@chorus-aidlc/chorus 0.21.0 → 0.21.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 (289) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-build-manifest.json +213 -213
  3. package/.next/standalone/.next/app-path-routes-manifest.json +38 -38
  4. package/.next/standalone/.next/build-manifest.json +2 -2
  5. package/.next/standalone/.next/prerender-manifest.json +42 -42
  6. package/.next/standalone/.next/server/app/(dashboard)/project-groups/[uuid]/page.js +1 -1
  7. package/.next/standalone/.next/server/app/(dashboard)/project-groups/[uuid]/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/(dashboard)/project-groups/[uuid]/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/activity/page.js +1 -1
  10. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/activity/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/[ideaUuid]/page.js +2 -2
  12. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/[ideaUuid]/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/page.js +2 -2
  14. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/dashboard/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/documents/[documentUuid]/page.js +1 -1
  17. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/documents/[documentUuid]/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/documents/page.js +1 -1
  19. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/documents/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/graph/page.js +2 -2
  21. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/graph/page.js.nft.json +1 -1
  22. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/graph/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page.js +2 -2
  24. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page.js.nft.json +1 -1
  25. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page_client-reference-manifest.js +1 -1
  26. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/new/page.js +2 -2
  27. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/new/page_client-reference-manifest.js +1 -1
  28. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/page.js +2 -2
  29. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/proposals/page_client-reference-manifest.js +1 -1
  30. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/[taskUuid]/page.js +1 -1
  31. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/[taskUuid]/page.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/[taskUuid]/page_client-reference-manifest.js +1 -1
  33. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/page.js +1 -1
  34. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/page.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/(dashboard)/projects/[uuid]/tasks/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app/(dashboard)/projects/page.js +1 -1
  37. package/.next/standalone/.next/server/app/(dashboard)/projects/page.js.nft.json +1 -1
  38. package/.next/standalone/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/(dashboard)/settings/page.js +2 -2
  40. package/.next/standalone/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  43. package/.next/standalone/.next/server/app/_not-found.html +2 -2
  44. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  45. package/.next/standalone/.next/server/app/admin/companies/[uuid]/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/admin/companies/new/page_client-reference-manifest.js +1 -1
  47. package/.next/standalone/.next/server/app/admin/companies/new.html +2 -2
  48. package/.next/standalone/.next/server/app/admin/companies/new.rsc +1 -1
  49. package/.next/standalone/.next/server/app/admin/companies/page_client-reference-manifest.js +1 -1
  50. package/.next/standalone/.next/server/app/admin/companies.html +2 -2
  51. package/.next/standalone/.next/server/app/admin/companies.rsc +1 -1
  52. package/.next/standalone/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  53. package/.next/standalone/.next/server/app/admin.html +2 -2
  54. package/.next/standalone/.next/server/app/admin.rsc +1 -1
  55. package/.next/standalone/.next/server/app/api/admin/companies/[uuid]/route_client-reference-manifest.js +1 -1
  56. package/.next/standalone/.next/server/app/api/admin/companies/route_client-reference-manifest.js +1 -1
  57. package/.next/standalone/.next/server/app/api/admin/login/route_client-reference-manifest.js +1 -1
  58. package/.next/standalone/.next/server/app/api/admin/session/route_client-reference-manifest.js +1 -1
  59. package/.next/standalone/.next/server/app/api/agent-connections/route_client-reference-manifest.js +1 -1
  60. package/.next/standalone/.next/server/app/api/agents/[uuid]/route_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/api/agents/[uuid]/sessions/route_client-reference-manifest.js +1 -1
  62. package/.next/standalone/.next/server/app/api/agents/route_client-reference-manifest.js +1 -1
  63. package/.next/standalone/.next/server/app/api/api-keys/[uuid]/route_client-reference-manifest.js +1 -1
  64. package/.next/standalone/.next/server/app/api/api-keys/route_client-reference-manifest.js +1 -1
  65. package/.next/standalone/.next/server/app/api/auth/callback/route_client-reference-manifest.js +1 -1
  66. package/.next/standalone/.next/server/app/api/auth/check-default/route_client-reference-manifest.js +1 -1
  67. package/.next/standalone/.next/server/app/api/auth/company-oidc/route_client-reference-manifest.js +1 -1
  68. package/.next/standalone/.next/server/app/api/auth/default-login/route_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/app/api/auth/identify/route_client-reference-manifest.js +1 -1
  70. package/.next/standalone/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
  71. package/.next/standalone/.next/server/app/api/auth/me/route_client-reference-manifest.js +1 -1
  72. package/.next/standalone/.next/server/app/api/auth/sync-token/route_client-reference-manifest.js +1 -1
  73. package/.next/standalone/.next/server/app/api/comments/route_client-reference-manifest.js +1 -1
  74. package/.next/standalone/.next/server/app/api/daemon/connection-heartbeat/route_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/app/api/daemon/control/route_client-reference-manifest.js +1 -1
  76. package/.next/standalone/.next/server/app/api/daemon/directory-request/report/route_client-reference-manifest.js +1 -1
  77. package/.next/standalone/.next/server/app/api/daemon/execution-state/route_client-reference-manifest.js +1 -1
  78. package/.next/standalone/.next/server/app/api/daemon/executions/route_client-reference-manifest.js +1 -1
  79. package/.next/standalone/.next/server/app/api/daemon/pending-turns/route_client-reference-manifest.js +1 -1
  80. package/.next/standalone/.next/server/app/api/daemon/report-interrupt/route_client-reference-manifest.js +1 -1
  81. package/.next/standalone/.next/server/app/api/daemon/resume/route_client-reference-manifest.js +1 -1
  82. package/.next/standalone/.next/server/app/api/daemon/transcript/route_client-reference-manifest.js +1 -1
  83. package/.next/standalone/.next/server/app/api/daemon/turn-advance/route_client-reference-manifest.js +1 -1
  84. package/.next/standalone/.next/server/app/api/daemon-directory-requests/[uuid]/route_client-reference-manifest.js +1 -1
  85. package/.next/standalone/.next/server/app/api/daemon-directory-requests/route_client-reference-manifest.js +1 -1
  86. package/.next/standalone/.next/server/app/api/daemon-sessions/[sessionUuid]/instruction/route_client-reference-manifest.js +1 -1
  87. package/.next/standalone/.next/server/app/api/daemon-sessions/[sessionUuid]/repoint/route_client-reference-manifest.js +1 -1
  88. package/.next/standalone/.next/server/app/api/daemon-sessions/[sessionUuid]/route_client-reference-manifest.js +1 -1
  89. package/.next/standalone/.next/server/app/api/daemon-sessions/ad-hoc/route_client-reference-manifest.js +1 -1
  90. package/.next/standalone/.next/server/app/api/daemon-sessions/route_client-reference-manifest.js +1 -1
  91. package/.next/standalone/.next/server/app/api/documents/[uuid]/route_client-reference-manifest.js +1 -1
  92. package/.next/standalone/.next/server/app/api/entities/[type]/[uuid]/root-idea/route_client-reference-manifest.js +1 -1
  93. package/.next/standalone/.next/server/app/api/events/notifications/route_client-reference-manifest.js +1 -1
  94. package/.next/standalone/.next/server/app/api/events/route_client-reference-manifest.js +1 -1
  95. package/.next/standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  96. package/.next/standalone/.next/server/app/api/ideas/[uuid]/claim/route_client-reference-manifest.js +1 -1
  97. package/.next/standalone/.next/server/app/api/ideas/[uuid]/move/preview/route_client-reference-manifest.js +1 -1
  98. package/.next/standalone/.next/server/app/api/ideas/[uuid]/move/route_client-reference-manifest.js +1 -1
  99. package/.next/standalone/.next/server/app/api/ideas/[uuid]/parent/route_client-reference-manifest.js +1 -1
  100. package/.next/standalone/.next/server/app/api/ideas/[uuid]/release/route_client-reference-manifest.js +1 -1
  101. package/.next/standalone/.next/server/app/api/ideas/[uuid]/route_client-reference-manifest.js +1 -1
  102. package/.next/standalone/.next/server/app/api/ideas/[uuid]/wake-preview/route_client-reference-manifest.js +1 -1
  103. package/.next/standalone/.next/server/app/api/ideas/conversational/route_client-reference-manifest.js +1 -1
  104. package/.next/standalone/.next/server/app/api/mcp/route_client-reference-manifest.js +1 -1
  105. package/.next/standalone/.next/server/app/api/me/assignments/route_client-reference-manifest.js +1 -1
  106. package/.next/standalone/.next/server/app/api/mentionables/route_client-reference-manifest.js +1 -1
  107. package/.next/standalone/.next/server/app/api/notifications/[uuid]/archive/route_client-reference-manifest.js +1 -1
  108. package/.next/standalone/.next/server/app/api/notifications/[uuid]/read/route_client-reference-manifest.js +1 -1
  109. package/.next/standalone/.next/server/app/api/notifications/preferences/route_client-reference-manifest.js +1 -1
  110. package/.next/standalone/.next/server/app/api/notifications/read-all/route_client-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
  112. package/.next/standalone/.next/server/app/api/notifications/unread-count/route_client-reference-manifest.js +1 -1
  113. package/.next/standalone/.next/server/app/api/project-groups/[uuid]/access-preview/route_client-reference-manifest.js +1 -1
  114. package/.next/standalone/.next/server/app/api/project-groups/[uuid]/dashboard/route_client-reference-manifest.js +1 -1
  115. package/.next/standalone/.next/server/app/api/project-groups/[uuid]/members/[userUuid]/route_client-reference-manifest.js +1 -1
  116. package/.next/standalone/.next/server/app/api/project-groups/[uuid]/members/route_client-reference-manifest.js +1 -1
  117. package/.next/standalone/.next/server/app/api/project-groups/[uuid]/route_client-reference-manifest.js +1 -1
  118. package/.next/standalone/.next/server/app/api/project-groups/route_client-reference-manifest.js +1 -1
  119. package/.next/standalone/.next/server/app/api/project-visits/pin/route_client-reference-manifest.js +1 -1
  120. package/.next/standalone/.next/server/app/api/project-visits/route_client-reference-manifest.js +1 -1
  121. package/.next/standalone/.next/server/app/api/project-visits/visit/route_client-reference-manifest.js +1 -1
  122. package/.next/standalone/.next/server/app/api/projects/[uuid]/access-preview/route_client-reference-manifest.js +1 -1
  123. package/.next/standalone/.next/server/app/api/projects/[uuid]/activity/route_client-reference-manifest.js +1 -1
  124. package/.next/standalone/.next/server/app/api/projects/[uuid]/agent-cwds/route_client-reference-manifest.js +1 -1
  125. package/.next/standalone/.next/server/app/api/projects/[uuid]/available/route_client-reference-manifest.js +1 -1
  126. package/.next/standalone/.next/server/app/api/projects/[uuid]/documents/route_client-reference-manifest.js +1 -1
  127. package/.next/standalone/.next/server/app/api/projects/[uuid]/group/preview/route_client-reference-manifest.js +1 -1
  128. package/.next/standalone/.next/server/app/api/projects/[uuid]/group/route_client-reference-manifest.js +1 -1
  129. package/.next/standalone/.next/server/app/api/projects/[uuid]/ideas/route_client-reference-manifest.js +1 -1
  130. package/.next/standalone/.next/server/app/api/projects/[uuid]/ideas/tracker/route_client-reference-manifest.js +1 -1
  131. package/.next/standalone/.next/server/app/api/projects/[uuid]/members/[userUuid]/route_client-reference-manifest.js +1 -1
  132. package/.next/standalone/.next/server/app/api/projects/[uuid]/members/route_client-reference-manifest.js +1 -1
  133. package/.next/standalone/.next/server/app/api/projects/[uuid]/proposals/[proposalUuid]/validate/route_client-reference-manifest.js +1 -1
  134. package/.next/standalone/.next/server/app/api/projects/[uuid]/proposals/route_client-reference-manifest.js +1 -1
  135. package/.next/standalone/.next/server/app/api/projects/[uuid]/proposals/summary/route_client-reference-manifest.js +1 -1
  136. package/.next/standalone/.next/server/app/api/projects/[uuid]/resource-graph/route_client-reference-manifest.js +1 -1
  137. package/.next/standalone/.next/server/app/api/projects/[uuid]/route_client-reference-manifest.js +1 -1
  138. package/.next/standalone/.next/server/app/api/projects/[uuid]/stats/route_client-reference-manifest.js +1 -1
  139. package/.next/standalone/.next/server/app/api/projects/[uuid]/tasks/dependencies/route_client-reference-manifest.js +1 -1
  140. package/.next/standalone/.next/server/app/api/projects/[uuid]/tasks/route_client-reference-manifest.js +1 -1
  141. package/.next/standalone/.next/server/app/api/projects/agent-cwd-options/route_client-reference-manifest.js +1 -1
  142. package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  143. package/.next/standalone/.next/server/app/api/proposals/[uuid]/approve/route_client-reference-manifest.js +1 -1
  144. package/.next/standalone/.next/server/app/api/proposals/[uuid]/close/route_client-reference-manifest.js +1 -1
  145. package/.next/standalone/.next/server/app/api/proposals/[uuid]/reject/route_client-reference-manifest.js +1 -1
  146. package/.next/standalone/.next/server/app/api/proposals/[uuid]/revoke/route_client-reference-manifest.js +1 -1
  147. package/.next/standalone/.next/server/app/api/proposals/[uuid]/route_client-reference-manifest.js +1 -1
  148. package/.next/standalone/.next/server/app/api/references/[uuid]/route_client-reference-manifest.js +1 -1
  149. package/.next/standalone/.next/server/app/api/references/route_client-reference-manifest.js +1 -1
  150. package/.next/standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  151. package/.next/standalone/.next/server/app/api/session/route_client-reference-manifest.js +1 -1
  152. package/.next/standalone/.next/server/app/api/sessions/[uuid]/route_client-reference-manifest.js +1 -1
  153. package/.next/standalone/.next/server/app/api/tasks/[uuid]/claim/route_client-reference-manifest.js +1 -1
  154. package/.next/standalone/.next/server/app/api/tasks/[uuid]/dependencies/[dependsOnUuid]/route_client-reference-manifest.js +1 -1
  155. package/.next/standalone/.next/server/app/api/tasks/[uuid]/dependencies/route_client-reference-manifest.js +1 -1
  156. package/.next/standalone/.next/server/app/api/tasks/[uuid]/release/route_client-reference-manifest.js +1 -1
  157. package/.next/standalone/.next/server/app/api/tasks/[uuid]/route_client-reference-manifest.js +1 -1
  158. package/.next/standalone/.next/server/app/api/tasks/[uuid]/sessions/route_client-reference-manifest.js +1 -1
  159. package/.next/standalone/.next/server/app/index.html +2 -2
  160. package/.next/standalone/.next/server/app/index.rsc +1 -1
  161. package/.next/standalone/.next/server/app/login/admin/page_client-reference-manifest.js +1 -1
  162. package/.next/standalone/.next/server/app/login/admin.html +2 -2
  163. package/.next/standalone/.next/server/app/login/admin.rsc +1 -1
  164. package/.next/standalone/.next/server/app/login/callback/page_client-reference-manifest.js +1 -1
  165. package/.next/standalone/.next/server/app/login/callback.html +2 -2
  166. package/.next/standalone/.next/server/app/login/callback.rsc +1 -1
  167. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  168. package/.next/standalone/.next/server/app/login/pick-workspace/page_client-reference-manifest.js +1 -1
  169. package/.next/standalone/.next/server/app/login/pick-workspace.html +2 -2
  170. package/.next/standalone/.next/server/app/login/pick-workspace.rsc +1 -1
  171. package/.next/standalone/.next/server/app/login.html +2 -2
  172. package/.next/standalone/.next/server/app/login.rsc +1 -1
  173. package/.next/standalone/.next/server/app/onboarding/page.js +2 -2
  174. package/.next/standalone/.next/server/app/onboarding/page.js.nft.json +1 -1
  175. package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  176. package/.next/standalone/.next/server/app/onboarding.html +2 -2
  177. package/.next/standalone/.next/server/app/onboarding.rsc +2 -2
  178. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  179. package/.next/standalone/.next/server/app/projects.html +2 -2
  180. package/.next/standalone/.next/server/app/projects.rsc +2 -2
  181. package/.next/standalone/.next/server/app/settings.html +2 -2
  182. package/.next/standalone/.next/server/app/settings.rsc +3 -3
  183. package/.next/standalone/.next/server/app-paths-manifest.json +38 -38
  184. package/.next/standalone/.next/server/chunks/1855.js +2 -2
  185. package/.next/standalone/.next/server/chunks/2689.js +2 -2
  186. package/.next/standalone/.next/server/chunks/5212.js +1 -1
  187. package/.next/standalone/.next/server/chunks/5281.js +2 -2
  188. package/.next/standalone/.next/server/chunks/5647.js +1 -1
  189. package/.next/standalone/.next/server/chunks/5764.js +2 -2
  190. package/.next/standalone/.next/server/chunks/6493.js +1 -1
  191. package/.next/standalone/.next/server/chunks/6991.js +2 -2
  192. package/.next/standalone/.next/server/chunks/{9894.js → 7138.js} +1 -1
  193. package/.next/standalone/.next/server/chunks/{9583.js → 7169.js} +3 -3
  194. package/.next/standalone/.next/server/chunks/7425.js +1 -0
  195. package/.next/standalone/.next/server/chunks/7839.js +1 -1
  196. package/.next/standalone/.next/server/chunks/8692.js +1 -0
  197. package/.next/standalone/.next/server/chunks/87.js +1 -0
  198. package/.next/standalone/.next/server/chunks/8849.js +2 -2
  199. package/.next/standalone/.next/server/chunks/911.js +1 -0
  200. package/.next/standalone/.next/server/chunks/9295.js +1 -1
  201. package/.next/standalone/.next/server/middleware-manifest.json +5 -5
  202. package/.next/standalone/.next/server/pages/404.html +2 -2
  203. package/.next/standalone/.next/server/pages/500.html +1 -1
  204. package/.next/standalone/.next/server/pages-manifest.json +1 -1
  205. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  206. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  207. package/.next/standalone/.next/static/chunks/15638-e8566f8551988a0b.js +1 -0
  208. package/.next/standalone/.next/static/chunks/30187-8406d0b0e7582b4e.js +1 -0
  209. package/.next/standalone/.next/static/chunks/59480-03e05915e0f0f1e4.js +1 -0
  210. package/.next/standalone/.next/static/chunks/65833-d0a8d9023febc1ce.js +1 -0
  211. package/.next/standalone/.next/static/chunks/75844-ab7e24827a4875a0.js +1 -0
  212. package/.next/standalone/.next/static/chunks/88277-9563bd5857edfb08.js +1 -0
  213. package/.next/standalone/.next/static/chunks/91202-a6809360a6c58c9a.js +1 -0
  214. package/.next/standalone/.next/static/chunks/app/(dashboard)/layout-9a0a7266bbc1498f.js +1 -0
  215. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/dashboard/{page-670eeb1a8007a20c.js → page-26aef423473209b6.js} +1 -1
  216. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/documents/[documentUuid]/page-deb0615a19598fe6.js +1 -0
  217. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/documents/page-cb20e73952b1d4ee.js +1 -0
  218. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/graph/{page-ed5fbcae30e875d1.js → page-c8af650e39ff3eac.js} +1 -1
  219. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page-6bc33e1fb5e252dc.js +1 -0
  220. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/new/page-e622257cf6a2fe0c.js +1 -0
  221. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/{page-49b02e795c5b279c.js → page-2085f55b6cbd4d82.js} +1 -1
  222. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/tasks/[taskUuid]/{page-f26cad3e8406ac07.js → page-2b9e6239037f79d5.js} +1 -1
  223. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/tasks/{page-04a3fbabc7542960.js → page-7afc11846cb7aefc.js} +1 -1
  224. package/.next/standalone/.next/static/chunks/app/(dashboard)/settings/{page-d0c217c1e9a18433.js → page-406dbd7ae784ec2b.js} +1 -1
  225. package/.next/standalone/.next/static/chunks/app/onboarding/page-bb641e258e90d08b.js +1 -0
  226. package/.next/standalone/package.json +1 -1
  227. package/.next/standalone/public/chorus-plugin/.claude-plugin/plugin.json +1 -1
  228. package/.next/standalone/public/chorus-plugin/bin/chorus-api.sh +1 -1
  229. package/.next/standalone/public/chorus-plugin/skills/brainstorm/SKILL.md +1 -1
  230. package/.next/standalone/public/chorus-plugin/skills/chorus/SKILL.md +1 -1
  231. package/.next/standalone/public/chorus-plugin/skills/chorus-cli/SKILL.md +1 -1
  232. package/.next/standalone/public/chorus-plugin/skills/develop/SKILL.md +1 -1
  233. package/.next/standalone/public/chorus-plugin/skills/docs/SKILL.md +1 -1
  234. package/.next/standalone/public/chorus-plugin/skills/idea/SKILL.md +1 -1
  235. package/.next/standalone/public/chorus-plugin/skills/openspec-aware/SKILL.md +1 -1
  236. package/.next/standalone/public/chorus-plugin/skills/orchestrate/SKILL.md +1 -1
  237. package/.next/standalone/public/chorus-plugin/skills/proposal/SKILL.md +1 -1
  238. package/.next/standalone/public/chorus-plugin/skills/quick-dev/SKILL.md +1 -1
  239. package/.next/standalone/public/chorus-plugin/skills/research/SKILL.md +1 -1
  240. package/.next/standalone/public/chorus-plugin/skills/review/SKILL.md +1 -1
  241. package/.next/standalone/public/chorus-plugin/skills/spec-lite/SKILL.md +1 -1
  242. package/.next/standalone/public/chorus-plugin/skills/yolo/SKILL.md +1 -1
  243. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-brainstorm/SKILL.md +1 -1
  244. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-cli/SKILL.md +1 -1
  245. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-develop/SKILL.md +1 -1
  246. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-docs/SKILL.md +1 -1
  247. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-idea/SKILL.md +1 -1
  248. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-openspec-aware/SKILL.md +1 -1
  249. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-orchestrate/SKILL.md +1 -1
  250. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-proposal/SKILL.md +1 -1
  251. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-quick-dev/SKILL.md +1 -1
  252. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-research/SKILL.md +1 -1
  253. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-review/SKILL.md +1 -1
  254. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-spec-lite/SKILL.md +1 -1
  255. package/.next/standalone/public/kiro-plugin/.kiro/skills/chorus-yolo/SKILL.md +1 -1
  256. package/.next/standalone/public/kiro-plugin/bin/chorus-api.sh +1 -1
  257. package/README.md +1 -1
  258. package/README.zh.md +1 -1
  259. package/cli/init/contracts.mjs +3 -0
  260. package/cli/init/install-methods.mjs +24 -113
  261. package/cli/init/pi-compatibility.mjs +5 -0
  262. package/cli/init/pi-mcp-backend.mjs +160 -0
  263. package/cli/init/pi-mcp-config.mjs +48 -64
  264. package/cli/init/registry.mjs +3 -2
  265. package/cli/init/run-command.mjs +3 -1
  266. package/cli/init/steps/codex-restart.mjs +95 -0
  267. package/cli/init/steps/credential-seed.mjs +18 -17
  268. package/cli/init.mjs +2 -2
  269. package/cli/upgrade-plugins.mjs +10 -45
  270. package/package.json +1 -1
  271. package/.next/standalone/.next/server/chunks/1443.js +0 -1
  272. package/.next/standalone/.next/server/chunks/2701.js +0 -1
  273. package/.next/standalone/.next/server/chunks/6666.js +0 -1
  274. package/.next/standalone/.next/server/chunks/7329.js +0 -1
  275. package/.next/standalone/.next/static/chunks/14891-8a7485231cdaf105.js +0 -1
  276. package/.next/standalone/.next/static/chunks/30187-12e26e880f7b6da7.js +0 -1
  277. package/.next/standalone/.next/static/chunks/36244-82317cfd58345146.js +0 -1
  278. package/.next/standalone/.next/static/chunks/40309-bedb6f19876265b4.js +0 -1
  279. package/.next/standalone/.next/static/chunks/56161-5d2f255f25dba375.js +0 -1
  280. package/.next/standalone/.next/static/chunks/6497-36958930c3e35070.js +0 -1
  281. package/.next/standalone/.next/static/chunks/70762-18006a86c770d908.js +0 -1
  282. package/.next/standalone/.next/static/chunks/app/(dashboard)/layout-2f843ed9eb3944e4.js +0 -1
  283. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/documents/[documentUuid]/page-ed4d5692eac763c4.js +0 -1
  284. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/documents/page-48b79f200d9f086c.js +0 -1
  285. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/[proposalUuid]/page-91e61264f483701b.js +0 -1
  286. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[uuid]/proposals/new/page-cf90d562352224ec.js +0 -1
  287. package/.next/standalone/.next/static/chunks/app/onboarding/page-87d43a00d0a7b209.js +0 -1
  288. /package/.next/standalone/.next/static/{q_ngNQiWgbMewMxZKkQzM → -QBMDLYHMUleR_Nbp3gXV}/_buildManifest.js +0 -0
  289. /package/.next/standalone/.next/static/{q_ngNQiWgbMewMxZKkQzM → -QBMDLYHMUleR_Nbp3gXV}/_ssgManifest.js +0 -0
