@jlongo78/agent-spaces 0.4.0 → 0.5.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 (451) hide show
  1. package/.next/standalone/.claude/settings.local.json +11 -0
  2. package/.next/standalone/.next/BUILD_ID +1 -1
  3. package/.next/standalone/.next/build-manifest.json +2 -2
  4. package/.next/standalone/.next/prerender-manifest.json +3 -3
  5. package/.next/standalone/.next/required-server-files.json +19 -19
  6. package/.next/standalone/.next/server/app/(desktop)/admin/analytics/page_client-reference-manifest.js +1 -1
  7. package/.next/standalone/.next/server/app/(desktop)/admin/users/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/(desktop)/analytics/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/(desktop)/network/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/(desktop)/page.js +2 -2
  11. package/.next/standalone/.next/server/app/(desktop)/page.js.nft.json +1 -1
  12. package/.next/standalone/.next/server/app/(desktop)/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/(desktop)/projects/page_client-reference-manifest.js +1 -1
  14. package/.next/standalone/.next/server/app/(desktop)/sessions/[id]/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/(desktop)/sessions/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/(desktop)/settings/page_client-reference-manifest.js +1 -1
  17. package/.next/standalone/.next/server/app/(desktop)/terminal/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/(desktop)/terminal/pane/[id]/page_client-reference-manifest.js +1 -1
  19. package/.next/standalone/.next/server/app/(desktop)/terminal/remote/[nodeId]/[workspaceId]/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/(desktop)/workspaces/page_client-reference-manifest.js +1 -1
  21. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  22. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  23. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  24. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  25. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  26. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  27. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  28. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  29. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  30. package/.next/standalone/.next/server/app/_not-found.rsc +3 -3
  31. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  32. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  33. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
  34. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  35. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  36. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  37. package/.next/standalone/.next/server/app/admin/analytics.html +1 -1
  38. package/.next/standalone/.next/server/app/admin/analytics.rsc +5 -5
  39. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics/__PAGE__.segment.rsc +2 -2
  40. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics.segment.rsc +1 -1
  41. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
  42. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +2 -2
  43. package/.next/standalone/.next/server/app/admin/analytics.segments/_full.segment.rsc +5 -5
  44. package/.next/standalone/.next/server/app/admin/analytics.segments/_head.segment.rsc +1 -1
  45. package/.next/standalone/.next/server/app/admin/analytics.segments/_index.segment.rsc +3 -3
  46. package/.next/standalone/.next/server/app/admin/analytics.segments/_tree.segment.rsc +2 -2
  47. package/.next/standalone/.next/server/app/admin/users.html +1 -1
  48. package/.next/standalone/.next/server/app/admin/users.rsc +5 -5
  49. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users/__PAGE__.segment.rsc +2 -2
  50. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users.segment.rsc +1 -1
  51. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
  52. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap.segment.rsc +2 -2
  53. package/.next/standalone/.next/server/app/admin/users.segments/_full.segment.rsc +5 -5
  54. package/.next/standalone/.next/server/app/admin/users.segments/_head.segment.rsc +1 -1
  55. package/.next/standalone/.next/server/app/admin/users.segments/_index.segment.rsc +3 -3
  56. package/.next/standalone/.next/server/app/admin/users.segments/_tree.segment.rsc +2 -2
  57. package/.next/standalone/.next/server/app/analytics.html +1 -1
  58. package/.next/standalone/.next/server/app/analytics.rsc +5 -5
  59. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics/__PAGE__.segment.rsc +2 -2
  60. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics.segment.rsc +1 -1
  61. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +2 -2
  62. package/.next/standalone/.next/server/app/analytics.segments/_full.segment.rsc +5 -5
  63. package/.next/standalone/.next/server/app/analytics.segments/_head.segment.rsc +1 -1
  64. package/.next/standalone/.next/server/app/analytics.segments/_index.segment.rsc +3 -3
  65. package/.next/standalone/.next/server/app/analytics.segments/_tree.segment.rsc +2 -2
  66. package/.next/standalone/.next/server/app/api/admin/analytics/route.js +1 -1
  67. package/.next/standalone/.next/server/app/api/admin/analytics/route.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/api/admin/users/[id]/route.js +1 -1
  69. package/.next/standalone/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/api/admin/users/route.js +1 -1
  71. package/.next/standalone/.next/server/app/api/admin/users/route.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/api/analytics/overview/route.js +2 -2
  73. package/.next/standalone/.next/server/app/api/analytics/overview/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/api/auth/login/route.js +1 -1
  75. package/.next/standalone/.next/server/app/api/auth/login/route.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/api/auth/logout/route.js +1 -1
  77. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  78. package/.next/standalone/.next/server/app/api/auth/me/route.js +1 -1
  79. package/.next/standalone/.next/server/app/api/auth/me/route.js.nft.json +1 -1
  80. package/.next/standalone/.next/server/app/api/auth/totp/setup/route.js +1 -1
  81. package/.next/standalone/.next/server/app/api/auth/totp/setup/route.js.nft.json +1 -1
  82. package/.next/standalone/.next/server/app/api/auth/totp/status/route.js +1 -1
  83. package/.next/standalone/.next/server/app/api/auth/totp/status/route.js.nft.json +1 -1
  84. package/.next/standalone/.next/server/app/api/auth/totp/verify/route.js +1 -1
  85. package/.next/standalone/.next/server/app/api/auth/totp/verify/route.js.nft.json +1 -1
  86. package/.next/standalone/.next/server/app/api/bulk/route.js +2 -2
  87. package/.next/standalone/.next/server/app/api/bulk/route.js.nft.json +1 -1
  88. package/.next/standalone/.next/server/app/api/chat/route.js +1 -1
  89. package/.next/standalone/.next/server/app/api/chat/route.js.nft.json +1 -1
  90. package/.next/standalone/.next/server/app/api/config/route.js +1 -1
  91. package/.next/standalone/.next/server/app/api/config/route.js.nft.json +1 -1
  92. package/.next/standalone/.next/server/app/api/events/route.js +2 -2
  93. package/.next/standalone/.next/server/app/api/events/route.js.nft.json +1 -1
  94. package/.next/standalone/.next/server/app/api/folders/route.js +1 -1
  95. package/.next/standalone/.next/server/app/api/folders/route.js.nft.json +1 -1
  96. package/.next/standalone/.next/server/app/api/network/discovered/route.js +1 -1
  97. package/.next/standalone/.next/server/app/api/network/discovered/route.js.nft.json +1 -1
  98. package/.next/standalone/.next/server/app/api/network/handshake/route.js +1 -1
  99. package/.next/standalone/.next/server/app/api/network/handshake/route.js.nft.json +1 -1
  100. package/.next/standalone/.next/server/app/api/network/health/route.js +1 -1
  101. package/.next/standalone/.next/server/app/api/network/health/route.js.nft.json +1 -1
  102. package/.next/standalone/.next/server/app/api/network/identity/route.js +1 -1
  103. package/.next/standalone/.next/server/app/api/network/identity/route.js.nft.json +1 -1
  104. package/.next/standalone/.next/server/app/api/network/keys/[id]/route.js +1 -1
  105. package/.next/standalone/.next/server/app/api/network/keys/[id]/route.js.nft.json +1 -1
  106. package/.next/standalone/.next/server/app/api/network/keys/route.js +1 -1
  107. package/.next/standalone/.next/server/app/api/network/keys/route.js.nft.json +1 -1
  108. package/.next/standalone/.next/server/app/api/network/nodes/[id]/route.js +1 -1
  109. package/.next/standalone/.next/server/app/api/network/nodes/[id]/route.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/api/network/nodes/check/route.js +1 -1
  111. package/.next/standalone/.next/server/app/api/network/nodes/check/route.js.nft.json +1 -1
  112. package/.next/standalone/.next/server/app/api/network/nodes/route.js +1 -1
  113. package/.next/standalone/.next/server/app/api/network/nodes/route.js.nft.json +1 -1
  114. package/.next/standalone/.next/server/app/api/network/projects/route.js +1 -1
  115. package/.next/standalone/.next/server/app/api/network/projects/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/network/proxy/[nodeId]/[...path]/route.js +1 -1
  117. package/.next/standalone/.next/server/app/api/network/proxy/[nodeId]/[...path]/route.js.nft.json +1 -1
  118. package/.next/standalone/.next/server/app/api/network/search/route.js +1 -1
  119. package/.next/standalone/.next/server/app/api/network/search/route.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/api/network/sessions/[id]/messages/route.js +1 -1
  121. package/.next/standalone/.next/server/app/api/network/sessions/[id]/messages/route.js.nft.json +1 -1
  122. package/.next/standalone/.next/server/app/api/network/sessions/[id]/route.js +1 -1
  123. package/.next/standalone/.next/server/app/api/network/sessions/[id]/route.js.nft.json +1 -1
  124. package/.next/standalone/.next/server/app/api/network/sessions/route.js +1 -1
  125. package/.next/standalone/.next/server/app/api/network/sessions/route.js.nft.json +1 -1
  126. package/.next/standalone/.next/server/app/api/network/terminal/token/route.js +1 -1
  127. package/.next/standalone/.next/server/app/api/network/terminal/token/route.js.nft.json +1 -1
  128. package/.next/standalone/.next/server/app/api/network/workspaces/[id]/route.js +1 -1
  129. package/.next/standalone/.next/server/app/api/network/workspaces/[id]/route.js.nft.json +1 -1
  130. package/.next/standalone/.next/server/app/api/network/workspaces/route.js +1 -1
  131. package/.next/standalone/.next/server/app/api/network/workspaces/route.js.nft.json +1 -1
  132. package/.next/standalone/.next/server/app/api/panes/[id]/route.js +2 -2
  133. package/.next/standalone/.next/server/app/api/panes/[id]/route.js.nft.json +1 -1
  134. package/.next/standalone/.next/server/app/api/panes/route.js +2 -2
  135. package/.next/standalone/.next/server/app/api/panes/route.js.nft.json +1 -1
  136. package/.next/standalone/.next/server/app/api/projects/route.js +2 -2
  137. package/.next/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  138. package/.next/standalone/.next/server/app/api/search/route.js +2 -2
  139. package/.next/standalone/.next/server/app/api/search/route.js.nft.json +1 -1
  140. package/.next/standalone/.next/server/app/api/sessions/[id]/chat/route.js +2 -2
  141. package/.next/standalone/.next/server/app/api/sessions/[id]/chat/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/sessions/[id]/messages/route.js +2 -2
  143. package/.next/standalone/.next/server/app/api/sessions/[id]/messages/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/sessions/[id]/route.js +2 -2
  145. package/.next/standalone/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/sessions/route.js +2 -2
  147. package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/sync/route.js +3 -3
  149. package/.next/standalone/.next/server/app/api/sync/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/tags/route.js +2 -2
  151. package/.next/standalone/.next/server/app/api/tags/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/tier/route.js +1 -1
  153. package/.next/standalone/.next/server/app/api/tier/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/[key]/route.js +2 -2
  155. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/[key]/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/route.js +2 -2
  157. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/[msgId]/route.js +2 -2
  159. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/[msgId]/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/route.js +2 -2
  161. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/workspaces/[id]/route.js +2 -2
  163. package/.next/standalone/.next/server/app/api/workspaces/[id]/route.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/app/api/workspaces/[id]/sessions/route.js +2 -2
  165. package/.next/standalone/.next/server/app/api/workspaces/[id]/sessions/route.js.nft.json +1 -1
  166. package/.next/standalone/.next/server/app/api/workspaces/route.js +2 -2
  167. package/.next/standalone/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  168. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  169. package/.next/standalone/.next/server/app/login.html +1 -1
  170. package/.next/standalone/.next/server/app/login.rsc +4 -4
  171. package/.next/standalone/.next/server/app/login.segments/_full.segment.rsc +4 -4
  172. package/.next/standalone/.next/server/app/login.segments/_head.segment.rsc +1 -1
  173. package/.next/standalone/.next/server/app/login.segments/_index.segment.rsc +3 -3
  174. package/.next/standalone/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  175. package/.next/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  176. package/.next/standalone/.next/server/app/login.segments/login.segment.rsc +1 -1
  177. package/.next/standalone/.next/server/app/m/page_client-reference-manifest.js +1 -1
  178. package/.next/standalone/.next/server/app/m/projects/page_client-reference-manifest.js +1 -1
  179. package/.next/standalone/.next/server/app/m/projects.html +1 -1
  180. package/.next/standalone/.next/server/app/m/projects.rsc +5 -5
  181. package/.next/standalone/.next/server/app/m/projects.segments/_full.segment.rsc +5 -5
  182. package/.next/standalone/.next/server/app/m/projects.segments/_head.segment.rsc +1 -1
  183. package/.next/standalone/.next/server/app/m/projects.segments/_index.segment.rsc +3 -3
  184. package/.next/standalone/.next/server/app/m/projects.segments/_tree.segment.rsc +2 -2
  185. package/.next/standalone/.next/server/app/m/projects.segments/m/projects/__PAGE__.segment.rsc +2 -2
  186. package/.next/standalone/.next/server/app/m/projects.segments/m/projects.segment.rsc +1 -1
  187. package/.next/standalone/.next/server/app/m/projects.segments/m.segment.rsc +2 -2
  188. package/.next/standalone/.next/server/app/m/sessions/[id]/page_client-reference-manifest.js +1 -1
  189. package/.next/standalone/.next/server/app/m/sessions/page_client-reference-manifest.js +1 -1
  190. package/.next/standalone/.next/server/app/m/sessions.html +1 -1
  191. package/.next/standalone/.next/server/app/m/sessions.rsc +5 -5
  192. package/.next/standalone/.next/server/app/m/sessions.segments/_full.segment.rsc +5 -5
  193. package/.next/standalone/.next/server/app/m/sessions.segments/_head.segment.rsc +1 -1
  194. package/.next/standalone/.next/server/app/m/sessions.segments/_index.segment.rsc +3 -3
  195. package/.next/standalone/.next/server/app/m/sessions.segments/_tree.segment.rsc +2 -2
  196. package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions/__PAGE__.segment.rsc +2 -2
  197. package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions.segment.rsc +1 -1
  198. package/.next/standalone/.next/server/app/m/sessions.segments/m.segment.rsc +2 -2
  199. package/.next/standalone/.next/server/app/m/settings/page_client-reference-manifest.js +1 -1
  200. package/.next/standalone/.next/server/app/m/settings.html +1 -1
  201. package/.next/standalone/.next/server/app/m/settings.rsc +5 -5
  202. package/.next/standalone/.next/server/app/m/settings.segments/_full.segment.rsc +5 -5
  203. package/.next/standalone/.next/server/app/m/settings.segments/_head.segment.rsc +1 -1
  204. package/.next/standalone/.next/server/app/m/settings.segments/_index.segment.rsc +3 -3
  205. package/.next/standalone/.next/server/app/m/settings.segments/_tree.segment.rsc +2 -2
  206. package/.next/standalone/.next/server/app/m/settings.segments/m/settings/__PAGE__.segment.rsc +2 -2
  207. package/.next/standalone/.next/server/app/m/settings.segments/m/settings.segment.rsc +1 -1
  208. package/.next/standalone/.next/server/app/m/settings.segments/m.segment.rsc +2 -2
  209. package/.next/standalone/.next/server/app/m/terminal/page_client-reference-manifest.js +1 -1
  210. package/.next/standalone/.next/server/app/m/terminal.html +1 -1
  211. package/.next/standalone/.next/server/app/m/terminal.rsc +5 -5
  212. package/.next/standalone/.next/server/app/m/terminal.segments/_full.segment.rsc +5 -5
  213. package/.next/standalone/.next/server/app/m/terminal.segments/_head.segment.rsc +1 -1
  214. package/.next/standalone/.next/server/app/m/terminal.segments/_index.segment.rsc +3 -3
  215. package/.next/standalone/.next/server/app/m/terminal.segments/_tree.segment.rsc +2 -2
  216. package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal/__PAGE__.segment.rsc +2 -2
  217. package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal.segment.rsc +1 -1
  218. package/.next/standalone/.next/server/app/m/terminal.segments/m.segment.rsc +2 -2
  219. package/.next/standalone/.next/server/app/m.html +1 -1
  220. package/.next/standalone/.next/server/app/m.rsc +5 -5
  221. package/.next/standalone/.next/server/app/m.segments/_full.segment.rsc +5 -5
  222. package/.next/standalone/.next/server/app/m.segments/_head.segment.rsc +1 -1
  223. package/.next/standalone/.next/server/app/m.segments/_index.segment.rsc +3 -3
  224. package/.next/standalone/.next/server/app/m.segments/_tree.segment.rsc +2 -2
  225. package/.next/standalone/.next/server/app/m.segments/m/__PAGE__.segment.rsc +2 -2
  226. package/.next/standalone/.next/server/app/m.segments/m.segment.rsc +2 -2
  227. package/.next/standalone/.next/server/app/network.html +1 -1
  228. package/.next/standalone/.next/server/app/network.rsc +5 -5
  229. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network/__PAGE__.segment.rsc +2 -2
  230. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network.segment.rsc +1 -1
  231. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap.segment.rsc +2 -2
  232. package/.next/standalone/.next/server/app/network.segments/_full.segment.rsc +5 -5
  233. package/.next/standalone/.next/server/app/network.segments/_head.segment.rsc +1 -1
  234. package/.next/standalone/.next/server/app/network.segments/_index.segment.rsc +3 -3
  235. package/.next/standalone/.next/server/app/network.segments/_tree.segment.rsc +2 -2
  236. package/.next/standalone/.next/server/app/projects.html +1 -1
  237. package/.next/standalone/.next/server/app/projects.rsc +5 -5
  238. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects/__PAGE__.segment.rsc +2 -2
  239. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects.segment.rsc +1 -1
  240. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap.segment.rsc +2 -2
  241. package/.next/standalone/.next/server/app/projects.segments/_full.segment.rsc +5 -5
  242. package/.next/standalone/.next/server/app/projects.segments/_head.segment.rsc +1 -1
  243. package/.next/standalone/.next/server/app/projects.segments/_index.segment.rsc +3 -3
  244. package/.next/standalone/.next/server/app/projects.segments/_tree.segment.rsc +2 -2
  245. package/.next/standalone/.next/server/app/sessions.html +1 -1
  246. package/.next/standalone/.next/server/app/sessions.rsc +5 -5
  247. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions/__PAGE__.segment.rsc +2 -2
  248. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions.segment.rsc +1 -1
  249. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap.segment.rsc +2 -2
  250. package/.next/standalone/.next/server/app/sessions.segments/_full.segment.rsc +5 -5
  251. package/.next/standalone/.next/server/app/sessions.segments/_head.segment.rsc +1 -1
  252. package/.next/standalone/.next/server/app/sessions.segments/_index.segment.rsc +3 -3
  253. package/.next/standalone/.next/server/app/sessions.segments/_tree.segment.rsc +2 -2
  254. package/.next/standalone/.next/server/app/settings.html +1 -1
  255. package/.next/standalone/.next/server/app/settings.rsc +5 -5
  256. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings/__PAGE__.segment.rsc +2 -2
  257. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings.segment.rsc +1 -1
  258. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap.segment.rsc +2 -2
  259. package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +5 -5
  260. package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  261. package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +3 -3
  262. package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  263. package/.next/standalone/.next/server/app/terminal.html +1 -1
  264. package/.next/standalone/.next/server/app/terminal.rsc +5 -5
  265. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal/__PAGE__.segment.rsc +2 -2
  266. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal.segment.rsc +1 -1
  267. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap.segment.rsc +2 -2
  268. package/.next/standalone/.next/server/app/terminal.segments/_full.segment.rsc +5 -5
  269. package/.next/standalone/.next/server/app/terminal.segments/_head.segment.rsc +1 -1
  270. package/.next/standalone/.next/server/app/terminal.segments/_index.segment.rsc +3 -3
  271. package/.next/standalone/.next/server/app/terminal.segments/_tree.segment.rsc +2 -2
  272. package/.next/standalone/.next/server/app/workspaces.html +1 -1
  273. package/.next/standalone/.next/server/app/workspaces.rsc +5 -5
  274. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces/__PAGE__.segment.rsc +2 -2
  275. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces.segment.rsc +1 -1
  276. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap.segment.rsc +2 -2
  277. package/.next/standalone/.next/server/app/workspaces.segments/_full.segment.rsc +5 -5
  278. package/.next/standalone/.next/server/app/workspaces.segments/_head.segment.rsc +1 -1
  279. package/.next/standalone/.next/server/app/workspaces.segments/_index.segment.rsc +3 -3
  280. package/.next/standalone/.next/server/app/workspaces.segments/_tree.segment.rsc +2 -2
  281. package/.next/standalone/.next/server/chunks/[root-of-the-server]__086be15a._.js +3 -0
  282. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0955695e._.js +3 -0
  283. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0fac388d._.js +3 -0
  284. package/.next/standalone/.next/server/chunks/[root-of-the-server]__18a58c5f._.js +3 -0
  285. package/.next/standalone/.next/server/chunks/[root-of-the-server]__190b05d8._.js +3 -0
  286. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1a211143._.js +3 -0
  287. package/.next/standalone/.next/server/chunks/[root-of-the-server]__20353b76._.js +3 -0
  288. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2861e096._.js +3 -0
  289. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2a7a798c._.js +3 -0
  290. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2b6758fc._.js +3 -0
  291. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2e9d1d5a._.js +3 -0
  292. package/.next/standalone/.next/server/chunks/[root-of-the-server]__31f028ec._.js +3 -0
  293. package/.next/standalone/.next/server/chunks/[root-of-the-server]__34c34116._.js +3 -0
  294. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3aa57139._.js +3 -0
  295. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3ce30e4e._.js +3 -0
  296. package/.next/standalone/.next/server/chunks/[root-of-the-server]__41ae8be6._.js +3 -0
  297. package/.next/standalone/.next/server/chunks/[root-of-the-server]__41e589ee._.js +3 -0
  298. package/.next/standalone/.next/server/chunks/[root-of-the-server]__43112c34._.js +3 -0
  299. package/.next/standalone/.next/server/chunks/[root-of-the-server]__464db440._.js +3 -0
  300. package/.next/standalone/.next/server/chunks/[root-of-the-server]__466c7e18._.js +3 -0
  301. package/.next/standalone/.next/server/chunks/[root-of-the-server]__47a63195._.js +3 -0
  302. package/.next/standalone/.next/server/chunks/[root-of-the-server]__4ad64489._.js +3 -0
  303. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5bbc73ff._.js +3 -0
  304. package/.next/standalone/.next/server/chunks/[root-of-the-server]__60689e2b._.js +3 -0
  305. package/.next/standalone/.next/server/chunks/[root-of-the-server]__67c4abf3._.js +3 -0
  306. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6b94cc47._.js +3 -0
  307. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6c6cfe82._.js +3 -0
  308. package/.next/standalone/.next/server/chunks/[root-of-the-server]__776b2fd5._.js +3 -0
  309. package/.next/standalone/.next/server/chunks/[root-of-the-server]__7901e2ab._.js +3 -0
  310. package/.next/standalone/.next/server/chunks/[root-of-the-server]__83b9bcf3._.js +11 -0
  311. package/.next/standalone/.next/server/chunks/[root-of-the-server]__89124c96._.js +243 -0
  312. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8c2eee30._.js +3 -0
  313. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8ffcf827._.js +3 -0
  314. package/.next/standalone/.next/server/chunks/[root-of-the-server]__95b7f18e._.js +3 -0
  315. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9e343d64._.js +3 -0
  316. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a2ee9884._.js +13 -0
  317. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a651ede9._.js +3 -0
  318. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a6ce192e._.js +3 -0
  319. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b4b692df._.js +3 -0
  320. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b4edb4d6._.js +3 -0
  321. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b71497ab._.js +243 -0
  322. package/.next/standalone/.next/server/chunks/[root-of-the-server]__bc97ddc7._.js +3 -0
  323. package/.next/standalone/.next/server/chunks/[root-of-the-server]__bef2ed87._.js +3 -0
  324. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c525457e._.js +19 -0
  325. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c546cf71._.js +3 -0
  326. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ccc27199._.js +3 -0
  327. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ce5edd98._.js +3 -0
  328. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d877df12._.js +3 -0
  329. package/.next/standalone/.next/server/chunks/[root-of-the-server]__dd2e81be._.js +11 -0
  330. package/.next/standalone/.next/server/chunks/[root-of-the-server]__de96c005._.js +3 -0
  331. package/.next/standalone/.next/server/chunks/[root-of-the-server]__df6bc9e9._.js +3 -0
  332. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e2b78951._.js +3 -0
  333. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e742ef33._.js +3 -0
  334. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__63c35e0f._.js +1 -1
  335. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__66aca5d4._.js +3 -0
  336. package/.next/standalone/.next/server/chunks/ssr/_1f12caba._.js +1 -1
  337. package/.next/standalone/.next/server/chunks/ssr/_3b54193d._.js +1 -1
  338. package/.next/standalone/.next/server/chunks/ssr/_43e7e611._.js +1 -1
  339. package/.next/standalone/.next/server/chunks/ssr/_5ac43c5d._.js +1 -1
  340. package/.next/standalone/.next/server/chunks/ssr/_cd50a174._.js +1 -1
  341. package/.next/standalone/.next/server/chunks/ssr/src_app_(desktop)_terminal_page_tsx_de5e8d85._.js +1 -1
  342. package/.next/standalone/.next/server/edge/chunks/[root-of-the-server]__32a0045c._.js +1 -1
  343. package/.next/standalone/.next/server/edge/chunks/_d73df637._.js +3 -0
  344. package/.next/standalone/.next/server/edge/chunks/turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_a4434a38.js +6 -0
  345. package/.next/standalone/.next/server/middleware-manifest.json +7 -7
  346. package/.next/standalone/.next/server/pages/404.html +1 -1
  347. package/.next/standalone/.next/server/pages/500.html +2 -2
  348. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  349. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  350. package/.next/standalone/.next/static/chunks/{31f45c67350373f2.js → 10c6424526b53431.js} +2 -2
  351. package/.next/standalone/.next/static/chunks/{8cc07e8d950d6962.js → 27649ec994a696fb.js} +1 -1
  352. package/.next/standalone/.next/static/chunks/{3c4ee171d96760e8.js → 302ce212c690bec4.js} +2 -2
  353. package/.next/standalone/.next/static/chunks/51dacec57c9714c0.js +1 -0
  354. package/.next/standalone/.next/static/chunks/{f2b58d718b34646d.js → 53782d1e41fd7f82.js} +1 -1
  355. package/.next/standalone/.next/static/chunks/{f789a1d0736e1154.js → 58d78765e5140dcb.js} +1 -1
  356. package/.next/standalone/.next/static/chunks/{7c1e6d7f1d3b4173.js → cb442c50eecb758d.js} +2 -2
  357. package/.next/standalone/.next/static/chunks/ff5fac1bd7b518dd.css +3 -0
  358. package/.next/standalone/node_modules/@img/sharp-win32-x64/lib/sharp-win32-x64.node +0 -0
  359. package/.next/standalone/node_modules/@img/{sharp-linux-x64 → sharp-win32-x64}/package.json +39 -46
  360. package/.next/standalone/package.json +89 -91
  361. package/.next/standalone/server.js +1 -1
  362. package/.next/standalone/tsconfig.json +34 -34
  363. package/LICENSE +661 -661
  364. package/README.md +131 -131
  365. package/bin/fix-standalone-externals.js +79 -79
  366. package/bin/lib/auto-setup.js +101 -101
  367. package/bin/mdns-service.js +171 -171
  368. package/bin/postinstall.js +35 -35
  369. package/bin/setup-admin.js +189 -189
  370. package/bin/spaces-dev.js +208 -173
  371. package/bin/spaces-install.js +426 -0
  372. package/bin/spaces-setup.js +242 -242
  373. package/bin/spaces.js +465 -317
  374. package/bin/terminal-server.js +1117 -1051
  375. package/package.json +89 -91
  376. package/.next/standalone/.next/server/chunks/[root-of-the-server]__025cd038._.js +0 -3
  377. package/.next/standalone/.next/server/chunks/[root-of-the-server]__042ba2bc._.js +0 -3
  378. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07cc153d._.js +0 -3
  379. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08e411dd._.js +0 -3
  380. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0add852f._.js +0 -3
  381. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c113ed0._.js +0 -3
  382. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0cf032ab._.js +0 -3
  383. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11293532._.js +0 -13
  384. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1194f2c1._.js +0 -3
  385. package/.next/standalone/.next/server/chunks/[root-of-the-server]__19c2d094._.js +0 -3
  386. package/.next/standalone/.next/server/chunks/[root-of-the-server]__19c3ad21._.js +0 -3
  387. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1ebc634e._.js +0 -3
  388. package/.next/standalone/.next/server/chunks/[root-of-the-server]__24197539._.js +0 -3
  389. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2891c969._.js +0 -11
  390. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2c6e6625._.js +0 -3
  391. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2fe2b40e._.js +0 -3
  392. package/.next/standalone/.next/server/chunks/[root-of-the-server]__318f12c6._.js +0 -3
  393. package/.next/standalone/.next/server/chunks/[root-of-the-server]__32df12e4._.js +0 -3
  394. package/.next/standalone/.next/server/chunks/[root-of-the-server]__34e7cb21._.js +0 -3
  395. package/.next/standalone/.next/server/chunks/[root-of-the-server]__49c92d87._.js +0 -3
  396. package/.next/standalone/.next/server/chunks/[root-of-the-server]__52bde30c._.js +0 -3
  397. package/.next/standalone/.next/server/chunks/[root-of-the-server]__53090a81._.js +0 -3
  398. package/.next/standalone/.next/server/chunks/[root-of-the-server]__57193cf5._.js +0 -3
  399. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5c33078d._.js +0 -3
  400. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5f8c694a._.js +0 -3
  401. package/.next/standalone/.next/server/chunks/[root-of-the-server]__630b9a6a._.js +0 -3
  402. package/.next/standalone/.next/server/chunks/[root-of-the-server]__727d05f1._.js +0 -3
  403. package/.next/standalone/.next/server/chunks/[root-of-the-server]__75a774f0._.js +0 -233
  404. package/.next/standalone/.next/server/chunks/[root-of-the-server]__7f0bc701._.js +0 -233
  405. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8915603e._.js +0 -3
  406. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8afe4d5e._.js +0 -3
  407. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9d15de27._.js +0 -3
  408. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a1fbc199._.js +0 -3
  409. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a1fe6070._.js +0 -3
  410. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a3f604d6._.js +0 -3
  411. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a5504205._.js +0 -3
  412. package/.next/standalone/.next/server/chunks/[root-of-the-server]__abf53d11._.js +0 -3
  413. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b78eeead._.js +0 -11
  414. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c1b8f8f6._.js +0 -3
  415. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c3c74ca4._.js +0 -3
  416. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c79824d9._.js +0 -3
  417. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c9db5d8a._.js +0 -3
  418. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cbd9cb15._.js +0 -3
  419. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ccb4e920._.js +0 -3
  420. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d15515e3._.js +0 -3
  421. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d490583e._.js +0 -3
  422. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d9c106a9._.js +0 -3
  423. package/.next/standalone/.next/server/chunks/[root-of-the-server]__de2c3bf8._.js +0 -3
  424. package/.next/standalone/.next/server/chunks/[root-of-the-server]__dfbf7bdd._.js +0 -19
  425. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e1e26f47._.js +0 -3
  426. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ee9346bf._.js +0 -3
  427. package/.next/standalone/.next/server/chunks/[root-of-the-server]__fea012d6._.js +0 -3
  428. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ff1b0769._.js +0 -3
  429. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__eac7aeff._.js +0 -3
  430. package/.next/standalone/.next/server/edge/chunks/node_modules_next_dist_esm_build_templates_edge-wrapper_78fa9d6a.js +0 -3
  431. package/.next/standalone/.next/server/edge/chunks/turbopack-node_modules_next_dist_esm_build_templates_edge-wrapper_a5230bba.js +0 -6
  432. package/.next/standalone/.next/static/chunks/780381483091d8fb.js +0 -1
  433. package/.next/standalone/.next/static/chunks/806334ea0f6ca92a.css +0 -3
  434. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/README.md +0 -46
  435. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  436. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +0 -1
  437. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  438. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/package.json +0 -42
  439. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +0 -46
  440. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  441. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +0 -1
  442. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  443. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +0 -42
  444. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +0 -30
  445. package/.next/standalone/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
  446. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
  447. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/package.json +0 -46
  448. /package/.next/standalone/.next/static/{k4gRsS979E-cbl1AWcHhx → U-EFIvMEHFIoGaoj6xBXK}/_buildManifest.js +0 -0
  449. /package/.next/standalone/.next/static/{k4gRsS979E-cbl1AWcHhx → U-EFIvMEHFIoGaoj6xBXK}/_clientMiddlewareManifest.json +0 -0
  450. /package/.next/standalone/.next/static/{k4gRsS979E-cbl1AWcHhx → U-EFIvMEHFIoGaoj6xBXK}/_ssgManifest.js +0 -0
  451. /package/.next/standalone/node_modules/@img/{sharp-libvips-linux-x64 → sharp-win32-x64}/versions.json +0 -0
