thursday-agent 0.17.2 → 0.19.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.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +4 -2
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +28 -12
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +12 -12
- package/.next/server/app/_not-found.segments/_full.segment.rsc +12 -12
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +11 -11
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/artifact/route.js +7 -7
- package/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/files/route.js +4 -4
- package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/route.js +4 -4
- package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/route.js +4 -4
- package/.next/server/app/api/bot/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/[id]/route.js +1 -1
- package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/file/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/bot/thread/file/route.js +29 -0
- package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -0
- package/.next/server/app/api/bot/thread/file/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/bot/thread/route.js +1 -1
- package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js +1 -1
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/events/route.js +2 -2
- package/.next/server/app/api/events/route.js.nft.json +1 -1
- package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
- package/.next/server/app/api/file/[...path]/route.js +4 -4
- package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/automatic/route.js +3 -3
- package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/catalog/[provider]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/llm-model/catalog/{route.js → [provider]/route.js} +8 -8
- package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -0
- package/.next/server/app/api/llm-model/catalog/[provider]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/llm-model/credits/[provider]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/llm-model/credits/[provider]/route/build-manifest.json +12 -0
- package/.next/server/app/api/llm-model/credits/[provider]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/llm-model/credits/{route.js → [provider]/route.js} +8 -8
- package/.next/server/app/api/llm-model/credits/[provider]/route.js.map +5 -0
- package/.next/server/app/api/llm-model/credits/[provider]/route.js.nft.json +1 -0
- package/.next/server/app/api/llm-model/credits/[provider]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/llm-model/route.js +1 -1
- package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/subscription/route.js +1 -1
- package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/[name]/route.js +1 -1
- package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/oauth/callback/route.js +2 -2
- package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/route.js +1 -1
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/tools/route.js +1 -1
- package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/edit/route.js +12 -12
- package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/route.js +1 -1
- package/.next/server/app/api/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/reach/route.js +17 -17
- package/.next/server/app/api/reach/route.js.nft.json +1 -1
- package/.next/server/app/api/routine/route.js +6 -6
- package/.next/server/app/api/routine/route.js.nft.json +1 -1
- package/.next/server/app/api/running/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/running/route/build-manifest.json +12 -0
- package/.next/server/app/api/running/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/running/route.js +10 -0
- package/.next/server/app/api/running/route.js.map +5 -0
- package/.next/server/app/api/running/route.js.nft.json +1 -0
- package/.next/server/app/api/running/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/signins/route.js +4 -4
- package/.next/server/app/api/signins/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/[source]/[name]/route.js +7 -7
- package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +6 -6
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/end/route.js +1 -1
- package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/route.js +1 -1
- package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/settings/route.js +1 -1
- package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/text/route.js +12 -12
- package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/tool-call/route.js +13 -13
- package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/files/route.js +7 -7
- package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/route.js +6 -6
- package/.next/server/app/api/workspace/route.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +94 -6
- package/.next/server/app/artifact/[...path]/page.js +9 -5
- package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next/server/app/page/server-reference-manifest.json +161 -128
- package/.next/server/app/page.js +10 -9
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +4 -2
- package/.next/server/chunks/[root-of-the-server]__00qyw01._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__02ra64t._.js +5 -0
- package/.next/server/chunks/{[root-of-the-server]__05dp5tr._.js → [root-of-the-server]__06ky9of._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0b565-x._.js +7 -0
- package/.next/server/chunks/[root-of-the-server]__0bmtib_._.js +7 -0
- package/.next/server/chunks/[root-of-the-server]__0bqveex._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0brmiv2._.js +7 -0
- package/.next/server/chunks/[root-of-the-server]__0eivkvk._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0f7m79q._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0g38-aj._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0gvdr2h._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0h656y-._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0hm3tiq._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0hzdqnv._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0kzmxpg._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0mgyt8p._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0mrk2it._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0o5s5-o._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0p80i1n._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0qdoc_9._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0qzho69._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0sm5xvm._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0v_kuor._.js +5 -0
- package/.next/server/chunks/{[root-of-the-server]__061o2_x._.js → [root-of-the-server]__0ypkfbu._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1-18_pz._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__01k3vi3._.js → [root-of-the-server]__14iga7p._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__16gn7zn._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__18e65_-._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1_cgawk._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1ceammd._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1ckt1yj._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1cu5f3z._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1dth047._.js +5 -0
- package/.next/server/chunks/{[root-of-the-server]__1k2qs1m._.js → [root-of-the-server]__1fc6v12._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1hviq62._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1ksm9m-._.js +12 -0
- package/.next/server/chunks/[root-of-the-server]__1m1q6u5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1m_dmf6._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1mys2c3._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1p0njle._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1p47fbb._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1pugoq0._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0ts7ai0._.js → [root-of-the-server]__1trns9g._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1ygplx1._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1zn039k._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__20w_g71._.js +3 -0
- package/.next/server/chunks/_01c32w9._.js +1 -1
- package/.next/server/chunks/_02bov6_._.js +1 -1
- package/.next/server/chunks/_06hnfi8._.js +2 -2
- package/.next/server/chunks/_06u9yo-._.js +1 -1
- package/.next/server/chunks/_08354bn._.js +12 -11
- package/.next/server/chunks/_08_-9ay._.js +7 -0
- package/.next/server/chunks/_08s4vft._.js +1 -1
- package/.next/server/chunks/_0bgjf07._.js +5 -0
- package/.next/server/chunks/_0c49lmw._.js +1 -1
- package/.next/server/chunks/_0fb6dvr._.js +1 -1
- package/.next/server/chunks/_0hgvg55._.js +1 -1
- package/.next/server/chunks/_0iw19ig._.js +1 -1
- package/.next/server/chunks/_0poi1t2._.js +1 -1
- package/.next/server/chunks/_0s8ao8z._.js +1 -1
- package/.next/server/chunks/_0t_7gji._.js +1 -1
- package/.next/server/chunks/_0ucx1jv._.js +1 -1
- package/.next/server/chunks/_0uzj57i._.js +1 -1
- package/.next/server/chunks/_0wyh244._.js +112 -0
- package/.next/server/chunks/_1-sk_q4._.js +1 -1
- package/.next/server/chunks/_108gsm8._.js +2 -2
- package/.next/server/chunks/_136j09a._.js +5 -5
- package/.next/server/chunks/_15negpy._.js +2 -2
- package/.next/server/chunks/_1d7og_q._.js +1 -1
- package/.next/server/chunks/_1dxq827._.js +2 -2
- package/.next/server/chunks/_1e54wxa._.js +1 -1
- package/.next/server/chunks/_1frcwj1._.js +1 -1
- package/.next/server/chunks/_1gn2r2q._.js +8 -6
- package/.next/server/chunks/_1gxankq._.js +2 -2
- package/.next/server/chunks/_1i3uucm._.js +1 -1
- package/.next/server/chunks/_1jvy78-._.js +5 -0
- package/.next/server/chunks/_1lg0lsu._.js +53 -0
- package/.next/server/chunks/_1njolhx._.js +294 -0
- package/.next/server/chunks/_1q6e56i._.js +8 -6
- package/.next/server/chunks/_1qgix-j._.js +1 -1
- package/.next/server/chunks/_1wtb-77._.js +294 -0
- package/.next/server/chunks/_1wwl_7o._.js +1 -1
- package/.next/server/chunks/_1y8w80a._.js +5 -5
- package/.next/server/chunks/_1yx285_._.js +3 -0
- package/.next/server/chunks/_20qn224._.js +3 -0
- package/.next/server/chunks/_211dn2c._.js +1 -1
- package/.next/server/chunks/_next-internal_server_app_api_bot_thread_file_route_actions_0q3be0o.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_llm-model_catalog_[provider]_route_actions_1i0449q.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_llm-model_credits_[provider]_route_actions_0iui9hz.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_running_route_actions_0o1g-aw.js +3 -0
- package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
- package/.next/server/chunks/features_bot_08z387_._.js +3 -3
- package/.next/server/chunks/features_bot_0zy_q8y._.js +7 -7
- package/.next/server/chunks/features_bot_1dfrdsb._.js +7 -7
- package/.next/server/chunks/features_workspace_workspace_ts_13h82gv._.js +3 -3
- package/.next/server/chunks/features_workspace_workspace_ts_1iyjroj._.js +3 -3
- package/.next/server/chunks/{node_modules_1rosz79._.js → node_modules_035o7ku._.js} +1 -1
- package/.next/server/chunks/{node_modules_1er1u8w._.js → node_modules_0tn5t13._.js} +1 -1
- package/.next/server/chunks/{node_modules_103lpef._.js → node_modules_12oq3hr._.js} +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0g87zst._.js → node_modules_consola_dist_chunks_prompt_mjs_0yd5xa0._.js} +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__04upd5v._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0p0mv2u._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0sk5enu._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0xyaud4._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1-gi9sm._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__16nn3pe._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1c8-7cw._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__1d7usu0._.js → [root-of-the-server]__1qn0axo._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__1tb5vve._.js +47 -0
- package/.next/server/chunks/ssr/_02cm0fr._.js +5 -0
- package/.next/server/chunks/ssr/{features_bot_1knyan7._.js → _07nmtxo._.js} +2 -2
- package/.next/server/chunks/ssr/_088vzgn._.js +1 -1
- package/.next/server/chunks/ssr/{_1dfv66y._.js → _0bg1u1j._.js} +2 -2
- package/.next/server/chunks/ssr/_0cv9tmv._.js +1 -1
- package/.next/server/chunks/ssr/{_10-_awu._.js → _0f9hx5p._.js} +2 -2
- package/.next/server/chunks/ssr/_0g9ula_._.js +3 -0
- package/.next/server/chunks/ssr/{_1aqjk-1._.js → _0irozu9._.js} +2 -2
- package/.next/server/chunks/ssr/{_123y-ah._.js → _0is8m6y._.js} +2 -2
- package/.next/server/chunks/ssr/_0iwsdp7._.js +3 -0
- package/.next/server/chunks/ssr/_0l7rjg5._.js +1 -1
- package/.next/server/chunks/ssr/{lib_logger_ts_0-olsze._.js → _0mfgsk-._.js} +4 -2
- package/.next/server/chunks/ssr/{_0fo4552._.js → _0nk80t6._.js} +53 -13
- package/.next/server/chunks/ssr/_0p6w0ef._.js +3 -0
- package/.next/server/chunks/ssr/_0pbav_w._.js +3 -0
- package/.next/server/chunks/ssr/{_0vo_oym._.js → _0q-mdwv._.js} +8 -8
- package/.next/server/chunks/ssr/_0s5_ahb._.js +3 -0
- package/.next/server/chunks/ssr/{_0e2fnvg._.js → _0t5f2c3._.js} +2 -2
- package/.next/server/chunks/ssr/_0v9r8g2._.js +1 -1
- package/.next/server/chunks/ssr/_0x8ophf._.js +1 -1
- package/.next/server/chunks/ssr/_0x9f717._.js +60 -0
- package/.next/server/chunks/ssr/_107vtdk._.js +162 -0
- package/.next/server/chunks/ssr/{_17a4qyk._.js → _12lql1x._.js} +3 -3
- package/.next/server/chunks/ssr/{_163dr78._.js → _165wnr4._.js} +2 -2
- package/.next/server/chunks/ssr/_16_7zeo._.js +3 -0
- package/.next/server/chunks/ssr/_17komoi._.js +3 -0
- package/.next/server/chunks/ssr/_190hjys._.js +3 -0
- package/.next/server/chunks/ssr/_1bfrntd._.js +6 -0
- package/.next/server/chunks/ssr/{_01al00i._.js → _1booff4._.js} +2 -2
- package/.next/server/chunks/ssr/{_0xfafez._.js → _1ew1j7l._.js} +2 -2
- package/.next/server/chunks/ssr/_1i2swyr._.js +3 -0
- package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
- package/.next/server/chunks/ssr/_1qsa25k._.js +3 -0
- package/.next/server/chunks/ssr/_1soynbw._.js +6 -0
- package/.next/server/chunks/ssr/_1vc2xmu._.js +3 -0
- package/.next/server/chunks/ssr/{_14oirtb._.js → _1wq90j8._.js} +2 -2
- package/.next/server/chunks/ssr/_1xwtbdz._.js +3 -0
- package/.next/server/chunks/ssr/_1zrhkf0._.js +310 -0
- package/.next/server/chunks/ssr/_21awrs2._.js +5 -0
- package/.next/server/chunks/ssr/features_0796o8r._.js +1 -1
- package/.next/server/chunks/ssr/features_bot_0tb4ui-._.js +2 -2
- package/.next/server/chunks/ssr/features_bot_1c56lew._.js +37 -0
- package/.next/server/chunks/ssr/features_bot_1fn_grf._.js +3 -0
- package/.next/server/chunks/ssr/{features_config_09n-q9q._.js → features_config_05zi68v._.js} +3 -3
- package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
- package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
- package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
- package/.next/server/chunks/ssr/features_workspace_workspace_ts_1wc7_u_._.js +4 -4
- package/.next/server/chunks/ssr/{node_modules_1k5i-_9._.js → node_modules_0-sux1a._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0msrhxf._.js → node_modules_01oezhb._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1gq3ght._.js → node_modules_04m6ebg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0nmkv-v._.js → node_modules_067jfov._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0gd9hbz._.js → node_modules_06ugby3._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0d6j33x._.js → node_modules_07p51j3._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_10_fv2a._.js → node_modules_0995xyq._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1lmyts8._.js → node_modules_0_uecwx._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_04x5wyv._.js → node_modules_0dsyc90._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0__0tvm._.js → node_modules_0hli6s2._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0k8-y89._.js → node_modules_0m-bde_._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1p_6sq7._.js → node_modules_0oqfdbr._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_0qd7p5f._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_13g-d25._.js → node_modules_0tgy5s5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1_8-jcj._.js → node_modules_1-kjmls._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0m73b88._.js → node_modules_1-l3ka5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_113l3e5._.js → node_modules_1-w3ayh._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0q-klni._.js → node_modules_133exgm._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1xb-ndg._.js → node_modules_17xc5_k._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_021lid9._.js → node_modules_1_i_w30._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1ri_eip._.js → node_modules_1a2cjfk._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_13bqv6i._.js → node_modules_1k752fe._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1qstb1x._.js → node_modules_1lie7z8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_096up6a._.js → node_modules_1mv70-y._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_156kv_t._.js → node_modules_1r611t2._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_1vfd8dz._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_0cjnmzp._.js → node_modules_1yaowd7._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0nw5jz7._.js → node_modules_20a1wpo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0amkw0b._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1r8pxbe._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0zq3l45._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1siiu4h._.js} +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +205 -132
- package/.next/static/chunks/{0obogzscwwekj.js → 088d3w5qxu19g.js} +2 -2
- package/.next/static/chunks/0_s4z70lx1tgs.js +1 -0
- package/.next/static/chunks/0bxekp4hnuk1g.js +1 -0
- package/.next/static/chunks/{1cglo3a2mbeou.js → 0fw4u_s974j24.js} +1 -1
- package/.next/static/chunks/0hy2x7qhk8wgx.css +1 -0
- package/.next/static/chunks/{2zbl41hed17g3.js → 0n_eshmn_7wfn.js} +2 -2
- package/.next/static/chunks/0q9b2n6l4flqb.js +1 -0
- package/.next/static/chunks/0ulcp_u_y1u0b.js +15 -0
- package/.next/static/chunks/0vj93zo0yvix9.js +35 -0
- package/.next/static/chunks/{166smhw8v-s3j.js → 10f98bh4hdmhe.js} +1 -1
- package/.next/static/chunks/1b8bce_z_act0.js +1 -0
- package/.next/static/chunks/1c32d2azsjaj_.js +1 -0
- package/.next/static/chunks/{1xv4g10m-cl1s.js → 1fs829mz69pxz.js} +1 -1
- package/.next/static/chunks/1lwlh4mo_vv8d.js +1 -0
- package/.next/static/chunks/{0p2f6uv4xytfm.js → 1po8fkg40peu-.js} +1 -1
- package/.next/static/chunks/{0uxq_vs6uxi-b.js → 1rg6b9l5fm1hj.js} +1 -1
- package/.next/static/chunks/{3b96xy59nl_gd.js → 26g3iwfuad-7p.js} +1 -1
- package/.next/static/chunks/2bjnmtke_q43c.js +1 -0
- package/.next/static/chunks/2c86k0o-1p9_w.js +1 -0
- package/.next/static/chunks/2gf4t0d76bvyv.js +1 -0
- package/.next/static/chunks/2rj3q_ahctv19.js +1 -0
- package/.next/static/chunks/{2lhc74urf3acr.js → 2x6-fpctvucte.js} +1 -1
- package/.next/static/chunks/2yicf7bky866n.js +3 -0
- package/.next/static/chunks/337g9g_ux2gj-.js +1 -0
- package/.next/static/chunks/350ws7svim7ij.js +58 -0
- package/.next/static/chunks/{0o7o0eb7ihxi6.js → 396enq-m0sss5.js} +1 -1
- package/.next/static/chunks/3e1w_nwfb39j-.js +1 -0
- package/.next/static/chunks/3v3ooretb54ag.js +1 -0
- package/.next/static/chunks/40re_3ukjulg9.js +1 -0
- package/.next/static/chunks/{3gsxnqqqphh-1.js → 44bcbnmup71so.js} +1 -1
- package/.next/static/chunks/{2qgkbdshzpq1c.js → 458dtbsemx996.js} +1 -1
- package/README.md +5 -5
- package/bin/background.mjs +995 -0
- package/bin/lock.mjs +121 -5
- package/bin/thursday.mjs +126 -30
- package/bin/tools.mjs +72 -1
- package/database/migrations/20260926021847_thread_cache_tokens/migration.sql +2 -0
- package/database/migrations/20260926021847_thread_cache_tokens/snapshot.json +1949 -0
- package/guide/bots.md +173 -317
- package/guide/calls.md +106 -146
- package/guide/index.md +2 -2
- package/guide/memory.md +14 -18
- package/guide/phone.md +86 -133
- package/guide/setup.md +141 -172
- package/guide/trouble.md +42 -65
- package/package.json +1 -1
- package/seed-skills/concierge/travel/references/itinerary.md +1 -1
- package/seed-skills/concierge/travel/scripts/itinerary.mjs +8 -3
- package/skills/artifact/references/book.md +3 -3
- package/skills/artifact/runtime/shell/shell.js +32 -3
- package/.next/server/app/api/llm-model/catalog/route/app-paths-manifest.json +0 -3
- package/.next/server/app/api/llm-model/catalog/route.js.nft.json +0 -1
- package/.next/server/app/api/llm-model/catalog/route_client-reference-manifest.js +0 -3
- package/.next/server/app/api/llm-model/credits/route/app-paths-manifest.json +0 -3
- package/.next/server/app/api/llm-model/credits/route.js.nft.json +0 -1
- package/.next/server/app/api/llm-model/credits/route_client-reference-manifest.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__01ypm_z._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__021dkui._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__03xamry._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__09gdscj._.js +0 -7
- package/.next/server/chunks/[root-of-the-server]__0ljizgj._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0nmust6._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__0svzjwa._.js +0 -7
- package/.next/server/chunks/[root-of-the-server]__1-rmal0._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__10xnb7e._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1_h4hf9._.js +0 -7
- package/.next/server/chunks/[root-of-the-server]__1c2kwku._.js +0 -12
- package/.next/server/chunks/[root-of-the-server]__1t02-1p._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1t0jj1j._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__1v7x5ym._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1vlxv19._.js +0 -5
- package/.next/server/chunks/_07nxi75._.js +0 -254
- package/.next/server/chunks/_08btiir._.js +0 -7
- package/.next/server/chunks/_0j0-gq6._.js +0 -5
- package/.next/server/chunks/_0p6v1fr._.js +0 -5
- package/.next/server/chunks/_0srlnvd._.js +0 -16
- package/.next/server/chunks/_0xygcxs._.js +0 -254
- package/.next/server/chunks/_1ic3bew._.js +0 -5
- package/.next/server/chunks/_next-internal_server_app_api_llm-model_catalog_route_actions_1eu2y41.js +0 -3
- package/.next/server/chunks/_next-internal_server_app_api_llm-model_credits_route_actions_0v424pb.js +0 -3
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_04oxl25._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0-af_o7._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__09f39cp._.js +0 -4
- package/.next/server/chunks/ssr/[root-of-the-server]__0ouu4qp._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0q9g9ea._.js +0 -5
- package/.next/server/chunks/ssr/[root-of-the-server]__17h1ggo._.js +0 -46
- package/.next/server/chunks/ssr/[root-of-the-server]__1jyeu61._.js +0 -5
- package/.next/server/chunks/ssr/_0afrpci._.js +0 -3
- package/.next/server/chunks/ssr/_0bgse1c._.js +0 -162
- package/.next/server/chunks/ssr/_0jstvlg._.js +0 -39
- package/.next/server/chunks/ssr/_0qsmpcu._.js +0 -3
- package/.next/server/chunks/ssr/_0z38nha._.js +0 -3
- package/.next/server/chunks/ssr/_1-41lck._.js +0 -3
- package/.next/server/chunks/ssr/_10_ph1t._.js +0 -3
- package/.next/server/chunks/ssr/_116lfdc._.js +0 -3
- package/.next/server/chunks/ssr/_14dfh7a._.js +0 -4
- package/.next/server/chunks/ssr/_17qtuv7._.js +0 -3
- package/.next/server/chunks/ssr/_19jez1a._.js +0 -3
- package/.next/server/chunks/ssr/_1_5xof_._.js +0 -3
- package/.next/server/chunks/ssr/_1alxym6._.js +0 -3
- package/.next/server/chunks/ssr/_1ou5sj0._.js +0 -3
- package/.next/server/chunks/ssr/_1tmw842._.js +0 -5
- package/.next/server/chunks/ssr/_1uij_rj._.js +0 -3
- package/.next/server/chunks/ssr/_1w9w1ok._.js +0 -3
- package/.next/server/chunks/ssr/_20gq_24._.js +0 -3
- package/.next/server/chunks/ssr/features_bot_0ouemw8._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_@base-ui_react_1j9i1ho._.js +0 -3
- package/.next/static/chunks/01l7kw74vfp32.js +0 -1
- package/.next/static/chunks/0a5_-jqhaktjj.js +0 -1
- package/.next/static/chunks/0npvak0wpgagb.js +0 -1
- package/.next/static/chunks/19l81deo_pyoc.js +0 -1
- package/.next/static/chunks/1bnhw-5fj7aiz.js +0 -1
- package/.next/static/chunks/1in6nxpu33iab.js +0 -1
- package/.next/static/chunks/1u7kg91f9qy3g.js +0 -1
- package/.next/static/chunks/2ajs12-fcdwzm.js +0 -1
- package/.next/static/chunks/2i7qtmxc1kuqg.js +0 -1
- package/.next/static/chunks/2kz1f6r59nky0.js +0 -3
- package/.next/static/chunks/31kn4_h2rvf6k.css +0 -1
- package/.next/static/chunks/35jj-5u4te56r.js +0 -1
- package/.next/static/chunks/37ixzapa06xlo.js +0 -1
- package/.next/static/chunks/3jtcieuk1l6tw.js +0 -1
- package/.next/static/chunks/3k1d8y03t5nax.js +0 -58
- package/.next/static/chunks/3sla-dm1puqd1.js +0 -35
- package/.next/static/chunks/3t2c76awm9k_p.js +0 -1
- package/.next/static/chunks/3vrmcm31ih7gb.js +0 -1
- package/.next/static/chunks/3yiqr95d7ybeq.js +0 -15
- package/bin/autostart.mjs +0 -162
- /package/.next/server/app/api/{llm-model/catalog → bot/thread/file}/route/build-manifest.json +0 -0
- /package/.next/server/app/api/{llm-model/catalog → bot/thread/file}/route/server-reference-manifest.json +0 -0
- /package/.next/server/app/api/{llm-model/catalog → bot/thread/file}/route.js.map +0 -0
- /package/.next/server/app/api/llm-model/{credits → catalog/[provider]}/route/build-manifest.json +0 -0
- /package/.next/server/app/api/llm-model/{credits → catalog/[provider]}/route/server-reference-manifest.json +0 -0
- /package/.next/server/app/api/llm-model/{credits → catalog/[provider]}/route.js.map +0 -0
- /package/.next/static/{8I2hKtciyA9LXvd8txuOz → YhaRHJqObuAcXZe5VLFs0}/_buildManifest.js +0 -0
- /package/.next/static/{8I2hKtciyA9LXvd8txuOz → YhaRHJqObuAcXZe5VLFs0}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{8I2hKtciyA9LXvd8txuOz → YhaRHJqObuAcXZe5VLFs0}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,302707,e=>{"use strict";var t=e.i(843476),n=e.i(689664),r=e.i(24071),a=e.i(867927),s=e.i(638292),l=e.i(456420);let i={name:"volume-2",size:24,node:[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]};i.node;let o=(0,l.default)(i),u={name:"volume-x",size:24,node:[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]]};u.node;let c=(0,l.default)(u);var d=e.i(618566),h=e.i(271645),p=e.i(798120),m=e.i(167881),f=e.i(660302),g=e.i(319036),x=e.i(728231),y=e.i(146538),w=e.i(265402),b=e.i(609507),v=e.i(463625),k=e.i(635963),j=e.i(6799),S=e.i(393080),N=e.i(283653),T=e.i(647163),E=e.i(90244),_=e.i(805995),M=e.i(616816),A=e.i(294970),C=e.i(432653),L=e.i(992112),R=e.i(218080);let I={hello:"Hi, I'm Thursday. One thing first: this is a recording. You'll hear my real voice on our first call.",key:"My real voice comes from OpenAI, and it needs a key — think of it as a password. Paste one in, and I wake up. Don't have one yet? No problem, skip ahead. I'll ask again later.",awake:"There we go — I'm awake. That key is all a call needs. The rest is quick: your microphone, who does the work for you, and what they think with.",mic:"Now let me hear you. Your browser will ask before it turns the microphone on. Say yes, then say anything — and watch the line under me move. It's only on during a call, unless you ask for more.",heard:"I hear you — that line is your voice. If you'd rather wake me by saying my name instead of tapping, switch that on here and give it a try.",bots:"Big jobs go to my helper bots, so you and I can keep talking while they work. They work right here on your computer, with a browser and your files. Signing in and paying always stay with you.",models:"Every bot runs on an A.I. model that you pick. Start small: a small one is fast and cheap, and you can move any bot up later. Your OpenAI key already covers it. A GPT subscription, or a Vercel key, opens up a lot more.",style:"One more, and it's the fun one: who I am to you. There are four of me, and the only difference is how I talk. Pick whoever sounds like someone you'd call — you can change your mind anytime.",call:"That's everything. Call me, tell me what to call you, and ask for one thing — anything you'd ask someone sitting next to you. From here on, it's my real voice. I'll show you the rest as we go.",asleep:"I still don't have a voice of my own, so no calls yet — but everything else works. Have a look around. When you have a key, tap me, and I'll take it from there.",asleepBare:"I still don't have a voice of my own, and my bots have nothing to think with yet — so no calls and no jobs for now. Have a look around. Add a key, or sign in with ChatGPT, and I'll take it from there."},O=Array(R.SPECTRUM_BANDS).fill(0),D="thursday.intro.muted";var P=e.i(567334),F=e.i(387758),$=e.i(877267),z=e.i(377090),B=e.i(732061),q=e.i(298293),U=e.i(922521);let K=[{radii:5,px:64,density:1.05},{radii:3.2,px:40,density:1.1},{radii:2.1,px:26,density:1.2},{radii:1.45,px:16,density:1.3}],H=[.2,1.6,2.5,3.1,3.55],W=["/sounds/opening-rise.ogg","/sounds/opening-step-1.ogg","/sounds/opening-step-2.ogg","/sounds/opening-step-3.ogg","/sounds/opening-land.ogg"],G=[2,3,1],Y=[[],["🤍"],["🤍","☁️"],["☁️","🤍"],["☁️","🕊️"],["🕊️","☁️"],["🕊️","🦢"],["🦢","🕊️","☁️"],["🦢","🤍"],["🤍","⚪","🦢"],["🤍","⚪"],["⚪","🤍"]],V=[[],["🤍","⚪"],["🤍","⚪","🦢"],["🦢","🤍","🕊️"],["🦢","🕊️","☁️"],["🕊️","🦢","☁️"],["🕊️","☁️"],["☁️","🕊️"],["☁️","🖤"],["⚫","🖤","☁️"],["🖤","⚫"],["🖤","⚫"]],J=K[0].px;function X({anchor:e,onArrive:n,onHello:r,onDone:a}){let s=(0,h.useRef)(null),l=(0,U.useIsDark)(),i=(0,h.useRef)({dark:l,onArrive:n,onHello:r,onDone:a});return i.current={dark:l,onArrive:n,onHello:r,onDone:a},(0,h.useEffect)(()=>{let t=s.current,n=e.current,r={arrive:!1,hello:!1,done:!1},a=e=>{r[e]||(r[e]=!0,"arrive"===e?i.current.onArrive():"hello"===e?i.current.onHello():i.current.onDone())};if(!t||!n||window.matchMedia("(prefers-reduced-motion: reduce)").matches){a("arrive"),a("hello"),a("done");return}let l=t.getContext("2d");if(!l){a("arrive"),a("hello"),a("done");return}let o=H.map((e,t)=>e+(t>0?(Math.random()-.5)*.12:0)),u=!function(){try{return"1"===window.localStorage.getItem(D)}catch{return!1}}()?W.map(e=>{let t=new Audio(e);return t.preload="auto",t}):[],c=0,d=50*Math.random(),h=Math.min(2,window.devicePixelRatio||1),p="letters"===(0,$.faceGlyphs)(),m=p?null:function(e,t){let n=Math.round(J*t),r=Math.ceil(1.3*n),a=document.createElement("canvas");a.width=12*r,a.height=r*Math.ceil(e.length/12);let s=a.getContext("2d");if(!s)return null;s.textAlign="center",s.textBaseline="middle",s.font=(0,F.GLYPH_FONT)(n);let l=new Map;return e.forEach((e,t)=>{l.set(e,t),s.fillText(e,t%12*r+r/2,Math.floor(t/12)*r+r/2)}),{canvas:a,at:l,slot:r,scale:r/t/J}}([...new Set([...P.EMOJI_POOL,...Y.flat(),...V.flat(),...G.flatMap(e=>q.WASH_SETS[e-1].emoji)])],h);if(!p&&!m){a("arrive"),a("hello"),a("done");return}let f=P.LEVELS-1,g=[],x=null,y=()=>{let e=window.innerWidth,r=window.innerHeight;t.width=Math.round(e*h),t.height=Math.round(r*h),l.setTransform(h,0,0,h,0,0),l.textAlign="center",l.textBaseline="middle",x=null;let a=n.getBoundingClientRect(),s=Number.parseFloat(getComputedStyle(n).getPropertyValue("--face-bleed"))/100||0,i=a.width*(1+2*s),o=a.left+a.width/2,u=a.top+a.height/2,c=F.DESIGN/i;g=K.map((t,n)=>{let a=.95*t.px/t.density,s=1.25*t.px/t.density,l=.12*n,i=Math.cos(l),h=Math.sin(l),p=70+26*n,m=[];for(let l=0;l*s<r;l++)for(let r=0;r*a<e;r++){let e=r*a+a/2,f=l*s+s/2,g=(e-o)*c,x=(f-u)*c,y=(g*i-x*h)/F.REST_R/t.radii,w=(g*h+x*i)/F.REST_R/t.radii,b=Math.hypot(y,w);if(b>2.6)continue;let v=Math.floor((Math.atan2(w,y)+Math.PI)/(2*Math.PI)*p),k=(0,P.hash)(v+13*n,3.1+d),j=(0,P.hash)(1.3*v,11.1+d);m.push({x:e,y:f,r:b,dx:y*F.REST_R,dy:w*F.REST_R,drift:.02+.14*k*k,go:.15+.9*(0,P.hash)(v,7.7+n),carry:j<.13?G[Math.floor(23*j)%G.length]:0,nx:g*(8/t.px)*.05,ny:x*(8/t.px)*.05,seed:(0,P.hash)(r+101*n,l),grain:(0,P.hash)(5.7*r+19+n,2.3*l+53),gap:.05+.3*(0,P.hash)(7.3*r+11,3.1*l+5+n)})}let g=m.length;return{px:t.px,cells:m,fast:new Float32Array(g),slow:new Float32Array(g),wasLevel:new Int8Array(g).fill(-9),turn:new Int32Array(g).fill(-9),pick:new Int32Array(g),pool:new Int8Array(g),poolFor:new Float32Array(g),byLevel:Array.from({length:f+1},()=>new Int32Array(g)),inLevel:new Int32Array(f+1),glyph:Array(g),over:!1}})};y(),window.addEventListener("resize",y);let w=(0,B.createSmoke)(),b=90*Math.random(),v={dx:0,dy:0,dist:0},k=performance.now(),j=k,S=0,N=0,T=e=>{let n=(e-k)/1e3,r=Math.min(.05,Math.max(0,(e-j)/1e3));j=e,S+=r;let{dark:s}=i.current,d=s?Y:V;p&&x!==s&&(x=s,l.fillStyle=getComputedStyle(t).color),(0,B.stepSmoke)(w,S,r,0,0,-1);let y=(0,z.windAt)(S,b),E=Math.exp(-r/F.TRAIL_FAST),_=Math.exp(-r/1.4);l.clearRect(0,0,t.width/h,t.height/h);let M=0;for(g.forEach((e,t)=>{let a=o[t],s=o[t+1];if(e.over||n<a)return;let i=n-s,u=i<=0?(0,P.smoothstep)(0,1,(n-a)/(0===t?1.2:.35)):1,c=i>0?(0,P.smoothstep)(0,.3,i):0,h=i>.05,g=S+31*t;e.inLevel.fill(0);let x=0,b=e.cells;for(let t=0;t<b.length;t++){let n=b[t],a=0,s=0;if(i<=0)u>0&&n.r<2.6&&(v.dx=n.dx,v.dy=n.dy,v.dist=n.r*F.REST_R,a=(0,B.restValue)(v,g,0,F.REST_R,u,w,y));else{let e=n.r-n.drift*i**.8,t=(1+(1.5*((0,P.smoothstep)(.6,.88,Math.abs(e))*(1-(0,P.smoothstep)(1.2,1.55,Math.abs(e))))-1)*c)*(1-(0,P.smoothstep)(n.go,n.go+.4,i));if(t>0){let r=n.r>0?e/n.r:0;v.dx=n.dx*r,v.dy=n.dy*r,v.dist=Math.abs(e)*F.REST_R,(a=(0,B.restValue)(v,g,0,F.REST_R,1,w,y)*t)>.04&&c>.5&&(s=n.carry)}}(a*=(.66+.72*n.grain)*(.8+.4*(0,P.hash)(Math.floor(n.nx+.5*S),Math.floor(n.ny-.3*S))))>.3&&(0,P.hash)(31.7*Math.floor(1.6*S),613*n.seed)>.992&&(a=Math.max(a,.9)),s?(e.pool[t]=s,e.poolFor[t]=.35*(.5+n.grain)):e.poolFor[t]>0?(e.poolFor[t]-=r,e.poolFor[t]<=0&&(e.pool[t]=0)):e.pool[t]=0;let l=e.fast[t]=a>e.fast[t]*E?a:e.fast[t]*E,o=e.slow[t]=a>e.slow[t]*_?a:e.slow[t]*_;if((a=l>.55*o?l:.55*o)<n.gap+.05*Math.sin(.28*S+6.283*n.seed))continue;let m=(a>1?1:a)*f|0;if(0===m)continue;x++;let k=S*(p?F.CHURN_LETTERS:F.CHURN_EMOJI)+7*n.seed|0;(k!==e.turn[t]||m-e.wasLevel[t]>=2||e.wasLevel[t]-m>=2)&&(e.turn[t]=k,e.wasLevel[t]=m,e.pick[t]=(997*n.seed|0)+k+m);let j=e.pick[t],N=e.pool[t]?q.WASH_SETS[e.pool[t]-1]:null,T=p?N?.letters??P.RAMP[m]:N?.emoji??(h?d[m]:P.EMOJI_POOL);e.glyph[t]=T[j%T.length],e.byLevel[m][e.inLevel[m]++]=t}M+=x,i>1.45&&0===x&&(e.over=!0),m||(l.font=(0,F.GLYPH_FONT)(e.px));for(let t=1;t<=f;t++){let n=e.inLevel[t];if(0===n)continue;let r=e.byLevel[t];if(!m){l.globalAlpha=P.ALPHA_TOP*(t/f);for(let t=0;t<n;t++){let n=b[r[t]];l.fillText(e.glyph[r[t]],n.x,n.y)}continue}l.globalAlpha=(0,P.emojiAlpha)(t,f);let a=e.px*m.scale*(.5+.5*(0,P.emojiWeight)(t,f));for(let t=0;t<n;t++){let n=b[r[t]],s=m.at.get(e.glyph[r[t]])??0;l.drawImage(m.canvas,s%12*m.slot,Math.floor(s/12)*m.slot,m.slot,m.slot,n.x-a/2,n.y-a/2,a,a)}}}),l.globalAlpha=1;c<u.length&&n>=o[c];c++)u[c].play().catch(()=>{});if(n>=o[4]&&a("arrive"),n>=4.7&&a("hello"),n>o[4]+1.6&&0===M){l.clearRect(0,0,t.width/h,t.height/h),a("done");return}N=requestAnimationFrame(T)};return N=requestAnimationFrame(T),()=>{if(cancelAnimationFrame(N),window.removeEventListener("resize",y),!r.done)for(let e of u)!function(e,t=.4){if(e.paused)return;let n=e.volume,r=performance.now(),a=s=>{let l=Math.max(0,Math.min(1,(s-r)/1e3/t));e.volume=n*(1-l),l<1?requestAnimationFrame(a):e.pause()};requestAnimationFrame(a)}(e)}},[e]),(0,t.jsx)("canvas",{ref:s,"aria-hidden":!0,className:"pointer-events-none absolute inset-0 size-full text-foreground"})}var Z=e.i(95187);let Q=(0,Z.createServerReference)("7fb17f76aa0e0e70e437fd4c3d08d4965e8fb924cd",Z.callServer,void 0,Z.findSourceMapURL,"passIntroAction");var ee=e.i(745747),et=e.i(333495),en=e.i(435135),er=e.i(692888),ea=e.i(114923),es=e.i(234916),el=e.i(67045),ei=e.i(297825),eo=e.i(895499),eu=e.i(656572),ec=e.i(609856);let ed=["key","mic","bots","models","style","call"];function eh({children:e}){return(0,t.jsxs)("p",{className:"text-[17px] leading-[1.675] tracking-[0.3px]",children:[(0,t.jsx)("span",{className:"mr-4 inline-block size-2.5 rounded-full bg-foreground align-middle opacity-55"}),e]})}let ep=({children:e})=>(0,t.jsx)("p",{className:"font-mono text-[11px] leading-relaxed text-pretty text-muted-foreground/70",children:e});function em({children:e,tail:r}){return(0,t.jsxs)("p",{className:"flex items-center gap-2.5 text-sm",children:[(0,t.jsx)("span",{className:"grid size-5 shrink-0 animate-in place-items-center rounded-full bg-primary text-primary-foreground duration-300 zoom-in-50",children:(0,t.jsx)(n.Check,{className:"size-3"})}),(0,t.jsx)("span",{className:"animate-in delay-150 duration-300 fill-mode-backwards fade-in slide-in-from-left-1",children:e}),r&&(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground/70",children:r})]})}function ef({keyed:e,onSaved:n}){return e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(em,{children:"OpenAI key saved"}),(0,t.jsx)(ep,{children:"Change it any time in Settings › API keys."})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh,{children:"Paste your OpenAI API key"}),(0,t.jsx)(M.VoiceKeys,{dense:!0,plain:!0,autoFocus:!0,onSaved:n}),(0,t.jsx)(M.GetKeyLink,{}),(0,t.jsx)("ol",{className:"flex flex-col gap-1.75 text-[13px] text-muted-foreground",children:["Sign in, or make an account","Create new secret key, and copy it","Paste it here"].map((e,n)=>(0,t.jsxs)("li",{className:"flex items-center gap-2.5",children:[(0,t.jsx)("span",{className:"grid size-4.5 shrink-0 place-items-center rounded font-mono text-[10px] text-foreground bg-secondary",children:n+1}),e]},e))}),(0,t.jsx)(ep,{children:"OpenAI bills it by the minute of call, separately from ChatGPT."})]})}function eg({mic:e}){let r=(0,el.useThursdayStore)(e=>e.wake),a=(0,el.useThursdayStore)(e=>e.patch),[l,i]=(0,h.useState)(!1),[o,u]=(0,h.useState)(null);return((0,eu.useWakeWord)({enabled:e.on&&r.enabled&&!o,phrases:[r.phrase],onWake:()=>i(!0),onError:u}),e.on)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(em,{children:"Microphone is on"}),(0,t.jsxs)("label",{className:"mt-1.5 flex cursor-pointer items-start gap-3",children:[(0,t.jsxs)("span",{className:"flex flex-1 flex-col gap-0.75",children:[(0,t.jsx)("span",{className:"text-sm",children:"Wake her by voice"}),(0,t.jsxs)(ep,{children:["Say ",(0,t.jsxs)("span",{className:"text-foreground",children:['"',r.phrase,'"']})," and she picks up. The microphone stays open for as long as this tab is, and the browser does the listening: Chrome sends what it hears to Google."]}),r.enabled&&!o&&(l?(0,t.jsxs)("span",{className:"mt-1.5 flex items-center gap-2 text-[13px]",children:[(0,t.jsx)("span",{className:"grid size-5 shrink-0 animate-in place-items-center rounded-full bg-foreground text-background duration-300 zoom-in-50",children:(0,t.jsx)(n.Check,{className:"size-3"})}),"Heard you. That is how you call her."]}):(0,t.jsxs)("span",{className:"mt-1.5 flex items-center gap-2 text-[13px]",children:[(0,t.jsx)(s.Mic,{className:"size-4 shrink-0"}),(0,t.jsx)(f.ShinyText,{text:`Try it now: say "${r.phrase}"`,speed:2.2})]})),o&&(0,t.jsx)(ep,{children:o})]}),(0,t.jsx)(g.Switch,{checked:r.enabled,onCheckedChange:e=>a({wake:{...r,enabled:e}})})]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh,{children:"Turn on the microphone"}),e.failed?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:(0,T.cn)("text-[13px] leading-normal",T.WAITING_INK),children:e.failed.what}),(0,t.jsx)(ep,{children:e.failed.next})]}):(0,t.jsx)(ep,{children:"Used on a call, and nowhere else unless you switch on waking her by voice."})]})}function ex({picked:e,onToggle:n}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh,{children:"Pick who comes along"}),(0,t.jsx)("div",{className:"flex flex-col",children:v.BOT_SEEDS.map(r=>{let a=!!e[r.name];return(0,t.jsxs)("label",{className:"flex h-9.5 cursor-pointer items-center gap-2.75",children:[(0,t.jsx)(k.BotMark,{size:24,seed:r.name,...r.icon,notify:!1,className:(0,T.cn)("shrink-0 transition-opacity",!a&&"opacity-40")}),(0,t.jsx)("span",{className:(0,T.cn)("w-17.5 shrink-0 text-[13.5px] font-medium",!a&&"text-muted-foreground"),children:r.name}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:r.hint}),(0,t.jsx)(g.Switch,{checked:a,onCheckedChange:()=>n(r.name)})]},r.name)})}),(0,t.jsx)(ep,{children:"Every one comes along. Switch off any you will not use: Settings › Bots has them all, and you can make your own."})]})}function ey(){let{settings:e,patch:n}=(0,ei.useLiveSettings)(),r=Math.max(0,b.PERSONAS.findIndex(t=>t.id===e?.persona)),a=b.PERSONAS[r],s=e=>n({persona:b.PERSONAS[(r+e+b.PERSONAS.length)%b.PERSONAS.length].id});return(0,t.jsxs)("div",{className:"flex w-full max-w-md flex-col gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"text-2xl font-semibold",children:a.label}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:a.about})]}),(0,t.jsx)("p",{className:"min-h-20 text-left text-sm leading-relaxed text-foreground/80",children:a.lines}),(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,t.jsx)(m.Button,{variant:"outline",size:"sm",onClick:()=>s(-1),children:"Someone else"}),(0,t.jsx)(m.Button,{variant:"outline",size:"sm",onClick:()=>s(1),children:"Next"})]}),(0,t.jsx)("div",{className:"flex justify-center gap-1.5",children:b.PERSONAS.map((e,n)=>(0,t.jsx)("span",{className:(0,T.cn)("h-0.5 w-5 rounded-full",n===r?"bg-foreground":"bg-border")},e.id))})]})}function ew(){let{data:e}=(0,N.useServerRoute)(p.queryKey.config),n=(0,w.parseTextModel)(e?.find(e=>e.key===L.DEFAULT_MODEL_KEY)?.value),r=e?.find(e=>e.key===L.DEFAULT_EFFORT_KEY)?.value,[a,s]=(0,h.useState)(null),[l]=(0,ec.useServerAction)(C.setConfigAction,{onOk:()=>(0,N.revalidate)(p.queryKey.config)}),[i]=(0,ec.useServerAction)(A.removeConfigAction,{onOk:()=>(0,N.revalidate)(p.queryKey.config)});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eh,{children:"Pick what they think with"}),(0,t.jsx)(_.AccountsSetup,{withoutVoice:!0}),(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)("span",{className:"shrink-0 text-[13px] text-muted-foreground",children:"Bots think with"}),(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)(y.ModelPicker,{provider:a??n?.provider??null,model:a?"":n?.model??"",unset:"Automatic",onChange:e=>{if(!e.model.trim())return s(e.provider);s(null),l(L.DEFAULT_MODEL_KEY,`${e.provider}/${e.model.trim()}`)},onUnset:()=>{s(null),n&&(i(L.DEFAULT_MODEL_KEY),r&&i(L.DEFAULT_EFFORT_KEY))}})})]})]})}function eb({mic:e,bots:r}){let a=["voice",e?"microphone":null,r>0?`${r} ${1===r?"bot":"bots"}`:null].filter(e=>null!==e);return(0,t.jsx)("span",{className:"flex items-center gap-2 text-xs",children:a.map((e,r)=>(0,t.jsxs)("span",{style:{animationDelay:`${300+260*r}ms`},className:"flex animate-in items-center gap-2 duration-300 fill-mode-backwards fade-in slide-in-from-bottom-1",children:[r>0&&(0,t.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(n.Check,{className:"size-3.25"}),e]})]},e))})}let ev={ask:"Find me flights to Osaka in October.",onIt:`On it. ${v.ERRANDS_BOT} is looking. Keep talking, I will say when it is back.`,back:`${v.ERRANDS_BOT} is back. The Tuesday morning flight is the pick. The page is on your screen.`},ek={threadId:"demo",label:"Osaka flights, October",bot:v.ERRANDS_BOT,words:"Three fares compared. The Tuesday morning one is the pick: direct, and the cheapest by a little.",paths:[]};function ej({stage:e}){return(0,t.jsxs)(t.Fragment,{children:["landed"===e&&(0,t.jsx)("div",{className:"pointer-events-none absolute bottom-5 left-5 w-90 text-left",children:(0,t.jsx)(eo.FinishedCard,{row:ek,bot:{icon:(0,v.findBotSeed)(ek.bot)?.icon??null},onOpen:()=>{},onClose:()=>{}})}),(0,t.jsxs)("div",{className:"absolute right-5 bottom-5 flex h-10 items-center gap-2.5 rounded-full bg-background pr-3.5 pl-2.5 ring-1 ring-border",children:[(0,t.jsx)("span",{className:"flex",children:v.BOT_SEEDS.map((n,r)=>(0,t.jsx)(k.BotMark,{size:22,seed:n.name,...n.icon,state:"working"===e&&n.name===v.ERRANDS_BOT?"thinking":"idle",notify:!1,className:(0,T.cn)("shrink-0",r>0&&"-ml-1.5")},n.name))}),(0,t.jsx)("span",{className:"w-40 truncate text-left text-[13px] text-muted-foreground",children:"working"===e?`${v.ERRANDS_BOT} \xb7 reading fares`:"landed"===e?`${v.ERRANDS_BOT} finished`:"Need a hand?"})]})]})}e.s(["Intro",0,function({ready:e,firstRun:n,forced:l}){let i=n||l,u=(0,d.useRouter)(),[f,g]=(0,h.useState)("hello"),[y,w]=(0,h.useState)(!1),[b,k]=(0,h.useState)(!1),[_,M]=(0,h.useState)(e),[A,C]=(0,h.useState)(null),[L,P]=(0,h.useState)(()=>Object.fromEntries(v.BOT_SEEDS.map(e=>[e.name,!0]))),[F,$]=(0,h.useState)("echoes"),z="hello"===F||"over"===F,B=(0,h.useRef)(null),q=function(e){let[t,n]=(0,h.useState)("off"),[r,a]=(0,h.useState)(!1),[s,l]=(0,h.useState)(""),i=(0,h.useRef)(null),o=(0,h.useRef)(null),u=(0,h.useRef)(e);u.current=e;let c=(0,h.useCallback)(()=>{for(let e of o.current?.getTracks()??[])e.stop();o.current=null},[]);return(0,h.useEffect)(()=>{e||(c(),n(e=>"on"===e||"asking"===e?"off":e))},[e,c]),(0,h.useEffect)(()=>c,[c]),{on:"on"===t,asking:"asking"===t,failed:"object"==typeof t?t:null,allowed:r,label:s,turnOn:(0,h.useCallback)(async()=>{n("asking");try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});if(!u.current){for(let t of e.getTracks())t.stop();a(!0);return}o.current=e,i.current??=(0,R.createAudioTap)(),i.current.open(),i.current.hear?.(e),l(e.getAudioTracks()[0]?.label??""),n("on"),a(!0)}catch(e){n(function(e){let t=e instanceof DOMException?e.name:"";if("NotAllowedError"===t)return{what:"This page is not allowed the microphone yet.",next:"The icon at the left of the address bar opens the site's settings: set Microphone to Allow and come back. Or just go on."};if("NotFoundError"===t)return{what:"No microphone was found.",next:"Plug one in or switch it on, then turn it on here again. Or just go on."};if("NotReadableError"===t)return{what:"The microphone would not start.",next:"Another app may be using it: close that app and turn it on here again. Or just go on."};let n=e instanceof Error&&e.message||t||String(e);return{what:"The microphone did not open.",next:`The browser said "${n}". Or just go on.`}}(e))}},[]),spectrum:(0,h.useCallback)(()=>i.current?.readMic()??[],[])}}("mic"===f&&!y),U=function(e){let[t,n]=(0,h.useState)(0);(0,h.useEffect)(()=>{if(!e)return;let t=performance.now(),r=setInterval(()=>n((performance.now()-t)%16e3),120);return()=>clearInterval(r)},[e]);let r=(e,t,n)=>({id:e,role:t,text:n}),a=[];t>900&&a.push(r("ask","user",ev.ask)),t>4700&&a.push(r("onIt","assistant",ev.onIt)),t>11500&&a.push(r("back","assistant",ev.back));let s=t>4700&&t<8300||t>11500&&t<14500;return{turns:a,status:s?"speaking":t>900&&t<4700?"listening":"idle",stage:t>9600?"landed":t>5400?"working":t>900?"asked":"rest",saying:s,voice:es.silentVoice}}("hello"===f&&i&&!y&&z),K=i&&!y;(0,h.useEffect)(()=>(ee.callSignal.hold(K),()=>ee.callSignal.hold(!1)),[K]),(0,h.useEffect)(()=>{if(!y)return;let e=setTimeout(()=>k(!0),700);return()=>clearTimeout(e)},[y]);let H=ed.indexOf(f),{data:W}=(0,N.useServerRoute)(p.queryKey.automaticModel),G=!!W?.ref,Y=(0,h.useMemo)(()=>{var e,t,n,r;let a,s;return e=f,t=_,n=q.on,r=G,a=(e,t)=>({id:e,role:"assistant",text:t}),s=[],"hello"===e||(s.push(a("key","I am Thursday. My voice comes from OpenAI, so the first thing I need is a key: paste one and I wake up. No key yet? Go on without it, and I will ask again when you call.")),t&&s.push(a("awake","There, I am awake, and that key is everything a call needs. From here on it is quick: your microphone, who works for you, and what they think with.")),"key"===e||(s.push(a("mic","Now let me hear you. Your browser asks before it opens the microphone: say yes, then say anything at all and watch the line under me move. It is only open on a call, unless you ask for more.")),n&&s.push(a("heard","I hear you: that line is your voice. If you would rather wake me by saying my name than by tapping me, switch it on here and try it once.")),"mic"===e||(s.push(a("bots","Long work goes to bots, so we can keep talking while they are at it. They work on this computer, with a shell, a browser and your files, and signing in or paying always stays with you.")),"bots"===e||(s.push(a("models","Bots think with a model you choose. Start small: a small model is quick and costs little, and any bot can move up later. An OpenAI key already covers it; a GPT subscription or one Vercel key opens far more.")),"models"===e||(s.push(a("style","One more, and it is the fun one: who I am to you. Four of them, and the only difference is how I talk — pick whoever sounds like someone you would call, and change your mind whenever you like.")),"style"===e||s.push(t?a("call","That is everything I need. Call me, tell me what to call you, and ask for one thing, anything you would ask a person at the next desk. I will show you the rest as we go."):r?a("asleep","I still have no voice of my own, so there is no call yet, but everything else works. Look around; tap me whenever you have a key and I will take it from there."):a("asleepBare","I still have no voice of my own, and my bots have nothing to think with yet, so there is no call and no job for now. Look around; add a key or sign in with ChatGPT whenever you like, and I will take it from there."))))))),s},[f,_,q.on,G]),V="hello"===f?U.turns:Y,J=(0,en.useTurnFocus)(V,K),Z=function(e){let t=(0,h.useRef)(null),n=(0,h.useRef)(new Set),r=(0,h.useRef)([]),a=(0,h.useRef)(!1),[s,l]=(0,h.useState)(!1),[i,o]=(0,h.useState)(!1),u=(0,h.useRef)(!1);(0,h.useEffect)(()=>{try{let e="1"===window.localStorage.getItem(D);u.current=e,o(e)}catch{}},[]);let c=(0,h.useCallback)(()=>{r.current=[],t.current?.audio.pause()},[]),d=(0,h.useCallback)(()=>{let e=r.current.shift();if(!e||!t.current)return;let{audio:n,clip:a}=t.current;a.resume(),n.src=`/voices/intro/${e}-${function(e){let t=0x811c9dc5;for(let n of`marin|${e}`)t^=n.codePointAt(0)??0,t=Math.imul(t,0x1000193);return(t>>>0).toString(16).padStart(8,"0")}(I[e])}.ogg`,n.play().catch(()=>{})},[]),p=(0,h.useCallback)((...e)=>{let s=e.filter(e=>!n.current.has(e));if(!u.current&&s.length){if(!t.current){let e=new Audio,n=e=>()=>{a.current=e,l(e)};for(let t of(e.addEventListener("playing",n(!0)),["pause","ended","error"]))e.addEventListener(t,n(!1));e.addEventListener("ended",d),e.addEventListener("error",d),t.current={audio:e,clip:(0,R.createClipTap)(e)}}for(let e of s)n.current.add(e);r.current=s,d()}},[d]);(0,h.useEffect)(()=>{e&&t.current&&p(e)},[e,p]),(0,h.useEffect)(()=>()=>{t.current?.audio.pause(),t.current?.clip.close(),t.current=null},[]);let m=(0,h.useCallback)(()=>{let t=!u.current;u.current=t,o(t);try{window.localStorage.setItem(D,t?"1":"0")}catch{}if(t)return c();e&&(n.current.delete(e),p(e))},[c,e,p]);return{say:p,hush:c,speaking:s,muted:i,toggle:m,spectrum:(0,h.useCallback)(()=>t.current&&a.current?t.current.clip.read():O,[])}}(y?null:Y.at(-1)?.id??null);if(b||!i)return null;let el=e=>{if(Z.hush(),w(!0),n){let e;(e=v.BOT_SEEDS.filter(e=>L[e.name]).map(e=>({name:e.name}))??v.BOT_SEEDS.map(e=>({name:e.name}))).length&&(0,E.createSeedBotsAction)(e).then(S.unwrapResult).then(()=>(0,N.revalidate)(p.queryKey.bot)).catch(e=>j.toast.add({type:"warning",title:"Could not set up the bots",description:(0,T.errorToString)(e)})),Q()}e&&ee.callSignal.place(),u.replace("/"),u.refresh()},ei="hello"===f?U.status:Z.speaking?"speaking":"mic"===f&&q.on?"listening":"idle",eo="call"===f,eu="hello"!==f;return(0,t.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Getting started",className:(0,T.cn)("fixed inset-0 z-40 bg-background transition-opacity duration-700",y&&"pointer-events-none opacity-0"),children:["over"!==F&&(0,t.jsx)(X,{anchor:B,onArrive:()=>$("her"),onHello:()=>$("hello"),onDone:()=>$("over")}),z&&(0,t.jsx)(x.TooltipProvider,{children:(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(m.Button,{size:"icon",variant:"ghost",onClick:Z.toggle,"aria-label":Z.muted?"Let her speak":"Mute her","aria-pressed":Z.muted,className:"absolute top-5 right-5 z-10 text-muted-foreground hover:text-foreground"}),children:Z.muted?(0,t.jsx)(c,{}):(0,t.jsx)(o,{})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:Z.muted?"Let her speak":"Mute her voice"})]})}),(0,t.jsxs)("div",{className:(0,T.cn)("flex h-full flex-col items-center justify-center gap-5 pt-[7vh]",eu&&"max-[900px]:justify-start max-[900px]:overflow-y-auto max-[900px]:pb-20"),children:[(0,t.jsxs)("div",{ref:B,className:(0,T.cn)("relative w-[min(20rem,52vw,37.5vh)] [--face-bleed:19.5%]",eu&&"max-[900px]:flex max-[900px]:w-full max-[900px]:flex-col max-[900px]:items-center max-[900px]:gap-7"),children:[(0,t.jsx)("button",{type:"button",disabled:!eo||!_,onClick:()=>el(!0),"aria-label":eo&&_?"Call Thursday":void 0,className:(0,T.cn)("block w-full rounded-full outline-none transition-all duration-700 ease-out focus-visible:ring-3 focus-visible:ring-ring/50","hello"!==f&&!_&&"opacity-35",eu&&"max-[900px]:mt-6 max-[900px]:w-[min(8rem,20vh)]"),children:"echoes"!==F?(0,t.jsx)(et.Face,{status:ei,failed:!1,word:A,getSpectrum:"hello"===f?U.voice:Z.spectrum,waking:!0,className:"-m-(--face-bleed) w-[calc(100%+2*var(--face-bleed))] max-w-none"}):(0,t.jsx)("div",{className:"aspect-square w-full"})}),(0,t.jsx)("div",{className:(0,T.cn)(eu&&"max-[900px]:hidden"),children:(0,t.jsx)(en.SideCaptions,{turns:V,pinned:J.pinned,live:"hello"===f?U.saying:Z.speaking,onPick:J.pick})}),eu&&(0,t.jsx)("p",{className:"hidden w-[min(22rem,calc(100vw-2rem))] text-left text-[15px] leading-[1.6] text-foreground max-[900px]:block",children:Y.at(-1)?.text}),"hello"!==f&&(0,t.jsxs)("div",{className:"absolute top-1/2 left-full ml-[calc(var(--face-bleed)+0.375rem)] flex w-[min(22rem,26vw)] -translate-y-1/2 animate-in flex-col gap-4 text-left fade-in slide-in-from-bottom-1 duration-300 max-[900px]:static max-[900px]:ml-0 max-[900px]:w-[min(22rem,calc(100vw-2rem))] max-[900px]:translate-y-0",children:["key"===f&&(0,t.jsx)(ef,{keyed:_,onSaved:()=>{M(!0),C((0,ea.awake)())}}),"mic"===f&&(0,t.jsx)(eg,{mic:q}),"bots"===f&&(0,t.jsx)(ex,{picked:L,onToggle:e=>P(t=>({...t,[e]:!t[e]}))}),"models"===f&&(0,t.jsx)(ew,{}),"style"===f&&(0,t.jsx)(ey,{})]},f)]}),(0,t.jsxs)("div",{className:"flex w-full max-w-3xl flex-col items-center gap-4 px-6 text-center",children:[(0,t.jsx)("div",{className:"flex h-14 items-center gap-2 text-[13px] text-muted-foreground",children:"hello"===f?z&&(0,t.jsx)("p",{className:"max-w-130 animate-in text-[20px] leading-[1.5] text-balance text-foreground duration-700 fill-mode-backwards fade-in slide-in-from-bottom-2",children:"Just talk to her. She gets it done on this computer, and tells you when it is ready."}):"mic"===f&&q.on?(0,t.jsx)(er.Ear,{live:!0,getMicSpectrum:q.spectrum}):_?eo?(0,t.jsx)(eb,{mic:q.allowed,bots:v.BOT_SEEDS.filter(e=>L[e.name]).length}):null:"Asleep"}),"hello"!==f||z?(0,t.jsxs)(m.Button,{variant:"brand",loading:"mic"===f&&q.asking,onClick:()=>{"hello"===f?(Z.say("hello",_?"awake":"key"),g("key")):"mic"!==f||q.on?eo?el(_):g(ed[H+1]):q.turnOn()},className:(0,T.cn)("h-12 px-7 pl-8 text-[15px]","mic"===f&&!q.on&&"pl-6","hello"===f&&"animate-in delay-300 duration-700 fill-mode-backwards fade-in slide-in-from-bottom-2"),children:["mic"===f&&!q.on&&!q.asking&&(0,t.jsx)(s.Mic,{className:"fill-current"}),"hello"===f?"Start":"mic"!==f||q.on?eo?_?"Call her":"Look around":"Continue":"Turn on the microphone",(0,t.jsx)(a.ChevronRight,{})]}):(0,t.jsx)("div",{className:"h-12"}),(0,t.jsx)("p",{className:"h-4 font-mono text-[11px] text-muted-foreground/70",children:"hello"===f?z&&(0,t.jsx)("span",{className:"block animate-in delay-500 duration-700 fill-mode-backwards fade-in",children:"two minutes · every step can wait"}):"key"!==f||_?"mic"===f&&q.asking?"your browser is asking — allow it at the top of the window":"mic"!==f||q.on?eo&&_?"or tap her":"":(0,t.jsx)("button",{type:"button",onClick:()=>g(ed[H+1]),className:"rounded-md outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:"not now — allow it when the first call asks"}):"no key is fine — it can go in from the call screen"})]})]}),"hello"===f?z&&(0,t.jsx)(ej,{stage:U.stage}):(0,t.jsxs)("div",{className:"absolute inset-x-0 bottom-6 grid grid-cols-[1fr_auto_1fr] items-center gap-4.5 font-mono text-[11px] text-muted-foreground/70 [@media(max-height:720px)]:bottom-3",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>g(H>0?ed[H-1]:"hello"),className:"flex items-center gap-1 justify-self-end rounded-md outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(r.ChevronLeft,{className:"size-3"}),"Back"]}),(0,t.jsxs)("span",{className:"flex items-center gap-4.5",children:[(0,t.jsx)("span",{className:"flex items-center gap-1.75",children:ed.map((e,n)=>(0,t.jsx)("span",{className:(0,T.cn)("h-1.75 rounded-full transition-all duration-300",n===H?"w-5.5 bg-foreground":"w-1.75",n<H&&"bg-foreground/40",n>H&&"bg-border")},e))}),(0,t.jsxs)("span",{children:[H+1," of ",ed.length]})]}),eo&&!_?(0,t.jsx)("span",{}):(0,t.jsx)("button",{type:"button",onClick:()=>el(!1),className:(0,T.cn)("justify-self-start rounded-md outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",eo&&"text-muted-foreground"),children:eo?"Look around first":"Skip all"})]})]})}],302707)},756958,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(511769),a=e.i(798120),s=e.i(917162),l=e.i(6799),i=e.i(393080),o=e.i(283653),u=e.i(647163),c=e.i(95187);let d=(0,c.createServerReference)("7f1423ff3b4c260a5bd16bdd6656f0d6cebe33e7ca",c.callServer,void 0,c.findSourceMapURL,"allowReachAction"),h=(0,c.createServerReference)("7f1129340f212c4d2e7907f2e4b6267978d2679851",c.callServer,void 0,c.findSourceMapURL,"declineReachAction");var p=e.i(36174);e.s(["ReachAsk",0,function(){let{data:e}=(0,o.useServerRoute)(a.queryKey.reach);(0,r.useAppEvent)({reach:()=>void(0,o.revalidate)(a.queryKey.reach)});let c=(0,n.useRef)(null),m=e?.channels.find(e=>e.asking)??null,f=m?.asking??null,g=m?.name??null,x=f&&g?`${g}:${f.chat}:${f.code}`:null;return(0,n.useEffect)(()=>{if(c.current?.key===x||(c.current?.close.abort(),c.current=null,!x||!f||!g))return;let e=new AbortController;c.current={key:x,close:e};let n={chat:f.chat,code:f.code};s.notify.confirm({title:`Let ${f.name} reach Thursday from a phone?`,description:(0,t.jsxs)("span",{className:"line-clamp-2",children:[[p.REACH_LABEL[g],f.name,f.handle].filter(Boolean).join(" · "),f.said&&` wrote “${f.said}”`]}),body:(0,t.jsxs)("div",{className:"grid gap-4",children:[(0,t.jsxs)("div",{className:"grid place-items-center gap-1.5 rounded-lg bg-muted p-4",children:[(0,t.jsx)("span",{className:"pl-[0.32em] font-mono text-3xl font-medium tracking-[0.32em]",children:f.code}),(0,t.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:"the code their phone was sent"})]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Allow only if the phone in your hand shows this code. Whoever you let in can talk to Thursday from there — and through her, start work on this computer."})]}),okText:"Allow",cancelText:"Not them",cautious:!0,signal:e.signal}).then(t=>{if(!e.signal.aborted)return(t?d(g,n):h(g,n)).then(i.unwrapResult).catch(e=>l.toast.add({type:"error",title:t?`Could not let ${f.name} in`:`Could not turn ${f.name} away`,description:(0,u.errorToString)(e)}))})},[x,f,g]),null}],756958)},252284,e=>{"use strict";var t=e.i(843476),n=e.i(271645);e.s(["Boot",0,function(){let[e,r]=(0,n.useState)(!1);return((0,n.useEffect)(()=>r(!0),[]),e)?null:(0,t.jsx)("p",{"aria-hidden":!0,className:"pointer-events-none fixed inset-x-0 bottom-16 z-50 animate-stalled text-center text-[13px] text-muted-foreground opacity-0",children:"The page did not start. Reload it."})}])},692888,638292,745747,234916,895499,656572,114923,435135,e=>{"use strict";var t,n,r=e.i(843476),a=e.i(989366),s=e.i(716327),l=e.i(456420);let i={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};i.node;let o=(0,l.default)(i),u={name:"flag",size:24,node:[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]]};u.node;let c=(0,l.default)(u),d={name:"mic",size:24,node:[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]};d.node;let h=(0,l.default)(d);e.s(["Mic",0,h],638292);let p={name:"mic-off",size:24,node:[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]]};p.node;let m=(0,l.default)(p),f={name:"phone-missed",size:24,node:[["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"m22 2-6 6",key:"6f0sa0"}],["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]};f.node;let g=(0,l.default)(f),x={name:"settings-2",size:24,node:[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]};x.node;let y=(0,l.default)(x);var w=e.i(263676),b=e.i(271645),v=e.i(798120),k=e.i(167881),j=e.i(225913),S=e.i(647163);let N=(0,j.cva)("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-1.5 [&>*]:relative [&>*]:focus-visible:z-10",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function T({className:e,orientation:t="horizontal",...n}){return(0,r.jsx)("div",{"data-slot":"button-group","data-orientation":t,role:"group",className:(0,S.cn)(N({orientation:t}),e),...n})}let E=new Intl.Segmenter(void 0,{granularity:"grapheme"});function _({text:e,wraps:t=[]}){let n=(0,b.useMemo)(()=>Array.from(E.segment(e),e=>e.segment),[e]),a=(0,b.useRef)([]),s=0;for(;s<n.length&&n[s]===a.current[s];)s++;(0,b.useEffect)(()=>{a.current=n},[n]);let l=e=>(0,r.jsx)(M,{wait:25*Math.max(0,e-s),children:n[e]},`${n[e]}${e}`),i=[];for(let e=0;e<n.length;){let a=t.find(t=>t.from===e&&t.to>e);if(!a){i.push(l(e)),e+=1;continue}let s=Math.min(a.to,n.length),o=[];for(let t=e;t<s;t++)o.push(l(t));i.push((0,r.jsx)(b.Fragment,{children:a.render(o)},`wrap${e}`)),e=s}return(0,r.jsx)("span",{children:i})}function M({wait:e,children:t}){let[n]=(0,b.useState)(e);return(0,r.jsx)("span",{style:{animationDelay:`${n}ms`},className:"animate-letter motion-reduce:animate-none",children:t})}var A=e.i(660302),C=e.i(633669),L=e.i(6799),R=e.i(728231),I=e.i(41533),O=e.i(149666),D=e.i(265402),P=e.i(451888),F=e.i(635963);let $={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};$.node;let z=(0,l.default)($);var B=e.i(511769);let q={wave:740,done:740,ask:820,took:740,give:900,take:520,stop:1150,read:560},U={wave:{body:"animate-crew-hop",shape:"animate-crew-hop-shape"},took:{body:"animate-crew-hop",shape:"animate-crew-hop-shape"},done:{body:"animate-crew-hop",shape:"animate-crew-hop-shape",turn:"animate-crew-spin"},ask:{body:"animate-crew-hop",shape:"animate-crew-hop-shape",turn:"animate-crew-ask-turn"},give:{turn:"animate-crew-give"},take:{body:"animate-crew-take",shape:"animate-crew-take-shape"},stop:{body:"animate-crew-sink",shape:"animate-crew-sink-shape"},read:{body:"animate-crew-nod",shape:"animate-crew-nod-shape"}},K={key:0,body:"",shape:"animate-crew-breath",turn:"",delayMs:0};var H=e.i(399512),W=e.i(256604),G=e.i(319841),Y=e.i(245629),V=e.i(661504),J=e.i(283653),X=e.i(978411),Z=e.i(351866),Q=e.i(401851),ee=e.i(677241),et=e.i(24708),en=e.i(845110),er=e.i(980797),ea=e.i(383482),es=e.i(24071),el=e.i(931619),ei=e.i(632781),eo=e.i(671428),eu=e.i(127341),ec=e.i(835878),ed=e.i(431594);function eh(){let e=(0,X.useBotThreads)(),t=(0,X.useRingingThreads)();return(0,b.useMemo)(()=>[...e].reverse().filter(e=>!t.includes(e.id)&&(0,P.needsThreadReply)(e)),[e,t])}function ep({tab:e,current:t,onTab:n,onClose:a}){return(0,r.jsxs)("div",{className:"flex items-center gap-2 pt-3 pr-3.5 pb-1.5 pl-2.5",children:[(0,r.jsx)(eu.Tabs,{value:e,onValueChange:e=>n(e),className:"gap-0",children:(0,r.jsxs)(eu.TabsList,{className:"gap-1 rounded-none bg-transparent p-0 group-data-horizontal/tabs:h-auto",children:[(0,r.jsxs)(eu.TabsTrigger,{value:"now",className:Z.TAB,children:["Now",t>0&&(0,r.jsx)("span",{className:"font-mono text-[10px] font-normal text-muted-foreground tabular-nums",children:t})]}),(0,r.jsx)(eu.TabsTrigger,{value:"history",className:Z.TAB,children:"History"})]})}),(0,r.jsx)("span",{className:"flex-1"}),(0,r.jsx)(Z.FoldButton,{onClick:a})]})}function em({bots:e}){return(0,r.jsx)("p",{className:"px-6 pt-4 pb-5 text-center text-[12px] text-muted-foreground",children:e?.length?"Nothing handed over yet — ask for something that takes a while.":`Thursday hands work to ${P.DEFAULT_BOT.name} until you make bots of your own in Settings › Bots.`})}function ef(){return(0,r.jsx)("p",{className:"px-6 pt-4 pb-5 text-center text-[12px] text-muted-foreground",children:"Nothing running or waiting."})}function eg({pages:e,threads:t,scroll:n,onPick:a}){let s=(0,b.useCallback)(e=>{e&&(e.scrollTop=n.current)},[n]),l=[];for(let e of t){let t=function(e){let t=(0,Y.toDate)(e);return(0,er.isToday)(t)?"today":(0,ea.isYesterday)(t)?"yesterday":(0,Q.format)(t,function(e,t){let[n,r]=(0,en.normalizeDates)(void 0,e,t);return n.getFullYear()===r.getFullYear()}((0,ee.constructFrom)(t,t),(0,et.constructNow)(t))?"MMM d":"MMM d, yyyy").toLowerCase()}(e.updatedAt),n=l.at(-1);n?.day===t?n.rows.push(e):l.push({day:t,rows:[e]})}return(0,r.jsx)("div",{ref:s,onScroll:e=>{n.current=e.currentTarget.scrollTop},className:"flex max-h-[50vh] min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pt-1 pb-2 scrollbar-none",children:e.error?(0,r.jsx)("p",{className:"px-2.5 py-3 text-[12px] text-destructive",children:e.error.message}):e.isLoading?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"flex h-6 items-center px-2.5 pt-1",children:(0,r.jsx)(eo.Skeleton,{className:"h-2.5 w-16"})}),(0,r.jsx)(ey,{})]}):(0,r.jsxs)(r.Fragment,{children:[l.map((e,t)=>(0,r.jsxs)(b.Fragment,{children:[(0,r.jsxs)("p",{className:(0,S.cn)("px-2.5 pb-1 font-mono text-[10px] text-muted-foreground",0===t?"pt-1":"pt-3"),children:[e.day," · ",e.rows.length]}),e.rows.map(e=>(0,r.jsx)(ev,{thread:e,onPick:()=>a(e.id)},e.id))]},e.day)),e.hasMore?(0,r.jsx)("div",{ref:e.sentinelRef,children:(0,r.jsx)(ey,{})}):0===l.length&&(0,r.jsx)("p",{className:"px-6 pt-3 pb-4 text-center text-[12px] text-muted-foreground",children:"Nothing has ended yet."})]})})}function ex({onBack:e,onClose:t}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-1",children:[(0,r.jsx)("button",{type:"button",onClick:e,"aria-label":"Back to the list",className:"shrink-0 rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,r.jsx)(es.ChevronLeft,{className:"size-4"})}),(0,r.jsx)(eo.Skeleton,{className:"size-5.5 shrink-0 rounded-md"}),(0,r.jsx)("span",{className:"flex min-w-0 flex-1",children:(0,r.jsx)(eo.Skeleton,{className:"h-3.5 w-2/5"})}),(0,r.jsx)(Z.FoldButton,{onClick:t})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 px-4 py-4",children:[(0,r.jsx)(eo.Skeleton,{className:"h-3 w-4/5"}),(0,r.jsx)(eo.Skeleton,{className:"h-3 w-3/5"}),(0,r.jsx)(eo.Skeleton,{className:"h-3 w-2/3"})]})]})}function ey(){return(0,r.jsxs)("div",{className:"flex items-center gap-2.5 px-2 py-1.5",children:[(0,r.jsx)(eo.Skeleton,{className:"size-8 shrink-0 rounded-[10px]"}),(0,r.jsxs)("span",{className:"flex h-9 min-w-0 flex-1 flex-col justify-center gap-1.5",children:[(0,r.jsx)(eo.Skeleton,{className:"h-3.5 w-2/5"}),(0,r.jsx)(eo.Skeleton,{className:"h-2.5 w-3/5"})]})]})}let ew=[{id:"needsYou",label:"needs you"},{id:"working",label:"working"}];function eb({threads:e,onPick:t}){let n=new Map;for(let t of e){let e=(0,P.standOf)(t),r=n.get(e);r?r.push(t):n.set(e,[t])}return(0,r.jsx)("div",{className:"flex max-h-[50vh] min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pt-1 pb-1 scrollbar-none",children:ew.map((e,a)=>{let s=n.get(e.id)??[];return s.length?(0,r.jsxs)(b.Fragment,{children:[(0,r.jsxs)("p",{className:(0,S.cn)("px-2.5 pb-1 font-mono text-[10px] text-muted-foreground",0===a?"pt-1":"pt-3"),children:[e.label," · ",s.length]}),s.map(e=>(0,r.jsx)(ev,{thread:e,onPick:()=>t(e.id)},e.id))]},e.id):null})})}function ev({thread:e,onPick:t,lines:n=1}){let a=(0,P.needsThreadReply)(e),s=e.lines.at(-1),l=(0,b.useMemo)(()=>(function(e){let t=e.room.questions[0];if(t)return{text:(0,S.plainText)(t.text),tone:"text-foreground"};if("waiting"===e.status&&e.ask)return{text:(0,P.isAppStop)(e.ask)?(0,S.plainText)(e.outcome??e.ask.question):e.ask.question,tone:S.WAITING_INK};let n=e.seen;if("cancelled"===e.status)return{text:"Stopped",tone:"text-muted-foreground"};if("done"===e.status)return{text:(0,S.plainText)(e.outcome??"Done"),tone:n?"text-muted-foreground":"text-foreground"};let r=(0,X.lastSaid)(e);return r?{text:"tool"===r.kind&&r.tool?r.tool.note??`${r.tool.name} \xb7 ${r.tool.input}`:r.text,tone:"text-muted-foreground"}:{text:`${e.bot.name} is taking it on…`,tone:"text-muted-foreground italic"}})(e),[e.status,e.outcome,e.seen,e.ask,e.room.questions,s?.id]),[i,o]=(0,H.useAnswerThread)(),[u,c]=(0,b.useState)(null),d=e.room.questions[0],h=d?d.options??[]:"waiting"===e.status&&(0,P.isAppStop)(e.ask)?e.ask?.options??[]:[];return(0,r.jsxs)("div",{className:"rounded-xl transition-colors hover:bg-muted/60",children:[(0,r.jsxs)("button",{type:"button",onClick:t,className:"flex w-full items-center gap-2.5 rounded-xl px-2 py-1.5 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,r.jsx)("span",{className:"relative flex size-8 shrink-0 items-center justify-center overflow-visible",title:e.bot.name,children:(0,r.jsx)(F.BotMark,{size:32,seed:e.bot.name,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,paint:e.bot.icon?.paint,state:"working"===e.status?"thinking":"idle",notify:a||(0,P.isUnread)(e),crossed:"cancelled"===e.status})}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[a&&!d&&(0,P.isAppStop)(e.ask)&&(0,r.jsx)("span",{className:"block font-mono text-[10px] tracking-wide text-muted-foreground",children:"Paused"}),(0,r.jsxs)("span",{className:"flex items-center justify-between gap-2",children:[(0,r.jsx)("span",{className:(0,S.cn)("min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]",a?"text-foreground":"text-foreground/80",(a||(0,P.isUnread)(e))&&"font-medium"),children:e.label}),e.routineId&&(0,r.jsx)("span",{title:"Started by a routine",className:"shrink-0",children:(0,r.jsx)(ed.RoutineMark,{className:"size-3 text-muted-foreground/80"})}),(0,r.jsx)(ec.BotRoster,{bots:e.roster}),(0,r.jsx)("span",{className:"flex-1"}),(0,r.jsx)("span",{className:"shrink-0 font-mono text-[11px] leading-4 text-muted-foreground/70 tabular-nums",children:(0,Y.shortAgo)(e.updatedAt)})]}),(0,r.jsxs)("span",{className:(0,S.cn)("mt-px flex items-center gap-1.5",1===n&&"h-4"),children:["working"===e.status&&(0,r.jsx)(ei.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/70"}),"working"===e.status||d?(0,r.jsx)(A.ShinyText,{text:l.text,speed:d?3.4:2.2,tone:d?"reading":void 0,className:(0,S.cn)("min-w-0 flex-1 text-[12px] leading-4",1===n?"truncate":"line-clamp-2",l.tone.includes("italic")&&"italic")}):(0,r.jsx)("span",{className:(0,S.cn)("min-w-0 flex-1 text-[12px] leading-4",1===n?"truncate":"line-clamp-2",l.tone),children:l.text})]})]})]}),h.length>0&&(0,r.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-0.5 pr-2 pb-2 pl-12.5",children:h.map(t=>(0,r.jsxs)(k.Button,{size:"sm",variant:"secondary",loading:u===t,disabled:o,onClick:async()=>{c(t),await i(e,t,d?.bot,d?.id),c(null)},className:"h-7 gap-1.5 rounded-full px-3 text-[12px]",children:[t===P.THREAD_CONTINUE&&(0,r.jsx)(el.ChevronsRight,{className:"size-3.5"}),t]},t))})]})}var ek=e.i(689664);let ej={name:"circle-pause",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],aliases:["pause-circle"]};ej.node;let eS=(0,l.default)(ej);var eN=e.i(51481),eT=e.i(77071),eE=e.i(825398);function e_({bot:e,icon:t,line:n,children:a}){return(0,r.jsxs)(R.Tooltip,{children:[(0,r.jsx)(R.TooltipTrigger,{render:(0,r.jsx)("span",{}),children:a}),(0,r.jsxs)(R.TooltipContent,{className:"flex items-center gap-2 py-1 pr-2.5 pl-1",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1.5 rounded-full bg-background/15 py-0.5 pr-2 pl-1",children:[(0,r.jsx)(F.BotMark,{size:15,seed:e,color:t?.color,shape:t?.shape,outline:t?.outline,paint:t?.paint}),(0,r.jsx)("span",{className:"font-medium text-[11px]",children:e})]}),n&&(0,r.jsx)("span",{className:"text-[11.5px] opacity-80",children:n})]})]})}let eM=[[0,[21,117,208]],[.4,[90,157,222]],[.75,[179,210,239]],[1,[252,252,254]]],eA=eM[0][1],eC=[{pace:.075,wide:.75,tall:1.15,seed:3.1,gustWide:.4,gustTall:.2,sky:1},{pace:.16,wide:1.3,tall:2.2,seed:11.7,gustWide:0,gustTall:0,sky:1},{pace:.3,wide:2.4,tall:4,seed:19.3,gustWide:0,gustTall:0,sky:1},{pace:.21,wide:1.65,tall:2.9,seed:27.7,gustWide:0,gustTall:0,sky:1.3}],eL=(e,t,n)=>e<t?t:e>n?n:e,eR=e=>e*e*(3-2*e),eI=(e,t,n)=>eR(eL((n-e)/(t-e),0,1)),eO=(e,t)=>{let n=0x165667b1*e+0x27d4eb2f*t|0;return(((n=(n^n>>>13)*0x4bf19f61)^n>>>16)>>>0)/0xffffffff},eD=(e,t)=>{let n=Math.floor(e),r=Math.floor(t),a=eR(e-n),s=eR(t-r);return(eO(n,r)*(1-a)+eO(n+1,r)*a)*(1-s)+(eO(n,r+1)*(1-a)+eO(n+1,r+1)*a)*s},eP=(e,t,n)=>.74*eD(e+n,t+.7*n)+.26*eD(2.2*e+n,2.2*t+1.3*n);function eF({on:e,className:t}){let n=(0,b.useRef)(null),[a,s]=(0,b.useState)(e),[l,i]=(0,b.useState)(!1);return((0,b.useEffect)(()=>{if(e){s(!0);let e=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(e)}i(!1);let t=setTimeout(()=>s(!1),200);return()=>clearTimeout(t)},[e]),(0,b.useEffect)(()=>{let e=n.current,t=e?.getContext("2d");if(!e||!t)return;e.width=48,e.height=48;let r=t.createImageData(48,48),a=r.data,s=[0,0,0],l=900*Math.random(),i=400*Math.random(),o=e=>{let n=e+l,o=n+1.7*Math.sin(.33*n),u=(.5+.5*Math.sin(.27*n))**2*.72+(.5+.5*Math.sin(.41*n+2.1))**3*.28,c=.1*Math.sin(.19*n),d=eC.map(e=>({seed:e.seed,shift:o*e.pace,wide:e.wide*(1-e.gustWide*u),tall:e.tall*(1+e.gustTall*u),sky:i*e.sky})),h=0;for(let e=0;e<48;e+=1){let t=(e+.5)/48*2-1;for(let e=0;e<48;e+=1,h+=4){let r=(e+.5)/48*2-1,l=eD(.55*r+.03*n,.55*t+i)-.5,o=eD(.55*r+9.1+i,.55*t-.024*n)-.5,u=r+1.15*l,p=t+ +o+c,[m,f,g,x]=d.map(e=>eP((u-e.shift)*e.wide+e.sky,p*e.tall,e.seed)),y=eL((.52-m)/.34,0,1);y*=.7+.6*eL((.56-f)/.4,0,1);let w=.97-.92*(y=eL(y+(.5-g)*.42,0,1))**1.2-.1*eL((.5-g)/.6,0,1)+(x-.5)*.38,b=Math.sqrt(r*r+t*t);!function(e,t){let n=eL(e,0,1),r=1;for(;r<eM.length-1&&n>eM[r][0];)r+=1;let[a,s]=eM[r-1],[l,i]=eM[r],o=(n-a)/(l-a);t[0]=s[0]+(i[0]-s[0])*o,t[1]=s[1]+(i[1]-s[1])*o,t[2]=s[2]+(i[2]-s[2])*o}(w+=.16*eL(1-Math.hypot(r+.42,t+.48)/1.5,0,1)+eI(.84,1,b)*eL(.15+.85*(.8*t+.45*r),0,1)*.45,s);let v=eL(b,0,1)**2.4*.26;a[h]=s[0]+(eA[0]-s[0])*v,a[h+1]=s[1]+(eA[1]-s[1])*v,a[h+2]=s[2]+(eA[2]-s[2])*v,a[h+3]=255*(1-eI(.94,1,b))}}t.putImageData(r,0,0)},u=performance.now();if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return void o(6);let c=0,d=0,h=e=>{c=requestAnimationFrame(h),e-d<33||(d=e,o((e-u)/1e3))};return c=requestAnimationFrame(h),()=>cancelAnimationFrame(c)},[a]),a)?(0,r.jsx)("canvas",{ref:n,"aria-hidden":!0,className:(0,S.cn)("pointer-events-none absolute inset-0 size-full transition-opacity",l?"opacity-100":"opacity-0",t),style:{transitionDuration:"200ms"}}):null}var e$=e.i(864723);let ez={done:ek.Check,cancelled:w.X,question:eN.CircleQuestionMark,stopped:eS,resumed:eE.RotateCw},eB={question:S.WAITING_INK,stopped:S.WAITING_INK},eq=e=>{let t=(0,S.plainText)(e).replace(/\s+/g," ").trim();return t.length>28?`${t.slice(0,27)}…`:t};function eU({crew:e,more:t,bubble:n,rows:a,count:s,busy:l,pending:i,playing:o,onPick:u,onOpen:c}){let d=(0,X.useWriteLineUp)(),h=a.length>0&&!d;return(0,r.jsxs)("div",{className:(0,S.cn)("pointer-events-auto w-fit max-w-full bg-background/78 ring-1 ring-border/50 backdrop-blur-md transition-shadow duration-300",h?"w-132 rounded-3xl shadow-lg shadow-black/8":"rounded-full shadow-sm shadow-black/3"),children:[(0,r.jsx)("div",{className:(0,S.cn)("grid overflow-hidden contain-inline-size transition-[grid-template-rows] duration-300 ease-out",h?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,r.jsxs)("div",{className:"min-h-0 overflow-hidden",inert:!h,children:[(0,r.jsxs)("p",{className:"px-3 py-2 font-mono text-[10px] tracking-wide text-muted-foreground",children:[i," ",1===i?"needs":"need"," a reply"]}),(0,r.jsx)("div",{className:"max-h-[34vh] overflow-y-auto px-1.5 pb-2",children:(0,r.jsx)("div",{children:a.map((e,t)=>(0,r.jsx)("div",{style:{animationDelay:`${120+60*t}ms`},className:"animate-in duration-300 fill-mode-backwards fade-in slide-in-from-bottom-1",children:(0,r.jsx)(ev,{thread:e,onPick:()=>u(e.id)})},e.id))},String(h))}),(0,r.jsx)("span",{className:"block h-1.5"})]})}),(0,r.jsx)(eK,{crew:e,more:t,bubble:h?null:n,label:s?`Threads (${s})`:"Bots",onClick:c,playing:o,side:(0,r.jsx)(eH,{busy:l,pending:i,grown:h}),onWrite:X.writeLine.open,writing:d})]})}function eK({crew:e,more:t,bubble:n,playing:a,side:s,label:l,onClick:i,onWrite:o,writing:u}){return(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-2 py-1.5 pr-3 pl-1.5",children:[(0,r.jsxs)(R.Tooltip,{children:[(0,r.jsxs)(R.TooltipTrigger,{render:(0,r.jsx)("button",{type:"button",onClick:o,"aria-label":"Write to Thursday or a bot","aria-pressed":u,className:(0,S.cn)("relative grid size-7 shrink-0 place-items-center overflow-hidden rounded-full outline-none transition-[background-color,box-shadow] duration-300 focus-visible:ring-3 focus-visible:ring-ring/50",u?"shadow-[0_6px_14px_-7px_color-mix(in_oklab,var(--brand)_60%,transparent)]":"bg-muted text-foreground hover:bg-accent")}),children:[(0,r.jsx)(eF,{on:!!u}),(0,r.jsx)(eT.Plus,{className:(0,S.cn)("size-3.5 transition-opacity duration-200",u?"opacity-0":"opacity-100")})]}),(0,r.jsxs)(R.TooltipContent,{children:["Write to Thursday or a bot",(0,r.jsx)("kbd",{"data-slot":"kbd",className:"bg-background/20 px-1.5 font-mono text-[10px]",children:"/"})]})]}),(0,r.jsxs)("button",{type:"button",onClick:i,"aria-label":l,className:"flex min-w-0 flex-1 items-center gap-2 rounded-full text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,r.jsx)(eG,{crew:e,more:t,bubble:n,playing:a}),s]})]})}function eH(e){let t=function({busy:e,pending:t,grown:n}){return t>0?{text:1===t?"waiting on you":`${t} waiting on you`,shine:!0}:e>0?{text:"working",shine:!0,spin:!0}:n?null:{text:"Need a hand?",shine:!1}}(e);return t?(0,r.jsxs)("span",{className:"ml-auto flex h-7 min-w-0 shrink items-center gap-1.5",children:[t.shine?(0,r.jsx)(A.ShinyText,{text:t.text,speed:2.6,className:"block truncate text-[14px] leading-5 tracking-[-0.15px]"}):(0,r.jsx)("span",{className:"block animate-in truncate text-[14px] leading-5 tracking-[-0.15px] text-muted-foreground fade-in duration-300",children:t.text},t.text),t.spin&&(0,r.jsx)(ei.Loader2,{className:"size-4 shrink-0 animate-spin text-muted-foreground/70"})]}):null}let eW=["alto","brio","cinder","delta"].map((e,t,n)=>({name:e,icon:{color:e$.MARK_PALETTE[Math.floor(t*e$.MARK_PALETTE.length/n.length)],shape:e$.MARK_SHAPES[t%e$.MARK_SHAPES.length]},awake:!1,waiting:!1,unread:!1,word:null,standIn:!0}));function eG({crew:e,more:t,bubble:n,playing:a}){return(0,r.jsxs)("span",{className:"flex min-w-0 shrink items-center",children:[e.map((t,s)=>{let l=t.standIn?e.every(e=>e.standIn)?"No bots yet":null:t.waiting?"Waiting on you":t.word?t.word:t.unread?"Left you a result":t.awake?"Working":"Idle",i=(0,r.jsx)("span",{className:(0,S.cn)("flex transition-transform duration-500 ease-out",t.awake&&"-translate-y-0.5 scale-110"),children:(0,r.jsx)(eY,{face:t,motion:function(e,t){if(!e)return{...K,delayMs:-370*t};let n=U[e.gesture];return{key:e.id,body:n.body??"",shape:n.shape??"animate-crew-breath",turn:n.turn??"",delayMs:"wave"===e.gesture?70*t:0}}(a.get(t.name),s)})});return(0,r.jsxs)(b.Fragment,{children:[(0,r.jsxs)("span",{className:(0,S.cn)("relative shrink-0 transition-[margin] duration-500 ease-out",s>0&&!e[s-1].word&&"-ml-2",t.standIn&&"opacity-35"),style:{zIndex:e.length-s},children:[null===l?(0,r.jsx)("span",{children:i}):(0,r.jsx)(e_,{bot:t.name,icon:t.icon,line:l,children:i}),n?.at===t.name&&(0,r.jsx)(eJ,{handoff:n})]}),t.word&&(0,r.jsx)("span",{className:"mx-2.5 min-w-0 shrink truncate",children:(0,r.jsx)(A.ShinyText,{text:t.word,speed:2.6,className:"truncate text-[13px] leading-5 tracking-[-0.1px]"})})]},t.name)}),t>0&&(0,r.jsx)("span",{className:"ml-2 flex h-[18px] shrink-0 items-center rounded-full bg-brand/10 px-2 font-mono text-[10.5px] leading-none font-medium text-brand",title:`${t} more`,children:"+"})]})}function eY({face:e,motion:t}){let n=t.delayMs?{animationDelay:`${t.delayMs}ms`}:void 0;return(0,r.jsx)("span",{"data-crew-motion":!0,className:(0,S.cn)("flex",t.body),style:n,children:(0,r.jsx)("span",{"data-crew-motion":!0,className:(0,S.cn)("flex origin-bottom",t.shape),style:n,children:(0,r.jsx)("span",{"data-crew-motion":!0,className:(0,S.cn)("flex",t.turn),style:n,children:(0,r.jsx)(eV,{face:e})})})},t.key)}function eV({face:e}){return(0,r.jsx)(F.BotMark,{size:28,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:e.waiting||e.unread})}function eJ({handoff:e}){return(0,r.jsxs)("span",{className:"pointer-events-none absolute bottom-[calc(100%+10px)] left-1/2 flex w-max -translate-x-1/2 animate-in flex-col items-center fade-in zoom-in-95 duration-200",children:[(0,r.jsx)("span",{className:"flex rounded-full bg-background py-2 pr-3.5 pl-2.5 shadow-lg shadow-black/10 ring-1 ring-border",children:(0,r.jsx)(eZ,{handoff:e})}),(0,r.jsx)("span",{className:"-mt-px size-0 border-x-[6px] border-t-[7px] border-x-transparent border-t-border"}),(0,r.jsx)("span",{className:"-mt-[7.5px] size-0 border-x-[6px] border-t-[7px] border-x-transparent border-t-background"})]})}function eX({handoff:e}){return(0,r.jsx)("span",{className:"ml-auto flex h-7 min-w-0 shrink animate-in items-center pl-4 fade-in duration-200",children:(0,r.jsx)(eZ,{handoff:e})})}function eZ({handoff:e}){let t=e.sign?ez[e.sign]:null,n=e.sign?eB[e.sign]:void 0;return(0,r.jsxs)("span",{className:(0,S.cn)("flex min-w-0 items-center gap-2 text-[13px] leading-[18px] tracking-[-0.1px] whitespace-nowrap",n),children:[(0,r.jsx)(eQ,{from:e.from,to:e.to}),t&&(0,r.jsx)(t,{className:(0,S.cn)("size-3.5 shrink-0",!n&&"text-muted-foreground/70")}),e.shine?(0,r.jsx)(A.ShinyText,{text:e.text,speed:2.2,className:"min-w-0 truncate"}):(0,r.jsx)("span",{className:"min-w-0 truncate",children:e.text})]})}function eQ({from:e,to:t}){let n=[e,...t];return(0,r.jsx)("span",{className:"flex shrink-0 items-center",children:n.map((e,t)=>(0,r.jsx)("span",{className:(0,S.cn)("relative flex",t>0&&"-ml-1.25"),style:{zIndex:n.length-t},children:(0,r.jsx)(e0,{bot:e})},e.name))})}function e0({bot:e}){return e.name===Z.THURSDAY.name?(0,r.jsx)(W.ThursdayMark,{size:18,className:"shrink-0"}):(0,r.jsx)(F.BotMark,{size:18,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"})}let e1=(0,b.memo)(function(){let e=(0,X.useBotThreads)(),t=eh(),{data:n}=(0,J.useServerRoute)(v.queryKey.bot),[a,s]=(0,b.useState)(!1),[l,i]=(0,b.useState)(null),o=a&&null!==l;(0,b.useEffect)(()=>(X.roomOpen.set(a?o?"thread":"list":null),()=>X.roomOpen.set(null)),[a,o]);let[u,c]=(0,b.useState)({}),[d,h]=(0,b.useState)("now"),p=(0,b.useRef)(0),m=[...e].reverse(),f=m.filter(e=>"finished"!==(0,P.standOf)(e)),g=a&&"history"===d,x=(0,V.useServerPages)({key:(e,t)=>{if(!g)return null;if(0===e)return v.queryKey.threadHistory(null);let n=t?.at(-1);return n?v.queryKey.threadHistory((0,Y.toDate)(n.updatedAt).toISOString()):null},size:I.PAGE_SIZE}),{refresh:y}=x,w=(0,b.useRef)(!1);w.current=x.items.length>0,(0,b.useEffect)(()=>{g&&w.current&&y()},[g,y]);let k=(0,b.useMemo)(()=>x.items.filter(e=>"done"===e.status||"cancelled"===e.status).map(e=>(0,X.threadFromRow)(e,n)),[x.items,n]),j=l?m.find(e=>e.id===l)??k.find(e=>e.id===l)??null:null,{data:N,isLoading:T}=(0,J.useServerRoute)(l?v.queryKey.thread(l):null),E=(0,b.useMemo)(()=>N&&N.id===l?(0,X.threadFromRow)(N,n):null,[N,l,n])??(j?.lines.length?j:null),[_,M]=function(){let[e,t]=(0,b.useState)(null),n=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),[e,(0,b.useCallback)(e=>{t(e),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,t(null)},3400)},[])]}(),A=(0,b.useMemo)(()=>_??function(e,t){for(let n of e){if("working"!==n.status)continue;let e=n.room.deliveries.find(e=>!e.delivered&&n.room.participants.some(t=>t.bot===e.bot&&"running"===t.state));if(e)return{at:e.bot,from:t(e.bot),to:[],text:"Step-in · waits for its next step",shine:!0}}return null}(e,e=>({name:e,icon:n?.find(t=>t.name===e)?.icon??null})),[_,e,n]),{crew:C,more:L}=(0,b.useMemo)(()=>(function(e,t){let n=new Set(t.filter(P.isUnread).map(e=>e.bot.name)),r=function(e){let t=new Map;for(let r of e){let e=new Set(r.room.questions.map(e=>e.bot));for(let a of("waiting"!==r.status||e.size||e.add(r.bot.name),r.room.participants)){var n;if(e.has(a.bot)){t.set(a.bot,{waiting:!0,word:null});continue}if(t.get(a.bot)?.waiting||"running"!==a.state&&"queued"!==a.state)continue;let s="running"===a.state?r.lines.findLast(e=>e.bot.name===a.bot&&"user"!==e.kind&&"note"!==e.kind&&"stop"!==e.kind):null;t.set(a.bot,{waiting:!1,word:(n=s??null,n?.kind==="tool"||n?.kind==="say"?eq((0,Z.stepOf)(n)):null)})}}return t}(t),a=new Map;for(let t of e??[])a.set(t.name,{name:t.name,icon:t.icon,awake:r.has(t.name),waiting:r.get(t.name)?.waiting??!1,unread:n.has(t.name),word:r.get(t.name)?.word??null});for(let[e,t]of r)a.has(e)||a.set(e,{name:e,icon:null,awake:!0,waiting:t.waiting,unread:n.has(e),word:t.word});let s=[...a.values()];if(!s.length)return{crew:eW.slice(0,3),more:0};for(let e of eW){if(s.length>=3)break;a.has(e.name)||s.push(e)}let l=e=>e.waiting?0:e.awake?1:e.unread?2:e.standIn?4:3,i=s.map((e,t)=>({face:e,at:t})).sort((e,t)=>l(e.face)-l(t.face)||e.at-t.at).map(e=>e.face);return{crew:i.slice(0,14),more:Math.max(0,i.length-14)}})(n,e),[n,e]),[R,O]=function(){let[e,t]=(0,b.useState)(new Map),n=(0,b.useRef)(new Map),r=(0,b.useRef)(0);return(0,b.useEffect)(()=>{let e=n.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear()}},[]),[e,(0,b.useCallback)(e=>{e.length&&t(a=>{let s=new Map(a);for(let{bot:a,gesture:l}of e){r.current+=1,s.set(a,{gesture:l,id:r.current});let e=n.current.get(a);e&&clearTimeout(e),n.current.set(a,setTimeout(()=>{n.current.delete(a),t(e=>{let t=new Map(e);return t.delete(a),t})},q[l]+1400*("wave"===l)))}return s})},[])]}(),D=(0,b.useRef)(!1);(0,b.useEffect)(()=>{!D.current&&n?.length&&(D.current=!0,O(n.map(e=>({bot:e.name,gesture:"wave"}))))},[n,O]);let F=(0,b.useRef)(null),$=(0,b.useRef)(new Map),z=(0,b.useRef)(new Set);(0,b.useEffect)(()=>{if(!X.botThreads.primed())return;let t=F.current;F.current=new Map(e.map(e=>[e.id,e.status]));let n=$.current;$.current=function(e){let t=new Map;for(let n of e)for(let e of n.room.participants)t.set(`${n.id}
|
|
2
|
+
${e.bot}`,e.state);return t}(e);let r=z.current;if(z.current=new Set(e.flatMap(e=>e.lines.map(e=>e.id))),!t)return;let a=null,s=[];for(let l of e){let{moments:e,gestures:i}=function(e,t,n,r,a){let s=e.bot,l=[];if(!t)return"working"===e.status?{moments:[{rank:1,at:s.name,from:Z.THURSDAY,to:[s],text:`took on “${eq(e.label)}”`}],gestures:[{bot:s.name,gesture:"took"}]}:{moments:[],gestures:[]};let i=[],o=e.lines.filter(e=>!n.has(e.id)),u=new Map;for(let e of o)"user"===e.kind?(e.steppedIn?l.push({bot:e.bot.name,gesture:"read"}):l.push({bot:e.bot.name,gesture:"took"}),i.push(e.steppedIn?{rank:1,at:e.bot.name,from:e.bot,to:[],text:"Step-in · read"}:{rank:1,at:e.bot.name,from:Z.THURSDAY,to:[e.bot],text:eq(e.text)})):"stop"===e.kind?(l.push({bot:e.bot.name,gesture:"stop"}),i.push({rank:3,at:e.bot.name,from:e.bot,to:[],sign:"stopped",text:(0,Z.leadOf)(e.text)})):"ask"===e.kind&&e.to?.name===Z.THURSDAY.name?(e.question&&l.push({bot:e.bot.name,gesture:"ask"}),i.push(e.question?{rank:4,at:e.bot.name,from:e.bot,to:[],sign:"question",text:`asks you \xb7 ${eq(e.text)}`}:{rank:2,at:e.bot.name,from:e.bot,to:[Z.THURSDAY],text:eq(e.text)})):"ask"===e.kind&&e.to&&u.set(e.bot.name,[...u.get(e.bot.name)??[],e]);for(let[e,t]of u){let n=new Map;for(let e of t)e.to&&n.set(e.to.name,e.to);for(let t of(l.push({bot:e,gesture:"give"}),n.values()))l.push({bot:t.name,gesture:"take"});i.push({rank:2,at:e,from:t[0].bot,to:[...n.values()],text:1===t.length?eq(t[0].text):`sent ${t.length} parts out`})}for(let t of e.roster){let n=`${e.id}
|
|
3
|
+
${t.name}`;t.name===s.name||"running"!==r.get(n)||"done"!==a.get(n)||o.some(e=>e.bot.name===t.name&&("ask"===e.kind||"say"===e.kind))||(l.push({bot:t.name,gesture:"done"}),i.push({rank:1,at:t.name,from:t,to:[],sign:"done",text:"finished its part"}))}if(t===e.status)return{moments:i,gestures:l};let c=eq(e.label);return"cancelled"===e.status?(l.push({bot:s.name,gesture:"stop"}),i.push({rank:3,at:s.name,from:s,to:[],sign:"cancelled",text:`stopped \xb7 ${c}`})):"done"===e.status?l.push({bot:s.name,gesture:"done"}):"working"===e.status?o.some(e=>"user"===e.kind)||(l.push({bot:s.name,gesture:"took"}),i.push({rank:1,at:s.name,from:s,to:[],sign:"resumed",text:"picked it back up"})):(0,P.isAppStop)(e.ask)&&!i.some(e=>"question"===e.sign||"stopped"===e.sign)&&(l.push({bot:s.name,gesture:"stop"}),i.push({rank:3,at:s.name,from:s,to:[],sign:"stopped",text:"paused"})),{moments:i,gestures:l}}(l,t.get(l.id),r,n,$.current);for(let t of(s.push(...i),e))(!a||t.rank>=a.rank)&&(a=t)}a&&M(a),O(s)},[e,M,O]),(0,X.useSeenOnDetail)(a?E:null),(0,B.useAppEvent)({showThread:e=>{i(e.threadId),s(!0)}}),(0,b.useEffect)(()=>X.roomOpens.subscribe(e=>{i(e),h("now"),s(!0)}),[]);let U=e.filter(e=>"working"===e.status).length,K=m.filter(P.needsThreadReply).length,W=(0,b.useMemo)(()=>C.map(e=>({...e,word:null})),[C]),Q=()=>{s(!1),i(null),h("now"),p.current=0},ee=(0,X.useCallWaits)();(0,G.useEscape)(a,()=>o?i(null):Q());let et=(0,b.useRef)(Q);et.current=Q,(0,b.useEffect)(()=>X.writeLine.subscribe(()=>et.current()),[]);let en=(0,b.useRef)(null);return(0,b.useEffect)(()=>{if(!o)return;let e=e=>{if("/"!==e.key||e.metaKey||e.ctrlKey||e.altKey||!(0,G.windowKey)(e))return;let t=en.current?.querySelector("textarea:not(:disabled)");t&&(e.preventDefault(),t.focus())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o]),(0,r.jsx)("div",{className:(0,S.cn)("pointer-events-none flex min-h-0 items-end justify-end",a?"col-span-3 row-start-1 self-stretch":"col-span-3 row-start-2"),children:a?(0,r.jsxs)("div",{ref:en,"data-room":!0,className:"pointer-events-auto flex max-h-full w-160 max-w-full animate-in flex-col overflow-hidden rounded-3xl bg-background/75 shadow-2xl shadow-black/6 ring-1 ring-border/50 backdrop-blur-xl fade-in slide-in-from-bottom-1 duration-200",children:[ee&&(0,r.jsx)(e2,{onBack:Q}),!E&&l&&T?(0,r.jsx)(ex,{onBack:()=>i(null),onClose:Q}):E?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Z.ThreadHeader,{thread:E,onBack:()=>i(null),onClose:Q}),(0,r.jsx)(Z.Conversation,{thread:E,tab:u[E.id]??null,onTab:e=>c(t=>({...t,[E.id]:e})),className:"min-h-0 flex-1"}),(0,r.jsx)(H.ThreadReply,{thread:{id:E.id,label:E.label,bot:E.bot.name,ask:E.ask,room:E.room},status:"working"===E.status?"running":E.status,faces:E.roster,to:u[E.id]??E.bot.name,className:"mx-3 mb-2 shrink-0"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ep,{tab:d,current:f.length,onTab:h,onClose:Q}),"history"===d?(0,r.jsx)(eg,{pages:x,threads:k,scroll:p,onPick:i}):f.length?(0,r.jsx)(eb,{threads:f,onPick:i}):m.length?(0,r.jsx)(ef,{}):(0,r.jsx)(em,{bots:n}),(0,r.jsx)(eK,{crew:W,more:L,bubble:null,playing:R,label:"Fold the room away",onClick:Q,onWrite:X.writeLine.open,side:A?(0,r.jsx)(eX,{handoff:A}):(0,r.jsx)(eH,{busy:U,pending:K,grown:!0})})]})]}):(0,r.jsx)(eU,{crew:C,more:L,bubble:A,playing:R,rows:t,count:e.length,busy:U,pending:K,onPick:e=>{i(e),s(!0)},onOpen:()=>s(!0)})})});function e2({onBack:e}){return(0,r.jsxs)("button",{type:"button",onClick:e,className:"group/waits flex shrink-0 items-center gap-2.5 bg-brand/8 py-2.5 pr-3 pl-4 text-left outline-none transition-colors hover:bg-brand/12 focus-visible:ring-3 focus-visible:ring-ring/50 dark:bg-brand/14 dark:hover:bg-brand/20",children:[(0,r.jsx)(W.ThursdayMark,{size:22,className:"shrink-0"}),(0,r.jsxs)("span",{className:"min-w-0 flex-1 text-[13px] leading-5",children:[(0,r.jsx)("span",{className:"font-medium",children:"Thursday is still on the line"}),(0,r.jsxs)("span",{className:"text-muted-foreground",children:[" ","— in writing. She is here when this closes."]})]}),(0,r.jsxs)("span",{className:"flex h-7 shrink-0 items-center gap-1 rounded-full px-2.5 font-medium text-[12.5px] text-brand ring-1 ring-brand/40 transition-colors group-hover/waits:bg-brand/10",children:["Back to her",(0,r.jsx)(z,{className:"size-3.5"})]})]})}var e5=e.i(222055),e3=e.i(616816),e4=e.i(992112);let e6={name:"app-window-mac",size:24,node:[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M14 8h.01",key:"1primd"}]]};e6.node;let e7=(0,l.default)(e6);var e9=e.i(375775);let e8="thursday.install-asked",te=null,tt=new Set,tn=()=>{for(let e of tt)e()};function tr(){return(0,b.useSyncExternalStore)(e=>(tt.add(e),()=>tt.delete(e)),()=>te,()=>null)}async function ta(){let e=te;e&&(te=null,tn(),await e.prompt(),await e.userChoice.catch(()=>void 0))}function ts({hidden:e}){let t=null!==tr(),[n,a]=(0,b.useState)(!0);if((0,b.useEffect)(()=>{try{a(null!==window.localStorage.getItem(e8))}catch{}},[]),!t||n||e)return null;let s=()=>{a(!0);try{window.localStorage.setItem(e8,"1")}catch{}};return(0,r.jsxs)("div",{className:"flex w-76 animate-in items-start gap-3 rounded-2xl bg-background p-3.5 shadow-[0_22px_44px_-20px_rgb(0_0_0/0.22)] ring-1 ring-border duration-300 fade-in slide-in-from-top-1",children:[(0,r.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted",children:(0,r.jsx)(e7,{className:"size-4"})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1 space-y-2.5",children:[(0,r.jsxs)("p",{className:"text-[13px] leading-snug",children:[(0,r.jsx)("span",{className:"block font-medium",children:"Keep her in her own window"}),(0,r.jsx)("span",{className:"block text-muted-foreground",children:"Install Thursday as an app, with its own icon. A closed tab no longer takes her calls with it."})]}),(0,r.jsxs)("div",{className:"flex gap-1.5",children:[(0,r.jsx)(k.Button,{size:"sm",className:"rounded-full px-3.5",onClick:()=>{s(),ta()},children:"Install"}),(0,r.jsx)(k.Button,{size:"sm",variant:"ghost",className:"rounded-full px-3 text-muted-foreground",onClick:s,children:"Not now"})]})]})]})}function tl(){return null===tr()?null:(0,r.jsx)("button",{type:"button",onClick:()=>void ta(),className:"group/install flex w-full items-start gap-2.5 rounded-xl px-3 py-2.5 text-left outline-none transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1 text-sm font-medium",children:["Install app",(0,r.jsx)(e9.ArrowUpRight,{className:"ml-auto size-3.5 text-muted-foreground transition-transform group-hover/install:translate-x-px group-hover/install:-translate-y-px"})]}),(0,r.jsx)("span",{className:"block text-xs leading-snug text-muted-foreground",children:"Its own window, apart from your tabs"})]})})}window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),te=e,tn()}),window.addEventListener("appinstalled",()=>{te=null,tn()});let ti={name:"aperture",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]]};ti.node;let to=(0,l.default)(ti);var tu=e.i(758925),tc=e.i(218964),td=e.i(97923);let th={name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]};th.node;let tp=(0,l.default)(th),tm={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};tm.node;let tf=(0,l.default)(tm),tg={name:"smartphone",size:24,node:[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]};tg.node;let tx=(0,l.default)(tg),ty={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};ty.node;let tw=(0,l.default)(ty);var tb=e.i(770703),tv=e.i(630374),tk=e.i(917162),tj=e.i(421429),tS=e.i(895836);function tN(){let{data:e}=(0,J.useServerRoute)(v.queryKey.bot);return e&&0===e.length?"waiting":null}function tT(){let{data:e}=(0,J.useServerRoute)(v.queryKey.threads);return{owed:(e??[]).filter(e=>(0,P.needsThreadReply)(e)||(0,P.isUnread)(e)).length}}function tE(){let{data:e,isLoading:t}=(0,J.useServerRoute)(v.queryKey.config);if(t)return null;let n=t=>(0,e4.isConfigSet)(e,t);return e4.CONFIG_GROUPS.some(e=>"keys"===e.section&&!(0,e4.groupSatisfied)(e,n))?"waiting":null}let t_=e4.CONFIG_GROUPS.filter(e=>"models"===e.section).flatMap(e=>e.entries.filter(e=>e.kind).map(e=>e.key));function tM(){let{data:e,isLoading:t}=(0,J.useServerRoute)(v.queryKey.config);return t||!e?null:t_.every(t=>!(0,e4.isConfigSet)(e,t))?"waiting":null}function tA(){let{data:e}=(0,J.useServerRoute)(v.queryKey.mcp);return e?.some(e=>e.lastError)?"red":null}var tC=e.i(991322),tL=e.i(852116);function tR(){let{data:e}=(0,J.useServerRoute)(v.queryKey.reach);return e?.channels.some(e=>e.refused)?"red":null}var tI=e.i(589128);let tO=e.i(569644).FolderOpen;var tD=e.i(922521),tP=e.i(734080),tF=e.i(989409);function t$({d:e,className:t}){return(0,r.jsx)("svg",{viewBox:"-2 -2 28 28","aria-hidden":!0,className:t,children:(0,r.jsx)("path",{d:e,fill:"currentColor"})})}let tz=[{label:"Ask on Discord",href:"https://discord.gg/Qmysdh9Fy8",mark:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"},{label:"GitHub",href:"https://github.com/cgoinglove/thursday",mark:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"}];function tB(){return(0,r.jsx)("div",{className:"flex flex-col gap-0.5",children:tz.map(e=>(0,r.jsxs)("a",{href:e.href,target:"_blank",rel:"noreferrer",className:(0,S.cn)((0,k.buttonVariants)({variant:"ghost"}),"justify-start text-muted-foreground"),children:[(0,r.jsx)(t$,{d:e.mark,className:"mr-1"}),(0,r.jsx)("span",{className:"truncate text-sm",children:e.label})]},e.href))})}var tq=tS;let tU=(e,t=tq.SettingSkeleton)=>(0,tb.default)(e,{loading:()=>(0,r.jsx)(t,{})}),tK=tU(()=>e.A(48663).then(e=>({default:e.MemorySetting}))),tH=tU(()=>e.A(959484).then(e=>({default:e.BotSetting})),tq.SettingPanesSkeleton),tW=tU(()=>e.A(954404).then(e=>({default:e.ThreadSetting}))),tG=tU(()=>e.A(483782).then(e=>({default:e.RoutineSetting}))),tY=tU(()=>e.A(711454).then(e=>({default:e.ModelsSetting}))),tV=tU(()=>e.A(711454).then(e=>({default:e.KeysSetting}))),tJ=tU(()=>e.A(711454).then(e=>({default:e.PhoneSetting}))),tX=tU(()=>e.A(17613).then(e=>({default:e.ThursdaySetting}))),tZ=tU(()=>e.A(706108).then(e=>({default:e.ArtifactSetting})),tq.SettingPanesSkeleton),tQ=tU(()=>e.A(194379).then(e=>({default:e.WorkspaceSetting})),tq.SettingPanesSkeleton),t0=tU(()=>e.A(832663).then(e=>({default:e.SkillsSetting}))),t1=tU(()=>e.A(959108).then(e=>({default:e.McpSetting}))),t2=tU(()=>e.A(663973).then(e=>({default:e.SignInsSetting})));function t5({tabs:e}){let[t,n]=(0,b.useState)(0),a=e[t].Component;return(0,r.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,r.jsx)("div",{className:"shrink-0 px-8 pt-5",children:(0,r.jsx)(tq.SettingColumn,{children:(0,r.jsx)(tj.Segmented,{view:!0,"aria-label":"Screens of this section",options:e.map((e,t)=>({value:String(t),label:e.label})),value:String(t),onChange:e=>n(Number(e))})})}),(0,r.jsx)("div",{className:"min-h-0 flex-1",children:(0,r.jsx)(a,{})})]})}let t3=[{label:"Finished",Component:tZ},{label:"All files",Component:tQ}],t4=["call","work","app"],t6="px-3 pt-3 pb-1 font-mono text-[10px] text-muted-foreground/60",t7=[{id:"thursday",label:"Thursday",group:"call",hint:"Captions, models, and how a call starts",icon:W.ThursdayMark,Component:tX},{id:"memory",label:"Memory",group:"call",hint:"What Thursday remembers about you",icon:tL.MemoryMark,Component:tK},{id:"bot",label:"Bots",group:"work",hint:"Who Thursday hands work to",icon:F.BotsMark,Component:tH,Badge:function(){return tN()?(0,r.jsx)(tS.NavBadge,{tone:"waiting"}):null}},{id:"threads",label:"Threads",group:"work",hint:"Work the bots were handed",icon:tc.ListChecks,Component:tW,Badge:function(){return(0,r.jsx)(tS.NavBadge,{tone:"waiting",count:tT().owed})}},{id:"routines",label:"Routines",group:"work",hint:"Work that starts by itself, on a schedule",icon:ed.RoutineMark,Component:tG},{id:"files",label:"Files",group:"work",hint:"What the bots finished, and everything else they wrote",icon:tO,Component:()=>(0,r.jsx)(t5,{tabs:t3})},{id:"skills",label:"Skills",group:"work",hint:"Instructions the bots load on demand",icon:tI.SkillsMark,Component:t0},{id:"mcp",label:"Connectors",group:"work",hint:"Apps the bots can use, from MCP servers",icon:tC.McpMark,Component:t1,Badge:function(){return tA()?(0,r.jsx)(tS.NavBadge,{tone:"red"}):null}},{id:"signins",label:"Sign-ins",group:"work",hint:"The sites you signed in to, and the bots that may use each",icon:td.LogIn,Component:t2},{id:"models",label:"Models",group:"app",hint:"What bots think with, and what they draw, film and speak with",icon:to,Component:tY,Badge:function(){return tM()?(0,r.jsx)(tS.NavBadge,{tone:"waiting"}):null}},{id:"keys",label:"API keys",group:"app",hint:"The accounts the app runs on",icon:tu.KeyRound,Component:tV,Badge:function(){return tE()?(0,r.jsx)(tS.NavBadge,{tone:"waiting"}):null}},{id:"phone",label:"Phone",group:"app",hint:"Write to Thursday from a chat app",icon:tx,Component:tJ,Badge:function(){return tR()?(0,r.jsx)(tS.NavBadge,{tone:"red"}):null}}],t9={system:{label:"System",icon:tp},light:{label:"Light",icon:tw},dark:{label:"Dark",icon:tf}};function t8(){let e=(0,tD.useTheme)();return(0,r.jsx)(tj.Segmented,{"aria-label":"Theme",className:"w-full gap-0.5 *:flex-1 *:py-1.5",options:tP.THEMES.map(e=>{let{label:t,icon:n}=t9[e];return{value:e,title:t,label:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n,{className:"size-3.5"}),(0,r.jsx)("span",{className:"sr-only",children:t})]})}}),value:e,onChange:tD.setTheme})}function ne({children:e}){let t=(0,tF.useSettingsStore)(e=>e.open),n=(0,tF.useSettingsStore)(e=>e.section),a=(0,tF.useSettingsStore)(e=>e.show),s=(0,tF.useSettingsStore)(e=>e.hide),l=(0,tF.useSettingsStore)(e=>e.pick),i=async e=>{let t=tF.useSettingsStore.getState().unsaved;(!t?.()||await tk.notify.discard())&&e()},o=(0,b.useRef)(null),u=t7.find(e=>e.id===n)??t7[0];return(0,b.useEffect)(()=>{if(!t)return;let e=e=>{if(!e.metaKey&&!e.ctrlKey)return;if("k"===e.key){let t=o.current?.querySelector("[data-setting-filter]");if(!t)return;e.preventDefault(),t.focus(),t.select();return}let t=Number(e.key);Number.isInteger(t)&&t>=1&&t<=t7.length&&(e.preventDefault(),i(()=>l(t7[t-1].id)))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,l]),(0,r.jsxs)(tv.Dialog,{open:t,onOpenChange:e=>e?a():void i(s),children:[e&&(0,r.jsx)(tv.DialogTrigger,{render:e}),(0,r.jsxs)(tv.DialogContent,{className:"block h-[min(52rem,calc(100vh-3rem))] overflow-hidden p-0 sm:max-w-[min(80rem,calc(100vw-3rem))]",children:[(0,r.jsx)(tv.DialogTitle,{className:"sr-only",children:"Settings"}),(0,r.jsxs)("div",{className:"flex h-full min-h-0",children:[(0,r.jsxs)("nav",{"aria-label":"Settings sections",onKeyDown:e=>{let t,r="ArrowDown"===e.key?1:"ArrowUp"===e.key?-1:0;if(!r)return;e.preventDefault();let a=(t=(t7.findIndex(e=>e.id===n)+r+t7.length)%t7.length,t7[t].id);i(()=>l(a)),e.currentTarget.querySelector(`[data-section="${a}"]`)?.focus()},className:"flex w-52 shrink-0 flex-col gap-0.5 overflow-y-auto border-r border-border/60 bg-muted/30 p-3",children:[t4.map(e=>(0,r.jsxs)(b.Fragment,{children:[(0,r.jsx)("span",{className:t6,children:e}),t7.filter(t=>t.group===e).map(e=>(0,r.jsxs)(k.Button,{"data-section":e.id,onClick:()=>void i(()=>l(e.id)),variant:e.id===n?"secondary":"ghost",className:(0,S.cn)("justify-start",e.id===n?"text-foreground bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]":"text-muted-foreground"),children:[(0,r.jsx)(e.icon,{className:(0,S.cn)("mr-1")}),(0,r.jsx)("span",{className:"truncate text-sm",children:e.label}),e.Badge&&(0,r.jsx)("span",{className:"ml-auto flex items-center",children:(0,r.jsx)(e.Badge,{})})]},e.id))]},e)),(0,r.jsx)("span",{className:t6,children:"community"}),(0,r.jsx)(tB,{}),(0,r.jsxs)("div",{className:"mt-auto flex flex-col gap-2 pt-3",children:[(0,r.jsx)(tl,{}),(0,r.jsx)("div",{className:"px-1",children:(0,r.jsx)(t8,{})})]})]}),(0,r.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,r.jsx)("div",{className:"shrink-0 px-8 pt-10",children:(0,r.jsxs)(tq.SettingColumn,{className:"animate-in space-y-0.5 fade-in slide-in-from-bottom-1 duration-300",children:[(0,r.jsx)("p",{className:"truncate text-2xl font-semibold",children:u.label}),(0,r.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:u.hint})]},u.id)}),(0,r.jsx)("div",{ref:o,className:"min-h-0 min-w-0 flex-1",children:(0,r.jsx)(u.Component,{})})]})]})]})]})}function nt(e){return e.includes("red")?"red":e.includes("waiting")?"waiting":null}function nn(){let e=tN(),t=tT().owed>0?"waiting":null,n=tA(),r=tE();return{bot:e,threads:t,mcp:n,keys:r,models:tM(),phone:tR()}}let nr=!1,na=new Set,ns=new Set,nl={hold(e){if(e!==nr)for(let t of(nr=e,na))t()},place(){for(let e of ns)e()},onPlace:e=>(ns.add(e),()=>{ns.delete(e)})};function ni(){return(0,b.useSyncExternalStore)(e=>(na.add(e),()=>na.delete(e)),()=>nr,()=>!1)}e.s(["callSignal",0,nl,"useCallHeld",0,ni],745747);let no=null,nu=null,nc=new Set,nd=()=>{for(let e of nc)e()};function nh(){return(0,b.useSyncExternalStore)(e=>(nc.add(e),()=>nc.delete(e)),()=>no?.stream??null,()=>null)}let np=()=>"u">typeof navigator&&"function"==typeof navigator.mediaDevices?.getDisplayMedia;async function nm(){let e;if(no||nu)return;let t={wanted:!0};nu=t;try{e=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:I.SCREEN_SHARE.frameRate},audio:!1})}finally{nu=null}if(!t.wanted){for(let t of e.getTracks())t.stop();return}let n=document.createElement("video");for(let t of(n.muted=!0,n.playsInline=!0,n.srcObject=e,e.getVideoTracks()))t.addEventListener("ended",nf);no={stream:e,video:n},nd();try{await n.play()}catch(e){throw nf(),e}}function nf(){if(nu&&(nu.wanted=!1),no){for(let e of no.stream.getTracks())e.stop();no.video.srcObject=null,no=null,nd()}}async function ng(e){let t,n=no?.video;if(!n)return{failed:"Nothing is being shared."};let r=await ((t=()=>!!(n.videoWidth&&n.videoHeight))()?Promise.resolve(!0):new Promise(e=>{let r=()=>{clearTimeout(a),n.removeEventListener("loadeddata",r),n.removeEventListener("resize",r),e(t())},a=setTimeout(r,I.SCREEN_SHARE.firstFrameMs);n.addEventListener("loadeddata",r),n.addEventListener("resize",r)}));if(no?.video!==n)return{failed:"Nothing is being shared."};if(!r)return{failed:"The shared screen has not shown anything yet."};let a=document.createElement("canvas"),s=a.getContext("2d");if(!s)return{failed:"This browser could not take the picture."};for(let t of I.SCREEN_SHARE.scales){let r=Math.min(1,I.SCREEN_SHARE.longestSide*t/Math.max(n.videoWidth,n.videoHeight));for(let t of(a.width=Math.round(n.videoWidth*r),a.height=Math.round(n.videoHeight*r),s.drawImage(n,0,0,a.width,a.height),I.SCREEN_SHARE.qualities)){let n=a.toDataURL("image/jpeg",t);if(n.length<=e)return{url:n}}}return{failed:`The picture of the shared screen would not fit the ${Math.round(e/1024)} KB this connection carries.`}}var nx=e.i(218080);function ny(){let e=performance.now()/1e3;return Array.from({length:nx.SPECTRUM_BANDS},(t,n)=>.18+.16*Math.sin(e*(5+.9*n)+1.7*n)**2)}e.s(["silentVoice",0,ny],234916);var nw=e.i(671228),nb=e.i(67045),nv=e.i(297825),nk=e.i(670097),nj=e.i(640262),nS=e.i(213377),nN=e.i(95187);let nT=(0,nN.createServerReference)("7f0292b3754f6b27ef199fc0934c45970f2b44137a",nN.callServer,void 0,nN.findSourceMapURL,"acceptThreadRelaysAction");var nE=e.i(393080),n_=e.i(609856);let nM=new Set,nA=e=>new Set(nO(e).filter(e=>"question"!==e.kind).map(e=>e.key)),nC={message:"says",question:"asks",report:"reports",interrupted:"was cut off"},nL={question:0,stopped:1,done:2,progress:3};function nR(e){let t=(0,S.captionText)(e.replace(/!\[[^\]]*\]\([^)]*\)/g," ")).replace(S.MARKDOWN_LINK,"$1").replace(/^• /gm,"").trim();if(t.length<=I.CALL_RELAY.chars)return t;let n=t.slice(0,I.CALL_RELAY.chars),r=Math.max(n.lastIndexOf("\n\n"),n.lastIndexOf(". "),n.lastIndexOf(".\n"),n.lastIndexOf("。")),a=(r>I.CALL_RELAY.chars/3?n.slice(0,r+1):n).trim();return`${a}
|
|
4
|
+
[The message goes on; the rest is in its thread on screen.]`}let nI=e=>`question:${e}`;function nO(e){let t=[];for(let n of e){let{relays:e,questions:r}=n.room,a=(0,Y.toDate)(n.updatedAt).getTime(),s=(e,t)=>`[${e} → Thursday, thread "${n.label}" (${n.id}), ${t}.]`,l=(e,t)=>({kind:"relay",name:n.label,line:t,done:!0,bot:e});for(let a of r){let r=a.options?.length?` Options: ${a.options.join(" / ")}.`:"";t.push({rank:nL.question,key:nI(a.id),kind:"question",line:`${s(a.bot,"question")}
|
|
5
|
+
${nR(a.text)}${r}`,relayIds:e.filter(e=>e.messageId===a.id).map(e=>e.id),threadId:n.id,text:a.text,show:l(a.bot,`${a.bot} asks`)})}let i=e.filter(e=>!r.some(t=>t.id===e.messageId)),o="done"===n.status,u="waiting"===n.status&&(0,P.isAppStop)(n.ask);if(o||u){if(n.seen)continue;let e=u?"stopped":"done",r=(u?n.ask?.question:null)??n.outcome??"",o="stopped"===e?`It stopped before finishing. Where it got to: ${nR(r)}`:`Done. Its answer: ${nR(r)}`;t.push({rank:nL[e],key:`${e}:${n.id}@${a}`,kind:"ending",line:`${s(n.bot,e)}
|
|
6
|
+
${o}`,relayIds:i.map(e=>e.id),threadId:n.id,text:r,show:l(n.bot,"stopped"===e?`${n.bot} stopped`:`${n.bot} finished`)});continue}for(let e of i)t.push({rank:nL.progress,key:`progress:${e.id}`,kind:"progress",line:`${s(e.bot,e.kind)}
|
|
7
|
+
${nR(e.text)}`,relayIds:[e.id],threadId:n.id,text:e.text,show:l(e.bot,`${e.bot} ${nC[e.kind]}`)})}return t.sort((e,t)=>e.rank-t.rank)}function nD(e){return"answered"===e.kind?`The user sent a message on screen to ${e.recipient??"the coordinator"} in thread "${e.label}" (${e.id})${e.replyTo?`, replying to ${e.replyTo}`:""}: ${e.answer}. It has reached that participant.`:"stopped"===e.kind?`The user stopped thread "${e.label}" on screen. It is no longer running.`:`The user put ${1===e.paths.length?"a file":`${e.paths.length} files`} down on screen, kept on this computer at ${e.paths.join(", ")}.`}let nP=(0,nN.createServerReference)("7f2372df05e5efe13b1831670e1f2a2139abd4cd0e",nN.callServer,void 0,nN.findSourceMapURL,"endCallAction"),nF=(0,nN.createServerReference)("7f6a1725bfdb5e9e8c83d58353248c43d7e7f8e71c",nN.callServer,void 0,nN.findSourceMapURL,"openTextCallAction"),n$=(0,nN.createServerReference)("7fa248af5b9bfe3ce0997171481c3cedc04c88db62",nN.callServer,void 0,nN.findSourceMapURL,"tellTextCallAction");var nz=e.i(561540);let nB=new nj.DefaultChatTransport({api:v.queryKey.textCall}),nq=()=>nb.useThursdayStore.getState().textModel,nU=e=>({type:`data-${nw.TEXT_CALL_NOTE}`,id:e.id,data:e});async function nK(e,t,n,r){try{let a=await fetch(v.queryKey.toolCall,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({toolCallId:t.id,callId:e,...n,name:t.name,input:t.arguments?JSON.parse(t.arguments):{}}),signal:r}),{output:s}=(0,nE.unwrapResult)(await a.json());return"string"==typeof s?s:JSON.stringify(s??null)}catch(e){return`Error: ${(0,S.errorToString)(e)}`}}var nH=e.i(493003),nW=e.i(807038),nG=e.i(83928),nY=e.i(616172),nV=e.i(621285);function nJ(){return(0,r.jsx)(nV.FileViewer,{children:(0,r.jsx)(n3,{})})}let nX={2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"},nZ="thursday.corner-dismissed";function nQ(){try{let e=JSON.parse(window.localStorage.getItem(nZ)??"[]");return Array.isArray(e)?e:[]}catch{return[]}}function n0(e){try{let t=[...e,...nQ().filter(t=>!e.includes(t))].slice(0,50);window.localStorage.setItem(nZ,JSON.stringify(t))}catch{}}function n1(){"u"<typeof Notification||"default"===Notification.permission&&Notification.requestPermission().catch(()=>void 0)}function n2(e){return{threadId:e.id,label:e.label,bot:e.bot.name,words:(0,S.plainText)(e.outcome??"").slice(0,I.FINISHED_NOTICE.words),paths:(0,nY.leadFirst)((0,nY.pathsIn)(e.outcome??"")),unchecked:!0}}function n5({row:e,children:t}){let n=e.unchecked&&e.paths.length>0,{data:r}=(0,J.useServerRoute)(n?v.queryKey.workspaceFiles(e.paths):null);if(!n)return t(e);if(!r)return null;let a=new Set(r.map(e=>e.path));return t({...e,paths:(0,nY.leadFirst)(e.paths.filter(e=>a.has(e)))})}function n3(){let[e,t]=(0,b.useState)([]),{data:n}=(0,J.useServerRoute)(v.queryKey.bot),a=(0,X.useBotThreads)(),s=(0,nV.useOpenFile)();(0,b.useEffect)(()=>X.fileOpens.subscribe(e=>{s(e)}),[s]),(0,B.useAppEvent)({showFile:e=>s(e.paths[0],e.paths.filter(e=>"image"===(0,nY.viewKindOf)(e)),!0),finished:e=>{!function(e,t,n){if(!("u"<typeof Notification)&&"granted"===Notification.permission&&!("visible"===document.visibilityState&&document.hasFocus()))try{let r=new Notification(t,{body:n,tag:e,icon:"/icon.svg"});r.onclick=()=>{window.focus(),r.close()}}catch{}}(e.threadId,e.label,e.words),t(t=>[{threadId:e.threadId,label:e.label,bot:e.bot,words:e.words,paths:e.paths},...t.filter(t=>t.threadId!==e.threadId)].slice(0,I.FINISHED_NOTICE.rows))}});let l=(0,b.useRef)(new Set);(0,b.useEffect)(()=>{if(!X.botThreads.primed())return;for(let e of a)("done"===e.status||"cancelled"===e.status)&&l.current.add(e.id);let e=new Set(nQ()),n=a.filter(t=>(0,P.isUnread)(t)&&!e.has(t.id)).sort((e,t)=>(0,Y.toDate)(t.updatedAt).getTime()-(0,Y.toDate)(e.updatedAt).getTime()),r=new Set(n.map(e=>e.id));t(e=>{let t=e.filter(e=>!l.current.has(e.threadId)||r.has(e.threadId)),a=[...n.filter(e=>!t.some(t=>t.threadId===e.id)).map(n2),...t].slice(0,I.FINISHED_NOTICE.rows);return a.length===e.length&&a.every((t,n)=>t.threadId===e[n].threadId)?e:a})},[a]);let i=e=>{n0([e]),t(t=>t.filter(t=>t.threadId!==e))};if(!e.length)return null;let o=e.slice(0,I.FINISHED_NOTICE.shown),u=e.slice(I.FINISHED_NOTICE.shown),c=e=>{n0(e),t(t=>t.filter(t=>!e.includes(t.threadId))),(0,nH.markSeenAction)(e).then(nE.unwrapResult).then(()=>(0,J.revalidate)(v.queryKey.threads)).catch(t=>L.toast.add({type:"error",title:e.length>1?"Could not mark the threads as read":"Could not mark the thread as read",description:(0,S.errorToString)(t)}))};return(0,r.jsx)("div",{className:"pointer-events-none relative col-start-1 row-start-2 w-82 max-w-full",children:(0,r.jsxs)("div",{className:"pointer-events-auto absolute bottom-0 left-0 -m-2 flex max-h-[80vh] w-82 max-w-full flex-col-reverse gap-2 overflow-y-auto p-2 scrollbar-none",children:[o.map(e=>(0,r.jsx)(n5,{row:e,children:e=>(0,r.jsx)(n6,{row:e,bot:n?.find(t=>t.name===e.bot),onOpen:t=>{t?(s(t,e.paths.filter(e=>"image"===(0,nY.viewKindOf)(e)),!1,e.threadId),c([e.threadId])):(X.roomOpens.open(e.threadId),i(e.threadId))},onClose:()=>i(e.threadId)})},e.threadId)),u.map(e=>(0,r.jsx)(n5,{row:e,children:e=>(0,r.jsx)(n4,{row:e,bot:n?.find(t=>t.name===e.bot),onOpen:()=>{X.roomOpens.open(e.threadId),i(e.threadId)},onClose:()=>i(e.threadId)})},e.threadId)),e.length>1&&(0,r.jsxs)("p",{className:"flex shrink-0 items-center gap-2 px-1.5 font-mono text-[10px] text-muted-foreground",children:[(0,r.jsxs)("span",{children:[e.length," new"]}),(0,r.jsx)("span",{className:"flex-1"}),(0,r.jsx)("button",{type:"button",onClick:()=>c(e.map(e=>e.threadId)),className:"rounded-md px-1 font-sans text-[11px] outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:"Clear all"})]})]})})}function n4({row:e,bot:t,onOpen:n,onClose:a}){let s=e.paths.length-3;return(0,r.jsxs)("div",{className:"flex shrink-0 animate-in items-center gap-2 rounded-2xl bg-background py-1.5 pr-1.5 pl-2.5 shadow-black/8 shadow-md ring-1 ring-border fade-in slide-in-from-bottom-1 duration-300",children:[(0,r.jsxs)("button",{type:"button",onClick:n,className:"flex min-w-0 flex-1 items-center gap-2 rounded-lg text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,r.jsx)(F.BotMark,{size:18,seed:e.bot,color:t?.icon?.color,shape:t?.icon?.shape,outline:t?.icon?.outline,paint:t?.icon?.paint,notify:!1,className:"shrink-0"}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] leading-5",children:e.label}),e.paths.length>0&&(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[e.paths.slice(0,3).map(e=>(0,r.jsx)(nG.FileThumb,{path:e,glyph:"size-2.5",className:"size-5 rounded-[6px] ring-1 ring-border"},e)),s>0&&(0,r.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",s]})]})]}),(0,r.jsx)(k.Button,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:a,className:"shrink-0 text-muted-foreground",children:(0,r.jsx)(w.X,{})})]})}function n6({row:e,bot:t,onOpen:n,onClose:a}){let s,l=(s=e.paths.length)<=2?2:3===s?3:4,i=e.paths.slice(0,l),o=e.paths.length-i.length;return(0,r.jsxs)("div",{className:"flex shrink-0 animate-in gap-2.5 rounded-[20px] bg-background py-2.5 pr-2 pl-2.5 shadow-black/10 shadow-lg ring-1 ring-border fade-in slide-in-from-bottom-2 duration-300",children:[(0,r.jsx)(F.BotMark,{size:32,seed:e.bot,color:t?.icon?.color,shape:t?.icon?.shape,outline:t?.icon?.outline,paint:t?.icon?.paint,notify:!1,className:"shrink-0"}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[(0,r.jsxs)("div",{className:"flex items-start gap-1",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>n(e.paths[0]??null),className:"flex min-w-0 flex-1 flex-col gap-1.5 rounded-lg text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,r.jsxs)("span",{className:"flex min-h-8 flex-col justify-center",children:[(0,r.jsx)("span",{className:"truncate font-medium text-[14px] leading-5 tracking-[-0.15px]",children:e.label}),(0,r.jsx)("span",{className:"truncate font-mono text-[10px] leading-[13px] text-muted-foreground",children:e.bot})]}),e.words&&(0,r.jsx)("span",{className:"line-clamp-2 break-keep wrap-anywhere text-[12.5px] leading-normal text-muted-foreground",children:(0,nW.shortenPaths)(e.words)})]}),(0,r.jsx)(k.Button,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:a,className:"shrink-0 text-muted-foreground",children:(0,r.jsx)(w.X,{})})]}),i.length>0&&(0,r.jsx)("div",{className:(0,S.cn)("grid gap-1.5 pt-0.5",nX[l]),children:i.map((e,t)=>(0,r.jsxs)("button",{type:"button",title:e.split("/").pop(),onClick:()=>n(e),className:"relative rounded-[10px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,r.jsx)(nG.FileThumb,{path:e,glyph:2===l?"size-6":"size-4",className:"aspect-square w-full rounded-[10px] ring-1 ring-border"}),o>0&&t===i.length-1&&(0,r.jsxs)("span",{className:"absolute inset-0 grid place-items-center rounded-[10px] bg-black/45 font-medium text-[14px] text-white",children:["+",o]})]},e))})]})]})}e.s(["ArtifactView",0,nJ,"FinishedCard",0,n6,"askToNotify",0,n1],895499);let n7={"not-allowed":"The microphone is not allowed","service-not-allowed":"The microphone is not allowed","audio-capture":"There is no microphone","language-not-supported":"This browser cannot listen in that language"},n9=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,"").split(/\s+/).filter(Boolean),n8=(e,t,n)=>Math.abs(e.length-t.length)<=n&&function(e,t){let n=Array.from({length:e.length+1},(e,t)=>t),r=Array(e.length+1).fill(0);for(let a=1;a<=t.length;a++){r[0]=a;for(let s=1;s<=e.length;s++){let l=n[s-1]+ +(t[a-1]!==e[s-1]);r[s]=Math.min(l,n[s]+1,r[s-1]+1)}[n,r]=[r,n]}return n[e.length]}(e,t)<=n;function re({enabled:e,onWake:t,phrases:n,onError:r}){let a=(0,b.useRef)({onWake:t,onError:r,phrases:n});a.current={onWake:t,onError:r,phrases:n},(0,b.useEffect)(()=>{if(!e)return;let t=window,n=t.SpeechRecognition??t.webkitSpeechRecognition;if(!n)return void a.current.onError?.("This browser cannot listen for a wake word");let r=new n,s=!0,l=!0,i=null,o=300;r.lang="en-US",r.continuous=!0,r.interimResults=!0,r.maxAlternatives=3;let u=()=>{if(s){l=!0;try{r.start()}catch{}}};return r.onresult=({resultIndex:e,results:t})=>{if(!s||!l)return;o=300;let{phrases:n,onWake:i}=a.current,u=n.map(n9).filter(e=>e.length);for(let n=e;n<t.length;n++){let e=t[n];for(let t=0;t<e.length;t++){let n=e[t].transcript,a=n9(n);if(u.some(e=>(function(e,t,n){for(let r=0;r<e.length;r++)if(function e(t,n,r,a,s){if(a===r.length)return!0;if(n>=t.length)return!1;let l=r[a],i=Math.max(1,Math.round(l.length*s));return!!(n8(t[n],l,i)&&e(t,n+1,r,a+1,s))||n+1<t.length&&n8(t[n]+t[n+1],l,i)&&e(t,n+2,r,a+1,s)}(e,r,t,0,n))return!0;return!1})(a,e,I.WAKE_TOLERANCE))){l=!1,r.abort(),i(n.trim());return}}}},r.onerror=({error:e})=>{let t=n7[e];t?(s=!1,a.current.onError?.(t)):"network"===e&&(o=Math.min(2*o,1e4))},r.onend=()=>{s&&(i=setTimeout(u,o))},u(),()=>{s=!1,i&&clearTimeout(i),r.onresult=null,r.onerror=null,r.onend=null,r.abort()}},[e])}e.s(["useWakeWord",0,re],656572);let rt={silent:{level:-1},fatal:{level:0},error:{level:0},warn:{level:1},log:{level:2},info:{level:3},success:{level:3},fail:{level:3},ready:{level:3},start:{level:3},box:{level:3},debug:{level:4},trace:{level:5},verbose:{level:1/0}};function rn(e){if(null===e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.iterator in e)&&(!(Symbol.toStringTag in e)||"[object Module]"===Object.prototype.toString.call(e))}let rr=!1,ra=[];class rs{options;_lastLog;_mockFn;constructor(e={}){const t=e.types||rt;for(const n in this.options=((...e)=>e.reduce((e,t)=>(function e(t,n,r=".",a){if(!rn(n))return e(t,{},r,a);let s=Object.assign({},n);for(let n in t){if("__proto__"===n||"constructor"===n)continue;let l=t[n];null!=l&&(a&&a(s,n,l,r)||(Array.isArray(l)&&Array.isArray(s[n])?s[n]=[...l,...s[n]]:rn(l)&&rn(s[n])?s[n]=e(l,s[n],(r?`${r}.`:"")+n.toString(),a):s[n]=l))}return s})(e,t,"",void 0),{}))({...e,defaults:{...e.defaults},level:rl(e.level,t),reporters:[...e.reporters||[]]},{types:rt,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}}),t){const e={type:n,...this.options.defaults,...t[n]};this[n]=this._wrapLogFn(e),this[n].raw=this._wrapLogFn(e,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=rl(e,this.options.types,this.options.level)}prompt(e,t){if(!this.options.prompt)throw Error("prompt is not supported!");return this.options.prompt(e,t)}create(e){let t=new rs({...this.options,...e});return this._mockFn&&t.mockTypes(this._mockFn),t}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let t=this.options.reporters.indexOf(e);if(-1!==t)return this.options.reporters.splice(t,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(e,t){e&&(e.__write||(e.__write=e.write),e.write=e=>{this[t].raw(String(e).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){rr=!0}resumeLogs(){for(let e of(rr=!1,ra.splice(0)))e[0]._logFn(e[1],e[2])}mockTypes(e){let t=e||this.options.mockFn;if(this._mockFn=t,"function"==typeof t)for(let e in this.options.types)this[e]=t(e,this.options.types[e])||this[e],this[e].raw=this[e]}_wrapLogFn(e,t){return(...n)=>rr?void ra.push([this,e,n,t]):this._logFn(e,n,t)}_logFn(e,t,n){var r,a;if((e.level||0)>this.level)return!1;let s={date:new Date,args:[],...e,level:rl(e.level,this.options.types)};n||1!==t.length||+(a=r=t[0],"[object Object]"!==Object.prototype.toString.call(a)||!r.message&&!r.args||!!r.stack)?s.args=[...t]:Object.assign(s,t[0]),s.message&&(s.args.unshift(s.message),delete s.message),s.additional&&(Array.isArray(s.additional)||(s.additional=s.additional.split("\n")),s.args.push("\n"+s.additional.join("\n")),delete s.additional),s.type="string"==typeof s.type?s.type.toLowerCase():"log",s.tag="string"==typeof s.tag?s.tag:"";let l=(e=!1)=>{let t=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&t>0){let e=[...this._lastLog.object.args];t>1&&e.push(`(repeated ${t} times)`),this._log({...this._lastLog.object,args:e}),this._lastLog.count=1}e&&(this._lastLog.object=s,this._log(s))};clearTimeout(this._lastLog.timeout);let i=this._lastLog.time&&s.date?s.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=s.date,i<this.options.throttle)try{let e=JSON.stringify([s.type,s.tag,s.args]),t=this._lastLog.serialized===e;if(this._lastLog.serialized=e,t&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(l,this.options.throttle);return}}catch{}l(!0)}_log(e){for(let t of this.options.reporters)t.log(e,{options:this.options})}}function rl(e,t={},n=3){return void 0===e?n:"number"==typeof e?e:t[e]&&void 0!==t[e].level?t[e].level:n}rs.prototype.add=rs.prototype.addReporter,rs.prototype.remove=rs.prototype.removeReporter,rs.prototype.clear=rs.prototype.removeReporter,rs.prototype.withScope=rs.prototype.withTag,rs.prototype.mock=rs.prototype.mockTypes,rs.prototype.pause=rs.prototype.pauseLogs,rs.prototype.resume=rs.prototype.resumeLogs;class ri{options;defaultColor;levelColorMap;typeColorMap;constructor(e){this.options={...e},this.defaultColor="#7f8c8d",this.levelColorMap={0:"#c0392b",1:"#f39c12",3:"#00BCD4"},this.typeColorMap={success:"#2ecc71"}}_getLogFn(e){return e<1?console.__error||console.error:1===e?console.__warn||console.warn:console.__log||console.log}log(e){let t=this._getLogFn(e.level),n="log"===e.type?"":e.type,r=e.tag||"",a=this.typeColorMap[e.type]||this.levelColorMap[e.level]||this.defaultColor,s=`
|
|
8
|
+
background: ${a};
|
|
9
|
+
border-radius: 0.5em;
|
|
10
|
+
color: white;
|
|
11
|
+
font-weight: bold;
|
|
12
|
+
padding: 2px 0.5em;
|
|
13
|
+
`,l=`%c${[r,n].filter(Boolean).join(":")}`;"string"==typeof e.args[0]?t(`${l}%c ${e.args[0]}`,s,"",...e.args.slice(1)):t(l,s,...e.args)}}function ro(e={}){return function(e={}){return new rs(e)}({reporters:e.reporters||[new ri({})],prompt:(e,t={})=>"confirm"===t.type?Promise.resolve(confirm(e)):Promise.resolve(prompt(e)),...e})}ro();var ru=e.i(247167),rc=e.i(379227);let{env:rd={},argv:rh=[],platform:rp=""}=void 0===ru.default?{}:ru.default,rm="NO_COLOR"in rd||rh.includes("--no-color"),rf="FORCE_COLOR"in rd||rh.includes("--color"),rg="dumb"===rd.TERM,rx=rc&&rc.isatty&&rc.isatty(1)&&rd.TERM&&!rg,ry="CI"in rd&&("GITHUB_ACTIONS"in rd||"GITLAB_CI"in rd||"CIRCLECI"in rd),rw=!rm&&(rf||"win32"===rp&&!rg||rx||ry);function rb(e,t,n){return function(e,t,n=e,r=e.length+1){return a=>{var s;return a||""!==a&&void 0!==a?(s=(""+a).indexOf(t,r),s<0?e+a+t:e+function e(t,n,r,a,s=n.slice(0,Math.max(0,t))+a,l=n.slice(Math.max(0,t+r.length)),i=l.indexOf(r)){return s+(i<0?l:e(i,l,r,a))}(s,a,t,n)+t):""}}(`\x1b[${e}m`,`\x1b[${t}m`,n)}let rv={reset:rb(0,0),bold:rb(1,22,"\x1b[22m\x1b[1m"),dim:rb(2,22,"\x1b[22m\x1b[2m"),italic:rb(3,23),underline:rb(4,24),inverse:rb(7,27),hidden:rb(8,28),strikethrough:rb(9,29),black:rb(30,39),red:rb(31,39),green:rb(32,39),yellow:rb(33,39),blue:rb(34,39),magenta:rb(35,39),cyan:rb(36,39),white:rb(37,39),gray:rb(90,39),bgBlack:rb(40,49),bgRed:rb(41,49),bgGreen:rb(42,49),bgYellow:rb(43,49),bgBlue:rb(44,49),bgMagenta:rb(45,49),bgCyan:rb(46,49),bgWhite:rb(47,49),blackBright:rb(90,39),redBright:rb(91,39),greenBright:rb(92,39),yellowBright:rb(93,39),blueBright:rb(94,39),magentaBright:rb(95,39),cyanBright:rb(96,39),whiteBright:rb(97,39),bgBlackBright:rb(100,49),bgRedBright:rb(101,49),bgGreenBright:rb(102,49),bgYellowBright:rb(103,49),bgBlueBright:rb(104,49),bgMagentaBright:rb(105,49),bgCyanBright:rb(106,49),bgWhiteBright:rb(107,49)},rk=function(e=rw){return e?rv:Object.fromEntries(Object.keys(rv).map(e=>[e,String]))}();[String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");let rj=ro({level:I.IS_DEV?4:3}),rS=(t=I.APP_NAME,rj.withDefaults({message:(n=`${t}: `,(function(e,t="reset"){return rk[e]||rk[t]})("blackBright")(n))}));var rN=e.i(413168);let rT={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},rE=new TextEncoder;async function r_(e){let t=rA(e);try{return await t.connect(),t}catch(e){throw await t.close(),e}}let rM=["response.completed","response.failed","response.incomplete","response.cancelled"],rA=({initialize:e,audio:t,on:n})=>{let r,a,s,l,i,o,u,c,d,h=!1,p=!1,m=!1,f=0,g=0,x="",y=[],w=new Set,b=new Set,v=new Set,k=new Map,j=!1,N=new Map,T=new Map,E=[],_=null,M=-1/0,A=null,C=()=>{clearTimeout(d),!A||A.unmute||m||p||(A.unmute=crypto.randomUUID(),U.send({type:"session.input_audio.unmute",event_id:A.unmute}))},L=()=>{for(let e of(clearTimeout(u),u=void 0,w))n.turn({...e.turn,fragments:[...e.fragments],done:!0});w.clear()},R=()=>{if(!m){for(let e of(m=!0,clearTimeout(i),clearTimeout(c),clearTimeout(d),clearInterval(o),L(),_=null,E.splice(0)))e.settle(!1);U.close(),s?.()}},O=e=>{a?.(Error(e)),R(),h&&!p?n.failed(e):p&&n.warn(e)},D=-1/0,P=()=>{if(m||p)return;let e=performance.now(),r=t.levels?.();r&&r.output>.01&&(M=e);let a={speaking:e-M<300,working:[...k.values()].some(e=>!e.terminal)||T.size>0||e-D<5e3,tools:[...T.values()]},s=JSON.stringify(a);(s!==x||a.speaking||a.working)&&(x=s,n.activity(a))},F=()=>{if(!h||m||p||_||!E.length)return;let[e]=E;_=crypto.randomUUID(),U.send({type:`session.${e.kind}.append`,event_id:_,delegation_id:null,content:e.chunks[0]}),c=setTimeout(()=>{n.warn("Live did not acknowledge the conversation update; delivery is unknown."),$(!1)},I.LIVE_CALL.appendMs)},$=e=>{clearTimeout(c),_=null;let[t]=E;t&&(e&&t.chunks.shift(),e&&t.chunks.length||(E.shift(),t.settle(e)),F())},z=(e,t)=>{if(!e.delta||void 0===e.start_ms||void 0===e.end_ms)return;let r=e.start_ms,a=e.end_ms,s=y.findLast(e=>e.turn.role===t&&r>=e.turn.seq-I.LIVE_CALL.transcriptGapMs&&r<=e.end+I.LIVE_CALL.transcriptGapMs&&("user"===t||!y.some(t=>"user"===t.turn.role&&t.turn.seq>e.turn.seq&&t.turn.seq<r)));s||(s={turn:{id:`live-${g++}`,role:t,text:"",seq:r,done:!1},end:a,fragments:[]},y.push(s)),s.fragments.push({start:r,end:a,text:e.delta}),s.fragments.sort((e,t)=>e.start-t.start),s.end=Math.max(s.end,a),s.turn.text=s.fragments.map(e=>e.text).join(""),n.turn({...s.turn,done:!1}),w.add(s),u??=setTimeout(L,I.LIVE_CALL.transcriptSaveMs)},B=async e=>{if(e.terminal&&!e.continued&&e.calls.size){if(e.continued=!0,await Promise.all(e.calls.values()),!p&&!m){for(let t of e.images.splice(0))q(t);D=performance.now(),U.send({type:"response.create",event_id:crypto.randomUUID()})}P()}},q=e=>{try{U.send({type:"response.item.create",event_id:crypto.randomUUID(),item:{type:"message",role:"user",content:[{type:"input_image",image_url:e}]}})}catch(r){let t=(0,S.errorToString)(r);rS.warn("Live picture not sent",{reason:t,bytes:e.length}),U.send({type:"response.item.create",event_id:crypto.randomUUID(),item:{type:"message",role:"developer",content:[{type:"input_text",text:`The picture of their screen did not go through, so nothing on it was seen: ${t}`}]}}),n.warn(`The picture of your screen did not go through: ${t}`)}},U=function({negotiate:e,audio:t,on:n}){let r,a,s=null,l=null,i=null,o=!1,u=!1,c=!1,d=e=>{for(let t of e?.getTracks()??[])t.stop()};return{async connect(){let h=new RTCPeerConnection;s=h;let p=h.createDataChannel("oai-events");l=p;let m=new Promise((e,t)=>{r=t;let a=e=>{o||c||(c=!0,u?n.dropped(e):t(Error(e)))};p.onopen=()=>{u=!0,e()},p.onclose=()=>a("The connection to OpenAI Live closed."),p.onerror=()=>a("The connection to OpenAI Live dropped."),h.onconnectionstatechange=()=>{["failed","closed"].includes(h.connectionState)&&a("Could not reach OpenAI Live.")}});m.catch(()=>{}),p.onmessage=({data:e})=>{let t;if(!o&&"string"==typeof e){try{t=JSON.parse(e)}catch{n.dropped("OpenAI Live sent an unreadable event.");return}n.event(t)}},h.ontrack=e=>{if(o)return;let n=e.streams[0]??new MediaStream([e.track]);t.element.srcObject=n,t.listen(n)};let f=await navigator.mediaDevices.getUserMedia({audio:rT});if(o)throw d(f),Error("The call closed before connecting.");for(let e of(i=f,t.hear?.(f),f.getAudioTracks()))h.addTrack(e,f);await h.setLocalDescription(await h.createOffer()),"complete"!==h.iceGatheringState&&await new Promise((e,t)=>{let n=n=>{clearTimeout(s),h.removeEventListener("icegatheringstatechange",r),a=void 0,n?t(n):e()},r=()=>{"complete"===h.iceGatheringState&&n()},s=setTimeout(()=>n(Error("ICE gathering timed out.")),1e4);a=()=>n(Error("The call closed before connecting.")),h.addEventListener("icegatheringstatechange",r),r()});let g=h.localDescription?.sdp;if(!g||o)throw Error("No live SDP offer is available.");let x=await e(g);if(o)throw Error("The call closed before connecting.");await h.setRemoteDescription({type:"answer",sdp:x}),await m},send(e){o||l?.readyState!=="open"||l.send(JSON.stringify(e))},limit:()=>s?.sctp?.maxMessageSize??null,close:()=>{o||(o=!0,r?.(Error("The call closed before connecting.")),a?.(),d(i),i=null,l?.close(),s?.close(),t.element.srcObject=null)}}}({audio:t,negotiate:async t=>{let n=await e(t);if(!n)throw Error("OpenAI Live returned no SDP answer.");return n},on:{event:e=>{if(!m){if(e.event_id){if(b.has(e.event_id))return;b.add(e.event_id)}switch(f=Math.max(f,e.offset_ms??0,e.end_ms??0),e.type){case"session.started":h=!0,r?.(),F();break;case"session.closed":n.finalized?.({reason:e.reason??"closed",seconds:e.usage?.seconds??null}),rS.info("Live session closed",{reason:e.reason,seconds:e.usage?.seconds}),a?.(Error("OpenAI Live closed before startup completed.")),R(),p||n.failed(`The Live call ended (${e.reason??"closed"}).`);break;case"session.input_transcript.delta":z(e,"user");break;case"session.output_transcript.delta":C(),z(e,"assistant");break;case"session.input_audio.unmuted":A&&e.client_event_id===A.unmute&&(A=null);break;case"session.instructions.appended":case"session.commentary.appended":case"session.thinking.appended":_&&e.client_event_id===_&&$(!0);break;case"error":{let t=e.error?.message??"OpenAI Live reported an error.";if(!h){O(t);break}if(A?.unmute&&e.error?.client_event_id===A.unmute){O(`She could not hear the microphone again: ${t}`);break}for(let r of(A&&e.error?.client_event_id===A.mute&&(clearTimeout(d),A=null),n.warn(t),_&&e.error?.client_event_id===_&&$(!1),k.values()))r.terminal||r.calls.size||(r.terminal=!0,r.stale=!0);P();break}case"response.event":{let t=e.event;if(!t||p)break;"response.created"===t.type&&(D=-1/0),"response.created"===t.type&&t.response&&e.delegation_id&&N.set(e.delegation_id,t.response.id);let r=t.response?.id??t.response_id??(e.delegation_id?N.get(e.delegation_id):void 0);if(!r)break;let a=k.get(r);if(a||(a={calls:new Map,images:[],terminal:!1,continued:!1},k.set(r,a)),a.stale&&!rM.includes(t.type)&&(a.stale=!1,a.terminal=!1),"response.reasoning_summary_text.done"===t.type&&n.reasoning?.({id:`${t.item_id}:${t.summary_index??0}`,text:t.text??"",seq:f}),("response.output_item.added"===t.type||"response.output_item.done"===t.type)&&t.item?.type===rN.LIVE_HOSTED_TOOLS.webSearch.item){let e=t.item,a="response.output_item.done"===t.type;a&&rS.debug("Live web search",e),n.search?.({id:e.id,responseId:r,query:(e.action?.query??e.action?.queries?.join(" · "))?.trim()||null,sources:[...new Set((e.action?.sources??[]).flatMap(e=>e.url?[e.url]:[]))].map(e=>({url:e})),done:a,seq:f})}if("response.output_item.done"===t.type&&t.item?.type==="message"){let e=function(e){let t=new Map;for(let n of e??[])for(let e of n.annotations??[])"url_citation"===e.type&&e.url&&!t.has(e.url)&&t.set(e.url,{url:e.url,...e.title?{title:e.title}:{}});return[...t.values()]}(t.item.content);e.length&&n.cited?.(r,e)}if("response.output_item.done"===t.type&&t.item?.type==="function_call"){let e=t.item;if(v.has(e.call_id))break;if(v.add(e.call_id),"incomplete"===e.status){a.terminal=!0,rS.warn("Live backend call cut off; not run",{responseId:r,name:e.name,arguments:e.arguments.slice(0,200)}),a.calls.size&&!j?(j=!0,B(a)):a.continued=!0;break}n.turn({id:e.id,role:"tool",tool:e.name,text:e.arguments,seq:f,done:!0}),L(),T.set(e.call_id,e.name);let s=Promise.resolve().then(()=>n.runTool({id:e.call_id,name:e.name,arguments:e.arguments,item:e.id})).catch(e=>`Error: ${(0,S.errorToString)(e)}`).then(t=>{T.delete(e.call_id);let{output:n,image:r}="string"==typeof t?{output:t}:t;m||p||(U.send({type:"response.item.create",event_id:crypto.randomUUID(),item:{type:"function_call_output",call_id:e.call_id,output:n}}),r&&a.images.push(r)),P()});a.calls.set(e.call_id,s),B(a)}rM.includes(t.type)&&(a.terminal=!0,a.stale=!1,"response.completed"===t.type?(j=!1,rS.debug("Live backend usage",{responseId:r,usage:t.response?.usage}),B(a)):"response.incomplete"===t.type&&a.calls.size&&!j?(j=!0,rS.warn("Live backend response incomplete; continuing once",{responseId:r}),B(a)):(j=!1,a.continued=!0,n.warn(t.response?.error?.message??`The Live backend ${t.type.slice(9)}.`)))}}P()}},dropped:O}});return{async connect(){t.element.muted=!1;let e=new Promise((e,t)=>{r=e,a=t});e.catch(()=>{});let n=setTimeout(()=>O("OpenAI Live did not start in time."),I.LIVE_CALL.startupMs);try{if(await Promise.all([U.connect(),e]),m)throw Error("The Live call closed during startup.");o=setInterval(P,100)}catch(e){throw R(),e}finally{clearTimeout(n),a=void 0}},close:()=>l||(m?Promise.resolve():(p=!0,L(),h)?(l=new Promise(e=>{s=e}),i=setTimeout(()=>{n.warn("Live disconnected without confirming final session usage."),R()},I.LIVE_CALL.closeMs),t.element.muted=!0,U.send({type:"session.close",event_id:crypto.randomUUID()}),l):(R(),Promise.resolve())),append(e,t){let n=function(e){let t=[],n="",r=0,a=e=>{let a=rE.encode(e).length;if(r+a>480&&n&&(t.push(n),n="",r=0),a<=480){n+=e,r+=a;return}for(let a of e){let e=rE.encode(a).length;r+e>480&&(t.push(n),n="",r=0),n+=a,r+=e}};for(let t of e.split(/(?<=\s)/))a(t);return n&&t.push(n),t}(t);return m||p||!n.length?Promise.resolve(!1):new Promise(t=>{E.push({kind:e,chunks:n,settle:t}),F()})},holdInput(e){!h||m||p||A||e<=0||(A={mute:crypto.randomUUID(),unmute:null},U.send({type:"session.input_audio.mute",event_id:A.mute}),d=setTimeout(C,e))},messageLimit:()=>U.limit(),brief(e){let t=e.trim();m||p||!t||U.send({type:"response.item.create",event_id:crypto.randomUUID(),item:{type:"message",role:"developer",content:[{type:"input_text",text:t}]}})}}};var rC=e.i(567334);let rL=["NIGHT","G'NIGHT","NITE","SLEEP ♥","ZZZ","BYE"],rR=[[22,rL],[17,["BYE","SEE YA","LATER","SO LONG","BYE ♥","CIAO"]],[11,["BYE","SEE YA","LATER","CIAO","BYE BYE","PEACE"]],[5,["ENJOY!","SEE YA","BYE","LATER","CIAO"]],[0,rL]],rI=(e,t)=>({text:e,at:Date.now(),hold:t});function rO(e=new Date){let t,n=e.getHours();return rI((t=rR.find(([e])=>n>=e)?.[1]??["BYE"])[Math.floor(Math.random()*t.length)],1.6)}let rD=()=>rI("OK",1);e.s(["awake",0,()=>rI("HI",1.6),"finished",0,rD,"goodbye",0,rO],114923);let rP=(0,nN.createServerReference)("7f98cc1261b595f96b2ec64e40874fe7561c77a354",nN.callServer,void 0,nN.findSourceMapURL,"openCallAction"),rF=(0,nN.createServerReference)("7f167531c9536d3d71efe6248868aca0a971ec420e",nN.callServer,void 0,nN.findSourceMapURL,"saveThoughtAction"),r$=(0,nN.createServerReference)("7f6419fc88f38db29e28fd89cc70ec8ad8848a2f6e",nN.callServer,void 0,nN.findSourceMapURL,"saveTurnsAction");class rz extends Error{}let rB=Array(nx.SPECTRUM_BANDS).fill(0),rq=!1;function rU(e){let t=e.replace(/\[[^\]]*\]?|\]/g,"").trim();return/[\p{L}\p{N}]/u.test(t)?t:""}function rK(e,t,n="This call is not being saved"){e.failures>=I.CALL_PAGE.saveFailures||t().then(e=>(0,nE.unwrapResult)(e)).catch(t=>{e.failures+=1,e.failures===I.CALL_PAGE.saveFailures&&L.toast.add({type:"warning",title:n,description:(0,S.errorToString)(t)})})}var rH=e.i(520722);let rW=new Intl.Segmenter(void 0,{granularity:"grapheme"}),rG=e=>Array.from(rW.segment(e)).length;function rY({text:e,animate:t}){let{shown:n,links:a}=(0,b.useMemo)(()=>{let t=[],n="",r=0;for(let a of e.matchAll(S.MARKDOWN_LINK)){let s=rG(n+=e.slice(r,a.index));n+=a[1],t.push({from:s,to:rG(n),href:a[2]}),r=a.index+a[0].length}return{shown:n+e.slice(r),links:t}},[e]);if(t)return(0,r.jsx)(_,{text:n,wraps:a.map(e=>({from:e.from,to:e.to,render:t=>(0,r.jsx)(rJ,{href:e.href,children:t})}))});let s=Array.from(rW.segment(n),e=>e.segment),l=[],i=0;for(let e of a)l.push(s.slice(i,e.from).join("")),l.push((0,r.jsx)(rJ,{href:e.href,children:s.slice(e.from,e.to).join("")},e.from)),i=e.to;return l.push(s.slice(i).join("")),(0,r.jsx)(r.Fragment,{children:l})}let rV="pointer-events-auto underline decoration-current/35 underline-offset-4 transition-colors hover:decoration-current";function rJ({href:e,children:t}){let[n]=(0,n_.useServerAction)(rH.openFileAction);if(/^https?:\/\//i.test(e))return(0,r.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",className:rV,onClick:e=>e.stopPropagation(),children:t});let a=(0,nY.workspaceRelative)(e);return a?(0,r.jsx)("a",{href:v.queryKey.fileView(a),className:rV,onClick:t=>{t.preventDefault(),t.stopPropagation();let r=(0,nV.fileTarget)(e);"os"===r.how?n(e):X.fileOpens.open(r.path)||window.open(v.queryKey.fileView(r.path),"_blank")},children:t}):t}var rX=e.i(174080),rZ=e.i(877267);let rQ="700 9px ui-monospace, SFMono-Regular, Menlo, monospace",r0=Math.ceil(13.5);function r1(e){let t=document.createElement("canvas");t.width=r0*e.length,t.height=r0;let n=t.getContext("2d");return n?(n.textAlign="center",n.textBaseline="middle",n.font=rQ,e.forEach((e,t)=>{n.fillText(e,t*r0+r0/2,r0/2)}),t):null}function r2({status:e}){let t=(0,b.useRef)(null),n=(0,b.useRef)(null),a=(0,b.useRef)(e),[s,l]=(0,b.useState)(!1),i=(0,b.useRef)(null);return(0,b.useEffect)(()=>{"emoji"===(0,rZ.faceGlyphs)()&&(i.current=r1(rC.EMOJI_POOL))},[]),(0,b.useEffect)(()=>{let t=a.current;a.current=e,"connecting"!==t||"connecting"===e||"idle"===e||"ending"===e||window.matchMedia("(prefers-reduced-motion: reduce)").matches||l(!0)},[e]),(0,b.useEffect)(()=>{let e=n.current,r=t.current?.getBoundingClientRect();if(!s||!e||!r)return;let a=window.innerWidth,o=window.innerHeight,u=r.left+r.width/2,c=r.top+r.height/2,d=Math.hypot(Math.max(u,a-u),Math.max(c,o-c)),h=Math.ceil(a/11),p=Math.ceil(o/11),m=[];for(let e=0;e<p;e++)for(let t=0;t<h;t++){if((0,rC.hash)(t+53,e+5)>.4)continue;let n=11*t+5.5,r=11*e+5.5,a=Math.atan2(r-c,n-u),s=(0,rC.hash)(t+31,e+17),l=Math.hypot(n-u,r-c)/d*(1+.1*Math.sin(3*a+1.3)+.05*Math.sin(7*a-.7)+(s-.5)*.1);l<.1||m.push({x:n,y:r,dd:l,seed:(0,rC.hash)(t,e),grain:s,speck:(0,rC.hash)(t+7,e+101)})}m.sort((e,t)=>e.dd-t.dd);let f=e=>{let t=0,n=m.length;for(;t<n;){let r=t+n>>1;m[r].dd<e?t=r+1:n=r}return t};e.width=a,e.height=o;let g=e.getContext("2d"),x="letters"===(0,rZ.faceGlyphs)(),y=x?null:i.current??r1(rC.EMOJI_POOL);if(!g||!x&&!y)return;x&&(g.textAlign="center",g.textBaseline="middle",g.font=rQ,g.fillStyle=getComputedStyle(e).color);let w=rC.LEVELS-1,b=x?rC.CHAR_RATE:rC.EMOJI_CHAR_RATE,v=r0/2,k=performance.now(),j=0,S=0,N=()=>{let e=(performance.now()-k)/1e3;if(e>1.9736842105263157)return l(!1);if(S=requestAnimationFrame(N),j++%2)return;let t=.95*e;g.clearRect(0,0,a,o);for(let n=f(t-.2-.475);n<m.length;n++){let r=m[n],a=t-r.dd;if(a<-.03)break;let s=(0,rC.smoothstep)(-.03,.02,a)*(1-(0,rC.smoothstep)(.02,.2,a))*(.72+.28*Math.sin(46*r.dd-7*e+6.283*r.seed));if(r.speck<.06){let e=.18+.32*r.grain,t=(a-.2)/.95;s=Math.max(s,(.3+.4*r.grain)*(1-(0,rC.smoothstep)(.4*e,e,t)))}let l=Math.round(s*w);if(l<1)continue;let i=Math.floor(e*b+10*r.seed);if(y){g.globalAlpha=(0,rC.emojiAlpha)(l,w);let e=Math.floor((0,rC.hash)(97*r.seed,i)*rC.EMOJI_POOL.length);g.drawImage(y,e*r0,0,r0,r0,r.x-v,r.y-v,r0,r0);continue}g.globalAlpha=rC.ALPHA_TOP*(l/w);let o=rC.RAMP[l];g.fillText(o[Math.floor((0,rC.hash)(131*r.seed,i)*o.length)],r.x,r.y)}g.globalAlpha=1};return S=requestAnimationFrame(N),()=>cancelAnimationFrame(S)},[s]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{ref:t,"aria-hidden":!0,className:"pointer-events-none absolute inset-0"}),s&&(0,rX.createPortal)((0,r.jsx)("canvas",{ref:n,"aria-hidden":!0,className:"pointer-events-none fixed inset-0 z-30 size-full text-foreground"}),document.body)]})}var r5=e.i(333495);function r3(e){let t=[];for(let n of e){let e=t.at(-1);e?.role!==n.role||n.fresh?t.push({id:n.id,role:n.role,text:n.text}):e.text=`${e.text} ${n.text}`}return t}let r4={assistant:null,user:null};function r6(e,t){let[n,r]=(0,b.useState)(r4);return(0,b.useEffect)(()=>{t||r(r4)},[t]),(0,b.useEffect)(()=>{if(!t)return;let e=e=>{"ArrowDown"!==e.key||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(0,G.windowKey)(e)&&(e.preventDefault(),r(r4))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]),{pinned:n,pick:(0,b.useCallback)((t,n)=>{let a=e.filter(e=>e.role===t).length-1;r(e=>({...e,[t]:n>=a?null:n}))},[e]),back:null!==n.assistant||null!==n.user}}let r7="(under)";function r9({turns:e,pinned:t,live:n,onPick:a,under:s=null,ahead:l=!1,workOf:i,typed:o=!1}){let u=e.at(-1);return(0,r.jsx)(r.Fragment,{children:["assistant","user"].map(c=>(0,r.jsx)(r8,{role:c,turns:e.filter(e=>e.role===c),pinned:t[c],saying:n?u?.id:void 0,onPick:e=>a(c,e),under:"assistant"===c?s:null,ahead:"assistant"===c&&l,workOf:"assistant"===c?i:void 0,whole:o&&"user"===c},c))})}function r8({role:e,turns:t,pinned:n,saying:a,onPick:s,under:l,ahead:i,workOf:o,whole:u}){let c="user"===e,[d,h]=(0,b.useState)({}),p=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>p.current?.disconnect(),[]);let m=(0,b.useCallback)(e=>{if(e)return p.current??=new ResizeObserver(e=>{h(t=>{let n=t;for(let r of e){let e=r.target,a=e.dataset.turn;a&&t[a]!==e.offsetHeight&&(n===t&&(n={...t}),n[a]=e.offsetHeight)}return n})}),p.current.observe(e),()=>p.current?.unobserve(e)},[]),f=t.length-1,g=null===n&&(i||!t.length)?t.length:Math.min(n??f,f),x=(0,b.useRef)(null);if((0,b.useEffect)(()=>{let e=x.current;e&&(e.scrollTop=e.scrollHeight)},[t[g]?.text]),!t.length&&!l)return null;let y=e=>1150/(1150+700*Math.abs(e-g)),w=e=>e===g?1:.78,v=e=>(d[t[e].id]??28.475)*y(e)*w(e),k=g===t.length?l:o?.(t[g].id)??null,j=Array(t.length+1).fill(0);j[g]=-28.475/2;for(let e=g-1;e>=0;e--)j[e]=j[e+1]-49-v(e);let N=k&&g<t.length?(d[r7]??0)+8:0;for(let e=g+1;e<t.length;e++)j[e]=j[e-1]+v(e-1)+49+(e-1===g?N:0);let T=k?g===t.length?j[g]:j[g]+(d[t[g].id]??28.475)+8:null;return(0,r.jsxs)("div",{className:(0,S.cn)("pointer-events-none absolute h-0 w-[min(21.25rem,24vw)]",c?"left-full ml-[calc(var(--face-bleed,0px)+0.375rem)] [perspective-origin:0_0]":"right-full mr-[calc(var(--face-bleed,0px)+0.375rem)] [perspective-origin:100%_0]"),style:{top:"calc(50% + -40px)",perspective:1150},children:[t.map((e,n)=>{let l=Math.abs(n-g),i=n<g?g-n<=2:n-g<=2,o=n===g,d=i?o?1:.56*.6**(l-1):0,h=i&&!o,p=14*l*(c?-1:1)/y(n),f=j[n]/y(n);return(0,r.jsx)("div",{ref:m,"data-turn":e.id,"aria-hidden":!i,onClick:h?()=>s(n):void 0,style:{transform:`translate(${p.toFixed(1)}px, ${f.toFixed(1)}px) translateZ(${-700*l}px) scale(${w(n)})`,"--ink":d,"--lift":Math.max(d,.9)},className:(0,S.cn)("group/turn absolute top-0 w-max max-w-full text-[17px] leading-[1.675] tracking-[0.3px] text-foreground transition-transform duration-[520ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",u&&n===t.length-1&&"animate-in fade-in duration-200 motion-reduce:animate-none",c?"left-0 origin-top-left":"right-0 origin-top-right",!i&&"invisible",h&&"pointer-events-auto cursor-pointer",o&&"pointer-events-auto"),children:(0,r.jsxs)("p",{ref:o?x:void 0,className:(0,S.cn)("break-keep wrap-anywhere text-pretty whitespace-pre-line opacity-(--ink) transition-opacity duration-[520ms] motion-reduce:transition-none",!o&&"line-clamp-4",o&&"overflow-y-auto overscroll-contain scrollbar-none",h&&"group-hover/turn:opacity-(--lift)"),style:o?{maxHeight:284.75}:void 0,children:[o&&(0,r.jsx)("span",{className:(0,S.cn)("mr-4 inline-block size-2.5 rounded-full align-middle",e.id===a?"animate-pulse motion-reduce:animate-none":"opacity-55",c?"bg-foreground":"bg-brand")}),(0,r.jsx)(rY,{text:e.text,animate:n===t.length-1&&!u})]})},e.id)}),k&&(0,r.jsx)("div",{ref:m,"data-turn":r7,style:{transform:`translateY(${(T??0).toFixed(1)}px)`},className:"absolute inset-x-0 top-0 transition-transform duration-[520ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",children:k})]})}e.s(["SideCaptions",0,r9,"turnsOf",0,r3,"useTurnFocus",0,r6],435135);var ae=e.i(454263);let at=["▁▄▇▄","▂▆▆▂","▄▇▄▁","▆▆▂▂","▇▄▁▄","▆▂▂▆","▄▁▄▇","▂▂▆▆"];function an({live:e,ringing:t}){let{owed:n}=tT(),r=nt(Object.values(nn()).map(e=>e??null)),a="waiting"===r?null:r;return(0,b.useEffect)(()=>{let r=t?`${I.APP_NAME} is calling`:I.APP_NAME,a=n>0?`(${n}) ${r}`:r;if(!e){document.title=a;return}let s=0;document.title=`${a} ${at[s]}`;let l=setInterval(()=>{s=(s+1)%at.length,document.title=`${a} ${at[s]}`},100);return()=>clearInterval(l)},[e,n,t]),(0,b.useEffect)(()=>{let e=document.head.querySelector("link[data-tab-icon]");e||((e=document.createElement("link")).rel="icon",e.type="image/svg+xml",e.setAttribute("sizes","any"),e.dataset.tabIcon="",document.head.append(e)),e.href=`data:image/svg+xml,${encodeURIComponent(function(e){let{head:t,eyes:n}=(0,ae.markAtRest)(W.THURSDAY_SEED),r=e?`<circle cx="200" cy="200" r="${66}"/>`:"",a=e?`<circle class="${e}" cx="200" cy="200" r="46"/>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="-6 -6 252 252"><style>.ink{fill:#0a0a0a}.red{fill:#e7000b}@media (prefers-color-scheme:dark){.ink{fill:#fafafa}.red{fill:#ff6467}}</style><mask id="m" maskUnits="userSpaceOnUse"><path d="${t}" fill="#fff"/><path d="${n[0]}"/><path d="${n[1]}"/>${r}</mask><path class="ink" d="${t}" mask="url(#m)"/>${a}</svg>`}(a))}`},[a]),null}let ar={name:"arrow-down-to-line",size:24,node:[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]};ar.node;let aa=(0,l.default)(ar);var as=e.i(96892),al=e.i(64801),ai=e.i(59377),ao=e.i(184762),au=e.i(146538);let ac=(0,nN.createServerReference)("7fdeda11e31eadaa30a97480a6af36e54823219849",nN.callServer,void 0,nN.findSourceMapURL,"startThreadAction");var ad=e.i(553429),ah=e.i(709190);let ap={name:ad.ROOM_THURSDAY,description:"A call in writing — she answers here"},am=e=>/^@(\S*)$/.exec(e.split(/\s/,1)[0]);function af({written:e,onCall:t=!1}){let{data:n}=(0,J.useServerRoute)(v.queryKey.bot),a=(0,b.useMemo)(()=>[...e?[ap]:[],...n?.length?n.filter(e=>!e.disabled).map(({name:e,icon:t,description:n})=>({name:e,icon:t,description:n})):[P.DEFAULT_BOT]],[n,e]),[l,i]=(0,b.useState)(!1),[o,u]=(0,b.useState)(!1),[c,d]=(0,b.useState)(!1),[h,p]=(0,b.useState)(""),m=(0,b.useRef)(t);m.current=t;let f=(0,ah.useGivenFiles)({onKept:e=>{if(m.current)return X.screenActs.announce({kind:"gave",paths:e}),"she knows it is here"}}),g=(0,b.useRef)(null),x=(0,b.useRef)(null),y=!!e?.on,[w,j]=(0,b.useState)(null);(0,b.useEffect)(()=>{y||j(null)},[y]);let N=a.find(e=>e.name===w)??(e?ap:a[0]),T=N===ap,E=ni(),_=(0,b.useCallback)(()=>{E||(i(!0),requestAnimationFrame(()=>g.current?.focus()))},[E]),M=(0,X.useRoomOpen)(),{take:A}=f,C=(0,b.useCallback)(e=>{X.writeLine.open(),A(e)},[A]);(0,b.useEffect)(()=>X.writeLine.subscribe(_),[_]),(0,b.useEffect)(()=>{if("thread"===M)return;let e=e=>{"/"!==e.key||e.metaKey||e.ctrlKey||e.altKey||(0,G.windowKey)(e)&&(e.preventDefault(),X.writeLine.open())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[M]),(0,b.useEffect)(()=>{if(E)return;let e=e=>!!e.dataTransfer?.types.includes("Files"),t=t=>{e(t)&&(t.preventDefault(),d(!0))},n=e=>{null===e.relatedTarget&&d(!1)},r=t=>{if(!e(t))return;t.preventDefault(),d(!1);let n=[...t.dataTransfer?.files??[]];ah.roomDrop.offer(t.target,n)||C(n)};return window.addEventListener("dragover",t),window.addEventListener("dragleave",n),window.addEventListener("drop",r),()=>{window.removeEventListener("dragover",t),window.removeEventListener("dragleave",n),window.removeEventListener("drop",r)}},[C,E]);let[L,R]=(0,n_.useServerAction)(ac,{onOk:({id:e})=>{(0,J.revalidate)(v.queryKey.threads),p(""),f.clear(),i(!1),j(null),X.roomOpens.open(e)}}),[I,O]=(0,b.useState)(0),[D,F]=(0,b.useState)(!1),$=e=>{u(!1),p(e=>am(e)?e.replace(/^@\S*\s?/,""):e),O(0),g.current?.focus(),j(e.name===ap.name?null:e.name)},z=D?null:am(h),B=z?a.filter(e=>e.name.toLowerCase().startsWith(z[1].toLowerCase())):a,q=B.length?I%B.length:0,[U,K]=(0,b.useState)(!1),H=R||U,W=!!h.trim()&&!z&&!f.arriving&&!H&&!(T&&!e?.runsOn),Y=()=>{if(!W)return;let t=f.withPaths(h);T?e&&(K(!0),e.say(t).then(()=>{p(""),f.clear()}).catch(()=>{}).finally(()=>K(!1))):L(N.name,t)},V=()=>{if(w)return j(null);y&&e?.end(),i(!1)},Z=(0,b.useRef)(t);(0,b.useEffect)(()=>{let e=t&&!Z.current;Z.current=t,!e||h.trim()||f.files.length||i(!1)},[t,h,f.files.length]);let Q=(l||c||y)&&!M;(0,G.useEscape)(Q,V);let ee=R||U;(0,b.useEffect)(()=>{Q&&!ee&&g.current?.focus()},[Q,ee]),(0,b.useEffect)(()=>(X.writeLine.shown(Q),()=>X.writeLine.shown(!1)),[Q]);let et=y&&!!M;(0,b.useEffect)(()=>(X.writeLine.waits(et),()=>X.writeLine.waits(!1)),[et]);let en=eh(),[er,ea]=(0,b.useState)(Q);return((0,b.useEffect)(()=>{if(Q)return void ea(!0);let e=setTimeout(()=>ea(!1),200);return()=>clearTimeout(e)},[Q]),er)?(0,r.jsxs)(r.Fragment,{children:[c&&(0,r.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none fixed inset-0 bg-background/60",children:(0,r.jsx)("div",{className:"absolute inset-3 rounded-3xl border-[1.5px] border-dashed border-foreground/30"})}),(0,r.jsx)("div",{className:"col-start-2 row-start-1 flex min-w-0 items-end justify-center",children:(0,r.jsxs)("div",{className:(0,S.cn)("flex w-160 max-w-full flex-col gap-2",Q?"pointer-events-auto animate-in duration-200 fade-in slide-in-from-bottom-2":"pointer-events-none animate-out duration-200 fade-out fill-mode-forwards slide-out-to-bottom-2"),children:[en.length>0&&(0,r.jsxs)("div",{className:"rounded-3xl bg-background/78 p-1.5 shadow-sm shadow-black/3 ring-1 ring-border/50 backdrop-blur-md",children:[(0,r.jsxs)("p",{className:"px-3 pt-1 pb-1 font-mono text-[10px] tracking-wide text-muted-foreground",children:[en.length," ",1===en.length?"needs":"need"," a reply"]}),(0,r.jsx)("div",{className:"max-h-[30vh] overflow-y-auto",children:en.map(e=>(0,r.jsx)(ev,{thread:e,lines:2,onPick:()=>X.roomOpens.open(e.id)},e.id))})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-[26px] bg-background p-2 shadow-[0_22px_44px_-20px_rgb(0_0_0/0.22)] ring-1 ring-border",children:[(f.files.length>0||c)&&(0,r.jsx)(ah.GivenFiles,{files:f.files,onRemove:f.remove,className:"px-0.5 pt-0.5",children:c&&(0,r.jsxs)("span",{className:"flex h-13 items-center gap-2 rounded-[14px] border-[1.5px] border-dashed border-foreground/60 px-4 text-[13px]",children:[(0,r.jsx)(aa,{className:"size-4"}),"Let go — it waits here"]})}),(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),Y()},className:"flex items-end gap-2",children:[(0,r.jsxs)(ai.Popover,{open:o||!!z,onOpenChange:u,children:[(0,r.jsxs)(ai.PopoverTrigger,{render:(0,r.jsx)("button",{type:"button","aria-label":`To ${N.name}. Choose someone else`,className:"flex h-9 shrink-0 items-center gap-1.5 rounded-full bg-muted pr-2.5 pl-1.5 text-[13px] font-medium outline-none transition-colors hover:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50"}),children:[(0,r.jsx)(aw,{bot:N,size:22}),N.name,(0,r.jsx)(s.ChevronDown,{className:"size-3 text-muted-foreground"})]}),(0,r.jsxs)(ai.PopoverContent,{side:"top",align:"start",sideOffset:14,initialFocus:!z&&void 0,className:"w-90 gap-0 rounded-[18px] p-1.5",children:[(0,r.jsx)("p",{className:"px-2.5 pt-1.5 pb-1 font-mono text-[10px] text-muted-foreground",children:"to"}),B.map((e,t)=>(0,r.jsxs)("button",{type:"button",onClick:()=>$(e),className:(0,S.cn)("flex h-11.5 w-full items-center gap-2.5 rounded-xl px-2.5 text-left outline-none hover:bg-muted focus-visible:bg-muted",(z?t===q:e.name===N.name)&&"bg-muted"),children:[(0,r.jsx)(aw,{bot:e,size:24}),(0,r.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,r.jsx)("span",{className:"text-[13.5px] leading-4.5 font-medium",children:e.name}),(0,r.jsx)("span",{className:"truncate text-xs leading-4 text-muted-foreground",children:e.description})]})]},e.name)),0===B.length&&(0,r.jsx)("p",{className:"px-2.5 py-2 text-[13px] text-muted-foreground",children:"Nobody by that name."})]})]}),(0,r.jsx)(ao.Textarea,{ref:g,value:h,rows:1,disabled:R||U,onChange:e=>{let t=e.target.value;p(t),O(0),am(t)||F(!1)},onPaste:e=>{let t=[...e.clipboardData.files];t.length&&(e.preventDefault(),C(t))},onKeyDown:e=>{let t=(0,G.composing)(e);if("Escape"===e.key&&!t)return(e.preventDefault(),z)?F(!0):V();let n="ArrowDown"===e.key||"ArrowUp"===e.key;if(z&&n&&!t){let t;return e.preventDefault(),t="ArrowDown"===e.key?1:-1,O(e=>B.length?(e+t+B.length)%B.length:0)}if("Enter"===e.key&&!e.shiftKey&&!t){if(e.preventDefault(),z){B[q]&&$(B[q]);return}Y()}},placeholder:f.files.length?"Say what to do with them":y&&T?"Write back":T?"Write to her instead of calling":`Say the whole job — ${N.name} cannot hear the call`,"aria-label":`Message for ${N.name}`,className:"max-h-36 min-h-9 flex-1 resize-none border-0 bg-transparent px-0 py-1.5 text-[15px] leading-6 shadow-none focus-visible:ring-0 dark:bg-transparent"}),(0,r.jsx)("input",{ref:x,type:"file",multiple:!0,hidden:!0,onChange:e=>{C([...e.target.files??[]]),e.target.value=""}}),(0,r.jsx)("button",{type:"button","aria-label":"Add files",onClick:()=>x.current?.click(),className:"grid size-9 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,r.jsx)(al.Paperclip,{className:"size-4"})}),(0,r.jsx)("button",{type:"submit","aria-label":"Send",disabled:!W,className:(0,S.cn)("grid size-9 shrink-0 place-items-center rounded-full outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",W?"bg-primary text-primary-foreground hover:bg-primary/85":"bg-muted text-muted-foreground/40"),children:H?(0,r.jsx)("span",{className:"size-3.5 animate-spin rounded-full border-2 border-current/30 border-t-current"}):(0,r.jsx)(as.ArrowUp,{className:"size-4"})})]})]}),T&&e?.error&&(0,r.jsx)("p",{className:"px-4 text-center text-xs leading-5 text-destructive",children:e.error}),T&&e?.error&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,r.jsxs)(k.Button,{type:"button",size:"sm",variant:"brand",disabled:e.busy,onClick:()=>{e.fallback&&nb.useThursdayStore.getState().patch({textModel:e.fallback}),e.again()},children:[(0,r.jsx)(eE.RotateCw,{}),e.fallback?"Send it again on your OpenAI key":"Send it again"]}),(0,r.jsx)("span",{className:"font-mono text-[10.5px] text-muted-foreground/70",children:(0,r.jsx)(ay,{children:"API keys"})})]}),(0,r.jsx)("p",{className:"flex flex-wrap items-center justify-center gap-x-2 gap-y-1 font-mono text-[10.5px] text-muted-foreground/70",children:z?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ab,{children:"↑↓"})," walk",(0,r.jsx)(ax,{}),(0,r.jsx)(ab,{children:"Enter"})," take",(0,r.jsx)(ax,{}),(0,r.jsx)(ab,{children:"Esc"})," close the list"]}):(0,r.jsxs)(r.Fragment,{children:[T&&!e?.runsOn?(0,r.jsx)(ag,{runsOn:null}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ab,{children:"Enter"})," send",(0,r.jsx)(ax,{}),(0,r.jsx)(ab,{children:"@"})," ",T?"a bot":"pick a bot",T&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ax,{}),(0,r.jsx)(ag,{runsOn:e?.runsOn??null})]})]}),(0,r.jsx)(ax,{}),(0,r.jsx)(ab,{children:"Esc"})," ",y?T?"to end":"back to her":"close"]})})]})})]}):null}function ag({runsOn:e}){let t=D.TEXT_MODEL_PROVIDERS.chatgpt.label,n=(0,r.jsx)(au.ModelPicker,{compact:!0,provider:e?.provider??null,model:e?.model??"",unset:"pick a model",onChange:e=>nb.useThursdayStore.getState().patch({textModel:e})});return e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"runs on"}),n]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{children:["Writing to her needs a ",t,", an OpenAI key, or"]}),n,(0,r.jsx)(ax,{}),(0,r.jsx)(ay,{children:"API keys"})]})}let ax=()=>(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"});function ay({children:e}){return(0,r.jsx)("button",{type:"button",onClick:()=>(0,tF.openSettings)("keys"),className:"rounded-sm text-foreground/80 underline underline-offset-3 outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:e})}function aw({bot:e,size:t}){return e===ap?(0,r.jsx)(W.ThursdayMark,{size:t,className:"shrink-0"}):(0,r.jsx)(F.BotMark,{size:t,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"})}function ab({children:e}){return(0,r.jsx)("kbd",{className:"rounded-md border border-border bg-background px-1.5 py-0.5 font-mono text-[10px] text-foreground/80 shadow-[0_1px_0_var(--border)]",children:e})}function av({status:e,failed:t=!1,messages:n,tool:a,thinkingSince:s=null,thinkingTitle:l=null,ended:i=null,faceWord:o=null,onTap:u,ringing:c=null,onDecline:d,wakePhrase:h=null,hotkeyLabel:p=null,idleLeft:m=null,since:f=null,getSpectrum:g,getMicSpectrum:x,captionView:y="sides",callable:w=!0,written:v=null}){var k;let[j,N]=(0,b.useState)(!1),T=!w&&"idle"===e,E="connecting"===e||"ending"===e,_=!!v?.on,M="idle"!==e&&!E&&!_,A=n.findLast(e=>"assistant"===e.role)?.text??"",C=(k=aN,(0,b.useSyncExternalStore)(e=>{let t=window.matchMedia(`(min-width: ${k}px)`);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia(`(min-width: ${k}px)`).matches,()=>!0)),L="sides"===y&&"idle"!==e&&C,R=(0,b.useMemo)(()=>r3(n),[n]),O=r6(R,L),D=R.at(-1)?.role,P=function(e,t){let[n,r]=(0,b.useState)(e),a=(0,b.useRef)(e?[e]:[]),s=(0,b.useRef)(Date.now()),l=(0,b.useRef)(!1),i=(0,b.useRef)(null),o=(0,b.useCallback)(()=>{i.current&&clearTimeout(i.current),i.current=null,(a.current.length>1||l.current)&&a.current.length&&(i.current=setTimeout(()=>{a.current.shift(),s.current=Date.now(),r(a.current[0]??null),o()},Math.max(0,s.current+I.CALL_LINE.dwellMs-Date.now())))},[]);return(0,b.useEffect)(()=>{if(!e){l.current=!0,a.current.length<=1&&(a.current=[],r(null)),o();return}l.current=!1;let t=a.current.findIndex(t=>t.id===e.id);t>=0?(a.current[t]=e,0===t&&r(e)):(a.current=[...a.current.map((e,t)=>0===t?e:{...e,done:!0}),e],1===a.current.length&&(s.current=Date.now(),r(e))),o()},[e,o]),(0,b.useEffect)(()=>{if(!t)return;let e=a.current.at(-1);a.current=e&&!l.current?[e]:[],s.current=Date.now(),r(a.current[0]??null),o()},[t,o]),(0,b.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]),n}(a,"speaking"===e),F=function(e,t){let n=null!==e||t,[r,a]=(0,b.useState)([]),[s,l]=(0,b.useState)(n);return(0,b.useEffect)(()=>{a(t=>{let n=t.some(e=>!e.done)?t.map(e=>e.done?e:{...e,done:!0}):t;if(!e)return n;let r=t.findIndex(t=>aD(t)===aD(e));return r>=0?t.map((t,n)=>n===r?e:t):[...n,e].slice(-4)})},[e]),(0,b.useEffect)(()=>{if(n)return void l(!0);let e=setTimeout(()=>{l(!1),a([])},300);return()=>clearTimeout(e)},[n]),{lines:r,on:n,held:s}}(P,null!==s),[$,z]=(0,b.useState)(!1);(0,b.useEffect)(()=>{"user"!==D?z(!1):F.on&&z(!0)},[D,F.on]);let B=function(e,t,n){let[r,a]=(0,b.useState)(aP),s=e.findLast(e=>"assistant"===e.role),l=s?.id??null,i=s?`${s.id}:${s.text.length}`:null,o=!n&&e.at(-1)?.role==="assistant";(0,b.useEffect)(()=>{a(e=>{let n=e;for(let e of t){let t=aD(e),r=n.owner[t];if(void 0===r){let e=t in n.seen?n.seen[t]:i;if(t in n.seen||(n={...n,seen:{...n.seen,[t]:i}}),!l||e===i&&!o)continue;r=l,n={...n,owner:{...n.owner,[t]:r}}}let a=n.turns[r]??[],s=a.findIndex(e=>aD(e)===t);s>=0&&a[s]===e||(n={...n,turns:{...n.turns,[r]:s>=0?a.map((t,n)=>n===s?e:t):[...a,e]}})}return n})},[t,i,l,o]),(0,b.useEffect)(()=>{e.length||a(aP)},[e.length]);let u=(0,b.useMemo)(()=>t.filter(e=>void 0===r.owner[aD(e)]),[t,r.owner]);return{turns:r.turns,pending:u,latest:l}}(R,F.lines,F.on),q="assistant"===D&&"speaking"===e||"user"===D&&"listening"===e&&!_,U=null!==c&&null===c.missedAt,K=function(e){let[t,n]=(0,b.useState)(null);return(0,b.useEffect)(()=>{if(!e)return void n(null);let t=()=>n({...a$,at:Date.now()});t();let r=setInterval(t,2600);return()=>clearInterval(r)},[e]),t}(U),H=ni();return(0,r.jsxs)("div",{className:"relative flex h-full flex-col",inert:H,children:[(0,r.jsxs)("div",{className:"absolute top-5 right-5 z-10 flex flex-col items-end gap-3",children:[(0,r.jsx)(aT,{}),(0,r.jsx)(ts,{hidden:"idle"!==e||null!==c||_}),(0,r.jsx)(aJ,{})]}),(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center gap-5 pt-[7vh]",children:[(0,r.jsxs)("div",{className:"relative w-[min(20rem,52vw,37.5vh)] [--face-bleed:19.5%]",children:[(0,r.jsx)("button",{type:"button",disabled:E,onClick:T?()=>N(!0):_&&!w?void 0:u,"aria-label":T?"Add a speech key":M?"End the call":U?"Answer Thursday":"Call Thursday",className:(0,S.cn)("block w-full rounded-full outline-none transition-all duration-700 ease-out focus-visible:ring-3 focus-visible:ring-ring/50 enabled:active:scale-[0.99] disabled:opacity-70",T&&"opacity-35"),children:(0,r.jsx)("span",{className:"block",children:(0,r.jsx)(r5.Face,{status:e,failed:t,word:K??o,getSpectrum:g,covered:H,className:"-m-(--face-bleed) w-[calc(100%+2*var(--face-bleed))] max-w-none"})})}),(0,r.jsx)(r2,{status:e}),L&&(0,r.jsx)(r9,{turns:R,pinned:O.pinned,live:q,onPick:O.pick,under:F.held&&B.pending.length>0?(0,r.jsx)(aF,{lines:B.pending,shown:F.on}):null,ahead:$&&F.held&&B.pending.length>0,typed:_,workOf:e=>{let t=[...B.turns[e]??[],...e===B.latest&&"assistant"===D?B.pending:[]];return t.length?(0,r.jsx)(aF,{lines:t,shown:!0}):null}})]}),(0,r.jsxs)("div",{className:"relative flex w-full max-w-3xl flex-col items-center gap-2 px-6 text-center",children:[c&&(0,r.jsx)(aB,{ringing:c,wakePhrase:h,onAnswer:u,onDecline:()=>d?.()}),(0,r.jsxs)("div",{className:(0,S.cn)("contents",c&&"*:invisible"),children:[(0,r.jsx)(aI,{tool:L?null:P,toolUp:null!==P,thinkingSince:s,thinkingTitle:l,micOpen:!_&&("listening"===e||"working"===e||"delegating"===e),getMicSpectrum:x}),(0,r.jsx)(aE,{text:L||"idle"===e?"":A,fadeIn:!0,className:"w-full max-w-160 text-center text-base"}),(0,r.jsx)("div",{className:(0,S.cn)("flex flex-col items-center","idle"===e&&"order-first"),children:T?(0,r.jsx)(a0,{open:j,onOpen:()=>N(!0),onClose:()=>N(!1)}):_?(0,r.jsx)("span",{className:"h-6"}):(0,r.jsx)(aG,{status:e,idleLeft:m,since:f,ended:i,behind:L&&O.back,wakePhrase:h,hotkeyLabel:p})})]})]})]}),(0,r.jsxs)(ak,{children:[(0,r.jsx)(nJ,{}),(0,r.jsx)(af,{written:v,onCall:M}),(0,r.jsx)(e1,{})]})]})}function ak({children:e}){return(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-10 grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] grid-rows-[minmax(0,1fr)_auto] items-end gap-x-4 gap-y-2 p-5",children:e})}let aj=["thursday","memory","bot"];function aS({alert:e}){return e?(0,r.jsx)("span",{"aria-hidden":!0,className:(0,S.cn)("absolute top-0.5 right-0.5 size-1.5 rounded-full ring-2 ring-background","red"===e?"bg-destructive":"bg-waiting")}):null}let aN=1e3;function aT(){let e=nn(),t=nt(t7.filter(e=>!aj.includes(e.id)).map(t=>e[t.id]??null));return(0,r.jsxs)(R.TooltipProvider,{children:[(0,r.jsxs)(T,{className:"bg-background/75 backdrop-blur-md",children:[(0,r.jsx)(T,{children:aj.map(t=>{let n=t7.find(e=>e.id===t);return n?(0,r.jsxs)(R.Tooltip,{children:[(0,r.jsxs)(R.TooltipTrigger,{render:(0,r.jsx)(k.Button,{size:"icon",variant:"outline","aria-label":n.label,onClick:()=>(0,tF.openSettings)(t)}),children:[(0,r.jsx)(n.icon,{className:"text-muted-foreground"}),(0,r.jsx)(aS,{alert:e[t]??null})]}),(0,r.jsx)(R.TooltipContent,{side:"bottom",children:n.label})]},t):null})}),(0,r.jsx)(T,{children:(0,r.jsxs)(k.Button,{variant:"outline",onClick:()=>(0,tF.openSettings)(),className:"gap-1.5 px-2.5 text-[12.5px] font-normal",children:[(0,r.jsx)(y,{className:"text-muted-foreground"}),"Settings",(0,r.jsx)(aS,{alert:t})]})})]}),(0,r.jsx)(ne,{})]})}function aE({text:e,lines:t=3,fadeIn:n=!1,className:a}){let l=(0,b.useRef)(null),[i,u]=(0,b.useState)(t),[c,d]=(0,b.useState)(0),[h,p]=(0,b.useState)(e);h!==e&&(p(e),d(0)),(0,b.useEffect)(()=>{let e=l.current;if(!e)return;let t=()=>{let t=Number.parseFloat(getComputedStyle(e).lineHeight);t&&u(Math.max(1,Math.round(e.scrollHeight/t)))};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]);let m=Math.ceil(Math.max(0,i-t)/t),f=Math.max(0,i-t-Math.min(c,m)*t),g=`calc(${t} * 1.625em)`,x=(0,r.jsx)("p",{ref:l,style:{lineHeight:1.625,transform:`translateY(-${1.625*f}em)`},className:"break-keep wrap-anywhere whitespace-pre-line transition-transform duration-200",children:(0,r.jsx)(rY,{text:e,animate:n})});return(0,r.jsxs)("div",{className:"relative flex w-full justify-center",children:[(0,r.jsx)("div",{style:{height:g},onClick:m>0?()=>d(e=>e>=m?0:e+1):void 0,className:(0,S.cn)("overflow-hidden",m>0&&"cursor-pointer",a),children:x}),m>0&&(0,r.jsxs)("div",{className:"absolute top-1/2 right-0 flex -translate-y-1/2 flex-col items-center gap-0.5",children:[(0,r.jsx)(a_,{look:o,label:"Earlier lines",shown:c<m,onPick:()=>d(e=>Math.min(m,e+1))}),(0,r.jsx)(a_,{look:s.ChevronDown,label:"Later lines",shown:c>0,onPick:()=>d(e=>Math.max(0,e-1))})]})]})}function a_({look:e,label:t,shown:n,onPick:a}){return(0,r.jsx)("button",{type:"button","aria-label":t,"aria-hidden":!n,tabIndex:n?void 0:-1,onClick:e=>{e.stopPropagation(),a()},className:(0,S.cn)("grid size-7 place-items-center rounded-full text-muted-foreground/60 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",!n&&"invisible"),children:(0,r.jsx)(e,{className:"size-3.5"})})}let aM=[{id:"a",from:0,to:1,gain:.8},{id:"b",from:1,to:3,gain:1},{id:"c",from:3,to:5,gain:1.15},{id:"d",from:5,to:6,gain:1.35},{id:"e",from:6,to:8,gain:1.55}];function aA({live:e,getMicSpectrum:t}){let n=(0,b.useRef)({}),a=(0,b.useRef)(aM.map(()=>0));return(0,b.useEffect)(()=>{if(!e||!t)return;let r=requestAnimationFrame(function e(){let s=t();aM.forEach((e,t)=>{let r=0;for(let t=e.from;t<e.to;t++)r=Math.max(r,s[t]??0);let l=Math.min(1,(r*e.gain)**.8),i=a.current[t],o=i+(l-i)*(l>i?.6:.16);a.current[t]=o;let u=n.current[e.id];u&&(u.style.height=`${2+12*o}px`)}),r=requestAnimationFrame(e)});return()=>cancelAnimationFrame(r)},[e,t]),(0,r.jsx)("span",{"aria-hidden":!0,className:"flex h-3.5 w-[18px] shrink-0 items-center gap-0.5",children:aM.map(e=>(0,r.jsx)("span",{ref:t=>{n.current[e.id]=t},style:{height:2},className:"w-0.5 rounded-full bg-muted-foreground/70"},e.id))})}function aC({live:e,getMicSpectrum:t}){return(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] leading-5 text-muted-foreground",children:[(0,r.jsx)(aA,{live:e,getMicSpectrum:t}),"Listening"]})}function aL({tool:e}){let t="relay"===e.kind?c:(0,e5.toolIcon)(e.name),n=e.line??e.name,a=e.line?"min-w-0 truncate text-[13px] leading-5 break-keep":"min-w-0 truncate font-mono text-xs leading-5",s=(0,J.useServerRoute)(v.queryKey.bot).data,l=e.bot?s?.find(t=>t.name===e.bot)??null:null;return(0,r.jsxs)("span",{className:"flex max-w-full items-center gap-1.5",children:[(0,r.jsxs)("span",{className:"relative grid size-[18px] shrink-0 place-items-center",children:[(0,r.jsx)(aR,{tool:e,bot:l,icon:t}),!e.done&&(0,r.jsx)("span",{className:"absolute inset-0 grid animate-ink place-items-center",children:(0,r.jsx)(aR,{tool:e,bot:l,icon:t,running:!0})})]}),e.done&&e.sources?.length?(0,r.jsx)(C.SourceChips,{sources:e.sources,limit:2,className:"flex-nowrap"}):e.done?(0,r.jsx)("span",{className:(0,S.cn)(a,"text-muted-foreground"),children:n}):(0,r.jsx)(A.ShinyText,{text:n,className:a})]})}function aR({tool:e,bot:t,icon:n,running:a}){return e.bot?(0,r.jsx)("span",{className:(0,S.cn)("flex",!a&&!e.done&&"opacity-40"),children:(0,r.jsx)(F.BotMark,{size:16,seed:e.bot,color:t?.icon?.color,shape:t?.icon?.shape,outline:t?.icon?.outline,paint:t?.icon?.paint,notify:!1})}):(0,r.jsx)(n,{className:(0,S.cn)("size-3.5",a?"text-foreground":"text-muted-foreground",!a&&!e.done&&"opacity-40")})}function aI({tool:e,toolUp:t,thinkingSince:n,thinkingTitle:a,micOpen:s,getMicSpectrum:l}){let[i,o]=(0,b.useState)(e);(0,b.useEffect)(()=>{e&&o(e)},[e]);let{thought:u,title:c}=function(e,t){let[n,r]=(0,b.useState)(null!==e),[a,s]=(0,b.useState)(t);return(0,b.useEffect)(()=>{null!==e&&(r(!0),s(t))},[e,t]),{thought:n,title:a}}(n,a),d=null!==e,h=null!==n&&!t,p=s&&!d&&!h,m=e=>s&&(0,r.jsx)(aA,{live:e,getMicSpectrum:l});return(0,r.jsx)("div",{className:"flex h-7 max-w-full items-center justify-center",children:(0,r.jsxs)("div",{className:"grid min-w-0 items-center justify-items-center",children:[i&&(0,r.jsx)(aH,{at:"col-start-1 row-start-1 max-w-full",shown:d,children:(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[m(d),(0,r.jsx)(aL,{tool:i})]})}),u&&(0,r.jsx)(aH,{at:"col-start-1 row-start-1 max-w-full",shown:h,children:(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[m(h),(0,r.jsx)(a1,{title:c})]})}),(0,r.jsx)(aH,{at:"col-start-1 row-start-1",shown:p,children:(0,r.jsx)(aC,{live:p,getMicSpectrum:l})})]})})}let aO=[1,.7,.45],aD=e=>e.id??`${e.kind??"tool"}:${e.name}`,aP={turns:{},owner:{},seen:{}};function aF({lines:e,shown:t}){let n=Math.max(0,e.length-3),a=e.length-n;return(0,r.jsx)("div",{"aria-hidden":!t,className:(0,S.cn)("pointer-events-auto relative w-full transition-opacity duration-300 ease-out",!t&&"pointer-events-none opacity-0"),style:{height:26*a},children:e.map((t,a)=>{let s=a-n;return(0,r.jsx)("div",{style:{transform:`translateY(${26*s}px)`,opacity:s<0?0:aO[e.length-1-a],height:26},className:"absolute inset-x-0 top-0 flex items-center transition-[transform,opacity] duration-300 ease-out motion-reduce:transition-none",children:(0,r.jsx)("div",{className:"flex min-w-0 animate-in duration-300 fade-in slide-in-from-bottom-1 motion-reduce:animate-none",children:(0,r.jsx)(aL,{tool:t})})},aD(t))})})}let a$={text:"CALL",hold:1.5},az="rounded-md border border-border bg-background px-1.5 py-0.5 font-mono text-[10px] text-foreground/80 shadow-[0_1px_0_var(--border)]";function aB({ringing:e,wakePhrase:t,onAnswer:n,onDecline:a}){let s=(0,J.useServerRoute)(v.queryKey.bot).data,l=(e,t)=>{let n=s?.find(t=>t.name===e.bot)?.icon;return(0,r.jsx)(F.BotMark,{size:t,seed:e.bot,color:n?.color,shape:n?.shape,outline:n?.outline,paint:n?.paint,notify:!1,className:"shrink-0"})},{first:i,others:o,missedAt:u}=e,[c,d]=(0,H.useAnswerThread)(),[h,p]=(0,b.useState)(null);if(null!==u){let e=[i,...o];return(0,r.jsxs)("div",{className:"absolute inset-x-0 -top-20 z-10 flex animate-in flex-col items-center px-6 fade-in duration-300",children:[(0,r.jsxs)("div",{className:"flex w-full max-w-140 flex-col text-left",children:[(0,r.jsxs)("p",{className:"mb-1.5 flex items-center gap-2 font-mono text-[11px] text-muted-foreground",children:[(0,r.jsx)(g,{className:"size-3"}),(0,r.jsxs)("span",{children:["Missed · ",(0,r.jsx)(aq,{at:u})]}),(0,r.jsxs)("button",{type:"button",onClick:a,className:"ml-auto flex items-center gap-1.5 rounded-md outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,r.jsx)("kbd",{className:az,children:"Esc"}),"clear"]})]}),e.slice(0,3).map(e=>(0,r.jsxs)("div",{className:"flex h-8.5 items-center gap-2.5",children:[l(e,20),(0,r.jsx)("span",{className:"w-32 shrink-0 truncate text-[13.5px]",children:e.label}),(0,r.jsx)("span",{className:"w-14 shrink-0 font-mono text-[10.5px] text-muted-foreground",children:aK[e.kind]}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:(0,S.plainText)(e.text)})]},e.id)),e.length>3&&(0,r.jsxs)("p",{className:"mt-1 font-mono text-[10.5px] text-muted-foreground/70",children:["+",e.length-3," more in the room"]})]}),(0,r.jsx)(k.Button,{variant:"brand",onClick:n,className:"mt-5 h-12 px-8 text-[15px]",children:"Call back"}),t&&(0,r.jsxs)("span",{className:"mt-3 flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground/70",children:["or say ",(0,r.jsx)(aU,{phrase:t})]})]})}return(0,r.jsxs)("div",{className:"absolute inset-x-0 -top-20 z-10 flex animate-in flex-col items-center gap-3 px-6 fade-in duration-300",children:[(0,r.jsxs)("span",{className:"flex max-w-full items-center gap-2 text-sm",children:[l(i,18),(0,r.jsx)("span",{children:i.bot}),(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,r.jsx)("span",{className:"truncate text-muted-foreground",children:i.label})]}),(0,r.jsx)("p",{className:"line-clamp-3 max-w-150 text-base/relaxed text-pretty break-keep wrap-anywhere [@media(min-height:860px)]:line-clamp-5",children:(0,S.plainText)(i.text)}),i.options.length>0&&(0,r.jsx)("span",{className:"flex max-w-full flex-wrap justify-center gap-1.5",children:i.options.map(e=>(0,r.jsx)(k.Button,{size:"sm",variant:"secondary",loading:h===e,disabled:d,onClick:async()=>{p(e),await c(i,e,i.bot,i.questionId??void 0),p(null)},className:"h-7 max-w-60 rounded-full px-3 text-[12.5px]",children:(0,r.jsx)("span",{className:"truncate",children:e})},e))}),(0,r.jsx)(k.Button,{variant:"brand",onClick:n,className:"mt-3 h-12 px-8 text-[15px]",children:"Answer"}),o.length>0&&(0,r.jsxs)("span",{className:"flex max-w-full flex-wrap items-center justify-center gap-x-4.5 gap-y-1 text-[13px] text-muted-foreground",children:[o.slice(0,2).map(e=>(0,r.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[l(e,16),(0,r.jsx)("span",{className:"max-w-44 truncate text-foreground",children:e.label}),aK[e.kind]]},e.id)),o.length>2&&(0,r.jsxs)("span",{children:["+",o.length-2]})]}),(0,r.jsxs)("span",{className:"mt-1 flex items-center gap-3 font-mono text-[11px] text-muted-foreground/70",children:[t&&(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:["say ",(0,r.jsx)(aU,{phrase:t})," to answer"]}),(0,r.jsxs)("button",{type:"button",onClick:a,className:"flex items-center gap-2 rounded-md outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,r.jsx)("kbd",{className:az,children:"Esc"}),"not now"]})]})]})}function aq({at:e}){let[t,n]=(0,b.useState)(()=>Date.now());return(0,b.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),3e4);return()=>clearInterval(e)},[]),t-e<6e4?"just now":(0,a.formatDistanceStrict)(e,t,{addSuffix:!0})}function aU({phrase:e}){return(0,r.jsxs)("span",{className:"flex items-center gap-1 rounded-full bg-muted px-2 py-0.5 text-foreground/80",children:[(0,r.jsx)(h,{className:"size-3"}),e]})}let aK={question:"asks",done:"finished",stopped:"stopped"};function aH({at:e,shown:t,children:n}){return(0,r.jsx)("span",{"aria-hidden":!t,className:(0,S.cn)("flex transition-opacity duration-300 ease-out",e,t?"opacity-100":"pointer-events-none opacity-0"),children:n})}let aW={quiet:`${I.CALL_IDLE.hangUpMs/1e3}s of quiet`,hungUp:"Thursday hung up",closed:"Live closed the call",expired:"the call ran to Live's time limit",dropped:"the connection dropped"};function aG({status:e,idleLeft:t,since:n,ended:a,behind:s,wakePhrase:l,hotkeyLabel:i}){let o,u,c="connecting"===e||"ending"===e,d="idle"!==e&&!c;return c?(u=e,o=(0,r.jsx)(A.ShinyText,{text:"connecting"===e?"Connecting…":"Ending…",className:"text-muted-foreground/70"})):d&&null!==t?(u="quiet",o=`Quiet — ending in ${t}s. Say anything to stay.`):d?(u=s?"behind":"live",o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"Tap Thursday to end"}),(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("kbd",{className:az,children:"↓"}),(0,r.jsx)("span",{children:"back to now"})]}):(0,r.jsx)(a2,{since:n}),(0,r.jsx)(aV,{})]})):a?(u=`ended:${a}`,o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{children:["Ended — ",aW[a]]}),(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,r.jsx)("span",{children:"Tap to call again"})]})):l?(u=`wake:${l}`,o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_,{text:"Tap Thursday, or say"}),(0,r.jsx)(aZ,{at:500,children:(0,r.jsx)(aU,{phrase:l})}),(0,r.jsx)(aZ,{at:aX,children:(0,r.jsx)(aQ,{})})]})):i?(u=`key:${i}`,o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_,{text:"Tap Thursday, or press"}),(0,r.jsx)(aZ,{at:550,children:(0,r.jsx)("kbd",{className:az,children:i})}),(0,r.jsx)(aZ,{at:aX,children:(0,r.jsx)(aQ,{})})]})):(u="tap",o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_,{text:"Tap Thursday to talk"}),(0,r.jsx)(aZ,{at:aX,children:(0,r.jsx)(aQ,{})})]})),(0,r.jsx)("span",{className:"flex h-6 animate-in items-center gap-1.5 font-mono text-[11px] text-muted-foreground fade-in duration-700",children:o},u)}let aY="rounded-md outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50";function aV(){let e=nh();return np()?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),e?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"Sharing"}),(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,r.jsx)("button",{type:"button",onClick:nf,className:aY,children:"Stop"})]}):(0,r.jsx)("button",{type:"button",onClick:()=>nm().catch(e=>L.toast.add({type:"warning",title:"Nothing was shared",description:(0,S.errorToString)(e)})),className:aY,children:"Share screen"})]}):null}function aJ(){let e=nh(),t=(0,b.useRef)(null);return((0,b.useEffect)(()=>{t.current&&(t.current.srcObject=e)},[e]),e)?(0,r.jsxs)("figure",{className:"flex w-44 animate-in flex-col items-end gap-1.5 fade-in duration-300",children:[(0,r.jsx)("video",{ref:t,autoPlay:!0,muted:!0,playsInline:!0,"aria-label":"The screen you are sharing",className:"aspect-video w-full rounded-lg bg-muted object-contain ring-1 ring-border/60"}),(0,r.jsx)("figcaption",{className:"font-mono text-[11px] text-muted-foreground",children:"Sent only when she looks"})]}):null}let aX=900;function aZ({at:e,children:t}){return(0,r.jsx)("span",{style:{animationDelay:`${e}ms`},className:"flex animate-in items-center gap-1.5 duration-700 fill-mode-backwards fade-in",children:t})}function aQ(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"px-1.5 text-muted-foreground/30",children:"·"}),(0,r.jsx)("span",{className:"text-muted-foreground/70",children:"/ to write"})]})}function a0({open:e,onOpen:t,onClose:n}){let{data:a}=(0,J.useServerRoute)(v.queryKey.automaticModel);return e?(0,r.jsxs)("div",{className:"w-[min(26rem,84vw)] animate-in space-y-2.5 rounded-2xl bg-background/80 p-3 ring-1 ring-border/60 backdrop-blur-md fade-in duration-300",children:[(0,r.jsxs)("div",{className:"flex h-6 items-center justify-between gap-2 pl-0.5",children:[(0,r.jsx)("span",{className:"text-[13px] font-medium",children:"Paste your OpenAI API key"}),(0,r.jsx)(k.Button,{type:"button",size:"icon",variant:"ghost","aria-label":"Not now",onClick:n,className:"-my-1 size-6",children:(0,r.jsx)(w.X,{className:"size-3.5"})})]}),(0,r.jsx)(e3.VoiceKeys,{dense:!0,plain:!0,autoFocus:!0}),(0,r.jsx)(e3.GetKeyLink,{})]}):(0,r.jsxs)("span",{className:"flex animate-in items-center gap-2 rounded-full bg-muted/60 py-1 pr-1 pl-1.5 ring-1 ring-border/60 fade-in duration-500",children:[(0,r.jsxs)("span",{className:"relative flex size-6 shrink-0 items-center justify-center",children:[(0,r.jsx)(F.BotMark,{size:24,seed:P.DEFAULT_BOT.name,color:P.DEFAULT_BOT.icon?.color,shape:P.DEFAULT_BOT.icon?.shape,outline:P.DEFAULT_BOT.icon?.outline,notify:!1}),(0,r.jsx)(m,{className:"absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full bg-muted text-muted-foreground"})]}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground break-keep wrap-anywhere",children:a&&!a.ref?"Calls need one speech key, and bots a model key or a ChatGPT sign-in.":"Calls need one speech key. Everything else here already works."}),(0,r.jsx)(k.Button,{size:"sm",variant:"brand",onClick:t,className:"h-7 px-3.5",children:"Add key"})]})}function a1({title:e}){let t=e?`Thinking \xb7 ${e}`:"Thinking";return(0,r.jsx)("span",{className:"flex max-w-full items-center text-[13px] leading-5",children:(0,r.jsx)(A.ShinyText,{text:t,className:"min-w-0 animate-in truncate fade-in duration-300"},t)})}function a2({since:e}){let[t,n]=(0,b.useState)(()=>Date.now());if((0,b.useEffect)(()=>{if(null===e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),null===e)return null;let a=Math.max(0,Math.floor((t-e)/1e3)),s=String(Math.floor(a/60)).padStart(2,"0"),l=String(a%60).padStart(2,"0");return(0,r.jsxs)("span",{className:"tabular-nums",children:[s,":",l]})}e.s(["Ear",0,aC,"Thursday",0,function({ready:e}){let t=function(){let[e,t]=(0,b.useState)(null),n=(0,b.useRef)(e);n.current=e;let r=(0,b.useRef)(new Set),[a]=(0,n_.useServerAction)(nF),s=(0,b.useRef)(null),l=(0,b.useRef)([]),[i,o]=(0,b.useState)([]),u=(0,b.useCallback)(e=>{l.current=e,o(e)},[]),c=(0,b.useRef)(new Map),d=(0,b.useRef)(0),[h,p]=(0,b.useState)(null),m=(0,b.useRef)(()=>{}),{messages:f,sendMessage:g,setMessages:x,status:y,stop:w,error:k,clearError:j}=(0,nk.useChat)({transport:nB,onFinish:e=>m.current(e)}),N="submitted"===y||"streaming"===y,T=(0,b.useRef)(f);T.current=f;let E=(0,b.useRef)(k);E.current=k;let _=(0,b.useRef)(""),M=(0,b.useCallback)(e=>{let t=n.current;if(!t)return;let r=l.current;u([]);let a=crypto.randomUUID();s.current=a;let i=nq();_.current=JSON.stringify(i??null);let o=[...r.map(nU),...e?[{type:"text",text:e}]:[]];g(o.length?{parts:o}:void 0,{body:{callId:t.callId,standing:t.standing,runsOn:i,turn:a}})},[g,u]),A=(0,b.useCallback)(()=>{let e=n.current;if(e){for(let e of(n.current=null,t(null),s.current=null,c.current.values()))nM.delete(e.key);c.current.clear(),u([]),d.current=0,p(null),w(),x([]),j(),nP(e.callId).then(nE.unwrapResult).finally(()=>(0,J.revalidate)(v.queryKey.callHistory(null)))}},[w,x,j,u]),C=(0,b.useRef)(A);C.current=A,(0,b.useEffect)(()=>()=>C.current(),[]);let R=(0,b.useCallback)(e=>{u([...l.current,e]);let t=n.current,r=s.current;t&&r&&n$(t.callId,r,e).then(nE.unwrapResult).catch(()=>{})},[u]);(0,b.useEffect)(()=>X.screenActs.subscribe(e=>{n.current&&R({id:crypto.randomUUID(),text:nD(e),said:!1})}),[R]);let O=(0,b.useCallback)(async e=>{let l=n.current;if(l||(n.current=l={...await a(nq()),at:Date.now()},r.current=nA(F.current??[]),t(l)),d.current=0,s.current)return R({id:crypto.randomUUID(),text:e,said:!0});j(),M(e)},[a,R,j,M]),D=(0,b.useCallback)(()=>{let e=T.current,t=e.at(-1);if(n.current&&t){if("assistant"===t.role){let n=_.current!==JSON.stringify(nq()??null)?-1:t.parts.findLastIndex(e=>(0,nj.isToolUIPart)(e)&&!e.providerExecuted&&("output-available"===e.state||"output-error"===e.state));u([...(0,nw.notesIn)([{...t,parts:t.parts.slice(n+1)}]),...l.current]),x(n<0?e.slice(0,-1):[...e.slice(0,-1),{...t,parts:t.parts.slice(0,n+1)}])}j(),M(null)}},[M,x,j,u]),{data:P}=(0,J.useServerRoute)(v.queryKey.threads),F=(0,b.useRef)(P);F.current=P;let $=(0,b.useCallback)(()=>{if(!n.current||!F.current)return;let e=nO(F.current),t=new Set(e.map(e=>e.key)),a=l.current.filter(e=>{let n=c.current.get(e.id);return void 0!==n&&!t.has(n.key)});if(a.length){for(let e of a){let t=c.current.get(e.id);t&&nM.delete(t.key),c.current.delete(e.id)}u(l.current.filter(e=>!a.includes(e)))}for(let t of e){if(nM.has(t.key)||r.current.has(t.key))continue;nM.add(t.key);let e={id:crypto.randomUUID(),text:t.line,said:!1};c.current.set(e.id,{key:t.key,rows:t.relayIds,show:t.show}),s.current&&p(t.show),R(e)}if(s.current||E.current||d.current>=I.TEXT_CALL.autoTurns)return;let i=l.current.filter(e=>c.current.has(e.id)),o=i.length?c.current.get(i[i.length-1].id):null;o&&(d.current+=1,p(o.show),M(null))},[u,R,M]),z=null!==e;(0,b.useEffect)(()=>{z&&P&&$()},[z,P,$]),m.current=({message:e,messages:t,isAbort:r,isError:a,isDisconnect:i})=>{if(r||!n.current)return;s.current=null;let o=new Set((0,nw.notesIn)([e]).map(e=>e.id));if(u(l.current.filter(e=>!o.has(e.id))),a||i)return;let d=new Set((0,nw.notesIn)(t).map(e=>e.id)),h=[];for(let[e,t]of c.current)d.has(e)&&(h.push(...t.rows),c.current.delete(e));if(h.length&&nT(h).then(nE.unwrapResult).catch(e=>L.toast.add({type:"error",title:"Could not record relay delivery",description:(0,S.errorToString)(e)})),l.current.some(e=>e.said))return M(null);$()},(0,b.useEffect)(()=>{if(N||!h)return;let e=setTimeout(()=>p(null),I.CALL_LINE.lingerMs);return()=>clearTimeout(e)},[N,h]);let B=f.at(-1)?.role==="assistant"?f.at(-1):null,q=B?.parts??[],U=q.at(-1),K=(0,b.useMemo)(()=>{let e=[],t=!1,n=(n,r,a)=>{if(!a)return;let s=t&&"assistant"===r;"assistant"===r&&(t=!1),e.push({id:n,role:r,text:a,...s?{fresh:!0}:{}})};for(let e of f){if("system"===e.role)continue;let r=e.role,a=[],s=0,l=()=>{let t=a.join("\n\n").trim();a=[],n(`${e.id}:${s++}`,r,"assistant"===r?(0,S.captionText)(t):t)};for(let r of e.parts){"text"===r.type&&a.push(r.text);let e=(0,nw.noteOf)(r);e&&(l(),e.said?n(e.id,"user",e.text):t=!0)}l()}let r=new Set((0,nw.notesIn)(f).map(e=>e.id));for(let e of i)e.said&&!r.has(e.id)&&n(e.id,"user",e.text);return e},[f,i]),H=[...q].reverse().find(nj.isToolUIPart),W=H?.toolCallId??null,G=H?(0,nj.getToolName)(H):null,Y=H?.state==="output-available"||H?.state==="output-error",V=H?.output,Z=(0,b.useMemo)(()=>Y&&G===nS.TOOL_NAMES.web_search?(0,nz.searchSourcesOf)(JSON.stringify(V??null)):[],[Y,G,V]),Q=V?.action?.query,ee=JSON.stringify({..."string"==typeof Q?{query:Q}:{},...H?.input??{}}),et=G?(0,nz.toolBot)(G,ee,F.current,void 0===V?void 0:JSON.stringify(V)):null,en=G?(0,nz.toolLine)(G,ee,et):null,er=U?.type==="text",ea=(0,b.useMemo)(()=>W&&G&&(!er||Z.length)?{id:W,name:G,line:en,bot:et,done:Y,...Z.length?{sources:Z}:{}}:null,[W,G,en,et,Y,Z,er]),[es,el]=(0,b.useState)(null),ei=ea?.done&&!ea.sources?ea.id:null;(0,b.useEffect)(()=>{if(!ei)return;let e=setTimeout(()=>el(ei),I.CALL_LINE.lingerMs);return()=>clearTimeout(e)},[ei]);let eo=ea&&ea.id!==es?ea:h,eu=!!N&&U?.type!=="text"&&(!ea||!!ea.done),[ec,ed]=(0,b.useState)(null);(0,b.useEffect)(()=>{ed(eu?Date.now():null)},[eu]);let eh=[...q].reverse().find(e=>"reasoning"===e.type),ep=eu&&eh?.type==="reasoning"&&(0,nz.reasoningTitle)(eh.text)||null,em=e?N?U?.type==="text"?"speaking":ea&&!ea.done&&ea.name===nS.TOOL_NAMES.thread_start?"delegating":"working":"listening":"idle";return{on:null!==e,busy:N,status:em,messages:K,tool:eo,thinkingSince:ec,thinkingTitle:ep,since:e?.at??null,error:k?k.message:null,say:O,again:D,end:A}}(),{status:n,failed:a,messages:s,tool:l,thinkingSince:i,thinkingTitle:o,ended:u,faceWord:c,idleLeft:d,since:h,call:p,ringing:m,decline:f,getSpectrum:g,getMicSpectrum:x,wakePhrase:y,hotkey:w}=function(e=!1){let t,n,r=(0,b.useRef)(null),a=(0,b.useRef)(null),s=(0,b.useRef)(null),[l,i]=(0,b.useState)("idle"),[o,u]=(0,b.useState)(!1),c=(0,b.useRef)(null),d=(0,b.useCallback)(e=>{c.current&&clearTimeout(c.current),c.current=e?setTimeout(()=>u(!1),6e3):null,u(e)},[]),[h,p]=(0,b.useState)([]),[m,f]=(0,b.useState)(null),[g,x]=(0,b.useState)(null),[y,w]=(0,b.useState)(null),[k,j]=(0,b.useState)(null),[N,T]=(0,b.useState)(null),[E,_]=(0,b.useState)(null),[M,A]=(0,b.useState)(null),C=(0,b.useRef)(null),R=(0,b.useRef)(null),D=(0,b.useRef)({on:!1,spoke:!1,giveUp:null}),P=(0,b.useRef)(null),F=(0,b.useRef)(null),$=(0,b.useRef)(0),z=(0,b.useRef)(null),q=(0,b.useRef)(!1),U=(0,b.useRef)(null),K=(0,b.useRef)(null),H=(0,b.useRef)(null),W=(0,b.useRef)(nM),V=(0,b.useRef)(new Set),Z=(0,b.useRef)(new Set),Q=(0,b.useRef)([]),ee=(0,b.useRef)([]),et=(0,b.useRef)(0),en=(0,b.useRef)(null),er=(0,b.useRef)(0),ea=(0,b.useRef)(!1),es=(0,b.useRef)(!1),el=(0,b.useRef)(void 0),ei=(0,b.useRef)(null),eo=ei.current??=(t=[],n=null,{send(e){n?n(e):t.push(e)},open(e){n=e;let r=t;for(let n of(t=[],r))e(n)},close(){n=null},clear(){let e=t;return t=[],e}}),eu=(0,b.useRef)(!1),ec=(0,b.useRef)(!1),ed=(0,b.useRef)(!1),eh=(0,b.useRef)(0),ep=(0,b.useCallback)(e=>{z.current&&clearTimeout(z.current),q.current=!1;let t=(0,nz.toolBot)(e.name,e.arguments,el.current);f({id:e.id,name:e.name,line:(0,nz.toolLine)(e.name,e.arguments,t),bot:t,done:!1})},[]),em=(0,b.useCallback)((e,t)=>{let n=(0,nz.toolBot)(e.name,e.arguments,el.current,t);n&&f(t=>t?.id===e.id&&t.bot!==n?{...t,bot:n,line:(0,nz.toolLine)(e.name,e.arguments,n)}:t)},[]),ef=(0,b.useCallback)(e=>{z.current&&clearTimeout(z.current),q.current=!0,f({...e,done:!1})},[]),eg=(0,b.useCallback)(e=>{f(t=>t?.id===e?{...t,done:!0}:t),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>f(e=>e?.done?null:e),I.CALL_LINE.lingerMs)},[]),ex=(0,b.useCallback)(()=>{if(D.current.giveUp&&clearTimeout(D.current.giveUp),D.current.spoke){for(let e of Q.current)V.current.delete(e);let e=ee.current;e.length&&nT(e).then(nE.unwrapResult).catch(e=>L.toast.add({type:"error",title:"Could not record relay delivery",description:(0,S.errorToString)(e)}))}ee.current=[],Q.current=[],D.current={on:!1,spoke:!1,giveUp:null},P.current?.(),q.current&&(q.current=!1,f(e=>e?.kind==="relay"?{...e,done:!0}:e),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>f(e=>e?.kind==="relay"?null:e),I.CALL_LINE.relayLingerMs))},[]),ey=(0,b.useCallback)(()=>{D.current.giveUp&&clearTimeout(D.current.giveUp),D.current={on:!0,spoke:!1,giveUp:setTimeout(ex,I.CALL_RELAY.readMs)}},[ex]),ew=(0,b.useCallback)(e=>{C.current=e,T(e),_(null)},[]),eb=(0,b.useCallback)((e,t)=>{let n=()=>{R.current&&clearTimeout(R.current),R.current=null};if(t){n(),null!==C.current&&ew(null);return}if(e){n(),null===C.current&&ew(Date.now());return}null===C.current||R.current||(R.current=setTimeout(()=>{R.current=null,ew(null)},I.CALL_LINE.thinkingTailMs))},[ew]),ev=(0,b.useCallback)(()=>{let e=r.current,t=el.current;if(!e||!t||D.current.on||es.current||null!==C.current||en.current)return;let n=ea.current;if(ea.current=!1,!n&&Date.now()-er.current<I.CALL_RELAY.quietMs)return;let a=nO(t).filter(e=>!W.current.has(e.key)&&!Z.current.has(e.key)),s=a[0];if(!s)return;let l=a.filter(e=>e.kind===s.kind).slice(0,I.CALL_RELAY.perTurn),i=l.map(e=>e.line);for(let e of l)W.current.add(e.key),V.current.add(e.key);s.key.startsWith("done:")&&A(rD()),ey(),Q.current=l.map(e=>e.key),ee.current=l.flatMap(e=>e.relayIds),ef((l.at(-1)??s).show),e.append("commentary",1===i.length?i.join(""):`[${i.length} updates.]
|
|
14
|
+
|
|
15
|
+
${i.join("\n\n")}`).then(e=>{e||(ee.current=[],ex())})},[ey,ex,ef]),ek=(0,b.useRef)(l);(0,b.useEffect)(()=>{ek.current=l},[l]);let ej=(0,b.useRef)("listening"),eS=(0,b.useRef)(null),eN=(0,b.useCallback)(()=>{eS.current&&clearTimeout(eS.current),eS.current=null},[]),eT=(0,b.useCallback)(e=>{ek.current=e,i(e)},[]),eE=(0,b.useCallback)(e=>{ej.current=e;let t=ek.current;if("speaking"===e){eN(),eT(e);return}let n="working"===e||"delegating"===e;if(n&&("working"===t||"delegating"===t)){eN(),eT(e);return}n||"listening"!==t?eS.current||(eS.current=setTimeout(()=>{eS.current=null,eT(ej.current)},n?800:600)):eN()},[eN,eT]),e_="idle"!==l&&"connecting"!==l&&"ending"!==l,{data:eM}=(0,J.useServerRoute)(v.queryKey.threads,{refreshInterval:I.INBOX_POLL_MS}),eA=(0,b.useRef)(!1);(0,B.useAppEvent)({hello:()=>{if(!eA.current){eA.current=!0;return}(0,J.revalidateAll)()},threads:()=>void(0,J.revalidate)(v.queryKey.threads),routines:()=>void(0,J.revalidate)(v.queryKey.routines),memory:()=>void(0,J.revalidate)(v.queryKey.memory),mcp:()=>{(0,J.revalidate)(v.queryKey.mcp),(0,J.revalidate)(v.queryKey.mcpTools)},config:()=>{(0,J.revalidate)(v.queryKey.config),(0,J.revalidate)(v.queryKey.llmModel)}});let{data:eC}=(0,J.useServerRoute)(v.queryKey.bot);(0,b.useEffect)(()=>{eM&&X.botThreads.sync(eM,eC)},[eM,eC]),(0,b.useEffect)(()=>{el.current=eM},[eM]);let eL=function({threads:e,resting:t,writing:n}){let r=(0,b.useRef)(Date.now()),[a,s]=(0,b.useState)([]),[l,i]=(0,b.useState)(null),o=a.length>0,u=(0,nb.useThursdayStore)(e=>e.callBack);(0,b.useEffect)(()=>{if(!e)return;let a=new Set(e.filter(e=>{let t,n;return t=e,"off"!==(n=u)&&!t.seen&&(t.room.questions.length>0||"any"===n&&"running"!==t.status)}).map(e=>e.id));if(s(e=>e.every(e=>a.has(e))?e:e.filter(e=>a.has(e))),!t||n)return;let l=r.current,o=e.filter(e=>a.has(e.id)&&(0,Y.toDate)(e.updatedAt).getTime()>l);o.length&&(r.current=Math.max(...o.map(e=>(0,Y.toDate)(e.updatedAt).getTime())),i(null),s(e=>[...e,...o.map(e=>e.id).filter(t=>!e.includes(t))]))},[e,u,t,n]),(0,b.useEffect)(()=>{n?(s([]),i(null)):r.current=Date.now()},[n]);let c=(0,b.useCallback)(()=>{s([]),i(null)},[]);(0,G.useEscape)(o,c),(0,b.useEffect)(()=>{if(!o||null!==l)return;let e=setTimeout(()=>i(Date.now()),I.CALL_BACK.ringMs);return()=>clearTimeout(e)},[o,l]),(0,b.useEffect)(()=>{if(o&&null===l){let e;return(e=new Audio("/sounds/ring.ogg")).play().catch(()=>{}),()=>e.pause()}},[o,l]);let d=(0,b.useMemo)(()=>{let[t,...n]=a.flatMap(t=>{let n=e?.find(e=>e.id===t);if(!n)return[];let r=n.room.questions[0];return[{id:n.id,bot:r?.bot??n.bot,kind:r?"question":"done"===n.status?"done":"stopped",label:n.label,text:r?.text??n.outcome??n.ask?.question??n.label,options:r?.options??[],questionId:r?.id??null}]});return t?{first:t,others:n,missedAt:l}:null},[a,e,l]);(0,b.useEffect)(()=>{X.ringingThreads.set(a)},[a]);let h=(0,b.useCallback)(()=>{s([]),i(null)},[]);return{ringing:d,isRinging:o,ringingFor:a,answered:h,unanswered:(0,b.useCallback)(e=>{e.length&&(s(t=>[...e,...t.filter(t=>!e.includes(t))]),i(Date.now()))},[]),settle:(0,b.useCallback)(()=>{r.current=Date.now()},[]),decline:c}}({threads:eM,resting:"idle"===l,writing:e}),{answered:eR,unanswered:eI,settle:eO}=eL;(0,b.useEffect)(()=>X.screenActs.subscribe(e=>{eu.current&&eo.send(nD(e))}),[eo]);let eD=(0,b.useRef)(null);(0,b.useEffect)(()=>{var e;let t,n=()=>{let e=eD.current;e&&eu.current&&!D.current.on&&(eD.current=null,eo.send(e))};P.current=n;let r=(e=e=>{eu.current&&(eD.current=e?"The user started sharing their screen with you. What is on it now is known only by looking at it; what was said about a screen before may not be what is there.":"The user stopped sharing their screen.",n())},t=()=>e(null!==no),nc.add(t),()=>{nc.delete(t)});return()=>{r(),P.current=null}},[eo]);let eP=(0,b.useCallback)(async(e=null)=>{if(ed.current)return;ed.current=!0,en.current&&clearInterval(en.current),en.current=null,eh.current+=1;let t=r.current,n=K.current;for(let e of(r.current=null,K.current=null,eu.current=!1,ec.current=!1,eD.current=null,nf(),ea.current=!1,V.current))W.current.delete(e);V.current.clear(),eo.close(),eo.clear(),U.current?.abort(),U.current=null,D.current.spoke=!1,ex(),z.current&&clearTimeout(z.current),eN(),eO(),w(null),x(null),i(t?"ending":"idle"),t&&A(rO()),p([]),f(null),ew(null),R.current&&clearTimeout(R.current),R.current=null,q.current=!1,await t?.close(),H.current?.(),H.current=null;let a=F.current;F.current=null,ed.current=!1,i("idle"),t&&j(e),n&&nP(n,a),t&&s.current&&(s.current.currentTime=0,s.current.play().catch(()=>{}))},[eo,eN,ex,ew]);(0,b.useEffect)(()=>{let e=()=>{let e=K.current;e&&navigator.sendBeacon(v.queryKey.callEnd,e)};return window.addEventListener("pagehide",e),()=>window.removeEventListener("pagehide",e)},[]),(0,b.useEffect)(()=>()=>{eh.current+=1,H.current?.(),H.current=null,r.current?.close(),r.current=null;let e=K.current;for(let t of(K.current=null,eu.current=!1,ec.current=!1,e&&nP(e),V.current))W.current.delete(t);V.current.clear(),U.current?.abort(),U.current=null,z.current&&clearTimeout(z.current),eS.current&&clearTimeout(eS.current),D.current.giveUp&&clearTimeout(D.current.giveUp),R.current&&clearTimeout(R.current),c.current&&clearTimeout(c.current),en.current&&clearInterval(en.current),nf()},[]);let eF=(0,b.useCallback)(()=>{if(en.current)return;let e=Date.now();en.current=setInterval(()=>{let t=Date.now();((et.current>e-I.CALL_END.unsaidMs?t-Math.max(et.current,e)>=I.CALL_END.quietMs:t-e>=I.CALL_END.unsaidMs)||t-e>=I.CALL_END.maxMs)&&eP("hungUp")},100)},[eP]);(0,b.useEffect)(()=>{if(!e_)return;$.current=Date.now();let e=setInterval(()=>{if(!r.current)return;let e=I.CALL_IDLE.hangUpMs-(Date.now()-$.current);w(e<=I.CALL_IDLE.warnMs?Math.max(0,Math.ceil(e/1e3)):null),e<=0&&!D.current.on&&eP("quiet")},1e3);return()=>clearInterval(e)},[e_,eP]),(0,b.useEffect)(()=>{if(!e_)return;let e=setInterval(ev,1e3);return()=>clearInterval(e)},[e_,ev]);let e$=(0,b.useCallback)(async()=>{let e=eL.isRinging,t=eL.ringingFor;if(ec.current||ed.current)return;if(eu.current||"idle"!==l)return eP();eR(),n1(),i("connecting"),j(null),d(!1),ec.current=!0,eu.current=!0,F.current=null,eo.clear(),eh.current+=1;let n=eh.current,o=()=>eu.current&&eh.current===n;try{a.current??=(0,nx.createAudioTap)(),function(e){if("suspended"!==e.state||rq)return;rq=!0;let t=()=>{rq=!1,window.removeEventListener("pointerdown",t),window.removeEventListener("keydown",t),e.resume().catch(()=>{})};window.addEventListener("pointerdown",t),window.addEventListener("keydown",t),L.toast.add({type:"warning",title:"Tap anywhere to hear her",description:"This call opened on its own, so the browser is holding the audio."})}(a.current.open().context);let t=new Audio("/sounds/start_voice.ogg");s.current??=new Audio("/sounds/end_voice.ogg");let n=await (!("locks"in navigator)?Promise.resolve(()=>{}):new Promise(e=>{navigator.locks.request("thursday-spoken-call",{ifAvailable:!0},t=>t?new Promise(t=>e(()=>t())):void e(null))}));if(!n)throw new rz("A call is already on in another tab of this app. Hang up there, or go on there.");H.current=n;let l=new AbortController;U.current=l;let i={failures:0},u={failures:0},c={callId:"",opening:null,standing:null,opened:{webSearch:O.LIVE_DEFAULTS.webSearch,readSkills:O.LIVE_DEFAULTS.readSkills}},h=new Map,m=new Map,g=null,y=e=>{let t={query:e.query,sources:e.sources};return rK(i,()=>r$(c.callId,[{id:e.row,role:"tool",tool:nS.TOOL_NAMES.web_search,text:JSON.stringify(t),seq:Math.max(0,Math.round(e.seq)),fragments:null}])),!!e.sources.length&&g===e.id&&(z.current&&clearTimeout(z.current),f(n=>n&&n.id!==e.id?n:{id:e.id,name:nS.TOOL_NAMES.web_search,line:(0,nz.toolLine)(nS.TOOL_NAMES.web_search,JSON.stringify(t)),done:!0,bot:null,sources:e.sources}),!0)},w=await r_({initialize:async t=>{let n=(0,nE.unwrapResult)(await rP(t,e));if(!o())throw nP(n.callId),Error("The call closed during startup.");return K.current=n.callId,c.callId=n.callId,c.opening=n.opening,c.standing=n.standing,c.opened=n.opened,n.sdp},audio:a.current,on:{runTool:async e=>{if(e.name===nS.TOOL_NAMES.end_call)return eF(),"Ending the call.";if(e.name===nS.TOOL_NAMES.emote){let{word:t,reply:n}=function(e){let t="";try{let n=JSON.parse(e);n&&"object"==typeof n&&"text"in n&&(t=String(n.text??"").trim())}catch{t=""}let n=Array.from(t).length;if(!n)return{word:null,reply:"Nothing was shown: text is empty."};if(n>rC.FACE_WORD_MAX)return{word:null,reply:`Too long: ${n} characters, ${rC.FACE_WORD_MAX} at most. Nothing was shown.`};let r=(0,rC.undrawable)(t);return r?{word:null,reply:`Cannot draw "${r}"; use only the characters \`text\` lists. Nothing was shown.`}:{word:t.toUpperCase(),reply:"Shown."}}(e.arguments);return t&&A({text:t,at:Date.now()}),n}if(e.name===nS.TOOL_NAMES.look_at_screen){if(null===no)return np()?"Nothing is being shared. They can share a screen, a window or a tab with Share screen, under your face.":"Nothing is being shared, and this browser cannot share a screen.";let e=r.current?.messageLimit(),t=e&&Number.isFinite(e)&&e>2048?e:65536,n=await ng(t-1024);return"failed"in n?n.failed:{output:"Their screen as it is now follows, as a picture.",image:n.url}}ep(e);let t=e.name===nS.TOOL_NAMES.web_search;t&&(g=e.id);let n=!1;try{let r=await nK(c.callId,e,c.opened,l.signal);em(e,r);let a=e.name===nS.TOOL_NAMES.thread_start?function(e){try{let{threadId:t,bot:n,label:r}=JSON.parse(e);return"string"==typeof t&&"string"==typeof n&&"string"==typeof r?{bot:n,label:r}:null}catch{return null}}(r):null;return a&&eo.send((({bot:e,label:t})=>`${e} took "${t}" and is working on it now.`)(a)),t&&(n=y({id:e.id,row:e.item??e.id,query:(0,nz.searchQueryOf)(e.arguments),sources:(0,nz.searchSourcesOf)(r),seq:0})),r}finally{n||eg(e.id)}},search:e=>{if(!e.done){g=e.id,ep({id:e.id,name:nS.TOOL_NAMES.web_search,arguments:JSON.stringify({query:e.query})});return}let t={id:e.id,row:e.id,query:e.query,sources:e.sources,seq:e.seq};m.set(e.responseId,t),y(t)||eg(t.id)},cited:(e,t)=>{let n=m.get(e);if(!n)return;let r=new Set(n.sources.map(e=>e.url));n.sources=[...n.sources.map(e=>t.find(t=>t.url===e.url)??e),...t.filter(e=>!r.has(e.url))],y(n)},reasoning:e=>{let t=(0,nz.reasoningTitle)(e.text);t&&_(t),rK(u,()=>rF(c.callId,{...e,seq:Math.max(0,Math.round(e.seq))}),"The backend's thinking is not being saved")},turn:e=>{let t="tool"===e.role?"":rU(e.text),n=!!t&&t!==rU(h.get(e.id)?.text??"");if(n&&(er.current=Date.now()),n&&"user"===e.role&&($.current=Date.now(),g)){let e=g;g=null,f(t=>t?.id===e?null:t)}"tool"!==e.role&&K.current===c.callId&&(h.set(e.id,{seq:e.seq,id:e.id,role:e.role,text:e.text}),p([...h.values()].sort((e,t)=>e.seq-t.seq).slice(-I.CALL_PAGE.scrollback))),e.done&&rK(i,()=>r$(c.callId,[{id:e.id,role:e.role,tool:e.tool,text:e.text,seq:Math.max(0,Math.round(e.seq)),fragments:e.fragments??null}]))},activity:e=>{var t;eE((t=e).speaking?"speaking":t.working||t.tools.length?t.tools.includes(nS.TOOL_NAMES.thread_start)?"delegating":"working":"listening");let n=e.working||e.tools.length>0;es.current=n,eb(n,e.speaking),e.speaking&&(et.current=Date.now()),(e.speaking&&!D.current.on||e.working||e.tools.length)&&($.current=Date.now()),D.current.on&&(e.speaking?D.current.spoke=!0:D.current.spoke&&ex())},finalized:e=>{F.current=e},warn:e=>L.toast.add({type:"warning",title:"Call warning",description:e}),failed:e=>{let t=F.current?.reason;if("expired"===t||"remote_hangup"===t)return void eP("expired"===t?"expired":"closed");if("content"===t){L.toast.add({type:"warning",title:"Live ended the call",description:"Its safety filter stopped the conversation."}),eP("closed");return}L.toast.add({type:"error",title:"Call failed",description:e}),d(!0),eP(F.current?"closed":"dropped")}}});if(!o())return void await w.close();r.current=w,ec.current=!1,ea.current=e,Z.current=e?new Set:nA(el.current??[]),eo.open(e=>void w.append("thinking",e)),er.current=Date.now(),c.opening&&(ey(),w.holdInput(I.LIVE_CALL.openingHoldMs),w.append("instructions",c.opening).then(e=>{e||ex()})),c.standing&&w.brief(c.standing),eT("listening"),x(Date.now()),t.play().catch(()=>{})}catch(r){if(H.current?.(),H.current=null,o()&&r instanceof rz?L.toast.add({type:"warning",title:"One call at a time",description:r.message}):o()&&(L.toast.add({type:"error",title:"Could not start the call",description:(0,S.errorToString)(r)}),d(!0),e&&eI(t)),eh.current!==n)return;K.current&&nP(K.current),K.current=null,ec.current=!1,eu.current=!1,U.current=null,eo.clear(),i("idle")}},[l,eP,ep,em,eg,eE,eT,eo,ey,ex,eb,d,eF,eL.isRinging,eL.ringingFor,eR,eI]);(0,b.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>j(null),I.CALL_ENDED_MS);return()=>clearTimeout(e)},[k]);let ez=(0,b.useCallback)(()=>a.current?.read()??rB,[]),eB=(0,b.useCallback)(()=>a.current?.readMic()??rB,[]),eq=(0,nb.useThursdayStore)(e=>e.wake),[eU,eK]=(0,b.useState)(!1),eH=ni();(0,b.useEffect)(()=>nl.onPlace(()=>void e$()),[e$]),re({enabled:"idle"===l&&eq.enabled&&!eU&&!eH,phrases:[eq.phrase],onWake:()=>void e$(),onError:e=>{eK(!0),L.toast.add({type:"error",title:"Wake word off",description:e})}});let eW=(0,nb.useThursdayStore)(e=>e.hotkey),eG="connecting"===l||"ending"===l;return(0,G.useHotkey)({enabled:eW.enabled&&!eG&&!eH,combo:eW.enabled&&(0,G.isCombo)(eW.combo)?eW.combo:null,onPress:()=>void e$()}),{status:l,failed:o,messages:h,tool:m,ended:k,thinkingSince:N,thinkingTitle:E,faceWord:M,idleLeft:y,since:g,call:e$,ringing:eL.ringing,decline:eL.decline,getSpectrum:ez,getMicSpectrum:eB,wakePhrase:eq.enabled&&!eU?eq.phrase:null,hotkey:eW.enabled&&(0,G.isCombo)(eW.combo)?eW.combo:null}}(t.on),k=(0,G.useHotkeyLabel)(w),j=(0,nb.useThursdayStore)(e=>e.captionView),{data:N}=(0,J.useServerRoute)(v.queryKey.config),T=N?(0,e4.isConfigSet)(N,O.LIVE_PROVIDER.apiKeyName):e,E="idle"!==n,_=t.end;(0,b.useEffect)(()=>{E&&t.on&&_()},[E,t.on,_]);let M=t.on&&!E,A=(0,nb.useThursdayStore)(e=>e.textModel),{settings:C}=(0,nv.useLiveSettings)(),R=C?.backendModel??O.LIVE_DEFAULTS.backendModel,P=(0,b.useMemo)(()=>{let e=e=>(0,e4.isConfigSet)(N,e),n=(0,nw.textCallRunsOn)(e),r=A&&e(D.TEXT_MODEL_PROVIDERS[A.provider].apiKeyName)?A:n?{provider:n,model:R}:null;return{on:M,busy:t.busy,error:t.error,say:t.say,again:t.again,end:t.end,runsOn:r,fallback:r?.provider!=="openai"&&e(D.TEXT_MODEL_PROVIDERS.openai.apiKeyName)?{provider:"openai",model:R}:null}},[M,t.busy,t.error,t.say,t.again,t.end,N,A,R]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(an,{live:"idle"!==n,ringing:null!==m}),(0,r.jsx)(av,{status:M?t.status:n,failed:M?null!==t.error:a,messages:M?t.messages:s,tool:M?t.tool:l,thinkingSince:M?t.thinkingSince:i,thinkingTitle:M?t.thinkingTitle:o,ended:u,faceWord:c,onTap:p,ringing:T?m:null,onDecline:f,wakePhrase:y,hotkeyLabel:k,idleLeft:d,since:h,getSpectrum:M?ny:g,getMicSpectrum:x,captionView:j,callable:T,written:E?null:P})]})}],692888)},379227,(e,t,n)=>{var r;"u">typeof __nccwpck_require__&&(__nccwpck_require__.ab="/ROOT/node_modules/next/dist/compiled/tty-browserify/"),(r={}).isatty=function(){return!1},r.ReadStream=function(){throw Error("tty.ReadStream is not implemented")},r.WriteStream=function(){throw Error("tty.WriteStream is not implemented")},t.exports=r},90317,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={bindSnapshot:function(){return u},createAsyncLocalStorage:function(){return o},createSnapshot:function(){return c}};for(var a in r)Object.defineProperty(n,a,{enumerable:!0,get:r[a]});let s=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class l{disable(){throw s}getStore(){}run(){throw s}exit(){throw s}enterWith(){throw s}static bind(e){return e}}let i="u">typeof globalThis&&globalThis.AsyncLocalStorage;function o(){return i?new i:new l}function u(e){return i?i.bind(e):l.bind(e)}function c(){return i?i.snapshot():function(e,...t){return e(...t)}}},242344,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"workAsyncStorageInstance",{enumerable:!0,get:function(){return r}});let r=(0,e.r(90317).createAsyncLocalStorage)()},563599,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"workAsyncStorage",{enumerable:!0,get:function(){return r.workAsyncStorageInstance}});let r=e.r(242344)},309885,(e,t,n)=>{"use strict";function r(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"encodeURIPath",{enumerable:!0,get:function(){return r}})},667585,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"BailoutToCSR",{enumerable:!0,get:function(){return a}});let r=e.r(132061);function a({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new r.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},652157,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"PreloadChunks",{enumerable:!0,get:function(){return o}});let r=e.r(843476),a=e.r(174080),s=e.r(563599),l=e.r(309885),i=e.r(543369);function o({moduleIds:e}){if("u">typeof window)return null;let t=s.workAsyncStorage.getStore();if(void 0===t)return null;let n=[];if(t.reactLoadableManifest&&e){let r=t.reactLoadableManifest;for(let t of e){if(!r[t])continue;let e=r[t].files;n.push(...e)}}if(0===n.length)return null;let u=(0,i.getAssetTokenQuery)();return(0,r.jsx)(r.Fragment,{children:n.map(e=>{let n=`${t.assetPrefix}/_next/${(0,l.encodeURIPath)(e)}${u}`;return e.endsWith(".css")?(0,r.jsx)("link",{precedence:"dynamic",href:n,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,a.preload)(n,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},869093,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return u}});let r=e.r(843476),a=e.r(271645),s=e.r(667585),l=e.r(652157);function i(e){return{default:e&&"default"in e?e.default:e}}let o={loader:()=>Promise.resolve(i(()=>null)),loading:null,ssr:!0},u=function(e){let t={...o,...e},n=(0,a.lazy)(()=>t.loader().then(i)),u=t.loading;function c(e){let i=u?(0,r.jsx)(u,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,c=o?a.Suspense:a.Fragment,d=t.ssr?(0,r.jsxs)(r.Fragment,{children:["u"<typeof window?(0,r.jsx)(l.PreloadChunks,{moduleIds:t.modules}):null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(s.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(c,{...o?{fallback:i}:{},children:d})}return c.displayName="LoadableComponent",c}},770703,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return a}});let r=e.r(555682)._(e.r(869093));function a(e,t){let n={};"function"==typeof e&&(n.loader=e);let a={...n,...t};return(0,r.default)({...a,modules:a.loadableGenerated?.modules})}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},618566,(e,t,n)=>{t.exports=e.r(976562)}]);
|