@@ -1,6 +1,6 @@
1
- "use strict";exports.id=2689,exports.ids=[2689],exports.modules={2559:(a,b,c)=>{c.d(b,{S:()=>h});var d=c(55153);c(70404);var e=c(43353),f=c(35139),g=c(57187);function h({className:a,...b}){return(0,d.jsx)(f.Root,{"data-slot":"checkbox",className:(0,g.cn)("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",a),...b,children:(0,d.jsx)(f.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:(0,d.jsx)(e.A,{className:"size-3.5"})})})}},10598:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(77144).A)("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]])},17356:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(77144).A)("corner-left-up",[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]])},25959:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{p:()=>n});var e=c(55153),f=c(5210),g=c(68139),h=c(79239),i=c(10196),j=c(42279),k=c(91981),l=c(78718),m=a([k]);function n({assignee:a,onReassign:b,editable:c}){let d=(0,f.c)("common"),m=!0===c&&"function"==typeof b,n=d(a?"reassign":"assign"),o=a?(0,e.jsxs)(e.Fragment,{children:[(0,l.bB)(a)?(0,e.jsx)(h.AgentAvatar,{name:a.name,size:28,className:"rounded-full"}):(0,e.jsx)(g.eu,{className:"h-7 w-7",children:(0,e.jsx)(g.q5,{className:"bg-border text-muted-foreground",children:a.name.charAt(0).toUpperCase()})}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:a.name}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:d((0,l.bB)(a)?"agent":"user")}),"agent_instance"===a.type&&a.instance&&(0,e.jsx)("div",{className:"mt-1",children:(0,e.jsx)(k.jQ,{cwd:a.instance.cwd,host:a.instance.host})})]})]}):(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:d("unassigned")}),p="mt-2 flex items-center gap-2.5 rounded-lg bg-background p-3";return(0,e.jsxs)("div",{children:[(0,e.jsx)(i.J,{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:d("assignee")}),m?(0,e.jsx)(j.Bc,{delayDuration:300,children:(0,e.jsxs)(j.m_,{children:[(0,e.jsx)(j.k$,{asChild:!0,children:(0,e.jsx)("button",{type:"button",onClick:b,"aria-label":n,className:`${p} w-full cursor-pointer text-left`,children:o})}),(0,e.jsx)(j.ZI,{children:n})]})}):(0,e.jsx)("div",{className:p,children:o})]})}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},30850:(a,b,c)=>{c.d(b,{Q:()=>e});var d=c(8845);let e=(0,d.createServerReference)("40759544812c7977b84b12ad0677eb3b19604e4ca8",d.callServer,void 0,d.findSourceMapURL,"getTaskAction")},31280:(a,b,c)=>{c.d(b,{d:()=>t});var d=c(55153),e=c(70404),f=c(5210),g=c(80804),h=c(6170),i=c(35603);let j=(0,c(77144).A)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var k=c(6401),l=c(39976),m=c(43840),n=c(8009),o=c(57187),p=c(8845);let q=(0,p.createServerReference)("40c065f13e2788512e8d7141512ea0bcdd460c03fe",p.callServer,void 0,p.findSourceMapURL,"getProjectIdeasForPickerAction"),r=(0,p.createServerReference)("60f59b614b1d69ec3e2bff105f3b184b3a0c4bdf5b",p.callServer,void 0,p.findSourceMapURL,"setIdeaParentAction");var s=c(6994);function t({open:a,onOpenChange:b,ideaUuid:c,ideaTitle:p,projectUuid:t,currentParentUuid:u,descendantUuids:v,onChanged:w,onCloseAutoFocus:x}){let y=(0,f.c)("ideaTracker.lineage"),z=(0,f.c)("common"),A=(0,g.r)(),[B,C]=(0,e.useState)([]),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(null),L=new Set([c,...v]);(0,e.useCallback)(async()=>{G(!0),K(null);try{let a=await q(t);a.success?(C(a.data),E(a.hasMore)):K(a.error)}catch(a){s.q.error("Failed to load parent candidates:",a),K(y("saveFailed"))}G(!1)},[t,y]);let M=async a=>{if(!H){I(!0),K(null);try{let d=await r(c,a);d.success?(h.oR.success(a?y("save"):y("detach")),b(!1),A.refresh(),w()):K(d.error||y("saveFailed"))}catch(a){K(a instanceof Error?a.message:y("saveFailed"))}I(!1)}};return(0,d.jsx)(m.lG,{open:a,onOpenChange:b,children:(0,d.jsxs)(m.Cf,{onCloseAutoFocus:x,children:[(0,d.jsxs)(m.c7,{children:[(0,d.jsx)(m.L3,{children:y("setParentTitle")}),(0,d.jsx)(m.rr,{children:y("setParentDescription",{title:p})})]}),(0,d.jsxs)("div",{className:"min-w-0 space-y-3 pt-1",children:[F?(0,d.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,d.jsx)(i.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(0,d.jsx)("div",{className:"rounded-md border border-border",children:(0,d.jsxs)(n.uB,{children:[(0,d.jsx)(n.G7,{placeholder:y("searchPlaceholder")}),(0,d.jsxs)(n.oI,{children:[(0,d.jsx)(n.xL,{children:y("noCandidates")}),(0,d.jsx)(n.L$,{children:B.map(a=>{let b=L.has(a.uuid),c=a.uuid===u;return(0,d.jsxs)(n.h_,{value:a.title,disabled:b,onSelect:()=>{b||M(a.uuid)},className:(0,o.cn)("flex min-w-0 items-center justify-between gap-2",b&&"opacity-55",c&&"bg-primary/10"),children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-foreground",children:a.title}),b&&(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[11px] font-medium text-[#B0654A] dark:text-[#EBA890]",children:[(0,d.jsx)(j,{className:"h-3 w-3"}),y("cycleBlocked")]})]},a.uuid)})})]})]})}),(0,d.jsxs)("div",{className:"flex items-start gap-2 rounded-md bg-[#FBF0EB] dark:bg-[#221e1b] px-3 py-2.5",children:[(0,d.jsx)(k.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[#B0654A] dark:text-[#EBA890]"}),(0,d.jsx)("p",{className:"text-[12px] leading-relaxed text-[#9A5238] dark:text-[#E9A088]",children:y("cycleWarning")})]}),D&&(0,d.jsx)("p",{className:"px-1 text-[12px] text-muted-foreground",role:"status",children:y("pickerTruncated")}),J&&(0,d.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:J})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 pt-2",children:[u?(0,d.jsx)(l.$,{variant:"outline",className:"border-border",onClick:()=>M(null),disabled:H,children:y("detach")}):(0,d.jsx)("span",{}),(0,d.jsx)(l.$,{variant:"outline",className:"border-border",onClick:()=>b(!1),disabled:H,children:z("cancel")})]})]})})}},32540:(a,b,c)=>{c.d(b,{U:()=>l});var d=c(55153),e=c(70404),f=c(5210),g=c(79239),h=c(39976),i=c(33585),j=c(57187);function k(a){return a.agentName??a.agentUuid}function l({sessions:a,onSelect:b,surface:c,className:l}){let m=(0,f.c)("activeSessions"),[n,o]=(0,e.useState)(!1),p=(0,e.useRef)(null);if(0===a.length)return null;let q=a.some(a=>a.canOpen),r=1===a.length&&a[0].canOpen,s=a[0],t=()=>{null!==p.current&&(clearTimeout(p.current),p.current=null)},u=()=>{t(),p.current=setTimeout(()=>o(!1),120)},v=a=>{a.canOpen&&(o(!1),b(a))},w=(0,d.jsxs)(h.$,{type:"button",variant:"outline",size:"tracker"===c?"xs":"icon-sm","data-testid":`${c}-active-session-indicator`,"aria-label":m(q?"indicatorLabel":"statusOnlyIndicatorLabel",{count:a.length}),"aria-disabled":!q,"aria-haspopup":a.length>1?"dialog":void 0,onPointerDown:a=>a.stopPropagation(),onPointerEnter:r?void 0:a=>{"touch"!==a.pointerType&&(t(),o(!0))},onPointerLeave:r?void 0:a=>{"touch"!==a.pointerType&&u()},onFocus:r?void 0:()=>o(!0),onClick:a=>{if(a.stopPropagation(),t(),r)return void v(s);n&&a.preventDefault()},onKeyDown:a=>a.stopPropagation(),className:(0,j.cn)("group/active relative gap-1.5 overflow-visible border-emerald-500/35 bg-emerald-500/10 font-semibold text-emerald-700 shadow-none transition-[background-color,border-color,box-shadow] hover:border-emerald-500/60 hover:bg-emerald-500/15 hover:text-emerald-700 hover:shadow-[0_3px_10px_-5px_rgba(16,185,129,0.8)] focus-visible:border-emerald-500 focus-visible:ring-emerald-500/50 dark:border-emerald-500/35 dark:bg-emerald-500/10 dark:text-emerald-300 dark:hover:border-emerald-500/60 dark:hover:bg-emerald-500/15 dark:hover:text-emerald-300","tracker"===c?"h-7 min-w-7 px-1 text-[11px]":"sidebar"===c?"h-8 min-w-8 px-1 text-[11px]":"h-9 min-w-9 px-1 text-[11px] shadow-sm",l),children:[(0,d.jsxs)("span",{className:"relative shrink-0","aria-hidden":!0,children:[(0,d.jsx)(g.AgentAvatar,{name:k(s),size:"graph"===c?22:20,className:"rounded-full ring-1 ring-emerald-600/25"}),(0,d.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 size-2 rounded-full border-2 border-card bg-emerald-500"}),(0,d.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 size-2 rounded-full bg-emerald-400/75 motion-safe:animate-ping motion-reduce:animate-none"})]}),a.length>1&&(0,d.jsx)("span",{children:a.length})]});return r?w:(0,d.jsxs)(i.AM,{open:n,onOpenChange:o,children:[(0,d.jsx)(i.Wv,{asChild:!0,children:w}),(0,d.jsxs)(i.hl,{align:"start",sideOffset:6,onCloseAutoFocus:a=>a.preventDefault(),onPointerDown:a=>a.stopPropagation(),onPointerEnter:t,onPointerLeave:u,onClick:a=>a.stopPropagation(),className:"w-[min(22rem,calc(100vw-2rem))] p-1.5","aria-label":m("chooserLabel"),children:[(0,d.jsx)("p",{className:"px-2 pb-1.5 pt-1 text-xs font-medium text-muted-foreground",children:m("runningCount",{count:a.length})}),(0,d.jsx)("div",{className:"max-h-64 overflow-y-auto",children:a.map(a=>(0,d.jsxs)(h.$,{type:"button",variant:"ghost",disabled:!a.canOpen,"aria-label":a.canOpen?k(a):m("statusOnlyEntry",{agent:k(a)}),onClick:()=>v(a),className:"group/session h-auto w-full min-w-0 items-start justify-start gap-2.5 whitespace-normal px-2 py-2 text-left disabled:cursor-not-allowed disabled:opacity-65",children:[(0,d.jsxs)("span",{className:"relative mt-0.5 shrink-0","aria-hidden":!0,children:[(0,d.jsx)(g.AgentAvatar,{name:k(a),size:30,className:"rounded-lg ring-1 ring-border transition-shadow group-hover/session:ring-emerald-500/45"}),(0,d.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 size-2.5 rounded-full border-2 border-card bg-emerald-500"})]}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block truncate text-xs font-medium text-foreground",children:k(a)}),(0,d.jsx)("span",{className:"block truncate text-[11px] text-muted-foreground",children:a.connectionAvailable?m("location",{host:a.host??m("unknownHost"),cwd:a.cwd??m("unknownCwd")}):m("agentFallback")}),!a.canOpen&&(0,d.jsx)("span",{className:"block text-[11px] font-medium text-muted-foreground",children:m("statusOnly")})]})]},a.sessionUuid))})]})]})}},35139:(a,b,c)=>{c.r(b),c.d(b,{Checkbox:()=>v,CheckboxIndicator:()=>x,Indicator:()=>x,Root:()=>v,createCheckboxScope:()=>p,unstable_BubbleInput:()=>z,unstable_CheckboxBubbleInput:()=>z,unstable_CheckboxProvider:()=>s,unstable_CheckboxTrigger:()=>u,unstable_Provider:()=>s,unstable_Trigger:()=>u});var d=c(70404),e=c(39383),f=c(51861),g=c(84586),h=c(83722),i=c(18750),j=c(37022),k=c(36443),l=c(69640),m=c(55153),n="Checkbox",[o,p]=(0,f.A)(n),[q,r]=o(n);function s(a){let{__scopeCheckbox:b,checked:c,children:e,defaultChecked:f,disabled:g,form:i,name:j,onCheckedChange:k,required:l,value:o="on",internal_do_not_use_render:p}=a,[r,s]=(0,h.i)({prop:c,defaultProp:f??!1,onChange:k,caller:n}),[t,u]=d.useState(null),[v,w]=d.useState(null),x=d.useRef(!1),y=!t||!!i||!!t.closest("form"),z={checked:r,disabled:g,setChecked:s,control:t,setControl:u,name:j,form:i,value:o,hasConsumerStoppedPropagationRef:x,required:l,defaultChecked:!A(f)&&f,isFormControl:y,bubbleInput:v,setBubbleInput:w};return(0,m.jsx)(q,{scope:b,...z,children:"function"==typeof p?p(z):e})}var t="CheckboxTrigger",u=d.forwardRef(({__scopeCheckbox:a,onKeyDown:b,onClick:c,...f},h)=>{let{control:i,value:j,disabled:k,checked:n,required:o,setControl:p,setChecked:q,hasConsumerStoppedPropagationRef:s,isFormControl:u,bubbleInput:v}=r(t,a),w=(0,e.s)(h,p),x=d.useRef(n);return d.useEffect(()=>{let a=i?.form;if(a){let b=()=>q(x.current);return a.addEventListener("reset",b),()=>a.removeEventListener("reset",b)}},[i,q]),(0,m.jsx)(l.sG.button,{type:"button",role:"checkbox","aria-checked":A(n)?"mixed":n,"aria-required":o,"data-state":B(n),"data-disabled":k?"":void 0,disabled:k,value:j,...f,ref:w,onKeyDown:(0,g.mK)(b,a=>{"Enter"===a.key&&a.preventDefault()}),onClick:(0,g.mK)(c,a=>{q(a=>!!A(a)||!a),v&&u&&(s.current=a.isPropagationStopped(),s.current||a.stopPropagation())})})});u.displayName=t;var v=d.forwardRef((a,b)=>{let{__scopeCheckbox:c,name:d,checked:e,defaultChecked:f,required:g,disabled:h,value:i,onCheckedChange:j,form:k,...l}=a;return(0,m.jsx)(s,{__scopeCheckbox:c,checked:e,defaultChecked:f,disabled:h,required:g,onCheckedChange:j,name:d,form:k,value:i,internal_do_not_use_render:({isFormControl:a})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u,{...l,ref:b,__scopeCheckbox:c}),a&&(0,m.jsx)(z,{__scopeCheckbox:c})]})})});v.displayName=n;var w="CheckboxIndicator",x=d.forwardRef((a,b)=>{let{__scopeCheckbox:c,forceMount:d,...e}=a,f=r(w,c);return(0,m.jsx)(k.C,{present:d||A(f.checked)||!0===f.checked,children:(0,m.jsx)(l.sG.span,{"data-state":B(f.checked),"data-disabled":f.disabled?"":void 0,...e,ref:b,style:{pointerEvents:"none",...a.style}})})});x.displayName=w;var y="CheckboxBubbleInput",z=d.forwardRef(({__scopeCheckbox:a,...b},c)=>{let{control:f,hasConsumerStoppedPropagationRef:g,checked:h,defaultChecked:k,required:n,disabled:o,name:p,value:q,form:s,bubbleInput:t,setBubbleInput:u}=r(y,a),v=(0,e.s)(c,u),w=(0,i.Z)(h),x=(0,j.X)(f);d.useEffect(()=>{if(!t)return;let a=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,b=!g.current;if(w!==h&&a){let c=new Event("click",{bubbles:b});t.indeterminate=A(h),a.call(t,!A(h)&&h),t.dispatchEvent(c)}},[t,w,h,g]);let z=d.useRef(!A(h)&&h);return(0,m.jsx)(l.sG.input,{type:"checkbox","aria-hidden":!0,defaultChecked:k??z.current,required:n,disabled:o,name:p,value:q,form:s,...b,tabIndex:-1,ref:v,style:{...b.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function A(a){return"indeterminate"===a}function B(a){return A(a)?"indeterminate":a?"checked":"unchecked"}z.displayName=y},38662:(a,b,c)=>{c.d(b,{C:()=>f});var d=c(55153),e=c(57187);function f({done:a,total:b,size:c=14,stroke:f=2,className:g,color:h="#B26B3D",trackColor:i="#EAD9C8"}){let j=(c-f)/2,k=2*Math.PI*j,l=b>0?Math.min(1,Math.max(0,a/b)):0;return(0,d.jsxs)("svg",{width:c,height:c,viewBox:`0 0 ${c} ${c}`,className:(0,e.cn)("shrink-0",g),role:"img","aria-label":`${a}/${b}`,children:[(0,d.jsx)("circle",{cx:c/2,cy:c/2,r:j,fill:"none",stroke:i,strokeWidth:f}),l>0&&(0,d.jsx)("circle",{cx:c/2,cy:c/2,r:j,fill:"none",stroke:b>0&&a>=b?"#1D9E75":h,strokeWidth:f,strokeDasharray:k,strokeDashoffset:k*(1-l),strokeLinecap:"round",transform:`rotate(-90 ${c/2} ${c/2})`})]})}},42236:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{x:()=>k});var e=c(55153),f=c(70404),g=c(5210),h=c(86787),i=c(18028),j=a([i]);function k({ideaUuid:a,currentUserUuid:b,commentCount:c,onCommentCountChange:d}){let j=(0,g.c)("ideaTracker"),[k,l]=(0,f.useState)("comments");return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex gap-1 rounded-lg bg-secondary p-0.5",children:[(0,e.jsxs)("button",{onClick:()=>l("comments"),className:`flex-1 rounded-md px-3 py-1.5 text-[13px] font-medium transition-colors flex items-center justify-center gap-1.5 cursor-pointer ${"comments"===k?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-muted-foreground"}`,children:[j("panel.activityTab.comments"),c>0&&(0,e.jsx)("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-secondary text-muted-foreground text-[10px] font-semibold leading-none",children:c})]}),(0,e.jsx)("button",{onClick:()=>l("activity"),className:`flex-1 rounded-md px-3 py-1.5 text-[13px] font-medium transition-colors cursor-pointer ${"activity"===k?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-muted-foreground"}`,children:j("panel.activityTab.activity")})]}),(0,e.jsx)("div",{children:"activity"===k?(0,e.jsx)(h.v,{ideaUuid:a}):(0,e.jsx)(i.$m,{targetType:"idea",targetUuid:a,currentUserUuid:b,onCountChange:d,compact:!0})})]})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},43725:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{N:()=>o,d:()=>n});var e=c(82009);c(36005);var f=c(65751),g=c(63319),h=c(22426),i=c(95078),j=c(4371),k=c(43756),l=c(62237),m=a([f,h,i,j,k]);async function n(a){let b=await (0,f.d)();if(!b||!["user","super_admin"].includes(b.type))return{eligible:!1,reason:"unauthorized"};let c=await (0,k.oJ)(b,"idea",a,"editor");return c?c.error.endsWith("not found")?{eligible:!1,reason:"idea_not_found"}:{eligible:!1,reason:"unauthorized"}:(0,h.Rf)(b.companyUuid,a)}async function o(a,b,c){let d=await (0,f.d)();if(!d||!["user","super_admin"].includes(d.type))return{success:!1,errorCode:"unauthorized"};let e=await (0,k.oJ)(d,"idea",a,"editor");if(e)return{success:!1,errorCode:e.error.endsWith("not found")?"idea_not_found":"permission_denied"};try{let e=b?await (0,j.e2)({companyUuid:d.companyUuid,userUuid:d.actorUuid,...b}):null,f=await (0,i.Di)({companyUuid:d.companyUuid,actorUuid:d.actorUuid,actorType:d.type,ideaUuid:a,temporaryCwd:e,...b?{temporaryAgentUuid:b.agentUuid}:{},...c?{selection:c}:{}});return{success:!0,...f}}catch(b){if(b instanceof i.CZ)return{success:!1,errorCode:b.code};return g.default.error({err:b,ideaUuid:a},"Research dispatch failed"),{success:!1,errorCode:"unknown"}}}[f,h,i,j,k]=m.then?(await m)():m,(0,l.D)([n,o]),(0,e.A)(n,"4086e75f0a570191f6aa43d2e6d2ae1eb3625fee82",null),(0,e.A)(o,"7066101d4a51f8c0a7b92b053e4fbcbb1657c06f44",null),d()}catch(a){d(a)}})},48007:(a,b,c)=>{c.d(b,{c:()=>e});var d=c(8845);let e=(0,d.createServerReference)("4036f9aca9363fd7a0f11c8b3697324dfe256815bc",d.callServer,void 0,d.findSourceMapURL,"getIdeaAction")},48354:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{G:()=>q});var e=c(55153),f=c(5210),g=c(35603),h=c(77012),i=c(10196),j=c(7907),k=c(92548),l=c(74586),m=c(3505),n=c(63468),o=c(25959),p=a([l,o]);function q({idea:a,elaboration:b,isLoading:c,onRefresh:d,onReassign:p,canReassign:q}){let r=(0,f.c)("ideaTracker"),s=(0,f.c)("common");return c?(0,e.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,e.jsx)(g.A,{className:"h-5 w-5 animate-spin text-primary"})}):(0,e.jsxs)(m.P.div,{variants:n.qG,initial:"initial",animate:"animate",children:[(0,e.jsx)(o.p,{assignee:a.assignee,onReassign:p,editable:q}),(0,e.jsx)(j.Separator,{className:"my-5 bg-secondary"}),b&&b.rounds.length>0?(0,e.jsx)("div",{children:(0,e.jsx)(k.R,{ideaUuid:a.uuid,elaboration:b,onRefresh:d})}):"open"===a.status?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-8 text-center",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#FFF3E0] dark:bg-[#3a2a12]",children:(0,e.jsx)(h.A,{className:"h-5 w-5 text-[#E65100] dark:text-[#F0A050]"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:r("panel.elaborationNotStarted")}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:r("panel.elaborationNotStartedDesc")})]})]}):(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-8 text-center",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#E3F2FD] dark:bg-[#13253a]",children:(0,e.jsx)(h.A,{className:"h-5 w-5 text-[#1976D2] dark:text-[#5AA9F0]"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:r("panel.elaborationWaiting")}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:r("panel.elaborationWaitingDesc")})]})]}),a.content&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(j.Separator,{className:"my-5 bg-secondary"}),(0,e.jsxs)("div",{children:[(0,e.jsx)(i.J,{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("content")}),(0,e.jsx)("div",{className:"mt-2",children:(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[13px] leading-relaxed text-foreground",children:(0,e.jsx)(l.MarkdownContent,{children:a.content})})})]})]})]})}[l,o]=p.then?(await p)():p,d()}catch(a){d(a)}})},48756:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(77144).A)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]])},56164:(a,b,c)=>{c.d(b,{b:()=>j});var d=c(70404),e=c(69640),f=c(55153),g="horizontal",h=["horizontal","vertical"],i=d.forwardRef((a,b)=>{var c;let{decorative:d,orientation:i=g,...j}=a,k=(c=i,h.includes(c))?i:g;return(0,f.jsx)(e.sG.div,{"data-orientation":k,...d?{role:"none"}:{"aria-orientation":"vertical"===k?k:void 0,role:"separator"},...j,ref:b})});i.displayName="Separator";var j=i},57922:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{k:()=>A});var e=c(55153),f=c(70404),g=c(5210),h=c(82204),i=c.n(h),j=c(35603),k=c(48756),l=c(90025),m=c(62346),n=c(80123),o=c(81975),p=c(36015),q=c(39976),r=c(11383),s=c(47626),t=c(89084),u=c(74586),v=c(56793),w=c(63519),x=c(99705);c(95055);var y=c(6994),z=a([u]);function A({idea:a,projectUuid:b,onTaskClick:c,onDocClick:d,initialProposals:h}){let i=(0,g.c)("ideaTracker"),[l,m]=(0,f.useState)(h??[]),[n,o]=(0,f.useState)(!h),p=(0,f.useCallback)(async()=>{try{let c=await (0,x.U)(b,a.uuid);if(c.success)return m(c.data),c.data}catch(a){y.q.error("Failed to fetch proposals:",a)}finally{o(!1)}return[]},[b,a.uuid]),q=(0,f.useRef)(l);q.current=l;let{getPresence:r}=(0,s.xQ)();return((0,t.eV)("proposal",async()=>{let a=q.current;for(let b of(await p())){let c=a.find(a=>a.uuid===b.uuid);if(!c)continue;let d=new Set((c.documentDrafts??[]).map(a=>a.uuid)),e=new Set((c.taskDrafts??[]).map(a=>a.uuid)),f=(b.documentDrafts??[]).filter(a=>a.uuid&&!d.has(a.uuid)),g=(b.taskDrafts??[]).filter(a=>a.uuid&&!e.has(a.uuid)),h=[...f.map(a=>a.uuid),...g.map(a=>a.uuid)];if(h.length>0){let a=r("proposal",b.uuid)[0];if(a)for(let c of h)(0,s.fv)({entityType:"proposal",entityUuid:b.uuid,subEntityType:"draft",subEntityUuid:c,agentUuid:a.agentUuid,agentName:a.agentName,action:"mutate"})}}}),n)?(0,e.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,e.jsx)(j.A,{className:"h-5 w-5 animate-spin text-primary"})}):0===l.length?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#F3E5F5] dark:bg-[#281630]",children:(0,e.jsx)(k.A,{className:"h-5 w-5 text-[#7B1FA2] dark:text-[#C98FE0]"})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:i("panel.noProposals")})]}):(0,e.jsx)("div",{className:"space-y-5",children:l.map(a=>(0,e.jsx)(B,{proposal:a,projectUuid:b,onTaskClick:c,onDocClick:d},a.uuid))})}u=(z.then?(await z)():z)[0];let D={draft:"bg-[#F5F5F5] dark:bg-[#1e1e20] text-muted-foreground",pending:"bg-[#FFF3E0] dark:bg-[#3a2a12] text-[#E65100] dark:text-[#F0A050]",approved:"bg-[#E8F5E9] dark:bg-[#14281a] text-[#5A9E6F] dark:text-[#6FD19A]",rejected:"bg-[#FFEBEE] dark:bg-[#331619] text-[#C4574C] dark:text-[#F0897E]",revised:"bg-[#E3F2FD] dark:bg-[#13253a] text-[#1976D2] dark:text-[#5AA9F0]",closed:"bg-[#F5F5F5] dark:bg-[#1e1e20] text-muted-foreground"};function B({proposal:a,projectUuid:b,onTaskClick:c,onDocClick:d}){let h=(0,g.c)("ideaTracker"),j=(0,g.c)(),k=(0,g.c)("proposals"),n=(0,g.c)("tasks"),o=(0,g.c)("documents"),s=a.documentDrafts||[],t=a.taskDrafts||[],[x,y]=(0,f.useState)(new Set),[z,A]=(0,f.useState)("cards"),[B,E]=(0,f.useState)([]),F="approved"===a.status,G=(0,f.useMemo)(()=>{let a=new Map;for(let b of B)a.set(b.title,b);return a},[B]),{dagTasks:H,dagEdges:I,dagHeight:J}=(0,f.useMemo)(()=>{let a=t.map(a=>{let b=G.get(a.title);return{uuid:b?.uuid||a.uuid,title:a.title,status:b?.status||"open",priority:a.priority||"medium"}}),b=[],c=new Map(t.map(a=>[a.uuid,a]));for(let a of t)if(a.dependsOnDraftUuids)for(let d of a.dependsOnDraftUuids){let e=G.get(a.title),f=c.get(d),g=f?G.get(f.title):void 0;b.push({from:e?.uuid||a.uuid,to:g?.uuid||d})}return{dagTasks:a,dagEdges:b,dagHeight:Math.max(350,90*a.length)}},[t,G]),K=F?B.filter(a=>"done"===a.status||"closed"===a.status).length:0;return(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-[14px] font-semibold text-foreground truncate flex-1",children:a.title}),(0,e.jsx)(p.E,{className:`text-[11px] font-semibold border-0 shrink-0 ${D[a.status]||""}`,children:j(`status.${a.status}`)})]}),a.description&&(0,e.jsx)("div",{className:"max-h-[120px] overflow-y-auto text-[13px] leading-relaxed text-foreground/80 prose prose-sm max-w-none [&_h1]:text-sm [&_h2]:text-[13px] [&_h3]:text-xs [&_p]:text-[13px] [&_p]:text-foreground/80 [&_p]:my-1.5 [&_li]:text-[13px] [&_li]:text-foreground/80 [&_ul]:my-1 [&_ol]:my-1 [&_strong]:text-foreground [&_code]:bg-secondary [&_code]:text-foreground [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_a]:text-primary",children:(0,e.jsx)(u.MarkdownContent,{children:(0,w.j)(a.description)})}),(0,e.jsxs)(i(),{href:`/projects/${b}/proposals/${a.uuid}`,className:"flex items-center gap-1 text-[13px] font-medium text-primary hover:underline",children:[h("panel.viewProposal"),(0,e.jsx)(l.A,{className:"h-3.5 w-3.5"})]}),s.length>0&&(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[1px] text-muted-foreground",children:k(F?"documents":"documentDrafts")}),(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground",children:s.length})]}),(0,e.jsx)("div",{className:"space-y-0",children:s.map((b,c)=>(0,e.jsx)(r.D,{entityType:"proposal",entityUuid:a.uuid,subEntityType:"draft",subEntityUuid:b.uuid||`draft-${c}`,badgeInside:!0,children:(0,e.jsxs)(q.$,{variant:"ghost",className:"w-full justify-start h-auto text-left flex items-center gap-2.5 py-3.5 hover:bg-background transition-colors cursor-pointer -mx-1 px-1 rounded-lg",onClick:()=>b.content&&d?.({title:b.title,type:b.type,content:b.content}),children:[(0,e.jsx)(m.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)(p.E,{variant:"outline",className:"shrink-0 text-[10px] font-medium border-border text-muted-foreground bg-secondary px-2 py-0.5 font-mono",children:o(w.y[b.type]||"typeOther")}),(0,e.jsx)("span",{className:"flex-1 min-w-0 text-left text-[13px] text-foreground truncate",children:b.title})]})},b.uuid||c))})]}),(t.length>0||B.length>0)&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between pb-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[1px] text-muted-foreground",children:k(F?"tasks":"taskDrafts")}),(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground",children:F&&B.length>0?B.length:t.length})]}),(0,e.jsxs)("span",{className:"text-[12px] text-muted-foreground",children:[K,"/",F&&B.length>0?B.length:t.length]})]}),(0,e.jsx)("div",{className:"-mx-6 border-t border-border"}),I.length>0&&(0,e.jsxs)("div",{className:"flex gap-0.5 rounded-lg border border-border bg-[#F7F6F3] dark:bg-[#1e1d1b] p-0.5 mt-3 w-fit",children:[(0,e.jsx)(q.$,{variant:"ghost",size:"sm",onClick:()=>A("cards"),className:`rounded-md px-2.5 py-1 h-auto text-[11px] font-medium transition-colors ${"cards"===z?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-muted-foreground"}`,children:k("cardsView")}),(0,e.jsx)(q.$,{variant:"ghost",size:"sm",onClick:()=>A("dag"),className:`rounded-md px-2.5 py-1 h-auto text-[11px] font-medium transition-colors ${"dag"===z?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-muted-foreground"}`,children:n("dagView")})]}),"cards"===z&&(0,e.jsx)("div",{className:"space-y-0",children:F&&B.length>0?B.map(a=>(0,e.jsx)(r.D,{entityType:"task",entityUuid:a.uuid,badgeInside:!0,children:(0,e.jsx)(C,{task:{uuid:a.uuid,title:a.title},expanded:!1,onToggle:()=>{},onNavigate:c?()=>c(a.uuid):void 0,taskStatus:a.status})},a.uuid)):t.map((b,c)=>(0,e.jsx)(r.D,{entityType:"proposal",entityUuid:a.uuid,subEntityType:"draft",subEntityUuid:b.uuid,badgeInside:!0,children:(0,e.jsx)(C,{task:b,expanded:x.has(c),onToggle:()=>{y(a=>{let b=new Set(a);return b.has(c)?b.delete(c):b.add(c),b})}})},b.uuid))}),"dag"===z&&(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsx)(v._u,{tasks:H,edges:I,readonly:!0,height:J,onNodeClick:c})})]}),0===s.length&&0===t.length&&0===B.length&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground italic",children:k("emptyContainer")})]})}let E={open:"border-[#D9D9D9] dark:border-[#3a3a40] bg-card",assigned:"border-[#1976D2] bg-[#1976D2]",in_progress:"border-[#5A9E6F] bg-[#5A9E6F]",to_verify:"border-[#7B1FA2] bg-[#7B1FA2]",done:"border-[#00796B] bg-[#00796B]",closed:"border-[#9A9A9A] bg-[#9A9A9A] dark:border-[#6b6862] dark:bg-[#6b6862]"},F={open:null,assigned:null,in_progress:{className:"bg-[#E8F5E9] dark:bg-[#14281a] text-[#5A9E6F] dark:text-[#6FD19A]",key:"inProgress"},to_verify:{className:"bg-[#F3E5F5] dark:bg-[#281630] text-[#7B1FA2] dark:text-[#C98FE0]",key:"toVerify"},done:{className:"bg-[#E0F2F1] dark:bg-[#12292a] text-[#00796B] dark:text-[#4FD1C0]",key:"done"},closed:{className:"bg-[#F5F5F5] dark:bg-[#1e1e20] text-muted-foreground",key:"done"}};function C({task:a,expanded:b,onToggle:c,onNavigate:d,taskStatus:f}){let h=(0,g.c)("proposals"),i=(0,g.c)("acceptanceCriteria"),j=(0,g.c)("status"),k=a.acceptanceCriteriaItems||[],p=!!(a.description||k.length>0),r=f?E[f]||E.open:"border-[#D9D9D9] dark:border-[#3a3a40] bg-card",s=f?F[f]:null,t=(0,e.jsx)("span",{className:`shrink-0 h-2 w-2 rounded-full border-[1.5px] ${r} transition-colors`}),u=(0,e.jsx)("span",{className:"flex-1 min-w-0 text-[13px] leading-snug truncate text-muted-foreground",children:a.title}),v=s?(0,e.jsx)("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium ${s.className}`,children:j(s.key)}):null;return d?(0,e.jsxs)(q.$,{variant:"ghost",onClick:d,className:"w-full justify-start h-auto text-left flex items-center gap-2.5 py-4 cursor-pointer hover:bg-background -mx-1 px-1 rounded-lg transition-colors",children:[(0,e.jsx)(m.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t,u,v]}):(0,e.jsxs)("div",{children:[(0,e.jsxs)(q.$,{variant:"ghost",onClick:p?c:void 0,className:`w-full justify-start h-auto text-left flex items-center gap-2.5 py-4 ${p?"cursor-pointer hover:bg-background -mx-1 px-1 rounded-lg":""} transition-colors`,children:[b?(0,e.jsx)(n.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,e.jsx)(l.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t,u,v]}),b&&p&&(0,e.jsxs)("div",{className:"pb-3 pl-5 space-y-3",children:[a.description&&(0,e.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:a.description}),k.length>0&&(0,e.jsxs)("div",{className:"rounded-lg bg-background p-3 space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(o.A,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,e.jsx)("span",{className:"text-[11px] font-semibold text-foreground",children:h("taskAcceptanceCriteria")})]}),(0,e.jsx)("div",{className:"space-y-1.5",children:k.map((a,b)=>(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsx)("p",{className:"text-[11px] leading-snug text-foreground/80 flex-1",children:a.description}),!1!==a.required&&(0,e.jsx)("span",{className:"shrink-0 text-[10px] font-medium text-[#E65100] dark:text-[#F0A050]",children:i("required")})]},b))})]})]})]})}d()}catch(a){d(a)}})},58350:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{D:()=>ae});var e=c(55153),f=c(70404),g=c(5210),h=c(80804),i=c(6170),j=c(63813),k=c(35603),l=c(72770),m=c(17356),n=c(10598),o=c(88769),p=c(39976),q=c(50341),r=c(36015),s=c(12909),t=c(96506),u=c(10196),v=c(29288),w=c(2067),x=c(89084),y=c(90225),z=c(48354),A=c(57922),B=c(93231),C=c(70312),D=c(93430),E=c(42236),F=c(24456),G=c(66166),H=c(57896),I=c(31280),J=c(79091),K=c(15845),L=c(13907),M=c(48007),N=c(99705),O=c(95055),P=c(30850),Q=c(45157),R=c(64735),S=c(10019),T=c(61362),U=c(87860),V=c(23790),W=c(32540),X=c(59260),Y=c(65839),Z=c(40678),$=c(28287),_=c(6994),aa=c(89256),ab=c(74753),ac=c(38662),ad=a([z,A,E,F,G,J]);function ae(a){return(0,e.jsx)(af,{...a},a.ideaUuid)}function af({ideaUuid:a,projectUuid:b,currentUserUuid:c,onClose:d,onNavigate:ad}){let ae=(0,g.c)(),af=(0,y.F7)(),ag=(0,g.c)("ideaTracker"),ah=(0,g.c)("status"),ai=(0,g.c)("ideaTracker.lineage"),aj=(0,h.r)(),ak=(0,X.kz)(),al=ak?.activeSessionsByIdea.get(a)??[],[am,an]=(0,f.useState)(null),[ao,ap]=(0,f.useState)(!0),[aq,ar]=(0,f.useState)(null),[as,at]=(0,f.useState)([]),[au,av]=(0,f.useState)([]),[aw,ax]=(0,f.useState)(null),[ay,az]=(0,f.useState)(null),aA=(0,f.useRef)(0),aB=(0,f.useRef)(0),[aC,aD]=(0,f.useState)("overview"),[aE,aF]=(0,f.useState)(new Set(["overview"])),[aG,aH]=(0,f.useState)(!1),[aI,aJ]=(0,f.useState)(0),[aK,aL]=(0,f.useState)(!1),[aM,aN]=(0,f.useState)(!1),[aO,aP]=(0,f.useState)(!1),aQ=(0,f.useRef)(null),aR=(0,f.useCallback)(a=>{a.preventDefault(),aQ.current?.focus()},[]),[aS,aT]=(0,f.useState)(null),[aU,aV]=(0,f.useState)(!0),[aW,aX]=(0,f.useState)(!1),[aY,aZ]=(0,f.useState)(null),[a$,a_]=(0,f.useState)(!1),{start:a0,pickerState:a1,confirmPick:a2,cancelPick:a3,isResolving:a4}=(0,Y.E)({reassignNoWake:$.U,previewIdeaUuid:am?.uuid}),[a5,a6]=(0,f.useState)(!1),[a7,a8]=(0,f.useState)(""),[a9,ba]=(0,f.useState)(""),[bb,bc]=(0,f.useState)(!1),[bd,be]=(0,f.useState)(null),[bf,bg]=(0,f.useState)(!1),[bh,bi]=(0,f.useState)(!1),[bj,bk]=(0,f.useState)(!1),[bl,bm]=(0,f.useState)(!1),[bn,bo]=(0,f.useState)(null),[bp,bq]=(0,f.useState)(null),[br,bs]=(0,f.useState)(null),bt=(0,f.useCallback)(a=>{bs(null),bo(a)},[]),bu=(0,f.useCallback)(a=>{bo(null),bq(null),bs(a)},[]),[bv,bw]=(0,f.useState)(!1),[bx,by]=(0,f.useState)(!1),bz=(0,f.useCallback)(a=>{let b=new URLSearchParams(window.location.search);b.set("tab",a),window.history.replaceState(null,"",`${window.location.pathname}?${b.toString()}`)},[]),bA=(0,f.useCallback)(async()=>{try{let b=await (0,M.c)(a);b.success?(an(b.data),ar(null)):ar(ag("Not found"===b.error?"panel.notFound":"panel.loadFailed"))}catch{ar(ag("panel.loadFailed"))}finally{ap(!1)}},[a,ag]);(0,x.eV)("idea",bA),(0,x.eV)("proposal",bA),(0,x.eV)("task",bA);let bB=am?.uuid,bC=am?.status,bD=`${bB}:${bC}`,bE=(0,f.useCallback)(async()=>{let a=++aA.current;if(ax(null),bB){if("open"===bC){at([]),ax(bD);return}try{let c=await (0,N.U)(b,bB);a===aA.current&&c.success&&(at(c.data),ax(bD))}catch(a){_.q.error("Failed to fetch proposals:",a)}}},[b,bB,bC,bD]);(0,x.eV)("proposal",bE);let bF=(0,f.useCallback)(async()=>{let a=++aB.current;az(null);let c=as.filter(a=>"approved"===a.status);if(0===c.length){av([]),az(as);return}try{let d=await Promise.all(c.map(a=>(0,O.c)(b,a.uuid)));if(a!==aB.current||d.some(a=>!a.success))return;let e=d.flatMap(a=>a.success&&a.data?a.data.map(a=>({uuid:a.uuid,title:a.title,status:a.status,commentCount:a.commentCount??0,assignee:a.assignee??null,acceptanceSummary:a.acceptanceSummary??null})):[]);av(e),az(as)}catch(a){_.q.error("Failed to fetch tasks:",a)}},[b,as]);(0,x.eV)("task",bF);let bG=(0,f.useCallback)(async()=>{if(!bB)return;let a=await (0,Q.z)(bB);a.success&&a.data&&aT(a.data),aV(!1)},[bB]);(0,x.eV)("idea",bG);let bH=(0,f.useMemo)(()=>am?function(a,b,c){let d=["overview"];return d.push("elaboration"),b.length>0&&d.push("proposal"),c.length>0&&d.push("tasks"),d.push("activity"),d}(0,as,au):["overview","activity"],[am,as,au]);(0,f.useRef)(null),am&&am.badgeHint;let bI=(0,f.useMemo)(()=>au.filter(a=>"in_progress"===a.status||"assigned"===a.status||"to_verify"===a.status).length,[au]),bJ=(0,f.useCallback)(()=>{if(!bn)return void bq(null);(0,P.Q)(bn).then(a=>{a.success&&bq(a.data)}).catch(a=>_.q.error("Failed to load task details:",a))},[bn]);(0,x.eV)("task",bJ);let bK=()=>{a6(!1),a8(am?.title||""),ba(am?.content||""),be(null)},bL=async()=>{if(!am||!a7.trim())return void be(ae("ideas.titleRequired"));bc(!0),be(null);let a=await (0,K.J)({ideaUuid:am.uuid,projectUuid:b,title:a7.trim(),content:a9.trim()||null});bc(!1),a.success?(a6(!1),await bA(),aj.refresh()):be(a.error||ae("ideas.updateFailed"))},bM=async()=>{if(!am||aM)return;aN(!0);let a=await (0,L.Z)(am.uuid,b);aN(!1),a.success&&(d(),aj.refresh())},bN=async()=>{if(!am)return;aX(!0),aZ(null);let a=await (0,R.e)(am.uuid);aX(!1),a.success?(a_(!0),await bA(),aj.refresh()):aZ(a.error||ae("elaboration.verifyFailed"))},bO=async a=>{if(!am)return;bg(!0),an({...am,isContainer:a});let c=await (0,K.J)({ideaUuid:am.uuid,projectUuid:b,title:am.title,content:am.content??null,isContainer:a});bg(!1),c.success?(await bA(),aj.refresh()):(an({...am,isContainer:!a}),i.oR.error(c.error||ae("ideas.updateFailed")))},bP=am?.derivedStatus||"todo",bQ=am?.isContainer===!0,bR=null!==am&&af,bS=(0,T.o)({ideaStatus:am?.status,elaborationStatus:am?.elaborationStatus,elaboration:aS});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:d}),(0,e.jsxs)("div",{className:`fixed right-0 top-14 md:top-0 z-50 flex h-[calc(100%-3.5rem)] md:h-full w-full md:w-[480px] flex-col border-l border-border bg-card shadow-xl ${bx?"":"animate-in slide-in-from-right duration-300"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between border-b border-secondary px-6 py-5",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:ao?(0,e.jsx)("div",{className:"h-5 w-40 animate-pulse rounded bg-secondary"}):am?a5?(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground",children:ae("ideas.editIdea")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:`text-[11px] font-semibold uppercase tracking-wider ${bQ?"text-primary":"text-muted-foreground"}`,children:bQ?ai("typeTheme"):ai("typeIdea")}),(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground truncate",children:am.title}),(0,e.jsxs)("div",{className:"mt-1.5 flex min-w-0 items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[(0,e.jsx)(r.E,{className:ab._5[bP]||ab._5.todo,children:am.badgeHint?ag(`badge.${ab.Wl[am.badgeHint]||"open"}`):ah(ab.Bj[bP]||"todo")}),bQ&&am.childProgress&&am.childProgress.total>0&&(0,e.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs font-medium text-primary",title:ai("childrenDone",{done:am.childProgress.done,total:am.childProgress.total}),children:[(0,e.jsx)(ac.C,{done:am.childProgress.done,total:am.childProgress.total,size:13,stroke:2}),am.childProgress.done,"/",am.childProgress.total]}),(0,e.jsx)("span",{className:"min-w-0 truncate whitespace-nowrap text-xs text-muted-foreground",title:(0,aa.r)(am.createdAt),children:(0,aa.r)(am.createdAt)})]}),al.length>0&&ak&&(0,e.jsx)(W.U,{sessions:al,onSelect:ak.openChatForActiveSession,surface:"sidebar",className:"shrink-0"})]})]}):(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground",children:ag("panel.notFound")})}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-2 ml-3",children:[am&&!ao&&!a5&&af&&(0,e.jsx)(U.M,{ideaUuid:am.uuid,projectUuid:b,assignee:am.assignee,assigneeName:am.assignee?.name,proposals:as,tasks:au,triggerRef:aQ,busy:aM||aW||a4||bb||bf||null!==a1,stageReason:bQ?ai("containerHint"):void 0,stageDataReason:aw!==bD||ay!==as?ag("panel.actions.loadingStage"):void 0,verifyReason:aU?ag("loading"):a$?ae("elaboration.verifiedQueuedHint"):bS?void 0:ag("panel.actions.verifyUnavailable"),editReason:"elaborated"===am.status?ag("panel.actions.editUnavailable"):void 0,onVerify:()=>{!am||am.isContainer||!bS||a$||aU||aW||a4||bf||a0({ideaUuid:am.uuid,wake:bN})},onDerive:()=>bm(!0),onSetParent:()=>bk(!0),onMove:()=>bi(!0),onEdit:()=>{am&&"elaborated"!==am.status&&(a8(am.title),ba(am.content||""),be(null),a6(!0))},onDelete:()=>aP(!0),onStarted:bA,onCloseAutoFocus:aR},am.uuid),(0,e.jsx)(p.$,{variant:"outline",size:"icon",className:"h-8 w-8 border-border",onClick:a5?bK:d,"aria-label":ae("common.close"),children:(0,e.jsx)(j.A,{className:"h-4 w-4 text-muted-foreground"})})]})]}),am&&!ao&&!a5&&(0,e.jsx)("div",{className:"border-b border-secondary px-6",children:(0,e.jsx)("div",{className:"flex gap-0 -mb-px",children:bH.map(a=>(0,e.jsxs)("button",{onClick:()=>{aD(a),aH(!0),aF(b=>new Set([...b,a])),bz(a)},className:`relative flex items-center gap-1.5 px-3 py-2.5 text-[13px] font-medium transition-colors cursor-pointer ${aC===a?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-muted-foreground"}`,children:[ag(`panel.tabs.${a}`),"tasks"===a&&bI>0&&(0,e.jsx)("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-[#E3F2FD] dark:bg-[#13253a] text-[#1976D2] dark:text-[#5AA9F0] text-[10px] font-semibold leading-none",children:bI}),"activity"===a&&aI>0&&(0,e.jsx)("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-secondary text-muted-foreground text-[10px] font-semibold leading-none",children:aI})]},a))})}),(0,e.jsx)(q.F,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:(0,e.jsx)("div",{className:"flex min-h-full flex-col px-6 py-5",children:ao?(0,e.jsxs)("div",{className:"flex flex-1 items-center justify-center py-12",children:[(0,e.jsx)(k.A,{className:"h-6 w-6 animate-spin text-primary"}),(0,e.jsx)("span",{className:"ml-2 text-sm text-muted-foreground",children:ag("loading")})]}):aq?(0,e.jsx)("div",{className:"flex flex-1 items-center justify-center py-12",children:(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:aq})}):am?a5?(0,e.jsxs)("div",{className:"space-y-5",children:[bd&&(0,e.jsx)("div",{className:"rounded-lg bg-destructive/10 p-3 text-sm text-destructive",children:bd}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(u.J,{htmlFor:"edit-title",className:"text-[13px] font-medium text-foreground",children:ae("ideas.titleLabel")}),(0,e.jsx)(s.p,{id:"edit-title",value:a7,onChange:a=>a8(a.target.value),className:"border-border text-sm focus-visible:ring-primary",autoFocus:!0})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(u.J,{htmlFor:"edit-content",className:"text-[13px] font-medium text-foreground",children:ae("common.content")}),(0,e.jsx)(t.T,{id:"edit-content",value:a9,onChange:a=>ba(a.target.value),rows:8,className:"border-border text-sm resize-none focus-visible:ring-primary"})]}),(0,e.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[(0,e.jsx)(p.$,{variant:"outline",onClick:bK,disabled:bb,children:ae("common.cancel")}),(0,e.jsxs)(p.$,{onClick:bL,disabled:bb||!a7.trim(),children:[bb&&(0,e.jsx)(k.A,{className:"mr-2 h-4 w-4 animate-spin"}),ae("common.save")]})]})]}):(0,e.jsxs)(e.Fragment,{children:[a$&&(0,e.jsx)("p",{role:"status",className:"mb-4 text-xs text-muted-foreground",children:ae("elaboration.verifiedQueuedHint")}),aY&&(0,e.jsx)("p",{role:"alert",className:"mb-4 text-xs text-destructive",children:aY}),bQ&&(0,e.jsx)("p",{className:"mb-4 text-xs text-muted-foreground",children:ai("containerHint")}),aE.has("overview")&&(0,e.jsxs)("div",{style:{display:"overview"===aC?"block":"none"},children:[(0,e.jsxs)("div",{className:"mb-5 flex items-start justify-between gap-3 rounded-lg border border-[#EFEBE3] dark:border-[#2a2a2e] bg-background px-3.5 py-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,e.jsxs)(u.J,{htmlFor:"container-toggle",className:"flex items-center gap-1.5 text-[13px] font-medium text-foreground",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5 text-primary","aria-hidden":!0}),ai("container")]}),(0,e.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:ai("containerDescription")})]}),(0,e.jsx)(v.d,{id:"container-toggle",checked:bQ,disabled:bf||!af,onCheckedChange:bO,"aria-label":ai("makeContainer")})]}),(0,e.jsx)(B.p,{idea:am,proposals:as,tasks:au,onSelectTask:bt}),(0,e.jsxs)("div",{className:"mt-5 space-y-2",children:[(0,e.jsx)("div",{className:"flex items-center",children:(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5 text-primary"}),(0,e.jsx)("span",{className:"text-[12px] font-semibold text-foreground/80",children:ai("title")})]})}),am.parent?(0,e.jsxs)("button",{type:"button",onClick:()=>ad?.(am.parent.uuid),className:"flex w-full items-center gap-2 rounded-lg bg-background px-3 py-2.5 text-left transition-colors hover:bg-secondary",children:[(0,e.jsx)(m.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:ai("derivedFrom")}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground/80",children:am.parent.title})]}):(0,e.jsx)("p",{className:"px-1 text-[12px] text-muted-foreground",children:ai("noParent")}),am.children&&am.children.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-1 pt-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"text-[12px] font-medium text-foreground/80",children:ai("derivedIdeas")}),(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground",children:am.children.length})]}),(()=>{let a=am.children.filter(a=>"done"===a.derivedStatus).length,b=am.children.length;return(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground",title:ai("childrenDone",{done:a,total:b}),children:[(0,e.jsx)(ac.C,{done:a,total:b,size:14,stroke:2}),a,"/",b]})})()]}),(0,e.jsx)("div",{className:"overflow-hidden rounded-lg border border-[#EFEBE3] dark:border-[#2a2a2e]",children:am.children.map((a,b)=>(0,e.jsxs)("div",{children:[b>0&&(0,e.jsx)("div",{className:"h-px bg-[#F0EEEA] dark:bg-[#1f1e1c]"}),(0,e.jsxs)("button",{type:"button",onClick:()=>ad?.(a.uuid),className:"flex w-full items-center justify-between gap-2 px-3 py-2.5 text-left transition-colors hover:bg-background",children:[(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,e.jsx)(n.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate text-[12px] text-foreground",children:a.title})]}),(0,e.jsx)(r.E,{className:`shrink-0 border-0 text-[10px] ${ab._5[a.derivedStatus]||ab._5.todo}`,children:ah(ab.Bj[a.derivedStatus]||"todo")})]})]},a.uuid))})]})]}),(0,e.jsx)(C.U,{projectUuid:b,ideaUuid:am.uuid,proposals:as,onDocClick:bu}),(0,e.jsxs)("div",{className:"mt-5 space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(o.A,{className:"h-3.5 w-3.5 text-primary"}),(0,e.jsx)("span",{className:"text-[12px] font-semibold text-foreground/80",children:ae("references.title")})]}),(0,e.jsx)(V.ReferencesSection,{targetType:"idea",targetUuid:am.uuid,canWrite:!0,compact:!0})]})]}),bH.includes("elaboration")&&aE.has("elaboration")&&(0,e.jsx)("div",{style:{display:"elaboration"===aC?"block":"none"},children:(0,e.jsx)(z.G,{idea:am,elaboration:aS,isLoading:aU,onRefresh:async()=>{await bG(),await bA()},onReassign:()=>aL(!0),canReassign:bR})}),bH.includes("proposal")&&aE.has("proposal")&&(0,e.jsx)("div",{style:{display:"proposal"===aC?"block":"none"},children:(0,e.jsx)(A.k,{idea:am,projectUuid:b,onTaskClick:bt,onDocClick:bu,initialProposals:as})}),bH.includes("tasks")&&aE.has("tasks")&&(0,e.jsx)("div",{style:{display:"tasks"===aC?"block":"none"},children:(0,e.jsx)(D.n,{tasks:au,projectUuid:b,proposalUuids:as.filter(a=>"approved"===a.status).map(a=>a.uuid),onSelectTask:bt})}),aE.has("activity")&&(0,e.jsx)("div",{style:{display:"activity"===aC?"block":"none"},children:(0,e.jsx)(E.x,{ideaUuid:am.uuid,currentUserUuid:c,commentCount:aI,onCommentCountChange:aJ})})]}):null})}),am&&(0,e.jsx)(w.Lt,{open:aO,onOpenChange:aP,children:(0,e.jsxs)(w.EO,{onCloseAutoFocus:aR,children:[(0,e.jsxs)(w.wd,{children:[(0,e.jsx)(w.r7,{children:ae("ideas.deleteIdea")}),(0,e.jsx)(w.$v,{children:ae("ideas.deleteIdeaConfirm",{title:am.title})})]}),(0,e.jsxs)(w.ck,{children:[(0,e.jsx)(w.Zr,{children:ae("common.cancel")}),(0,e.jsx)(w.Rx,{variant:"destructive",onClick:bM,disabled:aM,children:ae("common.delete")})]})]})})]}),(0,e.jsx)(H.h,{open:bh,onOpenChange:bi,onCloseAutoFocus:aR,ideaUuid:a,projectUuid:b,onMoved:()=>d()}),am&&(0,e.jsx)(I.d,{open:bj,onOpenChange:bk,ideaUuid:am.uuid,ideaTitle:am.title,projectUuid:b,currentParentUuid:am.parentUuid??null,descendantUuids:am.descendantUuids??[],onChanged:bA,onCloseAutoFocus:aR}),am&&(0,e.jsx)(J.i,{open:bl,onOpenChange:bm,onCloseAutoFocus:aR,projectUuid:b,parentUuid:am.uuid,parentTitle:am.title,onCreated:a=>{i.oR.success(ai("deriveIdea")),aj.refresh(),ad?.(a)}}),aK&&am&&(0,e.jsx)(S.i,{idea:{uuid:am.uuid,title:am.title,content:am.content,status:am.status,assignee:am.assignee?{type:am.assignee.type,uuid:am.assignee.uuid,name:am.assignee.name}:null},projectUuid:b,currentUserUuid:c,onClose:()=>{aL(!1),bA()}}),(0,e.jsx)(Z.V,{open:null!==a1,onCloseAutoFocus:aR,agentName:am?.assignee?.name??"",instances:a1?.instances??[],onConfirm:a2,onCancel:a3}),bn&&bp&&(0,e.jsx)(F.v,{task:bp,projectUuid:b,currentUserUuid:c,mode:bv?"sidebyside":"overlay",onClose:()=>{bo(null),bq(null)},onBack:()=>{bo(null),bq(null)}}),br&&(0,e.jsx)(G.K,{title:br.title,type:br.type,content:br.content,mode:bv?"sidebyside":"overlay",onClose:()=>bs(null),onBack:()=>bs(null)})]})}[z,A,E,F,G,J]=ad.then?(await ad)():ad,d()}catch(a){d(a)}})},63519:(a,b,c)=>{function d(a){return a.replace(/\\n/g,"\n")}c.d(b,{j:()=>d,y:()=>e});let e={prd:"typePrd",tech_design:"typeTechDesign",adr:"typeAdr",spec:"typeSpec",guide:"typeGuide",design:"typeDesign",note:"typeNote",report:"typeReport",other:"typeOther"}},66166:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{K:()=>q});var e=c(55153),f=c(70404),g=c(5210),h=c(3260),i=c(63813),j=c(39976),k=c(36015),l=c(50341),m=c(74586),n=c(63519),o=c(74753),p=a([m]);function q({title:a,type:b,content:c,mode:d="overlay",onClose:p,onBack:q}){let r=(0,g.c)("documents"),[s,t]=(0,f.useState)(!1),u="sidebyside"===d;return(0,e.jsxs)(e.Fragment,{children:[!u&&(0,e.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:p}),(0,e.jsxs)("div",{className:`fixed top-14 md:top-0 flex h-[calc(100%-3.5rem)] md:h-full w-full md:w-[480px] flex-col bg-card shadow-xl border-l border-border ${u?`z-40 ${s?"":"animate-in slide-in-from-right duration-300"}`:`z-50 right-0 ${s?"":"animate-in slide-in-from-right duration-300"}`}`,style:u?{right:`${o.L8}px`}:void 0,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between border-b border-secondary px-6 py-5",children:[q&&(0,e.jsx)(j.$,{variant:"ghost",size:"icon",className:"mr-2 h-8 w-8 shrink-0",onClick:q,children:(0,e.jsx)(h.A,{className:"h-4 w-4 text-muted-foreground"})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground truncate",children:a}),(0,e.jsx)("div",{className:"mt-1.5",children:(0,e.jsx)(k.E,{variant:"outline",className:"text-[10px] font-medium border-border text-muted-foreground bg-secondary px-2 py-0.5 font-mono",children:r(n.y[b]||"typeOther")})})]}),(0,e.jsx)(j.$,{variant:"outline",size:"icon",className:"ml-4 h-8 w-8 shrink-0 border-border",onClick:p,children:(0,e.jsx)(i.A,{className:"h-4 w-4 text-muted-foreground"})})]}),(0,e.jsx)(l.F,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:(0,e.jsx)("div",{className:"px-6 py-5 text-[13px] leading-relaxed text-foreground prose prose-sm max-w-none [&_h1]:text-lg [&_h1]:font-semibold [&_h1]:mt-4 [&_h1]:mb-2 [&_h2]:text-base [&_h2]:font-semibold [&_h2]:mt-3 [&_h2]:mb-1.5 [&_h3]:text-sm [&_h3]:font-medium [&_h3]:mt-2 [&_h3]:mb-1 [&_p]:text-[13px] [&_p]:text-foreground/80 [&_p]:my-1.5 [&_li]:text-[13px] [&_li]:text-foreground/80 [&_ul]:my-1 [&_ol]:my-1 [&_strong]:text-foreground [&_code]:text-[12px] [&_code]:bg-secondary [&_code]:text-foreground [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_pre]:bg-secondary [&_pre]:text-foreground [&_pre]:p-3 [&_pre]:rounded-lg [&_pre]:my-2 [&_a]:text-primary",children:(0,e.jsx)(m.MarkdownContent,{children:(0,n.j)(c)})})})]})]})}m=(p.then?(await p)():p)[0],d()}catch(a){d(a)}})},70312:(a,b,c)=>{c.d(b,{U:()=>p});var d=c(55153),e=c(70404),f=c(5210),g=c(35603),h=c(62346),i=c(36015),j=c(39976),k=c(89084),l=c(6994),m=c(63519),n=c(8845);let o=(0,n.createServerReference)("601f22d9d4637a9dd8d2270bc2f046f85fbe373254",n.callServer,void 0,n.findSourceMapURL,"getReportsForIdeaAction");function p({projectUuid:a,ideaUuid:b,proposals:c,onDocClick:n}){let p=(0,f.c)("idea"),q=(0,f.c)("documents"),[r,s]=(0,e.useState)([]),[t,u]=(0,e.useState)(!0),v=c.some(a=>"approved"===a.status),w=(0,e.useCallback)(async()=>{if(!v){s([]),u(!1);return}try{let c=await o(a,b);if(c.success){let a=[...c.data].sort((a,b)=>new Date(b.createdAt).getTime()-new Date(a.createdAt).getTime());s(a.map(a=>({uuid:a.uuid,title:a.title,type:a.type,content:a.content??null,createdAt:a.createdAt})))}}catch(a){l.q.error("Failed to fetch reports for idea:",a)}finally{u(!1)}},[a,b,v]);return((0,k.eV)("document",w),t)?v?(0,d.jsx)("div",{className:"flex items-center justify-center py-3",children:(0,d.jsx)(g.A,{className:"h-4 w-4 animate-spin text-primary"})}):null:0===r.length?null:(0,d.jsxs)("div",{className:"mt-6 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[1px] text-muted-foreground",children:p("reportsList")}),(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.length}),(0,d.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:["\xb7 ",p("reportsAcrossProposals")]})]}),(0,d.jsx)("div",{className:"space-y-0",children:r.map(a=>(0,d.jsxs)(j.$,{variant:"ghost",className:"w-full justify-start h-auto text-left flex items-center gap-2.5 py-3.5 hover:bg-background transition-colors cursor-pointer -mx-1 px-1 rounded-lg",onClick:()=>n({title:a.title,type:"report",content:a.content??""}),children:[(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,d.jsx)(i.E,{variant:"outline",className:"shrink-0 text-[10px] font-medium border-border text-muted-foreground bg-secondary px-2 py-0.5 font-mono",children:q(m.y[a.type]||"typeOther")}),(0,d.jsx)("span",{className:"flex-1 min-w-0 text-left text-[13px] text-foreground truncate",children:a.title})]},a.uuid))})]})}},72770:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(77144).A)("git-fork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]])},79091:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{i:()=>v});var e=c(55153),f=c(70404),g=c(5210),h=c(35603),i=c(6170),j=c(39976),k=c(43840),l=c(12909),m=c(96506),n=c(10196),o=c(2559),p=c(63284),q=c(21687),r=c(79396),s=c(59260),t=c(91981),u=a([t]);function v({open:a,onOpenChange:b,onCloseAutoFocus:c,projectUuid:d,onCreated:u,parentUuid:v,parentTitle:w}){let x=(0,g.c)("ideaTracker"),y=(0,g.c)("ideaTracker.lineage"),z=!!v,A=(0,g.c)("common"),[B,C]=(0,f.useState)(""),[D,E]=(0,f.useState)(""),[F,G]=(0,f.useState)(!1),[H,I]=(0,f.useState)(!1),[J,K]=(0,f.useState)(null),[L,M]=(0,f.useState)(!1),[N,O]=(0,f.useState)(!1),[P,Q]=(0,f.useState)(!1),[R,S]=(0,f.useState)(!1),T=(0,s.kz)(),U=(T?.connections??[]).some(a=>"online"===a.effectiveStatus),[V,W]=(0,f.useState)("form"),X=z?"form":V,Y=async()=>{let a=B.trim();if(a){I(!0),K(null);try{let c=await fetch(`/api/projects/${d}/ideas`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a,content:D.trim()||void 0,...v?{parentUuid:v}:{},...F?{isContainer:!0}:{}})}),e=await c.json();e.success&&e.data?.uuid?(C(""),E(""),G(!1),b(!1),u?.(e.data.uuid)):K(e.error||x("error.createFailed"))}catch{K(x("error.createFailed"))}finally{I(!1)}}},Z=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-4 py-2",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(n.J,{htmlFor:"idea-title",children:x("newIdea.ideaTitle")}),(0,e.jsx)(l.p,{id:"idea-title",value:B,onChange:a=>C(a.target.value),placeholder:x("newIdea.titlePlaceholder"),autoFocus:!0,onKeyDown:a=>{!(0,q.P)(a)&&"Enter"===a.key&&!a.shiftKey&&B.trim()&&(a.preventDefault(),Y())}})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(n.J,{htmlFor:"idea-content",children:[x("newIdea.description"),(0,e.jsxs)("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",A("optional"),")"]})]}),(0,e.jsx)(m.T,{id:"idea-content",value:D,onChange:a=>E(a.target.value),placeholder:x("newIdea.descriptionPlaceholder"),rows:4,className:"resize-none"})]}),(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)(o.S,{id:"idea-is-container",checked:F,onCheckedChange:a=>G(!0===a),className:"mt-0.5"}),(0,e.jsxs)("div",{className:"grid gap-1 leading-none",children:[(0,e.jsx)(n.J,{htmlFor:"idea-is-container",className:"cursor-pointer",children:y("makeContainer")}),(0,e.jsx)("p",{className:"text-xs font-normal text-muted-foreground",children:y("containerHint")})]})]}),J&&(0,e.jsx)("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-[12px] text-destructive",children:J})]}),(0,e.jsxs)(k.Es,{children:[(0,e.jsx)(j.$,{variant:"outline",onClick:()=>b(!1),disabled:H,children:A("cancel")}),(0,e.jsxs)(j.$,{onClick:Y,disabled:H||!B.trim(),className:"bg-primary hover:bg-[#B56A42] text-white",children:[H?(0,e.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,A("create")]})]})]}),$=async a=>{Q(!0);try{let b=await (0,r.tm)("/api/ideas/conversational",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectUuid:d,agentUuid:a.agentUuid,connectionUuid:a.connectionUuid,descriptionText:a.userText,researchFirst:N,...L?{decompose:!0}:{}})});if(!b.ok){let a=null;try{let c=await b.json();"string"==typeof c?.error&&c.error&&(a=c.error)}catch{}throw new t.fF(b.status,a)}let c=null;try{let a=await b.json();a?.success&&a.data?.session&&(c=a.data.session)}catch{}if(!c)throw new t.fF(b.status,null);return c}finally{Q(!1)}},_=(0,e.jsxs)("div",{className:"space-y-3 py-2",children:[(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)(o.S,{id:"idea-research-first",checked:N,onCheckedChange:a=>O(!0===a),disabled:P,"aria-describedby":"idea-research-first-hint",className:"mt-0.5"}),(0,e.jsxs)("div",{className:"grid gap-1",children:[(0,e.jsx)(n.J,{htmlFor:"idea-research-first",className:"cursor-pointer",children:x("newIdea.researchFirst")}),(0,e.jsx)("p",{id:"idea-research-first-hint",className:"text-xs leading-4 text-muted-foreground",children:x("newIdea.researchFirstHint")})]})]}),(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)(o.S,{id:"idea-decompose",checked:L,disabled:P,onCheckedChange:a=>M(!0===a),className:"mt-0.5"}),(0,e.jsxs)("div",{className:"grid gap-1 leading-none",children:[(0,e.jsx)(n.J,{htmlFor:"idea-decompose",className:"cursor-pointer",children:x("newIdea.decompose")}),(0,e.jsx)("p",{className:"text-xs font-normal text-muted-foreground",children:x("newIdea.decomposeHint")})]})]}),(0,e.jsx)(t.jH,{projectUuid:d,dispatch:$,onStarted:()=>{b(!1),i.oR.success(x("newIdea.submitted"))}})]});return(0,e.jsx)(k.lG,{open:a,onOpenChange:b,children:(0,e.jsxs)(k.Cf,{className:"sm:max-w-[480px]",onCloseAutoFocus:c,children:[(0,e.jsxs)(k.c7,{children:[(0,e.jsx)(k.L3,{children:z?y("deriveIdea"):x("newIdea.title")}),z&&w&&(0,e.jsxs)("p",{className:"text-[13px] text-muted-foreground",children:[y("derivedFrom")," \xb7 ",w]})]}),!z&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.tU,{value:X,onValueChange:a=>W(a),children:(0,e.jsxs)(p.j7,{className:"grid w-full grid-cols-2",children:[(0,e.jsx)(p.Xi,{value:"form",children:x("newIdea.modeForm")}),(0,e.jsx)(p.Xi,{value:"conversation",disabled:!U&&!R,children:x("newIdea.modeConversation")})]})}),!U&&(0,e.jsxs)("div",{className:"rounded-xl border border-[#EFEBE4] dark:border-[#2a2a2e] bg-[#FCFBF8] dark:bg-[#1e1d1b] px-3 py-2",children:[(0,e.jsx)("p",{className:"px-1 pt-1 text-[12px] font-medium text-muted-foreground",children:x("newIdea.modeConversationOfflineHint")}),(0,e.jsx)(t.Bs,{variant:"compact"})]})]}),"form"===X?Z:_]})})}t=(u.then?(await u)():u)[0],d()}catch(a){d(a)}})},85903:(a,b,c)=>{c.d(b,{i:()=>e});var d=c(48996);function e(a){return`${d.W} Explicit, one-time research request for ideaUuid: ${a}.
1
+ "use strict";exports.id=2689,exports.ids=[2689],exports.modules={2559:(a,b,c)=>{c.d(b,{S:()=>h});var d=c(55153);c(70404);var e=c(43353),f=c(35139),g=c(57187);function h({className:a,...b}){return(0,d.jsx)(f.Root,{"data-slot":"checkbox",className:(0,g.cn)("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",a),...b,children:(0,d.jsx)(f.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:(0,d.jsx)(e.A,{className:"size-3.5"})})})}},10598:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(77144).A)("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]])},11927:(a,b,c)=>{c.d(b,{U:()=>p});var d=c(55153),e=c(70404),f=c(5210),g=c(35603),h=c(62346),i=c(36015),j=c(39976),k=c(89084),l=c(6994),m=c(63519),n=c(8845);let o=(0,n.createServerReference)("60c6089c769ea6db6cf29451452b80b0851e27b255",n.callServer,void 0,n.findSourceMapURL,"getReportsForIdeaAction");function p({projectUuid:a,ideaUuid:b,proposals:c,onDocClick:n}){let p=(0,f.c)("idea"),q=(0,f.c)("documents"),[r,s]=(0,e.useState)([]),[t,u]=(0,e.useState)(!0),v=c.some(a=>"approved"===a.status),w=(0,e.useCallback)(async()=>{if(!v){s([]),u(!1);return}try{let c=await o(a,b);if(c.success){let a=[...c.data].sort((a,b)=>new Date(b.createdAt).getTime()-new Date(a.createdAt).getTime());s(a.map(a=>({uuid:a.uuid,title:a.title,type:a.type,content:a.content??null,createdAt:a.createdAt})))}}catch(a){l.q.error("Failed to fetch reports for idea:",a)}finally{u(!1)}},[a,b,v]);return((0,k.eV)("document",w),t)?v?(0,d.jsx)("div",{className:"flex items-center justify-center py-3",children:(0,d.jsx)(g.A,{className:"h-4 w-4 animate-spin text-primary"})}):null:0===r.length?null:(0,d.jsxs)("div",{className:"mt-6 space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[1px] text-muted-foreground",children:p("reportsList")}),(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.length}),(0,d.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:["\xb7 ",p("reportsAcrossProposals")]})]}),(0,d.jsx)("div",{className:"space-y-0",children:r.map(a=>(0,d.jsxs)(j.$,{variant:"ghost",className:"w-full justify-start h-auto text-left flex items-center gap-2.5 py-3.5 hover:bg-background transition-colors cursor-pointer -mx-1 px-1 rounded-lg",onClick:()=>n({title:a.title,type:"report",content:a.content??""}),children:[(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,d.jsx)(i.E,{variant:"outline",className:"shrink-0 text-[10px] font-medium border-border text-muted-foreground bg-secondary px-2 py-0.5 font-mono",children:q(m.y[a.type]||"typeOther")}),(0,d.jsx)("span",{className:"flex-1 min-w-0 text-left text-[13px] text-foreground truncate",children:a.title})]},a.uuid))})]})}},17356:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(77144).A)("corner-left-up",[["path",{d:"M14 9 9 4 4 9",key:"1af5af"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]])},23956:(a,b,c)=>{c.d(b,{c:()=>e});var d=c(8845);let e=(0,d.createServerReference)("406b7eac4d040cab5d794181aa1d220a3c8df0f7af",d.callServer,void 0,d.findSourceMapURL,"getIdeaAction")},25959:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{p:()=>n});var e=c(55153),f=c(5210),g=c(68139),h=c(79239),i=c(10196),j=c(42279),k=c(91981),l=c(78718),m=a([k]);function n({assignee:a,onReassign:b,editable:c}){let d=(0,f.c)("common"),m=!0===c&&"function"==typeof b,n=d(a?"reassign":"assign"),o=a?(0,e.jsxs)(e.Fragment,{children:[(0,l.bB)(a)?(0,e.jsx)(h.AgentAvatar,{name:a.name,size:28,className:"rounded-full"}):(0,e.jsx)(g.eu,{className:"h-7 w-7",children:(0,e.jsx)(g.q5,{className:"bg-border text-muted-foreground",children:a.name.charAt(0).toUpperCase()})}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:a.name}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:d((0,l.bB)(a)?"agent":"user")}),"agent_instance"===a.type&&a.instance&&(0,e.jsx)("div",{className:"mt-1",children:(0,e.jsx)(k.jQ,{cwd:a.instance.cwd,host:a.instance.host})})]})]}):(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:d("unassigned")}),p="mt-2 flex items-center gap-2.5 rounded-lg bg-background p-3";return(0,e.jsxs)("div",{children:[(0,e.jsx)(i.J,{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:d("assignee")}),m?(0,e.jsx)(j.Bc,{delayDuration:300,children:(0,e.jsxs)(j.m_,{children:[(0,e.jsx)(j.k$,{asChild:!0,children:(0,e.jsx)("button",{type:"button",onClick:b,"aria-label":n,className:`${p} w-full cursor-pointer text-left`,children:o})}),(0,e.jsx)(j.ZI,{children:n})]})}):(0,e.jsx)("div",{className:p,children:o})]})}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},32540:(a,b,c)=>{c.d(b,{U:()=>l});var d=c(55153),e=c(70404),f=c(5210),g=c(79239),h=c(39976),i=c(33585),j=c(57187);function k(a){return a.agentName??a.agentUuid}function l({sessions:a,onSelect:b,surface:c,className:l}){let m=(0,f.c)("activeSessions"),[n,o]=(0,e.useState)(!1),p=(0,e.useRef)(null);if(0===a.length)return null;let q=a.some(a=>a.canOpen),r=1===a.length&&a[0].canOpen,s=a[0],t=()=>{null!==p.current&&(clearTimeout(p.current),p.current=null)},u=()=>{t(),p.current=setTimeout(()=>o(!1),120)},v=a=>{a.canOpen&&(o(!1),b(a))},w=(0,d.jsxs)(h.$,{type:"button",variant:"outline",size:"tracker"===c?"xs":"icon-sm","data-testid":`${c}-active-session-indicator`,"aria-label":m(q?"indicatorLabel":"statusOnlyIndicatorLabel",{count:a.length}),"aria-disabled":!q,"aria-haspopup":a.length>1?"dialog":void 0,onPointerDown:a=>a.stopPropagation(),onPointerEnter:r?void 0:a=>{"touch"!==a.pointerType&&(t(),o(!0))},onPointerLeave:r?void 0:a=>{"touch"!==a.pointerType&&u()},onFocus:r?void 0:()=>o(!0),onClick:a=>{if(a.stopPropagation(),t(),r)return void v(s);n&&a.preventDefault()},onKeyDown:a=>a.stopPropagation(),className:(0,j.cn)("group/active relative gap-1.5 overflow-visible border-emerald-500/35 bg-emerald-500/10 font-semibold text-emerald-700 shadow-none transition-[background-color,border-color,box-shadow] hover:border-emerald-500/60 hover:bg-emerald-500/15 hover:text-emerald-700 hover:shadow-[0_3px_10px_-5px_rgba(16,185,129,0.8)] focus-visible:border-emerald-500 focus-visible:ring-emerald-500/50 dark:border-emerald-500/35 dark:bg-emerald-500/10 dark:text-emerald-300 dark:hover:border-emerald-500/60 dark:hover:bg-emerald-500/15 dark:hover:text-emerald-300","tracker"===c?"h-7 min-w-7 px-1 text-[11px]":"sidebar"===c?"h-8 min-w-8 px-1 text-[11px]":"h-9 min-w-9 px-1 text-[11px] shadow-sm",l),children:[(0,d.jsxs)("span",{className:"relative shrink-0","aria-hidden":!0,children:[(0,d.jsx)(g.AgentAvatar,{name:k(s),size:"graph"===c?22:20,className:"rounded-full ring-1 ring-emerald-600/25"}),(0,d.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 size-2 rounded-full border-2 border-card bg-emerald-500"}),(0,d.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 size-2 rounded-full bg-emerald-400/75 motion-safe:animate-ping motion-reduce:animate-none"})]}),a.length>1&&(0,d.jsx)("span",{children:a.length})]});return r?w:(0,d.jsxs)(i.AM,{open:n,onOpenChange:o,children:[(0,d.jsx)(i.Wv,{asChild:!0,children:w}),(0,d.jsxs)(i.hl,{align:"start",sideOffset:6,onCloseAutoFocus:a=>a.preventDefault(),onPointerDown:a=>a.stopPropagation(),onPointerEnter:t,onPointerLeave:u,onClick:a=>a.stopPropagation(),className:"w-[min(22rem,calc(100vw-2rem))] p-1.5","aria-label":m("chooserLabel"),children:[(0,d.jsx)("p",{className:"px-2 pb-1.5 pt-1 text-xs font-medium text-muted-foreground",children:m("runningCount",{count:a.length})}),(0,d.jsx)("div",{className:"max-h-64 overflow-y-auto",children:a.map(a=>(0,d.jsxs)(h.$,{type:"button",variant:"ghost",disabled:!a.canOpen,"aria-label":a.canOpen?k(a):m("statusOnlyEntry",{agent:k(a)}),onClick:()=>v(a),className:"group/session h-auto w-full min-w-0 items-start justify-start gap-2.5 whitespace-normal px-2 py-2 text-left disabled:cursor-not-allowed disabled:opacity-65",children:[(0,d.jsxs)("span",{className:"relative mt-0.5 shrink-0","aria-hidden":!0,children:[(0,d.jsx)(g.AgentAvatar,{name:k(a),size:30,className:"rounded-lg ring-1 ring-border transition-shadow group-hover/session:ring-emerald-500/45"}),(0,d.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 size-2.5 rounded-full border-2 border-card bg-emerald-500"})]}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block truncate text-xs font-medium text-foreground",children:k(a)}),(0,d.jsx)("span",{className:"block truncate text-[11px] text-muted-foreground",children:a.connectionAvailable?m("location",{host:a.host??m("unknownHost"),cwd:a.cwd??m("unknownCwd")}):m("agentFallback")}),!a.canOpen&&(0,d.jsx)("span",{className:"block text-[11px] font-medium text-muted-foreground",children:m("statusOnly")})]})]},a.sessionUuid))})]})]})}},35139:(a,b,c)=>{c.r(b),c.d(b,{Checkbox:()=>v,CheckboxIndicator:()=>x,Indicator:()=>x,Root:()=>v,createCheckboxScope:()=>p,unstable_BubbleInput:()=>z,unstable_CheckboxBubbleInput:()=>z,unstable_CheckboxProvider:()=>s,unstable_CheckboxTrigger:()=>u,unstable_Provider:()=>s,unstable_Trigger:()=>u});var d=c(70404),e=c(39383),f=c(51861),g=c(84586),h=c(83722),i=c(18750),j=c(37022),k=c(36443),l=c(69640),m=c(55153),n="Checkbox",[o,p]=(0,f.A)(n),[q,r]=o(n);function s(a){let{__scopeCheckbox:b,checked:c,children:e,defaultChecked:f,disabled:g,form:i,name:j,onCheckedChange:k,required:l,value:o="on",internal_do_not_use_render:p}=a,[r,s]=(0,h.i)({prop:c,defaultProp:f??!1,onChange:k,caller:n}),[t,u]=d.useState(null),[v,w]=d.useState(null),x=d.useRef(!1),y=!t||!!i||!!t.closest("form"),z={checked:r,disabled:g,setChecked:s,control:t,setControl:u,name:j,form:i,value:o,hasConsumerStoppedPropagationRef:x,required:l,defaultChecked:!A(f)&&f,isFormControl:y,bubbleInput:v,setBubbleInput:w};return(0,m.jsx)(q,{scope:b,...z,children:"function"==typeof p?p(z):e})}var t="CheckboxTrigger",u=d.forwardRef(({__scopeCheckbox:a,onKeyDown:b,onClick:c,...f},h)=>{let{control:i,value:j,disabled:k,checked:n,required:o,setControl:p,setChecked:q,hasConsumerStoppedPropagationRef:s,isFormControl:u,bubbleInput:v}=r(t,a),w=(0,e.s)(h,p),x=d.useRef(n);return d.useEffect(()=>{let a=i?.form;if(a){let b=()=>q(x.current);return a.addEventListener("reset",b),()=>a.removeEventListener("reset",b)}},[i,q]),(0,m.jsx)(l.sG.button,{type:"button",role:"checkbox","aria-checked":A(n)?"mixed":n,"aria-required":o,"data-state":B(n),"data-disabled":k?"":void 0,disabled:k,value:j,...f,ref:w,onKeyDown:(0,g.mK)(b,a=>{"Enter"===a.key&&a.preventDefault()}),onClick:(0,g.mK)(c,a=>{q(a=>!!A(a)||!a),v&&u&&(s.current=a.isPropagationStopped(),s.current||a.stopPropagation())})})});u.displayName=t;var v=d.forwardRef((a,b)=>{let{__scopeCheckbox:c,name:d,checked:e,defaultChecked:f,required:g,disabled:h,value:i,onCheckedChange:j,form:k,...l}=a;return(0,m.jsx)(s,{__scopeCheckbox:c,checked:e,defaultChecked:f,disabled:h,required:g,onCheckedChange:j,name:d,form:k,value:i,internal_do_not_use_render:({isFormControl:a})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u,{...l,ref:b,__scopeCheckbox:c}),a&&(0,m.jsx)(z,{__scopeCheckbox:c})]})})});v.displayName=n;var w="CheckboxIndicator",x=d.forwardRef((a,b)=>{let{__scopeCheckbox:c,forceMount:d,...e}=a,f=r(w,c);return(0,m.jsx)(k.C,{present:d||A(f.checked)||!0===f.checked,children:(0,m.jsx)(l.sG.span,{"data-state":B(f.checked),"data-disabled":f.disabled?"":void 0,...e,ref:b,style:{pointerEvents:"none",...a.style}})})});x.displayName=w;var y="CheckboxBubbleInput",z=d.forwardRef(({__scopeCheckbox:a,...b},c)=>{let{control:f,hasConsumerStoppedPropagationRef:g,checked:h,defaultChecked:k,required:n,disabled:o,name:p,value:q,form:s,bubbleInput:t,setBubbleInput:u}=r(y,a),v=(0,e.s)(c,u),w=(0,i.Z)(h),x=(0,j.X)(f);d.useEffect(()=>{if(!t)return;let a=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,b=!g.current;if(w!==h&&a){let c=new Event("click",{bubbles:b});t.indeterminate=A(h),a.call(t,!A(h)&&h),t.dispatchEvent(c)}},[t,w,h,g]);let z=d.useRef(!A(h)&&h);return(0,m.jsx)(l.sG.input,{type:"checkbox","aria-hidden":!0,defaultChecked:k??z.current,required:n,disabled:o,name:p,value:q,form:s,...b,tabIndex:-1,ref:v,style:{...b.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function A(a){return"indeterminate"===a}function B(a){return A(a)?"indeterminate":a?"checked":"unchecked"}z.displayName=y},38662:(a,b,c)=>{c.d(b,{C:()=>f});var d=c(55153),e=c(57187);function f({done:a,total:b,size:c=14,stroke:f=2,className:g,color:h="#B26B3D",trackColor:i="#EAD9C8"}){let j=(c-f)/2,k=2*Math.PI*j,l=b>0?Math.min(1,Math.max(0,a/b)):0;return(0,d.jsxs)("svg",{width:c,height:c,viewBox:`0 0 ${c} ${c}`,className:(0,e.cn)("shrink-0",g),role:"img","aria-label":`${a}/${b}`,children:[(0,d.jsx)("circle",{cx:c/2,cy:c/2,r:j,fill:"none",stroke:i,strokeWidth:f}),l>0&&(0,d.jsx)("circle",{cx:c/2,cy:c/2,r:j,fill:"none",stroke:b>0&&a>=b?"#1D9E75":h,strokeWidth:f,strokeDasharray:k,strokeDashoffset:k*(1-l),strokeLinecap:"round",transform:`rotate(-90 ${c/2} ${c/2})`})]})}},42236:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{x:()=>k});var e=c(55153),f=c(70404),g=c(5210),h=c(86787),i=c(18028),j=a([i]);function k({ideaUuid:a,currentUserUuid:b,commentCount:c,onCommentCountChange:d}){let j=(0,g.c)("ideaTracker"),[k,l]=(0,f.useState)("comments");return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex gap-1 rounded-lg bg-secondary p-0.5",children:[(0,e.jsxs)("button",{onClick:()=>l("comments"),className:`flex-1 rounded-md px-3 py-1.5 text-[13px] font-medium transition-colors flex items-center justify-center gap-1.5 cursor-pointer ${"comments"===k?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-muted-foreground"}`,children:[j("panel.activityTab.comments"),c>0&&(0,e.jsx)("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-secondary text-muted-foreground text-[10px] font-semibold leading-none",children:c})]}),(0,e.jsx)("button",{onClick:()=>l("activity"),className:`flex-1 rounded-md px-3 py-1.5 text-[13px] font-medium transition-colors cursor-pointer ${"activity"===k?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-muted-foreground"}`,children:j("panel.activityTab.activity")})]}),(0,e.jsx)("div",{children:"activity"===k?(0,e.jsx)(h.v,{ideaUuid:a}):(0,e.jsx)(i.$m,{targetType:"idea",targetUuid:a,currentUserUuid:b,onCountChange:d,compact:!0})})]})}i=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},43725:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{N:()=>o,d:()=>n});var e=c(82009);c(36005);var f=c(65751),g=c(63319),h=c(22426),i=c(95078),j=c(4371),k=c(43756),l=c(62237),m=a([f,h,i,j,k]);async function n(a){let b=await (0,f.d)();if(!b||!["user","super_admin"].includes(b.type))return{eligible:!1,reason:"unauthorized"};let c=await (0,k.oJ)(b,"idea",a,"editor");return c?c.error.endsWith("not found")?{eligible:!1,reason:"idea_not_found"}:{eligible:!1,reason:"unauthorized"}:(0,h.Rf)(b.companyUuid,a)}async function o(a,b,c){let d=await (0,f.d)();if(!d||!["user","super_admin"].includes(d.type))return{success:!1,errorCode:"unauthorized"};let e=await (0,k.oJ)(d,"idea",a,"editor");if(e)return{success:!1,errorCode:e.error.endsWith("not found")?"idea_not_found":"permission_denied"};try{let e=b?await (0,j.e2)({companyUuid:d.companyUuid,userUuid:d.actorUuid,...b}):null,f=await (0,i.Di)({companyUuid:d.companyUuid,actorUuid:d.actorUuid,actorType:d.type,ideaUuid:a,temporaryCwd:e,...b?{temporaryAgentUuid:b.agentUuid}:{},...c?{selection:c}:{}});return{success:!0,...f}}catch(b){if(b instanceof i.CZ)return{success:!1,errorCode:b.code};return g.default.error({err:b,ideaUuid:a},"Research dispatch failed"),{success:!1,errorCode:"unknown"}}}[f,h,i,j,k]=m.then?(await m)():m,(0,l.D)([n,o]),(0,e.A)(n,"40a29e2af30ed8bd0a65fea6473d475c6dbd2c23d2",null),(0,e.A)(o,"705c94e797daeee4c028f99a606c267c345981f81b",null),d()}catch(a){d(a)}})},47905:(a,b,c)=>{c.d(b,{p:()=>s});var d=c(55153),e=c(70404),f=c(5210),g=c(6462);let h=(0,c(77144).A)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]);var i=c(48756),j=c(81975),k=c(59355),l=c(62346),m=c(43353),n=c(18369),o=c(80123),p=c(90025),q=c(8845);q.callServer,q.findSourceMapURL;var r=c(74753);function s({idea:a,proposals:b,tasks:c,onSelectTask:q}){let s=(0,f.c)("ideaTracker"),t=(0,f.c)(),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(new Set),y=(0,e.useMemo)(()=>"open"===a.status?"idea_created":"elaborating"===a.status||0===b.length?"elaboration":b.some(a=>"approved"===a.status)&&c.length>0?"tasks":"proposal",[a.status,b,c]),z=(0,e.useMemo)(()=>{let a=["idea_created","elaboration","proposal","tasks"],b=a.indexOf(y);return a.map((a,c)=>({id:a,labelKey:({idea_created:"panel.timeline.ideaCreated",elaboration:"panel.timeline.elaboration",proposal:"panel.timeline.proposal",tasks:"panel.timeline.tasksProgress"})[a],status:c<b?"completed":c===b?"active":"upcoming",icon:({idea_created:(0,d.jsx)(g.A,{className:"h-3.5 w-3.5"}),elaboration:(0,d.jsx)(h,{className:"h-3.5 w-3.5"}),proposal:(0,d.jsx)(i.A,{className:"h-3.5 w-3.5"}),tasks:(0,d.jsx)(j.A,{className:"h-3.5 w-3.5"})})[a]}))},[y]),A=(0,e.useCallback)(a=>{x(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),B=(0,e.useMemo)(()=>"open"===a.status?s("panel.timeline.noElaboration"):"skipped"===a.elaborationStatus?s("panel.timeline.elaborationSkipped"):"resolved"===a.elaborationStatus&&u?s("panel.timeline.elaborationComplete",{count:u.summary.totalQuestions}):"elaborating"===a.status?s("panel.timeline.elaborationInProgress"):u&&u.summary.totalQuestions>0?s("panel.timeline.elaborationComplete",{count:u.summary.totalQuestions}):s("panel.timeline.noElaboration"),[a.status,a.elaborationStatus,u,s]),C=(0,e.useMemo)(()=>{if(0===b.length)return s("panel.timeline.noProposal");let a=b.filter(a=>"approved"===a.status).length,c=b.filter(a=>"pending"===a.status).length;if(a>0&&1===b.length)return s("panel.timeline.proposalApproved");if(a>0)return s("panel.timeline.proposalsApproved",{count:a,total:b.length});if(c>0)return s("panel.timeline.proposalPending");switch(b[0].status){case"draft":default:return s("panel.timeline.proposalDraft");case"rejected":return s("panel.timeline.proposalRejected")}},[b,s]),D=(0,e.useMemo)(()=>{let a=0,c=0;for(let d of b)a+=d.documentDrafts?.length??0,c+=d.taskDrafts?.length??0;return{docCount:a,taskDraftCount:c}},[b]),E=(0,e.useMemo)(()=>{let a=c.filter(a=>"done"===a.status||"closed"===a.status).length,b=c.filter(a=>"in_progress"===a.status).length;return{done:a,inProgress:b,toVerify:c.filter(a=>"to_verify"===a.status).length,open:c.filter(a=>"open"===a.status||"assigned"===a.status).length,total:c.length}},[c]);return(0,d.jsx)("div",{className:"space-y-0",children:z.map((e,f)=>{let g=w.has(e.id),h=f===z.length-1;return(0,d.jsxs)("div",{className:"flex gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center w-5 shrink-0",children:[(0,d.jsx)("div",{className:"mt-1",children:"completed"===e.status?(0,d.jsx)("div",{className:"h-5 w-5 rounded-full bg-[#E0F2F1] dark:bg-[#12292a] flex items-center justify-center",children:(0,d.jsx)(m.A,{className:"h-3 w-3 text-[#00796B] dark:text-[#4FD1C0]"})}):"active"===e.status?(0,d.jsx)("div",{className:"h-5 w-5 rounded-full bg-primary flex items-center justify-center",children:(0,d.jsx)(n.A,{className:"h-2 w-2 fill-white text-white"})}):(0,d.jsx)("div",{className:"h-5 w-5 rounded-full border-2 border-dashed border-[#D9D9D9] dark:border-[#3a3a40] flex items-center justify-center",children:(0,d.jsx)(n.A,{className:"h-2 w-2 text-muted-foreground"})})}),!h&&(0,d.jsx)("div",{className:"flex-1 w-px bg-border mt-1 min-h-[8px]"})]}),(0,d.jsxs)("div",{className:`flex-1 min-w-0 ${h?"pb-0":"pb-4"}`,children:[(0,d.jsxs)("button",{onClick:()=>A(e.id),className:"flex items-center gap-1.5 w-full text-left group cursor-pointer",children:[g?(0,d.jsx)(o.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):(0,d.jsx)(p.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:`text-[13px] font-medium ${"active"===e.status?"text-primary":"completed"===e.status?"text-foreground":"text-muted-foreground"}`,children:s(e.labelKey)}),!g&&(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground truncate ml-1",children:(b=>{switch(b.id){case"idea_created":return a.createdBy?a.createdBy.name:"";case"elaboration":return B;case"proposal":return C;case"tasks":return c.length>0?s("panel.timeline.tasksComplete",{done:E.done,total:E.total}):s("panel.timeline.noTasks");default:return""}})(e)})]}),(e=>{let f=w.has(e.id);switch(e.id){case"idea_created":return f?(0,d.jsxs)("div",{className:"mt-2 space-y-1.5",children:[a.createdBy&&(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:s("panel.timeline.createdBy",{name:a.createdBy.name})}),(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:(0,r.fw)(a.createdAt,t)}),a.content&&(0,d.jsxs)("p",{className:"text-[12px] text-muted-foreground line-clamp-2",children:[a.content.slice(0,120),a.content.length>120?"...":""]})]}):null;case"elaboration":return f?(0,d.jsxs)("div",{className:"mt-2 space-y-1.5",children:[(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:B}),u&&u.rounds.length>0&&(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:s("panel.timeline.rounds",{count:u.rounds.length})})]}):null;case"proposal":return f?(0,d.jsxs)("div",{className:"mt-2 space-y-1.5",children:[(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:C}),b.length>0&&(0,d.jsxs)("div",{className:"space-y-1",children:[D.docCount>0&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground",children:[(0,d.jsx)(k.A,{className:"h-3 w-3"}),(0,d.jsx)("span",{children:s("panel.timeline.documents",{count:D.docCount})})]}),D.taskDraftCount>0&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground",children:[(0,d.jsx)(j.A,{className:"h-3 w-3"}),(0,d.jsx)("span",{children:s("panel.timeline.tasks",{count:D.taskDraftCount})})]})]})]}):null;case"tasks":return f?(0,d.jsx)("div",{className:"mt-2 space-y-2",children:0===c.length?(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:s("panel.timeline.noTasks")}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("div",{className:"flex-1 h-1.5 rounded-full bg-[#F0EDE8] dark:bg-[#1f1e1c] overflow-hidden flex",children:[E.done>0&&(0,d.jsx)("div",{className:"h-full bg-[#00796B]",style:{width:`${E.done/E.total*100}%`}}),E.inProgress>0&&(0,d.jsx)("div",{className:"h-full bg-[#1976D2]",style:{width:`${E.inProgress/E.total*100}%`}}),E.toVerify>0&&(0,d.jsx)("div",{className:"h-full bg-[#7B1FA2]",style:{width:`${E.toVerify/E.total*100}%`}})]}),(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground shrink-0",children:s("panel.timeline.tasksComplete",{done:E.done,total:E.total})})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[c.slice(0,5).map(a=>(0,d.jsxs)("button",{onClick:()=>q(a.uuid),className:"flex items-center gap-2 w-full text-left rounded-md px-2 py-1.5 hover:bg-secondary transition-colors group cursor-pointer",children:[(0,d.jsx)(l.A,{className:"h-3 w-3 text-muted-foreground shrink-0 group-hover:text-primary"}),(0,d.jsx)("span",{className:`h-2 w-2 rounded-full shrink-0 ${(0,r.eT)(a.status)}`}),(0,d.jsx)("span",{className:"flex-1 text-[12px] text-foreground truncate group-hover:text-primary",children:a.title})]},a.uuid)),c.length>5&&(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground px-2",children:s("panel.timeline.moreItems",{count:c.length-5})})]})]})}):null;default:return null}})(e)]})]},e.id)})})}},48354:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{G:()=>q});var e=c(55153),f=c(5210),g=c(35603),h=c(77012),i=c(10196),j=c(7907),k=c(69972),l=c(74586),m=c(3505),n=c(63468),o=c(25959),p=a([l,o]);function q({idea:a,elaboration:b,isLoading:c,onRefresh:d,onReassign:p,canReassign:q}){let r=(0,f.c)("ideaTracker"),s=(0,f.c)("common");return c?(0,e.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,e.jsx)(g.A,{className:"h-5 w-5 animate-spin text-primary"})}):(0,e.jsxs)(m.P.div,{variants:n.qG,initial:"initial",animate:"animate",children:[(0,e.jsx)(o.p,{assignee:a.assignee,onReassign:p,editable:q}),(0,e.jsx)(j.Separator,{className:"my-5 bg-secondary"}),b&&b.rounds.length>0?(0,e.jsx)("div",{children:(0,e.jsx)(k.R,{ideaUuid:a.uuid,elaboration:b,onRefresh:d})}):"open"===a.status?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-8 text-center",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#FFF3E0] dark:bg-[#3a2a12]",children:(0,e.jsx)(h.A,{className:"h-5 w-5 text-[#E65100] dark:text-[#F0A050]"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:r("panel.elaborationNotStarted")}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:r("panel.elaborationNotStartedDesc")})]})]}):(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-8 text-center",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#E3F2FD] dark:bg-[#13253a]",children:(0,e.jsx)(h.A,{className:"h-5 w-5 text-[#1976D2] dark:text-[#5AA9F0]"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:r("panel.elaborationWaiting")}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:r("panel.elaborationWaitingDesc")})]})]}),a.content&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(j.Separator,{className:"my-5 bg-secondary"}),(0,e.jsxs)("div",{children:[(0,e.jsx)(i.J,{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("content")}),(0,e.jsx)("div",{className:"mt-2",children:(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[13px] leading-relaxed text-foreground",children:(0,e.jsx)(l.MarkdownContent,{children:a.content})})})]})]})]})}[l,o]=p.then?(await p)():p,d()}catch(a){d(a)}})},48756:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(77144).A)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]])},51084:(a,b,c)=>{c.d(b,{M:()=>N});var d=c(55153),e=c(70404),f=c(5210),g=c(6170),h=c(85713),i=c(86848),j=c(34315),k=c(47161),l=c(72770),m=c(17356),n=c(62385),o=c(49856),p=c(88769),q=c(79432),r=c(86208),s=c(80123),t=c(39976),u=c(61764),v=c(25519),w=c(42279),x=c(64572),y=c(24842),z=c(8845);z.callServer,z.findSourceMapURL;let A=(0,z.createServerReference)("705c94e797daeee4c028f99a606c267c345981f81b",z.callServer,void 0,z.findSourceMapURL,"researchIdeaAction");var B=c(65839),C=c(40678),D=c(59260);function E({ideaUuid:a,assignee:b,disabledReason:c,refreshKey:h,onStarted:i,renderAction:j,onCloseAutoFocus:k}){let l=(0,f.c)("research"),m=(0,D.kz)(),n=(0,y.Q9)(b),o=null!==n&&(m?.connections??[]).some(a=>a.agentUuid===n&&"online"===a.effectiveStatus),[p,q]=(0,e.useState)("loading"),[r,s]=(0,e.useState)(!1),t=(0,e.useRef)(!1),[u,v]=(0,e.useState)(0),w=(0,e.useRef)(void 0),x=(0,e.useCallback)(async(a,b,c)=>(w.current={agentUuid:b,instanceUuid:c},{success:!0}),[]),{start:z,pickerState:E,confirmPick:F,confirmTemporary:G,cancelPick:H,isResolving:I}=(0,B.E)({reassignNoWake:x,previewIdeaUuid:a}),J=c||(r||I?l("dispatching"):n?o?p?l(p):void 0:l("offlineHint"):l("assignmentHint")),K=async(c,d=!0)=>{if(!t.current){t.current=!0,s(!0);try{let e=c||w.current?await A(a,c,w.current):await A(a);e.success?(q(void 0),g.oR.success(l("dispatched")),w.current=void 0,i()):(d&&"assignment_required"===e.errorCode&&(0,y.Q9)(b)?(t.current=!1,z({ideaUuid:a,wake:a=>K(a,!1)})):g.oR.error(l(e.errorCode)),v(a=>a+1))}catch{g.oR.error(l("unknown"))}finally{t.current=!1,s(!1)}}};return(0,d.jsxs)(d.Fragment,{children:[j({label:l("button"),busy:r||I,disabledReason:J,onSelect:()=>{J||t.current||(w.current=void 0,K())}}),(0,d.jsx)(C.V,{open:null!==E,onCloseAutoFocus:k,agentName:"",instances:E?.instances??[],agentUuid:E?.agentUuid,onConfirm:F,onTemporaryConfirm:G,onCancel:H})]})}var F=c(35487),G=c(21687),H=c(57187);let I={default:"",research:"text-[#9A6700] focus:text-[#7A5100] focus:bg-[#FFF4CE] dark:text-[#F2C45D] dark:focus:text-[#F7D990] dark:focus:bg-[#3B2D12]",verify:"text-[#1976D2] focus:text-[#155FA0] focus:bg-[#E3F2FD] dark:text-[#64B5F6] dark:focus:text-[#90CAF9] dark:focus:bg-[#102A43]",develop:"text-[#2E7D32] focus:text-[#256628] focus:bg-[#E8F5E9] dark:text-[#72D572] dark:focus:text-[#9AE69A] dark:focus:bg-[#17351D]",yolo:"text-[#6A4FB6] focus:text-[#584098] focus:bg-[#F1ECFA] dark:text-[#B39DDB] dark:focus:text-[#D1C4E9] dark:focus:bg-[#2A2040]",destructive:"text-destructive focus:text-destructive focus:bg-destructive/10"};function J(a){return()=>{}}function K(){return!1}function L({label:a,icon:b,reason:c,onSelect:f,onTooltipEscape:g,tone:h="default"}){let i=(0,e.useId)(),j=(0,d.jsxs)(u._2,{"aria-label":a,"aria-disabled":!!c,"aria-describedby":c?i:void 0,variant:"destructive"===h?"destructive":"default",className:(0,H.cn)(I[h],c&&"cursor-default text-muted-foreground focus:bg-accent focus:text-muted-foreground dark:focus:bg-accent dark:text-muted-foreground dark:focus:text-muted-foreground"),onKeyDown:a=>{"Enter"===a.key&&(0,G.P)(a)&&a.preventDefault()},onSelect:a=>{c?a.preventDefault():f()},children:[b,(0,d.jsx)("span",{children:a}),c&&(0,d.jsx)("span",{id:i,className:"sr-only",children:c})]});return c?(0,d.jsxs)(w.m_,{children:[(0,d.jsx)(w.k$,{asChild:!0,children:j}),(0,d.jsx)(w.ZI,{side:"left",className:"z-[120] max-w-64",onEscapeKeyDown:g,children:c})]}):j}function M({label:a,icon:b,reason:c,onSelect:f,tone:g="default"}){let h=(0,e.useId)();return(0,d.jsxs)(t.$,{type:"button",variant:"ghost","aria-label":a,"aria-disabled":!!c,"aria-describedby":c?h:void 0,className:(0,H.cn)("focus-visible:ring-ring flex h-auto min-h-12 w-full items-center gap-3 whitespace-normal rounded-lg px-3 py-2 text-left text-sm outline-none transition-colors","hover:bg-accent focus-visible:ring-2 [&_svg]:size-5 [&_svg]:shrink-0",I[g],c&&"cursor-default text-muted-foreground hover:bg-transparent focus:bg-accent focus:text-muted-foreground dark:focus:bg-accent dark:text-muted-foreground dark:focus:text-muted-foreground"),onKeyDown:a=>{"Enter"===a.key&&(0,G.P)(a)&&a.preventDefault()},onClick:()=>{c||f()},children:[b,(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block font-medium",children:a}),c&&(0,d.jsx)("span",{id:h,className:"mt-0.5 block break-words whitespace-normal text-xs leading-4 text-muted-foreground",children:c})]})]})}function N(a){let b=(0,f.c)(),c=(0,f.c)("ideaTracker.panel.actions"),[y,z]=(0,e.useState)(!1),A=(0,e.useSyncExternalStore)(J,K,()=>!1),B=a.busy?c("busy"):void 0,C=B||a.stageReason||a.stageDataReason,D=async b=>{try{let d=b?new URL(`/projects/${a.projectUuid}/dashboard?panel=${a.ideaUuid}`,window.location.origin).href:a.ideaUuid;await navigator.clipboard.writeText(d),g.oR.success(c(b?"linkCopied":"uuidCopied"))}catch{g.oR.error(c("copyFailed"))}},G={ideaUuid:a.ideaUuid,assignee:a.assignee,assigneeName:a.assigneeName,proposals:a.proposals,tasks:a.tasks,onStarted:a.onStarted,disabledReason:C,onCloseAutoFocus:a.onCloseAutoFocus};return(0,d.jsx)(E,{ideaUuid:a.ideaUuid,assignee:a.assignee,disabledReason:B,onCloseAutoFocus:a.onCloseAutoFocus,refreshKey:JSON.stringify([a.proposals,a.tasks]),onStarted:a.onStarted,renderAction:f=>(0,d.jsx)(x.w,{...G,disabledReason:C||(f.busy?c("busy"):void 0),renderAction:g=>(0,d.jsx)(F.s,{...G,disabledReason:C||(g.busy?c("busy"):void 0),renderAction:x=>{let C=B||(g.busy||x.busy||f.busy?c("busy"):void 0),E=[[{label:f.label,icon:(0,d.jsx)(h.A,{}),reason:C||f.disabledReason,onSelect:f.onSelect,tone:"research"},{label:b("elaboration.verifyButton"),icon:(0,d.jsx)(i.A,{}),reason:C||a.stageReason||a.verifyReason,onSelect:a.onVerify,tone:"verify"},{label:g.label,icon:(0,d.jsx)(j.A,{}),reason:C||g.disabledReason,onSelect:g.onSelect,tone:"develop"},{label:x.label,icon:(0,d.jsx)(k.A,{}),reason:C||x.disabledReason,onSelect:x.onSelect,tone:"yolo"}],[{label:b("ideaTracker.lineage.deriveIdea"),icon:(0,d.jsx)(l.A,{}),reason:C,onSelect:a.onDerive,tone:"default"},{label:b("ideaTracker.lineage.setParentTitle"),icon:(0,d.jsx)(m.A,{}),reason:C,onSelect:a.onSetParent,tone:"default"},{label:b("ideas.actions.move"),icon:(0,d.jsx)(n.A,{}),reason:C,onSelect:a.onMove,tone:"default"},{label:b("ideas.editIdea"),icon:(0,d.jsx)(o.A,{}),reason:C||a.editReason,onSelect:a.onEdit,tone:"default"}],[{label:c("copyLink"),icon:(0,d.jsx)(p.A,{}),onSelect:()=>{D(!0)},tone:"default"},{label:c("copyUuid"),icon:(0,d.jsx)(q.A,{}),onSelect:()=>{D(!1)},tone:"default"}],[{label:b("ideas.deleteIdea"),icon:(0,d.jsx)(r.A,{}),reason:C,onSelect:a.onDelete,tone:"destructive"}]];return A?(0,d.jsxs)(v.cj,{open:y,onOpenChange:z,children:[(0,d.jsx)(v.CG,{asChild:!0,children:(0,d.jsxs)(t.$,{ref:a.triggerRef,variant:"outline",size:"sm",className:"h-11 gap-1.5 border-border px-3",children:[b("common.actions"),(0,d.jsx)(s.A,{className:"size-4","aria-hidden":!0})]})}),(0,d.jsxs)(v.h,{side:"bottom",className:"max-h-[min(82svh,44rem)] gap-0 overflow-hidden rounded-t-2xl pb-[max(1rem,env(safe-area-inset-bottom))]",onCloseAutoFocus:a.onCloseAutoFocus,children:[(0,d.jsx)("div",{className:"mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-muted-foreground/25","aria-hidden":!0}),(0,d.jsxs)(v.Fm,{className:"border-b px-4 pt-3 pb-3 text-left",children:[(0,d.jsx)(v.qp,{children:b("common.actions")}),(0,d.jsx)(v.Qs,{className:"sr-only",children:b("common.actions")})]}),(0,d.jsx)("div",{className:"overflow-y-auto overscroll-contain px-2 py-2",children:E.map((a,b)=>(0,d.jsx)("div",{className:(0,H.cn)(b>0&&"mt-1 border-t pt-1"),children:a.map(a=>(0,d.jsx)(M,{...a,onSelect:()=>{z(!1),a.onSelect()}},a.label))},b))})]})]}):(0,d.jsx)(w.Bc,{delayDuration:300,children:(0,d.jsxs)(u.rI,{open:y,onOpenChange:z,children:[(0,d.jsx)(u.ty,{asChild:!0,children:(0,d.jsxs)(t.$,{ref:a.triggerRef,variant:"outline",size:"sm",className:"h-8 gap-1.5 border-border px-2.5",children:[b("common.actions"),(0,d.jsx)(s.A,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),(0,d.jsx)(u.SQ,{align:"end",className:"z-[100] w-64 max-w-[calc(100vw-1rem)] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto",children:E.map((a,b)=>(0,d.jsxs)(e.Fragment,{children:[b>0&&(0,d.jsx)(u.mB,{}),a.map(a=>(0,d.jsx)(L,{...a,onTooltipEscape:()=>z(!1)},a.label))]},b))})]})})}})})})}},56164:(a,b,c)=>{c.d(b,{b:()=>j});var d=c(70404),e=c(69640),f=c(55153),g="horizontal",h=["horizontal","vertical"],i=d.forwardRef((a,b)=>{var c;let{decorative:d,orientation:i=g,...j}=a,k=(c=i,h.includes(c))?i:g;return(0,f.jsx)(e.sG.div,{"data-orientation":k,...d?{role:"none"}:{"aria-orientation":"vertical"===k?k:void 0,role:"separator"},...j,ref:b})});i.displayName="Separator";var j=i},57922:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{k:()=>A});var e=c(55153),f=c(70404),g=c(5210),h=c(82204),i=c.n(h),j=c(35603),k=c(48756),l=c(90025),m=c(62346),n=c(80123),o=c(81975),p=c(36015),q=c(39976),r=c(11383),s=c(47626),t=c(89084),u=c(74586),v=c(56793),w=c(63519),x=c(39604);c(69013);var y=c(6994),z=a([u]);function A({idea:a,projectUuid:b,onTaskClick:c,onDocClick:d,initialProposals:h}){let i=(0,g.c)("ideaTracker"),[l,m]=(0,f.useState)(h??[]),[n,o]=(0,f.useState)(!h),p=(0,f.useCallback)(async()=>{try{let c=await (0,x.U)(b,a.uuid);if(c.success)return m(c.data),c.data}catch(a){y.q.error("Failed to fetch proposals:",a)}finally{o(!1)}return[]},[b,a.uuid]),q=(0,f.useRef)(l);q.current=l;let{getPresence:r}=(0,s.xQ)();return((0,t.eV)("proposal",async()=>{let a=q.current;for(let b of(await p())){let c=a.find(a=>a.uuid===b.uuid);if(!c)continue;let d=new Set((c.documentDrafts??[]).map(a=>a.uuid)),e=new Set((c.taskDrafts??[]).map(a=>a.uuid)),f=(b.documentDrafts??[]).filter(a=>a.uuid&&!d.has(a.uuid)),g=(b.taskDrafts??[]).filter(a=>a.uuid&&!e.has(a.uuid)),h=[...f.map(a=>a.uuid),...g.map(a=>a.uuid)];if(h.length>0){let a=r("proposal",b.uuid)[0];if(a)for(let c of h)(0,s.fv)({entityType:"proposal",entityUuid:b.uuid,subEntityType:"draft",subEntityUuid:c,agentUuid:a.agentUuid,agentName:a.agentName,action:"mutate"})}}}),n)?(0,e.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,e.jsx)(j.A,{className:"h-5 w-5 animate-spin text-primary"})}):0===l.length?(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-[#F3E5F5] dark:bg-[#281630]",children:(0,e.jsx)(k.A,{className:"h-5 w-5 text-[#7B1FA2] dark:text-[#C98FE0]"})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:i("panel.noProposals")})]}):(0,e.jsx)("div",{className:"space-y-5",children:l.map(a=>(0,e.jsx)(B,{proposal:a,projectUuid:b,onTaskClick:c,onDocClick:d},a.uuid))})}u=(z.then?(await z)():z)[0];let D={draft:"bg-[#F5F5F5] dark:bg-[#1e1e20] text-muted-foreground",pending:"bg-[#FFF3E0] dark:bg-[#3a2a12] text-[#E65100] dark:text-[#F0A050]",approved:"bg-[#E8F5E9] dark:bg-[#14281a] text-[#5A9E6F] dark:text-[#6FD19A]",rejected:"bg-[#FFEBEE] dark:bg-[#331619] text-[#C4574C] dark:text-[#F0897E]",revised:"bg-[#E3F2FD] dark:bg-[#13253a] text-[#1976D2] dark:text-[#5AA9F0]",closed:"bg-[#F5F5F5] dark:bg-[#1e1e20] text-muted-foreground"};function B({proposal:a,projectUuid:b,onTaskClick:c,onDocClick:d}){let h=(0,g.c)("ideaTracker"),j=(0,g.c)(),k=(0,g.c)("proposals"),n=(0,g.c)("tasks"),o=(0,g.c)("documents"),s=a.documentDrafts||[],t=a.taskDrafts||[],[x,y]=(0,f.useState)(new Set),[z,A]=(0,f.useState)("cards"),[B,E]=(0,f.useState)([]),F="approved"===a.status,G=(0,f.useMemo)(()=>{let a=new Map;for(let b of B)a.set(b.title,b);return a},[B]),{dagTasks:H,dagEdges:I,dagHeight:J}=(0,f.useMemo)(()=>{let a=t.map(a=>{let b=G.get(a.title);return{uuid:b?.uuid||a.uuid,title:a.title,status:b?.status||"open",priority:a.priority||"medium"}}),b=[],c=new Map(t.map(a=>[a.uuid,a]));for(let a of t)if(a.dependsOnDraftUuids)for(let d of a.dependsOnDraftUuids){let e=G.get(a.title),f=c.get(d),g=f?G.get(f.title):void 0;b.push({from:e?.uuid||a.uuid,to:g?.uuid||d})}return{dagTasks:a,dagEdges:b,dagHeight:Math.max(350,90*a.length)}},[t,G]),K=F?B.filter(a=>"done"===a.status||"closed"===a.status).length:0;return(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h3",{className:"text-[14px] font-semibold text-foreground truncate flex-1",children:a.title}),(0,e.jsx)(p.E,{className:`text-[11px] font-semibold border-0 shrink-0 ${D[a.status]||""}`,children:j(`status.${a.status}`)})]}),a.description&&(0,e.jsx)("div",{className:"max-h-[120px] overflow-y-auto text-[13px] leading-relaxed text-foreground/80 prose prose-sm max-w-none [&_h1]:text-sm [&_h2]:text-[13px] [&_h3]:text-xs [&_p]:text-[13px] [&_p]:text-foreground/80 [&_p]:my-1.5 [&_li]:text-[13px] [&_li]:text-foreground/80 [&_ul]:my-1 [&_ol]:my-1 [&_strong]:text-foreground [&_code]:bg-secondary [&_code]:text-foreground [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_a]:text-primary",children:(0,e.jsx)(u.MarkdownContent,{children:(0,w.j)(a.description)})}),(0,e.jsxs)(i(),{href:`/projects/${b}/proposals/${a.uuid}`,className:"flex items-center gap-1 text-[13px] font-medium text-primary hover:underline",children:[h("panel.viewProposal"),(0,e.jsx)(l.A,{className:"h-3.5 w-3.5"})]}),s.length>0&&(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[1px] text-muted-foreground",children:k(F?"documents":"documentDrafts")}),(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground",children:s.length})]}),(0,e.jsx)("div",{className:"space-y-0",children:s.map((b,c)=>(0,e.jsx)(r.D,{entityType:"proposal",entityUuid:a.uuid,subEntityType:"draft",subEntityUuid:b.uuid||`draft-${c}`,badgeInside:!0,children:(0,e.jsxs)(q.$,{variant:"ghost",className:"w-full justify-start h-auto text-left flex items-center gap-2.5 py-3.5 hover:bg-background transition-colors cursor-pointer -mx-1 px-1 rounded-lg",onClick:()=>b.content&&d?.({title:b.title,type:b.type,content:b.content}),children:[(0,e.jsx)(m.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)(p.E,{variant:"outline",className:"shrink-0 text-[10px] font-medium border-border text-muted-foreground bg-secondary px-2 py-0.5 font-mono",children:o(w.y[b.type]||"typeOther")}),(0,e.jsx)("span",{className:"flex-1 min-w-0 text-left text-[13px] text-foreground truncate",children:b.title})]})},b.uuid||c))})]}),(t.length>0||B.length>0)&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between pb-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[1px] text-muted-foreground",children:k(F?"tasks":"taskDrafts")}),(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground",children:F&&B.length>0?B.length:t.length})]}),(0,e.jsxs)("span",{className:"text-[12px] text-muted-foreground",children:[K,"/",F&&B.length>0?B.length:t.length]})]}),(0,e.jsx)("div",{className:"-mx-6 border-t border-border"}),I.length>0&&(0,e.jsxs)("div",{className:"flex gap-0.5 rounded-lg border border-border bg-[#F7F6F3] dark:bg-[#1e1d1b] p-0.5 mt-3 w-fit",children:[(0,e.jsx)(q.$,{variant:"ghost",size:"sm",onClick:()=>A("cards"),className:`rounded-md px-2.5 py-1 h-auto text-[11px] font-medium transition-colors ${"cards"===z?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-muted-foreground"}`,children:k("cardsView")}),(0,e.jsx)(q.$,{variant:"ghost",size:"sm",onClick:()=>A("dag"),className:`rounded-md px-2.5 py-1 h-auto text-[11px] font-medium transition-colors ${"dag"===z?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-muted-foreground"}`,children:n("dagView")})]}),"cards"===z&&(0,e.jsx)("div",{className:"space-y-0",children:F&&B.length>0?B.map(a=>(0,e.jsx)(r.D,{entityType:"task",entityUuid:a.uuid,badgeInside:!0,children:(0,e.jsx)(C,{task:{uuid:a.uuid,title:a.title},expanded:!1,onToggle:()=>{},onNavigate:c?()=>c(a.uuid):void 0,taskStatus:a.status})},a.uuid)):t.map((b,c)=>(0,e.jsx)(r.D,{entityType:"proposal",entityUuid:a.uuid,subEntityType:"draft",subEntityUuid:b.uuid,badgeInside:!0,children:(0,e.jsx)(C,{task:b,expanded:x.has(c),onToggle:()=>{y(a=>{let b=new Set(a);return b.has(c)?b.delete(c):b.add(c),b})}})},b.uuid))}),"dag"===z&&(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsx)(v._u,{tasks:H,edges:I,readonly:!0,height:J,onNodeClick:c})})]}),0===s.length&&0===t.length&&0===B.length&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground italic",children:k("emptyContainer")})]})}let E={open:"border-[#D9D9D9] dark:border-[#3a3a40] bg-card",assigned:"border-[#1976D2] bg-[#1976D2]",in_progress:"border-[#5A9E6F] bg-[#5A9E6F]",to_verify:"border-[#7B1FA2] bg-[#7B1FA2]",done:"border-[#00796B] bg-[#00796B]",closed:"border-[#9A9A9A] bg-[#9A9A9A] dark:border-[#6b6862] dark:bg-[#6b6862]"},F={open:null,assigned:null,in_progress:{className:"bg-[#E8F5E9] dark:bg-[#14281a] text-[#5A9E6F] dark:text-[#6FD19A]",key:"inProgress"},to_verify:{className:"bg-[#F3E5F5] dark:bg-[#281630] text-[#7B1FA2] dark:text-[#C98FE0]",key:"toVerify"},done:{className:"bg-[#E0F2F1] dark:bg-[#12292a] text-[#00796B] dark:text-[#4FD1C0]",key:"done"},closed:{className:"bg-[#F5F5F5] dark:bg-[#1e1e20] text-muted-foreground",key:"done"}};function C({task:a,expanded:b,onToggle:c,onNavigate:d,taskStatus:f}){let h=(0,g.c)("proposals"),i=(0,g.c)("acceptanceCriteria"),j=(0,g.c)("status"),k=a.acceptanceCriteriaItems||[],p=!!(a.description||k.length>0),r=f?E[f]||E.open:"border-[#D9D9D9] dark:border-[#3a3a40] bg-card",s=f?F[f]:null,t=(0,e.jsx)("span",{className:`shrink-0 h-2 w-2 rounded-full border-[1.5px] ${r} transition-colors`}),u=(0,e.jsx)("span",{className:"flex-1 min-w-0 text-[13px] leading-snug truncate text-muted-foreground",children:a.title}),v=s?(0,e.jsx)("span",{className:`shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium ${s.className}`,children:j(s.key)}):null;return d?(0,e.jsxs)(q.$,{variant:"ghost",onClick:d,className:"w-full justify-start h-auto text-left flex items-center gap-2.5 py-4 cursor-pointer hover:bg-background -mx-1 px-1 rounded-lg transition-colors",children:[(0,e.jsx)(m.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t,u,v]}):(0,e.jsxs)("div",{children:[(0,e.jsxs)(q.$,{variant:"ghost",onClick:p?c:void 0,className:`w-full justify-start h-auto text-left flex items-center gap-2.5 py-4 ${p?"cursor-pointer hover:bg-background -mx-1 px-1 rounded-lg":""} transition-colors`,children:[b?(0,e.jsx)(n.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):(0,e.jsx)(l.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t,u,v]}),b&&p&&(0,e.jsxs)("div",{className:"pb-3 pl-5 space-y-3",children:[a.description&&(0,e.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:a.description}),k.length>0&&(0,e.jsxs)("div",{className:"rounded-lg bg-background p-3 space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(o.A,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,e.jsx)("span",{className:"text-[11px] font-semibold text-foreground",children:h("taskAcceptanceCriteria")})]}),(0,e.jsx)("div",{className:"space-y-1.5",children:k.map((a,b)=>(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsx)("p",{className:"text-[11px] leading-snug text-foreground/80 flex-1",children:a.description}),!1!==a.required&&(0,e.jsx)("span",{className:"shrink-0 text-[10px] font-medium text-[#E65100] dark:text-[#F0A050]",children:i("required")})]},b))})]})]})]})}d()}catch(a){d(a)}})},58350:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{D:()=>ae});var e=c(55153),f=c(70404),g=c(5210),h=c(80804),i=c(6170),j=c(63813),k=c(35603),l=c(72770),m=c(17356),n=c(10598),o=c(88769),p=c(39976),q=c(50341),r=c(36015),s=c(12909),t=c(96506),u=c(10196),v=c(29288),w=c(2067),x=c(89084),y=c(90225),z=c(48354),A=c(57922),B=c(47905),C=c(11927),D=c(93430),E=c(42236),F=c(24456),G=c(66166),H=c(86759),I=c(74208),J=c(79091),K=c(62979),L=c(65315),M=c(23956),N=c(39604),O=c(69013),P=c(62943),Q=c(17433),R=c(5200),S=c(82640),T=c(61362),U=c(51084),V=c(49206),W=c(32540),X=c(59260),Y=c(65839),Z=c(40678),$=c(77110),_=c(6994),aa=c(89256),ab=c(74753),ac=c(38662),ad=a([z,A,E,F,G,J]);function ae(a){return(0,e.jsx)(af,{...a},a.ideaUuid)}function af({ideaUuid:a,projectUuid:b,currentUserUuid:c,onClose:d,onNavigate:ad}){let ae=(0,g.c)(),af=(0,y.F7)(),ag=(0,g.c)("ideaTracker"),ah=(0,g.c)("status"),ai=(0,g.c)("ideaTracker.lineage"),aj=(0,h.r)(),ak=(0,X.kz)(),al=ak?.activeSessionsByIdea.get(a)??[],[am,an]=(0,f.useState)(null),[ao,ap]=(0,f.useState)(!0),[aq,ar]=(0,f.useState)(null),[as,at]=(0,f.useState)([]),[au,av]=(0,f.useState)([]),[aw,ax]=(0,f.useState)(null),[ay,az]=(0,f.useState)(null),aA=(0,f.useRef)(0),aB=(0,f.useRef)(0),[aC,aD]=(0,f.useState)("overview"),[aE,aF]=(0,f.useState)(new Set(["overview"])),[aG,aH]=(0,f.useState)(!1),[aI,aJ]=(0,f.useState)(0),[aK,aL]=(0,f.useState)(!1),[aM,aN]=(0,f.useState)(!1),[aO,aP]=(0,f.useState)(!1),aQ=(0,f.useRef)(null),aR=(0,f.useCallback)(a=>{a.preventDefault(),aQ.current?.focus()},[]),[aS,aT]=(0,f.useState)(null),[aU,aV]=(0,f.useState)(!0),[aW,aX]=(0,f.useState)(!1),[aY,aZ]=(0,f.useState)(null),[a$,a_]=(0,f.useState)(!1),{start:a0,pickerState:a1,confirmPick:a2,cancelPick:a3,isResolving:a4}=(0,Y.E)({reassignNoWake:$.U,previewIdeaUuid:am?.uuid}),[a5,a6]=(0,f.useState)(!1),[a7,a8]=(0,f.useState)(""),[a9,ba]=(0,f.useState)(""),[bb,bc]=(0,f.useState)(!1),[bd,be]=(0,f.useState)(null),[bf,bg]=(0,f.useState)(!1),[bh,bi]=(0,f.useState)(!1),[bj,bk]=(0,f.useState)(!1),[bl,bm]=(0,f.useState)(!1),[bn,bo]=(0,f.useState)(null),[bp,bq]=(0,f.useState)(null),[br,bs]=(0,f.useState)(null),bt=(0,f.useCallback)(a=>{bs(null),bo(a)},[]),bu=(0,f.useCallback)(a=>{bo(null),bq(null),bs(a)},[]),[bv,bw]=(0,f.useState)(!1),[bx,by]=(0,f.useState)(!1),bz=(0,f.useCallback)(a=>{let b=new URLSearchParams(window.location.search);b.set("tab",a),window.history.replaceState(null,"",`${window.location.pathname}?${b.toString()}`)},[]),bA=(0,f.useCallback)(async()=>{try{let b=await (0,M.c)(a);b.success?(an(b.data),ar(null)):ar(ag("Not found"===b.error?"panel.notFound":"panel.loadFailed"))}catch{ar(ag("panel.loadFailed"))}finally{ap(!1)}},[a,ag]);(0,x.eV)("idea",bA),(0,x.eV)("proposal",bA),(0,x.eV)("task",bA);let bB=am?.uuid,bC=am?.status,bD=`${bB}:${bC}`,bE=(0,f.useCallback)(async()=>{let a=++aA.current;if(ax(null),bB){if("open"===bC){at([]),ax(bD);return}try{let c=await (0,N.U)(b,bB);a===aA.current&&c.success&&(at(c.data),ax(bD))}catch(a){_.q.error("Failed to fetch proposals:",a)}}},[b,bB,bC,bD]);(0,x.eV)("proposal",bE);let bF=(0,f.useCallback)(async()=>{let a=++aB.current;az(null);let c=as.filter(a=>"approved"===a.status);if(0===c.length){av([]),az(as);return}try{let d=await Promise.all(c.map(a=>(0,O.c)(b,a.uuid)));if(a!==aB.current||d.some(a=>!a.success))return;let e=d.flatMap(a=>a.success&&a.data?a.data.map(a=>({uuid:a.uuid,title:a.title,status:a.status,commentCount:a.commentCount??0,assignee:a.assignee??null,acceptanceSummary:a.acceptanceSummary??null})):[]);av(e),az(as)}catch(a){_.q.error("Failed to fetch tasks:",a)}},[b,as]);(0,x.eV)("task",bF);let bG=(0,f.useCallback)(async()=>{if(!bB)return;let a=await (0,Q.z)(bB);a.success&&a.data&&aT(a.data),aV(!1)},[bB]);(0,x.eV)("idea",bG);let bH=(0,f.useMemo)(()=>am?function(a,b,c){let d=["overview"];return d.push("elaboration"),b.length>0&&d.push("proposal"),c.length>0&&d.push("tasks"),d.push("activity"),d}(0,as,au):["overview","activity"],[am,as,au]);(0,f.useRef)(null),am&&am.badgeHint;let bI=(0,f.useMemo)(()=>au.filter(a=>"in_progress"===a.status||"assigned"===a.status||"to_verify"===a.status).length,[au]),bJ=(0,f.useCallback)(()=>{if(!bn)return void bq(null);(0,P.Q)(bn).then(a=>{a.success&&bq(a.data)}).catch(a=>_.q.error("Failed to load task details:",a))},[bn]);(0,x.eV)("task",bJ);let bK=()=>{a6(!1),a8(am?.title||""),ba(am?.content||""),be(null)},bL=async()=>{if(!am||!a7.trim())return void be(ae("ideas.titleRequired"));bc(!0),be(null);let a=await (0,K.J)({ideaUuid:am.uuid,projectUuid:b,title:a7.trim(),content:a9.trim()||null});bc(!1),a.success?(a6(!1),await bA(),aj.refresh()):be(a.error||ae("ideas.updateFailed"))},bM=async()=>{if(!am||aM)return;aN(!0);let a=await (0,L.Z)(am.uuid,b);aN(!1),a.success&&(d(),aj.refresh())},bN=async()=>{if(!am)return;aX(!0),aZ(null);let a=await (0,R.e)(am.uuid);aX(!1),a.success?(a_(!0),await bA(),aj.refresh()):aZ(a.error||ae("elaboration.verifyFailed"))},bO=async a=>{if(!am)return;bg(!0),an({...am,isContainer:a});let c=await (0,K.J)({ideaUuid:am.uuid,projectUuid:b,title:am.title,content:am.content??null,isContainer:a});bg(!1),c.success?(await bA(),aj.refresh()):(an({...am,isContainer:!a}),i.oR.error(c.error||ae("ideas.updateFailed")))},bP=am?.derivedStatus||"todo",bQ=am?.isContainer===!0,bR=null!==am&&af,bS=(0,T.o)({ideaStatus:am?.status,elaborationStatus:am?.elaborationStatus,elaboration:aS});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:d}),(0,e.jsxs)("div",{className:`fixed right-0 top-14 md:top-0 z-50 flex h-[calc(100%-3.5rem)] md:h-full w-full md:w-[480px] flex-col border-l border-border bg-card shadow-xl ${bx?"":"animate-in slide-in-from-right duration-300"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between border-b border-secondary px-6 py-5",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:ao?(0,e.jsx)("div",{className:"h-5 w-40 animate-pulse rounded bg-secondary"}):am?a5?(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground",children:ae("ideas.editIdea")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:`text-[11px] font-semibold uppercase tracking-wider ${bQ?"text-primary":"text-muted-foreground"}`,children:bQ?ai("typeTheme"):ai("typeIdea")}),(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground truncate",children:am.title}),(0,e.jsxs)("div",{className:"mt-1.5 flex min-w-0 items-center gap-2",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[(0,e.jsx)(r.E,{className:ab._5[bP]||ab._5.todo,children:am.badgeHint?ag(`badge.${ab.Wl[am.badgeHint]||"open"}`):ah(ab.Bj[bP]||"todo")}),bQ&&am.childProgress&&am.childProgress.total>0&&(0,e.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs font-medium text-primary",title:ai("childrenDone",{done:am.childProgress.done,total:am.childProgress.total}),children:[(0,e.jsx)(ac.C,{done:am.childProgress.done,total:am.childProgress.total,size:13,stroke:2}),am.childProgress.done,"/",am.childProgress.total]}),(0,e.jsx)("span",{className:"min-w-0 truncate whitespace-nowrap text-xs text-muted-foreground",title:(0,aa.r)(am.createdAt),children:(0,aa.r)(am.createdAt)})]}),al.length>0&&ak&&(0,e.jsx)(W.U,{sessions:al,onSelect:ak.openChatForActiveSession,surface:"sidebar",className:"shrink-0"})]})]}):(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground",children:ag("panel.notFound")})}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-2 ml-3",children:[am&&!ao&&!a5&&af&&(0,e.jsx)(U.M,{ideaUuid:am.uuid,projectUuid:b,assignee:am.assignee,assigneeName:am.assignee?.name,proposals:as,tasks:au,triggerRef:aQ,busy:aM||aW||a4||bb||bf||null!==a1,stageReason:bQ?ai("containerHint"):void 0,stageDataReason:aw!==bD||ay!==as?ag("panel.actions.loadingStage"):void 0,verifyReason:aU?ag("loading"):a$?ae("elaboration.verifiedQueuedHint"):bS?void 0:ag("panel.actions.verifyUnavailable"),editReason:"elaborated"===am.status?ag("panel.actions.editUnavailable"):void 0,onVerify:()=>{!am||am.isContainer||!bS||a$||aU||aW||a4||bf||a0({ideaUuid:am.uuid,wake:bN})},onDerive:()=>bm(!0),onSetParent:()=>bk(!0),onMove:()=>bi(!0),onEdit:()=>{am&&"elaborated"!==am.status&&(a8(am.title),ba(am.content||""),be(null),a6(!0))},onDelete:()=>aP(!0),onStarted:bA,onCloseAutoFocus:aR},am.uuid),(0,e.jsx)(p.$,{variant:"outline",size:"icon",className:"h-8 w-8 border-border",onClick:a5?bK:d,"aria-label":ae("common.close"),children:(0,e.jsx)(j.A,{className:"h-4 w-4 text-muted-foreground"})})]})]}),am&&!ao&&!a5&&(0,e.jsx)("div",{className:"border-b border-secondary px-6",children:(0,e.jsx)("div",{className:"flex gap-0 -mb-px",children:bH.map(a=>(0,e.jsxs)("button",{onClick:()=>{aD(a),aH(!0),aF(b=>new Set([...b,a])),bz(a)},className:`relative flex items-center gap-1.5 px-3 py-2.5 text-[13px] font-medium transition-colors cursor-pointer ${aC===a?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-muted-foreground"}`,children:[ag(`panel.tabs.${a}`),"tasks"===a&&bI>0&&(0,e.jsx)("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-[#E3F2FD] dark:bg-[#13253a] text-[#1976D2] dark:text-[#5AA9F0] text-[10px] font-semibold leading-none",children:bI}),"activity"===a&&aI>0&&(0,e.jsx)("span",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded-full bg-secondary text-muted-foreground text-[10px] font-semibold leading-none",children:aI})]},a))})}),(0,e.jsx)(q.F,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:(0,e.jsx)("div",{className:"flex min-h-full flex-col px-6 py-5",children:ao?(0,e.jsxs)("div",{className:"flex flex-1 items-center justify-center py-12",children:[(0,e.jsx)(k.A,{className:"h-6 w-6 animate-spin text-primary"}),(0,e.jsx)("span",{className:"ml-2 text-sm text-muted-foreground",children:ag("loading")})]}):aq?(0,e.jsx)("div",{className:"flex flex-1 items-center justify-center py-12",children:(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:aq})}):am?a5?(0,e.jsxs)("div",{className:"space-y-5",children:[bd&&(0,e.jsx)("div",{className:"rounded-lg bg-destructive/10 p-3 text-sm text-destructive",children:bd}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(u.J,{htmlFor:"edit-title",className:"text-[13px] font-medium text-foreground",children:ae("ideas.titleLabel")}),(0,e.jsx)(s.p,{id:"edit-title",value:a7,onChange:a=>a8(a.target.value),className:"border-border text-sm focus-visible:ring-primary",autoFocus:!0})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(u.J,{htmlFor:"edit-content",className:"text-[13px] font-medium text-foreground",children:ae("common.content")}),(0,e.jsx)(t.T,{id:"edit-content",value:a9,onChange:a=>ba(a.target.value),rows:8,className:"border-border text-sm resize-none focus-visible:ring-primary"})]}),(0,e.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[(0,e.jsx)(p.$,{variant:"outline",onClick:bK,disabled:bb,children:ae("common.cancel")}),(0,e.jsxs)(p.$,{onClick:bL,disabled:bb||!a7.trim(),children:[bb&&(0,e.jsx)(k.A,{className:"mr-2 h-4 w-4 animate-spin"}),ae("common.save")]})]})]}):(0,e.jsxs)(e.Fragment,{children:[a$&&(0,e.jsx)("p",{role:"status",className:"mb-4 text-xs text-muted-foreground",children:ae("elaboration.verifiedQueuedHint")}),aY&&(0,e.jsx)("p",{role:"alert",className:"mb-4 text-xs text-destructive",children:aY}),bQ&&(0,e.jsx)("p",{className:"mb-4 text-xs text-muted-foreground",children:ai("containerHint")}),aE.has("overview")&&(0,e.jsxs)("div",{style:{display:"overview"===aC?"block":"none"},children:[(0,e.jsxs)("div",{className:"mb-5 flex items-start justify-between gap-3 rounded-lg border border-[#EFEBE3] dark:border-[#2a2a2e] bg-background px-3.5 py-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,e.jsxs)(u.J,{htmlFor:"container-toggle",className:"flex items-center gap-1.5 text-[13px] font-medium text-foreground",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5 text-primary","aria-hidden":!0}),ai("container")]}),(0,e.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:ai("containerDescription")})]}),(0,e.jsx)(v.d,{id:"container-toggle",checked:bQ,disabled:bf||!af,onCheckedChange:bO,"aria-label":ai("makeContainer")})]}),(0,e.jsx)(B.p,{idea:am,proposals:as,tasks:au,onSelectTask:bt}),(0,e.jsxs)("div",{className:"mt-5 space-y-2",children:[(0,e.jsx)("div",{className:"flex items-center",children:(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5 text-primary"}),(0,e.jsx)("span",{className:"text-[12px] font-semibold text-foreground/80",children:ai("title")})]})}),am.parent?(0,e.jsxs)("button",{type:"button",onClick:()=>ad?.(am.parent.uuid),className:"flex w-full items-center gap-2 rounded-lg bg-background px-3 py-2.5 text-left transition-colors hover:bg-secondary",children:[(0,e.jsx)(m.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"shrink-0 text-[12px] text-muted-foreground",children:ai("derivedFrom")}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12px] font-medium text-foreground/80",children:am.parent.title})]}):(0,e.jsx)("p",{className:"px-1 text-[12px] text-muted-foreground",children:ai("noParent")}),am.children&&am.children.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-1 pt-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{className:"text-[12px] font-medium text-foreground/80",children:ai("derivedIdeas")}),(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground",children:am.children.length})]}),(()=>{let a=am.children.filter(a=>"done"===a.derivedStatus).length,b=am.children.length;return(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground",title:ai("childrenDone",{done:a,total:b}),children:[(0,e.jsx)(ac.C,{done:a,total:b,size:14,stroke:2}),a,"/",b]})})()]}),(0,e.jsx)("div",{className:"overflow-hidden rounded-lg border border-[#EFEBE3] dark:border-[#2a2a2e]",children:am.children.map((a,b)=>(0,e.jsxs)("div",{children:[b>0&&(0,e.jsx)("div",{className:"h-px bg-[#F0EEEA] dark:bg-[#1f1e1c]"}),(0,e.jsxs)("button",{type:"button",onClick:()=>ad?.(a.uuid),className:"flex w-full items-center justify-between gap-2 px-3 py-2.5 text-left transition-colors hover:bg-background",children:[(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,e.jsx)(n.A,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate text-[12px] text-foreground",children:a.title})]}),(0,e.jsx)(r.E,{className:`shrink-0 border-0 text-[10px] ${ab._5[a.derivedStatus]||ab._5.todo}`,children:ah(ab.Bj[a.derivedStatus]||"todo")})]})]},a.uuid))})]})]}),(0,e.jsx)(C.U,{projectUuid:b,ideaUuid:am.uuid,proposals:as,onDocClick:bu}),(0,e.jsxs)("div",{className:"mt-5 space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(o.A,{className:"h-3.5 w-3.5 text-primary"}),(0,e.jsx)("span",{className:"text-[12px] font-semibold text-foreground/80",children:ae("references.title")})]}),(0,e.jsx)(V.ReferencesSection,{targetType:"idea",targetUuid:am.uuid,canWrite:!0,compact:!0})]})]}),bH.includes("elaboration")&&aE.has("elaboration")&&(0,e.jsx)("div",{style:{display:"elaboration"===aC?"block":"none"},children:(0,e.jsx)(z.G,{idea:am,elaboration:aS,isLoading:aU,onRefresh:async()=>{await bG(),await bA()},onReassign:()=>aL(!0),canReassign:bR})}),bH.includes("proposal")&&aE.has("proposal")&&(0,e.jsx)("div",{style:{display:"proposal"===aC?"block":"none"},children:(0,e.jsx)(A.k,{idea:am,projectUuid:b,onTaskClick:bt,onDocClick:bu,initialProposals:as})}),bH.includes("tasks")&&aE.has("tasks")&&(0,e.jsx)("div",{style:{display:"tasks"===aC?"block":"none"},children:(0,e.jsx)(D.n,{tasks:au,projectUuid:b,proposalUuids:as.filter(a=>"approved"===a.status).map(a=>a.uuid),onSelectTask:bt})}),aE.has("activity")&&(0,e.jsx)("div",{style:{display:"activity"===aC?"block":"none"},children:(0,e.jsx)(E.x,{ideaUuid:am.uuid,currentUserUuid:c,commentCount:aI,onCommentCountChange:aJ})})]}):null})}),am&&(0,e.jsx)(w.Lt,{open:aO,onOpenChange:aP,children:(0,e.jsxs)(w.EO,{onCloseAutoFocus:aR,children:[(0,e.jsxs)(w.wd,{children:[(0,e.jsx)(w.r7,{children:ae("ideas.deleteIdea")}),(0,e.jsx)(w.$v,{children:ae("ideas.deleteIdeaConfirm",{title:am.title})})]}),(0,e.jsxs)(w.ck,{children:[(0,e.jsx)(w.Zr,{children:ae("common.cancel")}),(0,e.jsx)(w.Rx,{variant:"destructive",onClick:bM,disabled:aM,children:ae("common.delete")})]})]})})]}),(0,e.jsx)(H.h,{open:bh,onOpenChange:bi,onCloseAutoFocus:aR,ideaUuid:a,projectUuid:b,onMoved:()=>d()}),am&&(0,e.jsx)(I.d,{open:bj,onOpenChange:bk,ideaUuid:am.uuid,ideaTitle:am.title,projectUuid:b,currentParentUuid:am.parentUuid??null,descendantUuids:am.descendantUuids??[],onChanged:bA,onCloseAutoFocus:aR}),am&&(0,e.jsx)(J.i,{open:bl,onOpenChange:bm,onCloseAutoFocus:aR,projectUuid:b,parentUuid:am.uuid,parentTitle:am.title,onCreated:a=>{i.oR.success(ai("deriveIdea")),aj.refresh(),ad?.(a)}}),aK&&am&&(0,e.jsx)(S.i,{idea:{uuid:am.uuid,title:am.title,content:am.content,status:am.status,assignee:am.assignee?{type:am.assignee.type,uuid:am.assignee.uuid,name:am.assignee.name}:null},projectUuid:b,currentUserUuid:c,onClose:()=>{aL(!1),bA()}}),(0,e.jsx)(Z.V,{open:null!==a1,onCloseAutoFocus:aR,agentName:am?.assignee?.name??"",instances:a1?.instances??[],onConfirm:a2,onCancel:a3}),bn&&bp&&(0,e.jsx)(F.v,{task:bp,projectUuid:b,currentUserUuid:c,mode:bv?"sidebyside":"overlay",onClose:()=>{bo(null),bq(null)},onBack:()=>{bo(null),bq(null)}}),br&&(0,e.jsx)(G.K,{title:br.title,type:br.type,content:br.content,mode:bv?"sidebyside":"overlay",onClose:()=>bs(null),onBack:()=>bs(null)})]})}[z,A,E,F,G,J]=ad.then?(await ad)():ad,d()}catch(a){d(a)}})},62943:(a,b,c)=>{c.d(b,{Q:()=>e});var d=c(8845);let e=(0,d.createServerReference)("40137158780568bf1b9a5bcf36337723d75f1a3a82",d.callServer,void 0,d.findSourceMapURL,"getTaskAction")},63519:(a,b,c)=>{function d(a){return a.replace(/\\n/g,"\n")}c.d(b,{j:()=>d,y:()=>e});let e={prd:"typePrd",tech_design:"typeTechDesign",adr:"typeAdr",spec:"typeSpec",guide:"typeGuide",design:"typeDesign",note:"typeNote",report:"typeReport",other:"typeOther"}},66166:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{K:()=>q});var e=c(55153),f=c(70404),g=c(5210),h=c(3260),i=c(63813),j=c(39976),k=c(36015),l=c(50341),m=c(74586),n=c(63519),o=c(74753),p=a([m]);function q({title:a,type:b,content:c,mode:d="overlay",onClose:p,onBack:q}){let r=(0,g.c)("documents"),[s,t]=(0,f.useState)(!1),u="sidebyside"===d;return(0,e.jsxs)(e.Fragment,{children:[!u&&(0,e.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:p}),(0,e.jsxs)("div",{className:`fixed top-14 md:top-0 flex h-[calc(100%-3.5rem)] md:h-full w-full md:w-[480px] flex-col bg-card shadow-xl border-l border-border ${u?`z-40 ${s?"":"animate-in slide-in-from-right duration-300"}`:`z-50 right-0 ${s?"":"animate-in slide-in-from-right duration-300"}`}`,style:u?{right:`${o.L8}px`}:void 0,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between border-b border-secondary px-6 py-5",children:[q&&(0,e.jsx)(j.$,{variant:"ghost",size:"icon",className:"mr-2 h-8 w-8 shrink-0",onClick:q,children:(0,e.jsx)(h.A,{className:"h-4 w-4 text-muted-foreground"})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground truncate",children:a}),(0,e.jsx)("div",{className:"mt-1.5",children:(0,e.jsx)(k.E,{variant:"outline",className:"text-[10px] font-medium border-border text-muted-foreground bg-secondary px-2 py-0.5 font-mono",children:r(n.y[b]||"typeOther")})})]}),(0,e.jsx)(j.$,{variant:"outline",size:"icon",className:"ml-4 h-8 w-8 shrink-0 border-border",onClick:p,children:(0,e.jsx)(i.A,{className:"h-4 w-4 text-muted-foreground"})})]}),(0,e.jsx)(l.F,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:(0,e.jsx)("div",{className:"px-6 py-5 text-[13px] leading-relaxed text-foreground prose prose-sm max-w-none [&_h1]:text-lg [&_h1]:font-semibold [&_h1]:mt-4 [&_h1]:mb-2 [&_h2]:text-base [&_h2]:font-semibold [&_h2]:mt-3 [&_h2]:mb-1.5 [&_h3]:text-sm [&_h3]:font-medium [&_h3]:mt-2 [&_h3]:mb-1 [&_p]:text-[13px] [&_p]:text-foreground/80 [&_p]:my-1.5 [&_li]:text-[13px] [&_li]:text-foreground/80 [&_ul]:my-1 [&_ol]:my-1 [&_strong]:text-foreground [&_code]:text-[12px] [&_code]:bg-secondary [&_code]:text-foreground [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_pre]:bg-secondary [&_pre]:text-foreground [&_pre]:p-3 [&_pre]:rounded-lg [&_pre]:my-2 [&_a]:text-primary",children:(0,e.jsx)(m.MarkdownContent,{children:(0,n.j)(c)})})})]})]})}m=(p.then?(await p)():p)[0],d()}catch(a){d(a)}})},72770:(a,b,c)=>{c.d(b,{A:()=>d});let d=(0,c(77144).A)("git-fork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]])},74208:(a,b,c)=>{c.d(b,{d:()=>t});var d=c(55153),e=c(70404),f=c(5210),g=c(80804),h=c(6170),i=c(35603);let j=(0,c(77144).A)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var k=c(6401),l=c(39976),m=c(43840),n=c(8009),o=c(57187),p=c(8845);let q=(0,p.createServerReference)("40d456abe03a8e8a848f0f7596b1346c4dfbee2e5a",p.callServer,void 0,p.findSourceMapURL,"getProjectIdeasForPickerAction"),r=(0,p.createServerReference)("60ef4c89da4284b463b29483a407dec4dfdde59fb6",p.callServer,void 0,p.findSourceMapURL,"setIdeaParentAction");var s=c(6994);function t({open:a,onOpenChange:b,ideaUuid:c,ideaTitle:p,projectUuid:t,currentParentUuid:u,descendantUuids:v,onChanged:w,onCloseAutoFocus:x}){let y=(0,f.c)("ideaTracker.lineage"),z=(0,f.c)("common"),A=(0,g.r)(),[B,C]=(0,e.useState)([]),[D,E]=(0,e.useState)(!1),[F,G]=(0,e.useState)(!1),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(null),L=new Set([c,...v]);(0,e.useCallback)(async()=>{G(!0),K(null);try{let a=await q(t);a.success?(C(a.data),E(a.hasMore)):K(a.error)}catch(a){s.q.error("Failed to load parent candidates:",a),K(y("saveFailed"))}G(!1)},[t,y]);let M=async a=>{if(!H){I(!0),K(null);try{let d=await r(c,a);d.success?(h.oR.success(a?y("save"):y("detach")),b(!1),A.refresh(),w()):K(d.error||y("saveFailed"))}catch(a){K(a instanceof Error?a.message:y("saveFailed"))}I(!1)}};return(0,d.jsx)(m.lG,{open:a,onOpenChange:b,children:(0,d.jsxs)(m.Cf,{onCloseAutoFocus:x,children:[(0,d.jsxs)(m.c7,{children:[(0,d.jsx)(m.L3,{children:y("setParentTitle")}),(0,d.jsx)(m.rr,{children:y("setParentDescription",{title:p})})]}),(0,d.jsxs)("div",{className:"min-w-0 space-y-3 pt-1",children:[F?(0,d.jsx)("div",{className:"flex h-40 items-center justify-center",children:(0,d.jsx)(i.A,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(0,d.jsx)("div",{className:"rounded-md border border-border",children:(0,d.jsxs)(n.uB,{children:[(0,d.jsx)(n.G7,{placeholder:y("searchPlaceholder")}),(0,d.jsxs)(n.oI,{children:[(0,d.jsx)(n.xL,{children:y("noCandidates")}),(0,d.jsx)(n.L$,{children:B.map(a=>{let b=L.has(a.uuid),c=a.uuid===u;return(0,d.jsxs)(n.h_,{value:a.title,disabled:b,onSelect:()=>{b||M(a.uuid)},className:(0,o.cn)("flex min-w-0 items-center justify-between gap-2",b&&"opacity-55",c&&"bg-primary/10"),children:[(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-foreground",children:a.title}),b&&(0,d.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-[11px] font-medium text-[#B0654A] dark:text-[#EBA890]",children:[(0,d.jsx)(j,{className:"h-3 w-3"}),y("cycleBlocked")]})]},a.uuid)})})]})]})}),(0,d.jsxs)("div",{className:"flex items-start gap-2 rounded-md bg-[#FBF0EB] dark:bg-[#221e1b] px-3 py-2.5",children:[(0,d.jsx)(k.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[#B0654A] dark:text-[#EBA890]"}),(0,d.jsx)("p",{className:"text-[12px] leading-relaxed text-[#9A5238] dark:text-[#E9A088]",children:y("cycleWarning")})]}),D&&(0,d.jsx)("p",{className:"px-1 text-[12px] text-muted-foreground",role:"status",children:y("pickerTruncated")}),J&&(0,d.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:J})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 pt-2",children:[u?(0,d.jsx)(l.$,{variant:"outline",className:"border-border",onClick:()=>M(null),disabled:H,children:y("detach")}):(0,d.jsx)("span",{}),(0,d.jsx)(l.$,{variant:"outline",className:"border-border",onClick:()=>b(!1),disabled:H,children:z("cancel")})]})]})})}},79091:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{i:()=>v});var e=c(55153),f=c(70404),g=c(5210),h=c(35603),i=c(6170),j=c(39976),k=c(43840),l=c(12909),m=c(96506),n=c(10196),o=c(2559),p=c(63284),q=c(21687),r=c(79396),s=c(59260),t=c(91981),u=a([t]);function v({open:a,onOpenChange:b,onCloseAutoFocus:c,projectUuid:d,onCreated:u,parentUuid:v,parentTitle:w}){let x=(0,g.c)("ideaTracker"),y=(0,g.c)("ideaTracker.lineage"),z=!!v,A=(0,g.c)("common"),[B,C]=(0,f.useState)(""),[D,E]=(0,f.useState)(""),[F,G]=(0,f.useState)(!1),[H,I]=(0,f.useState)(!1),[J,K]=(0,f.useState)(null),[L,M]=(0,f.useState)(!1),[N,O]=(0,f.useState)(!1),[P,Q]=(0,f.useState)(!1),[R,S]=(0,f.useState)(!1),T=(0,s.kz)(),U=(T?.connections??[]).some(a=>"online"===a.effectiveStatus),[V,W]=(0,f.useState)("form"),X=z?"form":V,Y=async()=>{let a=B.trim();if(a){I(!0),K(null);try{let c=await fetch(`/api/projects/${d}/ideas`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a,content:D.trim()||void 0,...v?{parentUuid:v}:{},...F?{isContainer:!0}:{}})}),e=await c.json();e.success&&e.data?.uuid?(C(""),E(""),G(!1),b(!1),u?.(e.data.uuid)):K(e.error||x("error.createFailed"))}catch{K(x("error.createFailed"))}finally{I(!1)}}},Z=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-4 py-2",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(n.J,{htmlFor:"idea-title",children:x("newIdea.ideaTitle")}),(0,e.jsx)(l.p,{id:"idea-title",value:B,onChange:a=>C(a.target.value),placeholder:x("newIdea.titlePlaceholder"),autoFocus:!0,onKeyDown:a=>{!(0,q.P)(a)&&"Enter"===a.key&&!a.shiftKey&&B.trim()&&(a.preventDefault(),Y())}})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(n.J,{htmlFor:"idea-content",children:[x("newIdea.description"),(0,e.jsxs)("span",{className:"ml-1 text-xs font-normal text-muted-foreground",children:["(",A("optional"),")"]})]}),(0,e.jsx)(m.T,{id:"idea-content",value:D,onChange:a=>E(a.target.value),placeholder:x("newIdea.descriptionPlaceholder"),rows:4,className:"resize-none"})]}),(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)(o.S,{id:"idea-is-container",checked:F,onCheckedChange:a=>G(!0===a),className:"mt-0.5"}),(0,e.jsxs)("div",{className:"grid gap-1 leading-none",children:[(0,e.jsx)(n.J,{htmlFor:"idea-is-container",className:"cursor-pointer",children:y("makeContainer")}),(0,e.jsx)("p",{className:"text-xs font-normal text-muted-foreground",children:y("containerHint")})]})]}),J&&(0,e.jsx)("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-[12px] text-destructive",children:J})]}),(0,e.jsxs)(k.Es,{children:[(0,e.jsx)(j.$,{variant:"outline",onClick:()=>b(!1),disabled:H,children:A("cancel")}),(0,e.jsxs)(j.$,{onClick:Y,disabled:H||!B.trim(),className:"bg-primary hover:bg-[#B56A42] text-white",children:[H?(0,e.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"}):null,A("create")]})]})]}),$=async a=>{Q(!0);try{let b=await (0,r.tm)("/api/ideas/conversational",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectUuid:d,agentUuid:a.agentUuid,connectionUuid:a.connectionUuid,descriptionText:a.userText,researchFirst:N,...L?{decompose:!0}:{}})});if(!b.ok){let a=null;try{let c=await b.json();"string"==typeof c?.error&&c.error&&(a=c.error)}catch{}throw new t.fF(b.status,a)}let c=null;try{let a=await b.json();a?.success&&a.data?.session&&(c=a.data.session)}catch{}if(!c)throw new t.fF(b.status,null);return c}finally{Q(!1)}},_=(0,e.jsxs)("div",{className:"space-y-3 py-2",children:[(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)(o.S,{id:"idea-research-first",checked:N,onCheckedChange:a=>O(!0===a),disabled:P,"aria-describedby":"idea-research-first-hint",className:"mt-0.5"}),(0,e.jsxs)("div",{className:"grid gap-1",children:[(0,e.jsx)(n.J,{htmlFor:"idea-research-first",className:"cursor-pointer",children:x("newIdea.researchFirst")}),(0,e.jsx)("p",{id:"idea-research-first-hint",className:"text-xs leading-4 text-muted-foreground",children:x("newIdea.researchFirstHint")})]})]}),(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)(o.S,{id:"idea-decompose",checked:L,disabled:P,onCheckedChange:a=>M(!0===a),className:"mt-0.5"}),(0,e.jsxs)("div",{className:"grid gap-1 leading-none",children:[(0,e.jsx)(n.J,{htmlFor:"idea-decompose",className:"cursor-pointer",children:x("newIdea.decompose")}),(0,e.jsx)("p",{className:"text-xs font-normal text-muted-foreground",children:x("newIdea.decomposeHint")})]})]}),(0,e.jsx)(t.jH,{projectUuid:d,dispatch:$,onStarted:()=>{b(!1),i.oR.success(x("newIdea.submitted"))}})]});return(0,e.jsx)(k.lG,{open:a,onOpenChange:b,children:(0,e.jsxs)(k.Cf,{className:"sm:max-w-[480px]",onCloseAutoFocus:c,children:[(0,e.jsxs)(k.c7,{children:[(0,e.jsx)(k.L3,{children:z?y("deriveIdea"):x("newIdea.title")}),z&&w&&(0,e.jsxs)("p",{className:"text-[13px] text-muted-foreground",children:[y("derivedFrom")," \xb7 ",w]})]}),!z&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.tU,{value:X,onValueChange:a=>W(a),children:(0,e.jsxs)(p.j7,{className:"grid w-full grid-cols-2",children:[(0,e.jsx)(p.Xi,{value:"form",children:x("newIdea.modeForm")}),(0,e.jsx)(p.Xi,{value:"conversation",disabled:!U&&!R,children:x("newIdea.modeConversation")})]})}),!U&&(0,e.jsxs)("div",{className:"rounded-xl border border-[#EFEBE4] dark:border-[#2a2a2e] bg-[#FCFBF8] dark:bg-[#1e1d1b] px-3 py-2",children:[(0,e.jsx)("p",{className:"px-1 pt-1 text-[12px] font-medium text-muted-foreground",children:x("newIdea.modeConversationOfflineHint")}),(0,e.jsx)(t.Bs,{variant:"compact"})]})]}),"form"===X?Z:_]})})}t=(u.then?(await u)():u)[0],d()}catch(a){d(a)}})},85903:(a,b,c)=>{c.d(b,{i:()=>e});var d=c(48996);function e(a){return`${d.W} Explicit, one-time research request for ideaUuid: ${a}.
2
2
  This is the existing Idea's root conversation. Before research and again before saving, re-read the Idea, ALL related proposals/tasks and execution history including theme descendants. If development has begun, report that the stage changed and STOP without research or edits.