@@ -1,5 +1,5 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31278,e=>{"use strict";let t=(0,e.i(75254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],31278)},66027,54616,e=>{"use strict";let t;var s=e.i(75555),r=e.i(40143),i=e.i(86491),n=e.i(15823),a=e.i(93803),o=e.i(19273),u=e.i(80166),c=class extends n.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#s=(0,a.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#r=void 0;#i=void 0;#n=void 0;#a;#o;#s;#t;#u;#c;#l;#h;#d;#p;#y=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#r.addObserver(this),l(this.#r,this.options)?this.#f():this.updateResult(),this.#m())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return h(this.#r,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return h(this.#r,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#g(),this.#r.removeObserver(this)}setOptions(e){let t=this.options,s=this.#r;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,o.resolveEnabled)(this.options.enabled,this.#r))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#v(),this.#r.setOptions(this.options),t._defaulted&&!(0,o.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#r,observer:this});let r=this.hasListeners();r&&d(this.#r,s,this.options,t)&&this.#f(),this.updateResult(),r&&(this.#r!==s||(0,o.resolveEnabled)(this.options.enabled,this.#r)!==(0,o.resolveEnabled)(t.enabled,this.#r)||(0,o.resolveStaleTime)(this.options.staleTime,this.#r)!==(0,o.resolveStaleTime)(t.staleTime,this.#r))&&this.#x();let i=this.#w();r&&(this.#r!==s||(0,o.resolveEnabled)(this.options.enabled,this.#r)!==(0,o.resolveEnabled)(t.enabled,this.#r)||i!==this.#p)&&this.#k(i)}getOptimisticResult(e){var t,s;let r=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(r,e);return t=this,s=i,(0,o.shallowEqualObjects)(t.getCurrentResult(),s)||(this.#n=i,this.#o=this.options,this.#a=this.#r.state),i}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(e,s)=>(this.trackProp(s),t?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#s.status||this.#s.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,s))})}trackProp(e){this.#y.add(e)}getCurrentQuery(){return this.#r}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),s=this.#e.getQueryCache().build(this.#e,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#f({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#f(e){this.#v();let t=this.#r.fetch(this.options,e);return e?.throwOnError||(t=t.catch(o.noop)),t}#x(){this.#b();let e=(0,o.resolveStaleTime)(this.options.staleTime,this.#r);if(o.isServer||this.#n.isStale||!(0,o.isValidTimeout)(e))return;let t=(0,o.timeUntilStale)(this.#n.dataUpdatedAt,e);this.#h=u.timeoutManager.setTimeout(()=>{this.#n.isStale||this.updateResult()},t+1)}#w(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#r):this.options.refetchInterval)??!1}#k(e){this.#g(),this.#p=e,!o.isServer&&!1!==(0,o.resolveEnabled)(this.options.enabled,this.#r)&&(0,o.isValidTimeout)(this.#p)&&0!==this.#p&&(this.#d=u.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||s.focusManager.isFocused())&&this.#f()},this.#p))}#m(){this.#x(),this.#k(this.#w())}#b(){this.#h&&(u.timeoutManager.clearTimeout(this.#h),this.#h=void 0)}#g(){this.#d&&(u.timeoutManager.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let s,r=this.#r,n=this.options,u=this.#n,c=this.#a,h=this.#o,y=e!==r?e.state:this.#i,{state:f}=e,m={...f},b=!1;if(t._optimisticResults){let s=this.hasListeners(),a=!s&&l(e,t),o=s&&d(e,r,t,n);(a||o)&&(m={...m,...(0,i.fetchState)(f.data,e.options)}),"isRestoring"===t._optimisticResults&&(m.fetchStatus="idle")}let{error:g,errorUpdatedAt:v,status:x}=m;s=m.data;let w=!1;if(void 0!==t.placeholderData&&void 0===s&&"pending"===x){let e;u?.isPlaceholderData&&t.placeholderData===h?.placeholderData?(e=u.data,w=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,void 0!==e&&(x="success",s=(0,o.replaceData)(u?.data,e,t),b=!0)}if(t.select&&void 0!==s&&!w)if(u&&s===c?.data&&t.select===this.#u)s=this.#c;else try{this.#u=t.select,s=t.select(s),s=(0,o.replaceData)(u?.data,s,t),this.#c=s,this.#t=null}catch(e){this.#t=e}this.#t&&(g=this.#t,s=this.#c,v=Date.now(),x="error");let k="fetching"===m.fetchStatus,S="pending"===x,C="error"===x,R=S&&k,j=void 0!==s,T={status:x,fetchStatus:m.fetchStatus,isPending:S,isSuccess:"success"===x,isError:C,isInitialLoading:R,isLoading:R,data:s,dataUpdatedAt:m.dataUpdatedAt,error:g,errorUpdatedAt:v,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>y.dataUpdateCount||m.errorUpdateCount>y.errorUpdateCount,isFetching:k,isRefetching:k&&!S,isLoadingError:C&&!j,isPaused:"paused"===m.fetchStatus,isPlaceholderData:b,isRefetchError:C&&j,isStale:p(e,t),refetch:this.refetch,promise:this.#s,isEnabled:!1!==(0,o.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==T.data,s="error"===T.status&&!t,i=e=>{s?e.reject(T.error):t&&e.resolve(T.data)},n=()=>{i(this.#s=T.promise=(0,a.pendingThenable)())},o=this.#s;switch(o.status){case"pending":e.queryHash===r.queryHash&&i(o);break;case"fulfilled":(s||T.data!==o.value)&&n();break;case"rejected":s&&T.error===o.reason||n()}}return T}updateResult(){let e=this.#n,t=this.createResult(this.#r,this.options);if(this.#a=this.#r.state,this.#o=this.options,void 0!==this.#a.data&&(this.#l=this.#r),(0,o.shallowEqualObjects)(t,e))return;this.#n=t;let s=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,s="function"==typeof t?t():t;if("all"===s||!s&&!this.#y.size)return!0;let r=new Set(s??this.#y);return this.options.throwOnError&&r.add("error"),Object.keys(this.#n).some(t=>this.#n[t]!==e[t]&&r.has(t))};this.#S({listeners:s()})}#v(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#r)return;let t=this.#r;this.#r=e,this.#i=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#m()}#S(e){r.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#r,type:"observerResultsUpdated"})})}};function l(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&h(e,t,t.refetchOnMount)}function h(e,t,s){if(!1!==(0,o.resolveEnabled)(t.enabled,e)&&"static"!==(0,o.resolveStaleTime)(t.staleTime,e)){let r="function"==typeof s?s(e):s;return"always"===r||!1!==r&&p(e,t)}return!1}function d(e,t,s,r){return(e!==t||!1===(0,o.resolveEnabled)(r.enabled,e))&&(!s.suspense||"error"!==e.state.status)&&p(e,s)}function p(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,o.resolveStaleTime)(t.staleTime,e))}e.i(47167);var y=e.i(71645),f=e.i(12598);e.i(18050);var m=y.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),b=y.createContext(!1);b.Provider;var g=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function v(e,t){return function(e,t,s){let i,n=y.useContext(b),a=y.useContext(m),u=(0,f.useQueryClient)(s),c=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(c);let l=u.getQueryCache().get(c.queryHash);if(c._optimisticResults=n?"isRestoring":"optimistic",c.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=c.staleTime;c.staleTime="function"==typeof t?(...s)=>e(t(...s)):e(t),"number"==typeof c.gcTime&&(c.gcTime=Math.max(c.gcTime,1e3))}i=l?.state.error&&"function"==typeof c.throwOnError?(0,o.shouldThrowError)(c.throwOnError,[l.state.error,l]):c.throwOnError,(c.suspense||c.experimental_prefetchInRender||i)&&!a.isReset()&&(c.retryOnMount=!1),y.useEffect(()=>{a.clearReset()},[a]);let h=!u.getQueryCache().get(c.queryHash),[d]=y.useState(()=>new t(u,c)),p=d.getOptimisticResult(c),v=!n&&!1!==e.subscribed;if(y.useSyncExternalStore(y.useCallback(e=>{let t=v?d.subscribe(r.notifyManager.batchCalls(e)):o.noop;return d.updateResult(),t},[d,v]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),y.useEffect(()=>{d.setOptions(c)},[c,d]),c?.suspense&&p.isPending)throw g(c,d,a);if((({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&void 0===e.data||(0,o.shouldThrowError)(s,[e.error,r])))({result:p,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw p.error;if(u.getDefaultOptions().queries?._experimental_afterQuery?.(c,p),c.experimental_prefetchInRender&&!o.isServer&&p.isLoading&&p.isFetching&&!n){let e=h?g(c,d,a):l?.promise;e?.catch(o.noop).finally(()=>{d.updateResult()})}return c.notifyOnChangeProps?p:d.trackResult(p)}(e,c,t)}e.s(["useQuery",()=>v],66027);var x=e.i(14272),w=n,k=class extends w.Subscribable{#e;#n=void 0;#C;#R;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#j()}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,o.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#C,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,o.hashKey)(t.mutationKey)!==(0,o.hashKey)(this.options.mutationKey)?this.reset():this.#C?.state.status==="pending"&&this.#C.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#C?.removeObserver(this)}onMutationUpdate(e){this.#j(),this.#S(e)}getCurrentResult(){return this.#n}reset(){this.#C?.removeObserver(this),this.#C=void 0,this.#j(),this.#S()}mutate(e,t){return this.#R=t,this.#C?.removeObserver(this),this.#C=this.#e.getMutationCache().build(this.#e,this.options),this.#C.addObserver(this),this.#C.execute(e)}#j(){let e=this.#C?.state??(0,x.getDefaultState)();this.#n={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#S(e){r.notifyManager.batch(()=>{if(this.#R&&this.hasListeners()){let t=this.#n.variables,s=this.#n.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#R.onSuccess?.(e.data,t,s,r)}catch(e){Promise.reject(e)}try{this.#R.onSettled?.(e.data,null,t,s,r)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#R.onError?.(e.error,t,s,r)}catch(e){Promise.reject(e)}try{this.#R.onSettled?.(void 0,e.error,t,s,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#n)})})}};function S(e,t){let s=(0,f.useQueryClient)(t),[i]=y.useState(()=>new k(s,e));y.useEffect(()=>{i.setOptions(e)},[i,e]);let n=y.useSyncExternalStore(y.useCallback(e=>i.subscribe(r.notifyManager.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),a=y.useCallback((e,t)=>{i.mutate(e,t).catch(o.noop)},[i]);if(n.error&&(0,o.shouldThrowError)(i.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}e.s(["useMutation",()=>S],54616)},3999,e=>{"use strict";var t=e.i(66027),s=e.i(54616),r=e.i(12598),i=e.i(9165);function n(e={}){return(0,t.useQuery)({queryKey:["sessions",e],queryFn:async()=>{let t=new URLSearchParams;return e.projectId&&t.set("projectId",e.projectId),void 0!==e.starred&&t.set("starred",String(e.starred)),e.search&&t.set("search",e.search),e.agentType&&t.set("agentType",e.agentType),e.sortBy&&t.set("sortBy",e.sortBy),e.sortDir&&t.set("sortDir",e.sortDir),void 0!==e.offset&&t.set("offset",String(e.offset)),void 0!==e.limit&&t.set("limit",String(e.limit)),"all"===e.nodeFilter&&t.set("nodes","all"),(await fetch((0,i.api)(`/api/sessions?${t}`))).json()}})}function a(e){return(0,t.useQuery)({queryKey:["session",e],queryFn:async()=>{let t=await fetch((0,i.api)(`/api/sessions/${e}`));if(!t.ok)throw Error("Session not found");return t.json()},enabled:!!e})}function o(e,s=0,r=50,n){return(0,t.useQuery)({queryKey:["messages",e,s,r,n],queryFn:async()=>{let t=n?(0,i.api)(`/api/network/proxy/${n}/sessions/${e}/messages?offset=${s}&limit=${r}`):(0,i.api)(`/api/sessions/${e}/messages?offset=${s}&limit=${r}`);return(await fetch(t)).json()},enabled:!!e})}function u(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"star"})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function c(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,notes:t})=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"notes",notes:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["session"]})}})}function l(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,tagName:t})=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"tag",tagName:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["tags"]})}})}function h(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,tagName:t})=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"removeTag",tagName:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["tags"]})}})}function d(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,name:t})=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",name:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function p(){return(0,t.useQuery)({queryKey:["tags"],queryFn:async()=>(await fetch((0,i.api)("/api/tags"))).json()})}function y(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)("/api/tags"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",tagId:e})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function f(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({tagId:e,color:t})=>(await fetch((0,i.api)("/api/tags"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"updateColor",tagId:e,color:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function m(){return(0,t.useQuery)({queryKey:["workspaces"],queryFn:async()=>(await fetch((0,i.api)("/api/workspaces"))).json()})}function b(){return(0,t.useQuery)({queryKey:["workspaces","remote"],queryFn:async()=>(await fetch((0,i.api)("/api/workspaces?nodes=all"))).json()})}function g(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({workspaceId:e,sessionId:t,nodeId:s,title:r,cwd:n,agentType:a})=>{let o=await fetch((0,i.api)(`/api/workspaces/${e}/sessions`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t,nodeId:s,title:r,cwd:n,agentType:a})});if(!o.ok)throw Error("Failed to add session to workspace");return o.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["workspace-sessions"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function v(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({workspaceId:e,sessionId:t})=>{let s=await fetch((0,i.api)(`/api/workspaces/${e}/sessions`),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t})});if(!s.ok)throw Error("Failed to remove session from workspace");return s.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["workspace-sessions"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function x(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)("/api/bulk"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["tags"]})}})}function w(){return(0,t.useQuery)({queryKey:["projects"],queryFn:async()=>(await fetch((0,i.api)("/api/projects"))).json()})}function k(){return(0,t.useQuery)({queryKey:["analytics"],queryFn:async()=>(await fetch((0,i.api)("/api/analytics/overview"))).json()})}function S(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async()=>(await fetch((0,i.api)("/api/sync"),{method:"POST"})).json(),onSuccess:()=>{e.invalidateQueries()}})}e.s(["useAddSessionToWorkspace",()=>g,"useAddTag",()=>l,"useAnalytics",()=>k,"useBulkAction",()=>x,"useDeleteTag",()=>y,"useMessages",()=>o,"useProjects",()=>w,"useRemoteWorkspaces",()=>b,"useRemoveSessionFromWorkspace",()=>v,"useRemoveTag",()=>h,"useRenameSession",()=>d,"useSession",()=>a,"useSessions",()=>n,"useSync",()=>S,"useTags",()=>p,"useToggleStar",()=>u,"useUpdateNotes",()=>c,"useUpdateTagColor",()=>f,"useWorkspaces",()=>m])},3116,e=>{"use strict";let t=(0,e.i(75254).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);e.s(["Clock",()=>t],3116)},7233,e=>{"use strict";let t=(0,e.i(75254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>t],7233)},27612,e=>{"use strict";let t=(0,e.i(75254).default)("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"}]]);e.s(["Trash2",()=>t],27612)},68407,e=>{"use strict";var t=e.i(66027),s=e.i(54616),r=e.i(12598),i=e.i(9165);function n(){return(0,t.useQuery)({queryKey:["node-identity"],queryFn:async()=>(await fetch((0,i.api)("/api/network/identity"))).json()})}function a(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)("/api/network/identity"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["node-identity"]})}})}function o(e=!0){return(0,t.useQuery)({queryKey:["network-nodes"],queryFn:async()=>{let e=await fetch((0,i.api)("/api/network/nodes"));if(!e.ok)return[];let t=await e.json();return Array.isArray(t)?t:[]},enabled:e})}function u(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>{let t=await fetch((0,i.api)("/api/network/nodes"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error((await t.json()).error||"Failed to add node");return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["network-nodes"]})}})}function c(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)(`/api/network/nodes/${e}`),{method:"DELETE"})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["network-nodes"]})}})}function l(){return(0,t.useQuery)({queryKey:["network-api-keys"],queryFn:async()=>(await fetch((0,i.api)("/api/network/keys"))).json()})}function h(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)("/api/network/keys"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["network-api-keys"]})}})}function d(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)(`/api/network/keys/${e}`),{method:"DELETE"})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["network-api-keys"]})}})}function p(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async()=>(await fetch((0,i.api)("/api/network/nodes/check"),{method:"POST"})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["network-nodes"]})}})}e.s(["useAddNode",()=>u,"useApiKeys",()=>l,"useCheckHealth",()=>p,"useCreateApiKey",()=>h,"useNodeIdentity",()=>n,"useNodes",()=>o,"useRemoveNode",()=>c,"useRevokeApiKey",()=>d,"useUpdateNodeName",()=>a])},94351,e=>{"use strict";let t=(0,e.i(75254).default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);e.s(["Home",()=>t],94351)},74886,e=>{"use strict";let t=(0,e.i(75254).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",()=>t],74886)},68054,e=>{"use strict";let t=(0,e.i(75254).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],68054)},64659,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>t],64659)},14764,e=>{"use strict";let t=(0,e.i(75254).default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);e.s(["Send",()=>t],14764)},63059,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],63059)},98003,e=>{"use strict";var t=e.i(18050),s=e.i(75157);let r=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#78716c"];function i({value:e,onChange:i,className:n}){return(0,t.jsx)("div",{className:(0,s.cn)("grid grid-cols-8 gap-1.5",n),children:r.map(r=>(0,t.jsx)("button",{onClick:()=>i(r),className:(0,s.cn)("w-6 h-6 rounded-full border-2 transition-transform hover:scale-110",e===r?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:r},title:r},r))})}e.s(["ColorPicker",()=>i])},55900,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["ChevronUp",()=>t],55900)},43531,e=>{"use strict";let t=(0,e.i(75254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",()=>t],43531)},37727,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",()=>t],37727)},88699,e=>{"use strict";let t=(0,e.i(75254).default)("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.s(["Pencil",()=>t],88699)},73359,e=>{"use strict";let t={shell:{id:"shell",name:"Shell",command:"",resumeFlag:"",supportsResume:!1,color:"#71717a",description:"Plain terminal shell"},claude:{id:"claude",name:"Claude Code",command:"claude",resumeFlag:"--resume",supportsResume:!0,color:"#d97706",description:"Anthropic Claude Code CLI"},codex:{id:"codex",name:"Codex CLI",command:"codex",resumeFlag:"resume",supportsResume:!0,color:"#10b981",description:"OpenAI Codex CLI"},gemini:{id:"gemini",name:"Gemini CLI",command:"gemini",resumeFlag:"--resume",supportsResume:!0,color:"#3b82f6",description:"Google Gemini CLI"},aider:{id:"aider",name:"Aider",command:"aider",resumeFlag:"",supportsResume:!1,color:"#8b5cf6",description:"AI pair programming in your terminal"},custom:{id:"custom",name:"Custom",command:"",resumeFlag:"",supportsResume:!1,color:"#ec4899",description:"Custom command"}},s=Object.values(t);e.s(["AGENT_LIST",0,s,"AGENT_TYPES",0,t])},34623,e=>{"use strict";var t=e.i(18050),s=e.i(71645),r=e.i(31278),i=e.i(39616),n=e.i(18566),a=e.i(9165),o=e.i(29320);let u="spaces-terminal-token";function c({children:e}){let c=(0,n.useRouter)(),{isDesktop:l,basePath:h}=(0,o.useTier)(),[d,p]=(0,s.useState)("loading"),[y,f]=(0,s.useState)(""),[m,b]=(0,s.useState)(""),[g,v]=(0,s.useState)(""),[x,w]=(0,s.useState)(!1),k=(0,s.useRef)(null),S=`${h}/spaces_icon.png`;(0,s.useEffect)(()=>{if(l){f("desktop-local"),p("authorized");return}function e(){let e=sessionStorage.getItem(u);if(e){f(e),p("authorized");return}fetch((0,a.api)("/api/auth/totp/status")).then(e=>e.json()).then(e=>{e.enabled?(p("prompt"),setTimeout(()=>k.current?.focus(),100)):p("not-setup")}).catch(()=>p("not-setup"))}fetch((0,a.api)("/api/auth/me")).then(t=>{if(t.ok){f("session-auth"),p("authorized");return}return e()}).catch(()=>e())},[l]);let C=(0,s.useCallback)(async e=>{if(6!==e.length)return;w(!0),v("");let t=await fetch((0,a.api)("/api/auth/totp/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,action:"verify"})}),s=await t.json();w(!1),s.success&&s.terminalToken?(sessionStorage.setItem(u,s.terminalToken),f(s.terminalToken),p("authorized")):(v(s.error||"Invalid code"),b(""),k.current?.focus())},[]);return"loading"===d?(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsx)(r.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})}):"authorized"===d?(0,t.jsx)(t.Fragment,{children:e(y)}):"not-setup"===d?(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsxs)("div",{className:"text-center space-y-4 max-w-sm",children:[(0,t.jsx)("img",{src:S,alt:"Spaces",className:"w-12 h-12 mx-auto opacity-40"}),(0,t.jsx)("h2",{className:"text-lg font-semibold text-white",children:"2FA Required"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Two-factor authentication must be set up before you can use terminals."}),(0,t.jsxs)("button",{onClick:()=>c.push("/settings"),className:"inline-flex items-center gap-2 px-4 py-2 text-sm bg-indigo-600 text-white rounded-md hover:bg-indigo-500",children:[(0,t.jsx)(i.Settings,{className:"w-4 h-4"}),"Go to Settings"]})]})}):(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsxs)("div",{className:"text-center space-y-4 max-w-sm",children:[(0,t.jsx)("img",{src:S,alt:"Spaces",className:"w-12 h-12 mx-auto"}),(0,t.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Terminal Verification"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Enter the 6-digit code from your authenticator app."}),(0,t.jsxs)("div",{children:[(0,t.jsx)("input",{ref:k,type:"text",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"000000",value:m,onChange:e=>{let t;b(t=e.target.value.replace(/\D/g,"").slice(0,6)),v(""),6===t.length&&C(t)},disabled:x,className:"w-48 px-3 py-3 text-2xl font-mono tracking-[0.4em] text-center bg-zinc-800 border border-zinc-700 rounded-lg focus:outline-none focus:border-indigo-500 text-white disabled:opacity-50",autoFocus:!0}),x&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 mt-3 text-xs text-zinc-400",children:[(0,t.jsx)(r.Loader2,{className:"w-3 h-3 animate-spin"}),"Verifying..."]}),g&&(0,t.jsx)("p",{className:"text-sm text-red-400 mt-3",children:g})]}),(0,t.jsx)("p",{className:"text-[11px] text-zinc-600",children:"Token is valid for 8 hours after verification."})]})})}e.s(["TotpGate",()=>c])},24134,e=>{"use strict";var t=e.i(47167),s=e.i(18050),r=e.i(71645),i=e.i(74080),n=e.i(37727),a=e.i(88699),o=e.i(43531),u=e.i(75254);let c=(0,u.default)("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"}]]),l=(0,u.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),h=(0,u.default)("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),d=(0,u.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var p=e.i(48256),y=e.i(61911),f=e.i(75157),m=e.i(73359);let b=t.default.env.NEXT_PUBLIC_WS_PATH;function g({pane:t,onClose:u,onUpdate:g,isMaximized:v,onToggleMaximize:x,onPopout:w,isPopout:k,terminalToken:S,workspaceCollaboration:C}){let R=(0,r.useRef)(null),j=(0,r.useRef)(null),T=(0,r.useRef)(null),Q=(0,r.useRef)(null),[O,M]=(0,r.useState)(!1),[N,E]=(0,r.useState)(!1),[q,I]=(0,r.useState)(t.title),[F,P]=(0,r.useState)(!1),[K,z]=(0,r.useState)({x:0,y:0}),A=(0,r.useRef)(null),U=(0,r.useRef)(null),[D,$]=(0,r.useState)(!1),L=(0,r.useRef)(t);L.current=t;let _=(0,r.useRef)(g);_.current=g;let J=(0,r.useRef)(S);J.current=S;let B=(0,r.useRef)(!1),W=(0,r.useRef)(!1),H=(0,r.useRef)(null),G=(0,r.useRef)(0),V=(0,r.useCallback)(async()=>{if(!R.current)return;L.current,W.current=!1,G.current=0;let{Terminal:t}=await e.A(16049),{FitAddon:s}=await e.A(59439),{WebLinksAddon:r}=await e.A(16091);j.current&&j.current.dispose();let i=new t({cursorBlink:!0,fontSize:13,fontFamily:"'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace",theme:{background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#6366f1",selectionBackground:"#6366f133",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"},allowProposedApi:!0}),n=new s,a=new r;i.loadAddon(n),i.loadAddon(a),await new Promise(e=>requestAnimationFrame(()=>{if(R.current){i.open(R.current);try{n.fit()}catch{}}e()})),j.current=i,Q.current=n;let o=()=>{try{n.fit()}catch{}};requestAnimationFrame(()=>requestAnimationFrame(o)),setTimeout(o,300);let u=()=>{let e,t,s,r,n;if(W.current)return;G.current>0&&(i.write("\x1b[2J\x1b[H"),i.clear());let a=new WebSocket((t=new URLSearchParams({paneId:(e=L.current).id,cwd:e.cwd,agentType:e.agentType||"shell",cols:String(i.cols),rows:String(i.rows)}),e.claudeSessionId&&t.set("agentSession",e.claudeSessionId),e.customCommand&&t.set("customCommand",e.customCommand),e.nodeId&&t.set("nodeId",e.nodeId),(s=J.current)&&t.set("terminalToken",s),r=b||"/ws",n="https:"===location.protocol?"wss:":"ws:",`${n}//${location.host}${r}?${t}`));T.current=a,a.onopen=()=>{M(!0),$(!1),B.current=!1,G.current=0,setTimeout(()=>{if(Q.current)try{Q.current.fit()}catch{}},150)},a.onmessage=e=>{try{let t=JSON.parse(e.data);if("data"===t.type)i.write(t.data);else if("exit"===t.type){$(!0),B.current=!0;let e=t.reason?` — ${t.reason}`:"";i.write(`\r
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31278,e=>{"use strict";let t=(0,e.i(75254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],31278)},66027,54616,e=>{"use strict";let t;var s=e.i(75555),r=e.i(40143),i=e.i(86491),n=e.i(15823),a=e.i(93803),o=e.i(19273),u=e.i(80166),c=class extends n.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#s=(0,a.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#r=void 0;#i=void 0;#n=void 0;#a;#o;#s;#t;#u;#c;#l;#h;#d;#p;#y=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#r.addObserver(this),l(this.#r,this.options)?this.#f():this.updateResult(),this.#m())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return h(this.#r,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return h(this.#r,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#g(),this.#r.removeObserver(this)}setOptions(e){let t=this.options,s=this.#r;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,o.resolveEnabled)(this.options.enabled,this.#r))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#v(),this.#r.setOptions(this.options),t._defaulted&&!(0,o.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#r,observer:this});let r=this.hasListeners();r&&d(this.#r,s,this.options,t)&&this.#f(),this.updateResult(),r&&(this.#r!==s||(0,o.resolveEnabled)(this.options.enabled,this.#r)!==(0,o.resolveEnabled)(t.enabled,this.#r)||(0,o.resolveStaleTime)(this.options.staleTime,this.#r)!==(0,o.resolveStaleTime)(t.staleTime,this.#r))&&this.#x();let i=this.#w();r&&(this.#r!==s||(0,o.resolveEnabled)(this.options.enabled,this.#r)!==(0,o.resolveEnabled)(t.enabled,this.#r)||i!==this.#p)&&this.#k(i)}getOptimisticResult(e){var t,s;let r=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(r,e);return t=this,s=i,(0,o.shallowEqualObjects)(t.getCurrentResult(),s)||(this.#n=i,this.#o=this.options,this.#a=this.#r.state),i}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(e,s)=>(this.trackProp(s),t?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#s.status||this.#s.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,s))})}trackProp(e){this.#y.add(e)}getCurrentQuery(){return this.#r}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),s=this.#e.getQueryCache().build(this.#e,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#f({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#f(e){this.#v();let t=this.#r.fetch(this.options,e);return e?.throwOnError||(t=t.catch(o.noop)),t}#x(){this.#b();let e=(0,o.resolveStaleTime)(this.options.staleTime,this.#r);if(o.isServer||this.#n.isStale||!(0,o.isValidTimeout)(e))return;let t=(0,o.timeUntilStale)(this.#n.dataUpdatedAt,e);this.#h=u.timeoutManager.setTimeout(()=>{this.#n.isStale||this.updateResult()},t+1)}#w(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#r):this.options.refetchInterval)??!1}#k(e){this.#g(),this.#p=e,!o.isServer&&!1!==(0,o.resolveEnabled)(this.options.enabled,this.#r)&&(0,o.isValidTimeout)(this.#p)&&0!==this.#p&&(this.#d=u.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||s.focusManager.isFocused())&&this.#f()},this.#p))}#m(){this.#x(),this.#k(this.#w())}#b(){this.#h&&(u.timeoutManager.clearTimeout(this.#h),this.#h=void 0)}#g(){this.#d&&(u.timeoutManager.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let s,r=this.#r,n=this.options,u=this.#n,c=this.#a,h=this.#o,y=e!==r?e.state:this.#i,{state:f}=e,m={...f},b=!1;if(t._optimisticResults){let s=this.hasListeners(),a=!s&&l(e,t),o=s&&d(e,r,t,n);(a||o)&&(m={...m,...(0,i.fetchState)(f.data,e.options)}),"isRestoring"===t._optimisticResults&&(m.fetchStatus="idle")}let{error:g,errorUpdatedAt:v,status:x}=m;s=m.data;let w=!1;if(void 0!==t.placeholderData&&void 0===s&&"pending"===x){let e;u?.isPlaceholderData&&t.placeholderData===h?.placeholderData?(e=u.data,w=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,void 0!==e&&(x="success",s=(0,o.replaceData)(u?.data,e,t),b=!0)}if(t.select&&void 0!==s&&!w)if(u&&s===c?.data&&t.select===this.#u)s=this.#c;else try{this.#u=t.select,s=t.select(s),s=(0,o.replaceData)(u?.data,s,t),this.#c=s,this.#t=null}catch(e){this.#t=e}this.#t&&(g=this.#t,s=this.#c,v=Date.now(),x="error");let k="fetching"===m.fetchStatus,S="pending"===x,C="error"===x,R=S&&k,j=void 0!==s,T={status:x,fetchStatus:m.fetchStatus,isPending:S,isSuccess:"success"===x,isError:C,isInitialLoading:R,isLoading:R,data:s,dataUpdatedAt:m.dataUpdatedAt,error:g,errorUpdatedAt:v,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>y.dataUpdateCount||m.errorUpdateCount>y.errorUpdateCount,isFetching:k,isRefetching:k&&!S,isLoadingError:C&&!j,isPaused:"paused"===m.fetchStatus,isPlaceholderData:b,isRefetchError:C&&j,isStale:p(e,t),refetch:this.refetch,promise:this.#s,isEnabled:!1!==(0,o.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==T.data,s="error"===T.status&&!t,i=e=>{s?e.reject(T.error):t&&e.resolve(T.data)},n=()=>{i(this.#s=T.promise=(0,a.pendingThenable)())},o=this.#s;switch(o.status){case"pending":e.queryHash===r.queryHash&&i(o);break;case"fulfilled":(s||T.data!==o.value)&&n();break;case"rejected":s&&T.error===o.reason||n()}}return T}updateResult(){let e=this.#n,t=this.createResult(this.#r,this.options);if(this.#a=this.#r.state,this.#o=this.options,void 0!==this.#a.data&&(this.#l=this.#r),(0,o.shallowEqualObjects)(t,e))return;this.#n=t;let s=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,s="function"==typeof t?t():t;if("all"===s||!s&&!this.#y.size)return!0;let r=new Set(s??this.#y);return this.options.throwOnError&&r.add("error"),Object.keys(this.#n).some(t=>this.#n[t]!==e[t]&&r.has(t))};this.#S({listeners:s()})}#v(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#r)return;let t=this.#r;this.#r=e,this.#i=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#m()}#S(e){r.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#r,type:"observerResultsUpdated"})})}};function l(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&h(e,t,t.refetchOnMount)}function h(e,t,s){if(!1!==(0,o.resolveEnabled)(t.enabled,e)&&"static"!==(0,o.resolveStaleTime)(t.staleTime,e)){let r="function"==typeof s?s(e):s;return"always"===r||!1!==r&&p(e,t)}return!1}function d(e,t,s,r){return(e!==t||!1===(0,o.resolveEnabled)(r.enabled,e))&&(!s.suspense||"error"!==e.state.status)&&p(e,s)}function p(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,o.resolveStaleTime)(t.staleTime,e))}e.i(47167);var y=e.i(71645),f=e.i(12598);e.i(18050);var m=y.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),b=y.createContext(!1);b.Provider;var g=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function v(e,t){return function(e,t,s){let i,n=y.useContext(b),a=y.useContext(m),u=(0,f.useQueryClient)(s),c=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(c);let l=u.getQueryCache().get(c.queryHash);if(c._optimisticResults=n?"isRestoring":"optimistic",c.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=c.staleTime;c.staleTime="function"==typeof t?(...s)=>e(t(...s)):e(t),"number"==typeof c.gcTime&&(c.gcTime=Math.max(c.gcTime,1e3))}i=l?.state.error&&"function"==typeof c.throwOnError?(0,o.shouldThrowError)(c.throwOnError,[l.state.error,l]):c.throwOnError,(c.suspense||c.experimental_prefetchInRender||i)&&!a.isReset()&&(c.retryOnMount=!1),y.useEffect(()=>{a.clearReset()},[a]);let h=!u.getQueryCache().get(c.queryHash),[d]=y.useState(()=>new t(u,c)),p=d.getOptimisticResult(c),v=!n&&!1!==e.subscribed;if(y.useSyncExternalStore(y.useCallback(e=>{let t=v?d.subscribe(r.notifyManager.batchCalls(e)):o.noop;return d.updateResult(),t},[d,v]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),y.useEffect(()=>{d.setOptions(c)},[c,d]),c?.suspense&&p.isPending)throw g(c,d,a);if((({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&void 0===e.data||(0,o.shouldThrowError)(s,[e.error,r])))({result:p,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw p.error;if(u.getDefaultOptions().queries?._experimental_afterQuery?.(c,p),c.experimental_prefetchInRender&&!o.isServer&&p.isLoading&&p.isFetching&&!n){let e=h?g(c,d,a):l?.promise;e?.catch(o.noop).finally(()=>{d.updateResult()})}return c.notifyOnChangeProps?p:d.trackResult(p)}(e,c,t)}e.s(["useQuery",()=>v],66027);var x=e.i(14272),w=n,k=class extends w.Subscribable{#e;#n=void 0;#C;#R;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#j()}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,o.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#C,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,o.hashKey)(t.mutationKey)!==(0,o.hashKey)(this.options.mutationKey)?this.reset():this.#C?.state.status==="pending"&&this.#C.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#C?.removeObserver(this)}onMutationUpdate(e){this.#j(),this.#S(e)}getCurrentResult(){return this.#n}reset(){this.#C?.removeObserver(this),this.#C=void 0,this.#j(),this.#S()}mutate(e,t){return this.#R=t,this.#C?.removeObserver(this),this.#C=this.#e.getMutationCache().build(this.#e,this.options),this.#C.addObserver(this),this.#C.execute(e)}#j(){let e=this.#C?.state??(0,x.getDefaultState)();this.#n={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#S(e){r.notifyManager.batch(()=>{if(this.#R&&this.hasListeners()){let t=this.#n.variables,s=this.#n.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#R.onSuccess?.(e.data,t,s,r)}catch(e){Promise.reject(e)}try{this.#R.onSettled?.(e.data,null,t,s,r)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#R.onError?.(e.error,t,s,r)}catch(e){Promise.reject(e)}try{this.#R.onSettled?.(void 0,e.error,t,s,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#n)})})}};function S(e,t){let s=(0,f.useQueryClient)(t),[i]=y.useState(()=>new k(s,e));y.useEffect(()=>{i.setOptions(e)},[i,e]);let n=y.useSyncExternalStore(y.useCallback(e=>i.subscribe(r.notifyManager.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),a=y.useCallback((e,t)=>{i.mutate(e,t).catch(o.noop)},[i]);if(n.error&&(0,o.shouldThrowError)(i.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}e.s(["useMutation",()=>S],54616)},3999,e=>{"use strict";var t=e.i(66027),s=e.i(54616),r=e.i(12598),i=e.i(9165);function n(e={}){return(0,t.useQuery)({queryKey:["sessions",e],queryFn:async()=>{let t=new URLSearchParams;return e.projectId&&t.set("projectId",e.projectId),void 0!==e.starred&&t.set("starred",String(e.starred)),e.search&&t.set("search",e.search),e.agentType&&t.set("agentType",e.agentType),e.sortBy&&t.set("sortBy",e.sortBy),e.sortDir&&t.set("sortDir",e.sortDir),void 0!==e.offset&&t.set("offset",String(e.offset)),void 0!==e.limit&&t.set("limit",String(e.limit)),"all"===e.nodeFilter&&t.set("nodes","all"),(await fetch((0,i.api)(`/api/sessions?${t}`))).json()}})}function a(e){return(0,t.useQuery)({queryKey:["session",e],queryFn:async()=>{let t=await fetch((0,i.api)(`/api/sessions/${e}`));if(!t.ok)throw Error("Session not found");return t.json()},enabled:!!e})}function o(e,s=0,r=50,n){return(0,t.useQuery)({queryKey:["messages",e,s,r,n],queryFn:async()=>{let t=n?(0,i.api)(`/api/network/proxy/${n}/sessions/${e}/messages?offset=${s}&limit=${r}`):(0,i.api)(`/api/sessions/${e}/messages?offset=${s}&limit=${r}`);return(await fetch(t)).json()},enabled:!!e})}function u(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"star"})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function c(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,notes:t})=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"notes",notes:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["session"]})}})}function l(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,tagName:t})=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"tag",tagName:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["tags"]})}})}function h(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,tagName:t})=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"removeTag",tagName:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["tags"]})}})}function d(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,name:t})=>(await fetch((0,i.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",name:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function p(){return(0,t.useQuery)({queryKey:["tags"],queryFn:async()=>(await fetch((0,i.api)("/api/tags"))).json()})}function y(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)("/api/tags"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",tagId:e})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function f(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({tagId:e,color:t})=>(await fetch((0,i.api)("/api/tags"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"updateColor",tagId:e,color:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function m(){return(0,t.useQuery)({queryKey:["workspaces"],queryFn:async()=>(await fetch((0,i.api)("/api/workspaces"))).json()})}function b(){return(0,t.useQuery)({queryKey:["workspaces","remote"],queryFn:async()=>(await fetch((0,i.api)("/api/workspaces?nodes=all"))).json()})}function g(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({workspaceId:e,sessionId:t,nodeId:s,title:r,cwd:n,agentType:a})=>{let o=await fetch((0,i.api)(`/api/workspaces/${e}/sessions`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t,nodeId:s,title:r,cwd:n,agentType:a})});if(!o.ok)throw Error("Failed to add session to workspace");return o.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["workspace-sessions"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function v(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async({workspaceId:e,sessionId:t})=>{let s=await fetch((0,i.api)(`/api/workspaces/${e}/sessions`),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t})});if(!s.ok)throw Error("Failed to remove session from workspace");return s.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["workspace-sessions"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function x(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)("/api/bulk"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["tags"]})}})}function w(){return(0,t.useQuery)({queryKey:["projects"],queryFn:async()=>(await fetch((0,i.api)("/api/projects"))).json()})}function k(){return(0,t.useQuery)({queryKey:["analytics"],queryFn:async()=>(await fetch((0,i.api)("/api/analytics/overview"))).json()})}function S(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async()=>(await fetch((0,i.api)("/api/sync"),{method:"POST"})).json(),onSuccess:()=>{e.invalidateQueries()}})}e.s(["useAddSessionToWorkspace",()=>g,"useAddTag",()=>l,"useAnalytics",()=>k,"useBulkAction",()=>x,"useDeleteTag",()=>y,"useMessages",()=>o,"useProjects",()=>w,"useRemoteWorkspaces",()=>b,"useRemoveSessionFromWorkspace",()=>v,"useRemoveTag",()=>h,"useRenameSession",()=>d,"useSession",()=>a,"useSessions",()=>n,"useSync",()=>S,"useTags",()=>p,"useToggleStar",()=>u,"useUpdateNotes",()=>c,"useUpdateTagColor",()=>f,"useWorkspaces",()=>m])},3116,e=>{"use strict";let t=(0,e.i(75254).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);e.s(["Clock",()=>t],3116)},7233,e=>{"use strict";let t=(0,e.i(75254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>t],7233)},27612,e=>{"use strict";let t=(0,e.i(75254).default)("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"}]]);e.s(["Trash2",()=>t],27612)},68407,e=>{"use strict";var t=e.i(66027),s=e.i(54616),r=e.i(12598),i=e.i(9165);function n(){return(0,t.useQuery)({queryKey:["node-identity"],queryFn:async()=>(await fetch((0,i.api)("/api/network/identity"))).json()})}function a(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)("/api/network/identity"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["node-identity"]})}})}function o(e=!0){return(0,t.useQuery)({queryKey:["network-nodes"],queryFn:async()=>{let e=await fetch((0,i.api)("/api/network/nodes"));if(!e.ok)return[];let t=await e.json();return Array.isArray(t)?t:[]},enabled:e})}function u(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>{let t=await fetch((0,i.api)("/api/network/nodes"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error((await t.json()).error||"Failed to add node");return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["network-nodes"]})}})}function c(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)(`/api/network/nodes/${e}`),{method:"DELETE"})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["network-nodes"]})}})}function l(){return(0,t.useQuery)({queryKey:["network-api-keys"],queryFn:async()=>(await fetch((0,i.api)("/api/network/keys"))).json()})}function h(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)("/api/network/keys"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["network-api-keys"]})}})}function d(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,i.api)(`/api/network/keys/${e}`),{method:"DELETE"})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["network-api-keys"]})}})}function p(){let e=(0,r.useQueryClient)();return(0,s.useMutation)({mutationFn:async()=>(await fetch((0,i.api)("/api/network/nodes/check"),{method:"POST"})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["network-nodes"]})}})}e.s(["useAddNode",()=>u,"useApiKeys",()=>l,"useCheckHealth",()=>p,"useCreateApiKey",()=>h,"useNodeIdentity",()=>n,"useNodes",()=>o,"useRemoveNode",()=>c,"useRevokeApiKey",()=>d,"useUpdateNodeName",()=>a])},94351,e=>{"use strict";let t=(0,e.i(75254).default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);e.s(["Home",()=>t],94351)},74886,e=>{"use strict";let t=(0,e.i(75254).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",()=>t],74886)},68054,e=>{"use strict";let t=(0,e.i(75254).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],68054)},64659,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["ChevronDown",()=>t],64659)},14764,e=>{"use strict";let t=(0,e.i(75254).default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);e.s(["Send",()=>t],14764)},63059,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],63059)},98003,e=>{"use strict";var t=e.i(18050),s=e.i(75157);let r=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#78716c"];function i({value:e,onChange:i,className:n}){return(0,t.jsx)("div",{className:(0,s.cn)("grid grid-cols-8 gap-1.5",n),children:r.map(r=>(0,t.jsx)("button",{onClick:()=>i(r),className:(0,s.cn)("w-6 h-6 rounded-full border-2 transition-transform hover:scale-110",e===r?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:r},title:r},r))})}e.s(["ColorPicker",()=>i])},55900,e=>{"use strict";let t=(0,e.i(75254).default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["ChevronUp",()=>t],55900)},43531,e=>{"use strict";let t=(0,e.i(75254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",()=>t],43531)},37727,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",()=>t],37727)},88699,e=>{"use strict";let t=(0,e.i(75254).default)("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.s(["Pencil",()=>t],88699)},73359,e=>{"use strict";let t={shell:{id:"shell",name:"Shell",command:"",resumeFlag:"",supportsResume:!1,color:"#71717a",description:"Plain terminal shell"},claude:{id:"claude",name:"Claude Code",command:"claude",resumeFlag:"--resume",supportsResume:!0,color:"#d97706",description:"Anthropic Claude Code CLI"},codex:{id:"codex",name:"Codex CLI",command:"codex",resumeFlag:"resume",supportsResume:!0,color:"#10b981",description:"OpenAI Codex CLI"},gemini:{id:"gemini",name:"Gemini CLI",command:"gemini",resumeFlag:"--resume",supportsResume:!0,color:"#3b82f6",description:"Google Gemini CLI"},aider:{id:"aider",name:"Aider",command:"aider",resumeFlag:"",supportsResume:!1,color:"#8b5cf6",description:"AI pair programming in your terminal"},custom:{id:"custom",name:"Custom",command:"",resumeFlag:"",supportsResume:!1,color:"#ec4899",description:"Custom command"}},s=Object.values(t);e.s(["AGENT_LIST",0,s,"AGENT_TYPES",0,t])},34623,e=>{"use strict";var t=e.i(18050),s=e.i(71645),r=e.i(31278),i=e.i(39616),n=e.i(18566),a=e.i(9165),o=e.i(29320);let u="spaces-terminal-token";function c({children:e}){let c=(0,n.useRouter)(),{isDesktop:l,basePath:h}=(0,o.useTier)(),[d,p]=(0,s.useState)("loading"),[y,f]=(0,s.useState)(""),[m,b]=(0,s.useState)(""),[g,v]=(0,s.useState)(""),[x,w]=(0,s.useState)(!1),k=(0,s.useRef)(null),S=`${h}/spaces_icon.png`;(0,s.useEffect)(()=>{if(l){f("desktop-local"),p("authorized");return}function e(){let e=sessionStorage.getItem(u);if(e){f(e),p("authorized");return}fetch((0,a.api)("/api/auth/totp/status")).then(e=>e.json()).then(e=>{e.enabled?(p("prompt"),setTimeout(()=>k.current?.focus(),100)):p("not-setup")}).catch(()=>p("not-setup"))}fetch((0,a.api)("/api/auth/me")).then(t=>{if(t.ok){f("session-auth"),p("authorized");return}return e()}).catch(()=>e())},[l]);let C=(0,s.useCallback)(async e=>{if(6!==e.length)return;w(!0),v("");let t=await fetch((0,a.api)("/api/auth/totp/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,action:"verify"})}),s=await t.json();w(!1),s.success&&s.terminalToken?(sessionStorage.setItem(u,s.terminalToken),f(s.terminalToken),p("authorized")):(v(s.error||"Invalid code"),b(""),k.current?.focus())},[]);return"loading"===d?(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsx)(r.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})}):"authorized"===d?(0,t.jsx)(t.Fragment,{children:e(y)}):"not-setup"===d?(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsxs)("div",{className:"text-center space-y-4 max-w-sm",children:[(0,t.jsx)("img",{src:S,alt:"Spaces",className:"w-12 h-12 mx-auto opacity-40"}),(0,t.jsx)("h2",{className:"text-lg font-semibold text-white",children:"2FA Required"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Two-factor authentication must be set up before you can use terminals."}),(0,t.jsxs)("button",{onClick:()=>c.push("/settings"),className:"inline-flex items-center gap-2 px-4 py-2 text-sm bg-indigo-600 text-white rounded-md hover:bg-indigo-500",children:[(0,t.jsx)(i.Settings,{className:"w-4 h-4"}),"Go to Settings"]})]})}):(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsxs)("div",{className:"text-center space-y-4 max-w-sm",children:[(0,t.jsx)("img",{src:S,alt:"Spaces",className:"w-12 h-12 mx-auto"}),(0,t.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Terminal Verification"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Enter the 6-digit code from your authenticator app."}),(0,t.jsxs)("div",{children:[(0,t.jsx)("input",{ref:k,type:"text",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"000000",value:m,onChange:e=>{let t;b(t=e.target.value.replace(/\D/g,"").slice(0,6)),v(""),6===t.length&&C(t)},disabled:x,className:"w-48 px-3 py-3 text-2xl font-mono tracking-[0.4em] text-center bg-zinc-800 border border-zinc-700 rounded-lg focus:outline-none focus:border-indigo-500 text-white disabled:opacity-50",autoFocus:!0}),x&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 mt-3 text-xs text-zinc-400",children:[(0,t.jsx)(r.Loader2,{className:"w-3 h-3 animate-spin"}),"Verifying..."]}),g&&(0,t.jsx)("p",{className:"text-sm text-red-400 mt-3",children:g})]}),(0,t.jsx)("p",{className:"text-[11px] text-zinc-600",children:"Token is valid for 8 hours after verification."})]})})}e.s(["TotpGate",()=>c])},24134,e=>{"use strict";var t=e.i(47167),s=e.i(18050),r=e.i(71645),i=e.i(74080),n=e.i(37727),a=e.i(88699),o=e.i(43531),u=e.i(75254);let c=(0,u.default)("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"}]]),l=(0,u.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),h=(0,u.default)("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),d=(0,u.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var p=e.i(48256),y=e.i(61911),f=e.i(75157),m=e.i(73359);let b=t.default.env.NEXT_PUBLIC_WS_PATH;function g({pane:t,onClose:u,onUpdate:g,isMaximized:v,onToggleMaximize:x,onPopout:w,isPopout:k,terminalToken:S,workspaceCollaboration:C}){let R=(0,r.useRef)(null),j=(0,r.useRef)(null),T=(0,r.useRef)(null),Q=(0,r.useRef)(null),[O,N]=(0,r.useState)(!1),[M,E]=(0,r.useState)(!1),[q,I]=(0,r.useState)(t.title),[F,P]=(0,r.useState)(!1),[K,z]=(0,r.useState)({x:0,y:0}),A=(0,r.useRef)(null),U=(0,r.useRef)(null),[D,$]=(0,r.useState)(!1),L=(0,r.useRef)(t);L.current=t;let _=(0,r.useRef)(g);_.current=g;let J=(0,r.useRef)(S);J.current=S;let W=(0,r.useRef)(!1),B=(0,r.useRef)(!1),H=(0,r.useRef)(null),G=(0,r.useRef)(0),V=(0,r.useCallback)(async()=>{if(!R.current)return;L.current,B.current=!1,G.current=0;let{Terminal:t}=await e.A(16049),{FitAddon:s}=await e.A(59439),{WebLinksAddon:r}=await e.A(16091);j.current&&j.current.dispose();let i=new t({cursorBlink:!0,fontSize:13,fontFamily:"'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace",theme:{background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#6366f1",selectionBackground:"#6366f133",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"},allowProposedApi:!0}),n=new s,a=new r;i.loadAddon(n),i.loadAddon(a),await new Promise(e=>requestAnimationFrame(()=>{if(R.current){i.open(R.current);try{n.fit()}catch{}}e()})),j.current=i,Q.current=n;let o=()=>{try{n.fit()}catch{}};requestAnimationFrame(()=>requestAnimationFrame(o)),setTimeout(o,300);let u=()=>{let e,t,s,r,n;if(B.current)return;G.current>0&&(i.write("\x1b[2J\x1b[H"),i.clear());let a=new WebSocket((t=new URLSearchParams({paneId:(e=L.current).id,cwd:e.cwd,agentType:e.agentType||"shell",cols:String(i.cols),rows:String(i.rows)}),e.claudeSessionId&&t.set("agentSession",e.claudeSessionId),e.customCommand&&t.set("customCommand",e.customCommand),e.nodeId&&t.set("nodeId",e.nodeId),(s=J.current)&&t.set("terminalToken",s),r=b||"/ws",n="https:"===location.protocol?"wss:":"ws:",`${n}//${location.host}${r}?${t}`));T.current=a,a.onopen=()=>{N(!0),$(!1),W.current=!1,G.current=0,setTimeout(()=>{if(Q.current)try{Q.current.fit()}catch{}},150)},a.onmessage=e=>{try{let t=JSON.parse(e.data);if("data"===t.type)i.write(t.data);else if("exit"===t.type){$(!0),W.current=!0;let e=t.reason?` — ${t.reason}`:"";i.write(`\r
2
2
  \x1b[90m[Process exited with code ${t.exitCode}${e}]\x1b[0m\r
3
3
  `)}else"error"===t.type?i.write(`\r
4
4
  \x1b[31m${t.data}\x1b[0m\r
5
- `):"session-detected"===t.type&&_.current(L.current.id,{claudeSessionId:t.sessionId})}catch{}},a.onclose=()=>{if(M(!1),!B.current&&!W.current){let e=G.current;if(e<20){let t=Math.min(1e3*Math.pow(1.5,e),3e4);G.current=e+1,H.current=setTimeout(u,t)}}},a.onerror=()=>{M(!1)}};i.onData(e=>{T.current?.readyState===WebSocket.OPEN&&T.current.send(JSON.stringify({type:"data",data:e}))}),i.onResize(({cols:e,rows:t})=>{T.current?.readyState===WebSocket.OPEN&&T.current.send(JSON.stringify({type:"resize",cols:e,rows:t}))}),u()},[]);(0,r.useEffect)(()=>(V(),()=>{W.current=!0,H.current&&clearTimeout(H.current),T.current?.close(),j.current?.dispose()}),[V]),(0,r.useEffect)(()=>{let e,t=new ResizeObserver(()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{if(Q.current)try{Q.current.fit()}catch{}})});return R.current&&t.observe(R.current),()=>{cancelAnimationFrame(e),t.disconnect()}},[]),(0,r.useEffect)(()=>{setTimeout(()=>{if(Q.current)try{Q.current.fit()}catch{}},50)},[v]);let Y=()=>{g(t.id,{title:q}),E(!1)};return(0,r.useEffect)(()=>{if(!F)return;let e=e=>{let t=e.target;A.current&&!A.current.contains(t)&&U.current&&!U.current.contains(t)&&P(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[F]),(0,s.jsxs)("div",{className:(0,f.cn)("flex flex-col border rounded-lg overflow-hidden",v?"fixed inset-2 z-50":"","border-zinc-700"),style:{borderColor:`${t.color}60`},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs select-none flex-shrink-0",style:{backgroundColor:`${t.color}60`},children:[(0,s.jsxs)("div",{ref:A,className:"flex-shrink-0",children:[(0,s.jsx)("button",{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();z({x:t.left,y:t.bottom+6}),P(!F)},className:"w-3 h-3 rounded-full hover:ring-2 hover:ring-zinc-500 ring-offset-1 ring-offset-zinc-900 transition-shadow cursor-pointer",style:{backgroundColor:t.color},title:"Change color"}),F&&(0,i.createPortal)((0,s.jsx)("div",{ref:U,className:"fixed z-[9999] bg-zinc-800 border border-zinc-600 rounded-xl p-3 shadow-2xl",style:{left:K.x,top:K.y},children:(0,s.jsx)("div",{className:"grid grid-cols-4 gap-2.5",style:{width:132},children:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#78716c"].map(e=>(0,s.jsx)("button",{onClick:()=>{g(t.id,{color:e}),P(!1)},className:`w-7 h-7 rounded-full border-2 transition-all hover:scale-110 ${t.color===e?"border-white scale-110 shadow-lg":"border-transparent hover:border-zinc-500"}`,style:{backgroundColor:e}},e))})}),document.body)]}),N?(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-1",children:[(0,s.jsx)("input",{autoFocus:!0,value:q,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&Y(),"Escape"===e.key&&(I(t.title),E(!1))},className:"flex-1 bg-transparent border border-zinc-600 rounded px-1.5 py-0.5 text-xs focus:outline-none focus:border-indigo-400"}),(0,s.jsx)("button",{onClick:Y,className:"text-green-400 hover:text-green-300",children:(0,s.jsx)(o.Check,{className:"w-3 h-3"})})]}):(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-1 min-w-0 group/title",children:[(0,s.jsx)("span",{onDoubleClick:()=>E(!0),className:"truncate text-zinc-300 font-medium cursor-default",children:t.title}),(0,s.jsx)("button",{onClick:()=>E(!0),className:"text-zinc-600 hover:text-zinc-300 opacity-0 group-hover/title:opacity-100 transition-opacity flex-shrink-0",title:"Rename",children:(0,s.jsx)(a.Pencil,{className:"w-2.5 h-2.5"})})]}),(0,s.jsx)("span",{className:"text-[10px] text-zinc-500 truncate max-w-[120px]",title:t.cwd,children:t.cwd.split(/[/\\]/).pop()}),t.agentType&&"shell"!==t.agentType&&(0,s.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:`${m.AGENT_TYPES[t.agentType]?.color||"#6366f1"}20`,color:m.AGENT_TYPES[t.agentType]?.color||"#6366f1"},children:m.AGENT_TYPES[t.agentType]?.name||t.agentType}),t.nodeId&&(0,s.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium bg-blue-500/10 text-blue-400 flex items-center gap-0.5",children:[(0,s.jsx)(p.Globe,{className:"w-2.5 h-2.5"}),"remote"]}),C&&"shell"!==t.agentType&&(0,s.jsx)("button",{onClick:()=>g(t.id,{isCollaborating:!t.isCollaborating}),className:`transition-colors ${t.isCollaborating?"text-indigo-400 hover:text-indigo-300":"text-zinc-600 hover:text-zinc-400"}`,title:t.isCollaborating?"Collaborating — click to opt out":"Not collaborating — click to opt in",children:(0,s.jsx)(y.Users,{className:"w-3 h-3"})}),!O&&!D&&(0,s.jsx)("span",{className:"text-[10px] text-yellow-500",children:"connecting..."}),D&&(0,s.jsx)("button",{onClick:()=>{W.current=!0,H.current&&clearTimeout(H.current),T.current?.close(),j.current?.dispose(),$(!1),B.current=!1,setTimeout(V,100)},className:"text-zinc-400 hover:text-white",title:"Restart",children:(0,s.jsx)(c,{className:"w-3 h-3"})}),!k&&w&&(0,s.jsx)("button",{onClick:()=>{w&&(W.current=!0,H.current&&clearTimeout(H.current),T.current?.close(),j.current?.dispose(),w(t.id))},className:"text-zinc-400 hover:text-white",title:"Pop out to new window",children:(0,s.jsx)(d,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>x(t.id),className:"text-zinc-400 hover:text-white",title:v?"Restore":"Maximize",children:v?(0,s.jsx)(h,{className:"w-3 h-3"}):(0,s.jsx)(l,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>{confirm("Close this terminal?")&&u(t.id)},className:"text-zinc-400 hover:text-red-400",title:"Close",children:(0,s.jsx)(n.X,{className:"w-3 h-3"})})]}),(0,s.jsx)("div",{ref:R,className:"flex-1 bg-[#0a0a0a]",style:{minHeight:v?"calc(100vh - 100px)":"300px"}})]})}e.s(["TerminalPane",()=>g],24134)},63209,e=>{"use strict";let t=(0,e.i(75254).default)("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.s(["AlertCircle",()=>t],63209)},16049,e=>{e.v(t=>Promise.all(["static/chunks/e40d2bd3b4ce8192.js"].map(t=>e.l(t))).then(()=>t(44908)))},59439,e=>{e.v(t=>Promise.all(["static/chunks/af8bfb72187b7cbf.js"].map(t=>e.l(t))).then(()=>t(93309)))},16091,e=>{e.v(t=>Promise.all(["static/chunks/9768207ca0a51abd.js"].map(t=>e.l(t))).then(()=>t(52216)))}]);
5
+ `):"session-detected"===t.type&&_.current(L.current.id,{claudeSessionId:t.sessionId})}catch{}},a.onclose=()=>{if(N(!1),!W.current&&!B.current){let e=G.current;if(e<20){let t=Math.min(1e3*Math.pow(1.5,e),3e4);G.current=e+1,H.current=setTimeout(u,t)}}},a.onerror=()=>{N(!1)}};i.onData(e=>{T.current?.readyState===WebSocket.OPEN&&T.current.send(JSON.stringify({type:"data",data:e}))}),i.onResize(({cols:e,rows:t})=>{T.current?.readyState===WebSocket.OPEN&&T.current.send(JSON.stringify({type:"resize",cols:e,rows:t}))}),u()},[]);(0,r.useEffect)(()=>(V(),()=>{B.current=!0,H.current&&clearTimeout(H.current),T.current?.close(),j.current?.dispose()}),[V]),(0,r.useEffect)(()=>{let e,t=new ResizeObserver(()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{if(Q.current)try{Q.current.fit()}catch{}})});return R.current&&t.observe(R.current),()=>{cancelAnimationFrame(e),t.disconnect()}},[]),(0,r.useEffect)(()=>{setTimeout(()=>{if(Q.current)try{Q.current.fit()}catch{}},50)},[v]);let Y=()=>{g(t.id,{title:q}),E(!1)};return(0,r.useEffect)(()=>{if(!F)return;let e=e=>{let t=e.target;A.current&&!A.current.contains(t)&&U.current&&!U.current.contains(t)&&P(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[F]),(0,s.jsxs)("div",{className:(0,f.cn)("flex flex-col border rounded-lg overflow-hidden",v?"fixed inset-2 z-50":"","border-zinc-700"),style:{borderColor:`${t.color}60`},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs select-none flex-shrink-0",style:{backgroundColor:`${t.color}60`},children:[(0,s.jsxs)("div",{ref:A,className:"flex-shrink-0",children:[(0,s.jsx)("button",{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();z({x:t.left,y:t.bottom+6}),P(!F)},className:"w-3 h-3 rounded-full hover:ring-2 hover:ring-zinc-500 ring-offset-1 ring-offset-zinc-900 transition-shadow cursor-pointer",style:{backgroundColor:t.color},title:"Change color"}),F&&(0,i.createPortal)((0,s.jsx)("div",{ref:U,className:"fixed z-[9999] bg-zinc-800 border border-zinc-600 rounded-xl p-3 shadow-2xl",style:{left:K.x,top:K.y},children:(0,s.jsx)("div",{className:"grid grid-cols-4 gap-2.5",style:{width:132},children:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#78716c"].map(e=>(0,s.jsx)("button",{onClick:()=>{g(t.id,{color:e}),P(!1)},className:`w-7 h-7 rounded-full border-2 transition-all hover:scale-110 ${t.color===e?"border-white scale-110 shadow-lg":"border-transparent hover:border-zinc-500"}`,style:{backgroundColor:e}},e))})}),document.body)]}),M?(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-1",children:[(0,s.jsx)("input",{autoFocus:!0,value:q,onChange:e=>I(e.target.value),onKeyDown:e=>{"Enter"===e.key&&Y(),"Escape"===e.key&&(I(t.title),E(!1))},className:"flex-1 bg-transparent border border-zinc-600 rounded px-1.5 py-0.5 text-xs focus:outline-none focus:border-indigo-400"}),(0,s.jsx)("button",{onClick:Y,className:"text-green-400 hover:text-green-300",children:(0,s.jsx)(o.Check,{className:"w-3 h-3"})})]}):(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-1 min-w-0 group/title",children:[(0,s.jsx)("span",{onDoubleClick:()=>E(!0),className:"truncate text-zinc-300 font-medium cursor-default",children:t.title}),(0,s.jsx)("button",{onClick:()=>E(!0),className:"text-zinc-600 hover:text-zinc-300 opacity-0 group-hover/title:opacity-100 transition-opacity flex-shrink-0",title:"Rename",children:(0,s.jsx)(a.Pencil,{className:"w-2.5 h-2.5"})})]}),(0,s.jsx)("span",{className:"text-[10px] text-zinc-500 truncate max-w-[120px]",title:t.cwd,children:t.cwd.split(/[/\\]/).pop()}),t.agentType&&"shell"!==t.agentType&&(0,s.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:`${m.AGENT_TYPES[t.agentType]?.color||"#6366f1"}20`,color:m.AGENT_TYPES[t.agentType]?.color||"#6366f1"},children:m.AGENT_TYPES[t.agentType]?.name||t.agentType}),t.nodeId&&(0,s.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium bg-blue-500/10 text-blue-400 flex items-center gap-0.5",children:[(0,s.jsx)(p.Globe,{className:"w-2.5 h-2.5"}),"remote"]}),C&&"shell"!==t.agentType&&(0,s.jsx)("button",{onClick:()=>{let e=!t.isCollaborating;g(t.id,{isCollaborating:e}),T.current?.readyState===WebSocket.OPEN&&T.current.send(JSON.stringify({type:"collab-toggle",isCollaborating:e}))},className:`transition-colors ${t.isCollaborating?"text-indigo-400 hover:text-indigo-300":"text-zinc-600 hover:text-zinc-400"}`,title:t.isCollaborating?"Collaborating — click to opt out":"Not collaborating — click to opt in",children:(0,s.jsx)(y.Users,{className:"w-3 h-3"})}),!O&&!D&&(0,s.jsx)("span",{className:"text-[10px] text-yellow-500",children:"connecting..."}),D&&(0,s.jsx)("button",{onClick:()=>{B.current=!0,H.current&&clearTimeout(H.current),T.current?.close(),j.current?.dispose(),$(!1),W.current=!1,setTimeout(V,100)},className:"text-zinc-400 hover:text-white",title:"Restart",children:(0,s.jsx)(c,{className:"w-3 h-3"})}),!k&&w&&(0,s.jsx)("button",{onClick:()=>{w&&(B.current=!0,H.current&&clearTimeout(H.current),T.current?.close(),j.current?.dispose(),w(t.id))},className:"text-zinc-400 hover:text-white",title:"Pop out to new window",children:(0,s.jsx)(d,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>x(t.id),className:"text-zinc-400 hover:text-white",title:v?"Restore":"Maximize",children:v?(0,s.jsx)(h,{className:"w-3 h-3"}):(0,s.jsx)(l,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>{confirm("Close this terminal?")&&u(t.id)},className:"text-zinc-400 hover:text-red-400",title:"Close",children:(0,s.jsx)(n.X,{className:"w-3 h-3"})})]}),(0,s.jsx)("div",{ref:R,className:"flex-1 bg-[#0a0a0a]",style:{minHeight:v?"calc(100vh - 100px)":"300px"}})]})}e.s(["TerminalPane",()=>g],24134)},63209,e=>{"use strict";let t=(0,e.i(75254).default)("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.s(["AlertCircle",()=>t],63209)},16049,e=>{e.v(t=>Promise.all(["static/chunks/e40d2bd3b4ce8192.js"].map(t=>e.l(t))).then(()=>t(44908)))},59439,e=>{e.v(t=>Promise.all(["static/chunks/af8bfb72187b7cbf.js"].map(t=>e.l(t))).then(()=>t(93309)))},16091,e=>{e.v(t=>Promise.all(["static/chunks/9768207ca0a51abd.js"].map(t=>e.l(t))).then(()=>t(52216)))}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31278,e=>{"use strict";let t=(0,e.i(75254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],31278)},66027,54616,e=>{"use strict";let t;var s=e.i(75555),i=e.i(40143),r=e.i(86491),a=e.i(15823),n=e.i(93803),o=e.i(19273),c=e.i(80166),u=class extends a.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#s=(0,n.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#i=void 0;#r=void 0;#a=void 0;#n;#o;#s;#t;#c;#u;#l;#h;#d;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#i.addObserver(this),l(this.#i,this.options)?this.#y():this.updateResult(),this.#f())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return h(this.#i,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return h(this.#i,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#b(),this.#i.removeObserver(this)}setOptions(e){let t=this.options,s=this.#i;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,o.resolveEnabled)(this.options.enabled,this.#i))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#g(),this.#i.setOptions(this.options),t._defaulted&&!(0,o.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#i,observer:this});let i=this.hasListeners();i&&d(this.#i,s,this.options,t)&&this.#y(),this.updateResult(),i&&(this.#i!==s||(0,o.resolveEnabled)(this.options.enabled,this.#i)!==(0,o.resolveEnabled)(t.enabled,this.#i)||(0,o.resolveStaleTime)(this.options.staleTime,this.#i)!==(0,o.resolveStaleTime)(t.staleTime,this.#i))&&this.#v();let r=this.#j();i&&(this.#i!==s||(0,o.resolveEnabled)(this.options.enabled,this.#i)!==(0,o.resolveEnabled)(t.enabled,this.#i)||r!==this.#p)&&this.#S(r)}getOptimisticResult(e){var t,s;let i=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(i,e);return t=this,s=r,(0,o.shallowEqualObjects)(t.getCurrentResult(),s)||(this.#a=r,this.#o=this.options,this.#n=this.#i.state),r}getCurrentResult(){return this.#a}trackResult(e,t){return new Proxy(e,{get:(e,s)=>(this.trackProp(s),t?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#s.status||this.#s.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,s))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#i}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),s=this.#e.getQueryCache().build(this.#e,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#y({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#y(e){this.#g();let t=this.#i.fetch(this.options,e);return e?.throwOnError||(t=t.catch(o.noop)),t}#v(){this.#x();let e=(0,o.resolveStaleTime)(this.options.staleTime,this.#i);if(o.isServer||this.#a.isStale||!(0,o.isValidTimeout)(e))return;let t=(0,o.timeUntilStale)(this.#a.dataUpdatedAt,e);this.#h=c.timeoutManager.setTimeout(()=>{this.#a.isStale||this.updateResult()},t+1)}#j(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#i):this.options.refetchInterval)??!1}#S(e){this.#b(),this.#p=e,!o.isServer&&!1!==(0,o.resolveEnabled)(this.options.enabled,this.#i)&&(0,o.isValidTimeout)(this.#p)&&0!==this.#p&&(this.#d=c.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||s.focusManager.isFocused())&&this.#y()},this.#p))}#f(){this.#v(),this.#S(this.#j())}#x(){this.#h&&(c.timeoutManager.clearTimeout(this.#h),this.#h=void 0)}#b(){this.#d&&(c.timeoutManager.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let s,i=this.#i,a=this.options,c=this.#a,u=this.#n,h=this.#o,m=e!==i?e.state:this.#r,{state:y}=e,f={...y},x=!1;if(t._optimisticResults){let s=this.hasListeners(),n=!s&&l(e,t),o=s&&d(e,i,t,a);(n||o)&&(f={...f,...(0,r.fetchState)(y.data,e.options)}),"isRestoring"===t._optimisticResults&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:g,status:v}=f;s=f.data;let j=!1;if(void 0!==t.placeholderData&&void 0===s&&"pending"===v){let e;c?.isPlaceholderData&&t.placeholderData===h?.placeholderData?(e=c.data,j=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,void 0!==e&&(v="success",s=(0,o.replaceData)(c?.data,e,t),x=!0)}if(t.select&&void 0!==s&&!j)if(c&&s===u?.data&&t.select===this.#c)s=this.#u;else try{this.#c=t.select,s=t.select(s),s=(0,o.replaceData)(c?.data,s,t),this.#u=s,this.#t=null}catch(e){this.#t=e}this.#t&&(b=this.#t,s=this.#u,g=Date.now(),v="error");let S="fetching"===f.fetchStatus,w="pending"===v,R="error"===v,Q=w&&S,T=void 0!==s,N={status:v,fetchStatus:f.fetchStatus,isPending:w,isSuccess:"success"===v,isError:R,isInitialLoading:Q,isLoading:Q,data:s,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>m.dataUpdateCount||f.errorUpdateCount>m.errorUpdateCount,isFetching:S,isRefetching:S&&!w,isLoadingError:R&&!T,isPaused:"paused"===f.fetchStatus,isPlaceholderData:x,isRefetchError:R&&T,isStale:p(e,t),refetch:this.refetch,promise:this.#s,isEnabled:!1!==(0,o.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==N.data,s="error"===N.status&&!t,r=e=>{s?e.reject(N.error):t&&e.resolve(N.data)},a=()=>{r(this.#s=N.promise=(0,n.pendingThenable)())},o=this.#s;switch(o.status){case"pending":e.queryHash===i.queryHash&&r(o);break;case"fulfilled":(s||N.data!==o.value)&&a();break;case"rejected":s&&N.error===o.reason||a()}}return N}updateResult(){let e=this.#a,t=this.createResult(this.#i,this.options);if(this.#n=this.#i.state,this.#o=this.options,void 0!==this.#n.data&&(this.#l=this.#i),(0,o.shallowEqualObjects)(t,e))return;this.#a=t;let s=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,s="function"==typeof t?t():t;if("all"===s||!s&&!this.#m.size)return!0;let i=new Set(s??this.#m);return this.options.throwOnError&&i.add("error"),Object.keys(this.#a).some(t=>this.#a[t]!==e[t]&&i.has(t))};this.#w({listeners:s()})}#g(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#i)return;let t=this.#i;this.#i=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#f()}#w(e){i.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#a)}),this.#e.getQueryCache().notify({query:this.#i,type:"observerResultsUpdated"})})}};function l(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&h(e,t,t.refetchOnMount)}function h(e,t,s){if(!1!==(0,o.resolveEnabled)(t.enabled,e)&&"static"!==(0,o.resolveStaleTime)(t.staleTime,e)){let i="function"==typeof s?s(e):s;return"always"===i||!1!==i&&p(e,t)}return!1}function d(e,t,s,i){return(e!==t||!1===(0,o.resolveEnabled)(i.enabled,e))&&(!s.suspense||"error"!==e.state.status)&&p(e,s)}function p(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,o.resolveStaleTime)(t.staleTime,e))}e.i(47167);var m=e.i(71645),y=e.i(12598);e.i(18050);var f=m.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),x=m.createContext(!1);x.Provider;var b=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function g(e,t){return function(e,t,s){let r,a=m.useContext(x),n=m.useContext(f),c=(0,y.useQueryClient)(s),u=c.defaultQueryOptions(e);c.getDefaultOptions().queries?._experimental_beforeQuery?.(u);let l=c.getQueryCache().get(u.queryHash);if(u._optimisticResults=a?"isRestoring":"optimistic",u.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=u.staleTime;u.staleTime="function"==typeof t?(...s)=>e(t(...s)):e(t),"number"==typeof u.gcTime&&(u.gcTime=Math.max(u.gcTime,1e3))}r=l?.state.error&&"function"==typeof u.throwOnError?(0,o.shouldThrowError)(u.throwOnError,[l.state.error,l]):u.throwOnError,(u.suspense||u.experimental_prefetchInRender||r)&&!n.isReset()&&(u.retryOnMount=!1),m.useEffect(()=>{n.clearReset()},[n]);let h=!c.getQueryCache().get(u.queryHash),[d]=m.useState(()=>new t(c,u)),p=d.getOptimisticResult(u),g=!a&&!1!==e.subscribed;if(m.useSyncExternalStore(m.useCallback(e=>{let t=g?d.subscribe(i.notifyManager.batchCalls(e)):o.noop;return d.updateResult(),t},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),m.useEffect(()=>{d.setOptions(u)},[u,d]),u?.suspense&&p.isPending)throw b(u,d,n);if((({result:e,errorResetBoundary:t,throwOnError:s,query:i,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(r&&void 0===e.data||(0,o.shouldThrowError)(s,[e.error,i])))({result:p,errorResetBoundary:n,throwOnError:u.throwOnError,query:l,suspense:u.suspense}))throw p.error;if(c.getDefaultOptions().queries?._experimental_afterQuery?.(u,p),u.experimental_prefetchInRender&&!o.isServer&&p.isLoading&&p.isFetching&&!a){let e=h?b(u,d,n):l?.promise;e?.catch(o.noop).finally(()=>{d.updateResult()})}return u.notifyOnChangeProps?p:d.trackResult(p)}(e,u,t)}e.s(["useQuery",()=>g],66027);var v=e.i(14272),j=a,S=class extends j.Subscribable{#e;#a=void 0;#R;#Q;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#T()}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,o.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#R,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,o.hashKey)(t.mutationKey)!==(0,o.hashKey)(this.options.mutationKey)?this.reset():this.#R?.state.status==="pending"&&this.#R.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#R?.removeObserver(this)}onMutationUpdate(e){this.#T(),this.#w(e)}getCurrentResult(){return this.#a}reset(){this.#R?.removeObserver(this),this.#R=void 0,this.#T(),this.#w()}mutate(e,t){return this.#Q=t,this.#R?.removeObserver(this),this.#R=this.#e.getMutationCache().build(this.#e,this.options),this.#R.addObserver(this),this.#R.execute(e)}#T(){let e=this.#R?.state??(0,v.getDefaultState)();this.#a={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#w(e){i.notifyManager.batch(()=>{if(this.#Q&&this.hasListeners()){let t=this.#a.variables,s=this.#a.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#Q.onSuccess?.(e.data,t,s,i)}catch(e){Promise.reject(e)}try{this.#Q.onSettled?.(e.data,null,t,s,i)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#Q.onError?.(e.error,t,s,i)}catch(e){Promise.reject(e)}try{this.#Q.onSettled?.(void 0,e.error,t,s,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#a)})})}};function w(e,t){let s=(0,y.useQueryClient)(t),[r]=m.useState(()=>new S(s,e));m.useEffect(()=>{r.setOptions(e)},[r,e]);let a=m.useSyncExternalStore(m.useCallback(e=>r.subscribe(i.notifyManager.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=m.useCallback((e,t)=>{r.mutate(e,t).catch(o.noop)},[r]);if(a.error&&(0,o.shouldThrowError)(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:n,mutateAsync:a.mutate}}e.s(["useMutation",()=>w],54616)},3999,e=>{"use strict";var t=e.i(66027),s=e.i(54616),i=e.i(12598),r=e.i(9165);function a(e={}){return(0,t.useQuery)({queryKey:["sessions",e],queryFn:async()=>{let t=new URLSearchParams;return e.projectId&&t.set("projectId",e.projectId),void 0!==e.starred&&t.set("starred",String(e.starred)),e.search&&t.set("search",e.search),e.agentType&&t.set("agentType",e.agentType),e.sortBy&&t.set("sortBy",e.sortBy),e.sortDir&&t.set("sortDir",e.sortDir),void 0!==e.offset&&t.set("offset",String(e.offset)),void 0!==e.limit&&t.set("limit",String(e.limit)),"all"===e.nodeFilter&&t.set("nodes","all"),(await fetch((0,r.api)(`/api/sessions?${t}`))).json()}})}function n(e){return(0,t.useQuery)({queryKey:["session",e],queryFn:async()=>{let t=await fetch((0,r.api)(`/api/sessions/${e}`));if(!t.ok)throw Error("Session not found");return t.json()},enabled:!!e})}function o(e,s=0,i=50,a){return(0,t.useQuery)({queryKey:["messages",e,s,i,a],queryFn:async()=>{let t=a?(0,r.api)(`/api/network/proxy/${a}/sessions/${e}/messages?offset=${s}&limit=${i}`):(0,r.api)(`/api/sessions/${e}/messages?offset=${s}&limit=${i}`);return(await fetch(t)).json()},enabled:!!e})}function c(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"star"})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function u(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,notes:t})=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"notes",notes:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["session"]})}})}function l(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,tagName:t})=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"tag",tagName:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["tags"]})}})}function h(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,tagName:t})=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"removeTag",tagName:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["tags"]})}})}function d(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,name:t})=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",name:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function p(){return(0,t.useQuery)({queryKey:["tags"],queryFn:async()=>(await fetch((0,r.api)("/api/tags"))).json()})}function m(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,r.api)("/api/tags"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",tagId:e})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function y(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({tagId:e,color:t})=>(await fetch((0,r.api)("/api/tags"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"updateColor",tagId:e,color:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function f(){return(0,t.useQuery)({queryKey:["workspaces"],queryFn:async()=>(await fetch((0,r.api)("/api/workspaces"))).json()})}function x(){return(0,t.useQuery)({queryKey:["workspaces","remote"],queryFn:async()=>(await fetch((0,r.api)("/api/workspaces?nodes=all"))).json()})}function b(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({workspaceId:e,sessionId:t,nodeId:s,title:i,cwd:a,agentType:n})=>{let o=await fetch((0,r.api)(`/api/workspaces/${e}/sessions`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t,nodeId:s,title:i,cwd:a,agentType:n})});if(!o.ok)throw Error("Failed to add session to workspace");return o.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["workspace-sessions"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function g(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({workspaceId:e,sessionId:t})=>{let s=await fetch((0,r.api)(`/api/workspaces/${e}/sessions`),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t})});if(!s.ok)throw Error("Failed to remove session from workspace");return s.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["workspace-sessions"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function v(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,r.api)("/api/bulk"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["tags"]})}})}function j(){return(0,t.useQuery)({queryKey:["projects"],queryFn:async()=>(await fetch((0,r.api)("/api/projects"))).json()})}function S(){return(0,t.useQuery)({queryKey:["analytics"],queryFn:async()=>(await fetch((0,r.api)("/api/analytics/overview"))).json()})}function w(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async()=>(await fetch((0,r.api)("/api/sync"),{method:"POST"})).json(),onSuccess:()=>{e.invalidateQueries()}})}e.s(["useAddSessionToWorkspace",()=>b,"useAddTag",()=>l,"useAnalytics",()=>S,"useBulkAction",()=>v,"useDeleteTag",()=>m,"useMessages",()=>o,"useProjects",()=>j,"useRemoteWorkspaces",()=>x,"useRemoveSessionFromWorkspace",()=>g,"useRemoveTag",()=>h,"useRenameSession",()=>d,"useSession",()=>n,"useSessions",()=>a,"useSync",()=>w,"useTags",()=>p,"useToggleStar",()=>c,"useUpdateNotes",()=>u,"useUpdateTagColor",()=>y,"useWorkspaces",()=>f])},37727,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",()=>t],37727)},7233,e=>{"use strict";let t=(0,e.i(75254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>t],7233)},16715,e=>{"use strict";let t=(0,e.i(75254).default)("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"}]]);e.s(["RefreshCw",()=>t],16715)},98919,e=>{"use strict";let t=(0,e.i(75254).default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);e.s(["Shield",()=>t],98919)},95468,11588,e=>{"use strict";var t=e.i(75254);let s=(0,t.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["CheckCircle2",()=>s],95468);let i=(0,t.default)("folder-code",[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]]);e.s(["FolderCode",()=>i],11588)},38090,e=>{"use strict";var t=e.i(18050),s=e.i(71645),i=e.i(3999),r=e.i(39616),a=e.i(16715),n=e.i(75505),o=e.i(31278),c=e.i(98919),u=e.i(95468),l=e.i(17923),h=e.i(7233),d=e.i(37727),p=e.i(11588),m=e.i(9165),y=e.i(9593),f=e.i(29320);function x(){let{hasAuth:e}=(0,f.useTier)(),x="u">typeof document&&document.cookie.includes("spaces-session="),b=(0,i.useSync)(),[g,v]=(0,s.useState)(""),[j,S]=(0,s.useState)(!1),[w,R]=(0,s.useState)(!0),[Q,T]=(0,s.useState)(!1),[N,k]=(0,s.useState)(""),[C,O]=(0,s.useState)(""),[E,M]=(0,s.useState)(""),[q,z]=(0,s.useState)(""),[F,I]=(0,s.useState)(!1),K=(0,s.useRef)(null),[P,D]=(0,s.useState)(null),[U,A]=(0,s.useState)([]),[L,$]=(0,s.useState)(""),[_,W]=(0,s.useState)(!1),[J,B]=(0,s.useState)(!0);(0,s.useEffect)(()=>{e?x?fetch((0,m.api)("/api/auth/me")).then(e=>e.json()).then(e=>{D(e),R(!1)}).catch(()=>R(!1)):fetch((0,m.api)("/api/auth/totp/status")).then(e=>e.json()).then(e=>{S(e.enabled),R(!1)}).catch(()=>R(!1)):R(!1)},[e,x]),(0,s.useEffect)(()=>{fetch((0,m.api)("/api/config")).then(e=>e.json()).then(e=>{W(e.telemetryOptOut),A(e.devDirectories||[]),B(!1)}).catch(()=>B(!1))},[]);let H=async e=>{A(e),await fetch((0,m.api)("/api/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({devDirectories:e})})},V=()=>{let e=L.trim();!e||U.includes(e)||(e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e))&&(H([...U,e]),$(""))},X=async()=>{let e=await b.mutateAsync();v(`Synced ${e.projects} projects, ${e.sessions} sessions, enriched ${e.enriched}`),(0,y.track)("sync_completed",{projects:e.projects,sessions:e.sessions,enriched:e.enriched})},Y=async()=>{let e=!_;W(e),(0,y.setOptOut)(e),(0,y.track)("telemetry_toggled",{enabled:!e}),await fetch((0,m.api)("/api/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({telemetryOptOut:e})})},Z=async()=>{T(!0),z(""),M("");let e=await fetch((0,m.api)("/api/auth/totp/setup"),{method:"POST"}),t=await e.json();k(t.qrDataUrl),O(t.secret),setTimeout(()=>K.current?.focus(),100)},G=async e=>{if(6!==e.length)return;I(!0),z("");let t=await fetch((0,m.api)("/api/auth/totp/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,action:"enable"})}),s=await t.json();I(!1),s.success?(S(!0),T(!1),k(""),O(""),M("")):(z(s.error||"Invalid code"),M(""),K.current?.focus())},ee=async()=>{confirm("Disable 2FA? You will need to set it up again to use terminals.")&&(await fetch((0,m.api)("/api/auth/totp/setup"),{method:"POST"}),S(!1),T(!1))};return(0,t.jsxs)("div",{className:"p-6 max-w-3xl",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold",children:"Settings"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm mt-1",children:"Configure Spaces"})]}),(0,t.jsxs)("div",{className:"space-y-6",children:[e&&(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(c.Shield,{className:"w-4 h-4"}),"Terminal Security"]}),w?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[(0,t.jsx)(o.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):x?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(u.CheckCircle2,{className:"w-5 h-5 text-green-500"}),(0,t.jsx)("span",{className:"text-sm font-medium text-green-500",children:"2FA Enabled"})]}),(0,t.jsx)("p",{className:"text-xs text-zinc-500",children:"Two-factor authentication is required at login. TOTP is managed through the login flow. Contact an admin to reset your 2FA if needed."})]}):j&&!Q?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(u.CheckCircle2,{className:"w-5 h-5 text-green-500"}),(0,t.jsx)("span",{className:"text-sm font-medium text-green-500",children:"2FA Enabled"})]}),(0,t.jsx)("p",{className:"text-xs text-zinc-500",children:"Two-factor authentication is required each time you open a terminal session. Tokens are valid for 8 hours."}),(0,t.jsx)("button",{onClick:ee,className:"text-xs text-zinc-500 hover:text-red-400 transition-colors",children:"Disable 2FA"})]}):Q?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),N?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,t.jsx)("div",{className:"bg-white p-3 rounded-lg",children:(0,t.jsx)("img",{src:N,alt:"TOTP QR Code",width:200,height:200})}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("p",{className:"text-[10px] text-zinc-600 mb-1",children:"Manual entry key:"}),(0,t.jsx)("code",{className:"text-xs bg-zinc-800 px-2 py-1 rounded font-mono select-all",children:C})]})]}):(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)(o.Loader2,{className:"w-6 h-6 animate-spin text-zinc-400"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs text-zinc-400 block mb-1.5",children:"Enter the 6-digit code from your authenticator"}),(0,t.jsx)("input",{ref:K,type:"text",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"000000",value:E,onChange:e=>{let t;M(t=e.target.value.replace(/\D/g,"").slice(0,6)),z(""),6===t.length&&G(t)},disabled:F,className:"w-40 px-3 py-2 text-lg font-mono tracking-[0.3em] text-center bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white disabled:opacity-50"}),F&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-2 text-xs text-zinc-400",children:[(0,t.jsx)(o.Loader2,{className:"w-3 h-3 animate-spin"}),"Verifying..."]}),q&&(0,t.jsx)("p",{className:"text-xs text-red-400 mt-2",children:q})]}),(0,t.jsx)("button",{onClick:()=>{T(!1),k(""),O("")},className:"text-xs text-zinc-500 hover:text-white transition-colors",children:"Cancel"})]}):(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Two-factor authentication adds an extra layer of security to terminal access. You'll need an authenticator app to generate codes."}),(0,t.jsxs)("button",{onClick:Z,className:"flex items-center gap-2 px-4 py-2 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600",children:[(0,t.jsx)(c.Shield,{className:"w-4 h-4"}),"Set up 2FA"]})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(n.FolderOpen,{className:"w-4 h-4"}),"Data Source"]}),(0,t.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-muted-foreground text-xs",children:"Agent Data Directories"}),(0,t.jsxs)("div",{className:"font-mono text-xs mt-1 p-2 bg-zinc-50 dark:bg-zinc-800 rounded space-y-1",children:[(0,t.jsx)("p",{children:"~/.claude/"}),(0,t.jsx)("p",{children:"~/.codex/"}),(0,t.jsx)("p",{children:"~/.gemini/"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-muted-foreground text-xs",children:"Spaces Database"}),(0,t.jsx)("p",{className:"font-mono text-xs mt-1 p-2 bg-zinc-50 dark:bg-zinc-800 rounded",children:"~/.spaces/spaces.db"})]})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(p.FolderCode,{className:"w-4 h-4"}),"Development Directories"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Restrict terminal pane creation to these project roots. Paths must be absolute."}),U.length>0&&(0,t.jsx)("div",{className:"space-y-1.5 mb-3",children:U.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-zinc-50 dark:bg-zinc-800 rounded-md group",children:[(0,t.jsx)(n.FolderOpen,{className:"w-3.5 h-3.5 text-amber-500/70 flex-shrink-0"}),(0,t.jsx)("span",{className:"font-mono text-xs flex-1 truncate",children:e}),(0,t.jsx)("button",{onClick:()=>{H(U.filter(t=>t!==e))},className:"text-zinc-400 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",title:"Remove",children:(0,t.jsx)(d.X,{className:"w-3.5 h-3.5"})})]},e))}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"text",placeholder:"u">typeof navigator&&navigator.platform?.startsWith("Win")?"C:\\Users\\you\\projects":"/home/user/projects",value:L,onChange:e=>$(e.target.value),onKeyDown:e=>"Enter"===e.key&&V(),className:"flex-1 px-3 py-1.5 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 font-mono"}),(0,t.jsxs)("button",{onClick:V,disabled:!L.trim()||!(L.trim().startsWith("/")||/^[A-Za-z]:[\\/]/.test(L.trim())),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600 disabled:opacity-50",children:[(0,t.jsx)(h.Plus,{className:"w-3.5 h-3.5"}),"Add"]})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(a.RefreshCw,{className:"w-4 h-4"}),"Data Sync"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Force a full re-scan of all agent sessions. This rebuilds the index from scratch."}),(0,t.jsxs)("button",{onClick:X,disabled:b.isPending,className:"flex items-center gap-2 px-4 py-2 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600 disabled:opacity-50",children:[b.isPending?(0,t.jsx)(o.Loader2,{className:"w-4 h-4 animate-spin"}):(0,t.jsx)(a.RefreshCw,{className:"w-4 h-4"}),"Re-sync Now"]}),g&&(0,t.jsx)("p",{className:"text-xs text-green-600 mt-2",children:g})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(l.BarChart3,{className:"w-4 h-4"}),"Telemetry"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Anonymous usage data helps us understand how Spaces is used and improve the product. No file paths, session content, or personal information is ever collected."}),J?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[(0,t.jsx)(o.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):(0,t.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:!_,onChange:Y,className:"w-4 h-4 rounded border-zinc-300 dark:border-zinc-700 text-indigo-500 focus:ring-indigo-500"}),(0,t.jsx)("span",{className:"text-sm",children:"Send anonymous usage data"})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(r.Settings,{className:"w-4 h-4"}),"About"]}),(0,t.jsxs)("div",{className:"text-sm space-y-1",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Version:"})," 0.1.0"]}),(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Data access:"})," Read-only (never modifies agent data directories)"]}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs mt-2",children:"Spaces is an open-source agent workspace manager. All session data stays local on your machine."})]})]})]})]})}e.s(["default",()=>x])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,31278,e=>{"use strict";let t=(0,e.i(75254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],31278)},66027,54616,e=>{"use strict";let t;var s=e.i(75555),i=e.i(40143),r=e.i(86491),a=e.i(15823),n=e.i(93803),o=e.i(19273),c=e.i(80166),u=class extends a.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#s=(0,n.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#i=void 0;#r=void 0;#a=void 0;#n;#o;#s;#t;#c;#u;#l;#h;#d;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#i.addObserver(this),l(this.#i,this.options)?this.#y():this.updateResult(),this.#f())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return h(this.#i,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return h(this.#i,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#b(),this.#i.removeObserver(this)}setOptions(e){let t=this.options,s=this.#i;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,o.resolveEnabled)(this.options.enabled,this.#i))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#g(),this.#i.setOptions(this.options),t._defaulted&&!(0,o.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#i,observer:this});let i=this.hasListeners();i&&d(this.#i,s,this.options,t)&&this.#y(),this.updateResult(),i&&(this.#i!==s||(0,o.resolveEnabled)(this.options.enabled,this.#i)!==(0,o.resolveEnabled)(t.enabled,this.#i)||(0,o.resolveStaleTime)(this.options.staleTime,this.#i)!==(0,o.resolveStaleTime)(t.staleTime,this.#i))&&this.#v();let r=this.#j();i&&(this.#i!==s||(0,o.resolveEnabled)(this.options.enabled,this.#i)!==(0,o.resolveEnabled)(t.enabled,this.#i)||r!==this.#p)&&this.#S(r)}getOptimisticResult(e){var t,s;let i=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(i,e);return t=this,s=r,(0,o.shallowEqualObjects)(t.getCurrentResult(),s)||(this.#a=r,this.#o=this.options,this.#n=this.#i.state),r}getCurrentResult(){return this.#a}trackResult(e,t){return new Proxy(e,{get:(e,s)=>(this.trackProp(s),t?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#s.status||this.#s.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,s))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#i}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),s=this.#e.getQueryCache().build(this.#e,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#y({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#a))}#y(e){this.#g();let t=this.#i.fetch(this.options,e);return e?.throwOnError||(t=t.catch(o.noop)),t}#v(){this.#x();let e=(0,o.resolveStaleTime)(this.options.staleTime,this.#i);if(o.isServer||this.#a.isStale||!(0,o.isValidTimeout)(e))return;let t=(0,o.timeUntilStale)(this.#a.dataUpdatedAt,e);this.#h=c.timeoutManager.setTimeout(()=>{this.#a.isStale||this.updateResult()},t+1)}#j(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#i):this.options.refetchInterval)??!1}#S(e){this.#b(),this.#p=e,!o.isServer&&!1!==(0,o.resolveEnabled)(this.options.enabled,this.#i)&&(0,o.isValidTimeout)(this.#p)&&0!==this.#p&&(this.#d=c.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||s.focusManager.isFocused())&&this.#y()},this.#p))}#f(){this.#v(),this.#S(this.#j())}#x(){this.#h&&(c.timeoutManager.clearTimeout(this.#h),this.#h=void 0)}#b(){this.#d&&(c.timeoutManager.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let s,i=this.#i,a=this.options,c=this.#a,u=this.#n,h=this.#o,m=e!==i?e.state:this.#r,{state:y}=e,f={...y},x=!1;if(t._optimisticResults){let s=this.hasListeners(),n=!s&&l(e,t),o=s&&d(e,i,t,a);(n||o)&&(f={...f,...(0,r.fetchState)(y.data,e.options)}),"isRestoring"===t._optimisticResults&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:g,status:v}=f;s=f.data;let j=!1;if(void 0!==t.placeholderData&&void 0===s&&"pending"===v){let e;c?.isPlaceholderData&&t.placeholderData===h?.placeholderData?(e=c.data,j=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,void 0!==e&&(v="success",s=(0,o.replaceData)(c?.data,e,t),x=!0)}if(t.select&&void 0!==s&&!j)if(c&&s===u?.data&&t.select===this.#c)s=this.#u;else try{this.#c=t.select,s=t.select(s),s=(0,o.replaceData)(c?.data,s,t),this.#u=s,this.#t=null}catch(e){this.#t=e}this.#t&&(b=this.#t,s=this.#u,g=Date.now(),v="error");let S="fetching"===f.fetchStatus,w="pending"===v,R="error"===v,Q=w&&S,N=void 0!==s,T={status:v,fetchStatus:f.fetchStatus,isPending:w,isSuccess:"success"===v,isError:R,isInitialLoading:Q,isLoading:Q,data:s,dataUpdatedAt:f.dataUpdatedAt,error:b,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>m.dataUpdateCount||f.errorUpdateCount>m.errorUpdateCount,isFetching:S,isRefetching:S&&!w,isLoadingError:R&&!N,isPaused:"paused"===f.fetchStatus,isPlaceholderData:x,isRefetchError:R&&N,isStale:p(e,t),refetch:this.refetch,promise:this.#s,isEnabled:!1!==(0,o.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==T.data,s="error"===T.status&&!t,r=e=>{s?e.reject(T.error):t&&e.resolve(T.data)},a=()=>{r(this.#s=T.promise=(0,n.pendingThenable)())},o=this.#s;switch(o.status){case"pending":e.queryHash===i.queryHash&&r(o);break;case"fulfilled":(s||T.data!==o.value)&&a();break;case"rejected":s&&T.error===o.reason||a()}}return T}updateResult(){let e=this.#a,t=this.createResult(this.#i,this.options);if(this.#n=this.#i.state,this.#o=this.options,void 0!==this.#n.data&&(this.#l=this.#i),(0,o.shallowEqualObjects)(t,e))return;this.#a=t;let s=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,s="function"==typeof t?t():t;if("all"===s||!s&&!this.#m.size)return!0;let i=new Set(s??this.#m);return this.options.throwOnError&&i.add("error"),Object.keys(this.#a).some(t=>this.#a[t]!==e[t]&&i.has(t))};this.#w({listeners:s()})}#g(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#i)return;let t=this.#i;this.#i=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#f()}#w(e){i.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#a)}),this.#e.getQueryCache().notify({query:this.#i,type:"observerResultsUpdated"})})}};function l(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&h(e,t,t.refetchOnMount)}function h(e,t,s){if(!1!==(0,o.resolveEnabled)(t.enabled,e)&&"static"!==(0,o.resolveStaleTime)(t.staleTime,e)){let i="function"==typeof s?s(e):s;return"always"===i||!1!==i&&p(e,t)}return!1}function d(e,t,s,i){return(e!==t||!1===(0,o.resolveEnabled)(i.enabled,e))&&(!s.suspense||"error"!==e.state.status)&&p(e,s)}function p(e,t){return!1!==(0,o.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,o.resolveStaleTime)(t.staleTime,e))}e.i(47167);var m=e.i(71645),y=e.i(12598);e.i(18050);var f=m.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),x=m.createContext(!1);x.Provider;var b=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function g(e,t){return function(e,t,s){let r,a=m.useContext(x),n=m.useContext(f),c=(0,y.useQueryClient)(s),u=c.defaultQueryOptions(e);c.getDefaultOptions().queries?._experimental_beforeQuery?.(u);let l=c.getQueryCache().get(u.queryHash);if(u._optimisticResults=a?"isRestoring":"optimistic",u.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=u.staleTime;u.staleTime="function"==typeof t?(...s)=>e(t(...s)):e(t),"number"==typeof u.gcTime&&(u.gcTime=Math.max(u.gcTime,1e3))}r=l?.state.error&&"function"==typeof u.throwOnError?(0,o.shouldThrowError)(u.throwOnError,[l.state.error,l]):u.throwOnError,(u.suspense||u.experimental_prefetchInRender||r)&&!n.isReset()&&(u.retryOnMount=!1),m.useEffect(()=>{n.clearReset()},[n]);let h=!c.getQueryCache().get(u.queryHash),[d]=m.useState(()=>new t(c,u)),p=d.getOptimisticResult(u),g=!a&&!1!==e.subscribed;if(m.useSyncExternalStore(m.useCallback(e=>{let t=g?d.subscribe(i.notifyManager.batchCalls(e)):o.noop;return d.updateResult(),t},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),m.useEffect(()=>{d.setOptions(u)},[u,d]),u?.suspense&&p.isPending)throw b(u,d,n);if((({result:e,errorResetBoundary:t,throwOnError:s,query:i,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(r&&void 0===e.data||(0,o.shouldThrowError)(s,[e.error,i])))({result:p,errorResetBoundary:n,throwOnError:u.throwOnError,query:l,suspense:u.suspense}))throw p.error;if(c.getDefaultOptions().queries?._experimental_afterQuery?.(u,p),u.experimental_prefetchInRender&&!o.isServer&&p.isLoading&&p.isFetching&&!a){let e=h?b(u,d,n):l?.promise;e?.catch(o.noop).finally(()=>{d.updateResult()})}return u.notifyOnChangeProps?p:d.trackResult(p)}(e,u,t)}e.s(["useQuery",()=>g],66027);var v=e.i(14272),j=a,S=class extends j.Subscribable{#e;#a=void 0;#R;#Q;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#N()}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,o.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#R,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,o.hashKey)(t.mutationKey)!==(0,o.hashKey)(this.options.mutationKey)?this.reset():this.#R?.state.status==="pending"&&this.#R.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#R?.removeObserver(this)}onMutationUpdate(e){this.#N(),this.#w(e)}getCurrentResult(){return this.#a}reset(){this.#R?.removeObserver(this),this.#R=void 0,this.#N(),this.#w()}mutate(e,t){return this.#Q=t,this.#R?.removeObserver(this),this.#R=this.#e.getMutationCache().build(this.#e,this.options),this.#R.addObserver(this),this.#R.execute(e)}#N(){let e=this.#R?.state??(0,v.getDefaultState)();this.#a={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#w(e){i.notifyManager.batch(()=>{if(this.#Q&&this.hasListeners()){let t=this.#a.variables,s=this.#a.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#Q.onSuccess?.(e.data,t,s,i)}catch(e){Promise.reject(e)}try{this.#Q.onSettled?.(e.data,null,t,s,i)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#Q.onError?.(e.error,t,s,i)}catch(e){Promise.reject(e)}try{this.#Q.onSettled?.(void 0,e.error,t,s,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#a)})})}};function w(e,t){let s=(0,y.useQueryClient)(t),[r]=m.useState(()=>new S(s,e));m.useEffect(()=>{r.setOptions(e)},[r,e]);let a=m.useSyncExternalStore(m.useCallback(e=>r.subscribe(i.notifyManager.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=m.useCallback((e,t)=>{r.mutate(e,t).catch(o.noop)},[r]);if(a.error&&(0,o.shouldThrowError)(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:n,mutateAsync:a.mutate}}e.s(["useMutation",()=>w],54616)},3999,e=>{"use strict";var t=e.i(66027),s=e.i(54616),i=e.i(12598),r=e.i(9165);function a(e={}){return(0,t.useQuery)({queryKey:["sessions",e],queryFn:async()=>{let t=new URLSearchParams;return e.projectId&&t.set("projectId",e.projectId),void 0!==e.starred&&t.set("starred",String(e.starred)),e.search&&t.set("search",e.search),e.agentType&&t.set("agentType",e.agentType),e.sortBy&&t.set("sortBy",e.sortBy),e.sortDir&&t.set("sortDir",e.sortDir),void 0!==e.offset&&t.set("offset",String(e.offset)),void 0!==e.limit&&t.set("limit",String(e.limit)),"all"===e.nodeFilter&&t.set("nodes","all"),(await fetch((0,r.api)(`/api/sessions?${t}`))).json()}})}function n(e){return(0,t.useQuery)({queryKey:["session",e],queryFn:async()=>{let t=await fetch((0,r.api)(`/api/sessions/${e}`));if(!t.ok)throw Error("Session not found");return t.json()},enabled:!!e})}function o(e,s=0,i=50,a){return(0,t.useQuery)({queryKey:["messages",e,s,i,a],queryFn:async()=>{let t=a?(0,r.api)(`/api/network/proxy/${a}/sessions/${e}/messages?offset=${s}&limit=${i}`):(0,r.api)(`/api/sessions/${e}/messages?offset=${s}&limit=${i}`);return(await fetch(t)).json()},enabled:!!e})}function c(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"star"})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function u(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,notes:t})=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"notes",notes:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["session"]})}})}function l(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,tagName:t})=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"tag",tagName:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["tags"]})}})}function h(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,tagName:t})=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"removeTag",tagName:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["tags"]})}})}function d(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({sessionId:e,name:t})=>(await fetch((0,r.api)(`/api/sessions/${e}`),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"rename",name:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function p(){return(0,t.useQuery)({queryKey:["tags"],queryFn:async()=>(await fetch((0,r.api)("/api/tags"))).json()})}function m(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,r.api)("/api/tags"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",tagId:e})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function y(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({tagId:e,color:t})=>(await fetch((0,r.api)("/api/tags"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"updateColor",tagId:e,color:t})})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["tags"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function f(){return(0,t.useQuery)({queryKey:["workspaces"],queryFn:async()=>(await fetch((0,r.api)("/api/workspaces"))).json()})}function x(){return(0,t.useQuery)({queryKey:["workspaces","remote"],queryFn:async()=>(await fetch((0,r.api)("/api/workspaces?nodes=all"))).json()})}function b(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({workspaceId:e,sessionId:t,nodeId:s,title:i,cwd:a,agentType:n})=>{let o=await fetch((0,r.api)(`/api/workspaces/${e}/sessions`),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t,nodeId:s,title:i,cwd:a,agentType:n})});if(!o.ok)throw Error("Failed to add session to workspace");return o.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["workspace-sessions"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function g(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async({workspaceId:e,sessionId:t})=>{let s=await fetch((0,r.api)(`/api/workspaces/${e}/sessions`),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:t})});if(!s.ok)throw Error("Failed to remove session from workspace");return s.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["workspace-sessions"]}),e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["session"]})}})}function v(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async e=>(await fetch((0,r.api)("/api/bulk"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).json(),onSuccess:()=>{e.invalidateQueries({queryKey:["sessions"]}),e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["tags"]})}})}function j(){return(0,t.useQuery)({queryKey:["projects"],queryFn:async()=>(await fetch((0,r.api)("/api/projects"))).json()})}function S(){return(0,t.useQuery)({queryKey:["analytics"],queryFn:async()=>(await fetch((0,r.api)("/api/analytics/overview"))).json()})}function w(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:async()=>(await fetch((0,r.api)("/api/sync"),{method:"POST"})).json(),onSuccess:()=>{e.invalidateQueries()}})}e.s(["useAddSessionToWorkspace",()=>b,"useAddTag",()=>l,"useAnalytics",()=>S,"useBulkAction",()=>v,"useDeleteTag",()=>m,"useMessages",()=>o,"useProjects",()=>j,"useRemoteWorkspaces",()=>x,"useRemoveSessionFromWorkspace",()=>g,"useRemoveTag",()=>h,"useRenameSession",()=>d,"useSession",()=>n,"useSessions",()=>a,"useSync",()=>w,"useTags",()=>p,"useToggleStar",()=>c,"useUpdateNotes",()=>u,"useUpdateTagColor",()=>y,"useWorkspaces",()=>f])},37727,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",()=>t],37727)},7233,e=>{"use strict";let t=(0,e.i(75254).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",()=>t],7233)},16715,e=>{"use strict";let t=(0,e.i(75254).default)("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"}]]);e.s(["RefreshCw",()=>t],16715)},98919,e=>{"use strict";let t=(0,e.i(75254).default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);e.s(["Shield",()=>t],98919)},95468,11588,e=>{"use strict";var t=e.i(75254);let s=(0,t.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["CheckCircle2",()=>s],95468);let i=(0,t.default)("folder-code",[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]]);e.s(["FolderCode",()=>i],11588)},38090,e=>{"use strict";var t=e.i(18050),s=e.i(71645),i=e.i(3999),r=e.i(39616),a=e.i(16715),n=e.i(75505),o=e.i(31278),c=e.i(98919),u=e.i(95468),l=e.i(17923),h=e.i(7233),d=e.i(37727),p=e.i(11588),m=e.i(9165),y=e.i(9593),f=e.i(29320);function x(){let{hasAuth:e,tier:x,version:b}=(0,f.useTier)(),g="u">typeof document&&document.cookie.includes("spaces-session="),v=(0,i.useSync)(),[j,S]=(0,s.useState)(""),[w,R]=(0,s.useState)(!1),[Q,N]=(0,s.useState)(!0),[T,k]=(0,s.useState)(!1),[C,O]=(0,s.useState)(""),[E,M]=(0,s.useState)(""),[q,z]=(0,s.useState)(""),[F,I]=(0,s.useState)(""),[K,P]=(0,s.useState)(!1),D=(0,s.useRef)(null),[U,A]=(0,s.useState)(null),[L,$]=(0,s.useState)([]),[_,W]=(0,s.useState)(""),[J,B]=(0,s.useState)(!1),[H,V]=(0,s.useState)(!0);(0,s.useEffect)(()=>{e?g?fetch((0,m.api)("/api/auth/me")).then(e=>e.json()).then(e=>{A(e),N(!1)}).catch(()=>N(!1)):fetch((0,m.api)("/api/auth/totp/status")).then(e=>e.json()).then(e=>{R(e.enabled),N(!1)}).catch(()=>N(!1)):N(!1)},[e,g]),(0,s.useEffect)(()=>{fetch((0,m.api)("/api/config")).then(e=>e.json()).then(e=>{B(e.telemetryOptOut),$(e.devDirectories||[]),V(!1)}).catch(()=>V(!1))},[]);let X=async e=>{$(e),await fetch((0,m.api)("/api/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({devDirectories:e})})},Y=()=>{let e=_.trim();!e||L.includes(e)||(e.startsWith("/")||/^[A-Za-z]:[\\/]/.test(e))&&(X([...L,e]),W(""))},Z=async()=>{let e=await v.mutateAsync();S(`Synced ${e.projects} projects, ${e.sessions} sessions, enriched ${e.enriched}`),(0,y.track)("sync_completed",{projects:e.projects,sessions:e.sessions,enriched:e.enriched})},G=async()=>{let e=!J;B(e),(0,y.setOptOut)(e),(0,y.track)("telemetry_toggled",{enabled:!e}),await fetch((0,m.api)("/api/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({telemetryOptOut:e})})},ee=async()=>{k(!0),I(""),z("");let e=await fetch((0,m.api)("/api/auth/totp/setup"),{method:"POST"}),t=await e.json();O(t.qrDataUrl),M(t.secret),setTimeout(()=>D.current?.focus(),100)},et=async e=>{if(6!==e.length)return;P(!0),I("");let t=await fetch((0,m.api)("/api/auth/totp/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,action:"enable"})}),s=await t.json();P(!1),s.success?(R(!0),k(!1),O(""),M(""),z("")):(I(s.error||"Invalid code"),z(""),D.current?.focus())},es=async()=>{confirm("Disable 2FA? You will need to set it up again to use terminals.")&&(await fetch((0,m.api)("/api/auth/totp/setup"),{method:"POST"}),R(!1),k(!1))};return(0,t.jsxs)("div",{className:"p-6 max-w-3xl",children:[(0,t.jsxs)("div",{className:"mb-6",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold",children:"Settings"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm mt-1",children:"Configure Spaces"})]}),(0,t.jsxs)("div",{className:"space-y-6",children:[e&&(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(c.Shield,{className:"w-4 h-4"}),"Terminal Security"]}),Q?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[(0,t.jsx)(o.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):g?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(u.CheckCircle2,{className:"w-5 h-5 text-green-500"}),(0,t.jsx)("span",{className:"text-sm font-medium text-green-500",children:"2FA Enabled"})]}),(0,t.jsx)("p",{className:"text-xs text-zinc-500",children:"Two-factor authentication is required at login. TOTP is managed through the login flow. Contact an admin to reset your 2FA if needed."})]}):w&&!T?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(u.CheckCircle2,{className:"w-5 h-5 text-green-500"}),(0,t.jsx)("span",{className:"text-sm font-medium text-green-500",children:"2FA Enabled"})]}),(0,t.jsx)("p",{className:"text-xs text-zinc-500",children:"Two-factor authentication is required each time you open a terminal session. Tokens are valid for 8 hours."}),(0,t.jsx)("button",{onClick:es,className:"text-xs text-zinc-500 hover:text-red-400 transition-colors",children:"Disable 2FA"})]}):T?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),C?(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,t.jsx)("div",{className:"bg-white p-3 rounded-lg",children:(0,t.jsx)("img",{src:C,alt:"TOTP QR Code",width:200,height:200})}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("p",{className:"text-[10px] text-zinc-600 mb-1",children:"Manual entry key:"}),(0,t.jsx)("code",{className:"text-xs bg-zinc-800 px-2 py-1 rounded font-mono select-all",children:E})]})]}):(0,t.jsx)("div",{className:"flex justify-center py-8",children:(0,t.jsx)(o.Loader2,{className:"w-6 h-6 animate-spin text-zinc-400"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs text-zinc-400 block mb-1.5",children:"Enter the 6-digit code from your authenticator"}),(0,t.jsx)("input",{ref:D,type:"text",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"000000",value:q,onChange:e=>{let t;z(t=e.target.value.replace(/\D/g,"").slice(0,6)),I(""),6===t.length&&et(t)},disabled:K,className:"w-40 px-3 py-2 text-lg font-mono tracking-[0.3em] text-center bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white disabled:opacity-50"}),K&&(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-2 text-xs text-zinc-400",children:[(0,t.jsx)(o.Loader2,{className:"w-3 h-3 animate-spin"}),"Verifying..."]}),F&&(0,t.jsx)("p",{className:"text-xs text-red-400 mt-2",children:F})]}),(0,t.jsx)("button",{onClick:()=>{k(!1),O(""),M("")},className:"text-xs text-zinc-500 hover:text-white transition-colors",children:"Cancel"})]}):(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Two-factor authentication adds an extra layer of security to terminal access. You'll need an authenticator app to generate codes."}),(0,t.jsxs)("button",{onClick:ee,className:"flex items-center gap-2 px-4 py-2 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600",children:[(0,t.jsx)(c.Shield,{className:"w-4 h-4"}),"Set up 2FA"]})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(n.FolderOpen,{className:"w-4 h-4"}),"Data Source"]}),(0,t.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-muted-foreground text-xs",children:"Agent Data Directories"}),(0,t.jsxs)("div",{className:"font-mono text-xs mt-1 p-2 bg-zinc-50 dark:bg-zinc-800 rounded space-y-1",children:[(0,t.jsx)("p",{children:"~/.claude/"}),(0,t.jsx)("p",{children:"~/.codex/"}),(0,t.jsx)("p",{children:"~/.gemini/"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-muted-foreground text-xs",children:"Spaces Database"}),(0,t.jsx)("p",{className:"font-mono text-xs mt-1 p-2 bg-zinc-50 dark:bg-zinc-800 rounded",children:"~/.spaces/spaces.db"})]})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(p.FolderCode,{className:"w-4 h-4"}),"Development Directories"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Restrict terminal pane creation to these project roots. Paths must be absolute."}),L.length>0&&(0,t.jsx)("div",{className:"space-y-1.5 mb-3",children:L.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-zinc-50 dark:bg-zinc-800 rounded-md group",children:[(0,t.jsx)(n.FolderOpen,{className:"w-3.5 h-3.5 text-amber-500/70 flex-shrink-0"}),(0,t.jsx)("span",{className:"font-mono text-xs flex-1 truncate",children:e}),(0,t.jsx)("button",{onClick:()=>{X(L.filter(t=>t!==e))},className:"text-zinc-400 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",title:"Remove",children:(0,t.jsx)(d.X,{className:"w-3.5 h-3.5"})})]},e))}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"text",placeholder:"u">typeof navigator&&navigator.platform?.startsWith("Win")?"C:\\Users\\you\\projects":"/home/user/projects",value:_,onChange:e=>W(e.target.value),onKeyDown:e=>"Enter"===e.key&&Y(),className:"flex-1 px-3 py-1.5 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 font-mono"}),(0,t.jsxs)("button",{onClick:Y,disabled:!_.trim()||!(_.trim().startsWith("/")||/^[A-Za-z]:[\\/]/.test(_.trim())),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600 disabled:opacity-50",children:[(0,t.jsx)(h.Plus,{className:"w-3.5 h-3.5"}),"Add"]})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(a.RefreshCw,{className:"w-4 h-4"}),"Data Sync"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Force a full re-scan of all agent sessions. This rebuilds the index from scratch."}),(0,t.jsxs)("button",{onClick:Z,disabled:v.isPending,className:"flex items-center gap-2 px-4 py-2 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600 disabled:opacity-50",children:[v.isPending?(0,t.jsx)(o.Loader2,{className:"w-4 h-4 animate-spin"}):(0,t.jsx)(a.RefreshCw,{className:"w-4 h-4"}),"Re-sync Now"]}),j&&(0,t.jsx)("p",{className:"text-xs text-green-600 mt-2",children:j})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(l.BarChart3,{className:"w-4 h-4"}),"Telemetry"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Anonymous usage data helps us understand how Spaces is used and improve the product. No file paths, session content, or personal information is ever collected."}),H?(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[(0,t.jsx)(o.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):(0,t.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,t.jsx)("input",{type:"checkbox",checked:!J,onChange:G,className:"w-4 h-4 rounded border-zinc-300 dark:border-zinc-700 text-indigo-500 focus:ring-indigo-500"}),(0,t.jsx)("span",{className:"text-sm",children:"Send anonymous usage data"})]})]}),(0,t.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,t.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,t.jsx)(r.Settings,{className:"w-4 h-4"}),"About"]}),(0,t.jsxs)("div",{className:"text-sm space-y-1",children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Version:"})," ",b||"..."]}),(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Tier:"})," ",(0,t.jsx)("span",{className:"capitalize",children:x})]}),(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Data access:"})," Read-only (never modifies agent data directories)"]}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs mt-2",children:"Spaces is an open-source agent workspace manager. All session data stays local on your machine."})]})]})]})]})}e.s(["default",()=>x])}]);
@@ -1,5 +1,5 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,71689,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",()=>t],71689)},68054,e=>{"use strict";let t=(0,e.i(75254).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],68054)},43531,e=>{"use strict";let t=(0,e.i(75254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",()=>t],43531)},31278,e=>{"use strict";let t=(0,e.i(75254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],31278)},37727,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",()=>t],37727)},88699,e=>{"use strict";let t=(0,e.i(75254).default)("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.s(["Pencil",()=>t],88699)},73359,e=>{"use strict";let t={shell:{id:"shell",name:"Shell",command:"",resumeFlag:"",supportsResume:!1,color:"#71717a",description:"Plain terminal shell"},claude:{id:"claude",name:"Claude Code",command:"claude",resumeFlag:"--resume",supportsResume:!0,color:"#d97706",description:"Anthropic Claude Code CLI"},codex:{id:"codex",name:"Codex CLI",command:"codex",resumeFlag:"resume",supportsResume:!0,color:"#10b981",description:"OpenAI Codex CLI"},gemini:{id:"gemini",name:"Gemini CLI",command:"gemini",resumeFlag:"--resume",supportsResume:!0,color:"#3b82f6",description:"Google Gemini CLI"},aider:{id:"aider",name:"Aider",command:"aider",resumeFlag:"",supportsResume:!1,color:"#8b5cf6",description:"AI pair programming in your terminal"},custom:{id:"custom",name:"Custom",command:"",resumeFlag:"",supportsResume:!1,color:"#ec4899",description:"Custom command"}},s=Object.values(t);e.s(["AGENT_LIST",0,s,"AGENT_TYPES",0,t])},34623,e=>{"use strict";var t=e.i(18050),s=e.i(71645),r=e.i(31278),a=e.i(39616),n=e.i(18566),i=e.i(9165),c=e.i(29320);let l="spaces-terminal-token";function o({children:e}){let o=(0,n.useRouter)(),{isDesktop:d,basePath:u}=(0,c.useTier)(),[m,x]=(0,s.useState)("loading"),[h,p]=(0,s.useState)(""),[f,g]=(0,s.useState)(""),[b,y]=(0,s.useState)(""),[w,j]=(0,s.useState)(!1),k=(0,s.useRef)(null),N=`${u}/spaces_icon.png`;(0,s.useEffect)(()=>{if(d){p("desktop-local"),x("authorized");return}function e(){let e=sessionStorage.getItem(l);if(e){p(e),x("authorized");return}fetch((0,i.api)("/api/auth/totp/status")).then(e=>e.json()).then(e=>{e.enabled?(x("prompt"),setTimeout(()=>k.current?.focus(),100)):x("not-setup")}).catch(()=>x("not-setup"))}fetch((0,i.api)("/api/auth/me")).then(t=>{if(t.ok){p("session-auth"),x("authorized");return}return e()}).catch(()=>e())},[d]);let v=(0,s.useCallback)(async e=>{if(6!==e.length)return;j(!0),y("");let t=await fetch((0,i.api)("/api/auth/totp/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,action:"verify"})}),s=await t.json();j(!1),s.success&&s.terminalToken?(sessionStorage.setItem(l,s.terminalToken),p(s.terminalToken),x("authorized")):(y(s.error||"Invalid code"),g(""),k.current?.focus())},[]);return"loading"===m?(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsx)(r.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})}):"authorized"===m?(0,t.jsx)(t.Fragment,{children:e(h)}):"not-setup"===m?(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsxs)("div",{className:"text-center space-y-4 max-w-sm",children:[(0,t.jsx)("img",{src:N,alt:"Spaces",className:"w-12 h-12 mx-auto opacity-40"}),(0,t.jsx)("h2",{className:"text-lg font-semibold text-white",children:"2FA Required"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Two-factor authentication must be set up before you can use terminals."}),(0,t.jsxs)("button",{onClick:()=>o.push("/settings"),className:"inline-flex items-center gap-2 px-4 py-2 text-sm bg-indigo-600 text-white rounded-md hover:bg-indigo-500",children:[(0,t.jsx)(a.Settings,{className:"w-4 h-4"}),"Go to Settings"]})]})}):(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsxs)("div",{className:"text-center space-y-4 max-w-sm",children:[(0,t.jsx)("img",{src:N,alt:"Spaces",className:"w-12 h-12 mx-auto"}),(0,t.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Terminal Verification"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Enter the 6-digit code from your authenticator app."}),(0,t.jsxs)("div",{children:[(0,t.jsx)("input",{ref:k,type:"text",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"000000",value:f,onChange:e=>{let t;g(t=e.target.value.replace(/\D/g,"").slice(0,6)),y(""),6===t.length&&v(t)},disabled:w,className:"w-48 px-3 py-3 text-2xl font-mono tracking-[0.4em] text-center bg-zinc-800 border border-zinc-700 rounded-lg focus:outline-none focus:border-indigo-500 text-white disabled:opacity-50",autoFocus:!0}),w&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 mt-3 text-xs text-zinc-400",children:[(0,t.jsx)(r.Loader2,{className:"w-3 h-3 animate-spin"}),"Verifying..."]}),b&&(0,t.jsx)("p",{className:"text-sm text-red-400 mt-3",children:b})]}),(0,t.jsx)("p",{className:"text-[11px] text-zinc-600",children:"Token is valid for 8 hours after verification."})]})})}e.s(["TotpGate",()=>o])},24134,e=>{"use strict";var t=e.i(47167),s=e.i(18050),r=e.i(71645),a=e.i(74080),n=e.i(37727),i=e.i(88699),c=e.i(43531),l=e.i(75254);let o=(0,l.default)("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"}]]),d=(0,l.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),u=(0,l.default)("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),m=(0,l.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var x=e.i(48256),h=e.i(61911),p=e.i(75157),f=e.i(73359);let g=t.default.env.NEXT_PUBLIC_WS_PATH;function b({pane:t,onClose:l,onUpdate:b,isMaximized:y,onToggleMaximize:w,onPopout:j,isPopout:k,terminalToken:N,workspaceCollaboration:v}){let C=(0,r.useRef)(null),z=(0,r.useRef)(null),T=(0,r.useRef)(null),S=(0,r.useRef)(null),[R,A]=(0,r.useState)(!1),[P,E]=(0,r.useState)(!1),[I,M]=(0,r.useState)(t.title),[F,L]=(0,r.useState)(!1),[$,G]=(0,r.useState)({x:0,y:0}),O=(0,r.useRef)(null),q=(0,r.useRef)(null),[B,_]=(0,r.useState)(!1),H=(0,r.useRef)(t);H.current=t;let J=(0,r.useRef)(b);J.current=b;let U=(0,r.useRef)(N);U.current=N;let W=(0,r.useRef)(!1),Y=(0,r.useRef)(!1),D=(0,r.useRef)(null),V=(0,r.useRef)(0),K=(0,r.useCallback)(async()=>{if(!C.current)return;H.current,Y.current=!1,V.current=0;let{Terminal:t}=await e.A(16049),{FitAddon:s}=await e.A(59439),{WebLinksAddon:r}=await e.A(16091);z.current&&z.current.dispose();let a=new t({cursorBlink:!0,fontSize:13,fontFamily:"'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace",theme:{background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#6366f1",selectionBackground:"#6366f133",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"},allowProposedApi:!0}),n=new s,i=new r;a.loadAddon(n),a.loadAddon(i),await new Promise(e=>requestAnimationFrame(()=>{if(C.current){a.open(C.current);try{n.fit()}catch{}}e()})),z.current=a,S.current=n;let c=()=>{try{n.fit()}catch{}};requestAnimationFrame(()=>requestAnimationFrame(c)),setTimeout(c,300);let l=()=>{let e,t,s,r,n;if(Y.current)return;V.current>0&&(a.write("\x1b[2J\x1b[H"),a.clear());let i=new WebSocket((t=new URLSearchParams({paneId:(e=H.current).id,cwd:e.cwd,agentType:e.agentType||"shell",cols:String(a.cols),rows:String(a.rows)}),e.claudeSessionId&&t.set("agentSession",e.claudeSessionId),e.customCommand&&t.set("customCommand",e.customCommand),e.nodeId&&t.set("nodeId",e.nodeId),(s=U.current)&&t.set("terminalToken",s),r=g||"/ws",n="https:"===location.protocol?"wss:":"ws:",`${n}//${location.host}${r}?${t}`));T.current=i,i.onopen=()=>{A(!0),_(!1),W.current=!1,V.current=0,setTimeout(()=>{if(S.current)try{S.current.fit()}catch{}},150)},i.onmessage=e=>{try{let t=JSON.parse(e.data);if("data"===t.type)a.write(t.data);else if("exit"===t.type){_(!0),W.current=!0;let e=t.reason?` — ${t.reason}`:"";a.write(`\r
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,71689,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",()=>t],71689)},68054,e=>{"use strict";let t=(0,e.i(75254).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",()=>t],68054)},43531,e=>{"use strict";let t=(0,e.i(75254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",()=>t],43531)},31278,e=>{"use strict";let t=(0,e.i(75254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],31278)},37727,e=>{"use strict";let t=(0,e.i(75254).default)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",()=>t],37727)},88699,e=>{"use strict";let t=(0,e.i(75254).default)("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.s(["Pencil",()=>t],88699)},73359,e=>{"use strict";let t={shell:{id:"shell",name:"Shell",command:"",resumeFlag:"",supportsResume:!1,color:"#71717a",description:"Plain terminal shell"},claude:{id:"claude",name:"Claude Code",command:"claude",resumeFlag:"--resume",supportsResume:!0,color:"#d97706",description:"Anthropic Claude Code CLI"},codex:{id:"codex",name:"Codex CLI",command:"codex",resumeFlag:"resume",supportsResume:!0,color:"#10b981",description:"OpenAI Codex CLI"},gemini:{id:"gemini",name:"Gemini CLI",command:"gemini",resumeFlag:"--resume",supportsResume:!0,color:"#3b82f6",description:"Google Gemini CLI"},aider:{id:"aider",name:"Aider",command:"aider",resumeFlag:"",supportsResume:!1,color:"#8b5cf6",description:"AI pair programming in your terminal"},custom:{id:"custom",name:"Custom",command:"",resumeFlag:"",supportsResume:!1,color:"#ec4899",description:"Custom command"}},s=Object.values(t);e.s(["AGENT_LIST",0,s,"AGENT_TYPES",0,t])},34623,e=>{"use strict";var t=e.i(18050),s=e.i(71645),r=e.i(31278),a=e.i(39616),n=e.i(18566),i=e.i(9165),c=e.i(29320);let l="spaces-terminal-token";function o({children:e}){let o=(0,n.useRouter)(),{isDesktop:d,basePath:u}=(0,c.useTier)(),[m,x]=(0,s.useState)("loading"),[h,p]=(0,s.useState)(""),[f,g]=(0,s.useState)(""),[b,y]=(0,s.useState)(""),[w,k]=(0,s.useState)(!1),j=(0,s.useRef)(null),N=`${u}/spaces_icon.png`;(0,s.useEffect)(()=>{if(d){p("desktop-local"),x("authorized");return}function e(){let e=sessionStorage.getItem(l);if(e){p(e),x("authorized");return}fetch((0,i.api)("/api/auth/totp/status")).then(e=>e.json()).then(e=>{e.enabled?(x("prompt"),setTimeout(()=>j.current?.focus(),100)):x("not-setup")}).catch(()=>x("not-setup"))}fetch((0,i.api)("/api/auth/me")).then(t=>{if(t.ok){p("session-auth"),x("authorized");return}return e()}).catch(()=>e())},[d]);let v=(0,s.useCallback)(async e=>{if(6!==e.length)return;k(!0),y("");let t=await fetch((0,i.api)("/api/auth/totp/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,action:"verify"})}),s=await t.json();k(!1),s.success&&s.terminalToken?(sessionStorage.setItem(l,s.terminalToken),p(s.terminalToken),x("authorized")):(y(s.error||"Invalid code"),g(""),j.current?.focus())},[]);return"loading"===m?(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsx)(r.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})}):"authorized"===m?(0,t.jsx)(t.Fragment,{children:e(h)}):"not-setup"===m?(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsxs)("div",{className:"text-center space-y-4 max-w-sm",children:[(0,t.jsx)("img",{src:N,alt:"Spaces",className:"w-12 h-12 mx-auto opacity-40"}),(0,t.jsx)("h2",{className:"text-lg font-semibold text-white",children:"2FA Required"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Two-factor authentication must be set up before you can use terminals."}),(0,t.jsxs)("button",{onClick:()=>o.push("/settings"),className:"inline-flex items-center gap-2 px-4 py-2 text-sm bg-indigo-600 text-white rounded-md hover:bg-indigo-500",children:[(0,t.jsx)(a.Settings,{className:"w-4 h-4"}),"Go to Settings"]})]})}):(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsxs)("div",{className:"text-center space-y-4 max-w-sm",children:[(0,t.jsx)("img",{src:N,alt:"Spaces",className:"w-12 h-12 mx-auto"}),(0,t.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Terminal Verification"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400",children:"Enter the 6-digit code from your authenticator app."}),(0,t.jsxs)("div",{children:[(0,t.jsx)("input",{ref:j,type:"text",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"000000",value:f,onChange:e=>{let t;g(t=e.target.value.replace(/\D/g,"").slice(0,6)),y(""),6===t.length&&v(t)},disabled:w,className:"w-48 px-3 py-3 text-2xl font-mono tracking-[0.4em] text-center bg-zinc-800 border border-zinc-700 rounded-lg focus:outline-none focus:border-indigo-500 text-white disabled:opacity-50",autoFocus:!0}),w&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 mt-3 text-xs text-zinc-400",children:[(0,t.jsx)(r.Loader2,{className:"w-3 h-3 animate-spin"}),"Verifying..."]}),b&&(0,t.jsx)("p",{className:"text-sm text-red-400 mt-3",children:b})]}),(0,t.jsx)("p",{className:"text-[11px] text-zinc-600",children:"Token is valid for 8 hours after verification."})]})})}e.s(["TotpGate",()=>o])},24134,e=>{"use strict";var t=e.i(47167),s=e.i(18050),r=e.i(71645),a=e.i(74080),n=e.i(37727),i=e.i(88699),c=e.i(43531),l=e.i(75254);let o=(0,l.default)("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"}]]),d=(0,l.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]),u=(0,l.default)("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]),m=(0,l.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);var x=e.i(48256),h=e.i(61911),p=e.i(75157),f=e.i(73359);let g=t.default.env.NEXT_PUBLIC_WS_PATH;function b({pane:t,onClose:l,onUpdate:b,isMaximized:y,onToggleMaximize:w,onPopout:k,isPopout:j,terminalToken:N,workspaceCollaboration:v}){let C=(0,r.useRef)(null),z=(0,r.useRef)(null),S=(0,r.useRef)(null),T=(0,r.useRef)(null),[R,A]=(0,r.useState)(!1),[P,E]=(0,r.useState)(!1),[I,M]=(0,r.useState)(t.title),[F,L]=(0,r.useState)(!1),[$,G]=(0,r.useState)({x:0,y:0}),O=(0,r.useRef)(null),q=(0,r.useRef)(null),[B,_]=(0,r.useState)(!1),J=(0,r.useRef)(t);J.current=t;let W=(0,r.useRef)(b);W.current=b;let H=(0,r.useRef)(N);H.current=N;let U=(0,r.useRef)(!1),Y=(0,r.useRef)(!1),D=(0,r.useRef)(null),V=(0,r.useRef)(0),K=(0,r.useCallback)(async()=>{if(!C.current)return;J.current,Y.current=!1,V.current=0;let{Terminal:t}=await e.A(16049),{FitAddon:s}=await e.A(59439),{WebLinksAddon:r}=await e.A(16091);z.current&&z.current.dispose();let a=new t({cursorBlink:!0,fontSize:13,fontFamily:"'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace",theme:{background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#6366f1",selectionBackground:"#6366f133",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"},allowProposedApi:!0}),n=new s,i=new r;a.loadAddon(n),a.loadAddon(i),await new Promise(e=>requestAnimationFrame(()=>{if(C.current){a.open(C.current);try{n.fit()}catch{}}e()})),z.current=a,T.current=n;let c=()=>{try{n.fit()}catch{}};requestAnimationFrame(()=>requestAnimationFrame(c)),setTimeout(c,300);let l=()=>{let e,t,s,r,n;if(Y.current)return;V.current>0&&(a.write("\x1b[2J\x1b[H"),a.clear());let i=new WebSocket((t=new URLSearchParams({paneId:(e=J.current).id,cwd:e.cwd,agentType:e.agentType||"shell",cols:String(a.cols),rows:String(a.rows)}),e.claudeSessionId&&t.set("agentSession",e.claudeSessionId),e.customCommand&&t.set("customCommand",e.customCommand),e.nodeId&&t.set("nodeId",e.nodeId),(s=H.current)&&t.set("terminalToken",s),r=g||"/ws",n="https:"===location.protocol?"wss:":"ws:",`${n}//${location.host}${r}?${t}`));S.current=i,i.onopen=()=>{A(!0),_(!1),U.current=!1,V.current=0,setTimeout(()=>{if(T.current)try{T.current.fit()}catch{}},150)},i.onmessage=e=>{try{let t=JSON.parse(e.data);if("data"===t.type)a.write(t.data);else if("exit"===t.type){_(!0),U.current=!0;let e=t.reason?` — ${t.reason}`:"";a.write(`\r
2
2
  \x1b[90m[Process exited with code ${t.exitCode}${e}]\x1b[0m\r
3
3
  `)}else"error"===t.type?a.write(`\r
4
4
  \x1b[31m${t.data}\x1b[0m\r
5
- `):"session-detected"===t.type&&J.current(H.current.id,{claudeSessionId:t.sessionId})}catch{}},i.onclose=()=>{if(A(!1),!W.current&&!Y.current){let e=V.current;if(e<20){let t=Math.min(1e3*Math.pow(1.5,e),3e4);V.current=e+1,D.current=setTimeout(l,t)}}},i.onerror=()=>{A(!1)}};a.onData(e=>{T.current?.readyState===WebSocket.OPEN&&T.current.send(JSON.stringify({type:"data",data:e}))}),a.onResize(({cols:e,rows:t})=>{T.current?.readyState===WebSocket.OPEN&&T.current.send(JSON.stringify({type:"resize",cols:e,rows:t}))}),l()},[]);(0,r.useEffect)(()=>(K(),()=>{Y.current=!0,D.current&&clearTimeout(D.current),T.current?.close(),z.current?.dispose()}),[K]),(0,r.useEffect)(()=>{let e,t=new ResizeObserver(()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{if(S.current)try{S.current.fit()}catch{}})});return C.current&&t.observe(C.current),()=>{cancelAnimationFrame(e),t.disconnect()}},[]),(0,r.useEffect)(()=>{setTimeout(()=>{if(S.current)try{S.current.fit()}catch{}},50)},[y]);let X=()=>{b(t.id,{title:I}),E(!1)};return(0,r.useEffect)(()=>{if(!F)return;let e=e=>{let t=e.target;O.current&&!O.current.contains(t)&&q.current&&!q.current.contains(t)&&L(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[F]),(0,s.jsxs)("div",{className:(0,p.cn)("flex flex-col border rounded-lg overflow-hidden",y?"fixed inset-2 z-50":"","border-zinc-700"),style:{borderColor:`${t.color}60`},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs select-none flex-shrink-0",style:{backgroundColor:`${t.color}60`},children:[(0,s.jsxs)("div",{ref:O,className:"flex-shrink-0",children:[(0,s.jsx)("button",{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();G({x:t.left,y:t.bottom+6}),L(!F)},className:"w-3 h-3 rounded-full hover:ring-2 hover:ring-zinc-500 ring-offset-1 ring-offset-zinc-900 transition-shadow cursor-pointer",style:{backgroundColor:t.color},title:"Change color"}),F&&(0,a.createPortal)((0,s.jsx)("div",{ref:q,className:"fixed z-[9999] bg-zinc-800 border border-zinc-600 rounded-xl p-3 shadow-2xl",style:{left:$.x,top:$.y},children:(0,s.jsx)("div",{className:"grid grid-cols-4 gap-2.5",style:{width:132},children:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#78716c"].map(e=>(0,s.jsx)("button",{onClick:()=>{b(t.id,{color:e}),L(!1)},className:`w-7 h-7 rounded-full border-2 transition-all hover:scale-110 ${t.color===e?"border-white scale-110 shadow-lg":"border-transparent hover:border-zinc-500"}`,style:{backgroundColor:e}},e))})}),document.body)]}),P?(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-1",children:[(0,s.jsx)("input",{autoFocus:!0,value:I,onChange:e=>M(e.target.value),onKeyDown:e=>{"Enter"===e.key&&X(),"Escape"===e.key&&(M(t.title),E(!1))},className:"flex-1 bg-transparent border border-zinc-600 rounded px-1.5 py-0.5 text-xs focus:outline-none focus:border-indigo-400"}),(0,s.jsx)("button",{onClick:X,className:"text-green-400 hover:text-green-300",children:(0,s.jsx)(c.Check,{className:"w-3 h-3"})})]}):(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-1 min-w-0 group/title",children:[(0,s.jsx)("span",{onDoubleClick:()=>E(!0),className:"truncate text-zinc-300 font-medium cursor-default",children:t.title}),(0,s.jsx)("button",{onClick:()=>E(!0),className:"text-zinc-600 hover:text-zinc-300 opacity-0 group-hover/title:opacity-100 transition-opacity flex-shrink-0",title:"Rename",children:(0,s.jsx)(i.Pencil,{className:"w-2.5 h-2.5"})})]}),(0,s.jsx)("span",{className:"text-[10px] text-zinc-500 truncate max-w-[120px]",title:t.cwd,children:t.cwd.split(/[/\\]/).pop()}),t.agentType&&"shell"!==t.agentType&&(0,s.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:`${f.AGENT_TYPES[t.agentType]?.color||"#6366f1"}20`,color:f.AGENT_TYPES[t.agentType]?.color||"#6366f1"},children:f.AGENT_TYPES[t.agentType]?.name||t.agentType}),t.nodeId&&(0,s.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium bg-blue-500/10 text-blue-400 flex items-center gap-0.5",children:[(0,s.jsx)(x.Globe,{className:"w-2.5 h-2.5"}),"remote"]}),v&&"shell"!==t.agentType&&(0,s.jsx)("button",{onClick:()=>b(t.id,{isCollaborating:!t.isCollaborating}),className:`transition-colors ${t.isCollaborating?"text-indigo-400 hover:text-indigo-300":"text-zinc-600 hover:text-zinc-400"}`,title:t.isCollaborating?"Collaborating — click to opt out":"Not collaborating — click to opt in",children:(0,s.jsx)(h.Users,{className:"w-3 h-3"})}),!R&&!B&&(0,s.jsx)("span",{className:"text-[10px] text-yellow-500",children:"connecting..."}),B&&(0,s.jsx)("button",{onClick:()=>{Y.current=!0,D.current&&clearTimeout(D.current),T.current?.close(),z.current?.dispose(),_(!1),W.current=!1,setTimeout(K,100)},className:"text-zinc-400 hover:text-white",title:"Restart",children:(0,s.jsx)(o,{className:"w-3 h-3"})}),!k&&j&&(0,s.jsx)("button",{onClick:()=>{j&&(Y.current=!0,D.current&&clearTimeout(D.current),T.current?.close(),z.current?.dispose(),j(t.id))},className:"text-zinc-400 hover:text-white",title:"Pop out to new window",children:(0,s.jsx)(m,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>w(t.id),className:"text-zinc-400 hover:text-white",title:y?"Restore":"Maximize",children:y?(0,s.jsx)(u,{className:"w-3 h-3"}):(0,s.jsx)(d,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>{confirm("Close this terminal?")&&l(t.id)},className:"text-zinc-400 hover:text-red-400",title:"Close",children:(0,s.jsx)(n.X,{className:"w-3 h-3"})})]}),(0,s.jsx)("div",{ref:C,className:"flex-1 bg-[#0a0a0a]",style:{minHeight:y?"calc(100vh - 100px)":"300px"}})]})}e.s(["TerminalPane",()=>b],24134)},63209,e=>{"use strict";let t=(0,e.i(75254).default)("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.s(["AlertCircle",()=>t],63209)},10160,e=>{"use strict";var t=e.i(18050),s=e.i(71645),r=e.i(18566),a=e.i(31278),n=e.i(71689),i=e.i(48256),c=e.i(68054),l=e.i(63209),o=e.i(24134),d=e.i(34623),u=e.i(9165);function m({params:e}){return(0,t.jsx)(d.TotpGate,{children:s=>(0,t.jsx)(x,{params:e,terminalToken:s})})}function x({params:e,terminalToken:d}){let m=(0,r.useRouter)(),[x,h]=(0,s.useState)(null),[p,f]=(0,s.useState)(null),[g,b]=(0,s.useState)([]),[y,w]=(0,s.useState)(""),[j,k]=(0,s.useState)("#6366f1"),[N,v]=(0,s.useState)(""),[C,z]=(0,s.useState)(!0),[T,S]=(0,s.useState)(null),[R,A]=(0,s.useState)(null);(0,s.useEffect)(()=>{e.then(e=>{h(e.nodeId),f(e.workspaceId)})},[e]),(0,s.useEffect)(()=>{x&&p&&Promise.all([fetch((0,u.api)(`/api/network/proxy/${x}/workspaces/${p}`)).then(e=>{if(!e.ok)throw Error(`Failed to fetch workspace (${e.status})`);return e.json()}),fetch((0,u.api)(`/api/network/proxy/${x}/workspaces`)).then(e=>{if(!e.ok)throw Error(`Failed to fetch workspaces (${e.status})`);return e.json()})]).then(([e,t])=>{b((e.panes||[]).map(e=>({...e,nodeId:x,isPopout:!!e.isPopout})));let s=t.workspaces?.find(e=>String(e.id)===p);s&&(w(s.name),k(s.color),v(s.nodeName||"")),z(!1)}).catch(e=>{S(e.message),z(!1)})},[x,p]);let P=(0,s.useCallback)(()=>{},[]),E=(0,s.useCallback)(()=>{},[]),I=(0,s.useCallback)(e=>{A(t=>t===e?null:e)},[]);if(C)return(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsx)(a.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})});if(T)return(0,t.jsxs)("div",{className:"h-screen flex flex-col items-center justify-center bg-zinc-950 text-zinc-100",children:[(0,t.jsx)(l.AlertCircle,{className:"w-8 h-8 text-red-500 mb-3"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400 mb-4",children:T}),(0,t.jsxs)("button",{onClick:()=>m.push("/terminal"),className:"flex items-center gap-2 px-4 py-2 text-sm border border-zinc-700 text-zinc-400 rounded-lg hover:text-white hover:border-zinc-500 transition-colors",children:[(0,t.jsx)(n.ArrowLeft,{className:"w-4 h-4"}),"Back to Spaces"]})]});let M=g.filter(e=>!e.isPopout);return(0,t.jsxs)("div",{className:"h-screen flex flex-col bg-zinc-950 text-zinc-100",children:[(0,t.jsx)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-zinc-800 flex-shrink-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("button",{onClick:()=>m.push("/terminal"),className:"p-1.5 -ml-1 text-zinc-500 hover:text-white hover:bg-zinc-800 rounded-md transition-colors",title:"Back to Spaces",children:(0,t.jsx)(n.ArrowLeft,{className:"w-4 h-4"})}),(0,t.jsx)("div",{className:"w-px h-4 bg-zinc-800"}),(0,t.jsx)(i.Globe,{className:"w-3.5 h-3.5 text-zinc-500"}),(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:j}}),(0,t.jsx)("span",{className:"text-sm font-semibold",children:y||"Remote Workspace"}),N&&(0,t.jsxs)("span",{className:"text-xs text-zinc-500",children:["on ",N]}),(0,t.jsxs)("span",{className:"text-[11px] text-zinc-500",children:[M.length," pane",1!==M.length?"s":""]})]})}),0===M.length?(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)(c.Terminal,{className:"w-10 h-10 text-zinc-700 mx-auto"}),(0,t.jsx)("p",{className:"text-zinc-500 text-sm",children:"This remote workspace has no panes."})]})}):(0,t.jsx)("div",{className:"flex-1 p-2 gap-2 overflow-auto",style:{display:"grid",gridTemplateColumns:1===M.length?"1fr":M.length<=2||M.length<=4?"repeat(2, 1fr)":"repeat(3, 1fr)",gridAutoRows:M.length<=2?"1fr":"minmax(300px, 1fr)"},children:M.map(e=>R&&R!==e.id?null:(0,t.jsx)(o.TerminalPane,{pane:e,onClose:P,onUpdate:E,isMaximized:R===e.id,onToggleMaximize:I,terminalToken:d},e.id))})]})}e.s(["default",()=>m])},16049,e=>{e.v(t=>Promise.all(["static/chunks/e40d2bd3b4ce8192.js"].map(t=>e.l(t))).then(()=>t(44908)))},59439,e=>{e.v(t=>Promise.all(["static/chunks/af8bfb72187b7cbf.js"].map(t=>e.l(t))).then(()=>t(93309)))},16091,e=>{e.v(t=>Promise.all(["static/chunks/9768207ca0a51abd.js"].map(t=>e.l(t))).then(()=>t(52216)))}]);
5
+ `):"session-detected"===t.type&&W.current(J.current.id,{claudeSessionId:t.sessionId})}catch{}},i.onclose=()=>{if(A(!1),!U.current&&!Y.current){let e=V.current;if(e<20){let t=Math.min(1e3*Math.pow(1.5,e),3e4);V.current=e+1,D.current=setTimeout(l,t)}}},i.onerror=()=>{A(!1)}};a.onData(e=>{S.current?.readyState===WebSocket.OPEN&&S.current.send(JSON.stringify({type:"data",data:e}))}),a.onResize(({cols:e,rows:t})=>{S.current?.readyState===WebSocket.OPEN&&S.current.send(JSON.stringify({type:"resize",cols:e,rows:t}))}),l()},[]);(0,r.useEffect)(()=>(K(),()=>{Y.current=!0,D.current&&clearTimeout(D.current),S.current?.close(),z.current?.dispose()}),[K]),(0,r.useEffect)(()=>{let e,t=new ResizeObserver(()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{if(T.current)try{T.current.fit()}catch{}})});return C.current&&t.observe(C.current),()=>{cancelAnimationFrame(e),t.disconnect()}},[]),(0,r.useEffect)(()=>{setTimeout(()=>{if(T.current)try{T.current.fit()}catch{}},50)},[y]);let X=()=>{b(t.id,{title:I}),E(!1)};return(0,r.useEffect)(()=>{if(!F)return;let e=e=>{let t=e.target;O.current&&!O.current.contains(t)&&q.current&&!q.current.contains(t)&&L(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[F]),(0,s.jsxs)("div",{className:(0,p.cn)("flex flex-col border rounded-lg overflow-hidden",y?"fixed inset-2 z-50":"","border-zinc-700"),style:{borderColor:`${t.color}60`},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs select-none flex-shrink-0",style:{backgroundColor:`${t.color}60`},children:[(0,s.jsxs)("div",{ref:O,className:"flex-shrink-0",children:[(0,s.jsx)("button",{onClick:e=>{let t=e.currentTarget.getBoundingClientRect();G({x:t.left,y:t.bottom+6}),L(!F)},className:"w-3 h-3 rounded-full hover:ring-2 hover:ring-zinc-500 ring-offset-1 ring-offset-zinc-900 transition-shadow cursor-pointer",style:{backgroundColor:t.color},title:"Change color"}),F&&(0,a.createPortal)((0,s.jsx)("div",{ref:q,className:"fixed z-[9999] bg-zinc-800 border border-zinc-600 rounded-xl p-3 shadow-2xl",style:{left:$.x,top:$.y},children:(0,s.jsx)("div",{className:"grid grid-cols-4 gap-2.5",style:{width:132},children:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#78716c"].map(e=>(0,s.jsx)("button",{onClick:()=>{b(t.id,{color:e}),L(!1)},className:`w-7 h-7 rounded-full border-2 transition-all hover:scale-110 ${t.color===e?"border-white scale-110 shadow-lg":"border-transparent hover:border-zinc-500"}`,style:{backgroundColor:e}},e))})}),document.body)]}),P?(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-1",children:[(0,s.jsx)("input",{autoFocus:!0,value:I,onChange:e=>M(e.target.value),onKeyDown:e=>{"Enter"===e.key&&X(),"Escape"===e.key&&(M(t.title),E(!1))},className:"flex-1 bg-transparent border border-zinc-600 rounded px-1.5 py-0.5 text-xs focus:outline-none focus:border-indigo-400"}),(0,s.jsx)("button",{onClick:X,className:"text-green-400 hover:text-green-300",children:(0,s.jsx)(c.Check,{className:"w-3 h-3"})})]}):(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-1 min-w-0 group/title",children:[(0,s.jsx)("span",{onDoubleClick:()=>E(!0),className:"truncate text-zinc-300 font-medium cursor-default",children:t.title}),(0,s.jsx)("button",{onClick:()=>E(!0),className:"text-zinc-600 hover:text-zinc-300 opacity-0 group-hover/title:opacity-100 transition-opacity flex-shrink-0",title:"Rename",children:(0,s.jsx)(i.Pencil,{className:"w-2.5 h-2.5"})})]}),(0,s.jsx)("span",{className:"text-[10px] text-zinc-500 truncate max-w-[120px]",title:t.cwd,children:t.cwd.split(/[/\\]/).pop()}),t.agentType&&"shell"!==t.agentType&&(0,s.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium",style:{backgroundColor:`${f.AGENT_TYPES[t.agentType]?.color||"#6366f1"}20`,color:f.AGENT_TYPES[t.agentType]?.color||"#6366f1"},children:f.AGENT_TYPES[t.agentType]?.name||t.agentType}),t.nodeId&&(0,s.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded font-medium bg-blue-500/10 text-blue-400 flex items-center gap-0.5",children:[(0,s.jsx)(x.Globe,{className:"w-2.5 h-2.5"}),"remote"]}),v&&"shell"!==t.agentType&&(0,s.jsx)("button",{onClick:()=>{let e=!t.isCollaborating;b(t.id,{isCollaborating:e}),S.current?.readyState===WebSocket.OPEN&&S.current.send(JSON.stringify({type:"collab-toggle",isCollaborating:e}))},className:`transition-colors ${t.isCollaborating?"text-indigo-400 hover:text-indigo-300":"text-zinc-600 hover:text-zinc-400"}`,title:t.isCollaborating?"Collaborating — click to opt out":"Not collaborating — click to opt in",children:(0,s.jsx)(h.Users,{className:"w-3 h-3"})}),!R&&!B&&(0,s.jsx)("span",{className:"text-[10px] text-yellow-500",children:"connecting..."}),B&&(0,s.jsx)("button",{onClick:()=>{Y.current=!0,D.current&&clearTimeout(D.current),S.current?.close(),z.current?.dispose(),_(!1),U.current=!1,setTimeout(K,100)},className:"text-zinc-400 hover:text-white",title:"Restart",children:(0,s.jsx)(o,{className:"w-3 h-3"})}),!j&&k&&(0,s.jsx)("button",{onClick:()=>{k&&(Y.current=!0,D.current&&clearTimeout(D.current),S.current?.close(),z.current?.dispose(),k(t.id))},className:"text-zinc-400 hover:text-white",title:"Pop out to new window",children:(0,s.jsx)(m,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>w(t.id),className:"text-zinc-400 hover:text-white",title:y?"Restore":"Maximize",children:y?(0,s.jsx)(u,{className:"w-3 h-3"}):(0,s.jsx)(d,{className:"w-3 h-3"})}),(0,s.jsx)("button",{onClick:()=>{confirm("Close this terminal?")&&l(t.id)},className:"text-zinc-400 hover:text-red-400",title:"Close",children:(0,s.jsx)(n.X,{className:"w-3 h-3"})})]}),(0,s.jsx)("div",{ref:C,className:"flex-1 bg-[#0a0a0a]",style:{minHeight:y?"calc(100vh - 100px)":"300px"}})]})}e.s(["TerminalPane",()=>b],24134)},63209,e=>{"use strict";let t=(0,e.i(75254).default)("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.s(["AlertCircle",()=>t],63209)},10160,e=>{"use strict";var t=e.i(18050),s=e.i(71645),r=e.i(18566),a=e.i(31278),n=e.i(71689),i=e.i(48256),c=e.i(68054),l=e.i(63209),o=e.i(24134),d=e.i(34623),u=e.i(9165);function m({params:e}){return(0,t.jsx)(d.TotpGate,{children:s=>(0,t.jsx)(x,{params:e,terminalToken:s})})}function x({params:e,terminalToken:d}){let m=(0,r.useRouter)(),[x,h]=(0,s.useState)(null),[p,f]=(0,s.useState)(null),[g,b]=(0,s.useState)([]),[y,w]=(0,s.useState)(""),[k,j]=(0,s.useState)("#6366f1"),[N,v]=(0,s.useState)(""),[C,z]=(0,s.useState)(!0),[S,T]=(0,s.useState)(null),[R,A]=(0,s.useState)(null);(0,s.useEffect)(()=>{e.then(e=>{h(e.nodeId),f(e.workspaceId)})},[e]),(0,s.useEffect)(()=>{x&&p&&Promise.all([fetch((0,u.api)(`/api/network/proxy/${x}/workspaces/${p}`)).then(e=>{if(!e.ok)throw Error(`Failed to fetch workspace (${e.status})`);return e.json()}),fetch((0,u.api)(`/api/network/proxy/${x}/workspaces`)).then(e=>{if(!e.ok)throw Error(`Failed to fetch workspaces (${e.status})`);return e.json()})]).then(([e,t])=>{b((e.panes||[]).map(e=>({...e,nodeId:x,isPopout:!!e.isPopout})));let s=t.workspaces?.find(e=>String(e.id)===p);s&&(w(s.name),j(s.color),v(s.nodeName||"")),z(!1)}).catch(e=>{T(e.message),z(!1)})},[x,p]);let P=(0,s.useCallback)(()=>{},[]),E=(0,s.useCallback)(()=>{},[]),I=(0,s.useCallback)(e=>{A(t=>t===e?null:e)},[]);if(C)return(0,t.jsx)("div",{className:"flex items-center justify-center h-screen bg-zinc-950",children:(0,t.jsx)(a.Loader2,{className:"w-6 h-6 animate-spin text-indigo-500"})});if(S)return(0,t.jsxs)("div",{className:"h-screen flex flex-col items-center justify-center bg-zinc-950 text-zinc-100",children:[(0,t.jsx)(l.AlertCircle,{className:"w-8 h-8 text-red-500 mb-3"}),(0,t.jsx)("p",{className:"text-sm text-zinc-400 mb-4",children:S}),(0,t.jsxs)("button",{onClick:()=>m.push("/terminal"),className:"flex items-center gap-2 px-4 py-2 text-sm border border-zinc-700 text-zinc-400 rounded-lg hover:text-white hover:border-zinc-500 transition-colors",children:[(0,t.jsx)(n.ArrowLeft,{className:"w-4 h-4"}),"Back to Spaces"]})]});let M=g.filter(e=>!e.isPopout);return(0,t.jsxs)("div",{className:"h-screen flex flex-col bg-zinc-950 text-zinc-100",children:[(0,t.jsx)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-zinc-800 flex-shrink-0",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("button",{onClick:()=>m.push("/terminal"),className:"p-1.5 -ml-1 text-zinc-500 hover:text-white hover:bg-zinc-800 rounded-md transition-colors",title:"Back to Spaces",children:(0,t.jsx)(n.ArrowLeft,{className:"w-4 h-4"})}),(0,t.jsx)("div",{className:"w-px h-4 bg-zinc-800"}),(0,t.jsx)(i.Globe,{className:"w-3.5 h-3.5 text-zinc-500"}),(0,t.jsx)("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:k}}),(0,t.jsx)("span",{className:"text-sm font-semibold",children:y||"Remote Workspace"}),N&&(0,t.jsxs)("span",{className:"text-xs text-zinc-500",children:["on ",N]}),(0,t.jsxs)("span",{className:"text-[11px] text-zinc-500",children:[M.length," pane",1!==M.length?"s":""]})]})}),0===M.length?(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)(c.Terminal,{className:"w-10 h-10 text-zinc-700 mx-auto"}),(0,t.jsx)("p",{className:"text-zinc-500 text-sm",children:"This remote workspace has no panes."})]})}):(0,t.jsx)("div",{className:"flex-1 p-2 gap-2 overflow-auto",style:{display:"grid",gridTemplateColumns:1===M.length?"1fr":M.length<=2||M.length<=4?"repeat(2, 1fr)":"repeat(3, 1fr)",gridAutoRows:M.length<=2?"1fr":"minmax(300px, 1fr)"},children:M.map(e=>R&&R!==e.id?null:(0,t.jsx)(o.TerminalPane,{pane:e,onClose:P,onUpdate:E,isMaximized:R===e.id,onToggleMaximize:I,terminalToken:d},e.id))})]})}e.s(["default",()=>m])},16049,e=>{e.v(t=>Promise.all(["static/chunks/e40d2bd3b4ce8192.js"].map(t=>e.l(t))).then(()=>t(44908)))},59439,e=>{e.v(t=>Promise.all(["static/chunks/af8bfb72187b7cbf.js"].map(t=>e.l(t))).then(()=>t(93309)))},16091,e=>{e.v(t=>Promise.all(["static/chunks/9768207ca0a51abd.js"].map(t=>e.l(t))).then(()=>t(52216)))}]);