thursday-agent 0.26.0 → 0.27.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 (391) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +5 -5
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/required-server-files.json +5 -5
  5. package/.next/server/app/_global-error/page/build-manifest.json +2 -2
  6. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  7. package/.next/server/app/_global-error.html +1 -1
  8. package/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/.next/server/app/_not-found/page/build-manifest.json +2 -2
  13. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  20. package/.next/server/app/api/artifact/route.js +10 -10
  21. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  22. package/.next/server/app/api/bot/memory/files/route.js +1 -1
  23. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  24. package/.next/server/app/api/bot/memory/route.js +8 -8
  25. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  26. package/.next/server/app/api/bot/route.js +8 -8
  27. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  28. package/.next/server/app/api/bot/thread/file/route.js +15 -15
  29. package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
  30. package/.next/server/app/api/bot/thread/route.js +5 -5
  31. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  32. package/.next/server/app/api/bot/tool-result/[id]/route.js +6 -6
  33. package/.next/server/app/api/bot/tool-result/[id]/route.js.nft.json +1 -1
  34. package/.next/server/app/api/config/route.js +3 -3
  35. package/.next/server/app/api/config/route.js.nft.json +1 -1
  36. package/.next/server/app/api/events/route.js +1 -1
  37. package/.next/server/app/api/events/route.js.nft.json +1 -1
  38. package/.next/server/app/api/favicon/[host]/route.js +4 -4
  39. package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
  40. package/.next/server/app/api/file/[...path]/route.js +4 -4
  41. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  42. package/.next/server/app/api/llm-model/automatic/route.js +5 -5
  43. package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
  44. package/.next/server/app/api/llm-model/catalog/[provider]/route.js +5 -5
  45. package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -1
  46. package/.next/server/app/api/llm-model/credits/[provider]/route.js +5 -5
  47. package/.next/server/app/api/llm-model/credits/[provider]/route.js.nft.json +1 -1
  48. package/.next/server/app/api/llm-model/route.js +6 -6
  49. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  50. package/.next/server/app/api/llm-model/subscription/route.js +6 -6
  51. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  52. package/.next/server/app/api/mcp/[name]/route.js +5 -5
  53. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  54. package/.next/server/app/api/mcp/oauth/callback/route.js +6 -6
  55. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  56. package/.next/server/app/api/mcp/route.js +5 -5
  57. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  58. package/.next/server/app/api/mcp/tools/route.js +5 -5
  59. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  60. package/.next/server/app/api/memory/edit/route.js +15 -15
  61. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  62. package/.next/server/app/api/memory/route.js +4 -4
  63. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  64. package/.next/server/app/api/reach/route.js +18 -18
  65. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  66. package/.next/server/app/api/routine/route.js +8 -8
  67. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  68. package/.next/server/app/api/running/route.js +2 -2
  69. package/.next/server/app/api/running/route.js.nft.json +1 -1
  70. package/.next/server/app/api/signins/route.js +3 -3
  71. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  72. package/.next/server/app/api/skills/[source]/[name]/route.js +6 -6
  73. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  74. package/.next/server/app/api/skills/route.js +6 -6
  75. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  76. package/.next/server/app/api/thursday/call/end/route.js +5 -5
  77. package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
  78. package/.next/server/app/api/thursday/call/plan/route.js +14 -14
  79. package/.next/server/app/api/thursday/call/plan/route.js.nft.json +1 -1
  80. package/.next/server/app/api/thursday/call/route.js +6 -6
  81. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  82. package/.next/server/app/api/thursday/settings/route.js +5 -5
  83. package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
  84. package/.next/server/app/api/thursday/text/route.js +14 -14
  85. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  86. package/.next/server/app/api/thursday/tool-call/route.js +15 -15
  87. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  88. package/.next/server/app/api/update/route.js +7 -7
  89. package/.next/server/app/api/update/route.js.nft.json +1 -1
  90. package/.next/server/app/api/workspace/files/route.js +6 -6
  91. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  92. package/.next/server/app/api/workspace/route.js +6 -6
  93. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  94. package/.next/server/app/artifact/[...path]/page/build-manifest.json +2 -2
  95. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
  96. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  97. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  98. package/.next/server/app/favicon.ico/route.js +2 -2
  99. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  100. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  101. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  102. package/.next/server/app/page/build-manifest.json +2 -2
  103. package/.next/server/app/page/react-loadable-manifest.json +1 -1
  104. package/.next/server/app/page/server-reference-manifest.json +184 -184
  105. package/.next/server/app/page.js +10 -10
  106. package/.next/server/app/page.js.nft.json +1 -1
  107. package/.next/server/app/page_client-reference-manifest.js +1 -1
  108. package/.next/server/chunks/[root-of-the-server]__01jpmcj._.js +2 -2
  109. package/.next/server/chunks/[root-of-the-server]__03bjojd._.js +3 -3
  110. package/.next/server/chunks/{[root-of-the-server]__0wosonh._.js → [root-of-the-server]__05u-9a3._.js} +1 -1
  111. package/.next/server/chunks/{[root-of-the-server]__1dyse-1._.js → [root-of-the-server]__0_qe8iq._.js} +1 -1
  112. package/.next/server/chunks/[root-of-the-server]__0d-dfqm._.js +1 -1
  113. package/.next/server/chunks/[root-of-the-server]__0jqidnu._.js +1 -1
  114. package/.next/server/chunks/[root-of-the-server]__0mmynvy._.js +2 -2
  115. package/.next/server/chunks/[root-of-the-server]__0ncs9uu._.js +1 -1
  116. package/.next/server/chunks/[root-of-the-server]__0qhf60h._.js +3 -0
  117. package/.next/server/chunks/[root-of-the-server]__0sea36s._.js +4 -4
  118. package/.next/server/chunks/[root-of-the-server]__0zezbds._.js +2 -2
  119. package/.next/server/chunks/[root-of-the-server]__12hkdpz._.js +1 -1
  120. package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
  121. package/.next/server/chunks/[root-of-the-server]__14inehv._.js +3 -0
  122. package/.next/server/chunks/[root-of-the-server]__17kdjf6._.js +1 -1
  123. package/.next/server/chunks/[root-of-the-server]__17yv6lg._.js +2 -2
  124. package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +2 -2
  125. package/.next/server/chunks/{[root-of-the-server]__0b3_rzi._.js → [root-of-the-server]__1hjb8wf._.js} +1 -1
  126. package/.next/server/chunks/[root-of-the-server]__1jcu_e9._.js +2 -2
  127. package/.next/server/chunks/[root-of-the-server]__1jmr2ed._.js +3 -3
  128. package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
  129. package/.next/server/chunks/[root-of-the-server]__1o7z93z._.js +2 -2
  130. package/.next/server/chunks/[root-of-the-server]__1onvx8x._.js +2 -2
  131. package/.next/server/chunks/_0-mqt2w._.js +1 -1
  132. package/.next/server/chunks/_04s1gb9._.js +30 -27
  133. package/.next/server/chunks/_06u9yo-._.js +1 -1
  134. package/.next/server/chunks/_08354bn._.js +33 -30
  135. package/.next/server/chunks/_083t_nr._.js +1 -1
  136. package/.next/server/chunks/_0c-s0ei._.js +1 -1
  137. package/.next/server/chunks/_0gifi_2._.js +2 -2
  138. package/.next/server/chunks/_0m3sdq8._.js +1 -1
  139. package/.next/server/chunks/_0pljp-1._.js +1 -1
  140. package/.next/server/chunks/_0wjia9n._.js +1 -1
  141. package/.next/server/chunks/_0wyh244._.js +33 -30
  142. package/.next/server/chunks/_0x2mdif._.js +1 -1
  143. package/.next/server/chunks/_1-sk_q4._.js +1 -1
  144. package/.next/server/chunks/_12a_gfz._.js +1 -1
  145. package/.next/server/chunks/_14-kmob._.js +1 -1
  146. package/.next/server/chunks/_16zct7w._.js +30 -27
  147. package/.next/server/chunks/_1823_7a._.js +4 -4
  148. package/.next/server/chunks/_1f_x75d._.js +1 -1
  149. package/.next/server/chunks/_1o2r4ja._.js +1 -1
  150. package/.next/server/chunks/_1q42187._.js +3 -3
  151. package/.next/server/chunks/_1ufbxe1._.js +1 -1
  152. package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
  153. package/.next/server/chunks/features_14kex_m._.js +11 -11
  154. package/.next/server/chunks/features_bot_08z387_._.js +4 -4
  155. package/.next/server/chunks/features_memory_0__61kl._.js +1 -1
  156. package/.next/server/chunks/features_memory_1uqvksn._.js +1 -1
  157. package/.next/server/chunks/features_workspace_workspace_ts_13h82gv._.js +1 -1
  158. package/.next/server/chunks/features_workspace_workspace_ts_1iyjroj._.js +3 -3
  159. package/.next/server/chunks/ssr/{[root-of-the-server]__0x297x3._.js → [root-of-the-server]__03_9u5q._.js} +2 -2
  160. package/.next/server/chunks/ssr/{[root-of-the-server]__0653diy._.js → [root-of-the-server]__04ky8w1._.js} +2 -2
  161. package/.next/server/chunks/ssr/{[root-of-the-server]__1zlzs9j._.js → [root-of-the-server]__0crm8gr._.js} +2 -2
  162. package/.next/server/chunks/ssr/{[root-of-the-server]__02936mh._.js → [root-of-the-server]__0d3n8i_._.js} +2 -2
  163. package/.next/server/chunks/ssr/{[root-of-the-server]__0s8q44q._.js → [root-of-the-server]__0d4o9hs._.js} +2 -2
  164. package/.next/server/chunks/ssr/[root-of-the-server]__0id2dqb._.js +1 -1
  165. package/.next/server/chunks/ssr/{[root-of-the-server]__1s0etwd._.js → [root-of-the-server]__0q2c15o._.js} +2 -2
  166. package/.next/server/chunks/ssr/[root-of-the-server]__0t_oz3-._.js +6 -0
  167. package/.next/server/chunks/ssr/{[root-of-the-server]__16x99f1._.js → [root-of-the-server]__12r70jm._.js} +1 -1
  168. package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
  169. package/.next/server/chunks/ssr/{[root-of-the-server]__0glkz9k._.js → [root-of-the-server]__1fvh0zn._.js} +2 -2
  170. package/.next/server/chunks/ssr/[root-of-the-server]__1t38-p_._.js +1 -1
  171. package/.next/server/chunks/ssr/{[root-of-the-server]__1c1xyyb._.js → [root-of-the-server]__1uy0zqr._.js} +2 -2
  172. package/.next/server/chunks/ssr/_02uubus._.js +3 -0
  173. package/.next/server/chunks/ssr/_0692i-a._.js +3 -0
  174. package/.next/server/chunks/ssr/_079xt7h._.js +32 -29
  175. package/.next/server/chunks/ssr/_07g7ojr._.js +3 -0
  176. package/.next/server/chunks/ssr/_0ewhz_x._.js +3 -0
  177. package/.next/server/chunks/ssr/_0f3t9pm._.js +2 -2
  178. package/.next/server/chunks/ssr/_0gx6qzr._.js +57 -0
  179. package/.next/server/chunks/ssr/_0pjwmak._.js +6 -0
  180. package/.next/server/chunks/ssr/_0pnzfq1._.js +1 -1
  181. package/.next/server/chunks/ssr/_0px9eat._.js +3 -0
  182. package/.next/server/chunks/ssr/_0r2_l__._.js +3 -0
  183. package/.next/server/chunks/ssr/{_20_wc-g._.js → _0rcuovx._.js} +2 -2
  184. package/.next/server/chunks/ssr/_0uwhhcs._.js +3 -0
  185. package/.next/server/chunks/ssr/{_1wct0tm._.js → _128r03g._.js} +1 -1
  186. package/.next/server/chunks/ssr/_12c2n7f._.js +3 -0
  187. package/.next/server/chunks/ssr/{_12_ail7._.js → _14f64h2._.js} +1 -1
  188. package/.next/server/chunks/ssr/_17fa2ns._.js +162 -0
  189. package/.next/server/chunks/ssr/_1_px1o-._.js +3 -0
  190. package/.next/server/chunks/ssr/_1a_w_du._.js +1 -1
  191. package/.next/server/chunks/ssr/_1e_9qjr._.js +1 -1
  192. package/.next/server/chunks/ssr/_1f59vze._.js +57 -0
  193. package/.next/server/chunks/ssr/_1j5ohq5._.js +3 -0
  194. package/.next/server/chunks/ssr/{_0ingto_._.js → _1kj3d2q._.js} +2 -2
  195. package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
  196. package/.next/server/chunks/ssr/_1ocl7u0._.js +3 -0
  197. package/.next/server/chunks/ssr/_1q9r6u6._.js +3 -0
  198. package/.next/server/chunks/ssr/{_0fvctar._.js → _1qqusa-._.js} +2 -2
  199. package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
  200. package/.next/server/chunks/ssr/_1uok0wt._.js +3 -0
  201. package/.next/server/chunks/ssr/_1v1pcoh._.js +1 -1
  202. package/.next/server/chunks/ssr/_1xw9imq._.js +3 -0
  203. package/.next/server/chunks/ssr/{components_ui_markdown-body_tsx_0h7bkrz._.js → components_ui_markdown-body_tsx_08i96c6._.js} +2 -2
  204. package/.next/server/chunks/ssr/features_0rrgq_t._.js +1 -1
  205. package/.next/server/chunks/ssr/features_ai_components_model-picker_tsx_0ucb1y9._.js +1 -1
  206. package/.next/server/chunks/ssr/features_bot_0tb4ui-._.js +2 -2
  207. package/.next/server/chunks/ssr/features_bot_components_01ye2wp._.js +1 -1
  208. package/.next/server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js +2 -2
  209. package/.next/server/chunks/ssr/features_bot_components_thread-setting_tsx_0yae7zy._.js +1 -1
  210. package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +2 -2
  211. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  212. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +2 -2
  213. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  214. package/.next/server/chunks/ssr/features_skills_components_skills-setting_tsx_1wtuuip._.js +1 -1
  215. package/.next/server/chunks/ssr/features_thursday_components_thursday-setting_tsx_1_6ydrc._.js +1 -1
  216. package/.next/server/chunks/ssr/{node_modules_193w7l8._.js → node_modules_02djdfa._.js} +2 -2
  217. package/.next/server/chunks/ssr/{node_modules_1bwlhwa._.js → node_modules_03ybg-h._.js} +1 -1
  218. package/.next/server/chunks/ssr/{node_modules_01xoz64._.js → node_modules_066eqdg._.js} +1 -1
  219. package/.next/server/chunks/ssr/{node_modules_20ifwl6._.js → node_modules_09605b3._.js} +1 -1
  220. package/.next/server/chunks/ssr/{node_modules_1yilsx4._.js → node_modules_0_c17cv._.js} +1 -1
  221. package/.next/server/chunks/ssr/{node_modules_080f5gu._.js → node_modules_0a1-9-h._.js} +1 -1
  222. package/.next/server/chunks/ssr/{node_modules_17c047f._.js → node_modules_0bfpl_c._.js} +1 -1
  223. package/.next/server/chunks/ssr/{node_modules_1pav8g4._.js → node_modules_0brchjo._.js} +1 -1
  224. package/.next/server/chunks/ssr/{node_modules_0gwiuga._.js → node_modules_0c0pgdi._.js} +1 -1
  225. package/.next/server/chunks/ssr/{node_modules_02-zrtu._.js → node_modules_0ep265x._.js} +1 -1
  226. package/.next/server/chunks/ssr/{node_modules_0kqej10._.js → node_modules_0gzvt6a._.js} +2 -2
  227. package/.next/server/chunks/ssr/{node_modules_0i18max._.js → node_modules_0h4gjw5._.js} +1 -1
  228. package/.next/server/chunks/ssr/{node_modules_1m2_gxv._.js → node_modules_0iso-he._.js} +1 -1
  229. package/.next/server/chunks/ssr/{node_modules_0cda8i6._.js → node_modules_0jvqmb4._.js} +1 -1
  230. package/.next/server/chunks/ssr/node_modules_0kzgugm._.js +3 -0
  231. package/.next/server/chunks/ssr/{node_modules_0uvoegq._.js → node_modules_0l8gpkg._.js} +1 -1
  232. package/.next/server/chunks/ssr/{node_modules_12ajdg8._.js → node_modules_0mlrvds._.js} +2 -2
  233. package/.next/server/chunks/ssr/node_modules_0nvqvnw._.js +7 -7
  234. package/.next/server/chunks/ssr/{node_modules_1s3j8gb._.js → node_modules_0ogtyfm._.js} +2 -2
  235. package/.next/server/chunks/ssr/{node_modules_1_xiwxs._.js → node_modules_0os_-0h._.js} +1 -1
  236. package/.next/server/chunks/ssr/{node_modules_1abjhxx._.js → node_modules_0p05zru._.js} +1 -1
  237. package/.next/server/chunks/ssr/{node_modules_1o-m6_3._.js → node_modules_0pf8124._.js} +2 -2
  238. package/.next/server/chunks/ssr/{node_modules_0eqvt2l._.js → node_modules_0pp3v4f._.js} +2 -2
  239. package/.next/server/chunks/ssr/{node_modules_0rzz90e._.js → node_modules_0r1vv13._.js} +1 -1
  240. package/.next/server/chunks/ssr/{node_modules_1kum1yu._.js → node_modules_0r9yw6x._.js} +1 -1
  241. package/.next/server/chunks/ssr/{node_modules_1yw5fq4._.js → node_modules_0rk1a3e._.js} +1 -1
  242. package/.next/server/chunks/ssr/{node_modules_1es3wjv._.js → node_modules_0sq1pa3._.js} +2 -2
  243. package/.next/server/chunks/ssr/{node_modules_1-cv1_p._.js → node_modules_0w-pjyz._.js} +2 -2
  244. package/.next/server/chunks/ssr/{node_modules_0g_yuwn._.js → node_modules_0yoh66_._.js} +1 -1
  245. package/.next/server/chunks/ssr/{node_modules_1s9agqr._.js → node_modules_10kn3ni._.js} +2 -2
  246. package/.next/server/chunks/ssr/{node_modules_1yajzrd._.js → node_modules_124ipg-._.js} +1 -1
  247. package/.next/server/chunks/ssr/{node_modules_0svoyrb._.js → node_modules_12_p7d0._.js} +1 -1
  248. package/.next/server/chunks/ssr/{node_modules_203yqqb._.js → node_modules_12w12wr._.js} +1 -1
  249. package/.next/server/chunks/ssr/{node_modules_17ks351._.js → node_modules_16kmp_v._.js} +2 -2
  250. package/.next/server/chunks/ssr/{node_modules_05qs8r_._.js → node_modules_16m_yhd._.js} +1 -1
  251. package/.next/server/chunks/ssr/{node_modules_07dc1cr._.js → node_modules_171uvar._.js} +1 -1
  252. package/.next/server/chunks/ssr/{node_modules_0qsi9t2._.js → node_modules_19pn2ti._.js} +1 -1
  253. package/.next/server/chunks/ssr/{node_modules_0k9_jdk._.js → node_modules_1_ly5yy._.js} +1 -1
  254. package/.next/server/chunks/ssr/{node_modules_0o_gq58._.js → node_modules_1_wsn9q._.js} +1 -1
  255. package/.next/server/chunks/ssr/{node_modules_1u7wlaq._.js → node_modules_1djak6n._.js} +2 -2
  256. package/.next/server/chunks/ssr/{node_modules_08cq8i-._.js → node_modules_1e-oxmh._.js} +1 -1
  257. package/.next/server/chunks/ssr/{node_modules_15x7int._.js → node_modules_1ed4zep._.js} +2 -2
  258. package/.next/server/chunks/ssr/{node_modules_1pkpq6d._.js → node_modules_1f2qlxm._.js} +2 -2
  259. package/.next/server/chunks/ssr/{node_modules_1aw7c9f._.js → node_modules_1fn72fs._.js} +2 -2
  260. package/.next/server/chunks/ssr/node_modules_1h9p77x._.js +7 -7
  261. package/.next/server/chunks/ssr/{node_modules_1ucf2fi._.js → node_modules_1hj0rvo._.js} +1 -1
  262. package/.next/server/chunks/ssr/{node_modules_12pvysk._.js → node_modules_1jvkoqj._.js} +1 -1
  263. package/.next/server/chunks/ssr/{node_modules_0tq4-57._.js → node_modules_1jzofr8._.js} +1 -1
  264. package/.next/server/chunks/ssr/{node_modules_08hfp3a._.js → node_modules_1maqy-g._.js} +1 -1
  265. package/.next/server/chunks/ssr/{node_modules_071fb26._.js → node_modules_1oox5h1._.js} +1 -1
  266. package/.next/server/chunks/ssr/{node_modules_0_jxnnn._.js → node_modules_1p56fwh._.js} +1 -1
  267. package/.next/server/chunks/ssr/{node_modules_01yukzc._.js → node_modules_1prbr1-._.js} +1 -1
  268. package/.next/server/chunks/ssr/{node_modules_1hrbceb._.js → node_modules_1qfou69._.js} +1 -1
  269. package/.next/server/chunks/ssr/{node_modules_11f1w-3._.js → node_modules_1qnosqe._.js} +2 -2
  270. package/.next/server/chunks/ssr/{node_modules_1kd_hpx._.js → node_modules_1rdpn6v._.js} +1 -1
  271. package/.next/server/chunks/ssr/{node_modules_079iwnx._.js → node_modules_1v6m9sp._.js} +1 -1
  272. package/.next/server/chunks/ssr/{node_modules_1iapzqf._.js → node_modules_1z8ywx9._.js} +1 -1
  273. package/.next/server/chunks/ssr/{node_modules_1dim95c._.js → node_modules_1zzudo-._.js} +1 -1
  274. package/.next/server/chunks/ssr/{node_modules_1_71wv3._.js → node_modules_2157u1j._.js} +2 -2
  275. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_1c5gb92._.js → node_modules_katex_dist_katex_mjs_12lynt6._.js} +1 -1
  276. package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_1ocxq2z._.js → node_modules_katex_dist_katex_mjs_1vjoadq._.js} +1 -1
  277. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_1v93o68._.js +1 -1
  278. package/.next/server/middleware-build-manifest.js +5 -5
  279. package/.next/server/pages/404.html +1 -1
  280. package/.next/server/pages/500.html +1 -1
  281. package/.next/server/server-reference-manifest.js +1 -1
  282. package/.next/server/server-reference-manifest.json +185 -185
  283. package/.next/static/chunks/051z85h3ofmif.js +1 -0
  284. package/.next/static/chunks/05722zc-sohb_.js +4 -0
  285. package/.next/static/chunks/07jo959manleh.js +1 -0
  286. package/.next/static/chunks/0_5a18_y41-_4.js +1 -0
  287. package/.next/static/chunks/0be7dgti95u_2.js +1 -0
  288. package/.next/static/chunks/0c28x0q2aqsbj.js +1 -0
  289. package/.next/static/chunks/0o_rabv5are-o.js +2 -0
  290. package/.next/static/chunks/{0776-hu4_eek7.js → 0wwq57j09skhy.js} +2 -2
  291. package/.next/static/chunks/0zm3urd75-zw5.js +1 -0
  292. package/.next/static/chunks/16hfi69t-6a4t.js +2 -0
  293. package/.next/static/chunks/1g58g8-daiwu5.js +3 -0
  294. package/.next/static/chunks/1i1u85j-_yb1n.js +15 -0
  295. package/.next/static/chunks/1kd2sxkkrae8e.js +1 -0
  296. package/.next/static/chunks/{3xloayc4c096r.js → 1n3a07w81jbc-.js} +1 -1
  297. package/.next/static/chunks/1nncyxatu7une.js +1 -0
  298. package/.next/static/chunks/1s5t41jiomssd.css +1 -0
  299. package/.next/static/chunks/1yl4mlpsw8e7h.js +1 -0
  300. package/.next/static/chunks/{33qtnlc00c9gq.js → 2gl-fo_rmmmq0.js} +1 -1
  301. package/.next/static/chunks/2h_sak2oi70qs.js +1 -0
  302. package/.next/static/chunks/2isg5redeg2bc.js +1 -0
  303. package/.next/static/chunks/{2fxn-xltgy2un.js → 2of2-kggzp-fk.js} +1 -1
  304. package/.next/static/chunks/2vmran3sacktz.js +1 -0
  305. package/.next/static/chunks/2w02v9g8o9-rz.js +1 -0
  306. package/.next/static/chunks/2wi2pcbjrqm86.js +1 -0
  307. package/.next/static/chunks/2xk8otp3gnzml.js +1 -0
  308. package/.next/static/chunks/2ym1hrikoit8p.js +1 -0
  309. package/.next/static/chunks/34d1f980dv5c6.js +18 -0
  310. package/.next/static/chunks/34zhr71217o1-.js +2 -0
  311. package/.next/static/chunks/{0o1r15rfncytn.js → 37r4l2878vybp.js} +1 -1
  312. package/.next/static/chunks/{2cz5734j90h5b.js → 3a-2z23puvz2z.js} +1 -1
  313. package/.next/static/chunks/3d55-y263hup9.js +1 -0
  314. package/.next/static/chunks/3dzrveotr82eu.js +39 -0
  315. package/.next/static/chunks/3fensfht8pxhl.js +55 -0
  316. package/.next/static/chunks/3k7fum0yljmyr.js +1 -0
  317. package/.next/static/chunks/3sawwm4vucnzn.js +1 -0
  318. package/.next/static/chunks/{0z0-g4k1hnpw2.js → 3u208m--8u1iq.js} +1 -1
  319. package/.next/static/chunks/{turbopack-1kym6rf88i5i0.js → turbopack-0ekrsq98buh0j.js} +1 -1
  320. package/README.md +18 -18
  321. package/bin/background.mjs +60 -32
  322. package/bin/print.mjs +82 -0
  323. package/bin/thursday.mjs +44 -13
  324. package/guide/bots.md +19 -3
  325. package/guide/calls.md +5 -2
  326. package/guide/memory.md +2 -1
  327. package/guide/setup.md +8 -6
  328. package/guide/trouble.md +4 -0
  329. package/package.json +11 -5
  330. package/public/voices/intro/awake-f4e02fad.ogg +0 -0
  331. package/seed-skills/concierge/travel/scripts/itinerary.mjs +2 -1
  332. package/server.js +1 -1
  333. package/skills/artifact/references/document.md +5 -2
  334. package/skills/artifact/runtime/document/markdown.mjs +14 -1
  335. package/skills/artifact/runtime/shell/head.html +1 -1
  336. package/skills/artifact/scripts/document.mjs +9 -3
  337. package/skills/browser/SKILL.md +17 -13
  338. package/.next/server/chunks/[root-of-the-server]__0ald4vb._.js +0 -3
  339. package/.next/server/chunks/[root-of-the-server]__0srfj96._.js +0 -3
  340. package/.next/server/chunks/ssr/[root-of-the-server]__1kos36s._.js +0 -6
  341. package/.next/server/chunks/ssr/_024j8bs._.js +0 -3
  342. package/.next/server/chunks/ssr/_04jb10a._.js +0 -3
  343. package/.next/server/chunks/ssr/_059oyhd._.js +0 -3
  344. package/.next/server/chunks/ssr/_0d0uyl3._.js +0 -3
  345. package/.next/server/chunks/ssr/_0fk7dbp._.js +0 -88
  346. package/.next/server/chunks/ssr/_0gfa_rb._.js +0 -3
  347. package/.next/server/chunks/ssr/_0i7zd74._.js +0 -3
  348. package/.next/server/chunks/ssr/_0sp2z94._.js +0 -3
  349. package/.next/server/chunks/ssr/_1avnw03._.js +0 -57
  350. package/.next/server/chunks/ssr/_1bfrntd._.js +0 -6
  351. package/.next/server/chunks/ssr/_1cpvfkg._.js +0 -3
  352. package/.next/server/chunks/ssr/_1cqjpyq._.js +0 -3
  353. package/.next/server/chunks/ssr/_1khngyc._.js +0 -72
  354. package/.next/server/chunks/ssr/_1kyjimg._.js +0 -162
  355. package/.next/server/chunks/ssr/_1sw4r4m._.js +0 -6
  356. package/.next/server/chunks/ssr/_20004tu._.js +0 -57
  357. package/.next/server/chunks/ssr/node_modules_01alue6._.js +0 -3
  358. package/.next/server/chunks/ssr/node_modules_02n9-pb._.js +0 -3
  359. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_0zxr5sz._.js +0 -3
  360. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_trash_mjs_0px2gzr._.js +0 -3
  361. package/.next/static/chunks/02d9vhnz5mwvu.js +0 -1
  362. package/.next/static/chunks/06ff4fq0z4das.js +0 -1
  363. package/.next/static/chunks/09q9n7jrkm4c9.js +0 -39
  364. package/.next/static/chunks/0b3wt5kqs-mk2.js +0 -2
  365. package/.next/static/chunks/0blrj_tg1yur0.js +0 -1
  366. package/.next/static/chunks/0dn1ptom1ahgg.js +0 -18
  367. package/.next/static/chunks/0dq7uppta9s--.js +0 -1
  368. package/.next/static/chunks/0hoz2b--nhn4y.js +0 -1
  369. package/.next/static/chunks/0kfjtkez2xze2.js +0 -1
  370. package/.next/static/chunks/0mv2zywfzt83k.js +0 -4
  371. package/.next/static/chunks/0txtrhykehsd_.js +0 -55
  372. package/.next/static/chunks/17vs1vz7_4l4p.css +0 -1
  373. package/.next/static/chunks/1dnvf_117h4k3.js +0 -2
  374. package/.next/static/chunks/1irynso77np9t.js +0 -1
  375. package/.next/static/chunks/1sh_-w_keseat.js +0 -1
  376. package/.next/static/chunks/1z2_9pl3nezly.js +0 -3
  377. package/.next/static/chunks/23ty4edkuxirx.js +0 -1
  378. package/.next/static/chunks/2f1cnfz4h1e2x.js +0 -1
  379. package/.next/static/chunks/2jepcbdewlwlg.js +0 -1
  380. package/.next/static/chunks/2r_zq_knm0hph.js +0 -15
  381. package/.next/static/chunks/2yfmmo4qr_f-m.js +0 -1
  382. package/.next/static/chunks/3-xnkknav7azp.js +0 -1
  383. package/.next/static/chunks/38q31td1ecuay.js +0 -1
  384. package/.next/static/chunks/3n75-7grldc6f.js +0 -1
  385. package/.next/static/chunks/3ofr4htw4wpj3.js +0 -1
  386. package/.next/static/chunks/40bkw3zfenss4.js +0 -2
  387. package/public/voices/intro/awake-17dbafbf.ogg +0 -0
  388. package/public/voices/intro/models-d09ddc74.ogg +0 -0
  389. /package/.next/static/{YIQV0_9FZPTFUe9TCiVSF → 3_9hbwcAuWTSWCJSufp3d}/_buildManifest.js +0 -0
  390. /package/.next/static/{YIQV0_9FZPTFUe9TCiVSF → 3_9hbwcAuWTSWCJSufp3d}/_clientMiddlewareManifest.js +0 -0
  391. /package/.next/static/{YIQV0_9FZPTFUe9TCiVSF → 3_9hbwcAuWTSWCJSufp3d}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,457343,e=>{"use strict";var t=e.i(843476),s=e.i(867927),n=e.i(632781),a=e.i(648119),i=e.i(929272),r=e.i(759659),o=e.i(263676),l=e.i(271645),d=e.i(798120),c=e.i(167881),u=e.i(630374),x=e.i(463415),m=e.i(917162),h=e.i(660302),p=e.i(671428),f=e.i(41533),g=e.i(234563),j=e.i(95187);let b=(0,j.createServerReference)("7f2560d4b1b1c84196804520b3ce0265c5e51a1037",j.callServer,void 0,j.findSourceMapURL,"clearFinishedThreadsAction"),k=(0,j.createServerReference)("7fd1ec1fba6c8a90fb823e19f9190ed8b87a503a22",j.callServer,void 0,j.findSourceMapURL,"deleteThreadAction");var N=e.i(451888),w=e.i(635963),v=e.i(835878),y=e.i(222055),S=e.i(351866),T=e.i(978411),M=e.i(431594),D=e.i(895836),C=e.i(245629),z=e.i(609856),R=e.i(661504),A=e.i(283653),I=e.i(647163),$=e.i(399512);let O="w-36";function F({thread:e,bots:a,open:i,onOpen:r,onStop:o,onDelete:d}){let c="running"===e.status,u=(0,l.useMemo)(()=>(0,T.threadFromRow)(e,a),[e,a]),x=function(e){let t=e.room.questions[0];if(t)return{text:(0,I.plainText)(t.text),tone:I.WAITING_INK};if("waiting"===e.status&&e.ask)return{text:(0,N.isAppStop)(e.ask)?(0,I.plainText)(e.outcome??e.ask.question):e.ask.question,tone:I.WAITING_INK};let s=e.seen;if("cancelled"===e.status)return{text:"Stopped",tone:"text-muted-foreground"};if("done"===e.status)return{text:(0,I.plainText)(e.outcome??"Done"),tone:s?"text-muted-foreground":"text-foreground/80"};for(let t=e.lines.length-1;t>=0;t--){let s=e.lines[t];if("tool"===s.kind)return{text:s.note??s.input,tone:"text-muted-foreground",tool:s.name,shine:!0};if("text"===s.kind)return{text:s.text,tone:"text-muted-foreground",shine:!0};if("user"===s.kind)break}return{text:`${e.bot} is taking it on…`,tone:"text-muted-foreground italic",shine:!0}}(e),m=e.tokens.input+e.tokens.output;return(0,t.jsxs)("div",{className:(0,I.cn)("group/row relative transition-colors",i?"bg-muted/80":"hover:bg-muted/50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,t.jsxs)("button",{type:"button",onClick:r,className:"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",children:[(0,t.jsx)(w.BotMark,{size:40,seed:e.bot,...(0,w.markOf)(e.bot,a),state:c?"thinking":"idle",notify:(0,N.needsThreadReply)(e)||(0,N.isUnread)(e),crossed:"cancelled"===e.status,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}),e.routineId&&(0,t.jsx)("span",{title:"Started by a routine",className:"shrink-0",children:(0,t.jsx)(M.RoutineMark,{className:"size-3 text-muted-foreground/80"})}),(0,t.jsx)(v.BotRoster,{bots:u.roster}),c&&(0,t.jsx)(n.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"})]}),x&&(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] leading-snug",children:[x.tool&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:x.tool}),x.shine?(0,t.jsx)(h.ShinyText,{text:x.text,speed:2.2,className:"min-w-0 truncate"}):(0,t.jsx)("span",{className:(0,I.cn)("min-w-0 truncate",x.tone),children:x.text})]})]}),(0,t.jsxs)("span",{className:(0,I.cn)("flex shrink-0 flex-col items-end gap-0.5 font-mono text-[11px] leading-4 text-muted-foreground tabular-nums",O),children:[(0,t.jsx)("span",{children:(0,C.whenOf)(e.updatedAt)}),(0,t.jsxs)("span",{className:"max-w-full truncate text-muted-foreground",title:m>0?`${e.id} \xb7 in ${(0,I.formatCount)(e.tokens.input)} \xb7 out ${(0,I.formatCount)(e.tokens.output)}`:e.id,children:[e.bot,m>0&&` \xb7 ${(0,I.formatCount)(m)}`]})]}),(0,t.jsx)(s.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,t.jsx)(q,{thread:e,onStop:o,onDelete:d})]}),c&&(0,t.jsx)(B,{thread:e})]})}function q({thread:e,onStop:s,onDelete:n,className:o}){let l="running"===e.status||"waiting"===e.status;return(0,t.jsxs)(x.DropdownMenu,{children:[(0,t.jsx)(x.DropdownMenuTrigger,{render:(0,t.jsx)(c.Button,{size:"icon-sm",variant:"ghost","aria-label":"More",className:o}),children:(0,t.jsx)(a.MoreHorizontal,{})}),(0,t.jsxs)(x.DropdownMenuContent,{align:"end",children:[l&&(0,t.jsxs)(x.DropdownMenuItem,{onClick:s,children:[(0,t.jsx)(i.Square,{}),"Stop"]}),(0,t.jsxs)(x.DropdownMenuItem,{variant:"destructive",onClick:n,children:[(0,t.jsx)(r.Trash2,{}),"Delete"]})]})]})}function K({thread:e,whole:s,bots:n,onClose:a,onStop:i,onDelete:r}){let[d,x]=(0,l.useState)(null),m=(0,l.useCallback)(e=>{x(e?.closest("[data-slot=dialog-content]")??null)},[]),[h,f]=(0,l.useState)({}),g=(0,l.useMemo)(()=>e?(0,T.threadFromRow)(e,n):null,[e,n]),j=(0,l.useMemo)(()=>s?(0,T.threadFromRow)(s,n):g?.lines.length?g:null,[s,g,n]),b=e?h[e.id]??null:null;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{ref:m,hidden:!0}),(0,t.jsx)(u.Dialog,{open:!!(e&&d),onOpenChange:e=>!e&&a(),modal:!1,disablePointerDismissal:!0,children:(0,t.jsx)(u.DialogPortal,{container:d,children:(0,t.jsx)(u.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&&g&&(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:[(0,t.jsx)(w.BotMark,{size:28,seed:e.bot,...(0,w.markOf)(e.bot,n),state:"running"===e.status?"thinking":"idle",notify:(0,N.needsThreadReply)(e),crossed:"cancelled"===e.status,className:"shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(u.DialogTitle,{className:"sr-only",children:e.label}),(0,t.jsx)("p",{className:"truncate text-[15px] leading-5 font-semibold",children:e.label}),(0,t.jsxs)("div",{className:"mt-0.5 flex min-w-0 items-center gap-2 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsxs)("span",{title:e.id,className:"min-w-0 truncate",children:[e.bot," · ",(0,C.whenOf)(e.updatedAt)]}),(0,t.jsx)(S.ThreadFacts,{thread:g})]})]}),(0,t.jsx)(q,{thread:e,onStop:()=>i(e),onDelete:()=>r(e),className:"text-muted-foreground"}),(0,t.jsx)(u.DialogClose,{render:(0,t.jsx)(c.Button,{size:"icon-sm",variant:"ghost","aria-label":"Close the thread"}),children:(0,t.jsx)(o.X,{})})]}),j?(0,t.jsx)(S.Conversation,{thread:j,tab:b,onTab:t=>f(s=>({...s,[e.id]:t})),className:"max-h-none min-h-0 flex-1 px-5",tabsClassName:"px-5"}):(0,t.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-2 px-5 py-4",children:[(0,t.jsx)(p.Skeleton,{className:"h-3 w-4/5"}),(0,t.jsx)(p.Skeleton,{className:"h-3 w-3/5"}),(0,t.jsx)(p.Skeleton,{className:"h-3 w-2/3"})]}),(0,t.jsx)("div",{className:"shrink-0 px-5 pt-2 pb-4",children:(0,t.jsx)($.ThreadReply,{thread:{id:e.id,label:e.label,bot:e.bot,ask:e.ask,room:e.room},status:e.status,faces:g.roster,to:b??e.bot,claimsDrops:!1})})]})})})})]})}function B({thread:e}){let s=[];if(e.lines.forEach((t,n)=>{if("tool"!==t.kind)return;let a=e.lines[n+1];s.push({step:t,took:a?(0,C.toDate)(a.at).getTime()-(0,C.toDate)(t.at).getTime():null})}),0===s.length)return null;let a=(0,C.toDate)(e.updatedAt).getTime()-(0,C.toDate)(e.createdAt).getTime();return(0,t.jsxs)("div",{className:"pointer-events-none absolute top-[calc(100%-0.75rem)] left-17 z-20 hidden w-96 max-w-[calc(100%-5rem)] rounded-xl bg-background p-3 pb-2 shadow-xl shadow-black/10 ring-1 ring-border/60 group-hover/row:block",children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)("span",{children:e.bot}),(0,t.jsx)("span",{className:"opacity-50",children:"·"}),(0,t.jsxs)("span",{children:[s.length," ",1===s.length?"step":"steps"]}),(0,t.jsx)("span",{className:"opacity-50",children:"·"}),(0,t.jsx)("span",{children:E(a)})]}),s.slice(-6).map(({step:e,took:s})=>{let a=(0,y.toolIcon)(e.name);return(0,t.jsxs)("div",{className:"flex h-5.5 items-center gap-2 font-mono text-[11px]",children:[null===s?(0,t.jsx)(n.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}):(0,t.jsx)(a,{className:"size-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",children:e.name}),null===s?(0,t.jsx)(h.ShinyText,{text:e.note??e.input,speed:2.2,className:"min-w-0 flex-1 truncate"}):(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-foreground",children:e.note??e.input}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right text-muted-foreground tabular-nums",children:null===s?"":E(s)})]},e.id)})]})}function E(e){let t=Math.max(0,e)/1e3;if(t<10)return`${t.toFixed(1)}s`;if(t<60)return`${Math.round(t)}s`;let s=Math.floor(t/60);return`${s}m ${Math.round(t-60*s)}s`}function P(){return(0,t.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,t.jsx)(p.Skeleton,{className:"size-10 shrink-0 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-2",children:[(0,t.jsx)(p.Skeleton,{className:"h-3 w-40 max-w-full"}),(0,t.jsx)(p.Skeleton,{className:"h-2.5 w-80 max-w-full"})]}),(0,t.jsxs)("span",{className:(0,I.cn)("flex shrink-0 flex-col items-end gap-1.5",O),children:[(0,t.jsx)(p.Skeleton,{className:"h-2.5 w-12"}),(0,t.jsx)(p.Skeleton,{className:"h-2.5 w-24"})]}),(0,t.jsx)("span",{className:"size-4 shrink-0"}),(0,t.jsx)("span",{className:"size-7 shrink-0"})]})}e.s(["ThreadSetting",0,function(){let[e,s]=(0,l.useState)(null),[n,a]=(0,l.useState)(""),i=n.trim(),[r,o]=(0,l.useState)("");(0,l.useEffect)(()=>{let e=setTimeout(()=>o(i),f.SEARCH_WAIT_MS);return()=>clearTimeout(e)},[i]);let{data:u}=(0,A.useServerRoute)(d.queryKey.bot),{items:x,isLoading:h,isLoadingMore:p,error:j,hasMore:w,sentinelRef:v}=(0,R.useServerPages)({key:(e,t)=>{if(0===e)return d.queryKey.threadHistory(null,r);let s=t?.at(-1);return s?d.queryKey.threadHistory((0,C.toDate)(s.updatedAt).toISOString(),r):null},size:f.PAGE_SIZE}),y=x.find(t=>t.id===e),{data:S}=(0,A.useServerRoute)(e?d.queryKey.thread(e):null),M=S?.id===e?S:void 0;(0,T.useSeenOnDetail)(y);let[I]=(0,z.useServerAction)(g.cancelThreadAction,{onOk:e=>{(0,A.revalidate)(d.queryKey.threads),T.screenActs.announce({kind:"stopped",id:e.id,label:e.label})}}),[$]=(0,z.useServerAction)(k,{onOk:()=>(0,A.revalidate)(d.queryKey.threads)}),[O]=(0,z.useServerAction)(b,{onOk:()=>(0,A.revalidate)(d.queryKey.threads)}),q=async()=>{await m.notify.confirm({title:"Clear finished jobs?",description:"Everything done or stopped goes, messages included. Running and waiting jobs stay.",okText:"Clear",destructive:!0})&&O()},B=async t=>{if(!await m.notify.confirm({title:`Delete "${t.label}"?`,description:"Its messages go with it — nothing can be picked back up.",okText:"Delete",destructive:!0}))return;let n=x.findIndex(e=>e.id===t.id),a=x[n+1]??x[n-1];try{await $(t.id)}catch{return}t.id===e&&s(a?.id??null)};if(h)return(0,t.jsx)(D.SettingSkeleton,{rows:3});if(j)return(0,t.jsx)(D.SettingError,{message:j.message});let E=x.filter(e=>"waiting"===e.status).length,H=x.filter(N.isUnread).length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(D.SettingScreen,{footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(D.SettingRailNote,{children:[x.length," shown",E>0&&` \xb7 ${E} waiting on you`,H>0&&` \xb7 ${H} new result${1===H?"":"s"}`]}),(w||x.some(e=>"done"===e.status||"cancelled"===e.status))&&(0,t.jsx)(c.Button,{variant:"outline",size:"sm",onClick:q,children:"Clear finished"})]}),children:(0,t.jsx)(D.SettingGroup,{filter:(0,t.jsx)(D.SettingFilter,{value:n,onChange:a,placeholder:"Filter by label, bot or word"}),right:r?`${x.length}${w?"+":""} found`:void 0,children:(0,t.jsxs)(D.SettingItems,{children:[0===x.length?(0,t.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:r?"No job matches that.":"Nothing yet. When Thursday hands a job to a bot mid-call, it shows up here — while it runs, and after."}):x.map(e=>(0,t.jsx)(F,{thread:e,bots:u,open:e.id===y?.id,onOpen:()=>s(e.id),onStop:()=>I(e.id),onDelete:()=>B(e)},e.id)),(0,t.jsx)(D.SettingMore,{hasMore:w,loading:p,sentinelRef:v,ghost:(0,t.jsx)(P,{}),className:"divide-y divide-border/60"})]})})}),(0,t.jsx)(K,{thread:y,whole:M,bots:u,onClose:()=>s(null),onStop:e=>I(e.id),onDelete:B})]})}],457343)},648119,e=>{"use strict";var t=e.i(456420);let s={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};s.node;let n=(0,t.default)(s);e.s(["MoreHorizontal",0,n],648119)},759659,e=>{"use strict";var t=e.i(456420);let s={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};s.node;let n=(0,t.default)(s);e.s(["Trash2",0,n],759659)}]);
