thursday-agent 0.23.0 → 0.24.0

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 (406) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/app/_global-error.html +1 -1
  5. package/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  9. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  10. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/_not-found.html +1 -1
  12. package/.next/server/app/_not-found.rsc +2 -2
  13. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  14. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  15. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  16. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  17. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  18. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  19. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  20. package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
  21. package/.next/server/app/api/bot/thread/file/route.js +2 -2
  22. package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
  23. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  24. package/.next/server/app/api/config/route.js.nft.json +1 -1
  25. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  26. package/.next/server/app/api/llm-model/automatic/route.js +2 -2
  27. package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
  28. package/.next/server/app/api/llm-model/catalog/[provider]/route.js +2 -2
  29. package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -1
  30. package/.next/server/app/api/llm-model/credits/[provider]/route.js +2 -2
  31. package/.next/server/app/api/llm-model/credits/[provider]/route.js.nft.json +1 -1
  32. package/.next/server/app/api/llm-model/route.js +2 -2
  33. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  34. package/.next/server/app/api/llm-model/subscription/route.js +2 -2
  35. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  36. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  37. package/.next/server/app/api/mcp/oauth/callback/route.js +3 -3
  38. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  39. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  40. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  41. package/.next/server/app/api/memory/edit/route.js +2 -2
  42. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  43. package/.next/server/app/api/reach/route.js +2 -2
  44. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  45. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  46. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  47. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  48. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  49. package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
  50. package/.next/server/app/api/thursday/call/plan/route.js +3 -3
  51. package/.next/server/app/api/thursday/call/plan/route.js.nft.json +1 -1
  52. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  53. package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
  54. package/.next/server/app/api/thursday/text/route.js +2 -2
  55. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  56. package/.next/server/app/api/thursday/tool-call/route.js +3 -3
  57. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  58. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  59. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  60. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
  61. package/.next/server/app/artifact/[...path]/page.js +2 -2
  62. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  63. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  64. package/.next/server/app/page/react-loadable-manifest.json +1 -1
  65. package/.next/server/app/page/server-reference-manifest.json +63 -63
  66. package/.next/server/app/page.js +2 -2
  67. package/.next/server/app/page.js.nft.json +1 -1
  68. package/.next/server/app/page_client-reference-manifest.js +1 -1
  69. package/.next/server/chunks/[root-of-the-server]__0582p46._.js +1 -1
  70. package/.next/server/chunks/{[root-of-the-server]__0d00o4_._.js → [root-of-the-server]__06_ck92._.js} +1 -1
  71. package/.next/server/chunks/[root-of-the-server]__06kxzw-._.js +1 -1
  72. package/.next/server/chunks/[root-of-the-server]__0d-dfqm._.js +1 -1
  73. package/.next/server/chunks/{[root-of-the-server]__1mowvzz._.js → [root-of-the-server]__0f8quhc._.js} +1 -1
  74. package/.next/server/chunks/[root-of-the-server]__0lg1fok._.js +1 -1
  75. package/.next/server/chunks/[root-of-the-server]__0mh1tgg._.js +1 -1
  76. package/.next/server/chunks/{[root-of-the-server]__0eem_66._.js → [root-of-the-server]__0tsqr_i._.js} +1 -1
  77. package/.next/server/chunks/{[root-of-the-server]__1yiqjfx._.js → [root-of-the-server]__0z8s0g8._.js} +1 -1
  78. package/.next/server/chunks/[root-of-the-server]__11e22s7._.js +1 -1
  79. package/.next/server/chunks/[root-of-the-server]__1478lu3._.js +1 -1
  80. package/.next/server/chunks/[root-of-the-server]__17kdjf6._.js +1 -1
  81. package/.next/server/chunks/[root-of-the-server]__17m7ag9._.js +1 -1
  82. package/.next/server/chunks/[root-of-the-server]__181zc_o._.js +1 -1
  83. package/.next/server/chunks/{[root-of-the-server]__1ivfglf._.js → [root-of-the-server]__1mwe6in._.js} +1 -1
  84. package/.next/server/chunks/{[root-of-the-server]__1r_d-gv._.js → [root-of-the-server]__1nzt9ia._.js} +1 -1
  85. package/.next/server/chunks/[root-of-the-server]__1v5jpk9._.js +1 -1
  86. package/.next/server/chunks/{[root-of-the-server]__0pp2355._.js → [root-of-the-server]__1vz_k4p._.js} +1 -1
  87. package/.next/server/chunks/_008vczq._.js +1 -1
  88. package/.next/server/chunks/_00aztuo._.js +1 -1
  89. package/.next/server/chunks/_021kabv._.js +20 -20
  90. package/.next/server/chunks/_05gl-xy._.js +48 -40
  91. package/.next/server/chunks/_07mczew._.js +1 -1
  92. package/.next/server/chunks/_0la8s6t._.js +1 -1
  93. package/.next/server/chunks/_0rn3c_0._.js +31 -31
  94. package/.next/server/chunks/_0wkhub3._.js +1 -1
  95. package/.next/server/chunks/{_0q2y48v._.js → _0z9l1-a._.js} +1 -1
  96. package/.next/server/chunks/_0zwjr-g._.js +1 -1
  97. package/.next/server/chunks/_12-7atf._.js +1 -1
  98. package/.next/server/chunks/_124q1p2._.js +1 -1
  99. package/.next/server/chunks/_13qoxq9._.js +31 -31
  100. package/.next/server/chunks/_15-_mie._.js +1 -1
  101. package/.next/server/chunks/_18sj4xf._.js +1 -1
  102. package/.next/server/chunks/_19kea1l._.js +46 -38
  103. package/.next/server/chunks/{_0-934yz._.js → _1ao-3d8._.js} +1 -1
  104. package/.next/server/chunks/{_0a09g1e._.js → _1cc2hkg._.js} +1 -1
  105. package/.next/server/chunks/_1chy-lk._.js +1 -1
  106. package/.next/server/chunks/_1cok9lj._.js +76 -0
  107. package/.next/server/chunks/_1d5zmy8._.js +1 -1
  108. package/.next/server/chunks/{_0ocmvv0._.js → _1h7ll0h._.js} +1 -1
  109. package/.next/server/chunks/_1hw1ujv._.js +20 -20
  110. package/.next/server/chunks/_1lg0lsu._.js +24 -24
  111. package/.next/server/chunks/_1mzdpal._.js +76 -0
  112. package/.next/server/chunks/_1q42187._.js +2 -2
  113. package/.next/server/chunks/_1u2plme._.js +3 -0
  114. package/.next/server/chunks/_1ufbxe1._.js +1 -1
  115. package/.next/server/chunks/_1unludv._.js +1 -1
  116. package/.next/server/chunks/_1v4id5q._.js +20 -20
  117. package/.next/server/chunks/_1v5qol2._.js +20 -20
  118. package/.next/server/chunks/_1wg0cqo._.js +1 -1
  119. package/.next/server/chunks/_1x2xiyw._.js +1 -1
  120. package/.next/server/chunks/_1znrlca._.js +1 -1
  121. package/.next/server/chunks/node_modules_09fdt86._.js +26 -0
  122. package/.next/server/chunks/node_modules_0u_q4-b._.js +26 -0
  123. package/.next/server/chunks/node_modules_1oo0z5r._.js +26 -0
  124. package/.next/server/chunks/ssr/[root-of-the-server]__09u-n6y._.js +112 -0
  125. package/.next/server/chunks/ssr/[root-of-the-server]__0glkz9k._.js +3 -0
  126. package/.next/server/chunks/ssr/[root-of-the-server]__0rpmgnt._.js +3 -0
  127. package/.next/server/chunks/ssr/[root-of-the-server]__0tgkj13._.js +3 -0
  128. package/.next/server/chunks/ssr/{[root-of-the-server]__203utm3._.js → [root-of-the-server]__0wrprhy._.js} +1 -1
  129. package/.next/server/chunks/ssr/[root-of-the-server]__17yeveo._.js +1 -1
  130. package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
  131. package/.next/server/chunks/ssr/{[root-of-the-server]__0zt_au4._.js → [root-of-the-server]__1ft98nl._.js} +2 -2
  132. package/.next/server/chunks/ssr/[root-of-the-server]__1gv2nbd._.js +3 -0
  133. package/.next/server/chunks/ssr/[root-of-the-server]__1kos36s._.js +6 -0
  134. package/.next/server/chunks/ssr/{[root-of-the-server]__0y03pu0._.js → [root-of-the-server]__1n2hycp._.js} +1 -1
  135. package/.next/server/chunks/ssr/[root-of-the-server]__20floom._.js +2 -2
  136. package/.next/server/chunks/ssr/{_0eprrig._.js → _0-y517w._.js} +2 -2
  137. package/.next/server/chunks/ssr/{_03vw3u5._.js → _02sda-9._.js} +2 -2
  138. package/.next/server/chunks/ssr/_03n27qx._.js +85 -0
  139. package/.next/server/chunks/ssr/_04jb10a._.js +3 -0
  140. package/.next/server/chunks/ssr/_09a6bpd._.js +1 -1
  141. package/.next/server/chunks/ssr/_0akma_h._.js +3 -0
  142. package/.next/server/chunks/ssr/_0cd6g3l._.js +44 -36
  143. package/.next/server/chunks/ssr/_0fx7w0u._.js +3 -0
  144. package/.next/server/chunks/ssr/_0gfa_rb._.js +3 -0
  145. package/.next/server/chunks/ssr/_0ghdb00._.js +3 -0
  146. package/.next/server/chunks/ssr/_0ingto_._.js +3 -0
  147. package/.next/server/chunks/ssr/_0jgsxrg._.js +6 -0
  148. package/.next/server/chunks/ssr/{_0a_pedm._.js → _0ktd2qg._.js} +2 -2
  149. package/.next/server/chunks/ssr/{_0bt2e10._.js → _0kvhn--._.js} +2 -2
  150. package/.next/server/chunks/ssr/_0poypri._.js +3 -0
  151. package/.next/server/chunks/ssr/_0tg3o37._.js +1 -1
  152. package/.next/server/chunks/ssr/_0y0ubpl._.js +85 -0
  153. package/.next/server/chunks/ssr/_11l9kc0._.js +1 -1
  154. package/.next/server/chunks/ssr/_12-hlgn._.js +3 -0
  155. package/.next/server/chunks/ssr/_12_ail7._.js +1 -1
  156. package/.next/server/chunks/ssr/_12n2oxe._.js +3 -0
  157. package/.next/server/chunks/ssr/_16_7zeo._.js +1 -1
  158. package/.next/server/chunks/ssr/_1a_w_du._.js +3 -0
  159. package/.next/server/chunks/ssr/_1bfrntd._.js +2 -2
  160. package/.next/server/chunks/ssr/_1e_9qjr._.js +3 -0
  161. package/.next/server/chunks/ssr/{_0kmldic._.js → _1gqjgsr._.js} +2 -2
  162. package/.next/server/chunks/ssr/_1kyjimg._.js +162 -0
  163. package/.next/server/chunks/ssr/_1l-3enz._.js +5 -5
  164. package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
  165. package/.next/server/chunks/ssr/{_0x9f717._.js → _1odlery._.js} +2 -2
  166. package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
  167. package/.next/server/chunks/ssr/components_ui_markdown-body_tsx_0eaiq36._.js +3 -0
  168. package/.next/server/chunks/ssr/features_ai_components_model-picker_tsx_0ucb1y9._.js +1 -1
  169. package/.next/server/chunks/ssr/features_bot_components_01ye2wp._.js +3 -0
  170. package/.next/server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js +4 -0
  171. package/.next/server/chunks/ssr/features_bot_components_thread-setting_tsx_0yae7zy._.js +3 -0
  172. package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +20 -0
  173. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  174. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  175. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  176. package/.next/server/chunks/ssr/features_skills_components_skills-setting_tsx_1wtuuip._.js +3 -0
  177. package/.next/server/chunks/ssr/features_thursday_0tni574._.js +3 -0
  178. package/.next/server/chunks/ssr/features_thursday_components_thursday-setting_tsx_1_6ydrc._.js +3 -0
  179. package/.next/server/chunks/ssr/lib_date-like_ts_02is0pw._.js +3 -0
  180. package/.next/server/chunks/ssr/node_modules_017gqu8._.js +3 -0
  181. package/.next/server/chunks/ssr/node_modules_01alue6._.js +3 -0
  182. package/.next/server/chunks/ssr/node_modules_01htpr-._.js +17 -0
  183. package/.next/server/chunks/ssr/node_modules_01pxb8b._.js +26 -0
  184. package/.next/server/chunks/ssr/node_modules_01tm_tp._.js +3 -0
  185. package/.next/server/chunks/ssr/node_modules_02n9-pb._.js +3 -0
  186. package/.next/server/chunks/ssr/node_modules_02pi0yq._.js +17 -0
  187. package/.next/server/chunks/ssr/node_modules_03-o46i._.js +3 -0
  188. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0ir6p7s._.js → node_modules_04aag9b._.js} +2 -2
  189. package/.next/server/chunks/ssr/node_modules_04si41m._.js +3 -0
  190. package/.next/server/chunks/ssr/{node_modules_d3-scale_src_1tr1qwb._.js → node_modules_05-8wqp._.js} +2 -2
  191. package/.next/server/chunks/ssr/node_modules_063ofsn._.js +64 -0
  192. package/.next/server/chunks/ssr/node_modules_0794bsw._.js +20 -20
  193. package/.next/server/chunks/ssr/node_modules_09zjj0q._.js +3 -0
  194. package/.next/server/chunks/ssr/node_modules_0_aoyhl._.js +24 -0
  195. package/.next/server/chunks/ssr/node_modules_0_nsswh._.js +3 -0
  196. package/.next/server/chunks/ssr/node_modules_0_ps6bu._.js +3 -0
  197. package/.next/server/chunks/ssr/{node_modules_0y_k4h5._.js → node_modules_0bxpl07._.js} +2 -2
  198. package/.next/server/chunks/ssr/node_modules_0bz_arm._.js +3 -0
  199. package/.next/server/chunks/ssr/node_modules_0dxcji9._.js +3 -0
  200. package/.next/server/chunks/ssr/node_modules_0f5_pdq._.js +40 -0
  201. package/.next/server/chunks/ssr/node_modules_0fibdri._.js +3 -0
  202. package/.next/server/chunks/ssr/node_modules_0gtb11b._.js +3 -0
  203. package/.next/server/chunks/ssr/node_modules_0hlr1-8._.js +24 -0
  204. package/.next/server/chunks/ssr/{node_modules_111pp7w._.js → node_modules_0klo3i5._.js} +2 -2
  205. package/.next/server/chunks/ssr/{node_modules_0xht9wg._.js → node_modules_0koo_87._.js} +2 -2
  206. package/.next/server/chunks/ssr/node_modules_0kyd5t1._.js +3 -0
  207. package/.next/server/chunks/ssr/node_modules_0kzqz7r._.js +3 -0
  208. package/.next/server/chunks/ssr/node_modules_0lf6itx._.js +3 -0
  209. package/.next/server/chunks/ssr/node_modules_0pejed0._.js +3 -0
  210. package/.next/server/chunks/ssr/node_modules_0pf0mdn._.js +43 -0
  211. package/.next/server/chunks/ssr/node_modules_0q3wqo6._.js +3 -0
  212. package/.next/server/chunks/ssr/node_modules_0qw862r._.js +3 -0
  213. package/.next/server/chunks/ssr/node_modules_0rr5bhc._.js +3 -0
  214. package/.next/server/chunks/ssr/node_modules_0u1te_7._.js +3 -0
  215. package/.next/server/chunks/ssr/node_modules_0udp97e._.js +3 -0
  216. package/.next/server/chunks/ssr/node_modules_0v47nij._.js +43 -0
  217. package/.next/server/chunks/ssr/node_modules_0x7tjjt._.js +17 -0
  218. package/.next/server/chunks/ssr/node_modules_0xhtcgd._.js +3 -0
  219. package/.next/server/chunks/ssr/{node_modules_0ayoorn._.js → node_modules_0xon57z._.js} +2 -2
  220. package/.next/server/chunks/ssr/node_modules_0z1zutp._.js +17 -0
  221. package/.next/server/chunks/ssr/node_modules_0z7xnqk._.js +17 -0
  222. package/.next/server/chunks/ssr/node_modules_11bryw1._.js +3 -0
  223. package/.next/server/chunks/ssr/{node_modules_00mh9o-._.js → node_modules_13eo1xw._.js} +2 -2
  224. package/.next/server/chunks/ssr/node_modules_13udj58._.js +3 -0
  225. package/.next/server/chunks/ssr/node_modules_15vxln6._.js +17 -0
  226. package/.next/server/chunks/ssr/node_modules_15yal8y._.js +17 -0
  227. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1ejf5ye._.js → node_modules_17q6-cb._.js} +2 -2
  228. package/.next/server/chunks/ssr/node_modules_17sis9w._.js +17 -0
  229. package/.next/server/chunks/ssr/node_modules_19v9p62._.js +17 -0
  230. package/.next/server/chunks/ssr/node_modules_19xlry2._.js +3 -0
  231. package/.next/server/chunks/ssr/node_modules_1afgbir._.js +17 -0
  232. package/.next/server/chunks/ssr/node_modules_1asq18n._.js +29 -0
  233. package/.next/server/chunks/ssr/node_modules_1bo15xl._.js +3 -0
  234. package/.next/server/chunks/ssr/node_modules_1crkt86._.js +3 -0
  235. package/.next/server/chunks/ssr/{node_modules_04f_uw2._.js → node_modules_1fpm85j._.js} +2 -2
  236. package/.next/server/chunks/ssr/node_modules_1gkjtk-._.js +3 -0
  237. package/.next/server/chunks/ssr/node_modules_1hj50tu._.js +3 -0
  238. package/.next/server/chunks/ssr/node_modules_1hv0kyf._.js +3 -0
  239. package/.next/server/chunks/ssr/node_modules_1i5fr0j._.js +3 -0
  240. package/.next/server/chunks/ssr/node_modules_1k3cymo._.js +3 -0
  241. package/.next/server/chunks/ssr/node_modules_1ki78ma._.js +3 -0
  242. package/.next/server/chunks/ssr/{node_modules_07udd3z._.js → node_modules_1lrg_ju._.js} +2 -2
  243. package/.next/server/chunks/ssr/node_modules_1lt565w._.js +3 -0
  244. package/.next/server/chunks/ssr/node_modules_1oxvn1l._.js +3 -0
  245. package/.next/server/chunks/ssr/node_modules_1qgcqvi._.js +3 -0
  246. package/.next/server/chunks/ssr/node_modules_1r_497y._.js +3 -0
  247. package/.next/server/chunks/ssr/node_modules_1thrjjl._.js +3 -0
  248. package/.next/server/chunks/ssr/node_modules_1tsuh_o._.js +17 -0
  249. package/.next/server/chunks/ssr/node_modules_1vhpjvn._.js +3 -0
  250. package/.next/server/chunks/ssr/{node_modules_1b5rxw5._.js → node_modules_1xpa_a4._.js} +2 -2
  251. package/.next/server/chunks/ssr/node_modules_1xtyj97._.js +26 -0
  252. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_0dlpxwr._.js → node_modules_@mermaid-js_parser_dist_066fcep._.js} +1 -1
  253. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_0eji647._.js → node_modules_@mermaid-js_parser_dist_0_301m2._.js} +1 -1
  254. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_0lct0v1._.js → node_modules_@mermaid-js_parser_dist_0it10w8._.js} +1 -1
  255. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_13hksv_._.js → node_modules_@mermaid-js_parser_dist_0m-ahsg._.js} +1 -1
  256. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0n8rqkj._.js +3 -0
  257. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0nb4v-i._.js +3 -0
  258. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_0tdjo9s._.js +3 -0
  259. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_12betp4._.js +3 -0
  260. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1mu01rb._.js +3 -0
  261. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1xda76v._.js +3 -0
  262. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1z2f7i3._.js +3 -0
  263. package/.next/server/chunks/ssr/node_modules_katex_dist_katex_mjs_0gtpcr6._.js +3 -0
  264. package/.next/server/chunks/ssr/node_modules_katex_dist_katex_mjs_0o4db0q._.js +3 -0
  265. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_0e5n4p5._.js +3 -0
  266. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-Y2CYZVJY_mjs_20i4m4_._.js +3 -0
  267. package/.next/server/chunks/ssr/node_modules_streamdown_dist_0lptw6m._.js +3 -0
  268. package/.next/server/chunks/ssr/node_modules_streamdown_dist_1-e49om._.js +3 -0
  269. package/.next/server/middleware-build-manifest.js +3 -3
  270. package/.next/server/pages/404.html +1 -1
  271. package/.next/server/pages/500.html +1 -1
  272. package/.next/server/server-reference-manifest.js +1 -1
  273. package/.next/server/server-reference-manifest.json +64 -64
  274. package/.next/static/chunks/{1ettmta9iet7b.js → 03_uoxripq3nc.js} +1 -1
  275. package/.next/static/chunks/{396enq-m0sss5.js → 0776-hu4_eek7.js} +2 -2
  276. package/.next/static/chunks/0akv-2v88qow0.js +1 -0
  277. package/.next/static/chunks/{1oh4hbusfz97l.js → 0rq_fqeaz_bvd.js} +1 -1
  278. package/.next/static/chunks/0zardk7icrprd.js +4 -0
  279. package/.next/static/chunks/17rnkwd0nvzhn.js +1 -0
  280. package/.next/static/chunks/{0fklfoj8o_msg.js → 1cmwusx1ey_yw.js} +1 -1
  281. package/.next/static/chunks/{1j4rndg17wgfk.js → 1grvc88py7u6u.js} +1 -1
  282. package/.next/static/chunks/1ob3lsnuwfj-n.js +70 -0
  283. package/.next/static/chunks/{411uyd0is9u5s.js → 1qmqv6cr2nr5g.js} +1 -1
  284. package/.next/static/chunks/1yrz0aw09rjij.js +1 -0
  285. package/.next/static/chunks/1z2_9pl3nezly.js +3 -0
  286. package/.next/static/chunks/{1mpz4epyg-7pz.js → 2-zwoj9evpp_d.js} +2 -2
  287. package/.next/static/chunks/{11c3uijgqik4m.js → 20w8bgikzj9nl.js} +1 -1
  288. package/.next/static/chunks/{2sxclirl-c-um.js → 2abjsec0elgbx.js} +1 -1
  289. package/.next/static/chunks/{3_deesw_pbmkd.js → 2fxn-xltgy2un.js} +1 -1
  290. package/.next/static/chunks/2hq0xxr8bwwjx.js +1 -0
  291. package/.next/static/chunks/2jf2ckv1t70es.js +1 -0
  292. package/.next/static/chunks/2k8ou_gpe91k1.js +1 -0
  293. package/.next/static/chunks/{2zhiqxw61qowv.js → 2vk1rx8_abchj.js} +1 -1
  294. package/.next/static/chunks/{22jb4s3-8ckup.js → 2vz587tsy9sw-.js} +1 -1
  295. package/.next/static/chunks/33qtnlc00c9gq.js +1 -0
  296. package/.next/static/chunks/34ih-rod1rypo.js +1 -0
  297. package/.next/static/chunks/{3uf32hp_g9stz.js → 399la1vg4mefu.js} +1 -1
  298. package/.next/static/chunks/3b8uta6_6no_3.css +1 -0
  299. package/.next/static/chunks/3eeapb56_2bu2.js +2 -0
  300. package/.next/static/chunks/{081kl7k8r6f8z.js → 3h29tl1whfjs2.js} +1 -1
  301. package/.next/static/chunks/3l4m3_ojnhbav.js +1 -0
  302. package/.next/static/chunks/3pia1ryvrhyfr.js +1 -0
  303. package/.next/static/chunks/3qzf68zb5zlh8.js +1 -0
  304. package/.next/static/chunks/{3ph9u-51x6jhe.js → 3w6r10nihrl3l.js} +5 -5
  305. package/.next/static/chunks/3xloayc4c096r.js +1 -0
  306. package/README.md +10 -1
  307. package/guide/bots.md +35 -26
  308. package/node_modules/@types/ws/README.md +1 -1
  309. package/node_modules/@types/ws/index.d.mts +4 -0
  310. package/node_modules/@types/ws/index.d.ts +4 -0
  311. package/node_modules/@types/ws/package.json +3 -3
  312. package/package.json +2 -2
  313. package/.next/server/chunks/_1fn6cvh._.js +0 -3
  314. package/.next/server/chunks/_1jtvbp9._.js +0 -76
  315. package/.next/server/chunks/node_modules_@ai-sdk_1o5ydf6._.js +0 -26
  316. package/.next/server/chunks/ssr/[root-of-the-server]__0jjj49d._.js +0 -3
  317. package/.next/server/chunks/ssr/[root-of-the-server]__1qn0axo._.js +0 -6
  318. package/.next/server/chunks/ssr/[root-of-the-server]__1u42eh0._.js +0 -3
  319. package/.next/server/chunks/ssr/_0-s7ria._.js +0 -3
  320. package/.next/server/chunks/ssr/_088qe9a._.js +0 -162
  321. package/.next/server/chunks/ssr/_0ali_i8._.js +0 -3
  322. package/.next/server/chunks/ssr/_0flnog5._.js +0 -3
  323. package/.next/server/chunks/ssr/_0iuvjnw._.js +0 -3
  324. package/.next/server/chunks/ssr/_0k-gl8l._.js +0 -3
  325. package/.next/server/chunks/ssr/_0ks03l-._.js +0 -3
  326. package/.next/server/chunks/ssr/_0mng-y8._.js +0 -6
  327. package/.next/server/chunks/ssr/_0ugzm_0._.js +0 -3
  328. package/.next/server/chunks/ssr/_0wnv6c0._.js +0 -3
  329. package/.next/server/chunks/ssr/_0z9zkd-._.js +0 -3
  330. package/.next/server/chunks/ssr/_123y-ah._.js +0 -3
  331. package/.next/server/chunks/ssr/_14j205q._.js +0 -85
  332. package/.next/server/chunks/ssr/_16wjbs2._.js +0 -3
  333. package/.next/server/chunks/ssr/_18rmqqu._.js +0 -3
  334. package/.next/server/chunks/ssr/_1ckje8g._.js +0 -3
  335. package/.next/server/chunks/ssr/_1h3qetc._.js +0 -3
  336. package/.next/server/chunks/ssr/_1kpvfmn._.js +0 -4
  337. package/.next/server/chunks/ssr/_1pkw8wf._.js +0 -85
  338. package/.next/server/chunks/ssr/_1xwtbdz._.js +0 -3
  339. package/.next/server/chunks/ssr/features_bot_0-7flc-._.js +0 -3
  340. package/.next/server/chunks/ssr/features_config_10xs4l1._.js +0 -20
  341. package/.next/server/chunks/ssr/features_thursday_0cf9y0b._.js +0 -3
  342. package/.next/server/chunks/ssr/node_modules_04f6p6a._.js +0 -24
  343. package/.next/server/chunks/ssr/node_modules_08-pj-2._.js +0 -3
  344. package/.next/server/chunks/ssr/node_modules_098h6h5._.js +0 -29
  345. package/.next/server/chunks/ssr/node_modules_0_7yfem._.js +0 -3
  346. package/.next/server/chunks/ssr/node_modules_0bp3vfu._.js +0 -3
  347. package/.next/server/chunks/ssr/node_modules_0ch5hqr._.js +0 -3
  348. package/.next/server/chunks/ssr/node_modules_0e-hyim._.js +0 -64
  349. package/.next/server/chunks/ssr/node_modules_0ffm9w3._.js +0 -26
  350. package/.next/server/chunks/ssr/node_modules_0il0v7d._.js +0 -3
  351. package/.next/server/chunks/ssr/node_modules_0jzyuwk._.js +0 -3
  352. package/.next/server/chunks/ssr/node_modules_0ln4iwf._.js +0 -3
  353. package/.next/server/chunks/ssr/node_modules_0my2hph._.js +0 -3
  354. package/.next/server/chunks/ssr/node_modules_0ql0igl._.js +0 -17
  355. package/.next/server/chunks/ssr/node_modules_0qwth-_._.js +0 -17
  356. package/.next/server/chunks/ssr/node_modules_0y9byl5._.js +0 -3
  357. package/.next/server/chunks/ssr/node_modules_10bzndo._.js +0 -43
  358. package/.next/server/chunks/ssr/node_modules_19f7b4c._.js +0 -3
  359. package/.next/server/chunks/ssr/node_modules_1b_h09q._.js +0 -3
  360. package/.next/server/chunks/ssr/node_modules_1e83j9e._.js +0 -26
  361. package/.next/server/chunks/ssr/node_modules_1e9ugfy._.js +0 -3
  362. package/.next/server/chunks/ssr/node_modules_1hd66k0._.js +0 -64
  363. package/.next/server/chunks/ssr/node_modules_1inwr2m._.js +0 -43
  364. package/.next/server/chunks/ssr/node_modules_1j9xx1k._.js +0 -3
  365. package/.next/server/chunks/ssr/node_modules_1k8kypa._.js +0 -3
  366. package/.next/server/chunks/ssr/node_modules_1oeu85h._.js +0 -3
  367. package/.next/server/chunks/ssr/node_modules_1r2ghv5._.js +0 -3
  368. package/.next/server/chunks/ssr/node_modules_1rg7lj4._.js +0 -40
  369. package/.next/server/chunks/ssr/node_modules_1ttpnib._.js +0 -29
  370. package/.next/server/chunks/ssr/node_modules_201yvda._.js +0 -17
  371. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_17wxxyr._.js +0 -3
  372. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_18pinup._.js +0 -3
  373. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1feyqvf._.js +0 -3
  374. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1ok0411._.js +0 -3
  375. package/.next/server/chunks/ssr/node_modules_@mermaid-js_parser_dist_1sgfrma._.js +0 -3
  376. package/.next/server/chunks/ssr/node_modules_d3-shape_src_arc_1-w13bo.js +0 -3
  377. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_0jkhu0x._.js +0 -3
  378. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_0thh8pk._.js +0 -17
  379. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_1o1kg4c._.js +0 -3
  380. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_1rxlz7e._.js +0 -3
  381. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_1turj0n._.js +0 -3
  382. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_1v463pe._.js +0 -17
  383. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-5VM5RSS4_mjs_0tg6kya._.js +0 -17
  384. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_chunk-F27PBJKO_mjs_0ms0zmb._.js +0 -3
  385. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_dagre-GXQ25YYZ_mjs_0k_lz8d._.js +0 -3
  386. package/.next/server/chunks/ssr/node_modules_mermaid_dist_chunks_mermaid_core_sizeCapture-INFHLROL_mjs_179zv_p._.js +0 -3
  387. package/.next/server/chunks/ssr/node_modules_streamdown_dist_highlighted-body-KPVGNVTW_1fnf894.js +0 -3
  388. package/.next/server/chunks/ssr/node_modules_streamdown_dist_mermaid-HWGCJPDP_093xi20.js +0 -3
  389. package/.next/static/chunks/02lze_e5sagjn.js +0 -1
  390. package/.next/static/chunks/0ve2gb0hw3wkq.js +0 -1
  391. package/.next/static/chunks/16np6727e61io.js +0 -1
  392. package/.next/static/chunks/18amidjlaqexf.js +0 -1
  393. package/.next/static/chunks/1u4jowlgjgeip.js +0 -70
  394. package/.next/static/chunks/236le5kv_yj6a.css +0 -1
  395. package/.next/static/chunks/24op50z6sqi_5.js +0 -1
  396. package/.next/static/chunks/2eczs-lporqt6.js +0 -1
  397. package/.next/static/chunks/2z4sodeldj_86.js +0 -1
  398. package/.next/static/chunks/3ezjz93yvzmop.js +0 -4
  399. package/.next/static/chunks/3h6rqjx92wva9.js +0 -1
  400. package/.next/static/chunks/3w7zt3xzyjn86.js +0 -3
  401. package/.next/static/chunks/3xkx7vqefm7on.js +0 -2
  402. package/.next/static/chunks/3ygk41pgsw7nv.js +0 -1
  403. package/.next/static/chunks/4384atd5zerir.js +0 -1
  404. /package/.next/static/{6tIYlzfG_5P4sIxxgmucO → WKQCaSVcySHM4bjkWJXEH}/_buildManifest.js +0 -0
  405. /package/.next/static/{6tIYlzfG_5P4sIxxgmucO → WKQCaSVcySHM4bjkWJXEH}/_clientMiddlewareManifest.js +0 -0
  406. /package/.next/static/{6tIYlzfG_5P4sIxxgmucO → WKQCaSVcySHM4bjkWJXEH}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,94682,e=>{"use strict";var t=e.i(843476),n=e.i(24071),s=e.i(482022),r=e.i(569644),i=e.i(456420);let o={name:"images",size:24,node:[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16",key:"9kzy35"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2",key:"1t0f0t"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor",key:"1obus6"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2",key:"1gvhby"}]]};o.node;let a=(0,i.default)(o);var l=e.i(759659),c=e.i(271645),d=e.i(798120),u=e.i(167881),h=e.i(917162),f=e.i(671428),m=e.i(41533),x=e.i(95187);let p=(0,x.createServerReference)("7f07efc30c06410ee789eef202233cf738a9eae1af",x.callServer,void 0,x.findSourceMapURL,"deleteArtifactAction");var g=e.i(635963),b=e.i(853483),v=e.i(978411),j=e.i(895836),y=e.i(989409),k=e.i(83928),N=e.i(621285),S=e.i(977037),w=e.i(245629),A=e.i(609856),C=e.i(283653),T=e.i(647163);function $(e){let t=new Map;for(let n of e){let e=t.get(n.bot)??[];e.push(n),t.set(n.bot,e)}return[...t].map(([e,t])=>({bot:e,rows:t}))}function F({label:e,mark:n,count:s,active:r,onPick:i}){return(0,t.jsxs)("button",{type:"button",onClick:i,className:(0,T.cn)("mx-2 flex h-9 items-center gap-2 rounded-md px-2 text-left text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",r?(0,T.cn)(j.PICKED_ROW,"font-medium"):"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[n??(0,t.jsx)(a,{className:"size-4 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] text-muted-foreground/70 tabular-nums",children:s})]})}function z({row:e,file:i,onOpen:o,onBack:a,onGone:c,onShelf:f}){let[m]=(0,A.useServerAction)(S.revealFileAction),[x,g]=(0,A.useServerAction)(p,{okMessage:"Deleted",onOk:()=>{(0,C.revalidate)(d.queryKey.artifacts),i?a():c()}}),j=i?{path:i.path,bytes:i.bytes,at:i.at}:"file"===e.kind?{path:e.path,bytes:e.bytes,at:e.at}:null,{filed:k,note:$,failure:F,follow:R}=(0,b.useFileNote)(j?.path??null,null),M=e=>{y.useSettingsStore.getState().hide(),v.roomOpens.open(e)},P=async e=>{await h.notify.confirm({title:`Delete ${e.split("/").pop()}?`,description:j?"It is deleted from disk for good.":"The folder and everything in it are deleted from disk for good.",okText:"Delete",destructive:!0})&&x(e)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex h-11 shrink-0 items-center gap-3 border-b border-border/60 px-6",children:[(0,t.jsxs)("button",{type:"button",onClick:i?a:f,className:"-ml-1 flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/60 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(n.ChevronLeft,{className:"size-3"}),i?e.name:"Shelf"]}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-foreground",children:j?j.path.split("/").pop()??e.name:e.name}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground/70",children:j?`${(0,T.formatBytes)(j.bytes)} \xb7 ${(0,w.shortAgo)(j.at)}`:`${e.count} ${1===e.count?"file":"files"} \xb7 ${(0,w.shortAgo)(e.at)}`}),k&&(0,t.jsx)(b.FileThreadChip,{note:$,onOpen:M}),j&&(0,t.jsx)("a",{href:d.queryKey.fileView(j.path),target:"_blank",rel:"noreferrer","aria-label":"Open in a new tab",className:"grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(s.ExternalLink,{className:"size-4"})}),(0,t.jsx)(u.Button,{size:"icon-sm",variant:"ghost","aria-label":"Reveal in the file manager",className:"text-muted-foreground",onClick:()=>m(j?.path??e.path),children:(0,t.jsx)(r.FolderOpen,{})}),(0,t.jsx)(u.Button,{size:"icon-sm",variant:"ghost","aria-label":"Delete",loading:g,className:"ml-1.5 text-muted-foreground hover:text-destructive",onClick:()=>P(j?.path??e.path),children:(0,t.jsx)(l.Trash2,{})})]}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:j?(0,t.jsx)(N.FilePreview,{path:j.path,bytes:j.bytes}):(0,t.jsx)(O,{path:e.path,onOpen:o})}),j&&k&&(0,t.jsx)("div",{className:"shrink-0 border-t border-border/60 px-6 pt-2.5 pb-3",children:(0,t.jsx)(b.FileNoteBar,{path:j.path,note:$,failure:F,onThread:R,onOpenThread:M})})]})}function O({path:e,onOpen:n}){let{data:s,isLoading:r,error:i}=(0,C.useServerRoute)(d.queryKey.artifactSet(e,m.ARTIFACT_VIEW.setFiles));if(r)return(0,t.jsx)("div",{className:"grid grid-cols-4 gap-3 p-5",children:Array.from({length:8},(e,n)=>(0,t.jsx)(f.Skeleton,{className:"aspect-4/3 w-full rounded-xl"},n))});if(i)return(0,t.jsx)(j.SettingError,{message:i.message});let o=s?.files??[];return 0===o.length?(0,t.jsx)("p",{className:"p-5 text-xs text-muted-foreground/60",children:"Nothing in here the app can open."}):(0,t.jsxs)("div",{className:"p-5",children:[(0,t.jsx)("div",{className:"grid grid-cols-4 gap-3",children:o.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>n(e),title:`${e.name} \xb7 ${(0,T.formatBytes)(e.bytes)}`,className:"flex flex-col gap-1.5 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-offset-2",children:[(0,t.jsx)(R,{file:e}),(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e.name})]},e.path))}),s&&s.total>o.length&&(0,t.jsx)("p",{className:"pt-4 font-mono text-[11px] text-muted-foreground/60",children:`${o.length} of ${s.total.toLocaleString("en")} — the rest are in the folder`})]})}function R({file:e}){return(0,t.jsx)(k.FileThumb,{path:e.path,bytes:e.bytes,glyph:"size-5",className:"aspect-4/3 w-full rounded-xl ring-1 ring-foreground/5 ring-inset"})}function M({entries:e,bots:n,onPick:s}){return(0,t.jsx)("div",{className:"space-y-7 p-6",children:$(e).map(({bot:e,rows:i})=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-medium",children:[e&&(0,t.jsx)(g.BotMark,{size:20,seed:e,...(0,g.markOf)(e,n),notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e??"Unsorted"}),(0,t.jsx)("span",{className:"font-mono text-[11px] font-normal text-muted-foreground",children:i.length})]}),(0,t.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(9.5rem,1fr))] gap-x-4 gap-y-5",children:i.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>s(e),className:"group flex min-w-0 flex-col gap-1.5 rounded-xl text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:["set"===e.kind?(0,t.jsx)("span",{className:"grid aspect-4/3 w-full place-items-center rounded-xl bg-muted/60 text-muted-foreground transition-colors group-hover:bg-muted",children:(0,t.jsx)(r.FolderOpen,{className:"size-5"})}):(0,t.jsx)(k.FileThumb,{path:e.path,bytes:e.bytes,glyph:"size-5",className:"aspect-4/3 w-full rounded-xl ring-1 ring-foreground/5 ring-inset"}),(0,t.jsxs)("span",{className:"min-w-0 space-y-0.5 px-0.5",children:[(0,t.jsx)("span",{className:"block truncate text-[13px]",children:e.name}),(0,t.jsxs)("span",{className:"block truncate font-mono text-[10.5px] text-muted-foreground",children:["set"===e.kind?`${e.count} ${1===e.count?"file":"files"} \xb7 `:"",(0,w.shortAgo)(e.at)]})]})]},e.path))})]},e??""))})}function P({empty:e}){return(0,t.jsx)("div",{className:"p-8",children:(0,t.jsx)("p",{className:"max-w-lg text-sm leading-relaxed text-muted-foreground",children:e?"Nothing finished yet. When a bot ends a job with something to hand over — a page, a report, a set of pictures — it lands here.":"Pick something on the left. Each bot's work is under its face; a folder it filled is one row, and opens as a sheet."})})}e.s(["ArtifactSetting",0,function(){let[e,n]=(0,c.useState)(null),[s,i]=(0,c.useState)(""),[o,a]=(0,c.useState)(void 0),[l,h]=(0,c.useState)(m.ARTIFACT_VIEW.rows),{data:f,isLoading:x,error:p}=(0,C.useServerRoute)(d.queryKey.artifactShelf(l),{keepPreviousData:!0}),{data:b}=(0,C.useServerRoute)(d.queryKey.bot),[v]=(0,A.useServerAction)(S.revealFileAction);if(x)return(0,t.jsx)(j.SettingPanesSkeleton,{});if(p)return(0,t.jsx)(j.SettingError,{message:p.message});let y=f?.entries??[],k=f?.total??0,N=s.trim().toLowerCase(),w=y.filter(e=>(void 0===o||e.bot===o)&&(!N||e.name.toLowerCase().includes(N)||e.bot?.toLowerCase().includes(N))),T=y.find(t=>t.path===e?.row.path)??e?.row;return(0,t.jsx)(j.SettingPanes,{footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.SettingRailNote,{children:(0,t.jsxs)("span",{className:"font-mono",children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"finished"}),` \xb7 ${function(e,t,n){if(0===t)return"empty";let s=t>e.length?`${e.length} of ${t.toLocaleString("en")} results`:`${t} ${1===t?"result":"results"}`;return n>t?`${s} \xb7 ${n.toLocaleString("en")} files`:s}(y,k,f?.files??0)}`]})}),(0,t.jsxs)(u.Button,{variant:"outline",size:"sm",onClick:()=>v(m.PATHS.artifacts),children:[(0,t.jsx)(r.FolderOpen,{}),"Reveal folder"]})]}),left:(0,t.jsxs)("div",{className:"flex flex-col py-2",children:[(0,t.jsx)(j.SettingFilter,{value:s,onChange:i,placeholder:"Filter files",className:"mx-2 mb-1.5 w-auto"}),(0,t.jsx)(F,{label:"Everyone",count:y.length,active:void 0===o,onPick:()=>{a(void 0),n(null)}}),$(y).map(({bot:e,rows:s})=>(0,t.jsx)(F,{label:e??"Unsorted",mark:e?(0,t.jsx)(g.BotMark,{size:18,seed:e,...(0,g.markOf)(e,b),notify:!1,className:"shrink-0"}):void 0,count:s.length,active:o===e,onPick:()=>{a(e),n(null)}},e??"")),k>y.length&&(0,t.jsx)("button",{type:"button",onClick:()=>h(l+m.ARTIFACT_VIEW.rows),className:"mx-2 mt-2 rounded-md px-2 py-1.5 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/60 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:`Show ${Math.min(m.ARTIFACT_VIEW.rows,k-y.length)} more of ${k.toLocaleString("en")}`})]}),right:T?(0,t.jsx)(z,{row:T,file:e?.file??null,onOpen:e=>n({row:T,file:e}),onBack:()=>n({row:T,file:null}),onGone:()=>n(null),onShelf:()=>n(null)},T.path):w.length>0?(0,t.jsx)(M,{entries:w,bots:b,onPick:e=>n({row:e,file:null})}):(0,t.jsx)(P,{empty:0===k})})}],94682)},759659,e=>{"use strict";var t=e.i(456420);let n={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};n.node;let s=(0,t.default)(n);e.s(["Trash2",0,s],759659)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,94682,e=>{"use strict";var t=e.i(843476),n=e.i(24071),s=e.i(482022),r=e.i(569644),i=e.i(456420);let o={name:"images",size:24,node:[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16",key:"9kzy35"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2",key:"1t0f0t"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor",key:"1obus6"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2",key:"1gvhby"}]]};o.node;let a=(0,i.default)(o);var l=e.i(759659),c=e.i(271645),d=e.i(798120),u=e.i(167881),h=e.i(917162),m=e.i(671428),f=e.i(41533),x=e.i(95187);let p=(0,x.createServerReference)("7fb4a36a00d5baed1ba52a62d28557e7327920ed3d",x.callServer,void 0,x.findSourceMapURL,"deleteArtifactAction");var g=e.i(635963),b=e.i(853483),v=e.i(978411),j=e.i(895836),y=e.i(989409),k=e.i(83928),N=e.i(621285),S=e.i(707125),w=e.i(245629),A=e.i(609856),C=e.i(283653),T=e.i(647163);function $(e){let t=new Map;for(let n of e){let e=t.get(n.bot)??[];e.push(n),t.set(n.bot,e)}return[...t].map(([e,t])=>({bot:e,rows:t}))}function F({label:e,mark:n,count:s,active:r,onPick:i}){return(0,t.jsxs)("button",{type:"button",onClick:i,className:(0,T.cn)("mx-2 flex h-9 items-center gap-2 rounded-md px-2 text-left text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",r?(0,T.cn)(j.PICKED_ROW,"font-medium"):"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[n??(0,t.jsx)(a,{className:"size-4 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] text-muted-foreground/70 tabular-nums",children:s})]})}function z({row:e,file:i,onOpen:o,onBack:a,onGone:c,onShelf:m}){let[f]=(0,A.useServerAction)(S.revealFileAction),[x,g]=(0,A.useServerAction)(p,{okMessage:"Deleted",onOk:()=>{(0,C.revalidate)(d.queryKey.artifacts),i?a():c()}}),j=i?{path:i.path,bytes:i.bytes,at:i.at}:"file"===e.kind?{path:e.path,bytes:e.bytes,at:e.at}:null,{filed:k,note:$,failure:F,follow:R}=(0,b.useFileNote)(j?.path??null,null),M=e=>{y.useSettingsStore.getState().hide(),v.roomOpens.open(e)},P=async e=>{await h.notify.confirm({title:`Delete ${e.split("/").pop()}?`,description:j?"It is deleted from disk for good.":"The folder and everything in it are deleted from disk for good.",okText:"Delete",destructive:!0})&&x(e)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex h-11 shrink-0 items-center gap-3 border-b border-border/60 px-6",children:[(0,t.jsxs)("button",{type:"button",onClick:i?a:m,className:"-ml-1 flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/60 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(n.ChevronLeft,{className:"size-3"}),i?e.name:"Shelf"]}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-foreground",children:j?j.path.split("/").pop()??e.name:e.name}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground/70",children:j?`${(0,T.formatBytes)(j.bytes)} \xb7 ${(0,w.shortAgo)(j.at)}`:`${e.count} ${1===e.count?"file":"files"} \xb7 ${(0,w.shortAgo)(e.at)}`}),k&&(0,t.jsx)(b.FileThreadChip,{note:$,onOpen:M}),j&&(0,t.jsx)("a",{href:d.queryKey.fileView(j.path),target:"_blank",rel:"noreferrer","aria-label":"Open in a new tab",className:"grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(s.ExternalLink,{className:"size-4"})}),(0,t.jsx)(u.Button,{size:"icon-sm",variant:"ghost","aria-label":"Reveal in the file manager",className:"text-muted-foreground",onClick:()=>f(j?.path??e.path),children:(0,t.jsx)(r.FolderOpen,{})}),(0,t.jsx)(u.Button,{size:"icon-sm",variant:"ghost","aria-label":"Delete",loading:g,className:"ml-1.5 text-muted-foreground hover:text-destructive",onClick:()=>P(j?.path??e.path),children:(0,t.jsx)(l.Trash2,{})})]}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:j?(0,t.jsx)(N.FilePreview,{path:j.path,bytes:j.bytes}):(0,t.jsx)(O,{path:e.path,onOpen:o})}),j&&k&&(0,t.jsx)("div",{className:"shrink-0 border-t border-border/60 px-6 pt-2.5 pb-3",children:(0,t.jsx)(b.FileNoteBar,{path:j.path,note:$,failure:F,onThread:R,onOpenThread:M})})]})}function O({path:e,onOpen:n}){let{data:s,isLoading:r,error:i}=(0,C.useServerRoute)(d.queryKey.artifactSet(e,f.ARTIFACT_VIEW.setFiles));if(r)return(0,t.jsx)("div",{className:"grid grid-cols-4 gap-3 p-5",children:Array.from({length:8},(e,n)=>(0,t.jsx)(m.Skeleton,{className:"aspect-4/3 w-full rounded-xl"},n))});if(i)return(0,t.jsx)(j.SettingError,{message:i.message});let o=s?.files??[];return 0===o.length?(0,t.jsx)("p",{className:"p-5 text-xs text-muted-foreground/60",children:"Nothing in here the app can open."}):(0,t.jsxs)("div",{className:"p-5",children:[(0,t.jsx)("div",{className:"grid grid-cols-4 gap-3",children:o.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>n(e),title:`${e.name} \xb7 ${(0,T.formatBytes)(e.bytes)}`,className:"flex flex-col gap-1.5 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-offset-2",children:[(0,t.jsx)(R,{file:e}),(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e.name})]},e.path))}),s&&s.total>o.length&&(0,t.jsx)("p",{className:"pt-4 font-mono text-[11px] text-muted-foreground/60",children:`${o.length} of ${s.total.toLocaleString("en")} — the rest are in the folder`})]})}function R({file:e}){return(0,t.jsx)(k.FileThumb,{path:e.path,bytes:e.bytes,glyph:"size-5",className:"aspect-4/3 w-full rounded-xl ring-1 ring-foreground/5 ring-inset"})}function M({entries:e,bots:n,onPick:s}){return(0,t.jsx)("div",{className:"space-y-7 p-6",children:$(e).map(({bot:e,rows:i})=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-medium",children:[e&&(0,t.jsx)(g.BotMark,{size:20,seed:e,...(0,g.markOf)(e,n),notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e??"Unsorted"}),(0,t.jsx)("span",{className:"font-mono text-[11px] font-normal text-muted-foreground",children:i.length})]}),(0,t.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(9.5rem,1fr))] gap-x-4 gap-y-5",children:i.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>s(e),className:"group flex min-w-0 flex-col gap-1.5 rounded-xl text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:["set"===e.kind?(0,t.jsx)("span",{className:"grid aspect-4/3 w-full place-items-center rounded-xl bg-muted/60 text-muted-foreground transition-colors group-hover:bg-muted",children:(0,t.jsx)(r.FolderOpen,{className:"size-5"})}):(0,t.jsx)(k.FileThumb,{path:e.path,bytes:e.bytes,glyph:"size-5",className:"aspect-4/3 w-full rounded-xl ring-1 ring-foreground/5 ring-inset"}),(0,t.jsxs)("span",{className:"min-w-0 space-y-0.5 px-0.5",children:[(0,t.jsx)("span",{className:"block truncate text-[13px]",children:e.name}),(0,t.jsxs)("span",{className:"block truncate font-mono text-[10.5px] text-muted-foreground",children:["set"===e.kind?`${e.count} ${1===e.count?"file":"files"} \xb7 `:"",(0,w.shortAgo)(e.at)]})]})]},e.path))})]},e??""))})}function P({empty:e}){return(0,t.jsx)("div",{className:"p-8",children:(0,t.jsx)("p",{className:"max-w-lg text-sm leading-relaxed text-muted-foreground",children:e?"Nothing finished yet. When a bot ends a job with something to hand over — a page, a report, a set of pictures — it lands here.":"Pick something on the left. Each bot's work is under its face; a folder it filled is one row, and opens as a sheet."})})}e.s(["ArtifactSetting",0,function(){let[e,n]=(0,c.useState)(null),[s,i]=(0,c.useState)(""),[o,a]=(0,c.useState)(void 0),[l,h]=(0,c.useState)(f.ARTIFACT_VIEW.rows),{data:m,isLoading:x,error:p}=(0,C.useServerRoute)(d.queryKey.artifactShelf(l),{keepPreviousData:!0}),{data:b}=(0,C.useServerRoute)(d.queryKey.bot),[v]=(0,A.useServerAction)(S.revealFileAction);if(x)return(0,t.jsx)(j.SettingPanesSkeleton,{});if(p)return(0,t.jsx)(j.SettingError,{message:p.message});let y=m?.entries??[],k=m?.total??0,N=s.trim().toLowerCase(),w=y.filter(e=>(void 0===o||e.bot===o)&&(!N||e.name.toLowerCase().includes(N)||e.bot?.toLowerCase().includes(N))),T=y.find(t=>t.path===e?.row.path)??e?.row;return(0,t.jsx)(j.SettingPanes,{footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.SettingRailNote,{children:(0,t.jsxs)("span",{className:"font-mono",children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"finished"}),` \xb7 ${function(e,t,n){if(0===t)return"empty";let s=t>e.length?`${e.length} of ${t.toLocaleString("en")} results`:`${t} ${1===t?"result":"results"}`;return n>t?`${s} \xb7 ${n.toLocaleString("en")} files`:s}(y,k,m?.files??0)}`]})}),(0,t.jsxs)(u.Button,{variant:"outline",size:"sm",onClick:()=>v(f.PATHS.artifacts),children:[(0,t.jsx)(r.FolderOpen,{}),"Reveal folder"]})]}),left:(0,t.jsxs)("div",{className:"flex flex-col py-2",children:[(0,t.jsx)(j.SettingFilter,{value:s,onChange:i,placeholder:"Filter files",className:"mx-2 mb-1.5 w-auto"}),(0,t.jsx)(F,{label:"Everyone",count:y.length,active:void 0===o,onPick:()=>{a(void 0),n(null)}}),$(y).map(({bot:e,rows:s})=>(0,t.jsx)(F,{label:e??"Unsorted",mark:e?(0,t.jsx)(g.BotMark,{size:18,seed:e,...(0,g.markOf)(e,b),notify:!1,className:"shrink-0"}):void 0,count:s.length,active:o===e,onPick:()=>{a(e),n(null)}},e??"")),k>y.length&&(0,t.jsx)("button",{type:"button",onClick:()=>h(l+f.ARTIFACT_VIEW.rows),className:"mx-2 mt-2 rounded-md px-2 py-1.5 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/60 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:`Show ${Math.min(f.ARTIFACT_VIEW.rows,k-y.length)} more of ${k.toLocaleString("en")}`})]}),right:T?(0,t.jsx)(z,{row:T,file:e?.file??null,onOpen:e=>n({row:T,file:e}),onBack:()=>n({row:T,file:null}),onGone:()=>n(null),onShelf:()=>n(null)},T.path):w.length>0?(0,t.jsx)(M,{entries:w,bots:b,onPick:e=>n({row:e,file:null})}):(0,t.jsx)(P,{empty:0===k})})}],94682)},759659,e=>{"use strict";var t=e.i(456420);let n={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};n.node;let s=(0,t.default)(n);e.s(["Trash2",0,s],759659)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,303121,e=>{"use strict";var t=e.i(95187);let a=(0,t.createServerReference)("7f143c1ad68820d668598f0a3e2763d48ee721ba86",t.callServer,void 0,t.findSourceMapURL,"deleteWorkspaceFileAction");e.s(["deleteWorkspaceFileAction",0,a])},333999,e=>{"use strict";var t=e.i(271645),a=e.i(647163);e.s(["useObjectState",0,e=>{let[s,r]=(0,t.useState)(e);return[s,(0,t.useCallback)(e=>{r(t=>{let s=(0,a.isFunction)(e)?e(t):e;return Object.keys(s).some(e=>!Object.is(t[e],s[e]))?{...t,...s}:t})},[])]}])},759659,e=>{"use strict";var t=e.i(456420);let a={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};a.node;let s=(0,t.default)(a);e.s(["Trash2",0,s],759659)}]);
