@lovelybunch/api 1.0.76-alpha.1 → 1.0.76-alpha.2

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 (389) hide show
  1. package/dist/lib/mcp-client.d.ts +39 -0
  2. package/dist/lib/mcp-client.js +131 -0
  3. package/dist/routes/api/v1/ai/tools.js +49 -232
  4. package/dist/routes/api/v1/proposals/[id]/route.d.ts +10 -24
  5. package/dist/routes/api/v1/proposals/[id]/route.js +10 -1
  6. package/dist/routes/api/v1/proposals/route.d.ts +2 -16
  7. package/dist/routes/api/v1/proposals/route.js +11 -8
  8. package/dist/routes/api/v1/terminal/[proposalId]/create/route.js +2 -2
  9. package/dist/routes/api/v1/terminal/code/index.d.ts +3 -0
  10. package/dist/routes/api/v1/terminal/code/index.js +5 -0
  11. package/dist/routes/api/v1/terminal/code/route.d.ts +13 -0
  12. package/dist/routes/api/v1/terminal/code/route.js +155 -0
  13. package/dist/server-with-static.js +2 -0
  14. package/dist/server.js +2 -0
  15. package/package.json +4 -4
  16. package/static/assets/{ActivityPage-DC2t-Kyv.js → ActivityPage-BIYCh5I6.js} +1 -1
  17. package/static/assets/{ApiKeysSettingsPage-DbXgxh7i.js → ApiKeysSettingsPage-uPmxt5fp.js} +1 -1
  18. package/static/assets/{ArchitectureEditPage-B5dNFxvL.js → ArchitectureEditPage-DlNQfJe3.js} +2 -2
  19. package/static/assets/{ArchitecturePage-D796d-Je.js → ArchitecturePage-z4FsbdfN.js} +1 -1
  20. package/static/assets/{AuthSettingsPage-nIgM05Yw.js → AuthSettingsPage-Ct9brG0C.js} +2 -2
  21. package/static/assets/{CallbackPage-NNbLun2S.js → CallbackPage-DrMJVPyS.js} +1 -1
  22. package/static/assets/CodePage-CFl4HO-3.js +2 -0
  23. package/static/assets/{CollapsibleSection-DbKW4cyU.js → CollapsibleSection-D_16mIbS.js} +1 -1
  24. package/static/assets/{DashboardPage-Aw1xWH4M.js → DashboardPage---KVQx1B.js} +2 -2
  25. package/static/assets/{GitPage-Hi0mdDOi.js → GitPage-CNYHAHAE.js} +3 -3
  26. package/static/assets/{GitSettingsPage-2vuCM-U-.js → GitSettingsPage-CQbe217E.js} +2 -2
  27. package/static/assets/{IdentityPage-2BzLc2EI.js → IdentityPage-BNrnoMAb.js} +2 -2
  28. package/static/assets/{ImplementationStepsEditor-BlmI5YuN.js → ImplementationStepsEditor-CpIE-yvb.js} +1 -1
  29. package/static/assets/IntegrationsSettingsPage-Bvrthw6u.js +1 -0
  30. package/static/assets/{JobDetailPage-CLEY1Z5e.js → JobDetailPage-C1uyETkW.js} +1 -1
  31. package/static/assets/{KnowledgeDetailPage-D94ukozt.js → KnowledgeDetailPage-D4ZUM3Zz.js} +1 -1
  32. package/static/assets/KnowledgeEditPage-CkO6HZ1m.js +1 -0
  33. package/static/assets/{KnowledgePage-D-ahboFK.js → KnowledgePage-DTgCuE5t.js} +1 -1
  34. package/static/assets/{LoginPage-DQ2rJliF.js → LoginPage-kNNO_ouW.js} +1 -1
  35. package/static/assets/{MailInboxPage-Bfh0_pBU.js → MailInboxPage-DFA4mCj0.js} +1 -1
  36. package/static/assets/{MailProcessingModal-NF9kjdgr.js → MailProcessingModal-Caii7A8L.js} +2 -2
  37. package/static/assets/{MailReadPage-C0QhDa1x.js → MailReadPage-DnxomkpM.js} +1 -1
  38. package/static/assets/{MailSentPage-Ctgcp1RB.js → MailSentPage-BHkc5X_Y.js} +1 -1
  39. package/static/assets/{McpSettingsPage-CFgpw5_r.js → McpSettingsPage-DFwFqNpn.js} +1 -1
  40. package/static/assets/NewKnowledgePage-Dst7m_BB.js +9 -0
  41. package/static/assets/{NewSkillPage-CvBSXZFE.js → NewSkillPage-E2godqql.js} +1 -1
  42. package/static/assets/{NewTaskPage-DRL-pyjV.js → NewTaskPage--x_FMYzw.js} +2 -2
  43. package/static/assets/{NotFoundPage-DW0gfvNA.js → NotFoundPage-CWYaoUzq.js} +1 -1
  44. package/static/assets/NotificationsSettingsPage-BgGoQm7i.js +1 -0
  45. package/static/assets/ProjectEditPage-BlQkGGW3.js +11 -0
  46. package/static/assets/{ProjectPage-78a-iVFG.js → ProjectPage-cnzG8ymb.js} +1 -1
  47. package/static/assets/PromptsSettingsPage-DEMozxxj.js +1 -0
  48. package/static/assets/{ResourceDetailPage-CLcuo4yw.js → ResourceDetailPage-D-amMTWE.js} +1 -1
  49. package/static/assets/{ResourcesPage-C0TGRawd.js → ResourcesPage-BaxxCRUq.js} +2 -2
  50. package/static/assets/RoleEditPage-Bn5nL0Hm.js +13 -0
  51. package/static/assets/{RolePage-haUf186q.js → RolePage-BOBxbE4o.js} +1 -1
  52. package/static/assets/{RulesSettingsPage-Cc8rvAvm.js → RulesSettingsPage-BX4-A4bn.js} +1 -1
  53. package/static/assets/SchedulePage-BNmUnXVu.js +4 -0
  54. package/static/assets/{SkillDetailPage-BqhoNNkM.js → SkillDetailPage-Dyvc1AIM.js} +1 -1
  55. package/static/assets/{SkillEditPage-cpSdv9D4.js → SkillEditPage-BBr2jC5s.js} +1 -1
  56. package/static/assets/{SkillsPage-Cxkm5ymf.js → SkillsPage-C8moT36F.js} +1 -1
  57. package/static/assets/{SkillsSettingsPage-DrmRher8.js → SkillsSettingsPage-D1begXXp.js} +1 -1
  58. package/static/assets/{SourceInput-C0WkiXS6.js → SourceInput-D_5iVkI5.js} +1 -1
  59. package/static/assets/{TagInput-raThOrbG.js → TagInput-C1r8NbaU.js} +1 -1
  60. package/static/assets/{TaskDetailPage-BMzce3uJ.js → TaskDetailPage-DY-hfPO_.js} +2 -2
  61. package/static/assets/TaskEditPage-BQNQc-sZ.js +1 -0
  62. package/static/assets/{TasksPage-CxKJQJ1_.js → TasksPage-ssM1z2ta.js} +3 -3
  63. package/static/assets/{TerminalPage-BWdNoEM5.js → TerminalPage-Cny60rpN.js} +1 -1
  64. package/static/assets/{TerminalSessionPage-B6_ssmNM.js → TerminalSessionPage-Cy2h1IvH.js} +2 -2
  65. package/static/assets/UserPreferencesPage-DLLHv7Sv.js +1 -0
  66. package/static/assets/{UserSettingsPage-CqooRxDi.js → UserSettingsPage-wrlm0m4w.js} +1 -1
  67. package/static/assets/{UtilitiesPage-e4IaR2YV.js → UtilitiesPage-DDdi2gjr.js} +1 -1
  68. package/static/assets/{alert-BGFBZOrZ.js → alert-ClYcOZrl.js} +1 -1
  69. package/static/assets/apl-B4CMkyY2.js +1 -0
  70. package/static/assets/{arrow-down-DXhs3vvo.js → arrow-down-C21GpXY8.js} +1 -1
  71. package/static/assets/{arrow-left-PEX5RePT.js → arrow-left-Bo3ORcvL.js} +1 -1
  72. package/static/assets/{arrow-up-D7z0QZsQ.js → arrow-up-BvV2LsrY.js} +1 -1
  73. package/static/assets/{arrow-up-down-OTrzDHIL.js → arrow-up-down-vbTTNMQ9.js} +1 -1
  74. package/static/assets/asciiarmor-Df11BRmG.js +1 -0
  75. package/static/assets/asn1-EdZsLKOL.js +1 -0
  76. package/static/assets/asterisk-B-8jnY81.js +1 -0
  77. package/static/assets/{badge-rki-Xf0E.js → badge-BIzmYH_4.js} +1 -1
  78. package/static/assets/brainfuck-C4LP7Hcl.js +1 -0
  79. package/static/assets/{browser-modal-BKnqJnf5.js → browser-modal-CkjrwJ8N.js} +1 -1
  80. package/static/assets/{card-_Grh-Otl.js → card-Bg-wA9s_.js} +1 -1
  81. package/static/assets/{chevron-left-LQtIDk73.js → chevron-left-DO-Zz6cq.js} +1 -1
  82. package/static/assets/{chevron-up-BM1GKhAV.js → chevron-up-C115Uf6r.js} +1 -1
  83. package/static/assets/{chevrons-up-Ccej0FyZ.js → chevrons-up-bgADpoQ9.js} +1 -1
  84. package/static/assets/{circle-alert-C5k9mZfC.js → circle-alert-D8dEhUnq.js} +1 -1
  85. package/static/assets/{circle-check-fwIZxHsK.js → circle-check-CS2LuTcV.js} +1 -1
  86. package/static/assets/{circle-check-big-BaFefwt0.js → circle-check-big-Bm4c-_XI.js} +1 -1
  87. package/static/assets/{circle-play-C1R46Kry.js → circle-play-N-BXePlE.js} +1 -1
  88. package/static/assets/{circle-x-CKuM1691.js → circle-x-DWHqcJFb.js} +1 -1
  89. package/static/assets/clike-B9uivgTg.js +1 -0
  90. package/static/assets/{clipboard-DWJnnRi8.js → clipboard-BBdw7Fw8.js} +1 -1
  91. package/static/assets/{clock-Diqm3Csm.js → clock-Cg9nPTux.js} +1 -1
  92. package/static/assets/clojure-BMjYHr_A.js +1 -0
  93. package/static/assets/cmake-BQqOBYOt.js +1 -0
  94. package/static/assets/cobol-CWcv1MsR.js +1 -0
  95. package/static/assets/{code-Ao0cA5nW.js → code-D21v96Wj.js} +1 -1
  96. package/static/assets/coffeescript-S37ZYGWr.js +1 -0
  97. package/static/assets/commonlisp-DBKNyK5s.js +1 -0
  98. package/static/assets/crystal-SjHAIU92.js +1 -0
  99. package/static/assets/css-BnMrqG3P.js +1 -0
  100. package/static/assets/cypher-C_CwsFkJ.js +1 -0
  101. package/static/assets/d-pRatUO7H.js +1 -0
  102. package/static/assets/diff-DbItnlRl.js +1 -0
  103. package/static/assets/dockerfile-BKs6k2Af.js +1 -0
  104. package/static/assets/{download-5iQDQeY0.js → download-ULpe9uEL.js} +1 -1
  105. package/static/assets/dtd-DF_7sFjM.js +1 -0
  106. package/static/assets/dylan-DwRh75JA.js +1 -0
  107. package/static/assets/ebnf-CDyGwa7X.js +1 -0
  108. package/static/assets/ecl-Cabwm37j.js +1 -0
  109. package/static/assets/eiffel-CnydiIhH.js +1 -0
  110. package/static/assets/elm-vLlmbW-K.js +1 -0
  111. package/static/assets/erlang-BNw1qcRV.js +1 -0
  112. package/static/assets/{external-link-B6dkiWgP.js → external-link--nEePPjR.js} +1 -1
  113. package/static/assets/{eye-DQUzAWBY.js → eye-nqxk2SXP.js} +1 -1
  114. package/static/assets/factor-kuTfRLto.js +1 -0
  115. package/static/assets/fcl-Kvtd6kyn.js +1 -0
  116. package/static/assets/{folder-git-2-CQUj8P5W.js → folder-git-2-D1jARXTb.js} +1 -1
  117. package/static/assets/forth-Ffai-XNe.js +1 -0
  118. package/static/assets/fortran-DYz_wnZ1.js +1 -0
  119. package/static/assets/gas-Bneqetm1.js +1 -0
  120. package/static/assets/gherkin-heZmZLOM.js +1 -0
  121. package/static/assets/groovy-D9Dt4D0W.js +1 -0
  122. package/static/assets/haskell-Cw1EW3IL.js +1 -0
  123. package/static/assets/haxe-H-WmDvRZ.js +1 -0
  124. package/static/assets/http-DBlCnlav.js +1 -0
  125. package/static/assets/idl-BEugSyMb.js +1 -0
  126. package/static/assets/index-80RT6UXi.js +3 -0
  127. package/static/assets/index-AIsVwTBP.js +1 -0
  128. package/static/assets/index-AeonINTL.js +1 -0
  129. package/static/assets/index-BBY4n5t-.js +1 -0
  130. package/static/assets/index-BEkvG6MQ.js +1 -0
  131. package/static/assets/index-BEvAFxs_.js +1 -0
  132. package/static/assets/index-BS_uzzCh.js +1 -0
  133. package/static/assets/index-Beun4ywN.js +2 -0
  134. package/static/assets/index-CR0uN9wO.js +1 -0
  135. package/static/assets/index-CRSfgM43.js +1 -0
  136. package/static/assets/index-CawWXqM_.js +1 -0
  137. package/static/assets/index-ChD5bDHD.js +1 -0
  138. package/static/assets/index-ClFRvTkG.js +1 -0
  139. package/static/assets/index-D8UBHQdy.js +1 -0
  140. package/static/assets/index-DCrCdQ-J.js +1 -0
  141. package/static/assets/{index-CIFIEidO.js → index-DF2yEDGL.js} +103 -103
  142. package/static/assets/index-DH_vXhd4.css +1 -0
  143. package/static/assets/index-DHmd0I4e.js +1 -0
  144. package/static/assets/index-DvIiLgyh.js +1 -0
  145. package/static/assets/index-p-EXqOgO.js +7 -0
  146. package/static/assets/{info-BvzdeJ30.js → info-jWH_Nbw8.js} +1 -1
  147. package/static/assets/javascript-iXu5QeM3.js +1 -0
  148. package/static/assets/julia-DuME0IfC.js +1 -0
  149. package/static/assets/{label-B1lgxULu.js → label-Bo7tep86.js} +1 -1
  150. package/static/assets/livescript-BwQOo05w.js +1 -0
  151. package/static/assets/lua-BgMRiT3U.js +1 -0
  152. package/static/assets/markdown-editor-B6HEtSkH.css +1 -0
  153. package/static/assets/markdown-editor-DGcgv9Jo.js +111 -0
  154. package/static/assets/mathematica-DTrFuWx2.js +1 -0
  155. package/static/assets/mbox-CNhZ1qSd.js +1 -0
  156. package/static/assets/{message-square-LKqx0LRr.js → message-square-CJkxqplf.js} +1 -1
  157. package/static/assets/mirc-CjQqDB4T.js +1 -0
  158. package/static/assets/mllike-CXdrOF99.js +1 -0
  159. package/static/assets/modelica-Dc1JOy9r.js +1 -0
  160. package/static/assets/mscgen-BA5vi2Kp.js +1 -0
  161. package/static/assets/mumps-BT43cFF4.js +1 -0
  162. package/static/assets/nginx-DdIZxoE0.js +1 -0
  163. package/static/assets/nsis-LdVXkNf5.js +1 -0
  164. package/static/assets/ntriples-BfvgReVJ.js +1 -0
  165. package/static/assets/octave-Ck1zUtKM.js +1 -0
  166. package/static/assets/oz-BzwKVEFT.js +1 -0
  167. package/static/assets/{paperclip-Cvcr3t6l.js → paperclip-Dw99lBW-.js} +1 -1
  168. package/static/assets/pascal--L3eBynH.js +1 -0
  169. package/static/assets/{pause-TaMz44vG.js → pause-CSm_MUb9.js} +1 -1
  170. package/static/assets/perl-CdXCOZ3F.js +1 -0
  171. package/static/assets/pig-CevX1Tat.js +1 -0
  172. package/static/assets/pipeline-builders-UvjOF56t.js +17 -0
  173. package/static/assets/{play-C4YxfQOO.js → play-Sq1Ji6eG.js} +1 -1
  174. package/static/assets/powershell-CFHJl5sT.js +1 -0
  175. package/static/assets/properties-C78fOPTZ.js +1 -0
  176. package/static/assets/protobuf-ChK-085T.js +1 -0
  177. package/static/assets/pug-DeIclll2.js +1 -0
  178. package/static/assets/puppet-DMA9R1ak.js +1 -0
  179. package/static/assets/python-BuPzkPfP.js +1 -0
  180. package/static/assets/q-pXgVlZs6.js +1 -0
  181. package/static/assets/r-B6wPVr8A.js +1 -0
  182. package/static/assets/{radio-group-D7Rt-k1F.js → radio-group-BfqZdNY5.js} +1 -1
  183. package/static/assets/{refresh-cw-C9ZWZi2c.js → refresh-cw-DwXF5JvK.js} +1 -1
  184. package/static/assets/rpm-CTu-6PCP.js +1 -0
  185. package/static/assets/ruby-B2Rjki9n.js +1 -0
  186. package/static/assets/sas-B4kiWyti.js +1 -0
  187. package/static/assets/scheme-C41bIUwD.js +1 -0
  188. package/static/assets/{search-C1RuN2pO.js → search-NagOQziO.js} +1 -1
  189. package/static/assets/select-XHfMw_BF.js +1 -0
  190. package/static/assets/shell-CjFT_Tl9.js +1 -0
  191. package/static/assets/sieve-C3Gn_uJK.js +1 -0
  192. package/static/assets/simple-mode-GW_nhZxv.js +1 -0
  193. package/static/assets/smalltalk-CnHTOXQT.js +1 -0
  194. package/static/assets/solr-DehyRSwq.js +1 -0
  195. package/static/assets/sparql-DkYu6x3z.js +1 -0
  196. package/static/assets/spreadsheet-BCZA_wO0.js +1 -0
  197. package/static/assets/sql-D0XecflT.js +1 -0
  198. package/static/assets/stex-C3f8Ysf7.js +1 -0
  199. package/static/assets/stylus-B533Al4x.js +1 -0
  200. package/static/assets/swift-BzpIVaGY.js +1 -0
  201. package/static/assets/{switch-LSkE6hx8.js → switch-uoWXvqqm.js} +1 -1
  202. package/static/assets/{tabs-etlvrbtm.js → tabs-Be_b96k_.js} +1 -1
  203. package/static/assets/{tag-B2iP7vv_.js → tag-wGnl5hoT.js} +1 -1
  204. package/static/assets/tcl-DVfN8rqt.js +1 -0
  205. package/static/assets/{terminal-preview-PyMHLXJ3.js → terminal-preview-BBm_7lm8.js} +1 -1
  206. package/static/assets/textile-CnDTJFAw.js +1 -0
  207. package/static/assets/tiddlywiki-DO-Gjzrf.js +1 -0
  208. package/static/assets/tiki-DGYXhP31.js +1 -0
  209. package/static/assets/toml-Bm5Em-hy.js +1 -0
  210. package/static/assets/troff-wAsdV37c.js +1 -0
  211. package/static/assets/ttcn-CfJYG6tj.js +1 -0
  212. package/static/assets/ttcn-cfg-B9xdYoR4.js +1 -0
  213. package/static/assets/turtle-B1tBg_DP.js +1 -0
  214. package/static/assets/{use-terminal-Blvh8GLp.js → use-terminal-QLr-9n4J.js} +1 -1
  215. package/static/assets/vb-CmGdzxic.js +1 -0
  216. package/static/assets/vbscript-BuJXcnF6.js +1 -0
  217. package/static/assets/velocity-D8B20fx6.js +1 -0
  218. package/static/assets/verilog-C6RDOZhf.js +1 -0
  219. package/static/assets/vhdl-lSbBsy5d.js +1 -0
  220. package/static/assets/{video-A2wzYKal.js → video-Dn8vsERP.js} +1 -1
  221. package/static/assets/webidl-ZXfAyPTL.js +1 -0
  222. package/static/assets/xquery-DzFWVndE.js +1 -0
  223. package/static/assets/yacas-BJ4BC0dw.js +1 -0
  224. package/static/assets/z80-Hz9HOZM7.js +1 -0
  225. package/static/index.html +2 -2
  226. package/dist/lib/auth/auth-manager.d.ts.map +0 -1
  227. package/dist/lib/auth/auth-manager.js.map +0 -1
  228. package/dist/lib/gait-path.d.ts.map +0 -1
  229. package/dist/lib/gait-path.js.map +0 -1
  230. package/dist/lib/git-settings.d.ts.map +0 -1
  231. package/dist/lib/git-settings.js.map +0 -1
  232. package/dist/lib/git.d.ts.map +0 -1
  233. package/dist/lib/git.js.map +0 -1
  234. package/dist/lib/jobs/global-job-scheduler.d.ts.map +0 -1
  235. package/dist/lib/jobs/global-job-scheduler.js.map +0 -1
  236. package/dist/lib/jobs/job-runner.d.ts.map +0 -1
  237. package/dist/lib/jobs/job-runner.js.map +0 -1
  238. package/dist/lib/jobs/job-scheduler.d.ts.map +0 -1
  239. package/dist/lib/jobs/job-scheduler.js.map +0 -1
  240. package/dist/lib/jobs/job-store.d.ts.map +0 -1
  241. package/dist/lib/jobs/job-store.js.map +0 -1
  242. package/dist/lib/project-paths.d.ts.map +0 -1
  243. package/dist/lib/project-paths.js.map +0 -1
  244. package/dist/lib/storage/file-storage.d.ts.map +0 -1
  245. package/dist/lib/storage/file-storage.js.map +0 -1
  246. package/dist/lib/symlinks/symlink-manager.d.ts.map +0 -1
  247. package/dist/lib/symlinks/symlink-manager.js.map +0 -1
  248. package/dist/lib/symlinks/types.d.ts.map +0 -1
  249. package/dist/lib/symlinks/types.js.map +0 -1
  250. package/dist/lib/terminal/context-helper.d.ts.map +0 -1
  251. package/dist/lib/terminal/context-helper.js.map +0 -1
  252. package/dist/lib/terminal/global-manager.d.ts.map +0 -1
  253. package/dist/lib/terminal/global-manager.js.map +0 -1
  254. package/dist/lib/terminal/shell-utils.d.ts.map +0 -1
  255. package/dist/lib/terminal/shell-utils.js.map +0 -1
  256. package/dist/lib/terminal/terminal-manager.d.ts.map +0 -1
  257. package/dist/lib/terminal/terminal-manager.js.map +0 -1
  258. package/dist/lib/user-preferences.d.ts.map +0 -1
  259. package/dist/lib/user-preferences.js.map +0 -1
  260. package/dist/middleware/auth.d.ts.map +0 -1
  261. package/dist/middleware/auth.js.map +0 -1
  262. package/dist/routes/api/v1/agents/[id]/index.d.ts.map +0 -1
  263. package/dist/routes/api/v1/agents/[id]/index.js.map +0 -1
  264. package/dist/routes/api/v1/agents/[id]/route.d.ts.map +0 -1
  265. package/dist/routes/api/v1/agents/[id]/route.js.map +0 -1
  266. package/dist/routes/api/v1/agents/index.d.ts.map +0 -1
  267. package/dist/routes/api/v1/agents/index.js.map +0 -1
  268. package/dist/routes/api/v1/agents/route.d.ts.map +0 -1
  269. package/dist/routes/api/v1/agents/route.js.map +0 -1
  270. package/dist/routes/api/v1/ai/index.d.ts.map +0 -1
  271. package/dist/routes/api/v1/ai/index.js.map +0 -1
  272. package/dist/routes/api/v1/ai/route.d.ts.map +0 -1
  273. package/dist/routes/api/v1/ai/route.js.map +0 -1
  274. package/dist/routes/api/v1/api-keys/index.d.ts.map +0 -1
  275. package/dist/routes/api/v1/api-keys/index.js.map +0 -1
  276. package/dist/routes/api/v1/api-keys/route.d.ts.map +0 -1
  277. package/dist/routes/api/v1/api-keys/route.js.map +0 -1
  278. package/dist/routes/api/v1/auth/index.d.ts.map +0 -1
  279. package/dist/routes/api/v1/auth/index.js.map +0 -1
  280. package/dist/routes/api/v1/auth/route.d.ts.map +0 -1
  281. package/dist/routes/api/v1/auth/route.js.map +0 -1
  282. package/dist/routes/api/v1/auth-settings/index.d.ts.map +0 -1
  283. package/dist/routes/api/v1/auth-settings/index.js.map +0 -1
  284. package/dist/routes/api/v1/auth-settings/route.d.ts.map +0 -1
  285. package/dist/routes/api/v1/auth-settings/route.js.map +0 -1
  286. package/dist/routes/api/v1/chats/[id]/index.d.ts.map +0 -1
  287. package/dist/routes/api/v1/chats/[id]/index.js.map +0 -1
  288. package/dist/routes/api/v1/chats/[id]/route.d.ts.map +0 -1
  289. package/dist/routes/api/v1/chats/[id]/route.js.map +0 -1
  290. package/dist/routes/api/v1/chats/index.d.ts.map +0 -1
  291. package/dist/routes/api/v1/chats/index.js.map +0 -1
  292. package/dist/routes/api/v1/chats/route.d.ts.map +0 -1
  293. package/dist/routes/api/v1/chats/route.js.map +0 -1
  294. package/dist/routes/api/v1/config/index.d.ts.map +0 -1
  295. package/dist/routes/api/v1/config/index.js.map +0 -1
  296. package/dist/routes/api/v1/config/route.d.ts.map +0 -1
  297. package/dist/routes/api/v1/config/route.js.map +0 -1
  298. package/dist/routes/api/v1/context/architecture/route.d.ts.map +0 -1
  299. package/dist/routes/api/v1/context/architecture/route.js.map +0 -1
  300. package/dist/routes/api/v1/context/index.d.ts.map +0 -1
  301. package/dist/routes/api/v1/context/index.js.map +0 -1
  302. package/dist/routes/api/v1/context/knowledge/[filename]/index.d.ts.map +0 -1
  303. package/dist/routes/api/v1/context/knowledge/[filename]/index.js.map +0 -1
  304. package/dist/routes/api/v1/context/knowledge/[filename]/route.d.ts.map +0 -1
  305. package/dist/routes/api/v1/context/knowledge/[filename]/route.js.map +0 -1
  306. package/dist/routes/api/v1/context/knowledge/index.d.ts.map +0 -1
  307. package/dist/routes/api/v1/context/knowledge/index.js.map +0 -1
  308. package/dist/routes/api/v1/context/knowledge/route.d.ts.map +0 -1
  309. package/dist/routes/api/v1/context/knowledge/route.js.map +0 -1
  310. package/dist/routes/api/v1/context/project/route.d.ts.map +0 -1
  311. package/dist/routes/api/v1/context/project/route.js.map +0 -1
  312. package/dist/routes/api/v1/git/index.d.ts.map +0 -1
  313. package/dist/routes/api/v1/git/index.js.map +0 -1
  314. package/dist/routes/api/v1/jobs/[id]/route.d.ts.map +0 -1
  315. package/dist/routes/api/v1/jobs/[id]/route.js.map +0 -1
  316. package/dist/routes/api/v1/jobs/[id]/run/route.d.ts.map +0 -1
  317. package/dist/routes/api/v1/jobs/[id]/run/route.js.map +0 -1
  318. package/dist/routes/api/v1/jobs/index.d.ts.map +0 -1
  319. package/dist/routes/api/v1/jobs/index.js.map +0 -1
  320. package/dist/routes/api/v1/jobs/route.d.ts.map +0 -1
  321. package/dist/routes/api/v1/jobs/route.js.map +0 -1
  322. package/dist/routes/api/v1/jobs/status/route.d.ts.map +0 -1
  323. package/dist/routes/api/v1/jobs/status/route.js.map +0 -1
  324. package/dist/routes/api/v1/mcp/index.d.ts.map +0 -1
  325. package/dist/routes/api/v1/mcp/index.js.map +0 -1
  326. package/dist/routes/api/v1/mcp/route.d.ts.map +0 -1
  327. package/dist/routes/api/v1/mcp/route.js.map +0 -1
  328. package/dist/routes/api/v1/proposals/[id]/route.d.ts.map +0 -1
  329. package/dist/routes/api/v1/proposals/[id]/route.js.map +0 -1
  330. package/dist/routes/api/v1/proposals/index.d.ts.map +0 -1
  331. package/dist/routes/api/v1/proposals/index.js.map +0 -1
  332. package/dist/routes/api/v1/proposals/route.d.ts.map +0 -1
  333. package/dist/routes/api/v1/proposals/route.js.map +0 -1
  334. package/dist/routes/api/v1/resources/[id]/index.d.ts.map +0 -1
  335. package/dist/routes/api/v1/resources/[id]/index.js.map +0 -1
  336. package/dist/routes/api/v1/resources/[id]/route.js.map +0 -1
  337. package/dist/routes/api/v1/resources/[id]/thumbnail/index.d.ts.map +0 -1
  338. package/dist/routes/api/v1/resources/[id]/thumbnail/index.js.map +0 -1
  339. package/dist/routes/api/v1/resources/[id]/thumbnail/route.js.map +0 -1
  340. package/dist/routes/api/v1/resources/index.d.ts.map +0 -1
  341. package/dist/routes/api/v1/resources/index.js.map +0 -1
  342. package/dist/routes/api/v1/resources/route.d.ts.map +0 -1
  343. package/dist/routes/api/v1/resources/route.js.map +0 -1
  344. package/dist/routes/api/v1/symlinks/index.d.ts.map +0 -1
  345. package/dist/routes/api/v1/symlinks/index.js.map +0 -1
  346. package/dist/routes/api/v1/symlinks/route.d.ts.map +0 -1
  347. package/dist/routes/api/v1/symlinks/route.js.map +0 -1
  348. package/dist/routes/api/v1/terminal/[proposalId]/create/index.d.ts.map +0 -1
  349. package/dist/routes/api/v1/terminal/[proposalId]/create/index.js.map +0 -1
  350. package/dist/routes/api/v1/terminal/[proposalId]/create/route.d.ts.map +0 -1
  351. package/dist/routes/api/v1/terminal/[proposalId]/create/route.js.map +0 -1
  352. package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.d.ts.map +0 -1
  353. package/dist/routes/api/v1/terminal/[proposalId]/destroy/index.js.map +0 -1
  354. package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.d.ts.map +0 -1
  355. package/dist/routes/api/v1/terminal/[proposalId]/destroy/route.js.map +0 -1
  356. package/dist/routes/api/v1/terminal/[proposalId]/resize/index.d.ts.map +0 -1
  357. package/dist/routes/api/v1/terminal/[proposalId]/resize/index.js.map +0 -1
  358. package/dist/routes/api/v1/terminal/[proposalId]/resize/route.d.ts.map +0 -1
  359. package/dist/routes/api/v1/terminal/[proposalId]/resize/route.js.map +0 -1
  360. package/dist/routes/api/v1/terminal/sessions/index.d.ts.map +0 -1
  361. package/dist/routes/api/v1/terminal/sessions/index.js.map +0 -1
  362. package/dist/routes/api/v1/terminal/sessions/route.d.ts.map +0 -1
  363. package/dist/routes/api/v1/terminal/sessions/route.js.map +0 -1
  364. package/dist/routes/api/v1/user/index.d.ts.map +0 -1
  365. package/dist/routes/api/v1/user/index.js.map +0 -1
  366. package/dist/routes/api/v1/user/settings/index.d.ts.map +0 -1
  367. package/dist/routes/api/v1/user/settings/index.js.map +0 -1
  368. package/dist/routes/api/v1/user/settings/route.d.ts.map +0 -1
  369. package/dist/routes/api/v1/user/settings/route.js.map +0 -1
  370. package/dist/server-with-static.d.ts.map +0 -1
  371. package/dist/server-with-static.js.map +0 -1
  372. package/dist/server.d.ts.map +0 -1
  373. package/dist/server.js.map +0 -1
  374. package/static/assets/CodePage-xbYipiBR.js +0 -2
  375. package/static/assets/IntegrationsSettingsPage-Ds16sLG2.js +0 -1
  376. package/static/assets/KnowledgeEditPage-DpjdauND.js +0 -1
  377. package/static/assets/NewKnowledgePage-EqWKQ4lU.js +0 -9
  378. package/static/assets/NotificationsSettingsPage-BzVS1D5M.js +0 -1
  379. package/static/assets/ProjectEditPage-BlQk50Xs.js +0 -11
  380. package/static/assets/PromptsSettingsPage-DWEKgvMD.js +0 -1
  381. package/static/assets/RoleEditPage-m6lOchyA.js +0 -13
  382. package/static/assets/SchedulePage-DUSxe93C.js +0 -4
  383. package/static/assets/TaskEditPage-Dpsi2Rcp.js +0 -1
  384. package/static/assets/UserPreferencesPage-CY_0CoMe.js +0 -1
  385. package/static/assets/index-CHdBxVyk.css +0 -2
  386. package/static/assets/kiro-CGoI3Dqh.js +0 -17
  387. package/static/assets/markdown-editor-C-DC0mFI.js +0 -62
  388. package/static/assets/markdown-editor-DUEthZ0y.css +0 -1
  389. package/static/assets/select-Dp3J_OE9.js +0 -1