@@ -0,0 +1,2 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),a=e.i(225913);e.i(271645);var r=e.i(647163);function s({className:e,...a}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,r.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...a})}e.i(652225);let i=(0,a.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:a="vertical",...s}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":a,className:(0,r.cn)(i({orientation:a}),e),...s})},"FieldContent",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,r.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...a})},"FieldLabel",0,function({className:e,...a}){return(0,t.jsx)(s,{"data-slot":"field-label",className:(0,r.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...a})}],986530)},556133,e=>{"use strict";var t=e.i(843476),a=e.i(401851),r=e.i(689664),s=e.i(867927),i=e.i(456420);let n={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};n.node;let l=(0,i.default)(n);var o=e.i(77071),d=e.i(759659),c=e.i(263676),u=e.i(271645),m=e.i(798120),h=e.i(167881),f=e.i(986530),x=e.i(23750),p=e.i(917162),g=e.i(671428),v=e.i(127341),b=e.i(184762),j=e.i(41533),y=e.i(968978),k=e.i(265402),N=e.i(670097),S=e.i(640262),w=e.i(96892);let C={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};C.node;let M=(0,i.default)(C);var T=e.i(716327),F=e.i(632781),A=e.i(935829),R=e.i(660302),z=e.i(146538),L=e.i(213377),O=e.i(647163);let E=new S.DefaultChatTransport({api:m.queryKey.memoryEdit});function I({notes:e}){let[a,r]=(0,u.useState)(""),[s,i]=(0,u.useState)({provider:null,model:""}),[n,l]=(0,u.useState)(!1),{messages:o,sendMessage:d,setMessages:c,status:m,stop:f,error:x,clearError:p}=(0,N.useChat)({transport:E}),g=(0,u.useRef)(f);g.current=f,(0,u.useEffect)(()=>()=>{g.current()},[]);let v=(0,u.useRef)(new Map);for(let t of e)for(let e of t.facts)v.current.set(e.id,{text:e.text,path:t.path});let b="submitted"===m||"streaming"===m,j=!!(s.provider&&s.model.trim()),k=[...o].reverse().find(e=>"assistant"===e.role),C=k?.parts??[],M=C.filter(S.isToolUIPart),F=C.flatMap(e=>"text"===e.type?[e.text]:[]).join(" ").trim(),A=!!x||M.some(e=>"output-error"===e.state),$=M.filter(e=>"output-available"===e.state&&(0,S.getToolName)(e)!==L.TOOL_NAMES.memory_recall).length;(0,u.useEffect)(()=>{if("ready"!==m||A||0===o.length)return;let e=setTimeout(()=>c([]),4e3);return()=>clearTimeout(e)},[m,A,o.length,c]);let B=(0,u.useRef)("");(0,u.useEffect)(()=>{if(!x||!B.current)return;let e=B.current;B.current="",r(t=>t||e)},[x]);let D=b?(0,t.jsx)(R.ShinyText,{text:"Working on memory",className:"text-xs"}):x?(0,t.jsx)("span",{className:"text-xs text-destructive",children:x.message}):k?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:F||(0===$?"Nothing to change":1===$?"1 change saved":`${$} changes saved`)}):!a.trim()||j||n?null:(0,t.jsx)("button",{type:"button",onClick:()=>l(!0),className:"rounded-sm text-xs text-muted-foreground underline-offset-3 outline-none hover:text-foreground hover:underline focus-visible:ring-3 focus-visible:ring-ring/50",children:"Pick a model to edit with"});return(0,t.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-18 z-10 flex justify-center px-8",children:(0,t.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-120 flex-col items-center gap-2",children:[n&&(0,t.jsx)("div",{className:"w-full rounded-xl bg-popover p-2 shadow-lg ring-1 ring-foreground/10",children:(0,t.jsx)(z.ModelPicker,{provider:s.provider,model:s.model,unset:"Provider",onChange:i})}),M.length>0&&(0,t.jsx)("ul",{className:"w-full divide-y divide-border/60 overflow-hidden rounded-xl bg-popover shadow-lg ring-1 ring-foreground/10",children:M.map(e=>(0,t.jsx)(P,{name:(0,S.getToolName)(e),input:e.input,state:e.state,errorText:"output-error"===e.state?e.errorText:void 0,known:v.current},e.toolCallId))}),D&&(0,t.jsx)("p",{className:"max-w-full truncate px-1",children:D}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=a.trim();if(t&&!b){if(!j)return void l(!0);B.current=t,r(""),l(!1),p(),c([]),d({text:t},{body:{model:s}})}},className:"flex h-10 w-full items-center gap-1.5 rounded-xl bg-popover pr-1.5 pl-3.5 shadow-lg ring-1 ring-foreground/10",children:[(0,t.jsx)("input",{autoFocus:!0,value:a,onChange:e=>r(e.target.value),disabled:b,"aria-label":"Edit memory",placeholder:"Tell memory what changed",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"}),(0,t.jsxs)(h.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>l(!n),className:(0,O.cn)("max-w-44",!j&&"text-muted-foreground"),children:[j&&s.provider?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.ProviderIcon,{provider:s.provider,className:"size-3"}),(0,t.jsx)("span",{className:"truncate",children:s.model})]}):"Model",(0,t.jsx)(T.ChevronDown,{className:"text-muted-foreground"})]}),(0,t.jsx)(h.Button,{type:"submit",size:"icon-sm",loading:b,disabled:!a.trim()||b,"aria-label":"Send",children:!b&&(0,t.jsx)(w.ArrowUp,{})})]})]})})}let $={Remember:o.Plus,Replace:l,Forget:A.Minus,Rename:l,Opened:M};function P({name:e,input:a,state:s,errorText:i,known:n}){let l=function(e,t,a){if(e===L.TOOL_NAMES.memory_recall)return{kind:"Opened",path:(t??{}).path??"",lines:[]};if(e===L.TOOL_NAMES.memory_describe){let e=t??{};return{kind:"Rename",path:e.path??"",lines:e.description?[{after:`“${e.description}”`}]:[]}}if(e===L.TOOL_NAMES.memory_forget){let e=((t??{}).factIds??[]).filter(e=>null!=e),r=e.map(e=>a.get(e));return{kind:"Forget",path:r.find(e=>e)?.path??"",lines:e.map((e,t)=>({before:r[t]?.text??`Fact #${e}`}))}}let r=t??{},s=r.path??"",i=(r.facts??[]).filter(e=>null!=e),n=i.map(e=>null!=e.replaces?{before:a.get(e.replaces)?.text??`Fact #${e.replaces}`,after:e.text}:{after:e.text});return e===L.TOOL_NAMES.memory_create&&r.description&&n.unshift({after:`“${r.description}”`}),{kind:i.some(e=>null!=e.replaces)?"Replace":"Remember",path:s,lines:n}}(e,a,n),o=$[l.kind],d="output-error"===s;return(0,t.jsxs)("li",{className:"flex animate-in items-start gap-2.5 px-3 py-2.5 duration-200 fade-in slide-in-from-bottom-1",children:[(0,t.jsx)(o,{className:"mt-1 size-3.5 shrink-0 text-muted-foreground"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[l.lines.map((e,a)=>(0,t.jsxs)("div",{children:[e.before&&(0,t.jsx)("p",{className:"text-[13px] leading-5 text-muted-foreground/60 line-through",children:e.before}),e.after&&(0,t.jsx)("p",{className:"text-sm leading-5 text-foreground/90",children:e.after})]},`${l.kind}-${a}`)),(0,t.jsxs)("p",{className:"pt-0.5 font-mono text-[11px] text-muted-foreground",children:[l.kind,l.path&&` \xb7 ${l.path}`]}),d&&i&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:i})]}),(0,t.jsx)("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:d?(0,t.jsx)(c.X,{className:"size-3.5 text-destructive"}):"output-available"===s?(0,t.jsx)(r.Check,{className:"size-3.5"}):(0,t.jsx)(F.Loader2,{className:"size-3.5 animate-spin"})})]})}var B=e.i(95187);let D=(0,B.createServerReference)("7f778d1e1d9d5fe4a0bfefcb5829024f1c37eb17c3",B.callServer,void 0,B.findSourceMapURL,"addFactsAction"),_=(0,B.createServerReference)("7ffa8a2dd6092d5634c0afd449a8770a0a4ac295be",B.callServer,void 0,B.findSourceMapURL,"createNoteAction"),K=(0,B.createServerReference)("7f1181e8e9af091ebbec97b17c74f875db2a474cde",B.callServer,void 0,B.findSourceMapURL,"deleteNoteAction"),U=(0,B.createServerReference)("7fa441589d5fbf4cd06bbeda5a3228383ad486fc1c",B.callServer,void 0,B.findSourceMapURL,"forgetFactAction"),q=(0,B.createServerReference)("7ff7001819dbde7db5a64168bf3f11708e3f8af5f5",B.callServer,void 0,B.findSourceMapURL,"reviseFactAction"),V=(0,B.createServerReference)("7fb69a0b4423357fde7f88352da64ce6aed542ea08",B.callServer,void 0,B.findSourceMapURL,"updateNoteAction");var Y=e.i(362201),H=e.i(245629);let W=Y.enum(["user","call","bot"]);Y.string().trim().min(1,"A note needs a line saying what it is about").max(j.MEMORY_LIMITS.descriptionChars,`A note's line is one line: at most ${j.MEMORY_LIMITS.descriptionChars} characters`);let X=Y.object({id:Y.number(),text:Y.string(),source:W.nullish(),createdAt:H.DateLikeSchema});Y.object({id:Y.number(),path:Y.string(),description:Y.string(),ownedByUser:Y.boolean(),hits:Y.number(),lastReadAt:H.DateLikeSchema.nullable(),createdAt:H.DateLikeSchema,updatedAt:H.DateLikeSchema,factCount:Y.number(),facts:X.array()});let G=[{path:"profile",of:"The user themselves — name, age, what they do, where they live, whatever else says who they are"},{path:"preferences",of:"How they want things done, and said — read whole on every call, so a rule for a particular situation goes here too"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],Z=G.filter(e=>!e.path.endsWith("/")).map(e=>e.path),J=G.filter(e=>e.path.endsWith("/")).map(e=>e.path.slice(0,-1));RegExp(`^(?:${Z.join("|")}|(?:${J.join("|")})/.+)$`);var Q=e.i(895836),ee=e.i(319841),et=e.i(609856),ea=e.i(661504),er=e.i(283653);let es=[{key:"you",label:"You"},{key:"people",label:"People"},{key:"projects",label:"Projects"},{key:"topics",label:"Topics"},{key:"other",label:"Other"}],ei={onOk:()=>(0,er.revalidate)(m.queryKey.memory)},en=k.textModelProviderSchema.options.filter(e=>"chatgpt"!==e).slice(0,3);function el(){return(0,t.jsx)("span",{className:"mr-0.5 flex items-center",children:en.map(e=>(0,t.jsx)("span",{className:"-ml-1.5 grid size-5 place-items-center rounded-full bg-background ring-1 ring-border first:ml-0",children:(0,t.jsx)(y.ProviderIcon,{provider:e,className:"size-3"})},e))})}function eo(e,t){return a=>{(0,ee.composing)(a)||("Enter"===a.key&&(a.preventDefault(),e()),"Escape"===a.key&&(a.stopPropagation(),t()))}}function ed({note:e,open:a,onToggle:r}){var i;let n,o,c,m,f,[x,g]=(0,u.useState)(!1),[v,b]=(0,et.useServerAction)(K,ei),j=async()=>{await p.notify.confirm({title:`Forget ${e.path}?`,description:"Every fact in this note is deleted for good.",okText:"Delete",destructive:!0})&&v(e.id)},y=(0,t.jsx)("span",{className:"w-36 shrink-0 truncate text-sm font-medium",children:-1===(n=(i=e.path).indexOf("/"))?i:i.slice(n+1)});return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex h-12 items-center gap-3 pr-2 pl-4",children:x?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.ChevronRight,{className:"size-3.5 shrink-0 rotate-90 text-muted-foreground"}),y,(0,t.jsx)(ec,{note:e,onDone:()=>g(!1)})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button","aria-expanded":a,onClick:r,className:(0,O.cn)("flex h-full min-w-0 flex-1 items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",(o=e.path,!Z.includes(o)&&.15>(c=(0,H.toDate)(e.lastReadAt??e.createdAt),m=Math.max(0,(Date.now()-c.getTime())/864e5),(e.hits+1)/(1+m))&&!a&&"opacity-55")),children:[(0,t.jsx)(s.ChevronRight,{className:(0,O.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",a&&"rotate-90")}),y,(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:e.description}),(0,t.jsxs)("span",{className:"w-16 shrink-0 text-right font-mono text-[11px] text-muted-foreground",children:[e.factCount," ",1===e.factCount?"fact":"facts"]}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground",title:e.lastReadAt?"Last read back":"Never read back",children:e.lastReadAt?(0,H.shortAgo)(e.lastReadAt):"—"})]}),(0,t.jsx)("span",{className:"flex w-15 shrink-0 justify-end",children:a&&(0,t.jsxs)(t.Fragment,{children:[(f=e.path,!Z.includes(f)&&(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit the note's line",onClick:()=>g(!0),children:(0,t.jsx)(l,{})})),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this note",loading:b,onClick:j,children:!b&&(0,t.jsx)(d.Trash2,{})})]})})]})}),a&&(0,t.jsxs)("div",{className:"space-y-1 border-t border-border/60 bg-muted/40 py-2.5 pr-2 pl-10",children:[(0,t.jsx)(eu,{noteId:e.id}),e.facts.map(a=>(0,t.jsx)(em,{noteId:e.id,fact:a},a.id))]})]})}function ec({note:e,onDone:a}){let[s,i]=(0,u.useState)(e.description),[n,l]=(0,et.useServerAction)(V,{onOk:()=>{a(),(0,er.revalidate)(m.queryKey.memory)}}),o=()=>{let t=s.trim();if(!t||t===e.description)return a();n(e.id,{description:t})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Input,{autoFocus:!0,value:s,onChange:e=>i(e.target.value),onKeyDown:eo(o,a),"aria-label":"The note's line",placeholder:"One line Thursday sees in her list",maxLength:j.MEMORY_LIMITS.descriptionChars,className:"h-8 min-w-0 flex-1 text-[13px]"}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:l,onClick:o,children:!l&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:a,children:(0,t.jsx)(c.X,{})})]})}function eu({noteId:e}){let[a,r]=(0,u.useState)(""),[s,i]=(0,et.useServerAction)(D,{onOk:()=>{r(""),(0,er.revalidate)(m.queryKey.memory)}}),n=()=>{let t=a.trim();t&&!i&&s(e,[t])};return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 pb-1",children:[(0,t.jsx)(x.Input,{value:a,onChange:e=>r(e.target.value),onKeyDown:eo(n,()=>r("")),"aria-label":"Add a fact",placeholder:"Add a fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsxs)(h.Button,{size:"sm",variant:"outline",loading:i,disabled:!a.trim(),onClick:n,children:[!i&&(0,t.jsx)(o.Plus,{}),"Add"]})]})}function em({noteId:e,fact:s}){let i,[n,o]=(0,u.useState)(!1),[f,g]=(0,u.useState)(s.text),[v,b]=(0,et.useServerAction)(q,{onOk:()=>{o(!1),(0,er.revalidate)(m.queryKey.memory)}}),[j,y]=(0,et.useServerAction)(U,ei),k=async()=>{await p.notify.confirm({title:"Forget this fact?",description:`"${s.text}" is deleted for good.`,okText:"Delete",destructive:!0})&&j(e,s.id)},N=()=>{let t=f.trim();if(!t||t===s.text)return o(!1);v(e,s.id,t)},S="user"===(i=s.source)?"you":"call"===i?"on a call":"bot"===i?"a bot":"";return(0,t.jsx)("div",{className:"flex min-h-10 items-center gap-1.5",children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Input,{autoFocus:!0,value:f,onChange:e=>g(e.target.value),onKeyDown:eo(N,()=>o(!1)),"aria-label":"Fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:b,onClick:N,children:!b&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>o(!1),children:(0,t.jsx)(c.X,{})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 pl-1 text-sm leading-relaxed text-foreground/90",children:s.text}),(0,t.jsxs)("span",{className:"shrink-0 pr-1 font-mono text-[11px] text-muted-foreground",children:[(0,a.format)(s.createdAt,"yyyy.MM.dd"),S&&` \xb7 ${S}`]}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit this fact",onClick:()=>{g(s.text),o(!0)},children:(0,t.jsx)(l,{})}),(0,t.jsx)(h.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this fact",loading:y,onClick:()=>void k(),children:!y&&(0,t.jsx)(d.Trash2,{})})]})})}let eh=[{key:"people",label:"Person",placeholder:"alex",fact:"Moved to the platform team in March"},{key:"projects",label:"Project",placeholder:"thursday",fact:"Ships behind a feature flag until April"},{key:"topics",label:"Topic",placeholder:"scheduling",fact:"No meetings before 10am"}];function ef(){return p.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(ex,{onDone:e})})}function ex({onDone:e}){let[a,r]=(0,u.useState)("people"),[s,i]=(0,u.useState)(""),[n,l]=(0,u.useState)(""),[d,c]=(0,u.useState)(""),[p,g,,y]=(0,et.useServerAction)(_,{errorMessage:!1,onOk:()=>{(0,er.revalidate)(m.queryKey.memory),e()}}),k=eh.find(e=>e.key===a),N=s.trim()&&n.trim()&&!g,S=()=>{N&&p(`${a}/${s.trim()}`,n.trim(),d.split("\n").map(e=>e.trim()).filter(Boolean))};return(0,t.jsxs)(Q.SettingDialogContent,{title:"New note",description:"Where Thursday keeps what she learns about this.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(h.Button,{disabled:!N,loading:g,onClick:S,children:[!g&&(0,t.jsx)(o.Plus,{}),"Create"]})]}),children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{children:"Kind"}),(0,t.jsx)(v.Tabs,{value:a,onValueChange:e=>r(e),children:(0,t.jsx)(v.TabsList,{className:"w-full",children:eh.map(e=>(0,t.jsx)(v.TabsTrigger,{value:e.key,children:e.label},e.key))})})]}),(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{htmlFor:"note-name",children:"Name"}),(0,t.jsxs)(f.FieldContent,{children:[(0,t.jsx)(x.Input,{id:"note-name",value:s,onChange:e=>i(e.target.value),placeholder:k?.placeholder,spellCheck:!1,required:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[a,"/",s.trim()||"…"]})]})]}),(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{htmlFor:"note-summary",children:"Summary"}),(0,t.jsx)(f.FieldContent,{children:(0,t.jsx)(x.Input,{id:"note-summary",value:n,onChange:e=>l(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||229===e.keyCode||"Enter"===e.key&&S()},placeholder:"One line Thursday sees in her list",maxLength:j.MEMORY_LIMITS.descriptionChars,required:!0})})]}),(0,t.jsxs)(f.Field,{children:[(0,t.jsx)(f.FieldLabel,{htmlFor:"note-facts",children:"Facts"}),(0,t.jsx)(b.Textarea,{id:"note-facts",value:d,onChange:e=>c(e.target.value),placeholder:`One per line
2
+ ${k?.fact??""}`,className:"min-h-24 resize-none text-sm"})]})]}),y&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:y})]})}e.s(["MemorySetting",0,function(){let{items:e,isLoading:a,isLoadingMore:r,error:s,hasMore:i,sentinelRef:n}=(0,ea.useServerPages)({key:e=>m.queryKey.memoryPage(e*j.PAGE_SIZE)}),[l,d]=(0,u.useState)(""),[c,f]=(0,u.useState)(new Set),[x,p]=(0,u.useState)(!1);if(a)return(0,t.jsx)(Q.SettingSkeleton,{});if(s)return(0,t.jsx)(Q.SettingError,{message:s.message});let v=l.trim().toLowerCase(),b=v?e.filter(e=>[e.path,e.description,...e.facts.map(e=>e.text)].some(e=>e.toLowerCase().includes(v))):e,y=e.reduce((e,t)=>e+t.factCount,0),k=i?"+":"";return(0,t.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,t.jsxs)(Q.SettingScreen,{footer:(0,t.jsxs)(h.Button,{size:"sm",variant:x?"secondary":"ghost","aria-pressed":x,onClick:()=>p(!x),children:[(0,t.jsx)(el,{}),"Edit with a model"]}),children:[(0,t.jsx)(Q.SettingToolbar,{count:(0,t.jsxs)("span",{className:"flex items-center gap-3",children:[`${e.length}${k} notes \xb7 ${y}${k} facts`,(0,t.jsxs)(h.Button,{size:"sm",variant:"outline",className:"font-sans",onClick:ef,children:[(0,t.jsx)(o.Plus,{}),"New note"]})]}),children:(0,t.jsx)(Q.SettingFilter,{value:l,onChange:d,placeholder:"Filter memory"})}),v&&0===b.length&&(0,t.jsx)("p",{className:"px-1 text-xs text-muted-foreground",children:"Nothing matches"}),es.map(({key:e,label:a})=>{let r=b.filter(t=>(function(e){if(Z.includes(e))return"you";let t=e.slice(0,e.indexOf("/"));return J.includes(t)?t:"other"})(t.path)===e);return 0===r.length?null:(0,t.jsx)(Q.SettingGroup,{label:a,children:(0,t.jsx)(Q.SettingItems,{children:r.map(e=>(0,t.jsx)(ed,{note:e,open:c.has(e.id)!==!!v,onToggle:()=>{let t;return t=e.id,f(e=>{let a=new Set(e);return a.delete(t)||a.add(t),a})}},e.id))})},e)}),(0,t.jsx)(Q.SettingMore,{hasMore:i,loading:r,sentinelRef:n,ghost:(0,t.jsxs)("div",{className:"flex h-12 items-center gap-3 px-4",children:[(0,t.jsx)(g.Skeleton,{className:"h-3 w-24"}),(0,t.jsx)(g.Skeleton,{className:"h-3 w-56"})]})})]}),x&&(0,t.jsx)(I,{notes:e})]})}],556133)},935829,e=>{"use strict";var t=e.i(456420);let a={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};a.node;let r=(0,t.default)(a);e.s(["Minus",0,r],935829)},759659,e=>{"use strict";var t=e.i(456420);let a={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};a.node;let r=(0,t.default)(a);e.s(["Trash2",0,r],759659)}]);
@@ -0,0 +1,3 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,532965,e=>{"use strict";var t=e.i(843476),n=e.i(271645),a=e.i(456420);let r={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]};r.node;let s=(0,a.default)(r);var o=e.i(935829),i=e.i(77071),l=e.i(798120),c=e.i(683408),d=e.i(660302),u=e.i(635963),f=e.i(454263),p=e.i(213377),h=e.i(616172),x=e.i(245629),m=e.i(553429),y=e.i(978411);let g=e=>e.waitsFor.length>0&&"cancelled"!==e.state,b=e=>"waiting"===e.state&&e.waitsFor.length>0;function k(e){let t=(0,x.toDate)(e.createdAt).getTime(),n=e=>e.at?Math.max(0,((0,x.toDate)(e.at).getTime()-t)/1e3):0,a=e.bot.name,r=e.lines,s=e.room.exchanges,o=new Map(s.map(e=>[e.id,e])),i=[a,...e.room.participants.map(e=>e.bot),...s.map(e=>e.bot)],l=e=>i.find(t=>t.toLowerCase()===e.toLowerCase())??e,c=new Set(r.filter(e=>"tool"===e.kind||"ask"===e.kind).map(y.messageOf)),d=e=>("say"===e.kind||"result"===e.kind)&&!c.has((0,y.messageOf)(e)),u=e=>"user"!==e.kind&&"note"!==e.kind&&"stop"!==e.kind,f=new Map,h=new Map,k=new Map;for(let[e,t]of r.entries())t.parent&&(u(t)&&h.set(t.parent,e),u(t)&&!k.has(t.parent)&&k.set(t.parent,e),d(t)&&f.set(t.parent,(0,y.messageOf)(t)));let v=[{id:"job",kind:"job",order:-1,from:"you",to:a,text:e.request,at:0,after:[],extra:!1,exchange:"",closed:null}],w=[a],j=e=>{e&&e!==m.ROOM_THURSDAY&&!w.includes(e)&&w.push(e)},M=new Set,$=null,N=e=>{let t={after:[],extra:!1,exchange:"",...e,closed:null};return v.push(t),$=null,t},z=(e,t,n,r)=>{let s={id:e.id,order:t,at:n};if("tool"===e.kind){if(e.tool?.name===p.TOOL_NAMES.send_message){let t=e.meant?l(e.meant.name):"";N({...s,kind:"refused",from:r,to:t===m.ROOM_THURSDAY?"you":t,text:(e.tool?.results??[]).flatMap(e=>"text"===e.type?[e.text]:[]).join(" ").trim()})}return}if("ask"===e.kind){let t=l(e.to?.name??"");if(t===m.ROOM_THURSDAY){let t=e.questionId??"";o.get(t)?.state==="done"&&M.add(r),N({...s,kind:"question",from:r,to:"you",text:e.text,exchange:t});return}j(t);let n=e.exchange?o.get(e.exchange):void 0;N({...s,kind:"give",from:r,to:t,text:e.text,after:n&&g(n)?n.waitsFor:[],extra:!n,exchange:n?.id??""});return}if("user"===e.kind)return void N({...s,kind:M.delete(r)?"answer":"tell",from:"you",to:r,text:e.text});if("say"!==e.kind&&"result"!==e.kind||!d(e))return;let i=(0,y.messageOf)(e),c=$;if(c?.message===i){c.event.text=`${c.event.text}
2
+
3
+ ${e.text}`;return}if(r===a){"result"===e.kind&&($={message:i,event:N({...s,kind:"report",from:r,to:"you",text:e.text})});return}let u=e.parent?o.get(e.parent):void 0;if(u?.state==="done"&&f.get(u.id)===i){$={message:i,event:N({...s,kind:"return",from:r,to:l(u.caller),text:e.text,exchange:u.id})};return}};for(let[e,t]of r.entries()){let r=n(t),s=l(t.bot.name);j(s),z(t,e,r,s);let i=t.parent?o.get(t.parent):void 0;i?.state!=="done"||s===a||h.get(i.id)!==e||f.has(i.id)||N({id:`silent:${t.id}`,kind:"return",order:e,from:s,to:l(i.caller),text:"This turn ended without a message.",at:r,exchange:i.id})}let S=e=>e<0?null:n(r[e]),A=e=>r.findLastIndex(t=>l(t.bot.name)===e&&u(t));for(let e of s)j(e.bot);return{coord:a,bots:w,events:v,seats:new Map(w.map(t=>[t,(t=>{let n=s.filter(e=>e.bot===t),o=e.room.questions.filter(e=>l(e.bot)===t);if(o.length)return{key:"asking",waits:["you"],since:S(r.findIndex(e=>e.questionId===o[0].id))};if(n.some(e=>"running"===e.state||"queued"===e.state))return{key:"run",waits:[],since:null};let i=n.filter(e=>"paused"===e.state);if(i.length)return{key:"paused",waits:["you"],since:S(r.findLastIndex(e=>"stop"===e.kind&&i.some(t=>t.id===e.parent)))};let c=n.find(b);if(c)return{key:"held",waits:c.waitsFor,since:S(r.findIndex(e=>"ask"===e.kind&&e.exchange===c.id))};if(n.some(e=>"waiting"===e.state)){let e=s.filter(e=>{let n;return l(e.caller)===t&&e.bot!==m.ROOM_THURSDAY&&"done"!==(n=e.state)&&"cancelled"!==n});return{key:"ended",waits:w.filter(t=>e.some(e=>e.bot===t)),since:S(A(t))}}let d=n.at(-1);return d?"cancelled"===d.state?{key:"stopped",waits:[],since:null}:t===a&&"done"!==e.status?"cancelled"===e.status?{key:"stopped",waits:[],since:null}:{key:"ended",waits:[],since:S(A(t))}:{key:"done",waits:[],since:S(A(t))}:{key:"none",waits:[],since:null}})(t)])),owed:new Map(s.filter(g).map(e=>[e.id,e.waitsFor])),states:new Map(s.map(e=>[e.id,e.state])),starts:k,asking:new Set(e.room.questions.map(e=>e.id)),span:r.reduce((e,t)=>Math.max(e,n(t)),0),steps:r.reduce((e,t)=>{if("tool"!==t.kind&&"ask"!==t.kind)return e;let n=l(t.bot.name);return e.set(n,(e.get(n)??0)+1),e},new Map),status:e.status,seen:e.seen}}function v(e,t,n){let a=null===e,r=new Map(e?.read);for(let e of t.events)r.has(e.id)||r.set(e.id,a?e.at:Math.max(e.at,n));let s=new Map(e?.seats);for(let[e,r]of t.seats){let t=`${r.key}:${r.waits.join(",")}`;s.get(e)?.state!==t&&s.set(e,{state:t,since:a?r.since:n})}let o=new Map(e?.owed);for(let[e,n]of t.owed)o.set(e,{waits:n,out:null});for(let[e,a]of o)null!==a.out||t.owed.has(e)||("cancelled"===t.states.get(e)?o.delete(e):o.set(e,{...a,out:n}));let i=new Map(e?.asked);for(let e of t.asking)i.has(e)||i.set(e,null);for(let[e,a]of i)null!==a||t.asking.has(e)||i.set(e,n);let l=new Map(e?.reports);for(let e of t.events)"report"===e.kind&&l.set(e.id,{event:e,gone:null});for(let[e,a]of l)null!==a.gone||t.events.some(t=>t.id===e)||l.set(e,{...a,gone:n});return{read:r,seats:s,owed:o,asked:i,reports:l,ended:"done"===t.status||"cancelled"===t.status?e?.ended??(a?t.span:n):null,opened:e?.opened??n,fresh:e?.fresh??("done"===t.status&&!t.seen)}}function w(e,t){let n=e.events.map(n=>{let a=t.read.get(n.id)??n.at,r=t.owed.get(n.exchange);return"give"===n.kind&&!n.extra&&r?{...n,at:a,after:r.waits}:"question"===n.kind?{...n,at:a,closed:t.asked.get(n.exchange)??(e.asking.has(n.exchange)?null:a)}:{...n,at:a}});for(let[a,r]of t.owed){if(null===r.out)continue;let t=n.find(e=>"give"===e.kind&&e.exchange===a);t&&n.push({...t,id:`release:${a}`,kind:"release",order:(e.starts.get(a)??1/0)-.5,at:Math.max(r.out,t.at)})}for(let[e,a]of t.reports)null!==a.gone&&n.push({...a.event,at:t.read.get(e)??a.event.at,closed:a.gone});n.sort((e,t)=>e.at-t.at||e.order-t.order);let a=new Map([...e.seats].map(([e,n])=>[e,{...n,since:t.seats.get(e)?.since??n.since}]));return{office:e,events:n,seats:a,ended:t.ended,opened:t.opened,fresh:t.fresh}}let j=e=>"you"===e?"you":e,M=e=>e.length>2?`${e.length} bots`:e.map(j).join(" and "),$={key:"none",waits:[],since:null};function N(e,t){let{key:n,waits:a,since:r}=e.seats.get(t)??$,s=t===e.office.coord;return{key:n,label:({run:"Working",asking:"Waiting on you",paused:"Paused",held:`Held \xb7 after ${M(a)}`,ended:a.length?`Waiting on ${M(a)}`:"Waiting",done:s?"Reported":"Answered",stopped:"Stopped",none:"Not called yet"})[n],since:r,waits:a}}let z=(e,t)=>e.events.find(e=>"report"===e.kind&&e.at<=t&&(null===e.closed||e.closed>t))??null;function S(e){let{bots:t,status:n}=e.office;if("done"===n)return"done";if("cancelled"===n)return"stopped";let a=t.map(t=>N(e,t).key);return a.includes("asking")?"you":a.includes("paused")?"paused":"work"}let A=[26,55,84],O={yaw:45,pitch:30},C=.894/Math.SQRT1_2;function D({yaw:e,pitch:t}){let n=e*Math.PI/180,a=t*Math.PI/180;return{x:[C*Math.cos(n),C*Math.sin(n)*Math.sin(a)],y:[-C*Math.sin(n),C*Math.cos(n)*Math.sin(a)],z:[0,-.94*Math.cos(a)/Math.cos(Math.PI/6)]}}let P=e=>Math.round(10*e)/10,F=e=>Math.round(100*e)/100,L=(e,t,n)=>Math.min(n,Math.max(t,e)),q=e=>e<=0?0:e>=1?1:1-(1-e)**3,R="color-mix(in oklab, var(--ink) 72%, transparent)",T="color-mix(in oklab, var(--ink) 30%, transparent)";function I(e,t,n,a=4.5,r="color-mix(in oklab, var(--ink) 56%, transparent)",s=0,o=1){let[i,l]=e.at(t[0],t[1],t[2]),[c,d]=e.at(n[0],n[1],n[2]),u=Math.hypot(c-i,d-l)||1,f=(c-i)/u*a,p=(d-l)/u*a;return{id:"",x1:P(i-f),y1:P(l-p),x2:P(c+f),y2:P(d+p),length:P(u+2*a),color:r,width:o,delay:s}}let _=["var(--gray-0)","var(--gray-75)","var(--gray-100)"];function W(e,[t,n,a,r,s,o],i={}){let l=i.fills??_,c=i.over,d=i.color;return{faces:[{points:e.points([[t,r,s],[a,r,s],[a,r,o],[t,r,o]]),fill:l[1],hatch:!1},{points:e.points([[a,n,s],[a,r,s],[a,r,o],[a,n,o]]),fill:l[2],hatch:!1!==i.hatch},{points:e.points([[t,n,o],[a,n,o],[a,r,o],[t,r,o]]),fill:l[0],hatch:!1}],edges:[I(e,[t,n,o],[a,n,o],c,d),I(e,[t,n,o],[t,r,o],c,d),I(e,[t,r,o],[a,r,o],c,d),I(e,[a,n,o],[a,r,o],c,d),I(e,[t,r,s],[t,r,o],c,d),I(e,[a,r,s],[a,r,o],c,d),I(e,[a,n,s],[a,n,o],c,d),I(e,[t,r,s],[a,r,s],c,d),I(e,[a,n,s],[a,r,s],c,d)]}}let E=(...e)=>({faces:e.flatMap(e=>e.faces),edges:e.flatMap(e=>e.edges)}),B=e=>{let t=0;for(let n=1;n<e.length;n++)t+=Math.hypot(e[n][0]-e[n-1][0],e[n][1]-e[n-1][1]);return t};function U(e,t){let n=B(e),a=L(t,0,1)*n;for(let t=1;t<e.length;t++){let[r,s]=e[t-1],[o,i]=e[t],l=Math.hypot(o-r,i-s);if(a<=l||t===e.length-1){let e=l?Math.min(1,a/l):0;return{x:r+(o-r)*e,y:s+(i-s)*e,total:n}}a-=l}return{x:e[0][0],y:e[0][1],total:n}}function Y(e){if(e.length<3)return e;let t=[e[0]];for(let n=1;n<e.length-1;n++){let[a,r]=e[n-1],[s,o]=e[n],[i,l]=e[n+1],c=Math.hypot(s-a,o-r),d=Math.hypot(i-s,l-o),u=Math.min(3.5,c/2,d/2);if(u<.3){t.push(e[n]);continue}let f=[s-(s-a)/c*u,o-(o-r)/c*u],p=[s+(i-s)/d*u,o+(l-o)/d*u];for(let e=0;e<=6;e++){let n=e/6;t.push([(1-n)**2*f[0]+2*(1-n)*n*s+n*n*p[0],(1-n)**2*f[1]+2*(1-n)*n*o+n*n*p[1]])}}return t.push(e[e.length-1]),t}function H(e,t){let n=L(e,0,1)*t,a=1/(t-.175);return n<.15?a*n*n/.3:n>t-.2?1-a*(t-n)**2/.4:.15*a/2+a*(n-.15)}function G(e,t,n){for(let a of e){if(a.who!==t||n<a.leave||n>=a.back)continue;if(n<a.arrive){let e=(n-a.leave)/(a.arrive-a.leave);return{trip:a,phase:"out",u:H(e,a.arrive-a.leave),p:e,carry:a.out}}if(n<a.stay)return{trip:a,phase:"at",u:1,p:0,carry:null};let e=(n-a.stay)/(a.back-a.stay);return{trip:a,phase:"back",u:Number.isFinite(a.back)?1-H(e,a.back-a.stay):1,p:e,carry:a.home}}return null}let K={hop:.58,flip:.92,cheer:.76},X={hop:.3,flip:.8,cheer:.58},Q=[0,1,2,3],V=(e,t)=>{let n=Math.imul(0x811c9dc5^t,0x1000193);for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),0x1000193);return(((n=Math.imul((n=Math.imul(n^n>>>15,0x85ebca6b))^n>>>13,0xc2b2ae35))^n>>>16)>>>0)/0x100000000};function Z(e,t){let n=n=>V(e,7919*(t+1)+n),a=2.45+.7*n(3),r=1.15*(.85+.3*n(4));return{rise:.4+.1*n(6),fall:a/r+.15,top:a,sink:r}}var J=e.i(83928),ee=e.i(621285),et=e.i(283653),en=e.i(647163);let ea=[.3,.4,.5,.7,.75,.8,.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4],er=(e,t,n,a)=>{let r=Math.min(ea[ea.length-1],Math.max(ea[0],a));return{z:r,x:t-r/e.z*(t-e.x),y:n-r/e.z*(n-e.y)}},es=(e,t)=>t?ea.find(t=>t>e+.001)??e:ea.findLast(t=>t<e-.001)??e,eo=e=>`color-mix(in oklab, var(--ink) ${e}%, transparent)`;function ei({scene:e,start:a,label:r,faces:c,from:d,onBot:u,onAnswer:f,camera:p=O,desk:x,className:m}){let g=(0,n.useRef)(null),b=function(e){let[t,a]=(0,n.useState)(null);return(0,n.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{let e=Math.round(t.clientWidth),n=Math.round(t.clientHeight);a(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})};n();let r=new ResizeObserver(n);return r.observe(t),()=>r.disconnect()},[e]),t}(g),[k]=(0,n.useState)(()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches),v=(0,n.useMemo)(()=>b&&b.w>0&&b.h>0?function(e,t,n=O,a=!1){let{helpers:r,at:s}=function(e){let t=new Map;for(let n of e.events)"give"!==n.kind&&"release"!==n.kind||t.has(n.to)||t.set(n.to,n.at);let n=e.office.bots.filter(t=>t!==e.office.coord);return n.sort((e,n)=>(t.get(e)??1/0)-(t.get(n)??1/0)),{helpers:n,at:t}}(e),o=function(e,t){let n=Math.ceil(t.length/3),a=t.length?58+30*n:48,r=t.map((e,t)=>{let n=Math.floor(t/3),a=t%3,r=58+30*n,s=10+29*a;return{bot:e,x0:r,y0:s,x1:r+20,y1:s+8,seat:[r+6.5,s-1.6],lane:A[a],spot:[r+7,A[a]],tray:[r+1.2,s+1.4,r+6.8,s+6.6],laptop:[r+16.8,s+1.2]}}),s={bot:e,x0:16,y0:15,x1:40,y1:23,seat:[23.5,13.4],spot:[27,30],lane:30,tray:[0,0,0,0],laptop:[36.6,16.2]},o=[42,78],i=[24,45],l=[s.seat,[44,13.4]],c={lobby:[...l,[44,34],[24,40],[24,54],[42,62],o],door:[...l,[44,34],[24,40],i]};for(let e of r)c[`to:${e.bot}`]=[...l,[44,26],[53,26],[53,e.lane],e.spot],c[`from:${e.bot}`]=[e.seat,[e.x0-2.5,e.seat[1]],[e.x0-2.5,e.lane],[53,e.lane],[53,26],[44,26],[44,30],s.spot];return{width:a,desks:r,byBot:new Map(r.map(e=>[e.bot,e])),own:s,lobby:o,door:i,routes:c}}(e.office.coord,r),i=o.width,l=70,c=80,d=a?function(e,t,n){let a=D(n),r=1/0,s=-1/0,o=1/0,i=-1/0,l=(e,t,n)=>{let l=e*a.x[0]+t*a.y[0]+n*a.z[0],c=e*a.x[1]+t*a.y[1]+n*a.z[1];r=Math.min(r,l),s=Math.max(s,l),o=Math.min(o,c),i=Math.max(i,c)};for(let t of[e.x0-1,e.x1+3])for(let n of[e.seat[1]-3,e.y1+3])for(let e of[0,11.2])l(t,n,e);let c=Math.max(1,t.w-32),d=Math.max(1,t.h-44-12),u=e.seat[0]*a.x[1]+e.seat[1]*a.y[1],f=Math.min(o,u-13.5),p=Math.min(c/(s-r),d/(i-f)),h=16+(c-(s-r)*p)/2-r*p,x=44+(d-(i-f)*p)/2-f*p,m=(e,t,n=0)=>[P(h+(e*a.x[0]+t*a.y[0]+n*a.z[0])*p),P(x+(e*a.x[1]+t*a.y[1]+n*a.z[1])*p)];return{s:p,axes:a,at:m,points:e=>e.map(([e,t,n])=>m(e,t,n).join(",")).join(" ")}}(o.own,t,n):function(e,t,n,a){let r=D(a),s=1/0,o=-1/0,i=1/0,l=-1/0,c=(e,t,n)=>{let a=e*r.x[0]+t*r.y[0]+n*r.z[0],c=e*r.x[1]+t*r.y[1]+n*r.z[1];s=Math.min(s,a),o=Math.max(o,a),i=Math.min(i,c),l=Math.max(l,c)};for(let t of[-4,e+3])for(let e of[-4,103])for(let n of[-6,18])c(t,e,n);for(let e of[n.x0,n.x1])for(let t of[n.y0,n.y1])c(e,t,-5);let d=Math.max(1,t.w-40),u=Math.max(1,t.h-96-16),f=Math.min(d/(o-s),u/(l-i),7.4),p=20+(d-(o-s)*f)/2-s*f,h=96+(u-(l-i)*f)/2-i*f,x=(e,t,n=0)=>[P(p+(e*r.x[0]+t*r.y[0]+n*r.z[0])*f),P(h+(e*r.x[1]+t*r.y[1]+n*r.z[1])*f)];return{s:f,axes:r,at:x,points:e=>e.map(([e,t,n])=>x(e,t,n).join(",")).join(" ")}}(o.width,t,{x0:i+9,x1:i+9+28,y0:c,y1:c-l},n),u=[],f=[],p=[],h=[],x=0,m=(e,t,n=!1)=>u.push({id:`f${u.length}`,points:d.points(e),fill:t,hatch:n,delay:x}),y=(e,t,n,a=R)=>f.push({...I(d,e,t,n,a,0,a===T?.75:1.3),id:`l${f.length}`,delay:x}),g=a?[]:[...[0,i].map(e=>({...I(d,[e,-2,-5],[e,102,-5],340,"url(#office-fade-y)",0,.75),id:`gx${e}`})),...[0,100].map(e=>({...I(d,[-2,e,-5],[i+2,e,-5],340,"url(#office-fade-x)",0,.75),id:`gy${e}`}))];if(!a){for(let[e,t,n]of(m([[0,100,0],[i,100,0],[i,100,-5],[0,100,-5]],"var(--gray-100)"),m([[i,0,0],[i,100,0],[i,100,-5],[i,0,-5]],"var(--gray-150)",!0),y([0,100,-5],[i,100,-5],64),y([i,0,-5],[i,100,-5],64),y([0,100,0],[0,100,-5],8),y([i,100,0],[i,100,-5],8),y([i,0,0],[i,0,-5],8),x=70,m([[0,48,0],[48,48,0],[48,100,0],[0,100,0]],"url(#office-floor-lobby)"),x=110,m([[0,0,0],[48,0,0],[48,48,0],[0,48,0]],"url(#office-floor-own)"),x=150,r.length&&m([[48,0,0],[i,0,0],[i,100,0],[48,100,0]],"url(#office-floor-work)"),m([[0,0,0],[i,0,0],[i,2.6,0],[2.6,2.6,0],[2.6,100,0],[0,100,0]],"url(#office-hatch-soft)"),y([0,100,0],[i,100,0],22),y([i,0,0],[i,100,0],22),x=210,m([[0,0,0],[i,0,0],[i,0,16],[0,0,16]],"var(--gray-25)"),m([[0,0,0],[0,100,0],[0,100,16],[0,0,16]],"var(--gray-75)",!0),m([[-2,-2,16],[i,-2,16],[i,0,16],[0,0,16],[0,100,16],[-2,100,16]],"var(--gray-100)"),m([[i,-2,0],[i,0,0],[i,0,16],[i,-2,16]],"var(--gray-150)",!0),m([[-2,100,0],[0,100,0],[0,100,16],[-2,100,16]],"var(--gray-100)"),[[[-2,-2,16],[i,-2,16],10],[[0,0,16],[i,0,16],10],[[-2,-2,16],[-2,100,16],10],[[0,0,16],[0,100,16],10],[[i,-2,0],[i,-2,16],10],[[i,0,0],[i,0,16],10],[[i,-2,16],[i,0,16],5],[[-2,100,0],[-2,100,16],10],[[0,100,0],[0,100,16],10],[[-2,100,16],[0,100,16],5],[[0,0,0],[i,0,0],0],[[0,0,0],[0,100,0],0],[[0,0,0],[0,0,16],10]]))y(e,t,n);y([0,.05,1.1],[i,.05,1.1],0,T),y([.05,0,1.1],[.05,100,1.1],0,T),x=260,m([[2.5,.12,4],[21.5,.12,4],[21.5,.12,13],[2.5,.12,13]],"var(--gray-0)"),y([2.5,.12,4],[21.5,.12,4],3),y([2.5,.12,13],[21.5,.12,13],3),y([2.5,.12,4],[2.5,.12,13],3),y([21.5,.12,4],[21.5,.12,13],3)}let b=0,k=(e,t,n={})=>{let a=`p${b++}`;h.push({id:a,depth:e,faces:t.faces.map((e,t)=>({...e,id:`${a}f${t}`})),edges:t.edges.map((e,t)=>({...e,id:`${a}e${t}`})),mugs:[],delay:x,appear:null,...n})},v=(e,t,n,a,r,s)=>p.push({points:d.points([[e+.3,t+.5,0],[n+r,t+.5,0],[n+r,a+.7*r,0],[e+.3,a+.7*r,0]]),delay:x,of:s,depth:(e+n)/2+(t+a)/2}),w=["var(--gray-75)","var(--gray-50)","var(--gray-150)"],j=(e,t,n)=>{for(let a=t;a<n;a+=4){let r=Math.min(n,a+4),s=W(d,[e-.9,a,e+.9,r,0,7],{fills:w}),o=s.edges,i=[o[1],o[3],o[8]].concat(a===t?[o[0],o[6]]:[]).concat(r===n?[o[2],o[4],o[5],o[7]]:[]);x+=16,k(e+(a+r)/2+.9,{faces:s.faces,edges:i})}},M=(e,t,n)=>{for(let a=t;a<n;a+=4){let r=Math.min(n,a+4),s=W(d,[a,e-.9,r,e+.9,0,7],{fills:w,hatch:!1}),o=s.edges,i=[o[0],o[2],o[7]].concat(a===t?[o[1],o[4]]:[]).concat(r===n?[o[3],o[5],o[6],o[8]]:[]);x+=16,k((a+r)/2+e+.9,{faces:s.faces,edges:i})}};a||(r.length&&(j(48,0,18),j(48,30,100)),M(48,0,18),M(48,30,48));let $=["var(--office-lid-top)","var(--office-lid)","var(--office-lid-side)"],z="color-mix(in oklab, var(--ink) 80%, transparent)",S=([e,t])=>W(d,[e-3.4,t+.4,e+3.4,t+4.4,6.1,6.45],{fills:["var(--gray-100)","var(--gray-150)","var(--gray-200)"],over:2}),C=[],q=(t,n,a)=>{let r,s;x+=60;let o=(t.x0+t.x1)/2+(t.y0+t.y1)/2,i=`p${b}`;v(t.x0,t.y0,t.x1,t.y1,2.6,null===n?null:i),k(o,(r=W(d,[t.x0-.4,t.y0-.4,t.x1+.4,t.y1+.4,5.2,5.2+.9]),s=[[t.x0,t.y1-.9],[t.x1-.9,t.y1-.9],[t.x1-.9,t.y0]].map(([e,t])=>W(d,[e,t,e+.9,t+.9,0,5.2],{fills:["var(--gray-50)","var(--gray-100)","var(--gray-150)"],over:2.5})),E({faces:[],edges:[I(d,[t.x0+.45,t.y0+.45,0],[t.x0+.45,t.y0+.45,5.2],2.5)]},...s,r)),{appear:n}),x+=40;let l=((t,n)=>{let a=N(e,n).key,[r,s]=t;if("done"===a||"none"===a)return{part:E(S(t),W(d,[r-3.4,s+.4,r+3.4,s+4.4,6.45,6.85],{fills:["var(--gray-200)","var(--gray-300)","var(--gray-250)"],hatch:!1,over:2,color:z}))};let[o,i]=d.at(r-3.4+.45,s+.46,10.2-.4),{axes:l,s:c}=d;return{part:E(S(t),W(d,[r-3.4,s,r+3.4,s+.45,6.1,10.2],{fills:$,hatch:!1,over:2,color:z})),screen:{id:`screen-${n}`,bot:n,matrix:`matrix(${[l.x[0]*c,l.x[1]*c,-l.z[0]*c,-l.z[1]*c,o,i].map(F).join(",")})`,w:6.8-.9,h:4.1-.75,mode:"run"===a?"lit":"paused"===a?"paused":"asking"===a?"asking":"stopped"===a?"dark":"dim"}}})(t.laptop,t.bot);if(k(t.laptop[0]+t.laptop[1]+3.3,l.part,{appear:n,screen:l.screen}),"run"===N(e,t.bot).key&&C.push({id:`pool-${t.bot}`,bot:t.bot,cx:(t.x0+t.x1)/2+1,cy:(t.y0+t.y1)/2-1,r:15}),x+=40,k(o+5.2,{faces:[],edges:[]},{mugs:[((e,t)=>{let n=1.05*d.s,[a,r]=d.at(e,t,8.2),[s,o]=d.at(e,t,6.1);return{cx:a,cy:r,bx:s,by:o,rx:P(n),ry:P(.5*n)}})(a?31:t.x0+11,a?20.5:t.y1-1.5)],appear:n}),x+=40,a)k(o+.6,E(...[0,1,2].map(e=>W(d,[17.2+.3*e,16.2-.2*e,22.2+.3*e,19.6-.2*e,6.1+.7*e,6.1+(e+1)*.7],{over:1.5}))));else{let[a,r,s,o]=t.tray;k((a+s)/2+(r+o)/2+.3,E(W(d,[a,r,s,o,6.1,7.4],{fills:["var(--gray-50)","var(--gray-150)","var(--gray-200)"],over:2}),{faces:[{points:d.points([[a+.5,r+.5,7.4],[s-.5,r+.5,7.4],[s-.5,o-.5,7.4],[a+.5,o-.5,7.4]]),fill:"var(--gray-100)",hatch:!1}],edges:[]}),{appear:n,check:"done"===N(e,t.bot).key?d.points([[(a+s)/2-1.6,(r+o)/2-.2,7.45],[(a+s)/2-.4,(r+o)/2+1.1,7.45],[(a+s)/2+1.9,(r+o)/2-1.6,7.45]]):void 0})}};if(a||(x+=60,v(12,74,36,80,3,null),k(101,E(W(d,[12,74,36,80,0,7.2]),W(d,[11.4,73.4,36.6,80.6,7.2,8.1])))),q(o.own,null,!0),!a)for(let e of o.desks)q(e,s.get(e.bot)??0,!1);let{axes:_}=d,B=([e,t,n],a,r,s)=>{let[o,i]=d.at(e,t,n),l=d.s/a;return`matrix(${[r[0]*l,r[1]*l,s[0]*l,s[1]*l,o,i].map(F).join(",")})`},U=[-_.y[0],-_.y[1]],Y=[-_.z[0],-_.z[1]],H=([e,t,n])=>{let[a,r]=d.at(e,t,n);return`matrix(${[_.x[0]*d.s,_.x[1]*d.s,_.y[0]*d.s,_.y[1]*d.s,a,r].map(F).join(",")})`},G=e=>e<=150?Math.round(1.2*e):e<=210?170:250;for(let e of u)e.delay=G(e.delay);for(let e of f)e.delay=G(e.delay);let K=h.filter(e=>null===e.appear).map(e=>e.depth),X=Math.min(...K),Q=Math.max(...K),V=e=>Math.round(300+300*L((e-X)/Math.max(1,Q-X),0,1));for(let e of h)e.delay=V(e.depth);for(let e of p)e.delay=V(e.depth);return{plan:o,fit:d,guides:g,faces:u,lines:f,shades:p,pieces:h,sign:{matrix:B([i+9,c,-5],10,U,_.x)},board:{matrix:B([-18,99,50],10,U,Y),w:1e3,h:500},floor:H([0,0,0]),pools:C,ground:{matrix:H([0,0,-5]),w:i,d:100},botSize:Math.round(a?13.5*d.s:L(13.5*d.s,28,96)),popAt:700,built:1e3}}(e,b,p,x):null,[e,b,p,x]),w=(0,n.useMemo)(()=>v?function(e,t){let n=[],a=new Map,r=e.office.coord,s=e=>B(e)/46+.175,o=(e,r,o,i,l,c={})=>{let d=t.routes[r];if(!d)return;let u=Y(d),f=n.findLast(t=>t.who===e);f&&f.back===1/0&&(f.stay=Math.max(f.arrive+.35,o),f.back=f.stay+s(f.route),a.set(e,f.back));let p=Math.max(o,a.get(e)??-1/0),h=s(u),x=p+h,m=void 0!==c.until?Math.max(x+.35,c.until):x+(c.hold??.35),y=c.forever?1/0:m+h;n.push({who:e,route:u,leave:p,arrive:x,stay:m,back:y,out:l,home:c.home??null,event:i,answer:c.answer}),a.set(e,y)};for(let i of e.events)switch(i.kind){case"job":{let e=Y(t.routes.lobby),o=s(e);n.push({who:r,route:e,leave:-2,arrive:-1,stay:.8,back:.8+o,out:null,home:"start",event:i}),a.set(r,.8+o);break}case"give":i.from===r&&o(r,`to:${i.to}`,i.at,i,i.extra?"extra":i.after.length?"held":"order");break;case"release":i.from===r&&o(r,`to:${i.to}`,i.at,i,"copy");break;case"refused":i.from===r&&"you"===i.to&&o(r,"door",i.at,i,"note",{home:"noted",hold:.65});break;case"question":{if(i.from!==r)break;let t=e.events.slice(e.events.indexOf(i)+1).find(e=>"answer"===e.kind&&e.to===i.from),n=Math.min(t?.at??1/0,i.closed??1/0);o(r,"lobby",i.at,i,"question",t?{home:"answer",until:n+.35,answer:t}:Number.isFinite(n)?{until:n}:{forever:!0});break}case"report":o(r,"lobby",i.at,i,"report",null===i.closed?{forever:!0}:{until:i.closed,home:"report"});break;case"return":i.to===r&&o(i.from,`from:${i.from}`,i.at,i,"result")}return n}(e,v.plan):[],[e,v]),[j,M]=(0,n.useState)(null),$=null!==j,C=v?.built??null;(0,n.useEffect)(()=>{if(null===C||$)return;let e=window.setTimeout(()=>M((Date.now()-a)/1e3),C);return()=>window.clearTimeout(e)},[null===C,$,a]);let _=(0,n.useMemo)(()=>k?[]:function(e,t,n){let a=e.office.coord,r=e.opened,s=[],o=(e,t,n)=>{n>=r&&s.push({bot:e,kind:t,at:n})},i=new Map;for(let e of t){if(e.who!==a)continue;("start"===e.home||"answer"===e.home)&&o(a,"hop",e.back);let t=e.event.to;"you"!==t&&"job"!==e.event.kind&&(i.has(t)?("order"===e.out||"extra"===e.out||"copy"===e.out)&&o(t,"hop",e.arrive+.11):(i.set(t,e.arrive),o(t,"flip",e.arrive+.11)))}let l=t.findLast(e=>"report"===e.out),c=l&&"done"===e.office.status&&null===l.event.closed?l.arrive>=r?l.arrive:e.fresh&&null!==n?n:null:null;l&&null!==c&&e.office.bots.forEach((e,n)=>{if(e!==a&&(i.get(e)??1/0)>l.arrive)return;let r=c+.15+.07*n,s=G(t,e,r),d=Number.isFinite(s?.trip.back);s&&("out"===s.phase||"back"===s.phase&&d)&&(r=(d?s.trip.back:s.trip.arrive)+.1),o(e,"cheer",r),o(e,"hop",r+K.cheer+.06)});let d=S(e);if("paused"===d||"stopped"===d)return s;let u=[...s],f=(e,n)=>{let a=G(t,e,n);return!a||"at"===a.phase||"back"===a.phase&&!Number.isFinite(a.trip.back)};for(let t of e.office.bots)if("none"!==N(e,t).key)for(let e=0;;e++){let n=r+4+150*(e+V(t,e));if(n>r+3600)break;if(.35>V(t,-1-e))continue;let o=.25>V(t,1e3+e)?"flip":"hop",l=n+K[o];t!==a&&(i.get(t)??1/0)>n||!f(t,n)||!f(t,l)||u.some(e=>e.bot===t&&e.at<l+1.5&&n<e.at+2.5)||s.push({bot:t,kind:o,at:n})}return s}(e,w,j),[k,e,w,j]),H=(0,n.useMemo)(()=>v?function(e,t,n,a){let r=[];for(let e of a)if(r.push([e.at,e.at+K[e.kind]]),"cheer"===e.kind)for(let t of Q){let{rise:n,fall:a}=Z(e.bot,t),s=e.at+.1;r.push([s,s+n+a]),r.push([s+n+a+5,s+n+a+5+.8])}for(let e of n)r.push([e.leave,e.arrive+.8]),Number.isFinite(e.back)&&r.push([e.stay,e.back+.8]);for(let e of t.pieces)null!==e.appear&&r.push([e.appear,e.appear+.8]);for(let t of e.events)"refused"===t.kind&&r.push([t.at,t.at+2.4+.1]);return r}(e,v,w,_):null,[e,v,w,_]),J=function(e,t){let[a,r]=(0,n.useState)(()=>(Date.now()-e)/1e3);return(0,n.useEffect)(()=>{let n;if(!t)return;let a=0,s=()=>{let o=(Date.now()-e)/1e3;r(o);let i=function(e,t){let n=1/0;for(let[a,r]of e){if(t>=a&&t<r)return 0;a>t&&(n=Math.min(n,a-t))}return n}(t,o);0===i?a=requestAnimationFrame(s):Number.isFinite(i)&&(n=window.setTimeout(s,1e3*i))};return s(),()=>{cancelAnimationFrame(a),window.clearTimeout(n)}},[e,t]),a}(a,$?H:null),ee=v?function(e,t,n,a,r){let{plan:s,fit:o}=t,i=e.office.coord,l=(e,t=.35)=>F(q(L((r-e)/t,0,1))),c=t.botSize,d=new Map;for(let e of n)e.who!==i||"you"===e.event.to||d.has(e.event.to)||"job"===e.event.kind||d.set(e.event.to,e.arrive);let u=[],f=[],p=[],h=e=>e===i?s.own.seat:s.byBot.get(e)?.seat;for(let t of e.office.bots){let s=t===i,l=s?-1/0:d.get(t);if(!s&&(void 0===l||r<l))continue;let x=h(t);if(!x)continue;let m=G(n,t,r),y=N(e,t),g=x[0],b=x[1],k=0,v=0,w=0,j=[0,0],M=null,$=!!m&&"at"!==m.phase&&!("back"===m.phase&&!Number.isFinite(m.trip.back));if(m){let e=U(m.trip.route,m.u);if(g=e.x,b=e.y,$){let a=Math.abs(Math.sin(Math.PI*m.u*e.total/13.799999999999999));k=3.5*a,w=.03*(1-a)**4;let s=U(m.trip.route,Math.min(1,m.u+.02)),i=U(m.trip.route,Math.max(0,m.u-.02)),[l,c]=o.at(s.x,s.y,0),[d,u]=o.at(i.x,i.y,0),[p,h]=o.at(g,b,0),x=Math.atan2(c-h,l-p)-Math.atan2(h-u,p-d),y=Math.atan2(Math.sin(x),Math.cos(x)),$="back"===m.phase?-1:1;v=L(180*y/Math.PI,-5,5)*$;let N=(l-d)*$,z=(c-u)*$,S=18/(Math.hypot(N,z)||1);j=[Math.round(N*S),Math.round(z*S*.7)];let A=G(n,t,r-.06);if(A&&A.phase===m.phase){let e=U(m.trip.route,A.u),[t,n]=o.at(e.x,e.y,0);M=[P(t-p),P(n-h),P(L((p-t)*1.2,-12,12))]}for(let e=1;e<=6;e++){let n="back"===m.phase?m.u+.045*e:m.u-.045*e;if(n<0||n>1)continue;let a=U(m.trip.route,n),r=e%2?.7:-.7,[s,i]=o.at(a.x+r,a.y-r,0);f.push({id:`${t}${e}`,x:s,y:i,opacity:F(.22-.03*e)})}}}let z=a.find(e=>e.bot===t&&r>=e.at&&r<e.at+K[e.kind]),S=z?function(e,t,n){let a=K[e]-.1-.13;if(t<.1)return{lift:0,spin:0,squash:.16*Math.sin(t/.1*Math.PI)};if(t<.1+a){let r=(t-.1)/a;return{lift:X[e]*n*4*r*(1-r),spin:"flip"===e?360*(r<=0?0:r>=1?1:r<.5?4*r*r*r:1-(-2*r+2)**3/2):0,squash:-.1*Math.max(0,1-3*r)}}return{lift:0,spin:0,squash:.14*Math.sin(Math.min(1,(t-.1-a)/.13)*Math.PI)}}(z.kind,r-z.at,c):{lift:0,spin:0,squash:0};k+=S.lift;let[A,O]=o.at(g,b,0),C=$?m?.carry??null:null,D=s?1:L((r-(l??0))/.35,0,1);u.push({bot:t,depth:g+b+.25,x:A,y:O,hop:P(k),tilt:P(v),spin:P(S.spin),squash:F(S.squash+w),scale:F(.6+.4*q(D)),opacity:F(D),size:c,carry:C?{dark:"result"===C||"report"===C||"copy"===C,ember:"question"===C||"answer"===C,stamp:"noted"===C}:null,lag:C?M:null,gaze:j,working:"run"===y.key&&!$,crossed:"stopped"===y.key||"paused"===y.key}),p.push({bot:t,x:A,head:P(O-k-c),foot:O,carrying:!!C,walking:$})}let x=[],m=[],y=(e,t,n,a,r,s,i,l,c=1,d=!1)=>{let u=Math.cos(l),f=Math.sin(l),p=(e,r)=>[t+e*u-r*f,n+e*f+r*u,a];x.push({id:e,depth:t+n+.6,points:o.points([p(-r/2,-s/2),p(r/2,-s/2),p(r/2,s/2),p(-r/2,s/2)]),lines:[.3,.5,.7].map(e=>o.points([p(-r/2+.2*r,-s/2+s*e),p(r/2-r*(e>.6?.45:.2),-s/2+s*e)])),dark:i,ember:d,opacity:c})},g=(e,t,n)=>{let a=e<8?e:1+(e-1)%7,r=e<8?0:Math.floor((e-1)/7),s=Math.floor(a/4),i=3.6+a%4*4.5+.5*r,l=i+3.7,c=12.2-3.9*s-.5*r,d=c-3.2;m.push({id:`pin${e}`,depth:-1,points:o.points([[i,.3,d],[l,.3,d],[l,.3,c],[i,.3,c]]),lines:[.72,.52,.32].map(e=>o.points([[i+.7,.3,d+(c-d)*e],[l-(e<.4?1.8:.7),.3,d+(c-d)*e]])),dark:t,ember:!1,opacity:n})},b=n.find(e=>"start"===e.home);b&&r>=b.back&&g(0,!1,l(b.back));let k=1;for(let e of n)"result"===e.out&&(r>=e.arrive+.31&&g(k,!0,l(e.arrive+.31,.2)),k+=1);for(let e of s.desks){let t=n.filter(t=>t.who===i&&t.event.to===e.bot&&t.leave<=r),a=t.findLast(e=>"held"===e.out),s=a?t.find(e=>"copy"===e.out&&e.event.exchange===a.event.exchange):t.findLast(e=>"copy"===e.out),o=t.findLast(e=>"order"===e.out),c=t.filter(e=>"extra"===e.out).slice(-3),d=(e.tray[0]+e.tray[2])/2,u=(e.tray[1]+e.tray[3])/2;a&&r>=a.arrive+.22&&(!s||r<s.arrive+.4)&&y(`hold-${e.bot}`,d,u,7.5,3.6,4.2,!1,-.12),s&&r>=s.arrive&&r<s.arrive+.4&&y(`copy-${e.bot}`,d+.5,u-.5,7.8,2.8,2.8,!0,.2);let f=s&&(!o||s.leave>o.leave)?s.arrive+.4:o?o.arrive+.22:null;null!==f&&r>=f&&y(`order-${e.bot}`,e.x0+9.5,e.y0+4.2,6.15,4.6,3.6,!1,.08,l(f)),s&&r>=s.arrive+.4&&y(`answers-${e.bot}`,e.x0+11.2,e.y0+3.4,6.2,2.8,2.6,!0,.25,l(s.arrive+.4)),c.forEach((t,n)=>{r>=t.arrive&&y(`more-${e.bot}-${t.event.id}`,e.x0+6.8+1.2*n,e.y0+5.4,6.25,2.6,2.2,!1,-.2,l(t.arrive))})}let v=n.find(e=>"question"===e.out&&r>=e.arrive&&r<Math.min(e.answer?e.answer.at+.3:1/0,e.event.closed??1/0));v&&r>=v.arrive+.22&&y("question",29,77,8.2,4.4,3.4,!1,-.2,1,!0);let w=n.findLast(e=>"report"===e.out&&r>=e.arrive&&(!Number.isFinite(e.back)||r<e.stay));w&&r>=w.arrive+.22&&y("report",29,77,8.2,4.4,3.4,!0,-.2,l(w.arrive+.22,.15));let j=n.find(e=>"answer"===e.home&&r>=e.back);j&&y("answer",23.5,19.8,6.15,3.4,2.6,!1,-.15,l(j.back));let M=n.find(e=>"note"===e.out&&r>=e.arrive&&r<e.stay),$=[];for(let e of n){let t=e.out;if(!t||"note"===t)continue;let n="result"===t?.31:.22;if(r<e.arrive||r>=e.arrive+n)continue;let a=q((r-e.arrive)/n),i=e.route[e.route.length-1],[l,d]=o.at(i[0],i[1],0),u={x:l+.1*c,y:d-c-16},f=s.byBot.get(e.event.to),p="question"===t||"report"===t?[29,77,8.2]:"result"===t?[12,.3,9.5]:f?[(f.tray[0]+f.tray[2])/2,(f.tray[1]+f.tray[3])/2,7.6]:[i[0],i[1],6],[h,x]=o.at(p[0],p[1],p[2]);$.push({id:`fly-${e.event.id}`,x:P(u.x+(h-u.x)*a),y:P(u.y+(x-u.y)*a-72*a*(1-a)),turn:P(-4+16*a),scale:F(1-.45*a),dark:"result"===t||"report"===t||"copy"===t,ember:"question"===t})}let z=[],S=new Map;for(let e of t.pieces){if(null===e.appear){z.push({kind:"piece",piece:e,draw:1});continue}if(r<e.appear)continue;let t=F(L((r-e.appear)/.8,0,1));S.set(e.id,t),z.push({kind:"piece",piece:e,draw:t})}let A=[...z,...u.map(e=>({kind:"bot",walker:e})),...x.map(e=>({kind:"paper",paper:e}))],O=e=>"piece"===e.kind?e.piece.depth:"bot"===e.kind?e.walker.depth:e.paper.depth;A.sort((e,t)=>O(e)-O(t));let C=t.shades.filter(e=>{if(!e.of)return!0;let t=S.get(e.of);return void 0!==t&&t>=.6}),D=[],R=new Map(u.map(e=>[e.bot,e]));for(let t of e.office.bots){let n=N(e,t),a=R.get(t);if("held"===n.key&&a)for(let e of n.waits){let n=R.get(e);n&&D.push({id:`${e}>${t}`,x1:n.x,y1:n.y,x2:a.x,y2:a.y,opacity:Math.min(n.opacity,a.opacity)})}}let T=e.events.findLast(e=>"refused"===e.kind&&"you"!==e.to&&r>=e.at&&r<e.at+2.4),I=(e,t,n,a)=>{let[s,i]=o.at(e,t,0);return{x:s,y:i-c,scale:F(L((r-n)/.18,0,1)),text:a.text}},_=T?h(T.from):void 0,W=M?I(s.door[0],s.door[1],M.arrive,M.event):T&&_?I(_[0],_[1],T.at,T):null,E=[],B=!1;for(let e of a){if("cheer"!==e.kind)continue;let t=r-e.at-.1,a=h(e.bot);if(t<0||!R.has(e.bot)||!a)continue;let i=G(n,e.bot,e.at+.1),l=i?U(i.trip.route,i.u):{x:a[0],y:a[1]};for(let n of Q){let{rise:a,fall:r}=Z(e.bot,n);t>=a+r+5+.8||(t<a+r&&(B=!0),E.push(function(e,t,n,a,r,s,o){let i=n=>V(e,7919*(t+1)+n),{rise:l,fall:c,top:d,sink:u}=Z(e,t),f=r/s.s,p=i(1)*Math.PI*2,h=f*(.5+1.1*i(2)),x=4.2+1.4*i(5),m=i(7)*Math.PI*2,y=1+Math.round(i(9)),g=(.5>i(11)?-1:1)*(40+60*i(10)),b=L(a-l,0,c),k=b/c,v=a<l?a/l*.3:.3+.7*k,w=a<l?0:Math.sin(b*x+m)*f*.35,j=L(n.x+Math.cos(p)*h*v-Math.sin(p)*w,1.5,o-1.5),M=L(n.y+Math.sin(p)*h*v+Math.cos(p)*w,1.5,98.5),$=a<l?.95+(d-.95)*(1-(1-a/l)**2):d-u*(b<.3?b*b/.6:b-.15),[N,z]=s.at(j,M,-(Math.max(0,$)*f/s.axes.z[1])),S=a<l?a/l*y*Math.PI:y*Math.PI+.9*Math.cos(b*x+m)*(1-k),A=.62*r/18,O=L((l+c+5+.8-a)/.8,0,1);return{id:`${e}-sheet${t}`,plane:`matrix(${[s.axes.x[0]*A,s.axes.x[1]*A,s.axes.y[0]*A,s.axes.y[1]*A,N,z].map(F).join(",")})`,turn:P(360*i(8)+(a<l?a/l*160:160+g*b)),face:F(Math.cos(S)),landed:a>=l+c,dark:t%4==1,opacity:F(O)}}(e.bot,n,l,t,c,o,s.width)))}}return{sprites:A,pins:m,tossed:E,hush:B,here:new Set(u.map(e=>e.bot)),flying:$,trail:f,shades:C,links:D,stamp:W,tags:p}}(e,v,w,_,J):null,ea=S(e),eo=(0,n.useMemo)(()=>(function(e){let t=new Set;for(let n of e.events)if("return"===n.kind||"report"===n.kind)for(let e of(0,h.pathsIn)(n.text))t.add(e);return[...t]})(e),[e]),{data:ed}=(0,et.useServerRoute)(eo.length?l.queryKey.workspaceFiles(eo):null),eu=(0,n.useCallback)(e=>ed?.some(t=>t.path===e)??!1,[ed]),[ef,ep]=(0,n.useState)(null),eh=x?{z:1,x:0,y:0}:b?er({z:1,x:0,y:0},b.w/2,b.h/2,.7):{z:.7,x:0,y:0},ex=ef??eh,ey=(0,n.useRef)(eh);ey.current=eh;let eg=(0,n.useRef)(0),ej=(0,n.useRef)(null),e$=(0,n.useRef)(null),[ez,eS]=(0,n.useState)(!1),eO=z(e,J)?.id??null,[eR,eT]=(0,n.useState)({bot:null,report:eO}),eI=eR.report===eO?eR.bot:null;(0,n.useEffect)(()=>{let e=g.current;if(!e||x)return;let t=t=>{if(t.target.closest("[data-reads]"))return;t.preventDefault(),cancelAnimationFrame(eg.current),ej.current=null;let n=e.getBoundingClientRect(),a=t.clientX-n.left,r=t.clientY-n.top;ep(e=>{let n=e??ey.current;return er(n,a,r,n.z*Math.exp(-t.deltaY*(t.ctrlKey?.01:.0022)))})};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[x]);let e_=()=>{let e=e$.current;e$.current=null,eS(!1),e&&!e.moved&&!e.onPlate&&eI&&eT({bot:null,report:eO})},eW=e=>{cancelAnimationFrame(eg.current);let t=e??ey.current;ej.current=t;let n=performance.now(),a=()=>{let r=Math.min(1,(performance.now()-n)/300),s=1-(1-r)**3;ep(r>=1?e:{z:ex.z+(t.z-ex.z)*s,x:ex.x+(t.x-ex.x)*s,y:ex.y+(t.y-ex.y)*s}),r<1?eg.current=requestAnimationFrame(a):ej.current=null};eg.current=requestAnimationFrame(a)};(0,n.useEffect)(()=>()=>{cancelAnimationFrame(eg.current),y.officePointed.set(null)},[]);let eE=`translate(${ex.x}px, ${ex.y}px) scale(${ex.z})`,eB=(e,t)=>({x:ex.x+ex.z*e,y:ex.y+ex.z*t}),eU=(0,y.useOfficePointed)(),eH=Math.min(1,Math.max(20/26,ex.z/.9)),eG=(ee?.tags??[]).map(t=>({tag:t,plate:function(e,t,n){switch(N(e,t).key){case"run":return{tone:"work",words:"working"};case"asking":case"paused":return{tone:"you",words:"needs you"};default:return t===e.office.coord&&z(e,n)?{tone:"report",words:"report ready"}:null}}(e,t.bot,J)})),{crowded:eK,onRoom:eX}=function(e,t){let a=(0,n.useRef)(new Map),r=(0,n.useCallback)((e,t)=>{a.current.set(e,t)},[]),[s,o]=(0,n.useState)([]),i=JSON.stringify([t,...e.map(e=>[e.bot,Math.round(e.home.x),Math.round(e.home.y),e.open,e.words])]);return(0,n.useLayoutEffect)(()=>{let n=(e,n,a,r)=>({bot:e,l:n-r*t/2,r:n+r*t/2,t:a-26*t,b:a}),r=(e,t)=>e.l<t.r+4&&t.l<e.r+4&&e.t<t.b+4&&t.t<e.b+4,s=e.filter(e=>e.open),i=s.flatMap(e=>{let t=a.current.get(e.bot);return t?[n(e.bot,e.home.x,e.home.y,t.mark)]:[]}),l=[],c=[];for(let e of s.sort((e,t)=>Number(t.first)-Number(e.first))){let t=a.current.get(e.bot);if(!t)continue;let s=n(e.bot,e.home.x,e.home.y,t.mark+t.rest);if(e.first){l.push(s);continue}[...i,...l].some(t=>t.bot!==e.bot&&r(s,t))?c.push(e.bot):l.push(s)}o(e=>e.length===c.length&&e.every(e=>c.includes(e))?e:c)},[i]),{crowded:s,onRoom:r}}(eG.flatMap(({tag:t,plate:n})=>{let a=t.walking?(t=>{let n=t===e.office.coord?v?.plan.own.seat:v?.plan.byBot.get(t)?.seat;if(!v||!n)return null;let[a,r]=v.fit.at(n[0],n[1],0);return eB(a,r-v.botSize-6)})(t.bot):eB(t.x,t.foot-(v?.botSize??0)-6);return a?[{bot:t.bot,home:a,open:null!==n,first:n?.tone==="you",words:n?.words??""}]:[]}),eH);return(0,t.jsx)("div",{ref:g,"data-room":!0,"data-building":$?void 0:"",onPointerDown:e=>{let t=e.target;if(!(0!==e.button||t.closest("button, a, [data-reads]"))){if(x){e$.current={x:e.clientX,y:e.clientY,from:ex,moved:!1,onPlate:!!t.closest("[data-plate]")};return}cancelAnimationFrame(eg.current),ej.current=null,e$.current={x:e.clientX,y:e.clientY,from:ex,moved:!1,onPlate:!!t.closest("[data-plate]")},e.currentTarget.setPointerCapture(e.pointerId)}},onPointerMove:e=>{let t=e$.current;if(!t||x)return;let n=e.clientX-t.x,a=e.clientY-t.y;!t.moved&&3>Math.hypot(n,a)||(t.moved=!0,eS(!0),ep({...t.from,x:t.from.x+n,y:t.from.y+a}))},onPointerUp:e_,onPointerCancel:e_,className:(0,en.cn)("relative select-none overflow-hidden",!x&&"touch-none",!x&&(ez?"cursor-grabbing":"cursor-grab"),m),children:v&&ee&&b&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"office-fade pointer-events-none absolute inset-0 [mask-composite:intersect] [mask-image:linear-gradient(to_right,transparent,#000_80px,#000_calc(100%-80px),transparent),linear-gradient(to_bottom,transparent,#000_60px,#000_calc(100%-60px),transparent)]",children:(0,t.jsx)("div",{className:"absolute top-0 left-0 origin-top-left",style:{width:b.w,height:b.h,transform:eE},children:(0,t.jsxs)("svg",{width:b.w,height:b.h,className:"overflow-visible","aria-hidden":!0,children:[(0,t.jsx)(ek,{}),(0,t.jsx)(eb,{stage:v,on:$&&"paused"===ea}),v.guides.map(e=>(0,t.jsx)("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,style:{stroke:e.color,strokeWidth:e.width,strokeLinecap:"round"}},e.id))]})})}),(0,t.jsxs)("div",{className:"absolute top-0 left-0 origin-top-left",style:{width:b.w,height:b.h,transform:eE},children:[!x&&(0,t.jsx)(eY,{stage:v,scene:e,sign:ea,start:a,label:r,faces:c}),(0,t.jsxs)("svg",{width:b.w,height:b.h,className:"overflow-visible",role:"img","aria-label":`The office for ${r}`,children:[(0,t.jsx)(ev,{}),(0,t.jsx)(ew,{stage:v}),(0,t.jsx)(eA,{stage:v,here:ee.here}),ee.shades.map(e=>(0,t.jsx)("polygon",{className:"office-drop",points:e.points,fill:"url(#office-hatch-shade)",style:{animationDelay:`${e.delay}ms`}},e.points)),(0,t.jsxs)("g",{className:"office-fade",style:{animationDelay:`${v.popAt}ms`},children:[(0,t.jsx)(eM,{links:ee.links}),ee.pins.map(e=>(0,t.jsx)(eC,{paper:e},e.id))]}),ee.tossed.map(e=>e.landed&&(0,t.jsx)(eD,{sheet:e},e.id)),ee.trail.map(e=>(0,t.jsx)("ellipse",{cx:e.x,cy:e.y,rx:3,ry:1.5,style:{fill:"var(--ink)",opacity:e.opacity}},e.id)),ee.sprites.map(e=>{let n;return"piece"===e.kind?(0,t.jsx)(eN,{piece:e.piece,draw:e.draw,awake:!e.piece.screen||ee.here.has(e.piece.screen.bot)},e.piece.id):"bot"===e.kind?(0,t.jsx)(eP,{walker:e.walker,face:(n=e.walker.bot,c.find(e=>e.name===n)),popAt:v.popAt},`bot-${e.walker.bot}`):(0,t.jsx)(eC,{paper:e.paper,land:v.popAt},e.paper.id)}),ee.tossed.map(e=>!e.landed&&(0,t.jsx)(eD,{sheet:e},e.id)),ee.flying.map(e=>(0,t.jsx)("g",{transform:`translate(${e.x} ${e.y}) rotate(${e.turn}) scale(${e.scale})`,children:(0,t.jsx)(eF,{dark:e.dark,ember:e.ember})},e.id))]}),!x&&(0,t.jsx)(em,{stage:v,sign:ea,land:$?0:v.popAt+250})]}),(0,t.jsxs)("div",{className:"office-fade pointer-events-none absolute inset-0",style:{animationDelay:`${v.popAt}ms`},children:[ee.stamp&&(0,t.jsx)(eL,{spot:eB(ee.stamp.x,ee.stamp.y),scale:ee.stamp.scale,text:ee.stamp.text}),eG.map(({tag:n,plate:a})=>(0,t.jsx)(eq,{plate:a,state:N(e,n.bot),crowded:eK.includes(n.bot),onRoom:eX,bot:n.bot,head:eB(n.x,n.head),foot:eB(n.x,n.foot).y,lift:n.carrying?32*ex.z:0,size:v.botSize*ex.z,width:b.w,hush:ee.hush,pointed:eU===n.bot,scale:eH,words:eI===n.bot?function(e,t,n){if(t===e.office.coord){let t=z(e,n);if(t)return{kind:"report",text:t.text}}let a=e.events.findLast(a=>a.from===t&&a.at<=n&&("return"===a.kind||"question"===a.kind&&"asking"===N(e,t).key));return a?{kind:"question"===a.kind?"question":"answer",text:a.text}:null}(e,n.bot,J):void 0,onPick:()=>{var e;eT({bot:eI===(e=n.bot)?null:e,report:eO}),u?.(e)}},n.bot))]}),!x&&(0,t.jsx)(ec,{label:r,bots:e.office.bots.length,files:"done"===e.office.status?eo.filter(eu):[],from:d,scene:e,sign:ea,onAnswer:f}),!x&&(0,t.jsxs)("div",{className:"absolute bottom-3.5 left-4 flex items-center gap-0.5 rounded-full bg-background p-0.75 shadow-sm ring-1 ring-border",children:[(0,t.jsx)(el,{label:"Zoom out",onClick:()=>{let e=ej.current??ex;eW(er(e,b.w/2,b.h/2,es(e.z,!1)))},children:(0,t.jsx)(o.Minus,{className:"size-3.5"})}),(0,t.jsxs)("span",{className:"min-w-11 text-center font-mono text-[11.5px] text-foreground/80 tabular-nums",children:[Math.round(100*ex.z),"%"]}),(0,t.jsx)(el,{label:"Zoom in",onClick:()=>{let e=ej.current??ex;eW(er(e,b.w/2,b.h/2,es(e.z,!0)))},children:(0,t.jsx)(i.Plus,{className:"size-3.5"})}),(0,t.jsx)("span",{className:"mx-0.5 h-4 w-px bg-border"}),(0,t.jsx)(el,{label:"Fit the office",onClick:()=>eW(null),children:(0,t.jsx)(s,{className:"size-3.5"})})]})]})})}function el({label:e,onClick:n,children:a}){return(0,t.jsx)("button",{type:"button","aria-label":e,title:e,onClick:n,className:"grid size-7.5 place-items-center rounded-full outline-none transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",children:a})}function ec({label:e,bots:a,files:r,from:s,scene:o,sign:i,onAnswer:l}){let c=(0,y.useOfficeCaption)(),[d,u]=(0,n.useState)(!1),f=r.length>4,p=d&&f,h=f&&!p?r.slice(0,3):r;return(0,t.jsxs)("div",{className:(0,en.cn)("pointer-events-none absolute left-6 flex max-w-[min(34rem,calc(100%-3rem))] animate-in flex-col gap-3 fade-in transition-[top] duration-300",c?"top-24":"top-5"),children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1",children:[(0,t.jsx)("h2",{className:"line-clamp-2 max-w-[28rem] text-balance font-semibold text-[22px] leading-tight tracking-tight",children:e}),(0,t.jsx)(eE,{scene:o,sign:i,onAnswer:l})]}),r.length>0&&(0,t.jsxs)("div",{className:"flex animate-in flex-col gap-2 fade-in slide-in-from-top-1 duration-300",children:[(0,t.jsxs)("span",{className:"font-mono text-[11.5px] text-muted-foreground tabular-nums",children:[a," ",1===a?"bot":"bots"," · ",r.length," ",1===r.length?"file":"files"]}),(0,t.jsxs)("div",{className:(0,en.cn)("pointer-events-auto flex flex-wrap gap-1.5",p&&"max-h-60 overflow-y-auto rounded-2xl bg-background/80 p-1.5 ring-1 ring-border scrollbar-none"),children:[h.map(e=>{let n=(0,J.fileIcon)(e);return(0,t.jsxs)(ee.FileLink,{path:e,from:s,className:"flex h-7 min-w-0 max-w-full items-center gap-1.5 rounded-full bg-background pr-3 pl-2.5 text-[12.5px] shadow-sm outline-none ring-1 ring-border transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(n,{className:"size-3.5 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:e.split("/").pop()})]},e)}),f&&(0,t.jsx)("button",{type:"button",onClick:()=>u(e=>!e),"aria-expanded":p,className:"flex h-7 items-center rounded-full bg-foreground/7 px-3 text-[12.5px] outline-none transition-colors hover:bg-foreground/12 focus-visible:ring-3 focus-visible:ring-ring/50",children:p?"Fewer":`+${r.length-3} more`})]})]})]})}let ed={a:"2.3,1.7 4,0 16,0 17.7,1.7 16,3.4 4,3.4",g:"2.3,18 4,16.3 16,16.3 17.7,18 16,19.7 4,19.7",d:"2.3,34.3 4,32.6 16,32.6 17.7,34.3 16,36 4,36",f:"1.7,2.3 3.4,4 3.4,15.7 1.7,17.4 0,15.7 0,4",e:"1.7,18.6 3.4,20.3 3.4,32 1.7,33.7 0,32 0,20.3",b:"18.3,2.3 20,4 20,15.7 18.3,17.4 16.6,15.7 16.6,4",c:"18.3,18.6 20,20.3 20,32 18.3,33.7 16.6,32 16.6,20.3"},eu=["abcdef","bc","abdeg","abcdg","bcfg","acdfg","acdefg","abc","abcdefg","abcdfg"];function ef({value:e,tall:n=41,lit:a="var(--ink)",unlit:r=eo(5.5)}){return(0,t.jsx)("svg",{width:23*n/41,height:n,viewBox:"-0.5 -0.5 21 37",className:"-skew-x-[7deg] overflow-visible","aria-hidden":!0,children:Object.keys(ed).map(n=>(0,t.jsx)("polygon",{points:ed[n],style:{fill:eu[e].includes(n)?a:r}},n))})}let ep=["first","second","third"],eh={done:150,paused:150,stopped:132,you:106},ex={work:"AT WORK",you:"YOUR TURN",paused:"PAUSED",stopped:"STOPPED",done:"DONE"};function em({stage:e,sign:n,land:a}){return(0,t.jsx)("div",{className:"office-fade pointer-events-none absolute top-0 left-0 origin-top-left",style:{width:700,height:280,transform:e.sign.matrix,animationDelay:`${e.popAt}ms`},children:(0,t.jsx)(ey,{sign:n,land:a})})}function ey({sign:e,land:a}){let[r,s]=(0,n.useState)(null),[o,i]=(0,n.useState)(e);return o!==e&&(s(o),i(e)),(0,n.useEffect)(()=>{if(null===r)return;let e=window.setTimeout(()=>s(null),800);return()=>window.clearTimeout(e)},[r]),(0,t.jsxs)(t.Fragment,{children:[null!==r&&(0,t.jsx)("div",{className:(0,en.cn)("absolute inset-0","work"===r?"origin-right animate-office-tape-out":"animate-office-sign-out"),children:(0,t.jsx)(eg,{sign:r,land:0})}),(0,t.jsx)("div",{className:(0,en.cn)("absolute inset-0",null!==r&&("done"===e?"animate-office-paint":"animate-in fade-in delay-200 duration-300 fill-mode-backwards")),children:(0,t.jsx)(eg,{sign:e,land:null!==r?0:a})},e)]})}function eg({sign:e,land:a}){let[r]=(0,n.useState)(a);return"work"===e?(0,t.jsxs)("div",{className:"absolute inset-x-0 top-5 flex h-27 items-center overflow-hidden pl-7 font-bold text-[64px] text-foreground/45 tracking-[0.2em]",children:[(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute inset-y-0 right-0 -left-[51px] animate-office-tape bg-[repeating-linear-gradient(-45deg,color-mix(in_oklab,var(--ink)_14%,transparent)_0_18px,transparent_18px_36px)] motion-reduce:animate-none"}),(0,t.jsx)("span",{className:"relative",children:ex.work})]}):(0,t.jsx)("div",{className:(0,en.cn)("absolute top-4.5 left-6 flex animate-office-sign flex-col gap-2.5 whitespace-nowrap motion-reduce:animate-none","done"===e&&"text-foreground/82",("you"===e||"paused"===e)&&"text-waiting/85","stopped"===e&&"text-foreground/40"),style:{animationDelay:`${r}ms`},children:(0,t.jsx)("span",{className:"font-extrabold leading-[0.9] tracking-[0.02em]",style:{fontSize:eh[e]},children:ex[e]})})}function eb({stage:e,on:n}){let{matrix:a,w:r,d:s}=e.ground;return(0,t.jsxs)("g",{transform:a,style:{opacity:+!!n,transition:"opacity 1.2s ease"},children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("radialGradient",{id:"office-alarm",children:[(0,t.jsx)("stop",{offset:"0",style:{stopColor:"var(--destructive)",stopOpacity:.12}}),(0,t.jsx)("stop",{offset:"0.55",style:{stopColor:"var(--destructive)",stopOpacity:.07}}),(0,t.jsx)("stop",{offset:"1",style:{stopColor:"var(--destructive)",stopOpacity:0}})]})}),(0,t.jsx)("ellipse",{cx:r/2,cy:s/2,rx:r/2+100,ry:s/2+100,fill:"url(#office-alarm)"})]})}function ek(){let e=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("stop",{offset:"0",style:{stopColor:"var(--ink)",stopOpacity:0}}),(0,t.jsx)("stop",{offset:"0.3",style:{stopColor:"var(--ink)",stopOpacity:.2}}),(0,t.jsx)("stop",{offset:"0.7",style:{stopColor:"var(--ink)",stopOpacity:.2}}),(0,t.jsx)("stop",{offset:"1",style:{stopColor:"var(--ink)",stopOpacity:0}})]});return(0,t.jsxs)("defs",{children:[(0,t.jsx)("linearGradient",{id:"office-fade-x",x1:"0",y1:"0",x2:"1",y2:"1",children:e}),(0,t.jsx)("linearGradient",{id:"office-fade-y",x1:"1",y1:"0",x2:"0",y2:"1",children:e})]})}function ev(){let e=(e,n,a,r)=>(0,t.jsx)("pattern",{id:e,width:n,height:n,patternUnits:"userSpaceOnUse",patternTransform:`rotate(${a})`,children:(0,t.jsx)("line",{x1:"0",y1:"0",x2:"0",y2:n,style:{stroke:eo(r),strokeWidth:.8}})}),n=(e,n,a)=>(0,t.jsxs)("linearGradient",{id:e,x1:"0.1",y1:"0",x2:"0.9",y2:"1",children:[(0,t.jsx)("stop",{offset:"0",style:{stopColor:n}}),(0,t.jsx)("stop",{offset:"1",style:{stopColor:a}})]});return(0,t.jsxs)("defs",{children:[e("office-hatch-side",3.4,-38,20),e("office-hatch-shade",3,28,30),e("office-hatch-soft",3.2,28,14),n("office-floor-own","var(--gray-25)","var(--gray-100)"),n("office-floor-lobby","var(--gray-50)","var(--gray-150)"),n("office-floor-work","var(--gray-0)","var(--gray-75)")]})}let ew=(0,n.memo)(function({stage:e}){return(0,t.jsxs)(t.Fragment,{children:[e.faces.map(e=>(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)("polygon",{className:"office-drop",points:e.points,style:{fill:e.fill,animationDelay:`${e.delay}ms`}}),e.hatch&&(0,t.jsx)("polygon",{className:"office-drop",points:e.points,fill:"url(#office-hatch-side)",style:{animationDelay:`${e.delay}ms`}})]},e.id)),e.lines.map(e=>(0,t.jsx)(ej,{line:e,className:"office-drop",style:{animationDelay:`${e.delay}ms`}},e.id))]})});function ej({line:e,className:n,style:a}){return(0,t.jsx)("line",{className:n,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,style:{stroke:e.color,strokeWidth:e.width,strokeLinecap:"round",...a}})}function eM({links:e}){return(0,t.jsx)(t.Fragment,{children:e.map(e=>{let n=(e.x1+e.x2)/2,a=(e.y1+e.y2)/2+.12*Math.abs(e.x2-e.x1)+6;return(0,t.jsxs)("g",{opacity:e.opacity,children:[(0,t.jsx)("path",{d:`M${e.x1} ${e.y1} Q${n} ${a} ${e.x2} ${e.y2}`,style:{fill:"none",stroke:eo(42),strokeWidth:1.3,strokeDasharray:"3 3.5",strokeLinecap:"round"}}),(0,t.jsx)("circle",{cx:e.x2,cy:e.y2,r:2.6,style:{fill:eo(55)}})]},e.id)})})}let e$=e=>e<=0?0:e>=1?1:1-(1-e)**3,eN=(0,n.memo)(function({piece:e,draw:a,awake:r=!0}){let s=a<1;return(0,t.jsxs)("g",{className:"office-drop",style:{animationDelay:`${e.delay}ms`},children:[(0,t.jsx)("g",{opacity:s?e$((a-.35)/.65):1,children:e.faces.map(e=>(0,t.jsxs)(n.Fragment,{children:[(0,t.jsx)("polygon",{points:e.points,style:{fill:e.fill}}),e.hatch&&(0,t.jsx)("polygon",{points:e.points,fill:"url(#office-hatch-side)"})]},e.id))}),e.edges.map(e=>(0,t.jsx)(ej,{line:e,style:s?{strokeDasharray:`${e.length} ${e.length}`,strokeDashoffset:e.length*(1-e$(a))}:void 0},e.id)),(!s||a>.7)&&(0,t.jsxs)(t.Fragment,{children:[e.mugs.map(e=>(0,t.jsx)(eO,{mug:e},`${e.cx},${e.cy}`)),e.screen&&(0,t.jsx)(eS,{screen:e.screen,awake:r}),e.check&&(0,t.jsx)("polyline",{points:e.check,style:{fill:"none",stroke:"var(--ink)",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"}})]})]})}),ez=[.5,.95,1.4,1.85,2.3,2.75,3.2,3.65,4.1,4.55];function eS({screen:e,awake:a}){let{w:r,h:s}=e,o=a||"lit"!==e.mode?e.mode:"dim",i=(0,n.useId)();return(0,t.jsxs)("g",{transform:e.matrix,children:[(0,t.jsx)("defs",{children:(0,t.jsx)("clipPath",{id:i,clipPathUnits:"userSpaceOnUse",children:(0,t.jsx)("rect",{x:0,y:0,width:r,height:s})})}),(0,t.jsx)("rect",{x:0,y:0,width:r,height:s,rx:.15,style:{fill:"lit"===o?"var(--office-screen-lit)":"dim"===o||"asking"===o?"var(--office-screen-dim)":"var(--office-screen-dark)"}}),"lit"===o&&(0,t.jsx)("g",{clipPath:`url(#${i})`,children:(0,t.jsx)("g",{className:"animate-office-screen",children:ez.map((e,n)=>(0,t.jsx)("line",{x1:.55,y1:e,x2:r*(n%3==2?.45:n%2?.7:.85),y2:e,style:{stroke:"var(--office-screen-line)",strokeWidth:.26,strokeLinecap:"round"}},e))})}),"dim"===o&&[.7,1.2].map((e,n)=>(0,t.jsx)("line",{x1:.55,y1:e,x2:r*(n?.4:.65),y2:e,style:{stroke:"color-mix(in oklab, var(--office-screen-lit) 35%, transparent)",strokeWidth:.2,strokeLinecap:"round"}},e)),"paused"===o&&(0,t.jsxs)("g",{style:{fill:"var(--waiting)"},children:[(0,t.jsx)("rect",{x:r/2-.55,y:s/2-.7,width:.36,height:1.4,rx:.12}),(0,t.jsx)("rect",{x:r/2+.19,y:s/2-.7,width:.36,height:1.4,rx:.12})]}),"asking"===o&&(0,t.jsx)("circle",{cx:r/2,cy:s/2,r:.55,style:{fill:"var(--waiting)"}})]})}function eA({stage:e,here:a}){let r=(0,n.useId)(),s=e.pools.filter(e=>a.has(e.bot));return s.length?(0,t.jsxs)("g",{transform:e.floor,children:[(0,t.jsx)("defs",{children:(0,t.jsxs)("radialGradient",{id:r,children:[(0,t.jsx)("stop",{offset:"0",style:{stopColor:"var(--ink)",stopOpacity:.16}}),(0,t.jsx)("stop",{offset:"0.6",style:{stopColor:"var(--ink)",stopOpacity:.08}}),(0,t.jsx)("stop",{offset:"1",style:{stopColor:"var(--ink)",stopOpacity:0}})]})}),s.map(n=>(0,t.jsx)("ellipse",{className:"office-fade",cx:n.cx,cy:n.cy,rx:n.r,ry:n.r,fill:`url(#${r})`,style:{animationDelay:`${e.popAt}ms`}},n.id))]}):null}function eO({mug:e}){let n={stroke:eo(60),strokeWidth:1};return(0,t.jsxs)("g",{children:[(0,t.jsx)("ellipse",{cx:e.bx,cy:e.by,rx:e.rx,ry:e.ry,style:{fill:"var(--gray-50)",...n}}),(0,t.jsx)("rect",{x:e.cx-e.rx,y:e.cy,width:2*e.rx,height:Math.max(0,e.by-e.cy),style:{fill:"var(--gray-50)"}}),(0,t.jsx)("line",{x1:e.cx-e.rx,y1:e.cy,x2:e.bx-e.rx,y2:e.by,style:n}),(0,t.jsx)("line",{x1:e.cx+e.rx,y1:e.cy,x2:e.bx+e.rx,y2:e.by,style:n}),(0,t.jsx)("ellipse",{cx:e.cx,cy:e.cy,rx:e.rx,ry:e.ry,style:{fill:"var(--gray-0)",...n}})]})}function eC({paper:e,land:n}){return(0,t.jsxs)("g",{opacity:e.opacity,className:void 0===n?void 0:"office-fade",style:void 0===n?void 0:{animationDelay:`${n}ms`},children:[(0,t.jsx)("polygon",{points:e.points,style:{fill:e.dark?"var(--ink)":"var(--gray-0)",stroke:e.ember?"var(--waiting)":e.dark?"var(--ink)":eo(50),strokeWidth:e.ember?1.6:1,strokeLinejoin:"round"}}),e.lines.map(n=>(0,t.jsx)("polyline",{points:n,style:{fill:"none",stroke:e.dark?"color-mix(in oklab, var(--gray-0) 55%, transparent)":eo(32),strokeWidth:1.2,strokeLinecap:"round"}},n))]})}function eD({sheet:e}){return(0,t.jsxs)("g",{transform:`${e.plane} rotate(${e.turn}) scale(${e.face} 1)`,opacity:e.opacity,children:[(0,t.jsx)("rect",{x:-7,y:-9,width:14,height:18,rx:1.6,style:{fill:e.dark?"var(--ink)":"var(--gray-0)",stroke:e.dark?"var(--ink)":eo(45),strokeWidth:.8}}),e.face>0&&[-5,-2,1].map((n,a)=>(0,t.jsx)("rect",{x:-4.5,y:n,width:2===a?5:9,height:1.4,style:{fill:e.dark?"color-mix(in oklab, var(--gray-0) 55%, transparent)":eo(32)}},n))]})}function eP({walker:e,face:n,popAt:a}){let{x:r,y:s,hop:o,tilt:i,spin:l,squash:c,scale:d,size:f,opacity:p}=e;return(0,t.jsxs)("g",{className:"office-fade",style:{animationDelay:`${a}ms`},children:[(0,t.jsx)("ellipse",{cx:r,cy:s,rx:Math.max(1,.27*f-Math.min(.5*o,.15*f)),ry:Math.max(1,.1*f-Math.min(.2*o,.05*f)),fill:"url(#office-hatch-shade)",opacity:p}),(0,t.jsx)("g",{transform:`translate(${r} ${s-o}) rotate(${i}) scale(${d*(1+.6*c)} ${d*(1-c)}) translate(0 ${-f/2}) rotate(${l}) translate(${-f/2} ${-f/2})`,opacity:p,children:(0,t.jsx)("g",{className:"office-pop",style:{animationDelay:`${a}ms`},children:(0,t.jsx)("g",{className:(0,en.cn)("origin-bottom [transform-box:fill-box]",e.working&&"animate-office-work motion-reduce:animate-none"),children:(0,t.jsx)(u.BotMark,{size:f,seed:e.bot,...(0,u.iconProps)(n?.icon),state:e.working?"thinking":"idle",gazeX:e.gaze[0],gazeY:e.gaze[1],crossed:e.crossed,notify:!1})})})}),e.carry&&(0,t.jsx)("g",{transform:e.lag?`translate(${r+.1*f+.8*e.lag[0]} ${s-.6*o-f-16+.4*e.lag[1]}) rotate(${e.lag[2]-4})`:`translate(${r+.1*f} ${s-o-f-16}) rotate(${-(1.4*i)-4})`,children:(0,t.jsx)(eF,{...e.carry})})]})}function eF({dark:e,ember:n,stamp:a=!1}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("rect",{x:-11,y:-14,width:22,height:28,rx:2.5,style:{fill:e?"var(--ink)":"var(--gray-0)",stroke:n?"var(--waiting)":e?"var(--ink)":eo(45),strokeWidth:1.3}}),[-8,-3.5,1].map((n,a)=>(0,t.jsx)("rect",{x:-6.5,y:n,width:2===a?7.5:13,height:2,style:{fill:e?"color-mix(in oklab, var(--gray-0) 55%, transparent)":eo(32)}},n)),a&&(0,t.jsx)("rect",{x:-8.5,y:3.5,width:15,height:7,rx:1.5,transform:"rotate(-14)",style:{fill:"none",stroke:"var(--destructive)",strokeWidth:1.5}})]})}function eL({spot:e,scale:n,text:a}){return(0,t.jsxs)("div",{className:"absolute flex items-center gap-2",style:{left:e.x+30,top:e.y-8},children:[(0,t.jsx)("div",{className:"relative h-9.5 w-7.5 shrink-0 -rotate-5 rounded-[3px] border border-foreground/30 bg-background",children:(0,t.jsx)("span",{className:"absolute top-3.5 -left-0.5 rounded-[3px] border-2 border-destructive bg-background/90 px-0.75 font-semibold text-[10.5px] text-destructive",style:{transform:`rotate(-14deg) scale(${n})`},children:"Refused"})}),(0,t.jsx)("span",{className:"line-clamp-3 w-48 rounded-lg border border-border bg-background/95 px-2 py-1 text-[11.5px] text-foreground/80 leading-snug",children:a})]})}function eq({plate:e,state:a,crowded:r,onRoom:s,bot:o,head:i,foot:l,lift:c,size:u,width:f,hush:p,words:h,pointed:x,scale:m,onPick:g}){let b=i.y-6-c,k=(null===e||r)&&!x,v=(0,n.useRef)(null),w=(0,n.useRef)(null),[j,M]=(0,n.useState)(null),$=`${a.key} ${e?.tone??""} ${e?.words??""}`,N=void 0!==h;(0,n.useLayoutEffect)(()=>{if(!v.current||!w.current)return;let e=0;for(let t of v.current.querySelectorAll("[data-unfold]"))e+=t.scrollWidth;let t={mark:w.current.offsetWidth+17,rest:e};s(o,t),M(e=>e&&e.mark===t.mark&&e.rest===t.rest?e:t)},[o,$,N,s]);let z=j?j.mark+j.rest:0,S=j?i.x+z/2>f-12?{right:-j.mark/2}:i.x-z/2<12?{left:-j.mark/2}:null:null;return(0,t.jsxs)("div",{"data-plate":!0,onPointerEnter:()=>y.officePointed.set(o),onPointerLeave:()=>y.officePointed.set(null),className:(0,en.cn)("group/plate absolute size-0 transition-opacity duration-500",void 0!==h?"z-40":e?.tone==="you"?"z-31":x?"z-30":k?"z-10 hover:z-30 has-[:focus-visible]:z-30":"z-20 hover:z-30 has-[:focus-visible]:z-30",p&&"opacity-15"),style:{left:i.x,top:b},children:[(0,t.jsx)("button",{type:"button",tabIndex:-1,"aria-hidden":!0,onClick:g,className:"pointer-events-auto absolute top-1 cursor-pointer",style:{left:-(.4*u),width:.8*u,height:Math.max(12,l-b-4)}}),void 0!==h&&(0,t.jsx)(eT,{words:h,state:a,bot:o,top:b,x:i.x,width:f,below:l-b,size:u,onPick:g}),(0,t.jsxs)("div",{ref:v,hidden:N,style:{...S,scale:1===m?void 0:String(m),transformOrigin:`${S?.right!==void 0?"100%":S?.left!==void 0?"0%":"50%"} 100%`},className:(0,en.cn)("pointer-events-auto absolute bottom-0 flex h-6.5 items-center whitespace-nowrap rounded-full bg-background pr-2.25 text-[12px] transition-opacity duration-120",!S&&"left-0 -translate-x-1/2",e?.tone==="you"?"ring-[1.5px] ring-waiting":"ring-[0.75px] ring-foreground/25",e&&"animate-office-plate",null===e&&!x&&"opacity-0 group-hover/plate:opacity-100 group-has-[:focus-visible]/plate:opacity-100"),children:[e?.tone==="you"&&(0,t.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 animate-office-ask rounded-full"}),(0,t.jsxs)("button",{type:"button",onClick:g,"aria-label":`${o} \xb7 ${a.label}`,className:"flex h-full items-center rounded-full pl-2 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)("span",{ref:w,className:"flex shrink-0 items-center",children:(0,t.jsx)(e_,{state:a.key})}),(0,t.jsx)(eI,{open:!k,children:(0,t.jsx)("span",{className:"font-semibold",children:o})}),e&&(0,t.jsx)(eI,{open:!k,children:"work"===e.tone?(0,t.jsx)(d.ShinyText,{text:e.words}):(0,t.jsx)("span",{className:"you"===e.tone?"text-waiting":"text-muted-foreground",children:e.words})})]})]},e?.tone??"none")]})}let eR={report:"Report",question:"Asks you",answer:"Answer"};function eT({words:e,state:a,bot:r,top:s,x:o,width:i,below:l,size:d,onPick:u}){let f=(0,n.useRef)(null),[p,h]=(0,n.useState)(0),x=`${a.label} ${e?.kind??""} ${e?.text??""}`;(0,n.useLayoutEffect)(()=>{let e=f.current?.offsetHeight??0;h(t=>t===e?t:e)},[x]);let m=e?.kind==="report",y=m||p>0&&s-p<8,g=e?.kind==="question";return(0,t.jsxs)("div",{ref:f,"data-reads":!0,style:m?{left:Math.min(Math.max(-300+.35*d,12-o),i-12-300-o),top:l+10,width:300}:{left:Math.min(Math.max(-150,12-o),i-12-300-o),width:300,...y?{top:-26}:{bottom:0}},className:(0,en.cn)("pointer-events-auto absolute flex cursor-auto select-text flex-col rounded-2xl bg-background shadow-lg",y?"animate-office-card-down":"animate-office-card-up",g?"ring-[1.5px] ring-waiting":"ring-1 ring-border"),children:[(0,t.jsxs)("button",{type:"button",onClick:u,"aria-expanded":!0,"aria-label":`${r} \xb7 ${a.label}`,className:"flex h-8 shrink-0 items-center gap-1.5 rounded-t-2xl px-3 text-left text-[12px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(e_,{state:a.key}),(0,t.jsx)("span",{className:"font-semibold",children:r}),(0,t.jsx)("span",{className:g?"text-waiting":"text-muted-foreground",children:e?eR[e.kind]:a.label})]}),e&&(0,t.jsx)("div",{className:"max-h-56 overflow-y-auto overscroll-contain px-3 pb-4 [mask-image:linear-gradient(to_bottom,#000_calc(100%-14px),transparent)]",children:(0,t.jsx)(c.Markdown,{className:"min-w-0 text-[12.5px] leading-relaxed wrap-anywhere break-keep [&_h1]:text-[14px] [&_h2]:text-[13.5px] [&_h3]:text-[13px] [&_li]:my-0.5 [&_table]:text-[11.5px] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:e.text})})]})}function eI({open:e,children:n}){return(0,t.jsx)("span",{className:(0,en.cn)("flex overflow-hidden transition-[max-width,opacity] duration-200 ease-out motion-reduce:transition-none",e?"max-w-80 opacity-100":"max-w-0 opacity-0 group-hover/plate:max-w-80 group-hover/plate:opacity-100 group-has-[:focus-visible]/plate:max-w-80 group-has-[:focus-visible]/plate:opacity-100"),children:(0,t.jsx)("span",{"data-unfold":!0,className:"flex shrink-0 items-center pl-1.5",children:n})})}function e_({state:e}){switch(e){case"run":return(0,t.jsx)("span",{className:"size-1.75 shrink-0 animate-pulse rounded-full bg-foreground motion-reduce:animate-none"});case"asking":return(0,t.jsx)("span",{className:"size-1.75 shrink-0 rounded-full bg-waiting"});case"paused":return(0,t.jsxs)("span",{className:"flex h-2 shrink-0 gap-0.5","aria-hidden":!0,children:[(0,t.jsx)("span",{className:"w-0.5 rounded-full bg-waiting"}),(0,t.jsx)("span",{className:"w-0.5 rounded-full bg-waiting"})]});case"ended":return(0,t.jsx)("span",{className:"size-1.5 shrink-0 rounded-full border-[1.5px] border-muted-foreground"});case"held":return(0,t.jsx)("svg",{width:8,height:11,viewBox:"0 0 12 14","aria-hidden":!0,className:"shrink-0",children:(0,t.jsx)("path",{d:"M1.5 1h9M1.5 13h9M2.5 1c0 3.5 3.5 4.5 3.5 6S2.5 9.5 2.5 13M9.5 1c0 3.5-3.5 4.5-3.5 6s3.5 2.5 3.5 6",style:{fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}})});case"done":return(0,t.jsx)("svg",{width:10,height:8,viewBox:"0 0 11 9","aria-hidden":!0,className:"office-check shrink-0",children:(0,t.jsx)("path",{d:"M1 4.5l3 3L10 1.5",style:{fill:"none",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round",strokeLinejoin:"round"}})});case"stopped":return(0,t.jsx)("span",{className:"size-1.75 shrink-0 rounded-xs bg-muted-foreground"});case"none":return(0,t.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-muted-foreground"})}}let eW={work:"run",you:"asking",paused:"paused",stopped:"stopped",done:"done"};function eE({scene:e,sign:n,onAnswer:a}){let r,{called:s,back:o}={called:(r=e.office.bots.filter(t=>t!==e.office.coord&&"none"!==N(e,t).key)).length,back:r.filter(t=>"done"===N(e,t).key).length},i=e.office.bots.find(t=>"asking"===N(e,t).key),l={work:s?`At work \xb7 ${o} of ${s} back`:"At work",you:`Your turn — ${i??"a bot"} asks`,paused:"Paused — waiting on Continue",stopped:"Stopped",done:"Done"}[n],c="you"===n||"paused"===n,d=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:(0,en.cn)("flex w-3 justify-center",!c&&"text-muted-foreground"),children:(0,t.jsx)(e_,{state:eW[n]})}),l]});return c&&a?(0,t.jsx)("button",{type:"button",onClick:a,className:"pointer-events-auto flex items-center gap-1.5 text-[15px] text-waiting underline-offset-4 outline-none hover:underline focus-visible:underline",children:d}):(0,t.jsx)("span",{className:(0,en.cn)("flex items-center gap-1.5 text-[15px]",c?"text-waiting":"stopped"===n?"text-muted-foreground":"text-foreground/70"),children:d})}function eB({seconds:e,tall:a}){let r,s,o,i=Math.min(359999,Math.max(0,Math.floor(e))),l=Math.floor(i/3600),c=[...l?[l]:[],Math.floor(i/60)%(l?60:100),i%60],d=Math.max(3,Math.round(a/10));return(0,t.jsx)("div",{role:"img","aria-label":`Running for ${(r=Math.max(0,Math.floor(e)),s=e=>String(e).padStart(2,"0"),(o=Math.floor(r/3600))?`${o}:${s(Math.floor(r/60)%60)}:${s(r%60)}`:`${Math.floor(r/60)}:${s(r%60)}`)}`,className:"flex items-center",style:{gap:a/8},children:c.map((e,r)=>(0,t.jsxs)(n.Fragment,{children:[r>0&&(0,t.jsxs)("span",{className:"flex flex-col",style:{gap:a/3.2},children:[(0,t.jsx)("span",{className:"rounded-[1px] bg-current",style:{width:d,height:d}}),(0,t.jsx)("span",{className:"rounded-[1px] bg-current",style:{width:d,height:d}})]}),(r>0||e>=10)&&(0,t.jsx)(ef,{value:Math.floor(e/10),tall:a,lit:"currentColor",unlit:eo(4)}),(0,t.jsx)(ef,{value:e%10,tall:a,lit:"currentColor",unlit:eo(4)})]},ep[r]))})}function eU({bot:e,icon:a,size:r}){let s=(0,n.useMemo)(()=>(0,f.markStill)(e,a??null),[e,a]),o=(0,n.useId)(),i=s.paint?`url(#${o})`:s.ink;return(0,t.jsxs)("svg",{width:r,height:r,viewBox:"0 0 240 240","aria-hidden":!0,className:"shrink-0",children:[s.paint&&(0,t.jsx)("defs",{children:(0,t.jsx)("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:s.paint.map((e,n,a)=>(0,t.jsx)("stop",{offset:n/Math.max(1,a.length-1),style:{stopColor:e}},`${e}-${n/Math.max(1,a.length-1)}`))})}),(0,t.jsx)("path",{d:s.head,style:s.outline?{fill:"none",stroke:i,strokeWidth:14}:{fill:i}}),s.eyes.map(e=>(0,t.jsx)("path",{d:e,style:{fill:s.outline?i:"var(--background)"}},e))]})}function eY({stage:e,scene:a,sign:r,start:s,label:o,faces:i}){let l=function(e,t){let[a,r]=(0,n.useState)(()=>Date.now());return(0,n.useEffect)(()=>{if(null!==t)return;let e=window.setInterval(()=>r(Date.now()),1e3);return()=>window.clearInterval(e)},[t]),t??(a-e)/1e3}(s,a.ended),c=a.office.bots.map((e,t)=>({bot:e,order:t,steps:a.office.steps.get(e)??0})).sort((e,t)=>t.steps-e.steps||e.order-t.order).slice(0,8);return(0,t.jsxs)("div",{className:"office-fade pointer-events-none absolute top-0 left-0 origin-top-left",style:{width:e.board.w,height:e.board.h,transform:e.board.matrix,animationDelay:`${e.popAt}ms`},children:[(0,t.jsxs)("div",{className:"absolute inset-x-0 top-0 flex h-85 border-2 border-foreground/30 bg-background/70 text-foreground/40",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col justify-between px-9 pt-7 pb-8",children:[(0,t.jsxs)("div",{"aria-hidden":!0,className:"flex items-baseline justify-between gap-6 font-semibold text-[26px] uppercase tracking-[0.18em]",children:[(0,t.jsx)("span",{className:"truncate",children:o}),(0,t.jsx)("span",{className:"shrink-0",children:ex[r]})]}),(0,t.jsx)("div",{className:"text-foreground/85",children:(0,t.jsx)(eB,{seconds:l,tall:170})})]}),(0,t.jsxs)("div",{"aria-hidden":!0,className:"flex w-105 shrink-0 flex-col gap-1 border-foreground/30 border-l-2 px-7 pt-6",children:[(0,t.jsxs)("span",{className:"mb-1 flex justify-between font-mono text-[19px] uppercase tracking-[0.2em]",children:[(0,t.jsx)("span",{children:"Crew"}),(0,t.jsx)("span",{children:"Steps"})]}),c.map(({bot:e,steps:n},r)=>(0,t.jsxs)("div",{className:"flex h-7 items-center gap-3 text-[22px]",children:[(0,t.jsx)("span",{className:"w-5 font-mono text-[18px]",children:r+1}),(0,t.jsx)(eU,{bot:e,icon:i.find(t=>t.name===e)?.icon,size:24}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground/65",children:e}),(0,t.jsx)("span",{className:"flex w-3 justify-center",children:(0,t.jsx)(e_,{state:N(a,e).key})}),(0,t.jsx)("span",{className:"w-10 text-right font-mono text-foreground/65 tabular-nums",children:n})]},e))]})]}),(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute top-85 left-24 h-40 w-0.5 bg-foreground/30"}),(0,t.jsx)("span",{"aria-hidden":!0,className:"absolute top-85 right-24 h-40 w-0.5 bg-foreground/30"})]})}let eH={yaw:20,pitch:40};function eG({thread:e,onBot:a,onAnswer:r,camera:s}){let o=(0,x.toDate)(e.createdAt).getTime(),i=(0,n.useMemo)(()=>k(e),[e]),l=function(e,t){let[a,r]=(0,n.useState)(()=>({office:e,memory:v(null,e,(Date.now()-t)/1e3)}));if(a.office===e)return a.memory;let s={office:e,memory:v(a.memory,e,(Date.now()-t)/1e3)};return r(s),s.memory}(i,o),c=(0,n.useMemo)(()=>w(i,l),[i,l]);return(0,t.jsx)(ee.FileViewer,{children:(0,t.jsx)(ei,{scene:c,start:o,label:e.label,faces:e.roster,from:e.id,onBot:a,onAnswer:r,camera:s,className:"min-h-0 min-w-0 flex-1"})})}e.s(["BotDesk",0,function({bot:e,thread:a,className:r}){let s=a?k(a).seats.get(e.name)?.key??"none":"none",[o]=(0,n.useState)(()=>Date.now()),i=(0,n.useMemo)(()=>{let t={coord:e.name,bots:[e.name],events:[],seats:new Map([[e.name,{key:s,waits:[],since:null}]]),owed:new Map,states:new Map,starts:new Map,asking:new Set,span:0,steps:new Map,status:a?.status??"done",seen:!0};return w(t,v(null,t,0))},[e.name,s,a?.status]);return(0,t.jsx)("div",{className:(0,en.cn)("flex",r),children:(0,t.jsx)(ei,{scene:i,start:o,label:a?.label??e.name,faces:[e],from:a?.id??"",camera:eH,desk:!0,className:"min-h-0 min-w-0 flex-1"})})},"OfficeBackdrop",0,function({thread:e,leaving:a=!1,onBot:r,onAnswer:s,camera:o,className:i}){let[l,c]=(0,n.useState)(null),[d,u]=(0,n.useState)(e);return d.id!==e.id?(c(d),u(e)):d!==e&&u(e),(0,n.useEffect)(()=>{if(!l)return;let e=window.setTimeout(()=>c(null),440);return()=>window.clearTimeout(e)},[l]),(0,t.jsx)("div",{inert:a,className:(0,en.cn)("flex animate-in fade-in duration-300",i,a&&"pointer-events-none opacity-0 transition-opacity duration-250 ease-in"),children:(0,t.jsx)("div",{className:"relative flex min-h-0 min-w-0 flex-1",children:(l?[l,e]:[e]).map(e=>e===l?(0,t.jsx)("div",{inert:!0,className:"pointer-events-none absolute inset-0 flex animate-office-sink",children:(0,t.jsx)(eG,{thread:e,camera:o})},e.id):(0,t.jsx)("div",{className:(0,en.cn)("flex min-h-0 min-w-0 flex-1",l&&"animate-office-rise"),children:(0,t.jsx)(eG,{thread:e,onBot:r,onAnswer:s,camera:o})},e.id))})})}],532965)},590714,function(e){e.n(e.i(532965))}]);