3
3
  Invoke the shared research skill for ONE bounded pass (approximately 2–5 minutes, at most 5 deeply read sources). Reuse existing evidence. An explicit user instruction to skip research takes precedence. Tools unavailable, empty results, or exhausted budget: record the limitation and stop.
4
4
  Attach useful sources through existing references and obtain real UUIDs. Read the latest Idea content immediately before saving and MERGE concise findings, source citations using ref:UUID, implications, unknowns, and the stopping reason; preserve user text and existing evidence.
5
5
  Preserve all elaboration rounds, questions, answers and resolved state. Do not create or claim an Idea, start elaboration, submit or modify a Proposal, change task status, or start development. If findings affect an approved proposal, only record the impact and revision needs in the Idea.
6
- Report the findings and END this turn. This menu invocation does not resume the Idea or Proposal workflow. A later explicit Research request may run another bounded pass.`}},86787:(a,b,c)=>{c.d(b,{v:()=>k});var d=c(55153),e=c(70404),f=c(5210),g=c(35603),h=c(10196),i=c(75742),j=c(74753);function k({ideaUuid:a}){let b=(0,f.c)(),[c,k]=(0,e.useState)([]),[l,m]=(0,e.useState)(!0);return(0,e.useCallback)(async()=>{m(!0),k((await (0,i.x)(a)).activities),m(!1)},[a]),(0,d.jsxs)("div",{className:"mt-5",children:[(0,d.jsx)(h.J,{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:b("common.activity")}),(0,d.jsx)("div",{className:"mt-2",children:l?(0,d.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,d.jsx)(g.A,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):0===c.length?(0,d.jsx)("p",{className:"text-sm text-muted-foreground italic",children:b("common.noActivity")}):c.map((a,e)=>(0,d.jsxs)("div",{className:"flex items-stretch gap-2.5",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center w-2 shrink-0",children:[(0,d.jsx)("div",{className:"mt-1.5 h-2 w-2 shrink-0 rounded-full border-[1.5px] border-[#D9D9D9] dark:border-[#3a3a40] bg-card"}),e<c.length-1&&(0,d.jsx)("div",{className:"flex-1 w-px bg-border mt-1"})]}),(0,d.jsxs)("div",{className:"flex-1 pb-3",children:[(0,d.jsx)("p",{className:"text-[13px] text-foreground",children:function(a,b){let{action:c,actorName:d}=a;switch(c){case"created":case"idea_created":return b("activity.ideaCreated",{actor:d});case"assigned":case"idea_assigned":return b("activity.ideaAssigned",{actor:d});case"claimed":case"idea_claimed":return b("activity.ideaClaimed",{actor:d});case"released":case"idea_released":return b("activity.ideaReleased",{actor:d});case"status_changed":case"idea_status_changed":return b("activity.ideaStatusChanged",{actor:d});case"edited":case"idea_edited":return b("activity.ideaEdited",{actor:d});case"reparented":case"idea_reparented":return b("activity.ideaReparented",{actor:d});case"elaboration_started":return b("activity.elaborationStarted",{actor:d});case"elaboration_answered":return b("activity.elaborationAnswered",{actor:d});case"elaboration_skipped":return b("activity.elaborationSkipped",{actor:d});case"elaboration_resolved":return b("activity.elaborationResolved",{actor:d});case"elaboration_followup":return b("activity.elaborationFollowup",{actor:d});default:return b("activity.genericAction",{actor:d,action:c})}}(a,b)}),(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground",children:(0,j.fw)(a.createdAt,b)})]})]},a.uuid))})]})}},87860:(a,b,c)=>{c.d(b,{M:()=>N});var d=c(55153),e=c(70404),f=c(5210),g=c(6170),h=c(85713),i=c(86848),j=c(34315),k=c(47161),l=c(72770),m=c(17356),n=c(62385),o=c(49856),p=c(88769),q=c(79432),r=c(86208),s=c(80123),t=c(39976),u=c(61764),v=c(25519),w=c(42279),x=c(71902),y=c(24842),z=c(8845);z.callServer,z.findSourceMapURL;let A=(0,z.createServerReference)("7066101d4a51f8c0a7b92b053e4fbcbb1657c06f44",z.callServer,void 0,z.findSourceMapURL,"researchIdeaAction");var B=c(65839),C=c(40678),D=c(59260);function E({ideaUuid:a,assignee:b,disabledReason:c,refreshKey:h,onStarted:i,renderAction:j,onCloseAutoFocus:k}){let l=(0,f.c)("research"),m=(0,D.kz)(),n=(0,y.Q9)(b),o=null!==n&&(m?.connections??[]).some(a=>a.agentUuid===n&&"online"===a.effectiveStatus),[p,q]=(0,e.useState)("loading"),[r,s]=(0,e.useState)(!1),t=(0,e.useRef)(!1),[u,v]=(0,e.useState)(0),w=(0,e.useRef)(void 0),x=(0,e.useCallback)(async(a,b,c)=>(w.current={agentUuid:b,instanceUuid:c},{success:!0}),[]),{start:z,pickerState:E,confirmPick:F,confirmTemporary:G,cancelPick:H,isResolving:I}=(0,B.E)({reassignNoWake:x,previewIdeaUuid:a}),J=c||(r||I?l("dispatching"):n?o?p?l(p):void 0:l("offlineHint"):l("assignmentHint")),K=async(c,d=!0)=>{if(!t.current){t.current=!0,s(!0);try{let e=c||w.current?await A(a,c,w.current):await A(a);e.success?(q(void 0),g.oR.success(l("dispatched")),w.current=void 0,i()):(d&&"assignment_required"===e.errorCode&&(0,y.Q9)(b)?(t.current=!1,z({ideaUuid:a,wake:a=>K(a,!1)})):g.oR.error(l(e.errorCode)),v(a=>a+1))}catch{g.oR.error(l("unknown"))}finally{t.current=!1,s(!1)}}};return(0,d.jsxs)(d.Fragment,{children:[j({label:l("button"),busy:r||I,disabledReason:J,onSelect:()=>{J||t.current||(w.current=void 0,K())}}),(0,d.jsx)(C.V,{open:null!==E,onCloseAutoFocus:k,agentName:"",instances:E?.instances??[],agentUuid:E?.agentUuid,onConfirm:F,onTemporaryConfirm:G,onCancel:H})]})}var F=c(71679),G=c(21687),H=c(57187);let I={default:"",research:"text-[#9A6700] focus:text-[#7A5100] focus:bg-[#FFF4CE] dark:text-[#F2C45D] dark:focus:text-[#F7D990] dark:focus:bg-[#3B2D12]",verify:"text-[#1976D2] focus:text-[#155FA0] focus:bg-[#E3F2FD] dark:text-[#64B5F6] dark:focus:text-[#90CAF9] dark:focus:bg-[#102A43]",develop:"text-[#2E7D32] focus:text-[#256628] focus:bg-[#E8F5E9] dark:text-[#72D572] dark:focus:text-[#9AE69A] dark:focus:bg-[#17351D]",yolo:"text-[#6A4FB6] focus:text-[#584098] focus:bg-[#F1ECFA] dark:text-[#B39DDB] dark:focus:text-[#D1C4E9] dark:focus:bg-[#2A2040]",destructive:"text-destructive focus:text-destructive focus:bg-destructive/10"};function J(a){return()=>{}}function K(){return!1}function L({label:a,icon:b,reason:c,onSelect:f,onTooltipEscape:g,tone:h="default"}){let i=(0,e.useId)(),j=(0,d.jsxs)(u._2,{"aria-label":a,"aria-disabled":!!c,"aria-describedby":c?i:void 0,variant:"destructive"===h?"destructive":"default",className:(0,H.cn)(I[h],c&&"cursor-default text-muted-foreground focus:bg-accent focus:text-muted-foreground dark:focus:bg-accent dark:text-muted-foreground dark:focus:text-muted-foreground"),onKeyDown:a=>{"Enter"===a.key&&(0,G.P)(a)&&a.preventDefault()},onSelect:a=>{c?a.preventDefault():f()},children:[b,(0,d.jsx)("span",{children:a}),c&&(0,d.jsx)("span",{id:i,className:"sr-only",children:c})]});return c?(0,d.jsxs)(w.m_,{children:[(0,d.jsx)(w.k$,{asChild:!0,children:j}),(0,d.jsx)(w.ZI,{side:"left",className:"z-[120] max-w-64",onEscapeKeyDown:g,children:c})]}):j}function M({label:a,icon:b,reason:c,onSelect:f,tone:g="default"}){let h=(0,e.useId)();return(0,d.jsxs)(t.$,{type:"button",variant:"ghost","aria-label":a,"aria-disabled":!!c,"aria-describedby":c?h:void 0,className:(0,H.cn)("focus-visible:ring-ring flex h-auto min-h-12 w-full items-center gap-3 whitespace-normal rounded-lg px-3 py-2 text-left text-sm outline-none transition-colors","hover:bg-accent focus-visible:ring-2 [&_svg]:size-5 [&_svg]:shrink-0",I[g],c&&"cursor-default text-muted-foreground hover:bg-transparent focus:bg-accent focus:text-muted-foreground dark:focus:bg-accent dark:text-muted-foreground dark:focus:text-muted-foreground"),onKeyDown:a=>{"Enter"===a.key&&(0,G.P)(a)&&a.preventDefault()},onClick:()=>{c||f()},children:[b,(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block font-medium",children:a}),c&&(0,d.jsx)("span",{id:h,className:"mt-0.5 block break-words whitespace-normal text-xs leading-4 text-muted-foreground",children:c})]})]})}function N(a){let b=(0,f.c)(),c=(0,f.c)("ideaTracker.panel.actions"),[y,z]=(0,e.useState)(!1),A=(0,e.useSyncExternalStore)(J,K,()=>!1),B=a.busy?c("busy"):void 0,C=B||a.stageReason||a.stageDataReason,D=async b=>{try{let d=b?new URL(`/projects/${a.projectUuid}/dashboard?panel=${a.ideaUuid}`,window.location.origin).href:a.ideaUuid;await navigator.clipboard.writeText(d),g.oR.success(c(b?"linkCopied":"uuidCopied"))}catch{g.oR.error(c("copyFailed"))}},G={ideaUuid:a.ideaUuid,assignee:a.assignee,assigneeName:a.assigneeName,proposals:a.proposals,tasks:a.tasks,onStarted:a.onStarted,disabledReason:C,onCloseAutoFocus:a.onCloseAutoFocus};return(0,d.jsx)(E,{ideaUuid:a.ideaUuid,assignee:a.assignee,disabledReason:B,onCloseAutoFocus:a.onCloseAutoFocus,refreshKey:JSON.stringify([a.proposals,a.tasks]),onStarted:a.onStarted,renderAction:f=>(0,d.jsx)(x.w,{...G,disabledReason:C||(f.busy?c("busy"):void 0),renderAction:g=>(0,d.jsx)(F.s,{...G,disabledReason:C||(g.busy?c("busy"):void 0),renderAction:x=>{let C=B||(g.busy||x.busy||f.busy?c("busy"):void 0),E=[[{label:f.label,icon:(0,d.jsx)(h.A,{}),reason:C||f.disabledReason,onSelect:f.onSelect,tone:"research"},{label:b("elaboration.verifyButton"),icon:(0,d.jsx)(i.A,{}),reason:C||a.stageReason||a.verifyReason,onSelect:a.onVerify,tone:"verify"},{label:g.label,icon:(0,d.jsx)(j.A,{}),reason:C||g.disabledReason,onSelect:g.onSelect,tone:"develop"},{label:x.label,icon:(0,d.jsx)(k.A,{}),reason:C||x.disabledReason,onSelect:x.onSelect,tone:"yolo"}],[{label:b("ideaTracker.lineage.deriveIdea"),icon:(0,d.jsx)(l.A,{}),reason:C,onSelect:a.onDerive,tone:"default"},{label:b("ideaTracker.lineage.setParentTitle"),icon:(0,d.jsx)(m.A,{}),reason:C,onSelect:a.onSetParent,tone:"default"},{label:b("ideas.actions.move"),icon:(0,d.jsx)(n.A,{}),reason:C,onSelect:a.onMove,tone:"default"},{label:b("ideas.editIdea"),icon:(0,d.jsx)(o.A,{}),reason:C||a.editReason,onSelect:a.onEdit,tone:"default"}],[{label:c("copyLink"),icon:(0,d.jsx)(p.A,{}),onSelect:()=>{D(!0)},tone:"default"},{label:c("copyUuid"),icon:(0,d.jsx)(q.A,{}),onSelect:()=>{D(!1)},tone:"default"}],[{label:b("ideas.deleteIdea"),icon:(0,d.jsx)(r.A,{}),reason:C,onSelect:a.onDelete,tone:"destructive"}]];return A?(0,d.jsxs)(v.cj,{open:y,onOpenChange:z,children:[(0,d.jsx)(v.CG,{asChild:!0,children:(0,d.jsxs)(t.$,{ref:a.triggerRef,variant:"outline",size:"sm",className:"h-11 gap-1.5 border-border px-3",children:[b("common.actions"),(0,d.jsx)(s.A,{className:"size-4","aria-hidden":!0})]})}),(0,d.jsxs)(v.h,{side:"bottom",className:"max-h-[min(82svh,44rem)] gap-0 overflow-hidden rounded-t-2xl pb-[max(1rem,env(safe-area-inset-bottom))]",onCloseAutoFocus:a.onCloseAutoFocus,children:[(0,d.jsx)("div",{className:"mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-muted-foreground/25","aria-hidden":!0}),(0,d.jsxs)(v.Fm,{className:"border-b px-4 pt-3 pb-3 text-left",children:[(0,d.jsx)(v.qp,{children:b("common.actions")}),(0,d.jsx)(v.Qs,{className:"sr-only",children:b("common.actions")})]}),(0,d.jsx)("div",{className:"overflow-y-auto overscroll-contain px-2 py-2",children:E.map((a,b)=>(0,d.jsx)("div",{className:(0,H.cn)(b>0&&"mt-1 border-t pt-1"),children:a.map(a=>(0,d.jsx)(M,{...a,onSelect:()=>{z(!1),a.onSelect()}},a.label))},b))})]})]}):(0,d.jsx)(w.Bc,{delayDuration:300,children:(0,d.jsxs)(u.rI,{open:y,onOpenChange:z,children:[(0,d.jsx)(u.ty,{asChild:!0,children:(0,d.jsxs)(t.$,{ref:a.triggerRef,variant:"outline",size:"sm",className:"h-8 gap-1.5 border-border px-2.5",children:[b("common.actions"),(0,d.jsx)(s.A,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),(0,d.jsx)(u.SQ,{align:"end",className:"z-[100] w-64 max-w-[calc(100vw-1rem)] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto",children:E.map((a,b)=>(0,d.jsxs)(e.Fragment,{children:[b>0&&(0,d.jsx)(u.mB,{}),a.map(a=>(0,d.jsx)(L,{...a,onTooltipEscape:()=>z(!1)},a.label))]},b))})]})})}})})})}},93231:(a,b,c)=>{c.d(b,{p:()=>s});var d=c(55153),e=c(70404),f=c(5210),g=c(6462);let h=(0,c(77144).A)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]);var i=c(48756),j=c(81975),k=c(59355),l=c(62346),m=c(43353),n=c(18369),o=c(80123),p=c(90025),q=c(8845);q.callServer,q.findSourceMapURL;var r=c(74753);function s({idea:a,proposals:b,tasks:c,onSelectTask:q}){let s=(0,f.c)("ideaTracker"),t=(0,f.c)(),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(new Set),y=(0,e.useMemo)(()=>"open"===a.status?"idea_created":"elaborating"===a.status||0===b.length?"elaboration":b.some(a=>"approved"===a.status)&&c.length>0?"tasks":"proposal",[a.status,b,c]),z=(0,e.useMemo)(()=>{let a=["idea_created","elaboration","proposal","tasks"],b=a.indexOf(y);return a.map((a,c)=>({id:a,labelKey:({idea_created:"panel.timeline.ideaCreated",elaboration:"panel.timeline.elaboration",proposal:"panel.timeline.proposal",tasks:"panel.timeline.tasksProgress"})[a],status:c<b?"completed":c===b?"active":"upcoming",icon:({idea_created:(0,d.jsx)(g.A,{className:"h-3.5 w-3.5"}),elaboration:(0,d.jsx)(h,{className:"h-3.5 w-3.5"}),proposal:(0,d.jsx)(i.A,{className:"h-3.5 w-3.5"}),tasks:(0,d.jsx)(j.A,{className:"h-3.5 w-3.5"})})[a]}))},[y]),A=(0,e.useCallback)(a=>{x(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),B=(0,e.useMemo)(()=>"open"===a.status?s("panel.timeline.noElaboration"):"skipped"===a.elaborationStatus?s("panel.timeline.elaborationSkipped"):"resolved"===a.elaborationStatus&&u?s("panel.timeline.elaborationComplete",{count:u.summary.totalQuestions}):"elaborating"===a.status?s("panel.timeline.elaborationInProgress"):u&&u.summary.totalQuestions>0?s("panel.timeline.elaborationComplete",{count:u.summary.totalQuestions}):s("panel.timeline.noElaboration"),[a.status,a.elaborationStatus,u,s]),C=(0,e.useMemo)(()=>{if(0===b.length)return s("panel.timeline.noProposal");let a=b.filter(a=>"approved"===a.status).length,c=b.filter(a=>"pending"===a.status).length;if(a>0&&1===b.length)return s("panel.timeline.proposalApproved");if(a>0)return s("panel.timeline.proposalsApproved",{count:a,total:b.length});if(c>0)return s("panel.timeline.proposalPending");switch(b[0].status){case"draft":default:return s("panel.timeline.proposalDraft");case"rejected":return s("panel.timeline.proposalRejected")}},[b,s]),D=(0,e.useMemo)(()=>{let a=0,c=0;for(let d of b)a+=d.documentDrafts?.length??0,c+=d.taskDrafts?.length??0;return{docCount:a,taskDraftCount:c}},[b]),E=(0,e.useMemo)(()=>{let a=c.filter(a=>"done"===a.status||"closed"===a.status).length,b=c.filter(a=>"in_progress"===a.status).length;return{done:a,inProgress:b,toVerify:c.filter(a=>"to_verify"===a.status).length,open:c.filter(a=>"open"===a.status||"assigned"===a.status).length,total:c.length}},[c]);return(0,d.jsx)("div",{className:"space-y-0",children:z.map((e,f)=>{let g=w.has(e.id),h=f===z.length-1;return(0,d.jsxs)("div",{className:"flex gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center w-5 shrink-0",children:[(0,d.jsx)("div",{className:"mt-1",children:"completed"===e.status?(0,d.jsx)("div",{className:"h-5 w-5 rounded-full bg-[#E0F2F1] dark:bg-[#12292a] flex items-center justify-center",children:(0,d.jsx)(m.A,{className:"h-3 w-3 text-[#00796B] dark:text-[#4FD1C0]"})}):"active"===e.status?(0,d.jsx)("div",{className:"h-5 w-5 rounded-full bg-primary flex items-center justify-center",children:(0,d.jsx)(n.A,{className:"h-2 w-2 fill-white text-white"})}):(0,d.jsx)("div",{className:"h-5 w-5 rounded-full border-2 border-dashed border-[#D9D9D9] dark:border-[#3a3a40] flex items-center justify-center",children:(0,d.jsx)(n.A,{className:"h-2 w-2 text-muted-foreground"})})}),!h&&(0,d.jsx)("div",{className:"flex-1 w-px bg-border mt-1 min-h-[8px]"})]}),(0,d.jsxs)("div",{className:`flex-1 min-w-0 ${h?"pb-0":"pb-4"}`,children:[(0,d.jsxs)("button",{onClick:()=>A(e.id),className:"flex items-center gap-1.5 w-full text-left group cursor-pointer",children:[g?(0,d.jsx)(o.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):(0,d.jsx)(p.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,d.jsx)("span",{className:`text-[13px] font-medium ${"active"===e.status?"text-primary":"completed"===e.status?"text-foreground":"text-muted-foreground"}`,children:s(e.labelKey)}),!g&&(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground truncate ml-1",children:(b=>{switch(b.id){case"idea_created":return a.createdBy?a.createdBy.name:"";case"elaboration":return B;case"proposal":return C;case"tasks":return c.length>0?s("panel.timeline.tasksComplete",{done:E.done,total:E.total}):s("panel.timeline.noTasks");default:return""}})(e)})]}),(e=>{let f=w.has(e.id);switch(e.id){case"idea_created":return f?(0,d.jsxs)("div",{className:"mt-2 space-y-1.5",children:[a.createdBy&&(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:s("panel.timeline.createdBy",{name:a.createdBy.name})}),(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:(0,r.fw)(a.createdAt,t)}),a.content&&(0,d.jsxs)("p",{className:"text-[12px] text-muted-foreground line-clamp-2",children:[a.content.slice(0,120),a.content.length>120?"...":""]})]}):null;case"elaboration":return f?(0,d.jsxs)("div",{className:"mt-2 space-y-1.5",children:[(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:B}),u&&u.rounds.length>0&&(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:s("panel.timeline.rounds",{count:u.rounds.length})})]}):null;case"proposal":return f?(0,d.jsxs)("div",{className:"mt-2 space-y-1.5",children:[(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:C}),b.length>0&&(0,d.jsxs)("div",{className:"space-y-1",children:[D.docCount>0&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground",children:[(0,d.jsx)(k.A,{className:"h-3 w-3"}),(0,d.jsx)("span",{children:s("panel.timeline.documents",{count:D.docCount})})]}),D.taskDraftCount>0&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-[12px] text-muted-foreground",children:[(0,d.jsx)(j.A,{className:"h-3 w-3"}),(0,d.jsx)("span",{children:s("panel.timeline.tasks",{count:D.taskDraftCount})})]})]})]}):null;case"tasks":return f?(0,d.jsx)("div",{className:"mt-2 space-y-2",children:0===c.length?(0,d.jsx)("p",{className:"text-[12px] text-muted-foreground",children:s("panel.timeline.noTasks")}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("div",{className:"flex-1 h-1.5 rounded-full bg-[#F0EDE8] dark:bg-[#1f1e1c] overflow-hidden flex",children:[E.done>0&&(0,d.jsx)("div",{className:"h-full bg-[#00796B]",style:{width:`${E.done/E.total*100}%`}}),E.inProgress>0&&(0,d.jsx)("div",{className:"h-full bg-[#1976D2]",style:{width:`${E.inProgress/E.total*100}%`}}),E.toVerify>0&&(0,d.jsx)("div",{className:"h-full bg-[#7B1FA2]",style:{width:`${E.toVerify/E.total*100}%`}})]}),(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground shrink-0",children:s("panel.timeline.tasksComplete",{done:E.done,total:E.total})})]}),(0,d.jsxs)("div",{className:"space-y-1",children:[c.slice(0,5).map(a=>(0,d.jsxs)("button",{onClick:()=>q(a.uuid),className:"flex items-center gap-2 w-full text-left rounded-md px-2 py-1.5 hover:bg-secondary transition-colors group cursor-pointer",children:[(0,d.jsx)(l.A,{className:"h-3 w-3 text-muted-foreground shrink-0 group-hover:text-primary"}),(0,d.jsx)("span",{className:`h-2 w-2 rounded-full shrink-0 ${(0,r.eT)(a.status)}`}),(0,d.jsx)("span",{className:"flex-1 text-[12px] text-foreground truncate group-hover:text-primary",children:a.title})]},a.uuid)),c.length>5&&(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground px-2",children:s("panel.timeline.moreItems",{count:c.length-5})})]})]})}):null;default:return null}})(e)]})]},e.id)})})}},93430:(a,b,c)=>{c.d(b,{n:()=>v});var d=c(55153),e=c(70404),f=c(5210),g=c(81975),h=c(90025),i=c(80123),j=c(62346),k=c(43353),l=c(64782),m=c(82204),n=c.n(m),o=c(89084),p=c(57902),q=c(11383),r=c(79239),s=c(78718),t=c(74753);let u=["in_progress","to_verify","open","assigned","done","closed"];function v({tasks:a,projectUuid:b,proposalUuids:c,onSelectTask:m}){let v=(0,f.c)("ideaTracker"),[w,x]=(0,e.useState)({}),y=(0,e.useMemo)(()=>a.map(a=>a.uuid),[a]),z=(0,e.useCallback)(async()=>{if(0===y.length)return;let a=await (0,p.h)(y);a.success&&a.data&&x(a.data)},[y]);(0,o.eV)("task",z);let A=(0,e.useMemo)(()=>{let b=[];for(let c of u){let d=a.filter(a=>a.status===c);d.length>0&&b.push({status:c,tasks:d})}let c=new Set(u),d=a.filter(a=>!c.has(a.status));return d.length>0&&b.push({status:"other",tasks:d}),b},[a]),[B,C]=(0,e.useState)(new Set),D=(0,e.useMemo)(()=>{let b=a.length,c=a.filter(a=>"done"===a.status||"closed"===a.status).length,d=0,e=0,f=0,g=0;for(let b of a)b.acceptanceSummary&&(d+=b.acceptanceSummary.total,e+=b.acceptanceSummary.passed,f+=b.acceptanceSummary.required,g+=b.acceptanceSummary.requiredPassed);return{total:b,done:c,acTotal:d,acPassed:e,acRequired:f,acRequiredPassed:g}},[a]);return 0===a.length?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[(0,d.jsx)(g.A,{className:"h-8 w-8 text-muted-foreground"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:v("panel.taskList.noTasks")})]}):(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 rounded-lg bg-[#FAFAF7] dark:bg-[#1e1e1c] px-3 py-2",children:[(0,d.jsx)("span",{className:"text-[12px] text-muted-foreground",children:v("panel.taskList.summary",{done:D.done,total:D.total})}),D.acTotal>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-[12px] text-muted-foreground",children:"\xb7"}),(0,d.jsx)("span",{className:"text-[12px] text-muted-foreground",children:v("panel.taskList.acSummary",{passed:D.acRequiredPassed,total:D.acRequired})})]}),c.length>0&&(0,d.jsxs)(n(),{href:`/projects/${b}/tasks?proposalUuids=${c.join(",")}`,className:"ml-auto flex items-center gap-1 text-[13px] font-medium text-primary shrink-0",children:[v("panel.taskList.viewKanban"),(0,d.jsx)(h.A,{className:"h-3.5 w-3.5"})]})]}),A.map(a=>{let b=B.has(a.status);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("button",{onClick:()=>{var b;return b=a.status,void C(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"flex items-center gap-2 w-full text-left py-1.5 group cursor-pointer",children:[b?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,d.jsx)(i.A,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,d.jsx)("span",{className:`h-2 w-2 rounded-full shrink-0 ${(0,t.eT)(a.status)}`}),(0,d.jsx)("span",{className:"text-[13px] font-medium text-foreground",children:function(a,b){switch(a){case"in_progress":return b("panel.taskList.inProgress");case"to_verify":return b("panel.taskList.toVerify");case"open":return b("panel.taskList.open");case"assigned":return b("panel.taskList.assigned");case"done":return b("panel.taskList.done");case"closed":return b("panel.taskList.closed");default:return a}}(a.status,v)}),(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground ml-auto",children:a.tasks.length})]}),!b&&(0,d.jsx)("div",{className:"ml-3 space-y-0.5",children:a.tasks.map(a=>{let b=w[a.uuid]||0,c=a.acceptanceSummary;return(0,d.jsx)(q.D,{entityType:"task",entityUuid:a.uuid,badgeInside:!0,children:(0,d.jsxs)("button",{onClick:()=>m(a.uuid),className:"flex items-center gap-2 w-full text-left rounded-md px-2.5 py-2 hover:bg-secondary transition-colors group cursor-pointer",children:[(0,d.jsx)(j.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 group-hover:text-primary"}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 rounded-full shrink-0 ${(0,t.eT)(a.status)}`}),(0,d.jsx)("span",{className:"flex-1 text-[13px] text-foreground truncate group-hover:text-primary",children:a.title}),c&&c.total>0&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 shrink-0 rounded-full bg-[#F0EDE8] dark:bg-[#1f1e1c] px-1.5 py-0.5 text-[10px] text-muted-foreground",children:[(0,d.jsx)(k.A,{className:"h-2.5 w-2.5"}),c.requiredPassed,"/",c.required]}),a.assignee&&(0,d.jsxs)("span",{className:"shrink-0 inline-flex items-center gap-1 text-[10px] text-muted-foreground max-w-[72px] truncate",title:a.assignee.name,children:[(0,s.bB)(a.assignee)?(0,d.jsx)(r.AgentAvatar,{name:a.assignee.name,size:14,className:"shrink-0 rounded-full"}):(0,d.jsx)(l.A,{className:"h-2.5 w-2.5 shrink-0"}),a.assignee.name.split(/[@\s]/)[0]]}),b>0&&(0,d.jsx)("span",{className:"inline-flex items-center justify-center h-4 min-w-[16px] rounded-full bg-[#E8F5E9] dark:bg-[#14281a] text-[#2E7D32] dark:text-[#5FD07E] text-[9px] font-semibold shrink-0",title:v("panel.taskList.workersActive",{count:b}),children:b})]})},a.uuid)})})]},a.status)})]})}},95078:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{CZ:()=>s,Di:()=>r});var e=c(85903),f=c(55094),g=c(73347),h=c(30453),i=c(4509),j=c(44701),k=c(4371),l=c(48590),m=c(11490),n=c(72231),o=c(22426),p=a([g,j,k,l,m,n,o]);[g,j,k,l,m,n,o]=p.then?(await p)():p;class s extends Error{constructor(a){super(a),this.code=a}}async function q(a){for(let b=0;;b++)try{return await a()}catch(a){if(b>=2||"object"!=typeof a||!a||!("code"in a)||"P2002"!==a.code)throw a;await new Promise(a=>setTimeout(a,10*(b+1)))}}async function r(a){if(!["user","super_admin"].includes(a.actorType))throw new s("unauthorized");let{companyUuid:b,ideaUuid:c,actorUuid:d}=a,p=await g.z.idea.findFirst({where:{companyUuid:b,uuid:c}});if(!p)throw new s("idea_not_found");let r=await (0,j.wo)(b,p.assigneeType,p.assigneeUuid),t=a.selection?.agentUuid??r;if(!t)throw new s("assignment_required");if(r&&t!==r||a.temporaryCwd&&a.temporaryAgentUuid!==t)throw new s("target_changed");let u=await g.z.agent.findFirst({where:{companyUuid:b,uuid:t}});if(!u||"super_admin"!==a.actorType&&u.ownerUuid!==d)throw new s("permission_denied");let[v]=await (0,n.jj)(b,p.projectUuid,[{type:"agent",uuid:t}]);if(!v)throw new s("permission_denied");let w=(0,i.RU)(u.roles,u.permissions),x=["idea:read","idea:write","proposal:read","task:read","document:read","document:write"];if(!x.every(a=>w.has(a)))throw new s("permission_denied");let y={companyUuid:b,actorUserUuid:d,projectUuid:p.projectUuid,agentUuid:t,registeredInstanceUuid:r===t&&"agent_instance"===p.assigneeType?p.assigneeUuid:null,registeredSource:r===t&&"project_fixed"===p.cwdSource?"project_fixed":null,registeredHost:r===t?p.cwdHost:null,registeredRuntimeCwd:r===t?p.runtimeCwd:null,temporaryTarget:a.temporaryCwd},z=await (0,k.gt)(y),A=a.selection?.instanceUuid&&"project_fixed"!==z.source?await (0,k.gt)({...y,registeredInstanceUuid:a.selection.instanceUuid,registeredSource:null,registeredHost:null,registeredRuntimeCwd:null}):z,B=await g.z.daemonSession.findFirst({where:{companyUuid:b,agentUuid:t,sessionId:c}});if(!B&&"unconfigured"===A.source&&await g.z.daemonConnection.count({where:{companyUuid:b,agentUuid:t,status:"online",lastSeenAt:{gte:new Date(Date.now()-l.STALE_THRESHOLD_MS)}}})>1)throw new s("assignment_required");let C=B?.originConnectionUuid??A.connectionUuid;if(!C)throw new s("agent_offline");if("unconfigured"!==A.source&&("ready"!==A.availability||B&&(A.connectionUuid!==B.originConnectionUuid||B.runtimeCwd&&A.cwd!==B.runtimeCwd)))throw new s("ready"!==A.availability?"agent_offline":"origin_conflict");let D=(0,e.i)(c),E=(0,f.DE)(),F=await q(()=>g.z.$transaction(async e=>{await (0,o.KG)(e,b,p.projectUuid),await e.$queryRaw`SELECT uuid FROM "Idea" WHERE uuid = ${c} AND "companyUuid" = ${b} FOR UPDATE`;let f=await e.idea.findFirst({where:{companyUuid:b,uuid:c}});if(!f)throw new s("idea_not_found");if(["projectUuid","assigneeType","assigneeUuid","cwdSource","cwdHost","runtimeCwd"].some(a=>f[a]!==p[a]))throw new s("target_changed");let g=await e.agent.findFirst({where:{companyUuid:b,uuid:t}});if(!g||"super_admin"!==a.actorType&&g.ownerUuid!==d||!x.every(a=>(0,i.RU)(g.roles,g.permissions).has(a)))throw new s("permission_denied");let h=await e.project.findFirst({where:{uuid:p.projectUuid,companyUuid:b},select:{visibility:!0}});if(!h)throw new s("idea_not_found");if("private"===h.visibility){let b=async a=>a?(await e.projectMember.findUnique({where:{projectUuid_userUuid:{projectUuid:p.projectUuid,userUuid:a}},select:{role:!0}}))?.role??null:null,c=await b(g.ownerUuid),f="user"===a.actorType?await b(d):"admin";if(!c||!f||"viewer"===f)throw new s("permission_denied")}let j=await (0,o.Rf)(b,c,e);if(!j.eligible)throw new s(j.reason);let k=await e.daemonConnection.findFirst({where:{companyUuid:b,uuid:C,agentUuid:t,status:"online",lastSeenAt:{gte:new Date(Date.now()-l.STALE_THRESHOLD_MS)}}});if(!k)throw new s("agent_offline");if("unconfigured"!==A.source&&(k.host!==A.host||"registered_instance"===A.source&&!p.runtimeCwd&&k.cwd!==A.cwd))throw new s("target_changed");let m=await e.daemonSession.findFirst({where:{companyUuid:b,agentUuid:t,sessionId:c}});if(m&&(m.originConnectionUuid!==C||m.directIdeaUuid!==c||"unconfigured"!==A.source&&m.runtimeCwd&&m.runtimeCwd!==A.cwd))throw new s("origin_conflict");let n=await (0,l.resolveOrCreateSession)({companyUuid:b,agentUuid:t,sessionId:c,directIdeaUuid:c,originConnectionUuid:C,runtimeCwd:m?.runtimeCwd??A.cwd??k.cwd},e);if(n.originConnectionUuid!==C||n.directIdeaUuid!==c)throw new s("origin_conflict");await e.$queryRaw`SELECT uuid FROM "DaemonSession" WHERE uuid = ${n.uuid} FOR UPDATE`;let q=await (0,l.createPendingTurn)({sessionUuid:n.uuid,trigger:E?"research_requested":"human_instruction",promptText:D,...E?{operationPayload:{version:1,kind:"research",ideaUuid:c}}:{}},e);if(a.selection){let a=A.agentInstanceUuid??k.agentInstanceUuid;await e.idea.update({where:{uuid:c,companyUuid:b},data:{assigneeType:a?"agent_instance":"agent",assigneeUuid:a??t,assignedByType:"user",assignedByUuid:d,assignedAt:new Date,cwdSource:"project_fixed"===A.source?"project_fixed":null,cwdHost:A.host??k.host,runtimeCwd:n.runtimeCwd}})}let r=await e.notification.create({data:{companyUuid:b,projectUuid:p.projectUuid,projectName:"",recipientType:"agent",recipientUuid:t,entityType:"idea",entityUuid:c,entityTitle:p.title,action:E?"research_requested":"human_instruction",message:"Research requested",actorType:"user",actorUuid:d,actorName:"",instructionText:D}});return{session:n,turn:q,notification:r}}));return(0,l.publishTranscriptEvent)({companyUuid:b,sessionUuid:F.session.uuid,trigger:"turn_created",turn:F.turn,messages:[]}),(0,m.N_)({companyUuid:b,originConnectionUuid:C,turnUuid:F.turn.uuid,runtimeCwd:F.session.runtimeCwd}),h.B.emitChange({companyUuid:b,projectUuid:p.projectUuid,entityType:"idea",entityUuid:c,action:"updated"}),{session:F.session,sessionUuid:F.session.uuid,turnUuid:F.turn.uuid,agentUuid:t}}d()}catch(a){d(a)}})}};
6
+ Report the findings and END this turn. This menu invocation does not resume the Idea or Proposal workflow. A later explicit Research request may run another bounded pass.`}},86787:(a,b,c)=>{c.d(b,{v:()=>k});var d=c(55153),e=c(70404),f=c(5210),g=c(35603),h=c(10196),i=c(21506),j=c(74753);function k({ideaUuid:a}){let b=(0,f.c)(),[c,k]=(0,e.useState)([]),[l,m]=(0,e.useState)(!0);return(0,e.useCallback)(async()=>{m(!0),k((await (0,i.x)(a)).activities),m(!1)},[a]),(0,d.jsxs)("div",{className:"mt-5",children:[(0,d.jsx)(h.J,{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:b("common.activity")}),(0,d.jsx)("div",{className:"mt-2",children:l?(0,d.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,d.jsx)(g.A,{className:"h-4 w-4 animate-spin text-muted-foreground"})}):0===c.length?(0,d.jsx)("p",{className:"text-sm text-muted-foreground italic",children:b("common.noActivity")}):c.map((a,e)=>(0,d.jsxs)("div",{className:"flex items-stretch gap-2.5",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center w-2 shrink-0",children:[(0,d.jsx)("div",{className:"mt-1.5 h-2 w-2 shrink-0 rounded-full border-[1.5px] border-[#D9D9D9] dark:border-[#3a3a40] bg-card"}),e<c.length-1&&(0,d.jsx)("div",{className:"flex-1 w-px bg-border mt-1"})]}),(0,d.jsxs)("div",{className:"flex-1 pb-3",children:[(0,d.jsx)("p",{className:"text-[13px] text-foreground",children:function(a,b){let{action:c,actorName:d}=a;switch(c){case"created":case"idea_created":return b("activity.ideaCreated",{actor:d});case"assigned":case"idea_assigned":return b("activity.ideaAssigned",{actor:d});case"claimed":case"idea_claimed":return b("activity.ideaClaimed",{actor:d});case"released":case"idea_released":return b("activity.ideaReleased",{actor:d});case"status_changed":case"idea_status_changed":return b("activity.ideaStatusChanged",{actor:d});case"edited":case"idea_edited":return b("activity.ideaEdited",{actor:d});case"reparented":case"idea_reparented":return b("activity.ideaReparented",{actor:d});case"elaboration_started":return b("activity.elaborationStarted",{actor:d});case"elaboration_answered":return b("activity.elaborationAnswered",{actor:d});case"elaboration_skipped":return b("activity.elaborationSkipped",{actor:d});case"elaboration_resolved":return b("activity.elaborationResolved",{actor:d});case"elaboration_followup":return b("activity.elaborationFollowup",{actor:d});default:return b("activity.genericAction",{actor:d,action:c})}}(a,b)}),(0,d.jsx)("p",{className:"text-[11px] text-muted-foreground",children:(0,j.fw)(a.createdAt,b)})]})]},a.uuid))})]})}},93430:(a,b,c)=>{c.d(b,{n:()=>v});var d=c(55153),e=c(70404),f=c(5210),g=c(81975),h=c(90025),i=c(80123),j=c(62346),k=c(43353),l=c(64782),m=c(82204),n=c.n(m),o=c(89084),p=c(82175),q=c(11383),r=c(79239),s=c(78718),t=c(74753);let u=["in_progress","to_verify","open","assigned","done","closed"];function v({tasks:a,projectUuid:b,proposalUuids:c,onSelectTask:m}){let v=(0,f.c)("ideaTracker"),[w,x]=(0,e.useState)({}),y=(0,e.useMemo)(()=>a.map(a=>a.uuid),[a]),z=(0,e.useCallback)(async()=>{if(0===y.length)return;let a=await (0,p.h)(y);a.success&&a.data&&x(a.data)},[y]);(0,o.eV)("task",z);let A=(0,e.useMemo)(()=>{let b=[];for(let c of u){let d=a.filter(a=>a.status===c);d.length>0&&b.push({status:c,tasks:d})}let c=new Set(u),d=a.filter(a=>!c.has(a.status));return d.length>0&&b.push({status:"other",tasks:d}),b},[a]),[B,C]=(0,e.useState)(new Set),D=(0,e.useMemo)(()=>{let b=a.length,c=a.filter(a=>"done"===a.status||"closed"===a.status).length,d=0,e=0,f=0,g=0;for(let b of a)b.acceptanceSummary&&(d+=b.acceptanceSummary.total,e+=b.acceptanceSummary.passed,f+=b.acceptanceSummary.required,g+=b.acceptanceSummary.requiredPassed);return{total:b,done:c,acTotal:d,acPassed:e,acRequired:f,acRequiredPassed:g}},[a]);return 0===a.length?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[(0,d.jsx)(g.A,{className:"h-8 w-8 text-muted-foreground"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:v("panel.taskList.noTasks")})]}):(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 rounded-lg bg-[#FAFAF7] dark:bg-[#1e1e1c] px-3 py-2",children:[(0,d.jsx)("span",{className:"text-[12px] text-muted-foreground",children:v("panel.taskList.summary",{done:D.done,total:D.total})}),D.acTotal>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"text-[12px] text-muted-foreground",children:"\xb7"}),(0,d.jsx)("span",{className:"text-[12px] text-muted-foreground",children:v("panel.taskList.acSummary",{passed:D.acRequiredPassed,total:D.acRequired})})]}),c.length>0&&(0,d.jsxs)(n(),{href:`/projects/${b}/tasks?proposalUuids=${c.join(",")}`,className:"ml-auto flex items-center gap-1 text-[13px] font-medium text-primary shrink-0",children:[v("panel.taskList.viewKanban"),(0,d.jsx)(h.A,{className:"h-3.5 w-3.5"})]})]}),A.map(a=>{let b=B.has(a.status);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("button",{onClick:()=>{var b;return b=a.status,void C(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"flex items-center gap-2 w-full text-left py-1.5 group cursor-pointer",children:[b?(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 text-muted-foreground"}):(0,d.jsx)(i.A,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,d.jsx)("span",{className:`h-2 w-2 rounded-full shrink-0 ${(0,t.eT)(a.status)}`}),(0,d.jsx)("span",{className:"text-[13px] font-medium text-foreground",children:function(a,b){switch(a){case"in_progress":return b("panel.taskList.inProgress");case"to_verify":return b("panel.taskList.toVerify");case"open":return b("panel.taskList.open");case"assigned":return b("panel.taskList.assigned");case"done":return b("panel.taskList.done");case"closed":return b("panel.taskList.closed");default:return a}}(a.status,v)}),(0,d.jsx)("span",{className:"text-[11px] text-muted-foreground ml-auto",children:a.tasks.length})]}),!b&&(0,d.jsx)("div",{className:"ml-3 space-y-0.5",children:a.tasks.map(a=>{let b=w[a.uuid]||0,c=a.acceptanceSummary;return(0,d.jsx)(q.D,{entityType:"task",entityUuid:a.uuid,badgeInside:!0,children:(0,d.jsxs)("button",{onClick:()=>m(a.uuid),className:"flex items-center gap-2 w-full text-left rounded-md px-2.5 py-2 hover:bg-secondary transition-colors group cursor-pointer",children:[(0,d.jsx)(j.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 group-hover:text-primary"}),(0,d.jsx)("span",{className:`h-1.5 w-1.5 rounded-full shrink-0 ${(0,t.eT)(a.status)}`}),(0,d.jsx)("span",{className:"flex-1 text-[13px] text-foreground truncate group-hover:text-primary",children:a.title}),c&&c.total>0&&(0,d.jsxs)("span",{className:"inline-flex items-center gap-0.5 shrink-0 rounded-full bg-[#F0EDE8] dark:bg-[#1f1e1c] px-1.5 py-0.5 text-[10px] text-muted-foreground",children:[(0,d.jsx)(k.A,{className:"h-2.5 w-2.5"}),c.requiredPassed,"/",c.required]}),a.assignee&&(0,d.jsxs)("span",{className:"shrink-0 inline-flex items-center gap-1 text-[10px] text-muted-foreground max-w-[72px] truncate",title:a.assignee.name,children:[(0,s.bB)(a.assignee)?(0,d.jsx)(r.AgentAvatar,{name:a.assignee.name,size:14,className:"shrink-0 rounded-full"}):(0,d.jsx)(l.A,{className:"h-2.5 w-2.5 shrink-0"}),a.assignee.name.split(/[@\s]/)[0]]}),b>0&&(0,d.jsx)("span",{className:"inline-flex items-center justify-center h-4 min-w-[16px] rounded-full bg-[#E8F5E9] dark:bg-[#14281a] text-[#2E7D32] dark:text-[#5FD07E] text-[9px] font-semibold shrink-0",title:v("panel.taskList.workersActive",{count:b}),children:b})]})},a.uuid)})})]},a.status)})]})}},95078:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{CZ:()=>s,Di:()=>r});var e=c(85903),f=c(55094),g=c(73347),h=c(30453),i=c(4509),j=c(44701),k=c(4371),l=c(48590),m=c(11490),n=c(72231),o=c(22426),p=a([g,j,k,l,m,n,o]);[g,j,k,l,m,n,o]=p.then?(await p)():p;class s extends Error{constructor(a){super(a),this.code=a}}async function q(a){for(let b=0;;b++)try{return await a()}catch(a){if(b>=2||"object"!=typeof a||!a||!("code"in a)||"P2002"!==a.code)throw a;await new Promise(a=>setTimeout(a,10*(b+1)))}}async function r(a){if(!["user","super_admin"].includes(a.actorType))throw new s("unauthorized");let{companyUuid:b,ideaUuid:c,actorUuid:d}=a,p=await g.z.idea.findFirst({where:{companyUuid:b,uuid:c}});if(!p)throw new s("idea_not_found");let r=await (0,j.wo)(b,p.assigneeType,p.assigneeUuid),t=a.selection?.agentUuid??r;if(!t)throw new s("assignment_required");if(r&&t!==r||a.temporaryCwd&&a.temporaryAgentUuid!==t)throw new s("target_changed");let u=await g.z.agent.findFirst({where:{companyUuid:b,uuid:t}});if(!u||"super_admin"!==a.actorType&&u.ownerUuid!==d)throw new s("permission_denied");let[v]=await (0,n.jj)(b,p.projectUuid,[{type:"agent",uuid:t}]);if(!v)throw new s("permission_denied");let w=(0,i.RU)(u.roles,u.permissions),x=["idea:read","idea:write","proposal:read","task:read","document:read","document:write"];if(!x.every(a=>w.has(a)))throw new s("permission_denied");let y={companyUuid:b,actorUserUuid:d,projectUuid:p.projectUuid,agentUuid:t,registeredInstanceUuid:r===t&&"agent_instance"===p.assigneeType?p.assigneeUuid:null,registeredSource:r===t&&"project_fixed"===p.cwdSource?"project_fixed":null,registeredHost:r===t?p.cwdHost:null,registeredRuntimeCwd:r===t?p.runtimeCwd:null,temporaryTarget:a.temporaryCwd},z=await (0,k.gt)(y),A=a.selection?.instanceUuid&&"project_fixed"!==z.source?await (0,k.gt)({...y,registeredInstanceUuid:a.selection.instanceUuid,registeredSource:null,registeredHost:null,registeredRuntimeCwd:null}):z,B=await g.z.daemonSession.findFirst({where:{companyUuid:b,agentUuid:t,sessionId:c}});if(!B&&"unconfigured"===A.source&&await g.z.daemonConnection.count({where:{companyUuid:b,agentUuid:t,status:"online",lastSeenAt:{gte:new Date(Date.now()-l.STALE_THRESHOLD_MS)}}})>1)throw new s("assignment_required");let C=B?.originConnectionUuid??A.connectionUuid;if(!C)throw new s("agent_offline");if("unconfigured"!==A.source&&("ready"!==A.availability||B&&(A.connectionUuid!==B.originConnectionUuid||B.runtimeCwd&&A.cwd!==B.runtimeCwd)))throw new s("ready"!==A.availability?"agent_offline":"origin_conflict");let D=(0,e.i)(c),E=(0,f.DE)(),F=await q(()=>g.z.$transaction(async e=>{await (0,o.KG)(e,b,p.projectUuid),await e.$queryRaw`SELECT uuid FROM "Idea" WHERE uuid = ${c} AND "companyUuid" = ${b} FOR UPDATE`;let f=await e.idea.findFirst({where:{companyUuid:b,uuid:c}});if(!f)throw new s("idea_not_found");if(["projectUuid","assigneeType","assigneeUuid","cwdSource","cwdHost","runtimeCwd"].some(a=>f[a]!==p[a]))throw new s("target_changed");let g=await e.agent.findFirst({where:{companyUuid:b,uuid:t}});if(!g||"super_admin"!==a.actorType&&g.ownerUuid!==d||!x.every(a=>(0,i.RU)(g.roles,g.permissions).has(a)))throw new s("permission_denied");let h=await e.project.findFirst({where:{uuid:p.projectUuid,companyUuid:b},select:{visibility:!0}});if(!h)throw new s("idea_not_found");if("private"===h.visibility){let b=async a=>a?(await e.projectMember.findUnique({where:{projectUuid_userUuid:{projectUuid:p.projectUuid,userUuid:a}},select:{role:!0}}))?.role??null:null,c=await b(g.ownerUuid),f="user"===a.actorType?await b(d):"admin";if(!c||!f||"viewer"===f)throw new s("permission_denied")}let j=await (0,o.Rf)(b,c,e);if(!j.eligible)throw new s(j.reason);let k=await e.daemonConnection.findFirst({where:{companyUuid:b,uuid:C,agentUuid:t,status:"online",lastSeenAt:{gte:new Date(Date.now()-l.STALE_THRESHOLD_MS)}}});if(!k)throw new s("agent_offline");if("unconfigured"!==A.source&&(k.host!==A.host||"registered_instance"===A.source&&!p.runtimeCwd&&k.cwd!==A.cwd))throw new s("target_changed");let m=await e.daemonSession.findFirst({where:{companyUuid:b,agentUuid:t,sessionId:c}});if(m&&(m.originConnectionUuid!==C||m.directIdeaUuid!==c||"unconfigured"!==A.source&&m.runtimeCwd&&m.runtimeCwd!==A.cwd))throw new s("origin_conflict");let n=await (0,l.resolveOrCreateSession)({companyUuid:b,agentUuid:t,sessionId:c,directIdeaUuid:c,originConnectionUuid:C,runtimeCwd:m?.runtimeCwd??A.cwd??k.cwd},e);if(n.originConnectionUuid!==C||n.directIdeaUuid!==c)throw new s("origin_conflict");await e.$queryRaw`SELECT uuid FROM "DaemonSession" WHERE uuid = ${n.uuid} FOR UPDATE`;let q=await (0,l.createPendingTurn)({sessionUuid:n.uuid,trigger:E?"research_requested":"human_instruction",promptText:D,...E?{operationPayload:{version:1,kind:"research",ideaUuid:c}}:{}},e);if(a.selection){let a=A.agentInstanceUuid??k.agentInstanceUuid;await e.idea.update({where:{uuid:c,companyUuid:b},data:{assigneeType:a?"agent_instance":"agent",assigneeUuid:a??t,assignedByType:"user",assignedByUuid:d,assignedAt:new Date,cwdSource:"project_fixed"===A.source?"project_fixed":null,cwdHost:A.host??k.host,runtimeCwd:n.runtimeCwd}})}let r=await e.notification.create({data:{companyUuid:b,projectUuid:p.projectUuid,projectName:"",recipientType:"agent",recipientUuid:t,entityType:"idea",entityUuid:c,entityTitle:p.title,action:E?"research_requested":"human_instruction",message:"Research requested",actorType:"user",actorUuid:d,actorName:"",instructionText:D}});return{session:n,turn:q,notification:r}}));return(0,l.publishTranscriptEvent)({companyUuid:b,sessionUuid:F.session.uuid,trigger:"turn_created",turn:F.turn,messages:[]}),(0,m.N_)({companyUuid:b,originConnectionUuid:C,turnUuid:F.turn.uuid,runtimeCwd:F.session.runtimeCwd}),h.B.emitChange({companyUuid:b,projectUuid:p.projectUuid,entityType:"idea",entityUuid:c,action:"updated"}),{session:F.session,sessionUuid:F.session.uuid,turnUuid:F.turn.uuid,agentUuid:t}}d()}catch(a){d(a)}})}};