thursday-agent 0.16.0 → 0.17.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 (277) 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/page.js.nft.json +1 -1
  5. package/.next/server/app/_global-error.html +1 -1
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found.html +1 -1
  12. package/.next/server/app/_not-found.rsc +1 -1
  13. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  14. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  15. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/api/artifact/route.js +9 -9
  17. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  18. package/.next/server/app/api/bot/memory/files/route.js +3 -3
  19. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  20. package/.next/server/app/api/bot/memory/route.js +8 -8
  21. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  22. package/.next/server/app/api/bot/route.js +8 -8
  23. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  24. package/.next/server/app/api/bot/thread/[id]/route.js +3 -3
  25. package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
  26. package/.next/server/app/api/bot/thread/route.js +3 -3
  27. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  28. package/.next/server/app/api/config/route.js.nft.json +1 -1
  29. package/.next/server/app/api/events/route.js.nft.json +1 -1
  30. package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
  31. package/.next/server/app/api/file/[...path]/route.js +4 -4
  32. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  33. package/.next/server/app/api/llm-model/catalog/route.js.nft.json +1 -1
  34. package/.next/server/app/api/llm-model/credits/route.js.nft.json +1 -1
  35. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  36. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  37. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  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 +11 -11
  42. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  43. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  44. package/.next/server/app/api/reach/route.js +11 -11
  45. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  46. package/.next/server/app/api/routine/route.js +7 -7
  47. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  48. package/.next/server/app/api/signins/route.js +5 -5
  49. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  50. package/.next/server/app/api/skills/[source]/[name]/route.js +7 -7
  51. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  52. package/.next/server/app/api/skills/route.js +7 -7
  53. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  54. package/.next/server/app/api/thursday/call/route.js +5 -5
  55. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  56. package/.next/server/app/api/thursday/settings/route.js +5 -5
  57. package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
  58. package/.next/server/app/api/thursday/text/route.js +13 -13
  59. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  60. package/.next/server/app/api/thursday/tool-call/route.js +12 -12
  61. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  62. package/.next/server/app/api/workspace/files/route.js +8 -8
  63. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  64. package/.next/server/app/api/workspace/route.js +9 -9
  65. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  66. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +3 -3
  67. package/.next/server/app/artifact/[...path]/page.js +4 -4
  68. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  69. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  70. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  71. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  72. package/.next/server/app/page/server-reference-manifest.json +60 -60
  73. package/.next/server/app/page.js +5 -5
  74. package/.next/server/app/page.js.nft.json +1 -1
  75. package/.next/server/app/page_client-reference-manifest.js +1 -1
  76. package/.next/server/chunks/[root-of-the-server]__00qyw01._.js +1 -1
  77. package/.next/server/chunks/[root-of-the-server]__01ypm_z._.js +3 -0
  78. package/.next/server/chunks/[root-of-the-server]__021dkui._.js +3 -0
  79. package/.next/server/chunks/{[root-of-the-server]__18e65_-._.js → [root-of-the-server]__03xamry._.js} +2 -2
  80. package/.next/server/chunks/[root-of-the-server]__05dp5tr._.js +1 -1
  81. package/.next/server/chunks/[root-of-the-server]__09gdscj._.js +7 -0
  82. package/.next/server/chunks/{[root-of-the-server]__10_7vqz._.js → [root-of-the-server]__0b36yfw._.js} +1 -1
  83. package/.next/server/chunks/{[root-of-the-server]__1gamvcz._.js → [root-of-the-server]__0jzwdg-._.js} +2 -2
  84. package/.next/server/chunks/[root-of-the-server]__0mrk2it._.js +1 -1
  85. package/.next/server/chunks/[root-of-the-server]__0nmust6._.js +5 -0
  86. package/.next/server/chunks/[root-of-the-server]__0svzjwa._.js +7 -0
  87. package/.next/server/chunks/{[root-of-the-server]__16yw3mb._.js → [root-of-the-server]__12m24xl._.js} +1 -1
  88. package/.next/server/chunks/{[root-of-the-server]__1zrwxis._.js → [root-of-the-server]__12tahb4._.js} +1 -1
  89. package/.next/server/chunks/{[root-of-the-server]__1ep-pao._.js → [root-of-the-server]__1_h4hf9._.js} +4 -4
  90. package/.next/server/chunks/{[root-of-the-server]__1-tdj60._.js → [root-of-the-server]__1de1o6m._.js} +2 -2
  91. package/.next/server/chunks/{[root-of-the-server]__1voqqyc._.js → [root-of-the-server]__1ignh6-._.js} +1 -1
  92. package/.next/server/chunks/[root-of-the-server]__1t02-1p._.js +3 -0
  93. package/.next/server/chunks/[root-of-the-server]__1ygplx1._.js +1 -1
  94. package/.next/server/chunks/{[root-of-the-server]__11g20j-._.js → [root-of-the-server]__1yl5l25._.js} +1 -1
  95. package/.next/server/chunks/{[root-of-the-server]__1mbd2w_._.js → [root-of-the-server]__208vmyf._.js} +1 -1
  96. package/.next/server/chunks/{_1mfu9a3._.js → _02lipqs._.js} +1 -1
  97. package/.next/server/chunks/_05sa7xl._.js +1 -1
  98. package/.next/server/chunks/{_1rg5bfd._.js → _074f2ts._.js} +1 -1
  99. package/.next/server/chunks/_07nxi75._.js +3 -3
  100. package/.next/server/chunks/_08btiir._.js +7 -0
  101. package/.next/server/chunks/_0caua_s._.js +1 -1
  102. package/.next/server/chunks/{_0qoush_._.js → _0gt6cbj._.js} +1 -1
  103. package/.next/server/chunks/_0xygcxs._.js +3 -3
  104. package/.next/server/chunks/{_09c4we8._.js → _17i1lt2._.js} +1 -1
  105. package/.next/server/chunks/_19kea1l._.js +9 -9
  106. package/.next/server/chunks/_1gn2r2q._.js +3 -3
  107. package/.next/server/chunks/{_03niwml._.js → _1ntwp1s._.js} +1 -1
  108. package/.next/server/chunks/_1q6e56i._.js +3 -3
  109. package/.next/server/chunks/{_02fn1o3._.js → _1tkzgtm._.js} +1 -1
  110. package/.next/server/chunks/_1wl2g8_._.js +2 -2
  111. package/.next/server/chunks/{_1w6uf9k._.js → _1y3mnz4._.js} +1 -1
  112. package/.next/server/chunks/features_workspace_workspace_ts_13h82gv._.js +4 -4
  113. package/.next/server/chunks/features_workspace_workspace_ts_1iyjroj._.js +4 -4
  114. package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0cux6zt._.js → node_modules_consola_dist_chunks_prompt_mjs_04oxl25._.js} +1 -1
  115. package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0w32bqh._.js → node_modules_consola_dist_chunks_prompt_mjs_0g87zst._.js} +1 -1
  116. package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_1clmnaj._.js → node_modules_consola_dist_chunks_prompt_mjs_1341cnf._.js} +1 -1
  117. package/.next/server/chunks/ssr/{[root-of-the-server]__02jdtqa._.js → [root-of-the-server]__07660xu._.js} +2 -2
  118. package/.next/server/chunks/ssr/{[root-of-the-server]__0rnjkw2._.js → [root-of-the-server]__149x25m._.js} +2 -2
  119. package/.next/server/chunks/ssr/[root-of-the-server]__17h1ggo._.js +1 -1
  120. package/.next/server/chunks/ssr/[root-of-the-server]__19s8qyj._.js +3 -0
  121. package/.next/server/chunks/ssr/[root-of-the-server]__1jyeu61._.js +1 -1
  122. package/.next/server/chunks/ssr/_088vzgn._.js +3 -0
  123. package/.next/server/chunks/ssr/{_0wupyvd._.js → _0_vnw9v._.js} +2 -2
  124. package/.next/server/chunks/ssr/{_1u5vsy-._.js → _0aeknva._.js} +2 -2
  125. package/.next/server/chunks/ssr/_0fo4552._.js +3 -3
  126. package/.next/server/chunks/ssr/{_0-ou1b0._.js → _0n2scfq._.js} +2 -2
  127. package/.next/server/chunks/ssr/_0o_o9ji._.js +3 -0
  128. package/.next/server/chunks/ssr/_0qne8xs._.js +3 -0
  129. package/.next/server/chunks/ssr/_0r0g9ki._.js +1 -1
  130. package/.next/server/chunks/ssr/_0v9r8g2._.js +3 -0
  131. package/.next/server/chunks/ssr/_0x8ophf._.js +1 -1
  132. package/.next/server/chunks/ssr/{_0ncuqct._.js → _0ztbn5q._.js} +2 -2
  133. package/.next/server/chunks/ssr/{_0w8r7o7._.js → _1-41lck._.js} +2 -2
  134. package/.next/server/chunks/ssr/{_10fwcz_._.js → _14dfh7a._.js} +2 -2
  135. package/.next/server/chunks/ssr/{_1f6s34p._.js → _15m5ctz._.js} +2 -2
  136. package/.next/server/chunks/ssr/{_11pnnvd._.js → _18-e7zi._.js} +2 -2
  137. package/.next/server/chunks/ssr/{_0y28gl3._.js → _1c5iqz1._.js} +3 -3
  138. package/.next/server/chunks/ssr/{_1dqaksc._.js → _1hbjh6n._.js} +2 -2
  139. package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
  140. package/.next/server/chunks/ssr/{_1k0efi3._.js → _1sttj8x._.js} +2 -2
  141. package/.next/server/chunks/ssr/_1uij_rj._.js +1 -1
  142. package/.next/server/chunks/ssr/_1umbr78._.js +1 -1
  143. package/.next/server/chunks/ssr/{_17ble8k._.js → _1vtgiou._.js} +3 -3
  144. package/.next/server/chunks/ssr/_1w9w1ok._.js +1 -1
  145. package/.next/server/chunks/ssr/{_1z586yw._.js → _1z6pirx._.js} +2 -2
  146. package/.next/server/chunks/ssr/features_0796o8r._.js +1 -1
  147. package/.next/server/chunks/ssr/features_bot_1knyan7._.js +3 -0
  148. package/.next/server/chunks/ssr/features_bot_1kr0_m-._.js +3 -0
  149. package/.next/server/chunks/ssr/{features_config_11dpa7r._.js → features_config_0n0zu89._.js} +3 -3
  150. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  151. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  152. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  153. package/.next/server/chunks/ssr/features_workspace_workspace_ts_1wc7_u_._.js +4 -4
  154. package/.next/server/chunks/ssr/{node_modules_1r5o-bo._.js → node_modules_00h1t1j._.js} +1 -1
  155. package/.next/server/chunks/ssr/{node_modules_1o9n7_n._.js → node_modules_02ficyi._.js} +1 -1
  156. package/.next/server/chunks/ssr/{node_modules_0u24mg0._.js → node_modules_03q71_j._.js} +1 -1
  157. package/.next/server/chunks/ssr/{node_modules_138kcrz._.js → node_modules_03uejh6._.js} +1 -1
  158. package/.next/server/chunks/ssr/{node_modules_0x_2io2._.js → node_modules_06grs09._.js} +1 -1
  159. package/.next/server/chunks/ssr/{node_modules_0n1js5k._.js → node_modules_07mo9rn._.js} +1 -1
  160. package/.next/server/chunks/ssr/{node_modules_0bas34k._.js → node_modules_09e8kz_._.js} +1 -1
  161. package/.next/server/chunks/ssr/{node_modules_1dzye0n._.js → node_modules_09ikzel._.js} +1 -1
  162. package/.next/server/chunks/ssr/{node_modules_18yn_bs._.js → node_modules_0_d_7gq._.js} +1 -1
  163. package/.next/server/chunks/ssr/{node_modules_0ka8te1._.js → node_modules_0_p8w7p._.js} +1 -1
  164. package/.next/server/chunks/ssr/{node_modules_0mark4f._.js → node_modules_0f5bmkb._.js} +1 -1
  165. package/.next/server/chunks/ssr/{node_modules_0sdjzae._.js → node_modules_0kwie-o._.js} +1 -1
  166. package/.next/server/chunks/ssr/{node_modules_1ozyial._.js → node_modules_0r-9e4n._.js} +1 -1
  167. package/.next/server/chunks/ssr/{node_modules_156m1qh._.js → node_modules_0u_8z64._.js} +1 -1
  168. package/.next/server/chunks/ssr/{node_modules_0-ew8f8._.js → node_modules_0zf3wuu._.js} +1 -1
  169. package/.next/server/chunks/ssr/{node_modules_1xua-g1._.js → node_modules_1-7fc7h._.js} +1 -1
  170. package/.next/server/chunks/ssr/{node_modules_0ld7p-1._.js → node_modules_142z3o5._.js} +1 -1
  171. package/.next/server/chunks/ssr/{node_modules_0-8r9yw._.js → node_modules_180l3i0._.js} +1 -1
  172. package/.next/server/chunks/ssr/{node_modules_1tj7_9z._.js → node_modules_197vh1s._.js} +1 -1
  173. package/.next/server/chunks/ssr/{node_modules_0y5uubt._.js → node_modules_1_n9o9s._.js} +1 -1
  174. package/.next/server/chunks/ssr/{node_modules_0etz1i0._.js → node_modules_1fw32pg._.js} +1 -1
  175. package/.next/server/chunks/ssr/{node_modules_0bbwe-u._.js → node_modules_1hefp6h._.js} +1 -1
  176. package/.next/server/chunks/ssr/{node_modules_097cl9f._.js → node_modules_1irot3r._.js} +1 -1
  177. package/.next/server/chunks/ssr/{node_modules_0uibk9z._.js → node_modules_1om2itc._.js} +1 -1
  178. package/.next/server/chunks/ssr/{node_modules_1zkzksd._.js → node_modules_1ubln7w._.js} +1 -1
  179. package/.next/server/chunks/ssr/{node_modules_02uwbwp._.js → node_modules_1wyhtw9._.js} +1 -1
  180. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_133hjui._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0aczkbn._.js} +1 -1
  181. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1b3vwd3._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0ah684s._.js} +1 -1
  182. package/.next/server/middleware-build-manifest.js +3 -3
  183. package/.next/server/pages/404.html +1 -1
  184. package/.next/server/pages/500.html +1 -1
  185. package/.next/server/server-reference-manifest.js +1 -1
  186. package/.next/server/server-reference-manifest.json +61 -61
  187. package/.next/static/chunks/{1ub9obhgfm4jl.js → 024plctckvq-1.js} +1 -1
  188. package/.next/static/chunks/04toe_3nqfjqt.js +1 -0
  189. package/.next/static/chunks/{0609ejkwuy4sf.js → 0_b_bi2pobasx.js} +2 -2
  190. package/.next/static/chunks/{3ro66d9dc70bc.js → 0dfvwgnyrp8qt.js} +1 -1
  191. package/.next/static/chunks/{314szf8yer-3n.js → 0f47nnshdlucs.js} +1 -1
  192. package/.next/static/chunks/0sowxe4nnl5qu.js +1 -0
  193. package/.next/static/chunks/{07vcuxousbmy1.js → 0sv142q1yrva2.js} +1 -1
  194. package/.next/static/chunks/{0q4ws7qd21chx.js → 0tp868040z9nn.js} +2 -2
  195. package/.next/static/chunks/{0unonxbajyknw.js → 1-63yde5eaz7i.js} +1 -1
  196. package/.next/static/chunks/14qitm0kwsb6g.js +15 -0
  197. package/.next/static/chunks/{2xjr5b-yk_h3o.js → 1bgvxd3xny53w.js} +1 -1
  198. package/.next/static/chunks/{245_cp14iz637.js → 1cyrrz4q871aj.js} +1 -1
  199. package/.next/static/chunks/1st3b0c9vhxg3.js +1 -0
  200. package/.next/static/chunks/{39miwvg4k-b2d.js → 1wbqaidq7vc3_.js} +1 -1
  201. package/.next/static/chunks/{0cl_fgkphk1oz.js → 28sxb_k460e9h.js} +1 -1
  202. package/.next/static/chunks/{3j-l8un0d77v7.js → 2v6e_9p95o2e3.js} +1 -1
  203. package/.next/static/chunks/{23tx-2paw9qa6.js → 3-qp777vtfglj.js} +1 -1
  204. package/.next/static/chunks/{2jbjyazqfqyoh.js → 33ekkscpcq-z1.js} +1 -1
  205. package/.next/static/chunks/388l-zszwa_jf.js +1 -0
  206. package/.next/static/chunks/{3vwjs5kq11417.js → 38edd4rpcbvzp.js} +1 -1
  207. package/.next/static/chunks/3bwrvpjk95_x4.js +1 -0
  208. package/.next/static/chunks/{42m371fn687r5.js → 3itdg6t243u6f.js} +1 -1
  209. package/.next/static/chunks/{2oa4gpkzjtpni.js → 44vre0f7xqsh-.js} +1 -1
  210. package/README.md +12 -12
  211. package/guide/bots.md +48 -8
  212. package/guide/calls.md +13 -12
  213. package/guide/setup.md +4 -2
  214. package/package.json +1 -1
  215. package/public/sounds/NOTICE +3 -0
  216. package/public/sounds/opening-land.ogg +0 -0
  217. package/public/sounds/opening-rise.ogg +0 -0
  218. package/public/sounds/opening-step-1.ogg +0 -0
  219. package/public/sounds/opening-step-2.ogg +0 -0
  220. package/public/sounds/opening-step-3.ogg +0 -0
  221. package/skills/README.md +3 -0
  222. package/skills/artifact/SKILL.md +6 -5
  223. package/skills/artifact/references/book.md +22 -8
  224. package/skills/artifact/references/deck.md +4 -2
  225. package/skills/artifact/references/document.md +9 -0
  226. package/skills/artifact/references/sheet.md +108 -0
  227. package/skills/artifact/runtime/book/book.css +75 -0
  228. package/skills/artifact/runtime/book/book.html +6 -3
  229. package/skills/artifact/runtime/book/book.js +21 -0
  230. package/skills/artifact/runtime/canvas/canvas.css +1 -1
  231. package/skills/artifact/runtime/canvas/canvas.js +11 -1
  232. package/skills/artifact/runtime/deck/deck.css +164 -1
  233. package/skills/artifact/runtime/deck/deck.js +76 -1
  234. package/skills/artifact/runtime/document/docx.js +631 -0
  235. package/skills/artifact/runtime/document/markdown.mjs +58 -2
  236. package/skills/artifact/runtime/document/quick.css +66 -0
  237. package/skills/artifact/runtime/document/quick.html +1 -0
  238. package/skills/artifact/runtime/document/quick.js +154 -0
  239. package/skills/artifact/runtime/document/word.mjs +65 -0
  240. package/skills/artifact/runtime/sheet/format.mjs +385 -0
  241. package/skills/artifact/runtime/sheet/formula.mjs +755 -0
  242. package/skills/artifact/runtime/sheet/sheet.css +499 -0
  243. package/skills/artifact/runtime/sheet/sheet.html +102 -0
  244. package/skills/artifact/runtime/sheet/sheet.js +1361 -0
  245. package/skills/artifact/runtime/sheet/xlsx.mjs +320 -0
  246. package/skills/artifact/runtime/shell/head.html +1 -1
  247. package/skills/artifact/runtime/shell/shell.css +3 -0
  248. package/skills/artifact/runtime/shell/wear.mjs +47 -1
  249. package/skills/artifact/runtime/vendor/fflate.LICENSE.md +23 -0
  250. package/skills/artifact/runtime/vendor/fflate.mjs +2710 -0
  251. package/skills/artifact/scripts/book.mjs +141 -5
  252. package/skills/artifact/scripts/chart.mjs +229 -11
  253. package/skills/artifact/scripts/document.mjs +29 -2
  254. package/skills/artifact/scripts/spreadsheet.mjs +1068 -0
  255. package/skills/data-report/SKILL.md +8 -1
  256. package/.next/server/chunks/[root-of-the-server]__0aijj66._.js +0 -3
  257. package/.next/server/chunks/[root-of-the-server]__0tvoct-._.js +0 -3
  258. package/.next/server/chunks/[root-of-the-server]__118qjk_._.js +0 -7
  259. package/.next/server/chunks/[root-of-the-server]__1b8tp42._.js +0 -5
  260. package/.next/server/chunks/[root-of-the-server]__1gzcbda._.js +0 -3
  261. package/.next/server/chunks/[root-of-the-server]__1qcn1ti._.js +0 -7
  262. package/.next/server/chunks/_0xx3ryc._.js +0 -7
  263. package/.next/server/chunks/ssr/[root-of-the-server]__1y5_1cv._.js +0 -3
  264. package/.next/server/chunks/ssr/_0l1-xc6._.js +0 -3
  265. package/.next/server/chunks/ssr/_1g48r6t._.js +0 -3
  266. package/.next/server/chunks/ssr/features_bot_1k25jdg._.js +0 -3
  267. package/.next/server/chunks/ssr/features_bot_1s_-2vj._.js +0 -3
  268. package/.next/server/chunks/ssr/lib_utils_ts_0_f1xvm._.js +0 -3
  269. package/.next/static/chunks/00d54fcfm-lko.js +0 -1
  270. package/.next/static/chunks/0gjlsu6vrfzod.js +0 -1
  271. package/.next/static/chunks/17yqt1p_svv13.js +0 -1
  272. package/.next/static/chunks/203pbwecfs3tm.js +0 -1
  273. package/.next/static/chunks/3ghvoe_mlljzs.js +0 -15
  274. package/.next/static/chunks/3gn7dubb4-pwy.js +0 -1
  275. /package/.next/static/{RtLRT9EEaGn-OqwpMFdYg → VtbCMn-0G969p8QJsWdGv}/_buildManifest.js +0 -0
  276. /package/.next/static/{RtLRT9EEaGn-OqwpMFdYg → VtbCMn-0G969p8QJsWdGv}/_clientMiddlewareManifest.js +0 -0
  277. /package/.next/static/{RtLRT9EEaGn-OqwpMFdYg → VtbCMn-0G969p8QJsWdGv}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,8912,e=>{"use strict";var s=e.i(843476),t=e.i(437750),n=e.i(375775),i=e.i(91511),a=e.i(758925),r=e.i(97923),o=e.i(456420);let l={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};l.node;let d=(0,o.default)(l),c={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};c.node;let u=(0,o.default)(c);var m=e.i(263676),h=e.i(511769),x=e.i(798120),p=e.i(167881),g=e.i(917162),f=e.i(818125),k=e.i(635963),b=e.i(895836),j=e.i(245629),y=e.i(609856),v=e.i(283653),N=e.i(647163),w=e.i(95187);let S=(0,w.createServerReference)("7f3539b9eeeadd65ddfbc32c7c645e89ebb2f3c4d6",w.callServer,void 0,w.findSourceMapURL,"removeSignInAction");var z=e.i(180245);let A=[[t.AppWindow,"A bot opens a window","When its work needs you signed in to a site, it opens that site on your screen and asks."],[r.LogIn,"You sign in there","The app keeps that sign-in here — the site's session, never your password."],[u,"Only that bot uses it","Later work is signed in without asking. Another bot has to ask you first."]];function I(){return(0,s.jsx)("ol",{className:"grid gap-3 pb-5 sm:grid-cols-3",children:A.map(([e,t,n],i)=>(0,s.jsxs)("li",{className:"flex gap-3 rounded-xl bg-muted/40 p-3.5",children:[(0,s.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-background text-muted-foreground ring-1 ring-border/60",children:(0,s.jsx)(e,{className:"size-4"})}),(0,s.jsxs)("span",{className:"min-w-0 space-y-0.5",children:[(0,s.jsxs)("span",{className:"block text-[13px] font-medium",children:[i+1,". ",t]}),(0,s.jsx)("span",{className:"block text-xs leading-relaxed text-muted-foreground",children:n})]})]},t))})}function O({signIn:e,bots:t}){let n=()=>(0,v.revalidate)(x.queryKey.signIns),[i,r]=(0,y.useServerAction)(z.setSignInBotAction,{onOk:n}),[o,l]=(0,y.useServerAction)(S,{onOk:n}),c=async()=>{await g.notify.confirm({title:`Sign out of ${e.site}?`,description:"What is kept here is removed, and the bots that used it ask you to sign in again. The site itself may still list the session until it ends it.",okText:"Sign out",destructive:!0})&&o(e.site)};return(0,s.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-xl bg-muted/60",children:(0,s.jsx)(f.SiteIcon,{host:e.site,className:"size-5 rounded-[5px]",fallback:(0,s.jsx)(a.KeyRound,{className:"size-4 text-muted-foreground"})})}),(0,s.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,s.jsx)("span",{className:"block truncate text-sm font-medium",children:e.site}),(0,s.jsx)("span",{className:"block truncate text-[13px] text-muted-foreground",children:e.account})]}),(0,s.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground tabular-nums",children:e.usedAt?`used ${(0,j.whenOf)(e.usedAt)}`:`kept ${(0,j.whenOf)(e.keptAt)}`}),(0,s.jsxs)(p.Button,{variant:"outline",size:"sm",loading:l,onClick:()=>void c(),children:[(0,s.jsx)(d,{}),"Sign out"]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pl-13",children:[e.bots.map(n=>(0,s.jsxs)("span",{className:"flex h-7 items-center gap-1.5 rounded-full bg-muted/60 pr-1 pl-1.5 text-[13px]",children:[(0,s.jsx)(k.BotMark,{size:18,seed:n,...(0,k.markOf)(n,t)}),n,(0,s.jsx)("button",{type:"button",disabled:r,"aria-label":`${n} may no longer use it`,onClick:()=>void i(e.site,n,!1),className:"grid size-5 place-items-center rounded-full text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,s.jsx)(m.X,{className:"size-3"})})]},n)),0===e.bots.length&&0===e.asking.length&&(0,s.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"No bot may use it. One that needs it will ask."}),e.asking.map(n=>(0,s.jsxs)("span",{className:(0,N.cn)("flex h-7 items-center gap-1.5 rounded-full pr-1 pl-1.5 text-[13px] ring-1 ring-border ring-inset",N.WAITING_INK),children:[(0,s.jsx)(k.BotMark,{size:18,seed:n,...(0,k.markOf)(n,t)}),n," asks",(0,s.jsx)(p.Button,{size:"sm",variant:"secondary",className:"h-5 rounded-full px-2 text-[11px]",disabled:r,onClick:()=>void i(e.site,n,!0),children:"Allow"})]},n))]})]})}let R="https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm";function K(){return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,s.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-xl bg-muted/60",children:(0,s.jsx)(f.SiteIcon,{host:new URL(R).host,className:"size-5 rounded-[5px]",fallback:(0,s.jsx)(i.Globe,{className:"size-4 text-muted-foreground"})})}),(0,s.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,s.jsx)("span",{className:"block text-sm font-medium",children:"Your own Chrome"}),(0,s.jsx)("span",{className:"block text-[13px] text-muted-foreground",children:"For a site that will not stay signed in. A bot gets a tab of its own, signed in as you."})]}),(0,s.jsxs)("a",{href:R,target:"_blank",rel:"noreferrer",className:(0,N.cn)((0,p.buttonVariants)({variant:"outline",size:"sm"})),children:["Get the extension",(0,s.jsx)(n.ArrowUpRight,{})]})]})}e.s(["SignInsSetting",0,function(){let{data:e,isLoading:t,error:n}=(0,v.useServerRoute)(x.queryKey.signIns),{data:i}=(0,v.useServerRoute)(x.queryKey.bot);if((0,h.useAppEvent)({signins:()=>void(0,v.revalidate)(x.queryKey.signIns)}),t)return(0,s.jsx)(b.SettingSkeleton,{rows:3});if(n)return(0,s.jsx)(b.SettingError,{message:n.message});let a=e??[];return(0,s.jsxs)(b.SettingScreen,{footer:(0,s.jsx)(b.SettingRailNote,{children:"A site's session as the browser held it — never a password. Kept on this machine, outside the folder the bots work in."}),children:[(0,s.jsx)(I,{}),(0,s.jsxs)(b.SettingItems,{children:[0===a.length?(0,s.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:"Nothing is kept yet. When a bot needs you signed in somewhere, it opens a window for you to sign in — and that sign-in is kept here for its later work."}):a.map(e=>(0,s.jsx)(O,{signIn:e,bots:i},e.site)),(0,s.jsx)(K,{})]})]})}],8912)},437750,e=>{"use strict";var s=e.i(456420);let t={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"}]]};t.node;let n=(0,s.default)(t);e.s(["AppWindow",0,n],437750)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,8912,e=>{"use strict";var s=e.i(843476),t=e.i(437750),n=e.i(375775),i=e.i(91511),a=e.i(758925),r=e.i(97923),o=e.i(456420);let l={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};l.node;let d=(0,o.default)(l),c={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};c.node;let u=(0,o.default)(c);var m=e.i(263676),h=e.i(511769),x=e.i(798120),p=e.i(167881),g=e.i(917162),f=e.i(818125),k=e.i(635963),b=e.i(895836),j=e.i(245629),y=e.i(609856),v=e.i(283653),N=e.i(647163),w=e.i(95187);let S=(0,w.createServerReference)("7f4132c111fe2638cc8913b88177d482963b0ae8e6",w.callServer,void 0,w.findSourceMapURL,"removeSignInAction");var z=e.i(730206);let A=[[t.AppWindow,"A bot opens a window","When its work needs you signed in to a site, it opens that site on your screen and asks."],[r.LogIn,"You sign in there","The app keeps that sign-in here — the site's session, never your password."],[u,"Only that bot uses it","Later work is signed in without asking. Another bot has to ask you first."]];function I(){return(0,s.jsx)("ol",{className:"grid gap-3 pb-5 sm:grid-cols-3",children:A.map(([e,t,n],i)=>(0,s.jsxs)("li",{className:"flex gap-3 rounded-xl bg-muted/40 p-3.5",children:[(0,s.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-background text-muted-foreground ring-1 ring-border/60",children:(0,s.jsx)(e,{className:"size-4"})}),(0,s.jsxs)("span",{className:"min-w-0 space-y-0.5",children:[(0,s.jsxs)("span",{className:"block text-[13px] font-medium",children:[i+1,". ",t]}),(0,s.jsx)("span",{className:"block text-xs leading-relaxed text-muted-foreground",children:n})]})]},t))})}function O({signIn:e,bots:t}){let n=()=>(0,v.revalidate)(x.queryKey.signIns),[i,r]=(0,y.useServerAction)(z.setSignInBotAction,{onOk:n}),[o,l]=(0,y.useServerAction)(S,{onOk:n}),c=async()=>{await g.notify.confirm({title:`Sign out of ${e.site}?`,description:"What is kept here is removed, and the bots that used it ask you to sign in again. The site itself may still list the session until it ends it.",okText:"Sign out",destructive:!0})&&o(e.site)};return(0,s.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-xl bg-muted/60",children:(0,s.jsx)(f.SiteIcon,{host:e.site,className:"size-5 rounded-[5px]",fallback:(0,s.jsx)(a.KeyRound,{className:"size-4 text-muted-foreground"})})}),(0,s.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,s.jsx)("span",{className:"block truncate text-sm font-medium",children:e.site}),(0,s.jsx)("span",{className:"block truncate text-[13px] text-muted-foreground",children:e.account})]}),(0,s.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground tabular-nums",children:e.usedAt?`used ${(0,j.whenOf)(e.usedAt)}`:`kept ${(0,j.whenOf)(e.keptAt)}`}),(0,s.jsxs)(p.Button,{variant:"outline",size:"sm",loading:l,onClick:()=>void c(),children:[(0,s.jsx)(d,{}),"Sign out"]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pl-13",children:[e.bots.map(n=>(0,s.jsxs)("span",{className:"flex h-7 items-center gap-1.5 rounded-full bg-muted/60 pr-1 pl-1.5 text-[13px]",children:[(0,s.jsx)(k.BotMark,{size:18,seed:n,...(0,k.markOf)(n,t)}),n,(0,s.jsx)("button",{type:"button",disabled:r,"aria-label":`${n} may no longer use it`,onClick:()=>void i(e.site,n,!1),className:"grid size-5 place-items-center rounded-full text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,s.jsx)(m.X,{className:"size-3"})})]},n)),0===e.bots.length&&0===e.asking.length&&(0,s.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"No bot may use it. One that needs it will ask."}),e.asking.map(n=>(0,s.jsxs)("span",{className:(0,N.cn)("flex h-7 items-center gap-1.5 rounded-full pr-1 pl-1.5 text-[13px] ring-1 ring-border ring-inset",N.WAITING_INK),children:[(0,s.jsx)(k.BotMark,{size:18,seed:n,...(0,k.markOf)(n,t)}),n," asks",(0,s.jsx)(p.Button,{size:"sm",variant:"secondary",className:"h-5 rounded-full px-2 text-[11px]",disabled:r,onClick:()=>void i(e.site,n,!0),children:"Allow"})]},n))]})]})}let R="https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm";function K(){return(0,s.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,s.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-xl bg-muted/60",children:(0,s.jsx)(f.SiteIcon,{host:new URL(R).host,className:"size-5 rounded-[5px]",fallback:(0,s.jsx)(i.Globe,{className:"size-4 text-muted-foreground"})})}),(0,s.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,s.jsx)("span",{className:"block text-sm font-medium",children:"Your own Chrome"}),(0,s.jsx)("span",{className:"block text-[13px] text-muted-foreground",children:"For a site that will not stay signed in. A bot gets a tab of its own, signed in as you."})]}),(0,s.jsxs)("a",{href:R,target:"_blank",rel:"noreferrer",className:(0,N.cn)((0,p.buttonVariants)({variant:"outline",size:"sm"})),children:["Get the extension",(0,s.jsx)(n.ArrowUpRight,{})]})]})}e.s(["SignInsSetting",0,function(){let{data:e,isLoading:t,error:n}=(0,v.useServerRoute)(x.queryKey.signIns),{data:i}=(0,v.useServerRoute)(x.queryKey.bot);if((0,h.useAppEvent)({signins:()=>void(0,v.revalidate)(x.queryKey.signIns)}),t)return(0,s.jsx)(b.SettingSkeleton,{rows:3});if(n)return(0,s.jsx)(b.SettingError,{message:n.message});let a=e??[];return(0,s.jsxs)(b.SettingScreen,{footer:(0,s.jsx)(b.SettingRailNote,{children:"A site's session as the browser held it — never a password. Kept on this machine, outside the folder the bots work in."}),children:[(0,s.jsx)(I,{}),(0,s.jsxs)(b.SettingItems,{children:[0===a.length?(0,s.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:"Nothing is kept yet. When a bot needs you signed in somewhere, it opens a window for you to sign in — and that sign-in is kept here for its later work."}):a.map(e=>(0,s.jsx)(O,{signIn:e,bots:i},e.site)),(0,s.jsx)(K,{})]})]})}],8912)},437750,e=>{"use strict";var s=e.i(456420);let t={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"}]]};t.node;let n=(0,s.default)(t);e.s(["AppWindow",0,n],437750)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,616816,e=>{"use strict";var t=e.i(843476),r=e.i(375775),a=e.i(689664),n=e.i(263676),l=e.i(271645),i=e.i(798120),s=e.i(167881),o=e.i(23750),h=e.i(41533),u=e.i(968978),c=e.i(149666),d=e.i(265402),f=e.i(609856),m=e.i(283653),p=e.i(647163),g=e.i(819661),y=e.i(992112);function M({provider:e,saved:r,autoFocus:a,dense:n,plain:l,value:i,ready:s,saving:o,onValue:h,onSubmit:c}){return(0,t.jsxs)("div",{className:"space-y-2",children:[!l&&(0,t.jsxs)("span",{className:"flex items-center gap-2 px-0.5 text-muted-foreground",children:[(0,t.jsx)(u.ProviderIcon,{provider:e.id,className:"size-4 shrink-0"}),(0,t.jsx)("span",{className:(0,p.cn)("font-mono",n?"text-[11px]":"text-[12.5px]"),children:e.label})]}),(0,t.jsx)(w,{provider:e,saved:r,autoFocus:a,dense:n,mark:l,value:i,ready:s,saving:o,onValue:h,onSubmit:c})]})}let x=e=>e?.replace(/…$/,"")??"";function w({provider:e,saved:r,autoFocus:n,dense:l,mark:i,value:h,ready:c,saving:f,onValue:m,onSubmit:g}){var y;let M,b=(y=e.id,M=x(d.TEXT_MODEL_PROVIDERS[y].keyLooks),Object.entries(d.TEXT_MODEL_PROVIDERS).flatMap(([e,t])=>{let r=x(t.keyLooks);return e!==y&&r&&!M.startsWith(r)?[r]:[]})).some(e=>h.trim().startsWith(e));return(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),g()},className:(0,p.cn)("flex items-center gap-3 rounded-2xl border bg-muted/40 px-4 transition-colors",l?"h-11 rounded-xl px-3":"h-14",r||c?"border-foreground bg-transparent":"border-border"),children:[i&&(0,t.jsx)(u.ProviderIcon,{provider:e.id,className:"size-4 shrink-0 text-muted-foreground"}),(0,t.jsx)(o.Input,{autoFocus:n,type:"password","aria-label":"OpenAI API key",autoComplete:"off",value:h,spellCheck:!1,placeholder:r?"Replace it":"sk-…",onChange:e=>m(e.target.value),className:(0,p.cn)("min-w-0 flex-1 border-0 bg-transparent px-0 font-mono shadow-none focus-visible:ring-0 dark:bg-transparent",l?"h-7 text-[13px]":"h-9 text-[15px]")}),h?(0,t.jsx)(s.Button,{type:"submit",size:"sm",variant:b?"outline":"default",loading:f,disabled:!c,className:(0,p.cn)("shrink-0",l?"h-7 px-3":"h-9 px-4"),children:b?`Not ${e.label}?`:"Save"}):r&&(0,t.jsx)("span",{className:(0,p.cn)("grid shrink-0 animate-in place-items-center rounded-full bg-foreground text-background zoom-in-50 duration-300",l?"size-5":"size-7"),children:(0,t.jsx)(a.Check,{className:l?"size-3":"size-4"})})]})}e.s(["GetKeyLink",0,function(){let e=d.TEXT_MODEL_PROVIDERS[c.LIVE_PROVIDER.id].keysAt;return e?(0,t.jsxs)("a",{href:e,target:"_blank",rel:"noreferrer",className:"flex items-center gap-2.5 text-[13px] font-medium text-foreground no-underline",children:[(0,t.jsxs)("span",{className:"flex h-7.5 shrink-0 items-center gap-1.5 rounded-full bg-muted px-3.5 whitespace-nowrap transition-colors hover:bg-accent",children:["Get a key",(0,t.jsx)(r.ArrowUpRight,{className:"size-3.5"})]}),(0,t.jsx)("span",{className:"truncate font-mono text-[11px] font-normal text-muted-foreground/70",children:e.replace(/^https:\/\//,"")})]}):null},"KeyInput",0,w,"VoiceKeys",0,function({ref:e,autoFocus:r,dense:a=!1,plain:o=!1,onCancel:u,onSaved:d,className:x}){let{data:w}=(0,m.useServerRoute)(i.queryKey.config),[b,v]=(0,l.useState)({}),[k,A]=(0,l.useState)(null),[O,S]=(0,l.useState)(null),[E]=(0,f.useServerAction)(g.setConfigAction,{errorMessage:!1,onError:e=>S(e??"That key was not saved."),onOk:()=>{(0,m.revalidate)(i.queryKey.config),(0,m.revalidate)(i.queryKey.llmModel)}}),_=e=>(b[e]?.trim().length??0)>=h.KEY_MIN,L=async e=>{let t=e.apiKeyName;if(!_(t)||k)return!1;S(null),A(t);try{return await E(t,b[t]),v(e=>({...e,[t]:""})),d?.(e.id),!0}catch{return!1}finally{A(null)}};return(0,l.useImperativeHandle)(e,()=>({pending:()=>_(c.LIVE_PROVIDER.apiKeyName),flush:async()=>!_(c.LIVE_PROVIDER.apiKeyName)||L(c.LIVE_PROVIDER)})),(0,t.jsxs)("div",{className:(0,p.cn)("w-full",a?"space-y-2":"space-y-4",x),children:[a&&!o&&(0,t.jsxs)("div",{className:"flex h-6 items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"px-0.5 font-mono text-[11px] text-muted-foreground",children:"Voice key"}),u&&(0,t.jsx)(s.Button,{type:"button",size:"icon",variant:"ghost","aria-label":"Not now",onClick:u,className:"-my-1 size-6",children:(0,t.jsx)(n.X,{className:"size-3.5"})})]}),(0,t.jsx)(M,{provider:c.LIVE_PROVIDER,saved:(0,y.isConfigSet)(w,c.LIVE_PROVIDER.apiKeyName),autoFocus:r,dense:a,plain:o,value:b[c.LIVE_PROVIDER.apiKeyName]??"",ready:_(c.LIVE_PROVIDER.apiKeyName),saving:k===c.LIVE_PROVIDER.apiKeyName,onValue:e=>{S(null),v(t=>({...t,[c.LIVE_PROVIDER.apiKeyName]:e}))},onSubmit:()=>void L(c.LIVE_PROVIDER)}),O&&(0,t.jsx)("p",{className:(0,p.cn)("px-0.5 leading-5 break-words",a?"text-xs":"text-center text-[13px]",p.WAITING_INK),children:O}),!o&&(0,t.jsx)("p",{className:(0,p.cn)("px-0.5 font-mono text-muted-foreground",a?"text-[11px]":"pt-1 text-center text-[12.5px]"),children:a?"Live voice and reasoning share this OpenAI API key.":"Live uses an OpenAI API key, billed separately from ChatGPT. Stored on this machine, in this app's database."})]})}])},671228,67045,297825,e=>{"use strict";let t,r;var a=e.i(504565),n=e.i(265402),l=e.i(413168);let i=[{id:"chatgpt",...n.TEXT_MODEL_PROVIDERS.chatgpt},{id:"openai",...n.TEXT_MODEL_PROVIDERS.openai}];a.default.object({id:a.default.string().min(1),text:a.default.string(),said:a.default.boolean()});let s="note",o=e=>e.type===`data-${s}`?e.data:null,h={min:3,max:32},u=a.default.object({enabled:a.default.boolean(),phrase:a.default.string().trim().min(h.min).max(h.max)}),c={enabled:!1,phrase:"hey thursday"},d=a.default.object({enabled:a.default.boolean(),combo:a.default.string().trim().min(1).max(64)}),f={enabled:!1,combo:"alt+shift+KeyT"},m=["off","waiting","any"],p=a.default.enum(m),g="waiting",y=["center","sides"],M=a.default.enum(y);a.default.object({id:a.default.string().min(1),role:a.default.enum(["user","assistant","tool"]),tool:a.default.string().nullish(),text:a.default.string(),seq:a.default.number().int().min(0),fragments:a.default.array(l.LiveFragmentSchema).nullish()}),a.default.object({id:a.default.string().min(1),text:a.default.string(),seq:a.default.number().int().min(0)}),e.s(["CALL_BACK_DEFAULT",0,g,"CALL_BACK_LABEL",0,{off:"Never",waiting:"When a job needs me",any:"Whenever a job ends"},"CALL_BACK_MODES",0,m,"CAPTION_VIEWS",0,y,"CallBackSchema",0,p,"CaptionViewSchema",0,M,"HOTKEY_DEFAULT",0,f,"HotkeySchema",0,d,"TEXT_CALL_NOTE",0,s,"WAKE_DEFAULT",0,c,"WAKE_PHRASE",0,h,"WakeSchema",0,u,"isEnglishPhrase",0,e=>/^[a-z0-9\s'.,!?-]+$/i.test(e.trim())&&/[a-z]/i.test(e),"noteOf",0,o,"notesIn",0,e=>e.flatMap(e=>e.parts.flatMap(e=>{let t=o(e);return t?[t]:[]})),"textCallRunsOn",0,e=>i.find(t=>e(t.apiKeyName))?.id??null],671228);var x=e.i(681307),w=e.i(768834);let b=e=>t=>{try{let r=e(t);if(r instanceof Promise)return r;return{then:e=>b(e)(r),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>b(t)(e)}}};var v=e.i(149666);let k=x.z.object({wake:u.catch(c),hotkey:d.catch(f),callBack:p.catch(g),captionView:M.catch("sides"),textModel:n.textModelRefSchema.nullable().catch(null)}),A={wake:c,hotkey:f,callBack:g,captionView:"sides",textModel:null},O=(0,w.create)()((t=e=>({...A,carried:null,patch:t=>e(t),carriedDone:()=>e({carried:null})}),r={name:"thursday.settings",version:2,migrate:(e,t)=>t<1&&e&&"object"==typeof e?{...e,webSearch:!0}:e,partialize:e=>({wake:e.wake,hotkey:e.hotkey,callBack:e.callBack,captionView:e.captionView,textModel:e.textModel}),merge:(e,t)=>{let r=k.safeParse(e),a=r.success?r.data:A;return{...t,...a,carried:function(e){if(!e||"object"!=typeof e)return null;let t=[...Object.keys(v.LiveSettingsSchema.shape),"voicePrompt","systemPrompt","model"].filter(t=>t in e);return t.length?Object.fromEntries(t.map(t=>[t,e[t]])):null}(e)}}},(e,a,n)=>{let l,i={storage:function(e){let t;try{t=e()}catch(e){return}return{getItem:e=>{var r;let a=e=>null===e?null:JSON.parse(e,void 0),n=null!=(r=t.getItem(e))?r:null;return n instanceof Promise?n.then(a):a(n)},setItem:(e,r)=>t.setItem(e,JSON.stringify(r,void 0)),removeItem:e=>t.removeItem(e)}}(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...r},s=!1,o=0,h=new Set,u=new Set,c=i.storage;if(!c)return t((...t)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),e(...t)});let d=()=>{let e=i.partialize({...a()});return c.setItem(i.name,{state:e,version:i.version})},f=n.setState;n.setState=(e,t)=>(f(e,t),d());let m=t((...t)=>(e(...t),d()));n.getInitialState=()=>m;let p=()=>{var t,r;if(!c)return;let n=++o;s=!1,h.forEach(e=>{var t;return e(null!=(t=a())?t:m)});let f=(null==(r=i.onRehydrateStorage)?void 0:r.call(i,null!=(t=a())?t:m))||void 0;return b(c.getItem.bind(c))(i.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===i.version)return[!1,e.state];else{if(i.migrate){let t=i.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(t=>{var r;if(n!==o)return;let[s,h]=t;if(e(l=i.merge(h,null!=(r=a())?r:m),!0),s)return d()}).then(()=>{n===o&&(null==f||f(a(),void 0),l=a(),s=!0,u.forEach(e=>e(l)))}).catch(e=>{n===o&&(null==f||f(void 0,e))})};return n.persist={setOptions:e=>{i={...i,...e},e.storage&&(c=e.storage)},clearStorage:()=>{++o,null==c||c.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>p(),hasHydrated:()=>s,onHydrate:e=>(h.add(e),()=>{h.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},i.skipHydration||p(),l||m}));e.s(["useThursdayStore",0,O],67045);var S=e.i(271645),E=e.i(798120),_=e.i(609856),L=e.i(283653),N=e.i(95187);let R=(0,N.createServerReference)("7f85ab4b0acb99e2bd03426653ae6d50cb059ddbaf",N.callServer,void 0,N.findSourceMapURL,"seedLiveSettingsAction"),I=(0,N.createServerReference)("7ff9b3e77fd3b3216f53e8e9fda08755753cbe13e2",N.callServer,void 0,N.findSourceMapURL,"setLiveSettingsAction");e.s(["useLiveSettings",0,function(){let{data:e}=(0,L.useServerRoute)(E.queryKey.thursdaySettings),[t]=(0,_.useServerAction)(I,{onOk:()=>(0,L.revalidate)(E.queryKey.thursdaySettings)}),r=(0,S.useRef)(e);r.current=e;let a=(0,S.useCallback)(e=>{let a=r.current;a&&t({...a,...e})},[t]);return function(){let e=O(e=>e.carried),t=O(e=>e.carriedDone),[r]=(0,_.useServerAction)(R,{onOk:e=>{e&&(0,L.revalidate)(E.queryKey.thursdaySettings)},errorMessage:!1});(0,S.useEffect)(()=>{e&&(t(),r(e))},[e,t,r])}(),{settings:e,patch:a}}],297825)},561540,377090,732061,298293,387758,333495,e=>{"use strict";var t=e.i(213377);let r={[t.TOOL_NAMES.memory_recall]:"Checking your notes",[t.TOOL_NAMES.memory_create]:"Starting a note",[t.TOOL_NAMES.memory_remember]:"Noting that down",[t.TOOL_NAMES.memory_describe]:"Renaming a note",[t.TOOL_NAMES.memory_forget]:"Forgetting that",[t.TOOL_NAMES.bash]:"Doing it on this computer",[t.TOOL_NAMES.web_search]:"Searching the web",[t.TOOL_NAMES.load_skill]:"Reading how to do this",[t.TOOL_NAMES.look_at]:"Looking at the picture",[t.TOOL_NAMES.make_deck]:"Making the deck",[t.TOOL_NAMES.end_call]:"Ending the call",[t.TOOL_NAMES.routine]:"Checking your routines"};function a(e,t=28){let r=e.trim().replace(/\s+/g," ");if(r.length<=t)return r;let n=r.slice(0,t),l=n.lastIndexOf(" ");return`${(l>t/2?n.slice(0,l):n).trimEnd()}…`}let n=(e,t)=>"string"==typeof e[t]?e[t].trim():"";function l(e){if(!e)return null;try{let t=JSON.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t}catch{}return null}let i=new Set([t.TOOL_NAMES.thread_tell,t.TOOL_NAMES.thread_answer,t.TOOL_NAMES.thread_status,t.TOOL_NAMES.thread_show,t.TOOL_NAMES.thread_cancel,t.TOOL_NAMES.thread_seen]);function s(e){return Array.isArray(e)?e.flatMap(e=>e&&"object"==typeof e&&"string"==typeof e.url?[e]:[]):[]}e.s(["reasoningTitle",0,function(e){return/^\s*\*\*(.+?)\*\*/.exec(e)?.[1]?.trim()||null},"searchOf",0,function(e,r){if(e!==t.TOOL_NAMES.web_search)return null;try{let e=JSON.parse(r);return{query:"string"==typeof e.query?e.query:null,sources:s(e.sources)}}catch{return null}},"searchQueryOf",0,function(e){let t=l(e)?.query;return"string"==typeof t&&t.trim()?t.trim():null},"searchSourcesOf",0,function(e){return s(l(e)?.sources)},"startedLabel",0,function(e,r){if(e!==t.TOOL_NAMES.thread_start)return null;try{let e=JSON.parse(r);return"string"==typeof e.label?e.label:null}catch{return null}},"toolBot",0,function(e,r,a,n){let s=l(r);if(!s)return null;if(e===t.TOOL_NAMES.thread_start)return"string"==typeof s.bot&&s.bot.trim()?s.bot.trim():null;if(!i.has(e))return null;let o="string"==typeof s.thread?s.thread.trim():"";if(!o||"all"===o.toLowerCase())return null;let h=o.toLowerCase(),u=a?.find(e=>e.id===o)??a?.find(e=>e.label.toLowerCase()===h);return u?e===t.TOOL_NAMES.thread_answer?u.room.questions[0]?.bot??u.bot:u.bot:function(e){let t=l(e);if(!t)return null;if("string"==typeof t.bot&&t.bot.trim())return t.bot.trim();let r=t.answered;return"string"==typeof r?.bot?r.bot:null}(n)},"toolLine",0,function(e,i,s=null){let o;if(e===t.TOOL_NAMES.tool_search||e===t.TOOL_NAMES.tool_call)return"Reaching a connected service";let h=l(i);return(h&&function(e,r,l){if(e===t.TOOL_NAMES.memory_remember||e===t.TOOL_NAMES.memory_create){let l=n(r,"path"),i=function(e){if(!Array.isArray(e.facts))return null;let t=e.facts.map(e=>e&&"object"==typeof e&&"string"==typeof e.text?e.text.trim():"").filter(Boolean);return t.length?{text:t[0],more:t.length-1}:null}(r),s=e===t.TOOL_NAMES.memory_create?"Starting":"Noting";if(!l)return null;if(!i)return`${s} ${l}`;let o=i.more>0?` (+${i.more})`:"";return`${s} ${l}: ${a(i.text)}${o}`}if(e===t.TOOL_NAMES.memory_recall){let e=n(r,"path");return e?`Checking \xb7 ${e}`:null}if(e===t.TOOL_NAMES.memory_describe){let e=n(r,"path");return e?`Renaming \xb7 ${e}`:null}if(e===t.TOOL_NAMES.bash){let e=n(r,"description")||n(r,"command");return e?`On this computer \xb7 ${a(e,44)}`:null}if(e===t.TOOL_NAMES.load_skill){let e=n(r,"name");return e?`Reading the ${e} skill`:null}if(e===t.TOOL_NAMES.look_at){let e=n(r,"path");return e?`Looking at ${e.split("/").filter(Boolean).at(-1)??""}`:null}if(e===t.TOOL_NAMES.make_deck){let e=n(r,"title");return e?`Making the deck \xb7 ${a(e,44)}`:null}if(e===t.TOOL_NAMES.thread_start){let e=n(r,"bot");return e?`Handing this to ${e}`:"Handing this over"}if(e===t.TOOL_NAMES.web_search){let e=n(r,"query");return e?`Searching \xb7 ${e}`:null}if(e===t.TOOL_NAMES.routine){if("create"===r.action){let e=[n(r,"bot"),function(e){if("string"==typeof e.at&&e.at.length>=16){let[t,r]=e.at.split(" "),[a,n,l]=t.split("-").map(Number),i=new Date(a,n-1,l);if(i.toDateString()===new Date().toDateString())return`once at ${r}`;let s=i.toLocaleDateString("en-US",{month:"short",day:"numeric"});return`once, ${s} ${r}`}return"string"==typeof e.time&&e.time?`daily at ${e.time}`:"number"==typeof e.everyHours?`every ${e.everyHours} hours`:null}(r)].filter(Boolean).join(", ");return e?`Setting a routine \xb7 ${e}`:"Setting a routine"}return"change"===r.action?"Changing a routine":"delete"===r.action?"Deleting a routine":null}let i=n(r,"thread");return e===t.TOOL_NAMES.thread_tell?l?`Telling ${l}`:"Passing that on":e===t.TOOL_NAMES.thread_answer?l?`Answering ${l}`:"Answering that":e===t.TOOL_NAMES.thread_cancel?i?`Stopping ${i}`:"Stopping that":e===t.TOOL_NAMES.thread_seen?i?`Marking ${i} as read`:"Marking that as read":e===t.TOOL_NAMES.thread_show?i?`Opening ${i}`:"Opening that":e===t.TOOL_NAMES.thread_status?i&&"all"!==i.toLowerCase()?`Checking on ${i}`:"Checking on the work":null}(e,h,s))??r[e]??((o=e.indexOf("__"))<=0?null:`Reaching ${e.slice(0,o).replace(/[-_]/g," ")}`)}],561540);var o=e.i(843476),h=e.i(271645),u=e.i(41533),c=e.i(218080),d=e.i(567334);function f(e,t,r){let a=(0|e)*0x165667b1+(0|t)*0x27d4eb2f+(0|r)*0x4bf19f61;return(((a=Math.imul(a^a>>>13,0x4bf19f61))^a>>>16)>>>0)/0x100000000}let m=(e,t,r)=>e+(t-e)*r;function p(e,t,r){let a=Math.floor(e),n=Math.floor(t),l=Math.floor(r),i=e-a,s=t-n,o=r-l,h=i*i*(3-2*i),u=s*s*(3-2*s),c=m(f(a,n,l),f(a+1,n,l),h),d=m(f(a,n+1,l),f(a+1,n+1,l),h),p=m(f(a,n,l+1),f(a+1,n,l+1),h),g=m(f(a,n+1,l+1),f(a+1,n+1,l+1),h);return m(m(c,d,u),m(p,g,u),o*o*(3-2*o))}function g(e,t,r,a=3){let n=0,l=.5,i=0;for(let s=0;s<a;s++)n+=l*p(e,t,r),i+=l,e*=2.03,t*=2.03,r*=1.97,l*=.5;return n/i}function y(e,t,r,a=4){let n=g(e,t,r,2),l=g(e+5.2,t+1.3,r+2.8,2);return g(e+a*n,t+a*l,r,3)}function M(e,t=0){let r=9.2*g(.1*e+3.7*t,3.1+t,1.4,2);return{x:Math.cos(r),y:Math.sin(r),g:.38+.62*Math.max(0,Math.min(1,(g(.11*e+5.3*t,7.7,2.2,3)-.38)*3.2))**1.5}}e.s(["fbm",0,g,"ihash",0,f,"vnoise",0,p,"warp",0,y,"windAt",0,M],377090);let x=2*Math.PI,w=(e,t,r)=>(0,d.smoothstep)(t,t+(r-t)*.3,e)*(1-(0,d.smoothstep)(r-(r-t)*.3,r,e)),b={x:0,y:0,rot:0,yaw:0,pitch:0,spin:0,axis:0,sx:1,sy:1,lidL:1,lidR:1,size:1,gx:0,gy:0},v=(()=>{let e=0;for(let t=0;t<5;t++)e+=Math.exp(-t/1.6);return Array.from({length:5},(t,r)=>Math.exp(-r/1.6)/e)})(),k={now:{wake:!0,sighs:!0,len:0,pose:()=>b},dust:{wake:!0,len:2.4,pose(e,t){let r=t?-1:1,a=.55*(0,d.smoothstep)(.16,.3,e)*Math.exp(-Math.max(0,e-.3)/.55),n=2.5*x*(e-.2),l=.3+.2*(0,d.smoothstep)(.05,.25,e)+.5*(0,d.smoothstep)(1.35,1.75,e),i=w(e,1.45,2.4);return{...b,yaw:r*a*Math.sin(n),x:.035*r*a*Math.sin(n-.5),rot:.03*r*a*Math.sin(n+.9),y:-.02*i,lidL:l,lidR:l,size:1+.06*i}},fx(e,t,r,a,n,l,i,s){let o=t?-1:1,h=1;for(let t=0;t<5;t++){let r=.2+(.25+.5*t)/2.5;h-=v[t]*(0,d.smoothstep)(r-.03,r+.1,e),e>=r&&l.thrown<=t&&(l.thrown=t+1,function(e,t,r,a){let n=e.head,l=Math.min(1.4,3.2*r),i=4+Math.round(6*l);for(let r=0;r<i;r++){let r=(Math.random()-.5)*1.6*a,i=t*Math.sqrt(Math.max(0,a*a-r*r))*(.1+.8*Math.random()),s=(230+170*Math.random())*(.55+.45*l),o=(Math.random()-.6)*90+r/a*50;for(let l=0;l<7;l++){let l=s*(.75+.5*Math.random());L(e,{...N,x:n.x*a+i+(Math.random()-.5)*24,y:n.y*a+r+(Math.random()-.5)*24,vx:t*l,vy:o+(Math.random()-.5)*50,life:1.3+.8*Math.random(),a:.55+.3*Math.random(),r0:4,r1:30+20*Math.random(),grow:.5,keep:.35,fall:45,curl:40,kind:2,hold:0,fadeP:1.5})}for(let l=0;l<3;l++)L(e,{...N,x:n.x*a+i,y:n.y*a+r,vx:t*s*(.8+.5*Math.random()),vy:o-40*Math.random(),life:.6+.4*Math.random(),a:.9,r0:1.5,r1:2.5,grow:1,keep:.4,fall:320,curl:0,kind:2,hold:0,fadeP:1})}}(a,o*(t%2?-1:1),v[t],s))}r.crust=Math.max(r.crust,e<0?(0,d.smoothstep)(-.8,-.3,e):Math.max(0,h))}},turn:{wake:!0,len:1.8,pose(e,t){let r=t?-1:1,a=x*(0,d.smoothstep)(-.6,.95,e),n=e>.95?-.1*Math.sin(Math.min(1,(e-.95)/.6)*Math.PI):0,l=(0,d.smoothstep)(0,.3,e);return{...b,spin:r*(a+n),axis:.22*r,y:-.02*w(e,.5,1.6),lidL:l,lidR:l}}},vape:{len:6.6,pose(e){let t=w(e,.2,1.7),r=(0,d.smoothstep)(1.7,2.3,e)*(1-(0,d.smoothstep)(5.2,6.4,e)),a=1-.35*t-.42*r;return{...b,pitch:.12*t-.08*r,y:-.02*t+.015*r,sx:1+.03*t,sy:1+.03*t,lidL:a,lidR:a}},fx(e,t,r,a,n,l,i,s){if(e<0||e>6.8)return;r.hush=Math.max(r.hush,.8*w(e,.2,2));let o=e>1.8&&e<5.4?(0,d.smoothstep)(1.8,2.2,e)*(.4+.6*Math.exp(-(e-1.8)/1.6))*(1-(0,d.smoothstep)(4.5,5.4,e)):0;o>0&&function(e,t,r,a,n,l){var i;let s,o,h,u,c,[d,f]=(i=.55*l,o=Math.cos((s=e.head).rot),h=Math.sin(s.rot),u=0*s.sx,c=i*s.sy,[s.x*l+u*o-c*h,s.y*l+u*h+c*o]),m=.88*t.field;for(r.owed+=110*a*n;r.owed>=1;){r.owed-=1;let t=Math.PI/2+(Math.random()-.5)*1.6,n=165*(.6+.4*a)*(.7+.6*Math.random());L(e,{x:d+(Math.random()-.5)*26,y:f+(Math.random()-.5)*10,vx:Math.cos(t)*n,vy:Math.sin(t)*n,life:5+2.5*Math.random(),a:.75,r0:10,r1:96*(.7+.6*Math.random()),grow:1.6,keep:.55,fall:10,rise:30,riseT:3.6,curl:85,splay:55,wall:m,home:m*Math.random()**.85*.92,peel:.1+1.0999999999999999*Math.random(),side:0,hitAt:-1,peeled:!1,kind:1,hold:3,fadeP:2.4})}}(a,n,l,o,i,s)}},look:{len:2.8,pose(e,t){let r=t?-1:1,a=w(e,.45,1.35),n=w(e,1.45,2.45);return{...b,yaw:r*(-.42*a+.42*n),gx:r*(-.08*a+.08*n),x:r*(-.03*a+.03*n),rot:r*(-.03*a+.03*n)}}},wink:{len:2,pose(e,t){let r=w(e,.8,1.35),a=.08*w(e,.7,1.55);return t?{...b,lidL:1-r,rot:-a}:{...b,lidR:1-r,rot:a}}},sleepy:{len:3.2,hold:!0,pose(e){let t=w(e,1.5,1.95),r=.8*(0,d.smoothstep)(.1,1.5,e)*(1-.8*t)+.2*(0,d.smoothstep)(1.95,3.1,e),a=1-.7*r;return{...b,y:.07*r,rot:.1*r,gy:.05*r,lidL:a,lidR:a}}},spin:{len:3,pose(e,t){let r=t?-1:1,a=-.25*w(e,0,.45)+x*(0,d.smoothstep)(.3,1.75,e),n=e>1.7?Math.exp(-(e-1.7)/.55)*(0,d.smoothstep)(1.7,1.85,e):0,l=1.5*x*(e-1.7),i=1-.3*n;return{...b,spin:r*a,axis:.62*r,x:.035*n*Math.sin(l),y:.022*n*Math.cos(l),rot:.07*n*Math.sin(l+.6),gx:.06*n*Math.sin(1.3*l),gy:.04*n*Math.cos(1.3*l),lidL:i,lidR:i}}}},A=Object.keys(k),O=A.filter(e=>k[e].wake),S=A.filter(e=>!k[e].wake),E=(e,t,r,a)=>e+(t-e)*(1-Math.exp(-a/r)),_=e=>Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.rot)+Math.abs(e.yaw)+Math.abs(e.pitch)+Math.abs(e.spin)+Math.abs(e.sx-1)+Math.abs(e.sy-1)<1e-4;function L(e,t){e.parts.length>=2200||e.parts.push({...t,age:0,seed:60*Math.random()})}let N={rise:0,riseT:1,splay:0,wall:0,home:0,peel:0,side:0,hitAt:-1,peeled:!1},R={x:0,y:0},I={v:0,kind:0,hold:0,covers:!1},T=(e,t,r)=>e+(t-e)*r,z=(e,t,r)=>{let a,n=(a=(r-e)/(t-e))<0?0:a>1?1:a;return n*n*(3-2*n)};function P(e,t=!1,r=0){let a,n=t=>f(e,7*t+3,1),l=.5>n(3)?-1:1,i=(.26+.18*n(2))*l,s=[0,0],o=e=>[l*e*(.15+.07*n(9)),(n(10)-.5)*.07],h=e=>({ms:.62+.2*n(11),tilt:0,gaze:s,blink:[e,e+.22]});switch(t?[0,2,3,4][4*n(1)|0]:5*n(1)|0){case 0:a=[{ms:1.3+.9*n(4),tilt:0,gaze:s,snap:.01},{ms:1.4+.9*n(5),tilt:0,gaze:s},h(.12),{ms:1.2+.9*n(6),tilt:0,gaze:o(1),snap:.1},{ms:1.3+.9*n(7),tilt:0,gaze:s,snap:.12},{ms:.95,tilt:0,gaze:s,blink:[.1,.3],blink2:.5>n(8)?[.44,.64]:null},{ms:1.6+1.2*n(12),tilt:0,gaze:s}];break;case 1:a=[{ms:.9+.5*n(4),tilt:0,gaze:s,snap:.01},{ms:.8+.5*n(5),tilt:0,gaze:s},h(.1),{ms:.7+.6*n(6),tilt:0,gaze:s}];break;case 2:a=[{ms:1.2+.8*n(4),tilt:0,gaze:s,snap:.01},{ms:1.6+1.2*n(13),tilt:i,gaze:s,snap:.9},{ms:.8,tilt:i,gaze:s,blink:[.14,.36]},{ms:1.8+1.1*n(5),tilt:0,gaze:s,snap:.75},{ms:1.5+1.3*n(6),tilt:0,gaze:s}];break;case 3:a=[{ms:.9+.5*n(4),tilt:0,gaze:s,snap:.01},{ms:1.1+.7*n(5),tilt:0,gaze:o(1.1),snap:.09},{ms:1.4+.8*n(6),tilt:0,gaze:s,snap:.12},{ms:1,tilt:0,gaze:s,blink:[.08,.28],blink2:[.42,.62]},{ms:1.4+1.2*n(7),tilt:0,gaze:s}];break;default:a=[{ms:1.2+.7*n(4),tilt:0,gaze:s,snap:.01},{ms:1.2+.7*n(5),tilt:0,gaze:s},{ms:1+.6*n(6),tilt:0,gaze:o(1),snap:.09},{ms:.9+.5*n(7),tilt:0,gaze:o(-.85),snap:.09},{ms:1.2+.8*n(8),tilt:0,gaze:s,snap:.12},h(.12),{ms:1.3+ +n(12),tilt:0,gaze:s}]}let u=0;for(let e of a)u+=e.ms;for(let e=20;u<r;e+=2){let t=2.6+1.8*n(e);a.push({ms:t,tilt:0,gaze:s,blink:.7>n(e+1)?[.4,.62]:void 0}),u+=t}return{beats:a,total:u}}let j={gaze:[0,0],tilt:0,lid:1};var V=e.i(877267);let F=(e,t,r)=>e+(t-e)*r,C=(e,t,r,a)=>a<.5?e+(t-e)*a*2:t+(r-t)*(a-.5)*2;function $(e,t,r){return .58+.07*Math.sin(.35*r)+(g(.011*e+.04*r,.011*t-.03*r,.22*r,2)-.5)*.6}function D(){let e={face:0,hush:0,dim:0,ink:0,reach:0,few:0,narrow:0,hard:0,haze:0,sigh:{live:!1,t0:0,dir:Math.PI/2,seed:0,now:0,front:0},ways:{jumble:new Float32Array(257),reach:new Float32Array(257),gush:new Float32Array(257),gust:new Float32Array(257),lobe:new Float32Array(257)}};return K(e),e}function K(e){let t=F(.52,1,e.face);e.ink=F(1.52,2.5,e.face),e.reach=F(2.2,4,e.face),e.haze=F(.27,.57,e.face),e.few=C(4.2,1.9,1,t),e.narrow=C(.3,.17,.04,t),e.hard=C(2.6,2,1.25,t)}function q(e,t){return(0,d.smoothstep)(0,.05,e)*Math.max(.18,Math.exp(-Math.max(0,e-.5)/.3))*(.6+.8*g(5*e+t,1.7,2.9,2))}function B(e,t,r,a,n,l,i=!0){let s=e.sigh;i&&l>=0&&l<.3&&!s.live&&(s.live=!0,s.t0=t-l,s.dir=Math.PI/2+(.5>Math.random()?-1:1)*(.7+(Math.random()-.5)*.3),s.seed=50*Math.random());let o=(t-s.t0)*.65;s.live&&o>2.4&&(s.live=!1),s.now=s.live?q(o,s.seed)*(1-(0,d.smoothstep)(.855,2.4,o))*1.5*(0,d.smoothstep)(0,.25,o):0,s.front=.55+1.53*(1-Math.exp(-Math.max(0,o)/.6))+.18*Math.max(0,o),e.dim=Math.max(n,e.dim*Math.exp(-r/2.2));let h=l>=0?a*(0,d.smoothstep)(.65,.65+.2,l):0,u=h>e.face?2.05/2.3:.5;e.face+=(h-e.face)*(1-Math.exp(-r/u)),K(e);let c=e.ways;for(let e=0;e<=256;e++){let r=-Math.PI+e/256*Math.PI*2,a=Math.cos(r),n=Math.sin(r);c.jumble[e]=(g(2.2*a+11,2.2*n,.35*t,2)-.5)*220,c.reach[e]=Math.max(0,g(1.1*a+5,1.1*n,.12*t,2)-.22),c.gush[e]=(0,d.smoothstep)(.5,.78,g(1.6*a+3,1.6*n,.5*t,2)),c.gust[e]=.4+1.2*g(1.2*a+7,1.2*n,.4*t,2),s.live&&(c.lobe[e]=1.53*(.5+ +g(1.4*a+s.seed,1.4*n,.3*o,2)))}}function W(e,t){let r=(t+Math.PI)/(2*Math.PI)*256,a=Math.min(255,Math.max(0,Math.floor(r)));return e[a]+(e[a+1]-e[a])*(r-a)}function H(e,t,r,a,n,l,i){let s=e.px??e.dx,o=e.py??e.dy,h=e.sx??e.dx,u=e.sy??e.dy,c=.018*i.g*Math.min(1,e.dist/a)**2*a,f=Math.hypot(s-i.x*c,o-i.y*c),m=1-(0,d.smoothstep)(.55*a,a,f),p=m>0?($(e.dx,e.dy,t)+r)*m:0;l.dim>.002&&(p*=1-.16*l.dim);let M=1-l.hush,x=Math.hypot(h-i.x*c,u-i.y*c);if(l.haze>0&&M>0&&x<1.32*a){let e=l.haze*M*(1-.39*l.dim)*(1-(0,d.smoothstep)(.9*a,1.32*a,x))*n;if(1.55*e>p){let r=e*(.45+1.1*y(.012*h+11,.012*u,.15*t,2));r>p&&(p=r)}}let w=.55+Math.max(0,.92*l.ink-.55)*(0,d.smoothstep)(.92*a,1.14*a,x);if(M>0&&w*n*M>p){let e=function(e,t,r,a,n,l,i,s,o){let h;if(n>a*(i.reach+.2+.54))return 0;let u=.087*s.g*n,c=e-s.x*u,f=t-s.y*u,m=Math.hypot(c,f)||1,p=Math.atan2(f,c),M=i.few/(1+.006*n),x=g(c/m*M,f/m*M,.008*(n-66*r-W(i.ways.jumble,p)),3),w=function(e,t){let r=e.sigh;if(!r.live||r.now<=.01)return 0;let a=t-r.dir;return a-=Math.round(a/(2*Math.PI))*Math.PI*2,r.now*(1-(0,d.smoothstep)(1.3608,3.024,Math.abs(a)))}(i,p),b=i.sigh.front,v=w>0?w*(1-(0,d.smoothstep)(b-.35,b+.05,n/a)):0,k=w>0?w*((h=b-1)<0?0:h>1?1:h):0,A=a*(1.05+(i.reach-1.05)*Math.min(1,2.4*W(i.ways.reach,p))+.54*k),O=(0,d.smoothstep)(.55*a,A,n),S=.4+i.narrow*O;if(1.2*x<=S)return 0;let E=x*(.8+.4*y(.02*e+3,.02*t,.3*r,2)),_=(3.2*Math.max(0,E-S))**i.hard;return _<=0?0:(_*=1+.9*W(i.ways.gush,p)+1.2*v,i.dim>.002&&(_*=1-.65*i.dim),Math.min(o,_*(1-O)**1.25*(.6+.65*(s.g*W(i.ways.gust,p)))*i.ink)*l)}(h,u,t,a,x,n,l,i,w)*M;e>p&&(p=e)}if(n<.98&&p>0){let t=y(.015*e.dx-7,.015*e.dy+3,11.4,2);p*=(0,d.smoothstep)(t-.34,t+.34,1.7*n-.24)}return p}function U(e,t,r,a){let n=a.sigh;if(!n.live)return 0;let l=(t-n.t0)*.65,i=e.dist/r-.55;if(i<=0)return 0;let s=Math.atan2(e.py??e.dy,e.px??e.dx)-n.dir;if(Math.abs(s-=Math.round(s/(2*Math.PI))*Math.PI*2)>3.141592653589793)return 0;let o=W(a.ways.lobe,s);if(i>o*(1-Math.exp(-l/.6))+.18*l)return 0;let h=-.6*Math.log(1-Math.min(i/o,.97));for(let e=0;e<3;e++){let e=Math.exp(-h/.6);h-=(o*(1-e)+.18*h-i)/(o*e/.6+.18)}let u=l-h;if(h<0||u<0||u>1.9)return 0;let c=q(u,n.seed),f=1-(0,d.smoothstep)(.855,2.4,l);if(c*f<.01)return 0;s+=(g(1.8*i,2.2*u,.3*t,2)-.5)*1.1*(.3+h);let m=Math.min(Math.PI,(.95+1.45*(1-Math.exp(-h/.45)))*1.8*(.55+.9*g(2.2*i+n.seed,1.7*u,3.3,2))),p=1-(0,d.smoothstep)(.55*m,m,Math.abs(s));if(p<=0)return 0;let M=1+.4*h,x=(3*Math.max(0,g(2.2*s/M+4,3*u+.6*i/M,5.1,3)-.32))**1.4,w=1-(0,d.smoothstep)(.15,.9,i)*(1-Math.min(1,.45+x)),b=1/(1+(i/.81)**2),v=(0,d.smoothstep)(.25,.65,y(.014*e.dx+n.seed,.014*e.dy,.9*u+.2*t,2)),k=1-.65*(0,d.smoothstep)(.1,.7,i)*(1-v);return Math.min(.95,$(e.dx,e.dy,t)*c*f*p*w*b*k*3.5)}e.s(["createSmoke",0,D,"restValue",0,H,"sighValue",0,U,"stepSmoke",0,B],732061);let G=(e,t,r)=>{let a,n=(a=(r-e)/(t-e))<0?0:a>1?1:a;return n*n*(3-2*n)},J=[{letters:["0","1","7","4","9","2","8","3","5","6"],emoji:["🤍","🖤","⚪","⚫","☁️","🦢","🐧","🐼","🎱","🕊️"]},{letters:["/","\\","|","_","-","~","^","<",">","="],emoji:["🌑","🌒","🌓","🌔","🌕","🌖","🌗","🌘","🌙","🌚"]},{letters:["(",")","[","]","{","}",":",";","*","+"],emoji:["❄️","🫧","💧","🌊","🧊","🐳","🐟","🪸","🌌","🔮"]},{letters:[".",",","'","`",":",'"',";","·","*","^"],emoji:["🗿","💬","🖨️","📀","🗝️","🧷","📎","🖇️","🧮","🔭"]}];function X(e,t,r,a,n){let l=Math.floor(r/a);return Q(e,t,r,l*a+.6+f(l,11,5)*a*.45,n*(.6+3.4*f(l,17,9)**2),l)}function Y(e){let t=e;for(let e=0;e<400;e++,t++){let e=1+t%J.length;if(.25>f(t,19,7)&&(2===e||3===e)&&.35>f(t,3,2))break}return t}function Q(e,t,r,a,n,l){let i=r-a;if(i<0||i>n)return 0;let s=G(0,1.7+2.6*f(l,3,2),i),o=G(n-(1.5+2.8*f(l,4,3)),n,i),h=1+(4*f(l,19,7)|0);for(let r=0;r<h;r++){let a=(f(7*l+r,23,1)-.5)*300,n=(f(7*l+r,29,2)-.5)*300,i=e-a,h=t-n,u=Math.hypot(i,h),c=470*s*(.4+1.1*g(.011*i+l,.011*h,3.3*r,3));if(u>=c||o>.85*g(.016*i-4,.016*h+6,5.1*r+1,2)+.1)continue;let d=1-u/Math.max(1,c);if(!(g(.05*e+r,.05*t,2.7*l,2)>.95*d+.34))return 1+(l+r)%J.length}return 0}e.s(["WASH_SETS",0,J,"wakingSlot",0,Y,"washAt",0,X,"washOnce",0,Q],298293);let Z=1e3/240,{fontSize:ee,density:et}=u.ASCII_FACE,er=e=>`700 ${e}px ui-monospace,SFMono-Regular,Menlo,monospace`,ea=(e,t,r)=>er(e*(.5+.5*(0,d.emojiWeight)(t,r))),en=[235,235,235];function el(e){let t=[[],[],[],[],[]],r=0;for(let a of Array.from(e.toUpperCase())){let e=d.LETTERS[a];if(e){if(t[0].length)for(let e of t)e.push(-1);e.forEach((e,a)=>{for(let n of e)t[a].push("#"===n?r:-1)})," "!==a&&r++}}return t}let ei=el("ERROR");function es(e,t,r,a,n){return e+(t-e)*Math.min(1,n/(t>e?r:a))}function eo(e,t,r,a,n,l){let i=Math.floor(t/(a*l)+e[0].length/2),s=Math.floor(r/(n*l)+e.length/2);return s<0||s>=e.length?-1:e[s][i]??-1}let eh=[...J,{letters:["~","s","S","§","~","∫","s","≈","S","~"],emoji:["💨","☁️","🌫️","💨","☁️","🫧","💭","💨","☁️","🌫️"]},{letters:["*",":","'",".","*",",",":","`","*",";"],emoji:null}],eu=J.length,ec={gap:1,size:1.1},ed=e=>e<0?0:e>1?1:e;function ef(e,t,r,a){let n=e=>Math.max(1,Math.min(3,Math.floor(625.6/(e[0].length*t)),Math.floor(421.6/(e.length*r)))),l=el(a),i=3>n(l)?function(e){let t=Array.from(e.trim()),r=t.flatMap((e,t)=>" "===e?[t]:[]);if(!r.length)return null;let a=t.length/2,n=r.reduce((e,t)=>Math.abs(t-a)<Math.abs(e-a)?t:e),l=el(t.slice(0,n).join("")),i=el(t.slice(n+1).join(""));if(!l[0].length||!i[0].length)return null;let s=Math.max(-1,...l.flat())+1,o=Math.max(l[0].length,i[0].length),h=(e,t)=>{let r=Math.floor((o-e.length)/2);return[...Array(r).fill(-1),...e.map(e=>e<0?e:e+t),...Array(o-e.length-r).fill(-1)]},u=()=>Array(o).fill(-1);return[...l.map(e=>h(e,0)),u(),u(),...i.map(e=>h(e,s))]}(a):null,s=i&&n(i)>n(l)?i:l,o=n(s),h=0;for(let a of e)a.word=eo(s,a.dx,a.dy,t,r,o),h=Math.max(h,a.word+1);return h}function em({className:e,mode:t="idle",size:r=680,color:a=en,getSpectrum:n,word:l=null,waking:i=!1}){let s=(0,h.useRef)(null),f=(0,h.useRef)(null),m=(0,h.useRef)([]),y=(0,h.useRef)(null),x=(0,h.useRef)({cur:[...a],target:a}),w=(0,h.useRef)(0),v=(0,h.useRef)(n);v.current=n;let A=(0,h.useRef)({phrase:0,bob:0,bobVel:0,amp:[,,,,].fill(0),phase:Array.from({length:4},(e,t)=>2.1*t),spin:0,rings:[]}),F=(0,h.useRef)({mode:t,start:0}),C=(0,h.useRef)(performance.now()),$=(0,h.useRef)(90*Math.random()).current,K=(0,h.useRef)({scale:.3,lift:0,gather:0,comet:0,speech:0,err:0,word:0}),q=(0,h.useRef)(null),W=(0,h.useRef)({cw:1,ch:1}),G=(0,h.useRef)({script:null,from:0,until:0}),J=(0,h.useRef)(null),el=(0,h.useRef)(i);return(0,h.useEffect)(()=>{let e=s.current;if(!e)return;let t=.95*ee/et,a=1.25*ee/et,n=680/r,l=t*n,i=a*n,o=Math.max(1,Math.floor(625.6/(ei[0].length*l)));w.current=r,W.current={cw:l,ch:i};let h=[],u=Math.ceil(r/t),c=Math.ceil(r/a),p=new Int32Array(u*c).fill(-1);for(let e=0;e<c;e++)for(let s=0;s<u;s++){let c=s*t,f=e*a,m=(c-r/2)*n,g=(f-r/2)*n,y=Math.hypot(m,g),M=eo(ei,m,g,l,i,o);M<0&&y>328||(p[e*u+s]=h.length,h.push({x:c+t/2,y:f+a/2,dx:m,dy:g,dist:y,angle:Math.atan2(g,m),cos:y>0?m/y:1,sin:y>0?g/y:0,seed:(0,d.hash)(s,e),grain:(0,d.hash)(5.7*s+19,2.3*e+53),gap:.05+.3*(0,d.hash)(7.3*s+11,3.1*e+5),speck:(0,d.hash)(4.1*s+23,6.3*e+41),letter:M,word:-1}))}m.current=h,J.current={cells:h,cols:u,rows:c,cw:l,ch:i,half:340,at:p,field:328},q.current&&ef(h,l,i,q.current.text),y.current={byLevel:Array.from({length:d.LEVELS},()=>new Int32Array(h.length)),inLevel:new Int32Array(d.LEVELS),glyph:Array(h.length),fast:new Float32Array(h.length),slow:new Float32Array(h.length),wasLevel:new Int8Array(h.length).fill(-9),turn:new Int32Array(h.length).fill(-9),pick:new Int32Array(h.length),pool:new Int8Array(h.length),poolFor:new Float32Array(h.length)};let g=Math.min(2,window.devicePixelRatio||1);e.width=r*g,e.height=r*g,e.style.width=`${r}px`,e.style.height=`${r}px`;let M=e.getContext("2d");return M&&(M.setTransform(g,0,0,g,0,0),M.textAlign="center",M.textBaseline="middle","emoji"===(0,V.faceGlyphs)()&&function(e,t,r){if(0===r.length)return;let a=new Set(d.EMOJI_POOL);for(let e of eh)for(let t of e.emoji??[])a.add(t);let n=d.LEVELS-1,l=[];for(let e=1;e<=n;e++)l.push(ea(t,e,n));for(let t of l){e.font=t;let n=0;for(let t of a){let a=r[97*n++%r.length];e.fillText(t,a.x,a.y)}}e.clearRect(0,0,e.canvas.width,e.canvas.height)}(M,ee,h),f.current=M),()=>{M?.clearRect(0,0,r,r),m.current=[],J.current=null,y.current=null}},[r]),(0,h.useEffect)(()=>{x.current.target=a},[a]),(0,h.useEffect)(()=>{F.current.mode!==t&&(F.current={mode:t,start:.001*performance.now()})},[t]),(0,h.useEffect)(()=>{if(!l||Date.now()-l.at>(l.hold??3.4)*1e3)return;let{cw:e,ch:t}=W.current,r=performance.now();if(q.current={text:l.text,start:.001*r,letters:ef(m.current,e,t,l.text),hold:l.hold??3.4},r-C.current<600){let e=K.current;e.word=1,e.scale=0}},[l]),(0,h.useEffect)(()=>{let e,t=0,r=(0,c.createVoiceFollower)(),a="letters"===(0,V.faceGlyphs)(),n=a?.4:.264,l=D(),i=(e=new Float32Array(0),{deck:[],lastWake:null,head:{...b},smoke:{...b},want:{hush:0,crust:0},doing:{hush:0,crust:0},yawSlow:0,yawV:0,moved:!1,turned:!1,hx:e,hy:e,hz:e,px:e,py:e,pd:e,sx:e,sy:e,crust:0,crustSeed:40*Math.random(),crustWas:new Uint8Array(0),crusted:0,crustedNow:0,parts:[],live:!1,calm:1,thick:e,top:e,kind:new Int8Array(0),keep:e}),s={dx:0,dy:0,dist:0,px:0,py:0,sx:0,sy:0},o=Array(c.SPECTRUM_BANDS).fill(0),h=.001*performance.now(),C=0,W=0,et=el.current?{slot:Y(4e3*Math.random()|0)}:null;if(et){let e=P(1e6*Math.random()|0,!0);G.current={script:e,from:.15,until:1.4+e.total+1.5}}let en=-1/0,ei=e=>{var c,V;if(e-en<1e3/u.ASCII_FACE.fps-Z){t=requestAnimationFrame(ei);return}en=e;let D=.001*e,Y=Math.min(.05,Math.max(0,D-h));h=D;let el=f.current,eo=y.current,ef=J.current;if(!el||!eo||!ef){t=requestAnimationFrame(ei);return}let em=w.current;eo.inLevel.fill(0);let ep=v.current?.();if(!ep||ep.length<2){for(let e=0;e<o.length;e++){let t=.5*Math.sin(1.7*D+1.7*e)+.3*Math.sin(.8*D+.6*e)+.2*Math.sin(3*D+2.9*e);o[e]=.5*t+.5}ep=o}let eg=A.current,ey=Math.max(1,Math.round(60*Y)),eM=r.read(ep,Y);eg.phrase=eM.phrase,eM.onset>0&&(eg.bobVel+=.06*eM.onset,eg.rings.push({born:D,power:eM.onset}),eg.rings.length>5&&eg.rings.shift());for(let e=0;e<ey;e++)eg.bobVel+=-(.012*eg.bob)-.09*eg.bobVel,eg.bob+=eg.bobVel;C+=Y;for(let e=0;e<4;e++){let t=Math.floor(e*eM.bands.length/4),r=Math.max(t+1,Math.floor((e+1)*eM.bands.length/4)),a=0;for(let e=t;e<r;e++)a+=eM.bands[e];a/=r-t;let n=.7+.6*(0,d.hash)((.9*D|0)+31*e,e);eg.amp[e]+=(a*n-eg.amp[e])*(1-(1-(.05+.02*e))**ey),eg.phase[e]+=Y*(.9+.5*e)*(e%2?-1:1)}for(eg.spin+=Y*(1.1+.9*eg.phrase);eg.rings.length>0&&D-eg.rings[0].born>.7;)eg.rings.shift();let ex=F.current,ew=q.current,eb=ew?D-ew.start:0,ev=null!==ew&&"error"!==ex.mode&&eb<ew.hold+.08*ew.letters+.45+.35+.9,ek=function(e,t){let r={scale:1,lift:0,gather:0,comet:0,speech:0,err:0,word:0};switch(e){case"idle":return r;case"connecting":{let e=1-Math.exp(-t/1.3);return{...r,scale:.45+.55*e,lift:.06*e,gather:1}}case"speaking":return{...r,speech:1};case"working":return{...r,scale:0,comet:1};case"ending":return{...r,scale:0};case"error":return{...r,scale:0,err:1}}}(ex.mode,D-ex.start);ev&&(ek.word=1,null!==ew&&eb<ew.hold&&(ek.scale=0,ek.lift=0,ek.gather=0,ek.comet=0,ek.speech=0));let eA=K.current;eA.scale=es(eA.scale,ek.scale,.45,"ending"===ex.mode?.4:.7,Y),eA.lift=es(eA.lift,ek.lift,.22,.4,Y),eA.gather=es(eA.gather,ek.gather,.3,.95,Y),eA.comet=es(eA.comet,ek.comet,.45,.9,Y),eA.speech=es(eA.speech,ek.speech,.5,.75,Y),"error"===ex.mode&&(eA.err<=.01&&(W=0),W+=Y),eA.err=es(eA.err,ek.err,.5,.6,Y),eA.word=es(eA.word,ek.word,.35,.5,Y);let eO=eA.err>.5,eS=eA.word>.5,eE=M(C,$),e_=Math.exp(-Y/.085),eL=Math.exp(-Y/.8),eN=eA.scale*(1-eA.speech)*(1-eA.comet)*(1-eA.gather),eR=null,eI=0,eT=0,ez=0,eP=-1,ej=null,eV=-1,eF=G.current,eC=eN>.4&&!eO&&!eS,e$=(0,d.smoothstep)(.4,.75,eN)*(1-(0,d.smoothstep)(0,.5,eA.word));if(!eC&&void 0===eF.cut&&eF.script&&C>eF.from&&C<eF.until&&(eF.cut=C),eC&&void 0===eF.cut&&C>eF.until){let e=0===eF.until,t=function(e){let[t,r]=function(e){let t=e.deck;if(!t.length){for(let e of O)for(let r of S)t.push([e,r]);for(let r=0;r<200;r++){for(let e=t.length-1;e>0;e--){let r=Math.random()*(e+1)|0;[t[e],t[r]]=[t[r],t[e]]}let r=t[t.length-1][0]!==e.lastWake;for(let e=1;r&&e<t.length;e++)r=t[e][0]!==t[e-1][0];if(r)break}}let r=t.pop()??[O[0],S[0]];return e.lastWake=r[0],r}(e),a=11*(.75+.5*Math.random()),n=Math.max(Math.max(k[t].len,1.5)+.8,a-k[r].len),l=(e,t)=>({key:e,at:t,m:.5>Math.random(),thrown:0,owed:0});return{items:[l(t,0),l(r,n)],open:n+k[r].len+.8*!k[r].hold}}(i);eF.plan=t,eF.script=P(1e3*C|0,!1,t.open),eF.from=C+(e?.15:17*(.55+.9*Math.random())),eF.until=eF.from+1.25+Math.max(eF.script.total,t.open)+1.5}if(eC||void 0!==eF.cut){let e=C-eF.from,t=eF.until-eF.from;if(eF.script&&e>0){let r=(0,d.smoothstep)(.4,.75,eN),a=t-1.5-.3,n=void 0===eF.cut?ed((e-a)/1.35):Math.max(ed((e-a)/1.35),ed((C-eF.cut)/.4));eI=(0,d.smoothstep)(.75,1.05,e);let l=function(e,t){let r=0,a=[0,0],n=0;for(let l of e.beats){let e=t-r;if(e<l.ms){let t=z(0,l.snap??.12,e),r=1;for(let t of[l.blink,l.blink2])!t||e<=t[0]||e>=t[1]||(r*=Math.abs(Math.cos(Math.PI*((e-t[0])/(t[1]-t[0]))))**.7);return{gaze:[T(a[0],l.gaze[0],t),T(a[1],l.gaze[1],t)],tilt:T(n,l.tilt,t),lid:r}}r+=l.ms,a=l.gaze,n=l.tilt}return j}(eF.script,Math.max(0,e-.875)),i=l.lid*(0,d.smoothstep)(.75,1.13,e),s=(1-n)**2.2;eR={...l,gaze:[l.gaze[0],l.gaze[1]+.04*(0,d.smoothstep)(0,.65,n)],lid:i*s,fall:i*(1-s)*.3999999999999999},eT=eI*(1-n)*r,ez=(0,d.smoothstep)(.1,.9,n)*r,r>.5&&(eP=e-.75),void 0===eF.cut?(ej=eF.plan??null,eV=e-.75):n>=1&&(eF.until=C,eF.cut=void 0,eR=null,eI=0)}}let eD=170*1.08*Math.max(.02,eA.scale);eR=function(e,t,r,a,n,l,i,s,o){var h;h=t.cells.length,e.hx.length!==h&&(e.hx=new Float32Array(h),e.hy=new Float32Array(h),e.hz=new Float32Array(h),e.px=new Float32Array(h),e.py=new Float32Array(h),e.pd=new Float32Array(h),e.sx=new Float32Array(h),e.sy=new Float32Array(h),e.crustWas=new Uint8Array(h),e.thick=new Float32Array(h),e.top=new Float32Array(h),e.kind=new Int8Array(h),e.keep=new Float32Array(h),e.parts.length=0,e.live=!1),e.calm=o,e.crusted=e.crustedNow,e.crustedNow=0;let u=b,c=e.want;if(c.hush=0,c.crust=0,n&&l>-1){let o={...b},h=!1;for(let r of n.items){let n=k[r.key],i=l-r.at;if(n.fx?.(i,r.m,c,e,t,r,a,s),i<(n.wake?-.8:0)||!n.hold&&i>n.len+.6)continue;let u=n.pose(i,r.m);u!==b&&(h=!0,o.x+=u.x,o.y+=u.y,o.rot+=u.rot,o.yaw+=u.yaw,o.pitch+=u.pitch,o.spin+=u.spin,u.spin&&(o.axis=u.axis),o.gx+=u.gx,o.gy+=u.gy,o.sx*=u.sx,o.sy*=u.sy,o.lidL*=u.lidL,o.lidR*=u.lidR,o.size*=u.size)}if(i&&l>=0){let e;o.yaw+=.08*(g(.13*r+3.1,1.7,.4,2)-.5)*2*(0,d.smoothstep)(0,1.2,l)*((e=i.lid)<0?0:e>1?1:e),h=!0}h&&(u=o)}let f=e.doing;f.hush=E(f.hush,c.hush,.15,a),f.crust=E(f.crust,c.crust,.1,a),e.crust=f.crust;let m=e.head,y=m.yaw,M=u!==b?.045:o<.99?.3:.6;m.spin=u.spin+Math.atan2(Math.sin(m.spin-u.spin),Math.cos(m.spin-u.spin)),u.spin&&(m.axis=u.axis),m.x=E(m.x,u.x,M,a),m.y=E(m.y,u.y,M,a),m.rot=E(m.rot,u.rot,M,a),m.yaw=E(m.yaw,u.yaw,M,a),m.pitch=E(m.pitch,u.pitch,M,a),m.spin=E(m.spin,u.spin,M,a),m.sx=E(m.sx,u.sx,M,a),m.sy=E(m.sy,u.sy,M,a),e.yawV=(m.yaw-y)/Math.max(a,.001);let x=e.smoke;e.yawSlow=E(e.yawSlow,m.yaw,.3,a);let w=1-Math.exp(-a/.12);return(x.x+=(m.x+.25*Math.sin(e.yawSlow)-x.x)*w,x.y+=(m.y-x.y)*w,x.rot+=(m.rot-x.rot)*w,x.sx+=(m.sx-x.sx)*w,x.sy+=(m.sy-x.sy)*w,e.moved=!(_(m)&&_(x)),e.turned=Math.abs(m.yaw)+Math.abs(m.pitch)+Math.abs(m.spin)>1e-4,e.moved&&function(e,t,r){let a=t.cells,n=e.head;{let t=Math.cos(n.rot),l=Math.sin(n.rot),i=n.x*r,s=n.y*r,o=e.turned?function(e){let t=Math.cos(e.yaw),r=Math.sin(e.yaw),a=Math.cos(e.pitch),n=Math.sin(e.pitch),l=[t,r*n,r*a,0,a,-n,-r,t*n,t*a];if(!e.spin)return l;let i=Math.sin(e.axis),s=Math.cos(e.axis),o=Math.cos(e.spin),h=Math.sin(e.spin),u=1-o,c=[o+i*i*u,i*s*u,s*h,i*s*u,o+s*s*u,-i*h,-s*h,i*h,o],d=Array(9);for(let e=0;e<3;e++)for(let t=0;t<3;t++)d[3*e+t]=c[3*e]*l[t]+c[3*e+1]*l[3+t]+c[3*e+2]*l[6+t];return d}(n):null,h=r*r;for(let r=0;r<a.length;r++){let u=a[r].dx-i,c=a[r].dy-s,d=(u*t+c*l)/n.sx,f=(-u*l+c*t)/n.sy;if(e.px[r]=d,e.py[r]=f,e.pd[r]=Math.hypot(d,f),o){let t=Math.sqrt(Math.max(0,h-d*d-f*f));e.hx[r]=o[0]*d+o[3]*f+o[6]*t,e.hy[r]=o[1]*d+o[4]*f+o[7]*t,e.hz[r]=o[2]*d+o[5]*f+o[8]*t}else e.hx[r]=d,e.hy[r]=f,e.hz[r]=1}}let l=e.smoke,i=Math.cos(l.rot),s=Math.sin(l.rot),o=l.x*r,h=l.y*r;for(let t=0;t<a.length;t++){let r=a[t].dx-o,n=a[t].dy-h;e.sx[t]=(r*i+n*s)/l.sx,e.sy[t]=(-r*s+n*i)/l.sy}}(e,t,s),function(e,t,r,a){let n=e.parts;if(!n.length&&!e.live)return;e.calm<.02&&(n.length=0),e.thick.fill(0),e.top.fill(0),e.keep.fill(0);let l=0;for(let i of n){if(i.age+=a,i.age>=i.life)continue;let s=i.x,o=i.y,h=i.keep**a;i.vx*=h,i.vy*=h,i.vy+=(i.fall-i.rise*Math.min(1,i.age/i.riseT))*a,i.splay&&(i.vx+=(0===i.vx?i.seed%2<1?-1:1:Math.sign(i.vx))*i.splay*Math.min(1,i.age/.8)*a),i.wall&&function(e,t){let r=Math.hypot(e.x,e.y);if(r>.94*e.wall){let a=e.x/r,n=e.y/r,l=-n,i=e.vx*a+e.vy*n;if(!e.side){let t=e.vx*l+e.vy*a;e.side=Math.abs(t)>1?Math.sign(t):e.seed%2<1?-1:1}r>e.wall&&i>0&&(e.vx+=-i*a+e.side*i*.85*l,e.vy+=-i*n+e.side*i*.85*a);let s=120*Math.max(0,1-e.age/3.2);e.vx+=e.side*l*s*t,e.vy+=e.side*a*s*t,r>e.wall&&(e.x-=a*(r-e.wall)*.5,e.y-=n*(r-e.wall)*.5),e.hitAt<0&&(e.hitAt=e.age)}if(e.hitAt>=0&&e.age-e.hitAt>e.peel&&r>1){e.peeled||(e.peeled=!0,e.rise=Math.min(e.rise,14));let a=1.2*(r-e.home)*Math.min(1,(e.age-e.hitAt-e.peel)/.6);e.vx-=e.x/r*a*t,e.vy-=e.y/r*a*t}}(i,a);let u=0,c=0;if(i.curl){let e=i.curl*Math.min(1,i.age/.4);!function(e,t,r){let a=.011*e,n=.011*t,l=.3*r;R.x=(p(a,n+.25,l)-p(a,n-.25,l))/.5,R.y=-(p(a+.25,n,l)-p(a-.25,n,l))/.5}(i.x+7*i.seed,i.y,r),u=R.x*e,c=R.y*e}i.x+=(i.vx+u)*a,i.y+=(i.vy+c)*a;let f=i.a*(1-(i.age/i.life)**i.fadeP)*(0,d.smoothstep)(0,.06,i.age)*e.calm,m=i.r0+(i.r1-i.r0)*(1-Math.exp(-i.age/i.grow)),g=Math.min(4,Math.max(1,Math.ceil(Math.hypot(i.x-s,i.y-o)/7)));for(let r=1;r<=g;r++)!function(e,t,r,a,n,l,i,s){let o=Math.min(70,n+9),h=(r+t.half)/t.cw,u=(a+t.half)/t.ch,c=o/t.cw,d=o/t.ch,f=Math.max(0,Math.floor(h-c)),m=Math.min(t.cols-1,Math.ceil(h+c)),p=Math.max(0,Math.floor(u-d)),g=Math.min(t.rows-1,Math.ceil(u+d)),y=1/(o*o),M=t.cells;for(let n=p;n<=g;n++)for(let o=f;o<=m;o++){let h=t.at[n*t.cols+o];if(h<0)continue;let u=M[h].dx-r,c=M[h].dy-a,d=1-(u*u+c*c)*y;if(d<=0)continue;let f=l*d*d;e.thick[h]+=f-e.thick[h]*f,f>e.top[h]&&(e.top[h]=f,e.kind[h]=i),s>e.keep[h]&&(e.keep[h]=s)}}(e,t,s+(i.x-s)*r/g,o+(i.y-o)*r/g,m,f/Math.sqrt(g),i.kind,i.hold);n[l++]=i}n.length=l,e.live=l>0}(e,t,r,a),i&&u!==b)?{...i,gaze:[i.gaze[0]+u.gx,i.gaze[1]+u.gy],lids:[u.lidL,u.lidR],size:u.size}:i}(i,ef,D,Y,ej,eV,eR,eD,e$),l.hush=i.doing.hush,B(l,D,Y,eT,ez,eP,null===ej||null!==(c=ej)&&!0===k[c.items[0].key].sighs);let eK=i.moved,eq=i.live||i.crust>.004||i.crusted>0,eB=m.current;for(let e=0;e<eB.length;e++){let t=eB[e];eK?(s.dx=i.hx[e],s.dy=i.hy[e],s.px=i.px[e],s.py=i.py[e],s.dist=i.pd[e],s.sx=i.sx[e],s.sy=i.sy[e]):(s.dx=s.px=s.sx=t.dx,s.dy=s.py=s.sy=t.dy,s.dist=t.dist);let r=function(e,t,r,a,n,l,i,s,o,h){let u,c,f,m,p=i.scale>.02?H(t,r,i.lift,170*1.08*i.scale,i.scale,o,h)*(1-.6*i.speech):0;return i.gather>.01&&(p+=function(e,t,r){let a=170*r;if(e.speck>=.55||e.dist<.8*a)return 0;let n=Math.min(55,Math.floor((e.angle+Math.PI)/(2*Math.PI)*56)),l=(.7*t+(0,d.hash)(n,5.3))%1,i=e.dist-(a+(320-a)*(1-l)**1.25)-(e.grain-.5)*16;return Math.exp(-(i*i)/260)*(0,d.smoothstep)(0,.2,l)*(1-l)*1.1}(e,r,i.scale)*i.gather),i.comet>.01&&(p+=(c=Math.exp(-((u=e.dist-210)*u)/1100),c*Math.exp(-((m=Math.atan2(Math.sin(f=e.angle-3*r),Math.cos(f)))*m)/(m<0?2.8:.16))*i.comet)),i.speech>.01&&(p+=function(e,t,r,a){var n;let l=170+40*r.phrase+85*r.bob;for(let t=0;t<4;t++)l+=28*r.amp[t]*Math.sin((t+2)*(e.angle+r.spin)+r.phase[t]);let i=170+(((n=l)<=205?Math.max(110,n):205+30*Math.tanh((n-205)/30))-170)*a,s=(e.grain-.5)*20+20*Math.sin(5*e.angle+.9*t+6.283*e.seed)*.3,o=e.dist-(i+s),h=Math.exp(-(o*o)/800)+.5*Math.exp(-(e.dist*e.dist)/6e3);if(e.dist<i&&(h+=.22*(1-e.dist/i)**.6*(.75+.25*Math.sin(.05*e.dist-1.2*t))),e.speck<.22){let a=90*(.6+.9*e.grain);for(let n=0;n<r.rings.length;n++){let l=r.rings[n],s=t-l.born,o=e.dist-(i+6+s*a);h+=Math.exp(-(o*o)/500)*l.power*Math.max(0,1-s/.7)}}return h}(e,r,s,i.speech)*i.speech),i.err>.01&&(p+=function(e,t,r){if(e.letter<0)return 0;let a=r%9.2,n=.12*e.seed;return Math.max(0,(0,d.smoothstep)(0,1,(a-.65*e.letter-n)/.8)-(0,d.smoothstep)(0,1,(a-5.6-.5*e.letter-n)/.7))*(.86+.14*Math.sin(3.5*t+6*e.seed))}(e,r,a)*i.err),i.word>.01&&(p+=function(e,t,r,a){if(e.word<0)return 0;let n=.45*e.seed,l=(0,d.smoothstep)(0,1,(r-.11*e.word-n)/.3),i=r-a-.08*e.word-n,s=(0,d.smoothstep)(0,1,i/.35),o=.2*(1-(0,d.smoothstep)(0,1,(i-.35)/.9));return Math.max(l-s,l>.5?o*s:0)*((l>0&&l<1||s>0&&o>0)&&.35>(0,d.hash)(Math.floor(14*t)+97*e.seed,31*e.grain)?.25:1)*(.86+.14*Math.sin(3.5*t+6*e.seed))}(e,r,n,l)*i.word),p}(t,s,D,W,eb,ew?.hold??3.4,eA,eg,l,eE);if(l.sigh.live){let e=U(s,D,eD,l)*eA.scale;e>r&&(r=e)}let o=!(eO&&t.letter>=0||eS&&t.word>=0),h=0,u=0,c=!1;if(eq&&o){let t=function(e,t,r,a,n,l,i){let s=t.cells[r];if(I.v=a,I.kind=0,I.hold=0,I.covers=!1,e.crust>.004||e.crusted>0){let t=e.moved?e.hx[r]:s.dx,a=e.moved?e.hy[r]:s.dy,n=e.moved?e.pd[r]:s.dist,o=1-(0,d.smoothstep)(.92*l,1.1*l,n),h=!1;if(o>.05){let r=.12+.76*g(.022*t+e.crustSeed,.022*a,2.7,2);(h=e.crust>r)&&(I.v=.42*(.5+.9*g(.09*t,.09*a,5.5,2))*o*i,I.kind=2,I.hold=.15,e.crustedNow++)}e.crustWas[r]&&!h&&.06>Math.random()&&function(e,t,r){let a=Math.sqrt(Math.max(0,r*r-t.dist*t.dist)),n=Math.max(-260,Math.min(260,e.yawV*a*.55)),l=90+80*Math.random();L(e,{...N,x:t.dx,y:t.dy,vx:n+t.cos*l,vy:t.sin*l-30,life:1+.7*Math.random(),a:.45+.25*Math.random(),r0:3,r1:18+12*Math.random(),grow:.6,keep:.3,fall:45,curl:35,kind:2,hold:0,fadeP:1.5}),.35>Math.random()&&L(e,{...N,x:t.dx,y:t.dy,vx:n+t.cos*(120+80*Math.random()),vy:t.sin*l-50,life:.6+.4*Math.random(),a:.9,r0:1.5,r1:2.5,grow:1,keep:.4,fall:300,curl:0,kind:2,hold:0,fadeP:1})}(e,s,l),e.crustWas[r]=+!!h}if(e.live){let t=e.thick[r];if(t>.02){let a=e.kind[r],l=t*i*(.6+.8*p(.04*s.dx+.3*n,.04*s.dy-.2*n,.5*n)),o=.1+.3*s.grain;l>o?(I.v=2===a?.5*(1-Math.exp(-1.5*l)):.3+.62*Math.min(1,l),I.kind=a,I.hold=.12,l>.45&&2===a&&(I.covers=!0)):e.keep[r]>0&&l>.5*o&&(I.kind=a,I.hold=e.keep[r]*(.5+s.grain))}}return I}(i,ef,e,r,D,eD,eA.scale);r=t.v,h=t.kind,u=t.hold,c=t.covers}o&&(r*=(.66+.72*t.grain)*(.8+.4*(0,d.hash)(Math.floor(.05*t.dx+.5*D),Math.floor(.05*t.dy-.3*D))))>.3&&(0,d.hash)(31.7*Math.floor(1.6*D),613*t.seed)>.992&&(r=Math.max(r,.9));let f=!o||h?0:C<42?et?Q(t.dx,t.dy,C,1,2.9,et.slot):0:X(t.dx,t.dy,C,42,3.2);if(h?(eo.pool[e]=eu+h,eo.poolFor[e]=u):f?(eo.pool[e]=f,eo.poolFor[e]=.3+.9*t.grain):eo.poolFor[e]>0?(eo.poolFor[e]-=Y,eo.poolFor[e]<=0&&(eo.pool[e]=0)):eo.pool[e]=0,eI>.03&&null!==eR&&o&&!c&&(V=e,!i.turned||i.pd[V]<.985*eD&&i.hz[V]>0)&&function(e,t,r,a,n,l){if(a<=.03||n.lid<=.02)return!1;let i=r/112,s=i*l.size*(n.size??1);for(let o of[-1,1]){let h=n.lid*(n.lids?n.lids[o<0?0:1]:1);if(h<=.02)continue;let u=e-(44*o*i*l.gap+n.gaze[0]*r),c=t-(-20*i+n.gaze[1]*r+(n.fall??0)*51*s/2),d=Math.cos(n.tilt),f=Math.sin(n.tilt),m=u*d-c*f,p=51*s*h,y=(-(u*f+c*d)+p/2)/p;if(!(y<=0||y>=1||Math.abs(m- - -(2*(1-y)*y*1)*s)>38*s/2*Math.sin(Math.PI*y)**.35)&&!(a<.99&&a<.88*g(.026*u+3,.026*c,7.7,2)+.06))return!0}return!1}(eK?i.hx[e]:t.dx,eK?i.hy[e]:t.dy,eD,eI,eR,ec)){eo.fast[e]=0,eo.slow[e]=0,eo.pool[e]=0;continue}let m=eo.fast[e]=r>eo.fast[e]*e_?r:eo.fast[e]*e_,y=eo.slow[e]=r>eo.slow[e]*eL?r:eo.slow[e]*eL;r=m>.52*y?m:.52*y,o&&r<t.gap+.05*Math.sin(.28*D+6.283*t.seed)&&(r=0);let M=(r=r<0?0:r>1?1:r)*(d.LEVELS-1)|0;if(0===M)continue;let x=C*n+7*t.seed|0;(x!==eo.turn[e]||M-eo.wasLevel[e]>=2||eo.wasLevel[e]-M>=2)&&(eo.turn[e]=x,eo.wasLevel[e]=M,eo.pick[e]=(997*t.seed|0)+x+M);let w=eo.pick[e],b=eo.pool[e]?eh[eo.pool[e]-1]:null,v=a?b?.letters??d.RAMP[M]:b?.emoji??d.EMOJI_POOL;eo.glyph[e]=v[(w%v.length+v.length)%v.length],eo.byLevel[M][eo.inLevel[M]++]=e}el.clearRect(0,0,em,em);let eW=m.current,eH=d.LEVELS-1,eU=x.current;for(let e=0;e<3;e++)eU.cur[e]+=(eU.target[e]-eU.cur[e])*(1-.95**ey);el.fillStyle=`rgb(${0|eU.cur[0]},${0|eU.cur[1]},${0|eU.cur[2]})`,a&&(el.font=er(ee));for(let e=1;e<=eH;e++){let t=eo.inLevel[e];if(0===t)continue;a?el.globalAlpha=d.ALPHA_TOP*(e/eH):(el.globalAlpha=(0,d.emojiAlpha)(e,eH),el.font=ea(ee,e,eH));let r=eo.byLevel[e];for(let e=0;e<t;e++){let t=eW[r[e]];el.fillText(eo.glyph[r[e]],t.x,t.y)}}el.globalAlpha=1,t=requestAnimationFrame(ei)};return t=requestAnimationFrame(ei),()=>cancelAnimationFrame(t)},[]),(0,o.jsx)("canvas",{ref:s,className:e,"aria-hidden":!0,style:{display:"block",pointerEvents:"none"}})}e.s(["AsciiOrb",0,em,"CHURN_EMOJI",0,.264,"CHURN_LETTERS",0,.4,"DESIGN",0,680,"GLYPH_FONT",0,er,"REST_R",0,170*1.08,"TRAIL_FAST",0,.085],387758);var ep=e.i(922521),eg=e.i(647163);let ey={ending:"ending",idle:"idle",connecting:"connecting",listening:"idle",speaking:"speaking",working:"working",delegating:"working"},eM=[247,247,247],ex=[10,10,10];function ew({status:e,failed:t,word:r,size:a,getSpectrum:n,waking:l,className:i}){let s=(0,ep.useIsDark)();return(0,o.jsx)(em,{mode:t?"error":ey[e],word:r,size:a,color:s?eM:ex,getSpectrum:n,waking:l,className:i})}let eb=(0,h.memo)(function({status:e="idle",covered:t=!1,className:r,...a}){let n=(0,h.useRef)(null),[l,i]=(0,h.useState)(null),[s,u]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{let e=n.current;if(!e)return;let t=new ResizeObserver(([e])=>{let t=Math.round(e.contentRect.width);t>0&&i(t)});return t.observe(e),()=>t.disconnect()},[]),(0,h.useEffect)(()=>{let e=requestAnimationFrame(()=>u(!0));return()=>cancelAnimationFrame(e)},[]),(0,o.jsx)("div",{ref:n,className:(0,eg.cn)("aspect-square transition-opacity duration-700 ease-out",s&&null!==l?"opacity-100":"opacity-0",r),children:null!==l&&!t&&(0,o.jsx)(ew,{...a,status:e,size:l})})});e.s(["Face",0,eb],333495)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,496336,e=>{"use strict";var t=e.i(843476),n=e.i(716327),a=e.i(271645),s=e.i(647163);e.s(["FoldedText",0,function({text:e,subject:r,clamp:i="line-clamp-3",tall:o="max-h-40",className:l}){let[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),x=(0,a.useRef)(null),[p,b]=(0,a.useState)(e);return p!==e&&(b(e),c(!1)),(0,a.useEffect)(()=>{let e=x.current;e&&!d&&m(e.scrollHeight>e.clientHeight+1)},[d,e]),(0,t.jsxs)("div",{className:(0,s.cn)("flex items-start gap-1",l),children:[(0,t.jsx)("p",{ref:x,className:(0,s.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep wrap-anywhere",d?(0,s.cn)(o,"overflow-y-auto scrollbar-none"):i),children:e}),(u||d)&&(0,t.jsx)("button",{type:"button",onClick:()=>c(e=>!e),"aria-label":d?`Fold the ${r}`:`Read the whole ${r}`,className:"shrink-0 rounded-md p-0.5 opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(n.ChevronDown,{className:(0,s.cn)("size-3.5",d&&"rotate-180")})})]})}])},835878,e=>{"use strict";var t=e.i(843476),n=e.i(635963);e.s(["BotRoster",0,function({bots:e}){return e.length<2?null:(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:e.map(e=>e.name).join(", "),children:[(0,t.jsx)("span",{className:"flex items-center gap-0.5",children:e.slice(0,3).map(e=>(0,t.jsx)(n.BotMark,{size:18,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"},e.name))}),(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.length," bots"]})]})}])},351866,e=>{"use strict";var t=e.i(843476),n=e.i(401851),a=e.i(689664),s=e.i(716327),r=e.i(24071),i=e.i(51481),o=e.i(508734),l=e.i(919191),d=e.i(632781),c=e.i(825398),u=e.i(263676),m=e.i(271645),x=e.i(815731),p=e.i(496336),b=e.i(683408),h=e.i(660302),f=e.i(127341),g=e.i(6799),k=e.i(95187);let j=(0,k.createServerReference)("7f9bb64ae5decdc5eb16cf9a9298a8a8772204a462",k.callServer,void 0,k.findSourceMapURL,"compactThreadAction");var v=e.i(807038),w=e.i(635963),y=e.i(256604),N=e.i(621285),S=e.i(245629),z=e.i(609856),T=e.i(647163),C=e.i(553429),_=e.i(978411),M=e.i(222055);function A({onClick:e}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":"Fold the room away",className:"grid size-7 shrink-0 place-items-center rounded-full bg-muted text-foreground outline-none transition-colors hover:bg-muted-foreground/20 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(u.X,{className:"size-3.5"})})}function B({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(R,{thread:e}),(0,t.jsx)($,{thread:e}),(0,t.jsx)(q,{thread:e})]})}function R({thread:e}){let{contextTokens:n,tokens:a}=e;return n?(0,t.jsx)("span",{title:`Last step ${(0,T.formatCount)(n)} tokens \xb7 in total in ${(0,T.formatCount)(a.input)} \xb7 out ${(0,T.formatCount)(a.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,T.formatCount)(n)}):null}function $({thread:e}){let{contextTokens:n,contextBudget:a}=e,[s,r]=(0,m.useState)(!1),[i,o]=(0,z.useServerAction)(j,{onOk:()=>r(!0)}),[l,d]=(0,m.useState)(n);if(l!==n&&(d(n),r(!1)),!n||!a)return null;let c=Math.min(1,n/a);return(0,t.jsx)("button",{type:"button",disabled:o||s,onClick:()=>void i(e.id,e.bot.name),title:s?"It summarizes itself at its next step":`Context ${(0,T.formatCount)(n)} of ${(0,T.formatCount)(a)} — it summarizes itself at the end of the bar. Press to have it do so at its next step`,"aria-label":"Summarize this thread's context at its next step",className:"-my-2 flex h-6 shrink-0 items-center rounded-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default",children:(0,t.jsx)("span",{className:"block h-[3px] w-9 overflow-hidden rounded-full bg-muted",children:(0,t.jsx)("span",{className:(0,T.cn)("block h-full rounded-full",s?"animate-pulse bg-muted-foreground/40":c>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*c))}%`}})})})}let D={working:"text-muted-foreground",waiting:T.WAITING_INK,done:"text-foreground",cancelled:"text-muted-foreground"},I={working:"working",waiting:"waiting",done:"done",cancelled:"stopped"};function q({thread:e}){let n="done"===e.status&&e.seen?"text-muted-foreground":D[e.status];return"working"===e.status?(0,t.jsx)(h.ShinyText,{text:I.working,speed:2.2,className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,T.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",n),children:I[e.status]})}function F({thread:e,roster:n,side:a,onPick:s,className:r}){return(0,t.jsx)(f.Tabs,{value:a??e.bot.name,onValueChange:t=>s(t===e.bot.name?null:String(t)),className:(0,T.cn)("shrink-0 gap-0 px-3 pt-1 pb-0.5",r),children:(0,t.jsx)(f.TabsList,{className:"w-full justify-start gap-1 overflow-x-auto rounded-none bg-transparent p-0 scrollbar-none group-data-horizontal/tabs:h-auto",children:n.map(n=>{let a=O(e,n.name);return(0,t.jsxs)(f.TabsTrigger,{value:n.name,className:(0,T.cn)(L,"pl-1.5"),children:[(0,t.jsx)(w.BotMark,{size:16,seed:n.name,color:n.icon?.color,shape:n.icon?.shape,outline:n.icon?.outline,paint:n.icon?.paint,notify:"asking"===a,className:"shrink-0"}),(0,t.jsx)("span",{className:"max-w-28 truncate",children:n.name}),"running"===a&&(0,t.jsx)(d.Loader2,{className:"size-3 animate-spin text-muted-foreground/70"})]},n.name)})})})}let L="h-7 flex-none rounded-full px-3 py-0 text-[12px] text-muted-foreground hover:bg-muted/60 data-active:bg-muted data-active:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-none dark:data-active:border-transparent dark:data-active:bg-muted";function O(e,t){let{room:n}=e;return n.questions.some(e=>e.bot===t)?"asking":"working"===e.status&&n.participants.some(e=>e.bot===t&&"running"===e.state)?"running":null}function E({turn:e,thread:n,self:a}){let s=e.speaker.name===a,r=s?"none":e.speaker.name===W.name?"dark":"secondary",i=null;return(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(ee,{side:s?"start":"end",name:e.speaker.name,mark:(0,t.jsx)(J,{bot:e.speaker}),children:e.entries.map(o=>{if("work"===o.kind)return s?(0,t.jsx)(H,{lines:o.lines,trailing:o.open,bot:e.speaker,thread:n},o.key):(0,t.jsx)(K,{lines:o.lines,trailing:o.open,bot:e.speaker,thread:n},o.key);let l=(0,_.heardBy)(o.line),d=l&&l.name!==e.speaker.name&&l.name!==a&&l.name!==W.name&&l.name!==i?l:null;return l&&(i=l.name),(0,t.jsx)(et,{line:o.line,surface:r,mention:d},o.key)})})})}function K({lines:e,trailing:n,bot:a,thread:s}){var r;let[i,o]=(0,m.useState)(!1),[l,c]=(0,m.useState)(null),u=n?O(s,a.name):null,x=(r=e,[["tool","step"],["say","note"],["stop","stop"],["note","compaction"]].map(([e,t])=>[r.filter(t=>t.kind===e).length,t]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}${1===e?"":"s"}`).join(" · ")),p=e.filter(e=>e.tool?.results!==void 0);if(!u&&!x)return null;let b=e.findLast(e=>"tool"===e.kind||"say"===e.kind),f=i&&e.length>0;return(0,t.jsxs)("div",{className:(0,T.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 p-1",f?"w-full":"w-fit max-w-full"),children:[(0,t.jsxs)("button",{type:"button",disabled:!e.length,"aria-expanded":f,onClick:()=>{o(e=>!e),c(null)},className:"flex min-w-0 items-center gap-2 rounded-xl px-2.5 py-1.5 text-left outline-none transition-colors enabled:hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:["running"===u&&(0,t.jsx)(d.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/60"}),u?(0,t.jsx)(h.ShinyText,{text:"asking"===u?"waiting on you":b?V(b):"working",tone:"asking"===u?"waiting":"muted",speed:2.4,className:(0,T.cn)("min-w-0 truncate text-[12px] leading-4",f&&"flex-1")}):(0,t.jsx)(U,{words:b?V(b):"",facts:[x,function(e){let t=e.flatMap(e=>e.at?[(0,S.toDate)(e.at).getTime()]:[]);if(t.length<2)return"";let n=Math.round((Math.max(...t)-Math.min(...t))/1e3);if(n<1)return"";if(n<60)return`${n}s`;let a=Math.round(n/60);return a<60?`${a} min`:`${Math.floor(a/60)}h ${a%60}m`}(e)].filter(Boolean).join(" · "),grow:f}),e.length>0&&(0,t.jsx)(G,{open:f})]}),!f&&p.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1 px-2 pt-0.5 pb-1.5",children:p.map(e=>e.tool&&(0,t.jsx)(M.StepTile,{tool:e.tool,onOpen:()=>{c(e.id),o(!0)}},e.id))}),f&&(0,t.jsx)("div",{className:"flex min-w-0 flex-col gap-0.5 pt-0.5",children:ec(e).map(e=>"tools"===e.kind?e.lines.map(e=>e.tool&&(0,t.jsx)(M.BotTool,{tool:e.tool,threadId:s.id,collapsed:e.id!==l},e.id)):"stops"===e.kind?(0,t.jsx)("div",{className:"px-1.5 py-1",children:(0,t.jsx)(el,{lines:e.lines})},e.key):e.lines.map(e=>(0,t.jsx)(ei,{line:e,inset:!0},e.id)))})]})}function H({lines:e,trailing:n,bot:a,thread:s}){let r=n?O(s,a.name):null,i=e.some(e=>e.tool&&void 0===e.tool.results);return(0,t.jsxs)(t.Fragment,{children:[ec(e).map(e=>"tools"===e.kind?(0,t.jsx)(P,{lines:e.lines,threadId:s.id},e.key):"stops"===e.kind?(0,t.jsx)(el,{lines:e.lines},e.key):e.lines.map(e=>(0,t.jsx)(ei,{line:e},e.id))),r&&!i&&(0,t.jsx)(h.ShinyText,{text:"asking"===r?"waiting on you":"on the next step…",tone:"asking"===r?"waiting":"muted",speed:2.2,className:"block px-1 font-mono text-[10px]"})]})}function P({lines:e,threadId:n}){return(0,t.jsx)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:e.map(e=>e.tool&&(0,t.jsx)(M.BotTool,{tool:e.tool,threadId:n,collapsed:!0},e.id))})}function U({words:e,facts:n,grow:a=!1}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:(0,T.cn)("min-w-0 truncate text-[12.5px] leading-5 text-foreground/80",a&&"flex-1"),children:e}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] leading-4 text-muted-foreground",children:n})]})}function G({open:e}){return(0,t.jsx)("span",{className:"grid size-5.5 shrink-0 place-items-center rounded-md bg-background text-muted-foreground ring-1 ring-border/60",children:(0,t.jsx)(s.ChevronDown,{className:(0,T.cn)("size-3.5 transition-transform",e&&"rotate-180")})})}function V(e){return"tool"===e.kind&&e.tool?e.tool.note??`${e.tool.name} \xb7 ${e.tool.input}`:(0,T.plainText)(e.text).replace(/\s+/g," ").trim()}function Q({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(X,{from:W,to:e.bot}),(0,t.jsx)(ee,{side:"end",name:W.name,mark:(0,t.jsx)(J,{bot:W}),children:(0,t.jsx)(Z,{dark:!0,className:"py-2 pr-2 pl-3.5",children:(0,t.jsx)(p.FoldedText,{text:e.request,subject:"request",className:"wrap-anywhere"})})})]})}let W={name:C.ROOM_THURSDAY};function X({from:e,to:n}){return(0,t.jsx)("div",{className:"flex animate-in justify-center fade-in duration-300",children:(0,t.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(Y,{bot:e}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,t.jsx)(Y,{bot:n})]})})}function Y({bot:e}){return(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[e.name===W.name?(0,t.jsx)(y.ThursdayMark,{size:15,className:"shrink-0"}):(0,t.jsx)(w.BotMark,{size:15,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function J({bot:e}){return e.name===W.name?(0,t.jsx)(y.ThursdayMark,{size:26,className:"mt-1 shrink-0"}):(0,t.jsx)(w.BotMark,{size:26,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"mt-1 shrink-0"})}function Z({dark:e=!1,children:n,className:a}){return(0,t.jsx)(x.Bubble,{align:"end",variant:e?"default":"secondary",className:"max-w-full",children:(0,t.jsx)(x.BubbleContent,{className:(0,T.cn)("rounded-tr-md px-3.5",a),children:(0,t.jsx)("div",{className:(0,T.cn)("min-w-0",e&&"inverse"),children:n})})})}function ee({side:e,mark:n,name:a,children:s}){return(0,t.jsxs)("div",{className:(0,T.cn)("flex gap-2.5","end"===e&&"flex-row-reverse"),children:[n,(0,t.jsxs)("div",{className:(0,T.cn)("flex min-w-0 flex-1 flex-col gap-1.5 [&>*+*]:max-w-[80%]","end"===e&&"items-end"),children:[(0,t.jsx)("p",{className:"max-w-[80%] truncate px-1 font-mono text-[10px] text-muted-foreground",children:a}),s]})]})}function et({line:e,surface:n,mention:a}){let s=!!e.question,r="result"===e.kind,i="none"!==n,o=(0,v.shortenPaths)(e.text),d=(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(er,{}),a?(0,t.jsx)(es,{bot:a,bubble:i,children:o}):(0,t.jsx)(en,{bubble:i,className:(0,T.cn)(!r&&"leading-snug"),children:o}),(0,t.jsx)(v.Attachments,{text:e.text,onBubble:i,className:"mt-2"})]});return(0,t.jsxs)(t.Fragment,{children:[i?(0,t.jsx)(Z,{dark:"dark"===n,children:d}):(0,t.jsx)("div",{className:"min-w-0 max-w-full px-1",children:d}),e.steppedIn&&(0,t.jsxs)("p",{className:"flex items-center gap-1 px-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(l.CornerDownLeft,{className:"size-2.5"}),"stepped in"]}),r&&(0,t.jsx)("div",{className:"flex px-1",children:(0,t.jsx)(eo,{text:e.text})})]})}function en({children:e,bubble:n=!1,className:a}){return(0,t.jsx)(b.Markdown,{className:(0,T.cn)("min-w-0 max-w-full text-[13px] leading-relaxed wrap-anywhere break-keep [&_h1]:text-[15px] [&_h2]:text-[14px] [&_h3]:text-[13px] [&_h3]:font-semibold [&_li]:my-0.5 [&_table]:text-[12px] [&_table]:wrap-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",n&&"[&_[data-streamdown=inline-code]]:text-[12px] [&_[data-streamdown=code-block]]:my-2 [&_[data-streamdown=code-block]]:gap-0 [&_[data-streamdown=code-block]]:rounded-[10px] [&_[data-streamdown=code-block]]:border-0 [&_[data-streamdown=code-block]]:bg-background [&_[data-streamdown=code-block]]:p-0 [&_[data-streamdown=code-block-header]]:h-7 [&_[data-streamdown=code-block-header]]:px-2.5 [&_[data-streamdown=code-block-header]]:text-[11px] [&_[data-streamdown=code-block-body]]:border-0 [&_[data-streamdown=code-block-body]]:bg-transparent! [&_[data-streamdown=code-block-body]]:px-2.5 [&_[data-streamdown=code-block-body]]:pt-0 [&_[data-streamdown=code-block-body]]:pb-2.5 [&_[data-streamdown=code-block-body]]:text-[12.5px] [&_[data-streamdown=code-block]_div:has(>[data-streamdown=code-block-actions])]:-mt-7 [&_[data-streamdown=code-block-actions]]:mr-1 [&_[data-streamdown=code-block-actions]]:border-0 [&_[data-streamdown=code-block-actions]]:bg-transparent!",a),children:e})}function ea({bot:e,bubble:n}){return(0,t.jsxs)("span",{className:(0,T.cn)("mr-1.5 inline-flex h-5 max-w-full items-center gap-1 rounded-full pr-2 pl-[3px] align-[-4px] text-[12px] leading-none font-medium whitespace-nowrap text-foreground",n?"bg-background":"bg-muted"),children:[(0,t.jsx)(w.BotMark,{size:14,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function es({bot:e,bubble:n,children:a}){return(0,t.jsxs)("div",{className:"min-w-0 max-w-full text-[13px] leading-snug",children:[(0,t.jsx)(ea,{bot:e,bubble:n}),(0,t.jsx)(en,{bubble:n,className:"contents leading-snug [&>p:first-child]:inline",children:a})]})}function er(){return(0,t.jsxs)("p",{className:"mb-1 flex items-center gap-1.5 text-[12px] leading-4 font-medium text-muted-foreground",children:[(0,t.jsx)(i.CircleQuestionMark,{className:"size-3.5 shrink-0"}),"Question"]})}function ei({line:e,inset:n=!1}){return"note"===e.kind?(0,t.jsxs)("details",{className:"w-full px-2 py-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)("span",{className:"h-px flex-1 bg-border"}),(0,t.jsx)("span",{className:"min-w-0 text-center font-mono text-[10px]",children:"Compacted — it goes on from its summary"}),(0,t.jsx)("span",{className:"h-px flex-1 bg-border"})]}),(0,t.jsx)(en,{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px]",children:e.text})]}):(0,t.jsx)(en,{className:(0,T.cn)("text-[12.5px] text-muted-foreground",n?"px-2.5 py-1":"px-1"),children:e.text})}function eo({text:e}){let[n,s]=(0,m.useState)(!1),r=(0,m.useRef)(null);return(0,m.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),(0,t.jsx)("button",{type:"button","aria-label":"Copy the answer",onClick:async()=>{try{await navigator.clipboard.writeText(e),s(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>s(!1),1400)}catch(e){g.toast.add({type:"error",title:"Could not copy the answer",description:(0,T.errorToString)(e)})}},className:"grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:n?(0,t.jsx)(a.Check,{className:"size-3"}):(0,t.jsx)(o.Copy,{className:"size-3"})})}function el({lines:e}){return(0,t.jsxs)("details",{className:"group min-w-0 px-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[12.5px] leading-relaxed outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)(c.RotateCw,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:ed(e[0].text)}),e.length>1&&(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:["×",e.length]}),(0,t.jsx)(s.ChevronDown,{className:"size-2.5 shrink-0 text-muted-foreground/70 transition-transform group-open:rotate-180"})]}),(0,t.jsx)("div",{className:"mt-1 space-y-1 pl-4.5 text-[11px] leading-relaxed",children:e.map(e=>(0,t.jsxs)("p",{className:"flex gap-2 break-keep wrap-anywhere",children:[e.at&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground/70 tabular-nums",children:(0,n.format)((0,S.toDate)(e.at),"HH:mm:ss")}),(0,t.jsx)("span",{className:"min-w-0",children:e.text})]},e.id))})]})}let ed=e=>e.split(" (")[0].replace(/\.$/,"");function ec(e){let t=[];for(let n of e){let e="tool"===n.kind&&n.tool?"tools":"stop"===n.kind?"stops":"said",a=t.at(-1),s=a?.kind===e&&("stops"!==e||ed(a.lines[0].text)===ed(n.text));a&&s?a.lines.push(n):t.push({kind:e,key:n.id,lines:[n]})}return t}e.s(["Conversation",0,function({thread:e,tab:n=null,onTab:a,className:s,tabsClassName:r}){let i,o=(0,m.useRef)(null),l=(0,m.useRef)(!0),d=e.roster,c=a&&n!==e.bot.name&&d.some(e=>e.name===n)?n:null,u=c??e.bot.name,x=d.filter(t=>(!c||t.name===c)&&O(e,t.name)),p=(0,_.threadItems)((i=new Set(e.room.questions.map(e=>e.id))).size?{...e,lines:e.lines.filter(e=>!("ask"===e.kind&&void 0!==e.questionId&&i.has(e.questionId)))}:e,u,x);return(0,m.useEffect)(()=>{l.current=!0},[e.id,c]),(0,m.useEffect)(()=>{let e=o.current;e&&l.current&&(e.scrollTop=e.scrollHeight)},[e.lines,e.status,c]),(0,m.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{l.current&&(e.scrollTop=e.scrollHeight)});for(let n of Array.from(e.children))t.observe(n);return()=>t.disconnect()},[p.length,e.lines,c]),(0,t.jsxs)(N.FileViewer,{children:[a&&(0,t.jsx)(F,{thread:e,roster:d,side:c,onPick:a,className:r}),(0,t.jsxs)("div",{ref:o,onScroll:e=>{let t=e.currentTarget;l.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:(0,T.cn)("min-w-0 max-h-[64vh] space-y-3 overflow-y-auto px-4 pt-6 pb-4 mask-[linear-gradient(to_bottom,transparent,black_2rem)] scrollbar-none",s),children:[!c&&(0,t.jsx)(Q,{thread:e}),p.map(n=>"invite"===n.kind?(0,t.jsx)(X,{from:n.from,to:n.to},n.key):(0,t.jsx)(E,{turn:n,thread:e,self:u},n.key))]})]})},"FoldButton",0,A,"TAB",0,L,"THURSDAY",0,W,"ThreadFacts",0,B,"ThreadHeader",0,function({thread:e,onBack:n,onClose:a}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-1",children:[(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":"Back to the list",className:"shrink-0 rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(r.ChevronLeft,{className:"size-4"})}),(0,t.jsx)(w.BotMark,{size:22,seed:e.bot.name,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,paint:e.bot.icon?.paint,notify:!1}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:e.label}),(0,t.jsx)(B,{thread:e}),(0,t.jsx)(A,{onClick:a})]})},"leadOf",0,ed,"stepOf",0,V],351866)},399512,709190,e=>{"use strict";var t=e.i(843476),n=e.i(96892),a=e.i(716327),s=e.i(24071),r=e.i(867927),i=e.i(931619),o=e.i(919191),l=e.i(632781),d=e.i(64801),c=e.i(929272),u=e.i(263676),m=e.i(271645),x=e.i(798120),p=e.i(167881),b=e.i(463415),h=e.i(496336),f=e.i(683408),g=e.i(660302),k=e.i(184762),j=e.i(603854),v=e.i(43374),w=e.i(95187);let y=(0,w.createServerReference)("7f7f8cd31895eb44170d7269aeeb477a94986b2694",w.callServer,void 0,w.findSourceMapURL,"withdrawStepInAction");var N=e.i(451888),S=e.i(635963),z=e.i(978411),T=e.i(609856),C=e.i(283653),_=e.i(180245);function M({bot:e,onAllowed:n}){let{data:a}=(0,C.useServerRoute)(x.queryKey.signIns),[s,r]=(0,T.useServerAction)(_.setSignInBotAction,{onOk:()=>(0,C.revalidate)(x.queryKey.signIns)}),i=(a??[]).filter(t=>t.asking.includes(e));return i.length?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(a=>(0,t.jsxs)(p.Button,{type:"button",size:"sm",loading:r,onClick:()=>void s(a.site,e,!0).then(()=>n(`Yes — you may use my ${a.site} sign-in.`)).catch(()=>{}),children:["Let ",e," use ",a.site," (",a.account,")"]},a.site))}):null}var A=e.i(6799),B=e.i(41533),R=e.i(83928);let $=(0,w.createServerReference)("7f0362ac5f4ef10351a512c0ff3b70858aa27e0f46",w.callServer,void 0,w.findSourceMapURL,"giveFilesAction");var D=e.i(647163);function I(e){let t=(0,m.useRef)(e?.onKept);t.current=e?.onKept;let[n,a]=(0,m.useState)([]),[s]=(0,T.useServerAction)($),r=(0,m.useCallback)(async e=>{let r=B.GIVEN_FILES.perMessage-n.length;e.length>r&&A.toast.add({type:"error",title:`At most ${B.GIVEN_FILES.perMessage} files at a time.`});let i=e.slice(0,Math.max(0,r));if(!i.length)return;let o=i.map(e=>({key:crypto.randomUUID(),name:e.name,bytes:e.size,path:null}));a(e=>[...e,...o]);let l=new FormData;for(let e of i)l.append("file",e);try{let e=await s(l),n=t.current?.(e);a(t=>t.map(t=>{let a=o.findIndex(e=>e.key===t.key);return a<0?t:{...t,path:e[a]??null,note:n}}))}catch{a(e=>e.filter(e=>!o.some(t=>t.key===e.key)))}},[n.length,s]);return{files:n,take:r,remove:e=>a(t=>t.filter(t=>t.key!==e)),clear:()=>a([]),arriving:n.some(e=>null===e.path),withPaths:e=>[e.trim(),...n.flatMap(e=>e.path??[])].filter(Boolean).join("\n")}}function q({files:e,onRemove:n,dense:a=!1,children:s,className:r}){let i=a?"size-8 rounded-lg":"size-10 rounded-[9px]";return(0,t.jsxs)("div",{className:(0,D.cn)("flex flex-wrap gap-1.5",r),children:[e.map(e=>(0,t.jsxs)("span",{className:(0,D.cn)("flex max-w-64 items-center bg-muted/70",a?"h-10.5 gap-2 rounded-xl py-1 pr-1.5 pl-1":"h-13 gap-2.5 rounded-[14px] py-1.5 pr-2 pl-1.5"),children:[e.path?(0,t.jsx)(R.FileThumb,{path:e.path,bytes:e.bytes,className:(0,D.cn)("shrink-0 overflow-hidden ring-1 ring-foreground/6",i)}):(0,t.jsx)("span",{className:(0,D.cn)("grid shrink-0 place-items-center bg-background text-muted-foreground ring-1 ring-foreground/6",i),children:(0,t.jsx)(l.Loader2,{className:"size-3.5 animate-spin"})}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,t.jsx)("span",{className:(0,D.cn)("truncate",a?"text-xs leading-4":"text-[12.5px] leading-4.5"),children:e.name}),(0,t.jsxs)("span",{className:"font-mono text-[10px] leading-3.5 text-muted-foreground",children:[O(e.bytes),e.note&&` \xb7 ${e.note}`]})]}),(0,t.jsx)("button",{type:"button","aria-label":`Take ${e.name} out`,onClick:()=>n(e.key),className:"grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(u.X,{className:"size-3.5"})})]},e.key)),s]})}let F=null,L={claim:e=>(F=e,()=>{F===e&&(F=null)}),offer:(e,t)=>!!F&&!!e?.closest?.("[data-room]")&&(F(t),!0)},O=e=>e<1048576?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`;e.s(["GivenFiles",0,q,"roomDrop",0,L,"useGivenFiles",0,I],709190);var E=e.i(319841);function K({className:e,children:n}){return(0,t.jsx)("div",{className:(0,D.cn)("flex min-w-0 flex-col gap-2.5 rounded-[18px] bg-muted py-2 pr-2 pl-3.5",e),children:n})}function H({bot:e,word:n,children:a}){return(0,t.jsxs)("div",{className:"flex min-h-7 min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{title:e.name,className:"shrink-0 leading-none",children:(0,t.jsx)(V,{bot:e,size:16})}),(0,t.jsx)("span",{className:(0,D.cn)("truncate text-[12px] leading-4 font-medium",D.WAITING_INK),children:n}),a]})}function P({options:e,picked:n,busy:a,onChoose:s}){return(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map(e=>(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",loading:n===e,disabled:a,onClick:()=>s(e),className:"h-7 gap-1.5 rounded-full bg-background px-3 text-[12.5px] hover:bg-background/60 dark:hover:bg-background/60",children:[e===N.THREAD_CONTINUE&&n!==e&&(0,t.jsx)(i.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),e]},e))})}function U({threadId:e,recipient:a,draftKey:s,send:r,busy:i,placeholder:o,label:c,autoFocus:u=!1,onEscape:x,leading:b,trailing:h,className:f}){let[g,j]=(0,m.useState)(()=>z.threadDrafts.get(e,a,s)),[v,w]=(0,m.useState)(!1),y=t=>{j(t),z.threadDrafts.set(e,a,t,s)},N=I(),S=(0,m.useRef)(null),{take:T}=N;(0,m.useEffect)(()=>L.claim(e=>void T(e)),[T]);let C=!!g.trim()&&!i&&!N.arriving,_=async()=>{C&&(w(!0),await r(N.withPaths(g))&&(y(""),N.clear()),w(!1))};return(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),_()},className:(0,D.cn)("flex min-w-0 flex-wrap items-end gap-1",f),children:[N.files.length>0&&(0,t.jsx)(q,{dense:!0,files:N.files,onRemove:N.remove,className:"w-full pb-1"}),b,(0,t.jsx)(k.Textarea,{value:g,rows:1,disabled:i,autoFocus:u,onChange:e=>y(e.target.value),onPaste:e=>{let t=[...e.clipboardData.files];t.length&&(e.preventDefault(),T(t))},onKeyDown:e=>{let t=(0,E.composing)(e);if("Escape"===e.key&&x&&!t){e.preventDefault(),x();return}"Enter"!==e.key||e.shiftKey||t||(e.preventDefault(),_())},placeholder:o,"aria-label":c,className:"max-h-32 min-h-0 min-w-0 flex-1 resize-none border-0 bg-transparent px-0 py-1 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),(0,t.jsx)("input",{ref:S,type:"file",multiple:!0,hidden:!0,onChange:e=>{T([...e.target.files??[]]),e.target.value=""}}),(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:i,"aria-label":"Add files",onClick:()=>S.current?.click(),className:"rounded-full text-muted-foreground",children:(0,t.jsx)(d.Paperclip,{})}),h,(0,t.jsx)(p.Button,{type:"submit",size:"icon-sm",variant:C?"default":"ghost",disabled:!C,"aria-label":"Send",className:"rounded-full",children:v?(0,t.jsx)(l.Loader2,{className:"animate-spin"}):(0,t.jsx)(n.ArrowUp,{})})]})}function G({current:e,bots:n,disabled:s,onPick:r}){return(0,t.jsxs)(b.DropdownMenu,{children:[(0,t.jsxs)(b.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",disabled:s,"aria-label":`Message ${e.name}; choose another bot`,className:"mt-1 inline-flex h-5 shrink-0 items-center gap-1 self-start rounded-full bg-muted pr-1.5 pl-[3px] text-[12px] leading-none font-medium outline-none transition-colors hover:bg-muted-foreground/15 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50"}),children:[(0,t.jsx)("span",{className:"pl-1 text-muted-foreground",children:"To"}),(0,t.jsx)(V,{bot:e,size:14}),(0,t.jsx)("span",{className:"max-w-32 truncate",children:e.name}),(0,t.jsx)(a.ChevronDown,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)(b.DropdownMenuContent,{align:"start",children:(0,t.jsx)(b.DropdownMenuGroup,{children:n.map(e=>(0,t.jsxs)(b.DropdownMenuItem,{onClick:()=>r(e.name),children:[(0,t.jsx)(V,{bot:e,size:16}),e.name]},e.name))})})]})}function V({bot:e,size:n}){return(0,t.jsx)(S.BotMark,{size:n,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"})}function Q(){let[e,t]=(0,T.useServerAction)(j.answerThreadAction,{onOk:()=>(0,C.revalidate)(x.queryKey.threads)});return[async(t,n,a,s)=>{let r=n.trim();if(!r)return!1;try{let n=await e(t.id,r,a,s);return z.screenActs.announce({kind:"answered",id:n.id,label:n.label,answer:r,recipient:a,replyTo:s}),!0}catch{return!1}},t]}e.s(["ThreadReply",0,function({thread:e,status:n,faces:a=[],to:i=null,className:d}){let[b,k]=(0,m.useState)(),[j,w]=(0,m.useState)(()=>z.threadDrafts.recipient(e.id)??e.bot),[S,_]=(0,m.useState)(!1),[A,B]=(0,m.useState)(null),[R,$]=(0,m.useState)({id:e.id,bot:e.bot});(R.id!==e.id||R.bot!==e.bot)&&($({id:e.id,bot:e.bot}),w(z.threadDrafts.recipient(e.id)??e.bot),k(void 0),_(!1)),(0,m.useEffect)(()=>{i&&(z.threadDrafts.select(e.id,i),w(i))},[e.id,i]);let I=e.room.participants,q=e.room.questions,F=Math.max(0,q.findIndex(e=>e.id===b)),L=q[F],O="waiting"===n?e.ask:null,E=(0,N.isAppStop)(O),V=L?.bot??(I.some(e=>e.bot===j)?j:e.bot),W=L?.id,[X,Y]=Q(),[J,Z]=(0,T.useServerAction)(v.cancelThreadAction,{onOk:e=>{(0,C.revalidate)(x.queryKey.threads),z.screenActs.announce({kind:"stopped",id:e.id,label:e.label})}}),ee=Y||Z,et=e.room.deliveries.filter(e=>!e.delivered),[en,ea]=(0,T.useServerAction)(y,{onOk:()=>(0,C.revalidate)(x.queryKey.threads)}),es=et.map(e=>`${e.bot}: ${e.text}`).join(" · "),er=I.filter(e=>"running"===e.state).map(e=>e.bot),ei=er.join(", ")||e.bot,eo="running"===n&&I.some(e=>e.bot===V&&("running"===e.state||"queued"===e.state)),el="running"===n&&!eo,ed=V!==e.bot,ec=e=>a.find(t=>t.name===e)??{name:e},eu=async t=>{if(ee)return!1;let n=await X(e,t,V,W);return n&&eo&&_(!1),n},em=async e=>{B(e),await eu(e),B(null)},ex=(a=!1)=>"running"===n||"waiting"===n?(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",loading:Z,disabled:ee,onClick:()=>J(e.id),"aria-label":"Stop this thread",className:(0,D.cn)("h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",a&&"bg-background px-3 hover:bg-background/60 dark:hover:bg-background/60"),children:[!Z&&(0,t.jsx)(c.Square,{className:"size-2.5 fill-current"}),"Stop"]}):null;if(L){let n=L.options??[],a=L.text;return(0,t.jsxs)(K,{className:d,children:[(0,t.jsx)(H,{bot:ec(V),word:"Question",children:(0,t.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[q.length>1&&(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Previous question",disabled:ee||0===F,onClick:()=>k(q[F-1].id),children:(0,t.jsx)(s.ChevronLeft,{})}),(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums","aria-live":"polite",children:[F+1," / ",q.length]}),(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Next question",disabled:ee||F===q.length-1,onClick:()=>k(q[F+1].id),children:(0,t.jsx)(r.ChevronRight,{})})]}),ex(!0)]})}),a&&(0,t.jsx)("div",{className:"max-h-[min(14rem,30vh)] min-w-0 overflow-y-auto overscroll-contain pr-1.5",children:(0,t.jsx)(f.Markdown,{className:"min-w-0 text-[13px] leading-snug wrap-anywhere break-keep [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:a})}),n.length>0&&(0,t.jsx)(P,{options:n,picked:A,busy:ee,onChoose:em}),(0,t.jsx)(M,{bot:V,onAllowed:eu}),(0,t.jsx)(U,{threadId:e.id,recipient:V,draftKey:L.id,send:eu,busy:ee,placeholder:n.length?"Or write your own answer…":"Your answer…",label:`Answer for ${V}`},JSON.stringify([e.id,V,L.id]))]})}return E?(0,t.jsxs)(K,{className:d,children:[(0,t.jsx)(H,{bot:ec(e.bot),word:"Paused",children:(0,t.jsx)("span",{className:"ml-auto flex shrink-0",children:ex(!0)})}),O?.question&&(0,t.jsx)(h.FoldedText,{text:O.question,subject:"message",clamp:"line-clamp-3",tall:"max-h-40"}),(0,t.jsx)(P,{options:O?.options.length?O.options:[N.THREAD_CONTINUE],picked:A,busy:ee,onChoose:em}),(0,t.jsx)(U,{threadId:e.id,recipient:V,send:eu,busy:ee,placeholder:"Or put it another way…",label:`Message for ${V}`},JSON.stringify([e.id,V,"paused"]))]}):eo&&!S?(0,t.jsxs)("div",{className:(0,D.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 ring-1 ring-border/50",d),children:[et.map(n=>(0,t.jsxs)("div",{className:"flex items-start gap-2 border-border/60 border-b py-2.5 pr-1.5 pl-3.5",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsxs)("p",{className:"flex min-w-0 items-center gap-1.5 font-mono text-[10px] leading-4",children:[(0,t.jsx)(l.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}),(0,t.jsx)(g.ShinyText,{text:`Step-in \xb7 waits for ${n.bot}'s next step`,speed:2.2,className:"min-w-0 truncate"})]}),(0,t.jsx)("p",{className:"whitespace-pre-wrap break-keep wrap-anywhere text-[13px] leading-snug",children:n.text})]}),(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:ea,onClick:()=>en(e.id,n.id),"aria-label":"Take it back",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:(0,t.jsx)(u.X,{})})]},n.id)),(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2 py-1.5 pr-1.5 pl-3.5",children:[(0,t.jsx)(g.ShinyText,{text:`${ei} \xb7 Working`,speed:2.4,className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",disabled:ee,onClick:()=>_(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,t.jsx)(o.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),ex()]})]}):(0,t.jsxs)("div",{className:(0,D.cn)("flex min-w-0 flex-col gap-1.5",d),children:[el&&(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2 pr-1.5 pl-3.5",children:[(0,t.jsxs)("p",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-[12.5px] leading-5",children:[(0,t.jsxs)("span",{className:"shrink-0 text-muted-foreground",children:[V," is idle"]}),er.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/50",children:"·"}),(0,t.jsx)(g.ShinyText,{text:`${er.join(", ")} working`,speed:2.4,className:"min-w-0 truncate"})]})]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),ex()]}),(0,t.jsx)(U,{threadId:e.id,recipient:V,send:eu,busy:ee,autoFocus:eo,onEscape:eo?()=>_(!1):void 0,placeholder:eo?`What's off? ${V} reads this before its next step`:el?`Anything for ${V}? It starts again as soon as you send`:"Anything more? It picks up where it left off",label:`Message for ${V}`,className:"rounded-2xl bg-background py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",leading:I.length>1?(0,t.jsx)(G,{current:ec(V),bots:I.map(e=>ec(e.bot)),disabled:ee,onPick:t=>{z.threadDrafts.select(e.id,t),w(t)}}):null,trailing:eo?(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:ee,onClick:()=>_(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,t.jsx)(u.X,{})}):null},JSON.stringify([e.id,V])),ed&&(0,t.jsxs)("p",{className:"min-w-0 truncate px-1 text-xs text-muted-foreground",children:[V,"’s answer goes back to ",e.bot]}),!!es&&!eo&&(0,t.jsxs)("p",{className:"flex min-w-0 items-center gap-2 px-1 text-xs text-muted-foreground",children:[(0,t.jsx)(l.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsxs)("span",{className:"truncate",children:["Sending to ",es]})]})]})},"useAnswerThread",0,Q],399512)},603854,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f7bb799009465b1485b93cf098c5444693f8355b4",t.callServer,void 0,t.findSourceMapURL,"answerThreadAction");e.s(["answerThreadAction",0,n])},43374,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f9c2c29ef859b4f85149212550e72d94f6c816a69",t.callServer,void 0,t.findSourceMapURL,"cancelThreadAction");e.s(["cancelThreadAction",0,n])},931619,e=>{"use strict";var t=e.i(456420);let n={name:"chevrons-right",size:24,node:[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]};n.node;let a=(0,t.default)(n);e.s(["ChevronsRight",0,a],931619)},51481,e=>{"use strict";var t=e.i(456420);let n={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};n.node;let a=(0,t.default)(n);e.s(["CircleQuestionMark",0,a],51481)},919191,e=>{"use strict";var t=e.i(456420);let n={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};n.node;let a=(0,t.default)(n);e.s(["CornerDownLeft",0,a],919191)},64801,e=>{"use strict";var t=e.i(456420);let n={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]};n.node;let a=(0,t.default)(n);e.s(["Paperclip",0,a],64801)},825398,815731,e=>{"use strict";var t=e.i(456420);let n={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};n.node;let a=(0,t.default)(n);e.s(["RotateCw",0,a],825398);var s=e.i(843476),r=e.i(176782),i=e.i(552245),o=e.i(225913),l=e.i(647163);let d=(0,o.cva)("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});(0,o.cva)("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}}),e.s(["Bubble",0,function({variant:e="default",align:t="start",className:n,...a}){return(0,s.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,l.cn)(d({variant:e}),n),...a})},"BubbleContent",0,function({className:e,render:t,...n}){var a;return a={defaultTagName:"div",props:(0,r.mergeProps)({className:(0,l.cn)("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",e)},n),render:t,state:{slot:"bubble-content"}},(0,i.useRenderElement)(a.defaultTagName??"div",a,a)}],815731)},929272,e=>{"use strict";var t=e.i(456420);let n={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};n.node;let a=(0,t.default)(n);e.s(["Square",0,a],929272)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,496336,e=>{"use strict";var t=e.i(843476),n=e.i(716327),a=e.i(271645),s=e.i(647163);e.s(["FoldedText",0,function({text:e,subject:r,clamp:i="line-clamp-3",tall:o="max-h-40",className:l}){let[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),x=(0,a.useRef)(null),[p,b]=(0,a.useState)(e);return p!==e&&(b(e),c(!1)),(0,a.useEffect)(()=>{let e=x.current;e&&!d&&m(e.scrollHeight>e.clientHeight+1)},[d,e]),(0,t.jsxs)("div",{className:(0,s.cn)("flex items-start gap-1",l),children:[(0,t.jsx)("p",{ref:x,className:(0,s.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep wrap-anywhere",d?(0,s.cn)(o,"overflow-y-auto scrollbar-none"):i),children:e}),(u||d)&&(0,t.jsx)("button",{type:"button",onClick:()=>c(e=>!e),"aria-label":d?`Fold the ${r}`:`Read the whole ${r}`,className:"shrink-0 rounded-md p-0.5 opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(n.ChevronDown,{className:(0,s.cn)("size-3.5",d&&"rotate-180")})})]})}])},835878,e=>{"use strict";var t=e.i(843476),n=e.i(635963);e.s(["BotRoster",0,function({bots:e}){return e.length<2?null:(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:e.map(e=>e.name).join(", "),children:[(0,t.jsx)("span",{className:"flex items-center gap-0.5",children:e.slice(0,3).map(e=>(0,t.jsx)(n.BotMark,{size:18,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"},e.name))}),(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.length," bots"]})]})}])},351866,e=>{"use strict";var t=e.i(843476),n=e.i(401851),a=e.i(689664),s=e.i(716327),r=e.i(24071),i=e.i(51481),o=e.i(508734),l=e.i(919191),d=e.i(632781),c=e.i(825398),u=e.i(263676),m=e.i(271645),x=e.i(815731),p=e.i(496336),b=e.i(683408),h=e.i(660302),f=e.i(127341),g=e.i(6799),k=e.i(95187);let j=(0,k.createServerReference)("7fc7b254c43cff117cb083333d0a1edb0982da7f89",k.callServer,void 0,k.findSourceMapURL,"compactThreadAction");var v=e.i(807038),w=e.i(635963),y=e.i(256604),N=e.i(621285),S=e.i(245629),z=e.i(609856),T=e.i(647163),C=e.i(553429),_=e.i(978411),M=e.i(222055);function A({onClick:e}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":"Fold the room away",className:"grid size-7 shrink-0 place-items-center rounded-full bg-muted text-foreground outline-none transition-colors hover:bg-muted-foreground/20 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(u.X,{className:"size-3.5"})})}function B({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(R,{thread:e}),(0,t.jsx)($,{thread:e}),(0,t.jsx)(q,{thread:e})]})}function R({thread:e}){let{contextTokens:n,tokens:a}=e;return n?(0,t.jsx)("span",{title:`Last step ${(0,T.formatCount)(n)} tokens \xb7 in total in ${(0,T.formatCount)(a.input)} \xb7 out ${(0,T.formatCount)(a.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,T.formatCount)(n)}):null}function $({thread:e}){let{contextTokens:n,contextBudget:a}=e,[s,r]=(0,m.useState)(!1),[i,o]=(0,z.useServerAction)(j,{onOk:()=>r(!0)}),[l,d]=(0,m.useState)(n);if(l!==n&&(d(n),r(!1)),!n||!a)return null;let c=Math.min(1,n/a);return(0,t.jsx)("button",{type:"button",disabled:o||s,onClick:()=>void i(e.id,e.bot.name),title:s?"It summarizes itself at its next step":`Context ${(0,T.formatCount)(n)} of ${(0,T.formatCount)(a)} — it summarizes itself at the end of the bar. Press to have it do so at its next step`,"aria-label":"Summarize this thread's context at its next step",className:"-my-2 flex h-6 shrink-0 items-center rounded-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default",children:(0,t.jsx)("span",{className:"block h-[3px] w-9 overflow-hidden rounded-full bg-muted",children:(0,t.jsx)("span",{className:(0,T.cn)("block h-full rounded-full",s?"animate-pulse bg-muted-foreground/40":c>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*c))}%`}})})})}let D={working:"text-muted-foreground",waiting:T.WAITING_INK,done:"text-foreground",cancelled:"text-muted-foreground"},I={working:"working",waiting:"waiting",done:"done",cancelled:"stopped"};function q({thread:e}){let n="done"===e.status&&e.seen?"text-muted-foreground":D[e.status];return"working"===e.status?(0,t.jsx)(h.ShinyText,{text:I.working,speed:2.2,className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,T.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",n),children:I[e.status]})}function F({thread:e,roster:n,side:a,onPick:s,className:r}){return(0,t.jsx)(f.Tabs,{value:a??e.bot.name,onValueChange:t=>s(t===e.bot.name?null:String(t)),className:(0,T.cn)("shrink-0 gap-0 px-3 pt-1 pb-0.5",r),children:(0,t.jsx)(f.TabsList,{className:"w-full justify-start gap-1 overflow-x-auto rounded-none bg-transparent p-0 scrollbar-none group-data-horizontal/tabs:h-auto",children:n.map(n=>{let a=O(e,n.name);return(0,t.jsxs)(f.TabsTrigger,{value:n.name,className:(0,T.cn)(L,"pl-1.5"),children:[(0,t.jsx)(w.BotMark,{size:16,seed:n.name,color:n.icon?.color,shape:n.icon?.shape,outline:n.icon?.outline,paint:n.icon?.paint,notify:"asking"===a,className:"shrink-0"}),(0,t.jsx)("span",{className:"max-w-28 truncate",children:n.name}),"running"===a&&(0,t.jsx)(d.Loader2,{className:"size-3 animate-spin text-muted-foreground/70"})]},n.name)})})})}let L="h-7 flex-none rounded-full px-3 py-0 text-[12px] text-muted-foreground hover:bg-muted/60 data-active:bg-muted data-active:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-none dark:data-active:border-transparent dark:data-active:bg-muted";function O(e,t){let{room:n}=e;return n.questions.some(e=>e.bot===t)?"asking":"working"===e.status&&n.participants.some(e=>e.bot===t&&"running"===e.state)?"running":null}function E({turn:e,thread:n,self:a}){let s=e.speaker.name===a,r=s?"none":e.speaker.name===W.name?"dark":"secondary",i=null;return(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(ee,{side:s?"start":"end",name:e.speaker.name,mark:(0,t.jsx)(J,{bot:e.speaker}),children:e.entries.map(o=>{if("work"===o.kind)return s?(0,t.jsx)(H,{lines:o.lines,trailing:o.open,bot:e.speaker,thread:n},o.key):(0,t.jsx)(K,{lines:o.lines,trailing:o.open,bot:e.speaker,thread:n},o.key);let l=(0,_.heardBy)(o.line),d=l&&l.name!==e.speaker.name&&l.name!==a&&l.name!==W.name&&l.name!==i?l:null;return l&&(i=l.name),(0,t.jsx)(et,{line:o.line,surface:r,mention:d},o.key)})})})}function K({lines:e,trailing:n,bot:a,thread:s}){var r;let[i,o]=(0,m.useState)(!1),[l,c]=(0,m.useState)(null),u=n?O(s,a.name):null,x=(r=e,[["tool","step"],["say","note"],["stop","stop"],["note","compaction"]].map(([e,t])=>[r.filter(t=>t.kind===e).length,t]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}${1===e?"":"s"}`).join(" · ")),p=e.filter(e=>e.tool?.results!==void 0);if(!u&&!x)return null;let b=e.findLast(e=>"tool"===e.kind||"say"===e.kind),f=i&&e.length>0;return(0,t.jsxs)("div",{className:(0,T.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 p-1",f?"w-full":"w-fit max-w-full"),children:[(0,t.jsxs)("button",{type:"button",disabled:!e.length,"aria-expanded":f,onClick:()=>{o(e=>!e),c(null)},className:"flex min-w-0 items-center gap-2 rounded-xl px-2.5 py-1.5 text-left outline-none transition-colors enabled:hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:["running"===u&&(0,t.jsx)(d.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/60"}),u?(0,t.jsx)(h.ShinyText,{text:"asking"===u?"waiting on you":b?V(b):"working",tone:"asking"===u?"waiting":"muted",speed:2.4,className:(0,T.cn)("min-w-0 truncate text-[12px] leading-4",f&&"flex-1")}):(0,t.jsx)(U,{words:b?V(b):"",facts:[x,function(e){let t=e.flatMap(e=>e.at?[(0,S.toDate)(e.at).getTime()]:[]);if(t.length<2)return"";let n=Math.round((Math.max(...t)-Math.min(...t))/1e3);if(n<1)return"";if(n<60)return`${n}s`;let a=Math.round(n/60);return a<60?`${a} min`:`${Math.floor(a/60)}h ${a%60}m`}(e)].filter(Boolean).join(" · "),grow:f}),e.length>0&&(0,t.jsx)(G,{open:f})]}),!f&&p.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1 px-2 pt-0.5 pb-1.5",children:p.map(e=>e.tool&&(0,t.jsx)(M.StepTile,{tool:e.tool,onOpen:()=>{c(e.id),o(!0)}},e.id))}),f&&(0,t.jsx)("div",{className:"flex min-w-0 flex-col gap-0.5 pt-0.5",children:ec(e).map(e=>"tools"===e.kind?e.lines.map(e=>e.tool&&(0,t.jsx)(M.BotTool,{tool:e.tool,threadId:s.id,collapsed:e.id!==l},e.id)):"stops"===e.kind?(0,t.jsx)("div",{className:"px-1.5 py-1",children:(0,t.jsx)(el,{lines:e.lines})},e.key):e.lines.map(e=>(0,t.jsx)(ei,{line:e,inset:!0},e.id)))})]})}function H({lines:e,trailing:n,bot:a,thread:s}){let r=n?O(s,a.name):null,i=e.some(e=>e.tool&&void 0===e.tool.results);return(0,t.jsxs)(t.Fragment,{children:[ec(e).map(e=>"tools"===e.kind?(0,t.jsx)(P,{lines:e.lines,threadId:s.id},e.key):"stops"===e.kind?(0,t.jsx)(el,{lines:e.lines},e.key):e.lines.map(e=>(0,t.jsx)(ei,{line:e},e.id))),r&&!i&&(0,t.jsx)(h.ShinyText,{text:"asking"===r?"waiting on you":"on the next step…",tone:"asking"===r?"waiting":"muted",speed:2.2,className:"block px-1 font-mono text-[10px]"})]})}function P({lines:e,threadId:n}){return(0,t.jsx)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:e.map(e=>e.tool&&(0,t.jsx)(M.BotTool,{tool:e.tool,threadId:n,collapsed:!0},e.id))})}function U({words:e,facts:n,grow:a=!1}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:(0,T.cn)("min-w-0 truncate text-[12.5px] leading-5 text-foreground/80",a&&"flex-1"),children:e}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] leading-4 text-muted-foreground",children:n})]})}function G({open:e}){return(0,t.jsx)("span",{className:"grid size-5.5 shrink-0 place-items-center rounded-md bg-background text-muted-foreground ring-1 ring-border/60",children:(0,t.jsx)(s.ChevronDown,{className:(0,T.cn)("size-3.5 transition-transform",e&&"rotate-180")})})}function V(e){return"tool"===e.kind&&e.tool?e.tool.note??`${e.tool.name} \xb7 ${e.tool.input}`:(0,T.plainText)(e.text).replace(/\s+/g," ").trim()}function Q({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(X,{from:W,to:e.bot}),(0,t.jsx)(ee,{side:"end",name:W.name,mark:(0,t.jsx)(J,{bot:W}),children:(0,t.jsx)(Z,{dark:!0,className:"py-2 pr-2 pl-3.5",children:(0,t.jsx)(p.FoldedText,{text:e.request,subject:"request",className:"wrap-anywhere"})})})]})}let W={name:C.ROOM_THURSDAY};function X({from:e,to:n}){return(0,t.jsx)("div",{className:"flex animate-in justify-center fade-in duration-300",children:(0,t.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(Y,{bot:e}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,t.jsx)(Y,{bot:n})]})})}function Y({bot:e}){return(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[e.name===W.name?(0,t.jsx)(y.ThursdayMark,{size:15,className:"shrink-0"}):(0,t.jsx)(w.BotMark,{size:15,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function J({bot:e}){return e.name===W.name?(0,t.jsx)(y.ThursdayMark,{size:26,className:"mt-1 shrink-0"}):(0,t.jsx)(w.BotMark,{size:26,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"mt-1 shrink-0"})}function Z({dark:e=!1,children:n,className:a}){return(0,t.jsx)(x.Bubble,{align:"end",variant:e?"default":"secondary",className:"max-w-full",children:(0,t.jsx)(x.BubbleContent,{className:(0,T.cn)("rounded-tr-md px-3.5",a),children:(0,t.jsx)("div",{className:(0,T.cn)("min-w-0",e&&"inverse"),children:n})})})}function ee({side:e,mark:n,name:a,children:s}){return(0,t.jsxs)("div",{className:(0,T.cn)("flex gap-2.5","end"===e&&"flex-row-reverse"),children:[n,(0,t.jsxs)("div",{className:(0,T.cn)("flex min-w-0 flex-1 flex-col gap-1.5 [&>*+*]:max-w-[80%]","end"===e&&"items-end"),children:[(0,t.jsx)("p",{className:"max-w-[80%] truncate px-1 font-mono text-[10px] text-muted-foreground",children:a}),s]})]})}function et({line:e,surface:n,mention:a}){let s=!!e.question,r="result"===e.kind,i="none"!==n,o=(0,v.shortenPaths)(e.text),d=(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(er,{}),a?(0,t.jsx)(es,{bot:a,bubble:i,children:o}):(0,t.jsx)(en,{bubble:i,className:(0,T.cn)(!r&&"leading-snug"),children:o}),(0,t.jsx)(v.Attachments,{text:e.text,onBubble:i,className:"mt-2"})]});return(0,t.jsxs)(t.Fragment,{children:[i?(0,t.jsx)(Z,{dark:"dark"===n,children:d}):(0,t.jsx)("div",{className:"min-w-0 max-w-full px-1",children:d}),e.steppedIn&&(0,t.jsxs)("p",{className:"flex items-center gap-1 px-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(l.CornerDownLeft,{className:"size-2.5"}),"stepped in"]}),r&&(0,t.jsx)("div",{className:"flex px-1",children:(0,t.jsx)(eo,{text:e.text})})]})}function en({children:e,bubble:n=!1,className:a}){return(0,t.jsx)(b.Markdown,{className:(0,T.cn)("min-w-0 max-w-full text-[13px] leading-relaxed wrap-anywhere break-keep [&_h1]:text-[15px] [&_h2]:text-[14px] [&_h3]:text-[13px] [&_h3]:font-semibold [&_li]:my-0.5 [&_table]:text-[12px] [&_table]:wrap-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",n&&"[&_[data-streamdown=inline-code]]:text-[12px] [&_[data-streamdown=code-block]]:my-2 [&_[data-streamdown=code-block]]:gap-0 [&_[data-streamdown=code-block]]:rounded-[10px] [&_[data-streamdown=code-block]]:border-0 [&_[data-streamdown=code-block]]:bg-background [&_[data-streamdown=code-block]]:p-0 [&_[data-streamdown=code-block-header]]:h-7 [&_[data-streamdown=code-block-header]]:px-2.5 [&_[data-streamdown=code-block-header]]:text-[11px] [&_[data-streamdown=code-block-body]]:border-0 [&_[data-streamdown=code-block-body]]:bg-transparent! [&_[data-streamdown=code-block-body]]:px-2.5 [&_[data-streamdown=code-block-body]]:pt-0 [&_[data-streamdown=code-block-body]]:pb-2.5 [&_[data-streamdown=code-block-body]]:text-[12.5px] [&_[data-streamdown=code-block]_div:has(>[data-streamdown=code-block-actions])]:-mt-7 [&_[data-streamdown=code-block-actions]]:mr-1 [&_[data-streamdown=code-block-actions]]:border-0 [&_[data-streamdown=code-block-actions]]:bg-transparent!",a),children:e})}function ea({bot:e,bubble:n}){return(0,t.jsxs)("span",{className:(0,T.cn)("mr-1.5 inline-flex h-5 max-w-full items-center gap-1 rounded-full pr-2 pl-[3px] align-[-4px] text-[12px] leading-none font-medium whitespace-nowrap text-foreground",n?"bg-background":"bg-muted"),children:[(0,t.jsx)(w.BotMark,{size:14,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function es({bot:e,bubble:n,children:a}){return(0,t.jsxs)("div",{className:"min-w-0 max-w-full text-[13px] leading-snug",children:[(0,t.jsx)(ea,{bot:e,bubble:n}),(0,t.jsx)(en,{bubble:n,className:"contents leading-snug [&>p:first-child]:inline",children:a})]})}function er(){return(0,t.jsxs)("p",{className:"mb-1 flex items-center gap-1.5 text-[12px] leading-4 font-medium text-muted-foreground",children:[(0,t.jsx)(i.CircleQuestionMark,{className:"size-3.5 shrink-0"}),"Question"]})}function ei({line:e,inset:n=!1}){return"note"===e.kind?(0,t.jsxs)("details",{className:"w-full px-2 py-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)("span",{className:"h-px flex-1 bg-border"}),(0,t.jsx)("span",{className:"min-w-0 text-center font-mono text-[10px]",children:"Compacted — it goes on from its summary"}),(0,t.jsx)("span",{className:"h-px flex-1 bg-border"})]}),(0,t.jsx)(en,{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px]",children:e.text})]}):(0,t.jsx)(en,{className:(0,T.cn)("text-[12.5px] text-muted-foreground",n?"px-2.5 py-1":"px-1"),children:e.text})}function eo({text:e}){let[n,s]=(0,m.useState)(!1),r=(0,m.useRef)(null);return(0,m.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),(0,t.jsx)("button",{type:"button","aria-label":"Copy the answer",onClick:async()=>{try{await navigator.clipboard.writeText(e),s(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>s(!1),1400)}catch(e){g.toast.add({type:"error",title:"Could not copy the answer",description:(0,T.errorToString)(e)})}},className:"grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:n?(0,t.jsx)(a.Check,{className:"size-3"}):(0,t.jsx)(o.Copy,{className:"size-3"})})}function el({lines:e}){return(0,t.jsxs)("details",{className:"group min-w-0 px-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[12.5px] leading-relaxed outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)(c.RotateCw,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:ed(e[0].text)}),e.length>1&&(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:["×",e.length]}),(0,t.jsx)(s.ChevronDown,{className:"size-2.5 shrink-0 text-muted-foreground/70 transition-transform group-open:rotate-180"})]}),(0,t.jsx)("div",{className:"mt-1 space-y-1 pl-4.5 text-[11px] leading-relaxed",children:e.map(e=>(0,t.jsxs)("p",{className:"flex gap-2 break-keep wrap-anywhere",children:[e.at&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground/70 tabular-nums",children:(0,n.format)((0,S.toDate)(e.at),"HH:mm:ss")}),(0,t.jsx)("span",{className:"min-w-0",children:e.text})]},e.id))})]})}let ed=e=>e.split(" (")[0].replace(/\.$/,"");function ec(e){let t=[];for(let n of e){let e="tool"===n.kind&&n.tool?"tools":"stop"===n.kind?"stops":"said",a=t.at(-1),s=a?.kind===e&&("stops"!==e||ed(a.lines[0].text)===ed(n.text));a&&s?a.lines.push(n):t.push({kind:e,key:n.id,lines:[n]})}return t}e.s(["Conversation",0,function({thread:e,tab:n=null,onTab:a,className:s,tabsClassName:r}){let i,o=(0,m.useRef)(null),l=(0,m.useRef)(!0),d=e.roster,c=a&&n!==e.bot.name&&d.some(e=>e.name===n)?n:null,u=c??e.bot.name,x=d.filter(t=>(!c||t.name===c)&&O(e,t.name)),p=(0,_.threadItems)((i=new Set(e.room.questions.map(e=>e.id))).size?{...e,lines:e.lines.filter(e=>!("ask"===e.kind&&void 0!==e.questionId&&i.has(e.questionId)))}:e,u,x);return(0,m.useEffect)(()=>{l.current=!0},[e.id,c]),(0,m.useEffect)(()=>{let e=o.current;e&&l.current&&(e.scrollTop=e.scrollHeight)},[e.lines,e.status,c]),(0,m.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{l.current&&(e.scrollTop=e.scrollHeight)});for(let n of Array.from(e.children))t.observe(n);return()=>t.disconnect()},[p.length,e.lines,c]),(0,t.jsxs)(N.FileViewer,{children:[a&&(0,t.jsx)(F,{thread:e,roster:d,side:c,onPick:a,className:r}),(0,t.jsxs)("div",{ref:o,onScroll:e=>{let t=e.currentTarget;l.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:(0,T.cn)("min-w-0 max-h-[64vh] space-y-3 overflow-y-auto px-4 pt-6 pb-4 mask-[linear-gradient(to_bottom,transparent,black_2rem)] scrollbar-none",s),children:[!c&&(0,t.jsx)(Q,{thread:e}),p.map(n=>"invite"===n.kind?(0,t.jsx)(X,{from:n.from,to:n.to},n.key):(0,t.jsx)(E,{turn:n,thread:e,self:u},n.key))]})]})},"FoldButton",0,A,"TAB",0,L,"THURSDAY",0,W,"ThreadFacts",0,B,"ThreadHeader",0,function({thread:e,onBack:n,onClose:a}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-1",children:[(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":"Back to the list",className:"shrink-0 rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(r.ChevronLeft,{className:"size-4"})}),(0,t.jsx)(w.BotMark,{size:22,seed:e.bot.name,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,paint:e.bot.icon?.paint,notify:!1}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:e.label}),(0,t.jsx)(B,{thread:e}),(0,t.jsx)(A,{onClick:a})]})},"leadOf",0,ed,"stepOf",0,V],351866)},399512,709190,e=>{"use strict";var t=e.i(843476),n=e.i(96892),a=e.i(716327),s=e.i(24071),r=e.i(867927),i=e.i(931619),o=e.i(919191),l=e.i(632781),d=e.i(64801),c=e.i(929272),u=e.i(263676),m=e.i(271645),x=e.i(798120),p=e.i(167881),b=e.i(463415),h=e.i(496336),f=e.i(683408),g=e.i(660302),k=e.i(184762),j=e.i(186882),v=e.i(750456),w=e.i(95187);let y=(0,w.createServerReference)("7f4834f38f44ede53e8ea16cf59cfd81cbca6481d4",w.callServer,void 0,w.findSourceMapURL,"withdrawStepInAction");var N=e.i(451888),S=e.i(635963),z=e.i(978411),T=e.i(609856),C=e.i(283653),_=e.i(730206);function M({bot:e,onAllowed:n}){let{data:a}=(0,C.useServerRoute)(x.queryKey.signIns),[s,r]=(0,T.useServerAction)(_.setSignInBotAction,{onOk:()=>(0,C.revalidate)(x.queryKey.signIns)}),i=(a??[]).filter(t=>t.asking.includes(e));return i.length?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(a=>(0,t.jsxs)(p.Button,{type:"button",size:"sm",loading:r,onClick:()=>void s(a.site,e,!0).then(()=>n(`Yes — you may use my ${a.site} sign-in.`)).catch(()=>{}),children:["Let ",e," use ",a.site," (",a.account,")"]},a.site))}):null}var A=e.i(6799),B=e.i(41533),R=e.i(83928);let $=(0,w.createServerReference)("7f437b7e9ad4bf7261b89d1fcf6c445f53cd95d337",w.callServer,void 0,w.findSourceMapURL,"giveFilesAction");var D=e.i(647163);function I(e){let t=(0,m.useRef)(e?.onKept);t.current=e?.onKept;let[n,a]=(0,m.useState)([]),[s]=(0,T.useServerAction)($),r=(0,m.useCallback)(async e=>{let r=B.GIVEN_FILES.perMessage-n.length;e.length>r&&A.toast.add({type:"error",title:`At most ${B.GIVEN_FILES.perMessage} files at a time.`});let i=e.slice(0,Math.max(0,r));if(!i.length)return;let o=i.map(e=>({key:crypto.randomUUID(),name:e.name,bytes:e.size,path:null}));a(e=>[...e,...o]);let l=new FormData;for(let e of i)l.append("file",e);try{let e=await s(l),n=t.current?.(e);a(t=>t.map(t=>{let a=o.findIndex(e=>e.key===t.key);return a<0?t:{...t,path:e[a]??null,note:n}}))}catch{a(e=>e.filter(e=>!o.some(t=>t.key===e.key)))}},[n.length,s]);return{files:n,take:r,remove:e=>a(t=>t.filter(t=>t.key!==e)),clear:()=>a([]),arriving:n.some(e=>null===e.path),withPaths:e=>[e.trim(),...n.flatMap(e=>e.path??[])].filter(Boolean).join("\n")}}function q({files:e,onRemove:n,dense:a=!1,children:s,className:r}){let i=a?"size-8 rounded-lg":"size-10 rounded-[9px]";return(0,t.jsxs)("div",{className:(0,D.cn)("flex flex-wrap gap-1.5",r),children:[e.map(e=>(0,t.jsxs)("span",{className:(0,D.cn)("flex max-w-64 items-center bg-muted/70",a?"h-10.5 gap-2 rounded-xl py-1 pr-1.5 pl-1":"h-13 gap-2.5 rounded-[14px] py-1.5 pr-2 pl-1.5"),children:[e.path?(0,t.jsx)(R.FileThumb,{path:e.path,bytes:e.bytes,className:(0,D.cn)("shrink-0 overflow-hidden ring-1 ring-foreground/6",i)}):(0,t.jsx)("span",{className:(0,D.cn)("grid shrink-0 place-items-center bg-background text-muted-foreground ring-1 ring-foreground/6",i),children:(0,t.jsx)(l.Loader2,{className:"size-3.5 animate-spin"})}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,t.jsx)("span",{className:(0,D.cn)("truncate",a?"text-xs leading-4":"text-[12.5px] leading-4.5"),children:e.name}),(0,t.jsxs)("span",{className:"font-mono text-[10px] leading-3.5 text-muted-foreground",children:[O(e.bytes),e.note&&` \xb7 ${e.note}`]})]}),(0,t.jsx)("button",{type:"button","aria-label":`Take ${e.name} out`,onClick:()=>n(e.key),className:"grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(u.X,{className:"size-3.5"})})]},e.key)),s]})}let F=null,L={claim:e=>(F=e,()=>{F===e&&(F=null)}),offer:(e,t)=>!!F&&!!e?.closest?.("[data-room]")&&(F(t),!0)},O=e=>e<1048576?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`;e.s(["GivenFiles",0,q,"roomDrop",0,L,"useGivenFiles",0,I],709190);var E=e.i(319841);function K({className:e,children:n}){return(0,t.jsx)("div",{className:(0,D.cn)("flex min-w-0 flex-col gap-2.5 rounded-[18px] bg-muted py-2 pr-2 pl-3.5",e),children:n})}function H({bot:e,word:n,children:a}){return(0,t.jsxs)("div",{className:"flex min-h-7 min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{title:e.name,className:"shrink-0 leading-none",children:(0,t.jsx)(V,{bot:e,size:16})}),(0,t.jsx)("span",{className:(0,D.cn)("truncate text-[12px] leading-4 font-medium",D.WAITING_INK),children:n}),a]})}function P({options:e,picked:n,busy:a,onChoose:s}){return(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map(e=>(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",loading:n===e,disabled:a,onClick:()=>s(e),className:"h-7 gap-1.5 rounded-full bg-background px-3 text-[12.5px] hover:bg-background/60 dark:hover:bg-background/60",children:[e===N.THREAD_CONTINUE&&n!==e&&(0,t.jsx)(i.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),e]},e))})}function U({threadId:e,recipient:a,draftKey:s,send:r,busy:i,placeholder:o,label:c,autoFocus:u=!1,onEscape:x,leading:b,trailing:h,className:f}){let[g,j]=(0,m.useState)(()=>z.threadDrafts.get(e,a,s)),[v,w]=(0,m.useState)(!1),y=t=>{j(t),z.threadDrafts.set(e,a,t,s)},N=I(),S=(0,m.useRef)(null),{take:T}=N;(0,m.useEffect)(()=>L.claim(e=>void T(e)),[T]);let C=!!g.trim()&&!i&&!N.arriving,_=async()=>{C&&(w(!0),await r(N.withPaths(g))&&(y(""),N.clear()),w(!1))};return(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),_()},className:(0,D.cn)("flex min-w-0 flex-wrap items-end gap-1",f),children:[N.files.length>0&&(0,t.jsx)(q,{dense:!0,files:N.files,onRemove:N.remove,className:"w-full pb-1"}),b,(0,t.jsx)(k.Textarea,{value:g,rows:1,disabled:i,autoFocus:u,onChange:e=>y(e.target.value),onPaste:e=>{let t=[...e.clipboardData.files];t.length&&(e.preventDefault(),T(t))},onKeyDown:e=>{let t=(0,E.composing)(e);if("Escape"===e.key&&x&&!t){e.preventDefault(),x();return}"Enter"!==e.key||e.shiftKey||t||(e.preventDefault(),_())},placeholder:o,"aria-label":c,className:"max-h-32 min-h-0 min-w-0 flex-1 resize-none border-0 bg-transparent px-0 py-1 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),(0,t.jsx)("input",{ref:S,type:"file",multiple:!0,hidden:!0,onChange:e=>{T([...e.target.files??[]]),e.target.value=""}}),(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:i,"aria-label":"Add files",onClick:()=>S.current?.click(),className:"rounded-full text-muted-foreground",children:(0,t.jsx)(d.Paperclip,{})}),h,(0,t.jsx)(p.Button,{type:"submit",size:"icon-sm",variant:C?"default":"ghost",disabled:!C,"aria-label":"Send",className:"rounded-full",children:v?(0,t.jsx)(l.Loader2,{className:"animate-spin"}):(0,t.jsx)(n.ArrowUp,{})})]})}function G({current:e,bots:n,disabled:s,onPick:r}){return(0,t.jsxs)(b.DropdownMenu,{children:[(0,t.jsxs)(b.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",disabled:s,"aria-label":`Message ${e.name}; choose another bot`,className:"mt-1 inline-flex h-5 shrink-0 items-center gap-1 self-start rounded-full bg-muted pr-1.5 pl-[3px] text-[12px] leading-none font-medium outline-none transition-colors hover:bg-muted-foreground/15 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50"}),children:[(0,t.jsx)("span",{className:"pl-1 text-muted-foreground",children:"To"}),(0,t.jsx)(V,{bot:e,size:14}),(0,t.jsx)("span",{className:"max-w-32 truncate",children:e.name}),(0,t.jsx)(a.ChevronDown,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)(b.DropdownMenuContent,{align:"start",children:(0,t.jsx)(b.DropdownMenuGroup,{children:n.map(e=>(0,t.jsxs)(b.DropdownMenuItem,{onClick:()=>r(e.name),children:[(0,t.jsx)(V,{bot:e,size:16}),e.name]},e.name))})})]})}function V({bot:e,size:n}){return(0,t.jsx)(S.BotMark,{size:n,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"})}function Q(){let[e,t]=(0,T.useServerAction)(j.answerThreadAction,{onOk:()=>(0,C.revalidate)(x.queryKey.threads)});return[async(t,n,a,s)=>{let r=n.trim();if(!r)return!1;try{let n=await e(t.id,r,a,s);return z.screenActs.announce({kind:"answered",id:n.id,label:n.label,answer:r,recipient:a,replyTo:s}),!0}catch{return!1}},t]}e.s(["ThreadReply",0,function({thread:e,status:n,faces:a=[],to:i=null,className:d}){let[b,k]=(0,m.useState)(),[j,w]=(0,m.useState)(()=>z.threadDrafts.recipient(e.id)??e.bot),[S,_]=(0,m.useState)(!1),[A,B]=(0,m.useState)(null),[R,$]=(0,m.useState)({id:e.id,bot:e.bot});(R.id!==e.id||R.bot!==e.bot)&&($({id:e.id,bot:e.bot}),w(z.threadDrafts.recipient(e.id)??e.bot),k(void 0),_(!1)),(0,m.useEffect)(()=>{i&&(z.threadDrafts.select(e.id,i),w(i))},[e.id,i]);let I=e.room.participants,q=e.room.questions,F=Math.max(0,q.findIndex(e=>e.id===b)),L=q[F],O="waiting"===n?e.ask:null,E=(0,N.isAppStop)(O),V=L?.bot??(I.some(e=>e.bot===j)?j:e.bot),W=L?.id,[X,Y]=Q(),[J,Z]=(0,T.useServerAction)(v.cancelThreadAction,{onOk:e=>{(0,C.revalidate)(x.queryKey.threads),z.screenActs.announce({kind:"stopped",id:e.id,label:e.label})}}),ee=Y||Z,et=e.room.deliveries.filter(e=>!e.delivered),[en,ea]=(0,T.useServerAction)(y,{onOk:()=>(0,C.revalidate)(x.queryKey.threads)}),es=et.map(e=>`${e.bot}: ${e.text}`).join(" · "),er=I.filter(e=>"running"===e.state).map(e=>e.bot),ei=er.join(", ")||e.bot,eo="running"===n&&I.some(e=>e.bot===V&&("running"===e.state||"queued"===e.state)),el="running"===n&&!eo,ed=V!==e.bot,ec=e=>a.find(t=>t.name===e)??{name:e},eu=async t=>{if(ee)return!1;let n=await X(e,t,V,W);return n&&eo&&_(!1),n},em=async e=>{B(e),await eu(e),B(null)},ex=(a=!1)=>"running"===n||"waiting"===n?(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",loading:Z,disabled:ee,onClick:()=>J(e.id),"aria-label":"Stop this thread",className:(0,D.cn)("h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",a&&"bg-background px-3 hover:bg-background/60 dark:hover:bg-background/60"),children:[!Z&&(0,t.jsx)(c.Square,{className:"size-2.5 fill-current"}),"Stop"]}):null;if(L){let n=L.options??[],a=L.text;return(0,t.jsxs)(K,{className:d,children:[(0,t.jsx)(H,{bot:ec(V),word:"Question",children:(0,t.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[q.length>1&&(0,t.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Previous question",disabled:ee||0===F,onClick:()=>k(q[F-1].id),children:(0,t.jsx)(s.ChevronLeft,{})}),(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums","aria-live":"polite",children:[F+1," / ",q.length]}),(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Next question",disabled:ee||F===q.length-1,onClick:()=>k(q[F+1].id),children:(0,t.jsx)(r.ChevronRight,{})})]}),ex(!0)]})}),a&&(0,t.jsx)("div",{className:"max-h-[min(14rem,30vh)] min-w-0 overflow-y-auto overscroll-contain pr-1.5",children:(0,t.jsx)(f.Markdown,{className:"min-w-0 text-[13px] leading-snug wrap-anywhere break-keep [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:a})}),n.length>0&&(0,t.jsx)(P,{options:n,picked:A,busy:ee,onChoose:em}),(0,t.jsx)(M,{bot:V,onAllowed:eu}),(0,t.jsx)(U,{threadId:e.id,recipient:V,draftKey:L.id,send:eu,busy:ee,placeholder:n.length?"Or write your own answer…":"Your answer…",label:`Answer for ${V}`},JSON.stringify([e.id,V,L.id]))]})}return E?(0,t.jsxs)(K,{className:d,children:[(0,t.jsx)(H,{bot:ec(e.bot),word:"Paused",children:(0,t.jsx)("span",{className:"ml-auto flex shrink-0",children:ex(!0)})}),O?.question&&(0,t.jsx)(h.FoldedText,{text:O.question,subject:"message",clamp:"line-clamp-3",tall:"max-h-40"}),(0,t.jsx)(P,{options:O?.options.length?O.options:[N.THREAD_CONTINUE],picked:A,busy:ee,onChoose:em}),(0,t.jsx)(U,{threadId:e.id,recipient:V,send:eu,busy:ee,placeholder:"Or put it another way…",label:`Message for ${V}`},JSON.stringify([e.id,V,"paused"]))]}):eo&&!S?(0,t.jsxs)("div",{className:(0,D.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 ring-1 ring-border/50",d),children:[et.map(n=>(0,t.jsxs)("div",{className:"flex items-start gap-2 border-border/60 border-b py-2.5 pr-1.5 pl-3.5",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsxs)("p",{className:"flex min-w-0 items-center gap-1.5 font-mono text-[10px] leading-4",children:[(0,t.jsx)(l.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}),(0,t.jsx)(g.ShinyText,{text:`Step-in \xb7 waits for ${n.bot}'s next step`,speed:2.2,className:"min-w-0 truncate"})]}),(0,t.jsx)("p",{className:"whitespace-pre-wrap break-keep wrap-anywhere text-[13px] leading-snug",children:n.text})]}),(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:ea,onClick:()=>en(e.id,n.id),"aria-label":"Take it back",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:(0,t.jsx)(u.X,{})})]},n.id)),(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2 py-1.5 pr-1.5 pl-3.5",children:[(0,t.jsx)(g.ShinyText,{text:`${ei} \xb7 Working`,speed:2.4,className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",disabled:ee,onClick:()=>_(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,t.jsx)(o.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),ex()]})]}):(0,t.jsxs)("div",{className:(0,D.cn)("flex min-w-0 flex-col gap-1.5",d),children:[el&&(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2 pr-1.5 pl-3.5",children:[(0,t.jsxs)("p",{className:"flex min-w-0 flex-1 items-center gap-1.5 text-[12.5px] leading-5",children:[(0,t.jsxs)("span",{className:"shrink-0 text-muted-foreground",children:[V," is idle"]}),er.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/50",children:"·"}),(0,t.jsx)(g.ShinyText,{text:`${er.join(", ")} working`,speed:2.4,className:"min-w-0 truncate"})]})]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),ex()]}),(0,t.jsx)(U,{threadId:e.id,recipient:V,send:eu,busy:ee,autoFocus:eo,onEscape:eo?()=>_(!1):void 0,placeholder:eo?`What's off? ${V} reads this before its next step`:el?`Anything for ${V}? It starts again as soon as you send`:"Anything more? It picks up where it left off",label:`Message for ${V}`,className:"rounded-2xl bg-background py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",leading:I.length>1?(0,t.jsx)(G,{current:ec(V),bots:I.map(e=>ec(e.bot)),disabled:ee,onPick:t=>{z.threadDrafts.select(e.id,t),w(t)}}):null,trailing:eo?(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:ee,onClick:()=>_(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,t.jsx)(u.X,{})}):null},JSON.stringify([e.id,V])),ed&&(0,t.jsxs)("p",{className:"min-w-0 truncate px-1 text-xs text-muted-foreground",children:[V,"’s answer goes back to ",e.bot]}),!!es&&!eo&&(0,t.jsxs)("p",{className:"flex min-w-0 items-center gap-2 px-1 text-xs text-muted-foreground",children:[(0,t.jsx)(l.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsxs)("span",{className:"truncate",children:["Sending to ",es]})]})]})},"useAnswerThread",0,Q],399512)},186882,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f97f3d8097e9dd928e8380c0b2ae11b6a3ed0f837",t.callServer,void 0,t.findSourceMapURL,"answerThreadAction");e.s(["answerThreadAction",0,n])},750456,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7fd1c34898b1d9b8c18a494235f4d821ea402d2c13",t.callServer,void 0,t.findSourceMapURL,"cancelThreadAction");e.s(["cancelThreadAction",0,n])},931619,e=>{"use strict";var t=e.i(456420);let n={name:"chevrons-right",size:24,node:[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]};n.node;let a=(0,t.default)(n);e.s(["ChevronsRight",0,a],931619)},51481,e=>{"use strict";var t=e.i(456420);let n={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};n.node;let a=(0,t.default)(n);e.s(["CircleQuestionMark",0,a],51481)},919191,e=>{"use strict";var t=e.i(456420);let n={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};n.node;let a=(0,t.default)(n);e.s(["CornerDownLeft",0,a],919191)},64801,e=>{"use strict";var t=e.i(456420);let n={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]};n.node;let a=(0,t.default)(n);e.s(["Paperclip",0,a],64801)},825398,815731,e=>{"use strict";var t=e.i(456420);let n={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};n.node;let a=(0,t.default)(n);e.s(["RotateCw",0,a],825398);var s=e.i(843476),r=e.i(176782),i=e.i(552245),o=e.i(225913),l=e.i(647163);let d=(0,o.cva)("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});(0,o.cva)("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}}),e.s(["Bubble",0,function({variant:e="default",align:t="start",className:n,...a}){return(0,s.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,l.cn)(d({variant:e}),n),...a})},"BubbleContent",0,function({className:e,render:t,...n}){var a;return a={defaultTagName:"div",props:(0,r.mergeProps)({className:(0,l.cn)("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",e)},n),render:t,state:{slot:"bubble-content"}},(0,i.useRenderElement)(a.defaultTagName??"div",a,a)}],815731)},929272,e=>{"use strict";var t=e.i(456420);let n={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};n.node;let a=(0,t.default)(n);e.s(["Square",0,a],929272)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,480869,e=>{"use strict";var t=e.i(843476),n=e.i(401851),a=e.i(493801),s=e.i(456420);let i={name:"calendar-days",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M12 13h.01",key:"y0uutt"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M8 17h.01",key:"p3bg7i"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M16 17h.01",key:"ql8jdd"}]]};i.node;let r=(0,s.default)(i);var l=e.i(689664),o=e.i(716327),d=e.i(867927),u=e.i(632781),c=e.i(648119),m=e.i(21357),h=e.i(759659),x=e.i(263676),f=e.i(271645),p=e.i(798120),g=e.i(167881),b=e.i(630374),j=e.i(463415),y=e.i(23750),k=e.i(917162),v=e.i(421429),w=e.i(660302),N=e.i(319036),M=e.i(184762),S=e.i(41533),D=e.i(635963),T=e.i(978411),C=e.i(895836),$=e.i(989409),R=e.i(245629),O=e.i(609856),A=e.i(283653),z=e.i(647163),q=e.i(95187);let I=(0,q.createServerReference)("7ff4ff4876a9a3117f8c3a270dbdc3f12d40e19cbc",q.callServer,void 0,q.findSourceMapURL,"createRoutineAction"),E=(0,q.createServerReference)("7f3c723276b9cc18dcd61940331cc94124d50945bf",q.callServer,void 0,q.findSourceMapURL,"deleteRoutineAction"),P=(0,q.createServerReference)("7f23daacf2cfdea17779c77c96ea0e6fa530e806f5",q.callServer,void 0,q.findSourceMapURL,"runRoutineNowAction"),B=(0,q.createServerReference)("7f2f053a6a8607efed4fe598279bacb666a3365d72",q.callServer,void 0,q.findSourceMapURL,"updateRoutineAction");var F=e.i(504565);let H=[1,2,3,4,5,6,7],U=F.default.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"A time is HH:MM, 00:00 to 23:59");function K(e){let[t,n]=e.split(" "),[a,s,i]=t.split("-").map(Number),[r,l]=n.split(":").map(Number);return new Date(a,s-1,i,r,l)}let W=/^\d{4}-\d\d-\d\d ([01]\d|2[0-3]):[0-5]\d$/,L=F.default.string().regex(W,'A moment is "YYYY-MM-DD HH:MM"').refine(e=>{if(!W.test(e))return!0;let t=K(e);return t.getMonth()===Number(e.slice(5,7))-1&&t.getDate()===Number(e.slice(8,10))},"There is no such day"),G=F.default.discriminatedUnion("kind",[F.default.object({kind:F.default.literal("once"),at:L}),F.default.object({kind:F.default.literal("daily"),time:U,days:F.default.array(F.default.number().int().min(1).max(7)).min(1,"Pick at least one day").transform(e=>[...new Set(e)].sort((e,t)=>e-t))}),F.default.object({kind:F.default.literal("every"),hours:F.default.number().int().min(S.ROUTINE.minHours,`No more often than every ${S.ROUTINE.minHours}h`).max(168)})]),J=F.default.object({bot:F.default.string().trim().min(1,"Pick a bot"),label:F.default.string().trim().min(1,"Give it a name").max(80),request:F.default.string().trim().min(1,"Say what it should do"),schedule:G}),Y=F.default.object({id:F.default.string(),status:F.default.enum(["running","waiting","done","cancelled"]),outcome:F.default.string().nullable(),updatedAt:R.DateLikeSchema});J.extend({id:F.default.string(),enabled:F.default.boolean(),nextRunAt:R.DateLikeSchema,runs:F.default.array(Y)});let _=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],V=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function X(e){if("once"===e.kind){let[t,n]=e.at.split(" "),[,a,s]=t.split("-").map(Number);return`Once \xb7 ${V[a-1]} ${s} ${n}`}if("every"===e.kind)return 1===e.hours?"Every hour":`Every ${e.hours} hours`;let{days:t,time:n}=e;if(7===t.length)return`Daily ${n}`;if(1===t.length)return`${_[t[0]-1]} ${n}`;let a=t.every((e,n)=>0===n||e===t[n-1]+1)?`${_[t[0]-1]}–${_[t.at(-1)-1]}`:t.map(e=>_[e-1]).join(" ");return`Daily ${n} \xb7 ${a}`}var Q=e.i(431594);function Z({routine:e,bots:n,open:a,onOpen:s,onSwitch:i}){let r=function(e,t){let n=e.runs[0],a=n?.outcome?(0,z.plainText)(n.outcome):"",s=n?`${(0,R.whenOf)(n.updatedAt)}${a?` — ${a}`:""}`:"Not run yet";if(!e.enabled)return{text:`Off \xb7 ${s}`,tone:"text-muted-foreground"};let i=t?.find(t=>t.name===e.bot);return t&&(!i||i.disabled)?{text:i?`${e.bot} is switched off`:`${e.bot} is gone — pick another bot`,tone:z.WAITING_INK,waits:!0}:n?.status==="running"?{text:"Running now",tone:"",shine:!0}:n?.status==="waiting"?{text:`The last run waits on you${a?`: ${a}`:""}`,tone:z.WAITING_INK,waits:!0}:{text:s,tone:"text-muted-foreground"}}(e,n),l=e.runs[0]?.status==="running";return(0,t.jsxs)("div",{className:(0,z.cn)("flex items-center gap-3 p-4 transition-colors",a?"bg-muted/80":"hover:bg-muted/50"),children:[(0,t.jsxs)("button",{type:"button",onClick:s,className:(0,z.cn)("flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",!e.enabled&&"opacity-70"),children:[(0,t.jsx)(D.BotMark,{size:40,seed:e.bot,...(0,D.markOf)(e.bot,n),state:l?"thinking":"idle",notify:!!r.waits,className:"shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e.label}),l&&(0,t.jsx)(u.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"})]}),(0,t.jsx)("span",{className:"flex min-w-0 text-[13px] leading-snug",children:r.shine?(0,t.jsx)(w.ShinyText,{text:r.text,speed:2.2,className:"min-w-0 truncate"}):(0,t.jsx)("span",{className:(0,z.cn)("min-w-0 truncate",r.tone),children:r.text})})]}),(0,t.jsxs)("span",{className:"flex w-44 shrink-0 flex-col items-end gap-0.5 font-mono text-[11px] leading-4 text-muted-foreground tabular-nums",children:[(0,t.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 text-foreground",children:[(0,t.jsx)(Q.RoutineMark,{className:"size-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"truncate",children:X(e.schedule)})]}),(0,t.jsx)("span",{className:"max-w-full truncate text-muted-foreground/70",children:e.enabled?`next ${(0,R.whenOf)(e.nextRunAt)}`:"off"})]})]}),(0,t.jsx)(N.Switch,{checked:e.enabled,onCheckedChange:i,"aria-label":`${e.label} on or off`,className:"shrink-0"}),(0,t.jsx)("button",{type:"button",onClick:s,"aria-label":`Open ${e.label}`,className:"shrink-0 rounded-md text-muted-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(d.ChevronRight,{className:"size-4"})})]})}let ee=e=>String(e).padStart(2,"0");function et(e,t=new Date){let a=new Date(t);return a.setDate(a.getDate()+e),(0,n.format)(a,"yyyy-MM-dd")}let en=(e,t)=>{let n=e?.schedule;return{label:e?.label??"",bot:e?.bot??t.find(e=>!e.disabled)?.name??"",request:e?.request??"",kind:n?.kind??"daily",time:n?.kind==="daily"?n.time:n?.kind==="once"?n.at.slice(11):"09:00",days:n?.kind==="daily"?n.days:[...H],hours:n?.kind==="every"?n.hours:6,date:n?.kind==="once"?n.at.slice(0,10):et(1)}};function ea(e){let t=/^\d\d:\d\d$/.test(e.time);return"once"===e.kind?t&&e.date?{kind:"once",at:`${e.date} ${e.time}`}:null:"daily"===e.kind?e.days.length&&t?{kind:"daily",time:e.time,days:e.days}:null:{kind:"every",hours:e.hours}}let es=e=>e?.kind==="once"&&K(e.at)<=new Date,ei=[{label:"Every day",days:[...H]},{label:"Weekdays",days:[1,2,3,4,5]},{label:"Weekends",days:[6,7]}],er=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],el=[1,2,3,6,12,24].filter(e=>e>=S.ROUTINE.minHours);function eo({routine:e,bots:n,onClose:a,onMade:s}){var i,r;let l,[u,w]=(0,f.useState)(null),S=(0,f.useCallback)(e=>{w(e?.closest("[data-slot=dialog-content]")??null)},[]),C="new"===e?null:e,q="new"===e?"new":e?.id??"",[F,U]=(0,f.useState)(()=>en(C,n));(0,f.useEffect)(()=>U(en(C,n)),[q]);let K=e=>U(t=>({...t,...e})),W=()=>(0,A.revalidate)(p.queryKey.routines),[L,G]=(0,O.useServerAction)(I,{onOk:e=>{W(),s(e.id)}}),[J]=(0,O.useServerAction)(B,{onOk:W}),[Y]=(0,O.useServerAction)(E,{onOk:W}),[V,Z]=(0,O.useServerAction)(P,{onOk:()=>{W(),(0,A.revalidate)(p.queryKey.threads)}}),em=ea(F),eg=em&&!es(em)&&F.label.trim()&&F.bot&&F.request.trim()?{label:F.label.trim(),bot:F.bot,request:F.request.trim(),schedule:em}:null,eb=e=>{C&&J(C.id,e)},ej=e=>{K(e);let t=ea({...F,...e});!t||es(t)||eb({schedule:t,..."once"===t.kind?{enabled:!0}:{}})},ey=!!(C&&(F.label.trim()&&F.label.trim()!==C.label||F.request.trim()&&F.request.trim()!==C.request)),ek=async()=>{!C||await k.notify.confirm({title:`Delete "${C.label}"?`,description:"It starts no more. The jobs it already opened stay.",okText:"Delete",destructive:!0})&&(await Y(C.id).catch(()=>{}),a())},ev=n.find(e=>e.name===F.bot),ew=C?.runs[0]?.status==="running"||C?.runs[0]?.status==="waiting";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{ref:S,hidden:!0}),(0,t.jsx)(b.Dialog,{open:!!(e&&u),onOpenChange:e=>!e&&a(),modal:!1,disablePointerDismissal:!0,children:(0,t.jsx)(b.DialogPortal,{container:u,children:(0,t.jsx)(b.DialogPopup,{className:"absolute inset-y-0 right-0 z-10 flex w-[min(35rem,calc(100%-13rem))] flex-col border-l border-border/60 bg-popover text-popover-foreground shadow-2xl shadow-black/10 duration-150 data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-right-4 data-closed:animate-out data-closed:fade-out-0 data-closed:slide-out-to-right-4",children:e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5 pt-3.5 pr-3 pb-1.5 pl-5",children:[ev?(0,t.jsx)(D.BotMark,{size:28,seed:ev.name,...(0,D.markOf)(ev.name,n),notify:!1,className:"shrink-0"}):(0,t.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,t.jsx)(Q.RoutineMark,{className:"size-3.5"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(b.DialogTitle,{className:"sr-only",children:C?C.label:"New routine"}),(0,t.jsx)("p",{className:"truncate text-[15px] leading-5 font-semibold",children:C?C.label:"New routine"}),C&&(0,t.jsxs)("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsx)(Q.RoutineMark,{className:"size-3 shrink-0"}),(0,t.jsxs)("span",{className:"truncate",children:[C.bot," · ",X(C.schedule),C.enabled&&` \xb7 next ${(0,R.whenOf)(C.nextRunAt)}`]})]})]}),C&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.Switch,{checked:C.enabled,onCheckedChange:e=>void J(C.id,{enabled:e}),"aria-label":`${C.label} on or off`,className:"mr-1 shrink-0"}),(0,t.jsxs)(j.DropdownMenu,{children:[(0,t.jsx)(j.DropdownMenuTrigger,{render:(0,t.jsx)(g.Button,{size:"icon-sm",variant:"ghost","aria-label":"More",className:"text-muted-foreground"}),children:(0,t.jsx)(c.MoreHorizontal,{})}),(0,t.jsx)(j.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(j.DropdownMenuItem,{variant:"destructive",onClick:ek,children:[(0,t.jsx)(h.Trash2,{}),"Delete"]})})]})]}),(0,t.jsx)(b.DialogClose,{render:(0,t.jsx)(g.Button,{size:"icon-sm",variant:"ghost","aria-label":"Close the routine"}),children:(0,t.jsx)(x.X,{})})]}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-5 pt-3 pb-5",children:[(0,t.jsxs)(ep,{label:"Name",htmlFor:"routine-name",children:[(0,t.jsx)(y.Input,{id:"routine-name",value:F.label,onChange:e=>K({label:e.target.value}),placeholder:"Morning mail",maxLength:80,autoFocus:!C}),(0,t.jsx)(ed,{children:"What it is called in this list, and what she calls it on a call."})]}),(0,t.jsxs)(ep,{label:"Bot",children:[(0,t.jsxs)(j.DropdownMenu,{children:[(0,t.jsxs)(j.DropdownMenuTrigger,{render:(0,t.jsx)(g.Button,{variant:"outline",className:"justify-start gap-2 pl-1.5 font-normal"}),children:[ev?(0,t.jsx)(D.BotMark,{size:20,seed:ev.name,...(0,D.markOf)(ev.name,n),notify:!1,className:"shrink-0"}):null,(0,t.jsx)("span",{className:(0,z.cn)(!ev&&"pl-1.5 text-muted-foreground"),children:ev?.name??(F.bot||"Pick a bot")}),(0,t.jsx)(o.ChevronDown,{className:"ml-1 size-3.5 text-muted-foreground"})]}),(0,t.jsx)(j.DropdownMenuContent,{align:"start",children:(0,t.jsx)(j.DropdownMenuGroup,{children:n.filter(e=>!e.disabled).map(e=>(0,t.jsxs)(j.DropdownMenuItem,{onClick:()=>{K({bot:e.name}),e.name!==C?.bot&&eb({bot:e.name})},children:[(0,t.jsx)(D.BotMark,{size:16,seed:e.name,...(0,D.markOf)(e.name,n),notify:!1,className:"shrink-0"}),e.name]},e.name))})})]}),(0,t.jsx)(ed,{children:"Who does the job each time it starts."})]}),(0,t.jsx)(ep,{label:"When",children:(0,t.jsxs)("div",{className:"space-y-3.5",children:[(0,t.jsx)(v.Segmented,{"aria-label":"How it starts",value:F.kind,onChange:e=>ej({kind:e}),options:[{value:"once",label:"Once"},{value:"daily",label:"On set days"},{value:"every",label:"Every few hours"}]}),(0,t.jsx)("div",{className:"space-y-2.5",children:"once"===F.kind?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ec,{word:"On",children:(0,t.jsx)(eh,{value:F.date,onPick:e=>ej({date:e})})}),(0,t.jsxs)(ec,{word:"At",children:[(0,t.jsx)(ex,{value:F.time,onChange:e=>K({time:e}),onDone:()=>ej({})}),(0,t.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"or"}),(0,t.jsx)(eu,{picked:!1,onClick:()=>{let e;return ej(((e=new Date(Date.now()+36e5)).setMinutes(5*Math.ceil(e.getMinutes()/5),0,0),{date:et(0,e),time:`${ee(e.getHours())}:${ee(e.getMinutes())}`}))},children:"In an hour"})]})]}):"daily"===F.kind?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ec,{word:"On",children:H.map(e=>{let n=F.days.includes(e);return(0,t.jsx)(eu,{picked:n,several:!0,"aria-label":er[e-1],onClick:()=>ej({days:n?F.days.filter(t=>t!==e):[...F.days,e].sort((e,t)=>e-t)}),children:_[e-1]},e)})}),(0,t.jsx)(ec,{children:ei.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>ej({days:[...e.days]}),className:"h-6.5 rounded-full bg-muted px-2.5 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:e.label},e.label))}),(0,t.jsx)(ec,{word:"At",children:(0,t.jsx)(ex,{value:F.time,onChange:e=>K({time:e}),onDone:()=>ej({})})})]}):(0,t.jsxs)(ec,{word:"Every",children:[(el.includes(F.hours)?el:[...el,F.hours].sort((e,t)=>e-t)).map(e=>(0,t.jsx)(eu,{picked:e===F.hours,onClick:()=>ej({hours:e}),className:"min-w-10 px-3",children:e},e)),(0,t.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"hours"})]})}),(0,t.jsx)(ef,{schedule:em,kind:F.kind})]})}),(0,t.jsxs)(ep,{label:"Job",htmlFor:"routine-request",children:[(0,t.jsx)(M.Textarea,{id:"routine-request",value:F.request,onChange:e=>K({request:e.target.value}),placeholder:"Go through the mail that came since the last run and draft replies to what needs one. Send nothing.",className:"min-h-28"}),(0,t.jsx)(ed,{children:"Handed to the bot as a new thread each time, with a line on how the last run ended. Nobody is there to ask, so say everything it needs."})]}),C&&(0,t.jsxs)("div",{className:"pt-1",children:[(0,t.jsx)("div",{className:"flex h-6 items-center",children:(0,t.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:"Runs"})}),0===C.runs.length?(0,t.jsx)("p",{className:"py-2 text-[13px] text-muted-foreground",children:"Not run yet."}):C.runs.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.id,void($.useSettingsStore.getState().hide(),T.roomOpens.open(t))},className:"flex h-9 w-full items-center gap-3 border-t border-border/60 text-left text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)("span",{className:"w-28 shrink-0 font-mono text-[11px] text-muted-foreground tabular-nums",children:(0,R.whenOf)(e.updatedAt)}),(0,t.jsx)("span",{className:(0,z.cn)("min-w-0 flex-1 truncate","waiting"===e.status?z.WAITING_INK:"text-muted-foreground"),children:"running"===e.status?"Running now":e.outcome?(0,z.plainText)(e.outcome):"cancelled"===e.status?"Stopped":"No words"}),(0,t.jsx)(d.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground"})]},e.id))]})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-3 border-t border-border/60 px-5 py-3",children:[(0,t.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-4 text-muted-foreground",children:C||eg?"Starts while Thursday is running on this computer, whether or not a tab is open. A time that passed meanwhile starts once, not once for each.":`Still needs ${i=F,r=em,(l=[i.label.trim()?null:"a name",i.bot?null:"a bot",!r?"a time":es(r)?"a time still ahead":null,i.request.trim()?null:"a job"].filter(e=>null!==e)).length>1?`${l.slice(0,-1).join(", ")} and ${l.at(-1)}`:l[0]??"nothing"}.`}),ey&&(0,t.jsx)(g.Button,{size:"sm",onClick:()=>{if(!C)return;let e={};F.label.trim()&&F.label.trim()!==C.label&&(e.label=F.label.trim()),F.request.trim()&&F.request.trim()!==C.request&&(e.request=F.request.trim()),Object.keys(e).length&&eb(e)},children:"Save"}),C?(0,t.jsxs)(g.Button,{variant:"outline",size:"sm",loading:Z,disabled:ew,title:ew?"Its last run is still open":void 0,onClick:()=>void V(C.id),children:[(0,t.jsx)(m.Play,{}),"Run now"]}):(0,t.jsx)(g.Button,{size:"sm",loading:G,disabled:!eg,onClick:()=>eg&&void L(eg),children:"Create"})]})]})})})})]})}let ed=({children:e})=>(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e});function eu({picked:e,several:n=!1,className:a,children:s,...i}){return(0,t.jsxs)("button",{type:"button","aria-pressed":e,className:(0,z.cn)("inline-flex h-8 items-center justify-center gap-1.5 rounded-full px-3.5 text-[13px] whitespace-nowrap outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",!e&&"text-foreground ring-1 ring-border ring-inset hover:bg-muted",e&&(n?"bg-brand/10 pl-2.5 font-medium text-brand ring-1 ring-brand/30 ring-inset":"bg-brand font-medium text-brand-foreground"),a),...i,children:[e&&n&&(0,t.jsx)(l.Check,{className:"size-3.5"}),s]})}function ec({word:e,children:n}){return(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"flex h-8 w-9 shrink-0 items-center text-[13px] text-muted-foreground",children:e}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",children:n})]})}function em(e){let t=K(`${e} 00:00`),a=(t.getTime()-K(`${et(0)} 00:00`).getTime())/864e5;return(0,n.format)(t,a<7?"EEE d":"EEE, MMM d")}function eh({value:e,onPick:n}){let a=(0,f.useRef)(null),s=[0,1,2,3].map(e=>et(e)),i=()=>a.current?.showPicker();return(0,t.jsxs)(t.Fragment,{children:[s.map((a,s)=>(0,t.jsx)(eu,{picked:a===e,onClick:()=>n(a),children:0===s?"Today":1===s?"Tomorrow":em(a)},a)),!s.includes(e)&&(0,t.jsx)(eu,{picked:!0,onClick:i,children:em(e)}),(0,t.jsxs)("span",{className:"relative",children:[(0,t.jsx)(eu,{picked:!1,"aria-label":"Another day",onClick:i,className:"w-8 px-0",children:(0,t.jsx)(r,{className:"size-3.5"})}),(0,t.jsx)("input",{ref:a,type:"date",tabIndex:-1,"aria-hidden":!0,min:s[0],value:e,onChange:e=>e.target.value&&n(e.target.value),className:"pointer-events-none absolute inset-0 opacity-0"})]})]})}function ex({value:e,onChange:n,onDone:a}){return(0,t.jsx)(y.Input,{type:"time","aria-label":"Time of day",value:e,onChange:e=>n(e.target.value),onBlur:a,onClick:e=>e.currentTarget.showPicker?.(),className:"h-8.5 w-28 px-3 text-[15px] tabular-nums md:text-[15px] [&::-webkit-calendar-picker-indicator]:hidden"})}function ef({schedule:e,kind:n}){if(!e||es(e))return(0,t.jsx)("p",{className:"text-xs text-destructive",children:e?"That time has passed. Pick a later one.":"daily"===n?"Pick a time and at least one day.":"Pick a time."});let s=function(e,t){if("once"===e.kind)return K(e.at);if("every"===e.kind)return new Date(t.getTime()+36e5*e.hours);let[n,a]=e.time.split(":").map(Number);for(let s=0;s<=7;s++){let i=new Date(t);i.setDate(i.getDate()+s),i.setHours(n,a,0,0);let r=0===i.getDay()?7:i.getDay();if(i>t&&e.days.includes(r))return i}return new Date(t.getTime()+864e5)}(e,new Date);return(0,t.jsxs)("p",{className:"flex items-start gap-2 text-[13px] leading-5",children:[(0,t.jsx)(Q.RoutineMark,{className:"mt-0.75 size-3.5 shrink-0 text-muted-foreground"}),(0,t.jsxs)("span",{className:"min-w-0",children:[X(e),(0,t.jsxs)("span",{className:"text-muted-foreground",children:[" · ","once"===e.kind?`${(0,a.formatDistanceToNowStrict)(s,{addSuffix:!0})}, then it switches itself off`:`first start ${(0,R.whenOf)(s)}`]})]})]})}function ep({label:e,htmlFor:n,children:a}){return(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)("label",{htmlFor:n,className:"w-14 shrink-0 pt-2 font-mono text-xs text-muted-foreground",children:e}),(0,t.jsx)("div",{className:"min-w-0 flex-1 space-y-1.5",children:a})]})}e.s(["RoutineSetting",0,function(){let[e,n]=(0,f.useState)(null),{data:a,isLoading:s,error:i}=(0,A.useServerRoute)(p.queryKey.routines),{data:r}=(0,A.useServerRoute)(p.queryKey.bot),[l]=(0,O.useServerAction)(B,{onOk:()=>(0,A.revalidate)(p.queryKey.routines)});if(s)return(0,t.jsx)(C.SettingSkeleton,{rows:3});if(i)return(0,t.jsx)(C.SettingError,{message:i.message});let o=a??[],d=o.filter(e=>e.enabled).length,u=o.find(t=>t.id===e);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(C.SettingScreen,{footer:(0,t.jsxs)(C.SettingRailNote,{children:[o.length," set up · ",d," on",o.length>=S.ROUTINE.max&&` \xb7 ${S.ROUTINE.max} is the most`]}),children:(0,t.jsx)(C.SettingItems,{addRow:o.length<S.ROUTINE.max?{label:"New routine",onClick:()=>n("new")}:void 0,children:0===o.length?(0,t.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:'Nothing starts by itself yet. Tell Thursday what should — "every weekday at nine, go through my mail" — or make one here.'}):o.map(a=>(0,t.jsx)(Z,{routine:a,bots:r,open:a.id===e,onOpen:()=>n(a.id),onSwitch:e=>l(a.id,{enabled:e})},a.id))})}),(0,t.jsx)(eo,{routine:"new"===e?"new":u??null,bots:r??[],onClose:()=>n(null),onMade:e=>n(e)})]})}],480869)},648119,e=>{"use strict";var t=e.i(560972);e.s(["MoreHorizontal",()=>t.default])},21357,e=>{"use strict";var t=e.i(456420);let n={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};n.node;let a=(0,t.default)(n);e.s(["Play",0,a],21357)},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 a=(0,t.default)(n);e.s(["Trash2",0,a],759659)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,480869,e=>{"use strict";var t=e.i(843476),n=e.i(401851),a=e.i(493801),s=e.i(456420);let i={name:"calendar-days",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M12 13h.01",key:"y0uutt"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M8 17h.01",key:"p3bg7i"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M16 17h.01",key:"ql8jdd"}]]};i.node;let r=(0,s.default)(i);var l=e.i(689664),o=e.i(716327),d=e.i(867927),u=e.i(632781),c=e.i(648119),m=e.i(21357),h=e.i(759659),x=e.i(263676),f=e.i(271645),p=e.i(798120),g=e.i(167881),b=e.i(630374),j=e.i(463415),y=e.i(23750),k=e.i(917162),v=e.i(421429),w=e.i(660302),N=e.i(319036),M=e.i(184762),S=e.i(41533),D=e.i(635963),T=e.i(978411),C=e.i(895836),$=e.i(989409),R=e.i(245629),O=e.i(609856),A=e.i(283653),z=e.i(647163),q=e.i(95187);let I=(0,q.createServerReference)("7f06d92c21777b885f1a5d5bc43c653de9d3072114",q.callServer,void 0,q.findSourceMapURL,"createRoutineAction"),E=(0,q.createServerReference)("7ff09b093ff7cae3b125dbf4cef60382244f216c14",q.callServer,void 0,q.findSourceMapURL,"deleteRoutineAction"),P=(0,q.createServerReference)("7fc537c27af31ea9dd07bb659cd830f424d9db8da0",q.callServer,void 0,q.findSourceMapURL,"runRoutineNowAction"),B=(0,q.createServerReference)("7f1dd5d74cf91e923b32a7d021be995694527b5001",q.callServer,void 0,q.findSourceMapURL,"updateRoutineAction");var F=e.i(504565);let H=[1,2,3,4,5,6,7],U=F.default.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/,"A time is HH:MM, 00:00 to 23:59");function K(e){let[t,n]=e.split(" "),[a,s,i]=t.split("-").map(Number),[r,l]=n.split(":").map(Number);return new Date(a,s-1,i,r,l)}let W=/^\d{4}-\d\d-\d\d ([01]\d|2[0-3]):[0-5]\d$/,L=F.default.string().regex(W,'A moment is "YYYY-MM-DD HH:MM"').refine(e=>{if(!W.test(e))return!0;let t=K(e);return t.getMonth()===Number(e.slice(5,7))-1&&t.getDate()===Number(e.slice(8,10))},"There is no such day"),G=F.default.discriminatedUnion("kind",[F.default.object({kind:F.default.literal("once"),at:L}),F.default.object({kind:F.default.literal("daily"),time:U,days:F.default.array(F.default.number().int().min(1).max(7)).min(1,"Pick at least one day").transform(e=>[...new Set(e)].sort((e,t)=>e-t))}),F.default.object({kind:F.default.literal("every"),hours:F.default.number().int().min(S.ROUTINE.minHours,`No more often than every ${S.ROUTINE.minHours}h`).max(168)})]),J=F.default.object({bot:F.default.string().trim().min(1,"Pick a bot"),label:F.default.string().trim().min(1,"Give it a name").max(80),request:F.default.string().trim().min(1,"Say what it should do"),schedule:G}),Y=F.default.object({id:F.default.string(),status:F.default.enum(["running","waiting","done","cancelled"]),outcome:F.default.string().nullable(),updatedAt:R.DateLikeSchema});J.extend({id:F.default.string(),enabled:F.default.boolean(),nextRunAt:R.DateLikeSchema,runs:F.default.array(Y)});let _=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],V=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function X(e){if("once"===e.kind){let[t,n]=e.at.split(" "),[,a,s]=t.split("-").map(Number);return`Once \xb7 ${V[a-1]} ${s} ${n}`}if("every"===e.kind)return 1===e.hours?"Every hour":`Every ${e.hours} hours`;let{days:t,time:n}=e;if(7===t.length)return`Daily ${n}`;if(1===t.length)return`${_[t[0]-1]} ${n}`;let a=t.every((e,n)=>0===n||e===t[n-1]+1)?`${_[t[0]-1]}–${_[t.at(-1)-1]}`:t.map(e=>_[e-1]).join(" ");return`Daily ${n} \xb7 ${a}`}var Q=e.i(431594);function Z({routine:e,bots:n,open:a,onOpen:s,onSwitch:i}){let r=function(e,t){let n=e.runs[0],a=n?.outcome?(0,z.plainText)(n.outcome):"",s=n?`${(0,R.whenOf)(n.updatedAt)}${a?` — ${a}`:""}`:"Not run yet";if(!e.enabled)return{text:`Off \xb7 ${s}`,tone:"text-muted-foreground"};let i=t?.find(t=>t.name===e.bot);return t&&(!i||i.disabled)?{text:i?`${e.bot} is switched off`:`${e.bot} is gone — pick another bot`,tone:z.WAITING_INK,waits:!0}:n?.status==="running"?{text:"Running now",tone:"",shine:!0}:n?.status==="waiting"?{text:`The last run waits on you${a?`: ${a}`:""}`,tone:z.WAITING_INK,waits:!0}:{text:s,tone:"text-muted-foreground"}}(e,n),l=e.runs[0]?.status==="running";return(0,t.jsxs)("div",{className:(0,z.cn)("flex items-center gap-3 p-4 transition-colors",a?"bg-muted/80":"hover:bg-muted/50"),children:[(0,t.jsxs)("button",{type:"button",onClick:s,className:(0,z.cn)("flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",!e.enabled&&"opacity-70"),children:[(0,t.jsx)(D.BotMark,{size:40,seed:e.bot,...(0,D.markOf)(e.bot,n),state:l?"thinking":"idle",notify:!!r.waits,className:"shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e.label}),l&&(0,t.jsx)(u.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"})]}),(0,t.jsx)("span",{className:"flex min-w-0 text-[13px] leading-snug",children:r.shine?(0,t.jsx)(w.ShinyText,{text:r.text,speed:2.2,className:"min-w-0 truncate"}):(0,t.jsx)("span",{className:(0,z.cn)("min-w-0 truncate",r.tone),children:r.text})})]}),(0,t.jsxs)("span",{className:"flex w-44 shrink-0 flex-col items-end gap-0.5 font-mono text-[11px] leading-4 text-muted-foreground tabular-nums",children:[(0,t.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 text-foreground",children:[(0,t.jsx)(Q.RoutineMark,{className:"size-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"truncate",children:X(e.schedule)})]}),(0,t.jsx)("span",{className:"max-w-full truncate text-muted-foreground/70",children:e.enabled?`next ${(0,R.whenOf)(e.nextRunAt)}`:"off"})]})]}),(0,t.jsx)(N.Switch,{checked:e.enabled,onCheckedChange:i,"aria-label":`${e.label} on or off`,className:"shrink-0"}),(0,t.jsx)("button",{type:"button",onClick:s,"aria-label":`Open ${e.label}`,className:"shrink-0 rounded-md text-muted-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(d.ChevronRight,{className:"size-4"})})]})}let ee=e=>String(e).padStart(2,"0");function et(e,t=new Date){let a=new Date(t);return a.setDate(a.getDate()+e),(0,n.format)(a,"yyyy-MM-dd")}let en=(e,t)=>{let n=e?.schedule;return{label:e?.label??"",bot:e?.bot??t.find(e=>!e.disabled)?.name??"",request:e?.request??"",kind:n?.kind??"daily",time:n?.kind==="daily"?n.time:n?.kind==="once"?n.at.slice(11):"09:00",days:n?.kind==="daily"?n.days:[...H],hours:n?.kind==="every"?n.hours:6,date:n?.kind==="once"?n.at.slice(0,10):et(1)}};function ea(e){let t=/^\d\d:\d\d$/.test(e.time);return"once"===e.kind?t&&e.date?{kind:"once",at:`${e.date} ${e.time}`}:null:"daily"===e.kind?e.days.length&&t?{kind:"daily",time:e.time,days:e.days}:null:{kind:"every",hours:e.hours}}let es=e=>e?.kind==="once"&&K(e.at)<=new Date,ei=[{label:"Every day",days:[...H]},{label:"Weekdays",days:[1,2,3,4,5]},{label:"Weekends",days:[6,7]}],er=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],el=[1,2,3,6,12,24].filter(e=>e>=S.ROUTINE.minHours);function eo({routine:e,bots:n,onClose:a,onMade:s}){var i,r;let l,[u,w]=(0,f.useState)(null),S=(0,f.useCallback)(e=>{w(e?.closest("[data-slot=dialog-content]")??null)},[]),C="new"===e?null:e,q="new"===e?"new":e?.id??"",[F,U]=(0,f.useState)(()=>en(C,n));(0,f.useEffect)(()=>U(en(C,n)),[q]);let K=e=>U(t=>({...t,...e})),W=()=>(0,A.revalidate)(p.queryKey.routines),[L,G]=(0,O.useServerAction)(I,{onOk:e=>{W(),s(e.id)}}),[J]=(0,O.useServerAction)(B,{onOk:W}),[Y]=(0,O.useServerAction)(E,{onOk:W}),[V,Z]=(0,O.useServerAction)(P,{onOk:()=>{W(),(0,A.revalidate)(p.queryKey.threads)}}),em=ea(F),eg=em&&!es(em)&&F.label.trim()&&F.bot&&F.request.trim()?{label:F.label.trim(),bot:F.bot,request:F.request.trim(),schedule:em}:null,eb=e=>{C&&J(C.id,e)},ej=e=>{K(e);let t=ea({...F,...e});!t||es(t)||eb({schedule:t,..."once"===t.kind?{enabled:!0}:{}})},ey=!!(C&&(F.label.trim()&&F.label.trim()!==C.label||F.request.trim()&&F.request.trim()!==C.request)),ek=async()=>{!C||await k.notify.confirm({title:`Delete "${C.label}"?`,description:"It starts no more. The jobs it already opened stay.",okText:"Delete",destructive:!0})&&(await Y(C.id).catch(()=>{}),a())},ev=n.find(e=>e.name===F.bot),ew=C?.runs[0]?.status==="running"||C?.runs[0]?.status==="waiting";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{ref:S,hidden:!0}),(0,t.jsx)(b.Dialog,{open:!!(e&&u),onOpenChange:e=>!e&&a(),modal:!1,disablePointerDismissal:!0,children:(0,t.jsx)(b.DialogPortal,{container:u,children:(0,t.jsx)(b.DialogPopup,{className:"absolute inset-y-0 right-0 z-10 flex w-[min(35rem,calc(100%-13rem))] flex-col border-l border-border/60 bg-popover text-popover-foreground shadow-2xl shadow-black/10 duration-150 data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-right-4 data-closed:animate-out data-closed:fade-out-0 data-closed:slide-out-to-right-4",children:e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5 pt-3.5 pr-3 pb-1.5 pl-5",children:[ev?(0,t.jsx)(D.BotMark,{size:28,seed:ev.name,...(0,D.markOf)(ev.name,n),notify:!1,className:"shrink-0"}):(0,t.jsx)("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:(0,t.jsx)(Q.RoutineMark,{className:"size-3.5"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(b.DialogTitle,{className:"sr-only",children:C?C.label:"New routine"}),(0,t.jsx)("p",{className:"truncate text-[15px] leading-5 font-semibold",children:C?C.label:"New routine"}),C&&(0,t.jsxs)("p",{className:"mt-0.5 flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsx)(Q.RoutineMark,{className:"size-3 shrink-0"}),(0,t.jsxs)("span",{className:"truncate",children:[C.bot," · ",X(C.schedule),C.enabled&&` \xb7 next ${(0,R.whenOf)(C.nextRunAt)}`]})]})]}),C&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.Switch,{checked:C.enabled,onCheckedChange:e=>void J(C.id,{enabled:e}),"aria-label":`${C.label} on or off`,className:"mr-1 shrink-0"}),(0,t.jsxs)(j.DropdownMenu,{children:[(0,t.jsx)(j.DropdownMenuTrigger,{render:(0,t.jsx)(g.Button,{size:"icon-sm",variant:"ghost","aria-label":"More",className:"text-muted-foreground"}),children:(0,t.jsx)(c.MoreHorizontal,{})}),(0,t.jsx)(j.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(j.DropdownMenuItem,{variant:"destructive",onClick:ek,children:[(0,t.jsx)(h.Trash2,{}),"Delete"]})})]})]}),(0,t.jsx)(b.DialogClose,{render:(0,t.jsx)(g.Button,{size:"icon-sm",variant:"ghost","aria-label":"Close the routine"}),children:(0,t.jsx)(x.X,{})})]}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-5 pt-3 pb-5",children:[(0,t.jsxs)(ep,{label:"Name",htmlFor:"routine-name",children:[(0,t.jsx)(y.Input,{id:"routine-name",value:F.label,onChange:e=>K({label:e.target.value}),placeholder:"Morning mail",maxLength:80,autoFocus:!C}),(0,t.jsx)(ed,{children:"What it is called in this list, and what she calls it on a call."})]}),(0,t.jsxs)(ep,{label:"Bot",children:[(0,t.jsxs)(j.DropdownMenu,{children:[(0,t.jsxs)(j.DropdownMenuTrigger,{render:(0,t.jsx)(g.Button,{variant:"outline",className:"justify-start gap-2 pl-1.5 font-normal"}),children:[ev?(0,t.jsx)(D.BotMark,{size:20,seed:ev.name,...(0,D.markOf)(ev.name,n),notify:!1,className:"shrink-0"}):null,(0,t.jsx)("span",{className:(0,z.cn)(!ev&&"pl-1.5 text-muted-foreground"),children:ev?.name??(F.bot||"Pick a bot")}),(0,t.jsx)(o.ChevronDown,{className:"ml-1 size-3.5 text-muted-foreground"})]}),(0,t.jsx)(j.DropdownMenuContent,{align:"start",children:(0,t.jsx)(j.DropdownMenuGroup,{children:n.filter(e=>!e.disabled).map(e=>(0,t.jsxs)(j.DropdownMenuItem,{onClick:()=>{K({bot:e.name}),e.name!==C?.bot&&eb({bot:e.name})},children:[(0,t.jsx)(D.BotMark,{size:16,seed:e.name,...(0,D.markOf)(e.name,n),notify:!1,className:"shrink-0"}),e.name]},e.name))})})]}),(0,t.jsx)(ed,{children:"Who does the job each time it starts."})]}),(0,t.jsx)(ep,{label:"When",children:(0,t.jsxs)("div",{className:"space-y-3.5",children:[(0,t.jsx)(v.Segmented,{"aria-label":"How it starts",value:F.kind,onChange:e=>ej({kind:e}),options:[{value:"once",label:"Once"},{value:"daily",label:"On set days"},{value:"every",label:"Every few hours"}]}),(0,t.jsx)("div",{className:"space-y-2.5",children:"once"===F.kind?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ec,{word:"On",children:(0,t.jsx)(eh,{value:F.date,onPick:e=>ej({date:e})})}),(0,t.jsxs)(ec,{word:"At",children:[(0,t.jsx)(ex,{value:F.time,onChange:e=>K({time:e}),onDone:()=>ej({})}),(0,t.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"or"}),(0,t.jsx)(eu,{picked:!1,onClick:()=>{let e;return ej(((e=new Date(Date.now()+36e5)).setMinutes(5*Math.ceil(e.getMinutes()/5),0,0),{date:et(0,e),time:`${ee(e.getHours())}:${ee(e.getMinutes())}`}))},children:"In an hour"})]})]}):"daily"===F.kind?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ec,{word:"On",children:H.map(e=>{let n=F.days.includes(e);return(0,t.jsx)(eu,{picked:n,several:!0,"aria-label":er[e-1],onClick:()=>ej({days:n?F.days.filter(t=>t!==e):[...F.days,e].sort((e,t)=>e-t)}),children:_[e-1]},e)})}),(0,t.jsx)(ec,{children:ei.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>ej({days:[...e.days]}),className:"h-6.5 rounded-full bg-muted px-2.5 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:e.label},e.label))}),(0,t.jsx)(ec,{word:"At",children:(0,t.jsx)(ex,{value:F.time,onChange:e=>K({time:e}),onDone:()=>ej({})})})]}):(0,t.jsxs)(ec,{word:"Every",children:[(el.includes(F.hours)?el:[...el,F.hours].sort((e,t)=>e-t)).map(e=>(0,t.jsx)(eu,{picked:e===F.hours,onClick:()=>ej({hours:e}),className:"min-w-10 px-3",children:e},e)),(0,t.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"hours"})]})}),(0,t.jsx)(ef,{schedule:em,kind:F.kind})]})}),(0,t.jsxs)(ep,{label:"Job",htmlFor:"routine-request",children:[(0,t.jsx)(M.Textarea,{id:"routine-request",value:F.request,onChange:e=>K({request:e.target.value}),placeholder:"Go through the mail that came since the last run and draft replies to what needs one. Send nothing.",className:"min-h-28"}),(0,t.jsx)(ed,{children:"Handed to the bot as a new thread each time, with a line on how the last run ended. Nobody is there to ask, so say everything it needs."})]}),C&&(0,t.jsxs)("div",{className:"pt-1",children:[(0,t.jsx)("div",{className:"flex h-6 items-center",children:(0,t.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:"Runs"})}),0===C.runs.length?(0,t.jsx)("p",{className:"py-2 text-[13px] text-muted-foreground",children:"Not run yet."}):C.runs.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.id,void($.useSettingsStore.getState().hide(),T.roomOpens.open(t))},className:"flex h-9 w-full items-center gap-3 border-t border-border/60 text-left text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)("span",{className:"w-28 shrink-0 font-mono text-[11px] text-muted-foreground tabular-nums",children:(0,R.whenOf)(e.updatedAt)}),(0,t.jsx)("span",{className:(0,z.cn)("min-w-0 flex-1 truncate","waiting"===e.status?z.WAITING_INK:"text-muted-foreground"),children:"running"===e.status?"Running now":e.outcome?(0,z.plainText)(e.outcome):"cancelled"===e.status?"Stopped":"No words"}),(0,t.jsx)(d.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground"})]},e.id))]})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-3 border-t border-border/60 px-5 py-3",children:[(0,t.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-4 text-muted-foreground",children:C||eg?"Starts while Thursday is running on this computer, whether or not a tab is open. A time that passed meanwhile starts once, not once for each.":`Still needs ${i=F,r=em,(l=[i.label.trim()?null:"a name",i.bot?null:"a bot",!r?"a time":es(r)?"a time still ahead":null,i.request.trim()?null:"a job"].filter(e=>null!==e)).length>1?`${l.slice(0,-1).join(", ")} and ${l.at(-1)}`:l[0]??"nothing"}.`}),ey&&(0,t.jsx)(g.Button,{size:"sm",onClick:()=>{if(!C)return;let e={};F.label.trim()&&F.label.trim()!==C.label&&(e.label=F.label.trim()),F.request.trim()&&F.request.trim()!==C.request&&(e.request=F.request.trim()),Object.keys(e).length&&eb(e)},children:"Save"}),C?(0,t.jsxs)(g.Button,{variant:"outline",size:"sm",loading:Z,disabled:ew,title:ew?"Its last run is still open":void 0,onClick:()=>void V(C.id),children:[(0,t.jsx)(m.Play,{}),"Run now"]}):(0,t.jsx)(g.Button,{size:"sm",loading:G,disabled:!eg,onClick:()=>eg&&void L(eg),children:"Create"})]})]})})})})]})}let ed=({children:e})=>(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e});function eu({picked:e,several:n=!1,className:a,children:s,...i}){return(0,t.jsxs)("button",{type:"button","aria-pressed":e,className:(0,z.cn)("inline-flex h-8 items-center justify-center gap-1.5 rounded-full px-3.5 text-[13px] whitespace-nowrap outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",!e&&"text-foreground ring-1 ring-border ring-inset hover:bg-muted",e&&(n?"bg-brand/10 pl-2.5 font-medium text-brand ring-1 ring-brand/30 ring-inset":"bg-brand font-medium text-brand-foreground"),a),...i,children:[e&&n&&(0,t.jsx)(l.Check,{className:"size-3.5"}),s]})}function ec({word:e,children:n}){return(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("span",{className:"flex h-8 w-9 shrink-0 items-center text-[13px] text-muted-foreground",children:e}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1.5",children:n})]})}function em(e){let t=K(`${e} 00:00`),a=(t.getTime()-K(`${et(0)} 00:00`).getTime())/864e5;return(0,n.format)(t,a<7?"EEE d":"EEE, MMM d")}function eh({value:e,onPick:n}){let a=(0,f.useRef)(null),s=[0,1,2,3].map(e=>et(e)),i=()=>a.current?.showPicker();return(0,t.jsxs)(t.Fragment,{children:[s.map((a,s)=>(0,t.jsx)(eu,{picked:a===e,onClick:()=>n(a),children:0===s?"Today":1===s?"Tomorrow":em(a)},a)),!s.includes(e)&&(0,t.jsx)(eu,{picked:!0,onClick:i,children:em(e)}),(0,t.jsxs)("span",{className:"relative",children:[(0,t.jsx)(eu,{picked:!1,"aria-label":"Another day",onClick:i,className:"w-8 px-0",children:(0,t.jsx)(r,{className:"size-3.5"})}),(0,t.jsx)("input",{ref:a,type:"date",tabIndex:-1,"aria-hidden":!0,min:s[0],value:e,onChange:e=>e.target.value&&n(e.target.value),className:"pointer-events-none absolute inset-0 opacity-0"})]})]})}function ex({value:e,onChange:n,onDone:a}){return(0,t.jsx)(y.Input,{type:"time","aria-label":"Time of day",value:e,onChange:e=>n(e.target.value),onBlur:a,onClick:e=>e.currentTarget.showPicker?.(),className:"h-8.5 w-28 px-3 text-[15px] tabular-nums md:text-[15px] [&::-webkit-calendar-picker-indicator]:hidden"})}function ef({schedule:e,kind:n}){if(!e||es(e))return(0,t.jsx)("p",{className:"text-xs text-destructive",children:e?"That time has passed. Pick a later one.":"daily"===n?"Pick a time and at least one day.":"Pick a time."});let s=function(e,t){if("once"===e.kind)return K(e.at);if("every"===e.kind)return new Date(t.getTime()+36e5*e.hours);let[n,a]=e.time.split(":").map(Number);for(let s=0;s<=7;s++){let i=new Date(t);i.setDate(i.getDate()+s),i.setHours(n,a,0,0);let r=0===i.getDay()?7:i.getDay();if(i>t&&e.days.includes(r))return i}return new Date(t.getTime()+864e5)}(e,new Date);return(0,t.jsxs)("p",{className:"flex items-start gap-2 text-[13px] leading-5",children:[(0,t.jsx)(Q.RoutineMark,{className:"mt-0.75 size-3.5 shrink-0 text-muted-foreground"}),(0,t.jsxs)("span",{className:"min-w-0",children:[X(e),(0,t.jsxs)("span",{className:"text-muted-foreground",children:[" · ","once"===e.kind?`${(0,a.formatDistanceToNowStrict)(s,{addSuffix:!0})}, then it switches itself off`:`first start ${(0,R.whenOf)(s)}`]})]})]})}function ep({label:e,htmlFor:n,children:a}){return(0,t.jsxs)("div",{className:"flex gap-3",children:[(0,t.jsx)("label",{htmlFor:n,className:"w-14 shrink-0 pt-2 font-mono text-xs text-muted-foreground",children:e}),(0,t.jsx)("div",{className:"min-w-0 flex-1 space-y-1.5",children:a})]})}e.s(["RoutineSetting",0,function(){let[e,n]=(0,f.useState)(null),{data:a,isLoading:s,error:i}=(0,A.useServerRoute)(p.queryKey.routines),{data:r}=(0,A.useServerRoute)(p.queryKey.bot),[l]=(0,O.useServerAction)(B,{onOk:()=>(0,A.revalidate)(p.queryKey.routines)});if(s)return(0,t.jsx)(C.SettingSkeleton,{rows:3});if(i)return(0,t.jsx)(C.SettingError,{message:i.message});let o=a??[],d=o.filter(e=>e.enabled).length,u=o.find(t=>t.id===e);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(C.SettingScreen,{footer:(0,t.jsxs)(C.SettingRailNote,{children:[o.length," set up · ",d," on",o.length>=S.ROUTINE.max&&` \xb7 ${S.ROUTINE.max} is the most`]}),children:(0,t.jsx)(C.SettingItems,{addRow:o.length<S.ROUTINE.max?{label:"New routine",onClick:()=>n("new")}:void 0,children:0===o.length?(0,t.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:'Nothing starts by itself yet. Tell Thursday what should — "every weekday at nine, go through my mail" — or make one here.'}):o.map(a=>(0,t.jsx)(Z,{routine:a,bots:r,open:a.id===e,onOpen:()=>n(a.id),onSwitch:e=>l(a.id,{enabled:e})},a.id))})}),(0,t.jsx)(eo,{routine:"new"===e?"new":u??null,bots:r??[],onClose:()=>n(null),onMade:e=>n(e)})]})}],480869)},648119,e=>{"use strict";var t=e.i(560972);e.s(["MoreHorizontal",()=>t.default])},21357,e=>{"use strict";var t=e.i(456420);let n={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};n.node;let a=(0,t.default)(n);e.s(["Play",0,a],21357)},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 a=(0,t.default)(n);e.s(["Trash2",0,a],759659)}]);