@@ -0,0 +1,3 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,532965,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(456420);let r={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};r.node;let s=(0,a.default)(r);var o=e.i(935829),i=e.i(77071),l=e.i(798120),d=e.i(683408),c=e.i(660302),u=e.i(635963),f=e.i(454263),p=e.i(213377),h=e.i(616172),x=e.i(245629),m=e.i(553429),y=e.i(978411);let g=e=>e.waitsFor.length>0&&"cancelled"!==e.state,b=e=>"waiting"===e.state&&e.waitsFor.length>0;function k(e,t,n){let a=null===e,r=new Map(e?.read);for(let e of t.events)r.has(e.id)||r.set(e.id,a?e.at:Math.max(e.at,n));let s=new Map(e?.seats);for(let[e,r]of t.seats){let t=`${r.key}:${r.waits.join(",")}`;s.get(e)?.state!==t&&s.set(e,{state:t,since:a?r.since:n})}let o=new Map(e?.owed);for(let[e,n]of t.owed)o.set(e,{waits:n,out:null});for(let[e,a]of o)null!==a.out||t.owed.has(e)||("cancelled"===t.states.get(e)?o.delete(e):o.set(e,{...a,out:n}));let i=new Map(e?.asked);for(let e of t.asking)i.has(e)||i.set(e,null);for(let[e,a]of i)null!==a||t.asking.has(e)||i.set(e,n);let l=new Map(e?.reports);for(let e of t.events)"report"===e.kind&&l.set(e.id,{event:e,gone:null});for(let[e,a]of l)null!==a.gone||t.events.some(t=>t.id===e)||l.set(e,{...a,gone:n});return{read:r,seats:s,owed:o,asked:i,reports:l,ended:"done"===t.status||"cancelled"===t.status?e?.ended??(a?t.span:n):null,opened:e?.opened??n,fresh:e?.fresh??("done"===t.status&&!t.seen)}}let v=e=>"you"===e?"you":e,w=e=>e.length>2?`${e.length} bots`:e.map(v).join(" and "),j={key:"none",waits:[],since:null};function M(e,t){let{key:n,waits:a,since:r}=e.seats.get(t)??j,s=t===e.office.coord;return{key:n,label:({run:"Working",asking:"Waiting on you",paused:"Paused",held:`Held \xb7 after ${w(a)}`,ended:a.length?`Waiting on ${w(a)}`:"Waiting",done:s?"Reported":"Answered",stopped:"Stopped",none:"Not called yet"})[n],since:r,waits:a}}let $=(e,t)=>e.events.find(e=>"report"===e.kind&&e.at<=t&&(null===e.closed||e.closed>t))??null;function N(e){let{bots:t,status:n}=e.office;if("done"===n)return"done";if("cancelled"===n)return"stopped";let a=t.map(t=>M(e,t).key);return a.includes("asking")?"you":a.includes("paused")?"paused":"work"}let z=[26,55,84],S={yaw:45,pitch:30},A=.894/Math.SQRT1_2,O=e=>Math.round(10*e)/10,C=e=>Math.round(100*e)/100,P=(e,t,n)=>Math.min(n,Math.max(t,e)),D=e=>e<=0?0:e>=1?1:1-(1-e)**3,F="color-mix(in oklab, var(--ink) 72%, transparent)",L="color-mix(in oklab, var(--ink) 30%, transparent)";function q(e,t,n,a=4.5,r="color-mix(in oklab, var(--ink) 56%, transparent)",s=0,o=1){let[i,l]=e.at(t[0],t[1],t[2]),[d,c]=e.at(n[0],n[1],n[2]),u=Math.hypot(d-i,c-l)||1,f=(d-i)/u*a,p=(c-l)/u*a;return{id:"",x1:O(i-f),y1:O(l-p),x2:O(d+f),y2:O(c+p),length:O(u+2*a),color:r,width:o,delay:s}}let R=["var(--gray-0)","var(--gray-75)","var(--gray-100)"];function T(e,[t,n,a,r,s,o],i={}){let l=i.fills??R,d=i.over,c=i.color;return{faces:[{points:e.points([[t,r,s],[a,r,s],[a,r,o],[t,r,o]]),fill:l[1],hatch:!1},{points:e.points([[a,n,s],[a,r,s],[a,r,o],[a,n,o]]),fill:l[2],hatch:!1!==i.hatch},{points:e.points([[t,n,o],[a,n,o],[a,r,o],[t,r,o]]),fill:l[0],hatch:!1}],edges:[q(e,[t,n,o],[a,n,o],d,c),q(e,[t,n,o],[t,r,o],d,c),q(e,[t,r,o],[a,r,o],d,c),q(e,[a,n,o],[a,r,o],d,c),q(e,[t,r,s],[t,r,o],d,c),q(e,[a,r,s],[a,r,o],d,c),q(e,[a,n,s],[a,n,o],d,c),q(e,[t,r,s],[a,r,s],d,c),q(e,[a,n,s],[a,r,s],d,c)]}}let I=(...e)=>({faces:e.flatMap(e=>e.faces),edges:e.flatMap(e=>e.edges)}),_=e=>{let t=0;for(let n=1;n<e.length;n++)t+=Math.hypot(e[n][0]-e[n-1][0],e[n][1]-e[n-1][1]);return t};function W(e,t){let n=_(e),a=P(t,0,1)*n;for(let t=1;t<e.length;t++){let[r,s]=e[t-1],[o,i]=e[t],l=Math.hypot(o-r,i-s);if(a<=l||t===e.length-1){let e=l?Math.min(1,a/l):0;return{x:r+(o-r)*e,y:s+(i-s)*e,total:n}}a-=l}return{x:e[0][0],y:e[0][1],total:n}}function E(e){if(e.length<3)return e;let t=[e[0]];for(let n=1;n<e.length-1;n++){let[a,r]=e[n-1],[s,o]=e[n],[i,l]=e[n+1],d=Math.hypot(s-a,o-r),c=Math.hypot(i-s,l-o),u=Math.min(3.5,d/2,c/2);if(u<.3){t.push(e[n]);continue}let f=[s-(s-a)/d*u,o-(o-r)/d*u],p=[s+(i-s)/c*u,o+(l-o)/c*u];for(let e=0;e<=6;e++){let n=e/6;t.push([(1-n)**2*f[0]+2*(1-n)*n*s+n*n*p[0],(1-n)**2*f[1]+2*(1-n)*n*o+n*n*p[1]])}}return t.push(e[e.length-1]),t}function B(e,t){let n=P(e,0,1)*t,a=1/(t-.175);return n<.15?a*n*n/.3:n>t-.2?1-a*(t-n)**2/.4:.15*a/2+a*(n-.15)}function U(e,t,n){for(let a of e){if(a.who!==t||n<a.leave||n>=a.back)continue;if(n<a.arrive){let e=(n-a.leave)/(a.arrive-a.leave);return{trip:a,phase:"out",u:B(e,a.arrive-a.leave),p:e,carry:a.out}}if(n<a.stay)return{trip:a,phase:"at",u:1,p:0,carry:null};let e=(n-a.stay)/(a.back-a.stay);return{trip:a,phase:"back",u:Number.isFinite(a.back)?1-B(e,a.back-a.stay):1,p:e,carry:a.home}}return null}let Y={hop:.58,flip:.92,cheer:.76},H={hop:.3,flip:.8,cheer:.58},G=[0,1,2,3],K=(e,t)=>{let n=Math.imul(0x811c9dc5^t,0x1000193);for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),0x1000193);return(((n=Math.imul((n=Math.imul(n^n>>>15,0x85ebca6b))^n>>>13,0xc2b2ae35))^n>>>16)>>>0)/0x100000000};function X(e,t){let n=n=>K(e,7919*(t+1)+n),a=2.45+.7*n(3),r=1.15*(.85+.3*n(4));return{rise:.4+.1*n(6),fall:a/r+.15,top:a,sink:r}}var Q=e.i(83928),V=e.i(621285),Z=e.i(283653),J=e.i(647163);let ee=[.3,.4,.5,.7,.75,.8,.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4],et=(e,t,n,a)=>{let r=Math.min(ee[ee.length-1],Math.max(ee[0],a));return{z:r,x:t-r/e.z*(t-e.x),y:n-r/e.z*(n-e.y)}},en=(e,t)=>t?ee.find(t=>t>e+.001)??e:ee.findLast(t=>t<e-.001)??e,ea=e=>`color-mix(in oklab, var(--ink) ${e}%, transparent)`;function er({scene:e,start:a,label:r,faces:d,from:c,onBot:u,onAnswer:f,camera:p=S,className:x}){let m=(0,n.useRef)(null),g=function(e){let[t,a]=(0,n.useState)(null);return(0,n.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{let e=Math.round(t.clientWidth),n=Math.round(t.clientHeight);a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})};n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e]),t}(m),[b]=(0,n.useState)(()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches),k=(0,n.useMemo)(()=>g&&g.w>0&&g.h>0?function(e,t,n=S){let{helpers:a,at:r}=function(e){let t=new Map;for(let n of e.events)"give"!==n.kind&&"release"!==n.kind||t.has(n.to)||t.set(n.to,n.at);let n=e.office.bots.filter(t=>t!==e.office.coord);return n.sort((e,n)=>(t.get(e)??1/0)-(t.get(n)??1/0)),{helpers:n,at:t}}(e),s=function(e,t){let n=Math.ceil(t.length/3),a=t.length?58+30*n:48,r=t.map((e,t)=>{let n=Math.floor(t/3),a=t%3,r=58+30*n,s=10+29*a;return{bot:e,x0:r,y0:s,x1:r+20,y1:s+8,seat:[r+6.5,s-1.6],lane:z[a],spot:[r+7,z[a]],tray:[r+1.2,s+1.4,r+6.8,s+6.6],laptop:[r+16.8,s+1.2]}}),s={bot:e,x0:16,y0:15,x1:40,y1:23,seat:[23.5,13.4],spot:[27,30],lane:30,tray:[0,0,0,0],laptop:[36.6,16.2]},o=[42,78],i=[24,45],l=[s.seat,[44,13.4]],d={lobby:[...l,[44,34],[24,40],[24,54],[42,62],o],door:[...l,[44,34],[24,40],i]};for(let e of r)d[`to:${e.bot}`]=[...l,[44,26],[53,26],[53,e.lane],e.spot],d[`from:${e.bot}`]=[e.seat,[e.x0-2.5,e.seat[1]],[e.x0-2.5,e.lane],[53,e.lane],[53,26],[44,26],[44,30],s.spot];return{width:a,desks:r,byBot:new Map(r.map(e=>[e.bot,e])),own:s,lobby:o,door:i,routes:d}}(e.office.coord,a),o=s.width,i=70,l=80,d=function(e,t,n,a){let r=function({yaw:e,pitch:t}){let n=e*Math.PI/180,a=t*Math.PI/180;return{x:[A*Math.cos(n),A*Math.sin(n)*Math.sin(a)],y:[-A*Math.sin(n),A*Math.cos(n)*Math.sin(a)],z:[0,-.94*Math.cos(a)/Math.cos(Math.PI/6)]}}(a),s=1/0,o=-1/0,i=1/0,l=-1/0,d=(e,t,n)=>{let a=e*r.x[0]+t*r.y[0]+n*r.z[0],d=e*r.x[1]+t*r.y[1]+n*r.z[1];s=Math.min(s,a),o=Math.max(o,a),i=Math.min(i,d),l=Math.max(l,d)};for(let t of[-4,e+3])for(let e of[-4,103])for(let n of[-6,18])d(t,e,n);for(let e of[n.x0,n.x1])for(let t of[n.y0,n.y1])d(e,t,-5);let c=Math.max(1,t.w-40),u=Math.max(1,t.h-96-16),f=Math.min(c/(o-s),u/(l-i),7.4),p=20+(c-(o-s)*f)/2-s*f,h=96+(u-(l-i)*f)/2-i*f,x=(e,t,n=0)=>[O(p+(e*r.x[0]+t*r.y[0]+n*r.z[0])*f),O(h+(e*r.x[1]+t*r.y[1]+n*r.z[1])*f)];return{s:f,axes:r,at:x,points:e=>e.map(([e,t,n])=>x(e,t,n).join(",")).join(" ")}}(s.width,t,{x0:o+9,x1:o+9+28,y0:l,y1:l-i},n),c=[],u=[],f=[],p=[],h=0,x=(e,t,n=!1)=>c.push({id:`f${c.length}`,points:d.points(e),fill:t,hatch:n,delay:h}),m=(e,t,n,a=F)=>u.push({...q(d,e,t,n,a,0,a===L?.75:1.3),id:`l${u.length}`,delay:h}),y=[...[0,o].map(e=>({...q(d,[e,-2,-5],[e,102,-5],340,"url(#office-fade-y)",0,.75),id:`gx${e}`})),...[0,100].map(e=>({...q(d,[-2,e,-5],[o+2,e,-5],340,"url(#office-fade-x)",0,.75),id:`gy${e}`}))];for(let[e,t,n]of(x([[0,100,0],[o,100,0],[o,100,-5],[0,100,-5]],"var(--gray-100)"),x([[o,0,0],[o,100,0],[o,100,-5],[o,0,-5]],"var(--gray-150)",!0),m([0,100,-5],[o,100,-5],64),m([o,0,-5],[o,100,-5],64),m([0,100,0],[0,100,-5],8),m([o,100,0],[o,100,-5],8),m([o,0,0],[o,0,-5],8),h=70,x([[0,48,0],[48,48,0],[48,100,0],[0,100,0]],"url(#office-floor-lobby)"),h=110,x([[0,0,0],[48,0,0],[48,48,0],[0,48,0]],"url(#office-floor-own)"),h=150,a.length&&x([[48,0,0],[o,0,0],[o,100,0],[48,100,0]],"url(#office-floor-work)"),x([[0,0,0],[o,0,0],[o,2.6,0],[2.6,2.6,0],[2.6,100,0],[0,100,0]],"url(#office-hatch-soft)"),m([0,100,0],[o,100,0],22),m([o,0,0],[o,100,0],22),h=210,x([[0,0,0],[o,0,0],[o,0,16],[0,0,16]],"var(--gray-25)"),x([[0,0,0],[0,100,0],[0,100,16],[0,0,16]],"var(--gray-75)",!0),x([[-2,-2,16],[o,-2,16],[o,0,16],[0,0,16],[0,100,16],[-2,100,16]],"var(--gray-100)"),x([[o,-2,0],[o,0,0],[o,0,16],[o,-2,16]],"var(--gray-150)",!0),x([[-2,100,0],[0,100,0],[0,100,16],[-2,100,16]],"var(--gray-100)"),[[[-2,-2,16],[o,-2,16],10],[[0,0,16],[o,0,16],10],[[-2,-2,16],[-2,100,16],10],[[0,0,16],[0,100,16],10],[[o,-2,0],[o,-2,16],10],[[o,0,0],[o,0,16],10],[[o,-2,16],[o,0,16],5],[[-2,100,0],[-2,100,16],10],[[0,100,0],[0,100,16],10],[[-2,100,16],[0,100,16],5],[[0,0,0],[o,0,0],0],[[0,0,0],[0,100,0],0],[[0,0,0],[0,0,16],10]]))m(e,t,n);m([0,.05,1.1],[o,.05,1.1],0,L),m([.05,0,1.1],[.05,100,1.1],0,L),h=260,x([[2.5,.12,4],[21.5,.12,4],[21.5,.12,13],[2.5,.12,13]],"var(--gray-0)"),m([2.5,.12,4],[21.5,.12,4],3),m([2.5,.12,13],[21.5,.12,13],3),m([2.5,.12,4],[2.5,.12,13],3),m([21.5,.12,4],[21.5,.12,13],3);let g=0,b=(e,t,n={})=>{let a=`p${g++}`;p.push({id:a,depth:e,faces:t.faces.map((e,t)=>({...e,id:`${a}f${t}`})),edges:t.edges.map((e,t)=>({...e,id:`${a}e${t}`})),mugs:[],delay:h,appear:null,...n})},k=(e,t,n,a,r,s)=>f.push({points:d.points([[e+.3,t+.5,0],[n+r,t+.5,0],[n+r,a+.7*r,0],[e+.3,a+.7*r,0]]),delay:h,of:s,depth:(e+n)/2+(t+a)/2}),v=["var(--gray-75)","var(--gray-50)","var(--gray-150)"],w=(e,t,n)=>{for(let a=t;a<n;a+=4){let r=Math.min(n,a+4),s=T(d,[e-.9,a,e+.9,r,0,7],{fills:v}),o=s.edges,i=[o[1],o[3],o[8]].concat(a===t?[o[0],o[6]]:[]).concat(r===n?[o[2],o[4],o[5],o[7]]:[]);h+=16,b(e+(a+r)/2+.9,{faces:s.faces,edges:i})}},j=(e,t,n)=>{for(let a=t;a<n;a+=4){let r=Math.min(n,a+4),s=T(d,[a,e-.9,r,e+.9,0,7],{fills:v,hatch:!1}),o=s.edges,i=[o[0],o[2],o[7]].concat(a===t?[o[1],o[4]]:[]).concat(r===n?[o[3],o[5],o[6],o[8]]:[]);h+=16,b((a+r)/2+e+.9,{faces:s.faces,edges:i})}};a.length&&(w(48,0,18),w(48,30,100)),j(48,0,18),j(48,30,48);let $=["var(--office-lid-top)","var(--office-lid)","var(--office-lid-side)"],N="color-mix(in oklab, var(--ink) 80%, transparent)",D=([e,t])=>T(d,[e-3.4,t+.4,e+3.4,t+4.4,6.1,6.45],{fills:["var(--gray-100)","var(--gray-150)","var(--gray-200)"],over:2}),R=[],_=(t,n,a)=>{let r,s;h+=60;let o=(t.x0+t.x1)/2+(t.y0+t.y1)/2,i=`p${g}`;k(t.x0,t.y0,t.x1,t.y1,2.6,null===n?null:i),b(o,(r=T(d,[t.x0-.4,t.y0-.4,t.x1+.4,t.y1+.4,5.2,5.2+.9]),s=[[t.x0,t.y1-.9],[t.x1-.9,t.y1-.9],[t.x1-.9,t.y0]].map(([e,t])=>T(d,[e,t,e+.9,t+.9,0,5.2],{fills:["var(--gray-50)","var(--gray-100)","var(--gray-150)"],over:2.5})),I({faces:[],edges:[q(d,[t.x0+.45,t.y0+.45,0],[t.x0+.45,t.y0+.45,5.2],2.5)]},...s,r)),{appear:n}),h+=40;let l=((t,n)=>{let a=M(e,n).key,[r,s]=t;if("done"===a||"none"===a)return{part:I(D(t),T(d,[r-3.4,s+.4,r+3.4,s+4.4,6.45,6.85],{fills:["var(--gray-200)","var(--gray-300)","var(--gray-250)"],hatch:!1,over:2,color:N}))};let[o,i]=d.at(r-3.4+.45,s+.46,10.2-.4),{axes:l,s:c}=d;return{part:I(D(t),T(d,[r-3.4,s,r+3.4,s+.45,6.1,10.2],{fills:$,hatch:!1,over:2,color:N})),screen:{id:`screen-${n}`,bot:n,matrix:`matrix(${[l.x[0]*c,l.x[1]*c,-l.z[0]*c,-l.z[1]*c,o,i].map(C).join(",")})`,w:6.8-.9,h:4.1-.75,mode:"run"===a?"lit":"paused"===a?"paused":"asking"===a?"asking":"stopped"===a?"dark":"dim"}}})(t.laptop,t.bot);if(b(t.laptop[0]+t.laptop[1]+3.3,l.part,{appear:n,screen:l.screen}),"run"===M(e,t.bot).key&&R.push({id:`pool-${t.bot}`,bot:t.bot,cx:(t.x0+t.x1)/2+1,cy:(t.y0+t.y1)/2-1,r:15}),h+=40,b(o+5.2,{faces:[],edges:[]},{mugs:[((e,t)=>{let n=1.05*d.s,[a,r]=d.at(e,t,8.2),[s,o]=d.at(e,t,6.1);return{cx:a,cy:r,bx:s,by:o,rx:O(n),ry:O(.5*n)}})(a?31:t.x0+11,a?20.5:t.y1-1.5)],appear:n}),h+=40,a)b(o+.6,I(...[0,1,2].map(e=>T(d,[17.2+.3*e,16.2-.2*e,22.2+.3*e,19.6-.2*e,6.1+.7*e,6.1+(e+1)*.7],{over:1.5}))));else{let[a,r,s,o]=t.tray;b((a+s)/2+(r+o)/2+.3,I(T(d,[a,r,s,o,6.1,7.4],{fills:["var(--gray-50)","var(--gray-150)","var(--gray-200)"],over:2}),{faces:[{points:d.points([[a+.5,r+.5,7.4],[s-.5,r+.5,7.4],[s-.5,o-.5,7.4],[a+.5,o-.5,7.4]]),fill:"var(--gray-100)",hatch:!1}],edges:[]}),{appear:n,check:"done"===M(e,t.bot).key?d.points([[(a+s)/2-1.6,(r+o)/2-.2,7.45],[(a+s)/2-.4,(r+o)/2+1.1,7.45],[(a+s)/2+1.9,(r+o)/2-1.6,7.45]]):void 0})}};for(let e of(h+=60,k(12,74,36,80,3,null),b(101,I(T(d,[12,74,36,80,0,7.2]),T(d,[11.4,73.4,36.6,80.6,7.2,8.1]))),_(s.own,null,!0),s.desks))_(e,r.get(e.bot)??0,!1);let{axes:W}=d,E=([e,t,n],a,r,s)=>{let[o,i]=d.at(e,t,n),l=d.s/a;return`matrix(${[r[0]*l,r[1]*l,s[0]*l,s[1]*l,o,i].map(C).join(",")})`},B=[-W.y[0],-W.y[1]],U=[-W.z[0],-W.z[1]],Y=([e,t,n])=>{let[a,r]=d.at(e,t,n);return`matrix(${[W.x[0]*d.s,W.x[1]*d.s,W.y[0]*d.s,W.y[1]*d.s,a,r].map(C).join(",")})`},H=e=>e<=150?Math.round(1.2*e):e<=210?170:250;for(let e of c)e.delay=H(e.delay);for(let e of u)e.delay=H(e.delay);let G=p.filter(e=>null===e.appear).map(e=>e.depth),K=Math.min(...G),X=Math.max(...G),Q=e=>Math.round(300+300*P((e-K)/Math.max(1,X-K),0,1));for(let e of p)e.delay=Q(e.depth);for(let e of f)e.delay=Q(e.depth);return{plan:s,fit:d,guides:y,faces:c,lines:u,shades:f,pieces:p,sign:{matrix:E([o+9,l,-5],10,B,W.x)},board:{matrix:E([-18,99,50],10,B,U),w:1e3,h:500},floor:Y([0,0,0]),pools:R,ground:{matrix:Y([0,0,-5]),w:o,d:100},botSize:Math.round(P(13.5*d.s,28,96)),popAt:700,built:1e3}}(e,g,p):null,[e,g,p]),v=(0,n.useMemo)(()=>k?function(e,t){let n=[],a=new Map,r=e.office.coord,s=e=>_(e)/46+.175,o=(e,r,o,i,l,d={})=>{let c=t.routes[r];if(!c)return;let u=E(c),f=n.findLast(t=>t.who===e);f&&f.back===1/0&&(f.stay=Math.max(f.arrive+.35,o),f.back=f.stay+s(f.route),a.set(e,f.back));let p=Math.max(o,a.get(e)??-1/0),h=s(u),x=p+h,m=void 0!==d.until?Math.max(x+.35,d.until):x+(d.hold??.35),y=d.forever?1/0:m+h;n.push({who:e,route:u,leave:p,arrive:x,stay:m,back:y,out:l,home:d.home??null,event:i,answer:d.answer}),a.set(e,y)};for(let i of e.events)switch(i.kind){case"job":{let e=E(t.routes.lobby),o=s(e);n.push({who:r,route:e,leave:-2,arrive:-1,stay:.8,back:.8+o,out:null,home:"start",event:i}),a.set(r,.8+o);break}case"give":i.from===r&&o(r,`to:${i.to}`,i.at,i,i.extra?"extra":i.after.length?"held":"order");break;case"release":i.from===r&&o(r,`to:${i.to}`,i.at,i,"copy");break;case"refused":i.from===r&&"you"===i.to&&o(r,"door",i.at,i,"note",{home:"noted",hold:.65});break;case"question":{if(i.from!==r)break;let t=e.events.slice(e.events.indexOf(i)+1).find(e=>"answer"===e.kind&&e.to===i.from),n=Math.min(t?.at??1/0,i.closed??1/0);o(r,"lobby",i.at,i,"question",t?{home:"answer",until:n+.35,answer:t}:Number.isFinite(n)?{until:n}:{forever:!0});break}case"report":o(r,"lobby",i.at,i,"report",null===i.closed?{forever:!0}:{until:i.closed,home:"report"});break;case"return":i.to===r&&o(i.from,`from:${i.from}`,i.at,i,"result")}return n}(e,k.plan):[],[e,k]),[w,j]=(0,n.useState)(null),R=null!==w,B=k?.built??null;(0,n.useEffect)(()=>{if(null===B||R)return;let e=window.setTimeout(()=>j((Date.now()-a)/1e3),B);return()=>window.clearTimeout(e)},[null===B,R,a]);let Q=(0,n.useMemo)(()=>b?[]:function(e,t,n){let a=e.office.coord,r=e.opened,s=[],o=(e,t,n)=>{n>=r&&s.push({bot:e,kind:t,at:n})},i=new Map;for(let e of t){if(e.who!==a)continue;("start"===e.home||"answer"===e.home)&&o(a,"hop",e.back);let t=e.event.to;"you"!==t&&"job"!==e.event.kind&&(i.has(t)?("order"===e.out||"extra"===e.out||"copy"===e.out)&&o(t,"hop",e.arrive+.11):(i.set(t,e.arrive),o(t,"flip",e.arrive+.11)))}let l=t.findLast(e=>"report"===e.out),d=l&&"done"===e.office.status&&null===l.event.closed?l.arrive>=r?l.arrive:e.fresh&&null!==n?n:null:null;l&&null!==d&&e.office.bots.forEach((e,n)=>{if(e!==a&&(i.get(e)??1/0)>l.arrive)return;let r=d+.15+.07*n,s=U(t,e,r),c=Number.isFinite(s?.trip.back);s&&("out"===s.phase||"back"===s.phase&&c)&&(r=(c?s.trip.back:s.trip.arrive)+.1),o(e,"cheer",r),o(e,"hop",r+Y.cheer+.06)});let c=N(e);if("paused"===c||"stopped"===c)return s;let u=[...s],f=(e,n)=>{let a=U(t,e,n);return!a||"at"===a.phase||"back"===a.phase&&!Number.isFinite(a.trip.back)};for(let t of e.office.bots)if("none"!==M(e,t).key)for(let e=0;;e++){let n=r+4+150*(e+K(t,e));if(n>r+3600)break;if(.35>K(t,-1-e))continue;let o=.25>K(t,1e3+e)?"flip":"hop",l=n+Y[o];t!==a&&(i.get(t)??1/0)>n||!f(t,n)||!f(t,l)||u.some(e=>e.bot===t&&e.at<l+1.5&&n<e.at+2.5)||s.push({bot:t,kind:o,at:n})}return s}(e,v,w),[b,e,v,w]),V=(0,n.useMemo)(()=>k?function(e,t,n,a){let r=[];for(let e of a)if(r.push([e.at,e.at+Y[e.kind]]),"cheer"===e.kind)for(let t of G){let{rise:n,fall:a}=X(e.bot,t),s=e.at+.1;r.push([s,s+n+a]),r.push([s+n+a+5,s+n+a+5+.8])}for(let e of n)r.push([e.leave,e.arrive+.8]),Number.isFinite(e.back)&&r.push([e.stay,e.back+.8]);for(let e of t.pieces)null!==e.appear&&r.push([e.appear,e.appear+.8]);for(let t of e.events)"refused"===t.kind&&r.push([t.at,t.at+2.4+.1]);return r}(e,k,v,Q):null,[e,k,v,Q]),ee=function(e,t){let[a,r]=(0,n.useState)(()=>(Date.now()-e)/1e3);return(0,n.useEffect)(()=>{let n;if(!t)return;let a=0,s=()=>{let o=(Date.now()-e)/1e3;r(o);let i=function(e,t){let n=1/0;for(let[a,r]of e){if(t>=a&&t<r)return 0;a>t&&(n=Math.min(n,a-t))}return n}(t,o);0===i?a=requestAnimationFrame(s):Number.isFinite(i)&&(n=window.setTimeout(s,1e3*i))};return s(),()=>{cancelAnimationFrame(a),window.clearTimeout(n)}},[e,t]),a}(a,R?V:null),ea=k?function(e,t,n,a,r){let{plan:s,fit:o}=t,i=e.office.coord,l=(e,t=.35)=>C(D(P((r-e)/t,0,1))),d=t.botSize,c=new Map;for(let e of n)e.who!==i||"you"===e.event.to||c.has(e.event.to)||"job"===e.event.kind||c.set(e.event.to,e.arrive);let u=[],f=[],p=[],h=e=>e===i?s.own.seat:s.byBot.get(e)?.seat;for(let t of e.office.bots){let s=t===i,l=s?-1/0:c.get(t);if(!s&&(void 0===l||r<l))continue;let x=h(t);if(!x)continue;let m=U(n,t,r),y=M(e,t),g=x[0],b=x[1],k=0,v=0,w=0,j=[0,0],$=null,N=!!m&&"at"!==m.phase&&!("back"===m.phase&&!Number.isFinite(m.trip.back));if(m){let e=W(m.trip.route,m.u);if(g=e.x,b=e.y,N){let a=Math.abs(Math.sin(Math.PI*m.u*e.total/13.799999999999999));k=3.5*a,w=.03*(1-a)**4;let s=W(m.trip.route,Math.min(1,m.u+.02)),i=W(m.trip.route,Math.max(0,m.u-.02)),[l,d]=o.at(s.x,s.y,0),[c,u]=o.at(i.x,i.y,0),[p,h]=o.at(g,b,0),x=Math.atan2(d-h,l-p)-Math.atan2(h-u,p-c),y=Math.atan2(Math.sin(x),Math.cos(x)),M="back"===m.phase?-1:1;v=P(180*y/Math.PI,-5,5)*M;let N=(l-c)*M,z=(d-u)*M,S=18/(Math.hypot(N,z)||1);j=[Math.round(N*S),Math.round(z*S*.7)];let A=U(n,t,r-.06);if(A&&A.phase===m.phase){let e=W(m.trip.route,A.u),[t,n]=o.at(e.x,e.y,0);$=[O(t-p),O(n-h),O(P((p-t)*1.2,-12,12))]}for(let e=1;e<=6;e++){let n="back"===m.phase?m.u+.045*e:m.u-.045*e;if(n<0||n>1)continue;let a=W(m.trip.route,n),r=e%2?.7:-.7,[s,i]=o.at(a.x+r,a.y-r,0);f.push({id:`${t}${e}`,x:s,y:i,opacity:C(.22-.03*e)})}}}let z=a.find(e=>e.bot===t&&r>=e.at&&r<e.at+Y[e.kind]),S=z?function(e,t,n){let a=Y[e]-.1-.13;if(t<.1)return{lift:0,spin:0,squash:.16*Math.sin(t/.1*Math.PI)};if(t<.1+a){let r=(t-.1)/a;return{lift:H[e]*n*4*r*(1-r),spin:"flip"===e?360*(r<=0?0:r>=1?1:r<.5?4*r*r*r:1-(-2*r+2)**3/2):0,squash:-.1*Math.max(0,1-3*r)}}return{lift:0,spin:0,squash:.14*Math.sin(Math.min(1,(t-.1-a)/.13)*Math.PI)}}(z.kind,r-z.at,d):{lift:0,spin:0,squash:0};k+=S.lift;let[A,F]=o.at(g,b,0),L=N?m?.carry??null:null,q=s?1:P((r-(l??0))/.35,0,1);u.push({bot:t,depth:g+b+.25,x:A,y:F,hop:O(k),tilt:O(v),spin:O(S.spin),squash:C(S.squash+w),scale:C(.6+.4*D(q)),opacity:C(q),size:d,carry:L?{dark:"result"===L||"report"===L||"copy"===L,ember:"question"===L||"answer"===L,stamp:"noted"===L}:null,lag:L?$:null,gaze:j,working:"run"===y.key&&!N,crossed:"stopped"===y.key||"paused"===y.key}),p.push({bot:t,x:A,head:O(F-k-d),foot:F,carrying:!!L,walking:N})}let x=[],m=[],y=(e,t,n,a,r,s,i,l,d=1,c=!1)=>{let u=Math.cos(l),f=Math.sin(l),p=(e,r)=>[t+e*u-r*f,n+e*f+r*u,a];x.push({id:e,depth:t+n+.6,points:o.points([p(-r/2,-s/2),p(r/2,-s/2),p(r/2,s/2),p(-r/2,s/2)]),lines:[.3,.5,.7].map(e=>o.points([p(-r/2+.2*r,-s/2+s*e),p(r/2-r*(e>.6?.45:.2),-s/2+s*e)])),dark:i,ember:c,opacity:d})},g=(e,t,n)=>{let a=e<8?e:1+(e-1)%7,r=e<8?0:Math.floor((e-1)/7),s=Math.floor(a/4),i=3.6+a%4*4.5+.5*r,l=i+3.7,d=12.2-3.9*s-.5*r,c=d-3.2;m.push({id:`pin${e}`,depth:-1,points:o.points([[i,.3,c],[l,.3,c],[l,.3,d],[i,.3,d]]),lines:[.72,.52,.32].map(e=>o.points([[i+.7,.3,c+(d-c)*e],[l-(e<.4?1.8:.7),.3,c+(d-c)*e]])),dark:t,ember:!1,opacity:n})},b=n.find(e=>"start"===e.home);b&&r>=b.back&&g(0,!1,l(b.back));let k=1;for(let e of n)"result"===e.out&&(r>=e.arrive+.31&&g(k,!0,l(e.arrive+.31,.2)),k+=1);for(let e of s.desks){let t=n.filter(t=>t.who===i&&t.event.to===e.bot&&t.leave<=r),a=t.findLast(e=>"held"===e.out),s=a?t.find(e=>"copy"===e.out&&e.event.exchange===a.event.exchange):t.findLast(e=>"copy"===e.out),o=t.findLast(e=>"order"===e.out),d=t.filter(e=>"extra"===e.out).slice(-3),c=(e.tray[0]+e.tray[2])/2,u=(e.tray[1]+e.tray[3])/2;a&&r>=a.arrive+.22&&(!s||r<s.arrive+.4)&&y(`hold-${e.bot}`,c,u,7.5,3.6,4.2,!1,-.12),s&&r>=s.arrive&&r<s.arrive+.4&&y(`copy-${e.bot}`,c+.5,u-.5,7.8,2.8,2.8,!0,.2);let f=s&&(!o||s.leave>o.leave)?s.arrive+.4:o?o.arrive+.22:null;null!==f&&r>=f&&y(`order-${e.bot}`,e.x0+9.5,e.y0+4.2,6.15,4.6,3.6,!1,.08,l(f)),s&&r>=s.arrive+.4&&y(`answers-${e.bot}`,e.x0+11.2,e.y0+3.4,6.2,2.8,2.6,!0,.25,l(s.arrive+.4)),d.forEach((t,n)=>{r>=t.arrive&&y(`more-${e.bot}-${t.event.id}`,e.x0+6.8+1.2*n,e.y0+5.4,6.25,2.6,2.2,!1,-.2,l(t.arrive))})}let v=n.find(e=>"question"===e.out&&r>=e.arrive&&r<Math.min(e.answer?e.answer.at+.3:1/0,e.event.closed??1/0));v&&r>=v.arrive+.22&&y("question",29,77,8.2,4.4,3.4,!1,-.2,1,!0);let w=n.findLast(e=>"report"===e.out&&r>=e.arrive&&(!Number.isFinite(e.back)||r<e.stay));w&&r>=w.arrive+.22&&y("report",29,77,8.2,4.4,3.4,!0,-.2,l(w.arrive+.22,.15));let j=n.find(e=>"answer"===e.home&&r>=e.back);j&&y("answer",23.5,19.8,6.15,3.4,2.6,!1,-.15,l(j.back));let $=n.find(e=>"note"===e.out&&r>=e.arrive&&r<e.stay),N=[];for(let e of n){let t=e.out;if(!t||"note"===t)continue;let n="result"===t?.31:.22;if(r<e.arrive||r>=e.arrive+n)continue;let a=D((r-e.arrive)/n),i=e.route[e.route.length-1],[l,c]=o.at(i[0],i[1],0),u={x:l+.1*d,y:c-d-16},f=s.byBot.get(e.event.to),p="question"===t||"report"===t?[29,77,8.2]:"result"===t?[12,.3,9.5]:f?[(f.tray[0]+f.tray[2])/2,(f.tray[1]+f.tray[3])/2,7.6]:[i[0],i[1],6],[h,x]=o.at(p[0],p[1],p[2]);N.push({id:`fly-${e.event.id}`,x:O(u.x+(h-u.x)*a),y:O(u.y+(x-u.y)*a-72*a*(1-a)),turn:O(-4+16*a),scale:C(1-.45*a),dark:"result"===t||"report"===t||"copy"===t,ember:"question"===t})}let z=[],S=new Map;for(let e of t.pieces){if(null===e.appear){z.push({kind:"piece",piece:e,draw:1});continue}if(r<e.appear)continue;let t=C(P((r-e.appear)/.8,0,1));S.set(e.id,t),z.push({kind:"piece",piece:e,draw:t})}let A=[...z,...u.map(e=>({kind:"bot",walker:e})),...x.map(e=>({kind:"paper",paper:e}))],F=e=>"piece"===e.kind?e.piece.depth:"bot"===e.kind?e.walker.depth:e.paper.depth;A.sort((e,t)=>F(e)-F(t));let L=t.shades.filter(e=>{if(!e.of)return!0;let t=S.get(e.of);return void 0!==t&&t>=.6}),q=[],R=new Map(u.map(e=>[e.bot,e]));for(let t of e.office.bots){let n=M(e,t),a=R.get(t);if("held"===n.key&&a)for(let e of n.waits){let n=R.get(e);n&&q.push({id:`${e}>${t}`,x1:n.x,y1:n.y,x2:a.x,y2:a.y,opacity:Math.min(n.opacity,a.opacity)})}}let T=e.events.findLast(e=>"refused"===e.kind&&"you"!==e.to&&r>=e.at&&r<e.at+2.4),I=(e,t,n,a)=>{let[s,i]=o.at(e,t,0);return{x:s,y:i-d,scale:C(P((r-n)/.18,0,1)),text:a.text}},_=T?h(T.from):void 0,E=$?I(s.door[0],s.door[1],$.arrive,$.event):T&&_?I(_[0],_[1],T.at,T):null,B=[],Q=!1;for(let e of a){if("cheer"!==e.kind)continue;let t=r-e.at-.1,a=h(e.bot);if(t<0||!R.has(e.bot)||!a)continue;let i=U(n,e.bot,e.at+.1),l=i?W(i.trip.route,i.u):{x:a[0],y:a[1]};for(let n of G){let{rise:a,fall:r}=X(e.bot,n);t>=a+r+5+.8||(t<a+r&&(Q=!0),B.push(function(e,t,n,a,r,s,o){let i=n=>K(e,7919*(t+1)+n),{rise:l,fall:d,top:c,sink:u}=X(e,t),f=r/s.s,p=i(1)*Math.PI*2,h=f*(.5+1.1*i(2)),x=4.2+1.4*i(5),m=i(7)*Math.PI*2,y=1+Math.round(i(9)),g=(.5>i(11)?-1:1)*(40+60*i(10)),b=P(a-l,0,d),k=b/d,v=a<l?a/l*.3:.3+.7*k,w=a<l?0:Math.sin(b*x+m)*f*.35,j=P(n.x+Math.cos(p)*h*v-Math.sin(p)*w,1.5,o-1.5),M=P(n.y+Math.sin(p)*h*v+Math.cos(p)*w,1.5,98.5),$=a<l?.95+(c-.95)*(1-(1-a/l)**2):c-u*(b<.3?b*b/.6:b-.15),[N,z]=s.at(j,M,-(Math.max(0,$)*f/s.axes.z[1])),S=a<l?a/l*y*Math.PI:y*Math.PI+.9*Math.cos(b*x+m)*(1-k),A=.62*r/18,D=P((l+d+5+.8-a)/.8,0,1);return{id:`${e}-sheet${t}`,plane:`matrix(${[s.axes.x[0]*A,s.axes.x[1]*A,s.axes.y[0]*A,s.axes.y[1]*A,N,z].map(C).join(",")})`,turn:O(360*i(8)+(a<l?a/l*160:160+g*b)),face:C(Math.cos(S)),landed:a>=l+d,dark:t%4==1,opacity:C(D)}}(e.bot,n,l,t,d,o,s.width)))}}return{sprites:A,pins:m,tossed:B,hush:Q,here:new Set(u.map(e=>e.bot)),flying:N,trail:f,shades:L,links:q,stamp:E,tags:p}}(e,k,v,Q,ee):null,ei=N(e),el=(0,n.useMemo)(()=>(function(e){let t=new Set;for(let n of e.events)if("return"===n.kind||"report"===n.kind)for(let e of(0,h.pathsIn)(n.text))t.add(e);return[...t]})(e),[e]),{data:ed}=(0,Z.useServerRoute)(el.length?l.queryKey.workspaceFiles(el):null),ec=(0,n.useCallback)(e=>ed?.some(t=>t.path===e)??!1,[ed]),[eu,ef]=(0,n.useState)(null),eh=g?et({z:1,x:0,y:0},g.w/2,g.h/2,.7):{z:.7,x:0,y:0},ex=eu??eh,ek=(0,n.useRef)(eh);ek.current=eh;let ew=(0,n.useRef)(0),eM=(0,n.useRef)(null),e$=(0,n.useRef)(null),[ez,eF]=(0,n.useState)(!1),eL=$(e,ee)?.id??null,[eq,eR]=(0,n.useState)({bot:null,report:eL}),eT=eq.report===eL?eq.bot:null;(0,n.useEffect)(()=>{let e=m.current;if(!e)return;let t=t=>{if(t.target.closest("[data-reads]"))return;t.preventDefault(),cancelAnimationFrame(ew.current),eM.current=null;let n=e.getBoundingClientRect(),a=t.clientX-n.left,r=t.clientY-n.top;ef(e=>{let n=e??ek.current;return et(n,a,r,n.z*Math.exp(-t.deltaY*(t.ctrlKey?.01:.0022)))})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);let eI=()=>{let e=e$.current;e$.current=null,eF(!1),e&&!e.moved&&!e.onPlate&&eT&&eR({bot:null,report:eL})},e_=e=>{cancelAnimationFrame(ew.current);let t=e??ek.current;eM.current=t;let n=performance.now(),a=()=>{let r=Math.min(1,(performance.now()-n)/300),s=1-(1-r)**3;ef(r>=1?e:{z:ex.z+(t.z-ex.z)*s,x:ex.x+(t.x-ex.x)*s,y:ex.y+(t.y-ex.y)*s}),r<1?ew.current=requestAnimationFrame(a):eM.current=null};ew.current=requestAnimationFrame(a)};(0,n.useEffect)(()=>()=>{cancelAnimationFrame(ew.current),y.officePointed.set(null)},[]);let eW=`translate(${ex.x}px, ${ex.y}px) scale(${ex.z})`,eB=(e,t)=>({x:ex.x+ex.z*e,y:ex.y+ex.z*t}),eU=(0,y.useOfficePointed)(),eY=Math.min(1,Math.max(20/26,ex.z/.9)),eH=(ea?.tags??[]).map(t=>({tag:t,plate:function(e,t,n){switch(M(e,t).key){case"run":return{tone:"work",words:"working"};case"asking":case"paused":return{tone:"you",words:"needs you"};default:return t===e.office.coord&&$(e,n)?{tone:"report",words:"report ready"}:null}}(e,t.bot,ee)})),{crowded:eG,onRoom:eK}=function(e,t){let a=(0,n.useRef)(new Map),r=(0,n.useCallback)((e,t)=>{a.current.set(e,t)},[]),[s,o]=(0,n.useState)([]),i=JSON.stringify([t,...e.map(e=>[e.bot,Math.round(e.home.x),Math.round(e.home.y),e.open,e.words])]);return(0,n.useLayoutEffect)(()=>{let n=(e,n,a,r)=>({bot:e,l:n-r*t/2,r:n+r*t/2,t:a-26*t,b:a}),r=(e,t)=>e.l<t.r+4&&t.l<e.r+4&&e.t<t.b+4&&t.t<e.b+4,s=e.filter(e=>e.open),i=s.flatMap(e=>{let t=a.current.get(e.bot);return t?[n(e.bot,e.home.x,e.home.y,t.mark)]:[]}),l=[],d=[];for(let e of s.sort((e,t)=>Number(t.first)-Number(e.first))){let t=a.current.get(e.bot);if(!t)continue;let s=n(e.bot,e.home.x,e.home.y,t.mark+t.rest);if(e.first){l.push(s);continue}[...i,...l].some(t=>t.bot!==e.bot&&r(s,t))?d.push(e.bot):l.push(s)}o(e=>e.length===d.length&&e.every(e=>d.includes(e))?e:d)},[i]),{crowded:s,onRoom:r}}(eH.flatMap(({tag:t,plate:n})=>{let a=t.walking?(t=>{let n=t===e.office.coord?k?.plan.own.seat:k?.plan.byBot.get(t)?.seat;if(!k||!n)return null;let[a,r]=k.fit.at(n[0],n[1],0);return eB(a,r-k.botSize-6)})(t.bot):eB(t.x,t.foot-(k?.botSize??0)-6);return a?[{bot:t.bot,home:a,open:null!==n,first:n?.tone==="you",words:n?.words??""}]:[]}),eY);return(0,t.jsx)("div",{ref:m,"data-room":!0,"data-building":R?void 0:"",onPointerDown:e=>{let t=e.target;0!==e.button||t.closest("button, a, [data-reads]")||(cancelAnimationFrame(ew.current),eM.current=null,e$.current={x:e.clientX,y:e.clientY,from:ex,moved:!1,onPlate:!!t.closest("[data-plate]")},e.currentTarget.setPointerCapture(e.pointerId))},onPointerMove:e=>{let t=e$.current;if(!t)return;let n=e.clientX-t.x,a=e.clientY-t.y;!t.moved&&3>Math.hypot(n,a)||(t.moved=!0,eF(!0),ef({...t.from,x:t.from.x+n,y:t.from.y+a}))},onPointerUp:eI,onPointerCancel:eI,className:(0,J.cn)("relative touch-none select-none overflow-hidden",ez?"cursor-grabbing":"cursor-grab",x),children:k&&ea&&g&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"office-fade pointer-events-none absolute inset-0 [mask-composite:intersect] [mask-image:linear-gradient(to_right,transparent,#000_80px,#000_calc(100%-80px),transparent),linear-gradient(to_bottom,transparent,#000_60px,#000_calc(100%-60px),transparent)]",children:(0,t.jsx)("div",{className:"absolute top-0 left-0 origin-top-left",style:{width:g.w,height:g.h,transform:eW},children:(0,t.jsxs)("svg",{width:g.w,height:g.h,className:"overflow-visible","aria-hidden":!0,children:[(0,t.jsx)(ey,{}),(0,t.jsx)(em,{stage:k,on:R&&"paused"===ei}),k.guides.map(e=>(0,t.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,style:{stroke:e.color,strokeWidth:e.width,strokeLinecap:"round"}},e.id))]})})}),(0,t.jsxs)("div",{className:"absolute top-0 left-0 origin-top-left",style:{width:g.w,height:g.h,transform:eW},children:[(0,t.jsx)(eE,{stage:k,scene:e,sign:ei,start:a,label:r,faces:d}),(0,t.jsxs)("svg",{width:g.w,height:g.h,className:"overflow-visible",role:"img","aria-label":`The office for ${r}`,children:[(0,t.jsx)(eg,{}),(0,t.jsx)(eb,{stage:k}),(0,t.jsx)(eN,{stage:k,here:ea.here}),ea.shades.map(e=>(0,t.jsx)("polygon",{className:"office-drop",points:e.points,fill:"url(#office-hatch-shade)",style:{animationDelay:`${e.delay}ms`}},e.points)),(0,t.jsxs)("g",{className:"office-fade",style:{animationDelay:`${k.popAt}ms`},children:[(0,t.jsx)(ev,{links:ea.links}),ea.pins.map(e=>(0,t.jsx)(eS,{paper:e},e.id))]}),ea.tossed.map(e=>e.landed&&(0,t.jsx)(eA,{sheet:e},e.id)),ea.trail.map(e=>(0,t.jsx)("ellipse",{cx:e.x,cy:e.y,rx:3,ry:1.5,style:{fill:"var(--ink)",opacity:e.opacity}},e.id)),ea.sprites.map(e=>{let n;return"piece"===e.kind?(0,t.jsx)(ej,{piece:e.piece,draw:e.draw,awake:!e.piece.screen||ea.here.has(e.piece.screen.bot)},e.piece.id):"bot"===e.kind?(0,t.jsx)(eO,{walker:e.walker,face:(n=e.walker.bot,d.find(e=>e.name===n)),popAt:k.popAt},`bot-${e.walker.bot}`):(0,t.jsx)(eS,{paper:e.paper,land:k.popAt},e.paper.id)}),ea.tossed.map(e=>!e.landed&&(0,t.jsx)(eA,{sheet:e},e.id)),ea.flying.map(e=>(0,t.jsx)("g",{transform:`translate(${e.x} ${e.y}) rotate(${e.turn}) scale(${e.scale})`,children:(0,t.jsx)(eC,{dark:e.dark,ember:e.ember})},e.id))]}),(0,t.jsx)(ep,{stage:k,sign:ei,land:R?0:k.popAt+250})]}),(0,t.jsxs)("div",{className:"office-fade pointer-events-none absolute inset-0",style:{animationDelay:`${k.popAt}ms`},children:[ea.stamp&&(0,t.jsx)(eP,{spot:eB(ea.stamp.x,ea.stamp.y),scale:ea.stamp.scale,text:ea.stamp.text}),eH.map(({tag:n,plate:a})=>(0,t.jsx)(eD,{plate:a,state:M(e,n.bot),crowded:eG.includes(n.bot),onRoom:eK,bot:n.bot,head:eB(n.x,n.head),foot:eB(n.x,n.foot).y,lift:n.carrying?32*ex.z:0,size:k.botSize*ex.z,width:g.w,hush:ea.hush,pointed:eU===n.bot,scale:eY,words:eT===n.bot?function(e,t,n){if(t===e.office.coord){let t=$(e,n);if(t)return{kind:"report",text:t.text}}let a=e.events.findLast(a=>a.from===t&&a.at<=n&&("return"===a.kind||"question"===a.kind&&"asking"===M(e,t).key));return a?{kind:"question"===a.kind?"question":"answer",text:a.text}:null}(e,n.bot,ee):void 0,onPick:()=>{var e;eR({bot:eT===(e=n.bot)?null:e,report:eL}),u?.(e)}},n.bot))]}),(0,t.jsx)(eo,{label:r,bots:e.office.bots.length,files:"done"===e.office.status?el.filter(ec):[],from:c,scene:e,sign:ei,onAnswer:f}),(0,t.jsxs)("div",{className:"absolute bottom-3.5 left-4 flex items-center gap-0.5 rounded-full bg-background p-0.75 shadow-sm ring-1 ring-border",children:[(0,t.jsx)(es,{label:"Zoom out",onClick:()=>{let e=eM.current??ex;e_(et(e,g.w/2,g.h/2,en(e.z,!1)))},children:(0,t.jsx)(o.Minus,{className:"size-3.5"})}),(0,t.jsxs)("span",{className:"min-w-11 text-center font-mono text-[11.5px] text-foreground/80 tabular-nums",children:[Math.round(100*ex.z),"%"]}),(0,t.jsx)(es,{label:"Zoom in",onClick:()=>{let e=eM.current??ex;e_(et(e,g.w/2,g.h/2,en(e.z,!0)))},children:(0,t.jsx)(i.Plus,{className:"size-3.5"})}),(0,t.jsx)("span",{className:"mx-0.5 h-4 w-px bg-border"}),(0,t.jsx)(es,{label:"Fit the office",onClick:()=>e_(null),children:(0,t.jsx)(s,{className:"size-3.5"})})]})]})})}function es({label:e,onClick:n,children:a}){return(0,t.jsx)("button",{type:"button","aria-label":e,title:e,onClick:n,className:"grid size-7.5 place-items-center rounded-full outline-none transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",children:a})}function eo({label:e,bots:a,files:r,from:s,scene:o,sign:i,onAnswer:l}){let d=(0,y.useOfficeCaption)(),[c,u]=(0,n.useState)(!1),f=r.length>4,p=c&&f,h=f&&!p?r.slice(0,3):r;return(0,t.jsxs)("div",{className:(0,J.cn)("pointer-events-none absolute left-6 flex max-w-[min(34rem,calc(100%-3rem))] animate-in flex-col gap-3 fade-in transition-[top] duration-300",d?"top-24":"top-5"),children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[(0,t.jsx)("h2",{className:"line-clamp-2 max-w-[28rem] text-balance font-semibold text-[22px] leading-tight tracking-tight",children:e}),(0,t.jsx)(eI,{scene:o,sign:i,onAnswer:l})]}),r.length>0&&(0,t.jsxs)("div",{className:"flex animate-in flex-col gap-2 fade-in slide-in-from-top-1 duration-300",children:[(0,t.jsxs)("span",{className:"font-mono text-[11.5px] text-muted-foreground tabular-nums",children:[a," ",1===a?"bot":"bots"," · ",r.length," ",1===r.length?"file":"files"]}),(0,t.jsxs)("div",{className:(0,J.cn)("pointer-events-auto flex flex-wrap gap-1.5",p&&"max-h-60 overflow-y-auto rounded-2xl bg-background/80 p-1.5 ring-1 ring-border scrollbar-none"),children:[h.map(e=>{let n=(0,Q.fileIcon)(e);return(0,t.jsxs)(V.FileLink,{path:e,from:s,className:"flex h-7 min-w-0 max-w-full items-center gap-1.5 rounded-full bg-background pr-3 pl-2.5 text-[12.5px] shadow-sm outline-none ring-1 ring-border transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(n,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:e.split("/").pop()})]},e)}),f&&(0,t.jsx)("button",{type:"button",onClick:()=>u(e=>!e),"aria-expanded":p,className:"flex h-7 items-center rounded-full bg-foreground/7 px-3 text-[12.5px] outline-none transition-colors hover:bg-foreground/12 focus-visible:ring-3 focus-visible:ring-ring/50",children:p?"Fewer":`+${r.length-3} more`})]})]})]})}let ei={a:"2.3,1.7 4,0 16,0 17.7,1.7 16,3.4 4,3.4",g:"2.3,18 4,16.3 16,16.3 17.7,18 16,19.7 4,19.7",d:"2.3,34.3 4,32.6 16,32.6 17.7,34.3 16,36 4,36",f:"1.7,2.3 3.4,4 3.4,15.7 1.7,17.4 0,15.7 0,4",e:"1.7,18.6 3.4,20.3 3.4,32 1.7,33.7 0,32 0,20.3",b:"18.3,2.3 20,4 20,15.7 18.3,17.4 16.6,15.7 16.6,4",c:"18.3,18.6 20,20.3 20,32 18.3,33.7 16.6,32 16.6,20.3"},el=["abcdef","bc","abdeg","abcdg","bcfg","acdfg","acdefg","abc","abcdefg","abcdfg"];function ed({value:e,tall:n=41,lit:a="var(--ink)",unlit:r=ea(5.5)}){return(0,t.jsx)("svg",{width:23*n/41,height:n,viewBox:"-0.5 -0.5 21 37",className:"-skew-x-[7deg] overflow-visible","aria-hidden":!0,children:Object.keys(ei).map(n=>(0,t.jsx)("polygon",{points:ei[n],style:{fill:el[e].includes(n)?a:r}},n))})}let ec=["first","second","third"],eu={done:150,paused:150,stopped:132,you:106},ef={work:"AT WORK",you:"YOUR TURN",paused:"PAUSED",stopped:"STOPPED",done:"DONE"};function ep({stage:e,sign:n,land:a}){return(0,t.jsx)("div",{className:"office-fade pointer-events-none absolute top-0 left-0 origin-top-left",style:{width:700,height:280,transform:e.sign.matrix,animationDelay:`${e.popAt}ms`},children:(0,t.jsx)(eh,{sign:n,land:a})})}function eh({sign:e,land:a}){let[r,s]=(0,n.useState)(null),[o,i]=(0,n.useState)(e);return o!==e&&(s(o),i(e)),(0,n.useEffect)(()=>{if(null===r)return;let e=window.setTimeout(()=>s(null),800);return()=>window.clearTimeout(e)},[r]),(0,t.jsxs)(t.Fragment,{children:[null!==r&&(0,t.jsx)("div",{className:(0,J.cn)("absolute inset-0","work"===r?"origin-right animate-office-tape-out":"animate-office-sign-out"),children:(0,t.jsx)(ex,{sign:r,land:0})}),(0,t.jsx)("div",{className:(0,J.cn)("absolute inset-0",null!==r&&("done"===e?"animate-office-paint":"animate-in fade-in delay-200 duration-300 fill-mode-backwards")),children:(0,t.jsx)(ex,{sign:e,land:null!==r?0:a})},e)]})}function ex({sign:e,land:a}){let[r]=(0,n.useState)(a);return"work"===e?(0,t.jsxs)("div",{className:"absolute inset-x-0 top-5 flex h-27 items-center overflow-hidden pl-7 font-bold text-[64px] text-foreground/45 tracking-[0.2em]",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute inset-y-0 right-0 -left-[51px] animate-office-tape bg-[repeating-linear-gradient(-45deg,color-mix(in_oklab,var(--ink)_14%,transparent)_0_18px,transparent_18px_36px)] motion-reduce:animate-none"}),(0,t.jsx)("span",{className:"relative",children:ef.work})]}):(0,t.jsx)("div",{className:(0,J.cn)("absolute top-4.5 left-6 flex animate-office-sign flex-col gap-2.5 whitespace-nowrap motion-reduce:animate-none","done"===e&&"text-foreground/82",("you"===e||"paused"===e)&&"text-waiting/85","stopped"===e&&"text-foreground/40"),style:{animationDelay:`${r}ms`},children:(0,t.jsx)("span",{className:"font-extrabold leading-[0.9] tracking-[0.02em]",style:{fontSize:eu[e]},children:ef[e]})})}function em({stage:e,on:n}){let{matrix:a,w:r,d:s}=e.ground;return(0,t.jsxs)("g",{transform:a,style:{opacity:+!!n,transition:"opacity 1.2s ease"},children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("radialGradient",{id:"office-alarm",children:[(0,t.jsx)("stop",{offset:"0",style:{stopColor:"var(--destructive)",stopOpacity:.12}}),(0,t.jsx)("stop",{offset:"0.55",style:{stopColor:"var(--destructive)",stopOpacity:.07}}),(0,t.jsx)("stop",{offset:"1",style:{stopColor:"var(--destructive)",stopOpacity:0}})]})}),(0,t.jsx)("ellipse",{cx:r/2,cy:s/2,rx:r/2+100,ry:s/2+100,fill:"url(#office-alarm)"})]})}function ey(){let e=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("stop",{offset:"0",style:{stopColor:"var(--ink)",stopOpacity:0}}),(0,t.jsx)("stop",{offset:"0.3",style:{stopColor:"var(--ink)",stopOpacity:.2}}),(0,t.jsx)("stop",{offset:"0.7",style:{stopColor:"var(--ink)",stopOpacity:.2}}),(0,t.jsx)("stop",{offset:"1",style:{stopColor:"var(--ink)",stopOpacity:0}})]});return(0,t.jsxs)("defs",{children:[(0,t.jsx)("linearGradient",{id:"office-fade-x",x1:"0",y1:"0",x2:"1",y2:"1",children:e}),(0,t.jsx)("linearGradient",{id:"office-fade-y",x1:"1",y1:"0",x2:"0",y2:"1",children:e})]})}function eg(){let e=(e,n,a,r)=>(0,t.jsx)("pattern",{id:e,width:n,height:n,patternUnits:"userSpaceOnUse",patternTransform:`rotate(${a})`,children:(0,t.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:n,style:{stroke:ea(r),strokeWidth:.8}})}),n=(e,n,a)=>(0,t.jsxs)("linearGradient",{id:e,x1:"0.1",y1:"0",x2:"0.9",y2:"1",children:[(0,t.jsx)("stop",{offset:"0",style:{stopColor:n}}),(0,t.jsx)("stop",{offset:"1",style:{stopColor:a}})]});return(0,t.jsxs)("defs",{children:[e("office-hatch-side",3.4,-38,20),e("office-hatch-shade",3,28,30),e("office-hatch-soft",3.2,28,14),n("office-floor-own","var(--gray-25)","var(--gray-100)"),n("office-floor-lobby","var(--gray-50)","var(--gray-150)"),n("office-floor-work","var(--gray-0)","var(--gray-75)")]})}let eb=(0,n.memo)(function({stage:e}){return(0,t.jsxs)(t.Fragment,{children:[e.faces.map(e=>(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)("polygon",{className:"office-drop",points:e.points,style:{fill:e.fill,animationDelay:`${e.delay}ms`}}),e.hatch&&(0,t.jsx)("polygon",{className:"office-drop",points:e.points,fill:"url(#office-hatch-side)",style:{animationDelay:`${e.delay}ms`}})]},e.id)),e.lines.map(e=>(0,t.jsx)(ek,{line:e,className:"office-drop",style:{animationDelay:`${e.delay}ms`}},e.id))]})});function ek({line:e,className:n,style:a}){return(0,t.jsx)("line",{className:n,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,style:{stroke:e.color,strokeWidth:e.width,strokeLinecap:"round",...a}})}function ev({links:e}){return(0,t.jsx)(t.Fragment,{children:e.map(e=>{let n=(e.x1+e.x2)/2,a=(e.y1+e.y2)/2+.12*Math.abs(e.x2-e.x1)+6;return(0,t.jsxs)("g",{opacity:e.opacity,children:[(0,t.jsx)("path",{d:`M${e.x1} ${e.y1} Q${n} ${a} ${e.x2} ${e.y2}`,style:{fill:"none",stroke:ea(42),strokeWidth:1.3,strokeDasharray:"3 3.5",strokeLinecap:"round"}}),(0,t.jsx)("circle",{cx:e.x2,cy:e.y2,r:2.6,style:{fill:ea(55)}})]},e.id)})})}let ew=e=>e<=0?0:e>=1?1:1-(1-e)**3,ej=(0,n.memo)(function({piece:e,draw:a,awake:r=!0}){let s=a<1;return(0,t.jsxs)("g",{className:"office-drop",style:{animationDelay:`${e.delay}ms`},children:[(0,t.jsx)("g",{opacity:s?ew((a-.35)/.65):1,children:e.faces.map(e=>(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)("polygon",{points:e.points,style:{fill:e.fill}}),e.hatch&&(0,t.jsx)("polygon",{points:e.points,fill:"url(#office-hatch-side)"})]},e.id))}),e.edges.map(e=>(0,t.jsx)(ek,{line:e,style:s?{strokeDasharray:`${e.length} ${e.length}`,strokeDashoffset:e.length*(1-ew(a))}:void 0},e.id)),(!s||a>.7)&&(0,t.jsxs)(t.Fragment,{children:[e.mugs.map(e=>(0,t.jsx)(ez,{mug:e},`${e.cx},${e.cy}`)),e.screen&&(0,t.jsx)(e$,{screen:e.screen,awake:r}),e.check&&(0,t.jsx)("polyline",{points:e.check,style:{fill:"none",stroke:"var(--ink)",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"}})]})]})}),eM=[.5,.95,1.4,1.85,2.3,2.75,3.2,3.65,4.1,4.55];function e$({screen:e,awake:a}){let{w:r,h:s}=e,o=a||"lit"!==e.mode?e.mode:"dim",i=(0,n.useId)();return(0,t.jsxs)("g",{transform:e.matrix,children:[(0,t.jsx)("defs",{children:(0,t.jsx)("clipPath",{id:i,clipPathUnits:"userSpaceOnUse",children:(0,t.jsx)("rect",{x:0,y:0,width:r,height:s})})}),(0,t.jsx)("rect",{x:0,y:0,width:r,height:s,rx:.15,style:{fill:"lit"===o?"var(--office-screen-lit)":"dim"===o||"asking"===o?"var(--office-screen-dim)":"var(--office-screen-dark)"}}),"lit"===o&&(0,t.jsx)("g",{clipPath:`url(#${i})`,children:(0,t.jsx)("g",{className:"animate-office-screen",children:eM.map((e,n)=>(0,t.jsx)("line",{x1:.55,y1:e,x2:r*(n%3==2?.45:n%2?.7:.85),y2:e,style:{stroke:"var(--office-screen-line)",strokeWidth:.26,strokeLinecap:"round"}},e))})}),"dim"===o&&[.7,1.2].map((e,n)=>(0,t.jsx)("line",{x1:.55,y1:e,x2:r*(n?.4:.65),y2:e,style:{stroke:"color-mix(in oklab, var(--office-screen-lit) 35%, transparent)",strokeWidth:.2,strokeLinecap:"round"}},e)),"paused"===o&&(0,t.jsxs)("g",{style:{fill:"var(--waiting)"},children:[(0,t.jsx)("rect",{x:r/2-.55,y:s/2-.7,width:.36,height:1.4,rx:.12}),(0,t.jsx)("rect",{x:r/2+.19,y:s/2-.7,width:.36,height:1.4,rx:.12})]}),"asking"===o&&(0,t.jsx)("circle",{cx:r/2,cy:s/2,r:.55,style:{fill:"var(--waiting)"}})]})}function eN({stage:e,here:a}){let r=(0,n.useId)(),s=e.pools.filter(e=>a.has(e.bot));return s.length?(0,t.jsxs)("g",{transform:e.floor,children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("radialGradient",{id:r,children:[(0,t.jsx)("stop",{offset:"0",style:{stopColor:"var(--ink)",stopOpacity:.16}}),(0,t.jsx)("stop",{offset:"0.6",style:{stopColor:"var(--ink)",stopOpacity:.08}}),(0,t.jsx)("stop",{offset:"1",style:{stopColor:"var(--ink)",stopOpacity:0}})]})}),s.map(n=>(0,t.jsx)("ellipse",{className:"office-fade",cx:n.cx,cy:n.cy,rx:n.r,ry:n.r,fill:`url(#${r})`,style:{animationDelay:`${e.popAt}ms`}},n.id))]}):null}function ez({mug:e}){let n={stroke:ea(60),strokeWidth:1};return(0,t.jsxs)("g",{children:[(0,t.jsx)("ellipse",{cx:e.bx,cy:e.by,rx:e.rx,ry:e.ry,style:{fill:"var(--gray-50)",...n}}),(0,t.jsx)("rect",{x:e.cx-e.rx,y:e.cy,width:2*e.rx,height:Math.max(0,e.by-e.cy),style:{fill:"var(--gray-50)"}}),(0,t.jsx)("line",{x1:e.cx-e.rx,y1:e.cy,x2:e.bx-e.rx,y2:e.by,style:n}),(0,t.jsx)("line",{x1:e.cx+e.rx,y1:e.cy,x2:e.bx+e.rx,y2:e.by,style:n}),(0,t.jsx)("ellipse",{cx:e.cx,cy:e.cy,rx:e.rx,ry:e.ry,style:{fill:"var(--gray-0)",...n}})]})}function eS({paper:e,land:n}){return(0,t.jsxs)("g",{opacity:e.opacity,className:void 0===n?void 0:"office-fade",style:void 0===n?void 0:{animationDelay:`${n}ms`},children:[(0,t.jsx)("polygon",{points:e.points,style:{fill:e.dark?"var(--ink)":"var(--gray-0)",stroke:e.ember?"var(--waiting)":e.dark?"var(--ink)":ea(50),strokeWidth:e.ember?1.6:1,strokeLinejoin:"round"}}),e.lines.map(n=>(0,t.jsx)("polyline",{points:n,style:{fill:"none",stroke:e.dark?"color-mix(in oklab, var(--gray-0) 55%, transparent)":ea(32),strokeWidth:1.2,strokeLinecap:"round"}},n))]})}function eA({sheet:e}){return(0,t.jsxs)("g",{transform:`${e.plane} rotate(${e.turn}) scale(${e.face} 1)`,opacity:e.opacity,children:[(0,t.jsx)("rect",{x:-7,y:-9,width:14,height:18,rx:1.6,style:{fill:e.dark?"var(--ink)":"var(--gray-0)",stroke:e.dark?"var(--ink)":ea(45),strokeWidth:.8}}),e.face>0&&[-5,-2,1].map((n,a)=>(0,t.jsx)("rect",{x:-4.5,y:n,width:2===a?5:9,height:1.4,style:{fill:e.dark?"color-mix(in oklab, var(--gray-0) 55%, transparent)":ea(32)}},n))]})}function eO({walker:e,face:n,popAt:a}){let{x:r,y:s,hop:o,tilt:i,spin:l,squash:d,scale:c,size:f,opacity:p}=e;return(0,t.jsxs)("g",{className:"office-fade",style:{animationDelay:`${a}ms`},children:[(0,t.jsx)("ellipse",{cx:r,cy:s,rx:Math.max(1,.27*f-Math.min(.5*o,.15*f)),ry:Math.max(1,.1*f-Math.min(.2*o,.05*f)),fill:"url(#office-hatch-shade)",opacity:p}),(0,t.jsx)("g",{transform:`translate(${r} ${s-o}) rotate(${i}) scale(${c*(1+.6*d)} ${c*(1-d)}) translate(0 ${-f/2}) rotate(${l}) translate(${-f/2} ${-f/2})`,opacity:p,children:(0,t.jsx)("g",{className:"office-pop",style:{animationDelay:`${a}ms`},children:(0,t.jsx)("g",{className:(0,J.cn)("origin-bottom [transform-box:fill-box]",e.working&&"animate-office-work motion-reduce:animate-none"),children:(0,t.jsx)(u.BotMark,{size:f,seed:e.bot,...(0,u.iconProps)(n?.icon),state:e.working?"thinking":"idle",gazeX:e.gaze[0],gazeY:e.gaze[1],crossed:e.crossed,notify:!1})})})}),e.carry&&(0,t.jsx)("g",{transform:e.lag?`translate(${r+.1*f+.8*e.lag[0]} ${s-.6*o-f-16+.4*e.lag[1]}) rotate(${e.lag[2]-4})`:`translate(${r+.1*f} ${s-o-f-16}) rotate(${-(1.4*i)-4})`,children:(0,t.jsx)(eC,{...e.carry})})]})}function eC({dark:e,ember:n,stamp:a=!1}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:-11,y:-14,width:22,height:28,rx:2.5,style:{fill:e?"var(--ink)":"var(--gray-0)",stroke:n?"var(--waiting)":e?"var(--ink)":ea(45),strokeWidth:1.3}}),[-8,-3.5,1].map((n,a)=>(0,t.jsx)("rect",{x:-6.5,y:n,width:2===a?7.5:13,height:2,style:{fill:e?"color-mix(in oklab, var(--gray-0) 55%, transparent)":ea(32)}},n)),a&&(0,t.jsx)("rect",{x:-8.5,y:3.5,width:15,height:7,rx:1.5,transform:"rotate(-14)",style:{fill:"none",stroke:"var(--destructive)",strokeWidth:1.5}})]})}function eP({spot:e,scale:n,text:a}){return(0,t.jsxs)("div",{className:"absolute flex items-center gap-2",style:{left:e.x+30,top:e.y-8},children:[(0,t.jsx)("div",{className:"relative h-9.5 w-7.5 shrink-0 -rotate-5 rounded-[3px] border border-foreground/30 bg-background",children:(0,t.jsx)("span",{className:"absolute top-3.5 -left-0.5 rounded-[3px] border-2 border-destructive bg-background/90 px-0.75 font-semibold text-[10.5px] text-destructive",style:{transform:`rotate(-14deg) scale(${n})`},children:"Refused"})}),(0,t.jsx)("span",{className:"line-clamp-3 w-48 rounded-lg border border-border bg-background/95 px-2 py-1 text-[11.5px] text-foreground/80 leading-snug",children:a})]})}function eD({plate:e,state:a,crowded:r,onRoom:s,bot:o,head:i,foot:l,lift:d,size:u,width:f,hush:p,words:h,pointed:x,scale:m,onPick:g}){let b=i.y-6-d,k=(null===e||r)&&!x,v=(0,n.useRef)(null),w=(0,n.useRef)(null),[j,M]=(0,n.useState)(null),$=`${a.key} ${e?.tone??""} ${e?.words??""}`,N=void 0!==h;(0,n.useLayoutEffect)(()=>{if(!v.current||!w.current)return;let e=0;for(let t of v.current.querySelectorAll("[data-unfold]"))e+=t.scrollWidth;let t={mark:w.current.offsetWidth+17,rest:e};s(o,t),M(e=>e&&e.mark===t.mark&&e.rest===t.rest?e:t)},[o,$,N,s]);let z=j?j.mark+j.rest:0,S=j?i.x+z/2>f-12?{right:-j.mark/2}:i.x-z/2<12?{left:-j.mark/2}:null:null;return(0,t.jsxs)("div",{"data-plate":!0,onPointerEnter:()=>y.officePointed.set(o),onPointerLeave:()=>y.officePointed.set(null),className:(0,J.cn)("group/plate absolute size-0 transition-opacity duration-500",void 0!==h?"z-40":e?.tone==="you"?"z-31":x?"z-30":k?"z-10 hover:z-30 has-[:focus-visible]:z-30":"z-20 hover:z-30 has-[:focus-visible]:z-30",p&&"opacity-15"),style:{left:i.x,top:b},children:[(0,t.jsx)("button",{type:"button",tabIndex:-1,"aria-hidden":!0,onClick:g,className:"pointer-events-auto absolute top-1 cursor-pointer",style:{left:-(.4*u),width:.8*u,height:Math.max(12,l-b-4)}}),void 0!==h&&(0,t.jsx)(eL,{words:h,state:a,bot:o,top:b,x:i.x,width:f,below:l-b,size:u,onPick:g}),(0,t.jsxs)("div",{ref:v,hidden:N,style:{...S,scale:1===m?void 0:String(m),transformOrigin:`${S?.right!==void 0?"100%":S?.left!==void 0?"0%":"50%"} 100%`},className:(0,J.cn)("pointer-events-auto absolute bottom-0 flex h-6.5 items-center whitespace-nowrap rounded-full bg-background pr-2.25 text-[12px] transition-opacity duration-120",!S&&"left-0 -translate-x-1/2",e?.tone==="you"?"ring-[1.5px] ring-waiting":"ring-[0.75px] ring-foreground/25",e&&"animate-office-plate",null===e&&!x&&"opacity-0 group-hover/plate:opacity-100 group-has-[:focus-visible]/plate:opacity-100"),children:[e?.tone==="you"&&(0,t.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 animate-office-ask rounded-full"}),(0,t.jsxs)("button",{type:"button",onClick:g,"aria-label":`${o} \xb7 ${a.label}`,className:"flex h-full items-center rounded-full pl-2 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)("span",{ref:w,className:"flex shrink-0 items-center",children:(0,t.jsx)(eR,{state:a.key})}),(0,t.jsx)(eq,{open:!k,children:(0,t.jsx)("span",{className:"font-semibold",children:o})}),e&&(0,t.jsx)(eq,{open:!k,children:"work"===e.tone?(0,t.jsx)(c.ShinyText,{text:e.words}):(0,t.jsx)("span",{className:"you"===e.tone?"text-waiting":"text-muted-foreground",children:e.words})})]})]},e?.tone??"none")]})}let eF={report:"Report",question:"Asks you",answer:"Answer"};function eL({words:e,state:a,bot:r,top:s,x:o,width:i,below:l,size:c,onPick:u}){let f=(0,n.useRef)(null),[p,h]=(0,n.useState)(0),x=`${a.label} ${e?.kind??""} ${e?.text??""}`;(0,n.useLayoutEffect)(()=>{let e=f.current?.offsetHeight??0;h(t=>t===e?t:e)},[x]);let m=e?.kind==="report",y=m||p>0&&s-p<8,g=e?.kind==="question";return(0,t.jsxs)("div",{ref:f,"data-reads":!0,style:m?{left:Math.min(Math.max(-300+.35*c,12-o),i-12-300-o),top:l+10,width:300}:{left:Math.min(Math.max(-150,12-o),i-12-300-o),width:300,...y?{top:-26}:{bottom:0}},className:(0,J.cn)("pointer-events-auto absolute flex cursor-auto select-text flex-col rounded-2xl bg-background shadow-lg",y?"animate-office-card-down":"animate-office-card-up",g?"ring-[1.5px] ring-waiting":"ring-1 ring-border"),children:[(0,t.jsxs)("button",{type:"button",onClick:u,"aria-expanded":!0,"aria-label":`${r} \xb7 ${a.label}`,className:"flex h-8 shrink-0 items-center gap-1.5 rounded-t-2xl px-3 text-left text-[12px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(eR,{state:a.key}),(0,t.jsx)("span",{className:"font-semibold",children:r}),(0,t.jsx)("span",{className:g?"text-waiting":"text-muted-foreground",children:e?eF[e.kind]:a.label})]}),e&&(0,t.jsx)("div",{className:"max-h-56 overflow-y-auto overscroll-contain px-3 pb-4 [mask-image:linear-gradient(to_bottom,#000_calc(100%-14px),transparent)]",children:(0,t.jsx)(d.Markdown,{className:"min-w-0 text-[12.5px] leading-relaxed wrap-anywhere break-keep [&_h1]:text-[14px] [&_h2]:text-[13.5px] [&_h3]:text-[13px] [&_li]:my-0.5 [&_table]:text-[11.5px] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:e.text})})]})}function eq({open:e,children:n}){return(0,t.jsx)("span",{className:(0,J.cn)("flex overflow-hidden transition-[max-width,opacity] duration-200 ease-out motion-reduce:transition-none",e?"max-w-80 opacity-100":"max-w-0 opacity-0 group-hover/plate:max-w-80 group-hover/plate:opacity-100 group-has-[:focus-visible]/plate:max-w-80 group-has-[:focus-visible]/plate:opacity-100"),children:(0,t.jsx)("span",{"data-unfold":!0,className:"flex shrink-0 items-center pl-1.5",children:n})})}function eR({state:e}){switch(e){case"run":return(0,t.jsx)("span",{className:"size-1.75 shrink-0 animate-pulse rounded-full bg-foreground motion-reduce:animate-none"});case"asking":return(0,t.jsx)("span",{className:"size-1.75 shrink-0 rounded-full bg-waiting"});case"paused":return(0,t.jsxs)("span",{className:"flex h-2 shrink-0 gap-0.5","aria-hidden":!0,children:[(0,t.jsx)("span",{className:"w-0.5 rounded-full bg-waiting"}),(0,t.jsx)("span",{className:"w-0.5 rounded-full bg-waiting"})]});case"ended":return(0,t.jsx)("span",{className:"size-1.5 shrink-0 rounded-full border-[1.5px] border-muted-foreground"});case"held":return(0,t.jsx)("svg",{width:8,height:11,viewBox:"0 0 12 14","aria-hidden":!0,className:"shrink-0",children:(0,t.jsx)("path",{d:"M1.5 1h9M1.5 13h9M2.5 1c0 3.5 3.5 4.5 3.5 6S2.5 9.5 2.5 13M9.5 1c0 3.5-3.5 4.5-3.5 6s3.5 2.5 3.5 6",style:{fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}})});case"done":return(0,t.jsx)("svg",{width:10,height:8,viewBox:"0 0 11 9","aria-hidden":!0,className:"office-check shrink-0",children:(0,t.jsx)("path",{d:"M1 4.5l3 3L10 1.5",style:{fill:"none",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round",strokeLinejoin:"round"}})});case"stopped":return(0,t.jsx)("span",{className:"size-1.75 shrink-0 rounded-xs bg-muted-foreground"});case"none":return(0,t.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-muted-foreground"})}}let eT={work:"run",you:"asking",paused:"paused",stopped:"stopped",done:"done"};function eI({scene:e,sign:n,onAnswer:a}){let r,{called:s,back:o}={called:(r=e.office.bots.filter(t=>t!==e.office.coord&&"none"!==M(e,t).key)).length,back:r.filter(t=>"done"===M(e,t).key).length},i=e.office.bots.find(t=>"asking"===M(e,t).key),l={work:s?`At work \xb7 ${o} of ${s} back`:"At work",you:`Your turn — ${i??"a bot"} asks`,paused:"Paused — waiting on Continue",stopped:"Stopped",done:"Done"}[n],d="you"===n||"paused"===n,c=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:(0,J.cn)("flex w-3 justify-center",!d&&"text-muted-foreground"),children:(0,t.jsx)(eR,{state:eT[n]})}),l]});return d&&a?(0,t.jsx)("button",{type:"button",onClick:a,className:"pointer-events-auto flex items-center gap-1.5 text-[15px] text-waiting underline-offset-4 outline-none hover:underline focus-visible:underline",children:c}):(0,t.jsx)("span",{className:(0,J.cn)("flex items-center gap-1.5 text-[15px]",d?"text-waiting":"stopped"===n?"text-muted-foreground":"text-foreground/70"),children:c})}function e_({seconds:e,tall:a}){let r,s,o,i=Math.min(359999,Math.max(0,Math.floor(e))),l=Math.floor(i/3600),d=[...l?[l]:[],Math.floor(i/60)%(l?60:100),i%60],c=Math.max(3,Math.round(a/10));return(0,t.jsx)("div",{role:"img","aria-label":`Running for ${(r=Math.max(0,Math.floor(e)),s=e=>String(e).padStart(2,"0"),(o=Math.floor(r/3600))?`${o}:${s(Math.floor(r/60)%60)}:${s(r%60)}`:`${Math.floor(r/60)}:${s(r%60)}`)}`,className:"flex items-center",style:{gap:a/8},children:d.map((e,r)=>(0,t.jsxs)(n.Fragment,{children:[r>0&&(0,t.jsxs)("span",{className:"flex flex-col",style:{gap:a/3.2},children:[(0,t.jsx)("span",{className:"rounded-[1px] bg-current",style:{width:c,height:c}}),(0,t.jsx)("span",{className:"rounded-[1px] bg-current",style:{width:c,height:c}})]}),(r>0||e>=10)&&(0,t.jsx)(ed,{value:Math.floor(e/10),tall:a,lit:"currentColor",unlit:ea(4)}),(0,t.jsx)(ed,{value:e%10,tall:a,lit:"currentColor",unlit:ea(4)})]},ec[r]))})}function eW({bot:e,icon:a,size:r}){let s=(0,n.useMemo)(()=>(0,f.markStill)(e,a??null),[e,a]),o=(0,n.useId)(),i=s.paint?`url(#${o})`:s.ink;return(0,t.jsxs)("svg",{width:r,height:r,viewBox:"0 0 240 240","aria-hidden":!0,className:"shrink-0",children:[s.paint&&(0,t.jsx)("defs",{children:(0,t.jsx)("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:s.paint.map((e,n,a)=>(0,t.jsx)("stop",{offset:n/Math.max(1,a.length-1),style:{stopColor:e}},`${e}-${n/Math.max(1,a.length-1)}`))})}),(0,t.jsx)("path",{d:s.head,style:s.outline?{fill:"none",stroke:i,strokeWidth:14}:{fill:i}}),s.eyes.map(e=>(0,t.jsx)("path",{d:e,style:{fill:s.outline?i:"var(--background)"}},e))]})}function eE({stage:e,scene:a,sign:r,start:s,label:o,faces:i}){let l=function(e,t){let[a,r]=(0,n.useState)(()=>Date.now());return(0,n.useEffect)(()=>{if(null!==t)return;let e=window.setInterval(()=>r(Date.now()),1e3);return()=>window.clearInterval(e)},[t]),t??(a-e)/1e3}(s,a.ended),d=a.office.bots.map((e,t)=>({bot:e,order:t,steps:a.office.steps.get(e)??0})).sort((e,t)=>t.steps-e.steps||e.order-t.order).slice(0,8);return(0,t.jsxs)("div",{className:"office-fade pointer-events-none absolute top-0 left-0 origin-top-left",style:{width:e.board.w,height:e.board.h,transform:e.board.matrix,animationDelay:`${e.popAt}ms`},children:[(0,t.jsxs)("div",{className:"absolute inset-x-0 top-0 flex h-85 border-2 border-foreground/30 bg-background/70 text-foreground/40",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col justify-between px-9 pt-7 pb-8",children:[(0,t.jsxs)("div",{"aria-hidden":!0,className:"flex items-baseline justify-between gap-6 font-semibold text-[26px] uppercase tracking-[0.18em]",children:[(0,t.jsx)("span",{className:"truncate",children:o}),(0,t.jsx)("span",{className:"shrink-0",children:ef[r]})]}),(0,t.jsx)("div",{className:"text-foreground/85",children:(0,t.jsx)(e_,{seconds:l,tall:170})})]}),(0,t.jsxs)("div",{"aria-hidden":!0,className:"flex w-105 shrink-0 flex-col gap-1 border-foreground/30 border-l-2 px-7 pt-6",children:[(0,t.jsxs)("span",{className:"mb-1 flex justify-between font-mono text-[19px] uppercase tracking-[0.2em]",children:[(0,t.jsx)("span",{children:"Crew"}),(0,t.jsx)("span",{children:"Steps"})]}),d.map(({bot:e,steps:n},r)=>(0,t.jsxs)("div",{className:"flex h-7 items-center gap-3 text-[22px]",children:[(0,t.jsx)("span",{className:"w-5 font-mono text-[18px]",children:r+1}),(0,t.jsx)(eW,{bot:e,icon:i.find(t=>t.name===e)?.icon,size:24}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground/65",children:e}),(0,t.jsx)("span",{className:"flex w-3 justify-center",children:(0,t.jsx)(eR,{state:M(a,e).key})}),(0,t.jsx)("span",{className:"w-10 text-right font-mono text-foreground/65 tabular-nums",children:n})]},e))]})]}),(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute top-85 left-24 h-40 w-0.5 bg-foreground/30"}),(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute top-85 right-24 h-40 w-0.5 bg-foreground/30"})]})}function eB({thread:e,onBot:a,onAnswer:r,camera:s}){let o=(0,x.toDate)(e.createdAt).getTime(),i=(0,n.useMemo)(()=>(function(e){let t=(0,x.toDate)(e.createdAt).getTime(),n=e=>e.at?Math.max(0,((0,x.toDate)(e.at).getTime()-t)/1e3):0,a=e.bot.name,r=e.lines,s=e.room.exchanges,o=new Map(s.map(e=>[e.id,e])),i=[a,...e.room.participants.map(e=>e.bot),...s.map(e=>e.bot)],l=e=>i.find(t=>t.toLowerCase()===e.toLowerCase())??e,d=new Set(r.filter(e=>"tool"===e.kind||"ask"===e.kind).map(y.messageOf)),c=e=>("say"===e.kind||"result"===e.kind)&&!d.has((0,y.messageOf)(e)),u=e=>"user"!==e.kind&&"note"!==e.kind&&"stop"!==e.kind,f=new Map,h=new Map,k=new Map;for(let[e,t]of r.entries())t.parent&&(u(t)&&h.set(t.parent,e),u(t)&&!k.has(t.parent)&&k.set(t.parent,e),c(t)&&f.set(t.parent,(0,y.messageOf)(t)));let v=[{id:"job",kind:"job",order:-1,from:"you",to:a,text:e.request,at:0,after:[],extra:!1,exchange:"",closed:null}],w=[a],j=e=>{e&&e!==m.ROOM_THURSDAY&&!w.includes(e)&&w.push(e)},M=new Set,$=null,N=e=>{let t={after:[],extra:!1,exchange:"",...e,closed:null};return v.push(t),$=null,t},z=(e,t,n,r)=>{let s={id:e.id,order:t,at:n};if("tool"===e.kind){if(e.tool?.name===p.TOOL_NAMES.send_message){let t=e.meant?l(e.meant.name):"";N({...s,kind:"refused",from:r,to:t===m.ROOM_THURSDAY?"you":t,text:(e.tool?.results??[]).flatMap(e=>"text"===e.type?[e.text]:[]).join(" ").trim()})}return}if("ask"===e.kind){let t=l(e.to?.name??"");if(t===m.ROOM_THURSDAY){let t=e.questionId??"";o.get(t)?.state==="done"&&M.add(r),N({...s,kind:"question",from:r,to:"you",text:e.text,exchange:t});return}j(t);let n=e.exchange?o.get(e.exchange):void 0;N({...s,kind:"give",from:r,to:t,text:e.text,after:n&&g(n)?n.waitsFor:[],extra:!n,exchange:n?.id??""});return}if("user"===e.kind)return void N({...s,kind:M.delete(r)?"answer":"tell",from:"you",to:r,text:e.text});if("say"!==e.kind&&"result"!==e.kind||!c(e))return;let i=(0,y.messageOf)(e),d=$;if(d?.message===i){d.event.text=`${d.event.text}
2
+
3
+ ${e.text}`;return}if(r===a){"result"===e.kind&&($={message:i,event:N({...s,kind:"report",from:r,to:"you",text:e.text})});return}let u=e.parent?o.get(e.parent):void 0;if(u?.state==="done"&&f.get(u.id)===i){$={message:i,event:N({...s,kind:"return",from:r,to:l(u.caller),text:e.text,exchange:u.id})};return}};for(let[e,t]of r.entries()){let r=n(t),s=l(t.bot.name);j(s),z(t,e,r,s);let i=t.parent?o.get(t.parent):void 0;i?.state!=="done"||s===a||h.get(i.id)!==e||f.has(i.id)||N({id:`silent:${t.id}`,kind:"return",order:e,from:s,to:l(i.caller),text:"This turn ended without a message.",at:r,exchange:i.id})}let S=e=>e<0?null:n(r[e]),A=e=>r.findLastIndex(t=>l(t.bot.name)===e&&u(t));for(let e of s)j(e.bot);return{coord:a,bots:w,events:v,seats:new Map(w.map(t=>[t,(t=>{let n=s.filter(e=>e.bot===t),o=e.room.questions.filter(e=>l(e.bot)===t);if(o.length)return{key:"asking",waits:["you"],since:S(r.findIndex(e=>e.questionId===o[0].id))};if(n.some(e=>"running"===e.state||"queued"===e.state))return{key:"run",waits:[],since:null};let i=n.filter(e=>"paused"===e.state);if(i.length)return{key:"paused",waits:["you"],since:S(r.findLastIndex(e=>"stop"===e.kind&&i.some(t=>t.id===e.parent)))};let d=n.find(b);if(d)return{key:"held",waits:d.waitsFor,since:S(r.findIndex(e=>"ask"===e.kind&&e.exchange===d.id))};if(n.some(e=>"waiting"===e.state)){let e=s.filter(e=>{let n;return l(e.caller)===t&&e.bot!==m.ROOM_THURSDAY&&"done"!==(n=e.state)&&"cancelled"!==n});return{key:"ended",waits:w.filter(t=>e.some(e=>e.bot===t)),since:S(A(t))}}let c=n.at(-1);return c?"cancelled"===c.state?{key:"stopped",waits:[],since:null}:t===a&&"done"!==e.status?"cancelled"===e.status?{key:"stopped",waits:[],since:null}:{key:"ended",waits:[],since:S(A(t))}:{key:"done",waits:[],since:S(A(t))}:{key:"none",waits:[],since:null}})(t)])),owed:new Map(s.filter(g).map(e=>[e.id,e.waitsFor])),states:new Map(s.map(e=>[e.id,e.state])),starts:k,asking:new Set(e.room.questions.map(e=>e.id)),span:r.reduce((e,t)=>Math.max(e,n(t)),0),steps:r.reduce((e,t)=>{if("tool"!==t.kind&&"ask"!==t.kind)return e;let n=l(t.bot.name);return e.set(n,(e.get(n)??0)+1),e},new Map),status:e.status,seen:e.seen}})(e),[e]),l=function(e,t){let[a,r]=(0,n.useState)(()=>({office:e,memory:k(null,e,(Date.now()-t)/1e3)}));if(a.office===e)return a.memory;let s={office:e,memory:k(a.memory,e,(Date.now()-t)/1e3)};return r(s),s.memory}(i,o),d=(0,n.useMemo)(()=>(function(e,t){let n=e.events.map(n=>{let a=t.read.get(n.id)??n.at,r=t.owed.get(n.exchange);return"give"===n.kind&&!n.extra&&r?{...n,at:a,after:r.waits}:"question"===n.kind?{...n,at:a,closed:t.asked.get(n.exchange)??(e.asking.has(n.exchange)?null:a)}:{...n,at:a}});for(let[a,r]of t.owed){if(null===r.out)continue;let t=n.find(e=>"give"===e.kind&&e.exchange===a);t&&n.push({...t,id:`release:${a}`,kind:"release",order:(e.starts.get(a)??1/0)-.5,at:Math.max(r.out,t.at)})}for(let[e,a]of t.reports)null!==a.gone&&n.push({...a.event,at:t.read.get(e)??a.event.at,closed:a.gone});n.sort((e,t)=>e.at-t.at||e.order-t.order);let a=new Map([...e.seats].map(([e,n])=>[e,{...n,since:t.seats.get(e)?.since??n.since}]));return{office:e,events:n,seats:a,ended:t.ended,opened:t.opened,fresh:t.fresh}})(i,l),[i,l]);return(0,t.jsx)(V.FileViewer,{children:(0,t.jsx)(er,{scene:d,start:o,label:e.label,faces:e.roster,from:e.id,onBot:a,onAnswer:r,camera:s,className:"min-h-0 min-w-0 flex-1"})})}e.s(["OfficeBackdrop",0,function({thread:e,leaving:a=!1,onBot:r,onAnswer:s,camera:o,className:i}){let[l,d]=(0,n.useState)(null),[c,u]=(0,n.useState)(e);return c.id!==e.id?(d(c),u(e)):c!==e&&u(e),(0,n.useEffect)(()=>{if(!l)return;let e=window.setTimeout(()=>d(null),440);return()=>window.clearTimeout(e)},[l]),(0,t.jsx)("div",{inert:a,className:(0,J.cn)("flex animate-in fade-in duration-300",i,a&&"pointer-events-none opacity-0 transition-opacity duration-250 ease-in"),children:(0,t.jsx)("div",{className:"relative flex min-h-0 min-w-0 flex-1",children:(l?[l,e]:[e]).map(e=>e===l?(0,t.jsx)("div",{inert:!0,className:"pointer-events-none absolute inset-0 flex animate-office-sink",children:(0,t.jsx)(eB,{thread:e,camera:o})},e.id):(0,t.jsx)("div",{className:(0,J.cn)("flex min-h-0 min-w-0 flex-1",l&&"animate-office-rise"),children:(0,t.jsx)(eB,{thread:e,onBot:r,onAnswer:s,camera:o})},e.id))})})}],532965)},590714,function(e){e.n(e.i(532965))}]);
@@ -1,2 +1,2 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),a=e.i(225913);e.i(271645);var r=e.i(647163);function s({className:e,...a}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,r.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...a})}e.i(652225);let i=(0,a.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:a="vertical",...s}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":a,className:(0,r.cn)(i({orientation:a}),e),...s})},"FieldContent",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,r.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...a})},"FieldLabel",0,function({className:e,...a}){return(0,t.jsx)(s,{"data-slot":"field-label",className:(0,r.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...a})}],986530)},556133,e=>{"use strict";var t=e.i(843476),a=e.i(401851),r=e.i(689664),s=e.i(867927),i=e.i(456420);let n={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};n.node;let l=(0,i.default)(n);var o=e.i(77071),d=e.i(759659),c=e.i(263676),u=e.i(271645),m=e.i(798120),h=e.i(167881),f=e.i(986530),x=e.i(23750),p=e.i(917162),g=e.i(671428),v=e.i(127341),b=e.i(184762),j=e.i(41533),y=e.i(968978),k=e.i(265402),N=e.i(670097),S=e.i(640262),w=e.i(96892);let C={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};C.node;let M=(0,i.default)(C);var z=e.i(716327),T=e.i(632781),F=e.i(935829),A=e.i(660302),R=e.i(146538),L=e.i(213377),O=e.i(647163);let E=new S.DefaultChatTransport({api:m.queryKey.memoryEdit});function I({notes:e}){let[a,r]=(0,u.useState)(""),[s,i]=(0,u.useState)({provider:null,model:""}),[n,l]=(0,u.useState)(!1),{messages:o,sendMessage:d,setMessages:c,status:m,stop:f,error:x,clearError:p}=(0,N.useChat)({transport:E}),g=(0,u.useRef)(f);g.current=f,(0,u.useEffect)(()=>()=>{g.current()},[]);let v=(0,u.useRef)(new Map);for(let t of e)for(let e of t.facts)v.current.set(e.id,{text:e.text,path:t.path});let b="submitted"===m||"streaming"===m,j=!!(s.provider&&s.model.trim()),k=[...o].reverse().find(e=>"assistant"===e.role),C=k?.parts??[],M=C.filter(S.isToolUIPart),T=C.flatMap(e=>"text"===e.type?[e.text]:[]).join(" ").trim(),F=!!x||M.some(e=>"output-error"===e.state),$=M.filter(e=>"output-available"===e.state&&(0,S.getToolName)(e)!==L.TOOL_NAMES.memory_recall).length;(0,u.useEffect)(()=>{if("ready"!==m||F||0===o.length)return;let e=setTimeout(()=>c([]),4e3);return()=>clearTimeout(e)},[m,F,o.length,c]);let B=b?(0,t.jsx)(A.ShinyText,{text:"Working on memory",className:"text-xs"}):x?(0,t.jsx)("span",{className:"text-xs text-destructive",children:x.message}):k?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:T||(0===$?"Nothing to change":1===$?"1 change saved":`${$} changes saved`)}):null;return(0,t.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-18 z-10 flex justify-center px-8",children:(0,t.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-120 flex-col items-center gap-2",children:[n&&(0,t.jsx)("div",{className:"w-full rounded-xl bg-popover p-2 shadow-lg ring-1 ring-foreground/10",children:(0,t.jsx)(R.ModelPicker,{provider:s.provider,model:s.model,unset:"Provider",onChange:i})}),M.length>0&&(0,t.jsx)("ul",{className:"w-full divide-y divide-border/60 overflow-hidden rounded-xl bg-popover shadow-lg ring-1 ring-foreground/10",children:M.map(e=>(0,t.jsx)(P,{name:(0,S.getToolName)(e),input:e.input,state:e.state,errorText:"output-error"===e.state?e.errorText:void 0,known:v.current},e.toolCallId))}),B&&(0,t.jsx)("p",{className:"max-w-full truncate px-1",children:B}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=a.trim();t&&j&&!b&&(r(""),l(!1),p(),c([]),d({text:t},{body:{model:s}}))},className:"flex h-10 w-full items-center gap-1.5 rounded-xl bg-popover pr-1.5 pl-3.5 shadow-lg ring-1 ring-foreground/10",children:[(0,t.jsx)("input",{autoFocus:!0,value:a,onChange:e=>r(e.target.value),disabled:b,"aria-label":"Edit memory",placeholder:"Tell memory what changed",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"}),(0,t.jsxs)(h.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>l(!n),className:(0,O.cn)("max-w-44",!j&&"text-muted-foreground"),children:[j&&s.provider?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.ProviderIcon,{provider:s.provider,className:"size-3"}),(0,t.jsx)("span",{className:"truncate",children:s.model})]}):"Model",(0,t.jsx)(z.ChevronDown,{className:"text-muted-foreground"})]}),(0,t.jsx)(h.Button,{type:"submit",size:"icon-sm",loading:b,disabled:!a.trim()||!j||b,"aria-label":"Send",children:!b&&(0,t.jsx)(w.ArrowUp,{})})]})]})})}let $={Remember:o.Plus,Replace:l,Forget:F.Minus,Rename:l,Opened:M};function P({name:e,input:a,state:s,errorText:i,known:n}){let l=function(e,t,a){if(e===L.TOOL_NAMES.memory_recall)return{kind:"Opened",path:(t??{}).path??"",lines:[]};if(e===L.TOOL_NAMES.memory_describe){let e=t??{};return{kind:"Rename",path:e.path??"",lines:e.description?[{after:`“${e.description}”`}]:[]}}if(e===L.TOOL_NAMES.memory_forget){let e=((t??{}).factIds??[]).filter(e=>null!=e),r=e.map(e=>a.get(e));return{kind:"Forget",path:r.find(e=>e)?.path??"",lines:e.map((e,t)=>({before:r[t]?.text??`Fact #${e}`}))}}let r=t??{},s=r.path??"",i=(r.facts??[]).filter(e=>null!=e),n=i.map(e=>null!=e.replaces?{before:a.get(e.replaces)?.text??`Fact #${e.replaces}`,after:e.text}:{after:e.text});return e===L.TOOL_NAMES.memory_create&&r.description&&n.unshift({after:`“${r.description}”`}),{kind:i.some(e=>null!=e.replaces)?"Replace":"Remember",path:s,lines:n}}(e,a,n),o=$[l.kind],d="output-error"===s;return(0,t.jsxs)("li",{className:"flex animate-in items-start gap-2.5 px-3 py-2.5 duration-200 fade-in slide-in-from-bottom-1",children:[(0,t.jsx)(o,{className:"mt-1 size-3.5 shrink-0 text-muted-foreground"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[l.lines.map((e,a)=>(0,t.jsxs)("div",{children:[e.before&&(0,t.jsx)("p",{className:"text-[13px] leading-5 text-muted-foreground/60 line-through",children:e.before}),e.after&&(0,t.jsx)("p",{className:"text-sm leading-5 text-foreground/90",children:e.after})]},`${l.kind}-${a}`)),(0,t.jsxs)("p",{className:"pt-0.5 font-mono text-[11px] text-muted-foreground",children:[l.kind,l.path&&` \xb7 ${l.path}`]}),d&&i&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:i})]}),(0,t.jsx)("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:d?(0,t.jsx)(c.X,{className:"size-3.5 text-destructive"}):"output-available"===s?(0,t.jsx)(r.Check,{className:"size-3.5"}):(0,t.jsx)(T.Loader2,{className:"size-3.5 animate-spin"})})]})}var B=e.i(95187);let D=(0,B.createServerReference)("7fa31767ec3b5032a5871f9012317613c15f78f2b9",B.callServer,void 0,B.findSourceMapURL,"addFactsAction"),_=(0,B.createServerReference)("7f2fffcafc33e4417274b94bb6169b63543c643bf2",B.callServer,void 0,B.findSourceMapURL,"createNoteAction"),K=(0,B.createServerReference)("7f12447d33ce366e085df1066e96f0518d58e9b13b",B.callServer,void 0,B.findSourceMapURL,"deleteNoteAction"),U=(0,B.createServerReference)("7f69b88d52223f6e7eebcc3fb4e2e26bfd6821a297",B.callServer,void 0,B.findSourceMapURL,"forgetFactAction"),q=(0,B.createServerReference)("7f72cbe47c1f7d07eab9c5f73a84057ec03fda4dbc",B.callServer,void 0,B.findSourceMapURL,"reviseFactAction"),V=(0,B.createServerReference)("7f4fb822e09452650925f5a6f83a5cf59d64fb274a",B.callServer,void 0,B.findSourceMapURL,"updateNoteAction");var Y=e.i(681307),H=e.i(245629);let W=Y.z.enum(["user","call","bot"]);Y.z.string().trim().min(1,"A note needs a line saying what it is about").max(j.MEMORY_LIMITS.descriptionChars,`A note's line is one line: at most ${j.MEMORY_LIMITS.descriptionChars} characters`);let X=Y.z.object({id:Y.z.number(),text:Y.z.string(),source:W.nullish(),createdAt:H.DateLikeSchema});Y.z.object({id:Y.z.number(),path:Y.z.string(),description:Y.z.string(),ownedByUser:Y.z.boolean(),hits:Y.z.number(),lastReadAt:H.DateLikeSchema.nullable(),createdAt:H.DateLikeSchema,updatedAt:H.DateLikeSchema,factCount:Y.z.number(),facts:X.array()});let G=[{path:"profile",of:"The user themselves — name, age, what they do, where they live, whatever else says who they are"},{path:"preferences",of:"How they want things done, and said — read whole on every call, so a rule for a particular situation goes here too"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],Z=G.filter(e=>!e.path.endsWith("/")).map(e=>e.path),J=G.filter(e=>e.path.endsWith("/")).map(e=>e.path.slice(0,-1));RegExp(`^(?:${Z.join("|")}|(?:${J.join("|")})/.+)$`);var Q=e.i(895836),ee=e.i(319841),et=e.i(609856),ea=e.i(661504),er=e.i(283653);let es=[{key:"you",label:"You"},{key:"people",label:"People"},{key:"projects",label:"Projects"},{key:"topics",label:"Topics"},{key:"other",label:"Other"}],ei={onOk:()=>(0,er.revalidate)(m.queryKey.memory)},en=k.textModelProviderSchema.options.filter(e=>"chatgpt"!==e).slice(0,3);function el(){return(0,t.jsx)("span",{className:"mr-0.5 flex items-center",children:en.map(e=>(0,t.jsx)("span",{className:"-ml-1.5 grid size-5 place-items-center rounded-full bg-background ring-1 ring-border first:ml-0",children:(0,t.jsx)(y.ProviderIcon,{provider:e,className:"size-3"})},e))})}function eo(e,t){return a=>{(0,ee.composing)(a)||("Enter"===a.key&&(a.preventDefault(),e()),"Escape"===a.key&&(a.stopPropagation(),t()))}}function ed({note:e,open:a,onToggle:r}){var i;let n,o,c,m,f,[x,g]=(0,u.useState)(!1),[v,b]=(0,et.useServerAction)(K,ei),j=async()=>{await p.notify.confirm({title:`Forget ${e.path}?`,description:"Every fact in this note is deleted for good.",okText:"Delete",destructive:!0})&&v(e.id)},y=(0,t.jsx)("span",{className:"w-36 shrink-0 truncate text-sm font-medium",children:-1===(n=(i=e.path).indexOf("/"))?i:i.slice(n+1)});return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex h-12 items-center gap-3 pr-2 pl-4",children:x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.ChevronRight,{className:"size-3.5 shrink-0 rotate-90 text-muted-foreground"}),y,(0,t.jsx)(ec,{note:e,onDone:()=>g(!1)})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button","aria-expanded":a,onClick:r,className:(0,O.cn)("flex h-full min-w-0 flex-1 items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",(o=e.path,!Z.includes(o)&&.15>(c=(0,H.toDate)(e.lastReadAt??e.createdAt),m=Math.max(0,(Date.now()-c.getTime())/864e5),(e.hits+1)/(1+m))&&!a&&"opacity-55")),children:[(0,t.jsx)(s.ChevronRight,{className:(0,O.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",a&&"rotate-90")}),y,(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:e.description}),(0,t.jsxs)("span",{className:"w-16 shrink-0 text-right font-mono text-[11px] text-muted-foreground/70",children:[e.factCount," ",1===e.factCount?"fact":"facts"]}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground/50",title:e.lastReadAt?"Last read back":"Never read back",children:e.lastReadAt?(0,H.shortAgo)(e.lastReadAt):"—"})]}),(0,t.jsx)("span",{className:"flex w-15 shrink-0 justify-end",children:a&&(0,t.jsxs)(t.Fragment,{children:[(f=e.path,!Z.includes(f)&&(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit the note's line",onClick:()=>g(!0),children:(0,t.jsx)(l,{})})),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this note",loading:b,onClick:j,children:!b&&(0,t.jsx)(d.Trash2,{})})]})})]})}),a&&(0,t.jsxs)("div",{className:"space-y-1 border-t border-border/60 bg-muted/40 py-2.5 pr-2 pl-10",children:[(0,t.jsx)(eu,{noteId:e.id}),e.facts.map(a=>(0,t.jsx)(em,{noteId:e.id,fact:a},a.id))]})]})}function ec({note:e,onDone:a}){let[s,i]=(0,u.useState)(e.description),[n,l]=(0,et.useServerAction)(V,{onOk:()=>{a(),(0,er.revalidate)(m.queryKey.memory)}}),o=()=>{let t=s.trim();if(!t||t===e.description)return a();n(e.id,{description:t})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Input,{autoFocus:!0,value:s,onChange:e=>i(e.target.value),onKeyDown:eo(o,a),"aria-label":"The note's line",placeholder:"One line Thursday sees in her list",maxLength:j.MEMORY_LIMITS.descriptionChars,className:"h-8 min-w-0 flex-1 text-[13px]"}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:l,onClick:o,children:!l&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:a,children:(0,t.jsx)(c.X,{})})]})}function eu({noteId:e}){let[a,r]=(0,u.useState)(""),[s,i]=(0,et.useServerAction)(D,{onOk:()=>{r(""),(0,er.revalidate)(m.queryKey.memory)}}),n=()=>{let t=a.trim();t&&!i&&s(e,[t])};return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 pb-1",children:[(0,t.jsx)(x.Input,{value:a,onChange:e=>r(e.target.value),onKeyDown:eo(n,()=>r("")),"aria-label":"Add a fact",placeholder:"Add a fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsxs)(h.Button,{size:"sm",variant:"outline",loading:i,disabled:!a.trim(),onClick:n,children:[!i&&(0,t.jsx)(o.Plus,{}),"Add"]})]})}function em({noteId:e,fact:s}){let i,[n,o]=(0,u.useState)(!1),[f,g]=(0,u.useState)(s.text),[v,b]=(0,et.useServerAction)(q,{onOk:()=>{o(!1),(0,er.revalidate)(m.queryKey.memory)}}),[j,y]=(0,et.useServerAction)(U,ei),k=async()=>{await p.notify.confirm({title:"Forget this fact?",description:`"${s.text}" is deleted for good.`,okText:"Delete",destructive:!0})&&j(e,s.id)},N=()=>{let t=f.trim();if(!t||t===s.text)return o(!1);v(e,s.id,t)},S="user"===(i=s.source)?"you":"call"===i?"on a call":"bot"===i?"a bot":"";return(0,t.jsx)("div",{className:"flex min-h-10 items-center gap-1.5",children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Input,{autoFocus:!0,value:f,onChange:e=>g(e.target.value),onKeyDown:eo(N,()=>o(!1)),"aria-label":"Fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:b,onClick:N,children:!b&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>o(!1),children:(0,t.jsx)(c.X,{})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 pl-1 text-sm leading-relaxed text-foreground/90",children:s.text}),(0,t.jsxs)("span",{className:"shrink-0 pr-1 font-mono text-[11px] text-muted-foreground/50",children:[(0,a.format)(s.createdAt,"yyyy.MM.dd"),S&&` \xb7 ${S}`]}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit this fact",onClick:()=>{g(s.text),o(!0)},children:(0,t.jsx)(l,{})}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this fact",loading:y,onClick:()=>void k(),children:!y&&(0,t.jsx)(d.Trash2,{})})]})})}let eh=[{key:"people",label:"Person",placeholder:"jihoon",fact:"Moved to the platform team in March"},{key:"projects",label:"Project",placeholder:"thursday",fact:"Ships behind a feature flag until April"},{key:"topics",label:"Topic",placeholder:"scheduling",fact:"No meetings before 10am"}];function ef(){return p.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(ex,{onDone:e})})}function ex({onDone:e}){let[a,r]=(0,u.useState)("people"),[s,i]=(0,u.useState)(""),[n,l]=(0,u.useState)(""),[d,c]=(0,u.useState)(""),[p,g,,y]=(0,et.useServerAction)(_,{errorMessage:!1,onOk:()=>{(0,er.revalidate)(m.queryKey.memory),e()}}),k=eh.find(e=>e.key===a),N=s.trim()&&n.trim()&&!g,S=()=>{N&&p(`${a}/${s.trim()}`,n.trim(),d.split("\n").map(e=>e.trim()).filter(Boolean))};return(0,t.jsxs)(Q.SettingDialogContent,{title:"New note",description:"Where Thursday keeps what she learns about this.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(h.Button,{disabled:!N,loading:g,onClick:S,children:[!g&&(0,t.jsx)(o.Plus,{}),"Create"]})]}),children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{children:"Kind"}),(0,t.jsx)(v.Tabs,{value:a,onValueChange:e=>r(e),children:(0,t.jsx)(v.TabsList,{className:"w-full",children:eh.map(e=>(0,t.jsx)(v.TabsTrigger,{value:e.key,children:e.label},e.key))})})]}),(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{htmlFor:"note-name",children:"Name"}),(0,t.jsxs)(f.FieldContent,{children:[(0,t.jsx)(x.Input,{id:"note-name",value:s,onChange:e=>i(e.target.value),placeholder:k?.placeholder,spellCheck:!1,required:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[a,"/",s.trim()||"…"]})]})]}),(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{htmlFor:"note-summary",children:"Summary"}),(0,t.jsx)(f.FieldContent,{children:(0,t.jsx)(x.Input,{id:"note-summary",value:n,onChange:e=>l(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||229===e.keyCode||"Enter"===e.key&&S()},placeholder:"One line Thursday sees in her list",maxLength:j.MEMORY_LIMITS.descriptionChars,required:!0})})]}),(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{htmlFor:"note-facts",children:"Facts"}),(0,t.jsx)(b.Textarea,{id:"note-facts",value:d,onChange:e=>c(e.target.value),placeholder:`One per line
2
- ${k?.fact??""}`,className:"min-h-24 resize-none text-sm"})]})]}),y&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:y})]})}e.s(["MemorySetting",0,function(){let{items:e,isLoading:a,isLoadingMore:r,error:s,hasMore:i,sentinelRef:n}=(0,ea.useServerPages)({key:e=>m.queryKey.memoryPage(e*j.PAGE_SIZE)}),[l,d]=(0,u.useState)(""),[c,f]=(0,u.useState)(new Set),[x,p]=(0,u.useState)(!1);if(a)return(0,t.jsx)(Q.SettingSkeleton,{});if(s)return(0,t.jsx)(Q.SettingError,{message:s.message});let v=l.trim().toLowerCase(),b=v?e.filter(e=>[e.path,e.description,...e.facts.map(e=>e.text)].some(e=>e.toLowerCase().includes(v))):e,y=e.reduce((e,t)=>e+t.factCount,0),k=i?"+":"";return(0,t.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,t.jsxs)(Q.SettingScreen,{footer:(0,t.jsxs)(h.Button,{size:"sm",variant:x?"secondary":"ghost","aria-pressed":x,onClick:()=>p(!x),children:[(0,t.jsx)(el,{}),"Edit with a model"]}),children:[(0,t.jsx)(Q.SettingToolbar,{count:(0,t.jsxs)("span",{className:"flex items-center gap-3",children:[`${e.length}${k} notes \xb7 ${y}${k} facts`,(0,t.jsxs)(h.Button,{size:"sm",variant:"outline",className:"font-sans",onClick:ef,children:[(0,t.jsx)(o.Plus,{}),"New note"]})]}),children:(0,t.jsx)(Q.SettingFilter,{value:l,onChange:d,placeholder:"Filter memory"})}),v&&0===b.length&&(0,t.jsx)("p",{className:"px-1 text-xs text-muted-foreground/60",children:"Nothing matches"}),es.map(({key:e,label:a})=>{let r=b.filter(t=>(function(e){if(Z.includes(e))return"you";let t=e.slice(0,e.indexOf("/"));return J.includes(t)?t:"other"})(t.path)===e);return 0===r.length?null:(0,t.jsx)(Q.SettingGroup,{label:a,children:(0,t.jsx)(Q.SettingItems,{children:r.map(e=>(0,t.jsx)(ed,{note:e,open:c.has(e.id)!==!!v,onToggle:()=>{let t;return t=e.id,f(e=>{let a=new Set(e);return a.delete(t)||a.add(t),a})}},e.id))})},e)}),(0,t.jsx)(Q.SettingMore,{hasMore:i,loading:r,sentinelRef:n,ghost:(0,t.jsxs)("div",{className:"flex h-12 items-center gap-3 px-4",children:[(0,t.jsx)(g.Skeleton,{className:"h-3 w-24"}),(0,t.jsx)(g.Skeleton,{className:"h-3 w-56"})]})})]}),x&&(0,t.jsx)(I,{notes:e})]})}],556133)},935829,e=>{"use strict";var t=e.i(456420);let a={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};a.node;let r=(0,t.default)(a);e.s(["Minus",0,r],935829)},759659,e=>{"use strict";var t=e.i(456420);let a={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};a.node;let r=(0,t.default)(a);e.s(["Trash2",0,r],759659)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),a=e.i(225913);e.i(271645);var r=e.i(647163);function s({className:e,...a}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,r.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...a})}e.i(652225);let i=(0,a.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:a="vertical",...s}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":a,className:(0,r.cn)(i({orientation:a}),e),...s})},"FieldContent",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,r.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...a})},"FieldLabel",0,function({className:e,...a}){return(0,t.jsx)(s,{"data-slot":"field-label",className:(0,r.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...a})}],986530)},556133,e=>{"use strict";var t=e.i(843476),a=e.i(401851),r=e.i(689664),s=e.i(867927),i=e.i(456420);let n={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};n.node;let l=(0,i.default)(n);var o=e.i(77071),d=e.i(759659),c=e.i(263676),u=e.i(271645),m=e.i(798120),h=e.i(167881),f=e.i(986530),x=e.i(23750),p=e.i(917162),g=e.i(671428),v=e.i(127341),j=e.i(184762),b=e.i(41533),y=e.i(968978),k=e.i(265402),N=e.i(670097),S=e.i(640262),w=e.i(96892);let C={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};C.node;let M=(0,i.default)(C);var z=e.i(716327),T=e.i(632781),F=e.i(935829),A=e.i(660302),R=e.i(146538),L=e.i(213377),O=e.i(647163);let E=new S.DefaultChatTransport({api:m.queryKey.memoryEdit});function I({notes:e}){let[a,r]=(0,u.useState)(""),[s,i]=(0,u.useState)({provider:null,model:""}),[n,l]=(0,u.useState)(!1),{messages:o,sendMessage:d,setMessages:c,status:m,stop:f,error:x,clearError:p}=(0,N.useChat)({transport:E}),g=(0,u.useRef)(f);g.current=f,(0,u.useEffect)(()=>()=>{g.current()},[]);let v=(0,u.useRef)(new Map);for(let t of e)for(let e of t.facts)v.current.set(e.id,{text:e.text,path:t.path});let j="submitted"===m||"streaming"===m,b=!!(s.provider&&s.model.trim()),k=[...o].reverse().find(e=>"assistant"===e.role),C=k?.parts??[],M=C.filter(S.isToolUIPart),T=C.flatMap(e=>"text"===e.type?[e.text]:[]).join(" ").trim(),F=!!x||M.some(e=>"output-error"===e.state),$=M.filter(e=>"output-available"===e.state&&(0,S.getToolName)(e)!==L.TOOL_NAMES.memory_recall).length;(0,u.useEffect)(()=>{if("ready"!==m||F||0===o.length)return;let e=setTimeout(()=>c([]),4e3);return()=>clearTimeout(e)},[m,F,o.length,c]);let B=j?(0,t.jsx)(A.ShinyText,{text:"Working on memory",className:"text-xs"}):x?(0,t.jsx)("span",{className:"text-xs text-destructive",children:x.message}):k?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:T||(0===$?"Nothing to change":1===$?"1 change saved":`${$} changes saved`)}):null;return(0,t.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-18 z-10 flex justify-center px-8",children:(0,t.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-120 flex-col items-center gap-2",children:[n&&(0,t.jsx)("div",{className:"w-full rounded-xl bg-popover p-2 shadow-lg ring-1 ring-foreground/10",children:(0,t.jsx)(R.ModelPicker,{provider:s.provider,model:s.model,unset:"Provider",onChange:i})}),M.length>0&&(0,t.jsx)("ul",{className:"w-full divide-y divide-border/60 overflow-hidden rounded-xl bg-popover shadow-lg ring-1 ring-foreground/10",children:M.map(e=>(0,t.jsx)(P,{name:(0,S.getToolName)(e),input:e.input,state:e.state,errorText:"output-error"===e.state?e.errorText:void 0,known:v.current},e.toolCallId))}),B&&(0,t.jsx)("p",{className:"max-w-full truncate px-1",children:B}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=a.trim();t&&b&&!j&&(r(""),l(!1),p(),c([]),d({text:t},{body:{model:s}}))},className:"flex h-10 w-full items-center gap-1.5 rounded-xl bg-popover pr-1.5 pl-3.5 shadow-lg ring-1 ring-foreground/10",children:[(0,t.jsx)("input",{autoFocus:!0,value:a,onChange:e=>r(e.target.value),disabled:j,"aria-label":"Edit memory",placeholder:"Tell memory what changed",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"}),(0,t.jsxs)(h.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>l(!n),className:(0,O.cn)("max-w-44",!b&&"text-muted-foreground"),children:[b&&s.provider?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.ProviderIcon,{provider:s.provider,className:"size-3"}),(0,t.jsx)("span",{className:"truncate",children:s.model})]}):"Model",(0,t.jsx)(z.ChevronDown,{className:"text-muted-foreground"})]}),(0,t.jsx)(h.Button,{type:"submit",size:"icon-sm",loading:j,disabled:!a.trim()||!b||j,"aria-label":"Send",children:!j&&(0,t.jsx)(w.ArrowUp,{})})]})]})})}let $={Remember:o.Plus,Replace:l,Forget:F.Minus,Rename:l,Opened:M};function P({name:e,input:a,state:s,errorText:i,known:n}){let l=function(e,t,a){if(e===L.TOOL_NAMES.memory_recall)return{kind:"Opened",path:(t??{}).path??"",lines:[]};if(e===L.TOOL_NAMES.memory_describe){let e=t??{};return{kind:"Rename",path:e.path??"",lines:e.description?[{after:`“${e.description}”`}]:[]}}if(e===L.TOOL_NAMES.memory_forget){let e=((t??{}).factIds??[]).filter(e=>null!=e),r=e.map(e=>a.get(e));return{kind:"Forget",path:r.find(e=>e)?.path??"",lines:e.map((e,t)=>({before:r[t]?.text??`Fact #${e}`}))}}let r=t??{},s=r.path??"",i=(r.facts??[]).filter(e=>null!=e),n=i.map(e=>null!=e.replaces?{before:a.get(e.replaces)?.text??`Fact #${e.replaces}`,after:e.text}:{after:e.text});return e===L.TOOL_NAMES.memory_create&&r.description&&n.unshift({after:`“${r.description}”`}),{kind:i.some(e=>null!=e.replaces)?"Replace":"Remember",path:s,lines:n}}(e,a,n),o=$[l.kind],d="output-error"===s;return(0,t.jsxs)("li",{className:"flex animate-in items-start gap-2.5 px-3 py-2.5 duration-200 fade-in slide-in-from-bottom-1",children:[(0,t.jsx)(o,{className:"mt-1 size-3.5 shrink-0 text-muted-foreground"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[l.lines.map((e,a)=>(0,t.jsxs)("div",{children:[e.before&&(0,t.jsx)("p",{className:"text-[13px] leading-5 text-muted-foreground/60 line-through",children:e.before}),e.after&&(0,t.jsx)("p",{className:"text-sm leading-5 text-foreground/90",children:e.after})]},`${l.kind}-${a}`)),(0,t.jsxs)("p",{className:"pt-0.5 font-mono text-[11px] text-muted-foreground",children:[l.kind,l.path&&` \xb7 ${l.path}`]}),d&&i&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:i})]}),(0,t.jsx)("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:d?(0,t.jsx)(c.X,{className:"size-3.5 text-destructive"}):"output-available"===s?(0,t.jsx)(r.Check,{className:"size-3.5"}):(0,t.jsx)(T.Loader2,{className:"size-3.5 animate-spin"})})]})}var B=e.i(95187);let D=(0,B.createServerReference)("7fcf909fcf5af2de91eae75c75c0f38ca9ff34e3e3",B.callServer,void 0,B.findSourceMapURL,"addFactsAction"),_=(0,B.createServerReference)("7f0a295827ec1569b624a8863cd246a6545c8593f8",B.callServer,void 0,B.findSourceMapURL,"createNoteAction"),K=(0,B.createServerReference)("7f96184cf8069c538e9aed7c8e00d5ae6c9e93795f",B.callServer,void 0,B.findSourceMapURL,"deleteNoteAction"),U=(0,B.createServerReference)("7f570013ae20856ff764d373b38a616cc1428320e1",B.callServer,void 0,B.findSourceMapURL,"forgetFactAction"),q=(0,B.createServerReference)("7fe0b902eb61b22b066afff78f75cab1479581cddf",B.callServer,void 0,B.findSourceMapURL,"reviseFactAction"),V=(0,B.createServerReference)("7f92365c542ce02c7ba00f1c707bc3c49377d9ae6d",B.callServer,void 0,B.findSourceMapURL,"updateNoteAction");var Y=e.i(681307),H=e.i(245629);let W=Y.z.enum(["user","call","bot"]);Y.z.string().trim().min(1,"A note needs a line saying what it is about").max(b.MEMORY_LIMITS.descriptionChars,`A note's line is one line: at most ${b.MEMORY_LIMITS.descriptionChars} characters`);let X=Y.z.object({id:Y.z.number(),text:Y.z.string(),source:W.nullish(),createdAt:H.DateLikeSchema});Y.z.object({id:Y.z.number(),path:Y.z.string(),description:Y.z.string(),ownedByUser:Y.z.boolean(),hits:Y.z.number(),lastReadAt:H.DateLikeSchema.nullable(),createdAt:H.DateLikeSchema,updatedAt:H.DateLikeSchema,factCount:Y.z.number(),facts:X.array()});let G=[{path:"profile",of:"The user themselves — name, age, what they do, where they live, whatever else says who they are"},{path:"preferences",of:"How they want things done, and said — read whole on every call, so a rule for a particular situation goes here too"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],Z=G.filter(e=>!e.path.endsWith("/")).map(e=>e.path),J=G.filter(e=>e.path.endsWith("/")).map(e=>e.path.slice(0,-1));RegExp(`^(?:${Z.join("|")}|(?:${J.join("|")})/.+)$`);var Q=e.i(895836),ee=e.i(319841),et=e.i(609856),ea=e.i(661504),er=e.i(283653);let es=[{key:"you",label:"You"},{key:"people",label:"People"},{key:"projects",label:"Projects"},{key:"topics",label:"Topics"},{key:"other",label:"Other"}],ei={onOk:()=>(0,er.revalidate)(m.queryKey.memory)},en=k.textModelProviderSchema.options.filter(e=>"chatgpt"!==e).slice(0,3);function el(){return(0,t.jsx)("span",{className:"mr-0.5 flex items-center",children:en.map(e=>(0,t.jsx)("span",{className:"-ml-1.5 grid size-5 place-items-center rounded-full bg-background ring-1 ring-border first:ml-0",children:(0,t.jsx)(y.ProviderIcon,{provider:e,className:"size-3"})},e))})}function eo(e,t){return a=>{(0,ee.composing)(a)||("Enter"===a.key&&(a.preventDefault(),e()),"Escape"===a.key&&(a.stopPropagation(),t()))}}function ed({note:e,open:a,onToggle:r}){var i;let n,o,c,m,f,[x,g]=(0,u.useState)(!1),[v,j]=(0,et.useServerAction)(K,ei),b=async()=>{await p.notify.confirm({title:`Forget ${e.path}?`,description:"Every fact in this note is deleted for good.",okText:"Delete",destructive:!0})&&v(e.id)},y=(0,t.jsx)("span",{className:"w-36 shrink-0 truncate text-sm font-medium",children:-1===(n=(i=e.path).indexOf("/"))?i:i.slice(n+1)});return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex h-12 items-center gap-3 pr-2 pl-4",children:x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.ChevronRight,{className:"size-3.5 shrink-0 rotate-90 text-muted-foreground"}),y,(0,t.jsx)(ec,{note:e,onDone:()=>g(!1)})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button","aria-expanded":a,onClick:r,className:(0,O.cn)("flex h-full min-w-0 flex-1 items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",(o=e.path,!Z.includes(o)&&.15>(c=(0,H.toDate)(e.lastReadAt??e.createdAt),m=Math.max(0,(Date.now()-c.getTime())/864e5),(e.hits+1)/(1+m))&&!a&&"opacity-55")),children:[(0,t.jsx)(s.ChevronRight,{className:(0,O.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",a&&"rotate-90")}),y,(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:e.description}),(0,t.jsxs)("span",{className:"w-16 shrink-0 text-right font-mono text-[11px] text-muted-foreground/70",children:[e.factCount," ",1===e.factCount?"fact":"facts"]}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground/50",title:e.lastReadAt?"Last read back":"Never read back",children:e.lastReadAt?(0,H.shortAgo)(e.lastReadAt):"—"})]}),(0,t.jsx)("span",{className:"flex w-15 shrink-0 justify-end",children:a&&(0,t.jsxs)(t.Fragment,{children:[(f=e.path,!Z.includes(f)&&(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit the note's line",onClick:()=>g(!0),children:(0,t.jsx)(l,{})})),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this note",loading:j,onClick:b,children:!j&&(0,t.jsx)(d.Trash2,{})})]})})]})}),a&&(0,t.jsxs)("div",{className:"space-y-1 border-t border-border/60 bg-muted/40 py-2.5 pr-2 pl-10",children:[(0,t.jsx)(eu,{noteId:e.id}),e.facts.map(a=>(0,t.jsx)(em,{noteId:e.id,fact:a},a.id))]})]})}function ec({note:e,onDone:a}){let[s,i]=(0,u.useState)(e.description),[n,l]=(0,et.useServerAction)(V,{onOk:()=>{a(),(0,er.revalidate)(m.queryKey.memory)}}),o=()=>{let t=s.trim();if(!t||t===e.description)return a();n(e.id,{description:t})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Input,{autoFocus:!0,value:s,onChange:e=>i(e.target.value),onKeyDown:eo(o,a),"aria-label":"The note's line",placeholder:"One line Thursday sees in her list",maxLength:b.MEMORY_LIMITS.descriptionChars,className:"h-8 min-w-0 flex-1 text-[13px]"}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:l,onClick:o,children:!l&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:a,children:(0,t.jsx)(c.X,{})})]})}function eu({noteId:e}){let[a,r]=(0,u.useState)(""),[s,i]=(0,et.useServerAction)(D,{onOk:()=>{r(""),(0,er.revalidate)(m.queryKey.memory)}}),n=()=>{let t=a.trim();t&&!i&&s(e,[t])};return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 pb-1",children:[(0,t.jsx)(x.Input,{value:a,onChange:e=>r(e.target.value),onKeyDown:eo(n,()=>r("")),"aria-label":"Add a fact",placeholder:"Add a fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsxs)(h.Button,{size:"sm",variant:"outline",loading:i,disabled:!a.trim(),onClick:n,children:[!i&&(0,t.jsx)(o.Plus,{}),"Add"]})]})}function em({noteId:e,fact:s}){let i,[n,o]=(0,u.useState)(!1),[f,g]=(0,u.useState)(s.text),[v,j]=(0,et.useServerAction)(q,{onOk:()=>{o(!1),(0,er.revalidate)(m.queryKey.memory)}}),[b,y]=(0,et.useServerAction)(U,ei),k=async()=>{await p.notify.confirm({title:"Forget this fact?",description:`"${s.text}" is deleted for good.`,okText:"Delete",destructive:!0})&&b(e,s.id)},N=()=>{let t=f.trim();if(!t||t===s.text)return o(!1);v(e,s.id,t)},S="user"===(i=s.source)?"you":"call"===i?"on a call":"bot"===i?"a bot":"";return(0,t.jsx)("div",{className:"flex min-h-10 items-center gap-1.5",children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Input,{autoFocus:!0,value:f,onChange:e=>g(e.target.value),onKeyDown:eo(N,()=>o(!1)),"aria-label":"Fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:j,onClick:N,children:!j&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>o(!1),children:(0,t.jsx)(c.X,{})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 pl-1 text-sm leading-relaxed text-foreground/90",children:s.text}),(0,t.jsxs)("span",{className:"shrink-0 pr-1 font-mono text-[11px] text-muted-foreground/50",children:[(0,a.format)(s.createdAt,"yyyy.MM.dd"),S&&` \xb7 ${S}`]}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit this fact",onClick:()=>{g(s.text),o(!0)},children:(0,t.jsx)(l,{})}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this fact",loading:y,onClick:()=>void k(),children:!y&&(0,t.jsx)(d.Trash2,{})})]})})}let eh=[{key:"people",label:"Person",placeholder:"jihoon",fact:"Moved to the platform team in March"},{key:"projects",label:"Project",placeholder:"thursday",fact:"Ships behind a feature flag until April"},{key:"topics",label:"Topic",placeholder:"scheduling",fact:"No meetings before 10am"}];function ef(){return p.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(ex,{onDone:e})})}function ex({onDone:e}){let[a,r]=(0,u.useState)("people"),[s,i]=(0,u.useState)(""),[n,l]=(0,u.useState)(""),[d,c]=(0,u.useState)(""),[p,g,,y]=(0,et.useServerAction)(_,{errorMessage:!1,onOk:()=>{(0,er.revalidate)(m.queryKey.memory),e()}}),k=eh.find(e=>e.key===a),N=s.trim()&&n.trim()&&!g,S=()=>{N&&p(`${a}/${s.trim()}`,n.trim(),d.split("\n").map(e=>e.trim()).filter(Boolean))};return(0,t.jsxs)(Q.SettingDialogContent,{title:"New note",description:"Where Thursday keeps what she learns about this.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(h.Button,{disabled:!N,loading:g,onClick:S,children:[!g&&(0,t.jsx)(o.Plus,{}),"Create"]})]}),children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{children:"Kind"}),(0,t.jsx)(v.Tabs,{value:a,onValueChange:e=>r(e),children:(0,t.jsx)(v.TabsList,{className:"w-full",children:eh.map(e=>(0,t.jsx)(v.TabsTrigger,{value:e.key,children:e.label},e.key))})})]}),(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{htmlFor:"note-name",children:"Name"}),(0,t.jsxs)(f.FieldContent,{children:[(0,t.jsx)(x.Input,{id:"note-name",value:s,onChange:e=>i(e.target.value),placeholder:k?.placeholder,spellCheck:!1,required:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[a,"/",s.trim()||"…"]})]})]}),(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{htmlFor:"note-summary",children:"Summary"}),(0,t.jsx)(f.FieldContent,{children:(0,t.jsx)(x.Input,{id:"note-summary",value:n,onChange:e=>l(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||229===e.keyCode||"Enter"===e.key&&S()},placeholder:"One line Thursday sees in her list",maxLength:b.MEMORY_LIMITS.descriptionChars,required:!0})})]}),(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{htmlFor:"note-facts",children:"Facts"}),(0,t.jsx)(j.Textarea,{id:"note-facts",value:d,onChange:e=>c(e.target.value),placeholder:`One per line
2
+ ${k?.fact??""}`,className:"min-h-24 resize-none text-sm"})]})]}),y&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:y})]})}e.s(["MemorySetting",0,function(){let{items:e,isLoading:a,isLoadingMore:r,error:s,hasMore:i,sentinelRef:n}=(0,ea.useServerPages)({key:e=>m.queryKey.memoryPage(e*b.PAGE_SIZE)}),[l,d]=(0,u.useState)(""),[c,f]=(0,u.useState)(new Set),[x,p]=(0,u.useState)(!1);if(a)return(0,t.jsx)(Q.SettingSkeleton,{});if(s)return(0,t.jsx)(Q.SettingError,{message:s.message});let v=l.trim().toLowerCase(),j=v?e.filter(e=>[e.path,e.description,...e.facts.map(e=>e.text)].some(e=>e.toLowerCase().includes(v))):e,y=e.reduce((e,t)=>e+t.factCount,0),k=i?"+":"";return(0,t.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,t.jsxs)(Q.SettingScreen,{footer:(0,t.jsxs)(h.Button,{size:"sm",variant:x?"secondary":"ghost","aria-pressed":x,onClick:()=>p(!x),children:[(0,t.jsx)(el,{}),"Edit with a model"]}),children:[(0,t.jsx)(Q.SettingToolbar,{count:(0,t.jsxs)("span",{className:"flex items-center gap-3",children:[`${e.length}${k} notes \xb7 ${y}${k} facts`,(0,t.jsxs)(h.Button,{size:"sm",variant:"outline",className:"font-sans",onClick:ef,children:[(0,t.jsx)(o.Plus,{}),"New note"]})]}),children:(0,t.jsx)(Q.SettingFilter,{value:l,onChange:d,placeholder:"Filter memory"})}),v&&0===j.length&&(0,t.jsx)("p",{className:"px-1 text-xs text-muted-foreground/60",children:"Nothing matches"}),es.map(({key:e,label:a})=>{let r=j.filter(t=>(function(e){if(Z.includes(e))return"you";let t=e.slice(0,e.indexOf("/"));return J.includes(t)?t:"other"})(t.path)===e);return 0===r.length?null:(0,t.jsx)(Q.SettingGroup,{label:a,children:(0,t.jsx)(Q.SettingItems,{children:r.map(e=>(0,t.jsx)(ed,{note:e,open:c.has(e.id)!==!!v,onToggle:()=>{let t;return t=e.id,f(e=>{let a=new Set(e);return a.delete(t)||a.add(t),a})}},e.id))})},e)}),(0,t.jsx)(Q.SettingMore,{hasMore:i,loading:r,sentinelRef:n,ghost:(0,t.jsxs)("div",{className:"flex h-12 items-center gap-3 px-4",children:[(0,t.jsx)(g.Skeleton,{className:"h-3 w-24"}),(0,t.jsx)(g.Skeleton,{className:"h-3 w-56"})]})})]}),x&&(0,t.jsx)(I,{notes:e})]})}],556133)},935829,e=>{"use strict";var t=e.i(456420);let a={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};a.node;let r=(0,t.default)(a);e.s(["Minus",0,r],935829)},759659,e=>{"use strict";var t=e.i(456420);let a={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};a.node;let r=(0,t.default)(a);e.s(["Trash2",0,r],759659)}]);
@@ -36,4 +36,4 @@
36
36
 
37
37
  **Ground every claim.** Competitors, prices, search terms and what people say about the problem come from pages you opened, with the link beside them. What you could not check is marked as a guess.
38
38
 
39
- **What you keep.** How they write and sign off, who they write to and how, one brief per product — dated, so the next job starts from it.`}];e.s(["BOT_SEEDS",0,i,"ERRANDS_BOT",0,r,"findBotSeed",0,e=>i.find(t=>t.name===e)??null])},734979,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f4d1b83a856be03b184db5399983948fd7fba94a6",t.callServer,void 0,t.findSourceMapURL,"createSeedBotsAction");e.s(["createSeedBotsAction",0,n])}]);
39
+ **What you keep.** How they write and sign off, who they write to and how, one brief per product — dated, so the next job starts from it.`}];e.s(["BOT_SEEDS",0,i,"ERRANDS_BOT",0,r,"findBotSeed",0,e=>i.find(t=>t.name===e)??null])},79530,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f01b715d839f9d34714539856fb7473b8d1a7d7b8",t.callServer,void 0,t.findSourceMapURL,"createSeedBotsAction");e.s(["createSeedBotsAction",0,n])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),s=e.i(225913);e.i(271645);var i=e.i(647163);function n({className:e,...s}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,i.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...s})}e.i(652225);let l=(0,s.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:s="vertical",...n}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":s,className:(0,i.cn)(l({orientation:s}),e),...n})},"FieldContent",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,i.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...s})},"FieldLabel",0,function({className:e,...s}){return(0,t.jsx)(n,{"data-slot":"field-label",className:(0,i.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...s})}],986530)},833959,e=>{"use strict";var t=e.i(843476),s=e.i(437750),i=e.i(856539),n=e.i(24071),l=e.i(867927),r=e.i(829600),a=e.i(226091),o=e.i(726067),d=e.i(456420);let c={name:"frame",size:24,node:[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]};c.node;let u=(0,d.default)(c);var m=e.i(91511),x=e.i(77071),f=e.i(566595);let h={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]};h.node;let p=(0,d.default)(h);var g=e.i(759659);let v={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};v.node;let b=(0,d.default)(v);var k=e.i(271645),j=e.i(798120),y=e.i(167881),w=e.i(986530),N=e.i(23750),S=e.i(683408),z=e.i(917162),C=e.i(671428),L=e.i(319036),F=e.i(127341),M=e.i(184762),R=e.i(41533),T=e.i(895836),$=e.i(95187);let D=(0,$.createServerReference)("7fa1262db695c5ebbfd00215bef94a4cc6da2edf11",$.callServer,void 0,$.findSourceMapURL,"createSkillAction"),A=(0,$.createServerReference)("7fec00f822f5f2035683bb2e8714245e10e86f98c7",$.callServer,void 0,$.findSourceMapURL,"deleteSkillAction"),B=(0,$.createServerReference)("7f92e6309284e6827dbb0afd1b0993128e3994cf54",$.callServer,void 0,$.findSourceMapURL,"setSkillDisabledAction"),q=(0,$.createServerReference)("7f8257a569f9b2adeaafeb7f08994d8470df52826c",$.callServer,void 0,$.findSourceMapURL,"uploadSkillAction"),I=(0,$.createServerReference)("7f5fd8c8fd0bd9de5680bde0acf705143b434d483a",$.callServer,void 0,$.findSourceMapURL,"writeSkillFileAction");var K=e.i(681307);K.z.union([K.z.enum(["custom","default"]),K.z.templateLiteral(["kit:",K.z.string().regex(/^[\p{L}\p{N}_-]+$/u)]),K.z.templateLiteral(["own:",K.z.string().regex(/^[\p{L}\p{N}_-]+$/u)])]);let E=e=>"custom"===e||e.startsWith("own:"),U=K.z.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long").regex(/^[a-z0-9][a-z0-9_-]*$/i,"Use letters, numbers, dashes and underscores only"),O=K.z.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long");K.z.object({name:O,description:K.z.string().trim().min(1,"Description is required"),metadata:K.z.record(K.z.string(),K.z.unknown()).optional(),disabled:K.z.boolean().optional(),platforms:K.z.array(K.z.string()).optional()}).extend({name:U,content:K.z.string().trim().min(1,"Content is required")});var P=e.i(609856),W=e.i(283653),_=e.i(647163);let H={artifact:u,browser:m.Globe,computer:s.AppWindow,"find-skills":f.Search,"skill-creator":p};function V({skill:e}){let[s,n]=(0,P.useServerAction)(A,{onOk:()=>(0,W.revalidate)(j.queryKey.skills)}),[r]=(0,P.useServerAction)(B,{onOk:()=>(0,W.revalidate)(j.queryKey.skills)}),a=async()=>{await z.notify.confirm({title:`Delete ${e.name}?`,description:"Every file in this skill is deleted for good.",okText:"Delete",destructive:!0})&&s(e.source,e.dir)},o="default"===e.source&&H[e.dir]||i.BookMarked;return(0,t.jsxs)("div",{className:"group flex items-center transition-colors hover:bg-muted/50",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{var s;return s=e,z.notify.component({className:"sm:max-w-4xl",renderer:({guard:e})=>(0,t.jsx)(G,{skill:s,guard:e})})},className:"flex min-w-0 flex-1 items-center gap-3 py-4 pl-4 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:(0,_.cn)("grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",e.disabled&&"opacity-45"),children:(0,t.jsx)(o,{className:"size-4"})}),(0,t.jsxs)("span",{className:(0,_.cn)("min-w-0 flex-1 space-y-0.5",e.disabled&&"opacity-45"),children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.name}),(0,t.jsx)("span",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:e.description.trim().split(/(?<=[.。])\s|\n/)[0].trim()})]}),(0,t.jsx)(l.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 group-hover:text-foreground"})]}),(0,t.jsxs)("div",{className:"mr-4 ml-5 flex w-18 shrink-0 items-center justify-end gap-3",children:[(0,t.jsx)(L.Switch,{checked:!e.disabled,onCheckedChange:t=>r(e.source,e.dir,!t),"aria-label":`${e.name} on or off`,className:"shrink-0"}),E(e.source)?(0,t.jsx)(y.Button,{size:"icon-sm",variant:"ghost",loading:n,onClick:a,"aria-label":`Delete ${e.name}`,className:"shrink-0 text-muted-foreground",children:(0,t.jsx)(g.Trash2,{})}):(0,t.jsx)("span",{className:"size-7 shrink-0"})]})]})}function G({skill:e,guard:s}){let[i,l]=(0,k.useState)(""),[r,a]=(0,k.useState)("SKILL.md"),o=(0,k.useRef)(!1);(0,k.useEffect)(()=>s(()=>o.current),[s]);let d=async e=>{let t=i?`${i}/${e.name}`:e.name;"dir"===e.kind?l(t):t===r||(!o.current||await z.notify.confirm({title:"Discard your changes?",description:`What you wrote in ${r?.split("/").pop()} is not saved.`,okText:"Discard",destructive:!0}))&&(o.current=!1,a(t))};return(0,t.jsx)(T.SettingDialogContent,{title:e.name,description:(0,t.jsx)(Y,{skill:e,path:r??i}),children:(0,t.jsxs)("div",{className:"flex h-[36rem] divide-x divide-border/60 overflow-hidden rounded-xl border border-border/60 bg-background",children:[(0,t.jsxs)("div",{className:"flex w-44 shrink-0 flex-col overflow-y-auto bg-muted/20 py-1",children:[i&&(0,t.jsxs)("button",{type:"button",onClick:()=>l(i.split("/").slice(0,-1).join("/")),className:"mx-1 mb-1 flex items-center gap-1 rounded-md px-2 py-1 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/50 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)(n.ChevronLeft,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:i.split("/").pop()})]}),(0,t.jsx)(J,{source:e.source,dir:e.dir,path:i,current:r,onPick:d})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r?(0,t.jsx)(X,{source:e.source,dir:e.dir,path:r,editable:E(e.source),onUnsaved:e=>{o.current=e}},r):(0,t.jsx)("p",{className:"p-6 text-sm text-muted-foreground/60",children:"Pick a file"})})]})})}function Y({skill:e,path:s}){if(!e)return(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground/60",children:"Pick a skill"});let i=[e.name,...s.split("/").filter(Boolean)];return(0,t.jsx)("span",{className:"flex min-w-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:i.map((e,s)=>(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[s>0&&(0,t.jsx)(l.ChevronRight,{className:"size-3 shrink-0 opacity-50"}),(0,t.jsx)("span",{className:(0,_.cn)("truncate",s===i.length-1&&"text-foreground"),children:e})]},`${s}-${e}`))})}function Z({icon:e,label:s,active:i,hasChildren:n,onClick:r}){return(0,t.jsxs)("button",{type:"button",onClick:r,className:(0,_.cn)("mx-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",i?T.PICKED_ROW:"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70 [&>svg]:size-3",children:e}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),n&&(0,t.jsx)(l.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function J({source:e,dir:s,path:i,current:n,onPick:l}){let{data:d,isLoading:c,error:u}=(0,W.useServerRoute)(j.queryKey.skillNode(e,s,i));return u?(0,t.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:u.message}):c||!d?(0,t.jsxs)("div",{className:"space-y-2 p-2",children:[(0,t.jsx)(C.Skeleton,{className:"h-5 w-full"}),(0,t.jsx)(C.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==d.kind?null:(0,t.jsxs)(t.Fragment,{children:[d.entries.map(e=>(0,t.jsx)(Z,{icon:"dir"===e.kind?(0,t.jsx)(o.Folder,{}):e.name.endsWith(".md")?(0,t.jsx)(a.FileText,{}):(0,t.jsx)(r.File,{}),label:e.name,hasChildren:"dir"===e.kind,active:(i?`${i}/${e.name}`:e.name)===n,onClick:()=>l(e)},e.name)),0===d.entries.length&&(0,t.jsx)("p",{className:"p-3 text-xs text-muted-foreground/60",children:"Empty folder"})]})}function Q({content:e,description:s}){let i=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(e),n=s?.trim(),l=i?e.slice(i[0].length):e;return(0,t.jsxs)("div",{className:"min-w-0",children:[n&&(0,t.jsx)("p",{className:"border-b border-border/60 px-5 py-3 text-[13px] leading-relaxed text-muted-foreground",children:n}),(0,t.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,t.jsx)(S.Markdown,{children:l})})]})}function X({source:e,dir:s,path:i,editable:n,onUnsaved:l}){let[r,a]=(0,k.useState)(null),{data:o,isLoading:d,error:c}=(0,W.useServerRoute)(j.queryKey.skillNode(e,s,i)),u=null!==r&&(o?.kind!=="file"||r!==o.content);(0,k.useEffect)(()=>l?.(u),[u,l]);let[m,x]=(0,P.useServerAction)(I,{okMessage:"Saved",onOk:()=>{a(null),(0,W.revalidate)(j.queryKey.skills)}});if(c)return(0,t.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:c.message});if(d||!o)return(0,t.jsxs)("div",{className:"space-y-3 p-5",children:[(0,t.jsx)(C.Skeleton,{className:"h-5 w-2/3"}),(0,t.jsx)(C.Skeleton,{className:"h-4 w-full"}),(0,t.jsx)(C.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==o.kind)return null;let f=i.split("/").pop()??"";return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"sticky top-0 z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/90 px-5 py-2 font-mono text-[11px] text-muted-foreground backdrop-blur",children:[(0,t.jsx)("span",{className:"truncate",children:f}),(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,t.jsx)("span",{children:(0,_.formatBytes)(o.size)}),n&&null!==o.content&&null===r&&(0,t.jsxs)(y.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(o.content??""),children:[(0,t.jsx)(p,{}),"Edit"]}),null!==r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(null),children:"Cancel"}),(0,t.jsx)(y.Button,{size:"xs",className:"font-mono",loading:x,disabled:r===o.content,onClick:()=>m(e,s,i,r),children:"Save"})]})]})]}),null!==r?(0,t.jsx)(M.Textarea,{value:r,onChange:e=>a(e.target.value),spellCheck:!1,"aria-label":`${f} contents`,className:"min-h-120 resize-none rounded-none border-0 font-mono text-[13px] leading-relaxed shadow-none focus-visible:ring-0"}):null===o.content?(0,t.jsx)("p",{className:"px-5 py-4 text-sm text-muted-foreground/60",children:o.size>R.SKILL_FILES.inlineBytes?"Too long to show here — a bot still reads it from disk.":"Not a text file — a bot can still read it from disk."}):f.toLowerCase().endsWith(".md")?(0,t.jsx)(Q,{content:o.content,description:o.description}):(0,t.jsx)("pre",{className:"overflow-x-auto px-5 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-foreground/90",children:o.content})]})}function ee(){return z.notify.component({className:"sm:max-w-lg",renderer:({close:e,guard:s})=>(0,t.jsx)(et,{onDone:e,guard:s})})}function et({onDone:e,guard:s}){let[i,n]=(0,k.useState)("write"),[l,r]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),[d,c]=(0,k.useState)(""),[u,m]=(0,k.useState)(null),[f,h]=(0,k.useState)(!1),p=(0,k.useRef)(null),g=(0,k.useRef)(!1);g.current=!!(l.trim()||a.trim()||d.trim()||u),(0,k.useEffect)(()=>s(()=>g.current),[s]);let v={errorMessage:!1,onOk:()=>{(0,W.revalidate)(j.queryKey.skills),e()}},[S,z,,C]=(0,P.useServerAction)(D,v),[L,$,,A]=(0,P.useServerAction)(q,v),B=z||$,I="write"===i?C:A,K=null!==u&&u.size>R.SKILL_FILES.uploadBytes,E=Math.round(R.SKILL_FILES.uploadBytes/1024/1024),U=!B&&("write"===i?l.trim()&&a.trim()&&d.trim():null!==u&&!K),O=async()=>{if(!U)return;if("write"===i)return void S({name:l.trim(),description:a.trim(),content:d});if(!u)return;let e=new FormData;e.append("file",u),L(e)},H=e=>{let t=e?.[0]??null;t&&m(t)};return(0,t.jsxs)(T.SettingDialogContent,{title:"New skill",description:"Instructions a bot reads when a job calls for them.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(y.Button,{disabled:!U,loading:B,onClick:O,children:[!B&&("write"===i?(0,t.jsx)(x.Plus,{}):(0,t.jsx)(b,{})),"write"===i?"Create":"Upload"]})]}),children:[(0,t.jsxs)(F.Tabs,{value:i,onValueChange:e=>n(e),children:[(0,t.jsxs)(F.TabsList,{className:"w-full",children:[(0,t.jsx)(F.TabsTrigger,{value:"write",children:"Write"}),(0,t.jsx)(F.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,t.jsxs)(F.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,t.jsxs)(w.FieldContent,{children:[(0,t.jsx)(N.Input,{id:"skill-name",value:l,onChange:e=>r(e.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[R.PATHS.skills.custom,"/",l.trim()||"…","/SKILL.md"]})]})]}),(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,t.jsx)(w.FieldContent,{children:(0,t.jsx)(N.Input,{id:"skill-description",value:a,onChange:e=>o(e.target.value),placeholder:"What it does, then when to use it — a bot reads this to decide"})})]}),(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-content",children:"Content"}),(0,t.jsx)(M.Textarea,{id:"skill-content",value:d,onChange:e=>c(e.target.value),placeholder:"Markdown. The steps, the rules, the examples.",className:"min-h-40 resize-none font-mono text-xs"})]})]}),(0,t.jsxs)(F.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>p.current?.click(),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:e=>{e.preventDefault(),h(!1),H(e.dataTransfer.files)},className:(0,_.cn)("flex w-full flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-10 text-center outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",f?"border-foreground/60 bg-muted/60":"border-border hover:bg-muted/40"),children:[(0,t.jsx)(b,{className:"size-5 text-muted-foreground"}),u?(0,t.jsxs)("span",{className:"text-sm",children:[u.name,(0,t.jsxs)("span",{className:(0,_.cn)("ml-2 font-mono text-[11px]",K?"text-destructive":"text-muted-foreground"),children:[(0,_.formatBytes)(u.size),K&&` \xb7 over ${E} MB`]})]}):(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"Drop a file here, or click to choose"})]}),(0,t.jsx)("input",{ref:p,type:"file",accept:".md,.zip,.skill",className:"hidden",onChange:e=>H(e.target.files)}),(0,t.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground/80",children:"File requirements"}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".md"})," file needs a YAML block with the skill's name and description."]}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".zip"})," or"," ",(0,t.jsx)("span",{className:"font-mono",children:".skill"})," archive needs a SKILL.md inside — the rest of its folder comes along."]}),(0,t.jsxs)("p",{children:["Up to ",E," MB."]})]})]})]}),I&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:I})]})}e.s(["SkillsSetting",0,function(){let[e,s]=(0,k.useState)(""),{data:i,isLoading:n,error:l}=(0,W.useServerRoute)(j.queryKey.skills),r=i??[];if(n)return(0,t.jsx)(T.SettingSkeleton,{rows:4});if(l)return(0,t.jsx)(T.SettingError,{message:l.message});let a=e.trim().toLowerCase(),o=r.filter(e=>!a||`${e.name} ${e.description}`.toLowerCase().includes(a)),d=r.filter(e=>!e.disabled).length,c=r.filter(e=>!e.disabled&&("default"===e.source||"custom"===e.source)).length,u=new Map;for(let e of o)e.bot&&u.set(e.bot,[...u.get(e.bot)??[],e]);return(0,t.jsxs)(T.SettingScreen,{footer:(0,t.jsxs)(T.SettingRailNote,{children:[r.filter(e=>!E(e.source)).length," ","shipped ·"," ",r.filter(e=>E(e.source)).length," ","installed"]}),children:[(0,t.jsx)(T.SettingToolbar,{count:`${d} on \xb7 ${r.length-d} off`,children:(0,t.jsx)(T.SettingFilter,{value:e,onChange:s,placeholder:"Filter skills"})}),(0,t.jsx)(T.SettingGroup,{label:"Custom",hint:"yours — added here · a Default skill of the same name wins",children:(0,t.jsx)(T.SettingItems,{addRow:{label:"Add skill",onClick:ee},children:o.filter(e=>"custom"===e.source).map(e=>(0,t.jsx)(V,{skill:e},`custom/${e.dir}`))})}),[...u].map(([e,s])=>(0,t.jsx)(T.SettingGroup,{label:`${e}'s own`,hint:`only ${e} reads these \xb7 what it found or wrote can be edited or deleted`,children:(0,t.jsx)(T.SettingItems,{children:s.map(e=>(0,t.jsx)(V,{skill:e},`${e.source}/${e.dir}`))})},e)),(0,t.jsx)(T.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,t.jsx)(T.SettingItems,{children:o.filter(e=>"default"===e.source).map(e=>(0,t.jsx)(V,{skill:e},`default/${e.dir}`))})}),c>R.PROMPT_CROWDED.skills&&(0,t.jsxs)(T.SettingNote,{children:[c," skills are on for every bot. Each is a line in every prompt a bot reads, and one more to look past when it picks."]})]})}],833959)},437750,e=>{"use strict";var t=e.i(456420);let s={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};s.node;let i=(0,t.default)(s);e.s(["AppWindow",0,i],437750)},726067,e=>{"use strict";var t=e.i(456420);let s={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};s.node;let i=(0,t.default)(s);e.s(["Folder",0,i],726067)},759659,e=>{"use strict";var t=e.i(456420);let s={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};s.node;let i=(0,t.default)(s);e.s(["Trash2",0,i],759659)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),s=e.i(225913);e.i(271645);var i=e.i(647163);function n({className:e,...s}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,i.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...s})}e.i(652225);let l=(0,s.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:s="vertical",...n}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":s,className:(0,i.cn)(l({orientation:s}),e),...n})},"FieldContent",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,i.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...s})},"FieldLabel",0,function({className:e,...s}){return(0,t.jsx)(n,{"data-slot":"field-label",className:(0,i.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...s})}],986530)},833959,e=>{"use strict";var t=e.i(843476),s=e.i(437750),i=e.i(856539),n=e.i(24071),l=e.i(867927),r=e.i(829600),a=e.i(226091),o=e.i(726067),d=e.i(456420);let c={name:"frame",size:24,node:[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]};c.node;let u=(0,d.default)(c);var m=e.i(91511),x=e.i(77071),f=e.i(566595);let h={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]};h.node;let p=(0,d.default)(h);var g=e.i(759659);let v={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};v.node;let b=(0,d.default)(v);var k=e.i(271645),j=e.i(798120),y=e.i(167881),w=e.i(986530),N=e.i(23750),S=e.i(683408),z=e.i(917162),C=e.i(671428),L=e.i(319036),F=e.i(127341),M=e.i(184762),R=e.i(41533),T=e.i(895836),$=e.i(95187);let D=(0,$.createServerReference)("7f4b72da340ff346a332f2daa4f7f6018b51115b4f",$.callServer,void 0,$.findSourceMapURL,"createSkillAction"),A=(0,$.createServerReference)("7fe1d92ab6a0abe0073113d82bb1ab02ed942c0c8d",$.callServer,void 0,$.findSourceMapURL,"deleteSkillAction"),B=(0,$.createServerReference)("7fcb0c20527887254a1473a7db3f16a0edeef34ab9",$.callServer,void 0,$.findSourceMapURL,"setSkillDisabledAction"),q=(0,$.createServerReference)("7f3615f73b91f43a7f547d794a8701e8556e69a612",$.callServer,void 0,$.findSourceMapURL,"uploadSkillAction"),I=(0,$.createServerReference)("7f46ad1b877190a6bd68c447f285cdad25dc315844",$.callServer,void 0,$.findSourceMapURL,"writeSkillFileAction");var K=e.i(681307);K.z.union([K.z.enum(["custom","default"]),K.z.templateLiteral(["kit:",K.z.string().regex(/^[\p{L}\p{N}_-]+$/u)]),K.z.templateLiteral(["own:",K.z.string().regex(/^[\p{L}\p{N}_-]+$/u)])]);let E=e=>"custom"===e||e.startsWith("own:"),U=K.z.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long").regex(/^[a-z0-9][a-z0-9_-]*$/i,"Use letters, numbers, dashes and underscores only"),O=K.z.string().trim().min(1,"Skill name is required").max(64,"Skill name is too long");K.z.object({name:O,description:K.z.string().trim().min(1,"Description is required"),metadata:K.z.record(K.z.string(),K.z.unknown()).optional(),disabled:K.z.boolean().optional(),platforms:K.z.array(K.z.string()).optional()}).extend({name:U,content:K.z.string().trim().min(1,"Content is required")});var P=e.i(609856),W=e.i(283653),_=e.i(647163);let H={artifact:u,browser:m.Globe,computer:s.AppWindow,"find-skills":f.Search,"skill-creator":p};function V({skill:e}){let[s,n]=(0,P.useServerAction)(A,{onOk:()=>(0,W.revalidate)(j.queryKey.skills)}),[r]=(0,P.useServerAction)(B,{onOk:()=>(0,W.revalidate)(j.queryKey.skills)}),a=async()=>{await z.notify.confirm({title:`Delete ${e.name}?`,description:"Every file in this skill is deleted for good.",okText:"Delete",destructive:!0})&&s(e.source,e.dir)},o="default"===e.source&&H[e.dir]||i.BookMarked;return(0,t.jsxs)("div",{className:"group flex items-center transition-colors hover:bg-muted/50",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{var s;return s=e,z.notify.component({className:"sm:max-w-4xl",renderer:({guard:e})=>(0,t.jsx)(G,{skill:s,guard:e})})},className:"flex min-w-0 flex-1 items-center gap-3 py-4 pl-4 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:(0,_.cn)("grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",e.disabled&&"opacity-45"),children:(0,t.jsx)(o,{className:"size-4"})}),(0,t.jsxs)("span",{className:(0,_.cn)("min-w-0 flex-1 space-y-0.5",e.disabled&&"opacity-45"),children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.name}),(0,t.jsx)("span",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:e.description.trim().split(/(?<=[.。])\s|\n/)[0].trim()})]}),(0,t.jsx)(l.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 group-hover:text-foreground"})]}),(0,t.jsxs)("div",{className:"mr-4 ml-5 flex w-18 shrink-0 items-center justify-end gap-3",children:[(0,t.jsx)(L.Switch,{checked:!e.disabled,onCheckedChange:t=>r(e.source,e.dir,!t),"aria-label":`${e.name} on or off`,className:"shrink-0"}),E(e.source)?(0,t.jsx)(y.Button,{size:"icon-sm",variant:"ghost",loading:n,onClick:a,"aria-label":`Delete ${e.name}`,className:"shrink-0 text-muted-foreground",children:(0,t.jsx)(g.Trash2,{})}):(0,t.jsx)("span",{className:"size-7 shrink-0"})]})]})}function G({skill:e,guard:s}){let[i,l]=(0,k.useState)(""),[r,a]=(0,k.useState)("SKILL.md"),o=(0,k.useRef)(!1);(0,k.useEffect)(()=>s(()=>o.current),[s]);let d=async e=>{let t=i?`${i}/${e.name}`:e.name;"dir"===e.kind?l(t):t===r||(!o.current||await z.notify.confirm({title:"Discard your changes?",description:`What you wrote in ${r?.split("/").pop()} is not saved.`,okText:"Discard",destructive:!0}))&&(o.current=!1,a(t))};return(0,t.jsx)(T.SettingDialogContent,{title:e.name,description:(0,t.jsx)(Y,{skill:e,path:r??i}),children:(0,t.jsxs)("div",{className:"flex h-[36rem] divide-x divide-border/60 overflow-hidden rounded-xl border border-border/60 bg-background",children:[(0,t.jsxs)("div",{className:"flex w-44 shrink-0 flex-col overflow-y-auto bg-muted/20 py-1",children:[i&&(0,t.jsxs)("button",{type:"button",onClick:()=>l(i.split("/").slice(0,-1).join("/")),className:"mx-1 mb-1 flex items-center gap-1 rounded-md px-2 py-1 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/50 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)(n.ChevronLeft,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:i.split("/").pop()})]}),(0,t.jsx)(J,{source:e.source,dir:e.dir,path:i,current:r,onPick:d})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r?(0,t.jsx)(X,{source:e.source,dir:e.dir,path:r,editable:E(e.source),onUnsaved:e=>{o.current=e}},r):(0,t.jsx)("p",{className:"p-6 text-sm text-muted-foreground/60",children:"Pick a file"})})]})})}function Y({skill:e,path:s}){if(!e)return(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground/60",children:"Pick a skill"});let i=[e.name,...s.split("/").filter(Boolean)];return(0,t.jsx)("span",{className:"flex min-w-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:i.map((e,s)=>(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[s>0&&(0,t.jsx)(l.ChevronRight,{className:"size-3 shrink-0 opacity-50"}),(0,t.jsx)("span",{className:(0,_.cn)("truncate",s===i.length-1&&"text-foreground"),children:e})]},`${s}-${e}`))})}function Z({icon:e,label:s,active:i,hasChildren:n,onClick:r}){return(0,t.jsxs)("button",{type:"button",onClick:r,className:(0,_.cn)("mx-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",i?T.PICKED_ROW:"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70 [&>svg]:size-3",children:e}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),n&&(0,t.jsx)(l.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function J({source:e,dir:s,path:i,current:n,onPick:l}){let{data:d,isLoading:c,error:u}=(0,W.useServerRoute)(j.queryKey.skillNode(e,s,i));return u?(0,t.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:u.message}):c||!d?(0,t.jsxs)("div",{className:"space-y-2 p-2",children:[(0,t.jsx)(C.Skeleton,{className:"h-5 w-full"}),(0,t.jsx)(C.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==d.kind?null:(0,t.jsxs)(t.Fragment,{children:[d.entries.map(e=>(0,t.jsx)(Z,{icon:"dir"===e.kind?(0,t.jsx)(o.Folder,{}):e.name.endsWith(".md")?(0,t.jsx)(a.FileText,{}):(0,t.jsx)(r.File,{}),label:e.name,hasChildren:"dir"===e.kind,active:(i?`${i}/${e.name}`:e.name)===n,onClick:()=>l(e)},e.name)),0===d.entries.length&&(0,t.jsx)("p",{className:"p-3 text-xs text-muted-foreground/60",children:"Empty folder"})]})}function Q({content:e,description:s}){let i=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(e),n=s?.trim(),l=i?e.slice(i[0].length):e;return(0,t.jsxs)("div",{className:"min-w-0",children:[n&&(0,t.jsx)("p",{className:"border-b border-border/60 px-5 py-3 text-[13px] leading-relaxed text-muted-foreground",children:n}),(0,t.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,t.jsx)(S.Markdown,{children:l})})]})}function X({source:e,dir:s,path:i,editable:n,onUnsaved:l}){let[r,a]=(0,k.useState)(null),{data:o,isLoading:d,error:c}=(0,W.useServerRoute)(j.queryKey.skillNode(e,s,i)),u=null!==r&&(o?.kind!=="file"||r!==o.content);(0,k.useEffect)(()=>l?.(u),[u,l]);let[m,x]=(0,P.useServerAction)(I,{okMessage:"Saved",onOk:()=>{a(null),(0,W.revalidate)(j.queryKey.skills)}});if(c)return(0,t.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:c.message});if(d||!o)return(0,t.jsxs)("div",{className:"space-y-3 p-5",children:[(0,t.jsx)(C.Skeleton,{className:"h-5 w-2/3"}),(0,t.jsx)(C.Skeleton,{className:"h-4 w-full"}),(0,t.jsx)(C.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==o.kind)return null;let f=i.split("/").pop()??"";return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"sticky top-0 z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/90 px-5 py-2 font-mono text-[11px] text-muted-foreground backdrop-blur",children:[(0,t.jsx)("span",{className:"truncate",children:f}),(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,t.jsx)("span",{children:(0,_.formatBytes)(o.size)}),n&&null!==o.content&&null===r&&(0,t.jsxs)(y.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(o.content??""),children:[(0,t.jsx)(p,{}),"Edit"]}),null!==r&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(null),children:"Cancel"}),(0,t.jsx)(y.Button,{size:"xs",className:"font-mono",loading:x,disabled:r===o.content,onClick:()=>m(e,s,i,r),children:"Save"})]})]})]}),null!==r?(0,t.jsx)(M.Textarea,{value:r,onChange:e=>a(e.target.value),spellCheck:!1,"aria-label":`${f} contents`,className:"min-h-120 resize-none rounded-none border-0 font-mono text-[13px] leading-relaxed shadow-none focus-visible:ring-0"}):null===o.content?(0,t.jsx)("p",{className:"px-5 py-4 text-sm text-muted-foreground/60",children:o.size>R.SKILL_FILES.inlineBytes?"Too long to show here — a bot still reads it from disk.":"Not a text file — a bot can still read it from disk."}):f.toLowerCase().endsWith(".md")?(0,t.jsx)(Q,{content:o.content,description:o.description}):(0,t.jsx)("pre",{className:"overflow-x-auto px-5 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-foreground/90",children:o.content})]})}function ee(){return z.notify.component({className:"sm:max-w-lg",renderer:({close:e,guard:s})=>(0,t.jsx)(et,{onDone:e,guard:s})})}function et({onDone:e,guard:s}){let[i,n]=(0,k.useState)("write"),[l,r]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),[d,c]=(0,k.useState)(""),[u,m]=(0,k.useState)(null),[f,h]=(0,k.useState)(!1),p=(0,k.useRef)(null),g=(0,k.useRef)(!1);g.current=!!(l.trim()||a.trim()||d.trim()||u),(0,k.useEffect)(()=>s(()=>g.current),[s]);let v={errorMessage:!1,onOk:()=>{(0,W.revalidate)(j.queryKey.skills),e()}},[S,z,,C]=(0,P.useServerAction)(D,v),[L,$,,A]=(0,P.useServerAction)(q,v),B=z||$,I="write"===i?C:A,K=null!==u&&u.size>R.SKILL_FILES.uploadBytes,E=Math.round(R.SKILL_FILES.uploadBytes/1024/1024),U=!B&&("write"===i?l.trim()&&a.trim()&&d.trim():null!==u&&!K),O=async()=>{if(!U)return;if("write"===i)return void S({name:l.trim(),description:a.trim(),content:d});if(!u)return;let e=new FormData;e.append("file",u),L(e)},H=e=>{let t=e?.[0]??null;t&&m(t)};return(0,t.jsxs)(T.SettingDialogContent,{title:"New skill",description:"Instructions a bot reads when a job calls for them.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(y.Button,{disabled:!U,loading:B,onClick:O,children:[!B&&("write"===i?(0,t.jsx)(x.Plus,{}):(0,t.jsx)(b,{})),"write"===i?"Create":"Upload"]})]}),children:[(0,t.jsxs)(F.Tabs,{value:i,onValueChange:e=>n(e),children:[(0,t.jsxs)(F.TabsList,{className:"w-full",children:[(0,t.jsx)(F.TabsTrigger,{value:"write",children:"Write"}),(0,t.jsx)(F.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,t.jsxs)(F.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,t.jsxs)(w.FieldContent,{children:[(0,t.jsx)(N.Input,{id:"skill-name",value:l,onChange:e=>r(e.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[R.PATHS.skills.custom,"/",l.trim()||"…","/SKILL.md"]})]})]}),(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,t.jsx)(w.FieldContent,{children:(0,t.jsx)(N.Input,{id:"skill-description",value:a,onChange:e=>o(e.target.value),placeholder:"What it does, then when to use it — a bot reads this to decide"})})]}),(0,t.jsxs)(w.Field,{children:[(0,t.jsx)(w.FieldLabel,{htmlFor:"skill-content",children:"Content"}),(0,t.jsx)(M.Textarea,{id:"skill-content",value:d,onChange:e=>c(e.target.value),placeholder:"Markdown. The steps, the rules, the examples.",className:"min-h-40 resize-none font-mono text-xs"})]})]}),(0,t.jsxs)(F.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>p.current?.click(),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:e=>{e.preventDefault(),h(!1),H(e.dataTransfer.files)},className:(0,_.cn)("flex w-full flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-10 text-center outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",f?"border-foreground/60 bg-muted/60":"border-border hover:bg-muted/40"),children:[(0,t.jsx)(b,{className:"size-5 text-muted-foreground"}),u?(0,t.jsxs)("span",{className:"text-sm",children:[u.name,(0,t.jsxs)("span",{className:(0,_.cn)("ml-2 font-mono text-[11px]",K?"text-destructive":"text-muted-foreground"),children:[(0,_.formatBytes)(u.size),K&&` \xb7 over ${E} MB`]})]}):(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"Drop a file here, or click to choose"})]}),(0,t.jsx)("input",{ref:p,type:"file",accept:".md,.zip,.skill",className:"hidden",onChange:e=>H(e.target.files)}),(0,t.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground/80",children:"File requirements"}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".md"})," file needs a YAML block with the skill's name and description."]}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".zip"})," or"," ",(0,t.jsx)("span",{className:"font-mono",children:".skill"})," archive needs a SKILL.md inside — the rest of its folder comes along."]}),(0,t.jsxs)("p",{children:["Up to ",E," MB."]})]})]})]}),I&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:I})]})}e.s(["SkillsSetting",0,function(){let[e,s]=(0,k.useState)(""),{data:i,isLoading:n,error:l}=(0,W.useServerRoute)(j.queryKey.skills),r=i??[];if(n)return(0,t.jsx)(T.SettingSkeleton,{rows:4});if(l)return(0,t.jsx)(T.SettingError,{message:l.message});let a=e.trim().toLowerCase(),o=r.filter(e=>!a||`${e.name} ${e.description}`.toLowerCase().includes(a)),d=r.filter(e=>!e.disabled).length,c=r.filter(e=>!e.disabled&&("default"===e.source||"custom"===e.source)).length,u=new Map;for(let e of o)e.bot&&u.set(e.bot,[...u.get(e.bot)??[],e]);return(0,t.jsxs)(T.SettingScreen,{footer:(0,t.jsxs)(T.SettingRailNote,{children:[r.filter(e=>!E(e.source)).length," ","shipped ·"," ",r.filter(e=>E(e.source)).length," ","installed"]}),children:[(0,t.jsx)(T.SettingToolbar,{count:`${d} on \xb7 ${r.length-d} off`,children:(0,t.jsx)(T.SettingFilter,{value:e,onChange:s,placeholder:"Filter skills"})}),(0,t.jsx)(T.SettingGroup,{label:"Custom",hint:"yours — added here · a Default skill of the same name wins",children:(0,t.jsx)(T.SettingItems,{addRow:{label:"Add skill",onClick:ee},children:o.filter(e=>"custom"===e.source).map(e=>(0,t.jsx)(V,{skill:e},`custom/${e.dir}`))})}),[...u].map(([e,s])=>(0,t.jsx)(T.SettingGroup,{label:`${e}'s own`,hint:`only ${e} reads these \xb7 what it found or wrote can be edited or deleted`,children:(0,t.jsx)(T.SettingItems,{children:s.map(e=>(0,t.jsx)(V,{skill:e},`${e.source}/${e.dir}`))})},e)),(0,t.jsx)(T.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,t.jsx)(T.SettingItems,{children:o.filter(e=>"default"===e.source).map(e=>(0,t.jsx)(V,{skill:e},`default/${e.dir}`))})}),c>R.PROMPT_CROWDED.skills&&(0,t.jsxs)(T.SettingNote,{children:[c," skills are on for every bot. Each is a line in every prompt a bot reads, and one more to look past when it picks."]})]})}],833959)},437750,e=>{"use strict";var t=e.i(456420);let s={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};s.node;let i=(0,t.default)(s);e.s(["AppWindow",0,i],437750)},726067,e=>{"use strict";var t=e.i(456420);let s={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};s.node;let i=(0,t.default)(s);e.s(["Folder",0,i],726067)},759659,e=>{"use strict";var t=e.i(456420);let s={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};s.node;let i=(0,t.default)(s);e.s(["Trash2",0,i],759659)}]);