vibepulse 0.2.0 → 0.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 (420) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +4 -0
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/cache/.previewinfo +1 -1
  5. package/.next/cache/.rscinfo +1 -1
  6. package/.next/cache/.tsbuildinfo +1 -1
  7. package/.next/cache/config.json +3 -3
  8. package/.next/fallback-build-manifest.json +2 -2
  9. package/.next/prerender-manifest.json +3 -3
  10. package/.next/routes-manifest.json +32 -0
  11. package/.next/server/app/_global-error/page.js +1 -1
  12. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  13. package/.next/server/app/_global-error.html +2 -2
  14. package/.next/server/app/_global-error.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  18. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  19. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/.next/server/app/_not-found/page.js +1 -1
  21. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/_not-found.html +1 -1
  24. package/.next/server/app/_not-found.rsc +2 -2
  25. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  26. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  27. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  28. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  29. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  30. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  31. package/.next/server/app/api/node/events/route.js +1 -1
  32. package/.next/server/app/api/node/events/route.js.nft.json +1 -1
  33. package/.next/server/app/api/node/health/route.js +1 -1
  34. package/.next/server/app/api/node/health/route.js.nft.json +1 -1
  35. package/.next/server/app/api/node/sessions/[id]/archive/route/app-paths-manifest.json +3 -0
  36. package/.next/server/app/api/node/sessions/[id]/archive/route/build-manifest.json +11 -0
  37. package/.next/server/app/api/node/sessions/[id]/archive/route/server-reference-manifest.json +4 -0
  38. package/.next/server/app/api/node/sessions/[id]/archive/route.js +6 -0
  39. package/.next/server/app/api/node/sessions/[id]/archive/route.js.map +5 -0
  40. package/.next/server/app/api/node/sessions/[id]/archive/route.js.nft.json +1 -0
  41. package/.next/server/app/api/node/sessions/[id]/archive/route_client-reference-manifest.js +2 -0
  42. package/.next/server/app/api/node/sessions/[id]/delete/route/app-paths-manifest.json +3 -0
  43. package/.next/server/app/api/node/sessions/[id]/delete/route/build-manifest.json +11 -0
  44. package/.next/server/app/api/node/sessions/[id]/delete/route/server-reference-manifest.json +4 -0
  45. package/.next/server/app/api/node/sessions/[id]/delete/route.js +7 -0
  46. package/.next/server/app/api/node/sessions/[id]/delete/route.js.map +5 -0
  47. package/.next/server/app/api/node/sessions/[id]/delete/route.js.nft.json +1 -0
  48. package/.next/server/app/api/node/sessions/[id]/delete/route_client-reference-manifest.js +2 -0
  49. package/.next/server/app/api/node/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
  50. package/.next/server/app/api/node/sessions/[id]/open-editor/route/build-manifest.json +11 -0
  51. package/.next/server/app/api/node/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
  52. package/.next/server/app/api/node/sessions/[id]/open-editor/route.js +7 -0
  53. package/.next/server/app/api/node/sessions/[id]/open-editor/route.js.map +5 -0
  54. package/.next/server/app/api/node/sessions/[id]/open-editor/route.js.nft.json +1 -0
  55. package/.next/server/app/api/node/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
  56. package/.next/server/app/api/node/sessions/route.js +1 -1
  57. package/.next/server/app/api/node/sessions/route.js.nft.json +1 -1
  58. package/.next/server/app/api/opencode-events/route.js +1 -1
  59. package/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
  60. package/.next/server/app/api/sessions/[id]/archive/route.js +2 -1
  61. package/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
  62. package/.next/server/app/api/sessions/[id]/delete/route.js +3 -2
  63. package/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
  64. package/.next/server/app/api/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
  65. package/.next/server/app/api/sessions/[id]/open-editor/route/build-manifest.json +11 -0
  66. package/.next/server/app/api/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
  67. package/.next/server/app/api/sessions/[id]/open-editor/route.js +7 -0
  68. package/.next/server/app/api/sessions/[id]/open-editor/route.js.map +5 -0
  69. package/.next/server/app/api/sessions/[id]/open-editor/route.js.nft.json +1 -0
  70. package/.next/server/app/api/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
  71. package/.next/server/app/api/sessions/route.js +1 -1
  72. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  73. package/.next/server/app/index.html +1 -1
  74. package/.next/server/app/index.rsc +3 -3
  75. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  76. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  77. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  78. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  79. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  80. package/.next/server/app/page.js +1 -1
  81. package/.next/server/app/page.js.nft.json +1 -1
  82. package/.next/server/app/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app-paths-manifest.json +4 -0
  84. package/.next/server/chunks/[root-of-the-server]__1211da38._.js +3 -0
  85. package/.next/server/chunks/[root-of-the-server]__1211da38._.js.map +1 -0
  86. package/.next/{standalone/.next/server/chunks/[root-of-the-server]__b698889b._.js → server/chunks/[root-of-the-server]__1b87ec42._.js} +2 -2
  87. package/.next/server/chunks/[root-of-the-server]__1b87ec42._.js.map +1 -0
  88. package/.next/server/chunks/[root-of-the-server]__2b526e7a._.js +3 -0
  89. package/.next/server/chunks/[root-of-the-server]__2b526e7a._.js.map +1 -0
  90. package/.next/server/chunks/[root-of-the-server]__2f981540._.js +3 -0
  91. package/.next/server/chunks/[root-of-the-server]__2f981540._.js.map +1 -0
  92. package/.next/server/chunks/[root-of-the-server]__3745b314._.js +3 -0
  93. package/.next/server/chunks/[root-of-the-server]__3745b314._.js.map +1 -0
  94. package/.next/server/chunks/[root-of-the-server]__56690af0._.js +1 -1
  95. package/.next/server/chunks/[root-of-the-server]__56690af0._.js.map +1 -1
  96. package/.next/server/chunks/[root-of-the-server]__56f5f249._.js +1 -1
  97. package/.next/server/chunks/[root-of-the-server]__56f5f249._.js.map +1 -1
  98. package/.next/server/chunks/[root-of-the-server]__59175de4._.js +1 -1
  99. package/.next/server/chunks/[root-of-the-server]__59175de4._.js.map +1 -1
  100. package/.next/server/chunks/[root-of-the-server]__64fffc02._.js +1 -1
  101. package/.next/server/chunks/[root-of-the-server]__64fffc02._.js.map +1 -1
  102. package/.next/server/chunks/[root-of-the-server]__6c428a24._.js +3 -0
  103. package/.next/server/chunks/[root-of-the-server]__6c428a24._.js.map +1 -0
  104. package/.next/server/chunks/[root-of-the-server]__73a00b88._.js +3 -0
  105. package/.next/server/chunks/[root-of-the-server]__73a00b88._.js.map +1 -0
  106. package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +1 -1
  107. package/.next/server/chunks/[root-of-the-server]__89c5eeab._.js.map +1 -1
  108. package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +1 -1
  109. package/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js.map +1 -1
  110. package/.next/server/chunks/[root-of-the-server]__b796d06c._.js +1 -1
  111. package/.next/server/chunks/[root-of-the-server]__b796d06c._.js.map +1 -1
  112. package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +1 -1
  113. package/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js.map +1 -1
  114. package/.next/server/chunks/[root-of-the-server]__d8e61048._.js +3 -0
  115. package/.next/server/chunks/[root-of-the-server]__d8e61048._.js.map +1 -0
  116. package/.next/server/chunks/[root-of-the-server]__db285678._.js +3 -0
  117. package/.next/server/chunks/[root-of-the-server]__db285678._.js.map +1 -0
  118. package/.next/{standalone/.next/server/chunks/[root-of-the-server]__16a9eb0a._.js → server/chunks/[root-of-the-server]__e00a9200._.js} +2 -2
  119. package/.next/server/chunks/{[root-of-the-server]__16a9eb0a._.js.map → [root-of-the-server]__e00a9200._.js.map} +1 -1
  120. package/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js +3 -0
  121. package/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js.map +1 -0
  122. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_archive_route_actions_237255a5.js +3 -0
  123. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_archive_route_actions_237255a5.js.map +1 -0
  124. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_delete_route_actions_e5d426f6.js +3 -0
  125. package/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_delete_route_actions_e5d426f6.js.map +1 -0
  126. package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_open-editor_route_actions_eaebf476.js +3 -0
  127. package/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_open-editor_route_actions_eaebf476.js.map +1 -0
  128. package/.next/server/chunks/ce889_server_app_api_node_sessions_[id]_open-editor_route_actions_791cdf5b.js +3 -0
  129. package/.next/server/chunks/ce889_server_app_api_node_sessions_[id]_open-editor_route_actions_791cdf5b.js.map +1 -0
  130. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js +1 -1
  131. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js.map +1 -1
  132. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
  133. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js.map +1 -1
  134. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +2 -2
  135. package/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js.map +1 -1
  136. package/.next/server/chunks/ssr/{[root-of-the-server]__efc52f08._.js → [root-of-the-server]__631e12d0._.js} +2 -2
  137. package/.next/server/chunks/ssr/[root-of-the-server]__a8cd3911._.js +3 -0
  138. package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
  139. package/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js.map +1 -1
  140. package/.next/server/pages/404.html +1 -1
  141. package/.next/server/pages/500.html +2 -2
  142. package/.next/server/server-reference-manifest.js +1 -1
  143. package/.next/server/server-reference-manifest.json +1 -1
  144. package/.next/standalone/.next/BUILD_ID +1 -1
  145. package/.next/standalone/.next/app-path-routes-manifest.json +4 -0
  146. package/.next/standalone/.next/build-manifest.json +2 -2
  147. package/.next/standalone/.next/prerender-manifest.json +3 -3
  148. package/.next/standalone/.next/routes-manifest.json +32 -0
  149. package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
  150. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  151. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  152. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  153. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  154. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  155. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  156. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  157. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  158. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  159. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  161. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  162. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  163. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  164. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  165. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  166. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  167. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  168. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  169. package/.next/standalone/.next/server/app/api/node/events/route.js +1 -1
  170. package/.next/standalone/.next/server/app/api/node/events/route.js.nft.json +1 -1
  171. package/.next/standalone/.next/server/app/api/node/health/route.js +1 -1
  172. package/.next/standalone/.next/server/app/api/node/health/route.js.nft.json +1 -1
  173. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route/app-paths-manifest.json +3 -0
  174. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route/build-manifest.json +11 -0
  175. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route/server-reference-manifest.json +4 -0
  176. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route.js +6 -0
  177. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route.js.map +5 -0
  178. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route.js.nft.json +1 -0
  179. package/.next/standalone/.next/server/app/api/node/sessions/[id]/archive/route_client-reference-manifest.js +2 -0
  180. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route/app-paths-manifest.json +3 -0
  181. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route/build-manifest.json +11 -0
  182. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route/server-reference-manifest.json +4 -0
  183. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js +7 -0
  184. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js.map +5 -0
  185. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route.js.nft.json +1 -0
  186. package/.next/standalone/.next/server/app/api/node/sessions/[id]/delete/route_client-reference-manifest.js +2 -0
  187. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
  188. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route/build-manifest.json +11 -0
  189. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
  190. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js +7 -0
  191. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js.map +5 -0
  192. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route.js.nft.json +1 -0
  193. package/.next/standalone/.next/server/app/api/node/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
  194. package/.next/standalone/.next/server/app/api/node/sessions/route.js +1 -1
  195. package/.next/standalone/.next/server/app/api/node/sessions/route.js.nft.json +1 -1
  196. package/.next/standalone/.next/server/app/api/opencode-events/route.js +1 -1
  197. package/.next/standalone/.next/server/app/api/opencode-events/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js +2 -1
  199. package/.next/standalone/.next/server/app/api/sessions/[id]/archive/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js +3 -2
  201. package/.next/standalone/.next/server/app/api/sessions/[id]/delete/route.js.nft.json +1 -1
  202. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route/app-paths-manifest.json +3 -0
  203. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route/build-manifest.json +11 -0
  204. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route/server-reference-manifest.json +4 -0
  205. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js +7 -0
  206. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js.map +5 -0
  207. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route.js.nft.json +1 -0
  208. package/.next/standalone/.next/server/app/api/sessions/[id]/open-editor/route_client-reference-manifest.js +2 -0
  209. package/.next/standalone/.next/server/app/api/sessions/route.js +1 -1
  210. package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
  211. package/.next/standalone/.next/server/app/index.html +1 -1
  212. package/.next/standalone/.next/server/app/index.rsc +3 -3
  213. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  214. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
  215. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  216. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  217. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  218. package/.next/standalone/.next/server/app/page.js +1 -1
  219. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  220. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  221. package/.next/standalone/.next/server/app-paths-manifest.json +4 -0
  222. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1211da38._.js +3 -0
  223. package/.next/{server/chunks/[root-of-the-server]__b698889b._.js → standalone/.next/server/chunks/[root-of-the-server]__1b87ec42._.js} +2 -2
  224. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2b526e7a._.js +3 -0
  225. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2f981540._.js +3 -0
  226. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3745b314._.js +3 -0
  227. package/.next/standalone/.next/server/chunks/[root-of-the-server]__56690af0._.js +1 -1
  228. package/.next/standalone/.next/server/chunks/[root-of-the-server]__56f5f249._.js +1 -1
  229. package/.next/standalone/.next/server/chunks/[root-of-the-server]__59175de4._.js +1 -1
  230. package/.next/standalone/.next/server/chunks/[root-of-the-server]__64fffc02._.js +1 -1
  231. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6c428a24._.js +3 -0
  232. package/.next/standalone/.next/server/chunks/[root-of-the-server]__73a00b88._.js +3 -0
  233. package/.next/standalone/.next/server/chunks/[root-of-the-server]__89c5eeab._.js +1 -1
  234. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8da6c5a8._.js +1 -1
  235. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b796d06c._.js +1 -1
  236. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c2ce5c0f._.js +1 -1
  237. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d8e61048._.js +3 -0
  238. package/.next/standalone/.next/server/chunks/[root-of-the-server]__db285678._.js +3 -0
  239. package/.next/{server/chunks/[root-of-the-server]__16a9eb0a._.js → standalone/.next/server/chunks/[root-of-the-server]__e00a9200._.js} +2 -2
  240. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e5df5e5f._.js +3 -0
  241. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_archive_route_actions_237255a5.js +3 -0
  242. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_node_sessions_[id]_delete_route_actions_e5d426f6.js +3 -0
  243. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_sessions_[id]_open-editor_route_actions_eaebf476.js +3 -0
  244. package/.next/standalone/.next/server/chunks/ce889_server_app_api_node_sessions_[id]_open-editor_route_actions_791cdf5b.js +3 -0
  245. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7e181e75.js +1 -1
  246. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_b054aff3.js +1 -1
  247. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_fa835ac3.js +2 -2
  248. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__efc52f08._.js → [root-of-the-server]__631e12d0._.js} +2 -2
  249. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__a8cd3911._.js +3 -0
  250. package/.next/standalone/.next/server/chunks/ssr/src_app_page_tsx_a7111f3e._.js +3 -3
  251. package/.next/standalone/.next/server/pages/404.html +1 -1
  252. package/.next/standalone/.next/server/pages/500.html +2 -2
  253. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  254. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  255. package/.next/standalone/.next/static/chunks/7ac19aaef01f4a03.js +13 -0
  256. package/.next/standalone/.next/static/chunks/f42202943f6742e5.css +3 -0
  257. package/.next/standalone/AGENTS.md +85 -0
  258. package/.next/standalone/README.md +76 -0
  259. package/.next/standalone/__mocks__/child_process.ts +4 -0
  260. package/.next/standalone/bin/dev-runtime.js +58 -0
  261. package/.next/standalone/bin/vibepulse.js +87 -0
  262. package/.next/standalone/check-hsql.mjs +71 -0
  263. package/.next/standalone/docs/session-status-detection.md +258 -0
  264. package/.next/standalone/eslint.config.mjs +31 -0
  265. package/.next/standalone/next.config.ts +8 -0
  266. package/.next/standalone/package-lock.json +10312 -0
  267. package/.next/standalone/package.json +1 -1
  268. package/.next/standalone/postcss.config.mjs +7 -0
  269. package/.next/standalone/src/AGENTS.md +41 -0
  270. package/.next/standalone/src/app/api/AGENTS.md +40 -0
  271. package/.next/standalone/src/app/api/node/events/route.test.ts +196 -0
  272. package/.next/standalone/src/app/api/node/events/route.ts +259 -0
  273. package/.next/standalone/src/app/api/node/health/route.test.ts +190 -0
  274. package/.next/standalone/src/app/api/node/health/route.ts +48 -0
  275. package/.next/standalone/src/app/api/node/sessions/[id]/archive/route.test.ts +128 -0
  276. package/.next/standalone/src/app/api/node/sessions/[id]/archive/route.ts +97 -0
  277. package/.next/standalone/src/app/api/node/sessions/[id]/delete/route.test.ts +113 -0
  278. package/.next/standalone/src/app/api/node/sessions/[id]/delete/route.ts +81 -0
  279. package/.next/standalone/src/app/api/node/sessions/[id]/open-editor/route.test.ts +206 -0
  280. package/.next/standalone/src/app/api/node/sessions/[id]/open-editor/route.ts +123 -0
  281. package/.next/standalone/src/app/api/node/sessions/route.test.ts +408 -0
  282. package/.next/standalone/src/app/api/node/sessions/route.ts +1094 -0
  283. package/.next/standalone/src/app/api/nodes/route.test.ts +237 -0
  284. package/.next/standalone/src/app/api/nodes/route.ts +176 -0
  285. package/.next/standalone/src/app/api/opencode-config/route.test.ts +86 -0
  286. package/.next/standalone/src/app/api/opencode-config/route.ts +376 -0
  287. package/.next/standalone/src/app/api/opencode-config/status/route.ts +31 -0
  288. package/.next/standalone/src/app/api/opencode-events/route.test.ts +624 -0
  289. package/.next/standalone/src/app/api/opencode-events/route.ts +508 -0
  290. package/.next/standalone/src/app/api/opencode-models/route.test.ts +167 -0
  291. package/.next/standalone/src/app/api/opencode-models/route.ts +76 -0
  292. package/.next/standalone/src/app/api/profiles/[id]/apply/route.ts +49 -0
  293. package/.next/standalone/src/app/api/profiles/[id]/export/route.ts +31 -0
  294. package/.next/standalone/src/app/api/profiles/[id]/route.ts +160 -0
  295. package/.next/standalone/src/app/api/profiles/import/route.test.js +107 -0
  296. package/.next/standalone/src/app/api/profiles/import/route.ts +65 -0
  297. package/.next/standalone/src/app/api/profiles/route.ts +107 -0
  298. package/.next/standalone/src/app/api/sessions/[id]/archive/route.test.ts +136 -0
  299. package/.next/standalone/src/app/api/sessions/[id]/archive/route.ts +170 -0
  300. package/.next/standalone/src/app/api/sessions/[id]/delete/route.test.ts +113 -0
  301. package/.next/standalone/src/app/api/sessions/[id]/delete/route.ts +137 -0
  302. package/.next/standalone/src/app/api/sessions/[id]/open-editor/route.test.ts +218 -0
  303. package/.next/standalone/src/app/api/sessions/[id]/open-editor/route.ts +85 -0
  304. package/.next/standalone/src/app/api/sessions/[id]/route.test.ts +531 -0
  305. package/.next/standalone/src/app/api/sessions/[id]/route.ts +75 -0
  306. package/.next/standalone/src/app/api/sessions/route.test.ts +1298 -0
  307. package/.next/standalone/src/app/api/sessions/route.ts +1695 -0
  308. package/.next/standalone/src/app/favicon.ico +0 -0
  309. package/.next/standalone/src/app/globals.css +66 -0
  310. package/.next/standalone/src/app/layout.tsx +37 -0
  311. package/.next/standalone/src/app/page.test.tsx +134 -0
  312. package/.next/standalone/src/app/page.tsx +358 -0
  313. package/.next/standalone/src/components/AGENTS.md +42 -0
  314. package/.next/standalone/src/components/ErrorBoundary.tsx +72 -0
  315. package/.next/standalone/src/components/KanbanBoard.test.tsx +704 -0
  316. package/.next/standalone/src/components/KanbanBoard.tsx +852 -0
  317. package/.next/standalone/src/components/LoadingState.tsx +37 -0
  318. package/.next/standalone/src/components/ProjectCard.test.tsx +773 -0
  319. package/.next/standalone/src/components/ProjectCard.tsx +595 -0
  320. package/.next/standalone/src/components/QueryProvider.tsx +25 -0
  321. package/.next/standalone/src/components/SessionCard.test.tsx +566 -0
  322. package/.next/standalone/src/components/SessionCard.tsx +434 -0
  323. package/.next/standalone/src/components/SessionList.tsx +60 -0
  324. package/.next/standalone/src/components/host-config/HostManagerDialog.test.tsx +252 -0
  325. package/.next/standalone/src/components/host-config/HostManagerDialog.tsx +476 -0
  326. package/.next/standalone/src/components/opencode-config/AgentConfigForm.test.tsx +72 -0
  327. package/.next/standalone/src/components/opencode-config/AgentConfigForm.tsx +483 -0
  328. package/.next/standalone/src/components/opencode-config/AgentModelSelector.tsx +284 -0
  329. package/.next/standalone/src/components/opencode-config/AgentsConfigPanel.tsx +162 -0
  330. package/.next/standalone/src/components/opencode-config/ConfigButton.tsx +43 -0
  331. package/.next/standalone/src/components/opencode-config/ConfigPanel.tsx +91 -0
  332. package/.next/standalone/src/components/opencode-config/FullscreenConfigPanel.tsx +435 -0
  333. package/.next/standalone/src/components/opencode-config/GeneralSettingsForm.test.tsx +91 -0
  334. package/.next/standalone/src/components/opencode-config/GeneralSettingsForm.tsx +288 -0
  335. package/.next/standalone/src/components/opencode-config/categories/CategoriesList.tsx +382 -0
  336. package/.next/standalone/src/components/opencode-config/categories/CategoriesManager.test.tsx +111 -0
  337. package/.next/standalone/src/components/opencode-config/categories/CategoriesManager.tsx +174 -0
  338. package/.next/standalone/src/components/opencode-config/categories/CategoryConfigForm.tsx +453 -0
  339. package/.next/standalone/src/components/opencode-config/profiles/ProfileCard.tsx +140 -0
  340. package/.next/standalone/src/components/opencode-config/profiles/ProfileEditor.tsx +446 -0
  341. package/.next/standalone/src/components/opencode-config/profiles/ProfileList.tsx +446 -0
  342. package/.next/standalone/src/components/opencode-config/profiles/ProfileManager.test.tsx +225 -0
  343. package/.next/standalone/src/components/opencode-config/profiles/ProfileManager.tsx +405 -0
  344. package/.next/standalone/src/components/ui/Tabs.tsx +59 -0
  345. package/.next/standalone/src/hooks/useHostSources.test.ts +509 -0
  346. package/.next/standalone/src/hooks/useHostSources.ts +299 -0
  347. package/.next/standalone/src/hooks/useOpencodeSync.test.ts +387 -0
  348. package/.next/standalone/src/hooks/useOpencodeSync.ts +571 -0
  349. package/.next/standalone/src/index.ts +2 -0
  350. package/.next/standalone/src/lib/editorLauncher.server.ts +36 -0
  351. package/.next/standalone/src/lib/editorLauncher.test.ts +35 -0
  352. package/.next/standalone/src/lib/editorLauncher.ts +25 -0
  353. package/.next/standalone/src/lib/hostAccent.test.ts +58 -0
  354. package/.next/standalone/src/lib/hostAccent.ts +46 -0
  355. package/.next/standalone/src/lib/hostIdentity.test.ts +187 -0
  356. package/.next/standalone/src/lib/hostIdentity.ts +122 -0
  357. package/.next/standalone/src/lib/hostSourcesStorage.test.ts +141 -0
  358. package/.next/standalone/src/lib/hostSourcesStorage.ts +72 -0
  359. package/.next/standalone/src/lib/nodeProtocol.test.ts +159 -0
  360. package/.next/standalone/src/lib/nodeProtocol.ts +142 -0
  361. package/.next/standalone/src/lib/nodeRegistry.test.ts +173 -0
  362. package/.next/standalone/src/lib/nodeRegistry.ts +398 -0
  363. package/.next/standalone/src/lib/notificationSound.ts +292 -0
  364. package/.next/standalone/src/lib/opencodeConfig.test.ts +100 -0
  365. package/.next/standalone/src/lib/opencodeConfig.ts +76 -0
  366. package/.next/standalone/src/lib/opencodeDiscovery.ts +275 -0
  367. package/.next/standalone/src/lib/profiles/share.test.ts +91 -0
  368. package/.next/standalone/src/lib/profiles/share.ts +93 -0
  369. package/.next/standalone/src/lib/profiles/storage.test.ts +108 -0
  370. package/.next/standalone/src/lib/profiles/storage.ts +370 -0
  371. package/.next/standalone/src/lib/runtimeMode.test.ts +29 -0
  372. package/.next/standalone/src/lib/runtimeMode.ts +29 -0
  373. package/.next/standalone/src/lib/sessionActionErrors.ts +37 -0
  374. package/.next/standalone/src/lib/sessionArchiveOverrides.test.ts +43 -0
  375. package/.next/standalone/src/lib/sessionArchiveOverrides.ts +116 -0
  376. package/.next/standalone/src/lib/transform.test.ts +121 -0
  377. package/.next/standalone/src/lib/transform.ts +193 -0
  378. package/.next/standalone/src/test/setup.ts +8 -0
  379. package/.next/standalone/src/types/index.ts +152 -0
  380. package/.next/standalone/src/types/opencodeConfig.ts +149 -0
  381. package/.next/standalone/tsconfig.json +34 -0
  382. package/.next/standalone/tsconfig.lib.json +17 -0
  383. package/.next/standalone/vitest.config.ts +16 -0
  384. package/.next/static/chunks/7ac19aaef01f4a03.js +13 -0
  385. package/.next/static/chunks/f42202943f6742e5.css +3 -0
  386. package/.next/trace +1 -1
  387. package/.next/trace-build +1 -1
  388. package/.next/types/routes.d.ts +5 -1
  389. package/.next/types/validator.ts +36 -0
  390. package/package.json +1 -1
  391. package/.next/server/chunks/[root-of-the-server]__0b017945._.js +0 -3
  392. package/.next/server/chunks/[root-of-the-server]__0b017945._.js.map +0 -1
  393. package/.next/server/chunks/[root-of-the-server]__1e118bd3._.js +0 -3
  394. package/.next/server/chunks/[root-of-the-server]__1e118bd3._.js.map +0 -1
  395. package/.next/server/chunks/[root-of-the-server]__6979e732._.js +0 -3
  396. package/.next/server/chunks/[root-of-the-server]__6979e732._.js.map +0 -1
  397. package/.next/server/chunks/[root-of-the-server]__a7b4d79d._.js +0 -3
  398. package/.next/server/chunks/[root-of-the-server]__a7b4d79d._.js.map +0 -1
  399. package/.next/server/chunks/[root-of-the-server]__b698889b._.js.map +0 -1
  400. package/.next/server/chunks/[root-of-the-server]__ddc251b7._.js +0 -3
  401. package/.next/server/chunks/[root-of-the-server]__ddc251b7._.js.map +0 -1
  402. package/.next/server/chunks/ssr/[root-of-the-server]__b0788643._.js +0 -3
  403. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b017945._.js +0 -3
  404. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1e118bd3._.js +0 -3
  405. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6979e732._.js +0 -3
  406. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a7b4d79d._.js +0 -3
  407. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ddc251b7._.js +0 -3
  408. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__b0788643._.js +0 -3
  409. package/.next/standalone/.next/static/chunks/9f8c22002e7395e8.js +0 -13
  410. package/.next/standalone/.next/static/chunks/f1b55db60e7ed6f3.css +0 -3
  411. package/.next/static/chunks/9f8c22002e7395e8.js +0 -13
  412. package/.next/static/chunks/f1b55db60e7ed6f3.css +0 -3
  413. /package/.next/server/chunks/ssr/{[root-of-the-server]__efc52f08._.js.map → [root-of-the-server]__631e12d0._.js.map} +0 -0
  414. /package/.next/server/chunks/ssr/{[root-of-the-server]__b0788643._.js.map → [root-of-the-server]__a8cd3911._.js.map} +0 -0
  415. /package/.next/standalone/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_buildManifest.js +0 -0
  416. /package/.next/standalone/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_clientMiddlewareManifest.json +0 -0
  417. /package/.next/standalone/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_ssgManifest.js +0 -0
  418. /package/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_buildManifest.js +0 -0
  419. /package/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_clientMiddlewareManifest.json +0 -0
  420. /package/.next/static/{L_tmqf71LaeMzApO4SiU- → Fw2R3y-fHX4B2SWxNy_4X}/_ssgManifest.js +0 -0