@@ -1 +1 @@
1
- import{a as N,r as t,A as v,j as e,t as C,F as g,B as a,L as c,Y as d,M as w,au as y,ar as b}from"./index-CIFIEidO.js";import{C as i,a as r,b as E}from"./card-_Grh-Otl.js";import{c as k}from"./clipboard-B9ndUJKl.js";function L(){const{toast:l}=N(),[o,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${v}/api/v1/context/role`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/role.md";try{await k(s),l({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),l({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"role-md",filename:"role.md",name:"role.md",path:".nut/context/role.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading role definition..."})]})})})}):!u||!o?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(g,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Role Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Role definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(c,{to:"/context/role/edit",children:[e.jsx(d,{className:"h-4 w-4 mr-2"}),"Create Role Definition"]})})]})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Role"}),e.jsx("p",{className:"text-muted-foreground",children:"This Coconut's responsibilities and guidelines"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(c,{to:"/context/role/edit",children:[e.jsx(d,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(E,{className:"pb-0"}),e.jsx(r,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(b,{children:o.content||"No content available"})})})]})]})}export{L as default};
1
+ import{a as N,r as t,A as v,j as e,t as C,F as g,B as a,L as c,Y as d,M as w,au as y,ar as b}from"./index-DF2yEDGL.js";import{C as i,a as r,b as E}from"./card-Bg-wA9s_.js";import{c as k}from"./clipboard-B9ndUJKl.js";function L(){const{toast:l}=N(),[o,m]=t.useState(null),[x,h]=t.useState(!0),[u,n]=t.useState(!1);t.useEffect(()=>{fetch(`${v}/api/v1/context/role`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(m(s.document),n(!0)):n(!1)}).catch(()=>{n(!1)}).finally(()=>{h(!1)})},[]);const p=async()=>{const s=".nut/context/role.md";try{await k(s),l({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(f){console.error("Failed to copy path:",f),l({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},j=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"role-md",filename:"role.md",name:"role.md",path:".nut/context/role.md"}});window.dispatchEvent(s)};return x?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading role definition..."})]})})})}):!u||!o?e.jsx("div",{className:"space-y-6",children:e.jsx(i,{children:e.jsx(r,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(g,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Role Definition Found"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Role definition will appear here once created."}),e.jsx(a,{className:"mt-4",asChild:!0,children:e.jsxs(c,{to:"/context/role/edit",children:[e.jsx(d,{className:"h-4 w-4 mr-2"}),"Create Role Definition"]})})]})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Role"}),e.jsx("p",{className:"text-muted-foreground",children:"This Coconut's responsibilities and guidelines"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(w,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(a,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(y,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(a,{size:"sm",asChild:!0,children:e.jsxs(c,{to:"/context/role/edit",children:[e.jsx(d,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),e.jsxs(i,{children:[e.jsx(E,{className:"pb-0"}),e.jsx(r,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(b,{children:o.content||"No content available"})})})]})]})}export{L as default};
@@ -1,4 +1,4 @@
1
- import{c as f,r,A as p,j as e,a$ as F,B as l,P as L,I as c,E as T}from"./index-CIFIEidO.js";import{C as I,b as z,a as _}from"./card-_Grh-Otl.js";import{L as n}from"./label-B1lgxULu.js";import{B as D}from"./badge-rki-Xf0E.js";/**
1
+ import{c as f,r,A as p,j as e,bv as F,B as l,P as L,I as c,E as T}from"./index-DF2yEDGL.js";import{C as I,b as z,a as _}from"./card-Bg-wA9s_.js";import{L as n}from"./label-Bo7tep86.js";import{B as D}from"./badge-BIzmYH_4.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,4 @@
1
+ import{a as Xe,ad as Ze,r as m,j as e,B as u,t as J,P as pe,bG as ge,y as q,z as fe,E as ve,H as V,J as G,N as Y,O as K,Q,R as X,U as Z,L as je,k as ee,a9 as Ne,bH as es,C as ss,n as se,D as be,b as ye,d as we,f as Se,g as Ce,I as te,a2 as ke,a3 as Ae,a4 as De,a5 as Ie,a6 as Te,aa as Fe,o as ts,ab as as,W as Pe,A as j}from"./index-DF2yEDGL.js";import{C as O,a as ae,c as re,b as $e}from"./card-Bg-wA9s_.js";import{B as F}from"./badge-BIzmYH_4.js";import{S as rs,a as ns,b as is,c as ls,d as ds}from"./select-XHfMw_BF.js";import{L as v}from"./label-Bo7tep86.js";import{S as cs}from"./switch-uoWXvqqm.js";import{T as os,a as ms,b as ne,c as ie}from"./tabs-Be_b96k_.js";import{R as us}from"./refresh-cw-DwXF5JvK.js";import{P as Me}from"./play-Sq1Ji6eG.js";import{P as hs}from"./pause-CSm_MUb9.js";import{C as xs}from"./clock-Cg9nPTux.js";import{C as ps}from"./chevron-up-C115Uf6r.js";import"./index-BEvAFxs_.js";const ce=[{id:"claude",label:"Claude Code"},{id:"gemini",label:"Google Gemini"},{id:"codex",label:"OpenAI Codex"},{id:"droid",label:"Factory Droid"},{id:"kiro",label:"Kiro"}],gs=[{label:"Monday",value:"monday"},{label:"Tuesday",value:"tuesday"},{label:"Wednesday",value:"wednesday"},{label:"Thursday",value:"thursday"},{label:"Friday",value:"friday"},{label:"Saturday",value:"saturday"},{label:"Sunday",value:"sunday"}],Ee=["monday","tuesday","wednesday","thursday","friday"],Je=a=>{if(!a)return"—";try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(a))}catch{return a}},H=a=>{if(!a)return"—";const x=new Date(a).getTime()-Date.now(),f=Math.round(x/(1e3*60));if(Number.isNaN(f))return Je(a);if(Math.abs(f)<1)return"now";if(f>0){if(f<60)return`in ${f}m`;const b=Math.round(f/60);return b<24?`in ${b}h`:`in ${Math.round(b/24)}d`}const N=Math.abs(f);if(N<60)return`${N}m ago`;const T=Math.round(N/60);return T<24?`${T}h ago`:`${Math.round(T/24)}d ago`},fs=a=>{if(a.type==="interval"){const o=a.daysOfWeek.map(x=>x.slice(0,3).toUpperCase()).join(", ");return`Every ${a.hours}h (${o||"All days"})`}return a.description||`Cron: ${a.expression}`},vs=a=>{const o=ce.find(x=>x.id===a);return o?o.label:a},le=a=>{switch(a){case"active":case"succeeded":return"default";case"paused":case"running":return"secondary";case"failed":return"destructive";default:return"outline"}},de=()=>({name:"",model:"claude",prompt:"",hours:6,daysOfWeek:new Set(Ee),status:!0,anchorHour:"",agentIds:[],mcpServers:[]}),Re=a=>{if(a.schedule.type!=="interval")return de();const o=a.agentIds||(a.agentId?[a.agentId]:[]);return{name:a.name,model:ce.some(x=>x.id===a.model)?a.model:"claude",prompt:a.prompt,hours:a.schedule.hours,daysOfWeek:new Set(a.schedule.daysOfWeek),status:a.status==="active",anchorHour:a.schedule.anchorHour===void 0?"":String(a.schedule.anchorHour),agentIds:o,mcpServers:a.mcpServers||[]}},js=a=>a?Array.isArray(a)?a.filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean):typeof a=="string"?a.split(",").map(o=>o.trim()).filter(Boolean):[]:[];function $s(){const{toast:a}=Xe(),{refresh:o}=Ze(),[x,f]=m.useState([]),[N,T]=m.useState(!0),[L,b]=m.useState(!1),[P,y]=m.useState(!1),[n,p]=m.useState(()=>de()),[z,oe]=m.useState(!1),[w,S]=m.useState(null),[c,C]=m.useState(null),[g,$]=m.useState(null),[Oe,M]=m.useState(!1),[R,He]=m.useState([]),[W,Le]=m.useState([]),[ze,We]=m.useState(new Set),[B,U]=m.useState({open:!1,serverToRemove:null}),k=async(s=!1)=>{try{N||b(!0);const t=await fetch(`${j}/api/v1/jobs`);if(!t.ok)throw new Error(`Failed to fetch jobs (${t.status})`);const r=await t.json();if(!r?.success)throw new Error(r?.error?.message||"Unknown error loading jobs");const i=r.data??[];if(f(i),c){const l=i.find(d=>d.id===c.id);l&&(C(l),l.schedule.type!=="cron"&&p(Re(l)))}if(g){const l=i.find(d=>d.id===g.id);l&&$(l)}s&&a({title:"Schedule refreshed",description:"Latest job information loaded."})}catch(t){console.error("Failed to load jobs:",t),a({title:"Failed to load schedule",description:t?.message??"Unknown error",variant:"destructive"})}finally{T(!1),b(!1)}};m.useEffect(()=>{k()},[]),m.useEffect(()=>{P&&(async()=>{try{const t=await fetch(`${j}/api/v1/agents`);if(t.ok){const i=await t.json(),d=(Array.isArray(i?.documents)?i.documents:[]).map(h=>({id:h.filename,name:h?.metadata?.name||h.title||h.filename,tools:js(h?.metadata?.tools)}));if(He(d),c){const D=(c.agentIds||(c.agentId?[c.agentId]:[])).filter(I=>!d.find(_=>_.id===I));D.length>0&&(a({title:"Some agents no longer available",description:`The following agents have been removed: ${D.join(", ")}`,variant:"destructive"}),p(I=>({...I,agentIds:I.agentIds.filter(_=>d.find(Qe=>Qe.id===_))})))}}const r=await fetch(`${j}/api/v1/mcp`);if(r.ok){const i=await r.json();if(i?.success&&Array.isArray(i.servers)&&(Le(i.servers),c?.mcpServers)){const l=c.mcpServers.filter(d=>!i.servers.includes(d));l.length>0&&(a({title:"Some MCP servers are no longer available",description:`The following servers have been removed: ${l.join(", ")}`,variant:"destructive"}),p(d=>({...d,mcpServers:d.mcpServers.filter(h=>i.servers.includes(h))})))}}}catch(t){console.error("Failed to load agents or MCP servers:",t)}})()},[P,c,a]);const A=s=>{p(t=>({...t,...s}))},Be=(s,t)=>{p(r=>{let i;if(t){i=[...r.agentIds,s];const l=R.find(d=>d.id===s);if(l&&l.tools.length>0){const d=new Set([...r.mcpServers,...l.tools]);return{...r,agentIds:i,mcpServers:Array.from(d).filter(h=>W.includes(h))}}}else i=r.agentIds.filter(l=>l!==s);return{...r,agentIds:i}})},Ue=(s,t)=>{if(!t&&R.filter(i=>n.agentIds.includes(i.id)&&i.tools.includes(s)).length>0){U({open:!0,serverToRemove:s});return}p(r=>({...r,mcpServers:t?[...r.mcpServers,s]:r.mcpServers.filter(i=>i!==s)}))},_e=()=>{const s=B.serverToRemove;s&&p(t=>({...t,mcpServers:t.mcpServers.filter(r=>r!==s)})),U({open:!1,serverToRemove:null})},qe=(s,t)=>{p(r=>{const i=new Set(r.daysOfWeek);return t?i.add(s):i.delete(s),i.size===0&&Ee.forEach(l=>i.add(l)),{...r,daysOfWeek:i}})},E=()=>{p(de())},me=s=>{We(t=>{const r=new Set(t);return r.has(s)?r.delete(s):r.add(s),r})},ue=s=>{$(s),M(!0)},he=()=>{C(null),E(),y(!0)},Ve=s=>{if(s._error){a({title:"Cannot edit corrupted job",description:"Please fix the job file manually at .nut/jobs/"+s.id+".md",variant:"destructive"});return}if(s.schedule.type==="cron"){a({title:"Manual edit required",description:"Cron-based jobs can be edited directly in .nut/jobs/<id>.md for now.",variant:"destructive"});return}C(s),p(Re(s)),y(!0)},Ge=async s=>{if(s.preventDefault(),!n.name.trim()){a({title:"Job name required",description:"Please provide a name for the scheduled job.",variant:"destructive"});return}if(!n.prompt.trim()){a({title:"Prompt required",description:"Please provide instructions for the scheduled job.",variant:"destructive"});return}oe(!0);const t=!!c;try{const r=Number(n.anchorHour.trim()),i=n.anchorHour.trim()===""||Number.isNaN(r)?void 0:Math.min(23,Math.max(0,r)),l={name:n.name.trim(),prompt:n.prompt.trim(),model:n.model,status:n.status?"active":"paused",schedule:{type:"interval",hours:Math.max(1,Number(n.hours)||6),daysOfWeek:Array.from(n.daysOfWeek),anchorHour:i},agentIds:n.agentIds.length>0?n.agentIds:void 0,mcpServers:n.mcpServers.length>0?n.mcpServers:void 0},d=t?`${j}/api/v1/jobs/${c?.id}`:`${j}/api/v1/jobs`,D=await fetch(d,{method:t?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!D.ok){const I=await D.json().catch(()=>({}));throw new Error(I?.error?.message||`Failed to ${t?"update":"create"} job (${D.status})`)}a({title:t?"Scheduled job updated":"Scheduled job created",description:l.name}),y(!1),C(null),E(),await k()}catch(r){console.error("Failed to submit job:",r),a({title:`Failed to ${c?"update":"create"} job`,description:r?.message??"Unknown error",variant:"destructive"})}finally{oe(!1)}},Ye=async s=>{if(s._error){a({title:"Cannot run corrupted job",description:"Please fix the job file manually at .nut/jobs/"+s.id+".md",variant:"destructive"});return}S(s.id);try{const t=await fetch(`${j}/api/v1/jobs/${s.id}/run`,{method:"POST"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r?.error?.message||`Failed to run job (${t.status})`)}a({title:"Run started",description:`${s.name} is executing.`}),await k(),await o()}catch(t){console.error("Failed to run job:",t),a({title:"Run failed to start",description:t?.message??"Unknown error",variant:"destructive"})}finally{S(null)}},Ke=async s=>{if(s._error){a({title:"Cannot update corrupted job",description:"Please fix the job file manually at .nut/jobs/"+s.id+".md",variant:"destructive"});return}S(s.id);const t=s.status==="active"?"paused":"active";try{const r=await fetch(`${j}/api/v1/jobs/${s.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i?.error?.message||`Failed to update job (${r.status})`)}a({title:t==="active"?"Job resumed":"Job paused",description:s.name}),await k(),await o()}catch(r){console.error("Failed to update job status:",r),a({title:"Failed to update job",description:r?.message??"Unknown error",variant:"destructive"})}finally{S(null)}},xe=async s=>{S(s.id);try{const t=await fetch(`${j}/api/v1/jobs/${s.id}`,{method:"DELETE"});if(!t.ok){const r=await t.json().catch(()=>({}));throw new Error(r?.error?.message||`Failed to delete job (${t.status})`)}a({title:"Scheduled job deleted",description:s.name}),c?.id===s.id&&(y(!1),C(null),E()),g?.id===s.id&&(M(!1),$(null)),await k()}catch(t){console.error("Failed to delete job:",t),a({title:"Failed to delete job",description:t?.message??"Unknown error",variant:"destructive"})}finally{S(null)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Jobs"}),e.jsx("p",{className:"text-md text-muted-foreground",children:"Automate recurring agent runs"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(u,{variant:"outline",onClick:()=>k(!0),disabled:N||L,children:[L?e.jsx(J,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(us,{className:"mr-2 h-4 w-4"}),"Refresh"]}),e.jsxs(u,{onClick:he,children:[e.jsx(pe,{className:"mr-2 h-4 w-4"}),"New Scheduled Job"]})]})]}),N?e.jsx(O,{children:e.jsxs(ae,{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(J,{className:"mr-2 h-5 w-5 animate-spin"}),"Loading scheduled jobs..."]})}):x.length===0?e.jsx(O,{className:"border-dashed",children:e.jsxs(ae,{className:"flex flex-col items-center justify-center py-16 px-6 text-center",children:[e.jsx("div",{className:"rounded-full bg-muted p-6 mb-6",children:e.jsx(ge,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx(re,{className:"text-2xl mb-3",children:"No scheduled jobs yet"}),e.jsx("p",{className:"text-muted-foreground max-w-md mb-6",children:"Automate recurring tasks by scheduling an agent to run on your behalf. Set up your first job to get started."}),e.jsxs("div",{className:"bg-accent/50 rounded-lg p-6 max-w-lg space-y-3 text-sm text-left",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-xs font-bold text-primary",children:"1"})}),e.jsx("p",{className:"text-muted-foreground",children:"Choose the days of the week and cadence that fit your workflow"})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-xs font-bold text-primary",children:"2"})}),e.jsx("p",{className:"text-muted-foreground",children:"Provide detailed instructions so the agent can execute safely"})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("span",{className:"text-xs font-bold text-primary",children:"3"})}),e.jsx("p",{className:"text-muted-foreground",children:"All runs are logged under for review"})]})]}),e.jsxs(u,{onClick:he,className:"mt-8",size:"lg",children:[e.jsx(pe,{className:"mr-2 h-5 w-5"}),"Create Your First Job"]})]})}):e.jsx("div",{className:"grid gap-4",children:x.map(s=>s._error?e.jsx(O,{className:"border-destructive/50 bg-destructive/5",children:e.jsx($e,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsxs(re,{className:"text-lg truncate text-destructive",children:["Unable to load job: ",s.id]}),e.jsx(F,{variant:"destructive",className:"text-xs shrink-0",children:"Error"})]}),e.jsx("p",{className:"text-sm text-destructive/80 mt-1",children:s._error}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Please review the job file at ",e.jsxs("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:[".nut/jobs/",s.id,".md"]})]})]}),e.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:e.jsxs(q,{children:[e.jsx(fe,{asChild:!0,children:e.jsx(u,{size:"sm",variant:"ghost",disabled:w===s.id,className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(ve,{className:"h-3.5 w-3.5"})})}),e.jsxs(V,{children:[e.jsxs(G,{children:[e.jsx(Y,{children:"Delete corrupted job?"}),e.jsxs(K,{children:["This will remove the corrupted job file ",e.jsx("strong",{children:s.id}),". This action cannot be undone."]})]}),e.jsxs(Q,{children:[e.jsx(X,{children:"Cancel"}),e.jsx(Z,{onClick:()=>xe(s),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})})]})})},s.id):e.jsxs(O,{className:"group relative overflow-hidden border-border hover:border-primary/50 transition-all hover:shadow-lg",children:[e.jsx($e,{className:"pb-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx(je,{to:`/schedule/${s.id}`,className:"hover:underline",children:e.jsx(re,{className:"text-lg truncate",children:s.name})}),e.jsx(F,{variant:le(s.status),className:"capitalize text-xs shrink-0",children:s.status})]}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:s.description||s.prompt||"No description provided"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx(u,{size:"sm",variant:"default",onClick:()=>Ye(s),disabled:w===s.id,className:"h-8 px-3",children:w===s.id?e.jsx(J,{className:"h-3.5 w-3.5 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"mr-1.5 h-3.5 w-3.5"}),"Run"]})}),e.jsx(u,{size:"sm",variant:"outline",asChild:!0,className:"h-8 px-3 text-xs",children:e.jsx(je,{to:`/schedule/${s.id}`,children:"View"})}),e.jsx(u,{size:"sm",variant:"outline",onClick:()=>Ve(s),disabled:w===s.id,className:"h-8 px-3 text-xs",children:"Edit"}),e.jsx(u,{size:"sm",variant:"outline",onClick:()=>Ke(s),disabled:w===s.id,className:"h-8 px-2",children:s.status==="active"?e.jsx(hs,{className:"h-3.5 w-3.5"}):e.jsx(Me,{className:"h-3.5 w-3.5"})}),e.jsxs(q,{children:[e.jsx(fe,{asChild:!0,children:e.jsx(u,{size:"sm",variant:"ghost",disabled:w===s.id,className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",children:e.jsx(ve,{className:"h-3.5 w-3.5"})})}),e.jsxs(V,{children:[e.jsxs(G,{children:[e.jsx(Y,{children:"Delete scheduled job?"}),e.jsxs(K,{children:["This will remove ",e.jsx("strong",{children:s.name}),". Existing run logs will remain in ",e.jsx("code",{children:".nut/jobs/logs"}),"."]})]}),e.jsxs(Q,{children:[e.jsx(X,{children:"Cancel"}),e.jsx(Z,{onClick:()=>xe(s),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]})}),e.jsxs(ae,{className:"space-y-3 pt-0",children:[e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md bg-accent/30",children:[e.jsx(xs,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"min-w-0",children:e.jsx("div",{className:"font-semibold truncate",children:fs(s.schedule)})})]}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md bg-accent/30",children:[e.jsx(ee,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("div",{className:"font-semibold",children:vs(s.model)})]}),e.jsx("div",{className:"flex items-center gap-2 p-2 rounded-md bg-accent/30",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-bold",children:"Next"}),e.jsx("div",{className:"font-semibold truncate",children:H(s.metadata.nextRunAt)})]})}),e.jsx("div",{className:"flex items-center gap-2 p-2 rounded-md bg-accent/30",children:e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-bold",children:"Last"}),e.jsx("div",{className:"font-semibold truncate",children:H(s.metadata.lastRunAt)})]})})]}),(s.agentIds&&s.agentIds.length>0||s.agentId||s.mcpServers&&s.mcpServers.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 text-xs",children:[(s.agentIds||(s.agentId?[s.agentId]:[])).map(t=>e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800",children:[e.jsx(ee,{className:"h-3 w-3 text-blue-600 dark:text-blue-400"}),e.jsx("span",{className:"font-medium text-blue-900 dark:text-blue-100",children:t.replace(".md","")})]},t)),s.mcpServers&&s.mcpServers.length>0&&s.mcpServers.map(t=>e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-md bg-purple-50 dark:bg-purple-950/20 border border-purple-200 dark:border-purple-800",children:[e.jsx(Ne,{className:"h-3 w-3 text-purple-600 dark:text-purple-400"}),e.jsx("span",{className:"font-medium text-purple-900 dark:text-purple-100",children:t})]},t))]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[e.jsx(es,{className:"h-3 w-3"}),"Recent Runs"]}),s.runs.length>1&&e.jsxs(u,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>ue(s),children:["View All (",s.runs.length,")",e.jsx(ss,{className:"ml-1 h-3 w-3"})]})]}),s.runs.length===0?e.jsx("div",{className:"rounded-md border border-dashed bg-muted/20 p-4 text-center text-xs text-muted-foreground",children:'No runs yet • Click "Run" to execute'}):e.jsxs("div",{className:"space-y-1.5",children:[s.runs.slice(0,1).map(t=>{const r=ze.has(t.id);return e.jsxs("div",{className:"rounded-md border bg-card/50 overflow-hidden transition-all",children:[e.jsxs("div",{className:"p-2.5 text-xs hover:bg-accent/50 transition-colors cursor-pointer",onClick:()=>me(t.id),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx(F,{variant:le(t.status),className:"capitalize text-[10px] h-5",children:t.status}),e.jsx("span",{className:"text-muted-foreground truncate",children:H(t.startedAt)})]}),t.trigger==="manual"&&e.jsx(F,{variant:"outline",className:"text-[10px] h-5",children:"manual"})]}),t.error&&e.jsx("p",{className:"text-destructive font-medium mt-1 line-clamp-1",children:t.error})]}),t.summary&&e.jsx("div",{className:"px-2.5 pb-2.5",children:e.jsxs("div",{className:"rounded bg-muted/50 p-2 font-mono text-[10px] leading-relaxed text-muted-foreground relative cursor-pointer hover:bg-muted/70 transition-colors",onClick:i=>{i.stopPropagation(),me(t.id)},children:[e.jsx("div",{className:r?"":"line-clamp-2",children:t.summary}),e.jsx("div",{className:"flex justify-center mt-1",children:e.jsx("div",{className:"text-muted-foreground p-0.5",children:r?e.jsx(ps,{className:"h-3 w-3"}):e.jsx(se,{className:"h-3 w-3"})})})]})})]},t.id)}),s.runs.length>1&&e.jsxs(u,{variant:"ghost",size:"sm",className:"w-full h-7 text-xs",onClick:()=>ue(s),children:["+",s.runs.length-1," more runs"]})]})]})]})]},s.id))}),e.jsx(be,{open:P,onOpenChange:s=>{y(s),s||(C(null),E())},children:e.jsxs(ye,{className:"max-w-4xl h-[700px] overflow-hidden flex flex-col",children:[e.jsxs(we,{className:"space-y-2 pb-4 shrink-0",children:[e.jsxs(Se,{className:"text-xl flex items-center gap-2",children:[e.jsx(ge,{className:"h-5 w-5 text-primary"}),c?"Edit Scheduled Job":"Create New Scheduled Job"]}),e.jsx(Ce,{className:"text-sm",children:c?"Update the prompt, cadence, or agent preference":"Automate recurring tasks by scheduling an agent"})]}),e.jsxs("form",{onSubmit:Ge,className:"flex flex-col flex-1 min-h-0",children:[e.jsxs(os,{defaultValue:"basics",className:"flex-1 flex flex-col min-h-0",children:[e.jsxs(ms,{className:"grid w-full grid-cols-3 mb-4 shrink-0",children:[e.jsx(ne,{value:"basics",children:"Basics"}),e.jsx(ne,{value:"schedule",children:"Schedule"}),e.jsx(ne,{value:"advanced",children:"Advanced"})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto pr-2 -mr-2 min-h-0",children:[e.jsxs(ie,{value:"basics",className:"space-y-5 mt-0",children:[e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(v,{htmlFor:"job-name",className:"text-sm font-medium flex items-center gap-1.5",children:["Job Name",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(te,{id:"job-name",placeholder:"e.g., Publish docs nightly",value:n.name,onChange:s=>A({name:s.target.value}),className:"h-11",required:!0})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsx(v,{htmlFor:"job-model",className:"text-sm font-medium",children:"AI Model"}),e.jsxs(rs,{value:n.model,onValueChange:s=>A({model:s}),children:[e.jsx(ns,{id:"job-model",className:"h-11",children:e.jsx(is,{placeholder:"Select a model"})}),e.jsx(ls,{children:ce.map(s=>e.jsx(ds,{value:s.id,children:s.label},s.id))})]})]})]}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(v,{className:"text-sm font-medium flex items-center gap-1.5",children:[e.jsx(ee,{className:"h-4 w-4"}),"Custom Agent",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(optional)"})]}),e.jsxs(ke,{children:[e.jsx(Ae,{asChild:!0,children:e.jsxs(u,{variant:"outline",className:"w-full h-11 justify-between font-normal",children:[n.agentIds.length===0?"No agents selected":`${n.agentIds.length} agent${n.agentIds.length!==1?"s":""} selected`,e.jsx(se,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(De,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsx(Ie,{children:"Available Agents"}),e.jsx(Te,{}),R.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-muted-foreground",children:"No agents configured"}):R.map(s=>e.jsx(Fe,{checked:n.agentIds.includes(s.id),onCheckedChange:t=>Be(s.id,t),children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:s.name}),s.tools.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["MCP: ",s.tools.join(", ")]})]})},s.id))]})]})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(v,{className:"text-sm font-medium flex items-center gap-1.5",children:[e.jsx(Ne,{className:"h-4 w-4"}),"MCP Servers",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(optional)"})]}),e.jsxs(ke,{children:[e.jsx(Ae,{asChild:!0,children:e.jsxs(u,{variant:"outline",className:"w-full h-11 justify-between font-normal",children:[n.mcpServers.length===0?"No MCP servers selected":`${n.mcpServers.length} server${n.mcpServers.length!==1?"s":""} selected`,e.jsx(se,{className:"h-4 w-4 opacity-50"})]})}),e.jsxs(De,{className:"w-full min-w-[--radix-dropdown-menu-trigger-width]",children:[e.jsx(Ie,{children:"Available MCP Servers"}),e.jsx(Te,{}),W.length===0?e.jsx("div",{className:"px-2 py-1.5 text-sm text-muted-foreground",children:"No MCP servers configured"}):W.map(s=>e.jsx(Fe,{checked:n.mcpServers.includes(s),onCheckedChange:t=>Ue(s,t),children:s},s))]})]})]})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(v,{htmlFor:"job-prompt",className:"text-sm font-medium flex items-center gap-1.5",children:[n.agentIds.length>0?"Custom Instructions":"Instructions",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(ts,{id:"job-prompt",placeholder:n.agentIds.length>0?`Additional instructions to supplement the agent's predefined behavior...
2
+ Example: Focus on performance optimizations`:`Example:
3
+ Run the following command and append the output to .nut/knowledge/runs.md:
4
+ pnpm docs:publish`,rows:6,value:n.prompt,onChange:s=>A({prompt:s.target.value}),className:"resize-none font-mono text-sm"}),e.jsxs("p",{className:"text-xs text-muted-foreground flex items-start gap-1.5",children:[e.jsx("span",{className:"text-amber-600 dark:text-amber-500",children:"⚠"}),e.jsx("span",{children:n.agentIds.length>0?"These custom instructions will be combined with the selected agents' predefined instructions. Jobs run with autonomous permissions.":"Provide clear, actionable instructions. Jobs run with autonomous permissions - include safety checks where needed."})]})]})]}),e.jsx(ie,{value:"schedule",className:"space-y-5 mt-0",children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-[1.2fr_1fr]",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(v,{className:"text-sm font-medium",children:"Days of the Week"}),e.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:gs.map(s=>e.jsxs("label",{className:"flex items-center gap-2.5 text-sm rounded-md border border-input px-3.5 py-2.5 cursor-pointer hover:bg-accent/50 transition-colors",children:[e.jsx(as,{checked:n.daysOfWeek.has(s.value),onCheckedChange:t=>qe(s.value,t)}),e.jsx("span",{className:"font-medium",children:s.label})]},s.value))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select which days the job should run"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2.5",children:[e.jsx(v,{htmlFor:"job-hours",className:"text-sm font-medium",children:"Frequency (hours)"}),e.jsxs("div",{className:"relative",children:[e.jsx(te,{id:"job-hours",type:"number",min:1,value:n.hours,onChange:s=>A({hours:Number(s.target.value)||1}),className:"h-11 pr-16"}),e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"hours"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"How often the job runs on selected days"})]}),e.jsxs("div",{className:"space-y-2.5",children:[e.jsxs(v,{htmlFor:"job-anchor",className:"text-sm font-medium flex items-center gap-1.5",children:["Start Hour",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(optional)"})]}),e.jsxs("div",{className:"relative",children:[e.jsx(te,{id:"job-anchor",type:"number",min:0,max:23,placeholder:"Auto",value:n.anchorHour,onChange:s=>A({anchorHour:s.target.value}),className:"h-11"}),e.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"0-23"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Preferred starting hour in 24h format"})]})]})]})}),e.jsx(ie,{value:"advanced",className:"space-y-5 mt-0",children:e.jsxs("div",{className:"flex items-start gap-4 rounded-lg border border-border bg-accent/20 p-4",children:[e.jsx(cs,{id:"job-status",checked:n.status,onCheckedChange:s=>A({status:s}),className:"mt-1"}),e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsx(v,{htmlFor:"job-status",className:"text-base font-semibold cursor-pointer",children:n.status?"Start Active":"Start Paused"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n.status?"Job will begin running on the configured schedule immediately after creation.":"Job will be created in a paused state. You can activate it later from the schedule page."})]})]})})]})]}),e.jsxs(Pe,{className:"gap-2 sm:gap-2 pt-4 border-t mt-4",children:[e.jsx(u,{type:"button",variant:"outline",onClick:()=>y(!1),disabled:z,className:"min-w-24",children:"Cancel"}),e.jsx(u,{type:"submit",disabled:z||!n.name.trim()||!n.prompt.trim(),className:"min-w-32",children:z?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"mr-2 h-4 w-4 animate-spin"}),c?"Saving...":"Creating..."]}):e.jsx(e.Fragment,{children:c?"Save Changes":"Create Job"})})]})]})]})}),e.jsx(be,{open:Oe,onOpenChange:s=>{M(s),s||$(null)},children:e.jsxs(ye,{className:"max-w-3xl",children:[e.jsxs(we,{children:[e.jsxs(Se,{children:["Run history — ",g?.name]}),e.jsxs(Ce,{children:[g?.runs?.length??0," recorded runs. Logs stored in ",e.jsxs("code",{children:[".nut/jobs/",g?.id,".md"]})," and ",e.jsxs("code",{children:[".nut/jobs/logs/",g?.id]}),"."]})]}),e.jsxs("div",{className:"max-h-[420px] space-y-3 overflow-y-auto pr-2",children:[g?.runs.map(s=>e.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[e.jsxs("div",{className:"p-3 text-xs bg-card/50",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[e.jsx(F,{variant:le(s.status),className:"capitalize text-[10px] h-5",children:s.status}),e.jsxs("span",{className:"text-muted-foreground",children:[s.trigger," • ",Je(s.startedAt)]}),s.finishedAt&&e.jsxs("span",{className:"text-muted-foreground",children:["• completed ",H(s.finishedAt)]})]}),s.error&&e.jsx("p",{className:"text-destructive font-medium mb-2",children:s.error}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-[10px] text-muted-foreground",children:[s.outputPath&&e.jsxs("span",{children:["log: ",e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:s.outputPath})]}),s.cliCommand&&e.jsxs("span",{children:["cmd: ",e.jsx("code",{className:"bg-muted px-1 py-0.5 rounded",children:s.cliCommand})]})]})]}),s.summary&&e.jsx("div",{className:"px-3 pb-3",children:e.jsx("div",{className:"rounded bg-muted/50 p-2 font-mono text-[10px] leading-relaxed text-muted-foreground whitespace-pre-wrap",children:s.summary})})]},s.id)),g&&g.runs.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No recorded runs yet."})]}),e.jsx(Pe,{children:e.jsx(u,{variant:"outline",onClick:()=>M(!1),children:"Close"})})]})}),e.jsx(q,{open:B.open,onOpenChange:s=>{s||U({open:!1,serverToRemove:null})},children:e.jsxs(V,{children:[e.jsxs(G,{children:[e.jsx(Y,{children:"Remove MCP Server?"}),e.jsxs(K,{children:["One or more selected agents require the ",e.jsx("strong",{children:B.serverToRemove})," MCP server. Removing it may lead to unexpected consequences when the job runs."]})]}),e.jsxs(Q,{children:[e.jsx(X,{children:"Cancel"}),e.jsx(Z,{onClick:_e,children:"OK"})]})]})})]})}export{$s as default};
@@ -1 +1 @@
1
- import{x as C,u as S,r as h,j as e,B as a,L as c,Y as E,E as T,k as A,A as N}from"./index-CIFIEidO.js";import{C as l,b as d,a as o,c as f,d as z}from"./card-_Grh-Otl.js";import{B as v}from"./badge-rki-Xf0E.js";import{A as p}from"./arrow-left-PEX5RePT.js";function B(n){return n.replace(/[-_]/g," ").replace(/\b\w/g,u=>u.toUpperCase())}const i={blue:{bg:"#dbeafe",border:"#2563eb",text:"#1e40af"},green:{bg:"#dcfce7",border:"#16a34a",text:"#166534"},red:{bg:"#fee2e2",border:"#dc2626",text:"#991b1b"},emerald:{bg:"#d1fae5",border:"#10b981",text:"#047857"},purple:{bg:"#f3e8ff",border:"#9333ea",text:"#6b21a8"},orange:{bg:"#fed7aa",border:"#ea580c",text:"#9a3412"},yellow:{bg:"#fef9c3",border:"#eab308",text:"#854d0e"},teal:{bg:"#ccfbf1",border:"#14b8a6",text:"#0f766e"},indigo:{bg:"#e0e7ff",border:"#6366f1",text:"#4338ca"},pink:{bg:"#fce7f3",border:"#ec4899",text:"#9f1239"},cyan:{bg:"#cffafe",border:"#06b6d4",text:"#155e75"},slate:{bg:"#f1f5f9",border:"#475569",text:"#334155"},gray:{bg:"#f3f4f6",border:"#6b7280",text:"#374151"}};function U(){const n=C(),u=S(),[s,w]=h.useState(null),[k,g]=h.useState(!0),[b,m]=h.useState(null);h.useEffect(()=>{async function r(){try{g(!0);const j=await(await fetch(`${N}/api/v1/skills/${n.id}`)).json();j.success?w(j.document):m(j.error||"Failed to fetch skill")}catch(t){m(t instanceof Error?t.message:"Unknown error")}finally{g(!1)}}n.id&&r()},[n.id]);const y=async()=>{if(!(!s||!confirm("Are you sure you want to delete this skill?")))try{const t=await(await fetch(`${N}/api/v1/skills/${s.id}`,{method:"DELETE"})).json();t.success?u("/skills"):m(t.error?.message||"Failed to delete skill")}catch(r){m(r instanceof Error?r.message:"Unknown error")}};if(k)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-64 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-32 animate-pulse mt-2"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(a,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/skills",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})})})]}),e.jsx(l,{children:e.jsxs(d,{children:[e.jsx("div",{className:"h-6 bg-muted rounded w-48 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-64 animate-pulse"})]})})]});if(b||!s)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Skill Not Found"}),e.jsx("p",{className:"text-muted-foreground",children:"The requested skill could not be found"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(a,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/skills",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})})})]}),e.jsx(l,{children:e.jsx(o,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-destructive",children:b||"Skill not found"})})})})]});const x=s.metadata?.color||"blue";return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"space-y-1",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:B(s.name)}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(a,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(c,{to:"/skills",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})}),e.jsx(a,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(c,{to:`/skills/${s.id}/edit`,children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs(a,{variant:"destructive",size:"sm",onClick:y,children:[e.jsx(T,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Delete"})]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(l,{children:[e.jsx(d,{children:e.jsx(f,{children:"Description"})}),e.jsx(o,{children:e.jsx("p",{children:s.description})})]}),s.content&&e.jsxs(l,{children:[e.jsxs(d,{children:[e.jsx(f,{children:"Instructions"}),e.jsx(z,{children:"System prompt and behavior instructions for this skill"})]}),e.jsx(o,{children:e.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-muted p-4 rounded-md",children:s.content})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(l,{children:[e.jsx(d,{children:e.jsx(f,{children:"Actions"})}),e.jsx(o,{className:"space-y-2",children:e.jsx(a,{variant:"default",className:"w-full justify-start",asChild:!0,children:e.jsxs(c,{to:`/terminal/sk-${s.id}`,children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Use Skill"]})})})]}),e.jsxs(l,{children:[e.jsx(d,{children:e.jsx(f,{children:"Information"})}),e.jsxs(o,{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"Color"}),e.jsx(v,{variant:"outline",className:"capitalize border-2",style:{backgroundColor:i[x]?.bg||i.blue.bg,color:i[x]?.text||i.blue.text,borderColor:i[x]?.border||i.blue.border},children:x})]}),s.allowedTools&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Allowed Tools"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.allowedTools})]}),s.metadata?.mcpServers&&s.metadata.mcpServers.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"MCP Servers"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:s.metadata.mcpServers.map(r=>e.jsx(v,{variant:"secondary",children:r},r))})]}),!s.allowedTools&&!(s.metadata?.mcpServers&&s.metadata.mcpServers.length>0)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Tools"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No specific tools configured - inherits all tools"})]})]})]})]})]})]})}export{U as default};
1
+ import{x as C,u as S,r as h,j as e,B as a,L as c,Y as E,E as T,k as A,A as N}from"./index-DF2yEDGL.js";import{C as l,b as d,a as o,c as f,d as z}from"./card-Bg-wA9s_.js";import{B as v}from"./badge-BIzmYH_4.js";import{A as p}from"./arrow-left-Bo3ORcvL.js";function B(n){return n.replace(/[-_]/g," ").replace(/\b\w/g,u=>u.toUpperCase())}const i={blue:{bg:"#dbeafe",border:"#2563eb",text:"#1e40af"},green:{bg:"#dcfce7",border:"#16a34a",text:"#166534"},red:{bg:"#fee2e2",border:"#dc2626",text:"#991b1b"},emerald:{bg:"#d1fae5",border:"#10b981",text:"#047857"},purple:{bg:"#f3e8ff",border:"#9333ea",text:"#6b21a8"},orange:{bg:"#fed7aa",border:"#ea580c",text:"#9a3412"},yellow:{bg:"#fef9c3",border:"#eab308",text:"#854d0e"},teal:{bg:"#ccfbf1",border:"#14b8a6",text:"#0f766e"},indigo:{bg:"#e0e7ff",border:"#6366f1",text:"#4338ca"},pink:{bg:"#fce7f3",border:"#ec4899",text:"#9f1239"},cyan:{bg:"#cffafe",border:"#06b6d4",text:"#155e75"},slate:{bg:"#f1f5f9",border:"#475569",text:"#334155"},gray:{bg:"#f3f4f6",border:"#6b7280",text:"#374151"}};function U(){const n=C(),u=S(),[s,w]=h.useState(null),[k,g]=h.useState(!0),[b,m]=h.useState(null);h.useEffect(()=>{async function r(){try{g(!0);const j=await(await fetch(`${N}/api/v1/skills/${n.id}`)).json();j.success?w(j.document):m(j.error||"Failed to fetch skill")}catch(t){m(t instanceof Error?t.message:"Unknown error")}finally{g(!1)}}n.id&&r()},[n.id]);const y=async()=>{if(!(!s||!confirm("Are you sure you want to delete this skill?")))try{const t=await(await fetch(`${N}/api/v1/skills/${s.id}`,{method:"DELETE"})).json();t.success?u("/skills"):m(t.error?.message||"Failed to delete skill")}catch(r){m(r instanceof Error?r.message:"Unknown error")}};if(k)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-64 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-32 animate-pulse mt-2"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(a,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/skills",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})})})]}),e.jsx(l,{children:e.jsxs(d,{children:[e.jsx("div",{className:"h-6 bg-muted rounded w-48 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-64 animate-pulse"})]})})]});if(b||!s)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Skill Not Found"}),e.jsx("p",{className:"text-muted-foreground",children:"The requested skill could not be found"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(a,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/skills",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})})})]}),e.jsx(l,{children:e.jsx(o,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-destructive",children:b||"Skill not found"})})})})]});const x=s.metadata?.color||"blue";return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"space-y-1",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:B(s.name)}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(a,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(c,{to:"/skills",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(p,{className:"h-4 w-4"})})}),e.jsx(a,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(c,{to:`/skills/${s.id}/edit`,children:[e.jsx(E,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs(a,{variant:"destructive",size:"sm",onClick:y,children:[e.jsx(T,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Delete"})]})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(l,{children:[e.jsx(d,{children:e.jsx(f,{children:"Description"})}),e.jsx(o,{children:e.jsx("p",{children:s.description})})]}),s.content&&e.jsxs(l,{children:[e.jsxs(d,{children:[e.jsx(f,{children:"Instructions"}),e.jsx(z,{children:"System prompt and behavior instructions for this skill"})]}),e.jsx(o,{children:e.jsx("pre",{className:"whitespace-pre-wrap text-sm bg-muted p-4 rounded-md",children:s.content})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(l,{children:[e.jsx(d,{children:e.jsx(f,{children:"Actions"})}),e.jsx(o,{className:"space-y-2",children:e.jsx(a,{variant:"default",className:"w-full justify-start",asChild:!0,children:e.jsxs(c,{to:`/terminal/sk-${s.id}`,children:[e.jsx(A,{className:"h-4 w-4 mr-2"}),"Use Skill"]})})})]}),e.jsxs(l,{children:[e.jsx(d,{children:e.jsx(f,{children:"Information"})}),e.jsxs(o,{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"Color"}),e.jsx(v,{variant:"outline",className:"capitalize border-2",style:{backgroundColor:i[x]?.bg||i.blue.bg,color:i[x]?.text||i.blue.text,borderColor:i[x]?.border||i.blue.border},children:x})]}),s.allowedTools&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Allowed Tools"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.allowedTools})]}),s.metadata?.mcpServers&&s.metadata.mcpServers.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"MCP Servers"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:s.metadata.mcpServers.map(r=>e.jsx(v,{variant:"secondary",children:r},r))})]}),!s.allowedTools&&!(s.metadata?.mcpServers&&s.metadata.mcpServers.length>0)&&e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Tools"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No specific tools configured - inherits all tools"})]})]})]})]})]})]})}export{U as default};
@@ -1 +1 @@
1
- import{x as Q,u as V,a as W,r as i,j as e,B as u,L as v,k as X,I as B,o as Y,ab as Z,A as y}from"./index-CIFIEidO.js";import{C as N,a as C,b as O,c as ee}from"./card-_Grh-Otl.js";import{L as l}from"./label-B1lgxULu.js";import{B as se}from"./badge-rki-Xf0E.js";import{c as te}from"./clipboard-B9ndUJKl.js";import{A as D}from"./arrow-left-PEX5RePT.js";import{C as re,a as ae}from"./clipboard-DWJnnRi8.js";function me(){const{id:n}=Q(),q=V(),{toast:S}=W(),[U,k]=i.useState(!0),[o,w]=i.useState(!1),[d,c]=i.useState(null),[f,E]=i.useState(""),[x,P]=i.useState(""),[m,M]=i.useState("blue"),[h,F]=i.useState([]),[p,L]=i.useState(""),[$,g]=i.useState([]),[z,A]=i.useState(!0),[R,I]=i.useState(!1),_=["blue","green","red","emerald","purple","orange","yellow","teal","indigo","pink","cyan","slate","gray"],H={blue:{bg:"#3b82f6",border:"#1e40af",text:"#ffffff"},green:{bg:"#22c55e",border:"#15803d",text:"#ffffff"},red:{bg:"#ef4444",border:"#b91c1c",text:"#ffffff"},emerald:{bg:"#10b981",border:"#047857",text:"#ffffff"},purple:{bg:"#a855f7",border:"#7e22ce",text:"#ffffff"},orange:{bg:"#f97316",border:"#c2410c",text:"#ffffff"},yellow:{bg:"#eab308",border:"#a16207",text:"#ffffff"},teal:{bg:"#14b8a6",border:"#0f766e",text:"#ffffff"},indigo:{bg:"#6366f1",border:"#4338ca",text:"#ffffff"},pink:{bg:"#ec4899",border:"#be185d",text:"#ffffff"},cyan:{bg:"#06b6d4",border:"#0e7490",text:"#ffffff"},slate:{bg:"#64748b",border:"#475569",text:"#ffffff"},gray:{bg:"#6b7280",border:"#4b5563",text:"#ffffff"}};i.useEffect(()=>{async function s(){try{k(!0);const r=await(await fetch(`${y}/api/v1/skills/${n}`)).json();if(!r.success)throw new Error(r.error||"Failed to load skill");const t=r.document;E(t.name||""),P(t.description||""),M(t.metadata?.color||"blue"),L(t.content||""),F(Array.isArray(t.metadata?.mcpServers)?t.metadata.mcpServers:[])}catch(a){const r=a instanceof Error?a.message:"Failed to load skill";c(r)}finally{k(!1)}}n&&s()},[n]),i.useEffect(()=>{let s=!0;return(async()=>{A(!0);try{const r=await fetch(`${y}/api/v1/mcp`);if(!r.ok)throw new Error("Failed to fetch MCP servers");const t=await r.json();if(!t?.success||!Array.isArray(t.servers)){s&&g([]);return}const b=t.mcpServers&&typeof t.mcpServers=="object"?t.mcpServers:{},K=t.servers.map(T=>{const j=b[T]??{};return{name:T,enabled:j?.enabled!==!1,description:typeof j?.description=="string"?j.description:void 0}});s&&g(K)}catch(r){console.error("Failed to load MCP servers",r),s&&g([])}finally{s&&A(!1)}})(),()=>{s=!1}},[]);const J=async()=>{const s=".nut/config.json";try{await te(s),I(!0),S({title:"Copied!",description:`${s} copied to clipboard`}),setTimeout(()=>I(!1),2e3)}catch(a){console.error("Failed to copy config path:",a),S({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},G=async s=>{if(s.preventDefault(),!f.trim()||!x.trim()||!p.trim()){c("Name, description, and skill instructions are required");return}try{w(!0),c(null);const a={name:f.trim(),description:x.trim(),content:p.trim(),metadata:{color:m,mcpServers:h.length?h:void 0}},t=await(await fetch(`${y}/api/v1/skills/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(!t.success)throw new Error(t.error||"Failed to update skill");const b=t.document?.id||n;q(`/skills/${b}`)}catch(a){const r=a instanceof Error?a.message:"Failed to update skill";c(r)}finally{w(!1)}};return U?e.jsx("div",{className:"space-y-6",children:e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:"Loading skill..."})})}):d&&!f?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Skill"}),e.jsx("p",{className:"text-muted-foreground",children:"Unable to load skill"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(u,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/skills/${n}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(D,{className:"h-4 w-4"})})})})]}),e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:e.jsx("div",{className:"text-destructive",children:d})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Skill"}),e.jsxs("p",{className:"text-muted-foreground",children:["Skill ID: ",n]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(u,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/skills/${n}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(D,{className:"h-4 w-4"})})})})]}),e.jsxs(N,{children:[e.jsx(O,{children:e.jsxs(ee,{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-5 w-5"}),"Skill Configuration"]})}),e.jsx(C,{children:e.jsxs("form",{onSubmit:G,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"name",children:"Name *"}),e.jsx(B,{id:"name",value:f,onChange:s=>E(s.target.value),disabled:o})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"description",children:"Description *"}),e.jsx(B,{id:"description",value:x,onChange:s=>P(s.target.value),disabled:o})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(s=>{const a=H[s];return e.jsx("button",{type:"button",onClick:()=>M(s),disabled:o,className:`w-10 h-10 rounded-md border-2 transition-all ${m===s?"ring-2 ring-offset-2 shadow-md":"hover:scale-110 hover:shadow-sm"}`,style:{backgroundColor:a.bg,borderColor:m===s?a.border:"hsl(var(--border))",...m===s&&{"--tw-ring-color":a.border}},title:s,children:e.jsx("span",{className:"sr-only",children:s})},s)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"content",children:"Skill Instructions *"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["System prompt or instructions for this skill's behavior."," ","Insert ",e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:".nut/config.json"})," ",e.jsx("button",{type:"button",onClick:J,className:"inline-flex items-center align-middle text-muted-foreground hover:text-foreground transition-colors",title:"Copy .nut/config.json to clipboard",children:R?e.jsx(re,{className:"h-3.5 w-3.5 ml-0.5"}):e.jsx(ae,{className:"h-3.5 w-3.5 ml-0.5"})})," ","if you want the skill to be able to access its name, role, or email address."]}),e.jsx(Y,{id:"content",value:p,onChange:s=>L(s.target.value),rows:8,disabled:o,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"MCP Servers (Optional)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers this skill requires. Leave empty to inherit all available servers."}),e.jsx("div",{className:"space-y-2",children:z?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers..."}):$.length===0?e.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):$.map(s=>e.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[e.jsx(Z,{checked:h.includes(s.name),onCheckedChange:a=>{F(r=>a===!0?r.includes(s.name)?r:[...r,s.name]:r.filter(t=>t!==s.name))},disabled:o||!s.enabled}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s.name,!s.enabled&&e.jsx(se,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.enabled?s.description||"Enabled MCP server":"Enable this server in Settings to use it"})]})]},s.name))})]}),d&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:d}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(u,{type:"button",variant:"outline",asChild:!0,disabled:o,children:e.jsx(v,{to:`/skills/${n}`,children:"Cancel"})}),e.jsx(u,{type:"submit",disabled:o,children:o?"Saving...":"Save Changes"})]})]})})]})]})}export{me as default};
1
+ import{x as Q,u as V,a as W,r as i,j as e,B as u,L as v,k as X,I as B,o as Y,ab as Z,A as y}from"./index-DF2yEDGL.js";import{C as N,a as C,b as O,c as ee}from"./card-Bg-wA9s_.js";import{L as l}from"./label-Bo7tep86.js";import{B as se}from"./badge-BIzmYH_4.js";import{c as te}from"./clipboard-B9ndUJKl.js";import{A as D}from"./arrow-left-Bo3ORcvL.js";import{C as re,a as ae}from"./clipboard-BBdw7Fw8.js";function me(){const{id:n}=Q(),q=V(),{toast:S}=W(),[U,k]=i.useState(!0),[o,w]=i.useState(!1),[d,c]=i.useState(null),[f,E]=i.useState(""),[x,P]=i.useState(""),[m,M]=i.useState("blue"),[h,F]=i.useState([]),[p,L]=i.useState(""),[$,g]=i.useState([]),[z,A]=i.useState(!0),[R,I]=i.useState(!1),_=["blue","green","red","emerald","purple","orange","yellow","teal","indigo","pink","cyan","slate","gray"],H={blue:{bg:"#3b82f6",border:"#1e40af",text:"#ffffff"},green:{bg:"#22c55e",border:"#15803d",text:"#ffffff"},red:{bg:"#ef4444",border:"#b91c1c",text:"#ffffff"},emerald:{bg:"#10b981",border:"#047857",text:"#ffffff"},purple:{bg:"#a855f7",border:"#7e22ce",text:"#ffffff"},orange:{bg:"#f97316",border:"#c2410c",text:"#ffffff"},yellow:{bg:"#eab308",border:"#a16207",text:"#ffffff"},teal:{bg:"#14b8a6",border:"#0f766e",text:"#ffffff"},indigo:{bg:"#6366f1",border:"#4338ca",text:"#ffffff"},pink:{bg:"#ec4899",border:"#be185d",text:"#ffffff"},cyan:{bg:"#06b6d4",border:"#0e7490",text:"#ffffff"},slate:{bg:"#64748b",border:"#475569",text:"#ffffff"},gray:{bg:"#6b7280",border:"#4b5563",text:"#ffffff"}};i.useEffect(()=>{async function s(){try{k(!0);const r=await(await fetch(`${y}/api/v1/skills/${n}`)).json();if(!r.success)throw new Error(r.error||"Failed to load skill");const t=r.document;E(t.name||""),P(t.description||""),M(t.metadata?.color||"blue"),L(t.content||""),F(Array.isArray(t.metadata?.mcpServers)?t.metadata.mcpServers:[])}catch(a){const r=a instanceof Error?a.message:"Failed to load skill";c(r)}finally{k(!1)}}n&&s()},[n]),i.useEffect(()=>{let s=!0;return(async()=>{A(!0);try{const r=await fetch(`${y}/api/v1/mcp`);if(!r.ok)throw new Error("Failed to fetch MCP servers");const t=await r.json();if(!t?.success||!Array.isArray(t.servers)){s&&g([]);return}const b=t.mcpServers&&typeof t.mcpServers=="object"?t.mcpServers:{},K=t.servers.map(T=>{const j=b[T]??{};return{name:T,enabled:j?.enabled!==!1,description:typeof j?.description=="string"?j.description:void 0}});s&&g(K)}catch(r){console.error("Failed to load MCP servers",r),s&&g([])}finally{s&&A(!1)}})(),()=>{s=!1}},[]);const J=async()=>{const s=".nut/config.json";try{await te(s),I(!0),S({title:"Copied!",description:`${s} copied to clipboard`}),setTimeout(()=>I(!1),2e3)}catch(a){console.error("Failed to copy config path:",a),S({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},G=async s=>{if(s.preventDefault(),!f.trim()||!x.trim()||!p.trim()){c("Name, description, and skill instructions are required");return}try{w(!0),c(null);const a={name:f.trim(),description:x.trim(),content:p.trim(),metadata:{color:m,mcpServers:h.length?h:void 0}},t=await(await fetch(`${y}/api/v1/skills/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json();if(!t.success)throw new Error(t.error||"Failed to update skill");const b=t.document?.id||n;q(`/skills/${b}`)}catch(a){const r=a instanceof Error?a.message:"Failed to update skill";c(r)}finally{w(!1)}};return U?e.jsx("div",{className:"space-y-6",children:e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:"Loading skill..."})})}):d&&!f?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Skill"}),e.jsx("p",{className:"text-muted-foreground",children:"Unable to load skill"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(u,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/skills/${n}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(D,{className:"h-4 w-4"})})})})]}),e.jsx(N,{children:e.jsx(C,{className:"pt-6",children:e.jsx("div",{className:"text-destructive",children:d})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Skill"}),e.jsxs("p",{className:"text-muted-foreground",children:["Skill ID: ",n]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(u,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(v,{to:`/skills/${n}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(D,{className:"h-4 w-4"})})})})]}),e.jsxs(N,{children:[e.jsx(O,{children:e.jsxs(ee,{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-5 w-5"}),"Skill Configuration"]})}),e.jsx(C,{children:e.jsxs("form",{onSubmit:G,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"name",children:"Name *"}),e.jsx(B,{id:"name",value:f,onChange:s=>E(s.target.value),disabled:o})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"description",children:"Description *"}),e.jsx(B,{id:"description",value:x,onChange:s=>P(s.target.value),disabled:o})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"Color"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(s=>{const a=H[s];return e.jsx("button",{type:"button",onClick:()=>M(s),disabled:o,className:`w-10 h-10 rounded-md border-2 transition-all ${m===s?"ring-2 ring-offset-2 shadow-md":"hover:scale-110 hover:shadow-sm"}`,style:{backgroundColor:a.bg,borderColor:m===s?a.border:"hsl(var(--border))",...m===s&&{"--tw-ring-color":a.border}},title:s,children:e.jsx("span",{className:"sr-only",children:s})},s)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"content",children:"Skill Instructions *"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["System prompt or instructions for this skill's behavior."," ","Insert ",e.jsx("code",{className:"text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:".nut/config.json"})," ",e.jsx("button",{type:"button",onClick:J,className:"inline-flex items-center align-middle text-muted-foreground hover:text-foreground transition-colors",title:"Copy .nut/config.json to clipboard",children:R?e.jsx(re,{className:"h-3.5 w-3.5 ml-0.5"}):e.jsx(ae,{className:"h-3.5 w-3.5 ml-0.5"})})," ","if you want the skill to be able to access its name, role, or email address."]}),e.jsx(Y,{id:"content",value:p,onChange:s=>L(s.target.value),rows:8,disabled:o,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{children:"MCP Servers (Optional)"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which MCP servers this skill requires. Leave empty to inherit all available servers."}),e.jsx("div",{className:"space-y-2",children:z?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading MCP servers..."}):$.length===0?e.jsx("div",{className:"text-sm text-muted-foreground border border-dashed rounded-md p-3",children:"No MCP servers configured yet. Configure servers in Settings → MCP."}):$.map(s=>e.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-transparent bg-muted/30 px-3 py-2 hover:border-muted transition-colors",children:[e.jsx(Z,{checked:h.includes(s.name),onCheckedChange:a=>{F(r=>a===!0?r.includes(s.name)?r:[...r,s.name]:r.filter(t=>t!==s.name))},disabled:o||!s.enabled}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s.name,!s.enabled&&e.jsx(se,{variant:"secondary",className:"ml-2 text-xs",children:"Disabled"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.enabled?s.description||"Enabled MCP server":"Enable this server in Settings to use it"})]})]},s.name))})]}),d&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 p-3 rounded-md",children:d}),e.jsxs("div",{className:"flex gap-2 justify-end",children:[e.jsx(u,{type:"button",variant:"outline",asChild:!0,disabled:o,children:e.jsx(v,{to:`/skills/${n}`,children:"Cancel"})}),e.jsx(u,{type:"submit",disabled:o,children:o?"Saving...":"Save Changes"})]})]})})]})]})}export{me as default};
@@ -1,4 +1,4 @@
1
- import{c as M,j as e,S as z,_,r as f,a as $,A as R,t as O,B as j,L as y,P as E,k as F,ae as B,af as U}from"./index-CIFIEidO.js";import{C as N,a as w,b as D,c as K}from"./card-_Grh-Otl.js";import{c as V}from"./clipboard-B9ndUJKl.js";import{R as H,L}from"./browser-modal-BKnqJnf5.js";import{R as P,f as Y}from"./registry-ANRa5WBi.js";import{B as v}from"./badge-rki-Xf0E.js";import"./search-C1RuN2pO.js";/**
1
+ import{c as M,j as e,S as z,_,r as f,a as $,A as R,t as O,B as j,L as y,P as E,k as F,ae as B,af as U}from"./index-DF2yEDGL.js";import{C as N,a as w,b as D,c as K}from"./card-Bg-wA9s_.js";import{c as V}from"./clipboard-B9ndUJKl.js";import{R as H,L}from"./browser-modal-CkjrwJ8N.js";import{R as P,f as Y}from"./registry-ANRa5WBi.js";import{B as v}from"./badge-BIzmYH_4.js";import"./search-NagOQziO.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{j as s,a$ as e,B as a,L as t}from"./index-CIFIEidO.js";import{C as i,b as l,c as r,d as n,a as d}from"./card-_Grh-Otl.js";import{E as o}from"./external-link-B6dkiWgP.js";function h(){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:"Skills Management"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure and manage AI skills that automate various development tasks."})]}),s.jsx(e,{}),s.jsxs(i,{children:[s.jsxs(l,{children:[s.jsx(r,{children:"Skills"}),s.jsx(n,{children:"Skills are managed from the Skills page. Visit the skills page to create, edit, and manage your AI skills."})]}),s.jsx(d,{children:s.jsx(a,{asChild:!0,children:s.jsxs(t,{to:"/skills",children:[s.jsx(o,{className:"h-4 w-4 mr-2"}),"Go to Skills"]})})})]})]})}export{h as default};
1
+ import{j as s,bv as e,B as a,L as t}from"./index-DF2yEDGL.js";import{C as i,b as l,c as r,d as n,a as d}from"./card-Bg-wA9s_.js";import{E as o}from"./external-link--nEePPjR.js";function h(){return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-lg font-medium",children:"Skills Management"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure and manage AI skills that automate various development tasks."})]}),s.jsx(e,{}),s.jsxs(i,{children:[s.jsxs(l,{children:[s.jsx(r,{children:"Skills"}),s.jsx(n,{children:"Skills are managed from the Skills page. Visit the skills page to create, edit, and manage your AI skills."})]}),s.jsx(d,{children:s.jsx(a,{asChild:!0,children:s.jsxs(t,{to:"/skills",children:[s.jsx(o,{className:"h-4 w-4 mr-2"}),"Go to Skills"]})})})]})]})}export{h as default};
@@ -1 +1 @@
1
- import{r as h,j as t,I as x,B as d,P as j,X as N}from"./index-CIFIEidO.js";import{E as v}from"./external-link-B6dkiWgP.js";function g(n){return typeof n=="string"?n.startsWith("http://")||n.startsWith("https://")?{title:n,url:n}:{title:n}:n}function S(n){return n?n.map(g):[]}function k({sources:n,onChange:i,disabled:a}){const[l,m]=h.useState(""),[o,c]=h.useState(""),u=()=>{const e=l.trim();if(!e)return;const s=o.trim()||void 0,r={title:e,url:s};i([...n,r]),m(""),c("")},f=e=>{i(n.filter((s,r)=>r!==e))},p=e=>{e.key==="Enter"&&(e.preventDefault(),u())};return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[t.jsx(x,{placeholder:"Source title (e.g., Design System Audit)",value:l,onChange:e=>m(e.target.value),onKeyDown:p,disabled:a,className:"flex-1"}),t.jsx(x,{placeholder:"URL (optional)",value:o,onChange:e=>c(e.target.value),onKeyDown:p,disabled:a,className:"flex-1",type:"url"}),t.jsxs(d,{type:"button",variant:"outline",onClick:u,disabled:a||!l.trim(),className:"shrink-0",children:[t.jsx(j,{className:"h-4 w-4 sm:mr-1"}),t.jsx("span",{className:"hidden sm:inline",children:"Add"})]})]}),n.length>0&&t.jsx("ul",{className:"space-y-2",children:n.map((e,s)=>t.jsxs("li",{className:"flex items-start gap-2 rounded-md border bg-muted/50 p-2 text-sm",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium truncate",children:e.title}),e.url&&t.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-primary flex items-center gap-1 truncate",children:[t.jsx(v,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:e.url})]})]}),t.jsx(d,{type:"button",variant:"ghost",size:"sm",onClick:()=>f(s),disabled:a,className:"h-6 w-6 p-0 shrink-0","aria-label":`Remove source ${e.title}`,children:t.jsx(N,{className:"h-3 w-3"})})]},s))})]})}export{k as S,S as n};
1
+ import{r as h,j as t,I as x,B as d,P as j,X as N}from"./index-DF2yEDGL.js";import{E as v}from"./external-link--nEePPjR.js";function g(n){return typeof n=="string"?n.startsWith("http://")||n.startsWith("https://")?{title:n,url:n}:{title:n}:n}function S(n){return n?n.map(g):[]}function k({sources:n,onChange:i,disabled:a}){const[l,m]=h.useState(""),[o,c]=h.useState(""),u=()=>{const e=l.trim();if(!e)return;const s=o.trim()||void 0,r={title:e,url:s};i([...n,r]),m(""),c("")},f=e=>{i(n.filter((s,r)=>r!==e))},p=e=>{e.key==="Enter"&&(e.preventDefault(),u())};return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[t.jsx(x,{placeholder:"Source title (e.g., Design System Audit)",value:l,onChange:e=>m(e.target.value),onKeyDown:p,disabled:a,className:"flex-1"}),t.jsx(x,{placeholder:"URL (optional)",value:o,onChange:e=>c(e.target.value),onKeyDown:p,disabled:a,className:"flex-1",type:"url"}),t.jsxs(d,{type:"button",variant:"outline",onClick:u,disabled:a||!l.trim(),className:"shrink-0",children:[t.jsx(j,{className:"h-4 w-4 sm:mr-1"}),t.jsx("span",{className:"hidden sm:inline",children:"Add"})]})]}),n.length>0&&t.jsx("ul",{className:"space-y-2",children:n.map((e,s)=>t.jsxs("li",{className:"flex items-start gap-2 rounded-md border bg-muted/50 p-2 text-sm",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"font-medium truncate",children:e.title}),e.url&&t.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-primary flex items-center gap-1 truncate",children:[t.jsx(v,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:e.url})]})]}),t.jsx(d,{type:"button",variant:"ghost",size:"sm",onClick:()=>f(s),disabled:a,className:"h-6 w-6 p-0 shrink-0","aria-label":`Remove source ${e.title}`,children:t.jsx(N,{className:"h-3 w-3"})})]},s))})]})}export{k as S,S as n};
@@ -1 +1 @@
1
- import{r as p,j as t,I as d,B as m,X as x}from"./index-CIFIEidO.js";import{B as f}from"./badge-rki-Xf0E.js";function j({tags:a,onChange:r,disabled:n,placeholder:o}){const[l,s]=p.useState(""),c=()=>{const e=l.trim();if(e){if(a.includes(e)){s("");return}r([...a,e]),s("")}},i=e=>{r(a.filter(u=>u!==e))};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(d,{placeholder:o||"Add a tag",value:l,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),c())},disabled:n}),t.jsx(m,{type:"button",variant:"outline",onClick:c,disabled:n,children:"Add"})]}),a.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:a.map(e=>t.jsxs(f,{variant:"secondary",className:"flex items-center gap-1",children:[e,t.jsx("button",{type:"button",onClick:()=>i(e),className:"ml-1 hover:text-destructive",disabled:n,"aria-label":`Remove tag ${e}`,children:t.jsx(x,{className:"h-3 w-3"})})]},e))})]})}export{j as T};
1
+ import{r as p,j as t,I as d,B as m,X as x}from"./index-DF2yEDGL.js";import{B as f}from"./badge-BIzmYH_4.js";function j({tags:a,onChange:r,disabled:n,placeholder:o}){const[l,s]=p.useState(""),c=()=>{const e=l.trim();if(e){if(a.includes(e)){s("");return}r([...a,e]),s("")}},i=e=>{r(a.filter(u=>u!==e))};return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(d,{placeholder:o||"Add a tag",value:l,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),c())},disabled:n}),t.jsx(m,{type:"button",variant:"outline",onClick:c,disabled:n,children:"Add"})]}),a.length>0&&t.jsx("div",{className:"flex flex-wrap gap-2",children:a.map(e=>t.jsxs(f,{variant:"secondary",className:"flex items-center gap-1",children:[e,t.jsx("button",{type:"button",onClick:()=>i(e),className:"ml-1 hover:text-destructive",disabled:n,"aria-label":`Remove tag ${e}`,children:t.jsx(x,{className:"h-3 w-3"})})]},e))})]})}export{j as T};
@@ -1,4 +1,4 @@
1
- import{c as T,x as xe,u as ue,r as i,a as pe,j as e,B as n,L as c,y as je,z as fe,E as ge,H as Ne,J as ye,N as ve,O as be,Q as we,R as Ce,U as ke,D as H,V,b as B,d as q,f as J,g as K,W as G,Y as Se,_ as Q,$ as De,m as Te,o as Ae,A as u}from"./index-CIFIEidO.js";import{c as $e}from"./clipboard-B9ndUJKl.js";import{C as m,b as k,a as h,c as W,d as Pe}from"./card-_Grh-Otl.js";import{B as g}from"./badge-rki-Xf0E.js";import{L as Y}from"./label-B1lgxULu.js";import{S as X,a as Z,b as ee,c as se,d as te}from"./select-Dp3J_OE9.js";import{T as Ue,a as ae,g as Ee}from"./status-utils-PwF3DXLL.js";import{A as S}from"./arrow-left-PEX5RePT.js";import{C as Ie,a as Oe}from"./clipboard-DWJnnRi8.js";import{A as Fe}from"./arrow-up-down-OTrzDHIL.js";import{I as ze}from"./info-BvzdeJ30.js";import{P as Le}from"./play-C4YxfQOO.js";import{C as Me}from"./clock-Diqm3Csm.js";import{M as _e}from"./message-square-LKqx0LRr.js";import"./chevron-up-BM1GKhAV.js";/**
1
+ import{c as T,x as xe,u as ue,r as i,a as pe,j as e,B as n,L as c,y as je,z as fe,E as ge,H as Ne,J as ye,N as ve,O as be,Q as we,R as Ce,U as ke,D as H,V,b as B,d as q,f as J,g as K,W as G,Y as Se,_ as Q,$ as De,m as Te,o as Ae,A as u}from"./index-DF2yEDGL.js";import{c as $e}from"./clipboard-B9ndUJKl.js";import{C as m,b as k,a as h,c as W,d as Pe}from"./card-Bg-wA9s_.js";import{B as g}from"./badge-BIzmYH_4.js";import{L as Y}from"./label-Bo7tep86.js";import{S as X,a as Z,b as ee,c as se,d as te}from"./select-XHfMw_BF.js";import{T as Ue,a as ae,g as Ee}from"./status-utils-PwF3DXLL.js";import{A as S}from"./arrow-left-Bo3ORcvL.js";import{C as Ie,a as Oe}from"./clipboard-BBdw7Fw8.js";import{A as Fe}from"./arrow-up-down-vbTTNMQ9.js";import{I as ze}from"./info-jWH_Nbw8.js";import{P as Le}from"./play-Sq1Ji6eG.js";import{C as Me}from"./clock-Cg9nPTux.js";import{M as _e}from"./message-square-CJkxqplf.js";import"./index-BEvAFxs_.js";import"./chevron-up-C115Uf6r.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -13,4 +13,4 @@ import{c as T,x as xe,u as ue,r as i,a as pe,j as e,B as n,L as c,y as je,z as f
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const Be=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],qe=T("gauge",Be);function Je(a){return a>=80?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300":a>=60?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300":a>=40?"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-300":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"}function Ke(a){switch(a){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}const Ge=["low","medium","high","critical"];function ne(a){return a?a.charAt(0).toUpperCase()+a.slice(1):"None"}function D(a){const N=Date.now(),s=new Date(a).getTime(),d=N-s,y=Math.floor(d/1e3),o=Math.floor(y/60),l=Math.floor(o/60),x=Math.floor(l/24);return x>0?`${x}d ago`:l>0?`${l}h ago`:o>0?`${o}m ago`:"just now"}function os(){const{id:a}=xe(),N=ue(),[s,d]=i.useState(null),[y,o]=i.useState(!0),[l,x]=i.useState(null),[A,$]=i.useState(!1),[P,U]=i.useState(!1),[E,I]=i.useState(!1),[O,F]=i.useState(!1),[p,z]=i.useState(""),[ie,v]=i.useState(!1),[le,b]=i.useState(!1),[j,L]=i.useState("draft"),[w,M]=i.useState("medium"),[ce,_]=i.useState(!1),{toast:R}=pe();i.useEffect(()=>{async function t(){if(a)try{o(!0);const f=await(await fetch(`${u}/api/v1/tasks/${a}`)).json();f.success?d(f.data):x(f.error?.message||"Failed to fetch task")}catch(r){x(r instanceof Error?r.message:"Unknown error")}finally{o(!1)}}t()},[a]);const de=async()=>{if(a){$(!0);try{const r=await(await fetch(`${u}/api/v1/tasks/${a}`,{method:"DELETE"})).json();r.success?N("/tasks"):alert(r.error?.message||"Failed to delete task")}catch(t){alert(`Error deleting task: ${t instanceof Error?t.message:"Unknown error"}`)}finally{$(!1)}}},oe=async()=>{if(!(!s||!a||j===s.status)){U(!0);try{const r=await(await fetch(`${u}/api/v1/tasks/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:j})})).json();r.success?(d(r.data),v(!1)):alert(r.error?.message||"Failed to update status")}catch(t){alert(`Error updating status: ${t instanceof Error?t.message:"Unknown error"}`)}finally{U(!1)}}},me=async()=>{if(!(!s||!a)){I(!0);try{const r=await(await fetch(`${u}/api/v1/tasks/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({metadata:{...s.metadata,priority:w}})})).json();r.success?(d(r.data),b(!1)):alert(r.error?.message||"Failed to update priority")}catch(t){alert(`Error updating priority: ${t instanceof Error?t.message:"Unknown error"}`)}finally{I(!1)}}},he=async()=>{if(!(!s||!a||!p.trim())){F(!0);try{const t={id:`comment-${Date.now()}`,content:p,author:"current-user",createdAt:new Date().toISOString()},r=[...s.comments||[],t],C=await(await fetch(`${u}/api/v1/tasks/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:r})})).json();C.success?(d(C.data),z("")):alert(C.error?.message||"Failed to add comment")}catch(t){alert(`Error adding comment: ${t instanceof Error?t.message:"Unknown error"}`)}finally{F(!1)}}};return y?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/tasks",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsxs(m,{children:[e.jsx(k,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]})}),e.jsx(h,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-4/6 animate-pulse"})]})})]})]}):l||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:l||"Task not found"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/tasks",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsx(m,{children:e.jsx(h,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:l||"Task not found"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['The task with ID "',a,'" could not be found.']}),e.jsx(n,{asChild:!0,className:"mt-4",children:e.jsx(c,{to:"/tasks",children:"Back to Tasks"})})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.title||s.intent}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(c,{to:"/tasks",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})}),e.jsxs(je,{children:[e.jsx(fe,{asChild:!0,children:e.jsxs(n,{variant:"destructive",size:"sm",disabled:A,children:[e.jsx(ge,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:A?"Deleting...":"Delete"})]})}),e.jsxs(Ne,{children:[e.jsxs(ye,{children:[e.jsx(ve,{children:"Are you absolutely sure?"}),e.jsxs(be,{children:["This action cannot be undone. This will permanently delete the task",e.jsxs("span",{className:"font-semibold",children:[' "',s.title||s.intent,'"']})," and remove it from the system."]})]}),e.jsxs(we,{children:[e.jsx(Ce,{children:"Cancel"}),e.jsx(ke,{onClick:de,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Task"})]})]})]})]})]}),e.jsxs("button",{type:"button",onClick:async()=>{const t=`.nut/tasks/${s.id}.md`;try{await $e(t),_(!0),R({title:"Copied!",description:`${t} copied to clipboard`}),setTimeout(()=>_(!1),2e3)}catch(r){console.error("Failed to copy path:",r),R({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono",children:[e.jsx("span",{children:`.nut/tasks/${s.id}.md`}),ce?e.jsx(Ie,{className:"h-3.5 w-3.5"}):e.jsx(Oe,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(H,{open:ie,onOpenChange:v,children:[e.jsx(V,{asChild:!0,children:e.jsxs(n,{variant:"outline",size:"sm",onClick:()=>L(s?.status||"draft"),children:[e.jsx(Fe,{className:"h-4 w-4 mr-2"}),"Update Status"]})}),e.jsxs(B,{children:[e.jsxs(q,{children:[e.jsx(J,{children:"Change Task Status"}),e.jsx(K,{children:"Update the status of this task."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(Y,{htmlFor:"status",children:"Status"}),e.jsxs(X,{value:j,onValueChange:t=>L(t),children:[e.jsx(Z,{children:e.jsx(ee,{placeholder:"Select status"})}),e.jsx(se,{children:Ue.map(t=>e.jsx(te,{value:t,children:ae(t)},t))})]})]})}),e.jsxs(G,{children:[e.jsx(n,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),e.jsx(n,{onClick:oe,disabled:P||j===s?.status,children:P?"Updating...":"Update Status"})]})]})]}),e.jsxs(H,{open:le,onOpenChange:b,children:[e.jsx(V,{asChild:!0,children:e.jsxs(n,{variant:"outline",size:"sm",onClick:()=>M(s?.metadata.priority||"medium"),children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),"Update Priority"]})}),e.jsxs(B,{children:[e.jsxs(q,{children:[e.jsx(J,{children:"Change Task Priority"}),e.jsx(K,{children:"Update the priority of this task."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(Y,{htmlFor:"priority",children:"Priority"}),e.jsxs(X,{value:w,onValueChange:M,children:[e.jsx(Z,{children:e.jsx(ee,{placeholder:"Select priority"})}),e.jsx(se,{children:Ge.map(t=>e.jsx(te,{value:t,children:ne(t)},t))})]})]})}),e.jsxs(G,{children:[e.jsx(n,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsx(n,{onClick:me,disabled:E||w===s?.metadata.priority,children:E?"Updating...":"Update Priority"})]})]})]}),e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(c,{to:`/tasks/${a}/edit`,children:[e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Edit"]})}),e.jsx("div",{className:"border-l h-6 mx-1"}),e.jsx(n,{variant:"default",size:"sm",className:"bg-blue-600 hover:bg-blue-700",asChild:!0,children:e.jsxs(c,{to:`/terminal/${a}?reviewOnly=true`,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),"Review Task"]})}),e.jsx(n,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700",asChild:!0,children:e.jsxs(c,{to:`/terminal/${a}?startOnly=true`,children:[e.jsx(Le,{className:"h-4 w-4 mr-2"}),"Start Task"]})})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx(m,{children:e.jsx(h,{className:"pt-6 space-y-4",children:s.content?e.jsx(Q,{children:s.content}):e.jsx("p",{className:"text-muted-foreground",children:"No detailed content available for this task."})})}),s.planSteps&&s.planSteps.length>0&&e.jsxs(m,{children:[e.jsxs(k,{children:[e.jsx(W,{children:"Implementation Steps"}),e.jsxs(Pe,{children:[s.planSteps.length," step",s.planSteps.length!==1?"s":""," planned"]})]}),e.jsx(h,{children:e.jsx("div",{className:"space-y-3",children:s.planSteps.map((t,r)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-medium",children:r+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:t.description}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:e.jsx(g,{variant:"outline",className:"text-xs",children:t.status})})]})]},t.id))})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(m,{children:e.jsx(h,{className:"pt-6",children:e.jsxs("div",{children:[s.metadata.readiness!=null&&e.jsxs("div",{className:"flex items-center justify-between py-2 first:pt-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{children:"Readiness"})]}),e.jsxs("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold ${Je(s.metadata.readiness)}`,children:[s.metadata.readiness,"%"]})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 first:pt-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(re,{className:"h-4 w-4"}),e.jsx("span",{children:"Status"})]}),e.jsx(g,{variant:Ee(s.status),children:ae(s.status)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Ve,{className:"h-4 w-4"}),e.jsx("span",{children:"Priority"})]}),e.jsx(g,{variant:Ke(s.metadata.priority),children:ne(s.metadata.priority)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(De,{className:"h-4 w-4"}),e.jsx("span",{children:"Author"})]}),e.jsx("span",{className:"text-sm font-medium",children:s.author.name})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Te,{className:"h-4 w-4"}),e.jsx("span",{children:"Created"})]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:D(s.metadata.createdAt)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 last:pb-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Me,{className:"h-4 w-4"}),e.jsx("span",{children:"Updated"})]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:D(s.metadata.updatedAt)})]})]})})}),e.jsxs(m,{children:[e.jsx(k,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"h-5 w-5"}),e.jsx(W,{children:"Comments"}),s.comments&&s.comments.length>0&&e.jsx(g,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-xs",children:s.comments.length})]})}),e.jsxs(h,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ae,{placeholder:"Add a comment...",value:p,onChange:t=>z(t.target.value),rows:3}),e.jsx(n,{className:"w-full",onClick:he,disabled:O||!p.trim(),children:O?"Adding...":"Add Comment"})]}),s.comments&&s.comments.length>0&&e.jsx("div",{className:"space-y-3",children:[...s.comments].reverse().map((t,r)=>e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsxs("div",{className:"mb-1",children:[e.jsx("span",{className:"text-sm font-semibold",children:t.author}),e.jsx("p",{className:"text-xs text-muted-foreground",children:D(t.createdAt)})]}),e.jsx(Q,{className:"prose-sm prose-p:mb-0 prose-ul:my-1 prose-ol:my-1 text-sm",children:t.content})]},t.id||r))})]})]})]})]})]})}export{os as default};
16
+ */const Be=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],qe=T("gauge",Be);function Je(a){return a>=80?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300":a>=60?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300":a>=40?"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-300":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"}function Ke(a){switch(a){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}const Ge=["low","medium","high","critical"];function ne(a){return a?a.charAt(0).toUpperCase()+a.slice(1):"None"}function D(a){const N=Date.now(),s=new Date(a).getTime(),d=N-s,y=Math.floor(d/1e3),o=Math.floor(y/60),l=Math.floor(o/60),x=Math.floor(l/24);return x>0?`${x}d ago`:l>0?`${l}h ago`:o>0?`${o}m ago`:"just now"}function ms(){const{id:a}=xe(),N=ue(),[s,d]=i.useState(null),[y,o]=i.useState(!0),[l,x]=i.useState(null),[A,$]=i.useState(!1),[P,U]=i.useState(!1),[E,I]=i.useState(!1),[O,F]=i.useState(!1),[p,z]=i.useState(""),[ie,v]=i.useState(!1),[le,b]=i.useState(!1),[j,L]=i.useState("draft"),[w,M]=i.useState("medium"),[ce,_]=i.useState(!1),{toast:R}=pe();i.useEffect(()=>{async function t(){if(a)try{o(!0);const f=await(await fetch(`${u}/api/v1/tasks/${a}`)).json();f.success?d(f.data):x(f.error?.message||"Failed to fetch task")}catch(r){x(r instanceof Error?r.message:"Unknown error")}finally{o(!1)}}t()},[a]);const de=async()=>{if(a){$(!0);try{const r=await(await fetch(`${u}/api/v1/tasks/${a}`,{method:"DELETE"})).json();r.success?N("/tasks"):alert(r.error?.message||"Failed to delete task")}catch(t){alert(`Error deleting task: ${t instanceof Error?t.message:"Unknown error"}`)}finally{$(!1)}}},oe=async()=>{if(!(!s||!a||j===s.status)){U(!0);try{const r=await(await fetch(`${u}/api/v1/tasks/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:j})})).json();r.success?(d(r.data),v(!1)):alert(r.error?.message||"Failed to update status")}catch(t){alert(`Error updating status: ${t instanceof Error?t.message:"Unknown error"}`)}finally{U(!1)}}},me=async()=>{if(!(!s||!a)){I(!0);try{const r=await(await fetch(`${u}/api/v1/tasks/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({metadata:{...s.metadata,priority:w}})})).json();r.success?(d(r.data),b(!1)):alert(r.error?.message||"Failed to update priority")}catch(t){alert(`Error updating priority: ${t instanceof Error?t.message:"Unknown error"}`)}finally{I(!1)}}},he=async()=>{if(!(!s||!a||!p.trim())){F(!0);try{const t={id:`comment-${Date.now()}`,content:p,author:"current-user",createdAt:new Date().toISOString()},r=[...s.comments||[],t],C=await(await fetch(`${u}/api/v1/tasks/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:r})})).json();C.success?(d(C.data),z("")):alert(C.error?.message||"Failed to add comment")}catch(t){alert(`Error adding comment: ${t instanceof Error?t.message:"Unknown error"}`)}finally{F(!1)}}};return y?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/tasks",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsxs(m,{children:[e.jsx(k,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]})}),e.jsx(h,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-4/6 animate-pulse"})]})})]})]}):l||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:l||"Task not found"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(c,{to:"/tasks",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsx(m,{children:e.jsx(h,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:l||"Task not found"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['The task with ID "',a,'" could not be found.']}),e.jsx(n,{asChild:!0,className:"mt-4",children:e.jsx(c,{to:"/tasks",children:"Back to Tasks"})})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.title||s.intent}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(c,{to:"/tasks",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})}),e.jsxs(je,{children:[e.jsx(fe,{asChild:!0,children:e.jsxs(n,{variant:"destructive",size:"sm",disabled:A,children:[e.jsx(ge,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:A?"Deleting...":"Delete"})]})}),e.jsxs(Ne,{children:[e.jsxs(ye,{children:[e.jsx(ve,{children:"Are you absolutely sure?"}),e.jsxs(be,{children:["This action cannot be undone. This will permanently delete the task",e.jsxs("span",{className:"font-semibold",children:[' "',s.title||s.intent,'"']})," and remove it from the system."]})]}),e.jsxs(we,{children:[e.jsx(Ce,{children:"Cancel"}),e.jsx(ke,{onClick:de,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Task"})]})]})]})]})]}),e.jsxs("button",{type:"button",onClick:async()=>{const t=`.nut/tasks/${s.id}.md`;try{await $e(t),_(!0),R({title:"Copied!",description:`${t} copied to clipboard`}),setTimeout(()=>_(!1),2e3)}catch(r){console.error("Failed to copy path:",r),R({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono",children:[e.jsx("span",{children:`.nut/tasks/${s.id}.md`}),ce?e.jsx(Ie,{className:"h-3.5 w-3.5"}):e.jsx(Oe,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(H,{open:ie,onOpenChange:v,children:[e.jsx(V,{asChild:!0,children:e.jsxs(n,{variant:"outline",size:"sm",onClick:()=>L(s?.status||"draft"),children:[e.jsx(Fe,{className:"h-4 w-4 mr-2"}),"Update Status"]})}),e.jsxs(B,{children:[e.jsxs(q,{children:[e.jsx(J,{children:"Change Task Status"}),e.jsx(K,{children:"Update the status of this task."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(Y,{htmlFor:"status",children:"Status"}),e.jsxs(X,{value:j,onValueChange:t=>L(t),children:[e.jsx(Z,{children:e.jsx(ee,{placeholder:"Select status"})}),e.jsx(se,{children:Ue.map(t=>e.jsx(te,{value:t,children:ae(t)},t))})]})]})}),e.jsxs(G,{children:[e.jsx(n,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),e.jsx(n,{onClick:oe,disabled:P||j===s?.status,children:P?"Updating...":"Update Status"})]})]})]}),e.jsxs(H,{open:le,onOpenChange:b,children:[e.jsx(V,{asChild:!0,children:e.jsxs(n,{variant:"outline",size:"sm",onClick:()=>M(s?.metadata.priority||"medium"),children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),"Update Priority"]})}),e.jsxs(B,{children:[e.jsxs(q,{children:[e.jsx(J,{children:"Change Task Priority"}),e.jsx(K,{children:"Update the priority of this task."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(Y,{htmlFor:"priority",children:"Priority"}),e.jsxs(X,{value:w,onValueChange:M,children:[e.jsx(Z,{children:e.jsx(ee,{placeholder:"Select priority"})}),e.jsx(se,{children:Ge.map(t=>e.jsx(te,{value:t,children:ne(t)},t))})]})]})}),e.jsxs(G,{children:[e.jsx(n,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsx(n,{onClick:me,disabled:E||w===s?.metadata.priority,children:E?"Updating...":"Update Priority"})]})]})]}),e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(c,{to:`/tasks/${a}/edit`,children:[e.jsx(Se,{className:"h-4 w-4 mr-2"}),"Edit"]})}),e.jsx("div",{className:"border-l h-6 mx-1"}),e.jsx(n,{variant:"default",size:"sm",className:"bg-blue-600 hover:bg-blue-700",asChild:!0,children:e.jsxs(c,{to:`/terminal/${a}?reviewOnly=true`,children:[e.jsx(ze,{className:"h-4 w-4 mr-2"}),"Review Task"]})}),e.jsx(n,{variant:"default",size:"sm",className:"bg-green-600 hover:bg-green-700",asChild:!0,children:e.jsxs(c,{to:`/terminal/${a}?startOnly=true`,children:[e.jsx(Le,{className:"h-4 w-4 mr-2"}),"Start Task"]})})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx(m,{children:e.jsx(h,{className:"pt-6 space-y-4",children:s.content?e.jsx(Q,{children:s.content}):e.jsx("p",{className:"text-muted-foreground",children:"No detailed content available for this task."})})}),s.planSteps&&s.planSteps.length>0&&e.jsxs(m,{children:[e.jsxs(k,{children:[e.jsx(W,{children:"Implementation Steps"}),e.jsxs(Pe,{children:[s.planSteps.length," step",s.planSteps.length!==1?"s":""," planned"]})]}),e.jsx(h,{children:e.jsx("div",{className:"space-y-3",children:s.planSteps.map((t,r)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-medium",children:r+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:t.description}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:e.jsx(g,{variant:"outline",className:"text-xs",children:t.status})})]})]},t.id))})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(m,{children:e.jsx(h,{className:"pt-6",children:e.jsxs("div",{children:[s.metadata.readiness!=null&&e.jsxs("div",{className:"flex items-center justify-between py-2 first:pt-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(qe,{className:"h-4 w-4"}),e.jsx("span",{children:"Readiness"})]}),e.jsxs("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold ${Je(s.metadata.readiness)}`,children:[s.metadata.readiness,"%"]})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 first:pt-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(re,{className:"h-4 w-4"}),e.jsx("span",{children:"Status"})]}),e.jsx(g,{variant:Ee(s.status),children:ae(s.status)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Ve,{className:"h-4 w-4"}),e.jsx("span",{children:"Priority"})]}),e.jsx(g,{variant:Ke(s.metadata.priority),children:ne(s.metadata.priority)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(De,{className:"h-4 w-4"}),e.jsx("span",{children:"Author"})]}),e.jsx("span",{className:"text-sm font-medium",children:s.author.name})]}),e.jsxs("div",{className:"flex items-center justify-between py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Te,{className:"h-4 w-4"}),e.jsx("span",{children:"Created"})]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:D(s.metadata.createdAt)})]}),e.jsxs("div",{className:"flex items-center justify-between py-2 last:pb-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Me,{className:"h-4 w-4"}),e.jsx("span",{children:"Updated"})]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:D(s.metadata.updatedAt)})]})]})})}),e.jsxs(m,{children:[e.jsx(k,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"h-5 w-5"}),e.jsx(W,{children:"Comments"}),s.comments&&s.comments.length>0&&e.jsx(g,{variant:"secondary",className:"rounded-full px-2 py-0.5 text-xs",children:s.comments.length})]})}),e.jsxs(h,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(Ae,{placeholder:"Add a comment...",value:p,onChange:t=>z(t.target.value),rows:3}),e.jsx(n,{className:"w-full",onClick:he,disabled:O||!p.trim(),children:O?"Adding...":"Add Comment"})]}),s.comments&&s.comments.length>0&&e.jsx("div",{className:"space-y-3",children:[...s.comments].reverse().map((t,r)=>e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsxs("div",{className:"mb-1",children:[e.jsx("span",{className:"text-sm font-semibold",children:t.author}),e.jsx("p",{className:"text-xs text-muted-foreground",children:D(t.createdAt)})]}),e.jsx(Q,{className:"prose-sm prose-p:mb-0 prose-ul:my-1 prose-ol:my-1 text-sm",children:t.content})]},t.id||r))})]})]})]})]})]})}export{ms as default};
@@ -0,0 +1 @@
1
+ import{x as R,u as U,a as H,r as c,A,j as e,B as h,L as p,I as O,X as V,a0 as _}from"./index-DF2yEDGL.js";import{L as j}from"./label-Bo7tep86.js";import{S as D,a as L,b as F,c as I,d as r}from"./select-XHfMw_BF.js";import{C as f,b as $,a as v,c as q,d as J}from"./card-Bg-wA9s_.js";import{M as K}from"./markdown-editor-DGcgv9Jo.js";import{C as W}from"./CollapsibleSection-D_16mIbS.js";import{I as X,L as G}from"./ImplementationStepsEditor-CpIE-yvb.js";import{T as Q}from"./TagInput-C1r8NbaU.js";import{A as N}from"./arrow-left-Bo3ORcvL.js";import"./index-BEvAFxs_.js";import"./chevron-up-C115Uf6r.js";import"./badge-BIzmYH_4.js";function oe(){const{id:i}=R(),P=U(),{toast:y}=H(),[z,S]=c.useState(!0),[u,k]=c.useState(!1),[C,w]=c.useState(null),[n,o]=c.useState({title:"",description:"",priority:"medium",status:"draft",author:{id:"current-user",name:"Current User",email:"user@example.com"}}),[m,b]=c.useState([]),[T,E]=c.useState([]);c.useEffect(()=>{i&&B()},[i]);const B=async()=>{try{S(!0);const t=await fetch(`${A}/api/v1/tasks/${i}`),s=await t.json();if(s.success||s.data||t.ok){const a=s.data||s;o({title:a.title||a.intent||"",description:a.content||"",priority:a.metadata?.priority||"medium",status:a.status||"draft",author:{id:a.author?.id||"current-user",name:a.author?.name||"Current User",email:a.author?.email||"user@example.com"}});const g=Array.isArray(a.planSteps)?a.planSteps:[];b(g.map((d,x)=>({id:d.id||`step-${x+1}`,description:d.description||"",status:d.status||"pending"}))),E(a.metadata?.tags||[])}else w(s.error?.message||"Failed to fetch task")}catch(t){w(t instanceof Error?t.message:"An error occurred")}finally{S(!1)}},M=async t=>{t.preventDefault(),k(!0);try{const s=m.map(l=>({id:l.id,description:l.description.trim(),status:l.status})).filter(l=>l.description.length>0),a=T.map(l=>l.trim()).filter(l=>l.length>0),g={title:n.title,status:n.status,planSteps:s,metadata:{priority:n.priority,tags:a},content:n.description},d=await fetch(`${A}/api/v1/tasks/${i}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),x=await d.json();if(x.success||d.ok)y({title:"Success",description:"Task updated successfully."}),P(`/tasks/${i}`);else throw new Error(x.error?.message||"Failed to update task")}catch(s){y({title:"Error",description:`Failed to update task: ${s instanceof Error?s.message:"An error occurred"}`,variant:"destructive"})}finally{k(!1)}};return z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Task"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading task data..."})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(p,{to:`/tasks/${i}`,className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsxs(f,{children:[e.jsx($,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-1/2 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-3/4 animate-pulse"})]})}),e.jsx(v,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-64 bg-muted rounded animate-pulse"})]})})]})]}):C?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(p,{to:"/tasks",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx(f,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:C})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Task"}),e.jsxs("p",{className:"text-muted-foreground",children:["Editing ",i]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(p,{to:`/tasks/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx("form",{onSubmit:M,children:e.jsxs(f,{children:[e.jsxs($,{children:[e.jsx(q,{children:"Task Details"}),e.jsx(J,{children:"Update the information for your task"})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"title",children:"Title *"}),e.jsx(O,{id:"title",placeholder:"Brief description of what you want to change",value:n.title,onChange:t=>o(s=>({...s,title:t.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"description",children:"Description"}),e.jsx(K,{value:n.description,onChange:t=>o(s=>({...s,description:t||""})),placeholder:"Write your task description in markdown...",height:400})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"status",children:"Status"}),e.jsxs(D,{value:n.status,onValueChange:t=>o(s=>({...s,status:t})),children:[e.jsx(L,{children:e.jsx(F,{placeholder:"Select status"})}),e.jsxs(I,{children:[e.jsx(r,{value:"draft",children:"Draft"}),e.jsx(r,{value:"proposed",children:"Proposed"}),e.jsx(r,{value:"in-review",children:"In Review"}),e.jsx(r,{value:"approved",children:"Approved"}),e.jsx(r,{value:"code-complete",children:"Code Complete"}),e.jsx(r,{value:"rejected",children:"Rejected"}),e.jsx(r,{value:"merged",children:"Merged"})]})]})]}),e.jsx(W,{defaultOpen:!0,icon:e.jsx(G,{className:"h-4 w-4"}),title:"Optional Implementation Detail",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"priority",children:"Priority"}),e.jsxs(D,{value:n.priority,onValueChange:t=>o(s=>({...s,priority:t})),children:[e.jsx(L,{children:e.jsx(F,{placeholder:"Select priority"})}),e.jsxs(I,{children:[e.jsx(r,{value:"low",children:"Low"}),e.jsx(r,{value:"medium",children:"Medium"}),e.jsx(r,{value:"high",children:"High"}),e.jsx(r,{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Implementation Steps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keep the implementation plan accurate as work progresses."})]}),m.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m.length," step",m.length===1?"":"s"]})]}),e.jsx(X,{steps:m,onChange:b,disabled:u})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Tags"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tags power filtering and discovery across the task list."}),e.jsx(Q,{tags:T,onChange:E,disabled:u,placeholder:"Add a tag (e.g. backend, rollout)"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(h,{type:"button",variant:"outline",asChild:!0,children:e.jsxs(p,{to:`/tasks/${i}`,children:[e.jsx(V,{className:"mr-2 h-4 w-4"}),"Cancel"]})}),e.jsx(h,{type:"submit",disabled:u||!n.title,children:u?e.jsx(e.Fragment,{children:"Saving..."}):e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Save Changes"]})})]})]})]})})]})}export{oe as TaskEditPage};
@@ -1,4 +1,4 @@
1
- import{c as Ce,w as Ke,u as ze,q as Ve,r as A,j as t,B as P,L as te,P as ue,I as We,X,K as Ue,p as Ge,n as He,G as Qe,C as Ye,A as Xe}from"./index-CIFIEidO.js";import{C as J,a as Z,c as Je}from"./card-_Grh-Otl.js";import{B as se}from"./badge-rki-Xf0E.js";import{S as oe,a as he,b as de,c as me,d as B}from"./select-Dp3J_OE9.js";import{A as Ze,a as Ee,T as qe,g as et}from"./status-utils-PwF3DXLL.js";import{S as tt}from"./search-C1RuN2pO.js";import{C as st}from"./chevron-up-BM1GKhAV.js";import{C as rt}from"./chevron-left-LQtIDk73.js";/**
1
+ import{c as Ce,w as Ke,u as ze,q as Ve,r as A,j as t,B as P,L as te,P as ue,I as We,X,K as Ue,p as Ge,n as He,G as Qe,C as Ye,A as Xe}from"./index-DF2yEDGL.js";import{C as J,a as Z,c as Je}from"./card-Bg-wA9s_.js";import{B as se}from"./badge-BIzmYH_4.js";import{S as oe,a as he,b as de,c as me,d as B}from"./select-XHfMw_BF.js";import{A as Ze,a as Ee,T as qe,g as et}from"./status-utils-PwF3DXLL.js";import{S as tt}from"./search-NagOQziO.js";import{C as st}from"./chevron-up-C115Uf6r.js";import{C as rt}from"./chevron-left-DO-Zz6cq.js";import"./index-BEvAFxs_.js";/**
2
2
  * @license lucide-react v0.542.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -13,5 +13,5 @@ import{c as Ce,w as Ke,u as ze,q as Ve,r as A,j as t,B as P,L as te,P as ue,I as
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const lt=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],be=Ce("funnel",lt);function K(s){return Array.isArray?Array.isArray(s):_e(s)==="[object Array]"}function ut(s){if(typeof s=="string")return s;let e=s+"";return e=="0"&&1/s==-1/0?"-0":e}function ot(s){return s==null?"":ut(s)}function O(s){return typeof s=="string"}function De(s){return typeof s=="number"}function ht(s){return s===!0||s===!1||dt(s)&&_e(s)=="[object Boolean]"}function ke(s){return typeof s=="object"}function dt(s){return ke(s)&&s!==null}function D(s){return s!=null}function fe(s){return!s.trim().length}function _e(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}const mt="Incorrect 'index' type",ft=s=>`Invalid value for key ${s}`,gt=s=>`Pattern length exceeds max of ${s}.`,xt=s=>`Missing ${s} property in key`,pt=s=>`Property 'weight' in key '${s}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class At{constructor(e){this._keys=[],this._keyMap={};let r=0;e.forEach(n=>{let a=Ie(n);this._keys.push(a),this._keyMap[a.id]=a,r+=a.weight}),this._keys.forEach(n=>{n.weight/=r})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ie(s){let e=null,r=null,n=null,a=1,c=null;if(O(s)||K(s))n=s,e=Fe(s),r=ge(s);else{if(!ve.call(s,"name"))throw new Error(xt("name"));const l=s.name;if(n=l,ve.call(s,"weight")&&(a=s.weight,a<=0))throw new Error(pt(l));e=Fe(l),r=ge(l),c=s.getFn}return{path:e,id:r,weight:a,src:n,getFn:c}}function Fe(s){return K(s)?s:s.split(".")}function ge(s){return K(s)?s.join("."):s}function jt(s,e){let r=[],n=!1;const a=(c,l,u)=>{if(D(c))if(!l[u])r.push(c);else{let o=l[u];const h=c[o];if(!D(h))return;if(u===l.length-1&&(O(h)||De(h)||ht(h)))r.push(ot(h));else if(K(h)){n=!0;for(let d=0,f=h.length;d<f;d+=1)a(h[d],l,u+1)}else l.length&&a(h,l,u+1)}};return a(s,O(e)?e.split("."):e,0),n?r:r[0]}const yt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Ct={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(s,e)=>s.score===e.score?s.idx<e.idx?-1:1:s.score<e.score?-1:1},wt={location:0,threshold:.6,distance:100},Nt={useExtendedSearch:!1,getFn:jt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var m={...Ct,...yt,...wt,...Nt};const Et=/[^ ]+/g;function bt(s=1,e=3){const r=new Map,n=Math.pow(10,e);return{get(a){const c=a.match(Et).length;if(r.has(c))return r.get(c);const l=1/Math.pow(c,.5*s),u=parseFloat(Math.round(l*n)/n);return r.set(c,u),u},clear(){r.clear()}}}class we{constructor({getFn:e=m.getFn,fieldNormWeight:r=m.fieldNormWeight}={}){this.norm=bt(r,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,O(this.docs[0])?this.docs.forEach((e,r)=>{this._addString(e,r)}):this.docs.forEach((e,r)=>{this._addObject(e,r)}),this.norm.clear())}add(e){const r=this.size();O(e)?this._addString(e,r):this._addObject(e,r)}removeAt(e){this.records.splice(e,1);for(let r=e,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(e,r){return e[this._keysMap[r]]}size(){return this.records.length}_addString(e,r){if(!D(e)||fe(e))return;let n={v:e,i:r,n:this.norm.get(e)};this.records.push(n)}_addObject(e,r){let n={i:r,$:{}};this.keys.forEach((a,c)=>{let l=a.getFn?a.getFn(e):this.getFn(e,a.path);if(D(l)){if(K(l)){let u=[];const o=[{nestedArrIndex:-1,value:l}];for(;o.length;){const{nestedArrIndex:h,value:d}=o.pop();if(D(d))if(O(d)&&!fe(d)){let f={v:d,i:h,n:this.norm.get(d)};u.push(f)}else K(d)&&d.forEach((f,p)=>{o.push({nestedArrIndex:p,value:f})})}n.$[c]=u}else if(O(l)&&!fe(l)){let u={v:l,n:this.norm.get(l)};n.$[c]=u}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Le(s,e,{getFn:r=m.getFn,fieldNormWeight:n=m.fieldNormWeight}={}){const a=new we({getFn:r,fieldNormWeight:n});return a.setKeys(s.map(Ie)),a.setSources(e),a.create(),a}function vt(s,{getFn:e=m.getFn,fieldNormWeight:r=m.fieldNormWeight}={}){const{keys:n,records:a}=s,c=new we({getFn:e,fieldNormWeight:r});return c.setKeys(n),c.setIndexRecords(a),c}function re(s,{errors:e=0,currentLocation:r=0,expectedLocation:n=0,distance:a=m.distance,ignoreLocation:c=m.ignoreLocation}={}){const l=e/s.length;if(c)return l;const u=Math.abs(n-r);return a?l+u/a:u?1:l}function Ft(s=[],e=m.minMatchCharLength){let r=[],n=-1,a=-1,c=0;for(let l=s.length;c<l;c+=1){let u=s[c];u&&n===-1?n=c:!u&&n!==-1&&(a=c-1,a-n+1>=e&&r.push([n,a]),n=-1)}return s[c-1]&&c-n>=e&&r.push([n,c-1]),r}const U=32;function Mt(s,e,r,{location:n=m.location,distance:a=m.distance,threshold:c=m.threshold,findAllMatches:l=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,includeMatches:o=m.includeMatches,ignoreLocation:h=m.ignoreLocation}={}){if(e.length>U)throw new Error(gt(U));const d=e.length,f=s.length,p=Math.max(0,Math.min(n,f));let x=c,j=p;const C=u>1||o,M=C?Array(f):[];let v;for(;(v=s.indexOf(e,j))>-1;){let E=re(e,{currentLocation:v,expectedLocation:p,distance:a,ignoreLocation:h});if(x=Math.min(E,x),j=v+d,C){let R=0;for(;R<d;)M[v+R]=1,R+=1}}j=-1;let k=[],F=1,L=d+f;const ie=1<<d-1;for(let E=0;E<d;E+=1){let R=0,_=L;for(;R<_;)re(e,{errors:E,currentLocation:p+_,expectedLocation:p,distance:a,ignoreLocation:h})<=x?R=_:L=_,_=Math.floor((L-R)/2+R);L=_;let G=Math.max(1,p-_+1),N=l?f:Math.min(p+_,f)+d,I=Array(N+2);I[N+1]=(1<<E)-1;for(let b=N;b>=G;b-=1){let W=b-1,ee=r[s.charAt(W)];if(C&&(M[W]=+!!ee),I[b]=(I[b+1]<<1|1)&ee,E&&(I[b]|=(k[b+1]|k[b])<<1|1|k[b+1]),I[b]&ie&&(F=re(e,{errors:E,currentLocation:W,expectedLocation:p,distance:a,ignoreLocation:h}),F<=x)){if(x=F,j=W,j<=p)break;G=Math.max(1,2*p-j)}}if(re(e,{errors:E+1,currentLocation:p,expectedLocation:p,distance:a,ignoreLocation:h})>x)break;k=I}const T={isMatch:j>=0,score:Math.max(.001,F)};if(C){const E=Ft(M,u);E.length?o&&(T.indices=E):T.isMatch=!1}return T}function St(s){let e={};for(let r=0,n=s.length;r<n;r+=1){const a=s.charAt(r);e[a]=(e[a]||0)|1<<n-r-1}return e}const ne=String.prototype.normalize?(s=>s.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(s=>s);class Te{constructor(e,{location:r=m.location,threshold:n=m.threshold,distance:a=m.distance,includeMatches:c=m.includeMatches,findAllMatches:l=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,isCaseSensitive:o=m.isCaseSensitive,ignoreDiacritics:h=m.ignoreDiacritics,ignoreLocation:d=m.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:a,includeMatches:c,findAllMatches:l,minMatchCharLength:u,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d},e=o?e:e.toLowerCase(),e=h?ne(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const f=(x,j)=>{this.chunks.push({pattern:x,alphabet:St(x),startIndex:j})},p=this.pattern.length;if(p>U){let x=0;const j=p%U,C=p-j;for(;x<C;)f(this.pattern.substr(x,U),x),x+=U;if(j){const M=p-U;f(this.pattern.substr(M),M)}}else f(this.pattern,0)}searchIn(e){const{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a}=this.options;if(e=r?e:e.toLowerCase(),e=n?ne(e):e,this.pattern===e){let C={isMatch:!0,score:0};return a&&(C.indices=[[0,e.length-1]]),C}const{location:c,distance:l,threshold:u,findAllMatches:o,minMatchCharLength:h,ignoreLocation:d}=this.options;let f=[],p=0,x=!1;this.chunks.forEach(({pattern:C,alphabet:M,startIndex:v})=>{const{isMatch:k,score:F,indices:L}=Mt(e,C,M,{location:c+v,distance:l,threshold:u,findAllMatches:o,minMatchCharLength:h,includeMatches:a,ignoreLocation:d});k&&(x=!0),p+=F,k&&L&&(f=[...f,...L])});let j={isMatch:x,score:x?p/this.chunks.length:1};return x&&a&&(j.indices=f),j}}class V{constructor(e){this.pattern=e}static isMultiMatch(e){return Me(e,this.multiRegex)}static isSingleMatch(e){return Me(e,this.singleRegex)}search(){}}function Me(s,e){const r=s.match(e);return r?r[1]:null}class Bt extends V{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const r=e===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class Dt extends V{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class kt extends V{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const r=e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class _t extends V{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const r=!e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class It extends V{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const r=e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Lt extends V{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const r=!e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class Re extends V{constructor(e,{location:r=m.location,threshold:n=m.threshold,distance:a=m.distance,includeMatches:c=m.includeMatches,findAllMatches:l=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,isCaseSensitive:o=m.isCaseSensitive,ignoreDiacritics:h=m.ignoreDiacritics,ignoreLocation:d=m.ignoreLocation}={}){super(e),this._bitapSearch=new Te(e,{location:r,threshold:n,distance:a,includeMatches:c,findAllMatches:l,minMatchCharLength:u,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class $e extends V{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let r=0,n;const a=[],c=this.pattern.length;for(;(n=e.indexOf(this.pattern,r))>-1;)r=n+c,a.push([n,r-1]);const l=!!a.length;return{isMatch:l,score:l?0:1,indices:a}}}const xe=[Bt,$e,kt,_t,Lt,It,Dt,Re],Se=xe.length,Tt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Rt="|";function $t(s,e={}){return s.split(Rt).map(r=>{let n=r.trim().split(Tt).filter(c=>c&&!!c.trim()),a=[];for(let c=0,l=n.length;c<l;c+=1){const u=n[c];let o=!1,h=-1;for(;!o&&++h<Se;){const d=xe[h];let f=d.isMultiMatch(u);f&&(a.push(new d(f,e)),o=!0)}if(!o)for(h=-1;++h<Se;){const d=xe[h];let f=d.isSingleMatch(u);if(f){a.push(new d(f,e));break}}}return a})}const Ot=new Set([Re.type,$e.type]);class Pt{constructor(e,{isCaseSensitive:r=m.isCaseSensitive,ignoreDiacritics:n=m.ignoreDiacritics,includeMatches:a=m.includeMatches,minMatchCharLength:c=m.minMatchCharLength,ignoreLocation:l=m.ignoreLocation,findAllMatches:u=m.findAllMatches,location:o=m.location,threshold:h=m.threshold,distance:d=m.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a,minMatchCharLength:c,findAllMatches:u,ignoreLocation:l,location:o,threshold:h,distance:d},e=r?e:e.toLowerCase(),e=n?ne(e):e,this.pattern=e,this.query=$t(this.pattern,this.options)}static condition(e,r){return r.useExtendedSearch}searchIn(e){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:a,ignoreDiacritics:c}=this.options;e=a?e:e.toLowerCase(),e=c?ne(e):e;let l=0,u=[],o=0;for(let h=0,d=r.length;h<d;h+=1){const f=r[h];u.length=0,l=0;for(let p=0,x=f.length;p<x;p+=1){const j=f[p],{isMatch:C,indices:M,score:v}=j.search(e);if(C){if(l+=1,o+=v,n){const k=j.constructor.type;Ot.has(k)?u=[...u,...M]:u.push(M)}}else{o=0,l=0,u.length=0;break}}if(l){let p={isMatch:!0,score:o/l};return n&&(p.indices=u),p}}return{isMatch:!1,score:1}}}const pe=[];function Kt(...s){pe.push(...s)}function Ae(s,e){for(let r=0,n=pe.length;r<n;r+=1){let a=pe[r];if(a.condition(s,e))return new a(s,e)}return new Te(s,e)}const ae={AND:"$and",OR:"$or"},je={PATH:"$path",PATTERN:"$val"},ye=s=>!!(s[ae.AND]||s[ae.OR]),zt=s=>!!s[je.PATH],Vt=s=>!K(s)&&ke(s)&&!ye(s),Be=s=>({[ae.AND]:Object.keys(s).map(e=>({[e]:s[e]}))});function Oe(s,e,{auto:r=!0}={}){const n=a=>{let c=Object.keys(a);const l=zt(a);if(!l&&c.length>1&&!ye(a))return n(Be(a));if(Vt(a)){const o=l?a[je.PATH]:c[0],h=l?a[je.PATTERN]:a[o];if(!O(h))throw new Error(ft(o));const d={keyId:ge(o),pattern:h};return r&&(d.searcher=Ae(h,e)),d}let u={children:[],operator:c[0]};return c.forEach(o=>{const h=a[o];K(h)&&h.forEach(d=>{u.children.push(n(d))})}),u};return ye(s)||(s=Be(s)),n(s)}function Wt(s,{ignoreFieldNorm:e=m.ignoreFieldNorm}){s.forEach(r=>{let n=1;r.matches.forEach(({key:a,norm:c,score:l})=>{const u=a?a.weight:null;n*=Math.pow(l===0&&u?Number.EPSILON:l,(u||1)*(e?1:c))}),r.score=n})}function Ut(s,e){const r=s.matches;e.matches=[],D(r)&&r.forEach(n=>{if(!D(n.indices)||!n.indices.length)return;const{indices:a,value:c}=n;let l={indices:a,value:c};n.key&&(l.key=n.key.src),n.idx>-1&&(l.refIndex=n.idx),e.matches.push(l)})}function Gt(s,e){e.score=s.score}function Ht(s,e,{includeMatches:r=m.includeMatches,includeScore:n=m.includeScore}={}){const a=[];return r&&a.push(Ut),n&&a.push(Gt),s.map(c=>{const{idx:l}=c,u={item:e[l],refIndex:l};return a.length&&a.forEach(o=>{o(c,u)}),u})}class H{constructor(e,r={},n){this.options={...m,...r},this.options.useExtendedSearch,this._keyStore=new At(this.options.keys),this.setCollection(e,n)}setCollection(e,r){if(this._docs=e,r&&!(r instanceof we))throw new Error(mt);this._myIndex=r||Le(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){D(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const r=[];for(let n=0,a=this._docs.length;n<a;n+=1){const c=this._docs[n];e(c,n)&&(this.removeAt(n),n-=1,a-=1,r.push(c))}return r}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:r=-1}={}){const{includeMatches:n,includeScore:a,shouldSort:c,sortFn:l,ignoreFieldNorm:u}=this.options;let o=O(e)?O(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return Wt(o,{ignoreFieldNorm:u}),c&&o.sort(l),De(r)&&r>-1&&(o=o.slice(0,r)),Ht(o,this._docs,{includeMatches:n,includeScore:a})}_searchStringList(e){const r=Ae(e,this.options),{records:n}=this._myIndex,a=[];return n.forEach(({v:c,i:l,n:u})=>{if(!D(c))return;const{isMatch:o,score:h,indices:d}=r.searchIn(c);o&&a.push({item:c,idx:l,matches:[{score:h,value:c,norm:u,indices:d}]})}),a}_searchLogical(e){const r=Oe(e,this.options),n=(u,o,h)=>{if(!u.children){const{keyId:f,searcher:p}=u,x=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(o,f),searcher:p});return x&&x.length?[{idx:h,item:o,matches:x}]:[]}const d=[];for(let f=0,p=u.children.length;f<p;f+=1){const x=u.children[f],j=n(x,o,h);if(j.length)d.push(...j);else if(u.operator===ae.AND)return[]}return d},a=this._myIndex.records,c={},l=[];return a.forEach(({$:u,i:o})=>{if(D(u)){let h=n(r,u,o);h.length&&(c[o]||(c[o]={idx:o,item:u,matches:[]},l.push(c[o])),h.forEach(({matches:d})=>{c[o].matches.push(...d)}))}}),l}_searchObjectList(e){const r=Ae(e,this.options),{keys:n,records:a}=this._myIndex,c=[];return a.forEach(({$:l,i:u})=>{if(!D(l))return;let o=[];n.forEach((h,d)=>{o.push(...this._findMatches({key:h,value:l[d],searcher:r}))}),o.length&&c.push({idx:u,item:l,matches:o})}),c}_findMatches({key:e,value:r,searcher:n}){if(!D(r))return[];let a=[];if(K(r))r.forEach(({v:c,i:l,n:u})=>{if(!D(c))return;const{isMatch:o,score:h,indices:d}=n.searchIn(c);o&&a.push({score:h,key:e,value:c,idx:l,norm:u,indices:d})});else{const{v:c,n:l}=r,{isMatch:u,score:o,indices:h}=n.searchIn(c);u&&a.push({score:o,key:e,value:c,norm:l,indices:h})}return a}}H.version="7.1.0";H.createIndex=Le;H.parseIndex=vt;H.config=m;H.parseQuery=Oe;Kt(Pt);function Qt(s){switch(s){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}const q=20;function rs(){const[s]=Ke(),e=ze(),r=Ve(),[n,a]=A.useState([]),[c,l]=A.useState([]),[u,o]=A.useState(!0),[h,d]=A.useState(null),[f,p]=A.useState(s.get("status")||"_default"),[x,j]=A.useState(s.get("priority")||"all"),[C,M]=A.useState(s.get("search")||""),[v,k]=A.useState(s.get("sortBy")||"created"),[F,L]=A.useState(s.get("order")||"desc"),[ie,T]=A.useState(()=>{const i=parseInt(s.get("page")||"1",10);return Number.isNaN(i)||i<1?1:i}),[E,R]=A.useState(!1),_=A.useRef(null),G=[f!=="_default",x!=="all",v!=="created",F!=="desc"].filter(Boolean).length,N=A.useCallback(i=>{const g=new URLSearchParams(s);Object.entries(i).forEach(([S,z])=>{z&&z!=="all"&&z!=="_default"&&z!==""?g.set(S,z):g.delete(S)});const y=g.toString(),w=y?`?${y}`:"";e(`${r.pathname}${w}`)},[s,e,r.pathname]),I=A.useCallback(i=>{p(i),T(1),N({status:i==="_default"?null:i,page:null})},[N]),Q=A.useCallback(i=>{j(i),T(1),N({priority:i==="all"?null:i,page:null})},[N]),b=A.useCallback(i=>{M(i),T(1),N({search:i||null,page:null})},[N]),W=A.useCallback(i=>{k(i),T(1),N({sortBy:i==="created"?null:i,page:null})},[N]),ee=A.useCallback(()=>{const i=F==="asc"?"desc":"asc";L(i),T(1),N({order:i==="desc"?null:i,page:null})},[F,N]),ce=A.useCallback(i=>{T(i),N({page:i===1?null:String(i)}),window.scrollTo({top:0,behavior:"smooth"})},[N]),le=A.useCallback(i=>{if(i.key==="s"||i.key==="S"){const g=document.activeElement;g?.tagName==="INPUT"||g?.tagName==="TEXTAREA"||g?.getAttribute("contenteditable")==="true"||(i.preventDefault(),_.current?.focus())}},[]);A.useEffect(()=>(document.addEventListener("keydown",le),()=>{document.removeEventListener("keydown",le)}),[le]);const Ne=A.useMemo(()=>{const i={keys:[{name:"title",weight:.4},{name:"intent",weight:.3},{name:"id",weight:.2},{name:"author.name",weight:.05},{name:"metadata.tags",weight:.05}],threshold:.3,includeScore:!0};return new H(n,i)},[n]);A.useEffect(()=>{async function i(){try{o(!0);const y=await(await fetch(`${Xe}/api/v1/tasks`)).json();y.success?(a(y.data),l(y.data)):d(y.error?.message||"Failed to fetch tasks")}catch(g){d(g instanceof Error?g.message:"Unknown error")}finally{o(!1)}}i()},[]),A.useEffect(()=>{let i=n;if(f==="_default"?i=i.filter(g=>Ze.includes(g.status)):f!=="all"&&(i=i.filter(g=>g.status===f)),x!=="all"&&(i=i.filter(g=>g.metadata.priority===x)),C.trim()){const g=Ne.search(C),y=new Set(g.map(w=>w.item.id));i=i.filter(w=>y.has(w.id))}i=i.sort((g,y)=>{let w,S;switch(v){case"created":{w=new Date(g.metadata.createdAt).getTime(),S=new Date(y.metadata.createdAt).getTime();break}case"updated":{w=new Date(g.metadata.updatedAt).getTime(),S=new Date(y.metadata.updatedAt).getTime();break}case"status":{w=g.status,S=y.status;break}case"priority":{const z={critical:4,high:3,medium:2,low:1};w=z[g.metadata.priority]||0,S=z[y.metadata.priority]||0;break}case"intent":{w=(g.title||g.intent||"").toLowerCase(),S=(y.title||y.intent||"").toLowerCase();break}default:w=new Date(g.metadata.createdAt).getTime(),S=new Date(y.metadata.createdAt).getTime()}return F==="asc"?w<S?-1:w>S?1:0:w>S?-1:w<S?1:0}),l(i)},[n,f,x,C,v,F,Ne]);const Y=Math.max(1,Math.ceil(c.length/q)),$=Math.min(ie,Y),Pe=c.slice(($-1)*q,$*q);return h?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your agents"})]}),t.jsx(P,{asChild:!0,children:t.jsxs(te,{to:"/tasks/new",children:[t.jsx(ue,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsx("div",{className:"text-center",children:t.jsxs("p",{className:"text-destructive",children:["Error: ",h]})})})})]}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your agents"})]}),t.jsx(P,{asChild:!0,children:t.jsxs(te,{to:"/tasks/new",children:[t.jsx(ue,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"relative",children:[t.jsx(tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t.jsx(We,{ref:_,placeholder:"Search tasks...",value:C,onChange:i=>b(i.target.value),className:"pl-9 pr-20 h-11 bg-muted/40 border-muted-foreground/20 focus:bg-background transition-colors"}),t.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:C?t.jsx("button",{onClick:()=>b(""),className:"h-5 w-5 rounded-full bg-muted-foreground/20 hover:bg-muted-foreground/30 flex items-center justify-center transition-colors",children:t.jsx(X,{className:"h-3 w-3"})}):t.jsx(Ue,{children:t.jsx(Ge,{children:"S"})})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>R(!E),className:"flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg border border-muted-foreground/20 hover:bg-muted/50 transition-colors",children:[t.jsx(be,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Filters & Sort"}),t.jsx("span",{className:"sm:hidden",children:"Filters"}),G>0&&t.jsx("span",{className:"flex items-center justify-center h-5 w-5 text-xs font-bold rounded-full bg-primary text-primary-foreground",children:G}),E?t.jsx(st,{className:"h-4 w-4 ml-1"}):t.jsx(He,{className:"h-4 w-4 ml-1"})]}),t.jsxs("div",{className:"flex-1 flex items-center gap-2 overflow-x-auto scrollbar-hide",children:[f!=="_default"&&t.jsxs("button",{onClick:()=>I("_default"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-blue-500/15 text-blue-600 dark:text-blue-400 hover:bg-blue-500/25 transition-colors whitespace-nowrap",children:[f==="all"?"All statuses":Ee(f),t.jsx(X,{className:"h-3 w-3"})]}),x!=="all"&&t.jsxs("button",{onClick:()=>Q("all"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 transition-colors whitespace-nowrap",children:[x," priority",t.jsx(X,{className:"h-3 w-3"})]}),(v!=="created"||F!=="desc")&&t.jsxs("button",{onClick:()=>{W("created"),L("desc"),N({sortBy:null,order:null})},className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-purple-500/15 text-purple-600 dark:text-purple-400 hover:bg-purple-500/25 transition-colors whitespace-nowrap",children:[v," ",F==="asc"?"↑":"↓",t.jsx(X,{className:"h-3 w-3"})]})]}),!u&&t.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[c.length," result",c.length!==1?"s":""]})]}),E&&t.jsxs("div",{className:"p-4 rounded-lg border border-muted-foreground/20 bg-muted/30 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsxs(oe,{value:f,onValueChange:I,children:[t.jsx(he,{className:"w-full bg-background",children:t.jsx(de,{placeholder:"Filter by status"})}),t.jsxs(me,{children:[t.jsx(B,{value:"_default",children:"Active (Default)"}),t.jsx(B,{value:"all",children:"All statuses"}),qe.map(i=>t.jsx(B,{value:i,children:Ee(i)},i))]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Priority"}),t.jsxs(oe,{value:x,onValueChange:Q,children:[t.jsx(he,{className:"w-full bg-background",children:t.jsx(de,{placeholder:"Filter by priority"})}),t.jsxs(me,{children:[t.jsx(B,{value:"all",children:"All priorities"}),t.jsx(B,{value:"low",children:"Low"}),t.jsx(B,{value:"medium",children:"Medium"}),t.jsx(B,{value:"high",children:"High"}),t.jsx(B,{value:"critical",children:"Critical"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Sort By"}),t.jsxs(oe,{value:v,onValueChange:i=>W(i),children:[t.jsx(he,{className:"w-full bg-background",children:t.jsx(de,{})}),t.jsxs(me,{children:[t.jsx(B,{value:"created",children:"Created Date"}),t.jsx(B,{value:"updated",children:"Updated Date"}),t.jsx(B,{value:"status",children:"Status"}),t.jsx(B,{value:"priority",children:"Priority"}),t.jsx(B,{value:"intent",children:"Title"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Order"}),t.jsx(P,{variant:"outline",onClick:ee,className:"w-full justify-between bg-background",children:F==="asc"?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Ascending"}),t.jsx(ct,{className:"h-4 w-4"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Descending"}),t.jsx(at,{className:"h-4 w-4"})]})})]})]}),G>0&&t.jsx("div",{className:"pt-2 border-t border-muted-foreground/10",children:t.jsxs(P,{variant:"ghost",size:"sm",onClick:()=>{I("_default"),Q("all"),b("")},className:"text-muted-foreground hover:text-foreground",children:[t.jsx(X,{className:"h-3 w-3 mr-1"}),"Reset all filters"]})})]})]}),u?t.jsx("div",{className:"space-y-3",children:Array.from({length:6}).map((i,g)=>t.jsx(J,{className:"overflow-hidden",children:t.jsx(Z,{className:"py-4",children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsx("div",{className:"h-5 bg-muted rounded w-2/3 animate-pulse"}),t.jsxs("div",{className:"flex gap-1.5 flex-shrink-0",children:[t.jsx("div",{className:"h-5 w-14 bg-muted rounded-full animate-pulse"}),t.jsx("div",{className:"h-5 w-14 bg-muted rounded-full animate-pulse"})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"h-3.5 bg-muted rounded w-full animate-pulse"}),t.jsx("div",{className:"h-3.5 bg-muted rounded w-4/5 animate-pulse"})]}),t.jsxs("div",{className:"flex justify-between items-center pt-1",children:[t.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"}),t.jsx("div",{className:"h-3 bg-muted rounded w-1/6 animate-pulse"})]})]})})},g))}):c.length===0&&n.length>0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(be,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No tasks match your filters"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Try adjusting your status or priority filters."}),t.jsx(P,{variant:"outline",className:"mt-4",onClick:()=>{I("_default"),Q("all"),b("")},children:"Clear Filters"})]})})}):n.length===0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(Qe,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No tasks yet"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first task to get started."}),t.jsx(P,{asChild:!0,className:"mt-4",children:t.jsxs(te,{to:"/tasks/new",children:[t.jsx(ue,{className:"mr-2 h-4 w-4"}),"New Task"]})})]})})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"space-y-3",children:Pe.map(i=>t.jsx(te,{to:`/tasks/${i.id}`,className:"block",children:t.jsx(J,{className:"hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:t.jsx(Z,{className:"py-4",children:t.jsx("div",{className:"flex justify-between items-start gap-4",children:t.jsxs("div",{className:"flex-1 space-y-2",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsx(Je,{className:"text-base leading-tight",children:i.title||i.intent}),t.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[i.metadata.priority&&t.jsx(se,{variant:Qt(i.metadata.priority),className:"text-xs",children:i.metadata.priority}),t.jsx(se,{variant:et(i.status),className:"text-xs",children:i.status})]})]}),i.content&&t.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[i.content.split(`
17
- `).slice(0,2).join(" ").substring(0,150),i.content.length>150?"...":""]}),t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"text-xs text-muted-foreground",children:[i.id," • by ",i.author.name," • ",new Date(i.metadata.createdAt).toLocaleDateString()]}),t.jsxs("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[i.planSteps.length>0&&t.jsxs("span",{children:[i.planSteps.length," step",i.planSteps.length!==1?"s":""]}),i.metadata.tags&&i.metadata.tags.length>0&&t.jsxs("span",{children:[i.metadata.tags.length," tag",i.metadata.tags.length!==1?"s":""]})]})]}),i.metadata.tags&&i.metadata.tags.length>0&&t.jsxs("div",{className:"flex gap-1 mt-2",children:[i.metadata.tags.slice(0,3).map(g=>t.jsx(se,{variant:"outline",className:"text-xs",children:g},g)),i.metadata.tags.length>3&&t.jsxs(se,{variant:"outline",className:"text-xs",children:["+",i.metadata.tags.length-3]})]})]})})})})},i.id))}),Y>1&&t.jsxs("div",{className:"flex items-center justify-between pt-2",children:[t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",($-1)*q+1,"–",Math.min($*q,c.length)," of ",c.length]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(P,{variant:"outline",size:"sm",disabled:$<=1,onClick:()=>ce($-1),children:t.jsx(rt,{className:"h-4 w-4"})}),Array.from({length:Y},(i,g)=>g+1).filter(i=>i===1||i===Y||Math.abs(i-$)<=1).reduce((i,g,y,w)=>(y>0&&g-w[y-1]>1&&i.push("ellipsis"),i.push(g),i),[]).map((i,g)=>i==="ellipsis"?t.jsx("span",{className:"px-2 text-sm text-muted-foreground",children:"…"},`e${g}`):t.jsx(P,{variant:i===$?"default":"outline",size:"sm",className:"min-w-[2rem]",onClick:()=>ce(i),children:i},i)),t.jsx(P,{variant:"outline",size:"sm",disabled:$>=Y,onClick:()=>ce($+1),children:t.jsx(Ye,{className:"h-4 w-4"})})]})]})]})]})}export{rs as default};
16
+ */const lt=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],be=Ce("funnel",lt);function K(s){return Array.isArray?Array.isArray(s):_e(s)==="[object Array]"}function ut(s){if(typeof s=="string")return s;let e=s+"";return e=="0"&&1/s==-1/0?"-0":e}function ot(s){return s==null?"":ut(s)}function O(s){return typeof s=="string"}function De(s){return typeof s=="number"}function ht(s){return s===!0||s===!1||dt(s)&&_e(s)=="[object Boolean]"}function ke(s){return typeof s=="object"}function dt(s){return ke(s)&&s!==null}function D(s){return s!=null}function fe(s){return!s.trim().length}function _e(s){return s==null?s===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(s)}const mt="Incorrect 'index' type",ft=s=>`Invalid value for key ${s}`,gt=s=>`Pattern length exceeds max of ${s}.`,xt=s=>`Missing ${s} property in key`,pt=s=>`Property 'weight' in key '${s}' must be a positive integer`,ve=Object.prototype.hasOwnProperty;class At{constructor(e){this._keys=[],this._keyMap={};let r=0;e.forEach(n=>{let a=Ie(n);this._keys.push(a),this._keyMap[a.id]=a,r+=a.weight}),this._keys.forEach(n=>{n.weight/=r})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Ie(s){let e=null,r=null,n=null,a=1,c=null;if(O(s)||K(s))n=s,e=Fe(s),r=ge(s);else{if(!ve.call(s,"name"))throw new Error(xt("name"));const l=s.name;if(n=l,ve.call(s,"weight")&&(a=s.weight,a<=0))throw new Error(pt(l));e=Fe(l),r=ge(l),c=s.getFn}return{path:e,id:r,weight:a,src:n,getFn:c}}function Fe(s){return K(s)?s:s.split(".")}function ge(s){return K(s)?s.join("."):s}function jt(s,e){let r=[],n=!1;const a=(c,l,u)=>{if(D(c))if(!l[u])r.push(c);else{let o=l[u];const h=c[o];if(!D(h))return;if(u===l.length-1&&(O(h)||De(h)||ht(h)))r.push(ot(h));else if(K(h)){n=!0;for(let d=0,f=h.length;d<f;d+=1)a(h[d],l,u+1)}else l.length&&a(h,l,u+1)}};return a(s,O(e)?e.split("."):e,0),n?r:r[0]}const yt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},Ct={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(s,e)=>s.score===e.score?s.idx<e.idx?-1:1:s.score<e.score?-1:1},wt={location:0,threshold:.6,distance:100},Nt={useExtendedSearch:!1,getFn:jt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var m={...Ct,...yt,...wt,...Nt};const Et=/[^ ]+/g;function bt(s=1,e=3){const r=new Map,n=Math.pow(10,e);return{get(a){const c=a.match(Et).length;if(r.has(c))return r.get(c);const l=1/Math.pow(c,.5*s),u=parseFloat(Math.round(l*n)/n);return r.set(c,u),u},clear(){r.clear()}}}class we{constructor({getFn:e=m.getFn,fieldNormWeight:r=m.fieldNormWeight}={}){this.norm=bt(r,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((r,n)=>{this._keysMap[r.id]=n})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,O(this.docs[0])?this.docs.forEach((e,r)=>{this._addString(e,r)}):this.docs.forEach((e,r)=>{this._addObject(e,r)}),this.norm.clear())}add(e){const r=this.size();O(e)?this._addString(e,r):this._addObject(e,r)}removeAt(e){this.records.splice(e,1);for(let r=e,n=this.size();r<n;r+=1)this.records[r].i-=1}getValueForItemAtKeyId(e,r){return e[this._keysMap[r]]}size(){return this.records.length}_addString(e,r){if(!D(e)||fe(e))return;let n={v:e,i:r,n:this.norm.get(e)};this.records.push(n)}_addObject(e,r){let n={i:r,$:{}};this.keys.forEach((a,c)=>{let l=a.getFn?a.getFn(e):this.getFn(e,a.path);if(D(l)){if(K(l)){let u=[];const o=[{nestedArrIndex:-1,value:l}];for(;o.length;){const{nestedArrIndex:h,value:d}=o.pop();if(D(d))if(O(d)&&!fe(d)){let f={v:d,i:h,n:this.norm.get(d)};u.push(f)}else K(d)&&d.forEach((f,p)=>{o.push({nestedArrIndex:p,value:f})})}n.$[c]=u}else if(O(l)&&!fe(l)){let u={v:l,n:this.norm.get(l)};n.$[c]=u}}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}}function Le(s,e,{getFn:r=m.getFn,fieldNormWeight:n=m.fieldNormWeight}={}){const a=new we({getFn:r,fieldNormWeight:n});return a.setKeys(s.map(Ie)),a.setSources(e),a.create(),a}function vt(s,{getFn:e=m.getFn,fieldNormWeight:r=m.fieldNormWeight}={}){const{keys:n,records:a}=s,c=new we({getFn:e,fieldNormWeight:r});return c.setKeys(n),c.setIndexRecords(a),c}function re(s,{errors:e=0,currentLocation:r=0,expectedLocation:n=0,distance:a=m.distance,ignoreLocation:c=m.ignoreLocation}={}){const l=e/s.length;if(c)return l;const u=Math.abs(n-r);return a?l+u/a:u?1:l}function Ft(s=[],e=m.minMatchCharLength){let r=[],n=-1,a=-1,c=0;for(let l=s.length;c<l;c+=1){let u=s[c];u&&n===-1?n=c:!u&&n!==-1&&(a=c-1,a-n+1>=e&&r.push([n,a]),n=-1)}return s[c-1]&&c-n>=e&&r.push([n,c-1]),r}const U=32;function Mt(s,e,r,{location:n=m.location,distance:a=m.distance,threshold:c=m.threshold,findAllMatches:l=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,includeMatches:o=m.includeMatches,ignoreLocation:h=m.ignoreLocation}={}){if(e.length>U)throw new Error(gt(U));const d=e.length,f=s.length,p=Math.max(0,Math.min(n,f));let x=c,j=p;const C=u>1||o,M=C?Array(f):[];let v;for(;(v=s.indexOf(e,j))>-1;){let E=re(e,{currentLocation:v,expectedLocation:p,distance:a,ignoreLocation:h});if(x=Math.min(E,x),j=v+d,C){let R=0;for(;R<d;)M[v+R]=1,R+=1}}j=-1;let k=[],F=1,L=d+f;const ie=1<<d-1;for(let E=0;E<d;E+=1){let R=0,_=L;for(;R<_;)re(e,{errors:E,currentLocation:p+_,expectedLocation:p,distance:a,ignoreLocation:h})<=x?R=_:L=_,_=Math.floor((L-R)/2+R);L=_;let G=Math.max(1,p-_+1),N=l?f:Math.min(p+_,f)+d,I=Array(N+2);I[N+1]=(1<<E)-1;for(let b=N;b>=G;b-=1){let W=b-1,ee=r[s.charAt(W)];if(C&&(M[W]=+!!ee),I[b]=(I[b+1]<<1|1)&ee,E&&(I[b]|=(k[b+1]|k[b])<<1|1|k[b+1]),I[b]&ie&&(F=re(e,{errors:E,currentLocation:W,expectedLocation:p,distance:a,ignoreLocation:h}),F<=x)){if(x=F,j=W,j<=p)break;G=Math.max(1,2*p-j)}}if(re(e,{errors:E+1,currentLocation:p,expectedLocation:p,distance:a,ignoreLocation:h})>x)break;k=I}const T={isMatch:j>=0,score:Math.max(.001,F)};if(C){const E=Ft(M,u);E.length?o&&(T.indices=E):T.isMatch=!1}return T}function St(s){let e={};for(let r=0,n=s.length;r<n;r+=1){const a=s.charAt(r);e[a]=(e[a]||0)|1<<n-r-1}return e}const ne=String.prototype.normalize?(s=>s.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"")):(s=>s);class Te{constructor(e,{location:r=m.location,threshold:n=m.threshold,distance:a=m.distance,includeMatches:c=m.includeMatches,findAllMatches:l=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,isCaseSensitive:o=m.isCaseSensitive,ignoreDiacritics:h=m.ignoreDiacritics,ignoreLocation:d=m.ignoreLocation}={}){if(this.options={location:r,threshold:n,distance:a,includeMatches:c,findAllMatches:l,minMatchCharLength:u,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d},e=o?e:e.toLowerCase(),e=h?ne(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const f=(x,j)=>{this.chunks.push({pattern:x,alphabet:St(x),startIndex:j})},p=this.pattern.length;if(p>U){let x=0;const j=p%U,C=p-j;for(;x<C;)f(this.pattern.substr(x,U),x),x+=U;if(j){const M=p-U;f(this.pattern.substr(M),M)}}else f(this.pattern,0)}searchIn(e){const{isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a}=this.options;if(e=r?e:e.toLowerCase(),e=n?ne(e):e,this.pattern===e){let C={isMatch:!0,score:0};return a&&(C.indices=[[0,e.length-1]]),C}const{location:c,distance:l,threshold:u,findAllMatches:o,minMatchCharLength:h,ignoreLocation:d}=this.options;let f=[],p=0,x=!1;this.chunks.forEach(({pattern:C,alphabet:M,startIndex:v})=>{const{isMatch:k,score:F,indices:L}=Mt(e,C,M,{location:c+v,distance:l,threshold:u,findAllMatches:o,minMatchCharLength:h,includeMatches:a,ignoreLocation:d});k&&(x=!0),p+=F,k&&L&&(f=[...f,...L])});let j={isMatch:x,score:x?p/this.chunks.length:1};return x&&a&&(j.indices=f),j}}class V{constructor(e){this.pattern=e}static isMultiMatch(e){return Me(e,this.multiRegex)}static isSingleMatch(e){return Me(e,this.singleRegex)}search(){}}function Me(s,e){const r=s.match(e);return r?r[1]:null}class Bt extends V{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const r=e===this.pattern;return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class Dt extends V{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const n=e.indexOf(this.pattern)===-1;return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class kt extends V{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const r=e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,this.pattern.length-1]}}}class _t extends V{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const r=!e.startsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class It extends V{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const r=e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class Lt extends V{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const r=!e.endsWith(this.pattern);return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class Re extends V{constructor(e,{location:r=m.location,threshold:n=m.threshold,distance:a=m.distance,includeMatches:c=m.includeMatches,findAllMatches:l=m.findAllMatches,minMatchCharLength:u=m.minMatchCharLength,isCaseSensitive:o=m.isCaseSensitive,ignoreDiacritics:h=m.ignoreDiacritics,ignoreLocation:d=m.ignoreLocation}={}){super(e),this._bitapSearch=new Te(e,{location:r,threshold:n,distance:a,includeMatches:c,findAllMatches:l,minMatchCharLength:u,isCaseSensitive:o,ignoreDiacritics:h,ignoreLocation:d})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class $e extends V{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let r=0,n;const a=[],c=this.pattern.length;for(;(n=e.indexOf(this.pattern,r))>-1;)r=n+c,a.push([n,r-1]);const l=!!a.length;return{isMatch:l,score:l?0:1,indices:a}}}const xe=[Bt,$e,kt,_t,Lt,It,Dt,Re],Se=xe.length,Tt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,Rt="|";function $t(s,e={}){return s.split(Rt).map(r=>{let n=r.trim().split(Tt).filter(c=>c&&!!c.trim()),a=[];for(let c=0,l=n.length;c<l;c+=1){const u=n[c];let o=!1,h=-1;for(;!o&&++h<Se;){const d=xe[h];let f=d.isMultiMatch(u);f&&(a.push(new d(f,e)),o=!0)}if(!o)for(h=-1;++h<Se;){const d=xe[h];let f=d.isSingleMatch(u);if(f){a.push(new d(f,e));break}}}return a})}const Ot=new Set([Re.type,$e.type]);class Pt{constructor(e,{isCaseSensitive:r=m.isCaseSensitive,ignoreDiacritics:n=m.ignoreDiacritics,includeMatches:a=m.includeMatches,minMatchCharLength:c=m.minMatchCharLength,ignoreLocation:l=m.ignoreLocation,findAllMatches:u=m.findAllMatches,location:o=m.location,threshold:h=m.threshold,distance:d=m.distance}={}){this.query=null,this.options={isCaseSensitive:r,ignoreDiacritics:n,includeMatches:a,minMatchCharLength:c,findAllMatches:u,ignoreLocation:l,location:o,threshold:h,distance:d},e=r?e:e.toLowerCase(),e=n?ne(e):e,this.pattern=e,this.query=$t(this.pattern,this.options)}static condition(e,r){return r.useExtendedSearch}searchIn(e){const r=this.query;if(!r)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:a,ignoreDiacritics:c}=this.options;e=a?e:e.toLowerCase(),e=c?ne(e):e;let l=0,u=[],o=0;for(let h=0,d=r.length;h<d;h+=1){const f=r[h];u.length=0,l=0;for(let p=0,x=f.length;p<x;p+=1){const j=f[p],{isMatch:C,indices:M,score:v}=j.search(e);if(C){if(l+=1,o+=v,n){const k=j.constructor.type;Ot.has(k)?u=[...u,...M]:u.push(M)}}else{o=0,l=0,u.length=0;break}}if(l){let p={isMatch:!0,score:o/l};return n&&(p.indices=u),p}}return{isMatch:!1,score:1}}}const pe=[];function Kt(...s){pe.push(...s)}function Ae(s,e){for(let r=0,n=pe.length;r<n;r+=1){let a=pe[r];if(a.condition(s,e))return new a(s,e)}return new Te(s,e)}const ae={AND:"$and",OR:"$or"},je={PATH:"$path",PATTERN:"$val"},ye=s=>!!(s[ae.AND]||s[ae.OR]),zt=s=>!!s[je.PATH],Vt=s=>!K(s)&&ke(s)&&!ye(s),Be=s=>({[ae.AND]:Object.keys(s).map(e=>({[e]:s[e]}))});function Oe(s,e,{auto:r=!0}={}){const n=a=>{let c=Object.keys(a);const l=zt(a);if(!l&&c.length>1&&!ye(a))return n(Be(a));if(Vt(a)){const o=l?a[je.PATH]:c[0],h=l?a[je.PATTERN]:a[o];if(!O(h))throw new Error(ft(o));const d={keyId:ge(o),pattern:h};return r&&(d.searcher=Ae(h,e)),d}let u={children:[],operator:c[0]};return c.forEach(o=>{const h=a[o];K(h)&&h.forEach(d=>{u.children.push(n(d))})}),u};return ye(s)||(s=Be(s)),n(s)}function Wt(s,{ignoreFieldNorm:e=m.ignoreFieldNorm}){s.forEach(r=>{let n=1;r.matches.forEach(({key:a,norm:c,score:l})=>{const u=a?a.weight:null;n*=Math.pow(l===0&&u?Number.EPSILON:l,(u||1)*(e?1:c))}),r.score=n})}function Ut(s,e){const r=s.matches;e.matches=[],D(r)&&r.forEach(n=>{if(!D(n.indices)||!n.indices.length)return;const{indices:a,value:c}=n;let l={indices:a,value:c};n.key&&(l.key=n.key.src),n.idx>-1&&(l.refIndex=n.idx),e.matches.push(l)})}function Gt(s,e){e.score=s.score}function Ht(s,e,{includeMatches:r=m.includeMatches,includeScore:n=m.includeScore}={}){const a=[];return r&&a.push(Ut),n&&a.push(Gt),s.map(c=>{const{idx:l}=c,u={item:e[l],refIndex:l};return a.length&&a.forEach(o=>{o(c,u)}),u})}class H{constructor(e,r={},n){this.options={...m,...r},this.options.useExtendedSearch,this._keyStore=new At(this.options.keys),this.setCollection(e,n)}setCollection(e,r){if(this._docs=e,r&&!(r instanceof we))throw new Error(mt);this._myIndex=r||Le(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){D(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const r=[];for(let n=0,a=this._docs.length;n<a;n+=1){const c=this._docs[n];e(c,n)&&(this.removeAt(n),n-=1,a-=1,r.push(c))}return r}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:r=-1}={}){const{includeMatches:n,includeScore:a,shouldSort:c,sortFn:l,ignoreFieldNorm:u}=this.options;let o=O(e)?O(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return Wt(o,{ignoreFieldNorm:u}),c&&o.sort(l),De(r)&&r>-1&&(o=o.slice(0,r)),Ht(o,this._docs,{includeMatches:n,includeScore:a})}_searchStringList(e){const r=Ae(e,this.options),{records:n}=this._myIndex,a=[];return n.forEach(({v:c,i:l,n:u})=>{if(!D(c))return;const{isMatch:o,score:h,indices:d}=r.searchIn(c);o&&a.push({item:c,idx:l,matches:[{score:h,value:c,norm:u,indices:d}]})}),a}_searchLogical(e){const r=Oe(e,this.options),n=(u,o,h)=>{if(!u.children){const{keyId:f,searcher:p}=u,x=this._findMatches({key:this._keyStore.get(f),value:this._myIndex.getValueForItemAtKeyId(o,f),searcher:p});return x&&x.length?[{idx:h,item:o,matches:x}]:[]}const d=[];for(let f=0,p=u.children.length;f<p;f+=1){const x=u.children[f],j=n(x,o,h);if(j.length)d.push(...j);else if(u.operator===ae.AND)return[]}return d},a=this._myIndex.records,c={},l=[];return a.forEach(({$:u,i:o})=>{if(D(u)){let h=n(r,u,o);h.length&&(c[o]||(c[o]={idx:o,item:u,matches:[]},l.push(c[o])),h.forEach(({matches:d})=>{c[o].matches.push(...d)}))}}),l}_searchObjectList(e){const r=Ae(e,this.options),{keys:n,records:a}=this._myIndex,c=[];return a.forEach(({$:l,i:u})=>{if(!D(l))return;let o=[];n.forEach((h,d)=>{o.push(...this._findMatches({key:h,value:l[d],searcher:r}))}),o.length&&c.push({idx:u,item:l,matches:o})}),c}_findMatches({key:e,value:r,searcher:n}){if(!D(r))return[];let a=[];if(K(r))r.forEach(({v:c,i:l,n:u})=>{if(!D(c))return;const{isMatch:o,score:h,indices:d}=n.searchIn(c);o&&a.push({score:h,key:e,value:c,idx:l,norm:u,indices:d})});else{const{v:c,n:l}=r,{isMatch:u,score:o,indices:h}=n.searchIn(c);u&&a.push({score:o,key:e,value:c,norm:l,indices:h})}return a}}H.version="7.1.0";H.createIndex=Le;H.parseIndex=vt;H.config=m;H.parseQuery=Oe;Kt(Pt);function Qt(s){switch(s){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}const q=20;function ns(){const[s]=Ke(),e=ze(),r=Ve(),[n,a]=A.useState([]),[c,l]=A.useState([]),[u,o]=A.useState(!0),[h,d]=A.useState(null),[f,p]=A.useState(s.get("status")||"_default"),[x,j]=A.useState(s.get("priority")||"all"),[C,M]=A.useState(s.get("search")||""),[v,k]=A.useState(s.get("sortBy")||"created"),[F,L]=A.useState(s.get("order")||"desc"),[ie,T]=A.useState(()=>{const i=parseInt(s.get("page")||"1",10);return Number.isNaN(i)||i<1?1:i}),[E,R]=A.useState(!1),_=A.useRef(null),G=[f!=="_default",x!=="all",v!=="created",F!=="desc"].filter(Boolean).length,N=A.useCallback(i=>{const g=new URLSearchParams(s);Object.entries(i).forEach(([S,z])=>{z&&z!=="all"&&z!=="_default"&&z!==""?g.set(S,z):g.delete(S)});const y=g.toString(),w=y?`?${y}`:"";e(`${r.pathname}${w}`)},[s,e,r.pathname]),I=A.useCallback(i=>{p(i),T(1),N({status:i==="_default"?null:i,page:null})},[N]),Q=A.useCallback(i=>{j(i),T(1),N({priority:i==="all"?null:i,page:null})},[N]),b=A.useCallback(i=>{M(i),T(1),N({search:i||null,page:null})},[N]),W=A.useCallback(i=>{k(i),T(1),N({sortBy:i==="created"?null:i,page:null})},[N]),ee=A.useCallback(()=>{const i=F==="asc"?"desc":"asc";L(i),T(1),N({order:i==="desc"?null:i,page:null})},[F,N]),ce=A.useCallback(i=>{T(i),N({page:i===1?null:String(i)}),window.scrollTo({top:0,behavior:"smooth"})},[N]),le=A.useCallback(i=>{if(i.key==="s"||i.key==="S"){const g=document.activeElement;g?.tagName==="INPUT"||g?.tagName==="TEXTAREA"||g?.getAttribute("contenteditable")==="true"||(i.preventDefault(),_.current?.focus())}},[]);A.useEffect(()=>(document.addEventListener("keydown",le),()=>{document.removeEventListener("keydown",le)}),[le]);const Ne=A.useMemo(()=>{const i={keys:[{name:"title",weight:.4},{name:"intent",weight:.3},{name:"id",weight:.2},{name:"author.name",weight:.05},{name:"metadata.tags",weight:.05}],threshold:.3,includeScore:!0};return new H(n,i)},[n]);A.useEffect(()=>{async function i(){try{o(!0);const y=await(await fetch(`${Xe}/api/v1/tasks`)).json();y.success?(a(y.data),l(y.data)):d(y.error?.message||"Failed to fetch tasks")}catch(g){d(g instanceof Error?g.message:"Unknown error")}finally{o(!1)}}i()},[]),A.useEffect(()=>{let i=n;if(f==="_default"?i=i.filter(g=>Ze.includes(g.status)):f!=="all"&&(i=i.filter(g=>g.status===f)),x!=="all"&&(i=i.filter(g=>g.metadata.priority===x)),C.trim()){const g=Ne.search(C),y=new Set(g.map(w=>w.item.id));i=i.filter(w=>y.has(w.id))}i=i.sort((g,y)=>{let w,S;switch(v){case"created":{w=new Date(g.metadata.createdAt).getTime(),S=new Date(y.metadata.createdAt).getTime();break}case"updated":{w=new Date(g.metadata.updatedAt).getTime(),S=new Date(y.metadata.updatedAt).getTime();break}case"status":{w=g.status,S=y.status;break}case"priority":{const z={critical:4,high:3,medium:2,low:1};w=z[g.metadata.priority]||0,S=z[y.metadata.priority]||0;break}case"intent":{w=(g.title||g.intent||"").toLowerCase(),S=(y.title||y.intent||"").toLowerCase();break}default:w=new Date(g.metadata.createdAt).getTime(),S=new Date(y.metadata.createdAt).getTime()}return F==="asc"?w<S?-1:w>S?1:0:w>S?-1:w<S?1:0}),l(i)},[n,f,x,C,v,F,Ne]);const Y=Math.max(1,Math.ceil(c.length/q)),$=Math.min(ie,Y),Pe=c.slice(($-1)*q,$*q);return h?t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your agents"})]}),t.jsx(P,{asChild:!0,children:t.jsxs(te,{to:"/tasks/new",children:[t.jsx(ue,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsx("div",{className:"text-center",children:t.jsxs("p",{className:"text-destructive",children:["Error: ",h]})})})})]}):t.jsxs("div",{className:"space-y-6",children:[t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tasks"}),t.jsx("p",{className:"text-muted-foreground",children:"Manage tasks for your agents"})]}),t.jsx(P,{asChild:!0,children:t.jsxs(te,{to:"/tasks/new",children:[t.jsx(ue,{className:"mr-2 h-4 w-4"}),"New Task"]})})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"relative",children:[t.jsx(tt,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),t.jsx(We,{ref:_,placeholder:"Search tasks...",value:C,onChange:i=>b(i.target.value),className:"pl-9 pr-20 h-11 bg-muted/40 border-muted-foreground/20 focus:bg-background transition-colors"}),t.jsx("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-2",children:C?t.jsx("button",{onClick:()=>b(""),className:"h-5 w-5 rounded-full bg-muted-foreground/20 hover:bg-muted-foreground/30 flex items-center justify-center transition-colors",children:t.jsx(X,{className:"h-3 w-3"})}):t.jsx(Ue,{children:t.jsx(Ge,{children:"S"})})})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("button",{onClick:()=>R(!E),className:"flex items-center gap-2 px-3 py-2 text-sm font-medium rounded-lg border border-muted-foreground/20 hover:bg-muted/50 transition-colors",children:[t.jsx(be,{className:"h-4 w-4"}),t.jsx("span",{className:"hidden sm:inline",children:"Filters & Sort"}),t.jsx("span",{className:"sm:hidden",children:"Filters"}),G>0&&t.jsx("span",{className:"flex items-center justify-center h-5 w-5 text-xs font-bold rounded-full bg-primary text-primary-foreground",children:G}),E?t.jsx(st,{className:"h-4 w-4 ml-1"}):t.jsx(He,{className:"h-4 w-4 ml-1"})]}),t.jsxs("div",{className:"flex-1 flex items-center gap-2 overflow-x-auto scrollbar-hide",children:[f!=="_default"&&t.jsxs("button",{onClick:()=>I("_default"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-blue-500/15 text-blue-600 dark:text-blue-400 hover:bg-blue-500/25 transition-colors whitespace-nowrap",children:[f==="all"?"All statuses":Ee(f),t.jsx(X,{className:"h-3 w-3"})]}),x!=="all"&&t.jsxs("button",{onClick:()=>Q("all"),className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-amber-500/15 text-amber-600 dark:text-amber-400 hover:bg-amber-500/25 transition-colors whitespace-nowrap",children:[x," priority",t.jsx(X,{className:"h-3 w-3"})]}),(v!=="created"||F!=="desc")&&t.jsxs("button",{onClick:()=>{W("created"),L("desc"),N({sortBy:null,order:null})},className:"flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-full bg-purple-500/15 text-purple-600 dark:text-purple-400 hover:bg-purple-500/25 transition-colors whitespace-nowrap",children:[v," ",F==="asc"?"↑":"↓",t.jsx(X,{className:"h-3 w-3"})]})]}),!u&&t.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[c.length," result",c.length!==1?"s":""]})]}),E&&t.jsxs("div",{className:"p-4 rounded-lg border border-muted-foreground/20 bg-muted/30 space-y-4 animate-in slide-in-from-top-2 duration-200",children:[t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Status"}),t.jsxs(oe,{value:f,onValueChange:I,children:[t.jsx(he,{className:"w-full bg-background",children:t.jsx(de,{placeholder:"Filter by status"})}),t.jsxs(me,{children:[t.jsx(B,{value:"_default",children:"Active (Default)"}),t.jsx(B,{value:"all",children:"All statuses"}),qe.map(i=>t.jsx(B,{value:i,children:Ee(i)},i))]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Priority"}),t.jsxs(oe,{value:x,onValueChange:Q,children:[t.jsx(he,{className:"w-full bg-background",children:t.jsx(de,{placeholder:"Filter by priority"})}),t.jsxs(me,{children:[t.jsx(B,{value:"all",children:"All priorities"}),t.jsx(B,{value:"low",children:"Low"}),t.jsx(B,{value:"medium",children:"Medium"}),t.jsx(B,{value:"high",children:"High"}),t.jsx(B,{value:"critical",children:"Critical"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Sort By"}),t.jsxs(oe,{value:v,onValueChange:i=>W(i),children:[t.jsx(he,{className:"w-full bg-background",children:t.jsx(de,{})}),t.jsxs(me,{children:[t.jsx(B,{value:"created",children:"Created Date"}),t.jsx(B,{value:"updated",children:"Updated Date"}),t.jsx(B,{value:"status",children:"Status"}),t.jsx(B,{value:"priority",children:"Priority"}),t.jsx(B,{value:"intent",children:"Title"})]})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide",children:"Order"}),t.jsx(P,{variant:"outline",onClick:ee,className:"w-full justify-between bg-background",children:F==="asc"?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Ascending"}),t.jsx(ct,{className:"h-4 w-4"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"Descending"}),t.jsx(at,{className:"h-4 w-4"})]})})]})]}),G>0&&t.jsx("div",{className:"pt-2 border-t border-muted-foreground/10",children:t.jsxs(P,{variant:"ghost",size:"sm",onClick:()=>{I("_default"),Q("all"),b("")},className:"text-muted-foreground hover:text-foreground",children:[t.jsx(X,{className:"h-3 w-3 mr-1"}),"Reset all filters"]})})]})]}),u?t.jsx("div",{className:"space-y-3",children:Array.from({length:6}).map((i,g)=>t.jsx(J,{className:"overflow-hidden",children:t.jsx(Z,{className:"py-4",children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsx("div",{className:"h-5 bg-muted rounded w-2/3 animate-pulse"}),t.jsxs("div",{className:"flex gap-1.5 flex-shrink-0",children:[t.jsx("div",{className:"h-5 w-14 bg-muted rounded-full animate-pulse"}),t.jsx("div",{className:"h-5 w-14 bg-muted rounded-full animate-pulse"})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"h-3.5 bg-muted rounded w-full animate-pulse"}),t.jsx("div",{className:"h-3.5 bg-muted rounded w-4/5 animate-pulse"})]}),t.jsxs("div",{className:"flex justify-between items-center pt-1",children:[t.jsx("div",{className:"h-3 bg-muted rounded w-1/3 animate-pulse"}),t.jsx("div",{className:"h-3 bg-muted rounded w-1/6 animate-pulse"})]})]})})},g))}):c.length===0&&n.length>0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(be,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No tasks match your filters"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Try adjusting your status or priority filters."}),t.jsx(P,{variant:"outline",className:"mt-4",onClick:()=>{I("_default"),Q("all"),b("")},children:"Clear Filters"})]})})}):n.length===0?t.jsx(J,{children:t.jsx(Z,{className:"pt-6",children:t.jsxs("div",{className:"text-center py-6",children:[t.jsx(Qe,{className:"mx-auto h-12 w-12 text-muted-foreground/50"}),t.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No tasks yet"}),t.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create your first task to get started."}),t.jsx(P,{asChild:!0,className:"mt-4",children:t.jsxs(te,{to:"/tasks/new",children:[t.jsx(ue,{className:"mr-2 h-4 w-4"}),"New Task"]})})]})})}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"space-y-3",children:Pe.map(i=>t.jsx(te,{to:`/tasks/${i.id}`,className:"block",children:t.jsx(J,{className:"hover:shadow-md hover:bg-muted/30 transition-all cursor-pointer",children:t.jsx(Z,{className:"py-4",children:t.jsx("div",{className:"flex justify-between items-start gap-4",children:t.jsxs("div",{className:"flex-1 space-y-2",children:[t.jsxs("div",{className:"flex items-start justify-between",children:[t.jsx(Je,{className:"text-base leading-tight",children:i.title||i.intent}),t.jsxs("div",{className:"flex gap-1 ml-3 flex-shrink-0",children:[i.metadata.priority&&t.jsx(se,{variant:Qt(i.metadata.priority),className:"text-xs",children:i.metadata.priority}),t.jsx(se,{variant:et(i.status),className:"text-xs",children:i.status})]})]}),i.content&&t.jsxs("div",{className:"text-sm text-muted-foreground leading-relaxed",children:[i.content.split(`
17
+ `).slice(0,2).join(" ").substring(0,150),i.content.length>150?"...":""]}),t.jsxs("div",{className:"flex justify-between items-center",children:[t.jsxs("div",{className:"text-xs text-muted-foreground",children:[i.id," • by ",i.author.name," • ",new Date(i.metadata.createdAt).toLocaleDateString()]}),t.jsxs("div",{className:"flex gap-3 text-xs text-muted-foreground",children:[i.planSteps.length>0&&t.jsxs("span",{children:[i.planSteps.length," step",i.planSteps.length!==1?"s":""]}),i.metadata.tags&&i.metadata.tags.length>0&&t.jsxs("span",{children:[i.metadata.tags.length," tag",i.metadata.tags.length!==1?"s":""]})]})]}),i.metadata.tags&&i.metadata.tags.length>0&&t.jsxs("div",{className:"flex gap-1 mt-2",children:[i.metadata.tags.slice(0,3).map(g=>t.jsx(se,{variant:"outline",className:"text-xs",children:g},g)),i.metadata.tags.length>3&&t.jsxs(se,{variant:"outline",className:"text-xs",children:["+",i.metadata.tags.length-3]})]})]})})})})},i.id))}),Y>1&&t.jsxs("div",{className:"flex items-center justify-between pt-2",children:[t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",($-1)*q+1,"–",Math.min($*q,c.length)," of ",c.length]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(P,{variant:"outline",size:"sm",disabled:$<=1,onClick:()=>ce($-1),children:t.jsx(rt,{className:"h-4 w-4"})}),Array.from({length:Y},(i,g)=>g+1).filter(i=>i===1||i===Y||Math.abs(i-$)<=1).reduce((i,g,y,w)=>(y>0&&g-w[y-1]>1&&i.push("ellipsis"),i.push(g),i),[]).map((i,g)=>i==="ellipsis"?t.jsx("span",{className:"px-2 text-sm text-muted-foreground",children:"…"},`e${g}`):t.jsx(P,{variant:i===$?"default":"outline",size:"sm",className:"min-w-[2rem]",onClick:()=>ce(i),children:i},i)),t.jsx(P,{variant:"outline",size:"sm",disabled:$>=Y,onClick:()=>ce($+1),children:t.jsx(Ye,{className:"h-4 w-4"})})]})]})]})]})}export{ns as default};