@pennyfarthing/core 11.2.0 → 11.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -1
  3. package/packages/core/dist/cli/commands/doctor.d.ts.map +1 -1
  4. package/packages/core/dist/cli/commands/doctor.js +381 -66
  5. package/packages/core/dist/cli/commands/doctor.js.map +1 -1
  6. package/packages/core/dist/cli/commands/init.js +4 -4
  7. package/packages/core/dist/cli/commands/init.js.map +1 -1
  8. package/packages/core/dist/cli/commands/update.d.ts.map +1 -1
  9. package/packages/core/dist/cli/commands/update.js +4 -5
  10. package/packages/core/dist/cli/commands/update.js.map +1 -1
  11. package/packages/core/dist/cli/utils/constants.d.ts +3 -8
  12. package/packages/core/dist/cli/utils/constants.d.ts.map +1 -1
  13. package/packages/core/dist/cli/utils/constants.js +3 -4
  14. package/packages/core/dist/cli/utils/constants.js.map +1 -1
  15. package/packages/core/dist/cli/utils/settings.d.ts +11 -0
  16. package/packages/core/dist/cli/utils/settings.d.ts.map +1 -1
  17. package/packages/core/dist/cli/utils/settings.js +65 -29
  18. package/packages/core/dist/cli/utils/settings.js.map +1 -1
  19. package/packages/core/dist/cli/utils/symlinks.js +16 -16
  20. package/packages/core/dist/cli/utils/symlinks.js.map +1 -1
  21. package/packages/core/dist/consultation/tandem-metrics.d.ts +91 -0
  22. package/packages/core/dist/consultation/tandem-metrics.d.ts.map +1 -0
  23. package/packages/core/dist/consultation/tandem-metrics.js +131 -0
  24. package/packages/core/dist/consultation/tandem-metrics.js.map +1 -0
  25. package/packages/core/dist/consultation/tandem-metrics.test.d.ts +18 -0
  26. package/packages/core/dist/consultation/tandem-metrics.test.d.ts.map +1 -0
  27. package/packages/core/dist/consultation/tandem-metrics.test.js +457 -0
  28. package/packages/core/dist/consultation/tandem-metrics.test.js.map +1 -0
  29. package/packages/core/dist/public/js/react/react.js +14 -14
  30. package/packages/core/dist/scripts/benchmark-integration.d.ts +182 -0
  31. package/packages/core/dist/scripts/benchmark-integration.d.ts.map +1 -0
  32. package/packages/core/dist/scripts/benchmark-integration.js +691 -0
  33. package/packages/core/dist/scripts/benchmark-integration.js.map +1 -0
  34. package/packages/core/dist/scripts/job-fair-aggregator.d.ts +150 -0
  35. package/packages/core/dist/scripts/job-fair-aggregator.d.ts.map +1 -0
  36. package/packages/core/dist/scripts/job-fair-aggregator.js +547 -0
  37. package/packages/core/dist/scripts/job-fair-aggregator.js.map +1 -0
  38. package/packages/core/dist/server/api/agent-load.js +1 -1
  39. package/packages/core/dist/server/api/agent-load.js.map +1 -1
  40. package/packages/core/dist/server/server.d.ts +0 -3
  41. package/packages/core/dist/server/server.d.ts.map +1 -1
  42. package/packages/core/dist/server/server.js +3 -37
  43. package/packages/core/dist/server/server.js.map +1 -1
  44. package/packages/core/dist/server/server.test.d.ts +1 -1
  45. package/packages/core/dist/server/server.test.js +12 -23
  46. package/packages/core/dist/server/server.test.js.map +1 -1
  47. package/packages/core/dist/shared/capabilities.d.ts +88 -0
  48. package/packages/core/dist/shared/capabilities.d.ts.map +1 -0
  49. package/packages/core/dist/shared/capabilities.js +133 -0
  50. package/packages/core/dist/shared/capabilities.js.map +1 -0
  51. package/packages/core/dist/shared/capabilities.test.d.ts +2 -0
  52. package/packages/core/dist/shared/capabilities.test.d.ts.map +1 -0
  53. package/packages/core/dist/shared/capabilities.test.js +217 -0
  54. package/packages/core/dist/shared/capabilities.test.js.map +1 -0
  55. package/packages/core/dist/shared/spawn-prompt.d.ts +47 -0
  56. package/packages/core/dist/shared/spawn-prompt.d.ts.map +1 -0
  57. package/packages/core/dist/shared/spawn-prompt.js +82 -0
  58. package/packages/core/dist/shared/spawn-prompt.js.map +1 -0
  59. package/packages/core/dist/shared/spawn-prompt.test.d.ts +2 -0
  60. package/packages/core/dist/shared/spawn-prompt.test.d.ts.map +1 -0
  61. package/packages/core/dist/shared/spawn-prompt.test.js +251 -0
  62. package/packages/core/dist/shared/spawn-prompt.test.js.map +1 -0
  63. package/packages/core/dist/workflow/tandem-workflow-templates.test.d.ts +18 -0
  64. package/packages/core/dist/workflow/tandem-workflow-templates.test.d.ts.map +1 -0
  65. package/packages/core/dist/workflow/tandem-workflow-templates.test.js +434 -0
  66. package/packages/core/dist/workflow/tandem-workflow-templates.test.js.map +1 -0
  67. package/packages/core/dist/workflow/workflow-schema.d.ts +32 -0
  68. package/packages/core/dist/workflow/workflow-schema.d.ts.map +1 -1
  69. package/packages/core/dist/workflow/workflow-schema.js +120 -0
  70. package/packages/core/dist/workflow/workflow-schema.js.map +1 -1
  71. package/packages/core/dist/workflow/workflow-schema.test.d.ts.map +1 -1
  72. package/packages/core/dist/workflow/workflow-schema.test.js +570 -1
  73. package/packages/core/dist/workflow/workflow-schema.test.js.map +1 -1
  74. package/pennyfarthing-dist/agents/dev.md +6 -10
  75. package/pennyfarthing-dist/agents/reviewer.md +8 -2
  76. package/pennyfarthing-dist/agents/sm-finish.md +18 -1
  77. package/pennyfarthing-dist/commands/pf-git.md +4 -2
  78. package/pennyfarthing-dist/gates/approval.md +63 -0
  79. package/pennyfarthing-dist/gates/confidence-sm.md +71 -0
  80. package/pennyfarthing-dist/gates/context-ok.md +56 -0
  81. package/pennyfarthing-dist/gates/evaluations/confidence-sm.md +54 -0
  82. package/pennyfarthing-dist/gates/quality-pass.md +67 -0
  83. package/pennyfarthing-dist/gates/tests-fail.md +84 -0
  84. package/pennyfarthing-dist/gates/tests-pass.md +79 -0
  85. package/pennyfarthing-dist/guides/agent-behavior.md +23 -19
  86. package/pennyfarthing-dist/guides/bell-mode.md +1 -1
  87. package/pennyfarthing-dist/guides/hooks.md +28 -28
  88. package/pennyfarthing-dist/guides/reflector.md +1 -1
  89. package/pennyfarthing-dist/guides/tandem-protocol.md +3 -3
  90. package/pennyfarthing-dist/scripts/core/check-context.sh +2 -0
  91. package/pennyfarthing-dist/scripts/core/phase-check-start.sh +5 -87
  92. package/pennyfarthing-dist/scripts/hooks/README.md +5 -5
  93. package/pennyfarthing-dist/scripts/hooks/__pycache__/question_reflector_check.cpython-314.pyc +0 -0
  94. package/pennyfarthing-dist/scripts/hooks/bell-mode-hook.sh +4 -183
  95. package/pennyfarthing-dist/scripts/hooks/context-circuit-breaker.sh +4 -95
  96. package/pennyfarthing-dist/scripts/hooks/context-warning.sh +4 -65
  97. package/pennyfarthing-dist/scripts/hooks/cyclist-pretooluse-hook.sh +3 -31
  98. package/pennyfarthing-dist/scripts/hooks/pre-commit.sh +27 -33
  99. package/pennyfarthing-dist/scripts/hooks/pre-edit-check.sh +4 -71
  100. package/pennyfarthing-dist/scripts/hooks/question-reflector-check.sh +3 -19
  101. package/pennyfarthing-dist/scripts/hooks/schema-validation.sh +4 -30
  102. package/pennyfarthing-dist/scripts/hooks/session-start.sh +3 -32
  103. package/pennyfarthing-dist/scripts/hooks/session-stop.sh +4 -65
  104. package/pennyfarthing-dist/scripts/hooks/sprint-yaml-validation.sh +4 -78
  105. package/pennyfarthing-dist/scripts/hooks/welcome-hook.sh +4 -93
  106. package/pennyfarthing-dist/scripts/misc/README.md +1 -1
  107. package/pennyfarthing-dist/scripts/misc/statusline.sh +4 -301
  108. package/pennyfarthing-dist/templates/settings.local.json.template +19 -10
  109. package/pennyfarthing-dist/workflows/tdd.yaml +11 -2
  110. package/pennyfarthing_scripts/CLAUDE.md +19 -10
  111. package/pennyfarthing_scripts/__pycache__/__init__.cpython-311.pyc +0 -0
  112. package/pennyfarthing_scripts/__pycache__/__init__.cpython-314.pyc +0 -0
  113. package/pennyfarthing_scripts/__pycache__/bellmode_hook.cpython-314.pyc +0 -0
  114. package/pennyfarthing_scripts/__pycache__/cli.cpython-314.pyc +0 -0
  115. package/pennyfarthing_scripts/__pycache__/config.cpython-314.pyc +0 -0
  116. package/pennyfarthing_scripts/__pycache__/context.cpython-314.pyc +0 -0
  117. package/pennyfarthing_scripts/__pycache__/hooks.cpython-314.pyc +0 -0
  118. package/pennyfarthing_scripts/__pycache__/jira.cpython-314.pyc +0 -0
  119. package/pennyfarthing_scripts/__pycache__/jira_bidirectional_sync.cpython-314.pyc +0 -0
  120. package/pennyfarthing_scripts/__pycache__/jira_epic_creation.cpython-314.pyc +0 -0
  121. package/pennyfarthing_scripts/__pycache__/jira_sync.cpython-314.pyc +0 -0
  122. package/pennyfarthing_scripts/__pycache__/jira_sync_story.cpython-314.pyc +0 -0
  123. package/pennyfarthing_scripts/__pycache__/output.cpython-314.pyc +0 -0
  124. package/pennyfarthing_scripts/__pycache__/patch_mode.cpython-314.pyc +0 -0
  125. package/pennyfarthing_scripts/__pycache__/pretooluse_hook.cpython-314.pyc +0 -0
  126. package/pennyfarthing_scripts/__pycache__/schema_validation_hook.cpython-314.pyc +0 -0
  127. package/pennyfarthing_scripts/__pycache__/session_start_hook.cpython-314.pyc +0 -0
  128. package/pennyfarthing_scripts/__pycache__/sprint.cpython-314.pyc +0 -0
  129. package/pennyfarthing_scripts/__pycache__/workflow.cpython-311.pyc +0 -0
  130. package/pennyfarthing_scripts/__pycache__/workflow.cpython-314.pyc +0 -0
  131. package/pennyfarthing_scripts/bc/__pycache__/__init__.cpython-314.pyc +0 -0
  132. package/pennyfarthing_scripts/bc/__pycache__/cli.cpython-314.pyc +0 -0
  133. package/pennyfarthing_scripts/bc/__pycache__/focus.cpython-314.pyc +0 -0
  134. package/pennyfarthing_scripts/bellmode_hook.py +12 -296
  135. package/pennyfarthing_scripts/bikerack/__pycache__/__init__.cpython-314.pyc +0 -0
  136. package/pennyfarthing_scripts/bikerack/__pycache__/__main__.cpython-314.pyc +0 -0
  137. package/pennyfarthing_scripts/bikerack/__pycache__/audit_log_panel.cpython-314.pyc +0 -0
  138. package/pennyfarthing_scripts/bikerack/__pycache__/background_panel.cpython-314.pyc +0 -0
  139. package/pennyfarthing_scripts/bikerack/__pycache__/base_panel.cpython-314.pyc +0 -0
  140. package/pennyfarthing_scripts/bikerack/__pycache__/changed_panel.cpython-314.pyc +0 -0
  141. package/pennyfarthing_scripts/bikerack/__pycache__/cli.cpython-314.pyc +0 -0
  142. package/pennyfarthing_scripts/bikerack/__pycache__/context_meter_footer.cpython-314.pyc +0 -0
  143. package/pennyfarthing_scripts/bikerack/__pycache__/debug_panel.cpython-314.pyc +0 -0
  144. package/pennyfarthing_scripts/bikerack/__pycache__/diffs_panel.cpython-314.pyc +0 -0
  145. package/pennyfarthing_scripts/bikerack/__pycache__/events.cpython-314.pyc +0 -0
  146. package/pennyfarthing_scripts/bikerack/__pycache__/git_panel.cpython-314.pyc +0 -0
  147. package/pennyfarthing_scripts/bikerack/__pycache__/launcher.cpython-314.pyc +0 -0
  148. package/pennyfarthing_scripts/bikerack/__pycache__/portrait_resolver.cpython-314.pyc +0 -0
  149. package/pennyfarthing_scripts/bikerack/__pycache__/progress_panel.cpython-314.pyc +0 -0
  150. package/pennyfarthing_scripts/bikerack/__pycache__/sprint_panel.cpython-314.pyc +0 -0
  151. package/pennyfarthing_scripts/bikerack/__pycache__/story_detail_data.cpython-314.pyc +0 -0
  152. package/pennyfarthing_scripts/bikerack/__pycache__/story_detail_screen.cpython-314.pyc +0 -0
  153. package/pennyfarthing_scripts/bikerack/__pycache__/tui.cpython-314.pyc +0 -0
  154. package/pennyfarthing_scripts/bikerack/__pycache__/ws_client.cpython-314.pyc +0 -0
  155. package/pennyfarthing_scripts/bikerack/audit_log_panel.py +119 -0
  156. package/pennyfarthing_scripts/bikerack/base_panel.py +27 -4
  157. package/pennyfarthing_scripts/bikerack/changed_panel.py +96 -4
  158. package/pennyfarthing_scripts/bikerack/context_meter_footer.py +88 -0
  159. package/pennyfarthing_scripts/bikerack/debug_panel.py +1 -1
  160. package/pennyfarthing_scripts/bikerack/diffs_panel.py +30 -0
  161. package/pennyfarthing_scripts/bikerack/events.py +28 -0
  162. package/pennyfarthing_scripts/bikerack/portrait_resolver.py +139 -0
  163. package/pennyfarthing_scripts/bikerack/sprint_panel.py +373 -142
  164. package/pennyfarthing_scripts/bikerack/story_detail_data.py +244 -0
  165. package/pennyfarthing_scripts/bikerack/story_detail_screen.py +176 -0
  166. package/pennyfarthing_scripts/bikerack/tui.py +293 -61
  167. package/pennyfarthing_scripts/brownfield/__pycache__/__init__.cpython-314.pyc +0 -0
  168. package/pennyfarthing_scripts/brownfield/__pycache__/__main__.cpython-314.pyc +0 -0
  169. package/pennyfarthing_scripts/brownfield/__pycache__/cli.cpython-314.pyc +0 -0
  170. package/pennyfarthing_scripts/brownfield/__pycache__/discover.cpython-314.pyc +0 -0
  171. package/pennyfarthing_scripts/cli.py +5 -0
  172. package/pennyfarthing_scripts/codemarkers/__pycache__/__init__.cpython-314.pyc +0 -0
  173. package/pennyfarthing_scripts/codemarkers/__pycache__/__main__.cpython-314.pyc +0 -0
  174. package/pennyfarthing_scripts/codemarkers/__pycache__/analyze.cpython-314.pyc +0 -0
  175. package/pennyfarthing_scripts/codemarkers/__pycache__/cli.cpython-314.pyc +0 -0
  176. package/pennyfarthing_scripts/codemarkers/__pycache__/formatters.cpython-314.pyc +0 -0
  177. package/pennyfarthing_scripts/codemarkers/__pycache__/models.cpython-314.pyc +0 -0
  178. package/pennyfarthing_scripts/common/__pycache__/__init__.cpython-314.pyc +0 -0
  179. package/pennyfarthing_scripts/common/__pycache__/config.cpython-314.pyc +0 -0
  180. package/pennyfarthing_scripts/common/__pycache__/output.cpython-314.pyc +0 -0
  181. package/pennyfarthing_scripts/common/__pycache__/themes.cpython-314.pyc +0 -0
  182. package/pennyfarthing_scripts/common/pr_config.py +38 -0
  183. package/pennyfarthing_scripts/complexity/__pycache__/__init__.cpython-314.pyc +0 -0
  184. package/pennyfarthing_scripts/complexity/__pycache__/__main__.cpython-314.pyc +0 -0
  185. package/pennyfarthing_scripts/complexity/__pycache__/analyze.cpython-314.pyc +0 -0
  186. package/pennyfarthing_scripts/complexity/__pycache__/cli.cpython-314.pyc +0 -0
  187. package/pennyfarthing_scripts/complexity/__pycache__/formatters.cpython-314.pyc +0 -0
  188. package/pennyfarthing_scripts/complexity/__pycache__/models.cpython-314.pyc +0 -0
  189. package/pennyfarthing_scripts/consultation/__pycache__/__init__.cpython-314.pyc +0 -0
  190. package/pennyfarthing_scripts/consultation/__pycache__/cli.cpython-314.pyc +0 -0
  191. package/pennyfarthing_scripts/consultation/__pycache__/dialogue_manager.cpython-314.pyc +0 -0
  192. package/pennyfarthing_scripts/deadcode/__pycache__/__init__.cpython-314.pyc +0 -0
  193. package/pennyfarthing_scripts/deadcode/__pycache__/__main__.cpython-314.pyc +0 -0
  194. package/pennyfarthing_scripts/deadcode/__pycache__/analyze.cpython-314.pyc +0 -0
  195. package/pennyfarthing_scripts/deadcode/__pycache__/cli.cpython-314.pyc +0 -0
  196. package/pennyfarthing_scripts/deadcode/__pycache__/formatters.cpython-314.pyc +0 -0
  197. package/pennyfarthing_scripts/deadcode/__pycache__/models.cpython-314.pyc +0 -0
  198. package/pennyfarthing_scripts/dependencies/__pycache__/__init__.cpython-314.pyc +0 -0
  199. package/pennyfarthing_scripts/dependencies/__pycache__/__main__.cpython-314.pyc +0 -0
  200. package/pennyfarthing_scripts/dependencies/__pycache__/analyze.cpython-314.pyc +0 -0
  201. package/pennyfarthing_scripts/dependencies/__pycache__/cli.cpython-314.pyc +0 -0
  202. package/pennyfarthing_scripts/dependencies/__pycache__/formatters.cpython-314.pyc +0 -0
  203. package/pennyfarthing_scripts/dependencies/__pycache__/models.cpython-314.pyc +0 -0
  204. package/pennyfarthing_scripts/epic/__pycache__/__init__.cpython-314.pyc +0 -0
  205. package/pennyfarthing_scripts/epic/__pycache__/cli.cpython-314.pyc +0 -0
  206. package/pennyfarthing_scripts/git/__pycache__/__init__.cpython-314.pyc +0 -0
  207. package/pennyfarthing_scripts/git/__pycache__/create_branches.cpython-314.pyc +0 -0
  208. package/pennyfarthing_scripts/git/__pycache__/status_all.cpython-314.pyc +0 -0
  209. package/pennyfarthing_scripts/git_group/__pycache__/__init__.cpython-314.pyc +0 -0
  210. package/pennyfarthing_scripts/git_group/__pycache__/cli.cpython-314.pyc +0 -0
  211. package/pennyfarthing_scripts/handoff/__pycache__/__init__.cpython-314.pyc +0 -0
  212. package/pennyfarthing_scripts/handoff/__pycache__/cli.cpython-314.pyc +0 -0
  213. package/pennyfarthing_scripts/handoff/__pycache__/complete_phase.cpython-314.pyc +0 -0
  214. package/pennyfarthing_scripts/handoff/__pycache__/gate_file.cpython-314.pyc +0 -0
  215. package/pennyfarthing_scripts/handoff/__pycache__/gate_runner.cpython-314.pyc +0 -0
  216. package/pennyfarthing_scripts/handoff/__pycache__/marker.cpython-314.pyc +0 -0
  217. package/pennyfarthing_scripts/handoff/__pycache__/resolve_gate.cpython-314.pyc +0 -0
  218. package/pennyfarthing_scripts/handoff/cli.py +33 -1
  219. package/pennyfarthing_scripts/handoff/complete_phase.py +28 -0
  220. package/pennyfarthing_scripts/handoff/marker.py +15 -15
  221. package/pennyfarthing_scripts/handoff/phase_check.py +96 -0
  222. package/pennyfarthing_scripts/handoff/resolve_gate.py +13 -1
  223. package/pennyfarthing_scripts/healthscore/__pycache__/__init__.cpython-314.pyc +0 -0
  224. package/pennyfarthing_scripts/healthscore/__pycache__/__main__.cpython-314.pyc +0 -0
  225. package/pennyfarthing_scripts/healthscore/__pycache__/analyze.cpython-314.pyc +0 -0
  226. package/pennyfarthing_scripts/healthscore/__pycache__/cli.cpython-314.pyc +0 -0
  227. package/pennyfarthing_scripts/healthscore/__pycache__/formatters.cpython-314.pyc +0 -0
  228. package/pennyfarthing_scripts/healthscore/__pycache__/models.cpython-314.pyc +0 -0
  229. package/pennyfarthing_scripts/hooks/__init__.py +437 -0
  230. package/pennyfarthing_scripts/hooks/__pycache__/__init__.cpython-314.pyc +0 -0
  231. package/pennyfarthing_scripts/hooks/__pycache__/bell_mode.cpython-314.pyc +0 -0
  232. package/pennyfarthing_scripts/hooks/__pycache__/cli.cpython-314.pyc +0 -0
  233. package/pennyfarthing_scripts/hooks/__pycache__/context_breaker.cpython-314.pyc +0 -0
  234. package/pennyfarthing_scripts/hooks/__pycache__/context_warning.cpython-314.pyc +0 -0
  235. package/pennyfarthing_scripts/hooks/__pycache__/cyclist_pretooluse.cpython-314.pyc +0 -0
  236. package/pennyfarthing_scripts/hooks/__pycache__/pre_edit_check.cpython-314.pyc +0 -0
  237. package/pennyfarthing_scripts/hooks/__pycache__/reflector_check.cpython-314.pyc +0 -0
  238. package/pennyfarthing_scripts/hooks/__pycache__/schema_validation.cpython-314.pyc +0 -0
  239. package/pennyfarthing_scripts/hooks/__pycache__/session_start.cpython-314.pyc +0 -0
  240. package/pennyfarthing_scripts/hooks/__pycache__/session_stop.cpython-314.pyc +0 -0
  241. package/pennyfarthing_scripts/hooks/__pycache__/sprint_yaml_validation.cpython-314.pyc +0 -0
  242. package/pennyfarthing_scripts/hooks/__pycache__/statusline.cpython-314.pyc +0 -0
  243. package/pennyfarthing_scripts/hooks/bell_mode.py +215 -0
  244. package/pennyfarthing_scripts/hooks/cli.py +96 -0
  245. package/pennyfarthing_scripts/hooks/context_breaker.py +104 -0
  246. package/pennyfarthing_scripts/hooks/context_warning.py +66 -0
  247. package/pennyfarthing_scripts/hooks/cyclist_pretooluse.py +129 -0
  248. package/pennyfarthing_scripts/hooks/pre_edit_check.py +78 -0
  249. package/pennyfarthing_scripts/hooks/reflector_check.py +271 -0
  250. package/pennyfarthing_scripts/hooks/schema_validation.py +203 -0
  251. package/pennyfarthing_scripts/hooks/session_start.py +296 -0
  252. package/pennyfarthing_scripts/hooks/session_stop.py +111 -0
  253. package/pennyfarthing_scripts/hooks/sprint_yaml_validation.py +97 -0
  254. package/pennyfarthing_scripts/hooks/statusline.py +420 -0
  255. package/pennyfarthing_scripts/hooks.py +27 -432
  256. package/pennyfarthing_scripts/hotspots/__pycache__/__init__.cpython-314.pyc +0 -0
  257. package/pennyfarthing_scripts/hotspots/__pycache__/__main__.cpython-314.pyc +0 -0
  258. package/pennyfarthing_scripts/hotspots/__pycache__/analyze.cpython-314.pyc +0 -0
  259. package/pennyfarthing_scripts/hotspots/__pycache__/cli.cpython-314.pyc +0 -0
  260. package/pennyfarthing_scripts/hotspots/__pycache__/formatters.cpython-314.pyc +0 -0
  261. package/pennyfarthing_scripts/hotspots/__pycache__/models.cpython-314.pyc +0 -0
  262. package/pennyfarthing_scripts/jira/__pycache__/__init__.cpython-314.pyc +0 -0
  263. package/pennyfarthing_scripts/jira/__pycache__/__main__.cpython-314.pyc +0 -0
  264. package/pennyfarthing_scripts/jira/__pycache__/bidirectional.cpython-314.pyc +0 -0
  265. package/pennyfarthing_scripts/jira/__pycache__/claim.cpython-314.pyc +0 -0
  266. package/pennyfarthing_scripts/jira/__pycache__/cli.cpython-314.pyc +0 -0
  267. package/pennyfarthing_scripts/jira/__pycache__/client.cpython-314.pyc +0 -0
  268. package/pennyfarthing_scripts/jira/__pycache__/compat.cpython-314.pyc +0 -0
  269. package/pennyfarthing_scripts/jira/__pycache__/create.cpython-314.pyc +0 -0
  270. package/pennyfarthing_scripts/jira/__pycache__/epic.cpython-314.pyc +0 -0
  271. package/pennyfarthing_scripts/jira/__pycache__/mappings.cpython-314.pyc +0 -0
  272. package/pennyfarthing_scripts/jira/__pycache__/models.cpython-314.pyc +0 -0
  273. package/pennyfarthing_scripts/jira/__pycache__/operations.cpython-314.pyc +0 -0
  274. package/pennyfarthing_scripts/jira/__pycache__/reconcile.cpython-314.pyc +0 -0
  275. package/pennyfarthing_scripts/jira/__pycache__/story.cpython-314.pyc +0 -0
  276. package/pennyfarthing_scripts/jira/__pycache__/sync.cpython-314.pyc +0 -0
  277. package/pennyfarthing_scripts/launch/__pycache__/__init__.cpython-314.pyc +0 -0
  278. package/pennyfarthing_scripts/launch/__pycache__/cli.cpython-314.pyc +0 -0
  279. package/pennyfarthing_scripts/migration/__pycache__/__init__.cpython-314.pyc +0 -0
  280. package/pennyfarthing_scripts/migration/__pycache__/__main__.cpython-314.pyc +0 -0
  281. package/pennyfarthing_scripts/migration/__pycache__/cli.cpython-314.pyc +0 -0
  282. package/pennyfarthing_scripts/migration/__pycache__/session.cpython-314.pyc +0 -0
  283. package/pennyfarthing_scripts/migration/__pycache__/skill.cpython-314.pyc +0 -0
  284. package/pennyfarthing_scripts/migration/__pycache__/step.cpython-314.pyc +0 -0
  285. package/pennyfarthing_scripts/migration/__pycache__/validate.cpython-314.pyc +0 -0
  286. package/pennyfarthing_scripts/preflight/__pycache__/__init__.cpython-314.pyc +0 -0
  287. package/pennyfarthing_scripts/preflight/__pycache__/__main__.cpython-314.pyc +0 -0
  288. package/pennyfarthing_scripts/preflight/__pycache__/cli.cpython-314.pyc +0 -0
  289. package/pennyfarthing_scripts/preflight/__pycache__/finish.cpython-314.pyc +0 -0
  290. package/pennyfarthing_scripts/pretooluse_hook.py +3 -185
  291. package/pennyfarthing_scripts/prime/__pycache__/__init__.cpython-314.pyc +0 -0
  292. package/pennyfarthing_scripts/prime/__pycache__/__main__.cpython-314.pyc +0 -0
  293. package/pennyfarthing_scripts/prime/__pycache__/cli.cpython-314.pyc +0 -0
  294. package/pennyfarthing_scripts/prime/__pycache__/loader.cpython-314.pyc +0 -0
  295. package/pennyfarthing_scripts/prime/__pycache__/models.cpython-314.pyc +0 -0
  296. package/pennyfarthing_scripts/prime/__pycache__/persona.cpython-314.pyc +0 -0
  297. package/pennyfarthing_scripts/prime/__pycache__/session.cpython-314.pyc +0 -0
  298. package/pennyfarthing_scripts/prime/__pycache__/tiers.cpython-314.pyc +0 -0
  299. package/pennyfarthing_scripts/prime/__pycache__/version_sentinel.cpython-314.pyc +0 -0
  300. package/pennyfarthing_scripts/prime/__pycache__/workflow.cpython-314.pyc +0 -0
  301. package/pennyfarthing_scripts/prime/workflow.py +2 -1
  302. package/pennyfarthing_scripts/schema_validation_hook.py +3 -298
  303. package/pennyfarthing_scripts/session/__pycache__/__init__.cpython-314.pyc +0 -0
  304. package/pennyfarthing_scripts/session/__pycache__/cli.cpython-314.pyc +0 -0
  305. package/pennyfarthing_scripts/session_start_hook.py +4 -186
  306. package/pennyfarthing_scripts/sprint/__pycache__/__init__.cpython-314.pyc +0 -0
  307. package/pennyfarthing_scripts/sprint/__pycache__/__main__.cpython-314.pyc +0 -0
  308. package/pennyfarthing_scripts/sprint/__pycache__/archive.cpython-314.pyc +0 -0
  309. package/pennyfarthing_scripts/sprint/__pycache__/archive_epic.cpython-314.pyc +0 -0
  310. package/pennyfarthing_scripts/sprint/__pycache__/cli.cpython-314.pyc +0 -0
  311. package/pennyfarthing_scripts/sprint/__pycache__/epic_add.cpython-314.pyc +0 -0
  312. package/pennyfarthing_scripts/sprint/__pycache__/epic_update.cpython-314.pyc +0 -0
  313. package/pennyfarthing_scripts/sprint/__pycache__/import_epic.cpython-314.pyc +0 -0
  314. package/pennyfarthing_scripts/sprint/__pycache__/loader.cpython-314.pyc +0 -0
  315. package/pennyfarthing_scripts/sprint/__pycache__/status.cpython-314.pyc +0 -0
  316. package/pennyfarthing_scripts/sprint/__pycache__/story_add.cpython-314.pyc +0 -0
  317. package/pennyfarthing_scripts/sprint/__pycache__/story_finish.cpython-314.pyc +0 -0
  318. package/pennyfarthing_scripts/sprint/__pycache__/story_update.cpython-314.pyc +0 -0
  319. package/pennyfarthing_scripts/sprint/__pycache__/validate_cmd.cpython-314.pyc +0 -0
  320. package/pennyfarthing_scripts/sprint/__pycache__/validator.cpython-314.pyc +0 -0
  321. package/pennyfarthing_scripts/sprint/__pycache__/work.cpython-314.pyc +0 -0
  322. package/pennyfarthing_scripts/sprint/__pycache__/yaml_io.cpython-314.pyc +0 -0
  323. package/pennyfarthing_scripts/sprint/story_update.py +19 -0
  324. package/pennyfarthing_scripts/story/__pycache__/__init__.cpython-314.pyc +0 -0
  325. package/pennyfarthing_scripts/story/__pycache__/__main__.cpython-314.pyc +0 -0
  326. package/pennyfarthing_scripts/story/__pycache__/cli.cpython-314.pyc +0 -0
  327. package/pennyfarthing_scripts/story/__pycache__/create.cpython-314.pyc +0 -0
  328. package/pennyfarthing_scripts/story/__pycache__/size.cpython-314.pyc +0 -0
  329. package/pennyfarthing_scripts/story/__pycache__/template.cpython-314.pyc +0 -0
  330. package/pennyfarthing_scripts/tests/__pycache__/__init__.cpython-314.pyc +0 -0
  331. package/pennyfarthing_scripts/tests/__pycache__/conftest.cpython-314-pytest-9.0.2.pyc +0 -0
  332. package/pennyfarthing_scripts/tests/__pycache__/test_108_1_gate_migration.cpython-314-pytest-9.0.2.pyc +0 -0
  333. package/pennyfarthing_scripts/tests/__pycache__/test_archive_epic.cpython-314-pytest-9.0.2.pyc +0 -0
  334. package/pennyfarthing_scripts/tests/__pycache__/test_bc.cpython-314-pytest-9.0.2.pyc +0 -0
  335. package/pennyfarthing_scripts/tests/__pycache__/test_bikerack.cpython-314-pytest-9.0.2.pyc +0 -0
  336. package/pennyfarthing_scripts/tests/__pycache__/test_brownfield.cpython-314-pytest-9.0.2.pyc +0 -0
  337. package/pennyfarthing_scripts/tests/__pycache__/test_cli_modules.cpython-314-pytest-9.0.2.pyc +0 -0
  338. package/pennyfarthing_scripts/tests/__pycache__/test_cli_normalization.cpython-314-pytest-9.0.2.pyc +0 -0
  339. package/pennyfarthing_scripts/tests/__pycache__/test_codemarkers.cpython-314-pytest-9.0.2.pyc +0 -0
  340. package/pennyfarthing_scripts/tests/__pycache__/test_common.cpython-314-pytest-9.0.2.pyc +0 -0
  341. package/pennyfarthing_scripts/tests/__pycache__/test_confidence_sm_evaluation.cpython-314-pytest-9.0.2.pyc +0 -0
  342. package/pennyfarthing_scripts/tests/__pycache__/test_confidence_sm_gate.cpython-314-pytest-9.0.2.pyc +0 -0
  343. package/pennyfarthing_scripts/tests/__pycache__/test_dialogue_manager.cpython-314-pytest-9.0.2.pyc +0 -0
  344. package/pennyfarthing_scripts/tests/__pycache__/test_epic_shard_validation.cpython-314-pytest-9.0.2.pyc +0 -0
  345. package/pennyfarthing_scripts/tests/__pycache__/test_git_utils.cpython-314-pytest-9.0.2.pyc +0 -0
  346. package/pennyfarthing_scripts/tests/__pycache__/test_handoff_cli.cpython-314-pytest-9.0.2.pyc +0 -0
  347. package/pennyfarthing_scripts/tests/__pycache__/test_handoff_e2e.cpython-314-pytest-9.0.2.pyc +0 -0
  348. package/pennyfarthing_scripts/tests/__pycache__/test_healthscore.cpython-314-pytest-9.0.2.pyc +0 -0
  349. package/pennyfarthing_scripts/tests/__pycache__/test_jira_package.cpython-314-pytest-9.0.2.pyc +0 -0
  350. package/pennyfarthing_scripts/tests/__pycache__/test_package_structure.cpython-314-pytest-9.0.2.pyc +0 -0
  351. package/pennyfarthing_scripts/tests/__pycache__/test_patch_mode.cpython-314-pytest-9.0.2.pyc +0 -0
  352. package/pennyfarthing_scripts/tests/__pycache__/test_prime.cpython-314-pytest-9.0.2.pyc +0 -0
  353. package/pennyfarthing_scripts/tests/__pycache__/test_sprint_package.cpython-314-pytest-9.0.2.pyc +0 -0
  354. package/pennyfarthing_scripts/tests/__pycache__/test_sprint_panel.cpython-314-pytest-9.0.2.pyc +0 -0
  355. package/pennyfarthing_scripts/tests/__pycache__/test_sprint_validator.cpython-314-pytest-9.0.2.pyc +0 -0
  356. package/pennyfarthing_scripts/tests/__pycache__/test_story_add.cpython-314-pytest-9.0.2.pyc +0 -0
  357. package/pennyfarthing_scripts/tests/__pycache__/test_story_package.cpython-314-pytest-9.0.2.pyc +0 -0
  358. package/pennyfarthing_scripts/tests/__pycache__/test_story_update.cpython-314-pytest-9.0.2.pyc +0 -0
  359. package/pennyfarthing_scripts/tests/__pycache__/test_tiers.cpython-314-pytest-9.0.2.pyc +0 -0
  360. package/pennyfarthing_scripts/tests/__pycache__/test_token_counting.cpython-314-pytest-9.0.2.pyc +0 -0
  361. package/pennyfarthing_scripts/tests/__pycache__/test_topology_loader.cpython-314-pytest-9.0.2.pyc +0 -0
  362. package/pennyfarthing_scripts/tests/__pycache__/test_tui_focus.cpython-314-pytest-9.0.2.pyc +0 -0
  363. package/pennyfarthing_scripts/tests/__pycache__/test_tui_panel_persistence.cpython-314-pytest-9.0.2.pyc +0 -0
  364. package/pennyfarthing_scripts/tests/__pycache__/test_validate_cmd.cpython-314-pytest-9.0.2.pyc +0 -0
  365. package/pennyfarthing_scripts/tests/__pycache__/test_version_sentinel.cpython-314-pytest-9.0.2.pyc +0 -0
  366. package/pennyfarthing_scripts/tests/__pycache__/test_workflow_check.cpython-314-pytest-9.0.2.pyc +0 -0
  367. package/pennyfarthing_scripts/tests/__pycache__/test_workflow_cli.cpython-314-pytest-9.0.2.pyc +0 -0
  368. package/pennyfarthing_scripts/tests/__pycache__/test_yaml_io.cpython-314-pytest-9.0.2.pyc +0 -0
  369. package/pennyfarthing_scripts/tests/test_sprint_panel.py +344 -265
  370. package/pennyfarthing_scripts/theme/__pycache__/__init__.cpython-314.pyc +0 -0
  371. package/pennyfarthing_scripts/theme/__pycache__/cli.cpython-314.pyc +0 -0
  372. package/pennyfarthing_scripts/validate/__pycache__/__init__.cpython-314.pyc +0 -0
  373. package/pennyfarthing_scripts/validate/__pycache__/cli.cpython-314.pyc +0 -0
  374. package/pennyfarthing_scripts/validate/adapters/__pycache__/__init__.cpython-314.pyc +0 -0
  375. package/pennyfarthing_scripts/validate/adapters/__pycache__/agent.cpython-314.pyc +0 -0
  376. package/pennyfarthing_scripts/validate/adapters/__pycache__/schema.cpython-314.pyc +0 -0
  377. package/pennyfarthing_scripts/validate/adapters/__pycache__/skill_command.cpython-314.pyc +0 -0
  378. package/pennyfarthing_scripts/validate/adapters/__pycache__/sprint.cpython-314.pyc +0 -0
  379. package/pennyfarthing_scripts/validate/adapters/__pycache__/tandem_awareness.cpython-314.pyc +0 -0
  380. package/pennyfarthing_scripts/validate/adapters/__pycache__/workflow.cpython-314.pyc +0 -0
  381. package/pennyfarthing_scripts/validate/adapters/workflow.py +19 -0
  382. package/pennyfarthing_scripts/welcome_hook.py +3 -149
  383. package/pennyfarthing_scripts/workflow/__pycache__/__init__.cpython-314.pyc +0 -0
  384. package/pennyfarthing_scripts/workflow/__pycache__/cli.cpython-314.pyc +0 -0
  385. package/pennyfarthing_scripts/workflow/__pycache__/helpers.cpython-314.pyc +0 -0
  386. package/pennyfarthing_scripts/workflow/__pycache__/scale.cpython-314.pyc +0 -0
  387. package/pennyfarthing_scripts/workflow/__pycache__/state.cpython-314.pyc +0 -0
  388. package/pennyfarthing_scripts/workflow/cli.py +7 -6
  389. package/pennyfarthing_scripts/workflow/team_lifecycle.py +257 -0
  390. package/packages/core/dist/scripts/theme-detail.test.d.ts +0 -10
  391. package/packages/core/dist/scripts/theme-detail.test.js +0 -199
  392. package/pennyfarthing_scripts/bikerack/__pycache__/portrait.cpython-314.pyc +0 -0
  393. package/pennyfarthing_scripts/gate/__pycache__/__init__.cpython-314.pyc +0 -0
  394. package/pennyfarthing_scripts/gate/__pycache__/cli.cpython-314.pyc +0 -0
  395. package/pennyfarthing_scripts/gate/__pycache__/validate.cpython-314.pyc +0 -0
  396. package/pennyfarthing_scripts/git/__pycache__/hooks_installer.cpython-314.pyc +0 -0
  397. package/pennyfarthing_scripts/git/__pycache__/repos.cpython-314.pyc +0 -0
  398. package/pennyfarthing_scripts/git/__pycache__/worktree.cpython-314.pyc +0 -0
  399. package/pennyfarthing_scripts/prime/__pycache__/heatmap.cpython-314.pyc +0 -0
  400. package/pennyfarthing_scripts/tests/__pycache__/test_108_2_remove_handoff_fallback.cpython-314-pytest-9.0.2.pyc +0 -0
  401. package/pennyfarthing_scripts/tests/__pycache__/test_gate_file_resolution.cpython-314-pytest-9.0.2.pyc +0 -0
  402. package/pennyfarthing_scripts/tests/__pycache__/test_gate_runner.cpython-314-pytest-9.0.2.pyc +0 -0
  403. package/pennyfarthing_scripts/tests/__pycache__/test_resolve_gate_file_field.cpython-314-pytest-9.0.2.pyc +0 -0
@@ -1,12 +1,12 @@
1
- function JA(n,e){for(var i=0;i<e.length;i++){const a=e[i];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in n)){const c=Object.getOwnPropertyDescriptor(a,r);c&&Object.defineProperty(n,r,c.get?c:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}function sw(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ch={exports:{}},Vo={};var eb;function eN(){if(eb)return Vo;eb=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(a,r,c){var d=null;if(c!==void 0&&(d=""+c),r.key!==void 0&&(d=""+r.key),"key"in r){c={};for(var h in r)h!=="key"&&(c[h]=r[h])}else c=r;return r=c.ref,{$$typeof:n,type:a,key:d,ref:r!==void 0?r:null,props:c}}return Vo.Fragment=e,Vo.jsx=i,Vo.jsxs=i,Vo}var tb;function tN(){return tb||(tb=1,Ch.exports=eN()),Ch.exports}var l=tN(),_h={exports:{}},Fo={},Eh={exports:{}},Dh={};var nb;function nN(){return nb||(nb=1,(function(n){function e(M,K){var q=M.length;M.push(K);e:for(;0<q;){var he=q-1>>>1,Se=M[he];if(0<r(Se,K))M[he]=K,M[q]=Se,q=he;else break e}}function i(M){return M.length===0?null:M[0]}function a(M){if(M.length===0)return null;var K=M[0],q=M.pop();if(q!==K){M[0]=q;e:for(var he=0,Se=M.length,I=Se>>>1;he<I;){var L=2*(he+1)-1,ee=M[L],V=L+1,Y=M[V];if(0>r(ee,q))V<Se&&0>r(Y,ee)?(M[he]=Y,M[V]=q,he=V):(M[he]=ee,M[L]=q,he=L);else if(V<Se&&0>r(Y,q))M[he]=Y,M[V]=q,he=V;else break e}}return K}function r(M,K){var q=M.sortIndex-K.sortIndex;return q!==0?q:M.id-K.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();n.unstable_now=function(){return d.now()-h}}var f=[],p=[],y=1,b=null,x=3,w=!1,E=!1,_=!1,C=!1,D=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function T(M){for(var K=i(p);K!==null;){if(K.callback===null)a(p);else if(K.startTime<=M)a(p),K.sortIndex=K.expirationTime,e(f,K);else break;K=i(p)}}function R(M){if(_=!1,T(M),!E)if(i(f)!==null)E=!0,z||(z=!0,$());else{var K=i(p);K!==null&&W(R,K.startTime-M)}}var z=!1,O=-1,A=5,G=-1;function U(){return C?!0:!(n.unstable_now()-G<A)}function B(){if(C=!1,z){var M=n.unstable_now();G=M;var K=!0;try{e:{E=!1,_&&(_=!1,N(O),O=-1),w=!0;var q=x;try{t:{for(T(M),b=i(f);b!==null&&!(b.expirationTime>M&&U());){var he=b.callback;if(typeof he=="function"){b.callback=null,x=b.priorityLevel;var Se=he(b.expirationTime<=M);if(M=n.unstable_now(),typeof Se=="function"){b.callback=Se,T(M),K=!0;break t}b===i(f)&&a(f),T(M)}else a(f);b=i(f)}if(b!==null)K=!0;else{var I=i(p);I!==null&&W(R,I.startTime-M),K=!1}}break e}finally{b=null,x=q,w=!1}K=void 0}}finally{K?$():z=!1}}}var $;if(typeof k=="function")$=function(){k(B)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,ne=ae.port2;ae.port1.onmessage=B,$=function(){ne.postMessage(null)}}else $=function(){D(B,0)};function W(M,K){O=D(function(){M(n.unstable_now())},K)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(M){M.callback=null},n.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<M?Math.floor(1e3/M):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(M){switch(x){case 1:case 2:case 3:var K=3;break;default:K=x}var q=x;x=K;try{return M()}finally{x=q}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(M,K){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var q=x;x=M;try{return K()}finally{x=q}},n.unstable_scheduleCallback=function(M,K,q){var he=n.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?he+q:he):q=he,M){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=q+Se,M={id:y++,callback:K,priorityLevel:M,startTime:q,expirationTime:Se,sortIndex:-1},q>he?(M.sortIndex=q,e(p,M),i(f)===null&&M===i(p)&&(_?(N(O),O=-1):_=!0,W(R,q-he))):(M.sortIndex=Se,e(f,M),E||w||(E=!0,z||(z=!0,$()))),M},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(M){var K=x;return function(){var q=x;x=K;try{return M.apply(this,arguments)}finally{x=q}}}})(Dh)),Dh}var ib;function iN(){return ib||(ib=1,Eh.exports=nN()),Eh.exports}var Ah={exports:{}},ke={};var sb;function sN(){if(sb)return ke;sb=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),x=Symbol.iterator;function w(I){return I===null||typeof I!="object"?null:(I=x&&I[x]||I["@@iterator"],typeof I=="function"?I:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,C={};function D(I,L,ee){this.props=I,this.context=L,this.refs=C,this.updater=ee||E}D.prototype.isReactComponent={},D.prototype.setState=function(I,L){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,L,"setState")},D.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function N(){}N.prototype=D.prototype;function k(I,L,ee){this.props=I,this.context=L,this.refs=C,this.updater=ee||E}var T=k.prototype=new N;T.constructor=k,_(T,D.prototype),T.isPureReactComponent=!0;var R=Array.isArray;function z(){}var O={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function G(I,L,ee){var V=ee.ref;return{$$typeof:n,type:I,key:L,ref:V!==void 0?V:null,props:ee}}function U(I,L){return G(I.type,L,I.props)}function B(I){return typeof I=="object"&&I!==null&&I.$$typeof===n}function $(I){var L={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(ee){return L[ee]})}var ae=/\/+/g;function ne(I,L){return typeof I=="object"&&I!==null&&I.key!=null?$(""+I.key):L.toString(36)}function W(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(z,z):(I.status="pending",I.then(function(L){I.status==="pending"&&(I.status="fulfilled",I.value=L)},function(L){I.status==="pending"&&(I.status="rejected",I.reason=L)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function M(I,L,ee,V,Y){var le=typeof I;(le==="undefined"||le==="boolean")&&(I=null);var X=!1;if(I===null)X=!0;else switch(le){case"bigint":case"string":case"number":X=!0;break;case"object":switch(I.$$typeof){case n:case e:X=!0;break;case y:return X=I._init,M(X(I._payload),L,ee,V,Y)}}if(X)return Y=Y(I),X=V===""?"."+ne(I,0):V,R(Y)?(ee="",X!=null&&(ee=X.replace(ae,"$&/")+"/"),M(Y,L,ee,"",function(De){return De})):Y!=null&&(B(Y)&&(Y=U(Y,ee+(Y.key==null||I&&I.key===Y.key?"":(""+Y.key).replace(ae,"$&/")+"/")+X)),L.push(Y)),1;X=0;var ce=V===""?".":V+":";if(R(I))for(var de=0;de<I.length;de++)V=I[de],le=ce+ne(V,de),X+=M(V,L,ee,le,Y);else if(de=w(I),typeof de=="function")for(I=de.call(I),de=0;!(V=I.next()).done;)V=V.value,le=ce+ne(V,de++),X+=M(V,L,ee,le,Y);else if(le==="object"){if(typeof I.then=="function")return M(W(I),L,ee,V,Y);throw L=String(I),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.")}return X}function K(I,L,ee){if(I==null)return I;var V=[],Y=0;return M(I,V,"","",function(le){return L.call(ee,le,Y++)}),V}function q(I){if(I._status===-1){var L=I._result;L=L(),L.then(function(ee){(I._status===0||I._status===-1)&&(I._status=1,I._result=ee)},function(ee){(I._status===0||I._status===-1)&&(I._status=2,I._result=ee)}),I._status===-1&&(I._status=0,I._result=L)}if(I._status===1)return I._result.default;throw I._result}var he=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var L=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(L))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},Se={map:K,forEach:function(I,L,ee){K(I,function(){L.apply(this,arguments)},ee)},count:function(I){var L=0;return K(I,function(){L++}),L},toArray:function(I){return K(I,function(L){return L})||[]},only:function(I){if(!B(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return ke.Activity=b,ke.Children=Se,ke.Component=D,ke.Fragment=i,ke.Profiler=r,ke.PureComponent=k,ke.StrictMode=a,ke.Suspense=f,ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,ke.__COMPILER_RUNTIME={__proto__:null,c:function(I){return O.H.useMemoCache(I)}},ke.cache=function(I){return function(){return I.apply(null,arguments)}},ke.cacheSignal=function(){return null},ke.cloneElement=function(I,L,ee){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var V=_({},I.props),Y=I.key;if(L!=null)for(le in L.key!==void 0&&(Y=""+L.key),L)!A.call(L,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&L.ref===void 0||(V[le]=L[le]);var le=arguments.length-2;if(le===1)V.children=ee;else if(1<le){for(var X=Array(le),ce=0;ce<le;ce++)X[ce]=arguments[ce+2];V.children=X}return G(I.type,Y,V)},ke.createContext=function(I){return I={$$typeof:d,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:c,_context:I},I},ke.createElement=function(I,L,ee){var V,Y={},le=null;if(L!=null)for(V in L.key!==void 0&&(le=""+L.key),L)A.call(L,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(Y[V]=L[V]);var X=arguments.length-2;if(X===1)Y.children=ee;else if(1<X){for(var ce=Array(X),de=0;de<X;de++)ce[de]=arguments[de+2];Y.children=ce}if(I&&I.defaultProps)for(V in X=I.defaultProps,X)Y[V]===void 0&&(Y[V]=X[V]);return G(I,le,Y)},ke.createRef=function(){return{current:null}},ke.forwardRef=function(I){return{$$typeof:h,render:I}},ke.isValidElement=B,ke.lazy=function(I){return{$$typeof:y,_payload:{_status:-1,_result:I},_init:q}},ke.memo=function(I,L){return{$$typeof:p,type:I,compare:L===void 0?null:L}},ke.startTransition=function(I){var L=O.T,ee={};O.T=ee;try{var V=I(),Y=O.S;Y!==null&&Y(ee,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(z,he)}catch(le){he(le)}finally{L!==null&&ee.types!==null&&(L.types=ee.types),O.T=L}},ke.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},ke.use=function(I){return O.H.use(I)},ke.useActionState=function(I,L,ee){return O.H.useActionState(I,L,ee)},ke.useCallback=function(I,L){return O.H.useCallback(I,L)},ke.useContext=function(I){return O.H.useContext(I)},ke.useDebugValue=function(){},ke.useDeferredValue=function(I,L){return O.H.useDeferredValue(I,L)},ke.useEffect=function(I,L){return O.H.useEffect(I,L)},ke.useEffectEvent=function(I){return O.H.useEffectEvent(I)},ke.useId=function(){return O.H.useId()},ke.useImperativeHandle=function(I,L,ee){return O.H.useImperativeHandle(I,L,ee)},ke.useInsertionEffect=function(I,L){return O.H.useInsertionEffect(I,L)},ke.useLayoutEffect=function(I,L){return O.H.useLayoutEffect(I,L)},ke.useMemo=function(I,L){return O.H.useMemo(I,L)},ke.useOptimistic=function(I,L){return O.H.useOptimistic(I,L)},ke.useReducer=function(I,L,ee){return O.H.useReducer(I,L,ee)},ke.useRef=function(I){return O.H.useRef(I)},ke.useState=function(I){return O.H.useState(I)},ke.useSyncExternalStore=function(I,L,ee){return O.H.useSyncExternalStore(I,L,ee)},ke.useTransition=function(){return O.H.useTransition()},ke.version="19.2.4",ke}var ab;function If(){return ab||(ab=1,Ah.exports=sN()),Ah.exports}var Nh={exports:{}},Ot={};var ob;function aN(){if(ob)return Ot;ob=1;var n=If();function e(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var a={d:{f:i,r:function(){throw Error(e(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},r=Symbol.for("react.portal");function c(f,p,y){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:b==null?null:""+b,children:f,containerInfo:p,implementation:y}}var d=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ot.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Ot.createPortal=function(f,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(e(299));return c(f,p,null,y)},Ot.flushSync=function(f){var p=d.T,y=a.p;try{if(d.T=null,a.p=2,f)return f()}finally{d.T=p,a.p=y,a.d.f()}},Ot.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(f,p))},Ot.prefetchDNS=function(f){typeof f=="string"&&a.d.D(f)},Ot.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var y=p.as,b=h(y,p.crossOrigin),x=typeof p.integrity=="string"?p.integrity:void 0,w=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?a.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:b,integrity:x,fetchPriority:w}):y==="script"&&a.d.X(f,{crossOrigin:b,integrity:x,fetchPriority:w,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ot.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=h(p.as,p.crossOrigin);a.d.M(f,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(f)},Ot.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,b=h(y,p.crossOrigin);a.d.L(f,y,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Ot.preloadModule=function(f,p){if(typeof f=="string")if(p){var y=h(p.as,p.crossOrigin);a.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(f)},Ot.requestFormReset=function(f){a.d.r(f)},Ot.unstable_batchedUpdates=function(f,p){return f(p)},Ot.useFormState=function(f,p,y){return d.H.useFormState(f,p,y)},Ot.useFormStatus=function(){return d.H.useHostTransitionStatus()},Ot.version="19.2.4",Ot}var rb;function aw(){if(rb)return Nh.exports;rb=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Nh.exports=aN(),Nh.exports}var lb;function oN(){if(lb)return Fo;lb=1;var n=iN(),e=If(),i=aw();function a(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var s=t,o=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(o=s.return),t=s.return;while(t)}return s.tag===3?o:null}function d(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function h(t){if(t.tag===31){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function f(t){if(c(t)!==t)throw Error(a(188))}function p(t){var s=t.alternate;if(!s){if(s=c(t),s===null)throw Error(a(188));return s!==t?null:t}for(var o=t,u=s;;){var g=o.return;if(g===null)break;var v=g.alternate;if(v===null){if(u=g.return,u!==null){o=u;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===o)return f(g),t;if(v===u)return f(g),s;v=v.sibling}throw Error(a(188))}if(o.return!==u.return)o=g,u=v;else{for(var S=!1,j=g.child;j;){if(j===o){S=!0,o=g,u=v;break}if(j===u){S=!0,u=g,o=v;break}j=j.sibling}if(!S){for(j=v.child;j;){if(j===o){S=!0,o=v,u=g;break}if(j===u){S=!0,u=v,o=g;break}j=j.sibling}if(!S)throw Error(a(189))}}if(o.alternate!==u)throw Error(a(190))}if(o.tag!==3)throw Error(a(188));return o.stateNode.current===o?t:s}function y(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=y(t),s!==null)return s;t=t.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),k=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function $(t){return t===null||typeof t!="object"?null:(t=B&&t[B]||t["@@iterator"],typeof t=="function"?t:null)}var ae=Symbol.for("react.client.reference");function ne(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ae?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case _:return"Fragment";case D:return"Profiler";case C:return"StrictMode";case R:return"Suspense";case z:return"SuspenseList";case G:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case k:return t.displayName||"Context";case N:return(t._context.displayName||"Context")+".Consumer";case T:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case O:return s=t.displayName||null,s!==null?s:ne(t.type)||"Memo";case A:s=t._payload,t=t._init;try{return ne(t(s))}catch{}}return null}var W=Array.isArray,M=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q={pending:!1,data:null,method:null,action:null},he=[],Se=-1;function I(t){return{current:t}}function L(t){0>Se||(t.current=he[Se],he[Se]=null,Se--)}function ee(t,s){Se++,he[Se]=t.current,t.current=s}var V=I(null),Y=I(null),le=I(null),X=I(null);function ce(t,s){switch(ee(le,s),ee(Y,t),ee(V,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?Cy(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=Cy(s),t=_y(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}L(V),ee(V,t)}function de(){L(V),L(Y),L(le)}function De(t){t.memoizedState!==null&&ee(X,t);var s=V.current,o=_y(s,t.type);s!==o&&(ee(Y,t),ee(V,o))}function Ge(t){Y.current===t&&(L(V),L(Y)),X.current===t&&(L(X),Io._currentValue=q)}var Ne,dt;function rt(t){if(Ne===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Ne=s&&s[1]||"",dt=-1<o.stack.indexOf(`
1
+ function JA(n,e){for(var i=0;i<e.length;i++){const a=e[i];if(typeof a!="string"&&!Array.isArray(a)){for(const r in a)if(r!=="default"&&!(r in n)){const c=Object.getOwnPropertyDescriptor(a,r);c&&Object.defineProperty(n,r,c.get?c:{enumerable:!0,get:()=>a[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}function sw(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ch={exports:{}},Vo={};var eb;function eN(){if(eb)return Vo;eb=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(a,r,c){var d=null;if(c!==void 0&&(d=""+c),r.key!==void 0&&(d=""+r.key),"key"in r){c={};for(var h in r)h!=="key"&&(c[h]=r[h])}else c=r;return r=c.ref,{$$typeof:n,type:a,key:d,ref:r!==void 0?r:null,props:c}}return Vo.Fragment=e,Vo.jsx=i,Vo.jsxs=i,Vo}var tb;function tN(){return tb||(tb=1,Ch.exports=eN()),Ch.exports}var l=tN(),_h={exports:{}},Fo={},Eh={exports:{}},Dh={};var nb;function nN(){return nb||(nb=1,(function(n){function e(M,K){var q=M.length;M.push(K);e:for(;0<q;){var he=q-1>>>1,Se=M[he];if(0<r(Se,K))M[he]=K,M[q]=Se,q=he;else break e}}function i(M){return M.length===0?null:M[0]}function a(M){if(M.length===0)return null;var K=M[0],q=M.pop();if(q!==K){M[0]=q;e:for(var he=0,Se=M.length,I=Se>>>1;he<I;){var L=2*(he+1)-1,ee=M[L],V=L+1,Y=M[V];if(0>r(ee,q))V<Se&&0>r(Y,ee)?(M[he]=Y,M[V]=q,he=V):(M[he]=ee,M[L]=q,he=L);else if(V<Se&&0>r(Y,q))M[he]=Y,M[V]=q,he=V;else break e}}return K}function r(M,K){var q=M.sortIndex-K.sortIndex;return q!==0?q:M.id-K.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;n.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();n.unstable_now=function(){return d.now()-h}}var f=[],p=[],y=1,b=null,x=3,w=!1,E=!1,C=!1,S=!1,D=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function T(M){for(var K=i(p);K!==null;){if(K.callback===null)a(p);else if(K.startTime<=M)a(p),K.sortIndex=K.expirationTime,e(f,K);else break;K=i(p)}}function R(M){if(C=!1,T(M),!E)if(i(f)!==null)E=!0,z||(z=!0,$());else{var K=i(p);K!==null&&W(R,K.startTime-M)}}var z=!1,O=-1,A=5,G=-1;function U(){return S?!0:!(n.unstable_now()-G<A)}function B(){if(S=!1,z){var M=n.unstable_now();G=M;var K=!0;try{e:{E=!1,C&&(C=!1,N(O),O=-1),w=!0;var q=x;try{t:{for(T(M),b=i(f);b!==null&&!(b.expirationTime>M&&U());){var he=b.callback;if(typeof he=="function"){b.callback=null,x=b.priorityLevel;var Se=he(b.expirationTime<=M);if(M=n.unstable_now(),typeof Se=="function"){b.callback=Se,T(M),K=!0;break t}b===i(f)&&a(f),T(M)}else a(f);b=i(f)}if(b!==null)K=!0;else{var I=i(p);I!==null&&W(R,I.startTime-M),K=!1}}break e}finally{b=null,x=q,w=!1}K=void 0}}finally{K?$():z=!1}}}var $;if(typeof k=="function")$=function(){k(B)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,ne=ae.port2;ae.port1.onmessage=B,$=function(){ne.postMessage(null)}}else $=function(){D(B,0)};function W(M,K){O=D(function(){M(n.unstable_now())},K)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(M){M.callback=null},n.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<M?Math.floor(1e3/M):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(M){switch(x){case 1:case 2:case 3:var K=3;break;default:K=x}var q=x;x=K;try{return M()}finally{x=q}},n.unstable_requestPaint=function(){S=!0},n.unstable_runWithPriority=function(M,K){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var q=x;x=M;try{return K()}finally{x=q}},n.unstable_scheduleCallback=function(M,K,q){var he=n.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?he+q:he):q=he,M){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=q+Se,M={id:y++,callback:K,priorityLevel:M,startTime:q,expirationTime:Se,sortIndex:-1},q>he?(M.sortIndex=q,e(p,M),i(f)===null&&M===i(p)&&(C?(N(O),O=-1):C=!0,W(R,q-he))):(M.sortIndex=Se,e(f,M),E||w||(E=!0,z||(z=!0,$()))),M},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(M){var K=x;return function(){var q=x;x=K;try{return M.apply(this,arguments)}finally{x=q}}}})(Dh)),Dh}var ib;function iN(){return ib||(ib=1,Eh.exports=nN()),Eh.exports}var Ah={exports:{}},ke={};var sb;function sN(){if(sb)return ke;sb=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),x=Symbol.iterator;function w(I){return I===null||typeof I!="object"?null:(I=x&&I[x]||I["@@iterator"],typeof I=="function"?I:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,S={};function D(I,L,ee){this.props=I,this.context=L,this.refs=S,this.updater=ee||E}D.prototype.isReactComponent={},D.prototype.setState=function(I,L){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,L,"setState")},D.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function N(){}N.prototype=D.prototype;function k(I,L,ee){this.props=I,this.context=L,this.refs=S,this.updater=ee||E}var T=k.prototype=new N;T.constructor=k,C(T,D.prototype),T.isPureReactComponent=!0;var R=Array.isArray;function z(){}var O={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function G(I,L,ee){var V=ee.ref;return{$$typeof:n,type:I,key:L,ref:V!==void 0?V:null,props:ee}}function U(I,L){return G(I.type,L,I.props)}function B(I){return typeof I=="object"&&I!==null&&I.$$typeof===n}function $(I){var L={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(ee){return L[ee]})}var ae=/\/+/g;function ne(I,L){return typeof I=="object"&&I!==null&&I.key!=null?$(""+I.key):L.toString(36)}function W(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(z,z):(I.status="pending",I.then(function(L){I.status==="pending"&&(I.status="fulfilled",I.value=L)},function(L){I.status==="pending"&&(I.status="rejected",I.reason=L)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function M(I,L,ee,V,Y){var le=typeof I;(le==="undefined"||le==="boolean")&&(I=null);var X=!1;if(I===null)X=!0;else switch(le){case"bigint":case"string":case"number":X=!0;break;case"object":switch(I.$$typeof){case n:case e:X=!0;break;case y:return X=I._init,M(X(I._payload),L,ee,V,Y)}}if(X)return Y=Y(I),X=V===""?"."+ne(I,0):V,R(Y)?(ee="",X!=null&&(ee=X.replace(ae,"$&/")+"/"),M(Y,L,ee,"",function(De){return De})):Y!=null&&(B(Y)&&(Y=U(Y,ee+(Y.key==null||I&&I.key===Y.key?"":(""+Y.key).replace(ae,"$&/")+"/")+X)),L.push(Y)),1;X=0;var ce=V===""?".":V+":";if(R(I))for(var de=0;de<I.length;de++)V=I[de],le=ce+ne(V,de),X+=M(V,L,ee,le,Y);else if(de=w(I),typeof de=="function")for(I=de.call(I),de=0;!(V=I.next()).done;)V=V.value,le=ce+ne(V,de++),X+=M(V,L,ee,le,Y);else if(le==="object"){if(typeof I.then=="function")return M(W(I),L,ee,V,Y);throw L=String(I),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.")}return X}function K(I,L,ee){if(I==null)return I;var V=[],Y=0;return M(I,V,"","",function(le){return L.call(ee,le,Y++)}),V}function q(I){if(I._status===-1){var L=I._result;L=L(),L.then(function(ee){(I._status===0||I._status===-1)&&(I._status=1,I._result=ee)},function(ee){(I._status===0||I._status===-1)&&(I._status=2,I._result=ee)}),I._status===-1&&(I._status=0,I._result=L)}if(I._status===1)return I._result.default;throw I._result}var he=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var L=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(L))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},Se={map:K,forEach:function(I,L,ee){K(I,function(){L.apply(this,arguments)},ee)},count:function(I){var L=0;return K(I,function(){L++}),L},toArray:function(I){return K(I,function(L){return L})||[]},only:function(I){if(!B(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return ke.Activity=b,ke.Children=Se,ke.Component=D,ke.Fragment=i,ke.Profiler=r,ke.PureComponent=k,ke.StrictMode=a,ke.Suspense=f,ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,ke.__COMPILER_RUNTIME={__proto__:null,c:function(I){return O.H.useMemoCache(I)}},ke.cache=function(I){return function(){return I.apply(null,arguments)}},ke.cacheSignal=function(){return null},ke.cloneElement=function(I,L,ee){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var V=C({},I.props),Y=I.key;if(L!=null)for(le in L.key!==void 0&&(Y=""+L.key),L)!A.call(L,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&L.ref===void 0||(V[le]=L[le]);var le=arguments.length-2;if(le===1)V.children=ee;else if(1<le){for(var X=Array(le),ce=0;ce<le;ce++)X[ce]=arguments[ce+2];V.children=X}return G(I.type,Y,V)},ke.createContext=function(I){return I={$$typeof:d,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:c,_context:I},I},ke.createElement=function(I,L,ee){var V,Y={},le=null;if(L!=null)for(V in L.key!==void 0&&(le=""+L.key),L)A.call(L,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(Y[V]=L[V]);var X=arguments.length-2;if(X===1)Y.children=ee;else if(1<X){for(var ce=Array(X),de=0;de<X;de++)ce[de]=arguments[de+2];Y.children=ce}if(I&&I.defaultProps)for(V in X=I.defaultProps,X)Y[V]===void 0&&(Y[V]=X[V]);return G(I,le,Y)},ke.createRef=function(){return{current:null}},ke.forwardRef=function(I){return{$$typeof:h,render:I}},ke.isValidElement=B,ke.lazy=function(I){return{$$typeof:y,_payload:{_status:-1,_result:I},_init:q}},ke.memo=function(I,L){return{$$typeof:p,type:I,compare:L===void 0?null:L}},ke.startTransition=function(I){var L=O.T,ee={};O.T=ee;try{var V=I(),Y=O.S;Y!==null&&Y(ee,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(z,he)}catch(le){he(le)}finally{L!==null&&ee.types!==null&&(L.types=ee.types),O.T=L}},ke.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},ke.use=function(I){return O.H.use(I)},ke.useActionState=function(I,L,ee){return O.H.useActionState(I,L,ee)},ke.useCallback=function(I,L){return O.H.useCallback(I,L)},ke.useContext=function(I){return O.H.useContext(I)},ke.useDebugValue=function(){},ke.useDeferredValue=function(I,L){return O.H.useDeferredValue(I,L)},ke.useEffect=function(I,L){return O.H.useEffect(I,L)},ke.useEffectEvent=function(I){return O.H.useEffectEvent(I)},ke.useId=function(){return O.H.useId()},ke.useImperativeHandle=function(I,L,ee){return O.H.useImperativeHandle(I,L,ee)},ke.useInsertionEffect=function(I,L){return O.H.useInsertionEffect(I,L)},ke.useLayoutEffect=function(I,L){return O.H.useLayoutEffect(I,L)},ke.useMemo=function(I,L){return O.H.useMemo(I,L)},ke.useOptimistic=function(I,L){return O.H.useOptimistic(I,L)},ke.useReducer=function(I,L,ee){return O.H.useReducer(I,L,ee)},ke.useRef=function(I){return O.H.useRef(I)},ke.useState=function(I){return O.H.useState(I)},ke.useSyncExternalStore=function(I,L,ee){return O.H.useSyncExternalStore(I,L,ee)},ke.useTransition=function(){return O.H.useTransition()},ke.version="19.2.4",ke}var ab;function If(){return ab||(ab=1,Ah.exports=sN()),Ah.exports}var Nh={exports:{}},Ot={};var ob;function aN(){if(ob)return Ot;ob=1;var n=If();function e(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var a={d:{f:i,r:function(){throw Error(e(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},r=Symbol.for("react.portal");function c(f,p,y){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:b==null?null:""+b,children:f,containerInfo:p,implementation:y}}var d=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ot.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Ot.createPortal=function(f,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(e(299));return c(f,p,null,y)},Ot.flushSync=function(f){var p=d.T,y=a.p;try{if(d.T=null,a.p=2,f)return f()}finally{d.T=p,a.p=y,a.d.f()}},Ot.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(f,p))},Ot.prefetchDNS=function(f){typeof f=="string"&&a.d.D(f)},Ot.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var y=p.as,b=h(y,p.crossOrigin),x=typeof p.integrity=="string"?p.integrity:void 0,w=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?a.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:b,integrity:x,fetchPriority:w}):y==="script"&&a.d.X(f,{crossOrigin:b,integrity:x,fetchPriority:w,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ot.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=h(p.as,p.crossOrigin);a.d.M(f,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(f)},Ot.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,b=h(y,p.crossOrigin);a.d.L(f,y,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Ot.preloadModule=function(f,p){if(typeof f=="string")if(p){var y=h(p.as,p.crossOrigin);a.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(f)},Ot.requestFormReset=function(f){a.d.r(f)},Ot.unstable_batchedUpdates=function(f,p){return f(p)},Ot.useFormState=function(f,p,y){return d.H.useFormState(f,p,y)},Ot.useFormStatus=function(){return d.H.useHostTransitionStatus()},Ot.version="19.2.4",Ot}var rb;function aw(){if(rb)return Nh.exports;rb=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Nh.exports=aN(),Nh.exports}var lb;function oN(){if(lb)return Fo;lb=1;var n=iN(),e=If(),i=aw();function a(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var s=t,o=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(o=s.return),t=s.return;while(t)}return s.tag===3?o:null}function d(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function h(t){if(t.tag===31){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function f(t){if(c(t)!==t)throw Error(a(188))}function p(t){var s=t.alternate;if(!s){if(s=c(t),s===null)throw Error(a(188));return s!==t?null:t}for(var o=t,u=s;;){var g=o.return;if(g===null)break;var v=g.alternate;if(v===null){if(u=g.return,u!==null){o=u;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===o)return f(g),t;if(v===u)return f(g),s;v=v.sibling}throw Error(a(188))}if(o.return!==u.return)o=g,u=v;else{for(var _=!1,j=g.child;j;){if(j===o){_=!0,o=g,u=v;break}if(j===u){_=!0,u=g,o=v;break}j=j.sibling}if(!_){for(j=v.child;j;){if(j===o){_=!0,o=v,u=g;break}if(j===u){_=!0,u=v,o=g;break}j=j.sibling}if(!_)throw Error(a(189))}}if(o.alternate!==u)throw Error(a(190))}if(o.tag!==3)throw Error(a(188));return o.stateNode.current===o?t:s}function y(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=y(t),s!==null)return s;t=t.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),k=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function $(t){return t===null||typeof t!="object"?null:(t=B&&t[B]||t["@@iterator"],typeof t=="function"?t:null)}var ae=Symbol.for("react.client.reference");function ne(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ae?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case D:return"Profiler";case S:return"StrictMode";case R:return"Suspense";case z:return"SuspenseList";case G:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case E:return"Portal";case k:return t.displayName||"Context";case N:return(t._context.displayName||"Context")+".Consumer";case T:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case O:return s=t.displayName||null,s!==null?s:ne(t.type)||"Memo";case A:s=t._payload,t=t._init;try{return ne(t(s))}catch{}}return null}var W=Array.isArray,M=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q={pending:!1,data:null,method:null,action:null},he=[],Se=-1;function I(t){return{current:t}}function L(t){0>Se||(t.current=he[Se],he[Se]=null,Se--)}function ee(t,s){Se++,he[Se]=t.current,t.current=s}var V=I(null),Y=I(null),le=I(null),X=I(null);function ce(t,s){switch(ee(le,s),ee(Y,t),ee(V,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?Cy(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=Cy(s),t=_y(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}L(V),ee(V,t)}function de(){L(V),L(Y),L(le)}function De(t){t.memoizedState!==null&&ee(X,t);var s=V.current,o=_y(s,t.type);s!==o&&(ee(Y,t),ee(V,o))}function Ge(t){Y.current===t&&(L(V),L(Y)),X.current===t&&(L(X),Io._currentValue=q)}var Ne,dt;function rt(t){if(Ne===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Ne=s&&s[1]||"",dt=-1<o.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+Ne+t+dt}var An=!1;function ei(t,s){if(!t||An)return"";An=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(s){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(te){var J=te}Reflect.construct(t,[],re)}else{try{re.call()}catch(te){J=te}t.call(re.prototype)}}else{try{throw Error()}catch(te){J=te}(re=t())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(te){if(te&&J&&typeof te.stack=="string")return[te.stack,J.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=u.DetermineComponentFrameRoot(),S=v[0],j=v[1];if(S&&j){var P=S.split(`
3
+ `+Ne+t+dt}var An=!1;function ei(t,s){if(!t||An)return"";An=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(s){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(te){var J=te}Reflect.construct(t,[],re)}else{try{re.call()}catch(te){J=te}t.call(re.prototype)}}else{try{throw Error()}catch(te){J=te}(re=t())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(te){if(te&&J&&typeof te.stack=="string")return[te.stack,J.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=u.DetermineComponentFrameRoot(),_=v[0],j=v[1];if(_&&j){var P=_.split(`
4
4
  `),Z=j.split(`
5
5
  `);for(g=u=0;u<P.length&&!P[u].includes("DetermineComponentFrameRoot");)u++;for(;g<Z.length&&!Z[g].includes("DetermineComponentFrameRoot");)g++;if(u===P.length||g===Z.length)for(u=P.length-1,g=Z.length-1;1<=u&&0<=g&&P[u]!==Z[g];)g--;for(;1<=u&&0<=g;u--,g--)if(P[u]!==Z[g]){if(u!==1||g!==1)do if(u--,g--,0>g||P[u]!==Z[g]){var se=`
6
6
  `+P[u].replace(" at new "," at ");return t.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",t.displayName)),se}while(1<=u&&0<=g);break}}}finally{An=!1,Error.prepareStackTrace=o}return(o=t?t.displayName||t.name:"")?rt(o):""}function Ya(t,s){switch(t.tag){case 26:case 27:case 5:return rt(t.type);case 16:return rt("Lazy");case 13:return t.child!==s&&s!==null?rt("Suspense Fallback"):rt("Suspense");case 19:return rt("SuspenseList");case 0:case 15:return ei(t.type,!1);case 11:return ei(t.type.render,!1);case 1:return ei(t.type,!0);case 31:return rt("Activity");default:return""}}function ep(t){try{var s="",o=null;do s+=Ya(t,o),o=t,t=t.return;while(t);return s}catch(u){return`
7
7
  Error generating stack: `+u.message+`
8
- `+u.stack}}var lu=Object.prototype.hasOwnProperty,cu=n.unstable_scheduleCallback,uu=n.unstable_cancelCallback,kE=n.unstable_shouldYield,RE=n.unstable_requestPaint,Qt=n.unstable_now,OE=n.unstable_getCurrentPriorityLevel,tp=n.unstable_ImmediatePriority,np=n.unstable_UserBlockingPriority,pr=n.unstable_NormalPriority,zE=n.unstable_LowPriority,ip=n.unstable_IdlePriority,ME=n.log,PE=n.unstable_setDisableYieldValue,Xa=null,Zt=null;function _i(t){if(typeof ME=="function"&&PE(t),Zt&&typeof Zt.setStrictMode=="function")try{Zt.setStrictMode(Xa,t)}catch{}}var Kt=Math.clz32?Math.clz32:GE,LE=Math.log,IE=Math.LN2;function GE(t){return t>>>=0,t===0?32:31-(LE(t)/IE|0)|0}var gr=256,vr=262144,yr=4194304;function ls(t){var s=t&42;if(s!==0)return s;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function br(t,s,o){var u=t.pendingLanes;if(u===0)return 0;var g=0,v=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var j=u&134217727;return j!==0?(u=j&~v,u!==0?g=ls(u):(S&=j,S!==0?g=ls(S):o||(o=j&~t,o!==0&&(g=ls(o))))):(j=u&~v,j!==0?g=ls(j):S!==0?g=ls(S):o||(o=u&~t,o!==0&&(g=ls(o)))),g===0?0:s!==0&&s!==g&&(s&v)===0&&(v=g&-g,o=s&-s,v>=o||v===32&&(o&4194048)!==0)?s:g}function Qa(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function BE(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function sp(){var t=yr;return yr<<=1,(yr&62914560)===0&&(yr=4194304),t}function du(t){for(var s=[],o=0;31>o;o++)s.push(t);return s}function Za(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function HE(t,s,o,u,g,v){var S=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var j=t.entanglements,P=t.expirationTimes,Z=t.hiddenUpdates;for(o=S&~o;0<o;){var se=31-Kt(o),re=1<<se;j[se]=0,P[se]=-1;var J=Z[se];if(J!==null)for(Z[se]=null,se=0;se<J.length;se++){var te=J[se];te!==null&&(te.lane&=-536870913)}o&=~re}u!==0&&ap(t,u,0),v!==0&&g===0&&t.tag!==0&&(t.suspendedLanes|=v&~(S&~s))}function ap(t,s,o){t.pendingLanes|=s,t.suspendedLanes&=~s;var u=31-Kt(s);t.entangledLanes|=s,t.entanglements[u]=t.entanglements[u]|1073741824|o&261930}function op(t,s){var o=t.entangledLanes|=s;for(t=t.entanglements;o;){var u=31-Kt(o),g=1<<u;g&s|t[u]&s&&(t[u]|=s),o&=~g}}function rp(t,s){var o=s&-s;return o=(o&42)!==0?1:hu(o),(o&(t.suspendedLanes|s))!==0?0:o}function hu(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function fu(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function lp(){var t=K.p;return t!==0?t:(t=window.event,t===void 0?32:qy(t.type))}function cp(t,s){var o=K.p;try{return K.p=t,s()}finally{K.p=o}}var Ei=Math.random().toString(36).slice(2),At="__reactFiber$"+Ei,Bt="__reactProps$"+Ei,Gs="__reactContainer$"+Ei,mu="__reactEvents$"+Ei,VE="__reactListeners$"+Ei,FE="__reactHandles$"+Ei,up="__reactResources$"+Ei,Ka="__reactMarker$"+Ei;function pu(t){delete t[At],delete t[Bt],delete t[mu],delete t[VE],delete t[FE]}function Bs(t){var s=t[At];if(s)return s;for(var o=t.parentNode;o;){if(s=o[Gs]||o[At]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(t=ky(t);t!==null;){if(o=t[At])return o;t=ky(t)}return s}t=o,o=t.parentNode}return null}function Hs(t){if(t=t[At]||t[Gs]){var s=t.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return t}return null}function Ja(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(a(33))}function Vs(t){var s=t[up];return s||(s=t[up]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ct(t){t[Ka]=!0}var dp=new Set,hp={};function cs(t,s){Fs(t,s),Fs(t+"Capture",s)}function Fs(t,s){for(hp[t]=s,t=0;t<s.length;t++)dp.add(s[t])}var UE=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fp={},mp={};function $E(t){return lu.call(mp,t)?!0:lu.call(fp,t)?!1:UE.test(t)?mp[t]=!0:(fp[t]=!0,!1)}function xr(t,s,o){if($E(s))if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var u=s.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+o)}}function wr(t,s,o){if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+o)}}function ti(t,s,o,u){if(u===null)t.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(o);return}t.setAttributeNS(s,o,""+u)}}function un(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function pp(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function WE(t,s,o){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,s);if(!t.hasOwnProperty(s)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var g=u.get,v=u.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return g.call(this)},set:function(S){o=""+S,v.call(this,S)}}),Object.defineProperty(t,s,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(S){o=""+S},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function gu(t){if(!t._valueTracker){var s=pp(t)?"checked":"value";t._valueTracker=WE(t,s,""+t[s])}}function gp(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var o=s.getValue(),u="";return t&&(u=pp(t)?t.checked?"true":"false":t.value),t=u,t!==o?(s.setValue(t),!0):!1}function Sr(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var qE=/[\n"\\]/g;function dn(t){return t.replace(qE,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function vu(t,s,o,u,g,v,S,j){t.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.type=S:t.removeAttribute("type"),s!=null?S==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+un(s)):t.value!==""+un(s)&&(t.value=""+un(s)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),s!=null?yu(t,S,un(s)):o!=null?yu(t,S,un(o)):u!=null&&t.removeAttribute("value"),g==null&&v!=null&&(t.defaultChecked=!!v),g!=null&&(t.checked=g&&typeof g!="function"&&typeof g!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?t.name=""+un(j):t.removeAttribute("name")}function vp(t,s,o,u,g,v,S,j){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.type=v),s!=null||o!=null){if(!(v!=="submit"&&v!=="reset"||s!=null)){gu(t);return}o=o!=null?""+un(o):"",s=s!=null?""+un(s):o,j||s===t.value||(t.value=s),t.defaultValue=s}u=u??g,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=j?t.checked:!!u,t.defaultChecked=!!u,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(t.name=S),gu(t)}function yu(t,s,o){s==="number"&&Sr(t.ownerDocument)===t||t.defaultValue===""+o||(t.defaultValue=""+o)}function Us(t,s,o,u){if(t=t.options,s){s={};for(var g=0;g<o.length;g++)s["$"+o[g]]=!0;for(o=0;o<t.length;o++)g=s.hasOwnProperty("$"+t[o].value),t[o].selected!==g&&(t[o].selected=g),g&&u&&(t[o].defaultSelected=!0)}else{for(o=""+un(o),s=null,g=0;g<t.length;g++){if(t[g].value===o){t[g].selected=!0,u&&(t[g].defaultSelected=!0);return}s!==null||t[g].disabled||(s=t[g])}s!==null&&(s.selected=!0)}}function yp(t,s,o){if(s!=null&&(s=""+un(s),s!==t.value&&(t.value=s),o==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=o!=null?""+un(o):""}function bp(t,s,o,u){if(s==null){if(u!=null){if(o!=null)throw Error(a(92));if(W(u)){if(1<u.length)throw Error(a(93));u=u[0]}o=u}o==null&&(o=""),s=o}o=un(s),t.defaultValue=o,u=t.textContent,u===o&&u!==""&&u!==null&&(t.value=u),gu(t)}function $s(t,s){if(s){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=s;return}}t.textContent=s}var YE=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function xp(t,s,o){var u=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":u?t.setProperty(s,o):typeof o!="number"||o===0||YE.has(s)?s==="float"?t.cssFloat=o:t[s]=(""+o).trim():t[s]=o+"px"}function wp(t,s,o){if(s!=null&&typeof s!="object")throw Error(a(62));if(t=t.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||s!=null&&s.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var g in s)u=s[g],s.hasOwnProperty(g)&&o[g]!==u&&xp(t,g,u)}else for(var v in s)s.hasOwnProperty(v)&&xp(t,v,s[v])}function bu(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var XE=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),QE=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Cr(t){return QE.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function ni(){}var xu=null;function wu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ws=null,qs=null;function Sp(t){var s=Hs(t);if(s&&(t=s.stateNode)){var o=t[Bt]||null;e:switch(t=s.stateNode,s.type){case"input":if(vu(t,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=t;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+dn(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var u=o[s];if(u!==t&&u.form===t.form){var g=u[Bt]||null;if(!g)throw Error(a(90));vu(u,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(s=0;s<o.length;s++)u=o[s],u.form===t.form&&gp(u)}break e;case"textarea":yp(t,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&Us(t,!!o.multiple,s,!1)}}}var Su=!1;function Cp(t,s,o){if(Su)return t(s,o);Su=!0;try{var u=t(s);return u}finally{if(Su=!1,(Ws!==null||qs!==null)&&(ul(),Ws&&(s=Ws,t=qs,qs=Ws=null,Sp(s),t)))for(s=0;s<t.length;s++)Sp(t[s])}}function eo(t,s){var o=t.stateNode;if(o===null)return null;var u=o[Bt]||null;if(u===null)return null;o=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(o&&typeof o!="function")throw Error(a(231,s,typeof o));return o}var ii=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cu=!1;if(ii)try{var to={};Object.defineProperty(to,"passive",{get:function(){Cu=!0}}),window.addEventListener("test",to,to),window.removeEventListener("test",to,to)}catch{Cu=!1}var Di=null,_u=null,_r=null;function _p(){if(_r)return _r;var t,s=_u,o=s.length,u,g="value"in Di?Di.value:Di.textContent,v=g.length;for(t=0;t<o&&s[t]===g[t];t++);var S=o-t;for(u=1;u<=S&&s[o-u]===g[v-u];u++);return _r=g.slice(t,1<u?1-u:void 0)}function Er(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Dr(){return!0}function Ep(){return!1}function Ht(t){function s(o,u,g,v,S){this._reactName=o,this._targetInst=g,this.type=u,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var j in t)t.hasOwnProperty(j)&&(o=t[j],this[j]=o?o(v):v[j]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Dr:Ep,this.isPropagationStopped=Ep,this}return b(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Dr)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Dr)},persist:function(){},isPersistent:Dr}),s}var us={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ar=Ht(us),no=b({},us,{view:0,detail:0}),ZE=Ht(no),Eu,Du,io,Nr=b({},no,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nu,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==io&&(io&&t.type==="mousemove"?(Eu=t.screenX-io.screenX,Du=t.screenY-io.screenY):Du=Eu=0,io=t),Eu)},movementY:function(t){return"movementY"in t?t.movementY:Du}}),Dp=Ht(Nr),KE=b({},Nr,{dataTransfer:0}),JE=Ht(KE),eD=b({},no,{relatedTarget:0}),Au=Ht(eD),tD=b({},us,{animationName:0,elapsedTime:0,pseudoElement:0}),nD=Ht(tD),iD=b({},us,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),sD=Ht(iD),aD=b({},us,{data:0}),Ap=Ht(aD),oD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rD={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},lD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cD(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=lD[t])?!!s[t]:!1}function Nu(){return cD}var uD=b({},no,{key:function(t){if(t.key){var s=oD[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Er(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?rD[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nu,charCode:function(t){return t.type==="keypress"?Er(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Er(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),dD=Ht(uD),hD=b({},Nr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Np=Ht(hD),fD=b({},no,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nu}),mD=Ht(fD),pD=b({},us,{propertyName:0,elapsedTime:0,pseudoElement:0}),gD=Ht(pD),vD=b({},Nr,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),yD=Ht(vD),bD=b({},us,{newState:0,oldState:0}),xD=Ht(bD),wD=[9,13,27,32],ju=ii&&"CompositionEvent"in window,so=null;ii&&"documentMode"in document&&(so=document.documentMode);var SD=ii&&"TextEvent"in window&&!so,jp=ii&&(!ju||so&&8<so&&11>=so),Tp=" ",kp=!1;function Rp(t,s){switch(t){case"keyup":return wD.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Op(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ys=!1;function CD(t,s){switch(t){case"compositionend":return Op(s);case"keypress":return s.which!==32?null:(kp=!0,Tp);case"textInput":return t=s.data,t===Tp&&kp?null:t;default:return null}}function _D(t,s){if(Ys)return t==="compositionend"||!ju&&Rp(t,s)?(t=_p(),_r=_u=Di=null,Ys=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return jp&&s.locale!=="ko"?null:s.data;default:return null}}var ED={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function zp(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!ED[t.type]:s==="textarea"}function Mp(t,s,o,u){Ws?qs?qs.push(u):qs=[u]:Ws=u,s=vl(s,"onChange"),0<s.length&&(o=new Ar("onChange","change",null,o,u),t.push({event:o,listeners:s}))}var ao=null,oo=null;function DD(t){vy(t,0)}function jr(t){var s=Ja(t);if(gp(s))return t}function Pp(t,s){if(t==="change")return s}var Lp=!1;if(ii){var Tu;if(ii){var ku="oninput"in document;if(!ku){var Ip=document.createElement("div");Ip.setAttribute("oninput","return;"),ku=typeof Ip.oninput=="function"}Tu=ku}else Tu=!1;Lp=Tu&&(!document.documentMode||9<document.documentMode)}function Gp(){ao&&(ao.detachEvent("onpropertychange",Bp),oo=ao=null)}function Bp(t){if(t.propertyName==="value"&&jr(oo)){var s=[];Mp(s,oo,t,wu(t)),Cp(DD,s)}}function AD(t,s,o){t==="focusin"?(Gp(),ao=s,oo=o,ao.attachEvent("onpropertychange",Bp)):t==="focusout"&&Gp()}function ND(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return jr(oo)}function jD(t,s){if(t==="click")return jr(s)}function TD(t,s){if(t==="input"||t==="change")return jr(s)}function kD(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Jt=typeof Object.is=="function"?Object.is:kD;function ro(t,s){if(Jt(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var o=Object.keys(t),u=Object.keys(s);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var g=o[u];if(!lu.call(s,g)||!Jt(t[g],s[g]))return!1}return!0}function Hp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vp(t,s){var o=Hp(t);t=0;for(var u;o;){if(o.nodeType===3){if(u=t+o.textContent.length,t<=s&&u>=s)return{node:o,offset:s-t};t=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Hp(o)}}function Fp(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Fp(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Up(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=Sr(t.document);s instanceof t.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)t=s.contentWindow;else break;s=Sr(t.document)}return s}function Ru(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var RD=ii&&"documentMode"in document&&11>=document.documentMode,Xs=null,Ou=null,lo=null,zu=!1;function $p(t,s,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;zu||Xs==null||Xs!==Sr(u)||(u=Xs,"selectionStart"in u&&Ru(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),lo&&ro(lo,u)||(lo=u,u=vl(Ou,"onSelect"),0<u.length&&(s=new Ar("onSelect","select",null,s,o),t.push({event:s,listeners:u}),s.target=Xs)))}function ds(t,s){var o={};return o[t.toLowerCase()]=s.toLowerCase(),o["Webkit"+t]="webkit"+s,o["Moz"+t]="moz"+s,o}var Qs={animationend:ds("Animation","AnimationEnd"),animationiteration:ds("Animation","AnimationIteration"),animationstart:ds("Animation","AnimationStart"),transitionrun:ds("Transition","TransitionRun"),transitionstart:ds("Transition","TransitionStart"),transitioncancel:ds("Transition","TransitionCancel"),transitionend:ds("Transition","TransitionEnd")},Mu={},Wp={};ii&&(Wp=document.createElement("div").style,"AnimationEvent"in window||(delete Qs.animationend.animation,delete Qs.animationiteration.animation,delete Qs.animationstart.animation),"TransitionEvent"in window||delete Qs.transitionend.transition);function hs(t){if(Mu[t])return Mu[t];if(!Qs[t])return t;var s=Qs[t],o;for(o in s)if(s.hasOwnProperty(o)&&o in Wp)return Mu[t]=s[o];return t}var qp=hs("animationend"),Yp=hs("animationiteration"),Xp=hs("animationstart"),OD=hs("transitionrun"),zD=hs("transitionstart"),MD=hs("transitioncancel"),Qp=hs("transitionend"),Zp=new Map,Pu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Pu.push("scrollEnd");function Nn(t,s){Zp.set(t,s),cs(s,[t])}var Tr=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},hn=[],Zs=0,Lu=0;function kr(){for(var t=Zs,s=Lu=Zs=0;s<t;){var o=hn[s];hn[s++]=null;var u=hn[s];hn[s++]=null;var g=hn[s];hn[s++]=null;var v=hn[s];if(hn[s++]=null,u!==null&&g!==null){var S=u.pending;S===null?g.next=g:(g.next=S.next,S.next=g),u.pending=g}v!==0&&Kp(o,g,v)}}function Rr(t,s,o,u){hn[Zs++]=t,hn[Zs++]=s,hn[Zs++]=o,hn[Zs++]=u,Lu|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function Iu(t,s,o,u){return Rr(t,s,o,u),Or(t)}function fs(t,s){return Rr(t,null,null,s),Or(t)}function Kp(t,s,o){t.lanes|=o;var u=t.alternate;u!==null&&(u.lanes|=o);for(var g=!1,v=t.return;v!==null;)v.childLanes|=o,u=v.alternate,u!==null&&(u.childLanes|=o),v.tag===22&&(t=v.stateNode,t===null||t._visibility&1||(g=!0)),t=v,v=v.return;return t.tag===3?(v=t.stateNode,g&&s!==null&&(g=31-Kt(o),t=v.hiddenUpdates,u=t[g],u===null?t[g]=[s]:u.push(s),s.lane=o|536870912),v):null}function Or(t){if(50<ko)throw ko=0,qd=null,Error(a(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var Ks={};function PD(t,s,o,u){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(t,s,o,u){return new PD(t,s,o,u)}function Gu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function si(t,s){var o=t.alternate;return o===null?(o=en(t.tag,s,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=s,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&65011712,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,s=t.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o.refCleanup=t.refCleanup,o}function Jp(t,s){t.flags&=65011714;var o=t.alternate;return o===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=o.childLanes,t.lanes=o.lanes,t.child=o.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=o.memoizedProps,t.memoizedState=o.memoizedState,t.updateQueue=o.updateQueue,t.type=o.type,s=o.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function zr(t,s,o,u,g,v){var S=0;if(u=t,typeof t=="function")Gu(t)&&(S=1);else if(typeof t=="string")S=HA(t,o,V.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case G:return t=en(31,o,s,g),t.elementType=G,t.lanes=v,t;case _:return ms(o.children,g,v,s);case C:S=8,g|=24;break;case D:return t=en(12,o,s,g|2),t.elementType=D,t.lanes=v,t;case R:return t=en(13,o,s,g),t.elementType=R,t.lanes=v,t;case z:return t=en(19,o,s,g),t.elementType=z,t.lanes=v,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case k:S=10;break e;case N:S=9;break e;case T:S=11;break e;case O:S=14;break e;case A:S=16,u=null;break e}S=29,o=Error(a(130,t===null?"null":typeof t,"")),u=null}return s=en(S,o,s,g),s.elementType=t,s.type=u,s.lanes=v,s}function ms(t,s,o,u){return t=en(7,t,u,s),t.lanes=o,t}function Bu(t,s,o){return t=en(6,t,null,s),t.lanes=o,t}function eg(t){var s=en(18,null,null,0);return s.stateNode=t,s}function Hu(t,s,o){return s=en(4,t.children!==null?t.children:[],t.key,s),s.lanes=o,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var tg=new WeakMap;function fn(t,s){if(typeof t=="object"&&t!==null){var o=tg.get(t);return o!==void 0?o:(s={value:t,source:s,stack:ep(s)},tg.set(t,s),s)}return{value:t,source:s,stack:ep(s)}}var Js=[],ea=0,Mr=null,co=0,mn=[],pn=0,Ai=null,Gn=1,Bn="";function ai(t,s){Js[ea++]=co,Js[ea++]=Mr,Mr=t,co=s}function ng(t,s,o){mn[pn++]=Gn,mn[pn++]=Bn,mn[pn++]=Ai,Ai=t;var u=Gn;t=Bn;var g=32-Kt(u)-1;u&=~(1<<g),o+=1;var v=32-Kt(s)+g;if(30<v){var S=g-g%5;v=(u&(1<<S)-1).toString(32),u>>=S,g-=S,Gn=1<<32-Kt(s)+g|o<<g|u,Bn=v+t}else Gn=1<<v|o<<g|u,Bn=t}function Vu(t){t.return!==null&&(ai(t,1),ng(t,1,0))}function Fu(t){for(;t===Mr;)Mr=Js[--ea],Js[ea]=null,co=Js[--ea],Js[ea]=null;for(;t===Ai;)Ai=mn[--pn],mn[pn]=null,Bn=mn[--pn],mn[pn]=null,Gn=mn[--pn],mn[pn]=null}function ig(t,s){mn[pn++]=Gn,mn[pn++]=Bn,mn[pn++]=Ai,Gn=s.id,Bn=s.overflow,Ai=t}var Nt=null,nt=null,Ue=!1,Ni=null,gn=!1,Uu=Error(a(519));function ji(t){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw uo(fn(s,t)),Uu}function sg(t){var s=t.stateNode,o=t.type,u=t.memoizedProps;switch(s[At]=t,s[Bt]=u,o){case"dialog":He("cancel",s),He("close",s);break;case"iframe":case"object":case"embed":He("load",s);break;case"video":case"audio":for(o=0;o<Oo.length;o++)He(Oo[o],s);break;case"source":He("error",s);break;case"img":case"image":case"link":He("error",s),He("load",s);break;case"details":He("toggle",s);break;case"input":He("invalid",s),vp(s,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":He("invalid",s);break;case"textarea":He("invalid",s),bp(s,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||u.suppressHydrationWarning===!0||wy(s.textContent,o)?(u.popover!=null&&(He("beforetoggle",s),He("toggle",s)),u.onScroll!=null&&He("scroll",s),u.onScrollEnd!=null&&He("scrollend",s),u.onClick!=null&&(s.onclick=ni),s=!0):s=!1,s||ji(t,!0)}function ag(t){for(Nt=t.return;Nt;)switch(Nt.tag){case 5:case 31:case 13:gn=!1;return;case 27:case 3:gn=!0;return;default:Nt=Nt.return}}function ta(t){if(t!==Nt)return!1;if(!Ue)return ag(t),Ue=!0,!1;var s=t.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=t.type,o=!(o!=="form"&&o!=="button")||lh(t.type,t.memoizedProps)),o=!o),o&&nt&&ji(t),ag(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));nt=Ty(t)}else if(s===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));nt=Ty(t)}else s===27?(s=nt,Fi(t.type)?(t=fh,fh=null,nt=t):nt=s):nt=Nt?yn(t.stateNode.nextSibling):null;return!0}function ps(){nt=Nt=null,Ue=!1}function $u(){var t=Ni;return t!==null&&($t===null?$t=t:$t.push.apply($t,t),Ni=null),t}function uo(t){Ni===null?Ni=[t]:Ni.push(t)}var Wu=I(null),gs=null,oi=null;function Ti(t,s,o){ee(Wu,s._currentValue),s._currentValue=o}function ri(t){t._currentValue=Wu.current,L(Wu)}function qu(t,s,o){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===o)break;t=t.return}}function Yu(t,s,o,u){var g=t.child;for(g!==null&&(g.return=t);g!==null;){var v=g.dependencies;if(v!==null){var S=g.child;v=v.firstContext;e:for(;v!==null;){var j=v;v=g;for(var P=0;P<s.length;P++)if(j.context===s[P]){v.lanes|=o,j=v.alternate,j!==null&&(j.lanes|=o),qu(v.return,o,t),u||(S=null);break e}v=j.next}}else if(g.tag===18){if(S=g.return,S===null)throw Error(a(341));S.lanes|=o,v=S.alternate,v!==null&&(v.lanes|=o),qu(S,o,t),S=null}else S=g.child;if(S!==null)S.return=g;else for(S=g;S!==null;){if(S===t){S=null;break}if(g=S.sibling,g!==null){g.return=S.return,S=g;break}S=S.return}g=S}}function na(t,s,o,u){t=null;for(var g=s,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var S=g.alternate;if(S===null)throw Error(a(387));if(S=S.memoizedProps,S!==null){var j=g.type;Jt(g.pendingProps.value,S.value)||(t!==null?t.push(j):t=[j])}}else if(g===X.current){if(S=g.alternate,S===null)throw Error(a(387));S.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(t!==null?t.push(Io):t=[Io])}g=g.return}t!==null&&Yu(s,t,o,u),s.flags|=262144}function Pr(t){for(t=t.firstContext;t!==null;){if(!Jt(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function vs(t){gs=t,oi=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function jt(t){return og(gs,t)}function Lr(t,s){return gs===null&&vs(t),og(t,s)}function og(t,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},oi===null){if(t===null)throw Error(a(308));oi=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else oi=oi.next=s;return o}var LD=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(o,u){t.push(u)}};this.abort=function(){s.aborted=!0,t.forEach(function(o){return o()})}},ID=n.unstable_scheduleCallback,GD=n.unstable_NormalPriority,mt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Xu(){return{controller:new LD,data:new Map,refCount:0}}function ho(t){t.refCount--,t.refCount===0&&ID(GD,function(){t.controller.abort()})}var fo=null,Qu=0,ia=0,sa=null;function BD(t,s){if(fo===null){var o=fo=[];Qu=0,ia=Jd(),sa={status:"pending",value:void 0,then:function(u){o.push(u)}}}return Qu++,s.then(rg,rg),s}function rg(){if(--Qu===0&&fo!==null){sa!==null&&(sa.status="fulfilled");var t=fo;fo=null,ia=0,sa=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function HD(t,s){var o=[],u={status:"pending",value:null,reason:null,then:function(g){o.push(g)}};return t.then(function(){u.status="fulfilled",u.value=s;for(var g=0;g<o.length;g++)(0,o[g])(s)},function(g){for(u.status="rejected",u.reason=g,g=0;g<o.length;g++)(0,o[g])(void 0)}),u}var lg=M.S;M.S=function(t,s){$v=Qt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&BD(t,s),lg!==null&&lg(t,s)};var ys=I(null);function Zu(){var t=ys.current;return t!==null?t:tt.pooledCache}function Ir(t,s){s===null?ee(ys,ys.current):ee(ys,s.pool)}function cg(){var t=Zu();return t===null?null:{parent:mt._currentValue,pool:t}}var aa=Error(a(460)),Ku=Error(a(474)),Gr=Error(a(542)),Br={then:function(){}};function ug(t){return t=t.status,t==="fulfilled"||t==="rejected"}function dg(t,s,o){switch(o=t[o],o===void 0?t.push(s):o!==s&&(s.then(ni,ni),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,fg(t),t;default:if(typeof s.status=="string")s.then(ni,ni);else{if(t=tt,t!==null&&100<t.shellSuspendCounter)throw Error(a(482));t=s,t.status="pending",t.then(function(u){if(s.status==="pending"){var g=s;g.status="fulfilled",g.value=u}},function(u){if(s.status==="pending"){var g=s;g.status="rejected",g.reason=u}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,fg(t),t}throw xs=s,aa}}function bs(t){try{var s=t._init;return s(t._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(xs=o,aa):o}}var xs=null;function hg(){if(xs===null)throw Error(a(459));var t=xs;return xs=null,t}function fg(t){if(t===aa||t===Gr)throw Error(a(483))}var oa=null,mo=0;function Hr(t){var s=mo;return mo+=1,oa===null&&(oa=[]),dg(oa,t,s)}function po(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function Vr(t,s){throw s.$$typeof===x?Error(a(525)):(t=Object.prototype.toString.call(s),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function mg(t){function s(F,H){if(t){var Q=F.deletions;Q===null?(F.deletions=[H],F.flags|=16):Q.push(H)}}function o(F,H){if(!t)return null;for(;H!==null;)s(F,H),H=H.sibling;return null}function u(F){for(var H=new Map;F!==null;)F.key!==null?H.set(F.key,F):H.set(F.index,F),F=F.sibling;return H}function g(F,H){return F=si(F,H),F.index=0,F.sibling=null,F}function v(F,H,Q){return F.index=Q,t?(Q=F.alternate,Q!==null?(Q=Q.index,Q<H?(F.flags|=67108866,H):Q):(F.flags|=67108866,H)):(F.flags|=1048576,H)}function S(F){return t&&F.alternate===null&&(F.flags|=67108866),F}function j(F,H,Q,oe){return H===null||H.tag!==6?(H=Bu(Q,F.mode,oe),H.return=F,H):(H=g(H,Q),H.return=F,H)}function P(F,H,Q,oe){var xe=Q.type;return xe===_?se(F,H,Q.props.children,oe,Q.key):H!==null&&(H.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===A&&bs(xe)===H.type)?(H=g(H,Q.props),po(H,Q),H.return=F,H):(H=zr(Q.type,Q.key,Q.props,null,F.mode,oe),po(H,Q),H.return=F,H)}function Z(F,H,Q,oe){return H===null||H.tag!==4||H.stateNode.containerInfo!==Q.containerInfo||H.stateNode.implementation!==Q.implementation?(H=Hu(Q,F.mode,oe),H.return=F,H):(H=g(H,Q.children||[]),H.return=F,H)}function se(F,H,Q,oe,xe){return H===null||H.tag!==7?(H=ms(Q,F.mode,oe,xe),H.return=F,H):(H=g(H,Q),H.return=F,H)}function re(F,H,Q){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=Bu(""+H,F.mode,Q),H.return=F,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case w:return Q=zr(H.type,H.key,H.props,null,F.mode,Q),po(Q,H),Q.return=F,Q;case E:return H=Hu(H,F.mode,Q),H.return=F,H;case A:return H=bs(H),re(F,H,Q)}if(W(H)||$(H))return H=ms(H,F.mode,Q,null),H.return=F,H;if(typeof H.then=="function")return re(F,Hr(H),Q);if(H.$$typeof===k)return re(F,Lr(F,H),Q);Vr(F,H)}return null}function J(F,H,Q,oe){var xe=H!==null?H.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return xe!==null?null:j(F,H,""+Q,oe);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:return Q.key===xe?P(F,H,Q,oe):null;case E:return Q.key===xe?Z(F,H,Q,oe):null;case A:return Q=bs(Q),J(F,H,Q,oe)}if(W(Q)||$(Q))return xe!==null?null:se(F,H,Q,oe,null);if(typeof Q.then=="function")return J(F,H,Hr(Q),oe);if(Q.$$typeof===k)return J(F,H,Lr(F,Q),oe);Vr(F,Q)}return null}function te(F,H,Q,oe,xe){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return F=F.get(Q)||null,j(H,F,""+oe,xe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case w:return F=F.get(oe.key===null?Q:oe.key)||null,P(H,F,oe,xe);case E:return F=F.get(oe.key===null?Q:oe.key)||null,Z(H,F,oe,xe);case A:return oe=bs(oe),te(F,H,Q,oe,xe)}if(W(oe)||$(oe))return F=F.get(Q)||null,se(H,F,oe,xe,null);if(typeof oe.then=="function")return te(F,H,Q,Hr(oe),xe);if(oe.$$typeof===k)return te(F,H,Q,Lr(H,oe),xe);Vr(H,oe)}return null}function me(F,H,Q,oe){for(var xe=null,We=null,ve=H,Me=H=0,Fe=null;ve!==null&&Me<Q.length;Me++){ve.index>Me?(Fe=ve,ve=null):Fe=ve.sibling;var qe=J(F,ve,Q[Me],oe);if(qe===null){ve===null&&(ve=Fe);break}t&&ve&&qe.alternate===null&&s(F,ve),H=v(qe,H,Me),We===null?xe=qe:We.sibling=qe,We=qe,ve=Fe}if(Me===Q.length)return o(F,ve),Ue&&ai(F,Me),xe;if(ve===null){for(;Me<Q.length;Me++)ve=re(F,Q[Me],oe),ve!==null&&(H=v(ve,H,Me),We===null?xe=ve:We.sibling=ve,We=ve);return Ue&&ai(F,Me),xe}for(ve=u(ve);Me<Q.length;Me++)Fe=te(ve,F,Me,Q[Me],oe),Fe!==null&&(t&&Fe.alternate!==null&&ve.delete(Fe.key===null?Me:Fe.key),H=v(Fe,H,Me),We===null?xe=Fe:We.sibling=Fe,We=Fe);return t&&ve.forEach(function(Yi){return s(F,Yi)}),Ue&&ai(F,Me),xe}function _e(F,H,Q,oe){if(Q==null)throw Error(a(151));for(var xe=null,We=null,ve=H,Me=H=0,Fe=null,qe=Q.next();ve!==null&&!qe.done;Me++,qe=Q.next()){ve.index>Me?(Fe=ve,ve=null):Fe=ve.sibling;var Yi=J(F,ve,qe.value,oe);if(Yi===null){ve===null&&(ve=Fe);break}t&&ve&&Yi.alternate===null&&s(F,ve),H=v(Yi,H,Me),We===null?xe=Yi:We.sibling=Yi,We=Yi,ve=Fe}if(qe.done)return o(F,ve),Ue&&ai(F,Me),xe;if(ve===null){for(;!qe.done;Me++,qe=Q.next())qe=re(F,qe.value,oe),qe!==null&&(H=v(qe,H,Me),We===null?xe=qe:We.sibling=qe,We=qe);return Ue&&ai(F,Me),xe}for(ve=u(ve);!qe.done;Me++,qe=Q.next())qe=te(ve,F,Me,qe.value,oe),qe!==null&&(t&&qe.alternate!==null&&ve.delete(qe.key===null?Me:qe.key),H=v(qe,H,Me),We===null?xe=qe:We.sibling=qe,We=qe);return t&&ve.forEach(function(KA){return s(F,KA)}),Ue&&ai(F,Me),xe}function et(F,H,Q,oe){if(typeof Q=="object"&&Q!==null&&Q.type===_&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:e:{for(var xe=Q.key;H!==null;){if(H.key===xe){if(xe=Q.type,xe===_){if(H.tag===7){o(F,H.sibling),oe=g(H,Q.props.children),oe.return=F,F=oe;break e}}else if(H.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===A&&bs(xe)===H.type){o(F,H.sibling),oe=g(H,Q.props),po(oe,Q),oe.return=F,F=oe;break e}o(F,H);break}else s(F,H);H=H.sibling}Q.type===_?(oe=ms(Q.props.children,F.mode,oe,Q.key),oe.return=F,F=oe):(oe=zr(Q.type,Q.key,Q.props,null,F.mode,oe),po(oe,Q),oe.return=F,F=oe)}return S(F);case E:e:{for(xe=Q.key;H!==null;){if(H.key===xe)if(H.tag===4&&H.stateNode.containerInfo===Q.containerInfo&&H.stateNode.implementation===Q.implementation){o(F,H.sibling),oe=g(H,Q.children||[]),oe.return=F,F=oe;break e}else{o(F,H);break}else s(F,H);H=H.sibling}oe=Hu(Q,F.mode,oe),oe.return=F,F=oe}return S(F);case A:return Q=bs(Q),et(F,H,Q,oe)}if(W(Q))return me(F,H,Q,oe);if($(Q)){if(xe=$(Q),typeof xe!="function")throw Error(a(150));return Q=xe.call(Q),_e(F,H,Q,oe)}if(typeof Q.then=="function")return et(F,H,Hr(Q),oe);if(Q.$$typeof===k)return et(F,H,Lr(F,Q),oe);Vr(F,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,H!==null&&H.tag===6?(o(F,H.sibling),oe=g(H,Q),oe.return=F,F=oe):(o(F,H),oe=Bu(Q,F.mode,oe),oe.return=F,F=oe),S(F)):o(F,H)}return function(F,H,Q,oe){try{mo=0;var xe=et(F,H,Q,oe);return oa=null,xe}catch(ve){if(ve===aa||ve===Gr)throw ve;var We=en(29,ve,null,F.mode);return We.lanes=oe,We.return=F,We}}}var ws=mg(!0),pg=mg(!1),ki=!1;function Ju(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ed(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ri(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Oi(t,s,o){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Ye&2)!==0){var g=u.pending;return g===null?s.next=s:(s.next=g.next,g.next=s),u.pending=s,s=Or(t),Kp(t,null,o),s}return Rr(t,u,s,o),Or(t)}function go(t,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var u=s.lanes;u&=t.pendingLanes,o|=u,s.lanes=o,op(t,o)}}function td(t,s){var o=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var g=null,v=null;if(o=o.firstBaseUpdate,o!==null){do{var S={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};v===null?g=v=S:v=v.next=S,o=o.next}while(o!==null);v===null?g=v=s:v=v.next=s}else g=v=s;o={baseState:u.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:u.shared,callbacks:u.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=s:t.next=s,o.lastBaseUpdate=s}var nd=!1;function vo(){if(nd){var t=sa;if(t!==null)throw t}}function yo(t,s,o,u){nd=!1;var g=t.updateQueue;ki=!1;var v=g.firstBaseUpdate,S=g.lastBaseUpdate,j=g.shared.pending;if(j!==null){g.shared.pending=null;var P=j,Z=P.next;P.next=null,S===null?v=Z:S.next=Z,S=P;var se=t.alternate;se!==null&&(se=se.updateQueue,j=se.lastBaseUpdate,j!==S&&(j===null?se.firstBaseUpdate=Z:j.next=Z,se.lastBaseUpdate=P))}if(v!==null){var re=g.baseState;S=0,se=Z=P=null,j=v;do{var J=j.lane&-536870913,te=J!==j.lane;if(te?(Ve&J)===J:(u&J)===J){J!==0&&J===ia&&(nd=!0),se!==null&&(se=se.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var me=t,_e=j;J=s;var et=o;switch(_e.tag){case 1:if(me=_e.payload,typeof me=="function"){re=me.call(et,re,J);break e}re=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=_e.payload,J=typeof me=="function"?me.call(et,re,J):me,J==null)break e;re=b({},re,J);break e;case 2:ki=!0}}J=j.callback,J!==null&&(t.flags|=64,te&&(t.flags|=8192),te=g.callbacks,te===null?g.callbacks=[J]:te.push(J))}else te={lane:J,tag:j.tag,payload:j.payload,callback:j.callback,next:null},se===null?(Z=se=te,P=re):se=se.next=te,S|=J;if(j=j.next,j===null){if(j=g.shared.pending,j===null)break;te=j,j=te.next,te.next=null,g.lastBaseUpdate=te,g.shared.pending=null}}while(!0);se===null&&(P=re),g.baseState=P,g.firstBaseUpdate=Z,g.lastBaseUpdate=se,v===null&&(g.shared.lanes=0),Ii|=S,t.lanes=S,t.memoizedState=re}}function gg(t,s){if(typeof t!="function")throw Error(a(191,t));t.call(s)}function vg(t,s){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;t<o.length;t++)gg(o[t],s)}var ra=I(null),Fr=I(0);function yg(t,s){t=gi,ee(Fr,t),ee(ra,s),gi=t|s.baseLanes}function id(){ee(Fr,gi),ee(ra,ra.current)}function sd(){gi=Fr.current,L(ra),L(Fr)}var tn=I(null),vn=null;function zi(t){var s=t.alternate;ee(ht,ht.current&1),ee(tn,t),vn===null&&(s===null||ra.current!==null||s.memoizedState!==null)&&(vn=t)}function ad(t){ee(ht,ht.current),ee(tn,t),vn===null&&(vn=t)}function bg(t){t.tag===22?(ee(ht,ht.current),ee(tn,t),vn===null&&(vn=t)):Mi()}function Mi(){ee(ht,ht.current),ee(tn,tn.current)}function nn(t){L(tn),vn===t&&(vn=null),L(ht)}var ht=I(0);function Ur(t){for(var s=t;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||dh(o)||hh(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var li=0,ze=null,Ke=null,pt=null,$r=!1,la=!1,Ss=!1,Wr=0,bo=0,ca=null,VD=0;function lt(){throw Error(a(321))}function od(t,s){if(s===null)return!1;for(var o=0;o<s.length&&o<t.length;o++)if(!Jt(t[o],s[o]))return!1;return!0}function rd(t,s,o,u,g,v){return li=v,ze=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,M.H=t===null||t.memoizedState===null?nv:Sd,Ss=!1,v=o(u,g),Ss=!1,la&&(v=wg(s,o,u,g)),xg(t),v}function xg(t){M.H=So;var s=Ke!==null&&Ke.next!==null;if(li=0,pt=Ke=ze=null,$r=!1,bo=0,ca=null,s)throw Error(a(300));t===null||gt||(t=t.dependencies,t!==null&&Pr(t)&&(gt=!0))}function wg(t,s,o,u){ze=t;var g=0;do{if(la&&(ca=null),bo=0,la=!1,25<=g)throw Error(a(301));if(g+=1,pt=Ke=null,t.updateQueue!=null){var v=t.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}M.H=iv,v=s(o,u)}while(la);return v}function FD(){var t=M.H,s=t.useState()[0];return s=typeof s.then=="function"?xo(s):s,t=t.useState()[0],(Ke!==null?Ke.memoizedState:null)!==t&&(ze.flags|=1024),s}function ld(){var t=Wr!==0;return Wr=0,t}function cd(t,s,o){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~o}function ud(t){if($r){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}$r=!1}li=0,pt=Ke=ze=null,la=!1,bo=Wr=0,ca=null}function Lt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pt===null?ze.memoizedState=pt=t:pt=pt.next=t,pt}function ft(){if(Ke===null){var t=ze.alternate;t=t!==null?t.memoizedState:null}else t=Ke.next;var s=pt===null?ze.memoizedState:pt.next;if(s!==null)pt=s,Ke=t;else{if(t===null)throw ze.alternate===null?Error(a(467)):Error(a(310));Ke=t,t={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},pt===null?ze.memoizedState=pt=t:pt=pt.next=t}return pt}function qr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xo(t){var s=bo;return bo+=1,ca===null&&(ca=[]),t=dg(ca,t,s),s=ze,(pt===null?s.memoizedState:pt.next)===null&&(s=s.alternate,M.H=s===null||s.memoizedState===null?nv:Sd),t}function Yr(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return xo(t);if(t.$$typeof===k)return jt(t)}throw Error(a(438,String(t)))}function dd(t){var s=null,o=ze.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var u=ze.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(s={data:u.data.map(function(g){return g.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=qr(),ze.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(t),u=0;u<t;u++)o[u]=U;return s.index++,o}function ci(t,s){return typeof s=="function"?s(t):s}function Xr(t){var s=ft();return hd(s,Ke,t)}function hd(t,s,o){var u=t.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=o;var g=t.baseQueue,v=u.pending;if(v!==null){if(g!==null){var S=g.next;g.next=v.next,v.next=S}s.baseQueue=g=v,u.pending=null}if(v=t.baseState,g===null)t.memoizedState=v;else{s=g.next;var j=S=null,P=null,Z=s,se=!1;do{var re=Z.lane&-536870913;if(re!==Z.lane?(Ve&re)===re:(li&re)===re){var J=Z.revertLane;if(J===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),re===ia&&(se=!0);else if((li&J)===J){Z=Z.next,J===ia&&(se=!0);continue}else re={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},P===null?(j=P=re,S=v):P=P.next=re,ze.lanes|=J,Ii|=J;re=Z.action,Ss&&o(v,re),v=Z.hasEagerState?Z.eagerState:o(v,re)}else J={lane:re,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},P===null?(j=P=J,S=v):P=P.next=J,ze.lanes|=re,Ii|=re;Z=Z.next}while(Z!==null&&Z!==s);if(P===null?S=v:P.next=j,!Jt(v,t.memoizedState)&&(gt=!0,se&&(o=sa,o!==null)))throw o;t.memoizedState=v,t.baseState=S,t.baseQueue=P,u.lastRenderedState=v}return g===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function fd(t){var s=ft(),o=s.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=t;var u=o.dispatch,g=o.pending,v=s.memoizedState;if(g!==null){o.pending=null;var S=g=g.next;do v=t(v,S.action),S=S.next;while(S!==g);Jt(v,s.memoizedState)||(gt=!0),s.memoizedState=v,s.baseQueue===null&&(s.baseState=v),o.lastRenderedState=v}return[v,u]}function Sg(t,s,o){var u=ze,g=ft(),v=Ue;if(v){if(o===void 0)throw Error(a(407));o=o()}else o=s();var S=!Jt((Ke||g).memoizedState,o);if(S&&(g.memoizedState=o,gt=!0),g=g.queue,gd(Eg.bind(null,u,g,t),[t]),g.getSnapshot!==s||S||pt!==null&&pt.memoizedState.tag&1){if(u.flags|=2048,ua(9,{destroy:void 0},_g.bind(null,u,g,o,s),null),tt===null)throw Error(a(349));v||(li&127)!==0||Cg(u,s,o)}return o}function Cg(t,s,o){t.flags|=16384,t={getSnapshot:s,value:o},s=ze.updateQueue,s===null?(s=qr(),ze.updateQueue=s,s.stores=[t]):(o=s.stores,o===null?s.stores=[t]:o.push(t))}function _g(t,s,o,u){s.value=o,s.getSnapshot=u,Dg(s)&&Ag(t)}function Eg(t,s,o){return o(function(){Dg(s)&&Ag(t)})}function Dg(t){var s=t.getSnapshot;t=t.value;try{var o=s();return!Jt(t,o)}catch{return!0}}function Ag(t){var s=fs(t,2);s!==null&&Wt(s,t,2)}function md(t){var s=Lt();if(typeof t=="function"){var o=t;if(t=o(),Ss){_i(!0);try{o()}finally{_i(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:t},s}function Ng(t,s,o,u){return t.baseState=o,hd(t,Ke,typeof u=="function"?u:ci)}function UD(t,s,o,u,g){if(Kr(t))throw Error(a(485));if(t=s.action,t!==null){var v={payload:g,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){v.listeners.push(S)}};M.T!==null?o(!0):v.isTransition=!1,u(v),o=s.pending,o===null?(v.next=s.pending=v,jg(s,v)):(v.next=o.next,s.pending=o.next=v)}}function jg(t,s){var o=s.action,u=s.payload,g=t.state;if(s.isTransition){var v=M.T,S={};M.T=S;try{var j=o(g,u),P=M.S;P!==null&&P(S,j),Tg(t,s,j)}catch(Z){pd(t,s,Z)}finally{v!==null&&S.types!==null&&(v.types=S.types),M.T=v}}else try{v=o(g,u),Tg(t,s,v)}catch(Z){pd(t,s,Z)}}function Tg(t,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){kg(t,s,u)},function(u){return pd(t,s,u)}):kg(t,s,o)}function kg(t,s,o){s.status="fulfilled",s.value=o,Rg(s),t.state=o,s=t.pending,s!==null&&(o=s.next,o===s?t.pending=null:(o=o.next,s.next=o,jg(t,o)))}function pd(t,s,o){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do s.status="rejected",s.reason=o,Rg(s),s=s.next;while(s!==u)}t.action=null}function Rg(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function Og(t,s){return s}function zg(t,s){if(Ue){var o=tt.formState;if(o!==null){e:{var u=ze;if(Ue){if(nt){t:{for(var g=nt,v=gn;g.nodeType!==8;){if(!v){g=null;break t}if(g=yn(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){nt=yn(g.nextSibling),u=g.data==="F!";break e}}ji(u)}u=!1}u&&(s=o[0])}}return o=Lt(),o.memoizedState=o.baseState=s,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Og,lastRenderedState:s},o.queue=u,o=Jg.bind(null,ze,u),u.dispatch=o,u=md(!1),v=wd.bind(null,ze,!1,u.queue),u=Lt(),g={state:s,dispatch:null,action:t,pending:null},u.queue=g,o=UD.bind(null,ze,g,v,o),g.dispatch=o,u.memoizedState=t,[s,o,!1]}function Mg(t){var s=ft();return Pg(s,Ke,t)}function Pg(t,s,o){if(s=hd(t,s,Og)[0],t=Xr(ci)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var u=xo(s)}catch(S){throw S===aa?Gr:S}else u=s;s=ft();var g=s.queue,v=g.dispatch;return o!==s.memoizedState&&(ze.flags|=2048,ua(9,{destroy:void 0},$D.bind(null,g,o),null)),[u,v,t]}function $D(t,s){t.action=s}function Lg(t){var s=ft(),o=Ke;if(o!==null)return Pg(s,o,t);ft(),s=s.memoizedState,o=ft();var u=o.queue.dispatch;return o.memoizedState=t,[s,u,!1]}function ua(t,s,o,u){return t={tag:t,create:o,deps:u,inst:s,next:null},s=ze.updateQueue,s===null&&(s=qr(),ze.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=t.next=t:(u=o.next,o.next=t,t.next=u,s.lastEffect=t),t}function Ig(){return ft().memoizedState}function Qr(t,s,o,u){var g=Lt();ze.flags|=t,g.memoizedState=ua(1|s,{destroy:void 0},o,u===void 0?null:u)}function Zr(t,s,o,u){var g=ft();u=u===void 0?null:u;var v=g.memoizedState.inst;Ke!==null&&u!==null&&od(u,Ke.memoizedState.deps)?g.memoizedState=ua(s,v,o,u):(ze.flags|=t,g.memoizedState=ua(1|s,v,o,u))}function Gg(t,s){Qr(8390656,8,t,s)}function gd(t,s){Zr(2048,8,t,s)}function WD(t){ze.flags|=4;var s=ze.updateQueue;if(s===null)s=qr(),ze.updateQueue=s,s.events=[t];else{var o=s.events;o===null?s.events=[t]:o.push(t)}}function Bg(t){var s=ft().memoizedState;return WD({ref:s,nextImpl:t}),function(){if((Ye&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function Hg(t,s){return Zr(4,2,t,s)}function Vg(t,s){return Zr(4,4,t,s)}function Fg(t,s){if(typeof s=="function"){t=t();var o=s(t);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Ug(t,s,o){o=o!=null?o.concat([t]):null,Zr(4,4,Fg.bind(null,s,t),o)}function vd(){}function $g(t,s){var o=ft();s=s===void 0?null:s;var u=o.memoizedState;return s!==null&&od(s,u[1])?u[0]:(o.memoizedState=[t,s],t)}function Wg(t,s){var o=ft();s=s===void 0?null:s;var u=o.memoizedState;if(s!==null&&od(s,u[1]))return u[0];if(u=t(),Ss){_i(!0);try{t()}finally{_i(!1)}}return o.memoizedState=[u,s],u}function yd(t,s,o){return o===void 0||(li&1073741824)!==0&&(Ve&261930)===0?t.memoizedState=s:(t.memoizedState=o,t=qv(),ze.lanes|=t,Ii|=t,o)}function qg(t,s,o,u){return Jt(o,s)?o:ra.current!==null?(t=yd(t,o,u),Jt(t,s)||(gt=!0),t):(li&42)===0||(li&1073741824)!==0&&(Ve&261930)===0?(gt=!0,t.memoizedState=o):(t=qv(),ze.lanes|=t,Ii|=t,s)}function Yg(t,s,o,u,g){var v=K.p;K.p=v!==0&&8>v?v:8;var S=M.T,j={};M.T=j,wd(t,!1,s,o);try{var P=g(),Z=M.S;if(Z!==null&&Z(j,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var se=HD(P,u);wo(t,s,se,on(t))}else wo(t,s,u,on(t))}catch(re){wo(t,s,{then:function(){},status:"rejected",reason:re},on())}finally{K.p=v,S!==null&&j.types!==null&&(S.types=j.types),M.T=S}}function qD(){}function bd(t,s,o,u){if(t.tag!==5)throw Error(a(476));var g=Xg(t).queue;Yg(t,g,s,q,o===null?qD:function(){return Qg(t),o(u)})}function Xg(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:q,baseState:q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:q},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:o},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function Qg(t){var s=Xg(t);s.next===null&&(s=t.alternate.memoizedState),wo(t,s.next.queue,{},on())}function xd(){return jt(Io)}function Zg(){return ft().memoizedState}function Kg(){return ft().memoizedState}function YD(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var o=on();t=Ri(o);var u=Oi(s,t,o);u!==null&&(Wt(u,s,o),go(u,s,o)),s={cache:Xu()},t.payload=s;return}s=s.return}}function XD(t,s,o){var u=on();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Kr(t)?ev(s,o):(o=Iu(t,s,o,u),o!==null&&(Wt(o,t,u),tv(o,s,u)))}function Jg(t,s,o){var u=on();wo(t,s,o,u)}function wo(t,s,o,u){var g={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Kr(t))ev(s,g);else{var v=t.alternate;if(t.lanes===0&&(v===null||v.lanes===0)&&(v=s.lastRenderedReducer,v!==null))try{var S=s.lastRenderedState,j=v(S,o);if(g.hasEagerState=!0,g.eagerState=j,Jt(j,S))return Rr(t,s,g,0),tt===null&&kr(),!1}catch{}if(o=Iu(t,s,g,u),o!==null)return Wt(o,t,u),tv(o,s,u),!0}return!1}function wd(t,s,o,u){if(u={lane:2,revertLane:Jd(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Kr(t)){if(s)throw Error(a(479))}else s=Iu(t,o,u,2),s!==null&&Wt(s,t,2)}function Kr(t){var s=t.alternate;return t===ze||s!==null&&s===ze}function ev(t,s){la=$r=!0;var o=t.pending;o===null?s.next=s:(s.next=o.next,o.next=s),t.pending=s}function tv(t,s,o){if((o&4194048)!==0){var u=s.lanes;u&=t.pendingLanes,o|=u,s.lanes=o,op(t,o)}}var So={readContext:jt,use:Yr,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};So.useEffectEvent=lt;var nv={readContext:jt,use:Yr,useCallback:function(t,s){return Lt().memoizedState=[t,s===void 0?null:s],t},useContext:jt,useEffect:Gg,useImperativeHandle:function(t,s,o){o=o!=null?o.concat([t]):null,Qr(4194308,4,Fg.bind(null,s,t),o)},useLayoutEffect:function(t,s){return Qr(4194308,4,t,s)},useInsertionEffect:function(t,s){Qr(4,2,t,s)},useMemo:function(t,s){var o=Lt();s=s===void 0?null:s;var u=t();if(Ss){_i(!0);try{t()}finally{_i(!1)}}return o.memoizedState=[u,s],u},useReducer:function(t,s,o){var u=Lt();if(o!==void 0){var g=o(s);if(Ss){_i(!0);try{o(s)}finally{_i(!1)}}}else g=s;return u.memoizedState=u.baseState=g,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:g},u.queue=t,t=t.dispatch=XD.bind(null,ze,t),[u.memoizedState,t]},useRef:function(t){var s=Lt();return t={current:t},s.memoizedState=t},useState:function(t){t=md(t);var s=t.queue,o=Jg.bind(null,ze,s);return s.dispatch=o,[t.memoizedState,o]},useDebugValue:vd,useDeferredValue:function(t,s){var o=Lt();return yd(o,t,s)},useTransition:function(){var t=md(!1);return t=Yg.bind(null,ze,t.queue,!0,!1),Lt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,o){var u=ze,g=Lt();if(Ue){if(o===void 0)throw Error(a(407));o=o()}else{if(o=s(),tt===null)throw Error(a(349));(Ve&127)!==0||Cg(u,s,o)}g.memoizedState=o;var v={value:o,getSnapshot:s};return g.queue=v,Gg(Eg.bind(null,u,v,t),[t]),u.flags|=2048,ua(9,{destroy:void 0},_g.bind(null,u,v,o,s),null),o},useId:function(){var t=Lt(),s=tt.identifierPrefix;if(Ue){var o=Bn,u=Gn;o=(u&~(1<<32-Kt(u)-1)).toString(32)+o,s="_"+s+"R_"+o,o=Wr++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=VD++,s="_"+s+"r_"+o.toString(32)+"_";return t.memoizedState=s},useHostTransitionStatus:xd,useFormState:zg,useActionState:zg,useOptimistic:function(t){var s=Lt();s.memoizedState=s.baseState=t;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=wd.bind(null,ze,!0,o),o.dispatch=s,[t,s]},useMemoCache:dd,useCacheRefresh:function(){return Lt().memoizedState=YD.bind(null,ze)},useEffectEvent:function(t){var s=Lt(),o={impl:t};return s.memoizedState=o,function(){if((Ye&2)!==0)throw Error(a(440));return o.impl.apply(void 0,arguments)}}},Sd={readContext:jt,use:Yr,useCallback:$g,useContext:jt,useEffect:gd,useImperativeHandle:Ug,useInsertionEffect:Hg,useLayoutEffect:Vg,useMemo:Wg,useReducer:Xr,useRef:Ig,useState:function(){return Xr(ci)},useDebugValue:vd,useDeferredValue:function(t,s){var o=ft();return qg(o,Ke.memoizedState,t,s)},useTransition:function(){var t=Xr(ci)[0],s=ft().memoizedState;return[typeof t=="boolean"?t:xo(t),s]},useSyncExternalStore:Sg,useId:Zg,useHostTransitionStatus:xd,useFormState:Mg,useActionState:Mg,useOptimistic:function(t,s){var o=ft();return Ng(o,Ke,t,s)},useMemoCache:dd,useCacheRefresh:Kg};Sd.useEffectEvent=Bg;var iv={readContext:jt,use:Yr,useCallback:$g,useContext:jt,useEffect:gd,useImperativeHandle:Ug,useInsertionEffect:Hg,useLayoutEffect:Vg,useMemo:Wg,useReducer:fd,useRef:Ig,useState:function(){return fd(ci)},useDebugValue:vd,useDeferredValue:function(t,s){var o=ft();return Ke===null?yd(o,t,s):qg(o,Ke.memoizedState,t,s)},useTransition:function(){var t=fd(ci)[0],s=ft().memoizedState;return[typeof t=="boolean"?t:xo(t),s]},useSyncExternalStore:Sg,useId:Zg,useHostTransitionStatus:xd,useFormState:Lg,useActionState:Lg,useOptimistic:function(t,s){var o=ft();return Ke!==null?Ng(o,Ke,t,s):(o.baseState=t,[t,o.queue.dispatch])},useMemoCache:dd,useCacheRefresh:Kg};iv.useEffectEvent=Bg;function Cd(t,s,o,u){s=t.memoizedState,o=o(u,s),o=o==null?s:b({},s,o),t.memoizedState=o,t.lanes===0&&(t.updateQueue.baseState=o)}var _d={enqueueSetState:function(t,s,o){t=t._reactInternals;var u=on(),g=Ri(u);g.payload=s,o!=null&&(g.callback=o),s=Oi(t,g,u),s!==null&&(Wt(s,t,u),go(s,t,u))},enqueueReplaceState:function(t,s,o){t=t._reactInternals;var u=on(),g=Ri(u);g.tag=1,g.payload=s,o!=null&&(g.callback=o),s=Oi(t,g,u),s!==null&&(Wt(s,t,u),go(s,t,u))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var o=on(),u=Ri(o);u.tag=2,s!=null&&(u.callback=s),s=Oi(t,u,o),s!==null&&(Wt(s,t,o),go(s,t,o))}};function sv(t,s,o,u,g,v,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,v,S):s.prototype&&s.prototype.isPureReactComponent?!ro(o,u)||!ro(g,v):!0}function av(t,s,o,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,u),s.state!==t&&_d.enqueueReplaceState(s,s.state,null)}function Cs(t,s){var o=s;if("ref"in s){o={};for(var u in s)u!=="ref"&&(o[u]=s[u])}if(t=t.defaultProps){o===s&&(o=b({},o));for(var g in t)o[g]===void 0&&(o[g]=t[g])}return o}function ov(t){Tr(t)}function rv(t){console.error(t)}function lv(t){Tr(t)}function Jr(t,s){try{var o=t.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(u){setTimeout(function(){throw u})}}function cv(t,s,o){try{var u=t.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Ed(t,s,o){return o=Ri(o),o.tag=3,o.payload={element:null},o.callback=function(){Jr(t,s)},o}function uv(t){return t=Ri(t),t.tag=3,t}function dv(t,s,o,u){var g=o.type.getDerivedStateFromError;if(typeof g=="function"){var v=u.value;t.payload=function(){return g(v)},t.callback=function(){cv(s,o,u)}}var S=o.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){cv(s,o,u),typeof g!="function"&&(Gi===null?Gi=new Set([this]):Gi.add(this));var j=u.stack;this.componentDidCatch(u.value,{componentStack:j!==null?j:""})})}function QD(t,s,o,u,g){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(s=o.alternate,s!==null&&na(s,o,g,!0),o=tn.current,o!==null){switch(o.tag){case 31:case 13:return vn===null?dl():o.alternate===null&&ct===0&&(ct=3),o.flags&=-257,o.flags|=65536,o.lanes=g,u===Br?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([u]):s.add(u),Qd(t,u,g)),!1;case 22:return o.flags|=65536,u===Br?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([u]):o.add(u)),Qd(t,u,g)),!1}throw Error(a(435,o.tag))}return Qd(t,u,g),dl(),!1}if(Ue)return s=tn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=g,u!==Uu&&(t=Error(a(422),{cause:u}),uo(fn(t,o)))):(u!==Uu&&(s=Error(a(423),{cause:u}),uo(fn(s,o))),t=t.current.alternate,t.flags|=65536,g&=-g,t.lanes|=g,u=fn(u,o),g=Ed(t.stateNode,u,g),td(t,g),ct!==4&&(ct=2)),!1;var v=Error(a(520),{cause:u});if(v=fn(v,o),To===null?To=[v]:To.push(v),ct!==4&&(ct=2),s===null)return!0;u=fn(u,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,t=g&-g,o.lanes|=t,t=Ed(o.stateNode,u,t),td(o,t),!1;case 1:if(s=o.type,v=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Gi===null||!Gi.has(v))))return o.flags|=65536,g&=-g,o.lanes|=g,g=uv(g),dv(g,t,o,u),td(o,g),!1}o=o.return}while(o!==null);return!1}var Dd=Error(a(461)),gt=!1;function Tt(t,s,o,u){s.child=t===null?pg(s,null,o,u):ws(s,t.child,o,u)}function hv(t,s,o,u,g){o=o.render;var v=s.ref;if("ref"in u){var S={};for(var j in u)j!=="ref"&&(S[j]=u[j])}else S=u;return vs(s),u=rd(t,s,o,S,v,g),j=ld(),t!==null&&!gt?(cd(t,s,g),ui(t,s,g)):(Ue&&j&&Vu(s),s.flags|=1,Tt(t,s,u,g),s.child)}function fv(t,s,o,u,g){if(t===null){var v=o.type;return typeof v=="function"&&!Gu(v)&&v.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=v,mv(t,s,v,u,g)):(t=zr(o.type,null,u,s,s.mode,g),t.ref=s.ref,t.return=s,s.child=t)}if(v=t.child,!zd(t,g)){var S=v.memoizedProps;if(o=o.compare,o=o!==null?o:ro,o(S,u)&&t.ref===s.ref)return ui(t,s,g)}return s.flags|=1,t=si(v,u),t.ref=s.ref,t.return=s,s.child=t}function mv(t,s,o,u,g){if(t!==null){var v=t.memoizedProps;if(ro(v,u)&&t.ref===s.ref)if(gt=!1,s.pendingProps=u=v,zd(t,g))(t.flags&131072)!==0&&(gt=!0);else return s.lanes=t.lanes,ui(t,s,g)}return Ad(t,s,o,u,g)}function pv(t,s,o,u){var g=u.children,v=t!==null?t.memoizedState:null;if(t===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((s.flags&128)!==0){if(v=v!==null?v.baseLanes|o:o,t!==null){for(u=s.child=t.child,g=0;u!==null;)g=g|u.lanes|u.childLanes,u=u.sibling;u=g&~v}else u=0,s.child=null;return gv(t,s,v,o,u)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&Ir(s,v!==null?v.cachePool:null),v!==null?yg(s,v):id(),bg(s);else return u=s.lanes=536870912,gv(t,s,v!==null?v.baseLanes|o:o,o,u)}else v!==null?(Ir(s,v.cachePool),yg(s,v),Mi(),s.memoizedState=null):(t!==null&&Ir(s,null),id(),Mi());return Tt(t,s,g,o),s.child}function Co(t,s){return t!==null&&t.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function gv(t,s,o,u,g){var v=Zu();return v=v===null?null:{parent:mt._currentValue,pool:v},s.memoizedState={baseLanes:o,cachePool:v},t!==null&&Ir(s,null),id(),bg(s),t!==null&&na(t,s,u,!0),s.childLanes=g,null}function el(t,s){return s=nl({mode:s.mode,children:s.children},t.mode),s.ref=t.ref,t.child=s,s.return=t,s}function vv(t,s,o){return ws(s,t.child,null,o),t=el(s,s.pendingProps),t.flags|=2,nn(s),s.memoizedState=null,t}function ZD(t,s,o){var u=s.pendingProps,g=(s.flags&128)!==0;if(s.flags&=-129,t===null){if(Ue){if(u.mode==="hidden")return t=el(s,u),s.lanes=536870912,Co(null,t);if(ad(s),(t=nt)?(t=jy(t,gn),t=t!==null&&t.data==="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ai!==null?{id:Gn,overflow:Bn}:null,retryLane:536870912,hydrationErrors:null},o=eg(t),o.return=s,s.child=o,Nt=s,nt=null)):t=null,t===null)throw ji(s);return s.lanes=536870912,null}return el(s,u)}var v=t.memoizedState;if(v!==null){var S=v.dehydrated;if(ad(s),g)if(s.flags&256)s.flags&=-257,s=vv(t,s,o);else if(s.memoizedState!==null)s.child=t.child,s.flags|=128,s=null;else throw Error(a(558));else if(gt||na(t,s,o,!1),g=(o&t.childLanes)!==0,gt||g){if(u=tt,u!==null&&(S=rp(u,o),S!==0&&S!==v.retryLane))throw v.retryLane=S,fs(t,S),Wt(u,t,S),Dd;dl(),s=vv(t,s,o)}else t=v.treeContext,nt=yn(S.nextSibling),Nt=s,Ue=!0,Ni=null,gn=!1,t!==null&&ig(s,t),s=el(s,u),s.flags|=4096;return s}return t=si(t.child,{mode:u.mode,children:u.children}),t.ref=s.ref,s.child=t,t.return=s,t}function tl(t,s){var o=s.ref;if(o===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(a(284));(t===null||t.ref!==o)&&(s.flags|=4194816)}}function Ad(t,s,o,u,g){return vs(s),o=rd(t,s,o,u,void 0,g),u=ld(),t!==null&&!gt?(cd(t,s,g),ui(t,s,g)):(Ue&&u&&Vu(s),s.flags|=1,Tt(t,s,o,g),s.child)}function yv(t,s,o,u,g,v){return vs(s),s.updateQueue=null,o=wg(s,u,o,g),xg(t),u=ld(),t!==null&&!gt?(cd(t,s,v),ui(t,s,v)):(Ue&&u&&Vu(s),s.flags|=1,Tt(t,s,o,v),s.child)}function bv(t,s,o,u,g){if(vs(s),s.stateNode===null){var v=Ks,S=o.contextType;typeof S=="object"&&S!==null&&(v=jt(S)),v=new o(u,v),s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=_d,s.stateNode=v,v._reactInternals=s,v=s.stateNode,v.props=u,v.state=s.memoizedState,v.refs={},Ju(s),S=o.contextType,v.context=typeof S=="object"&&S!==null?jt(S):Ks,v.state=s.memoizedState,S=o.getDerivedStateFromProps,typeof S=="function"&&(Cd(s,o,S,u),v.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(S=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),S!==v.state&&_d.enqueueReplaceState(v,v.state,null),yo(s,u,v,g),vo(),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308),u=!0}else if(t===null){v=s.stateNode;var j=s.memoizedProps,P=Cs(o,j);v.props=P;var Z=v.context,se=o.contextType;S=Ks,typeof se=="object"&&se!==null&&(S=jt(se));var re=o.getDerivedStateFromProps;se=typeof re=="function"||typeof v.getSnapshotBeforeUpdate=="function",j=s.pendingProps!==j,se||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(j||Z!==S)&&av(s,v,u,S),ki=!1;var J=s.memoizedState;v.state=J,yo(s,u,v,g),vo(),Z=s.memoizedState,j||J!==Z||ki?(typeof re=="function"&&(Cd(s,o,re,u),Z=s.memoizedState),(P=ki||sv(s,o,P,u,J,Z,S))?(se||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(s.flags|=4194308)):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=Z),v.props=u,v.state=Z,v.context=S,u=P):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{v=s.stateNode,ed(t,s),S=s.memoizedProps,se=Cs(o,S),v.props=se,re=s.pendingProps,J=v.context,Z=o.contextType,P=Ks,typeof Z=="object"&&Z!==null&&(P=jt(Z)),j=o.getDerivedStateFromProps,(Z=typeof j=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==re||J!==P)&&av(s,v,u,P),ki=!1,J=s.memoizedState,v.state=J,yo(s,u,v,g),vo();var te=s.memoizedState;S!==re||J!==te||ki||t!==null&&t.dependencies!==null&&Pr(t.dependencies)?(typeof j=="function"&&(Cd(s,o,j,u),te=s.memoizedState),(se=ki||sv(s,o,se,u,J,te,P)||t!==null&&t.dependencies!==null&&Pr(t.dependencies))?(Z||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(u,te,P),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(u,te,P)),typeof v.componentDidUpdate=="function"&&(s.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===t.memoizedProps&&J===t.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&J===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=te),v.props=u,v.state=te,v.context=P,u=se):(typeof v.componentDidUpdate!="function"||S===t.memoizedProps&&J===t.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&J===t.memoizedState||(s.flags|=1024),u=!1)}return v=u,tl(t,s),u=(s.flags&128)!==0,v||u?(v=s.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:v.render(),s.flags|=1,t!==null&&u?(s.child=ws(s,t.child,null,g),s.child=ws(s,null,o,g)):Tt(t,s,o,g),s.memoizedState=v.state,t=s.child):t=ui(t,s,g),t}function xv(t,s,o,u){return ps(),s.flags|=256,Tt(t,s,o,u),s.child}var Nd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function jd(t){return{baseLanes:t,cachePool:cg()}}function Td(t,s,o){return t=t!==null?t.childLanes&~o:0,s&&(t|=an),t}function wv(t,s,o){var u=s.pendingProps,g=!1,v=(s.flags&128)!==0,S;if((S=v)||(S=t!==null&&t.memoizedState===null?!1:(ht.current&2)!==0),S&&(g=!0,s.flags&=-129),S=(s.flags&32)!==0,s.flags&=-33,t===null){if(Ue){if(g?zi(s):Mi(),(t=nt)?(t=jy(t,gn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ai!==null?{id:Gn,overflow:Bn}:null,retryLane:536870912,hydrationErrors:null},o=eg(t),o.return=s,s.child=o,Nt=s,nt=null)):t=null,t===null)throw ji(s);return hh(t)?s.lanes=32:s.lanes=536870912,null}var j=u.children;return u=u.fallback,g?(Mi(),g=s.mode,j=nl({mode:"hidden",children:j},g),u=ms(u,g,o,null),j.return=s,u.return=s,j.sibling=u,s.child=j,u=s.child,u.memoizedState=jd(o),u.childLanes=Td(t,S,o),s.memoizedState=Nd,Co(null,u)):(zi(s),kd(s,j))}var P=t.memoizedState;if(P!==null&&(j=P.dehydrated,j!==null)){if(v)s.flags&256?(zi(s),s.flags&=-257,s=Rd(t,s,o)):s.memoizedState!==null?(Mi(),s.child=t.child,s.flags|=128,s=null):(Mi(),j=u.fallback,g=s.mode,u=nl({mode:"visible",children:u.children},g),j=ms(j,g,o,null),j.flags|=2,u.return=s,j.return=s,u.sibling=j,s.child=u,ws(s,t.child,null,o),u=s.child,u.memoizedState=jd(o),u.childLanes=Td(t,S,o),s.memoizedState=Nd,s=Co(null,u));else if(zi(s),hh(j)){if(S=j.nextSibling&&j.nextSibling.dataset,S)var Z=S.dgst;S=Z,u=Error(a(419)),u.stack="",u.digest=S,uo({value:u,source:null,stack:null}),s=Rd(t,s,o)}else if(gt||na(t,s,o,!1),S=(o&t.childLanes)!==0,gt||S){if(S=tt,S!==null&&(u=rp(S,o),u!==0&&u!==P.retryLane))throw P.retryLane=u,fs(t,u),Wt(S,t,u),Dd;dh(j)||dl(),s=Rd(t,s,o)}else dh(j)?(s.flags|=192,s.child=t.child,s=null):(t=P.treeContext,nt=yn(j.nextSibling),Nt=s,Ue=!0,Ni=null,gn=!1,t!==null&&ig(s,t),s=kd(s,u.children),s.flags|=4096);return s}return g?(Mi(),j=u.fallback,g=s.mode,P=t.child,Z=P.sibling,u=si(P,{mode:"hidden",children:u.children}),u.subtreeFlags=P.subtreeFlags&65011712,Z!==null?j=si(Z,j):(j=ms(j,g,o,null),j.flags|=2),j.return=s,u.return=s,u.sibling=j,s.child=u,Co(null,u),u=s.child,j=t.child.memoizedState,j===null?j=jd(o):(g=j.cachePool,g!==null?(P=mt._currentValue,g=g.parent!==P?{parent:P,pool:P}:g):g=cg(),j={baseLanes:j.baseLanes|o,cachePool:g}),u.memoizedState=j,u.childLanes=Td(t,S,o),s.memoizedState=Nd,Co(t.child,u)):(zi(s),o=t.child,t=o.sibling,o=si(o,{mode:"visible",children:u.children}),o.return=s,o.sibling=null,t!==null&&(S=s.deletions,S===null?(s.deletions=[t],s.flags|=16):S.push(t)),s.child=o,s.memoizedState=null,o)}function kd(t,s){return s=nl({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function nl(t,s){return t=en(22,t,null,s),t.lanes=0,t}function Rd(t,s,o){return ws(s,t.child,null,o),t=kd(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function Sv(t,s,o){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),qu(t.return,s,o)}function Od(t,s,o,u,g,v){var S=t.memoizedState;S===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:g,treeForkCount:v}:(S.isBackwards=s,S.rendering=null,S.renderingStartTime=0,S.last=u,S.tail=o,S.tailMode=g,S.treeForkCount=v)}function Cv(t,s,o){var u=s.pendingProps,g=u.revealOrder,v=u.tail;u=u.children;var S=ht.current,j=(S&2)!==0;if(j?(S=S&1|2,s.flags|=128):S&=1,ee(ht,S),Tt(t,s,u,o),u=Ue?co:0,!j&&t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Sv(t,o,s);else if(t.tag===19)Sv(t,o,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(g){case"forwards":for(o=s.child,g=null;o!==null;)t=o.alternate,t!==null&&Ur(t)===null&&(g=o),o=o.sibling;o=g,o===null?(g=s.child,s.child=null):(g=o.sibling,o.sibling=null),Od(s,!1,g,o,v,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,g=s.child,s.child=null;g!==null;){if(t=g.alternate,t!==null&&Ur(t)===null){s.child=g;break}t=g.sibling,g.sibling=o,o=g,g=t}Od(s,!0,o,null,v,u);break;case"together":Od(s,!1,null,null,void 0,u);break;default:s.memoizedState=null}return s.child}function ui(t,s,o){if(t!==null&&(s.dependencies=t.dependencies),Ii|=s.lanes,(o&s.childLanes)===0)if(t!==null){if(na(t,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(a(153));if(s.child!==null){for(t=s.child,o=si(t,t.pendingProps),s.child=o,o.return=s;t.sibling!==null;)t=t.sibling,o=o.sibling=si(t,t.pendingProps),o.return=s;o.sibling=null}return s.child}function zd(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&Pr(t)))}function KD(t,s,o){switch(s.tag){case 3:ce(s,s.stateNode.containerInfo),Ti(s,mt,t.memoizedState.cache),ps();break;case 27:case 5:De(s);break;case 4:ce(s,s.stateNode.containerInfo);break;case 10:Ti(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,ad(s),null;break;case 13:var u=s.memoizedState;if(u!==null)return u.dehydrated!==null?(zi(s),s.flags|=128,null):(o&s.child.childLanes)!==0?wv(t,s,o):(zi(s),t=ui(t,s,o),t!==null?t.sibling:null);zi(s);break;case 19:var g=(t.flags&128)!==0;if(u=(o&s.childLanes)!==0,u||(na(t,s,o,!1),u=(o&s.childLanes)!==0),g){if(u)return Cv(t,s,o);s.flags|=128}if(g=s.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),ee(ht,ht.current),u)break;return null;case 22:return s.lanes=0,pv(t,s,o,s.pendingProps);case 24:Ti(s,mt,t.memoizedState.cache)}return ui(t,s,o)}function _v(t,s,o){if(t!==null)if(t.memoizedProps!==s.pendingProps)gt=!0;else{if(!zd(t,o)&&(s.flags&128)===0)return gt=!1,KD(t,s,o);gt=(t.flags&131072)!==0}else gt=!1,Ue&&(s.flags&1048576)!==0&&ng(s,co,s.index);switch(s.lanes=0,s.tag){case 16:e:{var u=s.pendingProps;if(t=bs(s.elementType),s.type=t,typeof t=="function")Gu(t)?(u=Cs(t,u),s.tag=1,s=bv(null,s,t,u,o)):(s.tag=0,s=Ad(null,s,t,u,o));else{if(t!=null){var g=t.$$typeof;if(g===T){s.tag=11,s=hv(null,s,t,u,o);break e}else if(g===O){s.tag=14,s=fv(null,s,t,u,o);break e}}throw s=ne(t)||t,Error(a(306,s,""))}}return s;case 0:return Ad(t,s,s.type,s.pendingProps,o);case 1:return u=s.type,g=Cs(u,s.pendingProps),bv(t,s,u,g,o);case 3:e:{if(ce(s,s.stateNode.containerInfo),t===null)throw Error(a(387));u=s.pendingProps;var v=s.memoizedState;g=v.element,ed(t,s),yo(s,u,null,o);var S=s.memoizedState;if(u=S.cache,Ti(s,mt,u),u!==v.cache&&Yu(s,[mt],o,!0),vo(),u=S.element,v.isDehydrated)if(v={element:u,isDehydrated:!1,cache:S.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=xv(t,s,u,o);break e}else if(u!==g){g=fn(Error(a(424)),s),uo(g),s=xv(t,s,u,o);break e}else for(t=s.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,nt=yn(t.firstChild),Nt=s,Ue=!0,Ni=null,gn=!0,o=pg(s,null,u,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ps(),u===g){s=ui(t,s,o);break e}Tt(t,s,u,o)}s=s.child}return s;case 26:return tl(t,s),t===null?(o=My(s.type,null,s.pendingProps,null))?s.memoizedState=o:Ue||(o=s.type,t=s.pendingProps,u=yl(le.current).createElement(o),u[At]=s,u[Bt]=t,kt(u,o,t),Ct(u),s.stateNode=u):s.memoizedState=My(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return De(s),t===null&&Ue&&(u=s.stateNode=Ry(s.type,s.pendingProps,le.current),Nt=s,gn=!0,g=nt,Fi(s.type)?(fh=g,nt=yn(u.firstChild)):nt=g),Tt(t,s,s.pendingProps.children,o),tl(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&Ue&&((g=u=nt)&&(u=NA(u,s.type,s.pendingProps,gn),u!==null?(s.stateNode=u,Nt=s,nt=yn(u.firstChild),gn=!1,g=!0):g=!1),g||ji(s)),De(s),g=s.type,v=s.pendingProps,S=t!==null?t.memoizedProps:null,u=v.children,lh(g,v)?u=null:S!==null&&lh(g,S)&&(s.flags|=32),s.memoizedState!==null&&(g=rd(t,s,FD,null,null,o),Io._currentValue=g),tl(t,s),Tt(t,s,u,o),s.child;case 6:return t===null&&Ue&&((t=o=nt)&&(o=jA(o,s.pendingProps,gn),o!==null?(s.stateNode=o,Nt=s,nt=null,t=!0):t=!1),t||ji(s)),null;case 13:return wv(t,s,o);case 4:return ce(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=ws(s,null,u,o):Tt(t,s,u,o),s.child;case 11:return hv(t,s,s.type,s.pendingProps,o);case 7:return Tt(t,s,s.pendingProps,o),s.child;case 8:return Tt(t,s,s.pendingProps.children,o),s.child;case 12:return Tt(t,s,s.pendingProps.children,o),s.child;case 10:return u=s.pendingProps,Ti(s,s.type,u.value),Tt(t,s,u.children,o),s.child;case 9:return g=s.type._context,u=s.pendingProps.children,vs(s),g=jt(g),u=u(g),s.flags|=1,Tt(t,s,u,o),s.child;case 14:return fv(t,s,s.type,s.pendingProps,o);case 15:return mv(t,s,s.type,s.pendingProps,o);case 19:return Cv(t,s,o);case 31:return ZD(t,s,o);case 22:return pv(t,s,o,s.pendingProps);case 24:return vs(s),u=jt(mt),t===null?(g=Zu(),g===null&&(g=tt,v=Xu(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=o),g=v),s.memoizedState={parent:u,cache:g},Ju(s),Ti(s,mt,g)):((t.lanes&o)!==0&&(ed(t,s),yo(s,null,null,o),vo()),g=t.memoizedState,v=s.memoizedState,g.parent!==u?(g={parent:u,cache:u},s.memoizedState=g,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=g),Ti(s,mt,u)):(u=v.cache,Ti(s,mt,u),u!==g.cache&&Yu(s,[mt],o,!0))),Tt(t,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function di(t){t.flags|=4}function Md(t,s,o,u,g){if((s=(t.mode&32)!==0)&&(s=!1),s){if(t.flags|=16777216,(g&335544128)===g)if(t.stateNode.complete)t.flags|=8192;else if(Zv())t.flags|=8192;else throw xs=Br,Ku}else t.flags&=-16777217}function Ev(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!By(s))if(Zv())t.flags|=8192;else throw xs=Br,Ku}function il(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?sp():536870912,t.lanes|=s,ma|=s)}function _o(t,s){if(!Ue)switch(t.tailMode){case"hidden":s=t.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?t.tail=null:o.sibling=null;break;case"collapsed":o=t.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function it(t){var s=t.alternate!==null&&t.alternate.child===t.child,o=0,u=0;if(s)for(var g=t.child;g!==null;)o|=g.lanes|g.childLanes,u|=g.subtreeFlags&65011712,u|=g.flags&65011712,g.return=t,g=g.sibling;else for(g=t.child;g!==null;)o|=g.lanes|g.childLanes,u|=g.subtreeFlags,u|=g.flags,g.return=t,g=g.sibling;return t.subtreeFlags|=u,t.childLanes=o,s}function JD(t,s,o){var u=s.pendingProps;switch(Fu(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return it(s),null;case 1:return it(s),null;case 3:return o=s.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),s.memoizedState.cache!==u&&(s.flags|=2048),ri(mt),de(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(t===null||t.child===null)&&(ta(s)?di(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,$u())),it(s),null;case 26:var g=s.type,v=s.memoizedState;return t===null?(di(s),v!==null?(it(s),Ev(s,v)):(it(s),Md(s,g,null,u,o))):v?v!==t.memoizedState?(di(s),it(s),Ev(s,v)):(it(s),s.flags&=-16777217):(t=t.memoizedProps,t!==u&&di(s),it(s),Md(s,g,t,u,o)),null;case 27:if(Ge(s),o=le.current,g=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==u&&di(s);else{if(!u){if(s.stateNode===null)throw Error(a(166));return it(s),null}t=V.current,ta(s)?sg(s):(t=Ry(g,u,o),s.stateNode=t,di(s))}return it(s),null;case 5:if(Ge(s),g=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==u&&di(s);else{if(!u){if(s.stateNode===null)throw Error(a(166));return it(s),null}if(v=V.current,ta(s))sg(s);else{var S=yl(le.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=S.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof u.is=="string"?S.createElement("select",{is:u.is}):S.createElement("select"),u.multiple?v.multiple=!0:u.size&&(v.size=u.size);break;default:v=typeof u.is=="string"?S.createElement(g,{is:u.is}):S.createElement(g)}}v[At]=s,v[Bt]=u;e:for(S=s.child;S!==null;){if(S.tag===5||S.tag===6)v.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===s)break e;for(;S.sibling===null;){if(S.return===null||S.return===s)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}s.stateNode=v;e:switch(kt(v,g,u),g){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&di(s)}}return it(s),Md(s,s.type,t===null?null:t.memoizedProps,s.pendingProps,o),null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==u&&di(s);else{if(typeof u!="string"&&s.stateNode===null)throw Error(a(166));if(t=le.current,ta(s)){if(t=s.stateNode,o=s.memoizedProps,u=null,g=Nt,g!==null)switch(g.tag){case 27:case 5:u=g.memoizedProps}t[At]=s,t=!!(t.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||wy(t.nodeValue,o)),t||ji(s,!0)}else t=yl(t).createTextNode(u),t[At]=s,s.stateNode=t}return it(s),null;case 31:if(o=s.memoizedState,t===null||t.memoizedState!==null){if(u=ta(s),o!==null){if(t===null){if(!u)throw Error(a(318));if(t=s.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[At]=s}else ps(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;it(s),t=!1}else o=$u(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return s.flags&256?(nn(s),s):(nn(s),null);if((s.flags&128)!==0)throw Error(a(558))}return it(s),null;case 13:if(u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(g=ta(s),u!==null&&u.dehydrated!==null){if(t===null){if(!g)throw Error(a(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[At]=s}else ps(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;it(s),g=!1}else g=$u(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return s.flags&256?(nn(s),s):(nn(s),null)}return nn(s),(s.flags&128)!==0?(s.lanes=o,s):(o=u!==null,t=t!==null&&t.memoizedState!==null,o&&(u=s.child,g=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(g=u.alternate.memoizedState.cachePool.pool),v=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),v!==g&&(u.flags|=2048)),o!==t&&o&&(s.child.flags|=8192),il(s,s.updateQueue),it(s),null);case 4:return de(),t===null&&ih(s.stateNode.containerInfo),it(s),null;case 10:return ri(s.type),it(s),null;case 19:if(L(ht),u=s.memoizedState,u===null)return it(s),null;if(g=(s.flags&128)!==0,v=u.rendering,v===null)if(g)_o(u,!1);else{if(ct!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(v=Ur(t),v!==null){for(s.flags|=128,_o(u,!1),t=v.updateQueue,s.updateQueue=t,il(s,t),s.subtreeFlags=0,t=o,o=s.child;o!==null;)Jp(o,t),o=o.sibling;return ee(ht,ht.current&1|2),Ue&&ai(s,u.treeForkCount),s.child}t=t.sibling}u.tail!==null&&Qt()>ll&&(s.flags|=128,g=!0,_o(u,!1),s.lanes=4194304)}else{if(!g)if(t=Ur(v),t!==null){if(s.flags|=128,g=!0,t=t.updateQueue,s.updateQueue=t,il(s,t),_o(u,!0),u.tail===null&&u.tailMode==="hidden"&&!v.alternate&&!Ue)return it(s),null}else 2*Qt()-u.renderingStartTime>ll&&o!==536870912&&(s.flags|=128,g=!0,_o(u,!1),s.lanes=4194304);u.isBackwards?(v.sibling=s.child,s.child=v):(t=u.last,t!==null?t.sibling=v:s.child=v,u.last=v)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=Qt(),t.sibling=null,o=ht.current,ee(ht,g?o&1|2:o&1),Ue&&ai(s,u.treeForkCount),t):(it(s),null);case 22:case 23:return nn(s),sd(),u=s.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(s.flags|=8192):u&&(s.flags|=8192),u?(o&536870912)!==0&&(s.flags&128)===0&&(it(s),s.subtreeFlags&6&&(s.flags|=8192)):it(s),o=s.updateQueue,o!==null&&il(s,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==o&&(s.flags|=2048),t!==null&&L(ys),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ri(mt),it(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function eA(t,s){switch(Fu(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return ri(mt),de(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return Ge(s),null;case 31:if(s.memoizedState!==null){if(nn(s),s.alternate===null)throw Error(a(340));ps()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 13:if(nn(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(a(340));ps()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return L(ht),null;case 4:return de(),null;case 10:return ri(s.type),null;case 22:case 23:return nn(s),sd(),t!==null&&L(ys),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return ri(mt),null;case 25:return null;default:return null}}function Dv(t,s){switch(Fu(s),s.tag){case 3:ri(mt),de();break;case 26:case 27:case 5:Ge(s);break;case 4:de();break;case 31:s.memoizedState!==null&&nn(s);break;case 13:nn(s);break;case 19:L(ht);break;case 10:ri(s.type);break;case 22:case 23:nn(s),sd(),t!==null&&L(ys);break;case 24:ri(mt)}}function Eo(t,s){try{var o=s.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var g=u.next;o=g;do{if((o.tag&t)===t){u=void 0;var v=o.create,S=o.inst;u=v(),S.destroy=u}o=o.next}while(o!==g)}}catch(j){Qe(s,s.return,j)}}function Pi(t,s,o){try{var u=s.updateQueue,g=u!==null?u.lastEffect:null;if(g!==null){var v=g.next;u=v;do{if((u.tag&t)===t){var S=u.inst,j=S.destroy;if(j!==void 0){S.destroy=void 0,g=s;var P=o,Z=j;try{Z()}catch(se){Qe(g,P,se)}}}u=u.next}while(u!==v)}}catch(se){Qe(s,s.return,se)}}function Av(t){var s=t.updateQueue;if(s!==null){var o=t.stateNode;try{vg(s,o)}catch(u){Qe(t,t.return,u)}}}function Nv(t,s,o){o.props=Cs(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(u){Qe(t,s,u)}}function Do(t,s){try{var o=t.ref;if(o!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof o=="function"?t.refCleanup=o(u):o.current=u}}catch(g){Qe(t,s,g)}}function Hn(t,s){var o=t.ref,u=t.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(g){Qe(t,s,g)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(g){Qe(t,s,g)}else o.current=null}function jv(t){var s=t.type,o=t.memoizedProps,u=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(g){Qe(t,t.return,g)}}function Pd(t,s,o){try{var u=t.stateNode;SA(u,t.type,o,s),u[Bt]=s}catch(g){Qe(t,t.return,g)}}function Tv(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Fi(t.type)||t.tag===4}function Ld(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Fi(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Id(t,s,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(t,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(t),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=ni));else if(u!==4&&(u===27&&Fi(t.type)&&(o=t.stateNode,s=null),t=t.child,t!==null))for(Id(t,s,o),t=t.sibling;t!==null;)Id(t,s,o),t=t.sibling}function sl(t,s,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?o.insertBefore(t,s):o.appendChild(t);else if(u!==4&&(u===27&&Fi(t.type)&&(o=t.stateNode),t=t.child,t!==null))for(sl(t,s,o),t=t.sibling;t!==null;)sl(t,s,o),t=t.sibling}function kv(t){var s=t.stateNode,o=t.memoizedProps;try{for(var u=t.type,g=s.attributes;g.length;)s.removeAttributeNode(g[0]);kt(s,u,o),s[At]=t,s[Bt]=o}catch(v){Qe(t,t.return,v)}}var hi=!1,vt=!1,Gd=!1,Rv=typeof WeakSet=="function"?WeakSet:Set,_t=null;function tA(t,s){if(t=t.containerInfo,oh=El,t=Up(t),Ru(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var g=u.anchorOffset,v=u.focusNode;u=u.focusOffset;try{o.nodeType,v.nodeType}catch{o=null;break e}var S=0,j=-1,P=-1,Z=0,se=0,re=t,J=null;t:for(;;){for(var te;re!==o||g!==0&&re.nodeType!==3||(j=S+g),re!==v||u!==0&&re.nodeType!==3||(P=S+u),re.nodeType===3&&(S+=re.nodeValue.length),(te=re.firstChild)!==null;)J=re,re=te;for(;;){if(re===t)break t;if(J===o&&++Z===g&&(j=S),J===v&&++se===u&&(P=S),(te=re.nextSibling)!==null)break;re=J,J=re.parentNode}re=te}o=j===-1||P===-1?null:{start:j,end:P}}else o=null}o=o||{start:0,end:0}}else o=null;for(rh={focusedElem:t,selectionRange:o},El=!1,_t=s;_t!==null;)if(s=_t,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,_t=t;else for(;_t!==null;){switch(s=_t,v=s.alternate,t=s.flags,s.tag){case 0:if((t&4)!==0&&(t=s.updateQueue,t=t!==null?t.events:null,t!==null))for(o=0;o<t.length;o++)g=t[o],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&v!==null){t=void 0,o=s,g=v.memoizedProps,v=v.memoizedState,u=o.stateNode;try{var me=Cs(o.type,g);t=u.getSnapshotBeforeUpdate(me,v),u.__reactInternalSnapshotBeforeUpdate=t}catch(_e){Qe(o,o.return,_e)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,o=t.nodeType,o===9)uh(t);else if(o===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":uh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(a(163))}if(t=s.sibling,t!==null){t.return=s.return,_t=t;break}_t=s.return}}function Ov(t,s,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:mi(t,o),u&4&&Eo(5,o);break;case 1:if(mi(t,o),u&4)if(t=o.stateNode,s===null)try{t.componentDidMount()}catch(S){Qe(o,o.return,S)}else{var g=Cs(o.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(g,s,t.__reactInternalSnapshotBeforeUpdate)}catch(S){Qe(o,o.return,S)}}u&64&&Av(o),u&512&&Do(o,o.return);break;case 3:if(mi(t,o),u&64&&(t=o.updateQueue,t!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{vg(t,s)}catch(S){Qe(o,o.return,S)}}break;case 27:s===null&&u&4&&kv(o);case 26:case 5:mi(t,o),s===null&&u&4&&jv(o),u&512&&Do(o,o.return);break;case 12:mi(t,o);break;case 31:mi(t,o),u&4&&Pv(t,o);break;case 13:mi(t,o),u&4&&Lv(t,o),u&64&&(t=o.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(o=uA.bind(null,o),TA(t,o))));break;case 22:if(u=o.memoizedState!==null||hi,!u){s=s!==null&&s.memoizedState!==null||vt,g=hi;var v=vt;hi=u,(vt=s)&&!v?pi(t,o,(o.subtreeFlags&8772)!==0):mi(t,o),hi=g,vt=v}break;case 30:break;default:mi(t,o)}}function zv(t){var s=t.alternate;s!==null&&(t.alternate=null,zv(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&pu(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var at=null,Vt=!1;function fi(t,s,o){for(o=o.child;o!==null;)Mv(t,s,o),o=o.sibling}function Mv(t,s,o){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(Xa,o)}catch{}switch(o.tag){case 26:vt||Hn(o,s),fi(t,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:vt||Hn(o,s);var u=at,g=Vt;Fi(o.type)&&(at=o.stateNode,Vt=!1),fi(t,s,o),Mo(o.stateNode),at=u,Vt=g;break;case 5:vt||Hn(o,s);case 6:if(u=at,g=Vt,at=null,fi(t,s,o),at=u,Vt=g,at!==null)if(Vt)try{(at.nodeType===9?at.body:at.nodeName==="HTML"?at.ownerDocument.body:at).removeChild(o.stateNode)}catch(v){Qe(o,s,v)}else try{at.removeChild(o.stateNode)}catch(v){Qe(o,s,v)}break;case 18:at!==null&&(Vt?(t=at,Ay(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,o.stateNode),Sa(t)):Ay(at,o.stateNode));break;case 4:u=at,g=Vt,at=o.stateNode.containerInfo,Vt=!0,fi(t,s,o),at=u,Vt=g;break;case 0:case 11:case 14:case 15:Pi(2,o,s),vt||Pi(4,o,s),fi(t,s,o);break;case 1:vt||(Hn(o,s),u=o.stateNode,typeof u.componentWillUnmount=="function"&&Nv(o,s,u)),fi(t,s,o);break;case 21:fi(t,s,o);break;case 22:vt=(u=vt)||o.memoizedState!==null,fi(t,s,o),vt=u;break;default:fi(t,s,o)}}function Pv(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Sa(t)}catch(o){Qe(s,s.return,o)}}}function Lv(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Sa(t)}catch(o){Qe(s,s.return,o)}}function nA(t){switch(t.tag){case 31:case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new Rv),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new Rv),s;default:throw Error(a(435,t.tag))}}function al(t,s){var o=nA(t);s.forEach(function(u){if(!o.has(u)){o.add(u);var g=dA.bind(null,t,u);u.then(g,g)}})}function Ft(t,s){var o=s.deletions;if(o!==null)for(var u=0;u<o.length;u++){var g=o[u],v=t,S=s,j=S;e:for(;j!==null;){switch(j.tag){case 27:if(Fi(j.type)){at=j.stateNode,Vt=!1;break e}break;case 5:at=j.stateNode,Vt=!1;break e;case 3:case 4:at=j.stateNode.containerInfo,Vt=!0;break e}j=j.return}if(at===null)throw Error(a(160));Mv(v,S,g),at=null,Vt=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Iv(s,t),s=s.sibling}var jn=null;function Iv(t,s){var o=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Ft(s,t),Ut(t),u&4&&(Pi(3,t,t.return),Eo(3,t),Pi(5,t,t.return));break;case 1:Ft(s,t),Ut(t),u&512&&(vt||o===null||Hn(o,o.return)),u&64&&hi&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(o=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var g=jn;if(Ft(s,t),Ut(t),u&512&&(vt||o===null||Hn(o,o.return)),u&4){var v=o!==null?o.memoizedState:null;if(u=t.memoizedState,o===null)if(u===null)if(t.stateNode===null){e:{u=t.type,o=t.memoizedProps,g=g.ownerDocument||g;t:switch(u){case"title":v=g.getElementsByTagName("title")[0],(!v||v[Ka]||v[At]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(u),g.head.insertBefore(v,g.querySelector("head > title"))),kt(v,u,o),v[At]=t,Ct(v),u=v;break e;case"link":var S=Iy("link","href",g).get(u+(o.href||""));if(S){for(var j=0;j<S.length;j++)if(v=S[j],v.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&v.getAttribute("rel")===(o.rel==null?null:o.rel)&&v.getAttribute("title")===(o.title==null?null:o.title)&&v.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){S.splice(j,1);break t}}v=g.createElement(u),kt(v,u,o),g.head.appendChild(v);break;case"meta":if(S=Iy("meta","content",g).get(u+(o.content||""))){for(j=0;j<S.length;j++)if(v=S[j],v.getAttribute("content")===(o.content==null?null:""+o.content)&&v.getAttribute("name")===(o.name==null?null:o.name)&&v.getAttribute("property")===(o.property==null?null:o.property)&&v.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&v.getAttribute("charset")===(o.charSet==null?null:o.charSet)){S.splice(j,1);break t}}v=g.createElement(u),kt(v,u,o),g.head.appendChild(v);break;default:throw Error(a(468,u))}v[At]=t,Ct(v),u=v}t.stateNode=u}else Gy(g,t.type,t.stateNode);else t.stateNode=Ly(g,u,t.memoizedProps);else v!==u?(v===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):v.count--,u===null?Gy(g,t.type,t.stateNode):Ly(g,u,t.memoizedProps)):u===null&&t.stateNode!==null&&Pd(t,t.memoizedProps,o.memoizedProps)}break;case 27:Ft(s,t),Ut(t),u&512&&(vt||o===null||Hn(o,o.return)),o!==null&&u&4&&Pd(t,t.memoizedProps,o.memoizedProps);break;case 5:if(Ft(s,t),Ut(t),u&512&&(vt||o===null||Hn(o,o.return)),t.flags&32){g=t.stateNode;try{$s(g,"")}catch(me){Qe(t,t.return,me)}}u&4&&t.stateNode!=null&&(g=t.memoizedProps,Pd(t,g,o!==null?o.memoizedProps:g)),u&1024&&(Gd=!0);break;case 6:if(Ft(s,t),Ut(t),u&4){if(t.stateNode===null)throw Error(a(162));u=t.memoizedProps,o=t.stateNode;try{o.nodeValue=u}catch(me){Qe(t,t.return,me)}}break;case 3:if(wl=null,g=jn,jn=bl(s.containerInfo),Ft(s,t),jn=g,Ut(t),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Sa(s.containerInfo)}catch(me){Qe(t,t.return,me)}Gd&&(Gd=!1,Gv(t));break;case 4:u=jn,jn=bl(t.stateNode.containerInfo),Ft(s,t),Ut(t),jn=u;break;case 12:Ft(s,t),Ut(t);break;case 31:Ft(s,t),Ut(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,al(t,u)));break;case 13:Ft(s,t),Ut(t),t.child.flags&8192&&t.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(rl=Qt()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,al(t,u)));break;case 22:g=t.memoizedState!==null;var P=o!==null&&o.memoizedState!==null,Z=hi,se=vt;if(hi=Z||g,vt=se||P,Ft(s,t),vt=se,hi=Z,Ut(t),u&8192)e:for(s=t.stateNode,s._visibility=g?s._visibility&-2:s._visibility|1,g&&(o===null||P||hi||vt||_s(t)),o=null,s=t;;){if(s.tag===5||s.tag===26){if(o===null){P=o=s;try{if(v=P.stateNode,g)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{j=P.stateNode;var re=P.memoizedProps.style,J=re!=null&&re.hasOwnProperty("display")?re.display:null;j.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(me){Qe(P,P.return,me)}}}else if(s.tag===6){if(o===null){P=s;try{P.stateNode.nodeValue=g?"":P.memoizedProps}catch(me){Qe(P,P.return,me)}}}else if(s.tag===18){if(o===null){P=s;try{var te=P.stateNode;g?Ny(te,!0):Ny(P.stateNode,!1)}catch(me){Qe(P,P.return,me)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}u&4&&(u=t.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,al(t,o))));break;case 19:Ft(s,t),Ut(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,al(t,u)));break;case 30:break;case 21:break;default:Ft(s,t),Ut(t)}}function Ut(t){var s=t.flags;if(s&2){try{for(var o,u=t.return;u!==null;){if(Tv(u)){o=u;break}u=u.return}if(o==null)throw Error(a(160));switch(o.tag){case 27:var g=o.stateNode,v=Ld(t);sl(t,v,g);break;case 5:var S=o.stateNode;o.flags&32&&($s(S,""),o.flags&=-33);var j=Ld(t);sl(t,j,S);break;case 3:case 4:var P=o.stateNode.containerInfo,Z=Ld(t);Id(t,Z,P);break;default:throw Error(a(161))}}catch(se){Qe(t,t.return,se)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Gv(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;Gv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function mi(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Ov(t,s.alternate,s),s=s.sibling}function _s(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:Pi(4,s,s.return),_s(s);break;case 1:Hn(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&Nv(s,s.return,o),_s(s);break;case 27:Mo(s.stateNode);case 26:case 5:Hn(s,s.return),_s(s);break;case 22:s.memoizedState===null&&_s(s);break;case 30:_s(s);break;default:_s(s)}t=t.sibling}}function pi(t,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var u=s.alternate,g=t,v=s,S=v.flags;switch(v.tag){case 0:case 11:case 15:pi(g,v,o),Eo(4,v);break;case 1:if(pi(g,v,o),u=v,g=u.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(Z){Qe(u,u.return,Z)}if(u=v,g=u.updateQueue,g!==null){var j=u.stateNode;try{var P=g.shared.hiddenCallbacks;if(P!==null)for(g.shared.hiddenCallbacks=null,g=0;g<P.length;g++)gg(P[g],j)}catch(Z){Qe(u,u.return,Z)}}o&&S&64&&Av(v),Do(v,v.return);break;case 27:kv(v);case 26:case 5:pi(g,v,o),o&&u===null&&S&4&&jv(v),Do(v,v.return);break;case 12:pi(g,v,o);break;case 31:pi(g,v,o),o&&S&4&&Pv(g,v);break;case 13:pi(g,v,o),o&&S&4&&Lv(g,v);break;case 22:v.memoizedState===null&&pi(g,v,o),Do(v,v.return);break;case 30:break;default:pi(g,v,o)}s=s.sibling}}function Bd(t,s){var o=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==o&&(t!=null&&t.refCount++,o!=null&&ho(o))}function Hd(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&ho(t))}function Tn(t,s,o,u){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Bv(t,s,o,u),s=s.sibling}function Bv(t,s,o,u){var g=s.flags;switch(s.tag){case 0:case 11:case 15:Tn(t,s,o,u),g&2048&&Eo(9,s);break;case 1:Tn(t,s,o,u);break;case 3:Tn(t,s,o,u),g&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&ho(t)));break;case 12:if(g&2048){Tn(t,s,o,u),t=s.stateNode;try{var v=s.memoizedProps,S=v.id,j=v.onPostCommit;typeof j=="function"&&j(S,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(P){Qe(s,s.return,P)}}else Tn(t,s,o,u);break;case 31:Tn(t,s,o,u);break;case 13:Tn(t,s,o,u);break;case 23:break;case 22:v=s.stateNode,S=s.alternate,s.memoizedState!==null?v._visibility&2?Tn(t,s,o,u):Ao(t,s):v._visibility&2?Tn(t,s,o,u):(v._visibility|=2,da(t,s,o,u,(s.subtreeFlags&10256)!==0||!1)),g&2048&&Bd(S,s);break;case 24:Tn(t,s,o,u),g&2048&&Hd(s.alternate,s);break;default:Tn(t,s,o,u)}}function da(t,s,o,u,g){for(g=g&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var v=t,S=s,j=o,P=u,Z=S.flags;switch(S.tag){case 0:case 11:case 15:da(v,S,j,P,g),Eo(8,S);break;case 23:break;case 22:var se=S.stateNode;S.memoizedState!==null?se._visibility&2?da(v,S,j,P,g):Ao(v,S):(se._visibility|=2,da(v,S,j,P,g)),g&&Z&2048&&Bd(S.alternate,S);break;case 24:da(v,S,j,P,g),g&&Z&2048&&Hd(S.alternate,S);break;default:da(v,S,j,P,g)}s=s.sibling}}function Ao(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=t,u=s,g=u.flags;switch(u.tag){case 22:Ao(o,u),g&2048&&Bd(u.alternate,u);break;case 24:Ao(o,u),g&2048&&Hd(u.alternate,u);break;default:Ao(o,u)}s=s.sibling}}var No=8192;function ha(t,s,o){if(t.subtreeFlags&No)for(t=t.child;t!==null;)Hv(t,s,o),t=t.sibling}function Hv(t,s,o){switch(t.tag){case 26:ha(t,s,o),t.flags&No&&t.memoizedState!==null&&VA(o,jn,t.memoizedState,t.memoizedProps);break;case 5:ha(t,s,o);break;case 3:case 4:var u=jn;jn=bl(t.stateNode.containerInfo),ha(t,s,o),jn=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=No,No=16777216,ha(t,s,o),No=u):ha(t,s,o));break;default:ha(t,s,o)}}function Vv(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function jo(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var u=s[o];_t=u,Uv(u,t)}Vv(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Fv(t),t=t.sibling}function Fv(t){switch(t.tag){case 0:case 11:case 15:jo(t),t.flags&2048&&Pi(9,t,t.return);break;case 3:jo(t);break;case 12:jo(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,ol(t)):jo(t);break;default:jo(t)}}function ol(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var u=s[o];_t=u,Uv(u,t)}Vv(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:Pi(8,s,s.return),ol(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,ol(s));break;default:ol(s)}t=t.sibling}}function Uv(t,s){for(;_t!==null;){var o=_t;switch(o.tag){case 0:case 11:case 15:Pi(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:ho(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,_t=u;else e:for(o=t;_t!==null;){u=_t;var g=u.sibling,v=u.return;if(zv(u),u===o){_t=null;break e}if(g!==null){g.return=v,_t=g;break e}_t=v}}}var iA={getCacheForType:function(t){var s=jt(mt),o=s.data.get(t);return o===void 0&&(o=t(),s.data.set(t,o)),o},cacheSignal:function(){return jt(mt).controller.signal}},sA=typeof WeakMap=="function"?WeakMap:Map,Ye=0,tt=null,Be=null,Ve=0,Xe=0,sn=null,Li=!1,fa=!1,Vd=!1,gi=0,ct=0,Ii=0,Es=0,Fd=0,an=0,ma=0,To=null,$t=null,Ud=!1,rl=0,$v=0,ll=1/0,cl=null,Gi=null,bt=0,Bi=null,pa=null,vi=0,$d=0,Wd=null,Wv=null,ko=0,qd=null;function on(){return(Ye&2)!==0&&Ve!==0?Ve&-Ve:M.T!==null?Jd():lp()}function qv(){if(an===0)if((Ve&536870912)===0||Ue){var t=vr;vr<<=1,(vr&3932160)===0&&(vr=262144),an=t}else an=536870912;return t=tn.current,t!==null&&(t.flags|=32),an}function Wt(t,s,o){(t===tt&&(Xe===2||Xe===9)||t.cancelPendingCommit!==null)&&(ga(t,0),Hi(t,Ve,an,!1)),Za(t,o),((Ye&2)===0||t!==tt)&&(t===tt&&((Ye&2)===0&&(Es|=o),ct===4&&Hi(t,Ve,an,!1)),Vn(t))}function Yv(t,s,o){if((Ye&6)!==0)throw Error(a(327));var u=!o&&(s&127)===0&&(s&t.expiredLanes)===0||Qa(t,s),g=u?rA(t,s):Xd(t,s,!0),v=u;do{if(g===0){fa&&!u&&Hi(t,s,0,!1);break}else{if(o=t.current.alternate,v&&!aA(o)){g=Xd(t,s,!1),v=!1;continue}if(g===2){if(v=s,t.errorRecoveryDisabledLanes&v)var S=0;else S=t.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){s=S;e:{var j=t;g=To;var P=j.current.memoizedState.isDehydrated;if(P&&(ga(j,S).flags|=256),S=Xd(j,S,!1),S!==2){if(Vd&&!P){j.errorRecoveryDisabledLanes|=v,Es|=v,g=4;break e}v=$t,$t=g,v!==null&&($t===null?$t=v:$t.push.apply($t,v))}g=S}if(v=!1,g!==2)continue}}if(g===1){ga(t,0),Hi(t,s,0,!0);break}e:{switch(u=t,v=g,v){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:Hi(u,s,an,!Li);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(g=rl+300-Qt(),10<g)){if(Hi(u,s,an,!Li),br(u,0,!0)!==0)break e;vi=s,u.timeoutHandle=Ey(Xv.bind(null,u,o,$t,cl,Ud,s,an,Es,ma,Li,v,"Throttled",-0,0),g);break e}Xv(u,o,$t,cl,Ud,s,an,Es,ma,Li,v,null,-0,0)}}break}while(!0);Vn(t)}function Xv(t,s,o,u,g,v,S,j,P,Z,se,re,J,te){if(t.timeoutHandle=-1,re=s.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ni},Hv(s,v,re);var me=(v&62914560)===v?rl-Qt():(v&4194048)===v?$v-Qt():0;if(me=FA(re,me),me!==null){vi=v,t.cancelPendingCommit=me(iy.bind(null,t,s,v,o,u,g,S,j,P,se,re,null,J,te)),Hi(t,v,S,!Z);return}}iy(t,s,v,o,u,g,S,j,P)}function aA(t){for(var s=t;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var g=o[u],v=g.getSnapshot;g=g.value;try{if(!Jt(v(),g))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Hi(t,s,o,u){s&=~Fd,s&=~Es,t.suspendedLanes|=s,t.pingedLanes&=~s,u&&(t.warmLanes|=s),u=t.expirationTimes;for(var g=s;0<g;){var v=31-Kt(g),S=1<<v;u[v]=-1,g&=~S}o!==0&&ap(t,o,s)}function ul(){return(Ye&6)===0?(Ro(0),!1):!0}function Yd(){if(Be!==null){if(Xe===0)var t=Be.return;else t=Be,oi=gs=null,ud(t),oa=null,mo=0,t=Be;for(;t!==null;)Dv(t.alternate,t),t=t.return;Be=null}}function ga(t,s){var o=t.timeoutHandle;o!==-1&&(t.timeoutHandle=-1,EA(o)),o=t.cancelPendingCommit,o!==null&&(t.cancelPendingCommit=null,o()),vi=0,Yd(),tt=t,Be=o=si(t.current,null),Ve=s,Xe=0,sn=null,Li=!1,fa=Qa(t,s),Vd=!1,ma=an=Fd=Es=Ii=ct=0,$t=To=null,Ud=!1,(s&8)!==0&&(s|=s&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=s;0<u;){var g=31-Kt(u),v=1<<g;s|=t[g],u&=~v}return gi=s,kr(),o}function Qv(t,s){ze=null,M.H=So,s===aa||s===Gr?(s=hg(),Xe=3):s===Ku?(s=hg(),Xe=4):Xe=s===Dd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,sn=s,Be===null&&(ct=1,Jr(t,fn(s,t.current)))}function Zv(){var t=tn.current;return t===null?!0:(Ve&4194048)===Ve?vn===null:(Ve&62914560)===Ve||(Ve&536870912)!==0?t===vn:!1}function Kv(){var t=M.H;return M.H=So,t===null?So:t}function Jv(){var t=M.A;return M.A=iA,t}function dl(){ct=4,Li||(Ve&4194048)!==Ve&&tn.current!==null||(fa=!0),(Ii&134217727)===0&&(Es&134217727)===0||tt===null||Hi(tt,Ve,an,!1)}function Xd(t,s,o){var u=Ye;Ye|=2;var g=Kv(),v=Jv();(tt!==t||Ve!==s)&&(cl=null,ga(t,s)),s=!1;var S=ct;e:do try{if(Xe!==0&&Be!==null){var j=Be,P=sn;switch(Xe){case 8:Yd(),S=6;break e;case 3:case 2:case 9:case 6:tn.current===null&&(s=!0);var Z=Xe;if(Xe=0,sn=null,va(t,j,P,Z),o&&fa){S=0;break e}break;default:Z=Xe,Xe=0,sn=null,va(t,j,P,Z)}}oA(),S=ct;break}catch(se){Qv(t,se)}while(!0);return s&&t.shellSuspendCounter++,oi=gs=null,Ye=u,M.H=g,M.A=v,Be===null&&(tt=null,Ve=0,kr()),S}function oA(){for(;Be!==null;)ey(Be)}function rA(t,s){var o=Ye;Ye|=2;var u=Kv(),g=Jv();tt!==t||Ve!==s?(cl=null,ll=Qt()+500,ga(t,s)):fa=Qa(t,s);e:do try{if(Xe!==0&&Be!==null){s=Be;var v=sn;t:switch(Xe){case 1:Xe=0,sn=null,va(t,s,v,1);break;case 2:case 9:if(ug(v)){Xe=0,sn=null,ty(s);break}s=function(){Xe!==2&&Xe!==9||tt!==t||(Xe=7),Vn(t)},v.then(s,s);break e;case 3:Xe=7;break e;case 4:Xe=5;break e;case 7:ug(v)?(Xe=0,sn=null,ty(s)):(Xe=0,sn=null,va(t,s,v,7));break;case 5:var S=null;switch(Be.tag){case 26:S=Be.memoizedState;case 5:case 27:var j=Be;if(S?By(S):j.stateNode.complete){Xe=0,sn=null;var P=j.sibling;if(P!==null)Be=P;else{var Z=j.return;Z!==null?(Be=Z,hl(Z)):Be=null}break t}}Xe=0,sn=null,va(t,s,v,5);break;case 6:Xe=0,sn=null,va(t,s,v,6);break;case 8:Yd(),ct=6;break e;default:throw Error(a(462))}}lA();break}catch(se){Qv(t,se)}while(!0);return oi=gs=null,M.H=u,M.A=g,Ye=o,Be!==null?0:(tt=null,Ve=0,kr(),ct)}function lA(){for(;Be!==null&&!kE();)ey(Be)}function ey(t){var s=_v(t.alternate,t,gi);t.memoizedProps=t.pendingProps,s===null?hl(t):Be=s}function ty(t){var s=t,o=s.alternate;switch(s.tag){case 15:case 0:s=yv(o,s,s.pendingProps,s.type,void 0,Ve);break;case 11:s=yv(o,s,s.pendingProps,s.type.render,s.ref,Ve);break;case 5:ud(s);default:Dv(o,s),s=Be=Jp(s,gi),s=_v(o,s,gi)}t.memoizedProps=t.pendingProps,s===null?hl(t):Be=s}function va(t,s,o,u){oi=gs=null,ud(s),oa=null,mo=0;var g=s.return;try{if(QD(t,g,s,o,Ve)){ct=1,Jr(t,fn(o,t.current)),Be=null;return}}catch(v){if(g!==null)throw Be=g,v;ct=1,Jr(t,fn(o,t.current)),Be=null;return}s.flags&32768?(Ue||u===1?t=!0:fa||(Ve&536870912)!==0?t=!1:(Li=t=!0,(u===2||u===9||u===3||u===6)&&(u=tn.current,u!==null&&u.tag===13&&(u.flags|=16384))),ny(s,t)):hl(s)}function hl(t){var s=t;do{if((s.flags&32768)!==0){ny(s,Li);return}t=s.return;var o=JD(s.alternate,s,gi);if(o!==null){Be=o;return}if(s=s.sibling,s!==null){Be=s;return}Be=s=t}while(s!==null);ct===0&&(ct=5)}function ny(t,s){do{var o=eA(t.alternate,t);if(o!==null){o.flags&=32767,Be=o;return}if(o=t.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(t=t.sibling,t!==null)){Be=t;return}Be=t=o}while(t!==null);ct=6,Be=null}function iy(t,s,o,u,g,v,S,j,P){t.cancelPendingCommit=null;do fl();while(bt!==0);if((Ye&6)!==0)throw Error(a(327));if(s!==null){if(s===t.current)throw Error(a(177));if(v=s.lanes|s.childLanes,v|=Lu,HE(t,o,v,S,j,P),t===tt&&(Be=tt=null,Ve=0),pa=s,Bi=t,vi=o,$d=v,Wd=g,Wv=u,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,hA(pr,function(){return ly(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||u){u=M.T,M.T=null,g=K.p,K.p=2,S=Ye,Ye|=4;try{tA(t,s,o)}finally{Ye=S,K.p=g,M.T=u}}bt=1,sy(),ay(),oy()}}function sy(){if(bt===1){bt=0;var t=Bi,s=pa,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=M.T,M.T=null;var u=K.p;K.p=2;var g=Ye;Ye|=4;try{Iv(s,t);var v=rh,S=Up(t.containerInfo),j=v.focusedElem,P=v.selectionRange;if(S!==j&&j&&j.ownerDocument&&Fp(j.ownerDocument.documentElement,j)){if(P!==null&&Ru(j)){var Z=P.start,se=P.end;if(se===void 0&&(se=Z),"selectionStart"in j)j.selectionStart=Z,j.selectionEnd=Math.min(se,j.value.length);else{var re=j.ownerDocument||document,J=re&&re.defaultView||window;if(J.getSelection){var te=J.getSelection(),me=j.textContent.length,_e=Math.min(P.start,me),et=P.end===void 0?_e:Math.min(P.end,me);!te.extend&&_e>et&&(S=et,et=_e,_e=S);var F=Vp(j,_e),H=Vp(j,et);if(F&&H&&(te.rangeCount!==1||te.anchorNode!==F.node||te.anchorOffset!==F.offset||te.focusNode!==H.node||te.focusOffset!==H.offset)){var Q=re.createRange();Q.setStart(F.node,F.offset),te.removeAllRanges(),_e>et?(te.addRange(Q),te.extend(H.node,H.offset)):(Q.setEnd(H.node,H.offset),te.addRange(Q))}}}}for(re=[],te=j;te=te.parentNode;)te.nodeType===1&&re.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<re.length;j++){var oe=re[j];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}El=!!oh,rh=oh=null}finally{Ye=g,K.p=u,M.T=o}}t.current=s,bt=2}}function ay(){if(bt===2){bt=0;var t=Bi,s=pa,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=M.T,M.T=null;var u=K.p;K.p=2;var g=Ye;Ye|=4;try{Ov(t,s.alternate,s)}finally{Ye=g,K.p=u,M.T=o}}bt=3}}function oy(){if(bt===4||bt===3){bt=0,RE();var t=Bi,s=pa,o=vi,u=Wv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?bt=5:(bt=0,pa=Bi=null,ry(t,t.pendingLanes));var g=t.pendingLanes;if(g===0&&(Gi=null),fu(o),s=s.stateNode,Zt&&typeof Zt.onCommitFiberRoot=="function")try{Zt.onCommitFiberRoot(Xa,s,void 0,(s.current.flags&128)===128)}catch{}if(u!==null){s=M.T,g=K.p,K.p=2,M.T=null;try{for(var v=t.onRecoverableError,S=0;S<u.length;S++){var j=u[S];v(j.value,{componentStack:j.stack})}}finally{M.T=s,K.p=g}}(vi&3)!==0&&fl(),Vn(t),g=t.pendingLanes,(o&261930)!==0&&(g&42)!==0?t===qd?ko++:(ko=0,qd=t):ko=0,Ro(0)}}function ry(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,ho(s)))}function fl(){return sy(),ay(),oy(),ly()}function ly(){if(bt!==5)return!1;var t=Bi,s=$d;$d=0;var o=fu(vi),u=M.T,g=K.p;try{K.p=32>o?32:o,M.T=null,o=Wd,Wd=null;var v=Bi,S=vi;if(bt=0,pa=Bi=null,vi=0,(Ye&6)!==0)throw Error(a(331));var j=Ye;if(Ye|=4,Fv(v.current),Bv(v,v.current,S,o),Ye=j,Ro(0,!1),Zt&&typeof Zt.onPostCommitFiberRoot=="function")try{Zt.onPostCommitFiberRoot(Xa,v)}catch{}return!0}finally{K.p=g,M.T=u,ry(t,s)}}function cy(t,s,o){s=fn(o,s),s=Ed(t.stateNode,s,2),t=Oi(t,s,2),t!==null&&(Za(t,2),Vn(t))}function Qe(t,s,o){if(t.tag===3)cy(t,t,o);else for(;s!==null;){if(s.tag===3){cy(s,t,o);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Gi===null||!Gi.has(u))){t=fn(o,t),o=uv(2),u=Oi(s,o,2),u!==null&&(dv(o,u,s,t),Za(u,2),Vn(u));break}}s=s.return}}function Qd(t,s,o){var u=t.pingCache;if(u===null){u=t.pingCache=new sA;var g=new Set;u.set(s,g)}else g=u.get(s),g===void 0&&(g=new Set,u.set(s,g));g.has(o)||(Vd=!0,g.add(o),t=cA.bind(null,t,s,o),s.then(t,t))}function cA(t,s,o){var u=t.pingCache;u!==null&&u.delete(s),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,tt===t&&(Ve&o)===o&&(ct===4||ct===3&&(Ve&62914560)===Ve&&300>Qt()-rl?(Ye&2)===0&&ga(t,0):Fd|=o,ma===Ve&&(ma=0)),Vn(t)}function uy(t,s){s===0&&(s=sp()),t=fs(t,s),t!==null&&(Za(t,s),Vn(t))}function uA(t){var s=t.memoizedState,o=0;s!==null&&(o=s.retryLane),uy(t,o)}function dA(t,s){var o=0;switch(t.tag){case 31:case 13:var u=t.stateNode,g=t.memoizedState;g!==null&&(o=g.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(a(314))}u!==null&&u.delete(s),uy(t,o)}function hA(t,s){return cu(t,s)}var ml=null,ya=null,Zd=!1,pl=!1,Kd=!1,Vi=0;function Vn(t){t!==ya&&t.next===null&&(ya===null?ml=ya=t:ya=ya.next=t),pl=!0,Zd||(Zd=!0,mA())}function Ro(t,s){if(!Kd&&pl){Kd=!0;do for(var o=!1,u=ml;u!==null;){if(t!==0){var g=u.pendingLanes;if(g===0)var v=0;else{var S=u.suspendedLanes,j=u.pingedLanes;v=(1<<31-Kt(42|t)+1)-1,v&=g&~(S&~j),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(o=!0,my(u,v))}else v=Ve,v=br(u,u===tt?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(v&3)===0||Qa(u,v)||(o=!0,my(u,v));u=u.next}while(o);Kd=!1}}function fA(){dy()}function dy(){pl=Zd=!1;var t=0;Vi!==0&&_A()&&(t=Vi);for(var s=Qt(),o=null,u=ml;u!==null;){var g=u.next,v=hy(u,s);v===0?(u.next=null,o===null?ml=g:o.next=g,g===null&&(ya=o)):(o=u,(t!==0||(v&3)!==0)&&(pl=!0)),u=g}bt!==0&&bt!==5||Ro(t),Vi!==0&&(Vi=0)}function hy(t,s){for(var o=t.suspendedLanes,u=t.pingedLanes,g=t.expirationTimes,v=t.pendingLanes&-62914561;0<v;){var S=31-Kt(v),j=1<<S,P=g[S];P===-1?((j&o)===0||(j&u)!==0)&&(g[S]=BE(j,s)):P<=s&&(t.expiredLanes|=j),v&=~j}if(s=tt,o=Ve,o=br(t,t===s?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,o===0||t===s&&(Xe===2||Xe===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&uu(u),t.callbackNode=null,t.callbackPriority=0;if((o&3)===0||Qa(t,o)){if(s=o&-o,s===t.callbackPriority)return s;switch(u!==null&&uu(u),fu(o)){case 2:case 8:o=np;break;case 32:o=pr;break;case 268435456:o=ip;break;default:o=pr}return u=fy.bind(null,t),o=cu(o,u),t.callbackPriority=s,t.callbackNode=o,s}return u!==null&&u!==null&&uu(u),t.callbackPriority=2,t.callbackNode=null,2}function fy(t,s){if(bt!==0&&bt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var o=t.callbackNode;if(fl()&&t.callbackNode!==o)return null;var u=Ve;return u=br(t,t===tt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(Yv(t,u,s),hy(t,Qt()),t.callbackNode!=null&&t.callbackNode===o?fy.bind(null,t):null)}function my(t,s){if(fl())return null;Yv(t,s,!0)}function mA(){DA(function(){(Ye&6)!==0?cu(tp,fA):dy()})}function Jd(){if(Vi===0){var t=ia;t===0&&(t=gr,gr<<=1,(gr&261888)===0&&(gr=256)),Vi=t}return Vi}function py(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Cr(""+t)}function gy(t,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,t.id&&o.setAttribute("form",t.id),s.parentNode.insertBefore(o,s),t=new FormData(t),o.parentNode.removeChild(o),t}function pA(t,s,o,u,g){if(s==="submit"&&o&&o.stateNode===g){var v=py((g[Bt]||null).action),S=u.submitter;S&&(s=(s=S[Bt]||null)?py(s.formAction):S.getAttribute("formAction"),s!==null&&(v=s,S=null));var j=new Ar("action","action",null,u,g);t.push({event:j,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Vi!==0){var P=S?gy(g,S):new FormData(g);bd(o,{pending:!0,data:P,method:g.method,action:v},null,P)}}else typeof v=="function"&&(j.preventDefault(),P=S?gy(g,S):new FormData(g),bd(o,{pending:!0,data:P,method:g.method,action:v},v,P))},currentTarget:g}]})}}for(var eh=0;eh<Pu.length;eh++){var th=Pu[eh],gA=th.toLowerCase(),vA=th[0].toUpperCase()+th.slice(1);Nn(gA,"on"+vA)}Nn(qp,"onAnimationEnd"),Nn(Yp,"onAnimationIteration"),Nn(Xp,"onAnimationStart"),Nn("dblclick","onDoubleClick"),Nn("focusin","onFocus"),Nn("focusout","onBlur"),Nn(OD,"onTransitionRun"),Nn(zD,"onTransitionStart"),Nn(MD,"onTransitionCancel"),Nn(Qp,"onTransitionEnd"),Fs("onMouseEnter",["mouseout","mouseover"]),Fs("onMouseLeave",["mouseout","mouseover"]),Fs("onPointerEnter",["pointerout","pointerover"]),Fs("onPointerLeave",["pointerout","pointerover"]),cs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),cs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),cs("onBeforeInput",["compositionend","keypress","textInput","paste"]),cs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),cs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),cs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),yA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Oo));function vy(t,s){s=(s&4)!==0;for(var o=0;o<t.length;o++){var u=t[o],g=u.event;u=u.listeners;e:{var v=void 0;if(s)for(var S=u.length-1;0<=S;S--){var j=u[S],P=j.instance,Z=j.currentTarget;if(j=j.listener,P!==v&&g.isPropagationStopped())break e;v=j,g.currentTarget=Z;try{v(g)}catch(se){Tr(se)}g.currentTarget=null,v=P}else for(S=0;S<u.length;S++){if(j=u[S],P=j.instance,Z=j.currentTarget,j=j.listener,P!==v&&g.isPropagationStopped())break e;v=j,g.currentTarget=Z;try{v(g)}catch(se){Tr(se)}g.currentTarget=null,v=P}}}}function He(t,s){var o=s[mu];o===void 0&&(o=s[mu]=new Set);var u=t+"__bubble";o.has(u)||(yy(s,t,2,!1),o.add(u))}function nh(t,s,o){var u=0;s&&(u|=4),yy(o,t,u,s)}var gl="_reactListening"+Math.random().toString(36).slice(2);function ih(t){if(!t[gl]){t[gl]=!0,dp.forEach(function(o){o!=="selectionchange"&&(yA.has(o)||nh(o,!1,t),nh(o,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[gl]||(s[gl]=!0,nh("selectionchange",!1,s))}}function yy(t,s,o,u){switch(qy(s)){case 2:var g=WA;break;case 8:g=qA;break;default:g=yh}o=g.bind(null,s,o,t),g=void 0,!Cu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(g=!0),u?g!==void 0?t.addEventListener(s,o,{capture:!0,passive:g}):t.addEventListener(s,o,!0):g!==void 0?t.addEventListener(s,o,{passive:g}):t.addEventListener(s,o,!1)}function sh(t,s,o,u,g){var v=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var S=u.tag;if(S===3||S===4){var j=u.stateNode.containerInfo;if(j===g)break;if(S===4)for(S=u.return;S!==null;){var P=S.tag;if((P===3||P===4)&&S.stateNode.containerInfo===g)return;S=S.return}for(;j!==null;){if(S=Bs(j),S===null)return;if(P=S.tag,P===5||P===6||P===26||P===27){u=v=S;continue e}j=j.parentNode}}u=u.return}Cp(function(){var Z=v,se=wu(o),re=[];e:{var J=Zp.get(t);if(J!==void 0){var te=Ar,me=t;switch(t){case"keypress":if(Er(o)===0)break e;case"keydown":case"keyup":te=dD;break;case"focusin":me="focus",te=Au;break;case"focusout":me="blur",te=Au;break;case"beforeblur":case"afterblur":te=Au;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":te=Dp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=JE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=mD;break;case qp:case Yp:case Xp:te=nD;break;case Qp:te=gD;break;case"scroll":case"scrollend":te=ZE;break;case"wheel":te=yD;break;case"copy":case"cut":case"paste":te=sD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=Np;break;case"toggle":case"beforetoggle":te=xD}var _e=(s&4)!==0,et=!_e&&(t==="scroll"||t==="scrollend"),F=_e?J!==null?J+"Capture":null:J;_e=[];for(var H=Z,Q;H!==null;){var oe=H;if(Q=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||Q===null||F===null||(oe=eo(H,F),oe!=null&&_e.push(zo(H,oe,Q))),et)break;H=H.return}0<_e.length&&(J=new te(J,me,null,o,se),re.push({event:J,listeners:_e}))}}if((s&7)===0){e:{if(J=t==="mouseover"||t==="pointerover",te=t==="mouseout"||t==="pointerout",J&&o!==xu&&(me=o.relatedTarget||o.fromElement)&&(Bs(me)||me[Gs]))break e;if((te||J)&&(J=se.window===se?se:(J=se.ownerDocument)?J.defaultView||J.parentWindow:window,te?(me=o.relatedTarget||o.toElement,te=Z,me=me?Bs(me):null,me!==null&&(et=c(me),_e=me.tag,me!==et||_e!==5&&_e!==27&&_e!==6)&&(me=null)):(te=null,me=Z),te!==me)){if(_e=Dp,oe="onMouseLeave",F="onMouseEnter",H="mouse",(t==="pointerout"||t==="pointerover")&&(_e=Np,oe="onPointerLeave",F="onPointerEnter",H="pointer"),et=te==null?J:Ja(te),Q=me==null?J:Ja(me),J=new _e(oe,H+"leave",te,o,se),J.target=et,J.relatedTarget=Q,oe=null,Bs(se)===Z&&(_e=new _e(F,H+"enter",me,o,se),_e.target=Q,_e.relatedTarget=et,oe=_e),et=oe,te&&me)t:{for(_e=bA,F=te,H=me,Q=0,oe=F;oe;oe=_e(oe))Q++;oe=0;for(var xe=H;xe;xe=_e(xe))oe++;for(;0<Q-oe;)F=_e(F),Q--;for(;0<oe-Q;)H=_e(H),oe--;for(;Q--;){if(F===H||H!==null&&F===H.alternate){_e=F;break t}F=_e(F),H=_e(H)}_e=null}else _e=null;te!==null&&by(re,J,te,_e,!1),me!==null&&et!==null&&by(re,et,me,_e,!0)}}e:{if(J=Z?Ja(Z):window,te=J.nodeName&&J.nodeName.toLowerCase(),te==="select"||te==="input"&&J.type==="file")var We=Pp;else if(zp(J))if(Lp)We=TD;else{We=ND;var ve=AD}else te=J.nodeName,!te||te.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Z&&bu(Z.elementType)&&(We=Pp):We=jD;if(We&&(We=We(t,Z))){Mp(re,We,o,se);break e}ve&&ve(t,J,Z),t==="focusout"&&Z&&J.type==="number"&&Z.memoizedProps.value!=null&&yu(J,"number",J.value)}switch(ve=Z?Ja(Z):window,t){case"focusin":(zp(ve)||ve.contentEditable==="true")&&(Xs=ve,Ou=Z,lo=null);break;case"focusout":lo=Ou=Xs=null;break;case"mousedown":zu=!0;break;case"contextmenu":case"mouseup":case"dragend":zu=!1,$p(re,o,se);break;case"selectionchange":if(RD)break;case"keydown":case"keyup":$p(re,o,se)}var Me;if(ju)e:{switch(t){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Ys?Rp(t,o)&&(Fe="onCompositionEnd"):t==="keydown"&&o.keyCode===229&&(Fe="onCompositionStart");Fe&&(jp&&o.locale!=="ko"&&(Ys||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Ys&&(Me=_p()):(Di=se,_u="value"in Di?Di.value:Di.textContent,Ys=!0)),ve=vl(Z,Fe),0<ve.length&&(Fe=new Ap(Fe,t,null,o,se),re.push({event:Fe,listeners:ve}),Me?Fe.data=Me:(Me=Op(o),Me!==null&&(Fe.data=Me)))),(Me=SD?CD(t,o):_D(t,o))&&(Fe=vl(Z,"onBeforeInput"),0<Fe.length&&(ve=new Ap("onBeforeInput","beforeinput",null,o,se),re.push({event:ve,listeners:Fe}),ve.data=Me)),pA(re,t,Z,o,se)}vy(re,s)})}function zo(t,s,o){return{instance:t,listener:s,currentTarget:o}}function vl(t,s){for(var o=s+"Capture",u=[];t!==null;){var g=t,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=eo(t,o),g!=null&&u.unshift(zo(t,g,v)),g=eo(t,s),g!=null&&u.push(zo(t,g,v))),t.tag===3)return u;t=t.return}return[]}function bA(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function by(t,s,o,u,g){for(var v=s._reactName,S=[];o!==null&&o!==u;){var j=o,P=j.alternate,Z=j.stateNode;if(j=j.tag,P!==null&&P===u)break;j!==5&&j!==26&&j!==27||Z===null||(P=Z,g?(Z=eo(o,v),Z!=null&&S.unshift(zo(o,Z,P))):g||(Z=eo(o,v),Z!=null&&S.push(zo(o,Z,P)))),o=o.return}S.length!==0&&t.push({event:s,listeners:S})}var xA=/\r\n?/g,wA=/\u0000|\uFFFD/g;function xy(t){return(typeof t=="string"?t:""+t).replace(xA,`
9
- `).replace(wA,"")}function wy(t,s){return s=xy(s),xy(t)===s}function Je(t,s,o,u,g,v){switch(o){case"children":typeof u=="string"?s==="body"||s==="textarea"&&u===""||$s(t,u):(typeof u=="number"||typeof u=="bigint")&&s!=="body"&&$s(t,""+u);break;case"className":wr(t,"class",u);break;case"tabIndex":wr(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":wr(t,o,u);break;case"style":wp(t,u,v);break;case"data":if(s!=="object"){wr(t,"data",u);break}case"src":case"href":if(u===""&&(s!=="a"||o!=="href")){t.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(o);break}u=Cr(""+u),t.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(o==="formAction"?(s!=="input"&&Je(t,s,"name",g.name,g,null),Je(t,s,"formEncType",g.formEncType,g,null),Je(t,s,"formMethod",g.formMethod,g,null),Je(t,s,"formTarget",g.formTarget,g,null)):(Je(t,s,"encType",g.encType,g,null),Je(t,s,"method",g.method,g,null),Je(t,s,"target",g.target,g,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(o);break}u=Cr(""+u),t.setAttribute(o,u);break;case"onClick":u!=null&&(t.onclick=ni);break;case"onScroll":u!=null&&He("scroll",t);break;case"onScrollEnd":u!=null&&He("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(o=u.__html,o!=null){if(g.children!=null)throw Error(a(60));t.innerHTML=o}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}o=Cr(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,""+u):t.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,""):t.removeAttribute(o);break;case"capture":case"download":u===!0?t.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,u):t.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(o,u):t.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(o):t.setAttribute(o,u);break;case"popover":He("beforetoggle",t),He("toggle",t),xr(t,"popover",u);break;case"xlinkActuate":ti(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ti(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ti(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ti(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ti(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ti(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ti(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ti(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ti(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":xr(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=XE.get(o)||o,xr(t,o,u))}}function ah(t,s,o,u,g,v){switch(o){case"style":wp(t,u,v);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(o=u.__html,o!=null){if(g.children!=null)throw Error(a(60));t.innerHTML=o}}break;case"children":typeof u=="string"?$s(t,u):(typeof u=="number"||typeof u=="bigint")&&$s(t,""+u);break;case"onScroll":u!=null&&He("scroll",t);break;case"onScrollEnd":u!=null&&He("scrollend",t);break;case"onClick":u!=null&&(t.onclick=ni);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!hp.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(g=o.endsWith("Capture"),s=o.slice(2,g?o.length-7:void 0),v=t[Bt]||null,v=v!=null?v[o]:null,typeof v=="function"&&t.removeEventListener(s,v,g),typeof u=="function")){typeof v!="function"&&v!==null&&(o in t?t[o]=null:t.hasAttribute(o)&&t.removeAttribute(o)),t.addEventListener(s,u,g);break e}o in t?t[o]=u:u===!0?t.setAttribute(o,""):xr(t,o,u)}}}function kt(t,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":He("error",t),He("load",t);var u=!1,g=!1,v;for(v in o)if(o.hasOwnProperty(v)){var S=o[v];if(S!=null)switch(v){case"src":u=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Je(t,s,v,S,o,null)}}g&&Je(t,s,"srcSet",o.srcSet,o,null),u&&Je(t,s,"src",o.src,o,null);return;case"input":He("invalid",t);var j=v=S=g=null,P=null,Z=null;for(u in o)if(o.hasOwnProperty(u)){var se=o[u];if(se!=null)switch(u){case"name":g=se;break;case"type":S=se;break;case"checked":P=se;break;case"defaultChecked":Z=se;break;case"value":v=se;break;case"defaultValue":j=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,s));break;default:Je(t,s,u,se,o,null)}}vp(t,v,j,P,Z,S,g,!1);return;case"select":He("invalid",t),u=S=v=null;for(g in o)if(o.hasOwnProperty(g)&&(j=o[g],j!=null))switch(g){case"value":v=j;break;case"defaultValue":S=j;break;case"multiple":u=j;default:Je(t,s,g,j,o,null)}s=v,o=S,t.multiple=!!u,s!=null?Us(t,!!u,s,!1):o!=null&&Us(t,!!u,o,!0);return;case"textarea":He("invalid",t),v=g=u=null;for(S in o)if(o.hasOwnProperty(S)&&(j=o[S],j!=null))switch(S){case"value":u=j;break;case"defaultValue":g=j;break;case"children":v=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(a(91));break;default:Je(t,s,S,j,o,null)}bp(t,u,g,v);return;case"option":for(P in o)o.hasOwnProperty(P)&&(u=o[P],u!=null)&&(P==="selected"?t.selected=u&&typeof u!="function"&&typeof u!="symbol":Je(t,s,P,u,o,null));return;case"dialog":He("beforetoggle",t),He("toggle",t),He("cancel",t),He("close",t);break;case"iframe":case"object":He("load",t);break;case"video":case"audio":for(u=0;u<Oo.length;u++)He(Oo[u],t);break;case"image":He("error",t),He("load",t);break;case"details":He("toggle",t);break;case"embed":case"source":case"link":He("error",t),He("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Z in o)if(o.hasOwnProperty(Z)&&(u=o[Z],u!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Je(t,s,Z,u,o,null)}return;default:if(bu(s)){for(se in o)o.hasOwnProperty(se)&&(u=o[se],u!==void 0&&ah(t,s,se,u,o,void 0));return}}for(j in o)o.hasOwnProperty(j)&&(u=o[j],u!=null&&Je(t,s,j,u,o,null))}function SA(t,s,o,u){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,S=null,j=null,P=null,Z=null,se=null;for(te in o){var re=o[te];if(o.hasOwnProperty(te)&&re!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":P=re;default:u.hasOwnProperty(te)||Je(t,s,te,null,u,re)}}for(var J in u){var te=u[J];if(re=o[J],u.hasOwnProperty(J)&&(te!=null||re!=null))switch(J){case"type":v=te;break;case"name":g=te;break;case"checked":Z=te;break;case"defaultChecked":se=te;break;case"value":S=te;break;case"defaultValue":j=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(a(137,s));break;default:te!==re&&Je(t,s,J,te,u,re)}}vu(t,S,j,P,Z,se,v,g);return;case"select":te=S=j=J=null;for(v in o)if(P=o[v],o.hasOwnProperty(v)&&P!=null)switch(v){case"value":break;case"multiple":te=P;default:u.hasOwnProperty(v)||Je(t,s,v,null,u,P)}for(g in u)if(v=u[g],P=o[g],u.hasOwnProperty(g)&&(v!=null||P!=null))switch(g){case"value":J=v;break;case"defaultValue":j=v;break;case"multiple":S=v;default:v!==P&&Je(t,s,g,v,u,P)}s=j,o=S,u=te,J!=null?Us(t,!!o,J,!1):!!u!=!!o&&(s!=null?Us(t,!!o,s,!0):Us(t,!!o,o?[]:"",!1));return;case"textarea":te=J=null;for(j in o)if(g=o[j],o.hasOwnProperty(j)&&g!=null&&!u.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:Je(t,s,j,null,u,g)}for(S in u)if(g=u[S],v=o[S],u.hasOwnProperty(S)&&(g!=null||v!=null))switch(S){case"value":J=g;break;case"defaultValue":te=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(a(91));break;default:g!==v&&Je(t,s,S,g,u,v)}yp(t,J,te);return;case"option":for(var me in o)J=o[me],o.hasOwnProperty(me)&&J!=null&&!u.hasOwnProperty(me)&&(me==="selected"?t.selected=!1:Je(t,s,me,null,u,J));for(P in u)J=u[P],te=o[P],u.hasOwnProperty(P)&&J!==te&&(J!=null||te!=null)&&(P==="selected"?t.selected=J&&typeof J!="function"&&typeof J!="symbol":Je(t,s,P,J,u,te));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var _e in o)J=o[_e],o.hasOwnProperty(_e)&&J!=null&&!u.hasOwnProperty(_e)&&Je(t,s,_e,null,u,J);for(Z in u)if(J=u[Z],te=o[Z],u.hasOwnProperty(Z)&&J!==te&&(J!=null||te!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(a(137,s));break;default:Je(t,s,Z,J,u,te)}return;default:if(bu(s)){for(var et in o)J=o[et],o.hasOwnProperty(et)&&J!==void 0&&!u.hasOwnProperty(et)&&ah(t,s,et,void 0,u,J);for(se in u)J=u[se],te=o[se],!u.hasOwnProperty(se)||J===te||J===void 0&&te===void 0||ah(t,s,se,J,u,te);return}}for(var F in o)J=o[F],o.hasOwnProperty(F)&&J!=null&&!u.hasOwnProperty(F)&&Je(t,s,F,null,u,J);for(re in u)J=u[re],te=o[re],!u.hasOwnProperty(re)||J===te||J==null&&te==null||Je(t,s,re,J,u,te)}function Sy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function CA(){if(typeof performance.getEntriesByType=="function"){for(var t=0,s=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var g=o[u],v=g.transferSize,S=g.initiatorType,j=g.duration;if(v&&j&&Sy(S)){for(S=0,j=g.responseEnd,u+=1;u<o.length;u++){var P=o[u],Z=P.startTime;if(Z>j)break;var se=P.transferSize,re=P.initiatorType;se&&Sy(re)&&(P=P.responseEnd,S+=se*(P<j?1:(j-Z)/(P-Z)))}if(--u,s+=8*(v+S)/(g.duration/1e3),t++,10<t)break}}if(0<t)return s/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var oh=null,rh=null;function yl(t){return t.nodeType===9?t:t.ownerDocument}function Cy(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function _y(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function lh(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var ch=null;function _A(){var t=window.event;return t&&t.type==="popstate"?t===ch?!1:(ch=t,!0):(ch=null,!1)}var Ey=typeof setTimeout=="function"?setTimeout:void 0,EA=typeof clearTimeout=="function"?clearTimeout:void 0,Dy=typeof Promise=="function"?Promise:void 0,DA=typeof queueMicrotask=="function"?queueMicrotask:typeof Dy<"u"?function(t){return Dy.resolve(null).then(t).catch(AA)}:Ey;function AA(t){setTimeout(function(){throw t})}function Fi(t){return t==="head"}function Ay(t,s){var o=s,u=0;do{var g=o.nextSibling;if(t.removeChild(o),g&&g.nodeType===8)if(o=g.data,o==="/$"||o==="/&"){if(u===0){t.removeChild(g),Sa(s);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")Mo(t.ownerDocument.documentElement);else if(o==="head"){o=t.ownerDocument.head,Mo(o);for(var v=o.firstChild;v;){var S=v.nextSibling,j=v.nodeName;v[Ka]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&v.rel.toLowerCase()==="stylesheet"||o.removeChild(v),v=S}}else o==="body"&&Mo(t.ownerDocument.body);o=g}while(o);Sa(s)}function Ny(t,s){var o=t;t=0;do{var u=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(t===0)break;t--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||t++;o=u}while(o)}function uh(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":uh(o),pu(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}t.removeChild(o)}}function NA(t,s,o,u){for(;t.nodeType===1;){var g=o;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Ka])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(v=t.getAttribute("rel"),v==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(v!==g.rel||t.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||t.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||t.getAttribute("title")!==(g.title==null?null:g.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(v=t.getAttribute("src"),(v!==(g.src==null?null:g.src)||t.getAttribute("type")!==(g.type==null?null:g.type)||t.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&t.getAttribute("name")===v)return t}else return t;if(t=yn(t.nextSibling),t===null)break}return null}function jA(t,s,o){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!o||(t=yn(t.nextSibling),t===null))return null;return t}function jy(t,s){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=yn(t.nextSibling),t===null))return null;return t}function dh(t){return t.data==="$?"||t.data==="$~"}function hh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function TA(t,s){var o=t.ownerDocument;if(t.data==="$~")t._reactRetry=s;else if(t.data!=="$?"||o.readyState!=="loading")s();else{var u=function(){s(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function yn(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return t}var fh=null;function Ty(t){t=t.nextSibling;for(var s=0;t;){if(t.nodeType===8){var o=t.data;if(o==="/$"||o==="/&"){if(s===0)return yn(t.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}t=t.nextSibling}return null}function ky(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var o=t.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return t;s--}else o!=="/$"&&o!=="/&"||s++}t=t.previousSibling}return null}function Ry(t,s,o){switch(s=yl(o),t){case"html":if(t=s.documentElement,!t)throw Error(a(452));return t;case"head":if(t=s.head,!t)throw Error(a(453));return t;case"body":if(t=s.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function Mo(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);pu(t)}var bn=new Map,Oy=new Set;function bl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var yi=K.d;K.d={f:kA,r:RA,D:OA,C:zA,L:MA,m:PA,X:IA,S:LA,M:GA};function kA(){var t=yi.f(),s=ul();return t||s}function RA(t){var s=Hs(t);s!==null&&s.tag===5&&s.type==="form"?Qg(s):yi.r(t)}var ba=typeof document>"u"?null:document;function zy(t,s,o){var u=ba;if(u&&typeof s=="string"&&s){var g=dn(s);g='link[rel="'+t+'"][href="'+g+'"]',typeof o=="string"&&(g+='[crossorigin="'+o+'"]'),Oy.has(g)||(Oy.add(g),t={rel:t,crossOrigin:o,href:s},u.querySelector(g)===null&&(s=u.createElement("link"),kt(s,"link",t),Ct(s),u.head.appendChild(s)))}}function OA(t){yi.D(t),zy("dns-prefetch",t,null)}function zA(t,s){yi.C(t,s),zy("preconnect",t,s)}function MA(t,s,o){yi.L(t,s,o);var u=ba;if(u&&t&&s){var g='link[rel="preload"][as="'+dn(s)+'"]';s==="image"&&o&&o.imageSrcSet?(g+='[imagesrcset="'+dn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(g+='[imagesizes="'+dn(o.imageSizes)+'"]')):g+='[href="'+dn(t)+'"]';var v=g;switch(s){case"style":v=xa(t);break;case"script":v=wa(t)}bn.has(v)||(t=b({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:t,as:s},o),bn.set(v,t),u.querySelector(g)!==null||s==="style"&&u.querySelector(Po(v))||s==="script"&&u.querySelector(Lo(v))||(s=u.createElement("link"),kt(s,"link",t),Ct(s),u.head.appendChild(s)))}}function PA(t,s){yi.m(t,s);var o=ba;if(o&&t){var u=s&&typeof s.as=="string"?s.as:"script",g='link[rel="modulepreload"][as="'+dn(u)+'"][href="'+dn(t)+'"]',v=g;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=wa(t)}if(!bn.has(v)&&(t=b({rel:"modulepreload",href:t},s),bn.set(v,t),o.querySelector(g)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Lo(v)))return}u=o.createElement("link"),kt(u,"link",t),Ct(u),o.head.appendChild(u)}}}function LA(t,s,o){yi.S(t,s,o);var u=ba;if(u&&t){var g=Vs(u).hoistableStyles,v=xa(t);s=s||"default";var S=g.get(v);if(!S){var j={loading:0,preload:null};if(S=u.querySelector(Po(v)))j.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":s},o),(o=bn.get(v))&&mh(t,o);var P=S=u.createElement("link");Ct(P),kt(P,"link",t),P._p=new Promise(function(Z,se){P.onload=Z,P.onerror=se}),P.addEventListener("load",function(){j.loading|=1}),P.addEventListener("error",function(){j.loading|=2}),j.loading|=4,xl(S,s,u)}S={type:"stylesheet",instance:S,count:1,state:j},g.set(v,S)}}}function IA(t,s){yi.X(t,s);var o=ba;if(o&&t){var u=Vs(o).hoistableScripts,g=wa(t),v=u.get(g);v||(v=o.querySelector(Lo(g)),v||(t=b({src:t,async:!0},s),(s=bn.get(g))&&ph(t,s),v=o.createElement("script"),Ct(v),kt(v,"link",t),o.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(g,v))}}function GA(t,s){yi.M(t,s);var o=ba;if(o&&t){var u=Vs(o).hoistableScripts,g=wa(t),v=u.get(g);v||(v=o.querySelector(Lo(g)),v||(t=b({src:t,async:!0,type:"module"},s),(s=bn.get(g))&&ph(t,s),v=o.createElement("script"),Ct(v),kt(v,"link",t),o.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(g,v))}}function My(t,s,o,u){var g=(g=le.current)?bl(g):null;if(!g)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=xa(o.href),o=Vs(g).hoistableStyles,u=o.get(s),u||(u={type:"style",instance:null,count:0,state:null},o.set(s,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=xa(o.href);var v=Vs(g).hoistableStyles,S=v.get(t);if(S||(g=g.ownerDocument||g,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(t,S),(v=g.querySelector(Po(t)))&&!v._p&&(S.instance=v,S.state.loading=5),bn.has(t)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},bn.set(t,o),v||BA(g,t,o,S.state))),s&&u===null)throw Error(a(528,""));return S}if(s&&u!==null)throw Error(a(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=wa(o),o=Vs(g).hoistableScripts,u=o.get(s),u||(u={type:"script",instance:null,count:0,state:null},o.set(s,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function xa(t){return'href="'+dn(t)+'"'}function Po(t){return'link[rel="stylesheet"]['+t+"]"}function Py(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function BA(t,s,o,u){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?u.loading=1:(s=t.createElement("link"),u.preload=s,s.addEventListener("load",function(){return u.loading|=1}),s.addEventListener("error",function(){return u.loading|=2}),kt(s,"link",o),Ct(s),t.head.appendChild(s))}function wa(t){return'[src="'+dn(t)+'"]'}function Lo(t){return"script[async]"+t}function Ly(t,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var u=t.querySelector('style[data-href~="'+dn(o.href)+'"]');if(u)return s.instance=u,Ct(u),u;var g=b({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Ct(u),kt(u,"style",g),xl(u,o.precedence,t),s.instance=u;case"stylesheet":g=xa(o.href);var v=t.querySelector(Po(g));if(v)return s.state.loading|=4,s.instance=v,Ct(v),v;u=Py(o),(g=bn.get(g))&&mh(u,g),v=(t.ownerDocument||t).createElement("link"),Ct(v);var S=v;return S._p=new Promise(function(j,P){S.onload=j,S.onerror=P}),kt(v,"link",u),s.state.loading|=4,xl(v,o.precedence,t),s.instance=v;case"script":return v=wa(o.src),(g=t.querySelector(Lo(v)))?(s.instance=g,Ct(g),g):(u=o,(g=bn.get(v))&&(u=b({},o),ph(u,g)),t=t.ownerDocument||t,g=t.createElement("script"),Ct(g),kt(g,"link",u),t.head.appendChild(g),s.instance=g);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(u=s.instance,s.state.loading|=4,xl(u,o.precedence,t));return s.instance}function xl(t,s,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=u.length?u[u.length-1]:null,v=g,S=0;S<u.length;S++){var j=u[S];if(j.dataset.precedence===s)v=j;else if(v!==g)break}v?v.parentNode.insertBefore(t,v.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(t,s.firstChild))}function mh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function ph(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var wl=null;function Iy(t,s,o){if(wl===null){var u=new Map,g=wl=new Map;g.set(o,u)}else g=wl,u=g.get(o),u||(u=new Map,g.set(o,u));if(u.has(t))return u;for(u.set(t,null),o=o.getElementsByTagName(t),g=0;g<o.length;g++){var v=o[g];if(!(v[Ka]||v[At]||t==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(s)||"";S=t+S;var j=u.get(S);j?j.push(v):u.set(S,[v])}}return u}function Gy(t,s,o){t=t.ownerDocument||t,t.head.insertBefore(o,s==="title"?t.querySelector("head > title"):null)}function HA(t,s,o){if(o===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(t=s.disabled,typeof s.precedence=="string"&&t==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function By(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function VA(t,s,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var g=xa(u.href),v=s.querySelector(Po(g));if(v){s=v._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(t.count++,t=Sl.bind(t),s.then(t,t)),o.state.loading|=4,o.instance=v,Ct(v);return}v=s.ownerDocument||s,u=Py(u),(g=bn.get(g))&&mh(u,g),v=v.createElement("link"),Ct(v);var S=v;S._p=new Promise(function(j,P){S.onload=j,S.onerror=P}),kt(v,"link",u),o.instance=v}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=Sl.bind(t),s.addEventListener("load",o),s.addEventListener("error",o))}}var gh=0;function FA(t,s){return t.stylesheets&&t.count===0&&_l(t,t.stylesheets),0<t.count||0<t.imgCount?function(o){var u=setTimeout(function(){if(t.stylesheets&&_l(t,t.stylesheets),t.unsuspend){var v=t.unsuspend;t.unsuspend=null,v()}},6e4+s);0<t.imgBytes&&gh===0&&(gh=62500*CA());var g=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&_l(t,t.stylesheets),t.unsuspend)){var v=t.unsuspend;t.unsuspend=null,v()}},(t.imgBytes>gh?50:800)+s);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(g)}}:null}function Sl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_l(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Cl=null;function _l(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Cl=new Map,s.forEach(UA,t),Cl=null,Sl.call(t))}function UA(t,s){if(!(s.state.loading&4)){var o=Cl.get(t);if(o)var u=o.get(null);else{o=new Map,Cl.set(t,o);for(var g=t.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var S=g[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(o.set(S.dataset.precedence,S),u=S)}u&&o.set(null,u)}g=s.instance,S=g.getAttribute("data-precedence"),v=o.get(S)||u,v===u&&o.set(null,g),o.set(S,g),this.count++,u=Sl.bind(this),g.addEventListener("load",u),g.addEventListener("error",u),v?v.parentNode.insertBefore(g,v.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(g,t.firstChild)),s.state.loading|=4}}var Io={$$typeof:k,Provider:null,Consumer:null,_currentValue:q,_currentValue2:q,_threadCount:0};function $A(t,s,o,u,g,v,S,j,P){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=du(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=du(0),this.hiddenUpdates=du(null),this.identifierPrefix=u,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=P,this.incompleteTransitions=new Map}function Hy(t,s,o,u,g,v,S,j,P,Z,se,re){return t=new $A(t,s,o,S,P,Z,se,re,j),s=1,v===!0&&(s|=24),v=en(3,null,null,s),t.current=v,v.stateNode=t,s=Xu(),s.refCount++,t.pooledCache=s,s.refCount++,v.memoizedState={element:u,isDehydrated:o,cache:s},Ju(v),t}function Vy(t){return t?(t=Ks,t):Ks}function Fy(t,s,o,u,g,v){g=Vy(g),u.context===null?u.context=g:u.pendingContext=g,u=Ri(s),u.payload={element:o},v=v===void 0?null:v,v!==null&&(u.callback=v),o=Oi(t,u,s),o!==null&&(Wt(o,t,s),go(o,t,s))}function Uy(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var o=t.retryLane;t.retryLane=o!==0&&o<s?o:s}}function vh(t,s){Uy(t,s),(t=t.alternate)&&Uy(t,s)}function $y(t){if(t.tag===13||t.tag===31){var s=fs(t,67108864);s!==null&&Wt(s,t,67108864),vh(t,67108864)}}function Wy(t){if(t.tag===13||t.tag===31){var s=on();s=hu(s);var o=fs(t,s);o!==null&&Wt(o,t,s),vh(t,s)}}var El=!0;function WA(t,s,o,u){var g=M.T;M.T=null;var v=K.p;try{K.p=2,yh(t,s,o,u)}finally{K.p=v,M.T=g}}function qA(t,s,o,u){var g=M.T;M.T=null;var v=K.p;try{K.p=8,yh(t,s,o,u)}finally{K.p=v,M.T=g}}function yh(t,s,o,u){if(El){var g=bh(u);if(g===null)sh(t,s,u,Dl,o),Yy(t,u);else if(XA(g,t,s,o,u))u.stopPropagation();else if(Yy(t,u),s&4&&-1<YA.indexOf(t)){for(;g!==null;){var v=Hs(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=ls(v.pendingLanes);if(S!==0){var j=v;for(j.pendingLanes|=2,j.entangledLanes|=2;S;){var P=1<<31-Kt(S);j.entanglements[1]|=P,S&=~P}Vn(v),(Ye&6)===0&&(ll=Qt()+500,Ro(0))}}break;case 31:case 13:j=fs(v,2),j!==null&&Wt(j,v,2),ul(),vh(v,2)}if(v=bh(u),v===null&&sh(t,s,u,Dl,o),v===g)break;g=v}g!==null&&u.stopPropagation()}else sh(t,s,u,null,o)}}function bh(t){return t=wu(t),xh(t)}var Dl=null;function xh(t){if(Dl=null,t=Bs(t),t!==null){var s=c(t);if(s===null)t=null;else{var o=s.tag;if(o===13){if(t=d(s),t!==null)return t;t=null}else if(o===31){if(t=h(s),t!==null)return t;t=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return Dl=t,null}function qy(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(OE()){case tp:return 2;case np:return 8;case pr:case zE:return 32;case ip:return 268435456;default:return 32}default:return 32}}var wh=!1,Ui=null,$i=null,Wi=null,Go=new Map,Bo=new Map,qi=[],YA="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Yy(t,s){switch(t){case"focusin":case"focusout":Ui=null;break;case"dragenter":case"dragleave":$i=null;break;case"mouseover":case"mouseout":Wi=null;break;case"pointerover":case"pointerout":Go.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bo.delete(s.pointerId)}}function Ho(t,s,o,u,g,v){return t===null||t.nativeEvent!==v?(t={blockedOn:s,domEventName:o,eventSystemFlags:u,nativeEvent:v,targetContainers:[g]},s!==null&&(s=Hs(s),s!==null&&$y(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,g!==null&&s.indexOf(g)===-1&&s.push(g),t)}function XA(t,s,o,u,g){switch(s){case"focusin":return Ui=Ho(Ui,t,s,o,u,g),!0;case"dragenter":return $i=Ho($i,t,s,o,u,g),!0;case"mouseover":return Wi=Ho(Wi,t,s,o,u,g),!0;case"pointerover":var v=g.pointerId;return Go.set(v,Ho(Go.get(v)||null,t,s,o,u,g)),!0;case"gotpointercapture":return v=g.pointerId,Bo.set(v,Ho(Bo.get(v)||null,t,s,o,u,g)),!0}return!1}function Xy(t){var s=Bs(t.target);if(s!==null){var o=c(s);if(o!==null){if(s=o.tag,s===13){if(s=d(o),s!==null){t.blockedOn=s,cp(t.priority,function(){Wy(o)});return}}else if(s===31){if(s=h(o),s!==null){t.blockedOn=s,cp(t.priority,function(){Wy(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){t.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Al(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var o=bh(t.nativeEvent);if(o===null){o=t.nativeEvent;var u=new o.constructor(o.type,o);xu=u,o.target.dispatchEvent(u),xu=null}else return s=Hs(o),s!==null&&$y(s),t.blockedOn=o,!1;s.shift()}return!0}function Qy(t,s,o){Al(t)&&o.delete(s)}function QA(){wh=!1,Ui!==null&&Al(Ui)&&(Ui=null),$i!==null&&Al($i)&&($i=null),Wi!==null&&Al(Wi)&&(Wi=null),Go.forEach(Qy),Bo.forEach(Qy)}function Nl(t,s){t.blockedOn===s&&(t.blockedOn=null,wh||(wh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,QA)))}var jl=null;function Zy(t){jl!==t&&(jl=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){jl===t&&(jl=null);for(var s=0;s<t.length;s+=3){var o=t[s],u=t[s+1],g=t[s+2];if(typeof u!="function"){if(xh(u||o)===null)continue;break}var v=Hs(o);v!==null&&(t.splice(s,3),s-=3,bd(v,{pending:!0,data:g,method:o.method,action:u},u,g))}}))}function Sa(t){function s(P){return Nl(P,t)}Ui!==null&&Nl(Ui,t),$i!==null&&Nl($i,t),Wi!==null&&Nl(Wi,t),Go.forEach(s),Bo.forEach(s);for(var o=0;o<qi.length;o++){var u=qi[o];u.blockedOn===t&&(u.blockedOn=null)}for(;0<qi.length&&(o=qi[0],o.blockedOn===null);)Xy(o),o.blockedOn===null&&qi.shift();if(o=(t.ownerDocument||t).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var g=o[u],v=o[u+1],S=g[Bt]||null;if(typeof v=="function")S||Zy(o);else if(S){var j=null;if(v&&v.hasAttribute("formAction")){if(g=v,S=v[Bt]||null)j=S.formAction;else if(xh(g)!==null)continue}else j=S.action;typeof j=="function"?o[u+1]=j:(o.splice(u,3),u-=3),Zy(o)}}}function Ky(){function t(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return g=S})},focusReset:"manual",scroll:"manual"})}function s(){g!==null&&(g(),g=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,g=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),g!==null&&(g(),g=null)}}}function Sh(t){this._internalRoot=t}Tl.prototype.render=Sh.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(a(409));var o=s.current,u=on();Fy(o,u,t,s,null,null)},Tl.prototype.unmount=Sh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Fy(t.current,2,null,t,null,null),ul(),s[Gs]=null}};function Tl(t){this._internalRoot=t}Tl.prototype.unstable_scheduleHydration=function(t){if(t){var s=lp();t={blockedOn:null,target:t,priority:s};for(var o=0;o<qi.length&&s!==0&&s<qi[o].priority;o++);qi.splice(o,0,t),o===0&&Xy(t)}};var Jy=e.version;if(Jy!=="19.2.4")throw Error(a(527,Jy,"19.2.4"));K.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=p(s),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var ZA={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kl.isDisabled&&kl.supportsFiber)try{Xa=kl.inject(ZA),Zt=kl}catch{}}return Fo.createRoot=function(t,s){if(!r(t))throw Error(a(299));var o=!1,u="",g=ov,v=rv,S=lv;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(g=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(S=s.onRecoverableError)),s=Hy(t,1,!1,null,null,o,u,null,g,v,S,Ky),t[Gs]=s.current,ih(t),new Sh(s)},Fo.hydrateRoot=function(t,s,o){if(!r(t))throw Error(a(299));var u=!1,g="",v=ov,S=rv,j=lv,P=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onUncaughtError!==void 0&&(v=o.onUncaughtError),o.onCaughtError!==void 0&&(S=o.onCaughtError),o.onRecoverableError!==void 0&&(j=o.onRecoverableError),o.formState!==void 0&&(P=o.formState)),s=Hy(t,1,!0,s,o??null,u,g,P,v,S,j,Ky),s.context=Vy(null),o=s.current,u=on(),u=hu(u),g=Ri(u),g.callback=null,Oi(o,g,u),o=u,s.current.lanes=o,Za(s,o),Vn(s),t[Gs]=s.current,ih(t),new Tl(s)},Fo.version="19.2.4",Fo}var cb;function rN(){if(cb)return _h.exports;cb=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),_h.exports=oN(),_h.exports}var lN=rN(),m=If();const ue=sw(m),Gf=JA({__proto__:null,default:ue},[m]);function ub(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function es(...n){return e=>{let i=!1;const a=n.map(r=>{const c=ub(r,e);return!i&&typeof c=="function"&&(i=!0),c});if(i)return()=>{for(let r=0;r<a.length;r++){const c=a[r];typeof c=="function"?c():ub(n[r],null)}}}}function Ie(...n){return m.useCallback(es(...n),n)}var cN=Symbol.for("react.lazy"),oc=Gf[" use ".trim().toString()];function uN(n){return typeof n=="object"&&n!==null&&"then"in n}function ow(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===cN&&"_payload"in n&&uN(n._payload)}function rw(n){const e=hN(n),i=m.forwardRef((a,r)=>{let{children:c,...d}=a;ow(c)&&typeof oc=="function"&&(c=oc(c._payload));const h=m.Children.toArray(c),f=h.find(mN);if(f){const p=f.props.children,y=h.map(b=>b===f?m.Children.count(p)>1?m.Children.only(null):m.isValidElement(p)?p.props.children:null:b);return l.jsx(e,{...d,ref:r,children:m.isValidElement(p)?m.cloneElement(p,void 0,y):null})}return l.jsx(e,{...d,ref:r,children:c})});return i.displayName=`${n}.Slot`,i}var dN=rw("Slot");function hN(n){const e=m.forwardRef((i,a)=>{let{children:r,...c}=i;if(ow(r)&&typeof oc=="function"&&(r=oc(r._payload)),m.isValidElement(r)){const d=gN(r),h=pN(c,r.props);return r.type!==m.Fragment&&(h.ref=a?es(a,d):d),m.cloneElement(r,h)}return m.Children.count(r)>1?m.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var fN=Symbol("radix.slottable");function mN(n){return m.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===fN}function pN(n,e){const i={...e};for(const a in e){const r=n[a],c=e[a];/^on[A-Z]/.test(a)?r&&c?i[a]=(...h)=>{const f=c(...h);return r(...h),f}:r&&(i[a]=r):a==="style"?i[a]={...r,...c}:a==="className"&&(i[a]=[r,c].filter(Boolean).join(" "))}return{...n,...i}}function gN(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning;return i?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}function lw(n){var e,i,a="";if(typeof n=="string"||typeof n=="number")a+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(i=lw(n[e]))&&(a&&(a+=" "),a+=i)}else for(i in n)n[i]&&(a&&(a+=" "),a+=i);return a}function cw(){for(var n,e,i=0,a="",r=arguments.length;i<r;i++)(n=arguments[i])&&(e=lw(n))&&(a&&(a+=" "),a+=e);return a}const db=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,hb=cw,Bf=(n,e)=>i=>{var a;if(e?.variants==null)return hb(n,i?.class,i?.className);const{variants:r,defaultVariants:c}=e,d=Object.keys(r).map(p=>{const y=i?.[p],b=c?.[p];if(y===null)return null;const x=db(y)||db(b);return r[p][x]}),h=i&&Object.entries(i).reduce((p,y)=>{let[b,x]=y;return x===void 0||(p[b]=x),p},{}),f=e==null||(a=e.compoundVariants)===null||a===void 0?void 0:a.reduce((p,y)=>{let{class:b,className:x,...w}=y;return Object.entries(w).every(E=>{let[_,C]=E;return Array.isArray(C)?C.includes({...c,...h}[_]):{...c,...h}[_]===C})?[...p,b,x]:p},[]);return hb(n,d,f,i?.class,i?.className)},vN=(n,e)=>{const i=new Array(n.length+e.length);for(let a=0;a<n.length;a++)i[a]=n[a];for(let a=0;a<e.length;a++)i[n.length+a]=e[a];return i},yN=(n,e)=>({classGroupId:n,validator:e}),uw=(n=new Map,e=null,i)=>({nextPart:n,validators:e,classGroupId:i}),rc="-",fb=[],bN="arbitrary..",xN=n=>{const e=SN(n),{conflictingClassGroups:i,conflictingClassGroupModifiers:a}=n;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return wN(d);const h=d.split(rc),f=h[0]===""&&h.length>1?1:0;return dw(h,f,e)},getConflictingClassGroupIds:(d,h)=>{if(h){const f=a[d],p=i[d];return f?p?vN(p,f):f:p||fb}return i[d]||fb}}},dw=(n,e,i)=>{if(n.length-e===0)return i.classGroupId;const r=n[e],c=i.nextPart.get(r);if(c){const p=dw(n,e+1,c);if(p)return p}const d=i.validators;if(d===null)return;const h=e===0?n.join(rc):n.slice(e).join(rc),f=d.length;for(let p=0;p<f;p++){const y=d[p];if(y.validator(h))return y.classGroupId}},wN=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),i=e.indexOf(":"),a=e.slice(0,i);return a?bN+a:void 0})(),SN=n=>{const{theme:e,classGroups:i}=n;return CN(i,e)},CN=(n,e)=>{const i=uw();for(const a in n){const r=n[a];Hf(r,i,a,e)}return i},Hf=(n,e,i,a)=>{const r=n.length;for(let c=0;c<r;c++){const d=n[c];_N(d,e,i,a)}},_N=(n,e,i,a)=>{if(typeof n=="string"){EN(n,e,i);return}if(typeof n=="function"){DN(n,e,i,a);return}AN(n,e,i,a)},EN=(n,e,i)=>{const a=n===""?e:hw(e,n);a.classGroupId=i},DN=(n,e,i,a)=>{if(NN(n)){Hf(n(a),e,i,a);return}e.validators===null&&(e.validators=[]),e.validators.push(yN(i,n))},AN=(n,e,i,a)=>{const r=Object.entries(n),c=r.length;for(let d=0;d<c;d++){const[h,f]=r[d];Hf(f,hw(e,h),i,a)}},hw=(n,e)=>{let i=n;const a=e.split(rc),r=a.length;for(let c=0;c<r;c++){const d=a[c];let h=i.nextPart.get(d);h||(h=uw(),i.nextPart.set(d,h)),i=h}return i},NN=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,jN=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,i=Object.create(null),a=Object.create(null);const r=(c,d)=>{i[c]=d,e++,e>n&&(e=0,a=i,i=Object.create(null))};return{get(c){let d=i[c];if(d!==void 0)return d;if((d=a[c])!==void 0)return r(c,d),d},set(c,d){c in i?i[c]=d:r(c,d)}}},nf="!",mb=":",TN=[],pb=(n,e,i,a,r)=>({modifiers:n,hasImportantModifier:e,baseClassName:i,maybePostfixModifierPosition:a,isExternal:r}),kN=n=>{const{prefix:e,experimentalParseClassName:i}=n;let a=r=>{const c=[];let d=0,h=0,f=0,p;const y=r.length;for(let _=0;_<y;_++){const C=r[_];if(d===0&&h===0){if(C===mb){c.push(r.slice(f,_)),f=_+1;continue}if(C==="/"){p=_;continue}}C==="["?d++:C==="]"?d--:C==="("?h++:C===")"&&h--}const b=c.length===0?r:r.slice(f);let x=b,w=!1;b.endsWith(nf)?(x=b.slice(0,-1),w=!0):b.startsWith(nf)&&(x=b.slice(1),w=!0);const E=p&&p>f?p-f:void 0;return pb(c,w,x,E)};if(e){const r=e+mb,c=a;a=d=>d.startsWith(r)?c(d.slice(r.length)):pb(TN,!1,d,void 0,!0)}if(i){const r=a;a=c=>i({className:c,parseClassName:r})}return a},RN=n=>{const e=new Map;return n.orderSensitiveModifiers.forEach((i,a)=>{e.set(i,1e6+a)}),i=>{const a=[];let r=[];for(let c=0;c<i.length;c++){const d=i[c],h=d[0]==="[",f=e.has(d);h||f?(r.length>0&&(r.sort(),a.push(...r),r=[]),a.push(d)):r.push(d)}return r.length>0&&(r.sort(),a.push(...r)),a}},ON=n=>({cache:jN(n.cacheSize),parseClassName:kN(n),sortModifiers:RN(n),...xN(n)}),zN=/\s+/,MN=(n,e)=>{const{parseClassName:i,getClassGroupId:a,getConflictingClassGroupIds:r,sortModifiers:c}=e,d=[],h=n.trim().split(zN);let f="";for(let p=h.length-1;p>=0;p-=1){const y=h[p],{isExternal:b,modifiers:x,hasImportantModifier:w,baseClassName:E,maybePostfixModifierPosition:_}=i(y);if(b){f=y+(f.length>0?" "+f:f);continue}let C=!!_,D=a(C?E.substring(0,_):E);if(!D){if(!C){f=y+(f.length>0?" "+f:f);continue}if(D=a(E),!D){f=y+(f.length>0?" "+f:f);continue}C=!1}const N=x.length===0?"":x.length===1?x[0]:c(x).join(":"),k=w?N+nf:N,T=k+D;if(d.indexOf(T)>-1)continue;d.push(T);const R=r(D,C);for(let z=0;z<R.length;++z){const O=R[z];d.push(k+O)}f=y+(f.length>0?" "+f:f)}return f},PN=(...n)=>{let e=0,i,a,r="";for(;e<n.length;)(i=n[e++])&&(a=fw(i))&&(r&&(r+=" "),r+=a);return r},fw=n=>{if(typeof n=="string")return n;let e,i="";for(let a=0;a<n.length;a++)n[a]&&(e=fw(n[a]))&&(i&&(i+=" "),i+=e);return i},LN=(n,...e)=>{let i,a,r,c;const d=f=>{const p=e.reduce((y,b)=>b(y),n());return i=ON(p),a=i.cache.get,r=i.cache.set,c=h,h(f)},h=f=>{const p=a(f);if(p)return p;const y=MN(f,i);return r(f,y),y};return c=d,(...f)=>c(PN(...f))},IN=[],xt=n=>{const e=i=>i[n]||IN;return e.isThemeGetter=!0,e},mw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,GN=/^\d+\/\d+$/,BN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,HN=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,VN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,FN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,UN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ca=n=>GN.test(n),Le=n=>!!n&&!Number.isNaN(Number(n)),Xi=n=>!!n&&Number.isInteger(Number(n)),jh=n=>n.endsWith("%")&&Le(n.slice(0,-1)),bi=n=>BN.test(n),$N=()=>!0,WN=n=>HN.test(n)&&!VN.test(n),gw=()=>!1,qN=n=>FN.test(n),YN=n=>UN.test(n),XN=n=>!pe(n)&&!ge(n),QN=n=>Va(n,bw,gw),pe=n=>mw.test(n),Ds=n=>Va(n,xw,WN),Th=n=>Va(n,tj,Le),gb=n=>Va(n,vw,gw),ZN=n=>Va(n,yw,YN),Rl=n=>Va(n,ww,qN),ge=n=>pw.test(n),Uo=n=>Fa(n,xw),KN=n=>Fa(n,nj),vb=n=>Fa(n,vw),JN=n=>Fa(n,bw),ej=n=>Fa(n,yw),Ol=n=>Fa(n,ww,!0),Va=(n,e,i)=>{const a=mw.exec(n);return a?a[1]?e(a[1]):i(a[2]):!1},Fa=(n,e,i=!1)=>{const a=pw.exec(n);return a?a[1]?e(a[1]):i:!1},vw=n=>n==="position"||n==="percentage",yw=n=>n==="image"||n==="url",bw=n=>n==="length"||n==="size"||n==="bg-size",xw=n=>n==="length",tj=n=>n==="number",nj=n=>n==="family-name",ww=n=>n==="shadow",ij=()=>{const n=xt("color"),e=xt("font"),i=xt("text"),a=xt("font-weight"),r=xt("tracking"),c=xt("leading"),d=xt("breakpoint"),h=xt("container"),f=xt("spacing"),p=xt("radius"),y=xt("shadow"),b=xt("inset-shadow"),x=xt("text-shadow"),w=xt("drop-shadow"),E=xt("blur"),_=xt("perspective"),C=xt("aspect"),D=xt("ease"),N=xt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...T(),ge,pe],z=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],A=()=>[ge,pe,f],G=()=>[Ca,"full","auto",...A()],U=()=>[Xi,"none","subgrid",ge,pe],B=()=>["auto",{span:["full",Xi,ge,pe]},Xi,ge,pe],$=()=>[Xi,"auto",ge,pe],ae=()=>["auto","min","max","fr",ge,pe],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...A()],K=()=>[Ca,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],q=()=>[n,ge,pe],he=()=>[...T(),vb,gb,{position:[ge,pe]}],Se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",JN,QN,{size:[ge,pe]}],L=()=>[jh,Uo,Ds],ee=()=>["","none","full",p,ge,pe],V=()=>["",Le,Uo,Ds],Y=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[Le,jh,vb,gb],ce=()=>["","none",E,ge,pe],de=()=>["none",Le,ge,pe],De=()=>["none",Le,ge,pe],Ge=()=>[Le,ge,pe],Ne=()=>[Ca,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bi],breakpoint:[bi],color:[$N],container:[bi],"drop-shadow":[bi],ease:["in","out","in-out"],font:[XN],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bi],shadow:[bi],spacing:["px",Le],text:[bi],"text-shadow":[bi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ca,pe,ge,C]}],container:["container"],columns:[{columns:[Le,pe,ge,h]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{start:G()}],end:[{end:G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[Xi,"auto",ge,pe]}],basis:[{basis:[Ca,"full","auto",h,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Le,Ca,"auto","initial","none",pe]}],grow:[{grow:["",Le,ge,pe]}],shrink:[{shrink:["",Le,ge,pe]}],order:[{order:[Xi,"first","last","none",ge,pe]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[h,"screen",...K()]}],"min-w":[{"min-w":[h,"screen","none",...K()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[d]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",i,Uo,Ds]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,ge,Th]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jh,pe]}],"font-family":[{font:[KN,pe,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ge,pe]}],"line-clamp":[{"line-clamp":[Le,"none",ge,Th]}],leading:[{leading:[c,...A()]}],"list-image":[{"list-image":["none",ge,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[Le,"from-font","auto",ge,Ds]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[Le,"auto",ge,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ge,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:he()}],"bg-repeat":[{bg:Se()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xi,ge,pe],radial:["",ge,pe],conic:[Xi,ge,pe]},ej,ZN]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Le,ge,pe]}],"outline-w":[{outline:["",Le,Uo,Ds]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",y,Ol,Rl]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",b,Ol,Rl]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[Le,Ds]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",x,Ol,Rl]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[Le,ge,pe]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Le]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[ge,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Le]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:he()}],"mask-repeat":[{mask:Se()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,pe]}],filter:[{filter:["","none",ge,pe]}],blur:[{blur:ce()}],brightness:[{brightness:[Le,ge,pe]}],contrast:[{contrast:[Le,ge,pe]}],"drop-shadow":[{"drop-shadow":["","none",w,Ol,Rl]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",Le,ge,pe]}],"hue-rotate":[{"hue-rotate":[Le,ge,pe]}],invert:[{invert:["",Le,ge,pe]}],saturate:[{saturate:[Le,ge,pe]}],sepia:[{sepia:["",Le,ge,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,pe]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[Le,ge,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Le,ge,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Le,ge,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Le,ge,pe]}],"backdrop-invert":[{"backdrop-invert":["",Le,ge,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Le,ge,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Le,ge,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Le,ge,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Le,"initial",ge,pe]}],ease:[{ease:["linear","initial",D,ge,pe]}],delay:[{delay:[Le,ge,pe]}],animate:[{animate:["none",N,ge,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,ge,pe]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:De()}],"scale-x":[{"scale-x":De()}],"scale-y":[{"scale-y":De()}],"scale-z":[{"scale-z":De()}],"scale-3d":["scale-3d"],skew:[{skew:Ge()}],"skew-x":[{"skew-x":Ge()}],"skew-y":[{"skew-y":Ge()}],transform:[{transform:[ge,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ne()}],"translate-x":[{"translate-x":Ne()}],"translate-y":[{"translate-y":Ne()}],"translate-z":[{"translate-z":Ne()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ge,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ge,pe]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[Le,Uo,Ds,Th]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},sj=LN(ij);function ye(...n){return sj(cw(n))}const Dc=Bf("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Ce=m.forwardRef(({className:n,variant:e,size:i,asChild:a=!1,...r},c)=>{const d=a?dN:"button";return l.jsx(d,{className:ye(Dc({variant:e,size:i,className:n})),ref:c,...r})});Ce.displayName="Button";function we(n,e,{checkForDefaultPrevented:i=!0}={}){return function(r){if(n?.(r),i===!1||!r.defaultPrevented)return e?.(r)}}function aj(n,e){const i=m.createContext(e),a=c=>{const{children:d,...h}=c,f=m.useMemo(()=>h,Object.values(h));return l.jsx(i.Provider,{value:f,children:d})};a.displayName=n+"Provider";function r(c){const d=m.useContext(i);if(d)return d;if(e!==void 0)return e;throw new Error(`\`${c}\` must be used within \`${n}\``)}return[a,r]}function cn(n,e=[]){let i=[];function a(c,d){const h=m.createContext(d),f=i.length;i=[...i,d];const p=b=>{const{scope:x,children:w,...E}=b,_=x?.[n]?.[f]||h,C=m.useMemo(()=>E,Object.values(E));return l.jsx(_.Provider,{value:C,children:w})};p.displayName=c+"Provider";function y(b,x){const w=x?.[n]?.[f]||h,E=m.useContext(w);if(E)return E;if(d!==void 0)return d;throw new Error(`\`${b}\` must be used within \`${c}\``)}return[p,y]}const r=()=>{const c=i.map(d=>m.createContext(d));return function(h){const f=h?.[n]||c;return m.useMemo(()=>({[`__scope${n}`]:{...h,[n]:f}}),[h,f])}};return r.scopeName=n,[a,oj(r,...e)]}function oj(...n){const e=n[0];if(n.length===1)return e;const i=()=>{const a=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(c){const d=a.reduce((h,{useScope:f,scopeName:p})=>{const b=f(c)[`__scope${p}`];return{...h,...b}},{});return m.useMemo(()=>({[`__scope${e.scopeName}`]:d}),[d])}};return i.scopeName=e.scopeName,i}var sr=aw();const Sw=sw(sr);function Pa(n){const e=rj(n),i=m.forwardRef((a,r)=>{const{children:c,...d}=a,h=m.Children.toArray(c),f=h.find(lj);if(f){const p=f.props.children,y=h.map(b=>b===f?m.Children.count(p)>1?m.Children.only(null):m.isValidElement(p)?p.props.children:null:b);return l.jsx(e,{...d,ref:r,children:m.isValidElement(p)?m.cloneElement(p,void 0,y):null})}return l.jsx(e,{...d,ref:r,children:c})});return i.displayName=`${n}.Slot`,i}function rj(n){const e=m.forwardRef((i,a)=>{const{children:r,...c}=i;if(m.isValidElement(r)){const d=uj(r),h=cj(c,r.props);return r.type!==m.Fragment&&(h.ref=a?es(a,d):d),m.cloneElement(r,h)}return m.Children.count(r)>1?m.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var Cw=Symbol("radix.slottable");function _w(n){const e=({children:i})=>l.jsx(l.Fragment,{children:i});return e.displayName=`${n}.Slottable`,e.__radixId=Cw,e}function lj(n){return m.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Cw}function cj(n,e){const i={...e};for(const a in e){const r=n[a],c=e[a];/^on[A-Z]/.test(a)?r&&c?i[a]=(...h)=>{const f=c(...h);return r(...h),f}:r&&(i[a]=r):a==="style"?i[a]={...r,...c}:a==="className"&&(i[a]=[r,c].filter(Boolean).join(" "))}return{...n,...i}}function uj(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning;return i?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}var dj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],je=dj.reduce((n,e)=>{const i=Pa(`Primitive.${e}`),a=m.forwardRef((r,c)=>{const{asChild:d,...h}=r,f=d?i:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(f,{...h,ref:c})});return a.displayName=`Primitive.${e}`,{...n,[e]:a}},{});function hj(n,e){n&&sr.flushSync(()=>n.dispatchEvent(e))}function Gt(n){const e=m.useRef(n);return m.useEffect(()=>{e.current=n}),m.useMemo(()=>(...i)=>e.current?.(...i),[])}function fj(n,e=globalThis?.document){const i=Gt(n);m.useEffect(()=>{const a=r=>{r.key==="Escape"&&i(r)};return e.addEventListener("keydown",a,{capture:!0}),()=>e.removeEventListener("keydown",a,{capture:!0})},[i,e])}var mj="DismissableLayer",sf="dismissableLayer.update",pj="dismissableLayer.pointerDownOutside",gj="dismissableLayer.focusOutside",yb,Ew=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ar=m.forwardRef((n,e)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:c,onInteractOutside:d,onDismiss:h,...f}=n,p=m.useContext(Ew),[y,b]=m.useState(null),x=y?.ownerDocument??globalThis?.document,[,w]=m.useState({}),E=Ie(e,O=>b(O)),_=Array.from(p.layers),[C]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),D=_.indexOf(C),N=y?_.indexOf(y):-1,k=p.layersWithOutsidePointerEventsDisabled.size>0,T=N>=D,R=bj(O=>{const A=O.target,G=[...p.branches].some(U=>U.contains(A));!T||G||(r?.(O),d?.(O),O.defaultPrevented||h?.())},x),z=xj(O=>{const A=O.target;[...p.branches].some(U=>U.contains(A))||(c?.(O),d?.(O),O.defaultPrevented||h?.())},x);return fj(O=>{N===p.layers.size-1&&(a?.(O),!O.defaultPrevented&&h&&(O.preventDefault(),h()))},x),m.useEffect(()=>{if(y)return i&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(yb=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(y)),p.layers.add(y),bb(),()=>{i&&p.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=yb)}},[y,x,i,p]),m.useEffect(()=>()=>{y&&(p.layers.delete(y),p.layersWithOutsidePointerEventsDisabled.delete(y),bb())},[y,p]),m.useEffect(()=>{const O=()=>w({});return document.addEventListener(sf,O),()=>document.removeEventListener(sf,O)},[]),l.jsx(je.div,{...f,ref:E,style:{pointerEvents:k?T?"auto":"none":void 0,...n.style},onFocusCapture:we(n.onFocusCapture,z.onFocusCapture),onBlurCapture:we(n.onBlurCapture,z.onBlurCapture),onPointerDownCapture:we(n.onPointerDownCapture,R.onPointerDownCapture)})});ar.displayName=mj;var vj="DismissableLayerBranch",yj=m.forwardRef((n,e)=>{const i=m.useContext(Ew),a=m.useRef(null),r=Ie(e,a);return m.useEffect(()=>{const c=a.current;if(c)return i.branches.add(c),()=>{i.branches.delete(c)}},[i.branches]),l.jsx(je.div,{...n,ref:r})});yj.displayName=vj;function bj(n,e=globalThis?.document){const i=Gt(n),a=m.useRef(!1),r=m.useRef(()=>{});return m.useEffect(()=>{const c=h=>{if(h.target&&!a.current){let f=function(){Dw(pj,i,p,{discrete:!0})};const p={originalEvent:h};h.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=f,e.addEventListener("click",r.current,{once:!0})):f()}else e.removeEventListener("click",r.current);a.current=!1},d=window.setTimeout(()=>{e.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(d),e.removeEventListener("pointerdown",c),e.removeEventListener("click",r.current)}},[e,i]),{onPointerDownCapture:()=>a.current=!0}}function xj(n,e=globalThis?.document){const i=Gt(n),a=m.useRef(!1);return m.useEffect(()=>{const r=c=>{c.target&&!a.current&&Dw(gj,i,{originalEvent:c},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,i]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function bb(){const n=new CustomEvent(sf);document.dispatchEvent(n)}function Dw(n,e,i,{discrete:a}){const r=i.originalEvent.target,c=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:i});e&&r.addEventListener(n,e,{once:!0}),a?hj(r,c):r.dispatchEvent(c)}var Dt=globalThis?.document?m.useLayoutEffect:()=>{},wj=Gf[" useId ".trim().toString()]||(()=>{}),Sj=0;function Mt(n){const[e,i]=m.useState(wj());return Dt(()=>{i(a=>a??String(Sj++))},[n]),e?`radix-${e}`:""}const Cj=["top","right","bottom","left"],ts=Math.min,rn=Math.max,lc=Math.round,zl=Math.floor,Xn=n=>({x:n,y:n}),_j={left:"right",right:"left",bottom:"top",top:"bottom"},Ej={start:"end",end:"start"};function af(n,e,i){return rn(n,ts(e,i))}function wi(n,e){return typeof n=="function"?n(e):n}function Si(n){return n.split("-")[0]}function Ua(n){return n.split("-")[1]}function Vf(n){return n==="x"?"y":"x"}function Ff(n){return n==="y"?"height":"width"}const Dj=new Set(["top","bottom"]);function Yn(n){return Dj.has(Si(n))?"y":"x"}function Uf(n){return Vf(Yn(n))}function Aj(n,e,i){i===void 0&&(i=!1);const a=Ua(n),r=Uf(n),c=Ff(r);let d=r==="x"?a===(i?"end":"start")?"right":"left":a==="start"?"bottom":"top";return e.reference[c]>e.floating[c]&&(d=cc(d)),[d,cc(d)]}function Nj(n){const e=cc(n);return[of(n),e,of(e)]}function of(n){return n.replace(/start|end/g,e=>Ej[e])}const xb=["left","right"],wb=["right","left"],jj=["top","bottom"],Tj=["bottom","top"];function kj(n,e,i){switch(n){case"top":case"bottom":return i?e?wb:xb:e?xb:wb;case"left":case"right":return e?jj:Tj;default:return[]}}function Rj(n,e,i,a){const r=Ua(n);let c=kj(Si(n),i==="start",a);return r&&(c=c.map(d=>d+"-"+r),e&&(c=c.concat(c.map(of)))),c}function cc(n){return n.replace(/left|right|bottom|top/g,e=>_j[e])}function Oj(n){return{top:0,right:0,bottom:0,left:0,...n}}function Aw(n){return typeof n!="number"?Oj(n):{top:n,right:n,bottom:n,left:n}}function uc(n){const{x:e,y:i,width:a,height:r}=n;return{width:a,height:r,top:i,left:e,right:e+a,bottom:i+r,x:e,y:i}}function Sb(n,e,i){let{reference:a,floating:r}=n;const c=Yn(e),d=Uf(e),h=Ff(d),f=Si(e),p=c==="y",y=a.x+a.width/2-r.width/2,b=a.y+a.height/2-r.height/2,x=a[h]/2-r[h]/2;let w;switch(f){case"top":w={x:y,y:a.y-r.height};break;case"bottom":w={x:y,y:a.y+a.height};break;case"right":w={x:a.x+a.width,y:b};break;case"left":w={x:a.x-r.width,y:b};break;default:w={x:a.x,y:a.y}}switch(Ua(e)){case"start":w[d]-=x*(i&&p?-1:1);break;case"end":w[d]+=x*(i&&p?-1:1);break}return w}async function zj(n,e){var i;e===void 0&&(e={});const{x:a,y:r,platform:c,rects:d,elements:h,strategy:f}=n,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:b="floating",altBoundary:x=!1,padding:w=0}=wi(e,n),E=Aw(w),C=h[x?b==="floating"?"reference":"floating":b],D=uc(await c.getClippingRect({element:(i=await(c.isElement==null?void 0:c.isElement(C)))==null||i?C:C.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(h.floating)),boundary:p,rootBoundary:y,strategy:f})),N=b==="floating"?{x:a,y:r,width:d.floating.width,height:d.floating.height}:d.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h.floating)),T=await(c.isElement==null?void 0:c.isElement(k))?await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1}:{x:1,y:1},R=uc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:N,offsetParent:k,strategy:f}):N);return{top:(D.top-R.top+E.top)/T.y,bottom:(R.bottom-D.bottom+E.bottom)/T.y,left:(D.left-R.left+E.left)/T.x,right:(R.right-D.right+E.right)/T.x}}const Mj=async(n,e,i)=>{const{placement:a="bottom",strategy:r="absolute",middleware:c=[],platform:d}=i,h=c.filter(Boolean),f=await(d.isRTL==null?void 0:d.isRTL(e));let p=await d.getElementRects({reference:n,floating:e,strategy:r}),{x:y,y:b}=Sb(p,a,f),x=a,w={},E=0;for(let C=0;C<h.length;C++){var _;const{name:D,fn:N}=h[C],{x:k,y:T,data:R,reset:z}=await N({x:y,y:b,initialPlacement:a,placement:x,strategy:r,middlewareData:w,rects:p,platform:{...d,detectOverflow:(_=d.detectOverflow)!=null?_:zj},elements:{reference:n,floating:e}});y=k??y,b=T??b,w={...w,[D]:{...w[D],...R}},z&&E<=50&&(E++,typeof z=="object"&&(z.placement&&(x=z.placement),z.rects&&(p=z.rects===!0?await d.getElementRects({reference:n,floating:e,strategy:r}):z.rects),{x:y,y:b}=Sb(p,x,f)),C=-1)}return{x:y,y:b,placement:x,strategy:r,middlewareData:w}},Pj=n=>({name:"arrow",options:n,async fn(e){const{x:i,y:a,placement:r,rects:c,platform:d,elements:h,middlewareData:f}=e,{element:p,padding:y=0}=wi(n,e)||{};if(p==null)return{};const b=Aw(y),x={x:i,y:a},w=Uf(r),E=Ff(w),_=await d.getDimensions(p),C=w==="y",D=C?"top":"left",N=C?"bottom":"right",k=C?"clientHeight":"clientWidth",T=c.reference[E]+c.reference[w]-x[w]-c.floating[E],R=x[w]-c.reference[w],z=await(d.getOffsetParent==null?void 0:d.getOffsetParent(p));let O=z?z[k]:0;(!O||!await(d.isElement==null?void 0:d.isElement(z)))&&(O=h.floating[k]||c.floating[E]);const A=T/2-R/2,G=O/2-_[E]/2-1,U=ts(b[D],G),B=ts(b[N],G),$=U,ae=O-_[E]-B,ne=O/2-_[E]/2+A,W=af($,ne,ae),M=!f.arrow&&Ua(r)!=null&&ne!==W&&c.reference[E]/2-(ne<$?U:B)-_[E]/2<0,K=M?ne<$?ne-$:ne-ae:0;return{[w]:x[w]+K,data:{[w]:W,centerOffset:ne-W-K,...M&&{alignmentOffset:K}},reset:M}}}),Lj=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var i,a;const{placement:r,middlewareData:c,rects:d,initialPlacement:h,platform:f,elements:p}=e,{mainAxis:y=!0,crossAxis:b=!0,fallbackPlacements:x,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:_=!0,...C}=wi(n,e);if((i=c.arrow)!=null&&i.alignmentOffset)return{};const D=Si(r),N=Yn(h),k=Si(h)===h,T=await(f.isRTL==null?void 0:f.isRTL(p.floating)),R=x||(k||!_?[cc(h)]:Nj(h)),z=E!=="none";!x&&z&&R.push(...Rj(h,_,E,T));const O=[h,...R],A=await f.detectOverflow(e,C),G=[];let U=((a=c.flip)==null?void 0:a.overflows)||[];if(y&&G.push(A[D]),b){const ne=Aj(r,d,T);G.push(A[ne[0]],A[ne[1]])}if(U=[...U,{placement:r,overflows:G}],!G.every(ne=>ne<=0)){var B,$;const ne=(((B=c.flip)==null?void 0:B.index)||0)+1,W=O[ne];if(W&&(!(b==="alignment"?N!==Yn(W):!1)||U.every(q=>Yn(q.placement)===N?q.overflows[0]>0:!0)))return{data:{index:ne,overflows:U},reset:{placement:W}};let M=($=U.filter(K=>K.overflows[0]<=0).sort((K,q)=>K.overflows[1]-q.overflows[1])[0])==null?void 0:$.placement;if(!M)switch(w){case"bestFit":{var ae;const K=(ae=U.filter(q=>{if(z){const he=Yn(q.placement);return he===N||he==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(he=>he>0).reduce((he,Se)=>he+Se,0)]).sort((q,he)=>q[1]-he[1])[0])==null?void 0:ae[0];K&&(M=K);break}case"initialPlacement":M=h;break}if(r!==M)return{reset:{placement:M}}}return{}}}};function Cb(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function _b(n){return Cj.some(e=>n[e]>=0)}const Ij=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:i,platform:a}=e,{strategy:r="referenceHidden",...c}=wi(n,e);switch(r){case"referenceHidden":{const d=await a.detectOverflow(e,{...c,elementContext:"reference"}),h=Cb(d,i.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:_b(h)}}}case"escaped":{const d=await a.detectOverflow(e,{...c,altBoundary:!0}),h=Cb(d,i.floating);return{data:{escapedOffsets:h,escaped:_b(h)}}}default:return{}}}}},Nw=new Set(["left","top"]);async function Gj(n,e){const{placement:i,platform:a,elements:r}=n,c=await(a.isRTL==null?void 0:a.isRTL(r.floating)),d=Si(i),h=Ua(i),f=Yn(i)==="y",p=Nw.has(d)?-1:1,y=c&&f?-1:1,b=wi(e,n);let{mainAxis:x,crossAxis:w,alignmentAxis:E}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return h&&typeof E=="number"&&(w=h==="end"?E*-1:E),f?{x:w*y,y:x*p}:{x:x*p,y:w*y}}const Bj=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var i,a;const{x:r,y:c,placement:d,middlewareData:h}=e,f=await Gj(e,n);return d===((i=h.offset)==null?void 0:i.placement)&&(a=h.arrow)!=null&&a.alignmentOffset?{}:{x:r+f.x,y:c+f.y,data:{...f,placement:d}}}}},Hj=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:i,y:a,placement:r,platform:c}=e,{mainAxis:d=!0,crossAxis:h=!1,limiter:f={fn:D=>{let{x:N,y:k}=D;return{x:N,y:k}}},...p}=wi(n,e),y={x:i,y:a},b=await c.detectOverflow(e,p),x=Yn(Si(r)),w=Vf(x);let E=y[w],_=y[x];if(d){const D=w==="y"?"top":"left",N=w==="y"?"bottom":"right",k=E+b[D],T=E-b[N];E=af(k,E,T)}if(h){const D=x==="y"?"top":"left",N=x==="y"?"bottom":"right",k=_+b[D],T=_-b[N];_=af(k,_,T)}const C=f.fn({...e,[w]:E,[x]:_});return{...C,data:{x:C.x-i,y:C.y-a,enabled:{[w]:d,[x]:h}}}}}},Vj=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:i,y:a,placement:r,rects:c,middlewareData:d}=e,{offset:h=0,mainAxis:f=!0,crossAxis:p=!0}=wi(n,e),y={x:i,y:a},b=Yn(r),x=Vf(b);let w=y[x],E=y[b];const _=wi(h,e),C=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(f){const k=x==="y"?"height":"width",T=c.reference[x]-c.floating[k]+C.mainAxis,R=c.reference[x]+c.reference[k]-C.mainAxis;w<T?w=T:w>R&&(w=R)}if(p){var D,N;const k=x==="y"?"width":"height",T=Nw.has(Si(r)),R=c.reference[b]-c.floating[k]+(T&&((D=d.offset)==null?void 0:D[b])||0)+(T?0:C.crossAxis),z=c.reference[b]+c.reference[k]+(T?0:((N=d.offset)==null?void 0:N[b])||0)-(T?C.crossAxis:0);E<R?E=R:E>z&&(E=z)}return{[x]:w,[b]:E}}}},Fj=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var i,a;const{placement:r,rects:c,platform:d,elements:h}=e,{apply:f=()=>{},...p}=wi(n,e),y=await d.detectOverflow(e,p),b=Si(r),x=Ua(r),w=Yn(r)==="y",{width:E,height:_}=c.floating;let C,D;b==="top"||b==="bottom"?(C=b,D=x===(await(d.isRTL==null?void 0:d.isRTL(h.floating))?"start":"end")?"left":"right"):(D=b,C=x==="end"?"top":"bottom");const N=_-y.top-y.bottom,k=E-y.left-y.right,T=ts(_-y[C],N),R=ts(E-y[D],k),z=!e.middlewareData.shift;let O=T,A=R;if((i=e.middlewareData.shift)!=null&&i.enabled.x&&(A=k),(a=e.middlewareData.shift)!=null&&a.enabled.y&&(O=N),z&&!x){const U=rn(y.left,0),B=rn(y.right,0),$=rn(y.top,0),ae=rn(y.bottom,0);w?A=E-2*(U!==0||B!==0?U+B:rn(y.left,y.right)):O=_-2*($!==0||ae!==0?$+ae:rn(y.top,y.bottom))}await f({...e,availableWidth:A,availableHeight:O});const G=await d.getDimensions(h.floating);return E!==G.width||_!==G.height?{reset:{rects:!0}}:{}}}};function Ac(){return typeof window<"u"}function $a(n){return jw(n)?(n.nodeName||"").toLowerCase():"#document"}function ln(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Kn(n){var e;return(e=(jw(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function jw(n){return Ac()?n instanceof Node||n instanceof ln(n).Node:!1}function Mn(n){return Ac()?n instanceof Element||n instanceof ln(n).Element:!1}function Qn(n){return Ac()?n instanceof HTMLElement||n instanceof ln(n).HTMLElement:!1}function Eb(n){return!Ac()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof ln(n).ShadowRoot}const Uj=new Set(["inline","contents"]);function or(n){const{overflow:e,overflowX:i,overflowY:a,display:r}=Pn(n);return/auto|scroll|overlay|hidden|clip/.test(e+a+i)&&!Uj.has(r)}const $j=new Set(["table","td","th"]);function Wj(n){return $j.has($a(n))}const qj=[":popover-open",":modal"];function Nc(n){return qj.some(e=>{try{return n.matches(e)}catch{return!1}})}const Yj=["transform","translate","scale","rotate","perspective"],Xj=["transform","translate","scale","rotate","perspective","filter"],Qj=["paint","layout","strict","content"];function $f(n){const e=Wf(),i=Mn(n)?Pn(n):n;return Yj.some(a=>i[a]?i[a]!=="none":!1)||(i.containerType?i.containerType!=="normal":!1)||!e&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!e&&(i.filter?i.filter!=="none":!1)||Xj.some(a=>(i.willChange||"").includes(a))||Qj.some(a=>(i.contain||"").includes(a))}function Zj(n){let e=ns(n);for(;Qn(e)&&!La(e);){if($f(e))return e;if(Nc(e))return null;e=ns(e)}return null}function Wf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Kj=new Set(["html","body","#document"]);function La(n){return Kj.has($a(n))}function Pn(n){return ln(n).getComputedStyle(n)}function jc(n){return Mn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function ns(n){if($a(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Eb(n)&&n.host||Kn(n);return Eb(e)?e.host:e}function Tw(n){const e=ns(n);return La(e)?n.ownerDocument?n.ownerDocument.body:n.body:Qn(e)&&or(e)?e:Tw(e)}function Qo(n,e,i){var a;e===void 0&&(e=[]),i===void 0&&(i=!0);const r=Tw(n),c=r===((a=n.ownerDocument)==null?void 0:a.body),d=ln(r);if(c){const h=rf(d);return e.concat(d,d.visualViewport||[],or(r)?r:[],h&&i?Qo(h):[])}return e.concat(r,Qo(r,[],i))}function rf(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function kw(n){const e=Pn(n);let i=parseFloat(e.width)||0,a=parseFloat(e.height)||0;const r=Qn(n),c=r?n.offsetWidth:i,d=r?n.offsetHeight:a,h=lc(i)!==c||lc(a)!==d;return h&&(i=c,a=d),{width:i,height:a,$:h}}function qf(n){return Mn(n)?n:n.contextElement}function Oa(n){const e=qf(n);if(!Qn(e))return Xn(1);const i=e.getBoundingClientRect(),{width:a,height:r,$:c}=kw(e);let d=(c?lc(i.width):i.width)/a,h=(c?lc(i.height):i.height)/r;return(!d||!Number.isFinite(d))&&(d=1),(!h||!Number.isFinite(h))&&(h=1),{x:d,y:h}}const Jj=Xn(0);function Rw(n){const e=ln(n);return!Wf()||!e.visualViewport?Jj:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function e1(n,e,i){return e===void 0&&(e=!1),!i||e&&i!==ln(n)?!1:e}function Os(n,e,i,a){e===void 0&&(e=!1),i===void 0&&(i=!1);const r=n.getBoundingClientRect(),c=qf(n);let d=Xn(1);e&&(a?Mn(a)&&(d=Oa(a)):d=Oa(n));const h=e1(c,i,a)?Rw(c):Xn(0);let f=(r.left+h.x)/d.x,p=(r.top+h.y)/d.y,y=r.width/d.x,b=r.height/d.y;if(c){const x=ln(c),w=a&&Mn(a)?ln(a):a;let E=x,_=rf(E);for(;_&&a&&w!==E;){const C=Oa(_),D=_.getBoundingClientRect(),N=Pn(_),k=D.left+(_.clientLeft+parseFloat(N.paddingLeft))*C.x,T=D.top+(_.clientTop+parseFloat(N.paddingTop))*C.y;f*=C.x,p*=C.y,y*=C.x,b*=C.y,f+=k,p+=T,E=ln(_),_=rf(E)}}return uc({width:y,height:b,x:f,y:p})}function Tc(n,e){const i=jc(n).scrollLeft;return e?e.left+i:Os(Kn(n)).left+i}function Ow(n,e){const i=n.getBoundingClientRect(),a=i.left+e.scrollLeft-Tc(n,i),r=i.top+e.scrollTop;return{x:a,y:r}}function t1(n){let{elements:e,rect:i,offsetParent:a,strategy:r}=n;const c=r==="fixed",d=Kn(a),h=e?Nc(e.floating):!1;if(a===d||h&&c)return i;let f={scrollLeft:0,scrollTop:0},p=Xn(1);const y=Xn(0),b=Qn(a);if((b||!b&&!c)&&(($a(a)!=="body"||or(d))&&(f=jc(a)),Qn(a))){const w=Os(a);p=Oa(a),y.x=w.x+a.clientLeft,y.y=w.y+a.clientTop}const x=d&&!b&&!c?Ow(d,f):Xn(0);return{width:i.width*p.x,height:i.height*p.y,x:i.x*p.x-f.scrollLeft*p.x+y.x+x.x,y:i.y*p.y-f.scrollTop*p.y+y.y+x.y}}function n1(n){return Array.from(n.getClientRects())}function i1(n){const e=Kn(n),i=jc(n),a=n.ownerDocument.body,r=rn(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),c=rn(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let d=-i.scrollLeft+Tc(n);const h=-i.scrollTop;return Pn(a).direction==="rtl"&&(d+=rn(e.clientWidth,a.clientWidth)-r),{width:r,height:c,x:d,y:h}}const Db=25;function s1(n,e){const i=ln(n),a=Kn(n),r=i.visualViewport;let c=a.clientWidth,d=a.clientHeight,h=0,f=0;if(r){c=r.width,d=r.height;const y=Wf();(!y||y&&e==="fixed")&&(h=r.offsetLeft,f=r.offsetTop)}const p=Tc(a);if(p<=0){const y=a.ownerDocument,b=y.body,x=getComputedStyle(b),w=y.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,E=Math.abs(a.clientWidth-b.clientWidth-w);E<=Db&&(c-=E)}else p<=Db&&(c+=p);return{width:c,height:d,x:h,y:f}}const a1=new Set(["absolute","fixed"]);function o1(n,e){const i=Os(n,!0,e==="fixed"),a=i.top+n.clientTop,r=i.left+n.clientLeft,c=Qn(n)?Oa(n):Xn(1),d=n.clientWidth*c.x,h=n.clientHeight*c.y,f=r*c.x,p=a*c.y;return{width:d,height:h,x:f,y:p}}function Ab(n,e,i){let a;if(e==="viewport")a=s1(n,i);else if(e==="document")a=i1(Kn(n));else if(Mn(e))a=o1(e,i);else{const r=Rw(n);a={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return uc(a)}function zw(n,e){const i=ns(n);return i===e||!Mn(i)||La(i)?!1:Pn(i).position==="fixed"||zw(i,e)}function r1(n,e){const i=e.get(n);if(i)return i;let a=Qo(n,[],!1).filter(h=>Mn(h)&&$a(h)!=="body"),r=null;const c=Pn(n).position==="fixed";let d=c?ns(n):n;for(;Mn(d)&&!La(d);){const h=Pn(d),f=$f(d);!f&&h.position==="fixed"&&(r=null),(c?!f&&!r:!f&&h.position==="static"&&!!r&&a1.has(r.position)||or(d)&&!f&&zw(n,d))?a=a.filter(y=>y!==d):r=h,d=ns(d)}return e.set(n,a),a}function l1(n){let{element:e,boundary:i,rootBoundary:a,strategy:r}=n;const d=[...i==="clippingAncestors"?Nc(e)?[]:r1(e,this._c):[].concat(i),a],h=d[0],f=d.reduce((p,y)=>{const b=Ab(e,y,r);return p.top=rn(b.top,p.top),p.right=ts(b.right,p.right),p.bottom=ts(b.bottom,p.bottom),p.left=rn(b.left,p.left),p},Ab(e,h,r));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function c1(n){const{width:e,height:i}=kw(n);return{width:e,height:i}}function u1(n,e,i){const a=Qn(e),r=Kn(e),c=i==="fixed",d=Os(n,!0,c,e);let h={scrollLeft:0,scrollTop:0};const f=Xn(0);function p(){f.x=Tc(r)}if(a||!a&&!c)if(($a(e)!=="body"||or(r))&&(h=jc(e)),a){const w=Os(e,!0,c,e);f.x=w.x+e.clientLeft,f.y=w.y+e.clientTop}else r&&p();c&&!a&&r&&p();const y=r&&!a&&!c?Ow(r,h):Xn(0),b=d.left+h.scrollLeft-f.x-y.x,x=d.top+h.scrollTop-f.y-y.y;return{x:b,y:x,width:d.width,height:d.height}}function kh(n){return Pn(n).position==="static"}function Nb(n,e){if(!Qn(n)||Pn(n).position==="fixed")return null;if(e)return e(n);let i=n.offsetParent;return Kn(n)===i&&(i=i.ownerDocument.body),i}function Mw(n,e){const i=ln(n);if(Nc(n))return i;if(!Qn(n)){let r=ns(n);for(;r&&!La(r);){if(Mn(r)&&!kh(r))return r;r=ns(r)}return i}let a=Nb(n,e);for(;a&&Wj(a)&&kh(a);)a=Nb(a,e);return a&&La(a)&&kh(a)&&!$f(a)?i:a||Zj(n)||i}const d1=async function(n){const e=this.getOffsetParent||Mw,i=this.getDimensions,a=await i(n.floating);return{reference:u1(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function h1(n){return Pn(n).direction==="rtl"}const f1={convertOffsetParentRelativeRectToViewportRelativeRect:t1,getDocumentElement:Kn,getClippingRect:l1,getOffsetParent:Mw,getElementRects:d1,getClientRects:n1,getDimensions:c1,getScale:Oa,isElement:Mn,isRTL:h1};function Pw(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function m1(n,e){let i=null,a;const r=Kn(n);function c(){var h;clearTimeout(a),(h=i)==null||h.disconnect(),i=null}function d(h,f){h===void 0&&(h=!1),f===void 0&&(f=1),c();const p=n.getBoundingClientRect(),{left:y,top:b,width:x,height:w}=p;if(h||e(),!x||!w)return;const E=zl(b),_=zl(r.clientWidth-(y+x)),C=zl(r.clientHeight-(b+w)),D=zl(y),k={rootMargin:-E+"px "+-_+"px "+-C+"px "+-D+"px",threshold:rn(0,ts(1,f))||1};let T=!0;function R(z){const O=z[0].intersectionRatio;if(O!==f){if(!T)return d();O?d(!1,O):a=setTimeout(()=>{d(!1,1e-7)},1e3)}O===1&&!Pw(p,n.getBoundingClientRect())&&d(),T=!1}try{i=new IntersectionObserver(R,{...k,root:r.ownerDocument})}catch{i=new IntersectionObserver(R,k)}i.observe(n)}return d(!0),c}function p1(n,e,i,a){a===void 0&&(a={});const{ancestorScroll:r=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:f=!1}=a,p=qf(n),y=r||c?[...p?Qo(p):[],...Qo(e)]:[];y.forEach(D=>{r&&D.addEventListener("scroll",i,{passive:!0}),c&&D.addEventListener("resize",i)});const b=p&&h?m1(p,i):null;let x=-1,w=null;d&&(w=new ResizeObserver(D=>{let[N]=D;N&&N.target===p&&w&&(w.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var k;(k=w)==null||k.observe(e)})),i()}),p&&!f&&w.observe(p),w.observe(e));let E,_=f?Os(n):null;f&&C();function C(){const D=Os(n);_&&!Pw(_,D)&&i(),_=D,E=requestAnimationFrame(C)}return i(),()=>{var D;y.forEach(N=>{r&&N.removeEventListener("scroll",i),c&&N.removeEventListener("resize",i)}),b?.(),(D=w)==null||D.disconnect(),w=null,f&&cancelAnimationFrame(E)}}const g1=Bj,v1=Hj,y1=Lj,b1=Fj,x1=Ij,jb=Pj,w1=Vj,S1=(n,e,i)=>{const a=new Map,r={platform:f1,...i},c={...r.platform,_c:a};return Mj(n,e,{...r,platform:c})};var C1=typeof document<"u",_1=function(){},Zl=C1?m.useLayoutEffect:_1;function dc(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let i,a,r;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(i=n.length,i!==e.length)return!1;for(a=i;a--!==0;)if(!dc(n[a],e[a]))return!1;return!0}if(r=Object.keys(n),i=r.length,i!==Object.keys(e).length)return!1;for(a=i;a--!==0;)if(!{}.hasOwnProperty.call(e,r[a]))return!1;for(a=i;a--!==0;){const c=r[a];if(!(c==="_owner"&&n.$$typeof)&&!dc(n[c],e[c]))return!1}return!0}return n!==n&&e!==e}function Lw(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Tb(n,e){const i=Lw(n);return Math.round(e*i)/i}function Rh(n){const e=m.useRef(n);return Zl(()=>{e.current=n}),e}function E1(n){n===void 0&&(n={});const{placement:e="bottom",strategy:i="absolute",middleware:a=[],platform:r,elements:{reference:c,floating:d}={},transform:h=!0,whileElementsMounted:f,open:p}=n,[y,b]=m.useState({x:0,y:0,strategy:i,placement:e,middlewareData:{},isPositioned:!1}),[x,w]=m.useState(a);dc(x,a)||w(a);const[E,_]=m.useState(null),[C,D]=m.useState(null),N=m.useCallback(q=>{q!==z.current&&(z.current=q,_(q))},[]),k=m.useCallback(q=>{q!==O.current&&(O.current=q,D(q))},[]),T=c||E,R=d||C,z=m.useRef(null),O=m.useRef(null),A=m.useRef(y),G=f!=null,U=Rh(f),B=Rh(r),$=Rh(p),ae=m.useCallback(()=>{if(!z.current||!O.current)return;const q={placement:e,strategy:i,middleware:x};B.current&&(q.platform=B.current),S1(z.current,O.current,q).then(he=>{const Se={...he,isPositioned:$.current!==!1};ne.current&&!dc(A.current,Se)&&(A.current=Se,sr.flushSync(()=>{b(Se)}))})},[x,e,i,B,$]);Zl(()=>{p===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,b(q=>({...q,isPositioned:!1})))},[p]);const ne=m.useRef(!1);Zl(()=>(ne.current=!0,()=>{ne.current=!1}),[]),Zl(()=>{if(T&&(z.current=T),R&&(O.current=R),T&&R){if(U.current)return U.current(T,R,ae);ae()}},[T,R,ae,U,G]);const W=m.useMemo(()=>({reference:z,floating:O,setReference:N,setFloating:k}),[N,k]),M=m.useMemo(()=>({reference:T,floating:R}),[T,R]),K=m.useMemo(()=>{const q={position:i,left:0,top:0};if(!M.floating)return q;const he=Tb(M.floating,y.x),Se=Tb(M.floating,y.y);return h?{...q,transform:"translate("+he+"px, "+Se+"px)",...Lw(M.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:he,top:Se}},[i,h,M.floating,y.x,y.y]);return m.useMemo(()=>({...y,update:ae,refs:W,elements:M,floatingStyles:K}),[y,ae,W,M,K])}const D1=n=>{function e(i){return{}.hasOwnProperty.call(i,"current")}return{name:"arrow",options:n,fn(i){const{element:a,padding:r}=typeof n=="function"?n(i):n;return a&&e(a)?a.current!=null?jb({element:a.current,padding:r}).fn(i):{}:a?jb({element:a,padding:r}).fn(i):{}}}},A1=(n,e)=>({...g1(n),options:[n,e]}),N1=(n,e)=>({...v1(n),options:[n,e]}),j1=(n,e)=>({...w1(n),options:[n,e]}),T1=(n,e)=>({...y1(n),options:[n,e]}),k1=(n,e)=>({...b1(n),options:[n,e]}),R1=(n,e)=>({...x1(n),options:[n,e]}),O1=(n,e)=>({...D1(n),options:[n,e]});var z1="Arrow",Iw=m.forwardRef((n,e)=>{const{children:i,width:a=10,height:r=5,...c}=n;return l.jsx(je.svg,{...c,ref:e,width:a,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?i:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});Iw.displayName=z1;var M1=Iw;function Yf(n){const[e,i]=m.useState(void 0);return Dt(()=>{if(n){i({width:n.offsetWidth,height:n.offsetHeight});const a=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const c=r[0];let d,h;if("borderBoxSize"in c){const f=c.borderBoxSize,p=Array.isArray(f)?f[0]:f;d=p.inlineSize,h=p.blockSize}else d=n.offsetWidth,h=n.offsetHeight;i({width:d,height:h})});return a.observe(n,{box:"border-box"}),()=>a.unobserve(n)}else i(void 0)},[n]),e}var Xf="Popper",[Gw,Wa]=cn(Xf),[P1,Bw]=Gw(Xf),Hw=n=>{const{__scopePopper:e,children:i}=n,[a,r]=m.useState(null);return l.jsx(P1,{scope:e,anchor:a,onAnchorChange:r,children:i})};Hw.displayName=Xf;var Vw="PopperAnchor",Fw=m.forwardRef((n,e)=>{const{__scopePopper:i,virtualRef:a,...r}=n,c=Bw(Vw,i),d=m.useRef(null),h=Ie(e,d),f=m.useRef(null);return m.useEffect(()=>{const p=f.current;f.current=a?.current||d.current,p!==f.current&&c.onAnchorChange(f.current)}),a?null:l.jsx(je.div,{...r,ref:h})});Fw.displayName=Vw;var Qf="PopperContent",[L1,I1]=Gw(Qf),Uw=m.forwardRef((n,e)=>{const{__scopePopper:i,side:a="bottom",sideOffset:r=0,align:c="center",alignOffset:d=0,arrowPadding:h=0,avoidCollisions:f=!0,collisionBoundary:p=[],collisionPadding:y=0,sticky:b="partial",hideWhenDetached:x=!1,updatePositionStrategy:w="optimized",onPlaced:E,..._}=n,C=Bw(Qf,i),[D,N]=m.useState(null),k=Ie(e,X=>N(X)),[T,R]=m.useState(null),z=Yf(T),O=z?.width??0,A=z?.height??0,G=a+(c!=="center"?"-"+c:""),U=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},B=Array.isArray(p)?p:[p],$=B.length>0,ae={padding:U,boundary:B.filter(B1),altBoundary:$},{refs:ne,floatingStyles:W,placement:M,isPositioned:K,middlewareData:q}=E1({strategy:"fixed",placement:G,whileElementsMounted:(...X)=>p1(...X,{animationFrame:w==="always"}),elements:{reference:C.anchor},middleware:[A1({mainAxis:r+A,alignmentAxis:d}),f&&N1({mainAxis:!0,crossAxis:!1,limiter:b==="partial"?j1():void 0,...ae}),f&&T1({...ae}),k1({...ae,apply:({elements:X,rects:ce,availableWidth:de,availableHeight:De})=>{const{width:Ge,height:Ne}=ce.reference,dt=X.floating.style;dt.setProperty("--radix-popper-available-width",`${de}px`),dt.setProperty("--radix-popper-available-height",`${De}px`),dt.setProperty("--radix-popper-anchor-width",`${Ge}px`),dt.setProperty("--radix-popper-anchor-height",`${Ne}px`)}}),T&&O1({element:T,padding:h}),H1({arrowWidth:O,arrowHeight:A}),x&&R1({strategy:"referenceHidden",...ae})]}),[he,Se]=qw(M),I=Gt(E);Dt(()=>{K&&I?.()},[K,I]);const L=q.arrow?.x,ee=q.arrow?.y,V=q.arrow?.centerOffset!==0,[Y,le]=m.useState();return Dt(()=>{D&&le(window.getComputedStyle(D).zIndex)},[D]),l.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:K?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:l.jsx(L1,{scope:i,placedSide:he,onArrowChange:R,arrowX:L,arrowY:ee,shouldHideArrow:V,children:l.jsx(je.div,{"data-side":he,"data-align":Se,..._,ref:k,style:{..._.style,animation:K?void 0:"none"}})})})});Uw.displayName=Qf;var $w="PopperArrow",G1={top:"bottom",right:"left",bottom:"top",left:"right"},Ww=m.forwardRef(function(e,i){const{__scopePopper:a,...r}=e,c=I1($w,a),d=G1[c.placedSide];return l.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[d]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:l.jsx(M1,{...r,ref:i,style:{...r.style,display:"block"}})})});Ww.displayName=$w;function B1(n){return n!==null}var H1=n=>({name:"transformOrigin",options:n,fn(e){const{placement:i,rects:a,middlewareData:r}=e,d=r.arrow?.centerOffset!==0,h=d?0:n.arrowWidth,f=d?0:n.arrowHeight,[p,y]=qw(i),b={start:"0%",center:"50%",end:"100%"}[y],x=(r.arrow?.x??0)+h/2,w=(r.arrow?.y??0)+f/2;let E="",_="";return p==="bottom"?(E=d?b:`${x}px`,_=`${-f}px`):p==="top"?(E=d?b:`${x}px`,_=`${a.floating.height+f}px`):p==="right"?(E=`${-f}px`,_=d?b:`${w}px`):p==="left"&&(E=`${a.floating.width+f}px`,_=d?b:`${w}px`),{data:{x:E,y:_}}}});function qw(n){const[e,i="center"]=n.split("-");return[e,i]}var Zf=Hw,kc=Fw,Kf=Uw,Jf=Ww,V1="Portal",rr=m.forwardRef((n,e)=>{const{container:i,...a}=n,[r,c]=m.useState(!1);Dt(()=>c(!0),[]);const d=i||r&&globalThis?.document?.body;return d?Sw.createPortal(l.jsx(je.div,{...a,ref:e}),d):null});rr.displayName=V1;function F1(n,e){return m.useReducer((i,a)=>e[i][a]??i,n)}var qt=n=>{const{present:e,children:i}=n,a=U1(e),r=typeof i=="function"?i({present:a.isPresent}):m.Children.only(i),c=Ie(a.ref,$1(r));return typeof i=="function"||a.isPresent?m.cloneElement(r,{ref:c}):null};qt.displayName="Presence";function U1(n){const[e,i]=m.useState(),a=m.useRef(null),r=m.useRef(n),c=m.useRef("none"),d=n?"mounted":"unmounted",[h,f]=F1(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const p=Ml(a.current);c.current=h==="mounted"?p:"none"},[h]),Dt(()=>{const p=a.current,y=r.current;if(y!==n){const x=c.current,w=Ml(p);n?f("MOUNT"):w==="none"||p?.display==="none"?f("UNMOUNT"):f(y&&x!==w?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,f]),Dt(()=>{if(e){let p;const y=e.ownerDocument.defaultView??window,b=w=>{const _=Ml(a.current).includes(CSS.escape(w.animationName));if(w.target===e&&_&&(f("ANIMATION_END"),!r.current)){const C=e.style.animationFillMode;e.style.animationFillMode="forwards",p=y.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=C)})}},x=w=>{w.target===e&&(c.current=Ml(a.current))};return e.addEventListener("animationstart",x),e.addEventListener("animationcancel",b),e.addEventListener("animationend",b),()=>{y.clearTimeout(p),e.removeEventListener("animationstart",x),e.removeEventListener("animationcancel",b),e.removeEventListener("animationend",b)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:m.useCallback(p=>{a.current=p?getComputedStyle(p):null,i(p)},[])}}function Ml(n){return n?.animationName||"none"}function $1(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning;return i?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}var W1=Gf[" useInsertionEffect ".trim().toString()]||Dt;function _n({prop:n,defaultProp:e,onChange:i=()=>{},caller:a}){const[r,c,d]=q1({defaultProp:e,onChange:i}),h=n!==void 0,f=h?n:r;{const y=m.useRef(n!==void 0);m.useEffect(()=>{const b=y.current;b!==h&&console.warn(`${a} is changing from ${b?"controlled":"uncontrolled"} to ${h?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=h},[h,a])}const p=m.useCallback(y=>{if(h){const b=Y1(y)?y(n):y;b!==n&&d.current?.(b)}else c(y)},[h,n,c,d]);return[f,p]}function q1({defaultProp:n,onChange:e}){const[i,a]=m.useState(n),r=m.useRef(i),c=m.useRef(e);return W1(()=>{c.current=e},[e]),m.useEffect(()=>{r.current!==i&&(c.current?.(i),r.current=i)},[i,r]),[i,a,c]}function Y1(n){return typeof n=="function"}var Yw=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),X1="VisuallyHidden",Xw=m.forwardRef((n,e)=>l.jsx(je.span,{...n,ref:e,style:{...Yw,...n.style}}));Xw.displayName=X1;var Q1=Xw,[Rc]=cn("Tooltip",[Wa]),Oc=Wa(),Qw="TooltipProvider",Z1=700,lf="tooltip.open",[K1,em]=Rc(Qw),Zw=n=>{const{__scopeTooltip:e,delayDuration:i=Z1,skipDelayDuration:a=300,disableHoverableContent:r=!1,children:c}=n,d=m.useRef(!0),h=m.useRef(!1),f=m.useRef(0);return m.useEffect(()=>{const p=f.current;return()=>window.clearTimeout(p)},[]),l.jsx(K1,{scope:e,isOpenDelayedRef:d,delayDuration:i,onOpen:m.useCallback(()=>{window.clearTimeout(f.current),d.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>d.current=!0,a)},[a]),isPointerInTransitRef:h,onPointerInTransitChange:m.useCallback(p=>{h.current=p},[]),disableHoverableContent:r,children:c})};Zw.displayName=Qw;var Zo="Tooltip",[J1,lr]=Rc(Zo),Kw=n=>{const{__scopeTooltip:e,children:i,open:a,defaultOpen:r,onOpenChange:c,disableHoverableContent:d,delayDuration:h}=n,f=em(Zo,n.__scopeTooltip),p=Oc(e),[y,b]=m.useState(null),x=Mt(),w=m.useRef(0),E=d??f.disableHoverableContent,_=h??f.delayDuration,C=m.useRef(!1),[D,N]=_n({prop:a,defaultProp:r??!1,onChange:O=>{O?(f.onOpen(),document.dispatchEvent(new CustomEvent(lf))):f.onClose(),c?.(O)},caller:Zo}),k=m.useMemo(()=>D?C.current?"delayed-open":"instant-open":"closed",[D]),T=m.useCallback(()=>{window.clearTimeout(w.current),w.current=0,C.current=!1,N(!0)},[N]),R=m.useCallback(()=>{window.clearTimeout(w.current),w.current=0,N(!1)},[N]),z=m.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{C.current=!0,N(!0),w.current=0},_)},[_,N]);return m.useEffect(()=>()=>{w.current&&(window.clearTimeout(w.current),w.current=0)},[]),l.jsx(Zf,{...p,children:l.jsx(J1,{scope:e,contentId:x,open:D,stateAttribute:k,trigger:y,onTriggerChange:b,onTriggerEnter:m.useCallback(()=>{f.isOpenDelayedRef.current?z():T()},[f.isOpenDelayedRef,z,T]),onTriggerLeave:m.useCallback(()=>{E?R():(window.clearTimeout(w.current),w.current=0)},[R,E]),onOpen:T,onClose:R,disableHoverableContent:E,children:i})})};Kw.displayName=Zo;var cf="TooltipTrigger",Jw=m.forwardRef((n,e)=>{const{__scopeTooltip:i,...a}=n,r=lr(cf,i),c=em(cf,i),d=Oc(i),h=m.useRef(null),f=Ie(e,h,r.onTriggerChange),p=m.useRef(!1),y=m.useRef(!1),b=m.useCallback(()=>p.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",b),[b]),l.jsx(kc,{asChild:!0,...d,children:l.jsx(je.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:f,onPointerMove:we(n.onPointerMove,x=>{x.pointerType!=="touch"&&!y.current&&!c.isPointerInTransitRef.current&&(r.onTriggerEnter(),y.current=!0)}),onPointerLeave:we(n.onPointerLeave,()=>{r.onTriggerLeave(),y.current=!1}),onPointerDown:we(n.onPointerDown,()=>{r.open&&r.onClose(),p.current=!0,document.addEventListener("pointerup",b,{once:!0})}),onFocus:we(n.onFocus,()=>{p.current||r.onOpen()}),onBlur:we(n.onBlur,r.onClose),onClick:we(n.onClick,r.onClose)})})});Jw.displayName=cf;var tm="TooltipPortal",[eT,tT]=Rc(tm,{forceMount:void 0}),e0=n=>{const{__scopeTooltip:e,forceMount:i,children:a,container:r}=n,c=lr(tm,e);return l.jsx(eT,{scope:e,forceMount:i,children:l.jsx(qt,{present:i||c.open,children:l.jsx(rr,{asChild:!0,container:r,children:a})})})};e0.displayName=tm;var Ia="TooltipContent",t0=m.forwardRef((n,e)=>{const i=tT(Ia,n.__scopeTooltip),{forceMount:a=i.forceMount,side:r="top",...c}=n,d=lr(Ia,n.__scopeTooltip);return l.jsx(qt,{present:a||d.open,children:d.disableHoverableContent?l.jsx(n0,{side:r,...c,ref:e}):l.jsx(nT,{side:r,...c,ref:e})})}),nT=m.forwardRef((n,e)=>{const i=lr(Ia,n.__scopeTooltip),a=em(Ia,n.__scopeTooltip),r=m.useRef(null),c=Ie(e,r),[d,h]=m.useState(null),{trigger:f,onClose:p}=i,y=r.current,{onPointerInTransitChange:b}=a,x=m.useCallback(()=>{h(null),b(!1)},[b]),w=m.useCallback((E,_)=>{const C=E.currentTarget,D={x:E.clientX,y:E.clientY},N=rT(D,C.getBoundingClientRect()),k=lT(D,N),T=cT(_.getBoundingClientRect()),R=dT([...k,...T]);h(R),b(!0)},[b]);return m.useEffect(()=>()=>x(),[x]),m.useEffect(()=>{if(f&&y){const E=C=>w(C,y),_=C=>w(C,f);return f.addEventListener("pointerleave",E),y.addEventListener("pointerleave",_),()=>{f.removeEventListener("pointerleave",E),y.removeEventListener("pointerleave",_)}}},[f,y,w,x]),m.useEffect(()=>{if(d){const E=_=>{const C=_.target,D={x:_.clientX,y:_.clientY},N=f?.contains(C)||y?.contains(C),k=!uT(D,d);N?x():k&&(x(),p())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[f,y,d,p,x]),l.jsx(n0,{...n,ref:c})}),[iT,sT]=Rc(Zo,{isInside:!1}),aT=_w("TooltipContent"),n0=m.forwardRef((n,e)=>{const{__scopeTooltip:i,children:a,"aria-label":r,onEscapeKeyDown:c,onPointerDownOutside:d,...h}=n,f=lr(Ia,i),p=Oc(i),{onClose:y}=f;return m.useEffect(()=>(document.addEventListener(lf,y),()=>document.removeEventListener(lf,y)),[y]),m.useEffect(()=>{if(f.trigger){const b=x=>{x.target?.contains(f.trigger)&&y()};return window.addEventListener("scroll",b,{capture:!0}),()=>window.removeEventListener("scroll",b,{capture:!0})}},[f.trigger,y]),l.jsx(ar,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:b=>b.preventDefault(),onDismiss:y,children:l.jsxs(Kf,{"data-state":f.stateAttribute,...p,...h,ref:e,style:{...h.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(aT,{children:a}),l.jsx(iT,{scope:i,isInside:!0,children:l.jsx(Q1,{id:f.contentId,role:"tooltip",children:r||a})})]})})});t0.displayName=Ia;var i0="TooltipArrow",oT=m.forwardRef((n,e)=>{const{__scopeTooltip:i,...a}=n,r=Oc(i);return sT(i0,i).isInside?null:l.jsx(Jf,{...r,...a,ref:e})});oT.displayName=i0;function rT(n,e){const i=Math.abs(e.top-n.y),a=Math.abs(e.bottom-n.y),r=Math.abs(e.right-n.x),c=Math.abs(e.left-n.x);switch(Math.min(i,a,r,c)){case c:return"left";case r:return"right";case i:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function lT(n,e,i=5){const a=[];switch(e){case"top":a.push({x:n.x-i,y:n.y+i},{x:n.x+i,y:n.y+i});break;case"bottom":a.push({x:n.x-i,y:n.y-i},{x:n.x+i,y:n.y-i});break;case"left":a.push({x:n.x+i,y:n.y-i},{x:n.x+i,y:n.y+i});break;case"right":a.push({x:n.x-i,y:n.y-i},{x:n.x-i,y:n.y+i});break}return a}function cT(n){const{top:e,right:i,bottom:a,left:r}=n;return[{x:r,y:e},{x:i,y:e},{x:i,y:a},{x:r,y:a}]}function uT(n,e){const{x:i,y:a}=n;let r=!1;for(let c=0,d=e.length-1;c<e.length;d=c++){const h=e[c],f=e[d],p=h.x,y=h.y,b=f.x,x=f.y;y>a!=x>a&&i<(b-p)*(a-y)/(x-y)+p&&(r=!r)}return r}function dT(n){const e=n.slice();return e.sort((i,a)=>i.x<a.x?-1:i.x>a.x?1:i.y<a.y?-1:i.y>a.y?1:0),hT(e)}function hT(n){if(n.length<=1)return n.slice();const e=[];for(let a=0;a<n.length;a++){const r=n[a];for(;e.length>=2;){const c=e[e.length-1],d=e[e.length-2];if((c.x-d.x)*(r.y-d.y)>=(c.y-d.y)*(r.x-d.x))e.pop();else break}e.push(r)}e.pop();const i=[];for(let a=n.length-1;a>=0;a--){const r=n[a];for(;i.length>=2;){const c=i[i.length-1],d=i[i.length-2];if((c.x-d.x)*(r.y-d.y)>=(c.y-d.y)*(r.x-d.x))i.pop();else break}i.push(r)}return i.pop(),e.length===1&&i.length===1&&e[0].x===i[0].x&&e[0].y===i[0].y?e:e.concat(i)}var fT=Zw,mT=Kw,pT=Jw,gT=e0,s0=t0;const St=fT,Re=mT,Oe=pT,Te=m.forwardRef(({className:n,sideOffset:e=4,...i},a)=>l.jsx(gT,{children:l.jsx(s0,{ref:a,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",n),...i})}));Te.displayName=s0.displayName;class a0{}class Ki extends a0{constructor(e,i,a){super(),this.viewId=e,this.groupId=i,this.panelId=a}}class Xo extends a0{constructor(e,i){super(),this.viewId=e,this.paneId=i}}class Zn{constructor(){}static getInstance(){return Zn.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,i){i&&(this.data=e,this.proto=i)}}Zn.INSTANCE=new Zn;function zt(){const n=Zn.getInstance();if(n.hasData(Ki.prototype))return n.getData(Ki.prototype)[0]}function $o(){const n=Zn.getInstance();if(n.hasData(Xo.prototype))return n.getData(Xo.prototype)[0]}var Rs;(function(n){n.any=(...e)=>i=>{const a=e.map(r=>r(i));return{dispose:()=>{a.forEach(r=>{r.dispose()})}}}})(Rs||(Rs={}));class nm{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class o0{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class vT{constructor(){this.events=new Map}get size(){return this.events.size}add(e,i){this.events.set(e,i)}delete(e){this.events.delete(e)}clear(){this.events.clear()}}class hc{static create(){var e;return new hc((e=new Error().stack)!==null&&e!==void 0?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class yT{constructor(e,i){this.callback=e,this.stacktrace=i}}class ie{static setLeakageMonitorEnabled(e){e!==ie.ENABLE_TRACKING&&ie.MEMORY_LEAK_WATCHER.clear(),ie.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var i;!((i=this.options)===null||i===void 0)&&i.replay&&this._last!==void 0&&e(this._last);const a=new yT(e,ie.ENABLE_TRACKING?hc.create():void 0);return this._listeners.push(a),{dispose:()=>{const r=this._listeners.indexOf(a);r>-1&&this._listeners.splice(r,1)}}},ie.ENABLE_TRACKING&&ie.MEMORY_LEAK_WATCHER.add(this._event,hc.create())),this._event}fire(e){var i;!((i=this.options)===null||i===void 0)&&i.replay&&(this._last=e);for(const a of this._listeners)a.callback(e)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(ie.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(const i of this._listeners)console.warn("dockview: stacktrace",(e=i.stacktrace)===null||e===void 0?void 0:e.print())}),this._listeners=[]),ie.ENABLE_TRACKING&&this._event&&ie.MEMORY_LEAK_WATCHER.delete(this._event))}}ie.ENABLE_TRACKING=!1;ie.MEMORY_LEAK_WATCHER=new vT;function Pe(n,e,i,a){return n.addEventListener(e,i,a),{dispose:()=>{n.removeEventListener(e,i,a)}}}class kb{constructor(){this._onFired=new ie,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const i=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>i&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}var yt;(function(n){n.NONE={dispose:()=>{}};function e(i){return{dispose:()=>{i()}}}n.from=e})(yt||(yt={}));class Ae{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=e}addDisposables(...e){e.forEach(i=>this._disposables.push(i))}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables=[])}}class Pt{constructor(){this._disposable=yt.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=yt.NONE)}}class bT extends Ae{constructor(e){super(),this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,zc(e,i=>{const a=i.target.scrollWidth>i.target.clientWidth,r=i.target.scrollHeight>i.target.clientHeight;this._value={hasScrollX:a,hasScrollY:r},this._onDidChange.fire(this._value)}))}}function zc(n,e){const i=new ResizeObserver(a=>{requestAnimationFrame(()=>{const r=a[0];e(r)})});return i.observe(n),{dispose:()=>{i.unobserve(n),i.disconnect()}}}const Ko=(n,...e)=>{for(const i of e)n.classList.contains(i)&&n.classList.remove(i)},Mc=(n,...e)=>{for(const i of e)n.classList.contains(i)||n.classList.add(i)},Ee=(n,e,i)=>{const a=n.classList.contains(e);i&&!a&&n.classList.add(e),!i&&a&&n.classList.remove(e)};function uf(n,e){for(;n;){if(n===e)return!0;n=n.parentNode}return!1}function r0(n){return new xT(n)}class xT extends Ae{constructor(e){super(),this._onDidFocus=new ie,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new ie,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let i=uf(document.activeElement,e),a=!1;const r=()=>{a=!1,i||(i=!0,this._onDidFocus.fire())},c=()=>{i&&(a=!0,window.setTimeout(()=>{a&&(a=!1,i=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{uf(document.activeElement,e)!==i&&(i?c():r())},this.addDisposables(Pe(e,"focus",r,!0)),this.addDisposables(Pe(e,"blur",c,!0))}refreshState(){this._refreshStateHandler()}}const l0="dv-quasiPreventDefault";function wT(n){n[l0]=!0}function Rb(n){return n[l0]}function ST(n,e){const i=Array.from(e);for(const a of i){if(a.href){const c=n.createElement("link");c.href=a.href,c.type=a.type,c.rel="stylesheet",n.head.appendChild(c)}let r=[];try{a.cssRules&&(r=Array.from(a.cssRules).map(c=>c.cssText))}catch{}for(const c of r){const d=n.createElement("style");d.appendChild(n.createTextNode(c)),n.head.appendChild(d)}}}function df(n){const{left:e,top:i,width:a,height:r}=n.getBoundingClientRect();return{left:e+window.scrollX,top:i+window.scrollY,width:a,height:r}}function CT(n){let e=n;for(;e?.parentNode;){if(e.parentNode===document)return!0;e.parentNode instanceof DocumentFragment?e=e.parentNode.host:e=e.parentNode}return!1}function _T(n,e){n.setAttribute("data-testid",e)}function ET(n){const e=[];function i(a){if(a.nodeType===Node.ELEMENT_NODE){n.includes(a.tagName)&&e.push(a),a.shadowRoot&&i(a.shadowRoot);for(const r of a.children)i(r)}}return i(document.documentElement),e}function fc(n=document){const e=ET(["IFRAME","WEBVIEW"]),i=new WeakMap;for(const a of e)i.set(a,a.style.pointerEvents),a.style.pointerEvents="none";return{release:()=>{var a;for(const r of e)r.style.pointerEvents=(a=i.get(r))!==null&&a!==void 0?a:"auto";e.splice(0,e.length)}}}function DT(n){function e(r){const c=[];for(let d=0;d<r.classList.length;d++)c.push(r.classList.item(d));return c}let i,a=n;for(;a!==null&&(i=e(a).find(r=>r.startsWith("dockview-theme-")),typeof i!="string");)a=a.parentElement;return i}class Pc{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const i of this._classNames)Ee(this.element,i,!1);this._classNames=e.split(" ").filter(i=>i.trim().length>0);for(const i of this._classNames)Ee(this.element,i,!0)}}const c0=100;function AT(n,e){const i=df(n),a=df(e);return!(i.left<a.left||i.left+i.width>a.left+a.width)}function NT(n){const e=new ie;let i=n.screenX,a=n.screenY,r;const c=()=>{if(n.closed)return;const d=n.screenX,h=n.screenY;(d!==i||h!==a)&&(clearTimeout(r),r=setTimeout(()=>{e.fire()},c0),i=d,a=h),requestAnimationFrame(c)};return c(),e}function jT(n,e){let i;return new Ae(Pe(n,"resize",()=>{clearTimeout(i),i=setTimeout(()=>{e()},c0)}))}function TT(n,e,i={buffer:10}){const a=i.buffer,r=n.getBoundingClientRect(),c=e.getBoundingClientRect();let d=0,h=0;const f=r.left-c.left,p=r.top-c.top,y=r.bottom-c.bottom,b=r.right-c.right;f<a?d=a-f:b>a&&(d=-a-b),p<a?h=a-p:y>a&&(h=-y-a),(d!==0||h!==0)&&(n.style.transform=`translate(${d}px, ${h}px)`)}function kT(n){let e=n;for(;e&&(e.style.zIndex==="auto"||e.style.zIndex==="");)e=e.parentElement;return e}function xi(n){if(n.length===0)throw new Error("Invalid tail call");return[n.slice(0,n.length-1),n[n.length-1]]}function u0(n,e){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!==e[i])return!1;return!0}function Oh(n,e){const i=n.indexOf(e);i>-1&&(n.splice(i,1),n.unshift(e))}function Pl(n,e){const i=n.indexOf(e);i>-1&&(n.splice(i,1),n.push(e))}function RT(n,e){for(let i=0;i<n.length;i++){const a=n[i];if(e(a))return i}return-1}function zh(n,e){const i=n.findIndex(a=>a===e);return i>-1?(n.splice(i,1),!0):!1}const st=(n,e,i)=>e>i?e:Math.min(i,Math.max(n,e)),im=()=>{let n=1;return{next:()=>(n++).toString()}},kn=(n,e)=>{const i=[];if(typeof e!="number"&&(e=n,n=0),n<=e)for(let a=n;a<e;a++)i.push(a);else for(let a=n;a>e;a--)i.push(a);return i};class OT{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,i,a,r){this.container=e,this.view=i,this.disposable=r,this._cachedVisibleSize=void 0,typeof a=="number"?(this._size=a,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=a.cachedVisibleSize)}setVisible(e,i){var a;e!==this.visible&&(e?(this.size=st((a=this._cachedVisibleSize)!==null&&a!==void 0?a:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof i=="number"?i:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var be;(function(n){n.HORIZONTAL="HORIZONTAL",n.VERTICAL="VERTICAL"})(be||(be={}));var xn;(function(n){n[n.MAXIMUM=0]="MAXIMUM",n[n.MINIMUM=1]="MINIMUM",n[n.DISABLED=2]="DISABLED",n[n.ENABLED=3]="ENABLED"})(xn||(xn={}));var wt;(function(n){n.Low="low",n.High="high",n.Normal="normal"})(wt||(wt={}));var Cn;(function(n){n.Distribute={type:"distribute"};function e(a){return{type:"split",index:a}}n.Split=e;function i(a){return{type:"invisible",cachedVisibleSize:a}}n.Invisible=i})(Cn||(Cn={}));class Jo{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const i=this.size;this.size=this.orthogonalSize,this.orthogonalSize=i,Ko(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==be.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,i)=>e+i.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,i)=>e+i.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,Ee(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,Ee(this.element,"dv-splitview-has-margin",e!==0)}constructor(e,i){var a,r;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new ie,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new ie,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new ie,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(c,d,h=this.viewItems.map(E=>E.size),f,p,y=Number.NEGATIVE_INFINITY,b=Number.POSITIVE_INFINITY,x,w)=>{if(c<0||c>this.viewItems.length)return 0;const E=kn(c,-1),_=kn(c+1,this.viewItems.length);if(p)for(const W of p)Oh(E,W),Oh(_,W);if(f)for(const W of f)Pl(E,W),Pl(_,W);const C=E.map(W=>this.viewItems[W]),D=E.map(W=>h[W]),N=_.map(W=>this.viewItems[W]),k=_.map(W=>h[W]),T=E.reduce((W,M)=>W+this.viewItems[M].minimumSize-h[M],0),R=E.reduce((W,M)=>W+this.viewItems[M].maximumSize-h[M],0),z=_.length===0?Number.POSITIVE_INFINITY:_.reduce((W,M)=>W+h[M]-this.viewItems[M].minimumSize,0),O=_.length===0?Number.NEGATIVE_INFINITY:_.reduce((W,M)=>W+h[M]-this.viewItems[M].maximumSize,0),A=Math.max(T,O),G=Math.min(z,R);let U=!1;if(x){const W=this.viewItems[x.index],M=d>=x.limitDelta;U=M!==W.visible,W.setVisible(M,x.size)}if(!U&&w){const W=this.viewItems[w.index],M=d<w.limitDelta;U=M!==W.visible,W.setVisible(M,w.size)}if(U)return this.resize(c,d,h,f,p,y,b);const B=st(d,A,G);let $=0,ae=B;for(let W=0;W<C.length;W++){const M=C[W],K=st(D[W]+ae,M.minimumSize,M.maximumSize),q=K-D[W];$+=q,ae-=q,M.size=K}let ne=$;for(let W=0;W<N.length;W++){const M=N[W],K=st(k[W]-ne,M.minimumSize,M.maximumSize),q=K-k[W];ne+=q,M.size=K}return d},this._orientation=(a=i.orientation)!==null&&a!==void 0?a:be.VERTICAL,this.element=this.createContainer(),this.margin=(r=i.margin)!==null&&r!==void 0?r:0,this.proportionalLayout=i.proportionalLayout===void 0?!0:!!i.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(i.styles),i.descriptor&&(this._size=i.descriptor.size,i.descriptor.views.forEach((c,d)=>{const h=c.visible===void 0||c.visible?c.size:{type:"invisible",cachedVisibleSize:c.size},f=c.view;this.addView(f,h,d,!0)}),this._contentSize=this.viewItems.reduce((c,d)=>c+d.size,0),this.saveProportions())}style(e){e?.separatorBorder==="transparent"?(Ko(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(Mc(this.element,"dv-separator-border"),e?.separatorBorder&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,i){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const a=this.viewItems[e];a.setVisible(i,a.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,i){if(e<0||e>=this.viewItems.length)return;const a=kn(this.viewItems.length).filter(h=>h!==e),r=[...a.filter(h=>this.viewItems[h].priority===wt.Low),e],c=a.filter(h=>this.viewItems[h].priority===wt.High),d=this.viewItems[e];i=Math.round(i),i=st(i,d.minimumSize,Math.min(d.maximumSize,this._size)),d.size=i,this.relayout(r,c)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,i){const a=this.viewItems.indexOf(e);if(a<0||a>=this.viewItems.length)return;i=typeof i=="number"?i:e.size,i=st(i,e.minimumSize,e.maximumSize),e.size=i;const r=kn(this.viewItems.length).filter(h=>h!==a),c=[...r.filter(h=>this.viewItems[h].priority===wt.Low),a],d=r.filter(h=>this.viewItems[h].priority===wt.High);this.relayout([...c,a],d)}addView(e,i={type:"distribute"},a=this.viewItems.length,r){const c=document.createElement("div");c.className="dv-view",c.appendChild(e.element);let d;typeof i=="number"?d=i:i.type==="split"?d=this.getViewSize(i.index)/2:i.type==="invisible"?d={cachedVisibleSize:i.cachedVisibleSize}:d=e.minimumSize;const h=e.onDidChange(p=>this.onDidChange(f,p.size)),f=new OT(c,e,d,{dispose:()=>{h.dispose(),this.viewContainer.removeChild(c)}});if(a===this.viewItems.length?this.viewContainer.appendChild(c):this.viewContainer.insertBefore(c,this.viewContainer.children.item(a)),this.viewItems.splice(a,0,f),this.viewItems.length>1){const p=document.createElement("div");p.className="dv-sash";const y=x=>{for(const W of this.viewItems)W.enabled=!1;const w=fc(),E=this._orientation===be.HORIZONTAL?x.clientX:x.clientY,_=RT(this.sashes,W=>W.container===p),C=this.viewItems.map(W=>W.size);let D,N;const k=kn(_,-1),T=kn(_+1,this.viewItems.length),R=k.reduce((W,M)=>W+(this.viewItems[M].minimumSize-C[M]),0),z=k.reduce((W,M)=>W+(this.viewItems[M].viewMaximumSize-C[M]),0),O=T.length===0?Number.POSITIVE_INFINITY:T.reduce((W,M)=>W+(C[M]-this.viewItems[M].minimumSize),0),A=T.length===0?Number.NEGATIVE_INFINITY:T.reduce((W,M)=>W+(C[M]-this.viewItems[M].viewMaximumSize),0),G=Math.max(R,A),U=Math.min(O,z),B=this.findFirstSnapIndex(k),$=this.findFirstSnapIndex(T);if(typeof B=="number"){const W=this.viewItems[B],M=Math.floor(W.viewMinimumSize/2);D={index:B,limitDelta:W.visible?G-M:G+M,size:W.size}}if(typeof $=="number"){const W=this.viewItems[$],M=Math.floor(W.viewMinimumSize/2);N={index:$,limitDelta:W.visible?U+M:U-M,size:W.size}}const ae=W=>{const K=(this._orientation===be.HORIZONTAL?W.clientX:W.clientY)-E;this.resize(_,K,C,void 0,void 0,G,U,D,N),this.distributeEmptySpace(),this.layoutViews()},ne=()=>{for(const W of this.viewItems)W.enabled=!0;w.release(),this.saveProportions(),document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",ne),document.removeEventListener("pointercancel",ne),document.removeEventListener("contextmenu",ne),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",ae),document.addEventListener("pointerup",ne),document.addEventListener("pointercancel",ne),document.addEventListener("contextmenu",ne)};p.addEventListener("pointerdown",y);const b={container:p,disposable:()=>{p.removeEventListener("pointerdown",y),this.sashContainer.removeChild(p)}};this.sashContainer.appendChild(p),this.sashes.push(b)}r||this.relayout([a]),!r&&typeof i!="number"&&i.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let i=0;for(const h of this.viewItems)h.maximumSize-h.minimumSize>0&&(e.push(h),i+=h.size);const a=Math.floor(i/e.length);for(const h of e)h.size=st(a,h.minimumSize,h.maximumSize);const r=kn(this.viewItems.length),c=r.filter(h=>this.viewItems[h].priority===wt.Low),d=r.filter(h=>this.viewItems[h].priority===wt.High);this.relayout(c,d)}removeView(e,i,a=!1){const r=this.viewItems.splice(e,1)[0];if(r.dispose(),this.viewItems.length>=1){const c=Math.max(e-1,0);this.sashes.splice(c,1)[0].disposable()}return a||this.relayout(),i&&i.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(r.view),r.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,i){const a=this.getViewCachedVisibleSize(e),r=typeof a>"u"?this.getViewSize(e):Cn.Invisible(a),c=this.removeView(e,void 0,!0);this.addView(c,r,i)}layout(e,i){const a=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=i,this.proportions){let r=0;for(let c=0;c<this.viewItems.length;c++){const d=this.viewItems[c],h=this.proportions[c];typeof h=="number"?r+=h:e-=d.size}for(let c=0;c<this.viewItems.length;c++){const d=this.viewItems[c],h=this.proportions[c];typeof h=="number"&&r>0&&(d.size=st(Math.round(h*e/r),d.minimumSize,d.maximumSize))}}else{const r=kn(this.viewItems.length),c=r.filter(h=>this.viewItems[h].priority===wt.Low),d=r.filter(h=>this.viewItems[h].priority===wt.High);this.resize(this.viewItems.length-1,e-a,void 0,c,d)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,i){const a=this.viewItems.reduce((r,c)=>r+c.size,0);this.resize(this.viewItems.length-1,this._size-a,void 0,e,i),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const i=this.viewItems.reduce((h,f)=>h+f.size,0);let a=this.size-i;const r=kn(this.viewItems.length-1,-1),c=r.filter(h=>this.viewItems[h].priority===wt.Low),d=r.filter(h=>this.viewItems[h].priority===wt.High);for(const h of d)Oh(r,h);for(const h of c)Pl(r,h);typeof e=="number"&&Pl(r,e);for(let h=0;a!==0&&h<r.length;h++){const f=this.viewItems[r[h]],p=st(f.size+a,f.minimumSize,f.maximumSize),y=p-f.size;a-=y,f.size=p}}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((f,p)=>f+p.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;const e=this.viewItems.filter(f=>f.visible),i=Math.max(0,e.length-1),a=this.margin*i/Math.max(1,e.length);let r=0;const c=[],d=4,h=this.viewItems.reduce((f,p,y)=>{const b=p.visible?1:0;return y===0?f.push(b):f.push(f[y-1]+b),f},[]);this.viewItems.forEach((f,p)=>{r+=this.viewItems[p].size,c.push(r);const y=f.visible?f.size-a:0,b=Math.max(0,h[p]-1),x=p===0||b===0?0:c[p-1]+b/i*a;if(p<this.viewItems.length-1){const w=f.visible?x+y-d/2+this.margin/2:x;this._orientation===be.HORIZONTAL&&(this.sashes[p].container.style.left=`${w}px`,this.sashes[p].container.style.top="0px"),this._orientation===be.VERTICAL&&(this.sashes[p].container.style.left="0px",this.sashes[p].container.style.top=`${w}px`)}this._orientation===be.HORIZONTAL&&(f.container.style.width=`${y}px`,f.container.style.left=`${x}px`,f.container.style.top="",f.container.style.height=""),this._orientation===be.VERTICAL&&(f.container.style.height=`${y}px`,f.container.style.top=`${x}px`,f.container.style.width="",f.container.style.left=""),f.view.layout(f.size-a,this._orthogonalSize)})}findFirstSnapIndex(e){for(const i of e){const a=this.viewItems[i];if(a.visible&&a.snap)return i}for(const i of e){const a=this.viewItems[i];if(a.visible&&a.maximumSize-a.minimumSize>0)return;if(!a.visible&&a.snap)return i}}updateSashEnablement(){let e=!1;const i=this.viewItems.map(f=>e=f.size-f.minimumSize>0||e);e=!1;const a=this.viewItems.map(f=>e=f.maximumSize-f.size>0||e),r=[...this.viewItems].reverse();e=!1;const c=r.map(f=>e=f.size-f.minimumSize>0||e).reverse();e=!1;const d=r.map(f=>e=f.maximumSize-f.size>0||e).reverse();let h=0;for(let f=0;f<this.sashes.length;f++){const p=this.sashes[f],y=this.viewItems[f];h+=y.size;const b=!(i[f]&&d[f+1]),x=!(a[f]&&c[f+1]);if(b&&x){const w=kn(f,-1),E=kn(f+1,this.viewItems.length),_=this.findFirstSnapIndex(w),C=this.findFirstSnapIndex(E),D=typeof _=="number"&&!this.viewItems[_].visible,N=typeof C=="number"&&!this.viewItems[C].visible;D&&c[f]&&(h>0||this.startSnappingEnabled)?this.updateSash(p,xn.MINIMUM):N&&i[f]&&(h<this._contentSize||this.endSnappingEnabled)?this.updateSash(p,xn.MAXIMUM):this.updateSash(p,xn.DISABLED)}else b&&!x?this.updateSash(p,xn.MINIMUM):!b&&x?this.updateSash(p,xn.MAXIMUM):this.updateSash(p,xn.ENABLED)}}updateSash(e,i){Ee(e.container,"dv-disabled",i===xn.DISABLED),Ee(e.container,"dv-enabled",i===xn.ENABLED),Ee(e.container,"dv-maximum",i===xn.MAXIMUM),Ee(e.container,"dv-minimum",i===xn.MINIMUM)}createViewContainer(){const e=document.createElement("div");return e.className="dv-view-container",e}createSashContainer(){const e=document.createElement("div");return e.className="dv-sash-container",e}createContainer(){const e=document.createElement("div"),i=this._orientation===be.HORIZONTAL?"dv-horizontal":"dv-vertical";return e.className=`dv-split-view-container ${i}`,e}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.removeChild(this.element);break}for(const e of this.viewItems)e.dispose();this.element.remove()}}const hf=Object.keys({orientation:void 0,descriptor:void 0,proportionalLayout:void 0,styles:void 0,margin:void 0,disableAutoResizing:void 0,className:void 0});class Ob extends Ae{get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}constructor(e,i){var a;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._orientation=(a=i.orientation)!==null&&a!==void 0?a:be.VERTICAL,this.element=document.createElement("div"),this.element.className="dv-pane-container",e.appendChild(this.element),this.splitview=new Jo(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:i.descriptor}),this.getPanes().forEach(r=>{const c=new Ae(r.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),d={pane:r,disposable:{dispose:()=>{c.dispose()}}};this.paneItems.push(d),r.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,i){this.splitview.setViewVisible(e,i)}addPane(e,i,a=this.splitview.length,r=!1){const c=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),d={pane:e,disposable:{dispose:()=>{c.dispose()}}};this.paneItems.splice(a,0,d),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,i,a,r)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,i={skipDispose:!1}){const a=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),i.skipDispose||(a.disposable.dispose(),a.pane.dispose()),a}moveView(e,i){if(e===i)return;const a=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(a.pane,a.pane.size,i,!1)}finally{this.skipAnimation=!1}}layout(e,i){this.splitview.layout(e,i)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),Mc(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,Ko(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class Et{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===be.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===be.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===be.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===be.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===be.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===be.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,i,a,r=0){this.view=e,this.orientation=i,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._orthogonalSize=a,this._size=r,this._disposable=this.view.onDidChange(c=>{c?this._onDidChange.fire({size:this.orientation===be.VERTICAL?c.width:c.height,orthogonalSize:this.orientation===be.VERTICAL?c.height:c.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,i){this._size=e,this._orthogonalSize=i,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class ut extends Ae{get width(){return this.orientation===be.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===be.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,i)=>this.splitview.isViewVisible(i)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,i)=>this.splitview.isViewVisible(i)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===be.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===be.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===be.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===be.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return wt.Normal;const e=this.children.map(i=>typeof i.priority>"u"?wt.Normal:i.priority);return e.some(i=>i===wt.High)?wt.High:e.some(i=>i===wt.Low)?wt.Low:wt.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach(i=>{i instanceof ut&&(i.margin=e)})}constructor(e,i,a,r,c,d,h,f){if(super(),this.orientation=e,this.proportionalLayout=i,this.styles=a,this._childrenDisposable=yt.NONE,this.children=[],this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new ie,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=c,this._size=r,this.element=document.createElement("div"),this.element.className="dv-branch-node",!f)this.splitview=new Jo(this.element,{orientation:this.orientation,proportionalLayout:i,styles:a,margin:h}),this.splitview.layout(this.size,this.orthogonalSize);else{const p={views:f.map(y=>({view:y.node,size:y.node.size,visible:y.node instanceof Et&&y.visible!==void 0?y.visible:!0})),size:this.orthogonalSize};this.children=f.map(y=>y.node),this.splitview=new Jo(this.element,{orientation:this.orientation,descriptor:p,proportionalLayout:i,styles:a,margin:h})}this.disabled=d,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,i){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===i)return;const a=this.splitview.contentSize===0;this.splitview.setViewVisible(e,i);const r=this.splitview.contentSize===0;(i&&a||!i&&r)&&this._onDidVisibilityChange.fire({visible:i})}moveChild(e,i){if(e===i)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e<i&&i--,this.splitview.moveView(e,i);const a=this._removeChild(e);this._addChild(a,i)}getChildSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,i){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,i)}layout(e,i){this._size=i,this._orthogonalSize=e,this.splitview.layout(i,e)}addChild(e,i,a,r){if(a<0||a>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,i,a,r),this._addChild(e,a)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,i){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,i),this._removeChild(e)}_addChild(e,i){this.children.splice(i,0,e),this.setupChildrenEvents()}_removeChild(e){const[i]=this.children.splice(e,1);return this.setupChildrenEvents(),i}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new Ae(Rs.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((e,i)=>e instanceof ut?e.onDidVisibilityChange(({visible:a})=>{this.setChildVisible(i,a)}):yt.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}}function ff(n,e){if(n instanceof Et)return n;if(n instanceof ut)return ff(n.children[e?n.children.length-1:0],e);throw new Error("invalid node")}function d0(n,e,i){if(n instanceof ut){const a=new ut(n.orientation,n.proportionalLayout,n.styles,e,i,n.disabled,n.margin);for(let r=n.children.length-1;r>=0;r--){const c=n.children[r];a.addChild(d0(c,c.size,c.orthogonalSize),c.size,0,!0)}return a}else return new Et(n.view,n.orientation,i)}function mf(n,e,i){if(n instanceof ut){const a=new ut(Wn(n.orientation),n.proportionalLayout,n.styles,e,i,n.disabled,n.margin);let r=0;for(let c=n.children.length-1;c>=0;c--){const d=n.children[c],h=d instanceof ut?d.orthogonalSize:d.size;let f=n.size===0?0:Math.round(e*h/n.size);r+=f,c===0&&(f+=e-r),a.addChild(mf(d,i,f),f,0,!0)}return a}else return new Et(n.view,Wn(n.orientation),i)}function zT(n){const e=n.parentElement;if(!e)throw new Error("Invalid grid element");let i=e.firstElementChild,a=0;for(;i!==n&&i!==e.lastElementChild&&i;)i=i.nextElementSibling,a++;return a}function ot(n){const e=n.parentElement;if(!e)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(e.className))return[];const i=zT(e),a=e.parentElement.parentElement.parentElement;return[...ot(a),i]}function $n(n,e,i){const a=PT(n,e),r=MT(i);if(a===r){const[c,d]=xi(e);let h=d;return(i==="right"||i==="bottom")&&(h+=1),[...c,h]}else{const c=i==="right"||i==="bottom"?1:0;return[...e,c]}}function MT(n){return n==="top"||n==="bottom"?be.VERTICAL:be.HORIZONTAL}function PT(n,e){return e.length%2===0?Wn(n):n}const Wn=n=>n===be.HORIZONTAL?be.VERTICAL:be.HORIZONTAL;function LT(n){return!!n.children}const pf=(n,e)=>{const i=e===be.VERTICAL?n.box.width:n.box.height;return LT(n)?{type:"branch",data:n.children.map(a=>pf(a,Wn(e))),size:i}:typeof n.cachedVisibleSize=="number"?{type:"leaf",data:n.view.toJSON(),size:n.cachedVisibleSize,visible:!1}:{type:"leaf",data:n.view.toJSON(),size:i}};class IT{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:i,orthogonalSize:a}=this.root;this.root=mf(this.root,a,i),this.root.layout(i,a)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const i=[this.root];for(;i.length>0;){const a=i.pop();a instanceof ut&&(a.disabled=e,i.push(...a.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)===null||e===void 0?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var i;const a=ot(e.element),[r,c]=this.getNode(a);if(!(c instanceof Et)||((i=this._maximizedNode)===null||i===void 0?void 0:i.leaf)===c)return;this.hasMaximizedView()&&this.exitMaximizedView(),pf(this.getView(),this.orientation);const d=[];function h(f,p){for(let y=0;y<f.children.length;y++){const b=f.children[y];b instanceof Et?b!==p&&(f.isChildVisible(y)?f.setChildVisible(y,!1):d.push(b)):h(b,p)}}h(this.root,c),this._maximizedNode={leaf:c,hiddenOnMaximize:d},this._onDidMaximizedNodeChange.fire({view:c.view,isMaximized:!0})}exitMaximizedView(){if(!this._maximizedNode)return;const e=this._maximizedNode.hiddenOnMaximize;function i(r){for(let c=r.children.length-1;c>=0;c--){const d=r.children[c];d instanceof Et?e.includes(d)||r.setChildVisible(c,!0):i(d)}}i(this.root);const a=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:a.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let i;e&&(i=ot(e.element)),this.hasMaximizedView()&&this.exitMaximizedView();const r={root:pf(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return i&&(r.maximizedNode={location:i}),e&&this.maximizeView(e),r}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new ut(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,i){const a=e.orientation,r=a===be.VERTICAL?e.height:e.width;if(this._deserialize(e.root,a,i,r),this.layout(e.width,e.height),e.maximizedNode){const c=e.maximizedNode.location,[d,h]=this.getNode(c);if(!(h instanceof Et))return;this.maximizeView(h.view)}}_deserialize(e,i,a,r){this.root=this._deserializeNode(e,i,a,r)}_deserializeNode(e,i,a,r){var c;let d;if(e.type==="branch"){const f=e.data.map(p=>({node:this._deserializeNode(p,Wn(i),a,e.size),visible:p.visible}));d=new ut(i,this.proportionalLayout,this.styles,e.size,r,this.locked,this.margin,f)}else{const h=a.fromJSON(e);typeof e.visible=="boolean"&&((c=h.setVisible)===null||c===void 0||c.call(h,e.visible)),d=new Et(h,i,r,e.size)}return d}get root(){return this._root}set root(e){const i=this._root;i&&(i.dispose(),this._maximizedNode=void 0,this.element.removeChild(i.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(a=>{this._onDidChange.fire(a)})}normalize(){if(!this._root||this._root.children.length!==1)return;const e=this.root,i=e.children[0];if(i instanceof Et)return;e.element.remove();const a=e.removeChild(0);e.dispose(),a.dispose(),this._root=d0(i,i.size,i.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(r=>{this._onDidChange.fire(r)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new ut(Wn(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){const i=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(mf(i,i.orthogonalSize,i.size),Cn.Distribute,0)}else this._root.addChild(e,Cn.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(i=>{this._onDidChange.fire(i)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const i=e?this.getNode(e)[1]:this.root;return this._getViews(i,this.orientation)}_getViews(e,i,a){const r={height:e.height,width:e.width};if(e instanceof Et)return{box:r,view:e.view,cachedVisibleSize:a};const c=[];for(let d=0;d<e.children.length;d++){const h=e.children[d],f=e.getChildCachedVisibleSize(d);c.push(this._getViews(h,Wn(i),f))}return{box:r,children:c}}progmaticSelect(e,i=!1){const[a,r]=this.getNode(e);if(!(r instanceof Et))throw new Error("invalid location");for(let c=a.length-1;c>-1;c--){const d=a[c],h=e[c]||0;if(i?h-1>-1:h+1<d.children.length)return ff(d.children[i?h-1:h+1],i)}return ff(this.root,i)}constructor(e,i,a,r,c){this.proportionalLayout=e,this.styles=i,this._locked=!1,this._margin=0,this._maximizedNode=void 0,this.disposable=new Pt,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onDidViewVisibilityChange=new ie,this.onDidViewVisibilityChange=this._onDidViewVisibilityChange.event,this._onDidMaximizedNodeChange=new ie,this.onDidMaximizedNodeChange=this._onDidMaximizedNodeChange.event,this.element=document.createElement("div"),this.element.className="dv-grid-view",this._locked=r??!1,this._margin=c??0,this.root=new ut(a,e,i,0,0,this.locked,this.margin)}isViewVisible(e){const[i,a]=xi(e),[,r]=this.getNode(i);if(!(r instanceof ut))throw new Error("Invalid from location");return r.isChildVisible(a)}setViewVisible(e,i){this.hasMaximizedView()&&this.exitMaximizedView();const[a,r]=xi(e),[,c]=this.getNode(a);if(!(c instanceof ut))throw new Error("Invalid from location");this._onDidViewVisibilityChange.fire(),c.setChildVisible(r,i)}moveView(e,i,a){this.hasMaximizedView()&&this.exitMaximizedView();const[,r]=this.getNode(e);if(!(r instanceof ut))throw new Error("Invalid location");r.moveChild(i,a)}addView(e,i,a){this.hasMaximizedView()&&this.exitMaximizedView();const[r,c]=xi(a),[d,h]=this.getNode(r);if(h instanceof ut){const f=new Et(e,Wn(h.orientation),h.orthogonalSize);h.addChild(f,i,c)}else{const[f,...p]=[...d].reverse(),[y,...b]=[...r].reverse();let x=0;const w=f.getChildCachedVisibleSize(y);typeof w=="number"&&(x=Cn.Invisible(w)),f.removeChild(y).dispose();const _=new ut(h.orientation,this.proportionalLayout,this.styles,h.size,h.orthogonalSize,this.locked,this.margin);f.addChild(_,h.size,y);const C=new Et(h.view,f.orientation,h.size);_.addChild(C,x,0),typeof i!="number"&&i.type==="split"&&(i={type:"split",index:0});const D=new Et(e,f.orientation,h.size);_.addChild(D,i,c)}}remove(e,i){const a=ot(e.element);return this.removeView(a,i)}removeView(e,i){this.hasMaximizedView()&&this.exitMaximizedView();const[a,r]=xi(e),[c,d]=this.getNode(a);if(!(d instanceof ut))throw new Error("Invalid location");const h=d.children[r];if(!(h instanceof Et))throw new Error("Invalid location");if(d.removeChild(r,i),h.dispose(),d.children.length!==1)return h.view;const f=d.children[0];if(c.length===0)return f instanceof Et||(d.removeChild(0,i),this.root=f),h.view;const[p,...y]=[...c].reverse(),[b,...x]=[...a].reverse(),w=d.isChildVisible(0);d.removeChild(0,i);const E=p.children.map((_,C)=>p.getChildSize(C));if(p.removeChild(b,i).dispose(),f instanceof ut){E.splice(b,1,...f.children.map(_=>_.size));for(let _=0;_<f.children.length;_++){const C=f.children[_];p.addChild(C,C.size,b+_)}for(;f.children.length>0;)f.removeChild(0)}else{const _=new Et(f.view,Wn(f.orientation),f.size),C=w?f.orthogonalSize:Cn.Invisible(f.orthogonalSize);p.addChild(_,C,b)}f.dispose();for(let _=0;_<E.length;_++)p.resizeChild(_,E[_]);return h.view}layout(e,i){const[a,r]=this.root.orientation===be.HORIZONTAL?[i,e]:[e,i];this.root.layout(a,r)}getNode(e,i=this.root,a=[]){if(e.length===0)return[a,i];if(!(i instanceof ut))throw new Error("Invalid location");const[r,...c]=e;if(r<0||r>=i.children.length)throw new Error("Invalid location");const d=i.children[r];return a.push(i),this.getNode(c,d,a)}}const gf=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});class sm extends Ae{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,i=!1){super(),this._disableResizing=i,this._element=e,this.addDisposables(zc(this._element,a=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!CT(this._element))return;const{width:r,height:c}=a.contentRect;this.layout(r,c)}))}}const GT=im();function mc(n){switch(n){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";default:return"center"}}class h0 extends sm{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,i){var a;super(document.createElement("div"),i.disableAutoResizing),this._id=GT.next(),this._groups=new Map,this._onDidRemove=new ie,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new ie,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new ie,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new ie,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new kb,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new kb,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new Pc(this.element),this._classNames.setClassNames((a=i.className)!==null&&a!==void 0?a:""),e.appendChild(this.element),this.gridview=new IT(!!i.proportionalLayout,i.styles,i.orientation,i.locked,i.margin),this.gridview.locked=!!i.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(r=>{this._onDidMaximizedChange.fire({panel:r.view,isMaximized:r.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.layout(this.width,this.height,!0)}),yt.from(()=>{var r;(r=this.element.parentElement)===null||r===void 0||r.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),Rs.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,i){this.gridview.setViewVisible(ot(e.element),i),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(ot(e.element))}updateOptions(e){var i,a,r,c;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=(i=e.disableAutoResizing)!==null&&i!==void 0?i:!1),"locked"in e&&(this.locked=(a=e.locked)!==null&&a!==void 0?a:!1),"margin"in e&&(this.gridview.margin=(r=e.margin)!==null&&r!==void 0?r:0),"className"in e&&this._classNames.setClassNames((c=e.className)!==null&&c!==void 0?c:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,i=[0],a){this.gridview.addView(e,a??Cn.Distribute,i),this._onDidAdd.fire(e)}doRemoveGroup(e,i){if(!this._groups.has(e.id))throw new Error("invalid operation");const a=this._groups.get(e.id),r=this.gridview.remove(e,Cn.Distribute);if(a&&!i?.skipDispose&&(a.disposable.dispose(),a.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!i?.skipActive&&this._activeGroup===e){const c=Array.from(this._groups.values());this.doSetGroupActive(c.length>0?c[0].value:void 0)}return r}getPanel(e){var i;return(i=this._groups.get(e))===null||i===void 0?void 0:i.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var i;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const a=ot(e.group.element),r=(i=this.gridview.next(a))===null||i===void 0?void 0:i.view;this.doSetGroupActive(r)}moveToPrevious(e){var i;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const a=ot(e.group.element),r=(i=this.gridview.previous(a))===null||i===void 0?void 0:i.view;this.doSetGroupActive(r)}layout(e,i,a){(a||e!==this.width||i!==this.height)&&(this.gridview.element.style.height=`${i}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,i))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class f0{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,i){this.component.removePanel(e,i)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,i){return this.component.layout(e,i)}addPanel(e){return this.component.addPanel(e)}movePanel(e,i){this.component.movePanel(e,i)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class er{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,i){this.component.movePanel(e,i)}focus(){this.component.focus()}layout(e,i){this.component.layout(e,i)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class m0{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,i,a=!1){this.component.layout(e,i,a)}addPanel(e){return this.component.addPanel(e)}removePanel(e,i){this.component.removePanel(e,i)}movePanel(e,i){this.component.movePanel(e,i)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class pc{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,i,a=!1){this.component.layout(e,i,a)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,i){return this.component.addFloatingGroup(e,i)}fromJSON(e,i){this.component.fromJSON(e,i)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,i){return this.component.addPopoutGroup(e,i)}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class am extends Ae{constructor(e,i){super(),this.el=e,this.disabled=i,this.dataDisposable=new Pt,this.pointerEventsDisposable=new Pt,this._onDragStart=new ie,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(e){this.disabled=e}isCancelled(e){return!1}configure(){this.addDisposables(this._onDragStart,Pe(this.el,"dragstart",e=>{if(e.defaultPrevented||this.isCancelled(e)||this.disabled){e.preventDefault();return}const i=fc();this.pointerEventsDisposable.value={dispose:()=>{i.release()}},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this.dataDisposable.value=this.getData(e),this._onDragStart.fire(e),e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.items.length>0||e.dataTransfer.setData("text/plain",""))}),Pe(this.el,"dragend",()=>{this.pointerEventsDisposable.dispose(),setTimeout(()=>{this.dataDisposable.dispose()},0)}))}}class p0 extends Ae{constructor(e,i){super(),this.element=e,this.callbacks=i,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(Pe(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(Pe(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(Pe(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(Pe(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(Pe(this.element,"drop",e=>{this.onDrop(e)}))}}function BT(n,e){const{top:i,left:a,width:r,height:c}=e,d=`${Math.round(i)}px`,h=`${Math.round(a)}px`,f=`${Math.round(r)}px`,p=`${Math.round(c)}px`;n.style.top=d,n.style.left=h,n.style.width=f,n.style.height=p,n.style.visibility="visible",(!n.style.transform||n.style.transform==="")&&(n.style.transform="translate3d(0, 0, 0)")}function HT(n,e){const{top:i,left:a,width:r,height:c}=e;n.style.top=i,n.style.left=a,n.style.width=r,n.style.height=c,n.style.visibility="visible",(!n.style.transform||n.style.transform==="")&&(n.style.transform="translate3d(0, 0, 0)")}function VT(n,e){const{top:i,left:a,width:r,height:c}=e,d=`${Math.round(i)}px`,h=`${Math.round(a)}px`,f=`${Math.round(r)}px`,p=`${Math.round(c)}px`;return n.style.top!==d||n.style.left!==h||n.style.width!==f||n.style.height!==p}class FT extends nm{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function zb(n){switch(n){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${n}'`)}}function UT(n){switch(n){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${n}'`)}}const $T={value:20,type:"percentage"},WT={value:50,type:"percentage"},qT=100,YT=100;class zn extends Ae{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,i){super(),this.element=e,this.options=i,this._onDrop=new ie,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new p0(this.element,{onDragEnter:()=>{var a,r,c;(c=(r=(a=this.options).getOverrideTarget)===null||r===void 0?void 0:r.call(a))===null||c===void 0||c.getElements()},onDragOver:a=>{var r,c,d,h,f,p,y;zn.ACTUAL_TARGET=this;const b=(c=(r=this.options).getOverrideTarget)===null||c===void 0?void 0:c.call(r);if(this._acceptedTargetZonesSet.size===0){if(b)return;this.removeDropTarget();return}const x=(f=(h=(d=this.options).getOverlayOutline)===null||h===void 0?void 0:h.call(d))!==null&&f!==void 0?f:this.element,w=x.offsetWidth,E=x.offsetHeight;if(w===0||E===0)return;const _=a.currentTarget.getBoundingClientRect(),C=((p=a.clientX)!==null&&p!==void 0?p:0)-_.left,D=((y=a.clientY)!==null&&y!==void 0?y:0)-_.top,N=this.calculateQuadrant(this._acceptedTargetZonesSet,C,D,w,E);if(this.isAlreadyUsed(a)||N===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(a,N)){if(b)return;this.removeDropTarget();return}const k=new FT({nativeEvent:a,position:N});if(this._onWillShowOverlay.fire(k),k.defaultPrevented){this.removeDropTarget();return}this.markAsUsed(a),b||this.targetElement||(this.targetElement=document.createElement("div"),this.targetElement.className="dv-drop-target-dropzone",this.overlayElement=document.createElement("div"),this.overlayElement.className="dv-drop-target-selection",this._state="center",this.targetElement.appendChild(this.overlayElement),x.classList.add("dv-drop-target"),x.append(this.targetElement)),this.toggleClasses(N,w,E),this._state=N},onDragLeave:()=>{var a,r;!((r=(a=this.options).getOverrideTarget)===null||r===void 0)&&r.call(a)||this.removeDropTarget()},onDragEnd:a=>{var r,c;const d=(c=(r=this.options).getOverrideTarget)===null||c===void 0?void 0:c.call(r);d&&zn.ACTUAL_TARGET===this&&this._state&&(a.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:a})),this.removeDropTarget(),d?.clear()},onDrop:a=>{var r,c,d;a.preventDefault();const h=this._state;this.removeDropTarget(),(d=(c=(r=this.options).getOverrideTarget)===null||c===void 0?void 0:c.call(r))===null||d===void 0||d.clear(),h&&(a.stopPropagation(),this._onDrop.fire({position:h,nativeEvent:a}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[zn.USED_EVENT_ID]=!0}isAlreadyUsed(e){const i=e[zn.USED_EVENT_ID];return typeof i=="boolean"&&i}toggleClasses(e,i,a){var r,c,d,h,f,p,y;const b=(c=(r=this.options).getOverrideTarget)===null||c===void 0?void 0:c.call(r);if(!b&&!this.overlayElement)return;const x=i<qT,w=a<YT,E=e==="left",_=e==="right",C=e==="top",D=e==="bottom",N=!x&&_,k=!x&&E,T=!w&&C,R=!w&&D;let z=1;const O=(h=(d=this.options.overlayModel)===null||d===void 0?void 0:d.size)!==null&&h!==void 0?h:WT;if(O.type==="percentage"?z=st(O.value,0,100)/100:((N||k)&&(z=st(0,O.value,i)/i),(T||R)&&(z=st(0,O.value,a)/a)),b){const G=(y=(p=(f=this.options).getOverlayOutline)===null||p===void 0?void 0:p.call(f))!==null&&y!==void 0?y:this.element,U=G.getBoundingClientRect(),B=b.getElements(void 0,G),$=B.root,ae=B.overlay,ne=$.getBoundingClientRect(),W=U.top-ne.top,M=U.left-ne.left,K={top:W,left:M,width:i,height:a};if(N?(K.left=M+i*(1-z),K.width=i*z):k?K.width=i*z:T?K.height=a*z:R&&(K.top=W+a*(1-z),K.height=a*z),x&&E&&(K.width=4),x&&_&&(K.left=M+i-4,K.width=4),!VT(ae,K))return;BT(ae,K),ae.className=`dv-drop-target-anchor${this.options.className?` ${this.options.className}`:""}`,Ee(ae,"dv-drop-target-left",E),Ee(ae,"dv-drop-target-right",_),Ee(ae,"dv-drop-target-top",C),Ee(ae,"dv-drop-target-bottom",D),Ee(ae,"dv-drop-target-center",e==="center"),B.changed&&(Ee(ae,"dv-drop-target-anchor-container-changed",!0),setTimeout(()=>{Ee(ae,"dv-drop-target-anchor-container-changed",!1)},10));return}if(!this.overlayElement)return;const A={top:"0px",left:"0px",width:"100%",height:"100%"};N?(A.left=`${100*(1-z)}%`,A.width=`${100*z}%`):k?A.width=`${100*z}%`:T?A.height=`${100*z}%`:R&&(A.top=`${100*(1-z)}%`,A.height=`${100*z}%`),HT(this.overlayElement,A),Ee(this.overlayElement,"dv-drop-target-small-vertical",w),Ee(this.overlayElement,"dv-drop-target-small-horizontal",x),Ee(this.overlayElement,"dv-drop-target-left",E),Ee(this.overlayElement,"dv-drop-target-right",_),Ee(this.overlayElement,"dv-drop-target-top",C),Ee(this.overlayElement,"dv-drop-target-bottom",D),Ee(this.overlayElement,"dv-drop-target-center",e==="center")}calculateQuadrant(e,i,a,r,c){var d,h;const f=(h=(d=this.options.overlayModel)===null||d===void 0?void 0:d.activationSize)!==null&&h!==void 0?h:$T;return f.type==="percentage"?XT(e,i,a,r,c,f.value):QT(e,i,a,r,c,f.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,(e=this.targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}}zn.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function XT(n,e,i,a,r,c){const d=100*e/a,h=100*i/r;return n.has("left")&&d<c?"left":n.has("right")&&d>100-c?"right":n.has("top")&&h<c?"top":n.has("bottom")&&h>100-c?"bottom":n.has("center")?"center":null}function QT(n,e,i,a,r,c){return n.has("left")&&e<c?"left":n.has("right")&&e>a-c?"right":n.has("top")&&i<c?"top":n.has("bottom")&&i>r-c?"bottom":n.has("center")?"center":null}const vf=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});class ZT extends o0{constructor(e,i,a,r){super(),this.nativeEvent=e,this.position=i,this.getData=a,this.panel=r}}class g0 extends nm{constructor(){super()}}class v0 extends Ae{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,i){super(),this.id=e,this.component=i,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new Pt,this._onDidDimensionChange=new ie,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new ie,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new ie,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new ie,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new ie,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new ie,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new ie,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new ie,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(a=>{this._isFocused=a.isFocused}),this.onDidActiveChange(a=>{this._isActive=a.isActive}),this.onDidVisibilityChange(a=>{this._isVisible=a.isVisible}),this.onDidDimensionsChange(a=>{this._width=a.width,this._height=a.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(i=>{this._parameters=i,e.update({params:i})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class y0 extends v0{constructor(e,i){super(e,i),this._onDidConstraintsChangeInternal=new ie,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new ie({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new ie,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class KT extends y0{set pane(e){this._pane=e}constructor(e,i){super(e,i),this._onDidExpansionChange=new ie({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new ie({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new ie({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var i;(i=this._pane)===null||i===void 0||i.setExpanded(e)}get isExpanded(){var e;return!!(!((e=this._pane)===null||e===void 0)&&e.isExpanded())}}class om extends Ae{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)===null||e===void 0?void 0:e.params}constructor(e,i,a){super(),this.id=e,this.component=i,this.api=a,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const r=r0(this._element);this.addDisposables(this.api,r.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),r.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),r)}focus(){const e=new g0;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,i){this._width=e,this._height=i,this.api._onDidDimensionChange.fire({width:e,height:i}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var i,a;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(i=this._params)===null||i===void 0?void 0:i.params),e.params)});for(const r of Object.keys(e.params))e.params[r]===void 0&&delete this._params.params[r];(a=this.part)===null||a===void 0||a.update({params:this._params.params})}toJSON(){var e,i;const a=(i=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&i!==void 0?i:{};return{id:this.id,component:this.component,params:Object.keys(a).length>0?a:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)===null||e===void 0||e.dispose(),super.dispose()}}class JT extends om{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=this.headerSize,a=this.isExpanded()?this._minimumBodySize:0;return e+a}get maximumSize(){const e=this.headerSize,a=this.isExpanded()?this._maximumBodySize:0;return e+a}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=typeof e=="number"?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=typeof e=="number"?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new KT(e.id,e.component)),this._onDidChangeExpansionState=new ie({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(i=>{const{isVisible:a}=i,{accessor:r}=this._params;r.setVisible(this,a)}),this.api.onDidSizeChange(i=>{this._onDidChange.fire({size:i.size})}),Pe(this.element,"mouseenter",i=>{this.api._onMouseEnter.fire(i)}),Pe(this.element,"mouseleave",i=>{this.api._onMouseLeave.fire(i)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(i=>{this.api._onDidExpansionChange.fire({isExpanded:i})}),this.api.onDidFocusChange(i=>{this.header&&(i.isFocused?Mc(this.header,"focused"):Ko(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var i;(i=this.body)===null||i===void 0||i.remove()},200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,i){this._size=e,this._orthogonalSize=i;const[a,r]=this.orientation===be.HORIZONTAL?[e,i]:[i,e];super.layout(a,r)}init(e){var i,a;super.init(e),typeof e.minimumBodySize=="number"&&(this.minimumBodySize=e.minimumBodySize),typeof e.maximumBodySize=="number"&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),(i=this.body)===null||i===void 0||i.append(this.bodyPart.element),(a=this.header)===null||a===void 0||a.append(this.headerPart.element),typeof e.isExpanded=="boolean"&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var i,a;(i=this.bodyPart)===null||i===void 0||i.update({params:e}),(a=this.headerPart)===null||a===void 0||a.update({params:e})},dispose:()=>{var e,i;(e=this.bodyPart)===null||e===void 0||e.dispose(),(i=this.headerPart)===null||i===void 0||i.dispose()}}}}class ek extends JT{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new ie,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOverEvent=new ie,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOverEvent),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,i=this.accessor.id;this.header.draggable=!0,this.handler=new class extends am{getData(){return Zn.getInstance().setData([new Xo(i,e)],Xo.prototype),{dispose:()=>{Zn.getInstance().clearData(Xo.prototype)}}}}(this.header),this.target=new zn(this.element,{acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(a,r)=>{const c=$o();if(c&&c.paneId!==this.id&&c.viewId===this.accessor.id)return!0;const d=new ZT(a,r,$o,this);return this._onUnhandledDragOverEvent.fire(d),d.isAccepted}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop(a=>{this.onDrop(a)}))}onDrop(e){const i=$o();if(!i||i.viewId!==this.accessor.id){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new er(this.accessor),getData:$o}));return}const a=this._params.containerApi,r=i.paneId,c=a.getPanel(r);if(!c){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:$o,api:new er(this.accessor)}));return}const d=a.panels,h=d.indexOf(c);let f=a.panels.indexOf(this);(e.position==="left"||e.position==="top")&&(f=Math.max(0,f-1)),(e.position==="right"||e.position==="bottom")&&(h>f&&f++,f=Math.min(d.length-1,f)),a.movePanel(h,f)}}class tk extends Ae{get element(){return this._element}constructor(e,i){super(),this.accessor=e,this.group=i,this.disposable=new Pt,this._onDidFocus=new ie,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new ie,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);const a=i.dropTargetContainer;this.dropTarget=new zn(this.element,{getOverlayOutline:()=>{var r;return((r=e.options.theme)===null||r===void 0?void 0:r.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:(r,c)=>{if(this.group.locked==="no-drop-target"||this.group.locked&&c==="center")return!1;const d=zt();return!d&&r.shiftKey&&this.group.location.type!=="floating"?!1:d&&d.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(r,c,"content")},getOverrideTarget:a?()=>a.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}renderPanel(e,i={asActive:!0}){const a=i.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&this._element.removeChild(this.panel.view.content.element),this.panel=e;let r;switch(e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&a&&this._element.appendChild(this.panel.view.content.element),r=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),r=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(a){const c=r0(r);this.focusTracker=c;const d=new Ae;d.addDisposables(c,c.onDidFocus(()=>this._onDidFocus.fire()),c.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=d}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,i){}closePanel(){var e;this.panel&&this.panel.api.renderer==="onlyWhenVisible"&&((e=this.panel.view.content.element.parentElement)===null||e===void 0||e.removeChild(this.panel.view.content.element)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;!((e=this.focusTracker)===null||e===void 0)&&e.refreshState&&this.focusTracker.refreshState()}}function b0(n,e,i){var a,r;Mc(e,"dv-dragged"),e.style.top="-9999px",document.body.appendChild(e),n.setDragImage(e,(a=i?.x)!==null&&a!==void 0?a:0,(r=i?.y)!==null&&r!==void 0?r:0),setTimeout(()=>{Ko(e,"dv-dragged"),e.remove()},0)}class nk extends am{constructor(e,i,a,r,c){super(e,c),this.accessor=i,this.group=a,this.panel=r,this.panelTransfer=Zn.getInstance()}getData(e){return this.panelTransfer.setData([new Ki(this.accessor.id,this.group.id,this.panel.id)],Ki.prototype),{dispose:()=>{this.panelTransfer.clearData(Ki.prototype)}}}}class ik extends Ae{get element(){return this._element}constructor(e,i,a){super(),this.panel=e,this.accessor=i,this.group=a,this.content=void 0,this._onPointDown=new ie,this.onPointerDown=this._onPointDown.event,this._onDropped=new ie,this.onDrop=this._onDropped.event,this._onDragStart=new ie,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,Ee(this.element,"dv-inactive-tab",!0),this.dragHandler=new nk(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new zn(this._element,{acceptedTargetZones:["left","right"],overlayModel:{activationSize:{value:50,type:"percentage"}},canDisplayOverlay:(r,c)=>{if(this.group.locked)return!1;const d=zt();return d&&this.accessor.id===d.viewId?!0:this.group.model.canDisplayOverlay(r,c,"tab")},getOverrideTarget:()=>{var r;return(r=a.model.dropTargetContainer)===null||r===void 0?void 0:r.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onDropped,this._onDragStart,this.dragHandler.onDragStart(r=>{if(r.dataTransfer){const c=getComputedStyle(this.element),d=this.element.cloneNode(!0);Array.from(c).forEach(h=>d.style.setProperty(h,c.getPropertyValue(h),c.getPropertyPriority(h))),d.style.position="absolute",b0(r.dataTransfer,d,{y:-10,x:30})}this._onDragStart.fire(r)}),this.dragHandler,Pe(this._element,"pointerdown",r=>{this._onPointDown.fire(r)}),this.dropTarget.onDrop(r=>{this._onDropped.fire(r)}),this.dropTarget)}setActive(e){Ee(this.element,"dv-active-tab",e),Ee(this.element,"dv-inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}dispose(){super.dispose()}}class Lc{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,i){this.event=e,this.options=i}}class sk extends am{constructor(e,i,a,r){super(e,r),this.accessor=i,this.group=a,this.panelTransfer=Zn.getInstance(),this.addDisposables(Pe(e,"pointerdown",c=>{c.shiftKey&&wT(c)},!0))}isCancelled(e){return this.group.api.location.type==="floating"&&!e.shiftKey}getData(e){const i=e.dataTransfer;this.panelTransfer.setData([new Ki(this.accessor.id,this.group.id,null)],Ki.prototype);const a=window.getComputedStyle(this.el),r=a.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),c=a.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");if(i){const d=document.createElement("div");d.style.backgroundColor=r,d.style.color=c,d.style.padding="2px 8px",d.style.height="24px",d.style.fontSize="11px",d.style.lineHeight="20px",d.style.borderRadius="12px",d.style.position="absolute",d.style.pointerEvents="none",d.style.top="-9999px",d.textContent=`Multiple Panels (${this.group.size})`,b0(i,d,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(Ki.prototype)}}}}class ak extends Ae{get element(){return this._element}constructor(e,i){super(),this.accessor=e,this.group=i,this._onDrop=new ie,this.onDrop=this._onDrop.event,this._onDragStart=new ie,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this._element.draggable=!this.accessor.options.disableDnd,Ee(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,Pe(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)})),this.handler=new sk(this._element,e,i,!!this.accessor.options.disableDnd),this.dropTarget=new zn(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:(a,r)=>{const c=zt();return c&&this.accessor.id===c.viewId?!0:i.model.canDisplayOverlay(a,r,"header_space")},getOverrideTarget:()=>{var a;return(a=i.model.dropTargetContainer)===null||a===void 0?void 0:a.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart(a=>{this._onDragStart.fire(a)}),this.dropTarget.onDrop(a=>{this._onDrop.fire(a)}),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,Ee(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}}class Ic extends Ae{get element(){return this._element}constructor(e){super(),this.scrollableElement=e,this._scrollLeft=0,this._element=document.createElement("div"),this._element.className="dv-scrollable",this._horizontalScrollbar=document.createElement("div"),this._horizontalScrollbar.className="dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._horizontalScrollbar),this.addDisposables(Pe(this.element,"wheel",i=>{this._scrollLeft+=i.deltaY*Ic.MouseWheelSpeed,this.calculateScrollbarStyles()}),Pe(this._horizontalScrollbar,"pointerdown",i=>{i.preventDefault(),Ee(this.element,"dv-scrollable-scrolling",!0);const a=i.clientX,r=this._scrollLeft,c=h=>{const f=h.clientX-a,{clientWidth:p}=this.element,{scrollWidth:y}=this.scrollableElement,b=p/y;this._scrollLeft=r+f/b,this.calculateScrollbarStyles()},d=()=>{Ee(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",d),document.removeEventListener("pointercancel",d)};document.addEventListener("pointermove",c),document.addEventListener("pointerup",d),document.addEventListener("pointercancel",d)}),Pe(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),Pe(this.scrollableElement,"scroll",()=>{this._scrollLeft=this.scrollableElement.scrollLeft,this.calculateScrollbarStyles()}),zc(this.element,()=>{Ee(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),Ee(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const{clientWidth:e}=this.element,{scrollWidth:i}=this.scrollableElement;if(i>e){const r=e*(e/i);this._horizontalScrollbar.style.width=`${r}px`,this._scrollLeft=st(this._scrollLeft,0,this.scrollableElement.scrollWidth-e),this.scrollableElement.scrollLeft=this._scrollLeft;const c=this._scrollLeft/(i-e);this._horizontalScrollbar.style.left=`${(e-r)*c}px`}else this._horizontalScrollbar.style.width="0px",this._horizontalScrollbar.style.left="0px",this._scrollLeft=0}}Ic.MouseWheelSpeed=1;class ok extends Ae{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const i=new bT(this._tabsList);this._observerDisposable.value=new Ae(i,i.onDidChange(a=>{const r=a.hasScrollX||a.hasScrollY;this.toggleDropdown({reset:!r})}),Pe(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1})}))}}get element(){return this._element}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}constructor(e,i,a){if(super(),this.group=e,this.accessor=i,this._observerDisposable=new Pt,this._tabs=[],this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._onTabDragStart=new ie,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new ie,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new ie,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container dv-horizontal",this.showTabsOverflowControl=a.showTabsOverflowControl,i.options.scrollbars==="native")this._element=this._tabsList;else{const r=new Ic(this._tabsList);this._element=r.element,this.addDisposables(r)}this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,Pe(this.element,"pointerdown",r=>{if(r.defaultPrevented)return;r.button===0&&this.accessor.doSetGroupActive(this.group)}),yt.from(()=>{for(const{value:r,disposable:c}of this._tabs)c.dispose(),r.dispose();this._tabs=[]}))}indexOf(e){return this._tabs.findIndex(i=>i.value.panel.id===e)}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}setActivePanel(e){let i=0;for(const a of this._tabs){const r=e.id===a.value.panel.id;if(a.value.setActive(r),r){const c=a.value.element,d=c.parentElement;(i<d.scrollLeft||i+c.clientWidth>d.scrollLeft+d.clientWidth)&&(d.scrollLeft=i)}i+=a.value.element.clientWidth}}openPanel(e,i=this._tabs.length){if(this._tabs.find(d=>d.value.panel.id===e.id))return;const a=new ik(e,this.accessor,this.group);a.setContent(e.view.tab);const r=new Ae(a.onDragStart(d=>{this._onTabDragStart.fire({nativeEvent:d,panel:e})}),a.onPointerDown(d=>{if(d.defaultPrevented)return;const h=!this.accessor.options.disableFloatingGroups,f=this.group.api.location.type==="floating"&&this.size===1;if(h&&!f&&d.shiftKey){d.preventDefault();const p=this.accessor.getGroupPanel(a.panel.id),{top:y,left:b}=a.element.getBoundingClientRect(),{top:x,left:w}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(p,{x:b-w,y:y-x,inDragMode:!0});return}d.button===0&&this.group.activePanel!==e&&this.group.model.openPanel(e)}),a.onDrop(d=>{this._onDrop.fire({event:d.nativeEvent,index:this._tabs.findIndex(h=>h.value===a)})}),a.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(new Lc(d,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:zt}))})),c={value:a,disposable:r};this.addTab(c,i)}delete(e){const i=this.indexOf(e),a=this._tabs.splice(i,1)[0],{value:r,disposable:c}=a;c.dispose(),r.dispose(),r.element.remove()}addTab(e,i=this._tabs.length){if(i<0||i>this._tabs.length)throw new Error("invalid location");this._tabsList.insertBefore(e.value.element,this._tabsList.children[i]),this._tabs=[...this._tabs.slice(0,i),e,...this._tabs.slice(i)],this.selectedIndex<0&&(this.selectedIndex=i)}toggleDropdown(e){const i=e.reset?[]:this._tabs.filter(a=>!AT(a.value.element,this._tabsList)).map(a=>a.value.panel.id);this._onOverflowTabsChange.fire({tabs:i,reset:e.reset})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState()}}const rm=n=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"height",n.height),e.setAttributeNS(null,"width",n.width),e.setAttributeNS(null,"viewBox",n.viewbox),e.setAttributeNS(null,"aria-hidden","false"),e.setAttributeNS(null,"focusable","false"),e.classList.add("dv-svg");const i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttributeNS(null,"d",n.path),e.appendChild(i),e},rk=()=>rm({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),lk=()=>rm({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),x0=()=>rm({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});function ck(){const n=document.createElement("div");n.className="dv-tabs-overflow-dropdown-default";const e=document.createElement("span");e.textContent="";const i=x0();return n.appendChild(i),n.appendChild(e),{element:n,update:a=>{e.textContent=`${a.tabs}`}}}class uk extends Ae{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get element(){return this._element}constructor(e,i){super(),this.accessor=e,this.group=i,this._hidden=!1,this.dropdownPart=null,this._overflowTabs=[],this._dropdownDisposable=new Pt,this._onDrop=new ie,this.onDrop=this._onDrop.event,this._onGroupDragStart=new ie,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",Ee(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new ok(i,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new ak(this.accessor,this.group),this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.addDisposables(this.tabs.onDrop(a=>this._onDrop.fire(a)),this.tabs.onWillShowOverlay(a=>this._onWillShowOverlay.fire(a)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(a=>{this.toggleDropdown(a)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(a=>{this._onGroupDragStart.fire({nativeEvent:a,group:this.group})}),this.voidContainer.onDrop(a=>{this._onDrop.fire({event:a.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(a=>{this._onWillShowOverlay.fire(new Lc(a,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:zt}))}),Pe(this.voidContainer.element,"pointerdown",a=>{if(a.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&a.shiftKey&&this.group.api.location.type!=="floating"){a.preventDefault();const{top:c,left:d}=this.element.getBoundingClientRect(),{top:h,left:f}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:d-f+20,y:c-h+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}openPanel(e,i=this.tabs.size){this.tabs.openPanel(e,i),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){Ee(this._element,"dv-single-tab",this.size===1)}toggleDropdown(e){const i=e.reset?[]:e.tabs;if(this._overflowTabs=i,this._overflowTabs.length>0&&this.dropdownPart){this.dropdownPart.update({tabs:i.length});return}if(this._overflowTabs.length===0){this._dropdownDisposable.dispose();return}const a=document.createElement("div");a.className="dv-tabs-overflow-dropdown-root";const r=ck();r.update({tabs:i.length}),this.dropdownPart=r,a.appendChild(r.element),this.rightActionsContainer.prepend(a),this._dropdownDisposable.value=new Ae(yt.from(()=>{var c,d;a.remove(),(d=(c=this.dropdownPart)===null||c===void 0?void 0:c.dispose)===null||d===void 0||d.call(c),this.dropdownPart=null}),Pe(a,"pointerdown",c=>{c.preventDefault()},{capture:!0}),Pe(a,"click",c=>{const d=document.createElement("div");d.style.overflow="auto",d.className="dv-tabs-overflow-container";for(const f of this.tabs.tabs.filter(p=>this._overflowTabs.includes(p.panel.id))){const p=this.group.panels.find(w=>w===f.panel),b=p.view.createTabRenderer("headerOverflow").element,x=document.createElement("div");Ee(x,"dv-tab",!0),Ee(x,"dv-active-tab",p.api.isActive),Ee(x,"dv-inactive-tab",!p.api.isActive),x.addEventListener("click",w=>{this.accessor.popupService.close(),!w.defaultPrevented&&(f.element.scrollIntoView(),f.panel.api.setActive())}),x.appendChild(b),d.appendChild(x)}const h=kT(a);this.accessor.popupService.openPopover(d,{x:c.clientX,y:c.clientY,zIndex:h?.style.zIndex?`calc(${h.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}}class w0 extends o0{constructor(e,i,a,r,c){super(),this.nativeEvent=e,this.target=i,this.position=a,this.getData=r,this.group=c}}const yf=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0});function dk(n){return!!n.referencePanel}function hk(n){return!!n.referenceGroup}function fk(n){return!!n.referencePanel}function mk(n){return!!n.referenceGroup}class lm extends nm{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class S0 extends lm{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class pk extends Ae{get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(e){this._locked=e,Ee(this.container,"dv-locked-groupview",e==="no-drop-target"||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?uf(document.activeElement,this.contentContainer.element):!1}get location(){return this._location}set location(e){switch(this._location=e,Ee(this.container,"dv-groupview-floating",!1),Ee(this.container,"dv-groupview-popout",!1),e.type){case"grid":this.contentContainer.dropTarget.setTargetZones(["top","bottom","left","right","center"]);break;case"floating":this.contentContainer.dropTarget.setTargetZones(["center"]),this.contentContainer.dropTarget.setTargetZones(e?["center"]:["top","bottom","left","right","center"]),Ee(this.container,"dv-groupview-floating",!0);break;case"popout":this.contentContainer.dropTarget.setTargetZones(["center"]),Ee(this.container,"dv-groupview-popout",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,i,a,r,c){var d;super(),this.container=e,this.accessor=i,this.id=a,this.options=r,this.groupPanel=c,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._onMove=new ie,this.onMove=this._onMove.event,this._onDidDrop=new ie,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new ie,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new ie,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new ie,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new ie,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new ie,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new ie,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new ie,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new ie,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new ie,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,Ee(this.container,"dv-groupview",!0),this._api=new pc(this.accessor),this.tabsContainer=new uk(this.accessor,this.groupPanel),this.contentContainer=new tk(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!r.hideHeader,this.locked=(d=r.locked)!==null&&d!==void 0?d:!1,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(h=>{this._onTabDragStart.fire(h)}),this.tabsContainer.onGroupDragStart(h=>{this._onGroupDragStart.fire(h)}),this.tabsContainer.onDrop(h=>{this.handleDropEvent("header",h.event,"center",h.index)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(h=>{this.handleDropEvent("content",h.nativeEvent,h.position)}),this.tabsContainer.onWillShowOverlay(h=>{this._onWillShowOverlay.fire(h)}),this.contentContainer.dropTarget.onWillShowOverlay(h=>{this._onWillShowOverlay.fire(new Lc(h,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:zt}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange)}focusContent(){this.contentContainer.element.focus()}set renderContainer(e){this.panels.forEach(i=>{this.renderContainer.detatch(i)}),this._overwriteRenderContainer=e,this.panels.forEach(i=>{this.rerender(i)})}get renderContainer(){var e;return(e=this._overwriteRenderContainer)!==null&&e!==void 0?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return(e=this._overwriteDropTargetContainer)!==null&&e!==void 0?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.accessor.options.createRightHeaderActionComponent&&(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this.addDisposables(this._rightHeaderActions),this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)),this.accessor.options.createLeftHeaderActionComponent&&(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this.addDisposables(this._leftHeaderActions),this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)),this.accessor.options.createPrefixHeaderActionComponent&&(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this.addDisposables(this._prefixHeaderActions),this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element))}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const i={views:this.tabsContainer.panels,activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,id:this.id};return this.locked!==!1&&(i.locked=this.locked),this.header.hidden&&(i.hideHeader=!0),i}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const i=e.panel?this.panels.indexOf(e.panel):-1;let a;if(i<this.panels.length-1)a=i+1;else if(!e.suppressRoll)a=0;else return;this.openPanel(this.panels[a])}moveToPrevious(e){if(e||(e={}),e.panel||(e.panel=this.activePanel),!e.panel)return;const i=this.panels.indexOf(e.panel);let a;if(i>0)a=i-1;else if(!e.suppressRoll)a=this.panels.length-1;else return;this.openPanel(this.panels[a])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}openPanel(e,i={}){(typeof i.index!="number"||i.index>this.panels.length)&&(i.index=this.panels.length);const a=!!i.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:i.skipSetActive}),this.doAddPanel(e,i.index,{skipSetActive:a}),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}a||this.doSetActivePanel(e),i.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),i.skipSetActive||this.updateContainer()}removePanel(e,i={skipSetActive:!1}){const a=typeof e=="string"?e:e.id,r=this._panels.find(c=>c.id===a);if(!r)throw new Error("invalid operation");return this._removePanel(r,i)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const i of e)this.doClose(i)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const i=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,i&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,i=!1){!i&&this.isActive===e||(this._isGroupActive=e,Ee(this.container,"dv-active-group",e),Ee(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer())}layout(e,i){var a;this._width=e,this._height=i,this.contentContainer.layout(this._width,this._height),!((a=this._activePanel)===null||a===void 0)&&a.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(e,i){const a=this._activePanel===e;if(this.doRemovePanel(e),a&&this.panels.length>0){const r=this.mostRecentlyUsed[0];this.openPanel(r,{skipSetActive:i.skipSetActive,skipSetGroupActive:i.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),i.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const i=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(i,1),this.mostRecentlyUsed.includes(e)){const r=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(r,1)}const a=this._panelDisposables.get(e.id);a&&(a.dispose(),this._panelDisposables.delete(e.id)),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,i=this.panels.length,a={skipSetActive:!1}){const c=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,i),a.skipSetActive||this.contentContainer.openPanel(e),!c&&(this.updateMru(e),this.panels.splice(i,0,e),this._panelDisposables.set(e.id,new Ae(e.api.onDidTitleChange(d=>this._onDidPanelTitleChange.fire(d)),e.api.onDidParametersChange(d=>this._onDidPanelParametersChange.fire(d)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e})))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,i;if(this.panels.forEach(a=>a.runEvents()),this.isEmpty&&!this.watermark){const a=this.accessor.createWatermarkComponent();a.init({containerApi:this._api,group:this.groupPanel}),this.watermark=a,Pe(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),(i=(e=this.watermark).dispose)===null||i===void 0||i.call(e),this.watermark=void 0)}canDisplayOverlay(e,i,a){const r=new w0(e,a,i,zt,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(r),r.isAccepted}handleDropEvent(e,i,a,r){if(this.locked==="no-drop-target")return;function c(){switch(e){case"header":return typeof r=="number"?"tab":"header_space";case"content":return"content"}}const d=typeof r=="number"?this.panels[r]:void 0,h=new S0({nativeEvent:i,position:a,panel:d,getData:()=>zt(),kind:c(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(h),h.defaultPrevented)return;const f=zt();if(f&&f.viewId===this.accessor.id){if(e==="content"&&f.groupId===this.id&&(a==="center"||f.panelId===null)||e==="header"&&f.groupId===this.id&&f.panelId===null)return;if(f.panelId===null){const{groupId:w}=f;this._onMove.fire({target:a,groupId:w,index:r});return}if(this.tabsContainer.indexOf(f.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:y,panelId:b}=f;if(this.id===y&&!a&&this.tabsContainer.indexOf(b)===r)return;this._onMove.fire({target:a,groupId:f.groupId,itemId:f.panelId,index:r})}else this._onDidDrop.fire(new lm({nativeEvent:i,position:a,panel:d,getData:()=>zt(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,i,a;super.dispose(),(e=this.watermark)===null||e===void 0||e.element.remove(),(a=(i=this.watermark)===null||i===void 0?void 0:i.dispose)===null||a===void 0||a.call(i),this.watermark=void 0;for(const r of this.panels)r.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class cm extends v0{constructor(e,i,a){super(e,i),this._onDidConstraintsChangeInternal=new ie,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new ie,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new ie,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),a&&this.initialize(a)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class C0 extends om{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,i,a,r){super(e,i,r??new cm(e,i)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,typeof a?.minimumWidth=="number"&&(this._minimumWidth=a.minimumWidth),typeof a?.maximumWidth=="number"&&(this._maximumWidth=a.maximumWidth),typeof a?.minimumHeight=="number"&&(this._minimumHeight=a.minimumHeight),typeof a?.maximumHeight=="number"&&(this._maximumHeight=a.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(c=>{const{isVisible:d}=c,{accessor:h}=this._params;h.setVisible(this,d)}),this.api.onActiveChange(()=>{const{accessor:c}=this._params;c.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(c=>{(typeof c.minimumWidth=="number"||typeof c.minimumWidth=="function")&&(this._minimumWidth=c.minimumWidth),(typeof c.minimumHeight=="number"||typeof c.minimumHeight=="function")&&(this._minimumHeight=c.minimumHeight),(typeof c.maximumWidth=="number"||typeof c.maximumWidth=="function")&&(this._maximumWidth=c.maximumWidth),(typeof c.maximumHeight=="number"||typeof c.maximumHeight=="function")&&(this._maximumHeight=c.maximumHeight)}),this.api.onDidSizeChange(c=>{this._onDidChange.fire({height:c.height,width:c.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible=="boolean"&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),i=r=>r===Number.MAX_SAFE_INTEGER?void 0:r,a=r=>r<=0?void 0:r;return Object.assign(Object.assign({},e),{minimumHeight:a(this.minimumHeight),maximumHeight:i(this.maximumHeight),minimumWidth:a(this.minimumWidth),maximumWidth:i(this.maximumWidth),snap:this.snap,priority:this.priority})}}const Wo="dockview: DockviewGroupPanelApiImpl not initialized";class gk extends cm{get location(){if(!this._group)throw new Error(Wo);return this._group.model.location}constructor(e,i){super(e,"__dockviewgroup__"),this.accessor=i,this._onDidLocationChange=new ie,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new ie,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidVisibilityChange.event(a=>{a.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():window}moveTo(e){var i,a,r,c;if(!this._group)throw new Error(Wo);const d=(i=e.group)!==null&&i!==void 0?i:this.accessor.addGroup({direction:UT((a=e.position)!==null&&a!==void 0?a:"right"),skipSetActive:(r=e.skipSetActive)!==null&&r!==void 0?r:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:d,position:e.group&&(c=e.position)!==null&&c!==void 0?c:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(Wo);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(Wo);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(Wo);this.isMaximized()&&this.accessor.exitMaximizedGroup()}initialize(e){this._group=e}}const vk=100,yk=100;class Mb extends C0{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth=="number")return this._explicitConstraints.minimumWidth;const i=(e=this.activePanel)===null||e===void 0?void 0:e.minimumWidth;return typeof i=="number"?i:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight=="number")return this._explicitConstraints.minimumHeight;const i=(e=this.activePanel)===null||e===void 0?void 0:e.minimumHeight;return typeof i=="number"?i:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth=="number")return this._explicitConstraints.maximumWidth;const i=(e=this.activePanel)===null||e===void 0?void 0:e.maximumWidth;return typeof i=="number"?i:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight=="number")return this._explicitConstraints.maximumHeight;const i=(e=this.activePanel)===null||e===void 0?void 0:e.maximumHeight;return typeof i=="number"?i:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,i,a){var r,c,d,h,f,p;super(i,"groupview_default",{minimumHeight:(c=(r=a.constraints)===null||r===void 0?void 0:r.minimumHeight)!==null&&c!==void 0?c:yk,minimumWidth:(h=(d=a.constraints)===null||d===void 0?void 0:d.minimumWidth)!==null&&h!==void 0?h:vk,maximumHeight:(f=a.constraints)===null||f===void 0?void 0:f.maximumHeight,maximumWidth:(p=a.constraints)===null||p===void 0?void 0:p.maximumWidth},new gk(i,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new pk(this.element,e,i,a,this),this.addDisposables(this.model.onDidActivePanelChange(y=>{this.api._onDidActivePanelChange.fire(y)}),this.api.onDidConstraintsChangeInternal(y=>{y.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof y.minimumWidth=="function"?y.minimumWidth():y.minimumWidth),y.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof y.minimumHeight=="function"?y.minimumHeight():y.minimumHeight),y.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof y.maximumWidth=="function"?y.maximumWidth():y.maximumWidth),y.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof y.maximumHeight=="function"?y.maximumHeight():y.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,i){super.layout(e,i),this.model.layout(e,i)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const bk={className:"dockview-theme-abyss"};class xk extends cm{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const i=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(i),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,i,a,r,c){super(e.id,r),this.panel=e,this.accessor=a,this._onDidTitleChange=new ie,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new ie,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new ie,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new ie,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new ie,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new Pt,this._tabComponent=c,this.initialize(e),this._group=i,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(e){var i,a;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(i=e.group)!==null&&i!==void 0?i:this._group,position:e.group&&(a=e.position)!==null&&a!==void 0?a:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var i;let a=(i=e?.isActive)!==null&&i!==void 0?i:!1;this.groupEventsDisposable.value=new Ae(this.group.api.onDidVisibilityChange(r=>{const c=!r.isVisible&&this.isVisible,d=r.isVisible&&!this.isVisible,h=this.group.model.isPanelActive(this.panel);(c||d&&h)&&this._onDidVisibilityChange.fire(r)}),this.group.api.onDidLocationChange(r=>{this.group===this.panel.group&&this._onDidLocationChange.fire(r)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&a!==this.isGroupActive&&(a=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class ja extends Ae{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return(e=this._renderer)!==null&&e!==void 0?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,i,a,r,c,d,h,f){super(),this.id=e,this.accessor=r,this.containerApi=c,this.view=h,this._renderer=f.renderer,this._group=d,this._minimumWidth=f.minimumWidth,this._minimumHeight=f.minimumHeight,this._maximumWidth=f.maximumWidth,this._maximumHeight=f.maximumHeight,this.api=new xk(this,this._group,r,i,a),this.addDisposables(this.api.onActiveChange(()=>{r.setActivePanel(this)}),this.api.onDidSizeChange(p=>{this.group.api.setSize(p)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new g0;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var i;this._params=Object.assign(Object.assign({},(i=this._params)!==null&&i!==void 0?i:{}),e.params);for(const a of Object.keys(e.params))e.params[a]===void 0&&delete this._params[a];this.view.update({params:this._params})}updateFromStateModel(e){var i,a,r;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:(i=e.params)!==null&&i!==void 0?i:{}}),this.setTitle((a=e.title)!==null&&a!==void 0?a:this.id),this.setRenderer((r=e.renderer)!==null&&r!==void 0?r:this.accessor.renderer)}updateParentGroup(e,i){this._group=e,this.api.group=this._group;const a=this._group.model.isPanelActive(this),r=this.group.api.isActive&&a;i?.skipSetActive||this.api.isActive!==r&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&a}),this.api.isVisible!==a&&this.api._onDidVisibilityChange.fire({isVisible:a})}runEvents(){const e=this._group.model.isPanelActive(this),i=this.group.api.isActive&&e;this.api.isActive!==i&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,i){this.api._onDidDimensionChange.fire({width:e,height:i}),this.view.layout(e,i)}dispose(){this.api.dispose(),this.view.dispose()}}class Pb extends Ae{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(rk()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(i=>{this._title=i.title,this.render()}),Pe(this.action,"pointerdown",i=>{i.preventDefault()}),Pe(this.action,"click",i=>{i.defaultPrevented||(i.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=(e=this._title)!==null&&e!==void 0?e:"")}}class _0{get content(){return this._content}get tab(){return this._tab}constructor(e,i,a,r){this.accessor=e,this.id=i,this.contentComponent=a,this.tabComponent=r,this._content=this.createContentComponent(this.id,a),this._tab=this.createTabComponent(this.id,r)}createTabRenderer(e){var i;const a=this.createTabComponent(this.id,this.tabComponent);return this._params&&a.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&((i=a.update)===null||i===void 0||i.call(a,this._updateEvent)),a}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}layout(e,i){var a,r;(r=(a=this.content).layout)===null||r===void 0||r.call(a,e,i)}update(e){var i,a,r,c;this._updateEvent=e,(a=(i=this.content).update)===null||a===void 0||a.call(i,e),(c=(r=this.tab).update)===null||c===void 0||c.call(r,e)}dispose(){var e,i,a,r;(i=(e=this.content).dispose)===null||i===void 0||i.call(e),(r=(a=this.tab).dispose)===null||r===void 0||r.call(a)}createContentComponent(e,i){return this.accessor.options.createComponent({id:e,name:i})}createTabComponent(e,i){const a=i??this.accessor.options.defaultTabComponent;if(a){if(this.accessor.options.createTabComponent){const r=this.accessor.options.createTabComponent({id:e,name:a});return r||new Pb}console.warn(`dockview: tabComponent '${i}' was not found. falling back to the default tab.`)}return new Pb}}class wk{constructor(e){this.accessor=e}fromJSON(e,i){var a,r;const c=e.id,d=e.params,h=e.title,f=e.view,p=f?f.content.id:(a=e.contentComponent)!==null&&a!==void 0?a:"unknown",y=f?(r=f.tab)===null||r===void 0?void 0:r.id:e.tabComponent,b=new _0(this.accessor,c,p,y),x=new ja(c,p,y,this.accessor,new pc(this.accessor),i,b,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return x.init({title:h??c,params:d??{}}),x}}class Sk extends Ae{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}class Ck{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(i=>i!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(i=>i!==e),this.update()}update(){for(let e=0;e<this._orderedList.length;e++)this._orderedList[e].setAttribute("aria-level",`${e}`),this._orderedList[e].style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${e*2})`}}const Ll=new Ck;let um=class js extends Ae{set minimumInViewportWidth(e){this.options.minimumInViewportWidth=e}set minimumInViewportHeight(e){this.options.minimumInViewportHeight=e}get element(){return this._element}get isVisible(){return this._isVisible}constructor(e){super(),this.options=e,this._element=document.createElement("div"),this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onDidChangeEnd=new ie,this.onDidChangeEnd=this._onDidChangeEnd.event,this.addDisposables(this._onDidChange,this._onDidChangeEnd),this._element.className="dv-resize-container",this._isVisible=!0,this.setupResize("top"),this.setupResize("bottom"),this.setupResize("left"),this.setupResize("right"),this.setupResize("topleft"),this.setupResize("topright"),this.setupResize("bottomleft"),this.setupResize("bottomright"),this._element.appendChild(this.options.content),this.options.container.appendChild(this._element),this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({height:this.options.height,width:this.options.width},"top"in this.options&&{top:this.options.top}),"bottom"in this.options&&{bottom:this.options.bottom}),"left"in this.options&&{left:this.options.left}),"right"in this.options&&{right:this.options.right})),Ll.push(this._element)}setVisible(e){e!==this.isVisible&&(this._isVisible=e,Ee(this.element,"dv-hidden",!this.isVisible))}bringToFront(){Ll.push(this._element)}setBounds(e={}){typeof e.height=="number"&&(this._element.style.height=`${e.height}px`),typeof e.width=="number"&&(this._element.style.width=`${e.width}px`),"top"in e&&typeof e.top=="number"&&(this._element.style.top=`${e.top}px`,this._element.style.bottom="auto",this.verticalAlignment="top"),"bottom"in e&&typeof e.bottom=="number"&&(this._element.style.bottom=`${e.bottom}px`,this._element.style.top="auto",this.verticalAlignment="bottom"),"left"in e&&typeof e.left=="number"&&(this._element.style.left=`${e.left}px`,this._element.style.right="auto",this.horiziontalAlignment="left"),"right"in e&&typeof e.right=="number"&&(this._element.style.right=`${e.right}px`,this._element.style.left="auto",this.horiziontalAlignment="right");const i=this.options.container.getBoundingClientRect(),a=this._element.getBoundingClientRect(),r=Math.max(0,this.getMinimumWidth(a.width)),c=Math.max(0,this.getMinimumHeight(a.height));if(this.verticalAlignment==="top"){const d=st(a.top-i.top,-c,Math.max(0,i.height-a.height+c));this._element.style.top=`${d}px`,this._element.style.bottom="auto"}if(this.verticalAlignment==="bottom"){const d=st(i.bottom-a.bottom,-c,Math.max(0,i.height-a.height+c));this._element.style.bottom=`${d}px`,this._element.style.top="auto"}if(this.horiziontalAlignment==="left"){const d=st(a.left-i.left,-r,Math.max(0,i.width-a.width+r));this._element.style.left=`${d}px`,this._element.style.right="auto"}if(this.horiziontalAlignment==="right"){const d=st(i.right-a.right,-r,Math.max(0,i.width-a.width+r));this._element.style.right=`${d}px`,this._element.style.left="auto"}this._onDidChange.fire()}toJSON(){const e=this.options.container.getBoundingClientRect(),i=this._element.getBoundingClientRect(),a={};return this.verticalAlignment==="top"?a.top=parseFloat(this._element.style.top):this.verticalAlignment==="bottom"?a.bottom=parseFloat(this._element.style.bottom):a.top=i.top-e.top,this.horiziontalAlignment==="left"?a.left=parseFloat(this._element.style.left):this.horiziontalAlignment==="right"?a.right=parseFloat(this._element.style.right):a.left=i.left-e.left,a.width=i.width,a.height=i.height,a}setupDrag(e,i={inDragMode:!1}){const a=new Pt,r=()=>{let c=null;const d=fc();a.value=new Ae({dispose:()=>{d.release()}},Pe(window,"pointermove",h=>{const f=this.options.container.getBoundingClientRect(),p=h.clientX-f.left,y=h.clientY-f.top;Ee(this._element,"dv-resize-container-dragging",!0);const b=this._element.getBoundingClientRect();c===null&&(c={x:h.clientX-b.left,y:h.clientY-b.top});const x=Math.max(0,this.getMinimumWidth(b.width)),w=Math.max(0,this.getMinimumHeight(b.height)),E=st(y-c.y,-w,Math.max(0,f.height-b.height+w)),_=st(c.y-y+f.height-b.height,-w,Math.max(0,f.height-b.height+w)),C=st(p-c.x,-x,Math.max(0,f.width-b.width+x)),D=st(c.x-p+f.width-b.width,-x,Math.max(0,f.width-b.width+x)),N={};E<=_?N.top=E:N.bottom=_,C<=D?N.left=C:N.right=D,this.setBounds(N)}),Pe(window,"pointerup",()=>{Ee(this._element,"dv-resize-container-dragging",!1),a.dispose(),this._onDidChangeEnd.fire()}))};this.addDisposables(a,Pe(e,"pointerdown",c=>{if(c.defaultPrevented){c.preventDefault();return}Rb(c)||r()}),Pe(this.options.content,"pointerdown",c=>{c.defaultPrevented||Rb(c)||c.shiftKey&&r()}),Pe(this.options.content,"pointerdown",()=>{Ll.push(this._element)},!0)),i.inDragMode&&r()}setupResize(e){const i=document.createElement("div");i.className=`dv-resize-handle-${e}`,this._element.appendChild(i);const a=new Pt;this.addDisposables(a,Pe(i,"pointerdown",r=>{r.preventDefault();let c=null;const d=fc();a.value=new Ae(Pe(window,"pointermove",h=>{const f=this.options.container.getBoundingClientRect(),p=this._element.getBoundingClientRect(),y=h.clientY-f.top,b=h.clientX-f.left;c===null&&(c={originalY:y,originalHeight:p.height,originalX:b,originalWidth:p.width});let x,w,E,_,C,D;const N=()=>{const O=c.originalY+c.originalHeight>f.height?Math.max(0,f.height-js.MINIMUM_HEIGHT):Math.max(0,c.originalY+c.originalHeight-js.MINIMUM_HEIGHT);x=st(y,0,O),E=c.originalY+c.originalHeight-x,w=f.height-x-E},k=()=>{x=c.originalY-c.originalHeight;const O=x<0&&typeof this.options.minimumInViewportHeight=="number"?-x+this.options.minimumInViewportHeight:js.MINIMUM_HEIGHT,A=f.height-Math.max(0,x);E=st(y-x,O,A),w=f.height-x-E},T=()=>{const O=c.originalX+c.originalWidth>f.width?Math.max(0,f.width-js.MINIMUM_WIDTH):Math.max(0,c.originalX+c.originalWidth-js.MINIMUM_WIDTH);_=st(b,0,O),D=c.originalX+c.originalWidth-_,C=f.width-_-D},R=()=>{_=c.originalX-c.originalWidth;const O=_<0&&typeof this.options.minimumInViewportWidth=="number"?-_+this.options.minimumInViewportWidth:js.MINIMUM_WIDTH,A=f.width-Math.max(0,_);D=st(b-_,O,A),C=f.width-_-D};switch(e){case"top":N();break;case"bottom":k();break;case"left":T();break;case"right":R();break;case"topleft":N(),T();break;case"topright":N(),R();break;case"bottomleft":k(),T();break;case"bottomright":k(),R();break}const z={};x<=w?z.top=x:z.bottom=w,_<=C?z.left=_:z.right=C,z.height=E,z.width=D,this.setBounds(z)}),{dispose:()=>{d.release()}},Pe(window,"pointerup",()=>{a.dispose(),this._onDidChangeEnd.fire()}))}))}getMinimumWidth(e){return typeof this.options.minimumInViewportWidth=="number"?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return typeof this.options.minimumInViewportHeight=="number"?e-this.options.minimumInViewportHeight:0}dispose(){Ll.destroy(this._element),this._element.remove(),super.dispose()}};um.MINIMUM_HEIGHT=20;um.MINIMUM_WIDTH=20;class _k extends Ae{constructor(e,i){super(),this.group=e,this.overlay=i,this.addDisposables(i)}position(e){this.overlay.setBounds(e)}}const Il=100,Qi={left:100,top:100,width:300,height:300},Ek=100;class Dk{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const i=this.cache.get(e);if(i&&i.frameId===this.currentFrameId)return i.rect;this.scheduleFrameUpdate();const a=df(e);return this.cache.set(e,{rect:a,frameId:this.currentFrameId}),a}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}function Ak(){const n=document.createElement("div");return n.tabIndex=-1,n}class Lb extends Ae{constructor(e,i){super(),this.element=e,this.accessor=i,this.map={},this._disposed=!1,this.positionCache=new Dk,this.pendingUpdates=new Set,this.addDisposables(yt.from(()=>{for(const a of Object.values(this.map))a.disposable.dispose(),a.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:i,destroy:a}=this.map[e.api.id];return i.dispose(),a.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:i,referenceContainer:a}=e;if(!this.map[i.api.id]){const y=Ak();y.className="dv-render-overlay",this.map[i.api.id]={panel:i,disposable:yt.NONE,destroy:yt.NONE,element:y}}const r=this.map[i.api.id].element;i.view.content.element.parentElement!==r&&r.appendChild(i.view.content.element),r.parentElement!==this.element&&this.element.appendChild(r);const c=()=>{const y=i.api.id;this.pendingUpdates.has(y)||(this.pendingUpdates.add(y),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(y),this.isDisposed||!this.map[y])return;const b=this.positionCache.getPosition(a.element),x=this.positionCache.getPosition(this.element),w=b.left-x.left,E=b.top-x.top,_=b.width,C=b.height;r.style.left=`${w}px`,r.style.top=`${E}px`,r.style.width=`${_}px`,r.style.height=`${C}px`,Ee(r,"dv-render-overlay-float",i.group.api.location.type==="floating")}))},d=()=>{i.api.isVisible&&(this.positionCache.invalidate(),c()),r.style.display=i.api.isVisible?"":"none"},h=new Pt,f=()=>{i.api.location.type==="floating"?queueMicrotask(()=>{const y=this.accessor.floatingGroups.find(E=>E.group===i.api.group);if(!y)return;const b=y.overlay.element,x=()=>{const E=Number(b.getAttribute("aria-level"));r.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${E*2+1})`},w=new MutationObserver(()=>{x()});h.value=yt.from(()=>w.disconnect()),w.observe(b,{attributeFilter:["aria-level"],attributes:!0}),x()}):r.style.zIndex=""},p=new Ae(h,new p0(r,{onDragEnd:y=>{a.dropTarget.dnd.onDragEnd(y)},onDragEnter:y=>{a.dropTarget.dnd.onDragEnter(y)},onDragLeave:y=>{a.dropTarget.dnd.onDragLeave(y)},onDrop:y=>{a.dropTarget.dnd.onDrop(y)},onDragOver:y=>{a.dropTarget.dnd.onDragOver(y)}}),i.api.onDidVisibilityChange(()=>{d()}),i.api.onDidDimensionsChange(()=>{i.api.isVisible&&c()}),i.api.onDidLocationChange(()=>{f()}));return this.map[i.api.id].destroy=yt.from(()=>{var y;i.view.content.element.parentElement===r&&r.removeChild(i.view.content.element),(y=r.parentElement)===null||y===void 0||y.removeChild(r)}),f(),queueMicrotask(()=>{this.isDisposed||d()}),this.map[i.api.id].disposable.dispose(),this.map[i.api.id].disposable=p,this.map[i.api.id].resize=c,r}}var Nk=function(n,e,i,a){function r(c){return c instanceof i?c:new i(function(d){d(c)})}return new(i||(i=Promise))(function(c,d){function h(y){try{p(a.next(y))}catch(b){d(b)}}function f(y){try{p(a.throw(y))}catch(b){d(b)}}function p(y){y.done?c(y.value):r(y.value).then(h,f)}p((a=a.apply(n,e||[])).next())})};class jk extends Ae{get window(){var e,i;return(i=(e=this._window)===null||e===void 0?void 0:e.value)!==null&&i!==void 0?i:null}constructor(e,i,a){super(),this.target=e,this.className=i,this.options=a,this._onWillClose=new ie,this.onWillClose=this._onWillClose.event,this._onDidClose=new ie,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX,i=this._window.value.screenY,a=this._window.value.innerWidth,r=this._window.value.innerHeight;return{top:i,left:e,width:a,height:r}}close(){var e,i;this._window&&(this._onWillClose.fire(),(i=(e=this.options).onWillClose)===null||i===void 0||i.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){var e,i;return Nk(this,void 0,void 0,function*(){if(this._window)throw new Error("instance of popout window is already open");const a=`${this.options.url}`,r=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([f,p])=>`${f}=${p}`).join(","),c=window.open(a,this.target,r);if(!c)return null;const d=new Ae;this._window={value:c,disposable:d},d.addDisposables(yt.from(()=>{c.close()}),Pe(window,"beforeunload",()=>{this.close()}));const h=this.createPopoutWindowContainer();return this.className&&h.classList.add(this.className),(i=(e=this.options).onDidOpen)===null||i===void 0||i.call(e,{id:this.target,window:c}),new Promise((f,p)=>{c.addEventListener("unload",y=>{}),c.addEventListener("load",()=>{try{const y=c.document;y.title=document.title,y.body.appendChild(h),ST(y,window.document.styleSheets),Pe(c,"beforeunload",()=>{this.close()}),f(h)}catch(y){p(y)}})})})}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class Tk extends Ae{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,i=new Set;this.addDisposables(this.accessor.onDidAddPanel(a=>{if(e.has(a.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${a.api.id} but panel already exists`);e.add(a.api.id)}),this.accessor.onDidRemovePanel(a=>{if(e.has(a.api.id))e.delete(a.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${a.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(a=>{if(i.has(a.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${a.api.id} but group already exists`);i.add(a.api.id)}),this.accessor.onDidRemoveGroup(a=>{if(i.has(a.api.id))i.delete(a.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${a.api.id} but group does not exists`)}))}}class kk extends Ae{constructor(e){super(),this.root=e,this._active=null,this._activeDisposable=new Pt,this._element=document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this.root.prepend(this._element),this.addDisposables(yt.from(()=>{this.close()}),this._activeDisposable)}openPopover(e,i){var a;this.close();const r=document.createElement("div");r.style.position="absolute",r.style.zIndex=(a=i.zIndex)!==null&&a!==void 0?a:"var(--dv-overlay-z-index)",r.appendChild(e);const c=this._element.getBoundingClientRect(),d=c.left,h=c.top;r.style.top=`${i.y-h}px`,r.style.left=`${i.x-d}px`,this._element.appendChild(r),this._active=r,this._activeDisposable.value=new Ae(Pe(window,"pointerdown",f=>{var p;const y=f.target;if(!(y instanceof HTMLElement))return;let b=y;for(;b&&b!==r;)b=(p=b?.parentElement)!==null&&p!==void 0?p:null;b||this.close()})),requestAnimationFrame(()=>{TT(r,this.root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class Ib extends Ae{get disabled(){return this._disabled}set disabled(e){var i;this.disabled!==e&&(this._disabled=e,e&&((i=this.model)===null||i===void 0||i.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&((e=this._model.root.parentElement)===null||e===void 0||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,i)=>{const a=this._outline!==i;if(this._outline=i,this._model)return this._model.changed=a,this._model;const r=this.createContainer(),c=this.createAnchor();if(this._model={root:r,overlay:c,changed:a},r.appendChild(c),this.element.appendChild(r),e?.target instanceof HTMLElement){const d=e.target.getBoundingClientRect(),h=this.element.getBoundingClientRect();c.style.left=`${d.left-h.left}px`,c.style.top=`${d.top-h.top}px`}return this._model}}}constructor(e,i){super(),this.element=e,this._disabled=!1,this._disabled=i.disabled,this.addDisposables(yt.from(()=>{var a;(a=this.model)===null||a===void 0||a.clear()}))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}const Gb={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};function Gl(n){const e=n.from.activePanel;[...n.from.panels].map(a=>{const r=n.from.model.removePanel(a);return n.from.model.renderContainer.detatch(a),r}).forEach(a=>{n.to.model.openPanel(a,{skipSetActive:e!==a,skipSetGroupActive:!0})})}class Rk extends h0{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return(e=this.options.defaultRenderer)!==null&&e!==void 0?e:"onlyWhenVisible"}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(e,i){var a,r,c;super(e,{proportionalLayout:!0,orientation:be.HORIZONTAL,styles:i.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:i.disableAutoResizing,locked:i.locked,margin:(r=(a=i.theme)===null||a===void 0?void 0:a.gap)!==null&&r!==void 0?r:0,className:i.className}),this.nextGroupId=im(),this._deserializer=new wk(this),this._watermark=null,this._onWillDragPanel=new ie,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new ie,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new ie,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new ie,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new ie,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new ie,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new ie,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new ie,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new ie,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new ie,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new ie,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new ie({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new ie,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidMaximizedGroupChange=new ie,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new ie,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new ie,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new ie,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new ie,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=i,this.popupService=new kk(this.element),this._themeClassnames=new Pc(this.element),this._api=new pc(this),this.rootDropTargetContainer=new Ib(this.element,{disabled:!0}),this.overlayRenderContainer=new Lb(this.gridview.element,this),this._rootDropTarget=new zn(this.element,{className:"dv-drop-target-edge",canDisplayOverlay:(d,h)=>{const f=zt();if(f)return f.viewId!==this.id?!1:h==="center"?this.gridview.length===0:!0;if(h==="center"&&this.gridview.length!==0)return!1;const p=new w0(d,"edge",h,zt);return this._onUnhandledDragOverEvent.fire(p),p.isAccepted},acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:(c=i.rootOverlayModel)!==null&&c!==void 0?c:Gb,getOverrideTarget:()=>{var d;return(d=this.rootDropTargetContainer)===null||d===void 0?void 0:d.model}}),this.updateDropTargetModel(i),Ee(this.gridview.element,"dv-dockview",!0),Ee(this.element,"dv-debug",!!i.debug),this.updateTheme(),this.updateWatermark(),i.debug&&this.addDisposables(new Tk(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.updateWatermark()}),this.onDidAdd(d=>{this._moving||this._onDidAddGroup.fire(d)}),this.onDidRemove(d=>{this._moving||this._onDidRemoveGroup.fire(d)}),this.onDidActiveChange(d=>{this._moving||this._onDidActiveGroupChange.fire(d)}),this.onDidMaximizedChange(d=>{this._onDidMaximizedGroupChange.fire({group:d.panel,isMaximized:d.isMaximized})}),Rs.any(this.onDidAdd,this.onDidRemove)(()=>{this.updateWatermark()}),Rs.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange)(()=>{this._bufferOnDidLayoutChange.fire()}),yt.from(()=>{for(const d of[...this._floatingGroups])d.dispose();for(const d of[...this._popoutGroups])d.disposable.dispose()}),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay(d=>{this.gridview.length>0&&d.position==="center"||this._onWillShowOverlay.fire(new Lc(d,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:zt}))}),this._rootDropTarget.onDrop(d=>{var h;const f=new S0({nativeEvent:d.nativeEvent,position:d.position,panel:void 0,api:this._api,group:void 0,getData:zt,kind:"edge"});if(this._onWillDrop.fire(f),f.defaultPrevented)return;const p=zt();p?this.moveGroupOrPanel({from:{groupId:p.groupId,panelId:(h=p.panelId)!==null&&h!==void 0?h:void 0},to:{group:this.orthogonalize(d.position),position:"center"}}):this._onDidDrop.fire(new lm({nativeEvent:d.nativeEvent,position:d.position,panel:void 0,api:this._api,group:void 0,getData:zt}))}),this._rootDropTarget)}setVisible(e,i){switch(e.api.location.type){case"grid":super.setVisible(e,i);break;case"floating":{const a=this.floatingGroups.find(r=>r.group===e);a&&(a.overlay.setVisible(i),e.api._onDidVisibilityChange.fire({isVisible:i}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window");break}}addPopoutGroup(e,i){var a,r,c,d,h;if(e instanceof ja&&e.group.size===1)return this.addPopoutGroup(e.group,i);const f=DT(this.gridview.element),p=this.element;function y(){return i?.position?i.position:e instanceof Mb?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():p.getBoundingClientRect()}const b=y(),x=(r=(a=i?.overridePopoutGroup)===null||a===void 0?void 0:a.id)!==null&&r!==void 0?r:this.getNextGroupId(),w=new jk(`${this.id}-${x}`,f??"",{url:(h=(c=i?.popoutUrl)!==null&&c!==void 0?c:(d=this.options)===null||d===void 0?void 0:d.popoutUrl)!==null&&h!==void 0?h:"/popout.html",left:window.screenX+b.left,top:window.screenY+b.top,width:b.width,height:b.height,onDidOpen:i?.onDidOpen,onWillClose:i?.onWillClose}),E=new Ae(w,w.onDidClose(()=>{E.dispose()}));return w.open().then(_=>{var C;if(w.isDisposed)return!1;const D=i?.referenceGroup?i.referenceGroup:e instanceof ja?e.group:e,N=e.api.location.type,k=D.element.parentElement!==null;let T;if(k?i?.overridePopoutGroup?T=i.overridePopoutGroup:(T=this.createGroup({id:x}),_&&this._onDidAddGroup.fire(T)):T=D,_===null)return console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),E.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock(()=>Gl({from:T,to:D})),D.api.isVisible||D.api.setVisible(!0),!1;const R=document.createElement("div");R.className="dv-overlay-render-container";const z=new Lb(R,this);T.model.renderContainer=z,T.layout(w.window.innerWidth,w.window.innerHeight);let O;if(!i?.overridePopoutGroup&&k)if(e instanceof ja)this.movingLock(()=>{const ne=D.model.removePanel(e);T.model.openPanel(ne)});else switch(this.movingLock(()=>Gl({from:D,to:T})),N){case"grid":D.api.setVisible(!1);break;case"floating":case"popout":O=(C=this._floatingGroups.find(ne=>ne.group.api.id===e.api.id))===null||C===void 0?void 0:C.overlay.toJSON(),this.removeGroup(D);break}_.classList.add("dv-dockview"),_.style.overflow="hidden",_.appendChild(R),_.appendChild(T.element);const A=document.createElement("div"),G=new Ib(A,{disabled:this.rootDropTargetContainer.disabled});_.appendChild(A),T.model.dropTargetContainer=G,T.model.location={type:"popout",getWindow:()=>w.window,popoutUrl:i?.popoutUrl},k&&e.api.location.type==="grid"&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(T),E.addDisposables(T.api.onDidActiveChange(ne=>{var W;ne.isActive&&((W=w.window)===null||W===void 0||W.focus())}),T.api.onWillFocus(()=>{var ne;(ne=w.window)===null||ne===void 0||ne.focus()}));let U;const B=k&&D&&this.getPanel(D.id),$={window:w,popoutGroup:T,referenceGroup:B?D.id:void 0,disposable:{dispose:()=>(E.dispose(),U)}},ae=NT(w.window);return E.addDisposables(ae,jT(w.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:w.window.innerWidth,height:w.window.innerHeight,group:T})}),ae.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:w.window.screenX,screenY:w.window.screenX,group:T})}),Pe(w.window,"resize",()=>{T.layout(w.window.innerWidth,w.window.innerHeight)}),z,yt.from(()=>{if(!this.isDisposed){if(k&&this.getPanel(D.id))this.movingLock(()=>Gl({from:T,to:D})),D.api.isVisible||D.api.setVisible(!0),this.getPanel(T.id)&&this.doRemoveGroup(T,{skipPopoutAssociated:!0});else if(this.getPanel(T.id)){if(T.model.renderContainer=this.overlayRenderContainer,T.model.dropTargetContainer=this.rootDropTargetContainer,U=T,!this._popoutGroups.find(W=>W.popoutGroup===T))return;O?this.addFloatingGroup(T,{height:O.height,width:O.width,position:O}):(this.doRemoveGroup(T,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),T.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(T,[0])})),this.doSetGroupAndPanelActive(T)}}})),this._popoutGroups.push($),this.updateWatermark(),!0}).catch(_=>(console.error("dockview: failed to create popout.",_),!1))}addFloatingGroup(e,i){var a,r,c,d,h;let f;if(e instanceof ja)f=this.createGroup(),this._onDidAddGroup.fire(f),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>f.model.openPanel(e,{skipSetGroupActive:!0}));else{f=e;const _=(a=this._popoutGroups.find(N=>N.popoutGroup===f))===null||a===void 0?void 0:a.referenceGroup,C=_?this.getPanel(_):void 0;typeof i?.skipRemoveGroup=="boolean"&&i.skipRemoveGroup||(C?(this.movingLock(()=>Gl({from:e,to:C})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(C,{skipDispose:!0}),f=C):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function p(){if(i?.position){const _={};return"left"in i.position?_.left=Math.max(i.position.left,0):"right"in i.position?_.right=Math.max(i.position.right,0):_.left=Qi.left,"top"in i.position?_.top=Math.max(i.position.top,0):"bottom"in i.position?_.bottom=Math.max(i.position.bottom,0):_.top=Qi.top,typeof i.width=="number"?_.width=Math.max(i.width,0):_.width=Qi.width,typeof i.height=="number"?_.height=Math.max(i.height,0):_.height=Qi.height,_}return{left:typeof i?.x=="number"?Math.max(i.x,0):Qi.left,top:typeof i?.y=="number"?Math.max(i.y,0):Qi.top,width:typeof i?.width=="number"?Math.max(i.width,0):Qi.width,height:typeof i?.height=="number"?Math.max(i.height,0):Qi.height}}const y=p(),b=new um(Object.assign(Object.assign({container:this.gridview.element,content:f.element},y),{minimumInViewportWidth:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(c=(r=this.options.floatingGroupBounds)===null||r===void 0?void 0:r.minimumWidthWithinViewport)!==null&&c!==void 0?c:Il,minimumInViewportHeight:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(h=(d=this.options.floatingGroupBounds)===null||d===void 0?void 0:d.minimumHeightWithinViewport)!==null&&h!==void 0?h:Il})),x=f.element.querySelector(".dv-void-container");if(!x)throw new Error("dockview: failed to find drag handle");b.setupDrag(x,{inDragMode:typeof i?.inDragMode=="boolean"?i.inDragMode:!1});const w=new _k(f,b),E=new Ae(f.api.onDidActiveChange(_=>{_.isActive&&b.bringToFront()}),zc(f.element,_=>{const{width:C,height:D}=_.contentRect;f.layout(C,D)}));w.addDisposables(b.onDidChange(()=>{f.layout(f.width,f.height)}),b.onDidChangeEnd(()=>{this._bufferOnDidLayoutChange.fire()}),f.onDidChange(_=>{b.setBounds({height:_?.height,width:_?.width})}),{dispose:()=>{E.dispose(),zh(this._floatingGroups,w),f.model.location={type:"grid"},this.updateWatermark()}}),this._floatingGroups.push(w),f.model.location={type:"floating"},i?.skipActiveGroup||this.doSetGroupAndPanelActive(f),this.updateWatermark()}orthogonalize(e,i){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===be.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===be.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,i);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,i);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var i,a;if(super.updateOptions(e),"floatingGroupBounds"in e)for(const d of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":d.overlay.minimumInViewportHeight=void 0,d.overlay.minimumInViewportWidth=void 0;break;case void 0:d.overlay.minimumInViewportHeight=Il,d.overlay.minimumInViewportWidth=Il;break;default:d.overlay.minimumInViewportHeight=(i=e.floatingGroupBounds)===null||i===void 0?void 0:i.minimumHeightWithinViewport,d.overlay.minimumInViewportWidth=(a=e.floatingGroupBounds)===null||a===void 0?void 0:a.minimumWidthWithinViewport}d.overlay.setBounds()}this.updateDropTargetModel(e);const r=this.options.disableDnd;this._options=Object.assign(Object.assign({},this.options),e);const c=this.options.disableDnd;r!==c&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),this.layout(this.gridview.width,this.gridview.height,!0)}layout(e,i,a){if(super.layout(e,i,a),this._floatingGroups)for(const r of this._floatingGroups)r.overlay.setBounds()}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}getGroupPanel(e){return this.panels.find(i=>i.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var i;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1]){e.group.model.moveToNext({suppressRoll:!0});return}const a=ot(e.group.element),r=(i=this.gridview.next(a))===null||i===void 0?void 0:i.view;this.doSetGroupAndPanelActive(r)}moveToPrevious(e={}){var i;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0]){e.group.model.moveToPrevious({suppressRoll:!0});return}const a=ot(e.group.element),r=(i=this.gridview.previous(a))===null||i===void 0?void 0:i.view;r&&this.doSetGroupAndPanelActive(r)}toJSON(){var e;const i=this.gridview.serialize(),a=this.panels.reduce((h,f)=>(h[f.id]=f.toJSON(),h),{}),r=this._floatingGroups.map(h=>({data:h.group.toJSON(),position:h.overlay.toJSON()})),c=this._popoutGroups.map(h=>({data:h.popoutGroup.toJSON(),gridReferenceGroup:h.referenceGroup,position:h.window.dimensions(),url:h.popoutGroup.api.location.type==="popout"?h.popoutGroup.api.location.popoutUrl:void 0})),d={grid:i,panels:a,activeGroup:(e=this.activeGroup)===null||e===void 0?void 0:e.id};return r.length>0&&(d.floatingGroups=r),c.length>0&&(d.popoutGroups=c),d}fromJSON(e,i){var a,r;const c=new Map;let d;if(i?.reuseExistingPanels){d=this.createGroup(),this._groups.delete(d.api.id);const y=Object.keys(e.panels);for(const b of this.panels)y.includes(b.api.id)&&c.set(b.api.id,b);this.movingLock(()=>{Array.from(c.values()).forEach(b=>{this.moveGroupOrPanel({from:{groupId:b.api.group.api.id,panelId:b.api.id},to:{group:d,position:"center"},keepEmptyGroups:!0})})})}if(this.clear(),typeof e!="object"||e===null)throw new Error("dockview: serialized layout must be a non-null object");const{grid:h,panels:f,activeGroup:p}=e;if(h.root.type!=="branch"||!Array.isArray(h.root.data))throw new Error("dockview: root must be of type branch");try{const y=this.width,b=this.height,x=C=>{const{id:D,locked:N,hideHeader:k,views:T,activeView:R}=C;if(typeof D!="string")throw new Error("dockview: group id must be of type string");const z=this.createGroup({id:D,locked:!!N,hideHeader:!!k});this._onDidAddGroup.fire(z);const O=[];for(const A of T){const G=c.get(A);if(d&&G)this.movingLock(()=>{d.model.removePanel(G)}),O.push(G),G.updateFromStateModel(f[A]);else{const U=this._deserializer.fromJSON(f[A],z);O.push(U)}}for(let A=0;A<T.length;A++){const G=O[A],U=typeof R=="string"&&R===G.id;c.has(G.api.id)?this.movingLock(()=>{z.model.openPanel(G,{skipSetActive:!U,skipSetGroupActive:!0})}):z.model.openPanel(G,{skipSetActive:!U,skipSetGroupActive:!0})}return!z.activePanel&&z.panels.length>0&&z.model.openPanel(z.panels[z.panels.length-1],{skipSetGroupActive:!0}),z};this.gridview.deserialize(h,{fromJSON:C=>x(C.data)}),this.layout(y,b,!0);const w=(a=e.floatingGroups)!==null&&a!==void 0?a:[];for(const C of w){const{data:D,position:N}=C,k=x(D);this.addFloatingGroup(k,{position:N,width:N.width,height:N.height,skipRemoveGroup:!0,inDragMode:!1})}const E=(r=e.popoutGroups)!==null&&r!==void 0?r:[],_=[];E.forEach((C,D)=>{const{data:N,position:k,gridReferenceGroup:T,url:R}=C,z=x(N),O=new Promise(A=>{setTimeout(()=>{this.addPopoutGroup(z,{position:k??void 0,overridePopoutGroup:T?z:void 0,referenceGroup:T?this.getPanel(T):void 0,popoutUrl:R}),A()},D*Ek)});_.push(O)}),this._popoutRestorationPromise=Promise.all(_).then(()=>{});for(const C of this._floatingGroups)C.overlay.setBounds();if(typeof p=="string"){const C=this.getPanel(p);C&&this.doSetGroupAndPanelActive(C)}}catch(y){console.error("dockview: failed to deserialize layout. Reverting changes",y);for(const b of this.groups)for(const x of b.panels)this.removePanel(x,{removeEmptyGroup:!1,skipDispose:!1});for(const b of this.groups)b.dispose(),this._groups.delete(b.id),this._onDidRemoveGroup.fire(b);for(const b of[...this._floatingGroups])b.dispose();throw this.clear(),y}this.updateWatermark(),this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}clear(){const e=Array.from(this._groups.values()).map(a=>a.value),i=!!this.activeGroup;for(const a of e)this.removeGroup(a,{skipActive:!0});i&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(const e of this._groups.entries()){const[i,a]=e;a.value.model.closeAllPanels()}}addPanel(e){var i,a;if(this.panels.find(f=>f.id===e.id))throw new Error(`dockview: panel with id ${e.id} already exists`);let r;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const c={width:e.initialWidth,height:e.initialHeight};let d;if(e.position)if(dk(e.position)){const f=typeof e.position.referencePanel=="string"?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(d=e.position.index,!f)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);r=this.findGroup(f)}else if(hk(e.position)){if(r=typeof e.position.referenceGroup=="string"?(i=this._groups.get(e.position.referenceGroup))===null||i===void 0?void 0:i.value:e.position.referenceGroup,d=e.position.index,!r)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else{const f=this.orthogonalize(zb(e.position.direction)),p=this.createPanel(e,f);return f.model.openPanel(p,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d}),e.inactive||this.doSetGroupAndPanelActive(f),f.api.setSize({height:c?.height,width:c?.width}),p}else r=this.activeGroup;let h;if(r){const f=mc(((a=e.position)===null||a===void 0?void 0:a.direction)||"within");if(e.floating){const p=this.createGroup();this._onDidAddGroup.fire(p);const y=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(p,Object.assign(Object.assign({},y),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),h=this.createPanel(e,p),p.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d})}else if(r.api.location.type==="floating"||f==="center")h=this.createPanel(e,r),r.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d}),r.api.setSize({width:c?.width,height:c?.height}),e.inactive||this.doSetGroupAndPanelActive(r);else{const p=ot(r.element),y=$n(this.gridview.orientation,p,f),b=this.createGroupAtLocation(y,this.orientationAtLocation(y)===be.VERTICAL?c?.height:c?.width);h=this.createPanel(e,b),b.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d}),e.inactive||this.doSetGroupAndPanelActive(b)}}else if(e.floating){const f=this.createGroup();this._onDidAddGroup.fire(f);const p=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(f,Object.assign(Object.assign({},p),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),h=this.createPanel(e,f),f.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d})}else{const f=this.createGroupAtLocation([0],this.gridview.orientation===be.VERTICAL?c?.height:c?.width);h=this.createPanel(e,f),f.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d}),e.inactive||this.doSetGroupAndPanelActive(f)}return h}removePanel(e,i={removeEmptyGroup:!0}){const a=e.group;if(!a)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);a.model.removePanel(e,{skipSetActiveGroup:i.skipSetActiveGroup}),i.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),a.size===0&&i.removeEmptyGroup&&this.removeGroup(a,{skipActive:i.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new Sk}updateWatermark(){var e,i;if(this.groups.filter(a=>a.api.location.type==="grid"&&a.api.isVisible).length===0){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new pc(this)});const a=document.createElement("div");a.className="dv-watermark-container",_T(a,"watermark-component"),a.appendChild(this._watermark.element),this.gridview.element.appendChild(a)}}else this._watermark&&(this._watermark.element.parentElement.remove(),(i=(e=this._watermark).dispose)===null||i===void 0||i.call(e),this._watermark=null)}addGroup(e){var i;if(e){let a;if(fk(e)){const p=typeof e.referencePanel=="string"?this.panels.find(y=>y.id===e.referencePanel):e.referencePanel;if(!p)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(a=this.findGroup(p),!a)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else if(mk(e)){if(a=typeof e.referenceGroup=="string"?(i=this._groups.get(e.referenceGroup))===null||i===void 0?void 0:i.value:e.referenceGroup,!a)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}else{const p=this.orthogonalize(zb(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(p),p}const r=mc(e.direction||"within"),c=ot(a.element),d=$n(this.gridview.orientation,c,r),h=this.createGroup(e),f=this.getLocationOrientation(d)===be.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(h,d,f),e.skipSetActive||this.doSetGroupAndPanelActive(h),h}else{const a=this.createGroup(e);return this.doAddGroup(a),this.doSetGroupAndPanelActive(a),a}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===be.HORIZONTAL?be.HORIZONTAL:be.VERTICAL}removeGroup(e,i){this.doRemoveGroup(e,i)}doRemoveGroup(e,i){var a;const r=[...e.panels];if(!i?.skipDispose)for(const h of r)this.removePanel(h,{removeEmptyGroup:!1,skipDispose:(a=i?.skipDispose)!==null&&a!==void 0?a:!1});const c=this.activePanel;if(e.api.location.type==="floating"){const h=this._floatingGroups.find(f=>f.group===e);if(h){if(i?.skipDispose||(h.group.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)),zh(this._floatingGroups,h),h.dispose(),!i?.skipActive&&this._activeGroup===e){const f=Array.from(this._groups.values());this.doSetGroupAndPanelActive(f.length>0?f[0].value:void 0)}return h.group}throw new Error("dockview: failed to find floating group")}if(e.api.location.type==="popout"){const h=this._popoutGroups.find(f=>f.popoutGroup===e);if(h){if(!i?.skipDispose){if(!i?.skipPopoutAssociated){const p=h.referenceGroup?this.getPanel(h.referenceGroup):void 0;p&&p.panels.length===0&&this.removeGroup(p)}h.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}zh(this._popoutGroups,h);const f=h.disposable.dispose();if(!i?.skipPopoutReturn&&f&&(this.doAddGroup(f,[0]),this.doSetGroupAndPanelActive(f)),!i?.skipActive&&this._activeGroup===e){const p=Array.from(this._groups.values());this.doSetGroupAndPanelActive(p.length>0?p[0].value:void 0)}return this.updateWatermark(),h.popoutGroup}throw new Error("dockview: failed to find popout group")}const d=super.doRemoveGroup(e,i);return i?.skipActive||this.activePanel!==c&&this._onDidActivePanelChange.fire(this.activePanel),d}debouncedUpdateAllPositions(){this._updatePositionsFrameId!==void 0&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions()})}movingLock(e){const i=this._moving;try{return this._moving=!0,e()}finally{this._moving=i}}moveGroupOrPanel(e){var i;const a=e.to.group,r=e.from.groupId,c=e.from.panelId,d=e.to.position,h=e.to.index,f=r?(i=this._groups.get(r))===null||i===void 0?void 0:i.value:void 0;if(!f)throw new Error(`dockview: Failed to find group id ${r}`);if(c===void 0){this.moveGroup({from:{group:f},to:{group:a,position:d},skipSetActive:e.skipSetActive});return}if(!d||d==="center"){const p=this.movingLock(()=>f.model.removePanel(c,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!p)throw new Error(`dockview: No panel with id ${c}`);!e.keepEmptyGroups&&f.model.size===0&&this.doRemoveGroup(f,{skipActive:!0});const y=a.model.size===0;this.movingLock(()=>{var b;return a.model.openPanel(p,{index:h,skipSetActive:((b=e.skipSetActive)!==null&&b!==void 0?b:!1)&&!y,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(a),this._onDidMovePanel.fire({panel:p,from:f})}else{const p=ot(a.element),y=$n(this.gridview.orientation,p,d);if(f.size<2){const[b,x]=xi(y);if(f.api.location.type==="grid"){const C=ot(f.element),[D,N]=xi(C);if(u0(D,b)){this.gridview.moveView(D,N,x),this._onDidMovePanel.fire({panel:this.getGroupPanel(c),from:f});return}}if(f.api.location.type==="popout"){const C=this._popoutGroups.find(k=>k.popoutGroup===f),D=this.movingLock(()=>C.popoutGroup.model.removePanel(C.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(f,{skipActive:!0});const N=this.createGroupAtLocation(y);this.movingLock(()=>N.model.openPanel(D,{skipSetActive:!0})),this.doSetGroupAndPanelActive(N),this._onDidMovePanel.fire({panel:this.getGroupPanel(c),from:f});return}const w=this.movingLock(()=>this.doRemoveGroup(f,{skipActive:!0,skipDispose:!0})),E=ot(a.element),_=$n(this.gridview.orientation,E,d);this.movingLock(()=>this.doAddGroup(w,_)),this.doSetGroupAndPanelActive(w),this._onDidMovePanel.fire({panel:this.getGroupPanel(c),from:f})}else{const b=this.movingLock(()=>f.model.removePanel(c,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!b)throw new Error(`dockview: No panel with id ${c}`);const x=$n(this.gridview.orientation,p,d),w=this.createGroupAtLocation(x);this.movingLock(()=>w.model.openPanel(b,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(w),this._onDidMovePanel.fire({panel:b,from:f})}}}moveGroup(e){const i=e.from.group,a=e.to.group,r=e.to.position;if(r==="center"){const c=i.activePanel,d=this.movingLock(()=>[...i.panels].map(h=>i.model.removePanel(h.id,{skipSetActive:!0})));i?.model.size===0&&this.doRemoveGroup(i,{skipActive:!0}),this.movingLock(()=>{for(const h of d)a.model.openPanel(h,{skipSetActive:h!==c,skipSetGroupActive:!0})}),e.skipSetActive!==!0?this.doSetGroupAndPanelActive(a):this.activePanel||this.doSetGroupAndPanelActive(a)}else{switch(i.api.location.type){case"grid":this.gridview.removeView(ot(i.element));break;case"floating":{const c=this._floatingGroups.find(d=>d.group===i);if(!c)throw new Error("dockview: failed to find floating group");c.dispose();break}case"popout":{const c=this._popoutGroups.find(h=>h.popoutGroup===i);if(!c)throw new Error("dockview: failed to find popout group");const d=this._popoutGroups.indexOf(c);if(d>=0&&this._popoutGroups.splice(d,1),c.referenceGroup){const h=this.getPanel(c.referenceGroup);h&&!h.api.isVisible&&this.doRemoveGroup(h,{skipActive:!0})}c.window.dispose(),a.api.location.type==="grid"?(i.model.renderContainer=this.overlayRenderContainer,i.model.dropTargetContainer=this.rootDropTargetContainer,i.model.location={type:"grid"}):a.api.location.type==="floating"&&(i.model.renderContainer=this.overlayRenderContainer,i.model.dropTargetContainer=this.rootDropTargetContainer,i.model.location={type:"floating"});break}}if(a.api.location.type==="grid"){const c=ot(a.element),d=$n(this.gridview.orientation,c,r);let h;switch(this.gridview.orientation){case be.VERTICAL:h=c.length%2==0?i.api.width:i.api.height;break;case be.HORIZONTAL:h=c.length%2==0?i.api.height:i.api.width;break}this.gridview.addView(i,h,d)}else if(a.api.location.type==="floating"){const c=this._floatingGroups.find(d=>d.group===a);if(c){const d=c.overlay.toJSON();let h,f;"left"in d?h=d.left+50:"right"in d?h=Math.max(0,d.right-d.width-50):h=50,"top"in d?f=d.top+50:"bottom"in d?f=Math.max(0,d.bottom-d.height-50):f=50,this.addFloatingGroup(i,{height:d.height,width:d.width,position:{left:h,top:f}})}}}if(i.panels.forEach(c=>{this._onDidMovePanel.fire({panel:c,from:i})}),this.debouncedUpdateAllPositions(),e.skipSetActive===!1){const c=a??i;this.doSetGroupAndPanelActive(c)}}doSetGroupActive(e){super.doSetGroupActive(e);const i=this.activePanel;!this._moving&&i!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(i)}doSetGroupAndPanelActive(e){super.doSetGroupActive(e);const i=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),!this._moving&&i!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(i)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let i=e?.id;if(i&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${e?.id}. reassigning group id to avoid errors`),i=void 0),!i)for(i=this.nextGroupId.next();this._groups.has(i);)i=this.nextGroupId.next();const a=new Mb(this,i,e);if(a.init({params:{},accessor:this}),!this._groups.has(a.id)){const r=new Ae(a.model.onTabDragStart(c=>{this._onWillDragPanel.fire(c)}),a.model.onGroupDragStart(c=>{this._onWillDragGroup.fire(c)}),a.model.onMove(c=>{const{groupId:d,itemId:h,target:f,index:p}=c;this.moveGroupOrPanel({from:{groupId:d,panelId:h},to:{group:a,position:f,index:p}})}),a.model.onDidDrop(c=>{this._onDidDrop.fire(c)}),a.model.onWillDrop(c=>{this._onWillDrop.fire(c)}),a.model.onWillShowOverlay(c=>{if(this.options.disableDnd){c.preventDefault();return}this._onWillShowOverlay.fire(c)}),a.model.onUnhandledDragOverEvent(c=>{this._onUnhandledDragOverEvent.fire(c)}),a.model.onDidAddPanel(c=>{this._moving||this._onDidAddPanel.fire(c.panel)}),a.model.onDidRemovePanel(c=>{this._moving||this._onDidRemovePanel.fire(c.panel)}),a.model.onDidActivePanelChange(c=>{this._moving||c.panel===this.activePanel&&this._onDidActivePanelChange.value!==c.panel&&this._onDidActivePanelChange.fire(c.panel)}),Rs.any(a.model.onDidPanelTitleChange,a.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(a.id,{value:a,disposable:r})}return a.initialize(),a}createPanel(e,i){var a,r,c;const d=e.component,h=(a=e.tabComponent)!==null&&a!==void 0?a:this.options.defaultTabComponent,f=new _0(this,e.id,d,h),p=new ja(e.id,d,h,this,this._api,i,f,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return p.init({title:(r=e.title)!==null&&r!==void 0?r:e.id,params:(c=e?.params)!==null&&c!==void 0?c:{}}),p}createGroupAtLocation(e,i,a){const r=this.createGroup(a);return this.doAddGroup(r,e,i),r}findGroup(e){var i;return(i=Array.from(this._groups.values()).find(a=>a.value.model.containsPanel(e)))===null||i===void 0?void 0:i.value}orientationAtLocation(e){const i=this.gridview.orientation;return e.length%2==1?i:Wn(i)}updateDropTargetModel(e){"dndEdges"in e&&(this._rootDropTarget.disabled=typeof e.dndEdges=="boolean"&&e.dndEdges===!1,typeof e.dndEdges=="object"&&e.dndEdges!==null?this._rootDropTarget.setOverlayModel(e.dndEdges):this._rootDropTarget.setOverlayModel(Gb)),"rootOverlayModel"in e&&this.updateDropTargetModel({dndEdges:e.dndEdges})}updateTheme(){var e,i;const a=(e=this._options.theme)!==null&&e!==void 0?e:bk;this._themeClassnames.setClassNames(a.className),this.gridview.margin=(i=a.gap)!==null&&i!==void 0?i:0,a.dndOverlayMounting==="absolute"?this.rootDropTargetContainer.disabled=!1:this.rootDropTargetContainer.disabled=!0}}class Ok extends h0{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,i){var a;super(e,{proportionalLayout:(a=i.proportionalLayout)!==null&&a!==void 0?a:!0,orientation:i.orientation,styles:i.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:i.disableAutoResizing,className:i.className}),this._onDidLayoutfromJSON=new ie,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new ie,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new ie,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new ie,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=i,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(r=>{this._onDidAddGroup.fire(r)}),this.onDidRemove(r=>{this._onDidRemoveGroup.fire(r)}),this.onDidActiveChange(r=>{this._onDidActiveGroupChange.fire(r)}))}updateOptions(e){super.updateOptions(e);const i=typeof e.orientation=="string"&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),i&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:(e=this.activeGroup)===null||e===void 0?void 0:e.id}}setVisible(e,i){this.gridview.setViewVisible(ot(e.element),i)}setActive(e){this._groups.forEach((i,a)=>{i.value.setActive(e===i.value)})}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}fromJSON(e){this.clear();const{grid:i,activePanel:a}=e;try{const r=[],c=this.width,d=this.height;if(this.gridview.deserialize(i,{fromJSON:h=>{const{data:f}=h,p=this.options.createComponent({id:f.id,name:f.component});return r.push(()=>p.init({params:f.params,minimumWidth:f.minimumWidth,maximumWidth:f.maximumWidth,minimumHeight:f.minimumHeight,maximumHeight:f.maximumHeight,priority:f.priority,snap:!!f.snap,accessor:this,isVisible:h.visible})),this._onDidAddGroup.fire(p),this.registerPanel(p),p}}),this.layout(c,d,!0),r.forEach(h=>h()),typeof a=="string"){const h=this.getPanel(a);h&&this.doSetGroupActive(h)}}catch(r){for(const c of this.groups)c.dispose(),this._groups.delete(c.id),this._onDidRemoveGroup.fire(c);throw this.clear(),r}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,i=Array.from(this._groups.values());for(const a of i)a.disposable.dispose(),this.doRemoveGroup(a.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,i){var a;let r;const c=this.gridview.remove(e),d=(a=this._groups.get(i.reference))===null||a===void 0?void 0:a.value;if(!d)throw new Error(`reference group ${i.reference} does not exist`);const h=mc(i.direction);if(h==="center")throw new Error(`${h} not supported as an option`);{const f=ot(d.element);r=$n(this.gridview.orientation,f,h)}this.doAddGroup(c,r,i.size)}addPanel(e){var i,a,r,c;let d=(i=e.location)!==null&&i!==void 0?i:[0];if(!((a=e.position)===null||a===void 0)&&a.referencePanel){const f=(r=this._groups.get(e.position.referencePanel))===null||r===void 0?void 0:r.value;if(!f)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const p=mc(e.position.direction);if(p==="center")throw new Error(`${p} not supported as an option`);{const y=ot(f.element);d=$n(this.gridview.orientation,y,p)}}const h=this.options.createComponent({id:e.id,name:e.component});return h.init({params:(c=e.params)!==null&&c!==void 0?c:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(h,d,e.size),this.registerPanel(h),this.doSetGroupActive(h),h}registerPanel(e){const i=new Ae(e.api.onDidFocusChange(a=>{a.isFocused&&this._groups.forEach(r=>{const c=r.value;c!==e?c.setActive(!1):c.setActive(!0)})}));this._groups.set(e.id,{value:e,disposable:i})}moveGroup(e,i,a){const r=this.getPanel(i);if(!r)throw new Error("invalid operation");const c=ot(e.element),d=$n(this.gridview.orientation,c,a),[h,f]=xi(d),p=ot(r.element),[y,b]=xi(p);if(u0(y,h)){this.gridview.moveView(y,b,f);return}const x=this.doRemoveGroup(r,{skipActive:!0,skipDispose:!0}),w=ot(e.element),E=$n(this.gridview.orientation,w,a);this.doAddGroup(x,E)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class zk extends sm{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new Ae(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(i=>this._onDidAddView.fire(i)),this._splitview.onDidRemoveView(i=>this._onDidRemoveView.fire(i)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===be.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===be.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,i){var a;super(document.createElement("div"),i.disableAutoResizing),this._splitviewChangeDisposable=new Pt,this._panels=new Map,this._onDidLayoutfromJSON=new ie,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new ie,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new ie,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new ie,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new Pc(this.element),this._classNames.setClassNames((a=i.className)!==null&&a!==void 0?a:""),e.appendChild(this.element),this._options=i,this.splitview=new Jo(this.element,i),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var i,a;"className"in e&&this._classNames.setClassNames((i=e.className)!==null&&i!==void 0?i:""),"disableResizing"in e&&(this.disableResizing=(a=e.disableAutoResizing)!==null&&a!==void 0?a:!1),typeof e.orientation=="string"&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}movePanel(e,i){this.splitview.moveView(e,i)}setVisible(e,i){const a=this.panels.indexOf(e);this.splitview.setViewVisible(a,i)}setActive(e,i){this._activePanel=e,this.panels.filter(a=>a!==e).forEach(a=>{a.api._onDidActiveChange.fire({isActive:!1}),i||a.focus()}),e.api._onDidActiveChange.fire({isActive:!0}),i||e.focus()}removePanel(e,i){const a=this._panels.get(e.id);if(!a)throw new Error(`unknown splitview panel ${e.id}`);a.dispose(),this._panels.delete(e.id);const r=this.panels.findIndex(h=>h===e);this.splitview.removeView(r,i).dispose();const d=this.panels;d.length>0&&this.setActive(d[d.length-1])}getPanel(e){return this.panels.find(i=>i.id===e)}addPanel(e){var i;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const a=this.options.createComponent({id:e.id,name:e.component});a.orientation=this.splitview.orientation,a.init({params:(i=e.params)!==null&&i!==void 0?i:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const r=typeof e.size=="number"?e.size:Cn.Distribute,c=typeof e.index=="number"?e.index:void 0;return this.splitview.addView(a,r,c),this.doAddView(a),this.setActive(a),a}layout(e,i){const[a,r]=this.splitview.orientation===be.HORIZONTAL?[e,i]:[i,e];this.splitview.layout(a,r)}doAddView(e){const i=e.api.onDidFocusChange(a=>{a.isFocused&&this.setActive(e,!0)});this._panels.set(e.id,i)}toJSON(){var e;return{views:this.splitview.getViews().map((a,r)=>({size:this.splitview.getViewSize(r),data:a.toJSON(),snap:!!a.snap,priority:a.priority})),activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:i,orientation:a,size:r,activeView:c}=e,d=[],h=this.width,f=this.height;if(this.splitview=new Jo(this.element,{orientation:a,proportionalLayout:this.options.proportionalLayout,descriptor:{size:r,views:i.map(p=>{const y=p.data;if(this._panels.has(y.id))throw new Error(`panel ${y.id} already exists`);const b=this.options.createComponent({id:y.id,name:y.component});return d.push(()=>{var x;b.init({params:(x=y.params)!==null&&x!==void 0?x:{},minimumSize:y.minimumSize,maximumSize:y.maximumSize,snap:p.snap,priority:p.priority,accessor:this})}),b.orientation=a,this.doAddView(b),setTimeout(()=>{this._onDidAddView.fire(b)},0),{size:p.size,view:b}})}}),this.layout(h,f),d.forEach(p=>p()),typeof c=="string"){const p=this.getPanel(c);p&&this.setActive(p)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;)this.splitview.removeView(0,Cn.Distribute,!0).dispose()}dispose(){for(const i of this._panels.values())i.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const i of e)i.dispose();this.element.remove(),super.dispose()}}class Bb extends Ae{get element(){return this._element}constructor(){super(),this._expandedIcon=lk(),this._collapsedIcon=x0(),this.disposable=new Pt,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(Pe(this._element,"click",()=>{var e;(e=this.apiRef.api)===null||e===void 0||e.setExpanded(!this.apiRef.api.isExpanded)}))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var e;const i=!!(!((e=this.apiRef.api)===null||e===void 0)&&e.isExpanded);Ee(this._expander,"collapsed",!i),i?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const Mk=im(),Hb=22,Vb=0,Fb=Number.MAX_SAFE_INTEGER;class Ub extends ek{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class Pk extends sm{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new Ae(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(i=>this._onDidAddView.fire(i)),this._paneview.onDidRemoveView(i=>this._onDidRemoveView.fire(i)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===be.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===be.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,i){var a;super(document.createElement("div"),i.disableAutoResizing),this._id=Mk.next(),this._disposable=new Pt,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new ie,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new ie,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new ie,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new ie,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new ie,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOverEvent=new ie,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOverEvent),this._classNames=new Pc(this.element),this._classNames.setClassNames((a=i.className)!==null&&a!==void 0?a:""),e.appendChild(this.element),this._options=i,this.paneview=new Ob(this.element,{orientation:be.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,i){const a=this.panels.indexOf(e);this.paneview.setViewVisible(a,i)}focus(){}updateOptions(e){var i,a;"className"in e&&this._classNames.setClassNames((i=e.className)!==null&&i!==void 0?i:""),"disableResizing"in e&&(this.disableResizing=(a=e.disableAutoResizing)!==null&&a!==void 0?a:!1),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var i,a;const r=this.options.createComponent({id:e.id,name:e.component});let c;e.headerComponent&&this.options.createHeaderComponent&&(c=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),c||(c=new Bb);const d=new Ub({id:e.id,component:e.component,headerComponent:e.headerComponent,header:c,body:r,orientation:be.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(i=e.headerSize)!==null&&i!==void 0?i:Hb,minimumBodySize:Vb,maximumBodySize:Fb});this.doAddPanel(d);const h=typeof e.size=="number"?e.size:Cn.Distribute,f=typeof e.index=="number"?e.index:void 0;return d.init({params:(a=e.params)!==null&&a!==void 0?a:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new er(this),accessor:this}),this.paneview.addPane(d,h,f),d.orientation=this.paneview.orientation,d}removePanel(e){const a=this.panels.findIndex(r=>r===e);this.paneview.removePane(a),this.doRemovePanel(e)}movePanel(e,i){this.paneview.moveView(e,i)}getPanel(e){return this.panels.find(i=>i.id===e)}layout(e,i){const[a,r]=this.paneview.orientation===be.HORIZONTAL?[e,i]:[i,e];this.paneview.layout(a,r)}toJSON(){const e=r=>r===Number.MAX_SAFE_INTEGER||r===Number.POSITIVE_INFINITY?void 0:r,i=r=>r<=0?void 0:r;return{views:this.paneview.getPanes().map((r,c)=>({size:this.paneview.getViewSize(c),data:r.toJSON(),minimumSize:i(r.minimumBodySize),maximumSize:e(r.maximumBodySize),headerSize:r.headerSize,expanded:r.isExpanded()})),size:this.paneview.size}}fromJSON(e){this.clear();const{views:i,size:a}=e,r=[],c=this.width,d=this.height;this.paneview=new Ob(this.element,{orientation:be.VERTICAL,descriptor:{size:a,views:i.map(h=>{var f,p,y;const b=h.data,x=this.options.createComponent({id:b.id,name:b.component});let w;b.headerComponent&&this.options.createHeaderComponent&&(w=this.options.createHeaderComponent({id:b.id,name:b.headerComponent})),w||(w=new Bb);const E=new Ub({id:b.id,component:b.component,headerComponent:b.headerComponent,header:w,body:x,orientation:be.VERTICAL,isExpanded:!!h.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(f=h.headerSize)!==null&&f!==void 0?f:Hb,minimumBodySize:(p=h.minimumSize)!==null&&p!==void 0?p:Vb,maximumBodySize:(y=h.maximumSize)!==null&&y!==void 0?y:Fb});return this.doAddPanel(E),r.push(()=>{var _;E.init({params:(_=b.params)!==null&&_!==void 0?_:{},minimumBodySize:h.minimumSize,maximumBodySize:h.maximumSize,title:b.title,isExpanded:!!h.expanded,containerApi:new er(this),accessor:this}),E.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(E)},0),{size:h.size,view:E}})}}),this.layout(c,d),r.forEach(h=>h()),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,i]of this._viewDisposables.entries())i.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const i=new Ae(e.onDidDrop(a=>{this._onDidDrop.fire(a)}),e.onUnhandledDragOverEvent(a=>{this._onUnhandledDragOverEvent.fire(a)}));this._viewDisposables.set(e.id,i)}doRemovePanel(e){const i=this._viewDisposables.get(e.id);i&&(i.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,i]of this._viewDisposables.entries())i.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}class Lk extends om{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=typeof this._minimumSize=="function"?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e=typeof this._maximumSize=="function"?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,i){super(e,i,new y0(e,i)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(a=>{const{isVisible:r}=a,{accessor:c}=this._params;c.setVisible(this,r)}),this.api.onActiveChange(()=>{const{accessor:a}=this._params;a.setActive(this)}),this.api.onDidConstraintsChangeInternal(a=>{(typeof a.minimumSize=="number"||typeof a.minimumSize=="function")&&(this._minimumSize=a.minimumSize),(typeof a.maximumSize=="number"||typeof a.maximumSize=="function")&&(this._maximumSize=a.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(a=>{this._onDidChange.fire({size:a.size})}))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,i){const[a,r]=this.orientation===be.HORIZONTAL?[e,i]:[i,e];super.layout(a,r)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){const e=a=>a===Number.MAX_SAFE_INTEGER||a===Number.POSITIVE_INFINITY?void 0:a,i=a=>a<=0?void 0:a;return Object.assign(Object.assign({},super.toJSON()),{minimumSize:i(this.minimumSize),maximumSize:e(this.maximumSize)})}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}function Ik(n,e){return new Rk(n,e).api}function Gk(n,e){const i=new zk(n,e);return new f0(i)}function Bk(n,e){const i=new Ok(n,e);return new m0(i)}function Hk(n,e){const i=new Pk(n,e);return new er(i)}const E0=(n,e)=>{const[i,a]=ue.useState(),r=ue.useRef(n.componentProps);return ue.useImperativeHandle(e,()=>({update:c=>{r.current=Object.assign(Object.assign({},r.current),c),a(Date.now())}}),[]),ue.createElement(n.component,r.current)};E0.displayName="DockviewReactJsBridge";const Vk=(()=>{let n=1;return{next:()=>`dockview_react_portal_key_${(n++).toString()}`}})(),Fk=ue.createContext({});class Is{constructor(e,i,a,r,c){this.parent=e,this.portalStore=i,this.component=a,this.parameters=r,this.context=c,this._initialProps={},this.disposed=!1,this.createPortal()}update(e){if(this.disposed)throw new Error("invalid operation: resource is already disposed");this.componentInstance?this.componentInstance.update(e):this._initialProps=Object.assign(Object.assign({},this._initialProps),e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if(!Uk(this.component))throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");const e=ue.createElement(ue.forwardRef(E0),{component:this.component,componentProps:this.parameters,ref:r=>{this.componentInstance=r,Object.keys(this._initialProps).length>0&&(this.componentInstance.update(this._initialProps),this._initialProps={})}}),i=this.context?ue.createElement(Fk.Provider,{value:this.context},e):e,a=Sw.createPortal(i,this.parent,Vk.next());this.ref={portal:a,disposable:this.portalStore.addPortal(a)}}dispose(){var e;(e=this.ref)===null||e===void 0||e.disposable.dispose(),this.disposed=!0}}const Gc=()=>{const[n,e]=ue.useState([]);ue.useDebugValue(`Portal count: ${n.length}`);const i=ue.useCallback(a=>{e(c=>[...c,a]);let r=!1;return yt.from(()=>{if(r)throw new Error("invalid operation: resource already disposed");r=!0,e(c=>c.filter(d=>d!==a))})},[]);return[n,i]};function Uk(n){return typeof n=="function"||!!n?.$$typeof}class $b{get element(){return this._element}constructor(e,i,a){this.id=e,this.component=i,this.reactPortalStore=a,this._onDidFocus=new ie,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new ie,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new Is(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var i;(i=this.part)===null||i===void 0||i.update({params:e.params})}layout(e,i){}dispose(){var e;this._onDidFocus.dispose(),this._onDidBlur.dispose(),(e=this.part)===null||e===void 0||e.dispose()}}class Wb{get element(){return this._element}constructor(e,i,a){this.id=e,this.component=i,this.reactPortalStore=a,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new Is(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,tabLocation:e.tabLocation})}update(e){var i;(i=this.part)===null||i===void 0||i.update({params:e.params})}layout(e,i){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class qb{get element(){return this._element}constructor(e,i,a){this.id=e,this.component=i,this.reactPortalStore=a,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Is(this.element,this.reactPortalStore,this.component,{group:e.group,containerApi:e.containerApi})}focus(){}update(e){var i,a,r;this.parameters&&(this.parameters.params=e.params),(i=this.part)===null||i===void 0||i.update({params:(r=(a=this.parameters)===null||a===void 0?void 0:a.params)!==null&&r!==void 0?r:{}})}layout(e,i){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class $k{get element(){return this._element}get part(){return this._part}constructor(e,i,a){this.component=e,this.reactPortalStore=i,this._group=a,this.mutableDisposable=new Pt,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.mutableDisposable.value=new Ae(this._group.model.onDidAddPanel(()=>{this.updatePanels()}),this._group.model.onDidRemovePanel(()=>{this.updatePanels()}),this._group.model.onDidActivePanelChange(()=>{this.updateActivePanel()}),e.api.onDidActiveChange(()=>{this.updateGroupActive()})),this._part=new Is(this.element,this.reactPortalStore,this.component,{api:e.api,containerApi:e.containerApi,panels:this._group.model.panels,activePanel:this._group.model.activePanel,isGroupActive:this._group.api.isActive,group:this._group})}dispose(){var e;this.mutableDisposable.dispose(),(e=this._part)===null||e===void 0||e.dispose()}update(e){var i;(i=this._part)===null||i===void 0||i.update(e.params)}updatePanels(){this.update({params:{panels:this._group.model.panels}})}updateActivePanel(){this.update({params:{activePanel:this._group.model.activePanel}})}updateGroupActive(){this.update({params:{isGroupActive:this._group.api.isActive}})}}function _a(n,e){return n?i=>new $k(n,e,i):void 0}const Bl="props.defaultTabComponent";function Wk(n){return yf.reduce((i,a)=>(a in n&&(i[a]=n[a]),i),{})}const dm=ue.forwardRef((n,e)=>{const i=ue.useRef(null),a=ue.useRef(),[r,c]=Gc();ue.useImperativeHandle(e,()=>i.current,[]);const d=ue.useRef({});return ue.useEffect(()=>{const h={};yf.forEach(f=>{const p=f,y=n[p];p in n&&y!==d.current[p]&&(h[p]=y)}),a.current&&a.current.updateOptions(h),d.current=n},yf.map(h=>n[h])),ue.useEffect(()=>{var h;if(!i.current)return;const f=(h=n.tabComponents)!==null&&h!==void 0?h:{};n.defaultTabComponent&&(f[Bl]=n.defaultTabComponent);const p={createLeftHeaderActionComponent:_a(n.leftHeaderActionsComponent,{addPortal:c}),createRightHeaderActionComponent:_a(n.rightHeaderActionsComponent,{addPortal:c}),createPrefixHeaderActionComponent:_a(n.prefixHeaderActionsComponent,{addPortal:c}),createComponent:w=>new $b(w.id,n.components[w.name],{addPortal:c}),createTabComponent(w){return new Wb(w.id,f[w.name],{addPortal:c})},createWatermarkComponent:n.watermarkComponent?()=>new qb("watermark",n.watermarkComponent,{addPortal:c}):void 0,defaultTabComponent:n.defaultTabComponent?Bl:void 0},y=Ik(i.current,Object.assign(Object.assign({},Wk(n)),p)),{clientWidth:b,clientHeight:x}=i.current;return y.layout(b,x),n.onReady&&n.onReady({api:y}),a.current=y,()=>{a.current=void 0,y.dispose()}},[]),ue.useEffect(()=>{if(!a.current)return()=>{};const h=a.current.onDidDrop(f=>{n.onDidDrop&&n.onDidDrop(f)});return()=>{h.dispose()}},[n.onDidDrop]),ue.useEffect(()=>{if(!a.current)return()=>{};const h=a.current.onWillDrop(f=>{n.onWillDrop&&n.onWillDrop(f)});return()=>{h.dispose()}},[n.onWillDrop]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createComponent:h=>new $b(h.id,n.components[h.name],{addPortal:c})})},[n.components]),ue.useEffect(()=>{var h;if(!a.current)return;const f=(h=n.tabComponents)!==null&&h!==void 0?h:{};n.defaultTabComponent&&(f[Bl]=n.defaultTabComponent),a.current.updateOptions({defaultTabComponent:n.defaultTabComponent?Bl:void 0,createTabComponent(p){return new Wb(p.id,f[p.name],{addPortal:c})}})},[n.tabComponents,n.defaultTabComponent]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createWatermarkComponent:n.watermarkComponent?()=>new qb("watermark",n.watermarkComponent,{addPortal:c}):void 0})},[n.watermarkComponent]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createRightHeaderActionComponent:_a(n.rightHeaderActionsComponent,{addPortal:c})})},[n.rightHeaderActionsComponent]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createLeftHeaderActionComponent:_a(n.leftHeaderActionsComponent,{addPortal:c})})},[n.leftHeaderActionsComponent]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createPrefixHeaderActionComponent:_a(n.prefixHeaderActionsComponent,{addPortal:c})})},[n.prefixHeaderActionsComponent]),ue.createElement("div",{style:{height:"100%",width:"100%"},ref:i},r)});dm.displayName="DockviewComponent";const qk=()=>ue.createElement("svg",{height:"11",width:"11",viewBox:"0 0 28 28","aria-hidden":"false",focusable:!1,className:"dv-svg"},ue.createElement("path",{d:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}));var Yk=function(n,e){var i={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&e.indexOf(a)<0&&(i[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(n);r<a.length;r++)e.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(n,a[r])&&(i[a[r]]=n[a[r]]);return i};function Xk(n){const[e,i]=ue.useState(n.title);return ue.useEffect(()=>{const a=n.onDidTitleChange(r=>{i(r.title)});return e!==n.title&&i(n.title),()=>{a.dispose()}},[n]),e}const D0=n=>{var{api:e,containerApi:i,params:a,hideClose:r,closeActionOverride:c,onPointerDown:d,onPointerUp:h,onPointerLeave:f,tabLocation:p}=n,y=Yk(n,["api","containerApi","params","hideClose","closeActionOverride","onPointerDown","onPointerUp","onPointerLeave","tabLocation"]);const b=Xk(e),x=ue.useRef(!1),w=ue.useCallback(N=>{N.preventDefault(),c?c():e.close()},[e,c]),E=ue.useCallback(N=>{N.preventDefault()},[]),_=ue.useCallback(N=>{x.current=N.button===1,d?.(N)},[d]),C=ue.useCallback(N=>{x&&N.button===1&&!r&&(x.current=!1,w(N)),h?.(N)},[h,w,r]),D=ue.useCallback(N=>{x.current=!1,f?.(N)},[f]);return ue.createElement("div",Object.assign({"data-testid":"dockview-dv-default-tab"},y,{onPointerDown:_,onPointerUp:C,onPointerLeave:D,className:"dv-default-tab"}),ue.createElement("span",{className:"dv-default-tab-content"},b),!r&&ue.createElement("div",{className:"dv-default-tab-action",onPointerDown:E,onClick:w},ue.createElement(qk,null)))};class Yb extends Lk{constructor(e,i,a,r){super(e,i),this.reactComponent=a,this.reactPortalStore=r}getComponent(){var e,i;return new Is(this.element,this.reactPortalStore,this.reactComponent,{params:(i=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&i!==void 0?i:{},api:this.api,containerApi:new f0(this._params.accessor)})}}function Qk(n){return hf.reduce((i,a)=>(a in n&&(i[a]=n[a]),i),{})}const Zk=ue.forwardRef((n,e)=>{const i=ue.useRef(null),a=ue.useRef(),[r,c]=Gc();ue.useImperativeHandle(e,()=>i.current,[]);const d=ue.useRef({});return ue.useEffect(()=>{const h={};hf.forEach(f=>{const p=f,y=n[p];p in n&&y!==d.current[p]&&(h[p]=y)}),a.current&&a.current.updateOptions(h),d.current=n},hf.map(h=>n[h])),ue.useEffect(()=>{if(!i.current)return()=>{};const h={createComponent:b=>new Yb(b.id,b.name,n.components[b.name],{addPortal:c})},f=Gk(i.current,Object.assign(Object.assign({},Qk(n)),h)),{clientWidth:p,clientHeight:y}=i.current;return f.layout(p,y),n.onReady&&n.onReady({api:f}),a.current=f,()=>{a.current=void 0,f.dispose()}},[]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createComponent:h=>new Yb(h.id,h.name,n.components[h.name],{addPortal:c})})},[n.components]),ue.createElement("div",{style:{height:"100%",width:"100%"},ref:i},r)});Zk.displayName="SplitviewComponent";class Xb extends C0{constructor(e,i,a,r){super(e,i),this.reactComponent=a,this.reactPortalStore=r}getComponent(){var e,i;return new Is(this.element,this.reactPortalStore,this.reactComponent,{params:(i=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&i!==void 0?i:{},api:this.api,containerApi:new m0(this._params.accessor)})}}function Kk(n){return gf.reduce((i,a)=>(a in n&&(i[a]=n[a]),i),{})}const Jk=ue.forwardRef((n,e)=>{const i=ue.useRef(null),a=ue.useRef(),[r,c]=Gc();ue.useImperativeHandle(e,()=>i.current,[]);const d=ue.useRef({});return ue.useEffect(()=>{const h={};gf.forEach(f=>{const p=f,y=n[p];p in n&&y!==d.current[p]&&(h[p]=y)}),a.current&&a.current.updateOptions(h),d.current=n},gf.map(h=>n[h])),ue.useEffect(()=>{if(!i.current)return()=>{};const h={createComponent:b=>new Xb(b.id,b.name,n.components[b.name],{addPortal:c})},f=Bk(i.current,Object.assign(Object.assign({},Kk(n)),h)),{clientWidth:p,clientHeight:y}=i.current;return f.layout(p,y),n.onReady&&n.onReady({api:f}),a.current=f,()=>{a.current=void 0,f.dispose()}},[]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createComponent:h=>new Xb(h.id,h.name,n.components[h.name],{addPortal:c})})},[n.components]),ue.createElement("div",{style:{height:"100%",width:"100%"},ref:i},r)});Jk.displayName="GridviewComponent";class Hl{get element(){return this._element}constructor(e,i,a){this.id=e,this.component=i,this.reactPortalStore=a,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Is(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var i;(i=this.part)===null||i===void 0||i.update(e.params)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function eR(n){return vf.reduce((i,a)=>(a in n&&(i[a]=n[a]),i),{})}const tR=ue.forwardRef((n,e)=>{const i=ue.useRef(null),a=ue.useRef(),[r,c]=Gc();ue.useImperativeHandle(e,()=>i.current,[]);const d=ue.useRef({});return ue.useEffect(()=>{const h={};vf.forEach(f=>{const p=f,y=n[p];p in n&&y!==d.current[p]&&(h[p]=y)}),a.current&&a.current.updateOptions(h),d.current=n},vf.map(h=>n[h])),ue.useEffect(()=>{var h;if(!i.current)return()=>{};const f=(h=n.headerComponents)!==null&&h!==void 0?h:{},p={createComponent:w=>new Hl(w.id,n.components[w.name],{addPortal:c}),createHeaderComponent:w=>new Hl(w.id,f[w.name],{addPortal:c})},y=Hk(i.current,Object.assign(Object.assign({},eR(n)),p)),{clientWidth:b,clientHeight:x}=i.current;return y.layout(b,x),n.onReady&&n.onReady({api:y}),a.current=y,()=>{a.current=void 0,y.dispose()}},[]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createComponent:h=>new Hl(h.id,n.components[h.name],{addPortal:c})})},[n.components]),ue.useEffect(()=>{var h;if(!a.current)return;const f=(h=n.headerComponents)!==null&&h!==void 0?h:{};a.current.updateOptions({createHeaderComponent:p=>new Hl(p.id,f[p.name],{addPortal:c})})},[n.headerComponents]),ue.useEffect(()=>{if(!a.current)return()=>{};const h=a.current.onDidDrop(f=>{n.onDidDrop&&n.onDidDrop(f)});return()=>{h.dispose()}},[n.onDidDrop]),ue.createElement("div",{style:{height:"100%",width:"100%"},ref:i},r)});tR.displayName="PaneviewComponent";class hm extends m.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,i){const a=this.props.panelName?` in ${this.props.panelName}`:"";console.error(`[ErrorBoundary] Caught error${a}:`,e,i)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:l.jsxs("div",{className:"error-boundary-fallback",style:{padding:"16px",color:"var(--status-error, #ef4444)",backgroundColor:"var(--bg-tertiary, #0f0f1a)",border:"1px solid var(--status-error, #ef4444)",borderRadius:"4px",margin:"8px"},children:[l.jsx("h4",{style:{margin:"0 0 8px 0"},children:this.props.panelName?`${this.props.panelName} Error`:"Panel Error"}),l.jsx("pre",{style:{margin:0,fontSize:"12px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:this.state.error?.message})]}):this.props.children}}const tr=new Map,Qb={small:1024,large:1440},gc={medium:300,large:400},vc={width:800,height:600};function nR(n){return n<Qb.small?"small":n>=Qb.large?"large":"medium"}function iR(n){return n==="large"?gc.large:gc.medium}function sR(n,e){return{width:n<vc.width,height:e<vc.height}}function aR(){const n=m.useCallback(()=>({width:typeof window<"u"?window.innerWidth:1200,height:typeof window<"u"?window.innerHeight:800}),[]),[e,i]=m.useState(n);m.useEffect(()=>{const c=()=>{i(n())};return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[n]);const a=nR(e.width),r=sR(e.width,e.height);return{breakpoint:a,isSmall:a==="small",isMedium:a==="medium",isLarge:a==="large",width:e.width,height:e.height,sidebarWidth:iR(a),isBelowMinimum:r.width||r.height,minimumViolation:r}}function A0(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),c=m.useRef(null),d=m.useRef(),h=m.useRef(!0),f=m.useRef(n);f.current=n;const p=m.useRef(null);return m.useEffect(()=>{h.current=!0;const b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/focus`,x=E=>{const _=f.current;if(_)if(E!==null){const C=_.getPanel(E);if(!C)return;_.groups.length>1?_.maximizeGroup(C):(p.current||(p.current=_.activePanel?.id??null),C.api.setActive()),r(!0),i(E)}else{if(_.hasMaximizedGroup())_.exitMaximizedGroup();else if(p.current){const D=_.getPanel(p.current);D&&D.api.setActive()}p.current=null,r(!1),i(null)}},w=()=>{h.current&&(c.current=new WebSocket(b),c.current.onmessage=E=>{try{const _=JSON.parse(E.data);_.type==="update"&&x(_.focus)}catch{}},c.current.onclose=()=>{d.current=setTimeout(w,2e3)})};return w(),()=>{h.current=!1,d.current&&clearTimeout(d.current),c.current&&c.current.close()}},[]),{focusedPanel:e,isInFocusMode:a}}const Ze={CHANGED:"changed",DIFFS:"diffs",DEBUG:"debug",AUDIT_LOG:"audit-log",MESSAGE:"message",SPRINT:"sprint",WORKFLOW:"workflow",AC:"ac",TODO:"todo",BACKGROUND:"background",GIT:"git",SETTINGS:"settings",PROGRESS:"progress"};function En(n,e){tr.set(n,e)}let Kl=null;const Ts=[Ze.CHANGED,Ze.DIFFS,Ze.DEBUG,Ze.AUDIT_LOG],ks=[Ze.SPRINT,Ze.WORKFLOW,Ze.AC,Ze.TODO,Ze.BACKGROUND,Ze.GIT,Ze.SETTINGS],Ta={changed:"Changed",diffs:"Diffs",debug:"Debug","audit-log":"Audit Log",message:"Message",sprint:"Sprint",workflow:"Workflow",ac:"AC",todo:"Todo",background:"Subagents",git:"Git",settings:"Settings",progress:"Progress"},Jl=new Set;function Zb(n){const e=Kl;if(!e||e.getPanel(n))return!1;const i=Ts.includes(n),a=ks.includes(n);let r;if(i)for(const c of Ts){const d=e.getPanel(c);if(d){r=d;break}}else if(a)for(const c of ks){const d=e.getPanel(c);if(d){r=d;break}}return e.addPanel({id:n,component:"PanelAdapter",params:{panelId:n},position:r?{referencePanel:r.id}:void 0,title:Ta[n]||n}),Jl.delete(n),!0}function oR({params:n}){const e=tr.get(n.panelId);return e?l.jsx("div",{"data-testid":`panel-${n.panelId}`,className:"dockview-panel-content",children:l.jsx(hm,{panelName:n.panelId,children:l.jsx("div",{className:"error-boundary-wrapper",children:l.jsx(e,{})})})}):(console.warn(`[DockviewWorkspace] No component registered for panel: ${n.panelId}`),null)}function rR({initialLayout:n,onLayoutChange:e}){const i=m.useRef(null),[a,r]=m.useState(null),{isSmall:c,isBelowMinimum:d,sidebarWidth:h}=aR(),[f,p]=m.useState(!1),[y,b]=m.useState([]),[x,w]=m.useState(!1),E=m.useRef(null);A0(a);const _=m.useRef(!1),C=m.useRef(null),D=m.useCallback(()=>{b(Array.from(Jl))},[]),N=m.useCallback(O=>{const A=O.api;if(i.current=A,Kl=A,r(A),n&&n.grid&&n.panels)try{A.fromJSON(n);const ne=A.getPanel(Ze.MESSAGE);ne?.group&&(ne.group.locked="no-drop-target",ne.group.model.header.hidden=!0),p(!0);return}catch(ne){console.warn("[DockviewWorkspace] Failed to restore layout from JSON, building default:",ne)}const G=A.addPanel({id:Ts[0],component:"PanelAdapter",params:{panelId:Ts[0]},title:Ta[Ts[0]]});for(let ne=1;ne<Ts.length;ne++){const W=Ts[ne];tr.has(W)&&A.addPanel({id:W,component:"PanelAdapter",params:{panelId:W},position:{referencePanel:G.id},title:Ta[W]})}const U=A.addPanel({id:Ze.MESSAGE,component:"PanelAdapter",params:{panelId:Ze.MESSAGE},position:{referencePanel:G.id,direction:"right"},title:Ta[Ze.MESSAGE]}),B=A.addPanel({id:ks[0],component:"PanelAdapter",params:{panelId:ks[0]},position:{referencePanel:U.id,direction:"right"},title:Ta[ks[0]]});for(let ne=1;ne<ks.length;ne++){const W=ks[ne];tr.has(W)&&A.addPanel({id:W,component:"PanelAdapter",params:{panelId:W},position:{referencePanel:B.id},title:Ta[W]})}U?.group&&(U.group.locked="no-drop-target",U.group.model.header.hidden=!0);const $=G.group,ae=B.group;$&&$.api.setSize({width:gc.medium}),ae&&ae.api.setSize({width:gc.medium}),p(!0)},[n]),k=m.useCallback(()=>{const O=i.current;!O||!e||O.panels.length!==0&&(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{const A=O.toJSON();A.panels&&Object.keys(A.panels).length>0&&e(A)},300))},[e]);m.useEffect(()=>{const O=i.current;if(!O||!f)return;const A=[O.onDidLayoutChange(()=>k()),O.onDidAddPanel(G=>{const U=G?.panel?.id;U&&Jl.delete(U),D(),k()}),O.onDidRemovePanel(G=>{const U=G?.panel?.id;U&&(Jl.add(U),D()),k()})];return()=>{A.forEach(G=>G.dispose())}},[f,k]),m.useEffect(()=>{const O=i.current;if(!O||!f)return;if(!_.current){_.current=!0,C.current=c;return}if(C.current===c)return;C.current=c;const A=O.getPanel(Ze.CHANGED),G=O.getPanel(Ze.SPRINT),U=A?.group,B=G?.group;c?(U?.api.setSize({width:0}),B?.api.setSize({width:0})):(U?.api.setSize({width:h}),B?.api.setSize({width:h}))},[c,h,f]);const T=m.useCallback(O=>{Zb(O),w(!1)},[]);m.useEffect(()=>()=>{E.current&&clearTimeout(E.current),Kl=null},[]),m.useEffect(()=>{const O=window.location.protocol==="https:"?"wss:":"ws:",A=new WebSocket(`${O}//${window.location.host}/ws/settings`);return A.onmessage=G=>{try{const U=JSON.parse(G.data);if(U.type==="panel:toggle"&&U.panelId){const B=Kl;if(!B)return;const $=B.getPanel(U.panelId);$?$.api.close():Zb(U.panelId)}}catch{}},()=>A.close()},[]);const R={PanelAdapter:oR},z={changed:"Changed Files",diffs:"Diffs",debug:"Debug","audit-log":"Audit Log",sprint:"Sprint",workflow:"Workflow",ac:"AC",todo:"Todo",background:"Subagents",git:"Git",hotspots:"Hotspots",settings:"Settings"};return l.jsxs("div",{className:"cyclist-dockview","data-dockview-group":"container",children:[d&&l.jsxs("div",{"data-testid":"min-dimension-warning",className:"min-dimension-warning",role:"alert",children:["Window is below minimum size (",vc.width,"x",vc.height,")"]}),y.length>0&&l.jsxs("div",{className:"panel-restore-container",children:[l.jsx(St,{delayDuration:300,children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs(Ce,{variant:"outline",size:"sm",className:"panel-restore-button",onClick:()=>w(!x),"aria-expanded":x,"aria-haspopup":"menu",children:[l.jsx("span",{className:"panel-restore-icon",children:"+"}),l.jsx("span",{className:"panel-restore-count",children:y.length})]})}),l.jsx(Te,{children:"Restore closed panels"})]})}),x&&l.jsxs("div",{className:"panel-restore-menu",role:"menu",children:[l.jsx("div",{className:"panel-restore-header",children:"Restore Panel"}),y.map(O=>l.jsx(Ce,{variant:"ghost",className:"panel-restore-item",onClick:()=>T(O),role:"menuitem",children:z[O]||O},O))]})]}),l.jsx(dm,{className:"dockview-container",onReady:N,components:R,defaultTabComponent:O=>l.jsx(D0,{...O,hideClose:!0}),watermarkComponent:()=>null})]})}var Kb=1,lR=.9,cR=.8,uR=.17,Mh=.1,Ph=.999,dR=.9999,hR=.99,fR=/[\\\/_+.#"@\[\(\{&]/,mR=/[\\\/_+.#"@\[\(\{&]/g,pR=/[\s-]/,N0=/[\s-]/g;function bf(n,e,i,a,r,c,d){if(c===e.length)return r===n.length?Kb:hR;var h=`${r},${c}`;if(d[h]!==void 0)return d[h];for(var f=a.charAt(c),p=i.indexOf(f,r),y=0,b,x,w,E;p>=0;)b=bf(n,e,i,a,p+1,c+1,d),b>y&&(p===r?b*=Kb:fR.test(n.charAt(p-1))?(b*=cR,w=n.slice(r,p-1).match(mR),w&&r>0&&(b*=Math.pow(Ph,w.length))):pR.test(n.charAt(p-1))?(b*=lR,E=n.slice(r,p-1).match(N0),E&&r>0&&(b*=Math.pow(Ph,E.length))):(b*=uR,r>0&&(b*=Math.pow(Ph,p-r))),n.charAt(p)!==e.charAt(c)&&(b*=dR)),(b<Mh&&i.charAt(p-1)===a.charAt(c+1)||a.charAt(c+1)===a.charAt(c)&&i.charAt(p-1)!==a.charAt(c))&&(x=bf(n,e,i,a,p+1,c+2,d),x*Mh>b&&(b=x*Mh)),b>y&&(y=b),p=i.indexOf(f,p+1);return d[h]=y,y}function Jb(n){return n.toLowerCase().replace(N0," ")}function gR(n,e,i){return n=i&&i.length>0?`${n+" "+i.join(" ")}`:n,bf(n,e,Jb(n),Jb(e),0,0,{})}var Lh="focusScope.autoFocusOnMount",Ih="focusScope.autoFocusOnUnmount",ex={bubbles:!1,cancelable:!0},vR="FocusScope",Bc=m.forwardRef((n,e)=>{const{loop:i=!1,trapped:a=!1,onMountAutoFocus:r,onUnmountAutoFocus:c,...d}=n,[h,f]=m.useState(null),p=Gt(r),y=Gt(c),b=m.useRef(null),x=Ie(e,_=>f(_)),w=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(a){let _=function(k){if(w.paused||!h)return;const T=k.target;h.contains(T)?b.current=T:Zi(b.current,{select:!0})},C=function(k){if(w.paused||!h)return;const T=k.relatedTarget;T!==null&&(h.contains(T)||Zi(b.current,{select:!0}))},D=function(k){if(document.activeElement===document.body)for(const R of k)R.removedNodes.length>0&&Zi(h)};document.addEventListener("focusin",_),document.addEventListener("focusout",C);const N=new MutationObserver(D);return h&&N.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",C),N.disconnect()}}},[a,h,w.paused]),m.useEffect(()=>{if(h){nx.add(w);const _=document.activeElement;if(!h.contains(_)){const D=new CustomEvent(Lh,ex);h.addEventListener(Lh,p),h.dispatchEvent(D),D.defaultPrevented||(yR(CR(j0(h)),{select:!0}),document.activeElement===_&&Zi(h))}return()=>{h.removeEventListener(Lh,p),setTimeout(()=>{const D=new CustomEvent(Ih,ex);h.addEventListener(Ih,y),h.dispatchEvent(D),D.defaultPrevented||Zi(_??document.body,{select:!0}),h.removeEventListener(Ih,y),nx.remove(w)},0)}}},[h,p,y,w]);const E=m.useCallback(_=>{if(!i&&!a||w.paused)return;const C=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,D=document.activeElement;if(C&&D){const N=_.currentTarget,[k,T]=bR(N);k&&T?!_.shiftKey&&D===T?(_.preventDefault(),i&&Zi(k,{select:!0})):_.shiftKey&&D===k&&(_.preventDefault(),i&&Zi(T,{select:!0})):D===N&&_.preventDefault()}},[i,a,w.paused]);return l.jsx(je.div,{tabIndex:-1,...d,ref:x,onKeyDown:E})});Bc.displayName=vR;function yR(n,{select:e=!1}={}){const i=document.activeElement;for(const a of n)if(Zi(a,{select:e}),document.activeElement!==i)return}function bR(n){const e=j0(n),i=tx(e,n),a=tx(e.reverse(),n);return[i,a]}function j0(n){const e=[],i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const r=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||r?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)e.push(i.currentNode);return e}function tx(n,e){for(const i of n)if(!xR(i,{upTo:e}))return i}function xR(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function wR(n){return n instanceof HTMLInputElement&&"select"in n}function Zi(n,{select:e=!1}={}){if(n&&n.focus){const i=document.activeElement;n.focus({preventScroll:!0}),n!==i&&wR(n)&&e&&n.select()}}var nx=SR();function SR(){let n=[];return{add(e){const i=n[0];e!==i&&i?.pause(),n=ix(n,e),n.unshift(e)},remove(e){n=ix(n,e),n[0]?.resume()}}}function ix(n,e){const i=[...n],a=i.indexOf(e);return a!==-1&&i.splice(a,1),i}function CR(n){return n.filter(e=>e.tagName!=="A")}var Gh=0;function fm(){m.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??sx()),document.body.insertAdjacentElement("beforeend",n[1]??sx()),Gh++,()=>{Gh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Gh--}},[])}function sx(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var qn=function(){return qn=Object.assign||function(e){for(var i,a=1,r=arguments.length;a<r;a++){i=arguments[a];for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(e[c]=i[c])}return e},qn.apply(this,arguments)};function T0(n,e){var i={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&e.indexOf(a)<0&&(i[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(n);r<a.length;r++)e.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(n,a[r])&&(i[a[r]]=n[a[r]]);return i}function _R(n,e,i){if(i||arguments.length===2)for(var a=0,r=e.length,c;a<r;a++)(c||!(a in e))&&(c||(c=Array.prototype.slice.call(e,0,a)),c[a]=e[a]);return n.concat(c||Array.prototype.slice.call(e))}var ec="right-scroll-bar-position",tc="width-before-scroll-bar",ER="with-scroll-bars-hidden",DR="--removed-body-scroll-bar-size";function Bh(n,e){return typeof n=="function"?n(e):n&&(n.current=e),n}function AR(n,e){var i=m.useState(function(){return{value:n,callback:e,facade:{get current(){return i.value},set current(a){var r=i.value;r!==a&&(i.value=a,i.callback(a,r))}}}})[0];return i.callback=e,i.facade}var NR=typeof window<"u"?m.useLayoutEffect:m.useEffect,ax=new WeakMap;function jR(n,e){var i=AR(null,function(a){return n.forEach(function(r){return Bh(r,a)})});return NR(function(){var a=ax.get(i);if(a){var r=new Set(a),c=new Set(n),d=i.current;r.forEach(function(h){c.has(h)||Bh(h,null)}),c.forEach(function(h){r.has(h)||Bh(h,d)})}ax.set(i,n)},[n]),i}function TR(n){return n}function kR(n,e){e===void 0&&(e=TR);var i=[],a=!1,r={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:n},useMedium:function(c){var d=e(c,a);return i.push(d),function(){i=i.filter(function(h){return h!==d})}},assignSyncMedium:function(c){for(a=!0;i.length;){var d=i;i=[],d.forEach(c)}i={push:function(h){return c(h)},filter:function(){return i}}},assignMedium:function(c){a=!0;var d=[];if(i.length){var h=i;i=[],h.forEach(c),d=i}var f=function(){var y=d;d=[],y.forEach(c)},p=function(){return Promise.resolve().then(f)};p(),i={push:function(y){d.push(y),p()},filter:function(y){return d=d.filter(y),i}}}};return r}function RR(n){n===void 0&&(n={});var e=kR(null);return e.options=qn({async:!0,ssr:!1},n),e}var k0=function(n){var e=n.sideCar,i=T0(n,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=e.read();if(!a)throw new Error("Sidecar medium not found");return m.createElement(a,qn({},i))};k0.isSideCarExport=!0;function OR(n,e){return n.useMedium(e),k0}var R0=RR(),Hh=function(){},Hc=m.forwardRef(function(n,e){var i=m.useRef(null),a=m.useState({onScrollCapture:Hh,onWheelCapture:Hh,onTouchMoveCapture:Hh}),r=a[0],c=a[1],d=n.forwardProps,h=n.children,f=n.className,p=n.removeScrollBar,y=n.enabled,b=n.shards,x=n.sideCar,w=n.noRelative,E=n.noIsolation,_=n.inert,C=n.allowPinchZoom,D=n.as,N=D===void 0?"div":D,k=n.gapMode,T=T0(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=x,z=jR([i,e]),O=qn(qn({},T),r);return m.createElement(m.Fragment,null,y&&m.createElement(R,{sideCar:R0,removeScrollBar:p,shards:b,noRelative:w,noIsolation:E,inert:_,setCallbacks:c,allowPinchZoom:!!C,lockRef:i,gapMode:k}),d?m.cloneElement(m.Children.only(h),qn(qn({},O),{ref:z})):m.createElement(N,qn({},O,{className:f,ref:z}),h))});Hc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Hc.classNames={fullWidth:tc,zeroRight:ec};var zR=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function MR(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var e=zR();return e&&n.setAttribute("nonce",e),n}function PR(n,e){n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}function LR(n){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(n)}var IR=function(){var n=0,e=null;return{add:function(i){n==0&&(e=MR())&&(PR(e,i),LR(e)),n++},remove:function(){n--,!n&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},GR=function(){var n=IR();return function(e,i){m.useEffect(function(){return n.add(e),function(){n.remove()}},[e&&i])}},O0=function(){var n=GR(),e=function(i){var a=i.styles,r=i.dynamic;return n(a,r),null};return e},BR={left:0,top:0,right:0,gap:0},Vh=function(n){return parseInt(n||"",10)||0},HR=function(n){var e=window.getComputedStyle(document.body),i=e[n==="padding"?"paddingLeft":"marginLeft"],a=e[n==="padding"?"paddingTop":"marginTop"],r=e[n==="padding"?"paddingRight":"marginRight"];return[Vh(i),Vh(a),Vh(r)]},VR=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return BR;var e=HR(n),i=document.documentElement.clientWidth,a=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,a-i+e[2]-e[0])}},FR=O0(),za="data-scroll-locked",UR=function(n,e,i,a){var r=n.left,c=n.top,d=n.right,h=n.gap;return i===void 0&&(i="margin"),`
8
+ `+u.stack}}var lu=Object.prototype.hasOwnProperty,cu=n.unstable_scheduleCallback,uu=n.unstable_cancelCallback,kE=n.unstable_shouldYield,RE=n.unstable_requestPaint,Qt=n.unstable_now,OE=n.unstable_getCurrentPriorityLevel,tp=n.unstable_ImmediatePriority,np=n.unstable_UserBlockingPriority,pr=n.unstable_NormalPriority,zE=n.unstable_LowPriority,ip=n.unstable_IdlePriority,ME=n.log,PE=n.unstable_setDisableYieldValue,Xa=null,Zt=null;function _i(t){if(typeof ME=="function"&&PE(t),Zt&&typeof Zt.setStrictMode=="function")try{Zt.setStrictMode(Xa,t)}catch{}}var Kt=Math.clz32?Math.clz32:GE,LE=Math.log,IE=Math.LN2;function GE(t){return t>>>=0,t===0?32:31-(LE(t)/IE|0)|0}var gr=256,vr=262144,yr=4194304;function ls(t){var s=t&42;if(s!==0)return s;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function br(t,s,o){var u=t.pendingLanes;if(u===0)return 0;var g=0,v=t.suspendedLanes,_=t.pingedLanes;t=t.warmLanes;var j=u&134217727;return j!==0?(u=j&~v,u!==0?g=ls(u):(_&=j,_!==0?g=ls(_):o||(o=j&~t,o!==0&&(g=ls(o))))):(j=u&~v,j!==0?g=ls(j):_!==0?g=ls(_):o||(o=u&~t,o!==0&&(g=ls(o)))),g===0?0:s!==0&&s!==g&&(s&v)===0&&(v=g&-g,o=s&-s,v>=o||v===32&&(o&4194048)!==0)?s:g}function Qa(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function BE(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function sp(){var t=yr;return yr<<=1,(yr&62914560)===0&&(yr=4194304),t}function du(t){for(var s=[],o=0;31>o;o++)s.push(t);return s}function Za(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function HE(t,s,o,u,g,v){var _=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var j=t.entanglements,P=t.expirationTimes,Z=t.hiddenUpdates;for(o=_&~o;0<o;){var se=31-Kt(o),re=1<<se;j[se]=0,P[se]=-1;var J=Z[se];if(J!==null)for(Z[se]=null,se=0;se<J.length;se++){var te=J[se];te!==null&&(te.lane&=-536870913)}o&=~re}u!==0&&ap(t,u,0),v!==0&&g===0&&t.tag!==0&&(t.suspendedLanes|=v&~(_&~s))}function ap(t,s,o){t.pendingLanes|=s,t.suspendedLanes&=~s;var u=31-Kt(s);t.entangledLanes|=s,t.entanglements[u]=t.entanglements[u]|1073741824|o&261930}function op(t,s){var o=t.entangledLanes|=s;for(t=t.entanglements;o;){var u=31-Kt(o),g=1<<u;g&s|t[u]&s&&(t[u]|=s),o&=~g}}function rp(t,s){var o=s&-s;return o=(o&42)!==0?1:hu(o),(o&(t.suspendedLanes|s))!==0?0:o}function hu(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function fu(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function lp(){var t=K.p;return t!==0?t:(t=window.event,t===void 0?32:qy(t.type))}function cp(t,s){var o=K.p;try{return K.p=t,s()}finally{K.p=o}}var Ei=Math.random().toString(36).slice(2),At="__reactFiber$"+Ei,Bt="__reactProps$"+Ei,Gs="__reactContainer$"+Ei,mu="__reactEvents$"+Ei,VE="__reactListeners$"+Ei,FE="__reactHandles$"+Ei,up="__reactResources$"+Ei,Ka="__reactMarker$"+Ei;function pu(t){delete t[At],delete t[Bt],delete t[mu],delete t[VE],delete t[FE]}function Bs(t){var s=t[At];if(s)return s;for(var o=t.parentNode;o;){if(s=o[Gs]||o[At]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(t=ky(t);t!==null;){if(o=t[At])return o;t=ky(t)}return s}t=o,o=t.parentNode}return null}function Hs(t){if(t=t[At]||t[Gs]){var s=t.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return t}return null}function Ja(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(a(33))}function Vs(t){var s=t[up];return s||(s=t[up]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ct(t){t[Ka]=!0}var dp=new Set,hp={};function cs(t,s){Fs(t,s),Fs(t+"Capture",s)}function Fs(t,s){for(hp[t]=s,t=0;t<s.length;t++)dp.add(s[t])}var UE=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fp={},mp={};function $E(t){return lu.call(mp,t)?!0:lu.call(fp,t)?!1:UE.test(t)?mp[t]=!0:(fp[t]=!0,!1)}function xr(t,s,o){if($E(s))if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var u=s.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+o)}}function wr(t,s,o){if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+o)}}function ti(t,s,o,u){if(u===null)t.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(o);return}t.setAttributeNS(s,o,""+u)}}function dn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function pp(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function WE(t,s,o){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,s);if(!t.hasOwnProperty(s)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var g=u.get,v=u.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return g.call(this)},set:function(_){o=""+_,v.call(this,_)}}),Object.defineProperty(t,s,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(_){o=""+_},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function gu(t){if(!t._valueTracker){var s=pp(t)?"checked":"value";t._valueTracker=WE(t,s,""+t[s])}}function gp(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var o=s.getValue(),u="";return t&&(u=pp(t)?t.checked?"true":"false":t.value),t=u,t!==o?(s.setValue(t),!0):!1}function Sr(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var qE=/[\n"\\]/g;function hn(t){return t.replace(qE,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function vu(t,s,o,u,g,v,_,j){t.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?t.type=_:t.removeAttribute("type"),s!=null?_==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+dn(s)):t.value!==""+dn(s)&&(t.value=""+dn(s)):_!=="submit"&&_!=="reset"||t.removeAttribute("value"),s!=null?yu(t,_,dn(s)):o!=null?yu(t,_,dn(o)):u!=null&&t.removeAttribute("value"),g==null&&v!=null&&(t.defaultChecked=!!v),g!=null&&(t.checked=g&&typeof g!="function"&&typeof g!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?t.name=""+dn(j):t.removeAttribute("name")}function vp(t,s,o,u,g,v,_,j){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.type=v),s!=null||o!=null){if(!(v!=="submit"&&v!=="reset"||s!=null)){gu(t);return}o=o!=null?""+dn(o):"",s=s!=null?""+dn(s):o,j||s===t.value||(t.value=s),t.defaultValue=s}u=u??g,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=j?t.checked:!!u,t.defaultChecked=!!u,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(t.name=_),gu(t)}function yu(t,s,o){s==="number"&&Sr(t.ownerDocument)===t||t.defaultValue===""+o||(t.defaultValue=""+o)}function Us(t,s,o,u){if(t=t.options,s){s={};for(var g=0;g<o.length;g++)s["$"+o[g]]=!0;for(o=0;o<t.length;o++)g=s.hasOwnProperty("$"+t[o].value),t[o].selected!==g&&(t[o].selected=g),g&&u&&(t[o].defaultSelected=!0)}else{for(o=""+dn(o),s=null,g=0;g<t.length;g++){if(t[g].value===o){t[g].selected=!0,u&&(t[g].defaultSelected=!0);return}s!==null||t[g].disabled||(s=t[g])}s!==null&&(s.selected=!0)}}function yp(t,s,o){if(s!=null&&(s=""+dn(s),s!==t.value&&(t.value=s),o==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=o!=null?""+dn(o):""}function bp(t,s,o,u){if(s==null){if(u!=null){if(o!=null)throw Error(a(92));if(W(u)){if(1<u.length)throw Error(a(93));u=u[0]}o=u}o==null&&(o=""),s=o}o=dn(s),t.defaultValue=o,u=t.textContent,u===o&&u!==""&&u!==null&&(t.value=u),gu(t)}function $s(t,s){if(s){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=s;return}}t.textContent=s}var YE=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function xp(t,s,o){var u=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":u?t.setProperty(s,o):typeof o!="number"||o===0||YE.has(s)?s==="float"?t.cssFloat=o:t[s]=(""+o).trim():t[s]=o+"px"}function wp(t,s,o){if(s!=null&&typeof s!="object")throw Error(a(62));if(t=t.style,o!=null){for(var u in o)!o.hasOwnProperty(u)||s!=null&&s.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var g in s)u=s[g],s.hasOwnProperty(g)&&o[g]!==u&&xp(t,g,u)}else for(var v in s)s.hasOwnProperty(v)&&xp(t,v,s[v])}function bu(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var XE=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),QE=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Cr(t){return QE.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function ni(){}var xu=null;function wu(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ws=null,qs=null;function Sp(t){var s=Hs(t);if(s&&(t=s.stateNode)){var o=t[Bt]||null;e:switch(t=s.stateNode,s.type){case"input":if(vu(t,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=t;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+hn(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var u=o[s];if(u!==t&&u.form===t.form){var g=u[Bt]||null;if(!g)throw Error(a(90));vu(u,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(s=0;s<o.length;s++)u=o[s],u.form===t.form&&gp(u)}break e;case"textarea":yp(t,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&Us(t,!!o.multiple,s,!1)}}}var Su=!1;function Cp(t,s,o){if(Su)return t(s,o);Su=!0;try{var u=t(s);return u}finally{if(Su=!1,(Ws!==null||qs!==null)&&(ul(),Ws&&(s=Ws,t=qs,qs=Ws=null,Sp(s),t)))for(s=0;s<t.length;s++)Sp(t[s])}}function eo(t,s){var o=t.stateNode;if(o===null)return null;var u=o[Bt]||null;if(u===null)return null;o=u[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(o&&typeof o!="function")throw Error(a(231,s,typeof o));return o}var ii=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cu=!1;if(ii)try{var to={};Object.defineProperty(to,"passive",{get:function(){Cu=!0}}),window.addEventListener("test",to,to),window.removeEventListener("test",to,to)}catch{Cu=!1}var Di=null,_u=null,_r=null;function _p(){if(_r)return _r;var t,s=_u,o=s.length,u,g="value"in Di?Di.value:Di.textContent,v=g.length;for(t=0;t<o&&s[t]===g[t];t++);var _=o-t;for(u=1;u<=_&&s[o-u]===g[v-u];u++);return _r=g.slice(t,1<u?1-u:void 0)}function Er(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Dr(){return!0}function Ep(){return!1}function Ht(t){function s(o,u,g,v,_){this._reactName=o,this._targetInst=g,this.type=u,this.nativeEvent=v,this.target=_,this.currentTarget=null;for(var j in t)t.hasOwnProperty(j)&&(o=t[j],this[j]=o?o(v):v[j]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Dr:Ep,this.isPropagationStopped=Ep,this}return b(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Dr)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Dr)},persist:function(){},isPersistent:Dr}),s}var us={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ar=Ht(us),no=b({},us,{view:0,detail:0}),ZE=Ht(no),Eu,Du,io,Nr=b({},no,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nu,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==io&&(io&&t.type==="mousemove"?(Eu=t.screenX-io.screenX,Du=t.screenY-io.screenY):Du=Eu=0,io=t),Eu)},movementY:function(t){return"movementY"in t?t.movementY:Du}}),Dp=Ht(Nr),KE=b({},Nr,{dataTransfer:0}),JE=Ht(KE),eD=b({},no,{relatedTarget:0}),Au=Ht(eD),tD=b({},us,{animationName:0,elapsedTime:0,pseudoElement:0}),nD=Ht(tD),iD=b({},us,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),sD=Ht(iD),aD=b({},us,{data:0}),Ap=Ht(aD),oD={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},rD={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},lD={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cD(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=lD[t])?!!s[t]:!1}function Nu(){return cD}var uD=b({},no,{key:function(t){if(t.key){var s=oD[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=Er(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?rD[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nu,charCode:function(t){return t.type==="keypress"?Er(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Er(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),dD=Ht(uD),hD=b({},Nr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Np=Ht(hD),fD=b({},no,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nu}),mD=Ht(fD),pD=b({},us,{propertyName:0,elapsedTime:0,pseudoElement:0}),gD=Ht(pD),vD=b({},Nr,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),yD=Ht(vD),bD=b({},us,{newState:0,oldState:0}),xD=Ht(bD),wD=[9,13,27,32],ju=ii&&"CompositionEvent"in window,so=null;ii&&"documentMode"in document&&(so=document.documentMode);var SD=ii&&"TextEvent"in window&&!so,jp=ii&&(!ju||so&&8<so&&11>=so),Tp=" ",kp=!1;function Rp(t,s){switch(t){case"keyup":return wD.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Op(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ys=!1;function CD(t,s){switch(t){case"compositionend":return Op(s);case"keypress":return s.which!==32?null:(kp=!0,Tp);case"textInput":return t=s.data,t===Tp&&kp?null:t;default:return null}}function _D(t,s){if(Ys)return t==="compositionend"||!ju&&Rp(t,s)?(t=_p(),_r=_u=Di=null,Ys=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return jp&&s.locale!=="ko"?null:s.data;default:return null}}var ED={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function zp(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!ED[t.type]:s==="textarea"}function Mp(t,s,o,u){Ws?qs?qs.push(u):qs=[u]:Ws=u,s=vl(s,"onChange"),0<s.length&&(o=new Ar("onChange","change",null,o,u),t.push({event:o,listeners:s}))}var ao=null,oo=null;function DD(t){vy(t,0)}function jr(t){var s=Ja(t);if(gp(s))return t}function Pp(t,s){if(t==="change")return s}var Lp=!1;if(ii){var Tu;if(ii){var ku="oninput"in document;if(!ku){var Ip=document.createElement("div");Ip.setAttribute("oninput","return;"),ku=typeof Ip.oninput=="function"}Tu=ku}else Tu=!1;Lp=Tu&&(!document.documentMode||9<document.documentMode)}function Gp(){ao&&(ao.detachEvent("onpropertychange",Bp),oo=ao=null)}function Bp(t){if(t.propertyName==="value"&&jr(oo)){var s=[];Mp(s,oo,t,wu(t)),Cp(DD,s)}}function AD(t,s,o){t==="focusin"?(Gp(),ao=s,oo=o,ao.attachEvent("onpropertychange",Bp)):t==="focusout"&&Gp()}function ND(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return jr(oo)}function jD(t,s){if(t==="click")return jr(s)}function TD(t,s){if(t==="input"||t==="change")return jr(s)}function kD(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Jt=typeof Object.is=="function"?Object.is:kD;function ro(t,s){if(Jt(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var o=Object.keys(t),u=Object.keys(s);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var g=o[u];if(!lu.call(s,g)||!Jt(t[g],s[g]))return!1}return!0}function Hp(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vp(t,s){var o=Hp(t);t=0;for(var u;o;){if(o.nodeType===3){if(u=t+o.textContent.length,t<=s&&u>=s)return{node:o,offset:s-t};t=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Hp(o)}}function Fp(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Fp(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Up(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=Sr(t.document);s instanceof t.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)t=s.contentWindow;else break;s=Sr(t.document)}return s}function Ru(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var RD=ii&&"documentMode"in document&&11>=document.documentMode,Xs=null,Ou=null,lo=null,zu=!1;function $p(t,s,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;zu||Xs==null||Xs!==Sr(u)||(u=Xs,"selectionStart"in u&&Ru(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),lo&&ro(lo,u)||(lo=u,u=vl(Ou,"onSelect"),0<u.length&&(s=new Ar("onSelect","select",null,s,o),t.push({event:s,listeners:u}),s.target=Xs)))}function ds(t,s){var o={};return o[t.toLowerCase()]=s.toLowerCase(),o["Webkit"+t]="webkit"+s,o["Moz"+t]="moz"+s,o}var Qs={animationend:ds("Animation","AnimationEnd"),animationiteration:ds("Animation","AnimationIteration"),animationstart:ds("Animation","AnimationStart"),transitionrun:ds("Transition","TransitionRun"),transitionstart:ds("Transition","TransitionStart"),transitioncancel:ds("Transition","TransitionCancel"),transitionend:ds("Transition","TransitionEnd")},Mu={},Wp={};ii&&(Wp=document.createElement("div").style,"AnimationEvent"in window||(delete Qs.animationend.animation,delete Qs.animationiteration.animation,delete Qs.animationstart.animation),"TransitionEvent"in window||delete Qs.transitionend.transition);function hs(t){if(Mu[t])return Mu[t];if(!Qs[t])return t;var s=Qs[t],o;for(o in s)if(s.hasOwnProperty(o)&&o in Wp)return Mu[t]=s[o];return t}var qp=hs("animationend"),Yp=hs("animationiteration"),Xp=hs("animationstart"),OD=hs("transitionrun"),zD=hs("transitionstart"),MD=hs("transitioncancel"),Qp=hs("transitionend"),Zp=new Map,Pu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Pu.push("scrollEnd");function Nn(t,s){Zp.set(t,s),cs(s,[t])}var Tr=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},fn=[],Zs=0,Lu=0;function kr(){for(var t=Zs,s=Lu=Zs=0;s<t;){var o=fn[s];fn[s++]=null;var u=fn[s];fn[s++]=null;var g=fn[s];fn[s++]=null;var v=fn[s];if(fn[s++]=null,u!==null&&g!==null){var _=u.pending;_===null?g.next=g:(g.next=_.next,_.next=g),u.pending=g}v!==0&&Kp(o,g,v)}}function Rr(t,s,o,u){fn[Zs++]=t,fn[Zs++]=s,fn[Zs++]=o,fn[Zs++]=u,Lu|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function Iu(t,s,o,u){return Rr(t,s,o,u),Or(t)}function fs(t,s){return Rr(t,null,null,s),Or(t)}function Kp(t,s,o){t.lanes|=o;var u=t.alternate;u!==null&&(u.lanes|=o);for(var g=!1,v=t.return;v!==null;)v.childLanes|=o,u=v.alternate,u!==null&&(u.childLanes|=o),v.tag===22&&(t=v.stateNode,t===null||t._visibility&1||(g=!0)),t=v,v=v.return;return t.tag===3?(v=t.stateNode,g&&s!==null&&(g=31-Kt(o),t=v.hiddenUpdates,u=t[g],u===null?t[g]=[s]:u.push(s),s.lane=o|536870912),v):null}function Or(t){if(50<ko)throw ko=0,qd=null,Error(a(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var Ks={};function PD(t,s,o,u){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function en(t,s,o,u){return new PD(t,s,o,u)}function Gu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function si(t,s){var o=t.alternate;return o===null?(o=en(t.tag,s,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=s,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&65011712,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,s=t.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o.refCleanup=t.refCleanup,o}function Jp(t,s){t.flags&=65011714;var o=t.alternate;return o===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=o.childLanes,t.lanes=o.lanes,t.child=o.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=o.memoizedProps,t.memoizedState=o.memoizedState,t.updateQueue=o.updateQueue,t.type=o.type,s=o.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function zr(t,s,o,u,g,v){var _=0;if(u=t,typeof t=="function")Gu(t)&&(_=1);else if(typeof t=="string")_=HA(t,o,V.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case G:return t=en(31,o,s,g),t.elementType=G,t.lanes=v,t;case C:return ms(o.children,g,v,s);case S:_=8,g|=24;break;case D:return t=en(12,o,s,g|2),t.elementType=D,t.lanes=v,t;case R:return t=en(13,o,s,g),t.elementType=R,t.lanes=v,t;case z:return t=en(19,o,s,g),t.elementType=z,t.lanes=v,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case k:_=10;break e;case N:_=9;break e;case T:_=11;break e;case O:_=14;break e;case A:_=16,u=null;break e}_=29,o=Error(a(130,t===null?"null":typeof t,"")),u=null}return s=en(_,o,s,g),s.elementType=t,s.type=u,s.lanes=v,s}function ms(t,s,o,u){return t=en(7,t,u,s),t.lanes=o,t}function Bu(t,s,o){return t=en(6,t,null,s),t.lanes=o,t}function eg(t){var s=en(18,null,null,0);return s.stateNode=t,s}function Hu(t,s,o){return s=en(4,t.children!==null?t.children:[],t.key,s),s.lanes=o,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var tg=new WeakMap;function mn(t,s){if(typeof t=="object"&&t!==null){var o=tg.get(t);return o!==void 0?o:(s={value:t,source:s,stack:ep(s)},tg.set(t,s),s)}return{value:t,source:s,stack:ep(s)}}var Js=[],ea=0,Mr=null,co=0,pn=[],gn=0,Ai=null,Gn=1,Bn="";function ai(t,s){Js[ea++]=co,Js[ea++]=Mr,Mr=t,co=s}function ng(t,s,o){pn[gn++]=Gn,pn[gn++]=Bn,pn[gn++]=Ai,Ai=t;var u=Gn;t=Bn;var g=32-Kt(u)-1;u&=~(1<<g),o+=1;var v=32-Kt(s)+g;if(30<v){var _=g-g%5;v=(u&(1<<_)-1).toString(32),u>>=_,g-=_,Gn=1<<32-Kt(s)+g|o<<g|u,Bn=v+t}else Gn=1<<v|o<<g|u,Bn=t}function Vu(t){t.return!==null&&(ai(t,1),ng(t,1,0))}function Fu(t){for(;t===Mr;)Mr=Js[--ea],Js[ea]=null,co=Js[--ea],Js[ea]=null;for(;t===Ai;)Ai=pn[--gn],pn[gn]=null,Bn=pn[--gn],pn[gn]=null,Gn=pn[--gn],pn[gn]=null}function ig(t,s){pn[gn++]=Gn,pn[gn++]=Bn,pn[gn++]=Ai,Gn=s.id,Bn=s.overflow,Ai=t}var Nt=null,nt=null,Ue=!1,Ni=null,vn=!1,Uu=Error(a(519));function ji(t){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw uo(mn(s,t)),Uu}function sg(t){var s=t.stateNode,o=t.type,u=t.memoizedProps;switch(s[At]=t,s[Bt]=u,o){case"dialog":He("cancel",s),He("close",s);break;case"iframe":case"object":case"embed":He("load",s);break;case"video":case"audio":for(o=0;o<Oo.length;o++)He(Oo[o],s);break;case"source":He("error",s);break;case"img":case"image":case"link":He("error",s),He("load",s);break;case"details":He("toggle",s);break;case"input":He("invalid",s),vp(s,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":He("invalid",s);break;case"textarea":He("invalid",s),bp(s,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||u.suppressHydrationWarning===!0||wy(s.textContent,o)?(u.popover!=null&&(He("beforetoggle",s),He("toggle",s)),u.onScroll!=null&&He("scroll",s),u.onScrollEnd!=null&&He("scrollend",s),u.onClick!=null&&(s.onclick=ni),s=!0):s=!1,s||ji(t,!0)}function ag(t){for(Nt=t.return;Nt;)switch(Nt.tag){case 5:case 31:case 13:vn=!1;return;case 27:case 3:vn=!0;return;default:Nt=Nt.return}}function ta(t){if(t!==Nt)return!1;if(!Ue)return ag(t),Ue=!0,!1;var s=t.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=t.type,o=!(o!=="form"&&o!=="button")||lh(t.type,t.memoizedProps)),o=!o),o&&nt&&ji(t),ag(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));nt=Ty(t)}else if(s===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(317));nt=Ty(t)}else s===27?(s=nt,Fi(t.type)?(t=fh,fh=null,nt=t):nt=s):nt=Nt?bn(t.stateNode.nextSibling):null;return!0}function ps(){nt=Nt=null,Ue=!1}function $u(){var t=Ni;return t!==null&&($t===null?$t=t:$t.push.apply($t,t),Ni=null),t}function uo(t){Ni===null?Ni=[t]:Ni.push(t)}var Wu=I(null),gs=null,oi=null;function Ti(t,s,o){ee(Wu,s._currentValue),s._currentValue=o}function ri(t){t._currentValue=Wu.current,L(Wu)}function qu(t,s,o){for(;t!==null;){var u=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,u!==null&&(u.childLanes|=s)):u!==null&&(u.childLanes&s)!==s&&(u.childLanes|=s),t===o)break;t=t.return}}function Yu(t,s,o,u){var g=t.child;for(g!==null&&(g.return=t);g!==null;){var v=g.dependencies;if(v!==null){var _=g.child;v=v.firstContext;e:for(;v!==null;){var j=v;v=g;for(var P=0;P<s.length;P++)if(j.context===s[P]){v.lanes|=o,j=v.alternate,j!==null&&(j.lanes|=o),qu(v.return,o,t),u||(_=null);break e}v=j.next}}else if(g.tag===18){if(_=g.return,_===null)throw Error(a(341));_.lanes|=o,v=_.alternate,v!==null&&(v.lanes|=o),qu(_,o,t),_=null}else _=g.child;if(_!==null)_.return=g;else for(_=g;_!==null;){if(_===t){_=null;break}if(g=_.sibling,g!==null){g.return=_.return,_=g;break}_=_.return}g=_}}function na(t,s,o,u){t=null;for(var g=s,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var _=g.alternate;if(_===null)throw Error(a(387));if(_=_.memoizedProps,_!==null){var j=g.type;Jt(g.pendingProps.value,_.value)||(t!==null?t.push(j):t=[j])}}else if(g===X.current){if(_=g.alternate,_===null)throw Error(a(387));_.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(t!==null?t.push(Io):t=[Io])}g=g.return}t!==null&&Yu(s,t,o,u),s.flags|=262144}function Pr(t){for(t=t.firstContext;t!==null;){if(!Jt(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function vs(t){gs=t,oi=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function jt(t){return og(gs,t)}function Lr(t,s){return gs===null&&vs(t),og(t,s)}function og(t,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},oi===null){if(t===null)throw Error(a(308));oi=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else oi=oi.next=s;return o}var LD=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(o,u){t.push(u)}};this.abort=function(){s.aborted=!0,t.forEach(function(o){return o()})}},ID=n.unstable_scheduleCallback,GD=n.unstable_NormalPriority,mt={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Xu(){return{controller:new LD,data:new Map,refCount:0}}function ho(t){t.refCount--,t.refCount===0&&ID(GD,function(){t.controller.abort()})}var fo=null,Qu=0,ia=0,sa=null;function BD(t,s){if(fo===null){var o=fo=[];Qu=0,ia=Jd(),sa={status:"pending",value:void 0,then:function(u){o.push(u)}}}return Qu++,s.then(rg,rg),s}function rg(){if(--Qu===0&&fo!==null){sa!==null&&(sa.status="fulfilled");var t=fo;fo=null,ia=0,sa=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function HD(t,s){var o=[],u={status:"pending",value:null,reason:null,then:function(g){o.push(g)}};return t.then(function(){u.status="fulfilled",u.value=s;for(var g=0;g<o.length;g++)(0,o[g])(s)},function(g){for(u.status="rejected",u.reason=g,g=0;g<o.length;g++)(0,o[g])(void 0)}),u}var lg=M.S;M.S=function(t,s){$v=Qt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&BD(t,s),lg!==null&&lg(t,s)};var ys=I(null);function Zu(){var t=ys.current;return t!==null?t:tt.pooledCache}function Ir(t,s){s===null?ee(ys,ys.current):ee(ys,s.pool)}function cg(){var t=Zu();return t===null?null:{parent:mt._currentValue,pool:t}}var aa=Error(a(460)),Ku=Error(a(474)),Gr=Error(a(542)),Br={then:function(){}};function ug(t){return t=t.status,t==="fulfilled"||t==="rejected"}function dg(t,s,o){switch(o=t[o],o===void 0?t.push(s):o!==s&&(s.then(ni,ni),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,fg(t),t;default:if(typeof s.status=="string")s.then(ni,ni);else{if(t=tt,t!==null&&100<t.shellSuspendCounter)throw Error(a(482));t=s,t.status="pending",t.then(function(u){if(s.status==="pending"){var g=s;g.status="fulfilled",g.value=u}},function(u){if(s.status==="pending"){var g=s;g.status="rejected",g.reason=u}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,fg(t),t}throw xs=s,aa}}function bs(t){try{var s=t._init;return s(t._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(xs=o,aa):o}}var xs=null;function hg(){if(xs===null)throw Error(a(459));var t=xs;return xs=null,t}function fg(t){if(t===aa||t===Gr)throw Error(a(483))}var oa=null,mo=0;function Hr(t){var s=mo;return mo+=1,oa===null&&(oa=[]),dg(oa,t,s)}function po(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function Vr(t,s){throw s.$$typeof===x?Error(a(525)):(t=Object.prototype.toString.call(s),Error(a(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function mg(t){function s(F,H){if(t){var Q=F.deletions;Q===null?(F.deletions=[H],F.flags|=16):Q.push(H)}}function o(F,H){if(!t)return null;for(;H!==null;)s(F,H),H=H.sibling;return null}function u(F){for(var H=new Map;F!==null;)F.key!==null?H.set(F.key,F):H.set(F.index,F),F=F.sibling;return H}function g(F,H){return F=si(F,H),F.index=0,F.sibling=null,F}function v(F,H,Q){return F.index=Q,t?(Q=F.alternate,Q!==null?(Q=Q.index,Q<H?(F.flags|=67108866,H):Q):(F.flags|=67108866,H)):(F.flags|=1048576,H)}function _(F){return t&&F.alternate===null&&(F.flags|=67108866),F}function j(F,H,Q,oe){return H===null||H.tag!==6?(H=Bu(Q,F.mode,oe),H.return=F,H):(H=g(H,Q),H.return=F,H)}function P(F,H,Q,oe){var xe=Q.type;return xe===C?se(F,H,Q.props.children,oe,Q.key):H!==null&&(H.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===A&&bs(xe)===H.type)?(H=g(H,Q.props),po(H,Q),H.return=F,H):(H=zr(Q.type,Q.key,Q.props,null,F.mode,oe),po(H,Q),H.return=F,H)}function Z(F,H,Q,oe){return H===null||H.tag!==4||H.stateNode.containerInfo!==Q.containerInfo||H.stateNode.implementation!==Q.implementation?(H=Hu(Q,F.mode,oe),H.return=F,H):(H=g(H,Q.children||[]),H.return=F,H)}function se(F,H,Q,oe,xe){return H===null||H.tag!==7?(H=ms(Q,F.mode,oe,xe),H.return=F,H):(H=g(H,Q),H.return=F,H)}function re(F,H,Q){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=Bu(""+H,F.mode,Q),H.return=F,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case w:return Q=zr(H.type,H.key,H.props,null,F.mode,Q),po(Q,H),Q.return=F,Q;case E:return H=Hu(H,F.mode,Q),H.return=F,H;case A:return H=bs(H),re(F,H,Q)}if(W(H)||$(H))return H=ms(H,F.mode,Q,null),H.return=F,H;if(typeof H.then=="function")return re(F,Hr(H),Q);if(H.$$typeof===k)return re(F,Lr(F,H),Q);Vr(F,H)}return null}function J(F,H,Q,oe){var xe=H!==null?H.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return xe!==null?null:j(F,H,""+Q,oe);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:return Q.key===xe?P(F,H,Q,oe):null;case E:return Q.key===xe?Z(F,H,Q,oe):null;case A:return Q=bs(Q),J(F,H,Q,oe)}if(W(Q)||$(Q))return xe!==null?null:se(F,H,Q,oe,null);if(typeof Q.then=="function")return J(F,H,Hr(Q),oe);if(Q.$$typeof===k)return J(F,H,Lr(F,Q),oe);Vr(F,Q)}return null}function te(F,H,Q,oe,xe){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return F=F.get(Q)||null,j(H,F,""+oe,xe);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case w:return F=F.get(oe.key===null?Q:oe.key)||null,P(H,F,oe,xe);case E:return F=F.get(oe.key===null?Q:oe.key)||null,Z(H,F,oe,xe);case A:return oe=bs(oe),te(F,H,Q,oe,xe)}if(W(oe)||$(oe))return F=F.get(Q)||null,se(H,F,oe,xe,null);if(typeof oe.then=="function")return te(F,H,Q,Hr(oe),xe);if(oe.$$typeof===k)return te(F,H,Q,Lr(H,oe),xe);Vr(H,oe)}return null}function me(F,H,Q,oe){for(var xe=null,We=null,ve=H,Me=H=0,Fe=null;ve!==null&&Me<Q.length;Me++){ve.index>Me?(Fe=ve,ve=null):Fe=ve.sibling;var qe=J(F,ve,Q[Me],oe);if(qe===null){ve===null&&(ve=Fe);break}t&&ve&&qe.alternate===null&&s(F,ve),H=v(qe,H,Me),We===null?xe=qe:We.sibling=qe,We=qe,ve=Fe}if(Me===Q.length)return o(F,ve),Ue&&ai(F,Me),xe;if(ve===null){for(;Me<Q.length;Me++)ve=re(F,Q[Me],oe),ve!==null&&(H=v(ve,H,Me),We===null?xe=ve:We.sibling=ve,We=ve);return Ue&&ai(F,Me),xe}for(ve=u(ve);Me<Q.length;Me++)Fe=te(ve,F,Me,Q[Me],oe),Fe!==null&&(t&&Fe.alternate!==null&&ve.delete(Fe.key===null?Me:Fe.key),H=v(Fe,H,Me),We===null?xe=Fe:We.sibling=Fe,We=Fe);return t&&ve.forEach(function(Yi){return s(F,Yi)}),Ue&&ai(F,Me),xe}function _e(F,H,Q,oe){if(Q==null)throw Error(a(151));for(var xe=null,We=null,ve=H,Me=H=0,Fe=null,qe=Q.next();ve!==null&&!qe.done;Me++,qe=Q.next()){ve.index>Me?(Fe=ve,ve=null):Fe=ve.sibling;var Yi=J(F,ve,qe.value,oe);if(Yi===null){ve===null&&(ve=Fe);break}t&&ve&&Yi.alternate===null&&s(F,ve),H=v(Yi,H,Me),We===null?xe=Yi:We.sibling=Yi,We=Yi,ve=Fe}if(qe.done)return o(F,ve),Ue&&ai(F,Me),xe;if(ve===null){for(;!qe.done;Me++,qe=Q.next())qe=re(F,qe.value,oe),qe!==null&&(H=v(qe,H,Me),We===null?xe=qe:We.sibling=qe,We=qe);return Ue&&ai(F,Me),xe}for(ve=u(ve);!qe.done;Me++,qe=Q.next())qe=te(ve,F,Me,qe.value,oe),qe!==null&&(t&&qe.alternate!==null&&ve.delete(qe.key===null?Me:qe.key),H=v(qe,H,Me),We===null?xe=qe:We.sibling=qe,We=qe);return t&&ve.forEach(function(KA){return s(F,KA)}),Ue&&ai(F,Me),xe}function et(F,H,Q,oe){if(typeof Q=="object"&&Q!==null&&Q.type===C&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case w:e:{for(var xe=Q.key;H!==null;){if(H.key===xe){if(xe=Q.type,xe===C){if(H.tag===7){o(F,H.sibling),oe=g(H,Q.props.children),oe.return=F,F=oe;break e}}else if(H.elementType===xe||typeof xe=="object"&&xe!==null&&xe.$$typeof===A&&bs(xe)===H.type){o(F,H.sibling),oe=g(H,Q.props),po(oe,Q),oe.return=F,F=oe;break e}o(F,H);break}else s(F,H);H=H.sibling}Q.type===C?(oe=ms(Q.props.children,F.mode,oe,Q.key),oe.return=F,F=oe):(oe=zr(Q.type,Q.key,Q.props,null,F.mode,oe),po(oe,Q),oe.return=F,F=oe)}return _(F);case E:e:{for(xe=Q.key;H!==null;){if(H.key===xe)if(H.tag===4&&H.stateNode.containerInfo===Q.containerInfo&&H.stateNode.implementation===Q.implementation){o(F,H.sibling),oe=g(H,Q.children||[]),oe.return=F,F=oe;break e}else{o(F,H);break}else s(F,H);H=H.sibling}oe=Hu(Q,F.mode,oe),oe.return=F,F=oe}return _(F);case A:return Q=bs(Q),et(F,H,Q,oe)}if(W(Q))return me(F,H,Q,oe);if($(Q)){if(xe=$(Q),typeof xe!="function")throw Error(a(150));return Q=xe.call(Q),_e(F,H,Q,oe)}if(typeof Q.then=="function")return et(F,H,Hr(Q),oe);if(Q.$$typeof===k)return et(F,H,Lr(F,Q),oe);Vr(F,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,H!==null&&H.tag===6?(o(F,H.sibling),oe=g(H,Q),oe.return=F,F=oe):(o(F,H),oe=Bu(Q,F.mode,oe),oe.return=F,F=oe),_(F)):o(F,H)}return function(F,H,Q,oe){try{mo=0;var xe=et(F,H,Q,oe);return oa=null,xe}catch(ve){if(ve===aa||ve===Gr)throw ve;var We=en(29,ve,null,F.mode);return We.lanes=oe,We.return=F,We}}}var ws=mg(!0),pg=mg(!1),ki=!1;function Ju(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ed(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ri(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Oi(t,s,o){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Ye&2)!==0){var g=u.pending;return g===null?s.next=s:(s.next=g.next,g.next=s),u.pending=s,s=Or(t),Kp(t,null,o),s}return Rr(t,u,s,o),Or(t)}function go(t,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var u=s.lanes;u&=t.pendingLanes,o|=u,s.lanes=o,op(t,o)}}function td(t,s){var o=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var g=null,v=null;if(o=o.firstBaseUpdate,o!==null){do{var _={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};v===null?g=v=_:v=v.next=_,o=o.next}while(o!==null);v===null?g=v=s:v=v.next=s}else g=v=s;o={baseState:u.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:u.shared,callbacks:u.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=s:t.next=s,o.lastBaseUpdate=s}var nd=!1;function vo(){if(nd){var t=sa;if(t!==null)throw t}}function yo(t,s,o,u){nd=!1;var g=t.updateQueue;ki=!1;var v=g.firstBaseUpdate,_=g.lastBaseUpdate,j=g.shared.pending;if(j!==null){g.shared.pending=null;var P=j,Z=P.next;P.next=null,_===null?v=Z:_.next=Z,_=P;var se=t.alternate;se!==null&&(se=se.updateQueue,j=se.lastBaseUpdate,j!==_&&(j===null?se.firstBaseUpdate=Z:j.next=Z,se.lastBaseUpdate=P))}if(v!==null){var re=g.baseState;_=0,se=Z=P=null,j=v;do{var J=j.lane&-536870913,te=J!==j.lane;if(te?(Ve&J)===J:(u&J)===J){J!==0&&J===ia&&(nd=!0),se!==null&&(se=se.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var me=t,_e=j;J=s;var et=o;switch(_e.tag){case 1:if(me=_e.payload,typeof me=="function"){re=me.call(et,re,J);break e}re=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=_e.payload,J=typeof me=="function"?me.call(et,re,J):me,J==null)break e;re=b({},re,J);break e;case 2:ki=!0}}J=j.callback,J!==null&&(t.flags|=64,te&&(t.flags|=8192),te=g.callbacks,te===null?g.callbacks=[J]:te.push(J))}else te={lane:J,tag:j.tag,payload:j.payload,callback:j.callback,next:null},se===null?(Z=se=te,P=re):se=se.next=te,_|=J;if(j=j.next,j===null){if(j=g.shared.pending,j===null)break;te=j,j=te.next,te.next=null,g.lastBaseUpdate=te,g.shared.pending=null}}while(!0);se===null&&(P=re),g.baseState=P,g.firstBaseUpdate=Z,g.lastBaseUpdate=se,v===null&&(g.shared.lanes=0),Ii|=_,t.lanes=_,t.memoizedState=re}}function gg(t,s){if(typeof t!="function")throw Error(a(191,t));t.call(s)}function vg(t,s){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;t<o.length;t++)gg(o[t],s)}var ra=I(null),Fr=I(0);function yg(t,s){t=gi,ee(Fr,t),ee(ra,s),gi=t|s.baseLanes}function id(){ee(Fr,gi),ee(ra,ra.current)}function sd(){gi=Fr.current,L(ra),L(Fr)}var tn=I(null),yn=null;function zi(t){var s=t.alternate;ee(ht,ht.current&1),ee(tn,t),yn===null&&(s===null||ra.current!==null||s.memoizedState!==null)&&(yn=t)}function ad(t){ee(ht,ht.current),ee(tn,t),yn===null&&(yn=t)}function bg(t){t.tag===22?(ee(ht,ht.current),ee(tn,t),yn===null&&(yn=t)):Mi()}function Mi(){ee(ht,ht.current),ee(tn,tn.current)}function nn(t){L(tn),yn===t&&(yn=null),L(ht)}var ht=I(0);function Ur(t){for(var s=t;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||dh(o)||hh(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var li=0,ze=null,Ke=null,pt=null,$r=!1,la=!1,Ss=!1,Wr=0,bo=0,ca=null,VD=0;function lt(){throw Error(a(321))}function od(t,s){if(s===null)return!1;for(var o=0;o<s.length&&o<t.length;o++)if(!Jt(t[o],s[o]))return!1;return!0}function rd(t,s,o,u,g,v){return li=v,ze=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,M.H=t===null||t.memoizedState===null?nv:Sd,Ss=!1,v=o(u,g),Ss=!1,la&&(v=wg(s,o,u,g)),xg(t),v}function xg(t){M.H=So;var s=Ke!==null&&Ke.next!==null;if(li=0,pt=Ke=ze=null,$r=!1,bo=0,ca=null,s)throw Error(a(300));t===null||gt||(t=t.dependencies,t!==null&&Pr(t)&&(gt=!0))}function wg(t,s,o,u){ze=t;var g=0;do{if(la&&(ca=null),bo=0,la=!1,25<=g)throw Error(a(301));if(g+=1,pt=Ke=null,t.updateQueue!=null){var v=t.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}M.H=iv,v=s(o,u)}while(la);return v}function FD(){var t=M.H,s=t.useState()[0];return s=typeof s.then=="function"?xo(s):s,t=t.useState()[0],(Ke!==null?Ke.memoizedState:null)!==t&&(ze.flags|=1024),s}function ld(){var t=Wr!==0;return Wr=0,t}function cd(t,s,o){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~o}function ud(t){if($r){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}$r=!1}li=0,pt=Ke=ze=null,la=!1,bo=Wr=0,ca=null}function Lt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pt===null?ze.memoizedState=pt=t:pt=pt.next=t,pt}function ft(){if(Ke===null){var t=ze.alternate;t=t!==null?t.memoizedState:null}else t=Ke.next;var s=pt===null?ze.memoizedState:pt.next;if(s!==null)pt=s,Ke=t;else{if(t===null)throw ze.alternate===null?Error(a(467)):Error(a(310));Ke=t,t={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},pt===null?ze.memoizedState=pt=t:pt=pt.next=t}return pt}function qr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xo(t){var s=bo;return bo+=1,ca===null&&(ca=[]),t=dg(ca,t,s),s=ze,(pt===null?s.memoizedState:pt.next)===null&&(s=s.alternate,M.H=s===null||s.memoizedState===null?nv:Sd),t}function Yr(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return xo(t);if(t.$$typeof===k)return jt(t)}throw Error(a(438,String(t)))}function dd(t){var s=null,o=ze.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var u=ze.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(s={data:u.data.map(function(g){return g.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=qr(),ze.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(t),u=0;u<t;u++)o[u]=U;return s.index++,o}function ci(t,s){return typeof s=="function"?s(t):s}function Xr(t){var s=ft();return hd(s,Ke,t)}function hd(t,s,o){var u=t.queue;if(u===null)throw Error(a(311));u.lastRenderedReducer=o;var g=t.baseQueue,v=u.pending;if(v!==null){if(g!==null){var _=g.next;g.next=v.next,v.next=_}s.baseQueue=g=v,u.pending=null}if(v=t.baseState,g===null)t.memoizedState=v;else{s=g.next;var j=_=null,P=null,Z=s,se=!1;do{var re=Z.lane&-536870913;if(re!==Z.lane?(Ve&re)===re:(li&re)===re){var J=Z.revertLane;if(J===0)P!==null&&(P=P.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),re===ia&&(se=!0);else if((li&J)===J){Z=Z.next,J===ia&&(se=!0);continue}else re={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},P===null?(j=P=re,_=v):P=P.next=re,ze.lanes|=J,Ii|=J;re=Z.action,Ss&&o(v,re),v=Z.hasEagerState?Z.eagerState:o(v,re)}else J={lane:re,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},P===null?(j=P=J,_=v):P=P.next=J,ze.lanes|=re,Ii|=re;Z=Z.next}while(Z!==null&&Z!==s);if(P===null?_=v:P.next=j,!Jt(v,t.memoizedState)&&(gt=!0,se&&(o=sa,o!==null)))throw o;t.memoizedState=v,t.baseState=_,t.baseQueue=P,u.lastRenderedState=v}return g===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function fd(t){var s=ft(),o=s.queue;if(o===null)throw Error(a(311));o.lastRenderedReducer=t;var u=o.dispatch,g=o.pending,v=s.memoizedState;if(g!==null){o.pending=null;var _=g=g.next;do v=t(v,_.action),_=_.next;while(_!==g);Jt(v,s.memoizedState)||(gt=!0),s.memoizedState=v,s.baseQueue===null&&(s.baseState=v),o.lastRenderedState=v}return[v,u]}function Sg(t,s,o){var u=ze,g=ft(),v=Ue;if(v){if(o===void 0)throw Error(a(407));o=o()}else o=s();var _=!Jt((Ke||g).memoizedState,o);if(_&&(g.memoizedState=o,gt=!0),g=g.queue,gd(Eg.bind(null,u,g,t),[t]),g.getSnapshot!==s||_||pt!==null&&pt.memoizedState.tag&1){if(u.flags|=2048,ua(9,{destroy:void 0},_g.bind(null,u,g,o,s),null),tt===null)throw Error(a(349));v||(li&127)!==0||Cg(u,s,o)}return o}function Cg(t,s,o){t.flags|=16384,t={getSnapshot:s,value:o},s=ze.updateQueue,s===null?(s=qr(),ze.updateQueue=s,s.stores=[t]):(o=s.stores,o===null?s.stores=[t]:o.push(t))}function _g(t,s,o,u){s.value=o,s.getSnapshot=u,Dg(s)&&Ag(t)}function Eg(t,s,o){return o(function(){Dg(s)&&Ag(t)})}function Dg(t){var s=t.getSnapshot;t=t.value;try{var o=s();return!Jt(t,o)}catch{return!0}}function Ag(t){var s=fs(t,2);s!==null&&Wt(s,t,2)}function md(t){var s=Lt();if(typeof t=="function"){var o=t;if(t=o(),Ss){_i(!0);try{o()}finally{_i(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:t},s}function Ng(t,s,o,u){return t.baseState=o,hd(t,Ke,typeof u=="function"?u:ci)}function UD(t,s,o,u,g){if(Kr(t))throw Error(a(485));if(t=s.action,t!==null){var v={payload:g,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){v.listeners.push(_)}};M.T!==null?o(!0):v.isTransition=!1,u(v),o=s.pending,o===null?(v.next=s.pending=v,jg(s,v)):(v.next=o.next,s.pending=o.next=v)}}function jg(t,s){var o=s.action,u=s.payload,g=t.state;if(s.isTransition){var v=M.T,_={};M.T=_;try{var j=o(g,u),P=M.S;P!==null&&P(_,j),Tg(t,s,j)}catch(Z){pd(t,s,Z)}finally{v!==null&&_.types!==null&&(v.types=_.types),M.T=v}}else try{v=o(g,u),Tg(t,s,v)}catch(Z){pd(t,s,Z)}}function Tg(t,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){kg(t,s,u)},function(u){return pd(t,s,u)}):kg(t,s,o)}function kg(t,s,o){s.status="fulfilled",s.value=o,Rg(s),t.state=o,s=t.pending,s!==null&&(o=s.next,o===s?t.pending=null:(o=o.next,s.next=o,jg(t,o)))}function pd(t,s,o){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do s.status="rejected",s.reason=o,Rg(s),s=s.next;while(s!==u)}t.action=null}function Rg(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function Og(t,s){return s}function zg(t,s){if(Ue){var o=tt.formState;if(o!==null){e:{var u=ze;if(Ue){if(nt){t:{for(var g=nt,v=vn;g.nodeType!==8;){if(!v){g=null;break t}if(g=bn(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){nt=bn(g.nextSibling),u=g.data==="F!";break e}}ji(u)}u=!1}u&&(s=o[0])}}return o=Lt(),o.memoizedState=o.baseState=s,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Og,lastRenderedState:s},o.queue=u,o=Jg.bind(null,ze,u),u.dispatch=o,u=md(!1),v=wd.bind(null,ze,!1,u.queue),u=Lt(),g={state:s,dispatch:null,action:t,pending:null},u.queue=g,o=UD.bind(null,ze,g,v,o),g.dispatch=o,u.memoizedState=t,[s,o,!1]}function Mg(t){var s=ft();return Pg(s,Ke,t)}function Pg(t,s,o){if(s=hd(t,s,Og)[0],t=Xr(ci)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var u=xo(s)}catch(_){throw _===aa?Gr:_}else u=s;s=ft();var g=s.queue,v=g.dispatch;return o!==s.memoizedState&&(ze.flags|=2048,ua(9,{destroy:void 0},$D.bind(null,g,o),null)),[u,v,t]}function $D(t,s){t.action=s}function Lg(t){var s=ft(),o=Ke;if(o!==null)return Pg(s,o,t);ft(),s=s.memoizedState,o=ft();var u=o.queue.dispatch;return o.memoizedState=t,[s,u,!1]}function ua(t,s,o,u){return t={tag:t,create:o,deps:u,inst:s,next:null},s=ze.updateQueue,s===null&&(s=qr(),ze.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=t.next=t:(u=o.next,o.next=t,t.next=u,s.lastEffect=t),t}function Ig(){return ft().memoizedState}function Qr(t,s,o,u){var g=Lt();ze.flags|=t,g.memoizedState=ua(1|s,{destroy:void 0},o,u===void 0?null:u)}function Zr(t,s,o,u){var g=ft();u=u===void 0?null:u;var v=g.memoizedState.inst;Ke!==null&&u!==null&&od(u,Ke.memoizedState.deps)?g.memoizedState=ua(s,v,o,u):(ze.flags|=t,g.memoizedState=ua(1|s,v,o,u))}function Gg(t,s){Qr(8390656,8,t,s)}function gd(t,s){Zr(2048,8,t,s)}function WD(t){ze.flags|=4;var s=ze.updateQueue;if(s===null)s=qr(),ze.updateQueue=s,s.events=[t];else{var o=s.events;o===null?s.events=[t]:o.push(t)}}function Bg(t){var s=ft().memoizedState;return WD({ref:s,nextImpl:t}),function(){if((Ye&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function Hg(t,s){return Zr(4,2,t,s)}function Vg(t,s){return Zr(4,4,t,s)}function Fg(t,s){if(typeof s=="function"){t=t();var o=s(t);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Ug(t,s,o){o=o!=null?o.concat([t]):null,Zr(4,4,Fg.bind(null,s,t),o)}function vd(){}function $g(t,s){var o=ft();s=s===void 0?null:s;var u=o.memoizedState;return s!==null&&od(s,u[1])?u[0]:(o.memoizedState=[t,s],t)}function Wg(t,s){var o=ft();s=s===void 0?null:s;var u=o.memoizedState;if(s!==null&&od(s,u[1]))return u[0];if(u=t(),Ss){_i(!0);try{t()}finally{_i(!1)}}return o.memoizedState=[u,s],u}function yd(t,s,o){return o===void 0||(li&1073741824)!==0&&(Ve&261930)===0?t.memoizedState=s:(t.memoizedState=o,t=qv(),ze.lanes|=t,Ii|=t,o)}function qg(t,s,o,u){return Jt(o,s)?o:ra.current!==null?(t=yd(t,o,u),Jt(t,s)||(gt=!0),t):(li&42)===0||(li&1073741824)!==0&&(Ve&261930)===0?(gt=!0,t.memoizedState=o):(t=qv(),ze.lanes|=t,Ii|=t,s)}function Yg(t,s,o,u,g){var v=K.p;K.p=v!==0&&8>v?v:8;var _=M.T,j={};M.T=j,wd(t,!1,s,o);try{var P=g(),Z=M.S;if(Z!==null&&Z(j,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var se=HD(P,u);wo(t,s,se,on(t))}else wo(t,s,u,on(t))}catch(re){wo(t,s,{then:function(){},status:"rejected",reason:re},on())}finally{K.p=v,_!==null&&j.types!==null&&(_.types=j.types),M.T=_}}function qD(){}function bd(t,s,o,u){if(t.tag!==5)throw Error(a(476));var g=Xg(t).queue;Yg(t,g,s,q,o===null?qD:function(){return Qg(t),o(u)})}function Xg(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:q,baseState:q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:q},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:o},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function Qg(t){var s=Xg(t);s.next===null&&(s=t.alternate.memoizedState),wo(t,s.next.queue,{},on())}function xd(){return jt(Io)}function Zg(){return ft().memoizedState}function Kg(){return ft().memoizedState}function YD(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var o=on();t=Ri(o);var u=Oi(s,t,o);u!==null&&(Wt(u,s,o),go(u,s,o)),s={cache:Xu()},t.payload=s;return}s=s.return}}function XD(t,s,o){var u=on();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Kr(t)?ev(s,o):(o=Iu(t,s,o,u),o!==null&&(Wt(o,t,u),tv(o,s,u)))}function Jg(t,s,o){var u=on();wo(t,s,o,u)}function wo(t,s,o,u){var g={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Kr(t))ev(s,g);else{var v=t.alternate;if(t.lanes===0&&(v===null||v.lanes===0)&&(v=s.lastRenderedReducer,v!==null))try{var _=s.lastRenderedState,j=v(_,o);if(g.hasEagerState=!0,g.eagerState=j,Jt(j,_))return Rr(t,s,g,0),tt===null&&kr(),!1}catch{}if(o=Iu(t,s,g,u),o!==null)return Wt(o,t,u),tv(o,s,u),!0}return!1}function wd(t,s,o,u){if(u={lane:2,revertLane:Jd(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Kr(t)){if(s)throw Error(a(479))}else s=Iu(t,o,u,2),s!==null&&Wt(s,t,2)}function Kr(t){var s=t.alternate;return t===ze||s!==null&&s===ze}function ev(t,s){la=$r=!0;var o=t.pending;o===null?s.next=s:(s.next=o.next,o.next=s),t.pending=s}function tv(t,s,o){if((o&4194048)!==0){var u=s.lanes;u&=t.pendingLanes,o|=u,s.lanes=o,op(t,o)}}var So={readContext:jt,use:Yr,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};So.useEffectEvent=lt;var nv={readContext:jt,use:Yr,useCallback:function(t,s){return Lt().memoizedState=[t,s===void 0?null:s],t},useContext:jt,useEffect:Gg,useImperativeHandle:function(t,s,o){o=o!=null?o.concat([t]):null,Qr(4194308,4,Fg.bind(null,s,t),o)},useLayoutEffect:function(t,s){return Qr(4194308,4,t,s)},useInsertionEffect:function(t,s){Qr(4,2,t,s)},useMemo:function(t,s){var o=Lt();s=s===void 0?null:s;var u=t();if(Ss){_i(!0);try{t()}finally{_i(!1)}}return o.memoizedState=[u,s],u},useReducer:function(t,s,o){var u=Lt();if(o!==void 0){var g=o(s);if(Ss){_i(!0);try{o(s)}finally{_i(!1)}}}else g=s;return u.memoizedState=u.baseState=g,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:g},u.queue=t,t=t.dispatch=XD.bind(null,ze,t),[u.memoizedState,t]},useRef:function(t){var s=Lt();return t={current:t},s.memoizedState=t},useState:function(t){t=md(t);var s=t.queue,o=Jg.bind(null,ze,s);return s.dispatch=o,[t.memoizedState,o]},useDebugValue:vd,useDeferredValue:function(t,s){var o=Lt();return yd(o,t,s)},useTransition:function(){var t=md(!1);return t=Yg.bind(null,ze,t.queue,!0,!1),Lt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,o){var u=ze,g=Lt();if(Ue){if(o===void 0)throw Error(a(407));o=o()}else{if(o=s(),tt===null)throw Error(a(349));(Ve&127)!==0||Cg(u,s,o)}g.memoizedState=o;var v={value:o,getSnapshot:s};return g.queue=v,Gg(Eg.bind(null,u,v,t),[t]),u.flags|=2048,ua(9,{destroy:void 0},_g.bind(null,u,v,o,s),null),o},useId:function(){var t=Lt(),s=tt.identifierPrefix;if(Ue){var o=Bn,u=Gn;o=(u&~(1<<32-Kt(u)-1)).toString(32)+o,s="_"+s+"R_"+o,o=Wr++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=VD++,s="_"+s+"r_"+o.toString(32)+"_";return t.memoizedState=s},useHostTransitionStatus:xd,useFormState:zg,useActionState:zg,useOptimistic:function(t){var s=Lt();s.memoizedState=s.baseState=t;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=wd.bind(null,ze,!0,o),o.dispatch=s,[t,s]},useMemoCache:dd,useCacheRefresh:function(){return Lt().memoizedState=YD.bind(null,ze)},useEffectEvent:function(t){var s=Lt(),o={impl:t};return s.memoizedState=o,function(){if((Ye&2)!==0)throw Error(a(440));return o.impl.apply(void 0,arguments)}}},Sd={readContext:jt,use:Yr,useCallback:$g,useContext:jt,useEffect:gd,useImperativeHandle:Ug,useInsertionEffect:Hg,useLayoutEffect:Vg,useMemo:Wg,useReducer:Xr,useRef:Ig,useState:function(){return Xr(ci)},useDebugValue:vd,useDeferredValue:function(t,s){var o=ft();return qg(o,Ke.memoizedState,t,s)},useTransition:function(){var t=Xr(ci)[0],s=ft().memoizedState;return[typeof t=="boolean"?t:xo(t),s]},useSyncExternalStore:Sg,useId:Zg,useHostTransitionStatus:xd,useFormState:Mg,useActionState:Mg,useOptimistic:function(t,s){var o=ft();return Ng(o,Ke,t,s)},useMemoCache:dd,useCacheRefresh:Kg};Sd.useEffectEvent=Bg;var iv={readContext:jt,use:Yr,useCallback:$g,useContext:jt,useEffect:gd,useImperativeHandle:Ug,useInsertionEffect:Hg,useLayoutEffect:Vg,useMemo:Wg,useReducer:fd,useRef:Ig,useState:function(){return fd(ci)},useDebugValue:vd,useDeferredValue:function(t,s){var o=ft();return Ke===null?yd(o,t,s):qg(o,Ke.memoizedState,t,s)},useTransition:function(){var t=fd(ci)[0],s=ft().memoizedState;return[typeof t=="boolean"?t:xo(t),s]},useSyncExternalStore:Sg,useId:Zg,useHostTransitionStatus:xd,useFormState:Lg,useActionState:Lg,useOptimistic:function(t,s){var o=ft();return Ke!==null?Ng(o,Ke,t,s):(o.baseState=t,[t,o.queue.dispatch])},useMemoCache:dd,useCacheRefresh:Kg};iv.useEffectEvent=Bg;function Cd(t,s,o,u){s=t.memoizedState,o=o(u,s),o=o==null?s:b({},s,o),t.memoizedState=o,t.lanes===0&&(t.updateQueue.baseState=o)}var _d={enqueueSetState:function(t,s,o){t=t._reactInternals;var u=on(),g=Ri(u);g.payload=s,o!=null&&(g.callback=o),s=Oi(t,g,u),s!==null&&(Wt(s,t,u),go(s,t,u))},enqueueReplaceState:function(t,s,o){t=t._reactInternals;var u=on(),g=Ri(u);g.tag=1,g.payload=s,o!=null&&(g.callback=o),s=Oi(t,g,u),s!==null&&(Wt(s,t,u),go(s,t,u))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var o=on(),u=Ri(o);u.tag=2,s!=null&&(u.callback=s),s=Oi(t,u,o),s!==null&&(Wt(s,t,o),go(s,t,o))}};function sv(t,s,o,u,g,v,_){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,v,_):s.prototype&&s.prototype.isPureReactComponent?!ro(o,u)||!ro(g,v):!0}function av(t,s,o,u){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,u),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,u),s.state!==t&&_d.enqueueReplaceState(s,s.state,null)}function Cs(t,s){var o=s;if("ref"in s){o={};for(var u in s)u!=="ref"&&(o[u]=s[u])}if(t=t.defaultProps){o===s&&(o=b({},o));for(var g in t)o[g]===void 0&&(o[g]=t[g])}return o}function ov(t){Tr(t)}function rv(t){console.error(t)}function lv(t){Tr(t)}function Jr(t,s){try{var o=t.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(u){setTimeout(function(){throw u})}}function cv(t,s,o){try{var u=t.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Ed(t,s,o){return o=Ri(o),o.tag=3,o.payload={element:null},o.callback=function(){Jr(t,s)},o}function uv(t){return t=Ri(t),t.tag=3,t}function dv(t,s,o,u){var g=o.type.getDerivedStateFromError;if(typeof g=="function"){var v=u.value;t.payload=function(){return g(v)},t.callback=function(){cv(s,o,u)}}var _=o.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(t.callback=function(){cv(s,o,u),typeof g!="function"&&(Gi===null?Gi=new Set([this]):Gi.add(this));var j=u.stack;this.componentDidCatch(u.value,{componentStack:j!==null?j:""})})}function QD(t,s,o,u,g){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(s=o.alternate,s!==null&&na(s,o,g,!0),o=tn.current,o!==null){switch(o.tag){case 31:case 13:return yn===null?dl():o.alternate===null&&ct===0&&(ct=3),o.flags&=-257,o.flags|=65536,o.lanes=g,u===Br?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([u]):s.add(u),Qd(t,u,g)),!1;case 22:return o.flags|=65536,u===Br?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([u]):o.add(u)),Qd(t,u,g)),!1}throw Error(a(435,o.tag))}return Qd(t,u,g),dl(),!1}if(Ue)return s=tn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=g,u!==Uu&&(t=Error(a(422),{cause:u}),uo(mn(t,o)))):(u!==Uu&&(s=Error(a(423),{cause:u}),uo(mn(s,o))),t=t.current.alternate,t.flags|=65536,g&=-g,t.lanes|=g,u=mn(u,o),g=Ed(t.stateNode,u,g),td(t,g),ct!==4&&(ct=2)),!1;var v=Error(a(520),{cause:u});if(v=mn(v,o),To===null?To=[v]:To.push(v),ct!==4&&(ct=2),s===null)return!0;u=mn(u,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,t=g&-g,o.lanes|=t,t=Ed(o.stateNode,u,t),td(o,t),!1;case 1:if(s=o.type,v=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Gi===null||!Gi.has(v))))return o.flags|=65536,g&=-g,o.lanes|=g,g=uv(g),dv(g,t,o,u),td(o,g),!1}o=o.return}while(o!==null);return!1}var Dd=Error(a(461)),gt=!1;function Tt(t,s,o,u){s.child=t===null?pg(s,null,o,u):ws(s,t.child,o,u)}function hv(t,s,o,u,g){o=o.render;var v=s.ref;if("ref"in u){var _={};for(var j in u)j!=="ref"&&(_[j]=u[j])}else _=u;return vs(s),u=rd(t,s,o,_,v,g),j=ld(),t!==null&&!gt?(cd(t,s,g),ui(t,s,g)):(Ue&&j&&Vu(s),s.flags|=1,Tt(t,s,u,g),s.child)}function fv(t,s,o,u,g){if(t===null){var v=o.type;return typeof v=="function"&&!Gu(v)&&v.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=v,mv(t,s,v,u,g)):(t=zr(o.type,null,u,s,s.mode,g),t.ref=s.ref,t.return=s,s.child=t)}if(v=t.child,!zd(t,g)){var _=v.memoizedProps;if(o=o.compare,o=o!==null?o:ro,o(_,u)&&t.ref===s.ref)return ui(t,s,g)}return s.flags|=1,t=si(v,u),t.ref=s.ref,t.return=s,s.child=t}function mv(t,s,o,u,g){if(t!==null){var v=t.memoizedProps;if(ro(v,u)&&t.ref===s.ref)if(gt=!1,s.pendingProps=u=v,zd(t,g))(t.flags&131072)!==0&&(gt=!0);else return s.lanes=t.lanes,ui(t,s,g)}return Ad(t,s,o,u,g)}function pv(t,s,o,u){var g=u.children,v=t!==null?t.memoizedState:null;if(t===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((s.flags&128)!==0){if(v=v!==null?v.baseLanes|o:o,t!==null){for(u=s.child=t.child,g=0;u!==null;)g=g|u.lanes|u.childLanes,u=u.sibling;u=g&~v}else u=0,s.child=null;return gv(t,s,v,o,u)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&Ir(s,v!==null?v.cachePool:null),v!==null?yg(s,v):id(),bg(s);else return u=s.lanes=536870912,gv(t,s,v!==null?v.baseLanes|o:o,o,u)}else v!==null?(Ir(s,v.cachePool),yg(s,v),Mi(),s.memoizedState=null):(t!==null&&Ir(s,null),id(),Mi());return Tt(t,s,g,o),s.child}function Co(t,s){return t!==null&&t.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function gv(t,s,o,u,g){var v=Zu();return v=v===null?null:{parent:mt._currentValue,pool:v},s.memoizedState={baseLanes:o,cachePool:v},t!==null&&Ir(s,null),id(),bg(s),t!==null&&na(t,s,u,!0),s.childLanes=g,null}function el(t,s){return s=nl({mode:s.mode,children:s.children},t.mode),s.ref=t.ref,t.child=s,s.return=t,s}function vv(t,s,o){return ws(s,t.child,null,o),t=el(s,s.pendingProps),t.flags|=2,nn(s),s.memoizedState=null,t}function ZD(t,s,o){var u=s.pendingProps,g=(s.flags&128)!==0;if(s.flags&=-129,t===null){if(Ue){if(u.mode==="hidden")return t=el(s,u),s.lanes=536870912,Co(null,t);if(ad(s),(t=nt)?(t=jy(t,vn),t=t!==null&&t.data==="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ai!==null?{id:Gn,overflow:Bn}:null,retryLane:536870912,hydrationErrors:null},o=eg(t),o.return=s,s.child=o,Nt=s,nt=null)):t=null,t===null)throw ji(s);return s.lanes=536870912,null}return el(s,u)}var v=t.memoizedState;if(v!==null){var _=v.dehydrated;if(ad(s),g)if(s.flags&256)s.flags&=-257,s=vv(t,s,o);else if(s.memoizedState!==null)s.child=t.child,s.flags|=128,s=null;else throw Error(a(558));else if(gt||na(t,s,o,!1),g=(o&t.childLanes)!==0,gt||g){if(u=tt,u!==null&&(_=rp(u,o),_!==0&&_!==v.retryLane))throw v.retryLane=_,fs(t,_),Wt(u,t,_),Dd;dl(),s=vv(t,s,o)}else t=v.treeContext,nt=bn(_.nextSibling),Nt=s,Ue=!0,Ni=null,vn=!1,t!==null&&ig(s,t),s=el(s,u),s.flags|=4096;return s}return t=si(t.child,{mode:u.mode,children:u.children}),t.ref=s.ref,s.child=t,t.return=s,t}function tl(t,s){var o=s.ref;if(o===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(a(284));(t===null||t.ref!==o)&&(s.flags|=4194816)}}function Ad(t,s,o,u,g){return vs(s),o=rd(t,s,o,u,void 0,g),u=ld(),t!==null&&!gt?(cd(t,s,g),ui(t,s,g)):(Ue&&u&&Vu(s),s.flags|=1,Tt(t,s,o,g),s.child)}function yv(t,s,o,u,g,v){return vs(s),s.updateQueue=null,o=wg(s,u,o,g),xg(t),u=ld(),t!==null&&!gt?(cd(t,s,v),ui(t,s,v)):(Ue&&u&&Vu(s),s.flags|=1,Tt(t,s,o,v),s.child)}function bv(t,s,o,u,g){if(vs(s),s.stateNode===null){var v=Ks,_=o.contextType;typeof _=="object"&&_!==null&&(v=jt(_)),v=new o(u,v),s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=_d,s.stateNode=v,v._reactInternals=s,v=s.stateNode,v.props=u,v.state=s.memoizedState,v.refs={},Ju(s),_=o.contextType,v.context=typeof _=="object"&&_!==null?jt(_):Ks,v.state=s.memoizedState,_=o.getDerivedStateFromProps,typeof _=="function"&&(Cd(s,o,_,u),v.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(_=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),_!==v.state&&_d.enqueueReplaceState(v,v.state,null),yo(s,u,v,g),vo(),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308),u=!0}else if(t===null){v=s.stateNode;var j=s.memoizedProps,P=Cs(o,j);v.props=P;var Z=v.context,se=o.contextType;_=Ks,typeof se=="object"&&se!==null&&(_=jt(se));var re=o.getDerivedStateFromProps;se=typeof re=="function"||typeof v.getSnapshotBeforeUpdate=="function",j=s.pendingProps!==j,se||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(j||Z!==_)&&av(s,v,u,_),ki=!1;var J=s.memoizedState;v.state=J,yo(s,u,v,g),vo(),Z=s.memoizedState,j||J!==Z||ki?(typeof re=="function"&&(Cd(s,o,re,u),Z=s.memoizedState),(P=ki||sv(s,o,P,u,J,Z,_))?(se||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(s.flags|=4194308)):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=u,s.memoizedState=Z),v.props=u,v.state=Z,v.context=_,u=P):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),u=!1)}else{v=s.stateNode,ed(t,s),_=s.memoizedProps,se=Cs(o,_),v.props=se,re=s.pendingProps,J=v.context,Z=o.contextType,P=Ks,typeof Z=="object"&&Z!==null&&(P=jt(Z)),j=o.getDerivedStateFromProps,(Z=typeof j=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(_!==re||J!==P)&&av(s,v,u,P),ki=!1,J=s.memoizedState,v.state=J,yo(s,u,v,g),vo();var te=s.memoizedState;_!==re||J!==te||ki||t!==null&&t.dependencies!==null&&Pr(t.dependencies)?(typeof j=="function"&&(Cd(s,o,j,u),te=s.memoizedState),(se=ki||sv(s,o,se,u,J,te,P)||t!==null&&t.dependencies!==null&&Pr(t.dependencies))?(Z||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(u,te,P),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(u,te,P)),typeof v.componentDidUpdate=="function"&&(s.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof v.componentDidUpdate!="function"||_===t.memoizedProps&&J===t.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&J===t.memoizedState||(s.flags|=1024),s.memoizedProps=u,s.memoizedState=te),v.props=u,v.state=te,v.context=P,u=se):(typeof v.componentDidUpdate!="function"||_===t.memoizedProps&&J===t.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||_===t.memoizedProps&&J===t.memoizedState||(s.flags|=1024),u=!1)}return v=u,tl(t,s),u=(s.flags&128)!==0,v||u?(v=s.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:v.render(),s.flags|=1,t!==null&&u?(s.child=ws(s,t.child,null,g),s.child=ws(s,null,o,g)):Tt(t,s,o,g),s.memoizedState=v.state,t=s.child):t=ui(t,s,g),t}function xv(t,s,o,u){return ps(),s.flags|=256,Tt(t,s,o,u),s.child}var Nd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function jd(t){return{baseLanes:t,cachePool:cg()}}function Td(t,s,o){return t=t!==null?t.childLanes&~o:0,s&&(t|=an),t}function wv(t,s,o){var u=s.pendingProps,g=!1,v=(s.flags&128)!==0,_;if((_=v)||(_=t!==null&&t.memoizedState===null?!1:(ht.current&2)!==0),_&&(g=!0,s.flags&=-129),_=(s.flags&32)!==0,s.flags&=-33,t===null){if(Ue){if(g?zi(s):Mi(),(t=nt)?(t=jy(t,vn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ai!==null?{id:Gn,overflow:Bn}:null,retryLane:536870912,hydrationErrors:null},o=eg(t),o.return=s,s.child=o,Nt=s,nt=null)):t=null,t===null)throw ji(s);return hh(t)?s.lanes=32:s.lanes=536870912,null}var j=u.children;return u=u.fallback,g?(Mi(),g=s.mode,j=nl({mode:"hidden",children:j},g),u=ms(u,g,o,null),j.return=s,u.return=s,j.sibling=u,s.child=j,u=s.child,u.memoizedState=jd(o),u.childLanes=Td(t,_,o),s.memoizedState=Nd,Co(null,u)):(zi(s),kd(s,j))}var P=t.memoizedState;if(P!==null&&(j=P.dehydrated,j!==null)){if(v)s.flags&256?(zi(s),s.flags&=-257,s=Rd(t,s,o)):s.memoizedState!==null?(Mi(),s.child=t.child,s.flags|=128,s=null):(Mi(),j=u.fallback,g=s.mode,u=nl({mode:"visible",children:u.children},g),j=ms(j,g,o,null),j.flags|=2,u.return=s,j.return=s,u.sibling=j,s.child=u,ws(s,t.child,null,o),u=s.child,u.memoizedState=jd(o),u.childLanes=Td(t,_,o),s.memoizedState=Nd,s=Co(null,u));else if(zi(s),hh(j)){if(_=j.nextSibling&&j.nextSibling.dataset,_)var Z=_.dgst;_=Z,u=Error(a(419)),u.stack="",u.digest=_,uo({value:u,source:null,stack:null}),s=Rd(t,s,o)}else if(gt||na(t,s,o,!1),_=(o&t.childLanes)!==0,gt||_){if(_=tt,_!==null&&(u=rp(_,o),u!==0&&u!==P.retryLane))throw P.retryLane=u,fs(t,u),Wt(_,t,u),Dd;dh(j)||dl(),s=Rd(t,s,o)}else dh(j)?(s.flags|=192,s.child=t.child,s=null):(t=P.treeContext,nt=bn(j.nextSibling),Nt=s,Ue=!0,Ni=null,vn=!1,t!==null&&ig(s,t),s=kd(s,u.children),s.flags|=4096);return s}return g?(Mi(),j=u.fallback,g=s.mode,P=t.child,Z=P.sibling,u=si(P,{mode:"hidden",children:u.children}),u.subtreeFlags=P.subtreeFlags&65011712,Z!==null?j=si(Z,j):(j=ms(j,g,o,null),j.flags|=2),j.return=s,u.return=s,u.sibling=j,s.child=u,Co(null,u),u=s.child,j=t.child.memoizedState,j===null?j=jd(o):(g=j.cachePool,g!==null?(P=mt._currentValue,g=g.parent!==P?{parent:P,pool:P}:g):g=cg(),j={baseLanes:j.baseLanes|o,cachePool:g}),u.memoizedState=j,u.childLanes=Td(t,_,o),s.memoizedState=Nd,Co(t.child,u)):(zi(s),o=t.child,t=o.sibling,o=si(o,{mode:"visible",children:u.children}),o.return=s,o.sibling=null,t!==null&&(_=s.deletions,_===null?(s.deletions=[t],s.flags|=16):_.push(t)),s.child=o,s.memoizedState=null,o)}function kd(t,s){return s=nl({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function nl(t,s){return t=en(22,t,null,s),t.lanes=0,t}function Rd(t,s,o){return ws(s,t.child,null,o),t=kd(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function Sv(t,s,o){t.lanes|=s;var u=t.alternate;u!==null&&(u.lanes|=s),qu(t.return,s,o)}function Od(t,s,o,u,g,v){var _=t.memoizedState;_===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:g,treeForkCount:v}:(_.isBackwards=s,_.rendering=null,_.renderingStartTime=0,_.last=u,_.tail=o,_.tailMode=g,_.treeForkCount=v)}function Cv(t,s,o){var u=s.pendingProps,g=u.revealOrder,v=u.tail;u=u.children;var _=ht.current,j=(_&2)!==0;if(j?(_=_&1|2,s.flags|=128):_&=1,ee(ht,_),Tt(t,s,u,o),u=Ue?co:0,!j&&t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Sv(t,o,s);else if(t.tag===19)Sv(t,o,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(g){case"forwards":for(o=s.child,g=null;o!==null;)t=o.alternate,t!==null&&Ur(t)===null&&(g=o),o=o.sibling;o=g,o===null?(g=s.child,s.child=null):(g=o.sibling,o.sibling=null),Od(s,!1,g,o,v,u);break;case"backwards":case"unstable_legacy-backwards":for(o=null,g=s.child,s.child=null;g!==null;){if(t=g.alternate,t!==null&&Ur(t)===null){s.child=g;break}t=g.sibling,g.sibling=o,o=g,g=t}Od(s,!0,o,null,v,u);break;case"together":Od(s,!1,null,null,void 0,u);break;default:s.memoizedState=null}return s.child}function ui(t,s,o){if(t!==null&&(s.dependencies=t.dependencies),Ii|=s.lanes,(o&s.childLanes)===0)if(t!==null){if(na(t,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(a(153));if(s.child!==null){for(t=s.child,o=si(t,t.pendingProps),s.child=o,o.return=s;t.sibling!==null;)t=t.sibling,o=o.sibling=si(t,t.pendingProps),o.return=s;o.sibling=null}return s.child}function zd(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&Pr(t)))}function KD(t,s,o){switch(s.tag){case 3:ce(s,s.stateNode.containerInfo),Ti(s,mt,t.memoizedState.cache),ps();break;case 27:case 5:De(s);break;case 4:ce(s,s.stateNode.containerInfo);break;case 10:Ti(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,ad(s),null;break;case 13:var u=s.memoizedState;if(u!==null)return u.dehydrated!==null?(zi(s),s.flags|=128,null):(o&s.child.childLanes)!==0?wv(t,s,o):(zi(s),t=ui(t,s,o),t!==null?t.sibling:null);zi(s);break;case 19:var g=(t.flags&128)!==0;if(u=(o&s.childLanes)!==0,u||(na(t,s,o,!1),u=(o&s.childLanes)!==0),g){if(u)return Cv(t,s,o);s.flags|=128}if(g=s.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),ee(ht,ht.current),u)break;return null;case 22:return s.lanes=0,pv(t,s,o,s.pendingProps);case 24:Ti(s,mt,t.memoizedState.cache)}return ui(t,s,o)}function _v(t,s,o){if(t!==null)if(t.memoizedProps!==s.pendingProps)gt=!0;else{if(!zd(t,o)&&(s.flags&128)===0)return gt=!1,KD(t,s,o);gt=(t.flags&131072)!==0}else gt=!1,Ue&&(s.flags&1048576)!==0&&ng(s,co,s.index);switch(s.lanes=0,s.tag){case 16:e:{var u=s.pendingProps;if(t=bs(s.elementType),s.type=t,typeof t=="function")Gu(t)?(u=Cs(t,u),s.tag=1,s=bv(null,s,t,u,o)):(s.tag=0,s=Ad(null,s,t,u,o));else{if(t!=null){var g=t.$$typeof;if(g===T){s.tag=11,s=hv(null,s,t,u,o);break e}else if(g===O){s.tag=14,s=fv(null,s,t,u,o);break e}}throw s=ne(t)||t,Error(a(306,s,""))}}return s;case 0:return Ad(t,s,s.type,s.pendingProps,o);case 1:return u=s.type,g=Cs(u,s.pendingProps),bv(t,s,u,g,o);case 3:e:{if(ce(s,s.stateNode.containerInfo),t===null)throw Error(a(387));u=s.pendingProps;var v=s.memoizedState;g=v.element,ed(t,s),yo(s,u,null,o);var _=s.memoizedState;if(u=_.cache,Ti(s,mt,u),u!==v.cache&&Yu(s,[mt],o,!0),vo(),u=_.element,v.isDehydrated)if(v={element:u,isDehydrated:!1,cache:_.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=xv(t,s,u,o);break e}else if(u!==g){g=mn(Error(a(424)),s),uo(g),s=xv(t,s,u,o);break e}else for(t=s.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,nt=bn(t.firstChild),Nt=s,Ue=!0,Ni=null,vn=!0,o=pg(s,null,u,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ps(),u===g){s=ui(t,s,o);break e}Tt(t,s,u,o)}s=s.child}return s;case 26:return tl(t,s),t===null?(o=My(s.type,null,s.pendingProps,null))?s.memoizedState=o:Ue||(o=s.type,t=s.pendingProps,u=yl(le.current).createElement(o),u[At]=s,u[Bt]=t,kt(u,o,t),Ct(u),s.stateNode=u):s.memoizedState=My(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return De(s),t===null&&Ue&&(u=s.stateNode=Ry(s.type,s.pendingProps,le.current),Nt=s,vn=!0,g=nt,Fi(s.type)?(fh=g,nt=bn(u.firstChild)):nt=g),Tt(t,s,s.pendingProps.children,o),tl(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&Ue&&((g=u=nt)&&(u=NA(u,s.type,s.pendingProps,vn),u!==null?(s.stateNode=u,Nt=s,nt=bn(u.firstChild),vn=!1,g=!0):g=!1),g||ji(s)),De(s),g=s.type,v=s.pendingProps,_=t!==null?t.memoizedProps:null,u=v.children,lh(g,v)?u=null:_!==null&&lh(g,_)&&(s.flags|=32),s.memoizedState!==null&&(g=rd(t,s,FD,null,null,o),Io._currentValue=g),tl(t,s),Tt(t,s,u,o),s.child;case 6:return t===null&&Ue&&((t=o=nt)&&(o=jA(o,s.pendingProps,vn),o!==null?(s.stateNode=o,Nt=s,nt=null,t=!0):t=!1),t||ji(s)),null;case 13:return wv(t,s,o);case 4:return ce(s,s.stateNode.containerInfo),u=s.pendingProps,t===null?s.child=ws(s,null,u,o):Tt(t,s,u,o),s.child;case 11:return hv(t,s,s.type,s.pendingProps,o);case 7:return Tt(t,s,s.pendingProps,o),s.child;case 8:return Tt(t,s,s.pendingProps.children,o),s.child;case 12:return Tt(t,s,s.pendingProps.children,o),s.child;case 10:return u=s.pendingProps,Ti(s,s.type,u.value),Tt(t,s,u.children,o),s.child;case 9:return g=s.type._context,u=s.pendingProps.children,vs(s),g=jt(g),u=u(g),s.flags|=1,Tt(t,s,u,o),s.child;case 14:return fv(t,s,s.type,s.pendingProps,o);case 15:return mv(t,s,s.type,s.pendingProps,o);case 19:return Cv(t,s,o);case 31:return ZD(t,s,o);case 22:return pv(t,s,o,s.pendingProps);case 24:return vs(s),u=jt(mt),t===null?(g=Zu(),g===null&&(g=tt,v=Xu(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=o),g=v),s.memoizedState={parent:u,cache:g},Ju(s),Ti(s,mt,g)):((t.lanes&o)!==0&&(ed(t,s),yo(s,null,null,o),vo()),g=t.memoizedState,v=s.memoizedState,g.parent!==u?(g={parent:u,cache:u},s.memoizedState=g,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=g),Ti(s,mt,u)):(u=v.cache,Ti(s,mt,u),u!==g.cache&&Yu(s,[mt],o,!0))),Tt(t,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function di(t){t.flags|=4}function Md(t,s,o,u,g){if((s=(t.mode&32)!==0)&&(s=!1),s){if(t.flags|=16777216,(g&335544128)===g)if(t.stateNode.complete)t.flags|=8192;else if(Zv())t.flags|=8192;else throw xs=Br,Ku}else t.flags&=-16777217}function Ev(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!By(s))if(Zv())t.flags|=8192;else throw xs=Br,Ku}function il(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?sp():536870912,t.lanes|=s,ma|=s)}function _o(t,s){if(!Ue)switch(t.tailMode){case"hidden":s=t.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?t.tail=null:o.sibling=null;break;case"collapsed":o=t.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function it(t){var s=t.alternate!==null&&t.alternate.child===t.child,o=0,u=0;if(s)for(var g=t.child;g!==null;)o|=g.lanes|g.childLanes,u|=g.subtreeFlags&65011712,u|=g.flags&65011712,g.return=t,g=g.sibling;else for(g=t.child;g!==null;)o|=g.lanes|g.childLanes,u|=g.subtreeFlags,u|=g.flags,g.return=t,g=g.sibling;return t.subtreeFlags|=u,t.childLanes=o,s}function JD(t,s,o){var u=s.pendingProps;switch(Fu(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return it(s),null;case 1:return it(s),null;case 3:return o=s.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),s.memoizedState.cache!==u&&(s.flags|=2048),ri(mt),de(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(t===null||t.child===null)&&(ta(s)?di(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,$u())),it(s),null;case 26:var g=s.type,v=s.memoizedState;return t===null?(di(s),v!==null?(it(s),Ev(s,v)):(it(s),Md(s,g,null,u,o))):v?v!==t.memoizedState?(di(s),it(s),Ev(s,v)):(it(s),s.flags&=-16777217):(t=t.memoizedProps,t!==u&&di(s),it(s),Md(s,g,t,u,o)),null;case 27:if(Ge(s),o=le.current,g=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==u&&di(s);else{if(!u){if(s.stateNode===null)throw Error(a(166));return it(s),null}t=V.current,ta(s)?sg(s):(t=Ry(g,u,o),s.stateNode=t,di(s))}return it(s),null;case 5:if(Ge(s),g=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==u&&di(s);else{if(!u){if(s.stateNode===null)throw Error(a(166));return it(s),null}if(v=V.current,ta(s))sg(s);else{var _=yl(le.current);switch(v){case 1:v=_.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=_.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=_.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=_.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=_.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof u.is=="string"?_.createElement("select",{is:u.is}):_.createElement("select"),u.multiple?v.multiple=!0:u.size&&(v.size=u.size);break;default:v=typeof u.is=="string"?_.createElement(g,{is:u.is}):_.createElement(g)}}v[At]=s,v[Bt]=u;e:for(_=s.child;_!==null;){if(_.tag===5||_.tag===6)v.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===s)break e;for(;_.sibling===null;){if(_.return===null||_.return===s)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}s.stateNode=v;e:switch(kt(v,g,u),g){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&di(s)}}return it(s),Md(s,s.type,t===null?null:t.memoizedProps,s.pendingProps,o),null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==u&&di(s);else{if(typeof u!="string"&&s.stateNode===null)throw Error(a(166));if(t=le.current,ta(s)){if(t=s.stateNode,o=s.memoizedProps,u=null,g=Nt,g!==null)switch(g.tag){case 27:case 5:u=g.memoizedProps}t[At]=s,t=!!(t.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||wy(t.nodeValue,o)),t||ji(s,!0)}else t=yl(t).createTextNode(u),t[At]=s,s.stateNode=t}return it(s),null;case 31:if(o=s.memoizedState,t===null||t.memoizedState!==null){if(u=ta(s),o!==null){if(t===null){if(!u)throw Error(a(318));if(t=s.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(a(557));t[At]=s}else ps(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;it(s),t=!1}else o=$u(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return s.flags&256?(nn(s),s):(nn(s),null);if((s.flags&128)!==0)throw Error(a(558))}return it(s),null;case 13:if(u=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(g=ta(s),u!==null&&u.dehydrated!==null){if(t===null){if(!g)throw Error(a(318));if(g=s.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(a(317));g[At]=s}else ps(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;it(s),g=!1}else g=$u(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return s.flags&256?(nn(s),s):(nn(s),null)}return nn(s),(s.flags&128)!==0?(s.lanes=o,s):(o=u!==null,t=t!==null&&t.memoizedState!==null,o&&(u=s.child,g=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(g=u.alternate.memoizedState.cachePool.pool),v=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),v!==g&&(u.flags|=2048)),o!==t&&o&&(s.child.flags|=8192),il(s,s.updateQueue),it(s),null);case 4:return de(),t===null&&ih(s.stateNode.containerInfo),it(s),null;case 10:return ri(s.type),it(s),null;case 19:if(L(ht),u=s.memoizedState,u===null)return it(s),null;if(g=(s.flags&128)!==0,v=u.rendering,v===null)if(g)_o(u,!1);else{if(ct!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(v=Ur(t),v!==null){for(s.flags|=128,_o(u,!1),t=v.updateQueue,s.updateQueue=t,il(s,t),s.subtreeFlags=0,t=o,o=s.child;o!==null;)Jp(o,t),o=o.sibling;return ee(ht,ht.current&1|2),Ue&&ai(s,u.treeForkCount),s.child}t=t.sibling}u.tail!==null&&Qt()>ll&&(s.flags|=128,g=!0,_o(u,!1),s.lanes=4194304)}else{if(!g)if(t=Ur(v),t!==null){if(s.flags|=128,g=!0,t=t.updateQueue,s.updateQueue=t,il(s,t),_o(u,!0),u.tail===null&&u.tailMode==="hidden"&&!v.alternate&&!Ue)return it(s),null}else 2*Qt()-u.renderingStartTime>ll&&o!==536870912&&(s.flags|=128,g=!0,_o(u,!1),s.lanes=4194304);u.isBackwards?(v.sibling=s.child,s.child=v):(t=u.last,t!==null?t.sibling=v:s.child=v,u.last=v)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=Qt(),t.sibling=null,o=ht.current,ee(ht,g?o&1|2:o&1),Ue&&ai(s,u.treeForkCount),t):(it(s),null);case 22:case 23:return nn(s),sd(),u=s.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(s.flags|=8192):u&&(s.flags|=8192),u?(o&536870912)!==0&&(s.flags&128)===0&&(it(s),s.subtreeFlags&6&&(s.flags|=8192)):it(s),o=s.updateQueue,o!==null&&il(s,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==o&&(s.flags|=2048),t!==null&&L(ys),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ri(mt),it(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function eA(t,s){switch(Fu(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return ri(mt),de(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return Ge(s),null;case 31:if(s.memoizedState!==null){if(nn(s),s.alternate===null)throw Error(a(340));ps()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 13:if(nn(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(a(340));ps()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return L(ht),null;case 4:return de(),null;case 10:return ri(s.type),null;case 22:case 23:return nn(s),sd(),t!==null&&L(ys),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return ri(mt),null;case 25:return null;default:return null}}function Dv(t,s){switch(Fu(s),s.tag){case 3:ri(mt),de();break;case 26:case 27:case 5:Ge(s);break;case 4:de();break;case 31:s.memoizedState!==null&&nn(s);break;case 13:nn(s);break;case 19:L(ht);break;case 10:ri(s.type);break;case 22:case 23:nn(s),sd(),t!==null&&L(ys);break;case 24:ri(mt)}}function Eo(t,s){try{var o=s.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var g=u.next;o=g;do{if((o.tag&t)===t){u=void 0;var v=o.create,_=o.inst;u=v(),_.destroy=u}o=o.next}while(o!==g)}}catch(j){Ze(s,s.return,j)}}function Pi(t,s,o){try{var u=s.updateQueue,g=u!==null?u.lastEffect:null;if(g!==null){var v=g.next;u=v;do{if((u.tag&t)===t){var _=u.inst,j=_.destroy;if(j!==void 0){_.destroy=void 0,g=s;var P=o,Z=j;try{Z()}catch(se){Ze(g,P,se)}}}u=u.next}while(u!==v)}}catch(se){Ze(s,s.return,se)}}function Av(t){var s=t.updateQueue;if(s!==null){var o=t.stateNode;try{vg(s,o)}catch(u){Ze(t,t.return,u)}}}function Nv(t,s,o){o.props=Cs(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(u){Ze(t,s,u)}}function Do(t,s){try{var o=t.ref;if(o!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof o=="function"?t.refCleanup=o(u):o.current=u}}catch(g){Ze(t,s,g)}}function Hn(t,s){var o=t.ref,u=t.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(g){Ze(t,s,g)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(g){Ze(t,s,g)}else o.current=null}function jv(t){var s=t.type,o=t.memoizedProps,u=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(g){Ze(t,t.return,g)}}function Pd(t,s,o){try{var u=t.stateNode;SA(u,t.type,o,s),u[Bt]=s}catch(g){Ze(t,t.return,g)}}function Tv(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Fi(t.type)||t.tag===4}function Ld(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Fi(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Id(t,s,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(t,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(t),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=ni));else if(u!==4&&(u===27&&Fi(t.type)&&(o=t.stateNode,s=null),t=t.child,t!==null))for(Id(t,s,o),t=t.sibling;t!==null;)Id(t,s,o),t=t.sibling}function sl(t,s,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,s?o.insertBefore(t,s):o.appendChild(t);else if(u!==4&&(u===27&&Fi(t.type)&&(o=t.stateNode),t=t.child,t!==null))for(sl(t,s,o),t=t.sibling;t!==null;)sl(t,s,o),t=t.sibling}function kv(t){var s=t.stateNode,o=t.memoizedProps;try{for(var u=t.type,g=s.attributes;g.length;)s.removeAttributeNode(g[0]);kt(s,u,o),s[At]=t,s[Bt]=o}catch(v){Ze(t,t.return,v)}}var hi=!1,vt=!1,Gd=!1,Rv=typeof WeakSet=="function"?WeakSet:Set,_t=null;function tA(t,s){if(t=t.containerInfo,oh=El,t=Up(t),Ru(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var g=u.anchorOffset,v=u.focusNode;u=u.focusOffset;try{o.nodeType,v.nodeType}catch{o=null;break e}var _=0,j=-1,P=-1,Z=0,se=0,re=t,J=null;t:for(;;){for(var te;re!==o||g!==0&&re.nodeType!==3||(j=_+g),re!==v||u!==0&&re.nodeType!==3||(P=_+u),re.nodeType===3&&(_+=re.nodeValue.length),(te=re.firstChild)!==null;)J=re,re=te;for(;;){if(re===t)break t;if(J===o&&++Z===g&&(j=_),J===v&&++se===u&&(P=_),(te=re.nextSibling)!==null)break;re=J,J=re.parentNode}re=te}o=j===-1||P===-1?null:{start:j,end:P}}else o=null}o=o||{start:0,end:0}}else o=null;for(rh={focusedElem:t,selectionRange:o},El=!1,_t=s;_t!==null;)if(s=_t,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,_t=t;else for(;_t!==null;){switch(s=_t,v=s.alternate,t=s.flags,s.tag){case 0:if((t&4)!==0&&(t=s.updateQueue,t=t!==null?t.events:null,t!==null))for(o=0;o<t.length;o++)g=t[o],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&v!==null){t=void 0,o=s,g=v.memoizedProps,v=v.memoizedState,u=o.stateNode;try{var me=Cs(o.type,g);t=u.getSnapshotBeforeUpdate(me,v),u.__reactInternalSnapshotBeforeUpdate=t}catch(_e){Ze(o,o.return,_e)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,o=t.nodeType,o===9)uh(t);else if(o===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":uh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(a(163))}if(t=s.sibling,t!==null){t.return=s.return,_t=t;break}_t=s.return}}function Ov(t,s,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:mi(t,o),u&4&&Eo(5,o);break;case 1:if(mi(t,o),u&4)if(t=o.stateNode,s===null)try{t.componentDidMount()}catch(_){Ze(o,o.return,_)}else{var g=Cs(o.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(g,s,t.__reactInternalSnapshotBeforeUpdate)}catch(_){Ze(o,o.return,_)}}u&64&&Av(o),u&512&&Do(o,o.return);break;case 3:if(mi(t,o),u&64&&(t=o.updateQueue,t!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{vg(t,s)}catch(_){Ze(o,o.return,_)}}break;case 27:s===null&&u&4&&kv(o);case 26:case 5:mi(t,o),s===null&&u&4&&jv(o),u&512&&Do(o,o.return);break;case 12:mi(t,o);break;case 31:mi(t,o),u&4&&Pv(t,o);break;case 13:mi(t,o),u&4&&Lv(t,o),u&64&&(t=o.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(o=uA.bind(null,o),TA(t,o))));break;case 22:if(u=o.memoizedState!==null||hi,!u){s=s!==null&&s.memoizedState!==null||vt,g=hi;var v=vt;hi=u,(vt=s)&&!v?pi(t,o,(o.subtreeFlags&8772)!==0):mi(t,o),hi=g,vt=v}break;case 30:break;default:mi(t,o)}}function zv(t){var s=t.alternate;s!==null&&(t.alternate=null,zv(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&pu(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var at=null,Vt=!1;function fi(t,s,o){for(o=o.child;o!==null;)Mv(t,s,o),o=o.sibling}function Mv(t,s,o){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(Xa,o)}catch{}switch(o.tag){case 26:vt||Hn(o,s),fi(t,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:vt||Hn(o,s);var u=at,g=Vt;Fi(o.type)&&(at=o.stateNode,Vt=!1),fi(t,s,o),Mo(o.stateNode),at=u,Vt=g;break;case 5:vt||Hn(o,s);case 6:if(u=at,g=Vt,at=null,fi(t,s,o),at=u,Vt=g,at!==null)if(Vt)try{(at.nodeType===9?at.body:at.nodeName==="HTML"?at.ownerDocument.body:at).removeChild(o.stateNode)}catch(v){Ze(o,s,v)}else try{at.removeChild(o.stateNode)}catch(v){Ze(o,s,v)}break;case 18:at!==null&&(Vt?(t=at,Ay(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,o.stateNode),Sa(t)):Ay(at,o.stateNode));break;case 4:u=at,g=Vt,at=o.stateNode.containerInfo,Vt=!0,fi(t,s,o),at=u,Vt=g;break;case 0:case 11:case 14:case 15:Pi(2,o,s),vt||Pi(4,o,s),fi(t,s,o);break;case 1:vt||(Hn(o,s),u=o.stateNode,typeof u.componentWillUnmount=="function"&&Nv(o,s,u)),fi(t,s,o);break;case 21:fi(t,s,o);break;case 22:vt=(u=vt)||o.memoizedState!==null,fi(t,s,o),vt=u;break;default:fi(t,s,o)}}function Pv(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Sa(t)}catch(o){Ze(s,s.return,o)}}}function Lv(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Sa(t)}catch(o){Ze(s,s.return,o)}}function nA(t){switch(t.tag){case 31:case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new Rv),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new Rv),s;default:throw Error(a(435,t.tag))}}function al(t,s){var o=nA(t);s.forEach(function(u){if(!o.has(u)){o.add(u);var g=dA.bind(null,t,u);u.then(g,g)}})}function Ft(t,s){var o=s.deletions;if(o!==null)for(var u=0;u<o.length;u++){var g=o[u],v=t,_=s,j=_;e:for(;j!==null;){switch(j.tag){case 27:if(Fi(j.type)){at=j.stateNode,Vt=!1;break e}break;case 5:at=j.stateNode,Vt=!1;break e;case 3:case 4:at=j.stateNode.containerInfo,Vt=!0;break e}j=j.return}if(at===null)throw Error(a(160));Mv(v,_,g),at=null,Vt=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Iv(s,t),s=s.sibling}var jn=null;function Iv(t,s){var o=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Ft(s,t),Ut(t),u&4&&(Pi(3,t,t.return),Eo(3,t),Pi(5,t,t.return));break;case 1:Ft(s,t),Ut(t),u&512&&(vt||o===null||Hn(o,o.return)),u&64&&hi&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(o=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var g=jn;if(Ft(s,t),Ut(t),u&512&&(vt||o===null||Hn(o,o.return)),u&4){var v=o!==null?o.memoizedState:null;if(u=t.memoizedState,o===null)if(u===null)if(t.stateNode===null){e:{u=t.type,o=t.memoizedProps,g=g.ownerDocument||g;t:switch(u){case"title":v=g.getElementsByTagName("title")[0],(!v||v[Ka]||v[At]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(u),g.head.insertBefore(v,g.querySelector("head > title"))),kt(v,u,o),v[At]=t,Ct(v),u=v;break e;case"link":var _=Iy("link","href",g).get(u+(o.href||""));if(_){for(var j=0;j<_.length;j++)if(v=_[j],v.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&v.getAttribute("rel")===(o.rel==null?null:o.rel)&&v.getAttribute("title")===(o.title==null?null:o.title)&&v.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){_.splice(j,1);break t}}v=g.createElement(u),kt(v,u,o),g.head.appendChild(v);break;case"meta":if(_=Iy("meta","content",g).get(u+(o.content||""))){for(j=0;j<_.length;j++)if(v=_[j],v.getAttribute("content")===(o.content==null?null:""+o.content)&&v.getAttribute("name")===(o.name==null?null:o.name)&&v.getAttribute("property")===(o.property==null?null:o.property)&&v.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&v.getAttribute("charset")===(o.charSet==null?null:o.charSet)){_.splice(j,1);break t}}v=g.createElement(u),kt(v,u,o),g.head.appendChild(v);break;default:throw Error(a(468,u))}v[At]=t,Ct(v),u=v}t.stateNode=u}else Gy(g,t.type,t.stateNode);else t.stateNode=Ly(g,u,t.memoizedProps);else v!==u?(v===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):v.count--,u===null?Gy(g,t.type,t.stateNode):Ly(g,u,t.memoizedProps)):u===null&&t.stateNode!==null&&Pd(t,t.memoizedProps,o.memoizedProps)}break;case 27:Ft(s,t),Ut(t),u&512&&(vt||o===null||Hn(o,o.return)),o!==null&&u&4&&Pd(t,t.memoizedProps,o.memoizedProps);break;case 5:if(Ft(s,t),Ut(t),u&512&&(vt||o===null||Hn(o,o.return)),t.flags&32){g=t.stateNode;try{$s(g,"")}catch(me){Ze(t,t.return,me)}}u&4&&t.stateNode!=null&&(g=t.memoizedProps,Pd(t,g,o!==null?o.memoizedProps:g)),u&1024&&(Gd=!0);break;case 6:if(Ft(s,t),Ut(t),u&4){if(t.stateNode===null)throw Error(a(162));u=t.memoizedProps,o=t.stateNode;try{o.nodeValue=u}catch(me){Ze(t,t.return,me)}}break;case 3:if(wl=null,g=jn,jn=bl(s.containerInfo),Ft(s,t),jn=g,Ut(t),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Sa(s.containerInfo)}catch(me){Ze(t,t.return,me)}Gd&&(Gd=!1,Gv(t));break;case 4:u=jn,jn=bl(t.stateNode.containerInfo),Ft(s,t),Ut(t),jn=u;break;case 12:Ft(s,t),Ut(t);break;case 31:Ft(s,t),Ut(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,al(t,u)));break;case 13:Ft(s,t),Ut(t),t.child.flags&8192&&t.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(rl=Qt()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,al(t,u)));break;case 22:g=t.memoizedState!==null;var P=o!==null&&o.memoizedState!==null,Z=hi,se=vt;if(hi=Z||g,vt=se||P,Ft(s,t),vt=se,hi=Z,Ut(t),u&8192)e:for(s=t.stateNode,s._visibility=g?s._visibility&-2:s._visibility|1,g&&(o===null||P||hi||vt||_s(t)),o=null,s=t;;){if(s.tag===5||s.tag===26){if(o===null){P=o=s;try{if(v=P.stateNode,g)_=v.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{j=P.stateNode;var re=P.memoizedProps.style,J=re!=null&&re.hasOwnProperty("display")?re.display:null;j.style.display=J==null||typeof J=="boolean"?"":(""+J).trim()}}catch(me){Ze(P,P.return,me)}}}else if(s.tag===6){if(o===null){P=s;try{P.stateNode.nodeValue=g?"":P.memoizedProps}catch(me){Ze(P,P.return,me)}}}else if(s.tag===18){if(o===null){P=s;try{var te=P.stateNode;g?Ny(te,!0):Ny(P.stateNode,!1)}catch(me){Ze(P,P.return,me)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}u&4&&(u=t.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,al(t,o))));break;case 19:Ft(s,t),Ut(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,al(t,u)));break;case 30:break;case 21:break;default:Ft(s,t),Ut(t)}}function Ut(t){var s=t.flags;if(s&2){try{for(var o,u=t.return;u!==null;){if(Tv(u)){o=u;break}u=u.return}if(o==null)throw Error(a(160));switch(o.tag){case 27:var g=o.stateNode,v=Ld(t);sl(t,v,g);break;case 5:var _=o.stateNode;o.flags&32&&($s(_,""),o.flags&=-33);var j=Ld(t);sl(t,j,_);break;case 3:case 4:var P=o.stateNode.containerInfo,Z=Ld(t);Id(t,Z,P);break;default:throw Error(a(161))}}catch(se){Ze(t,t.return,se)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Gv(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;Gv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function mi(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Ov(t,s.alternate,s),s=s.sibling}function _s(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:Pi(4,s,s.return),_s(s);break;case 1:Hn(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&Nv(s,s.return,o),_s(s);break;case 27:Mo(s.stateNode);case 26:case 5:Hn(s,s.return),_s(s);break;case 22:s.memoizedState===null&&_s(s);break;case 30:_s(s);break;default:_s(s)}t=t.sibling}}function pi(t,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var u=s.alternate,g=t,v=s,_=v.flags;switch(v.tag){case 0:case 11:case 15:pi(g,v,o),Eo(4,v);break;case 1:if(pi(g,v,o),u=v,g=u.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(Z){Ze(u,u.return,Z)}if(u=v,g=u.updateQueue,g!==null){var j=u.stateNode;try{var P=g.shared.hiddenCallbacks;if(P!==null)for(g.shared.hiddenCallbacks=null,g=0;g<P.length;g++)gg(P[g],j)}catch(Z){Ze(u,u.return,Z)}}o&&_&64&&Av(v),Do(v,v.return);break;case 27:kv(v);case 26:case 5:pi(g,v,o),o&&u===null&&_&4&&jv(v),Do(v,v.return);break;case 12:pi(g,v,o);break;case 31:pi(g,v,o),o&&_&4&&Pv(g,v);break;case 13:pi(g,v,o),o&&_&4&&Lv(g,v);break;case 22:v.memoizedState===null&&pi(g,v,o),Do(v,v.return);break;case 30:break;default:pi(g,v,o)}s=s.sibling}}function Bd(t,s){var o=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==o&&(t!=null&&t.refCount++,o!=null&&ho(o))}function Hd(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&ho(t))}function Tn(t,s,o,u){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Bv(t,s,o,u),s=s.sibling}function Bv(t,s,o,u){var g=s.flags;switch(s.tag){case 0:case 11:case 15:Tn(t,s,o,u),g&2048&&Eo(9,s);break;case 1:Tn(t,s,o,u);break;case 3:Tn(t,s,o,u),g&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&ho(t)));break;case 12:if(g&2048){Tn(t,s,o,u),t=s.stateNode;try{var v=s.memoizedProps,_=v.id,j=v.onPostCommit;typeof j=="function"&&j(_,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(P){Ze(s,s.return,P)}}else Tn(t,s,o,u);break;case 31:Tn(t,s,o,u);break;case 13:Tn(t,s,o,u);break;case 23:break;case 22:v=s.stateNode,_=s.alternate,s.memoizedState!==null?v._visibility&2?Tn(t,s,o,u):Ao(t,s):v._visibility&2?Tn(t,s,o,u):(v._visibility|=2,da(t,s,o,u,(s.subtreeFlags&10256)!==0||!1)),g&2048&&Bd(_,s);break;case 24:Tn(t,s,o,u),g&2048&&Hd(s.alternate,s);break;default:Tn(t,s,o,u)}}function da(t,s,o,u,g){for(g=g&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var v=t,_=s,j=o,P=u,Z=_.flags;switch(_.tag){case 0:case 11:case 15:da(v,_,j,P,g),Eo(8,_);break;case 23:break;case 22:var se=_.stateNode;_.memoizedState!==null?se._visibility&2?da(v,_,j,P,g):Ao(v,_):(se._visibility|=2,da(v,_,j,P,g)),g&&Z&2048&&Bd(_.alternate,_);break;case 24:da(v,_,j,P,g),g&&Z&2048&&Hd(_.alternate,_);break;default:da(v,_,j,P,g)}s=s.sibling}}function Ao(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=t,u=s,g=u.flags;switch(u.tag){case 22:Ao(o,u),g&2048&&Bd(u.alternate,u);break;case 24:Ao(o,u),g&2048&&Hd(u.alternate,u);break;default:Ao(o,u)}s=s.sibling}}var No=8192;function ha(t,s,o){if(t.subtreeFlags&No)for(t=t.child;t!==null;)Hv(t,s,o),t=t.sibling}function Hv(t,s,o){switch(t.tag){case 26:ha(t,s,o),t.flags&No&&t.memoizedState!==null&&VA(o,jn,t.memoizedState,t.memoizedProps);break;case 5:ha(t,s,o);break;case 3:case 4:var u=jn;jn=bl(t.stateNode.containerInfo),ha(t,s,o),jn=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=No,No=16777216,ha(t,s,o),No=u):ha(t,s,o));break;default:ha(t,s,o)}}function Vv(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function jo(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var u=s[o];_t=u,Uv(u,t)}Vv(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Fv(t),t=t.sibling}function Fv(t){switch(t.tag){case 0:case 11:case 15:jo(t),t.flags&2048&&Pi(9,t,t.return);break;case 3:jo(t);break;case 12:jo(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,ol(t)):jo(t);break;default:jo(t)}}function ol(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var u=s[o];_t=u,Uv(u,t)}Vv(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:Pi(8,s,s.return),ol(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,ol(s));break;default:ol(s)}t=t.sibling}}function Uv(t,s){for(;_t!==null;){var o=_t;switch(o.tag){case 0:case 11:case 15:Pi(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:ho(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,_t=u;else e:for(o=t;_t!==null;){u=_t;var g=u.sibling,v=u.return;if(zv(u),u===o){_t=null;break e}if(g!==null){g.return=v,_t=g;break e}_t=v}}}var iA={getCacheForType:function(t){var s=jt(mt),o=s.data.get(t);return o===void 0&&(o=t(),s.data.set(t,o)),o},cacheSignal:function(){return jt(mt).controller.signal}},sA=typeof WeakMap=="function"?WeakMap:Map,Ye=0,tt=null,Be=null,Ve=0,Qe=0,sn=null,Li=!1,fa=!1,Vd=!1,gi=0,ct=0,Ii=0,Es=0,Fd=0,an=0,ma=0,To=null,$t=null,Ud=!1,rl=0,$v=0,ll=1/0,cl=null,Gi=null,bt=0,Bi=null,pa=null,vi=0,$d=0,Wd=null,Wv=null,ko=0,qd=null;function on(){return(Ye&2)!==0&&Ve!==0?Ve&-Ve:M.T!==null?Jd():lp()}function qv(){if(an===0)if((Ve&536870912)===0||Ue){var t=vr;vr<<=1,(vr&3932160)===0&&(vr=262144),an=t}else an=536870912;return t=tn.current,t!==null&&(t.flags|=32),an}function Wt(t,s,o){(t===tt&&(Qe===2||Qe===9)||t.cancelPendingCommit!==null)&&(ga(t,0),Hi(t,Ve,an,!1)),Za(t,o),((Ye&2)===0||t!==tt)&&(t===tt&&((Ye&2)===0&&(Es|=o),ct===4&&Hi(t,Ve,an,!1)),Vn(t))}function Yv(t,s,o){if((Ye&6)!==0)throw Error(a(327));var u=!o&&(s&127)===0&&(s&t.expiredLanes)===0||Qa(t,s),g=u?rA(t,s):Xd(t,s,!0),v=u;do{if(g===0){fa&&!u&&Hi(t,s,0,!1);break}else{if(o=t.current.alternate,v&&!aA(o)){g=Xd(t,s,!1),v=!1;continue}if(g===2){if(v=s,t.errorRecoveryDisabledLanes&v)var _=0;else _=t.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){s=_;e:{var j=t;g=To;var P=j.current.memoizedState.isDehydrated;if(P&&(ga(j,_).flags|=256),_=Xd(j,_,!1),_!==2){if(Vd&&!P){j.errorRecoveryDisabledLanes|=v,Es|=v,g=4;break e}v=$t,$t=g,v!==null&&($t===null?$t=v:$t.push.apply($t,v))}g=_}if(v=!1,g!==2)continue}}if(g===1){ga(t,0),Hi(t,s,0,!0);break}e:{switch(u=t,v=g,v){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:Hi(u,s,an,!Li);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(g=rl+300-Qt(),10<g)){if(Hi(u,s,an,!Li),br(u,0,!0)!==0)break e;vi=s,u.timeoutHandle=Ey(Xv.bind(null,u,o,$t,cl,Ud,s,an,Es,ma,Li,v,"Throttled",-0,0),g);break e}Xv(u,o,$t,cl,Ud,s,an,Es,ma,Li,v,null,-0,0)}}break}while(!0);Vn(t)}function Xv(t,s,o,u,g,v,_,j,P,Z,se,re,J,te){if(t.timeoutHandle=-1,re=s.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ni},Hv(s,v,re);var me=(v&62914560)===v?rl-Qt():(v&4194048)===v?$v-Qt():0;if(me=FA(re,me),me!==null){vi=v,t.cancelPendingCommit=me(iy.bind(null,t,s,v,o,u,g,_,j,P,se,re,null,J,te)),Hi(t,v,_,!Z);return}}iy(t,s,v,o,u,g,_,j,P)}function aA(t){for(var s=t;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var u=0;u<o.length;u++){var g=o[u],v=g.getSnapshot;g=g.value;try{if(!Jt(v(),g))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Hi(t,s,o,u){s&=~Fd,s&=~Es,t.suspendedLanes|=s,t.pingedLanes&=~s,u&&(t.warmLanes|=s),u=t.expirationTimes;for(var g=s;0<g;){var v=31-Kt(g),_=1<<v;u[v]=-1,g&=~_}o!==0&&ap(t,o,s)}function ul(){return(Ye&6)===0?(Ro(0),!1):!0}function Yd(){if(Be!==null){if(Qe===0)var t=Be.return;else t=Be,oi=gs=null,ud(t),oa=null,mo=0,t=Be;for(;t!==null;)Dv(t.alternate,t),t=t.return;Be=null}}function ga(t,s){var o=t.timeoutHandle;o!==-1&&(t.timeoutHandle=-1,EA(o)),o=t.cancelPendingCommit,o!==null&&(t.cancelPendingCommit=null,o()),vi=0,Yd(),tt=t,Be=o=si(t.current,null),Ve=s,Qe=0,sn=null,Li=!1,fa=Qa(t,s),Vd=!1,ma=an=Fd=Es=Ii=ct=0,$t=To=null,Ud=!1,(s&8)!==0&&(s|=s&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=s;0<u;){var g=31-Kt(u),v=1<<g;s|=t[g],u&=~v}return gi=s,kr(),o}function Qv(t,s){ze=null,M.H=So,s===aa||s===Gr?(s=hg(),Qe=3):s===Ku?(s=hg(),Qe=4):Qe=s===Dd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,sn=s,Be===null&&(ct=1,Jr(t,mn(s,t.current)))}function Zv(){var t=tn.current;return t===null?!0:(Ve&4194048)===Ve?yn===null:(Ve&62914560)===Ve||(Ve&536870912)!==0?t===yn:!1}function Kv(){var t=M.H;return M.H=So,t===null?So:t}function Jv(){var t=M.A;return M.A=iA,t}function dl(){ct=4,Li||(Ve&4194048)!==Ve&&tn.current!==null||(fa=!0),(Ii&134217727)===0&&(Es&134217727)===0||tt===null||Hi(tt,Ve,an,!1)}function Xd(t,s,o){var u=Ye;Ye|=2;var g=Kv(),v=Jv();(tt!==t||Ve!==s)&&(cl=null,ga(t,s)),s=!1;var _=ct;e:do try{if(Qe!==0&&Be!==null){var j=Be,P=sn;switch(Qe){case 8:Yd(),_=6;break e;case 3:case 2:case 9:case 6:tn.current===null&&(s=!0);var Z=Qe;if(Qe=0,sn=null,va(t,j,P,Z),o&&fa){_=0;break e}break;default:Z=Qe,Qe=0,sn=null,va(t,j,P,Z)}}oA(),_=ct;break}catch(se){Qv(t,se)}while(!0);return s&&t.shellSuspendCounter++,oi=gs=null,Ye=u,M.H=g,M.A=v,Be===null&&(tt=null,Ve=0,kr()),_}function oA(){for(;Be!==null;)ey(Be)}function rA(t,s){var o=Ye;Ye|=2;var u=Kv(),g=Jv();tt!==t||Ve!==s?(cl=null,ll=Qt()+500,ga(t,s)):fa=Qa(t,s);e:do try{if(Qe!==0&&Be!==null){s=Be;var v=sn;t:switch(Qe){case 1:Qe=0,sn=null,va(t,s,v,1);break;case 2:case 9:if(ug(v)){Qe=0,sn=null,ty(s);break}s=function(){Qe!==2&&Qe!==9||tt!==t||(Qe=7),Vn(t)},v.then(s,s);break e;case 3:Qe=7;break e;case 4:Qe=5;break e;case 7:ug(v)?(Qe=0,sn=null,ty(s)):(Qe=0,sn=null,va(t,s,v,7));break;case 5:var _=null;switch(Be.tag){case 26:_=Be.memoizedState;case 5:case 27:var j=Be;if(_?By(_):j.stateNode.complete){Qe=0,sn=null;var P=j.sibling;if(P!==null)Be=P;else{var Z=j.return;Z!==null?(Be=Z,hl(Z)):Be=null}break t}}Qe=0,sn=null,va(t,s,v,5);break;case 6:Qe=0,sn=null,va(t,s,v,6);break;case 8:Yd(),ct=6;break e;default:throw Error(a(462))}}lA();break}catch(se){Qv(t,se)}while(!0);return oi=gs=null,M.H=u,M.A=g,Ye=o,Be!==null?0:(tt=null,Ve=0,kr(),ct)}function lA(){for(;Be!==null&&!kE();)ey(Be)}function ey(t){var s=_v(t.alternate,t,gi);t.memoizedProps=t.pendingProps,s===null?hl(t):Be=s}function ty(t){var s=t,o=s.alternate;switch(s.tag){case 15:case 0:s=yv(o,s,s.pendingProps,s.type,void 0,Ve);break;case 11:s=yv(o,s,s.pendingProps,s.type.render,s.ref,Ve);break;case 5:ud(s);default:Dv(o,s),s=Be=Jp(s,gi),s=_v(o,s,gi)}t.memoizedProps=t.pendingProps,s===null?hl(t):Be=s}function va(t,s,o,u){oi=gs=null,ud(s),oa=null,mo=0;var g=s.return;try{if(QD(t,g,s,o,Ve)){ct=1,Jr(t,mn(o,t.current)),Be=null;return}}catch(v){if(g!==null)throw Be=g,v;ct=1,Jr(t,mn(o,t.current)),Be=null;return}s.flags&32768?(Ue||u===1?t=!0:fa||(Ve&536870912)!==0?t=!1:(Li=t=!0,(u===2||u===9||u===3||u===6)&&(u=tn.current,u!==null&&u.tag===13&&(u.flags|=16384))),ny(s,t)):hl(s)}function hl(t){var s=t;do{if((s.flags&32768)!==0){ny(s,Li);return}t=s.return;var o=JD(s.alternate,s,gi);if(o!==null){Be=o;return}if(s=s.sibling,s!==null){Be=s;return}Be=s=t}while(s!==null);ct===0&&(ct=5)}function ny(t,s){do{var o=eA(t.alternate,t);if(o!==null){o.flags&=32767,Be=o;return}if(o=t.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(t=t.sibling,t!==null)){Be=t;return}Be=t=o}while(t!==null);ct=6,Be=null}function iy(t,s,o,u,g,v,_,j,P){t.cancelPendingCommit=null;do fl();while(bt!==0);if((Ye&6)!==0)throw Error(a(327));if(s!==null){if(s===t.current)throw Error(a(177));if(v=s.lanes|s.childLanes,v|=Lu,HE(t,o,v,_,j,P),t===tt&&(Be=tt=null,Ve=0),pa=s,Bi=t,vi=o,$d=v,Wd=g,Wv=u,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,hA(pr,function(){return ly(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||u){u=M.T,M.T=null,g=K.p,K.p=2,_=Ye,Ye|=4;try{tA(t,s,o)}finally{Ye=_,K.p=g,M.T=u}}bt=1,sy(),ay(),oy()}}function sy(){if(bt===1){bt=0;var t=Bi,s=pa,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=M.T,M.T=null;var u=K.p;K.p=2;var g=Ye;Ye|=4;try{Iv(s,t);var v=rh,_=Up(t.containerInfo),j=v.focusedElem,P=v.selectionRange;if(_!==j&&j&&j.ownerDocument&&Fp(j.ownerDocument.documentElement,j)){if(P!==null&&Ru(j)){var Z=P.start,se=P.end;if(se===void 0&&(se=Z),"selectionStart"in j)j.selectionStart=Z,j.selectionEnd=Math.min(se,j.value.length);else{var re=j.ownerDocument||document,J=re&&re.defaultView||window;if(J.getSelection){var te=J.getSelection(),me=j.textContent.length,_e=Math.min(P.start,me),et=P.end===void 0?_e:Math.min(P.end,me);!te.extend&&_e>et&&(_=et,et=_e,_e=_);var F=Vp(j,_e),H=Vp(j,et);if(F&&H&&(te.rangeCount!==1||te.anchorNode!==F.node||te.anchorOffset!==F.offset||te.focusNode!==H.node||te.focusOffset!==H.offset)){var Q=re.createRange();Q.setStart(F.node,F.offset),te.removeAllRanges(),_e>et?(te.addRange(Q),te.extend(H.node,H.offset)):(Q.setEnd(H.node,H.offset),te.addRange(Q))}}}}for(re=[],te=j;te=te.parentNode;)te.nodeType===1&&re.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<re.length;j++){var oe=re[j];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}El=!!oh,rh=oh=null}finally{Ye=g,K.p=u,M.T=o}}t.current=s,bt=2}}function ay(){if(bt===2){bt=0;var t=Bi,s=pa,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=M.T,M.T=null;var u=K.p;K.p=2;var g=Ye;Ye|=4;try{Ov(t,s.alternate,s)}finally{Ye=g,K.p=u,M.T=o}}bt=3}}function oy(){if(bt===4||bt===3){bt=0,RE();var t=Bi,s=pa,o=vi,u=Wv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?bt=5:(bt=0,pa=Bi=null,ry(t,t.pendingLanes));var g=t.pendingLanes;if(g===0&&(Gi=null),fu(o),s=s.stateNode,Zt&&typeof Zt.onCommitFiberRoot=="function")try{Zt.onCommitFiberRoot(Xa,s,void 0,(s.current.flags&128)===128)}catch{}if(u!==null){s=M.T,g=K.p,K.p=2,M.T=null;try{for(var v=t.onRecoverableError,_=0;_<u.length;_++){var j=u[_];v(j.value,{componentStack:j.stack})}}finally{M.T=s,K.p=g}}(vi&3)!==0&&fl(),Vn(t),g=t.pendingLanes,(o&261930)!==0&&(g&42)!==0?t===qd?ko++:(ko=0,qd=t):ko=0,Ro(0)}}function ry(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,ho(s)))}function fl(){return sy(),ay(),oy(),ly()}function ly(){if(bt!==5)return!1;var t=Bi,s=$d;$d=0;var o=fu(vi),u=M.T,g=K.p;try{K.p=32>o?32:o,M.T=null,o=Wd,Wd=null;var v=Bi,_=vi;if(bt=0,pa=Bi=null,vi=0,(Ye&6)!==0)throw Error(a(331));var j=Ye;if(Ye|=4,Fv(v.current),Bv(v,v.current,_,o),Ye=j,Ro(0,!1),Zt&&typeof Zt.onPostCommitFiberRoot=="function")try{Zt.onPostCommitFiberRoot(Xa,v)}catch{}return!0}finally{K.p=g,M.T=u,ry(t,s)}}function cy(t,s,o){s=mn(o,s),s=Ed(t.stateNode,s,2),t=Oi(t,s,2),t!==null&&(Za(t,2),Vn(t))}function Ze(t,s,o){if(t.tag===3)cy(t,t,o);else for(;s!==null;){if(s.tag===3){cy(s,t,o);break}else if(s.tag===1){var u=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Gi===null||!Gi.has(u))){t=mn(o,t),o=uv(2),u=Oi(s,o,2),u!==null&&(dv(o,u,s,t),Za(u,2),Vn(u));break}}s=s.return}}function Qd(t,s,o){var u=t.pingCache;if(u===null){u=t.pingCache=new sA;var g=new Set;u.set(s,g)}else g=u.get(s),g===void 0&&(g=new Set,u.set(s,g));g.has(o)||(Vd=!0,g.add(o),t=cA.bind(null,t,s,o),s.then(t,t))}function cA(t,s,o){var u=t.pingCache;u!==null&&u.delete(s),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,tt===t&&(Ve&o)===o&&(ct===4||ct===3&&(Ve&62914560)===Ve&&300>Qt()-rl?(Ye&2)===0&&ga(t,0):Fd|=o,ma===Ve&&(ma=0)),Vn(t)}function uy(t,s){s===0&&(s=sp()),t=fs(t,s),t!==null&&(Za(t,s),Vn(t))}function uA(t){var s=t.memoizedState,o=0;s!==null&&(o=s.retryLane),uy(t,o)}function dA(t,s){var o=0;switch(t.tag){case 31:case 13:var u=t.stateNode,g=t.memoizedState;g!==null&&(o=g.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(a(314))}u!==null&&u.delete(s),uy(t,o)}function hA(t,s){return cu(t,s)}var ml=null,ya=null,Zd=!1,pl=!1,Kd=!1,Vi=0;function Vn(t){t!==ya&&t.next===null&&(ya===null?ml=ya=t:ya=ya.next=t),pl=!0,Zd||(Zd=!0,mA())}function Ro(t,s){if(!Kd&&pl){Kd=!0;do for(var o=!1,u=ml;u!==null;){if(t!==0){var g=u.pendingLanes;if(g===0)var v=0;else{var _=u.suspendedLanes,j=u.pingedLanes;v=(1<<31-Kt(42|t)+1)-1,v&=g&~(_&~j),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(o=!0,my(u,v))}else v=Ve,v=br(u,u===tt?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(v&3)===0||Qa(u,v)||(o=!0,my(u,v));u=u.next}while(o);Kd=!1}}function fA(){dy()}function dy(){pl=Zd=!1;var t=0;Vi!==0&&_A()&&(t=Vi);for(var s=Qt(),o=null,u=ml;u!==null;){var g=u.next,v=hy(u,s);v===0?(u.next=null,o===null?ml=g:o.next=g,g===null&&(ya=o)):(o=u,(t!==0||(v&3)!==0)&&(pl=!0)),u=g}bt!==0&&bt!==5||Ro(t),Vi!==0&&(Vi=0)}function hy(t,s){for(var o=t.suspendedLanes,u=t.pingedLanes,g=t.expirationTimes,v=t.pendingLanes&-62914561;0<v;){var _=31-Kt(v),j=1<<_,P=g[_];P===-1?((j&o)===0||(j&u)!==0)&&(g[_]=BE(j,s)):P<=s&&(t.expiredLanes|=j),v&=~j}if(s=tt,o=Ve,o=br(t,t===s?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,o===0||t===s&&(Qe===2||Qe===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&uu(u),t.callbackNode=null,t.callbackPriority=0;if((o&3)===0||Qa(t,o)){if(s=o&-o,s===t.callbackPriority)return s;switch(u!==null&&uu(u),fu(o)){case 2:case 8:o=np;break;case 32:o=pr;break;case 268435456:o=ip;break;default:o=pr}return u=fy.bind(null,t),o=cu(o,u),t.callbackPriority=s,t.callbackNode=o,s}return u!==null&&u!==null&&uu(u),t.callbackPriority=2,t.callbackNode=null,2}function fy(t,s){if(bt!==0&&bt!==5)return t.callbackNode=null,t.callbackPriority=0,null;var o=t.callbackNode;if(fl()&&t.callbackNode!==o)return null;var u=Ve;return u=br(t,t===tt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(Yv(t,u,s),hy(t,Qt()),t.callbackNode!=null&&t.callbackNode===o?fy.bind(null,t):null)}function my(t,s){if(fl())return null;Yv(t,s,!0)}function mA(){DA(function(){(Ye&6)!==0?cu(tp,fA):dy()})}function Jd(){if(Vi===0){var t=ia;t===0&&(t=gr,gr<<=1,(gr&261888)===0&&(gr=256)),Vi=t}return Vi}function py(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Cr(""+t)}function gy(t,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,t.id&&o.setAttribute("form",t.id),s.parentNode.insertBefore(o,s),t=new FormData(t),o.parentNode.removeChild(o),t}function pA(t,s,o,u,g){if(s==="submit"&&o&&o.stateNode===g){var v=py((g[Bt]||null).action),_=u.submitter;_&&(s=(s=_[Bt]||null)?py(s.formAction):_.getAttribute("formAction"),s!==null&&(v=s,_=null));var j=new Ar("action","action",null,u,g);t.push({event:j,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Vi!==0){var P=_?gy(g,_):new FormData(g);bd(o,{pending:!0,data:P,method:g.method,action:v},null,P)}}else typeof v=="function"&&(j.preventDefault(),P=_?gy(g,_):new FormData(g),bd(o,{pending:!0,data:P,method:g.method,action:v},v,P))},currentTarget:g}]})}}for(var eh=0;eh<Pu.length;eh++){var th=Pu[eh],gA=th.toLowerCase(),vA=th[0].toUpperCase()+th.slice(1);Nn(gA,"on"+vA)}Nn(qp,"onAnimationEnd"),Nn(Yp,"onAnimationIteration"),Nn(Xp,"onAnimationStart"),Nn("dblclick","onDoubleClick"),Nn("focusin","onFocus"),Nn("focusout","onBlur"),Nn(OD,"onTransitionRun"),Nn(zD,"onTransitionStart"),Nn(MD,"onTransitionCancel"),Nn(Qp,"onTransitionEnd"),Fs("onMouseEnter",["mouseout","mouseover"]),Fs("onMouseLeave",["mouseout","mouseover"]),Fs("onPointerEnter",["pointerout","pointerover"]),Fs("onPointerLeave",["pointerout","pointerover"]),cs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),cs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),cs("onBeforeInput",["compositionend","keypress","textInput","paste"]),cs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),cs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),cs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),yA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Oo));function vy(t,s){s=(s&4)!==0;for(var o=0;o<t.length;o++){var u=t[o],g=u.event;u=u.listeners;e:{var v=void 0;if(s)for(var _=u.length-1;0<=_;_--){var j=u[_],P=j.instance,Z=j.currentTarget;if(j=j.listener,P!==v&&g.isPropagationStopped())break e;v=j,g.currentTarget=Z;try{v(g)}catch(se){Tr(se)}g.currentTarget=null,v=P}else for(_=0;_<u.length;_++){if(j=u[_],P=j.instance,Z=j.currentTarget,j=j.listener,P!==v&&g.isPropagationStopped())break e;v=j,g.currentTarget=Z;try{v(g)}catch(se){Tr(se)}g.currentTarget=null,v=P}}}}function He(t,s){var o=s[mu];o===void 0&&(o=s[mu]=new Set);var u=t+"__bubble";o.has(u)||(yy(s,t,2,!1),o.add(u))}function nh(t,s,o){var u=0;s&&(u|=4),yy(o,t,u,s)}var gl="_reactListening"+Math.random().toString(36).slice(2);function ih(t){if(!t[gl]){t[gl]=!0,dp.forEach(function(o){o!=="selectionchange"&&(yA.has(o)||nh(o,!1,t),nh(o,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[gl]||(s[gl]=!0,nh("selectionchange",!1,s))}}function yy(t,s,o,u){switch(qy(s)){case 2:var g=WA;break;case 8:g=qA;break;default:g=yh}o=g.bind(null,s,o,t),g=void 0,!Cu||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(g=!0),u?g!==void 0?t.addEventListener(s,o,{capture:!0,passive:g}):t.addEventListener(s,o,!0):g!==void 0?t.addEventListener(s,o,{passive:g}):t.addEventListener(s,o,!1)}function sh(t,s,o,u,g){var v=u;if((s&1)===0&&(s&2)===0&&u!==null)e:for(;;){if(u===null)return;var _=u.tag;if(_===3||_===4){var j=u.stateNode.containerInfo;if(j===g)break;if(_===4)for(_=u.return;_!==null;){var P=_.tag;if((P===3||P===4)&&_.stateNode.containerInfo===g)return;_=_.return}for(;j!==null;){if(_=Bs(j),_===null)return;if(P=_.tag,P===5||P===6||P===26||P===27){u=v=_;continue e}j=j.parentNode}}u=u.return}Cp(function(){var Z=v,se=wu(o),re=[];e:{var J=Zp.get(t);if(J!==void 0){var te=Ar,me=t;switch(t){case"keypress":if(Er(o)===0)break e;case"keydown":case"keyup":te=dD;break;case"focusin":me="focus",te=Au;break;case"focusout":me="blur",te=Au;break;case"beforeblur":case"afterblur":te=Au;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":te=Dp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=JE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=mD;break;case qp:case Yp:case Xp:te=nD;break;case Qp:te=gD;break;case"scroll":case"scrollend":te=ZE;break;case"wheel":te=yD;break;case"copy":case"cut":case"paste":te=sD;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=Np;break;case"toggle":case"beforetoggle":te=xD}var _e=(s&4)!==0,et=!_e&&(t==="scroll"||t==="scrollend"),F=_e?J!==null?J+"Capture":null:J;_e=[];for(var H=Z,Q;H!==null;){var oe=H;if(Q=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||Q===null||F===null||(oe=eo(H,F),oe!=null&&_e.push(zo(H,oe,Q))),et)break;H=H.return}0<_e.length&&(J=new te(J,me,null,o,se),re.push({event:J,listeners:_e}))}}if((s&7)===0){e:{if(J=t==="mouseover"||t==="pointerover",te=t==="mouseout"||t==="pointerout",J&&o!==xu&&(me=o.relatedTarget||o.fromElement)&&(Bs(me)||me[Gs]))break e;if((te||J)&&(J=se.window===se?se:(J=se.ownerDocument)?J.defaultView||J.parentWindow:window,te?(me=o.relatedTarget||o.toElement,te=Z,me=me?Bs(me):null,me!==null&&(et=c(me),_e=me.tag,me!==et||_e!==5&&_e!==27&&_e!==6)&&(me=null)):(te=null,me=Z),te!==me)){if(_e=Dp,oe="onMouseLeave",F="onMouseEnter",H="mouse",(t==="pointerout"||t==="pointerover")&&(_e=Np,oe="onPointerLeave",F="onPointerEnter",H="pointer"),et=te==null?J:Ja(te),Q=me==null?J:Ja(me),J=new _e(oe,H+"leave",te,o,se),J.target=et,J.relatedTarget=Q,oe=null,Bs(se)===Z&&(_e=new _e(F,H+"enter",me,o,se),_e.target=Q,_e.relatedTarget=et,oe=_e),et=oe,te&&me)t:{for(_e=bA,F=te,H=me,Q=0,oe=F;oe;oe=_e(oe))Q++;oe=0;for(var xe=H;xe;xe=_e(xe))oe++;for(;0<Q-oe;)F=_e(F),Q--;for(;0<oe-Q;)H=_e(H),oe--;for(;Q--;){if(F===H||H!==null&&F===H.alternate){_e=F;break t}F=_e(F),H=_e(H)}_e=null}else _e=null;te!==null&&by(re,J,te,_e,!1),me!==null&&et!==null&&by(re,et,me,_e,!0)}}e:{if(J=Z?Ja(Z):window,te=J.nodeName&&J.nodeName.toLowerCase(),te==="select"||te==="input"&&J.type==="file")var We=Pp;else if(zp(J))if(Lp)We=TD;else{We=ND;var ve=AD}else te=J.nodeName,!te||te.toLowerCase()!=="input"||J.type!=="checkbox"&&J.type!=="radio"?Z&&bu(Z.elementType)&&(We=Pp):We=jD;if(We&&(We=We(t,Z))){Mp(re,We,o,se);break e}ve&&ve(t,J,Z),t==="focusout"&&Z&&J.type==="number"&&Z.memoizedProps.value!=null&&yu(J,"number",J.value)}switch(ve=Z?Ja(Z):window,t){case"focusin":(zp(ve)||ve.contentEditable==="true")&&(Xs=ve,Ou=Z,lo=null);break;case"focusout":lo=Ou=Xs=null;break;case"mousedown":zu=!0;break;case"contextmenu":case"mouseup":case"dragend":zu=!1,$p(re,o,se);break;case"selectionchange":if(RD)break;case"keydown":case"keyup":$p(re,o,se)}var Me;if(ju)e:{switch(t){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Ys?Rp(t,o)&&(Fe="onCompositionEnd"):t==="keydown"&&o.keyCode===229&&(Fe="onCompositionStart");Fe&&(jp&&o.locale!=="ko"&&(Ys||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Ys&&(Me=_p()):(Di=se,_u="value"in Di?Di.value:Di.textContent,Ys=!0)),ve=vl(Z,Fe),0<ve.length&&(Fe=new Ap(Fe,t,null,o,se),re.push({event:Fe,listeners:ve}),Me?Fe.data=Me:(Me=Op(o),Me!==null&&(Fe.data=Me)))),(Me=SD?CD(t,o):_D(t,o))&&(Fe=vl(Z,"onBeforeInput"),0<Fe.length&&(ve=new Ap("onBeforeInput","beforeinput",null,o,se),re.push({event:ve,listeners:Fe}),ve.data=Me)),pA(re,t,Z,o,se)}vy(re,s)})}function zo(t,s,o){return{instance:t,listener:s,currentTarget:o}}function vl(t,s){for(var o=s+"Capture",u=[];t!==null;){var g=t,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=eo(t,o),g!=null&&u.unshift(zo(t,g,v)),g=eo(t,s),g!=null&&u.push(zo(t,g,v))),t.tag===3)return u;t=t.return}return[]}function bA(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function by(t,s,o,u,g){for(var v=s._reactName,_=[];o!==null&&o!==u;){var j=o,P=j.alternate,Z=j.stateNode;if(j=j.tag,P!==null&&P===u)break;j!==5&&j!==26&&j!==27||Z===null||(P=Z,g?(Z=eo(o,v),Z!=null&&_.unshift(zo(o,Z,P))):g||(Z=eo(o,v),Z!=null&&_.push(zo(o,Z,P)))),o=o.return}_.length!==0&&t.push({event:s,listeners:_})}var xA=/\r\n?/g,wA=/\u0000|\uFFFD/g;function xy(t){return(typeof t=="string"?t:""+t).replace(xA,`
9
+ `).replace(wA,"")}function wy(t,s){return s=xy(s),xy(t)===s}function Je(t,s,o,u,g,v){switch(o){case"children":typeof u=="string"?s==="body"||s==="textarea"&&u===""||$s(t,u):(typeof u=="number"||typeof u=="bigint")&&s!=="body"&&$s(t,""+u);break;case"className":wr(t,"class",u);break;case"tabIndex":wr(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":wr(t,o,u);break;case"style":wp(t,u,v);break;case"data":if(s!=="object"){wr(t,"data",u);break}case"src":case"href":if(u===""&&(s!=="a"||o!=="href")){t.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(o);break}u=Cr(""+u),t.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(o==="formAction"?(s!=="input"&&Je(t,s,"name",g.name,g,null),Je(t,s,"formEncType",g.formEncType,g,null),Je(t,s,"formMethod",g.formMethod,g,null),Je(t,s,"formTarget",g.formTarget,g,null)):(Je(t,s,"encType",g.encType,g,null),Je(t,s,"method",g.method,g,null),Je(t,s,"target",g.target,g,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(o);break}u=Cr(""+u),t.setAttribute(o,u);break;case"onClick":u!=null&&(t.onclick=ni);break;case"onScroll":u!=null&&He("scroll",t);break;case"onScrollEnd":u!=null&&He("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(o=u.__html,o!=null){if(g.children!=null)throw Error(a(60));t.innerHTML=o}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}o=Cr(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,""+u):t.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,""):t.removeAttribute(o);break;case"capture":case"download":u===!0?t.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(o,u):t.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(o,u):t.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(o):t.setAttribute(o,u);break;case"popover":He("beforetoggle",t),He("toggle",t),xr(t,"popover",u);break;case"xlinkActuate":ti(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ti(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ti(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ti(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ti(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ti(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ti(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ti(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ti(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":xr(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=XE.get(o)||o,xr(t,o,u))}}function ah(t,s,o,u,g,v){switch(o){case"style":wp(t,u,v);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(a(61));if(o=u.__html,o!=null){if(g.children!=null)throw Error(a(60));t.innerHTML=o}}break;case"children":typeof u=="string"?$s(t,u):(typeof u=="number"||typeof u=="bigint")&&$s(t,""+u);break;case"onScroll":u!=null&&He("scroll",t);break;case"onScrollEnd":u!=null&&He("scrollend",t);break;case"onClick":u!=null&&(t.onclick=ni);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!hp.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(g=o.endsWith("Capture"),s=o.slice(2,g?o.length-7:void 0),v=t[Bt]||null,v=v!=null?v[o]:null,typeof v=="function"&&t.removeEventListener(s,v,g),typeof u=="function")){typeof v!="function"&&v!==null&&(o in t?t[o]=null:t.hasAttribute(o)&&t.removeAttribute(o)),t.addEventListener(s,u,g);break e}o in t?t[o]=u:u===!0?t.setAttribute(o,""):xr(t,o,u)}}}function kt(t,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":He("error",t),He("load",t);var u=!1,g=!1,v;for(v in o)if(o.hasOwnProperty(v)){var _=o[v];if(_!=null)switch(v){case"src":u=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Je(t,s,v,_,o,null)}}g&&Je(t,s,"srcSet",o.srcSet,o,null),u&&Je(t,s,"src",o.src,o,null);return;case"input":He("invalid",t);var j=v=_=g=null,P=null,Z=null;for(u in o)if(o.hasOwnProperty(u)){var se=o[u];if(se!=null)switch(u){case"name":g=se;break;case"type":_=se;break;case"checked":P=se;break;case"defaultChecked":Z=se;break;case"value":v=se;break;case"defaultValue":j=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(a(137,s));break;default:Je(t,s,u,se,o,null)}}vp(t,v,j,P,Z,_,g,!1);return;case"select":He("invalid",t),u=_=v=null;for(g in o)if(o.hasOwnProperty(g)&&(j=o[g],j!=null))switch(g){case"value":v=j;break;case"defaultValue":_=j;break;case"multiple":u=j;default:Je(t,s,g,j,o,null)}s=v,o=_,t.multiple=!!u,s!=null?Us(t,!!u,s,!1):o!=null&&Us(t,!!u,o,!0);return;case"textarea":He("invalid",t),v=g=u=null;for(_ in o)if(o.hasOwnProperty(_)&&(j=o[_],j!=null))switch(_){case"value":u=j;break;case"defaultValue":g=j;break;case"children":v=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(a(91));break;default:Je(t,s,_,j,o,null)}bp(t,u,g,v);return;case"option":for(P in o)o.hasOwnProperty(P)&&(u=o[P],u!=null)&&(P==="selected"?t.selected=u&&typeof u!="function"&&typeof u!="symbol":Je(t,s,P,u,o,null));return;case"dialog":He("beforetoggle",t),He("toggle",t),He("cancel",t),He("close",t);break;case"iframe":case"object":He("load",t);break;case"video":case"audio":for(u=0;u<Oo.length;u++)He(Oo[u],t);break;case"image":He("error",t),He("load",t);break;case"details":He("toggle",t);break;case"embed":case"source":case"link":He("error",t),He("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Z in o)if(o.hasOwnProperty(Z)&&(u=o[Z],u!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Je(t,s,Z,u,o,null)}return;default:if(bu(s)){for(se in o)o.hasOwnProperty(se)&&(u=o[se],u!==void 0&&ah(t,s,se,u,o,void 0));return}}for(j in o)o.hasOwnProperty(j)&&(u=o[j],u!=null&&Je(t,s,j,u,o,null))}function SA(t,s,o,u){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,_=null,j=null,P=null,Z=null,se=null;for(te in o){var re=o[te];if(o.hasOwnProperty(te)&&re!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":P=re;default:u.hasOwnProperty(te)||Je(t,s,te,null,u,re)}}for(var J in u){var te=u[J];if(re=o[J],u.hasOwnProperty(J)&&(te!=null||re!=null))switch(J){case"type":v=te;break;case"name":g=te;break;case"checked":Z=te;break;case"defaultChecked":se=te;break;case"value":_=te;break;case"defaultValue":j=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(a(137,s));break;default:te!==re&&Je(t,s,J,te,u,re)}}vu(t,_,j,P,Z,se,v,g);return;case"select":te=_=j=J=null;for(v in o)if(P=o[v],o.hasOwnProperty(v)&&P!=null)switch(v){case"value":break;case"multiple":te=P;default:u.hasOwnProperty(v)||Je(t,s,v,null,u,P)}for(g in u)if(v=u[g],P=o[g],u.hasOwnProperty(g)&&(v!=null||P!=null))switch(g){case"value":J=v;break;case"defaultValue":j=v;break;case"multiple":_=v;default:v!==P&&Je(t,s,g,v,u,P)}s=j,o=_,u=te,J!=null?Us(t,!!o,J,!1):!!u!=!!o&&(s!=null?Us(t,!!o,s,!0):Us(t,!!o,o?[]:"",!1));return;case"textarea":te=J=null;for(j in o)if(g=o[j],o.hasOwnProperty(j)&&g!=null&&!u.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:Je(t,s,j,null,u,g)}for(_ in u)if(g=u[_],v=o[_],u.hasOwnProperty(_)&&(g!=null||v!=null))switch(_){case"value":J=g;break;case"defaultValue":te=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(a(91));break;default:g!==v&&Je(t,s,_,g,u,v)}yp(t,J,te);return;case"option":for(var me in o)J=o[me],o.hasOwnProperty(me)&&J!=null&&!u.hasOwnProperty(me)&&(me==="selected"?t.selected=!1:Je(t,s,me,null,u,J));for(P in u)J=u[P],te=o[P],u.hasOwnProperty(P)&&J!==te&&(J!=null||te!=null)&&(P==="selected"?t.selected=J&&typeof J!="function"&&typeof J!="symbol":Je(t,s,P,J,u,te));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var _e in o)J=o[_e],o.hasOwnProperty(_e)&&J!=null&&!u.hasOwnProperty(_e)&&Je(t,s,_e,null,u,J);for(Z in u)if(J=u[Z],te=o[Z],u.hasOwnProperty(Z)&&J!==te&&(J!=null||te!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(a(137,s));break;default:Je(t,s,Z,J,u,te)}return;default:if(bu(s)){for(var et in o)J=o[et],o.hasOwnProperty(et)&&J!==void 0&&!u.hasOwnProperty(et)&&ah(t,s,et,void 0,u,J);for(se in u)J=u[se],te=o[se],!u.hasOwnProperty(se)||J===te||J===void 0&&te===void 0||ah(t,s,se,J,u,te);return}}for(var F in o)J=o[F],o.hasOwnProperty(F)&&J!=null&&!u.hasOwnProperty(F)&&Je(t,s,F,null,u,J);for(re in u)J=u[re],te=o[re],!u.hasOwnProperty(re)||J===te||J==null&&te==null||Je(t,s,re,J,u,te)}function Sy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function CA(){if(typeof performance.getEntriesByType=="function"){for(var t=0,s=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var g=o[u],v=g.transferSize,_=g.initiatorType,j=g.duration;if(v&&j&&Sy(_)){for(_=0,j=g.responseEnd,u+=1;u<o.length;u++){var P=o[u],Z=P.startTime;if(Z>j)break;var se=P.transferSize,re=P.initiatorType;se&&Sy(re)&&(P=P.responseEnd,_+=se*(P<j?1:(j-Z)/(P-Z)))}if(--u,s+=8*(v+_)/(g.duration/1e3),t++,10<t)break}}if(0<t)return s/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var oh=null,rh=null;function yl(t){return t.nodeType===9?t:t.ownerDocument}function Cy(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function _y(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function lh(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var ch=null;function _A(){var t=window.event;return t&&t.type==="popstate"?t===ch?!1:(ch=t,!0):(ch=null,!1)}var Ey=typeof setTimeout=="function"?setTimeout:void 0,EA=typeof clearTimeout=="function"?clearTimeout:void 0,Dy=typeof Promise=="function"?Promise:void 0,DA=typeof queueMicrotask=="function"?queueMicrotask:typeof Dy<"u"?function(t){return Dy.resolve(null).then(t).catch(AA)}:Ey;function AA(t){setTimeout(function(){throw t})}function Fi(t){return t==="head"}function Ay(t,s){var o=s,u=0;do{var g=o.nextSibling;if(t.removeChild(o),g&&g.nodeType===8)if(o=g.data,o==="/$"||o==="/&"){if(u===0){t.removeChild(g),Sa(s);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;else if(o==="html")Mo(t.ownerDocument.documentElement);else if(o==="head"){o=t.ownerDocument.head,Mo(o);for(var v=o.firstChild;v;){var _=v.nextSibling,j=v.nodeName;v[Ka]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&v.rel.toLowerCase()==="stylesheet"||o.removeChild(v),v=_}}else o==="body"&&Mo(t.ownerDocument.body);o=g}while(o);Sa(s)}function Ny(t,s){var o=t;t=0;do{var u=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(t===0)break;t--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||t++;o=u}while(o)}function uh(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":uh(o),pu(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}t.removeChild(o)}}function NA(t,s,o,u){for(;t.nodeType===1;){var g=o;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Ka])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(v=t.getAttribute("rel"),v==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(v!==g.rel||t.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||t.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||t.getAttribute("title")!==(g.title==null?null:g.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(v=t.getAttribute("src"),(v!==(g.src==null?null:g.src)||t.getAttribute("type")!==(g.type==null?null:g.type)||t.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&t.getAttribute("name")===v)return t}else return t;if(t=bn(t.nextSibling),t===null)break}return null}function jA(t,s,o){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!o||(t=bn(t.nextSibling),t===null))return null;return t}function jy(t,s){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=bn(t.nextSibling),t===null))return null;return t}function dh(t){return t.data==="$?"||t.data==="$~"}function hh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function TA(t,s){var o=t.ownerDocument;if(t.data==="$~")t._reactRetry=s;else if(t.data!=="$?"||o.readyState!=="loading")s();else{var u=function(){s(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function bn(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return t}var fh=null;function Ty(t){t=t.nextSibling;for(var s=0;t;){if(t.nodeType===8){var o=t.data;if(o==="/$"||o==="/&"){if(s===0)return bn(t.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}t=t.nextSibling}return null}function ky(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var o=t.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return t;s--}else o!=="/$"&&o!=="/&"||s++}t=t.previousSibling}return null}function Ry(t,s,o){switch(s=yl(o),t){case"html":if(t=s.documentElement,!t)throw Error(a(452));return t;case"head":if(t=s.head,!t)throw Error(a(453));return t;case"body":if(t=s.body,!t)throw Error(a(454));return t;default:throw Error(a(451))}}function Mo(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);pu(t)}var xn=new Map,Oy=new Set;function bl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var yi=K.d;K.d={f:kA,r:RA,D:OA,C:zA,L:MA,m:PA,X:IA,S:LA,M:GA};function kA(){var t=yi.f(),s=ul();return t||s}function RA(t){var s=Hs(t);s!==null&&s.tag===5&&s.type==="form"?Qg(s):yi.r(t)}var ba=typeof document>"u"?null:document;function zy(t,s,o){var u=ba;if(u&&typeof s=="string"&&s){var g=hn(s);g='link[rel="'+t+'"][href="'+g+'"]',typeof o=="string"&&(g+='[crossorigin="'+o+'"]'),Oy.has(g)||(Oy.add(g),t={rel:t,crossOrigin:o,href:s},u.querySelector(g)===null&&(s=u.createElement("link"),kt(s,"link",t),Ct(s),u.head.appendChild(s)))}}function OA(t){yi.D(t),zy("dns-prefetch",t,null)}function zA(t,s){yi.C(t,s),zy("preconnect",t,s)}function MA(t,s,o){yi.L(t,s,o);var u=ba;if(u&&t&&s){var g='link[rel="preload"][as="'+hn(s)+'"]';s==="image"&&o&&o.imageSrcSet?(g+='[imagesrcset="'+hn(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(g+='[imagesizes="'+hn(o.imageSizes)+'"]')):g+='[href="'+hn(t)+'"]';var v=g;switch(s){case"style":v=xa(t);break;case"script":v=wa(t)}xn.has(v)||(t=b({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:t,as:s},o),xn.set(v,t),u.querySelector(g)!==null||s==="style"&&u.querySelector(Po(v))||s==="script"&&u.querySelector(Lo(v))||(s=u.createElement("link"),kt(s,"link",t),Ct(s),u.head.appendChild(s)))}}function PA(t,s){yi.m(t,s);var o=ba;if(o&&t){var u=s&&typeof s.as=="string"?s.as:"script",g='link[rel="modulepreload"][as="'+hn(u)+'"][href="'+hn(t)+'"]',v=g;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=wa(t)}if(!xn.has(v)&&(t=b({rel:"modulepreload",href:t},s),xn.set(v,t),o.querySelector(g)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Lo(v)))return}u=o.createElement("link"),kt(u,"link",t),Ct(u),o.head.appendChild(u)}}}function LA(t,s,o){yi.S(t,s,o);var u=ba;if(u&&t){var g=Vs(u).hoistableStyles,v=xa(t);s=s||"default";var _=g.get(v);if(!_){var j={loading:0,preload:null};if(_=u.querySelector(Po(v)))j.loading=5;else{t=b({rel:"stylesheet",href:t,"data-precedence":s},o),(o=xn.get(v))&&mh(t,o);var P=_=u.createElement("link");Ct(P),kt(P,"link",t),P._p=new Promise(function(Z,se){P.onload=Z,P.onerror=se}),P.addEventListener("load",function(){j.loading|=1}),P.addEventListener("error",function(){j.loading|=2}),j.loading|=4,xl(_,s,u)}_={type:"stylesheet",instance:_,count:1,state:j},g.set(v,_)}}}function IA(t,s){yi.X(t,s);var o=ba;if(o&&t){var u=Vs(o).hoistableScripts,g=wa(t),v=u.get(g);v||(v=o.querySelector(Lo(g)),v||(t=b({src:t,async:!0},s),(s=xn.get(g))&&ph(t,s),v=o.createElement("script"),Ct(v),kt(v,"link",t),o.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(g,v))}}function GA(t,s){yi.M(t,s);var o=ba;if(o&&t){var u=Vs(o).hoistableScripts,g=wa(t),v=u.get(g);v||(v=o.querySelector(Lo(g)),v||(t=b({src:t,async:!0,type:"module"},s),(s=xn.get(g))&&ph(t,s),v=o.createElement("script"),Ct(v),kt(v,"link",t),o.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(g,v))}}function My(t,s,o,u){var g=(g=le.current)?bl(g):null;if(!g)throw Error(a(446));switch(t){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=xa(o.href),o=Vs(g).hoistableStyles,u=o.get(s),u||(u={type:"style",instance:null,count:0,state:null},o.set(s,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=xa(o.href);var v=Vs(g).hoistableStyles,_=v.get(t);if(_||(g=g.ownerDocument||g,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(t,_),(v=g.querySelector(Po(t)))&&!v._p&&(_.instance=v,_.state.loading=5),xn.has(t)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},xn.set(t,o),v||BA(g,t,o,_.state))),s&&u===null)throw Error(a(528,""));return _}if(s&&u!==null)throw Error(a(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=wa(o),o=Vs(g).hoistableScripts,u=o.get(s),u||(u={type:"script",instance:null,count:0,state:null},o.set(s,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,t))}}function xa(t){return'href="'+hn(t)+'"'}function Po(t){return'link[rel="stylesheet"]['+t+"]"}function Py(t){return b({},t,{"data-precedence":t.precedence,precedence:null})}function BA(t,s,o,u){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?u.loading=1:(s=t.createElement("link"),u.preload=s,s.addEventListener("load",function(){return u.loading|=1}),s.addEventListener("error",function(){return u.loading|=2}),kt(s,"link",o),Ct(s),t.head.appendChild(s))}function wa(t){return'[src="'+hn(t)+'"]'}function Lo(t){return"script[async]"+t}function Ly(t,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var u=t.querySelector('style[data-href~="'+hn(o.href)+'"]');if(u)return s.instance=u,Ct(u),u;var g=b({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),Ct(u),kt(u,"style",g),xl(u,o.precedence,t),s.instance=u;case"stylesheet":g=xa(o.href);var v=t.querySelector(Po(g));if(v)return s.state.loading|=4,s.instance=v,Ct(v),v;u=Py(o),(g=xn.get(g))&&mh(u,g),v=(t.ownerDocument||t).createElement("link"),Ct(v);var _=v;return _._p=new Promise(function(j,P){_.onload=j,_.onerror=P}),kt(v,"link",u),s.state.loading|=4,xl(v,o.precedence,t),s.instance=v;case"script":return v=wa(o.src),(g=t.querySelector(Lo(v)))?(s.instance=g,Ct(g),g):(u=o,(g=xn.get(v))&&(u=b({},o),ph(u,g)),t=t.ownerDocument||t,g=t.createElement("script"),Ct(g),kt(g,"link",u),t.head.appendChild(g),s.instance=g);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(u=s.instance,s.state.loading|=4,xl(u,o.precedence,t));return s.instance}function xl(t,s,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=u.length?u[u.length-1]:null,v=g,_=0;_<u.length;_++){var j=u[_];if(j.dataset.precedence===s)v=j;else if(v!==g)break}v?v.parentNode.insertBefore(t,v.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(t,s.firstChild))}function mh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function ph(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var wl=null;function Iy(t,s,o){if(wl===null){var u=new Map,g=wl=new Map;g.set(o,u)}else g=wl,u=g.get(o),u||(u=new Map,g.set(o,u));if(u.has(t))return u;for(u.set(t,null),o=o.getElementsByTagName(t),g=0;g<o.length;g++){var v=o[g];if(!(v[Ka]||v[At]||t==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var _=v.getAttribute(s)||"";_=t+_;var j=u.get(_);j?j.push(v):u.set(_,[v])}}return u}function Gy(t,s,o){t=t.ownerDocument||t,t.head.insertBefore(o,s==="title"?t.querySelector("head > title"):null)}function HA(t,s,o){if(o===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(t=s.disabled,typeof s.precedence=="string"&&t==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function By(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function VA(t,s,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var g=xa(u.href),v=s.querySelector(Po(g));if(v){s=v._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(t.count++,t=Sl.bind(t),s.then(t,t)),o.state.loading|=4,o.instance=v,Ct(v);return}v=s.ownerDocument||s,u=Py(u),(g=xn.get(g))&&mh(u,g),v=v.createElement("link"),Ct(v);var _=v;_._p=new Promise(function(j,P){_.onload=j,_.onerror=P}),kt(v,"link",u),o.instance=v}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=Sl.bind(t),s.addEventListener("load",o),s.addEventListener("error",o))}}var gh=0;function FA(t,s){return t.stylesheets&&t.count===0&&_l(t,t.stylesheets),0<t.count||0<t.imgCount?function(o){var u=setTimeout(function(){if(t.stylesheets&&_l(t,t.stylesheets),t.unsuspend){var v=t.unsuspend;t.unsuspend=null,v()}},6e4+s);0<t.imgBytes&&gh===0&&(gh=62500*CA());var g=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&_l(t,t.stylesheets),t.unsuspend)){var v=t.unsuspend;t.unsuspend=null,v()}},(t.imgBytes>gh?50:800)+s);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(g)}}:null}function Sl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_l(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Cl=null;function _l(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Cl=new Map,s.forEach(UA,t),Cl=null,Sl.call(t))}function UA(t,s){if(!(s.state.loading&4)){var o=Cl.get(t);if(o)var u=o.get(null);else{o=new Map,Cl.set(t,o);for(var g=t.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var _=g[v];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(o.set(_.dataset.precedence,_),u=_)}u&&o.set(null,u)}g=s.instance,_=g.getAttribute("data-precedence"),v=o.get(_)||u,v===u&&o.set(null,g),o.set(_,g),this.count++,u=Sl.bind(this),g.addEventListener("load",u),g.addEventListener("error",u),v?v.parentNode.insertBefore(g,v.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(g,t.firstChild)),s.state.loading|=4}}var Io={$$typeof:k,Provider:null,Consumer:null,_currentValue:q,_currentValue2:q,_threadCount:0};function $A(t,s,o,u,g,v,_,j,P){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=du(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=du(0),this.hiddenUpdates=du(null),this.identifierPrefix=u,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=P,this.incompleteTransitions=new Map}function Hy(t,s,o,u,g,v,_,j,P,Z,se,re){return t=new $A(t,s,o,_,P,Z,se,re,j),s=1,v===!0&&(s|=24),v=en(3,null,null,s),t.current=v,v.stateNode=t,s=Xu(),s.refCount++,t.pooledCache=s,s.refCount++,v.memoizedState={element:u,isDehydrated:o,cache:s},Ju(v),t}function Vy(t){return t?(t=Ks,t):Ks}function Fy(t,s,o,u,g,v){g=Vy(g),u.context===null?u.context=g:u.pendingContext=g,u=Ri(s),u.payload={element:o},v=v===void 0?null:v,v!==null&&(u.callback=v),o=Oi(t,u,s),o!==null&&(Wt(o,t,s),go(o,t,s))}function Uy(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var o=t.retryLane;t.retryLane=o!==0&&o<s?o:s}}function vh(t,s){Uy(t,s),(t=t.alternate)&&Uy(t,s)}function $y(t){if(t.tag===13||t.tag===31){var s=fs(t,67108864);s!==null&&Wt(s,t,67108864),vh(t,67108864)}}function Wy(t){if(t.tag===13||t.tag===31){var s=on();s=hu(s);var o=fs(t,s);o!==null&&Wt(o,t,s),vh(t,s)}}var El=!0;function WA(t,s,o,u){var g=M.T;M.T=null;var v=K.p;try{K.p=2,yh(t,s,o,u)}finally{K.p=v,M.T=g}}function qA(t,s,o,u){var g=M.T;M.T=null;var v=K.p;try{K.p=8,yh(t,s,o,u)}finally{K.p=v,M.T=g}}function yh(t,s,o,u){if(El){var g=bh(u);if(g===null)sh(t,s,u,Dl,o),Yy(t,u);else if(XA(g,t,s,o,u))u.stopPropagation();else if(Yy(t,u),s&4&&-1<YA.indexOf(t)){for(;g!==null;){var v=Hs(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var _=ls(v.pendingLanes);if(_!==0){var j=v;for(j.pendingLanes|=2,j.entangledLanes|=2;_;){var P=1<<31-Kt(_);j.entanglements[1]|=P,_&=~P}Vn(v),(Ye&6)===0&&(ll=Qt()+500,Ro(0))}}break;case 31:case 13:j=fs(v,2),j!==null&&Wt(j,v,2),ul(),vh(v,2)}if(v=bh(u),v===null&&sh(t,s,u,Dl,o),v===g)break;g=v}g!==null&&u.stopPropagation()}else sh(t,s,u,null,o)}}function bh(t){return t=wu(t),xh(t)}var Dl=null;function xh(t){if(Dl=null,t=Bs(t),t!==null){var s=c(t);if(s===null)t=null;else{var o=s.tag;if(o===13){if(t=d(s),t!==null)return t;t=null}else if(o===31){if(t=h(s),t!==null)return t;t=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return Dl=t,null}function qy(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(OE()){case tp:return 2;case np:return 8;case pr:case zE:return 32;case ip:return 268435456;default:return 32}default:return 32}}var wh=!1,Ui=null,$i=null,Wi=null,Go=new Map,Bo=new Map,qi=[],YA="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Yy(t,s){switch(t){case"focusin":case"focusout":Ui=null;break;case"dragenter":case"dragleave":$i=null;break;case"mouseover":case"mouseout":Wi=null;break;case"pointerover":case"pointerout":Go.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bo.delete(s.pointerId)}}function Ho(t,s,o,u,g,v){return t===null||t.nativeEvent!==v?(t={blockedOn:s,domEventName:o,eventSystemFlags:u,nativeEvent:v,targetContainers:[g]},s!==null&&(s=Hs(s),s!==null&&$y(s)),t):(t.eventSystemFlags|=u,s=t.targetContainers,g!==null&&s.indexOf(g)===-1&&s.push(g),t)}function XA(t,s,o,u,g){switch(s){case"focusin":return Ui=Ho(Ui,t,s,o,u,g),!0;case"dragenter":return $i=Ho($i,t,s,o,u,g),!0;case"mouseover":return Wi=Ho(Wi,t,s,o,u,g),!0;case"pointerover":var v=g.pointerId;return Go.set(v,Ho(Go.get(v)||null,t,s,o,u,g)),!0;case"gotpointercapture":return v=g.pointerId,Bo.set(v,Ho(Bo.get(v)||null,t,s,o,u,g)),!0}return!1}function Xy(t){var s=Bs(t.target);if(s!==null){var o=c(s);if(o!==null){if(s=o.tag,s===13){if(s=d(o),s!==null){t.blockedOn=s,cp(t.priority,function(){Wy(o)});return}}else if(s===31){if(s=h(o),s!==null){t.blockedOn=s,cp(t.priority,function(){Wy(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){t.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Al(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var o=bh(t.nativeEvent);if(o===null){o=t.nativeEvent;var u=new o.constructor(o.type,o);xu=u,o.target.dispatchEvent(u),xu=null}else return s=Hs(o),s!==null&&$y(s),t.blockedOn=o,!1;s.shift()}return!0}function Qy(t,s,o){Al(t)&&o.delete(s)}function QA(){wh=!1,Ui!==null&&Al(Ui)&&(Ui=null),$i!==null&&Al($i)&&($i=null),Wi!==null&&Al(Wi)&&(Wi=null),Go.forEach(Qy),Bo.forEach(Qy)}function Nl(t,s){t.blockedOn===s&&(t.blockedOn=null,wh||(wh=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,QA)))}var jl=null;function Zy(t){jl!==t&&(jl=t,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){jl===t&&(jl=null);for(var s=0;s<t.length;s+=3){var o=t[s],u=t[s+1],g=t[s+2];if(typeof u!="function"){if(xh(u||o)===null)continue;break}var v=Hs(o);v!==null&&(t.splice(s,3),s-=3,bd(v,{pending:!0,data:g,method:o.method,action:u},u,g))}}))}function Sa(t){function s(P){return Nl(P,t)}Ui!==null&&Nl(Ui,t),$i!==null&&Nl($i,t),Wi!==null&&Nl(Wi,t),Go.forEach(s),Bo.forEach(s);for(var o=0;o<qi.length;o++){var u=qi[o];u.blockedOn===t&&(u.blockedOn=null)}for(;0<qi.length&&(o=qi[0],o.blockedOn===null);)Xy(o),o.blockedOn===null&&qi.shift();if(o=(t.ownerDocument||t).$$reactFormReplay,o!=null)for(u=0;u<o.length;u+=3){var g=o[u],v=o[u+1],_=g[Bt]||null;if(typeof v=="function")_||Zy(o);else if(_){var j=null;if(v&&v.hasAttribute("formAction")){if(g=v,_=v[Bt]||null)j=_.formAction;else if(xh(g)!==null)continue}else j=_.action;typeof j=="function"?o[u+1]=j:(o.splice(u,3),u-=3),Zy(o)}}}function Ky(){function t(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(_){return g=_})},focusReset:"manual",scroll:"manual"})}function s(){g!==null&&(g(),g=null),u||setTimeout(o,20)}function o(){if(!u&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,g=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),g!==null&&(g(),g=null)}}}function Sh(t){this._internalRoot=t}Tl.prototype.render=Sh.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(a(409));var o=s.current,u=on();Fy(o,u,t,s,null,null)},Tl.prototype.unmount=Sh.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Fy(t.current,2,null,t,null,null),ul(),s[Gs]=null}};function Tl(t){this._internalRoot=t}Tl.prototype.unstable_scheduleHydration=function(t){if(t){var s=lp();t={blockedOn:null,target:t,priority:s};for(var o=0;o<qi.length&&s!==0&&s<qi[o].priority;o++);qi.splice(o,0,t),o===0&&Xy(t)}};var Jy=e.version;if(Jy!=="19.2.4")throw Error(a(527,Jy,"19.2.4"));K.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(a(188)):(t=Object.keys(t).join(","),Error(a(268,t)));return t=p(s),t=t!==null?y(t):null,t=t===null?null:t.stateNode,t};var ZA={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var kl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kl.isDisabled&&kl.supportsFiber)try{Xa=kl.inject(ZA),Zt=kl}catch{}}return Fo.createRoot=function(t,s){if(!r(t))throw Error(a(299));var o=!1,u="",g=ov,v=rv,_=lv;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(g=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(_=s.onRecoverableError)),s=Hy(t,1,!1,null,null,o,u,null,g,v,_,Ky),t[Gs]=s.current,ih(t),new Sh(s)},Fo.hydrateRoot=function(t,s,o){if(!r(t))throw Error(a(299));var u=!1,g="",v=ov,_=rv,j=lv,P=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(g=o.identifierPrefix),o.onUncaughtError!==void 0&&(v=o.onUncaughtError),o.onCaughtError!==void 0&&(_=o.onCaughtError),o.onRecoverableError!==void 0&&(j=o.onRecoverableError),o.formState!==void 0&&(P=o.formState)),s=Hy(t,1,!0,s,o??null,u,g,P,v,_,j,Ky),s.context=Vy(null),o=s.current,u=on(),u=hu(u),g=Ri(u),g.callback=null,Oi(o,g,u),o=u,s.current.lanes=o,Za(s,o),Vn(s),t[Gs]=s.current,ih(t),new Tl(s)},Fo.version="19.2.4",Fo}var cb;function rN(){if(cb)return _h.exports;cb=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),_h.exports=oN(),_h.exports}var lN=rN(),m=If();const ue=sw(m),Gf=JA({__proto__:null,default:ue},[m]);function ub(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function es(...n){return e=>{let i=!1;const a=n.map(r=>{const c=ub(r,e);return!i&&typeof c=="function"&&(i=!0),c});if(i)return()=>{for(let r=0;r<a.length;r++){const c=a[r];typeof c=="function"?c():ub(n[r],null)}}}}function Ie(...n){return m.useCallback(es(...n),n)}var cN=Symbol.for("react.lazy"),oc=Gf[" use ".trim().toString()];function uN(n){return typeof n=="object"&&n!==null&&"then"in n}function ow(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===cN&&"_payload"in n&&uN(n._payload)}function rw(n){const e=hN(n),i=m.forwardRef((a,r)=>{let{children:c,...d}=a;ow(c)&&typeof oc=="function"&&(c=oc(c._payload));const h=m.Children.toArray(c),f=h.find(mN);if(f){const p=f.props.children,y=h.map(b=>b===f?m.Children.count(p)>1?m.Children.only(null):m.isValidElement(p)?p.props.children:null:b);return l.jsx(e,{...d,ref:r,children:m.isValidElement(p)?m.cloneElement(p,void 0,y):null})}return l.jsx(e,{...d,ref:r,children:c})});return i.displayName=`${n}.Slot`,i}var dN=rw("Slot");function hN(n){const e=m.forwardRef((i,a)=>{let{children:r,...c}=i;if(ow(r)&&typeof oc=="function"&&(r=oc(r._payload)),m.isValidElement(r)){const d=gN(r),h=pN(c,r.props);return r.type!==m.Fragment&&(h.ref=a?es(a,d):d),m.cloneElement(r,h)}return m.Children.count(r)>1?m.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var fN=Symbol("radix.slottable");function mN(n){return m.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===fN}function pN(n,e){const i={...e};for(const a in e){const r=n[a],c=e[a];/^on[A-Z]/.test(a)?r&&c?i[a]=(...h)=>{const f=c(...h);return r(...h),f}:r&&(i[a]=r):a==="style"?i[a]={...r,...c}:a==="className"&&(i[a]=[r,c].filter(Boolean).join(" "))}return{...n,...i}}function gN(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning;return i?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}function lw(n){var e,i,a="";if(typeof n=="string"||typeof n=="number")a+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(i=lw(n[e]))&&(a&&(a+=" "),a+=i)}else for(i in n)n[i]&&(a&&(a+=" "),a+=i);return a}function cw(){for(var n,e,i=0,a="",r=arguments.length;i<r;i++)(n=arguments[i])&&(e=lw(n))&&(a&&(a+=" "),a+=e);return a}const db=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,hb=cw,Bf=(n,e)=>i=>{var a;if(e?.variants==null)return hb(n,i?.class,i?.className);const{variants:r,defaultVariants:c}=e,d=Object.keys(r).map(p=>{const y=i?.[p],b=c?.[p];if(y===null)return null;const x=db(y)||db(b);return r[p][x]}),h=i&&Object.entries(i).reduce((p,y)=>{let[b,x]=y;return x===void 0||(p[b]=x),p},{}),f=e==null||(a=e.compoundVariants)===null||a===void 0?void 0:a.reduce((p,y)=>{let{class:b,className:x,...w}=y;return Object.entries(w).every(E=>{let[C,S]=E;return Array.isArray(S)?S.includes({...c,...h}[C]):{...c,...h}[C]===S})?[...p,b,x]:p},[]);return hb(n,d,f,i?.class,i?.className)},vN=(n,e)=>{const i=new Array(n.length+e.length);for(let a=0;a<n.length;a++)i[a]=n[a];for(let a=0;a<e.length;a++)i[n.length+a]=e[a];return i},yN=(n,e)=>({classGroupId:n,validator:e}),uw=(n=new Map,e=null,i)=>({nextPart:n,validators:e,classGroupId:i}),rc="-",fb=[],bN="arbitrary..",xN=n=>{const e=SN(n),{conflictingClassGroups:i,conflictingClassGroupModifiers:a}=n;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return wN(d);const h=d.split(rc),f=h[0]===""&&h.length>1?1:0;return dw(h,f,e)},getConflictingClassGroupIds:(d,h)=>{if(h){const f=a[d],p=i[d];return f?p?vN(p,f):f:p||fb}return i[d]||fb}}},dw=(n,e,i)=>{if(n.length-e===0)return i.classGroupId;const r=n[e],c=i.nextPart.get(r);if(c){const p=dw(n,e+1,c);if(p)return p}const d=i.validators;if(d===null)return;const h=e===0?n.join(rc):n.slice(e).join(rc),f=d.length;for(let p=0;p<f;p++){const y=d[p];if(y.validator(h))return y.classGroupId}},wN=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),i=e.indexOf(":"),a=e.slice(0,i);return a?bN+a:void 0})(),SN=n=>{const{theme:e,classGroups:i}=n;return CN(i,e)},CN=(n,e)=>{const i=uw();for(const a in n){const r=n[a];Hf(r,i,a,e)}return i},Hf=(n,e,i,a)=>{const r=n.length;for(let c=0;c<r;c++){const d=n[c];_N(d,e,i,a)}},_N=(n,e,i,a)=>{if(typeof n=="string"){EN(n,e,i);return}if(typeof n=="function"){DN(n,e,i,a);return}AN(n,e,i,a)},EN=(n,e,i)=>{const a=n===""?e:hw(e,n);a.classGroupId=i},DN=(n,e,i,a)=>{if(NN(n)){Hf(n(a),e,i,a);return}e.validators===null&&(e.validators=[]),e.validators.push(yN(i,n))},AN=(n,e,i,a)=>{const r=Object.entries(n),c=r.length;for(let d=0;d<c;d++){const[h,f]=r[d];Hf(f,hw(e,h),i,a)}},hw=(n,e)=>{let i=n;const a=e.split(rc),r=a.length;for(let c=0;c<r;c++){const d=a[c];let h=i.nextPart.get(d);h||(h=uw(),i.nextPart.set(d,h)),i=h}return i},NN=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,jN=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,i=Object.create(null),a=Object.create(null);const r=(c,d)=>{i[c]=d,e++,e>n&&(e=0,a=i,i=Object.create(null))};return{get(c){let d=i[c];if(d!==void 0)return d;if((d=a[c])!==void 0)return r(c,d),d},set(c,d){c in i?i[c]=d:r(c,d)}}},nf="!",mb=":",TN=[],pb=(n,e,i,a,r)=>({modifiers:n,hasImportantModifier:e,baseClassName:i,maybePostfixModifierPosition:a,isExternal:r}),kN=n=>{const{prefix:e,experimentalParseClassName:i}=n;let a=r=>{const c=[];let d=0,h=0,f=0,p;const y=r.length;for(let C=0;C<y;C++){const S=r[C];if(d===0&&h===0){if(S===mb){c.push(r.slice(f,C)),f=C+1;continue}if(S==="/"){p=C;continue}}S==="["?d++:S==="]"?d--:S==="("?h++:S===")"&&h--}const b=c.length===0?r:r.slice(f);let x=b,w=!1;b.endsWith(nf)?(x=b.slice(0,-1),w=!0):b.startsWith(nf)&&(x=b.slice(1),w=!0);const E=p&&p>f?p-f:void 0;return pb(c,w,x,E)};if(e){const r=e+mb,c=a;a=d=>d.startsWith(r)?c(d.slice(r.length)):pb(TN,!1,d,void 0,!0)}if(i){const r=a;a=c=>i({className:c,parseClassName:r})}return a},RN=n=>{const e=new Map;return n.orderSensitiveModifiers.forEach((i,a)=>{e.set(i,1e6+a)}),i=>{const a=[];let r=[];for(let c=0;c<i.length;c++){const d=i[c],h=d[0]==="[",f=e.has(d);h||f?(r.length>0&&(r.sort(),a.push(...r),r=[]),a.push(d)):r.push(d)}return r.length>0&&(r.sort(),a.push(...r)),a}},ON=n=>({cache:jN(n.cacheSize),parseClassName:kN(n),sortModifiers:RN(n),...xN(n)}),zN=/\s+/,MN=(n,e)=>{const{parseClassName:i,getClassGroupId:a,getConflictingClassGroupIds:r,sortModifiers:c}=e,d=[],h=n.trim().split(zN);let f="";for(let p=h.length-1;p>=0;p-=1){const y=h[p],{isExternal:b,modifiers:x,hasImportantModifier:w,baseClassName:E,maybePostfixModifierPosition:C}=i(y);if(b){f=y+(f.length>0?" "+f:f);continue}let S=!!C,D=a(S?E.substring(0,C):E);if(!D){if(!S){f=y+(f.length>0?" "+f:f);continue}if(D=a(E),!D){f=y+(f.length>0?" "+f:f);continue}S=!1}const N=x.length===0?"":x.length===1?x[0]:c(x).join(":"),k=w?N+nf:N,T=k+D;if(d.indexOf(T)>-1)continue;d.push(T);const R=r(D,S);for(let z=0;z<R.length;++z){const O=R[z];d.push(k+O)}f=y+(f.length>0?" "+f:f)}return f},PN=(...n)=>{let e=0,i,a,r="";for(;e<n.length;)(i=n[e++])&&(a=fw(i))&&(r&&(r+=" "),r+=a);return r},fw=n=>{if(typeof n=="string")return n;let e,i="";for(let a=0;a<n.length;a++)n[a]&&(e=fw(n[a]))&&(i&&(i+=" "),i+=e);return i},LN=(n,...e)=>{let i,a,r,c;const d=f=>{const p=e.reduce((y,b)=>b(y),n());return i=ON(p),a=i.cache.get,r=i.cache.set,c=h,h(f)},h=f=>{const p=a(f);if(p)return p;const y=MN(f,i);return r(f,y),y};return c=d,(...f)=>c(PN(...f))},IN=[],xt=n=>{const e=i=>i[n]||IN;return e.isThemeGetter=!0,e},mw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,GN=/^\d+\/\d+$/,BN=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,HN=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,VN=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,FN=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,UN=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ca=n=>GN.test(n),Le=n=>!!n&&!Number.isNaN(Number(n)),Xi=n=>!!n&&Number.isInteger(Number(n)),jh=n=>n.endsWith("%")&&Le(n.slice(0,-1)),bi=n=>BN.test(n),$N=()=>!0,WN=n=>HN.test(n)&&!VN.test(n),gw=()=>!1,qN=n=>FN.test(n),YN=n=>UN.test(n),XN=n=>!pe(n)&&!ge(n),QN=n=>Va(n,bw,gw),pe=n=>mw.test(n),Ds=n=>Va(n,xw,WN),Th=n=>Va(n,tj,Le),gb=n=>Va(n,vw,gw),ZN=n=>Va(n,yw,YN),Rl=n=>Va(n,ww,qN),ge=n=>pw.test(n),Uo=n=>Fa(n,xw),KN=n=>Fa(n,nj),vb=n=>Fa(n,vw),JN=n=>Fa(n,bw),ej=n=>Fa(n,yw),Ol=n=>Fa(n,ww,!0),Va=(n,e,i)=>{const a=mw.exec(n);return a?a[1]?e(a[1]):i(a[2]):!1},Fa=(n,e,i=!1)=>{const a=pw.exec(n);return a?a[1]?e(a[1]):i:!1},vw=n=>n==="position"||n==="percentage",yw=n=>n==="image"||n==="url",bw=n=>n==="length"||n==="size"||n==="bg-size",xw=n=>n==="length",tj=n=>n==="number",nj=n=>n==="family-name",ww=n=>n==="shadow",ij=()=>{const n=xt("color"),e=xt("font"),i=xt("text"),a=xt("font-weight"),r=xt("tracking"),c=xt("leading"),d=xt("breakpoint"),h=xt("container"),f=xt("spacing"),p=xt("radius"),y=xt("shadow"),b=xt("inset-shadow"),x=xt("text-shadow"),w=xt("drop-shadow"),E=xt("blur"),C=xt("perspective"),S=xt("aspect"),D=xt("ease"),N=xt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...T(),ge,pe],z=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],A=()=>[ge,pe,f],G=()=>[Ca,"full","auto",...A()],U=()=>[Xi,"none","subgrid",ge,pe],B=()=>["auto",{span:["full",Xi,ge,pe]},Xi,ge,pe],$=()=>[Xi,"auto",ge,pe],ae=()=>["auto","min","max","fr",ge,pe],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],M=()=>["auto",...A()],K=()=>[Ca,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],q=()=>[n,ge,pe],he=()=>[...T(),vb,gb,{position:[ge,pe]}],Se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],I=()=>["auto","cover","contain",JN,QN,{size:[ge,pe]}],L=()=>[jh,Uo,Ds],ee=()=>["","none","full",p,ge,pe],V=()=>["",Le,Uo,Ds],Y=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[Le,jh,vb,gb],ce=()=>["","none",E,ge,pe],de=()=>["none",Le,ge,pe],De=()=>["none",Le,ge,pe],Ge=()=>[Le,ge,pe],Ne=()=>[Ca,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[bi],breakpoint:[bi],color:[$N],container:[bi],"drop-shadow":[bi],ease:["in","out","in-out"],font:[XN],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[bi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[bi],shadow:[bi],spacing:["px",Le],text:[bi],"text-shadow":[bi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ca,pe,ge,S]}],container:["container"],columns:[{columns:[Le,pe,ge,h]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{start:G()}],end:[{end:G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[Xi,"auto",ge,pe]}],basis:[{basis:[Ca,"full","auto",h,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Le,Ca,"auto","initial","none",pe]}],grow:[{grow:["",Le,ge,pe]}],shrink:[{shrink:["",Le,ge,pe]}],order:[{order:[Xi,"first","last","none",ge,pe]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[h,"screen",...K()]}],"min-w":[{"min-w":[h,"screen","none",...K()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[d]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",i,Uo,Ds]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,ge,Th]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jh,pe]}],"font-family":[{font:[KN,pe,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,ge,pe]}],"line-clamp":[{"line-clamp":[Le,"none",ge,Th]}],leading:[{leading:[c,...A()]}],"list-image":[{"list-image":["none",ge,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ge,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[Le,"from-font","auto",ge,Ds]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[Le,"auto",ge,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ge,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ge,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:he()}],"bg-repeat":[{bg:Se()}],"bg-size":[{bg:I()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xi,ge,pe],radial:["",ge,pe],conic:[Xi,ge,pe]},ej,ZN]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:ee()}],"rounded-s":[{"rounded-s":ee()}],"rounded-e":[{"rounded-e":ee()}],"rounded-t":[{"rounded-t":ee()}],"rounded-r":[{"rounded-r":ee()}],"rounded-b":[{"rounded-b":ee()}],"rounded-l":[{"rounded-l":ee()}],"rounded-ss":[{"rounded-ss":ee()}],"rounded-se":[{"rounded-se":ee()}],"rounded-ee":[{"rounded-ee":ee()}],"rounded-es":[{"rounded-es":ee()}],"rounded-tl":[{"rounded-tl":ee()}],"rounded-tr":[{"rounded-tr":ee()}],"rounded-br":[{"rounded-br":ee()}],"rounded-bl":[{"rounded-bl":ee()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Le,ge,pe]}],"outline-w":[{outline:["",Le,Uo,Ds]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",y,Ol,Rl]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",b,Ol,Rl]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[Le,Ds]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",x,Ol,Rl]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[Le,ge,pe]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Le]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[ge,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Le]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:he()}],"mask-repeat":[{mask:Se()}],"mask-size":[{mask:I()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ge,pe]}],filter:[{filter:["","none",ge,pe]}],blur:[{blur:ce()}],brightness:[{brightness:[Le,ge,pe]}],contrast:[{contrast:[Le,ge,pe]}],"drop-shadow":[{"drop-shadow":["","none",w,Ol,Rl]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",Le,ge,pe]}],"hue-rotate":[{"hue-rotate":[Le,ge,pe]}],invert:[{invert:["",Le,ge,pe]}],saturate:[{saturate:[Le,ge,pe]}],sepia:[{sepia:["",Le,ge,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",ge,pe]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[Le,ge,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Le,ge,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Le,ge,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Le,ge,pe]}],"backdrop-invert":[{"backdrop-invert":["",Le,ge,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Le,ge,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Le,ge,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Le,ge,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ge,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Le,"initial",ge,pe]}],ease:[{ease:["linear","initial",D,ge,pe]}],delay:[{delay:[Le,ge,pe]}],animate:[{animate:["none",N,ge,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,ge,pe]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:De()}],"scale-x":[{"scale-x":De()}],"scale-y":[{"scale-y":De()}],"scale-z":[{"scale-z":De()}],"scale-3d":["scale-3d"],skew:[{skew:Ge()}],"skew-x":[{"skew-x":Ge()}],"skew-y":[{"skew-y":Ge()}],transform:[{transform:[ge,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ne()}],"translate-x":[{"translate-x":Ne()}],"translate-y":[{"translate-y":Ne()}],"translate-z":[{"translate-z":Ne()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ge,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ge,pe]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[Le,Uo,Ds,Th]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},sj=LN(ij);function ye(...n){return sj(cw(n))}const Dc=Bf("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Ce=m.forwardRef(({className:n,variant:e,size:i,asChild:a=!1,...r},c)=>{const d=a?dN:"button";return l.jsx(d,{className:ye(Dc({variant:e,size:i,className:n})),ref:c,...r})});Ce.displayName="Button";function we(n,e,{checkForDefaultPrevented:i=!0}={}){return function(r){if(n?.(r),i===!1||!r.defaultPrevented)return e?.(r)}}function aj(n,e){const i=m.createContext(e),a=c=>{const{children:d,...h}=c,f=m.useMemo(()=>h,Object.values(h));return l.jsx(i.Provider,{value:f,children:d})};a.displayName=n+"Provider";function r(c){const d=m.useContext(i);if(d)return d;if(e!==void 0)return e;throw new Error(`\`${c}\` must be used within \`${n}\``)}return[a,r]}function cn(n,e=[]){let i=[];function a(c,d){const h=m.createContext(d),f=i.length;i=[...i,d];const p=b=>{const{scope:x,children:w,...E}=b,C=x?.[n]?.[f]||h,S=m.useMemo(()=>E,Object.values(E));return l.jsx(C.Provider,{value:S,children:w})};p.displayName=c+"Provider";function y(b,x){const w=x?.[n]?.[f]||h,E=m.useContext(w);if(E)return E;if(d!==void 0)return d;throw new Error(`\`${b}\` must be used within \`${c}\``)}return[p,y]}const r=()=>{const c=i.map(d=>m.createContext(d));return function(h){const f=h?.[n]||c;return m.useMemo(()=>({[`__scope${n}`]:{...h,[n]:f}}),[h,f])}};return r.scopeName=n,[a,oj(r,...e)]}function oj(...n){const e=n[0];if(n.length===1)return e;const i=()=>{const a=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(c){const d=a.reduce((h,{useScope:f,scopeName:p})=>{const b=f(c)[`__scope${p}`];return{...h,...b}},{});return m.useMemo(()=>({[`__scope${e.scopeName}`]:d}),[d])}};return i.scopeName=e.scopeName,i}var sr=aw();const Sw=sw(sr);function Pa(n){const e=rj(n),i=m.forwardRef((a,r)=>{const{children:c,...d}=a,h=m.Children.toArray(c),f=h.find(lj);if(f){const p=f.props.children,y=h.map(b=>b===f?m.Children.count(p)>1?m.Children.only(null):m.isValidElement(p)?p.props.children:null:b);return l.jsx(e,{...d,ref:r,children:m.isValidElement(p)?m.cloneElement(p,void 0,y):null})}return l.jsx(e,{...d,ref:r,children:c})});return i.displayName=`${n}.Slot`,i}function rj(n){const e=m.forwardRef((i,a)=>{const{children:r,...c}=i;if(m.isValidElement(r)){const d=uj(r),h=cj(c,r.props);return r.type!==m.Fragment&&(h.ref=a?es(a,d):d),m.cloneElement(r,h)}return m.Children.count(r)>1?m.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var Cw=Symbol("radix.slottable");function _w(n){const e=({children:i})=>l.jsx(l.Fragment,{children:i});return e.displayName=`${n}.Slottable`,e.__radixId=Cw,e}function lj(n){return m.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Cw}function cj(n,e){const i={...e};for(const a in e){const r=n[a],c=e[a];/^on[A-Z]/.test(a)?r&&c?i[a]=(...h)=>{const f=c(...h);return r(...h),f}:r&&(i[a]=r):a==="style"?i[a]={...r,...c}:a==="className"&&(i[a]=[r,c].filter(Boolean).join(" "))}return{...n,...i}}function uj(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning;return i?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}var dj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],je=dj.reduce((n,e)=>{const i=Pa(`Primitive.${e}`),a=m.forwardRef((r,c)=>{const{asChild:d,...h}=r,f=d?i:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(f,{...h,ref:c})});return a.displayName=`Primitive.${e}`,{...n,[e]:a}},{});function hj(n,e){n&&sr.flushSync(()=>n.dispatchEvent(e))}function Gt(n){const e=m.useRef(n);return m.useEffect(()=>{e.current=n}),m.useMemo(()=>(...i)=>e.current?.(...i),[])}function fj(n,e=globalThis?.document){const i=Gt(n);m.useEffect(()=>{const a=r=>{r.key==="Escape"&&i(r)};return e.addEventListener("keydown",a,{capture:!0}),()=>e.removeEventListener("keydown",a,{capture:!0})},[i,e])}var mj="DismissableLayer",sf="dismissableLayer.update",pj="dismissableLayer.pointerDownOutside",gj="dismissableLayer.focusOutside",yb,Ew=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ar=m.forwardRef((n,e)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:c,onInteractOutside:d,onDismiss:h,...f}=n,p=m.useContext(Ew),[y,b]=m.useState(null),x=y?.ownerDocument??globalThis?.document,[,w]=m.useState({}),E=Ie(e,O=>b(O)),C=Array.from(p.layers),[S]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),D=C.indexOf(S),N=y?C.indexOf(y):-1,k=p.layersWithOutsidePointerEventsDisabled.size>0,T=N>=D,R=bj(O=>{const A=O.target,G=[...p.branches].some(U=>U.contains(A));!T||G||(r?.(O),d?.(O),O.defaultPrevented||h?.())},x),z=xj(O=>{const A=O.target;[...p.branches].some(U=>U.contains(A))||(c?.(O),d?.(O),O.defaultPrevented||h?.())},x);return fj(O=>{N===p.layers.size-1&&(a?.(O),!O.defaultPrevented&&h&&(O.preventDefault(),h()))},x),m.useEffect(()=>{if(y)return i&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(yb=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(y)),p.layers.add(y),bb(),()=>{i&&p.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=yb)}},[y,x,i,p]),m.useEffect(()=>()=>{y&&(p.layers.delete(y),p.layersWithOutsidePointerEventsDisabled.delete(y),bb())},[y,p]),m.useEffect(()=>{const O=()=>w({});return document.addEventListener(sf,O),()=>document.removeEventListener(sf,O)},[]),l.jsx(je.div,{...f,ref:E,style:{pointerEvents:k?T?"auto":"none":void 0,...n.style},onFocusCapture:we(n.onFocusCapture,z.onFocusCapture),onBlurCapture:we(n.onBlurCapture,z.onBlurCapture),onPointerDownCapture:we(n.onPointerDownCapture,R.onPointerDownCapture)})});ar.displayName=mj;var vj="DismissableLayerBranch",yj=m.forwardRef((n,e)=>{const i=m.useContext(Ew),a=m.useRef(null),r=Ie(e,a);return m.useEffect(()=>{const c=a.current;if(c)return i.branches.add(c),()=>{i.branches.delete(c)}},[i.branches]),l.jsx(je.div,{...n,ref:r})});yj.displayName=vj;function bj(n,e=globalThis?.document){const i=Gt(n),a=m.useRef(!1),r=m.useRef(()=>{});return m.useEffect(()=>{const c=h=>{if(h.target&&!a.current){let f=function(){Dw(pj,i,p,{discrete:!0})};const p={originalEvent:h};h.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=f,e.addEventListener("click",r.current,{once:!0})):f()}else e.removeEventListener("click",r.current);a.current=!1},d=window.setTimeout(()=>{e.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(d),e.removeEventListener("pointerdown",c),e.removeEventListener("click",r.current)}},[e,i]),{onPointerDownCapture:()=>a.current=!0}}function xj(n,e=globalThis?.document){const i=Gt(n),a=m.useRef(!1);return m.useEffect(()=>{const r=c=>{c.target&&!a.current&&Dw(gj,i,{originalEvent:c},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,i]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function bb(){const n=new CustomEvent(sf);document.dispatchEvent(n)}function Dw(n,e,i,{discrete:a}){const r=i.originalEvent.target,c=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:i});e&&r.addEventListener(n,e,{once:!0}),a?hj(r,c):r.dispatchEvent(c)}var Dt=globalThis?.document?m.useLayoutEffect:()=>{},wj=Gf[" useId ".trim().toString()]||(()=>{}),Sj=0;function Mt(n){const[e,i]=m.useState(wj());return Dt(()=>{i(a=>a??String(Sj++))},[n]),e?`radix-${e}`:""}const Cj=["top","right","bottom","left"],ts=Math.min,rn=Math.max,lc=Math.round,zl=Math.floor,Xn=n=>({x:n,y:n}),_j={left:"right",right:"left",bottom:"top",top:"bottom"},Ej={start:"end",end:"start"};function af(n,e,i){return rn(n,ts(e,i))}function wi(n,e){return typeof n=="function"?n(e):n}function Si(n){return n.split("-")[0]}function Ua(n){return n.split("-")[1]}function Vf(n){return n==="x"?"y":"x"}function Ff(n){return n==="y"?"height":"width"}const Dj=new Set(["top","bottom"]);function Yn(n){return Dj.has(Si(n))?"y":"x"}function Uf(n){return Vf(Yn(n))}function Aj(n,e,i){i===void 0&&(i=!1);const a=Ua(n),r=Uf(n),c=Ff(r);let d=r==="x"?a===(i?"end":"start")?"right":"left":a==="start"?"bottom":"top";return e.reference[c]>e.floating[c]&&(d=cc(d)),[d,cc(d)]}function Nj(n){const e=cc(n);return[of(n),e,of(e)]}function of(n){return n.replace(/start|end/g,e=>Ej[e])}const xb=["left","right"],wb=["right","left"],jj=["top","bottom"],Tj=["bottom","top"];function kj(n,e,i){switch(n){case"top":case"bottom":return i?e?wb:xb:e?xb:wb;case"left":case"right":return e?jj:Tj;default:return[]}}function Rj(n,e,i,a){const r=Ua(n);let c=kj(Si(n),i==="start",a);return r&&(c=c.map(d=>d+"-"+r),e&&(c=c.concat(c.map(of)))),c}function cc(n){return n.replace(/left|right|bottom|top/g,e=>_j[e])}function Oj(n){return{top:0,right:0,bottom:0,left:0,...n}}function Aw(n){return typeof n!="number"?Oj(n):{top:n,right:n,bottom:n,left:n}}function uc(n){const{x:e,y:i,width:a,height:r}=n;return{width:a,height:r,top:i,left:e,right:e+a,bottom:i+r,x:e,y:i}}function Sb(n,e,i){let{reference:a,floating:r}=n;const c=Yn(e),d=Uf(e),h=Ff(d),f=Si(e),p=c==="y",y=a.x+a.width/2-r.width/2,b=a.y+a.height/2-r.height/2,x=a[h]/2-r[h]/2;let w;switch(f){case"top":w={x:y,y:a.y-r.height};break;case"bottom":w={x:y,y:a.y+a.height};break;case"right":w={x:a.x+a.width,y:b};break;case"left":w={x:a.x-r.width,y:b};break;default:w={x:a.x,y:a.y}}switch(Ua(e)){case"start":w[d]-=x*(i&&p?-1:1);break;case"end":w[d]+=x*(i&&p?-1:1);break}return w}async function zj(n,e){var i;e===void 0&&(e={});const{x:a,y:r,platform:c,rects:d,elements:h,strategy:f}=n,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:b="floating",altBoundary:x=!1,padding:w=0}=wi(e,n),E=Aw(w),S=h[x?b==="floating"?"reference":"floating":b],D=uc(await c.getClippingRect({element:(i=await(c.isElement==null?void 0:c.isElement(S)))==null||i?S:S.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(h.floating)),boundary:p,rootBoundary:y,strategy:f})),N=b==="floating"?{x:a,y:r,width:d.floating.width,height:d.floating.height}:d.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h.floating)),T=await(c.isElement==null?void 0:c.isElement(k))?await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1}:{x:1,y:1},R=uc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:N,offsetParent:k,strategy:f}):N);return{top:(D.top-R.top+E.top)/T.y,bottom:(R.bottom-D.bottom+E.bottom)/T.y,left:(D.left-R.left+E.left)/T.x,right:(R.right-D.right+E.right)/T.x}}const Mj=async(n,e,i)=>{const{placement:a="bottom",strategy:r="absolute",middleware:c=[],platform:d}=i,h=c.filter(Boolean),f=await(d.isRTL==null?void 0:d.isRTL(e));let p=await d.getElementRects({reference:n,floating:e,strategy:r}),{x:y,y:b}=Sb(p,a,f),x=a,w={},E=0;for(let S=0;S<h.length;S++){var C;const{name:D,fn:N}=h[S],{x:k,y:T,data:R,reset:z}=await N({x:y,y:b,initialPlacement:a,placement:x,strategy:r,middlewareData:w,rects:p,platform:{...d,detectOverflow:(C=d.detectOverflow)!=null?C:zj},elements:{reference:n,floating:e}});y=k??y,b=T??b,w={...w,[D]:{...w[D],...R}},z&&E<=50&&(E++,typeof z=="object"&&(z.placement&&(x=z.placement),z.rects&&(p=z.rects===!0?await d.getElementRects({reference:n,floating:e,strategy:r}):z.rects),{x:y,y:b}=Sb(p,x,f)),S=-1)}return{x:y,y:b,placement:x,strategy:r,middlewareData:w}},Pj=n=>({name:"arrow",options:n,async fn(e){const{x:i,y:a,placement:r,rects:c,platform:d,elements:h,middlewareData:f}=e,{element:p,padding:y=0}=wi(n,e)||{};if(p==null)return{};const b=Aw(y),x={x:i,y:a},w=Uf(r),E=Ff(w),C=await d.getDimensions(p),S=w==="y",D=S?"top":"left",N=S?"bottom":"right",k=S?"clientHeight":"clientWidth",T=c.reference[E]+c.reference[w]-x[w]-c.floating[E],R=x[w]-c.reference[w],z=await(d.getOffsetParent==null?void 0:d.getOffsetParent(p));let O=z?z[k]:0;(!O||!await(d.isElement==null?void 0:d.isElement(z)))&&(O=h.floating[k]||c.floating[E]);const A=T/2-R/2,G=O/2-C[E]/2-1,U=ts(b[D],G),B=ts(b[N],G),$=U,ae=O-C[E]-B,ne=O/2-C[E]/2+A,W=af($,ne,ae),M=!f.arrow&&Ua(r)!=null&&ne!==W&&c.reference[E]/2-(ne<$?U:B)-C[E]/2<0,K=M?ne<$?ne-$:ne-ae:0;return{[w]:x[w]+K,data:{[w]:W,centerOffset:ne-W-K,...M&&{alignmentOffset:K}},reset:M}}}),Lj=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var i,a;const{placement:r,middlewareData:c,rects:d,initialPlacement:h,platform:f,elements:p}=e,{mainAxis:y=!0,crossAxis:b=!0,fallbackPlacements:x,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:C=!0,...S}=wi(n,e);if((i=c.arrow)!=null&&i.alignmentOffset)return{};const D=Si(r),N=Yn(h),k=Si(h)===h,T=await(f.isRTL==null?void 0:f.isRTL(p.floating)),R=x||(k||!C?[cc(h)]:Nj(h)),z=E!=="none";!x&&z&&R.push(...Rj(h,C,E,T));const O=[h,...R],A=await f.detectOverflow(e,S),G=[];let U=((a=c.flip)==null?void 0:a.overflows)||[];if(y&&G.push(A[D]),b){const ne=Aj(r,d,T);G.push(A[ne[0]],A[ne[1]])}if(U=[...U,{placement:r,overflows:G}],!G.every(ne=>ne<=0)){var B,$;const ne=(((B=c.flip)==null?void 0:B.index)||0)+1,W=O[ne];if(W&&(!(b==="alignment"?N!==Yn(W):!1)||U.every(q=>Yn(q.placement)===N?q.overflows[0]>0:!0)))return{data:{index:ne,overflows:U},reset:{placement:W}};let M=($=U.filter(K=>K.overflows[0]<=0).sort((K,q)=>K.overflows[1]-q.overflows[1])[0])==null?void 0:$.placement;if(!M)switch(w){case"bestFit":{var ae;const K=(ae=U.filter(q=>{if(z){const he=Yn(q.placement);return he===N||he==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(he=>he>0).reduce((he,Se)=>he+Se,0)]).sort((q,he)=>q[1]-he[1])[0])==null?void 0:ae[0];K&&(M=K);break}case"initialPlacement":M=h;break}if(r!==M)return{reset:{placement:M}}}return{}}}};function Cb(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function _b(n){return Cj.some(e=>n[e]>=0)}const Ij=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:i,platform:a}=e,{strategy:r="referenceHidden",...c}=wi(n,e);switch(r){case"referenceHidden":{const d=await a.detectOverflow(e,{...c,elementContext:"reference"}),h=Cb(d,i.reference);return{data:{referenceHiddenOffsets:h,referenceHidden:_b(h)}}}case"escaped":{const d=await a.detectOverflow(e,{...c,altBoundary:!0}),h=Cb(d,i.floating);return{data:{escapedOffsets:h,escaped:_b(h)}}}default:return{}}}}},Nw=new Set(["left","top"]);async function Gj(n,e){const{placement:i,platform:a,elements:r}=n,c=await(a.isRTL==null?void 0:a.isRTL(r.floating)),d=Si(i),h=Ua(i),f=Yn(i)==="y",p=Nw.has(d)?-1:1,y=c&&f?-1:1,b=wi(e,n);let{mainAxis:x,crossAxis:w,alignmentAxis:E}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return h&&typeof E=="number"&&(w=h==="end"?E*-1:E),f?{x:w*y,y:x*p}:{x:x*p,y:w*y}}const Bj=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var i,a;const{x:r,y:c,placement:d,middlewareData:h}=e,f=await Gj(e,n);return d===((i=h.offset)==null?void 0:i.placement)&&(a=h.arrow)!=null&&a.alignmentOffset?{}:{x:r+f.x,y:c+f.y,data:{...f,placement:d}}}}},Hj=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:i,y:a,placement:r,platform:c}=e,{mainAxis:d=!0,crossAxis:h=!1,limiter:f={fn:D=>{let{x:N,y:k}=D;return{x:N,y:k}}},...p}=wi(n,e),y={x:i,y:a},b=await c.detectOverflow(e,p),x=Yn(Si(r)),w=Vf(x);let E=y[w],C=y[x];if(d){const D=w==="y"?"top":"left",N=w==="y"?"bottom":"right",k=E+b[D],T=E-b[N];E=af(k,E,T)}if(h){const D=x==="y"?"top":"left",N=x==="y"?"bottom":"right",k=C+b[D],T=C-b[N];C=af(k,C,T)}const S=f.fn({...e,[w]:E,[x]:C});return{...S,data:{x:S.x-i,y:S.y-a,enabled:{[w]:d,[x]:h}}}}}},Vj=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:i,y:a,placement:r,rects:c,middlewareData:d}=e,{offset:h=0,mainAxis:f=!0,crossAxis:p=!0}=wi(n,e),y={x:i,y:a},b=Yn(r),x=Vf(b);let w=y[x],E=y[b];const C=wi(h,e),S=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:0,crossAxis:0,...C};if(f){const k=x==="y"?"height":"width",T=c.reference[x]-c.floating[k]+S.mainAxis,R=c.reference[x]+c.reference[k]-S.mainAxis;w<T?w=T:w>R&&(w=R)}if(p){var D,N;const k=x==="y"?"width":"height",T=Nw.has(Si(r)),R=c.reference[b]-c.floating[k]+(T&&((D=d.offset)==null?void 0:D[b])||0)+(T?0:S.crossAxis),z=c.reference[b]+c.reference[k]+(T?0:((N=d.offset)==null?void 0:N[b])||0)-(T?S.crossAxis:0);E<R?E=R:E>z&&(E=z)}return{[x]:w,[b]:E}}}},Fj=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var i,a;const{placement:r,rects:c,platform:d,elements:h}=e,{apply:f=()=>{},...p}=wi(n,e),y=await d.detectOverflow(e,p),b=Si(r),x=Ua(r),w=Yn(r)==="y",{width:E,height:C}=c.floating;let S,D;b==="top"||b==="bottom"?(S=b,D=x===(await(d.isRTL==null?void 0:d.isRTL(h.floating))?"start":"end")?"left":"right"):(D=b,S=x==="end"?"top":"bottom");const N=C-y.top-y.bottom,k=E-y.left-y.right,T=ts(C-y[S],N),R=ts(E-y[D],k),z=!e.middlewareData.shift;let O=T,A=R;if((i=e.middlewareData.shift)!=null&&i.enabled.x&&(A=k),(a=e.middlewareData.shift)!=null&&a.enabled.y&&(O=N),z&&!x){const U=rn(y.left,0),B=rn(y.right,0),$=rn(y.top,0),ae=rn(y.bottom,0);w?A=E-2*(U!==0||B!==0?U+B:rn(y.left,y.right)):O=C-2*($!==0||ae!==0?$+ae:rn(y.top,y.bottom))}await f({...e,availableWidth:A,availableHeight:O});const G=await d.getDimensions(h.floating);return E!==G.width||C!==G.height?{reset:{rects:!0}}:{}}}};function Ac(){return typeof window<"u"}function $a(n){return jw(n)?(n.nodeName||"").toLowerCase():"#document"}function ln(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Kn(n){var e;return(e=(jw(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function jw(n){return Ac()?n instanceof Node||n instanceof ln(n).Node:!1}function Mn(n){return Ac()?n instanceof Element||n instanceof ln(n).Element:!1}function Qn(n){return Ac()?n instanceof HTMLElement||n instanceof ln(n).HTMLElement:!1}function Eb(n){return!Ac()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof ln(n).ShadowRoot}const Uj=new Set(["inline","contents"]);function or(n){const{overflow:e,overflowX:i,overflowY:a,display:r}=Pn(n);return/auto|scroll|overlay|hidden|clip/.test(e+a+i)&&!Uj.has(r)}const $j=new Set(["table","td","th"]);function Wj(n){return $j.has($a(n))}const qj=[":popover-open",":modal"];function Nc(n){return qj.some(e=>{try{return n.matches(e)}catch{return!1}})}const Yj=["transform","translate","scale","rotate","perspective"],Xj=["transform","translate","scale","rotate","perspective","filter"],Qj=["paint","layout","strict","content"];function $f(n){const e=Wf(),i=Mn(n)?Pn(n):n;return Yj.some(a=>i[a]?i[a]!=="none":!1)||(i.containerType?i.containerType!=="normal":!1)||!e&&(i.backdropFilter?i.backdropFilter!=="none":!1)||!e&&(i.filter?i.filter!=="none":!1)||Xj.some(a=>(i.willChange||"").includes(a))||Qj.some(a=>(i.contain||"").includes(a))}function Zj(n){let e=ns(n);for(;Qn(e)&&!La(e);){if($f(e))return e;if(Nc(e))return null;e=ns(e)}return null}function Wf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Kj=new Set(["html","body","#document"]);function La(n){return Kj.has($a(n))}function Pn(n){return ln(n).getComputedStyle(n)}function jc(n){return Mn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function ns(n){if($a(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Eb(n)&&n.host||Kn(n);return Eb(e)?e.host:e}function Tw(n){const e=ns(n);return La(e)?n.ownerDocument?n.ownerDocument.body:n.body:Qn(e)&&or(e)?e:Tw(e)}function Qo(n,e,i){var a;e===void 0&&(e=[]),i===void 0&&(i=!0);const r=Tw(n),c=r===((a=n.ownerDocument)==null?void 0:a.body),d=ln(r);if(c){const h=rf(d);return e.concat(d,d.visualViewport||[],or(r)?r:[],h&&i?Qo(h):[])}return e.concat(r,Qo(r,[],i))}function rf(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function kw(n){const e=Pn(n);let i=parseFloat(e.width)||0,a=parseFloat(e.height)||0;const r=Qn(n),c=r?n.offsetWidth:i,d=r?n.offsetHeight:a,h=lc(i)!==c||lc(a)!==d;return h&&(i=c,a=d),{width:i,height:a,$:h}}function qf(n){return Mn(n)?n:n.contextElement}function Oa(n){const e=qf(n);if(!Qn(e))return Xn(1);const i=e.getBoundingClientRect(),{width:a,height:r,$:c}=kw(e);let d=(c?lc(i.width):i.width)/a,h=(c?lc(i.height):i.height)/r;return(!d||!Number.isFinite(d))&&(d=1),(!h||!Number.isFinite(h))&&(h=1),{x:d,y:h}}const Jj=Xn(0);function Rw(n){const e=ln(n);return!Wf()||!e.visualViewport?Jj:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function e1(n,e,i){return e===void 0&&(e=!1),!i||e&&i!==ln(n)?!1:e}function Os(n,e,i,a){e===void 0&&(e=!1),i===void 0&&(i=!1);const r=n.getBoundingClientRect(),c=qf(n);let d=Xn(1);e&&(a?Mn(a)&&(d=Oa(a)):d=Oa(n));const h=e1(c,i,a)?Rw(c):Xn(0);let f=(r.left+h.x)/d.x,p=(r.top+h.y)/d.y,y=r.width/d.x,b=r.height/d.y;if(c){const x=ln(c),w=a&&Mn(a)?ln(a):a;let E=x,C=rf(E);for(;C&&a&&w!==E;){const S=Oa(C),D=C.getBoundingClientRect(),N=Pn(C),k=D.left+(C.clientLeft+parseFloat(N.paddingLeft))*S.x,T=D.top+(C.clientTop+parseFloat(N.paddingTop))*S.y;f*=S.x,p*=S.y,y*=S.x,b*=S.y,f+=k,p+=T,E=ln(C),C=rf(E)}}return uc({width:y,height:b,x:f,y:p})}function Tc(n,e){const i=jc(n).scrollLeft;return e?e.left+i:Os(Kn(n)).left+i}function Ow(n,e){const i=n.getBoundingClientRect(),a=i.left+e.scrollLeft-Tc(n,i),r=i.top+e.scrollTop;return{x:a,y:r}}function t1(n){let{elements:e,rect:i,offsetParent:a,strategy:r}=n;const c=r==="fixed",d=Kn(a),h=e?Nc(e.floating):!1;if(a===d||h&&c)return i;let f={scrollLeft:0,scrollTop:0},p=Xn(1);const y=Xn(0),b=Qn(a);if((b||!b&&!c)&&(($a(a)!=="body"||or(d))&&(f=jc(a)),Qn(a))){const w=Os(a);p=Oa(a),y.x=w.x+a.clientLeft,y.y=w.y+a.clientTop}const x=d&&!b&&!c?Ow(d,f):Xn(0);return{width:i.width*p.x,height:i.height*p.y,x:i.x*p.x-f.scrollLeft*p.x+y.x+x.x,y:i.y*p.y-f.scrollTop*p.y+y.y+x.y}}function n1(n){return Array.from(n.getClientRects())}function i1(n){const e=Kn(n),i=jc(n),a=n.ownerDocument.body,r=rn(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),c=rn(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let d=-i.scrollLeft+Tc(n);const h=-i.scrollTop;return Pn(a).direction==="rtl"&&(d+=rn(e.clientWidth,a.clientWidth)-r),{width:r,height:c,x:d,y:h}}const Db=25;function s1(n,e){const i=ln(n),a=Kn(n),r=i.visualViewport;let c=a.clientWidth,d=a.clientHeight,h=0,f=0;if(r){c=r.width,d=r.height;const y=Wf();(!y||y&&e==="fixed")&&(h=r.offsetLeft,f=r.offsetTop)}const p=Tc(a);if(p<=0){const y=a.ownerDocument,b=y.body,x=getComputedStyle(b),w=y.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,E=Math.abs(a.clientWidth-b.clientWidth-w);E<=Db&&(c-=E)}else p<=Db&&(c+=p);return{width:c,height:d,x:h,y:f}}const a1=new Set(["absolute","fixed"]);function o1(n,e){const i=Os(n,!0,e==="fixed"),a=i.top+n.clientTop,r=i.left+n.clientLeft,c=Qn(n)?Oa(n):Xn(1),d=n.clientWidth*c.x,h=n.clientHeight*c.y,f=r*c.x,p=a*c.y;return{width:d,height:h,x:f,y:p}}function Ab(n,e,i){let a;if(e==="viewport")a=s1(n,i);else if(e==="document")a=i1(Kn(n));else if(Mn(e))a=o1(e,i);else{const r=Rw(n);a={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return uc(a)}function zw(n,e){const i=ns(n);return i===e||!Mn(i)||La(i)?!1:Pn(i).position==="fixed"||zw(i,e)}function r1(n,e){const i=e.get(n);if(i)return i;let a=Qo(n,[],!1).filter(h=>Mn(h)&&$a(h)!=="body"),r=null;const c=Pn(n).position==="fixed";let d=c?ns(n):n;for(;Mn(d)&&!La(d);){const h=Pn(d),f=$f(d);!f&&h.position==="fixed"&&(r=null),(c?!f&&!r:!f&&h.position==="static"&&!!r&&a1.has(r.position)||or(d)&&!f&&zw(n,d))?a=a.filter(y=>y!==d):r=h,d=ns(d)}return e.set(n,a),a}function l1(n){let{element:e,boundary:i,rootBoundary:a,strategy:r}=n;const d=[...i==="clippingAncestors"?Nc(e)?[]:r1(e,this._c):[].concat(i),a],h=d[0],f=d.reduce((p,y)=>{const b=Ab(e,y,r);return p.top=rn(b.top,p.top),p.right=ts(b.right,p.right),p.bottom=ts(b.bottom,p.bottom),p.left=rn(b.left,p.left),p},Ab(e,h,r));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function c1(n){const{width:e,height:i}=kw(n);return{width:e,height:i}}function u1(n,e,i){const a=Qn(e),r=Kn(e),c=i==="fixed",d=Os(n,!0,c,e);let h={scrollLeft:0,scrollTop:0};const f=Xn(0);function p(){f.x=Tc(r)}if(a||!a&&!c)if(($a(e)!=="body"||or(r))&&(h=jc(e)),a){const w=Os(e,!0,c,e);f.x=w.x+e.clientLeft,f.y=w.y+e.clientTop}else r&&p();c&&!a&&r&&p();const y=r&&!a&&!c?Ow(r,h):Xn(0),b=d.left+h.scrollLeft-f.x-y.x,x=d.top+h.scrollTop-f.y-y.y;return{x:b,y:x,width:d.width,height:d.height}}function kh(n){return Pn(n).position==="static"}function Nb(n,e){if(!Qn(n)||Pn(n).position==="fixed")return null;if(e)return e(n);let i=n.offsetParent;return Kn(n)===i&&(i=i.ownerDocument.body),i}function Mw(n,e){const i=ln(n);if(Nc(n))return i;if(!Qn(n)){let r=ns(n);for(;r&&!La(r);){if(Mn(r)&&!kh(r))return r;r=ns(r)}return i}let a=Nb(n,e);for(;a&&Wj(a)&&kh(a);)a=Nb(a,e);return a&&La(a)&&kh(a)&&!$f(a)?i:a||Zj(n)||i}const d1=async function(n){const e=this.getOffsetParent||Mw,i=this.getDimensions,a=await i(n.floating);return{reference:u1(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function h1(n){return Pn(n).direction==="rtl"}const f1={convertOffsetParentRelativeRectToViewportRelativeRect:t1,getDocumentElement:Kn,getClippingRect:l1,getOffsetParent:Mw,getElementRects:d1,getClientRects:n1,getDimensions:c1,getScale:Oa,isElement:Mn,isRTL:h1};function Pw(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function m1(n,e){let i=null,a;const r=Kn(n);function c(){var h;clearTimeout(a),(h=i)==null||h.disconnect(),i=null}function d(h,f){h===void 0&&(h=!1),f===void 0&&(f=1),c();const p=n.getBoundingClientRect(),{left:y,top:b,width:x,height:w}=p;if(h||e(),!x||!w)return;const E=zl(b),C=zl(r.clientWidth-(y+x)),S=zl(r.clientHeight-(b+w)),D=zl(y),k={rootMargin:-E+"px "+-C+"px "+-S+"px "+-D+"px",threshold:rn(0,ts(1,f))||1};let T=!0;function R(z){const O=z[0].intersectionRatio;if(O!==f){if(!T)return d();O?d(!1,O):a=setTimeout(()=>{d(!1,1e-7)},1e3)}O===1&&!Pw(p,n.getBoundingClientRect())&&d(),T=!1}try{i=new IntersectionObserver(R,{...k,root:r.ownerDocument})}catch{i=new IntersectionObserver(R,k)}i.observe(n)}return d(!0),c}function p1(n,e,i,a){a===void 0&&(a={});const{ancestorScroll:r=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:f=!1}=a,p=qf(n),y=r||c?[...p?Qo(p):[],...Qo(e)]:[];y.forEach(D=>{r&&D.addEventListener("scroll",i,{passive:!0}),c&&D.addEventListener("resize",i)});const b=p&&h?m1(p,i):null;let x=-1,w=null;d&&(w=new ResizeObserver(D=>{let[N]=D;N&&N.target===p&&w&&(w.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var k;(k=w)==null||k.observe(e)})),i()}),p&&!f&&w.observe(p),w.observe(e));let E,C=f?Os(n):null;f&&S();function S(){const D=Os(n);C&&!Pw(C,D)&&i(),C=D,E=requestAnimationFrame(S)}return i(),()=>{var D;y.forEach(N=>{r&&N.removeEventListener("scroll",i),c&&N.removeEventListener("resize",i)}),b?.(),(D=w)==null||D.disconnect(),w=null,f&&cancelAnimationFrame(E)}}const g1=Bj,v1=Hj,y1=Lj,b1=Fj,x1=Ij,jb=Pj,w1=Vj,S1=(n,e,i)=>{const a=new Map,r={platform:f1,...i},c={...r.platform,_c:a};return Mj(n,e,{...r,platform:c})};var C1=typeof document<"u",_1=function(){},Zl=C1?m.useLayoutEffect:_1;function dc(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let i,a,r;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(i=n.length,i!==e.length)return!1;for(a=i;a--!==0;)if(!dc(n[a],e[a]))return!1;return!0}if(r=Object.keys(n),i=r.length,i!==Object.keys(e).length)return!1;for(a=i;a--!==0;)if(!{}.hasOwnProperty.call(e,r[a]))return!1;for(a=i;a--!==0;){const c=r[a];if(!(c==="_owner"&&n.$$typeof)&&!dc(n[c],e[c]))return!1}return!0}return n!==n&&e!==e}function Lw(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function Tb(n,e){const i=Lw(n);return Math.round(e*i)/i}function Rh(n){const e=m.useRef(n);return Zl(()=>{e.current=n}),e}function E1(n){n===void 0&&(n={});const{placement:e="bottom",strategy:i="absolute",middleware:a=[],platform:r,elements:{reference:c,floating:d}={},transform:h=!0,whileElementsMounted:f,open:p}=n,[y,b]=m.useState({x:0,y:0,strategy:i,placement:e,middlewareData:{},isPositioned:!1}),[x,w]=m.useState(a);dc(x,a)||w(a);const[E,C]=m.useState(null),[S,D]=m.useState(null),N=m.useCallback(q=>{q!==z.current&&(z.current=q,C(q))},[]),k=m.useCallback(q=>{q!==O.current&&(O.current=q,D(q))},[]),T=c||E,R=d||S,z=m.useRef(null),O=m.useRef(null),A=m.useRef(y),G=f!=null,U=Rh(f),B=Rh(r),$=Rh(p),ae=m.useCallback(()=>{if(!z.current||!O.current)return;const q={placement:e,strategy:i,middleware:x};B.current&&(q.platform=B.current),S1(z.current,O.current,q).then(he=>{const Se={...he,isPositioned:$.current!==!1};ne.current&&!dc(A.current,Se)&&(A.current=Se,sr.flushSync(()=>{b(Se)}))})},[x,e,i,B,$]);Zl(()=>{p===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,b(q=>({...q,isPositioned:!1})))},[p]);const ne=m.useRef(!1);Zl(()=>(ne.current=!0,()=>{ne.current=!1}),[]),Zl(()=>{if(T&&(z.current=T),R&&(O.current=R),T&&R){if(U.current)return U.current(T,R,ae);ae()}},[T,R,ae,U,G]);const W=m.useMemo(()=>({reference:z,floating:O,setReference:N,setFloating:k}),[N,k]),M=m.useMemo(()=>({reference:T,floating:R}),[T,R]),K=m.useMemo(()=>{const q={position:i,left:0,top:0};if(!M.floating)return q;const he=Tb(M.floating,y.x),Se=Tb(M.floating,y.y);return h?{...q,transform:"translate("+he+"px, "+Se+"px)",...Lw(M.floating)>=1.5&&{willChange:"transform"}}:{position:i,left:he,top:Se}},[i,h,M.floating,y.x,y.y]);return m.useMemo(()=>({...y,update:ae,refs:W,elements:M,floatingStyles:K}),[y,ae,W,M,K])}const D1=n=>{function e(i){return{}.hasOwnProperty.call(i,"current")}return{name:"arrow",options:n,fn(i){const{element:a,padding:r}=typeof n=="function"?n(i):n;return a&&e(a)?a.current!=null?jb({element:a.current,padding:r}).fn(i):{}:a?jb({element:a,padding:r}).fn(i):{}}}},A1=(n,e)=>({...g1(n),options:[n,e]}),N1=(n,e)=>({...v1(n),options:[n,e]}),j1=(n,e)=>({...w1(n),options:[n,e]}),T1=(n,e)=>({...y1(n),options:[n,e]}),k1=(n,e)=>({...b1(n),options:[n,e]}),R1=(n,e)=>({...x1(n),options:[n,e]}),O1=(n,e)=>({...D1(n),options:[n,e]});var z1="Arrow",Iw=m.forwardRef((n,e)=>{const{children:i,width:a=10,height:r=5,...c}=n;return l.jsx(je.svg,{...c,ref:e,width:a,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?i:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});Iw.displayName=z1;var M1=Iw;function Yf(n){const[e,i]=m.useState(void 0);return Dt(()=>{if(n){i({width:n.offsetWidth,height:n.offsetHeight});const a=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const c=r[0];let d,h;if("borderBoxSize"in c){const f=c.borderBoxSize,p=Array.isArray(f)?f[0]:f;d=p.inlineSize,h=p.blockSize}else d=n.offsetWidth,h=n.offsetHeight;i({width:d,height:h})});return a.observe(n,{box:"border-box"}),()=>a.unobserve(n)}else i(void 0)},[n]),e}var Xf="Popper",[Gw,Wa]=cn(Xf),[P1,Bw]=Gw(Xf),Hw=n=>{const{__scopePopper:e,children:i}=n,[a,r]=m.useState(null);return l.jsx(P1,{scope:e,anchor:a,onAnchorChange:r,children:i})};Hw.displayName=Xf;var Vw="PopperAnchor",Fw=m.forwardRef((n,e)=>{const{__scopePopper:i,virtualRef:a,...r}=n,c=Bw(Vw,i),d=m.useRef(null),h=Ie(e,d),f=m.useRef(null);return m.useEffect(()=>{const p=f.current;f.current=a?.current||d.current,p!==f.current&&c.onAnchorChange(f.current)}),a?null:l.jsx(je.div,{...r,ref:h})});Fw.displayName=Vw;var Qf="PopperContent",[L1,I1]=Gw(Qf),Uw=m.forwardRef((n,e)=>{const{__scopePopper:i,side:a="bottom",sideOffset:r=0,align:c="center",alignOffset:d=0,arrowPadding:h=0,avoidCollisions:f=!0,collisionBoundary:p=[],collisionPadding:y=0,sticky:b="partial",hideWhenDetached:x=!1,updatePositionStrategy:w="optimized",onPlaced:E,...C}=n,S=Bw(Qf,i),[D,N]=m.useState(null),k=Ie(e,X=>N(X)),[T,R]=m.useState(null),z=Yf(T),O=z?.width??0,A=z?.height??0,G=a+(c!=="center"?"-"+c:""),U=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},B=Array.isArray(p)?p:[p],$=B.length>0,ae={padding:U,boundary:B.filter(B1),altBoundary:$},{refs:ne,floatingStyles:W,placement:M,isPositioned:K,middlewareData:q}=E1({strategy:"fixed",placement:G,whileElementsMounted:(...X)=>p1(...X,{animationFrame:w==="always"}),elements:{reference:S.anchor},middleware:[A1({mainAxis:r+A,alignmentAxis:d}),f&&N1({mainAxis:!0,crossAxis:!1,limiter:b==="partial"?j1():void 0,...ae}),f&&T1({...ae}),k1({...ae,apply:({elements:X,rects:ce,availableWidth:de,availableHeight:De})=>{const{width:Ge,height:Ne}=ce.reference,dt=X.floating.style;dt.setProperty("--radix-popper-available-width",`${de}px`),dt.setProperty("--radix-popper-available-height",`${De}px`),dt.setProperty("--radix-popper-anchor-width",`${Ge}px`),dt.setProperty("--radix-popper-anchor-height",`${Ne}px`)}}),T&&O1({element:T,padding:h}),H1({arrowWidth:O,arrowHeight:A}),x&&R1({strategy:"referenceHidden",...ae})]}),[he,Se]=qw(M),I=Gt(E);Dt(()=>{K&&I?.()},[K,I]);const L=q.arrow?.x,ee=q.arrow?.y,V=q.arrow?.centerOffset!==0,[Y,le]=m.useState();return Dt(()=>{D&&le(window.getComputedStyle(D).zIndex)},[D]),l.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...W,transform:K?W.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:l.jsx(L1,{scope:i,placedSide:he,onArrowChange:R,arrowX:L,arrowY:ee,shouldHideArrow:V,children:l.jsx(je.div,{"data-side":he,"data-align":Se,...C,ref:k,style:{...C.style,animation:K?void 0:"none"}})})})});Uw.displayName=Qf;var $w="PopperArrow",G1={top:"bottom",right:"left",bottom:"top",left:"right"},Ww=m.forwardRef(function(e,i){const{__scopePopper:a,...r}=e,c=I1($w,a),d=G1[c.placedSide];return l.jsx("span",{ref:c.onArrowChange,style:{position:"absolute",left:c.arrowX,top:c.arrowY,[d]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[c.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[c.placedSide],visibility:c.shouldHideArrow?"hidden":void 0},children:l.jsx(M1,{...r,ref:i,style:{...r.style,display:"block"}})})});Ww.displayName=$w;function B1(n){return n!==null}var H1=n=>({name:"transformOrigin",options:n,fn(e){const{placement:i,rects:a,middlewareData:r}=e,d=r.arrow?.centerOffset!==0,h=d?0:n.arrowWidth,f=d?0:n.arrowHeight,[p,y]=qw(i),b={start:"0%",center:"50%",end:"100%"}[y],x=(r.arrow?.x??0)+h/2,w=(r.arrow?.y??0)+f/2;let E="",C="";return p==="bottom"?(E=d?b:`${x}px`,C=`${-f}px`):p==="top"?(E=d?b:`${x}px`,C=`${a.floating.height+f}px`):p==="right"?(E=`${-f}px`,C=d?b:`${w}px`):p==="left"&&(E=`${a.floating.width+f}px`,C=d?b:`${w}px`),{data:{x:E,y:C}}}});function qw(n){const[e,i="center"]=n.split("-");return[e,i]}var Zf=Hw,kc=Fw,Kf=Uw,Jf=Ww,V1="Portal",rr=m.forwardRef((n,e)=>{const{container:i,...a}=n,[r,c]=m.useState(!1);Dt(()=>c(!0),[]);const d=i||r&&globalThis?.document?.body;return d?Sw.createPortal(l.jsx(je.div,{...a,ref:e}),d):null});rr.displayName=V1;function F1(n,e){return m.useReducer((i,a)=>e[i][a]??i,n)}var qt=n=>{const{present:e,children:i}=n,a=U1(e),r=typeof i=="function"?i({present:a.isPresent}):m.Children.only(i),c=Ie(a.ref,$1(r));return typeof i=="function"||a.isPresent?m.cloneElement(r,{ref:c}):null};qt.displayName="Presence";function U1(n){const[e,i]=m.useState(),a=m.useRef(null),r=m.useRef(n),c=m.useRef("none"),d=n?"mounted":"unmounted",[h,f]=F1(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const p=Ml(a.current);c.current=h==="mounted"?p:"none"},[h]),Dt(()=>{const p=a.current,y=r.current;if(y!==n){const x=c.current,w=Ml(p);n?f("MOUNT"):w==="none"||p?.display==="none"?f("UNMOUNT"):f(y&&x!==w?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,f]),Dt(()=>{if(e){let p;const y=e.ownerDocument.defaultView??window,b=w=>{const C=Ml(a.current).includes(CSS.escape(w.animationName));if(w.target===e&&C&&(f("ANIMATION_END"),!r.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",p=y.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},x=w=>{w.target===e&&(c.current=Ml(a.current))};return e.addEventListener("animationstart",x),e.addEventListener("animationcancel",b),e.addEventListener("animationend",b),()=>{y.clearTimeout(p),e.removeEventListener("animationstart",x),e.removeEventListener("animationcancel",b),e.removeEventListener("animationend",b)}}else f("ANIMATION_END")},[e,f]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:m.useCallback(p=>{a.current=p?getComputedStyle(p):null,i(p)},[])}}function Ml(n){return n?.animationName||"none"}function $1(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning;return i?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,i=e&&"isReactWarning"in e&&e.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}var W1=Gf[" useInsertionEffect ".trim().toString()]||Dt;function En({prop:n,defaultProp:e,onChange:i=()=>{},caller:a}){const[r,c,d]=q1({defaultProp:e,onChange:i}),h=n!==void 0,f=h?n:r;{const y=m.useRef(n!==void 0);m.useEffect(()=>{const b=y.current;b!==h&&console.warn(`${a} is changing from ${b?"controlled":"uncontrolled"} to ${h?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=h},[h,a])}const p=m.useCallback(y=>{if(h){const b=Y1(y)?y(n):y;b!==n&&d.current?.(b)}else c(y)},[h,n,c,d]);return[f,p]}function q1({defaultProp:n,onChange:e}){const[i,a]=m.useState(n),r=m.useRef(i),c=m.useRef(e);return W1(()=>{c.current=e},[e]),m.useEffect(()=>{r.current!==i&&(c.current?.(i),r.current=i)},[i,r]),[i,a,c]}function Y1(n){return typeof n=="function"}var Yw=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),X1="VisuallyHidden",Xw=m.forwardRef((n,e)=>l.jsx(je.span,{...n,ref:e,style:{...Yw,...n.style}}));Xw.displayName=X1;var Q1=Xw,[Rc]=cn("Tooltip",[Wa]),Oc=Wa(),Qw="TooltipProvider",Z1=700,lf="tooltip.open",[K1,em]=Rc(Qw),Zw=n=>{const{__scopeTooltip:e,delayDuration:i=Z1,skipDelayDuration:a=300,disableHoverableContent:r=!1,children:c}=n,d=m.useRef(!0),h=m.useRef(!1),f=m.useRef(0);return m.useEffect(()=>{const p=f.current;return()=>window.clearTimeout(p)},[]),l.jsx(K1,{scope:e,isOpenDelayedRef:d,delayDuration:i,onOpen:m.useCallback(()=>{window.clearTimeout(f.current),d.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>d.current=!0,a)},[a]),isPointerInTransitRef:h,onPointerInTransitChange:m.useCallback(p=>{h.current=p},[]),disableHoverableContent:r,children:c})};Zw.displayName=Qw;var Zo="Tooltip",[J1,lr]=Rc(Zo),Kw=n=>{const{__scopeTooltip:e,children:i,open:a,defaultOpen:r,onOpenChange:c,disableHoverableContent:d,delayDuration:h}=n,f=em(Zo,n.__scopeTooltip),p=Oc(e),[y,b]=m.useState(null),x=Mt(),w=m.useRef(0),E=d??f.disableHoverableContent,C=h??f.delayDuration,S=m.useRef(!1),[D,N]=En({prop:a,defaultProp:r??!1,onChange:O=>{O?(f.onOpen(),document.dispatchEvent(new CustomEvent(lf))):f.onClose(),c?.(O)},caller:Zo}),k=m.useMemo(()=>D?S.current?"delayed-open":"instant-open":"closed",[D]),T=m.useCallback(()=>{window.clearTimeout(w.current),w.current=0,S.current=!1,N(!0)},[N]),R=m.useCallback(()=>{window.clearTimeout(w.current),w.current=0,N(!1)},[N]),z=m.useCallback(()=>{window.clearTimeout(w.current),w.current=window.setTimeout(()=>{S.current=!0,N(!0),w.current=0},C)},[C,N]);return m.useEffect(()=>()=>{w.current&&(window.clearTimeout(w.current),w.current=0)},[]),l.jsx(Zf,{...p,children:l.jsx(J1,{scope:e,contentId:x,open:D,stateAttribute:k,trigger:y,onTriggerChange:b,onTriggerEnter:m.useCallback(()=>{f.isOpenDelayedRef.current?z():T()},[f.isOpenDelayedRef,z,T]),onTriggerLeave:m.useCallback(()=>{E?R():(window.clearTimeout(w.current),w.current=0)},[R,E]),onOpen:T,onClose:R,disableHoverableContent:E,children:i})})};Kw.displayName=Zo;var cf="TooltipTrigger",Jw=m.forwardRef((n,e)=>{const{__scopeTooltip:i,...a}=n,r=lr(cf,i),c=em(cf,i),d=Oc(i),h=m.useRef(null),f=Ie(e,h,r.onTriggerChange),p=m.useRef(!1),y=m.useRef(!1),b=m.useCallback(()=>p.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",b),[b]),l.jsx(kc,{asChild:!0,...d,children:l.jsx(je.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:f,onPointerMove:we(n.onPointerMove,x=>{x.pointerType!=="touch"&&!y.current&&!c.isPointerInTransitRef.current&&(r.onTriggerEnter(),y.current=!0)}),onPointerLeave:we(n.onPointerLeave,()=>{r.onTriggerLeave(),y.current=!1}),onPointerDown:we(n.onPointerDown,()=>{r.open&&r.onClose(),p.current=!0,document.addEventListener("pointerup",b,{once:!0})}),onFocus:we(n.onFocus,()=>{p.current||r.onOpen()}),onBlur:we(n.onBlur,r.onClose),onClick:we(n.onClick,r.onClose)})})});Jw.displayName=cf;var tm="TooltipPortal",[eT,tT]=Rc(tm,{forceMount:void 0}),eS=n=>{const{__scopeTooltip:e,forceMount:i,children:a,container:r}=n,c=lr(tm,e);return l.jsx(eT,{scope:e,forceMount:i,children:l.jsx(qt,{present:i||c.open,children:l.jsx(rr,{asChild:!0,container:r,children:a})})})};eS.displayName=tm;var Ia="TooltipContent",tS=m.forwardRef((n,e)=>{const i=tT(Ia,n.__scopeTooltip),{forceMount:a=i.forceMount,side:r="top",...c}=n,d=lr(Ia,n.__scopeTooltip);return l.jsx(qt,{present:a||d.open,children:d.disableHoverableContent?l.jsx(nS,{side:r,...c,ref:e}):l.jsx(nT,{side:r,...c,ref:e})})}),nT=m.forwardRef((n,e)=>{const i=lr(Ia,n.__scopeTooltip),a=em(Ia,n.__scopeTooltip),r=m.useRef(null),c=Ie(e,r),[d,h]=m.useState(null),{trigger:f,onClose:p}=i,y=r.current,{onPointerInTransitChange:b}=a,x=m.useCallback(()=>{h(null),b(!1)},[b]),w=m.useCallback((E,C)=>{const S=E.currentTarget,D={x:E.clientX,y:E.clientY},N=rT(D,S.getBoundingClientRect()),k=lT(D,N),T=cT(C.getBoundingClientRect()),R=dT([...k,...T]);h(R),b(!0)},[b]);return m.useEffect(()=>()=>x(),[x]),m.useEffect(()=>{if(f&&y){const E=S=>w(S,y),C=S=>w(S,f);return f.addEventListener("pointerleave",E),y.addEventListener("pointerleave",C),()=>{f.removeEventListener("pointerleave",E),y.removeEventListener("pointerleave",C)}}},[f,y,w,x]),m.useEffect(()=>{if(d){const E=C=>{const S=C.target,D={x:C.clientX,y:C.clientY},N=f?.contains(S)||y?.contains(S),k=!uT(D,d);N?x():k&&(x(),p())};return document.addEventListener("pointermove",E),()=>document.removeEventListener("pointermove",E)}},[f,y,d,p,x]),l.jsx(nS,{...n,ref:c})}),[iT,sT]=Rc(Zo,{isInside:!1}),aT=_w("TooltipContent"),nS=m.forwardRef((n,e)=>{const{__scopeTooltip:i,children:a,"aria-label":r,onEscapeKeyDown:c,onPointerDownOutside:d,...h}=n,f=lr(Ia,i),p=Oc(i),{onClose:y}=f;return m.useEffect(()=>(document.addEventListener(lf,y),()=>document.removeEventListener(lf,y)),[y]),m.useEffect(()=>{if(f.trigger){const b=x=>{x.target?.contains(f.trigger)&&y()};return window.addEventListener("scroll",b,{capture:!0}),()=>window.removeEventListener("scroll",b,{capture:!0})}},[f.trigger,y]),l.jsx(ar,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:b=>b.preventDefault(),onDismiss:y,children:l.jsxs(Kf,{"data-state":f.stateAttribute,...p,...h,ref:e,style:{...h.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(aT,{children:a}),l.jsx(iT,{scope:i,isInside:!0,children:l.jsx(Q1,{id:f.contentId,role:"tooltip",children:r||a})})]})})});tS.displayName=Ia;var iS="TooltipArrow",oT=m.forwardRef((n,e)=>{const{__scopeTooltip:i,...a}=n,r=Oc(i);return sT(iS,i).isInside?null:l.jsx(Jf,{...r,...a,ref:e})});oT.displayName=iS;function rT(n,e){const i=Math.abs(e.top-n.y),a=Math.abs(e.bottom-n.y),r=Math.abs(e.right-n.x),c=Math.abs(e.left-n.x);switch(Math.min(i,a,r,c)){case c:return"left";case r:return"right";case i:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function lT(n,e,i=5){const a=[];switch(e){case"top":a.push({x:n.x-i,y:n.y+i},{x:n.x+i,y:n.y+i});break;case"bottom":a.push({x:n.x-i,y:n.y-i},{x:n.x+i,y:n.y-i});break;case"left":a.push({x:n.x+i,y:n.y-i},{x:n.x+i,y:n.y+i});break;case"right":a.push({x:n.x-i,y:n.y-i},{x:n.x-i,y:n.y+i});break}return a}function cT(n){const{top:e,right:i,bottom:a,left:r}=n;return[{x:r,y:e},{x:i,y:e},{x:i,y:a},{x:r,y:a}]}function uT(n,e){const{x:i,y:a}=n;let r=!1;for(let c=0,d=e.length-1;c<e.length;d=c++){const h=e[c],f=e[d],p=h.x,y=h.y,b=f.x,x=f.y;y>a!=x>a&&i<(b-p)*(a-y)/(x-y)+p&&(r=!r)}return r}function dT(n){const e=n.slice();return e.sort((i,a)=>i.x<a.x?-1:i.x>a.x?1:i.y<a.y?-1:i.y>a.y?1:0),hT(e)}function hT(n){if(n.length<=1)return n.slice();const e=[];for(let a=0;a<n.length;a++){const r=n[a];for(;e.length>=2;){const c=e[e.length-1],d=e[e.length-2];if((c.x-d.x)*(r.y-d.y)>=(c.y-d.y)*(r.x-d.x))e.pop();else break}e.push(r)}e.pop();const i=[];for(let a=n.length-1;a>=0;a--){const r=n[a];for(;i.length>=2;){const c=i[i.length-1],d=i[i.length-2];if((c.x-d.x)*(r.y-d.y)>=(c.y-d.y)*(r.x-d.x))i.pop();else break}i.push(r)}return i.pop(),e.length===1&&i.length===1&&e[0].x===i[0].x&&e[0].y===i[0].y?e:e.concat(i)}var fT=Zw,mT=Kw,pT=Jw,gT=eS,sS=tS;const St=fT,Re=mT,Oe=pT,Te=m.forwardRef(({className:n,sideOffset:e=4,...i},a)=>l.jsx(gT,{children:l.jsx(sS,{ref:a,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",n),...i})}));Te.displayName=sS.displayName;class aS{}class Ki extends aS{constructor(e,i,a){super(),this.viewId=e,this.groupId=i,this.panelId=a}}class Xo extends aS{constructor(e,i){super(),this.viewId=e,this.paneId=i}}class Zn{constructor(){}static getInstance(){return Zn.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,i){i&&(this.data=e,this.proto=i)}}Zn.INSTANCE=new Zn;function zt(){const n=Zn.getInstance();if(n.hasData(Ki.prototype))return n.getData(Ki.prototype)[0]}function $o(){const n=Zn.getInstance();if(n.hasData(Xo.prototype))return n.getData(Xo.prototype)[0]}var Rs;(function(n){n.any=(...e)=>i=>{const a=e.map(r=>r(i));return{dispose:()=>{a.forEach(r=>{r.dispose()})}}}})(Rs||(Rs={}));class nm{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class oS{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class vT{constructor(){this.events=new Map}get size(){return this.events.size}add(e,i){this.events.set(e,i)}delete(e){this.events.delete(e)}clear(){this.events.clear()}}class hc{static create(){var e;return new hc((e=new Error().stack)!==null&&e!==void 0?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class yT{constructor(e,i){this.callback=e,this.stacktrace=i}}class ie{static setLeakageMonitorEnabled(e){e!==ie.ENABLE_TRACKING&&ie.MEMORY_LEAK_WATCHER.clear(),ie.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var i;!((i=this.options)===null||i===void 0)&&i.replay&&this._last!==void 0&&e(this._last);const a=new yT(e,ie.ENABLE_TRACKING?hc.create():void 0);return this._listeners.push(a),{dispose:()=>{const r=this._listeners.indexOf(a);r>-1&&this._listeners.splice(r,1)}}},ie.ENABLE_TRACKING&&ie.MEMORY_LEAK_WATCHER.add(this._event,hc.create())),this._event}fire(e){var i;!((i=this.options)===null||i===void 0)&&i.replay&&(this._last=e);for(const a of this._listeners)a.callback(e)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(ie.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(const i of this._listeners)console.warn("dockview: stacktrace",(e=i.stacktrace)===null||e===void 0?void 0:e.print())}),this._listeners=[]),ie.ENABLE_TRACKING&&this._event&&ie.MEMORY_LEAK_WATCHER.delete(this._event))}}ie.ENABLE_TRACKING=!1;ie.MEMORY_LEAK_WATCHER=new vT;function Pe(n,e,i,a){return n.addEventListener(e,i,a),{dispose:()=>{n.removeEventListener(e,i,a)}}}class kb{constructor(){this._onFired=new ie,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const i=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>i&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}var yt;(function(n){n.NONE={dispose:()=>{}};function e(i){return{dispose:()=>{i()}}}n.from=e})(yt||(yt={}));class Ae{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=e}addDisposables(...e){e.forEach(i=>this._disposables.push(i))}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables=[])}}class Pt{constructor(){this._disposable=yt.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=yt.NONE)}}class bT extends Ae{constructor(e){super(),this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,zc(e,i=>{const a=i.target.scrollWidth>i.target.clientWidth,r=i.target.scrollHeight>i.target.clientHeight;this._value={hasScrollX:a,hasScrollY:r},this._onDidChange.fire(this._value)}))}}function zc(n,e){const i=new ResizeObserver(a=>{requestAnimationFrame(()=>{const r=a[0];e(r)})});return i.observe(n),{dispose:()=>{i.unobserve(n),i.disconnect()}}}const Ko=(n,...e)=>{for(const i of e)n.classList.contains(i)&&n.classList.remove(i)},Mc=(n,...e)=>{for(const i of e)n.classList.contains(i)||n.classList.add(i)},Ee=(n,e,i)=>{const a=n.classList.contains(e);i&&!a&&n.classList.add(e),!i&&a&&n.classList.remove(e)};function uf(n,e){for(;n;){if(n===e)return!0;n=n.parentNode}return!1}function rS(n){return new xT(n)}class xT extends Ae{constructor(e){super(),this._onDidFocus=new ie,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new ie,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let i=uf(document.activeElement,e),a=!1;const r=()=>{a=!1,i||(i=!0,this._onDidFocus.fire())},c=()=>{i&&(a=!0,window.setTimeout(()=>{a&&(a=!1,i=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{uf(document.activeElement,e)!==i&&(i?c():r())},this.addDisposables(Pe(e,"focus",r,!0)),this.addDisposables(Pe(e,"blur",c,!0))}refreshState(){this._refreshStateHandler()}}const lS="dv-quasiPreventDefault";function wT(n){n[lS]=!0}function Rb(n){return n[lS]}function ST(n,e){const i=Array.from(e);for(const a of i){if(a.href){const c=n.createElement("link");c.href=a.href,c.type=a.type,c.rel="stylesheet",n.head.appendChild(c)}let r=[];try{a.cssRules&&(r=Array.from(a.cssRules).map(c=>c.cssText))}catch{}for(const c of r){const d=n.createElement("style");d.appendChild(n.createTextNode(c)),n.head.appendChild(d)}}}function df(n){const{left:e,top:i,width:a,height:r}=n.getBoundingClientRect();return{left:e+window.scrollX,top:i+window.scrollY,width:a,height:r}}function CT(n){let e=n;for(;e?.parentNode;){if(e.parentNode===document)return!0;e.parentNode instanceof DocumentFragment?e=e.parentNode.host:e=e.parentNode}return!1}function _T(n,e){n.setAttribute("data-testid",e)}function ET(n){const e=[];function i(a){if(a.nodeType===Node.ELEMENT_NODE){n.includes(a.tagName)&&e.push(a),a.shadowRoot&&i(a.shadowRoot);for(const r of a.children)i(r)}}return i(document.documentElement),e}function fc(n=document){const e=ET(["IFRAME","WEBVIEW"]),i=new WeakMap;for(const a of e)i.set(a,a.style.pointerEvents),a.style.pointerEvents="none";return{release:()=>{var a;for(const r of e)r.style.pointerEvents=(a=i.get(r))!==null&&a!==void 0?a:"auto";e.splice(0,e.length)}}}function DT(n){function e(r){const c=[];for(let d=0;d<r.classList.length;d++)c.push(r.classList.item(d));return c}let i,a=n;for(;a!==null&&(i=e(a).find(r=>r.startsWith("dockview-theme-")),typeof i!="string");)a=a.parentElement;return i}class Pc{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const i of this._classNames)Ee(this.element,i,!1);this._classNames=e.split(" ").filter(i=>i.trim().length>0);for(const i of this._classNames)Ee(this.element,i,!0)}}const cS=100;function AT(n,e){const i=df(n),a=df(e);return!(i.left<a.left||i.left+i.width>a.left+a.width)}function NT(n){const e=new ie;let i=n.screenX,a=n.screenY,r;const c=()=>{if(n.closed)return;const d=n.screenX,h=n.screenY;(d!==i||h!==a)&&(clearTimeout(r),r=setTimeout(()=>{e.fire()},cS),i=d,a=h),requestAnimationFrame(c)};return c(),e}function jT(n,e){let i;return new Ae(Pe(n,"resize",()=>{clearTimeout(i),i=setTimeout(()=>{e()},cS)}))}function TT(n,e,i={buffer:10}){const a=i.buffer,r=n.getBoundingClientRect(),c=e.getBoundingClientRect();let d=0,h=0;const f=r.left-c.left,p=r.top-c.top,y=r.bottom-c.bottom,b=r.right-c.right;f<a?d=a-f:b>a&&(d=-a-b),p<a?h=a-p:y>a&&(h=-y-a),(d!==0||h!==0)&&(n.style.transform=`translate(${d}px, ${h}px)`)}function kT(n){let e=n;for(;e&&(e.style.zIndex==="auto"||e.style.zIndex==="");)e=e.parentElement;return e}function xi(n){if(n.length===0)throw new Error("Invalid tail call");return[n.slice(0,n.length-1),n[n.length-1]]}function uS(n,e){if(n.length!==e.length)return!1;for(let i=0;i<n.length;i++)if(n[i]!==e[i])return!1;return!0}function Oh(n,e){const i=n.indexOf(e);i>-1&&(n.splice(i,1),n.unshift(e))}function Pl(n,e){const i=n.indexOf(e);i>-1&&(n.splice(i,1),n.push(e))}function RT(n,e){for(let i=0;i<n.length;i++){const a=n[i];if(e(a))return i}return-1}function zh(n,e){const i=n.findIndex(a=>a===e);return i>-1?(n.splice(i,1),!0):!1}const st=(n,e,i)=>e>i?e:Math.min(i,Math.max(n,e)),im=()=>{let n=1;return{next:()=>(n++).toString()}},kn=(n,e)=>{const i=[];if(typeof e!="number"&&(e=n,n=0),n<=e)for(let a=n;a<e;a++)i.push(a);else for(let a=n;a>e;a--)i.push(a);return i};class OT{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,i,a,r){this.container=e,this.view=i,this.disposable=r,this._cachedVisibleSize=void 0,typeof a=="number"?(this._size=a,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=a.cachedVisibleSize)}setVisible(e,i){var a;e!==this.visible&&(e?(this.size=st((a=this._cachedVisibleSize)!==null&&a!==void 0?a:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof i=="number"?i:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var be;(function(n){n.HORIZONTAL="HORIZONTAL",n.VERTICAL="VERTICAL"})(be||(be={}));var wn;(function(n){n[n.MAXIMUM=0]="MAXIMUM",n[n.MINIMUM=1]="MINIMUM",n[n.DISABLED=2]="DISABLED",n[n.ENABLED=3]="ENABLED"})(wn||(wn={}));var wt;(function(n){n.Low="low",n.High="high",n.Normal="normal"})(wt||(wt={}));var _n;(function(n){n.Distribute={type:"distribute"};function e(a){return{type:"split",index:a}}n.Split=e;function i(a){return{type:"invisible",cachedVisibleSize:a}}n.Invisible=i})(_n||(_n={}));class Jo{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const i=this.size;this.size=this.orthogonalSize,this.orthogonalSize=i,Ko(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==be.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,i)=>e+i.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,i)=>e+i.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,Ee(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,Ee(this.element,"dv-splitview-has-margin",e!==0)}constructor(e,i){var a,r;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new ie,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new ie,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new ie,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(c,d,h=this.viewItems.map(E=>E.size),f,p,y=Number.NEGATIVE_INFINITY,b=Number.POSITIVE_INFINITY,x,w)=>{if(c<0||c>this.viewItems.length)return 0;const E=kn(c,-1),C=kn(c+1,this.viewItems.length);if(p)for(const W of p)Oh(E,W),Oh(C,W);if(f)for(const W of f)Pl(E,W),Pl(C,W);const S=E.map(W=>this.viewItems[W]),D=E.map(W=>h[W]),N=C.map(W=>this.viewItems[W]),k=C.map(W=>h[W]),T=E.reduce((W,M)=>W+this.viewItems[M].minimumSize-h[M],0),R=E.reduce((W,M)=>W+this.viewItems[M].maximumSize-h[M],0),z=C.length===0?Number.POSITIVE_INFINITY:C.reduce((W,M)=>W+h[M]-this.viewItems[M].minimumSize,0),O=C.length===0?Number.NEGATIVE_INFINITY:C.reduce((W,M)=>W+h[M]-this.viewItems[M].maximumSize,0),A=Math.max(T,O),G=Math.min(z,R);let U=!1;if(x){const W=this.viewItems[x.index],M=d>=x.limitDelta;U=M!==W.visible,W.setVisible(M,x.size)}if(!U&&w){const W=this.viewItems[w.index],M=d<w.limitDelta;U=M!==W.visible,W.setVisible(M,w.size)}if(U)return this.resize(c,d,h,f,p,y,b);const B=st(d,A,G);let $=0,ae=B;for(let W=0;W<S.length;W++){const M=S[W],K=st(D[W]+ae,M.minimumSize,M.maximumSize),q=K-D[W];$+=q,ae-=q,M.size=K}let ne=$;for(let W=0;W<N.length;W++){const M=N[W],K=st(k[W]-ne,M.minimumSize,M.maximumSize),q=K-k[W];ne+=q,M.size=K}return d},this._orientation=(a=i.orientation)!==null&&a!==void 0?a:be.VERTICAL,this.element=this.createContainer(),this.margin=(r=i.margin)!==null&&r!==void 0?r:0,this.proportionalLayout=i.proportionalLayout===void 0?!0:!!i.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(i.styles),i.descriptor&&(this._size=i.descriptor.size,i.descriptor.views.forEach((c,d)=>{const h=c.visible===void 0||c.visible?c.size:{type:"invisible",cachedVisibleSize:c.size},f=c.view;this.addView(f,h,d,!0)}),this._contentSize=this.viewItems.reduce((c,d)=>c+d.size,0),this.saveProportions())}style(e){e?.separatorBorder==="transparent"?(Ko(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(Mc(this.element,"dv-separator-border"),e?.separatorBorder&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,i){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const a=this.viewItems[e];a.setVisible(i,a.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,i){if(e<0||e>=this.viewItems.length)return;const a=kn(this.viewItems.length).filter(h=>h!==e),r=[...a.filter(h=>this.viewItems[h].priority===wt.Low),e],c=a.filter(h=>this.viewItems[h].priority===wt.High),d=this.viewItems[e];i=Math.round(i),i=st(i,d.minimumSize,Math.min(d.maximumSize,this._size)),d.size=i,this.relayout(r,c)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,i){const a=this.viewItems.indexOf(e);if(a<0||a>=this.viewItems.length)return;i=typeof i=="number"?i:e.size,i=st(i,e.minimumSize,e.maximumSize),e.size=i;const r=kn(this.viewItems.length).filter(h=>h!==a),c=[...r.filter(h=>this.viewItems[h].priority===wt.Low),a],d=r.filter(h=>this.viewItems[h].priority===wt.High);this.relayout([...c,a],d)}addView(e,i={type:"distribute"},a=this.viewItems.length,r){const c=document.createElement("div");c.className="dv-view",c.appendChild(e.element);let d;typeof i=="number"?d=i:i.type==="split"?d=this.getViewSize(i.index)/2:i.type==="invisible"?d={cachedVisibleSize:i.cachedVisibleSize}:d=e.minimumSize;const h=e.onDidChange(p=>this.onDidChange(f,p.size)),f=new OT(c,e,d,{dispose:()=>{h.dispose(),this.viewContainer.removeChild(c)}});if(a===this.viewItems.length?this.viewContainer.appendChild(c):this.viewContainer.insertBefore(c,this.viewContainer.children.item(a)),this.viewItems.splice(a,0,f),this.viewItems.length>1){const p=document.createElement("div");p.className="dv-sash";const y=x=>{for(const W of this.viewItems)W.enabled=!1;const w=fc(),E=this._orientation===be.HORIZONTAL?x.clientX:x.clientY,C=RT(this.sashes,W=>W.container===p),S=this.viewItems.map(W=>W.size);let D,N;const k=kn(C,-1),T=kn(C+1,this.viewItems.length),R=k.reduce((W,M)=>W+(this.viewItems[M].minimumSize-S[M]),0),z=k.reduce((W,M)=>W+(this.viewItems[M].viewMaximumSize-S[M]),0),O=T.length===0?Number.POSITIVE_INFINITY:T.reduce((W,M)=>W+(S[M]-this.viewItems[M].minimumSize),0),A=T.length===0?Number.NEGATIVE_INFINITY:T.reduce((W,M)=>W+(S[M]-this.viewItems[M].viewMaximumSize),0),G=Math.max(R,A),U=Math.min(O,z),B=this.findFirstSnapIndex(k),$=this.findFirstSnapIndex(T);if(typeof B=="number"){const W=this.viewItems[B],M=Math.floor(W.viewMinimumSize/2);D={index:B,limitDelta:W.visible?G-M:G+M,size:W.size}}if(typeof $=="number"){const W=this.viewItems[$],M=Math.floor(W.viewMinimumSize/2);N={index:$,limitDelta:W.visible?U+M:U-M,size:W.size}}const ae=W=>{const K=(this._orientation===be.HORIZONTAL?W.clientX:W.clientY)-E;this.resize(C,K,S,void 0,void 0,G,U,D,N),this.distributeEmptySpace(),this.layoutViews()},ne=()=>{for(const W of this.viewItems)W.enabled=!0;w.release(),this.saveProportions(),document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",ne),document.removeEventListener("pointercancel",ne),document.removeEventListener("contextmenu",ne),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",ae),document.addEventListener("pointerup",ne),document.addEventListener("pointercancel",ne),document.addEventListener("contextmenu",ne)};p.addEventListener("pointerdown",y);const b={container:p,disposable:()=>{p.removeEventListener("pointerdown",y),this.sashContainer.removeChild(p)}};this.sashContainer.appendChild(p),this.sashes.push(b)}r||this.relayout([a]),!r&&typeof i!="number"&&i.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let i=0;for(const h of this.viewItems)h.maximumSize-h.minimumSize>0&&(e.push(h),i+=h.size);const a=Math.floor(i/e.length);for(const h of e)h.size=st(a,h.minimumSize,h.maximumSize);const r=kn(this.viewItems.length),c=r.filter(h=>this.viewItems[h].priority===wt.Low),d=r.filter(h=>this.viewItems[h].priority===wt.High);this.relayout(c,d)}removeView(e,i,a=!1){const r=this.viewItems.splice(e,1)[0];if(r.dispose(),this.viewItems.length>=1){const c=Math.max(e-1,0);this.sashes.splice(c,1)[0].disposable()}return a||this.relayout(),i&&i.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(r.view),r.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,i){const a=this.getViewCachedVisibleSize(e),r=typeof a>"u"?this.getViewSize(e):_n.Invisible(a),c=this.removeView(e,void 0,!0);this.addView(c,r,i)}layout(e,i){const a=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=i,this.proportions){let r=0;for(let c=0;c<this.viewItems.length;c++){const d=this.viewItems[c],h=this.proportions[c];typeof h=="number"?r+=h:e-=d.size}for(let c=0;c<this.viewItems.length;c++){const d=this.viewItems[c],h=this.proportions[c];typeof h=="number"&&r>0&&(d.size=st(Math.round(h*e/r),d.minimumSize,d.maximumSize))}}else{const r=kn(this.viewItems.length),c=r.filter(h=>this.viewItems[h].priority===wt.Low),d=r.filter(h=>this.viewItems[h].priority===wt.High);this.resize(this.viewItems.length-1,e-a,void 0,c,d)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,i){const a=this.viewItems.reduce((r,c)=>r+c.size,0);this.resize(this.viewItems.length-1,this._size-a,void 0,e,i),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const i=this.viewItems.reduce((h,f)=>h+f.size,0);let a=this.size-i;const r=kn(this.viewItems.length-1,-1),c=r.filter(h=>this.viewItems[h].priority===wt.Low),d=r.filter(h=>this.viewItems[h].priority===wt.High);for(const h of d)Oh(r,h);for(const h of c)Pl(r,h);typeof e=="number"&&Pl(r,e);for(let h=0;a!==0&&h<r.length;h++){const f=this.viewItems[r[h]],p=st(f.size+a,f.minimumSize,f.maximumSize),y=p-f.size;a-=y,f.size=p}}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((f,p)=>f+p.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;const e=this.viewItems.filter(f=>f.visible),i=Math.max(0,e.length-1),a=this.margin*i/Math.max(1,e.length);let r=0;const c=[],d=4,h=this.viewItems.reduce((f,p,y)=>{const b=p.visible?1:0;return y===0?f.push(b):f.push(f[y-1]+b),f},[]);this.viewItems.forEach((f,p)=>{r+=this.viewItems[p].size,c.push(r);const y=f.visible?f.size-a:0,b=Math.max(0,h[p]-1),x=p===0||b===0?0:c[p-1]+b/i*a;if(p<this.viewItems.length-1){const w=f.visible?x+y-d/2+this.margin/2:x;this._orientation===be.HORIZONTAL&&(this.sashes[p].container.style.left=`${w}px`,this.sashes[p].container.style.top="0px"),this._orientation===be.VERTICAL&&(this.sashes[p].container.style.left="0px",this.sashes[p].container.style.top=`${w}px`)}this._orientation===be.HORIZONTAL&&(f.container.style.width=`${y}px`,f.container.style.left=`${x}px`,f.container.style.top="",f.container.style.height=""),this._orientation===be.VERTICAL&&(f.container.style.height=`${y}px`,f.container.style.top=`${x}px`,f.container.style.width="",f.container.style.left=""),f.view.layout(f.size-a,this._orthogonalSize)})}findFirstSnapIndex(e){for(const i of e){const a=this.viewItems[i];if(a.visible&&a.snap)return i}for(const i of e){const a=this.viewItems[i];if(a.visible&&a.maximumSize-a.minimumSize>0)return;if(!a.visible&&a.snap)return i}}updateSashEnablement(){let e=!1;const i=this.viewItems.map(f=>e=f.size-f.minimumSize>0||e);e=!1;const a=this.viewItems.map(f=>e=f.maximumSize-f.size>0||e),r=[...this.viewItems].reverse();e=!1;const c=r.map(f=>e=f.size-f.minimumSize>0||e).reverse();e=!1;const d=r.map(f=>e=f.maximumSize-f.size>0||e).reverse();let h=0;for(let f=0;f<this.sashes.length;f++){const p=this.sashes[f],y=this.viewItems[f];h+=y.size;const b=!(i[f]&&d[f+1]),x=!(a[f]&&c[f+1]);if(b&&x){const w=kn(f,-1),E=kn(f+1,this.viewItems.length),C=this.findFirstSnapIndex(w),S=this.findFirstSnapIndex(E),D=typeof C=="number"&&!this.viewItems[C].visible,N=typeof S=="number"&&!this.viewItems[S].visible;D&&c[f]&&(h>0||this.startSnappingEnabled)?this.updateSash(p,wn.MINIMUM):N&&i[f]&&(h<this._contentSize||this.endSnappingEnabled)?this.updateSash(p,wn.MAXIMUM):this.updateSash(p,wn.DISABLED)}else b&&!x?this.updateSash(p,wn.MINIMUM):!b&&x?this.updateSash(p,wn.MAXIMUM):this.updateSash(p,wn.ENABLED)}}updateSash(e,i){Ee(e.container,"dv-disabled",i===wn.DISABLED),Ee(e.container,"dv-enabled",i===wn.ENABLED),Ee(e.container,"dv-maximum",i===wn.MAXIMUM),Ee(e.container,"dv-minimum",i===wn.MINIMUM)}createViewContainer(){const e=document.createElement("div");return e.className="dv-view-container",e}createSashContainer(){const e=document.createElement("div");return e.className="dv-sash-container",e}createContainer(){const e=document.createElement("div"),i=this._orientation===be.HORIZONTAL?"dv-horizontal":"dv-vertical";return e.className=`dv-split-view-container ${i}`,e}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.removeChild(this.element);break}for(const e of this.viewItems)e.dispose();this.element.remove()}}const hf=Object.keys({orientation:void 0,descriptor:void 0,proportionalLayout:void 0,styles:void 0,margin:void 0,disableAutoResizing:void 0,className:void 0});class Ob extends Ae{get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}constructor(e,i){var a;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._orientation=(a=i.orientation)!==null&&a!==void 0?a:be.VERTICAL,this.element=document.createElement("div"),this.element.className="dv-pane-container",e.appendChild(this.element),this.splitview=new Jo(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:i.descriptor}),this.getPanes().forEach(r=>{const c=new Ae(r.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),d={pane:r,disposable:{dispose:()=>{c.dispose()}}};this.paneItems.push(d),r.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,i){this.splitview.setViewVisible(e,i)}addPane(e,i,a=this.splitview.length,r=!1){const c=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),d={pane:e,disposable:{dispose:()=>{c.dispose()}}};this.paneItems.splice(a,0,d),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,i,a,r)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,i={skipDispose:!1}){const a=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),i.skipDispose||(a.disposable.dispose(),a.pane.dispose()),a}moveView(e,i){if(e===i)return;const a=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(a.pane,a.pane.size,i,!1)}finally{this.skipAnimation=!1}}layout(e,i){this.splitview.layout(e,i)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),Mc(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,Ko(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class Et{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===be.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===be.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===be.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===be.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===be.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===be.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,i,a,r=0){this.view=e,this.orientation=i,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._orthogonalSize=a,this._size=r,this._disposable=this.view.onDidChange(c=>{c?this._onDidChange.fire({size:this.orientation===be.VERTICAL?c.width:c.height,orthogonalSize:this.orientation===be.VERTICAL?c.height:c.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,i){this._size=e,this._orthogonalSize=i,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class ut extends Ae{get width(){return this.orientation===be.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===be.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,i)=>this.splitview.isViewVisible(i)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,i)=>this.splitview.isViewVisible(i)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===be.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===be.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===be.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===be.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return wt.Normal;const e=this.children.map(i=>typeof i.priority>"u"?wt.Normal:i.priority);return e.some(i=>i===wt.High)?wt.High:e.some(i=>i===wt.Low)?wt.Low:wt.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach(i=>{i instanceof ut&&(i.margin=e)})}constructor(e,i,a,r,c,d,h,f){if(super(),this.orientation=e,this.proportionalLayout=i,this.styles=a,this._childrenDisposable=yt.NONE,this.children=[],this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new ie,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=c,this._size=r,this.element=document.createElement("div"),this.element.className="dv-branch-node",!f)this.splitview=new Jo(this.element,{orientation:this.orientation,proportionalLayout:i,styles:a,margin:h}),this.splitview.layout(this.size,this.orthogonalSize);else{const p={views:f.map(y=>({view:y.node,size:y.node.size,visible:y.node instanceof Et&&y.visible!==void 0?y.visible:!0})),size:this.orthogonalSize};this.children=f.map(y=>y.node),this.splitview=new Jo(this.element,{orientation:this.orientation,descriptor:p,proportionalLayout:i,styles:a,margin:h})}this.disabled=d,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,i){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===i)return;const a=this.splitview.contentSize===0;this.splitview.setViewVisible(e,i);const r=this.splitview.contentSize===0;(i&&a||!i&&r)&&this._onDidVisibilityChange.fire({visible:i})}moveChild(e,i){if(e===i)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e<i&&i--,this.splitview.moveView(e,i);const a=this._removeChild(e);this._addChild(a,i)}getChildSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,i){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,i)}layout(e,i){this._size=i,this._orthogonalSize=e,this.splitview.layout(i,e)}addChild(e,i,a,r){if(a<0||a>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,i,a,r),this._addChild(e,a)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,i){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,i),this._removeChild(e)}_addChild(e,i){this.children.splice(i,0,e),this.setupChildrenEvents()}_removeChild(e){const[i]=this.children.splice(e,1);return this.setupChildrenEvents(),i}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new Ae(Rs.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((e,i)=>e instanceof ut?e.onDidVisibilityChange(({visible:a})=>{this.setChildVisible(i,a)}):yt.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}}function ff(n,e){if(n instanceof Et)return n;if(n instanceof ut)return ff(n.children[e?n.children.length-1:0],e);throw new Error("invalid node")}function dS(n,e,i){if(n instanceof ut){const a=new ut(n.orientation,n.proportionalLayout,n.styles,e,i,n.disabled,n.margin);for(let r=n.children.length-1;r>=0;r--){const c=n.children[r];a.addChild(dS(c,c.size,c.orthogonalSize),c.size,0,!0)}return a}else return new Et(n.view,n.orientation,i)}function mf(n,e,i){if(n instanceof ut){const a=new ut(Wn(n.orientation),n.proportionalLayout,n.styles,e,i,n.disabled,n.margin);let r=0;for(let c=n.children.length-1;c>=0;c--){const d=n.children[c],h=d instanceof ut?d.orthogonalSize:d.size;let f=n.size===0?0:Math.round(e*h/n.size);r+=f,c===0&&(f+=e-r),a.addChild(mf(d,i,f),f,0,!0)}return a}else return new Et(n.view,Wn(n.orientation),i)}function zT(n){const e=n.parentElement;if(!e)throw new Error("Invalid grid element");let i=e.firstElementChild,a=0;for(;i!==n&&i!==e.lastElementChild&&i;)i=i.nextElementSibling,a++;return a}function ot(n){const e=n.parentElement;if(!e)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(e.className))return[];const i=zT(e),a=e.parentElement.parentElement.parentElement;return[...ot(a),i]}function $n(n,e,i){const a=PT(n,e),r=MT(i);if(a===r){const[c,d]=xi(e);let h=d;return(i==="right"||i==="bottom")&&(h+=1),[...c,h]}else{const c=i==="right"||i==="bottom"?1:0;return[...e,c]}}function MT(n){return n==="top"||n==="bottom"?be.VERTICAL:be.HORIZONTAL}function PT(n,e){return e.length%2===0?Wn(n):n}const Wn=n=>n===be.HORIZONTAL?be.VERTICAL:be.HORIZONTAL;function LT(n){return!!n.children}const pf=(n,e)=>{const i=e===be.VERTICAL?n.box.width:n.box.height;return LT(n)?{type:"branch",data:n.children.map(a=>pf(a,Wn(e))),size:i}:typeof n.cachedVisibleSize=="number"?{type:"leaf",data:n.view.toJSON(),size:n.cachedVisibleSize,visible:!1}:{type:"leaf",data:n.view.toJSON(),size:i}};class IT{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:i,orthogonalSize:a}=this.root;this.root=mf(this.root,a,i),this.root.layout(i,a)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const i=[this.root];for(;i.length>0;){const a=i.pop();a instanceof ut&&(a.disabled=e,i.push(...a.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)===null||e===void 0?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var i;const a=ot(e.element),[r,c]=this.getNode(a);if(!(c instanceof Et)||((i=this._maximizedNode)===null||i===void 0?void 0:i.leaf)===c)return;this.hasMaximizedView()&&this.exitMaximizedView(),pf(this.getView(),this.orientation);const d=[];function h(f,p){for(let y=0;y<f.children.length;y++){const b=f.children[y];b instanceof Et?b!==p&&(f.isChildVisible(y)?f.setChildVisible(y,!1):d.push(b)):h(b,p)}}h(this.root,c),this._maximizedNode={leaf:c,hiddenOnMaximize:d},this._onDidMaximizedNodeChange.fire({view:c.view,isMaximized:!0})}exitMaximizedView(){if(!this._maximizedNode)return;const e=this._maximizedNode.hiddenOnMaximize;function i(r){for(let c=r.children.length-1;c>=0;c--){const d=r.children[c];d instanceof Et?e.includes(d)||r.setChildVisible(c,!0):i(d)}}i(this.root);const a=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:a.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let i;e&&(i=ot(e.element)),this.hasMaximizedView()&&this.exitMaximizedView();const r={root:pf(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return i&&(r.maximizedNode={location:i}),e&&this.maximizeView(e),r}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new ut(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,i){const a=e.orientation,r=a===be.VERTICAL?e.height:e.width;if(this._deserialize(e.root,a,i,r),this.layout(e.width,e.height),e.maximizedNode){const c=e.maximizedNode.location,[d,h]=this.getNode(c);if(!(h instanceof Et))return;this.maximizeView(h.view)}}_deserialize(e,i,a,r){this.root=this._deserializeNode(e,i,a,r)}_deserializeNode(e,i,a,r){var c;let d;if(e.type==="branch"){const f=e.data.map(p=>({node:this._deserializeNode(p,Wn(i),a,e.size),visible:p.visible}));d=new ut(i,this.proportionalLayout,this.styles,e.size,r,this.locked,this.margin,f)}else{const h=a.fromJSON(e);typeof e.visible=="boolean"&&((c=h.setVisible)===null||c===void 0||c.call(h,e.visible)),d=new Et(h,i,r,e.size)}return d}get root(){return this._root}set root(e){const i=this._root;i&&(i.dispose(),this._maximizedNode=void 0,this.element.removeChild(i.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(a=>{this._onDidChange.fire(a)})}normalize(){if(!this._root||this._root.children.length!==1)return;const e=this.root,i=e.children[0];if(i instanceof Et)return;e.element.remove();const a=e.removeChild(0);e.dispose(),a.dispose(),this._root=dS(i,i.size,i.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(r=>{this._onDidChange.fire(r)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new ut(Wn(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){const i=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(mf(i,i.orthogonalSize,i.size),_n.Distribute,0)}else this._root.addChild(e,_n.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(i=>{this._onDidChange.fire(i)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const i=e?this.getNode(e)[1]:this.root;return this._getViews(i,this.orientation)}_getViews(e,i,a){const r={height:e.height,width:e.width};if(e instanceof Et)return{box:r,view:e.view,cachedVisibleSize:a};const c=[];for(let d=0;d<e.children.length;d++){const h=e.children[d],f=e.getChildCachedVisibleSize(d);c.push(this._getViews(h,Wn(i),f))}return{box:r,children:c}}progmaticSelect(e,i=!1){const[a,r]=this.getNode(e);if(!(r instanceof Et))throw new Error("invalid location");for(let c=a.length-1;c>-1;c--){const d=a[c],h=e[c]||0;if(i?h-1>-1:h+1<d.children.length)return ff(d.children[i?h-1:h+1],i)}return ff(this.root,i)}constructor(e,i,a,r,c){this.proportionalLayout=e,this.styles=i,this._locked=!1,this._margin=0,this._maximizedNode=void 0,this.disposable=new Pt,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onDidViewVisibilityChange=new ie,this.onDidViewVisibilityChange=this._onDidViewVisibilityChange.event,this._onDidMaximizedNodeChange=new ie,this.onDidMaximizedNodeChange=this._onDidMaximizedNodeChange.event,this.element=document.createElement("div"),this.element.className="dv-grid-view",this._locked=r??!1,this._margin=c??0,this.root=new ut(a,e,i,0,0,this.locked,this.margin)}isViewVisible(e){const[i,a]=xi(e),[,r]=this.getNode(i);if(!(r instanceof ut))throw new Error("Invalid from location");return r.isChildVisible(a)}setViewVisible(e,i){this.hasMaximizedView()&&this.exitMaximizedView();const[a,r]=xi(e),[,c]=this.getNode(a);if(!(c instanceof ut))throw new Error("Invalid from location");this._onDidViewVisibilityChange.fire(),c.setChildVisible(r,i)}moveView(e,i,a){this.hasMaximizedView()&&this.exitMaximizedView();const[,r]=this.getNode(e);if(!(r instanceof ut))throw new Error("Invalid location");r.moveChild(i,a)}addView(e,i,a){this.hasMaximizedView()&&this.exitMaximizedView();const[r,c]=xi(a),[d,h]=this.getNode(r);if(h instanceof ut){const f=new Et(e,Wn(h.orientation),h.orthogonalSize);h.addChild(f,i,c)}else{const[f,...p]=[...d].reverse(),[y,...b]=[...r].reverse();let x=0;const w=f.getChildCachedVisibleSize(y);typeof w=="number"&&(x=_n.Invisible(w)),f.removeChild(y).dispose();const C=new ut(h.orientation,this.proportionalLayout,this.styles,h.size,h.orthogonalSize,this.locked,this.margin);f.addChild(C,h.size,y);const S=new Et(h.view,f.orientation,h.size);C.addChild(S,x,0),typeof i!="number"&&i.type==="split"&&(i={type:"split",index:0});const D=new Et(e,f.orientation,h.size);C.addChild(D,i,c)}}remove(e,i){const a=ot(e.element);return this.removeView(a,i)}removeView(e,i){this.hasMaximizedView()&&this.exitMaximizedView();const[a,r]=xi(e),[c,d]=this.getNode(a);if(!(d instanceof ut))throw new Error("Invalid location");const h=d.children[r];if(!(h instanceof Et))throw new Error("Invalid location");if(d.removeChild(r,i),h.dispose(),d.children.length!==1)return h.view;const f=d.children[0];if(c.length===0)return f instanceof Et||(d.removeChild(0,i),this.root=f),h.view;const[p,...y]=[...c].reverse(),[b,...x]=[...a].reverse(),w=d.isChildVisible(0);d.removeChild(0,i);const E=p.children.map((C,S)=>p.getChildSize(S));if(p.removeChild(b,i).dispose(),f instanceof ut){E.splice(b,1,...f.children.map(C=>C.size));for(let C=0;C<f.children.length;C++){const S=f.children[C];p.addChild(S,S.size,b+C)}for(;f.children.length>0;)f.removeChild(0)}else{const C=new Et(f.view,Wn(f.orientation),f.size),S=w?f.orthogonalSize:_n.Invisible(f.orthogonalSize);p.addChild(C,S,b)}f.dispose();for(let C=0;C<E.length;C++)p.resizeChild(C,E[C]);return h.view}layout(e,i){const[a,r]=this.root.orientation===be.HORIZONTAL?[i,e]:[e,i];this.root.layout(a,r)}getNode(e,i=this.root,a=[]){if(e.length===0)return[a,i];if(!(i instanceof ut))throw new Error("Invalid location");const[r,...c]=e;if(r<0||r>=i.children.length)throw new Error("Invalid location");const d=i.children[r];return a.push(i),this.getNode(c,d,a)}}const gf=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});class sm extends Ae{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,i=!1){super(),this._disableResizing=i,this._element=e,this.addDisposables(zc(this._element,a=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!CT(this._element))return;const{width:r,height:c}=a.contentRect;this.layout(r,c)}))}}const GT=im();function mc(n){switch(n){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";default:return"center"}}class hS extends sm{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,i){var a;super(document.createElement("div"),i.disableAutoResizing),this._id=GT.next(),this._groups=new Map,this._onDidRemove=new ie,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new ie,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new ie,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new ie,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new kb,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new kb,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new Pc(this.element),this._classNames.setClassNames((a=i.className)!==null&&a!==void 0?a:""),e.appendChild(this.element),this.gridview=new IT(!!i.proportionalLayout,i.styles,i.orientation,i.locked,i.margin),this.gridview.locked=!!i.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(r=>{this._onDidMaximizedChange.fire({panel:r.view,isMaximized:r.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.layout(this.width,this.height,!0)}),yt.from(()=>{var r;(r=this.element.parentElement)===null||r===void 0||r.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),Rs.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,i){this.gridview.setViewVisible(ot(e.element),i),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(ot(e.element))}updateOptions(e){var i,a,r,c;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=(i=e.disableAutoResizing)!==null&&i!==void 0?i:!1),"locked"in e&&(this.locked=(a=e.locked)!==null&&a!==void 0?a:!1),"margin"in e&&(this.gridview.margin=(r=e.margin)!==null&&r!==void 0?r:0),"className"in e&&this._classNames.setClassNames((c=e.className)!==null&&c!==void 0?c:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,i=[0],a){this.gridview.addView(e,a??_n.Distribute,i),this._onDidAdd.fire(e)}doRemoveGroup(e,i){if(!this._groups.has(e.id))throw new Error("invalid operation");const a=this._groups.get(e.id),r=this.gridview.remove(e,_n.Distribute);if(a&&!i?.skipDispose&&(a.disposable.dispose(),a.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!i?.skipActive&&this._activeGroup===e){const c=Array.from(this._groups.values());this.doSetGroupActive(c.length>0?c[0].value:void 0)}return r}getPanel(e){var i;return(i=this._groups.get(e))===null||i===void 0?void 0:i.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var i;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const a=ot(e.group.element),r=(i=this.gridview.next(a))===null||i===void 0?void 0:i.view;this.doSetGroupActive(r)}moveToPrevious(e){var i;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const a=ot(e.group.element),r=(i=this.gridview.previous(a))===null||i===void 0?void 0:i.view;this.doSetGroupActive(r)}layout(e,i,a){(a||e!==this.width||i!==this.height)&&(this.gridview.element.style.height=`${i}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,i))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class fS{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,i){this.component.removePanel(e,i)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,i){return this.component.layout(e,i)}addPanel(e){return this.component.addPanel(e)}movePanel(e,i){this.component.movePanel(e,i)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class er{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,i){this.component.movePanel(e,i)}focus(){this.component.focus()}layout(e,i){this.component.layout(e,i)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class mS{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,i,a=!1){this.component.layout(e,i,a)}addPanel(e){return this.component.addPanel(e)}removePanel(e,i){this.component.removePanel(e,i)}movePanel(e,i){this.component.movePanel(e,i)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class pc{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,i,a=!1){this.component.layout(e,i,a)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,i){return this.component.addFloatingGroup(e,i)}fromJSON(e,i){this.component.fromJSON(e,i)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,i){return this.component.addPopoutGroup(e,i)}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class am extends Ae{constructor(e,i){super(),this.el=e,this.disabled=i,this.dataDisposable=new Pt,this.pointerEventsDisposable=new Pt,this._onDragStart=new ie,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(e){this.disabled=e}isCancelled(e){return!1}configure(){this.addDisposables(this._onDragStart,Pe(this.el,"dragstart",e=>{if(e.defaultPrevented||this.isCancelled(e)||this.disabled){e.preventDefault();return}const i=fc();this.pointerEventsDisposable.value={dispose:()=>{i.release()}},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this.dataDisposable.value=this.getData(e),this._onDragStart.fire(e),e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.items.length>0||e.dataTransfer.setData("text/plain",""))}),Pe(this.el,"dragend",()=>{this.pointerEventsDisposable.dispose(),setTimeout(()=>{this.dataDisposable.dispose()},0)}))}}class pS extends Ae{constructor(e,i){super(),this.element=e,this.callbacks=i,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(Pe(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(Pe(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(Pe(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(Pe(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(Pe(this.element,"drop",e=>{this.onDrop(e)}))}}function BT(n,e){const{top:i,left:a,width:r,height:c}=e,d=`${Math.round(i)}px`,h=`${Math.round(a)}px`,f=`${Math.round(r)}px`,p=`${Math.round(c)}px`;n.style.top=d,n.style.left=h,n.style.width=f,n.style.height=p,n.style.visibility="visible",(!n.style.transform||n.style.transform==="")&&(n.style.transform="translate3d(0, 0, 0)")}function HT(n,e){const{top:i,left:a,width:r,height:c}=e;n.style.top=i,n.style.left=a,n.style.width=r,n.style.height=c,n.style.visibility="visible",(!n.style.transform||n.style.transform==="")&&(n.style.transform="translate3d(0, 0, 0)")}function VT(n,e){const{top:i,left:a,width:r,height:c}=e,d=`${Math.round(i)}px`,h=`${Math.round(a)}px`,f=`${Math.round(r)}px`,p=`${Math.round(c)}px`;return n.style.top!==d||n.style.left!==h||n.style.width!==f||n.style.height!==p}class FT extends nm{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function zb(n){switch(n){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${n}'`)}}function UT(n){switch(n){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${n}'`)}}const $T={value:20,type:"percentage"},WT={value:50,type:"percentage"},qT=100,YT=100;class zn extends Ae{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,i){super(),this.element=e,this.options=i,this._onDrop=new ie,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new pS(this.element,{onDragEnter:()=>{var a,r,c;(c=(r=(a=this.options).getOverrideTarget)===null||r===void 0?void 0:r.call(a))===null||c===void 0||c.getElements()},onDragOver:a=>{var r,c,d,h,f,p,y;zn.ACTUAL_TARGET=this;const b=(c=(r=this.options).getOverrideTarget)===null||c===void 0?void 0:c.call(r);if(this._acceptedTargetZonesSet.size===0){if(b)return;this.removeDropTarget();return}const x=(f=(h=(d=this.options).getOverlayOutline)===null||h===void 0?void 0:h.call(d))!==null&&f!==void 0?f:this.element,w=x.offsetWidth,E=x.offsetHeight;if(w===0||E===0)return;const C=a.currentTarget.getBoundingClientRect(),S=((p=a.clientX)!==null&&p!==void 0?p:0)-C.left,D=((y=a.clientY)!==null&&y!==void 0?y:0)-C.top,N=this.calculateQuadrant(this._acceptedTargetZonesSet,S,D,w,E);if(this.isAlreadyUsed(a)||N===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(a,N)){if(b)return;this.removeDropTarget();return}const k=new FT({nativeEvent:a,position:N});if(this._onWillShowOverlay.fire(k),k.defaultPrevented){this.removeDropTarget();return}this.markAsUsed(a),b||this.targetElement||(this.targetElement=document.createElement("div"),this.targetElement.className="dv-drop-target-dropzone",this.overlayElement=document.createElement("div"),this.overlayElement.className="dv-drop-target-selection",this._state="center",this.targetElement.appendChild(this.overlayElement),x.classList.add("dv-drop-target"),x.append(this.targetElement)),this.toggleClasses(N,w,E),this._state=N},onDragLeave:()=>{var a,r;!((r=(a=this.options).getOverrideTarget)===null||r===void 0)&&r.call(a)||this.removeDropTarget()},onDragEnd:a=>{var r,c;const d=(c=(r=this.options).getOverrideTarget)===null||c===void 0?void 0:c.call(r);d&&zn.ACTUAL_TARGET===this&&this._state&&(a.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:a})),this.removeDropTarget(),d?.clear()},onDrop:a=>{var r,c,d;a.preventDefault();const h=this._state;this.removeDropTarget(),(d=(c=(r=this.options).getOverrideTarget)===null||c===void 0?void 0:c.call(r))===null||d===void 0||d.clear(),h&&(a.stopPropagation(),this._onDrop.fire({position:h,nativeEvent:a}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[zn.USED_EVENT_ID]=!0}isAlreadyUsed(e){const i=e[zn.USED_EVENT_ID];return typeof i=="boolean"&&i}toggleClasses(e,i,a){var r,c,d,h,f,p,y;const b=(c=(r=this.options).getOverrideTarget)===null||c===void 0?void 0:c.call(r);if(!b&&!this.overlayElement)return;const x=i<qT,w=a<YT,E=e==="left",C=e==="right",S=e==="top",D=e==="bottom",N=!x&&C,k=!x&&E,T=!w&&S,R=!w&&D;let z=1;const O=(h=(d=this.options.overlayModel)===null||d===void 0?void 0:d.size)!==null&&h!==void 0?h:WT;if(O.type==="percentage"?z=st(O.value,0,100)/100:((N||k)&&(z=st(0,O.value,i)/i),(T||R)&&(z=st(0,O.value,a)/a)),b){const G=(y=(p=(f=this.options).getOverlayOutline)===null||p===void 0?void 0:p.call(f))!==null&&y!==void 0?y:this.element,U=G.getBoundingClientRect(),B=b.getElements(void 0,G),$=B.root,ae=B.overlay,ne=$.getBoundingClientRect(),W=U.top-ne.top,M=U.left-ne.left,K={top:W,left:M,width:i,height:a};if(N?(K.left=M+i*(1-z),K.width=i*z):k?K.width=i*z:T?K.height=a*z:R&&(K.top=W+a*(1-z),K.height=a*z),x&&E&&(K.width=4),x&&C&&(K.left=M+i-4,K.width=4),!VT(ae,K))return;BT(ae,K),ae.className=`dv-drop-target-anchor${this.options.className?` ${this.options.className}`:""}`,Ee(ae,"dv-drop-target-left",E),Ee(ae,"dv-drop-target-right",C),Ee(ae,"dv-drop-target-top",S),Ee(ae,"dv-drop-target-bottom",D),Ee(ae,"dv-drop-target-center",e==="center"),B.changed&&(Ee(ae,"dv-drop-target-anchor-container-changed",!0),setTimeout(()=>{Ee(ae,"dv-drop-target-anchor-container-changed",!1)},10));return}if(!this.overlayElement)return;const A={top:"0px",left:"0px",width:"100%",height:"100%"};N?(A.left=`${100*(1-z)}%`,A.width=`${100*z}%`):k?A.width=`${100*z}%`:T?A.height=`${100*z}%`:R&&(A.top=`${100*(1-z)}%`,A.height=`${100*z}%`),HT(this.overlayElement,A),Ee(this.overlayElement,"dv-drop-target-small-vertical",w),Ee(this.overlayElement,"dv-drop-target-small-horizontal",x),Ee(this.overlayElement,"dv-drop-target-left",E),Ee(this.overlayElement,"dv-drop-target-right",C),Ee(this.overlayElement,"dv-drop-target-top",S),Ee(this.overlayElement,"dv-drop-target-bottom",D),Ee(this.overlayElement,"dv-drop-target-center",e==="center")}calculateQuadrant(e,i,a,r,c){var d,h;const f=(h=(d=this.options.overlayModel)===null||d===void 0?void 0:d.activationSize)!==null&&h!==void 0?h:$T;return f.type==="percentage"?XT(e,i,a,r,c,f.value):QT(e,i,a,r,c,f.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,(e=this.targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}}zn.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function XT(n,e,i,a,r,c){const d=100*e/a,h=100*i/r;return n.has("left")&&d<c?"left":n.has("right")&&d>100-c?"right":n.has("top")&&h<c?"top":n.has("bottom")&&h>100-c?"bottom":n.has("center")?"center":null}function QT(n,e,i,a,r,c){return n.has("left")&&e<c?"left":n.has("right")&&e>a-c?"right":n.has("top")&&i<c?"top":n.has("bottom")&&i>r-c?"bottom":n.has("center")?"center":null}const vf=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});class ZT extends oS{constructor(e,i,a,r){super(),this.nativeEvent=e,this.position=i,this.getData=a,this.panel=r}}class gS extends nm{constructor(){super()}}class vS extends Ae{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,i){super(),this.id=e,this.component=i,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new Pt,this._onDidDimensionChange=new ie,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new ie,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new ie,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new ie,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new ie,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new ie,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new ie,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new ie,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(a=>{this._isFocused=a.isFocused}),this.onDidActiveChange(a=>{this._isActive=a.isActive}),this.onDidVisibilityChange(a=>{this._isVisible=a.isVisible}),this.onDidDimensionsChange(a=>{this._width=a.width,this._height=a.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(i=>{this._parameters=i,e.update({params:i})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class yS extends vS{constructor(e,i){super(e,i),this._onDidConstraintsChangeInternal=new ie,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new ie({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new ie,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class KT extends yS{set pane(e){this._pane=e}constructor(e,i){super(e,i),this._onDidExpansionChange=new ie({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new ie({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new ie({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var i;(i=this._pane)===null||i===void 0||i.setExpanded(e)}get isExpanded(){var e;return!!(!((e=this._pane)===null||e===void 0)&&e.isExpanded())}}class om extends Ae{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)===null||e===void 0?void 0:e.params}constructor(e,i,a){super(),this.id=e,this.component=i,this.api=a,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const r=rS(this._element);this.addDisposables(this.api,r.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),r.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),r)}focus(){const e=new gS;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,i){this._width=e,this._height=i,this.api._onDidDimensionChange.fire({width:e,height:i}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var i,a;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(i=this._params)===null||i===void 0?void 0:i.params),e.params)});for(const r of Object.keys(e.params))e.params[r]===void 0&&delete this._params.params[r];(a=this.part)===null||a===void 0||a.update({params:this._params.params})}toJSON(){var e,i;const a=(i=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&i!==void 0?i:{};return{id:this.id,component:this.component,params:Object.keys(a).length>0?a:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)===null||e===void 0||e.dispose(),super.dispose()}}class JT extends om{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=this.headerSize,a=this.isExpanded()?this._minimumBodySize:0;return e+a}get maximumSize(){const e=this.headerSize,a=this.isExpanded()?this._maximumBodySize:0;return e+a}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=typeof e=="number"?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=typeof e=="number"?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new KT(e.id,e.component)),this._onDidChangeExpansionState=new ie({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(i=>{const{isVisible:a}=i,{accessor:r}=this._params;r.setVisible(this,a)}),this.api.onDidSizeChange(i=>{this._onDidChange.fire({size:i.size})}),Pe(this.element,"mouseenter",i=>{this.api._onMouseEnter.fire(i)}),Pe(this.element,"mouseleave",i=>{this.api._onMouseLeave.fire(i)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(i=>{this.api._onDidExpansionChange.fire({isExpanded:i})}),this.api.onDidFocusChange(i=>{this.header&&(i.isFocused?Mc(this.header,"focused"):Ko(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var i;(i=this.body)===null||i===void 0||i.remove()},200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,i){this._size=e,this._orthogonalSize=i;const[a,r]=this.orientation===be.HORIZONTAL?[e,i]:[i,e];super.layout(a,r)}init(e){var i,a;super.init(e),typeof e.minimumBodySize=="number"&&(this.minimumBodySize=e.minimumBodySize),typeof e.maximumBodySize=="number"&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),(i=this.body)===null||i===void 0||i.append(this.bodyPart.element),(a=this.header)===null||a===void 0||a.append(this.headerPart.element),typeof e.isExpanded=="boolean"&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var i,a;(i=this.bodyPart)===null||i===void 0||i.update({params:e}),(a=this.headerPart)===null||a===void 0||a.update({params:e})},dispose:()=>{var e,i;(e=this.bodyPart)===null||e===void 0||e.dispose(),(i=this.headerPart)===null||i===void 0||i.dispose()}}}}class ek extends JT{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new ie,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOverEvent=new ie,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOverEvent),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,i=this.accessor.id;this.header.draggable=!0,this.handler=new class extends am{getData(){return Zn.getInstance().setData([new Xo(i,e)],Xo.prototype),{dispose:()=>{Zn.getInstance().clearData(Xo.prototype)}}}}(this.header),this.target=new zn(this.element,{acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(a,r)=>{const c=$o();if(c&&c.paneId!==this.id&&c.viewId===this.accessor.id)return!0;const d=new ZT(a,r,$o,this);return this._onUnhandledDragOverEvent.fire(d),d.isAccepted}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop(a=>{this.onDrop(a)}))}onDrop(e){const i=$o();if(!i||i.viewId!==this.accessor.id){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new er(this.accessor),getData:$o}));return}const a=this._params.containerApi,r=i.paneId,c=a.getPanel(r);if(!c){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:$o,api:new er(this.accessor)}));return}const d=a.panels,h=d.indexOf(c);let f=a.panels.indexOf(this);(e.position==="left"||e.position==="top")&&(f=Math.max(0,f-1)),(e.position==="right"||e.position==="bottom")&&(h>f&&f++,f=Math.min(d.length-1,f)),a.movePanel(h,f)}}class tk extends Ae{get element(){return this._element}constructor(e,i){super(),this.accessor=e,this.group=i,this.disposable=new Pt,this._onDidFocus=new ie,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new ie,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);const a=i.dropTargetContainer;this.dropTarget=new zn(this.element,{getOverlayOutline:()=>{var r;return((r=e.options.theme)===null||r===void 0?void 0:r.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:(r,c)=>{if(this.group.locked==="no-drop-target"||this.group.locked&&c==="center")return!1;const d=zt();return!d&&r.shiftKey&&this.group.location.type!=="floating"?!1:d&&d.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(r,c,"content")},getOverrideTarget:a?()=>a.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}renderPanel(e,i={asActive:!0}){const a=i.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&this._element.removeChild(this.panel.view.content.element),this.panel=e;let r;switch(e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&a&&this._element.appendChild(this.panel.view.content.element),r=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),r=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(a){const c=rS(r);this.focusTracker=c;const d=new Ae;d.addDisposables(c,c.onDidFocus(()=>this._onDidFocus.fire()),c.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=d}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,i){}closePanel(){var e;this.panel&&this.panel.api.renderer==="onlyWhenVisible"&&((e=this.panel.view.content.element.parentElement)===null||e===void 0||e.removeChild(this.panel.view.content.element)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;!((e=this.focusTracker)===null||e===void 0)&&e.refreshState&&this.focusTracker.refreshState()}}function bS(n,e,i){var a,r;Mc(e,"dv-dragged"),e.style.top="-9999px",document.body.appendChild(e),n.setDragImage(e,(a=i?.x)!==null&&a!==void 0?a:0,(r=i?.y)!==null&&r!==void 0?r:0),setTimeout(()=>{Ko(e,"dv-dragged"),e.remove()},0)}class nk extends am{constructor(e,i,a,r,c){super(e,c),this.accessor=i,this.group=a,this.panel=r,this.panelTransfer=Zn.getInstance()}getData(e){return this.panelTransfer.setData([new Ki(this.accessor.id,this.group.id,this.panel.id)],Ki.prototype),{dispose:()=>{this.panelTransfer.clearData(Ki.prototype)}}}}class ik extends Ae{get element(){return this._element}constructor(e,i,a){super(),this.panel=e,this.accessor=i,this.group=a,this.content=void 0,this._onPointDown=new ie,this.onPointerDown=this._onPointDown.event,this._onDropped=new ie,this.onDrop=this._onDropped.event,this._onDragStart=new ie,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,Ee(this.element,"dv-inactive-tab",!0),this.dragHandler=new nk(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new zn(this._element,{acceptedTargetZones:["left","right"],overlayModel:{activationSize:{value:50,type:"percentage"}},canDisplayOverlay:(r,c)=>{if(this.group.locked)return!1;const d=zt();return d&&this.accessor.id===d.viewId?!0:this.group.model.canDisplayOverlay(r,c,"tab")},getOverrideTarget:()=>{var r;return(r=a.model.dropTargetContainer)===null||r===void 0?void 0:r.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onDropped,this._onDragStart,this.dragHandler.onDragStart(r=>{if(r.dataTransfer){const c=getComputedStyle(this.element),d=this.element.cloneNode(!0);Array.from(c).forEach(h=>d.style.setProperty(h,c.getPropertyValue(h),c.getPropertyPriority(h))),d.style.position="absolute",bS(r.dataTransfer,d,{y:-10,x:30})}this._onDragStart.fire(r)}),this.dragHandler,Pe(this._element,"pointerdown",r=>{this._onPointDown.fire(r)}),this.dropTarget.onDrop(r=>{this._onDropped.fire(r)}),this.dropTarget)}setActive(e){Ee(this.element,"dv-active-tab",e),Ee(this.element,"dv-inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}dispose(){super.dispose()}}class Lc{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,i){this.event=e,this.options=i}}class sk extends am{constructor(e,i,a,r){super(e,r),this.accessor=i,this.group=a,this.panelTransfer=Zn.getInstance(),this.addDisposables(Pe(e,"pointerdown",c=>{c.shiftKey&&wT(c)},!0))}isCancelled(e){return this.group.api.location.type==="floating"&&!e.shiftKey}getData(e){const i=e.dataTransfer;this.panelTransfer.setData([new Ki(this.accessor.id,this.group.id,null)],Ki.prototype);const a=window.getComputedStyle(this.el),r=a.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),c=a.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");if(i){const d=document.createElement("div");d.style.backgroundColor=r,d.style.color=c,d.style.padding="2px 8px",d.style.height="24px",d.style.fontSize="11px",d.style.lineHeight="20px",d.style.borderRadius="12px",d.style.position="absolute",d.style.pointerEvents="none",d.style.top="-9999px",d.textContent=`Multiple Panels (${this.group.size})`,bS(i,d,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(Ki.prototype)}}}}class ak extends Ae{get element(){return this._element}constructor(e,i){super(),this.accessor=e,this.group=i,this._onDrop=new ie,this.onDrop=this._onDrop.event,this._onDragStart=new ie,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this._element.draggable=!this.accessor.options.disableDnd,Ee(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,Pe(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)})),this.handler=new sk(this._element,e,i,!!this.accessor.options.disableDnd),this.dropTarget=new zn(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:(a,r)=>{const c=zt();return c&&this.accessor.id===c.viewId?!0:i.model.canDisplayOverlay(a,r,"header_space")},getOverrideTarget:()=>{var a;return(a=i.model.dropTargetContainer)===null||a===void 0?void 0:a.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart(a=>{this._onDragStart.fire(a)}),this.dropTarget.onDrop(a=>{this._onDrop.fire(a)}),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,Ee(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}}class Ic extends Ae{get element(){return this._element}constructor(e){super(),this.scrollableElement=e,this._scrollLeft=0,this._element=document.createElement("div"),this._element.className="dv-scrollable",this._horizontalScrollbar=document.createElement("div"),this._horizontalScrollbar.className="dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._horizontalScrollbar),this.addDisposables(Pe(this.element,"wheel",i=>{this._scrollLeft+=i.deltaY*Ic.MouseWheelSpeed,this.calculateScrollbarStyles()}),Pe(this._horizontalScrollbar,"pointerdown",i=>{i.preventDefault(),Ee(this.element,"dv-scrollable-scrolling",!0);const a=i.clientX,r=this._scrollLeft,c=h=>{const f=h.clientX-a,{clientWidth:p}=this.element,{scrollWidth:y}=this.scrollableElement,b=p/y;this._scrollLeft=r+f/b,this.calculateScrollbarStyles()},d=()=>{Ee(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",d),document.removeEventListener("pointercancel",d)};document.addEventListener("pointermove",c),document.addEventListener("pointerup",d),document.addEventListener("pointercancel",d)}),Pe(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),Pe(this.scrollableElement,"scroll",()=>{this._scrollLeft=this.scrollableElement.scrollLeft,this.calculateScrollbarStyles()}),zc(this.element,()=>{Ee(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),Ee(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const{clientWidth:e}=this.element,{scrollWidth:i}=this.scrollableElement;if(i>e){const r=e*(e/i);this._horizontalScrollbar.style.width=`${r}px`,this._scrollLeft=st(this._scrollLeft,0,this.scrollableElement.scrollWidth-e),this.scrollableElement.scrollLeft=this._scrollLeft;const c=this._scrollLeft/(i-e);this._horizontalScrollbar.style.left=`${(e-r)*c}px`}else this._horizontalScrollbar.style.width="0px",this._horizontalScrollbar.style.left="0px",this._scrollLeft=0}}Ic.MouseWheelSpeed=1;class ok extends Ae{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const i=new bT(this._tabsList);this._observerDisposable.value=new Ae(i,i.onDidChange(a=>{const r=a.hasScrollX||a.hasScrollY;this.toggleDropdown({reset:!r})}),Pe(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1})}))}}get element(){return this._element}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}constructor(e,i,a){if(super(),this.group=e,this.accessor=i,this._observerDisposable=new Pt,this._tabs=[],this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._onTabDragStart=new ie,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new ie,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new ie,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container dv-horizontal",this.showTabsOverflowControl=a.showTabsOverflowControl,i.options.scrollbars==="native")this._element=this._tabsList;else{const r=new Ic(this._tabsList);this._element=r.element,this.addDisposables(r)}this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,Pe(this.element,"pointerdown",r=>{if(r.defaultPrevented)return;r.button===0&&this.accessor.doSetGroupActive(this.group)}),yt.from(()=>{for(const{value:r,disposable:c}of this._tabs)c.dispose(),r.dispose();this._tabs=[]}))}indexOf(e){return this._tabs.findIndex(i=>i.value.panel.id===e)}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}setActivePanel(e){let i=0;for(const a of this._tabs){const r=e.id===a.value.panel.id;if(a.value.setActive(r),r){const c=a.value.element,d=c.parentElement;(i<d.scrollLeft||i+c.clientWidth>d.scrollLeft+d.clientWidth)&&(d.scrollLeft=i)}i+=a.value.element.clientWidth}}openPanel(e,i=this._tabs.length){if(this._tabs.find(d=>d.value.panel.id===e.id))return;const a=new ik(e,this.accessor,this.group);a.setContent(e.view.tab);const r=new Ae(a.onDragStart(d=>{this._onTabDragStart.fire({nativeEvent:d,panel:e})}),a.onPointerDown(d=>{if(d.defaultPrevented)return;const h=!this.accessor.options.disableFloatingGroups,f=this.group.api.location.type==="floating"&&this.size===1;if(h&&!f&&d.shiftKey){d.preventDefault();const p=this.accessor.getGroupPanel(a.panel.id),{top:y,left:b}=a.element.getBoundingClientRect(),{top:x,left:w}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(p,{x:b-w,y:y-x,inDragMode:!0});return}d.button===0&&this.group.activePanel!==e&&this.group.model.openPanel(e)}),a.onDrop(d=>{this._onDrop.fire({event:d.nativeEvent,index:this._tabs.findIndex(h=>h.value===a)})}),a.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(new Lc(d,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:zt}))})),c={value:a,disposable:r};this.addTab(c,i)}delete(e){const i=this.indexOf(e),a=this._tabs.splice(i,1)[0],{value:r,disposable:c}=a;c.dispose(),r.dispose(),r.element.remove()}addTab(e,i=this._tabs.length){if(i<0||i>this._tabs.length)throw new Error("invalid location");this._tabsList.insertBefore(e.value.element,this._tabsList.children[i]),this._tabs=[...this._tabs.slice(0,i),e,...this._tabs.slice(i)],this.selectedIndex<0&&(this.selectedIndex=i)}toggleDropdown(e){const i=e.reset?[]:this._tabs.filter(a=>!AT(a.value.element,this._tabsList)).map(a=>a.value.panel.id);this._onOverflowTabsChange.fire({tabs:i,reset:e.reset})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState()}}const rm=n=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"height",n.height),e.setAttributeNS(null,"width",n.width),e.setAttributeNS(null,"viewBox",n.viewbox),e.setAttributeNS(null,"aria-hidden","false"),e.setAttributeNS(null,"focusable","false"),e.classList.add("dv-svg");const i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttributeNS(null,"d",n.path),e.appendChild(i),e},rk=()=>rm({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),lk=()=>rm({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),xS=()=>rm({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});function ck(){const n=document.createElement("div");n.className="dv-tabs-overflow-dropdown-default";const e=document.createElement("span");e.textContent="";const i=xS();return n.appendChild(i),n.appendChild(e),{element:n,update:a=>{e.textContent=`${a.tabs}`}}}class uk extends Ae{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get element(){return this._element}constructor(e,i){super(),this.accessor=e,this.group=i,this._hidden=!1,this.dropdownPart=null,this._overflowTabs=[],this._dropdownDisposable=new Pt,this._onDrop=new ie,this.onDrop=this._onDrop.event,this._onGroupDragStart=new ie,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",Ee(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new ok(i,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new ak(this.accessor,this.group),this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.addDisposables(this.tabs.onDrop(a=>this._onDrop.fire(a)),this.tabs.onWillShowOverlay(a=>this._onWillShowOverlay.fire(a)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(a=>{this.toggleDropdown(a)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(a=>{this._onGroupDragStart.fire({nativeEvent:a,group:this.group})}),this.voidContainer.onDrop(a=>{this._onDrop.fire({event:a.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(a=>{this._onWillShowOverlay.fire(new Lc(a,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:zt}))}),Pe(this.voidContainer.element,"pointerdown",a=>{if(a.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&a.shiftKey&&this.group.api.location.type!=="floating"){a.preventDefault();const{top:c,left:d}=this.element.getBoundingClientRect(),{top:h,left:f}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:d-f+20,y:c-h+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}openPanel(e,i=this.tabs.size){this.tabs.openPanel(e,i),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){Ee(this._element,"dv-single-tab",this.size===1)}toggleDropdown(e){const i=e.reset?[]:e.tabs;if(this._overflowTabs=i,this._overflowTabs.length>0&&this.dropdownPart){this.dropdownPart.update({tabs:i.length});return}if(this._overflowTabs.length===0){this._dropdownDisposable.dispose();return}const a=document.createElement("div");a.className="dv-tabs-overflow-dropdown-root";const r=ck();r.update({tabs:i.length}),this.dropdownPart=r,a.appendChild(r.element),this.rightActionsContainer.prepend(a),this._dropdownDisposable.value=new Ae(yt.from(()=>{var c,d;a.remove(),(d=(c=this.dropdownPart)===null||c===void 0?void 0:c.dispose)===null||d===void 0||d.call(c),this.dropdownPart=null}),Pe(a,"pointerdown",c=>{c.preventDefault()},{capture:!0}),Pe(a,"click",c=>{const d=document.createElement("div");d.style.overflow="auto",d.className="dv-tabs-overflow-container";for(const f of this.tabs.tabs.filter(p=>this._overflowTabs.includes(p.panel.id))){const p=this.group.panels.find(w=>w===f.panel),b=p.view.createTabRenderer("headerOverflow").element,x=document.createElement("div");Ee(x,"dv-tab",!0),Ee(x,"dv-active-tab",p.api.isActive),Ee(x,"dv-inactive-tab",!p.api.isActive),x.addEventListener("click",w=>{this.accessor.popupService.close(),!w.defaultPrevented&&(f.element.scrollIntoView(),f.panel.api.setActive())}),x.appendChild(b),d.appendChild(x)}const h=kT(a);this.accessor.popupService.openPopover(d,{x:c.clientX,y:c.clientY,zIndex:h?.style.zIndex?`calc(${h.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}}class wS extends oS{constructor(e,i,a,r,c){super(),this.nativeEvent=e,this.target=i,this.position=a,this.getData=r,this.group=c}}const yf=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0});function dk(n){return!!n.referencePanel}function hk(n){return!!n.referenceGroup}function fk(n){return!!n.referencePanel}function mk(n){return!!n.referenceGroup}class lm extends nm{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class SS extends lm{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class pk extends Ae{get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(e){this._locked=e,Ee(this.container,"dv-locked-groupview",e==="no-drop-target"||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?uf(document.activeElement,this.contentContainer.element):!1}get location(){return this._location}set location(e){switch(this._location=e,Ee(this.container,"dv-groupview-floating",!1),Ee(this.container,"dv-groupview-popout",!1),e.type){case"grid":this.contentContainer.dropTarget.setTargetZones(["top","bottom","left","right","center"]);break;case"floating":this.contentContainer.dropTarget.setTargetZones(["center"]),this.contentContainer.dropTarget.setTargetZones(e?["center"]:["top","bottom","left","right","center"]),Ee(this.container,"dv-groupview-floating",!0);break;case"popout":this.contentContainer.dropTarget.setTargetZones(["center"]),Ee(this.container,"dv-groupview-popout",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,i,a,r,c){var d;super(),this.container=e,this.accessor=i,this.id=a,this.options=r,this.groupPanel=c,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._onMove=new ie,this.onMove=this._onMove.event,this._onDidDrop=new ie,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new ie,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new ie,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new ie,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new ie,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new ie,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new ie,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new ie,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new ie,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new ie,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,Ee(this.container,"dv-groupview",!0),this._api=new pc(this.accessor),this.tabsContainer=new uk(this.accessor,this.groupPanel),this.contentContainer=new tk(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!r.hideHeader,this.locked=(d=r.locked)!==null&&d!==void 0?d:!1,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(h=>{this._onTabDragStart.fire(h)}),this.tabsContainer.onGroupDragStart(h=>{this._onGroupDragStart.fire(h)}),this.tabsContainer.onDrop(h=>{this.handleDropEvent("header",h.event,"center",h.index)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(h=>{this.handleDropEvent("content",h.nativeEvent,h.position)}),this.tabsContainer.onWillShowOverlay(h=>{this._onWillShowOverlay.fire(h)}),this.contentContainer.dropTarget.onWillShowOverlay(h=>{this._onWillShowOverlay.fire(new Lc(h,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:zt}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange)}focusContent(){this.contentContainer.element.focus()}set renderContainer(e){this.panels.forEach(i=>{this.renderContainer.detatch(i)}),this._overwriteRenderContainer=e,this.panels.forEach(i=>{this.rerender(i)})}get renderContainer(){var e;return(e=this._overwriteRenderContainer)!==null&&e!==void 0?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return(e=this._overwriteDropTargetContainer)!==null&&e!==void 0?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.accessor.options.createRightHeaderActionComponent&&(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this.addDisposables(this._rightHeaderActions),this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)),this.accessor.options.createLeftHeaderActionComponent&&(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this.addDisposables(this._leftHeaderActions),this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)),this.accessor.options.createPrefixHeaderActionComponent&&(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this.addDisposables(this._prefixHeaderActions),this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element))}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const i={views:this.tabsContainer.panels,activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,id:this.id};return this.locked!==!1&&(i.locked=this.locked),this.header.hidden&&(i.hideHeader=!0),i}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const i=e.panel?this.panels.indexOf(e.panel):-1;let a;if(i<this.panels.length-1)a=i+1;else if(!e.suppressRoll)a=0;else return;this.openPanel(this.panels[a])}moveToPrevious(e){if(e||(e={}),e.panel||(e.panel=this.activePanel),!e.panel)return;const i=this.panels.indexOf(e.panel);let a;if(i>0)a=i-1;else if(!e.suppressRoll)a=this.panels.length-1;else return;this.openPanel(this.panels[a])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}openPanel(e,i={}){(typeof i.index!="number"||i.index>this.panels.length)&&(i.index=this.panels.length);const a=!!i.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:i.skipSetActive}),this.doAddPanel(e,i.index,{skipSetActive:a}),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}a||this.doSetActivePanel(e),i.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),i.skipSetActive||this.updateContainer()}removePanel(e,i={skipSetActive:!1}){const a=typeof e=="string"?e:e.id,r=this._panels.find(c=>c.id===a);if(!r)throw new Error("invalid operation");return this._removePanel(r,i)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const i of e)this.doClose(i)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const i=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,i&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,i=!1){!i&&this.isActive===e||(this._isGroupActive=e,Ee(this.container,"dv-active-group",e),Ee(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer())}layout(e,i){var a;this._width=e,this._height=i,this.contentContainer.layout(this._width,this._height),!((a=this._activePanel)===null||a===void 0)&&a.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(e,i){const a=this._activePanel===e;if(this.doRemovePanel(e),a&&this.panels.length>0){const r=this.mostRecentlyUsed[0];this.openPanel(r,{skipSetActive:i.skipSetActive,skipSetGroupActive:i.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),i.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const i=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(i,1),this.mostRecentlyUsed.includes(e)){const r=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(r,1)}const a=this._panelDisposables.get(e.id);a&&(a.dispose(),this._panelDisposables.delete(e.id)),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,i=this.panels.length,a={skipSetActive:!1}){const c=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,i),a.skipSetActive||this.contentContainer.openPanel(e),!c&&(this.updateMru(e),this.panels.splice(i,0,e),this._panelDisposables.set(e.id,new Ae(e.api.onDidTitleChange(d=>this._onDidPanelTitleChange.fire(d)),e.api.onDidParametersChange(d=>this._onDidPanelParametersChange.fire(d)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e})))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,i;if(this.panels.forEach(a=>a.runEvents()),this.isEmpty&&!this.watermark){const a=this.accessor.createWatermarkComponent();a.init({containerApi:this._api,group:this.groupPanel}),this.watermark=a,Pe(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),(i=(e=this.watermark).dispose)===null||i===void 0||i.call(e),this.watermark=void 0)}canDisplayOverlay(e,i,a){const r=new wS(e,a,i,zt,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(r),r.isAccepted}handleDropEvent(e,i,a,r){if(this.locked==="no-drop-target")return;function c(){switch(e){case"header":return typeof r=="number"?"tab":"header_space";case"content":return"content"}}const d=typeof r=="number"?this.panels[r]:void 0,h=new SS({nativeEvent:i,position:a,panel:d,getData:()=>zt(),kind:c(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(h),h.defaultPrevented)return;const f=zt();if(f&&f.viewId===this.accessor.id){if(e==="content"&&f.groupId===this.id&&(a==="center"||f.panelId===null)||e==="header"&&f.groupId===this.id&&f.panelId===null)return;if(f.panelId===null){const{groupId:w}=f;this._onMove.fire({target:a,groupId:w,index:r});return}if(this.tabsContainer.indexOf(f.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:y,panelId:b}=f;if(this.id===y&&!a&&this.tabsContainer.indexOf(b)===r)return;this._onMove.fire({target:a,groupId:f.groupId,itemId:f.panelId,index:r})}else this._onDidDrop.fire(new lm({nativeEvent:i,position:a,panel:d,getData:()=>zt(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,i,a;super.dispose(),(e=this.watermark)===null||e===void 0||e.element.remove(),(a=(i=this.watermark)===null||i===void 0?void 0:i.dispose)===null||a===void 0||a.call(i),this.watermark=void 0;for(const r of this.panels)r.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class cm extends vS{constructor(e,i,a){super(e,i),this._onDidConstraintsChangeInternal=new ie,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new ie,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new ie,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),a&&this.initialize(a)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class CS extends om{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,i,a,r){super(e,i,r??new cm(e,i)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,typeof a?.minimumWidth=="number"&&(this._minimumWidth=a.minimumWidth),typeof a?.maximumWidth=="number"&&(this._maximumWidth=a.maximumWidth),typeof a?.minimumHeight=="number"&&(this._minimumHeight=a.minimumHeight),typeof a?.maximumHeight=="number"&&(this._maximumHeight=a.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(c=>{const{isVisible:d}=c,{accessor:h}=this._params;h.setVisible(this,d)}),this.api.onActiveChange(()=>{const{accessor:c}=this._params;c.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(c=>{(typeof c.minimumWidth=="number"||typeof c.minimumWidth=="function")&&(this._minimumWidth=c.minimumWidth),(typeof c.minimumHeight=="number"||typeof c.minimumHeight=="function")&&(this._minimumHeight=c.minimumHeight),(typeof c.maximumWidth=="number"||typeof c.maximumWidth=="function")&&(this._maximumWidth=c.maximumWidth),(typeof c.maximumHeight=="number"||typeof c.maximumHeight=="function")&&(this._maximumHeight=c.maximumHeight)}),this.api.onDidSizeChange(c=>{this._onDidChange.fire({height:c.height,width:c.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible=="boolean"&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),i=r=>r===Number.MAX_SAFE_INTEGER?void 0:r,a=r=>r<=0?void 0:r;return Object.assign(Object.assign({},e),{minimumHeight:a(this.minimumHeight),maximumHeight:i(this.maximumHeight),minimumWidth:a(this.minimumWidth),maximumWidth:i(this.maximumWidth),snap:this.snap,priority:this.priority})}}const Wo="dockview: DockviewGroupPanelApiImpl not initialized";class gk extends cm{get location(){if(!this._group)throw new Error(Wo);return this._group.model.location}constructor(e,i){super(e,"__dockviewgroup__"),this.accessor=i,this._onDidLocationChange=new ie,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new ie,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidVisibilityChange.event(a=>{a.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():window}moveTo(e){var i,a,r,c;if(!this._group)throw new Error(Wo);const d=(i=e.group)!==null&&i!==void 0?i:this.accessor.addGroup({direction:UT((a=e.position)!==null&&a!==void 0?a:"right"),skipSetActive:(r=e.skipSetActive)!==null&&r!==void 0?r:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:d,position:e.group&&(c=e.position)!==null&&c!==void 0?c:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(Wo);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(Wo);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(Wo);this.isMaximized()&&this.accessor.exitMaximizedGroup()}initialize(e){this._group=e}}const vk=100,yk=100;class Mb extends CS{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth=="number")return this._explicitConstraints.minimumWidth;const i=(e=this.activePanel)===null||e===void 0?void 0:e.minimumWidth;return typeof i=="number"?i:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight=="number")return this._explicitConstraints.minimumHeight;const i=(e=this.activePanel)===null||e===void 0?void 0:e.minimumHeight;return typeof i=="number"?i:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth=="number")return this._explicitConstraints.maximumWidth;const i=(e=this.activePanel)===null||e===void 0?void 0:e.maximumWidth;return typeof i=="number"?i:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight=="number")return this._explicitConstraints.maximumHeight;const i=(e=this.activePanel)===null||e===void 0?void 0:e.maximumHeight;return typeof i=="number"?i:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,i,a){var r,c,d,h,f,p;super(i,"groupview_default",{minimumHeight:(c=(r=a.constraints)===null||r===void 0?void 0:r.minimumHeight)!==null&&c!==void 0?c:yk,minimumWidth:(h=(d=a.constraints)===null||d===void 0?void 0:d.minimumWidth)!==null&&h!==void 0?h:vk,maximumHeight:(f=a.constraints)===null||f===void 0?void 0:f.maximumHeight,maximumWidth:(p=a.constraints)===null||p===void 0?void 0:p.maximumWidth},new gk(i,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new pk(this.element,e,i,a,this),this.addDisposables(this.model.onDidActivePanelChange(y=>{this.api._onDidActivePanelChange.fire(y)}),this.api.onDidConstraintsChangeInternal(y=>{y.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof y.minimumWidth=="function"?y.minimumWidth():y.minimumWidth),y.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof y.minimumHeight=="function"?y.minimumHeight():y.minimumHeight),y.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof y.maximumWidth=="function"?y.maximumWidth():y.maximumWidth),y.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof y.maximumHeight=="function"?y.maximumHeight():y.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,i){super.layout(e,i),this.model.layout(e,i)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const bk={className:"dockview-theme-abyss"};class xk extends cm{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const i=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(i),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,i,a,r,c){super(e.id,r),this.panel=e,this.accessor=a,this._onDidTitleChange=new ie,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new ie,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new ie,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new ie,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new ie,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new Pt,this._tabComponent=c,this.initialize(e),this._group=i,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(e){var i,a;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(i=e.group)!==null&&i!==void 0?i:this._group,position:e.group&&(a=e.position)!==null&&a!==void 0?a:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var i;let a=(i=e?.isActive)!==null&&i!==void 0?i:!1;this.groupEventsDisposable.value=new Ae(this.group.api.onDidVisibilityChange(r=>{const c=!r.isVisible&&this.isVisible,d=r.isVisible&&!this.isVisible,h=this.group.model.isPanelActive(this.panel);(c||d&&h)&&this._onDidVisibilityChange.fire(r)}),this.group.api.onDidLocationChange(r=>{this.group===this.panel.group&&this._onDidLocationChange.fire(r)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&a!==this.isGroupActive&&(a=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class ja extends Ae{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return(e=this._renderer)!==null&&e!==void 0?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,i,a,r,c,d,h,f){super(),this.id=e,this.accessor=r,this.containerApi=c,this.view=h,this._renderer=f.renderer,this._group=d,this._minimumWidth=f.minimumWidth,this._minimumHeight=f.minimumHeight,this._maximumWidth=f.maximumWidth,this._maximumHeight=f.maximumHeight,this.api=new xk(this,this._group,r,i,a),this.addDisposables(this.api.onActiveChange(()=>{r.setActivePanel(this)}),this.api.onDidSizeChange(p=>{this.group.api.setSize(p)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new gS;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var i;this._params=Object.assign(Object.assign({},(i=this._params)!==null&&i!==void 0?i:{}),e.params);for(const a of Object.keys(e.params))e.params[a]===void 0&&delete this._params[a];this.view.update({params:this._params})}updateFromStateModel(e){var i,a,r;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:(i=e.params)!==null&&i!==void 0?i:{}}),this.setTitle((a=e.title)!==null&&a!==void 0?a:this.id),this.setRenderer((r=e.renderer)!==null&&r!==void 0?r:this.accessor.renderer)}updateParentGroup(e,i){this._group=e,this.api.group=this._group;const a=this._group.model.isPanelActive(this),r=this.group.api.isActive&&a;i?.skipSetActive||this.api.isActive!==r&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&a}),this.api.isVisible!==a&&this.api._onDidVisibilityChange.fire({isVisible:a})}runEvents(){const e=this._group.model.isPanelActive(this),i=this.group.api.isActive&&e;this.api.isActive!==i&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,i){this.api._onDidDimensionChange.fire({width:e,height:i}),this.view.layout(e,i)}dispose(){this.api.dispose(),this.view.dispose()}}class Pb extends Ae{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(rk()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(i=>{this._title=i.title,this.render()}),Pe(this.action,"pointerdown",i=>{i.preventDefault()}),Pe(this.action,"click",i=>{i.defaultPrevented||(i.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=(e=this._title)!==null&&e!==void 0?e:"")}}class _S{get content(){return this._content}get tab(){return this._tab}constructor(e,i,a,r){this.accessor=e,this.id=i,this.contentComponent=a,this.tabComponent=r,this._content=this.createContentComponent(this.id,a),this._tab=this.createTabComponent(this.id,r)}createTabRenderer(e){var i;const a=this.createTabComponent(this.id,this.tabComponent);return this._params&&a.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&((i=a.update)===null||i===void 0||i.call(a,this._updateEvent)),a}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}layout(e,i){var a,r;(r=(a=this.content).layout)===null||r===void 0||r.call(a,e,i)}update(e){var i,a,r,c;this._updateEvent=e,(a=(i=this.content).update)===null||a===void 0||a.call(i,e),(c=(r=this.tab).update)===null||c===void 0||c.call(r,e)}dispose(){var e,i,a,r;(i=(e=this.content).dispose)===null||i===void 0||i.call(e),(r=(a=this.tab).dispose)===null||r===void 0||r.call(a)}createContentComponent(e,i){return this.accessor.options.createComponent({id:e,name:i})}createTabComponent(e,i){const a=i??this.accessor.options.defaultTabComponent;if(a){if(this.accessor.options.createTabComponent){const r=this.accessor.options.createTabComponent({id:e,name:a});return r||new Pb}console.warn(`dockview: tabComponent '${i}' was not found. falling back to the default tab.`)}return new Pb}}class wk{constructor(e){this.accessor=e}fromJSON(e,i){var a,r;const c=e.id,d=e.params,h=e.title,f=e.view,p=f?f.content.id:(a=e.contentComponent)!==null&&a!==void 0?a:"unknown",y=f?(r=f.tab)===null||r===void 0?void 0:r.id:e.tabComponent,b=new _S(this.accessor,c,p,y),x=new ja(c,p,y,this.accessor,new pc(this.accessor),i,b,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return x.init({title:h??c,params:d??{}}),x}}class Sk extends Ae{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}class Ck{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(i=>i!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(i=>i!==e),this.update()}update(){for(let e=0;e<this._orderedList.length;e++)this._orderedList[e].setAttribute("aria-level",`${e}`),this._orderedList[e].style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${e*2})`}}const Ll=new Ck;let um=class js extends Ae{set minimumInViewportWidth(e){this.options.minimumInViewportWidth=e}set minimumInViewportHeight(e){this.options.minimumInViewportHeight=e}get element(){return this._element}get isVisible(){return this._isVisible}constructor(e){super(),this.options=e,this._element=document.createElement("div"),this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onDidChangeEnd=new ie,this.onDidChangeEnd=this._onDidChangeEnd.event,this.addDisposables(this._onDidChange,this._onDidChangeEnd),this._element.className="dv-resize-container",this._isVisible=!0,this.setupResize("top"),this.setupResize("bottom"),this.setupResize("left"),this.setupResize("right"),this.setupResize("topleft"),this.setupResize("topright"),this.setupResize("bottomleft"),this.setupResize("bottomright"),this._element.appendChild(this.options.content),this.options.container.appendChild(this._element),this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({height:this.options.height,width:this.options.width},"top"in this.options&&{top:this.options.top}),"bottom"in this.options&&{bottom:this.options.bottom}),"left"in this.options&&{left:this.options.left}),"right"in this.options&&{right:this.options.right})),Ll.push(this._element)}setVisible(e){e!==this.isVisible&&(this._isVisible=e,Ee(this.element,"dv-hidden",!this.isVisible))}bringToFront(){Ll.push(this._element)}setBounds(e={}){typeof e.height=="number"&&(this._element.style.height=`${e.height}px`),typeof e.width=="number"&&(this._element.style.width=`${e.width}px`),"top"in e&&typeof e.top=="number"&&(this._element.style.top=`${e.top}px`,this._element.style.bottom="auto",this.verticalAlignment="top"),"bottom"in e&&typeof e.bottom=="number"&&(this._element.style.bottom=`${e.bottom}px`,this._element.style.top="auto",this.verticalAlignment="bottom"),"left"in e&&typeof e.left=="number"&&(this._element.style.left=`${e.left}px`,this._element.style.right="auto",this.horiziontalAlignment="left"),"right"in e&&typeof e.right=="number"&&(this._element.style.right=`${e.right}px`,this._element.style.left="auto",this.horiziontalAlignment="right");const i=this.options.container.getBoundingClientRect(),a=this._element.getBoundingClientRect(),r=Math.max(0,this.getMinimumWidth(a.width)),c=Math.max(0,this.getMinimumHeight(a.height));if(this.verticalAlignment==="top"){const d=st(a.top-i.top,-c,Math.max(0,i.height-a.height+c));this._element.style.top=`${d}px`,this._element.style.bottom="auto"}if(this.verticalAlignment==="bottom"){const d=st(i.bottom-a.bottom,-c,Math.max(0,i.height-a.height+c));this._element.style.bottom=`${d}px`,this._element.style.top="auto"}if(this.horiziontalAlignment==="left"){const d=st(a.left-i.left,-r,Math.max(0,i.width-a.width+r));this._element.style.left=`${d}px`,this._element.style.right="auto"}if(this.horiziontalAlignment==="right"){const d=st(i.right-a.right,-r,Math.max(0,i.width-a.width+r));this._element.style.right=`${d}px`,this._element.style.left="auto"}this._onDidChange.fire()}toJSON(){const e=this.options.container.getBoundingClientRect(),i=this._element.getBoundingClientRect(),a={};return this.verticalAlignment==="top"?a.top=parseFloat(this._element.style.top):this.verticalAlignment==="bottom"?a.bottom=parseFloat(this._element.style.bottom):a.top=i.top-e.top,this.horiziontalAlignment==="left"?a.left=parseFloat(this._element.style.left):this.horiziontalAlignment==="right"?a.right=parseFloat(this._element.style.right):a.left=i.left-e.left,a.width=i.width,a.height=i.height,a}setupDrag(e,i={inDragMode:!1}){const a=new Pt,r=()=>{let c=null;const d=fc();a.value=new Ae({dispose:()=>{d.release()}},Pe(window,"pointermove",h=>{const f=this.options.container.getBoundingClientRect(),p=h.clientX-f.left,y=h.clientY-f.top;Ee(this._element,"dv-resize-container-dragging",!0);const b=this._element.getBoundingClientRect();c===null&&(c={x:h.clientX-b.left,y:h.clientY-b.top});const x=Math.max(0,this.getMinimumWidth(b.width)),w=Math.max(0,this.getMinimumHeight(b.height)),E=st(y-c.y,-w,Math.max(0,f.height-b.height+w)),C=st(c.y-y+f.height-b.height,-w,Math.max(0,f.height-b.height+w)),S=st(p-c.x,-x,Math.max(0,f.width-b.width+x)),D=st(c.x-p+f.width-b.width,-x,Math.max(0,f.width-b.width+x)),N={};E<=C?N.top=E:N.bottom=C,S<=D?N.left=S:N.right=D,this.setBounds(N)}),Pe(window,"pointerup",()=>{Ee(this._element,"dv-resize-container-dragging",!1),a.dispose(),this._onDidChangeEnd.fire()}))};this.addDisposables(a,Pe(e,"pointerdown",c=>{if(c.defaultPrevented){c.preventDefault();return}Rb(c)||r()}),Pe(this.options.content,"pointerdown",c=>{c.defaultPrevented||Rb(c)||c.shiftKey&&r()}),Pe(this.options.content,"pointerdown",()=>{Ll.push(this._element)},!0)),i.inDragMode&&r()}setupResize(e){const i=document.createElement("div");i.className=`dv-resize-handle-${e}`,this._element.appendChild(i);const a=new Pt;this.addDisposables(a,Pe(i,"pointerdown",r=>{r.preventDefault();let c=null;const d=fc();a.value=new Ae(Pe(window,"pointermove",h=>{const f=this.options.container.getBoundingClientRect(),p=this._element.getBoundingClientRect(),y=h.clientY-f.top,b=h.clientX-f.left;c===null&&(c={originalY:y,originalHeight:p.height,originalX:b,originalWidth:p.width});let x,w,E,C,S,D;const N=()=>{const O=c.originalY+c.originalHeight>f.height?Math.max(0,f.height-js.MINIMUM_HEIGHT):Math.max(0,c.originalY+c.originalHeight-js.MINIMUM_HEIGHT);x=st(y,0,O),E=c.originalY+c.originalHeight-x,w=f.height-x-E},k=()=>{x=c.originalY-c.originalHeight;const O=x<0&&typeof this.options.minimumInViewportHeight=="number"?-x+this.options.minimumInViewportHeight:js.MINIMUM_HEIGHT,A=f.height-Math.max(0,x);E=st(y-x,O,A),w=f.height-x-E},T=()=>{const O=c.originalX+c.originalWidth>f.width?Math.max(0,f.width-js.MINIMUM_WIDTH):Math.max(0,c.originalX+c.originalWidth-js.MINIMUM_WIDTH);C=st(b,0,O),D=c.originalX+c.originalWidth-C,S=f.width-C-D},R=()=>{C=c.originalX-c.originalWidth;const O=C<0&&typeof this.options.minimumInViewportWidth=="number"?-C+this.options.minimumInViewportWidth:js.MINIMUM_WIDTH,A=f.width-Math.max(0,C);D=st(b-C,O,A),S=f.width-C-D};switch(e){case"top":N();break;case"bottom":k();break;case"left":T();break;case"right":R();break;case"topleft":N(),T();break;case"topright":N(),R();break;case"bottomleft":k(),T();break;case"bottomright":k(),R();break}const z={};x<=w?z.top=x:z.bottom=w,C<=S?z.left=C:z.right=S,z.height=E,z.width=D,this.setBounds(z)}),{dispose:()=>{d.release()}},Pe(window,"pointerup",()=>{a.dispose(),this._onDidChangeEnd.fire()}))}))}getMinimumWidth(e){return typeof this.options.minimumInViewportWidth=="number"?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return typeof this.options.minimumInViewportHeight=="number"?e-this.options.minimumInViewportHeight:0}dispose(){Ll.destroy(this._element),this._element.remove(),super.dispose()}};um.MINIMUM_HEIGHT=20;um.MINIMUM_WIDTH=20;class _k extends Ae{constructor(e,i){super(),this.group=e,this.overlay=i,this.addDisposables(i)}position(e){this.overlay.setBounds(e)}}const Il=100,Qi={left:100,top:100,width:300,height:300},Ek=100;class Dk{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const i=this.cache.get(e);if(i&&i.frameId===this.currentFrameId)return i.rect;this.scheduleFrameUpdate();const a=df(e);return this.cache.set(e,{rect:a,frameId:this.currentFrameId}),a}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}function Ak(){const n=document.createElement("div");return n.tabIndex=-1,n}class Lb extends Ae{constructor(e,i){super(),this.element=e,this.accessor=i,this.map={},this._disposed=!1,this.positionCache=new Dk,this.pendingUpdates=new Set,this.addDisposables(yt.from(()=>{for(const a of Object.values(this.map))a.disposable.dispose(),a.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:i,destroy:a}=this.map[e.api.id];return i.dispose(),a.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:i,referenceContainer:a}=e;if(!this.map[i.api.id]){const y=Ak();y.className="dv-render-overlay",this.map[i.api.id]={panel:i,disposable:yt.NONE,destroy:yt.NONE,element:y}}const r=this.map[i.api.id].element;i.view.content.element.parentElement!==r&&r.appendChild(i.view.content.element),r.parentElement!==this.element&&this.element.appendChild(r);const c=()=>{const y=i.api.id;this.pendingUpdates.has(y)||(this.pendingUpdates.add(y),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(y),this.isDisposed||!this.map[y])return;const b=this.positionCache.getPosition(a.element),x=this.positionCache.getPosition(this.element),w=b.left-x.left,E=b.top-x.top,C=b.width,S=b.height;r.style.left=`${w}px`,r.style.top=`${E}px`,r.style.width=`${C}px`,r.style.height=`${S}px`,Ee(r,"dv-render-overlay-float",i.group.api.location.type==="floating")}))},d=()=>{i.api.isVisible&&(this.positionCache.invalidate(),c()),r.style.display=i.api.isVisible?"":"none"},h=new Pt,f=()=>{i.api.location.type==="floating"?queueMicrotask(()=>{const y=this.accessor.floatingGroups.find(E=>E.group===i.api.group);if(!y)return;const b=y.overlay.element,x=()=>{const E=Number(b.getAttribute("aria-level"));r.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${E*2+1})`},w=new MutationObserver(()=>{x()});h.value=yt.from(()=>w.disconnect()),w.observe(b,{attributeFilter:["aria-level"],attributes:!0}),x()}):r.style.zIndex=""},p=new Ae(h,new pS(r,{onDragEnd:y=>{a.dropTarget.dnd.onDragEnd(y)},onDragEnter:y=>{a.dropTarget.dnd.onDragEnter(y)},onDragLeave:y=>{a.dropTarget.dnd.onDragLeave(y)},onDrop:y=>{a.dropTarget.dnd.onDrop(y)},onDragOver:y=>{a.dropTarget.dnd.onDragOver(y)}}),i.api.onDidVisibilityChange(()=>{d()}),i.api.onDidDimensionsChange(()=>{i.api.isVisible&&c()}),i.api.onDidLocationChange(()=>{f()}));return this.map[i.api.id].destroy=yt.from(()=>{var y;i.view.content.element.parentElement===r&&r.removeChild(i.view.content.element),(y=r.parentElement)===null||y===void 0||y.removeChild(r)}),f(),queueMicrotask(()=>{this.isDisposed||d()}),this.map[i.api.id].disposable.dispose(),this.map[i.api.id].disposable=p,this.map[i.api.id].resize=c,r}}var Nk=function(n,e,i,a){function r(c){return c instanceof i?c:new i(function(d){d(c)})}return new(i||(i=Promise))(function(c,d){function h(y){try{p(a.next(y))}catch(b){d(b)}}function f(y){try{p(a.throw(y))}catch(b){d(b)}}function p(y){y.done?c(y.value):r(y.value).then(h,f)}p((a=a.apply(n,e||[])).next())})};class jk extends Ae{get window(){var e,i;return(i=(e=this._window)===null||e===void 0?void 0:e.value)!==null&&i!==void 0?i:null}constructor(e,i,a){super(),this.target=e,this.className=i,this.options=a,this._onWillClose=new ie,this.onWillClose=this._onWillClose.event,this._onDidClose=new ie,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX,i=this._window.value.screenY,a=this._window.value.innerWidth,r=this._window.value.innerHeight;return{top:i,left:e,width:a,height:r}}close(){var e,i;this._window&&(this._onWillClose.fire(),(i=(e=this.options).onWillClose)===null||i===void 0||i.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){var e,i;return Nk(this,void 0,void 0,function*(){if(this._window)throw new Error("instance of popout window is already open");const a=`${this.options.url}`,r=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([f,p])=>`${f}=${p}`).join(","),c=window.open(a,this.target,r);if(!c)return null;const d=new Ae;this._window={value:c,disposable:d},d.addDisposables(yt.from(()=>{c.close()}),Pe(window,"beforeunload",()=>{this.close()}));const h=this.createPopoutWindowContainer();return this.className&&h.classList.add(this.className),(i=(e=this.options).onDidOpen)===null||i===void 0||i.call(e,{id:this.target,window:c}),new Promise((f,p)=>{c.addEventListener("unload",y=>{}),c.addEventListener("load",()=>{try{const y=c.document;y.title=document.title,y.body.appendChild(h),ST(y,window.document.styleSheets),Pe(c,"beforeunload",()=>{this.close()}),f(h)}catch(y){p(y)}})})})}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class Tk extends Ae{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,i=new Set;this.addDisposables(this.accessor.onDidAddPanel(a=>{if(e.has(a.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${a.api.id} but panel already exists`);e.add(a.api.id)}),this.accessor.onDidRemovePanel(a=>{if(e.has(a.api.id))e.delete(a.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${a.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(a=>{if(i.has(a.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${a.api.id} but group already exists`);i.add(a.api.id)}),this.accessor.onDidRemoveGroup(a=>{if(i.has(a.api.id))i.delete(a.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${a.api.id} but group does not exists`)}))}}class kk extends Ae{constructor(e){super(),this.root=e,this._active=null,this._activeDisposable=new Pt,this._element=document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this.root.prepend(this._element),this.addDisposables(yt.from(()=>{this.close()}),this._activeDisposable)}openPopover(e,i){var a;this.close();const r=document.createElement("div");r.style.position="absolute",r.style.zIndex=(a=i.zIndex)!==null&&a!==void 0?a:"var(--dv-overlay-z-index)",r.appendChild(e);const c=this._element.getBoundingClientRect(),d=c.left,h=c.top;r.style.top=`${i.y-h}px`,r.style.left=`${i.x-d}px`,this._element.appendChild(r),this._active=r,this._activeDisposable.value=new Ae(Pe(window,"pointerdown",f=>{var p;const y=f.target;if(!(y instanceof HTMLElement))return;let b=y;for(;b&&b!==r;)b=(p=b?.parentElement)!==null&&p!==void 0?p:null;b||this.close()})),requestAnimationFrame(()=>{TT(r,this.root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class Ib extends Ae{get disabled(){return this._disabled}set disabled(e){var i;this.disabled!==e&&(this._disabled=e,e&&((i=this.model)===null||i===void 0||i.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&((e=this._model.root.parentElement)===null||e===void 0||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,i)=>{const a=this._outline!==i;if(this._outline=i,this._model)return this._model.changed=a,this._model;const r=this.createContainer(),c=this.createAnchor();if(this._model={root:r,overlay:c,changed:a},r.appendChild(c),this.element.appendChild(r),e?.target instanceof HTMLElement){const d=e.target.getBoundingClientRect(),h=this.element.getBoundingClientRect();c.style.left=`${d.left-h.left}px`,c.style.top=`${d.top-h.top}px`}return this._model}}}constructor(e,i){super(),this.element=e,this._disabled=!1,this._disabled=i.disabled,this.addDisposables(yt.from(()=>{var a;(a=this.model)===null||a===void 0||a.clear()}))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}const Gb={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};function Gl(n){const e=n.from.activePanel;[...n.from.panels].map(a=>{const r=n.from.model.removePanel(a);return n.from.model.renderContainer.detatch(a),r}).forEach(a=>{n.to.model.openPanel(a,{skipSetActive:e!==a,skipSetGroupActive:!0})})}class Rk extends hS{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return(e=this.options.defaultRenderer)!==null&&e!==void 0?e:"onlyWhenVisible"}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(e,i){var a,r,c;super(e,{proportionalLayout:!0,orientation:be.HORIZONTAL,styles:i.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:i.disableAutoResizing,locked:i.locked,margin:(r=(a=i.theme)===null||a===void 0?void 0:a.gap)!==null&&r!==void 0?r:0,className:i.className}),this.nextGroupId=im(),this._deserializer=new wk(this),this._watermark=null,this._onWillDragPanel=new ie,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new ie,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new ie,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new ie,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new ie,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new ie,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new ie,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new ie,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new ie,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new ie,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new ie,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new ie,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new ie({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new ie,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidMaximizedGroupChange=new ie,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new ie,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new ie,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new ie,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new ie,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=i,this.popupService=new kk(this.element),this._themeClassnames=new Pc(this.element),this._api=new pc(this),this.rootDropTargetContainer=new Ib(this.element,{disabled:!0}),this.overlayRenderContainer=new Lb(this.gridview.element,this),this._rootDropTarget=new zn(this.element,{className:"dv-drop-target-edge",canDisplayOverlay:(d,h)=>{const f=zt();if(f)return f.viewId!==this.id?!1:h==="center"?this.gridview.length===0:!0;if(h==="center"&&this.gridview.length!==0)return!1;const p=new wS(d,"edge",h,zt);return this._onUnhandledDragOverEvent.fire(p),p.isAccepted},acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:(c=i.rootOverlayModel)!==null&&c!==void 0?c:Gb,getOverrideTarget:()=>{var d;return(d=this.rootDropTargetContainer)===null||d===void 0?void 0:d.model}}),this.updateDropTargetModel(i),Ee(this.gridview.element,"dv-dockview",!0),Ee(this.element,"dv-debug",!!i.debug),this.updateTheme(),this.updateWatermark(),i.debug&&this.addDisposables(new Tk(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.updateWatermark()}),this.onDidAdd(d=>{this._moving||this._onDidAddGroup.fire(d)}),this.onDidRemove(d=>{this._moving||this._onDidRemoveGroup.fire(d)}),this.onDidActiveChange(d=>{this._moving||this._onDidActiveGroupChange.fire(d)}),this.onDidMaximizedChange(d=>{this._onDidMaximizedGroupChange.fire({group:d.panel,isMaximized:d.isMaximized})}),Rs.any(this.onDidAdd,this.onDidRemove)(()=>{this.updateWatermark()}),Rs.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange)(()=>{this._bufferOnDidLayoutChange.fire()}),yt.from(()=>{for(const d of[...this._floatingGroups])d.dispose();for(const d of[...this._popoutGroups])d.disposable.dispose()}),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay(d=>{this.gridview.length>0&&d.position==="center"||this._onWillShowOverlay.fire(new Lc(d,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:zt}))}),this._rootDropTarget.onDrop(d=>{var h;const f=new SS({nativeEvent:d.nativeEvent,position:d.position,panel:void 0,api:this._api,group:void 0,getData:zt,kind:"edge"});if(this._onWillDrop.fire(f),f.defaultPrevented)return;const p=zt();p?this.moveGroupOrPanel({from:{groupId:p.groupId,panelId:(h=p.panelId)!==null&&h!==void 0?h:void 0},to:{group:this.orthogonalize(d.position),position:"center"}}):this._onDidDrop.fire(new lm({nativeEvent:d.nativeEvent,position:d.position,panel:void 0,api:this._api,group:void 0,getData:zt}))}),this._rootDropTarget)}setVisible(e,i){switch(e.api.location.type){case"grid":super.setVisible(e,i);break;case"floating":{const a=this.floatingGroups.find(r=>r.group===e);a&&(a.overlay.setVisible(i),e.api._onDidVisibilityChange.fire({isVisible:i}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window");break}}addPopoutGroup(e,i){var a,r,c,d,h;if(e instanceof ja&&e.group.size===1)return this.addPopoutGroup(e.group,i);const f=DT(this.gridview.element),p=this.element;function y(){return i?.position?i.position:e instanceof Mb?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():p.getBoundingClientRect()}const b=y(),x=(r=(a=i?.overridePopoutGroup)===null||a===void 0?void 0:a.id)!==null&&r!==void 0?r:this.getNextGroupId(),w=new jk(`${this.id}-${x}`,f??"",{url:(h=(c=i?.popoutUrl)!==null&&c!==void 0?c:(d=this.options)===null||d===void 0?void 0:d.popoutUrl)!==null&&h!==void 0?h:"/popout.html",left:window.screenX+b.left,top:window.screenY+b.top,width:b.width,height:b.height,onDidOpen:i?.onDidOpen,onWillClose:i?.onWillClose}),E=new Ae(w,w.onDidClose(()=>{E.dispose()}));return w.open().then(C=>{var S;if(w.isDisposed)return!1;const D=i?.referenceGroup?i.referenceGroup:e instanceof ja?e.group:e,N=e.api.location.type,k=D.element.parentElement!==null;let T;if(k?i?.overridePopoutGroup?T=i.overridePopoutGroup:(T=this.createGroup({id:x}),C&&this._onDidAddGroup.fire(T)):T=D,C===null)return console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),E.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock(()=>Gl({from:T,to:D})),D.api.isVisible||D.api.setVisible(!0),!1;const R=document.createElement("div");R.className="dv-overlay-render-container";const z=new Lb(R,this);T.model.renderContainer=z,T.layout(w.window.innerWidth,w.window.innerHeight);let O;if(!i?.overridePopoutGroup&&k)if(e instanceof ja)this.movingLock(()=>{const ne=D.model.removePanel(e);T.model.openPanel(ne)});else switch(this.movingLock(()=>Gl({from:D,to:T})),N){case"grid":D.api.setVisible(!1);break;case"floating":case"popout":O=(S=this._floatingGroups.find(ne=>ne.group.api.id===e.api.id))===null||S===void 0?void 0:S.overlay.toJSON(),this.removeGroup(D);break}C.classList.add("dv-dockview"),C.style.overflow="hidden",C.appendChild(R),C.appendChild(T.element);const A=document.createElement("div"),G=new Ib(A,{disabled:this.rootDropTargetContainer.disabled});C.appendChild(A),T.model.dropTargetContainer=G,T.model.location={type:"popout",getWindow:()=>w.window,popoutUrl:i?.popoutUrl},k&&e.api.location.type==="grid"&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(T),E.addDisposables(T.api.onDidActiveChange(ne=>{var W;ne.isActive&&((W=w.window)===null||W===void 0||W.focus())}),T.api.onWillFocus(()=>{var ne;(ne=w.window)===null||ne===void 0||ne.focus()}));let U;const B=k&&D&&this.getPanel(D.id),$={window:w,popoutGroup:T,referenceGroup:B?D.id:void 0,disposable:{dispose:()=>(E.dispose(),U)}},ae=NT(w.window);return E.addDisposables(ae,jT(w.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:w.window.innerWidth,height:w.window.innerHeight,group:T})}),ae.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:w.window.screenX,screenY:w.window.screenX,group:T})}),Pe(w.window,"resize",()=>{T.layout(w.window.innerWidth,w.window.innerHeight)}),z,yt.from(()=>{if(!this.isDisposed){if(k&&this.getPanel(D.id))this.movingLock(()=>Gl({from:T,to:D})),D.api.isVisible||D.api.setVisible(!0),this.getPanel(T.id)&&this.doRemoveGroup(T,{skipPopoutAssociated:!0});else if(this.getPanel(T.id)){if(T.model.renderContainer=this.overlayRenderContainer,T.model.dropTargetContainer=this.rootDropTargetContainer,U=T,!this._popoutGroups.find(W=>W.popoutGroup===T))return;O?this.addFloatingGroup(T,{height:O.height,width:O.width,position:O}):(this.doRemoveGroup(T,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),T.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(T,[0])})),this.doSetGroupAndPanelActive(T)}}})),this._popoutGroups.push($),this.updateWatermark(),!0}).catch(C=>(console.error("dockview: failed to create popout.",C),!1))}addFloatingGroup(e,i){var a,r,c,d,h;let f;if(e instanceof ja)f=this.createGroup(),this._onDidAddGroup.fire(f),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>f.model.openPanel(e,{skipSetGroupActive:!0}));else{f=e;const C=(a=this._popoutGroups.find(N=>N.popoutGroup===f))===null||a===void 0?void 0:a.referenceGroup,S=C?this.getPanel(C):void 0;typeof i?.skipRemoveGroup=="boolean"&&i.skipRemoveGroup||(S?(this.movingLock(()=>Gl({from:e,to:S})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(S,{skipDispose:!0}),f=S):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function p(){if(i?.position){const C={};return"left"in i.position?C.left=Math.max(i.position.left,0):"right"in i.position?C.right=Math.max(i.position.right,0):C.left=Qi.left,"top"in i.position?C.top=Math.max(i.position.top,0):"bottom"in i.position?C.bottom=Math.max(i.position.bottom,0):C.top=Qi.top,typeof i.width=="number"?C.width=Math.max(i.width,0):C.width=Qi.width,typeof i.height=="number"?C.height=Math.max(i.height,0):C.height=Qi.height,C}return{left:typeof i?.x=="number"?Math.max(i.x,0):Qi.left,top:typeof i?.y=="number"?Math.max(i.y,0):Qi.top,width:typeof i?.width=="number"?Math.max(i.width,0):Qi.width,height:typeof i?.height=="number"?Math.max(i.height,0):Qi.height}}const y=p(),b=new um(Object.assign(Object.assign({container:this.gridview.element,content:f.element},y),{minimumInViewportWidth:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(c=(r=this.options.floatingGroupBounds)===null||r===void 0?void 0:r.minimumWidthWithinViewport)!==null&&c!==void 0?c:Il,minimumInViewportHeight:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(h=(d=this.options.floatingGroupBounds)===null||d===void 0?void 0:d.minimumHeightWithinViewport)!==null&&h!==void 0?h:Il})),x=f.element.querySelector(".dv-void-container");if(!x)throw new Error("dockview: failed to find drag handle");b.setupDrag(x,{inDragMode:typeof i?.inDragMode=="boolean"?i.inDragMode:!1});const w=new _k(f,b),E=new Ae(f.api.onDidActiveChange(C=>{C.isActive&&b.bringToFront()}),zc(f.element,C=>{const{width:S,height:D}=C.contentRect;f.layout(S,D)}));w.addDisposables(b.onDidChange(()=>{f.layout(f.width,f.height)}),b.onDidChangeEnd(()=>{this._bufferOnDidLayoutChange.fire()}),f.onDidChange(C=>{b.setBounds({height:C?.height,width:C?.width})}),{dispose:()=>{E.dispose(),zh(this._floatingGroups,w),f.model.location={type:"grid"},this.updateWatermark()}}),this._floatingGroups.push(w),f.model.location={type:"floating"},i?.skipActiveGroup||this.doSetGroupAndPanelActive(f),this.updateWatermark()}orthogonalize(e,i){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===be.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===be.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,i);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,i);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var i,a;if(super.updateOptions(e),"floatingGroupBounds"in e)for(const d of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":d.overlay.minimumInViewportHeight=void 0,d.overlay.minimumInViewportWidth=void 0;break;case void 0:d.overlay.minimumInViewportHeight=Il,d.overlay.minimumInViewportWidth=Il;break;default:d.overlay.minimumInViewportHeight=(i=e.floatingGroupBounds)===null||i===void 0?void 0:i.minimumHeightWithinViewport,d.overlay.minimumInViewportWidth=(a=e.floatingGroupBounds)===null||a===void 0?void 0:a.minimumWidthWithinViewport}d.overlay.setBounds()}this.updateDropTargetModel(e);const r=this.options.disableDnd;this._options=Object.assign(Object.assign({},this.options),e);const c=this.options.disableDnd;r!==c&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),this.layout(this.gridview.width,this.gridview.height,!0)}layout(e,i,a){if(super.layout(e,i,a),this._floatingGroups)for(const r of this._floatingGroups)r.overlay.setBounds()}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}getGroupPanel(e){return this.panels.find(i=>i.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var i;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1]){e.group.model.moveToNext({suppressRoll:!0});return}const a=ot(e.group.element),r=(i=this.gridview.next(a))===null||i===void 0?void 0:i.view;this.doSetGroupAndPanelActive(r)}moveToPrevious(e={}){var i;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0]){e.group.model.moveToPrevious({suppressRoll:!0});return}const a=ot(e.group.element),r=(i=this.gridview.previous(a))===null||i===void 0?void 0:i.view;r&&this.doSetGroupAndPanelActive(r)}toJSON(){var e;const i=this.gridview.serialize(),a=this.panels.reduce((h,f)=>(h[f.id]=f.toJSON(),h),{}),r=this._floatingGroups.map(h=>({data:h.group.toJSON(),position:h.overlay.toJSON()})),c=this._popoutGroups.map(h=>({data:h.popoutGroup.toJSON(),gridReferenceGroup:h.referenceGroup,position:h.window.dimensions(),url:h.popoutGroup.api.location.type==="popout"?h.popoutGroup.api.location.popoutUrl:void 0})),d={grid:i,panels:a,activeGroup:(e=this.activeGroup)===null||e===void 0?void 0:e.id};return r.length>0&&(d.floatingGroups=r),c.length>0&&(d.popoutGroups=c),d}fromJSON(e,i){var a,r;const c=new Map;let d;if(i?.reuseExistingPanels){d=this.createGroup(),this._groups.delete(d.api.id);const y=Object.keys(e.panels);for(const b of this.panels)y.includes(b.api.id)&&c.set(b.api.id,b);this.movingLock(()=>{Array.from(c.values()).forEach(b=>{this.moveGroupOrPanel({from:{groupId:b.api.group.api.id,panelId:b.api.id},to:{group:d,position:"center"},keepEmptyGroups:!0})})})}if(this.clear(),typeof e!="object"||e===null)throw new Error("dockview: serialized layout must be a non-null object");const{grid:h,panels:f,activeGroup:p}=e;if(h.root.type!=="branch"||!Array.isArray(h.root.data))throw new Error("dockview: root must be of type branch");try{const y=this.width,b=this.height,x=S=>{const{id:D,locked:N,hideHeader:k,views:T,activeView:R}=S;if(typeof D!="string")throw new Error("dockview: group id must be of type string");const z=this.createGroup({id:D,locked:!!N,hideHeader:!!k});this._onDidAddGroup.fire(z);const O=[];for(const A of T){const G=c.get(A);if(d&&G)this.movingLock(()=>{d.model.removePanel(G)}),O.push(G),G.updateFromStateModel(f[A]);else{const U=this._deserializer.fromJSON(f[A],z);O.push(U)}}for(let A=0;A<T.length;A++){const G=O[A],U=typeof R=="string"&&R===G.id;c.has(G.api.id)?this.movingLock(()=>{z.model.openPanel(G,{skipSetActive:!U,skipSetGroupActive:!0})}):z.model.openPanel(G,{skipSetActive:!U,skipSetGroupActive:!0})}return!z.activePanel&&z.panels.length>0&&z.model.openPanel(z.panels[z.panels.length-1],{skipSetGroupActive:!0}),z};this.gridview.deserialize(h,{fromJSON:S=>x(S.data)}),this.layout(y,b,!0);const w=(a=e.floatingGroups)!==null&&a!==void 0?a:[];for(const S of w){const{data:D,position:N}=S,k=x(D);this.addFloatingGroup(k,{position:N,width:N.width,height:N.height,skipRemoveGroup:!0,inDragMode:!1})}const E=(r=e.popoutGroups)!==null&&r!==void 0?r:[],C=[];E.forEach((S,D)=>{const{data:N,position:k,gridReferenceGroup:T,url:R}=S,z=x(N),O=new Promise(A=>{setTimeout(()=>{this.addPopoutGroup(z,{position:k??void 0,overridePopoutGroup:T?z:void 0,referenceGroup:T?this.getPanel(T):void 0,popoutUrl:R}),A()},D*Ek)});C.push(O)}),this._popoutRestorationPromise=Promise.all(C).then(()=>{});for(const S of this._floatingGroups)S.overlay.setBounds();if(typeof p=="string"){const S=this.getPanel(p);S&&this.doSetGroupAndPanelActive(S)}}catch(y){console.error("dockview: failed to deserialize layout. Reverting changes",y);for(const b of this.groups)for(const x of b.panels)this.removePanel(x,{removeEmptyGroup:!1,skipDispose:!1});for(const b of this.groups)b.dispose(),this._groups.delete(b.id),this._onDidRemoveGroup.fire(b);for(const b of[...this._floatingGroups])b.dispose();throw this.clear(),y}this.updateWatermark(),this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}clear(){const e=Array.from(this._groups.values()).map(a=>a.value),i=!!this.activeGroup;for(const a of e)this.removeGroup(a,{skipActive:!0});i&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(const e of this._groups.entries()){const[i,a]=e;a.value.model.closeAllPanels()}}addPanel(e){var i,a;if(this.panels.find(f=>f.id===e.id))throw new Error(`dockview: panel with id ${e.id} already exists`);let r;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const c={width:e.initialWidth,height:e.initialHeight};let d;if(e.position)if(dk(e.position)){const f=typeof e.position.referencePanel=="string"?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(d=e.position.index,!f)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);r=this.findGroup(f)}else if(hk(e.position)){if(r=typeof e.position.referenceGroup=="string"?(i=this._groups.get(e.position.referenceGroup))===null||i===void 0?void 0:i.value:e.position.referenceGroup,d=e.position.index,!r)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else{const f=this.orthogonalize(zb(e.position.direction)),p=this.createPanel(e,f);return f.model.openPanel(p,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d}),e.inactive||this.doSetGroupAndPanelActive(f),f.api.setSize({height:c?.height,width:c?.width}),p}else r=this.activeGroup;let h;if(r){const f=mc(((a=e.position)===null||a===void 0?void 0:a.direction)||"within");if(e.floating){const p=this.createGroup();this._onDidAddGroup.fire(p);const y=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(p,Object.assign(Object.assign({},y),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),h=this.createPanel(e,p),p.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d})}else if(r.api.location.type==="floating"||f==="center")h=this.createPanel(e,r),r.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d}),r.api.setSize({width:c?.width,height:c?.height}),e.inactive||this.doSetGroupAndPanelActive(r);else{const p=ot(r.element),y=$n(this.gridview.orientation,p,f),b=this.createGroupAtLocation(y,this.orientationAtLocation(y)===be.VERTICAL?c?.height:c?.width);h=this.createPanel(e,b),b.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d}),e.inactive||this.doSetGroupAndPanelActive(b)}}else if(e.floating){const f=this.createGroup();this._onDidAddGroup.fire(f);const p=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(f,Object.assign(Object.assign({},p),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),h=this.createPanel(e,f),f.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d})}else{const f=this.createGroupAtLocation([0],this.gridview.orientation===be.VERTICAL?c?.height:c?.width);h=this.createPanel(e,f),f.model.openPanel(h,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:d}),e.inactive||this.doSetGroupAndPanelActive(f)}return h}removePanel(e,i={removeEmptyGroup:!0}){const a=e.group;if(!a)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);a.model.removePanel(e,{skipSetActiveGroup:i.skipSetActiveGroup}),i.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),a.size===0&&i.removeEmptyGroup&&this.removeGroup(a,{skipActive:i.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new Sk}updateWatermark(){var e,i;if(this.groups.filter(a=>a.api.location.type==="grid"&&a.api.isVisible).length===0){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new pc(this)});const a=document.createElement("div");a.className="dv-watermark-container",_T(a,"watermark-component"),a.appendChild(this._watermark.element),this.gridview.element.appendChild(a)}}else this._watermark&&(this._watermark.element.parentElement.remove(),(i=(e=this._watermark).dispose)===null||i===void 0||i.call(e),this._watermark=null)}addGroup(e){var i;if(e){let a;if(fk(e)){const p=typeof e.referencePanel=="string"?this.panels.find(y=>y.id===e.referencePanel):e.referencePanel;if(!p)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(a=this.findGroup(p),!a)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else if(mk(e)){if(a=typeof e.referenceGroup=="string"?(i=this._groups.get(e.referenceGroup))===null||i===void 0?void 0:i.value:e.referenceGroup,!a)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}else{const p=this.orthogonalize(zb(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(p),p}const r=mc(e.direction||"within"),c=ot(a.element),d=$n(this.gridview.orientation,c,r),h=this.createGroup(e),f=this.getLocationOrientation(d)===be.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(h,d,f),e.skipSetActive||this.doSetGroupAndPanelActive(h),h}else{const a=this.createGroup(e);return this.doAddGroup(a),this.doSetGroupAndPanelActive(a),a}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===be.HORIZONTAL?be.HORIZONTAL:be.VERTICAL}removeGroup(e,i){this.doRemoveGroup(e,i)}doRemoveGroup(e,i){var a;const r=[...e.panels];if(!i?.skipDispose)for(const h of r)this.removePanel(h,{removeEmptyGroup:!1,skipDispose:(a=i?.skipDispose)!==null&&a!==void 0?a:!1});const c=this.activePanel;if(e.api.location.type==="floating"){const h=this._floatingGroups.find(f=>f.group===e);if(h){if(i?.skipDispose||(h.group.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)),zh(this._floatingGroups,h),h.dispose(),!i?.skipActive&&this._activeGroup===e){const f=Array.from(this._groups.values());this.doSetGroupAndPanelActive(f.length>0?f[0].value:void 0)}return h.group}throw new Error("dockview: failed to find floating group")}if(e.api.location.type==="popout"){const h=this._popoutGroups.find(f=>f.popoutGroup===e);if(h){if(!i?.skipDispose){if(!i?.skipPopoutAssociated){const p=h.referenceGroup?this.getPanel(h.referenceGroup):void 0;p&&p.panels.length===0&&this.removeGroup(p)}h.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}zh(this._popoutGroups,h);const f=h.disposable.dispose();if(!i?.skipPopoutReturn&&f&&(this.doAddGroup(f,[0]),this.doSetGroupAndPanelActive(f)),!i?.skipActive&&this._activeGroup===e){const p=Array.from(this._groups.values());this.doSetGroupAndPanelActive(p.length>0?p[0].value:void 0)}return this.updateWatermark(),h.popoutGroup}throw new Error("dockview: failed to find popout group")}const d=super.doRemoveGroup(e,i);return i?.skipActive||this.activePanel!==c&&this._onDidActivePanelChange.fire(this.activePanel),d}debouncedUpdateAllPositions(){this._updatePositionsFrameId!==void 0&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions()})}movingLock(e){const i=this._moving;try{return this._moving=!0,e()}finally{this._moving=i}}moveGroupOrPanel(e){var i;const a=e.to.group,r=e.from.groupId,c=e.from.panelId,d=e.to.position,h=e.to.index,f=r?(i=this._groups.get(r))===null||i===void 0?void 0:i.value:void 0;if(!f)throw new Error(`dockview: Failed to find group id ${r}`);if(c===void 0){this.moveGroup({from:{group:f},to:{group:a,position:d},skipSetActive:e.skipSetActive});return}if(!d||d==="center"){const p=this.movingLock(()=>f.model.removePanel(c,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!p)throw new Error(`dockview: No panel with id ${c}`);!e.keepEmptyGroups&&f.model.size===0&&this.doRemoveGroup(f,{skipActive:!0});const y=a.model.size===0;this.movingLock(()=>{var b;return a.model.openPanel(p,{index:h,skipSetActive:((b=e.skipSetActive)!==null&&b!==void 0?b:!1)&&!y,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(a),this._onDidMovePanel.fire({panel:p,from:f})}else{const p=ot(a.element),y=$n(this.gridview.orientation,p,d);if(f.size<2){const[b,x]=xi(y);if(f.api.location.type==="grid"){const S=ot(f.element),[D,N]=xi(S);if(uS(D,b)){this.gridview.moveView(D,N,x),this._onDidMovePanel.fire({panel:this.getGroupPanel(c),from:f});return}}if(f.api.location.type==="popout"){const S=this._popoutGroups.find(k=>k.popoutGroup===f),D=this.movingLock(()=>S.popoutGroup.model.removePanel(S.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(f,{skipActive:!0});const N=this.createGroupAtLocation(y);this.movingLock(()=>N.model.openPanel(D,{skipSetActive:!0})),this.doSetGroupAndPanelActive(N),this._onDidMovePanel.fire({panel:this.getGroupPanel(c),from:f});return}const w=this.movingLock(()=>this.doRemoveGroup(f,{skipActive:!0,skipDispose:!0})),E=ot(a.element),C=$n(this.gridview.orientation,E,d);this.movingLock(()=>this.doAddGroup(w,C)),this.doSetGroupAndPanelActive(w),this._onDidMovePanel.fire({panel:this.getGroupPanel(c),from:f})}else{const b=this.movingLock(()=>f.model.removePanel(c,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!b)throw new Error(`dockview: No panel with id ${c}`);const x=$n(this.gridview.orientation,p,d),w=this.createGroupAtLocation(x);this.movingLock(()=>w.model.openPanel(b,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(w),this._onDidMovePanel.fire({panel:b,from:f})}}}moveGroup(e){const i=e.from.group,a=e.to.group,r=e.to.position;if(r==="center"){const c=i.activePanel,d=this.movingLock(()=>[...i.panels].map(h=>i.model.removePanel(h.id,{skipSetActive:!0})));i?.model.size===0&&this.doRemoveGroup(i,{skipActive:!0}),this.movingLock(()=>{for(const h of d)a.model.openPanel(h,{skipSetActive:h!==c,skipSetGroupActive:!0})}),e.skipSetActive!==!0?this.doSetGroupAndPanelActive(a):this.activePanel||this.doSetGroupAndPanelActive(a)}else{switch(i.api.location.type){case"grid":this.gridview.removeView(ot(i.element));break;case"floating":{const c=this._floatingGroups.find(d=>d.group===i);if(!c)throw new Error("dockview: failed to find floating group");c.dispose();break}case"popout":{const c=this._popoutGroups.find(h=>h.popoutGroup===i);if(!c)throw new Error("dockview: failed to find popout group");const d=this._popoutGroups.indexOf(c);if(d>=0&&this._popoutGroups.splice(d,1),c.referenceGroup){const h=this.getPanel(c.referenceGroup);h&&!h.api.isVisible&&this.doRemoveGroup(h,{skipActive:!0})}c.window.dispose(),a.api.location.type==="grid"?(i.model.renderContainer=this.overlayRenderContainer,i.model.dropTargetContainer=this.rootDropTargetContainer,i.model.location={type:"grid"}):a.api.location.type==="floating"&&(i.model.renderContainer=this.overlayRenderContainer,i.model.dropTargetContainer=this.rootDropTargetContainer,i.model.location={type:"floating"});break}}if(a.api.location.type==="grid"){const c=ot(a.element),d=$n(this.gridview.orientation,c,r);let h;switch(this.gridview.orientation){case be.VERTICAL:h=c.length%2==0?i.api.width:i.api.height;break;case be.HORIZONTAL:h=c.length%2==0?i.api.height:i.api.width;break}this.gridview.addView(i,h,d)}else if(a.api.location.type==="floating"){const c=this._floatingGroups.find(d=>d.group===a);if(c){const d=c.overlay.toJSON();let h,f;"left"in d?h=d.left+50:"right"in d?h=Math.max(0,d.right-d.width-50):h=50,"top"in d?f=d.top+50:"bottom"in d?f=Math.max(0,d.bottom-d.height-50):f=50,this.addFloatingGroup(i,{height:d.height,width:d.width,position:{left:h,top:f}})}}}if(i.panels.forEach(c=>{this._onDidMovePanel.fire({panel:c,from:i})}),this.debouncedUpdateAllPositions(),e.skipSetActive===!1){const c=a??i;this.doSetGroupAndPanelActive(c)}}doSetGroupActive(e){super.doSetGroupActive(e);const i=this.activePanel;!this._moving&&i!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(i)}doSetGroupAndPanelActive(e){super.doSetGroupActive(e);const i=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),!this._moving&&i!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(i)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let i=e?.id;if(i&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${e?.id}. reassigning group id to avoid errors`),i=void 0),!i)for(i=this.nextGroupId.next();this._groups.has(i);)i=this.nextGroupId.next();const a=new Mb(this,i,e);if(a.init({params:{},accessor:this}),!this._groups.has(a.id)){const r=new Ae(a.model.onTabDragStart(c=>{this._onWillDragPanel.fire(c)}),a.model.onGroupDragStart(c=>{this._onWillDragGroup.fire(c)}),a.model.onMove(c=>{const{groupId:d,itemId:h,target:f,index:p}=c;this.moveGroupOrPanel({from:{groupId:d,panelId:h},to:{group:a,position:f,index:p}})}),a.model.onDidDrop(c=>{this._onDidDrop.fire(c)}),a.model.onWillDrop(c=>{this._onWillDrop.fire(c)}),a.model.onWillShowOverlay(c=>{if(this.options.disableDnd){c.preventDefault();return}this._onWillShowOverlay.fire(c)}),a.model.onUnhandledDragOverEvent(c=>{this._onUnhandledDragOverEvent.fire(c)}),a.model.onDidAddPanel(c=>{this._moving||this._onDidAddPanel.fire(c.panel)}),a.model.onDidRemovePanel(c=>{this._moving||this._onDidRemovePanel.fire(c.panel)}),a.model.onDidActivePanelChange(c=>{this._moving||c.panel===this.activePanel&&this._onDidActivePanelChange.value!==c.panel&&this._onDidActivePanelChange.fire(c.panel)}),Rs.any(a.model.onDidPanelTitleChange,a.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(a.id,{value:a,disposable:r})}return a.initialize(),a}createPanel(e,i){var a,r,c;const d=e.component,h=(a=e.tabComponent)!==null&&a!==void 0?a:this.options.defaultTabComponent,f=new _S(this,e.id,d,h),p=new ja(e.id,d,h,this,this._api,i,f,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return p.init({title:(r=e.title)!==null&&r!==void 0?r:e.id,params:(c=e?.params)!==null&&c!==void 0?c:{}}),p}createGroupAtLocation(e,i,a){const r=this.createGroup(a);return this.doAddGroup(r,e,i),r}findGroup(e){var i;return(i=Array.from(this._groups.values()).find(a=>a.value.model.containsPanel(e)))===null||i===void 0?void 0:i.value}orientationAtLocation(e){const i=this.gridview.orientation;return e.length%2==1?i:Wn(i)}updateDropTargetModel(e){"dndEdges"in e&&(this._rootDropTarget.disabled=typeof e.dndEdges=="boolean"&&e.dndEdges===!1,typeof e.dndEdges=="object"&&e.dndEdges!==null?this._rootDropTarget.setOverlayModel(e.dndEdges):this._rootDropTarget.setOverlayModel(Gb)),"rootOverlayModel"in e&&this.updateDropTargetModel({dndEdges:e.dndEdges})}updateTheme(){var e,i;const a=(e=this._options.theme)!==null&&e!==void 0?e:bk;this._themeClassnames.setClassNames(a.className),this.gridview.margin=(i=a.gap)!==null&&i!==void 0?i:0,a.dndOverlayMounting==="absolute"?this.rootDropTargetContainer.disabled=!1:this.rootDropTargetContainer.disabled=!0}}class Ok extends hS{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,i){var a;super(e,{proportionalLayout:(a=i.proportionalLayout)!==null&&a!==void 0?a:!0,orientation:i.orientation,styles:i.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:i.disableAutoResizing,className:i.className}),this._onDidLayoutfromJSON=new ie,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new ie,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new ie,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new ie,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=i,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(r=>{this._onDidAddGroup.fire(r)}),this.onDidRemove(r=>{this._onDidRemoveGroup.fire(r)}),this.onDidActiveChange(r=>{this._onDidActiveGroupChange.fire(r)}))}updateOptions(e){super.updateOptions(e);const i=typeof e.orientation=="string"&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),i&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:(e=this.activeGroup)===null||e===void 0?void 0:e.id}}setVisible(e,i){this.gridview.setViewVisible(ot(e.element),i)}setActive(e){this._groups.forEach((i,a)=>{i.value.setActive(e===i.value)})}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}fromJSON(e){this.clear();const{grid:i,activePanel:a}=e;try{const r=[],c=this.width,d=this.height;if(this.gridview.deserialize(i,{fromJSON:h=>{const{data:f}=h,p=this.options.createComponent({id:f.id,name:f.component});return r.push(()=>p.init({params:f.params,minimumWidth:f.minimumWidth,maximumWidth:f.maximumWidth,minimumHeight:f.minimumHeight,maximumHeight:f.maximumHeight,priority:f.priority,snap:!!f.snap,accessor:this,isVisible:h.visible})),this._onDidAddGroup.fire(p),this.registerPanel(p),p}}),this.layout(c,d,!0),r.forEach(h=>h()),typeof a=="string"){const h=this.getPanel(a);h&&this.doSetGroupActive(h)}}catch(r){for(const c of this.groups)c.dispose(),this._groups.delete(c.id),this._onDidRemoveGroup.fire(c);throw this.clear(),r}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,i=Array.from(this._groups.values());for(const a of i)a.disposable.dispose(),this.doRemoveGroup(a.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,i){var a;let r;const c=this.gridview.remove(e),d=(a=this._groups.get(i.reference))===null||a===void 0?void 0:a.value;if(!d)throw new Error(`reference group ${i.reference} does not exist`);const h=mc(i.direction);if(h==="center")throw new Error(`${h} not supported as an option`);{const f=ot(d.element);r=$n(this.gridview.orientation,f,h)}this.doAddGroup(c,r,i.size)}addPanel(e){var i,a,r,c;let d=(i=e.location)!==null&&i!==void 0?i:[0];if(!((a=e.position)===null||a===void 0)&&a.referencePanel){const f=(r=this._groups.get(e.position.referencePanel))===null||r===void 0?void 0:r.value;if(!f)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const p=mc(e.position.direction);if(p==="center")throw new Error(`${p} not supported as an option`);{const y=ot(f.element);d=$n(this.gridview.orientation,y,p)}}const h=this.options.createComponent({id:e.id,name:e.component});return h.init({params:(c=e.params)!==null&&c!==void 0?c:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(h,d,e.size),this.registerPanel(h),this.doSetGroupActive(h),h}registerPanel(e){const i=new Ae(e.api.onDidFocusChange(a=>{a.isFocused&&this._groups.forEach(r=>{const c=r.value;c!==e?c.setActive(!1):c.setActive(!0)})}));this._groups.set(e.id,{value:e,disposable:i})}moveGroup(e,i,a){const r=this.getPanel(i);if(!r)throw new Error("invalid operation");const c=ot(e.element),d=$n(this.gridview.orientation,c,a),[h,f]=xi(d),p=ot(r.element),[y,b]=xi(p);if(uS(y,h)){this.gridview.moveView(y,b,f);return}const x=this.doRemoveGroup(r,{skipActive:!0,skipDispose:!0}),w=ot(e.element),E=$n(this.gridview.orientation,w,a);this.doAddGroup(x,E)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class zk extends sm{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new Ae(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(i=>this._onDidAddView.fire(i)),this._splitview.onDidRemoveView(i=>this._onDidRemoveView.fire(i)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===be.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===be.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,i){var a;super(document.createElement("div"),i.disableAutoResizing),this._splitviewChangeDisposable=new Pt,this._panels=new Map,this._onDidLayoutfromJSON=new ie,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new ie,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new ie,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new ie,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new Pc(this.element),this._classNames.setClassNames((a=i.className)!==null&&a!==void 0?a:""),e.appendChild(this.element),this._options=i,this.splitview=new Jo(this.element,i),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var i,a;"className"in e&&this._classNames.setClassNames((i=e.className)!==null&&i!==void 0?i:""),"disableResizing"in e&&(this.disableResizing=(a=e.disableAutoResizing)!==null&&a!==void 0?a:!1),typeof e.orientation=="string"&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}movePanel(e,i){this.splitview.moveView(e,i)}setVisible(e,i){const a=this.panels.indexOf(e);this.splitview.setViewVisible(a,i)}setActive(e,i){this._activePanel=e,this.panels.filter(a=>a!==e).forEach(a=>{a.api._onDidActiveChange.fire({isActive:!1}),i||a.focus()}),e.api._onDidActiveChange.fire({isActive:!0}),i||e.focus()}removePanel(e,i){const a=this._panels.get(e.id);if(!a)throw new Error(`unknown splitview panel ${e.id}`);a.dispose(),this._panels.delete(e.id);const r=this.panels.findIndex(h=>h===e);this.splitview.removeView(r,i).dispose();const d=this.panels;d.length>0&&this.setActive(d[d.length-1])}getPanel(e){return this.panels.find(i=>i.id===e)}addPanel(e){var i;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const a=this.options.createComponent({id:e.id,name:e.component});a.orientation=this.splitview.orientation,a.init({params:(i=e.params)!==null&&i!==void 0?i:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const r=typeof e.size=="number"?e.size:_n.Distribute,c=typeof e.index=="number"?e.index:void 0;return this.splitview.addView(a,r,c),this.doAddView(a),this.setActive(a),a}layout(e,i){const[a,r]=this.splitview.orientation===be.HORIZONTAL?[e,i]:[i,e];this.splitview.layout(a,r)}doAddView(e){const i=e.api.onDidFocusChange(a=>{a.isFocused&&this.setActive(e,!0)});this._panels.set(e.id,i)}toJSON(){var e;return{views:this.splitview.getViews().map((a,r)=>({size:this.splitview.getViewSize(r),data:a.toJSON(),snap:!!a.snap,priority:a.priority})),activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:i,orientation:a,size:r,activeView:c}=e,d=[],h=this.width,f=this.height;if(this.splitview=new Jo(this.element,{orientation:a,proportionalLayout:this.options.proportionalLayout,descriptor:{size:r,views:i.map(p=>{const y=p.data;if(this._panels.has(y.id))throw new Error(`panel ${y.id} already exists`);const b=this.options.createComponent({id:y.id,name:y.component});return d.push(()=>{var x;b.init({params:(x=y.params)!==null&&x!==void 0?x:{},minimumSize:y.minimumSize,maximumSize:y.maximumSize,snap:p.snap,priority:p.priority,accessor:this})}),b.orientation=a,this.doAddView(b),setTimeout(()=>{this._onDidAddView.fire(b)},0),{size:p.size,view:b}})}}),this.layout(h,f),d.forEach(p=>p()),typeof c=="string"){const p=this.getPanel(c);p&&this.setActive(p)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;)this.splitview.removeView(0,_n.Distribute,!0).dispose()}dispose(){for(const i of this._panels.values())i.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const i of e)i.dispose();this.element.remove(),super.dispose()}}class Bb extends Ae{get element(){return this._element}constructor(){super(),this._expandedIcon=lk(),this._collapsedIcon=xS(),this.disposable=new Pt,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(Pe(this._element,"click",()=>{var e;(e=this.apiRef.api)===null||e===void 0||e.setExpanded(!this.apiRef.api.isExpanded)}))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var e;const i=!!(!((e=this.apiRef.api)===null||e===void 0)&&e.isExpanded);Ee(this._expander,"collapsed",!i),i?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const Mk=im(),Hb=22,Vb=0,Fb=Number.MAX_SAFE_INTEGER;class Ub extends ek{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class Pk extends sm{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new Ae(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(i=>this._onDidAddView.fire(i)),this._paneview.onDidRemoveView(i=>this._onDidRemoveView.fire(i)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===be.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===be.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,i){var a;super(document.createElement("div"),i.disableAutoResizing),this._id=Mk.next(),this._disposable=new Pt,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new ie,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new ie,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new ie,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new ie,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new ie,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOverEvent=new ie,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOverEvent),this._classNames=new Pc(this.element),this._classNames.setClassNames((a=i.className)!==null&&a!==void 0?a:""),e.appendChild(this.element),this._options=i,this.paneview=new Ob(this.element,{orientation:be.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,i){const a=this.panels.indexOf(e);this.paneview.setViewVisible(a,i)}focus(){}updateOptions(e){var i,a;"className"in e&&this._classNames.setClassNames((i=e.className)!==null&&i!==void 0?i:""),"disableResizing"in e&&(this.disableResizing=(a=e.disableAutoResizing)!==null&&a!==void 0?a:!1),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var i,a;const r=this.options.createComponent({id:e.id,name:e.component});let c;e.headerComponent&&this.options.createHeaderComponent&&(c=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),c||(c=new Bb);const d=new Ub({id:e.id,component:e.component,headerComponent:e.headerComponent,header:c,body:r,orientation:be.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(i=e.headerSize)!==null&&i!==void 0?i:Hb,minimumBodySize:Vb,maximumBodySize:Fb});this.doAddPanel(d);const h=typeof e.size=="number"?e.size:_n.Distribute,f=typeof e.index=="number"?e.index:void 0;return d.init({params:(a=e.params)!==null&&a!==void 0?a:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new er(this),accessor:this}),this.paneview.addPane(d,h,f),d.orientation=this.paneview.orientation,d}removePanel(e){const a=this.panels.findIndex(r=>r===e);this.paneview.removePane(a),this.doRemovePanel(e)}movePanel(e,i){this.paneview.moveView(e,i)}getPanel(e){return this.panels.find(i=>i.id===e)}layout(e,i){const[a,r]=this.paneview.orientation===be.HORIZONTAL?[e,i]:[i,e];this.paneview.layout(a,r)}toJSON(){const e=r=>r===Number.MAX_SAFE_INTEGER||r===Number.POSITIVE_INFINITY?void 0:r,i=r=>r<=0?void 0:r;return{views:this.paneview.getPanes().map((r,c)=>({size:this.paneview.getViewSize(c),data:r.toJSON(),minimumSize:i(r.minimumBodySize),maximumSize:e(r.maximumBodySize),headerSize:r.headerSize,expanded:r.isExpanded()})),size:this.paneview.size}}fromJSON(e){this.clear();const{views:i,size:a}=e,r=[],c=this.width,d=this.height;this.paneview=new Ob(this.element,{orientation:be.VERTICAL,descriptor:{size:a,views:i.map(h=>{var f,p,y;const b=h.data,x=this.options.createComponent({id:b.id,name:b.component});let w;b.headerComponent&&this.options.createHeaderComponent&&(w=this.options.createHeaderComponent({id:b.id,name:b.headerComponent})),w||(w=new Bb);const E=new Ub({id:b.id,component:b.component,headerComponent:b.headerComponent,header:w,body:x,orientation:be.VERTICAL,isExpanded:!!h.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(f=h.headerSize)!==null&&f!==void 0?f:Hb,minimumBodySize:(p=h.minimumSize)!==null&&p!==void 0?p:Vb,maximumBodySize:(y=h.maximumSize)!==null&&y!==void 0?y:Fb});return this.doAddPanel(E),r.push(()=>{var C;E.init({params:(C=b.params)!==null&&C!==void 0?C:{},minimumBodySize:h.minimumSize,maximumBodySize:h.maximumSize,title:b.title,isExpanded:!!h.expanded,containerApi:new er(this),accessor:this}),E.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(E)},0),{size:h.size,view:E}})}}),this.layout(c,d),r.forEach(h=>h()),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,i]of this._viewDisposables.entries())i.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const i=new Ae(e.onDidDrop(a=>{this._onDidDrop.fire(a)}),e.onUnhandledDragOverEvent(a=>{this._onUnhandledDragOverEvent.fire(a)}));this._viewDisposables.set(e.id,i)}doRemovePanel(e){const i=this._viewDisposables.get(e.id);i&&(i.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,i]of this._viewDisposables.entries())i.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}class Lk extends om{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=typeof this._minimumSize=="function"?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e=typeof this._maximumSize=="function"?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,i){super(e,i,new yS(e,i)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(a=>{const{isVisible:r}=a,{accessor:c}=this._params;c.setVisible(this,r)}),this.api.onActiveChange(()=>{const{accessor:a}=this._params;a.setActive(this)}),this.api.onDidConstraintsChangeInternal(a=>{(typeof a.minimumSize=="number"||typeof a.minimumSize=="function")&&(this._minimumSize=a.minimumSize),(typeof a.maximumSize=="number"||typeof a.maximumSize=="function")&&(this._maximumSize=a.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(a=>{this._onDidChange.fire({size:a.size})}))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,i){const[a,r]=this.orientation===be.HORIZONTAL?[e,i]:[i,e];super.layout(a,r)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){const e=a=>a===Number.MAX_SAFE_INTEGER||a===Number.POSITIVE_INFINITY?void 0:a,i=a=>a<=0?void 0:a;return Object.assign(Object.assign({},super.toJSON()),{minimumSize:i(this.minimumSize),maximumSize:e(this.maximumSize)})}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}function Ik(n,e){return new Rk(n,e).api}function Gk(n,e){const i=new zk(n,e);return new fS(i)}function Bk(n,e){const i=new Ok(n,e);return new mS(i)}function Hk(n,e){const i=new Pk(n,e);return new er(i)}const ES=(n,e)=>{const[i,a]=ue.useState(),r=ue.useRef(n.componentProps);return ue.useImperativeHandle(e,()=>({update:c=>{r.current=Object.assign(Object.assign({},r.current),c),a(Date.now())}}),[]),ue.createElement(n.component,r.current)};ES.displayName="DockviewReactJsBridge";const Vk=(()=>{let n=1;return{next:()=>`dockview_react_portal_key_${(n++).toString()}`}})(),Fk=ue.createContext({});class Is{constructor(e,i,a,r,c){this.parent=e,this.portalStore=i,this.component=a,this.parameters=r,this.context=c,this._initialProps={},this.disposed=!1,this.createPortal()}update(e){if(this.disposed)throw new Error("invalid operation: resource is already disposed");this.componentInstance?this.componentInstance.update(e):this._initialProps=Object.assign(Object.assign({},this._initialProps),e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if(!Uk(this.component))throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");const e=ue.createElement(ue.forwardRef(ES),{component:this.component,componentProps:this.parameters,ref:r=>{this.componentInstance=r,Object.keys(this._initialProps).length>0&&(this.componentInstance.update(this._initialProps),this._initialProps={})}}),i=this.context?ue.createElement(Fk.Provider,{value:this.context},e):e,a=Sw.createPortal(i,this.parent,Vk.next());this.ref={portal:a,disposable:this.portalStore.addPortal(a)}}dispose(){var e;(e=this.ref)===null||e===void 0||e.disposable.dispose(),this.disposed=!0}}const Gc=()=>{const[n,e]=ue.useState([]);ue.useDebugValue(`Portal count: ${n.length}`);const i=ue.useCallback(a=>{e(c=>[...c,a]);let r=!1;return yt.from(()=>{if(r)throw new Error("invalid operation: resource already disposed");r=!0,e(c=>c.filter(d=>d!==a))})},[]);return[n,i]};function Uk(n){return typeof n=="function"||!!n?.$$typeof}class $b{get element(){return this._element}constructor(e,i,a){this.id=e,this.component=i,this.reactPortalStore=a,this._onDidFocus=new ie,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new ie,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new Is(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var i;(i=this.part)===null||i===void 0||i.update({params:e.params})}layout(e,i){}dispose(){var e;this._onDidFocus.dispose(),this._onDidBlur.dispose(),(e=this.part)===null||e===void 0||e.dispose()}}class Wb{get element(){return this._element}constructor(e,i,a){this.id=e,this.component=i,this.reactPortalStore=a,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new Is(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,tabLocation:e.tabLocation})}update(e){var i;(i=this.part)===null||i===void 0||i.update({params:e.params})}layout(e,i){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class qb{get element(){return this._element}constructor(e,i,a){this.id=e,this.component=i,this.reactPortalStore=a,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Is(this.element,this.reactPortalStore,this.component,{group:e.group,containerApi:e.containerApi})}focus(){}update(e){var i,a,r;this.parameters&&(this.parameters.params=e.params),(i=this.part)===null||i===void 0||i.update({params:(r=(a=this.parameters)===null||a===void 0?void 0:a.params)!==null&&r!==void 0?r:{}})}layout(e,i){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class $k{get element(){return this._element}get part(){return this._part}constructor(e,i,a){this.component=e,this.reactPortalStore=i,this._group=a,this.mutableDisposable=new Pt,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.mutableDisposable.value=new Ae(this._group.model.onDidAddPanel(()=>{this.updatePanels()}),this._group.model.onDidRemovePanel(()=>{this.updatePanels()}),this._group.model.onDidActivePanelChange(()=>{this.updateActivePanel()}),e.api.onDidActiveChange(()=>{this.updateGroupActive()})),this._part=new Is(this.element,this.reactPortalStore,this.component,{api:e.api,containerApi:e.containerApi,panels:this._group.model.panels,activePanel:this._group.model.activePanel,isGroupActive:this._group.api.isActive,group:this._group})}dispose(){var e;this.mutableDisposable.dispose(),(e=this._part)===null||e===void 0||e.dispose()}update(e){var i;(i=this._part)===null||i===void 0||i.update(e.params)}updatePanels(){this.update({params:{panels:this._group.model.panels}})}updateActivePanel(){this.update({params:{activePanel:this._group.model.activePanel}})}updateGroupActive(){this.update({params:{isGroupActive:this._group.api.isActive}})}}function _a(n,e){return n?i=>new $k(n,e,i):void 0}const Bl="props.defaultTabComponent";function Wk(n){return yf.reduce((i,a)=>(a in n&&(i[a]=n[a]),i),{})}const dm=ue.forwardRef((n,e)=>{const i=ue.useRef(null),a=ue.useRef(),[r,c]=Gc();ue.useImperativeHandle(e,()=>i.current,[]);const d=ue.useRef({});return ue.useEffect(()=>{const h={};yf.forEach(f=>{const p=f,y=n[p];p in n&&y!==d.current[p]&&(h[p]=y)}),a.current&&a.current.updateOptions(h),d.current=n},yf.map(h=>n[h])),ue.useEffect(()=>{var h;if(!i.current)return;const f=(h=n.tabComponents)!==null&&h!==void 0?h:{};n.defaultTabComponent&&(f[Bl]=n.defaultTabComponent);const p={createLeftHeaderActionComponent:_a(n.leftHeaderActionsComponent,{addPortal:c}),createRightHeaderActionComponent:_a(n.rightHeaderActionsComponent,{addPortal:c}),createPrefixHeaderActionComponent:_a(n.prefixHeaderActionsComponent,{addPortal:c}),createComponent:w=>new $b(w.id,n.components[w.name],{addPortal:c}),createTabComponent(w){return new Wb(w.id,f[w.name],{addPortal:c})},createWatermarkComponent:n.watermarkComponent?()=>new qb("watermark",n.watermarkComponent,{addPortal:c}):void 0,defaultTabComponent:n.defaultTabComponent?Bl:void 0},y=Ik(i.current,Object.assign(Object.assign({},Wk(n)),p)),{clientWidth:b,clientHeight:x}=i.current;return y.layout(b,x),n.onReady&&n.onReady({api:y}),a.current=y,()=>{a.current=void 0,y.dispose()}},[]),ue.useEffect(()=>{if(!a.current)return()=>{};const h=a.current.onDidDrop(f=>{n.onDidDrop&&n.onDidDrop(f)});return()=>{h.dispose()}},[n.onDidDrop]),ue.useEffect(()=>{if(!a.current)return()=>{};const h=a.current.onWillDrop(f=>{n.onWillDrop&&n.onWillDrop(f)});return()=>{h.dispose()}},[n.onWillDrop]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createComponent:h=>new $b(h.id,n.components[h.name],{addPortal:c})})},[n.components]),ue.useEffect(()=>{var h;if(!a.current)return;const f=(h=n.tabComponents)!==null&&h!==void 0?h:{};n.defaultTabComponent&&(f[Bl]=n.defaultTabComponent),a.current.updateOptions({defaultTabComponent:n.defaultTabComponent?Bl:void 0,createTabComponent(p){return new Wb(p.id,f[p.name],{addPortal:c})}})},[n.tabComponents,n.defaultTabComponent]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createWatermarkComponent:n.watermarkComponent?()=>new qb("watermark",n.watermarkComponent,{addPortal:c}):void 0})},[n.watermarkComponent]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createRightHeaderActionComponent:_a(n.rightHeaderActionsComponent,{addPortal:c})})},[n.rightHeaderActionsComponent]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createLeftHeaderActionComponent:_a(n.leftHeaderActionsComponent,{addPortal:c})})},[n.leftHeaderActionsComponent]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createPrefixHeaderActionComponent:_a(n.prefixHeaderActionsComponent,{addPortal:c})})},[n.prefixHeaderActionsComponent]),ue.createElement("div",{style:{height:"100%",width:"100%"},ref:i},r)});dm.displayName="DockviewComponent";const qk=()=>ue.createElement("svg",{height:"11",width:"11",viewBox:"0 0 28 28","aria-hidden":"false",focusable:!1,className:"dv-svg"},ue.createElement("path",{d:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}));var Yk=function(n,e){var i={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&e.indexOf(a)<0&&(i[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(n);r<a.length;r++)e.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(n,a[r])&&(i[a[r]]=n[a[r]]);return i};function Xk(n){const[e,i]=ue.useState(n.title);return ue.useEffect(()=>{const a=n.onDidTitleChange(r=>{i(r.title)});return e!==n.title&&i(n.title),()=>{a.dispose()}},[n]),e}const DS=n=>{var{api:e,containerApi:i,params:a,hideClose:r,closeActionOverride:c,onPointerDown:d,onPointerUp:h,onPointerLeave:f,tabLocation:p}=n,y=Yk(n,["api","containerApi","params","hideClose","closeActionOverride","onPointerDown","onPointerUp","onPointerLeave","tabLocation"]);const b=Xk(e),x=ue.useRef(!1),w=ue.useCallback(N=>{N.preventDefault(),c?c():e.close()},[e,c]),E=ue.useCallback(N=>{N.preventDefault()},[]),C=ue.useCallback(N=>{x.current=N.button===1,d?.(N)},[d]),S=ue.useCallback(N=>{x&&N.button===1&&!r&&(x.current=!1,w(N)),h?.(N)},[h,w,r]),D=ue.useCallback(N=>{x.current=!1,f?.(N)},[f]);return ue.createElement("div",Object.assign({"data-testid":"dockview-dv-default-tab"},y,{onPointerDown:C,onPointerUp:S,onPointerLeave:D,className:"dv-default-tab"}),ue.createElement("span",{className:"dv-default-tab-content"},b),!r&&ue.createElement("div",{className:"dv-default-tab-action",onPointerDown:E,onClick:w},ue.createElement(qk,null)))};class Yb extends Lk{constructor(e,i,a,r){super(e,i),this.reactComponent=a,this.reactPortalStore=r}getComponent(){var e,i;return new Is(this.element,this.reactPortalStore,this.reactComponent,{params:(i=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&i!==void 0?i:{},api:this.api,containerApi:new fS(this._params.accessor)})}}function Qk(n){return hf.reduce((i,a)=>(a in n&&(i[a]=n[a]),i),{})}const Zk=ue.forwardRef((n,e)=>{const i=ue.useRef(null),a=ue.useRef(),[r,c]=Gc();ue.useImperativeHandle(e,()=>i.current,[]);const d=ue.useRef({});return ue.useEffect(()=>{const h={};hf.forEach(f=>{const p=f,y=n[p];p in n&&y!==d.current[p]&&(h[p]=y)}),a.current&&a.current.updateOptions(h),d.current=n},hf.map(h=>n[h])),ue.useEffect(()=>{if(!i.current)return()=>{};const h={createComponent:b=>new Yb(b.id,b.name,n.components[b.name],{addPortal:c})},f=Gk(i.current,Object.assign(Object.assign({},Qk(n)),h)),{clientWidth:p,clientHeight:y}=i.current;return f.layout(p,y),n.onReady&&n.onReady({api:f}),a.current=f,()=>{a.current=void 0,f.dispose()}},[]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createComponent:h=>new Yb(h.id,h.name,n.components[h.name],{addPortal:c})})},[n.components]),ue.createElement("div",{style:{height:"100%",width:"100%"},ref:i},r)});Zk.displayName="SplitviewComponent";class Xb extends CS{constructor(e,i,a,r){super(e,i),this.reactComponent=a,this.reactPortalStore=r}getComponent(){var e,i;return new Is(this.element,this.reactPortalStore,this.reactComponent,{params:(i=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&i!==void 0?i:{},api:this.api,containerApi:new mS(this._params.accessor)})}}function Kk(n){return gf.reduce((i,a)=>(a in n&&(i[a]=n[a]),i),{})}const Jk=ue.forwardRef((n,e)=>{const i=ue.useRef(null),a=ue.useRef(),[r,c]=Gc();ue.useImperativeHandle(e,()=>i.current,[]);const d=ue.useRef({});return ue.useEffect(()=>{const h={};gf.forEach(f=>{const p=f,y=n[p];p in n&&y!==d.current[p]&&(h[p]=y)}),a.current&&a.current.updateOptions(h),d.current=n},gf.map(h=>n[h])),ue.useEffect(()=>{if(!i.current)return()=>{};const h={createComponent:b=>new Xb(b.id,b.name,n.components[b.name],{addPortal:c})},f=Bk(i.current,Object.assign(Object.assign({},Kk(n)),h)),{clientWidth:p,clientHeight:y}=i.current;return f.layout(p,y),n.onReady&&n.onReady({api:f}),a.current=f,()=>{a.current=void 0,f.dispose()}},[]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createComponent:h=>new Xb(h.id,h.name,n.components[h.name],{addPortal:c})})},[n.components]),ue.createElement("div",{style:{height:"100%",width:"100%"},ref:i},r)});Jk.displayName="GridviewComponent";class Hl{get element(){return this._element}constructor(e,i,a){this.id=e,this.component=i,this.reactPortalStore=a,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Is(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var i;(i=this.part)===null||i===void 0||i.update(e.params)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function eR(n){return vf.reduce((i,a)=>(a in n&&(i[a]=n[a]),i),{})}const tR=ue.forwardRef((n,e)=>{const i=ue.useRef(null),a=ue.useRef(),[r,c]=Gc();ue.useImperativeHandle(e,()=>i.current,[]);const d=ue.useRef({});return ue.useEffect(()=>{const h={};vf.forEach(f=>{const p=f,y=n[p];p in n&&y!==d.current[p]&&(h[p]=y)}),a.current&&a.current.updateOptions(h),d.current=n},vf.map(h=>n[h])),ue.useEffect(()=>{var h;if(!i.current)return()=>{};const f=(h=n.headerComponents)!==null&&h!==void 0?h:{},p={createComponent:w=>new Hl(w.id,n.components[w.name],{addPortal:c}),createHeaderComponent:w=>new Hl(w.id,f[w.name],{addPortal:c})},y=Hk(i.current,Object.assign(Object.assign({},eR(n)),p)),{clientWidth:b,clientHeight:x}=i.current;return y.layout(b,x),n.onReady&&n.onReady({api:y}),a.current=y,()=>{a.current=void 0,y.dispose()}},[]),ue.useEffect(()=>{a.current&&a.current.updateOptions({createComponent:h=>new Hl(h.id,n.components[h.name],{addPortal:c})})},[n.components]),ue.useEffect(()=>{var h;if(!a.current)return;const f=(h=n.headerComponents)!==null&&h!==void 0?h:{};a.current.updateOptions({createHeaderComponent:p=>new Hl(p.id,f[p.name],{addPortal:c})})},[n.headerComponents]),ue.useEffect(()=>{if(!a.current)return()=>{};const h=a.current.onDidDrop(f=>{n.onDidDrop&&n.onDidDrop(f)});return()=>{h.dispose()}},[n.onDidDrop]),ue.createElement("div",{style:{height:"100%",width:"100%"},ref:i},r)});tR.displayName="PaneviewComponent";class hm extends m.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,i){const a=this.props.panelName?` in ${this.props.panelName}`:"";console.error(`[ErrorBoundary] Caught error${a}:`,e,i)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:l.jsxs("div",{className:"error-boundary-fallback",style:{padding:"16px",color:"var(--status-error, #ef4444)",backgroundColor:"var(--bg-tertiary, #0f0f1a)",border:"1px solid var(--status-error, #ef4444)",borderRadius:"4px",margin:"8px"},children:[l.jsx("h4",{style:{margin:"0 0 8px 0"},children:this.props.panelName?`${this.props.panelName} Error`:"Panel Error"}),l.jsx("pre",{style:{margin:0,fontSize:"12px",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:this.state.error?.message})]}):this.props.children}}const tr=new Map,Qb={small:1024,large:1440},gc={medium:300,large:400},vc={width:800,height:600};function nR(n){return n<Qb.small?"small":n>=Qb.large?"large":"medium"}function iR(n){return n==="large"?gc.large:gc.medium}function sR(n,e){return{width:n<vc.width,height:e<vc.height}}function aR(){const n=m.useCallback(()=>({width:typeof window<"u"?window.innerWidth:1200,height:typeof window<"u"?window.innerHeight:800}),[]),[e,i]=m.useState(n);m.useEffect(()=>{const c=()=>{i(n())};return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c)}},[n]);const a=nR(e.width),r=sR(e.width,e.height);return{breakpoint:a,isSmall:a==="small",isMedium:a==="medium",isLarge:a==="large",width:e.width,height:e.height,sidebarWidth:iR(a),isBelowMinimum:r.width||r.height,minimumViolation:r}}function AS(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),c=m.useRef(null),d=m.useRef(),h=m.useRef(!0),f=m.useRef(n);f.current=n;const p=m.useRef(null);return m.useEffect(()=>{h.current=!0;const b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/focus`,x=E=>{const C=f.current;if(C)if(E!==null){const S=C.getPanel(E);if(!S)return;C.groups.length>1?C.maximizeGroup(S):(p.current||(p.current=C.activePanel?.id??null),S.api.setActive()),r(!0),i(E)}else{if(C.hasMaximizedGroup())C.exitMaximizedGroup();else if(p.current){const D=C.getPanel(p.current);D&&D.api.setActive()}p.current=null,r(!1),i(null)}},w=()=>{h.current&&(c.current=new WebSocket(b),c.current.onmessage=E=>{try{const C=JSON.parse(E.data);C.type==="update"&&x(C.focus)}catch{}},c.current.onclose=()=>{d.current=setTimeout(w,2e3)})};return w(),()=>{h.current=!1,d.current&&clearTimeout(d.current),c.current&&c.current.close()}},[]),{focusedPanel:e,isInFocusMode:a}}const Xe={CHANGED:"changed",DIFFS:"diffs",DEBUG:"debug",AUDIT_LOG:"audit-log",MESSAGE:"message",SPRINT:"sprint",WORKFLOW:"workflow",AC:"ac",TODO:"todo",BACKGROUND:"background",GIT:"git",SETTINGS:"settings",PROGRESS:"progress",TANDEM:"tandem"};function un(n,e){tr.set(n,e)}let Kl=null;const Ts=[Xe.CHANGED,Xe.DIFFS,Xe.DEBUG,Xe.AUDIT_LOG],ks=[Xe.SPRINT,Xe.WORKFLOW,Xe.AC,Xe.TODO,Xe.BACKGROUND,Xe.GIT,Xe.SETTINGS,Xe.TANDEM],Ta={changed:"Changed",diffs:"Diffs",debug:"Debug","audit-log":"Audit Log",message:"Message",sprint:"Sprint",workflow:"Workflow",ac:"AC",todo:"Todo",background:"Subagents",git:"Git",settings:"Settings",progress:"Progress",tandem:"Tandem"},Jl=new Set;function Zb(n){const e=Kl;if(!e||e.getPanel(n))return!1;const i=Ts.includes(n),a=ks.includes(n);let r;if(i)for(const c of Ts){const d=e.getPanel(c);if(d){r=d;break}}else if(a)for(const c of ks){const d=e.getPanel(c);if(d){r=d;break}}return e.addPanel({id:n,component:"PanelAdapter",params:{panelId:n},position:r?{referencePanel:r.id}:void 0,title:Ta[n]||n}),Jl.delete(n),!0}function oR({params:n}){const e=tr.get(n.panelId);return e?l.jsx("div",{"data-testid":`panel-${n.panelId}`,className:"dockview-panel-content",children:l.jsx(hm,{panelName:n.panelId,children:l.jsx("div",{className:"error-boundary-wrapper",children:l.jsx(e,{})})})}):(console.warn(`[DockviewWorkspace] No component registered for panel: ${n.panelId}`),null)}function rR({initialLayout:n,onLayoutChange:e}){const i=m.useRef(null),[a,r]=m.useState(null),{isSmall:c,isBelowMinimum:d,sidebarWidth:h}=aR(),[f,p]=m.useState(!1),[y,b]=m.useState([]),[x,w]=m.useState(!1),E=m.useRef(null);AS(a);const C=m.useRef(!1),S=m.useRef(null),D=m.useCallback(()=>{b(Array.from(Jl))},[]),N=m.useCallback(O=>{const A=O.api;if(i.current=A,Kl=A,r(A),n&&n.grid&&n.panels)try{A.fromJSON(n);const ne=A.getPanel(Xe.MESSAGE);ne?.group&&(ne.group.locked="no-drop-target",ne.group.model.header.hidden=!0),p(!0);return}catch(ne){console.warn("[DockviewWorkspace] Failed to restore layout from JSON, building default:",ne)}const G=A.addPanel({id:Ts[0],component:"PanelAdapter",params:{panelId:Ts[0]},title:Ta[Ts[0]]});for(let ne=1;ne<Ts.length;ne++){const W=Ts[ne];tr.has(W)&&A.addPanel({id:W,component:"PanelAdapter",params:{panelId:W},position:{referencePanel:G.id},title:Ta[W]})}const U=A.addPanel({id:Xe.MESSAGE,component:"PanelAdapter",params:{panelId:Xe.MESSAGE},position:{referencePanel:G.id,direction:"right"},title:Ta[Xe.MESSAGE]}),B=A.addPanel({id:ks[0],component:"PanelAdapter",params:{panelId:ks[0]},position:{referencePanel:U.id,direction:"right"},title:Ta[ks[0]]});for(let ne=1;ne<ks.length;ne++){const W=ks[ne];tr.has(W)&&A.addPanel({id:W,component:"PanelAdapter",params:{panelId:W},position:{referencePanel:B.id},title:Ta[W]})}U?.group&&(U.group.locked="no-drop-target",U.group.model.header.hidden=!0);const $=G.group,ae=B.group;$&&$.api.setSize({width:gc.medium}),ae&&ae.api.setSize({width:gc.medium}),p(!0)},[n]),k=m.useCallback(()=>{const O=i.current;!O||!e||O.panels.length!==0&&(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{const A=O.toJSON();A.panels&&Object.keys(A.panels).length>0&&e(A)},300))},[e]);m.useEffect(()=>{const O=i.current;if(!O||!f)return;const A=[O.onDidLayoutChange(()=>k()),O.onDidAddPanel(G=>{const U=G?.panel?.id;U&&Jl.delete(U),D(),k()}),O.onDidRemovePanel(G=>{const U=G?.panel?.id;U&&(Jl.add(U),D()),k()})];return()=>{A.forEach(G=>G.dispose())}},[f,k]),m.useEffect(()=>{const O=i.current;if(!O||!f)return;if(!C.current){C.current=!0,S.current=c;return}if(S.current===c)return;S.current=c;const A=O.getPanel(Xe.CHANGED),G=O.getPanel(Xe.SPRINT),U=A?.group,B=G?.group;c?(U?.api.setSize({width:0}),B?.api.setSize({width:0})):(U?.api.setSize({width:h}),B?.api.setSize({width:h}))},[c,h,f]);const T=m.useCallback(O=>{Zb(O),w(!1)},[]);m.useEffect(()=>()=>{E.current&&clearTimeout(E.current),Kl=null},[]),m.useEffect(()=>{const O=window.location.protocol==="https:"?"wss:":"ws:",A=new WebSocket(`${O}//${window.location.host}/ws/settings`);return A.onmessage=G=>{try{const U=JSON.parse(G.data);if(U.type==="panel:toggle"&&U.panelId){const B=Kl;if(!B)return;const $=B.getPanel(U.panelId);$?$.api.close():Zb(U.panelId)}}catch{}},()=>A.close()},[]);const R={PanelAdapter:oR},z={changed:"Changed Files",diffs:"Diffs",debug:"Debug","audit-log":"Audit Log",sprint:"Sprint",workflow:"Workflow",ac:"AC",todo:"Todo",background:"Subagents",git:"Git",hotspots:"Hotspots",settings:"Settings"};return l.jsxs("div",{className:"cyclist-dockview","data-dockview-group":"container",children:[d&&l.jsxs("div",{"data-testid":"min-dimension-warning",className:"min-dimension-warning",role:"alert",children:["Window is below minimum size (",vc.width,"x",vc.height,")"]}),y.length>0&&l.jsxs("div",{className:"panel-restore-container",children:[l.jsx(St,{delayDuration:300,children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs(Ce,{variant:"outline",size:"sm",className:"panel-restore-button",onClick:()=>w(!x),"aria-expanded":x,"aria-haspopup":"menu",children:[l.jsx("span",{className:"panel-restore-icon",children:"+"}),l.jsx("span",{className:"panel-restore-count",children:y.length})]})}),l.jsx(Te,{children:"Restore closed panels"})]})}),x&&l.jsxs("div",{className:"panel-restore-menu",role:"menu",children:[l.jsx("div",{className:"panel-restore-header",children:"Restore Panel"}),y.map(O=>l.jsx(Ce,{variant:"ghost",className:"panel-restore-item",onClick:()=>T(O),role:"menuitem",children:z[O]||O},O))]})]}),l.jsx(dm,{className:"dockview-container",onReady:N,components:R,defaultTabComponent:O=>l.jsx(DS,{...O,hideClose:!0}),watermarkComponent:()=>null})]})}var Kb=1,lR=.9,cR=.8,uR=.17,Mh=.1,Ph=.999,dR=.9999,hR=.99,fR=/[\\\/_+.#"@\[\(\{&]/,mR=/[\\\/_+.#"@\[\(\{&]/g,pR=/[\s-]/,NS=/[\s-]/g;function bf(n,e,i,a,r,c,d){if(c===e.length)return r===n.length?Kb:hR;var h=`${r},${c}`;if(d[h]!==void 0)return d[h];for(var f=a.charAt(c),p=i.indexOf(f,r),y=0,b,x,w,E;p>=0;)b=bf(n,e,i,a,p+1,c+1,d),b>y&&(p===r?b*=Kb:fR.test(n.charAt(p-1))?(b*=cR,w=n.slice(r,p-1).match(mR),w&&r>0&&(b*=Math.pow(Ph,w.length))):pR.test(n.charAt(p-1))?(b*=lR,E=n.slice(r,p-1).match(NS),E&&r>0&&(b*=Math.pow(Ph,E.length))):(b*=uR,r>0&&(b*=Math.pow(Ph,p-r))),n.charAt(p)!==e.charAt(c)&&(b*=dR)),(b<Mh&&i.charAt(p-1)===a.charAt(c+1)||a.charAt(c+1)===a.charAt(c)&&i.charAt(p-1)!==a.charAt(c))&&(x=bf(n,e,i,a,p+1,c+2,d),x*Mh>b&&(b=x*Mh)),b>y&&(y=b),p=i.indexOf(f,p+1);return d[h]=y,y}function Jb(n){return n.toLowerCase().replace(NS," ")}function gR(n,e,i){return n=i&&i.length>0?`${n+" "+i.join(" ")}`:n,bf(n,e,Jb(n),Jb(e),0,0,{})}var Lh="focusScope.autoFocusOnMount",Ih="focusScope.autoFocusOnUnmount",ex={bubbles:!1,cancelable:!0},vR="FocusScope",Bc=m.forwardRef((n,e)=>{const{loop:i=!1,trapped:a=!1,onMountAutoFocus:r,onUnmountAutoFocus:c,...d}=n,[h,f]=m.useState(null),p=Gt(r),y=Gt(c),b=m.useRef(null),x=Ie(e,C=>f(C)),w=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(a){let C=function(k){if(w.paused||!h)return;const T=k.target;h.contains(T)?b.current=T:Zi(b.current,{select:!0})},S=function(k){if(w.paused||!h)return;const T=k.relatedTarget;T!==null&&(h.contains(T)||Zi(b.current,{select:!0}))},D=function(k){if(document.activeElement===document.body)for(const R of k)R.removedNodes.length>0&&Zi(h)};document.addEventListener("focusin",C),document.addEventListener("focusout",S);const N=new MutationObserver(D);return h&&N.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",S),N.disconnect()}}},[a,h,w.paused]),m.useEffect(()=>{if(h){nx.add(w);const C=document.activeElement;if(!h.contains(C)){const D=new CustomEvent(Lh,ex);h.addEventListener(Lh,p),h.dispatchEvent(D),D.defaultPrevented||(yR(CR(jS(h)),{select:!0}),document.activeElement===C&&Zi(h))}return()=>{h.removeEventListener(Lh,p),setTimeout(()=>{const D=new CustomEvent(Ih,ex);h.addEventListener(Ih,y),h.dispatchEvent(D),D.defaultPrevented||Zi(C??document.body,{select:!0}),h.removeEventListener(Ih,y),nx.remove(w)},0)}}},[h,p,y,w]);const E=m.useCallback(C=>{if(!i&&!a||w.paused)return;const S=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,D=document.activeElement;if(S&&D){const N=C.currentTarget,[k,T]=bR(N);k&&T?!C.shiftKey&&D===T?(C.preventDefault(),i&&Zi(k,{select:!0})):C.shiftKey&&D===k&&(C.preventDefault(),i&&Zi(T,{select:!0})):D===N&&C.preventDefault()}},[i,a,w.paused]);return l.jsx(je.div,{tabIndex:-1,...d,ref:x,onKeyDown:E})});Bc.displayName=vR;function yR(n,{select:e=!1}={}){const i=document.activeElement;for(const a of n)if(Zi(a,{select:e}),document.activeElement!==i)return}function bR(n){const e=jS(n),i=tx(e,n),a=tx(e.reverse(),n);return[i,a]}function jS(n){const e=[],i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const r=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||r?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)e.push(i.currentNode);return e}function tx(n,e){for(const i of n)if(!xR(i,{upTo:e}))return i}function xR(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function wR(n){return n instanceof HTMLInputElement&&"select"in n}function Zi(n,{select:e=!1}={}){if(n&&n.focus){const i=document.activeElement;n.focus({preventScroll:!0}),n!==i&&wR(n)&&e&&n.select()}}var nx=SR();function SR(){let n=[];return{add(e){const i=n[0];e!==i&&i?.pause(),n=ix(n,e),n.unshift(e)},remove(e){n=ix(n,e),n[0]?.resume()}}}function ix(n,e){const i=[...n],a=i.indexOf(e);return a!==-1&&i.splice(a,1),i}function CR(n){return n.filter(e=>e.tagName!=="A")}var Gh=0;function fm(){m.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??sx()),document.body.insertAdjacentElement("beforeend",n[1]??sx()),Gh++,()=>{Gh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Gh--}},[])}function sx(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var qn=function(){return qn=Object.assign||function(e){for(var i,a=1,r=arguments.length;a<r;a++){i=arguments[a];for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(e[c]=i[c])}return e},qn.apply(this,arguments)};function TS(n,e){var i={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&e.indexOf(a)<0&&(i[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(n);r<a.length;r++)e.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(n,a[r])&&(i[a[r]]=n[a[r]]);return i}function _R(n,e,i){if(i||arguments.length===2)for(var a=0,r=e.length,c;a<r;a++)(c||!(a in e))&&(c||(c=Array.prototype.slice.call(e,0,a)),c[a]=e[a]);return n.concat(c||Array.prototype.slice.call(e))}var ec="right-scroll-bar-position",tc="width-before-scroll-bar",ER="with-scroll-bars-hidden",DR="--removed-body-scroll-bar-size";function Bh(n,e){return typeof n=="function"?n(e):n&&(n.current=e),n}function AR(n,e){var i=m.useState(function(){return{value:n,callback:e,facade:{get current(){return i.value},set current(a){var r=i.value;r!==a&&(i.value=a,i.callback(a,r))}}}})[0];return i.callback=e,i.facade}var NR=typeof window<"u"?m.useLayoutEffect:m.useEffect,ax=new WeakMap;function jR(n,e){var i=AR(null,function(a){return n.forEach(function(r){return Bh(r,a)})});return NR(function(){var a=ax.get(i);if(a){var r=new Set(a),c=new Set(n),d=i.current;r.forEach(function(h){c.has(h)||Bh(h,null)}),c.forEach(function(h){r.has(h)||Bh(h,d)})}ax.set(i,n)},[n]),i}function TR(n){return n}function kR(n,e){e===void 0&&(e=TR);var i=[],a=!1,r={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:n},useMedium:function(c){var d=e(c,a);return i.push(d),function(){i=i.filter(function(h){return h!==d})}},assignSyncMedium:function(c){for(a=!0;i.length;){var d=i;i=[],d.forEach(c)}i={push:function(h){return c(h)},filter:function(){return i}}},assignMedium:function(c){a=!0;var d=[];if(i.length){var h=i;i=[],h.forEach(c),d=i}var f=function(){var y=d;d=[],y.forEach(c)},p=function(){return Promise.resolve().then(f)};p(),i={push:function(y){d.push(y),p()},filter:function(y){return d=d.filter(y),i}}}};return r}function RR(n){n===void 0&&(n={});var e=kR(null);return e.options=qn({async:!0,ssr:!1},n),e}var kS=function(n){var e=n.sideCar,i=TS(n,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=e.read();if(!a)throw new Error("Sidecar medium not found");return m.createElement(a,qn({},i))};kS.isSideCarExport=!0;function OR(n,e){return n.useMedium(e),kS}var RS=RR(),Hh=function(){},Hc=m.forwardRef(function(n,e){var i=m.useRef(null),a=m.useState({onScrollCapture:Hh,onWheelCapture:Hh,onTouchMoveCapture:Hh}),r=a[0],c=a[1],d=n.forwardProps,h=n.children,f=n.className,p=n.removeScrollBar,y=n.enabled,b=n.shards,x=n.sideCar,w=n.noRelative,E=n.noIsolation,C=n.inert,S=n.allowPinchZoom,D=n.as,N=D===void 0?"div":D,k=n.gapMode,T=TS(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=x,z=jR([i,e]),O=qn(qn({},T),r);return m.createElement(m.Fragment,null,y&&m.createElement(R,{sideCar:RS,removeScrollBar:p,shards:b,noRelative:w,noIsolation:E,inert:C,setCallbacks:c,allowPinchZoom:!!S,lockRef:i,gapMode:k}),d?m.cloneElement(m.Children.only(h),qn(qn({},O),{ref:z})):m.createElement(N,qn({},O,{className:f,ref:z}),h))});Hc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Hc.classNames={fullWidth:tc,zeroRight:ec};var zR=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function MR(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var e=zR();return e&&n.setAttribute("nonce",e),n}function PR(n,e){n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}function LR(n){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(n)}var IR=function(){var n=0,e=null;return{add:function(i){n==0&&(e=MR())&&(PR(e,i),LR(e)),n++},remove:function(){n--,!n&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},GR=function(){var n=IR();return function(e,i){m.useEffect(function(){return n.add(e),function(){n.remove()}},[e&&i])}},OS=function(){var n=GR(),e=function(i){var a=i.styles,r=i.dynamic;return n(a,r),null};return e},BR={left:0,top:0,right:0,gap:0},Vh=function(n){return parseInt(n||"",10)||0},HR=function(n){var e=window.getComputedStyle(document.body),i=e[n==="padding"?"paddingLeft":"marginLeft"],a=e[n==="padding"?"paddingTop":"marginTop"],r=e[n==="padding"?"paddingRight":"marginRight"];return[Vh(i),Vh(a),Vh(r)]},VR=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return BR;var e=HR(n),i=document.documentElement.clientWidth,a=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,a-i+e[2]-e[0])}},FR=OS(),za="data-scroll-locked",UR=function(n,e,i,a){var r=n.left,c=n.top,d=n.right,h=n.gap;return i===void 0&&(i="margin"),`
10
10
  .`.concat(ER,` {
11
11
  overflow: hidden `).concat(a,`;
12
12
  padding-right: `).concat(h,"px ").concat(a,`;
@@ -43,40 +43,40 @@ Error generating stack: `+u.message+`
43
43
  body[`).concat(za,`] {
44
44
  `).concat(DR,": ").concat(h,`px;
45
45
  }
46
- `)},ox=function(){var n=parseInt(document.body.getAttribute(za)||"0",10);return isFinite(n)?n:0},$R=function(){m.useEffect(function(){return document.body.setAttribute(za,(ox()+1).toString()),function(){var n=ox()-1;n<=0?document.body.removeAttribute(za):document.body.setAttribute(za,n.toString())}},[])},WR=function(n){var e=n.noRelative,i=n.noImportant,a=n.gapMode,r=a===void 0?"margin":a;$R();var c=m.useMemo(function(){return VR(r)},[r]);return m.createElement(FR,{styles:UR(c,!e,r,i?"":"!important")})},xf=!1;if(typeof window<"u")try{var Vl=Object.defineProperty({},"passive",{get:function(){return xf=!0,!0}});window.addEventListener("test",Vl,Vl),window.removeEventListener("test",Vl,Vl)}catch{xf=!1}var Ea=xf?{passive:!1}:!1,qR=function(n){return n.tagName==="TEXTAREA"},z0=function(n,e){if(!(n instanceof Element))return!1;var i=window.getComputedStyle(n);return i[e]!=="hidden"&&!(i.overflowY===i.overflowX&&!qR(n)&&i[e]==="visible")},YR=function(n){return z0(n,"overflowY")},XR=function(n){return z0(n,"overflowX")},rx=function(n,e){var i=e.ownerDocument,a=e;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var r=M0(n,a);if(r){var c=P0(n,a),d=c[1],h=c[2];if(d>h)return!0}a=a.parentNode}while(a&&a!==i.body);return!1},QR=function(n){var e=n.scrollTop,i=n.scrollHeight,a=n.clientHeight;return[e,i,a]},ZR=function(n){var e=n.scrollLeft,i=n.scrollWidth,a=n.clientWidth;return[e,i,a]},M0=function(n,e){return n==="v"?YR(e):XR(e)},P0=function(n,e){return n==="v"?QR(e):ZR(e)},KR=function(n,e){return n==="h"&&e==="rtl"?-1:1},JR=function(n,e,i,a,r){var c=KR(n,window.getComputedStyle(e).direction),d=c*a,h=i.target,f=e.contains(h),p=!1,y=d>0,b=0,x=0;do{if(!h)break;var w=P0(n,h),E=w[0],_=w[1],C=w[2],D=_-C-c*E;(E||D)&&M0(n,h)&&(b+=D,x+=E);var N=h.parentNode;h=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!f&&h!==document.body||f&&(e.contains(h)||e===h));return(y&&Math.abs(b)<1||!y&&Math.abs(x)<1)&&(p=!0),p},Fl=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},lx=function(n){return[n.deltaX,n.deltaY]},cx=function(n){return n&&"current"in n?n.current:n},eO=function(n,e){return n[0]===e[0]&&n[1]===e[1]},tO=function(n){return`
46
+ `)},ox=function(){var n=parseInt(document.body.getAttribute(za)||"0",10);return isFinite(n)?n:0},$R=function(){m.useEffect(function(){return document.body.setAttribute(za,(ox()+1).toString()),function(){var n=ox()-1;n<=0?document.body.removeAttribute(za):document.body.setAttribute(za,n.toString())}},[])},WR=function(n){var e=n.noRelative,i=n.noImportant,a=n.gapMode,r=a===void 0?"margin":a;$R();var c=m.useMemo(function(){return VR(r)},[r]);return m.createElement(FR,{styles:UR(c,!e,r,i?"":"!important")})},xf=!1;if(typeof window<"u")try{var Vl=Object.defineProperty({},"passive",{get:function(){return xf=!0,!0}});window.addEventListener("test",Vl,Vl),window.removeEventListener("test",Vl,Vl)}catch{xf=!1}var Ea=xf?{passive:!1}:!1,qR=function(n){return n.tagName==="TEXTAREA"},zS=function(n,e){if(!(n instanceof Element))return!1;var i=window.getComputedStyle(n);return i[e]!=="hidden"&&!(i.overflowY===i.overflowX&&!qR(n)&&i[e]==="visible")},YR=function(n){return zS(n,"overflowY")},XR=function(n){return zS(n,"overflowX")},rx=function(n,e){var i=e.ownerDocument,a=e;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var r=MS(n,a);if(r){var c=PS(n,a),d=c[1],h=c[2];if(d>h)return!0}a=a.parentNode}while(a&&a!==i.body);return!1},QR=function(n){var e=n.scrollTop,i=n.scrollHeight,a=n.clientHeight;return[e,i,a]},ZR=function(n){var e=n.scrollLeft,i=n.scrollWidth,a=n.clientWidth;return[e,i,a]},MS=function(n,e){return n==="v"?YR(e):XR(e)},PS=function(n,e){return n==="v"?QR(e):ZR(e)},KR=function(n,e){return n==="h"&&e==="rtl"?-1:1},JR=function(n,e,i,a,r){var c=KR(n,window.getComputedStyle(e).direction),d=c*a,h=i.target,f=e.contains(h),p=!1,y=d>0,b=0,x=0;do{if(!h)break;var w=PS(n,h),E=w[0],C=w[1],S=w[2],D=C-S-c*E;(E||D)&&MS(n,h)&&(b+=D,x+=E);var N=h.parentNode;h=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!f&&h!==document.body||f&&(e.contains(h)||e===h));return(y&&Math.abs(b)<1||!y&&Math.abs(x)<1)&&(p=!0),p},Fl=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},lx=function(n){return[n.deltaX,n.deltaY]},cx=function(n){return n&&"current"in n?n.current:n},eO=function(n,e){return n[0]===e[0]&&n[1]===e[1]},tO=function(n){return`
47
47
  .block-interactivity-`.concat(n,` {pointer-events: none;}
48
48
  .allow-interactivity-`).concat(n,` {pointer-events: all;}
49
- `)},nO=0,Da=[];function iO(n){var e=m.useRef([]),i=m.useRef([0,0]),a=m.useRef(),r=m.useState(nO++)[0],c=m.useState(O0)[0],d=m.useRef(n);m.useEffect(function(){d.current=n},[n]),m.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(r));var _=_R([n.lockRef.current],(n.shards||[]).map(cx),!0).filter(Boolean);return _.forEach(function(C){return C.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),_.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(r))})}}},[n.inert,n.lockRef.current,n.shards]);var h=m.useCallback(function(_,C){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!d.current.allowPinchZoom;var D=Fl(_),N=i.current,k="deltaX"in _?_.deltaX:N[0]-D[0],T="deltaY"in _?_.deltaY:N[1]-D[1],R,z=_.target,O=Math.abs(k)>Math.abs(T)?"h":"v";if("touches"in _&&O==="h"&&z.type==="range")return!1;var A=window.getSelection(),G=A&&A.anchorNode,U=G?G===z||G.contains(z):!1;if(U)return!1;var B=rx(O,z);if(!B)return!0;if(B?R=O:(R=O==="v"?"h":"v",B=rx(O,z)),!B)return!1;if(!a.current&&"changedTouches"in _&&(k||T)&&(a.current=R),!R)return!0;var $=a.current||R;return JR($,C,_,$==="h"?k:T)},[]),f=m.useCallback(function(_){var C=_;if(!(!Da.length||Da[Da.length-1]!==c)){var D="deltaY"in C?lx(C):Fl(C),N=e.current.filter(function(R){return R.name===C.type&&(R.target===C.target||C.target===R.shadowParent)&&eO(R.delta,D)})[0];if(N&&N.should){C.cancelable&&C.preventDefault();return}if(!N){var k=(d.current.shards||[]).map(cx).filter(Boolean).filter(function(R){return R.contains(C.target)}),T=k.length>0?h(C,k[0]):!d.current.noIsolation;T&&C.cancelable&&C.preventDefault()}}},[]),p=m.useCallback(function(_,C,D,N){var k={name:_,delta:C,target:D,should:N,shadowParent:sO(D)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(T){return T!==k})},1)},[]),y=m.useCallback(function(_){i.current=Fl(_),a.current=void 0},[]),b=m.useCallback(function(_){p(_.type,lx(_),_.target,h(_,n.lockRef.current))},[]),x=m.useCallback(function(_){p(_.type,Fl(_),_.target,h(_,n.lockRef.current))},[]);m.useEffect(function(){return Da.push(c),n.setCallbacks({onScrollCapture:b,onWheelCapture:b,onTouchMoveCapture:x}),document.addEventListener("wheel",f,Ea),document.addEventListener("touchmove",f,Ea),document.addEventListener("touchstart",y,Ea),function(){Da=Da.filter(function(_){return _!==c}),document.removeEventListener("wheel",f,Ea),document.removeEventListener("touchmove",f,Ea),document.removeEventListener("touchstart",y,Ea)}},[]);var w=n.removeScrollBar,E=n.inert;return m.createElement(m.Fragment,null,E?m.createElement(c,{styles:tO(r)}):null,w?m.createElement(WR,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function sO(n){for(var e=null;n!==null;)n instanceof ShadowRoot&&(e=n.host,n=n.host),n=n.parentNode;return e}const aO=OR(R0,iO);var Vc=m.forwardRef(function(n,e){return m.createElement(Hc,qn({},n,{ref:e,sideCar:aO}))});Vc.classNames=Hc.classNames;var oO=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},Aa=new WeakMap,Ul=new WeakMap,$l={},Fh=0,L0=function(n){return n&&(n.host||L0(n.parentNode))},rO=function(n,e){return e.map(function(i){if(n.contains(i))return i;var a=L0(i);return a&&n.contains(a)?a:(console.error("aria-hidden",i,"in not contained inside",n,". Doing nothing"),null)}).filter(function(i){return!!i})},lO=function(n,e,i,a){var r=rO(e,Array.isArray(n)?n:[n]);$l[i]||($l[i]=new WeakMap);var c=$l[i],d=[],h=new Set,f=new Set(r),p=function(b){!b||h.has(b)||(h.add(b),p(b.parentNode))};r.forEach(p);var y=function(b){!b||f.has(b)||Array.prototype.forEach.call(b.children,function(x){if(h.has(x))y(x);else try{var w=x.getAttribute(a),E=w!==null&&w!=="false",_=(Aa.get(x)||0)+1,C=(c.get(x)||0)+1;Aa.set(x,_),c.set(x,C),d.push(x),_===1&&E&&Ul.set(x,!0),C===1&&x.setAttribute(i,"true"),E||x.setAttribute(a,"true")}catch(D){console.error("aria-hidden: cannot operate on ",x,D)}})};return y(e),h.clear(),Fh++,function(){d.forEach(function(b){var x=Aa.get(b)-1,w=c.get(b)-1;Aa.set(b,x),c.set(b,w),x||(Ul.has(b)||b.removeAttribute(a),Ul.delete(b)),w||b.removeAttribute(i)}),Fh--,Fh||(Aa=new WeakMap,Aa=new WeakMap,Ul=new WeakMap,$l={})}},mm=function(n,e,i){i===void 0&&(i="data-aria-hidden");var a=Array.from(Array.isArray(n)?n:[n]),r=oO(n);return r?(a.push.apply(a,Array.from(r.querySelectorAll("[aria-live], script"))),lO(a,r,i,"aria-hidden")):function(){return null}},Fc="Dialog",[I0,G0]=cn(Fc),[cO,Ln]=I0(Fc),B0=n=>{const{__scopeDialog:e,children:i,open:a,defaultOpen:r,onOpenChange:c,modal:d=!0}=n,h=m.useRef(null),f=m.useRef(null),[p,y]=_n({prop:a,defaultProp:r??!1,onChange:c,caller:Fc});return l.jsx(cO,{scope:e,triggerRef:h,contentRef:f,contentId:Mt(),titleId:Mt(),descriptionId:Mt(),open:p,onOpenChange:y,onOpenToggle:m.useCallback(()=>y(b=>!b),[y]),modal:d,children:i})};B0.displayName=Fc;var H0="DialogTrigger",V0=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(H0,i),c=Ie(e,r.triggerRef);return l.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":vm(r.open),...a,ref:c,onClick:we(n.onClick,r.onOpenToggle)})});V0.displayName=H0;var pm="DialogPortal",[uO,F0]=I0(pm,{forceMount:void 0}),U0=n=>{const{__scopeDialog:e,forceMount:i,children:a,container:r}=n,c=Ln(pm,e);return l.jsx(uO,{scope:e,forceMount:i,children:m.Children.map(a,d=>l.jsx(qt,{present:i||c.open,children:l.jsx(rr,{asChild:!0,container:r,children:d})}))})};U0.displayName=pm;var yc="DialogOverlay",$0=m.forwardRef((n,e)=>{const i=F0(yc,n.__scopeDialog),{forceMount:a=i.forceMount,...r}=n,c=Ln(yc,n.__scopeDialog);return c.modal?l.jsx(qt,{present:a||c.open,children:l.jsx(hO,{...r,ref:e})}):null});$0.displayName=yc;var dO=Pa("DialogOverlay.RemoveScroll"),hO=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(yc,i);return l.jsx(Vc,{as:dO,allowPinchZoom:!0,shards:[r.contentRef],children:l.jsx(je.div,{"data-state":vm(r.open),...a,ref:e,style:{pointerEvents:"auto",...a.style}})})}),zs="DialogContent",W0=m.forwardRef((n,e)=>{const i=F0(zs,n.__scopeDialog),{forceMount:a=i.forceMount,...r}=n,c=Ln(zs,n.__scopeDialog);return l.jsx(qt,{present:a||c.open,children:c.modal?l.jsx(fO,{...r,ref:e}):l.jsx(mO,{...r,ref:e})})});W0.displayName=zs;var fO=m.forwardRef((n,e)=>{const i=Ln(zs,n.__scopeDialog),a=m.useRef(null),r=Ie(e,i.contentRef,a);return m.useEffect(()=>{const c=a.current;if(c)return mm(c)},[]),l.jsx(q0,{...n,ref:r,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(n.onCloseAutoFocus,c=>{c.preventDefault(),i.triggerRef.current?.focus()}),onPointerDownOutside:we(n.onPointerDownOutside,c=>{const d=c.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0;(d.button===2||h)&&c.preventDefault()}),onFocusOutside:we(n.onFocusOutside,c=>c.preventDefault())})}),mO=m.forwardRef((n,e)=>{const i=Ln(zs,n.__scopeDialog),a=m.useRef(!1),r=m.useRef(!1);return l.jsx(q0,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{n.onCloseAutoFocus?.(c),c.defaultPrevented||(a.current||i.triggerRef.current?.focus(),c.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:c=>{n.onInteractOutside?.(c),c.defaultPrevented||(a.current=!0,c.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const d=c.target;i.triggerRef.current?.contains(d)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&r.current&&c.preventDefault()}})}),q0=m.forwardRef((n,e)=>{const{__scopeDialog:i,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:c,...d}=n,h=Ln(zs,i),f=m.useRef(null),p=Ie(e,f);return fm(),l.jsxs(l.Fragment,{children:[l.jsx(Bc,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:c,children:l.jsx(ar,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":vm(h.open),...d,ref:p,onDismiss:()=>h.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(gO,{titleId:h.titleId}),l.jsx(yO,{contentRef:f,descriptionId:h.descriptionId})]})]})}),gm="DialogTitle",Y0=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(gm,i);return l.jsx(je.h2,{id:r.titleId,...a,ref:e})});Y0.displayName=gm;var X0="DialogDescription",Q0=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(X0,i);return l.jsx(je.p,{id:r.descriptionId,...a,ref:e})});Q0.displayName=X0;var Z0="DialogClose",K0=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(Z0,i);return l.jsx(je.button,{type:"button",...a,ref:e,onClick:we(n.onClick,()=>r.onOpenChange(!1))})});K0.displayName=Z0;function vm(n){return n?"open":"closed"}var J0="DialogTitleWarning",[pO,eS]=aj(J0,{contentName:zs,titleName:gm,docsSlug:"dialog"}),gO=({titleId:n})=>{const e=eS(J0),i=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
49
+ `)},nO=0,Da=[];function iO(n){var e=m.useRef([]),i=m.useRef([0,0]),a=m.useRef(),r=m.useState(nO++)[0],c=m.useState(OS)[0],d=m.useRef(n);m.useEffect(function(){d.current=n},[n]),m.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(r));var C=_R([n.lockRef.current],(n.shards||[]).map(cx),!0).filter(Boolean);return C.forEach(function(S){return S.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),C.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(r))})}}},[n.inert,n.lockRef.current,n.shards]);var h=m.useCallback(function(C,S){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!d.current.allowPinchZoom;var D=Fl(C),N=i.current,k="deltaX"in C?C.deltaX:N[0]-D[0],T="deltaY"in C?C.deltaY:N[1]-D[1],R,z=C.target,O=Math.abs(k)>Math.abs(T)?"h":"v";if("touches"in C&&O==="h"&&z.type==="range")return!1;var A=window.getSelection(),G=A&&A.anchorNode,U=G?G===z||G.contains(z):!1;if(U)return!1;var B=rx(O,z);if(!B)return!0;if(B?R=O:(R=O==="v"?"h":"v",B=rx(O,z)),!B)return!1;if(!a.current&&"changedTouches"in C&&(k||T)&&(a.current=R),!R)return!0;var $=a.current||R;return JR($,S,C,$==="h"?k:T)},[]),f=m.useCallback(function(C){var S=C;if(!(!Da.length||Da[Da.length-1]!==c)){var D="deltaY"in S?lx(S):Fl(S),N=e.current.filter(function(R){return R.name===S.type&&(R.target===S.target||S.target===R.shadowParent)&&eO(R.delta,D)})[0];if(N&&N.should){S.cancelable&&S.preventDefault();return}if(!N){var k=(d.current.shards||[]).map(cx).filter(Boolean).filter(function(R){return R.contains(S.target)}),T=k.length>0?h(S,k[0]):!d.current.noIsolation;T&&S.cancelable&&S.preventDefault()}}},[]),p=m.useCallback(function(C,S,D,N){var k={name:C,delta:S,target:D,should:N,shadowParent:sO(D)};e.current.push(k),setTimeout(function(){e.current=e.current.filter(function(T){return T!==k})},1)},[]),y=m.useCallback(function(C){i.current=Fl(C),a.current=void 0},[]),b=m.useCallback(function(C){p(C.type,lx(C),C.target,h(C,n.lockRef.current))},[]),x=m.useCallback(function(C){p(C.type,Fl(C),C.target,h(C,n.lockRef.current))},[]);m.useEffect(function(){return Da.push(c),n.setCallbacks({onScrollCapture:b,onWheelCapture:b,onTouchMoveCapture:x}),document.addEventListener("wheel",f,Ea),document.addEventListener("touchmove",f,Ea),document.addEventListener("touchstart",y,Ea),function(){Da=Da.filter(function(C){return C!==c}),document.removeEventListener("wheel",f,Ea),document.removeEventListener("touchmove",f,Ea),document.removeEventListener("touchstart",y,Ea)}},[]);var w=n.removeScrollBar,E=n.inert;return m.createElement(m.Fragment,null,E?m.createElement(c,{styles:tO(r)}):null,w?m.createElement(WR,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function sO(n){for(var e=null;n!==null;)n instanceof ShadowRoot&&(e=n.host,n=n.host),n=n.parentNode;return e}const aO=OR(RS,iO);var Vc=m.forwardRef(function(n,e){return m.createElement(Hc,qn({},n,{ref:e,sideCar:aO}))});Vc.classNames=Hc.classNames;var oO=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},Aa=new WeakMap,Ul=new WeakMap,$l={},Fh=0,LS=function(n){return n&&(n.host||LS(n.parentNode))},rO=function(n,e){return e.map(function(i){if(n.contains(i))return i;var a=LS(i);return a&&n.contains(a)?a:(console.error("aria-hidden",i,"in not contained inside",n,". Doing nothing"),null)}).filter(function(i){return!!i})},lO=function(n,e,i,a){var r=rO(e,Array.isArray(n)?n:[n]);$l[i]||($l[i]=new WeakMap);var c=$l[i],d=[],h=new Set,f=new Set(r),p=function(b){!b||h.has(b)||(h.add(b),p(b.parentNode))};r.forEach(p);var y=function(b){!b||f.has(b)||Array.prototype.forEach.call(b.children,function(x){if(h.has(x))y(x);else try{var w=x.getAttribute(a),E=w!==null&&w!=="false",C=(Aa.get(x)||0)+1,S=(c.get(x)||0)+1;Aa.set(x,C),c.set(x,S),d.push(x),C===1&&E&&Ul.set(x,!0),S===1&&x.setAttribute(i,"true"),E||x.setAttribute(a,"true")}catch(D){console.error("aria-hidden: cannot operate on ",x,D)}})};return y(e),h.clear(),Fh++,function(){d.forEach(function(b){var x=Aa.get(b)-1,w=c.get(b)-1;Aa.set(b,x),c.set(b,w),x||(Ul.has(b)||b.removeAttribute(a),Ul.delete(b)),w||b.removeAttribute(i)}),Fh--,Fh||(Aa=new WeakMap,Aa=new WeakMap,Ul=new WeakMap,$l={})}},mm=function(n,e,i){i===void 0&&(i="data-aria-hidden");var a=Array.from(Array.isArray(n)?n:[n]),r=oO(n);return r?(a.push.apply(a,Array.from(r.querySelectorAll("[aria-live], script"))),lO(a,r,i,"aria-hidden")):function(){return null}},Fc="Dialog",[IS,GS]=cn(Fc),[cO,Ln]=IS(Fc),BS=n=>{const{__scopeDialog:e,children:i,open:a,defaultOpen:r,onOpenChange:c,modal:d=!0}=n,h=m.useRef(null),f=m.useRef(null),[p,y]=En({prop:a,defaultProp:r??!1,onChange:c,caller:Fc});return l.jsx(cO,{scope:e,triggerRef:h,contentRef:f,contentId:Mt(),titleId:Mt(),descriptionId:Mt(),open:p,onOpenChange:y,onOpenToggle:m.useCallback(()=>y(b=>!b),[y]),modal:d,children:i})};BS.displayName=Fc;var HS="DialogTrigger",VS=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(HS,i),c=Ie(e,r.triggerRef);return l.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":vm(r.open),...a,ref:c,onClick:we(n.onClick,r.onOpenToggle)})});VS.displayName=HS;var pm="DialogPortal",[uO,FS]=IS(pm,{forceMount:void 0}),US=n=>{const{__scopeDialog:e,forceMount:i,children:a,container:r}=n,c=Ln(pm,e);return l.jsx(uO,{scope:e,forceMount:i,children:m.Children.map(a,d=>l.jsx(qt,{present:i||c.open,children:l.jsx(rr,{asChild:!0,container:r,children:d})}))})};US.displayName=pm;var yc="DialogOverlay",$S=m.forwardRef((n,e)=>{const i=FS(yc,n.__scopeDialog),{forceMount:a=i.forceMount,...r}=n,c=Ln(yc,n.__scopeDialog);return c.modal?l.jsx(qt,{present:a||c.open,children:l.jsx(hO,{...r,ref:e})}):null});$S.displayName=yc;var dO=Pa("DialogOverlay.RemoveScroll"),hO=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(yc,i);return l.jsx(Vc,{as:dO,allowPinchZoom:!0,shards:[r.contentRef],children:l.jsx(je.div,{"data-state":vm(r.open),...a,ref:e,style:{pointerEvents:"auto",...a.style}})})}),zs="DialogContent",WS=m.forwardRef((n,e)=>{const i=FS(zs,n.__scopeDialog),{forceMount:a=i.forceMount,...r}=n,c=Ln(zs,n.__scopeDialog);return l.jsx(qt,{present:a||c.open,children:c.modal?l.jsx(fO,{...r,ref:e}):l.jsx(mO,{...r,ref:e})})});WS.displayName=zs;var fO=m.forwardRef((n,e)=>{const i=Ln(zs,n.__scopeDialog),a=m.useRef(null),r=Ie(e,i.contentRef,a);return m.useEffect(()=>{const c=a.current;if(c)return mm(c)},[]),l.jsx(qS,{...n,ref:r,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(n.onCloseAutoFocus,c=>{c.preventDefault(),i.triggerRef.current?.focus()}),onPointerDownOutside:we(n.onPointerDownOutside,c=>{const d=c.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0;(d.button===2||h)&&c.preventDefault()}),onFocusOutside:we(n.onFocusOutside,c=>c.preventDefault())})}),mO=m.forwardRef((n,e)=>{const i=Ln(zs,n.__scopeDialog),a=m.useRef(!1),r=m.useRef(!1);return l.jsx(qS,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{n.onCloseAutoFocus?.(c),c.defaultPrevented||(a.current||i.triggerRef.current?.focus(),c.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:c=>{n.onInteractOutside?.(c),c.defaultPrevented||(a.current=!0,c.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const d=c.target;i.triggerRef.current?.contains(d)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&r.current&&c.preventDefault()}})}),qS=m.forwardRef((n,e)=>{const{__scopeDialog:i,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:c,...d}=n,h=Ln(zs,i),f=m.useRef(null),p=Ie(e,f);return fm(),l.jsxs(l.Fragment,{children:[l.jsx(Bc,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:c,children:l.jsx(ar,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":vm(h.open),...d,ref:p,onDismiss:()=>h.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(gO,{titleId:h.titleId}),l.jsx(yO,{contentRef:f,descriptionId:h.descriptionId})]})]})}),gm="DialogTitle",YS=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(gm,i);return l.jsx(je.h2,{id:r.titleId,...a,ref:e})});YS.displayName=gm;var XS="DialogDescription",QS=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(XS,i);return l.jsx(je.p,{id:r.descriptionId,...a,ref:e})});QS.displayName=XS;var ZS="DialogClose",KS=m.forwardRef((n,e)=>{const{__scopeDialog:i,...a}=n,r=Ln(ZS,i);return l.jsx(je.button,{type:"button",...a,ref:e,onClick:we(n.onClick,()=>r.onOpenChange(!1))})});KS.displayName=ZS;function vm(n){return n?"open":"closed"}var JS="DialogTitleWarning",[pO,e0]=aj(JS,{contentName:zs,titleName:gm,docsSlug:"dialog"}),gO=({titleId:n})=>{const e=e0(JS),i=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
50
50
 
51
51
  If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
52
52
 
53
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return m.useEffect(()=>{n&&(document.getElementById(n)||console.error(i))},[i,n]),null},vO="DialogDescriptionWarning",yO=({contentRef:n,descriptionId:e})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${eS(vO).contentName}}.`;return m.useEffect(()=>{const r=n.current?.getAttribute("aria-describedby");e&&r&&(document.getElementById(e)||console.warn(a))},[a,n,e]),null},ym=B0,bO=V0,bm=U0,Uc=$0,$c=W0,xm=Y0,wm=Q0,Sm=K0,xO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],In=xO.reduce((n,e)=>{const i=rw(`Primitive.${e}`),a=m.forwardRef((r,c)=>{const{asChild:d,...h}=r,f=d?i:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(f,{...h,ref:c})});return a.displayName=`Primitive.${e}`,{...n,[e]:a}},{}),qo='[cmdk-group=""]',Uh='[cmdk-group-items=""]',wO='[cmdk-group-heading=""]',tS='[cmdk-item=""]',ux=`${tS}:not([aria-disabled="true"])`,wf="cmdk-item-select",ka="data-value",SO=(n,e,i)=>gR(n,e,i),nS=m.createContext(void 0),cr=()=>m.useContext(nS),iS=m.createContext(void 0),Cm=()=>m.useContext(iS),sS=m.createContext(void 0),aS=m.forwardRef((n,e)=>{let i=Ra(()=>{var L,ee;return{search:"",value:(ee=(L=n.value)!=null?L:n.defaultValue)!=null?ee:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Ra(()=>new Set),r=Ra(()=>new Map),c=Ra(()=>new Map),d=Ra(()=>new Set),h=oS(n),{label:f,children:p,value:y,onValueChange:b,filter:x,shouldFilter:w,loop:E,disablePointerSelection:_=!1,vimBindings:C=!0,...D}=n,N=Mt(),k=Mt(),T=Mt(),R=m.useRef(null),z=OO();Ms(()=>{if(y!==void 0){let L=y.trim();i.current.value=L,O.emit()}},[y]),Ms(()=>{z(6,ae)},[]);let O=m.useMemo(()=>({subscribe:L=>(d.current.add(L),()=>d.current.delete(L)),snapshot:()=>i.current,setState:(L,ee,V)=>{var Y,le,X,ce;if(!Object.is(i.current[L],ee)){if(i.current[L]=ee,L==="search")$(),U(),z(1,B);else if(L==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let de=document.getElementById(T);de?de.focus():(Y=document.getElementById(N))==null||Y.focus()}if(z(7,()=>{var de;i.current.selectedItemId=(de=ne())==null?void 0:de.id,O.emit()}),V||z(5,ae),((le=h.current)==null?void 0:le.value)!==void 0){let de=ee??"";(ce=(X=h.current).onValueChange)==null||ce.call(X,de);return}}O.emit()}},emit:()=>{d.current.forEach(L=>L())}}),[]),A=m.useMemo(()=>({value:(L,ee,V)=>{var Y;ee!==((Y=c.current.get(L))==null?void 0:Y.value)&&(c.current.set(L,{value:ee,keywords:V}),i.current.filtered.items.set(L,G(ee,V)),z(2,()=>{U(),O.emit()}))},item:(L,ee)=>(a.current.add(L),ee&&(r.current.has(ee)?r.current.get(ee).add(L):r.current.set(ee,new Set([L]))),z(3,()=>{$(),U(),i.current.value||B(),O.emit()}),()=>{c.current.delete(L),a.current.delete(L),i.current.filtered.items.delete(L);let V=ne();z(4,()=>{$(),V?.getAttribute("id")===L&&B(),O.emit()})}),group:L=>(r.current.has(L)||r.current.set(L,new Set),()=>{c.current.delete(L),r.current.delete(L)}),filter:()=>h.current.shouldFilter,label:f||n["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:N,inputId:T,labelId:k,listInnerRef:R}),[]);function G(L,ee){var V,Y;let le=(Y=(V=h.current)==null?void 0:V.filter)!=null?Y:SO;return L?le(L,i.current.search,ee):0}function U(){if(!i.current.search||h.current.shouldFilter===!1)return;let L=i.current.filtered.items,ee=[];i.current.filtered.groups.forEach(Y=>{let le=r.current.get(Y),X=0;le.forEach(ce=>{let de=L.get(ce);X=Math.max(de,X)}),ee.push([Y,X])});let V=R.current;W().sort((Y,le)=>{var X,ce;let de=Y.getAttribute("id"),De=le.getAttribute("id");return((X=L.get(De))!=null?X:0)-((ce=L.get(de))!=null?ce:0)}).forEach(Y=>{let le=Y.closest(Uh);le?le.appendChild(Y.parentElement===le?Y:Y.closest(`${Uh} > *`)):V.appendChild(Y.parentElement===V?Y:Y.closest(`${Uh} > *`))}),ee.sort((Y,le)=>le[1]-Y[1]).forEach(Y=>{var le;let X=(le=R.current)==null?void 0:le.querySelector(`${qo}[${ka}="${encodeURIComponent(Y[0])}"]`);X?.parentElement.appendChild(X)})}function B(){let L=W().find(V=>V.getAttribute("aria-disabled")!=="true"),ee=L?.getAttribute(ka);O.setState("value",ee||void 0)}function $(){var L,ee,V,Y;if(!i.current.search||h.current.shouldFilter===!1){i.current.filtered.count=a.current.size;return}i.current.filtered.groups=new Set;let le=0;for(let X of a.current){let ce=(ee=(L=c.current.get(X))==null?void 0:L.value)!=null?ee:"",de=(Y=(V=c.current.get(X))==null?void 0:V.keywords)!=null?Y:[],De=G(ce,de);i.current.filtered.items.set(X,De),De>0&&le++}for(let[X,ce]of r.current)for(let de of ce)if(i.current.filtered.items.get(de)>0){i.current.filtered.groups.add(X);break}i.current.filtered.count=le}function ae(){var L,ee,V;let Y=ne();Y&&(((L=Y.parentElement)==null?void 0:L.firstChild)===Y&&((V=(ee=Y.closest(qo))==null?void 0:ee.querySelector(wO))==null||V.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function ne(){var L;return(L=R.current)==null?void 0:L.querySelector(`${tS}[aria-selected="true"]`)}function W(){var L;return Array.from(((L=R.current)==null?void 0:L.querySelectorAll(ux))||[])}function M(L){let ee=W()[L];ee&&O.setState("value",ee.getAttribute(ka))}function K(L){var ee;let V=ne(),Y=W(),le=Y.findIndex(ce=>ce===V),X=Y[le+L];(ee=h.current)!=null&&ee.loop&&(X=le+L<0?Y[Y.length-1]:le+L===Y.length?Y[0]:Y[le+L]),X&&O.setState("value",X.getAttribute(ka))}function q(L){let ee=ne(),V=ee?.closest(qo),Y;for(;V&&!Y;)V=L>0?kO(V,qo):RO(V,qo),Y=V?.querySelector(ux);Y?O.setState("value",Y.getAttribute(ka)):K(L)}let he=()=>M(W().length-1),Se=L=>{L.preventDefault(),L.metaKey?he():L.altKey?q(1):K(1)},I=L=>{L.preventDefault(),L.metaKey?M(0):L.altKey?q(-1):K(-1)};return m.createElement(In.div,{ref:e,tabIndex:-1,...D,"cmdk-root":"",onKeyDown:L=>{var ee;(ee=D.onKeyDown)==null||ee.call(D,L);let V=L.nativeEvent.isComposing||L.keyCode===229;if(!(L.defaultPrevented||V))switch(L.key){case"n":case"j":{C&&L.ctrlKey&&Se(L);break}case"ArrowDown":{Se(L);break}case"p":case"k":{C&&L.ctrlKey&&I(L);break}case"ArrowUp":{I(L);break}case"Home":{L.preventDefault(),M(0);break}case"End":{L.preventDefault(),he();break}case"Enter":{L.preventDefault();let Y=ne();if(Y){let le=new Event(wf);Y.dispatchEvent(le)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:MO},f),Wc(n,L=>m.createElement(iS.Provider,{value:O},m.createElement(nS.Provider,{value:A},L))))}),CO=m.forwardRef((n,e)=>{var i,a;let r=Mt(),c=m.useRef(null),d=m.useContext(sS),h=cr(),f=oS(n),p=(a=(i=f.current)==null?void 0:i.forceMount)!=null?a:d?.forceMount;Ms(()=>{if(!p)return h.item(r,d?.id)},[p]);let y=rS(r,c,[n.value,n.children,c],n.keywords),b=Cm(),x=is(z=>z.value&&z.value===y.current),w=is(z=>p||h.filter()===!1?!0:z.search?z.filtered.items.get(r)>0:!0);m.useEffect(()=>{let z=c.current;if(!(!z||n.disabled))return z.addEventListener(wf,E),()=>z.removeEventListener(wf,E)},[w,n.onSelect,n.disabled]);function E(){var z,O;_(),(O=(z=f.current).onSelect)==null||O.call(z,y.current)}function _(){b.setState("value",y.current,!0)}if(!w)return null;let{disabled:C,value:D,onSelect:N,forceMount:k,keywords:T,...R}=n;return m.createElement(In.div,{ref:es(c,e),...R,id:r,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!x,"data-disabled":!!C,"data-selected":!!x,onPointerMove:C||h.getDisablePointerSelection()?void 0:_,onClick:C?void 0:E},n.children)}),_O=m.forwardRef((n,e)=>{let{heading:i,children:a,forceMount:r,...c}=n,d=Mt(),h=m.useRef(null),f=m.useRef(null),p=Mt(),y=cr(),b=is(w=>r||y.filter()===!1?!0:w.search?w.filtered.groups.has(d):!0);Ms(()=>y.group(d),[]),rS(d,h,[n.value,n.heading,f]);let x=m.useMemo(()=>({id:d,forceMount:r}),[r]);return m.createElement(In.div,{ref:es(h,e),...c,"cmdk-group":"",role:"presentation",hidden:b?void 0:!0},i&&m.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:p},i),Wc(n,w=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?p:void 0},m.createElement(sS.Provider,{value:x},w))))}),EO=m.forwardRef((n,e)=>{let{alwaysRender:i,...a}=n,r=m.useRef(null),c=is(d=>!d.search);return!i&&!c?null:m.createElement(In.div,{ref:es(r,e),...a,"cmdk-separator":"",role:"separator"})}),DO=m.forwardRef((n,e)=>{let{onValueChange:i,...a}=n,r=n.value!=null,c=Cm(),d=is(p=>p.search),h=is(p=>p.selectedItemId),f=cr();return m.useEffect(()=>{n.value!=null&&c.setState("search",n.value)},[n.value]),m.createElement(In.input,{ref:e,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,"aria-activedescendant":h,id:f.inputId,type:"text",value:r?n.value:d,onChange:p=>{r||c.setState("search",p.target.value),i?.(p.target.value)}})}),AO=m.forwardRef((n,e)=>{let{children:i,label:a="Suggestions",...r}=n,c=m.useRef(null),d=m.useRef(null),h=is(p=>p.selectedItemId),f=cr();return m.useEffect(()=>{if(d.current&&c.current){let p=d.current,y=c.current,b,x=new ResizeObserver(()=>{b=requestAnimationFrame(()=>{let w=p.offsetHeight;y.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return x.observe(p),()=>{cancelAnimationFrame(b),x.unobserve(p)}}},[]),m.createElement(In.div,{ref:es(c,e),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":a,id:f.listId},Wc(n,p=>m.createElement("div",{ref:es(d,f.listInnerRef),"cmdk-list-sizer":""},p)))}),NO=m.forwardRef((n,e)=>{let{open:i,onOpenChange:a,overlayClassName:r,contentClassName:c,container:d,...h}=n;return m.createElement(ym,{open:i,onOpenChange:a},m.createElement(bm,{container:d},m.createElement(Uc,{"cmdk-overlay":"",className:r}),m.createElement($c,{"aria-label":n.label,"cmdk-dialog":"",className:c},m.createElement(aS,{ref:e,...h}))))}),jO=m.forwardRef((n,e)=>is(i=>i.filtered.count===0)?m.createElement(In.div,{ref:e,...n,"cmdk-empty":"",role:"presentation"}):null),TO=m.forwardRef((n,e)=>{let{progress:i,children:a,label:r="Loading...",...c}=n;return m.createElement(In.div,{ref:e,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},Wc(n,d=>m.createElement("div",{"aria-hidden":!0},d)))}),Yt=Object.assign(aS,{List:AO,Item:CO,Input:DO,Group:_O,Separator:EO,Dialog:NO,Empty:jO,Loading:TO});function kO(n,e){let i=n.nextElementSibling;for(;i;){if(i.matches(e))return i;i=i.nextElementSibling}}function RO(n,e){let i=n.previousElementSibling;for(;i;){if(i.matches(e))return i;i=i.previousElementSibling}}function oS(n){let e=m.useRef(n);return Ms(()=>{e.current=n}),e}var Ms=typeof window>"u"?m.useEffect:m.useLayoutEffect;function Ra(n){let e=m.useRef();return e.current===void 0&&(e.current=n()),e}function is(n){let e=Cm(),i=()=>n(e.snapshot());return m.useSyncExternalStore(e.subscribe,i,i)}function rS(n,e,i,a=[]){let r=m.useRef(),c=cr();return Ms(()=>{var d;let h=(()=>{var p;for(let y of i){if(typeof y=="string")return y.trim();if(typeof y=="object"&&"current"in y)return y.current?(p=y.current.textContent)==null?void 0:p.trim():r.current}})(),f=a.map(p=>p.trim());c.value(n,h,f),(d=e.current)==null||d.setAttribute(ka,h),r.current=h}),r}var OO=()=>{let[n,e]=m.useState(),i=Ra(()=>new Map);return Ms(()=>{i.current.forEach(a=>a()),i.current=new Map},[n]),(a,r)=>{i.current.set(a,r),e({})}};function zO(n){let e=n.type;return typeof e=="function"?e(n.props):"render"in e?e.render(n.props):n}function Wc({asChild:n,children:e},i){return n&&m.isValidElement(e)?m.cloneElement(zO(e),{ref:e.ref},i(e.props.children)):i(e)}var MO={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const lS=(...n)=>n.filter((e,i,a)=>!!e&&e.trim()!==""&&a.indexOf(e)===i).join(" ").trim();const PO=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const LO=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,i,a)=>a?a.toUpperCase():i.toLowerCase());const dx=n=>{const e=LO(n);return e.charAt(0).toUpperCase()+e.slice(1)};var IO={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const GO=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const BO=m.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:a,className:r="",children:c,iconNode:d,...h},f)=>m.createElement("svg",{ref:f,...IO,width:e,height:e,stroke:n,strokeWidth:a?Number(i)*24/Number(e):i,className:lS("lucide",r),...!c&&!GO(h)&&{"aria-hidden":"true"},...h},[...d.map(([p,y])=>m.createElement(p,y)),...Array.isArray(c)?c:[c]]));const Xt=(n,e)=>{const i=m.forwardRef(({className:a,...r},c)=>m.createElement(BO,{ref:c,iconNode:e,className:lS(`lucide-${PO(dx(n))}`,`lucide-${n}`,a),...r}));return i.displayName=dx(n),i};const HO=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]],VO=Xt("bell-ring",HO);const FO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ga=Xt("check",FO);const UO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],cS=Xt("chevron-down",UO);const $O=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],WO=Xt("chevron-up",$O);const qO=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],YO=Xt("chevrons-up-down",qO);const XO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],QO=Xt("circle",XO);const ZO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],KO=Xt("copy",ZO);const JO=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],ez=Xt("loader",JO);const tz=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],nz=Xt("rotate-ccw",tz);const iz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],sz=Xt("search",iz);const az=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],oz=Xt("triangle-alert",az);const rz=[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],lz=Xt("user-cog",rz);const cz=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],uz=Xt("x",cz);const dz=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],hz=Xt("zap",dz),qc=ym,fz=bm,uS=m.forwardRef(({className:n,...e},i)=>l.jsx(Uc,{ref:i,className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...e}));uS.displayName=Uc.displayName;const ur=m.forwardRef(({className:n,children:e,...i},a)=>l.jsxs(fz,{children:[l.jsx(uS,{}),l.jsxs($c,{ref:a,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-[var(--border)] bg-card text-card-foreground p-6 shadow-2xl shadow-black/40 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...i,children:[e,l.jsxs(Sm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(uz,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ur.displayName=$c.displayName;const Yc=({className:n,...e})=>l.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",n),...e});Yc.displayName="DialogHeader";const _m=({className:n,...e})=>l.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e});_m.displayName="DialogFooter";const Xc=m.forwardRef(({className:n,...e},i)=>l.jsx(xm,{ref:i,className:ye("text-base font-medium leading-none tracking-tight",n),...e}));Xc.displayName=xm.displayName;const Qc=m.forwardRef(({className:n,...e},i)=>l.jsx(wm,{ref:i,className:ye("text-sm text-[var(--text-secondary)]",n),...e}));Qc.displayName=wm.displayName;const Em=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt,{ref:i,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",n),...e}));Em.displayName=Yt.displayName;const Dm=m.forwardRef(({className:n,...e},i)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(sz,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(Yt.Input,{ref:i,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",n),...e})]}));Dm.displayName=Yt.Input.displayName;const Am=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt.List,{ref:i,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",n),...e}));Am.displayName=Yt.List.displayName;const Nm=m.forwardRef((n,e)=>l.jsx(Yt.Empty,{ref:e,className:"py-6 text-center text-sm",...n}));Nm.displayName=Yt.Empty.displayName;const nr=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt.Group,{ref:i,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",n),...e}));nr.displayName=Yt.Group.displayName;const mz=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt.Separator,{ref:i,className:ye("-mx-1 h-px bg-border",n),...e}));mz.displayName=Yt.Separator.displayName;const ir=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt.Item,{ref:i,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n),...e}));ir.displayName=Yt.Item.displayName;const Sf=({className:n,...e})=>l.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",n),...e});Sf.displayName="CommandShortcut";const pz=["Panels","Navigation","Settings","Agents"],gz="command-palette-search",vz="command-palette-results",hx="command-palette-shortcut",yz="command-palette-recent",dS="cyclist:recent-commands",bz=5,hS=[{id:"toggle-changed-panel",name:"Toggle Changed Files",category:"Panels",shortcut:"Cmd+Shift+1"},{id:"toggle-diffs-panel",name:"Toggle Diffs",category:"Panels",shortcut:"Cmd+Shift+2"},{id:"toggle-message-panel",name:"Toggle Messages",category:"Panels",shortcut:"Cmd+Shift+3"},{id:"toggle-debug-panel",name:"Toggle Debug",category:"Panels"},{id:"focus-input",name:"Focus Input",category:"Navigation",shortcut:"Cmd+L"},{id:"scroll-to-bottom",name:"Scroll to Bottom",category:"Navigation",shortcut:"Cmd+End"},{id:"scroll-to-top",name:"Scroll to Top",category:"Navigation",shortcut:"Cmd+Home"},{id:"open-settings",name:"Open Settings",category:"Settings",shortcut:"Cmd+,"},{id:"toggle-theme",name:"Toggle Theme",category:"Settings"},{id:"run-sm",name:"Start Scrum Master",category:"Agents"},{id:"run-tea",name:"Start TEA",category:"Agents"},{id:"run-dev",name:"Start Dev",category:"Agents"},{id:"run-reviewer",name:"Start Reviewer",category:"Agents"}];let fS=0;function xz(){return fS}function wz(n){fS=n}function Sz(){if(typeof navigator>"u")return"mac";const n=navigator.platform?.toLowerCase()||"";return n.includes("mac")?"mac":n.includes("win")?"windows":"linux"}function Cz(n){const e=n.key.toLowerCase()==="p",i=n.metaKey||n.ctrlKey,a=n.shiftKey;return e&&i&&a}function fx(n,e){return e==="mac"?n.replace(/Cmd/g,"⌘").replace(/Shift/g,"⇧").replace(/Alt/g,"⌥").replace(/Ctrl/g,"⌃").replace(/\+/g,""):n.replace(/Cmd/g,"Ctrl")}function _z(n){const e={};for(const i of n)e[i.category]||(e[i.category]=[]),e[i.category].push(i);return e}function Ez(n){Dz(n.id),n.handler&&n.handler()}function mS(){if(typeof localStorage>"u")return[];try{const n=localStorage.getItem(dS);return n?JSON.parse(n):[]}catch{return[]}}function Dz(n){if(typeof localStorage>"u")return;const e=mS().filter(a=>a!==n);e.unshift(n);const i=e.slice(0,bz);localStorage.setItem(dS,JSON.stringify(i))}const Az=new Map;function Nz(n){Az.set(n.id,n)}hS.forEach(n=>Nz(n));const jz=m.createContext(null);function Tz(){const[n,e]=m.useState(!1),[i]=m.useState(hS),a=m.useCallback(()=>{e(!0),wz(0)},[]),r=m.useCallback(()=>{e(!1)},[]),c=m.useCallback(()=>{n?r():a()},[n,a,r]);return{isOpen:n,open:a,close:r,toggle:c,commands:i,selectedIndex:xz()}}let $h=!1,Wl=null;function kz(n){if(Wl=n,!$h){const e=i=>{Cz(i)&&(i.preventDefault(),Wl?.())};return document.addEventListener("keydown",e),$h=!0,()=>{document.removeEventListener("keydown",e),$h=!1,Wl=null}}return()=>{Wl=null}}function Rz({children:n}){const e=Tz();m.useEffect(()=>kz(e.open),[e.open]),m.useEffect(()=>{const r=()=>e.close();return document.addEventListener("cyclist:close-command-palette",r),()=>document.removeEventListener("cyclist:close-command-palette",r)},[e.close]);const i=m.useCallback(r=>{Ez(r),e.close()},[e.close]),a={isOpen:e.isOpen,open:e.open,close:e.close,toggle:e.toggle};return l.jsxs(jz.Provider,{value:a,children:[n,l.jsx(Oz,{commands:e.commands,isOpen:e.isOpen,onClose:e.close,onExecute:i})]})}function Oz({commands:n,onClose:e,onExecute:i,isOpen:a=!0}){const r=Sz(),c=mS(),d=_z(n),h=n.filter(f=>c.includes(f.id));return l.jsx(qc,{open:a,onOpenChange:f=>{f||e()},children:l.jsx(ur,{className:"overflow-hidden p-0","aria-label":"Command palette",children:l.jsxs(Em,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[l.jsx(Dm,{placeholder:"Type a command...",id:gz,"aria-label":"Search commands"}),l.jsxs(Am,{id:vz,children:[l.jsx(Nm,{children:"No matching commands"}),h.length>0&&l.jsx(nr,{heading:"Recent",className:yz,children:h.map(f=>l.jsxs(ir,{value:f.name,onSelect:()=>i(f),className:"command-palette-item",children:[l.jsx("span",{children:f.name}),f.shortcut&&l.jsx(Sf,{className:hx,children:fx(f.shortcut,r)})]},`recent-${f.id}`))}),pz.map(f=>{const p=d[f];return p?.length?l.jsx(nr,{heading:f,children:p.map(y=>l.jsxs(ir,{value:y.name,onSelect:()=>i(y),className:"command-palette-item",children:[l.jsx("span",{children:y.name}),y.shortcut&&l.jsx(Sf,{className:hx,children:fx(y.shortcut,r)})]},y.id))},f):null})]})]})})})}const jm=m.createContext(null);function zz({children:n}){const[e,i]=m.useState(!1),[a,r]=m.useState("default"),c=m.useRef(null),d=m.useRef(),h=m.useRef(new Set),f=m.useRef(new Set),p=m.useRef(new Set),y=m.useRef(new Set),b=m.useRef(new Set),x=m.useCallback(()=>{const A=window.location.protocol==="https:"?"wss:":"ws:",G=window.location.host,U=`${A}//${G}/ws/claude`;console.log("[ClaudeContext] Connecting to",U);const B=new WebSocket(U);c.current=B,B.onopen=()=>{console.log("[ClaudeContext] Connected"),i(!0)},B.onmessage=$=>{try{const ae=JSON.parse($.data);switch(ae.type){case"message":ae.message&&h.current.forEach(ne=>ne(ae.message));break;case"complete":f.current.forEach(ne=>ne());break;case"error":ae.error&&p.current.forEach(ne=>ne(ae.error));break;case"init":console.log("[ClaudeContext] Init received");break}}catch(ae){console.error("[ClaudeContext] Failed to parse message:",ae)}},B.onclose=()=>{console.log("[ClaudeContext] Disconnected"),i(!1),c.current=null,d.current=setTimeout(()=>{console.log("[ClaudeContext] Attempting reconnect..."),x()},2e3)},B.onerror=$=>{console.error("[ClaudeContext] WebSocket error:",$)}},[]);m.useEffect(()=>(x(),()=>{d.current&&clearTimeout(d.current),c.current&&(c.current.close(),c.current=null)}),[x]);const w=m.useCallback((A,G)=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.error("[ClaudeContext] Cannot send: not connected"),p.current.forEach(B=>B("Not connected to Claude service"));return}const U={prompt:A,images:G||[],timestamp:Date.now()};y.current.forEach(B=>B(U)),c.current.send(JSON.stringify({type:"send",prompt:A,images:G}))},[]),E=m.useCallback(()=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.warn("[ClaudeContext] Cannot abort: not connected");return}c.current.send(JSON.stringify({type:"abort"}))},[]),_=m.useCallback(()=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.warn("[ClaudeContext] Cannot clear: not connected");return}c.current.send(JSON.stringify({type:"clear"})),b.current.forEach(A=>A())},[]),C=m.useCallback(A=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.warn("[ClaudeContext] Cannot clearAndReload: not connected");return}console.log("[ClaudeContext] TirePump: clearAndReload agent:",A),c.current.send(JSON.stringify({type:"clearAndReload",agent:A})),b.current.forEach(G=>G())},[]),D=m.useCallback(A=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.warn("[ClaudeContext] Cannot set mode: not connected");return}c.current.send(JSON.stringify({type:"setMode",mode:A})),r(A)},[]),N=m.useCallback(A=>(h.current.add(A),()=>{h.current.delete(A)}),[]),k=m.useCallback(A=>(f.current.add(A),()=>{f.current.delete(A)}),[]),T=m.useCallback(A=>(p.current.add(A),()=>{p.current.delete(A)}),[]),R=m.useCallback(A=>(y.current.add(A),()=>{y.current.delete(A)}),[]),z=m.useCallback(A=>(b.current.add(A),()=>{b.current.delete(A)}),[]),O=m.useMemo(()=>({send:w,abort:E,clear:_,clearAndReload:C,setMode:D,isConnected:e,mode:a,onMessage:N,onComplete:k,onError:T,onUserMessage:R,onClear:z}),[w,E,_,C,D,e,a,N,k,T,R,z]);return l.jsx(jm.Provider,{value:O,children:n})}function dr(){const n=m.useContext(jm);if(!n)throw new Error("useClaudeContext must be used within a ClaudeProvider");return n}const Mz=10,Wh="cyclist-message-queue";async function Pz(n){try{await fetch("/api/bell-queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(e){console.debug("[MessageQueue] Bell queue sync error:",e)}}function Lz(){const[n,e]=m.useState(()=>{try{const O=localStorage.getItem(Wh);return O?JSON.parse(O):[]}catch{return[]}}),[i,a]=m.useState(!1),[r,c]=m.useState(!1),[d,h]=m.useState(!1),f=m.useRef(n),p=m.useRef(r),y=m.useRef(new Set);m.useEffect(()=>{f.current=n},[n]),m.useEffect(()=>{p.current=r},[r]),m.useEffect(()=>{fetch("/api/settings").then(G=>G.json()).then(G=>{G?.workflow?.bell_mode&&c(!0)}).catch(G=>console.debug("[MessageQueue] Failed to load settings:",G));const O=window.location.protocol==="https:"?"wss:":"ws:",A=new WebSocket(`${O}//${window.location.host}/ws/settings`);return A.onmessage=G=>{try{const U=JSON.parse(G.data);if(U.type==="init"||U.type==="update"){const B=U.settings?.workflow;c(!!B?.bell_mode)}}catch{}},()=>A.close()},[]),m.useEffect(()=>{const A=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/bell`;let G=null,U;const B=()=>{try{G=new WebSocket(A),G.onmessage=$=>{try{if(JSON.parse($.data).type==="bell-consumed"){const ne=f.current[0];e(W=>{if(W.length===0)return W;const M=W.slice(1);try{localStorage.setItem(Wh,JSON.stringify(M))}catch{}return M}),ne&&(console.log("[MessageQueue] Bell consumed, notifying callbacks:",ne.text),y.current.forEach(W=>{try{W(ne)}catch(M){console.error("[MessageQueue] Bell consumed callback error:",M)}}))}}catch(ae){console.error("[MessageQueue] Failed to parse bell message:",ae)}},G.onclose=()=>{console.log("[MessageQueue] Bell WebSocket closed, reconnecting..."),U=setTimeout(B,2e3)},G.onerror=()=>{}}catch($){console.debug("[MessageQueue] Bell WebSocket init failed:",$)}};return B(),()=>{clearTimeout(U),G?.close()}},[]);const b=m.useCallback(O=>{try{localStorage.setItem(Wh,JSON.stringify(O))}catch{}Pz(O)},[]),x=m.useCallback(O=>!O.text.trim()&&O.images.length===0||f.current.length>=Mz?!1:(e(A=>{const G=[...A,O];return b(G),G}),!0),[b]),w=m.useCallback(()=>{let O=null;return e(A=>{if(A.length===0)return A;O=A[0];const G=A.slice(1);return b(G),G}),O},[b]),E=m.useCallback(O=>{e(A=>{if(O<0||O>=A.length)return A;const G=[...A.slice(0,O),...A.slice(O+1)];return b(G),G})},[b]),_=m.useCallback(()=>{e([]),b([])},[b]),C=m.useCallback(O=>{a(O)},[]),D=m.useCallback(O=>{c(O)},[]),N=m.useCallback(()=>{h(!0),console.log("[MessageQueue] Queue paused")},[]),k=m.useCallback(()=>{h(!1),console.log("[MessageQueue] Queue resumed")},[]),T=m.useCallback(O=>{if(d){console.log("[MessageQueue] Queue paused, skipping turn complete");return}const A=f.current;if(A.length!==0){console.log("[MessageQueue] Turn complete, sending",A.length,"queued messages");for(const G of A)O(G.text,G.images);e([]),b([])}},[d,b]),R=m.useCallback(O=>(y.current.add(O),()=>{y.current.delete(O)}),[]),z=m.useCallback(async(O,A)=>{const G=f.current;if(O<0||O>=G.length)return!1;const U=G[O];return U?(e(B=>{const $=[...B.slice(0,O),...B.slice(O+1)];return b($),$}),console.log("[MessageQueue] Injecting message, aborting Claude..."),A.abort(),await new Promise(B=>setTimeout(B,100)),console.log("[MessageQueue] Submitting injected message:",U.text),A.submit(U.text,U.images),!0):!1},[b]);return{queue:n,queueCount:n.length,isProcessing:i,bellMode:r,queuePaused:d,queueMessage:x,dequeueMessage:w,removeFromQueue:E,clearQueue:_,setProcessing:C,setBellMode:D,pauseQueue:N,resumeQueue:k,handleTurnComplete:T,onBellConsumed:R,injectMessage:z}}const pS=m.createContext(null);function Iz({children:n}){const{queue:e,queueCount:i,isProcessing:a,bellMode:r,queuePaused:c,queueMessage:d,dequeueMessage:h,removeFromQueue:f,clearQueue:p,setProcessing:y,setBellMode:b,pauseQueue:x,resumeQueue:w,handleTurnComplete:E,onBellConsumed:_,injectMessage:C}=Lz(),D=m.useMemo(()=>({queue:e,queueCount:i,isProcessing:a,bellMode:r,queuePaused:c,queueMessage:d,dequeueMessage:h,removeFromQueue:f,clearQueue:p,setProcessing:y,setBellMode:b,pauseQueue:x,resumeQueue:w,handleTurnComplete:E,onBellConsumed:_,injectMessage:C}),[e,i,a,r,c,d,h,f,p,y,b,x,w,E,_,C]);return l.jsx(pS.Provider,{value:D,children:n})}function gS(){const n=m.useContext(pS);if(!n)throw new Error("useMessageQueueContext must be used within a MessageQueueProvider");return n}const Gz=300;function Bz(n){if(!n||typeof n!="object")return!1;const e=n;if(!e.grid||typeof e.grid!="object"||!e.panels||typeof e.panels!="object"||Object.keys(e.panels).length===0)return!1;const i=e.grid;return!(!i.root||typeof i.width!="number"||typeof i.height!="number")}function Hz(n="/api/settings/layout"){const[e,i]=m.useState(null),[a,r]=m.useState(!0),[c,d]=m.useState(!1),[h,f]=m.useState(null),p=m.useRef(null),y=m.useRef(null);m.useEffect(()=>{(async()=>{try{const w=await fetch(n);if(w.ok){const E=await w.json();E.layout&&Bz(E.layout)?i(E.layout):i(null)}else i(null)}catch(w){console.error("[useLayoutPersistence] Failed to load layout:",w),i(null),f(w instanceof Error?w:new Error("Failed to load layout"))}finally{r(!1)}})()},[n]);const b=m.useCallback(x=>{y.current=x,p.current&&clearTimeout(p.current),p.current=setTimeout(async()=>{const w=y.current;if(w){d(!0);try{if(!(await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)})).ok)throw new Error("Failed to save layout");f(null)}catch(E){console.error("[useLayoutPersistence] Failed to save layout:",E),f(E instanceof Error?E:new Error("Failed to save layout"))}finally{d(!1)}}},Gz)},[n]);return m.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),{layout:e,isLoading:a,isSaving:c,error:h,saveLayout:b}}const vS=[{id:"system",name:"System",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},{id:"inter",name:"Inter",fontFamily:"'Inter', system-ui, -apple-system, sans-serif"},{id:"custom",name:"Custom",fontFamily:"",isCustom:!0}],yS=[{id:"system-mono",name:"System Mono",fontFamily:"ui-monospace, 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace"},{id:"jetbrains-mono",name:"JetBrains Mono",fontFamily:"'JetBrains Mono', ui-monospace, 'SF Mono', Monaco, monospace"},{id:"fira-code",name:"Fira Code",fontFamily:"'Fira Code', ui-monospace, 'SF Mono', Monaco, monospace"},{id:"custom",name:"Custom",fontFamily:"",isCustom:!0}],Cf={xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem"};function mx(n){return!n||typeof n!="string"?"":n.replace(/[;{}()<>\\]/g,"").replace(/javascript:/gi,"").replace(/expression\s*\(/gi,"").trim().slice(0,500)}const Tm={uiFont:"system",codeFont:"system-mono",uiFontSize:"base",codeFontSize:"base"};let bc={...Tm};function Vz(n,e){document.documentElement.style.setProperty("--font-size-ui",Cf[n]),document.documentElement.style.setProperty("--font-size-code",Cf[e])}function nc(n){const e=vS.find(a=>a.id===n.uiFont);if(e){const a=e.isCustom&&n.customUiFont?mx(n.customUiFont):e.fontFamily;document.documentElement.style.setProperty("--font-ui",a)}const i=yS.find(a=>a.id===n.codeFont);if(i){const a=i.isCustom&&n.customCodeFont?mx(n.customCodeFont):i.fontFamily;document.documentElement.style.setProperty("--font-mono",a)}Vz(n.uiFontSize,n.codeFontSize),bc={...n}}async function px(n){bc={...n};try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({display:{fonts:n}})})}catch(e){console.error("[font-presets] Failed to save settings:",e)}}async function bS(){try{const n=await fetch("/api/settings");if(n.ok){const e=await n.json();if(e?.display?.fonts)return bc={...e.display.fonts},bc}}catch(n){console.error("[font-presets] Failed to load settings:",n)}return{...Tm}}const ic="midnight",xS={midnight:{id:"midnight",name:"Midnight",variant:"dark",colors:{bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgTertiary:"#0f0f1a",textPrimary:"#e4e4e7",textSecondary:"#a1a1aa",textMuted:"#71717a",accent:"#818cf8",accentHover:"#a5b4fc",border:"#27272a",borderFocus:"#818cf8"},terminalColors:{background:"#0f0f1a",foreground:"#e4e4e7",black:"#1a1a2e",red:"#ff6b6b",green:"#69db7c",yellow:"#ffd43b",blue:"#818cf8",magenta:"#cc5de8",cyan:"#22b8cf",white:"#e4e4e7"}},daylight:{id:"daylight",name:"Daylight",variant:"light",colors:{bgPrimary:"#ffffff",bgSecondary:"#f4f4f5",bgTertiary:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#3f3f46",textMuted:"#71717a",accent:"#4f46e5",accentHover:"#4338ca",border:"#d4d4d8",borderFocus:"#4f46e5"},terminalColors:{background:"#ffffff",foreground:"#18181b",black:"#18181b",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#f4f4f5"}},"high-contrast":{id:"high-contrast",name:"High Contrast",variant:"dark",colors:{bgPrimary:"#000000",bgSecondary:"#0a0a0a",bgTertiary:"#141414",textPrimary:"#ffffff",textSecondary:"#e5e5e5",textMuted:"#a3a3a3",accent:"#ffff00",accentHover:"#ffff66",border:"#404040",borderFocus:"#ffff00"},terminalColors:{background:"#000000",foreground:"#ffffff",black:"#000000",red:"#ff0000",green:"#00ff00",yellow:"#ffff00",blue:"#0080ff",magenta:"#ff00ff",cyan:"#00ffff",white:"#ffffff"}},dracula:{id:"dracula",name:"Dracula",variant:"dark",colors:{bgPrimary:"#282A36",bgSecondary:"#21222C",bgTertiary:"#191A21",textPrimary:"#F8F8F2",textSecondary:"#BFBFBF",textMuted:"#6272A4",accent:"#BD93F9",accentHover:"#CAA9FA",border:"#44475A",borderFocus:"#BD93F9"},terminalColors:{background:"#282A36",foreground:"#F8F8F2",black:"#21222C",red:"#FF5555",green:"#50FA7B",yellow:"#F1FA8C",blue:"#BD93F9",magenta:"#FF79C6",cyan:"#8BE9FD",white:"#F8F8F2"}},nord:{id:"nord",name:"Nord",variant:"dark",colors:{bgPrimary:"#2E3440",bgSecondary:"#3B4252",bgTertiary:"#434C5E",textPrimary:"#ECEFF4",textSecondary:"#D8DEE9",textMuted:"#4C566A",accent:"#88C0D0",accentHover:"#8FBCBB",border:"#4C566A",borderFocus:"#88C0D0"},terminalColors:{background:"#2E3440",foreground:"#ECEFF4",black:"#3B4252",red:"#BF616A",green:"#A3BE8C",yellow:"#EBCB8B",blue:"#81A1C1",magenta:"#B48EAD",cyan:"#88C0D0",white:"#ECEFF4"}},gruvbox:{id:"gruvbox",name:"Gruvbox",variant:"dark",colors:{bgPrimary:"#1D2021",bgSecondary:"#282828",bgTertiary:"#3C3836",textPrimary:"#EBDBB2",textSecondary:"#D5C4A1",textMuted:"#928374",accent:"#8EC07C",accentHover:"#B8BB26",border:"#504945",borderFocus:"#8EC07C"},terminalColors:{background:"#1D2021",foreground:"#EBDBB2",black:"#282828",red:"#CC241D",green:"#98971A",yellow:"#D79921",blue:"#458588",magenta:"#B16286",cyan:"#689D6A",white:"#EBDBB2"}},catppuccin:{id:"catppuccin",name:"Catppuccin",variant:"dark",colors:{bgPrimary:"#1E1E2E",bgSecondary:"#181825",bgTertiary:"#11111B",textPrimary:"#CDD6F4",textSecondary:"#BAC2DE",textMuted:"#6C7086",accent:"#89B4FA",accentHover:"#74C7EC",border:"#45475A",borderFocus:"#89B4FA"},terminalColors:{background:"#1E1E2E",foreground:"#CDD6F4",black:"#45475A",red:"#F38BA8",green:"#A6E3A1",yellow:"#F9E2AF",blue:"#89B4FA",magenta:"#F5C2E7",cyan:"#94E2D5",white:"#CDD6F4"}},"tokyo-night":{id:"tokyo-night",name:"Tokyo Night",variant:"dark",colors:{bgPrimary:"#1A1B26",bgSecondary:"#16161E",bgTertiary:"#13131A",textPrimary:"#A9B1D6",textSecondary:"#9AA5CE",textMuted:"#565F89",accent:"#7AA2F7",accentHover:"#7DCFFF",border:"#292E42",borderFocus:"#7AA2F7"},terminalColors:{background:"#1A1B26",foreground:"#A9B1D6",black:"#32344A",red:"#F7768E",green:"#9ECE6A",yellow:"#E0AF68",blue:"#7AA2F7",magenta:"#BB9AF7",cyan:"#7DCFFF",white:"#A9B1D6"}},"solarized-dark":{id:"solarized-dark",name:"Solarized Dark",variant:"dark",colors:{bgPrimary:"#002B36",bgSecondary:"#073642",bgTertiary:"#001E27",textPrimary:"#839496",textSecondary:"#657B83",textMuted:"#586E75",accent:"#2B9ED8",accentHover:"#2AA198",border:"#094959",borderFocus:"#2B9ED8"},terminalColors:{background:"#002B36",foreground:"#839496",black:"#073642",red:"#DC322F",green:"#859900",yellow:"#B58900",blue:"#268BD2",magenta:"#D33682",cyan:"#2AA198",white:"#EEE8D5"}},"solarized-light":{id:"solarized-light",name:"Solarized Light",variant:"light",colors:{bgPrimary:"#FDF6E3",bgSecondary:"#EEE8D5",bgTertiary:"#DDD6C1",textPrimary:"#475B62",textSecondary:"#586E75",textMuted:"#93A1A1",accent:"#0B69AD",accentHover:"#2AA198",border:"#D3CBB8",borderFocus:"#0B69AD"},terminalColors:{background:"#FDF6E3",foreground:"#657B83",black:"#073642",red:"#DC322F",green:"#859900",yellow:"#B58900",blue:"#268BD2",magenta:"#D33682",cyan:"#2AA198",white:"#FDF6E3"}},monokai:{id:"monokai",name:"Monokai",variant:"dark",colors:{bgPrimary:"#272822",bgSecondary:"#1E1F1C",bgTertiary:"#171813",textPrimary:"#F8F8F2",textSecondary:"#CFCFC2",textMuted:"#75715E",accent:"#A6E22E",accentHover:"#E6DB74",border:"#3E3D32",borderFocus:"#A6E22E"},terminalColors:{background:"#272822",foreground:"#F8F8F2",black:"#272822",red:"#F92672",green:"#A6E22E",yellow:"#F4BF75",blue:"#66D9EF",magenta:"#AE81FF",cyan:"#A1EFE4",white:"#F8F8F2"}},"one-dark":{id:"one-dark",name:"One Dark",variant:"dark",colors:{bgPrimary:"#282C34",bgSecondary:"#21252B",bgTertiary:"#1B1D23",textPrimary:"#ABB2BF",textSecondary:"#9DA5B4",textMuted:"#636D83",accent:"#61AFEF",accentHover:"#528BFF",border:"#3E4451",borderFocus:"#61AFEF"},terminalColors:{background:"#282C34",foreground:"#ABB2BF",black:"#3F4451",red:"#E06C75",green:"#98C379",yellow:"#E5C07B",blue:"#61AFEF",magenta:"#C678DD",cyan:"#56B6C2",white:"#ABB2BF"}},"one-light":{id:"one-light",name:"One Light",variant:"light",colors:{bgPrimary:"#FAFAFA",bgSecondary:"#F0F0F0",bgTertiary:"#E5E5E6",textPrimary:"#383A42",textSecondary:"#4F525D",textMuted:"#A0A1A7",accent:"#3367D6",accentHover:"#526FFF",border:"#D3D3D4",borderFocus:"#3367D6"},terminalColors:{background:"#FAFAFA",foreground:"#383A42",black:"#383A42",red:"#E45649",green:"#50A14F",yellow:"#C18401",blue:"#4078F2",magenta:"#A626A4",cyan:"#0184BC",white:"#FAFAFA"}},"github-dark":{id:"github-dark",name:"GitHub Dark",variant:"dark",colors:{bgPrimary:"#0D1117",bgSecondary:"#161B22",bgTertiary:"#010409",textPrimary:"#C9D1D9",textSecondary:"#8B949E",textMuted:"#6E7681",accent:"#58A6FF",accentHover:"#79C0FF",border:"#30363D",borderFocus:"#58A6FF"},terminalColors:{background:"#0D1117",foreground:"#C9D1D9",black:"#484F58",red:"#FF7B72",green:"#7EE787",yellow:"#D29922",blue:"#58A6FF",magenta:"#BC8CFF",cyan:"#39C5CF",white:"#C9D1D9"}},"github-light":{id:"github-light",name:"GitHub Light",variant:"light",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F6F8FA",bgTertiary:"#EAEEF2",textPrimary:"#1F2328",textSecondary:"#656D76",textMuted:"#8C959F",accent:"#0969DA",accentHover:"#0550AE",border:"#D0D7DE",borderFocus:"#0969DA"},terminalColors:{background:"#FFFFFF",foreground:"#1F2328",black:"#24292F",red:"#CF222E",green:"#1A7F37",yellow:"#9A6700",blue:"#0969DA",magenta:"#8250DF",cyan:"#1B7C83",white:"#FFFFFF"}},"rose-pine":{id:"rose-pine",name:"Rosé Pine",variant:"dark",colors:{bgPrimary:"#191724",bgSecondary:"#1F1D2E",bgTertiary:"#26233A",textPrimary:"#E0DEF4",textSecondary:"#908CAA",textMuted:"#6E6A86",accent:"#C4A7E7",accentHover:"#EB6F92",border:"#403D52",borderFocus:"#C4A7E7"},terminalColors:{background:"#191724",foreground:"#E0DEF4",black:"#26233A",red:"#EB6F92",green:"#31748F",yellow:"#F6C177",blue:"#9CCFD8",magenta:"#C4A7E7",cyan:"#EBBCBA",white:"#E0DEF4"}},"rose-pine-dawn":{id:"rose-pine-dawn",name:"Rosé Pine Dawn",variant:"light",colors:{bgPrimary:"#FAF4ED",bgSecondary:"#FFFAF3",bgTertiary:"#F2E9E1",textPrimary:"#575279",textSecondary:"#797593",textMuted:"#9893A5",accent:"#735E8C",accentHover:"#B4637A",border:"#DFDAD9",borderFocus:"#735E8C"},terminalColors:{background:"#FAF4ED",foreground:"#575279",black:"#575279",red:"#B4637A",green:"#286983",yellow:"#EA9D34",blue:"#56949F",magenta:"#907AA9",cyan:"#D7827E",white:"#FAF4ED"}},kanagawa:{id:"kanagawa",name:"Kanagawa",variant:"dark",colors:{bgPrimary:"#1F1F28",bgSecondary:"#2A2A37",bgTertiary:"#16161D",textPrimary:"#DCD7BA",textSecondary:"#C8C093",textMuted:"#727169",accent:"#7E9CD8",accentHover:"#7FB4CA",border:"#363646",borderFocus:"#7E9CD8"},terminalColors:{background:"#1F1F28",foreground:"#DCD7BA",black:"#16161D",red:"#C34043",green:"#76946A",yellow:"#C0A36E",blue:"#7E9CD8",magenta:"#957FB8",cyan:"#6A9589",white:"#DCD7BA"}},"ayu-dark":{id:"ayu-dark",name:"Ayu Dark",variant:"dark",colors:{bgPrimary:"#0B0E14",bgSecondary:"#0D1017",bgTertiary:"#060810",textPrimary:"#BFBDB6",textSecondary:"#9B9B9B",textMuted:"#636A72",accent:"#E6B450",accentHover:"#FFB454",border:"#1C1F27",borderFocus:"#E6B450"},terminalColors:{background:"#0B0E14",foreground:"#BFBDB6",black:"#01060E",red:"#EA6C73",green:"#91B362",yellow:"#F9AF4F",blue:"#53BDFA",magenta:"#D2A6FF",cyan:"#90E1C6",white:"#C7C7C7"}},"ayu-light":{id:"ayu-light",name:"Ayu Light",variant:"light",colors:{bgPrimary:"#FCFCFC",bgSecondary:"#F3F4F5",bgTertiary:"#E7E8E9",textPrimary:"#5C6166",textSecondary:"#787B80",textMuted:"#ABB0B6",accent:"#9E5E08",accentHover:"#F2AE49",border:"#D8D8D8",borderFocus:"#9E5E08"},terminalColors:{background:"#FCFCFC",foreground:"#5C6166",black:"#1A1F29",red:"#F07171",green:"#86B300",yellow:"#F2AE49",blue:"#399EE6",magenta:"#A37ACC",cyan:"#4CBF99",white:"#FCFCFC"}}};function Sn(n){return xS[n]}function Fz(){return Object.keys(xS)}function _f(n){const e=Sn(n);if(!e){console.error(`[color-presets] Unknown preset: ${n}`);return}const i=document.documentElement;i.classList.add("theme-transition"),i.setAttribute("data-preset",e.id),i.setAttribute("data-variant",e.variant),i.style.setProperty("--bg-primary",e.colors.bgPrimary),i.style.setProperty("--bg-secondary",e.colors.bgSecondary),i.style.setProperty("--bg-tertiary",e.colors.bgTertiary),i.style.setProperty("--text-primary",e.colors.textPrimary),i.style.setProperty("--text-secondary",e.colors.textSecondary),i.style.setProperty("--text-muted",e.colors.textMuted),i.style.setProperty("--accent",e.colors.accent),i.style.setProperty("--accent-hover",e.colors.accentHover),i.style.setProperty("--border",e.colors.border),i.style.setProperty("--border-focus",e.colors.borderFocus),i.style.setProperty("--terminal-background",e.terminalColors.background),i.style.setProperty("--terminal-foreground",e.terminalColors.foreground),i.style.setProperty("--terminal-black",e.terminalColors.black),i.style.setProperty("--terminal-red",e.terminalColors.red),i.style.setProperty("--terminal-green",e.terminalColors.green),i.style.setProperty("--terminal-yellow",e.terminalColors.yellow),i.style.setProperty("--terminal-blue",e.terminalColors.blue),i.style.setProperty("--terminal-magenta",e.terminalColors.magenta),i.style.setProperty("--terminal-cyan",e.terminalColors.cyan),i.style.setProperty("--terminal-white",e.terminalColors.white),window.dispatchEvent(new CustomEvent("presetChange",{detail:{presetId:n}}))}async function Uz(n){if(!Sn(n))throw new Error(`Invalid preset id: ${n}`);try{return(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({display:{colorPreset:n}})})).ok}catch(e){return console.error("[color-presets] Failed to save preset:",e),!1}}async function wS(){try{const n=await fetch("/api/settings");if(n.ok){const i=(await n.json())?.display?.colorPreset;return i&&Sn(i)?i:ic}return ic}catch(n){return console.error("[color-presets] Failed to load preset:",n),ic}}const $z=Bf("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function $e({className:n,variant:e,...i}){return l.jsx("div",{className:ye($z({variant:e}),n),...i})}const SS=m.forwardRef(({children:n,onScrollChange:e,autoScroll:i=!0},a)=>{const r=m.useRef(null),c=m.useRef(!0),d=m.useCallback(p=>{const y=r.current;if(!y)return!0;const b=p??y.scrollTop,x=y.scrollHeight||0,w=y.clientHeight||0;return b===0&&x===0&&y.children.length>0||b===0&&x>w?!1:x<=w?!0:x-b-w<50},[]),h=m.useCallback((p="auto")=>{const y=r.current;y&&y.scrollTo({top:y.scrollHeight,behavior:p})},[]);m.useImperativeHandle(a,()=>({scrollToBottom:h}));const f=m.useCallback(p=>{const y=p.target,b=d(y.scrollTop);c.current=b,e?.(b)},[d,e]);return m.useEffect(()=>{i&&c.current&&h()},[n,i,h]),l.jsx("div",{ref:r,"data-testid":"message-list",className:"message-list",onScroll:f,children:n})});SS.displayName="MessageList";const Wz=new Set(["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","new","this","class","extends","import","export","from","default","async","await","try","catch","finally","throw","typeof","instanceof","in","of","true","false","null","undefined","void"]),qz=new Set(["def","class","return","if","elif","else","for","while","break","continue","import","from","as","try","except","finally","raise","with","lambda","yield","True","False","None","and","or","not","in","is","pass","self"]),Yz=new Set(["func","return","if","else","for","range","switch","case","break","continue","go","defer","chan","select","type","struct","interface","map","package","import","var","const","true","false","nil","make","new","append","len","cap","error"]),Xz=new Set(["fn","let","mut","return","if","else","for","while","loop","match","break","continue","impl","struct","enum","trait","pub","use","mod","crate","self","super","where","async","await","true","false","Some","None","Ok","Err"]),Qz=new Set(["if","then","else","elif","fi","for","while","do","done","case","esac","function","return","exit","export","source","alias","cd","echo","printf","read","local"]);function Zz(n){const e=n.toLowerCase();return["js","javascript","ts","typescript","jsx","tsx"].includes(e)?Wz:["python","py"].includes(e)?qz:["go","golang"].includes(e)?Yz:["rust","rs"].includes(e)?Xz:["bash","sh","shell","zsh"].includes(e)?Qz:new Set}function Kz(n){const e=n.toLowerCase();return["js","javascript","ts","typescript","jsx","tsx","go","golang","rust","rs"].includes(e)}function Jz(n){const e=n.toLowerCase();return["python","py","bash","sh","shell","zsh"].includes(e)}function eM(n,e,i){if(!n.trim())return n;const a=n.trim();if(Kz(i)&&a.startsWith("//"))return`<span class="comment">${n}</span>`;if(Jz(i)&&a.startsWith("#"))return`<span class="comment">${n}</span>`;let r="",c=0;for(;c<n.length;){if(n.slice(c,c+6)==="&quot;"){const d=n.indexOf("&quot;",c+6);if(d!==-1){r+=`<span class="string">${n.slice(c,d+6)}</span>`,c=d+6;continue}}if(n.slice(c,c+5)==="&#39;"||n.slice(c,c+6)==="&#039;"){const d=n.slice(c,c+6)==="&#039;"?6:5,h=n.slice(c,c+d),f=n.indexOf(h,c+d);if(f!==-1){r+=`<span class="string">${n.slice(c,f+d)}</span>`,c=f+d;continue}}if(/[a-zA-Z_]/.test(n[c])){let d="";for(;c<n.length&&/[a-zA-Z0-9_]/.test(n[c]);)d+=n[c],c++;e.has(d)?r+=`<span class="keyword">${d}</span>`:n[c]==="("?r+=`<span class="function">${d}</span>`:r+=d;continue}if(/[0-9]/.test(n[c])){let d="";for(;c<n.length&&/[0-9.]/.test(n[c]);)d+=n[c],c++;r+=`<span class="number">${d}</span>`;continue}r+=n[c],c++}return r}function tM(n,e){if(!n||!e)return n||"";const i=Zz(e);return n.split(`
53
+ For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return m.useEffect(()=>{n&&(document.getElementById(n)||console.error(i))},[i,n]),null},vO="DialogDescriptionWarning",yO=({contentRef:n,descriptionId:e})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${e0(vO).contentName}}.`;return m.useEffect(()=>{const r=n.current?.getAttribute("aria-describedby");e&&r&&(document.getElementById(e)||console.warn(a))},[a,n,e]),null},ym=BS,bO=VS,bm=US,Uc=$S,$c=WS,xm=YS,wm=QS,Sm=KS,xO=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],In=xO.reduce((n,e)=>{const i=rw(`Primitive.${e}`),a=m.forwardRef((r,c)=>{const{asChild:d,...h}=r,f=d?i:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(f,{...h,ref:c})});return a.displayName=`Primitive.${e}`,{...n,[e]:a}},{}),qo='[cmdk-group=""]',Uh='[cmdk-group-items=""]',wO='[cmdk-group-heading=""]',t0='[cmdk-item=""]',ux=`${t0}:not([aria-disabled="true"])`,wf="cmdk-item-select",ka="data-value",SO=(n,e,i)=>gR(n,e,i),n0=m.createContext(void 0),cr=()=>m.useContext(n0),i0=m.createContext(void 0),Cm=()=>m.useContext(i0),s0=m.createContext(void 0),a0=m.forwardRef((n,e)=>{let i=Ra(()=>{var L,ee;return{search:"",value:(ee=(L=n.value)!=null?L:n.defaultValue)!=null?ee:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Ra(()=>new Set),r=Ra(()=>new Map),c=Ra(()=>new Map),d=Ra(()=>new Set),h=o0(n),{label:f,children:p,value:y,onValueChange:b,filter:x,shouldFilter:w,loop:E,disablePointerSelection:C=!1,vimBindings:S=!0,...D}=n,N=Mt(),k=Mt(),T=Mt(),R=m.useRef(null),z=OO();Ms(()=>{if(y!==void 0){let L=y.trim();i.current.value=L,O.emit()}},[y]),Ms(()=>{z(6,ae)},[]);let O=m.useMemo(()=>({subscribe:L=>(d.current.add(L),()=>d.current.delete(L)),snapshot:()=>i.current,setState:(L,ee,V)=>{var Y,le,X,ce;if(!Object.is(i.current[L],ee)){if(i.current[L]=ee,L==="search")$(),U(),z(1,B);else if(L==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let de=document.getElementById(T);de?de.focus():(Y=document.getElementById(N))==null||Y.focus()}if(z(7,()=>{var de;i.current.selectedItemId=(de=ne())==null?void 0:de.id,O.emit()}),V||z(5,ae),((le=h.current)==null?void 0:le.value)!==void 0){let de=ee??"";(ce=(X=h.current).onValueChange)==null||ce.call(X,de);return}}O.emit()}},emit:()=>{d.current.forEach(L=>L())}}),[]),A=m.useMemo(()=>({value:(L,ee,V)=>{var Y;ee!==((Y=c.current.get(L))==null?void 0:Y.value)&&(c.current.set(L,{value:ee,keywords:V}),i.current.filtered.items.set(L,G(ee,V)),z(2,()=>{U(),O.emit()}))},item:(L,ee)=>(a.current.add(L),ee&&(r.current.has(ee)?r.current.get(ee).add(L):r.current.set(ee,new Set([L]))),z(3,()=>{$(),U(),i.current.value||B(),O.emit()}),()=>{c.current.delete(L),a.current.delete(L),i.current.filtered.items.delete(L);let V=ne();z(4,()=>{$(),V?.getAttribute("id")===L&&B(),O.emit()})}),group:L=>(r.current.has(L)||r.current.set(L,new Set),()=>{c.current.delete(L),r.current.delete(L)}),filter:()=>h.current.shouldFilter,label:f||n["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:N,inputId:T,labelId:k,listInnerRef:R}),[]);function G(L,ee){var V,Y;let le=(Y=(V=h.current)==null?void 0:V.filter)!=null?Y:SO;return L?le(L,i.current.search,ee):0}function U(){if(!i.current.search||h.current.shouldFilter===!1)return;let L=i.current.filtered.items,ee=[];i.current.filtered.groups.forEach(Y=>{let le=r.current.get(Y),X=0;le.forEach(ce=>{let de=L.get(ce);X=Math.max(de,X)}),ee.push([Y,X])});let V=R.current;W().sort((Y,le)=>{var X,ce;let de=Y.getAttribute("id"),De=le.getAttribute("id");return((X=L.get(De))!=null?X:0)-((ce=L.get(de))!=null?ce:0)}).forEach(Y=>{let le=Y.closest(Uh);le?le.appendChild(Y.parentElement===le?Y:Y.closest(`${Uh} > *`)):V.appendChild(Y.parentElement===V?Y:Y.closest(`${Uh} > *`))}),ee.sort((Y,le)=>le[1]-Y[1]).forEach(Y=>{var le;let X=(le=R.current)==null?void 0:le.querySelector(`${qo}[${ka}="${encodeURIComponent(Y[0])}"]`);X?.parentElement.appendChild(X)})}function B(){let L=W().find(V=>V.getAttribute("aria-disabled")!=="true"),ee=L?.getAttribute(ka);O.setState("value",ee||void 0)}function $(){var L,ee,V,Y;if(!i.current.search||h.current.shouldFilter===!1){i.current.filtered.count=a.current.size;return}i.current.filtered.groups=new Set;let le=0;for(let X of a.current){let ce=(ee=(L=c.current.get(X))==null?void 0:L.value)!=null?ee:"",de=(Y=(V=c.current.get(X))==null?void 0:V.keywords)!=null?Y:[],De=G(ce,de);i.current.filtered.items.set(X,De),De>0&&le++}for(let[X,ce]of r.current)for(let de of ce)if(i.current.filtered.items.get(de)>0){i.current.filtered.groups.add(X);break}i.current.filtered.count=le}function ae(){var L,ee,V;let Y=ne();Y&&(((L=Y.parentElement)==null?void 0:L.firstChild)===Y&&((V=(ee=Y.closest(qo))==null?void 0:ee.querySelector(wO))==null||V.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function ne(){var L;return(L=R.current)==null?void 0:L.querySelector(`${t0}[aria-selected="true"]`)}function W(){var L;return Array.from(((L=R.current)==null?void 0:L.querySelectorAll(ux))||[])}function M(L){let ee=W()[L];ee&&O.setState("value",ee.getAttribute(ka))}function K(L){var ee;let V=ne(),Y=W(),le=Y.findIndex(ce=>ce===V),X=Y[le+L];(ee=h.current)!=null&&ee.loop&&(X=le+L<0?Y[Y.length-1]:le+L===Y.length?Y[0]:Y[le+L]),X&&O.setState("value",X.getAttribute(ka))}function q(L){let ee=ne(),V=ee?.closest(qo),Y;for(;V&&!Y;)V=L>0?kO(V,qo):RO(V,qo),Y=V?.querySelector(ux);Y?O.setState("value",Y.getAttribute(ka)):K(L)}let he=()=>M(W().length-1),Se=L=>{L.preventDefault(),L.metaKey?he():L.altKey?q(1):K(1)},I=L=>{L.preventDefault(),L.metaKey?M(0):L.altKey?q(-1):K(-1)};return m.createElement(In.div,{ref:e,tabIndex:-1,...D,"cmdk-root":"",onKeyDown:L=>{var ee;(ee=D.onKeyDown)==null||ee.call(D,L);let V=L.nativeEvent.isComposing||L.keyCode===229;if(!(L.defaultPrevented||V))switch(L.key){case"n":case"j":{S&&L.ctrlKey&&Se(L);break}case"ArrowDown":{Se(L);break}case"p":case"k":{S&&L.ctrlKey&&I(L);break}case"ArrowUp":{I(L);break}case"Home":{L.preventDefault(),M(0);break}case"End":{L.preventDefault(),he();break}case"Enter":{L.preventDefault();let Y=ne();if(Y){let le=new Event(wf);Y.dispatchEvent(le)}}}}},m.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:MO},f),Wc(n,L=>m.createElement(i0.Provider,{value:O},m.createElement(n0.Provider,{value:A},L))))}),CO=m.forwardRef((n,e)=>{var i,a;let r=Mt(),c=m.useRef(null),d=m.useContext(s0),h=cr(),f=o0(n),p=(a=(i=f.current)==null?void 0:i.forceMount)!=null?a:d?.forceMount;Ms(()=>{if(!p)return h.item(r,d?.id)},[p]);let y=r0(r,c,[n.value,n.children,c],n.keywords),b=Cm(),x=is(z=>z.value&&z.value===y.current),w=is(z=>p||h.filter()===!1?!0:z.search?z.filtered.items.get(r)>0:!0);m.useEffect(()=>{let z=c.current;if(!(!z||n.disabled))return z.addEventListener(wf,E),()=>z.removeEventListener(wf,E)},[w,n.onSelect,n.disabled]);function E(){var z,O;C(),(O=(z=f.current).onSelect)==null||O.call(z,y.current)}function C(){b.setState("value",y.current,!0)}if(!w)return null;let{disabled:S,value:D,onSelect:N,forceMount:k,keywords:T,...R}=n;return m.createElement(In.div,{ref:es(c,e),...R,id:r,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!x,"data-disabled":!!S,"data-selected":!!x,onPointerMove:S||h.getDisablePointerSelection()?void 0:C,onClick:S?void 0:E},n.children)}),_O=m.forwardRef((n,e)=>{let{heading:i,children:a,forceMount:r,...c}=n,d=Mt(),h=m.useRef(null),f=m.useRef(null),p=Mt(),y=cr(),b=is(w=>r||y.filter()===!1?!0:w.search?w.filtered.groups.has(d):!0);Ms(()=>y.group(d),[]),r0(d,h,[n.value,n.heading,f]);let x=m.useMemo(()=>({id:d,forceMount:r}),[r]);return m.createElement(In.div,{ref:es(h,e),...c,"cmdk-group":"",role:"presentation",hidden:b?void 0:!0},i&&m.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:p},i),Wc(n,w=>m.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":i?p:void 0},m.createElement(s0.Provider,{value:x},w))))}),EO=m.forwardRef((n,e)=>{let{alwaysRender:i,...a}=n,r=m.useRef(null),c=is(d=>!d.search);return!i&&!c?null:m.createElement(In.div,{ref:es(r,e),...a,"cmdk-separator":"",role:"separator"})}),DO=m.forwardRef((n,e)=>{let{onValueChange:i,...a}=n,r=n.value!=null,c=Cm(),d=is(p=>p.search),h=is(p=>p.selectedItemId),f=cr();return m.useEffect(()=>{n.value!=null&&c.setState("search",n.value)},[n.value]),m.createElement(In.input,{ref:e,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,"aria-activedescendant":h,id:f.inputId,type:"text",value:r?n.value:d,onChange:p=>{r||c.setState("search",p.target.value),i?.(p.target.value)}})}),AO=m.forwardRef((n,e)=>{let{children:i,label:a="Suggestions",...r}=n,c=m.useRef(null),d=m.useRef(null),h=is(p=>p.selectedItemId),f=cr();return m.useEffect(()=>{if(d.current&&c.current){let p=d.current,y=c.current,b,x=new ResizeObserver(()=>{b=requestAnimationFrame(()=>{let w=p.offsetHeight;y.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return x.observe(p),()=>{cancelAnimationFrame(b),x.unobserve(p)}}},[]),m.createElement(In.div,{ref:es(c,e),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":a,id:f.listId},Wc(n,p=>m.createElement("div",{ref:es(d,f.listInnerRef),"cmdk-list-sizer":""},p)))}),NO=m.forwardRef((n,e)=>{let{open:i,onOpenChange:a,overlayClassName:r,contentClassName:c,container:d,...h}=n;return m.createElement(ym,{open:i,onOpenChange:a},m.createElement(bm,{container:d},m.createElement(Uc,{"cmdk-overlay":"",className:r}),m.createElement($c,{"aria-label":n.label,"cmdk-dialog":"",className:c},m.createElement(a0,{ref:e,...h}))))}),jO=m.forwardRef((n,e)=>is(i=>i.filtered.count===0)?m.createElement(In.div,{ref:e,...n,"cmdk-empty":"",role:"presentation"}):null),TO=m.forwardRef((n,e)=>{let{progress:i,children:a,label:r="Loading...",...c}=n;return m.createElement(In.div,{ref:e,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":i,"aria-valuemin":0,"aria-valuemax":100,"aria-label":r},Wc(n,d=>m.createElement("div",{"aria-hidden":!0},d)))}),Yt=Object.assign(a0,{List:AO,Item:CO,Input:DO,Group:_O,Separator:EO,Dialog:NO,Empty:jO,Loading:TO});function kO(n,e){let i=n.nextElementSibling;for(;i;){if(i.matches(e))return i;i=i.nextElementSibling}}function RO(n,e){let i=n.previousElementSibling;for(;i;){if(i.matches(e))return i;i=i.previousElementSibling}}function o0(n){let e=m.useRef(n);return Ms(()=>{e.current=n}),e}var Ms=typeof window>"u"?m.useEffect:m.useLayoutEffect;function Ra(n){let e=m.useRef();return e.current===void 0&&(e.current=n()),e}function is(n){let e=Cm(),i=()=>n(e.snapshot());return m.useSyncExternalStore(e.subscribe,i,i)}function r0(n,e,i,a=[]){let r=m.useRef(),c=cr();return Ms(()=>{var d;let h=(()=>{var p;for(let y of i){if(typeof y=="string")return y.trim();if(typeof y=="object"&&"current"in y)return y.current?(p=y.current.textContent)==null?void 0:p.trim():r.current}})(),f=a.map(p=>p.trim());c.value(n,h,f),(d=e.current)==null||d.setAttribute(ka,h),r.current=h}),r}var OO=()=>{let[n,e]=m.useState(),i=Ra(()=>new Map);return Ms(()=>{i.current.forEach(a=>a()),i.current=new Map},[n]),(a,r)=>{i.current.set(a,r),e({})}};function zO(n){let e=n.type;return typeof e=="function"?e(n.props):"render"in e?e.render(n.props):n}function Wc({asChild:n,children:e},i){return n&&m.isValidElement(e)?m.cloneElement(zO(e),{ref:e.ref},i(e.props.children)):i(e)}var MO={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const l0=(...n)=>n.filter((e,i,a)=>!!e&&e.trim()!==""&&a.indexOf(e)===i).join(" ").trim();const PO=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const LO=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,i,a)=>a?a.toUpperCase():i.toLowerCase());const dx=n=>{const e=LO(n);return e.charAt(0).toUpperCase()+e.slice(1)};var IO={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const GO=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const BO=m.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:a,className:r="",children:c,iconNode:d,...h},f)=>m.createElement("svg",{ref:f,...IO,width:e,height:e,stroke:n,strokeWidth:a?Number(i)*24/Number(e):i,className:l0("lucide",r),...!c&&!GO(h)&&{"aria-hidden":"true"},...h},[...d.map(([p,y])=>m.createElement(p,y)),...Array.isArray(c)?c:[c]]));const Xt=(n,e)=>{const i=m.forwardRef(({className:a,...r},c)=>m.createElement(BO,{ref:c,iconNode:e,className:l0(`lucide-${PO(dx(n))}`,`lucide-${n}`,a),...r}));return i.displayName=dx(n),i};const HO=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]],VO=Xt("bell-ring",HO);const FO=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ga=Xt("check",FO);const UO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],c0=Xt("chevron-down",UO);const $O=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],WO=Xt("chevron-up",$O);const qO=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],YO=Xt("chevrons-up-down",qO);const XO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],QO=Xt("circle",XO);const ZO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],KO=Xt("copy",ZO);const JO=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],ez=Xt("loader",JO);const tz=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],nz=Xt("rotate-ccw",tz);const iz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],sz=Xt("search",iz);const az=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],oz=Xt("triangle-alert",az);const rz=[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],lz=Xt("user-cog",rz);const cz=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],uz=Xt("x",cz);const dz=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],hz=Xt("zap",dz),qc=ym,fz=bm,u0=m.forwardRef(({className:n,...e},i)=>l.jsx(Uc,{ref:i,className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...e}));u0.displayName=Uc.displayName;const ur=m.forwardRef(({className:n,children:e,...i},a)=>l.jsxs(fz,{children:[l.jsx(u0,{}),l.jsxs($c,{ref:a,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-[var(--border)] bg-card text-card-foreground p-6 shadow-2xl shadow-black/40 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...i,children:[e,l.jsxs(Sm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(uz,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ur.displayName=$c.displayName;const Yc=({className:n,...e})=>l.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",n),...e});Yc.displayName="DialogHeader";const _m=({className:n,...e})=>l.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e});_m.displayName="DialogFooter";const Xc=m.forwardRef(({className:n,...e},i)=>l.jsx(xm,{ref:i,className:ye("text-base font-medium leading-none tracking-tight",n),...e}));Xc.displayName=xm.displayName;const Qc=m.forwardRef(({className:n,...e},i)=>l.jsx(wm,{ref:i,className:ye("text-sm text-[var(--text-secondary)]",n),...e}));Qc.displayName=wm.displayName;const Em=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt,{ref:i,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",n),...e}));Em.displayName=Yt.displayName;const Dm=m.forwardRef(({className:n,...e},i)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(sz,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(Yt.Input,{ref:i,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",n),...e})]}));Dm.displayName=Yt.Input.displayName;const Am=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt.List,{ref:i,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",n),...e}));Am.displayName=Yt.List.displayName;const Nm=m.forwardRef((n,e)=>l.jsx(Yt.Empty,{ref:e,className:"py-6 text-center text-sm",...n}));Nm.displayName=Yt.Empty.displayName;const nr=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt.Group,{ref:i,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",n),...e}));nr.displayName=Yt.Group.displayName;const mz=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt.Separator,{ref:i,className:ye("-mx-1 h-px bg-border",n),...e}));mz.displayName=Yt.Separator.displayName;const ir=m.forwardRef(({className:n,...e},i)=>l.jsx(Yt.Item,{ref:i,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n),...e}));ir.displayName=Yt.Item.displayName;const Sf=({className:n,...e})=>l.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",n),...e});Sf.displayName="CommandShortcut";const pz=["Panels","Navigation","Settings","Agents"],gz="command-palette-search",vz="command-palette-results",hx="command-palette-shortcut",yz="command-palette-recent",d0="cyclist:recent-commands",bz=5,h0=[{id:"toggle-changed-panel",name:"Toggle Changed Files",category:"Panels",shortcut:"Cmd+Shift+1"},{id:"toggle-diffs-panel",name:"Toggle Diffs",category:"Panels",shortcut:"Cmd+Shift+2"},{id:"toggle-message-panel",name:"Toggle Messages",category:"Panels",shortcut:"Cmd+Shift+3"},{id:"toggle-debug-panel",name:"Toggle Debug",category:"Panels"},{id:"focus-input",name:"Focus Input",category:"Navigation",shortcut:"Cmd+L"},{id:"scroll-to-bottom",name:"Scroll to Bottom",category:"Navigation",shortcut:"Cmd+End"},{id:"scroll-to-top",name:"Scroll to Top",category:"Navigation",shortcut:"Cmd+Home"},{id:"open-settings",name:"Open Settings",category:"Settings",shortcut:"Cmd+,"},{id:"toggle-theme",name:"Toggle Theme",category:"Settings"},{id:"run-sm",name:"Start Scrum Master",category:"Agents"},{id:"run-tea",name:"Start TEA",category:"Agents"},{id:"run-dev",name:"Start Dev",category:"Agents"},{id:"run-reviewer",name:"Start Reviewer",category:"Agents"}];let f0=0;function xz(){return f0}function wz(n){f0=n}function Sz(){if(typeof navigator>"u")return"mac";const n=navigator.platform?.toLowerCase()||"";return n.includes("mac")?"mac":n.includes("win")?"windows":"linux"}function Cz(n){const e=n.key.toLowerCase()==="p",i=n.metaKey||n.ctrlKey,a=n.shiftKey;return e&&i&&a}function fx(n,e){return e==="mac"?n.replace(/Cmd/g,"⌘").replace(/Shift/g,"⇧").replace(/Alt/g,"⌥").replace(/Ctrl/g,"⌃").replace(/\+/g,""):n.replace(/Cmd/g,"Ctrl")}function _z(n){const e={};for(const i of n)e[i.category]||(e[i.category]=[]),e[i.category].push(i);return e}function Ez(n){Dz(n.id),n.handler&&n.handler()}function m0(){if(typeof localStorage>"u")return[];try{const n=localStorage.getItem(d0);return n?JSON.parse(n):[]}catch{return[]}}function Dz(n){if(typeof localStorage>"u")return;const e=m0().filter(a=>a!==n);e.unshift(n);const i=e.slice(0,bz);localStorage.setItem(d0,JSON.stringify(i))}const Az=new Map;function Nz(n){Az.set(n.id,n)}h0.forEach(n=>Nz(n));const jz=m.createContext(null);function Tz(){const[n,e]=m.useState(!1),[i]=m.useState(h0),a=m.useCallback(()=>{e(!0),wz(0)},[]),r=m.useCallback(()=>{e(!1)},[]),c=m.useCallback(()=>{n?r():a()},[n,a,r]);return{isOpen:n,open:a,close:r,toggle:c,commands:i,selectedIndex:xz()}}let $h=!1,Wl=null;function kz(n){if(Wl=n,!$h){const e=i=>{Cz(i)&&(i.preventDefault(),Wl?.())};return document.addEventListener("keydown",e),$h=!0,()=>{document.removeEventListener("keydown",e),$h=!1,Wl=null}}return()=>{Wl=null}}function Rz({children:n}){const e=Tz();m.useEffect(()=>kz(e.open),[e.open]),m.useEffect(()=>{const r=()=>e.close();return document.addEventListener("cyclist:close-command-palette",r),()=>document.removeEventListener("cyclist:close-command-palette",r)},[e.close]);const i=m.useCallback(r=>{Ez(r),e.close()},[e.close]),a={isOpen:e.isOpen,open:e.open,close:e.close,toggle:e.toggle};return l.jsxs(jz.Provider,{value:a,children:[n,l.jsx(Oz,{commands:e.commands,isOpen:e.isOpen,onClose:e.close,onExecute:i})]})}function Oz({commands:n,onClose:e,onExecute:i,isOpen:a=!0}){const r=Sz(),c=m0(),d=_z(n),h=n.filter(f=>c.includes(f.id));return l.jsx(qc,{open:a,onOpenChange:f=>{f||e()},children:l.jsx(ur,{className:"overflow-hidden p-0","aria-label":"Command palette",children:l.jsxs(Em,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[l.jsx(Dm,{placeholder:"Type a command...",id:gz,"aria-label":"Search commands"}),l.jsxs(Am,{id:vz,children:[l.jsx(Nm,{children:"No matching commands"}),h.length>0&&l.jsx(nr,{heading:"Recent",className:yz,children:h.map(f=>l.jsxs(ir,{value:f.name,onSelect:()=>i(f),className:"command-palette-item",children:[l.jsx("span",{children:f.name}),f.shortcut&&l.jsx(Sf,{className:hx,children:fx(f.shortcut,r)})]},`recent-${f.id}`))}),pz.map(f=>{const p=d[f];return p?.length?l.jsx(nr,{heading:f,children:p.map(y=>l.jsxs(ir,{value:y.name,onSelect:()=>i(y),className:"command-palette-item",children:[l.jsx("span",{children:y.name}),y.shortcut&&l.jsx(Sf,{className:hx,children:fx(y.shortcut,r)})]},y.id))},f):null})]})]})})})}const jm=m.createContext(null);function zz({children:n}){const[e,i]=m.useState(!1),[a,r]=m.useState("default"),c=m.useRef(null),d=m.useRef(),h=m.useRef(new Set),f=m.useRef(new Set),p=m.useRef(new Set),y=m.useRef(new Set),b=m.useRef(new Set),x=m.useCallback(()=>{const A=window.location.protocol==="https:"?"wss:":"ws:",G=window.location.host,U=`${A}//${G}/ws/claude`;console.log("[ClaudeContext] Connecting to",U);const B=new WebSocket(U);c.current=B,B.onopen=()=>{console.log("[ClaudeContext] Connected"),i(!0)},B.onmessage=$=>{try{const ae=JSON.parse($.data);switch(ae.type){case"message":ae.message&&h.current.forEach(ne=>ne(ae.message));break;case"complete":f.current.forEach(ne=>ne());break;case"error":ae.error&&p.current.forEach(ne=>ne(ae.error));break;case"init":console.log("[ClaudeContext] Init received");break}}catch(ae){console.error("[ClaudeContext] Failed to parse message:",ae)}},B.onclose=()=>{console.log("[ClaudeContext] Disconnected"),i(!1),c.current=null,d.current=setTimeout(()=>{console.log("[ClaudeContext] Attempting reconnect..."),x()},2e3)},B.onerror=$=>{console.error("[ClaudeContext] WebSocket error:",$)}},[]);m.useEffect(()=>(x(),()=>{d.current&&clearTimeout(d.current),c.current&&(c.current.close(),c.current=null)}),[x]);const w=m.useCallback((A,G)=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.error("[ClaudeContext] Cannot send: not connected"),p.current.forEach(B=>B("Not connected to Claude service"));return}const U={prompt:A,images:G||[],timestamp:Date.now()};y.current.forEach(B=>B(U)),c.current.send(JSON.stringify({type:"send",prompt:A,images:G}))},[]),E=m.useCallback(()=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.warn("[ClaudeContext] Cannot abort: not connected");return}c.current.send(JSON.stringify({type:"abort"}))},[]),C=m.useCallback(()=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.warn("[ClaudeContext] Cannot clear: not connected");return}c.current.send(JSON.stringify({type:"clear"})),b.current.forEach(A=>A())},[]),S=m.useCallback(A=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.warn("[ClaudeContext] Cannot clearAndReload: not connected");return}console.log("[ClaudeContext] TirePump: clearAndReload agent:",A),c.current.send(JSON.stringify({type:"clearAndReload",agent:A})),b.current.forEach(G=>G())},[]),D=m.useCallback(A=>{if(!c.current||c.current.readyState!==WebSocket.OPEN){console.warn("[ClaudeContext] Cannot set mode: not connected");return}c.current.send(JSON.stringify({type:"setMode",mode:A})),r(A)},[]),N=m.useCallback(A=>(h.current.add(A),()=>{h.current.delete(A)}),[]),k=m.useCallback(A=>(f.current.add(A),()=>{f.current.delete(A)}),[]),T=m.useCallback(A=>(p.current.add(A),()=>{p.current.delete(A)}),[]),R=m.useCallback(A=>(y.current.add(A),()=>{y.current.delete(A)}),[]),z=m.useCallback(A=>(b.current.add(A),()=>{b.current.delete(A)}),[]),O=m.useMemo(()=>({send:w,abort:E,clear:C,clearAndReload:S,setMode:D,isConnected:e,mode:a,onMessage:N,onComplete:k,onError:T,onUserMessage:R,onClear:z}),[w,E,C,S,D,e,a,N,k,T,R,z]);return l.jsx(jm.Provider,{value:O,children:n})}function dr(){const n=m.useContext(jm);if(!n)throw new Error("useClaudeContext must be used within a ClaudeProvider");return n}const Mz=10,Wh="cyclist-message-queue";async function Pz(n){try{await fetch("/api/bell-queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(e){console.debug("[MessageQueue] Bell queue sync error:",e)}}function Lz(){const[n,e]=m.useState(()=>{try{const O=localStorage.getItem(Wh);return O?JSON.parse(O):[]}catch{return[]}}),[i,a]=m.useState(!1),[r,c]=m.useState(!1),[d,h]=m.useState(!1),f=m.useRef(n),p=m.useRef(r),y=m.useRef(new Set);m.useEffect(()=>{f.current=n},[n]),m.useEffect(()=>{p.current=r},[r]),m.useEffect(()=>{fetch("/api/settings").then(G=>G.json()).then(G=>{G?.workflow?.bell_mode&&c(!0)}).catch(G=>console.debug("[MessageQueue] Failed to load settings:",G));const O=window.location.protocol==="https:"?"wss:":"ws:",A=new WebSocket(`${O}//${window.location.host}/ws/settings`);return A.onmessage=G=>{try{const U=JSON.parse(G.data);if(U.type==="init"||U.type==="update"){const B=U.settings?.workflow;c(!!B?.bell_mode)}}catch{}},()=>A.close()},[]),m.useEffect(()=>{const A=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/bell`;let G=null,U;const B=()=>{try{G=new WebSocket(A),G.onmessage=$=>{try{if(JSON.parse($.data).type==="bell-consumed"){const ne=f.current[0];e(W=>{if(W.length===0)return W;const M=W.slice(1);try{localStorage.setItem(Wh,JSON.stringify(M))}catch{}return M}),ne&&(console.log("[MessageQueue] Bell consumed, notifying callbacks:",ne.text),y.current.forEach(W=>{try{W(ne)}catch(M){console.error("[MessageQueue] Bell consumed callback error:",M)}}))}}catch(ae){console.error("[MessageQueue] Failed to parse bell message:",ae)}},G.onclose=()=>{console.log("[MessageQueue] Bell WebSocket closed, reconnecting..."),U=setTimeout(B,2e3)},G.onerror=()=>{}}catch($){console.debug("[MessageQueue] Bell WebSocket init failed:",$)}};return B(),()=>{clearTimeout(U),G?.close()}},[]);const b=m.useCallback(O=>{try{localStorage.setItem(Wh,JSON.stringify(O))}catch{}Pz(O)},[]),x=m.useCallback(O=>!O.text.trim()&&O.images.length===0||f.current.length>=Mz?!1:(e(A=>{const G=[...A,O];return b(G),G}),!0),[b]),w=m.useCallback(()=>{let O=null;return e(A=>{if(A.length===0)return A;O=A[0];const G=A.slice(1);return b(G),G}),O},[b]),E=m.useCallback(O=>{e(A=>{if(O<0||O>=A.length)return A;const G=[...A.slice(0,O),...A.slice(O+1)];return b(G),G})},[b]),C=m.useCallback(()=>{e([]),b([])},[b]),S=m.useCallback(O=>{a(O)},[]),D=m.useCallback(O=>{c(O)},[]),N=m.useCallback(()=>{h(!0),console.log("[MessageQueue] Queue paused")},[]),k=m.useCallback(()=>{h(!1),console.log("[MessageQueue] Queue resumed")},[]),T=m.useCallback(O=>{if(d){console.log("[MessageQueue] Queue paused, skipping turn complete");return}const A=f.current;if(A.length!==0){console.log("[MessageQueue] Turn complete, sending",A.length,"queued messages");for(const G of A)O(G.text,G.images);e([]),b([])}},[d,b]),R=m.useCallback(O=>(y.current.add(O),()=>{y.current.delete(O)}),[]),z=m.useCallback(async(O,A)=>{const G=f.current;if(O<0||O>=G.length)return!1;const U=G[O];return U?(e(B=>{const $=[...B.slice(0,O),...B.slice(O+1)];return b($),$}),console.log("[MessageQueue] Injecting message, aborting Claude..."),A.abort(),await new Promise(B=>setTimeout(B,100)),console.log("[MessageQueue] Submitting injected message:",U.text),A.submit(U.text,U.images),!0):!1},[b]);return{queue:n,queueCount:n.length,isProcessing:i,bellMode:r,queuePaused:d,queueMessage:x,dequeueMessage:w,removeFromQueue:E,clearQueue:C,setProcessing:S,setBellMode:D,pauseQueue:N,resumeQueue:k,handleTurnComplete:T,onBellConsumed:R,injectMessage:z}}const p0=m.createContext(null);function Iz({children:n}){const{queue:e,queueCount:i,isProcessing:a,bellMode:r,queuePaused:c,queueMessage:d,dequeueMessage:h,removeFromQueue:f,clearQueue:p,setProcessing:y,setBellMode:b,pauseQueue:x,resumeQueue:w,handleTurnComplete:E,onBellConsumed:C,injectMessage:S}=Lz(),D=m.useMemo(()=>({queue:e,queueCount:i,isProcessing:a,bellMode:r,queuePaused:c,queueMessage:d,dequeueMessage:h,removeFromQueue:f,clearQueue:p,setProcessing:y,setBellMode:b,pauseQueue:x,resumeQueue:w,handleTurnComplete:E,onBellConsumed:C,injectMessage:S}),[e,i,a,r,c,d,h,f,p,y,b,x,w,E,C,S]);return l.jsx(p0.Provider,{value:D,children:n})}function g0(){const n=m.useContext(p0);if(!n)throw new Error("useMessageQueueContext must be used within a MessageQueueProvider");return n}const Gz=300;function Bz(n){if(!n||typeof n!="object")return!1;const e=n;if(!e.grid||typeof e.grid!="object"||!e.panels||typeof e.panels!="object"||Object.keys(e.panels).length===0)return!1;const i=e.grid;return!(!i.root||typeof i.width!="number"||typeof i.height!="number")}function Hz(n="/api/settings/layout"){const[e,i]=m.useState(null),[a,r]=m.useState(!0),[c,d]=m.useState(!1),[h,f]=m.useState(null),p=m.useRef(null),y=m.useRef(null);m.useEffect(()=>{(async()=>{try{const w=await fetch(n);if(w.ok){const E=await w.json();E.layout&&Bz(E.layout)?i(E.layout):i(null)}else i(null)}catch(w){console.error("[useLayoutPersistence] Failed to load layout:",w),i(null),f(w instanceof Error?w:new Error("Failed to load layout"))}finally{r(!1)}})()},[n]);const b=m.useCallback(x=>{y.current=x,p.current&&clearTimeout(p.current),p.current=setTimeout(async()=>{const w=y.current;if(w){d(!0);try{if(!(await fetch(n,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(w)})).ok)throw new Error("Failed to save layout");f(null)}catch(E){console.error("[useLayoutPersistence] Failed to save layout:",E),f(E instanceof Error?E:new Error("Failed to save layout"))}finally{d(!1)}}},Gz)},[n]);return m.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),{layout:e,isLoading:a,isSaving:c,error:h,saveLayout:b}}const v0=[{id:"system",name:"System",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},{id:"inter",name:"Inter",fontFamily:"'Inter', system-ui, -apple-system, sans-serif"},{id:"custom",name:"Custom",fontFamily:"",isCustom:!0}],y0=[{id:"system-mono",name:"System Mono",fontFamily:"ui-monospace, 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace"},{id:"jetbrains-mono",name:"JetBrains Mono",fontFamily:"'JetBrains Mono', ui-monospace, 'SF Mono', Monaco, monospace"},{id:"fira-code",name:"Fira Code",fontFamily:"'Fira Code', ui-monospace, 'SF Mono', Monaco, monospace"},{id:"custom",name:"Custom",fontFamily:"",isCustom:!0}],Cf={xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem"};function mx(n){return!n||typeof n!="string"?"":n.replace(/[;{}()<>\\]/g,"").replace(/javascript:/gi,"").replace(/expression\s*\(/gi,"").trim().slice(0,500)}const Tm={uiFont:"system",codeFont:"system-mono",uiFontSize:"base",codeFontSize:"base"};let bc={...Tm};function Vz(n,e){document.documentElement.style.setProperty("--font-size-ui",Cf[n]),document.documentElement.style.setProperty("--font-size-code",Cf[e])}function nc(n){const e=v0.find(a=>a.id===n.uiFont);if(e){const a=e.isCustom&&n.customUiFont?mx(n.customUiFont):e.fontFamily;document.documentElement.style.setProperty("--font-ui",a)}const i=y0.find(a=>a.id===n.codeFont);if(i){const a=i.isCustom&&n.customCodeFont?mx(n.customCodeFont):i.fontFamily;document.documentElement.style.setProperty("--font-mono",a)}Vz(n.uiFontSize,n.codeFontSize),bc={...n}}async function px(n){bc={...n};try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({display:{fonts:n}})})}catch(e){console.error("[font-presets] Failed to save settings:",e)}}async function b0(){try{const n=await fetch("/api/settings");if(n.ok){const e=await n.json();if(e?.display?.fonts)return bc={...e.display.fonts},bc}}catch(n){console.error("[font-presets] Failed to load settings:",n)}return{...Tm}}const ic="midnight",x0={midnight:{id:"midnight",name:"Midnight",variant:"dark",colors:{bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgTertiary:"#0f0f1a",textPrimary:"#e4e4e7",textSecondary:"#a1a1aa",textMuted:"#71717a",accent:"#818cf8",accentHover:"#a5b4fc",border:"#27272a",borderFocus:"#818cf8"},terminalColors:{background:"#0f0f1a",foreground:"#e4e4e7",black:"#1a1a2e",red:"#ff6b6b",green:"#69db7c",yellow:"#ffd43b",blue:"#818cf8",magenta:"#cc5de8",cyan:"#22b8cf",white:"#e4e4e7"}},daylight:{id:"daylight",name:"Daylight",variant:"light",colors:{bgPrimary:"#ffffff",bgSecondary:"#f4f4f5",bgTertiary:"#e4e4e7",textPrimary:"#18181b",textSecondary:"#3f3f46",textMuted:"#71717a",accent:"#4f46e5",accentHover:"#4338ca",border:"#d4d4d8",borderFocus:"#4f46e5"},terminalColors:{background:"#ffffff",foreground:"#18181b",black:"#18181b",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#f4f4f5"}},"high-contrast":{id:"high-contrast",name:"High Contrast",variant:"dark",colors:{bgPrimary:"#000000",bgSecondary:"#0a0a0a",bgTertiary:"#141414",textPrimary:"#ffffff",textSecondary:"#e5e5e5",textMuted:"#a3a3a3",accent:"#ffff00",accentHover:"#ffff66",border:"#404040",borderFocus:"#ffff00"},terminalColors:{background:"#000000",foreground:"#ffffff",black:"#000000",red:"#ff0000",green:"#00ff00",yellow:"#ffff00",blue:"#0080ff",magenta:"#ff00ff",cyan:"#00ffff",white:"#ffffff"}},dracula:{id:"dracula",name:"Dracula",variant:"dark",colors:{bgPrimary:"#282A36",bgSecondary:"#21222C",bgTertiary:"#191A21",textPrimary:"#F8F8F2",textSecondary:"#BFBFBF",textMuted:"#6272A4",accent:"#BD93F9",accentHover:"#CAA9FA",border:"#44475A",borderFocus:"#BD93F9"},terminalColors:{background:"#282A36",foreground:"#F8F8F2",black:"#21222C",red:"#FF5555",green:"#50FA7B",yellow:"#F1FA8C",blue:"#BD93F9",magenta:"#FF79C6",cyan:"#8BE9FD",white:"#F8F8F2"}},nord:{id:"nord",name:"Nord",variant:"dark",colors:{bgPrimary:"#2E3440",bgSecondary:"#3B4252",bgTertiary:"#434C5E",textPrimary:"#ECEFF4",textSecondary:"#D8DEE9",textMuted:"#4C566A",accent:"#88C0D0",accentHover:"#8FBCBB",border:"#4C566A",borderFocus:"#88C0D0"},terminalColors:{background:"#2E3440",foreground:"#ECEFF4",black:"#3B4252",red:"#BF616A",green:"#A3BE8C",yellow:"#EBCB8B",blue:"#81A1C1",magenta:"#B48EAD",cyan:"#88C0D0",white:"#ECEFF4"}},gruvbox:{id:"gruvbox",name:"Gruvbox",variant:"dark",colors:{bgPrimary:"#1D2021",bgSecondary:"#282828",bgTertiary:"#3C3836",textPrimary:"#EBDBB2",textSecondary:"#D5C4A1",textMuted:"#928374",accent:"#8EC07C",accentHover:"#B8BB26",border:"#504945",borderFocus:"#8EC07C"},terminalColors:{background:"#1D2021",foreground:"#EBDBB2",black:"#282828",red:"#CC241D",green:"#98971A",yellow:"#D79921",blue:"#458588",magenta:"#B16286",cyan:"#689D6A",white:"#EBDBB2"}},catppuccin:{id:"catppuccin",name:"Catppuccin",variant:"dark",colors:{bgPrimary:"#1E1E2E",bgSecondary:"#181825",bgTertiary:"#11111B",textPrimary:"#CDD6F4",textSecondary:"#BAC2DE",textMuted:"#6C7086",accent:"#89B4FA",accentHover:"#74C7EC",border:"#45475A",borderFocus:"#89B4FA"},terminalColors:{background:"#1E1E2E",foreground:"#CDD6F4",black:"#45475A",red:"#F38BA8",green:"#A6E3A1",yellow:"#F9E2AF",blue:"#89B4FA",magenta:"#F5C2E7",cyan:"#94E2D5",white:"#CDD6F4"}},"tokyo-night":{id:"tokyo-night",name:"Tokyo Night",variant:"dark",colors:{bgPrimary:"#1A1B26",bgSecondary:"#16161E",bgTertiary:"#13131A",textPrimary:"#A9B1D6",textSecondary:"#9AA5CE",textMuted:"#565F89",accent:"#7AA2F7",accentHover:"#7DCFFF",border:"#292E42",borderFocus:"#7AA2F7"},terminalColors:{background:"#1A1B26",foreground:"#A9B1D6",black:"#32344A",red:"#F7768E",green:"#9ECE6A",yellow:"#E0AF68",blue:"#7AA2F7",magenta:"#BB9AF7",cyan:"#7DCFFF",white:"#A9B1D6"}},"solarized-dark":{id:"solarized-dark",name:"Solarized Dark",variant:"dark",colors:{bgPrimary:"#002B36",bgSecondary:"#073642",bgTertiary:"#001E27",textPrimary:"#839496",textSecondary:"#657B83",textMuted:"#586E75",accent:"#2B9ED8",accentHover:"#2AA198",border:"#094959",borderFocus:"#2B9ED8"},terminalColors:{background:"#002B36",foreground:"#839496",black:"#073642",red:"#DC322F",green:"#859900",yellow:"#B58900",blue:"#268BD2",magenta:"#D33682",cyan:"#2AA198",white:"#EEE8D5"}},"solarized-light":{id:"solarized-light",name:"Solarized Light",variant:"light",colors:{bgPrimary:"#FDF6E3",bgSecondary:"#EEE8D5",bgTertiary:"#DDD6C1",textPrimary:"#475B62",textSecondary:"#586E75",textMuted:"#93A1A1",accent:"#0B69AD",accentHover:"#2AA198",border:"#D3CBB8",borderFocus:"#0B69AD"},terminalColors:{background:"#FDF6E3",foreground:"#657B83",black:"#073642",red:"#DC322F",green:"#859900",yellow:"#B58900",blue:"#268BD2",magenta:"#D33682",cyan:"#2AA198",white:"#FDF6E3"}},monokai:{id:"monokai",name:"Monokai",variant:"dark",colors:{bgPrimary:"#272822",bgSecondary:"#1E1F1C",bgTertiary:"#171813",textPrimary:"#F8F8F2",textSecondary:"#CFCFC2",textMuted:"#75715E",accent:"#A6E22E",accentHover:"#E6DB74",border:"#3E3D32",borderFocus:"#A6E22E"},terminalColors:{background:"#272822",foreground:"#F8F8F2",black:"#272822",red:"#F92672",green:"#A6E22E",yellow:"#F4BF75",blue:"#66D9EF",magenta:"#AE81FF",cyan:"#A1EFE4",white:"#F8F8F2"}},"one-dark":{id:"one-dark",name:"One Dark",variant:"dark",colors:{bgPrimary:"#282C34",bgSecondary:"#21252B",bgTertiary:"#1B1D23",textPrimary:"#ABB2BF",textSecondary:"#9DA5B4",textMuted:"#636D83",accent:"#61AFEF",accentHover:"#528BFF",border:"#3E4451",borderFocus:"#61AFEF"},terminalColors:{background:"#282C34",foreground:"#ABB2BF",black:"#3F4451",red:"#E06C75",green:"#98C379",yellow:"#E5C07B",blue:"#61AFEF",magenta:"#C678DD",cyan:"#56B6C2",white:"#ABB2BF"}},"one-light":{id:"one-light",name:"One Light",variant:"light",colors:{bgPrimary:"#FAFAFA",bgSecondary:"#F0F0F0",bgTertiary:"#E5E5E6",textPrimary:"#383A42",textSecondary:"#4F525D",textMuted:"#A0A1A7",accent:"#3367D6",accentHover:"#526FFF",border:"#D3D3D4",borderFocus:"#3367D6"},terminalColors:{background:"#FAFAFA",foreground:"#383A42",black:"#383A42",red:"#E45649",green:"#50A14F",yellow:"#C18401",blue:"#4078F2",magenta:"#A626A4",cyan:"#0184BC",white:"#FAFAFA"}},"github-dark":{id:"github-dark",name:"GitHub Dark",variant:"dark",colors:{bgPrimary:"#0D1117",bgSecondary:"#161B22",bgTertiary:"#010409",textPrimary:"#C9D1D9",textSecondary:"#8B949E",textMuted:"#6E7681",accent:"#58A6FF",accentHover:"#79C0FF",border:"#30363D",borderFocus:"#58A6FF"},terminalColors:{background:"#0D1117",foreground:"#C9D1D9",black:"#484F58",red:"#FF7B72",green:"#7EE787",yellow:"#D29922",blue:"#58A6FF",magenta:"#BC8CFF",cyan:"#39C5CF",white:"#C9D1D9"}},"github-light":{id:"github-light",name:"GitHub Light",variant:"light",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F6F8FA",bgTertiary:"#EAEEF2",textPrimary:"#1F2328",textSecondary:"#656D76",textMuted:"#8C959F",accent:"#0969DA",accentHover:"#0550AE",border:"#D0D7DE",borderFocus:"#0969DA"},terminalColors:{background:"#FFFFFF",foreground:"#1F2328",black:"#24292F",red:"#CF222E",green:"#1A7F37",yellow:"#9A6700",blue:"#0969DA",magenta:"#8250DF",cyan:"#1B7C83",white:"#FFFFFF"}},"rose-pine":{id:"rose-pine",name:"Rosé Pine",variant:"dark",colors:{bgPrimary:"#191724",bgSecondary:"#1F1D2E",bgTertiary:"#26233A",textPrimary:"#E0DEF4",textSecondary:"#908CAA",textMuted:"#6E6A86",accent:"#C4A7E7",accentHover:"#EB6F92",border:"#403D52",borderFocus:"#C4A7E7"},terminalColors:{background:"#191724",foreground:"#E0DEF4",black:"#26233A",red:"#EB6F92",green:"#31748F",yellow:"#F6C177",blue:"#9CCFD8",magenta:"#C4A7E7",cyan:"#EBBCBA",white:"#E0DEF4"}},"rose-pine-dawn":{id:"rose-pine-dawn",name:"Rosé Pine Dawn",variant:"light",colors:{bgPrimary:"#FAF4ED",bgSecondary:"#FFFAF3",bgTertiary:"#F2E9E1",textPrimary:"#575279",textSecondary:"#797593",textMuted:"#9893A5",accent:"#735E8C",accentHover:"#B4637A",border:"#DFDAD9",borderFocus:"#735E8C"},terminalColors:{background:"#FAF4ED",foreground:"#575279",black:"#575279",red:"#B4637A",green:"#286983",yellow:"#EA9D34",blue:"#56949F",magenta:"#907AA9",cyan:"#D7827E",white:"#FAF4ED"}},kanagawa:{id:"kanagawa",name:"Kanagawa",variant:"dark",colors:{bgPrimary:"#1F1F28",bgSecondary:"#2A2A37",bgTertiary:"#16161D",textPrimary:"#DCD7BA",textSecondary:"#C8C093",textMuted:"#727169",accent:"#7E9CD8",accentHover:"#7FB4CA",border:"#363646",borderFocus:"#7E9CD8"},terminalColors:{background:"#1F1F28",foreground:"#DCD7BA",black:"#16161D",red:"#C34043",green:"#76946A",yellow:"#C0A36E",blue:"#7E9CD8",magenta:"#957FB8",cyan:"#6A9589",white:"#DCD7BA"}},"ayu-dark":{id:"ayu-dark",name:"Ayu Dark",variant:"dark",colors:{bgPrimary:"#0B0E14",bgSecondary:"#0D1017",bgTertiary:"#060810",textPrimary:"#BFBDB6",textSecondary:"#9B9B9B",textMuted:"#636A72",accent:"#E6B450",accentHover:"#FFB454",border:"#1C1F27",borderFocus:"#E6B450"},terminalColors:{background:"#0B0E14",foreground:"#BFBDB6",black:"#01060E",red:"#EA6C73",green:"#91B362",yellow:"#F9AF4F",blue:"#53BDFA",magenta:"#D2A6FF",cyan:"#90E1C6",white:"#C7C7C7"}},"ayu-light":{id:"ayu-light",name:"Ayu Light",variant:"light",colors:{bgPrimary:"#FCFCFC",bgSecondary:"#F3F4F5",bgTertiary:"#E7E8E9",textPrimary:"#5C6166",textSecondary:"#787B80",textMuted:"#ABB0B6",accent:"#9E5E08",accentHover:"#F2AE49",border:"#D8D8D8",borderFocus:"#9E5E08"},terminalColors:{background:"#FCFCFC",foreground:"#5C6166",black:"#1A1F29",red:"#F07171",green:"#86B300",yellow:"#F2AE49",blue:"#399EE6",magenta:"#A37ACC",cyan:"#4CBF99",white:"#FCFCFC"}}};function Cn(n){return x0[n]}function Fz(){return Object.keys(x0)}function _f(n){const e=Cn(n);if(!e){console.error(`[color-presets] Unknown preset: ${n}`);return}const i=document.documentElement;i.classList.add("theme-transition"),i.setAttribute("data-preset",e.id),i.setAttribute("data-variant",e.variant),i.style.setProperty("--bg-primary",e.colors.bgPrimary),i.style.setProperty("--bg-secondary",e.colors.bgSecondary),i.style.setProperty("--bg-tertiary",e.colors.bgTertiary),i.style.setProperty("--text-primary",e.colors.textPrimary),i.style.setProperty("--text-secondary",e.colors.textSecondary),i.style.setProperty("--text-muted",e.colors.textMuted),i.style.setProperty("--accent",e.colors.accent),i.style.setProperty("--accent-hover",e.colors.accentHover),i.style.setProperty("--border",e.colors.border),i.style.setProperty("--border-focus",e.colors.borderFocus),i.style.setProperty("--terminal-background",e.terminalColors.background),i.style.setProperty("--terminal-foreground",e.terminalColors.foreground),i.style.setProperty("--terminal-black",e.terminalColors.black),i.style.setProperty("--terminal-red",e.terminalColors.red),i.style.setProperty("--terminal-green",e.terminalColors.green),i.style.setProperty("--terminal-yellow",e.terminalColors.yellow),i.style.setProperty("--terminal-blue",e.terminalColors.blue),i.style.setProperty("--terminal-magenta",e.terminalColors.magenta),i.style.setProperty("--terminal-cyan",e.terminalColors.cyan),i.style.setProperty("--terminal-white",e.terminalColors.white),window.dispatchEvent(new CustomEvent("presetChange",{detail:{presetId:n}}))}async function Uz(n){if(!Cn(n))throw new Error(`Invalid preset id: ${n}`);try{return(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({display:{colorPreset:n}})})).ok}catch(e){return console.error("[color-presets] Failed to save preset:",e),!1}}async function w0(){try{const n=await fetch("/api/settings");if(n.ok){const i=(await n.json())?.display?.colorPreset;return i&&Cn(i)?i:ic}return ic}catch(n){return console.error("[color-presets] Failed to load preset:",n),ic}}const $z=Bf("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function $e({className:n,variant:e,...i}){return l.jsx("div",{className:ye($z({variant:e}),n),...i})}const S0=m.forwardRef(({children:n,onScrollChange:e,autoScroll:i=!0},a)=>{const r=m.useRef(null),c=m.useRef(!0),d=m.useCallback(p=>{const y=r.current;if(!y)return!0;const b=p??y.scrollTop,x=y.scrollHeight||0,w=y.clientHeight||0;return b===0&&x===0&&y.children.length>0||b===0&&x>w?!1:x<=w?!0:x-b-w<50},[]),h=m.useCallback((p="auto")=>{const y=r.current;y&&y.scrollTo({top:y.scrollHeight,behavior:p})},[]);m.useImperativeHandle(a,()=>({scrollToBottom:h}));const f=m.useCallback(p=>{const y=p.target,b=d(y.scrollTop);c.current=b,e?.(b)},[d,e]);return m.useEffect(()=>{i&&c.current&&h()},[n,i,h]),l.jsx("div",{ref:r,"data-testid":"message-list",className:"message-list",onScroll:f,children:n})});S0.displayName="MessageList";const Wz=new Set(["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","new","this","class","extends","import","export","from","default","async","await","try","catch","finally","throw","typeof","instanceof","in","of","true","false","null","undefined","void"]),qz=new Set(["def","class","return","if","elif","else","for","while","break","continue","import","from","as","try","except","finally","raise","with","lambda","yield","True","False","None","and","or","not","in","is","pass","self"]),Yz=new Set(["func","return","if","else","for","range","switch","case","break","continue","go","defer","chan","select","type","struct","interface","map","package","import","var","const","true","false","nil","make","new","append","len","cap","error"]),Xz=new Set(["fn","let","mut","return","if","else","for","while","loop","match","break","continue","impl","struct","enum","trait","pub","use","mod","crate","self","super","where","async","await","true","false","Some","None","Ok","Err"]),Qz=new Set(["if","then","else","elif","fi","for","while","do","done","case","esac","function","return","exit","export","source","alias","cd","echo","printf","read","local"]);function Zz(n){const e=n.toLowerCase();return["js","javascript","ts","typescript","jsx","tsx"].includes(e)?Wz:["python","py"].includes(e)?qz:["go","golang"].includes(e)?Yz:["rust","rs"].includes(e)?Xz:["bash","sh","shell","zsh"].includes(e)?Qz:new Set}function Kz(n){const e=n.toLowerCase();return["js","javascript","ts","typescript","jsx","tsx","go","golang","rust","rs"].includes(e)}function Jz(n){const e=n.toLowerCase();return["python","py","bash","sh","shell","zsh"].includes(e)}function eM(n,e,i){if(!n.trim())return n;const a=n.trim();if(Kz(i)&&a.startsWith("//"))return`<span class="comment">${n}</span>`;if(Jz(i)&&a.startsWith("#"))return`<span class="comment">${n}</span>`;let r="",c=0;for(;c<n.length;){if(n.slice(c,c+6)==="&quot;"){const d=n.indexOf("&quot;",c+6);if(d!==-1){r+=`<span class="string">${n.slice(c,d+6)}</span>`,c=d+6;continue}}if(n.slice(c,c+5)==="&#39;"||n.slice(c,c+6)==="&#039;"){const d=n.slice(c,c+6)==="&#039;"?6:5,h=n.slice(c,c+d),f=n.indexOf(h,c+d);if(f!==-1){r+=`<span class="string">${n.slice(c,f+d)}</span>`,c=f+d;continue}}if(/[a-zA-Z_]/.test(n[c])){let d="";for(;c<n.length&&/[a-zA-Z0-9_]/.test(n[c]);)d+=n[c],c++;e.has(d)?r+=`<span class="keyword">${d}</span>`:n[c]==="("?r+=`<span class="function">${d}</span>`:r+=d;continue}if(/[0-9]/.test(n[c])){let d="";for(;c<n.length&&/[0-9.]/.test(n[c]);)d+=n[c],c++;r+=`<span class="number">${d}</span>`;continue}r+=n[c],c++}return r}function tM(n,e){if(!n||!e)return n||"";const i=Zz(e);return n.split(`
54
54
  `).map(c=>eM(c,i,e)).join(`
55
55
  `)}function nM(n){return n&&n.replace(/<!--\s*CYCLIST:[^>]+?\s*-->/gi,"").trim()}function iM(n){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};return n.replace(/[&<>"']/g,i=>e[i])}function Ef(n){return n.split("|").map(e=>e.trim()).filter((e,i,a)=>!(i===0&&e===""||i===a.length-1&&e===""))}function sM(n){return Ef(n).every(i=>/^[-:]+$/.test(i))}function gx(n){if(n.length===0)return"";const e=[];let i=null,a=!1;for(const c of n){if(sM(c)){a=!0;continue}!a&&i===null?i=c:e.push(c)}let r='<div class="table-wrapper"><table>';if(i){const c=Ef(i);r+="<thead><tr>";for(let d=0;d<c.length;d++)r+=`<th data-col="${d}" class="sortable-th">${c[d]} <span class="sort-indicator"></span></th>`;r+="</tr></thead>"}if(e.length>0){r+="<tbody>";for(const c of e){const d=Ef(c);r+="<tr>";for(const h of d)r+=`<td>${h}</td>`;r+="</tr>"}r+="</tbody>"}return r+="</table></div>",r}function aM(n){const e=n.split(`
56
56
  `),i=[];let a=[],r=!1;for(let c=0;c<e.length;c++){const d=e[c].trim();d.startsWith("|")&&d.includes("|",1)?(r||(r=!0,a=[]),a.push(d)):(r&&a.length>0&&(i.push(gx(a)),a=[],r=!1),i.push(e[c]))}return r&&a.length>0&&i.push(gx(a)),i.join(`
57
57
  `)}function Df(n){if(!n)return"";const e=nM(n);let i=iM(e);return i=i.replace(/```(\w+)?\n?([\s\S]*?)```/g,(a,r,c)=>{const d=r?` class="language-${r}"`:"",h=r?tM(c.trim(),r):c.trim();return`<pre><code${d}>${h}</code></pre>`}),i=i.replace(/^(\d+\.\s+.+)\n((?: +[^\n]+\n)+)/gm,(a,r,c)=>{const d=c.trim().replace(/\n\s*/g," ");return`${r} ${d}
58
- `}),i=i.replace(/`([^`]+)`/g,"<code>$1</code>"),i=aM(i),i=i.replace(/^######\s+(.+)$/gm,"<h6>$1</h6>"),i=i.replace(/^#####\s+(.+)$/gm,"<h5>$1</h5>"),i=i.replace(/^####\s+(.+)$/gm,"<h4>$1</h4>"),i=i.replace(/^###\s+(.+)$/gm,"<h3>$1</h3>"),i=i.replace(/^##\s+(.+)$/gm,"<h2>$1</h2>"),i=i.replace(/^#\s+(.+)$/gm,"<h1>$1</h1>"),i=i.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),i=i.replace(/\*([^*]+)\*/g,"<em>$1</em>"),i=i.replace(/^- (.+)$/gm,"<li data-ul>$1</li>"),i=i.replace(/^\d+\.\s+(.+)$/gm,"<li data-ol>$1</li>"),i=i.replace(/(<li data-ul>.*?<\/li>\n?)+/g,a=>`<ul>${a.replace(/ data-ul/g,"")}</ul>`),i=i.replace(/(<li data-ol>.*?<\/li>\n?)+/g,a=>`<ol>${a.replace(/ data-ol/g,"")}</ol>`),i=i.replace(/^(?!<[hulodtp]|<pre|<li)(.+)$/gm,"<p>$1</p>"),i}function oM({content:n,isStreaming:e}){const i=Df(n),[a,r]=m.useState(""),c=m.useRef(0),d=m.useRef(null);return m.useEffect(()=>{e?r("Claude is thinking..."):n&&c.current>0&&r("Response complete")},[e,n]),m.useEffect(()=>{if(!e){c.current=n.length;return}return d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{n.length>c.current&&(c.current=n.length)},2e3),()=>{d.current&&clearTimeout(d.current)}},[n,e]),l.jsxs(l.Fragment,{children:[l.jsx("div",{role:"status","aria-live":"polite",className:"visually-hidden",children:a}),l.jsx("div",{"data-testid":"streaming-content",className:"streaming-content","aria-busy":e,"aria-atomic":"false","aria-live":"polite",children:l.jsx("div",{dangerouslySetInnerHTML:{__html:i}})})]})}function Zc(){const[n,e]=m.useState(null),[i,a]=m.useState(!1),[r,c]=m.useState(!0),[d,h]=m.useState(null),f=m.useRef(null),p=m.useRef();return m.useEffect(()=>{const b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/persona`,x=()=>{try{f.current=new WebSocket(b),f.current.onopen=()=>{console.debug("[usePersona] WebSocket connected")},f.current.onmessage=w=>{try{const E=JSON.parse(w.data);if(E.type==="streaming"){a(E.isStreaming??!1);return}E.isStreaming!==void 0&&a(E.isStreaming),e(E),c(!1),h(null)}catch(E){console.error("[usePersona] Failed to parse message:",E)}},f.current.onclose=()=>{console.debug("[usePersona] WebSocket closed, reconnecting..."),a(!1),p.current=setTimeout(x,2e3)},f.current.onerror=w=>{console.error("[usePersona] WebSocket error:",w),h(new Error("WebSocket connection failed"))}}catch(w){console.error("[usePersona] WebSocket init failed:",w),h(w instanceof Error?w:new Error("Failed to connect")),c(!1)}};return x(),()=>{p.current&&clearTimeout(p.current),f.current&&f.current.close()}},[]),{persona:n,isStreaming:i,isLoading:r,error:d}}const qh="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDQwIDQwIj48Y2lyY2xlIGN4PSIyMCIgY3k9IjIwIiByPSIyMCIgZmlsbD0iIzY2NiIvPjxjaXJjbGUgY3g9IjIwIiBjeT0iMTUiIHI9IjgiIGZpbGw9IiNhYWEiLz48ZWxsaXBzZSBjeD0iMjAiIGN5PSIzNSIgcng9IjEyIiByeT0iMTAiIGZpbGw9IiNhYWEiLz48L3N2Zz4=";function rM(){const[n,e]=m.useState(null),[i,a]=m.useState(!0),[r,c]=m.useState(null);return m.useEffect(()=>{(async()=>{try{const h=await fetch("/api/identity");if(h.ok){const f=await h.json();f.avatarUrl?e(f.avatarUrl):e(qh)}else e(qh);a(!1)}catch(h){c(h instanceof Error?h:new Error("Failed to fetch avatar")),e(qh),a(!1)}})()},[]),{avatarUrl:n,isLoading:i,error:r}}function vx({isStreaming:n,agentSlug:e,agentTheme:i,agentCharacter:a}){const{persona:r}=Zc(),[c,d]=m.useState(!1),h=e||r?.slug,f=i||r?.theme,p=a||r?.character,y=n?"avatar-portrait avatar-thinking":"avatar-portrait";return h&&f&&!c?l.jsx("img",{src:`/portraits/${f}/small/${h}.png`,alt:p||"Agent",className:y,onError:()=>d(!0)}):l.jsx("span",{className:n?"avatar-emoji avatar-thinking":"avatar-emoji",children:"🤖"})}function yx(){const{avatarUrl:n,isLoading:e}=rM(),[i,a]=m.useState(!1);return e?l.jsx("span",{className:"avatar-emoji",children:"👤"}):n&&!i?l.jsx("img",{src:n,alt:"User",className:"avatar-portrait",onError:()=>a(!0)}):l.jsx("span",{className:"avatar-emoji",children:"👤"})}function lM(n){const e=m.useCallback(()=>{const i=n.current;if(!i)return;i.querySelectorAll("th.sortable-th").forEach(r=>{r.dataset.sortBound||(r.dataset.sortBound="1",r.style.cursor="pointer",r.addEventListener("click",()=>{const c=parseInt(r.dataset.col||"0",10),d=r.closest("table");if(!d)return;const h=d.querySelector("tbody");if(!h)return;const f=Array.from(h.querySelectorAll("tr")),p=r.dataset.sortDir==="asc"?"desc":"asc";d.querySelectorAll("th.sortable-th").forEach(b=>{b.dataset.sortDir="";const x=b.querySelector(".sort-indicator");x&&(x.textContent="")}),r.dataset.sortDir=p;const y=r.querySelector(".sort-indicator");y&&(y.textContent=p==="asc"?" ▲":" ▼"),f.sort((b,x)=>{const w=(b.children[c]?.textContent||"").trim(),E=(x.children[c]?.textContent||"").trim(),_=parseFloat(w),C=parseFloat(E);if(!isNaN(_)&&!isNaN(C))return p==="asc"?_-C:C-_;const D=w.localeCompare(E,void 0,{sensitivity:"base"});return p==="asc"?D:-D});for(const b of f)h.appendChild(b)}))})},[n]);m.useEffect(()=>{e()})}function CS({message:n,isLastAgentMessage:e,isFirstInTurn:i=!0}){const a=m.useRef(null);lM(a);const r=`message-${n.type}`,c=`message-${n.type}`,d=i?"":" continuation";if(n.type==="bell_injected"){const f=n.content?Df(n.content):"";return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{"data-testid":"message-bell-injected",className:`message message-user message-bell-injected${d}`,children:[l.jsx("div",{"data-testid":"avatar",className:"message-avatar",children:l.jsx(yx,{})}),l.jsxs("div",{className:"message-content",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"secondary",className:"bell-indicator",children:"🔔"})}),l.jsx(Te,{children:"Injected via Bell Mode"})]}),l.jsx("div",{dangerouslySetInnerHTML:{__html:f}}),n.imageCount&&n.imageCount>0&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs($e,{variant:"outline",className:"message-attachment-indicator",children:["📎 ",n.imageCount]})}),l.jsx(Te,{children:`${n.imageCount} image${n.imageCount>1?"s":""} attached`})]})]})]})})}if(n.type==="agent"&&n.isStreaming){const f=e!==!1;return l.jsxs("div",{"data-testid":c,className:`message ${r}${d}`,children:[l.jsx("div",{"data-testid":"avatar",className:"message-avatar",children:l.jsx(vx,{isStreaming:f,agentSlug:n.agentSlug,agentTheme:n.agentTheme,agentCharacter:n.agentCharacter})}),l.jsx("div",{className:"message-content",children:l.jsx(oM,{content:n.content||"",isStreaming:n.isStreaming??!1})})]})}const h=n.content?Df(n.content):"";return l.jsxs("div",{"data-testid":c,className:`message ${r}${d}`,ref:a,children:[l.jsx("div",{"data-testid":"avatar",className:"message-avatar",children:n.type==="user"?l.jsx(yx,{}):l.jsx(vx,{agentSlug:n.agentSlug,agentTheme:n.agentTheme,agentCharacter:n.agentCharacter})}),l.jsxs("div",{className:"message-content",children:[l.jsx("div",{dangerouslySetInnerHTML:{__html:h}}),n.type==="user"&&n.imageCount&&n.imageCount>0&&l.jsx(St,{delayDuration:300,children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs($e,{variant:"outline",className:"message-attachment-indicator",children:["📎 ",n.imageCount]})}),l.jsx(Te,{children:`${n.imageCount} image${n.imageCount>1?"s":""} attached`})]})})]})]})}function cM(n){return["Read","Write","Bash","Glob","Grep","Edit","Task"].includes(n)?`tool-${n.toLowerCase()}`:""}function _S(n){return n==null?"—":n<0?"0ms":n<1e3?`${Math.round(n)}ms`:`${(n/1e3).toFixed(1)}s`}const km=70;function Un(n,e=km-10){const i=n.replace(/\n/g," ");return i.length<=e?i:i.slice(0,e-3)+"..."}function Fn(n,e){if(!n)return"";const i=n[e];return i==null||i===""?"":String(i)}function uM(n){try{return new URL(n).hostname}catch{return n}}function dM(n){const e=n.toLowerCase();return e.startsWith("npm install")||e.startsWith("npm i ")||e==="npm i"||e.startsWith("pnpm install")||e.startsWith("pnpm add")||e.startsWith("yarn install")||e.startsWith("yarn add")?"Installing dependencies":e.startsWith("npm test")||e.startsWith("npm run test")||e.startsWith("pnpm test")||e.startsWith("pnpm run test")||e.startsWith("yarn test")||e.startsWith("vitest")||e.startsWith("jest")?"Running tests":e.startsWith("npm run build")||e.startsWith("pnpm run build")||e.startsWith("pnpm build")||e.startsWith("yarn build")?"Building project":e.startsWith("tsc")?"Type checking":e.startsWith("eslint")||e.startsWith("npm run lint")||e.startsWith("pnpm lint")?"Linting code":e.startsWith("prettier")?"Formatting code":`Running ${Un(n,km-8)}`}function Af(n,e){const i=e??{};switch(n){case"Read":{const a=Fn(i,"file_path");return a?Un(`Reading ${a}`):"Read"}case"Bash":{const a=Fn(i,"description");if(a)return Un(a);const r=Fn(i,"command");return r?dM(r):"Bash"}case"Glob":{const a=Fn(i,"pattern");return a?Un(`Finding ${a} files`):"Glob"}case"Grep":{const a=Fn(i,"pattern");if(!a)return"Grep";const r=a.replace(/^["']|["']$/g,"");return Un(`Searching for '${r}'`)}case"Write":{const a=Fn(i,"file_path");return a?Un(`Creating ${a}`):"Write"}case"Edit":{const a=Fn(i,"file_path");return a?Un(`Editing ${a}`):"Edit"}case"Task":{const a=Fn(i,"subagent_type");return a?`Launching ${a} agent`:"Task"}case"WebFetch":{const a=Fn(i,"url");if(!a)return"WebFetch";const r=uM(a);return Un(`Fetching ${r}`)}case"WebSearch":{const a=Fn(i,"query");return a?Un(`Searching web for '${a}'`):"WebSearch"}default:try{const a=JSON.stringify(i);if(a==="{}")return n;const r=km-n.length-3;return`${n} (${Un(a,r)})`}catch{return n}}}const bx=50;function hM(n){return n?n.replace(/\r\n/g,`
58
+ `}),i=i.replace(/`([^`]+)`/g,"<code>$1</code>"),i=aM(i),i=i.replace(/^######\s+(.+)$/gm,"<h6>$1</h6>"),i=i.replace(/^#####\s+(.+)$/gm,"<h5>$1</h5>"),i=i.replace(/^####\s+(.+)$/gm,"<h4>$1</h4>"),i=i.replace(/^###\s+(.+)$/gm,"<h3>$1</h3>"),i=i.replace(/^##\s+(.+)$/gm,"<h2>$1</h2>"),i=i.replace(/^#\s+(.+)$/gm,"<h1>$1</h1>"),i=i.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),i=i.replace(/\*([^*]+)\*/g,"<em>$1</em>"),i=i.replace(/^- (.+)$/gm,"<li data-ul>$1</li>"),i=i.replace(/^\d+\.\s+(.+)$/gm,"<li data-ol>$1</li>"),i=i.replace(/(<li data-ul>.*?<\/li>\n?)+/g,a=>`<ul>${a.replace(/ data-ul/g,"")}</ul>`),i=i.replace(/(<li data-ol>.*?<\/li>\n?)+/g,a=>`<ol>${a.replace(/ data-ol/g,"")}</ol>`),i=i.replace(/^(?!<[hulodtp]|<pre|<li)(.+)$/gm,"<p>$1</p>"),i}function oM({content:n,isStreaming:e}){const i=Df(n),[a,r]=m.useState(""),c=m.useRef(0),d=m.useRef(null);return m.useEffect(()=>{e?r("Claude is thinking..."):n&&c.current>0&&r("Response complete")},[e,n]),m.useEffect(()=>{if(!e){c.current=n.length;return}return d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{n.length>c.current&&(c.current=n.length)},2e3),()=>{d.current&&clearTimeout(d.current)}},[n,e]),l.jsxs(l.Fragment,{children:[l.jsx("div",{role:"status","aria-live":"polite",className:"visually-hidden",children:a}),l.jsx("div",{"data-testid":"streaming-content",className:"streaming-content","aria-busy":e,"aria-atomic":"false","aria-live":"polite",children:l.jsx("div",{dangerouslySetInnerHTML:{__html:i}})})]})}function Zc(){const[n,e]=m.useState(null),[i,a]=m.useState(!1),[r,c]=m.useState(!0),[d,h]=m.useState(null),f=m.useRef(null),p=m.useRef();return m.useEffect(()=>{const b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/persona`,x=()=>{try{f.current=new WebSocket(b),f.current.onopen=()=>{console.debug("[usePersona] WebSocket connected")},f.current.onmessage=w=>{try{const E=JSON.parse(w.data);if(E.type==="streaming"){a(E.isStreaming??!1);return}E.isStreaming!==void 0&&a(E.isStreaming),e(E),c(!1),h(null)}catch(E){console.error("[usePersona] Failed to parse message:",E)}},f.current.onclose=()=>{console.debug("[usePersona] WebSocket closed, reconnecting..."),a(!1),p.current=setTimeout(x,2e3)},f.current.onerror=w=>{console.error("[usePersona] WebSocket error:",w),h(new Error("WebSocket connection failed"))}}catch(w){console.error("[usePersona] WebSocket init failed:",w),h(w instanceof Error?w:new Error("Failed to connect")),c(!1)}};return x(),()=>{p.current&&clearTimeout(p.current),f.current&&f.current.close()}},[]),{persona:n,isStreaming:i,isLoading:r,error:d}}const qh="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDQwIDQwIj48Y2lyY2xlIGN4PSIyMCIgY3k9IjIwIiByPSIyMCIgZmlsbD0iIzY2NiIvPjxjaXJjbGUgY3g9IjIwIiBjeT0iMTUiIHI9IjgiIGZpbGw9IiNhYWEiLz48ZWxsaXBzZSBjeD0iMjAiIGN5PSIzNSIgcng9IjEyIiByeT0iMTAiIGZpbGw9IiNhYWEiLz48L3N2Zz4=";function rM(){const[n,e]=m.useState(null),[i,a]=m.useState(!0),[r,c]=m.useState(null);return m.useEffect(()=>{(async()=>{try{const h=await fetch("/api/identity");if(h.ok){const f=await h.json();f.avatarUrl?e(f.avatarUrl):e(qh)}else e(qh);a(!1)}catch(h){c(h instanceof Error?h:new Error("Failed to fetch avatar")),e(qh),a(!1)}})()},[]),{avatarUrl:n,isLoading:i,error:r}}function vx({isStreaming:n,agentSlug:e,agentTheme:i,agentCharacter:a}){const{persona:r}=Zc(),[c,d]=m.useState(!1),h=e||r?.slug,f=i||r?.theme,p=a||r?.character,y=n?"avatar-portrait avatar-thinking":"avatar-portrait";return h&&f&&!c?l.jsx("img",{src:`/portraits/${f}/small/${h}.png`,alt:p||"Agent",className:y,onError:()=>d(!0)}):l.jsx("span",{className:n?"avatar-emoji avatar-thinking":"avatar-emoji",children:"🤖"})}function yx(){const{avatarUrl:n,isLoading:e}=rM(),[i,a]=m.useState(!1);return e?l.jsx("span",{className:"avatar-emoji",children:"👤"}):n&&!i?l.jsx("img",{src:n,alt:"User",className:"avatar-portrait",onError:()=>a(!0)}):l.jsx("span",{className:"avatar-emoji",children:"👤"})}function lM(n){const e=m.useCallback(()=>{const i=n.current;if(!i)return;i.querySelectorAll("th.sortable-th").forEach(r=>{r.dataset.sortBound||(r.dataset.sortBound="1",r.style.cursor="pointer",r.addEventListener("click",()=>{const c=parseInt(r.dataset.col||"0",10),d=r.closest("table");if(!d)return;const h=d.querySelector("tbody");if(!h)return;const f=Array.from(h.querySelectorAll("tr")),p=r.dataset.sortDir==="asc"?"desc":"asc";d.querySelectorAll("th.sortable-th").forEach(b=>{b.dataset.sortDir="";const x=b.querySelector(".sort-indicator");x&&(x.textContent="")}),r.dataset.sortDir=p;const y=r.querySelector(".sort-indicator");y&&(y.textContent=p==="asc"?" ▲":" ▼"),f.sort((b,x)=>{const w=(b.children[c]?.textContent||"").trim(),E=(x.children[c]?.textContent||"").trim(),C=parseFloat(w),S=parseFloat(E);if(!isNaN(C)&&!isNaN(S))return p==="asc"?C-S:S-C;const D=w.localeCompare(E,void 0,{sensitivity:"base"});return p==="asc"?D:-D});for(const b of f)h.appendChild(b)}))})},[n]);m.useEffect(()=>{e()})}function C0({message:n,isLastAgentMessage:e,isFirstInTurn:i=!0}){const a=m.useRef(null);lM(a);const r=`message-${n.type}`,c=`message-${n.type}`,d=i?"":" continuation";if(n.type==="bell_injected"){const f=n.content?Df(n.content):"";return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{"data-testid":"message-bell-injected",className:`message message-user message-bell-injected${d}`,children:[l.jsx("div",{"data-testid":"avatar",className:"message-avatar",children:l.jsx(yx,{})}),l.jsxs("div",{className:"message-content",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"secondary",className:"bell-indicator",children:"🔔"})}),l.jsx(Te,{children:"Injected via Bell Mode"})]}),l.jsx("div",{dangerouslySetInnerHTML:{__html:f}}),n.imageCount&&n.imageCount>0&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs($e,{variant:"outline",className:"message-attachment-indicator",children:["📎 ",n.imageCount]})}),l.jsx(Te,{children:`${n.imageCount} image${n.imageCount>1?"s":""} attached`})]})]})]})})}if(n.type==="agent"&&n.isStreaming){const f=e!==!1;return l.jsxs("div",{"data-testid":c,className:`message ${r}${d}`,children:[l.jsx("div",{"data-testid":"avatar",className:"message-avatar",children:l.jsx(vx,{isStreaming:f,agentSlug:n.agentSlug,agentTheme:n.agentTheme,agentCharacter:n.agentCharacter})}),l.jsx("div",{className:"message-content",children:l.jsx(oM,{content:n.content||"",isStreaming:n.isStreaming??!1})})]})}const h=n.content?Df(n.content):"";return l.jsxs("div",{"data-testid":c,className:`message ${r}${d}`,ref:a,children:[l.jsx("div",{"data-testid":"avatar",className:"message-avatar",children:n.type==="user"?l.jsx(yx,{}):l.jsx(vx,{agentSlug:n.agentSlug,agentTheme:n.agentTheme,agentCharacter:n.agentCharacter})}),l.jsxs("div",{className:"message-content",children:[l.jsx("div",{dangerouslySetInnerHTML:{__html:h}}),n.type==="user"&&n.imageCount&&n.imageCount>0&&l.jsx(St,{delayDuration:300,children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs($e,{variant:"outline",className:"message-attachment-indicator",children:["📎 ",n.imageCount]})}),l.jsx(Te,{children:`${n.imageCount} image${n.imageCount>1?"s":""} attached`})]})})]})]})}function cM(n){return["Read","Write","Bash","Glob","Grep","Edit","Task"].includes(n)?`tool-${n.toLowerCase()}`:""}function _0(n){return n==null?"—":n<0?"0ms":n<1e3?`${Math.round(n)}ms`:`${(n/1e3).toFixed(1)}s`}const km=70;function Un(n,e=km-10){const i=n.replace(/\n/g," ");return i.length<=e?i:i.slice(0,e-3)+"..."}function Fn(n,e){if(!n)return"";const i=n[e];return i==null||i===""?"":String(i)}function uM(n){try{return new URL(n).hostname}catch{return n}}function dM(n){const e=n.toLowerCase();return e.startsWith("npm install")||e.startsWith("npm i ")||e==="npm i"||e.startsWith("pnpm install")||e.startsWith("pnpm add")||e.startsWith("yarn install")||e.startsWith("yarn add")?"Installing dependencies":e.startsWith("npm test")||e.startsWith("npm run test")||e.startsWith("pnpm test")||e.startsWith("pnpm run test")||e.startsWith("yarn test")||e.startsWith("vitest")||e.startsWith("jest")?"Running tests":e.startsWith("npm run build")||e.startsWith("pnpm run build")||e.startsWith("pnpm build")||e.startsWith("yarn build")?"Building project":e.startsWith("tsc")?"Type checking":e.startsWith("eslint")||e.startsWith("npm run lint")||e.startsWith("pnpm lint")?"Linting code":e.startsWith("prettier")?"Formatting code":`Running ${Un(n,km-8)}`}function Af(n,e){const i=e??{};switch(n){case"Read":{const a=Fn(i,"file_path");return a?Un(`Reading ${a}`):"Read"}case"Bash":{const a=Fn(i,"description");if(a)return Un(a);const r=Fn(i,"command");return r?dM(r):"Bash"}case"Glob":{const a=Fn(i,"pattern");return a?Un(`Finding ${a} files`):"Glob"}case"Grep":{const a=Fn(i,"pattern");if(!a)return"Grep";const r=a.replace(/^["']|["']$/g,"");return Un(`Searching for '${r}'`)}case"Write":{const a=Fn(i,"file_path");return a?Un(`Creating ${a}`):"Write"}case"Edit":{const a=Fn(i,"file_path");return a?Un(`Editing ${a}`):"Edit"}case"Task":{const a=Fn(i,"subagent_type");return a?`Launching ${a} agent`:"Task"}case"WebFetch":{const a=Fn(i,"url");if(!a)return"WebFetch";const r=uM(a);return Un(`Fetching ${r}`)}case"WebSearch":{const a=Fn(i,"query");return a?Un(`Searching web for '${a}'`):"WebSearch"}default:try{const a=JSON.stringify(i);if(a==="{}")return n;const r=km-n.length-3;return`${n} (${Un(a,r)})`}catch{return n}}}const bx=50;function hM(n){return n?n.replace(/\r\n/g,`
59
59
  `).split(`
60
60
  `).length:0}function fM(n,e){return n.replace(/\r\n/g,`
61
61
  `).split(`
62
62
  `).slice(0,e).join(`
63
- `)}function mM(n,e){return n==="Read"&&e.file_path?String(e.file_path):n==="Bash"&&e.command?String(e.command):n==="Glob"&&e.pattern||n==="Grep"&&e.pattern?String(e.pattern):n==="Write"&&e.file_path?String(e.file_path):JSON.stringify(e,null,2)}function ES(n){return{Read:"R",Write:"W",Bash:"B",Glob:"G",Grep:"S",Edit:"E",Task:"T",WebFetch:"F",WebSearch:"W",TodoWrite:"D"}[n]||n.charAt(0).toUpperCase()}function Rm({toolUse:n,result:e,className:i}){const[a,r]=m.useState(!0),[c,d]=m.useState(!0),[h,f]=m.useState(!1),[p,y]=m.useState("idle"),b=e?.is_error===!0,x=mM(n.tool_name,n.input),w=Object.keys(n.input).length,E=cM(n.tool_name),_=m.useMemo(()=>Af(n.tool_name,n.input),[n.tool_name,n.input]),C=m.useMemo(()=>e?hM(e.content):0,[e?.content]),D=C>bx,N=D&&!h,k=m.useMemo(()=>e?N?fM(e.content,bx):e.content:"",[e?.content,N]),T=async()=>{if(e)try{await navigator.clipboard.writeText(e.content),y("copied"),setTimeout(()=>y("idle"),2e3)}catch{y("error")}},R=C===1?"1 line":`${C} lines`,z=["tool-call-block",E,b?"tool-error":"",i||""].filter(Boolean).join(" "),O=ES(n.tool_name);return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{"data-testid":"tool-call-block",className:z,children:[l.jsxs("div",{className:"tool-header",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"default",className:"tool-type-badge",children:O})}),l.jsx(Te,{children:n.tool_name})]}),l.jsx("span",{className:"tool-name",children:_}),l.jsx("span",{"data-testid":"tool-duration",className:"tool-duration",children:e?.durationMs!==void 0?_S(e.durationMs):""})]}),l.jsx("div",{className:"tool-result-header",children:l.jsxs(Ce,{variant:"ghost",size:"sm","data-testid":"tool-prompt-toggle",className:"tool-result-toggle",onClick:()=>d(!c),children:[c?"▶":"▼"," Prompt (",w," ",w===1?"param":"params",")"]})}),l.jsx("div",{"data-testid":"tool-prompt-content",className:`tool-result-content ${c?"collapsed":""}`,children:l.jsx("pre",{children:x})}),e&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"tool-result-header",children:[l.jsxs(Ce,{variant:"ghost",size:"sm","data-testid":"tool-result-toggle",className:"tool-result-toggle",onClick:()=>r(!a),children:[a?"▶":"▼"," Result (",R,")"]}),l.jsx(Ce,{variant:"ghost",size:"icon","data-testid":"tool-result-copy",className:`tool-result-copy ${p==="copied"?"copied":""} ${p==="error"?"copy-error":""}`,onClick:T,"aria-label":"Copy result to clipboard",children:p==="copied"?"✓":"📋"})]}),l.jsxs("div",{"data-testid":"tool-result-content",className:`tool-result-content ${a?"collapsed":""} ${N&&!a?"truncated":""} ${b?"error-content":""}`,children:[l.jsx("pre",{children:k}),D&&!a&&N&&l.jsxs(Ce,{variant:"link",size:"sm","data-testid":"tool-result-expand",className:"tool-result-expand",onClick:()=>f(!0),children:["Show all (",C," lines)"]})]})]})]})})}function pM({stack:n,toolResults:e}){const[i,a]=m.useState(!n.isActive),r=m.useRef(n.isActive);m.useEffect(()=>{r.current&&!n.isActive&&a(!1),r.current=n.isActive},[n.isActive]);const c=`${n.count}`,d=m.useMemo(()=>{if(n.isActive&&n.tools.length>0){const E=n.tools[n.tools.length-1];return Af(E.tool_name,E.input)}return null},[n.tools,n.isActive]),h=m.useMemo(()=>{if(n.tools.length===0)return"";const E=n.tools[n.tools.length-1];return Af(E.tool_name,E.input)},[n.tools]),f=m.useMemo(()=>{const E=new Map;return n.tools.forEach(_=>{const C=E.get(_.tool_name)||0;E.set(_.tool_name,C+1)}),E},[n.tools]),p=m.useMemo(()=>n.tools.reduce((E,_)=>{const C=e.get(_.tool_id);return E+(C?.durationMs||0)},0),[n.tools,e]),y=E=>{const _=n.tools[E],C=e.get(_.tool_id);return n.isActive&&E===n.tools.length-1&&!C?"tool-current":"tool-historical"},b=m.useCallback(()=>{a(E=>!E)},[]),x=m.useCallback(E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),b())},[b]),w=!i||n.isActive;return l.jsxs("div",{"data-testid":"tool-stack","data-collapsible":"true",className:`tool-stack ${i&&!n.isActive?"collapsed":""}`,children:[l.jsxs("div",{"data-testid":"tool-stack-header",className:"tool-stack-header",onClick:b,onKeyDown:x,role:"button",tabIndex:0,"aria-expanded":!i||n.isActive,"aria-label":`Tool stack with ${c}: ${h}`,children:[l.jsx("span",{className:"tool-stack-toggle",children:i&&!n.isActive?"▶":"▼"}),l.jsx("span",{"data-testid":"tool-stack-count",className:"tool-stack-count-badge",children:c}),n.isActive&&d?l.jsx("span",{className:"tool-stack-active-summary",children:d}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"tool-stack-badges",children:l.jsx(St,{delayDuration:300,children:Array.from(f.entries()).slice(0,4).map(([E,_])=>l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"outline",className:`tool-mini-badge badge-${E.toLowerCase()}`,children:ES(E)})}),l.jsx(Te,{children:`${_} ${E} call${_>1?"s":""}`})]},E))})}),l.jsx("span",{className:"tool-stack-summary",children:h})]}),l.jsx("span",{className:"tool-stack-duration",children:p>0?_S(p):""})]}),w&&l.jsx("div",{className:"tool-stack-content",children:n.tools.map((E,_)=>{const C=e.get(E.tool_id),D=y(_);return l.jsx(Rm,{toolUse:{type:"tool_use",tool_name:E.tool_name,tool_id:E.tool_id,input:E.input,timestamp:E.timestamp},result:C?{type:"tool_result",tool_id:C.tool_id,content:C.content,timestamp:C.timestamp}:void 0,className:D},E.tool_id||`tool-${_}`)})})]})}const Yh=new Map;let xc=null;async function gM(){if(!xc)try{const n=await fetch("/api/theme-agents/full");n.ok&&(xc=await n.json())}catch{}}async function vM(n){const e=`agent:${n}`;if(Yh.has(e))return Yh.get(e);try{if(await gM(),xc?.agents){const i=xc.agents.find(a=>a.role===n);if(i?.helper)return Yh.set(e,i.helper),i.helper}return null}catch{return null}}const xx={"testing-runner":"Running tests",Explore:"Exploring codebase","sm-setup":"Setting up story","sm-finish":"Finishing story",handoff:"Handing off","workflow-status-check":"Checking workflow status","general-purpose":"Processing task",Plan:"Planning implementation",Bash:"Running commands"};function yM(n,e){const i=e?.plural?"are":"is",a=n.description,r=n.subagent_type;if(r&&xx[r]){const c=xx[r],d=c.charAt(0).toLowerCase()+c.slice(1);return a?`${i} ${d}: ${a}`:`${i} ${d}`}return a||"Working..."}function bM(){const[n,e]=m.useState(null),[i,a]=m.useState(!0),[r,c]=m.useState(null);return m.useEffect(()=>{const d=async p=>{try{const y=await vM(p);e(y),a(!1)}catch(y){c(y instanceof Error?y:new Error("Failed to fetch helper")),a(!1)}},h=window.location.protocol==="https:"?"wss:":"ws:",f=new WebSocket(`${h}//${window.location.host}/ws/persona`);return f.onmessage=p=>{try{const y=JSON.parse(p.data);y?.role&&d(y.role)}catch(y){c(y instanceof Error?y:new Error("Failed to parse persona")),a(!1)}},f.onerror=()=>{c(new Error("WebSocket connection failed")),a(!1)},()=>f.close()},[]),{helper:n,isLoading:i,error:r}}function xM({type:n,name:e,messages:i,defaultCollapsed:a=!0,onCollapseChange:r,helperName:c,helperStyle:d,friendlyMessage:h}){const[f,p]=m.useState(a),{helper:y}=bM(),b=m.useMemo(()=>yM({subagent_type:n,description:e},{plural:y?.plural}),[n,e,y?.plural]),x=c??y?.name,w=d??y?.style,E=h??b,_=x||n,C=E||e,D=i.filter(T=>T.type!=="tool_result").length,N=new Map;i.forEach(T=>{T.type==="tool_result"&&T.tool_id&&N.set(T.tool_id,T)});const k=(T,R)=>{if(T.type==="tool_use"&&T.tool_name&&T.tool_id){const z=N.get(T.tool_id);return l.jsx("div",{"data-testid":"message-tool_use",className:"message message-tool_use",children:l.jsx(Rm,{toolUse:{type:"tool_use",tool_name:T.tool_name,tool_id:T.tool_id,input:T.input||{},timestamp:T.timestamp},result:z?{type:"tool_result",tool_id:z.tool_id,content:z.content||"",timestamp:z.timestamp}:void 0})},`tool-wrapper-${T.tool_id}`)}if(T.type==="tool_result")return null;if(T.type==="user"){const z=(T.content||"").slice(0,120).replace(/\n/g," ");return l.jsx("div",{"data-testid":"subagent-prompt",className:"message message-subagent-prompt",children:l.jsxs("div",{className:"message-content",children:[z,(T.content||"").length>120?"...":""]})},`subagent-prompt-${R}`)}return l.jsx(CS,{message:{type:T.type,content:T.content,timestamp:T.timestamp}},`msg-${R}`)};return l.jsxs("div",{"data-testid":"subagent-span","data-collapsible":"true",className:`subagent-span subagent-${n} ${f?"collapsed":""}`,children:[l.jsxs("div",{"data-testid":"subagent-span-header",className:"subagent-header",onClick:()=>{const T=!f;p(T),r?.(T)},children:[l.jsx("span",{className:"subagent-toggle",children:f?"▶":"▼"}),l.jsx(St,{delayDuration:300,children:w?l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"subagent-helper-name",children:_})}),l.jsx(Te,{children:w})]}):l.jsx("span",{className:"subagent-helper-name",children:_})}),l.jsx("span",{className:"subagent-friendly-message",children:C}),l.jsx($e,{variant:"outline","data-testid":"subagent-type-badge",className:"subagent-type-badge",children:n}),l.jsx("span",{className:"subagent-count",children:D})]}),!f&&l.jsx("div",{className:"subagent-content",children:i.map((T,R)=>k(T,R))})]})}const wx=/<!--\s*CYCLIST:(\w+)(?::([^>]+?))?\s*-->/gi,As={HANDOFF:"handoff",CONTEXT_CLEAR:"context_clear",INVOKE:"invoke",QUESTION:"question",CHOICES:"choices",CONTINUE:"continue"},wM=new Set(["handoff","context_clear","invoke","question","choices","continue"]);function SM(n){return n?n.replace(/```[\s\S]*?```/g,""):""}function CM(n){if(!n)return null;const e=SM(n);if(!e.trim())return null;const i=[];wx.lastIndex=0;let a;for(;(a=wx.exec(e))!==null;){const r=a[1].toLowerCase();wM.has(r)&&i.push({type:r,value:a[2]?.trim()??"",source:"structured_marker"})}return i.length>0?i:null}function _M(n,e){if(!n)return e.map(c=>({number:c,text:`Option ${c}`}));const i=n.replace(/```[\s\S]*?```/g,""),a=[/^\s*(\d+)\.\s+(.+)$/gm,/^\s*(\d+)\)\s+(.+)$/gm,/\*\*(\d+)[.)]\*\*\s*(.+)/gm],r=new Map;for(const c of a){c.lastIndex=0;let d;for(;(d=c.exec(i))!==null;){const h=parseInt(d[1],10);if(e.includes(h)&&!r.has(h)){let f=d[2].trim();const p=f.search(/\s+[-—]\s+/);p>0&&p<30&&(f=f.substring(0,p)),r.set(h,f)}}}return e.map(c=>({number:c,text:r.get(c)||`Option ${c}`}))}function EM(n,e){if(!n||n.length===0)return null;const i=n[0];switch(i.type){case As.HANDOFF:return{type:"handoff",value:i.value,responses:[i.value,"Not yet"]};case As.INVOKE:return{type:"invoke",value:i.value,autoExecute:!0};case As.QUESTION:{if(i.value==="yesno")return{type:"yesno",responses:["Yes","No"]};if(i.value?.startsWith("open")){const r=i.value.indexOf(":");if(r!==-1){const c=i.value.substring(r+1).trim();if(c)return{type:"open",responses:[c]}}return{type:"open"}}const a=n.find(r=>r.type===As.CHOICES);return a?Sx(a.value,e):null}case As.CHOICES:return Sx(i.value,e);case As.CONTEXT_CLEAR:return{type:"context_clear",value:i.value};case As.CONTINUE:return{type:"continue",responses:["Continue"]};default:return null}}function Sx(n,e){const i=n.split(",").map(d=>d.trim()),a=i[0],r=/^\d+$/.test(a);let c;if(r){const d=i.map(h=>parseInt(h,10));c=_M(e,d)}else c=i.map((d,h)=>({number:h+1,text:d}));return{type:"choices",choices:c,responses:c.map(d=>d.text)}}function DM(n){return m.useMemo(()=>{if(!n)return null;const e=CM(n);return e?EM(e,n):null},[n])}async function AM(){try{const n=await fetch("/api/settings");if(n.ok)return(await n.json())?.workflow?.relay_mode??!1}catch{}return!1}function NM(n){const{send:e}=dr(),i=m.useCallback(x=>{console.log("[QuickActions] sendMessage called:",x),e(x,[])},[e]),{onAction:a}=n,[r,c]=m.useState(!1),[d,h]=m.useState(!1),f="message"in n?n.message:void 0,p="actions"in n?n.actions:void 0,y=DM(f?.content);m.useEffect(()=>{c(!1)},[f?.timestamp]),m.useEffect(()=>{AM().then(h)},[]),m.useEffect(()=>{const x=()=>{c(!0)};return window.addEventListener("cyclist:user-submit",x),()=>{window.removeEventListener("cyclist:user-submit",x)}},[]),m.useEffect(()=>{if(y?.type==="handoff"&&d&&y.value){const x=setTimeout(()=>{i(y.value),c(!0),a?.(y.value)},100);return()=>clearTimeout(x)}if(y?.type==="invoke"&&y.value){const x=setTimeout(()=>{i(y.value),c(!0),a?.(y.value)},100);return()=>clearTimeout(x)}},[y,d,a]),m.useEffect(()=>{if(y?.type==="open"&&y.responses&&y.responses.length>0){const x=y.responses[0];window.dispatchEvent(new CustomEvent("cyclist:suggest-prompt",{detail:{prompt:x}}))}},[y]);const b=m.useCallback(x=>{console.log("[QuickActions] Button clicked:",x),c(!0),i(x),a?.(x)},[a]);return p&&p.length>0?l.jsx("div",{className:"quick-actions",children:l.jsx("div",{className:"quick-actions-buttons",children:p.map(x=>l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b(x.command),disabled:r,"aria-label":`${x.label}: ${x.command}`,children:x.label},x.command))})}):!y||y.type==="open"||y.type==="continue"?null:y.type==="invoke"?l.jsx("div",{className:"quick-actions",children:l.jsxs("span",{className:"auto-invoke-status",children:["Invoking ",y.value,"..."]})}):y.type==="handoff"&&d?l.jsx("div",{className:"quick-actions",children:l.jsxs("span",{className:"auto-invoke-status",children:["Handing off to ",y.value,"..."]})}):l.jsxs("div",{className:"quick-actions",children:[y.type==="handoff"&&y.responses&&l.jsx("div",{className:"quick-actions-buttons",children:y.responses.map(x=>l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b(x),disabled:r,"aria-label":`Continue with ${x}`,children:x},x))}),y.type==="yesno"&&l.jsxs("div",{className:"quick-actions-buttons",children:[l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b("Yes"),disabled:r,"aria-label":"Answer Yes",children:"Yes"}),l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b("No"),disabled:r,"aria-label":"Answer No",children:"No"})]}),y.type==="choices"&&y.choices&&l.jsx("div",{className:"quick-actions-buttons",children:y.choices.map(x=>l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b(x.text),disabled:r,"aria-label":`Choose option ${x.number}: ${x.text}`,children:x.text},x.number))})]})}var jM="Separator",Cx="horizontal",TM=["horizontal","vertical"],DS=m.forwardRef((n,e)=>{const{decorative:i,orientation:a=Cx,...r}=n,c=kM(a)?a:Cx,h=i?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return l.jsx(In.div,{"data-orientation":c,...h,...r,ref:e})});DS.displayName=jM;function kM(n){return TM.includes(n)}var AS=DS;const Rt=m.forwardRef(({className:n,orientation:e="horizontal",decorative:i=!0,...a},r)=>l.jsx(AS,{ref:r,decorative:i,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...a}));Rt.displayName=AS.displayName;const RM=["<command-message>","<command-name>","Base directory for this skill:","Launching skill:"],OM=[/^```bash\s*\npf agent start\b/,/^pf agent start\b/,/^<purpose>/,/^<when-to-use>/,/^<execution>/,/^<critical>\s*\n/],ql={sm:"Scrum Master",tea:"Test Engineer",dev:"Developer",reviewer:"Reviewer",architect:"Architect",pm:"Product Manager","tech-writer":"Tech Writer","ux-designer":"UX Designer",devops:"DevOps",orchestrator:"Orchestrator",ba:"Business Analyst"};function zM(n){if(!n||typeof n!="string")return!1;if(RM.some(i=>n.includes(i)))return!0;const e=n.trimStart();return OM.some(i=>i.test(e))}function MM(n){if(!n||typeof n!="string")return null;const e=n.match(/<command-name>\/?([^<]+)<\/command-name>/);if(e){const c=e[1].trim();return ql[c]||c}const i=n.match(/<command-message>([^<]+)<\/command-message>/);if(i){const c=i[1].trim();return ql[c]||c}const a=n.match(/pf agent start\s+"([^"]+)"/);if(a){const c=a[1].trim();return ql[c]||c}const r=n.match(/Launching skill:\s*(\S+)/);if(r){const c=r[1].trim();return ql[c]||c}return null}function _x(n){return n.length===0?"stack-empty":`stack-${n[0].tool_id}`}function PM(n){const e=[];let i=[];for(const a of n)if(a.type==="tool_use")i.push({type:"tool_use",tool_name:a.tool_name||"",tool_id:a.tool_id||"",input:a.input||{},timestamp:a.timestamp,isStreaming:a.isStreaming});else{if(a.type==="tool_result")continue;if(i.length>=1){const r=i[i.length-1];e.push({stackId:_x(i),tools:[...i],count:i.length,isActive:r.isStreaming===!0,timestamp:i[0].timestamp})}i=[]}if(i.length>=1){const a=i[i.length-1];e.push({stackId:_x(i),tools:[...i],count:i.length,isActive:a.isStreaming===!0,timestamp:i[0].timestamp})}return e}function Xh(){const n=document.documentElement.getAttribute("data-variant");return n==="light"||n==="dark"?n:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function NS(){const[n,e]=m.useState(Xh);return m.useEffect(()=>{const i=new MutationObserver(()=>{e(Xh())});i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-variant"]});const a=()=>e(Xh());return window.addEventListener("presetChange",a),()=>{i.disconnect(),window.removeEventListener("presetChange",a)}},[]),n}const Ex=2e3;function Om(){const[n,e]=m.useState(null),[i,a]=m.useState(null),[r,c]=m.useState(null),[d,h]=m.useState(!0),[f,p]=m.useState(null),y=m.useRef({context:!1,stats:!1,projectInfo:!1}),b=m.useCallback(()=>{const x=y.current;x.context&&x.stats&&x.projectInfo&&h(!1)},[]);return m.useEffect(()=>{let x=null,w=null,E=!0;const _=()=>{const C=window.location.protocol==="https:"?"wss:":"ws:";x=new WebSocket(`${C}//${window.location.host}/ws/context`),x.onopen=()=>{console.log("[useStatsStrip] Context WebSocket connected")},x.onmessage=D=>{try{const N=JSON.parse(D.data);if(N.type==="init"||N.type==="update"){const k=N.context;k&&e({percent:k.percent??0,used:k.tokens??void 0,total:k.available?(k.tokens??0)+k.available:void 0}),y.current.context||(y.current.context=!0,b())}}catch(N){console.error("[useStatsStrip] Failed to parse context message:",N)}},x.onclose=()=>{E&&(w=setTimeout(_,Ex))},x.onerror=D=>{console.error("[useStatsStrip] Context WebSocket error:",D),x?.close()}};return _(),()=>{E=!1,w&&clearTimeout(w),x?.close()}},[b]),m.useEffect(()=>{let x=null,w=null,E=!0;const _=()=>{const C=window.location.protocol==="https:"?"wss:":"ws:";x=new WebSocket(`${C}//${window.location.host}/ws/stats`),x.onopen=()=>{console.log("[useStatsStrip] Stats WebSocket connected")},x.onmessage=D=>{try{const N=JSON.parse(D.data);a({model:N.model??null}),N.pwd&&c(k=>({pwd:N.pwd,jiraEmail:k?.jiraEmail??null,githubUsername:k?.githubUsername??null})),y.current.stats||(y.current.stats=!0,b())}catch(N){console.error("[useStatsStrip] Failed to parse stats message:",N)}},x.onclose=()=>{E&&(w=setTimeout(_,Ex))},x.onerror=D=>{console.error("[useStatsStrip] Stats WebSocket error:",D),x?.close()}};return _(),()=>{E=!1,w&&clearTimeout(w),x?.close()}},[b]),m.useEffect(()=>{(async()=>{try{const w=await fetch("/api/identity");if(w.ok){const E=await w.json();c(_=>({pwd:_?.pwd??"",jiraEmail:E.jiraEmail??null,githubUsername:E.githubUsername??null}))}}catch(w){console.error("[useStatsStrip] Failed to fetch identity:",w),p(w instanceof Error?w:new Error("Failed to fetch identity"))}finally{y.current.projectInfo=!0,b()}})()},[b]),{context:n,stats:i,projectInfo:r,isLoading:d,error:f}}const LM={pm:"#a78bfa",sm:"#60a5fa",dev:"#4ade80",tea:"#2dd4bf",reviewer:"#f87171",architect:"#fb923c",devops:"#22d3ee","ux-designer":"#f0abfc","tech-writer":"#e5e5e5",orchestrator:"#e879f9",ba:"#a3e635"},IM={pm:"PM",sm:"SM",dev:"DEV",tea:"TEA",reviewer:"REV",architect:"ARC",devops:"OPS","ux-designer":"UX","tech-writer":"TW",orchestrator:"ORC",ba:"BA"};function Dx(n){return new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function GM(n){if("isToolStack"in n||"messages"in n)return"agent";const e=n;return e.type==="context_cleared"?"system":e.type==="user"||e.type==="bell_injected"?"user":"agent"}function BM({messages:n}){const e=m.useRef(null),[i,a]=m.useState(!0),{persona:r}=Zc(),c=NS(),{projectInfo:d}=Om(),h=m.useRef(new Map),f=m.useCallback(C=>{a(C)},[]),p=m.useCallback(()=>{e.current?.scrollToBottom("smooth")},[]),y=m.useMemo(()=>{for(let C=n.length-1;C>=0;C--)if(n[C].type==="agent"&&!n[C].isStreaming)return n[C];return null},[n]),{turns:b,toolResults:x,lastAgentItemIndex:w}=m.useMemo(()=>{const C=new Map;for(const B of n)B.type==="tool_result"&&B.tool_id&&C.set(B.tool_id,B);const D=[],N=new Map;let k=!1;for(const B of n)if(B.type!=="tool_result"){if(B.type==="user"&&zM(B.content)){const $=MM(B.content);$&&!k&&(k=!0,D.push({...B,content:$}));continue}if(B.type==="user"&&(k=!1),B.parent_id){let $=N.get(B.parent_id);$||($={parent_id:B.parent_id,type:B.subagent_type||"unknown",name:B.subagent_name||"unnamed",messages:[]},N.set(B.parent_id,$)),$.messages.push(B);continue}D.push(B)}const T=PM(D),R=new Map;for(const B of T)for(const $ of B.tools)R.set($.tool_id,B);const z=[],O=new Set,A=new Set;for(const B of D)if(B.type==="tool_use"&&B.tool_id&&R.has(B.tool_id)){const $=R.get(B.tool_id);O.has($.stackId)||(O.add($.stackId),z.push({isToolStack:!0,stack:$}))}else z.push(B);for(const[,B]of N)A.has(B.parent_id)||(A.add(B.parent_id),z.push(B));let G=-1;for(let B=z.length-1;B>=0;B--){const $=z[B];if(!("isToolStack"in $)&&!("messages"in $)&&$.type==="agent"){G=B;break}}const U=[];for(const B of z){const $=GM(B),ae=U[U.length-1];ae&&ae.speaker===$?ae.items.push(B):U.push({speaker:$,items:[B],timestamp:"timestamp"in B?B.timestamp:Date.now()})}return{turns:U,toolResults:C,lastAgentItemIndex:G}},[n]),E=(C,D,N)=>{if("isToolStack"in C)return l.jsx(pM,{stack:C.stack,toolResults:x},`stack-${C.stack.stackId}`);if("messages"in C&&"parent_id"in C){const T=C,R=h.current.get(T.parent_id)??!0;return l.jsx(xM,{type:T.type,name:T.name,messages:T.messages,defaultCollapsed:R,onCollapseChange:z=>h.current.set(T.parent_id,z)},`subagent-${T.parent_id}`)}const k=C;if(k.type==="tool_use"&&k.tool_name&&k.tool_id){if(k.tool_name==="AskUserQuestion")return null;const T=x.get(k.tool_id);return l.jsx(Rm,{toolUse:{type:"tool_use",tool_name:k.tool_name,tool_id:k.tool_id,input:k.input||{},timestamp:k.timestamp},result:T?{type:"tool_result",tool_id:T.tool_id,content:T.content||"",timestamp:T.timestamp,is_error:T.is_error,durationMs:T.durationMs}:void 0},`tool-${k.tool_id}`)}return l.jsx(CS,{message:k,isLastAgentMessage:D===w,isFirstInTurn:N},`msg-${D}-${k.timestamp}`)};if(n.length===0)return l.jsx("div",{"data-testid":"message-view",className:"message-view",children:l.jsx("div",{className:"message-view-empty",children:l.jsxs("div",{children:[l.jsx("img",{src:c==="dark"?"/images/cyclist-dark.png":"/images/cyclist-light.png",alt:"Cyclist",style:{height:"2.5rem",opacity:.6,display:"block",margin:"0 auto 0.5rem"}}),l.jsxs("div",{children:["Type ",l.jsx("code",{style:{background:"var(--bg-tertiary, #0f0f1a)",padding:"2px 6px",borderRadius:"3px",fontFamily:"var(--font-mono, monospace)"},children:"/sm"})," to start"]})]})})});let _=0;return l.jsxs("div",{"data-testid":"message-view",className:"message-view",role:"log","aria-live":"polite",children:[l.jsx(SS,{ref:e,onScrollChange:f,autoScroll:i,children:b.map((C,D)=>{if(C.speaker==="system")return C.items.forEach(()=>_++),l.jsx("div",{className:"turn-group turn-system",children:l.jsxs("div",{className:"context-cleared-bar",children:[l.jsx(Rt,{className:"context-cleared-line"}),l.jsx("span",{className:"context-cleared-label",children:"Context cleared"}),l.jsx("span",{className:"context-cleared-time",children:Dx(C.timestamp)}),l.jsx(Rt,{className:"context-cleared-line"})]})},`turn-${D}`);let N=!1;const k=r?.character||"Agent",T=r?.role||null,R=T?IM[T]||T:null,z=T?LM[T]||"#e879f9":void 0,O=d?.githubUsername||"You";return l.jsxs("div",{className:`turn-group turn-${C.speaker}`,children:[l.jsxs("div",{className:"turn-label",children:[l.jsx("span",{className:"turn-speaker",children:C.speaker==="user"?O:k}),C.speaker==="agent"&&R&&l.jsx($e,{variant:"default",className:"turn-role-badge",style:{backgroundColor:z},children:R}),l.jsx("span",{className:"turn-timestamp",children:Dx(C.timestamp)})]}),C.items.map(A=>{const G=_++,U=!("isToolStack"in A)&&!("messages"in A)&&A.type!=="tool_use",B=U&&!N;return U&&(N=!0),E(A,G,B)})]},`turn-${D}`)})}),y&&l.jsx(NM,{message:y}),l.jsx("div",{"data-testid":"auto-scroll-indicator","data-active":i.toString(),className:"auto-scroll-indicator",style:{display:"none"}}),l.jsx(Ce,{variant:"ghost",size:"icon","data-testid":"scroll-to-bottom-button",className:"scroll-to-bottom-button",onClick:p,style:{visibility:i?"hidden":"visible"},children:"↓"})]})}const Ax="cyclist-command-history",HM=100;function VM(){const[n,e]=m.useState(()=>{try{const p=localStorage.getItem(Ax);return p?JSON.parse(p):[]}catch{return[]}}),i=m.useRef(-1),a=m.useRef(""),r=m.useCallback(p=>{try{localStorage.setItem(Ax,JSON.stringify(p))}catch{}},[]),c=m.useCallback(p=>{p.trim()&&e(y=>{if(y.length>0&&y[y.length-1]===p)return y;const b=[...y,p];return b.length>HM&&b.shift(),r(b),b})},[r]),d=m.useCallback(p=>{if(n.length===0)return null;if(i.current===-1)a.current=p,i.current=n.length-1;else if(i.current>0)i.current--;else return null;return n[i.current]},[n]),h=m.useCallback(()=>{if(i.current===-1)return null;if(i.current++,i.current>=n.length){i.current=-1;const p=a.current;return a.current="",p}return n[i.current]},[n]),f=m.useCallback(()=>{i.current=-1,a.current=""},[]);return{addToHistory:c,navigateUp:d,navigateDown:h,resetNavigation:f}}const jS=[{name:"/add",description:"Add files to context"},{name:"/bug",description:"Report a bug"},{name:"/clear",description:"Clear conversation history"},{name:"/compact",description:"Toggle compact mode"},{name:"/config",description:"Show configuration"},{name:"/cost",description:"Show session cost"},{name:"/doctor",description:"Check system health"},{name:"/help",description:"Show available commands"},{name:"/init",description:"Initialize CLAUDE.md"},{name:"/login",description:"Authenticate with Anthropic"},{name:"/logout",description:"Clear authentication"},{name:"/memory",description:"Edit CLAUDE.md memory"},{name:"/model",description:"Switch Claude model"},{name:"/permissions",description:"View/edit permissions"},{name:"/pf-architect",description:"System Architect - Technical design and architecture"},{name:"/pf-ba",description:"Business Analyst - Requirements discovery and stakeholder analysis"},{name:"/pf-benchmark",description:"Compare an agent's performance against a stored baseline"},{name:"/pf-benchmark-control",description:"Create control baseline for a scenario (shortcut for /benchmark control <agent>)"},{name:"/pf-brainstorming",description:"Structured problem-solving brainstorm session"},{name:"/pf-check",description:"Run quality gates (lint, type check, tests) before handoff"},{name:"/pf-chore",description:"Quick commit for small changes without full git-cleanup ceremony"},{name:"/pf-ci",description:"Detect and run CI locally"},{name:"/pf-dev",description:"Developer - Feature implementation and coding"},{name:"/pf-devops",description:"DevOps Engineer - Infrastructure and deployment automation"},{name:"/pf-docs",description:"Domain documentation management"},{name:"/pf-epic",description:"Epic lifecycle - start epics for development and close completed epics"},{name:"/pf-fix-blocker",description:"Quick alias for /patch - fix blocking issue during story work"},{name:"/pf-git",description:"Repository operations - status, cleanup, branches, and release management"},{name:"/pf-health-check",description:"Check Pennyfarthing installation health and apply updates"},{name:"/pf-help",description:"Context-aware help for Pennyfarthing commands, agents, and workflows"},{name:"/pf-job-fair",description:"Discover which characters in a theme excel at each role"},{name:"/pf-orchestrator",description:"Orchestrator - Coordinator of all agents and meta operations"},{name:"/pf-party-mode",description:"Creative brainstorming and multi-agent discussion"},{name:"/pf-patch",description:"Interrupt-driven bug fix during active story work"},{name:"/pf-permissions",description:"View and manage runtime permission grants - list, grant, revoke, or show details"},{name:"/pf-pm",description:"Product Manager - Strategic planning and prioritization"},{name:"/pf-prime",description:"Load essential project context at agent activation"},{name:"/pf-retro",description:"Facilitate a sprint retrospective"},{name:"/pf-reviewer",description:"Code Reviewer - Critical code review and quality enforcement"},{name:"/pf-session",description:"Session lifecycle - start new work and resume checkpoints"},{name:"/pf-setup",description:"/setup - Interactive Project Setup"},{name:"/pf-sm",description:"Scrum Master - Story coordination and sprint management"},{name:"/pf-solo",description:"Run a single agent on a scenario with absolute rubric scoring"},{name:"/pf-sprint",description:"Sprint status, backlog, and story management - check status, find work, archive completed stories"},{name:"/pf-standalone",description:"Wrap current changes into a standalone Jira story, branch, PR, and merge"},{name:"/pf-tea",description:"Test Engineer/Architect - Test strategy and TDD"},{name:"/pf-tech-writer",description:"Technical Writer - Documentation creation and maintenance"},{name:"/pf-theme",description:"Manage persona themes - list, show, set, create, or interactive wizard"},{name:"/pf-ux-designer",description:"UX Designer - User experience design and UI patterns"},{name:"/pf-work",description:"Resume work or start new - smart entry point that picks up where you left off"},{name:"/pf-workflow",description:"List available workflows, show current workflow details, and switch workflows mid-session. Use when checking available workflow types (TDD, trivial, agent-docs), viewing current workflow phase, switching to a different workflow pattern, or managing BikeLane stepped workflows."},{name:"/pr-comments",description:"View PR comments"},{name:"/review",description:"Start code review"},{name:"/status",description:"Show session status"},{name:"/terminal-setup",description:"Configure terminal"},{name:"/vim",description:"Toggle vim mode"}].sort((n,e)=>n.name.localeCompare(e.name)),TS="cyclist:command-frequency";function kS(){if(typeof localStorage>"u")return{};try{const n=localStorage.getItem(TS);return n?JSON.parse(n):{}}catch{return{}}}function RS(n){if(typeof localStorage>"u")return;const e=kS();e[n]=(e[n]||0)+1,localStorage.setItem(TS,JSON.stringify(e))}function FM(n){const e=n.toLowerCase(),i=kS();return jS.filter(a=>a.name.toLowerCase().startsWith(e)).sort((a,r)=>{const c=i[a.name]||0,d=i[r.name]||0;return d!==c?d-c:a.name.localeCompare(r.name)})}function UM(n){const e=m.useMemo(()=>jS,[n]),[i,a]=m.useState({visible:!1,commands:[],selectedIndex:0,prefix:""}),r=m.useCallback(b=>FM(b),[e,n]),c=m.useCallback(b=>{const x=r(b);a({visible:!0,commands:x,selectedIndex:0,prefix:b})},[r]),d=m.useCallback(()=>{a({visible:!1,commands:[],selectedIndex:0,prefix:""})},[]),h=m.useCallback(b=>{const x=r(b);x.length===0?d():a(w=>({...w,commands:x,selectedIndex:0,prefix:b}))},[r,d]),f=m.useCallback(()=>{a(b=>{if(b.commands.length===0)return b;const x=b.selectedIndex<=0?b.commands.length-1:b.selectedIndex-1;return{...b,selectedIndex:x}})},[]),p=m.useCallback(()=>{a(b=>{if(b.commands.length===0)return b;const x=b.selectedIndex>=b.commands.length-1?0:b.selectedIndex+1;return{...b,selectedIndex:x}})},[]),y=m.useCallback(()=>{if(!i.visible||i.commands.length===0)return null;const b=i.commands[i.selectedIndex];return d(),b?.name&&RS(b.name),b?.name||null},[i,d]);return{state:i,showCompletion:c,hideCompletion:d,updateCompletion:h,navigateUp:f,navigateDown:p,selectCurrent:y,isVisible:i.visible}}function OS(n){const e=n+"CollectionProvider",[i,a]=cn(e),[r,c]=i(e,{collectionRef:{current:null},itemMap:new Map}),d=_=>{const{scope:C,children:D}=_,N=ue.useRef(null),k=ue.useRef(new Map).current;return l.jsx(r,{scope:C,itemMap:k,collectionRef:N,children:D})};d.displayName=e;const h=n+"CollectionSlot",f=Pa(h),p=ue.forwardRef((_,C)=>{const{scope:D,children:N}=_,k=c(h,D),T=Ie(C,k.collectionRef);return l.jsx(f,{ref:T,children:N})});p.displayName=h;const y=n+"CollectionItemSlot",b="data-radix-collection-item",x=Pa(y),w=ue.forwardRef((_,C)=>{const{scope:D,children:N,...k}=_,T=ue.useRef(null),R=Ie(C,T),z=c(y,D);return ue.useEffect(()=>(z.itemMap.set(T,{ref:T,...k}),()=>{z.itemMap.delete(T)})),l.jsx(x,{[b]:"",ref:R,children:N})});w.displayName=y;function E(_){const C=c(n+"CollectionConsumer",_);return ue.useCallback(()=>{const N=C.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${b}]`));return Array.from(C.itemMap.values()).sort((z,O)=>k.indexOf(z.ref.current)-k.indexOf(O.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:d,Slot:p,ItemSlot:w},E,a]}var $M=m.createContext(void 0);function Kc(n){const e=m.useContext($M);return n||e||"ltr"}var Qh="rovingFocusGroup.onEntryFocus",WM={bubbles:!1,cancelable:!0},hr="RovingFocusGroup",[Nf,zS,qM]=OS(hr),[YM,MS]=cn(hr,[qM]),[XM,QM]=YM(hr),PS=m.forwardRef((n,e)=>l.jsx(Nf.Provider,{scope:n.__scopeRovingFocusGroup,children:l.jsx(Nf.Slot,{scope:n.__scopeRovingFocusGroup,children:l.jsx(ZM,{...n,ref:e})})}));PS.displayName=hr;var ZM=m.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:i,orientation:a,loop:r=!1,dir:c,currentTabStopId:d,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:f,onEntryFocus:p,preventScrollOnEntryFocus:y=!1,...b}=n,x=m.useRef(null),w=Ie(e,x),E=Kc(c),[_,C]=_n({prop:d,defaultProp:h??null,onChange:f,caller:hr}),[D,N]=m.useState(!1),k=Gt(p),T=zS(i),R=m.useRef(!1),[z,O]=m.useState(0);return m.useEffect(()=>{const A=x.current;if(A)return A.addEventListener(Qh,k),()=>A.removeEventListener(Qh,k)},[k]),l.jsx(XM,{scope:i,orientation:a,dir:E,loop:r,currentTabStopId:_,onItemFocus:m.useCallback(A=>C(A),[C]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>O(A=>A+1),[]),onFocusableItemRemove:m.useCallback(()=>O(A=>A-1),[]),children:l.jsx(je.div,{tabIndex:D||z===0?-1:0,"data-orientation":a,...b,ref:w,style:{outline:"none",...n.style},onMouseDown:we(n.onMouseDown,()=>{R.current=!0}),onFocus:we(n.onFocus,A=>{const G=!R.current;if(A.target===A.currentTarget&&G&&!D){const U=new CustomEvent(Qh,WM);if(A.currentTarget.dispatchEvent(U),!U.defaultPrevented){const B=T().filter(M=>M.focusable),$=B.find(M=>M.active),ae=B.find(M=>M.id===_),W=[$,ae,...B].filter(Boolean).map(M=>M.ref.current);GS(W,y)}}R.current=!1}),onBlur:we(n.onBlur,()=>N(!1))})})}),LS="RovingFocusGroupItem",IS=m.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:i,focusable:a=!0,active:r=!1,tabStopId:c,children:d,...h}=n,f=Mt(),p=c||f,y=QM(LS,i),b=y.currentTabStopId===p,x=zS(i),{onFocusableItemAdd:w,onFocusableItemRemove:E,currentTabStopId:_}=y;return m.useEffect(()=>{if(a)return w(),()=>E()},[a,w,E]),l.jsx(Nf.ItemSlot,{scope:i,id:p,focusable:a,active:r,children:l.jsx(je.span,{tabIndex:b?0:-1,"data-orientation":y.orientation,...h,ref:e,onMouseDown:we(n.onMouseDown,C=>{a?y.onItemFocus(p):C.preventDefault()}),onFocus:we(n.onFocus,()=>y.onItemFocus(p)),onKeyDown:we(n.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){y.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const D=e2(C,y.orientation,y.dir);if(D!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let k=x().filter(T=>T.focusable).map(T=>T.ref.current);if(D==="last")k.reverse();else if(D==="prev"||D==="next"){D==="prev"&&k.reverse();const T=k.indexOf(C.currentTarget);k=y.loop?t2(k,T+1):k.slice(T+1)}setTimeout(()=>GS(k))}}),children:typeof d=="function"?d({isCurrentTabStop:b,hasTabStop:_!=null}):d})})});IS.displayName=LS;var KM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JM(n,e){return e!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function e2(n,e,i){const a=JM(n.key,i);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return KM[a]}function GS(n,e=!1){const i=document.activeElement;for(const a of n)if(a===i||(a.focus({preventScroll:e}),document.activeElement!==i))return}function t2(n,e){return n.map((i,a)=>n[(e+a)%n.length])}var n2=PS,i2=IS,BS="Toggle",zm=m.forwardRef((n,e)=>{const{pressed:i,defaultPressed:a,onPressedChange:r,...c}=n,[d,h]=_n({prop:i,onChange:r,defaultProp:a??!1,caller:BS});return l.jsx(je.button,{type:"button","aria-pressed":d,"data-state":d?"on":"off","data-disabled":n.disabled?"":void 0,...c,ref:e,onClick:we(n.onClick,()=>{n.disabled||h(!d)})})});zm.displayName=BS;var HS=zm,ss="ToggleGroup",[VS]=cn(ss,[MS]),FS=MS(),Mm=ue.forwardRef((n,e)=>{const{type:i,...a}=n;if(i==="single"){const r=a;return l.jsx(s2,{...r,ref:e})}if(i==="multiple"){const r=a;return l.jsx(a2,{...r,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${ss}\``)});Mm.displayName=ss;var[US,$S]=VS(ss),s2=ue.forwardRef((n,e)=>{const{value:i,defaultValue:a,onValueChange:r=()=>{},...c}=n,[d,h]=_n({prop:i,defaultProp:a??"",onChange:r,caller:ss});return l.jsx(US,{scope:n.__scopeToggleGroup,type:"single",value:ue.useMemo(()=>d?[d]:[],[d]),onItemActivate:h,onItemDeactivate:ue.useCallback(()=>h(""),[h]),children:l.jsx(WS,{...c,ref:e})})}),a2=ue.forwardRef((n,e)=>{const{value:i,defaultValue:a,onValueChange:r=()=>{},...c}=n,[d,h]=_n({prop:i,defaultProp:a??[],onChange:r,caller:ss}),f=ue.useCallback(y=>h((b=[])=>[...b,y]),[h]),p=ue.useCallback(y=>h((b=[])=>b.filter(x=>x!==y)),[h]);return l.jsx(US,{scope:n.__scopeToggleGroup,type:"multiple",value:d,onItemActivate:f,onItemDeactivate:p,children:l.jsx(WS,{...c,ref:e})})});Mm.displayName=ss;var[o2,r2]=VS(ss),WS=ue.forwardRef((n,e)=>{const{__scopeToggleGroup:i,disabled:a=!1,rovingFocus:r=!0,orientation:c,dir:d,loop:h=!0,...f}=n,p=FS(i),y=Kc(d),b={role:"group",dir:y,...f};return l.jsx(o2,{scope:i,rovingFocus:r,disabled:a,children:r?l.jsx(n2,{asChild:!0,...p,orientation:c,dir:y,loop:h,children:l.jsx(je.div,{...b,ref:e})}):l.jsx(je.div,{...b,ref:e})})}),wc="ToggleGroupItem",qS=ue.forwardRef((n,e)=>{const i=$S(wc,n.__scopeToggleGroup),a=r2(wc,n.__scopeToggleGroup),r=FS(n.__scopeToggleGroup),c=i.value.includes(n.value),d=a.disabled||n.disabled,h={...n,pressed:c,disabled:d},f=ue.useRef(null);return a.rovingFocus?l.jsx(i2,{asChild:!0,...r,focusable:!d,active:c,ref:f,children:l.jsx(Nx,{...h,ref:e})}):l.jsx(Nx,{...h,ref:e})});qS.displayName=wc;var Nx=ue.forwardRef((n,e)=>{const{__scopeToggleGroup:i,value:a,...r}=n,c=$S(wc,i),d={role:"radio","aria-checked":n.pressed,"aria-pressed":void 0},h=c.type==="single"?d:void 0;return l.jsx(zm,{...h,...r,ref:e,onPressedChange:f=>{f?c.onItemActivate(a):c.onItemDeactivate(a)}})}),YS=Mm,XS=qS;const QS=Bf("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),l2=m.forwardRef(({className:n,variant:e,size:i,...a},r)=>l.jsx(HS,{ref:r,className:ye(QS({variant:e,size:i,className:n})),...a}));l2.displayName=HS.displayName;const ZS=m.createContext({size:"default",variant:"default"}),KS=m.forwardRef(({className:n,variant:e,size:i,children:a,...r},c)=>l.jsx(YS,{ref:c,className:ye("flex items-center justify-center gap-1",n),...r,children:l.jsx(ZS.Provider,{value:{variant:e,size:i},children:a})}));KS.displayName=YS.displayName;const JS=m.forwardRef(({className:n,children:e,variant:i,size:a,...r},c)=>{const d=m.useContext(ZS);return l.jsx(XS,{ref:c,className:ye(QS({variant:d.variant||i,size:d.size||a}),n),...r,children:e})});JS.displayName=XS.displayName;const jx=["plan","manual","accept"],Zh={plan:"Plan",manual:"Manual",accept:"Accept"},Tx={plan:"Read-only exploration mode",manual:"Ask for permission before actions",accept:"Auto-accept file edits"},c2={plan:"plan",manual:"default",accept:"acceptEdits"},u2={plan:"plan",default:"manual",acceptEdits:"accept"},kx={1:"plan",2:"manual",3:"accept"};function d2(n){m.useEffect(()=>{const e=i=>{(i.metaKey||i.ctrlKey)&&kx[i.key]&&(i.preventDefault(),n(kx[i.key]))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n])}function h2(){const[n,e]=m.useState("manual"),[i,a]=m.useState(!0),r=m.useRef(null);m.useEffect(()=>{const h=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/claude`,f=new WebSocket(h);r.current=f,f.onopen=()=>{f.send(JSON.stringify({type:"getMode"}))},f.onmessage=y=>{try{const b=JSON.parse(y.data);if(b.type==="mode"&&b.mode){const x=u2[b.mode]||"manual";e(x),a(!1),console.log("[ModeSwitch] Mode synced:",b.mode,"->",x)}}catch(b){console.error("[ModeSwitch] Failed to parse mode response:",b)}},f.onerror=()=>{a(!1)};const p=setTimeout(()=>{i&&a(!1)},2e3);return()=>{clearTimeout(p),f.readyState===WebSocket.OPEN&&f.close(),r.current=null}},[]);const c=m.useCallback(d=>{const h=c2[d];r.current&&r.current.readyState===WebSocket.OPEN?(r.current.send(JSON.stringify({type:"setMode",mode:h})),e(d),console.log("[ModeSwitch] Mode set to:",d,"->",h)):(e(d),console.warn("[ModeSwitch] WebSocket not connected, mode set locally only"))},[]);return{mode:n,setMode:c,isLoading:i}}function f2({mode:n,defaultMode:e="manual",onModeChange:i,className:a="",disabled:r=!1}){const[c,d]=m.useState(e),[h,f]=m.useState(!1),p=n??c;m.useEffect(()=>{const w=window.matchMedia("(prefers-reduced-motion: reduce)");f(w.matches);const E=_=>{f(_.matches)};return w.addEventListener("change",E),()=>w.removeEventListener("change",E)},[]);const y=jx.indexOf(p),b=m.useCallback(w=>{r||(n||d(w),i?.(w))},[n,r,i]),x=m.useCallback(w=>{w&&b(w)},[b]);return l.jsxs("div",{className:ye("mode-switch",r&&"mode-switch--disabled",h&&"reduced-motion",a),"data-testid":"mode-switch",style:h?{transition:"none"}:void 0,children:[l.jsx("div",{className:"mode-switch__highlight","data-testid":"mode-highlight",style:{transform:`translateX(${y*100}%)`,transition:h?"none":void 0},"data-mode":p}),l.jsx(St,{delayDuration:400,children:l.jsx(KS,{type:"single",value:p,onValueChange:x,disabled:r,className:"relative z-[1] gap-0","aria-label":"Permission mode",children:jx.map(w=>{const E=p===w;return l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(JS,{value:w,"data-mode":w,"data-testid":`mode-${w}`,"aria-label":`${Zh[w]} mode: ${Tx[w]}`,className:ye("mode-option",E&&"active"),children:Zh[w]})}),l.jsx(Te,{side:"bottom",children:Tx[w]})]},w)})})}),l.jsx("div",{className:"visually-hidden",role:"status","aria-live":"polite",children:`${Zh[p]} mode selected`})]})}const Yl=["image/png","image/jpeg","image/gif","image/webp"],m2=20*1024*1024;function p2({commands:n,selectedIndex:e,visible:i,onSelect:a}){return!i||n.length===0?null:l.jsx("div",{className:"completion-popup","data-testid":"completion-popup",children:n.map((r,c)=>l.jsxs("div",{className:`completion-item ${c===e?"selected":""}`,onClick:()=>a(c),"data-testid":`completion-item-${c}`,children:[l.jsx("span",{className:"completion-name",children:r.name}),l.jsx("span",{className:"completion-desc",children:r.description})]},r.name))})}function g2(n){return n?n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):""}function v2({queue:n,bellMode:e,onRemove:i,onClear:a,onInject:r}){return n.length===0?null:l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"queue-display","data-testid":"queue-display",children:[l.jsxs("div",{className:"queue-header",children:[l.jsxs("span",{className:"queue-count",children:[n.length," queued"]}),e&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"secondary",className:"queue-mode-badge bell-mode",children:"🔔"})}),l.jsx(Te,{children:"Bell mode active - messages inject via hook"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"sm",type:"button",className:"queue-clear-btn",onClick:a,children:"Clear"})}),l.jsx(Te,{children:"Clear all queued messages"})]})]}),l.jsx("ul",{className:"queue-list",children:n.map((c,d)=>{const h=c.text.length>60?c.text.substring(0,60)+"...":c.text,f=c.images&&c.images.length>0;return l.jsxs("li",{className:"queue-item","data-testid":`queue-item-${d}`,children:[l.jsx("span",{className:"queue-item-text",children:g2(h)}),f&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs($e,{variant:"outline",className:"queue-image-indicator",children:["📎",c.images.length]})}),l.jsx(Te,{children:`${c.images.length} image(s) attached`})]}),l.jsxs("div",{className:"queue-item-actions",children:[r&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:"queue-item-inject",onClick:()=>r(d),children:"▶"})}),l.jsx(Te,{children:"Send now (abort current and send this message)"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:"queue-item-remove",onClick:()=>i(d),children:"×"})}),l.jsx(Te,{children:"Remove from queue"})]})]})]},d)})})]})})}function y2({images:n,onRemove:e}){return n.length===0?null:l.jsx(St,{delayDuration:300,children:l.jsx("div",{className:"image-preview","data-testid":"image-preview",children:n.map((i,a)=>l.jsxs("div",{className:"image-preview-item",children:[l.jsx("img",{src:i.dataUrl,alt:i.filename}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:"image-remove",onClick:()=>e(a),children:"X"})}),l.jsx(Te,{children:"Remove image"})]})]},a))})})}function b2({onSubmit:n,isProcessing:e=!1,placeholder:i,onInject:a}){const r=m.useRef(null),[c,d]=m.useState(""),[h,f]=m.useState([]),{mode:p,setMode:y}=h2();d2(y);const{addToHistory:b,navigateUp:x,navigateDown:w,resetNavigation:E}=VM(),{state:_,showCompletion:C,hideCompletion:D,updateCompletion:N,navigateUp:k,navigateDown:T,selectCurrent:R,isVisible:z}=UM(),{queue:O,queueCount:A,bellMode:G,queueMessage:U,removeFromQueue:B,clearQueue:$,setProcessing:ae,resumeQueue:ne}=gS();m.useEffect(()=>{ae(e)},[e,ae]),m.useEffect(()=>{const V=Y=>{d(Y.detail.prompt),r.current?.focus()};return window.addEventListener("cyclist:suggest-prompt",V),()=>{window.removeEventListener("cyclist:suggest-prompt",V)}},[]);const W=m.useCallback(async V=>{let Y=null;if(V.items){for(const le of V.items)if(le.type&&Yl.includes(le.type)){Y=le.getAsFile();break}}if(!Y&&V.files?.length>0){for(const le of V.files)if(le.type&&Yl.includes(le.type)){Y=le;break}}return Y?Y.size>m2?(console.warn("Image too large:",Y.size),!1):new Promise(le=>{const X=new FileReader;X.onload=()=>{const ce=X.result,de=Y.name||`Pasted Image.${Y.type.split("/")[1]||"png"}`;f(De=>[...De,{dataUrl:ce,mimeType:Y.type,filename:de}]),le(!0)},X.onerror=()=>le(!1),X.readAsDataURL(Y)}):!1},[]),M=m.useCallback(V=>{f(Y=>Y.filter((le,X)=>X!==V))},[]),K=m.useCallback(()=>{if(!r.current)return null;const V=r.current.selectionStart,Y=c;let le=V;for(;le>0&&Y[le-1]!==" "&&Y[le-1]!==`
64
- `;)le--;const X=Y.substring(le,V);return X.startsWith("/")?{prefix:X,start:le,end:V}:null},[c]),q=m.useCallback(V=>{const Y=K();if(!Y){d(ce=>ce+V);return}const{start:le,end:X}=Y;d(ce=>ce.substring(0,le)+V+ce.substring(X)),setTimeout(()=>{if(r.current){const ce=le+V.length;r.current.selectionStart=r.current.selectionEnd=ce}},0)},[K]),he=m.useCallback(()=>{const V=c.trim();if(!(!V&&h.length===0)){if(e){U({text:V,images:[...h]})&&(d(""),f([]),r.current?.focus());return}if(b(V),E(),V.startsWith("/")){const Y=V.split(/\s/)[0];RS(Y)}ne(),window.dispatchEvent(new CustomEvent("cyclist:user-submit")),n(V,h),d(""),f([]),r.current?.focus()}},[c,h,e,U,b,E,ne,n]),Se=m.useCallback(V=>{if(V.key==="Tab"&&!V.shiftKey&&!V.ctrlKey&&!V.altKey){if(z){V.preventDefault();const le=R();le&&q(le);return}const Y=K();if(Y){V.preventDefault(),C(Y.prefix);return}}if(V.key==="Escape"&&z){V.preventDefault(),D();return}if(V.key==="Enter"&&!V.shiftKey){if(z){V.preventDefault();const Y=R();Y&&q(Y);return}V.preventDefault(),he();return}if(V.key==="ArrowUp"&&!V.shiftKey&&!V.ctrlKey&&!V.altKey){if(z){V.preventDefault(),k();return}if(r.current?.selectionStart===0){const Y=x(c);if(Y!==null){V.preventDefault(),d(Y);return}}}if(V.key==="ArrowDown"&&!V.shiftKey&&!V.ctrlKey&&!V.altKey){if(z){V.preventDefault(),T();return}if(r.current?.selectionEnd===c.length){const Y=w();if(Y!==null){V.preventDefault(),d(Y);return}}}},[z,R,q,K,C,D,he,k,T,x,w,c]),I=m.useCallback(V=>{const Y=V.target.value;if(d(Y),Y==="/"&&!z){C("/");return}if(z){const le=K();le?N(le.prefix):D()}},[z,C,K,N,D]),L=m.useCallback(async V=>{const Y=V.clipboardData;if(!Y)return;let le=!1;if(Y.items){for(const X of Y.items)if(X.type&&Yl.includes(X.type)){le=!0;break}}if(!le&&Y.files?.length>0){for(const X of Y.files)if(X.type&&Yl.includes(X.type)){le=!0;break}}le&&(V.preventDefault(),await W(Y))},[W]),ee=m.useCallback(V=>{const Y=_.commands[V];Y&&(q(Y.name),D())},[_.commands,q,D]);return l.jsxs("div",{className:"editor-container","data-testid":"editor-container",children:[l.jsx(f2,{mode:p,onModeChange:y,className:"editor-mode-switch"}),l.jsxs("div",{className:"editor-wrapper",id:"editor-wrapper",children:[l.jsx(y2,{images:h,onRemove:M}),l.jsx("textarea",{ref:r,id:"editor-textarea",className:"editor-textarea",value:c,onChange:I,onKeyDown:Se,onPaste:L,placeholder:i,spellCheck:!1,autoFocus:!0,"data-testid":"editor-textarea"}),l.jsx(p2,{commands:_.commands,selectedIndex:_.selectedIndex,visible:z,onSelect:ee})]}),l.jsx(v2,{queue:O,bellMode:G,onRemove:B,onClear:$,onInject:a})]})}function x2(){const[n,e]=m.useState(null),i=m.useCallback(c=>d=>{e(c)},[]),a=m.useCallback(()=>{e(null)},[]),r=m.useCallback(c=>n===c,[n]);return{handleFocus:i,handleBlur:a,isFocused:r}}function w2({currentAgent:n,onAgentSwitch:e}){const[i,a]=m.useState(!1),[r,c]=m.useState([]),d=m.useRef(null);m.useEffect(()=>{fetch("/api/theme-agents/full").then(f=>f.ok?f.json():null).then(f=>{f?.agents&&c(f.agents)}).catch(()=>{})},[]),m.useEffect(()=>{if(!i)return;const f=p=>{d.current&&!d.current.contains(p.target)&&a(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]),m.useEffect(()=>{if(!i)return;const f=p=>{p.key==="Escape"&&(p.stopPropagation(),a(!1))};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[i]);const h=m.useCallback(f=>{f.role!==n&&(e?.(f.role),a(!1))},[n,e]);return l.jsxs("div",{className:"agent-quick-picker-wrapper",ref:d,children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:`btn-toggle agent-picker-toggle ${i?"active":""}`,"data-testid":"agent-quick-picker",onClick:()=>a(f=>!f),"aria-label":"Switch agent","aria-expanded":i,"aria-haspopup":"listbox",children:l.jsx(lz,{className:"h-4 w-4"})})}),l.jsx(Te,{children:"Switch Agent"})]}),i&&l.jsx("div",{className:"agent-quick-picker-dropdown","data-testid":"agent-quick-picker-dropdown",role:"listbox","aria-label":"Available agents",children:r.map(f=>{const p=f.role===n;return l.jsx("div",{className:`agent-quick-picker-option ${p?"current":""}`,"data-testid":`agent-option-${f.role}`,role:"option","aria-selected":p,"aria-label":`${f.role} (${f.character})`,title:f.character,onClick:()=>h(f),children:l.jsx("span",{className:"agent-option-role",children:f.role})},f.role)})})]})}function S2({isRunning:n,isStopping:e=!1,onStop:i,onForceStop:a,onReset:r,bellMode:c=!1,relayMode:d=!1,onBellModeChange:h,onRelayModeChange:f,contextPercent:p=0,currentAgent:y=null,onTirePump:b,onAgentSwitch:x}){const w=m.useRef(0),E=500,{handleFocus:_,handleBlur:C,isFocused:D}=x2(),N=m.useCallback(k=>{if(k.key!=="Escape"&&k.keyCode!==27||!n)return;const T=Date.now();T-w.current<E&&a?a():i(),w.current=T},[n,i,a]);return m.useEffect(()=>(document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N)}),[N]),l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"control-bar","data-testid":"control-bar",children:[l.jsxs("div",{className:"control-bar-toggles",children:[l.jsx(w2,{currentAgent:y,onAgentSwitch:x}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:`btn-toggle bell-toggle ${c?"active":""}`,"data-testid":"bell-mode-toggle",onClick:()=>h?.(!c),"aria-pressed":c,"aria-label":"Bell mode - inject queued messages via hook",children:l.jsx(VO,{className:"h-4 w-4"})})}),l.jsx(Te,{children:"Bell Mode: Inject queued messages during tool use (Cmd+B)"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:`btn-toggle relay-toggle ${d?"active":""}`,"data-testid":"relay-toggle",onClick:()=>f?.(!d),"aria-pressed":d,"aria-label":"Relay mode - auto-handoff to next agent",children:l.jsx(hz,{className:"h-4 w-4"})})}),l.jsx(Te,{children:"Relay Mode: Auto-handoff to next agent (Cmd+4)"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:`btn-toggle pump-toggle ${p>=70?"warning":""}`,"data-testid":"pump-toggle",onClick:b,disabled:!y,"aria-label":"TirePump: Clear context and reload agent",children:l.jsx(nz,{className:"h-4 w-4"})})}),l.jsx(Te,{children:y?`TirePump: Clear context (${p}%) and reload ${y}`:"TirePump: No agent loaded"})]})]}),l.jsxs(Ce,{variant:"destructive",type:"button",className:`btn-stop danger ${e?"stopping":""} ${n&&!e?"throbbing":""} ${D("stop")?"focused focus-visible":""}`,"data-testid":"stop-button",onClick:i,disabled:!n||e,"aria-busy":e,"aria-label":"Stop Claude",onFocus:_("stop"),onBlur:C,children:[l.jsx("span",{"data-icon":"stop",className:"icon"}),e?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"spinner","data-loading":!0}),"Stopping..."]}):"Stop"]}),l.jsx(Ce,{variant:"outline",type:"button",className:`btn-reset ${D("reset")?"focused focus-visible":""}`,"data-testid":"reset-button",onClick:r,"aria-label":"Reset session",onFocus:_("reset"),onBlur:C,children:"Reset"})]})})}function C2(){const[n,e]=m.useState(!1),[i,a]=m.useState(!1),[r,c]=m.useState(!1),[d,h]=m.useState(!1),[f,p]=m.useState(0),[y,b]=m.useState(null),{abort:x,clear:w,clearAndReload:E,send:_,onMessage:C,onComplete:D,onError:N,isConnected:k}=dr();m.useEffect(()=>{function B(W){const M=W?.workflow,K=!!M?.bell_mode,q=!!M?.relay_mode;console.log("[ControlBar] Settings updated:",{bellMode:K,relayMode:q}),c(K),h(q)}async function $(){try{console.log("[ControlBar] Loading settings via REST");const W=await fetch("/api/settings");if(W.ok){const M=await W.json();B(M)}}catch(W){console.error("[ControlBar] Failed to load settings:",W)}}console.log("[ControlBar] useEffect mount - loading settings"),$(),console.log("[ControlBar] Connecting to /ws/settings for real-time sync");const ae=window.location.protocol==="https:"?"wss:":"ws:",ne=new WebSocket(`${ae}//${window.location.host}/ws/settings`);return ne.onmessage=W=>{try{const M=JSON.parse(W.data);(M.type==="init"||M.type==="update")&&B(M.settings)}catch(M){console.error("[ControlBar] Failed to parse WebSocket message:",M)}},ne.onerror=W=>{console.error("[ControlBar] WebSocket error:",W)},()=>{ne.close()}},[]),m.useEffect(()=>{const B=window.location.protocol==="https:"?"wss:":"ws:",$=new WebSocket(`${B}//${window.location.host}/ws/context`);return $.onmessage=ae=>{try{const ne=JSON.parse(ae.data);if(ne.type==="init"||ne.type==="update"){const W=ne.context?.percent??0;p(W)}}catch(ne){console.error("[ControlBar] Failed to parse context message:",ne)}},()=>{$.close()}},[]),m.useEffect(()=>{const B=window.location.protocol==="https:"?"wss:":"ws:",$=new WebSocket(`${B}//${window.location.host}/ws/persona`);return $.onmessage=ae=>{try{const ne=JSON.parse(ae.data);b(ne?.slug??null)}catch(ne){console.error("[ControlBar] Failed to parse persona message:",ne)}},()=>{$.close()}},[]),m.useEffect(()=>{if(!k)return;const B=()=>{e(!0),a(!1)},$=()=>{e(!1),a(!1)},ae=()=>{e(!1),a(!1)},ne=C(B),W=D($),M=N(ae);return()=>{ne(),W(),M()}},[k,C,D,N]);const T=m.useCallback(()=>{a(!0);try{x()}catch(B){console.error("[ControlBar] Stop failed:",B)}},[x]),R=m.useCallback(()=>{a(!0);try{x()}catch(B){console.error("[ControlBar] Force stop failed:",B)}},[x]),z=m.useCallback(()=>{try{w(),e(!1),a(!1)}catch(B){console.error("[ControlBar] Reset failed:",B)}},[w]),O=m.useCallback(async B=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflow:{bell_mode:B}})}),c(B),console.log("[ControlBar] Bell mode set to:",B)}catch($){console.error("[ControlBar] Failed to toggle bell mode:",$)}},[]),A=m.useCallback(async B=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflow:{relay_mode:B}})}),h(B),console.log("[ControlBar] Relay mode set to:",B)}catch($){console.error("[ControlBar] Failed to toggle relay mode:",$)}},[]),G=m.useCallback(()=>{if(!y){console.warn("[ControlBar] Cannot TirePump: no current agent");return}try{console.log("[ControlBar] TirePump: clearing context and reloading agent:",y),E(y),e(!1),a(!1),p(0)}catch(B){console.error("[ControlBar] TirePump failed:",B)}},[y,E]),U=m.useCallback(B=>{_(`/${B}`)},[_]);return{isRunning:n,isStopping:i,bellMode:r,relayMode:d,contextPercent:f,currentAgent:y,handleStop:T,handleForceStop:R,handleReset:z,handleBellModeChange:O,handleRelayModeChange:A,handleTirePump:G,handleAgentSwitch:U}}function fe({className:n,...e}){return l.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",n),...e})}const Rx={pm:"#a78bfa",sm:"#60a5fa",dev:"#4ade80",tea:"#2dd4bf",reviewer:"#f87171",architect:"#fb923c",devops:"#22d3ee","ux-designer":"#f0abfc","tech-writer":"#e5e5e5",orchestrator:"#e879f9",ba:"#a3e635"};function _2({isOpen:n,onClose:e,currentRole:i,currentTheme:a}){const[r,c]=m.useState(null),[d,h]=m.useState(null),[f,p]=m.useState(!1),[y,b]=m.useState(!1),x=m.useRef(),{send:w}=dr();m.useEffect(()=>{n&&(p(!0),fetch("/api/theme-agents/full").then(N=>N.ok?N.json():null).then(N=>{c(N),h(null),p(!1)}).catch(()=>p(!1)))},[n]),m.useEffect(()=>{b(!1)},[d]),m.useEffect(()=>{if(!n)return;const N=k=>{k.key==="Escape"&&e()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[n,e]);const E=m.useCallback(N=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{h(N)},100)},[]),_=m.useCallback(()=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{h(null)},200)},[]),C=m.useCallback(N=>{if(N.role===i)return;const k=`/${N.role}`;w(k),e()},[i,w,e]);if(!n)return null;const D=d||r?.agents.find(N=>N.role===i)||r?.agents[0];return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"agent-popup-backdrop",onClick:e,"aria-hidden":"true"}),l.jsx("div",{className:"agent-popup",role:"dialog","aria-modal":"true","aria-labelledby":"agent-popup-title",children:f?l.jsxs("div",{className:"agent-popup-loading p-4 space-y-3",children:[l.jsx(fe,{className:"h-6 w-40"}),l.jsx(Rt,{}),l.jsxs("div",{className:"flex gap-4",children:[l.jsxs("div",{className:"space-y-2 flex-shrink-0",style:{width:160},children:[l.jsx(fe,{className:"h-5 w-12"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-8 w-full"})]}),l.jsxs("div",{className:"space-y-3 flex-1",children:[l.jsx(fe,{className:"h-24 w-24 rounded-full mx-auto"}),l.jsx(fe,{className:"h-5 w-32 mx-auto"}),l.jsx(fe,{className:"h-4 w-full"}),l.jsx(fe,{className:"h-4 w-3/4"})]})]})]}):r?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"agent-popup-header",children:[l.jsxs("h2",{id:"agent-popup-title",className:"agent-popup-theme",children:[r.themeName,l.jsx($e,{variant:"secondary",className:`tier-badge ${r.tier?`tier-${r.tier.toLowerCase()}`:"tier-unranked"}`,children:r.tier||"Unranked"})]}),l.jsx(Ce,{variant:"ghost",size:"icon",className:"agent-popup-close",onClick:e,"aria-label":"Close popup",children:"×"})]}),l.jsx(Rt,{className:"my-1"}),l.jsxs("div",{className:"agent-popup-content",children:[l.jsxs("div",{className:"agent-popup-roster",children:[l.jsx("h3",{className:"roster-title",children:"Team"}),l.jsx("ul",{className:"roster-list",role:"listbox",children:r.agents.map(N=>{const k=N.role===i,T=d?.role===N.role,R=Rx[N.role]||"#888";return l.jsxs("li",{className:`roster-item ${k?"current":""} ${T?"previewing":""}`,role:"option","aria-selected":k,onMouseEnter:()=>E(N),onMouseLeave:_,onClick:()=>C(N),children:[l.jsx("span",{className:"roster-character",children:N.character}),l.jsx("span",{className:"roster-role",style:{backgroundColor:R},children:N.role}),k&&l.jsx("span",{className:"roster-current-marker",children:"●"})]},N.role)})})]}),l.jsx("div",{className:"agent-popup-details","data-testid":"agent-popup-details",children:D&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"popup-portrait","data-testid":"popup-portrait",children:!y&&a?l.jsx("img",{src:`/portraits/${a}/large/${D.slug}.png`,alt:D.character,onError:()=>b(!0)}):l.jsx("div",{className:"portrait-placeholder",children:"🤖"})}),l.jsx("h3",{className:"popup-character",children:D.character}),l.jsxs("div",{className:"popup-role-mapping",children:[l.jsx($e,{variant:"default",className:"role-badge",style:{backgroundColor:Rx[D.role]||"#888"},children:D.role}),"→ ",D.character]}),l.jsxs("div",{className:"popup-detail","data-testid":"popup-detail-style",children:[l.jsx("label",{children:"Style:"}),l.jsx("span",{children:D.style||"—"})]}),l.jsxs("div",{className:"popup-detail","data-testid":"popup-detail-background",children:[l.jsx("label",{children:"Background:"}),l.jsx("span",{children:D.background||"—"})]}),D.quirks.length>0&&l.jsxs("div",{className:"popup-detail","data-testid":"popup-detail-quirks",children:[l.jsx("label",{children:"Quirks:"}),l.jsx("span",{children:D.quirks.join(", ")})]}),D.lift!==void 0&&l.jsxs("div",{className:"popup-detail",children:[l.jsx("label",{children:"Lift:"}),l.jsxs("span",{className:`lift-value ${D.lift>=0?"positive":"negative"}`,children:[D.lift>=0?"+":"",D.lift.toFixed(1)]})]})]})})]})]}):l.jsx("div",{className:"agent-popup-error",children:"Failed to load theme data"})})]})}const E2={pm:"PM",sm:"SM",dev:"DEV",tea:"TEA",reviewer:"REV",architect:"ARC",devops:"OPS","ux-designer":"UX","tech-writer":"TW",orchestrator:"ORC",ba:"BA"};function D2({character:n,role:e,slug:i,theme:a,isActive:r,isThinking:c}){const[d,h]=m.useState(!1);if(!r)return null;const f=E2[e]||e.toUpperCase();return l.jsxs("div",{className:`persona-tandem-portrait${c?" avatar-tandem-thinking":""}`,"data-testid":"tandem-portrait",role:"img","aria-label":`${n} (${e}) - observing`,tabIndex:-1,children:[d?l.jsx("span",{className:"tandem-portrait-fallback","aria-hidden":"true",children:"🤖"}):l.jsx("img",{src:`/portraits/${a}/medium/${i}.png`,alt:"","aria-hidden":"true",className:"tandem-portrait-image",onError:()=>h(!0)}),l.jsx("span",{className:"tandem-role-badge","data-testid":"tandem-role-badge","aria-hidden":"true",children:f})]})}const A2={pm:"#a78bfa",sm:"#60a5fa",dev:"#4ade80",tea:"#2dd4bf",reviewer:"#f87171",architect:"#fb923c",devops:"#22d3ee","ux-designer":"#f0abfc","tech-writer":"#e5e5e5",orchestrator:"#e879f9",ba:"#a3e635"},N2={pm:"PM",sm:"SM",dev:"DEV",tea:"TEA",reviewer:"REV",architect:"ARC",devops:"OPS","ux-designer":"UX","tech-writer":"TW",orchestrator:"ORC",ba:"BA"};function j2(n){return n.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function eC(){const{persona:n,isStreaming:e}=Zc(),i=NS(),[a,r]=m.useState(!1),[c,d]=m.useState(!1),[h,f]=m.useState(!1),p=n?.character||"Agent",y=n?.theme||"default",b=n?.role||"agent",x=n?.slug,w=n?.quote,E=n?.tandemAgent,[_,C]=m.useState(!1),D=m.useRef(!1),N=m.useRef(null);m.useEffect(()=>{const O=D.current,A=E?.isThinking??!1;D.current=A,!O&&A&&C(!0)},[E?.isThinking]);const k=m.useCallback(()=>{C(!1)},[]),T=m.useCallback(()=>{d(!0)},[]),R=m.useCallback(()=>{d(!1)},[]),z=A2[b]||"#e879f9";return n?.character?l.jsxs(l.Fragment,{children:[l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:`persona-header clickable${h?" compact":""}`,"data-testid":"persona-header",role:"button",tabIndex:0,"aria-label":"Current agent persona - click to view team","aria-live":"polite",onClick:T,onKeyDown:O=>O.key==="Enter"&&T(),children:[l.jsxs("div",{className:"persona-portrait-group",children:[l.jsx("div",{className:`persona-portrait${e?" avatar-thinking":""}${_?" avatar-observation-pulse":""}`,"data-testid":"persona-portrait",ref:N,onAnimationEnd:k,children:x&&y&&!a?l.jsx("img",{src:`/portraits/${y}/medium/${x}.png`,alt:p,className:"portrait-image",onError:()=>r(!0)}):l.jsx("span",{className:"portrait-fallback",children:"🤖"})}),E&&l.jsx(D2,{character:E.character,role:E.role,slug:E.slug,theme:E.theme,isActive:!0,isThinking:E.isThinking}),E&&l.jsx("span",{className:"visually-hidden",role:"status","aria-live":"polite","data-testid":"tandem-sr-status",children:E.isThinking?`${E.character} is thinking`:`${E.character} observing`})]}),l.jsxs("div",{className:"persona-info",children:[l.jsxs("div",{className:"persona-name-row",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"default",className:"persona-role","data-testid":"persona-role",style:{backgroundColor:z},children:N2[b]||b})}),l.jsx(Te,{children:b})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"persona-character","data-testid":"persona-character",children:p})}),l.jsx(Te,{children:p})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"persona-theme","data-testid":"persona-theme",children:j2(y)})}),l.jsx(Te,{children:`Theme: ${y}`})]})]}),w&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"persona-catchphrase","data-testid":"persona-catchphrase",children:['"',w,'"']})}),l.jsx(Te,{children:w})]})]}),l.jsx("img",{src:i==="dark"?"/images/cyclist-dark.png":"/images/cyclist-light.png",alt:"Cyclist",className:"persona-branding"}),l.jsx("button",{className:"persona-collapse-toggle",onClick:O=>{O.stopPropagation(),f(!h)},"aria-label":h?"Expand header":"Collapse header",children:h?"▼":"▲"})]})}),l.jsx(_2,{isOpen:c,onClose:R,currentRole:b,currentTheme:y})]}):l.jsx("div",{className:"persona-header empty","data-testid":"persona-header"})}function T2(n){if(!n)return"—";const e=n.toLowerCase();if(e.includes("opus"))return"opus";if(e.includes("sonnet"))return"sonnet";if(e.includes("haiku"))return"haiku";const i=n.split("-");if(i.length>=2){for(let a=i.length-2;a>=0;a--)if(!/^\d{8}$/.test(i[a]))return i[a]}return n}function k2(n){return n>=85?"level-danger":n>=70?"level-warning":"level-safe"}function R2(n){if(!n)return"";const e=n.split("/");return e[e.length-1]||e[e.length-2]||n}function O2(){const{context:n,stats:e,projectInfo:i}=Om(),a=n?.percent??0,r=e?.model??null,c=i?.pwd??"",d=i?.jiraEmail??null,h=i?.githubUsername??null,f=k2(a),p=R2(c);return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"stats-strip","data-testid":"stats-strip",children:[l.jsxs("div",{className:"stats-left","data-testid":"stats-left",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"stats-pwd","data-testid":"stats-pwd","data-full-path":c,children:p})}),l.jsx(Te,{children:c})]}),d&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"stats-jira-email","data-testid":"jira-email",children:d})}),l.jsx(Te,{children:`Jira: ${d}`})]}),h&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"stats-github-user","data-testid":"github-user",children:["@",h]})}),l.jsx(Te,{children:`GitHub: ${h}`})]})]}),l.jsxs("div",{className:"stats-right","data-testid":"stats-right",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"secondary",className:"stats-model-badge","data-testid":"model-badge",children:T2(r)})}),r&&l.jsx(Te,{children:r})]}),l.jsxs("div",{className:`stats-context-meter ${f}`,"data-testid":"context-meter",children:[l.jsxs("span",{className:"context-percent","data-testid":"context-percent",children:[a,"%"]}),l.jsx("div",{className:"context-fill","data-testid":"context-fill",style:{width:`${a}%`}})]})]})]})})}function Ox(n){return n.startsWith("Stop hook feedback:")}function z2(n){const e=Date.now(),i=n.parent_tool_use_id||void 0,a=n.subagent_type,r=n.subagent_name,c=[];if(n.type==="assistant"||n.type==="message"){const d=n.message?.content||n.content;if(Array.isArray(d)){const h=d.filter(p=>p.type==="text"&&typeof p.text=="string").map(p=>p.text).join("");h&&h.trim().length>=3&&!Ox(h.trim())&&c.push({type:"agent",content:h,timestamp:e,isStreaming:!0,parent_id:i,subagent_type:a,subagent_name:r});const f=d.filter(p=>p.type==="tool_use");for(const p of f)c.push({type:"tool_use",tool_name:p.name,tool_id:p.id,input:p.input,timestamp:e,parent_id:i,subagent_type:a,subagent_name:r})}else typeof d=="string"&&d.trim().length>=3&&!Ox(d.trim())&&c.push({type:"agent",content:d,timestamp:e,isStreaming:!0,parent_id:i,subagent_type:a,subagent_name:r});return c}if(n.type==="user"){let d="";const h=n.message?.content||n.content;if(Array.isArray(h)){d=h.filter(p=>p.type==="text"&&typeof p.text=="string").map(p=>p.text).join("");const f=h.filter(p=>p.type==="tool_result");for(const p of f)c.push({type:"tool_result",tool_id:p.tool_use_id,content:typeof p.content=="string"?p.content:"",timestamp:e,is_error:p.is_error})}else typeof h=="string"&&(d=h);return d&&c.push({type:"user",content:d,timestamp:e,parent_id:i,subagent_type:a,subagent_name:r}),c}return n.type==="tool_use"?(c.push({type:"tool_use",tool_name:n.tool_name,tool_id:n.tool_id,input:n.input,timestamp:e,parent_id:i,subagent_type:a,subagent_name:r}),c):(n.type==="tool_result"&&c.push({type:"tool_result",tool_id:n.tool_id,content:typeof n.output=="string"?n.output:"",timestamp:e,parent_id:i,subagent_type:a,subagent_name:r,is_error:n.is_error,durationMs:n.durationMs}),c)}function M2(){const[n,e]=m.useState([]),[i,a]=m.useState(!1),{isRunning:r,isStopping:c,bellMode:d,relayMode:h,contextPercent:f,currentAgent:p,handleStop:y,handleForceStop:b,handleReset:x,handleBellModeChange:w,handleRelayModeChange:E,handleTirePump:_,handleAgentSwitch:C}=C2(),{send:D,abort:N,onMessage:k,onComplete:T,onError:R,onUserMessage:z,onClear:O,isConnected:A}=dr(),{persona:G}=Zc(),U=m.useRef(G);U.current=G;const{handleTurnComplete:B,pauseQueue:$,onBellConsumed:ae,injectMessage:ne}=gS(),W=m.useRef();m.useEffect(()=>ae(ce=>{e(de=>[...de,{type:"bell_injected",content:ce.text,timestamp:Date.now(),imageCount:ce.images.length>0?ce.images.length:void 0}])}),[ae]);const M={abort:N,submit:(X,ce)=>{a(!0),D(X,ce)}},K=m.useCallback(X=>{const ce=z2(X);if(ce.length>0){const de=U.current,De=ce.map(Ne=>Ne.type==="agent"&&de?{...Ne,agentSlug:de.slug??void 0,agentTheme:de.theme??void 0,agentCharacter:de.character??void 0}:Ne),Ge=De.filter(Ne=>Ne.type==="tool_result"&&!Ne.parent_id&&Ne.tool_id).map(Ne=>Ne.tool_id);Ge.length>0?e(Ne=>{const dt=new Set(Ge.filter(rt=>Ne.some(An=>An.parent_id===rt)));return dt.size>0?[...Ne.filter(rt=>!rt.parent_id||!dt.has(rt.parent_id)),...De]:[...Ne,...De]}):e(Ne=>[...Ne,...De])}},[]),q=m.useCallback(()=>{a(!1),e(X=>X.map(ce=>ce.type==="agent"&&ce.isStreaming?{...ce,isStreaming:!1}:ce)),W.current&&B(W.current)},[B]),he=m.useCallback(X=>{a(!1),e(ce=>[...ce,{type:"agent",content:`Error: ${X}`,timestamp:Date.now()}])},[]);m.useEffect(()=>z(ce=>{e(de=>[...de,{type:"user",content:ce.prompt,timestamp:ce.timestamp,imageCount:ce.images.length>0?ce.images.length:void 0}])}),[z]),m.useEffect(()=>O(()=>{e(ce=>[...ce,{type:"context_cleared",content:"Context cleared",timestamp:Date.now()}]),a(!1)}),[O]),m.useEffect(()=>{if(!A){console.log("[MessagePanel] Claude WebSocket not connected");return}const X=k(K),ce=T(q),de=R(he);return()=>{X(),ce(),de()}},[A,k,T,R,K,q,he]);const Se=m.useCallback((X,ce)=>{a(!0),D(X,ce)},[D]);m.useEffect(()=>{W.current=Se},[Se]);const I=m.useCallback(()=>{$(),y()},[$,y]),[L,ee]=m.useState(null),V=m.useRef(null),Y=m.useRef(!1),le=m.useCallback(X=>{X.preventDefault(),Y.current=!0;const ce=X.clientY,de=V.current;if(!de)return;const De=de.getBoundingClientRect(),Ge=L??de.querySelector(".message-panel-editor")?.getBoundingClientRect().height??150,Ne=rt=>{if(!Y.current)return;const An=ce-rt.clientY,ei=Math.max(80,Math.min(Ge+An,De.height*.7));ee(ei)},dt=()=>{Y.current=!1,document.removeEventListener("mousemove",Ne),document.removeEventListener("mouseup",dt),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",Ne),document.addEventListener("mouseup",dt),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[L]);return l.jsxs("div",{className:"message-panel","data-testid":"message-panel",ref:V,children:[l.jsx(eC,{}),l.jsx("div",{className:"message-panel-content",children:l.jsx(BM,{messages:n})}),l.jsx("div",{className:"message-panel-resize-handle",onMouseDown:le}),l.jsx("div",{className:"message-panel-editor",style:L!=null?{height:L,flexShrink:0}:void 0,children:l.jsxs("div",{className:"editor-with-controls",children:[l.jsx("div",{className:"editor-area",children:l.jsx(b2,{onSubmit:Se,isProcessing:i||r,placeholder:"Send a message...",onInject:X=>ne(X,M)})}),l.jsx(S2,{isRunning:r||i,isStopping:c,onStop:I,onForceStop:b,onReset:x,bellMode:d,relayMode:h,onBellModeChange:w,onRelayModeChange:E,contextPercent:f,currentAgent:p,onTirePump:_,onAgentSwitch:C})]})}),l.jsx(O2,{})]})}function P2(n){return n.id?{id:n.id,title:n.title??"",status:n.status??void 0,phase:n.phase??void 0,points:n.points??void 0,criteria:n.criteria,workflowPhases:n.workflow,workflowType:n.workflowType??void 0}:null}function Pm(){const[n,e]=m.useState(null),[i,a]=m.useState(!0),[r,c]=m.useState(null),[d,h]=m.useState(null),f=m.useRef(null),p=m.useRef();return m.useEffect(()=>{const b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/story`,x=()=>{try{f.current=new WebSocket(b),f.current.onopen=()=>{console.debug("[useStory] WebSocket connected")},f.current.onmessage=w=>{try{const E=JSON.parse(w.data);(E.type==="init"||E.type==="update")&&(e(P2(E)),h(E.availableWorkflows??null),a(!1),c(null))}catch(E){console.error("[useStory] Failed to parse message:",E)}},f.current.onclose=()=>{console.debug("[useStory] WebSocket closed, reconnecting..."),p.current=setTimeout(x,2e3)},f.current.onerror=w=>{console.error("[useStory] WebSocket error:",w),c(new Error("WebSocket connection failed"))}}catch(w){console.error("[useStory] WebSocket init failed:",w),c(w instanceof Error?w:new Error("Failed to connect")),a(!1)}};return x(),()=>{p.current&&clearTimeout(p.current),f.current&&f.current.close()}},[]),{story:n,isLoading:i,error:r,availableWorkflows:d}}function tC(){const[n,e]=m.useState(null),[i,a]=m.useState(!0),[r,c]=m.useState(null),d=m.useRef(null),h=m.useRef(),f=m.useRef(!0);return m.useEffect(()=>{const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/sprint`,b=()=>{if(f.current)try{d.current=new WebSocket(y),d.current.onopen=()=>{console.debug("[useSprint] WebSocket connected")},d.current.onmessage=x=>{try{const w=JSON.parse(x.data);if(w.type==="init"||w.type==="update"){const{type:E,..._}=w;e(C=>C?{...C,..._}:_),a(!1),c(null)}}catch(w){console.error("[useSprint] Failed to parse message:",w)}},d.current.onclose=()=>{console.debug("[useSprint] WebSocket closed, reconnecting..."),h.current=setTimeout(b,2e3)},d.current.onerror=x=>{console.error("[useSprint] WebSocket error:",x),c(new Error("WebSocket connection failed"))}}catch(x){console.error("[useSprint] WebSocket init failed:",x),c(x instanceof Error?x:new Error("Failed to connect")),a(!1)}};return b(),()=>{f.current=!1,h.current&&clearTimeout(h.current),d.current&&d.current.close()}},[]),{data:n,isLoading:i,error:r}}function L2(n){if(!n)return null;const e=n.split("@")[0],i=e.split(".");if(i.length>=2){const a=i[0].charAt(0).toUpperCase(),r=i[i.length-1].charAt(0).toUpperCase()+i[i.length-1].slice(1);return`${a}. ${r}`}return e}function I2(n){const e=n.stories.reduce((a,r)=>a+r.points,0);return{done:n.stories.filter(a=>a.status==="done").reduce((a,r)=>a+r.points,0),total:e}}function jf(n){return n.stories.length>0&&n.stories.every(e=>e.status==="done"||e.status==="cancelled")}function G2(n){switch(n){case"done":return{icon:l.jsx(Ga,{size:12}),className:"status-done"};case"in_progress":return{icon:l.jsx(ez,{size:12}),className:"status-in-progress"};case"blocked":return{icon:l.jsx(oz,{size:12}),className:"status-blocked"};default:return{icon:l.jsx(QO,{size:12}),className:"status-backlog"}}}function zx(n){return`https://1898andco.atlassian.net/browse/${n}`}function Mx({hasContext:n,testIdPrefix:e,id:i}){const a=n?"Context file exists":"No context file";return l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:`context-indicator ${n?"has-context":"no-context"}`,"data-testid":`${e}-context-indicator-${i}`,"data-has-context":String(n),title:a,children:n?"📄":""})}),l.jsx(Te,{children:a})]})}function B2({priority:n,storyId:e}){return n?l.jsx("span",{className:"priority-label","data-testid":`story-priority-${e}`,"data-priority":n,title:n,children:n}):null}function H2({status:n,storyId:e}){const{icon:i,className:a}=G2(n);return l.jsx($e,{variant:n==="blocked"?"destructive":n==="done"?"default":"secondary",className:`story-status-badge ${a}`,"data-testid":`story-status-badge-${e}`,"data-status":n,"aria-label":`Status: ${n}`,children:i})}function V2({jiraKey:n,storyId:e}){const i=a=>{a.preventDefault();const r=zx(n);try{const c=window.electronAPI;if(c?.shell?.openExternal){c.shell.openExternal(r);return}}catch{}window.open(r,"_blank")};return l.jsx("a",{className:"jira-link cyclist-link","data-testid":`story-jira-link-${e}`,href:zx(n),onClick:i,children:n})}function Px({text:n}){const[e,i]=m.useState(!1),a=async r=>{r.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2e3)}catch{}};return l.jsx("button",{className:`copy-id-button ${e?"copied":""}`,onClick:a,"aria-label":`Copy ${n}`,title:"Copy ID + title",children:e?l.jsx(Ga,{size:12}):l.jsx(KO,{size:12})})}function Lx({epic:n,isExpanded:e,isArchiving:i,onToggle:a,onKeyDown:r,onArchive:c}){const{done:d,total:h}=I2(n),f=jf(n);return l.jsxs("div",{className:`epic-group ${f?"epic-completed":""}`,"data-testid":`epic-group-${n.id}`,children:[l.jsxs("div",{className:"epic-header",children:[l.jsx(Ce,{variant:"ghost",size:"icon",className:"epic-toggle","data-testid":`epic-toggle-${n.id}`,onClick:()=>a(n.id),onKeyDown:p=>r(n.id,p),"aria-expanded":e,children:e?"▼":"▶"}),l.jsx("span",{className:"epic-title",children:n.title}),n.jiraKey&&l.jsx("span",{className:"epic-jira",children:n.jiraKey}),l.jsx(Px,{text:`${n.id} ${n.title}`}),l.jsx(Mx,{hasContext:n.hasContext??!1,testIdPrefix:"epic",id:n.id}),f&&n.hasContext&&l.jsx($e,{variant:"default",className:"epic-ready-badge","data-testid":`epic-ready-badge-${n.id}`,children:"Ready"}),l.jsx("div",{className:"epic-progress","data-testid":`epic-progress-${n.id}`,"data-done":String(d),"data-total":String(h),children:l.jsx("div",{className:"progress-bar",style:{width:`${h>0?d/h*100:0}%`}})}),l.jsxs("span",{className:"epic-progress-label","data-testid":`epic-progress-label-${n.id}`,children:[d,"/",h," pts"]}),f&&l.jsxs(l.Fragment,{children:[i&&l.jsx("span",{"data-testid":`archive-loading-${n.id}`,children:"..."}),l.jsx(Ce,{variant:"outline",size:"sm",className:"archive-button","data-testid":`archive-button-${n.id}`,"aria-label":`Archive ${n.id}`,disabled:i,onClick:()=>c(n.id),children:"Archive"})]})]}),e&&l.jsx("div",{className:"epic-stories",children:n.stories.map(p=>{const y=p.hasContext??!1,b=p.status==="blocked",x=L2(p.assignedTo);return l.jsxs("div",{className:`story-item ${y?"":"missing-context"} ${b?"story-blocked":""}`,"data-testid":`story-item-${p.id}`,"data-status":p.status,"data-story-id":p.id,"aria-label":`${p.id}: ${p.title}`,children:[l.jsx(B2,{priority:p.priority,storyId:p.id}),l.jsx(H2,{status:p.status,storyId:p.id}),p.jiraKey&&l.jsx(V2,{jiraKey:p.jiraKey,storyId:p.id}),l.jsx(Px,{text:`${p.id} ${p.title}`}),l.jsxs("div",{className:"story-info",children:[l.jsx("span",{className:"story-title",children:p.title}),l.jsxs("span",{className:"story-meta",children:[x&&l.jsx("span",{className:"story-assignee","data-testid":`story-assignee-${p.id}`,children:x}),p.workflow&&l.jsx("span",{className:"story-workflow-badge","data-testid":`story-workflow-${p.id}`,children:p.workflow}),p.status==="done"&&p.completed&&l.jsx("span",{className:"story-completed-date","data-testid":`story-completed-${p.id}`,children:p.completed})]})]}),l.jsx(Mx,{hasContext:y,testIdPrefix:"story",id:p.id}),l.jsx("span",{className:"story-points","data-testid":`story-points-${p.id}`,children:p.points})]},p.id)})})]})}function nC(){const{data:n,isLoading:e,error:i}=tC(),[a,r]=m.useState(new Set),[c,d]=m.useState(new Set),[h,f]=m.useState(null),[p,y]=m.useState(null),b=n?.epics.filter(R=>!jf(R))??[],x=n?.epics.filter(R=>jf(R))??[],w=m.useRef(!1);m.useEffect(()=>{n?.epics&&!w.current&&(w.current=!0,r(new Set(b.map(R=>R.id))))},[n?.epics]);const E=m.useCallback(R=>{r(z=>{const O=new Set(z);return O.has(R)?O.delete(R):O.add(R),O})},[]),_=m.useCallback((R,z)=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),E(R))},[E]),C=m.useCallback(async R=>{d(z=>new Set(z).add(`archive-${R}`)),f(null),y(null);try{if(typeof window<"u"&&window.electronAPI?.sprint?.archiveEpic)await window.electronAPI.sprint.archiveEpic(R);else if(!(await fetch(`/api/sprint/archive-epic/${R}`,{method:"POST"})).ok)throw new Error("Archive failed")}catch(z){y(z instanceof Error?z:new Error("Archive failed"))}finally{d(z=>{const O=new Set(z);return O.delete(`archive-${R}`),O})}},[]),D=m.useCallback(async R=>{d(z=>new Set(z).add(`promote-${R}`)),y(null);try{if(typeof window<"u"&&window.electronAPI?.sprint?.promoteEpic)await window.electronAPI.sprint.promoteEpic(R);else if(!(await fetch(`/api/sprint/promote-epic/${R}`,{method:"POST"})).ok)throw new Error("Promote failed")}catch(z){y(z instanceof Error?z:new Error("Promote failed"))}finally{d(z=>{const O=new Set(z);return O.delete(`promote-${R}`),O})}},[]);if(e)return l.jsx("div",{className:"enhanced-sprint-panel","data-testid":"enhanced-sprint-panel",children:l.jsxs("div",{className:"loading-state space-y-3 p-2","data-testid":"sprint-panel-loading",children:[l.jsx(fe,{className:"h-5 w-32"}),l.jsx(fe,{className:"h-4 w-full"}),l.jsx(Rt,{className:"my-2"}),l.jsx(fe,{className:"h-5 w-28"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(Rt,{className:"my-2"}),l.jsx(fe,{className:"h-5 w-36"}),l.jsx(fe,{className:"h-6 w-3/4"})]})});const N=i||p,k=N?l.jsx("div",{className:"error-toast","data-testid":"error-toast",children:N.message}):null,T=h?l.jsxs("div",{className:"confirm-dialog","data-testid":"confirm-archive-dialog",children:[l.jsx("p",{children:"Are you sure you want to archive this epic?"}),l.jsx(Ce,{variant:"destructive",size:"sm","data-testid":"confirm-archive-yes",onClick:()=>C(h),children:"Yes"}),l.jsx(Ce,{variant:"outline",size:"sm","data-testid":"confirm-archive-no",onClick:()=>f(null),children:"No"})]}):null;return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"enhanced-sprint-panel","data-testid":"enhanced-sprint-panel",children:[k,T,l.jsxs("section",{"data-section":"current-story",children:[l.jsx("h2",{children:"Current Story"}),n?.currentStory?l.jsxs("div",{"data-testid":"current-story-section",children:[l.jsx("span",{className:"story-id",children:n.currentStory.id}),l.jsx("span",{className:"story-title",children:n.currentStory.title}),l.jsx("span",{className:"story-status",children:n.currentStory.status}),l.jsxs("span",{className:"story-points","data-testid":"current-story-points",children:[n.currentStory.points," pts"]})]}):n?.nextStory?l.jsxs("div",{"data-testid":"next-up-section",children:[l.jsx("span",{className:"next-up-label",children:"Next up:"}),l.jsx("span",{className:"story-id",children:n.nextStory.id}),l.jsx("span",{className:"story-title",children:n.nextStory.title})]}):l.jsx("div",{"data-testid":"no-stories-section",children:l.jsx("span",{children:"No active story"})})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{"data-section":"epics",children:[l.jsx("h2",{children:"Current Epics"}),l.jsxs("div",{"data-testid":"epic-tree-view",children:[(!n?.epics||n.epics.length===0)&&l.jsxs("div",{className:"empty-state","data-testid":"no-epics-section",children:[l.jsx("span",{children:"No epics in current sprint"}),l.jsx("p",{className:"hint",children:"Promote an epic from Future Initiatives to get started"})]}),b.map(R=>l.jsx(Lx,{epic:R,isExpanded:a.has(R.id),isArchiving:c.has(`archive-${R.id}`),onToggle:E,onKeyDown:_,onArchive:f},R.id))]})]}),x.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{"data-section":"completed-epics",children:[l.jsx("h2",{children:"Completed Epics"}),l.jsx("div",{"data-testid":"completed-epics-section",children:x.map(R=>l.jsx(Lx,{epic:R,isExpanded:a.has(R.id),isArchiving:c.has(`archive-${R.id}`),onToggle:E,onKeyDown:_,onArchive:f},R.id))})]})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{"data-section":"future",children:[l.jsx("h2",{children:"Future Initiatives"}),l.jsx("div",{"data-testid":"future-initiatives-section",children:n?.futureEpics.map(R=>{const z=c.has(`promote-${R.id}`),O=R.status==="ready";return l.jsxs("div",{className:"future-epic","data-testid":`future-epic-${R.id}`,children:[l.jsx("span",{className:"future-epic-title",children:R.title}),l.jsxs("span",{className:"future-epic-points",children:[R.estimatedPoints," pts"]}),l.jsx($e,{variant:R.status==="ready"?"default":"secondary",className:"future-epic-status","data-testid":`future-epic-status-${R.id}`,"data-status":R.status,children:R.status}),O&&l.jsx(Ce,{variant:"default",size:"sm",className:"promote-button","data-testid":`promote-button-${R.id}`,"aria-label":`Promote ${R.id} to current sprint`,disabled:z,onClick:()=>D(R.id),children:"Promote"})]},R.id)})})]})]})})}function iC(n){let e=0,i=0,a=0;for(const r of n){const c=r.status[0]||" ",d=r.status[1]||" ";c!==" "&&c!=="?"&&e++,(d==="M"||d==="D")&&i++,c==="?"&&d==="?"&&a++}return{staged:e,modified:i,untracked:a}}function F2(n){return n?.length?n.map(e=>{const i=iC(e.dirtyFiles);return{name:e.name,path:e.path,branch:e.branch,ahead:e.ahead??void 0,behind:e.behind??void 0,developBehind:e.developBehind??void 0,staged:i.staged,modified:i.modified,untracked:i.untracked,isDirty:!e.clean,files:e.dirtyFiles}}):[]}function U2(n){if(!n?.length)return null;const e=n[0];let i=0,a=0,r=0;for(const d of n){const h=iC(d.dirtyFiles);i+=h.staged,a+=h.modified,r+=h.untracked}const c=n.some(d=>!d.clean);return{branch:e.branch,ahead:e.ahead??void 0,behind:e.behind??void 0,staged:i>0?i:void 0,modified:a>0?a:void 0,untracked:r>0?r:void 0,isDirty:c}}function Lm(){const[n,e]=m.useState(null),[i,a]=m.useState([]),[r,c]=m.useState(!0),[d,h]=m.useState(null),f=m.useRef(null),p=m.useRef();return m.useEffect(()=>{const b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/git`,x=()=>{try{f.current=new WebSocket(b),f.current.onopen=()=>{console.debug("[useGitStatus] WebSocket connected")},f.current.onmessage=w=>{try{const E=JSON.parse(w.data);(E.type==="init"||E.type==="update")&&(e(U2(E.repos)),a(F2(E.repos)),c(!1),h(null))}catch(E){console.error("[useGitStatus] Failed to parse message:",E)}},f.current.onclose=()=>{console.debug("[useGitStatus] WebSocket closed, reconnecting..."),p.current=setTimeout(x,2e3)},f.current.onerror=w=>{console.error("[useGitStatus] WebSocket error:",w),h(new Error("WebSocket connection failed"))}}catch(w){console.error("[useGitStatus] WebSocket init failed:",w),h(w instanceof Error?w:new Error("Failed to connect")),c(!1)}};return x(),()=>{p.current&&clearTimeout(p.current),f.current&&f.current.close()}},[]),{gitStatus:n,repos:i,isLoading:r,error:d}}function $2(n){const e=n[0]||" ",i=n[1]||" ";return e==="?"&&i==="?"?"untracked":e!==" "&&e!=="?"?"staged":"modified"}function W2(n){const e=n[0]||" ",i=n[1]||" ";return e==="?"&&i==="?"?"?":e==="A"?"+":e==="D"||i==="D"?"-":e==="M"||i==="M"?"~":e==="R"?"R":n.trim()||"~"}function q2({files:n}){return l.jsx("ul",{className:"file-list",children:n.map((e,i)=>l.jsxs("li",{className:`file-item ${$2(e.status)}`,children:[l.jsx("span",{className:"file-status-icon",children:W2(e.status)}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"file-path",children:e.path})}),l.jsx(Te,{children:e.path})]})]},`${e.path}-${i}`))})}function Y2({repo:n}){const[e,i]=m.useState(!1),{name:a,branch:r,ahead:c,behind:d,developBehind:h,staged:f,modified:p,untracked:y,isDirty:b,files:x}=n,w=x.length>0;return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:`repo-status ${e?"expanded":""}`,"data-testid":`repo-status-${a}`,children:[l.jsxs("div",{className:"repo-header",children:[l.jsx("span",{className:"repo-name",children:a}),b&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"destructive",className:"dirty-indicator",children:"●"})}),l.jsx(Te,{children:"Uncommitted changes"})]})]}),l.jsxs("div",{className:"branch-info",children:[l.jsx("span",{className:"branch-icon",children:"⎇"}),l.jsx("span",{className:"branch-name",children:r})]}),(c!==void 0&&c>0||d!==void 0&&d>0||h!==void 0&&h>0)&&l.jsxs("div",{className:"sync-status",children:[c!==void 0&&c>0&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"ahead",children:["↑",c]})}),l.jsx(Te,{children:"Commits ahead of remote"})]}),d!==void 0&&d>0&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"behind",children:["↓",d]})}),l.jsx(Te,{children:"Commits behind remote"})]}),h!==void 0&&h>0&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"develop-behind",children:["⟳",h]})}),l.jsxs(Te,{children:["develop is ",h," commit",h>1?"s":""," ahead"]})]})]}),(f>0||p>0||y>0)&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs(Ce,{variant:"ghost",className:"file-status-toggle",onClick:()=>i(!e),children:[l.jsx("span",{className:`toggle-icon ${e?"open":""}`,children:"▶"}),l.jsxs("div",{className:"file-status",children:[f>0&&l.jsxs($e,{variant:"outline",className:"status-item staged",children:["+",f]}),p>0&&l.jsxs($e,{variant:"outline",className:"status-item modified",children:["~",p]}),y>0&&l.jsxs($e,{variant:"outline",className:"status-item untracked",children:["?",y]})]})]})}),l.jsx(Te,{children:e?"Collapse file list":"Expand file list"})]}),e&&w&&l.jsx(q2,{files:x})]})})}function sC(){const{repos:n,isLoading:e,error:i}=Lm();return e?l.jsx("div",{className:"git-panel loading","data-testid":"git-panel",children:l.jsxs("div",{className:"space-y-3 p-2",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(fe,{className:"h-4 w-32"}),l.jsx(fe,{className:"h-3 w-24"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx(fe,{className:"h-4 w-28"}),l.jsx(fe,{className:"h-3 w-20"})]})]})}):i?l.jsx("div",{className:"git-panel error","data-testid":"git-panel",children:l.jsx("div",{className:"error-message",children:i.message})}):n.length===0?l.jsx("div",{className:"git-panel empty","data-testid":"git-panel",children:l.jsx("div",{className:"placeholder",children:"No git repos"})}):l.jsx("div",{className:"git-panel stacked","data-testid":"git-panel",children:n.map(a=>l.jsx(Y2,{repo:a},a.name))})}function X2(n){switch(n){case"done":return"✓";case"current":return"●";default:return"○"}}function Q2(n){return n?["tdd","bdd"].includes(n.toLowerCase())?n.toUpperCase():n.charAt(0).toUpperCase()+n.slice(1):"—"}function Z2({phase:n,isLast:e}){const i=X2(n.status),a=`phase-step ${n.status}`;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:a,children:[l.jsx("span",{className:"phase-icon",children:i}),l.jsx("span",{className:"phase-label",children:n.label})]}),!e&&l.jsx("span",{className:"phase-arrow",children:"→"})]})}function K2({phases:n}){const e=n.length,i=n.findIndex(d=>d.status==="current"),a=n.filter(d=>d.status==="done").length,r=i>=0?i+1:a===e?e:1,c=i>=0?n[i]:null;return l.jsxs("div",{className:"stepped-progress",children:[l.jsxs("span",{className:"stepped-counter",children:["Step ",r," of ",e]}),c&&l.jsx("span",{className:"stepped-current-label",children:c.label})]})}function J2({workflows:n,onStart:e}){return l.jsxs("div",{className:"available-workflows",children:[l.jsx("div",{className:"available-workflows-header",children:l.jsxs("span",{className:"available-workflows-title",children:["Available Workflows (",n.length,")"]})}),l.jsx("div",{className:"available-workflows-list",children:n.map(i=>l.jsxs("div",{className:"workflow-entry","data-testid":"workflow-entry","data-workflow-entry-type":i.type,children:[l.jsxs("div",{className:"workflow-entry-header",children:[l.jsx("span",{className:"workflow-entry-name",children:i.name}),l.jsx($e,{variant:"outline",className:"workflow-entry-type-badge",children:i.type})]}),l.jsx("div",{className:"workflow-entry-description",children:i.description}),i.type==="stepped"&&l.jsxs("div",{className:"workflow-entry-hint",children:["/workflow start ",i.name]}),l.jsx("div",{className:"workflow-entry-footer",children:l.jsx(Ce,{variant:"ghost",size:"sm",className:"workflow-start-button","data-testid":"workflow-start-button",onClick:()=>e?.(i),children:"Start"})})]},i.name))})]})}function aC(){const{story:n,isLoading:e,error:i,availableWorkflows:a}=Pm(),{send:r,isConnected:c}=dr(),d=m.useCallback(b=>{c&&r(`/workflow start ${b.name}`)},[r,c]);if(e)return l.jsx("div",{className:"workflow-panel loading","data-testid":"workflow-panel",children:l.jsxs("div",{className:"space-y-2 p-2",children:[l.jsx(fe,{className:"h-6 w-16 rounded-full"}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx(fe,{className:"h-4 w-12"}),l.jsx(fe,{className:"h-4 w-12"}),l.jsx(fe,{className:"h-4 w-12"})]})]})});if(i)return l.jsx("div",{className:"workflow-panel error","data-testid":"workflow-panel",children:l.jsx("div",{className:"error-message",children:i.message})});const h=n?.workflow??null,f=n?.workflowPhases??null,p=n?.workflowType==="stepped";if(!h&&(!f||f.length===0))return a&&a.length>0?l.jsx("div",{className:"workflow-panel","data-testid":"workflow-panel",children:l.jsx(J2,{workflows:a,onStart:d})}):l.jsx("div",{className:"workflow-panel","data-testid":"workflow-panel",children:l.jsx("div",{className:"placeholder",children:"No active workflow"})});const y=Q2(h);return l.jsx("div",{className:"workflow-panel","data-testid":"workflow-panel",children:l.jsxs("div",{className:"workflow-content",children:[l.jsx($e,{variant:"secondary",className:"workflow-type-badge","data-workflow-type":h||"",children:y}),f&&f.length>0&&(p?l.jsx(K2,{phases:f}):l.jsx("div",{className:"phase-progress",children:f.map((b,x)=>l.jsx(Z2,{phase:b,isLast:x===f.length-1},b.name))}))]})})}function eP({item:n}){const e=n.completed?"ac-item ac-done":"ac-item",i=n.completed?"✓":"○";return l.jsxs("div",{className:e,children:[l.jsx("span",{className:"ac-icon",children:i}),l.jsx("span",{className:"ac-text",children:n.text})]})}function oC(){const{story:n,isLoading:e,error:i}=Pm();if(e)return l.jsx("div",{className:"ac-panel loading","data-testid":"ac-panel",children:l.jsxs("div",{className:"space-y-2 p-2",children:[l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-4 w-3/4"}),l.jsx(fe,{className:"h-4 w-5/6"}),l.jsx(fe,{className:"h-4 w-2/3"})]})});if(i)return l.jsx("div",{className:"ac-panel error","data-testid":"ac-panel",children:l.jsx("div",{className:"error-message",children:i.message})});const a=n?.criteria??null;if(!a||a.length===0)return l.jsx("div",{className:"ac-panel","data-testid":"ac-panel",children:l.jsx("div",{className:"placeholder",children:"No acceptance criteria"})});const r=a.filter(d=>d.completed).length,c=a.length;return l.jsx("div",{className:"ac-panel","data-testid":"ac-panel",children:l.jsxs("div",{className:"ac-content",children:[l.jsxs("span",{className:"progress-text",children:[r,"/",c]}),l.jsx("div",{className:"progress-bar-container",children:l.jsx("div",{className:"progress-bar",style:{width:`${r/c*100}%`}})}),l.jsx("div",{className:"ac-list",children:a.map((d,h)=>l.jsx(eP,{item:d},h))})]})})}function rC(){const[n,e]=m.useState([]),[i,a]=m.useState(!0),[r,c]=m.useState(null),d=m.useRef(null),h=m.useRef();return m.useEffect(()=>{const p=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/todos`,y=()=>{try{d.current=new WebSocket(p),d.current.onopen=()=>{console.debug("[useTodos] WebSocket connected")},d.current.onmessage=b=>{try{const x=JSON.parse(b.data);(x.type==="init"||x.type==="update")&&(e(x.todos||[]),a(!1),c(null))}catch(x){console.error("[useTodos] Failed to parse message:",x)}},d.current.onclose=()=>{console.debug("[useTodos] WebSocket closed, reconnecting..."),h.current=setTimeout(y,2e3)},d.current.onerror=b=>{console.error("[useTodos] WebSocket error:",b),c(new Error("WebSocket connection failed"))}}catch(b){console.error("[useTodos] WebSocket init failed:",b),c(b instanceof Error?b:new Error("Failed to connect")),a(!1)}};return y(),()=>{h.current&&clearTimeout(h.current),d.current&&d.current.close()}},[]),{todos:n,isLoading:i,error:r}}function Kh({todo:n}){const e={pending:"○",in_progress:"●",completed:"✓"}[n.status],i=`todo-item todo-${n.status}`,a=n.status==="in_progress"&&n.activeForm?n.activeForm:n.content;return l.jsxs("div",{className:i,"data-testid":`todo-${n.id}`,children:[l.jsx("span",{className:"todo-status",children:e}),l.jsx("span",{className:"todo-subject",children:a}),n.blockedBy&&n.blockedBy.length>0&&l.jsx(St,{delayDuration:300,children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"todo-blocked",children:"(blocked)"})}),l.jsx(Te,{children:`Blocked by: ${n.blockedBy.join(", ")}`})]})})]})}function lC(){const{todos:n,isLoading:e,error:i}=rC();if(e)return l.jsx("div",{className:"todo-panel loading","data-testid":"todo-panel",children:l.jsxs("div",{className:"space-y-2 p-2",children:[l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-4 w-5/6"}),l.jsx(fe,{className:"h-4 w-3/4"}),l.jsx(fe,{className:"h-4 w-4/5"})]})});if(i)return l.jsx("div",{className:"todo-panel error","data-testid":"todo-panel",children:l.jsx("div",{className:"error-message",children:i.message})});if(n.length===0)return l.jsx("div",{className:"todo-panel","data-testid":"todo-panel",children:l.jsx("div",{className:"placeholder",children:"No active tasks"})});const a=n.filter(p=>p.status==="in_progress"),r=n.filter(p=>p.status==="pending"),c=n.filter(p=>p.status==="completed"),d=n.length,h=c.length,f=d>0?Math.round(h/d*100):0;return l.jsx("div",{className:"todo-panel","data-testid":"todo-panel",children:l.jsxs("div",{className:"todo-content",children:[l.jsxs("div",{className:"progress-bar-container",children:[l.jsx("div",{className:"progress-bar",style:{width:`${f}%`}}),l.jsxs("span",{className:"progress-text",children:[h,"/",d]})]}),a.length>0&&l.jsxs("div",{className:"todo-section",children:[l.jsx("h4",{children:"In Progress"}),a.map(p=>l.jsx(Kh,{todo:p},p.id))]}),r.length>0&&l.jsxs("div",{className:"todo-section",children:[l.jsx("h4",{children:"Pending"}),r.map(p=>l.jsx(Kh,{todo:p},p.id))]}),c.length>0&&l.jsxs("div",{className:"todo-section todo-completed",children:[l.jsxs("h4",{children:["Completed (",c.length,")"]}),c.map(p=>l.jsx(Kh,{todo:p},p.id))]})]})})}function tP(){const[n,e]=m.useState([]),i=m.useRef(null),a=m.useRef();m.useEffect(()=>{const f=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/background-tasks`,p=()=>{try{i.current=new WebSocket(f),i.current.onopen=()=>{console.debug("[useBackgroundTasks] WebSocket connected")},i.current.onmessage=y=>{try{const b=JSON.parse(y.data);switch(b.type){case"init":b.tasks&&e(b.tasks);break;case"task:started":b.task&&e(x=>x.some(w=>w.taskId===b.task.taskId)?x:[...x,b.task]);break;case"task:completed":b.task&&e(x=>x.map(w=>w.taskId===b.task.taskId?{...w,...b.task}:w));break}}catch(b){console.error("[useBackgroundTasks] Failed to parse message:",b)}},i.current.onclose=()=>{console.debug("[useBackgroundTasks] WebSocket closed, reconnecting..."),a.current=setTimeout(p,2e3)},i.current.onerror=y=>{console.error("[useBackgroundTasks] WebSocket error:",y)}}catch(y){console.error("[useBackgroundTasks] WebSocket init failed:",y)}};return p(),()=>{a.current&&clearTimeout(a.current),i.current&&i.current.close()}},[]);const r=m.useCallback(()=>{e(h=>h.filter(f=>f.status==="pending"))},[]),c=n.filter(h=>h.status==="pending").length,d=n.filter(h=>h.status==="completed").length;return{tasks:n,pendingCount:c,completedCount:d,clearCompleted:r}}function Ix(n){return n<1e3?`${n}ms`:n<6e4?`${Math.floor(n/1e3)}s`:`${Math.floor(n/6e4)}m`}function nP({task:n,tick:e}){const a=n.status==="pending"?"...":n.success?"v":"x",r=`task-item task-${n.status}${n.success===!1?" task-error":""}`;let c;return n.status==="completed"&&n.durationMs!==void 0?c=Ix(n.durationMs):c=Ix(Date.now()-n.startedAt),l.jsxs("div",{className:r,"data-testid":`task-${n.taskId}`,children:[l.jsx("span",{className:"task-status",children:a}),l.jsxs("div",{className:"task-content",children:[l.jsx("span",{className:"task-description",children:n.description}),l.jsx("span",{className:"task-type",children:n.subagentType})]}),l.jsx("span",{className:"task-elapsed",children:c})]})}function cC(){const{tasks:n,pendingCount:e,completedCount:i,clearCompleted:a}=tP(),[r,c]=m.useState(0);if(m.useEffect(()=>{if(e===0)return;const h=setInterval(()=>{c(f=>f+1)},1e3);return()=>clearInterval(h)},[e]),n.length===0)return l.jsx("div",{className:"background-panel empty","data-testid":"background-panel",children:l.jsx("div",{className:"placeholder",children:"No subagent tasks"})});const d=[...n].sort((h,f)=>h.status==="pending"&&f.status!=="pending"?-1:h.status!=="pending"&&f.status==="pending"?1:f.startedAt-h.startedAt);return l.jsxs("div",{className:"background-panel","data-testid":"background-panel",children:[l.jsxs("div",{className:"panel-header",children:[l.jsxs("span",{className:"task-counts",children:[e>0&&l.jsxs("span",{className:"pending-count",children:[e," running"]}),i>0&&l.jsxs("span",{className:"completed-count",children:[i," done"]})]}),i>0&&l.jsx(Ce,{variant:"ghost",size:"sm",type:"button",className:"clear-button",onClick:a,children:"Clear"})]}),l.jsx("div",{className:"task-list",children:d.map(h=>l.jsx(nP,{task:h,tick:r},h.taskId))})]})}function Tf(n,[e,i]){return Math.min(i,Math.max(e,n))}function iP(n,e){return m.useReducer((i,a)=>e[i][a]??i,n)}var Im="ScrollArea",[uC]=cn(Im),[sP,Dn]=uC(Im),dC=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,type:a="hover",dir:r,scrollHideDelay:c=600,...d}=n,[h,f]=m.useState(null),[p,y]=m.useState(null),[b,x]=m.useState(null),[w,E]=m.useState(null),[_,C]=m.useState(null),[D,N]=m.useState(0),[k,T]=m.useState(0),[R,z]=m.useState(!1),[O,A]=m.useState(!1),G=Ie(e,B=>f(B)),U=Kc(r);return l.jsx(sP,{scope:i,type:a,dir:U,scrollHideDelay:c,scrollArea:h,viewport:p,onViewportChange:y,content:b,onContentChange:x,scrollbarX:w,onScrollbarXChange:E,scrollbarXEnabled:R,onScrollbarXEnabledChange:z,scrollbarY:_,onScrollbarYChange:C,scrollbarYEnabled:O,onScrollbarYEnabledChange:A,onCornerWidthChange:N,onCornerHeightChange:T,children:l.jsx(je.div,{dir:U,...d,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":D+"px","--radix-scroll-area-corner-height":k+"px",...n.style}})})});dC.displayName=Im;var hC="ScrollAreaViewport",fC=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,children:a,nonce:r,...c}=n,d=Dn(hC,i),h=m.useRef(null),f=Ie(e,h,d.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),l.jsx(je.div,{"data-radix-scroll-area-viewport":"",...c,ref:f,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...n.style},children:l.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});fC.displayName=hC;var Jn="ScrollAreaScrollbar",Gm=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=Dn(Jn,n.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:d}=r,h=n.orientation==="horizontal";return m.useEffect(()=>(h?c(!0):d(!0),()=>{h?c(!1):d(!1)}),[h,c,d]),r.type==="hover"?l.jsx(aP,{...a,ref:e,forceMount:i}):r.type==="scroll"?l.jsx(oP,{...a,ref:e,forceMount:i}):r.type==="auto"?l.jsx(mC,{...a,ref:e,forceMount:i}):r.type==="always"?l.jsx(Bm,{...a,ref:e}):null});Gm.displayName=Jn;var aP=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=Dn(Jn,n.__scopeScrollArea),[c,d]=m.useState(!1);return m.useEffect(()=>{const h=r.scrollArea;let f=0;if(h){const p=()=>{window.clearTimeout(f),d(!0)},y=()=>{f=window.setTimeout(()=>d(!1),r.scrollHideDelay)};return h.addEventListener("pointerenter",p),h.addEventListener("pointerleave",y),()=>{window.clearTimeout(f),h.removeEventListener("pointerenter",p),h.removeEventListener("pointerleave",y)}}},[r.scrollArea,r.scrollHideDelay]),l.jsx(qt,{present:i||c,children:l.jsx(mC,{"data-state":c?"visible":"hidden",...a,ref:e})})}),oP=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=Dn(Jn,n.__scopeScrollArea),c=n.orientation==="horizontal",d=eu(()=>f("SCROLL_END"),100),[h,f]=iP("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return m.useEffect(()=>{if(h==="idle"){const p=window.setTimeout(()=>f("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(p)}},[h,r.scrollHideDelay,f]),m.useEffect(()=>{const p=r.viewport,y=c?"scrollLeft":"scrollTop";if(p){let b=p[y];const x=()=>{const w=p[y];b!==w&&(f("SCROLL"),d()),b=w};return p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[r.viewport,c,f,d]),l.jsx(qt,{present:i||h!=="hidden",children:l.jsx(Bm,{"data-state":h==="hidden"?"hidden":"visible",...a,ref:e,onPointerEnter:we(n.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:we(n.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),mC=m.forwardRef((n,e)=>{const i=Dn(Jn,n.__scopeScrollArea),{forceMount:a,...r}=n,[c,d]=m.useState(!1),h=n.orientation==="horizontal",f=eu(()=>{if(i.viewport){const p=i.viewport.offsetWidth<i.viewport.scrollWidth,y=i.viewport.offsetHeight<i.viewport.scrollHeight;d(h?p:y)}},10);return Ba(i.viewport,f),Ba(i.content,f),l.jsx(qt,{present:a||c,children:l.jsx(Bm,{"data-state":c?"visible":"hidden",...r,ref:e})})}),Bm=m.forwardRef((n,e)=>{const{orientation:i="vertical",...a}=n,r=Dn(Jn,n.__scopeScrollArea),c=m.useRef(null),d=m.useRef(0),[h,f]=m.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=bC(h.viewport,h.content),y={...a,sizes:h,onSizesChange:f,hasThumb:p>0&&p<1,onThumbChange:x=>c.current=x,onThumbPointerUp:()=>d.current=0,onThumbPointerDown:x=>d.current=x};function b(x,w){return hP(x,d.current,h,w)}return i==="horizontal"?l.jsx(rP,{...y,ref:e,onThumbPositionChange:()=>{if(r.viewport&&c.current){const x=r.viewport.scrollLeft,w=Gx(x,h,r.dir);c.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:x=>{r.viewport&&(r.viewport.scrollLeft=x)},onDragScroll:x=>{r.viewport&&(r.viewport.scrollLeft=b(x,r.dir))}}):i==="vertical"?l.jsx(lP,{...y,ref:e,onThumbPositionChange:()=>{if(r.viewport&&c.current){const x=r.viewport.scrollTop,w=Gx(x,h);c.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:x=>{r.viewport&&(r.viewport.scrollTop=x)},onDragScroll:x=>{r.viewport&&(r.viewport.scrollTop=b(x))}}):null}),rP=m.forwardRef((n,e)=>{const{sizes:i,onSizesChange:a,...r}=n,c=Dn(Jn,n.__scopeScrollArea),[d,h]=m.useState(),f=m.useRef(null),p=Ie(e,f,c.onScrollbarXChange);return m.useEffect(()=>{f.current&&h(getComputedStyle(f.current))},[f]),l.jsx(gC,{"data-orientation":"horizontal",...r,ref:p,sizes:i,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Jc(i)+"px",...n.style},onThumbPointerDown:y=>n.onThumbPointerDown(y.x),onDragScroll:y=>n.onDragScroll(y.x),onWheelScroll:(y,b)=>{if(c.viewport){const x=c.viewport.scrollLeft+y.deltaX;n.onWheelScroll(x),wC(x,b)&&y.preventDefault()}},onResize:()=>{f.current&&c.viewport&&d&&a({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:Cc(d.paddingLeft),paddingEnd:Cc(d.paddingRight)}})}})}),lP=m.forwardRef((n,e)=>{const{sizes:i,onSizesChange:a,...r}=n,c=Dn(Jn,n.__scopeScrollArea),[d,h]=m.useState(),f=m.useRef(null),p=Ie(e,f,c.onScrollbarYChange);return m.useEffect(()=>{f.current&&h(getComputedStyle(f.current))},[f]),l.jsx(gC,{"data-orientation":"vertical",...r,ref:p,sizes:i,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Jc(i)+"px",...n.style},onThumbPointerDown:y=>n.onThumbPointerDown(y.y),onDragScroll:y=>n.onDragScroll(y.y),onWheelScroll:(y,b)=>{if(c.viewport){const x=c.viewport.scrollTop+y.deltaY;n.onWheelScroll(x),wC(x,b)&&y.preventDefault()}},onResize:()=>{f.current&&c.viewport&&d&&a({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:Cc(d.paddingTop),paddingEnd:Cc(d.paddingBottom)}})}})}),[cP,pC]=uC(Jn),gC=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,sizes:a,hasThumb:r,onThumbChange:c,onThumbPointerUp:d,onThumbPointerDown:h,onThumbPositionChange:f,onDragScroll:p,onWheelScroll:y,onResize:b,...x}=n,w=Dn(Jn,i),[E,_]=m.useState(null),C=Ie(e,G=>_(G)),D=m.useRef(null),N=m.useRef(""),k=w.viewport,T=a.content-a.viewport,R=Gt(y),z=Gt(f),O=eu(b,10);function A(G){if(D.current){const U=G.clientX-D.current.left,B=G.clientY-D.current.top;p({x:U,y:B})}}return m.useEffect(()=>{const G=U=>{const B=U.target;E?.contains(B)&&R(U,T)};return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[k,E,T,R]),m.useEffect(z,[a,z]),Ba(E,O),Ba(w.content,O),l.jsx(cP,{scope:i,scrollbar:E,hasThumb:r,onThumbChange:Gt(c),onThumbPointerUp:Gt(d),onThumbPositionChange:z,onThumbPointerDown:Gt(h),children:l.jsx(je.div,{...x,ref:C,style:{position:"absolute",...x.style},onPointerDown:we(n.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),D.current=E.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),A(G))}),onPointerMove:we(n.onPointerMove,A),onPointerUp:we(n.onPointerUp,G=>{const U=G.target;U.hasPointerCapture(G.pointerId)&&U.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=N.current,w.viewport&&(w.viewport.style.scrollBehavior=""),D.current=null})})})}),Sc="ScrollAreaThumb",vC=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=pC(Sc,n.__scopeScrollArea);return l.jsx(qt,{present:i||r.hasThumb,children:l.jsx(uP,{ref:e,...a})})}),uP=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,style:a,...r}=n,c=Dn(Sc,i),d=pC(Sc,i),{onThumbPositionChange:h}=d,f=Ie(e,b=>d.onThumbChange(b)),p=m.useRef(void 0),y=eu(()=>{p.current&&(p.current(),p.current=void 0)},100);return m.useEffect(()=>{const b=c.viewport;if(b){const x=()=>{if(y(),!p.current){const w=fP(b,h);p.current=w,h()}};return h(),b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)}},[c.viewport,y,h]),l.jsx(je.div,{"data-state":d.hasThumb?"visible":"hidden",...r,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:we(n.onPointerDownCapture,b=>{const w=b.target.getBoundingClientRect(),E=b.clientX-w.left,_=b.clientY-w.top;d.onThumbPointerDown({x:E,y:_})}),onPointerUp:we(n.onPointerUp,d.onThumbPointerUp)})});vC.displayName=Sc;var Hm="ScrollAreaCorner",yC=m.forwardRef((n,e)=>{const i=Dn(Hm,n.__scopeScrollArea),a=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&a?l.jsx(dP,{...n,ref:e}):null});yC.displayName=Hm;var dP=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,...a}=n,r=Dn(Hm,i),[c,d]=m.useState(0),[h,f]=m.useState(0),p=!!(c&&h);return Ba(r.scrollbarX,()=>{const y=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(y),f(y)}),Ba(r.scrollbarY,()=>{const y=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(y),d(y)}),p?l.jsx(je.div,{...a,ref:e,style:{width:c,height:h,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function Cc(n){return n?parseInt(n,10):0}function bC(n,e){const i=n/e;return isNaN(i)?0:i}function Jc(n){const e=bC(n.viewport,n.content),i=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,a=(n.scrollbar.size-i)*e;return Math.max(a,18)}function hP(n,e,i,a="ltr"){const r=Jc(i),c=r/2,d=e||c,h=r-d,f=i.scrollbar.paddingStart+d,p=i.scrollbar.size-i.scrollbar.paddingEnd-h,y=i.content-i.viewport,b=a==="ltr"?[0,y]:[y*-1,0];return xC([f,p],b)(n)}function Gx(n,e,i="ltr"){const a=Jc(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,c=e.scrollbar.size-r,d=e.content-e.viewport,h=c-a,f=i==="ltr"?[0,d]:[d*-1,0],p=Tf(n,f);return xC([0,d],[0,h])(p)}function xC(n,e){return i=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const a=(e[1]-e[0])/(n[1]-n[0]);return e[0]+a*(i-n[0])}}function wC(n,e){return n>0&&n<e}var fP=(n,e=()=>{})=>{let i={left:n.scrollLeft,top:n.scrollTop},a=0;return(function r(){const c={left:n.scrollLeft,top:n.scrollTop},d=i.left!==c.left,h=i.top!==c.top;(d||h)&&e(),i=c,a=window.requestAnimationFrame(r)})(),()=>window.cancelAnimationFrame(a)};function eu(n,e){const i=Gt(n),a=m.useRef(0);return m.useEffect(()=>()=>window.clearTimeout(a.current),[]),m.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(i,e)},[i,e])}function Ba(n,e){const i=Gt(e);Dt(()=>{let a=0;if(n){const r=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(i)});return r.observe(n),()=>{window.cancelAnimationFrame(a),r.unobserve(n)}}},[n,i])}var SC=dC,mP=fC,pP=yC;const Vm=m.forwardRef(({className:n,children:e,...i},a)=>l.jsxs(SC,{ref:a,className:ye("relative overflow-hidden",n),...i,children:[l.jsx(mP,{className:"h-full w-full rounded-[inherit]",children:e}),l.jsx(CC,{}),l.jsx(pP,{})]}));Vm.displayName=SC.displayName;const CC=m.forwardRef(({className:n,orientation:e="vertical",...i},a)=>l.jsx(Gm,{ref:a,orientation:e,className:ye("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",n),...i,children:l.jsx(vC,{className:"relative flex-1 rounded-full bg-border"})}));CC.displayName=Gm.displayName;var tu="Collapsible",[gP]=cn(tu),[vP,Fm]=gP(tu),_C=m.forwardRef((n,e)=>{const{__scopeCollapsible:i,open:a,defaultOpen:r,disabled:c,onOpenChange:d,...h}=n,[f,p]=_n({prop:a,defaultProp:r??!1,onChange:d,caller:tu});return l.jsx(vP,{scope:i,disabled:c,contentId:Mt(),open:f,onOpenToggle:m.useCallback(()=>p(y=>!y),[p]),children:l.jsx(je.div,{"data-state":$m(f),"data-disabled":c?"":void 0,...h,ref:e})})});_C.displayName=tu;var EC="CollapsibleTrigger",DC=m.forwardRef((n,e)=>{const{__scopeCollapsible:i,...a}=n,r=Fm(EC,i);return l.jsx(je.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":$m(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...a,ref:e,onClick:we(n.onClick,r.onOpenToggle)})});DC.displayName=EC;var Um="CollapsibleContent",AC=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=Fm(Um,n.__scopeCollapsible);return l.jsx(qt,{present:i||r.open,children:({present:c})=>l.jsx(yP,{...a,ref:e,present:c})})});AC.displayName=Um;var yP=m.forwardRef((n,e)=>{const{__scopeCollapsible:i,present:a,children:r,...c}=n,d=Fm(Um,i),[h,f]=m.useState(a),p=m.useRef(null),y=Ie(e,p),b=m.useRef(0),x=b.current,w=m.useRef(0),E=w.current,_=d.open||h,C=m.useRef(_),D=m.useRef(void 0);return m.useEffect(()=>{const N=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(N)},[]),Dt(()=>{const N=p.current;if(N){D.current=D.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const k=N.getBoundingClientRect();b.current=k.height,w.current=k.width,C.current||(N.style.transitionDuration=D.current.transitionDuration,N.style.animationName=D.current.animationName),f(a)}},[d.open,a]),l.jsx(je.div,{"data-state":$m(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!_,...c,ref:y,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":E?`${E}px`:void 0,...n.style},children:_&&r})});function $m(n){return n?"open":"closed"}var bP=_C;const NC=bP,jC=DC,TC=AC;function xP(){const[n,e]=m.useState({}),[i,a]=m.useState(new Set),[r,c]=m.useState(null),d=m.useCallback(async h=>{if(!(n[h]||i.has(h))){a(f=>new Set(f).add(h)),c(null);try{const f=h?`?path=${encodeURIComponent(h)}`:"",p=await fetch(`/api/files${f}`);if(!p.ok)throw new Error(`Failed to list directory: ${p.statusText}`);const y=await p.json(),x=(Array.isArray(y)?y:y.entries??[]).sort((w,E)=>w.type!==E.type?w.type==="directory"?-1:1:w.name.localeCompare(E.name));e(w=>({...w,[h||"__root__"]:x}))}catch(f){c(f instanceof Error?f.message:"Failed to load directory")}finally{a(f=>{const p=new Set(f);return p.delete(h),p})}}},[n,i]);return{cache:n,loading:i,error:r,fetchDirectory:d}}function kC({entry:n,status:e,depth:i,onFileClick:a}){const r=e==="created"?"+":e==="modified"?"~":e==="deleted"?"-":null;return l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("div",{role:"treeitem",className:`file-item${e?` file-${e}`:""}`,style:{paddingLeft:`${12+i*16}px`},tabIndex:0,"aria-label":`${n.name}${e?`, ${e}`:""}`,onClick:()=>a?.(n,e),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),a?.(n,e))},children:[r&&l.jsx("span",{className:`status-icon status-${e}`,"aria-hidden":"true",children:r}),l.jsx("span",{className:"file-name",children:n.name})]})}),l.jsx(Te,{children:n.path})]})}function RC({entry:n,depth:e,changedFiles:i,onFileClick:a,fetchDirectory:r,cache:c,loading:d}){const h=Array.from(i.keys()).some(w=>w.startsWith(n.path+"/")),[f,p]=m.useState(h),y=c[n.path],b=d.has(n.path);m.useEffect(()=>{h&&!y&&!d.has(n.path)&&r(n.path)},[h,y,n.path,r,d]),m.useEffect(()=>{h&&p(!0)},[h]);const x=m.useCallback(()=>{const w=!f;p(w),w&&!y&&r(n.path)},[f,y,n.path,r]);return l.jsxs(NC,{open:f,onOpenChange:x,children:[l.jsx(jC,{asChild:!0,children:l.jsxs("div",{className:`directory-header${h?" has-changes":""}`,style:{paddingLeft:`${4+e*16}px`},children:[l.jsx("span",{className:"directory-toggle",children:l.jsx("span",{className:"toggle-icon",children:f?"▼":"▶"})}),l.jsx("span",{className:"directory-name",children:n.name})]})}),l.jsxs(TC,{children:[b&&l.jsx("div",{className:"tree-loading",style:{paddingLeft:`${12+(e+1)*16}px`},children:"Loading..."}),y?.map(w=>w.type==="directory"?l.jsx(RC,{entry:w,depth:e+1,changedFiles:i,onFileClick:a,fetchDirectory:r,cache:c,loading:d},w.path):l.jsx(kC,{entry:w,status:i.get(w.path),depth:e+1,onFileClick:a},w.path))]})]})}function wP({changedFiles:n,onFileClick:e}){const{cache:i,loading:a,error:r,fetchDirectory:c}=xP();m.useEffect(()=>{c("")},[]);const d=i.__root__,h=n.size;return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{role:"tree","aria-label":"Project files",className:"filetree full-filetree",children:[h>0&&l.jsx($e,{variant:"secondary","data-testid":"file-count-badge",className:"file-count-badge","aria-label":`${h} files changed`,children:h}),l.jsxs(Vm,{className:"filetree-scroll",children:[r&&l.jsx("div",{className:"tree-error",children:r}),!d&&!r&&l.jsx("div",{className:"tree-loading",children:"Loading project files..."}),d?.map(f=>f.type==="directory"?l.jsx(RC,{entry:f,depth:0,changedFiles:n,onFileClick:e,fetchDirectory:c,cache:i,loading:a},f.path):l.jsx(kC,{entry:f,status:n.get(f.path),depth:0,onFileClick:e},f.path))]})]})})}function Bx(n){const e=n[0]||" ",i=n[1]||" ";return e==="D"||i==="D"?"deleted":e==="?"||e==="A"?"created":"modified"}function OC(){const{repos:n}=Lm(),e=m.useMemo(()=>{const a=new Map;for(const r of n)for(const c of r.files){const d=n.length>1?`${r.path}/${c.path}`:`${r.path}/${c.path}`;a.set(d,Bx(c.status)),a.set(c.path,Bx(c.status))}return a},[n]),i=m.useCallback((a,r)=>{fetch("/api/files/edit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})}).catch(c=>console.error("[ChangedPanel] Failed to open file:",c))},[]);return l.jsx("div",{className:"changed-panel","data-testid":"changed-panel",children:l.jsx(wP,{changedFiles:e,onFileClick:i})})}const SP=2e3;function CP(){const[n,e]=m.useState([]),[i,a]=m.useState(null),r=m.useRef(null);m.useEffect(()=>{let h=null,f=!0;const p=()=>{const y=window.location.protocol==="https:"?"wss:":"ws:",b=new WebSocket(`${y}//${window.location.host}/ws/diffs`);r.current=b,b.onopen=()=>{console.log("[useDiffs] WebSocket connected")},b.onmessage=x=>{try{const w=JSON.parse(x.data);if(w.type==="init"){const E=w.diffs||[];e(E),E.length>0&&a(E[E.length-1])}else if(w.type==="diff"){const E=w.diff;e(_=>{const C=_.findIndex(D=>D.path===E.path);if(C>=0){const D=[..._];return D[C]=E,D}return[..._,E]}),a(E)}else if(w.type==="refresh"){const E=w.diffs||[];e(E),E.length>0?a(_=>{if(_){const C=E.find(D=>D.path===_.path);if(C)return C}return E[E.length-1]}):a(null)}}catch(w){console.error("[useDiffs] Failed to parse message:",w)}},b.onclose=()=>{f&&(h=setTimeout(p,SP))},b.onerror=x=>{console.error("[useDiffs] WebSocket error:",x),b.close()}};return p(),()=>{f=!1,h&&clearTimeout(h),r.current?.close()}},[]);const c=m.useCallback(h=>{const f=n.find(p=>p.path===h);a(f||null)},[n]),d=m.useCallback(()=>{e([]),a(null),r.current?.readyState===WebSocket.OPEN&&r.current.send(JSON.stringify({type:"clear"}))},[]);return{diffs:n,selectedDiff:i,selectDiff:c,clearDiffs:d}}function _P({line:n,type:e,lineNum:i}){return l.jsxs("div",{className:`diff-line diff-${e}`,children:[i!==void 0&&l.jsx("span",{className:"line-num",children:i}),l.jsx("span",{className:"line-content",children:n})]})}function EP(n){const e=n.split(`
63
+ `)}function mM(n,e){return n==="Read"&&e.file_path?String(e.file_path):n==="Bash"&&e.command?String(e.command):n==="Glob"&&e.pattern||n==="Grep"&&e.pattern?String(e.pattern):n==="Write"&&e.file_path?String(e.file_path):JSON.stringify(e,null,2)}function E0(n){return{Read:"R",Write:"W",Bash:"B",Glob:"G",Grep:"S",Edit:"E",Task:"T",WebFetch:"F",WebSearch:"W",TodoWrite:"D"}[n]||n.charAt(0).toUpperCase()}function Rm({toolUse:n,result:e,className:i}){const[a,r]=m.useState(!0),[c,d]=m.useState(!0),[h,f]=m.useState(!1),[p,y]=m.useState("idle"),b=e?.is_error===!0,x=mM(n.tool_name,n.input),w=Object.keys(n.input).length,E=cM(n.tool_name),C=m.useMemo(()=>Af(n.tool_name,n.input),[n.tool_name,n.input]),S=m.useMemo(()=>e?hM(e.content):0,[e?.content]),D=S>bx,N=D&&!h,k=m.useMemo(()=>e?N?fM(e.content,bx):e.content:"",[e?.content,N]),T=async()=>{if(e)try{await navigator.clipboard.writeText(e.content),y("copied"),setTimeout(()=>y("idle"),2e3)}catch{y("error")}},R=S===1?"1 line":`${S} lines`,z=["tool-call-block",E,b?"tool-error":"",i||""].filter(Boolean).join(" "),O=E0(n.tool_name);return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{"data-testid":"tool-call-block",className:z,children:[l.jsxs("div",{className:"tool-header",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"default",className:"tool-type-badge",children:O})}),l.jsx(Te,{children:n.tool_name})]}),l.jsx("span",{className:"tool-name",children:C}),l.jsx("span",{"data-testid":"tool-duration",className:"tool-duration",children:e?.durationMs!==void 0?_0(e.durationMs):""})]}),l.jsx("div",{className:"tool-result-header",children:l.jsxs(Ce,{variant:"ghost",size:"sm","data-testid":"tool-prompt-toggle",className:"tool-result-toggle",onClick:()=>d(!c),children:[c?"▶":"▼"," Prompt (",w," ",w===1?"param":"params",")"]})}),l.jsx("div",{"data-testid":"tool-prompt-content",className:`tool-result-content ${c?"collapsed":""}`,children:l.jsx("pre",{children:x})}),e&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"tool-result-header",children:[l.jsxs(Ce,{variant:"ghost",size:"sm","data-testid":"tool-result-toggle",className:"tool-result-toggle",onClick:()=>r(!a),children:[a?"▶":"▼"," Result (",R,")"]}),l.jsx(Ce,{variant:"ghost",size:"icon","data-testid":"tool-result-copy",className:`tool-result-copy ${p==="copied"?"copied":""} ${p==="error"?"copy-error":""}`,onClick:T,"aria-label":"Copy result to clipboard",children:p==="copied"?"✓":"📋"})]}),l.jsxs("div",{"data-testid":"tool-result-content",className:`tool-result-content ${a?"collapsed":""} ${N&&!a?"truncated":""} ${b?"error-content":""}`,children:[l.jsx("pre",{children:k}),D&&!a&&N&&l.jsxs(Ce,{variant:"link",size:"sm","data-testid":"tool-result-expand",className:"tool-result-expand",onClick:()=>f(!0),children:["Show all (",S," lines)"]})]})]})]})})}function pM({stack:n,toolResults:e}){const[i,a]=m.useState(!n.isActive),r=m.useRef(n.isActive);m.useEffect(()=>{r.current&&!n.isActive&&a(!1),r.current=n.isActive},[n.isActive]);const c=`${n.count}`,d=m.useMemo(()=>{if(n.isActive&&n.tools.length>0){const E=n.tools[n.tools.length-1];return Af(E.tool_name,E.input)}return null},[n.tools,n.isActive]),h=m.useMemo(()=>{if(n.tools.length===0)return"";const E=n.tools[n.tools.length-1];return Af(E.tool_name,E.input)},[n.tools]),f=m.useMemo(()=>{const E=new Map;return n.tools.forEach(C=>{const S=E.get(C.tool_name)||0;E.set(C.tool_name,S+1)}),E},[n.tools]),p=m.useMemo(()=>n.tools.reduce((E,C)=>{const S=e.get(C.tool_id);return E+(S?.durationMs||0)},0),[n.tools,e]),y=E=>{const C=n.tools[E],S=e.get(C.tool_id);return n.isActive&&E===n.tools.length-1&&!S?"tool-current":"tool-historical"},b=m.useCallback(()=>{a(E=>!E)},[]),x=m.useCallback(E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),b())},[b]),w=!i||n.isActive;return l.jsxs("div",{"data-testid":"tool-stack","data-collapsible":"true",className:`tool-stack ${i&&!n.isActive?"collapsed":""}`,children:[l.jsxs("div",{"data-testid":"tool-stack-header",className:"tool-stack-header",onClick:b,onKeyDown:x,role:"button",tabIndex:0,"aria-expanded":!i||n.isActive,"aria-label":`Tool stack with ${c}: ${h}`,children:[l.jsx("span",{className:"tool-stack-toggle",children:i&&!n.isActive?"▶":"▼"}),l.jsx("span",{"data-testid":"tool-stack-count",className:"tool-stack-count-badge",children:c}),n.isActive&&d?l.jsx("span",{className:"tool-stack-active-summary",children:d}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"tool-stack-badges",children:l.jsx(St,{delayDuration:300,children:Array.from(f.entries()).slice(0,4).map(([E,C])=>l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"outline",className:`tool-mini-badge badge-${E.toLowerCase()}`,children:E0(E)})}),l.jsx(Te,{children:`${C} ${E} call${C>1?"s":""}`})]},E))})}),l.jsx("span",{className:"tool-stack-summary",children:h})]}),l.jsx("span",{className:"tool-stack-duration",children:p>0?_0(p):""})]}),w&&l.jsx("div",{className:"tool-stack-content",children:n.tools.map((E,C)=>{const S=e.get(E.tool_id),D=y(C);return l.jsx(Rm,{toolUse:{type:"tool_use",tool_name:E.tool_name,tool_id:E.tool_id,input:E.input,timestamp:E.timestamp},result:S?{type:"tool_result",tool_id:S.tool_id,content:S.content,timestamp:S.timestamp}:void 0,className:D},E.tool_id||`tool-${C}`)})})]})}const Yh=new Map;let xc=null;async function gM(){if(!xc)try{const n=await fetch("/api/theme-agents/full");n.ok&&(xc=await n.json())}catch{}}async function vM(n){const e=`agent:${n}`;if(Yh.has(e))return Yh.get(e);try{if(await gM(),xc?.agents){const i=xc.agents.find(a=>a.role===n);if(i?.helper)return Yh.set(e,i.helper),i.helper}return null}catch{return null}}const xx={"testing-runner":"Running tests",Explore:"Exploring codebase","sm-setup":"Setting up story","sm-finish":"Finishing story",handoff:"Handing off","workflow-status-check":"Checking workflow status","general-purpose":"Processing task",Plan:"Planning implementation",Bash:"Running commands"};function yM(n,e){const i=e?.plural?"are":"is",a=n.description,r=n.subagent_type;if(r&&xx[r]){const c=xx[r],d=c.charAt(0).toLowerCase()+c.slice(1);return a?`${i} ${d}: ${a}`:`${i} ${d}`}return a||"Working..."}function bM(){const[n,e]=m.useState(null),[i,a]=m.useState(!0),[r,c]=m.useState(null);return m.useEffect(()=>{const d=async p=>{try{const y=await vM(p);e(y),a(!1)}catch(y){c(y instanceof Error?y:new Error("Failed to fetch helper")),a(!1)}},h=window.location.protocol==="https:"?"wss:":"ws:",f=new WebSocket(`${h}//${window.location.host}/ws/persona`);return f.onmessage=p=>{try{const y=JSON.parse(p.data);y?.role&&d(y.role)}catch(y){c(y instanceof Error?y:new Error("Failed to parse persona")),a(!1)}},f.onerror=()=>{c(new Error("WebSocket connection failed")),a(!1)},()=>f.close()},[]),{helper:n,isLoading:i,error:r}}function xM({type:n,name:e,messages:i,defaultCollapsed:a=!0,onCollapseChange:r,helperName:c,helperStyle:d,friendlyMessage:h}){const[f,p]=m.useState(a),{helper:y}=bM(),b=m.useMemo(()=>yM({subagent_type:n,description:e},{plural:y?.plural}),[n,e,y?.plural]),x=c??y?.name,w=d??y?.style,E=h??b,C=x||n,S=E||e,D=i.filter(T=>T.type!=="tool_result").length,N=new Map;i.forEach(T=>{T.type==="tool_result"&&T.tool_id&&N.set(T.tool_id,T)});const k=(T,R)=>{if(T.type==="tool_use"&&T.tool_name&&T.tool_id){const z=N.get(T.tool_id);return l.jsx("div",{"data-testid":"message-tool_use",className:"message message-tool_use",children:l.jsx(Rm,{toolUse:{type:"tool_use",tool_name:T.tool_name,tool_id:T.tool_id,input:T.input||{},timestamp:T.timestamp},result:z?{type:"tool_result",tool_id:z.tool_id,content:z.content||"",timestamp:z.timestamp}:void 0})},`tool-wrapper-${T.tool_id}`)}if(T.type==="tool_result")return null;if(T.type==="user"){const z=(T.content||"").slice(0,120).replace(/\n/g," ");return l.jsx("div",{"data-testid":"subagent-prompt",className:"message message-subagent-prompt",children:l.jsxs("div",{className:"message-content",children:[z,(T.content||"").length>120?"...":""]})},`subagent-prompt-${R}`)}return l.jsx(C0,{message:{type:T.type,content:T.content,timestamp:T.timestamp}},`msg-${R}`)};return l.jsxs("div",{"data-testid":"subagent-span","data-collapsible":"true",className:`subagent-span subagent-${n} ${f?"collapsed":""}`,children:[l.jsxs("div",{"data-testid":"subagent-span-header",className:"subagent-header",onClick:()=>{const T=!f;p(T),r?.(T)},children:[l.jsx("span",{className:"subagent-toggle",children:f?"▶":"▼"}),l.jsx(St,{delayDuration:300,children:w?l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"subagent-helper-name",children:C})}),l.jsx(Te,{children:w})]}):l.jsx("span",{className:"subagent-helper-name",children:C})}),l.jsx("span",{className:"subagent-friendly-message",children:S}),l.jsx($e,{variant:"outline","data-testid":"subagent-type-badge",className:"subagent-type-badge",children:n}),l.jsx("span",{className:"subagent-count",children:D})]}),!f&&l.jsx("div",{className:"subagent-content",children:i.map((T,R)=>k(T,R))})]})}const wx=/<!--\s*CYCLIST:(\w+)(?::([^>]+?))?\s*-->/gi,As={HANDOFF:"handoff",CONTEXT_CLEAR:"context_clear",INVOKE:"invoke",QUESTION:"question",CHOICES:"choices",CONTINUE:"continue"},wM=new Set(["handoff","context_clear","invoke","question","choices","continue"]);function SM(n){return n?n.replace(/```[\s\S]*?```/g,""):""}function CM(n){if(!n)return null;const e=SM(n);if(!e.trim())return null;const i=[];wx.lastIndex=0;let a;for(;(a=wx.exec(e))!==null;){const r=a[1].toLowerCase();wM.has(r)&&i.push({type:r,value:a[2]?.trim()??"",source:"structured_marker"})}return i.length>0?i:null}function _M(n,e){if(!n)return e.map(c=>({number:c,text:`Option ${c}`}));const i=n.replace(/```[\s\S]*?```/g,""),a=[/^\s*(\d+)\.\s+(.+)$/gm,/^\s*(\d+)\)\s+(.+)$/gm,/\*\*(\d+)[.)]\*\*\s*(.+)/gm],r=new Map;for(const c of a){c.lastIndex=0;let d;for(;(d=c.exec(i))!==null;){const h=parseInt(d[1],10);if(e.includes(h)&&!r.has(h)){let f=d[2].trim();const p=f.search(/\s+[-—]\s+/);p>0&&p<30&&(f=f.substring(0,p)),r.set(h,f)}}}return e.map(c=>({number:c,text:r.get(c)||`Option ${c}`}))}function EM(n,e){if(!n||n.length===0)return null;const i=n[0];switch(i.type){case As.HANDOFF:return{type:"handoff",value:i.value,responses:[i.value,"Not yet"]};case As.INVOKE:return{type:"invoke",value:i.value,autoExecute:!0};case As.QUESTION:{if(i.value==="yesno")return{type:"yesno",responses:["Yes","No"]};if(i.value?.startsWith("open")){const r=i.value.indexOf(":");if(r!==-1){const c=i.value.substring(r+1).trim();if(c)return{type:"open",responses:[c]}}return{type:"open"}}const a=n.find(r=>r.type===As.CHOICES);return a?Sx(a.value,e):null}case As.CHOICES:return Sx(i.value,e);case As.CONTEXT_CLEAR:return{type:"context_clear",value:i.value};case As.CONTINUE:return{type:"continue",responses:["Continue"]};default:return null}}function Sx(n,e){const i=n.split(",").map(d=>d.trim()),a=i[0],r=/^\d+$/.test(a);let c;if(r){const d=i.map(h=>parseInt(h,10));c=_M(e,d)}else c=i.map((d,h)=>({number:h+1,text:d}));return{type:"choices",choices:c,responses:c.map(d=>d.text)}}function DM(n){return m.useMemo(()=>{if(!n)return null;const e=CM(n);return e?EM(e,n):null},[n])}async function AM(){try{const n=await fetch("/api/settings");if(n.ok)return(await n.json())?.workflow?.relay_mode??!1}catch{}return!1}function NM(n){const{send:e}=dr(),i=m.useCallback(x=>{console.log("[QuickActions] sendMessage called:",x),e(x,[])},[e]),{onAction:a}=n,[r,c]=m.useState(!1),[d,h]=m.useState(!1),f="message"in n?n.message:void 0,p="actions"in n?n.actions:void 0,y=DM(f?.content);m.useEffect(()=>{c(!1)},[f?.timestamp]),m.useEffect(()=>{AM().then(h)},[]),m.useEffect(()=>{const x=()=>{c(!0)};return window.addEventListener("cyclist:user-submit",x),()=>{window.removeEventListener("cyclist:user-submit",x)}},[]),m.useEffect(()=>{if(y?.type==="handoff"&&d&&y.value){const x=setTimeout(()=>{i(y.value),c(!0),a?.(y.value)},100);return()=>clearTimeout(x)}if(y?.type==="invoke"&&y.value){const x=setTimeout(()=>{i(y.value),c(!0),a?.(y.value)},100);return()=>clearTimeout(x)}},[y,d,a]),m.useEffect(()=>{if(y?.type==="open"&&y.responses&&y.responses.length>0){const x=y.responses[0];window.dispatchEvent(new CustomEvent("cyclist:suggest-prompt",{detail:{prompt:x}}))}},[y]);const b=m.useCallback(x=>{console.log("[QuickActions] Button clicked:",x),c(!0),i(x),a?.(x)},[a]);return p&&p.length>0?l.jsx("div",{className:"quick-actions",children:l.jsx("div",{className:"quick-actions-buttons",children:p.map(x=>l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b(x.command),disabled:r,"aria-label":`${x.label}: ${x.command}`,children:x.label},x.command))})}):!y||y.type==="open"||y.type==="continue"?null:y.type==="invoke"?l.jsx("div",{className:"quick-actions",children:l.jsxs("span",{className:"auto-invoke-status",children:["Invoking ",y.value,"..."]})}):y.type==="handoff"&&d?l.jsx("div",{className:"quick-actions",children:l.jsxs("span",{className:"auto-invoke-status",children:["Handing off to ",y.value,"..."]})}):l.jsxs("div",{className:"quick-actions",children:[y.type==="handoff"&&y.responses&&l.jsx("div",{className:"quick-actions-buttons",children:y.responses.map(x=>l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b(x),disabled:r,"aria-label":`Continue with ${x}`,children:x},x))}),y.type==="yesno"&&l.jsxs("div",{className:"quick-actions-buttons",children:[l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b("Yes"),disabled:r,"aria-label":"Answer Yes",children:"Yes"}),l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b("No"),disabled:r,"aria-label":"Answer No",children:"No"})]}),y.type==="choices"&&y.choices&&l.jsx("div",{className:"quick-actions-buttons",children:y.choices.map(x=>l.jsx(Ce,{variant:"secondary",size:"sm",type:"button",className:"quick-action-btn",onClick:()=>b(x.text),disabled:r,"aria-label":`Choose option ${x.number}: ${x.text}`,children:x.text},x.number))})]})}var jM="Separator",Cx="horizontal",TM=["horizontal","vertical"],D0=m.forwardRef((n,e)=>{const{decorative:i,orientation:a=Cx,...r}=n,c=kM(a)?a:Cx,h=i?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return l.jsx(In.div,{"data-orientation":c,...h,...r,ref:e})});D0.displayName=jM;function kM(n){return TM.includes(n)}var A0=D0;const Rt=m.forwardRef(({className:n,orientation:e="horizontal",decorative:i=!0,...a},r)=>l.jsx(A0,{ref:r,decorative:i,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...a}));Rt.displayName=A0.displayName;const RM=["<command-message>","<command-name>","Base directory for this skill:","Launching skill:"],OM=[/^```bash\s*\npf agent start\b/,/^pf agent start\b/,/^<purpose>/,/^<when-to-use>/,/^<execution>/,/^<critical>\s*\n/],ql={sm:"Scrum Master",tea:"Test Engineer",dev:"Developer",reviewer:"Reviewer",architect:"Architect",pm:"Product Manager","tech-writer":"Tech Writer","ux-designer":"UX Designer",devops:"DevOps",orchestrator:"Orchestrator",ba:"Business Analyst"};function zM(n){if(!n||typeof n!="string")return!1;if(RM.some(i=>n.includes(i)))return!0;const e=n.trimStart();return OM.some(i=>i.test(e))}function MM(n){if(!n||typeof n!="string")return null;const e=n.match(/<command-name>\/?([^<]+)<\/command-name>/);if(e){const c=e[1].trim();return ql[c]||c}const i=n.match(/<command-message>([^<]+)<\/command-message>/);if(i){const c=i[1].trim();return ql[c]||c}const a=n.match(/pf agent start\s+"([^"]+)"/);if(a){const c=a[1].trim();return ql[c]||c}const r=n.match(/Launching skill:\s*(\S+)/);if(r){const c=r[1].trim();return ql[c]||c}return null}function _x(n){return n.length===0?"stack-empty":`stack-${n[0].tool_id}`}function PM(n){const e=[];let i=[];for(const a of n)if(a.type==="tool_use")i.push({type:"tool_use",tool_name:a.tool_name||"",tool_id:a.tool_id||"",input:a.input||{},timestamp:a.timestamp,isStreaming:a.isStreaming});else{if(a.type==="tool_result")continue;if(i.length>=1){const r=i[i.length-1];e.push({stackId:_x(i),tools:[...i],count:i.length,isActive:r.isStreaming===!0,timestamp:i[0].timestamp})}i=[]}if(i.length>=1){const a=i[i.length-1];e.push({stackId:_x(i),tools:[...i],count:i.length,isActive:a.isStreaming===!0,timestamp:i[0].timestamp})}return e}function Xh(){const n=document.documentElement.getAttribute("data-variant");return n==="light"||n==="dark"?n:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function N0(){const[n,e]=m.useState(Xh);return m.useEffect(()=>{const i=new MutationObserver(()=>{e(Xh())});i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-variant"]});const a=()=>e(Xh());return window.addEventListener("presetChange",a),()=>{i.disconnect(),window.removeEventListener("presetChange",a)}},[]),n}const Ex=2e3;function Om(){const[n,e]=m.useState(null),[i,a]=m.useState(null),[r,c]=m.useState(null),[d,h]=m.useState(!0),[f,p]=m.useState(null),y=m.useRef({context:!1,stats:!1,projectInfo:!1}),b=m.useCallback(()=>{const x=y.current;x.context&&x.stats&&x.projectInfo&&h(!1)},[]);return m.useEffect(()=>{let x=null,w=null,E=!0;const C=()=>{const S=window.location.protocol==="https:"?"wss:":"ws:";x=new WebSocket(`${S}//${window.location.host}/ws/context`),x.onopen=()=>{console.log("[useStatsStrip] Context WebSocket connected")},x.onmessage=D=>{try{const N=JSON.parse(D.data);if(N.type==="init"||N.type==="update"){const k=N.context;k&&e({percent:k.percent??0,used:k.tokens??void 0,total:k.available?(k.tokens??0)+k.available:void 0}),y.current.context||(y.current.context=!0,b())}}catch(N){console.error("[useStatsStrip] Failed to parse context message:",N)}},x.onclose=()=>{E&&(w=setTimeout(C,Ex))},x.onerror=D=>{console.error("[useStatsStrip] Context WebSocket error:",D),x?.close()}};return C(),()=>{E=!1,w&&clearTimeout(w),x?.close()}},[b]),m.useEffect(()=>{let x=null,w=null,E=!0;const C=()=>{const S=window.location.protocol==="https:"?"wss:":"ws:";x=new WebSocket(`${S}//${window.location.host}/ws/stats`),x.onopen=()=>{console.log("[useStatsStrip] Stats WebSocket connected")},x.onmessage=D=>{try{const N=JSON.parse(D.data);a({model:N.model??null}),N.pwd&&c(k=>({pwd:N.pwd,jiraEmail:k?.jiraEmail??null,githubUsername:k?.githubUsername??null})),y.current.stats||(y.current.stats=!0,b())}catch(N){console.error("[useStatsStrip] Failed to parse stats message:",N)}},x.onclose=()=>{E&&(w=setTimeout(C,Ex))},x.onerror=D=>{console.error("[useStatsStrip] Stats WebSocket error:",D),x?.close()}};return C(),()=>{E=!1,w&&clearTimeout(w),x?.close()}},[b]),m.useEffect(()=>{(async()=>{try{const w=await fetch("/api/identity");if(w.ok){const E=await w.json();c(C=>({pwd:C?.pwd??"",jiraEmail:E.jiraEmail??null,githubUsername:E.githubUsername??null}))}}catch(w){console.error("[useStatsStrip] Failed to fetch identity:",w),p(w instanceof Error?w:new Error("Failed to fetch identity"))}finally{y.current.projectInfo=!0,b()}})()},[b]),{context:n,stats:i,projectInfo:r,isLoading:d,error:f}}const LM={pm:"#a78bfa",sm:"#60a5fa",dev:"#4ade80",tea:"#2dd4bf",reviewer:"#f87171",architect:"#fb923c",devops:"#22d3ee","ux-designer":"#f0abfc","tech-writer":"#e5e5e5",orchestrator:"#e879f9",ba:"#a3e635"},IM={pm:"PM",sm:"SM",dev:"DEV",tea:"TEA",reviewer:"REV",architect:"ARC",devops:"OPS","ux-designer":"UX","tech-writer":"TW",orchestrator:"ORC",ba:"BA"};function Dx(n){return new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function GM(n){if("isToolStack"in n||"messages"in n)return"agent";const e=n;return e.type==="context_cleared"?"system":e.type==="user"||e.type==="bell_injected"?"user":"agent"}function BM({messages:n}){const e=m.useRef(null),[i,a]=m.useState(!0),{persona:r}=Zc(),c=N0(),{projectInfo:d}=Om(),h=m.useRef(new Map),f=m.useCallback(S=>{a(S)},[]),p=m.useCallback(()=>{e.current?.scrollToBottom("smooth")},[]),y=m.useMemo(()=>{for(let S=n.length-1;S>=0;S--)if(n[S].type==="agent"&&!n[S].isStreaming)return n[S];return null},[n]),{turns:b,toolResults:x,lastAgentItemIndex:w}=m.useMemo(()=>{const S=new Map;for(const B of n)B.type==="tool_result"&&B.tool_id&&S.set(B.tool_id,B);const D=[],N=new Map;let k=!1;for(const B of n)if(B.type!=="tool_result"){if(B.type==="user"&&zM(B.content)){const $=MM(B.content);$&&!k&&(k=!0,D.push({...B,content:$}));continue}if(B.type==="user"&&(k=!1),B.parent_id){let $=N.get(B.parent_id);$||($={parent_id:B.parent_id,type:B.subagent_type||"unknown",name:B.subagent_name||"unnamed",messages:[]},N.set(B.parent_id,$)),$.messages.push(B);continue}D.push(B)}const T=PM(D),R=new Map;for(const B of T)for(const $ of B.tools)R.set($.tool_id,B);const z=[],O=new Set,A=new Set;for(const B of D)if(B.type==="tool_use"&&B.tool_id&&R.has(B.tool_id)){const $=R.get(B.tool_id);O.has($.stackId)||(O.add($.stackId),z.push({isToolStack:!0,stack:$}))}else z.push(B);for(const[,B]of N)A.has(B.parent_id)||(A.add(B.parent_id),z.push(B));let G=-1;for(let B=z.length-1;B>=0;B--){const $=z[B];if(!("isToolStack"in $)&&!("messages"in $)&&$.type==="agent"){G=B;break}}const U=[];for(const B of z){const $=GM(B),ae=U[U.length-1];ae&&ae.speaker===$?ae.items.push(B):U.push({speaker:$,items:[B],timestamp:"timestamp"in B?B.timestamp:Date.now()})}return{turns:U,toolResults:S,lastAgentItemIndex:G}},[n]),E=(S,D,N)=>{if("isToolStack"in S)return l.jsx(pM,{stack:S.stack,toolResults:x},`stack-${S.stack.stackId}`);if("messages"in S&&"parent_id"in S){const T=S,R=h.current.get(T.parent_id)??!0;return l.jsx(xM,{type:T.type,name:T.name,messages:T.messages,defaultCollapsed:R,onCollapseChange:z=>h.current.set(T.parent_id,z)},`subagent-${T.parent_id}`)}const k=S;if(k.type==="tool_use"&&k.tool_name&&k.tool_id){if(k.tool_name==="AskUserQuestion")return null;const T=x.get(k.tool_id);return l.jsx(Rm,{toolUse:{type:"tool_use",tool_name:k.tool_name,tool_id:k.tool_id,input:k.input||{},timestamp:k.timestamp},result:T?{type:"tool_result",tool_id:T.tool_id,content:T.content||"",timestamp:T.timestamp,is_error:T.is_error,durationMs:T.durationMs}:void 0},`tool-${k.tool_id}`)}return l.jsx(C0,{message:k,isLastAgentMessage:D===w,isFirstInTurn:N},`msg-${D}-${k.timestamp}`)};if(n.length===0)return l.jsx("div",{"data-testid":"message-view",className:"message-view",children:l.jsx("div",{className:"message-view-empty",children:l.jsxs("div",{children:[l.jsx("img",{src:c==="dark"?"/images/cyclist-dark.png":"/images/cyclist-light.png",alt:"Cyclist",style:{height:"2.5rem",opacity:.6,display:"block",margin:"0 auto 0.5rem"}}),l.jsxs("div",{children:["Type ",l.jsx("code",{style:{background:"var(--bg-tertiary, #0f0f1a)",padding:"2px 6px",borderRadius:"3px",fontFamily:"var(--font-mono, monospace)"},children:"/sm"})," to start"]})]})})});let C=0;return l.jsxs("div",{"data-testid":"message-view",className:"message-view",role:"log","aria-live":"polite",children:[l.jsx(S0,{ref:e,onScrollChange:f,autoScroll:i,children:b.map((S,D)=>{if(S.speaker==="system")return S.items.forEach(()=>C++),l.jsx("div",{className:"turn-group turn-system",children:l.jsxs("div",{className:"context-cleared-bar",children:[l.jsx(Rt,{className:"context-cleared-line"}),l.jsx("span",{className:"context-cleared-label",children:"Context cleared"}),l.jsx("span",{className:"context-cleared-time",children:Dx(S.timestamp)}),l.jsx(Rt,{className:"context-cleared-line"})]})},`turn-${D}`);let N=!1;const k=r?.character||"Agent",T=r?.role||null,R=T?IM[T]||T:null,z=T?LM[T]||"#e879f9":void 0,O=d?.githubUsername||"You";return l.jsxs("div",{className:`turn-group turn-${S.speaker}`,children:[l.jsxs("div",{className:"turn-label",children:[l.jsx("span",{className:"turn-speaker",children:S.speaker==="user"?O:k}),S.speaker==="agent"&&R&&l.jsx($e,{variant:"default",className:"turn-role-badge",style:{backgroundColor:z},children:R}),l.jsx("span",{className:"turn-timestamp",children:Dx(S.timestamp)})]}),S.items.map(A=>{const G=C++,U=!("isToolStack"in A)&&!("messages"in A)&&A.type!=="tool_use",B=U&&!N;return U&&(N=!0),E(A,G,B)})]},`turn-${D}`)})}),y&&l.jsx(NM,{message:y}),l.jsx("div",{"data-testid":"auto-scroll-indicator","data-active":i.toString(),className:"auto-scroll-indicator",style:{display:"none"}}),l.jsx(Ce,{variant:"ghost",size:"icon","data-testid":"scroll-to-bottom-button",className:"scroll-to-bottom-button",onClick:p,style:{visibility:i?"hidden":"visible"},children:"↓"})]})}const Ax="cyclist-command-history",HM=100;function VM(){const[n,e]=m.useState(()=>{try{const p=localStorage.getItem(Ax);return p?JSON.parse(p):[]}catch{return[]}}),i=m.useRef(-1),a=m.useRef(""),r=m.useCallback(p=>{try{localStorage.setItem(Ax,JSON.stringify(p))}catch{}},[]),c=m.useCallback(p=>{p.trim()&&e(y=>{if(y.length>0&&y[y.length-1]===p)return y;const b=[...y,p];return b.length>HM&&b.shift(),r(b),b})},[r]),d=m.useCallback(p=>{if(n.length===0)return null;if(i.current===-1)a.current=p,i.current=n.length-1;else if(i.current>0)i.current--;else return null;return n[i.current]},[n]),h=m.useCallback(()=>{if(i.current===-1)return null;if(i.current++,i.current>=n.length){i.current=-1;const p=a.current;return a.current="",p}return n[i.current]},[n]),f=m.useCallback(()=>{i.current=-1,a.current=""},[]);return{addToHistory:c,navigateUp:d,navigateDown:h,resetNavigation:f}}const j0=[{name:"/add",description:"Add files to context"},{name:"/bug",description:"Report a bug"},{name:"/clear",description:"Clear conversation history"},{name:"/compact",description:"Toggle compact mode"},{name:"/config",description:"Show configuration"},{name:"/cost",description:"Show session cost"},{name:"/doctor",description:"Check system health"},{name:"/help",description:"Show available commands"},{name:"/init",description:"Initialize CLAUDE.md"},{name:"/login",description:"Authenticate with Anthropic"},{name:"/logout",description:"Clear authentication"},{name:"/memory",description:"Edit CLAUDE.md memory"},{name:"/model",description:"Switch Claude model"},{name:"/permissions",description:"View/edit permissions"},{name:"/pf-architect",description:"System Architect - Technical design and architecture"},{name:"/pf-ba",description:"Business Analyst - Requirements discovery and stakeholder analysis"},{name:"/pf-benchmark",description:"Compare an agent's performance against a stored baseline"},{name:"/pf-benchmark-control",description:"Create control baseline for a scenario (shortcut for /benchmark control <agent>)"},{name:"/pf-brainstorming",description:"Structured problem-solving brainstorm session"},{name:"/pf-check",description:"Run quality gates (lint, type check, tests) before handoff"},{name:"/pf-chore",description:"Quick commit for small changes without full git-cleanup ceremony"},{name:"/pf-ci",description:"Detect and run CI locally"},{name:"/pf-dev",description:"Developer - Feature implementation and coding"},{name:"/pf-devops",description:"DevOps Engineer - Infrastructure and deployment automation"},{name:"/pf-docs",description:"Domain documentation management"},{name:"/pf-epic",description:"Epic lifecycle - start epics for development and close completed epics"},{name:"/pf-fix-blocker",description:"Quick alias for /patch - fix blocking issue during story work"},{name:"/pf-git",description:"Repository operations - status, cleanup, branches, and release management"},{name:"/pf-health-check",description:"Check Pennyfarthing installation health and apply updates"},{name:"/pf-help",description:"Context-aware help for Pennyfarthing commands, agents, and workflows"},{name:"/pf-job-fair",description:"Discover which characters in a theme excel at each role"},{name:"/pf-orchestrator",description:"Orchestrator - Coordinator of all agents and meta operations"},{name:"/pf-party-mode",description:"Creative brainstorming and multi-agent discussion"},{name:"/pf-patch",description:"Interrupt-driven bug fix during active story work"},{name:"/pf-permissions",description:"View and manage runtime permission grants - list, grant, revoke, or show details"},{name:"/pf-pm",description:"Product Manager - Strategic planning and prioritization"},{name:"/pf-prime",description:"Load essential project context at agent activation"},{name:"/pf-retro",description:"Facilitate a sprint retrospective"},{name:"/pf-reviewer",description:"Code Reviewer - Critical code review and quality enforcement"},{name:"/pf-session",description:"Session lifecycle - start new work and resume checkpoints"},{name:"/pf-setup",description:"/setup - Interactive Project Setup"},{name:"/pf-sm",description:"Scrum Master - Story coordination and sprint management"},{name:"/pf-solo",description:"Run a single agent on a scenario with absolute rubric scoring"},{name:"/pf-sprint",description:"Sprint status, backlog, and story management - check status, find work, archive completed stories"},{name:"/pf-standalone",description:"Wrap current changes into a standalone Jira story, branch, PR, and merge"},{name:"/pf-tea",description:"Test Engineer/Architect - Test strategy and TDD"},{name:"/pf-tech-writer",description:"Technical Writer - Documentation creation and maintenance"},{name:"/pf-theme",description:"Manage persona themes - list, show, set, create, or interactive wizard"},{name:"/pf-ux-designer",description:"UX Designer - User experience design and UI patterns"},{name:"/pf-work",description:"Resume work or start new - smart entry point that picks up where you left off"},{name:"/pf-workflow",description:"List available workflows, show current workflow details, and switch workflows mid-session. Use when checking available workflow types (TDD, trivial, agent-docs), viewing current workflow phase, switching to a different workflow pattern, or managing BikeLane stepped workflows."},{name:"/pr-comments",description:"View PR comments"},{name:"/review",description:"Start code review"},{name:"/status",description:"Show session status"},{name:"/terminal-setup",description:"Configure terminal"},{name:"/vim",description:"Toggle vim mode"}].sort((n,e)=>n.name.localeCompare(e.name)),T0="cyclist:command-frequency";function k0(){if(typeof localStorage>"u")return{};try{const n=localStorage.getItem(T0);return n?JSON.parse(n):{}}catch{return{}}}function R0(n){if(typeof localStorage>"u")return;const e=k0();e[n]=(e[n]||0)+1,localStorage.setItem(T0,JSON.stringify(e))}function FM(n){const e=n.toLowerCase(),i=k0();return j0.filter(a=>a.name.toLowerCase().startsWith(e)).sort((a,r)=>{const c=i[a.name]||0,d=i[r.name]||0;return d!==c?d-c:a.name.localeCompare(r.name)})}function UM(n){const e=m.useMemo(()=>j0,[n]),[i,a]=m.useState({visible:!1,commands:[],selectedIndex:0,prefix:""}),r=m.useCallback(b=>FM(b),[e,n]),c=m.useCallback(b=>{const x=r(b);a({visible:!0,commands:x,selectedIndex:0,prefix:b})},[r]),d=m.useCallback(()=>{a({visible:!1,commands:[],selectedIndex:0,prefix:""})},[]),h=m.useCallback(b=>{const x=r(b);x.length===0?d():a(w=>({...w,commands:x,selectedIndex:0,prefix:b}))},[r,d]),f=m.useCallback(()=>{a(b=>{if(b.commands.length===0)return b;const x=b.selectedIndex<=0?b.commands.length-1:b.selectedIndex-1;return{...b,selectedIndex:x}})},[]),p=m.useCallback(()=>{a(b=>{if(b.commands.length===0)return b;const x=b.selectedIndex>=b.commands.length-1?0:b.selectedIndex+1;return{...b,selectedIndex:x}})},[]),y=m.useCallback(()=>{if(!i.visible||i.commands.length===0)return null;const b=i.commands[i.selectedIndex];return d(),b?.name&&R0(b.name),b?.name||null},[i,d]);return{state:i,showCompletion:c,hideCompletion:d,updateCompletion:h,navigateUp:f,navigateDown:p,selectCurrent:y,isVisible:i.visible}}function O0(n){const e=n+"CollectionProvider",[i,a]=cn(e),[r,c]=i(e,{collectionRef:{current:null},itemMap:new Map}),d=C=>{const{scope:S,children:D}=C,N=ue.useRef(null),k=ue.useRef(new Map).current;return l.jsx(r,{scope:S,itemMap:k,collectionRef:N,children:D})};d.displayName=e;const h=n+"CollectionSlot",f=Pa(h),p=ue.forwardRef((C,S)=>{const{scope:D,children:N}=C,k=c(h,D),T=Ie(S,k.collectionRef);return l.jsx(f,{ref:T,children:N})});p.displayName=h;const y=n+"CollectionItemSlot",b="data-radix-collection-item",x=Pa(y),w=ue.forwardRef((C,S)=>{const{scope:D,children:N,...k}=C,T=ue.useRef(null),R=Ie(S,T),z=c(y,D);return ue.useEffect(()=>(z.itemMap.set(T,{ref:T,...k}),()=>{z.itemMap.delete(T)})),l.jsx(x,{[b]:"",ref:R,children:N})});w.displayName=y;function E(C){const S=c(n+"CollectionConsumer",C);return ue.useCallback(()=>{const N=S.collectionRef.current;if(!N)return[];const k=Array.from(N.querySelectorAll(`[${b}]`));return Array.from(S.itemMap.values()).sort((z,O)=>k.indexOf(z.ref.current)-k.indexOf(O.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:d,Slot:p,ItemSlot:w},E,a]}var $M=m.createContext(void 0);function Kc(n){const e=m.useContext($M);return n||e||"ltr"}var Qh="rovingFocusGroup.onEntryFocus",WM={bubbles:!1,cancelable:!0},hr="RovingFocusGroup",[Nf,z0,qM]=O0(hr),[YM,M0]=cn(hr,[qM]),[XM,QM]=YM(hr),P0=m.forwardRef((n,e)=>l.jsx(Nf.Provider,{scope:n.__scopeRovingFocusGroup,children:l.jsx(Nf.Slot,{scope:n.__scopeRovingFocusGroup,children:l.jsx(ZM,{...n,ref:e})})}));P0.displayName=hr;var ZM=m.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:i,orientation:a,loop:r=!1,dir:c,currentTabStopId:d,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:f,onEntryFocus:p,preventScrollOnEntryFocus:y=!1,...b}=n,x=m.useRef(null),w=Ie(e,x),E=Kc(c),[C,S]=En({prop:d,defaultProp:h??null,onChange:f,caller:hr}),[D,N]=m.useState(!1),k=Gt(p),T=z0(i),R=m.useRef(!1),[z,O]=m.useState(0);return m.useEffect(()=>{const A=x.current;if(A)return A.addEventListener(Qh,k),()=>A.removeEventListener(Qh,k)},[k]),l.jsx(XM,{scope:i,orientation:a,dir:E,loop:r,currentTabStopId:C,onItemFocus:m.useCallback(A=>S(A),[S]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>O(A=>A+1),[]),onFocusableItemRemove:m.useCallback(()=>O(A=>A-1),[]),children:l.jsx(je.div,{tabIndex:D||z===0?-1:0,"data-orientation":a,...b,ref:w,style:{outline:"none",...n.style},onMouseDown:we(n.onMouseDown,()=>{R.current=!0}),onFocus:we(n.onFocus,A=>{const G=!R.current;if(A.target===A.currentTarget&&G&&!D){const U=new CustomEvent(Qh,WM);if(A.currentTarget.dispatchEvent(U),!U.defaultPrevented){const B=T().filter(M=>M.focusable),$=B.find(M=>M.active),ae=B.find(M=>M.id===C),W=[$,ae,...B].filter(Boolean).map(M=>M.ref.current);G0(W,y)}}R.current=!1}),onBlur:we(n.onBlur,()=>N(!1))})})}),L0="RovingFocusGroupItem",I0=m.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:i,focusable:a=!0,active:r=!1,tabStopId:c,children:d,...h}=n,f=Mt(),p=c||f,y=QM(L0,i),b=y.currentTabStopId===p,x=z0(i),{onFocusableItemAdd:w,onFocusableItemRemove:E,currentTabStopId:C}=y;return m.useEffect(()=>{if(a)return w(),()=>E()},[a,w,E]),l.jsx(Nf.ItemSlot,{scope:i,id:p,focusable:a,active:r,children:l.jsx(je.span,{tabIndex:b?0:-1,"data-orientation":y.orientation,...h,ref:e,onMouseDown:we(n.onMouseDown,S=>{a?y.onItemFocus(p):S.preventDefault()}),onFocus:we(n.onFocus,()=>y.onItemFocus(p)),onKeyDown:we(n.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){y.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const D=e2(S,y.orientation,y.dir);if(D!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let k=x().filter(T=>T.focusable).map(T=>T.ref.current);if(D==="last")k.reverse();else if(D==="prev"||D==="next"){D==="prev"&&k.reverse();const T=k.indexOf(S.currentTarget);k=y.loop?t2(k,T+1):k.slice(T+1)}setTimeout(()=>G0(k))}}),children:typeof d=="function"?d({isCurrentTabStop:b,hasTabStop:C!=null}):d})})});I0.displayName=L0;var KM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function JM(n,e){return e!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function e2(n,e,i){const a=JM(n.key,i);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return KM[a]}function G0(n,e=!1){const i=document.activeElement;for(const a of n)if(a===i||(a.focus({preventScroll:e}),document.activeElement!==i))return}function t2(n,e){return n.map((i,a)=>n[(e+a)%n.length])}var n2=P0,i2=I0,B0="Toggle",zm=m.forwardRef((n,e)=>{const{pressed:i,defaultPressed:a,onPressedChange:r,...c}=n,[d,h]=En({prop:i,onChange:r,defaultProp:a??!1,caller:B0});return l.jsx(je.button,{type:"button","aria-pressed":d,"data-state":d?"on":"off","data-disabled":n.disabled?"":void 0,...c,ref:e,onClick:we(n.onClick,()=>{n.disabled||h(!d)})})});zm.displayName=B0;var H0=zm,ss="ToggleGroup",[V0]=cn(ss,[M0]),F0=M0(),Mm=ue.forwardRef((n,e)=>{const{type:i,...a}=n;if(i==="single"){const r=a;return l.jsx(s2,{...r,ref:e})}if(i==="multiple"){const r=a;return l.jsx(a2,{...r,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${ss}\``)});Mm.displayName=ss;var[U0,$0]=V0(ss),s2=ue.forwardRef((n,e)=>{const{value:i,defaultValue:a,onValueChange:r=()=>{},...c}=n,[d,h]=En({prop:i,defaultProp:a??"",onChange:r,caller:ss});return l.jsx(U0,{scope:n.__scopeToggleGroup,type:"single",value:ue.useMemo(()=>d?[d]:[],[d]),onItemActivate:h,onItemDeactivate:ue.useCallback(()=>h(""),[h]),children:l.jsx(W0,{...c,ref:e})})}),a2=ue.forwardRef((n,e)=>{const{value:i,defaultValue:a,onValueChange:r=()=>{},...c}=n,[d,h]=En({prop:i,defaultProp:a??[],onChange:r,caller:ss}),f=ue.useCallback(y=>h((b=[])=>[...b,y]),[h]),p=ue.useCallback(y=>h((b=[])=>b.filter(x=>x!==y)),[h]);return l.jsx(U0,{scope:n.__scopeToggleGroup,type:"multiple",value:d,onItemActivate:f,onItemDeactivate:p,children:l.jsx(W0,{...c,ref:e})})});Mm.displayName=ss;var[o2,r2]=V0(ss),W0=ue.forwardRef((n,e)=>{const{__scopeToggleGroup:i,disabled:a=!1,rovingFocus:r=!0,orientation:c,dir:d,loop:h=!0,...f}=n,p=F0(i),y=Kc(d),b={role:"group",dir:y,...f};return l.jsx(o2,{scope:i,rovingFocus:r,disabled:a,children:r?l.jsx(n2,{asChild:!0,...p,orientation:c,dir:y,loop:h,children:l.jsx(je.div,{...b,ref:e})}):l.jsx(je.div,{...b,ref:e})})}),wc="ToggleGroupItem",q0=ue.forwardRef((n,e)=>{const i=$0(wc,n.__scopeToggleGroup),a=r2(wc,n.__scopeToggleGroup),r=F0(n.__scopeToggleGroup),c=i.value.includes(n.value),d=a.disabled||n.disabled,h={...n,pressed:c,disabled:d},f=ue.useRef(null);return a.rovingFocus?l.jsx(i2,{asChild:!0,...r,focusable:!d,active:c,ref:f,children:l.jsx(Nx,{...h,ref:e})}):l.jsx(Nx,{...h,ref:e})});q0.displayName=wc;var Nx=ue.forwardRef((n,e)=>{const{__scopeToggleGroup:i,value:a,...r}=n,c=$0(wc,i),d={role:"radio","aria-checked":n.pressed,"aria-pressed":void 0},h=c.type==="single"?d:void 0;return l.jsx(zm,{...h,...r,ref:e,onPressedChange:f=>{f?c.onItemActivate(a):c.onItemDeactivate(a)}})}),Y0=Mm,X0=q0;const Q0=Bf("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),l2=m.forwardRef(({className:n,variant:e,size:i,...a},r)=>l.jsx(H0,{ref:r,className:ye(Q0({variant:e,size:i,className:n})),...a}));l2.displayName=H0.displayName;const Z0=m.createContext({size:"default",variant:"default"}),K0=m.forwardRef(({className:n,variant:e,size:i,children:a,...r},c)=>l.jsx(Y0,{ref:c,className:ye("flex items-center justify-center gap-1",n),...r,children:l.jsx(Z0.Provider,{value:{variant:e,size:i},children:a})}));K0.displayName=Y0.displayName;const J0=m.forwardRef(({className:n,children:e,variant:i,size:a,...r},c)=>{const d=m.useContext(Z0);return l.jsx(X0,{ref:c,className:ye(Q0({variant:d.variant||i,size:d.size||a}),n),...r,children:e})});J0.displayName=X0.displayName;const jx=["plan","manual","accept"],Zh={plan:"Plan",manual:"Manual",accept:"Accept"},Tx={plan:"Read-only exploration mode",manual:"Ask for permission before actions",accept:"Auto-accept file edits"},c2={plan:"plan",manual:"default",accept:"acceptEdits"},u2={plan:"plan",default:"manual",acceptEdits:"accept"},kx={1:"plan",2:"manual",3:"accept"};function d2(n){m.useEffect(()=>{const e=i=>{(i.metaKey||i.ctrlKey)&&kx[i.key]&&(i.preventDefault(),n(kx[i.key]))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n])}function h2(){const[n,e]=m.useState("manual"),[i,a]=m.useState(!0),r=m.useRef(null);m.useEffect(()=>{const h=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/claude`,f=new WebSocket(h);r.current=f,f.onopen=()=>{f.send(JSON.stringify({type:"getMode"}))},f.onmessage=y=>{try{const b=JSON.parse(y.data);if(b.type==="mode"&&b.mode){const x=u2[b.mode]||"manual";e(x),a(!1),console.log("[ModeSwitch] Mode synced:",b.mode,"->",x)}}catch(b){console.error("[ModeSwitch] Failed to parse mode response:",b)}},f.onerror=()=>{a(!1)};const p=setTimeout(()=>{i&&a(!1)},2e3);return()=>{clearTimeout(p),f.readyState===WebSocket.OPEN&&f.close(),r.current=null}},[]);const c=m.useCallback(d=>{const h=c2[d];r.current&&r.current.readyState===WebSocket.OPEN?(r.current.send(JSON.stringify({type:"setMode",mode:h})),e(d),console.log("[ModeSwitch] Mode set to:",d,"->",h)):(e(d),console.warn("[ModeSwitch] WebSocket not connected, mode set locally only"))},[]);return{mode:n,setMode:c,isLoading:i}}function f2({mode:n,defaultMode:e="manual",onModeChange:i,className:a="",disabled:r=!1}){const[c,d]=m.useState(e),[h,f]=m.useState(!1),p=n??c;m.useEffect(()=>{const w=window.matchMedia("(prefers-reduced-motion: reduce)");f(w.matches);const E=C=>{f(C.matches)};return w.addEventListener("change",E),()=>w.removeEventListener("change",E)},[]);const y=jx.indexOf(p),b=m.useCallback(w=>{r||(n||d(w),i?.(w))},[n,r,i]),x=m.useCallback(w=>{w&&b(w)},[b]);return l.jsxs("div",{className:ye("mode-switch",r&&"mode-switch--disabled",h&&"reduced-motion",a),"data-testid":"mode-switch",style:h?{transition:"none"}:void 0,children:[l.jsx("div",{className:"mode-switch__highlight","data-testid":"mode-highlight",style:{transform:`translateX(${y*100}%)`,transition:h?"none":void 0},"data-mode":p}),l.jsx(St,{delayDuration:400,children:l.jsx(K0,{type:"single",value:p,onValueChange:x,disabled:r,className:"relative z-[1] gap-0","aria-label":"Permission mode",children:jx.map(w=>{const E=p===w;return l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(J0,{value:w,"data-mode":w,"data-testid":`mode-${w}`,"aria-label":`${Zh[w]} mode: ${Tx[w]}`,className:ye("mode-option",E&&"active"),children:Zh[w]})}),l.jsx(Te,{side:"bottom",children:Tx[w]})]},w)})})}),l.jsx("div",{className:"visually-hidden",role:"status","aria-live":"polite",children:`${Zh[p]} mode selected`})]})}const Yl=["image/png","image/jpeg","image/gif","image/webp"],m2=20*1024*1024;function p2({commands:n,selectedIndex:e,visible:i,onSelect:a}){return!i||n.length===0?null:l.jsx("div",{className:"completion-popup","data-testid":"completion-popup",children:n.map((r,c)=>l.jsxs("div",{className:`completion-item ${c===e?"selected":""}`,onClick:()=>a(c),"data-testid":`completion-item-${c}`,children:[l.jsx("span",{className:"completion-name",children:r.name}),l.jsx("span",{className:"completion-desc",children:r.description})]},r.name))})}function g2(n){return n?n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):""}function v2({queue:n,bellMode:e,onRemove:i,onClear:a,onInject:r}){return n.length===0?null:l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"queue-display","data-testid":"queue-display",children:[l.jsxs("div",{className:"queue-header",children:[l.jsxs("span",{className:"queue-count",children:[n.length," queued"]}),e&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"secondary",className:"queue-mode-badge bell-mode",children:"🔔"})}),l.jsx(Te,{children:"Bell mode active - messages inject via hook"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"sm",type:"button",className:"queue-clear-btn",onClick:a,children:"Clear"})}),l.jsx(Te,{children:"Clear all queued messages"})]})]}),l.jsx("ul",{className:"queue-list",children:n.map((c,d)=>{const h=c.text.length>60?c.text.substring(0,60)+"...":c.text,f=c.images&&c.images.length>0;return l.jsxs("li",{className:"queue-item","data-testid":`queue-item-${d}`,children:[l.jsx("span",{className:"queue-item-text",children:g2(h)}),f&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs($e,{variant:"outline",className:"queue-image-indicator",children:["📎",c.images.length]})}),l.jsx(Te,{children:`${c.images.length} image(s) attached`})]}),l.jsxs("div",{className:"queue-item-actions",children:[r&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:"queue-item-inject",onClick:()=>r(d),children:"▶"})}),l.jsx(Te,{children:"Send now (abort current and send this message)"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:"queue-item-remove",onClick:()=>i(d),children:"×"})}),l.jsx(Te,{children:"Remove from queue"})]})]})]},d)})})]})})}function y2({images:n,onRemove:e}){return n.length===0?null:l.jsx(St,{delayDuration:300,children:l.jsx("div",{className:"image-preview","data-testid":"image-preview",children:n.map((i,a)=>l.jsxs("div",{className:"image-preview-item",children:[l.jsx("img",{src:i.dataUrl,alt:i.filename}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:"image-remove",onClick:()=>e(a),children:"X"})}),l.jsx(Te,{children:"Remove image"})]})]},a))})})}function b2({onSubmit:n,isProcessing:e=!1,placeholder:i,onInject:a}){const r=m.useRef(null),[c,d]=m.useState(""),[h,f]=m.useState([]),{mode:p,setMode:y}=h2();d2(y);const{addToHistory:b,navigateUp:x,navigateDown:w,resetNavigation:E}=VM(),{state:C,showCompletion:S,hideCompletion:D,updateCompletion:N,navigateUp:k,navigateDown:T,selectCurrent:R,isVisible:z}=UM(),{queue:O,queueCount:A,bellMode:G,queueMessage:U,removeFromQueue:B,clearQueue:$,setProcessing:ae,resumeQueue:ne}=g0();m.useEffect(()=>{ae(e)},[e,ae]),m.useEffect(()=>{const V=Y=>{d(Y.detail.prompt),r.current?.focus()};return window.addEventListener("cyclist:suggest-prompt",V),()=>{window.removeEventListener("cyclist:suggest-prompt",V)}},[]);const W=m.useCallback(async V=>{let Y=null;if(V.items){for(const le of V.items)if(le.type&&Yl.includes(le.type)){Y=le.getAsFile();break}}if(!Y&&V.files?.length>0){for(const le of V.files)if(le.type&&Yl.includes(le.type)){Y=le;break}}return Y?Y.size>m2?(console.warn("Image too large:",Y.size),!1):new Promise(le=>{const X=new FileReader;X.onload=()=>{const ce=X.result,de=Y.name||`Pasted Image.${Y.type.split("/")[1]||"png"}`;f(De=>[...De,{dataUrl:ce,mimeType:Y.type,filename:de}]),le(!0)},X.onerror=()=>le(!1),X.readAsDataURL(Y)}):!1},[]),M=m.useCallback(V=>{f(Y=>Y.filter((le,X)=>X!==V))},[]),K=m.useCallback(()=>{if(!r.current)return null;const V=r.current.selectionStart,Y=c;let le=V;for(;le>0&&Y[le-1]!==" "&&Y[le-1]!==`
64
+ `;)le--;const X=Y.substring(le,V);return X.startsWith("/")?{prefix:X,start:le,end:V}:null},[c]),q=m.useCallback(V=>{const Y=K();if(!Y){d(ce=>ce+V);return}const{start:le,end:X}=Y;d(ce=>ce.substring(0,le)+V+ce.substring(X)),setTimeout(()=>{if(r.current){const ce=le+V.length;r.current.selectionStart=r.current.selectionEnd=ce}},0)},[K]),he=m.useCallback(()=>{const V=c.trim();if(!(!V&&h.length===0)){if(e){U({text:V,images:[...h]})&&(d(""),f([]),r.current?.focus());return}if(b(V),E(),V.startsWith("/")){const Y=V.split(/\s/)[0];R0(Y)}ne(),window.dispatchEvent(new CustomEvent("cyclist:user-submit")),n(V,h),d(""),f([]),r.current?.focus()}},[c,h,e,U,b,E,ne,n]),Se=m.useCallback(V=>{if(V.key==="Tab"&&!V.shiftKey&&!V.ctrlKey&&!V.altKey){if(z){V.preventDefault();const le=R();le&&q(le);return}const Y=K();if(Y){V.preventDefault(),S(Y.prefix);return}}if(V.key==="Escape"&&z){V.preventDefault(),D();return}if(V.key==="Enter"&&!V.shiftKey){if(z){V.preventDefault();const Y=R();Y&&q(Y);return}V.preventDefault(),he();return}if(V.key==="ArrowUp"&&!V.shiftKey&&!V.ctrlKey&&!V.altKey){if(z){V.preventDefault(),k();return}if(r.current?.selectionStart===0){const Y=x(c);if(Y!==null){V.preventDefault(),d(Y);return}}}if(V.key==="ArrowDown"&&!V.shiftKey&&!V.ctrlKey&&!V.altKey){if(z){V.preventDefault(),T();return}if(r.current?.selectionEnd===c.length){const Y=w();if(Y!==null){V.preventDefault(),d(Y);return}}}},[z,R,q,K,S,D,he,k,T,x,w,c]),I=m.useCallback(V=>{const Y=V.target.value;if(d(Y),Y==="/"&&!z){S("/");return}if(z){const le=K();le?N(le.prefix):D()}},[z,S,K,N,D]),L=m.useCallback(async V=>{const Y=V.clipboardData;if(!Y)return;let le=!1;if(Y.items){for(const X of Y.items)if(X.type&&Yl.includes(X.type)){le=!0;break}}if(!le&&Y.files?.length>0){for(const X of Y.files)if(X.type&&Yl.includes(X.type)){le=!0;break}}le&&(V.preventDefault(),await W(Y))},[W]),ee=m.useCallback(V=>{const Y=C.commands[V];Y&&(q(Y.name),D())},[C.commands,q,D]);return l.jsxs("div",{className:"editor-container","data-testid":"editor-container",children:[l.jsx(f2,{mode:p,onModeChange:y,className:"editor-mode-switch"}),l.jsxs("div",{className:"editor-wrapper",id:"editor-wrapper",children:[l.jsx(y2,{images:h,onRemove:M}),l.jsx("textarea",{ref:r,id:"editor-textarea",className:"editor-textarea",value:c,onChange:I,onKeyDown:Se,onPaste:L,placeholder:i,spellCheck:!1,autoFocus:!0,"data-testid":"editor-textarea"}),l.jsx(p2,{commands:C.commands,selectedIndex:C.selectedIndex,visible:z,onSelect:ee})]}),l.jsx(v2,{queue:O,bellMode:G,onRemove:B,onClear:$,onInject:a})]})}function x2(){const[n,e]=m.useState(null),i=m.useCallback(c=>d=>{e(c)},[]),a=m.useCallback(()=>{e(null)},[]),r=m.useCallback(c=>n===c,[n]);return{handleFocus:i,handleBlur:a,isFocused:r}}function w2({currentAgent:n,onAgentSwitch:e}){const[i,a]=m.useState(!1),[r,c]=m.useState([]),d=m.useRef(null);m.useEffect(()=>{fetch("/api/theme-agents/full").then(f=>f.ok?f.json():null).then(f=>{f?.agents&&c(f.agents)}).catch(()=>{})},[]),m.useEffect(()=>{if(!i)return;const f=p=>{d.current&&!d.current.contains(p.target)&&a(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]),m.useEffect(()=>{if(!i)return;const f=p=>{p.key==="Escape"&&(p.stopPropagation(),a(!1))};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[i]);const h=m.useCallback(f=>{f.role!==n&&(e?.(f.role),a(!1))},[n,e]);return l.jsxs("div",{className:"agent-quick-picker-wrapper",ref:d,children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:`btn-toggle agent-picker-toggle ${i?"active":""}`,"data-testid":"agent-quick-picker",onClick:()=>a(f=>!f),"aria-label":"Switch agent","aria-expanded":i,"aria-haspopup":"listbox",children:l.jsx(lz,{className:"h-4 w-4"})})}),l.jsx(Te,{children:"Switch Agent"})]}),i&&l.jsx("div",{className:"agent-quick-picker-dropdown","data-testid":"agent-quick-picker-dropdown",role:"listbox","aria-label":"Available agents",children:r.map(f=>{const p=f.role===n;return l.jsx("div",{className:`agent-quick-picker-option ${p?"current":""}`,"data-testid":`agent-option-${f.role}`,role:"option","aria-selected":p,"aria-label":`${f.role} (${f.character})`,title:f.character,onClick:()=>h(f),children:l.jsx("span",{className:"agent-option-role",children:f.role})},f.role)})})]})}function S2({isRunning:n,isStopping:e=!1,onStop:i,onForceStop:a,onReset:r,bellMode:c=!1,relayMode:d=!1,onBellModeChange:h,onRelayModeChange:f,contextPercent:p=0,currentAgent:y=null,onTirePump:b,onAgentSwitch:x}){const w=m.useRef(0),E=500,{handleFocus:C,handleBlur:S,isFocused:D}=x2(),N=m.useCallback(k=>{if(k.key!=="Escape"&&k.keyCode!==27||!n)return;const T=Date.now();T-w.current<E&&a?a():i(),w.current=T},[n,i,a]);return m.useEffect(()=>(document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N)}),[N]),l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"control-bar","data-testid":"control-bar",children:[l.jsxs("div",{className:"control-bar-toggles",children:[l.jsx(w2,{currentAgent:y,onAgentSwitch:x}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:`btn-toggle bell-toggle ${c?"active":""}`,"data-testid":"bell-mode-toggle",onClick:()=>h?.(!c),"aria-pressed":c,"aria-label":"Bell mode - inject queued messages via hook",children:l.jsx(VO,{className:"h-4 w-4"})})}),l.jsx(Te,{children:"Bell Mode: Inject queued messages during tool use (Cmd+B)"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:`btn-toggle relay-toggle ${d?"active":""}`,"data-testid":"relay-toggle",onClick:()=>f?.(!d),"aria-pressed":d,"aria-label":"Relay mode - auto-handoff to next agent",children:l.jsx(hz,{className:"h-4 w-4"})})}),l.jsx(Te,{children:"Relay Mode: Auto-handoff to next agent (Cmd+4)"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"icon",type:"button",className:`btn-toggle pump-toggle ${p>=70?"warning":""}`,"data-testid":"pump-toggle",onClick:b,disabled:!y,"aria-label":"TirePump: Clear context and reload agent",children:l.jsx(nz,{className:"h-4 w-4"})})}),l.jsx(Te,{children:y?`TirePump: Clear context (${p}%) and reload ${y}`:"TirePump: No agent loaded"})]})]}),l.jsxs(Ce,{variant:"destructive",type:"button",className:`btn-stop danger ${e?"stopping":""} ${n&&!e?"throbbing":""} ${D("stop")?"focused focus-visible":""}`,"data-testid":"stop-button",onClick:i,disabled:!n||e,"aria-busy":e,"aria-label":"Stop Claude",onFocus:C("stop"),onBlur:S,children:[l.jsx("span",{"data-icon":"stop",className:"icon"}),e?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"spinner","data-loading":!0}),"Stopping..."]}):"Stop"]}),l.jsx(Ce,{variant:"outline",type:"button",className:`btn-reset ${D("reset")?"focused focus-visible":""}`,"data-testid":"reset-button",onClick:r,"aria-label":"Reset session",onFocus:C("reset"),onBlur:S,children:"Reset"})]})})}function C2(){const[n,e]=m.useState(!1),[i,a]=m.useState(!1),[r,c]=m.useState(!1),[d,h]=m.useState(!1),[f,p]=m.useState(0),[y,b]=m.useState(null),{abort:x,clear:w,clearAndReload:E,send:C,onMessage:S,onComplete:D,onError:N,isConnected:k}=dr();m.useEffect(()=>{function B(W){const M=W?.workflow,K=!!M?.bell_mode,q=!!M?.relay_mode;console.log("[ControlBar] Settings updated:",{bellMode:K,relayMode:q}),c(K),h(q)}async function $(){try{console.log("[ControlBar] Loading settings via REST");const W=await fetch("/api/settings");if(W.ok){const M=await W.json();B(M)}}catch(W){console.error("[ControlBar] Failed to load settings:",W)}}console.log("[ControlBar] useEffect mount - loading settings"),$(),console.log("[ControlBar] Connecting to /ws/settings for real-time sync");const ae=window.location.protocol==="https:"?"wss:":"ws:",ne=new WebSocket(`${ae}//${window.location.host}/ws/settings`);return ne.onmessage=W=>{try{const M=JSON.parse(W.data);(M.type==="init"||M.type==="update")&&B(M.settings)}catch(M){console.error("[ControlBar] Failed to parse WebSocket message:",M)}},ne.onerror=W=>{console.error("[ControlBar] WebSocket error:",W)},()=>{ne.close()}},[]),m.useEffect(()=>{const B=window.location.protocol==="https:"?"wss:":"ws:",$=new WebSocket(`${B}//${window.location.host}/ws/context`);return $.onmessage=ae=>{try{const ne=JSON.parse(ae.data);if(ne.type==="init"||ne.type==="update"){const W=ne.context?.percent??0;p(W)}}catch(ne){console.error("[ControlBar] Failed to parse context message:",ne)}},()=>{$.close()}},[]),m.useEffect(()=>{const B=window.location.protocol==="https:"?"wss:":"ws:",$=new WebSocket(`${B}//${window.location.host}/ws/persona`);return $.onmessage=ae=>{try{const ne=JSON.parse(ae.data);b(ne?.slug??null)}catch(ne){console.error("[ControlBar] Failed to parse persona message:",ne)}},()=>{$.close()}},[]),m.useEffect(()=>{if(!k)return;const B=()=>{e(!0),a(!1)},$=()=>{e(!1),a(!1)},ae=()=>{e(!1),a(!1)},ne=S(B),W=D($),M=N(ae);return()=>{ne(),W(),M()}},[k,S,D,N]);const T=m.useCallback(()=>{a(!0);try{x()}catch(B){console.error("[ControlBar] Stop failed:",B)}},[x]),R=m.useCallback(()=>{a(!0);try{x()}catch(B){console.error("[ControlBar] Force stop failed:",B)}},[x]),z=m.useCallback(()=>{try{w(),e(!1),a(!1)}catch(B){console.error("[ControlBar] Reset failed:",B)}},[w]),O=m.useCallback(async B=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflow:{bell_mode:B}})}),c(B),console.log("[ControlBar] Bell mode set to:",B)}catch($){console.error("[ControlBar] Failed to toggle bell mode:",$)}},[]),A=m.useCallback(async B=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflow:{relay_mode:B}})}),h(B),console.log("[ControlBar] Relay mode set to:",B)}catch($){console.error("[ControlBar] Failed to toggle relay mode:",$)}},[]),G=m.useCallback(()=>{if(!y){console.warn("[ControlBar] Cannot TirePump: no current agent");return}try{console.log("[ControlBar] TirePump: clearing context and reloading agent:",y),E(y),e(!1),a(!1),p(0)}catch(B){console.error("[ControlBar] TirePump failed:",B)}},[y,E]),U=m.useCallback(B=>{C(`/${B}`)},[C]);return{isRunning:n,isStopping:i,bellMode:r,relayMode:d,contextPercent:f,currentAgent:y,handleStop:T,handleForceStop:R,handleReset:z,handleBellModeChange:O,handleRelayModeChange:A,handleTirePump:G,handleAgentSwitch:U}}function fe({className:n,...e}){return l.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",n),...e})}const Rx={pm:"#a78bfa",sm:"#60a5fa",dev:"#4ade80",tea:"#2dd4bf",reviewer:"#f87171",architect:"#fb923c",devops:"#22d3ee","ux-designer":"#f0abfc","tech-writer":"#e5e5e5",orchestrator:"#e879f9",ba:"#a3e635"};function _2({isOpen:n,onClose:e,currentRole:i,currentTheme:a}){const[r,c]=m.useState(null),[d,h]=m.useState(null),[f,p]=m.useState(!1),[y,b]=m.useState(!1),x=m.useRef(),{send:w}=dr();m.useEffect(()=>{n&&(p(!0),fetch("/api/theme-agents/full").then(N=>N.ok?N.json():null).then(N=>{c(N),h(null),p(!1)}).catch(()=>p(!1)))},[n]),m.useEffect(()=>{b(!1)},[d]),m.useEffect(()=>{if(!n)return;const N=k=>{k.key==="Escape"&&e()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[n,e]);const E=m.useCallback(N=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{h(N)},100)},[]),C=m.useCallback(()=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{h(null)},200)},[]),S=m.useCallback(N=>{if(N.role===i)return;const k=`/${N.role}`;w(k),e()},[i,w,e]);if(!n)return null;const D=d||r?.agents.find(N=>N.role===i)||r?.agents[0];return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"agent-popup-backdrop",onClick:e,"aria-hidden":"true"}),l.jsx("div",{className:"agent-popup",role:"dialog","aria-modal":"true","aria-labelledby":"agent-popup-title",children:f?l.jsxs("div",{className:"agent-popup-loading p-4 space-y-3",children:[l.jsx(fe,{className:"h-6 w-40"}),l.jsx(Rt,{}),l.jsxs("div",{className:"flex gap-4",children:[l.jsxs("div",{className:"space-y-2 flex-shrink-0",style:{width:160},children:[l.jsx(fe,{className:"h-5 w-12"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-8 w-full"})]}),l.jsxs("div",{className:"space-y-3 flex-1",children:[l.jsx(fe,{className:"h-24 w-24 rounded-full mx-auto"}),l.jsx(fe,{className:"h-5 w-32 mx-auto"}),l.jsx(fe,{className:"h-4 w-full"}),l.jsx(fe,{className:"h-4 w-3/4"})]})]})]}):r?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"agent-popup-header",children:[l.jsxs("h2",{id:"agent-popup-title",className:"agent-popup-theme",children:[r.themeName,l.jsx($e,{variant:"secondary",className:`tier-badge ${r.tier?`tier-${r.tier.toLowerCase()}`:"tier-unranked"}`,children:r.tier||"Unranked"})]}),l.jsx(Ce,{variant:"ghost",size:"icon",className:"agent-popup-close",onClick:e,"aria-label":"Close popup",children:"×"})]}),l.jsx(Rt,{className:"my-1"}),l.jsxs("div",{className:"agent-popup-content",children:[l.jsxs("div",{className:"agent-popup-roster",children:[l.jsx("h3",{className:"roster-title",children:"Team"}),l.jsx("ul",{className:"roster-list",role:"listbox",children:r.agents.map(N=>{const k=N.role===i,T=d?.role===N.role,R=Rx[N.role]||"#888";return l.jsxs("li",{className:`roster-item ${k?"current":""} ${T?"previewing":""}`,role:"option","aria-selected":k,onMouseEnter:()=>E(N),onMouseLeave:C,onClick:()=>S(N),children:[l.jsx("span",{className:"roster-character",children:N.character}),l.jsx("span",{className:"roster-role",style:{backgroundColor:R},children:N.role}),k&&l.jsx("span",{className:"roster-current-marker",children:"●"})]},N.role)})})]}),l.jsx("div",{className:"agent-popup-details","data-testid":"agent-popup-details",children:D&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"popup-portrait","data-testid":"popup-portrait",children:!y&&a?l.jsx("img",{src:`/portraits/${a}/large/${D.slug}.png`,alt:D.character,onError:()=>b(!0)}):l.jsx("div",{className:"portrait-placeholder",children:"🤖"})}),l.jsx("h3",{className:"popup-character",children:D.character}),l.jsxs("div",{className:"popup-role-mapping",children:[l.jsx($e,{variant:"default",className:"role-badge",style:{backgroundColor:Rx[D.role]||"#888"},children:D.role}),"→ ",D.character]}),l.jsxs("div",{className:"popup-detail","data-testid":"popup-detail-style",children:[l.jsx("label",{children:"Style:"}),l.jsx("span",{children:D.style||"—"})]}),l.jsxs("div",{className:"popup-detail","data-testid":"popup-detail-background",children:[l.jsx("label",{children:"Background:"}),l.jsx("span",{children:D.background||"—"})]}),D.quirks.length>0&&l.jsxs("div",{className:"popup-detail","data-testid":"popup-detail-quirks",children:[l.jsx("label",{children:"Quirks:"}),l.jsx("span",{children:D.quirks.join(", ")})]}),D.lift!==void 0&&l.jsxs("div",{className:"popup-detail",children:[l.jsx("label",{children:"Lift:"}),l.jsxs("span",{className:`lift-value ${D.lift>=0?"positive":"negative"}`,children:[D.lift>=0?"+":"",D.lift.toFixed(1)]})]})]})})]})]}):l.jsx("div",{className:"agent-popup-error",children:"Failed to load theme data"})})]})}const E2={pm:"PM",sm:"SM",dev:"DEV",tea:"TEA",reviewer:"REV",architect:"ARC",devops:"OPS","ux-designer":"UX","tech-writer":"TW",orchestrator:"ORC",ba:"BA"};function D2({character:n,role:e,slug:i,theme:a,isActive:r,isThinking:c}){const[d,h]=m.useState(!1);if(!r)return null;const f=E2[e]||e.toUpperCase();return l.jsxs("div",{className:`persona-tandem-portrait${c?" avatar-tandem-thinking":""}`,"data-testid":"tandem-portrait",role:"img","aria-label":`${n} (${e}) - observing`,tabIndex:-1,children:[d?l.jsx("span",{className:"tandem-portrait-fallback","aria-hidden":"true",children:"🤖"}):l.jsx("img",{src:`/portraits/${a}/medium/${i}.png`,alt:"","aria-hidden":"true",className:"tandem-portrait-image",onError:()=>h(!0)}),l.jsx("span",{className:"tandem-role-badge","data-testid":"tandem-role-badge","aria-hidden":"true",children:f})]})}const A2={pm:"#a78bfa",sm:"#60a5fa",dev:"#4ade80",tea:"#2dd4bf",reviewer:"#f87171",architect:"#fb923c",devops:"#22d3ee","ux-designer":"#f0abfc","tech-writer":"#e5e5e5",orchestrator:"#e879f9",ba:"#a3e635"},N2={pm:"PM",sm:"SM",dev:"DEV",tea:"TEA",reviewer:"REV",architect:"ARC",devops:"OPS","ux-designer":"UX","tech-writer":"TW",orchestrator:"ORC",ba:"BA"};function j2(n){return n.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function eC(){const{persona:n,isStreaming:e}=Zc(),i=N0(),[a,r]=m.useState(!1),[c,d]=m.useState(!1),[h,f]=m.useState(!1),p=n?.character||"Agent",y=n?.theme||"default",b=n?.role||"agent",x=n?.slug,w=n?.quote,E=n?.tandemAgent,[C,S]=m.useState(!1),D=m.useRef(!1),N=m.useRef(null);m.useEffect(()=>{const O=D.current,A=E?.isThinking??!1;D.current=A,!O&&A&&S(!0)},[E?.isThinking]);const k=m.useCallback(()=>{S(!1)},[]),T=m.useCallback(()=>{d(!0)},[]),R=m.useCallback(()=>{d(!1)},[]),z=A2[b]||"#e879f9";return n?.character?l.jsxs(l.Fragment,{children:[l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:`persona-header clickable${h?" compact":""}`,"data-testid":"persona-header",role:"button",tabIndex:0,"aria-label":"Current agent persona - click to view team","aria-live":"polite",onClick:T,onKeyDown:O=>O.key==="Enter"&&T(),children:[l.jsxs("div",{className:"persona-portrait-group",children:[l.jsx("div",{className:`persona-portrait${e?" avatar-thinking":""}${C?" avatar-observation-pulse":""}`,"data-testid":"persona-portrait",ref:N,onAnimationEnd:k,children:x&&y&&!a?l.jsx("img",{src:`/portraits/${y}/medium/${x}.png`,alt:p,className:"portrait-image",onError:()=>r(!0)}):l.jsx("span",{className:"portrait-fallback",children:"🤖"})}),E&&l.jsx(D2,{character:E.character,role:E.role,slug:E.slug,theme:E.theme,isActive:!0,isThinking:E.isThinking}),E&&l.jsx("span",{className:"visually-hidden",role:"status","aria-live":"polite","data-testid":"tandem-sr-status",children:E.isThinking?`${E.character} is thinking`:`${E.character} observing`})]}),l.jsxs("div",{className:"persona-info",children:[l.jsxs("div",{className:"persona-name-row",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"default",className:"persona-role","data-testid":"persona-role",style:{backgroundColor:z},children:N2[b]||b})}),l.jsx(Te,{children:b})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"persona-character","data-testid":"persona-character",children:p})}),l.jsx(Te,{children:p})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"persona-theme","data-testid":"persona-theme",children:j2(y)})}),l.jsx(Te,{children:`Theme: ${y}`})]})]}),w&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"persona-catchphrase","data-testid":"persona-catchphrase",children:['"',w,'"']})}),l.jsx(Te,{children:w})]})]}),l.jsx("img",{src:E?`/portraits/${y}/medium/cyclist-tandem.png`:i==="dark"?"/images/cyclist-dark.png":"/images/cyclist-light.png",alt:"Cyclist",className:"persona-branding"}),l.jsx("button",{className:"persona-collapse-toggle",onClick:O=>{O.stopPropagation(),f(!h)},"aria-label":h?"Expand header":"Collapse header",children:h?"▼":"▲"})]})}),l.jsx(_2,{isOpen:c,onClose:R,currentRole:b,currentTheme:y})]}):l.jsx("div",{className:"persona-header empty","data-testid":"persona-header"})}function T2(n){if(!n)return"—";const e=n.toLowerCase();if(e.includes("opus"))return"opus";if(e.includes("sonnet"))return"sonnet";if(e.includes("haiku"))return"haiku";const i=n.split("-");if(i.length>=2){for(let a=i.length-2;a>=0;a--)if(!/^\d{8}$/.test(i[a]))return i[a]}return n}function k2(n){return n>=85?"level-danger":n>=70?"level-warning":"level-safe"}function R2(n){if(!n)return"";const e=n.split("/");return e[e.length-1]||e[e.length-2]||n}function O2(){const{context:n,stats:e,projectInfo:i}=Om(),a=n?.percent??0,r=e?.model??null,c=i?.pwd??"",d=i?.jiraEmail??null,h=i?.githubUsername??null,f=k2(a),p=R2(c);return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"stats-strip","data-testid":"stats-strip",children:[l.jsxs("div",{className:"stats-left","data-testid":"stats-left",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"stats-pwd","data-testid":"stats-pwd","data-full-path":c,children:p})}),l.jsx(Te,{children:c})]}),d&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"stats-jira-email","data-testid":"jira-email",children:d})}),l.jsx(Te,{children:`Jira: ${d}`})]}),h&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"stats-github-user","data-testid":"github-user",children:["@",h]})}),l.jsx(Te,{children:`GitHub: ${h}`})]})]}),l.jsxs("div",{className:"stats-right","data-testid":"stats-right",children:[l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"secondary",className:"stats-model-badge","data-testid":"model-badge",children:T2(r)})}),r&&l.jsx(Te,{children:r})]}),l.jsxs("div",{className:`stats-context-meter ${f}`,"data-testid":"context-meter",children:[l.jsxs("span",{className:"context-percent","data-testid":"context-percent",children:[a,"%"]}),l.jsx("div",{className:"context-fill","data-testid":"context-fill",style:{width:`${a}%`}})]})]})]})})}function Ox(n){return n.startsWith("Stop hook feedback:")}function z2(n){const e=Date.now(),i=n.parent_tool_use_id||void 0,a=n.subagent_type,r=n.subagent_name,c=[];if(n.type==="assistant"||n.type==="message"){const d=n.message?.content||n.content;if(Array.isArray(d)){const h=d.filter(p=>p.type==="text"&&typeof p.text=="string").map(p=>p.text).join("");h&&h.trim().length>=3&&!Ox(h.trim())&&c.push({type:"agent",content:h,timestamp:e,isStreaming:!0,parent_id:i,subagent_type:a,subagent_name:r});const f=d.filter(p=>p.type==="tool_use");for(const p of f)c.push({type:"tool_use",tool_name:p.name,tool_id:p.id,input:p.input,timestamp:e,parent_id:i,subagent_type:a,subagent_name:r})}else typeof d=="string"&&d.trim().length>=3&&!Ox(d.trim())&&c.push({type:"agent",content:d,timestamp:e,isStreaming:!0,parent_id:i,subagent_type:a,subagent_name:r});return c}if(n.type==="user"){let d="";const h=n.message?.content||n.content;if(Array.isArray(h)){d=h.filter(p=>p.type==="text"&&typeof p.text=="string").map(p=>p.text).join("");const f=h.filter(p=>p.type==="tool_result");for(const p of f)c.push({type:"tool_result",tool_id:p.tool_use_id,content:typeof p.content=="string"?p.content:"",timestamp:e,is_error:p.is_error})}else typeof h=="string"&&(d=h);return d&&c.push({type:"user",content:d,timestamp:e,parent_id:i,subagent_type:a,subagent_name:r}),c}return n.type==="tool_use"?(c.push({type:"tool_use",tool_name:n.tool_name,tool_id:n.tool_id,input:n.input,timestamp:e,parent_id:i,subagent_type:a,subagent_name:r}),c):(n.type==="tool_result"&&c.push({type:"tool_result",tool_id:n.tool_id,content:typeof n.output=="string"?n.output:"",timestamp:e,parent_id:i,subagent_type:a,subagent_name:r,is_error:n.is_error,durationMs:n.durationMs}),c)}function M2(){const[n,e]=m.useState([]),[i,a]=m.useState(!1),{isRunning:r,isStopping:c,bellMode:d,relayMode:h,contextPercent:f,currentAgent:p,handleStop:y,handleForceStop:b,handleReset:x,handleBellModeChange:w,handleRelayModeChange:E,handleTirePump:C,handleAgentSwitch:S}=C2(),{send:D,abort:N,onMessage:k,onComplete:T,onError:R,onUserMessage:z,onClear:O,isConnected:A}=dr(),{persona:G}=Zc(),U=m.useRef(G);U.current=G;const{handleTurnComplete:B,pauseQueue:$,onBellConsumed:ae,injectMessage:ne}=g0(),W=m.useRef();m.useEffect(()=>ae(ce=>{e(de=>[...de,{type:"bell_injected",content:ce.text,timestamp:Date.now(),imageCount:ce.images.length>0?ce.images.length:void 0}])}),[ae]);const M={abort:N,submit:(X,ce)=>{a(!0),D(X,ce)}},K=m.useCallback(X=>{const ce=z2(X);if(ce.length>0){const de=U.current,De=ce.map(Ne=>Ne.type==="agent"&&de?{...Ne,agentSlug:de.slug??void 0,agentTheme:de.theme??void 0,agentCharacter:de.character??void 0}:Ne),Ge=De.filter(Ne=>Ne.type==="tool_result"&&!Ne.parent_id&&Ne.tool_id).map(Ne=>Ne.tool_id);Ge.length>0?e(Ne=>{const dt=new Set(Ge.filter(rt=>Ne.some(An=>An.parent_id===rt)));return dt.size>0?[...Ne.filter(rt=>!rt.parent_id||!dt.has(rt.parent_id)),...De]:[...Ne,...De]}):e(Ne=>[...Ne,...De])}},[]),q=m.useCallback(()=>{a(!1),e(X=>X.map(ce=>ce.type==="agent"&&ce.isStreaming?{...ce,isStreaming:!1}:ce)),W.current&&B(W.current)},[B]),he=m.useCallback(X=>{a(!1),e(ce=>[...ce,{type:"agent",content:`Error: ${X}`,timestamp:Date.now()}])},[]);m.useEffect(()=>z(ce=>{e(de=>[...de,{type:"user",content:ce.prompt,timestamp:ce.timestamp,imageCount:ce.images.length>0?ce.images.length:void 0}])}),[z]),m.useEffect(()=>O(()=>{e(ce=>[...ce,{type:"context_cleared",content:"Context cleared",timestamp:Date.now()}]),a(!1)}),[O]),m.useEffect(()=>{if(!A){console.log("[MessagePanel] Claude WebSocket not connected");return}const X=k(K),ce=T(q),de=R(he);return()=>{X(),ce(),de()}},[A,k,T,R,K,q,he]);const Se=m.useCallback((X,ce)=>{a(!0),D(X,ce)},[D]);m.useEffect(()=>{W.current=Se},[Se]);const I=m.useCallback(()=>{$(),y()},[$,y]),[L,ee]=m.useState(null),V=m.useRef(null),Y=m.useRef(!1),le=m.useCallback(X=>{X.preventDefault(),Y.current=!0;const ce=X.clientY,de=V.current;if(!de)return;const De=de.getBoundingClientRect(),Ge=L??de.querySelector(".message-panel-editor")?.getBoundingClientRect().height??150,Ne=rt=>{if(!Y.current)return;const An=ce-rt.clientY,ei=Math.max(80,Math.min(Ge+An,De.height*.7));ee(ei)},dt=()=>{Y.current=!1,document.removeEventListener("mousemove",Ne),document.removeEventListener("mouseup",dt),document.body.style.cursor="",document.body.style.userSelect=""};document.addEventListener("mousemove",Ne),document.addEventListener("mouseup",dt),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},[L]);return l.jsxs("div",{className:"message-panel","data-testid":"message-panel",ref:V,children:[l.jsx(eC,{}),l.jsx("div",{className:"message-panel-content",children:l.jsx(BM,{messages:n})}),l.jsx("div",{className:"message-panel-resize-handle",onMouseDown:le}),l.jsx("div",{className:"message-panel-editor",style:L!=null?{height:L,flexShrink:0}:void 0,children:l.jsxs("div",{className:"editor-with-controls",children:[l.jsx("div",{className:"editor-area",children:l.jsx(b2,{onSubmit:Se,isProcessing:i||r,placeholder:"Send a message...",onInject:X=>ne(X,M)})}),l.jsx(S2,{isRunning:r||i,isStopping:c,onStop:I,onForceStop:b,onReset:x,bellMode:d,relayMode:h,onBellModeChange:w,onRelayModeChange:E,contextPercent:f,currentAgent:p,onTirePump:C,onAgentSwitch:S})]})}),l.jsx(O2,{})]})}function P2(n){return n.id?{id:n.id,title:n.title??"",status:n.status??void 0,phase:n.phase??void 0,points:n.points??void 0,criteria:n.criteria,workflowPhases:n.workflow,workflowType:n.workflowType??void 0}:null}function Pm(){const[n,e]=m.useState(null),[i,a]=m.useState(!0),[r,c]=m.useState(null),[d,h]=m.useState(null),f=m.useRef(null),p=m.useRef();return m.useEffect(()=>{const b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/story`,x=()=>{try{f.current=new WebSocket(b),f.current.onopen=()=>{console.debug("[useStory] WebSocket connected")},f.current.onmessage=w=>{try{const E=JSON.parse(w.data);(E.type==="init"||E.type==="update")&&(e(P2(E)),h(E.availableWorkflows??null),a(!1),c(null))}catch(E){console.error("[useStory] Failed to parse message:",E)}},f.current.onclose=()=>{console.debug("[useStory] WebSocket closed, reconnecting..."),p.current=setTimeout(x,2e3)},f.current.onerror=w=>{console.error("[useStory] WebSocket error:",w),c(new Error("WebSocket connection failed"))}}catch(w){console.error("[useStory] WebSocket init failed:",w),c(w instanceof Error?w:new Error("Failed to connect")),a(!1)}};return x(),()=>{p.current&&clearTimeout(p.current),f.current&&f.current.close()}},[]),{story:n,isLoading:i,error:r,availableWorkflows:d}}function tC(){const[n,e]=m.useState(null),[i,a]=m.useState(!0),[r,c]=m.useState(null),d=m.useRef(null),h=m.useRef(),f=m.useRef(!0);return m.useEffect(()=>{const y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/sprint`,b=()=>{if(f.current)try{d.current=new WebSocket(y),d.current.onopen=()=>{console.debug("[useSprint] WebSocket connected")},d.current.onmessage=x=>{try{const w=JSON.parse(x.data);if(w.type==="init"||w.type==="update"){const{type:E,...C}=w;e(S=>S?{...S,...C}:C),a(!1),c(null)}}catch(w){console.error("[useSprint] Failed to parse message:",w)}},d.current.onclose=()=>{console.debug("[useSprint] WebSocket closed, reconnecting..."),h.current=setTimeout(b,2e3)},d.current.onerror=x=>{console.error("[useSprint] WebSocket error:",x),c(new Error("WebSocket connection failed"))}}catch(x){console.error("[useSprint] WebSocket init failed:",x),c(x instanceof Error?x:new Error("Failed to connect")),a(!1)}};return b(),()=>{f.current=!1,h.current&&clearTimeout(h.current),d.current&&d.current.close()}},[]),{data:n,isLoading:i,error:r}}function L2(n){if(!n)return null;const e=n.split("@")[0],i=e.split(".");if(i.length>=2){const a=i[0].charAt(0).toUpperCase(),r=i[i.length-1].charAt(0).toUpperCase()+i[i.length-1].slice(1);return`${a}. ${r}`}return e}function I2(n){const e=n.stories.reduce((a,r)=>a+r.points,0);return{done:n.stories.filter(a=>a.status==="done").reduce((a,r)=>a+r.points,0),total:e}}function jf(n){return n.stories.length>0&&n.stories.every(e=>e.status==="done"||e.status==="cancelled")}function G2(n){switch(n){case"done":return{icon:l.jsx(Ga,{size:12}),className:"status-done"};case"in_progress":return{icon:l.jsx(ez,{size:12}),className:"status-in-progress"};case"blocked":return{icon:l.jsx(oz,{size:12}),className:"status-blocked"};default:return{icon:l.jsx(QO,{size:12}),className:"status-backlog"}}}function zx(n){return`https://1898andco.atlassian.net/browse/${n}`}function Mx({hasContext:n,testIdPrefix:e,id:i}){const a=n?"Context file exists":"No context file";return l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:`context-indicator ${n?"has-context":"no-context"}`,"data-testid":`${e}-context-indicator-${i}`,"data-has-context":String(n),title:a,children:n?"📄":""})}),l.jsx(Te,{children:a})]})}function B2({priority:n,storyId:e}){return n?l.jsx("span",{className:"priority-label","data-testid":`story-priority-${e}`,"data-priority":n,title:n,children:n}):null}function H2({status:n,storyId:e}){const{icon:i,className:a}=G2(n);return l.jsx($e,{variant:n==="blocked"?"destructive":n==="done"?"default":"secondary",className:`story-status-badge ${a}`,"data-testid":`story-status-badge-${e}`,"data-status":n,"aria-label":`Status: ${n}`,children:i})}function V2({jiraKey:n,storyId:e}){const i=a=>{a.preventDefault();const r=zx(n);try{const c=window.electronAPI;if(c?.shell?.openExternal){c.shell.openExternal(r);return}}catch{}window.open(r,"_blank")};return l.jsx("a",{className:"jira-link cyclist-link","data-testid":`story-jira-link-${e}`,href:zx(n),onClick:i,children:n})}function Px({text:n}){const[e,i]=m.useState(!1),a=async r=>{r.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2e3)}catch{}};return l.jsx("button",{className:`copy-id-button ${e?"copied":""}`,onClick:a,"aria-label":`Copy ${n}`,title:"Copy ID + title",children:e?l.jsx(Ga,{size:12}):l.jsx(KO,{size:12})})}function Lx({epic:n,isExpanded:e,isArchiving:i,onToggle:a,onKeyDown:r,onArchive:c}){const{done:d,total:h}=I2(n),f=jf(n);return l.jsxs("div",{className:`epic-group ${f?"epic-completed":""}`,"data-testid":`epic-group-${n.id}`,children:[l.jsxs("div",{className:"epic-header",children:[l.jsx(Ce,{variant:"ghost",size:"icon",className:"epic-toggle","data-testid":`epic-toggle-${n.id}`,onClick:()=>a(n.id),onKeyDown:p=>r(n.id,p),"aria-expanded":e,children:e?"▼":"▶"}),l.jsx("span",{className:"epic-title",children:n.title}),n.jiraKey&&l.jsx("span",{className:"epic-jira",children:n.jiraKey}),l.jsx(Px,{text:`${n.id} ${n.title}`}),l.jsx(Mx,{hasContext:n.hasContext??!1,testIdPrefix:"epic",id:n.id}),f&&n.hasContext&&l.jsx($e,{variant:"default",className:"epic-ready-badge","data-testid":`epic-ready-badge-${n.id}`,children:"Ready"}),l.jsx("div",{className:"epic-progress","data-testid":`epic-progress-${n.id}`,"data-done":String(d),"data-total":String(h),children:l.jsx("div",{className:"progress-bar",style:{width:`${h>0?d/h*100:0}%`}})}),l.jsxs("span",{className:"epic-progress-label","data-testid":`epic-progress-label-${n.id}`,children:[d,"/",h," pts"]}),f&&l.jsxs(l.Fragment,{children:[i&&l.jsx("span",{"data-testid":`archive-loading-${n.id}`,children:"..."}),l.jsx(Ce,{variant:"outline",size:"sm",className:"archive-button","data-testid":`archive-button-${n.id}`,"aria-label":`Archive ${n.id}`,disabled:i,onClick:()=>c(n.id),children:"Archive"})]})]}),e&&l.jsx("div",{className:"epic-stories",children:n.stories.map(p=>{const y=p.hasContext??!1,b=p.status==="blocked",x=L2(p.assignedTo);return l.jsxs("div",{className:`story-item ${y?"":"missing-context"} ${b?"story-blocked":""}`,"data-testid":`story-item-${p.id}`,"data-status":p.status,"data-story-id":p.id,"aria-label":`${p.id}: ${p.title}`,children:[l.jsx(B2,{priority:p.priority,storyId:p.id}),l.jsx(H2,{status:p.status,storyId:p.id}),p.jiraKey&&l.jsx(V2,{jiraKey:p.jiraKey,storyId:p.id}),l.jsx(Px,{text:`${p.id} ${p.title}`}),l.jsxs("div",{className:"story-info",children:[l.jsx("span",{className:"story-title",children:p.title}),l.jsxs("span",{className:"story-meta",children:[x&&l.jsx("span",{className:"story-assignee","data-testid":`story-assignee-${p.id}`,children:x}),p.workflow&&l.jsx("span",{className:"story-workflow-badge","data-testid":`story-workflow-${p.id}`,children:p.workflow}),p.status==="done"&&p.completed&&l.jsx("span",{className:"story-completed-date","data-testid":`story-completed-${p.id}`,children:p.completed})]})]}),l.jsx(Mx,{hasContext:y,testIdPrefix:"story",id:p.id}),l.jsx("span",{className:"story-points","data-testid":`story-points-${p.id}`,children:p.points})]},p.id)})})]})}function nC(){const{data:n,isLoading:e,error:i}=tC(),[a,r]=m.useState(new Set),[c,d]=m.useState(new Set),[h,f]=m.useState(null),[p,y]=m.useState(null),b=n?.epics.filter(R=>!jf(R))??[],x=n?.epics.filter(R=>jf(R))??[],w=m.useRef(!1);m.useEffect(()=>{n?.epics&&!w.current&&(w.current=!0,r(new Set(b.map(R=>R.id))))},[n?.epics]);const E=m.useCallback(R=>{r(z=>{const O=new Set(z);return O.has(R)?O.delete(R):O.add(R),O})},[]),C=m.useCallback((R,z)=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),E(R))},[E]),S=m.useCallback(async R=>{d(z=>new Set(z).add(`archive-${R}`)),f(null),y(null);try{if(typeof window<"u"&&window.electronAPI?.sprint?.archiveEpic)await window.electronAPI.sprint.archiveEpic(R);else if(!(await fetch(`/api/sprint/archive-epic/${R}`,{method:"POST"})).ok)throw new Error("Archive failed")}catch(z){y(z instanceof Error?z:new Error("Archive failed"))}finally{d(z=>{const O=new Set(z);return O.delete(`archive-${R}`),O})}},[]),D=m.useCallback(async R=>{d(z=>new Set(z).add(`promote-${R}`)),y(null);try{if(typeof window<"u"&&window.electronAPI?.sprint?.promoteEpic)await window.electronAPI.sprint.promoteEpic(R);else if(!(await fetch(`/api/sprint/promote-epic/${R}`,{method:"POST"})).ok)throw new Error("Promote failed")}catch(z){y(z instanceof Error?z:new Error("Promote failed"))}finally{d(z=>{const O=new Set(z);return O.delete(`promote-${R}`),O})}},[]);if(e)return l.jsx("div",{className:"enhanced-sprint-panel","data-testid":"enhanced-sprint-panel",children:l.jsxs("div",{className:"loading-state space-y-3 p-2","data-testid":"sprint-panel-loading",children:[l.jsx(fe,{className:"h-5 w-32"}),l.jsx(fe,{className:"h-4 w-full"}),l.jsx(Rt,{className:"my-2"}),l.jsx(fe,{className:"h-5 w-28"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(Rt,{className:"my-2"}),l.jsx(fe,{className:"h-5 w-36"}),l.jsx(fe,{className:"h-6 w-3/4"})]})});const N=i||p,k=N?l.jsx("div",{className:"error-toast","data-testid":"error-toast",children:N.message}):null,T=h?l.jsxs("div",{className:"confirm-dialog","data-testid":"confirm-archive-dialog",children:[l.jsx("p",{children:"Are you sure you want to archive this epic?"}),l.jsx(Ce,{variant:"destructive",size:"sm","data-testid":"confirm-archive-yes",onClick:()=>S(h),children:"Yes"}),l.jsx(Ce,{variant:"outline",size:"sm","data-testid":"confirm-archive-no",onClick:()=>f(null),children:"No"})]}):null;return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"enhanced-sprint-panel","data-testid":"enhanced-sprint-panel",children:[k,T,l.jsxs("section",{"data-section":"current-story",children:[l.jsx("h2",{children:"Current Story"}),n?.currentStory?l.jsxs("div",{"data-testid":"current-story-section",children:[l.jsx("span",{className:"story-id",children:n.currentStory.id}),l.jsx("span",{className:"story-title",children:n.currentStory.title}),l.jsx("span",{className:"story-status",children:n.currentStory.status}),l.jsxs("span",{className:"story-points","data-testid":"current-story-points",children:[n.currentStory.points," pts"]})]}):n?.nextStory?l.jsxs("div",{"data-testid":"next-up-section",children:[l.jsx("span",{className:"next-up-label",children:"Next up:"}),l.jsx("span",{className:"story-id",children:n.nextStory.id}),l.jsx("span",{className:"story-title",children:n.nextStory.title})]}):l.jsx("div",{"data-testid":"no-stories-section",children:l.jsx("span",{children:"No active story"})})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{"data-section":"epics",children:[l.jsx("h2",{children:"Current Epics"}),l.jsxs("div",{"data-testid":"epic-tree-view",children:[(!n?.epics||n.epics.length===0)&&l.jsxs("div",{className:"empty-state","data-testid":"no-epics-section",children:[l.jsx("span",{children:"No epics in current sprint"}),l.jsx("p",{className:"hint",children:"Promote an epic from Future Initiatives to get started"})]}),b.map(R=>l.jsx(Lx,{epic:R,isExpanded:a.has(R.id),isArchiving:c.has(`archive-${R.id}`),onToggle:E,onKeyDown:C,onArchive:f},R.id))]})]}),x.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{"data-section":"completed-epics",children:[l.jsx("h2",{children:"Completed Epics"}),l.jsx("div",{"data-testid":"completed-epics-section",children:x.map(R=>l.jsx(Lx,{epic:R,isExpanded:a.has(R.id),isArchiving:c.has(`archive-${R.id}`),onToggle:E,onKeyDown:C,onArchive:f},R.id))})]})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{"data-section":"future",children:[l.jsx("h2",{children:"Future Initiatives"}),l.jsx("div",{"data-testid":"future-initiatives-section",children:n?.futureEpics.map(R=>{const z=c.has(`promote-${R.id}`),O=R.status==="ready";return l.jsxs("div",{className:"future-epic","data-testid":`future-epic-${R.id}`,children:[l.jsx("span",{className:"future-epic-title",children:R.title}),l.jsxs("span",{className:"future-epic-points",children:[R.estimatedPoints," pts"]}),l.jsx($e,{variant:R.status==="ready"?"default":"secondary",className:"future-epic-status","data-testid":`future-epic-status-${R.id}`,"data-status":R.status,children:R.status}),O&&l.jsx(Ce,{variant:"default",size:"sm",className:"promote-button","data-testid":`promote-button-${R.id}`,"aria-label":`Promote ${R.id} to current sprint`,disabled:z,onClick:()=>D(R.id),children:"Promote"})]},R.id)})})]})]})})}function iC(n){let e=0,i=0,a=0;for(const r of n){const c=r.status[0]||" ",d=r.status[1]||" ";c!==" "&&c!=="?"&&e++,(d==="M"||d==="D")&&i++,c==="?"&&d==="?"&&a++}return{staged:e,modified:i,untracked:a}}function F2(n){return n?.length?n.map(e=>{const i=iC(e.dirtyFiles);return{name:e.name,path:e.path,branch:e.branch,ahead:e.ahead??void 0,behind:e.behind??void 0,developBehind:e.developBehind??void 0,staged:i.staged,modified:i.modified,untracked:i.untracked,isDirty:!e.clean,files:e.dirtyFiles}}):[]}function U2(n){if(!n?.length)return null;const e=n[0];let i=0,a=0,r=0;for(const d of n){const h=iC(d.dirtyFiles);i+=h.staged,a+=h.modified,r+=h.untracked}const c=n.some(d=>!d.clean);return{branch:e.branch,ahead:e.ahead??void 0,behind:e.behind??void 0,staged:i>0?i:void 0,modified:a>0?a:void 0,untracked:r>0?r:void 0,isDirty:c}}function Lm(){const[n,e]=m.useState(null),[i,a]=m.useState([]),[r,c]=m.useState(!0),[d,h]=m.useState(null),f=m.useRef(null),p=m.useRef();return m.useEffect(()=>{const b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/git`,x=()=>{try{f.current=new WebSocket(b),f.current.onopen=()=>{console.debug("[useGitStatus] WebSocket connected")},f.current.onmessage=w=>{try{const E=JSON.parse(w.data);(E.type==="init"||E.type==="update")&&(e(U2(E.repos)),a(F2(E.repos)),c(!1),h(null))}catch(E){console.error("[useGitStatus] Failed to parse message:",E)}},f.current.onclose=()=>{console.debug("[useGitStatus] WebSocket closed, reconnecting..."),p.current=setTimeout(x,2e3)},f.current.onerror=w=>{console.error("[useGitStatus] WebSocket error:",w),h(new Error("WebSocket connection failed"))}}catch(w){console.error("[useGitStatus] WebSocket init failed:",w),h(w instanceof Error?w:new Error("Failed to connect")),c(!1)}};return x(),()=>{p.current&&clearTimeout(p.current),f.current&&f.current.close()}},[]),{gitStatus:n,repos:i,isLoading:r,error:d}}function $2(n){const e=n[0]||" ",i=n[1]||" ";return e==="?"&&i==="?"?"untracked":e!==" "&&e!=="?"?"staged":"modified"}function W2(n){const e=n[0]||" ",i=n[1]||" ";return e==="?"&&i==="?"?"?":e==="A"?"+":e==="D"||i==="D"?"-":e==="M"||i==="M"?"~":e==="R"?"R":n.trim()||"~"}function q2({files:n}){return l.jsx("ul",{className:"file-list",children:n.map((e,i)=>l.jsxs("li",{className:`file-item ${$2(e.status)}`,children:[l.jsx("span",{className:"file-status-icon",children:W2(e.status)}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"file-path",children:e.path})}),l.jsx(Te,{children:e.path})]})]},`${e.path}-${i}`))})}function Y2({repo:n}){const[e,i]=m.useState(!1),{name:a,branch:r,ahead:c,behind:d,developBehind:h,staged:f,modified:p,untracked:y,isDirty:b,files:x}=n,w=x.length>0;return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:`repo-status ${e?"expanded":""}`,"data-testid":`repo-status-${a}`,children:[l.jsxs("div",{className:"repo-header",children:[l.jsx("span",{className:"repo-name",children:a}),b&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx($e,{variant:"destructive",className:"dirty-indicator",children:"●"})}),l.jsx(Te,{children:"Uncommitted changes"})]})]}),l.jsxs("div",{className:"branch-info",children:[l.jsx("span",{className:"branch-icon",children:"⎇"}),l.jsx("span",{className:"branch-name",children:r})]}),(c!==void 0&&c>0||d!==void 0&&d>0||h!==void 0&&h>0)&&l.jsxs("div",{className:"sync-status",children:[c!==void 0&&c>0&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"ahead",children:["↑",c]})}),l.jsx(Te,{children:"Commits ahead of remote"})]}),d!==void 0&&d>0&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"behind",children:["↓",d]})}),l.jsx(Te,{children:"Commits behind remote"})]}),h!==void 0&&h>0&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("span",{className:"develop-behind",children:["⟳",h]})}),l.jsxs(Te,{children:["develop is ",h," commit",h>1?"s":""," ahead"]})]})]}),(f>0||p>0||y>0)&&l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs(Ce,{variant:"ghost",className:"file-status-toggle",onClick:()=>i(!e),children:[l.jsx("span",{className:`toggle-icon ${e?"open":""}`,children:"▶"}),l.jsxs("div",{className:"file-status",children:[f>0&&l.jsxs($e,{variant:"outline",className:"status-item staged",children:["+",f]}),p>0&&l.jsxs($e,{variant:"outline",className:"status-item modified",children:["~",p]}),y>0&&l.jsxs($e,{variant:"outline",className:"status-item untracked",children:["?",y]})]})]})}),l.jsx(Te,{children:e?"Collapse file list":"Expand file list"})]}),e&&w&&l.jsx(q2,{files:x})]})})}function sC(){const{repos:n,isLoading:e,error:i}=Lm();return e?l.jsx("div",{className:"git-panel loading","data-testid":"git-panel",children:l.jsxs("div",{className:"space-y-3 p-2",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(fe,{className:"h-4 w-32"}),l.jsx(fe,{className:"h-3 w-24"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx(fe,{className:"h-4 w-28"}),l.jsx(fe,{className:"h-3 w-20"})]})]})}):i?l.jsx("div",{className:"git-panel error","data-testid":"git-panel",children:l.jsx("div",{className:"error-message",children:i.message})}):n.length===0?l.jsx("div",{className:"git-panel empty","data-testid":"git-panel",children:l.jsx("div",{className:"placeholder",children:"No git repos"})}):l.jsx("div",{className:"git-panel stacked","data-testid":"git-panel",children:n.map(a=>l.jsx(Y2,{repo:a},a.name))})}function X2(n){switch(n){case"done":return"✓";case"current":return"●";default:return"○"}}function Q2(n){return n?["tdd","bdd"].includes(n.toLowerCase())?n.toUpperCase():n.charAt(0).toUpperCase()+n.slice(1):"—"}function Z2({phase:n,isLast:e}){const i=X2(n.status),a=`phase-step ${n.status}`;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:a,children:[l.jsx("span",{className:"phase-icon",children:i}),l.jsx("span",{className:"phase-label",children:n.label})]}),!e&&l.jsx("span",{className:"phase-arrow",children:"→"})]})}function K2({phases:n}){const e=n.length,i=n.findIndex(d=>d.status==="current"),a=n.filter(d=>d.status==="done").length,r=i>=0?i+1:a===e?e:1,c=i>=0?n[i]:null;return l.jsxs("div",{className:"stepped-progress",children:[l.jsxs("span",{className:"stepped-counter",children:["Step ",r," of ",e]}),c&&l.jsx("span",{className:"stepped-current-label",children:c.label})]})}function J2({workflows:n,onStart:e}){return l.jsxs("div",{className:"available-workflows",children:[l.jsx("div",{className:"available-workflows-header",children:l.jsxs("span",{className:"available-workflows-title",children:["Available Workflows (",n.length,")"]})}),l.jsx("div",{className:"available-workflows-list",children:n.map(i=>l.jsxs("div",{className:"workflow-entry","data-testid":"workflow-entry","data-workflow-entry-type":i.type,children:[l.jsxs("div",{className:"workflow-entry-header",children:[l.jsx("span",{className:"workflow-entry-name",children:i.name}),l.jsx($e,{variant:"outline",className:"workflow-entry-type-badge",children:i.type})]}),l.jsx("div",{className:"workflow-entry-description",children:i.description}),i.type==="stepped"&&l.jsxs("div",{className:"workflow-entry-hint",children:["/workflow start ",i.name]}),l.jsx("div",{className:"workflow-entry-footer",children:l.jsx(Ce,{variant:"ghost",size:"sm",className:"workflow-start-button","data-testid":"workflow-start-button",onClick:()=>e?.(i),children:"Start"})})]},i.name))})]})}function aC(){const{story:n,isLoading:e,error:i,availableWorkflows:a}=Pm(),{send:r,isConnected:c}=dr(),d=m.useCallback(b=>{c&&r(`/workflow start ${b.name}`)},[r,c]);if(e)return l.jsx("div",{className:"workflow-panel loading","data-testid":"workflow-panel",children:l.jsxs("div",{className:"space-y-2 p-2",children:[l.jsx(fe,{className:"h-6 w-16 rounded-full"}),l.jsxs("div",{className:"flex gap-2 items-center",children:[l.jsx(fe,{className:"h-4 w-12"}),l.jsx(fe,{className:"h-4 w-12"}),l.jsx(fe,{className:"h-4 w-12"})]})]})});if(i)return l.jsx("div",{className:"workflow-panel error","data-testid":"workflow-panel",children:l.jsx("div",{className:"error-message",children:i.message})});const h=n?.workflow??null,f=n?.workflowPhases??null,p=n?.workflowType==="stepped";if(!h&&(!f||f.length===0))return a&&a.length>0?l.jsx("div",{className:"workflow-panel","data-testid":"workflow-panel",children:l.jsx(J2,{workflows:a,onStart:d})}):l.jsx("div",{className:"workflow-panel","data-testid":"workflow-panel",children:l.jsx("div",{className:"placeholder",children:"No active workflow"})});const y=Q2(h);return l.jsx("div",{className:"workflow-panel","data-testid":"workflow-panel",children:l.jsxs("div",{className:"workflow-content",children:[l.jsx($e,{variant:"secondary",className:"workflow-type-badge","data-workflow-type":h||"",children:y}),f&&f.length>0&&(p?l.jsx(K2,{phases:f}):l.jsx("div",{className:"phase-progress",children:f.map((b,x)=>l.jsx(Z2,{phase:b,isLast:x===f.length-1},b.name))}))]})})}function eP({item:n}){const e=n.completed?"ac-item ac-done":"ac-item",i=n.completed?"✓":"○";return l.jsxs("div",{className:e,children:[l.jsx("span",{className:"ac-icon",children:i}),l.jsx("span",{className:"ac-text",children:n.text})]})}function oC(){const{story:n,isLoading:e,error:i}=Pm();if(e)return l.jsx("div",{className:"ac-panel loading","data-testid":"ac-panel",children:l.jsxs("div",{className:"space-y-2 p-2",children:[l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-4 w-3/4"}),l.jsx(fe,{className:"h-4 w-5/6"}),l.jsx(fe,{className:"h-4 w-2/3"})]})});if(i)return l.jsx("div",{className:"ac-panel error","data-testid":"ac-panel",children:l.jsx("div",{className:"error-message",children:i.message})});const a=n?.criteria??null;if(!a||a.length===0)return l.jsx("div",{className:"ac-panel","data-testid":"ac-panel",children:l.jsx("div",{className:"placeholder",children:"No acceptance criteria"})});const r=a.filter(d=>d.completed).length,c=a.length;return l.jsx("div",{className:"ac-panel","data-testid":"ac-panel",children:l.jsxs("div",{className:"ac-content",children:[l.jsxs("span",{className:"progress-text",children:[r,"/",c]}),l.jsx("div",{className:"progress-bar-container",children:l.jsx("div",{className:"progress-bar",style:{width:`${r/c*100}%`}})}),l.jsx("div",{className:"ac-list",children:a.map((d,h)=>l.jsx(eP,{item:d},h))})]})})}function rC(){const[n,e]=m.useState([]),[i,a]=m.useState(!0),[r,c]=m.useState(null),d=m.useRef(null),h=m.useRef();return m.useEffect(()=>{const p=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/todos`,y=()=>{try{d.current=new WebSocket(p),d.current.onopen=()=>{console.debug("[useTodos] WebSocket connected")},d.current.onmessage=b=>{try{const x=JSON.parse(b.data);(x.type==="init"||x.type==="update")&&(e(x.todos||[]),a(!1),c(null))}catch(x){console.error("[useTodos] Failed to parse message:",x)}},d.current.onclose=()=>{console.debug("[useTodos] WebSocket closed, reconnecting..."),h.current=setTimeout(y,2e3)},d.current.onerror=b=>{console.error("[useTodos] WebSocket error:",b),c(new Error("WebSocket connection failed"))}}catch(b){console.error("[useTodos] WebSocket init failed:",b),c(b instanceof Error?b:new Error("Failed to connect")),a(!1)}};return y(),()=>{h.current&&clearTimeout(h.current),d.current&&d.current.close()}},[]),{todos:n,isLoading:i,error:r}}function Kh({todo:n}){const e={pending:"○",in_progress:"●",completed:"✓"}[n.status],i=`todo-item todo-${n.status}`,a=n.status==="in_progress"&&n.activeForm?n.activeForm:n.content;return l.jsxs("div",{className:i,"data-testid":`todo-${n.id}`,children:[l.jsx("span",{className:"todo-status",children:e}),l.jsx("span",{className:"todo-subject",children:a}),n.blockedBy&&n.blockedBy.length>0&&l.jsx(St,{delayDuration:300,children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"todo-blocked",children:"(blocked)"})}),l.jsx(Te,{children:`Blocked by: ${n.blockedBy.join(", ")}`})]})})]})}function lC(){const{todos:n,isLoading:e,error:i}=rC();if(e)return l.jsx("div",{className:"todo-panel loading","data-testid":"todo-panel",children:l.jsxs("div",{className:"space-y-2 p-2",children:[l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-4 w-5/6"}),l.jsx(fe,{className:"h-4 w-3/4"}),l.jsx(fe,{className:"h-4 w-4/5"})]})});if(i)return l.jsx("div",{className:"todo-panel error","data-testid":"todo-panel",children:l.jsx("div",{className:"error-message",children:i.message})});if(n.length===0)return l.jsx("div",{className:"todo-panel","data-testid":"todo-panel",children:l.jsx("div",{className:"placeholder",children:"No active tasks"})});const a=n.filter(p=>p.status==="in_progress"),r=n.filter(p=>p.status==="pending"),c=n.filter(p=>p.status==="completed"),d=n.length,h=c.length,f=d>0?Math.round(h/d*100):0;return l.jsx("div",{className:"todo-panel","data-testid":"todo-panel",children:l.jsxs("div",{className:"todo-content",children:[l.jsxs("div",{className:"progress-bar-container",children:[l.jsx("div",{className:"progress-bar",style:{width:`${f}%`}}),l.jsxs("span",{className:"progress-text",children:[h,"/",d]})]}),a.length>0&&l.jsxs("div",{className:"todo-section",children:[l.jsx("h4",{children:"In Progress"}),a.map(p=>l.jsx(Kh,{todo:p},p.id))]}),r.length>0&&l.jsxs("div",{className:"todo-section",children:[l.jsx("h4",{children:"Pending"}),r.map(p=>l.jsx(Kh,{todo:p},p.id))]}),c.length>0&&l.jsxs("div",{className:"todo-section todo-completed",children:[l.jsxs("h4",{children:["Completed (",c.length,")"]}),c.map(p=>l.jsx(Kh,{todo:p},p.id))]})]})})}function tP(){const[n,e]=m.useState([]),i=m.useRef(null),a=m.useRef();m.useEffect(()=>{const f=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/background-tasks`,p=()=>{try{i.current=new WebSocket(f),i.current.onopen=()=>{console.debug("[useBackgroundTasks] WebSocket connected")},i.current.onmessage=y=>{try{const b=JSON.parse(y.data);switch(b.type){case"init":b.tasks&&e(b.tasks);break;case"task:started":b.task&&e(x=>x.some(w=>w.taskId===b.task.taskId)?x:[...x,b.task]);break;case"task:completed":b.task&&e(x=>x.map(w=>w.taskId===b.task.taskId?{...w,...b.task}:w));break}}catch(b){console.error("[useBackgroundTasks] Failed to parse message:",b)}},i.current.onclose=()=>{console.debug("[useBackgroundTasks] WebSocket closed, reconnecting..."),a.current=setTimeout(p,2e3)},i.current.onerror=y=>{console.error("[useBackgroundTasks] WebSocket error:",y)}}catch(y){console.error("[useBackgroundTasks] WebSocket init failed:",y)}};return p(),()=>{a.current&&clearTimeout(a.current),i.current&&i.current.close()}},[]);const r=m.useCallback(()=>{e(h=>h.filter(f=>f.status==="pending"))},[]),c=n.filter(h=>h.status==="pending").length,d=n.filter(h=>h.status==="completed").length;return{tasks:n,pendingCount:c,completedCount:d,clearCompleted:r}}function Ix(n){return n<1e3?`${n}ms`:n<6e4?`${Math.floor(n/1e3)}s`:`${Math.floor(n/6e4)}m`}function nP({task:n,tick:e}){const a=n.status==="pending"?"...":n.success?"v":"x",r=`task-item task-${n.status}${n.success===!1?" task-error":""}`;let c;return n.status==="completed"&&n.durationMs!==void 0?c=Ix(n.durationMs):c=Ix(Date.now()-n.startedAt),l.jsxs("div",{className:r,"data-testid":`task-${n.taskId}`,children:[l.jsx("span",{className:"task-status",children:a}),l.jsxs("div",{className:"task-content",children:[l.jsx("span",{className:"task-description",children:n.description}),l.jsx("span",{className:"task-type",children:n.subagentType})]}),l.jsx("span",{className:"task-elapsed",children:c})]})}function cC(){const{tasks:n,pendingCount:e,completedCount:i,clearCompleted:a}=tP(),[r,c]=m.useState(0);if(m.useEffect(()=>{if(e===0)return;const h=setInterval(()=>{c(f=>f+1)},1e3);return()=>clearInterval(h)},[e]),n.length===0)return l.jsx("div",{className:"background-panel empty","data-testid":"background-panel",children:l.jsx("div",{className:"placeholder",children:"No subagent tasks"})});const d=[...n].sort((h,f)=>h.status==="pending"&&f.status!=="pending"?-1:h.status!=="pending"&&f.status==="pending"?1:f.startedAt-h.startedAt);return l.jsxs("div",{className:"background-panel","data-testid":"background-panel",children:[l.jsxs("div",{className:"panel-header",children:[l.jsxs("span",{className:"task-counts",children:[e>0&&l.jsxs("span",{className:"pending-count",children:[e," running"]}),i>0&&l.jsxs("span",{className:"completed-count",children:[i," done"]})]}),i>0&&l.jsx(Ce,{variant:"ghost",size:"sm",type:"button",className:"clear-button",onClick:a,children:"Clear"})]}),l.jsx("div",{className:"task-list",children:d.map(h=>l.jsx(nP,{task:h,tick:r},h.taskId))})]})}function Tf(n,[e,i]){return Math.min(i,Math.max(e,n))}function iP(n,e){return m.useReducer((i,a)=>e[i][a]??i,n)}var Im="ScrollArea",[uC]=cn(Im),[sP,Dn]=uC(Im),dC=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,type:a="hover",dir:r,scrollHideDelay:c=600,...d}=n,[h,f]=m.useState(null),[p,y]=m.useState(null),[b,x]=m.useState(null),[w,E]=m.useState(null),[C,S]=m.useState(null),[D,N]=m.useState(0),[k,T]=m.useState(0),[R,z]=m.useState(!1),[O,A]=m.useState(!1),G=Ie(e,B=>f(B)),U=Kc(r);return l.jsx(sP,{scope:i,type:a,dir:U,scrollHideDelay:c,scrollArea:h,viewport:p,onViewportChange:y,content:b,onContentChange:x,scrollbarX:w,onScrollbarXChange:E,scrollbarXEnabled:R,onScrollbarXEnabledChange:z,scrollbarY:C,onScrollbarYChange:S,scrollbarYEnabled:O,onScrollbarYEnabledChange:A,onCornerWidthChange:N,onCornerHeightChange:T,children:l.jsx(je.div,{dir:U,...d,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":D+"px","--radix-scroll-area-corner-height":k+"px",...n.style}})})});dC.displayName=Im;var hC="ScrollAreaViewport",fC=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,children:a,nonce:r,...c}=n,d=Dn(hC,i),h=m.useRef(null),f=Ie(e,h,d.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),l.jsx(je.div,{"data-radix-scroll-area-viewport":"",...c,ref:f,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...n.style},children:l.jsx("div",{ref:d.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});fC.displayName=hC;var Jn="ScrollAreaScrollbar",Gm=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=Dn(Jn,n.__scopeScrollArea),{onScrollbarXEnabledChange:c,onScrollbarYEnabledChange:d}=r,h=n.orientation==="horizontal";return m.useEffect(()=>(h?c(!0):d(!0),()=>{h?c(!1):d(!1)}),[h,c,d]),r.type==="hover"?l.jsx(aP,{...a,ref:e,forceMount:i}):r.type==="scroll"?l.jsx(oP,{...a,ref:e,forceMount:i}):r.type==="auto"?l.jsx(mC,{...a,ref:e,forceMount:i}):r.type==="always"?l.jsx(Bm,{...a,ref:e}):null});Gm.displayName=Jn;var aP=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=Dn(Jn,n.__scopeScrollArea),[c,d]=m.useState(!1);return m.useEffect(()=>{const h=r.scrollArea;let f=0;if(h){const p=()=>{window.clearTimeout(f),d(!0)},y=()=>{f=window.setTimeout(()=>d(!1),r.scrollHideDelay)};return h.addEventListener("pointerenter",p),h.addEventListener("pointerleave",y),()=>{window.clearTimeout(f),h.removeEventListener("pointerenter",p),h.removeEventListener("pointerleave",y)}}},[r.scrollArea,r.scrollHideDelay]),l.jsx(qt,{present:i||c,children:l.jsx(mC,{"data-state":c?"visible":"hidden",...a,ref:e})})}),oP=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=Dn(Jn,n.__scopeScrollArea),c=n.orientation==="horizontal",d=eu(()=>f("SCROLL_END"),100),[h,f]=iP("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return m.useEffect(()=>{if(h==="idle"){const p=window.setTimeout(()=>f("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(p)}},[h,r.scrollHideDelay,f]),m.useEffect(()=>{const p=r.viewport,y=c?"scrollLeft":"scrollTop";if(p){let b=p[y];const x=()=>{const w=p[y];b!==w&&(f("SCROLL"),d()),b=w};return p.addEventListener("scroll",x),()=>p.removeEventListener("scroll",x)}},[r.viewport,c,f,d]),l.jsx(qt,{present:i||h!=="hidden",children:l.jsx(Bm,{"data-state":h==="hidden"?"hidden":"visible",...a,ref:e,onPointerEnter:we(n.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:we(n.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),mC=m.forwardRef((n,e)=>{const i=Dn(Jn,n.__scopeScrollArea),{forceMount:a,...r}=n,[c,d]=m.useState(!1),h=n.orientation==="horizontal",f=eu(()=>{if(i.viewport){const p=i.viewport.offsetWidth<i.viewport.scrollWidth,y=i.viewport.offsetHeight<i.viewport.scrollHeight;d(h?p:y)}},10);return Ba(i.viewport,f),Ba(i.content,f),l.jsx(qt,{present:a||c,children:l.jsx(Bm,{"data-state":c?"visible":"hidden",...r,ref:e})})}),Bm=m.forwardRef((n,e)=>{const{orientation:i="vertical",...a}=n,r=Dn(Jn,n.__scopeScrollArea),c=m.useRef(null),d=m.useRef(0),[h,f]=m.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=bC(h.viewport,h.content),y={...a,sizes:h,onSizesChange:f,hasThumb:p>0&&p<1,onThumbChange:x=>c.current=x,onThumbPointerUp:()=>d.current=0,onThumbPointerDown:x=>d.current=x};function b(x,w){return hP(x,d.current,h,w)}return i==="horizontal"?l.jsx(rP,{...y,ref:e,onThumbPositionChange:()=>{if(r.viewport&&c.current){const x=r.viewport.scrollLeft,w=Gx(x,h,r.dir);c.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:x=>{r.viewport&&(r.viewport.scrollLeft=x)},onDragScroll:x=>{r.viewport&&(r.viewport.scrollLeft=b(x,r.dir))}}):i==="vertical"?l.jsx(lP,{...y,ref:e,onThumbPositionChange:()=>{if(r.viewport&&c.current){const x=r.viewport.scrollTop,w=Gx(x,h);c.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:x=>{r.viewport&&(r.viewport.scrollTop=x)},onDragScroll:x=>{r.viewport&&(r.viewport.scrollTop=b(x))}}):null}),rP=m.forwardRef((n,e)=>{const{sizes:i,onSizesChange:a,...r}=n,c=Dn(Jn,n.__scopeScrollArea),[d,h]=m.useState(),f=m.useRef(null),p=Ie(e,f,c.onScrollbarXChange);return m.useEffect(()=>{f.current&&h(getComputedStyle(f.current))},[f]),l.jsx(gC,{"data-orientation":"horizontal",...r,ref:p,sizes:i,style:{bottom:0,left:c.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:c.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Jc(i)+"px",...n.style},onThumbPointerDown:y=>n.onThumbPointerDown(y.x),onDragScroll:y=>n.onDragScroll(y.x),onWheelScroll:(y,b)=>{if(c.viewport){const x=c.viewport.scrollLeft+y.deltaX;n.onWheelScroll(x),wC(x,b)&&y.preventDefault()}},onResize:()=>{f.current&&c.viewport&&d&&a({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:Cc(d.paddingLeft),paddingEnd:Cc(d.paddingRight)}})}})}),lP=m.forwardRef((n,e)=>{const{sizes:i,onSizesChange:a,...r}=n,c=Dn(Jn,n.__scopeScrollArea),[d,h]=m.useState(),f=m.useRef(null),p=Ie(e,f,c.onScrollbarYChange);return m.useEffect(()=>{f.current&&h(getComputedStyle(f.current))},[f]),l.jsx(gC,{"data-orientation":"vertical",...r,ref:p,sizes:i,style:{top:0,right:c.dir==="ltr"?0:void 0,left:c.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Jc(i)+"px",...n.style},onThumbPointerDown:y=>n.onThumbPointerDown(y.y),onDragScroll:y=>n.onDragScroll(y.y),onWheelScroll:(y,b)=>{if(c.viewport){const x=c.viewport.scrollTop+y.deltaY;n.onWheelScroll(x),wC(x,b)&&y.preventDefault()}},onResize:()=>{f.current&&c.viewport&&d&&a({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:Cc(d.paddingTop),paddingEnd:Cc(d.paddingBottom)}})}})}),[cP,pC]=uC(Jn),gC=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,sizes:a,hasThumb:r,onThumbChange:c,onThumbPointerUp:d,onThumbPointerDown:h,onThumbPositionChange:f,onDragScroll:p,onWheelScroll:y,onResize:b,...x}=n,w=Dn(Jn,i),[E,C]=m.useState(null),S=Ie(e,G=>C(G)),D=m.useRef(null),N=m.useRef(""),k=w.viewport,T=a.content-a.viewport,R=Gt(y),z=Gt(f),O=eu(b,10);function A(G){if(D.current){const U=G.clientX-D.current.left,B=G.clientY-D.current.top;p({x:U,y:B})}}return m.useEffect(()=>{const G=U=>{const B=U.target;E?.contains(B)&&R(U,T)};return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[k,E,T,R]),m.useEffect(z,[a,z]),Ba(E,O),Ba(w.content,O),l.jsx(cP,{scope:i,scrollbar:E,hasThumb:r,onThumbChange:Gt(c),onThumbPointerUp:Gt(d),onThumbPositionChange:z,onThumbPointerDown:Gt(h),children:l.jsx(je.div,{...x,ref:S,style:{position:"absolute",...x.style},onPointerDown:we(n.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),D.current=E.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",w.viewport&&(w.viewport.style.scrollBehavior="auto"),A(G))}),onPointerMove:we(n.onPointerMove,A),onPointerUp:we(n.onPointerUp,G=>{const U=G.target;U.hasPointerCapture(G.pointerId)&&U.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=N.current,w.viewport&&(w.viewport.style.scrollBehavior=""),D.current=null})})})}),Sc="ScrollAreaThumb",vC=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=pC(Sc,n.__scopeScrollArea);return l.jsx(qt,{present:i||r.hasThumb,children:l.jsx(uP,{ref:e,...a})})}),uP=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,style:a,...r}=n,c=Dn(Sc,i),d=pC(Sc,i),{onThumbPositionChange:h}=d,f=Ie(e,b=>d.onThumbChange(b)),p=m.useRef(void 0),y=eu(()=>{p.current&&(p.current(),p.current=void 0)},100);return m.useEffect(()=>{const b=c.viewport;if(b){const x=()=>{if(y(),!p.current){const w=fP(b,h);p.current=w,h()}};return h(),b.addEventListener("scroll",x),()=>b.removeEventListener("scroll",x)}},[c.viewport,y,h]),l.jsx(je.div,{"data-state":d.hasThumb?"visible":"hidden",...r,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:we(n.onPointerDownCapture,b=>{const w=b.target.getBoundingClientRect(),E=b.clientX-w.left,C=b.clientY-w.top;d.onThumbPointerDown({x:E,y:C})}),onPointerUp:we(n.onPointerUp,d.onThumbPointerUp)})});vC.displayName=Sc;var Hm="ScrollAreaCorner",yC=m.forwardRef((n,e)=>{const i=Dn(Hm,n.__scopeScrollArea),a=!!(i.scrollbarX&&i.scrollbarY);return i.type!=="scroll"&&a?l.jsx(dP,{...n,ref:e}):null});yC.displayName=Hm;var dP=m.forwardRef((n,e)=>{const{__scopeScrollArea:i,...a}=n,r=Dn(Hm,i),[c,d]=m.useState(0),[h,f]=m.useState(0),p=!!(c&&h);return Ba(r.scrollbarX,()=>{const y=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(y),f(y)}),Ba(r.scrollbarY,()=>{const y=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(y),d(y)}),p?l.jsx(je.div,{...a,ref:e,style:{width:c,height:h,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function Cc(n){return n?parseInt(n,10):0}function bC(n,e){const i=n/e;return isNaN(i)?0:i}function Jc(n){const e=bC(n.viewport,n.content),i=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,a=(n.scrollbar.size-i)*e;return Math.max(a,18)}function hP(n,e,i,a="ltr"){const r=Jc(i),c=r/2,d=e||c,h=r-d,f=i.scrollbar.paddingStart+d,p=i.scrollbar.size-i.scrollbar.paddingEnd-h,y=i.content-i.viewport,b=a==="ltr"?[0,y]:[y*-1,0];return xC([f,p],b)(n)}function Gx(n,e,i="ltr"){const a=Jc(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,c=e.scrollbar.size-r,d=e.content-e.viewport,h=c-a,f=i==="ltr"?[0,d]:[d*-1,0],p=Tf(n,f);return xC([0,d],[0,h])(p)}function xC(n,e){return i=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const a=(e[1]-e[0])/(n[1]-n[0]);return e[0]+a*(i-n[0])}}function wC(n,e){return n>0&&n<e}var fP=(n,e=()=>{})=>{let i={left:n.scrollLeft,top:n.scrollTop},a=0;return(function r(){const c={left:n.scrollLeft,top:n.scrollTop},d=i.left!==c.left,h=i.top!==c.top;(d||h)&&e(),i=c,a=window.requestAnimationFrame(r)})(),()=>window.cancelAnimationFrame(a)};function eu(n,e){const i=Gt(n),a=m.useRef(0);return m.useEffect(()=>()=>window.clearTimeout(a.current),[]),m.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(i,e)},[i,e])}function Ba(n,e){const i=Gt(e);Dt(()=>{let a=0;if(n){const r=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(i)});return r.observe(n),()=>{window.cancelAnimationFrame(a),r.unobserve(n)}}},[n,i])}var SC=dC,mP=fC,pP=yC;const Vm=m.forwardRef(({className:n,children:e,...i},a)=>l.jsxs(SC,{ref:a,className:ye("relative overflow-hidden",n),...i,children:[l.jsx(mP,{className:"h-full w-full rounded-[inherit]",children:e}),l.jsx(CC,{}),l.jsx(pP,{})]}));Vm.displayName=SC.displayName;const CC=m.forwardRef(({className:n,orientation:e="vertical",...i},a)=>l.jsx(Gm,{ref:a,orientation:e,className:ye("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",n),...i,children:l.jsx(vC,{className:"relative flex-1 rounded-full bg-border"})}));CC.displayName=Gm.displayName;var tu="Collapsible",[gP]=cn(tu),[vP,Fm]=gP(tu),_C=m.forwardRef((n,e)=>{const{__scopeCollapsible:i,open:a,defaultOpen:r,disabled:c,onOpenChange:d,...h}=n,[f,p]=En({prop:a,defaultProp:r??!1,onChange:d,caller:tu});return l.jsx(vP,{scope:i,disabled:c,contentId:Mt(),open:f,onOpenToggle:m.useCallback(()=>p(y=>!y),[p]),children:l.jsx(je.div,{"data-state":$m(f),"data-disabled":c?"":void 0,...h,ref:e})})});_C.displayName=tu;var EC="CollapsibleTrigger",DC=m.forwardRef((n,e)=>{const{__scopeCollapsible:i,...a}=n,r=Fm(EC,i);return l.jsx(je.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":$m(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...a,ref:e,onClick:we(n.onClick,r.onOpenToggle)})});DC.displayName=EC;var Um="CollapsibleContent",AC=m.forwardRef((n,e)=>{const{forceMount:i,...a}=n,r=Fm(Um,n.__scopeCollapsible);return l.jsx(qt,{present:i||r.open,children:({present:c})=>l.jsx(yP,{...a,ref:e,present:c})})});AC.displayName=Um;var yP=m.forwardRef((n,e)=>{const{__scopeCollapsible:i,present:a,children:r,...c}=n,d=Fm(Um,i),[h,f]=m.useState(a),p=m.useRef(null),y=Ie(e,p),b=m.useRef(0),x=b.current,w=m.useRef(0),E=w.current,C=d.open||h,S=m.useRef(C),D=m.useRef(void 0);return m.useEffect(()=>{const N=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(N)},[]),Dt(()=>{const N=p.current;if(N){D.current=D.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const k=N.getBoundingClientRect();b.current=k.height,w.current=k.width,S.current||(N.style.transitionDuration=D.current.transitionDuration,N.style.animationName=D.current.animationName),f(a)}},[d.open,a]),l.jsx(je.div,{"data-state":$m(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!C,...c,ref:y,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,"--radix-collapsible-content-width":E?`${E}px`:void 0,...n.style},children:C&&r})});function $m(n){return n?"open":"closed"}var bP=_C;const NC=bP,jC=DC,TC=AC;function xP(){const[n,e]=m.useState({}),[i,a]=m.useState(new Set),[r,c]=m.useState(null),d=m.useCallback(async h=>{if(!(n[h]||i.has(h))){a(f=>new Set(f).add(h)),c(null);try{const f=h?`?path=${encodeURIComponent(h)}`:"",p=await fetch(`/api/files${f}`);if(!p.ok)throw new Error(`Failed to list directory: ${p.statusText}`);const y=await p.json(),x=(Array.isArray(y)?y:y.entries??[]).sort((w,E)=>w.type!==E.type?w.type==="directory"?-1:1:w.name.localeCompare(E.name));e(w=>({...w,[h||"__root__"]:x}))}catch(f){c(f instanceof Error?f.message:"Failed to load directory")}finally{a(f=>{const p=new Set(f);return p.delete(h),p})}}},[n,i]);return{cache:n,loading:i,error:r,fetchDirectory:d}}function kC({entry:n,status:e,depth:i,onFileClick:a}){const r=e==="created"?"+":e==="modified"?"~":e==="deleted"?"-":null;return l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsxs("div",{role:"treeitem",className:`file-item${e?` file-${e}`:""}`,style:{paddingLeft:`${12+i*16}px`},tabIndex:0,"aria-label":`${n.name}${e?`, ${e}`:""}`,onClick:()=>a?.(n,e),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),a?.(n,e))},children:[r&&l.jsx("span",{className:`status-icon status-${e}`,"aria-hidden":"true",children:r}),l.jsx("span",{className:"file-name",children:n.name})]})}),l.jsx(Te,{children:n.path})]})}function RC({entry:n,depth:e,changedFiles:i,onFileClick:a,fetchDirectory:r,cache:c,loading:d}){const h=Array.from(i.keys()).some(w=>w.startsWith(n.path+"/")),[f,p]=m.useState(h),y=c[n.path],b=d.has(n.path);m.useEffect(()=>{h&&!y&&!d.has(n.path)&&r(n.path)},[h,y,n.path,r,d]),m.useEffect(()=>{h&&p(!0)},[h]);const x=m.useCallback(()=>{const w=!f;p(w),w&&!y&&r(n.path)},[f,y,n.path,r]);return l.jsxs(NC,{open:f,onOpenChange:x,children:[l.jsx(jC,{asChild:!0,children:l.jsxs("div",{className:`directory-header${h?" has-changes":""}`,style:{paddingLeft:`${4+e*16}px`},children:[l.jsx("span",{className:"directory-toggle",children:l.jsx("span",{className:"toggle-icon",children:f?"▼":"▶"})}),l.jsx("span",{className:"directory-name",children:n.name})]})}),l.jsxs(TC,{children:[b&&l.jsx("div",{className:"tree-loading",style:{paddingLeft:`${12+(e+1)*16}px`},children:"Loading..."}),y?.map(w=>w.type==="directory"?l.jsx(RC,{entry:w,depth:e+1,changedFiles:i,onFileClick:a,fetchDirectory:r,cache:c,loading:d},w.path):l.jsx(kC,{entry:w,status:i.get(w.path),depth:e+1,onFileClick:a},w.path))]})]})}function wP({changedFiles:n,onFileClick:e}){const{cache:i,loading:a,error:r,fetchDirectory:c}=xP();m.useEffect(()=>{c("")},[]);const d=i.__root__,h=n.size;return l.jsx(St,{delayDuration:300,children:l.jsxs("div",{role:"tree","aria-label":"Project files",className:"filetree full-filetree",children:[h>0&&l.jsx($e,{variant:"secondary","data-testid":"file-count-badge",className:"file-count-badge","aria-label":`${h} files changed`,children:h}),l.jsxs(Vm,{className:"filetree-scroll",children:[r&&l.jsx("div",{className:"tree-error",children:r}),!d&&!r&&l.jsx("div",{className:"tree-loading",children:"Loading project files..."}),d?.map(f=>f.type==="directory"?l.jsx(RC,{entry:f,depth:0,changedFiles:n,onFileClick:e,fetchDirectory:c,cache:i,loading:a},f.path):l.jsx(kC,{entry:f,status:n.get(f.path),depth:0,onFileClick:e},f.path))]})]})})}function Bx(n){const e=n[0]||" ",i=n[1]||" ";return e==="D"||i==="D"?"deleted":e==="?"||e==="A"?"created":"modified"}function OC(){const{repos:n}=Lm(),e=m.useMemo(()=>{const a=new Map;for(const r of n)for(const c of r.files){const d=n.length>1?`${r.path}/${c.path}`:`${r.path}/${c.path}`;a.set(d,Bx(c.status)),a.set(c.path,Bx(c.status))}return a},[n]),i=m.useCallback((a,r)=>{fetch("/api/files/edit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a.path})}).catch(c=>console.error("[ChangedPanel] Failed to open file:",c))},[]);return l.jsx("div",{className:"changed-panel","data-testid":"changed-panel",children:l.jsx(wP,{changedFiles:e,onFileClick:i})})}const SP=2e3;function CP(){const[n,e]=m.useState([]),[i,a]=m.useState(null),r=m.useRef(null);m.useEffect(()=>{let h=null,f=!0;const p=()=>{const y=window.location.protocol==="https:"?"wss:":"ws:",b=new WebSocket(`${y}//${window.location.host}/ws/diffs`);r.current=b,b.onopen=()=>{console.log("[useDiffs] WebSocket connected")},b.onmessage=x=>{try{const w=JSON.parse(x.data);if(w.type==="init"){const E=w.diffs||[];e(E),E.length>0&&a(E[E.length-1])}else if(w.type==="diff"){const E=w.diff;e(C=>{const S=C.findIndex(D=>D.path===E.path);if(S>=0){const D=[...C];return D[S]=E,D}return[...C,E]}),a(E)}else if(w.type==="refresh"){const E=w.diffs||[];e(E),E.length>0?a(C=>{if(C){const S=E.find(D=>D.path===C.path);if(S)return S}return E[E.length-1]}):a(null)}}catch(w){console.error("[useDiffs] Failed to parse message:",w)}},b.onclose=()=>{f&&(h=setTimeout(p,SP))},b.onerror=x=>{console.error("[useDiffs] WebSocket error:",x),b.close()}};return p(),()=>{f=!1,h&&clearTimeout(h),r.current?.close()}},[]);const c=m.useCallback(h=>{const f=n.find(p=>p.path===h);a(f||null)},[n]),d=m.useCallback(()=>{e([]),a(null),r.current?.readyState===WebSocket.OPEN&&r.current.send(JSON.stringify({type:"clear"}))},[]);return{diffs:n,selectedDiff:i,selectDiff:c,clearDiffs:d}}function _P({line:n,type:e,lineNum:i}){return l.jsxs("div",{className:`diff-line diff-${e}`,children:[i!==void 0&&l.jsx("span",{className:"line-num",children:i}),l.jsx("span",{className:"line-content",children:n})]})}function EP(n){const e=n.split(`
65
65
  `),i=[];let a=0;for(const r of e)if(r.startsWith("diff --git")||r.startsWith("index ")||r.startsWith("---")||r.startsWith("+++"))i.push({line:r,type:"header"});else if(r.startsWith("@@")){const c=r.match(/@@ -\d+(?:,\d+)? \+(\d+)/);c&&(a=parseInt(c[1],10)-1),i.push({line:r,type:"hunk"})}else r.startsWith("+")?(a++,i.push({line:r.substring(1),type:"added",lineNum:a})):r.startsWith("-")?i.push({line:r.substring(1),type:"removed"}):r.startsWith(" ")||r===""?(a++,i.push({line:r.substring(1)||"",type:"context",lineNum:a})):i.push({line:r,type:"context"});return i}function DP({diff:n}){const e=n.diff&&n.diff.trim().length>0;let i;if(e)i=EP(n.diff);else{const r=(n.original||"").split(`
66
66
  `),c=(n.modified||"").split(`
67
- `);i=[],r.forEach((d,h)=>{c.includes(d)||i.push({line:d,type:"removed",lineNum:h+1})}),c.forEach((d,h)=>{const f=r.includes(d)?"context":"added";i.push({line:d,type:f,lineNum:h+1})})}const a=n.additions!==void 0&&n.deletions!==void 0?`+${n.additions} -${n.deletions}`:null;return l.jsxs("div",{className:"diff-view","data-testid":"diff-view",children:[l.jsxs("div",{className:"diff-header",children:[l.jsx("span",{className:"diff-path",children:n.path}),n.status&&l.jsx("span",{className:`diff-status diff-status-${n.status}`,children:n.status}),a&&l.jsx("span",{className:"diff-stats",children:a}),l.jsx("span",{className:"diff-tool",children:n.toolName})]}),l.jsx("div",{className:"diff-content",children:i.map((r,c)=>l.jsx(_P,{line:r.line,type:r.type,lineNum:r.lineNum},c))})]})}function zC(){const{diffs:n,selectedDiff:e,selectDiff:i,clearDiffs:a}=CP();return n.length===0?l.jsxs("div",{className:"diffs-panel empty","data-testid":"diffs-panel",children:[l.jsx("div",{className:"placeholder",children:"No diffs yet"}),l.jsx("p",{className:"hint",children:"Diffs appear when files are modified"})]}):l.jsxs("div",{className:"diffs-panel","data-testid":"diffs-panel",children:[l.jsxs("div",{className:"panel-header",children:[l.jsxs("span",{className:"diff-count",children:[n.length," file(s)"]}),l.jsx(Ce,{variant:"ghost",size:"sm",type:"button",className:"clear-button",onClick:a,children:"Clear"})]}),n.length>1&&l.jsx("div",{className:"diff-tabs",children:n.map(r=>l.jsx(Ce,{variant:e?.path===r.path?"secondary":"ghost",size:"sm",type:"button",className:`diff-tab ${e?.path===r.path?"active":""}`,onClick:()=>i(r.path),children:r.path.split("/").pop()},r.path))}),e&&l.jsx(DP,{diff:e})]})}function fr({open:n,onOpenChange:e,title:i,description:a,footer:r,className:c,children:d}){return l.jsx(qc,{open:n,onOpenChange:e,children:l.jsxs(ur,{className:ye("max-w-5xl max-h-[80vh] overflow-y-auto",c),children:[l.jsxs(Yc,{children:[l.jsx(Xc,{children:i}),a&&l.jsx(Qc,{children:a})]}),d,r&&l.jsx(_m,{children:r})]})})}function AP(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams({days:String(n.days)});n.repo&&y.set("repo",n.repo);const b=n.skipTypes??(n.includeOrchestrator?[]:["orchestrator"]);for(const x of b)y.append("skip_type",x);fetch(`/api/hotspots?${y}`,{signal:p.signal}).then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}: ${x.statusText}`);return x.json()}).then(x=>{i(x),r(!1)}).catch(x=>{x.name!=="AbortError"&&(d(x instanceof Error?x:new Error(String(x))),r(!1))})},[n.days,n.repo,n.skipTypes,n.includeOrchestrator]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}const NP=[30,60,90],jP=new Set([".ts",".tsx",".js",".jsx",".py",".md",".css",".scss",".html"]),TP=new Set([".json",".yaml",".yml",".toml",".env"]);function kP(n){const e=n.split("/").pop()||"";if(e.startsWith(".")&&!e.includes(".",1))return"."+e.slice(1);const i=e.lastIndexOf(".");return i>0?e.slice(i):""}function Hx(n,e,i){if(!e)return!0;const a=kP(n);return!!(jP.has(a)||i&&TP.has(a))}function wn({label:n,field:e,currentSort:i,currentDirection:a,onSort:r,align:c="right"}){const d=i===e,h=d?a==="desc"?" v":" ^":"";return l.jsxs("th",{className:`text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2 cursor-pointer select-none ${c==="left"?"text-left":"text-right"} ${d?"text-[var(--text-primary)]":""}`,onClick:()=>r(e),role:"columnheader","aria-sort":d?a==="desc"?"descending":"ascending":"none",children:[n,h]})}function RP({hotspots:n,sortField:e,sortDirection:i,onSort:a}){const r=m.useMemo(()=>{const c=[...n];return c.sort((d,h)=>{const f=d[e],p=h[e];if(typeof f=="number"&&typeof p=="number")return i==="desc"?p-f:f-p;const y=String(f),b=String(p);return i==="desc"?b.localeCompare(y):y.localeCompare(b)}),c},[n,e,i]);return l.jsxs("table",{className:"w-full text-sm",role:"table",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-[var(--border)]",children:[l.jsx(wn,{label:"Score",field:"hotspot_score",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"Changes",field:"change_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"Fixes",field:"bug_fix_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"Authors",field:"author_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"Churn",field:"churn",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"File",field:"path",currentSort:e,currentDirection:i,onSort:a,align:"left"})]})}),l.jsx("tbody",{children:r.map(c=>l.jsxs("tr",{className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"text-right py-1.5",children:l.jsx($e,{variant:c.hotspot_score>=50?"destructive":c.hotspot_score>=25?"outline":"secondary",children:c.hotspot_score.toFixed(1)})}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.change_count}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.bug_fix_count}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.author_count}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.churn}),l.jsx("td",{className:"text-left py-1.5",children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"truncate max-w-xs inline-block align-bottom font-mono text-xs",children:c.path})}),l.jsx(Te,{children:c.path})]})})]},c.path))})]})}function OP({hotspots:n,sortField:e,sortDirection:i,onSort:a}){const r=m.useMemo(()=>{const c=[...n];return c.sort((d,h)=>{const p={change_count:"total_changes",bug_fix_count:"total_bug_fixes",author_count:"avg_author_count",churn:"file_count"}[e]||e,y=d[p],b=h[p];return typeof y=="number"&&typeof b=="number"?i==="desc"?b-y:y-b:i==="desc"?String(b).localeCompare(String(y)):String(y).localeCompare(String(b))}),c},[n,e,i]);return l.jsxs("table",{className:"w-full text-sm",role:"table",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-[var(--border)]",children:[l.jsx(wn,{label:"Score",field:"hotspot_score",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"Changes",field:"change_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"Fixes",field:"bug_fix_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"Authors",field:"author_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"Files",field:"churn",currentSort:e,currentDirection:i,onSort:a}),l.jsx(wn,{label:"Directory",field:"path",currentSort:e,currentDirection:i,onSort:a,align:"left"})]})}),l.jsx("tbody",{children:r.map(c=>l.jsxs("tr",{className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"text-right py-1.5",children:l.jsx($e,{variant:c.hotspot_score>=50?"destructive":c.hotspot_score>=25?"outline":"secondary",children:c.hotspot_score.toFixed(1)})}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.total_changes}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.total_bug_fixes}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.avg_author_count.toFixed(1)}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.file_count}),l.jsx("td",{className:"text-left py-1.5",children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"truncate max-w-xs inline-block align-bottom font-mono text-xs",children:c.path})}),l.jsx(Te,{children:c.path})]})})]},c.path))})]})}function zP({open:n,onOpenChange:e}){const[i,a]=m.useState(90),[r,c]=m.useState("files"),[d,h]=m.useState("hotspot_score"),[f,p]=m.useState("desc"),[y,b]=m.useState(!1),[x,w]=m.useState(!1),[E,_]=m.useState(!1),{data:C,isLoading:D,error:N,refresh:k}=AP({days:i,includeOrchestrator:y}),T=m.useCallback($=>{h(ae=>ae===$?(p(ne=>ne==="desc"?"asc":"desc"),ae):(p("desc"),$))},[]),R=m.useMemo(()=>C?C.repo_results?C.repo_results:C.file_hotspots?[{success:C.success,repo_name:C.repo_name||"",repo_path:C.repo_path||"",time_window_days:C.time_window_days||i,commit_count:C.commit_count||0,file_hotspots:C.file_hotspots||[],directory_hotspots:C.directory_hotspots||[]}]:[]:[],[C,i]),z=m.useMemo(()=>{const $=[];for(const ae of R)ae.success&&$.push(...ae.file_hotspots);return $},[R]),O=m.useMemo(()=>{const $=[];for(const ae of R)ae.success&&$.push(...ae.directory_hotspots);return $},[R]),A=m.useMemo(()=>z.filter($=>Hx($.path,x,E)),[z,x,E]),G=m.useMemo(()=>O.filter($=>Hx($.path,x,E)),[O,x,E]),U=R.reduce(($,ae)=>$+(ae.commit_count||0),0),B=()=>D?l.jsx("div",{className:"hotspots-panel loading","data-testid":"hotspots-panel",children:l.jsxs("div",{className:"space-y-3 p-2",children:[l.jsx(fe,{className:"h-4 w-40"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-3/4"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-5/6"})]})}):N?l.jsxs("div",{className:"hotspots-panel error","data-testid":"hotspots-panel",children:[l.jsx("div",{className:"error-message",children:N.message}),l.jsx(Ce,{variant:"outline",size:"sm",onClick:k,children:"Retry"})]}):l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"hotspots-panel","data-testid":"hotspots-panel",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[l.jsx("div",{className:"flex gap-1",children:NP.map($=>l.jsxs(Ce,{variant:i===$?"default":"outline",size:"sm",onClick:()=>a($),children:[$,"d"]},$))}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx(Ce,{variant:r==="files"?"default":"outline",size:"sm",onClick:()=>c("files"),children:"Files"}),l.jsx(Ce,{variant:r==="dirs"?"default":"outline",size:"sm",onClick:()=>c("dirs"),children:"Dirs"})]}),l.jsx("div",{className:"ml-auto",children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"outline",size:"sm",onClick:k,children:"Analyze"})}),l.jsx(Te,{children:"Run hotspot analysis"})]})})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2",children:[l.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:y,onChange:$=>b($.target.checked)}),"Include orchestrator"]}),l.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[l.jsx("input",{type:"checkbox","aria-label":"Code only",checked:x,onChange:$=>w($.target.checked)}),"Code only"]}),l.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[l.jsx("input",{type:"checkbox","aria-label":"Include config",checked:E,disabled:!x,onChange:$=>_($.target.checked),className:"disabled:opacity-40"}),l.jsx("span",{className:x?"":"opacity-40",children:"Include config"})]})]})]}),C&&l.jsxs("div",{className:"flex gap-4 text-xs text-[var(--text-muted)]",children:[l.jsxs("span",{children:[U," commits"]}),l.jsxs("span",{children:[A.length," files"]}),l.jsxs("span",{children:[G.length," dirs"]})]}),!C&&l.jsxs("div",{className:"text-center py-12 text-[var(--text-muted)]",children:["Click ",l.jsx("strong",{children:"Analyze"})," to detect code hotspots"]}),C&&r==="files"&&(A.length>0?l.jsx(RP,{hotspots:A.slice(0,50),sortField:d,sortDirection:f,onSort:T}):l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No file hotspots found"})),C&&r==="dirs"&&(G.length>0?l.jsx(OP,{hotspots:G.slice(0,50),sortField:d,sortDirection:f,onSort:T}):l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No directory hotspots found"}))]})});return l.jsx(fr,{open:n,onOpenChange:e,title:"Hotspots",description:"Files and directories ranked by change frequency and complexity",children:B()})}function MP(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams({days:String(n.days)});n.repo&&y.set("repo",n.repo),n.type&&y.set("type",n.type),fetch(`/api/code-markers?${y}`,{signal:p.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{i(b),r(!1)}).catch(b=>{b.name!=="AbortError"&&(d(b instanceof Error?b:new Error(String(b))),r(!1))})},[n.days,n.repo,n.type]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}function PP({open:n,onOpenChange:e}){const{data:i,isLoading:a,error:r,refresh:c}=MP({days:90,repo:"pennyfarthing"});m.useEffect(()=>{n&&c()},[n,c]);const[d,h]=m.useState("all"),[f,p]=m.useState("age_days"),[y,b]=m.useState("desc"),x=m.useMemo(()=>{if(!i?.markers)return[];switch(d){case"stale":return i.markers.filter(C=>C.is_stale);case"deprecated":return[];default:return i.markers}},[i,d]),w=m.useMemo(()=>{const C=[...x];return C.sort((D,N)=>{const k=D[f],T=N[f];if(typeof k=="string"&&typeof T=="string")return y==="asc"?k.localeCompare(T):T.localeCompare(k);const R=Number(k),z=Number(T);return y==="asc"?R-z:z-R}),C},[x,f,y]),E=C=>{f===C?b(D=>D==="asc"?"desc":"asc"):(p(C),b("desc"))},_=C=>f!==C?"":y==="desc"?" v":" ^";return l.jsxs(fr,{open:n,onOpenChange:e,title:"Code Markers",description:"TODO, FIXME, HACK, and XXX markers across the codebase",children:[a&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(fe,{className:"h-4 w-full"}),l.jsx(fe,{className:"h-4 w-3/4"}),l.jsx(fe,{className:"h-4 w-1/2"})]}),r&&l.jsx("div",{className:"p-4 rounded border border-[var(--status-error)]/20 bg-[var(--status-error)]/5 text-[var(--status-error)] text-sm",children:r.message}),!a&&!r&&i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex gap-4 text-xs text-[var(--text-muted)]","data-testid":"code-markers-summary",children:[l.jsxs("span",{"data-testid":"summary-total",children:["Total: ",l.jsx("span",{className:"tabular-nums font-mono",children:i.summary.total_markers})]}),l.jsxs("span",{"data-testid":"summary-stale",children:["Stale: ",l.jsx("span",{className:"tabular-nums font-mono",children:i.summary.stale_markers})]}),Object.entries(i.summary.by_type).map(([C,D])=>l.jsxs("span",{"data-testid":`summary-type-${C.toLowerCase()}`,children:[C,": ",l.jsx("span",{className:"tabular-nums font-mono",children:D})]},C))]}),l.jsx("div",{role:"tablist",className:"flex gap-4 border-b border-[var(--border)] mb-3",children:["all","stale","deprecated"].map(C=>l.jsx("button",{role:"tab","aria-selected":d===C,onClick:()=>h(C),className:`pb-2 text-sm capitalize ${d===C?"border-b-2 border-[var(--accent)] text-[var(--text-primary)] font-medium":"text-[var(--text-muted)]"}`,children:C},C))}),w.length===0?l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No markers found"}):l.jsxs("table",{role:"table",className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-[var(--border)]",children:[l.jsxs("th",{className:"cursor-pointer select-none text-left text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("marker_type"),children:["Type",_("marker_type")]}),l.jsxs("th",{className:"cursor-pointer select-none text-left text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("path"),children:["File",_("path")]}),l.jsxs("th",{className:"cursor-pointer select-none text-right text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("line"),children:["Line",_("line")]}),l.jsx("th",{className:"text-left text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",children:"Text"}),l.jsxs("th",{className:"cursor-pointer select-none text-left text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("author"),children:["Author",_("author")]}),l.jsxs("th",{className:"cursor-pointer select-none text-right text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("age_days"),children:["Age",_("age_days")]})]})}),l.jsx("tbody",{children:w.map((C,D)=>l.jsxs("tr",{className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"py-1.5",children:l.jsx($e,{variant:C.is_stale?"destructive":"secondary",children:C.marker_type})}),l.jsx("td",{className:"py-1.5 font-mono text-xs",children:C.path}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:C.line}),l.jsx("td",{className:"py-1.5 truncate max-w-xs",children:C.text}),l.jsx("td",{className:"py-1.5",children:C.author}),l.jsxs("td",{className:"text-right py-1.5 tabular-nums font-mono",children:[C.age_days,"d"]})]},`${C.path}:${C.line}:${D}`))})]})]})]})}function LP(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams;n.path&&y.set("path",n.path),n.top&&y.set("top",String(n.top)),fetch(`/api/complexity?${y}`,{signal:p.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{i(b),r(!1)}).catch(b=>{b.name!=="AbortError"&&(d(b instanceof Error?b:new Error(String(b))),r(!1))})},[n.path,n.top]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}function Na({label:n,field:e,currentSort:i,currentDirection:a,onSort:r,align:c="right"}){const d=i===e,h=d?a==="desc"?" v":" ^":"";return l.jsxs("th",{className:`text-${c} ${d?"active":""}`,onClick:()=>r(e),role:"columnheader","aria-sort":d?a==="desc"?"descending":"ascending":"none",style:{cursor:"pointer",userSelect:"none",padding:"4px 8px"},children:[n,h]})}function IP({open:n,onOpenChange:e}){const[i,a]=m.useState("avg_cyclomatic_complexity"),[r,c]=m.useState("desc"),{data:d,isLoading:h,error:f,refresh:p}=LP({});m.useEffect(()=>{n&&p()},[n,p]);const y=m.useCallback(w=>{a(E=>E===w?(c(_=>_==="desc"?"asc":"desc"),E):(c("desc"),w))},[]),b=m.useMemo(()=>{if(!d?.files)return[];const w=[...d.files];return w.sort((E,_)=>{const C=E[i],D=_[i];return typeof C=="number"&&typeof D=="number"?r==="desc"?D-C:C-D:r==="desc"?String(D).localeCompare(String(C)):String(C).localeCompare(String(D))}),w},[d,i,r]),x=()=>h?l.jsx("div",{className:"complexity-panel loading","data-testid":"complexity-panel",children:l.jsxs("div",{className:"space-y-3 p-2",children:[l.jsx(fe,{className:"h-4 w-40"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-3/4"})]})}):f?l.jsxs("div",{className:"complexity-panel error","data-testid":"complexity-panel",children:[l.jsxs("div",{className:"error-message",children:["Error: ",f.message]}),l.jsx(Ce,{variant:"outline",size:"sm",onClick:p,children:"Retry"})]}):d?l.jsxs("div",{className:"complexity-panel","data-testid":"complexity-panel",children:[l.jsx("div",{className:"complexity-summary",style:{marginBottom:"8px"},children:l.jsxs("span",{children:[d.file_count," files analyzed"]})}),l.jsxs("table",{className:"complexity-table",role:"table",style:{width:"100%",borderCollapse:"collapse"},children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx(Na,{label:"Complexity",field:"avg_cyclomatic_complexity",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"Nesting",field:"max_nesting_depth",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"Longest Fn",field:"longest_function",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"Lines",field:"total_lines",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"Functions",field:"function_count",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"File",field:"path",currentSort:i,currentDirection:r,onSort:y,align:"left"})]})}),l.jsx("tbody",{children:b.map(w=>l.jsxs("tr",{children:[l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:l.jsx($e,{variant:w.avg_cyclomatic_complexity>=7?"destructive":w.avg_cyclomatic_complexity>=4?"outline":"secondary",children:Number(w.avg_cyclomatic_complexity).toFixed(1)})}),l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:w.max_nesting_depth}),l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:w.longest_function}),l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:w.total_lines}),l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:w.function_count}),l.jsx("td",{className:"text-left",style:{padding:"4px 8px"},children:w.path})]},w.path))})]})]}):l.jsx("div",{className:"complexity-panel","data-testid":"complexity-panel",children:l.jsxs("p",{children:["Click ",l.jsx("strong",{children:"Analyze"})," to run complexity analysis"]})});return l.jsx(fr,{open:n,onOpenChange:e,title:"Complexity",description:"Cyclomatic complexity analysis",children:x()})}function GP(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams;n.path&&y.set("path",n.path),fetch(`/api/dependencies?${y}`,{signal:p.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{i(b),r(!1)}).catch(b=>{b.name!=="AbortError"&&(d(b instanceof Error?b:new Error(String(b))),r(!1))})},[n.path]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}function BP(n){return n==="high"||n==="critical"?"destructive":n==="moderate"?"outline":"secondary"}function HP({open:n,onOpenChange:e}){const{data:i,isLoading:a,error:r,refresh:c}=GP({});m.useEffect(()=>{n&&c()},[n,c]);const d=()=>a?l.jsx("div",{className:"dependencies-panel loading","data-testid":"dependencies-panel",children:l.jsxs("div",{className:"space-y-3 p-2",children:[l.jsx(fe,{className:"h-4 w-40"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-3/4"})]})}):r?l.jsxs("div",{className:"dependencies-panel error","data-testid":"dependencies-panel",children:[l.jsxs("div",{className:"error-message",children:["Error: ",r.message]}),l.jsx(Ce,{variant:"outline",size:"sm",onClick:c,children:"Retry"})]}):i?l.jsxs("div",{className:"dependencies-panel","data-testid":"dependencies-panel",children:[i.outdated.length>0&&l.jsxs("div",{className:"outdated-section",style:{marginBottom:"16px"},children:[l.jsxs("h4",{children:["Outdated Packages (",i.outdated.length,")"]}),l.jsxs("table",{role:"table",style:{width:"100%",borderCollapse:"collapse"},children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Package"}),l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Current"}),l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Wanted"}),l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Latest"}),l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Type"})]})}),l.jsx("tbody",{children:i.outdated.map(h=>l.jsxs("tr",{children:[l.jsx("td",{style:{padding:"4px 8px"},children:h.name}),l.jsx("td",{style:{padding:"4px 8px"},children:h.current}),l.jsx("td",{style:{padding:"4px 8px"},children:h.wanted}),l.jsx("td",{style:{padding:"4px 8px"},children:h.latest}),l.jsx("td",{style:{padding:"4px 8px"},children:h.type})]},h.name))})]})]}),i.advisories.length>0&&l.jsxs("div",{className:"security-section",children:[l.jsx("h4",{children:"Security Advisories"}),l.jsx("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:i.advisories.map(h=>l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[l.jsx($e,{variant:BP(h.severity),children:h.severity}),l.jsx("span",{children:h.count})]},h.severity))})]}),i.outdated.length===0&&i.advisories.length===0&&l.jsx("p",{children:"All dependencies are up to date with no known vulnerabilities."})]}):l.jsx("div",{className:"dependencies-panel","data-testid":"dependencies-panel",children:l.jsxs("p",{children:["Click ",l.jsx("strong",{children:"Analyze"})," to check dependencies"]})});return l.jsx(fr,{open:n,onOpenChange:e,title:"Dependencies",description:"Package staleness and security analysis",children:d()})}function VP(n,e=[]){let i=[];function a(c,d){const h=m.createContext(d);h.displayName=c+"Context";const f=i.length;i=[...i,d];const p=b=>{const{scope:x,children:w,...E}=b,_=x?.[n]?.[f]||h,C=m.useMemo(()=>E,Object.values(E));return l.jsx(_.Provider,{value:C,children:w})};p.displayName=c+"Provider";function y(b,x){const w=x?.[n]?.[f]||h,E=m.useContext(w);if(E)return E;if(d!==void 0)return d;throw new Error(`\`${b}\` must be used within \`${c}\``)}return[p,y]}const r=()=>{const c=i.map(d=>m.createContext(d));return function(h){const f=h?.[n]||c;return m.useMemo(()=>({[`__scope${n}`]:{...h,[n]:f}}),[h,f])}};return r.scopeName=n,[a,FP(r,...e)]}function FP(...n){const e=n[0];if(n.length===1)return e;const i=()=>{const a=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(c){const d=a.reduce((h,{useScope:f,scopeName:p})=>{const b=f(c)[`__scope${p}`];return{...h,...b}},{});return m.useMemo(()=>({[`__scope${e.scopeName}`]:d}),[d])}};return i.scopeName=e.scopeName,i}var Wm="Progress",qm=100,[UP]=VP(Wm),[$P,WP]=UP(Wm),MC=m.forwardRef((n,e)=>{const{__scopeProgress:i,value:a=null,max:r,getValueLabel:c=qP,...d}=n;(r||r===0)&&!Vx(r)&&console.error(YP(`${r}`,"Progress"));const h=Vx(r)?r:qm;a!==null&&!Fx(a,h)&&console.error(XP(`${a}`,"Progress"));const f=Fx(a,h)?a:null,p=_c(f)?c(f,h):void 0;return l.jsx($P,{scope:i,value:f,max:h,children:l.jsx(In.div,{"aria-valuemax":h,"aria-valuemin":0,"aria-valuenow":_c(f)?f:void 0,"aria-valuetext":p,role:"progressbar","data-state":IC(f,h),"data-value":f??void 0,"data-max":h,...d,ref:e})})});MC.displayName=Wm;var PC="ProgressIndicator",LC=m.forwardRef((n,e)=>{const{__scopeProgress:i,...a}=n,r=WP(PC,i);return l.jsx(In.div,{"data-state":IC(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...a,ref:e})});LC.displayName=PC;function qP(n,e){return`${Math.round(n/e*100)}%`}function IC(n,e){return n==null?"indeterminate":n===e?"complete":"loading"}function _c(n){return typeof n=="number"}function Vx(n){return _c(n)&&!isNaN(n)&&n>0}function Fx(n,e){return _c(n)&&!isNaN(n)&&n<=e&&n>=0}function YP(n,e){return`Invalid prop \`max\` of value \`${n}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${qm}\`.`}function XP(n,e){return`Invalid prop \`value\` of value \`${n}\` supplied to \`${e}\`. The \`value\` prop must be:
67
+ `);i=[],r.forEach((d,h)=>{c.includes(d)||i.push({line:d,type:"removed",lineNum:h+1})}),c.forEach((d,h)=>{const f=r.includes(d)?"context":"added";i.push({line:d,type:f,lineNum:h+1})})}const a=n.additions!==void 0&&n.deletions!==void 0?`+${n.additions} -${n.deletions}`:null;return l.jsxs("div",{className:"diff-view","data-testid":"diff-view",children:[l.jsxs("div",{className:"diff-header",children:[l.jsx("span",{className:"diff-path",children:n.path}),n.status&&l.jsx("span",{className:`diff-status diff-status-${n.status}`,children:n.status}),a&&l.jsx("span",{className:"diff-stats",children:a}),l.jsx("span",{className:"diff-tool",children:n.toolName})]}),l.jsx("div",{className:"diff-content",children:i.map((r,c)=>l.jsx(_P,{line:r.line,type:r.type,lineNum:r.lineNum},c))})]})}function zC(){const{diffs:n,selectedDiff:e,selectDiff:i,clearDiffs:a}=CP();return n.length===0?l.jsxs("div",{className:"diffs-panel empty","data-testid":"diffs-panel",children:[l.jsx("div",{className:"placeholder",children:"No diffs yet"}),l.jsx("p",{className:"hint",children:"Diffs appear when files are modified"})]}):l.jsxs("div",{className:"diffs-panel","data-testid":"diffs-panel",children:[l.jsxs("div",{className:"panel-header",children:[l.jsxs("span",{className:"diff-count",children:[n.length," file(s)"]}),l.jsx(Ce,{variant:"ghost",size:"sm",type:"button",className:"clear-button",onClick:a,children:"Clear"})]}),n.length>1&&l.jsx("div",{className:"diff-tabs",children:n.map(r=>l.jsx(Ce,{variant:e?.path===r.path?"secondary":"ghost",size:"sm",type:"button",className:`diff-tab ${e?.path===r.path?"active":""}`,onClick:()=>i(r.path),children:r.path.split("/").pop()},r.path))}),e&&l.jsx(DP,{diff:e})]})}function fr({open:n,onOpenChange:e,title:i,description:a,footer:r,className:c,children:d}){return l.jsx(qc,{open:n,onOpenChange:e,children:l.jsxs(ur,{className:ye("max-w-5xl max-h-[80vh] overflow-y-auto",c),children:[l.jsxs(Yc,{children:[l.jsx(Xc,{children:i}),a&&l.jsx(Qc,{children:a})]}),d,r&&l.jsx(_m,{children:r})]})})}function AP(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams({days:String(n.days)});n.repo&&y.set("repo",n.repo);const b=n.skipTypes??(n.includeOrchestrator?[]:["orchestrator"]);for(const x of b)y.append("skip_type",x);fetch(`/api/hotspots?${y}`,{signal:p.signal}).then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}: ${x.statusText}`);return x.json()}).then(x=>{i(x),r(!1)}).catch(x=>{x.name!=="AbortError"&&(d(x instanceof Error?x:new Error(String(x))),r(!1))})},[n.days,n.repo,n.skipTypes,n.includeOrchestrator]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}const NP=[30,60,90],jP=new Set([".ts",".tsx",".js",".jsx",".py",".md",".css",".scss",".html"]),TP=new Set([".json",".yaml",".yml",".toml",".env"]);function kP(n){const e=n.split("/").pop()||"";if(e.startsWith(".")&&!e.includes(".",1))return"."+e.slice(1);const i=e.lastIndexOf(".");return i>0?e.slice(i):""}function Hx(n,e,i){if(!e)return!0;const a=kP(n);return!!(jP.has(a)||i&&TP.has(a))}function Sn({label:n,field:e,currentSort:i,currentDirection:a,onSort:r,align:c="right"}){const d=i===e,h=d?a==="desc"?" v":" ^":"";return l.jsxs("th",{className:`text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2 cursor-pointer select-none ${c==="left"?"text-left":"text-right"} ${d?"text-[var(--text-primary)]":""}`,onClick:()=>r(e),role:"columnheader","aria-sort":d?a==="desc"?"descending":"ascending":"none",children:[n,h]})}function RP({hotspots:n,sortField:e,sortDirection:i,onSort:a}){const r=m.useMemo(()=>{const c=[...n];return c.sort((d,h)=>{const f=d[e],p=h[e];if(typeof f=="number"&&typeof p=="number")return i==="desc"?p-f:f-p;const y=String(f),b=String(p);return i==="desc"?b.localeCompare(y):y.localeCompare(b)}),c},[n,e,i]);return l.jsxs("table",{className:"w-full text-sm",role:"table",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-[var(--border)]",children:[l.jsx(Sn,{label:"Score",field:"hotspot_score",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"Changes",field:"change_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"Fixes",field:"bug_fix_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"Authors",field:"author_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"Churn",field:"churn",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"File",field:"path",currentSort:e,currentDirection:i,onSort:a,align:"left"})]})}),l.jsx("tbody",{children:r.map(c=>l.jsxs("tr",{className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"text-right py-1.5",children:l.jsx($e,{variant:c.hotspot_score>=50?"destructive":c.hotspot_score>=25?"outline":"secondary",children:c.hotspot_score.toFixed(1)})}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.change_count}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.bug_fix_count}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.author_count}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.churn}),l.jsx("td",{className:"text-left py-1.5",children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"truncate max-w-xs inline-block align-bottom font-mono text-xs",children:c.path})}),l.jsx(Te,{children:c.path})]})})]},c.path))})]})}function OP({hotspots:n,sortField:e,sortDirection:i,onSort:a}){const r=m.useMemo(()=>{const c=[...n];return c.sort((d,h)=>{const p={change_count:"total_changes",bug_fix_count:"total_bug_fixes",author_count:"avg_author_count",churn:"file_count"}[e]||e,y=d[p],b=h[p];return typeof y=="number"&&typeof b=="number"?i==="desc"?b-y:y-b:i==="desc"?String(b).localeCompare(String(y)):String(y).localeCompare(String(b))}),c},[n,e,i]);return l.jsxs("table",{className:"w-full text-sm",role:"table",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-[var(--border)]",children:[l.jsx(Sn,{label:"Score",field:"hotspot_score",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"Changes",field:"change_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"Fixes",field:"bug_fix_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"Authors",field:"author_count",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"Files",field:"churn",currentSort:e,currentDirection:i,onSort:a}),l.jsx(Sn,{label:"Directory",field:"path",currentSort:e,currentDirection:i,onSort:a,align:"left"})]})}),l.jsx("tbody",{children:r.map(c=>l.jsxs("tr",{className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"text-right py-1.5",children:l.jsx($e,{variant:c.hotspot_score>=50?"destructive":c.hotspot_score>=25?"outline":"secondary",children:c.hotspot_score.toFixed(1)})}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.total_changes}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.total_bug_fixes}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.avg_author_count.toFixed(1)}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:c.file_count}),l.jsx("td",{className:"text-left py-1.5",children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"truncate max-w-xs inline-block align-bottom font-mono text-xs",children:c.path})}),l.jsx(Te,{children:c.path})]})})]},c.path))})]})}function zP({open:n,onOpenChange:e}){const[i,a]=m.useState(90),[r,c]=m.useState("files"),[d,h]=m.useState("hotspot_score"),[f,p]=m.useState("desc"),[y,b]=m.useState(!1),[x,w]=m.useState(!1),[E,C]=m.useState(!1),{data:S,isLoading:D,error:N,refresh:k}=AP({days:i,includeOrchestrator:y}),T=m.useCallback($=>{h(ae=>ae===$?(p(ne=>ne==="desc"?"asc":"desc"),ae):(p("desc"),$))},[]),R=m.useMemo(()=>S?S.repo_results?S.repo_results:S.file_hotspots?[{success:S.success,repo_name:S.repo_name||"",repo_path:S.repo_path||"",time_window_days:S.time_window_days||i,commit_count:S.commit_count||0,file_hotspots:S.file_hotspots||[],directory_hotspots:S.directory_hotspots||[]}]:[]:[],[S,i]),z=m.useMemo(()=>{const $=[];for(const ae of R)ae.success&&$.push(...ae.file_hotspots);return $},[R]),O=m.useMemo(()=>{const $=[];for(const ae of R)ae.success&&$.push(...ae.directory_hotspots);return $},[R]),A=m.useMemo(()=>z.filter($=>Hx($.path,x,E)),[z,x,E]),G=m.useMemo(()=>O.filter($=>Hx($.path,x,E)),[O,x,E]),U=R.reduce(($,ae)=>$+(ae.commit_count||0),0),B=()=>D?l.jsx("div",{className:"hotspots-panel loading","data-testid":"hotspots-panel",children:l.jsxs("div",{className:"space-y-3 p-2",children:[l.jsx(fe,{className:"h-4 w-40"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-3/4"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-5/6"})]})}):N?l.jsxs("div",{className:"hotspots-panel error","data-testid":"hotspots-panel",children:[l.jsx("div",{className:"error-message",children:N.message}),l.jsx(Ce,{variant:"outline",size:"sm",onClick:k,children:"Retry"})]}):l.jsx(St,{delayDuration:300,children:l.jsxs("div",{className:"hotspots-panel","data-testid":"hotspots-panel",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[l.jsx("div",{className:"flex gap-1",children:NP.map($=>l.jsxs(Ce,{variant:i===$?"default":"outline",size:"sm",onClick:()=>a($),children:[$,"d"]},$))}),l.jsxs("div",{className:"flex gap-1",children:[l.jsx(Ce,{variant:r==="files"?"default":"outline",size:"sm",onClick:()=>c("files"),children:"Files"}),l.jsx(Ce,{variant:r==="dirs"?"default":"outline",size:"sm",onClick:()=>c("dirs"),children:"Dirs"})]}),l.jsx("div",{className:"ml-auto",children:l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"outline",size:"sm",onClick:k,children:"Analyze"})}),l.jsx(Te,{children:"Run hotspot analysis"})]})})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2",children:[l.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:y,onChange:$=>b($.target.checked)}),"Include orchestrator"]}),l.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[l.jsx("input",{type:"checkbox","aria-label":"Code only",checked:x,onChange:$=>w($.target.checked)}),"Code only"]}),l.jsxs("label",{className:"flex items-center gap-2 text-sm text-[var(--text-secondary)] cursor-pointer",children:[l.jsx("input",{type:"checkbox","aria-label":"Include config",checked:E,disabled:!x,onChange:$=>C($.target.checked),className:"disabled:opacity-40"}),l.jsx("span",{className:x?"":"opacity-40",children:"Include config"})]})]})]}),S&&l.jsxs("div",{className:"flex gap-4 text-xs text-[var(--text-muted)]",children:[l.jsxs("span",{children:[U," commits"]}),l.jsxs("span",{children:[A.length," files"]}),l.jsxs("span",{children:[G.length," dirs"]})]}),!S&&l.jsxs("div",{className:"text-center py-12 text-[var(--text-muted)]",children:["Click ",l.jsx("strong",{children:"Analyze"})," to detect code hotspots"]}),S&&r==="files"&&(A.length>0?l.jsx(RP,{hotspots:A.slice(0,50),sortField:d,sortDirection:f,onSort:T}):l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No file hotspots found"})),S&&r==="dirs"&&(G.length>0?l.jsx(OP,{hotspots:G.slice(0,50),sortField:d,sortDirection:f,onSort:T}):l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No directory hotspots found"}))]})});return l.jsx(fr,{open:n,onOpenChange:e,title:"Hotspots",description:"Files and directories ranked by change frequency and complexity",children:B()})}function MP(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams({days:String(n.days)});n.repo&&y.set("repo",n.repo),n.type&&y.set("type",n.type),fetch(`/api/code-markers?${y}`,{signal:p.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{i(b),r(!1)}).catch(b=>{b.name!=="AbortError"&&(d(b instanceof Error?b:new Error(String(b))),r(!1))})},[n.days,n.repo,n.type]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}function PP({open:n,onOpenChange:e}){const{data:i,isLoading:a,error:r,refresh:c}=MP({days:90,repo:"pennyfarthing"});m.useEffect(()=>{n&&c()},[n,c]);const[d,h]=m.useState("all"),[f,p]=m.useState("age_days"),[y,b]=m.useState("desc"),x=m.useMemo(()=>{if(!i?.markers)return[];switch(d){case"stale":return i.markers.filter(S=>S.is_stale);case"deprecated":return[];default:return i.markers}},[i,d]),w=m.useMemo(()=>{const S=[...x];return S.sort((D,N)=>{const k=D[f],T=N[f];if(typeof k=="string"&&typeof T=="string")return y==="asc"?k.localeCompare(T):T.localeCompare(k);const R=Number(k),z=Number(T);return y==="asc"?R-z:z-R}),S},[x,f,y]),E=S=>{f===S?b(D=>D==="asc"?"desc":"asc"):(p(S),b("desc"))},C=S=>f!==S?"":y==="desc"?" v":" ^";return l.jsxs(fr,{open:n,onOpenChange:e,title:"Code Markers",description:"TODO, FIXME, HACK, and XXX markers across the codebase",children:[a&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(fe,{className:"h-4 w-full"}),l.jsx(fe,{className:"h-4 w-3/4"}),l.jsx(fe,{className:"h-4 w-1/2"})]}),r&&l.jsx("div",{className:"p-4 rounded border border-[var(--status-error)]/20 bg-[var(--status-error)]/5 text-[var(--status-error)] text-sm",children:r.message}),!a&&!r&&i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex gap-4 text-xs text-[var(--text-muted)]","data-testid":"code-markers-summary",children:[l.jsxs("span",{"data-testid":"summary-total",children:["Total: ",l.jsx("span",{className:"tabular-nums font-mono",children:i.summary.total_markers})]}),l.jsxs("span",{"data-testid":"summary-stale",children:["Stale: ",l.jsx("span",{className:"tabular-nums font-mono",children:i.summary.stale_markers})]}),Object.entries(i.summary.by_type).map(([S,D])=>l.jsxs("span",{"data-testid":`summary-type-${S.toLowerCase()}`,children:[S,": ",l.jsx("span",{className:"tabular-nums font-mono",children:D})]},S))]}),l.jsx("div",{role:"tablist",className:"flex gap-4 border-b border-[var(--border)] mb-3",children:["all","stale","deprecated"].map(S=>l.jsx("button",{role:"tab","aria-selected":d===S,onClick:()=>h(S),className:`pb-2 text-sm capitalize ${d===S?"border-b-2 border-[var(--accent)] text-[var(--text-primary)] font-medium":"text-[var(--text-muted)]"}`,children:S},S))}),w.length===0?l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No markers found"}):l.jsxs("table",{role:"table",className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-[var(--border)]",children:[l.jsxs("th",{className:"cursor-pointer select-none text-left text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("marker_type"),children:["Type",C("marker_type")]}),l.jsxs("th",{className:"cursor-pointer select-none text-left text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("path"),children:["File",C("path")]}),l.jsxs("th",{className:"cursor-pointer select-none text-right text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("line"),children:["Line",C("line")]}),l.jsx("th",{className:"text-left text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",children:"Text"}),l.jsxs("th",{className:"cursor-pointer select-none text-left text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("author"),children:["Author",C("author")]}),l.jsxs("th",{className:"cursor-pointer select-none text-right text-xs font-medium uppercase tracking-wider text-[var(--text-muted)] pb-2",onClick:()=>E("age_days"),children:["Age",C("age_days")]})]})}),l.jsx("tbody",{children:w.map((S,D)=>l.jsxs("tr",{className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"py-1.5",children:l.jsx($e,{variant:S.is_stale?"destructive":"secondary",children:S.marker_type})}),l.jsx("td",{className:"py-1.5 font-mono text-xs",children:S.path}),l.jsx("td",{className:"text-right py-1.5 tabular-nums font-mono",children:S.line}),l.jsx("td",{className:"py-1.5 truncate max-w-xs",children:S.text}),l.jsx("td",{className:"py-1.5",children:S.author}),l.jsxs("td",{className:"text-right py-1.5 tabular-nums font-mono",children:[S.age_days,"d"]})]},`${S.path}:${S.line}:${D}`))})]})]})]})}function LP(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams;n.path&&y.set("path",n.path),n.top&&y.set("top",String(n.top)),fetch(`/api/complexity?${y}`,{signal:p.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{i(b),r(!1)}).catch(b=>{b.name!=="AbortError"&&(d(b instanceof Error?b:new Error(String(b))),r(!1))})},[n.path,n.top]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}function Na({label:n,field:e,currentSort:i,currentDirection:a,onSort:r,align:c="right"}){const d=i===e,h=d?a==="desc"?" v":" ^":"";return l.jsxs("th",{className:`text-${c} ${d?"active":""}`,onClick:()=>r(e),role:"columnheader","aria-sort":d?a==="desc"?"descending":"ascending":"none",style:{cursor:"pointer",userSelect:"none",padding:"4px 8px"},children:[n,h]})}function IP({open:n,onOpenChange:e}){const[i,a]=m.useState("avg_cyclomatic_complexity"),[r,c]=m.useState("desc"),{data:d,isLoading:h,error:f,refresh:p}=LP({});m.useEffect(()=>{n&&p()},[n,p]);const y=m.useCallback(w=>{a(E=>E===w?(c(C=>C==="desc"?"asc":"desc"),E):(c("desc"),w))},[]),b=m.useMemo(()=>{if(!d?.files)return[];const w=[...d.files];return w.sort((E,C)=>{const S=E[i],D=C[i];return typeof S=="number"&&typeof D=="number"?r==="desc"?D-S:S-D:r==="desc"?String(D).localeCompare(String(S)):String(S).localeCompare(String(D))}),w},[d,i,r]),x=()=>h?l.jsx("div",{className:"complexity-panel loading","data-testid":"complexity-panel",children:l.jsxs("div",{className:"space-y-3 p-2",children:[l.jsx(fe,{className:"h-4 w-40"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-3/4"})]})}):f?l.jsxs("div",{className:"complexity-panel error","data-testid":"complexity-panel",children:[l.jsxs("div",{className:"error-message",children:["Error: ",f.message]}),l.jsx(Ce,{variant:"outline",size:"sm",onClick:p,children:"Retry"})]}):d?l.jsxs("div",{className:"complexity-panel","data-testid":"complexity-panel",children:[l.jsx("div",{className:"complexity-summary",style:{marginBottom:"8px"},children:l.jsxs("span",{children:[d.file_count," files analyzed"]})}),l.jsxs("table",{className:"complexity-table",role:"table",style:{width:"100%",borderCollapse:"collapse"},children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx(Na,{label:"Complexity",field:"avg_cyclomatic_complexity",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"Nesting",field:"max_nesting_depth",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"Longest Fn",field:"longest_function",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"Lines",field:"total_lines",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"Functions",field:"function_count",currentSort:i,currentDirection:r,onSort:y}),l.jsx(Na,{label:"File",field:"path",currentSort:i,currentDirection:r,onSort:y,align:"left"})]})}),l.jsx("tbody",{children:b.map(w=>l.jsxs("tr",{children:[l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:l.jsx($e,{variant:w.avg_cyclomatic_complexity>=7?"destructive":w.avg_cyclomatic_complexity>=4?"outline":"secondary",children:Number(w.avg_cyclomatic_complexity).toFixed(1)})}),l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:w.max_nesting_depth}),l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:w.longest_function}),l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:w.total_lines}),l.jsx("td",{className:"text-right",style:{padding:"4px 8px"},children:w.function_count}),l.jsx("td",{className:"text-left",style:{padding:"4px 8px"},children:w.path})]},w.path))})]})]}):l.jsx("div",{className:"complexity-panel","data-testid":"complexity-panel",children:l.jsxs("p",{children:["Click ",l.jsx("strong",{children:"Analyze"})," to run complexity analysis"]})});return l.jsx(fr,{open:n,onOpenChange:e,title:"Complexity",description:"Cyclomatic complexity analysis",children:x()})}function GP(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams;n.path&&y.set("path",n.path),fetch(`/api/dependencies?${y}`,{signal:p.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{i(b),r(!1)}).catch(b=>{b.name!=="AbortError"&&(d(b instanceof Error?b:new Error(String(b))),r(!1))})},[n.path]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}function BP(n){return n==="high"||n==="critical"?"destructive":n==="moderate"?"outline":"secondary"}function HP({open:n,onOpenChange:e}){const{data:i,isLoading:a,error:r,refresh:c}=GP({});m.useEffect(()=>{n&&c()},[n,c]);const d=()=>a?l.jsx("div",{className:"dependencies-panel loading","data-testid":"dependencies-panel",children:l.jsxs("div",{className:"space-y-3 p-2",children:[l.jsx(fe,{className:"h-4 w-40"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-full"}),l.jsx(fe,{className:"h-3 w-3/4"})]})}):r?l.jsxs("div",{className:"dependencies-panel error","data-testid":"dependencies-panel",children:[l.jsxs("div",{className:"error-message",children:["Error: ",r.message]}),l.jsx(Ce,{variant:"outline",size:"sm",onClick:c,children:"Retry"})]}):i?l.jsxs("div",{className:"dependencies-panel","data-testid":"dependencies-panel",children:[i.outdated.length>0&&l.jsxs("div",{className:"outdated-section",style:{marginBottom:"16px"},children:[l.jsxs("h4",{children:["Outdated Packages (",i.outdated.length,")"]}),l.jsxs("table",{role:"table",style:{width:"100%",borderCollapse:"collapse"},children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Package"}),l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Current"}),l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Wanted"}),l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Latest"}),l.jsx("th",{className:"text-left",style:{padding:"4px 8px"},children:"Type"})]})}),l.jsx("tbody",{children:i.outdated.map(h=>l.jsxs("tr",{children:[l.jsx("td",{style:{padding:"4px 8px"},children:h.name}),l.jsx("td",{style:{padding:"4px 8px"},children:h.current}),l.jsx("td",{style:{padding:"4px 8px"},children:h.wanted}),l.jsx("td",{style:{padding:"4px 8px"},children:h.latest}),l.jsx("td",{style:{padding:"4px 8px"},children:h.type})]},h.name))})]})]}),i.advisories.length>0&&l.jsxs("div",{className:"security-section",children:[l.jsx("h4",{children:"Security Advisories"}),l.jsx("div",{style:{display:"flex",gap:"8px",flexWrap:"wrap"},children:i.advisories.map(h=>l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[l.jsx($e,{variant:BP(h.severity),children:h.severity}),l.jsx("span",{children:h.count})]},h.severity))})]}),i.outdated.length===0&&i.advisories.length===0&&l.jsx("p",{children:"All dependencies are up to date with no known vulnerabilities."})]}):l.jsx("div",{className:"dependencies-panel","data-testid":"dependencies-panel",children:l.jsxs("p",{children:["Click ",l.jsx("strong",{children:"Analyze"})," to check dependencies"]})});return l.jsx(fr,{open:n,onOpenChange:e,title:"Dependencies",description:"Package staleness and security analysis",children:d()})}function VP(n,e=[]){let i=[];function a(c,d){const h=m.createContext(d);h.displayName=c+"Context";const f=i.length;i=[...i,d];const p=b=>{const{scope:x,children:w,...E}=b,C=x?.[n]?.[f]||h,S=m.useMemo(()=>E,Object.values(E));return l.jsx(C.Provider,{value:S,children:w})};p.displayName=c+"Provider";function y(b,x){const w=x?.[n]?.[f]||h,E=m.useContext(w);if(E)return E;if(d!==void 0)return d;throw new Error(`\`${b}\` must be used within \`${c}\``)}return[p,y]}const r=()=>{const c=i.map(d=>m.createContext(d));return function(h){const f=h?.[n]||c;return m.useMemo(()=>({[`__scope${n}`]:{...h,[n]:f}}),[h,f])}};return r.scopeName=n,[a,FP(r,...e)]}function FP(...n){const e=n[0];if(n.length===1)return e;const i=()=>{const a=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(c){const d=a.reduce((h,{useScope:f,scopeName:p})=>{const b=f(c)[`__scope${p}`];return{...h,...b}},{});return m.useMemo(()=>({[`__scope${e.scopeName}`]:d}),[d])}};return i.scopeName=e.scopeName,i}var Wm="Progress",qm=100,[UP]=VP(Wm),[$P,WP]=UP(Wm),MC=m.forwardRef((n,e)=>{const{__scopeProgress:i,value:a=null,max:r,getValueLabel:c=qP,...d}=n;(r||r===0)&&!Vx(r)&&console.error(YP(`${r}`,"Progress"));const h=Vx(r)?r:qm;a!==null&&!Fx(a,h)&&console.error(XP(`${a}`,"Progress"));const f=Fx(a,h)?a:null,p=_c(f)?c(f,h):void 0;return l.jsx($P,{scope:i,value:f,max:h,children:l.jsx(In.div,{"aria-valuemax":h,"aria-valuemin":0,"aria-valuenow":_c(f)?f:void 0,"aria-valuetext":p,role:"progressbar","data-state":IC(f,h),"data-value":f??void 0,"data-max":h,...d,ref:e})})});MC.displayName=Wm;var PC="ProgressIndicator",LC=m.forwardRef((n,e)=>{const{__scopeProgress:i,...a}=n,r=WP(PC,i);return l.jsx(In.div,{"data-state":IC(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...a,ref:e})});LC.displayName=PC;function qP(n,e){return`${Math.round(n/e*100)}%`}function IC(n,e){return n==null?"indeterminate":n===e?"complete":"loading"}function _c(n){return typeof n=="number"}function Vx(n){return _c(n)&&!isNaN(n)&&n>0}function Fx(n,e){return _c(n)&&!isNaN(n)&&n<=e&&n>=0}function YP(n,e){return`Invalid prop \`max\` of value \`${n}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${qm}\`.`}function XP(n,e){return`Invalid prop \`value\` of value \`${n}\` supplied to \`${e}\`. The \`value\` prop must be:
68
68
  - a positive number
69
69
  - less than the value passed to \`max\` (or ${qm} if no \`max\` prop is set)
70
70
  - \`null\` or \`undefined\` if the progress is indeterminate.
71
71
 
72
- Defaulting to \`null\`.`}var GC=MC,QP=LC;const BC=m.forwardRef(({className:n,value:e,indicatorClassName:i,...a},r)=>l.jsx(GC,{ref:r,className:ye("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...a,children:l.jsx(QP,{className:ye("h-full w-full flex-1 bg-primary transition-all",i),style:{transform:`translateX(-${100-(e||0)}%)`}})}));BC.displayName=GC.displayName;var HC="AlertDialog",[ZP]=cn(HC,[G0]),Ci=G0(),VC=n=>{const{__scopeAlertDialog:e,...i}=n,a=Ci(e);return l.jsx(ym,{...a,...i,modal:!0})};VC.displayName=HC;var KP="AlertDialogTrigger",JP=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(bO,{...r,...a,ref:e})});JP.displayName=KP;var eL="AlertDialogPortal",FC=n=>{const{__scopeAlertDialog:e,...i}=n,a=Ci(e);return l.jsx(bm,{...a,...i})};FC.displayName=eL;var tL="AlertDialogOverlay",UC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(Uc,{...r,...a,ref:e})});UC.displayName=tL;var Ma="AlertDialogContent",[nL,iL]=ZP(Ma),sL=_w("AlertDialogContent"),$C=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,children:a,...r}=n,c=Ci(i),d=m.useRef(null),h=Ie(e,d),f=m.useRef(null);return l.jsx(pO,{contentName:Ma,titleName:WC,docsSlug:"alert-dialog",children:l.jsx(nL,{scope:i,cancelRef:f,children:l.jsxs($c,{role:"alertdialog",...c,...r,ref:h,onOpenAutoFocus:we(r.onOpenAutoFocus,p=>{p.preventDefault(),f.current?.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[l.jsx(sL,{children:a}),l.jsx(oL,{contentRef:d})]})})})});$C.displayName=Ma;var WC="AlertDialogTitle",qC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(xm,{...r,...a,ref:e})});qC.displayName=WC;var YC="AlertDialogDescription",XC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(wm,{...r,...a,ref:e})});XC.displayName=YC;var aL="AlertDialogAction",QC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(Sm,{...r,...a,ref:e})});QC.displayName=aL;var ZC="AlertDialogCancel",KC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,{cancelRef:r}=iL(ZC,i),c=Ci(i),d=Ie(e,r);return l.jsx(Sm,{...c,...a,ref:d})});KC.displayName=ZC;var oL=({contentRef:n})=>{const e=`\`${Ma}\` requires a description for the component to be accessible for screen reader users.
72
+ Defaulting to \`null\`.`}var GC=MC,QP=LC;const BC=m.forwardRef(({className:n,value:e,indicatorClassName:i,...a},r)=>l.jsx(GC,{ref:r,className:ye("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...a,children:l.jsx(QP,{className:ye("h-full w-full flex-1 bg-primary transition-all",i),style:{transform:`translateX(-${100-(e||0)}%)`}})}));BC.displayName=GC.displayName;var HC="AlertDialog",[ZP]=cn(HC,[GS]),Ci=GS(),VC=n=>{const{__scopeAlertDialog:e,...i}=n,a=Ci(e);return l.jsx(ym,{...a,...i,modal:!0})};VC.displayName=HC;var KP="AlertDialogTrigger",JP=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(bO,{...r,...a,ref:e})});JP.displayName=KP;var eL="AlertDialogPortal",FC=n=>{const{__scopeAlertDialog:e,...i}=n,a=Ci(e);return l.jsx(bm,{...a,...i})};FC.displayName=eL;var tL="AlertDialogOverlay",UC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(Uc,{...r,...a,ref:e})});UC.displayName=tL;var Ma="AlertDialogContent",[nL,iL]=ZP(Ma),sL=_w("AlertDialogContent"),$C=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,children:a,...r}=n,c=Ci(i),d=m.useRef(null),h=Ie(e,d),f=m.useRef(null);return l.jsx(pO,{contentName:Ma,titleName:WC,docsSlug:"alert-dialog",children:l.jsx(nL,{scope:i,cancelRef:f,children:l.jsxs($c,{role:"alertdialog",...c,...r,ref:h,onOpenAutoFocus:we(r.onOpenAutoFocus,p=>{p.preventDefault(),f.current?.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[l.jsx(sL,{children:a}),l.jsx(oL,{contentRef:d})]})})})});$C.displayName=Ma;var WC="AlertDialogTitle",qC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(xm,{...r,...a,ref:e})});qC.displayName=WC;var YC="AlertDialogDescription",XC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(wm,{...r,...a,ref:e})});XC.displayName=YC;var aL="AlertDialogAction",QC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,r=Ci(i);return l.jsx(Sm,{...r,...a,ref:e})});QC.displayName=aL;var ZC="AlertDialogCancel",KC=m.forwardRef((n,e)=>{const{__scopeAlertDialog:i,...a}=n,{cancelRef:r}=iL(ZC,i),c=Ci(i),d=Ie(e,r);return l.jsx(Sm,{...c,...a,ref:d})});KC.displayName=ZC;var oL=({contentRef:n})=>{const e=`\`${Ma}\` requires a description for the component to be accessible for screen reader users.
73
73
 
74
74
  You can add a description to the \`${Ma}\` by passing a \`${YC}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
75
75
 
76
76
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ma}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
77
77
 
78
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return m.useEffect(()=>{document.getElementById(n.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,n]),null},rL=VC,lL=FC,JC=UC,e_=$C,t_=QC,n_=KC,i_=qC,s_=XC;const cL=rL,uL=lL,a_=m.forwardRef(({className:n,...e},i)=>l.jsx(JC,{className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...e,ref:i}));a_.displayName=JC.displayName;const o_=m.forwardRef(({className:n,...e},i)=>l.jsxs(uL,{children:[l.jsx(a_,{}),l.jsx(e_,{ref:i,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...e})]}));o_.displayName=e_.displayName;const r_=({className:n,...e})=>l.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",n),...e});r_.displayName="AlertDialogHeader";const l_=({className:n,...e})=>l.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e});l_.displayName="AlertDialogFooter";const c_=m.forwardRef(({className:n,...e},i)=>l.jsx(i_,{ref:i,className:ye("text-lg font-semibold",n),...e}));c_.displayName=i_.displayName;const u_=m.forwardRef(({className:n,...e},i)=>l.jsx(s_,{ref:i,className:ye("text-sm text-muted-foreground",n),...e}));u_.displayName=s_.displayName;const d_=m.forwardRef(({className:n,...e},i)=>l.jsx(t_,{ref:i,className:ye(Dc(),n),...e}));d_.displayName=t_.displayName;const h_=m.forwardRef(({className:n,...e},i)=>l.jsx(n_,{ref:i,className:ye(Dc({variant:"outline"}),"mt-2 sm:mt-0",n),...e}));h_.displayName=n_.displayName;function dL({isOpen:n,title:e,message:i,confirmLabel:a="Confirm",cancelLabel:r="Cancel",isDanger:c=!1,onConfirm:d,onCancel:h}){return l.jsx(cL,{open:n,onOpenChange:f=>{f||h()},children:l.jsxs(o_,{children:[l.jsxs(r_,{children:[l.jsx(c_,{children:e}),l.jsx(u_,{children:i})]}),l.jsxs(l_,{children:[l.jsx(h_,{onClick:h,children:r}),l.jsx(d_,{className:ye(c&&Dc({variant:"destructive"})),onClick:d,children:a})]})]})})}function hL(n){const[e,i]=ue.useState(!1),a=m.useRef(null),r=m.useCallback(()=>new Promise(f=>{a.current=f,i(!0)}),[]),c=m.useCallback(()=>{i(!1),a.current?.(!0),a.current=null},[]),d=m.useCallback(()=>{i(!1),a.current?.(!1),a.current=null},[]),h={isOpen:e,title:n.title,message:n.message,confirmLabel:n.confirmLabel,cancelLabel:n.cancelLabel,isDanger:n.isDanger,onConfirm:c,onCancel:d};return{isOpen:e,confirm:r,dialogProps:h}}function fL(){const[n,e]=m.useState(null),[i,a]=m.useState(!1),[r,c]=m.useState(null),[d,h]=m.useState(null),f=m.useRef(null),p=m.useCallback(()=>{f.current&&f.current.abort();const b=new AbortController;f.current=b,a(!0),c(null),fetch("/api/agent-load",{signal:b.signal}).then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}: ${x.statusText}`);return x.json()}).then(x=>{e(x),a(!1)}).catch(x=>{x.name!=="AbortError"&&(c(x instanceof Error?x:new Error(String(x))),a(!1))})},[]),y=m.useCallback(async(b,x)=>{const w=await fetch("/api/agent-load/prune-sidecar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:b,file:x})});if(!w.ok){h({success:!1,error:`HTTP ${w.status}: ${w.statusText}`});return}const E=await w.json();h(E),E.success&&p()},[p]);return m.useEffect(()=>()=>{f.current&&f.current.abort()},[]),{data:n,isLoading:i,error:r,refresh:p,pruneSidecar:y,pruneResult:d}}const mL=["patterns.md","gotchas.md","decisions.md"];function pL({isOpen:n,onClose:e}){const{data:i,isLoading:a,error:r,refresh:c,pruneSidecar:d,pruneResult:h}=fL(),[f,p]=m.useState(null),[y,b]=m.useState(null),{confirm:x,dialogProps:w}=hL({title:"Clear Sidecar",message:y?`Reset ${y.file} for ${y.agent}? This will replace the sidecar with its default template.`:"",confirmLabel:"Confirm",isDanger:!0});m.useEffect(()=>{n&&c()},[n,c]);const E=m.useMemo(()=>i?[...i.agents].sort((T,R)=>(R.totalTokens??0)-(T.totalTokens??0)):[],[i]),_=m.useMemo(()=>E.length?E[0]?.totalTokens??0:0,[E]),C=T=>{p(R=>R===T?null:T)},D=async(T,R)=>{b({agent:T,file:R}),await x()&&await d(T,R),b(null)},N=T=>{const R=T.totalTokens??0,z=_>0?R/_*100:0,O=f===T.agent,A=R>=5e3?"bg-[var(--status-error,#f14c4c)]":R>=3e3?"bg-[var(--status-warning,#cca700)]":"bg-[var(--status-success,#4ec9b0)]";return l.jsxs(NC,{open:O,onOpenChange:()=>C(T.agent),children:[l.jsx(jC,{asChild:!0,children:l.jsxs("div",{className:"px-4 py-2 cursor-pointer hover:bg-muted/50 rounded-md transition-colors","data-testid":`agent-row-${T.agent}`,children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"font-mono text-sm font-medium",children:T.agent}),l.jsx("span",{className:"font-mono text-sm tabular-nums text-text-secondary",children:R.toLocaleString()})]}),l.jsx(BC,{value:z,className:"h-2.5 bg-[var(--border)]",indicatorClassName:A})]})}),l.jsx(TC,{children:l.jsxs("div",{className:"mx-4 mb-3 rounded-md bg-muted/30 p-3 space-y-1",children:[T.components&&T.components.length>0?T.components.map(G=>l.jsxs("div",{className:"flex items-center justify-between text-xs text-text-secondary",children:[l.jsx("span",{children:f_(G.name)}),l.jsx("span",{className:"tabular-nums",children:G.tokens.toLocaleString()})]},G.name)):l.jsx("div",{className:"text-xs text-text-secondary",children:"No component breakdown available"}),l.jsxs("div",{className:"pt-2 border-t border-muted/50 mt-2",children:[l.jsx("div",{className:"text-xs font-medium mb-1.5 text-text-secondary",children:"Sidecars"}),l.jsx("div",{className:"flex gap-2",children:mL.map(G=>l.jsxs(Ce,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:U=>{U.stopPropagation(),D(T.agent,G)},children:["Clear ",G]},G))})]})]})})]},T.agent)},k=()=>a?l.jsx("div",{className:"space-y-3 p-4",children:Array.from({length:5}).map((T,R)=>l.jsxs("div",{"data-testid":`skeleton-${R}`,className:"space-y-1.5 px-4",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx(fe,{className:"h-4 w-24"}),l.jsx(fe,{className:"h-4 w-16"})]}),l.jsx(fe,{className:"h-2.5 w-full rounded-full"})]},R))}):r?l.jsxs("div",{className:"p-4 space-y-3",children:[l.jsx("div",{className:"p-4 rounded border border-[var(--status-error)]/20 bg-[var(--status-error)]/5 text-[var(--status-error)] text-sm",children:r.message}),l.jsx("div",{className:"text-center",children:l.jsx(Ce,{variant:"outline",size:"sm",onClick:c,children:"Retry"})})]}):i?l.jsxs("div",{className:"space-y-0.5",children:[h?.success&&h.tokensFreed!=null&&l.jsxs("div",{className:"text-xs text-green-600 px-4 py-1",children:["Freed ",h.tokensFreed.toLocaleString()," tokens from ",h.agent,"/",h.file]}),l.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[l.jsxs("span",{"data-testid":"cached-at",className:"text-xs text-[var(--text-muted)]",children:["Cached: ",new Date(i.cachedAt).toLocaleString()]}),l.jsx(Ce,{variant:"ghost",size:"sm",className:"text-xs h-6 text-[var(--text-muted)] hover:text-[var(--text-primary)]",onClick:c,children:"Refresh"})]}),E.map(T=>N(T))]}):null;return l.jsxs(l.Fragment,{children:[l.jsx(fr,{open:n,onOpenChange:T=>{T||e()},title:"Agent Load Analysis",description:"Token usage breakdown for all agents",className:"max-w-2xl",children:k()}),l.jsx(dL,{...w})]})}function gL(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams({days:String(n.days),layer:n.layer||"all"});n.repo&&y.set("repo",n.repo),fetch(`/api/dead-code?${y}`,{signal:p.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{i(b),r(!1)}).catch(b=>{b.name!=="AbortError"&&(d(b instanceof Error?b:new Error(String(b))),r(!1))})},[n.days,n.repo,n.layer]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}function vL({isOpen:n,onClose:e,days:i=180,repo:a}){const{data:r,isLoading:c,error:d,refresh:h}=gL({days:i,repo:a,layer:"all"}),[f,p]=m.useState("stale"),[y,b]=m.useState("days_since_last_commit"),[x,w]=m.useState("desc"),[E,_]=m.useState("file"),[C,D]=m.useState("asc");m.useEffect(()=>{n&&h()},[n,h]);const N=m.useCallback(A=>{w(G=>y===A&&G==="desc"?"asc":"desc"),b(A)},[y]),k=m.useCallback(A=>{D(G=>E===A&&G==="desc"?"asc":"desc"),_(A)},[E]),T=r?.stale_file_count??r?.stale_files?.length??0,R=r?.unused_export_count??r?.unused_exports?.length??0,z=m.useMemo(()=>{const A=[...r?.stale_files||[]];return A.sort((G,U)=>{const B=G[y],$=U[y];if(typeof B=="number"&&typeof $=="number")return x==="asc"?B-$:$-B;const ae=String(B),ne=String($);return x==="asc"?ae.localeCompare(ne):ne.localeCompare(ae)}),A},[r?.stale_files,y,x]),O=m.useMemo(()=>{const A=[...r?.unused_exports||[]];return A.sort((G,U)=>{const B=G[E],$=U[E];if(typeof B=="number"&&typeof $=="number")return C==="asc"?B-$:$-B;const ae=String(B),ne=String($);return C==="asc"?ae.localeCompare(ne):ne.localeCompare(ae)}),A},[r?.unused_exports,E,C]);return l.jsx(qc,{open:n,onOpenChange:A=>{A||e()},children:l.jsxs(ur,{className:"max-w-4xl max-h-[80vh]",children:[l.jsxs(Yc,{children:[l.jsx(Xc,{children:"Dead Code Analysis"}),l.jsx(Qc,{children:"Diagnostic report — files and exports with no recent activity."})]}),l.jsxs("div",{className:"flex gap-4 border-b border-[var(--border)]",children:[l.jsxs("button",{onClick:()=>p("stale"),className:ye("pb-2 text-sm",f==="stale"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)] font-medium":"text-[var(--text-muted)]"),children:["Stale Files ",l.jsx($e,{variant:"secondary",className:"ml-1",children:T})]}),l.jsxs("button",{onClick:()=>p("exports"),className:ye("pb-2 text-sm",f==="exports"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)] font-medium":"text-[var(--text-muted)]"),children:["Unused Exports ",l.jsx($e,{variant:"secondary",className:"ml-1",children:R})]})]}),l.jsxs(Vm,{className:"h-[50vh]",children:[c&&l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"Analyzing..."}),d&&l.jsx("div",{className:"m-4 p-4 rounded border border-[var(--status-error)]/20 bg-[var(--status-error)]/5 text-[var(--status-error)] text-sm",children:d.message}),r&&f==="stale"&&(z.length===0?l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No stale files found"}):l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{role:"row",className:"border-b border-[var(--border)]",children:[l.jsx("th",{className:"text-left pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>N("path"),children:"File"}),l.jsx("th",{className:"text-right pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>N("days_since_last_commit"),children:"Days Stale"}),l.jsx("th",{className:"text-right pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>N("size_bytes"),children:"Size"}),l.jsx("th",{className:"text-left pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>N("last_commit_date"),children:"Last Commit"})]})}),l.jsx("tbody",{children:z.map(A=>l.jsxs("tr",{role:"row",className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"py-1.5 font-mono text-xs",children:A.path}),l.jsx("td",{className:"py-1.5 text-right tabular-nums font-mono",children:A.days_since_last_commit}),l.jsx("td",{className:"py-1.5 text-right tabular-nums font-mono",children:yL(A.size_bytes)}),l.jsx("td",{className:"py-1.5",children:A.last_commit_date?new Date(A.last_commit_date).toLocaleDateString():"—"})]},A.path))})]})),r&&f==="exports"&&(O.length===0?l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No unused exports found"}):l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{role:"row",className:"border-b border-[var(--border)]",children:[l.jsx("th",{className:"text-left pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>k("file"),children:"File"}),l.jsx("th",{className:"text-left pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>k("symbol"),children:"Export"}),l.jsx("th",{className:"text-right pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>k("line"),children:"Line"})]})}),l.jsx("tbody",{children:O.map(A=>l.jsxs("tr",{role:"row",className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"py-1.5 font-mono text-xs",children:A.file}),l.jsx("td",{className:"py-1.5",children:A.symbol}),l.jsx("td",{className:"py-1.5 text-right tabular-nums font-mono",children:A.line})]},`${A.file}:${A.symbol}`))})]}))]})]})})}function yL(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}const bL=[{min:90,grade:"A",color:"#22c55e"},{min:75,grade:"B",color:"#84cc16"},{min:60,grade:"C",color:"#eab308"},{min:40,grade:"D",color:"#f97316"},{min:0,grade:"F",color:"#ef4444"}],Ux={churn:"Churn",todo_density:"TODO Density",complexity:"Complexity",test_gaps:"Test Gaps",dead_code:"Dead Code",deprecation_debt:"Deprecation Debt",dependency_freshness:"Dependency Freshness",agent_context_efficiency:"Agent Context Efficiency"};function xL(n){for(const e of bL)if(n>=e.min)return{grade:e.grade,color:e.color};return{grade:"F",color:"#ef4444"}}function $x(n,e,i,a,r){const c=Wx(n,e,i,r),d=Wx(n,e,i,a),h=r-a<=180?"0":"1";return`M ${c.x} ${c.y} A ${i} ${i} 0 ${h} 0 ${d.x} ${d.y}`}function Wx(n,e,i,a){const r=(a-90)*Math.PI/180;return{x:n+i*Math.cos(r),y:e+i*Math.sin(r)}}function wL(n){const e=Math.floor(n/1e3);if(e<60)return`${e}s ago`;const i=Math.floor(e/60);return i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}function SL({score:n,dimensions:e,totalDimensions:i,onDimensionClick:a,isLoading:r,lastFetchedAt:c,onRefresh:d,error:h}){const f=n!=null,p=f?xL(n):null,y=f?n/100*180:0,[b,x]=m.useState(null);m.useEffect(()=>{if(!c){x(null);return}const _=()=>x(wL(Date.now()-c));_();const C=setInterval(_,1e4);return()=>clearInterval(C)},[c]);const w=Object.keys(Ux),E=new Map(e.map(_=>[_.name,_]));return l.jsxs("div",{"data-testid":"health-gauge","data-grade":p?.grade??null,children:[l.jsxs("div",{className:"health-gauge-header",children:[l.jsxs("div",{className:"health-gauge-status",children:[b&&l.jsx("span",{className:"health-gauge-age","data-testid":"health-gauge-age",children:b}),h&&l.jsx("span",{className:"health-gauge-error","data-testid":"health-gauge-error",children:"Failed"})]}),d&&l.jsx(Ce,{variant:"outline",size:"sm",className:"health-gauge-refresh","data-testid":"health-gauge-refresh",onClick:d,disabled:r,children:r?"Analyzing...":f?"Refresh":"Analyze"})]}),l.jsxs("svg",{viewBox:"0 0 200 120",width:"200",height:"120",className:r?"opacity-50":"",children:[l.jsx("path",{d:$x(100,100,80,0,180),fill:"none",stroke:"#333",strokeWidth:"12",strokeLinecap:"round"}),f&&y>0&&l.jsx("path",{d:$x(100,100,80,0,y),fill:"none",stroke:p.color,strokeWidth:"12",strokeLinecap:"round"}),l.jsx("text",{x:"100",y:"85",textAnchor:"middle",fontSize:"28",fill:"currentColor",children:f?String(Math.round(n)):"--"}),p&&l.jsx("text",{x:"100",y:"108",textAnchor:"middle",fontSize:"16",fill:p.color,children:p.grade})]}),f&&i&&e.length<i&&l.jsxs("div",{className:"health-gauge-partial",children:[e.length," of ",i," dimensions"]}),l.jsx("div",{"data-testid":"dimension-breakdown",className:"health-gauge-breakdown",children:w.map(_=>{const C=E.get(_);return l.jsxs("div",{"data-testid":`dimension-${_}`,className:"health-gauge-dimension",onClick:()=>a?.(_),children:[l.jsx("span",{className:"dimension-label",children:Ux[_]||_}),l.jsx("span",{className:"dimension-score",children:C?.score!==null&&C?.score!==void 0?C.score.toFixed(1):"--"})]},_)})})]})}function CL(n){return n>=5e4?"var(--color-danger, #ef4444)":n>=5e3?"var(--color-warning, #f59e0b)":"var(--color-success, #22c55e)"}function _L({history:n}){if(n.length<2)return null;const e=200,i=32,a=2,r=i-a*2,c=n[n.length-1],d=e/n.length;return l.jsx("div",{className:"context-sparkline","data-testid":"context-sparkline",children:l.jsx("svg",{viewBox:`0 0 ${e} ${i}`,role:"img","aria-label":`Context usage trend: currently ${c.percent}%`,children:n.map((h,f)=>{const p=Math.max(1,h.percent/100*r),y=f*d,b=a+r-p;return l.jsx("rect",{x:y,y:b,width:d,height:p,fill:CL(h.tokens),opacity:.8,rx:.5},f)})})})}function EL(){const[n,e]=m.useState(null),[i,a]=m.useState(!1),[r,c]=m.useState(null),[d,h]=m.useState(null),f=m.useRef(null),p=m.useCallback(()=>{f.current&&f.current.abort();const y=new AbortController;f.current=y,a(!0),c(null),fetch("/api/health-score",{signal:y.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{e(b),h(Date.now()),a(!1)}).catch(b=>{b.name!=="AbortError"&&(c(b instanceof Error?b:new Error(String(b))),a(!1))})},[]);return m.useEffect(()=>(p(),()=>{f.current?.abort()}),[p]),{data:n,isLoading:i,error:r,lastFetchedAt:d,refresh:p}}function f_(n){return n==="persona_compressed"?"Persona (Compressed)":n.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function DL(n){if(!n)return 0;switch(n){case"FULL":return 0;case"REFRESH":return 85;case"HANDOFF":return 82;case"MINIMAL":return 95;default:return 0}}function m_(){const[n,e]=m.useState(null),[i,a]=m.useState(null),[r,c]=m.useState(!1),[d,h]=m.useState(!1),[f,p]=m.useState(!1),[y,b]=m.useState(!1),[x,w]=m.useState(!1),[E,_]=m.useState(!1),[C,D]=m.useState(!1),N=EL(),k=m.useRef([]),[T,R]=m.useState(0),z=m.useCallback((U,B)=>{const $=k.current;$.push({percent:U,tokens:B,timestamp:Date.now()}),$.length>50&&$.shift(),R(ae=>ae+1)},[]),O=U=>{switch(U){case"churn":h(!0);break;case"test_gaps":break;case"todo_density":case"deprecation_debt":p(!0);break;case"complexity":b(!0);break;case"dead_code":D(!0);break;case"dependency_freshness":w(!0);break;case"agent_context_efficiency":_(!0);break}};m.useEffect(()=>{const U=window.location.protocol==="https:"?"wss:":"ws:",B=new WebSocket(`${U}//${window.location.host}/ws/context`);B.onmessage=ae=>{try{const ne=JSON.parse(ae.data);if(ne.type==="init"||ne.type==="update"){const W=ne.context;e(W),W.percent!=null&&z(W.percent,W.tokens??0)}}catch{}};const $=new WebSocket(`${U}//${window.location.host}/ws/token-stats`);return $.onmessage=ae=>{try{const ne=JSON.parse(ae.data);a(ne)}catch{}},()=>{B.close(),$.close()}},[z]);const A=n?.tier?`tier-${n.tier.toLowerCase()}`:"",G=DL(n?.tier);return l.jsxs("div",{className:"debug-panel","data-testid":"debug-panel",children:[l.jsx(SL,{score:N.data?.composite_score??null,dimensions:N.data?.dimensions??[],totalDimensions:8,onDimensionClick:O,isLoading:N.isLoading,lastFetchedAt:N.lastFetchedAt,onRefresh:N.refresh,error:N.error}),l.jsx(Rt,{className:"my-3"}),l.jsx("h4",{children:"Context Usage"}),n?l.jsxs("div",{className:"context-info",children:[n.tier&&l.jsxs("div",{className:"tier-display",children:[l.jsx($e,{variant:"outline",className:`tier-badge ${A}`,"data-testid":"tier-badge",children:n.tier}),l.jsxs("span",{className:"tier-savings","data-testid":"tier-savings",children:[G,"% savings"]})]}),n.tokenCounts&&Object.keys(n.tokenCounts).length>0&&l.jsxs("div",{className:"component-breakdown","data-testid":"component-breakdown",children:[l.jsxs("div",{className:"breakdown-header",children:[l.jsxs(Ce,{variant:"ghost",size:"sm",className:"breakdown-toggle","data-testid":"breakdown-toggle",onClick:()=>c(!r),"aria-expanded":r,children:[r?"▼":"▶"," Injected Context"]}),l.jsxs("span",{className:"total-tokens","data-testid":"total-tokens",children:[n.totalTokens?.toLocaleString()," tokens"]})]}),l.jsx("div",{className:`component-list ${r?"expanded":"collapsed"}`,"data-testid":"component-list","aria-expanded":r,children:Object.entries(n.tokenCounts).filter(([,U])=>U>0).sort(([,U],[,B])=>B-U).map(([U,B])=>l.jsxs("div",{className:"component-item","data-testid":`component-${U}`,children:[l.jsx("span",{className:"component-name",children:f_(U)}),l.jsx("span",{className:"component-tokens",children:B.toLocaleString()})]},U))})]}),l.jsx("div",{className:"context-bar",children:l.jsx("div",{className:"context-fill",style:{width:`${n.percent||0}%`}})}),l.jsx(_L,{history:k.current},T),l.jsxs("span",{className:"context-text",children:[(n.tokens??0).toLocaleString()," / ",n.baseline!=null&&n.available!=null?(n.baseline+n.available).toLocaleString():"—"," tokens (",n.percent||0,"%)"]}),n.baseline!=null&&l.jsxs("dl",{className:"context-breakdown",children:[l.jsx("dt",{children:"System Prompt"}),l.jsxs("dd",{children:[n.baseline.toLocaleString()," tokens"]}),l.jsx("dt",{children:"Conversation"}),l.jsxs("dd",{children:[n.usableTokens?.toLocaleString()??"—"," tokens"]}),l.jsx("dt",{children:"Available"}),l.jsxs("dd",{children:[n.available?.toLocaleString()??"—"," tokens"]})]})]}):l.jsx("div",{className:"placeholder",children:"No context data"}),l.jsx(Rt,{className:"my-3"}),l.jsx("h4",{children:"Token Stats"}),i?l.jsxs("dl",{className:"token-stats",children:[i.inputTokens!==void 0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-input",children:[l.jsx("dt",{children:"Input"}),l.jsx("dd",{children:Number(i.inputTokens).toLocaleString()})]}),i.outputTokens!==void 0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-output",children:[l.jsx("dt",{children:"Output"}),l.jsx("dd",{children:Number(i.outputTokens).toLocaleString()})]}),i.cacheReadTokens!==void 0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-cache-read",children:[l.jsx("dt",{children:"Cache Read"}),l.jsx("dd",{children:Number(i.cacheReadTokens).toLocaleString()})]}),i.cacheCreationTokens!==void 0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-cache-write",children:[l.jsx("dt",{children:"Cache Write"}),l.jsx("dd",{children:Number(i.cacheCreationTokens).toLocaleString()})]}),i.totalCostUsd!==void 0&&Number(i.totalCostUsd)>0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-cost",children:[l.jsx("dt",{children:"Cost"}),l.jsxs("dd",{children:["$",Number(i.totalCostUsd).toFixed(4)]})]})]}):l.jsx("div",{className:"placeholder",children:"No token stats"}),l.jsx(zP,{open:d,onOpenChange:h}),l.jsx(PP,{open:f,onOpenChange:p}),l.jsx(IP,{open:y,onOpenChange:b}),l.jsx(HP,{open:x,onOpenChange:w}),l.jsx(pL,{isOpen:E,onClose:()=>_(!1)}),l.jsx(vL,{isOpen:C,onClose:()=>D(!1)})]})}function Ym(n){const e=m.useRef({value:n,previous:n});return m.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}var nu="Switch",[AL]=cn(nu),[NL,jL]=AL(nu),p_=m.forwardRef((n,e)=>{const{__scopeSwitch:i,name:a,checked:r,defaultChecked:c,required:d,disabled:h,value:f="on",onCheckedChange:p,form:y,...b}=n,[x,w]=m.useState(null),E=Ie(e,k=>w(k)),_=m.useRef(!1),C=x?y||!!x.closest("form"):!0,[D,N]=_n({prop:r,defaultProp:c??!1,onChange:p,caller:nu});return l.jsxs(NL,{scope:i,checked:D,disabled:h,children:[l.jsx(je.button,{type:"button",role:"switch","aria-checked":D,"aria-required":d,"data-state":b_(D),"data-disabled":h?"":void 0,disabled:h,value:f,...b,ref:E,onClick:we(n.onClick,k=>{N(T=>!T),C&&(_.current=k.isPropagationStopped(),_.current||k.stopPropagation())})}),C&&l.jsx(y_,{control:x,bubbles:!_.current,name:a,value:f,checked:D,required:d,disabled:h,form:y,style:{transform:"translateX(-100%)"}})]})});p_.displayName=nu;var g_="SwitchThumb",v_=m.forwardRef((n,e)=>{const{__scopeSwitch:i,...a}=n,r=jL(g_,i);return l.jsx(je.span,{"data-state":b_(r.checked),"data-disabled":r.disabled?"":void 0,...a,ref:e})});v_.displayName=g_;var TL="SwitchBubbleInput",y_=m.forwardRef(({__scopeSwitch:n,control:e,checked:i,bubbles:a=!0,...r},c)=>{const d=m.useRef(null),h=Ie(d,c),f=Ym(i),p=Yf(e);return m.useEffect(()=>{const y=d.current;if(!y)return;const b=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(b,"checked").set;if(f!==i&&w){const E=new Event("click",{bubbles:a});w.call(y,i),y.dispatchEvent(E)}},[f,i,a]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i,...r,tabIndex:-1,ref:h,style:{...r.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});y_.displayName=TL;function b_(n){return n?"checked":"unchecked"}var x_=p_,kL=v_;const kf=m.forwardRef(({className:n,...e},i)=>l.jsx(x_,{className:ye("cyclist-switch peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),...e,ref:i,children:l.jsx(kL,{className:ye("cyclist-switch-thumb pointer-events-none block h-4 w-4 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));kf.displayName=x_.displayName;var iu="Popover",[w_]=cn(iu,[Wa]),mr=Wa(),[RL,as]=w_(iu),S_=n=>{const{__scopePopover:e,children:i,open:a,defaultOpen:r,onOpenChange:c,modal:d=!1}=n,h=mr(e),f=m.useRef(null),[p,y]=m.useState(!1),[b,x]=_n({prop:a,defaultProp:r??!1,onChange:c,caller:iu});return l.jsx(Zf,{...h,children:l.jsx(RL,{scope:e,contentId:Mt(),triggerRef:f,open:b,onOpenChange:x,onOpenToggle:m.useCallback(()=>x(w=>!w),[x]),hasCustomAnchor:p,onCustomAnchorAdd:m.useCallback(()=>y(!0),[]),onCustomAnchorRemove:m.useCallback(()=>y(!1),[]),modal:d,children:i})})};S_.displayName=iu;var C_="PopoverAnchor",OL=m.forwardRef((n,e)=>{const{__scopePopover:i,...a}=n,r=as(C_,i),c=mr(i),{onCustomAnchorAdd:d,onCustomAnchorRemove:h}=r;return m.useEffect(()=>(d(),()=>h()),[d,h]),l.jsx(kc,{...c,...a,ref:e})});OL.displayName=C_;var __="PopoverTrigger",E_=m.forwardRef((n,e)=>{const{__scopePopover:i,...a}=n,r=as(__,i),c=mr(i),d=Ie(e,r.triggerRef),h=l.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":T_(r.open),...a,ref:d,onClick:we(n.onClick,r.onOpenToggle)});return r.hasCustomAnchor?h:l.jsx(kc,{asChild:!0,...c,children:h})});E_.displayName=__;var Xm="PopoverPortal",[zL,ML]=w_(Xm,{forceMount:void 0}),D_=n=>{const{__scopePopover:e,forceMount:i,children:a,container:r}=n,c=as(Xm,e);return l.jsx(zL,{scope:e,forceMount:i,children:l.jsx(qt,{present:i||c.open,children:l.jsx(rr,{asChild:!0,container:r,children:a})})})};D_.displayName=Xm;var Ha="PopoverContent",A_=m.forwardRef((n,e)=>{const i=ML(Ha,n.__scopePopover),{forceMount:a=i.forceMount,...r}=n,c=as(Ha,n.__scopePopover);return l.jsx(qt,{present:a||c.open,children:c.modal?l.jsx(LL,{...r,ref:e}):l.jsx(IL,{...r,ref:e})})});A_.displayName=Ha;var PL=Pa("PopoverContent.RemoveScroll"),LL=m.forwardRef((n,e)=>{const i=as(Ha,n.__scopePopover),a=m.useRef(null),r=Ie(e,a),c=m.useRef(!1);return m.useEffect(()=>{const d=a.current;if(d)return mm(d)},[]),l.jsx(Vc,{as:PL,allowPinchZoom:!0,children:l.jsx(N_,{...n,ref:r,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(n.onCloseAutoFocus,d=>{d.preventDefault(),c.current||i.triggerRef.current?.focus()}),onPointerDownOutside:we(n.onPointerDownOutside,d=>{const h=d.detail.originalEvent,f=h.button===0&&h.ctrlKey===!0,p=h.button===2||f;c.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:we(n.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1})})})}),IL=m.forwardRef((n,e)=>{const i=as(Ha,n.__scopePopover),a=m.useRef(!1),r=m.useRef(!1);return l.jsx(N_,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{n.onCloseAutoFocus?.(c),c.defaultPrevented||(a.current||i.triggerRef.current?.focus(),c.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:c=>{n.onInteractOutside?.(c),c.defaultPrevented||(a.current=!0,c.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const d=c.target;i.triggerRef.current?.contains(d)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&r.current&&c.preventDefault()}})}),N_=m.forwardRef((n,e)=>{const{__scopePopover:i,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:y,...b}=n,x=as(Ha,i),w=mr(i);return fm(),l.jsx(Bc,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:c,children:l.jsx(ar,{asChild:!0,disableOutsidePointerEvents:d,onInteractOutside:y,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:p,onDismiss:()=>x.onOpenChange(!1),children:l.jsx(Kf,{"data-state":T_(x.open),role:"dialog",id:x.contentId,...w,...b,ref:e,style:{...b.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),j_="PopoverClose",GL=m.forwardRef((n,e)=>{const{__scopePopover:i,...a}=n,r=as(j_,i);return l.jsx(je.button,{type:"button",...a,ref:e,onClick:we(n.onClick,()=>r.onOpenChange(!1))})});GL.displayName=j_;var BL="PopoverArrow",HL=m.forwardRef((n,e)=>{const{__scopePopover:i,...a}=n,r=mr(i);return l.jsx(Jf,{...r,...a,ref:e})});HL.displayName=BL;function T_(n){return n?"open":"closed"}var VL=S_,FL=E_,UL=D_,k_=A_;const $L=VL,WL=FL,R_=m.forwardRef(({className:n,align:e="center",sideOffset:i=4,...a},r)=>l.jsx(UL,{children:l.jsx(k_,{ref:r,align:e,sideOffset:i,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",n),...a})}));R_.displayName=k_.displayName;function qL(){const n=Fz(),e=[],i=[];for(const a of n){const r=Sn(a);r&&(r.variant==="light"?i.push(a):e.push(a))}return e.sort((a,r)=>(Sn(a)?.name||"").localeCompare(Sn(r)?.name||"")),i.sort((a,r)=>(Sn(a)?.name||"").localeCompare(Sn(r)?.name||"")),{dark:e,light:i}}function qx({presetId:n}){const e=Sn(n);return e?l.jsxs("div",{className:"preset-swatches",children:[l.jsx("span",{className:"preset-swatch",style:{backgroundColor:e.colors.bgPrimary},title:"Background"}),l.jsx("span",{className:"preset-swatch",style:{backgroundColor:e.colors.bgSecondary},title:"Surface"}),l.jsx("span",{className:"preset-swatch",style:{backgroundColor:e.colors.textPrimary},title:"Text"}),l.jsx("span",{className:"preset-swatch",style:{backgroundColor:e.colors.accent},title:"Accent"})]}):null}function YL({currentPreset:n,onSelect:e,className:i=""}){const[a,r]=m.useState(!1),c=m.useMemo(()=>qL(),[]),d=Sn(n),h=f=>{e?.(f),r(!1)};return l.jsxs($L,{open:a,onOpenChange:r,children:[l.jsx(WL,{asChild:!0,children:l.jsxs(Ce,{variant:"outline",className:ye("theme-palette-button",i),"aria-label":`Select theme, current: ${d?.name||n}`,children:[l.jsxs("span",{className:"theme-palette-current",children:[d&&l.jsx("span",{className:"preset-swatch",style:{backgroundColor:d.colors.bgPrimary}}),l.jsx("span",{className:"theme-palette-name",children:d?.name||n})]}),l.jsx(YO,{className:"theme-palette-chevron"})]})}),l.jsx(R_,{className:"theme-palette-popover p-0",align:"start",children:l.jsxs(Em,{children:[l.jsx(Dm,{placeholder:"Search themes..."}),l.jsxs(Am,{children:[l.jsx(Nm,{children:"No theme found."}),l.jsx(nr,{heading:`Dark (${c.dark.length})`,children:c.dark.map(f=>{const p=Sn(f);if(!p)return null;const y=f===n;return l.jsxs(ir,{value:p.name,onSelect:()=>h(f),"data-preset-id":f,children:[l.jsx(qx,{presetId:f}),l.jsx("span",{className:"preset-name",children:p.name}),l.jsx(Ga,{className:ye("preset-check-icon ml-auto",y?"opacity-100":"opacity-0")})]},f)})}),l.jsx(nr,{heading:`Light (${c.light.length})`,children:c.light.map(f=>{const p=Sn(f);if(!p)return null;const y=f===n;return l.jsxs(ir,{value:p.name,onSelect:()=>h(f),"data-preset-id":f,children:[l.jsx(qx,{presetId:f}),l.jsx("span",{className:"preset-name",children:p.name}),l.jsx(Ga,{className:ye("preset-check-icon ml-auto",y?"opacity-100":"opacity-0")})]},f)})})]})]})})]})}var XL=[" ","Enter","ArrowUp","ArrowDown"],QL=[" ","Enter"],Ps="Select",[su,au,ZL]=OS(Ps),[qa]=cn(Ps,[ZL,Wa]),ou=Wa(),[KL,os]=qa(Ps),[JL,eI]=qa(Ps),O_=n=>{const{__scopeSelect:e,children:i,open:a,defaultOpen:r,onOpenChange:c,value:d,defaultValue:h,onValueChange:f,dir:p,name:y,autoComplete:b,disabled:x,required:w,form:E}=n,_=ou(e),[C,D]=m.useState(null),[N,k]=m.useState(null),[T,R]=m.useState(!1),z=Kc(p),[O,A]=_n({prop:a,defaultProp:r??!1,onChange:c,caller:Ps}),[G,U]=_n({prop:d,defaultProp:h,onChange:f,caller:Ps}),B=m.useRef(null),$=C?E||!!C.closest("form"):!0,[ae,ne]=m.useState(new Set),W=Array.from(ae).map(M=>M.props.value).join(";");return l.jsx(Zf,{..._,children:l.jsxs(KL,{required:w,scope:e,trigger:C,onTriggerChange:D,valueNode:N,onValueNodeChange:k,valueNodeHasChildren:T,onValueNodeHasChildrenChange:R,contentId:Mt(),value:G,onValueChange:U,open:O,onOpenChange:A,dir:z,triggerPointerDownPosRef:B,disabled:x,children:[l.jsx(su.Provider,{scope:e,children:l.jsx(JL,{scope:n.__scopeSelect,onNativeOptionAdd:m.useCallback(M=>{ne(K=>new Set(K).add(M))},[]),onNativeOptionRemove:m.useCallback(M=>{ne(K=>{const q=new Set(K);return q.delete(M),q})},[]),children:i})}),$?l.jsxs(sE,{"aria-hidden":!0,required:w,tabIndex:-1,name:y,autoComplete:b,value:G,onChange:M=>U(M.target.value),disabled:x,form:E,children:[G===void 0?l.jsx("option",{value:""}):null,Array.from(ae)]},W):null]})})};O_.displayName=Ps;var z_="SelectTrigger",M_=m.forwardRef((n,e)=>{const{__scopeSelect:i,disabled:a=!1,...r}=n,c=ou(i),d=os(z_,i),h=d.disabled||a,f=Ie(e,d.onTriggerChange),p=au(i),y=m.useRef("touch"),[b,x,w]=oE(_=>{const C=p().filter(k=>!k.disabled),D=C.find(k=>k.value===d.value),N=rE(C,_,D);N!==void 0&&d.onValueChange(N.value)}),E=_=>{h||(d.onOpenChange(!0),w()),_&&(d.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return l.jsx(kc,{asChild:!0,...c,children:l.jsx(je.button,{type:"button",role:"combobox","aria-controls":d.contentId,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":aE(d.value)?"":void 0,...r,ref:f,onClick:we(r.onClick,_=>{_.currentTarget.focus(),y.current!=="mouse"&&E(_)}),onPointerDown:we(r.onPointerDown,_=>{y.current=_.pointerType;const C=_.target;C.hasPointerCapture(_.pointerId)&&C.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(E(_),_.preventDefault())}),onKeyDown:we(r.onKeyDown,_=>{const C=b.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&x(_.key),!(C&&_.key===" ")&&XL.includes(_.key)&&(E(),_.preventDefault())})})})});M_.displayName=z_;var P_="SelectValue",L_=m.forwardRef((n,e)=>{const{__scopeSelect:i,className:a,style:r,children:c,placeholder:d="",...h}=n,f=os(P_,i),{onValueNodeHasChildrenChange:p}=f,y=c!==void 0,b=Ie(e,f.onValueNodeChange);return Dt(()=>{p(y)},[p,y]),l.jsx(je.span,{...h,ref:b,style:{pointerEvents:"none"},children:aE(f.value)?l.jsx(l.Fragment,{children:d}):c})});L_.displayName=P_;var tI="SelectIcon",I_=m.forwardRef((n,e)=>{const{__scopeSelect:i,children:a,...r}=n;return l.jsx(je.span,{"aria-hidden":!0,...r,ref:e,children:a||"▼"})});I_.displayName=tI;var nI="SelectPortal",G_=n=>l.jsx(rr,{asChild:!0,...n});G_.displayName=nI;var Ls="SelectContent",B_=m.forwardRef((n,e)=>{const i=os(Ls,n.__scopeSelect),[a,r]=m.useState();if(Dt(()=>{r(new DocumentFragment)},[]),!i.open){const c=a;return c?sr.createPortal(l.jsx(H_,{scope:n.__scopeSelect,children:l.jsx(su.Slot,{scope:n.__scopeSelect,children:l.jsx("div",{children:n.children})})}),c):null}return l.jsx(V_,{...n,ref:e})});B_.displayName=Ls;var Rn=10,[H_,rs]=qa(Ls),iI="SelectContentImpl",sI=Pa("SelectContent.RemoveScroll"),V_=m.forwardRef((n,e)=>{const{__scopeSelect:i,position:a="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:c,onPointerDownOutside:d,side:h,sideOffset:f,align:p,alignOffset:y,arrowPadding:b,collisionBoundary:x,collisionPadding:w,sticky:E,hideWhenDetached:_,avoidCollisions:C,...D}=n,N=os(Ls,i),[k,T]=m.useState(null),[R,z]=m.useState(null),O=Ie(e,X=>T(X)),[A,G]=m.useState(null),[U,B]=m.useState(null),$=au(i),[ae,ne]=m.useState(!1),W=m.useRef(!1);m.useEffect(()=>{if(k)return mm(k)},[k]),fm();const M=m.useCallback(X=>{const[ce,...de]=$().map(Ne=>Ne.ref.current),[De]=de.slice(-1),Ge=document.activeElement;for(const Ne of X)if(Ne===Ge||(Ne?.scrollIntoView({block:"nearest"}),Ne===ce&&R&&(R.scrollTop=0),Ne===De&&R&&(R.scrollTop=R.scrollHeight),Ne?.focus(),document.activeElement!==Ge))return},[$,R]),K=m.useCallback(()=>M([A,k]),[M,A,k]);m.useEffect(()=>{ae&&K()},[ae,K]);const{onOpenChange:q,triggerPointerDownPosRef:he}=N;m.useEffect(()=>{if(k){let X={x:0,y:0};const ce=De=>{X={x:Math.abs(Math.round(De.pageX)-(he.current?.x??0)),y:Math.abs(Math.round(De.pageY)-(he.current?.y??0))}},de=De=>{X.x<=10&&X.y<=10?De.preventDefault():k.contains(De.target)||q(!1),document.removeEventListener("pointermove",ce),he.current=null};return he.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",de,{capture:!0})}}},[k,q,he]),m.useEffect(()=>{const X=()=>q(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[q]);const[Se,I]=oE(X=>{const ce=$().filter(Ge=>!Ge.disabled),de=ce.find(Ge=>Ge.ref.current===document.activeElement),De=rE(ce,X,de);De&&setTimeout(()=>De.ref.current.focus())}),L=m.useCallback((X,ce,de)=>{const De=!W.current&&!de;(N.value!==void 0&&N.value===ce||De)&&(G(X),De&&(W.current=!0))},[N.value]),ee=m.useCallback(()=>k?.focus(),[k]),V=m.useCallback((X,ce,de)=>{const De=!W.current&&!de;(N.value!==void 0&&N.value===ce||De)&&B(X)},[N.value]),Y=a==="popper"?Rf:F_,le=Y===Rf?{side:h,sideOffset:f,align:p,alignOffset:y,arrowPadding:b,collisionBoundary:x,collisionPadding:w,sticky:E,hideWhenDetached:_,avoidCollisions:C}:{};return l.jsx(H_,{scope:i,content:k,viewport:R,onViewportChange:z,itemRefCallback:L,selectedItem:A,onItemLeave:ee,itemTextRefCallback:V,focusSelectedItem:K,selectedItemText:U,position:a,isPositioned:ae,searchRef:Se,children:l.jsx(Vc,{as:sI,allowPinchZoom:!0,children:l.jsx(Bc,{asChild:!0,trapped:N.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:we(r,X=>{N.trigger?.focus({preventScroll:!0}),X.preventDefault()}),children:l.jsx(ar,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:l.jsx(Y,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:X=>X.preventDefault(),...D,...le,onPlaced:()=>ne(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...D.style},onKeyDown:we(D.onKeyDown,X=>{const ce=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ce&&X.key.length===1&&I(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let De=$().filter(Ge=>!Ge.disabled).map(Ge=>Ge.ref.current);if(["ArrowUp","End"].includes(X.key)&&(De=De.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const Ge=X.target,Ne=De.indexOf(Ge);De=De.slice(Ne+1)}setTimeout(()=>M(De)),X.preventDefault()}})})})})})})});V_.displayName=iI;var aI="SelectItemAlignedPosition",F_=m.forwardRef((n,e)=>{const{__scopeSelect:i,onPlaced:a,...r}=n,c=os(Ls,i),d=rs(Ls,i),[h,f]=m.useState(null),[p,y]=m.useState(null),b=Ie(e,O=>y(O)),x=au(i),w=m.useRef(!1),E=m.useRef(!0),{viewport:_,selectedItem:C,selectedItemText:D,focusSelectedItem:N}=d,k=m.useCallback(()=>{if(c.trigger&&c.valueNode&&h&&p&&_&&C&&D){const O=c.trigger.getBoundingClientRect(),A=p.getBoundingClientRect(),G=c.valueNode.getBoundingClientRect(),U=D.getBoundingClientRect();if(c.dir!=="rtl"){const Ge=U.left-A.left,Ne=G.left-Ge,dt=O.left-Ne,rt=O.width+dt,An=Math.max(rt,A.width),ei=window.innerWidth-Rn,Ya=Tf(Ne,[Rn,Math.max(Rn,ei-An)]);h.style.minWidth=rt+"px",h.style.left=Ya+"px"}else{const Ge=A.right-U.right,Ne=window.innerWidth-G.right-Ge,dt=window.innerWidth-O.right-Ne,rt=O.width+dt,An=Math.max(rt,A.width),ei=window.innerWidth-Rn,Ya=Tf(Ne,[Rn,Math.max(Rn,ei-An)]);h.style.minWidth=rt+"px",h.style.right=Ya+"px"}const B=x(),$=window.innerHeight-Rn*2,ae=_.scrollHeight,ne=window.getComputedStyle(p),W=parseInt(ne.borderTopWidth,10),M=parseInt(ne.paddingTop,10),K=parseInt(ne.borderBottomWidth,10),q=parseInt(ne.paddingBottom,10),he=W+M+ae+q+K,Se=Math.min(C.offsetHeight*5,he),I=window.getComputedStyle(_),L=parseInt(I.paddingTop,10),ee=parseInt(I.paddingBottom,10),V=O.top+O.height/2-Rn,Y=$-V,le=C.offsetHeight/2,X=C.offsetTop+le,ce=W+M+X,de=he-ce;if(ce<=V){const Ge=B.length>0&&C===B[B.length-1].ref.current;h.style.bottom="0px";const Ne=p.clientHeight-_.offsetTop-_.offsetHeight,dt=Math.max(Y,le+(Ge?ee:0)+Ne+K),rt=ce+dt;h.style.height=rt+"px"}else{const Ge=B.length>0&&C===B[0].ref.current;h.style.top="0px";const dt=Math.max(V,W+_.offsetTop+(Ge?L:0)+le)+de;h.style.height=dt+"px",_.scrollTop=ce-V+_.offsetTop}h.style.margin=`${Rn}px 0`,h.style.minHeight=Se+"px",h.style.maxHeight=$+"px",a?.(),requestAnimationFrame(()=>w.current=!0)}},[x,c.trigger,c.valueNode,h,p,_,C,D,c.dir,a]);Dt(()=>k(),[k]);const[T,R]=m.useState();Dt(()=>{p&&R(window.getComputedStyle(p).zIndex)},[p]);const z=m.useCallback(O=>{O&&E.current===!0&&(k(),N?.(),E.current=!1)},[k,N]);return l.jsx(rI,{scope:i,contentWrapper:h,shouldExpandOnScrollRef:w,onScrollButtonChange:z,children:l.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:l.jsx(je.div,{...r,ref:b,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});F_.displayName=aI;var oI="SelectPopperPosition",Rf=m.forwardRef((n,e)=>{const{__scopeSelect:i,align:a="start",collisionPadding:r=Rn,...c}=n,d=ou(i);return l.jsx(Kf,{...d,...c,ref:e,align:a,collisionPadding:r,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Rf.displayName=oI;var[rI,Qm]=qa(Ls,{}),Of="SelectViewport",U_=m.forwardRef((n,e)=>{const{__scopeSelect:i,nonce:a,...r}=n,c=rs(Of,i),d=Qm(Of,i),h=Ie(e,c.onViewportChange),f=m.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),l.jsx(su.Slot,{scope:i,children:l.jsx(je.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:we(r.onScroll,p=>{const y=p.currentTarget,{contentWrapper:b,shouldExpandOnScrollRef:x}=d;if(x?.current&&b){const w=Math.abs(f.current-y.scrollTop);if(w>0){const E=window.innerHeight-Rn*2,_=parseFloat(b.style.minHeight),C=parseFloat(b.style.height),D=Math.max(_,C);if(D<E){const N=D+w,k=Math.min(E,N),T=N-k;b.style.height=k+"px",b.style.bottom==="0px"&&(y.scrollTop=T>0?T:0,b.style.justifyContent="flex-end")}}}f.current=y.scrollTop})})})]})});U_.displayName=Of;var $_="SelectGroup",[lI,cI]=qa($_),W_=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n,r=Mt();return l.jsx(lI,{scope:i,id:r,children:l.jsx(je.div,{role:"group","aria-labelledby":r,...a,ref:e})})});W_.displayName=$_;var q_="SelectLabel",Y_=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n,r=cI(q_,i);return l.jsx(je.div,{id:r.id,...a,ref:e})});Y_.displayName=q_;var Ec="SelectItem",[uI,X_]=qa(Ec),Q_=m.forwardRef((n,e)=>{const{__scopeSelect:i,value:a,disabled:r=!1,textValue:c,...d}=n,h=os(Ec,i),f=rs(Ec,i),p=h.value===a,[y,b]=m.useState(c??""),[x,w]=m.useState(!1),E=Ie(e,N=>f.itemRefCallback?.(N,a,r)),_=Mt(),C=m.useRef("touch"),D=()=>{r||(h.onValueChange(a),h.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(uI,{scope:i,value:a,disabled:r,textId:_,isSelected:p,onItemTextChange:m.useCallback(N=>{b(k=>k||(N?.textContent??"").trim())},[]),children:l.jsx(su.ItemSlot,{scope:i,value:a,disabled:r,textValue:y,children:l.jsx(je.div,{role:"option","aria-labelledby":_,"data-highlighted":x?"":void 0,"aria-selected":p&&x,"data-state":p?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...d,ref:E,onFocus:we(d.onFocus,()=>w(!0)),onBlur:we(d.onBlur,()=>w(!1)),onClick:we(d.onClick,()=>{C.current!=="mouse"&&D()}),onPointerUp:we(d.onPointerUp,()=>{C.current==="mouse"&&D()}),onPointerDown:we(d.onPointerDown,N=>{C.current=N.pointerType}),onPointerMove:we(d.onPointerMove,N=>{C.current=N.pointerType,r?f.onItemLeave?.():C.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(d.onPointerLeave,N=>{N.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:we(d.onKeyDown,N=>{f.searchRef?.current!==""&&N.key===" "||(QL.includes(N.key)&&D(),N.key===" "&&N.preventDefault())})})})})});Q_.displayName=Ec;var Yo="SelectItemText",Z_=m.forwardRef((n,e)=>{const{__scopeSelect:i,className:a,style:r,...c}=n,d=os(Yo,i),h=rs(Yo,i),f=X_(Yo,i),p=eI(Yo,i),[y,b]=m.useState(null),x=Ie(e,D=>b(D),f.onItemTextChange,D=>h.itemTextRefCallback?.(D,f.value,f.disabled)),w=y?.textContent,E=m.useMemo(()=>l.jsx("option",{value:f.value,disabled:f.disabled,children:w},f.value),[f.disabled,f.value,w]),{onNativeOptionAdd:_,onNativeOptionRemove:C}=p;return Dt(()=>(_(E),()=>C(E)),[_,C,E]),l.jsxs(l.Fragment,{children:[l.jsx(je.span,{id:f.textId,...c,ref:x}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?sr.createPortal(c.children,d.valueNode):null]})});Z_.displayName=Yo;var K_="SelectItemIndicator",J_=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n;return X_(K_,i).isSelected?l.jsx(je.span,{"aria-hidden":!0,...a,ref:e}):null});J_.displayName=K_;var zf="SelectScrollUpButton",eE=m.forwardRef((n,e)=>{const i=rs(zf,n.__scopeSelect),a=Qm(zf,n.__scopeSelect),[r,c]=m.useState(!1),d=Ie(e,a.onScrollButtonChange);return Dt(()=>{if(i.viewport&&i.isPositioned){let h=function(){const p=f.scrollTop>0;c(p)};const f=i.viewport;return h(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,i.isPositioned]),r?l.jsx(nE,{...n,ref:d,onAutoScroll:()=>{const{viewport:h,selectedItem:f}=i;h&&f&&(h.scrollTop=h.scrollTop-f.offsetHeight)}}):null});eE.displayName=zf;var Mf="SelectScrollDownButton",tE=m.forwardRef((n,e)=>{const i=rs(Mf,n.__scopeSelect),a=Qm(Mf,n.__scopeSelect),[r,c]=m.useState(!1),d=Ie(e,a.onScrollButtonChange);return Dt(()=>{if(i.viewport&&i.isPositioned){let h=function(){const p=f.scrollHeight-f.clientHeight,y=Math.ceil(f.scrollTop)<p;c(y)};const f=i.viewport;return h(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,i.isPositioned]),r?l.jsx(nE,{...n,ref:d,onAutoScroll:()=>{const{viewport:h,selectedItem:f}=i;h&&f&&(h.scrollTop=h.scrollTop+f.offsetHeight)}}):null});tE.displayName=Mf;var nE=m.forwardRef((n,e)=>{const{__scopeSelect:i,onAutoScroll:a,...r}=n,c=rs("SelectScrollButton",i),d=m.useRef(null),h=au(i),f=m.useCallback(()=>{d.current!==null&&(window.clearInterval(d.current),d.current=null)},[]);return m.useEffect(()=>()=>f(),[f]),Dt(()=>{h().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[h]),l.jsx(je.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:we(r.onPointerDown,()=>{d.current===null&&(d.current=window.setInterval(a,50))}),onPointerMove:we(r.onPointerMove,()=>{c.onItemLeave?.(),d.current===null&&(d.current=window.setInterval(a,50))}),onPointerLeave:we(r.onPointerLeave,()=>{f()})})}),dI="SelectSeparator",iE=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n;return l.jsx(je.div,{"aria-hidden":!0,...a,ref:e})});iE.displayName=dI;var Pf="SelectArrow",hI=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n,r=ou(i),c=os(Pf,i),d=rs(Pf,i);return c.open&&d.position==="popper"?l.jsx(Jf,{...r,...a,ref:e}):null});hI.displayName=Pf;var fI="SelectBubbleInput",sE=m.forwardRef(({__scopeSelect:n,value:e,...i},a)=>{const r=m.useRef(null),c=Ie(a,r),d=Ym(e);return m.useEffect(()=>{const h=r.current;if(!h)return;const f=window.HTMLSelectElement.prototype,y=Object.getOwnPropertyDescriptor(f,"value").set;if(d!==e&&y){const b=new Event("change",{bubbles:!0});y.call(h,e),h.dispatchEvent(b)}},[d,e]),l.jsx(je.select,{...i,style:{...Yw,...i.style},ref:c,defaultValue:e})});sE.displayName=fI;function aE(n){return n===""||n===void 0}function oE(n){const e=Gt(n),i=m.useRef(""),a=m.useRef(0),r=m.useCallback(d=>{const h=i.current+d;e(h),(function f(p){i.current=p,window.clearTimeout(a.current),p!==""&&(a.current=window.setTimeout(()=>f(""),1e3))})(h)},[e]),c=m.useCallback(()=>{i.current="",window.clearTimeout(a.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(a.current),[]),[i,r,c]}function rE(n,e,i){const r=e.length>1&&Array.from(e).every(p=>p===e[0])?e[0]:e,c=i?n.indexOf(i):-1;let d=mI(n,Math.max(c,0));r.length===1&&(d=d.filter(p=>p!==i));const f=d.find(p=>p.textValue.toLowerCase().startsWith(r.toLowerCase()));return f!==i?f:void 0}function mI(n,e){return n.map((i,a)=>n[(e+a)%n.length])}var pI=O_,lE=M_,gI=L_,vI=I_,yI=G_,cE=B_,bI=U_,xI=W_,uE=Y_,dE=Q_,wI=Z_,SI=J_,hE=eE,fE=tE,mE=iE;const CI=pI,Jh=xI,_I=gI,pE=m.forwardRef(({className:n,children:e,...i},a)=>l.jsxs(lE,{ref:a,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...i,children:[e,l.jsx(vI,{asChild:!0,children:l.jsx(cS,{className:"h-4 w-4 opacity-50"})})]}));pE.displayName=lE.displayName;const gE=m.forwardRef(({className:n,...e},i)=>l.jsx(hE,{ref:i,className:ye("flex cursor-default items-center justify-center py-1",n),...e,children:l.jsx(WO,{className:"h-4 w-4"})}));gE.displayName=hE.displayName;const vE=m.forwardRef(({className:n,...e},i)=>l.jsx(fE,{ref:i,className:ye("flex cursor-default items-center justify-center py-1",n),...e,children:l.jsx(cS,{className:"h-4 w-4"})}));vE.displayName=fE.displayName;const yE=m.forwardRef(({className:n,children:e,position:i="popper",...a},r)=>l.jsx(yI,{children:l.jsxs(cE,{ref:r,className:ye("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",i==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:i,...a,children:[l.jsx(gE,{}),l.jsx(bI,{className:ye("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(vE,{})]})}));yE.displayName=cE.displayName;const sc=m.forwardRef(({className:n,...e},i)=>l.jsx(uE,{ref:i,className:ye("px-2 py-1.5 text-sm font-semibold",n),...e}));sc.displayName=uE.displayName;const ac=m.forwardRef(({className:n,children:e,...i},a)=>l.jsxs(dE,{ref:a,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...i,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(SI,{children:l.jsx(Ga,{className:"h-4 w-4"})})}),l.jsx(wI,{children:e})]}));ac.displayName=dE.displayName;const EI=m.forwardRef(({className:n,...e},i)=>l.jsx(mE,{ref:i,className:ye("-mx-1 my-1 h-px bg-muted",n),...e}));EI.displayName=mE.displayName;function DI(n,e){const i=n.getUint16(4);for(let a=0;a<i;a++){const r=12+a*16;if(String.fromCharCode(n.getUint8(r),n.getUint8(r+1),n.getUint8(r+2),n.getUint8(r+3))===e)return{offset:n.getUint32(r+8),length:n.getUint32(r+12)}}return null}async function AI(n){try{const i=await(await n.blob()).arrayBuffer(),a=new DataView(i),r=DI(a,"post");return r?a.getUint32(r.offset+12)!==0:!1}catch{return!1}}const Zm="cyclist-system-fonts";function NI(){try{const n=localStorage.getItem(Zm);if(!n)return null;const e=JSON.parse(n);return e.fonts?.length>0?e.fonts:null}catch{return null}}function jI(n,e){try{const i={fonts:n,count:e};localStorage.setItem(Zm,JSON.stringify(i))}catch{}}let Xl=null;async function TI(){return Xl||(Xl=(async()=>{if(!("queryLocalFonts"in window))return[];try{const n=await window.queryLocalFonts(),e=new Map;for(const h of n)e.has(h.family)||e.set(h.family,h);const i=e.size,a=NI();if(a&&a.length>0)try{const h=localStorage.getItem(Zm);if(h&&JSON.parse(h).count===i)return a}catch{}const r=Array.from(e.entries()),c=await Promise.all(r.map(([,h])=>AI(h))),d=r.map(([h],f)=>({family:h,isMonospace:c[f]}));return d.sort((h,f)=>h.family.localeCompare(f.family)),jI(d,i),d}catch{return[]}})(),Xl)}const Ql="system-font:";function Yx({type:n,currentFont:e,customFont:i,onSelect:a,onCustomFontChange:r,className:c=""}){const[d,h]=m.useState(i||""),[f,p]=m.useState([]),[y,b]=m.useState(!1),x=n==="ui"?vS:yS,w=x.find(R=>R.id===e);m.useEffect(()=>{y||TI().then(R=>{p(R),b(!0)})},[y]);const E=m.useMemo(()=>{let R=f;return R=R.filter(z=>/^[\x20-\x7E\u00C0-\u024F]+$/.test(z.family)),n==="code"&&(R=R.filter(z=>z.isMonospace)),R},[f,n]),_=m.useMemo(()=>x.filter(R=>!R.isCustom),[x]);m.useEffect(()=>{i!==void 0&&h(i)},[i]);const C=m.useMemo(()=>e==="custom"&&d?f.some(z=>z.family===d)?`${Ql}${d}`:"custom":e,[e,d,f]),D=m.useCallback(R=>{if(R.startsWith(Ql)){const z=R.slice(Ql.length);a("custom",z)}else a(R==="custom"?"custom":R)},[a]),N=m.useCallback(R=>{const z=R.target.value;h(z),r?.(z),e==="custom"&&a("custom",z)},[e,a,r]),k=f.length>0,T=e==="custom"&&!k;return l.jsxs("div",{className:`font-picker ${c}`,children:[l.jsxs(CI,{value:C,onValueChange:D,children:[l.jsx(pE,{className:"font-picker-trigger","aria-label":`Select ${n} font`,style:{fontFamily:w?.fontFamily||(d?`"${d}"`:"inherit")},children:l.jsx(_I,{placeholder:"Select font..."})}),l.jsxs(yE,{className:"max-h-[300px]",children:[_.length>0&&l.jsxs(Jh,{children:[l.jsx(sc,{children:"Presets"}),_.map(R=>l.jsx(ac,{value:R.id,style:{fontFamily:R.fontFamily||"inherit"},children:l.jsxs("span",{className:"font-picker-item-content",children:[l.jsx("span",{className:"font-name",children:R.name}),l.jsx("span",{className:"font-preview",style:{fontFamily:R.fontFamily},children:"Aa"})]})},R.id))]}),k&&E.length>0&&l.jsxs(Jh,{children:[l.jsxs(sc,{children:["System Fonts (",E.length,")"]}),E.map(R=>l.jsx(ac,{value:`${Ql}${R.family}`,style:{fontFamily:`"${R.family}", inherit`},children:l.jsxs("span",{className:"font-picker-item-content",children:[l.jsx("span",{className:"font-name",children:R.family}),l.jsx("span",{className:"font-preview",style:{fontFamily:`"${R.family}"`},children:"Aa"})]})},R.family))]}),!k&&y&&l.jsxs(Jh,{children:[l.jsx(sc,{children:"Custom"}),l.jsx(ac,{value:"custom",children:"Custom..."})]})]})]}),T&&l.jsx("input",{type:"text",className:"font-picker-custom-input",value:d,onChange:N,placeholder:"Enter font family...","aria-label":"Custom font family"})]})}const kI=["xs","sm","base","lg","xl"];function Xx({currentSize:n,onSelect:e,className:i=""}){return l.jsx(St,{delayDuration:300,children:l.jsx("div",{className:`font-size-picker ${i}`,role:"group","aria-label":"Font size",children:kI.map(a=>l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:a===n?"secondary":"ghost",size:"sm",className:`font-size-option ${a===n?"active":""}`,"data-size":a,onClick:()=>e(a),"aria-pressed":a===n,children:a.toUpperCase()})}),l.jsx(Te,{children:`${Cf[a]} (${a})`})]},a))})})}const Qx={S:0,A:1,B:2};function bE(){const[n,e]=m.useState(null),[i,a]=m.useState([]),[r,c]=m.useState(!1),[d,h]=m.useState(ic),[f,p]=m.useState(Tm);m.useEffect(()=>{async function C(){try{console.log("[SettingsPanel] Loading settings via REST");const T=await fetch("/api/settings");if(T.ok){const R=await T.json();console.log("[SettingsPanel] Settings loaded:",R),e(R)}}catch(T){console.error("[SettingsPanel] Failed to load settings:",T)}}async function D(){try{const T=await fetch("/api/settings/themes");if(T.ok){const R=await T.json();a(R.themes||[])}}catch(T){console.error("[SettingsPanel] Failed to load themes:",T)}}C(),D(),console.log("[SettingsPanel] Connecting to /ws/settings for real-time sync");const N=window.location.protocol==="https:"?"wss:":"ws:",k=new WebSocket(`${N}//${window.location.host}/ws/settings`);return k.onmessage=T=>{try{const R=JSON.parse(T.data);(R.type==="init"||R.type==="update")&&(console.log("[SettingsPanel] Settings update via WebSocket:",R.settings),e(R.settings))}catch(R){console.error("[SettingsPanel] Failed to parse WebSocket message:",R)}},k.onerror=T=>{console.error("[SettingsPanel] WebSocket error:",T)},wS().then(T=>{_f(T),h(T)}),bS().then(T=>{p(T),nc(T)}),()=>k.close()},[]);const y=m.useMemo(()=>[...i].sort((C,D)=>{const N=(Qx[C.tier]??3)-(Qx[D.tier]??3);return N!==0?N:C.name.localeCompare(D.name)}),[i]),b=m.useCallback(async C=>{if(n){c(!0);try{const D={...n,pennyfarthing:{...n.pennyfarthing,theme:C}};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pennyfarthing:{theme:C}})}),e(D)}finally{c(!1)}}},[n]),x=m.useCallback(async(C,D,N)=>{if(n){console.log(`[SettingsPanel] Toggle ${C}.${D} = ${N}`),c(!0);try{const k={...n,[C]:{...n[C],[D]:N}};console.log("[SettingsPanel] Saving via REST"),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[C]:{[D]:N}})}),console.log("[SettingsPanel] Save complete, updating local state"),e(k)}finally{c(!1)}}},[n]),w=m.useCallback(async C=>{c(!0);try{_f(C),await Uz(C),h(C)}finally{c(!1)}},[]),E=m.useCallback(async(C,D,N)=>{c(!0);try{const k={...f,[C==="ui"?"uiFont":"codeFont"]:D,...D==="custom"&&N?{[C==="ui"?"customUiFont":"customCodeFont"]:N}:{}};nc(k),await px(k),p(k)}finally{c(!1)}},[f]),_=m.useCallback(async(C,D)=>{c(!0);try{const N={...f,[C==="ui"?"uiFontSize":"codeFontSize"]:D};nc(N),await px(N),p(N)}finally{c(!1)}},[f]);return n?l.jsxs("div",{className:"settings-panel","data-testid":"settings-panel",children:[l.jsxs("section",{className:"settings-section",children:[l.jsx("h4",{children:"Theme"}),l.jsx("select",{value:n.pennyfarthing?.theme||"",onChange:C=>b(C.target.value),disabled:r,className:"theme-select",children:y.map(C=>l.jsxs("option",{value:C.id,children:["[",C.tier||"Unranked","] ",C.name]},C.id))})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{className:"settings-section",children:[l.jsx("h4",{children:"Color Palette"}),l.jsx(YL,{currentPreset:d,onSelect:w})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{className:"settings-section",children:[l.jsx("h4",{children:"Fonts"}),l.jsxs("div",{className:"font-setting",children:[l.jsx("label",{children:"UI Font"}),l.jsx(Yx,{type:"ui",currentFont:f.uiFont,customFont:f.customUiFont,onSelect:(C,D)=>E("ui",C,D)}),l.jsx(Xx,{currentSize:f.uiFontSize,onSelect:C=>_("ui",C)})]}),l.jsxs("div",{className:"font-setting",children:[l.jsx("label",{children:"Code Font"}),l.jsx(Yx,{type:"code",currentFont:f.codeFont,customFont:f.customCodeFont,onSelect:(C,D)=>E("code",C,D)}),l.jsx(Xx,{currentSize:f.codeFontSize,onSelect:C=>_("code",C)})]})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{className:"settings-section",children:[l.jsx("h4",{children:"Workflow"}),window.__CYCLIST_MODE__==="cyclist"&&l.jsxs("div",{className:"toggle-setting",children:[l.jsx(kf,{checked:n.workflow?.bell_mode||!1,onCheckedChange:C=>x("workflow","bell_mode",C),disabled:r}),"Bell Mode",l.jsx("span",{className:"setting-description",children:"Inject queued messages via PostToolUse hook instead of waiting"})]}),l.jsxs("div",{className:"toggle-setting",children:[l.jsx(kf,{checked:n.workflow?.relay_mode||!1,onCheckedChange:C=>x("workflow","relay_mode",C),disabled:r}),"Relay Mode",l.jsx("span",{className:"setting-description",children:"Auto-handoff to next agent"})]})]})]}):l.jsx("div",{className:"settings-panel loading","data-testid":"settings-panel",children:l.jsxs("div",{className:"space-y-4 p-2",children:[l.jsx(fe,{className:"h-4 w-24"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-4 w-32"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-4 w-20"}),l.jsx(fe,{className:"h-6 w-48"})]})})}function RI(n){return new Date(n).toLocaleTimeString()}function Zx(n){return n===void 0?"-":n<1e3?`${n}ms`:`${(n/1e3).toFixed(1)}s`}function Kx(n,e=60){return n?n.length<=e?n:n.substring(0,e)+"...":"-"}function OI(n){return n===void 0?"":n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function zI(n){if(!n)return"";const e=n.split("/");return e.length<=3?n:".../"+e.slice(-3).join("/")}function It({label:n,value:e,mono:i}){return e==null||e===""?null:l.jsxs("div",{className:"detail-row",children:[l.jsx("span",{className:"detail-label",children:n}),l.jsx("span",{className:i?"detail-value font-mono":"detail-value",children:e})]})}function xE(){const[n,e]=m.useState([]),[i,a]=m.useState(null),[r,c]=m.useState([]),[d,h]=m.useState(""),[f,p]=m.useState(""),[y,b]=m.useState(!0),[x,w]=m.useState(null),[E,_]=m.useState(null),C=m.useRef(!0),D=m.useRef(null),N=m.useRef(null);m.useEffect(()=>{const A=N.current;if(!A)return;const G=()=>{C.current=A.scrollTop===0};return A.addEventListener("scroll",G),()=>A.removeEventListener("scroll",G)},[y]),m.useEffect(()=>{C.current&&D.current&&n.length>0&&D.current.scrollIntoView()},[n]);const k=m.useCallback(async()=>{try{const A=new URLSearchParams;d&&A.set("toolType",d),f&&A.set("status",f),A.set("limit","200");const G=await fetch(`/api/audit-log?${A}`);if(!G.ok)throw new Error("Failed to fetch audit log");const U=await G.json();e(U.entries||[]),w(null)}catch(A){w(A instanceof Error?A.message:"Unknown error")}},[d,f]),T=m.useCallback(async()=>{try{const A=await fetch("/api/audit-log/stats");if(!A.ok)throw new Error("Failed to fetch stats");const G=await A.json();a(G)}catch(A){console.error("[AuditLogPanel] Stats error:",A)}},[]),R=m.useCallback(async()=>{try{const A=await fetch("/api/audit-log/types");if(!A.ok)throw new Error("Failed to fetch types");const G=await A.json();c(G.types||[])}catch(A){console.error("[AuditLogPanel] Types error:",A)}},[]);m.useEffect(()=>{b(!0),Promise.all([k(),T(),R()]).finally(()=>{b(!1)});const A=new WebSocket(`ws://${window.location.host}/ws/spans`);return A.onmessage=G=>{try{const U=JSON.parse(G.data);U.type==="span"&&U.span&&(e(B=>[U.span,...B].slice(0,200)),T())}catch(U){console.error("[AuditLogPanel] WebSocket parse error:",U)}},()=>A.close()},[k,T,R]),m.useEffect(()=>{k()},[d,f,k]);const z=async A=>{try{const G=new URLSearchParams;G.set("format",A),G.set("download","true"),d&&G.set("toolType",d);const U=await fetch(`/api/audit-log/export?${G}`);if(!U.ok)throw new Error("Export failed");const B=await U.blob(),$=URL.createObjectURL(B),ae=document.createElement("a");ae.href=$,ae.download=`audit-log.${A}`,ae.click(),URL.revokeObjectURL($)}catch(G){console.error("[AuditLogPanel] Export error:",G)}},O=async()=>{if(confirm("Clear all audit log entries?"))try{if(!(await fetch("/api/audit-log",{method:"DELETE"})).ok)throw new Error("Clear failed");e([]),T()}catch(A){console.error("[AuditLogPanel] Clear error:",A)}};return y?l.jsxs("div",{className:"audit-log-panel p-4 space-y-3",children:[l.jsxs("div",{className:"flex gap-4",children:[l.jsx(fe,{className:"h-4 w-20"}),l.jsx(fe,{className:"h-4 w-24"}),l.jsx(fe,{className:"h-4 w-20"})]}),l.jsx(Rt,{}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(fe,{className:"h-6 w-full"}),l.jsx(fe,{className:"h-6 w-full"}),l.jsx(fe,{className:"h-6 w-full"}),l.jsx(fe,{className:"h-6 w-3/4"})]})]}):x?l.jsx("div",{className:"audit-log-panel p-4",children:l.jsxs("div",{className:"text-error",children:["Error: ",x]})}):l.jsx("div",{className:"audit-log-panel flex flex-col h-full",children:l.jsxs(St,{delayDuration:300,children:[i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"audit-log-stats flex gap-4 p-2 text-sm",children:[l.jsxs("span",{className:"text-muted",children:["Total: ",l.jsx("strong",{children:i.total})]}),l.jsxs("span",{className:"text-success",children:["Success: ",l.jsx("strong",{children:i.successCount})]}),l.jsxs("span",{className:"text-error",children:["Errors: ",l.jsx("strong",{children:i.errorCount})]})]}),l.jsx(Rt,{})]}),l.jsxs("div",{className:"audit-log-toolbar flex p-2 items-center",children:[l.jsxs("select",{value:d,onChange:A=>h(A.target.value),children:[l.jsx("option",{value:"",children:"All Tools"}),r.map(A=>l.jsx("option",{value:A,children:A},A))]}),l.jsxs("select",{value:f,onChange:A=>p(A.target.value),children:[l.jsx("option",{value:"",children:"All Status"}),l.jsx("option",{value:"success",children:"Success"}),l.jsx("option",{value:"error",children:"Errors"})]}),l.jsx("div",{className:"flex-1"}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"sm",className:"audit-log-btn",onClick:()=>z("json"),children:"JSON"})}),l.jsx(Te,{children:"Export as JSON"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"sm",className:"audit-log-btn",onClick:()=>z("csv"),children:"CSV"})}),l.jsx(Te,{children:"Export as CSV"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"sm",className:"audit-log-btn audit-log-btn-clear",onClick:O,children:"Clear"})}),l.jsx(Te,{children:"Clear audit log"})]})]}),l.jsxs("div",{ref:N,className:"audit-log-entries flex-1",style:{overflow:"auto"},children:[l.jsx("div",{ref:D}),n.length===0?l.jsx("div",{className:"p-4 text-muted text-center",children:"No entries"}):l.jsxs("table",{children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:"text-left",children:"Time"}),l.jsx("th",{className:"text-left",children:"Tool"}),l.jsx("th",{className:"text-left",children:"Input"}),l.jsx("th",{className:"text-right",children:"Duration"}),l.jsx("th",{className:"text-center",children:"Status"})]})}),l.jsx("tbody",{children:n.map((A,G)=>l.jsxs(ue.Fragment,{children:[l.jsxs("tr",{className:E===G?"expanded":"",onClick:()=>_(E===G?null:G),children:[l.jsx("td",{className:"whitespace-nowrap",children:RI(A.timestamp)}),l.jsx("td",{className:"tool-name font-mono","data-tool":A.toolName.toLowerCase(),children:A.toolName}),l.jsx("td",{className:"truncate max-w-[200px]",children:A.input?l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{children:Kx(A.input)})}),l.jsx(Te,{children:A.input})]}):Kx(A.input)}),l.jsx("td",{className:"text-right whitespace-nowrap",children:Zx(A.durationMs)}),l.jsx("td",{className:"text-center",children:A.success?l.jsx("span",{className:"status-ok",children:"✓"}):l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"status-err",children:"✗"})}),l.jsx(Te,{children:A.error})]})})]}),E===G&&l.jsx("tr",{className:"expanded-detail",children:l.jsxs("td",{colSpan:5,children:[l.jsxs("div",{className:"detail-grid",children:[l.jsx(It,{label:"Tool",value:A.toolName}),l.jsx(It,{label:"Duration",value:A.durationMs!==void 0?Zx(A.durationMs):void 0}),A.exitCode!==void 0&&A.exitCode!==null&&l.jsx(It,{label:"Exit Code",value:A.exitCode,mono:!0}),l.jsx(It,{label:"File",value:A.filePath,mono:!0}),A.language&&l.jsx(It,{label:"Language",value:A.language}),A.fileSize!==void 0&&l.jsx(It,{label:"Size",value:OI(A.fileSize)}),A.lineCount!==void 0&&l.jsx(It,{label:"Lines",value:A.lineCount.toLocaleString()}),A.gitStatus&&l.jsx(It,{label:"Git",value:A.gitStatus}),A.diff&&l.jsx(It,{label:"Diff",value:l.jsxs("span",{children:[l.jsxs("span",{style:{color:"var(--success, #22c55e)"},children:["+",A.diff.added]})," ",l.jsxs("span",{style:{color:"var(--error, #ef4444)"},children:["-",A.diff.removed]})]})}),A.command&&l.jsx(It,{label:"Command",value:A.command,mono:!0}),A.workingDirectory&&l.jsx(It,{label:"CWD",value:zI(A.workingDirectory),mono:!0}),A.subagentType&&l.jsx(It,{label:"Agent",value:A.subagentType}),A.isBackground&&l.jsx(It,{label:"Background",value:"Yes"}),A.promptSummary&&l.jsx(It,{label:"Prompt",value:A.promptSummary}),A.resultSummary&&l.jsx(It,{label:"Result",value:A.resultSummary})]}),A.outputSummary&&A.outputSummary.totalLines>0&&l.jsxs("div",{className:"detail-output",children:[l.jsxs("div",{className:"detail-label",children:["Output (",A.outputSummary.totalLines," lines",A.outputSummary.truncated?", truncated":"",")"]}),l.jsxs("pre",{children:[A.outputSummary.firstLines.join(`
78
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return m.useEffect(()=>{document.getElementById(n.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,n]),null},rL=VC,lL=FC,JC=UC,e_=$C,t_=QC,n_=KC,i_=qC,s_=XC;const cL=rL,uL=lL,a_=m.forwardRef(({className:n,...e},i)=>l.jsx(JC,{className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...e,ref:i}));a_.displayName=JC.displayName;const o_=m.forwardRef(({className:n,...e},i)=>l.jsxs(uL,{children:[l.jsx(a_,{}),l.jsx(e_,{ref:i,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...e})]}));o_.displayName=e_.displayName;const r_=({className:n,...e})=>l.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",n),...e});r_.displayName="AlertDialogHeader";const l_=({className:n,...e})=>l.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e});l_.displayName="AlertDialogFooter";const c_=m.forwardRef(({className:n,...e},i)=>l.jsx(i_,{ref:i,className:ye("text-lg font-semibold",n),...e}));c_.displayName=i_.displayName;const u_=m.forwardRef(({className:n,...e},i)=>l.jsx(s_,{ref:i,className:ye("text-sm text-muted-foreground",n),...e}));u_.displayName=s_.displayName;const d_=m.forwardRef(({className:n,...e},i)=>l.jsx(t_,{ref:i,className:ye(Dc(),n),...e}));d_.displayName=t_.displayName;const h_=m.forwardRef(({className:n,...e},i)=>l.jsx(n_,{ref:i,className:ye(Dc({variant:"outline"}),"mt-2 sm:mt-0",n),...e}));h_.displayName=n_.displayName;function dL({isOpen:n,title:e,message:i,confirmLabel:a="Confirm",cancelLabel:r="Cancel",isDanger:c=!1,onConfirm:d,onCancel:h}){return l.jsx(cL,{open:n,onOpenChange:f=>{f||h()},children:l.jsxs(o_,{children:[l.jsxs(r_,{children:[l.jsx(c_,{children:e}),l.jsx(u_,{children:i})]}),l.jsxs(l_,{children:[l.jsx(h_,{onClick:h,children:r}),l.jsx(d_,{className:ye(c&&Dc({variant:"destructive"})),onClick:d,children:a})]})]})})}function hL(n){const[e,i]=ue.useState(!1),a=m.useRef(null),r=m.useCallback(()=>new Promise(f=>{a.current=f,i(!0)}),[]),c=m.useCallback(()=>{i(!1),a.current?.(!0),a.current=null},[]),d=m.useCallback(()=>{i(!1),a.current?.(!1),a.current=null},[]),h={isOpen:e,title:n.title,message:n.message,confirmLabel:n.confirmLabel,cancelLabel:n.cancelLabel,isDanger:n.isDanger,onConfirm:c,onCancel:d};return{isOpen:e,confirm:r,dialogProps:h}}function fL(){const[n,e]=m.useState(null),[i,a]=m.useState(!1),[r,c]=m.useState(null),[d,h]=m.useState(null),f=m.useRef(null),p=m.useCallback(()=>{f.current&&f.current.abort();const b=new AbortController;f.current=b,a(!0),c(null),fetch("/api/agent-load",{signal:b.signal}).then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}: ${x.statusText}`);return x.json()}).then(x=>{e(x),a(!1)}).catch(x=>{x.name!=="AbortError"&&(c(x instanceof Error?x:new Error(String(x))),a(!1))})},[]),y=m.useCallback(async(b,x)=>{const w=await fetch("/api/agent-load/prune-sidecar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent:b,file:x})});if(!w.ok){h({success:!1,error:`HTTP ${w.status}: ${w.statusText}`});return}const E=await w.json();h(E),E.success&&p()},[p]);return m.useEffect(()=>()=>{f.current&&f.current.abort()},[]),{data:n,isLoading:i,error:r,refresh:p,pruneSidecar:y,pruneResult:d}}const mL=["patterns.md","gotchas.md","decisions.md"];function pL({isOpen:n,onClose:e}){const{data:i,isLoading:a,error:r,refresh:c,pruneSidecar:d,pruneResult:h}=fL(),[f,p]=m.useState(null),[y,b]=m.useState(null),{confirm:x,dialogProps:w}=hL({title:"Clear Sidecar",message:y?`Reset ${y.file} for ${y.agent}? This will replace the sidecar with its default template.`:"",confirmLabel:"Confirm",isDanger:!0});m.useEffect(()=>{n&&c()},[n,c]);const E=m.useMemo(()=>i?[...i.agents].sort((T,R)=>(R.totalTokens??0)-(T.totalTokens??0)):[],[i]),C=m.useMemo(()=>E.length?E[0]?.totalTokens??0:0,[E]),S=T=>{p(R=>R===T?null:T)},D=async(T,R)=>{b({agent:T,file:R}),await x()&&await d(T,R),b(null)},N=T=>{const R=T.totalTokens??0,z=C>0?R/C*100:0,O=f===T.agent,A=R>=5e3?"bg-[var(--status-error,#f14c4c)]":R>=3e3?"bg-[var(--status-warning,#cca700)]":"bg-[var(--status-success,#4ec9b0)]";return l.jsxs(NC,{open:O,onOpenChange:()=>S(T.agent),children:[l.jsx(jC,{asChild:!0,children:l.jsxs("div",{className:"px-4 py-2 cursor-pointer hover:bg-muted/50 rounded-md transition-colors","data-testid":`agent-row-${T.agent}`,children:[l.jsxs("div",{className:"flex items-center justify-between mb-1",children:[l.jsx("span",{className:"font-mono text-sm font-medium",children:T.agent}),l.jsx("span",{className:"font-mono text-sm tabular-nums text-text-secondary",children:R.toLocaleString()})]}),l.jsx(BC,{value:z,className:"h-2.5 bg-[var(--border)]",indicatorClassName:A})]})}),l.jsx(TC,{children:l.jsxs("div",{className:"mx-4 mb-3 rounded-md bg-muted/30 p-3 space-y-1",children:[T.components&&T.components.length>0?T.components.map(G=>l.jsxs("div",{className:"flex items-center justify-between text-xs text-text-secondary",children:[l.jsx("span",{children:f_(G.name)}),l.jsx("span",{className:"tabular-nums",children:G.tokens.toLocaleString()})]},G.name)):l.jsx("div",{className:"text-xs text-text-secondary",children:"No component breakdown available"}),l.jsxs("div",{className:"pt-2 border-t border-muted/50 mt-2",children:[l.jsx("div",{className:"text-xs font-medium mb-1.5 text-text-secondary",children:"Sidecars"}),l.jsx("div",{className:"flex gap-2",children:mL.map(G=>l.jsxs(Ce,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:U=>{U.stopPropagation(),D(T.agent,G)},children:["Clear ",G]},G))})]})]})})]},T.agent)},k=()=>a?l.jsx("div",{className:"space-y-3 p-4",children:Array.from({length:5}).map((T,R)=>l.jsxs("div",{"data-testid":`skeleton-${R}`,className:"space-y-1.5 px-4",children:[l.jsxs("div",{className:"flex justify-between",children:[l.jsx(fe,{className:"h-4 w-24"}),l.jsx(fe,{className:"h-4 w-16"})]}),l.jsx(fe,{className:"h-2.5 w-full rounded-full"})]},R))}):r?l.jsxs("div",{className:"p-4 space-y-3",children:[l.jsx("div",{className:"p-4 rounded border border-[var(--status-error)]/20 bg-[var(--status-error)]/5 text-[var(--status-error)] text-sm",children:r.message}),l.jsx("div",{className:"text-center",children:l.jsx(Ce,{variant:"outline",size:"sm",onClick:c,children:"Retry"})})]}):i?l.jsxs("div",{className:"space-y-0.5",children:[h?.success&&h.tokensFreed!=null&&l.jsxs("div",{className:"text-xs text-green-600 px-4 py-1",children:["Freed ",h.tokensFreed.toLocaleString()," tokens from ",h.agent,"/",h.file]}),l.jsxs("div",{className:"flex items-center justify-between px-4 py-2",children:[l.jsxs("span",{"data-testid":"cached-at",className:"text-xs text-[var(--text-muted)]",children:["Cached: ",new Date(i.cachedAt).toLocaleString()]}),l.jsx(Ce,{variant:"ghost",size:"sm",className:"text-xs h-6 text-[var(--text-muted)] hover:text-[var(--text-primary)]",onClick:c,children:"Refresh"})]}),E.map(T=>N(T))]}):null;return l.jsxs(l.Fragment,{children:[l.jsx(fr,{open:n,onOpenChange:T=>{T||e()},title:"Agent Load Analysis",description:"Token usage breakdown for all agents",className:"max-w-2xl",children:k()}),l.jsx(dL,{...w})]})}function gL(n){const[e,i]=m.useState(null),[a,r]=m.useState(!1),[c,d]=m.useState(null),h=m.useRef(null),f=m.useCallback(()=>{h.current&&h.current.abort();const p=new AbortController;h.current=p,r(!0),d(null);const y=new URLSearchParams({days:String(n.days),layer:n.layer||"all"});n.repo&&y.set("repo",n.repo),fetch(`/api/dead-code?${y}`,{signal:p.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{i(b),r(!1)}).catch(b=>{b.name!=="AbortError"&&(d(b instanceof Error?b:new Error(String(b))),r(!1))})},[n.days,n.repo,n.layer]);return m.useEffect(()=>()=>{h.current&&h.current.abort()},[]),{data:e,isLoading:a,error:c,refresh:f}}function vL({isOpen:n,onClose:e,days:i=180,repo:a}){const{data:r,isLoading:c,error:d,refresh:h}=gL({days:i,repo:a,layer:"all"}),[f,p]=m.useState("stale"),[y,b]=m.useState("days_since_last_commit"),[x,w]=m.useState("desc"),[E,C]=m.useState("file"),[S,D]=m.useState("asc");m.useEffect(()=>{n&&h()},[n,h]);const N=m.useCallback(A=>{w(G=>y===A&&G==="desc"?"asc":"desc"),b(A)},[y]),k=m.useCallback(A=>{D(G=>E===A&&G==="desc"?"asc":"desc"),C(A)},[E]),T=r?.stale_file_count??r?.stale_files?.length??0,R=r?.unused_export_count??r?.unused_exports?.length??0,z=m.useMemo(()=>{const A=[...r?.stale_files||[]];return A.sort((G,U)=>{const B=G[y],$=U[y];if(typeof B=="number"&&typeof $=="number")return x==="asc"?B-$:$-B;const ae=String(B),ne=String($);return x==="asc"?ae.localeCompare(ne):ne.localeCompare(ae)}),A},[r?.stale_files,y,x]),O=m.useMemo(()=>{const A=[...r?.unused_exports||[]];return A.sort((G,U)=>{const B=G[E],$=U[E];if(typeof B=="number"&&typeof $=="number")return S==="asc"?B-$:$-B;const ae=String(B),ne=String($);return S==="asc"?ae.localeCompare(ne):ne.localeCompare(ae)}),A},[r?.unused_exports,E,S]);return l.jsx(qc,{open:n,onOpenChange:A=>{A||e()},children:l.jsxs(ur,{className:"max-w-4xl max-h-[80vh]",children:[l.jsxs(Yc,{children:[l.jsx(Xc,{children:"Dead Code Analysis"}),l.jsx(Qc,{children:"Diagnostic report — files and exports with no recent activity."})]}),l.jsxs("div",{className:"flex gap-4 border-b border-[var(--border)]",children:[l.jsxs("button",{onClick:()=>p("stale"),className:ye("pb-2 text-sm",f==="stale"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)] font-medium":"text-[var(--text-muted)]"),children:["Stale Files ",l.jsx($e,{variant:"secondary",className:"ml-1",children:T})]}),l.jsxs("button",{onClick:()=>p("exports"),className:ye("pb-2 text-sm",f==="exports"?"border-b-2 border-[var(--accent)] text-[var(--text-primary)] font-medium":"text-[var(--text-muted)]"),children:["Unused Exports ",l.jsx($e,{variant:"secondary",className:"ml-1",children:R})]})]}),l.jsxs(Vm,{className:"h-[50vh]",children:[c&&l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"Analyzing..."}),d&&l.jsx("div",{className:"m-4 p-4 rounded border border-[var(--status-error)]/20 bg-[var(--status-error)]/5 text-[var(--status-error)] text-sm",children:d.message}),r&&f==="stale"&&(z.length===0?l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No stale files found"}):l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{role:"row",className:"border-b border-[var(--border)]",children:[l.jsx("th",{className:"text-left pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>N("path"),children:"File"}),l.jsx("th",{className:"text-right pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>N("days_since_last_commit"),children:"Days Stale"}),l.jsx("th",{className:"text-right pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>N("size_bytes"),children:"Size"}),l.jsx("th",{className:"text-left pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>N("last_commit_date"),children:"Last Commit"})]})}),l.jsx("tbody",{children:z.map(A=>l.jsxs("tr",{role:"row",className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"py-1.5 font-mono text-xs",children:A.path}),l.jsx("td",{className:"py-1.5 text-right tabular-nums font-mono",children:A.days_since_last_commit}),l.jsx("td",{className:"py-1.5 text-right tabular-nums font-mono",children:yL(A.size_bytes)}),l.jsx("td",{className:"py-1.5",children:A.last_commit_date?new Date(A.last_commit_date).toLocaleDateString():"—"})]},A.path))})]})),r&&f==="exports"&&(O.length===0?l.jsx("div",{className:"text-center py-12 text-[var(--text-muted)]",children:"No unused exports found"}):l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{role:"row",className:"border-b border-[var(--border)]",children:[l.jsx("th",{className:"text-left pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>k("file"),children:"File"}),l.jsx("th",{className:"text-left pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>k("symbol"),children:"Export"}),l.jsx("th",{className:"text-right pb-2 cursor-pointer select-none text-xs font-medium uppercase tracking-wider text-[var(--text-muted)]",onClick:()=>k("line"),children:"Line"})]})}),l.jsx("tbody",{children:O.map(A=>l.jsxs("tr",{role:"row",className:"text-[var(--text-primary)]",children:[l.jsx("td",{className:"py-1.5 font-mono text-xs",children:A.file}),l.jsx("td",{className:"py-1.5",children:A.symbol}),l.jsx("td",{className:"py-1.5 text-right tabular-nums font-mono",children:A.line})]},`${A.file}:${A.symbol}`))})]}))]})]})})}function yL(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}const bL=[{min:90,grade:"A",color:"#22c55e"},{min:75,grade:"B",color:"#84cc16"},{min:60,grade:"C",color:"#eab308"},{min:40,grade:"D",color:"#f97316"},{min:0,grade:"F",color:"#ef4444"}],Ux={churn:"Churn",todo_density:"TODO Density",complexity:"Complexity",test_gaps:"Test Gaps",dead_code:"Dead Code",deprecation_debt:"Deprecation Debt",dependency_freshness:"Dependency Freshness",agent_context_efficiency:"Agent Context Efficiency"};function xL(n){for(const e of bL)if(n>=e.min)return{grade:e.grade,color:e.color};return{grade:"F",color:"#ef4444"}}function $x(n,e,i,a,r){const c=Wx(n,e,i,r),d=Wx(n,e,i,a),h=r-a<=180?"0":"1";return`M ${c.x} ${c.y} A ${i} ${i} 0 ${h} 0 ${d.x} ${d.y}`}function Wx(n,e,i,a){const r=(a-90)*Math.PI/180;return{x:n+i*Math.cos(r),y:e+i*Math.sin(r)}}function wL(n){const e=Math.floor(n/1e3);if(e<60)return`${e}s ago`;const i=Math.floor(e/60);return i<60?`${i}m ago`:`${Math.floor(i/60)}h ago`}function SL({score:n,dimensions:e,totalDimensions:i,onDimensionClick:a,isLoading:r,lastFetchedAt:c,onRefresh:d,error:h}){const f=n!=null,p=f?xL(n):null,y=f?n/100*180:0,[b,x]=m.useState(null);m.useEffect(()=>{if(!c){x(null);return}const C=()=>x(wL(Date.now()-c));C();const S=setInterval(C,1e4);return()=>clearInterval(S)},[c]);const w=Object.keys(Ux),E=new Map(e.map(C=>[C.name,C]));return l.jsxs("div",{"data-testid":"health-gauge","data-grade":p?.grade??null,children:[l.jsxs("div",{className:"health-gauge-header",children:[l.jsxs("div",{className:"health-gauge-status",children:[b&&l.jsx("span",{className:"health-gauge-age","data-testid":"health-gauge-age",children:b}),h&&l.jsx("span",{className:"health-gauge-error","data-testid":"health-gauge-error",children:"Failed"})]}),d&&l.jsx(Ce,{variant:"outline",size:"sm",className:"health-gauge-refresh","data-testid":"health-gauge-refresh",onClick:d,disabled:r,children:r?"Analyzing...":f?"Refresh":"Analyze"})]}),l.jsxs("svg",{viewBox:"0 0 200 120",width:"200",height:"120",className:r?"opacity-50":"",children:[l.jsx("path",{d:$x(100,100,80,0,180),fill:"none",stroke:"#333",strokeWidth:"12",strokeLinecap:"round"}),f&&y>0&&l.jsx("path",{d:$x(100,100,80,0,y),fill:"none",stroke:p.color,strokeWidth:"12",strokeLinecap:"round"}),l.jsx("text",{x:"100",y:"85",textAnchor:"middle",fontSize:"28",fill:"currentColor",children:f?String(Math.round(n)):"--"}),p&&l.jsx("text",{x:"100",y:"108",textAnchor:"middle",fontSize:"16",fill:p.color,children:p.grade})]}),f&&i&&e.length<i&&l.jsxs("div",{className:"health-gauge-partial",children:[e.length," of ",i," dimensions"]}),l.jsx("div",{"data-testid":"dimension-breakdown",className:"health-gauge-breakdown",children:w.map(C=>{const S=E.get(C);return l.jsxs("div",{"data-testid":`dimension-${C}`,className:"health-gauge-dimension",onClick:()=>a?.(C),children:[l.jsx("span",{className:"dimension-label",children:Ux[C]||C}),l.jsx("span",{className:"dimension-score",children:S?.score!==null&&S?.score!==void 0?S.score.toFixed(1):"--"})]},C)})})]})}function CL(n){return n>=5e4?"var(--color-danger, #ef4444)":n>=5e3?"var(--color-warning, #f59e0b)":"var(--color-success, #22c55e)"}function _L({history:n}){if(n.length<2)return null;const e=200,i=32,a=2,r=i-a*2,c=n[n.length-1],d=e/n.length;return l.jsx("div",{className:"context-sparkline","data-testid":"context-sparkline",children:l.jsx("svg",{viewBox:`0 0 ${e} ${i}`,role:"img","aria-label":`Context usage trend: currently ${c.percent}%`,children:n.map((h,f)=>{const p=Math.max(1,h.percent/100*r),y=f*d,b=a+r-p;return l.jsx("rect",{x:y,y:b,width:d,height:p,fill:CL(h.tokens),opacity:.8,rx:.5},f)})})})}function EL(){const[n,e]=m.useState(null),[i,a]=m.useState(!1),[r,c]=m.useState(null),[d,h]=m.useState(null),f=m.useRef(null),p=m.useCallback(()=>{f.current&&f.current.abort();const y=new AbortController;f.current=y,a(!0),c(null),fetch("/api/health-score",{signal:y.signal}).then(b=>{if(!b.ok)throw new Error(`HTTP ${b.status}: ${b.statusText}`);return b.json()}).then(b=>{e(b),h(Date.now()),a(!1)}).catch(b=>{b.name!=="AbortError"&&(c(b instanceof Error?b:new Error(String(b))),a(!1))})},[]);return m.useEffect(()=>(p(),()=>{f.current?.abort()}),[p]),{data:n,isLoading:i,error:r,lastFetchedAt:d,refresh:p}}function f_(n){return n==="persona_compressed"?"Persona (Compressed)":n.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function DL(n){if(!n)return 0;switch(n){case"FULL":return 0;case"REFRESH":return 85;case"HANDOFF":return 82;case"MINIMAL":return 95;default:return 0}}function m_(){const[n,e]=m.useState(null),[i,a]=m.useState(null),[r,c]=m.useState(!1),[d,h]=m.useState(!1),[f,p]=m.useState(!1),[y,b]=m.useState(!1),[x,w]=m.useState(!1),[E,C]=m.useState(!1),[S,D]=m.useState(!1),N=EL(),k=m.useRef([]),[T,R]=m.useState(0),z=m.useCallback((U,B)=>{const $=k.current;$.push({percent:U,tokens:B,timestamp:Date.now()}),$.length>50&&$.shift(),R(ae=>ae+1)},[]),O=U=>{switch(U){case"churn":h(!0);break;case"test_gaps":break;case"todo_density":case"deprecation_debt":p(!0);break;case"complexity":b(!0);break;case"dead_code":D(!0);break;case"dependency_freshness":w(!0);break;case"agent_context_efficiency":C(!0);break}};m.useEffect(()=>{const U=window.location.protocol==="https:"?"wss:":"ws:",B=new WebSocket(`${U}//${window.location.host}/ws/context`);B.onmessage=ae=>{try{const ne=JSON.parse(ae.data);if(ne.type==="init"||ne.type==="update"){const W=ne.context;e(W),W.percent!=null&&z(W.percent,W.tokens??0)}}catch{}};const $=new WebSocket(`${U}//${window.location.host}/ws/token-stats`);return $.onmessage=ae=>{try{const ne=JSON.parse(ae.data);a(ne)}catch{}},()=>{B.close(),$.close()}},[z]);const A=n?.tier?`tier-${n.tier.toLowerCase()}`:"",G=DL(n?.tier);return l.jsxs("div",{className:"debug-panel","data-testid":"debug-panel",children:[l.jsx(SL,{score:N.data?.composite_score??null,dimensions:N.data?.dimensions??[],totalDimensions:8,onDimensionClick:O,isLoading:N.isLoading,lastFetchedAt:N.lastFetchedAt,onRefresh:N.refresh,error:N.error}),l.jsx(Rt,{className:"my-3"}),l.jsx("h4",{children:"Context Usage"}),n?l.jsxs("div",{className:"context-info",children:[n.tier&&l.jsxs("div",{className:"tier-display",children:[l.jsx($e,{variant:"outline",className:`tier-badge ${A}`,"data-testid":"tier-badge",children:n.tier}),l.jsxs("span",{className:"tier-savings","data-testid":"tier-savings",children:[G,"% savings"]})]}),n.tokenCounts&&Object.keys(n.tokenCounts).length>0&&l.jsxs("div",{className:"component-breakdown","data-testid":"component-breakdown",children:[l.jsxs("div",{className:"breakdown-header",children:[l.jsxs(Ce,{variant:"ghost",size:"sm",className:"breakdown-toggle","data-testid":"breakdown-toggle",onClick:()=>c(!r),"aria-expanded":r,children:[r?"▼":"▶"," Injected Context"]}),l.jsxs("span",{className:"total-tokens","data-testid":"total-tokens",children:[n.totalTokens?.toLocaleString()," tokens"]})]}),l.jsx("div",{className:`component-list ${r?"expanded":"collapsed"}`,"data-testid":"component-list","aria-expanded":r,children:Object.entries(n.tokenCounts).filter(([,U])=>U>0).sort(([,U],[,B])=>B-U).map(([U,B])=>l.jsxs("div",{className:"component-item","data-testid":`component-${U}`,children:[l.jsx("span",{className:"component-name",children:f_(U)}),l.jsx("span",{className:"component-tokens",children:B.toLocaleString()})]},U))})]}),l.jsx("div",{className:"context-bar",children:l.jsx("div",{className:"context-fill",style:{width:`${n.percent||0}%`}})}),l.jsx(_L,{history:k.current},T),l.jsxs("span",{className:"context-text",children:[(n.tokens??0).toLocaleString()," / ",n.baseline!=null&&n.available!=null?(n.baseline+n.available).toLocaleString():"—"," tokens (",n.percent||0,"%)"]}),n.baseline!=null&&l.jsxs("dl",{className:"context-breakdown",children:[l.jsx("dt",{children:"System Prompt"}),l.jsxs("dd",{children:[n.baseline.toLocaleString()," tokens"]}),l.jsx("dt",{children:"Conversation"}),l.jsxs("dd",{children:[n.usableTokens?.toLocaleString()??"—"," tokens"]}),l.jsx("dt",{children:"Available"}),l.jsxs("dd",{children:[n.available?.toLocaleString()??"—"," tokens"]})]})]}):l.jsx("div",{className:"placeholder",children:"No context data"}),l.jsx(Rt,{className:"my-3"}),l.jsx("h4",{children:"Token Stats"}),i?l.jsxs("dl",{className:"token-stats",children:[i.inputTokens!==void 0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-input",children:[l.jsx("dt",{children:"Input"}),l.jsx("dd",{children:Number(i.inputTokens).toLocaleString()})]}),i.outputTokens!==void 0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-output",children:[l.jsx("dt",{children:"Output"}),l.jsx("dd",{children:Number(i.outputTokens).toLocaleString()})]}),i.cacheReadTokens!==void 0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-cache-read",children:[l.jsx("dt",{children:"Cache Read"}),l.jsx("dd",{children:Number(i.cacheReadTokens).toLocaleString()})]}),i.cacheCreationTokens!==void 0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-cache-write",children:[l.jsx("dt",{children:"Cache Write"}),l.jsx("dd",{children:Number(i.cacheCreationTokens).toLocaleString()})]}),i.totalCostUsd!==void 0&&Number(i.totalCostUsd)>0&&l.jsxs("div",{className:"token-stat-card","data-testid":"token-stat-cost",children:[l.jsx("dt",{children:"Cost"}),l.jsxs("dd",{children:["$",Number(i.totalCostUsd).toFixed(4)]})]})]}):l.jsx("div",{className:"placeholder",children:"No token stats"}),l.jsx(zP,{open:d,onOpenChange:h}),l.jsx(PP,{open:f,onOpenChange:p}),l.jsx(IP,{open:y,onOpenChange:b}),l.jsx(HP,{open:x,onOpenChange:w}),l.jsx(pL,{isOpen:E,onClose:()=>C(!1)}),l.jsx(vL,{isOpen:S,onClose:()=>D(!1)})]})}function Ym(n){const e=m.useRef({value:n,previous:n});return m.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}var nu="Switch",[AL]=cn(nu),[NL,jL]=AL(nu),p_=m.forwardRef((n,e)=>{const{__scopeSwitch:i,name:a,checked:r,defaultChecked:c,required:d,disabled:h,value:f="on",onCheckedChange:p,form:y,...b}=n,[x,w]=m.useState(null),E=Ie(e,k=>w(k)),C=m.useRef(!1),S=x?y||!!x.closest("form"):!0,[D,N]=En({prop:r,defaultProp:c??!1,onChange:p,caller:nu});return l.jsxs(NL,{scope:i,checked:D,disabled:h,children:[l.jsx(je.button,{type:"button",role:"switch","aria-checked":D,"aria-required":d,"data-state":b_(D),"data-disabled":h?"":void 0,disabled:h,value:f,...b,ref:E,onClick:we(n.onClick,k=>{N(T=>!T),S&&(C.current=k.isPropagationStopped(),C.current||k.stopPropagation())})}),S&&l.jsx(y_,{control:x,bubbles:!C.current,name:a,value:f,checked:D,required:d,disabled:h,form:y,style:{transform:"translateX(-100%)"}})]})});p_.displayName=nu;var g_="SwitchThumb",v_=m.forwardRef((n,e)=>{const{__scopeSwitch:i,...a}=n,r=jL(g_,i);return l.jsx(je.span,{"data-state":b_(r.checked),"data-disabled":r.disabled?"":void 0,...a,ref:e})});v_.displayName=g_;var TL="SwitchBubbleInput",y_=m.forwardRef(({__scopeSwitch:n,control:e,checked:i,bubbles:a=!0,...r},c)=>{const d=m.useRef(null),h=Ie(d,c),f=Ym(i),p=Yf(e);return m.useEffect(()=>{const y=d.current;if(!y)return;const b=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(b,"checked").set;if(f!==i&&w){const E=new Event("click",{bubbles:a});w.call(y,i),y.dispatchEvent(E)}},[f,i,a]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i,...r,tabIndex:-1,ref:h,style:{...r.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});y_.displayName=TL;function b_(n){return n?"checked":"unchecked"}var x_=p_,kL=v_;const kf=m.forwardRef(({className:n,...e},i)=>l.jsx(x_,{className:ye("cyclist-switch peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),...e,ref:i,children:l.jsx(kL,{className:ye("cyclist-switch-thumb pointer-events-none block h-4 w-4 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));kf.displayName=x_.displayName;var iu="Popover",[w_]=cn(iu,[Wa]),mr=Wa(),[RL,as]=w_(iu),S_=n=>{const{__scopePopover:e,children:i,open:a,defaultOpen:r,onOpenChange:c,modal:d=!1}=n,h=mr(e),f=m.useRef(null),[p,y]=m.useState(!1),[b,x]=En({prop:a,defaultProp:r??!1,onChange:c,caller:iu});return l.jsx(Zf,{...h,children:l.jsx(RL,{scope:e,contentId:Mt(),triggerRef:f,open:b,onOpenChange:x,onOpenToggle:m.useCallback(()=>x(w=>!w),[x]),hasCustomAnchor:p,onCustomAnchorAdd:m.useCallback(()=>y(!0),[]),onCustomAnchorRemove:m.useCallback(()=>y(!1),[]),modal:d,children:i})})};S_.displayName=iu;var C_="PopoverAnchor",OL=m.forwardRef((n,e)=>{const{__scopePopover:i,...a}=n,r=as(C_,i),c=mr(i),{onCustomAnchorAdd:d,onCustomAnchorRemove:h}=r;return m.useEffect(()=>(d(),()=>h()),[d,h]),l.jsx(kc,{...c,...a,ref:e})});OL.displayName=C_;var __="PopoverTrigger",E_=m.forwardRef((n,e)=>{const{__scopePopover:i,...a}=n,r=as(__,i),c=mr(i),d=Ie(e,r.triggerRef),h=l.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":T_(r.open),...a,ref:d,onClick:we(n.onClick,r.onOpenToggle)});return r.hasCustomAnchor?h:l.jsx(kc,{asChild:!0,...c,children:h})});E_.displayName=__;var Xm="PopoverPortal",[zL,ML]=w_(Xm,{forceMount:void 0}),D_=n=>{const{__scopePopover:e,forceMount:i,children:a,container:r}=n,c=as(Xm,e);return l.jsx(zL,{scope:e,forceMount:i,children:l.jsx(qt,{present:i||c.open,children:l.jsx(rr,{asChild:!0,container:r,children:a})})})};D_.displayName=Xm;var Ha="PopoverContent",A_=m.forwardRef((n,e)=>{const i=ML(Ha,n.__scopePopover),{forceMount:a=i.forceMount,...r}=n,c=as(Ha,n.__scopePopover);return l.jsx(qt,{present:a||c.open,children:c.modal?l.jsx(LL,{...r,ref:e}):l.jsx(IL,{...r,ref:e})})});A_.displayName=Ha;var PL=Pa("PopoverContent.RemoveScroll"),LL=m.forwardRef((n,e)=>{const i=as(Ha,n.__scopePopover),a=m.useRef(null),r=Ie(e,a),c=m.useRef(!1);return m.useEffect(()=>{const d=a.current;if(d)return mm(d)},[]),l.jsx(Vc,{as:PL,allowPinchZoom:!0,children:l.jsx(N_,{...n,ref:r,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(n.onCloseAutoFocus,d=>{d.preventDefault(),c.current||i.triggerRef.current?.focus()}),onPointerDownOutside:we(n.onPointerDownOutside,d=>{const h=d.detail.originalEvent,f=h.button===0&&h.ctrlKey===!0,p=h.button===2||f;c.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:we(n.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1})})})}),IL=m.forwardRef((n,e)=>{const i=as(Ha,n.__scopePopover),a=m.useRef(!1),r=m.useRef(!1);return l.jsx(N_,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{n.onCloseAutoFocus?.(c),c.defaultPrevented||(a.current||i.triggerRef.current?.focus(),c.preventDefault()),a.current=!1,r.current=!1},onInteractOutside:c=>{n.onInteractOutside?.(c),c.defaultPrevented||(a.current=!0,c.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const d=c.target;i.triggerRef.current?.contains(d)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&r.current&&c.preventDefault()}})}),N_=m.forwardRef((n,e)=>{const{__scopePopover:i,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:c,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:y,...b}=n,x=as(Ha,i),w=mr(i);return fm(),l.jsx(Bc,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:c,children:l.jsx(ar,{asChild:!0,disableOutsidePointerEvents:d,onInteractOutside:y,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:p,onDismiss:()=>x.onOpenChange(!1),children:l.jsx(Kf,{"data-state":T_(x.open),role:"dialog",id:x.contentId,...w,...b,ref:e,style:{...b.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),j_="PopoverClose",GL=m.forwardRef((n,e)=>{const{__scopePopover:i,...a}=n,r=as(j_,i);return l.jsx(je.button,{type:"button",...a,ref:e,onClick:we(n.onClick,()=>r.onOpenChange(!1))})});GL.displayName=j_;var BL="PopoverArrow",HL=m.forwardRef((n,e)=>{const{__scopePopover:i,...a}=n,r=mr(i);return l.jsx(Jf,{...r,...a,ref:e})});HL.displayName=BL;function T_(n){return n?"open":"closed"}var VL=S_,FL=E_,UL=D_,k_=A_;const $L=VL,WL=FL,R_=m.forwardRef(({className:n,align:e="center",sideOffset:i=4,...a},r)=>l.jsx(UL,{children:l.jsx(k_,{ref:r,align:e,sideOffset:i,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",n),...a})}));R_.displayName=k_.displayName;function qL(){const n=Fz(),e=[],i=[];for(const a of n){const r=Cn(a);r&&(r.variant==="light"?i.push(a):e.push(a))}return e.sort((a,r)=>(Cn(a)?.name||"").localeCompare(Cn(r)?.name||"")),i.sort((a,r)=>(Cn(a)?.name||"").localeCompare(Cn(r)?.name||"")),{dark:e,light:i}}function qx({presetId:n}){const e=Cn(n);return e?l.jsxs("div",{className:"preset-swatches",children:[l.jsx("span",{className:"preset-swatch",style:{backgroundColor:e.colors.bgPrimary},title:"Background"}),l.jsx("span",{className:"preset-swatch",style:{backgroundColor:e.colors.bgSecondary},title:"Surface"}),l.jsx("span",{className:"preset-swatch",style:{backgroundColor:e.colors.textPrimary},title:"Text"}),l.jsx("span",{className:"preset-swatch",style:{backgroundColor:e.colors.accent},title:"Accent"})]}):null}function YL({currentPreset:n,onSelect:e,className:i=""}){const[a,r]=m.useState(!1),c=m.useMemo(()=>qL(),[]),d=Cn(n),h=f=>{e?.(f),r(!1)};return l.jsxs($L,{open:a,onOpenChange:r,children:[l.jsx(WL,{asChild:!0,children:l.jsxs(Ce,{variant:"outline",className:ye("theme-palette-button",i),"aria-label":`Select theme, current: ${d?.name||n}`,children:[l.jsxs("span",{className:"theme-palette-current",children:[d&&l.jsx("span",{className:"preset-swatch",style:{backgroundColor:d.colors.bgPrimary}}),l.jsx("span",{className:"theme-palette-name",children:d?.name||n})]}),l.jsx(YO,{className:"theme-palette-chevron"})]})}),l.jsx(R_,{className:"theme-palette-popover p-0",align:"start",children:l.jsxs(Em,{children:[l.jsx(Dm,{placeholder:"Search themes..."}),l.jsxs(Am,{children:[l.jsx(Nm,{children:"No theme found."}),l.jsx(nr,{heading:`Dark (${c.dark.length})`,children:c.dark.map(f=>{const p=Cn(f);if(!p)return null;const y=f===n;return l.jsxs(ir,{value:p.name,onSelect:()=>h(f),"data-preset-id":f,children:[l.jsx(qx,{presetId:f}),l.jsx("span",{className:"preset-name",children:p.name}),l.jsx(Ga,{className:ye("preset-check-icon ml-auto",y?"opacity-100":"opacity-0")})]},f)})}),l.jsx(nr,{heading:`Light (${c.light.length})`,children:c.light.map(f=>{const p=Cn(f);if(!p)return null;const y=f===n;return l.jsxs(ir,{value:p.name,onSelect:()=>h(f),"data-preset-id":f,children:[l.jsx(qx,{presetId:f}),l.jsx("span",{className:"preset-name",children:p.name}),l.jsx(Ga,{className:ye("preset-check-icon ml-auto",y?"opacity-100":"opacity-0")})]},f)})})]})]})})]})}var XL=[" ","Enter","ArrowUp","ArrowDown"],QL=[" ","Enter"],Ps="Select",[su,au,ZL]=O0(Ps),[qa]=cn(Ps,[ZL,Wa]),ou=Wa(),[KL,os]=qa(Ps),[JL,eI]=qa(Ps),O_=n=>{const{__scopeSelect:e,children:i,open:a,defaultOpen:r,onOpenChange:c,value:d,defaultValue:h,onValueChange:f,dir:p,name:y,autoComplete:b,disabled:x,required:w,form:E}=n,C=ou(e),[S,D]=m.useState(null),[N,k]=m.useState(null),[T,R]=m.useState(!1),z=Kc(p),[O,A]=En({prop:a,defaultProp:r??!1,onChange:c,caller:Ps}),[G,U]=En({prop:d,defaultProp:h,onChange:f,caller:Ps}),B=m.useRef(null),$=S?E||!!S.closest("form"):!0,[ae,ne]=m.useState(new Set),W=Array.from(ae).map(M=>M.props.value).join(";");return l.jsx(Zf,{...C,children:l.jsxs(KL,{required:w,scope:e,trigger:S,onTriggerChange:D,valueNode:N,onValueNodeChange:k,valueNodeHasChildren:T,onValueNodeHasChildrenChange:R,contentId:Mt(),value:G,onValueChange:U,open:O,onOpenChange:A,dir:z,triggerPointerDownPosRef:B,disabled:x,children:[l.jsx(su.Provider,{scope:e,children:l.jsx(JL,{scope:n.__scopeSelect,onNativeOptionAdd:m.useCallback(M=>{ne(K=>new Set(K).add(M))},[]),onNativeOptionRemove:m.useCallback(M=>{ne(K=>{const q=new Set(K);return q.delete(M),q})},[]),children:i})}),$?l.jsxs(sE,{"aria-hidden":!0,required:w,tabIndex:-1,name:y,autoComplete:b,value:G,onChange:M=>U(M.target.value),disabled:x,form:E,children:[G===void 0?l.jsx("option",{value:""}):null,Array.from(ae)]},W):null]})})};O_.displayName=Ps;var z_="SelectTrigger",M_=m.forwardRef((n,e)=>{const{__scopeSelect:i,disabled:a=!1,...r}=n,c=ou(i),d=os(z_,i),h=d.disabled||a,f=Ie(e,d.onTriggerChange),p=au(i),y=m.useRef("touch"),[b,x,w]=oE(C=>{const S=p().filter(k=>!k.disabled),D=S.find(k=>k.value===d.value),N=rE(S,C,D);N!==void 0&&d.onValueChange(N.value)}),E=C=>{h||(d.onOpenChange(!0),w()),C&&(d.triggerPointerDownPosRef.current={x:Math.round(C.pageX),y:Math.round(C.pageY)})};return l.jsx(kc,{asChild:!0,...c,children:l.jsx(je.button,{type:"button",role:"combobox","aria-controls":d.contentId,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":aE(d.value)?"":void 0,...r,ref:f,onClick:we(r.onClick,C=>{C.currentTarget.focus(),y.current!=="mouse"&&E(C)}),onPointerDown:we(r.onPointerDown,C=>{y.current=C.pointerType;const S=C.target;S.hasPointerCapture(C.pointerId)&&S.releasePointerCapture(C.pointerId),C.button===0&&C.ctrlKey===!1&&C.pointerType==="mouse"&&(E(C),C.preventDefault())}),onKeyDown:we(r.onKeyDown,C=>{const S=b.current!=="";!(C.ctrlKey||C.altKey||C.metaKey)&&C.key.length===1&&x(C.key),!(S&&C.key===" ")&&XL.includes(C.key)&&(E(),C.preventDefault())})})})});M_.displayName=z_;var P_="SelectValue",L_=m.forwardRef((n,e)=>{const{__scopeSelect:i,className:a,style:r,children:c,placeholder:d="",...h}=n,f=os(P_,i),{onValueNodeHasChildrenChange:p}=f,y=c!==void 0,b=Ie(e,f.onValueNodeChange);return Dt(()=>{p(y)},[p,y]),l.jsx(je.span,{...h,ref:b,style:{pointerEvents:"none"},children:aE(f.value)?l.jsx(l.Fragment,{children:d}):c})});L_.displayName=P_;var tI="SelectIcon",I_=m.forwardRef((n,e)=>{const{__scopeSelect:i,children:a,...r}=n;return l.jsx(je.span,{"aria-hidden":!0,...r,ref:e,children:a||"▼"})});I_.displayName=tI;var nI="SelectPortal",G_=n=>l.jsx(rr,{asChild:!0,...n});G_.displayName=nI;var Ls="SelectContent",B_=m.forwardRef((n,e)=>{const i=os(Ls,n.__scopeSelect),[a,r]=m.useState();if(Dt(()=>{r(new DocumentFragment)},[]),!i.open){const c=a;return c?sr.createPortal(l.jsx(H_,{scope:n.__scopeSelect,children:l.jsx(su.Slot,{scope:n.__scopeSelect,children:l.jsx("div",{children:n.children})})}),c):null}return l.jsx(V_,{...n,ref:e})});B_.displayName=Ls;var Rn=10,[H_,rs]=qa(Ls),iI="SelectContentImpl",sI=Pa("SelectContent.RemoveScroll"),V_=m.forwardRef((n,e)=>{const{__scopeSelect:i,position:a="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:c,onPointerDownOutside:d,side:h,sideOffset:f,align:p,alignOffset:y,arrowPadding:b,collisionBoundary:x,collisionPadding:w,sticky:E,hideWhenDetached:C,avoidCollisions:S,...D}=n,N=os(Ls,i),[k,T]=m.useState(null),[R,z]=m.useState(null),O=Ie(e,X=>T(X)),[A,G]=m.useState(null),[U,B]=m.useState(null),$=au(i),[ae,ne]=m.useState(!1),W=m.useRef(!1);m.useEffect(()=>{if(k)return mm(k)},[k]),fm();const M=m.useCallback(X=>{const[ce,...de]=$().map(Ne=>Ne.ref.current),[De]=de.slice(-1),Ge=document.activeElement;for(const Ne of X)if(Ne===Ge||(Ne?.scrollIntoView({block:"nearest"}),Ne===ce&&R&&(R.scrollTop=0),Ne===De&&R&&(R.scrollTop=R.scrollHeight),Ne?.focus(),document.activeElement!==Ge))return},[$,R]),K=m.useCallback(()=>M([A,k]),[M,A,k]);m.useEffect(()=>{ae&&K()},[ae,K]);const{onOpenChange:q,triggerPointerDownPosRef:he}=N;m.useEffect(()=>{if(k){let X={x:0,y:0};const ce=De=>{X={x:Math.abs(Math.round(De.pageX)-(he.current?.x??0)),y:Math.abs(Math.round(De.pageY)-(he.current?.y??0))}},de=De=>{X.x<=10&&X.y<=10?De.preventDefault():k.contains(De.target)||q(!1),document.removeEventListener("pointermove",ce),he.current=null};return he.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",de,{capture:!0})}}},[k,q,he]),m.useEffect(()=>{const X=()=>q(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[q]);const[Se,I]=oE(X=>{const ce=$().filter(Ge=>!Ge.disabled),de=ce.find(Ge=>Ge.ref.current===document.activeElement),De=rE(ce,X,de);De&&setTimeout(()=>De.ref.current.focus())}),L=m.useCallback((X,ce,de)=>{const De=!W.current&&!de;(N.value!==void 0&&N.value===ce||De)&&(G(X),De&&(W.current=!0))},[N.value]),ee=m.useCallback(()=>k?.focus(),[k]),V=m.useCallback((X,ce,de)=>{const De=!W.current&&!de;(N.value!==void 0&&N.value===ce||De)&&B(X)},[N.value]),Y=a==="popper"?Rf:F_,le=Y===Rf?{side:h,sideOffset:f,align:p,alignOffset:y,arrowPadding:b,collisionBoundary:x,collisionPadding:w,sticky:E,hideWhenDetached:C,avoidCollisions:S}:{};return l.jsx(H_,{scope:i,content:k,viewport:R,onViewportChange:z,itemRefCallback:L,selectedItem:A,onItemLeave:ee,itemTextRefCallback:V,focusSelectedItem:K,selectedItemText:U,position:a,isPositioned:ae,searchRef:Se,children:l.jsx(Vc,{as:sI,allowPinchZoom:!0,children:l.jsx(Bc,{asChild:!0,trapped:N.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:we(r,X=>{N.trigger?.focus({preventScroll:!0}),X.preventDefault()}),children:l.jsx(ar,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>N.onOpenChange(!1),children:l.jsx(Y,{role:"listbox",id:N.contentId,"data-state":N.open?"open":"closed",dir:N.dir,onContextMenu:X=>X.preventDefault(),...D,...le,onPlaced:()=>ne(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...D.style},onKeyDown:we(D.onKeyDown,X=>{const ce=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ce&&X.key.length===1&&I(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let De=$().filter(Ge=>!Ge.disabled).map(Ge=>Ge.ref.current);if(["ArrowUp","End"].includes(X.key)&&(De=De.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const Ge=X.target,Ne=De.indexOf(Ge);De=De.slice(Ne+1)}setTimeout(()=>M(De)),X.preventDefault()}})})})})})})});V_.displayName=iI;var aI="SelectItemAlignedPosition",F_=m.forwardRef((n,e)=>{const{__scopeSelect:i,onPlaced:a,...r}=n,c=os(Ls,i),d=rs(Ls,i),[h,f]=m.useState(null),[p,y]=m.useState(null),b=Ie(e,O=>y(O)),x=au(i),w=m.useRef(!1),E=m.useRef(!0),{viewport:C,selectedItem:S,selectedItemText:D,focusSelectedItem:N}=d,k=m.useCallback(()=>{if(c.trigger&&c.valueNode&&h&&p&&C&&S&&D){const O=c.trigger.getBoundingClientRect(),A=p.getBoundingClientRect(),G=c.valueNode.getBoundingClientRect(),U=D.getBoundingClientRect();if(c.dir!=="rtl"){const Ge=U.left-A.left,Ne=G.left-Ge,dt=O.left-Ne,rt=O.width+dt,An=Math.max(rt,A.width),ei=window.innerWidth-Rn,Ya=Tf(Ne,[Rn,Math.max(Rn,ei-An)]);h.style.minWidth=rt+"px",h.style.left=Ya+"px"}else{const Ge=A.right-U.right,Ne=window.innerWidth-G.right-Ge,dt=window.innerWidth-O.right-Ne,rt=O.width+dt,An=Math.max(rt,A.width),ei=window.innerWidth-Rn,Ya=Tf(Ne,[Rn,Math.max(Rn,ei-An)]);h.style.minWidth=rt+"px",h.style.right=Ya+"px"}const B=x(),$=window.innerHeight-Rn*2,ae=C.scrollHeight,ne=window.getComputedStyle(p),W=parseInt(ne.borderTopWidth,10),M=parseInt(ne.paddingTop,10),K=parseInt(ne.borderBottomWidth,10),q=parseInt(ne.paddingBottom,10),he=W+M+ae+q+K,Se=Math.min(S.offsetHeight*5,he),I=window.getComputedStyle(C),L=parseInt(I.paddingTop,10),ee=parseInt(I.paddingBottom,10),V=O.top+O.height/2-Rn,Y=$-V,le=S.offsetHeight/2,X=S.offsetTop+le,ce=W+M+X,de=he-ce;if(ce<=V){const Ge=B.length>0&&S===B[B.length-1].ref.current;h.style.bottom="0px";const Ne=p.clientHeight-C.offsetTop-C.offsetHeight,dt=Math.max(Y,le+(Ge?ee:0)+Ne+K),rt=ce+dt;h.style.height=rt+"px"}else{const Ge=B.length>0&&S===B[0].ref.current;h.style.top="0px";const dt=Math.max(V,W+C.offsetTop+(Ge?L:0)+le)+de;h.style.height=dt+"px",C.scrollTop=ce-V+C.offsetTop}h.style.margin=`${Rn}px 0`,h.style.minHeight=Se+"px",h.style.maxHeight=$+"px",a?.(),requestAnimationFrame(()=>w.current=!0)}},[x,c.trigger,c.valueNode,h,p,C,S,D,c.dir,a]);Dt(()=>k(),[k]);const[T,R]=m.useState();Dt(()=>{p&&R(window.getComputedStyle(p).zIndex)},[p]);const z=m.useCallback(O=>{O&&E.current===!0&&(k(),N?.(),E.current=!1)},[k,N]);return l.jsx(rI,{scope:i,contentWrapper:h,shouldExpandOnScrollRef:w,onScrollButtonChange:z,children:l.jsx("div",{ref:f,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:T},children:l.jsx(je.div,{...r,ref:b,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});F_.displayName=aI;var oI="SelectPopperPosition",Rf=m.forwardRef((n,e)=>{const{__scopeSelect:i,align:a="start",collisionPadding:r=Rn,...c}=n,d=ou(i);return l.jsx(Kf,{...d,...c,ref:e,align:a,collisionPadding:r,style:{boxSizing:"border-box",...c.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Rf.displayName=oI;var[rI,Qm]=qa(Ls,{}),Of="SelectViewport",U_=m.forwardRef((n,e)=>{const{__scopeSelect:i,nonce:a,...r}=n,c=rs(Of,i),d=Qm(Of,i),h=Ie(e,c.onViewportChange),f=m.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),l.jsx(su.Slot,{scope:i,children:l.jsx(je.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:we(r.onScroll,p=>{const y=p.currentTarget,{contentWrapper:b,shouldExpandOnScrollRef:x}=d;if(x?.current&&b){const w=Math.abs(f.current-y.scrollTop);if(w>0){const E=window.innerHeight-Rn*2,C=parseFloat(b.style.minHeight),S=parseFloat(b.style.height),D=Math.max(C,S);if(D<E){const N=D+w,k=Math.min(E,N),T=N-k;b.style.height=k+"px",b.style.bottom==="0px"&&(y.scrollTop=T>0?T:0,b.style.justifyContent="flex-end")}}}f.current=y.scrollTop})})})]})});U_.displayName=Of;var $_="SelectGroup",[lI,cI]=qa($_),W_=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n,r=Mt();return l.jsx(lI,{scope:i,id:r,children:l.jsx(je.div,{role:"group","aria-labelledby":r,...a,ref:e})})});W_.displayName=$_;var q_="SelectLabel",Y_=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n,r=cI(q_,i);return l.jsx(je.div,{id:r.id,...a,ref:e})});Y_.displayName=q_;var Ec="SelectItem",[uI,X_]=qa(Ec),Q_=m.forwardRef((n,e)=>{const{__scopeSelect:i,value:a,disabled:r=!1,textValue:c,...d}=n,h=os(Ec,i),f=rs(Ec,i),p=h.value===a,[y,b]=m.useState(c??""),[x,w]=m.useState(!1),E=Ie(e,N=>f.itemRefCallback?.(N,a,r)),C=Mt(),S=m.useRef("touch"),D=()=>{r||(h.onValueChange(a),h.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(uI,{scope:i,value:a,disabled:r,textId:C,isSelected:p,onItemTextChange:m.useCallback(N=>{b(k=>k||(N?.textContent??"").trim())},[]),children:l.jsx(su.ItemSlot,{scope:i,value:a,disabled:r,textValue:y,children:l.jsx(je.div,{role:"option","aria-labelledby":C,"data-highlighted":x?"":void 0,"aria-selected":p&&x,"data-state":p?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...d,ref:E,onFocus:we(d.onFocus,()=>w(!0)),onBlur:we(d.onBlur,()=>w(!1)),onClick:we(d.onClick,()=>{S.current!=="mouse"&&D()}),onPointerUp:we(d.onPointerUp,()=>{S.current==="mouse"&&D()}),onPointerDown:we(d.onPointerDown,N=>{S.current=N.pointerType}),onPointerMove:we(d.onPointerMove,N=>{S.current=N.pointerType,r?f.onItemLeave?.():S.current==="mouse"&&N.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(d.onPointerLeave,N=>{N.currentTarget===document.activeElement&&f.onItemLeave?.()}),onKeyDown:we(d.onKeyDown,N=>{f.searchRef?.current!==""&&N.key===" "||(QL.includes(N.key)&&D(),N.key===" "&&N.preventDefault())})})})})});Q_.displayName=Ec;var Yo="SelectItemText",Z_=m.forwardRef((n,e)=>{const{__scopeSelect:i,className:a,style:r,...c}=n,d=os(Yo,i),h=rs(Yo,i),f=X_(Yo,i),p=eI(Yo,i),[y,b]=m.useState(null),x=Ie(e,D=>b(D),f.onItemTextChange,D=>h.itemTextRefCallback?.(D,f.value,f.disabled)),w=y?.textContent,E=m.useMemo(()=>l.jsx("option",{value:f.value,disabled:f.disabled,children:w},f.value),[f.disabled,f.value,w]),{onNativeOptionAdd:C,onNativeOptionRemove:S}=p;return Dt(()=>(C(E),()=>S(E)),[C,S,E]),l.jsxs(l.Fragment,{children:[l.jsx(je.span,{id:f.textId,...c,ref:x}),f.isSelected&&d.valueNode&&!d.valueNodeHasChildren?sr.createPortal(c.children,d.valueNode):null]})});Z_.displayName=Yo;var K_="SelectItemIndicator",J_=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n;return X_(K_,i).isSelected?l.jsx(je.span,{"aria-hidden":!0,...a,ref:e}):null});J_.displayName=K_;var zf="SelectScrollUpButton",eE=m.forwardRef((n,e)=>{const i=rs(zf,n.__scopeSelect),a=Qm(zf,n.__scopeSelect),[r,c]=m.useState(!1),d=Ie(e,a.onScrollButtonChange);return Dt(()=>{if(i.viewport&&i.isPositioned){let h=function(){const p=f.scrollTop>0;c(p)};const f=i.viewport;return h(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,i.isPositioned]),r?l.jsx(nE,{...n,ref:d,onAutoScroll:()=>{const{viewport:h,selectedItem:f}=i;h&&f&&(h.scrollTop=h.scrollTop-f.offsetHeight)}}):null});eE.displayName=zf;var Mf="SelectScrollDownButton",tE=m.forwardRef((n,e)=>{const i=rs(Mf,n.__scopeSelect),a=Qm(Mf,n.__scopeSelect),[r,c]=m.useState(!1),d=Ie(e,a.onScrollButtonChange);return Dt(()=>{if(i.viewport&&i.isPositioned){let h=function(){const p=f.scrollHeight-f.clientHeight,y=Math.ceil(f.scrollTop)<p;c(y)};const f=i.viewport;return h(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,i.isPositioned]),r?l.jsx(nE,{...n,ref:d,onAutoScroll:()=>{const{viewport:h,selectedItem:f}=i;h&&f&&(h.scrollTop=h.scrollTop+f.offsetHeight)}}):null});tE.displayName=Mf;var nE=m.forwardRef((n,e)=>{const{__scopeSelect:i,onAutoScroll:a,...r}=n,c=rs("SelectScrollButton",i),d=m.useRef(null),h=au(i),f=m.useCallback(()=>{d.current!==null&&(window.clearInterval(d.current),d.current=null)},[]);return m.useEffect(()=>()=>f(),[f]),Dt(()=>{h().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[h]),l.jsx(je.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:we(r.onPointerDown,()=>{d.current===null&&(d.current=window.setInterval(a,50))}),onPointerMove:we(r.onPointerMove,()=>{c.onItemLeave?.(),d.current===null&&(d.current=window.setInterval(a,50))}),onPointerLeave:we(r.onPointerLeave,()=>{f()})})}),dI="SelectSeparator",iE=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n;return l.jsx(je.div,{"aria-hidden":!0,...a,ref:e})});iE.displayName=dI;var Pf="SelectArrow",hI=m.forwardRef((n,e)=>{const{__scopeSelect:i,...a}=n,r=ou(i),c=os(Pf,i),d=rs(Pf,i);return c.open&&d.position==="popper"?l.jsx(Jf,{...r,...a,ref:e}):null});hI.displayName=Pf;var fI="SelectBubbleInput",sE=m.forwardRef(({__scopeSelect:n,value:e,...i},a)=>{const r=m.useRef(null),c=Ie(a,r),d=Ym(e);return m.useEffect(()=>{const h=r.current;if(!h)return;const f=window.HTMLSelectElement.prototype,y=Object.getOwnPropertyDescriptor(f,"value").set;if(d!==e&&y){const b=new Event("change",{bubbles:!0});y.call(h,e),h.dispatchEvent(b)}},[d,e]),l.jsx(je.select,{...i,style:{...Yw,...i.style},ref:c,defaultValue:e})});sE.displayName=fI;function aE(n){return n===""||n===void 0}function oE(n){const e=Gt(n),i=m.useRef(""),a=m.useRef(0),r=m.useCallback(d=>{const h=i.current+d;e(h),(function f(p){i.current=p,window.clearTimeout(a.current),p!==""&&(a.current=window.setTimeout(()=>f(""),1e3))})(h)},[e]),c=m.useCallback(()=>{i.current="",window.clearTimeout(a.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(a.current),[]),[i,r,c]}function rE(n,e,i){const r=e.length>1&&Array.from(e).every(p=>p===e[0])?e[0]:e,c=i?n.indexOf(i):-1;let d=mI(n,Math.max(c,0));r.length===1&&(d=d.filter(p=>p!==i));const f=d.find(p=>p.textValue.toLowerCase().startsWith(r.toLowerCase()));return f!==i?f:void 0}function mI(n,e){return n.map((i,a)=>n[(e+a)%n.length])}var pI=O_,lE=M_,gI=L_,vI=I_,yI=G_,cE=B_,bI=U_,xI=W_,uE=Y_,dE=Q_,wI=Z_,SI=J_,hE=eE,fE=tE,mE=iE;const CI=pI,Jh=xI,_I=gI,pE=m.forwardRef(({className:n,children:e,...i},a)=>l.jsxs(lE,{ref:a,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...i,children:[e,l.jsx(vI,{asChild:!0,children:l.jsx(c0,{className:"h-4 w-4 opacity-50"})})]}));pE.displayName=lE.displayName;const gE=m.forwardRef(({className:n,...e},i)=>l.jsx(hE,{ref:i,className:ye("flex cursor-default items-center justify-center py-1",n),...e,children:l.jsx(WO,{className:"h-4 w-4"})}));gE.displayName=hE.displayName;const vE=m.forwardRef(({className:n,...e},i)=>l.jsx(fE,{ref:i,className:ye("flex cursor-default items-center justify-center py-1",n),...e,children:l.jsx(c0,{className:"h-4 w-4"})}));vE.displayName=fE.displayName;const yE=m.forwardRef(({className:n,children:e,position:i="popper",...a},r)=>l.jsx(yI,{children:l.jsxs(cE,{ref:r,className:ye("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",i==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:i,...a,children:[l.jsx(gE,{}),l.jsx(bI,{className:ye("p-1",i==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(vE,{})]})}));yE.displayName=cE.displayName;const sc=m.forwardRef(({className:n,...e},i)=>l.jsx(uE,{ref:i,className:ye("px-2 py-1.5 text-sm font-semibold",n),...e}));sc.displayName=uE.displayName;const ac=m.forwardRef(({className:n,children:e,...i},a)=>l.jsxs(dE,{ref:a,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...i,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(SI,{children:l.jsx(Ga,{className:"h-4 w-4"})})}),l.jsx(wI,{children:e})]}));ac.displayName=dE.displayName;const EI=m.forwardRef(({className:n,...e},i)=>l.jsx(mE,{ref:i,className:ye("-mx-1 my-1 h-px bg-muted",n),...e}));EI.displayName=mE.displayName;function DI(n,e){const i=n.getUint16(4);for(let a=0;a<i;a++){const r=12+a*16;if(String.fromCharCode(n.getUint8(r),n.getUint8(r+1),n.getUint8(r+2),n.getUint8(r+3))===e)return{offset:n.getUint32(r+8),length:n.getUint32(r+12)}}return null}async function AI(n){try{const i=await(await n.blob()).arrayBuffer(),a=new DataView(i),r=DI(a,"post");return r?a.getUint32(r.offset+12)!==0:!1}catch{return!1}}const Zm="cyclist-system-fonts";function NI(){try{const n=localStorage.getItem(Zm);if(!n)return null;const e=JSON.parse(n);return e.fonts?.length>0?e.fonts:null}catch{return null}}function jI(n,e){try{const i={fonts:n,count:e};localStorage.setItem(Zm,JSON.stringify(i))}catch{}}let Xl=null;async function TI(){return Xl||(Xl=(async()=>{if(!("queryLocalFonts"in window))return[];try{const n=await window.queryLocalFonts(),e=new Map;for(const h of n)e.has(h.family)||e.set(h.family,h);const i=e.size,a=NI();if(a&&a.length>0)try{const h=localStorage.getItem(Zm);if(h&&JSON.parse(h).count===i)return a}catch{}const r=Array.from(e.entries()),c=await Promise.all(r.map(([,h])=>AI(h))),d=r.map(([h],f)=>({family:h,isMonospace:c[f]}));return d.sort((h,f)=>h.family.localeCompare(f.family)),jI(d,i),d}catch{return[]}})(),Xl)}const Ql="system-font:";function Yx({type:n,currentFont:e,customFont:i,onSelect:a,onCustomFontChange:r,className:c=""}){const[d,h]=m.useState(i||""),[f,p]=m.useState([]),[y,b]=m.useState(!1),x=n==="ui"?v0:y0,w=x.find(R=>R.id===e);m.useEffect(()=>{y||TI().then(R=>{p(R),b(!0)})},[y]);const E=m.useMemo(()=>{let R=f;return R=R.filter(z=>/^[\x20-\x7E\u00C0-\u024F]+$/.test(z.family)),n==="code"&&(R=R.filter(z=>z.isMonospace)),R},[f,n]),C=m.useMemo(()=>x.filter(R=>!R.isCustom),[x]);m.useEffect(()=>{i!==void 0&&h(i)},[i]);const S=m.useMemo(()=>e==="custom"&&d?f.some(z=>z.family===d)?`${Ql}${d}`:"custom":e,[e,d,f]),D=m.useCallback(R=>{if(R.startsWith(Ql)){const z=R.slice(Ql.length);a("custom",z)}else a(R==="custom"?"custom":R)},[a]),N=m.useCallback(R=>{const z=R.target.value;h(z),r?.(z),e==="custom"&&a("custom",z)},[e,a,r]),k=f.length>0,T=e==="custom"&&!k;return l.jsxs("div",{className:`font-picker ${c}`,children:[l.jsxs(CI,{value:S,onValueChange:D,children:[l.jsx(pE,{className:"font-picker-trigger","aria-label":`Select ${n} font`,style:{fontFamily:w?.fontFamily||(d?`"${d}"`:"inherit")},children:l.jsx(_I,{placeholder:"Select font..."})}),l.jsxs(yE,{className:"max-h-[300px]",children:[C.length>0&&l.jsxs(Jh,{children:[l.jsx(sc,{children:"Presets"}),C.map(R=>l.jsx(ac,{value:R.id,style:{fontFamily:R.fontFamily||"inherit"},children:l.jsxs("span",{className:"font-picker-item-content",children:[l.jsx("span",{className:"font-name",children:R.name}),l.jsx("span",{className:"font-preview",style:{fontFamily:R.fontFamily},children:"Aa"})]})},R.id))]}),k&&E.length>0&&l.jsxs(Jh,{children:[l.jsxs(sc,{children:["System Fonts (",E.length,")"]}),E.map(R=>l.jsx(ac,{value:`${Ql}${R.family}`,style:{fontFamily:`"${R.family}", inherit`},children:l.jsxs("span",{className:"font-picker-item-content",children:[l.jsx("span",{className:"font-name",children:R.family}),l.jsx("span",{className:"font-preview",style:{fontFamily:`"${R.family}"`},children:"Aa"})]})},R.family))]}),!k&&y&&l.jsxs(Jh,{children:[l.jsx(sc,{children:"Custom"}),l.jsx(ac,{value:"custom",children:"Custom..."})]})]})]}),T&&l.jsx("input",{type:"text",className:"font-picker-custom-input",value:d,onChange:N,placeholder:"Enter font family...","aria-label":"Custom font family"})]})}const kI=["xs","sm","base","lg","xl"];function Xx({currentSize:n,onSelect:e,className:i=""}){return l.jsx(St,{delayDuration:300,children:l.jsx("div",{className:`font-size-picker ${i}`,role:"group","aria-label":"Font size",children:kI.map(a=>l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:a===n?"secondary":"ghost",size:"sm",className:`font-size-option ${a===n?"active":""}`,"data-size":a,onClick:()=>e(a),"aria-pressed":a===n,children:a.toUpperCase()})}),l.jsx(Te,{children:`${Cf[a]} (${a})`})]},a))})})}const Qx={S:0,A:1,B:2};function bE(){const[n,e]=m.useState(null),[i,a]=m.useState([]),[r,c]=m.useState(!1),[d,h]=m.useState(ic),[f,p]=m.useState(Tm);m.useEffect(()=>{async function S(){try{console.log("[SettingsPanel] Loading settings via REST");const T=await fetch("/api/settings");if(T.ok){const R=await T.json();console.log("[SettingsPanel] Settings loaded:",R),e(R)}}catch(T){console.error("[SettingsPanel] Failed to load settings:",T)}}async function D(){try{const T=await fetch("/api/settings/themes");if(T.ok){const R=await T.json();a(R.themes||[])}}catch(T){console.error("[SettingsPanel] Failed to load themes:",T)}}S(),D(),console.log("[SettingsPanel] Connecting to /ws/settings for real-time sync");const N=window.location.protocol==="https:"?"wss:":"ws:",k=new WebSocket(`${N}//${window.location.host}/ws/settings`);return k.onmessage=T=>{try{const R=JSON.parse(T.data);(R.type==="init"||R.type==="update")&&(console.log("[SettingsPanel] Settings update via WebSocket:",R.settings),e(R.settings))}catch(R){console.error("[SettingsPanel] Failed to parse WebSocket message:",R)}},k.onerror=T=>{console.error("[SettingsPanel] WebSocket error:",T)},w0().then(T=>{_f(T),h(T)}),b0().then(T=>{p(T),nc(T)}),()=>k.close()},[]);const y=m.useMemo(()=>[...i].sort((S,D)=>{const N=(Qx[S.tier]??3)-(Qx[D.tier]??3);return N!==0?N:S.name.localeCompare(D.name)}),[i]),b=m.useCallback(async S=>{if(n){c(!0);try{const D={...n,pennyfarthing:{...n.pennyfarthing,theme:S}};await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({pennyfarthing:{theme:S}})}),e(D)}finally{c(!1)}}},[n]),x=m.useCallback(async(S,D,N)=>{if(n){console.log(`[SettingsPanel] Toggle ${S}.${D} = ${N}`),c(!0);try{const k={...n,[S]:{...n[S],[D]:N}};console.log("[SettingsPanel] Saving via REST"),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[S]:{[D]:N}})}),console.log("[SettingsPanel] Save complete, updating local state"),e(k)}finally{c(!1)}}},[n]),w=m.useCallback(async S=>{c(!0);try{_f(S),await Uz(S),h(S)}finally{c(!1)}},[]),E=m.useCallback(async(S,D,N)=>{c(!0);try{const k={...f,[S==="ui"?"uiFont":"codeFont"]:D,...D==="custom"&&N?{[S==="ui"?"customUiFont":"customCodeFont"]:N}:{}};nc(k),await px(k),p(k)}finally{c(!1)}},[f]),C=m.useCallback(async(S,D)=>{c(!0);try{const N={...f,[S==="ui"?"uiFontSize":"codeFontSize"]:D};nc(N),await px(N),p(N)}finally{c(!1)}},[f]);return n?l.jsxs("div",{className:"settings-panel","data-testid":"settings-panel",children:[l.jsxs("section",{className:"settings-section",children:[l.jsx("h4",{children:"Theme"}),l.jsx("select",{value:n.pennyfarthing?.theme||"",onChange:S=>b(S.target.value),disabled:r,className:"theme-select",children:y.map(S=>l.jsxs("option",{value:S.id,children:["[",S.tier||"Unranked","] ",S.name]},S.id))})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{className:"settings-section",children:[l.jsx("h4",{children:"Color Palette"}),l.jsx(YL,{currentPreset:d,onSelect:w})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{className:"settings-section",children:[l.jsx("h4",{children:"Fonts"}),l.jsxs("div",{className:"font-setting",children:[l.jsx("label",{children:"UI Font"}),l.jsx(Yx,{type:"ui",currentFont:f.uiFont,customFont:f.customUiFont,onSelect:(S,D)=>E("ui",S,D)}),l.jsx(Xx,{currentSize:f.uiFontSize,onSelect:S=>C("ui",S)})]}),l.jsxs("div",{className:"font-setting",children:[l.jsx("label",{children:"Code Font"}),l.jsx(Yx,{type:"code",currentFont:f.codeFont,customFont:f.customCodeFont,onSelect:(S,D)=>E("code",S,D)}),l.jsx(Xx,{currentSize:f.codeFontSize,onSelect:S=>C("code",S)})]})]}),l.jsx(Rt,{className:"my-2"}),l.jsxs("section",{className:"settings-section",children:[l.jsx("h4",{children:"Workflow"}),window.__CYCLIST_MODE__==="cyclist"&&l.jsxs("div",{className:"toggle-setting",children:[l.jsx(kf,{checked:n.workflow?.bell_mode||!1,onCheckedChange:S=>x("workflow","bell_mode",S),disabled:r}),"Bell Mode",l.jsx("span",{className:"setting-description",children:"Inject queued messages via PostToolUse hook instead of waiting"})]}),l.jsxs("div",{className:"toggle-setting",children:[l.jsx(kf,{checked:n.workflow?.relay_mode||!1,onCheckedChange:S=>x("workflow","relay_mode",S),disabled:r}),"Relay Mode",l.jsx("span",{className:"setting-description",children:"Auto-handoff to next agent"})]})]})]}):l.jsx("div",{className:"settings-panel loading","data-testid":"settings-panel",children:l.jsxs("div",{className:"space-y-4 p-2",children:[l.jsx(fe,{className:"h-4 w-24"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-4 w-32"}),l.jsx(fe,{className:"h-8 w-full"}),l.jsx(fe,{className:"h-4 w-20"}),l.jsx(fe,{className:"h-6 w-48"})]})})}function RI(n){return new Date(n).toLocaleTimeString()}function Zx(n){return n===void 0?"-":n<1e3?`${n}ms`:`${(n/1e3).toFixed(1)}s`}function Kx(n,e=60){return n?n.length<=e?n:n.substring(0,e)+"...":"-"}function OI(n){return n===void 0?"":n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function zI(n){if(!n)return"";const e=n.split("/");return e.length<=3?n:".../"+e.slice(-3).join("/")}function It({label:n,value:e,mono:i}){return e==null||e===""?null:l.jsxs("div",{className:"detail-row",children:[l.jsx("span",{className:"detail-label",children:n}),l.jsx("span",{className:i?"detail-value font-mono":"detail-value",children:e})]})}function xE(){const[n,e]=m.useState([]),[i,a]=m.useState(null),[r,c]=m.useState([]),[d,h]=m.useState(""),[f,p]=m.useState(""),[y,b]=m.useState(!0),[x,w]=m.useState(null),[E,C]=m.useState(null),S=m.useRef(!0),D=m.useRef(null),N=m.useRef(null);m.useEffect(()=>{const A=N.current;if(!A)return;const G=()=>{S.current=A.scrollTop===0};return A.addEventListener("scroll",G),()=>A.removeEventListener("scroll",G)},[y]),m.useEffect(()=>{S.current&&D.current&&n.length>0&&D.current.scrollIntoView()},[n]);const k=m.useCallback(async()=>{try{const A=new URLSearchParams;d&&A.set("toolType",d),f&&A.set("status",f),A.set("limit","200");const G=await fetch(`/api/audit-log?${A}`);if(!G.ok)throw new Error("Failed to fetch audit log");const U=await G.json();e(U.entries||[]),w(null)}catch(A){w(A instanceof Error?A.message:"Unknown error")}},[d,f]),T=m.useCallback(async()=>{try{const A=await fetch("/api/audit-log/stats");if(!A.ok)throw new Error("Failed to fetch stats");const G=await A.json();a(G)}catch(A){console.error("[AuditLogPanel] Stats error:",A)}},[]),R=m.useCallback(async()=>{try{const A=await fetch("/api/audit-log/types");if(!A.ok)throw new Error("Failed to fetch types");const G=await A.json();c(G.types||[])}catch(A){console.error("[AuditLogPanel] Types error:",A)}},[]);m.useEffect(()=>{b(!0),Promise.all([k(),T(),R()]).finally(()=>{b(!1)});const A=new WebSocket(`ws://${window.location.host}/ws/spans`);return A.onmessage=G=>{try{const U=JSON.parse(G.data);U.type==="span"&&U.span&&(e(B=>[U.span,...B].slice(0,200)),T())}catch(U){console.error("[AuditLogPanel] WebSocket parse error:",U)}},()=>A.close()},[k,T,R]),m.useEffect(()=>{k()},[d,f,k]);const z=async A=>{try{const G=new URLSearchParams;G.set("format",A),G.set("download","true"),d&&G.set("toolType",d);const U=await fetch(`/api/audit-log/export?${G}`);if(!U.ok)throw new Error("Export failed");const B=await U.blob(),$=URL.createObjectURL(B),ae=document.createElement("a");ae.href=$,ae.download=`audit-log.${A}`,ae.click(),URL.revokeObjectURL($)}catch(G){console.error("[AuditLogPanel] Export error:",G)}},O=async()=>{if(confirm("Clear all audit log entries?"))try{if(!(await fetch("/api/audit-log",{method:"DELETE"})).ok)throw new Error("Clear failed");e([]),T()}catch(A){console.error("[AuditLogPanel] Clear error:",A)}};return y?l.jsxs("div",{className:"audit-log-panel p-4 space-y-3",children:[l.jsxs("div",{className:"flex gap-4",children:[l.jsx(fe,{className:"h-4 w-20"}),l.jsx(fe,{className:"h-4 w-24"}),l.jsx(fe,{className:"h-4 w-20"})]}),l.jsx(Rt,{}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(fe,{className:"h-6 w-full"}),l.jsx(fe,{className:"h-6 w-full"}),l.jsx(fe,{className:"h-6 w-full"}),l.jsx(fe,{className:"h-6 w-3/4"})]})]}):x?l.jsx("div",{className:"audit-log-panel p-4",children:l.jsxs("div",{className:"text-error",children:["Error: ",x]})}):l.jsx("div",{className:"audit-log-panel flex flex-col h-full",children:l.jsxs(St,{delayDuration:300,children:[i&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"audit-log-stats flex gap-4 p-2 text-sm",children:[l.jsxs("span",{className:"text-muted",children:["Total: ",l.jsx("strong",{children:i.total})]}),l.jsxs("span",{className:"text-success",children:["Success: ",l.jsx("strong",{children:i.successCount})]}),l.jsxs("span",{className:"text-error",children:["Errors: ",l.jsx("strong",{children:i.errorCount})]})]}),l.jsx(Rt,{})]}),l.jsxs("div",{className:"audit-log-toolbar flex p-2 items-center",children:[l.jsxs("select",{value:d,onChange:A=>h(A.target.value),children:[l.jsx("option",{value:"",children:"All Tools"}),r.map(A=>l.jsx("option",{value:A,children:A},A))]}),l.jsxs("select",{value:f,onChange:A=>p(A.target.value),children:[l.jsx("option",{value:"",children:"All Status"}),l.jsx("option",{value:"success",children:"Success"}),l.jsx("option",{value:"error",children:"Errors"})]}),l.jsx("div",{className:"flex-1"}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"sm",className:"audit-log-btn",onClick:()=>z("json"),children:"JSON"})}),l.jsx(Te,{children:"Export as JSON"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"sm",className:"audit-log-btn",onClick:()=>z("csv"),children:"CSV"})}),l.jsx(Te,{children:"Export as CSV"})]}),l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx(Ce,{variant:"ghost",size:"sm",className:"audit-log-btn audit-log-btn-clear",onClick:O,children:"Clear"})}),l.jsx(Te,{children:"Clear audit log"})]})]}),l.jsxs("div",{ref:N,className:"audit-log-entries flex-1",style:{overflow:"auto"},children:[l.jsx("div",{ref:D}),n.length===0?l.jsx("div",{className:"p-4 text-muted text-center",children:"No entries"}):l.jsxs("table",{children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:"text-left",children:"Time"}),l.jsx("th",{className:"text-left",children:"Tool"}),l.jsx("th",{className:"text-left",children:"Input"}),l.jsx("th",{className:"text-right",children:"Duration"}),l.jsx("th",{className:"text-center",children:"Status"})]})}),l.jsx("tbody",{children:n.map((A,G)=>l.jsxs(ue.Fragment,{children:[l.jsxs("tr",{className:E===G?"expanded":"",onClick:()=>C(E===G?null:G),children:[l.jsx("td",{className:"whitespace-nowrap",children:RI(A.timestamp)}),l.jsx("td",{className:"tool-name font-mono","data-tool":A.toolName.toLowerCase(),children:A.toolName}),l.jsx("td",{className:"truncate max-w-[200px]",children:A.input?l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{children:Kx(A.input)})}),l.jsx(Te,{children:A.input})]}):Kx(A.input)}),l.jsx("td",{className:"text-right whitespace-nowrap",children:Zx(A.durationMs)}),l.jsx("td",{className:"text-center",children:A.success?l.jsx("span",{className:"status-ok",children:"✓"}):l.jsxs(Re,{children:[l.jsx(Oe,{asChild:!0,children:l.jsx("span",{className:"status-err",children:"✗"})}),l.jsx(Te,{children:A.error})]})})]}),E===G&&l.jsx("tr",{className:"expanded-detail",children:l.jsxs("td",{colSpan:5,children:[l.jsxs("div",{className:"detail-grid",children:[l.jsx(It,{label:"Tool",value:A.toolName}),l.jsx(It,{label:"Duration",value:A.durationMs!==void 0?Zx(A.durationMs):void 0}),A.exitCode!==void 0&&A.exitCode!==null&&l.jsx(It,{label:"Exit Code",value:A.exitCode,mono:!0}),l.jsx(It,{label:"File",value:A.filePath,mono:!0}),A.language&&l.jsx(It,{label:"Language",value:A.language}),A.fileSize!==void 0&&l.jsx(It,{label:"Size",value:OI(A.fileSize)}),A.lineCount!==void 0&&l.jsx(It,{label:"Lines",value:A.lineCount.toLocaleString()}),A.gitStatus&&l.jsx(It,{label:"Git",value:A.gitStatus}),A.diff&&l.jsx(It,{label:"Diff",value:l.jsxs("span",{children:[l.jsxs("span",{style:{color:"var(--success, #22c55e)"},children:["+",A.diff.added]})," ",l.jsxs("span",{style:{color:"var(--error, #ef4444)"},children:["-",A.diff.removed]})]})}),A.command&&l.jsx(It,{label:"Command",value:A.command,mono:!0}),A.workingDirectory&&l.jsx(It,{label:"CWD",value:zI(A.workingDirectory),mono:!0}),A.subagentType&&l.jsx(It,{label:"Agent",value:A.subagentType}),A.isBackground&&l.jsx(It,{label:"Background",value:"Yes"}),A.promptSummary&&l.jsx(It,{label:"Prompt",value:A.promptSummary}),A.resultSummary&&l.jsx(It,{label:"Result",value:A.resultSummary})]}),A.outputSummary&&A.outputSummary.totalLines>0&&l.jsxs("div",{className:"detail-output",children:[l.jsxs("div",{className:"detail-label",children:["Output (",A.outputSummary.totalLines," lines",A.outputSummary.truncated?", truncated":"",")"]}),l.jsxs("pre",{children:[A.outputSummary.firstLines.join(`
79
79
  `),A.outputSummary.truncated&&A.outputSummary.lastLines.length>0?`
80
80
  ...
81
81
  `+A.outputSummary.lastLines.join(`
82
- `):""]})]}),A.input&&!A.command&&!A.filePath&&!A.subagentType&&l.jsxs("div",{className:"detail-output",children:[l.jsx("div",{className:"detail-label",children:"Input"}),l.jsx("pre",{children:A.input})]}),A.output&&!A.outputSummary&&l.jsxs("div",{className:"detail-output",children:[l.jsx("div",{className:"detail-label",children:"Output"}),l.jsxs("pre",{children:[A.output.substring(0,500),A.output.length>500&&"..."]})]}),A.error&&l.jsxs("div",{className:"detail-output",children:[l.jsx("div",{className:"detail-label status-err",children:"Error"}),l.jsx("pre",{className:"status-err",children:A.error})]})]})})]},`${A.timestamp}-${G}`))})]})]})]})})}function MI(){const{story:n,isLoading:e,error:i}=Pm(),{data:a,isLoading:r}=tC(),{todos:c}=rC(),{gitStatus:d}=Lm(),{context:h}=Om();if(e||r)return l.jsx("div",{className:"progress-panel loading","data-testid":"progress-panel",children:l.jsx("div",{className:"progress-loading",children:"Loading..."})});if(i)return l.jsx("div",{className:"progress-panel","data-testid":"progress-panel",children:l.jsx("div",{className:"error-message",children:i.message})});const f=a?.currentStory;if(!n&&!f)return l.jsx("div",{className:"progress-panel","data-testid":"progress-panel",children:l.jsxs("div",{className:"empty-state",children:[l.jsx("div",{children:"No active story"}),l.jsx("div",{className:"empty-hint",children:"Run /sprint work to start"})]})});const p=n?.id??f?.id??"",y=n?.title??f?.title??"",b=n?.points??f?.points??0,x=f?.jiraKey??"",w=n?.status??f?.status??"",E=n?.epic??f?.epic??"",_=w.replace(/_/g," "),C=n?.workflow??null,D=n?.workflowPhases??null,N=C||D&&D.length>0,k=n?.criteria??null,T=k!=null&&k.length>0,R=T?k.filter(q=>q.completed).length:0,z=T?k.length:0,O=z>0?Math.round(R/z*100):0,A=c&&c.length>0,G=A?c.filter(q=>q.status==="completed").length:0,U=A?c.length:0,B=A?c.find(q=>q.status==="in_progress"):null,$=d?.branch??"",ae=d?.modified??0,ne=d?.untracked??0,W=d?.ahead??0,M=d?.behind??0,K=h?.percent??0;return l.jsxs("div",{className:"progress-panel","data-testid":"progress-panel",children:[l.jsxs("div",{className:"progress-section","data-testid":"progress-story-header",children:[l.jsxs("div",{className:"story-header-row",children:[l.jsx("span",{className:"story-id",children:p}),l.jsxs("span",{className:"story-points",children:[b,"pt"]}),l.jsx("span",{className:"story-status",children:_})]}),l.jsx("div",{className:"story-title",children:y}),l.jsxs("div",{className:"story-meta",children:[l.jsx("span",{className:"story-jira",children:x}),l.jsx("span",{className:"story-epic",children:E})]})]}),N&&l.jsxs("div",{className:"progress-section","data-testid":"progress-workflow-row",children:[C&&l.jsx("span",{className:"workflow-badge",children:C.toUpperCase()==="TDD"||C.toUpperCase()==="BDD"?C.toUpperCase():C.charAt(0).toUpperCase()+C.slice(1)}),D&&D.length>0&&l.jsx("div",{className:"phase-progress",children:D.map(q=>l.jsx("div",{className:`phase-step ${q.status}`,children:l.jsx("span",{className:"phase-label",children:q.label})},q.name))})]}),T&&l.jsxs("div",{className:"progress-section","data-testid":"progress-ac-row",children:[l.jsx("span",{className:"row-label",children:"AC"}),l.jsxs("span",{className:"progress-count",children:[R,"/",z]}),l.jsx("div",{className:"progress-bar-container",role:"progressbar","aria-valuenow":R,"aria-valuemin":0,"aria-valuemax":z,children:l.jsx("div",{className:"progress-bar",style:{width:`${O}%`}})})]}),A&&l.jsxs("div",{className:"progress-section","data-testid":"progress-todo-row",children:[l.jsx("span",{className:"row-label",children:"Tasks"}),l.jsxs("span",{className:"progress-count",children:[G,"/",U]}),l.jsx("div",{className:"progress-bar-container",children:l.jsx("div",{className:"progress-bar",style:{width:`${U>0?Math.round(G/U*100):0}%`}})}),B&&l.jsx("span",{className:"active-task",children:B.activeForm||B.content})]}),l.jsxs("div",{className:"progress-section","data-testid":"progress-git-row",children:[l.jsx("span",{className:"git-branch",children:$}),l.jsxs("span",{className:"git-stats",children:[ae,"M ",ne,"U ↑",W," ↓",M]})]}),l.jsxs("div",{className:"progress-section","data-testid":"progress-context-row",children:[l.jsx("span",{className:"row-label",children:"Context"}),l.jsxs("span",{className:"context-percent",children:[K,"%"]}),l.jsx("div",{className:"progress-bar-container",role:"progressbar","aria-valuenow":K,"aria-valuemin":0,"aria-valuemax":100,children:l.jsx("div",{className:"progress-bar",style:{width:`${K}%`}})})]})]})}function PI(n){return n?["tdd","bdd"].includes(n.toLowerCase())?n.toUpperCase():n.charAt(0).toUpperCase()+n.slice(1):"—"}function wE(n){switch(n){case"done":return"✓";case"current":return"●";default:return"○"}}function LI({phase:n,isLast:e}){const i=wE(n.status),a=`phase-step ${n.status}`;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:a,children:[l.jsx("span",{className:"phase-icon",children:i}),l.jsx("span",{className:"phase-label",children:n.label})]}),!e&&l.jsx("span",{className:"phase-arrow",children:"→"})]})}function II({entry:n}){const e=wE(n.status),i=`phase-history-item ${n.status}`,a=n.status==="current"?"in progress":n.status==="pending"?"pending":n.duration||"—";return l.jsxs("div",{className:i,children:[l.jsx("span",{className:"history-icon",children:e}),l.jsx("span",{className:"history-phase",children:n.phase.toUpperCase()}),l.jsx("span",{className:"history-agent",children:n.agent}),l.jsx("span",{className:"history-duration",children:a})]})}function GI({workflowType:n,phases:e,phaseHistory:i,collapsed:a=!1,onToggle:r}){if(!n&&(!e||e.length===0))return l.jsx("div",{className:"bikelane-panel empty hidden","data-testid":"bikelane-panel",children:l.jsx("div",{className:"placeholder",children:"No active workflow"})});const c=PI(n);return a?l.jsx("div",{className:"bikelane-panel collapsed","data-testid":"bikelane-panel",children:l.jsxs("div",{className:"bikelane-header",onClick:r,children:[l.jsx($e,{variant:"secondary",className:"workflow-type-badge","data-workflow-type":n||"",children:c}),l.jsx("span",{className:"bikelane-expand",children:"▶"})]})}):l.jsxs("div",{className:"bikelane-panel","data-testid":"bikelane-panel",children:[l.jsxs("div",{className:"bikelane-header",onClick:r,children:[l.jsx($e,{variant:"secondary",className:"workflow-type-badge","data-workflow-type":n||"",children:c}),r&&l.jsx("span",{className:"bikelane-expand",children:"▼"})]}),e&&e.length>0&&l.jsx("div",{className:"phase-progress",children:e.map((d,h)=>l.jsx(LI,{phase:d,isLast:h===e.length-1},d.name))}),i&&i.length>0&&l.jsx("div",{className:"phase-history",children:l.jsx("div",{className:"phase-history-list",children:i.map((d,h)=>l.jsx(II,{entry:d},h))})})]})}const BI={sprint:nC,git:sC,diffs:zC,todos:lC,workflow:aC,background:cC,audit:xE,changed:OC,ac:oC,debug:m_,bikelane:GI,settings:bE,progress:MI};function SE(){return new URLSearchParams(window.location.search).get("panel")}function HI(){const n=SE(),e=n?BI[n]:null;return e?l.jsx("div",{style:{height:"100vh",width:"100vw",overflow:"auto",backgroundColor:"var(--bg-primary, #1a1a2e)",color:"var(--text-primary, #e4e4e7)"},children:l.jsx(e,{})}):l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw",backgroundColor:"var(--bg-primary, #1a1a2e)",color:"var(--text-primary, #e4e4e7)"},children:[l.jsx("h1",{children:"Panel not found"}),l.jsx("p",{children:l.jsx("a",{href:"/",style:{color:"var(--accent, #818cf8)"},children:"Back to BikeRack"})})]})}const Ns=["sprint","git","diffs","todo","workflow","background","audit-log","changed","ac","debug","settings"],Lf={sprint:"Sprint",git:"Git",diffs:"Diffs",todo:"Todo",workflow:"Workflow",background:"Subagents","audit-log":"Audit Log",changed:"Changed",ac:"AC",debug:"Debug",settings:"Settings"};function VI({params:n}){const e=tr.get(n.panelId);return e?l.jsx("div",{"data-testid":`panel-${n.panelId}`,className:"dockview-panel-content",children:l.jsx(hm,{panelName:n.panelId,children:l.jsx("div",{className:"error-boundary-wrapper",children:l.jsx(e,{})})})}):l.jsx("div",{"data-testid":`panel-${n.panelId}`,className:"dockview-panel-content",children:l.jsx("div",{style:{padding:"16px",color:"var(--text-secondary, #94a3b8)"},children:Lf[n.panelId]||n.panelId})})}function FI({initialLayout:n,onLayoutChange:e}){const i=m.useRef(null),[a,r]=m.useState(null),c=m.useRef(null);A0(a);const d=m.useCallback(p=>{const y=p.api;if(i.current=y,r(y),n&&n.grid&&n.panels&&Object.keys(n.panels).length>0)try{if(y.fromJSON(n),y.panels.length>0)return;console.warn("[BikeRackWorkspace] Restored layout produced no panels, building default")}catch(x){console.warn("[BikeRackWorkspace] Failed to restore layout, building default:",x)}const b=y.addPanel({id:Ns[0],component:"PanelAdapter",params:{panelId:Ns[0]},title:Lf[Ns[0]]});for(let x=1;x<Ns.length;x++)y.addPanel({id:Ns[x],component:"PanelAdapter",params:{panelId:Ns[x]},position:{referencePanel:b.id},title:Lf[Ns[x]]})},[n]),h=m.useCallback(()=>{const p=i.current;!p||!e||p.panels.length!==0&&(c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{const y=p.toJSON();y.panels&&Object.keys(y.panels).length>0&&e(y)},300))},[e]);m.useEffect(()=>{const p=i.current;if(!p)return;const y=[p.onDidLayoutChange(()=>h()),p.onDidAddPanel(()=>h()),p.onDidRemovePanel(()=>h())];return()=>y.forEach(b=>b.dispose())},[h]),m.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const f=ue.useMemo(()=>({PanelAdapter:VI}),[]);return l.jsxs("div",{className:"cyclist-app cyclist-dockview",style:{height:"100vh",width:"100vw",display:"flex",flexDirection:"column"},children:[l.jsx("div",{"data-testid":"bikerack-portrait-anchor",style:{flexShrink:0},children:l.jsx(eC,{})}),l.jsx(dm,{className:"dockview-container",onReady:d,components:f,defaultTabComponent:p=>l.jsx(D0,{...p,hideClose:!0}),watermarkComponent:()=>null})]})}var ru="Checkbox",[UI]=cn(ru),[$I,Km]=UI(ru);function WI(n){const{__scopeCheckbox:e,checked:i,children:a,defaultChecked:r,disabled:c,form:d,name:h,onCheckedChange:f,required:p,value:y="on",internal_do_not_use_render:b}=n,[x,w]=_n({prop:i,defaultProp:r??!1,onChange:f,caller:ru}),[E,_]=m.useState(null),[C,D]=m.useState(null),N=m.useRef(!1),k=E?!!d||!!E.closest("form"):!0,T={checked:x,disabled:c,setChecked:w,control:E,setControl:_,name:h,form:d,value:y,hasConsumerStoppedPropagationRef:N,required:p,defaultChecked:Ji(r)?!1:r,isFormControl:k,bubbleInput:C,setBubbleInput:D};return l.jsx($I,{scope:e,...T,children:qI(b)?b(T):a})}var CE="CheckboxTrigger",_E=m.forwardRef(({__scopeCheckbox:n,onKeyDown:e,onClick:i,...a},r)=>{const{control:c,value:d,disabled:h,checked:f,required:p,setControl:y,setChecked:b,hasConsumerStoppedPropagationRef:x,isFormControl:w,bubbleInput:E}=Km(CE,n),_=Ie(r,y),C=m.useRef(f);return m.useEffect(()=>{const D=c?.form;if(D){const N=()=>b(C.current);return D.addEventListener("reset",N),()=>D.removeEventListener("reset",N)}},[c,b]),l.jsx(je.button,{type:"button",role:"checkbox","aria-checked":Ji(f)?"mixed":f,"aria-required":p,"data-state":jE(f),"data-disabled":h?"":void 0,disabled:h,value:d,...a,ref:_,onKeyDown:we(e,D=>{D.key==="Enter"&&D.preventDefault()}),onClick:we(i,D=>{b(N=>Ji(N)?!0:!N),E&&w&&(x.current=D.isPropagationStopped(),x.current||D.stopPropagation())})})});_E.displayName=CE;var Jm=m.forwardRef((n,e)=>{const{__scopeCheckbox:i,name:a,checked:r,defaultChecked:c,required:d,disabled:h,value:f,onCheckedChange:p,form:y,...b}=n;return l.jsx(WI,{__scopeCheckbox:i,checked:r,defaultChecked:c,disabled:h,required:d,onCheckedChange:p,name:a,form:y,value:f,internal_do_not_use_render:({isFormControl:x})=>l.jsxs(l.Fragment,{children:[l.jsx(_E,{...b,ref:e,__scopeCheckbox:i}),x&&l.jsx(NE,{__scopeCheckbox:i})]})})});Jm.displayName=ru;var EE="CheckboxIndicator",DE=m.forwardRef((n,e)=>{const{__scopeCheckbox:i,forceMount:a,...r}=n,c=Km(EE,i);return l.jsx(qt,{present:a||Ji(c.checked)||c.checked===!0,children:l.jsx(je.span,{"data-state":jE(c.checked),"data-disabled":c.disabled?"":void 0,...r,ref:e,style:{pointerEvents:"none",...n.style}})})});DE.displayName=EE;var AE="CheckboxBubbleInput",NE=m.forwardRef(({__scopeCheckbox:n,...e},i)=>{const{control:a,hasConsumerStoppedPropagationRef:r,checked:c,defaultChecked:d,required:h,disabled:f,name:p,value:y,form:b,bubbleInput:x,setBubbleInput:w}=Km(AE,n),E=Ie(i,w),_=Ym(c),C=Yf(a);m.useEffect(()=>{const N=x;if(!N)return;const k=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(k,"checked").set,z=!r.current;if(_!==c&&R){const O=new Event("click",{bubbles:z});N.indeterminate=Ji(c),R.call(N,Ji(c)?!1:c),N.dispatchEvent(O)}},[x,_,c,r]);const D=m.useRef(Ji(c)?!1:c);return l.jsx(je.input,{type:"checkbox","aria-hidden":!0,defaultChecked:d??D.current,required:h,disabled:f,name:p,value:y,form:b,...e,tabIndex:-1,ref:E,style:{...e.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});NE.displayName=AE;function qI(n){return typeof n=="function"}function Ji(n){return n==="indeterminate"}function jE(n){return Ji(n)?"indeterminate":n?"checked":"unchecked"}const TE=m.forwardRef(({className:n,...e},i)=>l.jsx(Jm,{ref:i,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...e,children:l.jsx(DE,{className:ye("grid place-content-center text-current"),children:l.jsx(Ga,{className:"h-4 w-4"})})}));TE.displayName=Jm.displayName;const YI="approval-modal",XI="command-preview",QI="tool-name",ZI="approve-button",KI="reject-button",JI="always-allow-checkbox",e3="approval-modal-warning",t3={APPROVE:"Enter"},Jx={ONCE:"once",ALWAYS:"always"},n3={destructive:"severity-destructive",normal:"severity-normal",safe:"severity-safe"},i3="Permission Required",s3="Always allow this action",a3="Check to always allow this type of action without asking";function o3(n,e){switch(n){case"Bash":return e.command??"";case"Edit":return e.file_path??"";case"Write":return e.file_path??"";case"WebFetch":return e.url??"";default:return JSON.stringify(e)}}function r3(n){return{Bash:"terminal",Edit:"edit",Write:"file-plus",WebFetch:"globe",Read:"file",Grep:"search",Glob:"folder-search"}[n]??"tool"}function l3(n,e){if(n==="Bash"&&e.command){const i=e.command;if(/rm\s+(-[rf]+\s+)*/.test(i)||/git\s+(reset\s+--hard|push\s+--force|clean\s+-[fd])/.test(i)||/drop\s+database/i.test(i)||/truncate\s+table/i.test(i))return"destructive";if(/^(ls|cat|head|tail|grep|find|pwd|echo|which|type|file|stat|wc|diff)\b/.test(i)||/^git\s+(status|log|diff|show|branch|remote)\b/.test(i))return"safe"}return"normal"}function ew(n){return n?Jx.ALWAYS:Jx.ONCE}function tw(n,e,i){const a={toolId:n,approved:e};return e&&i&&(a.grantScope=i),a}function c3(){const[n,e]=m.useState(null),[i,a]=m.useState(!1),r=m.useCallback(f=>{e(f),a(!0)},[]),c=m.useCallback(()=>{a(!1),e(null)},[]),d=m.useCallback(f=>{c()},[c]),h=m.useCallback(()=>{c()},[c]);return{request:n,isOpen:i,show:r,hide:c,approve:d,reject:h}}let On=null,ef;function u3(){return On&&On.readyState===WebSocket.OPEN?On:null}function d3(n){const i=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/hooks`,a=()=>{try{On=new WebSocket(i),On.onopen=()=>{console.debug("[ApprovalModal] WebSocket connected to /ws/hooks")},On.onmessage=r=>{try{const c=JSON.parse(r.data);c.type==="hook-request"&&n({toolId:c.toolId,toolName:c.toolName,input:c.input,severity:c.severity,warning:c.warning,agent:c.agent})}catch(c){console.error("[ApprovalModal] Failed to parse message:",c)}},On.onclose=()=>{console.debug("[ApprovalModal] WebSocket closed, reconnecting..."),ef=setTimeout(a,2e3)},On.onerror=r=>{console.error("[ApprovalModal] WebSocket error:",r)}}catch(r){console.error("[ApprovalModal] WebSocket init failed:",r)}};return a(),()=>{ef&&clearTimeout(ef),On&&(On.close(),On=null)}}function nw(n){const e=u3();if(e){const i={type:"hook-response",toolId:n.toolId,approved:n.approved,data:n.grantScope?{grantScope:n.grantScope}:void 0};e.send(JSON.stringify(i))}else console.warn("[ApprovalModal] WebSocket not connected, cannot send response")}function h3({isOpen:n,toolName:e,toolId:i,input:a,onApprove:r,onReject:c,onDismiss:d,className:h="",severity:f,warning:p,agent:y}){const[b,x]=m.useState(!1);m.useEffect(()=>{if(!n)return;const N=k=>{k.key===t3.APPROVE&&(k.preventDefault(),r(ew(b)))};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[n,b,r]);const w=f??l3(e,a),E=n3[w],_=o3(e,a),C=r3(e),D=N=>{N||(d?d():c())};return l.jsx(qc,{open:n,onOpenChange:D,children:l.jsxs(ur,{"data-testid":YI,className:ye("max-w-[480px]",E,h),onPointerDownOutside:N=>{d||N.preventDefault()},children:[l.jsxs(Yc,{children:[l.jsx(Xc,{className:ye(w==="destructive"&&"text-destructive"),children:i3}),l.jsx(Qc,{asChild:!0,children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm text-muted-foreground",children:[l.jsx("span",{className:"approval-modal__icon","data-icon":C}),y&&l.jsx("span",{"data-testid":"agent-name",className:"font-medium",children:y}),y&&l.jsx("span",{className:"text-muted-foreground/50",children:"/"}),l.jsx("span",{"data-testid":QI,children:e})]}),l.jsx("pre",{className:ye("approval-modal__preview",w==="safe"&&"border-l-[3px] border-l-green-500",w==="normal"&&"border-l-[3px] border-l-primary",w==="destructive"&&"border-l-[3px] border-l-destructive bg-destructive/10"),"data-testid":XI,children:_})]})})]}),p&&l.jsx("div",{"data-testid":e3,className:"text-sm text-destructive font-medium",children:p}),l.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[l.jsx(TE,{id:"always-allow","data-testid":JI,checked:b,onCheckedChange:N=>x(N===!0),"aria-label":a3}),l.jsx("label",{htmlFor:"always-allow",className:"cursor-pointer select-none hover:text-foreground transition-colors",children:s3})]}),l.jsxs(_m,{children:[l.jsx(Ce,{"data-testid":KI,variant:"destructive",onClick:c,children:"Reject"}),l.jsx(Ce,{"data-testid":ZI,variant:"default",onClick:()=>r(ew(b)),children:"Approve"})]})]})})}En(Ze.MESSAGE,M2);En(Ze.CHANGED,OC);En(Ze.DIFFS,zC);En(Ze.DEBUG,m_);En(Ze.AUDIT_LOG,xE);En(Ze.SPRINT,nC);En(Ze.WORKFLOW,aC);En(Ze.AC,oC);En(Ze.TODO,lC);En(Ze.BACKGROUND,cC);En(Ze.GIT,sC);En(Ze.SETTINGS,bE);function tf({href:n,children:e}){const i=m.useCallback(a=>{a.preventDefault();const r=document.querySelector(n);r&&r.focus()},[n]);return l.jsx("a",{href:n,className:"sr-only skip-link",onClick:i,onFocus:a=>a.currentTarget.classList.add("skip-link-visible"),onBlur:a=>a.currentTarget.classList.remove("skip-link-visible"),children:e})}function f3(){m.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)"),e=a=>{a?document.documentElement.classList.add("reduced-motion"):document.documentElement.classList.remove("reduced-motion")};e(n.matches);const i=a=>{e(a.matches)};return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[])}function m3(){const n=m.useCallback(()=>{window.location.reload()},[]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",backgroundColor:"var(--bg-primary, #0a0a0f)",color:"var(--text-primary, #e2e8f0)",fontFamily:"system-ui, -apple-system, sans-serif",padding:"24px",textAlign:"center"},children:[l.jsx("h1",{style:{fontSize:"24px",fontWeight:600,marginBottom:"16px",color:"var(--status-error, #ef4444)"},children:"Something went wrong"}),l.jsx("p",{style:{fontSize:"14px",color:"var(--text-secondary, #94a3b8)",marginBottom:"24px",maxWidth:"400px"},children:"Cyclist encountered an unexpected error. Check the console for details."}),l.jsx("button",{onClick:n,style:{padding:"8px 16px",fontSize:"14px",backgroundColor:"var(--accent-primary, #6366f1)",color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Reload Cyclist"})]})}function p3(){const n=window.__CYCLIST_MODE__==="bikerack",e=SE(),i=n?"/api/settings/bikerack-layout":"/api/settings/layout",{layout:a,isLoading:r,saveLayout:c}=Hz(i);f3(),m.useEffect(()=>{bS().then(E=>{nc(E)})},[]),m.useEffect(()=>{wS().then(E=>{_f(E)})},[]);const[d,h]=m.useState([]),{request:f,isOpen:p,show:y,hide:b}=c3();m.useEffect(()=>d3(_=>{h(C=>[...C,_])}),[]),m.useEffect(()=>{if(!p&&d.length>0){const[E,..._]=d;h(_),y(E)}},[p,d,y]);const x=m.useCallback(E=>{if(f){const _=tw(f.toolId,!0,E);nw(_)}b()},[f,b]),w=m.useCallback(()=>{if(f){const E=tw(f.toolId,!1);nw(E)}b()},[f,b]);if(n){if(r)return l.jsx("div",{className:"cyclist-loading",style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:l.jsx("div",{className:"loading-spinner","aria-label":"Loading layout..."})});const E=()=>()=>{};return l.jsx(jm.Provider,{value:{send:()=>{},abort:()=>{},clear:()=>{},clearAndReload:()=>{},setMode:()=>{},isConnected:!1,mode:"default",onMessage:E,onComplete:E,onError:E,onUserMessage:E,onClear:E},children:l.jsx(FI,{initialLayout:a??void 0,onLayoutChange:c})})}return e?l.jsx(HI,{}):l.jsx(hm,{fallback:l.jsx(m3,{}),panelName:"App",children:l.jsx(zz,{children:l.jsx(Iz,{children:l.jsxs(Rz,{children:[l.jsxs("div",{className:"cyclist-app",children:[l.jsx(tf,{href:"#main-content",children:"Skip to main content"}),l.jsx(tf,{href:"#message-input",children:"Skip to input"}),l.jsx(tf,{href:"#sidebar-nav",children:"Skip to navigation"}),r?l.jsx("main",{id:"main-content",tabIndex:-1,children:l.jsx("div",{className:"cyclist-loading",children:l.jsx("div",{className:"loading-spinner","aria-label":"Loading layout..."})})}):l.jsx("main",{id:"main-content",tabIndex:-1,children:l.jsx(rR,{initialLayout:a??void 0,onLayoutChange:c})}),l.jsx("nav",{id:"sidebar-nav",tabIndex:-1,style:{display:"contents"},"aria-hidden":"true"}),l.jsx("div",{id:"message-input",tabIndex:-1,style:{display:"contents"},"aria-hidden":"true"})]}),l.jsx(h3,{isOpen:p,toolName:f?.toolName??"",toolId:f?.toolId??"",input:f?.input??{},onApprove:x,onReject:w})]})})})})}const iw=document.getElementById("react-root");iw&&lN.createRoot(iw).render(l.jsx(p3,{}));
82
+ `):""]})]}),A.input&&!A.command&&!A.filePath&&!A.subagentType&&l.jsxs("div",{className:"detail-output",children:[l.jsx("div",{className:"detail-label",children:"Input"}),l.jsx("pre",{children:A.input})]}),A.output&&!A.outputSummary&&l.jsxs("div",{className:"detail-output",children:[l.jsx("div",{className:"detail-label",children:"Output"}),l.jsxs("pre",{children:[A.output.substring(0,500),A.output.length>500&&"..."]})]}),A.error&&l.jsxs("div",{className:"detail-output",children:[l.jsx("div",{className:"detail-label status-err",children:"Error"}),l.jsx("pre",{className:"status-err",children:A.error})]})]})})]},`${A.timestamp}-${G}`))})]})]})]})})}function MI(){const{story:n,isLoading:e,error:i}=Pm(),{data:a,isLoading:r}=tC(),{todos:c}=rC(),{gitStatus:d}=Lm(),{context:h}=Om();if(e||r)return l.jsx("div",{className:"progress-panel loading","data-testid":"progress-panel",children:l.jsx("div",{className:"progress-loading",children:"Loading..."})});if(i)return l.jsx("div",{className:"progress-panel","data-testid":"progress-panel",children:l.jsx("div",{className:"error-message",children:i.message})});const f=a?.currentStory;if(!n&&!f)return l.jsx("div",{className:"progress-panel","data-testid":"progress-panel",children:l.jsxs("div",{className:"empty-state",children:[l.jsx("div",{children:"No active story"}),l.jsx("div",{className:"empty-hint",children:"Run /sprint work to start"})]})});const p=n?.id??f?.id??"",y=n?.title??f?.title??"",b=n?.points??f?.points??0,x=f?.jiraKey??"",w=n?.status??f?.status??"",E=n?.epic??f?.epic??"",C=w.replace(/_/g," "),S=n?.workflow??null,D=n?.workflowPhases??null,N=S||D&&D.length>0,k=n?.criteria??null,T=k!=null&&k.length>0,R=T?k.filter(q=>q.completed).length:0,z=T?k.length:0,O=z>0?Math.round(R/z*100):0,A=c&&c.length>0,G=A?c.filter(q=>q.status==="completed").length:0,U=A?c.length:0,B=A?c.find(q=>q.status==="in_progress"):null,$=d?.branch??"",ae=d?.modified??0,ne=d?.untracked??0,W=d?.ahead??0,M=d?.behind??0,K=h?.percent??0;return l.jsxs("div",{className:"progress-panel","data-testid":"progress-panel",children:[l.jsxs("div",{className:"progress-section","data-testid":"progress-story-header",children:[l.jsxs("div",{className:"story-header-row",children:[l.jsx("span",{className:"story-id",children:p}),l.jsxs("span",{className:"story-points",children:[b,"pt"]}),l.jsx("span",{className:"story-status",children:C})]}),l.jsx("div",{className:"story-title",children:y}),l.jsxs("div",{className:"story-meta",children:[l.jsx("span",{className:"story-jira",children:x}),l.jsx("span",{className:"story-epic",children:E})]})]}),N&&l.jsxs("div",{className:"progress-section","data-testid":"progress-workflow-row",children:[S&&l.jsx("span",{className:"workflow-badge",children:S.toUpperCase()==="TDD"||S.toUpperCase()==="BDD"?S.toUpperCase():S.charAt(0).toUpperCase()+S.slice(1)}),D&&D.length>0&&l.jsx("div",{className:"phase-progress",children:D.map(q=>l.jsx("div",{className:`phase-step ${q.status}`,children:l.jsx("span",{className:"phase-label",children:q.label})},q.name))})]}),T&&l.jsxs("div",{className:"progress-section","data-testid":"progress-ac-row",children:[l.jsx("span",{className:"row-label",children:"AC"}),l.jsxs("span",{className:"progress-count",children:[R,"/",z]}),l.jsx("div",{className:"progress-bar-container",role:"progressbar","aria-valuenow":R,"aria-valuemin":0,"aria-valuemax":z,children:l.jsx("div",{className:"progress-bar",style:{width:`${O}%`}})})]}),A&&l.jsxs("div",{className:"progress-section","data-testid":"progress-todo-row",children:[l.jsx("span",{className:"row-label",children:"Tasks"}),l.jsxs("span",{className:"progress-count",children:[G,"/",U]}),l.jsx("div",{className:"progress-bar-container",children:l.jsx("div",{className:"progress-bar",style:{width:`${U>0?Math.round(G/U*100):0}%`}})}),B&&l.jsx("span",{className:"active-task",children:B.activeForm||B.content})]}),l.jsxs("div",{className:"progress-section","data-testid":"progress-git-row",children:[l.jsx("span",{className:"git-branch",children:$}),l.jsxs("span",{className:"git-stats",children:[ae,"M ",ne,"U ↑",W," ↓",M]})]}),l.jsxs("div",{className:"progress-section","data-testid":"progress-context-row",children:[l.jsx("span",{className:"row-label",children:"Context"}),l.jsxs("span",{className:"context-percent",children:[K,"%"]}),l.jsx("div",{className:"progress-bar-container",role:"progressbar","aria-valuenow":K,"aria-valuemin":0,"aria-valuemax":100,children:l.jsx("div",{className:"progress-bar",style:{width:`${K}%`}})})]})]})}function PI(){const[n,e]=m.useState(null),[i,a]=m.useState([]),[r,c]=m.useState(null),[d,h]=m.useState(!0),[f,p]=m.useState(null),y=m.useRef(null),b=m.useRef();return m.useEffect(()=>{const w=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/tandem`,E=()=>{try{y.current=new WebSocket(w),y.current.onopen=()=>{console.debug("[useTandemObservations] WebSocket connected")},y.current.onmessage=C=>{try{const S=JSON.parse(C.data);switch(S.type){case"init":e(S.header??null),a(S.observations??[]),h(!1),p(null);break;case"observation":S.observation&&a(D=>{const N=[...D,S.observation];return N.length>200?N.slice(-200):N});break;case"metrics":S.metrics&&c(S.metrics);break;case"clear":e(null),a([]),c(null);break}}catch(S){console.error("[useTandemObservations] Failed to parse message:",S)}},y.current.onclose=()=>{console.debug("[useTandemObservations] WebSocket closed, reconnecting..."),b.current=setTimeout(E,2e3)},y.current.onerror=C=>{console.error("[useTandemObservations] WebSocket error:",C),p(new Error("WebSocket connection failed"))}}catch(C){console.error("[useTandemObservations] WebSocket init failed:",C),p(C instanceof Error?C:new Error("Failed to connect")),h(!1)}};return E(),()=>{b.current&&clearTimeout(b.current),y.current&&y.current.close()}},[]),{header:n,observations:i,metrics:r,isLoading:d,error:f}}function LI(){const{header:n,observations:e,metrics:i,isLoading:a,error:r}=PI(),[c,d]=m.useState(!1),h=!a&&!r&&!n&&e.length===0;return l.jsxs("div",{className:"tandem-panel",children:[r&&l.jsx("div",{"data-testid":"tandem-error",className:"tandem-error",children:"Connection failed — tandem data unavailable"}),n&&l.jsxs("div",{className:"tandem-header",children:[c?l.jsx("span",{"data-testid":"observer-portrait",className:"observer-portrait-fallback","aria-hidden":"true",children:"🤖"}):l.jsx("img",{"data-testid":"observer-portrait",src:`/portraits/${n.theme}/medium/${n.slug}.png`,alt:n.character,className:"observer-portrait",onError:()=>d(!0)}),l.jsxs("div",{className:"tandem-header-info",children:[l.jsx("span",{className:"observer-name",children:n.character}),l.jsx("span",{"data-testid":"observer-role-badge",className:"observer-role-badge",children:n.observer}),l.jsx("span",{"data-testid":"observer-phase",className:"observer-phase",children:n.phase})]})]}),h&&l.jsx("div",{"data-testid":"tandem-empty-state",className:"tandem-empty-state",children:"No tandem activity"}),e.map((f,p)=>l.jsxs("div",{"data-testid":"tandem-observation",className:"tandem-observation",children:[l.jsx("div",{className:"observation-time",children:f.time}),l.jsxs("div",{className:"observation-trigger",children:[l.jsx("span",{className:"trigger-scope",children:f.trigger.scope}),l.jsx("span",{className:"trigger-detail",children:f.trigger.detail})]}),l.jsx("div",{className:"observation-content",children:f.content}),f.outcome&&l.jsx("span",{"data-testid":"outcome-badge","data-outcome":f.outcome,className:`outcome-badge outcome-${f.outcome}`,children:f.outcome})]},f.timestamp+p)),i&&l.jsxs("div",{"data-testid":"tandem-metrics",className:"tandem-metrics",children:[l.jsxs("div",{className:"metric",children:[i.exchangeCount," exchanges"]}),l.jsxs("div",{className:"metric",children:[i.tokenOverhead,"% overhead"]}),l.jsxs("div",{className:"confidence-distribution",children:[l.jsxs("span",{children:["High: ",i.confidenceDistribution.high]}),l.jsxs("span",{children:["Medium: ",i.confidenceDistribution.medium]}),l.jsxs("span",{children:["Low: ",i.confidenceDistribution.low]})]})]})]})}function II(n){return n?["tdd","bdd"].includes(n.toLowerCase())?n.toUpperCase():n.charAt(0).toUpperCase()+n.slice(1):"—"}function wE(n){switch(n){case"done":return"✓";case"current":return"●";default:return"○"}}function GI({phase:n,isLast:e}){const i=wE(n.status),a=`phase-step ${n.status}`;return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:a,children:[l.jsx("span",{className:"phase-icon",children:i}),l.jsx("span",{className:"phase-label",children:n.label})]}),!e&&l.jsx("span",{className:"phase-arrow",children:"→"})]})}function BI({entry:n}){const e=wE(n.status),i=`phase-history-item ${n.status}`,a=n.status==="current"?"in progress":n.status==="pending"?"pending":n.duration||"—";return l.jsxs("div",{className:i,children:[l.jsx("span",{className:"history-icon",children:e}),l.jsx("span",{className:"history-phase",children:n.phase.toUpperCase()}),l.jsx("span",{className:"history-agent",children:n.agent}),l.jsx("span",{className:"history-duration",children:a})]})}function HI({workflowType:n,phases:e,phaseHistory:i,collapsed:a=!1,onToggle:r}){if(!n&&(!e||e.length===0))return l.jsx("div",{className:"bikelane-panel empty hidden","data-testid":"bikelane-panel",children:l.jsx("div",{className:"placeholder",children:"No active workflow"})});const c=II(n);return a?l.jsx("div",{className:"bikelane-panel collapsed","data-testid":"bikelane-panel",children:l.jsxs("div",{className:"bikelane-header",onClick:r,children:[l.jsx($e,{variant:"secondary",className:"workflow-type-badge","data-workflow-type":n||"",children:c}),l.jsx("span",{className:"bikelane-expand",children:"▶"})]})}):l.jsxs("div",{className:"bikelane-panel","data-testid":"bikelane-panel",children:[l.jsxs("div",{className:"bikelane-header",onClick:r,children:[l.jsx($e,{variant:"secondary",className:"workflow-type-badge","data-workflow-type":n||"",children:c}),r&&l.jsx("span",{className:"bikelane-expand",children:"▼"})]}),e&&e.length>0&&l.jsx("div",{className:"phase-progress",children:e.map((d,h)=>l.jsx(GI,{phase:d,isLast:h===e.length-1},d.name))}),i&&i.length>0&&l.jsx("div",{className:"phase-history",children:l.jsx("div",{className:"phase-history-list",children:i.map((d,h)=>l.jsx(BI,{entry:d},h))})})]})}const VI={sprint:nC,git:sC,diffs:zC,todos:lC,workflow:aC,background:cC,audit:xE,changed:OC,ac:oC,debug:m_,bikelane:HI,settings:bE,progress:MI};function SE(){return new URLSearchParams(window.location.search).get("panel")}function FI(){const n=SE(),e=n?VI[n]:null;return e?l.jsx("div",{style:{height:"100vh",width:"100vw",overflow:"auto",backgroundColor:"var(--bg-primary, #1a1a2e)",color:"var(--text-primary, #e4e4e7)"},children:l.jsx(e,{})}):l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",width:"100vw",backgroundColor:"var(--bg-primary, #1a1a2e)",color:"var(--text-primary, #e4e4e7)"},children:[l.jsx("h1",{children:"Panel not found"}),l.jsx("p",{children:l.jsx("a",{href:"/",style:{color:"var(--accent, #818cf8)"},children:"Back to BikeRack"})})]})}const Ns=["sprint","git","diffs","todo","workflow","background","audit-log","changed","ac","debug","settings"],Lf={sprint:"Sprint",git:"Git",diffs:"Diffs",todo:"Todo",workflow:"Workflow",background:"Subagents","audit-log":"Audit Log",changed:"Changed",ac:"AC",debug:"Debug",settings:"Settings"};function UI({params:n}){const e=tr.get(n.panelId);return e?l.jsx("div",{"data-testid":`panel-${n.panelId}`,className:"dockview-panel-content",children:l.jsx(hm,{panelName:n.panelId,children:l.jsx("div",{className:"error-boundary-wrapper",children:l.jsx(e,{})})})}):l.jsx("div",{"data-testid":`panel-${n.panelId}`,className:"dockview-panel-content",children:l.jsx("div",{style:{padding:"16px",color:"var(--text-secondary, #94a3b8)"},children:Lf[n.panelId]||n.panelId})})}function $I({initialLayout:n,onLayoutChange:e}){const i=m.useRef(null),[a,r]=m.useState(null),c=m.useRef(null);AS(a);const d=m.useCallback(p=>{const y=p.api;if(i.current=y,r(y),n&&n.grid&&n.panels&&Object.keys(n.panels).length>0)try{if(y.fromJSON(n),y.panels.length>0)return;console.warn("[BikeRackWorkspace] Restored layout produced no panels, building default")}catch(x){console.warn("[BikeRackWorkspace] Failed to restore layout, building default:",x)}const b=y.addPanel({id:Ns[0],component:"PanelAdapter",params:{panelId:Ns[0]},title:Lf[Ns[0]]});for(let x=1;x<Ns.length;x++)y.addPanel({id:Ns[x],component:"PanelAdapter",params:{panelId:Ns[x]},position:{referencePanel:b.id},title:Lf[Ns[x]]})},[n]),h=m.useCallback(()=>{const p=i.current;!p||!e||p.panels.length!==0&&(c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{const y=p.toJSON();y.panels&&Object.keys(y.panels).length>0&&e(y)},300))},[e]);m.useEffect(()=>{const p=i.current;if(!p)return;const y=[p.onDidLayoutChange(()=>h()),p.onDidAddPanel(()=>h()),p.onDidRemovePanel(()=>h())];return()=>y.forEach(b=>b.dispose())},[h]),m.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const f=ue.useMemo(()=>({PanelAdapter:UI}),[]);return l.jsxs("div",{className:"cyclist-app cyclist-dockview",style:{height:"100vh",width:"100vw",display:"flex",flexDirection:"column"},children:[l.jsx("div",{"data-testid":"bikerack-portrait-anchor",style:{flexShrink:0},children:l.jsx(eC,{})}),l.jsx(dm,{className:"dockview-container",onReady:d,components:f,defaultTabComponent:p=>l.jsx(DS,{...p,hideClose:!0}),watermarkComponent:()=>null})]})}var ru="Checkbox",[WI]=cn(ru),[qI,Km]=WI(ru);function YI(n){const{__scopeCheckbox:e,checked:i,children:a,defaultChecked:r,disabled:c,form:d,name:h,onCheckedChange:f,required:p,value:y="on",internal_do_not_use_render:b}=n,[x,w]=En({prop:i,defaultProp:r??!1,onChange:f,caller:ru}),[E,C]=m.useState(null),[S,D]=m.useState(null),N=m.useRef(!1),k=E?!!d||!!E.closest("form"):!0,T={checked:x,disabled:c,setChecked:w,control:E,setControl:C,name:h,form:d,value:y,hasConsumerStoppedPropagationRef:N,required:p,defaultChecked:Ji(r)?!1:r,isFormControl:k,bubbleInput:S,setBubbleInput:D};return l.jsx(qI,{scope:e,...T,children:XI(b)?b(T):a})}var CE="CheckboxTrigger",_E=m.forwardRef(({__scopeCheckbox:n,onKeyDown:e,onClick:i,...a},r)=>{const{control:c,value:d,disabled:h,checked:f,required:p,setControl:y,setChecked:b,hasConsumerStoppedPropagationRef:x,isFormControl:w,bubbleInput:E}=Km(CE,n),C=Ie(r,y),S=m.useRef(f);return m.useEffect(()=>{const D=c?.form;if(D){const N=()=>b(S.current);return D.addEventListener("reset",N),()=>D.removeEventListener("reset",N)}},[c,b]),l.jsx(je.button,{type:"button",role:"checkbox","aria-checked":Ji(f)?"mixed":f,"aria-required":p,"data-state":jE(f),"data-disabled":h?"":void 0,disabled:h,value:d,...a,ref:C,onKeyDown:we(e,D=>{D.key==="Enter"&&D.preventDefault()}),onClick:we(i,D=>{b(N=>Ji(N)?!0:!N),E&&w&&(x.current=D.isPropagationStopped(),x.current||D.stopPropagation())})})});_E.displayName=CE;var Jm=m.forwardRef((n,e)=>{const{__scopeCheckbox:i,name:a,checked:r,defaultChecked:c,required:d,disabled:h,value:f,onCheckedChange:p,form:y,...b}=n;return l.jsx(YI,{__scopeCheckbox:i,checked:r,defaultChecked:c,disabled:h,required:d,onCheckedChange:p,name:a,form:y,value:f,internal_do_not_use_render:({isFormControl:x})=>l.jsxs(l.Fragment,{children:[l.jsx(_E,{...b,ref:e,__scopeCheckbox:i}),x&&l.jsx(NE,{__scopeCheckbox:i})]})})});Jm.displayName=ru;var EE="CheckboxIndicator",DE=m.forwardRef((n,e)=>{const{__scopeCheckbox:i,forceMount:a,...r}=n,c=Km(EE,i);return l.jsx(qt,{present:a||Ji(c.checked)||c.checked===!0,children:l.jsx(je.span,{"data-state":jE(c.checked),"data-disabled":c.disabled?"":void 0,...r,ref:e,style:{pointerEvents:"none",...n.style}})})});DE.displayName=EE;var AE="CheckboxBubbleInput",NE=m.forwardRef(({__scopeCheckbox:n,...e},i)=>{const{control:a,hasConsumerStoppedPropagationRef:r,checked:c,defaultChecked:d,required:h,disabled:f,name:p,value:y,form:b,bubbleInput:x,setBubbleInput:w}=Km(AE,n),E=Ie(i,w),C=Ym(c),S=Yf(a);m.useEffect(()=>{const N=x;if(!N)return;const k=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(k,"checked").set,z=!r.current;if(C!==c&&R){const O=new Event("click",{bubbles:z});N.indeterminate=Ji(c),R.call(N,Ji(c)?!1:c),N.dispatchEvent(O)}},[x,C,c,r]);const D=m.useRef(Ji(c)?!1:c);return l.jsx(je.input,{type:"checkbox","aria-hidden":!0,defaultChecked:d??D.current,required:h,disabled:f,name:p,value:y,form:b,...e,tabIndex:-1,ref:E,style:{...e.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});NE.displayName=AE;function XI(n){return typeof n=="function"}function Ji(n){return n==="indeterminate"}function jE(n){return Ji(n)?"indeterminate":n?"checked":"unchecked"}const TE=m.forwardRef(({className:n,...e},i)=>l.jsx(Jm,{ref:i,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",n),...e,children:l.jsx(DE,{className:ye("grid place-content-center text-current"),children:l.jsx(Ga,{className:"h-4 w-4"})})}));TE.displayName=Jm.displayName;const QI="approval-modal",ZI="command-preview",KI="tool-name",JI="approve-button",e3="reject-button",t3="always-allow-checkbox",n3="approval-modal-warning",i3={APPROVE:"Enter"},Jx={ONCE:"once",ALWAYS:"always"},s3={destructive:"severity-destructive",normal:"severity-normal",safe:"severity-safe"},a3="Permission Required",o3="Always allow this action",r3="Check to always allow this type of action without asking";function l3(n,e){switch(n){case"Bash":return e.command??"";case"Edit":return e.file_path??"";case"Write":return e.file_path??"";case"WebFetch":return e.url??"";default:return JSON.stringify(e)}}function c3(n){return{Bash:"terminal",Edit:"edit",Write:"file-plus",WebFetch:"globe",Read:"file",Grep:"search",Glob:"folder-search"}[n]??"tool"}function u3(n,e){if(n==="Bash"&&e.command){const i=e.command;if(/rm\s+(-[rf]+\s+)*/.test(i)||/git\s+(reset\s+--hard|push\s+--force|clean\s+-[fd])/.test(i)||/drop\s+database/i.test(i)||/truncate\s+table/i.test(i))return"destructive";if(/^(ls|cat|head|tail|grep|find|pwd|echo|which|type|file|stat|wc|diff)\b/.test(i)||/^git\s+(status|log|diff|show|branch|remote)\b/.test(i))return"safe"}return"normal"}function ew(n){return n?Jx.ALWAYS:Jx.ONCE}function tw(n,e,i){const a={toolId:n,approved:e};return e&&i&&(a.grantScope=i),a}function d3(){const[n,e]=m.useState(null),[i,a]=m.useState(!1),r=m.useCallback(f=>{e(f),a(!0)},[]),c=m.useCallback(()=>{a(!1),e(null)},[]),d=m.useCallback(f=>{c()},[c]),h=m.useCallback(()=>{c()},[c]);return{request:n,isOpen:i,show:r,hide:c,approve:d,reject:h}}let On=null,ef;function h3(){return On&&On.readyState===WebSocket.OPEN?On:null}function f3(n){const i=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/hooks`,a=()=>{try{On=new WebSocket(i),On.onopen=()=>{console.debug("[ApprovalModal] WebSocket connected to /ws/hooks")},On.onmessage=r=>{try{const c=JSON.parse(r.data);c.type==="hook-request"&&n({toolId:c.toolId,toolName:c.toolName,input:c.input,severity:c.severity,warning:c.warning,agent:c.agent})}catch(c){console.error("[ApprovalModal] Failed to parse message:",c)}},On.onclose=()=>{console.debug("[ApprovalModal] WebSocket closed, reconnecting..."),ef=setTimeout(a,2e3)},On.onerror=r=>{console.error("[ApprovalModal] WebSocket error:",r)}}catch(r){console.error("[ApprovalModal] WebSocket init failed:",r)}};return a(),()=>{ef&&clearTimeout(ef),On&&(On.close(),On=null)}}function nw(n){const e=h3();if(e){const i={type:"hook-response",toolId:n.toolId,approved:n.approved,data:n.grantScope?{grantScope:n.grantScope}:void 0};e.send(JSON.stringify(i))}else console.warn("[ApprovalModal] WebSocket not connected, cannot send response")}function m3({isOpen:n,toolName:e,toolId:i,input:a,onApprove:r,onReject:c,onDismiss:d,className:h="",severity:f,warning:p,agent:y}){const[b,x]=m.useState(!1);m.useEffect(()=>{if(!n)return;const N=k=>{k.key===i3.APPROVE&&(k.preventDefault(),r(ew(b)))};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[n,b,r]);const w=f??u3(e,a),E=s3[w],C=l3(e,a),S=c3(e),D=N=>{N||(d?d():c())};return l.jsx(qc,{open:n,onOpenChange:D,children:l.jsxs(ur,{"data-testid":QI,className:ye("max-w-[480px]",E,h),onPointerDownOutside:N=>{d||N.preventDefault()},children:[l.jsxs(Yc,{children:[l.jsx(Xc,{className:ye(w==="destructive"&&"text-destructive"),children:a3}),l.jsx(Qc,{asChild:!0,children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm text-muted-foreground",children:[l.jsx("span",{className:"approval-modal__icon","data-icon":S}),y&&l.jsx("span",{"data-testid":"agent-name",className:"font-medium",children:y}),y&&l.jsx("span",{className:"text-muted-foreground/50",children:"/"}),l.jsx("span",{"data-testid":KI,children:e})]}),l.jsx("pre",{className:ye("approval-modal__preview",w==="safe"&&"border-l-[3px] border-l-green-500",w==="normal"&&"border-l-[3px] border-l-primary",w==="destructive"&&"border-l-[3px] border-l-destructive bg-destructive/10"),"data-testid":ZI,children:C})]})})]}),p&&l.jsx("div",{"data-testid":n3,className:"text-sm text-destructive font-medium",children:p}),l.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[l.jsx(TE,{id:"always-allow","data-testid":t3,checked:b,onCheckedChange:N=>x(N===!0),"aria-label":r3}),l.jsx("label",{htmlFor:"always-allow",className:"cursor-pointer select-none hover:text-foreground transition-colors",children:o3})]}),l.jsxs(_m,{children:[l.jsx(Ce,{"data-testid":e3,variant:"destructive",onClick:c,children:"Reject"}),l.jsx(Ce,{"data-testid":JI,variant:"default",onClick:()=>r(ew(b)),children:"Approve"})]})]})})}un(Xe.MESSAGE,M2);un(Xe.CHANGED,OC);un(Xe.DIFFS,zC);un(Xe.DEBUG,m_);un(Xe.AUDIT_LOG,xE);un(Xe.SPRINT,nC);un(Xe.WORKFLOW,aC);un(Xe.AC,oC);un(Xe.TODO,lC);un(Xe.BACKGROUND,cC);un(Xe.GIT,sC);un(Xe.SETTINGS,bE);un(Xe.TANDEM,LI);function tf({href:n,children:e}){const i=m.useCallback(a=>{a.preventDefault();const r=document.querySelector(n);r&&r.focus()},[n]);return l.jsx("a",{href:n,className:"sr-only skip-link",onClick:i,onFocus:a=>a.currentTarget.classList.add("skip-link-visible"),onBlur:a=>a.currentTarget.classList.remove("skip-link-visible"),children:e})}function p3(){m.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)"),e=a=>{a?document.documentElement.classList.add("reduced-motion"):document.documentElement.classList.remove("reduced-motion")};e(n.matches);const i=a=>{e(a.matches)};return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[])}function g3(){const n=m.useCallback(()=>{window.location.reload()},[]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",backgroundColor:"var(--bg-primary, #0a0a0f)",color:"var(--text-primary, #e2e8f0)",fontFamily:"system-ui, -apple-system, sans-serif",padding:"24px",textAlign:"center"},children:[l.jsx("h1",{style:{fontSize:"24px",fontWeight:600,marginBottom:"16px",color:"var(--status-error, #ef4444)"},children:"Something went wrong"}),l.jsx("p",{style:{fontSize:"14px",color:"var(--text-secondary, #94a3b8)",marginBottom:"24px",maxWidth:"400px"},children:"Cyclist encountered an unexpected error. Check the console for details."}),l.jsx("button",{onClick:n,style:{padding:"8px 16px",fontSize:"14px",backgroundColor:"var(--accent-primary, #6366f1)",color:"white",border:"none",borderRadius:"6px",cursor:"pointer"},children:"Reload Cyclist"})]})}function v3(){const n=window.__CYCLIST_MODE__==="bikerack",e=SE(),i=n?"/api/settings/bikerack-layout":"/api/settings/layout",{layout:a,isLoading:r,saveLayout:c}=Hz(i);p3(),m.useEffect(()=>{b0().then(E=>{nc(E)})},[]),m.useEffect(()=>{w0().then(E=>{_f(E)})},[]);const[d,h]=m.useState([]),{request:f,isOpen:p,show:y,hide:b}=d3();m.useEffect(()=>f3(C=>{h(S=>[...S,C])}),[]),m.useEffect(()=>{if(!p&&d.length>0){const[E,...C]=d;h(C),y(E)}},[p,d,y]);const x=m.useCallback(E=>{if(f){const C=tw(f.toolId,!0,E);nw(C)}b()},[f,b]),w=m.useCallback(()=>{if(f){const E=tw(f.toolId,!1);nw(E)}b()},[f,b]);if(n){if(r)return l.jsx("div",{className:"cyclist-loading",style:{height:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:l.jsx("div",{className:"loading-spinner","aria-label":"Loading layout..."})});const E=()=>()=>{};return l.jsx(jm.Provider,{value:{send:()=>{},abort:()=>{},clear:()=>{},clearAndReload:()=>{},setMode:()=>{},isConnected:!1,mode:"default",onMessage:E,onComplete:E,onError:E,onUserMessage:E,onClear:E},children:l.jsx($I,{initialLayout:a??void 0,onLayoutChange:c})})}return e?l.jsx(FI,{}):l.jsx(hm,{fallback:l.jsx(g3,{}),panelName:"App",children:l.jsx(zz,{children:l.jsx(Iz,{children:l.jsxs(Rz,{children:[l.jsxs("div",{className:"cyclist-app",children:[l.jsx(tf,{href:"#main-content",children:"Skip to main content"}),l.jsx(tf,{href:"#message-input",children:"Skip to input"}),l.jsx(tf,{href:"#sidebar-nav",children:"Skip to navigation"}),r?l.jsx("main",{id:"main-content",tabIndex:-1,children:l.jsx("div",{className:"cyclist-loading",children:l.jsx("div",{className:"loading-spinner","aria-label":"Loading layout..."})})}):l.jsx("main",{id:"main-content",tabIndex:-1,children:l.jsx(rR,{initialLayout:a??void 0,onLayoutChange:c})}),l.jsx("nav",{id:"sidebar-nav",tabIndex:-1,style:{display:"contents"},"aria-hidden":"true"}),l.jsx("div",{id:"message-input",tabIndex:-1,style:{display:"contents"},"aria-hidden":"true"})]}),l.jsx(m3,{isOpen:p,toolName:f?.toolName??"",toolId:f?.toolId??"",input:f?.input??{},onApprove:x,onReject:w})]})})})})}const iw=document.getElementById("react-root");iw&&lN.createRoot(iw).render(l.jsx(v3,{}));