@@ -1,13 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,52683,e=>{"use strict";let t,r,n;var a,s,i,o,l,d,c,u,m=e.i(43476),h=e.i(71645),p=e.i(75555),f=e.i(40143),x=e.i(86491),g=e.i(15823),b=e.i(93803),y=e.i(19273),v=e.i(80166),k=class extends g.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#r=(0,b.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#n=void 0;#a=void 0;#s=void 0;#i;#o;#r;#t;#l;#d;#c;#u;#m;#h;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#n.addObserver(this),w(this.#n,this.options)?this.#f():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return j(this.#n,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return j(this.#n,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#b(),this.#n.removeObserver(this)}setOptions(e){let t=this.options,r=this.#n;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,y.resolveEnabled)(this.options.enabled,this.#n))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#y(),this.#n.setOptions(this.options),t._defaulted&&!(0,y.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#n,observer:this});let n=this.hasListeners();n&&z(this.#n,r,this.options,t)&&this.#f(),this.updateResult(),n&&(this.#n!==r||(0,y.resolveEnabled)(this.options.enabled,this.#n)!==(0,y.resolveEnabled)(t.enabled,this.#n)||(0,y.resolveStaleTime)(this.options.staleTime,this.#n)!==(0,y.resolveStaleTime)(t.staleTime,this.#n))&&this.#v();let a=this.#k();n&&(this.#n!==r||(0,y.resolveEnabled)(this.options.enabled,this.#n)!==(0,y.resolveEnabled)(t.enabled,this.#n)||a!==this.#h)&&this.#w(a)}getOptimisticResult(e){var t,r;let n=this.#e.getQueryCache().build(this.#e,e),a=this.createResult(n,e);return t=this,r=a,(0,y.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#s=a,this.#o=this.options,this.#i=this.#n.state),a}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#r.status||this.#r.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#n}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#f({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#f(e){this.#y();let t=this.#n.fetch(this.options,e);return e?.throwOnError||(t=t.catch(y.noop)),t}#v(){this.#g();let e=(0,y.resolveStaleTime)(this.options.staleTime,this.#n);if(y.isServer||this.#s.isStale||!(0,y.isValidTimeout)(e))return;let t=(0,y.timeUntilStale)(this.#s.dataUpdatedAt,e);this.#u=v.timeoutManager.setTimeout(()=>{this.#s.isStale||this.updateResult()},t+1)}#k(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#n):this.options.refetchInterval)??!1}#w(e){this.#b(),this.#h=e,!y.isServer&&!1!==(0,y.resolveEnabled)(this.options.enabled,this.#n)&&(0,y.isValidTimeout)(this.#h)&&0!==this.#h&&(this.#m=v.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||p.focusManager.isFocused())&&this.#f()},this.#h))}#x(){this.#v(),this.#w(this.#k())}#g(){this.#u&&(v.timeoutManager.clearTimeout(this.#u),this.#u=void 0)}#b(){this.#m&&(v.timeoutManager.clearInterval(this.#m),this.#m=void 0)}createResult(e,t){let r,n=this.#n,a=this.options,s=this.#s,i=this.#i,o=this.#o,l=e!==n?e.state:this.#a,{state:d}=e,c={...d},u=!1;if(t._optimisticResults){let r=this.hasListeners(),s=!r&&w(e,t),i=r&&z(e,n,t,a);(s||i)&&(c={...c,...(0,x.fetchState)(d.data,e.options)}),"isRestoring"===t._optimisticResults&&(c.fetchStatus="idle")}let{error:m,errorUpdatedAt:h,status:p}=c;r=c.data;let f=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===p){let e;s?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=s.data,f=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#c?.state.data,this.#c):t.placeholderData,void 0!==e&&(p="success",r=(0,y.replaceData)(s?.data,e,t),u=!0)}if(t.select&&void 0!==r&&!f)if(s&&r===i?.data&&t.select===this.#l)r=this.#d;else try{this.#l=t.select,r=t.select(r),r=(0,y.replaceData)(s?.data,r,t),this.#d=r,this.#t=null}catch(e){this.#t=e}this.#t&&(m=this.#t,r=this.#d,h=Date.now(),p="error");let g="fetching"===c.fetchStatus,v="pending"===p,k="error"===p,j=v&&g,S=void 0!==r,C={status:p,fetchStatus:c.fetchStatus,isPending:v,isSuccess:"success"===p,isError:k,isInitialLoading:j,isLoading:j,data:r,dataUpdatedAt:c.dataUpdatedAt,error:m,errorUpdatedAt:h,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>l.dataUpdateCount||c.errorUpdateCount>l.errorUpdateCount,isFetching:g,isRefetching:g&&!v,isLoadingError:k&&!S,isPaused:"paused"===c.fetchStatus,isPlaceholderData:u,isRefetchError:k&&S,isStale:N(e,t),refetch:this.refetch,promise:this.#r,isEnabled:!1!==(0,y.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==C.data,r="error"===C.status&&!t,a=e=>{r?e.reject(C.error):t&&e.resolve(C.data)},s=()=>{a(this.#r=C.promise=(0,b.pendingThenable)())},i=this.#r;switch(i.status){case"pending":e.queryHash===n.queryHash&&a(i);break;case"fulfilled":(r||C.data!==i.value)&&s();break;case"rejected":r&&C.error===i.reason||s()}}return C}updateResult(){let e=this.#s,t=this.createResult(this.#n,this.options);if(this.#i=this.#n.state,this.#o=this.options,void 0!==this.#i.data&&(this.#c=this.#n),(0,y.shallowEqualObjects)(t,e))return;this.#s=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#p.size)return!0;let n=new Set(r??this.#p);return this.options.throwOnError&&n.add("error"),Object.keys(this.#s).some(t=>this.#s[t]!==e[t]&&n.has(t))};this.#j({listeners:r()})}#y(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#n)return;let t=this.#n;this.#n=e,this.#a=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#j(e){f.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#s)}),this.#e.getQueryCache().notify({query:this.#n,type:"observerResultsUpdated"})})}};function w(e,t){return!1!==(0,y.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&j(e,t,t.refetchOnMount)}function j(e,t,r){if(!1!==(0,y.resolveEnabled)(t.enabled,e)&&"static"!==(0,y.resolveStaleTime)(t.staleTime,e)){let n="function"==typeof r?r(e):r;return"always"===n||!1!==n&&N(e,t)}return!1}function z(e,t,r,n){return(e!==t||!1===(0,y.resolveEnabled)(n.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&N(e,r)}function N(e,t){return!1!==(0,y.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,y.resolveStaleTime)(t.staleTime,e))}e.i(47167);var S=e.i(12598),C=h.createContext((r=!1,{clearReset:()=>{r=!1},reset:()=>{r=!0},isReset:()=>r})),E=h.createContext(!1);E.Provider;var R=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function A(e,t){return function(e,t,r){let n,a=h.useContext(E),s=h.useContext(C),i=(0,S.useQueryClient)(r),o=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let l=i.getQueryCache().get(o.queryHash);if(o._optimisticResults=a?"isRestoring":"optimistic",o.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=o.staleTime;o.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof o.gcTime&&(o.gcTime=Math.max(o.gcTime,1e3))}n=l?.state.error&&"function"==typeof o.throwOnError?(0,y.shouldThrowError)(o.throwOnError,[l.state.error,l]):o.throwOnError,(o.suspense||o.experimental_prefetchInRender||n)&&!s.isReset()&&(o.retryOnMount=!1),h.useEffect(()=>{s.clearReset()},[s]);let d=!i.getQueryCache().get(o.queryHash),[c]=h.useState(()=>new t(i,o)),u=c.getOptimisticResult(o),m=!a&&!1!==e.subscribed;if(h.useSyncExternalStore(h.useCallback(e=>{let t=m?c.subscribe(f.notifyManager.batchCalls(e)):y.noop;return c.updateResult(),t},[c,m]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),h.useEffect(()=>{c.setOptions(o)},[o,c]),o?.suspense&&u.isPending)throw R(o,c,s);if((({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&void 0===e.data||(0,y.shouldThrowError)(r,[e.error,n])))({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:l,suspense:o.suspense}))throw u.error;if(i.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!y.isServer&&u.isLoading&&u.isFetching&&!a){let e=d?R(o,c,s):l?.promise;e?.catch(y.noop).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?u:c.trackResult(u)}(e,k,t)}let T=[{textClass:"text-blue-500 dark:text-blue-400"},{textClass:"text-emerald-500 dark:text-emerald-400"},{textClass:"text-amber-500 dark:text-amber-400"},{textClass:"text-violet-500 dark:text-violet-400"},{textClass:"text-cyan-500 dark:text-cyan-400"}];function O(e,t){return e||t?T[function(e,t){let r=`${e??""}:${t??""}`,n=0;for(let e=0;e<r.length;e+=1)n=31*n+r.charCodeAt(e)>>>0;return n%T.length}(e,t)].textClass:"text-zinc-400 dark:text-zinc-500"}function L(e){let t=Date.now()-e,r=Math.floor(t/6e4),n=Math.floor(t/36e5),a=Math.floor(t/864e5);return r<1?"<1m":n<1?`${r}m`:a<1?`${n}h`:`${a}d`}function F(e,t){return t?[...e,`Reason: ${t}`].join("\n"):e.join("\n")}function M({status:e,waitingForUser:t}){if(t)return(0,m.jsxs)("span",{className:"relative flex h-2 w-2 flex-shrink-0",title:"Waiting",children:[(0,m.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75"}),(0,m.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-amber-500"})]});switch(e){case"busy":return(0,m.jsxs)("span",{className:"relative flex h-2 w-2 flex-shrink-0",title:"Running",children:[(0,m.jsx)("span",{className:"animate-pulse absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75"}),(0,m.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-emerald-500"})]});case"retry":return(0,m.jsxs)("span",{className:"relative flex h-2 w-2 flex-shrink-0",title:"Retrying",children:[(0,m.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75"}),(0,m.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-red-500"})]});default:return(0,m.jsx)("span",{className:"inline-flex rounded-full h-2 w-2 bg-gray-400 flex-shrink-0",title:"Idle"})}}function I({cards:e,readOnly:t=!1}){let r=(0,S.useQueryClient)(),[n,a]=(0,h.useState)(!1),s=(0,h.useRef)(null);(0,h.useEffect)(()=>{if(!n)return;let e=e=>{s.current&&!s.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]);let i=e.some(e=>"done"!==e.status),o=async t=>{t.stopPropagation();let n=e.filter(e=>"done"!==e.status);await Promise.all(n.map(e=>fetch(`/api/sessions/${e.id}/archive`,{method:"POST"}))),a(!1),await r.invalidateQueries({queryKey:["sessions"]})},l=async t=>{t.stopPropagation(),confirm(`Delete ${e.length} session(s)? This cannot be undone.`)&&(await Promise.all(e.map(e=>fetch(`/api/sessions/${e.id}/delete`,{method:"POST"}))),a(!1),await r.invalidateQueries({queryKey:["sessions"]}))};return t?null:(0,m.jsxs)("div",{className:"relative",ref:s,children:[(0,m.jsx)("button",{type:"button",className:"w-5 h-5 flex items-center justify-center rounded-full text-gray-400 hover:text-gray-700 hover:bg-gray-200/80 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-zinc-600 transition-colors",onClick:e=>{e.stopPropagation(),a(!n)},title:"Batch actions",children:(0,m.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,m.jsx)("path",{d:"M5 10a2 2 0 110 4 2 2 0 010-4zm7 0a2 2 0 110 4 2 2 0 010-4zm7 0a2 2 0 110 4 2 2 0 010-4z"})})}),n&&(0,m.jsxs)("div",{className:"absolute right-0 top-6 w-32 rounded-md border border-gray-200 bg-white shadow-lg dark:border-zinc-700 dark:bg-zinc-900 z-20",children:[i&&(0,m.jsx)("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-50 dark:text-gray-200 dark:hover:bg-zinc-800",onClick:o,children:"Archive all"}),(0,m.jsx)("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20",onClick:l,children:"Delete all"})]})]})}function D({cardId:e,archived:t}){let r=(0,S.useQueryClient)(),[n,a]=(0,h.useState)(!1),s=(0,h.useRef)(null);(0,h.useEffect)(()=>{if(!n)return;let e=e=>{s.current&&!s.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]);let i=async t=>{t.stopPropagation();try{await fetch(`/api/sessions/${e}/archive`,{method:"POST"})}finally{a(!1),await r.invalidateQueries({queryKey:["sessions"]})}},o=async t=>{t.stopPropagation();try{await fetch(`/api/sessions/${e}/delete`,{method:"POST"})}finally{a(!1),await r.invalidateQueries({queryKey:["sessions"]})}};return(0,m.jsxs)("div",{className:"relative flex-shrink-0",ref:s,children:[(0,m.jsx)("button",{type:"button",className:"w-5 h-5 flex items-center justify-center rounded text-gray-400 hover:text-gray-600 hover:bg-gray-200 dark:text-gray-500 dark:hover:text-gray-300 dark:hover:bg-zinc-600 transition-colors",onClick:e=>{e.stopPropagation(),a(!n)},title:"Actions",children:(0,m.jsx)("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,m.jsx)("path",{d:"M5 10a2 2 0 110 4 2 2 0 010-4zm7 0a2 2 0 110 4 2 2 0 010-4zm7 0a2 2 0 110 4 2 2 0 010-4z"})})}),n&&(0,m.jsxs)("div",{className:"absolute right-0 top-6 w-28 rounded-md border border-gray-200 bg-white shadow-lg dark:border-zinc-700 dark:bg-zinc-900 z-20",children:[t?null:(0,m.jsx)("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-50 dark:text-gray-200 dark:hover:bg-zinc-800",onClick:i,children:"Archive"}),(0,m.jsx)("button",{type:"button",className:"w-full text-left px-3 py-1.5 text-xs text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20",onClick:o,children:"Delete"})]})]})}function P({card:e,isLast:t,readOnly:r=!1}){let[n,a]=(0,h.useState)(!0),s=(e.children||[]).filter(e=>"idle"!==e.realTimeStatus||e.waitingForUser),i=s.length>0,o=F([e.title||"Untitled Session",`Active ${L(e.updatedAt)} ago`,`Started ${L(e.createdAt)} ago`],e.debugReason);return(0,m.jsxs)("div",{className:t?"":"border-b border-gray-50 dark:border-zinc-700/30",children:[(0,m.jsxs)("div",{className:"group/row flex items-center gap-2.5 px-3 py-2 hover:bg-gray-50 dark:hover:bg-zinc-700/30 transition-colors",title:o,children:[i&&(0,m.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),a(!n)},className:"w-3 h-3 flex items-center justify-center text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 flex-shrink-0 transition-transform",title:n?"Collapse subagents":"Expand subagents",children:(0,m.jsx)("svg",{className:`w-2.5 h-2.5 transition-transform duration-150 ${n?"rotate-90":""}`,viewBox:"0 0 6 10",fill:"currentColor","aria-hidden":"true",children:(0,m.jsx)("path",{d:"M1 1l4 4-4 4",stroke:"currentColor",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,m.jsx)(M,{status:e.opencodeStatus,waitingForUser:e.waitingForUser}),(0,m.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300 truncate flex-1 min-w-0",children:e.title||"Untitled Session"}),i&&!n&&(0,m.jsxs)("span",{className:"text-[9px] font-medium text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-zinc-700 px-1 py-0.5 rounded flex-shrink-0",children:[s.length," sub"]}),(0,m.jsx)("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 flex-shrink-0 tabular-nums group-hover/row:hidden",children:L(e.updatedAt)}),r?null:(0,m.jsx)("div",{className:"hidden group-hover/row:flex flex-shrink-0",children:(0,m.jsx)(D,{cardId:e.id,archived:"done"===e.status})})]}),i&&n&&(0,m.jsx)("div",{className:"bg-gray-50/50 dark:bg-zinc-800/30",children:s.map((e,t)=>(0,m.jsxs)("div",{className:"flex items-center gap-2 pl-8 pr-3 py-1.5 hover:bg-gray-100/50 dark:hover:bg-zinc-700/20 transition-colors",title:F([e.title||"Subagent"],e.debugReason),children:[(0,m.jsx)("span",{className:"text-gray-300 dark:text-zinc-600 text-xs flex-shrink-0 font-mono leading-none",children:t===s.length-1?"└":"├"}),(0,m.jsx)(M,{status:e.realTimeStatus,waitingForUser:e.waitingForUser}),(0,m.jsx)("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate flex-1 min-w-0",children:e.title||"Subagent"})]},e.id))})]})}function _({projectName:e,branch:t,cards:r,readOnly:n,hostLabel:a,multipleHostsEnabled:s}){let i=r[0],o=n??i?.readOnly??!1,l=a??i?.hostLabel,d=i?.hostId,c=l&&(s||"Local"!==l),u=O(d,l),[p,f]=(0,h.useState)(()=>window.localStorage.getItem("vibepulse:open-tool")||"vscode"),[x]=(0,h.useState)(()=>{let e=window.localStorage.getItem("vibepulse:ssh-host");if(e)return e;let t=window.location.hostname;return t&&"localhost"!==t&&"127.0.0.1"!==t?t:""});return(0,m.jsxs)("article",{className:"w-full bg-white dark:bg-zinc-800 rounded-xl shadow-sm border border-gray-200 dark:border-zinc-700 hover:shadow-lg hover:border-gray-300 dark:hover:border-zinc-600 transition-all duration-200 overflow-visible",children:[(0,m.jsxs)("div",{className:"group/header flex items-center gap-2 px-3 py-2.5 hover:bg-gray-50 dark:hover:bg-zinc-700/30 transition-colors",children:[(0,m.jsx)("div",{className:`flex items-center justify-center flex-shrink-0 ${c?u:"text-blue-500 dark:text-blue-400"}`,title:c?`Source: ${l}`:void 0,children:(0,m.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}),(0,m.jsx)("span",{className:"text-sm font-semibold text-gray-800 dark:text-gray-200 truncate flex-1 min-w-0",children:e}),(r.length>1||!o)&&(0,m.jsxs)("div",{className:"flex items-center flex-shrink-0 bg-gray-100 dark:bg-zinc-700/50 rounded-full h-6 border border-gray-200/50 dark:border-zinc-700",children:[r.length>1&&(0,m.jsx)("span",{className:`text-[11px] font-medium text-gray-500 dark:text-gray-400 ${!o?"pl-2.5 pr-1":"px-2.5"}`,children:r.length}),!o&&(0,m.jsx)("div",{className:`${r.length>1?"pr-0.5":"px-0.5"}`,children:(0,m.jsx)(I,{cards:r,readOnly:o})})]})]}),(0,m.jsx)("div",{className:"border-t border-gray-100 dark:border-zinc-700/50",children:r.map((e,t)=>(0,m.jsx)(P,{card:e,isLast:t===r.length-1,readOnly:o},e.id))}),!o&&(0,m.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5 border-t border-gray-100 dark:border-zinc-700/50 bg-gray-50/50 dark:bg-zinc-800/50",children:[(0,m.jsx)("div",{className:"min-w-0 flex-1 text-[10px] text-gray-400 dark:text-gray-500 truncate",children:t?(0,m.jsx)("span",{className:"truncate",title:t,children:t}):null}),(0,m.jsxs)("div",{className:"flex items-center justify-end gap-1.5 flex-shrink-0",children:[(0,m.jsxs)("select",{className:"text-[10px] rounded border border-gray-200 bg-white px-1 py-0.5 text-gray-500 dark:border-zinc-700 dark:bg-zinc-900 dark:text-gray-400 focus:outline-none",value:p,onClick:e=>e.stopPropagation(),onChange:e=>{f(e.target.value),window.localStorage.setItem("vibepulse:open-tool",e.target.value)},title:"Select open tool",children:[(0,m.jsx)("option",{value:"vscode",children:"VSCode"}),(0,m.jsx)("option",{value:"antigravity",children:"Antigravity"})]}),(0,m.jsxs)("button",{type:"button",onClick:()=>{let e,t=r[0]?.directory;if(!t)return;let n="antigravity"===p?`antigravity://file${t}`:(e=encodeURI(t.replace(/\\/g,"/")),x?`vscode://vscode-remote/ssh-remote+${x}${e.startsWith("/")?"":"/"}${e}`:`vscode://file${e.startsWith("/")?e:`/${e}`}`);window.location.href=n},className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-medium text-gray-500 hover:text-blue-600 hover:bg-blue-50 dark:text-gray-400 dark:hover:text-blue-400 dark:hover:bg-blue-900/20 transition-colors",title:"Open project",children:[(0,m.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),"Open"]})]})]})]})}function V(e,t){return"number"==typeof e&&e>0&&t-e<=3e5}function $(e,t){if(!e)return;if(e.debugReason)return e.debugReason;let r=e.realTimeStatus||"idle";return e.waitingForUser||"retry"===r?"waiting_for_user":"busy"===r?V(e.time?.updated||e.time?.created,t)?"child_recent_activity":"child_unknown_fallback":void 0}function U(e){let t,r=e.children||[],n="string"==typeof e.slug?e.slug:"",a=Date.now(),s=e.realTimeStatus||"idle",i=r.some(e=>{let t=e.realTimeStatus||"idle";return"busy"===t||"retry"===t}),o="retry"===s?"retry":"busy"===s||i?"busy":"idle",l=r.some(e=>{let t=e.realTimeStatus||"idle";if(!("retry"===t||"idle"!==t&&e.waitingForUser))return!1;let r=e.time?.updated||a;return a-r<6e5}),d=!!e.waitingForUser,c="retry"===o||d||"busy"===o&&l,u=function({session:e,waitingForUser:t,effectiveStatus:r,firstActiveChild:n,firstWaitingChild:a,now:s}){if(e.debugReason)return e.debugReason;if(t)return $(a,s)||$(n,s)||"waiting_for_user";if("busy"===r){let t=e.realTimeStatus||"idle";return"busy"===t||"retry"===t?V(e.time?.updated||e.time?.created,s)?"direct_status_busy":"sticky_busy":n?"child_recent_activity":"unknown_fallback"}}({session:e,waitingForUser:c,effectiveStatus:o,firstActiveChild:r.find(e=>{let t=e.realTimeStatus||"idle";return"busy"===t||"retry"===t}),firstWaitingChild:r.find(e=>{let t=e.realTimeStatus||"idle";return"retry"===t||"idle"!==t&&!!e.waitingForUser}),now:a});return t=e.time?.archived?"done":c?"review":"busy"===o?"busy":"idle",{id:e.id,sessionSlug:n,title:e.title||"Untitled Session",directory:e.directory,projectName:e.projectName||"Unknown Project",branch:e.branch,agents:function(e){if(!e)return[];let t=e.split("_");return t.length>=3?t[t.length-1].split("-").filter(Boolean):[]}(n),messageCount:e.messageCount||0,status:t,opencodeStatus:o,waitingForUser:c,debugReason:u,todosTotal:0,todosCompleted:0,createdAt:e.time.created,updatedAt:e.time.updated,archivedAt:"done"===t?e.time.archived:void 0,sortOrder:0,hostId:e.hostId,hostLabel:e.hostLabel,hostKind:e.hostKind,rawSessionId:e.rawSessionId,sourceSessionKey:e.sourceSessionKey,readOnly:e.readOnly,children:r.map(e=>({id:e.id,title:e.title,realTimeStatus:e.realTimeStatus||"idle",waitingForUser:"retry"===(e.realTimeStatus||"idle")||"busy"===(e.realTimeStatus||"idle")&&!!e.waitingForUser,debugReason:$(e,a),createdAt:e.time?.created||0,updatedAt:e.time?.updated||0}))}}function q(){return(0,m.jsx)("div",{className:"h-[calc(100vh-8rem)] overflow-x-auto",children:(0,m.jsx)("div",{className:"flex gap-4 h-full min-w-max p-4",children:[1,2,3,4].map(e=>(0,m.jsxs)("div",{className:"flex-shrink-0 w-80 bg-gray-100 dark:bg-zinc-800 rounded-lg p-4 animate-pulse",children:[(0,m.jsx)("div",{className:"h-6 bg-gray-200 dark:bg-zinc-700 rounded w-24 mb-4"}),(0,m.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,m.jsxs)("div",{className:"p-4 bg-white dark:bg-zinc-900 rounded-lg shadow border border-gray-200 dark:border-zinc-700",children:[(0,m.jsx)("div",{className:"h-5 bg-gray-200 dark:bg-zinc-700 rounded w-3/4 mb-3"}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)("div",{className:"h-4 bg-gray-200 dark:bg-zinc-700 rounded w-20"}),(0,m.jsx)("div",{className:"h-4 bg-gray-200 dark:bg-zinc-700 rounded w-16"})]})]},e))})]},e))})})}let B=null,H="vibepulse:sound-muted",W="vibepulse:sound-muted-change",K=new Map;function Q(e){let t=Date.now();return!(t-(K.get(e)??0)<1e4)&&(K.set(e,t),!0)}function J(e,t,r){Q(`warn:${e}`)&&console.warn(`[VibePulse sound] ${t}`,r)}function G(){return B||(B=new AudioContext),B}function Y(e,t,r,n){if(X()){var a;return void(a=`${e}-muted`,Q(`info:${a}`)&&console.info(`[VibePulse sound] ${t}`))}try{let t=G(),a=()=>{try{n(t,t.currentTime)}catch(t){J(e,r,t)}};if("running"===t.state)return void a();t.resume().then(()=>{"running"===t.state?a():J(`${e}-state`,`${r} (AudioContext not running after resume)`,Error(t.state))}).catch(t=>{J(`${e}-resume`,`${r} (AudioContext resume failed)`,t)})}catch(t){J(e,r,t)}}function X(){return"true"===window.localStorage.getItem(H)}function Z(e){let t=()=>{e()},r=t=>{t.key===H&&e()};return window.addEventListener(W,t),window.addEventListener("storage",r),()=>{window.removeEventListener(W,t),window.removeEventListener("storage",r)}}function ee(){try{let e=G(),t=()=>{let t=e.createBuffer(1,1,22050),r=e.createBufferSource();r.buffer=t,r.connect(e.destination),r.start(0)};if("running"===e.state)return void t();e.resume().then(()=>{"running"===e.state?t():J("unlock-state","unlockAudio() resume did not reach running state",Error(e.state))}).catch(e=>{J("unlock-resume","Failed to resume AudioContext in unlockAudio()",e)})}catch(e){J("unlock-audio","unlockAudio() failed",e)}}function et(e,t){if(!e||""===e.trim())throw Error("Invalid hostId: cannot be empty");if(!t||""===t.trim())throw Error("Invalid sessionId: cannot be empty");if(e.includes(":")||t.includes(":"))throw Error("Invalid hostId or sessionId: colon character not allowed");return`${e}:${t}`}function er(e){try{let{sessionId:t}=function(e){if("string"!=typeof e)throw Error("Invalid sourceKey: must be a string");let t=e.split(":");if(2!==t.length)throw Error("Invalid sourceKey: must contain exactly one colon separator");let[r,n]=t,a=r.trim(),s=n.trim();if(""===a||""===s)throw Error("Invalid sourceKey: hostId and sessionId cannot be empty");return{hostId:a,sessionId:s}}(e);return t}catch{return null}}let en="vibepulse:waiting-sessions:v2",ea="local",es={hostId:ea,hostLabel:"Local",hostKind:"local"},ei=new Map;function eo(e,t){let r=function(){try{return JSON.parse(localStorage.getItem(en)||"{}")}catch{return{}}}();t?r[e]=!0:delete r[e],localStorage.setItem(en,JSON.stringify(r))}function el(e){let t=Date.now();return{...e,slug:e.slug||e.id,title:e.title||"Untitled Session",directory:e.directory||"",projectName:e.projectName||function(e){if(!e)return"Unknown Project";let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t[t.length-1]||"Unknown Project"}(e.directory),time:e.time||{created:t,updated:t},realTimeStatus:e.realTimeStatus||"busy",waitingForUser:!!e.waitingForUser,children:e.children||[]}}function ed(e){return"object"==typeof e&&null!==e&&"source"in e&&"event"in e}let ec="vibepulse:waiting-sessions:v2",eu="vibepulse:last-sessions-snapshot:v2",em={hostId:"local",hostLabel:"Local",hostKind:"local"},eh=[{id:"idle",title:"Idle"},{id:"busy",title:"Busy"},{id:"review",title:"Needs Attention"},{id:"done",title:"Archived"}];function ep(e){let t=e.sourceSessionKey||e.id;return"local"===e.hostKind||"local"===e.hostId||t.startsWith("local:")?t:null}function ef(e){return e.sourceSessionKey?e.sourceSessionKey:e.hostId&&e.rawSessionId?et(e.hostId,e.rawSessionId):e.hostId&&!e.id.includes(":")?et(e.hostId,e.id):e.id.includes(":")?e.id:et("local",e.id)}function ex({filterDays:e,onProcessHintsChange:t,hostSources:r,isNodeMode:n=!1,showHostFilter:a=!0,onHostStatusesChange:s}){let i=(0,h.useRef)({}),o=(0,h.useRef)(!1),[l,d]=(0,h.useState)("idle"),[c,u]=(0,h.useState)(null),{enabledSources:p,activeFilter:f,setActiveFilter:x,filteredHostIds:g}=r,b=(0,h.useMemo)(()=>{if(!n)return p;let e=p.filter(e=>"local"===e.hostKind&&"local"===e.hostId);return e.length>0?e:[em]},[p,n]),{data:y}=A({queryKey:["opencode-config"],queryFn:async()=>{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch config");return e.json()}}),v=y?.vibepulse?.sessionsRefreshIntervalMs,k="number"==typeof v&&Number.isFinite(v)&&v>0?v:5e3,{data:w,isLoading:j,error:z,dataUpdatedAt:N,refetch:S,isFetching:C,failureCount:E}=A({queryKey:["sessions",b,n],queryFn:async({signal:e})=>{try{let t=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sources:b}),signal:e});if(!t.ok){let e=null;try{e=await t.json()}catch{e=null}if(e&&!0===e.degraded&&Array.isArray(e.sessions))return e;let r=503===t.status&&e?.error==="OpenCode server not found",n=Error(r?e?.error||"OpenCode server not found":e?.error||`Failed to load sessions (${t.status})`);throw n.kind=r?"opencode_unavailable":"request_failed",n.hint=e?.hint,n.status=t.status,n}return t.json()}catch(t){if(t instanceof Error&&"AbortError"===t.name||t instanceof Error&&t.kind)throw t;let e=Error("Unable to connect to session service");throw e.kind="request_failed",e}},refetchInterval:e=>"fetching"!==e.state.fetchStatus&&k,refetchIntervalInBackground:!0,refetchOnReconnect:!0,retry:!1}),R=void 0!==w;(0,h.useEffect)(()=>{try{let e=localStorage.getItem(eu);if(!e)return;let t=JSON.parse(e);if(!t||!Array.isArray(t.sessions)||"number"!=typeof t.savedAt||(Array.isArray(t.processHints)||(t.processHints=[]),Array.isArray(t.hostStatuses)||(t.hostStatuses=[]),0===t.sessions.length))return;u(t)}catch{u(null)}},[]),(0,h.useEffect)(()=>{if(!w?.sessions||0===w.sessions.length||w.degraded&&c?.sessions?.length)return;let e={savedAt:Date.now(),sessions:w.sessions,processHints:w.processHints??[],hostStatuses:w.hostStatuses??[]};try{localStorage.setItem(eu,JSON.stringify(e)),u(e)}catch{u(e)}},[w?.degraded,w?.processHints,w?.sessions,w?.hostStatuses,c?.sessions?.length]);let T=async()=>{try{await navigator.clipboard.writeText("opencode --port <PORT>"),d("copied"),setTimeout(()=>d("idle"),1500)}catch{d("failed"),setTimeout(()=>d("idle"),2e3)}},L=(0,h.useMemo)(()=>{if(w?.sessions){if(w.degraded&&c?.sessions?.length&&Date.now()-c.savedAt<=6e5){let e=[...w.sessions],t=new Set(e.map(e=>ef(e)));for(let r of c.sessions){let n=ef(r);t.has(n)||(e.push(r),t.add(n))}return e}return w.sessions}return z&&c?.sessions?.length?c.sessions:[]},[z,w?.degraded,w?.sessions,c?.savedAt,c?.sessions]),F=!!z&&!w?.sessions&&!!c?.sessions?.length,M=(0,h.useMemo)(()=>w?.hostStatuses?.length?w.hostStatuses:F&&c?.hostStatuses?.length?c.hostStatuses:w&&!z&&1===b.length&&"local"===b[0].hostId&&"local"===b[0].hostKind?[{hostId:"local",hostLabel:"Local",hostKind:"local",online:!0}]:[],[z,w,w?.hostStatuses,b,F,c?.hostStatuses]),I=(0,h.useRef)(null);(0,h.useEffect)(()=>{s&&!function(e,t){if(!e||e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1){let n=e[r],a=t[r];if(n.hostId!==a.hostId||n.hostLabel!==a.hostLabel||n.hostKind!==a.hostKind||n.online!==a.online||n.degraded!==a.degraded||n.reason!==a.reason)return!1}return!0}(I.current,M)&&(I.current=M.map(e=>({...e})),s(M))},[M,s]);let D=!!z&&!F&&!R&&E>=3,P=!!z&&!F&&!R&&E>0&&E<3,V=(0,h.useMemo)(()=>w?.processHints?w.processHints:F&&c?.processHints?c.processHints:[],[w?.processHints,F,c?.processHints]);(0,h.useEffect)(()=>{t?.(V)},[t,V]);let $=(0,h.useMemo)(()=>{if(!L.length)return[];let e={};try{e=JSON.parse(localStorage.getItem(ec)||"{}")}catch{e={}}let t=function(){let e=Date.now();for(let[t,r]of ei)e-r.timestamp>5e3&&ei.delete(t);return ei}(),r=Date.now(),n=(e,t,n)=>!!n&&("busy"===e||"retry"===e)&&!!t&&r-t<=6e5;return L.map(r=>{let a=ep(r),s=!!a&&!!e[a],i=r.time?.updated||r.time?.created||0,o=!!a&&n(r.realTimeStatus,i,s),l=a?t.get(a):void 0,d=l?l.status:r.realTimeStatus,c=(r.children||[]).map(r=>{let a=ep(r),s=!!a&&!!e[a],i=r.time?.updated||r.time?.created||0,o=a?t.get(a):void 0,l=o?o.status:r.realTimeStatus,d=!!a&&n(l,i,s);return{...r,realTimeStatus:l,waitingForUser:!!r.waitingForUser||d}});return{...r,realTimeStatus:d,waitingForUser:!!r.waitingForUser||o,children:c}})},[L]);(0,h.useEffect)(()=>{let e={};for(let t of $){let r=ep(t);for(let n of(t.waitingForUser&&r&&(e[r]=!0),t.children||[])){let t=ep(n);n.waitingForUser&&t&&(e[t]=!0)}}localStorage.setItem(ec,JSON.stringify(e))},[$]);let B=(0,h.useMemo)(()=>{let t=$.map(U);if(g&&(t=t.filter(e=>{let t=e.hostId||"local";return g.has(t)})),0===e)return t;let r=N-24*e*36e5;return t.filter(e=>"busy"===e.status||"review"===e.status||Math.max(e.updatedAt||0,e.createdAt||0,e.archivedAt||0)>=r)},[N,$,e,g]);(0,h.useEffect)(()=>{let e={};for(let t of B)e[t.id]=t.status;if(!o.current){o.current=!0,i.current=e;return}let t=Object.entries(e).some(([e,t])=>{let r=i.current[e];return!!r&&"idle"!==r&&"idle"===t});i.current=e,t&&!F&&setTimeout(()=>void Y("play-complete","Skipped playCompleteSound() because muted","playCompleteSound() failed",(e,t)=>{let r=e.createOscillator(),n=e.createGain();r.type="sine",r.frequency.setValueAtTime(659,t),r.frequency.exponentialRampToValueAtTime(988,t+.18),n.gain.setValueAtTime(.22,t),n.gain.exponentialRampToValueAtTime(.001,t+.22),r.connect(n),n.connect(e.destination),r.start(t),r.stop(t+.22);let a=e.createOscillator(),s=e.createGain();a.type="sine",a.frequency.setValueAtTime(988,t+.12),a.frequency.exponentialRampToValueAtTime(1318,t+.32),s.gain.setValueAtTime(.18,t+.12),s.gain.exponentialRampToValueAtTime(.001,t+.36),a.connect(s),s.connect(e.destination),a.start(t+.12),a.stop(t+.36)}),250)},[B,F]);let H=a?(0,m.jsx)("div",{className:"shrink-0 flex items-center justify-end px-4 py-2 bg-zinc-50 dark:bg-black border-b border-gray-200 dark:border-zinc-800",children:(0,m.jsxs)("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-zinc-800 rounded-lg p-0.5","data-testid":"host-filter",children:[(0,m.jsx)("button",{type:"button",onClick:()=>x("all"),className:`px-3 py-1 text-xs font-medium rounded-md transition-all duration-150 ${"all"===f?"bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,"data-testid":"host-filter-option-all",children:"All Hosts"}),p.map(e=>{let t=M.find(t=>t.hostId===e.hostId),r=t?.online??!1,n=O(e.hostId,e.hostLabel);return(0,m.jsxs)("button",{type:"button",onClick:()=>x(e.hostId),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md transition-all duration-150 ${f===e.hostId?"bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,"data-testid":`host-filter-option-${e.hostId}`,children:[(0,m.jsx)("span",{className:`inline-flex items-center justify-center flex-shrink-0 ${n}`,"data-testid":`host-identity-${e.hostId}`,title:`Host identity: ${e.hostLabel}`,children:(0,m.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}),(0,m.jsx)("span",{className:"truncate",children:e.hostLabel}),(0,m.jsx)("span",{className:"ml-auto inline-flex items-center pl-1.5","data-testid":`host-indicators-${e.hostId}`,children:(0,m.jsx)("span",{className:`w-2 h-2 rounded-full ${r?"bg-emerald-500":"bg-gray-400"}`,"data-testid":`host-status-${e.hostId}`,title:r?"Online":"Offline"})})]},e.hostId)})]})}):null;if(j)return(0,m.jsxs)("div",{className:"flex flex-col flex-1 h-full min-h-0",children:[H,(0,m.jsx)(q,{})]});if(D){let e=z?.kind==="opencode_unavailable",t=e?z?.hint||"Run OpenCode with an exposed API port, for example `opencode --port <PORT>`.":z?.message||"An error occurred while loading sessions";return(0,m.jsxs)("div",{className:"flex flex-col flex-1 h-full min-h-0",children:[H,(0,m.jsx)("div",{className:"flex-1 flex items-center justify-center p-8",children:(0,m.jsxs)("div",{className:"max-w-md w-full text-center",children:[(0,m.jsx)("div",{className:"flex items-center justify-center w-12 h-12 mx-auto mb-4 bg-red-100 dark:bg-red-900/30 rounded-full",children:(0,m.jsx)("svg",{className:"w-6 h-6 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,m.jsx)("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:e?"OpenCode is not running":"Failed to load sessions"}),(0,m.jsx)("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:t}),(0,m.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,m.jsx)("button",{type:"button",onClick:()=>S(),className:"px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:C,children:C?"Retrying...":"Retry"}),e?(0,m.jsx)("button",{type:"button",onClick:T,className:"px-3 py-1.5 bg-gray-100 hover:bg-gray-200 dark:bg-zinc-800 dark:hover:bg-zinc-700 text-gray-700 dark:text-gray-300 text-sm font-medium rounded-md transition-colors",children:"copied"===l?"Copied":"failed"===l?"Copy Failed":"Copy Start Command"}):null]})]})})]})}return P?(0,m.jsxs)("div",{className:"flex flex-col flex-1 h-full min-h-0",children:[H,(0,m.jsx)("div",{className:"flex-1 flex items-center justify-center p-8",children:(0,m.jsxs)("div",{className:"max-w-md w-full text-center",children:[(0,m.jsx)("div",{className:"flex items-center justify-center w-12 h-12 mx-auto mb-4 bg-amber-100 dark:bg-amber-900/30 rounded-full",children:(0,m.jsx)("svg",{className:"w-6 h-6 text-amber-600 dark:text-amber-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,m.jsx)("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Reconnecting to session service..."}),(0,m.jsxs)("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:["Temporary fetch failure (",E,"/",3,"). Retrying automatically."]}),(0,m.jsx)("button",{type:"button",onClick:()=>S(),className:"px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium rounded-md transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:C,children:C?"Retrying...":"Retry now"})]})})]}):B&&0!==B.length?(0,m.jsxs)("div",{className:"flex flex-col flex-1 h-full min-h-0",children:[H,(0,m.jsxs)("div",{className:"flex-1 overflow-x-auto scrollbar-thin scroll-smooth relative",children:[F?(0,m.jsx)("div",{className:"px-4 pt-4 pb-0",children:(0,m.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-amber-800 dark:border-amber-900/40 dark:bg-amber-900/20 dark:text-amber-200",children:(0,m.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium",children:[(0,m.jsx)("span",{className:"inline-flex items-center rounded-full bg-amber-100 px-2 py-0.5 text-[10px] uppercase tracking-wide dark:bg-amber-900/40",children:"Stale Data"}),(0,m.jsxs)("span",{children:["Last seen at ",c?new Date(c.savedAt).toLocaleString():"--"]}),(0,m.jsx)("span",{className:"text-amber-700/80 dark:text-amber-300/80",children:"Read-only snapshot while OpenCode is unreachable."})]})})}):null,(0,m.jsx)("div",{className:"flex gap-6 h-full min-w-max p-4",children:eh.map(e=>{let t=B.filter(t=>t.status===e.id).sort((e,t)=>e.sortOrder-t.sortOrder),r=(e=>{let t=new Map;for(let r of e){let e=r.projectName||"Unknown Project",n=r.hostId||"local",a=`${n}::${e}`;t.has(a)||t.set(a,{projectName:e,branch:r.branch,hostLabel:r.hostLabel,readOnly:!!r.readOnly,cards:[]});let s=t.get(a);s.cards.push(r),s.readOnly=s.readOnly||!!r.readOnly,!s.branch&&r.branch&&(s.branch=r.branch),!s.hostLabel&&r.hostLabel&&(s.hostLabel=r.hostLabel)}return t})(t);return(0,m.jsxs)("div",{className:"flex-shrink-0 w-80 bg-gray-100 dark:bg-zinc-800/80 rounded-xl p-4 flex flex-col shadow-sm",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-200 dark:border-zinc-700",children:[(0,m.jsx)("h2",{className:"font-semibold text-gray-700 dark:text-gray-300",children:e.title}),(0,m.jsx)("span",{className:"px-2.5 py-0.5 bg-gray-200 dark:bg-zinc-700 text-gray-600 dark:text-gray-400 text-xs font-medium rounded-full",children:t.length})]}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto scrollbar-thin pr-1",children:(0,m.jsx)("div",{className:"space-y-3",children:Array.from(r.entries()).map(([e,t])=>(0,m.jsx)(_,{projectName:t.projectName,branch:t.branch,cards:t.cards,readOnly:F||t.readOnly,hostLabel:t.hostLabel,multipleHostsEnabled:b.length>1},e))})})]},e.id)})})]})]}):(0,m.jsxs)("div",{className:"flex flex-col flex-1 h-full min-h-0",children:[H,(0,m.jsx)("div",{className:"flex-1 flex items-center justify-center p-8",children:(0,m.jsxs)("div",{className:"max-w-md w-full text-center",children:[(0,m.jsx)("div",{className:"flex items-center justify-center w-12 h-12 mx-auto mb-4 bg-gray-100 dark:bg-zinc-800 rounded-full",children:(0,m.jsx)("svg",{className:"w-6 h-6 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})})}),(0,m.jsx)("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"No sessions yet"}),(0,m.jsx)("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:"OpenCode is running, but no sessions are available."}),(0,m.jsx)("p",{className:"text-sm text-gray-500 dark:text-gray-500",children:"Start a conversation in OpenCode and this board will update automatically."})]})})]})}var eg=h;class eb extends eg.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error("ErrorBoundary caught an error:",e,t)}render(){return this.state.hasError?(0,m.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-zinc-50 dark:bg-black",children:(0,m.jsxs)("div",{className:"max-w-md w-full mx-4 p-8 bg-white dark:bg-zinc-900 rounded-lg shadow-lg border border-gray-200 dark:border-zinc-800",children:[(0,m.jsx)("div",{className:"flex items-center justify-center w-12 h-12 mx-auto mb-4 bg-red-100 dark:bg-red-900/30 rounded-full",children:(0,m.jsx)("svg",{className:"w-6 h-6 text-red-600 dark:text-red-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),(0,m.jsx)("h2",{className:"text-xl font-semibold text-center text-gray-900 dark:text-white mb-2",children:"Something went wrong"}),(0,m.jsx)("p",{className:"text-center text-gray-600 dark:text-gray-400 mb-6",children:"An unexpected error occurred. Please try refreshing the page."}),this.state.error&&(0,m.jsx)("div",{className:"p-3 bg-gray-100 dark:bg-zinc-800 rounded text-sm text-gray-700 dark:text-gray-300 font-mono overflow-auto",children:this.state.error.message}),(0,m.jsx)("button",{onClick:()=>window.location.reload(),className:"mt-6 w-full py-2 px-4 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors",children:"Refresh Page"})]})}):this.props.children}}let ey=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),ev=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)};var ek={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"};let ew=(0,h.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:s,iconNode:i,...o},l)=>(0,h.createElement)("svg",{ref:l,...ek,width:t,height:t,stroke:e,strokeWidth:n?24*Number(r)/Number(t):r,className:ey("lucide",a),...!s&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1})(o)&&{"aria-hidden":"true"},...o},[...i.map(([e,t])=>(0,h.createElement)(e,t)),...Array.isArray(s)?s:[s]])),ej=(e,t)=>{let r=(0,h.forwardRef)(({className:r,...n},a)=>(0,h.createElement)(ew,{ref:a,iconNode:t,className:ey(`lucide-${ev(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,r),...n}));return r.displayName=ev(e),r},ez=ej("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),eN=ej("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),eS=ej("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function eC({onClick:e}){let{data:t}=A({queryKey:["opencode-config","status"],queryFn:async()=>{let e=await fetch("/api/opencode-config/status");if(!e.ok)throw Error("Failed to fetch config status");return e.json()}});return t?.hasPlugin?(0,m.jsx)("button",{type:"button",onClick:e,className:"inline-flex items-center justify-center w-9 h-9 rounded-lg text-gray-500 hover:text-gray-700 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-gray-200 dark:hover:bg-zinc-800 transition-colors duration-200","aria-label":"OpenCode Settings",title:"OpenCode Settings",children:(0,m.jsx)(eS,{className:"w-5 h-5"})}):null}let eE=ej("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),eR=ej("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),eA=ej("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),eT=ej("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),eO=ej("triangle-alert",[["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"}]]);var eL=e.i(14272),eF=g,eM=class extends eF.Subscribable{#e;#s=void 0;#z;#N;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#S()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,y.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#z,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,y.hashKey)(t.mutationKey)!==(0,y.hashKey)(this.options.mutationKey)?this.reset():this.#z?.state.status==="pending"&&this.#z.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#z?.removeObserver(this)}onMutationUpdate(e){this.#S(),this.#j(e)}getCurrentResult(){return this.#s}reset(){this.#z?.removeObserver(this),this.#z=void 0,this.#S(),this.#j()}mutate(e,t){return this.#N=t,this.#z?.removeObserver(this),this.#z=this.#e.getMutationCache().build(this.#e,this.options),this.#z.addObserver(this),this.#z.execute(e)}#S(){let e=this.#z?.state??(0,eL.getDefaultState)();this.#s={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#j(e){f.notifyManager.batch(()=>{if(this.#N&&this.hasListeners()){let t=this.#s.variables,r=this.#s.context,n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#N.onSuccess?.(e.data,t,r,n)}catch(e){Promise.reject(e)}try{this.#N.onSettled?.(e.data,null,t,r,n)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#N.onError?.(e.error,t,r,n)}catch(e){Promise.reject(e)}try{this.#N.onSettled?.(void 0,e.error,t,r,n)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#s)})})}};function eI(e,t){let r=(0,S.useQueryClient)(t),[n]=h.useState(()=>new eM(r,e));h.useEffect(()=>{n.setOptions(e)},[n,e]);let a=h.useSyncExternalStore(h.useCallback(e=>n.subscribe(f.notifyManager.batchCalls(e)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),s=h.useCallback((e,t)=>{n.mutate(e,t).catch(y.noop)},[n]);if(a.error&&(0,y.shouldThrowError)(n.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:s,mutateAsync:a.mutate}}let eD=ej("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),eP=ej("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),e_=ej("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),eV=ej("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),e$=ej("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),eU=ej("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]),eq=[{key:"visual-engineering",name:"Visual Engineering",description:"Visual and UI component engineering tasks"},{key:"ultrabrain",name:"Ultrabrain",description:"Complex reasoning and deep analysis tasks"},{key:"deep",name:"Deep",description:"Deep research and comprehensive tasks"},{key:"artistry",name:"Artistry",description:"Creative and design-focused tasks"},{key:"quick",name:"Quick",description:"Fast, simple tasks requiring minimal processing"},{key:"unspecified-low",name:"Unspecified Low",description:"Default low-complexity tasks"},{key:"unspecified-high",name:"Unspecified High",description:"Default high-complexity tasks"},{key:"writing",name:"Writing",description:"Content creation and writing tasks"}];function eB({categoryKey:e,config:t,isBuiltIn:r,availableModels:n,onEdit:a,onDelete:s}){var i;let o,l=(o=eq.find(t=>t.key===e))||{key:e,name:e,description:"Custom category"},d=!!(t.model||t.variant),c=t.model&&n&&n.size>0&&!n.has(t.model),u=d?"bg-white border-zinc-200 dark:bg-zinc-900 dark:border-zinc-700 hover:border-zinc-300 dark:hover:border-zinc-600":"bg-zinc-50/50 border-zinc-200/50 dark:bg-zinc-900/50 dark:border-zinc-800/50 hover:border-zinc-300 dark:hover:border-zinc-600";return c&&(u="bg-amber-50/50 border-amber-200 dark:bg-amber-900/10 dark:border-amber-800/50 hover:border-amber-300 dark:hover:border-amber-700"),(0,m.jsxs)("div",{className:`
2
- group relative flex items-center justify-between p-4 rounded-lg border flex-col sm:flex-row items-start sm:items-center gap-4
3
- transition-all duration-200
4
- ${u}
5
- `,children:[(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("h4",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate",children:l.name}),!r&&(0,m.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",children:"Custom"}),c&&(0,m.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:[(0,m.jsx)(eO,{className:"h-3 w-3"}),"Model Unavailable"]}),!c&&d&&(0,m.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300",children:"Configured"}),!d&&(0,m.jsxs)("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400",children:[(0,m.jsx)(eP,{className:"h-3 w-3"}),"Built-in fallback"]})]}),(0,m.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400 truncate",children:l.description}),(0,m.jsxs)("div",{className:"mt-2 flex items-center gap-3 text-xs",children:[(0,m.jsxs)("span",{className:"text-zinc-600 dark:text-zinc-400",children:[(0,m.jsx)("span",{className:"text-zinc-400 dark:text-zinc-500",children:"Provider:"})," ",function(e){if(!e)return"Default provider";let t=e.indexOf("/");return -1===t?"Unknown provider":e.substring(0,t)}(t.model)]}),(0,m.jsxs)("span",{className:"text-zinc-600 dark:text-zinc-400",children:[(0,m.jsx)("span",{className:"text-zinc-400 dark:text-zinc-500",children:"Model:"})," ",function(e){if(!e)return"Default model";let t=e.split("/");return t[t.length-1]}(t.model)]}),t.variant&&(0,m.jsxs)("span",{className:"text-zinc-600 dark:text-zinc-400",children:[(0,m.jsx)("span",{className:"text-zinc-400 dark:text-zinc-500",children:"Variant:"})," ",(i=t.variant)?i:"—"]})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1 ml-4 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,m.jsx)("button",{type:"button",onClick:()=>a(e,t),className:"p-1.5 rounded-md text-zinc-500 hover:text-zinc-900 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:text-zinc-100 dark:hover:bg-zinc-800 transition-colors","aria-label":`Edit ${l.name} category`,title:`Edit ${l.name}`,children:(0,m.jsx)(eV,{className:"h-4 w-4"})}),!r&&(0,m.jsx)("button",{type:"button",onClick:()=>s(e),className:"p-1.5 rounded-md text-zinc-500 hover:text-red-600 hover:bg-red-50 dark:text-zinc-400 dark:hover:text-red-400 dark:hover:bg-red-900/20 transition-colors","aria-label":`Delete ${l.name} category`,title:`Delete ${l.name}`,children:(0,m.jsx)(e$,{className:"h-4 w-4"})})]})]})}function eH({categories:e,onEdit:t,onDelete:r}){let{data:n}=A({queryKey:["opencode-models"],queryFn:async()=>{var e;let t=await fetch("/api/opencode-models"),r=null;try{r=await t.json()}catch{r=null}let n=r&&"object"==typeof r&&"error"in r&&"string"==typeof r.error?r.error:null;if(!t.ok||n)throw Error(n||`Failed to fetch models (${t.status})`);if(!((e=r)&&"object"==typeof e&&Array.isArray(e.models)))throw Error("Invalid models response");return r},retry:!1}),a=h.useMemo(()=>n?new Set(n.models):null,[n]),{builtIn:s,custom:i}=h.useMemo(()=>{let t=[],r=[];return eq.forEach(r=>{t.push({key:r.key,config:e[r.key]||{}})}),Object.entries(e).forEach(([e,t])=>{eq.some(t=>t.key===e)||r.push({key:e,config:t})}),{builtIn:t,custom:r}},[e]),o=i.length>0;return(0,m.jsxs)("div",{className:"space-y-6",children:[(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,m.jsx)(eU,{className:"h-4 w-4 text-zinc-500 dark:text-zinc-400"}),(0,m.jsx)("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:"Built-in Categories"}),(0,m.jsxs)("span",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:["(",s.length,")"]})]}),(0,m.jsx)("div",{className:"space-y-2",children:s.map(({key:e,config:n})=>(0,m.jsx)(eB,{categoryKey:e,config:n,isBuiltIn:!0,availableModels:a,onEdit:t,onDelete:r},e))})]}),o&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,m.jsx)(eU,{className:"h-4 w-4 text-blue-500"}),(0,m.jsx)("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100",children:"Custom Categories"}),(0,m.jsxs)("span",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:["(",i.length,")"]})]}),(0,m.jsx)("div",{className:"space-y-2",children:i.map(({key:e,config:n})=>(0,m.jsx)(eB,{categoryKey:e,config:n,isBuiltIn:!1,availableModels:a,onEdit:t,onDelete:r},e))})]}),0===s.length&&!o&&(0,m.jsxs)("div",{className:"text-center py-8",children:[(0,m.jsx)(eU,{className:"h-8 w-8 mx-auto text-zinc-300 dark:text-zinc-600 mb-2"}),(0,m.jsx)("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"No categories configured"})]})]})}var eW=e=>e instanceof Date,eK=e=>null==e,eQ=e=>!eK(e)&&!Array.isArray(e)&&"object"==typeof e&&!eW(e),eJ=e=>eQ(e)&&e.target?"checkbox"===e.target.type?e.target.checked:e.target.value:e,eG=(e,t)=>e.has(t.substring(0,t.search(/\.\d+(\.|$)/))||t),eY="u">typeof window&&void 0!==window.HTMLElement&&"u">typeof document;function eX(e){let t;if(e instanceof Date)return new Date(e);let r="u">typeof FileList&&e instanceof FileList;if(eY&&(e instanceof Blob||r))return e;let n=Array.isArray(e);if(!n&&!(eQ(e)&&eQ(t=e.constructor&&e.constructor.prototype)&&t.hasOwnProperty("isPrototypeOf")))return e;let a=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=eX(e[t]));return a}var eZ=e=>void 0===e,e0=e=>Array.isArray(e)?e.filter(Boolean):[],e1=e=>e0(e.replace(/["|']|\]/g,"").split(/\.|\[/)),e2=(e,t,r)=>{if(!t||!eQ(e))return r;let n=(/^\w*$/.test(t)?[t]:e1(t)).reduce((e,t)=>eK(e)?e:e[t],e);return eZ(n)||n===e?eZ(e[t])?r:e[t]:n},e5=e=>"function"==typeof e,e4=(e,t,r)=>{let n=-1,a=/^\w*$/.test(t)?[t]:e1(t),s=a.length,i=s-1;for(;++n<s;){let t=a[n],s=r;if(n!==i){let r=e[t];s=eQ(r)||Array.isArray(r)?r:isNaN(+a[n+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=s,e=e[t]}};let e3="blur",e9="onChange",e6="onSubmit",e8="maxLength",e7="minLength",te="pattern",tt="required",tr=h.default.createContext(null);tr.displayName="HookFormControlContext";var tn=(e,t,r,n=!0)=>{let a={defaultValues:t._defaultValues};for(let s in e)Object.defineProperty(a,s,{get:()=>("all"!==t._proxyFormState[s]&&(t._proxyFormState[s]=!n||"all"),r&&(r[s]=!0),e[s])});return a};let ta="u">typeof window?h.default.useLayoutEffect:h.default.useEffect;var ts=e=>"string"==typeof e,ti=(e,t,r,n,a)=>ts(e)?(n&&t.watch.add(e),e2(r,e,a)):Array.isArray(e)?e.map(e=>(n&&t.watch.add(e),e2(r,e))):(n&&(t.watchAll=!0),r),to=e=>eK(e)||"object"!=typeof e;function tl(e,t,r=new WeakSet){if(to(e)||to(t))return Object.is(e,t);if(eW(e)&&eW(t))return Object.is(e.getTime(),t.getTime());let n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;if(r.has(e)||r.has(t))return!0;for(let s of(r.add(e),r.add(t),n)){let n=e[s];if(!a.includes(s))return!1;if("ref"!==s){let e=t[s];if(eW(n)&&eW(e)||eQ(n)&&eQ(e)||Array.isArray(n)&&Array.isArray(e)?!tl(n,e,r):!Object.is(n,e))return!1}}return!0}let td=e=>e.render(function(e){let t=h.default.useContext(tr),{name:r,disabled:n,control:a=t,shouldUnregister:s,defaultValue:i,exact:o=!0}=e,l=eG(a._names.array,r),d=h.default.useMemo(()=>e2(a._formValues,r,e2(a._defaultValues,r,i)),[a,r,i]),c=function(e){let t=h.default.useContext(tr),{control:r=t,name:n,defaultValue:a,disabled:s,exact:i,compute:o}=e||{},l=h.default.useRef(a),d=h.default.useRef(o),c=h.default.useRef(void 0),u=h.default.useRef(r),m=h.default.useRef(n);d.current=o;let[p,f]=h.default.useState(()=>{let e=r._getWatch(n,l.current);return d.current?d.current(e):e}),x=h.default.useCallback(e=>{let t=ti(n,r._names,e||r._formValues,!1,l.current);return d.current?d.current(t):t},[r._formValues,r._names,n]),g=h.default.useCallback(e=>{if(!s){let t=ti(n,r._names,e||r._formValues,!1,l.current);if(d.current){let e=d.current(t);tl(e,c.current)||(f(e),c.current=e)}else f(t)}},[r._formValues,r._names,s,n]);ta(()=>(u.current===r&&tl(m.current,n)||(u.current=r,m.current=n,g()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:e=>{g(e.values)}})),[r,i,n,g]),h.default.useEffect(()=>r._removeUnmounted());let b=u.current!==r,y=m.current,v=h.default.useMemo(()=>{if(s)return null;let e=!b&&!tl(y,n);return b||e?x():null},[s,b,n,y,x]);return null!==v?v:p}({control:a,name:r,defaultValue:d,exact:o}),u=function(e){let t=h.default.useContext(tr),{control:r=t,disabled:n,name:a,exact:s}=e||{},[i,o]=h.default.useState(r._formState),l=h.default.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ta(()=>r._subscribe({name:a,formState:l.current,exact:s,callback:e=>{n||o({...r._formState,...e})}}),[a,n,s]),h.default.useEffect(()=>{l.current.isValid&&r._setValid(!0)},[r]),h.default.useMemo(()=>tn(i,r,l.current,!1),[i,r])}({control:a,name:r,exact:o}),m=h.default.useRef(e),p=h.default.useRef(void 0),f=h.default.useRef(a.register(r,{...e.rules,value:c,..."boolean"==typeof e.disabled?{disabled:e.disabled}:{}}));m.current=e;let x=h.default.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!e2(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!e2(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!e2(u.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!e2(u.validatingFields,r)},error:{enumerable:!0,get:()=>e2(u.errors,r)}}),[u,r]),g=h.default.useCallback(e=>f.current.onChange({target:{value:eJ(e),name:r},type:"change"}),[r]),b=h.default.useCallback(()=>f.current.onBlur({target:{value:e2(a._formValues,r),name:r},type:e3}),[r,a._formValues]),y=h.default.useCallback(e=>{let t=e2(a._fields,r);t&&t._f&&e&&(t._f.ref={focus:()=>e5(e.focus)&&e.focus(),select:()=>e5(e.select)&&e.select(),setCustomValidity:t=>e5(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>e5(e.reportValidity)&&e.reportValidity()})},[a._fields,r]),v=h.default.useMemo(()=>({name:r,value:c,..."boolean"==typeof n||u.disabled?{disabled:u.disabled||n}:{},onChange:g,onBlur:b,ref:y}),[r,n,u.disabled,g,b,y,c]);return h.default.useEffect(()=>{let e=a._options.shouldUnregister||s,t=p.current;t&&t!==r&&!l&&a.unregister(t),a.register(r,{...m.current.rules,..."boolean"==typeof m.current.disabled?{disabled:m.current.disabled}:{}});let n=(e,t)=>{let r=e2(a._fields,e);r&&r._f&&(r._f.mount=t)};if(n(r,!0),e){let e=eX(e2(a._options.defaultValues,r,m.current.defaultValue));e4(a._defaultValues,r,e),eZ(e2(a._formValues,r))&&e4(a._formValues,r,e)}return l||a.register(r),p.current=r,()=>{(l?e&&!a._state.action:e)?a.unregister(r):n(r,!1)}},[r,a,l,s]),h.default.useEffect(()=>{a._setDisabledField({disabled:n,name:r})},[n,r,a]),h.default.useMemo(()=>({field:v,formState:u,fieldState:x}),[v,u,x])}(e));h.default.createContext(null).displayName="HookFormContext";var tc=(e,t,r,n,a)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:a||!0}}:{},tu=e=>Array.isArray(e)?e:[e],tm=()=>{let e=[];return{get observers(){return e},next:t=>{for(let r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},th=e=>eQ(e)&&!Object.keys(e).length,tp=e=>{if(!eY)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},tf=e=>tp(e)&&e.isConnected;function tx(e,t){let r=Array.isArray(t)?t:/^\w*$/.test(t)?[t]:e1(t),n=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,n=0;for(;n<r;)e=eZ(e)?n++:e[t[n++]];return e}(e,r),a=r.length-1,s=r[a];return n&&delete n[s],0!==a&&(eQ(n)&&th(n)||Array.isArray(n)&&function(e){for(let t in e)if(e.hasOwnProperty(t)&&!eZ(e[t]))return!1;return!0}(n))&&tx(e,r.slice(0,-1)),e}function tg(e){return Array.isArray(e)||eQ(e)&&!(e=>{for(let t in e)if(e5(e[t]))return!0;return!1})(e)}function tb(e,t={}){for(let r in e){let n=e[r];tg(n)?(t[r]=Array.isArray(n)?[]:{},tb(n,t[r])):eZ(n)||(t[r]=!0)}return t}function ty(e,t,r){for(let n in r||(r=tb(t)),e){let a=e[n];if(tg(a))eZ(t)||to(r[n])?r[n]=tb(a,Array.isArray(a)?[]:{}):ty(a,eK(t)?{}:t[n],r[n]);else{let e=t[n];r[n]=!tl(a,e)}}return r}let tv={value:!1,isValid:!1},tk={value:!0,isValid:!0};var tw=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!eZ(e[0].attributes.value)?eZ(e[0].value)||""===e[0].value?tk:{value:e[0].value,isValid:!0}:tk:tv}return tv},tj=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>eZ(e)?e:t?""===e?NaN:e?+e:e:r&&ts(e)?new Date(e):n?n(e):e;let tz={isValid:!1,value:null};var tN=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,tz):tz;function tS(e){let t=e.ref;return"file"===t.type?t.files:"radio"===t.type?tN(e.refs).value:"select-multiple"===t.type?[...t.selectedOptions].map(({value:e})=>e):"checkbox"===t.type?tw(e.refs).value:tj(eZ(t.value)?e.ref.value:t.value,e)}var tC=e=>eZ(e)?e:e instanceof RegExp?e.source:eQ(e)?e.value instanceof RegExp?e.value.source:e.value:e,tE=e=>({isOnSubmit:!e||e===e6,isOnBlur:"onBlur"===e,isOnChange:e===e9,isOnAll:"all"===e,isOnTouch:"onTouched"===e});let tR="AsyncFunction";var tA=e=>!!e&&!!e.validate&&!!(e5(e.validate)&&e.validate.constructor.name===tR||eQ(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===tR)),tT=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));let tO=(e,t,r,n)=>{for(let a of r||Object.keys(e)){let r=e2(e,a);if(r){let{_f:e,...s}=r;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],a)&&!n)return!0;else if(e.ref&&t(e.ref,e.name)&&!n)return!0;else if(tO(s,t))break}else if(eQ(s)&&tO(s,t))break}}};function tL(e,t,r){let n=e2(e,r);if(n||/^\w*$/.test(r))return{error:n,name:r};let a=r.split(".");for(;a.length;){let n=a.join("."),s=e2(t,n),i=e2(e,n);if(s&&!Array.isArray(s)&&r!==n)break;if(i&&i.type)return{name:n,error:i};if(i&&i.root&&i.root.type)return{name:`${n}.root`,error:i.root};a.pop()}return{name:r}}var tF=(e,t,r)=>{let n=tu(e2(e,r));return e4(n,"root",t[r]),e4(e,r,n),e};function tM(e,t,r="validate"){if(ts(e)||Array.isArray(e)&&e.every(ts)||"boolean"==typeof e&&!e)return{type:r,message:ts(e)?e:"",ref:t}}var tI=e=>!eQ(e)||e instanceof RegExp?{value:e,message:""}:e,tD=async(e,t,r,n,a,s)=>{let{ref:i,refs:o,required:l,maxLength:d,minLength:c,min:u,max:m,pattern:h,validate:p,name:f,valueAsNumber:x,mount:g}=e._f,b=e2(r,f);if(!g||t.has(f))return{};let y=o?o[0]:i,v=e=>{a&&y.reportValidity&&(y.setCustomValidity("boolean"==typeof e?"":e||""),y.reportValidity())},k={},w="radio"===i.type,j="checkbox"===i.type,z=(x||"file"===i.type)&&eZ(i.value)&&eZ(b)||tp(i)&&""===i.value||""===b||Array.isArray(b)&&!b.length,N=tc.bind(null,f,n,k),S=(e,t,r,n=e8,a=e7)=>{let s=e?t:r;k[f]={type:e?n:a,message:s,ref:i,...N(e?n:a,s)}};if(s?!Array.isArray(b)||!b.length:l&&(!(w||j)&&(z||eK(b))||"boolean"==typeof b&&!b||j&&!tw(o).isValid||w&&!tN(o).isValid)){let{value:e,message:t}=ts(l)?{value:!!l,message:l}:tI(l);if(e&&(k[f]={type:tt,message:t,ref:y,...N(tt,t)},!n))return v(t),k}if(!z&&(!eK(u)||!eK(m))){let e,t,r=tI(m),a=tI(u);if(eK(b)||isNaN(b)){let n=i.valueAsDate||new Date(b),s=e=>new Date(new Date().toDateString()+" "+e),o="time"==i.type,l="week"==i.type;ts(r.value)&&b&&(e=o?s(b)>s(r.value):l?b>r.value:n>new Date(r.value)),ts(a.value)&&b&&(t=o?s(b)<s(a.value):l?b<a.value:n<new Date(a.value))}else{let n=i.valueAsNumber||(b?+b:b);eK(r.value)||(e=n>r.value),eK(a.value)||(t=n<a.value)}if((e||t)&&(S(!!e,r.message,a.message,"max","min"),!n))return v(k[f].message),k}if((d||c)&&!z&&(ts(b)||s&&Array.isArray(b))){let e=tI(d),t=tI(c),r=!eK(e.value)&&b.length>+e.value,a=!eK(t.value)&&b.length<+t.value;if((r||a)&&(S(r,e.message,t.message),!n))return v(k[f].message),k}if(h&&!z&&ts(b)){let{value:e,message:t}=tI(h);if(e instanceof RegExp&&!b.match(e)&&(k[f]={type:te,message:t,ref:i,...N(te,t)},!n))return v(t),k}if(p){if(e5(p)){let e=tM(await p(b,r),y);if(e&&(k[f]={...e,...N("validate",e.message)},!n))return v(e.message),k}else if(eQ(p)){let e={};for(let t in p){if(!th(e)&&!n)break;let a=tM(await p[t](b,r),y,t);a&&(e={...a,...N(t,a.message)},v(a.message),n&&(k[f]=e))}if(!th(e)&&(k[f]={ref:y,...e},!n))return k}}return v(!0),k};let tP={mode:e6,reValidateMode:e9,shouldFocusError:!0};function t_(e={}){let t=h.default.useRef(void 0),r=h.default.useRef(void 0),[n,a]=h.default.useState({isDirty:!1,isValidating:!1,isLoading:e5(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:e5(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!e5(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:r,...a}=function(e={}){let t,r={...tP,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:e5(r.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1},a={},s=(eQ(r.defaultValues)||eQ(r.values))&&eX(r.defaultValues||r.values)||{},i=r.shouldUnregister?{}:eX(s),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d=0,c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...c},m={...u},h={array:tm(),state:tm()},p="all"===r.criteriaMode,f=async e=>{if(!o.keepIsValid&&!r.disabled&&(u.isValid||m.isValid||e)){let e;r.resolver?(e=th((await y()).errors),x()):e=await k(a,!0),e!==n.isValid&&h.state.next({isValid:e})}},x=(e,t)=>{!r.disabled&&(u.isValidating||u.validatingFields||m.isValidating||m.validatingFields)&&((e||Array.from(l.mount)).forEach(e=>{e&&(t?e4(n.validatingFields,e,t):tx(n.validatingFields,e))}),h.state.next({validatingFields:n.validatingFields,isValidating:!th(n.validatingFields)}))},g=(e,t,r,n)=>{let l=e2(a,e);if(l){let a=e2(i,e,eZ(r)?e2(s,e):r);eZ(a)||n&&n.defaultChecked||t?e4(i,e,t?a:tS(l._f)):z(e,a),o.mount&&!o.action&&f()}},b=(e,t,a,i,o)=>{let l=!1,d=!1,c={name:e};if(!r.disabled){if(!a||i){(u.isDirty||m.isDirty)&&(d=n.isDirty,n.isDirty=c.isDirty=w(),l=d!==c.isDirty);let r=tl(e2(s,e),t);d=!!e2(n.dirtyFields,e),r?tx(n.dirtyFields,e):e4(n.dirtyFields,e,!0),c.dirtyFields=n.dirtyFields,l=l||(u.dirtyFields||m.dirtyFields)&&!r!==d}if(a){let t=e2(n.touchedFields,e);t||(e4(n.touchedFields,e,a),c.touchedFields=n.touchedFields,l=l||(u.touchedFields||m.touchedFields)&&t!==a)}l&&o&&h.state.next(c)}return l?c:{}},y=async e=>(x(e,!0),await r.resolver(i,r.context,((e,t,r,n)=>{let a={};for(let r of e){let e=e2(t,r);e&&e4(a,r,e._f)}return{criteriaMode:r,names:[...e],fields:a,shouldUseNativeValidation:n}})(e||l.mount,a,r.criteriaMode,r.shouldUseNativeValidation))),v=async e=>{let{errors:t}=await y(e);if(x(e),e)for(let r of e){let e=e2(t,r);e?e4(n.errors,r,e):tx(n.errors,r)}else n.errors=t;return t},k=async(t,a,s={valid:!0})=>{for(let o in t){let d=t[o];if(d){let{_f:t,...o}=d;if(t){let o=l.array.has(t.name),c=d._f&&tA(d._f);c&&u.validatingFields&&x([t.name],!0);let m=await tD(d,l.disabled,i,p,r.shouldUseNativeValidation&&!a,o);if(c&&u.validatingFields&&x([t.name]),m[t.name]&&(s.valid=!1,a||e.shouldUseNativeValidation))break;a||(e2(m,t.name)?o?tF(n.errors,m,t.name):e4(n.errors,t.name,m[t.name]):tx(n.errors,t.name))}th(o)||await k(o,a,s)}}return s.valid},w=(e,t)=>!r.disabled&&(e&&t&&e4(i,e,t),!tl(A(),s)),j=(e,t,r)=>ti(e,l,{...o.mount?i:eZ(t)?s:ts(e)?{[e]:t}:t},r,t),z=(e,t,r={})=>{let n=e2(a,e),s=t;if(n){let r=n._f;r&&(r.disabled||e4(i,e,tj(t,r)),s=tp(r.ref)&&eK(t)?"":t,"select-multiple"===r.ref.type?[...r.ref.options].forEach(e=>e.selected=s.includes(e.value)):r.refs?"checkbox"===r.ref.type?r.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(s)?e.checked=!!s.find(t=>t===e.value):e.checked=s===e.value||!!s)}):r.refs.forEach(e=>e.checked=e.value===s):"file"===r.ref.type?r.ref.value="":(r.ref.value=s,r.ref.type||h.state.next({name:e,values:eX(i)})))}(r.shouldDirty||r.shouldTouch)&&b(e,s,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&R(e)},N=(e,t,r)=>{for(let n in t){if(!t.hasOwnProperty(n))return;let s=t[n],i=e+"."+n,o=e2(a,i);(l.array.has(e)||eQ(s)||o&&!o._f)&&!eW(s)?N(i,s,r):z(i,s,r)}},S=(e,t,r={})=>{let d=e2(a,e),c=l.array.has(e),p=eX(t);e4(i,e,p),c?(h.array.next({name:e,values:eX(i)}),(u.isDirty||u.dirtyFields||m.isDirty||m.dirtyFields)&&r.shouldDirty&&h.state.next({name:e,dirtyFields:ty(s,i),isDirty:w(e,p)})):!d||d._f||eK(p)?z(e,p,r):N(e,p,r),tT(e,l)?h.state.next({...n,name:e,values:eX(i)}):h.state.next({name:o.mount?e:void 0,values:eX(i)})},C=async e=>{o.mount=!0;let s=e.target,c=s.name,g=!0,v=e2(a,c),w=e=>{g=Number.isNaN(e)||eW(e)&&isNaN(e.getTime())||tl(e,e2(i,c,e))},j=tE(r.mode),z=tE(r.reValidateMode);if(v){var N,S,C,E,A;let o,F,M,I=s.type?tS(v._f):eJ(e),D=e.type===e3||"focusout"===e.type,P=!((M=v._f).mount&&(M.required||M.min||M.max||M.maxLength||M.minLength||M.pattern||M.validate))&&!r.resolver&&!e2(n.errors,c)&&!v._f.deps||(N=D,S=e2(n.touchedFields,c),C=n.isSubmitted,E=z,!(A=j).isOnAll&&(!C&&A.isOnTouch?!(S||N):(C?E.isOnBlur:A.isOnBlur)?!N:(C?!E.isOnChange:!A.isOnChange)||N)),_=tT(c,l,D);e4(i,c,I),D?s&&s.readOnly||(v._f.onBlur&&v._f.onBlur(e),t&&t(0)):v._f.onChange&&v._f.onChange(e);let V=b(c,I,D),$=!th(V)||_;if(D||h.state.next({name:c,type:e.type,values:eX(i)}),P)return(u.isValid||m.isValid)&&("onBlur"===r.mode?D&&f():D||f()),$&&h.state.next({name:c,..._?{}:V});if(!D&&_&&h.state.next({...n}),r.resolver){let{errors:e}=await y([c]);if(x([c]),w(I),g){let t=tL(n.errors,a,c),r=tL(e,a,t.name||c);o=r.error,c=r.name,F=th(e)}}else x([c],!0),o=(await tD(v,l.disabled,i,p,r.shouldUseNativeValidation))[c],x([c]),w(I),g&&(o?F=!1:(u.isValid||m.isValid)&&(F=await k(a,!0)));if(g){v._f.deps&&(!Array.isArray(v._f.deps)||v._f.deps.length>0)&&R(v._f.deps);var T=c,O=F,L=o;let e=e2(n.errors,T),a=(u.isValid||m.isValid)&&"boolean"==typeof O&&n.isValid!==O;if(r.delayError&&L){let e;e=()=>{e4(n.errors,T,L),h.state.next({errors:n.errors})},(t=t=>{clearTimeout(d),d=setTimeout(e,t)})(r.delayError)}else clearTimeout(d),t=null,L?e4(n.errors,T,L):tx(n.errors,T);if((L?!tl(e,L):e)||!th(V)||a){let e={...V,...a&&"boolean"==typeof O?{isValid:O}:{},errors:n.errors,name:T};n={...n,...e},h.state.next(e)}}}},E=(e,t)=>{if(e2(n.errors,t)&&e.focus)return e.focus(),1},R=async(e,t={})=>{let s,i,o=tu(e);if(r.resolver){let t=await v(eZ(e)?e:o);s=th(t),i=e?!o.some(e=>e2(t,e)):s}else e?((i=(await Promise.all(o.map(async e=>{let t=e2(a,e);return await k(t&&t._f?{[e]:t}:t)}))).every(Boolean))||n.isValid)&&f():i=s=await k(a);return h.state.next({...!ts(e)||(u.isValid||m.isValid)&&s!==n.isValid?{}:{name:e},...r.resolver||!e?{isValid:s}:{},errors:n.errors}),t.shouldFocus&&!i&&tO(a,E,e?o:l.mount),i},A=(e,t)=>{let r={...o.mount?i:s};return t&&(r=function e(t,r){let n={};for(let a in t)if(t.hasOwnProperty(a)){let s=t[a],i=r[a];if(s&&eQ(s)&&i){let t=e(s,i);eQ(t)&&(n[a]=t)}else t[a]&&(n[a]=i)}return n}(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),eZ(e)?r:ts(e)?e2(r,e):e.map(e=>e2(r,e))},T=(e,t)=>({invalid:!!e2((t||n).errors,e),isDirty:!!e2((t||n).dirtyFields,e),error:e2((t||n).errors,e),isValidating:!!e2(n.validatingFields,e),isTouched:!!e2((t||n).touchedFields,e)}),O=(e,t,r)=>{let s=(e2(a,e,{_f:{}})._f||{}).ref,{ref:i,message:o,type:l,...d}=e2(n.errors,e)||{};e4(n.errors,e,{...d,...t,ref:s}),h.state.next({name:e,errors:n.errors,isValid:!1}),r&&r.shouldFocus&&s&&s.focus&&s.focus()},L=e=>h.state.subscribe({next:t=>{let r,a,o;r=e.name,a=t.name,o=e.exact,(!r||!a||r===a||tu(r).some(e=>e&&(o?e===a:e.startsWith(a)||a.startsWith(e))))&&((e,t,r,n)=>{r(e);let{name:a,...s}=e;return th(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(e=>t[e]===(!n||"all"))})(t,e.formState||u,$,e.reRenderRoot)&&e.callback({values:{...i},...n,...t,defaultValues:s})}}).unsubscribe,F=(e,t={})=>{for(let o of e?tu(e):l.mount)l.mount.delete(o),l.array.delete(o),t.keepValue||(tx(a,o),tx(i,o)),t.keepError||tx(n.errors,o),t.keepDirty||tx(n.dirtyFields,o),t.keepTouched||tx(n.touchedFields,o),t.keepIsValidating||tx(n.validatingFields,o),r.shouldUnregister||t.keepDefaultValue||tx(s,o);h.state.next({values:eX(i)}),h.state.next({...n,...!t.keepDirty?{}:{isDirty:w()}}),t.keepIsValid||f()},M=({disabled:e,name:t})=>{if("boolean"==typeof e&&o.mount||e||l.disabled.has(t)){let r=l.disabled.has(t);e?l.disabled.add(t):l.disabled.delete(t),!!e!==r&&o.mount&&!o.action&&f()}},I=(e,t={})=>{let n=e2(a,e),i="boolean"==typeof t.disabled||"boolean"==typeof r.disabled;return(e4(a,e,{...n||{},_f:{...n&&n._f?n._f:{ref:{name:e}},name:e,mount:!0,...t}}),l.mount.add(e),n)?M({disabled:"boolean"==typeof t.disabled?t.disabled:r.disabled,name:e}):g(e,!0,t.value),{...i?{disabled:t.disabled||r.disabled}:{},...r.progressive?{required:!!t.required,min:tC(t.min),max:tC(t.max),minLength:tC(t.minLength),maxLength:tC(t.maxLength),pattern:tC(t.pattern)}:{},name:e,onChange:C,onBlur:C,ref:i=>{if(i){let r;I(e,t),n=e2(a,e);let o=eZ(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,l="radio"===(r=o).type||"checkbox"===r.type,d=n._f.refs||[];(l?d.find(e=>e===o):o===n._f.ref)||(e4(a,e,{_f:{...n._f,...l?{refs:[...d.filter(tf),o,...Array.isArray(e2(s,e))?[{}]:[]],ref:{type:o.type,name:e}}:{ref:o}}}),g(e,!1,void 0,o))}else(n=e2(a,e,{}))._f&&(n._f.mount=!1),(r.shouldUnregister||t.shouldUnregister)&&!(eG(l.array,e)&&o.action)&&l.unMount.add(e)}}},D=()=>r.shouldFocusError&&tO(a,E,l.mount),P=(e,t)=>async s=>{let o;s&&(s.preventDefault&&s.preventDefault(),s.persist&&s.persist());let d=eX(i);if(h.state.next({isSubmitting:!0}),r.resolver){let{errors:e,values:t}=await y();x(),n.errors=e,d=eX(t)}else await k(a);if(l.disabled.size)for(let e of l.disabled)tx(d,e);if(tx(n.errors,"root"),th(n.errors)){h.state.next({errors:{}});try{await e(d,s)}catch(e){o=e}}else t&&await t({...n.errors},s),D(),setTimeout(D);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:th(n.errors)&&!o,submitCount:n.submitCount+1,errors:n.errors}),o)throw o},_=(e,t={})=>{let d=e?eX(e):s,c=eX(d),m=th(e),p=m?s:c;if(t.keepDefaultValues||(s=d),!t.keepValues){if(t.keepDirtyValues)for(let e of Array.from(new Set([...l.mount,...Object.keys(ty(s,i))]))){let t=e2(n.dirtyFields,e),r=e2(i,e),a=e2(p,e);t&&!eZ(r)?e4(p,e,r):t||eZ(a)||S(e,a)}else{if(eY&&eZ(e))for(let e of l.mount){let t=e2(a,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(tp(e)){let t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(let e of l.mount)S(e,e2(p,e));else a={}}i=r.shouldUnregister?t.keepDefaultValues?eX(s):{}:eX(p),h.array.next({values:{...p}}),h.state.next({values:{...p}})}l={mount:t.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!u.isValid||!!t.keepIsValid||!!t.keepDirtyValues||!r.shouldUnregister&&!th(p),o.watch=!!r.shouldUnregister,o.keepIsValid=!!t.keepIsValid,o.action=!1,t.keepErrors||(n.errors={}),h.state.next({submitCount:t.keepSubmitCount?n.submitCount:0,isDirty:!m&&(t.keepDirty?n.isDirty:!!(t.keepDefaultValues&&!tl(e,s))),isSubmitted:!!t.keepIsSubmitted&&n.isSubmitted,dirtyFields:m?{}:t.keepDirtyValues?t.keepDefaultValues&&i?ty(s,i):n.dirtyFields:t.keepDefaultValues&&e?ty(s,e):t.keepDirty?n.dirtyFields:{},touchedFields:t.keepTouched?n.touchedFields:{},errors:t.keepErrors?n.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&n.isSubmitSuccessful,isSubmitting:!1,defaultValues:s})},V=(e,t)=>_(e5(e)?e(i):e,{...r.resetOptions,...t}),$=e=>{n={...n,...e}},U={control:{register:I,unregister:F,getFieldState:T,handleSubmit:P,setError:O,_subscribe:L,_runSchema:y,_updateIsValidating:x,_focusError:D,_getWatch:j,_getDirty:w,_setValid:f,_setFieldArray:(e,t=[],l,d,c=!0,p=!0)=>{if(d&&l&&!r.disabled){if(o.action=!0,p&&Array.isArray(e2(a,e))){let t=l(e2(a,e),d.argA,d.argB);c&&e4(a,e,t)}if(p&&Array.isArray(e2(n.errors,e))){let t,r=l(e2(n.errors,e),d.argA,d.argB);c&&e4(n.errors,e,r),e0(e2(t=n.errors,e)).length||tx(t,e)}if((u.touchedFields||m.touchedFields)&&p&&Array.isArray(e2(n.touchedFields,e))){let t=l(e2(n.touchedFields,e),d.argA,d.argB);c&&e4(n.touchedFields,e,t)}(u.dirtyFields||m.dirtyFields)&&(n.dirtyFields=ty(s,i)),h.state.next({name:e,isDirty:w(e,t),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else e4(i,e,t)},_setDisabledField:M,_setErrors:e=>{n.errors=e,h.state.next({errors:n.errors,isValid:!1})},_getFieldArray:e=>e0(e2(o.mount?i:s,e,r.shouldUnregister?e2(s,e,[]):[])),_reset:_,_resetDefaultValues:()=>e5(r.defaultValues)&&r.defaultValues().then(e=>{V(e,r.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(let e of l.unMount){let t=e2(a,e);t&&(t._f.refs?t._f.refs.every(e=>!tf(e)):!tf(t._f.ref))&&F(e)}l.unMount=new Set},_disableForm:e=>{"boolean"==typeof e&&(h.state.next({disabled:e}),tO(a,(t,r)=>{let n=e2(a,r);n&&(t.disabled=n._f.disabled||e,Array.isArray(n._f.refs)&&n._f.refs.forEach(t=>{t.disabled=n._f.disabled||e}))},0,!1))},_subjects:h,_proxyFormState:u,get _fields(){return a},get _formValues(){return i},get _state(){return o},set _state(value){o=value},get _defaultValues(){return s},get _names(){return l},set _names(value){l=value},get _formState(){return n},get _options(){return r},set _options(value){r={...r,...value}}},subscribe:e=>(o.mount=!0,m={...m,...e.formState},L({...e,formState:{...c,...e.formState}})),trigger:R,register:I,handleSubmit:P,watch:(e,t)=>e5(e)?h.state.subscribe({next:r=>"values"in r&&e(j(void 0,t),r)}):j(e,t,!0),setValue:S,getValues:A,reset:V,resetField:(e,t={})=>{e2(a,e)&&(eZ(t.defaultValue)?S(e,eX(e2(s,e))):(S(e,t.defaultValue),e4(s,e,eX(t.defaultValue))),t.keepTouched||tx(n.touchedFields,e),t.keepDirty||(tx(n.dirtyFields,e),n.isDirty=t.defaultValue?w(e,eX(e2(s,e))):w()),!t.keepError&&(tx(n.errors,e),u.isValid&&f()),h.state.next({...n}))},clearErrors:e=>{let t=e?tu(e):void 0;null==t||t.forEach(e=>tx(n.errors,e)),t?t.forEach(e=>{h.state.next({name:e,errors:n.errors})}):h.state.next({errors:{}})},unregister:F,setError:O,setFocus:(e,t={})=>{let r=e2(a,e),n=r&&r._f;if(n){let e=n.refs?n.refs[0]:n.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&e5(e.select)&&e.select()})}},getFieldState:T};return{...U,formControl:U}}(e);t.current={...a,formState:n}}let s=t.current.control;return s._options=e,ta(()=>{let e=s._subscribe({formState:s._proxyFormState,callback:()=>a({...s._formState}),reRenderRoot:!0});return a(e=>({...e,isReady:!0})),s._formState.isReady=!0,e},[s]),h.default.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),h.default.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),h.default.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),h.default.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),h.default.useEffect(()=>{if(s._proxyFormState.isDirty){let e=s._getDirty();e!==n.isDirty&&s._subjects.state.next({isDirty:e})}},[s,n.isDirty]),h.default.useEffect(()=>{var t;e.values&&!tl(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),(null==(t=s._options.resetOptions)?void 0:t.keepIsValid)||s._setValid(),r.current=e.values,a(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),h.default.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=h.default.useMemo(()=>tn(n,s),[s,n]),t.current}var tV=e.i(74080);function t$(e,[t,r]){return Math.min(r,Math.max(t,e))}function tU(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function tq(e,t=[]){let r=[],n=()=>{let t=r.map(e=>h.createContext(e));return function(r){let n=r?.[e]||t;return h.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let a=h.createContext(n),s=r.length;r=[...r,n];let i=t=>{let{scope:r,children:n,...i}=t,o=r?.[e]?.[s]||a,l=h.useMemo(()=>i,Object.values(i));return(0,m.jsx)(o.Provider,{value:l,children:n})};return i.displayName=t+"Provider",[i,function(r,i){let o=i?.[e]?.[s]||a,l=h.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let a=r(e)[`__scope${n}`];return{...t,...a}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}function tB(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function tH(...e){return t=>{let r=!1,n=e.map(e=>{let n=tB(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():tB(e[t],null)}}}}function tW(...e){return h.useCallback(tH(...e),e)}function tK(e){var t;let r,n=(t=e,(r=h.forwardRef((e,t)=>{let{children:r,...n}=e;if(h.isValidElement(r)){var a;let e,s,i=(a=r,(s=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(s=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),o=function(e,t){let r={...t};for(let n in t){let a=e[n],s=t[n];/^on[A-Z]/.test(n)?a&&s?r[n]=(...e)=>{let t=s(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...s}:"className"===n&&(r[n]=[a,s].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==h.Fragment&&(o.ref=t?tH(t,i):i),h.cloneElement(r,o)}return h.Children.count(r)>1?h.Children.only(null):null})).displayName=`${t}.SlotClone`,r),a=h.forwardRef((e,t)=>{let{children:r,...a}=e,s=h.Children.toArray(r),i=s.find(tJ);if(i){let e=i.props.children,r=s.map(t=>t!==i?t:h.Children.count(e)>1?h.Children.only(null):h.isValidElement(e)?e.props.children:null);return(0,m.jsx)(n,{...a,ref:t,children:h.isValidElement(e)?h.cloneElement(e,void 0,r):null})}return(0,m.jsx)(n,{...a,ref:t,children:r})});return a.displayName=`${e}.Slot`,a}"u">typeof window&&window.document&&window.document.createElement;var tQ=Symbol("radix.slottable");function tJ(e){return h.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===tQ}var tG=new WeakMap;function tY(e,t){var r,n;let a,s,i;if("at"in Array.prototype)return Array.prototype.at.call(e,t);let o=(r=e,n=t,a=r.length,(i=(s=tX(n))>=0?s:a+s)<0||i>=a?-1:i);return -1===o?void 0:e[o]}function tX(e){return e!=e||0===e?0:Math.trunc(e)}(class e extends Map{#C;constructor(e){super(e),this.#C=[...super.keys()],tG.set(this,!0)}set(e,t){return tG.get(this)&&(this.has(e)?this.#C[this.#C.indexOf(e)]=e:this.#C.push(e)),super.set(e,t),this}insert(e,t,r){let n,a=this.has(t),s=this.#C.length,i=tX(e),o=i>=0?i:s+i,l=o<0||o>=s?-1:o;if(l===this.size||a&&l===this.size-1||-1===l)return this.set(t,r),this;let d=this.size+ +!a;i<0&&o++;let c=[...this.#C],u=!1;for(let e=o;e<d;e++)if(o===e){let s=c[e];c[e]===t&&(s=c[e+1]),a&&this.delete(t),n=this.get(s),this.set(t,r)}else{u||c[e-1]!==t||(u=!0);let r=c[u?e:e-1],a=n;n=this.get(r),this.delete(r),this.set(r,a)}return this}with(t,r,n){let a=new e(this);return a.insert(t,r,n),a}before(e){let t=this.#C.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,r){let n=this.#C.indexOf(e);return -1===n?this:this.insert(n,t,r)}after(e){let t=this.#C.indexOf(e);if(-1!==(t=-1===t||t===this.size-1?-1:t+1))return this.entryAt(t)}setAfter(e,t,r){let n=this.#C.indexOf(e);return -1===n?this:this.insert(n+1,t,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#C=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#C.splice(this.#C.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){let t=tY(this.#C,e);if(void 0!==t)return this.get(t)}entryAt(e){let t=tY(this.#C,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#C.indexOf(e)}keyAt(e){return tY(this.#C,e)}from(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.at(n)}keyFrom(e,t){let r=this.indexOf(e);if(-1===r)return;let n=r+t;return n<0&&(n=0),n>=this.size&&(n=this.size-1),this.keyAt(n)}find(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return n;r++}}findIndex(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return r;r++}return -1}filter(t,r){let n=[],a=0;for(let e of this)Reflect.apply(t,r,[e,a,this])&&n.push(e),a++;return new e(n)}map(t,r){let n=[],a=0;for(let e of this)n.push([e[0],Reflect.apply(t,r,[e,a,this])]),a++;return new e(n)}reduce(...e){let[t,r]=e,n=0,a=r??this.at(0);for(let r of this)a=0===n&&1===e.length?r:Reflect.apply(t,this,[a,r,n,this]),n++;return a}reduceRight(...e){let[t,r]=e,n=r??this.at(-1);for(let r=this.size-1;r>=0;r--){let a=this.at(r);n=r===this.size-1&&1===e.length?a:Reflect.apply(t,this,[n,a,r,this])}return n}toSorted(t){return new e([...this.entries()].sort(t))}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let r=this.keyAt(e),n=this.get(r);t.set(r,n)}return t}toSpliced(...t){let r=[...this.entries()];return r.splice(...t),new e(r)}slice(t,r){let n=new e,a=this.size-1;if(void 0===t)return n;t<0&&(t+=this.size),void 0!==r&&r>0&&(a=r-1);for(let e=t;e<=a;e++){let t=this.keyAt(e),r=this.get(t);n.set(t,r)}return n}every(e,t){let r=0;for(let n of this){if(!Reflect.apply(e,t,[n,r,this]))return!1;r++}return!0}some(e,t){let r=0;for(let n of this){if(Reflect.apply(e,t,[n,r,this]))return!0;r++}return!1}});var tZ=h.createContext(void 0),t0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=tK(`Primitive.${t}`),n=h.forwardRef((e,n)=>{let{asChild:a,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,m.jsx)(a?r:t,{...s,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function t1(e){let t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...e)=>t.current?.(...e),[])}var t2="dismissableLayer.update",t5=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),t4=h.forwardRef((e,t)=>{let{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:o,...l}=e,d=h.useContext(t5),[u,p]=h.useState(null),f=u?.ownerDocument??globalThis?.document,[,x]=h.useState({}),g=tW(t,e=>p(e)),b=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),k=u?b.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,j=k>=v,z=function(e,t=globalThis?.document){let r=t1(e),n=h.useRef(!1),a=h.useRef(()=>{});return h.useEffect(()=>{let e=e=>{if(e.target&&!n.current){let n=function(){t9("dismissableLayer.pointerDownOutside",r,s,{discrete:!0})},s={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",a.current),a.current=n,t.addEventListener("click",a.current,{once:!0})):n()}else t.removeEventListener("click",a.current);n.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",e),t.removeEventListener("click",a.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}(e=>{let t=e.target,r=[...d.branches].some(e=>e.contains(t));j&&!r&&(a?.(e),i?.(e),e.defaultPrevented||o?.())},f),N=function(e,t=globalThis?.document){let r=t1(e),n=h.useRef(!1);return h.useEffect(()=>{let e=e=>{e.target&&!n.current&&t9("dismissableLayer.focusOutside",r,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}(e=>{let t=e.target;![...d.branches].some(e=>e.contains(t))&&(s?.(e),i?.(e),e.defaultPrevented||o?.())},f);return!function(e,t=globalThis?.document){let r=t1(e);h.useEffect(()=>{let e=e=>{"Escape"===e.key&&r(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[r,t])}(e=>{k===d.layers.size-1&&(n?.(e),!e.defaultPrevented&&o&&(e.preventDefault(),o()))},f),h.useEffect(()=>{if(u)return r&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(c=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),t3(),()=>{r&&1===d.layersWithOutsidePointerEventsDisabled.size&&(f.body.style.pointerEvents=c)}},[u,f,r,d]),h.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),t3())},[u,d]),h.useEffect(()=>{let e=()=>x({});return document.addEventListener(t2,e),()=>document.removeEventListener(t2,e)},[]),(0,m.jsx)(t0.div,{...l,ref:g,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:tU(e.onFocusCapture,N.onFocusCapture),onBlurCapture:tU(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:tU(e.onPointerDownCapture,z.onPointerDownCapture)})});function t3(){let e=new CustomEvent(t2);document.dispatchEvent(e)}function t9(e,t,r,{discrete:n}){let a=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});if(t&&a.addEventListener(e,t,{once:!0}),n)a&&tV.flushSync(()=>a.dispatchEvent(s));else a.dispatchEvent(s)}t4.displayName="DismissableLayer",h.forwardRef((e,t)=>{let r=h.useContext(t5),n=h.useRef(null),a=tW(t,n);return h.useEffect(()=>{let e=n.current;if(e)return r.branches.add(e),()=>{r.branches.delete(e)}},[r.branches]),(0,m.jsx)(t0.div,{...e,ref:a})}).displayName="DismissableLayerBranch";var t6=0;function t8(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var t7="focusScope.autoFocusOnMount",re="focusScope.autoFocusOnUnmount",rt={bubbles:!1,cancelable:!0},rr=h.forwardRef((e,t)=>{let{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[o,l]=h.useState(null),d=t1(a),c=t1(s),u=h.useRef(null),p=tW(t,e=>l(e)),f=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(n){let e=function(e){if(f.paused||!o)return;let t=e.target;o.contains(t)?u.current=t:rs(u.current,{select:!0})},t=function(e){if(f.paused||!o)return;let t=e.relatedTarget;null!==t&&(o.contains(t)||rs(u.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let r=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&rs(o)});return o&&r.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),r.disconnect()}}},[n,o,f.paused]),h.useEffect(()=>{if(o){ri.add(f);let e=document.activeElement;if(!o.contains(e)){let t=new CustomEvent(t7,rt);o.addEventListener(t7,d),o.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let r=document.activeElement;for(let n of e)if(rs(n,{select:t}),document.activeElement!==r)return}(rn(o).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&rs(o))}return()=>{o.removeEventListener(t7,d),setTimeout(()=>{let t=new CustomEvent(re,rt);o.addEventListener(re,c),o.dispatchEvent(t),t.defaultPrevented||rs(e??document.body,{select:!0}),o.removeEventListener(re,c),ri.remove(f)},0)}}},[o,d,c,f]);let x=h.useCallback(e=>{if(!r&&!n||f.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){var s;let t,n=e.currentTarget,[i,o]=[ra(t=rn(s=n),s),ra(t.reverse(),s)];i&&o?e.shiftKey||a!==o?e.shiftKey&&a===i&&(e.preventDefault(),r&&rs(o,{select:!0})):(e.preventDefault(),r&&rs(i,{select:!0})):a===n&&e.preventDefault()}},[r,n,f.paused]);return(0,m.jsx)(t0.div,{tabIndex:-1,...i,ref:p,onKeyDown:x})});function rn(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function ra(e,t){for(let r of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(r,{upTo:t}))return r}function rs(e,{select:t=!1}={}){if(e&&e.focus){var r;let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&(r=e)instanceof HTMLInputElement&&"select"in r&&t&&e.select()}}rr.displayName="FocusScope";var ri=(n=[],{add(e){let t=n[0];e!==t&&t?.pause(),(n=ro(n,e)).unshift(e)},remove(e){n=ro(n,e),n[0]?.resume()}});function ro(e,t){let r=[...e],n=r.indexOf(t);return -1!==n&&r.splice(n,1),r}var rl=globalThis?.document?h.useLayoutEffect:()=>{},rd=h[" useId ".trim().toString()]||(()=>void 0),rc=0;function ru(e){let[t,r]=h.useState(rd());return rl(()=>{e||r(e=>e??String(rc++))},[e]),e||(t?`radix-${t}`:"")}let rm=["top","right","bottom","left"],rh=Math.min,rp=Math.max,rf=Math.round,rx=Math.floor,rg=e=>({x:e,y:e}),rb={left:"right",right:"left",bottom:"top",top:"bottom"};function ry(e,t){return"function"==typeof e?e(t):e}function rv(e){return e.split("-")[0]}function rk(e){return e.split("-")[1]}function rw(e){return"x"===e?"y":"x"}function rj(e){return"y"===e?"height":"width"}function rz(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function rN(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let rS=["left","right"],rC=["right","left"],rE=["top","bottom"],rR=["bottom","top"];function rA(e){let t=rv(e);return rb[t]+e.slice(t.length)}function rT(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function rO(e){let{x:t,y:r,width:n,height:a}=e;return{width:n,height:a,top:r,left:t,right:t+n,bottom:r+a,x:t,y:r}}function rL(e,t,r){let n,{reference:a,floating:s}=e,i=rz(t),o=rw(rz(t)),l=rj(o),d=rv(t),c="y"===i,u=a.x+a.width/2-s.width/2,m=a.y+a.height/2-s.height/2,h=a[l]/2-s[l]/2;switch(d){case"top":n={x:u,y:a.y-s.height};break;case"bottom":n={x:u,y:a.y+a.height};break;case"right":n={x:a.x+a.width,y:m};break;case"left":n={x:a.x-s.width,y:m};break;default:n={x:a.x,y:a.y}}switch(rk(t)){case"start":n[o]-=h*(r&&c?-1:1);break;case"end":n[o]+=h*(r&&c?-1:1)}return n}async function rF(e,t){var r;void 0===t&&(t={});let{x:n,y:a,platform:s,rects:i,elements:o,strategy:l}=e,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:u="floating",altBoundary:m=!1,padding:h=0}=ry(t,e),p=rT(h),f=o[m?"floating"===u?"reference":"floating":u],x=rO(await s.getClippingRect({element:null==(r=await (null==s.isElement?void 0:s.isElement(f)))||r?f:f.contextElement||await (null==s.getDocumentElement?void 0:s.getDocumentElement(o.floating)),boundary:d,rootBoundary:c,strategy:l})),g="floating"===u?{x:n,y:a,width:i.floating.width,height:i.floating.height}:i.reference,b=await (null==s.getOffsetParent?void 0:s.getOffsetParent(o.floating)),y=await (null==s.isElement?void 0:s.isElement(b))&&await (null==s.getScale?void 0:s.getScale(b))||{x:1,y:1},v=rO(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:b,strategy:l}):g);return{top:(x.top-v.top+p.top)/y.y,bottom:(v.bottom-x.bottom+p.bottom)/y.y,left:(x.left-v.left+p.left)/y.x,right:(v.right-x.right+p.right)/y.x}}let rM=async(e,t,r)=>{let{placement:n="bottom",strategy:a="absolute",middleware:s=[],platform:i}=r,o=i.detectOverflow?i:{...i,detectOverflow:rF},l=await (null==i.isRTL?void 0:i.isRTL(t)),d=await i.getElementRects({reference:e,floating:t,strategy:a}),{x:c,y:u}=rL(d,n,l),m=n,h=0,p={};for(let r=0;r<s.length;r++){let f=s[r];if(!f)continue;let{name:x,fn:g}=f,{x:b,y:y,data:v,reset:k}=await g({x:c,y:u,initialPlacement:n,placement:m,strategy:a,middlewareData:p,rects:d,platform:o,elements:{reference:e,floating:t}});c=null!=b?b:c,u=null!=y?y:u,p[x]={...p[x],...v},k&&h<50&&(h++,"object"==typeof k&&(k.placement&&(m=k.placement),k.rects&&(d=!0===k.rects?await i.getElementRects({reference:e,floating:t,strategy:a}):k.rects),{x:c,y:u}=rL(d,m,l)),r=-1)}return{x:c,y:u,placement:m,strategy:a,middlewareData:p}};function rI(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rD(e){return rm.some(t=>e[t]>=0)}let rP=new Set(["left","top"]);async function r_(e,t){let{placement:r,platform:n,elements:a}=e,s=await (null==n.isRTL?void 0:n.isRTL(a.floating)),i=rv(r),o=rk(r),l="y"===rz(r),d=rP.has(i)?-1:1,c=s&&l?-1:1,u=ry(t,e),{mainAxis:m,crossAxis:h,alignmentAxis:p}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return o&&"number"==typeof p&&(h="end"===o?-1*p:p),l?{x:h*c,y:m*d}:{x:m*d,y:h*c}}function rV(){return"u">typeof window}function r$(e){return rB(e)?(e.nodeName||"").toLowerCase():"#document"}function rU(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function rq(e){var t;return null==(t=(rB(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function rB(e){return!!rV()&&(e instanceof Node||e instanceof rU(e).Node)}function rH(e){return!!rV()&&(e instanceof Element||e instanceof rU(e).Element)}function rW(e){return!!rV()&&(e instanceof HTMLElement||e instanceof rU(e).HTMLElement)}function rK(e){return!(!rV()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof rU(e).ShadowRoot)}function rQ(e){let{overflow:t,overflowX:r,overflowY:n,display:a}=r2(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&"inline"!==a&&"contents"!==a}function rJ(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let rG=/transform|translate|scale|rotate|perspective|filter/,rY=/paint|layout|strict|content/,rX=e=>!!e&&"none"!==e;function rZ(e){let t=rH(e)?r2(e):e;return rX(t.transform)||rX(t.translate)||rX(t.scale)||rX(t.rotate)||rX(t.perspective)||!r0()&&(rX(t.backdropFilter)||rX(t.filter))||rG.test(t.willChange||"")||rY.test(t.contain||"")}function r0(){return null==t&&(t="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),t}function r1(e){return/^(html|body|#document)$/.test(r$(e))}function r2(e){return rU(e).getComputedStyle(e)}function r5(e){return rH(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function r4(e){if("html"===r$(e))return e;let t=e.assignedSlot||e.parentNode||rK(e)&&e.host||rq(e);return rK(t)?t.host:t}function r3(e,t,r){var n;void 0===t&&(t=[]),void 0===r&&(r=!0);let a=function e(t){let r=r4(t);return r1(r)?t.ownerDocument?t.ownerDocument.body:t.body:rW(r)&&rQ(r)?r:e(r)}(e),s=a===(null==(n=e.ownerDocument)?void 0:n.body),i=rU(a);if(!s)return t.concat(a,r3(a,[],r));{let e=r9(i);return t.concat(i,i.visualViewport||[],rQ(a)?a:[],e&&r?r3(e):[])}}function r9(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function r6(e){let t=r2(e),r=parseFloat(t.width)||0,n=parseFloat(t.height)||0,a=rW(e),s=a?e.offsetWidth:r,i=a?e.offsetHeight:n,o=rf(r)!==s||rf(n)!==i;return o&&(r=s,n=i),{width:r,height:n,$:o}}function r8(e){return rH(e)?e:e.contextElement}function r7(e){let t=r8(e);if(!rW(t))return rg(1);let r=t.getBoundingClientRect(),{width:n,height:a,$:s}=r6(t),i=(s?rf(r.width):r.width)/n,o=(s?rf(r.height):r.height)/a;return i&&Number.isFinite(i)||(i=1),o&&Number.isFinite(o)||(o=1),{x:i,y:o}}let ne=rg(0);function nt(e){let t=rU(e);return r0()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ne}function nr(e,t,r,n){var a;void 0===t&&(t=!1),void 0===r&&(r=!1);let s=e.getBoundingClientRect(),i=r8(e),o=rg(1);t&&(n?rH(n)&&(o=r7(n)):o=r7(e));let l=(void 0===(a=r)&&(a=!1),n&&(!a||n===rU(i))&&a)?nt(i):rg(0),d=(s.left+l.x)/o.x,c=(s.top+l.y)/o.y,u=s.width/o.x,m=s.height/o.y;if(i){let e=rU(i),t=n&&rH(n)?rU(n):n,r=e,a=r9(r);for(;a&&n&&t!==r;){let e=r7(a),t=a.getBoundingClientRect(),n=r2(a),s=t.left+(a.clientLeft+parseFloat(n.paddingLeft))*e.x,i=t.top+(a.clientTop+parseFloat(n.paddingTop))*e.y;d*=e.x,c*=e.y,u*=e.x,m*=e.y,d+=s,c+=i,a=r9(r=rU(a))}}return rO({width:u,height:m,x:d,y:c})}function nn(e,t){let r=r5(e).scrollLeft;return t?t.left+r:nr(rq(e)).left+r}function na(e,t){let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-nn(e,r),y:r.top+t.scrollTop}}function ns(e,t,r){var n;let a;if("viewport"===t)a=function(e,t){let r=rU(e),n=rq(e),a=r.visualViewport,s=n.clientWidth,i=n.clientHeight,o=0,l=0;if(a){s=a.width,i=a.height;let e=r0();(!e||e&&"fixed"===t)&&(o=a.offsetLeft,l=a.offsetTop)}let d=nn(n);if(d<=0){let e=n.ownerDocument,t=e.body,r=getComputedStyle(t),a="CSS1Compat"===e.compatMode&&parseFloat(r.marginLeft)+parseFloat(r.marginRight)||0,i=Math.abs(n.clientWidth-t.clientWidth-a);i<=25&&(s-=i)}else d<=25&&(s+=d);return{width:s,height:i,x:o,y:l}}(e,r);else if("document"===t){let t,r,s,i,o,l,d;n=rq(e),t=rq(n),r=r5(n),s=n.ownerDocument.body,i=rp(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=rp(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight),l=-r.scrollLeft+nn(n),d=-r.scrollTop,"rtl"===r2(s).direction&&(l+=rp(t.clientWidth,s.clientWidth)-i),a={width:i,height:o,x:l,y:d}}else if(rH(t)){let e,n,s,i,o,l;n=(e=nr(t,!0,"fixed"===r)).top+t.clientTop,s=e.left+t.clientLeft,i=rW(t)?r7(t):rg(1),o=t.clientWidth*i.x,l=t.clientHeight*i.y,a={width:o,height:l,x:s*i.x,y:n*i.y}}else{let r=nt(e);a={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return rO(a)}function ni(e){return"static"===r2(e).position}function no(e,t){if(!rW(e)||"fixed"===r2(e).position)return null;if(t)return t(e);let r=e.offsetParent;return rq(e)===r&&(r=r.ownerDocument.body),r}function nl(e,t){var r;let n=rU(e);if(rJ(e))return n;if(!rW(e)){let t=r4(e);for(;t&&!r1(t);){if(rH(t)&&!ni(t))return t;t=r4(t)}return n}let a=no(e,t);for(;a&&(r=a,/^(table|td|th)$/.test(r$(r)))&&ni(a);)a=no(a,t);return a&&r1(a)&&ni(a)&&!rZ(a)?n:a||function(e){let t=r4(e);for(;rW(t)&&!r1(t);){if(rZ(t))return t;if(rJ(t))break;t=r4(t)}return null}(e)||n}let nd=async function(e){let t=this.getOffsetParent||nl,r=this.getDimensions,n=await r(e.floating);return{reference:function(e,t,r){let n=rW(t),a=rq(t),s="fixed"===r,i=nr(e,!0,s,t),o={scrollLeft:0,scrollTop:0},l=rg(0);if(n||!n&&!s)if(("body"!==r$(t)||rQ(a))&&(o=r5(t)),n){let e=nr(t,!0,s,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else a&&(l.x=nn(a));s&&!n&&a&&(l.x=nn(a));let d=!a||n||s?rg(0):na(a,o);return{x:i.left+o.scrollLeft-l.x-d.x,y:i.top+o.scrollTop-l.y-d.y,width:i.width,height:i.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},nc={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:r,offsetParent:n,strategy:a}=e,s="fixed"===a,i=rq(n),o=!!t&&rJ(t.floating);if(n===i||o&&s)return r;let l={scrollLeft:0,scrollTop:0},d=rg(1),c=rg(0),u=rW(n);if((u||!u&&!s)&&(("body"!==r$(n)||rQ(i))&&(l=r5(n)),u)){let e=nr(n);d=r7(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}let m=!i||u||s?rg(0):na(i,l);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-l.scrollLeft*d.x+c.x+m.x,y:r.y*d.y-l.scrollTop*d.y+c.y+m.y}},getDocumentElement:rq,getClippingRect:function(e){let{element:t,boundary:r,rootBoundary:n,strategy:a}=e,s=[..."clippingAncestors"===r?rJ(t)?[]:function(e,t){let r=t.get(e);if(r)return r;let n=r3(e,[],!1).filter(e=>rH(e)&&"body"!==r$(e)),a=null,s="fixed"===r2(e).position,i=s?r4(e):e;for(;rH(i)&&!r1(i);){let t=r2(i),r=rZ(i);r||"fixed"!==t.position||(a=null),(s?r||a:!(!r&&"static"===t.position&&a&&("absolute"===a.position||"fixed"===a.position)||rQ(i)&&!r&&function e(t,r){let n=r4(t);return!(n===r||!rH(n)||r1(n))&&("fixed"===r2(n).position||e(n,r))}(e,i)))?a=t:n=n.filter(e=>e!==i),i=r4(i)}return t.set(e,n),n}(t,this._c):[].concat(r),n],i=ns(t,s[0],a),o=i.top,l=i.right,d=i.bottom,c=i.left;for(let e=1;e<s.length;e++){let r=ns(t,s[e],a);o=rp(r.top,o),l=rh(r.right,l),d=rh(r.bottom,d),c=rp(r.left,c)}return{width:l-c,height:d-o,x:c,y:o}},getOffsetParent:nl,getElementRects:nd,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:r}=r6(e);return{width:t,height:r}},getScale:r7,isElement:rH,isRTL:function(e){return"rtl"===r2(e).direction}};function nu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let nm=e=>({name:"arrow",options:e,async fn(t){let{x:r,y:n,placement:a,rects:s,platform:i,elements:o,middlewareData:l}=t,{element:d,padding:c=0}=ry(e,t)||{};if(null==d)return{};let u=rT(c),m={x:r,y:n},h=rw(rz(a)),p=rj(h),f=await i.getDimensions(d),x="y"===h,g=x?"clientHeight":"clientWidth",b=s.reference[p]+s.reference[h]-m[h]-s.floating[p],y=m[h]-s.reference[h],v=await (null==i.getOffsetParent?void 0:i.getOffsetParent(d)),k=v?v[g]:0;k&&await (null==i.isElement?void 0:i.isElement(v))||(k=o.floating[g]||s.floating[p]);let w=k/2-f[p]/2-1,j=rh(u[x?"top":"left"],w),z=rh(u[x?"bottom":"right"],w),N=k-f[p]-z,S=k/2-f[p]/2+(b/2-y/2),C=rp(j,rh(S,N)),E=!l.arrow&&null!=rk(a)&&S!==C&&s.reference[p]/2-(S<j?j:z)-f[p]/2<0,R=E?S<j?S-j:S-N:0;return{[h]:m[h]+R,data:{[h]:C,centerOffset:S-C-R,...E&&{alignmentOffset:R}},reset:E}}});var nh="u">typeof document?h.useLayoutEffect:function(){};function np(e,t){let r,n,a;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((r=e.length)!==t.length)return!1;for(n=r;0!=n--;)if(!np(e[n],t[n]))return!1;return!0}if((r=(a=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!({}).hasOwnProperty.call(t,a[n]))return!1;for(n=r;0!=n--;){let r=a[n];if(("_owner"!==r||!e.$$typeof)&&!np(e[r],t[r]))return!1}return!0}return e!=e&&t!=t}function nf(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nx(e,t){let r=nf(e);return Math.round(t*r)/r}function ng(e){let t=h.useRef(e);return nh(()=>{t.current=e}),t}var nb=h.forwardRef((e,t)=>{let{children:r,width:n=10,height:a=5,...s}=e;return(0,m.jsx)(t0.svg,{...s,ref:t,width:n,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:(0,m.jsx)("polygon",{points:"0,0 30,0 15,10"})})});nb.displayName="Arrow";var ny="Popper",[nv,nk]=tq(ny),[nw,nj]=nv(ny),nz=e=>{let{__scopePopper:t,children:r}=e,[n,a]=h.useState(null);return(0,m.jsx)(nw,{scope:t,anchor:n,onAnchorChange:a,children:r})};nz.displayName=ny;var nN="PopperAnchor",nS=h.forwardRef((e,t)=>{let{__scopePopper:r,virtualRef:n,...a}=e,s=nj(nN,r),i=h.useRef(null),o=tW(t,i),l=h.useRef(null);return h.useEffect(()=>{let e=l.current;l.current=n?.current||i.current,e!==l.current&&s.onAnchorChange(l.current)}),n?null:(0,m.jsx)(t0.div,{...a,ref:o})});nS.displayName=nN;var nC="PopperContent",[nE,nR]=nv(nC),nA=h.forwardRef((e,t)=>{var r,n,a,s,i,o,l,d,c,u,p,f,x,g,b,y,v,k,w,j,z;let N,S,C,E,R,A,{__scopePopper:T,side:O="bottom",sideOffset:L=0,align:F="center",alignOffset:M=0,arrowPadding:I=0,avoidCollisions:D=!0,collisionBoundary:P=[],collisionPadding:_=0,sticky:V="partial",hideWhenDetached:$=!1,updatePositionStrategy:U="optimized",onPlaced:q,...B}=e,H=nj(nC,T),[W,K]=h.useState(null),Q=tW(t,e=>K(e)),[J,G]=h.useState(null),Y=function(e){let[t,r]=h.useState(void 0);return rl(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let n,a;if(!Array.isArray(t)||!t.length)return;let s=t[0];if("borderBoxSize"in s){let e=s.borderBoxSize,t=Array.isArray(e)?e[0]:e;n=t.inlineSize,a=t.blockSize}else n=e.offsetWidth,a=e.offsetHeight;r({width:n,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)},[e]),t}(J),X=Y?.width??0,Z=Y?.height??0,ee="number"==typeof _?_:{top:0,right:0,bottom:0,left:0,..._},et=Array.isArray(P)?P:[P],er=et.length>0,en={padding:ee,boundary:et.filter(nF),altBoundary:er},{refs:ea,floatingStyles:es,placement:ei,isPositioned:eo,middlewareData:el}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:a,elements:{reference:s,floating:i}={},transform:o=!0,whileElementsMounted:l,open:d}=e,[c,u]=h.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=h.useState(n);np(m,n)||p(n);let[f,x]=h.useState(null),[g,b]=h.useState(null),y=h.useCallback(e=>{e!==j.current&&(j.current=e,x(e))},[]),v=h.useCallback(e=>{e!==z.current&&(z.current=e,b(e))},[]),k=s||f,w=i||g,j=h.useRef(null),z=h.useRef(null),N=h.useRef(c),S=null!=l,C=ng(l),E=ng(a),R=ng(d),A=h.useCallback(()=>{var e,n;let a,s,i;if(!j.current||!z.current)return;let o={placement:t,strategy:r,middleware:m};E.current&&(o.platform=E.current),(e=j.current,n=z.current,a=new Map,i={...(s={platform:nc,...o}).platform,_c:a},rM(e,n,{...s,platform:i})).then(e=>{let t={...e,isPositioned:!1!==R.current};T.current&&!np(N.current,t)&&(N.current=t,tV.flushSync(()=>{u(t)}))})},[m,t,r,E,R]);nh(()=>{!1===d&&N.current.isPositioned&&(N.current.isPositioned=!1,u(e=>({...e,isPositioned:!1})))},[d]);let T=h.useRef(!1);nh(()=>(T.current=!0,()=>{T.current=!1}),[]),nh(()=>{if(k&&(j.current=k),w&&(z.current=w),k&&w){if(C.current)return C.current(k,w,A);A()}},[k,w,A,C,S]);let O=h.useMemo(()=>({reference:j,floating:z,setReference:y,setFloating:v}),[y,v]),L=h.useMemo(()=>({reference:k,floating:w}),[k,w]),F=h.useMemo(()=>{let e={position:r,left:0,top:0};if(!L.floating)return e;let t=nx(L.floating,c.x),n=nx(L.floating,c.y);return o?{...e,transform:"translate("+t+"px, "+n+"px)",...nf(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}},[r,o,L.floating,c.x,c.y]);return h.useMemo(()=>({...c,update:A,refs:O,elements:L,floatingStyles:F}),[c,A,O,L,F])}({strategy:"fixed",placement:O+("center"!==F?"-"+F:""),whileElementsMounted:(...e)=>(function(e,t,r,n){let a;void 0===n&&(n={});let{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:d=!1}=n,c=r8(e),u=s||i?[...c?r3(c):[],...t?r3(t):[]]:[];u.forEach(e=>{s&&e.addEventListener("scroll",r,{passive:!0}),i&&e.addEventListener("resize",r)});let m=c&&l?function(e,t){let r,n=null,a=rq(e);function s(){var e;clearTimeout(r),null==(e=n)||e.disconnect(),n=null}return!function i(o,l){void 0===o&&(o=!1),void 0===l&&(l=1),s();let d=e.getBoundingClientRect(),{left:c,top:u,width:m,height:h}=d;if(o||t(),!m||!h)return;let p={rootMargin:-rx(u)+"px "+-rx(a.clientWidth-(c+m))+"px "+-rx(a.clientHeight-(u+h))+"px "+-rx(c)+"px",threshold:rp(0,rh(1,l))||1},f=!0;function x(t){let n=t[0].intersectionRatio;if(n!==l){if(!f)return i();n?i(!1,n):r=setTimeout(()=>{i(!1,1e-7)},1e3)}1!==n||nu(d,e.getBoundingClientRect())||i(),f=!1}try{n=new IntersectionObserver(x,{...p,root:a.ownerDocument})}catch(e){n=new IntersectionObserver(x,p)}n.observe(e)}(!0),s}(c,r):null,h=-1,p=null;o&&(p=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var e;null==(e=p)||e.observe(t)})),r()}),c&&!d&&p.observe(c),t&&p.observe(t));let f=d?nr(e):null;return d&&function t(){let n=nr(e);f&&!nu(f,n)&&r(),f=n,a=requestAnimationFrame(t)}(),r(),()=>{var e;u.forEach(e=>{s&&e.removeEventListener("scroll",r),i&&e.removeEventListener("resize",r)}),null==m||m(),null==(e=p)||e.disconnect(),p=null,d&&cancelAnimationFrame(a)}})(...e,{animationFrame:"always"===U}),elements:{reference:H.anchor},middleware:[{name:(N={name:"offset",options:a=r={mainAxis:L+Z,alignmentAxis:M},async fn(e){var t,r;let{x:n,y:s,placement:i,middlewareData:o}=e,l=await r_(e,a);return i===(null==(t=o.offset)?void 0:t.placement)&&null!=(r=o.arrow)&&r.alignmentOffset?{}:{x:n+l.x,y:s+l.y,data:{...l,placement:i}}}}).name,fn:N.fn,options:[r,n]},D&&{name:(S={name:"shift",options:c=l={mainAxis:!0,crossAxis:!1,limiter:"partial"===V?{fn:(void 0===(o=s)&&(o={}),{options:o,fn(e){let{x:t,y:r,placement:n,rects:a,middlewareData:s}=e,{offset:i=0,mainAxis:l=!0,crossAxis:d=!0}=ry(o,e),c={x:t,y:r},u=rz(n),m=rw(u),h=c[m],p=c[u],f=ry(i,e),x="number"==typeof f?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(l){let e="y"===m?"height":"width",t=a.reference[m]-a.floating[e]+x.mainAxis,r=a.reference[m]+a.reference[e]-x.mainAxis;h<t?h=t:h>r&&(h=r)}if(d){var g,b;let e="y"===m?"width":"height",t=rP.has(rv(n)),r=a.reference[u]-a.floating[e]+(t&&(null==(g=s.offset)?void 0:g[u])||0)+(t?0:x.crossAxis),i=a.reference[u]+a.reference[e]+(t?0:(null==(b=s.offset)?void 0:b[u])||0)-(t?x.crossAxis:0);p<r?p=r:p>i&&(p=i)}return{[m]:h,[u]:p}}}).fn,options:[s,i]}:void 0,...en},async fn(e){let{x:t,y:r,placement:n,platform:a}=e,{mainAxis:s=!0,crossAxis:i=!1,limiter:o={fn:e=>{let{x:t,y:r}=e;return{x:t,y:r}}},...l}=ry(c,e),d={x:t,y:r},u=await a.detectOverflow(e,l),m=rz(rv(n)),h=rw(m),p=d[h],f=d[m];if(s){let e="y"===h?"top":"left",t="y"===h?"bottom":"right",r=p+u[e],n=p-u[t];p=rp(r,rh(p,n))}if(i){let e="y"===m?"top":"left",t="y"===m?"bottom":"right",r=f+u[e],n=f-u[t];f=rp(r,rh(f,n))}let x=o.fn({...e,[h]:p,[m]:f});return{...x,data:{x:x.x-t,y:x.y-r,enabled:{[h]:s,[m]:i}}}}}).name,fn:S.fn,options:[l,d]},D&&{name:(C={name:"flip",options:f=u={...en},async fn(e){var t,r,n,a,s,i,o,l;let d,c,u,{placement:m,middlewareData:h,rects:p,initialPlacement:x,platform:g,elements:b}=e,{mainAxis:y=!0,crossAxis:v=!0,fallbackPlacements:k,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:z=!0,...N}=ry(f,e);if(null!=(t=h.arrow)&&t.alignmentOffset)return{};let S=rv(m),C=rz(x),E=rv(x)===x,R=await (null==g.isRTL?void 0:g.isRTL(b.floating)),A=k||(E||!z?[rA(x)]:(d=rA(x),[rN(x),d,rN(d)])),T="none"!==j;!k&&T&&A.push(...(c=rk(x),u=function(e,t,r){switch(e){case"top":case"bottom":if(r)return t?rC:rS;return t?rS:rC;case"left":case"right":return t?rE:rR;default:return[]}}(rv(x),"start"===j,R),c&&(u=u.map(e=>e+"-"+c),z&&(u=u.concat(u.map(rN)))),u));let O=[x,...A],L=await g.detectOverflow(e,N),F=[],M=(null==(r=h.flip)?void 0:r.overflows)||[];if(y&&F.push(L[S]),v){let e,t,r,n,a=(i=m,o=p,void 0===(l=R)&&(l=!1),e=rk(i),r=rj(t=rw(rz(i))),n="x"===t?e===(l?"end":"start")?"right":"left":"start"===e?"bottom":"top",o.reference[r]>o.floating[r]&&(n=rA(n)),[n,rA(n)]);F.push(L[a[0]],L[a[1]])}if(M=[...M,{placement:m,overflows:F}],!F.every(e=>e<=0)){let e=((null==(n=h.flip)?void 0:n.index)||0)+1,t=O[e];if(t&&("alignment"!==v||C===rz(t)||M.every(e=>rz(e.placement)!==C||e.overflows[0]>0)))return{data:{index:e,overflows:M},reset:{placement:t}};let r=null==(a=M.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:a.placement;if(!r)switch(w){case"bestFit":{let e=null==(s=M.filter(e=>{if(T){let t=rz(e.placement);return t===C||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:s[0];e&&(r=e);break}case"initialPlacement":r=x}if(m!==r)return{reset:{placement:r}}}return{}}}).name,fn:C.fn,options:[u,p]},{name:(E={name:"size",options:b=x={...en,apply:({elements:e,rects:t,availableWidth:r,availableHeight:n})=>{let{width:a,height:s}=t.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${r}px`),i.setProperty("--radix-popper-available-height",`${n}px`),i.setProperty("--radix-popper-anchor-width",`${a}px`),i.setProperty("--radix-popper-anchor-height",`${s}px`)}},async fn(e){var t,r;let n,a,{placement:s,rects:i,platform:o,elements:l}=e,{apply:d=()=>{},...c}=ry(b,e),u=await o.detectOverflow(e,c),m=rv(s),h=rk(s),p="y"===rz(s),{width:f,height:x}=i.floating;"top"===m||"bottom"===m?(n=m,a=h===(await (null==o.isRTL?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(a=m,n="end"===h?"top":"bottom");let g=x-u.top-u.bottom,y=f-u.left-u.right,v=rh(x-u[n],g),k=rh(f-u[a],y),w=!e.middlewareData.shift,j=v,z=k;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(z=y),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(j=g),w&&!h){let e=rp(u.left,0),t=rp(u.right,0),r=rp(u.top,0),n=rp(u.bottom,0);p?z=f-2*(0!==e||0!==t?e+t:rp(u.left,u.right)):j=x-2*(0!==r||0!==n?r+n:rp(u.top,u.bottom))}await d({...e,availableWidth:z,availableHeight:j});let N=await o.getDimensions(l.floating);return f!==N.width||x!==N.height?{reset:{rects:!0}}:{}}}).name,fn:E.fn,options:[x,g]},J&&{name:(R={name:"arrow",options:k=y={element:J,padding:I},fn(e){let{element:t,padding:r}="function"==typeof k?k(e):k;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?nm({element:t.current,padding:r}).fn(e):{}:t?nm({element:t,padding:r}).fn(e):{}}}).name,fn:R.fn,options:[y,v]},nM({arrowWidth:X,arrowHeight:Z}),$&&{name:(A={name:"hide",options:z=w={strategy:"referenceHidden",...en},async fn(e){let{rects:t,platform:r}=e,{strategy:n="referenceHidden",...a}=ry(z,e);switch(n){case"referenceHidden":{let n=rI(await r.detectOverflow(e,{...a,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:n,referenceHidden:rD(n)}}}case"escaped":{let n=rI(await r.detectOverflow(e,{...a,altBoundary:!0}),t.floating);return{data:{escapedOffsets:n,escaped:rD(n)}}}default:return{}}}}).name,fn:A.fn,options:[w,j]}]}),[ed,ec]=nI(ei),eu=t1(q);rl(()=>{eo&&eu?.()},[eo,eu]);let em=el.arrow?.x,eh=el.arrow?.y,ep=el.arrow?.centerOffset!==0,[ef,ex]=h.useState();return rl(()=>{W&&ex(window.getComputedStyle(W).zIndex)},[W]),(0,m.jsx)("div",{ref:ea.setFloating,"data-radix-popper-content-wrapper":"",style:{...es,transform:eo?es.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ef,"--radix-popper-transform-origin":[el.transformOrigin?.x,el.transformOrigin?.y].join(" "),...el.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,m.jsx)(nE,{scope:T,placedSide:ed,onArrowChange:G,arrowX:em,arrowY:eh,shouldHideArrow:ep,children:(0,m.jsx)(t0.div,{"data-side":ed,"data-align":ec,...B,ref:Q,style:{...B.style,animation:eo?void 0:"none"}})})})});nA.displayName=nC;var nT="PopperArrow",nO={top:"bottom",right:"left",bottom:"top",left:"right"},nL=h.forwardRef(function(e,t){let{__scopePopper:r,...n}=e,a=nR(nT,r),s=nO[a.placedSide];return(0,m.jsx)("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:(0,m.jsx)(nb,{...n,ref:t,style:{...n.style,display:"block"}})})});function nF(e){return null!==e}nL.displayName=nT;var nM=e=>({name:"transformOrigin",options:e,fn(t){let{placement:r,rects:n,middlewareData:a}=t,s=a.arrow?.centerOffset!==0,i=s?0:e.arrowWidth,o=s?0:e.arrowHeight,[l,d]=nI(r),c={start:"0%",center:"50%",end:"100%"}[d],u=(a.arrow?.x??0)+i/2,m=(a.arrow?.y??0)+o/2,h="",p="";return"bottom"===l?(h=s?c:`${u}px`,p=`${-o}px`):"top"===l?(h=s?c:`${u}px`,p=`${n.floating.height+o}px`):"right"===l?(h=`${-o}px`,p=s?c:`${m}px`):"left"===l&&(h=`${n.floating.width+o}px`,p=s?c:`${m}px`),{data:{x:h,y:p}}}});function nI(e){let[t,r="center"]=e.split("-");return[t,r]}var nD=h.forwardRef((e,t)=>{let{container:r,...n}=e,[a,s]=h.useState(!1);rl(()=>s(!0),[]);let i=r||a&&globalThis?.document?.body;return i?tV.default.createPortal((0,m.jsx)(t0.div,{...n,ref:t}),i):null});nD.displayName="Portal",h[" useEffectEvent ".trim().toString()],h[" useInsertionEffect ".trim().toString()];var nP=h[" useInsertionEffect ".trim().toString()]||rl;function n_({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){let[a,s,i]=function({defaultProp:e,onChange:t}){let[r,n]=h.useState(e),a=h.useRef(r),s=h.useRef(t);return nP(()=>{s.current=t},[t]),h.useEffect(()=>{a.current!==r&&(s.current?.(r),a.current=r)},[r,a]),[r,n,s]}({defaultProp:t,onChange:r}),o=void 0!==e,l=o?e:a;{let t=h.useRef(void 0!==e);h.useEffect(()=>{let e=t.current;if(e!==o){let t=o?"controlled":"uncontrolled";console.warn(`${n} is changing from ${e?"controlled":"uncontrolled"} to ${t}. 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.`)}t.current=o},[o,n])}return[l,h.useCallback(t=>{if(o){let r="function"==typeof t?t(e):t;r!==e&&i.current?.(r)}else s(t)},[o,e,s,i])]}Symbol("RADIX:SYNC_STATE");var nV=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"});h.forwardRef((e,t)=>(0,m.jsx)(t0.span,{...e,ref:t,style:{...nV,...e.style}})).displayName="VisuallyHidden";var n$=new WeakMap,nU=new WeakMap,nq={},nB=0,nH=function(e){return e&&(e.host||nH(e.parentNode))},nW=function(e,t,r,n){var a=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var r=nH(e);return r&&t.contains(r)?r:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});nq[r]||(nq[r]=new WeakMap);var s=nq[r],i=[],o=new Set,l=new Set(a),d=function(e){!e||o.has(e)||(o.add(e),d(e.parentNode))};a.forEach(d);var c=function(e){!e||l.has(e)||Array.prototype.forEach.call(e.children,function(e){if(o.has(e))c(e);else try{var t=e.getAttribute(n),a=null!==t&&"false"!==t,l=(n$.get(e)||0)+1,d=(s.get(e)||0)+1;n$.set(e,l),s.set(e,d),i.push(e),1===l&&a&&nU.set(e,!0),1===d&&e.setAttribute(r,"true"),a||e.setAttribute(n,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return c(t),o.clear(),nB++,function(){i.forEach(function(e){var t=n$.get(e)-1,a=s.get(e)-1;n$.set(e,t),s.set(e,a),t||(nU.has(e)||e.removeAttribute(n),nU.delete(e)),a||e.removeAttribute(r)}),--nB||(n$=new WeakMap,n$=new WeakMap,nU=new WeakMap,nq={})}},nK=function(e,t,r){void 0===r&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),nW(n,a,r,"aria-hidden")):function(){return null}},nQ=function(){return(nQ=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function nJ(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(e);a<n.length;a++)0>t.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]]);return r}var nG=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),nY="width-before-scroll-bar";function nX(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var nZ="u">typeof window?h.useLayoutEffect:h.useEffect,n0=new WeakMap,n1=(void 0===a&&(a={}),(void 0===s&&(s=function(e){return e}),i=[],o=!1,l={read:function(){if(o)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:null},useMedium:function(e){var t=s(e,o);return i.push(t),function(){i=i.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(o=!0;i.length;){var t=i;i=[],t.forEach(e)}i={push:function(t){return e(t)},filter:function(){return i}}},assignMedium:function(e){o=!0;var t=[];if(i.length){var r=i;i=[],r.forEach(e),t=i}var n=function(){var r=t;t=[],r.forEach(e)},a=function(){return Promise.resolve().then(n)};a(),i={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),i}}}}).options=nQ({async:!0,ssr:!1},a),l),n2=function(){},n5=h.forwardRef(function(e,t){var r,n,a,s,i=h.useRef(null),o=h.useState({onScrollCapture:n2,onWheelCapture:n2,onTouchMoveCapture:n2}),l=o[0],d=o[1],c=e.forwardProps,u=e.children,m=e.className,p=e.removeScrollBar,f=e.enabled,x=e.shards,g=e.sideCar,b=e.noRelative,y=e.noIsolation,v=e.inert,k=e.allowPinchZoom,w=e.as,j=e.gapMode,z=nJ(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=(r=[i,t],n=function(e){return r.forEach(function(t){return nX(t,e)})},(a=(0,h.useState)(function(){return{value:null,callback:n,facade:{get current(){return a.value},set current(value){var e=a.value;e!==value&&(a.value=value,a.callback(value,e))}}}})[0]).callback=n,s=a.facade,nZ(function(){var e=n0.get(s);if(e){var t=new Set(e),n=new Set(r),a=s.current;t.forEach(function(e){n.has(e)||nX(e,null)}),n.forEach(function(e){t.has(e)||nX(e,a)})}n0.set(s,r)},[r]),s),S=nQ(nQ({},z),l);return h.createElement(h.Fragment,null,f&&h.createElement(g,{sideCar:n1,removeScrollBar:p,shards:x,noRelative:b,noIsolation:y,inert:v,setCallbacks:d,allowPinchZoom:!!k,lockRef:i,gapMode:j}),c?h.cloneElement(h.Children.only(u),nQ(nQ({},S),{ref:N})):h.createElement(void 0===w?"div":w,nQ({},S,{className:m,ref:N}),u))});n5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},n5.classNames={fullWidth:nY,zeroRight:nG};var n4=function(e){var t=e.sideCar,r=nJ(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw Error("Sidecar medium not found");return h.createElement(n,nQ({},r))};n4.isSideCarExport=!0;var n3=function(){var e=0,t=null;return{add:function(r){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=u||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var n,a;(n=t).styleSheet?n.styleSheet.cssText=r:n.appendChild(document.createTextNode(r)),a=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(a)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},n9=function(){var e=n3();return function(t,r){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},n6=function(){var e=n9();return function(t){return e(t.styles,t.dynamic),null}},n8={left:0,top:0,right:0,gap:0},n7=function(e){return parseInt(e||"",10)||0},ae=function(e){var t=window.getComputedStyle(document.body),r=t["padding"===e?"paddingLeft":"marginLeft"],n=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[n7(r),n7(n),n7(a)]},at=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return n8;var t=ae(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},ar=n6(),an="data-scroll-locked",aa=function(e,t,r,n){var a=e.left,s=e.top,i=e.right,o=e.gap;return void 0===r&&(r="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(n,";\n padding-right: ").concat(o,"px ").concat(n,";\n }\n body[").concat(an,"] {\n overflow: hidden ").concat(n,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(n,";"),"margin"===r&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(o,"px ").concat(n,";\n "),"padding"===r&&"padding-right: ".concat(o,"px ").concat(n,";")].filter(Boolean).join(""),"\n }\n \n .").concat(nG," {\n right: ").concat(o,"px ").concat(n,";\n }\n \n .").concat(nY," {\n margin-right: ").concat(o,"px ").concat(n,";\n }\n \n .").concat(nG," .").concat(nG," {\n right: 0 ").concat(n,";\n }\n \n .").concat(nY," .").concat(nY," {\n margin-right: 0 ").concat(n,";\n }\n \n body[").concat(an,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(o,"px;\n }\n")},as=function(){var e=parseInt(document.body.getAttribute(an)||"0",10);return isFinite(e)?e:0},ai=function(){h.useEffect(function(){return document.body.setAttribute(an,(as()+1).toString()),function(){var e=as()-1;e<=0?document.body.removeAttribute(an):document.body.setAttribute(an,e.toString())}},[])},ao=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=void 0===n?"margin":n;ai();var s=h.useMemo(function(){return at(a)},[a]);return h.createElement(ar,{styles:aa(s,!t,a,r?"":"!important")})},al=!1;if("u">typeof window)try{var ad=Object.defineProperty({},"passive",{get:function(){return al=!0,!0}});window.addEventListener("test",ad,ad),window.removeEventListener("test",ad,ad)}catch(e){al=!1}var ac=!!al&&{passive:!1},au=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return"hidden"!==r[t]&&(r.overflowY!==r.overflowX||"TEXTAREA"===e.tagName||"visible"!==r[t])},am=function(e,t){var r=t.ownerDocument,n=t;do{if("u">typeof ShadowRoot&&n instanceof ShadowRoot&&(n=n.host),ah(e,n)){var a=ap(e,n);if(a[1]>a[2])return!0}n=n.parentNode}while(n&&n!==r.body)return!1},ah=function(e,t){return"v"===e?au(t,"overflowY"):au(t,"overflowX")},ap=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},af=function(e,t,r,n,a){var s,i=(s=window.getComputedStyle(t).direction,"h"===e&&"rtl"===s?-1:1),o=i*n,l=r.target,d=t.contains(l),c=!1,u=o>0,m=0,h=0;do{if(!l)break;var p=ap(e,l),f=p[0],x=p[1]-p[2]-i*f;(f||x)&&ah(e,l)&&(m+=x,h+=f);var g=l.parentNode;l=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!d&&l!==document.body||d&&(t.contains(l)||t===l))return u&&(a&&1>Math.abs(m)||!a&&o>m)?c=!0:!u&&(a&&1>Math.abs(h)||!a&&-o>h)&&(c=!0),c},ax=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ag=function(e){return[e.deltaX,e.deltaY]},ab=function(e){return e&&"current"in e?e.current:e},ay=0,av=[];let ak=(d=function(e){var t=h.useRef([]),r=h.useRef([0,0]),n=h.useRef(),a=h.useState(ay++)[0],s=h.useState(n6)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=(function(e,t,r){if(r||2==arguments.length)for(var n,a=0,s=t.length;a<s;a++)!n&&a in t||(n||(n=Array.prototype.slice.call(t,0,a)),n[a]=t[a]);return e.concat(n||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(ab),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var o=h.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,s=ax(e),o=r.current,l="deltaX"in e?e.deltaX:o[0]-s[0],d="deltaY"in e?e.deltaY:o[1]-s[1],c=e.target,u=Math.abs(l)>Math.abs(d)?"h":"v";if("touches"in e&&"h"===u&&"range"===c.type)return!1;var m=window.getSelection(),h=m&&m.anchorNode;if(h&&(h===c||h.contains(c)))return!1;var p=am(u,c);if(!p)return!0;if(p?a=u:(a="v"===u?"h":"v",p=am(u,c)),!p)return!1;if(!n.current&&"changedTouches"in e&&(l||d)&&(n.current=a),!a)return!0;var f=n.current||a;return af(f,t,e,"h"===f?l:d,!0)},[]),l=h.useCallback(function(e){if(av.length&&av[av.length-1]===s){var r="deltaY"in e?ag(e):ax(e),n=t.current.filter(function(t){var n;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(n=t.delta,n[0]===r[0]&&n[1]===r[1])})[0];if(n&&n.should){e.cancelable&&e.preventDefault();return}if(!n){var a=(i.current.shards||[]).map(ab).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?o(e,a[0]):!i.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),d=h.useCallback(function(e,r,n,a){var s={name:e,delta:r,target:n,should:a,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(n)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),c=h.useCallback(function(e){r.current=ax(e),n.current=void 0},[]),u=h.useCallback(function(t){d(t.type,ag(t),t.target,o(t,e.lockRef.current))},[]),m=h.useCallback(function(t){d(t.type,ax(t),t.target,o(t,e.lockRef.current))},[]);h.useEffect(function(){return av.push(s),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:m}),document.addEventListener("wheel",l,ac),document.addEventListener("touchmove",l,ac),document.addEventListener("touchstart",c,ac),function(){av=av.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,ac),document.removeEventListener("touchmove",l,ac),document.removeEventListener("touchstart",c,ac)}},[]);var p=e.removeScrollBar,f=e.inert;return h.createElement(h.Fragment,null,f?h.createElement(s,{styles:"\n .block-interactivity-".concat(a," {pointer-events: none;}\n .allow-interactivity-").concat(a," {pointer-events: all;}\n")}):null,p?h.createElement(ao,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},n1.useMedium(d),n4);var aw=h.forwardRef(function(e,t){return h.createElement(n5,nQ({},e,{ref:t,sideCar:ak}))});aw.classNames=n5.classNames;var aj=[" ","Enter","ArrowUp","ArrowDown"],az=[" ","Enter"],aN="Select",[aS,aC,aE]=function(e){let t=e+"CollectionProvider",[r,n]=tq(t),[a,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=e=>{let{scope:t,children:r}=e,n=h.default.useRef(null),s=h.default.useRef(new Map).current;return(0,m.jsx)(a,{scope:t,itemMap:s,collectionRef:n,children:r})};i.displayName=t;let o=e+"CollectionSlot",l=tK(o),d=h.default.forwardRef((e,t)=>{let{scope:r,children:n}=e,a=tW(t,s(o,r).collectionRef);return(0,m.jsx)(l,{ref:a,children:n})});d.displayName=o;let c=e+"CollectionItemSlot",u="data-radix-collection-item",p=tK(c),f=h.default.forwardRef((e,t)=>{let{scope:r,children:n,...a}=e,i=h.default.useRef(null),o=tW(t,i),l=s(c,r);return h.default.useEffect(()=>(l.itemMap.set(i,{ref:i,...a}),()=>void l.itemMap.delete(i))),(0,m.jsx)(p,{...{[u]:""},ref:o,children:n})});return f.displayName=c,[{Provider:i,Slot:d,ItemSlot:f},function(t){let r=s(e+"CollectionConsumer",t);return h.default.useCallback(()=>{let e=r.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${u}]`));return Array.from(r.itemMap.values()).sort((e,r)=>t.indexOf(e.ref.current)-t.indexOf(r.ref.current))},[r.collectionRef,r.itemMap])},n]}(aN),[aR,aA]=tq(aN,[aE,nk]),aT=nk(),[aO,aL]=aR(aN),[aF,aM]=aR(aN),aI=e=>{let t,{__scopeSelect:r,children:n,open:a,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:d,dir:c,name:u,autoComplete:p,disabled:f,required:x,form:g}=e,b=aT(r),[y,v]=h.useState(null),[k,w]=h.useState(null),[j,z]=h.useState(!1),N=(t=h.useContext(tZ),c||t||"ltr"),[S,C]=n_({prop:a,defaultProp:s??!1,onChange:i,caller:aN}),[E,R]=n_({prop:o,defaultProp:l,onChange:d,caller:aN}),A=h.useRef(null),T=!y||g||!!y.closest("form"),[O,L]=h.useState(new Set),F=Array.from(O).map(e=>e.props.value).join(";");return(0,m.jsx)(nz,{...b,children:(0,m.jsxs)(aO,{required:x,scope:r,trigger:y,onTriggerChange:v,valueNode:k,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:z,contentId:ru(),value:E,onValueChange:R,open:S,onOpenChange:C,dir:N,triggerPointerDownPosRef:A,disabled:f,children:[(0,m.jsx)(aS.Provider,{scope:r,children:(0,m.jsx)(aF,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(e=>{L(t=>new Set(t).add(e))},[]),onNativeOptionRemove:h.useCallback(e=>{L(t=>{let r=new Set(t);return r.delete(e),r})},[]),children:n})}),T?(0,m.jsxs)(so,{"aria-hidden":!0,required:x,tabIndex:-1,name:u,autoComplete:p,value:E,onChange:e=>R(e.target.value),disabled:f,form:g,children:[void 0===E?(0,m.jsx)("option",{value:""}):null,Array.from(O)]},F):null]})})};aI.displayName=aN;var aD="SelectTrigger",aP=h.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:n=!1,...a}=e,s=aT(r),i=aL(aD,r),o=i.disabled||n,l=tW(t,i.onTriggerChange),d=aC(r),c=h.useRef("touch"),[u,p,f]=sd(e=>{let t=d().filter(e=>!e.disabled),r=t.find(e=>e.value===i.value),n=sc(t,e,r);void 0!==n&&i.onValueChange(n.value)}),x=e=>{o||(i.onOpenChange(!0),f()),e&&(i.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,m.jsx)(nS,{asChild:!0,...s,children:(0,m.jsx)(t0.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":sl(i.value)?"":void 0,...a,ref:l,onClick:tU(a.onClick,e=>{e.currentTarget.focus(),"mouse"!==c.current&&x(e)}),onPointerDown:tU(a.onPointerDown,e=>{c.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(x(e),e.preventDefault())}),onKeyDown:tU(a.onKeyDown,e=>{let t=""!==u.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||p(e.key),(!t||" "!==e.key)&&aj.includes(e.key)&&(x(),e.preventDefault())})})})});aP.displayName=aD;var a_="SelectValue",aV=h.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,children:s,placeholder:i="",...o}=e,l=aL(a_,r),{onValueNodeHasChildrenChange:d}=l,c=void 0!==s,u=tW(t,l.onValueNodeChange);return rl(()=>{d(c)},[d,c]),(0,m.jsx)(t0.span,{...o,ref:u,style:{pointerEvents:"none"},children:sl(l.value)?(0,m.jsx)(m.Fragment,{children:i}):s})});aV.displayName=a_;var a$=h.forwardRef((e,t)=>{let{__scopeSelect:r,children:n,...a}=e;return(0,m.jsx)(t0.span,{"aria-hidden":!0,...a,ref:t,children:n||"▼"})});a$.displayName="SelectIcon";var aU=e=>(0,m.jsx)(nD,{asChild:!0,...e});aU.displayName="SelectPortal";var aq="SelectContent",aB=h.forwardRef((e,t)=>{let r=aL(aq,e.__scopeSelect),[n,a]=h.useState();return(rl(()=>{a(new DocumentFragment)},[]),r.open)?(0,m.jsx)(aQ,{...e,ref:t}):n?tV.createPortal((0,m.jsx)(aH,{scope:e.__scopeSelect,children:(0,m.jsx)(aS.Slot,{scope:e.__scopeSelect,children:(0,m.jsx)("div",{children:e.children})})}),n):null});aB.displayName=aq;var[aH,aW]=aR(aq),aK=tK("SelectContent.RemoveScroll"),aQ=h.forwardRef((e,t)=>{let{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:i,side:o,sideOffset:l,align:d,alignOffset:c,arrowPadding:u,collisionBoundary:p,collisionPadding:f,sticky:x,hideWhenDetached:g,avoidCollisions:b,...y}=e,v=aL(aq,r),[k,w]=h.useState(null),[j,z]=h.useState(null),N=tW(t,e=>w(e)),[S,C]=h.useState(null),[E,R]=h.useState(null),A=aC(r),[T,O]=h.useState(!1),L=h.useRef(!1);h.useEffect(()=>{if(k)return nK(k)},[k]),h.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??t8()),document.body.insertAdjacentElement("beforeend",e[1]??t8()),t6++,()=>{1===t6&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),t6--}},[]);let F=h.useCallback(e=>{let[t,...r]=A().map(e=>e.ref.current),[n]=r.slice(-1),a=document.activeElement;for(let r of e)if(r===a||(r?.scrollIntoView({block:"nearest"}),r===t&&j&&(j.scrollTop=0),r===n&&j&&(j.scrollTop=j.scrollHeight),r?.focus(),document.activeElement!==a))return},[A,j]),M=h.useCallback(()=>F([S,k]),[F,S,k]);h.useEffect(()=>{T&&M()},[T,M]);let{onOpenChange:I,triggerPointerDownPosRef:D}=v;h.useEffect(()=>{if(k){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(D.current?.y??0))}},r=r=>{e.x<=10&&e.y<=10?r.preventDefault():k.contains(r.target)||I(!1),document.removeEventListener("pointermove",t),D.current=null};return null!==D.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",r,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r,{capture:!0})}}},[k,I,D]),h.useEffect(()=>{let e=()=>I(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[I]);let[P,_]=sd(e=>{let t=A().filter(e=>!e.disabled),r=t.find(e=>e.ref.current===document.activeElement),n=sc(t,e,r);n&&setTimeout(()=>n.ref.current.focus())}),V=h.useCallback((e,t,r)=>{let n=!L.current&&!r;(void 0!==v.value&&v.value===t||n)&&(C(e),n&&(L.current=!0))},[v.value]),$=h.useCallback(()=>k?.focus(),[k]),U=h.useCallback((e,t,r)=>{let n=!L.current&&!r;(void 0!==v.value&&v.value===t||n)&&R(e)},[v.value]),q="popper"===n?aG:aJ,B=q===aG?{side:o,sideOffset:l,align:d,alignOffset:c,arrowPadding:u,collisionBoundary:p,collisionPadding:f,sticky:x,hideWhenDetached:g,avoidCollisions:b}:{};return(0,m.jsx)(aH,{scope:r,content:k,viewport:j,onViewportChange:z,itemRefCallback:V,selectedItem:S,onItemLeave:$,itemTextRefCallback:U,focusSelectedItem:M,selectedItemText:E,position:n,isPositioned:T,searchRef:P,children:(0,m.jsx)(aw,{as:aK,allowPinchZoom:!0,children:(0,m.jsx)(rr,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:tU(a,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,m.jsx)(t4,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,m.jsx)(q,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:e=>e.preventDefault(),...y,...B,onPlaced:()=>O(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:tU(y.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||_(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=A().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let r=e.target,n=t.indexOf(r);t=t.slice(n+1)}setTimeout(()=>F(t)),e.preventDefault()}})})})})})})});aQ.displayName="SelectContentImpl";var aJ=h.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:n,...a}=e,s=aL(aq,r),i=aW(aq,r),[o,l]=h.useState(null),[d,c]=h.useState(null),u=tW(t,e=>c(e)),p=aC(r),f=h.useRef(!1),x=h.useRef(!0),{viewport:g,selectedItem:b,selectedItemText:y,focusSelectedItem:v}=i,k=h.useCallback(()=>{if(s.trigger&&s.valueNode&&o&&d&&g&&b&&y){let e=s.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),r=s.valueNode.getBoundingClientRect(),a=y.getBoundingClientRect();if("rtl"!==s.dir){let n=a.left-t.left,s=r.left-n,i=e.left-s,l=e.width+i,d=Math.max(l,t.width),c=t$(s,[10,Math.max(10,window.innerWidth-10-d)]);o.style.minWidth=l+"px",o.style.left=c+"px"}else{let n=t.right-a.right,s=window.innerWidth-r.right-n,i=window.innerWidth-e.right-s,l=e.width+i,d=Math.max(l,t.width),c=t$(s,[10,Math.max(10,window.innerWidth-10-d)]);o.style.minWidth=l+"px",o.style.right=c+"px"}let i=p(),l=window.innerHeight-20,c=g.scrollHeight,u=window.getComputedStyle(d),m=parseInt(u.borderTopWidth,10),h=parseInt(u.paddingTop,10),x=parseInt(u.borderBottomWidth,10),v=m+h+c+parseInt(u.paddingBottom,10)+x,k=Math.min(5*b.offsetHeight,v),w=window.getComputedStyle(g),j=parseInt(w.paddingTop,10),z=parseInt(w.paddingBottom,10),N=e.top+e.height/2-10,S=b.offsetHeight/2,C=m+h+(b.offsetTop+S);if(C<=N){let e=i.length>0&&b===i[i.length-1].ref.current;o.style.bottom="0px";let t=Math.max(l-N,S+(e?z:0)+(d.clientHeight-g.offsetTop-g.offsetHeight)+x);o.style.height=C+t+"px"}else{let e=i.length>0&&b===i[0].ref.current;o.style.top="0px";let t=Math.max(N,m+g.offsetTop+(e?j:0)+S);o.style.height=t+(v-C)+"px",g.scrollTop=C-N+g.offsetTop}o.style.margin="10px 0",o.style.minHeight=k+"px",o.style.maxHeight=l+"px",n?.(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,o,d,g,b,y,s.dir,n]);rl(()=>k(),[k]);let[w,j]=h.useState();rl(()=>{d&&j(window.getComputedStyle(d).zIndex)},[d]);let z=h.useCallback(e=>{e&&!0===x.current&&(k(),v?.(),x.current=!1)},[k,v]);return(0,m.jsx)(aY,{scope:r,contentWrapper:o,shouldExpandOnScrollRef:f,onScrollButtonChange:z,children:(0,m.jsx)("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:(0,m.jsx)(t0.div,{...a,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});aJ.displayName="SelectItemAlignedPosition";var aG=h.forwardRef((e,t)=>{let{__scopeSelect:r,align:n="start",collisionPadding:a=10,...s}=e,i=aT(r);return(0,m.jsx)(nA,{...i,...s,ref:t,align:n,collisionPadding:a,style:{boxSizing:"border-box",...s.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)"}})});aG.displayName="SelectPopperPosition";var[aY,aX]=aR(aq,{}),aZ="SelectViewport",a0=h.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:n,...a}=e,s=aW(aZ,r),i=aX(aZ,r),o=tW(t,s.onViewportChange),l=h.useRef(0);return(0,m.jsxs)(m.Fragment,{children:[(0,m.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:n}),(0,m.jsx)(aS.Slot,{scope:r,children:(0,m.jsx)(t0.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:tU(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:r,shouldExpandOnScrollRef:n}=i;if(n?.current&&r){let e=Math.abs(l.current-t.scrollTop);if(e>0){let n=window.innerHeight-20,a=Math.max(parseFloat(r.style.minHeight),parseFloat(r.style.height));if(a<n){let s=a+e,i=Math.min(n,s),o=s-i;r.style.height=i+"px","0px"===r.style.bottom&&(t.scrollTop=o>0?o:0,r.style.justifyContent="flex-end")}}}l.current=t.scrollTop})})})]})});a0.displayName=aZ;var a1="SelectGroup",[a2,a5]=aR(a1);h.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=ru();return(0,m.jsx)(a2,{scope:r,id:a,children:(0,m.jsx)(t0.div,{role:"group","aria-labelledby":a,...n,ref:t})})}).displayName=a1;var a4="SelectLabel";h.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=a5(a4,r);return(0,m.jsx)(t0.div,{id:a.id,...n,ref:t})}).displayName=a4;var a3="SelectItem",[a9,a6]=aR(a3),a8=h.forwardRef((e,t)=>{let{__scopeSelect:r,value:n,disabled:a=!1,textValue:s,...i}=e,o=aL(a3,r),l=aW(a3,r),d=o.value===n,[c,u]=h.useState(s??""),[p,f]=h.useState(!1),x=tW(t,e=>l.itemRefCallback?.(e,n,a)),g=ru(),b=h.useRef("touch"),y=()=>{a||(o.onValueChange(n),o.onOpenChange(!1))};if(""===n)throw 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(0,m.jsx)(a9,{scope:r,value:n,disabled:a,textId:g,isSelected:d,onItemTextChange:h.useCallback(e=>{u(t=>t||(e?.textContent??"").trim())},[]),children:(0,m.jsx)(aS.ItemSlot,{scope:r,value:n,disabled:a,textValue:c,children:(0,m.jsx)(t0.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":d&&p,"data-state":d?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:x,onFocus:tU(i.onFocus,()=>f(!0)),onBlur:tU(i.onBlur,()=>f(!1)),onClick:tU(i.onClick,()=>{"mouse"!==b.current&&y()}),onPointerUp:tU(i.onPointerUp,()=>{"mouse"===b.current&&y()}),onPointerDown:tU(i.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:tU(i.onPointerMove,e=>{b.current=e.pointerType,a?l.onItemLeave?.():"mouse"===b.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tU(i.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:tU(i.onKeyDown,e=>{(l.searchRef?.current===""||" "!==e.key)&&(az.includes(e.key)&&y()," "===e.key&&e.preventDefault())})})})})});a8.displayName=a3;var a7="SelectItemText",se=h.forwardRef((e,t)=>{let{__scopeSelect:r,className:n,style:a,...s}=e,i=aL(a7,r),o=aW(a7,r),l=a6(a7,r),d=aM(a7,r),[c,u]=h.useState(null),p=tW(t,e=>u(e),l.onItemTextChange,e=>o.itemTextRefCallback?.(e,l.value,l.disabled)),f=c?.textContent,x=h.useMemo(()=>(0,m.jsx)("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:g,onNativeOptionRemove:b}=d;return rl(()=>(g(x),()=>b(x)),[g,b,x]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(t0.span,{id:l.textId,...s,ref:p}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?tV.createPortal(s.children,i.valueNode):null]})});se.displayName=a7;var st="SelectItemIndicator",sr=h.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return a6(st,r).isSelected?(0,m.jsx)(t0.span,{"aria-hidden":!0,...n,ref:t}):null});sr.displayName=st;var sn="SelectScrollUpButton";h.forwardRef((e,t)=>{let r=aW(sn,e.__scopeSelect),n=aX(sn,e.__scopeSelect),[a,s]=h.useState(!1),i=tW(t,n.onScrollButtonChange);return rl(()=>{if(r.viewport&&r.isPositioned){let e=function(){s(t.scrollTop>0)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,m.jsx)(ss,{...e,ref:i,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null}).displayName=sn;var sa="SelectScrollDownButton";h.forwardRef((e,t)=>{let r=aW(sa,e.__scopeSelect),n=aX(sa,e.__scopeSelect),[a,s]=h.useState(!1),i=tW(t,n.onScrollButtonChange);return rl(()=>{if(r.viewport&&r.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;s(Math.ceil(t.scrollTop)<e)},t=r.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),a?(0,m.jsx)(ss,{...e,ref:i,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=r;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null}).displayName=sa;var ss=h.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:n,...a}=e,s=aW("SelectScrollButton",r),i=h.useRef(null),o=aC(r),l=h.useCallback(()=>{null!==i.current&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>l(),[l]),rl(()=>{let e=o().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[o]),(0,m.jsx)(t0.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:tU(a.onPointerDown,()=>{null===i.current&&(i.current=window.setInterval(n,50))}),onPointerMove:tU(a.onPointerMove,()=>{s.onItemLeave?.(),null===i.current&&(i.current=window.setInterval(n,50))}),onPointerLeave:tU(a.onPointerLeave,()=>{l()})})});h.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e;return(0,m.jsx)(t0.div,{"aria-hidden":!0,...n,ref:t})}).displayName="SelectSeparator";var si="SelectArrow";h.forwardRef((e,t)=>{let{__scopeSelect:r,...n}=e,a=aT(r),s=aL(si,r),i=aW(si,r);return s.open&&"popper"===i.position?(0,m.jsx)(nL,{...a,...n,ref:t}):null}).displayName=si;var so=h.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{let a,s=h.useRef(null),i=tW(n,s),o=(a=h.useRef({value:t,previous:t}),h.useMemo(()=>(a.current.value!==t&&(a.current.previous=a.current.value,a.current.value=t),a.current.previous),[t]));return h.useEffect(()=>{let e=s.current;if(!e)return;let r=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(o!==t&&r){let n=new Event("change",{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,m.jsx)(t0.select,{...r,style:{...nV,...r.style},ref:i,defaultValue:t})});function sl(e){return""===e||void 0===e}function sd(e){let t=t1(e),r=h.useRef(""),n=h.useRef(0),a=h.useCallback(e=>{let a=r.current+e;t(a),function e(t){r.current=t,window.clearTimeout(n.current),""!==t&&(n.current=window.setTimeout(()=>e(""),1e3))}(a)},[t]),s=h.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,a,s]}function sc(e,t,r){var n,a;let s=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=r?e.indexOf(r):-1,o=(n=e,a=Math.max(i,0),n.map((e,t)=>n[(a+t)%n.length]));1===s.length&&(o=o.filter(e=>e!==r));let l=o.find(e=>e.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==r?l:void 0}so.displayName="SelectBubbleInput";let su=ej("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),sm=ej("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]),sh=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),sp=[],sf=(e,t,r)=>{if(0==e.length-t)return r.classGroupId;let n=e[t],a=r.nextPart.get(n);if(a){let r=sf(e,t+1,a);if(r)return r}let s=r.validators;if(null===s)return;let i=0===t?e.join("-"):e.slice(t).join("-"),o=s.length;for(let e=0;e<o;e++){let t=s[e];if(t.validator(i))return t.classGroupId}},sx=(e,t)=>{let r=sh();for(let n in e)sg(e[n],r,n,t);return r},sg=(e,t,r,n)=>{let a=e.length;for(let s=0;s<a;s++)sb(e[s],t,r,n)},sb=(e,t,r,n)=>{"string"==typeof e?sy(e,t,r):"function"==typeof e?sv(e,t,r,n):sk(e,t,r,n)},sy=(e,t,r)=>{(""===e?t:sw(t,e)).classGroupId=r},sv=(e,t,r,n)=>{sj(e)?sg(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push({classGroupId:r,validator:e}))},sk=(e,t,r,n)=>{let a=Object.entries(e),s=a.length;for(let e=0;e<s;e++){let[s,i]=a[e];sg(i,sw(t,s),r,n)}},sw=(e,t)=>{let r=e,n=t.split("-"),a=n.length;for(let e=0;e<a;e++){let t=n[e],a=r.nextPart.get(t);a||(a=sh(),r.nextPart.set(t,a)),r=a}return r},sj=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,sz=[],sN=(e,t,r,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:a}),sS=/\s+/,sC=e=>{let t;if("string"==typeof e)return e;let r="";for(let n=0;n<e.length;n++)e[n]&&(t=sC(e[n]))&&(r&&(r+=" "),r+=t);return r},sE=[],sR=e=>{let t=t=>t[e]||sE;return t.isThemeGetter=!0,t},sA=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sT=/^\((?:(\w[\w-]*):)?(.+)\)$/i,sO=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,sL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sF=/\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$/,sM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,sI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,sP=e=>sO.test(e),s_=e=>!!e&&!Number.isNaN(Number(e)),sV=e=>!!e&&Number.isInteger(Number(e)),s$=e=>e.endsWith("%")&&s_(e.slice(0,-1)),sU=e=>sL.test(e),sq=()=>!0,sB=e=>sF.test(e)&&!sM.test(e),sH=()=>!1,sW=e=>sI.test(e),sK=e=>sD.test(e),sQ=e=>!sG(e)&&!s4(e),sJ=e=>ir(e,io,sH),sG=e=>sA.test(e),sY=e=>ir(e,il,sB),sX=e=>ir(e,id,s_),sZ=e=>ir(e,iu,sq),s0=e=>ir(e,ic,sH),s1=e=>ir(e,is,sH),s2=e=>ir(e,ii,sK),s5=e=>ir(e,im,sW),s4=e=>sT.test(e),s3=e=>ia(e,il),s9=e=>ia(e,ic),s6=e=>ia(e,is),s8=e=>ia(e,io),s7=e=>ia(e,ii),ie=e=>ia(e,im,!0),it=e=>ia(e,iu,!0),ir=(e,t,r)=>{let n=sA.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},ia=(e,t,r=!1)=>{let n=sT.exec(e);return!!n&&(n[1]?t(n[1]):r)},is=e=>"position"===e||"percentage"===e,ii=e=>"image"===e||"url"===e,io=e=>"length"===e||"size"===e||"bg-size"===e,il=e=>"length"===e,id=e=>"number"===e,ic=e=>"family-name"===e,iu=e=>"number"===e||"weight"===e,im=e=>"shadow"===e,ih=((e,...t)=>{let r,n,a,s,i=e=>{let t=n(e);if(t)return t;let s=((e,t)=>{let{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:s}=t,i=[],o=e.trim().split(sS),l="";for(let e=o.length-1;e>=0;e-=1){let t=o[e],{isExternal:d,modifiers:c,hasImportantModifier:u,baseClassName:m,maybePostfixModifierPosition:h}=r(t);if(d){l=t+(l.length>0?" "+l:l);continue}let p=!!h,f=n(p?m.substring(0,h):m);if(!f){if(!p||!(f=n(m))){l=t+(l.length>0?" "+l:l);continue}p=!1}let x=0===c.length?"":1===c.length?c[0]:s(c).join(":"),g=u?x+"!":x,b=g+f;if(i.indexOf(b)>-1)continue;i.push(b);let y=a(f,p);for(let e=0;e<y.length;++e){let t=y[e];i.push(g+t)}l=t+(l.length>0?" "+l:l)}return l})(e,r);return a(e,s),s};return s=o=>{var l;let d;return n=(r={cache:(e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null),a=(a,s)=>{r[a]=s,++t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(a(e,t),t):void 0},set(e,t){e in r?r[e]=t:a(e,t)}}})((l=t.reduce((e,t)=>t(e),e())).cacheSize),parseClassName:(e=>{let{prefix:t,experimentalParseClassName:r}=e,n=e=>{let t,r=[],n=0,a=0,s=0,i=e.length;for(let o=0;o<i;o++){let i=e[o];if(0===n&&0===a){if(":"===i){r.push(e.slice(s,o)),s=o+1;continue}if("/"===i){t=o;continue}}"["===i?n++:"]"===i?n--:"("===i?a++:")"===i&&a--}let o=0===r.length?e:e.slice(s),l=o,d=!1;return o.endsWith("!")?(l=o.slice(0,-1),d=!0):o.startsWith("!")&&(l=o.slice(1),d=!0),sN(r,d,l,t&&t>s?t-s:void 0)};if(t){let e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):sN(sz,!1,t,void 0,!0)}if(r){let e=n;n=t=>r({className:t,parseClassName:e})}return n})(l),sortModifiers:(d=new Map,l.orderSensitiveModifiers.forEach((e,t)=>{d.set(e,1e6+t)}),e=>{let t=[],r=[];for(let n=0;n<e.length;n++){let a=e[n],s="["===a[0],i=d.has(a);s||i?(r.length>0&&(r.sort(),t.push(...r),r=[]),t.push(a)):r.push(a)}return r.length>0&&(r.sort(),t.push(...r)),t}),...(e=>{let t=(e=>{let{theme:t,classGroups:r}=e;return sx(r,t)})(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]")){var r;let t,n,a;return -1===(r=e).slice(1,-1).indexOf(":")?void 0:(n=(t=r.slice(1,-1)).indexOf(":"),(a=t.slice(0,n))?"arbitrary.."+a:void 0)}let n=e.split("-"),a=+(""===n[0]&&n.length>1);return sf(n,a,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=n[e],a=r[e];if(t){if(a){let e=Array(a.length+t.length);for(let t=0;t<a.length;t++)e[t]=a[t];for(let r=0;r<t.length;r++)e[a.length+r]=t[r];return e}return t}return a||sp}return r[e]||sp}}})(l)}).cache.get,a=r.cache.set,s=i,i(o)},(...e)=>s(((...e)=>{let t,r,n=0,a="";for(;n<e.length;)(t=e[n++])&&(r=sC(t))&&(a&&(a+=" "),a+=r);return a})(...e))})(()=>{let e=sR("color"),t=sR("font"),r=sR("text"),n=sR("font-weight"),a=sR("tracking"),s=sR("leading"),i=sR("breakpoint"),o=sR("container"),l=sR("spacing"),d=sR("radius"),c=sR("shadow"),u=sR("inset-shadow"),m=sR("text-shadow"),h=sR("drop-shadow"),p=sR("blur"),f=sR("perspective"),x=sR("aspect"),g=sR("ease"),b=sR("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...v(),s4,sG],w=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],z=()=>[s4,sG,l],N=()=>[sP,"full","auto",...z()],S=()=>[sV,"none","subgrid",s4,sG],C=()=>["auto",{span:["full",sV,s4,sG]},sV,s4,sG],E=()=>[sV,"auto",s4,sG],R=()=>["auto","min","max","fr",s4,sG],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],T=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...z()],L=()=>[sP,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],F=()=>[sP,"screen","full","dvw","lvw","svw","min","max","fit",...z()],M=()=>[sP,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],I=()=>[e,s4,sG],D=()=>[...v(),s6,s1,{position:[s4,sG]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",s8,sJ,{size:[s4,sG]}],V=()=>[s$,s3,sY],$=()=>["","none","full",d,s4,sG],U=()=>["",s_,s3,sY],q=()=>["solid","dashed","dotted","double"],B=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],H=()=>[s_,s$,s6,s1],W=()=>["","none",p,s4,sG],K=()=>["none",s_,s4,sG],Q=()=>["none",s_,s4,sG],J=()=>[s_,s4,sG],G=()=>[sP,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[sU],breakpoint:[sU],color:[sq],container:[sU],"drop-shadow":[sU],ease:["in","out","in-out"],font:[sQ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[sU],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[sU],shadow:[sU],spacing:["px",s_],text:[sU],"text-shadow":[sU],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",sP,sG,s4,x]}],container:["container"],columns:[{columns:[s_,sG,s4,o]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:k()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[sV,"auto",s4,sG]}],basis:[{basis:[sP,"full","auto",o,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[s_,sP,"auto","initial","none",sG]}],grow:[{grow:["",s_,s4,sG]}],shrink:[{shrink:["",s_,s4,sG]}],order:[{order:[sV,"first","last","none",s4,sG]}],"grid-cols":[{"grid-cols":S()}],"col-start-end":[{col:C()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":S()}],"row-start-end":[{row:C()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":R()}],"auto-rows":[{"auto-rows":R()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...T(),"normal"]}],"justify-self":[{"justify-self":["auto",...T()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...T(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...T(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...T(),"baseline"]}],"place-self":[{"place-self":["auto",...T()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...M()]}],"min-block-size":[{"min-block":["auto",...M()]}],"max-block-size":[{"max-block":["none",...M()]}],w:[{w:[o,"screen",...L()]}],"min-w":[{"min-w":[o,"screen","none",...L()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[i]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",r,s3,sY]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,it,sZ]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",s$,sG]}],"font-family":[{font:[s9,s0,t]}],"font-features":[{"font-features":[sG]}],"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:[a,s4,sG]}],"line-clamp":[{"line-clamp":[s_,"none",s4,sX]}],leading:[{leading:[s,...z()]}],"list-image":[{"list-image":["none",s4,sG]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",s4,sG]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[s_,"from-font","auto",s4,sY]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[s_,"auto",s4,sG]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",s4,sG]}],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",s4,sG]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},sV,s4,sG],radial:["",s4,sG],conic:[sV,s4,sG]},s7,s2]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:$()}],"rounded-s":[{"rounded-s":$()}],"rounded-e":[{"rounded-e":$()}],"rounded-t":[{"rounded-t":$()}],"rounded-r":[{"rounded-r":$()}],"rounded-b":[{"rounded-b":$()}],"rounded-l":[{"rounded-l":$()}],"rounded-ss":[{"rounded-ss":$()}],"rounded-se":[{"rounded-se":$()}],"rounded-ee":[{"rounded-ee":$()}],"rounded-es":[{"rounded-es":$()}],"rounded-tl":[{"rounded-tl":$()}],"rounded-tr":[{"rounded-tr":$()}],"rounded-br":[{"rounded-br":$()}],"rounded-bl":[{"rounded-bl":$()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-bs":[{"border-bs":U()}],"border-w-be":[{"border-be":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[s_,s4,sG]}],"outline-w":[{outline:["",s_,s3,sY]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",c,ie,s5]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",u,ie,s5]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[s_,sY]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",m,ie,s5]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[s_,s4,sG]}],"mix-blend":[{"mix-blend":[...B(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":B()}],"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":[s_]}],"mask-image-linear-from-pos":[{"mask-linear-from":H()}],"mask-image-linear-to-pos":[{"mask-linear-to":H()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":H()}],"mask-image-t-to-pos":[{"mask-t-to":H()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":H()}],"mask-image-r-to-pos":[{"mask-r-to":H()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":H()}],"mask-image-b-to-pos":[{"mask-b-to":H()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":H()}],"mask-image-l-to-pos":[{"mask-l-to":H()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":H()}],"mask-image-x-to-pos":[{"mask-x-to":H()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":H()}],"mask-image-y-to-pos":[{"mask-y-to":H()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[s4,sG]}],"mask-image-radial-from-pos":[{"mask-radial-from":H()}],"mask-image-radial-to-pos":[{"mask-radial-to":H()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":v()}],"mask-image-conic-pos":[{"mask-conic":[s_]}],"mask-image-conic-from-pos":[{"mask-conic-from":H()}],"mask-image-conic-to-pos":[{"mask-conic-to":H()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",s4,sG]}],filter:[{filter:["","none",s4,sG]}],blur:[{blur:W()}],brightness:[{brightness:[s_,s4,sG]}],contrast:[{contrast:[s_,s4,sG]}],"drop-shadow":[{"drop-shadow":["","none",h,ie,s5]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",s_,s4,sG]}],"hue-rotate":[{"hue-rotate":[s_,s4,sG]}],invert:[{invert:["",s_,s4,sG]}],saturate:[{saturate:[s_,s4,sG]}],sepia:[{sepia:["",s_,s4,sG]}],"backdrop-filter":[{"backdrop-filter":["","none",s4,sG]}],"backdrop-blur":[{"backdrop-blur":W()}],"backdrop-brightness":[{"backdrop-brightness":[s_,s4,sG]}],"backdrop-contrast":[{"backdrop-contrast":[s_,s4,sG]}],"backdrop-grayscale":[{"backdrop-grayscale":["",s_,s4,sG]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[s_,s4,sG]}],"backdrop-invert":[{"backdrop-invert":["",s_,s4,sG]}],"backdrop-opacity":[{"backdrop-opacity":[s_,s4,sG]}],"backdrop-saturate":[{"backdrop-saturate":[s_,s4,sG]}],"backdrop-sepia":[{"backdrop-sepia":["",s_,s4,sG]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",s4,sG]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[s_,"initial",s4,sG]}],ease:[{ease:["linear","initial",g,s4,sG]}],delay:[{delay:[s_,s4,sG]}],animate:[{animate:["none",b,s4,sG]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,s4,sG]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:K()}],"rotate-x":[{"rotate-x":K()}],"rotate-y":[{"rotate-y":K()}],"rotate-z":[{"rotate-z":K()}],scale:[{scale:Q()}],"scale-x":[{"scale-x":Q()}],"scale-y":[{"scale-y":Q()}],"scale-z":[{"scale-z":Q()}],"scale-3d":["scale-3d"],skew:[{skew:J()}],"skew-x":[{"skew-x":J()}],"skew-y":[{"skew-y":J()}],transform:[{transform:[s4,sG,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:G()}],"translate-x":[{"translate-x":G()}],"translate-y":[{"translate-y":G()}],"translate-z":[{"translate-z":G()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",s4,sG]}],"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":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",s4,sG]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[s_,s3,sY,sX]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-bs","border-w-be","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-bs","border-color-be","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-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]}});function ip(...e){return ih(function(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=function e(t){var r,n,a="";if("string"==typeof t||"number"==typeof t)a+=t;else if("object"==typeof t)if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(n=e(t[r]))&&(a&&(a+=" "),a+=n)}else for(n in t)t[n]&&(a&&(a+=" "),a+=n);return a}(e))&&(n&&(n+=" "),n+=t);return n}(e))}let ix=h.forwardRef(({className:e,children:t,...r},n)=>(0,m.jsxs)(aP,{ref:n,className:ip("flex h-10 w-full items-center justify-between rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm","ring-offset-white placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-zinc-950 focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50 dark:border-zinc-800 dark:bg-zinc-950 dark:ring-offset-zinc-950","dark:placeholder:text-zinc-400 dark:focus:ring-zinc-300",e),...r,children:[t,(0,m.jsx)(a$,{asChild:!0,children:(0,m.jsx)(su,{className:"h-4 w-4 opacity-50"})})]}));ix.displayName=aP.displayName;let ig=h.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>(0,m.jsx)(aU,{children:(0,m.jsx)(aB,{ref:a,className:ip("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg border border-zinc-200 bg-white text-zinc-950 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","dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-50","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:(0,m.jsx)(a0,{className:ip("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));ig.displayName=aB.displayName;let ib=h.forwardRef(({className:e,children:t,...r},n)=>(0,m.jsxs)(a8,{ref:n,className:ip("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none","focus:bg-zinc-100 focus:text-zinc-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50","dark:focus:bg-zinc-800 dark:focus:text-zinc-50",e),...r,children:[(0,m.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,m.jsx)(sr,{children:(0,m.jsx)(e_,{className:"h-4 w-4"})})}),(0,m.jsx)(se,{children:t})]}));function iy(e){if(!e)return{provider:"unknown",model:""};let t=e.indexOf("/");return -1!==t?{provider:e.substring(0,t),model:e.substring(t+1)}:{provider:"unknown",model:e}}function iv({value:e,onValueChange:t,placeholder:r="Select a model...",disabled:n=!1}){let[a,s]=h.useState(""),{data:i,isLoading:o,isError:l,error:d,refetch:c}=A({queryKey:["opencode-models"],queryFn:async()=>{let e=await fetch("/api/opencode-models"),t=await e.json();if(!e.ok||t.error)throw Error(t.error||"Failed to fetch models");return t},retry:!1}),u=h.useMemo(()=>{let t=new Set(i?.models??[]);return e&&!t.has(e)&&t.add(e),Array.from(t).sort()},[i?.models,e]),p=h.useMemo(()=>{if(!a.trim())return u;let e=a.toLowerCase();return u.filter(t=>t.toLowerCase().includes(e))},[u,a]),f=h.useMemo(()=>{let e={};return p.forEach(t=>{let{provider:r}=iy(t);e[r]||(e[r]=[]),e[r].push(t)}),e},[p]),x=Object.keys(f).sort(),g=h.useCallback(e=>{e||s("")},[]),b=e?iy(e):null;return(0,m.jsxs)(aI,{value:e,onValueChange:t,disabled:n||o,onOpenChange:g,children:[(0,m.jsx)(ix,{children:(0,m.jsx)(aV,{placeholder:r,children:b&&(0,m.jsxs)("span",{className:"flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-xs font-medium text-zinc-500 dark:text-zinc-400",children:b.provider}),(0,m.jsx)("span",{className:"text-zinc-500 dark:text-zinc-400",children:"/"}),(0,m.jsx)("span",{className:"text-zinc-900 dark:text-zinc-100",children:b.model})]})})}),(0,m.jsxs)(ig,{children:[(0,m.jsx)("div",{className:"sticky top-0 z-10 border-b border-zinc-200 bg-white px-2 pb-2 pt-1 dark:border-zinc-800 dark:bg-zinc-950",children:(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)(eR,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"}),(0,m.jsx)("input",{type:"text",value:a,onChange:e=>s(e.target.value),placeholder:"Search models...",className:ip("h-9 w-full rounded-md border border-zinc-200 bg-transparent pl-8 pr-3 text-sm","outline-none placeholder:text-zinc-500 focus:border-zinc-400 focus:ring-0","dark:border-zinc-800 dark:placeholder:text-zinc-400"),onKeyDown:e=>e.stopPropagation()})]})}),(0,m.jsx)("div",{className:"max-h-64 overflow-auto",children:o?(0,m.jsx)("div",{className:"px-2 py-4 text-center text-sm text-zinc-500",children:"Loading models..."}):l?(0,m.jsx)("div",{className:"px-4 py-6 text-center",children:(0,m.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,m.jsx)("div",{className:"w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,m.jsx)(eP,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}),(0,m.jsxs)("div",{className:"space-y-1",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Failed to load models"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 max-w-[200px]",children:d instanceof Error?d.message:"Please check your OpenCode installation"})]}),(0,m.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),c()},className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium bg-zinc-100 text-zinc-700 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700 transition-colors",children:[(0,m.jsx)(sm,{className:"h-3.5 w-3.5"}),"Retry"]})]})}):0===p.length?(0,m.jsx)("div",{className:"px-2 py-4 text-center text-sm text-zinc-500",children:"No models found"}):x.map(e=>(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold uppercase tracking-wide text-zinc-500 dark:text-zinc-400",children:e}),f[e].map(e=>{let{model:t}=iy(e);return(0,m.jsx)(ib,{value:e,children:(0,m.jsx)("span",{className:"flex items-center gap-2",children:(0,m.jsx)("span",{className:"text-zinc-900 dark:text-zinc-100",children:t})})},e)})]},e))})]})]})}ib.displayName=a8.displayName;let ik={"visual-engineering":["google/gemini-3.1-pro","glm-5","anthropic/claude-opus-4-6"],ultrabrain:["openai/gpt-5.3-codex","google/gemini-3.1-pro","anthropic/claude-opus-4-6"],deep:["openai/gpt-5.3-codex","anthropic/claude-opus-4-6","google/gemini-3.1-pro"],artistry:["google/gemini-3.1-pro","anthropic/claude-opus-4-6","openai/gpt-5.4"],quick:["anthropic/claude-haiku-4-5","google/gemini-3-flash","opencode/gpt-5-nano"],"unspecified-low":["anthropic/claude-sonnet-4-6","openai/gpt-5.3-codex","google/gemini-3-flash"],"unspecified-high":["openai/gpt-5.4","anthropic/claude-opus-4-6","glm-5","kimi-for-coding/k2p5"],writing:["google/gemini-3-flash","anthropic/claude-sonnet-4-6"]};function iw({categoryName:e,initialConfig:t,onSave:r,onCancel:n}){let[a,s]=h.useState(null),{control:i,handleSubmit:o,watch:l,formState:{isSubmitting:d}}=t_({defaultValues:{model:t?.model||"",variant:t?.variant||"",temperature:t?.temperature??.7,top_p:t?.top_p??1,prompt_append:t?.prompt_append||""}}),{data:c}=A({queryKey:["opencode-models"],queryFn:async()=>{var e;let t=await fetch("/api/opencode-models"),r=null;try{r=await t.json()}catch{r=null}let n=r&&"object"==typeof r&&"error"in r&&"string"==typeof r.error?r.error:null;if(!t.ok||n)throw Error(n||`Failed to fetch models (${t.status})`);if(!((e=r)&&"object"==typeof e&&Array.isArray(e.models)))throw Error("Invalid models response");return r},retry:!1}),u=h.useMemo(()=>new Set(c?.models??[]),[c]),p=l("model"),f=p&&u.size>0&&!u.has(p),x=!p,g=ik[e];return h.useEffect(()=>{if(a){let e=setTimeout(()=>s(null),3e3);return()=>clearTimeout(e)}},[a]),(0,m.jsxs)("form",{onSubmit:o(e=>{let t=Math.max(0,Math.min(2,e.temperature)),n=Math.max(0,Math.min(1,e.top_p));r({model:e.model||void 0,variant:e.variant||void 0,temperature:t,top_p:n,prompt_append:e.prompt_append||void 0}),s({type:"success",message:"Configuration saved successfully"})}),className:"space-y-6","aria-label":"Category configuration form",children:[a&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===a.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===a.type?(0,m.jsx)(e_,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(eP,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:a.message})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"category-name",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Category"}),(0,m.jsx)("input",{id:"category-name",type:"text",value:e,disabled:!0,className:"w-full rounded-lg border border-zinc-200 bg-zinc-100 px-3 py-2 text-sm text-zinc-600 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"The category identifier for this configuration."})]}),x&&g&&(0,m.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-zinc-200 bg-zinc-50 px-4 py-3 dark:border-zinc-800 dark:bg-zinc-900/20",children:[(0,m.jsx)(eP,{className:"mt-0.5 h-4 w-4 shrink-0 text-zinc-500 dark:text-zinc-400"}),(0,m.jsxs)("div",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"Using built-in fallback chain"})," — this category will try models in priority order when ",(0,m.jsx)("code",{className:"rounded bg-zinc-200 px-1 py-0.5 text-xs dark:bg-zinc-800",children:"task()"})," is called:",(0,m.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:g.map((e,t)=>(0,m.jsxs)(h.Fragment,{children:[(0,m.jsx)("code",{className:`rounded px-1.5 py-0.5 text-xs ${0===t?"bg-blue-100 text-blue-800 dark:bg-blue-900/50 dark:text-blue-200 font-medium":"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400"}`,children:e}),t<g.length-1&&(0,m.jsx)("span",{className:"text-zinc-400 dark:text-zinc-500",children:"→"})]},e))}),(0,m.jsx)("p",{className:"mt-2 text-xs text-zinc-500 dark:text-zinc-400",children:"Select a model to override the built-in behavior."})]})]}),x&&!g&&(0,m.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-zinc-200 bg-zinc-50 px-4 py-3 dark:border-zinc-800 dark:bg-zinc-900/20",children:[(0,m.jsx)(eP,{className:"mt-0.5 h-4 w-4 shrink-0 text-zinc-500 dark:text-zinc-400"}),(0,m.jsxs)("p",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"No model configured"})," — this custom category needs a model to be used with ",(0,m.jsx)("code",{className:"rounded bg-zinc-200 px-1 py-0.5 text-xs dark:bg-zinc-800",children:"task()"}),"."]})]}),f&&(0,m.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-800 dark:bg-amber-900/20",children:[(0,m.jsx)(eO,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-500 dark:text-amber-400"}),(0,m.jsxs)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"Model unavailable"})," — ",(0,m.jsx)("code",{className:"rounded bg-amber-100 px-1 py-0.5 text-xs dark:bg-amber-800",children:p})," is missing from current providers. Please check your provider settings."]})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"model-selector",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Model"}),(0,m.jsx)(td,{name:"model",control:i,render:({field:e})=>(0,m.jsx)("div",{id:"model-selector",children:(0,m.jsx)(iv,{value:e.value,onValueChange:e.onChange,placeholder:"Select a model..."})})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"The AI model identifier for this category."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"variant-selector",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Variant"}),(0,m.jsx)(td,{name:"variant",control:i,render:({field:e})=>(0,m.jsxs)("select",{id:"variant-selector",value:e.value,onChange:t=>e.onChange(t.target.value),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm dark:border-zinc-800 dark:bg-zinc-950",children:[(0,m.jsx)("option",{value:"",children:"Not set"}),(0,m.jsx)("option",{value:"max",children:"max"}),(0,m.jsx)("option",{value:"high",children:"high"}),(0,m.jsx)("option",{value:"medium",children:"medium"}),(0,m.jsx)("option",{value:"low",children:"low"}),(0,m.jsx)("option",{value:"xhigh",children:"xhigh"})]})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Model reasoning variant. Higher values mean more thinking."})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"temperature-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Temperature"}),(0,m.jsx)(td,{name:"temperature",control:i,rules:{min:{value:0,message:"Minimum is 0"},max:{value:2,message:"Maximum is 2"}},render:({field:e})=>(0,m.jsx)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e.value.toFixed(1)})})]}),(0,m.jsx)(td,{name:"temperature",control:i,rules:{min:{value:0,message:"Minimum is 0"},max:{value:2,message:"Maximum is 2"}},render:({field:e,fieldState:t})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"temperature-slider",type:"range",min:0,max:2,step:.1,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Temperature slider"}),(0,m.jsx)("input",{type:"number",min:0,max:2,step:.1,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)||0),className:"w-16 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Temperature value"})]}),t.error&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:t.error.message})]})}),(0,m.jsxs)("div",{className:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsx)("span",{children:"Precise (0)"}),(0,m.jsx)("span",{children:"Balanced (1)"}),(0,m.jsx)("span",{children:"Creative (2)"})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Controls randomness: lower values make responses more deterministic."})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"top-p-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Top P"}),(0,m.jsx)(td,{name:"top_p",control:i,rules:{min:{value:0,message:"Minimum is 0"},max:{value:1,message:"Maximum is 1"}},render:({field:e})=>(0,m.jsx)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e.value.toFixed(2)})})]}),(0,m.jsx)(td,{name:"top_p",control:i,rules:{min:{value:0,message:"Minimum is 0"},max:{value:1,message:"Maximum is 1"}},render:({field:e,fieldState:t})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"top-p-slider",type:"range",min:0,max:1,step:.05,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Top P slider"}),(0,m.jsx)("input",{type:"number",min:0,max:1,step:.05,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)||0),className:"w-16 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Top P value"})]}),t.error&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:t.error.message})]})}),(0,m.jsxs)("div",{className:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsx)("span",{children:"Diverse (0)"}),(0,m.jsx)("span",{children:"Default (1)"})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Controls nucleus sampling: lower values sample from more likely tokens."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"prompt-append",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Prompt Append"}),(0,m.jsx)(td,{name:"prompt_append",control:i,render:({field:e})=>(0,m.jsx)("textarea",{id:"prompt-append",value:e.value,onChange:t=>e.onChange(t.target.value),rows:4,className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm resize-none dark:border-zinc-800 dark:bg-zinc-950",placeholder:"Additional system instructions to append..."})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Additional instructions appended to the system prompt."})]}),(0,m.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-2",children:[(0,m.jsx)("button",{type:"button",onClick:n,className:"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-white px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800",children:"Cancel"}),(0,m.jsxs)("button",{type:"submit",disabled:d,className:"inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-blue-600 dark:hover:bg-blue-500",children:[d&&(0,m.jsx)(eD,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Save Changes"]})]})]})}function ij({onSaveSuccess:e}){let t=(0,S.useQueryClient)(),[r,n]=h.useState(null),[a,s]=h.useState(void 0),[i,o]=h.useState(null),{data:l,isLoading:d,isError:c,error:u}=A({queryKey:["opencode-config"],queryFn:async()=>{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch configuration");return e.json()}});h.useEffect(()=>{if(i){let e=setTimeout(()=>o(null),3e3);return()=>clearTimeout(e)}},[i]);let p=eI({mutationFn:async e=>{let t=await fetch("/api/opencode-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({categories:e})});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to save categories");return t.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["opencode-config"]}),o({type:"success",message:"Categories saved successfully"}),n(null),s(void 0),e?.()},onError:e=>{o({type:"error",message:e.message})}});if(d)return(0,m.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,m.jsx)(eD,{className:"h-6 w-6 animate-spin text-zinc-400"}),(0,m.jsx)("span",{className:"ml-2 text-sm text-zinc-500 dark:text-zinc-400",children:"Loading categories..."})]});if(c)return(0,m.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20",children:(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(eP,{className:"h-5 w-5 text-red-600 dark:text-red-400"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium text-red-800 dark:text-red-300",children:"Failed to load categories"}),(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:u instanceof Error?u.message:"An unknown error occurred"})]})]})});let f=l?.categories||{};return(0,m.jsxs)("div",{className:"space-y-4",children:[i&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===i.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===i.type?(0,m.jsx)(e_,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(eP,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:i.message})]}),r?(0,m.jsx)(iw,{categoryName:r,initialConfig:a,onSave:e=>{if(!r)return;let t={...l?.categories||{},[r]:e};p.mutate(t)},onCancel:()=>{n(null),s(void 0)}}):(0,m.jsx)(eH,{categories:f,onEdit:(e,t)=>{n(e),s(t)},onDelete:e=>{let{[e]:t,...r}=l?.categories||{};p.mutate(r)}})]})}let iz=ej("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),iN=ej("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),iS=ej("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]),iC=ej("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);function iE({profiles:e,activeProfileId:t,appliedProfileId:r,onApply:n,onEdit:a,onDelete:s,onExport:i,onImport:o,onCreateNew:l}){let[d,c]=h.useState(""),[u,p]=h.useState(null),f=h.useRef(null),x=(e,t)=>{t?p(e):n(e.id)},g=h.useMemo(()=>{if(!d.trim())return e;let t=d.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(t)||(e.description?.toLowerCase()||"").includes(t))},[e,d]),{active:b,builtIn:y,custom:v}=h.useMemo(()=>{let e=[],r=[],n=[];return g.forEach(a=>{a.id===t?e.push(a):a.isBuiltIn?r.push(a):n.push(a)}),{active:e,builtIn:r,custom:n}},[g,t]),k=e.length,w=g.length,j=d.trim().length>0;return(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsxs)("div",{className:"relative flex-1",children:[(0,m.jsx)(eR,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-zinc-400"}),(0,m.jsx)("input",{type:"text",placeholder:"Search profiles...",value:d,onChange:e=>c(e.target.value),className:"w-full pl-9 pr-3 py-2 text-sm bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded-lg placeholder:text-zinc-400 focus:outline-none focus:ring-2 focus:ring-teal-500/20 focus:border-teal-500 transition-all duration-200"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-zinc-500 dark:text-zinc-400 tabular-nums",children:[(0,m.jsx)(iN,{className:"h-3.5 w-3.5"}),(0,m.jsxs)("span",{children:[j?`${w} of ${k}`:`${k}`," profiles"]})]}),(0,m.jsx)("input",{ref:f,type:"file",accept:"application/json,.json",className:"sr-only",onChange:e=>{let t=e.target.files?.[0];t&&o(t),e.target.value=""},"aria-label":"Import profile file"}),(0,m.jsxs)("button",{type:"button",onClick:()=>{f.current?.click()},className:"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800 transition-colors",children:[(0,m.jsx)(iC,{className:"h-4 w-4"}),"Import File"]})]}),0===g.length&&(0,m.jsxs)("div",{className:"text-center py-12 px-4",children:[(0,m.jsx)("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-zinc-100 dark:bg-zinc-800 mb-3",children:(0,m.jsx)(iN,{className:"h-5 w-5 text-zinc-400 dark:text-zinc-500"})}),(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:j?"No profiles match your search":"No profiles yet"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-1",children:j?"Try a different search term":"Create your first profile to get started"})]}),g.length>0&&(0,m.jsxs)("div",{className:"space-y-4",children:[b.length>0&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsxs)("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-semibold bg-teal-100 text-teal-700 dark:bg-teal-900/40 dark:text-teal-300 uppercase tracking-wider",children:[(0,m.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-teal-500 animate-pulse"}),"Active"]}),(0,m.jsx)("span",{className:"text-[10px] text-zinc-400 dark:text-zinc-500 tabular-nums",children:b.length})]}),(0,m.jsx)("div",{className:"space-y-2",children:b.map(e=>(0,m.jsx)(iR,{profile:e,isActive:!0,isApplied:e.id===r,onApply:()=>x(e,e.id===r),onEdit:()=>a(e),onDelete:()=>s(e.id),onExport:()=>i(e)},e.id))})]}),y.length>0&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)("span",{className:"text-[10px] font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider",children:"Built-in"}),(0,m.jsx)("span",{className:"text-[10px] text-zinc-400 dark:text-zinc-500 tabular-nums",children:y.length})]}),(0,m.jsx)("div",{className:"space-y-2",children:y.map(e=>(0,m.jsx)(iR,{profile:e,isActive:!1,isApplied:e.id===r,onApply:()=>x(e,e.id===r),onEdit:()=>a(e),onDelete:()=>s(e.id),onExport:()=>i(e)},e.id))})]}),v.length>0&&(0,m.jsxs)("section",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)("span",{className:"text-[10px] font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider",children:"Custom"}),(0,m.jsx)("span",{className:"text-[10px] text-zinc-400 dark:text-zinc-500 tabular-nums",children:v.length})]}),(0,m.jsx)("div",{className:"space-y-2",children:v.map(e=>(0,m.jsx)(iR,{profile:e,isActive:!1,isApplied:e.id===r,onApply:()=>x(e,e.id===r),onEdit:()=>a(e),onDelete:()=>s(e.id),onExport:()=>i(e)},e.id))})]})]}),u&&(0,m.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,m.jsx)("div",{className:"w-full max-w-md mx-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-700 shadow-2xl",children:(0,m.jsxs)("div",{className:"p-6",children:[(0,m.jsxs)("div",{className:"flex items-start gap-4",children:[(0,m.jsx)("div",{className:"flex-shrink-0 w-12 h-12 rounded-full bg-amber-100 dark:bg-amber-900/30 flex items-center justify-center",children:(0,m.jsx)(eO,{className:"h-6 w-6 text-amber-600 dark:text-amber-400"})}),(0,m.jsxs)("div",{className:"flex-1",children:[(0,m.jsx)("h3",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:"Reset Profile Configuration"}),(0,m.jsxs)("p",{className:"mt-2 text-sm text-zinc-600 dark:text-zinc-400",children:["This will reset all agent and category configurations back to the ",(0,m.jsx)("strong",{children:u.name})," profile values. Any changes made after applying this profile will be lost."]})]})]}),(0,m.jsxs)("div",{className:"mt-6 flex items-center justify-end gap-3",children:[(0,m.jsxs)("button",{type:"button",onClick:()=>{p(null)},className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 text-sm font-medium text-zinc-700 dark:text-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-700 transition-colors",children:[(0,m.jsx)(eE,{className:"h-4 w-4"}),"Cancel"]}),(0,m.jsxs)("button",{type:"button",onClick:()=>{u&&(n(u.id),p(null))},className:"inline-flex items-center gap-2 px-4 py-2 rounded-lg bg-amber-600 text-sm font-medium text-white hover:bg-amber-700 transition-colors",children:[(0,m.jsx)(e_,{className:"h-4 w-4"}),"Reset to ",u.name]})]})]})})}),(0,m.jsxs)("button",{type:"button",onClick:l,className:"w-full flex items-center justify-center gap-2 py-3 px-4 rounded-lg border border-dashed border-zinc-300 dark:border-zinc-700 text-sm font-medium text-zinc-600 dark:text-zinc-400 hover:border-teal-400 hover:text-teal-600 dark:hover:border-teal-500 dark:hover:text-teal-400 hover:bg-teal-50/50 dark:hover:bg-teal-900/10 transition-all duration-200",children:[(0,m.jsx)(iz,{className:"h-4 w-4"}),"Create New Profile"]})]})}function iR({profile:e,isActive:t,isApplied:r,onApply:n,onEdit:a,onDelete:s,onExport:i}){return(0,m.jsxs)("div",{className:`
6
- group relative flex items-center justify-between p-3 rounded-lg border
7
- transition-all duration-200
8
- ${t?"bg-teal-50/50 border-teal-200 dark:bg-teal-900/20 dark:border-teal-700/50":"bg-white border-zinc-200 dark:bg-zinc-900 dark:border-zinc-700 hover:border-zinc-300 dark:hover:border-zinc-600"}
9
- `,children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,m.jsx)("span",{className:"text-xl",role:"img","aria-label":`${e.name} icon`,children:e.emoji}),(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("h4",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate",children:e.name}),e.isDefault&&(0,m.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300",children:"Default"}),e.isBuiltIn&&(0,m.jsx)("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",children:"Built-in"})]}),e.description&&(0,m.jsx)("p",{className:"mt-0.5 text-xs text-zinc-500 dark:text-zinc-400 truncate",children:e.description})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1 ml-3",children:[(0,m.jsx)("button",{type:"button",onClick:n,disabled:t&&!r,title:r?"Reset config to this profile":t?"Currently active":"Apply this profile",className:`
10
- px-2.5 py-1 rounded-md text-xs font-medium
11
- transition-all duration-200
12
- ${r?"bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/40 dark:text-amber-300 dark:hover:bg-amber-900/60":t?"bg-teal-100 text-teal-700 dark:bg-teal-900/40 dark:text-teal-300 cursor-default":"bg-zinc-100 text-zinc-700 hover:bg-teal-100 hover:text-teal-700 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-teal-900/30 dark:hover:text-teal-300"}
13
- `,children:r?"Reset":t?"Active":"Apply"}),(0,m.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,m.jsx)("button",{type:"button",onClick:i,className:"p-1.5 rounded-md text-zinc-400 hover:text-teal-600 hover:bg-teal-50 dark:text-zinc-500 dark:hover:text-teal-300 dark:hover:bg-teal-900/20 transition-colors","aria-label":`Export ${e.name}`,title:`Export ${e.name}`,children:(0,m.jsx)(iS,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),(0,m.jsx)("button",{type:"button",onClick:a,className:"p-1.5 rounded-md text-zinc-400 hover:text-zinc-700 hover:bg-zinc-100 dark:text-zinc-500 dark:hover:text-zinc-200 dark:hover:bg-zinc-800 transition-colors","aria-label":`Edit ${e.name}`,title:`Edit ${e.name}`,children:(0,m.jsxs)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",children:[(0,m.jsx)("title",{children:"Edit"}),(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})]})}),!e.isBuiltIn&&!e.isDefault&&(0,m.jsx)("button",{type:"button",onClick:s,className:"p-1.5 rounded-md text-zinc-400 hover:text-red-600 hover:bg-red-50 dark:text-zinc-500 dark:hover:text-red-400 dark:hover:bg-red-900/20 transition-colors","aria-label":`Delete ${e.name}`,title:`Delete ${e.name}`,children:(0,m.jsxs)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,role:"img",children:[(0,m.jsx)("title",{children:"Delete"}),(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})]})})]})]})]})}let iA=ej("rotate-ccw",[["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"}]]),iT=["⚡","🔥","💎","🚀","🎯","💡","🔧","🎨","📊","🤖","👾","💻","⚙️","🔍","✨","🌟","🎭","🎪","🧩","🎲","📚","🔐","🛠️","⚡️","🌊","🔮","📡","🎸","🏆","🌈"];function iO({profile:e,initialConfig:t,onSave:r,onCancel:n}){let a=!!e,[s,i]=h.useState(null),[o,l]=h.useState(t||{agents:{}}),[d,c]=h.useState(t||{agents:{}});h.useEffect(()=>{t&&(l(t),c(t))},[t]);let[u,p]=h.useState(!1),{control:f,handleSubmit:x,watch:g,formState:{errors:b,isSubmitting:y}}=t_({defaultValues:{id:e?.id||"",name:e?.name||"",emoji:e?.emoji||"⚡",description:e?.description||""}}),v=g("name"),k=g("emoji");h.useEffect(()=>{if(s){let e=setTimeout(()=>i(null),3e3);return()=>clearTimeout(e)}},[s]);let w=async()=>{try{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch configuration");let t=await e.json(),r={agents:t.agents||{},categories:t.categories};l(r),i({type:"success",message:"Configuration imported successfully"})}catch{i({type:"error",message:"Failed to import configuration"})}},j=h.useMemo(()=>JSON.stringify(o)!==JSON.stringify(d),[o,d]),z=Object.keys(o.agents||{}).length,N=Object.keys(o.categories||{}).length;return(0,m.jsxs)("form",{onSubmit:x(t=>{let n=new Date().toISOString();r({profile:{id:a?e.id:t.id,name:t.name,emoji:t.emoji,description:t.description||void 0,createdAt:a?e.createdAt:n,updatedAt:n,isDefault:!!a&&e.isDefault,isBuiltIn:!!a&&e.isBuiltIn},config:o}),i({type:"success",message:`Profile ${a?"updated":"created"} successfully`})}),className:"space-y-6","aria-label":"Profile editor form",children:[s&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===s.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===s.type?(0,m.jsx)(e_,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(eP,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:s.message})]}),!a&&(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsxs)("label",{htmlFor:"profile-id",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:["Profile ID",(0,m.jsx)("span",{className:"ml-1 text-red-500",children:"*"})]}),(0,m.jsx)(td,{name:"id",control:f,rules:{required:"Profile ID is required",pattern:{value:/^[a-zA-Z0-9_-]+$/,message:"Only alphanumeric characters, hyphens, and underscores allowed"}},render:({field:e})=>(0,m.jsx)("input",{id:"profile-id",type:"text",value:e.value,onChange:t=>e.onChange(t.target.value),placeholder:"e.g., my-custom-profile",className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm dark:border-zinc-800 dark:bg-zinc-950"})}),b.id&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:b.id.message}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Unique identifier for this profile. Use only letters, numbers, hyphens, and underscores."})]}),a&&(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"profile-id-readonly",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Profile ID"}),(0,m.jsx)("input",{id:"profile-id-readonly",type:"text",value:e.id,disabled:!0,className:"w-full rounded-lg border border-zinc-200 bg-zinc-100 px-3 py-2 text-sm text-zinc-600 dark:border-zinc-800 dark:bg-zinc-900 dark:text-zinc-400"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Profile ID cannot be changed after creation."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsxs)("label",{htmlFor:"profile-name",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:["Name",(0,m.jsx)("span",{className:"ml-1 text-red-500",children:"*"})]}),(0,m.jsx)(td,{name:"name",control:f,rules:{required:"Name is required",minLength:{value:1,message:"Name cannot be empty"}},render:({field:e})=>(0,m.jsx)("input",{id:"profile-name",type:"text",value:e.value,onChange:t=>e.onChange(t.target.value),placeholder:"e.g., My Custom Profile",className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm dark:border-zinc-800 dark:bg-zinc-950"})}),b.name&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:b.name.message}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Display name for this profile."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Emoji Icon"}),(0,m.jsx)(td,{name:"emoji",control:f,render:({field:e})=>(0,m.jsx)("div",{className:"flex flex-wrap gap-2",children:iT.map(t=>(0,m.jsx)("button",{type:"button",onClick:()=>e.onChange(t),className:`h-10 w-10 rounded-lg text-xl transition-all ${e.value===t?"bg-blue-100 ring-2 ring-blue-500 dark:bg-blue-900/30 dark:ring-blue-400":"bg-zinc-100 hover:bg-zinc-200 dark:bg-zinc-800 dark:hover:bg-zinc-700"}`,"aria-label":`Select ${t} emoji`,"aria-pressed":e.value===t,children:t},t))})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Choose an emoji to represent this profile."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"profile-description",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Description"}),(0,m.jsx)(td,{name:"description",control:f,render:({field:e})=>(0,m.jsx)("textarea",{id:"profile-description",value:e.value,onChange:t=>e.onChange(t.target.value),rows:3,className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm resize-none dark:border-zinc-800 dark:bg-zinc-950",placeholder:"Optional description of this profile..."})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Optional description to help identify this profile."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Configuration"}),(0,m.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,m.jsxs)("button",{type:"button",onClick:w,className:"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-white px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800",children:[(0,m.jsx)(iC,{className:"h-4 w-4","aria-hidden":"true"}),"Import from Current Config"]}),a&&j&&(0,m.jsxs)("button",{type:"button",onClick:()=>{l(d),i({type:"success",message:"Configuration reset to original values"})},className:"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-white px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 hover:text-amber-600 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800 dark:hover:text-amber-400",children:[(0,m.jsx)(iA,{className:"h-4 w-4","aria-hidden":"true"}),"Reset to Original"]})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Import agent and category configurations from your current settings, or reset to the profile's original values."})]}),(0,m.jsxs)("div",{className:"rounded-lg border border-zinc-200 bg-zinc-50 p-4 dark:border-zinc-700 dark:bg-zinc-900",children:[(0,m.jsx)("h4",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 mb-2",children:"Profile Preview"}),(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("span",{className:"text-3xl","aria-hidden":"true",children:k||"⚡"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:v||"Untitled Profile"}),(0,m.jsxs)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[z," agent",1!==z?"s":"",", ",N," categor",1!==N?"ies":"y"," configured"]})]})]})]}),(0,m.jsxs)("div",{className:"rounded-lg border border-zinc-200 dark:border-zinc-700 overflow-hidden",children:[(0,m.jsxs)("button",{type:"button",onClick:()=>p(!u),className:"w-full flex items-center justify-between p-4 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors","aria-expanded":u,children:[(0,m.jsx)("span",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Configuration Details"}),(0,m.jsx)(su,{className:`h-4 w-4 text-zinc-500 transition-transform duration-200 ${u?"rotate-180":""}`,"aria-hidden":"true"})]}),u&&(0,m.jsxs)("div",{className:"border-t border-zinc-200 dark:border-zinc-700 p-4 space-y-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsxs)("h5",{className:"text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wide mb-2",children:["Agents (",z,")"]}),0===z?(0,m.jsx)("p",{className:"text-sm text-zinc-400 dark:text-zinc-500 italic",children:"No agents configured"}):(0,m.jsx)("ul",{className:"space-y-1.5",children:Object.entries(o.agents||{}).map(([e,t])=>(0,m.jsxs)("li",{className:"text-sm text-zinc-700 dark:text-zinc-300 flex items-center gap-2",children:[(0,m.jsx)("span",{className:"font-medium text-zinc-900 dark:text-zinc-100 min-w-[80px]",children:e}),(0,m.jsx)("span",{className:"text-zinc-400",children:"→"}),(0,m.jsxs)("span",{className:"text-zinc-600 dark:text-zinc-400",children:[t.model,void 0!==t.temperature&&` temp: ${t.temperature}`]})]},e))})]}),(0,m.jsxs)("div",{children:[(0,m.jsxs)("h5",{className:"text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wide mb-2",children:["Categories (",N,")"]}),0===N?(0,m.jsx)("p",{className:"text-sm text-zinc-400 dark:text-zinc-500 italic",children:"No categories configured"}):(0,m.jsx)("ul",{className:"space-y-1.5",children:Object.entries(o.categories||{}).map(([e,t])=>(0,m.jsxs)("li",{className:"text-sm text-zinc-700 dark:text-zinc-300 flex items-center gap-2",children:[(0,m.jsx)("span",{className:"font-medium text-zinc-900 dark:text-zinc-100 min-w-[80px]",children:e}),(0,m.jsx)("span",{className:"text-zinc-400",children:"→"}),(0,m.jsxs)("span",{className:"text-zinc-600 dark:text-zinc-400",children:[t.model,t.variant&&` (${t.variant})`,void 0!==t.temperature&&` temp: ${t.temperature}`]})]},e))})]})]})]}),(0,m.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-2",children:[(0,m.jsx)("button",{type:"button",onClick:n,className:"inline-flex items-center gap-2 rounded-lg border border-zinc-200 bg-white px-4 py-2 text-sm font-medium text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-300 dark:hover:bg-zinc-800",children:"Cancel"}),(0,m.jsxs)("button",{type:"submit",disabled:y||!v.trim(),className:"inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-blue-600 dark:hover:bg-blue-500",children:[y&&(0,m.jsx)(eD,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),a?"Save Changes":"Create Profile"]})]})]})}async function iL(){let e=new AbortController,t=setTimeout(()=>e.abort(),8e3);try{let t=await fetch("/api/profiles",{signal:e.signal});if(!t.ok)throw Error("Failed to fetch profiles");return t.json()}catch(e){if(e instanceof Error&&"AbortError"===e.name)throw Error("Loading profiles timed out. Please try again.");throw e}finally{clearTimeout(t)}}async function iF(e){return"function"==typeof e.text?e.text():new Response(e).text()}function iM({onSaveSuccess:e}){let t=(0,S.useQueryClient)(),[r,n]=h.useState(null),[a,s]=h.useState(void 0),[i,o]=h.useState(!1),[l,d]=h.useState(null),[c,u]=h.useState(null),{data:p,isLoading:f,isError:x,error:g}=A({queryKey:["profiles"],queryFn:iL,retry:!1});h.useEffect(()=>{p?.activeProfileId&&d(p.activeProfileId)},[p?.activeProfileId]),h.useEffect(()=>{if(c){let e=setTimeout(()=>u(null),3e3);return()=>clearTimeout(e)}},[c]);let b=eI({mutationFn:async e=>{let t=await fetch(`/api/profiles/${e}/apply`,{method:"POST"});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to apply profile");return t.json()},onSuccess:(e,r)=>{t.invalidateQueries({queryKey:["profiles"]}),t.invalidateQueries({queryKey:["opencode-config"]}),d(r),u({type:"success",message:"Profile applied successfully"})},onError:e=>{u({type:"error",message:e.message})}}),y=eI({mutationFn:async({profile:e,config:t})=>{let r=await fetch("/api/profiles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:e,config:t})});if(!r.ok)throw Error((await r.json().catch(()=>({}))).error||"Failed to create profile");return r.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),u({type:"success",message:"Profile created successfully"}),o(!1),e?.()},onError:e=>{u({type:"error",message:e.message})}}),v=eI({mutationFn:async({id:e,profile:t,config:r})=>{let n=await fetch(`/api/profiles/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:t,config:r})});if(!n.ok)throw Error((await n.json().catch(()=>({}))).error||"Failed to update profile");return n.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),u({type:"success",message:"Profile updated successfully"}),n(null),e?.()},onError:e=>{u({type:"error",message:e.message})}}),k=eI({mutationFn:async e=>{let t=await fetch(`/api/profiles/${e}`,{method:"DELETE"});if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to delete profile");return t.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["profiles"]}),u({type:"success",message:"Profile deleted successfully"})},onError:e=>{u({type:"error",message:e.message})}}),w=eI({mutationFn:async e=>{let t=await fetch(`/api/profiles/${e.id}/export`);if(!t.ok)throw Error((await t.json().catch(()=>({}))).error||"Failed to export profile");return{blob:await t.blob(),profile:e}},onSuccess:({blob:e,profile:t})=>{var r;let n,a;r=`${t.id}.vibepulse-profile.json`,n=URL.createObjectURL(e),(a=document.createElement("a")).href=n,a.download=r,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(n),u({type:"success",message:`Exported ${t.name}`})},onError:e=>{u({type:"error",message:e.message})}}),j=eI({mutationFn:async e=>{let t;try{t=JSON.parse(await iF(e))}catch{throw Error("Profile file must be valid JSON")}let r=await fetch("/api/profiles/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw Error((await r.json().catch(()=>({}))).error||"Failed to import profile");return r.json()},onSuccess:e=>{t.invalidateQueries({queryKey:["profiles"]});let r=e&&"object"==typeof e&&"profile"in e&&e.profile&&"object"==typeof e.profile&&"name"in e.profile&&"string"==typeof e.profile.name?e.profile.name:"profile";u({type:"success",message:`Imported ${r}`})},onError:e=>{u({type:"error",message:e.message})}}),z=async e=>{n(e),o(!1);try{let t=await fetch(`/api/profiles/${e.id}`);if(t.ok){let e=await t.json();s(e.config)}}catch{s(void 0)}};if(f)return(0,m.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,m.jsx)(eD,{className:"h-6 w-6 animate-spin text-zinc-400"}),(0,m.jsx)("span",{className:"ml-2 text-sm text-zinc-500 dark:text-zinc-400",children:"Loading profiles..."})]});if(x)return(0,m.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-900/20",children:(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(eP,{className:"h-5 w-5 text-red-600 dark:text-red-400"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm font-medium text-red-800 dark:text-red-300",children:"Failed to load profiles"}),(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:g instanceof Error?g.message:"An unknown error occurred"})]})]})});let N=p?.profiles??[],C=p?.activeProfileId??null;return(0,m.jsxs)("div",{className:"space-y-4",children:[c&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===c.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===c.type?(0,m.jsx)(e_,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(eP,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:c.message})]}),r||i?(0,m.jsx)(iO,{profile:r??void 0,initialConfig:a,onSave:({profile:e,config:t})=>{i?y.mutate({profile:e,config:t}):r&&v.mutate({id:r.id,profile:e,config:t})},onCancel:()=>{n(null),s(void 0),o(!1)}}):(0,m.jsx)(iE,{profiles:N,activeProfileId:C,appliedProfileId:l,onApply:e=>{b.mutate(e)},onEdit:z,onDelete:e=>{k.mutate(e)},onExport:e=>{w.mutate(e)},onImport:e=>{j.mutate(e)},onCreateNew:()=>{o(!0),n(null)}})]})}let iI={sisyphus:["anthropic/claude-opus-4-6","glm-5","big-pickle"],prometheus:["anthropic/claude-opus-4-6","openai/gpt-5.4","google/gemini-3.1-pro"],metis:["anthropic/claude-opus-4-6","openai/gpt-5.4","google/gemini-3.1-pro"],atlas:["anthropic/claude-sonnet-4-6","openai/gpt-5.4"],hephaestus:["openai/gpt-5.3-codex"],oracle:["openai/gpt-5.4","google/gemini-3.1-pro","anthropic/claude-opus-4-6"],momus:["openai/gpt-5.4","anthropic/claude-opus-4-6","google/gemini-3.1-pro"],explore:["github-copilot/grok-code-fast-1","minimax-m2.5-free","anthropic/claude-haiku-4-5","opencode/gpt-5-nano"],librarian:["google/gemini-3-flash","minimax-m2.5-free","big-pickle"],default:["anthropic/claude-opus-4-6","openai/gpt-5.4"]};function iD({agentName:e="default",onSaveSuccess:t}){let r=(0,S.useQueryClient)(),[n,a]=h.useState(null),{data:s,isLoading:i}=A({queryKey:["opencode-config"],queryFn:async()=>{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch config");return e.json()}}),{control:o,handleSubmit:l,reset:d,formState:{isSubmitting:c}}=t_({defaultValues:{model:"",temperature:.7,top_p:1,variant:"",prompt_append:""}}),{data:u}=A({queryKey:["opencode-models"],queryFn:async()=>{var e;let t=await fetch("/api/opencode-models"),r=null;try{r=await t.json()}catch{r=null}let n=r&&"object"==typeof r&&"error"in r&&"string"==typeof r.error?r.error:null;if(!t.ok||n)throw Error(n||`Failed to fetch models (${t.status})`);if(!((e=r)&&"object"==typeof e&&Array.isArray(e.models)))throw Error("Invalid models response");return r},retry:!1}),p=h.useMemo(()=>new Set(u?.models??[]),[u]);h.useEffect(()=>{if(s){let t=s.agents?.[e]||{};d({model:t.model||"",temperature:t.temperature??.7,top_p:t.top_p??1,variant:t.variant||"",prompt_append:t.prompt_append||""})}},[s,e,d]),h.useEffect(()=>{if(n){let e=setTimeout(()=>a(null),3e3);return()=>clearTimeout(e)}},[n]);let f=eI({mutationFn:async t=>{let r=await fetch("/api/opencode-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:{[e]:t}})});if(!r.ok)throw Error((await r.json()).error||"Failed to save config");return r.json()},onSuccess:()=>{r.invalidateQueries({queryKey:["opencode-config"]}),a({type:"success",message:"Configuration saved successfully"}),t?.()},onError:e=>{a({type:"error",message:e.message})}}),x=s?.agents?.[e],g=!!x?.model,b=x?.model,y=b&&p.size>0&&!p.has(b),v=!b,k=iI[e]||iI.default;return i?(0,m.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,m.jsx)(eD,{className:"h-6 w-6 animate-spin text-zinc-400"}),(0,m.jsx)("span",{className:"ml-2 text-sm text-zinc-500",children:"Loading configuration..."})]}):(0,m.jsxs)("form",{onSubmit:l(e=>{f.mutate(e)}),className:"space-y-6","aria-label":"Agent configuration form",children:[g&&(0,m.jsx)("div",{className:"rounded-lg bg-blue-50 border border-blue-200 px-4 py-3 dark:bg-blue-900/20 dark:border-blue-800",children:(0,m.jsxs)("p",{className:"text-sm text-blue-800 dark:text-blue-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"Preset applied:"})," This agent is configured with model ",(0,m.jsx)("span",{className:"font-mono bg-blue-100 dark:bg-blue-800 px-1.5 py-0.5 rounded",children:x.model}),x.variant&&(0,m.jsxs)("span",{children:[" (variant: ",x.variant,")"]})]})}),n&&(0,m.jsxs)("div",{role:"alert",className:`flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===n.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===n.type?(0,m.jsx)(e_,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(eP,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:n.message})]}),v&&(0,m.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-zinc-200 bg-zinc-50 px-4 py-3 dark:border-zinc-800 dark:bg-zinc-900/20",children:[(0,m.jsx)(eP,{className:"mt-0.5 h-4 w-4 shrink-0 text-zinc-500 dark:text-zinc-400"}),(0,m.jsxs)("div",{className:"text-sm text-zinc-700 dark:text-zinc-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"Using default fallback chain"})," — this agent will try models in priority order:",(0,m.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:k.map((e,t)=>(0,m.jsxs)(h.Fragment,{children:[(0,m.jsx)("code",{className:`rounded px-1.5 py-0.5 text-xs ${0===t?"bg-blue-100 text-blue-800 dark:bg-blue-900/50 dark:text-blue-200 font-medium":"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400"}`,children:e}),t<k.length-1&&(0,m.jsx)("span",{className:"text-zinc-400 dark:text-zinc-500",children:"→"})]},e))}),(0,m.jsx)("p",{className:"mt-2 text-xs text-zinc-500 dark:text-zinc-400",children:"Select a model below to override the default behavior."})]})]}),y&&(0,m.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-800 dark:bg-amber-900/20",children:[(0,m.jsx)(eO,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-500 dark:text-amber-400"}),(0,m.jsxs)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:[(0,m.jsx)("span",{className:"font-medium",children:"Model unavailable"})," — ",(0,m.jsx)("code",{className:"rounded bg-amber-100 px-1 py-0.5 text-xs dark:bg-amber-800",children:b})," is missing from current providers. Please check your provider settings or select a different model."]})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"model-selector",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Model"}),(0,m.jsx)(td,{name:"model",control:o,rules:{required:"Please select a model"},render:({field:e,fieldState:t})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{id:"model-selector",children:(0,m.jsx)(iv,{value:e.value,onValueChange:e.onChange,placeholder:"Select a model..."})}),t.error&&(0,m.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",role:"alert",children:t.error.message})]})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"The AI model used for this agent."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"variant-selector",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Variant"}),(0,m.jsx)(td,{name:"variant",control:o,render:({field:e})=>(0,m.jsxs)("select",{id:"variant-selector",value:e.value,onChange:t=>e.onChange(t.target.value),className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm dark:border-zinc-800 dark:bg-zinc-950",children:[(0,m.jsx)("option",{value:"",children:"Not set"}),(0,m.jsx)("option",{value:"max",children:"max"}),(0,m.jsx)("option",{value:"high",children:"high"}),(0,m.jsx)("option",{value:"medium",children:"medium"}),(0,m.jsx)("option",{value:"low",children:"low"}),(0,m.jsx)("option",{value:"xhigh",children:"xhigh"})]})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Model reasoning variant. Higher values mean more thinking."})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"temperature-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Temperature"}),(0,m.jsx)(td,{name:"temperature",control:o,render:({field:e})=>(0,m.jsx)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e.value.toFixed(1)})})]}),(0,m.jsx)(td,{name:"temperature",control:o,render:({field:e})=>(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"temperature-slider",type:"range",min:0,max:2,step:.1,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Temperature slider"}),(0,m.jsx)("input",{type:"number",min:0,max:2,step:.1,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)||0),className:"w-16 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Temperature value"})]})}),(0,m.jsxs)("div",{className:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsx)("span",{children:"Precise (0)"}),(0,m.jsx)("span",{children:"Balanced (1)"}),(0,m.jsx)("span",{children:"Creative (2)"})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Controls randomness: lower values make responses more deterministic."})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"top-p-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Top P"}),(0,m.jsx)(td,{name:"top_p",control:o,render:({field:e})=>(0,m.jsx)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:e.value.toFixed(2)})})]}),(0,m.jsx)(td,{name:"top_p",control:o,render:({field:e})=>(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"top-p-slider",type:"range",min:0,max:1,step:.05,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Top P slider"}),(0,m.jsx)("input",{type:"number",min:0,max:1,step:.05,value:e.value,onChange:t=>e.onChange(parseFloat(t.target.value)||0),className:"w-16 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Top P value"})]})}),(0,m.jsxs)("div",{className:"flex justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsx)("span",{children:"Diverse (0)"}),(0,m.jsx)("span",{children:"Default (1)"})]}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Controls nucleus sampling: lower values sample from more likely tokens."})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"prompt-append",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Prompt Append"}),(0,m.jsx)(td,{name:"prompt_append",control:o,render:({field:e})=>(0,m.jsx)("textarea",{id:"prompt-append",value:e.value,onChange:t=>e.onChange(t.target.value),rows:4,className:"w-full rounded-lg border border-zinc-200 bg-white px-3 py-2 text-sm resize-none dark:border-zinc-800 dark:bg-zinc-950",placeholder:"Additional system instructions to append..."})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Additional instructions appended to the system prompt."})]}),(0,m.jsx)("div",{className:"flex items-center justify-end gap-3 pt-2",children:(0,m.jsxs)("button",{type:"submit",disabled:c||f.isPending,className:"inline-flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-blue-600 dark:hover:bg-blue-500",children:[(c||f.isPending)&&(0,m.jsx)(eD,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"Save Changes"]})})]})}let iP=ej("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function i_(){let e=(0,S.useQueryClient)(),[t,r]=h.useState(null),{data:n,isLoading:a}=A({queryKey:["opencode-config"],queryFn:async()=>{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch config");return e.json()}}),{control:s,handleSubmit:i,reset:o,formState:{isDirty:l,isSubmitting:d}}=t_({defaultValues:{stickyBusyDelaySeconds:1,sessionsRefreshIntervalSeconds:5}});h.useEffect(()=>{n&&o({stickyBusyDelaySeconds:"number"==typeof n.vibepulse?.stickyBusyDelayMs?Math.round(n.vibepulse.stickyBusyDelayMs/1e3):1,sessionsRefreshIntervalSeconds:"number"==typeof n.vibepulse?.sessionsRefreshIntervalMs?Math.round(n.vibepulse.sessionsRefreshIntervalMs/1e3):5})},[n,o]),h.useEffect(()=>{if(t){let e=setTimeout(()=>r(null),3e3);return()=>clearTimeout(e)}},[t]);let c=eI({mutationFn:async e=>{let t=await fetch("/api/opencode-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({vibepulse:{stickyBusyDelayMs:1e3*e.stickyBusyDelaySeconds,sessionsRefreshIntervalMs:1e3*e.sessionsRefreshIntervalSeconds}})});if(!t.ok)throw Error((await t.json()).error||"Failed to save settings");return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["opencode-config"]}),r({type:"success",message:"Settings saved successfully"})},onError:e=>{r({type:"error",message:e.message})}});return a?(0,m.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,m.jsx)(eD,{className:"h-6 w-6 animate-spin text-zinc-400"})}):(0,m.jsx)("form",{onSubmit:i(e=>{c.mutate(e)}),className:"space-y-6",children:(0,m.jsxs)("div",{className:"rounded-xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-800 dark:bg-zinc-900",children:[(0,m.jsxs)("div",{className:"mb-6 flex items-center gap-3 border-b border-zinc-100 pb-4 dark:border-zinc-800",children:[(0,m.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400",children:(0,m.jsx)(eS,{className:"h-4 w-4"})}),(0,m.jsx)("h3",{className:"text-lg font-medium text-zinc-900 dark:text-zinc-100",children:"Application Settings"})]}),t&&(0,m.jsxs)("div",{role:"alert",className:`mb-6 flex items-center gap-2 rounded-lg px-4 py-3 text-sm ${"success"===t.type?"bg-emerald-50 text-emerald-800 dark:bg-emerald-900/20 dark:text-emerald-300":"bg-red-50 text-red-800 dark:bg-red-900/20 dark:text-red-300"}`,children:["success"===t.type?(0,m.jsx)(e_,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):(0,m.jsx)(eP,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}),(0,m.jsx)("span",{children:t.message})]}),(0,m.jsxs)("div",{className:"space-y-8",children:[(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"sticky-busy-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Sticky Busy Delay"}),(0,m.jsx)(td,{name:"stickyBusyDelaySeconds",control:s,render:({field:e})=>(0,m.jsxs)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:[e.value,"s"]})})]}),(0,m.jsx)(td,{name:"stickyBusyDelaySeconds",control:s,render:({field:e})=>(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"sticky-busy-slider",type:"range",min:0,max:60,step:1,value:e.value,onChange:t=>e.onChange(parseInt(t.target.value,10)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Sticky busy delay slider"}),(0,m.jsx)("input",{type:"number",min:0,max:300,step:1,value:e.value,onChange:t=>e.onChange(parseInt(t.target.value,10)||0),className:"w-20 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Sticky busy delay value"})]})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:'The duration to keep a session marked as "busy" after activity stops. This prevents the UI from flickering when agents pause briefly. Default is 1 second.'})]}),(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("label",{htmlFor:"refresh-interval-slider",className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Sessions Refresh Interval"}),(0,m.jsx)(td,{name:"sessionsRefreshIntervalSeconds",control:s,render:({field:e})=>(0,m.jsxs)("span",{className:"rounded-md bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-700 dark:bg-zinc-800 dark:text-zinc-300",children:[e.value,"s"]})})]}),(0,m.jsx)(td,{name:"sessionsRefreshIntervalSeconds",control:s,render:({field:e})=>(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("input",{id:"refresh-interval-slider",type:"range",min:1,max:30,step:1,value:e.value,onChange:t=>e.onChange(parseInt(t.target.value,10)),className:"flex-1 h-2 cursor-pointer appearance-none rounded-lg bg-zinc-200 accent-blue-600 dark:bg-zinc-700","aria-label":"Sessions refresh interval slider"}),(0,m.jsx)("input",{type:"number",min:1,max:300,step:1,value:e.value,onChange:t=>e.onChange(parseInt(t.target.value,10)||1),className:"w-20 rounded-lg border border-zinc-200 bg-white px-2 py-1 text-center text-sm dark:border-zinc-800 dark:bg-zinc-950","aria-label":"Sessions refresh interval value"})]})}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"How often the board polls the server for session updates. Lower values provide more real-time feedback but increase server load. Default is 5 seconds."})]})]}),(0,m.jsx)("div",{className:"mt-8 flex justify-end border-t border-zinc-100 pt-6 dark:border-zinc-800",children:(0,m.jsxs)("button",{type:"submit",disabled:!l||d||c.isPending,className:"flex items-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-sm font-medium text-white shadow-sm transition-colors hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:hover:bg-blue-500 dark:focus:ring-offset-zinc-900",children:[d||c.isPending?(0,m.jsx)(eD,{className:"h-4 w-4 animate-spin"}):(0,m.jsx)(iP,{className:"h-4 w-4"}),"Save Settings"]})})]})})}let iV=[{key:"default",name:"Default",description:"Fallback configuration"},{key:"sisyphus",name:"Sisyphus",description:"Task execution agent"},{key:"hephaestus",name:"Hephaestus",description:"Build & automation"},{key:"prometheus",name:"Prometheus",description:"Planning agent"},{key:"oracle",name:"Oracle",description:"Knowledge & research"},{key:"metis",name:"Metis",description:"Strategy & consultation"},{key:"momus",name:"Momus",description:"Review & critique"},{key:"atlas",name:"Atlas",description:"Execution-focused"},{key:"librarian",name:"Librarian",description:"Documentation & exploration"},{key:"explore",name:"Explore",description:"Code navigation"}];function i$({open:e,onClose:t}){let[r,n]=h.useState("general"),[a,s]=h.useState("default"),[i,o]=h.useState(""),l=h.useRef(null),{data:d}=A({queryKey:["opencode-config"],queryFn:async()=>{let e=await fetch("/api/opencode-config");if(!e.ok)throw Error("Failed to fetch config");return e.json()},enabled:e}),{data:c}=A({queryKey:["opencode-models"],queryFn:async()=>{var e;let t=await fetch("/api/opencode-models"),r=null;try{r=await t.json()}catch{r=null}let n=r&&"object"==typeof r&&"error"in r&&"string"==typeof r.error?r.error:null;if(!t.ok||n)throw Error(n||`Failed to fetch models (${t.status})`);if(!((e=r)&&"object"==typeof e&&Array.isArray(e.models)))throw Error("Invalid models response");return r},enabled:e,retry:!1}),u=h.useMemo(()=>new Set(c?.models??[]),[c]),p=h.useCallback(e=>{let t=d?.agents?.[e];return t?.model?u.size>0&&!u.has(t.model)?"invalid":"ok":"unconfigured"},[d,u]),f=h.useMemo(()=>iV.filter(e=>"invalid"===p(e.key)).length,[p]);h.useEffect(()=>{if(!e)return;let r=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t]),h.useEffect(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}},[e]),h.useEffect(()=>{e&&setTimeout(()=>l.current?.focus(),100)},[e]);let x=h.useMemo(()=>{if(!i.trim())return iV;let e=i.toLowerCase();return iV.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)||(d?.agents?.[t.key]?.model||"").toLowerCase().includes(e))},[i,d]),g=iV.find(e=>e.key===a);return e?(0,m.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col bg-white dark:bg-zinc-950",children:[(0,m.jsxs)("header",{className:"flex h-16 items-center justify-between border-b border-zinc-200 px-6 dark:border-zinc-800",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-blue-600 text-white",children:(0,m.jsx)(eS,{className:"h-5 w-5"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h1",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:"Settings"}),(0,m.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Manage application and agent configuration"})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1 rounded-lg bg-zinc-100 p-1 dark:bg-zinc-800",children:[(0,m.jsx)("button",{type:"button",onClick:()=>n("general"),className:`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${"general"===r?"bg-blue-600 text-white shadow-sm":"text-zinc-600 hover:bg-zinc-200 dark:text-zinc-400 dark:hover:bg-zinc-700"}`,children:"General"}),(0,m.jsx)("button",{type:"button",onClick:()=>n("agents"),className:`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${"agents"===r?"bg-blue-600 text-white shadow-sm":"text-zinc-600 hover:bg-zinc-200 dark:text-zinc-400 dark:hover:bg-zinc-700"}`,children:"Agents"}),(0,m.jsx)("button",{type:"button",onClick:()=>n("categories"),className:`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${"categories"===r?"bg-blue-600 text-white shadow-sm":"text-zinc-600 hover:bg-zinc-200 dark:text-zinc-400 dark:hover:bg-zinc-700"}`,children:"Categories"}),(0,m.jsx)("button",{type:"button",onClick:()=>n("profiles"),className:`rounded-md px-4 py-1.5 text-sm font-medium transition-colors ${"profiles"===r?"bg-blue-600 text-white shadow-sm":"text-zinc-600 hover:bg-zinc-200 dark:text-zinc-400 dark:hover:bg-zinc-700"}`,children:"Profiles"})]}),(0,m.jsx)("button",{type:"button",onClick:t,className:"flex h-9 w-9 items-center justify-center rounded-lg text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200","aria-label":"Close panel",children:(0,m.jsx)(eE,{className:"h-5 w-5"})})]}),"general"===r?(0,m.jsx)("main",{className:"flex-1 overflow-y-auto bg-white dark:bg-zinc-950",children:(0,m.jsxs)("div",{className:"mx-auto max-w-4xl p-8",children:[(0,m.jsxs)("div",{className:"mb-8",children:[(0,m.jsx)("h2",{className:"text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:"General Settings"}),(0,m.jsx)("p",{className:"text-zinc-500 dark:text-zinc-400",children:"Manage application-wide behavior and preferences"})]}),(0,m.jsx)(i_,{})]})}):"agents"===r?(0,m.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[(0,m.jsxs)("aside",{className:"flex w-[280px] flex-col border-r border-zinc-200 bg-zinc-50/50 dark:border-zinc-800 dark:bg-zinc-900/20",children:[(0,m.jsx)("div",{className:"border-b border-zinc-200 p-4 dark:border-zinc-800",children:(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)(eR,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-zinc-400"}),(0,m.jsx)("input",{ref:l,type:"text",value:i,onChange:e=>o(e.target.value),placeholder:"Search agents...",className:"h-10 w-full rounded-lg border border-zinc-200 bg-white pl-9 pr-4 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-800 dark:bg-zinc-950 dark:text-zinc-100 dark:placeholder:text-zinc-600"})]})}),(0,m.jsxs)("nav",{className:"flex-1 overflow-y-auto p-2",children:[(0,m.jsx)("div",{className:"space-y-1",children:x.map(e=>{let t,r=d?.agents?.[e.key]?.model;return(0,m.jsxs)("button",{type:"button",onClick:()=>s(e.key),className:`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors ${a===e.key?"bg-blue-600 text-white":"text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800"}`,children:[(0,m.jsx)("div",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md ${a===e.key?"bg-white/20":"bg-zinc-200 dark:bg-zinc-800"}`,children:(0,m.jsx)(eA,{className:`h-4 w-4 ${a===e.key?"text-white":"text-zinc-600 dark:text-zinc-400"}`})}),(0,m.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 truncate text-sm font-medium",children:[e.name,"unconfigured"===(t=p(e.key))?(0,m.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${a===e.key?"bg-zinc-300":"bg-zinc-400 dark:bg-zinc-500"}`,title:"Inherits category configuration"}):"invalid"===t?(0,m.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${a===e.key?"bg-amber-300":"bg-amber-500"}`,title:"Model not available"}):(0,m.jsx)("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${a===e.key?"bg-emerald-300":"bg-emerald-500"}`,title:"Configured"})]}),(0,m.jsx)("div",{className:`truncate text-xs ${a===e.key?"text-blue-100":"text-zinc-500 dark:text-zinc-500"}`,children:e.description}),r&&(0,m.jsx)("div",{className:`mt-1 inline-flex max-w-full items-start rounded-md px-1.5 py-0.5 text-[11px] leading-4 ${a===e.key?"bg-white/15 text-blue-50/95":"bg-zinc-200/70 text-zinc-700 dark:bg-zinc-800/80 dark:text-zinc-300"}`,title:r,children:(0,m.jsx)("span",{className:"font-mono break-all [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden",children:r})})]}),a===e.key&&(0,m.jsx)(eT,{className:"h-4 w-4 shrink-0 text-blue-200"})]},e.key)})}),0===x.length&&(0,m.jsx)("div",{className:"py-8 text-center",children:(0,m.jsx)("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"No agents found"})})]}),(0,m.jsx)("div",{className:"border-t border-zinc-200 p-4 dark:border-zinc-800",children:(0,m.jsxs)("div",{className:"flex items-center justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[(0,m.jsxs)("span",{className:"flex items-center gap-1.5",children:[iV.length," agents",f>0&&(0,m.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:[(0,m.jsx)(eO,{className:"h-2.5 w-2.5"}),f," need attention"]})]}),(0,m.jsx)("kbd",{className:"rounded bg-zinc-200 px-1.5 py-0.5 font-mono dark:bg-zinc-800",children:"ESC"})]})})]}),(0,m.jsx)("main",{className:"flex-1 overflow-y-auto bg-white dark:bg-zinc-950",children:(0,m.jsxs)("div",{className:"mx-auto max-w-3xl p-8",children:[(0,m.jsxs)("div",{className:"mb-8 flex items-center gap-4",children:[(0,m.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-blue-500 to-indigo-600 text-white shadow-lg",children:(0,m.jsx)(eA,{className:"h-8 w-8"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h2",{className:"text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:g?.name}),(0,m.jsx)("p",{className:"text-zinc-500 dark:text-zinc-400",children:g?.description})]})]}),(0,m.jsx)(iD,{agentName:a})]})})]}):"categories"===r?(0,m.jsx)("main",{className:"flex-1 overflow-y-auto bg-white dark:bg-zinc-950",children:(0,m.jsxs)("div",{className:"mx-auto max-w-4xl p-8",children:[(0,m.jsxs)("div",{className:"mb-8",children:[(0,m.jsx)("h2",{className:"text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:"Categories"}),(0,m.jsx)("p",{className:"text-zinc-500 dark:text-zinc-400",children:"Manage agent categories and their configurations"})]}),(0,m.jsx)(ij,{})]})}):(0,m.jsx)("main",{className:"flex-1 overflow-y-auto bg-white dark:bg-zinc-950",children:(0,m.jsxs)("div",{className:"mx-auto max-w-4xl p-8",children:[(0,m.jsxs)("div",{className:"mb-8",children:[(0,m.jsx)("h2",{className:"text-2xl font-bold text-zinc-900 dark:text-zinc-100",children:"Profiles"}),(0,m.jsx)("p",{className:"text-zinc-500 dark:text-zinc-400",children:"Manage configuration profiles for different agent setups"})]}),(0,m.jsx)(iM,{})]})})]}):null}let iU=ej("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),iq=ej("pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),iB=ej("key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]),iH="vibepulse:host-filter:v1",iW="local";function iK(){try{let e=localStorage.getItem(iH);if(!e)return"all";let t=JSON.parse(e);if("string"==typeof t&&""!==t.trim()){let e=t.trim();if(e===iW)return"local";return e}return"all"}catch{return"all"}}function iQ({open:e,onClose:t,hostSources:r,isNodeMode:n=!1}){let{remoteHosts:a,addRemoteHost:s,editRemoteHost:i,deleteRemoteHost:o,toggleRemoteHost:l}=r,[d,c]=(0,h.useState)(null),[u,p]=(0,h.useState)(!1),[f,x]=(0,h.useState)({hostLabel:"",baseUrl:"",token:""}),[g,b]=(0,h.useState)(!1),[y,v]=(0,h.useState)(null),[k,w]=(0,h.useState)(!1),j=async(e,t)=>{v(null);try{await e()}catch(e){v(e instanceof Error?e.message:t)}};(0,h.useEffect)(()=>{if(e){let e=window.getComputedStyle(document.body).overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}}p(!1),c(null),v(null),x({hostLabel:"",baseUrl:"",token:""}),b(!1),w(!1)},[e]),(0,h.useEffect)(()=>{if(!e)return;let r=e=>{"Escape"===e.key&&t()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,t]);let z=async()=>{let e;v(null);let t=f.hostLabel.trim();if(!t)return void v("Label is required");let r=(e=function(e){let t=e.trim();if(!t)return{ok:!1,error:"empty"};try{let e=new URL(t);if("http:"!==e.protocol&&"https:"!==e.protocol)return{ok:!1,error:"unsupported_protocol"};if(e.username||e.password)return{ok:!1,error:"credentials_not_allowed"};return{ok:!0,normalizedBaseUrl:(e.search="",e.hash="",e.toString().replace(/\/+$/,""))}}catch{return{ok:!1,error:"invalid"}}}(f.baseUrl)).ok?null:"unsupported_protocol"===e.error?"Node URL must use http:// or https://":"credentials_not_allowed"===e.error?"Node URL must not include a username or password":"A valid Node URL is required (e.g., http://localhost:3000)";if(r)return void v(r);w(!0);try{if(u)await s({hostId:"",hostLabel:t,baseUrl:f.baseUrl,enabled:!0,token:f.token.trim()}),p(!1);else if(d){let e=a.find(e=>e.hostId===d);if(e){let r=f.token.trim(),n=g?"":r||void 0;await i(d,{...e,hostLabel:t,baseUrl:f.baseUrl,token:n})}c(null)}x({hostLabel:"",baseUrl:"",token:""}),b(!1)}catch(e){v(e instanceof Error?e.message:"An error occurred")}finally{w(!1)}},N=()=>{p(!1),c(null),x({hostLabel:"",baseUrl:"",token:""}),b(!1),v(null)};return e?(0,m.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4 backdrop-blur-sm","data-testid":"host-manager",children:(0,m.jsxs)("div",{className:"flex max-h-[85vh] w-full max-w-lg flex-col overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-2xl dark:border-zinc-800 dark:bg-zinc-950",children:[(0,m.jsxs)("header",{className:"flex h-14 items-center justify-between border-b border-zinc-200 px-5 dark:border-zinc-800",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,m.jsx)(eN,{className:"h-5 w-5 text-blue-600 dark:text-blue-500"}),(0,m.jsx)("h2",{className:"text-base font-semibold text-zinc-900 dark:text-zinc-100",children:"Nodes"})]}),(0,m.jsx)("button",{type:"button",onClick:t,className:"flex h-8 w-8 items-center justify-center rounded-lg text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-700 dark:text-zinc-400 dark:hover:bg-zinc-800 dark:hover:text-zinc-200","aria-label":"Close node manager",children:(0,m.jsx)(eE,{className:"h-4 w-4"})})]}),(0,m.jsx)("main",{className:"flex-1 overflow-y-auto p-5",children:n?(0,m.jsx)("div",{className:"rounded-lg border border-yellow-200 bg-yellow-50 p-4 dark:border-yellow-900/50 dark:bg-yellow-900/20",children:(0,m.jsxs)("div",{className:"flex items-start gap-3",children:[(0,m.jsx)(eP,{className:"mt-0.5 h-5 w-5 text-yellow-600 dark:text-yellow-500"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-400",children:"Node Mode Active"}),(0,m.jsx)("p",{className:"mt-1 text-sm text-yellow-700 dark:text-yellow-500",children:"Remote node configuration is disabled while running in node mode to prevent nested hub configurations."})]})]})}):(0,m.jsxs)("div",{className:"space-y-3",children:[y&&!u&&!d&&(0,m.jsxs)("div",{className:"flex items-center gap-1.5 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900/50 dark:bg-red-900/20 dark:text-red-400",children:[(0,m.jsx)(eP,{className:"h-3.5 w-3.5"}),(0,m.jsx)("span",{children:y})]}),(0,m.jsxs)("div",{"data-testid":"host-row-local",className:"flex items-center justify-between rounded-lg border border-zinc-200 bg-zinc-50/50 p-3 dark:border-zinc-800 dark:bg-zinc-900/20",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-md bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:(0,m.jsx)(eN,{className:"h-4 w-4"})}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:"Local"}),(0,m.jsx)("div",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Auto-discovered processes"})]})]}),(0,m.jsx)("div",{className:"flex items-center",children:(0,m.jsx)("span",{className:"inline-flex items-center rounded-full bg-blue-50 px-2 py-0.5 text-xs font-medium text-blue-700 ring-1 ring-inset ring-blue-700/10 dark:bg-blue-400/10 dark:text-blue-400 dark:ring-blue-400/30",children:"Built-in"})})]}),a.map(e=>{let t=d===e.hostId,r=e.hostId.replace(/[^a-zA-Z0-9-]/g,"-").toLowerCase();return(0,m.jsx)("div",{"data-testid":`host-row-remote-${r}`,className:`flex flex-col gap-3 rounded-lg border p-3 transition-colors ${t?"border-blue-500 bg-blue-50/30 dark:border-blue-500/50 dark:bg-blue-900/10":"border-zinc-200 bg-white hover:border-zinc-300 dark:border-zinc-800 dark:bg-zinc-950 dark:hover:border-zinc-700"}`,children:t?(0,m.jsxs)("div",{className:"space-y-3",children:[(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"edit-hostLabel",className:"text-xs font-medium text-zinc-700 dark:text-zinc-300",children:"Node Label"}),(0,m.jsx)("input",{id:"edit-hostLabel","data-testid":"host-form-label",type:"text",value:f.hostLabel,onChange:e=>x({...f,hostLabel:e.target.value}),className:"w-full rounded-md border border-zinc-300 bg-white px-3 py-1.5 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100",placeholder:"e.g., Production Node",disabled:k})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"edit-baseUrl",className:"text-xs font-medium text-zinc-700 dark:text-zinc-300",children:"Node URL"}),(0,m.jsx)("input",{id:"edit-baseUrl","data-testid":"host-form-base-url",type:"url",value:f.baseUrl,onChange:e=>x({...f,baseUrl:e.target.value}),className:"w-full rounded-md border border-zinc-300 bg-white px-3 py-1.5 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100",placeholder:"https://node.example.com",disabled:k})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsxs)("label",{htmlFor:"edit-token",className:"text-xs font-medium text-zinc-700 dark:text-zinc-300 flex items-center gap-1.5",children:[(0,m.jsx)(iB,{className:"h-3.5 w-3.5"}),"Update Token (optional)"]}),(0,m.jsx)("input",{id:"edit-token","data-testid":"host-form-token",type:"password",value:f.token,onChange:e=>{let t=e.target.value;x({...f,token:t}),g&&t.trim().length>0&&b(!1)},className:"w-full rounded-md border border-zinc-300 bg-white px-3 py-1.5 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100",placeholder:"Leave blank to keep existing token",disabled:k||g}),(0,m.jsxs)("label",{htmlFor:"edit-clear-token",className:"flex items-center gap-2 text-xs text-zinc-600 dark:text-zinc-400",children:[(0,m.jsx)("input",{id:"edit-clear-token",type:"checkbox",checked:g,onChange:e=>b(e.target.checked),disabled:k,className:"h-3.5 w-3.5 rounded border-zinc-300 text-blue-600 focus:ring-blue-500"}),"Clear saved token on save"]})]}),y&&(0,m.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-red-600 dark:text-red-400",children:[(0,m.jsx)(eP,{className:"h-3.5 w-3.5"}),(0,m.jsx)("span",{children:y})]}),(0,m.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,m.jsx)("button",{type:"button",onClick:N,disabled:k,className:"rounded-md px-3 py-1.5 text-xs font-medium text-zinc-600 hover:bg-zinc-100 disabled:opacity-50 dark:text-zinc-400 dark:hover:bg-zinc-800",children:"Cancel"}),(0,m.jsxs)("button",{type:"button",onClick:z,disabled:k,className:"inline-flex items-center gap-1.5 rounded-md bg-blue-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-blue-700 disabled:opacity-50",children:[(0,m.jsx)(e_,{className:"h-3.5 w-3.5"}),k?"Saving...":"Save"]})]})]}):(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("div",{className:`flex h-8 w-8 items-center justify-center rounded-md ${e.enabled?"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400":"bg-zinc-50 text-zinc-400 dark:bg-zinc-900 dark:text-zinc-600"}`,children:(0,m.jsx)(iU,{className:"h-4 w-4"})}),(0,m.jsxs)("div",{className:e.enabled?"":"opacity-60",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("div",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:e.hostLabel}),e.tokenConfigured&&(0,m.jsx)(iB,{className:"h-3 w-3 text-zinc-400","aria-label":"Token configured"})]}),(0,m.jsx)("div",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:e.baseUrl})]})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1",children:[(0,m.jsx)("button",{type:"button",onClick:()=>{j(()=>l(e.hostId,!e.enabled),"Failed to toggle node")},className:`rounded-md px-2.5 py-1 text-xs font-medium transition-colors ${e.enabled?"text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800":"text-blue-600 hover:bg-blue-50 dark:text-blue-400 dark:hover:bg-blue-900/20"}`,children:e.enabled?"Disable":"Enable"}),(0,m.jsx)("button",{type:"button",onClick:()=>{c(e.hostId),x({hostLabel:e.hostLabel,baseUrl:e.baseUrl,token:""}),b(!1),p(!1),v(null)},className:"rounded-md p-1.5 text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-200","aria-label":"Edit node",children:(0,m.jsx)(iq,{className:"h-3.5 w-3.5"})}),(0,m.jsx)("button",{type:"button",onClick:()=>{j(()=>o(e.hostId),"Failed to delete node")},className:"rounded-md p-1.5 text-zinc-400 transition-colors hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-900/20 dark:hover:text-red-400","aria-label":"Delete node",children:(0,m.jsx)(e$,{className:"h-3.5 w-3.5"})})]})]})},e.hostId)}),u?(0,m.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-blue-500 bg-blue-50/30 p-3 dark:border-blue-500/50 dark:bg-blue-900/10",children:[(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"add-hostLabel",className:"text-xs font-medium text-zinc-700 dark:text-zinc-300",children:"Node Label"}),(0,m.jsx)("input",{id:"add-hostLabel","data-testid":"host-form-label",type:"text",value:f.hostLabel,onChange:e=>x({...f,hostLabel:e.target.value}),className:"w-full rounded-md border border-zinc-300 bg-white px-3 py-1.5 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100",placeholder:"e.g., Remote Node",disabled:k})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsx)("label",{htmlFor:"add-baseUrl",className:"text-xs font-medium text-zinc-700 dark:text-zinc-300",children:"Node URL"}),(0,m.jsx)("input",{id:"add-baseUrl","data-testid":"host-form-base-url",type:"url",value:f.baseUrl,onChange:e=>x({...f,baseUrl:e.target.value}),className:"w-full rounded-md border border-zinc-300 bg-white px-3 py-1.5 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100",placeholder:"https://node.example.com",disabled:k})]}),(0,m.jsxs)("div",{className:"space-y-2",children:[(0,m.jsxs)("label",{htmlFor:"add-token",className:"text-xs font-medium text-zinc-700 dark:text-zinc-300 flex items-center gap-1.5",children:[(0,m.jsx)(iB,{className:"h-3.5 w-3.5"}),"Access Token (optional)"]}),(0,m.jsx)("input",{id:"add-token","data-testid":"host-form-token",type:"password",value:f.token,onChange:e=>x({...f,token:e.target.value}),className:"w-full rounded-md border border-zinc-300 bg-white px-3 py-1.5 text-sm text-zinc-900 placeholder:text-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100",placeholder:"Leave blank only on trusted networks",disabled:k}),(0,m.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:"Recommended: set a token unless this node is only reachable on a trusted private network."})]}),y&&(0,m.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-red-600 dark:text-red-400",children:[(0,m.jsx)(eP,{className:"h-3.5 w-3.5"}),(0,m.jsx)("span",{children:y})]}),(0,m.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,m.jsx)("button",{type:"button",onClick:N,disabled:k,className:"rounded-md px-3 py-1.5 text-xs font-medium text-zinc-600 hover:bg-zinc-100 disabled:opacity-50 dark:text-zinc-400 dark:hover:bg-zinc-800",children:"Cancel"}),(0,m.jsxs)("button",{type:"button",onClick:z,disabled:k,className:"inline-flex items-center gap-1.5 rounded-md bg-blue-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-blue-700 disabled:opacity-50",children:[(0,m.jsx)(e_,{className:"h-3.5 w-3.5"}),k?"Adding...":"Add Node"]})]})]}):(0,m.jsxs)("button",{type:"button",onClick:()=>{p(!0),c(null),x({hostLabel:"",baseUrl:"",token:""}),b(!1),v(null)},className:"flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-zinc-300 py-3 text-sm font-medium text-zinc-600 transition-colors hover:border-zinc-400 hover:bg-zinc-50 hover:text-zinc-900 dark:border-zinc-700 dark:text-zinc-400 dark:hover:border-zinc-600 dark:hover:bg-zinc-900/50 dark:hover:text-zinc-100",children:[(0,m.jsx)(iz,{className:"h-4 w-4"}),"Add Remote Node"]})]})})]})}):null}let iJ={hostId:"local",hostLabel:"Local",hostKind:"local"},iG="vibepulse:host-sources-changed";function iY(e){return{...e,hostKind:"remote"}}function iX(e,t){if("all"===e||"local"===e)return e;let r=t.find(t=>t.hostId===e);return r&&r.enabled?r.hostId:"all"}function iZ(e){"all"===e||"local"===e?localStorage.setItem(iH,JSON.stringify(e)):"string"==typeof e&&""!==e.trim()&&e!==iW?localStorage.setItem(iH,JSON.stringify(e.trim())):localStorage.setItem(iH,JSON.stringify("all")),window.dispatchEvent(new Event(iG))}async function i0(){let e=await fetch("/api/nodes");if(!e.ok)throw Error("Failed to fetch nodes");return((await e.json()).nodes||[]).map(e=>({hostId:e.nodeId,hostLabel:e.nodeLabel,baseUrl:e.baseUrl,enabled:e.enabled,tokenConfigured:e.tokenConfigured}))}let i1=[{label:"1d",days:1},{label:"3d",days:3},{label:"7d",days:7},{label:"30d",days:30},{label:"All",days:0}],i2="opencode --port <PORT>";function i5(){let e,t,r,n,a,s,i,o,l,d,c,u,p,f,x;e=(0,S.useQueryClient)(),t=(0,h.useRef)(null),r=(0,h.useRef)(0),n=(0,h.useRef)(null),a=(0,h.useRef)(null),s=(0,h.useRef)(!1),i=(0,h.useRef)(!0),o=(0,h.useRef)(null),l=(0,h.useRef)(new Map),d=(0,h.useCallback)(()=>{n.current||(n.current=setTimeout(()=>{e.invalidateQueries({queryKey:["sessions"]},{cancelRefetch:!1}),n.current=null},500))},[e]),c=(0,h.useCallback)(e=>{let t=l.current.get(e);t&&(clearTimeout(t),l.current.delete(e))},[]),u=(0,h.useCallback)(t=>{e.setQueriesData({queryKey:["sessions"]},t)},[e]),p=(0,h.useCallback)((e,t)=>{u(r=>{if(!r?.sessions)return r;let n=!1,a=r.sessions.map(r=>r.id===e?(n=!0,{...r,waitingForUser:t}):r.children?.some(t=>t.id===e)?(n=!0,{...r,children:r.children.map(r=>r.id===e?{...r,waitingForUser:t}:r)}):r);return n?{...r,sessions:a}:r})},[u]),f=(0,h.useCallback)((e,t)=>{c(e);let r=setTimeout(()=>{l.current.delete(e),t&&eo(e,!0),p(e,!0)},1500);l.current.set(e,r)},[c,p]),x=(0,h.useCallback)(e=>{var t;let r=ed(e)?e.source:es,n=ed(e)?e.event:e,a="payload"in n?n.payload:n,s=a.properties?.sessionID?et(r.hostId,er(t=a.properties.sessionID)??t):null,o=r.hostId===ea;if(!a?.type)return void d();let l="question.asked"===a.type||"permission.asked"===a.type,m="question.replied"===a.type||"question.rejected"===a.type||"permission.replied"===a.type;(s&&l&&o&&eo(s,!0),s&&m&&(c(s),o&&eo(s,!1)),["session.status","session.updated","session.created","session.deleted","question.asked","permission.asked","permission.updated","question.replied","question.rejected","permission.replied","session.archived"].includes(a.type))?u(e=>{if(!e?.sessions)return d(),e;switch(a.type){case"session.updated":case"session.created":{let t=a.properties?.info;if(!t)return d(),e;let n=function e(t,r){let n=er(t.rawSessionId??t.id)??t.rawSessionId??t.id,a=et(r.hostId,n),s=t.parentID?er(t.parentID)??t.parentID:t.parentID;return{...t,id:a,parentID:s?et(r.hostId,s):s,hostId:r.hostId,hostLabel:r.hostLabel,hostKind:r.hostKind,rawSessionId:n,sourceSessionKey:a,readOnly:"remote"===r.hostKind,children:t.children?.map(t=>e({...t,parentID:t.parentID??n},r))}}(t,r);if(n.parentID){let t=!1,r=e.sessions.map(e=>{let r=e.children?.some(e=>e.id===n.id),a=e.id===n.parentID;if(!r&&!a)return e;t=!0;let s=e.children||[],i=s.find(e=>e.id===n.id),o=el({...i,...n,realTimeStatus:n.realTimeStatus??i?.realTimeStatus??"busy",waitingForUser:n.waitingForUser??i?.waitingForUser});return i?{...e,children:s.map(e=>e.id===n.id?o:e)}:{...e,children:[...s,o]}});if(!t)return d(),e;return{...e,sessions:r}}let s=e.sessions.find(e=>e.id===n.id);if(!s)return d(),{...e,sessions:[el(n),...e.sessions]};let i={...s,...n,projectName:s.projectName,branch:s.branch,realTimeStatus:n.realTimeStatus??s.realTimeStatus,waitingForUser:n.waitingForUser??s.waitingForUser,children:s.children};return{...e,sessions:e.sessions.map(e=>e.id===n.id?i:e)}}case"session.deleted":{let t=a.properties?.info,n=t?.id??a.properties?.sessionID;if(!n)return d(),e;let s=et(r.hostId,er(n)??n);return{...e,sessions:e.sessions.filter(e=>e.id!==s)}}default:{if(!s)return d(),e;let t=e=>{switch(a.type){case"session.status":{var t;let r=a.properties?.status?.type;if(!r)return e;t=e.id,ei.set(t,{status:r,timestamp:Date.now()});let n=!e.parentID,s="busy"===r||"retry"===r;return"retry"!==r||i.current||Y("play-alert","Skipped playAlertSound() because muted","playAlertSound() failed",(e,t)=>{let r=e.createOscillator(),n=e.createGain();r.type="triangle",r.frequency.setValueAtTime(880,t),r.frequency.exponentialRampToValueAtTime(698,t+.25),n.gain.setValueAtTime(.3,t),n.gain.exponentialRampToValueAtTime(.001,t+.35),r.connect(n),n.connect(e.destination),r.start(t),r.stop(t+.35);let a=e.createOscillator(),s=e.createGain();a.type="triangle",a.frequency.setValueAtTime(698,t+.2),a.frequency.exponentialRampToValueAtTime(523,t+.45),s.gain.setValueAtTime(.25,t+.2),s.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(s),s.connect(e.destination),a.start(t+.2),a.stop(t+.5)}),"idle"===r&&(c(e.id),!n&&o&&eo(e.id,!1)),"retry"===r&&(c(e.id),o&&eo(e.id,!0)),"busy"===r&&c(e.id),"idle"===r&&n&&(e.children?.length||0)>0&&d(),{...e,time:s?{...e.time||{},archived:void 0}:e.time,realTimeStatus:r,waitingForUser:"retry"===r||("idle"!==r||!!n)&&e.waitingForUser,children:e.children}}case"question.asked":case"permission.asked":return i.current||setTimeout(()=>void Y("play-attention","Skipped playAttentionSound() because muted","playAttentionSound() failed",(e,t)=>{let r=e.createOscillator(),n=e.createGain();r.type="sine",r.frequency.value=523,n.gain.setValueAtTime(.3,t),n.gain.exponentialRampToValueAtTime(.001,t+.2),r.connect(n),n.connect(e.destination),r.start(t),r.stop(t+.2);let a=e.createOscillator(),s=e.createGain();a.type="sine",a.frequency.value=659,s.gain.setValueAtTime(.3,t+.15),s.gain.exponentialRampToValueAtTime(.001,t+.4),a.connect(s),s.connect(e.destination),a.start(t+.15),a.stop(t+.4);let i=e.createOscillator(),o=e.createGain();i.type="sine",i.frequency.value=784,o.gain.setValueAtTime(.25,t+.3),o.gain.exponentialRampToValueAtTime(.001,t+.55),i.connect(o),o.connect(e.destination),i.start(t+.3),i.stop(t+.55)}),250),o&&eo(s,!0),f(s,o),{...e,time:{...e.time||{},archived:void 0},waitingForUser:!0};case"permission.updated":return c(s),d(),e;case"question.replied":case"question.rejected":case"permission.replied":return c(s),o&&eo(s,!1),{...e,waitingForUser:!1};case"session.archived":return{...e,time:{...e.time||{},archived:Date.now()}};default:return e}},r=!1,n=e.sessions.map(e=>e.id===s?(r=!0,t(e)):e.children?.some(e=>e.id===s)?(r=!0,"session.status"===a.type&&a.properties?.status?.type==="idle")?{...e,children:e.children.filter(e=>e.id!==s)}:{...e,children:e.children.map(e=>e.id===s?t(e):e)}:e);if(!r)return d(),e;return{...e,sessions:n}}}}):d()},[u,d,c,f]),(0,h.useEffect)(()=>(o.current=setTimeout(()=>{i.current=!1},3e3),()=>{o.current&&clearTimeout(o.current)}),[]),(0,h.useEffect)(()=>{let e=null,n=l.current,i=()=>{t.current&&(clearTimeout(t.current),t.current=null),a.current&&(clearTimeout(a.current),a.current=null),(e=new EventSource("/api/opencode-events")).onopen=()=>{r.current=0,s.current=!1,a.current=setTimeout(()=>{e&&(s.current=!0,e.close(),d(),i())},15e3)},e.onmessage=e=>{try{let t=JSON.parse(e.data);x(t),r.current=0}catch(e){console.error("Failed to parse SSE event:",e)}},e.onerror=()=>{if(e?.close(),a.current&&(clearTimeout(a.current),a.current=null),s.current){s.current=!1;return}r.current<5&&(t.current=setTimeout(()=>{r.current++,i()},1e3*Math.pow(2,r.current)))}};return i(),()=>{for(let r of(e?.close(),t.current&&(clearTimeout(t.current),t.current=null),a.current&&(clearTimeout(a.current),a.current=null),n.values()))clearTimeout(r);n.clear()}},[x,d]);let[g,b]=(0,h.useState)("unknown"),y=function(e={}){let t=e.runtimeRole??"hub",r="hub"!==t,n=(0,S.useQueryClient)(),[a,s]=(0,h.useState)(()=>iK()),{data:i=[],isLoading:o,error:l}=A({queryKey:["nodes"],queryFn:i0,enabled:!r}),d=(0,h.useMemo)(()=>iX(a,i),[a,i]),c="unknown"!==t&&(r||!o&&!l);(0,h.useEffect)(()=>{let e=()=>{s(iK())};return window.addEventListener(iG,e),window.addEventListener("storage",e),()=>{window.removeEventListener(iG,e),window.removeEventListener("storage",e)}},[]),(0,h.useEffect)(()=>{d===a||c&&iZ(d)},[d,a,c]);let u=(0,h.useCallback)(e=>{let t=iX(e,i);s(t),iZ(t)},[i]),m=eI({mutationFn:async e=>{let t=await fetch("/api/nodes",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeLabel:e.hostLabel,baseUrl:e.baseUrl,token:e.token||"",enabled:e.enabled})});if(!t.ok)throw Error((await t.json()).error||"Failed to add node");return t.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["nodes"]})}}),p=eI({mutationFn:async({hostId:e,nextHost:t})=>{let r={nodeId:e,nodeLabel:t.hostLabel,baseUrl:t.baseUrl,enabled:t.enabled};void 0!==t.token&&(r.token=t.token);let n=await fetch("/api/nodes",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok)throw Error((await n.json()).error||"Failed to edit node");return n.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["nodes"]})}}),f=eI({mutationFn:async e=>{let t=await fetch("/api/nodes",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:e})});if(!t.ok)throw Error("Failed to delete node");return t.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["nodes"]})}}),x=eI({mutationFn:async({hostId:e,enabled:t})=>{let r=await fetch("/api/nodes",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({nodeId:e,enabled:t})});if(!r.ok)throw Error("Failed to toggle node");return r.json()},onSuccess:()=>{n.invalidateQueries({queryKey:["nodes"]})}}),g=(0,h.useCallback)(async e=>{await m.mutateAsync(e)},[m]),b=(0,h.useCallback)(async(e,t)=>{await p.mutateAsync({hostId:e,nextHost:t})},[p]),y=(0,h.useCallback)(async e=>{await f.mutateAsync(e)},[f]),v=(0,h.useCallback)(async(e,t)=>{let r=i.find(t=>t.hostId===e);r&&await x.mutateAsync({hostId:e,enabled:t??!r.enabled})},[x,i]),k=(0,h.useMemo)(()=>r?[iJ]:[iJ,...i.map(iY)],[r,i]),w=(0,h.useMemo)(()=>r?[iJ]:[iJ,...i.filter(e=>e.enabled).map(iY)],[r,i]),j=(0,h.useMemo)(()=>"all"===d?null:k.find(e=>e.hostId===d)??null,[d,k]),z=(0,h.useMemo)(()=>"all"===d?null:new Set([d]),[d]);return{sources:k,enabledSources:w,remoteHosts:i,activeFilter:d,activeSource:j,filteredHostIds:z,setActiveFilter:u,addRemoteHost:g,editRemoteHost:b,deleteRemoteHost:y,toggleRemoteHost:v,isLoading:o,error:l}}({runtimeRole:g}),[v,k]=(0,h.useState)(7),w=(0,h.useSyncExternalStore)(Z,X,()=>!1),[j,z]=(0,h.useState)([]),[N,C]=(0,h.useState)(!1),[E,R]=(0,h.useState)("idle"),[T,L]=(0,h.useState)(!1),[F,M]=(0,h.useState)(!1),[I,D]=(0,h.useState)([]),P="node"===g,_=(0,h.useRef)(null),V=(0,h.useRef)(null);(0,h.useEffect)(()=>{let e=!1;return fetch("/api/nodes").then(async t=>{var r;if(e)return;let n=null;if(404===t.status)try{n=await t.json()}catch{n=null}b(404===t.status&&"object"==typeof(r=n)&&null!==r&&"Route unavailable in node mode"===n.error?"node":"hub")}).catch(()=>{e||b("hub")}),()=>{e=!0}},[]);let $=(0,h.useMemo)(()=>Array.from(new Set(j.map(e=>e.projectName))),[j]),U=j.length>0,q=1===$.length?`${$[0]} has an OpenCode process without an exposed API port.`:`${$.length} projects have OpenCode processes without exposed API ports.`,B=(0,h.useMemo)(()=>new Map(I.map(e=>[e.hostId,e])),[I]);(0,h.useEffect)(()=>{let e=()=>{ee(),document.removeEventListener("click",e),document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",e),document.removeEventListener("touchstart",e)};return document.addEventListener("click",e),document.addEventListener("pointerdown",e,{passive:!0}),document.addEventListener("keydown",e),document.addEventListener("touchstart",e,{passive:!0}),()=>{document.removeEventListener("click",e),document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",e),document.removeEventListener("touchstart",e)}},[]),(0,h.useEffect)(()=>{if(!N||!U)return;let e=e=>{let t=e.target,r=V.current,n=_.current;r?.contains(t)||n?.contains(t)||C(!1)},t=e=>{"Escape"===e.key&&(C(!1),_.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[U,N]);let K=async()=>{try{await navigator.clipboard.writeText(i2),R("copied"),setTimeout(()=>R("idle"),1500)}catch{R("failed"),setTimeout(()=>R("idle"),2e3)}};return(0,m.jsx)("div",{className:"min-h-screen bg-zinc-50 dark:bg-black",children:(0,m.jsxs)("main",{className:"h-screen flex flex-col",children:[(0,m.jsxs)("header",{className:"flex items-center justify-between px-4 py-4 border-b border-gray-200 dark:border-zinc-800",children:[(0,m.jsxs)("h1",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:["VibePulse ",P?"(Node)":""]}),(0,m.jsxs)("div",{className:"flex items-center gap-3 flex-wrap justify-end",children:[(0,m.jsx)("button",{type:"button",onClick:()=>{ee();let e=!w;window.localStorage.setItem(H,String(e)),window.dispatchEvent(new Event(W)),e||Y("play-toggle-feedback","Skipped playToggleFeedbackSound() because muted","playToggleFeedbackSound() failed",(e,t)=>{let r=e.createOscillator(),n=e.createGain();r.type="sine",r.frequency.setValueAtTime(740,t),r.frequency.exponentialRampToValueAtTime(920,t+.1),n.gain.setValueAtTime(.13,t),n.gain.exponentialRampToValueAtTime(.001,t+.13),r.connect(n),n.connect(e.destination),r.start(t),r.stop(t+.13)})},className:`p-1.5 rounded-lg transition-all duration-150 ${w?"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-zinc-800":"text-blue-500 dark:text-blue-400 hover:text-blue-600 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20"}`,title:w?"Unmute notifications":"Mute notifications",children:w?(0,m.jsxs)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"}),(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2"})]}):(0,m.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.536 8.464a5 5 0 010 7.072M18.364 5.636a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"})})}),U?(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)("button",{ref:_,type:"button",onClick:()=>C(e=>!e),className:`p-1.5 rounded-lg transition-all duration-150 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-zinc-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 ${N?"bg-gray-100 dark:bg-zinc-800":""}`,"aria-label":"OpenCode process hint details","aria-haspopup":"dialog","aria-expanded":U&&N,"aria-controls":"process-hint-popover",children:(0,m.jsx)(ez,{className:"h-3.5 w-3.5"})}),U&&N?(0,m.jsxs)("div",{id:"process-hint-popover",ref:V,role:"dialog","aria-label":"OpenCode process hints",className:"absolute right-0 top-9 z-30 w-80 rounded-lg border border-blue-200 bg-white p-3 shadow-xl dark:border-blue-900/40 dark:bg-zinc-900",children:[(0,m.jsx)("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-200",children:q}),(0,m.jsx)("p",{className:"mt-1 text-[11px] leading-relaxed text-blue-800 dark:text-blue-300",children:"Sessions from these instances become visible once OpenCode starts with an exposed API port."}),(0,m.jsx)("div",{className:"mt-2 rounded-md bg-blue-50 px-2 py-1.5 dark:bg-blue-900/20",children:(0,m.jsx)("code",{className:"text-[11px] text-blue-900 dark:text-blue-200",children:i2})}),(0,m.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-2",children:[(0,m.jsx)("span",{className:"text-[10px] text-blue-700 dark:text-blue-300",children:"VibePulse auto-detects active ports."}),(0,m.jsx)("button",{type:"button",onClick:K,className:"rounded-md border border-blue-200 px-2 py-1 text-[10px] font-medium text-blue-800 transition-colors hover:bg-blue-50 dark:border-blue-900/40 dark:text-blue-200 dark:hover:bg-blue-900/30",children:"copied"===E?"Copied":"failed"===E?"Copy Failed":"Copy"})]})]}):null]}):null,(0,m.jsx)("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),(0,m.jsx)("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-zinc-800 rounded-lg p-0.5",children:i1.map(e=>(0,m.jsx)("button",{type:"button",onClick:()=>k(e.days),className:`px-3 py-1 text-xs font-medium rounded-md transition-all duration-150 ${v===e.days?"bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,children:e.label},e.days))}),(0,m.jsxs)("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-zinc-800 rounded-lg p-0.5","data-testid":"host-filter",children:[(0,m.jsx)("button",{type:"button",onClick:()=>y.setActiveFilter("all"),className:`px-3 py-1 text-xs font-medium rounded-md transition-all duration-150 ${"all"===y.activeFilter?"bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,"data-testid":"host-filter-option-all",children:"All Hosts"}),y.enabledSources.map(e=>{let t=B.get(e.hostId),r=t?.online??("local"===e.hostId&&1===y.enabledSources.length),n=O(e.hostId,e.hostLabel);return(0,m.jsxs)("button",{type:"button",onClick:()=>y.setActiveFilter(e.hostId),className:`flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md transition-all duration-150 ${y.activeFilter===e.hostId?"bg-white dark:bg-zinc-600 text-gray-900 dark:text-white shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"}`,"data-testid":`host-filter-option-${e.hostId}`,children:[(0,m.jsx)("span",{className:`inline-flex items-center justify-center flex-shrink-0 ${n}`,"data-testid":`host-identity-${e.hostId}`,title:`Host identity: ${e.hostLabel}`,children:(0,m.jsx)("svg",{className:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})})}),(0,m.jsx)("span",{className:"truncate",children:e.hostLabel}),(0,m.jsx)("span",{className:"ml-auto inline-flex items-center pl-1.5","data-testid":`host-indicators-${e.hostId}`,children:(0,m.jsx)("span",{className:`w-2 h-2 rounded-full ${r?"bg-emerald-500":"bg-gray-400"}`,"data-testid":`host-status-${e.hostId}`,title:r?"Online":"Offline"})})]},e.hostId)})]}),!P&&(0,m.jsxs)("button",{type:"button",onClick:()=>M(!0),className:"flex items-center gap-1.5 rounded-lg border border-zinc-200 bg-white px-3 py-1.5 text-xs font-medium text-zinc-700 shadow-sm transition-colors hover:bg-zinc-50 hover:text-zinc-900 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700 dark:hover:text-white",children:[(0,m.jsx)(eN,{className:"h-3.5 w-3.5"}),"Nodes"]}),(0,m.jsx)(eC,{onClick:()=>L(!0)})]})]}),(0,m.jsx)(eb,{children:(0,m.jsx)(ex,{filterDays:v,onProcessHintsChange:z,hostSources:y,isNodeMode:P,showHostFilter:!1,onHostStatusesChange:D})}),(0,m.jsx)(i$,{open:T,onClose:()=>L(!1)}),(0,m.jsx)(iQ,{hostSources:y,open:F,onClose:()=>M(!1),isNodeMode:P})]})})}e.s(["default",()=>i5],52683)}]);