thursday-agent 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +5 -5
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.json +5 -5
- package/.next/server/app/_global-error/page/build-manifest.json +2 -2
- 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/build-manifest.json +2 -2
- 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 +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/artifact/route.js +10 -10
- package/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/files/route.js +1 -1
- package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/route.js +8 -8
- package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/route.js +8 -8
- package/.next/server/app/api/bot/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/file/route.js +15 -15
- package/.next/server/app/api/bot/thread/file/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/route.js +5 -5
- package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/tool-result/[id]/route.js +6 -6
- package/.next/server/app/api/bot/tool-result/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js +3 -3
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/events/route.js +1 -1
- package/.next/server/app/api/events/route.js.nft.json +1 -1
- package/.next/server/app/api/favicon/[host]/route.js +4 -4
- 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 +5 -5
- package/.next/server/app/api/llm-model/automatic/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/catalog/[provider]/route.js +5 -5
- package/.next/server/app/api/llm-model/catalog/[provider]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/credits/[provider]/route.js +5 -5
- package/.next/server/app/api/llm-model/credits/[provider]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/route.js +6 -6
- package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/subscription/route.js +6 -6
- package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/[name]/route.js +5 -5
- package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/oauth/callback/route.js +6 -6
- package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/route.js +5 -5
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/tools/route.js +5 -5
- package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/edit/route.js +15 -15
- package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/route.js +4 -4
- package/.next/server/app/api/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/reach/route.js +18 -18
- package/.next/server/app/api/reach/route.js.nft.json +1 -1
- package/.next/server/app/api/routine/route.js +8 -8
- package/.next/server/app/api/routine/route.js.nft.json +1 -1
- package/.next/server/app/api/running/route.js +2 -2
- package/.next/server/app/api/running/route.js.nft.json +1 -1
- package/.next/server/app/api/signins/route.js +3 -3
- package/.next/server/app/api/signins/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/[source]/[name]/route.js +6 -6
- 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 +5 -5
- package/.next/server/app/api/thursday/call/end/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/plan/route.js +14 -14
- package/.next/server/app/api/thursday/call/plan/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/route.js +6 -6
- package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/settings/route.js +5 -5
- package/.next/server/app/api/thursday/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/text/route.js +14 -14
- package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/tool-call/route.js +15 -15
- package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
- package/.next/server/app/api/update/route.js +7 -7
- package/.next/server/app/api/update/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/files/route.js +6 -6
- 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/build-manifest.json +2 -2
- package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +11 -11
- 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 +2 -2
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next/server/app/page/build-manifest.json +2 -2
- package/.next/server/app/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/page/server-reference-manifest.json +184 -184
- package/.next/server/app/page.js +10 -10
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__01jpmcj._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__03bjojd._.js +3 -3
- package/.next/server/chunks/{[root-of-the-server]__0wosonh._.js → [root-of-the-server]__05u-9a3._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1dyse-1._.js → [root-of-the-server]__0_qe8iq._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0d-dfqm._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0jqidnu._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0mmynvy._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__0ncs9uu._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0qhf60h._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0sea36s._.js +4 -4
- package/.next/server/chunks/[root-of-the-server]__0zezbds._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__12hkdpz._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__13hng6h._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__14inehv._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__17kdjf6._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__17yv6lg._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0b3_rzi._.js → [root-of-the-server]__1hjb8wf._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1jcu_e9._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1jmr2ed._.js +3 -3
- package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1o7z93z._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__1onvx8x._.js +2 -2
- package/.next/server/chunks/_0-mqt2w._.js +1 -1
- package/.next/server/chunks/_04s1gb9._.js +30 -27
- package/.next/server/chunks/_06u9yo-._.js +1 -1
- package/.next/server/chunks/_08354bn._.js +33 -30
- package/.next/server/chunks/_083t_nr._.js +1 -1
- package/.next/server/chunks/_0c-s0ei._.js +1 -1
- package/.next/server/chunks/_0gifi_2._.js +2 -2
- package/.next/server/chunks/_0m3sdq8._.js +1 -1
- package/.next/server/chunks/_0pljp-1._.js +1 -1
- package/.next/server/chunks/_0wjia9n._.js +1 -1
- package/.next/server/chunks/_0wyh244._.js +33 -30
- package/.next/server/chunks/_0x2mdif._.js +1 -1
- package/.next/server/chunks/_1-sk_q4._.js +1 -1
- package/.next/server/chunks/_12a_gfz._.js +1 -1
- package/.next/server/chunks/_14-kmob._.js +1 -1
- package/.next/server/chunks/_16zct7w._.js +30 -27
- package/.next/server/chunks/_1823_7a._.js +4 -4
- package/.next/server/chunks/_1f_x75d._.js +1 -1
- package/.next/server/chunks/_1o2r4ja._.js +1 -1
- package/.next/server/chunks/_1q42187._.js +3 -3
- package/.next/server/chunks/_1ufbxe1._.js +1 -1
- package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
- package/.next/server/chunks/features_14kex_m._.js +11 -11
- package/.next/server/chunks/features_bot_08z387_._.js +4 -4
- package/.next/server/chunks/features_memory_0__61kl._.js +1 -1
- package/.next/server/chunks/features_memory_1uqvksn._.js +1 -1
- package/.next/server/chunks/features_workspace_workspace_ts_13h82gv._.js +1 -1
- package/.next/server/chunks/features_workspace_workspace_ts_1iyjroj._.js +3 -3
- package/.next/server/chunks/ssr/{[root-of-the-server]__0x297x3._.js → [root-of-the-server]__03_9u5q._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__0653diy._.js → [root-of-the-server]__04ky8w1._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__1zlzs9j._.js → [root-of-the-server]__0crm8gr._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__02936mh._.js → [root-of-the-server]__0d3n8i_._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__0s8q44q._.js → [root-of-the-server]__0d4o9hs._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__0id2dqb._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__1s0etwd._.js → [root-of-the-server]__0q2c15o._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__0t_oz3-._.js +6 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__16x99f1._.js → [root-of-the-server]__12r70jm._.js} +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1867koj._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0glkz9k._.js → [root-of-the-server]__1fvh0zn._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__1t38-p_._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__1c1xyyb._.js → [root-of-the-server]__1uy0zqr._.js} +2 -2
- package/.next/server/chunks/ssr/_02uubus._.js +3 -0
- package/.next/server/chunks/ssr/_0692i-a._.js +3 -0
- package/.next/server/chunks/ssr/_079xt7h._.js +32 -29
- package/.next/server/chunks/ssr/_07g7ojr._.js +3 -0
- package/.next/server/chunks/ssr/_0ewhz_x._.js +3 -0
- package/.next/server/chunks/ssr/_0f3t9pm._.js +2 -2
- package/.next/server/chunks/ssr/_0gx6qzr._.js +57 -0
- package/.next/server/chunks/ssr/_0pjwmak._.js +6 -0
- package/.next/server/chunks/ssr/_0pnzfq1._.js +1 -1
- package/.next/server/chunks/ssr/_0px9eat._.js +3 -0
- package/.next/server/chunks/ssr/_0r2_l__._.js +3 -0
- package/.next/server/chunks/ssr/{_20_wc-g._.js → _0rcuovx._.js} +2 -2
- package/.next/server/chunks/ssr/_0uwhhcs._.js +3 -0
- package/.next/server/chunks/ssr/{_1wct0tm._.js → _128r03g._.js} +1 -1
- package/.next/server/chunks/ssr/_12c2n7f._.js +3 -0
- package/.next/server/chunks/ssr/{_12_ail7._.js → _14f64h2._.js} +1 -1
- package/.next/server/chunks/ssr/_17fa2ns._.js +162 -0
- package/.next/server/chunks/ssr/_1_px1o-._.js +3 -0
- package/.next/server/chunks/ssr/_1a_w_du._.js +1 -1
- package/.next/server/chunks/ssr/_1e_9qjr._.js +1 -1
- package/.next/server/chunks/ssr/_1f59vze._.js +57 -0
- package/.next/server/chunks/ssr/_1j5ohq5._.js +3 -0
- package/.next/server/chunks/ssr/{_0ingto_._.js → _1kj3d2q._.js} +2 -2
- package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
- package/.next/server/chunks/ssr/_1ocl7u0._.js +3 -0
- package/.next/server/chunks/ssr/_1q9r6u6._.js +3 -0
- package/.next/server/chunks/ssr/{_0fvctar._.js → _1qqusa-._.js} +2 -2
- package/.next/server/chunks/ssr/_1soynbw._.js +2 -2
- package/.next/server/chunks/ssr/_1uok0wt._.js +3 -0
- package/.next/server/chunks/ssr/_1v1pcoh._.js +1 -1
- package/.next/server/chunks/ssr/_1xw9imq._.js +3 -0
- package/.next/server/chunks/ssr/{components_ui_markdown-body_tsx_0h7bkrz._.js → components_ui_markdown-body_tsx_08i96c6._.js} +2 -2
- package/.next/server/chunks/ssr/features_0rrgq_t._.js +1 -1
- package/.next/server/chunks/ssr/features_ai_components_model-picker_tsx_0ucb1y9._.js +1 -1
- package/.next/server/chunks/ssr/features_bot_0tb4ui-._.js +2 -2
- package/.next/server/chunks/ssr/features_bot_components_01ye2wp._.js +1 -1
- package/.next/server/chunks/ssr/features_bot_components_bot-setting_tsx_01ajft6._.js +2 -2
- package/.next/server/chunks/ssr/features_bot_components_thread-setting_tsx_0yae7zy._.js +1 -1
- package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +2 -2
- 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 +2 -2
- package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
- package/.next/server/chunks/ssr/features_skills_components_skills-setting_tsx_1wtuuip._.js +1 -1
- package/.next/server/chunks/ssr/features_thursday_components_thursday-setting_tsx_1_6ydrc._.js +1 -1
- package/.next/server/chunks/ssr/{node_modules_193w7l8._.js → node_modules_02djdfa._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1bwlhwa._.js → node_modules_03ybg-h._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_01xoz64._.js → node_modules_066eqdg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_20ifwl6._.js → node_modules_09605b3._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1yilsx4._.js → node_modules_0_c17cv._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_080f5gu._.js → node_modules_0a1-9-h._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_17c047f._.js → node_modules_0bfpl_c._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1pav8g4._.js → node_modules_0brchjo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0gwiuga._.js → node_modules_0c0pgdi._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_02-zrtu._.js → node_modules_0ep265x._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0kqej10._.js → node_modules_0gzvt6a._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0i18max._.js → node_modules_0h4gjw5._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1m2_gxv._.js → node_modules_0iso-he._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0cda8i6._.js → node_modules_0jvqmb4._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_0kzgugm._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_0uvoegq._.js → node_modules_0l8gpkg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_12ajdg8._.js → node_modules_0mlrvds._.js} +2 -2
- package/.next/server/chunks/ssr/node_modules_0nvqvnw._.js +7 -7
- package/.next/server/chunks/ssr/{node_modules_1s3j8gb._.js → node_modules_0ogtyfm._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1_xiwxs._.js → node_modules_0os_-0h._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1abjhxx._.js → node_modules_0p05zru._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1o-m6_3._.js → node_modules_0pf8124._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0eqvt2l._.js → node_modules_0pp3v4f._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0rzz90e._.js → node_modules_0r1vv13._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1kum1yu._.js → node_modules_0r9yw6x._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1yw5fq4._.js → node_modules_0rk1a3e._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1es3wjv._.js → node_modules_0sq1pa3._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1-cv1_p._.js → node_modules_0w-pjyz._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_0g_yuwn._.js → node_modules_0yoh66_._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1s9agqr._.js → node_modules_10kn3ni._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1yajzrd._.js → node_modules_124ipg-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0svoyrb._.js → node_modules_12_p7d0._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_203yqqb._.js → node_modules_12w12wr._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_17ks351._.js → node_modules_16kmp_v._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_05qs8r_._.js → node_modules_16m_yhd._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_07dc1cr._.js → node_modules_171uvar._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0qsi9t2._.js → node_modules_19pn2ti._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0k9_jdk._.js → node_modules_1_ly5yy._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0o_gq58._.js → node_modules_1_wsn9q._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1u7wlaq._.js → node_modules_1djak6n._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_08cq8i-._.js → node_modules_1e-oxmh._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_15x7int._.js → node_modules_1ed4zep._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1pkpq6d._.js → node_modules_1f2qlxm._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1aw7c9f._.js → node_modules_1fn72fs._.js} +2 -2
- package/.next/server/chunks/ssr/node_modules_1h9p77x._.js +7 -7
- package/.next/server/chunks/ssr/{node_modules_1ucf2fi._.js → node_modules_1hj0rvo._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_12pvysk._.js → node_modules_1jvkoqj._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0tq4-57._.js → node_modules_1jzofr8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_08hfp3a._.js → node_modules_1maqy-g._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_071fb26._.js → node_modules_1oox5h1._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0_jxnnn._.js → node_modules_1p56fwh._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_01yukzc._.js → node_modules_1prbr1-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1hrbceb._.js → node_modules_1qfou69._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_11f1w-3._.js → node_modules_1qnosqe._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_1kd_hpx._.js → node_modules_1rdpn6v._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_079iwnx._.js → node_modules_1v6m9sp._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1iapzqf._.js → node_modules_1z8ywx9._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1dim95c._.js → node_modules_1zzudo-._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1_71wv3._.js → node_modules_2157u1j._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_1c5gb92._.js → node_modules_katex_dist_katex_mjs_12lynt6._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_katex_dist_katex_mjs_1ocxq2z._.js → node_modules_katex_dist_katex_mjs_1vjoadq._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_1v93o68._.js +1 -1
- package/.next/server/middleware-build-manifest.js +5 -5
- 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 +185 -185
- package/.next/static/chunks/051z85h3ofmif.js +1 -0
- package/.next/static/chunks/05722zc-sohb_.js +4 -0
- package/.next/static/chunks/07jo959manleh.js +1 -0
- package/.next/static/chunks/0_5a18_y41-_4.js +1 -0
- package/.next/static/chunks/0be7dgti95u_2.js +1 -0
- package/.next/static/chunks/0c28x0q2aqsbj.js +1 -0
- package/.next/static/chunks/0o_rabv5are-o.js +2 -0
- package/.next/static/chunks/{0776-hu4_eek7.js → 0wwq57j09skhy.js} +2 -2
- package/.next/static/chunks/0zm3urd75-zw5.js +1 -0
- package/.next/static/chunks/16hfi69t-6a4t.js +2 -0
- package/.next/static/chunks/1g58g8-daiwu5.js +3 -0
- package/.next/static/chunks/1i1u85j-_yb1n.js +15 -0
- package/.next/static/chunks/1kd2sxkkrae8e.js +1 -0
- package/.next/static/chunks/{3xloayc4c096r.js → 1n3a07w81jbc-.js} +1 -1
- package/.next/static/chunks/1nncyxatu7une.js +1 -0
- package/.next/static/chunks/1s5t41jiomssd.css +1 -0
- package/.next/static/chunks/1yl4mlpsw8e7h.js +1 -0
- package/.next/static/chunks/{33qtnlc00c9gq.js → 2gl-fo_rmmmq0.js} +1 -1
- package/.next/static/chunks/2h_sak2oi70qs.js +1 -0
- package/.next/static/chunks/2isg5redeg2bc.js +1 -0
- package/.next/static/chunks/{2fxn-xltgy2un.js → 2of2-kggzp-fk.js} +1 -1
- package/.next/static/chunks/2vmran3sacktz.js +1 -0
- package/.next/static/chunks/2w02v9g8o9-rz.js +1 -0
- package/.next/static/chunks/2wi2pcbjrqm86.js +1 -0
- package/.next/static/chunks/2xk8otp3gnzml.js +1 -0
- package/.next/static/chunks/2ym1hrikoit8p.js +1 -0
- package/.next/static/chunks/34d1f980dv5c6.js +18 -0
- package/.next/static/chunks/34zhr71217o1-.js +2 -0
- package/.next/static/chunks/{0o1r15rfncytn.js → 37r4l2878vybp.js} +1 -1
- package/.next/static/chunks/{2cz5734j90h5b.js → 3a-2z23puvz2z.js} +1 -1
- package/.next/static/chunks/3d55-y263hup9.js +1 -0
- package/.next/static/chunks/3dzrveotr82eu.js +39 -0
- package/.next/static/chunks/3fensfht8pxhl.js +55 -0
- package/.next/static/chunks/3k7fum0yljmyr.js +1 -0
- package/.next/static/chunks/3sawwm4vucnzn.js +1 -0
- package/.next/static/chunks/{0z0-g4k1hnpw2.js → 3u208m--8u1iq.js} +1 -1
- package/.next/static/chunks/{turbopack-1kym6rf88i5i0.js → turbopack-0ekrsq98buh0j.js} +1 -1
- package/README.md +18 -18
- package/bin/background.mjs +60 -32
- package/bin/print.mjs +82 -0
- package/bin/thursday.mjs +44 -13
- package/guide/bots.md +19 -3
- package/guide/calls.md +5 -2
- package/guide/memory.md +2 -1
- package/guide/setup.md +8 -6
- package/guide/trouble.md +4 -0
- package/package.json +11 -5
- package/public/voices/intro/awake-f4e02fad.ogg +0 -0
- package/seed-skills/concierge/travel/scripts/itinerary.mjs +2 -1
- package/server.js +1 -1
- package/skills/artifact/references/document.md +5 -2
- package/skills/artifact/runtime/document/markdown.mjs +14 -1
- package/skills/artifact/runtime/shell/head.html +1 -1
- package/skills/artifact/scripts/document.mjs +9 -3
- package/skills/browser/SKILL.md +17 -13
- package/.next/server/chunks/[root-of-the-server]__0ald4vb._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0srfj96._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__1kos36s._.js +0 -6
- package/.next/server/chunks/ssr/_024j8bs._.js +0 -3
- package/.next/server/chunks/ssr/_04jb10a._.js +0 -3
- package/.next/server/chunks/ssr/_059oyhd._.js +0 -3
- package/.next/server/chunks/ssr/_0d0uyl3._.js +0 -3
- package/.next/server/chunks/ssr/_0fk7dbp._.js +0 -88
- package/.next/server/chunks/ssr/_0gfa_rb._.js +0 -3
- package/.next/server/chunks/ssr/_0i7zd74._.js +0 -3
- package/.next/server/chunks/ssr/_0sp2z94._.js +0 -3
- package/.next/server/chunks/ssr/_1avnw03._.js +0 -57
- package/.next/server/chunks/ssr/_1bfrntd._.js +0 -6
- package/.next/server/chunks/ssr/_1cpvfkg._.js +0 -3
- package/.next/server/chunks/ssr/_1cqjpyq._.js +0 -3
- package/.next/server/chunks/ssr/_1khngyc._.js +0 -72
- package/.next/server/chunks/ssr/_1kyjimg._.js +0 -162
- package/.next/server/chunks/ssr/_1sw4r4m._.js +0 -6
- package/.next/server/chunks/ssr/_20004tu._.js +0 -57
- package/.next/server/chunks/ssr/node_modules_01alue6._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_02n9-pb._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_0zxr5sz._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_trash_mjs_0px2gzr._.js +0 -3
- package/.next/static/chunks/02d9vhnz5mwvu.js +0 -1
- package/.next/static/chunks/06ff4fq0z4das.js +0 -1
- package/.next/static/chunks/09q9n7jrkm4c9.js +0 -39
- package/.next/static/chunks/0b3wt5kqs-mk2.js +0 -2
- package/.next/static/chunks/0blrj_tg1yur0.js +0 -1
- package/.next/static/chunks/0dn1ptom1ahgg.js +0 -18
- package/.next/static/chunks/0dq7uppta9s--.js +0 -1
- package/.next/static/chunks/0hoz2b--nhn4y.js +0 -1
- package/.next/static/chunks/0kfjtkez2xze2.js +0 -1
- package/.next/static/chunks/0mv2zywfzt83k.js +0 -4
- package/.next/static/chunks/0txtrhykehsd_.js +0 -55
- package/.next/static/chunks/17vs1vz7_4l4p.css +0 -1
- package/.next/static/chunks/1dnvf_117h4k3.js +0 -2
- package/.next/static/chunks/1irynso77np9t.js +0 -1
- package/.next/static/chunks/1sh_-w_keseat.js +0 -1
- package/.next/static/chunks/1z2_9pl3nezly.js +0 -3
- package/.next/static/chunks/23ty4edkuxirx.js +0 -1
- package/.next/static/chunks/2f1cnfz4h1e2x.js +0 -1
- package/.next/static/chunks/2jepcbdewlwlg.js +0 -1
- package/.next/static/chunks/2r_zq_knm0hph.js +0 -15
- package/.next/static/chunks/2yfmmo4qr_f-m.js +0 -1
- package/.next/static/chunks/3-xnkknav7azp.js +0 -1
- package/.next/static/chunks/38q31td1ecuay.js +0 -1
- package/.next/static/chunks/3n75-7grldc6f.js +0 -1
- package/.next/static/chunks/3ofr4htw4wpj3.js +0 -1
- package/.next/static/chunks/40bkw3zfenss4.js +0 -2
- package/public/voices/intro/awake-17dbafbf.ogg +0 -0
- package/public/voices/intro/models-d09ddc74.ogg +0 -0
- /package/.next/static/{YIQV0_9FZPTFUe9TCiVSF → 3_9hbwcAuWTSWCJSufp3d}/_buildManifest.js +0 -0
- /package/.next/static/{YIQV0_9FZPTFUe9TCiVSF → 3_9hbwcAuWTSWCJSufp3d}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{YIQV0_9FZPTFUe9TCiVSF → 3_9hbwcAuWTSWCJSufp3d}/_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),i=e.i(456420);let l={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"}]]};l.node;let o=(0,i.default)(l),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,i.default)(u);var d=e.i(770703),h=e.i(618566),p=e.i(271645),m=e.i(798120),f=e.i(167881),g=e.i(319036),x=e.i(728231),w=e.i(609507),y=e.i(463625),b=e.i(635963),v=e.i(553429),k=e.i(6799),j=e.i(393080),S=e.i(283653),N=e.i(647163),T=e.i(110703),E=e.i(616816),M=e.i(218080);let A={hello:"Hi, I'm Thursday. One thing first: this is a recording. You'll hear my real voice on our first call.",key:"First, I need a voice. Sign in with ChatGPT, and I talk on the plan you already have. Or paste an OpenAI key, if you'd rather. Neither one yet? No problem, skip ahead. I'll ask again later.",awake:"There we go — I'm awake. That's all a call needs. The rest is quick: your microphone, and who does the work for you.",mic:"Now let me hear you. Your browser will ask before it turns the microphone on — just say yes. From then on, say 'hey Thursday' anytime, and I'll pick up.",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.",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 sign in, or 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."},C=Array(M.SPECTRUM_BANDS).fill(0),_="thursday.intro.muted";var R=e.i(567334),L=e.i(387758),I=e.i(877267),O=e.i(377090),D=e.i(732061),$=e.i(298293),B=e.i(922521);let P=[{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}],z=[.2,1.6,2.5,3.1,3.55],q=["/sounds/opening-rise.ogg","/sounds/opening-step-1.ogg","/sounds/opening-step-2.ogg","/sounds/opening-step-3.ogg","/sounds/opening-land.ogg"],F=[2,3,1],U=[[],["🤍"],["🤍","☁️"],["☁️","🤍"],["☁️","🕊️"],["🕊️","☁️"],["🕊️","🦢"],["🦢","🕊️","☁️"],["🦢","🤍"],["🤍","⚪","🦢"],["🤍","⚪"],["⚪","🤍"]],K=[[],["🤍","⚪"],["🤍","⚪","🦢"],["🦢","🤍","🕊️"],["🦢","🕊️","☁️"],["🕊️","🦢","☁️"],["🕊️","☁️"],["☁️","🕊️"],["☁️","🖤"],["⚫","🖤","☁️"],["🖤","⚫"],["🖤","⚫"]],H=P[0].px;function W({anchor:e,onArrive:n,onHello:r,onDone:a}){let s=(0,p.useRef)(null),i=(0,B.useIsDark)(),l=(0,p.useRef)({dark:i,onArrive:n,onHello:r,onDone:a});return l.current={dark:i,onArrive:n,onHello:r,onDone:a},(0,p.useEffect)(()=>{let t=s.current,n=e.current,r={arrive:!1,hello:!1,done:!1},a=e=>{r[e]||(r[e]=!0,"arrive"===e?l.current.onArrive():"hello"===e?l.current.onHello():l.current.onDone())};if(!t||!n||window.matchMedia("(prefers-reduced-motion: reduce)").matches){a("arrive"),a("hello"),a("done");return}let i=t.getContext("2d");if(!i){a("arrive"),a("hello"),a("done");return}let o=z.map((e,t)=>e+(t>0?(Math.random()-.5)*.12:0)),u=!function(){try{return"1"===window.localStorage.getItem(_)}catch{return!1}}()?q.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,I.faceGlyphs)(),m=p?null:function(e,t){let n=Math.round(H*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,L.GLYPH_FONT)(n);let i=new Map;return e.forEach((e,t)=>{i.set(e,t),s.fillText(e,t%12*r+r/2,Math.floor(t/12)*r+r/2)}),{canvas:a,at:i,slot:r,scale:r/t/H}}([...new Set([...R.EMOJI_POOL,...U.flat(),...K.flat(),...F.flatMap(e=>$.WASH_SETS[e-1].emoji)])],h);if(!p&&!m){a("arrive"),a("hello"),a("done");return}let f=R.LEVELS-1,g=[],x=null,w=()=>{let e=window.innerWidth,r=window.innerHeight;t.width=Math.round(e*h),t.height=Math.round(r*h),i.setTransform(h,0,0,h,0,0),i.textAlign="center",i.textBaseline="middle",x=null;let a=n.getBoundingClientRect(),s=Number.parseFloat(getComputedStyle(n).getPropertyValue("--face-bleed"))/100||0,l=a.width*(1+2*s),o=a.left+a.width/2,u=a.top+a.height/2,c=L.DESIGN/l;g=P.map((t,n)=>{let a=.95*t.px/t.density,s=1.25*t.px/t.density,i=.12*n,l=Math.cos(i),h=Math.sin(i),p=70+26*n,m=[];for(let i=0;i*s<r;i++)for(let r=0;r*a<e;r++){let e=r*a+a/2,f=i*s+s/2,g=(e-o)*c,x=(f-u)*c,w=(g*l-x*h)/L.REST_R/t.radii,y=(g*h+x*l)/L.REST_R/t.radii,b=Math.hypot(w,y);if(b>2.6)continue;let v=Math.floor((Math.atan2(y,w)+Math.PI)/(2*Math.PI)*p),k=(0,R.hash)(v+13*n,3.1+d),j=(0,R.hash)(1.3*v,11.1+d);m.push({x:e,y:f,r:b,dx:w*L.REST_R,dy:y*L.REST_R,drift:.02+.14*k*k,go:.15+.9*(0,R.hash)(v,7.7+n),carry:j<.13?F[Math.floor(23*j)%F.length]:0,nx:g*(8/t.px)*.05,ny:x*(8/t.px)*.05,seed:(0,R.hash)(r+101*n,i),grain:(0,R.hash)(5.7*r+19+n,2.3*i+53),gap:.05+.3*(0,R.hash)(7.3*r+11,3.1*i+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}})};w(),window.addEventListener("resize",w);let y=(0,D.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}=l.current,d=s?U:K;p&&x!==s&&(x=s,i.fillStyle=getComputedStyle(t).color),(0,D.stepSmoke)(y,S,r,0,0,-1);let w=(0,O.windAt)(S,b),E=Math.exp(-r/L.TRAIL_FAST),M=Math.exp(-r/1.4);i.clearRect(0,0,t.width/h,t.height/h);let A=0;for(g.forEach((e,t)=>{let a=o[t],s=o[t+1];if(e.over||n<a)return;let l=n-s,u=l<=0?(0,R.smoothstep)(0,1,(n-a)/(0===t?1.2:.35)):1,c=l>0?(0,R.smoothstep)(0,.3,l):0,h=l>.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(l<=0)u>0&&n.r<2.6&&(v.dx=n.dx,v.dy=n.dy,v.dist=n.r*L.REST_R,a=(0,D.restValue)(v,g,0,L.REST_R,u,y,w));else{let e=n.r-n.drift*l**.8,t=(1+(1.5*((0,R.smoothstep)(.6,.88,Math.abs(e))*(1-(0,R.smoothstep)(1.2,1.55,Math.abs(e))))-1)*c)*(1-(0,R.smoothstep)(n.go,n.go+.4,l));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)*L.REST_R,(a=(0,D.restValue)(v,g,0,L.REST_R,1,y,w)*t)>.04&&c>.5&&(s=n.carry)}}(a*=(.66+.72*n.grain)*(.8+.4*(0,R.hash)(Math.floor(n.nx+.5*S),Math.floor(n.ny-.3*S))))>.3&&(0,R.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 i=e.fast[t]=a>e.fast[t]*E?a:e.fast[t]*E,o=e.slow[t]=a>e.slow[t]*M?a:e.slow[t]*M;if((a=i>.55*o?i:.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?L.CHURN_LETTERS:L.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]?$.WASH_SETS[e.pool[t]-1]:null,T=p?N?.letters??R.RAMP[m]:N?.emoji??(h?d[m]:R.EMOJI_POOL);e.glyph[t]=T[j%T.length],e.byLevel[m][e.inLevel[m]++]=t}A+=x,l>1.45&&0===x&&(e.over=!0),m||(i.font=(0,L.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){i.globalAlpha=R.ALPHA_TOP*(t/f);for(let t=0;t<n;t++){let n=b[r[t]];i.fillText(e.glyph[r[t]],n.x,n.y)}continue}i.globalAlpha=(0,R.emojiAlpha)(t,f);let a=e.px*m.scale*(.5+.5*(0,R.emojiWeight)(t,f));for(let t=0;t<n;t++){let n=b[r[t]],s=m.at.get(e.glyph[r[t]])??0;i.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)}}}),i.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===A){i.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",w),!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 i=Math.max(0,Math.min(1,(s-r)/1e3/t));e.volume=n*(1-i),i<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 G=e.i(95187);let Y=(0,G.createServerReference)("7f38b34f70eac7db809058738671337bb3925e5d5c",G.callServer,void 0,G.findSourceMapURL,"passIntroAction");var V=e.i(745747),J=e.i(333495),X=e.i(435135),Z=e.i(114923),Q=e.i(838098),ee=e.i(234916),et=e.i(67045),en=e.i(297825),er=e.i(895499),ea=e.i(991268),es=e.i(245629);let ei=["key","mic","bots","style","call"],el=(0,d.default)(()=>e.A(204916).then(e=>e.OfficeBackdrop),{loadableGenerated:{modules:[590714]},ssr:!1}),eo="Everyone did their part. The team is ready for you.";function eu({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 ec=({children:e})=>(0,t.jsx)("p",{className:"font-mono text-[11px] leading-relaxed text-pretty text-muted-foreground",children:e});function ed({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",children:r})]})}function eh({onSaved:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu,{children:"Give her a voice"}),(0,t.jsx)(E.CallLines,{onSaved:e})]})}function ep({mic:e}){let n=(0,et.useThursdayStore)(e=>e.wake);return e.allowed?(0,t.jsx)(ed,{children:`Microphone on, and "${n.phrase}" calls her`}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu,{children:"Turn on the microphone"}),e.failed?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:(0,N.cn)("text-[13px] leading-normal",N.WAITING_INK),children:e.failed.what}),(0,t.jsx)(ec,{children:e.failed.next})]}):(0,t.jsxs)(ec,{children:['On a call, and to hear "',n.phrase,'" while this tab is open. Chrome does that listening and sends what it hears to Google; Settings › Thursday switches it off.']})]})}function em({picked:e,onToggle:n}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu,{children:"Pick who comes along"}),(0,t.jsx)("div",{className:"flex flex-col",children:y.BOT_SEEDS.map(r=>{let a=!!e[r.name];return(0,t.jsxs)("label",{className:"flex min-h-9.5 cursor-pointer items-center gap-2.75 py-1",children:[(0,t.jsx)(b.BotMark,{size:24,seed:r.name,...r.icon,notify:!1,className:(0,N.cn)("shrink-0 transition-opacity",!a&&"opacity-40")}),(0,t.jsx)("span",{className:(0,N.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 text-xs leading-snug text-pretty text-muted-foreground",children:r.hint}),(0,t.jsx)(g.Switch,{checked:a,onCheckedChange:()=>n(r.name)})]},r.name)})}),(0,t.jsx)(ec,{children:"Every one comes along. Switch off any you will not use: Settings › Bots has them all, and you can make your own."})]})}function ef(){let{settings:e,patch:n}=(0,en.useLiveSettings)(),s=Math.max(0,w.PERSONAS.findIndex(t=>t.id===e?.persona)),i=w.PERSONAS[s],l=e=>n({persona:w.PERSONAS[(s+e+w.PERSONAS.length)%w.PERSONAS.length].id});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eu,{children:"Pick how she talks"}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("div",{className:"text-2xl font-semibold",children:i.label}),(0,t.jsx)("p",{className:"min-h-10 text-sm text-muted-foreground",children:i.about})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:()=>l(-1),children:[(0,t.jsx)(r.ChevronLeft,{}),"Previous"]}),(0,t.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:()=>l(1),children:["Next",(0,t.jsx)(a.ChevronRight,{})]})]}),(0,t.jsx)("div",{className:"flex gap-1.5",children:w.PERSONAS.map((e,n)=>(0,t.jsx)("span",{className:(0,N.cn)("h-0.5 w-5 rounded-full",n===s?"bg-foreground":"bg-border")},e.id))})]})}function eg({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 ex={ask:"Find me flights to Osaka in October.",onIt:`On it. ${y.ERRANDS_BOT} is looking. Keep talking, I will say when it is back.`,back:`${y.ERRANDS_BOT} is back. The Tuesday morning flight is the pick. The page is on your screen.`},ew={threadId:"demo",label:"Osaka flights, October",bot:y.ERRANDS_BOT,words:"Three fares compared. The Tuesday morning one is the pick: direct, and the cheapest by a little.",paths:[]};function ey({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)(er.FinishedCard,{row:ew,bot:{icon:(0,y.findBotSeed)(ew.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:y.BOT_SEEDS.map((n,r)=>(0,t.jsx)(b.BotMark,{size:22,seed:n.name,...n.icon,state:"working"===e&&n.name===y.ERRANDS_BOT?"thinking":"idle",notify:!1,className:(0,N.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?`${y.ERRANDS_BOT} \xb7 reading fares`:"landed"===e?`${y.ERRANDS_BOT} finished`:"Need a hand?"})]})]})}e.s(["Intro",0,function({ready:e,firstRun:n,forced:i}){let l=n||i,u=(0,h.useRouter)(),[d,g]=(0,p.useState)("hello"),[w,b]=(0,p.useState)(!1),[R,L]=(0,p.useState)(!1),[I,O]=(0,p.useState)(e),D=(0,E.useVoiceLine)(),$=I||null!==D.line,B=(0,p.useRef)($);(0,p.useEffect)(()=>{$&&!B.current&&z((0,Z.awake)()),B.current=$},[$]);let[P,z]=(0,p.useState)(null),[q,F]=(0,p.useState)(()=>Object.fromEntries(y.BOT_SEEDS.map(e=>[e.name,!0]))),[U,K]=(0,p.useState)("echoes"),H=(0,et.useThursdayStore)(e=>e.wake),G=(0,et.useThursdayStore)(e=>e.patch),en="bots"===d,er=(0,ea.useAwayAfter)(en,700),[eu,ec]=(0,p.useState)(!1),[ed,ew]=(0,p.useState)(null),[eb,ev]=(0,p.useState)(!1);(0,p.useEffect)(()=>{if(en){ew(new Date),ev(!1),ec(!0);let e=setTimeout(()=>ev(!0),5e3);return()=>clearTimeout(e)}let e=setTimeout(()=>ec(!1),250);return()=>clearTimeout(e)},[en]);let ek=(0,p.useMemo)(()=>ed&&function(e,t,n){let[r,...a]=e;if(!r)return null;let s=e=>({name:e,icon:(0,y.findBotSeed)(e)?.icon??null}),i=new Date(t.getTime()-95e3),l=e=>new Date(i.getTime()+1e3*e),o=a.flatMap((e,t)=>{let a=(0,y.findBotSeed)(e)?.hint??e,i=2+2.5*t;return[{id:`intro-ask-${e}-0`,bot:s(r),to:s(e),text:a,kind:"ask",exchange:`intro-${e}`,parent:"intro-lead",at:l(i)},{id:`intro-step-${e}-0`,bot:s(e),to:null,text:a,kind:"say",parent:`intro-${e}`,at:l(i+1.2)},...n?[{id:`intro-back-${e}-0`,bot:s(e),to:null,text:"Done.",kind:"say",parent:`intro-${e}`,at:l(100)}]:[]]});return n&&o.push({id:"intro-report-0",bot:s(r),to:null,text:eo,kind:"result",parent:"intro-lead",at:l(100)}),{id:`intro-team-${t.getTime()}`,request:"Who works for you",label:"Who works for you",bot:s(r),roster:e.map(s),lines:o.sort((e,t)=>(0,es.toDate)(e.at??i).getTime()-(0,es.toDate)(t.at??i).getTime()),room:{participants:e.map(e=>({bot:e,state:n?"done":e===r?"waiting":"running"})),questions:[],deliveries:[],relays:[],exchanges:[{id:"intro-lead",bot:r,caller:v.ROOM_THURSDAY,state:n?"done":"waiting",waitsFor:[]},...a.map(e=>({id:`intro-${e}`,bot:e,caller:r,state:n?"done":"running",waitsFor:[]}))]},status:n?"done":"working",outcome:n?eo:null,ask:null,seen:!0,routineId:null,tokens:{input:0,output:0},contextTokens:0,contextBudget:0,createdAt:i,updatedAt:n?l(100):t}}(y.BOT_SEEDS.filter(e=>q[e.name]).map(e=>e.name),ed,eb),[q,ed,eb]),ej="hello"===U||"over"===U,eS=(0,p.useRef)(null),eN=function(){let[e,t]=(0,p.useState)("off"),[n,r]=(0,p.useState)(!1);return{asking:"asking"===e,failed:"object"==typeof e?e:null,allowed:n,turnOn:(0,p.useCallback)(async()=>{t("asking");try{for(let e of(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks())e.stop();return t("off"),r(!0),!0}catch(e){return t(function(e){let t=e instanceof DOMException?e.name:"",n=(0,Q.micProblem)(e);if("refused"===n)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("missing"===n)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("busy"===n)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 r=e instanceof Error&&e.message||t||String(e);return{what:"The microphone did not open.",next:`The browser said "${r}". Or just go on.`}}(e)),!1}},[])}}(),eT=function(e){let[t,n]=(0,p.useState)(0);(0,p.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",ex.ask)),t>4700&&a.push(r("onIt","assistant",ex.onIt)),t>11500&&a.push(r("back","assistant",ex.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:ee.silentVoice}}("hello"===d&&l&&!w&&ej),eE=l&&!w;(0,p.useEffect)(()=>(V.callSignal.hold(eE),()=>V.callSignal.hold(!1)),[eE]),(0,p.useEffect)(()=>{if(!w)return;let e=setTimeout(()=>L(!0),700);return()=>clearTimeout(e)},[w]);let eM=ei.indexOf(d),{data:eA}=(0,S.useServerRoute)(m.queryKey.automaticModel),eC=!!eA?.ref,e_=(0,p.useMemo)(()=>{var e,t,n;let r,a;return e=d,t=$,n=eC,r=(e,t)=>({id:e,role:"assistant",text:t}),a=[],"hello"===e||(a.push(r("key","I am Thursday, and the first thing I need is a voice. Sign in with ChatGPT and I talk on your plan, or paste an OpenAI key. Neither yet? Go on without it, and I will ask again when you call.")),t&&a.push(r("awake","There, I am awake, and that is everything a call needs. From here on it is quick: your microphone, and who works for you.")),"key"===e||(a.push(r("mic","Now let me hear you. Your browser asks before it opens the microphone: say yes. From then on, saying hey Thursday calls me.")),"mic"===e||(a.push(r("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||(a.push(r("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||a.push(t?r("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."):n?r("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 sign in or have a key, and I will take it from there."):r("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.")))))),a},[d,$,eC]),eR="hello"===d?eT.turns:e_,eL=(0,X.useTurnFocus)(eR,eE),eI=function(e){let t=(0,p.useRef)(null),n=(0,p.useRef)(new Set),r=(0,p.useRef)([]),a=(0,p.useRef)(!1),[s,i]=(0,p.useState)(!1),[l,o]=(0,p.useState)(!1),u=(0,p.useRef)(!1);(0,p.useEffect)(()=>{try{let e="1"===window.localStorage.getItem(_);u.current=e,o(e)}catch{}},[]);let c=(0,p.useCallback)(()=>{r.current=[],t.current?.audio.pause()},[]),d=(0,p.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")}(A[e])}.ogg`,n.play().catch(()=>{})},[]),h=(0,p.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,i(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,M.createClipTap)(e)}}for(let e of s)n.current.add(e);r.current=s,d()}},[d]);(0,p.useEffect)(()=>{e&&t.current&&h(e)},[e,h]),(0,p.useEffect)(()=>()=>{t.current?.audio.pause(),t.current?.clip.close(),t.current=null},[]);let m=(0,p.useCallback)(()=>{let t=!u.current;u.current=t,o(t);try{window.localStorage.setItem(_,t?"1":"0")}catch{}if(t)return c();e&&(n.current.delete(e),h(e))},[c,e,h]);return{say:h,hush:c,speaking:s,muted:l,toggle:m,spectrum:(0,p.useCallback)(()=>t.current&&a.current?t.current.clip.read():C,[])}}(w?null:e_.at(-1)?.id??null);if(R||!l)return null;let eO=e=>{if(eI.hush(),b(!0),n){let e;(e=y.BOT_SEEDS.filter(e=>q[e.name]).map(e=>({name:e.name}))??y.BOT_SEEDS.map(e=>({name:e.name}))).length&&(0,T.createSeedBotsAction)(e).then(j.unwrapResult).then(()=>(0,S.revalidate)(m.queryKey.bot)).catch(e=>k.toast.add({type:"warning",title:"Could not set up the bots",description:(0,N.errorToString)(e)})),Y()}e&&V.callSignal.place(),u.replace("/"),u.refresh()},eD="hello"===d?eT.status:eI.speaking?"speaking":"idle",e$="call"===d,eB="hello"!==d;return(0,t.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Getting started",className:(0,N.cn)("fixed inset-0 z-40 bg-background transition-opacity duration-700 [--face-w:min(20rem,52vw,37.5vh)]",w&&"pointer-events-none opacity-0"),children:[eu&&ek&&(0,t.jsx)(el,{thread:ek,leaving:!en,className:"absolute inset-y-0 left-0 right-[calc(50%-var(--face-w)*0.695)] mask-[linear-gradient(to_right,black_80%,transparent)]"}),"over"!==U&&(0,t.jsx)(W,{anchor:eS,onArrive:()=>K("her"),onHello:()=>K("hello"),onDone:()=>K("over")}),ej&&(0,t.jsx)(x.TooltipProvider,{children:(0,t.jsxs)(x.Tooltip,{children:[(0,t.jsx)(x.TooltipTrigger,{render:(0,t.jsx)(f.Button,{size:"icon",variant:"ghost",onClick:eI.toggle,"aria-label":eI.muted?"Let her speak":"Mute her","aria-pressed":eI.muted,className:"absolute top-5 right-5 z-10 text-muted-foreground hover:text-foreground"}),children:eI.muted?(0,t.jsx)(c,{}):(0,t.jsx)(o,{})}),(0,t.jsx)(x.TooltipContent,{side:"bottom",children:eI.muted?"Let her speak":"Mute her voice"})]})}),(0,t.jsxs)("div",{className:(0,N.cn)("relative flex h-full flex-col items-center justify-center gap-5 pt-[7vh]",en&&"pointer-events-none",eB&&"max-[900px]:pointer-events-auto max-[900px]:justify-start max-[900px]:overflow-y-auto max-[900px]:pb-20"),children:[(0,t.jsxs)("div",{ref:eS,className:(0,N.cn)("relative w-(--face-w) [--face-bleed:19.5%]",eB&&"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:!e$||!$,onClick:()=>eO(!0),"aria-label":e$&&$?"Call Thursday":void 0,className:(0,N.cn)("block w-full rounded-full outline-none transition-all duration-700 ease-out focus-visible:ring-3 focus-visible:ring-ring/50","hello"!==d&&!$&&"opacity-35",en&&"pointer-events-none opacity-0",eB&&"max-[900px]:mt-6 max-[900px]:w-[min(8rem,20vh)]"),children:"echoes"!==U?(0,t.jsx)(J.Face,{status:eD,failed:!1,word:P,getSpectrum:"hello"===d?eT.voice:eI.spectrum,waking:!0,covered:er,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,N.cn)(eB&&"max-[900px]:hidden",en&&"hidden"),children:(0,t.jsx)(X.SideCaptions,{turns:eR,pinned:eL.pinned,live:"hello"===d?eT.saying:eI.speaking,onPick:eL.pick})}),eB&&(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:e_.at(-1)?.text}),"hello"!==d&&(0,t.jsxs)("div",{className:"pointer-events-auto 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"===d&&(0,t.jsx)(eh,{onSaved:()=>O(!0)}),"mic"===d&&(0,t.jsx)(ep,{mic:eN}),"bots"===d&&(0,t.jsx)("p",{className:"text-[15px] leading-[1.6] text-foreground max-[900px]:hidden",children:e_.at(-1)?.text}),"bots"===d&&(0,t.jsx)(em,{picked:q,onToggle:e=>F(t=>({...t,[e]:!t[e]}))}),"style"===d&&(0,t.jsx)(ef,{})]},d)]}),(0,t.jsxs)("div",{className:(0,N.cn)("relative flex w-full max-w-3xl flex-col items-center gap-4 px-6 text-center transition-transform duration-700 ease-out","hello"===d&&"translate-y-[calc(var(--face-w)*0.195)]"),children:[(0,t.jsx)("div",{className:"flex h-14 items-center gap-2 text-[13px] text-muted-foreground",children:"hello"===d?ej&&(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."}):en?null:$?e$?(0,t.jsx)(eg,{mic:eN.allowed,bots:y.BOT_SEEDS.filter(e=>q[e.name]).length}):null:"Asleep"}),"hello"!==d||ej?(0,t.jsxs)(f.Button,{variant:"key"!==d||$?"brand":"default",loading:"mic"===d&&eN.asking,onClick:()=>{"hello"===d?(eI.say("hello",$?"awake":"key"),g("key")):"mic"!==d||eN.allowed?e$?eO($):g(ei[eM+1]):eN.turnOn().then(e=>{e&&(G({wake:{...H,enabled:!0}}),g(e=>"mic"===e?"bots":e))})},className:(0,N.cn)("pointer-events-auto h-12 rounded-full px-7 pl-8 text-[15px]","mic"===d&&!eN.allowed&&"pl-6","hello"===d&&"animate-in delay-300 duration-700 fill-mode-backwards fade-in slide-in-from-bottom-2"),children:["mic"===d&&!eN.allowed&&!eN.asking&&(0,t.jsx)(s.Mic,{}),"hello"===d?"Start":"mic"!==d||eN.allowed?e$?$?"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",children:"hello"===d?ej&&(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"!==d||$?"mic"===d&&eN.asking?"your browser is asking — allow it at the top of the window":"mic"!==d||eN.allowed?e$&&$?"or tap her":"":(0,t.jsx)("button",{type:"button",onClick:()=>g(ei[eM+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"}):"neither is fine — both can wait for the call screen"})]})]}),"hello"===d?ej&&(0,t.jsx)(ey,{stage:eT.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 [@media(max-height:720px)]:bottom-3",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>g(eM>0?ei[eM-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:ei.map((e,n)=>(0,t.jsx)("span",{className:(0,N.cn)("h-1.75 rounded-full transition-all duration-300",n===eM?"w-5.5 bg-foreground":"w-1.75",n<eM&&"bg-foreground/40",n>eM&&"bg-border")},e))}),(0,t.jsxs)("span",{children:[eM+1," of ",ei.length]})]}),e$&&!$?(0,t.jsx)("span",{}):(0,t.jsx)("button",{type:"button",onClick:()=>eO(!1),className:(0,N.cn)("justify-self-start rounded-md outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",e$&&"text-muted-foreground"),children:e$?"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),i=e.i(6799),l=e.i(393080),o=e.i(283653),u=e.i(647163),c=e.i(95187);let d=(0,c.createServerReference)("7f96b7fa70abe1e405b33cd72f15c8c0e65c3b7e95",c.callServer,void 0,c.findSourceMapURL,"allowReachAction"),h=(0,c.createServerReference)("7f7a626bd0b22e43691b560eb6ddfde942406ff45a",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(l.unwrapResult).catch(e=>i.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,e=>{"use strict";var t,n,r=e.i(843476),a=e.i(989366),s=e.i(716327),i=e.i(456539),l=e.i(456420);let o={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"}]]};o.node;let u=(0,l.default)(o);var c=e.i(638292);let d={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"}]]};d.node;let h=(0,l.default)(d),p={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"}]]};p.node;let m=(0,l.default)(p);var f=e.i(250832),g=e.i(263676),x=e.i(770703),w=e.i(271645),y=e.i(798120),b=e.i(167881),v=e.i(225913),k=e.i(647163);let j=(0,v.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 S({className:e,orientation:t="horizontal",...n}){return(0,r.jsx)("div",{"data-slot":"button-group","data-orientation":t,role:"group",className:(0,k.cn)(j({orientation:t}),e),...n})}var N=e.i(129387),T=e.i(660302),E=e.i(633669),M=e.i(728231),A=e.i(41533),C=e.i(149666),_=e.i(265402),R=e.i(451888),L=e.i(635963);let I={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};I.node;let O=(0,l.default)(I);var D=e.i(511769),$=e.i(421429),B=e.i(231586),P=e.i(399512),z=e.i(256604);function q(e,t){let n=(0,w.useRef)(t);n.current=t,(0,w.useEffect)(()=>{if(!e)return;let t=document.activeElement,r=t instanceof HTMLElement&&t!==document.body?t:null,a=n.current;return()=>{let e=0,t=()=>{let n=document.activeElement;if(!n||n===document.body){let e=r?.isConnected?r:a?document.querySelector(`[data-focus-home="${CSS.escape(a)}"]`):null;if(e)return void e.focus({preventScroll:!0})}++e<30&&requestAnimationFrame(t)};requestAnimationFrame(t)}},[e])}var F=e.i(319841);function U(e){return(0,w.useSyncExternalStore)(t=>{let n=window.matchMedia(`(min-width: ${e}px)`);return n.addEventListener("change",t),()=>n.removeEventListener("change",t)},()=>window.matchMedia(`(min-width: ${e}px)`).matches,()=>!0)}var K=e.i(245629),H=e.i(661504),W=e.i(283653),G=e.i(978411),Y=e.i(351866),V=e.i(401851),J=e.i(677241),X=e.i(24708),Z=e.i(845110),Q=e.i(980797),ee=e.i(383482),et=e.i(24071),en=e.i(931619),er=e.i(632781),ea=e.i(671428),es=e.i(127341),ei=e.i(835878),el=e.i(431594),eo=e.i(989409);function eu(){let e=(0,G.useBotThreads)(),t=(0,G.useRingingThreads)();return(0,w.useMemo)(()=>[...e].reverse().filter(e=>!t.includes(e.id)&&(0,R.needsThreadReply)(e)),[e,t])}function ec({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)(es.Tabs,{value:e,onValueChange:e=>n(e),className:"gap-0",children:(0,r.jsxs)(es.TabsList,{className:"gap-1 rounded-none bg-transparent p-0 group-data-horizontal/tabs:h-auto",children:[(0,r.jsxs)(es.TabsTrigger,{value:"now",className:Y.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)(es.TabsTrigger,{value:"history",className:Y.TAB,children:"History"})]})}),(0,r.jsx)("span",{className:"flex-1"}),(0,r.jsx)(Y.FoldButton,{onClick:a})]})}function ed({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 ${R.DEFAULT_BOT.name} until you make bots of your own in Settings › Bots.`})}function eh(){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 ep({pages:e,threads:t,scroll:n,onPick:a}){let s=(0,w.useCallback)(e=>{e&&(e.scrollTop=n.current)},[n]),i=[];for(let e of t){let t=function(e){let t=(0,K.toDate)(e);return(0,Q.isToday)(t)?"today":(0,ee.isYesterday)(t)?"yesterday":(0,V.format)(t,function(e,t){let[n,r]=(0,Z.normalizeDates)(void 0,e,t);return n.getFullYear()===r.getFullYear()}((0,J.constructFrom)(t,t),(0,X.constructNow)(t))?"MMM d":"MMM d, yyyy").toLowerCase()}(e.updatedAt),n=i.at(-1);n?.day===t?n.rows.push(e):i.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)(ea.Skeleton,{className:"h-2.5 w-16"})}),(0,r.jsx)(ef,{})]}):(0,r.jsxs)(r.Fragment,{children:[i.map((e,t)=>(0,r.jsxs)(w.Fragment,{children:[(0,r.jsxs)("p",{className:(0,k.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)(ew,{thread:e,onPick:()=>a(e.id)},e.id))]},e.day)),e.hasMore?(0,r.jsx)("div",{ref:e.sentinelRef,children:(0,r.jsx)(ef,{})}):0===i.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 em({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)(et.ChevronLeft,{className:"size-4"})}),(0,r.jsx)(ea.Skeleton,{className:"size-5.5 shrink-0 rounded-md"}),(0,r.jsx)("span",{className:"flex min-w-0 flex-1",children:(0,r.jsx)(ea.Skeleton,{className:"h-3.5 w-2/5"})}),(0,r.jsx)(Y.FoldButton,{onClick:t})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 px-4 py-4",children:[(0,r.jsx)(ea.Skeleton,{className:"h-3 w-4/5"}),(0,r.jsx)(ea.Skeleton,{className:"h-3 w-3/5"}),(0,r.jsx)(ea.Skeleton,{className:"h-3 w-2/3"})]})]})}function ef(){return(0,r.jsxs)("div",{className:"flex items-center gap-2.5 px-2 py-1.5",children:[(0,r.jsx)(ea.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)(ea.Skeleton,{className:"h-3.5 w-2/5"}),(0,r.jsx)(ea.Skeleton,{className:"h-2.5 w-3/5"})]})]})}let eg=[{id:"needsYou",label:"needs you"},{id:"working",label:"working"}];function ex({threads:e,onPick:t}){let n=new Map;for(let t of e){let e=(0,R.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:eg.map((e,a)=>{let s=n.get(e.id)??[];return s.length?(0,r.jsxs)(w.Fragment,{children:[(0,r.jsxs)("p",{className:(0,k.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)(ew,{thread:e,onPick:()=>t(e.id)},e.id))]},e.id):null})})}function ew({thread:e,onPick:t,lines:n=1}){let a=(0,R.needsThreadReply)(e),s=e.lines.at(-1),i=(0,w.useMemo)(()=>(function(e){let t=e.room.questions[0];if(t)return{text:(0,k.plainText)(t.text),tone:"text-foreground"};if("waiting"===e.status&&e.ask)return{text:e.ask.refused?`${(0,_.refusedWords)(e.ask.refused)}.`:(0,R.isAppStop)(e.ask)?(0,k.plainText)(e.outcome??e.ask.question):e.ask.question,tone:k.WAITING_INK};let n=e.seen;if("cancelled"===e.status)return{text:"Stopped",tone:"text-muted-foreground"};if("done"===e.status)return{text:(0,k.plainText)(e.outcome??"Done"),tone:n?"text-muted-foreground":"text-foreground"};let r=(0,G.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]),[l,o]=(0,P.useAnswerThread)(),[u,c]=(0,w.useState)(null),d=e.room.questions[0],h=d?d.options??[]:"waiting"===e.status&&(0,R.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,"data-focus-home":`thread-${e.id}`,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)(L.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,R.isUnread)(e),crossed:"cancelled"===e.status})}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[a&&!d&&(0,R.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,k.cn)("min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]",a?"text-foreground":"text-foreground/80",(a||(0,R.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)(el.RoutineMark,{className:"size-3 text-muted-foreground/80"})}),(0,r.jsx)(ei.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 tabular-nums",children:(0,K.shortAgo)(e.updatedAt)})]}),(0,r.jsxs)("span",{className:(0,k.cn)("mt-px flex items-center gap-1.5",1===n&&"h-4"),children:["working"===e.status&&(0,r.jsx)(er.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/70"}),"working"===e.status||d?(0,r.jsx)(T.ShinyText,{text:i.text,speed:d?3.4:2.2,tone:d?"reading":void 0,className:(0,k.cn)("min-w-0 flex-1 text-[12px] leading-4",1===n?"truncate":"line-clamp-2",i.tone.includes("italic")&&"italic")}):(0,r.jsx)("span",{className:(0,k.cn)("min-w-0 flex-1 text-[12px] leading-4",1===n?"truncate":"line-clamp-2",i.tone),children:i.text})]})]})]}),h.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-1.5 pt-0.5 pr-2 pb-2 pl-12.5",children:[!d&&e.ask?.refused&&(0,r.jsxs)(b.Button,{size:"sm",variant:"secondary",onClick:()=>(0,eo.openSettings)("keys"),className:"h-7 gap-1.5 rounded-full px-3 text-[12px]",children:[(0,r.jsx)(f.Settings2,{className:"size-3.5"}),"Open Settings"]}),h.map(t=>(0,r.jsxs)(b.Button,{size:"sm",variant:"secondary",loading:u===t,disabled:o,onClick:async()=>{c(t),await l(e,t,d?.bot,d?.id),c(null)},className:"h-7 gap-1.5 rounded-full px-3 text-[12px]",children:[t===R.THREAD_CONTINUE&&(0,r.jsx)(en.ChevronsRight,{className:"size-3.5"}),t]},t))]})]})}let ey={name:"at-sign",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]};ey.node;let eb=(0,l.default)(ey);var ev=e.i(689664);let ek={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"]};ek.node;let ej=(0,l.default)(ek);var eS=e.i(51481),eN=e.i(825398);function eT({bot:e,icon:t,line:n,children:a}){return(0,r.jsxs)(M.Tooltip,{children:[(0,r.jsx)(M.TooltipTrigger,{render:(0,r.jsx)("span",{}),children:a}),(0,r.jsxs)(M.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)(L.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 eE=[[0,[21,117,208]],[.4,[90,157,222]],[.75,[179,210,239]],[1,[252,252,254]]],eM=eE[0][1],eA=[{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}],eC=(e,t,n)=>e<t?t:e>n?n:e,e_=e=>e*e*(3-2*e),eR=(e,t,n)=>e_(eC((n-e)/(t-e),0,1)),eL=(e,t)=>{let n=0x165667b1*e+0x27d4eb2f*t|0;return(((n=(n^n>>>13)*0x4bf19f61)^n>>>16)>>>0)/0xffffffff},eI=(e,t)=>{let n=Math.floor(e),r=Math.floor(t),a=e_(e-n),s=e_(t-r);return(eL(n,r)*(1-a)+eL(n+1,r)*a)*(1-s)+(eL(n,r+1)*(1-a)+eL(n+1,r+1)*a)*s},eO=(e,t,n)=>.74*eI(e+n,t+.7*n)+.26*eI(2.2*e+n,2.2*t+1.3*n);function eD({on:e,className:t}){let n=(0,w.useRef)(null),[a,s]=(0,w.useState)(e),[i,l]=(0,w.useState)(!1);return((0,w.useEffect)(()=>{if(e){s(!0);let e=requestAnimationFrame(()=>l(!0));return()=>cancelAnimationFrame(e)}l(!1);let t=setTimeout(()=>s(!1),200);return()=>clearTimeout(t)},[e]),(0,w.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],i=900*Math.random(),l=400*Math.random(),o=e=>{let n=e+i,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=eA.map(e=>({seed:e.seed,shift:o*e.pace,wide:e.wide*(1-e.gustWide*u),tall:e.tall*(1+e.gustTall*u),sky:l*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,i=eI(.55*r+.03*n,.55*t+l)-.5,o=eI(.55*r+9.1+l,.55*t-.024*n)-.5,u=r+1.15*i,p=t+ +o+c,[m,f,g,x]=d.map(e=>eO((u-e.shift)*e.wide+e.sky,p*e.tall,e.seed)),w=eC((.52-m)/.34,0,1);w*=.7+.6*eC((.56-f)/.4,0,1);let y=.97-.92*(w=eC(w+(.5-g)*.42,0,1))**1.2-.1*eC((.5-g)/.6,0,1)+(x-.5)*.38,b=Math.sqrt(r*r+t*t);!function(e,t){let n=eC(e,0,1),r=1;for(;r<eE.length-1&&n>eE[r][0];)r+=1;let[a,s]=eE[r-1],[i,l]=eE[r],o=(n-a)/(i-a);t[0]=s[0]+(l[0]-s[0])*o,t[1]=s[1]+(l[1]-s[1])*o,t[2]=s[2]+(l[2]-s[2])*o}(y+=.16*eC(1-Math.hypot(r+.42,t+.48)/1.5,0,1)+eR(.84,1,b)*eC(.15+.85*(.8*t+.45*r),0,1)*.45,s);let v=eC(b,0,1)**2.4*.26;a[h]=s[0]+(eM[0]-s[0])*v,a[h+1]=s[1]+(eM[1]-s[1])*v,a[h+2]=s[2]+(eM[2]-s[2])*v,a[h+3]=255*(1-eR(.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,k.cn)("pointer-events-none absolute inset-0 size-full transition-opacity",i?"opacity-100":"opacity-0",t),style:{transitionDuration:"200ms"}}):null}var e$=e.i(864723);let eB={done:ev.Check,cancelled:g.X,question:eS.CircleQuestionMark,stopped:ej,resumed:eN.RotateCw},eP={question:k.WAITING_INK,stopped:k.WAITING_INK},ez=e=>{let t=(0,k.plainText)(e).replace(/\s+/g," ").trim();return t.length>28?`${t.slice(0,27)}…`:t};function eq({crew:e,more:t,bubble:n,rows:a,count:s,busy:i,pending:l,playing:o,resting:u=!1,onPick:c,onOpen:d}){let h=(0,G.useWriteLineUp)(),p=a.length>0&&!h;return(0,r.jsxs)("div",{className:(0,k.cn)("pointer-events-auto w-fit max-w-full bg-background/78 ring-1 ring-border/50 backdrop-blur-md transition-shadow duration-300",p?"w-132 rounded-3xl shadow-lg shadow-black/8":"rounded-full shadow-sm shadow-black/3"),children:[(0,r.jsx)("div",{className:(0,k.cn)("grid overflow-hidden contain-inline-size transition-[grid-template-rows] duration-300 ease-out",p?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,r.jsxs)("div",{className:"min-h-0 overflow-hidden",inert:!p,children:[(0,r.jsxs)("p",{className:"px-3 py-2 font-mono text-[10px] tracking-wide text-muted-foreground",children:[l," ",1===l?"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)(ew,{thread:e,onPick:()=>c(e.id)})},e.id))},String(p))}),(0,r.jsx)("span",{className:"block h-1.5"})]})}),(0,r.jsx)(eF,{crew:e,more:t,bubble:p?null:n,label:s?`Threads (${s})`:"Bots",onClick:d,playing:o,resting:u,side:(0,r.jsx)(eU,{busy:i,pending:l,grown:p}),onWrite:G.writeLine.choose,writing:h})]})}function eF({crew:e,more:t,bubble:n,playing:a,resting:s=!1,side:i,label:l,onClick:o,onWrite:u,writing:c}){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)(M.Tooltip,{children:[(0,r.jsxs)(M.TooltipTrigger,{render:(0,r.jsx)("button",{type:"button",onClick:u,"aria-label":"Write to Thursday or a bot","data-focus-home":"write","aria-pressed":c,className:(0,k.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",c?"shadow-[0_6px_14px_-7px_color-mix(in_oklab,var(--brand)_60%,transparent)]":"bg-muted text-foreground hover:bg-accent")}),children:[(0,r.jsx)(eD,{on:!!c}),(0,r.jsx)(eb,{className:(0,k.cn)("size-3.5 transition-opacity duration-200",c?"opacity-0":"opacity-100")})]}),(0,r.jsxs)(M.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:o,"aria-label":l,"data-focus-home":"room",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)(eH,{crew:e,more:t,bubble:n,playing:a,resting:s}),i]})]})}function eU(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)(T.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)(er.Loader2,{className:"size-4 shrink-0 animate-spin text-muted-foreground/70"})]}):null}let eK=["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 eH({crew:e,more:t,bubble:n,playing:a,resting:s}){return(0,r.jsxs)("span",{className:"flex min-w-0 shrink items-center",children:[e.map((t,i)=>{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",o=(0,r.jsx)("span",{className:(0,k.cn)("flex transition-transform duration-500 ease-out",t.awake&&"-translate-y-0.5 scale-110"),children:(0,r.jsx)(eW,{face:t,motion:(0,B.motionOf)(a.get(t.name),i),asleep:s&&!t.awake&&!t.waiting&&!a.has(t.name)})});return(0,r.jsxs)(w.Fragment,{children:[(0,r.jsxs)("span",{className:(0,k.cn)("relative shrink-0 transition-[margin] duration-500 ease-out",i>0&&!e[i-1].word&&"-ml-2",t.standIn&&"opacity-35"),style:{zIndex:e.length-i},children:[null===l?(0,r.jsx)("span",{children:o}):(0,r.jsx)(eT,{bot:t.name,icon:t.icon,line:l,children:o}),n?.at===t.name&&(0,r.jsx)(eY,{handoff:n})]}),t.word&&(0,r.jsx)("span",{className:"mx-2.5 min-w-0 shrink truncate",children:(0,r.jsx)(T.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 eW({face:e,motion:t,asleep:n}){let a=t.delayMs?{animationDelay:`${t.delayMs}ms`}:void 0;return(0,r.jsx)("span",{"data-crew-motion":!0,className:(0,k.cn)("flex",t.body),style:a,children:(0,r.jsx)("span",{"data-crew-motion":!0,className:(0,k.cn)("flex origin-bottom",!n&&t.shape),style:a,children:(0,r.jsx)("span",{"data-crew-motion":!0,className:(0,k.cn)("flex",t.turn),style:a,children:(0,r.jsx)(eG,{face:e,asleep:n})})})},t.key)}function eG({face:e,asleep:t}){return(0,r.jsx)(L.BotMark,{resting:t,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 eY({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)(eJ,{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 eV({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)(eJ,{handoff:e})})}function eJ({handoff:e}){let t=e.sign?eB[e.sign]:null,n=e.sign?eP[e.sign]:void 0;return(0,r.jsxs)("span",{className:(0,k.cn)("flex min-w-0 items-center gap-2 text-[13px] leading-[18px] tracking-[-0.1px] whitespace-nowrap",n),children:[(0,r.jsx)(eX,{from:e.from,to:e.to}),t&&(0,r.jsx)(t,{className:(0,k.cn)("size-3.5 shrink-0",!n&&"text-muted-foreground/70")}),e.shine?(0,r.jsx)(T.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 eX({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,k.cn)("relative flex",t>0&&(n[t-1].name===Y.YOU.name?"ml-1":"-ml-1.25")),style:{zIndex:n.length-t},children:(0,r.jsx)(eZ,{bot:e})},e.name))})}function eZ({bot:e}){return e.name===Y.YOU.name?(0,r.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] text-muted-foreground",children:"You"}):e.name===Y.THURSDAY.name?(0,r.jsx)(z.ThursdayMark,{size:18,className:"shrink-0"}):(0,r.jsx)(L.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 eQ=(0,x.default)(()=>e.A(204916).then(e=>e.OfficeBackdrop),{loadableGenerated:{modules:[590714]},ssr:!1}),e0=(0,w.memo)(function(){let e=(0,G.useBotThreads)(),t=eu(),{data:n}=(0,W.useServerRoute)(y.queryKey.bot),[a,s]=(0,w.useState)(!1),[i,l]=(0,w.useState)(!1),[o,u]=(0,w.useState)(null),c=a&&null!==o;(0,w.useEffect)(()=>(G.roomOpen.set(a?c?"thread":"list":null),()=>G.roomOpen.set(null)),[a,c]),q(a,"room"),q(c,o?`thread-${o}`:void 0);let[d,h]=(0,w.useState)({}),[p,m]=(0,w.useState)("now"),f=(0,w.useRef)(0),g=[...e].reverse(),x=g.filter(e=>"finished"!==(0,R.standOf)(e)),b=a&&"history"===p,v=(0,H.useServerPages)({key:(e,t)=>{if(!b)return null;if(0===e)return y.queryKey.threadHistory(null);let n=t?.at(-1);return n?y.queryKey.threadHistory((0,K.toDate)(n.updatedAt).toISOString()):null},size:A.PAGE_SIZE}),{refresh:j}=v,S=(0,w.useRef)(!1);S.current=v.items.length>0,(0,w.useEffect)(()=>{b&&S.current&&j()},[b,j]);let N=(0,w.useMemo)(()=>v.items.filter(e=>"done"===e.status||"cancelled"===e.status).map(e=>(0,G.threadFromRow)(e,n)),[v.items,n]),T=o?g.find(e=>e.id===o)??N.find(e=>e.id===o)??null:null,{data:E,isLoading:M}=(0,W.useServerRoute)(o?y.queryKey.thread(o):null),C=(0,w.useMemo)(()=>E&&E.id===o?(0,G.threadFromRow)(E,n):null,[E,o,n])??(T?.lines.length?T:null),_=null!==o&&(null!==C||M),L=U(1280),I=(0,G.useRoomReadAs)(),O=c&&L&&"office"===I&&!i&&(null!==C||M);(0,w.useEffect)(()=>G.roomOffice.set(O),[O]),(0,w.useEffect)(()=>()=>G.roomOffice.set(!1),[]);let $=function(e){let[t,n]=(0,w.useState)(e);null!==e&&e!==t&&n(e);let r=null===e,[a,s]=(0,w.useState)(r);!r&&a&&s(!1),(0,w.useEffect)(()=>{if(!r)return;let e=setTimeout(()=>s(!0),250);return()=>clearTimeout(e)},[r,250]);let i=e??t;return a||null===i?null:{value:i,leaving:r}}(O?C:null);(0,w.useEffect)(()=>G.roomThread.set(a&&!i?o:null),[a,i,o]),(0,w.useEffect)(()=>()=>G.roomThread.set(null),[]);let[z,V]=function(){let[e,t]=(0,w.useState)(null),n=(0,w.useRef)(null);return(0,w.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),[e,(0,w.useCallback)(e=>{t(e),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,t(null)},3400)},[])]}(),J=(0,w.useMemo)(()=>z??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})),[z,e,n]),{crew:X,more:Z}=(0,w.useMemo)(()=>(function(e,t){let n=new Set(t.filter(R.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"?ez((0,Y.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()].filter(e=>e.awake||e.waiting),i=s.length?s:[...a.values()];if(!i.length)return{crew:eK.slice(0,3),more:0};for(let e of s.length?[]:eK){if(i.length>=3)break;a.has(e.name)||i.push(e)}let l=e=>e.waiting?0:e.awake?1:e.unread?2:e.standIn?4:3,o=i.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:o.slice(0,14),more:Math.max(0,o.length-14)}})(n,e),[n,e]),[Q,ee]=(0,B.useCrewGestures)(),et=(0,B.useCrewAwake)(),en=(0,w.useRef)(!1);(0,w.useEffect)(()=>{!en.current&&n?.length&&(en.current=!0,ee(n.map(e=>({bot:e.name,gesture:"wave"}))))},[n,ee]);let er=(0,w.useRef)(null),ea=(0,w.useRef)(new Map),es=(0,w.useRef)(new Set);(0,w.useEffect)(()=>{if(!G.botThreads.primed())return;let t=er.current;er.current=new Map(e.map(e=>[e.id,e.status]));let n=ea.current;ea.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=es.current;if(es.current=new Set(e.flatMap(e=>e.lines.map(e=>e.id))),!t)return;let a=null,s=[];for(let i of e){let{moments:e,gestures:l}=function(e,t,n,r,a){let s=e.bot,i=[];if(!t)return"working"===e.status?{moments:[{rank:1,at:s.name,from:"user"===e.startedBy?Y.YOU:Y.THURSDAY,to:[s],text:`took on “${ez(e.label)}”`}],gestures:[{bot:s.name,gesture:"took"}]}:{moments:[],gestures:[]};let l=[],o=e.lines.filter(e=>!n.has(e.id)),u=new Map;for(let e of o)"user"===e.kind?(e.steppedIn?i.push({bot:e.bot.name,gesture:"read"}):i.push({bot:e.bot.name,gesture:"took"}),l.push(e.steppedIn?{rank:1,at:e.bot.name,from:e.bot,to:[],text:"Step-in · read"}:{rank:1,at:e.bot.name,from:(0,G.speakerOf)(e),to:[e.bot],text:ez(e.text)})):"stop"===e.kind?(i.push({bot:e.bot.name,gesture:"stop"}),l.push({rank:3,at:e.bot.name,from:e.bot,to:[],sign:"stopped",text:(0,Y.leadOf)(e.text)})):"ask"===e.kind&&e.to?.name===Y.THURSDAY.name?(e.question&&i.push({bot:e.bot.name,gesture:"ask"}),l.push(e.question?{rank:4,at:e.bot.name,from:e.bot,to:[],sign:"question",text:`asks you \xb7 ${ez(e.text)}`}:{rank:2,at:e.bot.name,from:e.bot,to:[Y.THURSDAY],text:ez(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(i.push({bot:e,gesture:"give"}),n.values()))i.push({bot:t.name,gesture:"take"});l.push({rank:2,at:e,from:t[0].bot,to:[...n.values()],text:1===t.length?ez(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))||(i.push({bot:t.name,gesture:"done"}),l.push({rank:1,at:t.name,from:t,to:[],sign:"done",text:"finished its part"}))}if(t===e.status)return{moments:l,gestures:i};let c=ez(e.label);return"cancelled"===e.status?(i.push({bot:s.name,gesture:"stop"}),l.push({rank:3,at:s.name,from:s,to:[],sign:"cancelled",text:`stopped \xb7 ${c}`})):"done"===e.status?i.push({bot:s.name,gesture:"done"}):"working"===e.status?o.some(e=>"user"===e.kind)||(i.push({bot:s.name,gesture:"took"}),l.push({rank:1,at:s.name,from:s,to:[],sign:"resumed",text:"picked it back up"})):(0,R.isAppStop)(e.ask)&&!l.some(e=>"question"===e.sign||"stopped"===e.sign)&&(i.push({bot:s.name,gesture:"stop"}),l.push({rank:3,at:s.name,from:s,to:[],sign:"stopped",text:"paused"})),{moments:l,gestures:i}}(i,t.get(i.id),r,n,ea.current);for(let t of(s.push(...l),e))(!a||t.rank>=a.rank)&&(a=t)}a&&V(a),ee(s)},[e,V,ee]),(0,G.useSeenOnDetail)(a?C:null),(0,D.useAppEvent)({showThread:e=>{u(e.threadId),l(!1),s(!0)}}),(0,w.useEffect)(()=>G.roomOpens.subscribe(e=>{u(e),m("now"),l(!1),s(!0)}),[]);let ei=e.filter(e=>"working"===e.status).length,el=g.filter(R.needsThreadReply).length,eo=(0,w.useMemo)(()=>X.map(e=>({...e,word:null})),[X]),ef=()=>{s(!1),l(!1),u(null),m("now"),f.current=0},eg=()=>l(!0),ew=(0,w.useRef)(ef);ew.current=ef,(0,w.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>ew.current(),250);return()=>clearTimeout(e)},[i]);let ey=(0,G.useCallWaits)();(0,F.useEscape)(a&&!i,()=>c?u(null):eg()),(0,w.useEffect)(()=>G.writeLine.subscribe(()=>ew.current()),[]);let eb=(0,w.useRef)(null);return(0,w.useEffect)(()=>{if(!c)return;let e=e=>{if(!(0,F.typed)(e,"@")||!(0,F.windowKey)(e))return;let t=eb.current?.querySelector("textarea:not(:disabled)");t&&(e.preventDefault(),t.focus())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[c]),(0,r.jsxs)("div",{className:(0,k.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.jsx)(eQ,{thread:$.value,leaving:$.leaving,onBot:e=>h(t=>({...t,[$.value.id]:e===$.value.bot.name?null:e})),onAnswer:()=>(eb.current?.querySelector("[data-continue]:not(:disabled)")??eb.current?.querySelector("textarea:not(:disabled)"))?.focus(),className:"pointer-events-auto mr-4 min-h-0 min-w-0 flex-1 self-stretch"}),a?(0,r.jsxs)("div",{ref:eb,"data-room":!0,className:(0,k.cn)("pointer-events-auto flex max-h-full w-160 max-w-full shrink-0 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",_&&"h-[calc(64vh+11rem)]",i&&"pointer-events-none translate-y-1 opacity-0 transition-[opacity,translate] duration-250 ease-in"),children:[ey&&(0,r.jsx)(e2,{onBack:eg}),!C&&o&&M?(0,r.jsx)(em,{onBack:()=>u(null),onClose:eg}):C?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Y.ThreadHeader,{thread:C,onBack:()=>u(null),onClose:eg,titled:!O,children:L&&(0,r.jsx)(e1,{})}),(0,r.jsx)(Y.Conversation,{thread:C,tab:d[C.id]??null,onTab:e=>h(t=>({...t,[C.id]:e})),className:"max-h-none min-h-0 flex-1"}),(0,r.jsx)(P.ThreadReply,{thread:{id:C.id,label:C.label,bot:C.bot.name,ask:C.ask,room:C.room},status:"working"===C.status?"running":C.status,faces:C.roster,to:d[C.id]??C.bot.name,className:"mx-3 mb-2 shrink-0"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ec,{tab:p,current:x.length,onTab:m,onClose:eg}),"history"===p?(0,r.jsx)(ep,{pages:v,threads:N,scroll:f,onPick:u}):x.length?(0,r.jsx)(ex,{threads:x,onPick:u}):g.length?(0,r.jsx)(eh,{}):(0,r.jsx)(ed,{bots:n}),(0,r.jsx)(eF,{crew:eo,more:Z,bubble:null,playing:Q,label:"Fold the room away",onClick:eg,onWrite:G.writeLine.choose,side:J?(0,r.jsx)(eV,{handoff:J}):(0,r.jsx)(eU,{busy:ei,pending:el,grown:!0})})]})]}):(0,r.jsx)(eq,{crew:X,more:Z,bubble:J,playing:Q,resting:!et,rows:t,count:e.length,busy:ei,pending:el,onPick:e=>{u(e),l(!1),s(!0)},onOpen:()=>{l(!1),s(!0)}})]})});function e1(){let e=(0,G.useRoomReadAs)();return(0,r.jsx)($.Segmented,{view:!0,size:"sm","aria-label":"How the thread is shown",value:e,onChange:G.roomReadAs.set,options:[{value:"office",label:"Office",title:"The thread beside its office, where her face stands"},{value:"chat",label:"Chat",title:"The conversation alone, her face kept"}],className:"shrink-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)(z.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)(O,{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,w.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,w.useState)(!0);if((0,w.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)(b.Button,{size:"sm",className:"rounded-full px-3.5",onClick:()=>{s(),ta()},children:"Install"}),(0,r.jsx)(b.Button,{size:"sm",variant:"ghost",className:"rounded-full px-3 text-muted-foreground",onClick:s,children:"Not now"})]})]})]})}function ti(){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 tl={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"}]]};tl.node;let to=(0,l.default)(tl);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),tw={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"}]]};tw.node;let ty=(0,l.default)(tw);var tb=e.i(630374),tv=e.i(917162),tk=e.i(895836);function tj(){let{data:e}=(0,W.useServerRoute)(y.queryKey.bot);return e&&0===e.length?"waiting":null}function tS(){let{data:e}=(0,W.useServerRoute)(y.queryKey.threads);return{owed:(e??[]).filter(e=>(0,R.needsThreadReply)(e)||(0,R.isUnread)(e)).length}}var tN=e.i(36174);let tT=Object.values(tN.REACH_KEYS).flat();function tE(){let{data:e,isLoading:t}=(0,W.useServerRoute)(y.queryKey.config),n=(0,e3.useVoiceLine)();if(t)return null;let r=t=>(0,e4.isConfigSet)(e,t),a=e4.CONFIG_GROUPS.some(e=>"keys"===e.section&&!(0,e4.groupSatisfied)(e,e.id===e4.VOICE_GROUP_ID?n.countsForCall:r)),s=!!e?.some(e=>e.unreadable&&!tT.includes(e.key));return a||s?"waiting":null}let tM=e4.CONFIG_GROUPS.filter(e=>"models"===e.section).flatMap(e=>e.entries.filter(e=>e.kind).map(e=>e.key)),tA=Object.keys(e4.MEDIA_MODEL_KEYS);function tC(){let{data:e,isLoading:t}=(0,W.useServerRoute)(y.queryKey.config),{data:n}=(0,W.useServerRoute)(y.queryKey.llmModel);if(t||!e||!n)return null;let r=n.find(e=>e.signIn),a=r?.hasKey?{plan:r.plan??null}:null;return!tA.some(e=>(0,_.planMediaOf)(e,a))&&tM.every(t=>!(0,e4.isConfigSet)(e,t))?"waiting":null}function t_(){let{data:e}=(0,W.useServerRoute)(y.queryKey.mcp);return e?.some(e=>e.lastError)?"red":null}var tR=e.i(991322),tL=e.i(852116);function tI(){let{data:e}=(0,W.useServerRoute)(y.queryKey.reach),{data:t}=(0,W.useServerRoute)(y.queryKey.config),n=Object.values(tN.REACH_KEYS).flat().some(e=>(0,e4.isConfigUnreadable)(t,e));return e?.channels.some(e=>e.refused)||n?"red":null}var tO=e.i(589128),tD=e.i(569644);let t$=tD.FolderOpen;var tB=e.i(922521),tP=e.i(734080);function tz({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 tq=[{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-agent",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 tF(){return(0,r.jsx)("div",{className:"flex flex-col gap-0.5",children:tq.map(e=>(0,r.jsxs)("a",{href:e.href,target:"_blank",rel:"noreferrer",className:(0,k.cn)((0,b.buttonVariants)({variant:"ghost"}),"justify-start text-muted-foreground"),children:[(0,r.jsx)(tz,{d:e.mark,className:"mr-1"}),(0,r.jsx)("span",{className:"truncate text-sm",children:e.label})]},e.href))})}var tU=tk;let tK=(e,t=tU.SettingSkeleton)=>(0,x.default)(e,{loading:()=>(0,r.jsx)(t,{})}),tH=tK(()=>e.A(48663).then(e=>({default:e.MemorySetting}))),tW=tK(()=>e.A(959484).then(e=>({default:e.BotSetting})),tU.SettingPanesSkeleton),tG=tK(()=>e.A(954404).then(e=>({default:e.ThreadSetting}))),tY=tK(()=>e.A(483782).then(e=>({default:e.RoutineSetting}))),tV=tK(()=>e.A(711454).then(e=>({default:e.ModelsSetting}))),tJ=tK(()=>e.A(711454).then(e=>({default:e.KeysSetting}))),tX=tK(()=>e.A(711454).then(e=>({default:e.PhoneSetting}))),tZ=tK(()=>e.A(17613).then(e=>({default:e.ThursdaySetting}))),tQ=tK(()=>e.A(706108).then(e=>({default:e.ArtifactSetting})),tU.SettingPanesSkeleton),t0=tK(()=>e.A(194379).then(e=>({default:e.WorkspaceSetting})),tU.SettingPanesSkeleton),t1=tK(()=>e.A(832663).then(e=>({default:e.SkillsSetting}))),t2=tK(()=>e.A(959108).then(e=>({default:e.McpSetting}))),t5=tK(()=>e.A(663973).then(e=>({default:e.SignInsSetting})));function t3({tabs:e}){let[t,n]=(0,w.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)(tU.SettingColumn,{children:(0,r.jsx)($.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 t4=[{label:"Finished",Component:tQ},{label:"All files",Component:t0}],t6=["call","work","app"],t7="px-3 pt-3 pb-1 font-mono text-[10px] text-muted-foreground",t9=[{id:"thursday",label:"Thursday",group:"call",hint:"Captions, models, and how a call starts",icon:z.ThursdayMark,Component:tZ},{id:"memory",label:"Memory",group:"call",hint:"What Thursday remembers about you",icon:tL.MemoryMark,Component:tH},{id:"bot",label:"Bots",group:"work",hint:"Who Thursday hands work to",icon:L.BotsMark,Component:tW,Badge:function(){return tj()?(0,r.jsx)(tk.NavBadge,{tone:"waiting"}):null}},{id:"threads",label:"Threads",group:"work",hint:"Work the bots were handed",icon:tc.ListChecks,Component:tG,Badge:function(){return(0,r.jsx)(tk.NavBadge,{tone:"waiting",count:tS().owed})}},{id:"routines",label:"Routines",group:"work",hint:"Work that starts by itself, on a schedule",icon:el.RoutineMark,Component:tY},{id:"files",label:"Files",group:"work",hint:"What the bots finished, and everything else they wrote",icon:t$,Component:()=>(0,r.jsx)(t3,{tabs:t4})},{id:"skills",label:"Skills",group:"work",hint:"Instructions the bots load on demand",icon:tO.SkillsMark,Component:t1},{id:"mcp",label:"Connectors",group:"work",hint:"Apps the bots can use, from MCP servers",icon:tR.McpMark,Component:t2,Badge:function(){return t_()?(0,r.jsx)(tk.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:t5},{id:"models",label:"Models",group:"app",hint:"What bots think with, and what they draw, film and speak with",icon:to,Component:tV,Badge:function(){return tC()?(0,r.jsx)(tk.NavBadge,{tone:"waiting"}):null}},{id:"keys",label:"API keys",group:"app",hint:"The accounts the app runs on",icon:tu.KeyRound,Component:tJ,Badge:function(){return tE()?(0,r.jsx)(tk.NavBadge,{tone:"waiting"}):null}},{id:"phone",label:"Phone",group:"app",hint:"Write to Thursday from a chat app or by email",icon:tx,Component:tX,Badge:function(){return tI()?(0,r.jsx)(tk.NavBadge,{tone:"red"}):null}}],t8={system:{label:"System",icon:tp},light:{label:"Light",icon:ty},dark:{label:"Dark",icon:tf}};function ne(){let e=(0,tB.useTheme)();return(0,r.jsx)($.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}=t8[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:tB.setTheme})}function nt({children:e}){let t=(0,eo.useSettingsStore)(e=>e.open),n=(0,eo.useSettingsStore)(e=>e.section),a=(0,eo.useSettingsStore)(e=>e.show),s=(0,eo.useSettingsStore)(e=>e.hide),i=(0,eo.useSettingsStore)(e=>e.pick),l=async e=>{let t=eo.useSettingsStore.getState().unsaved;(!t?.()||await tv.notify.discard())&&e()},o=(0,w.useRef)(null),u=t9.find(e=>e.id===n)??t9[0];return(0,w.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<=t9.length&&(e.preventDefault(),l(()=>i(t9[t-1].id)))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,i]),(0,r.jsxs)(tb.Dialog,{open:t,onOpenChange:e=>e?a():void l(s),children:[e&&(0,r.jsx)(tb.DialogTrigger,{render:e}),(0,r.jsxs)(tb.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)(tb.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=(t9.findIndex(e=>e.id===n)+r+t9.length)%t9.length,t9[t].id);l(()=>i(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:[t6.map(e=>(0,r.jsxs)(w.Fragment,{children:[(0,r.jsx)("span",{className:t7,children:e}),t9.filter(t=>t.group===e).map(e=>(0,r.jsxs)(b.Button,{"data-section":e.id,tabIndex:e.id===n?0:-1,"aria-current":e.id===n?"page":void 0,onClick:()=>void l(()=>i(e.id)),variant:e.id===n?"secondary":"ghost",className:(0,k.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,k.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:t7,children:"community"}),(0,r.jsx)(tF,{}),(0,r.jsxs)("div",{className:"mt-auto flex flex-col gap-2 pt-3",children:[(0,r.jsx)(ti,{}),(0,r.jsx)("div",{className:"px-1",children:(0,r.jsx)(ne,{})})]})]}),(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)(tU.SettingColumn,{className:"animate-in space-y-0.5 fade-in slide-in-from-bottom-1 duration-300",children:[(0,r.jsx)("h3",{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,{})})]})]})]})]})}var nn=e.i(95187);let nr=(0,nn.createServerReference)("7f5504ba0241bdd66f5b5de1d2ab98ee0671cbf338",nn.callServer,void 0,nn.findSourceMapURL,"closeUpdateNoticeAction");var na=e.i(658707);function ns({hidden:e}){let{data:t}=(0,W.useServerRoute)(y.queryKey.update,{onError:()=>{}}),{to:n,failed:a}=(0,na.useUpdateStore)(),s=t?.moving&&!t.moving.failed?t.moving.to:null;(0,w.useEffect)(()=>{s&&(0,na.followUpdate)(s)},[s]);let i=(0,w.useRef)(null),l=t?.current??null;(0,w.useEffect)(()=>{l&&(i.current?i.current!==l&&window.location.reload():i.current=l)},[l]);let[o,u]=(0,w.useState)(null),[c,d]=(0,w.useState)(null),h=(0,eo.useSettingsStore)(e=>e.open);if(e||h)return null;if(n)return(0,r.jsxs)(ni,{children:[(0,r.jsx)("p",{className:"mt-3 text-[15px] leading-tight font-medium",children:(0,r.jsx)(T.ShinyText,{text:`Updating to ${n}…`})}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Thursday restarts in a moment."})]});if(a&&c!==a)return(0,r.jsxs)(ni,{children:[(0,r.jsxs)("p",{className:"mt-3 text-[15px] leading-tight font-medium",children:["Could not update to ",a.to]}),(0,r.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a.running?"The one before runs on.":"Thursday is not answering."}),(0,r.jsx)(nl,{primary:"See why",onPrimary:()=>(0,eo.openSettings)("thursday"),secondary:"Close",onSecondary:()=>d(a)})]});let p=t?.notice?t.newer:null;return p&&o!==p?(0,r.jsxs)(ni,{children:[(0,r.jsxs)("p",{className:"mt-3 text-[15px] leading-tight font-medium",children:["Thursday ",p," is out"]}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:["You run ",t?.current]}),(0,r.jsx)(nl,{primary:t?.byButton?"Update":"How to update",onPrimary:()=>t?.byButton?void(0,na.moveTo)(p):(0,eo.openSettings)("thursday"),secondary:"Not today",onSecondary:()=>{u(p),nr().then(()=>(0,W.revalidate)(y.queryKey.update))}})]}):null}function ni({children:e}){return(0,r.jsx)("div",{className:"inverse",children:(0,r.jsxs)("div",{className:"flex size-60 animate-in flex-col items-center rounded-[28px] bg-background p-5 text-center text-foreground shadow-[0_22px_44px_-20px_rgb(0_0_0/0.22)] duration-300 fade-in slide-in-from-top-1",children:[(0,r.jsx)(z.ThursdayMark,{size:72,className:"mt-1"}),e]})})}function nl({primary:e,onPrimary:t,secondary:n,onSecondary:a}){return(0,r.jsxs)("div",{className:"mt-auto flex w-full gap-1.5",children:[(0,r.jsx)(b.Button,{className:"flex-1 rounded-full",onClick:t,children:e}),(0,r.jsx)(b.Button,{variant:"ghost",className:"rounded-full px-3 text-muted-foreground",onClick:a,children:n})]})}function no(e){return e.includes("red")?"red":e.includes("waiting")?"waiting":null}function nu(){let e=tj(),t=tS().owed>0?"waiting":null,n=t_(),r=tE();return{bot:e,threads:t,mcp:n,keys:r,models:tC(),phone:tI()}}var nc=e.i(745747);let nd=null,nh=0,np=new Set,nm=()=>{for(let e of np)e()},nf=()=>{"hidden"===document.visibilityState&&ng.clear()},ng={show:e=>!nd&&"visible"===document.visibilityState&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches&&(nd={moment:e,phase:null,id:++nh},document.addEventListener("visibilitychange",nf),nm(),!0),tell(e,t){if(nd&&nd.id===e&&nd.phase!==t){if("done"===t)return ng.clear();nd={...nd,phase:t},nm()}},clear(){nd&&(nd=null,document.removeEventListener("visibilitychange",nf),nm())},current:()=>nd};function nx(){return(0,w.useSyncExternalStore)(e=>(np.add(e),()=>np.delete(e)),()=>nd,()=>null)}var nw=e.i(234916),ny=e.i(671228),nb=e.i(67045),nv=e.i(297825),nk=e.i(670097),nj=e.i(640262),nS=e.i(6799),nN=e.i(213377);let nT=(0,nn.createServerReference)("7f5e15c7d98ecb6c8d3ce13e1907bed35e2951dfac",nn.callServer,void 0,nn.findSourceMapURL,"acceptThreadRelaysAction");var nE=e.i(616172),nM=e.i(393080),nA=e.i(609856);let nC=new Set,n_=e=>new Set(nD(e).filter(e=>"question"!==e.kind).map(e=>e.key)),nR={message:"says",question:"asks",report:"reports",interrupted:"was cut off"},nL={question:0,stopped:1,done:2,progress:3};function nI(e){let t=(0,k.captionText)(e.replace(/!\[[^\]]*\]\([^)]*\)/g," ")).replace(k.MARKDOWN_LINK,"$1").replace(/^• /gm,"").trim();if(t.length<=A.CALL_RELAY.chars)return t;let n=t.slice(0,A.CALL_RELAY.chars),r=Math.max(n.lastIndexOf("\n\n"),n.lastIndexOf(". "),n.lastIndexOf(".\n"),n.lastIndexOf("。")),a=(r>A.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 nO=e=>`question:${e}`;function nD(e){let t=[];for(let n of e){let{relays:e,questions:r}=n.room,a=(0,K.toDate)(n.updatedAt).getTime(),s=(e,t)=>`[${e} → Thursday, thread "${n.label}" (${n.id}), ${t}.]`,i=(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:nO(a.id),kind:"question",line:`${s(a.bot,"question")}
|
|
5
|
+
${nI(a.text)}${r}`,relayIds:e.filter(e=>e.messageId===a.id).map(e=>e.id),threadId:n.id,text:a.text,show:i(a.bot,`${a.bot} asks`)})}let l=e.filter(e=>!r.some(t=>t.id===e.messageId)),o="done"===n.status,u="waiting"===n.status&&(0,R.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: ${nI(r)}`:`Done. Its answer: ${nI(r)}`;t.push({rank:nL[e],key:`${e}:${n.id}@${a}`,kind:"ending",line:`${s(n.bot,e)}
|
|
6
|
+
${o}`,relayIds:l.map(e=>e.id),threadId:n.id,text:r,show:i(n.bot,"stopped"===e?`${n.bot} stopped`:`${n.bot} finished`)});continue}for(let e of l)t.push({rank:nL.progress,key:`progress:${e.id}`,kind:"progress",line:`${s(e.bot,e.kind)}
|
|
7
|
+
${nI(e.text)}`,relayIds:[e.id],threadId:n.id,text:e.text,show:i(e.bot,`${e.bot} ${nR[e.kind]}`)})}return t.sort((e,t)=>e.rank-t.rank)}function n$(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.`:"showed"===e.kind?`The user drew a picture on screen and showed it to you, kept on this computer at ${e.path}.`:`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 nB=(0,nn.createServerReference)("7f6833b6b8626d58da4ebe3e159ce8c84ea59843a7",nn.callServer,void 0,nn.findSourceMapURL,"endCallAction"),nP=(0,nn.createServerReference)("7f37d8e4e9fe47d000b505c8f2307eac392020c20e",nn.callServer,void 0,nn.findSourceMapURL,"openTextCallAction"),nz=(0,nn.createServerReference)("7fbc7dd484830a41add56a23f34410993eed3de8c5",nn.callServer,void 0,nn.findSourceMapURL,"tellTextCallAction");var nq=e.i(561540);let nF=null,nU=null;async function nK(e,t){let n=await fetch(e,{signal:t});if(!n.ok)throw Error(`${new URL(e).host} answered ${n.status}`);return n.json()}async function nH(e,t){let n=await nK(`https://api.bigdatacloud.net/data/reverse-geocode-client?${new URLSearchParams({latitude:String(e.latitude),longitude:String(e.longitude),localityLanguage:"en"})}`,t);return{name:[n.city||n.locality,n.countryName].filter(Boolean).join(", ")||null,country:/^[A-Z]{2}$/.test(n.countryCode??"")?n.countryCode:null}}async function nW(e,t){let n=e=>(Math.round(100*e)/100).toString(),r=await nK(`https://api.open-meteo.com/v1/forecast?${new URLSearchParams({latitude:n(e.latitude),longitude:n(e.longitude),current:"temperature_2m,weather_code,wind_gusts_10m",daily:"temperature_2m_max,temperature_2m_min,sunrise,sunset",timezone:"auto",forecast_days:"1"})}`,t),a=r.current.wind_gusts_10m;return{code:r.current.weather_code,temperature:r.current.temperature_2m,low:r.daily.temperature_2m_min[0],high:r.daily.temperature_2m_max[0],sunrise:r.daily.sunrise[0].slice(11,16),sunset:r.daily.sunset[0].slice(11,16),gusts:"number"==typeof a?a:null}}async function nG(){let e=await new Promise((e,t)=>navigator.geolocation.getCurrentPosition(({coords:t})=>e(t),t,{maximumAge:A.HERE.keptMs})),t=new AbortController,n=setTimeout(()=>t.abort(),A.HERE.lookMs),[r,a]=await Promise.allSettled([nH(e,t.signal),nW(e,t.signal)]);for(let[e,t]of(clearTimeout(n),[["place",r],["weather",a]]))"rejected"===t.status&&console.warn(`No ${e} for the call: ${(0,k.errorToString)(t.reason)}`);let s="fulfilled"===r.status?r.value:null,i={place:s?.name??null,weather:"fulfilled"===a.status?a.value:null};return i.place||i.weather?{where:i,position:{lat:e.latitude,lon:e.longitude},country:s?.country??null}:null}function nY(){if(nU&&Date.now()-nU.asked<A.HERE.keptMs)return nU.done;let e=nG().then(e=>{e&&(nF={found:e,at:Date.now()})},e=>{e?.code===1?nF=null:console.warn(`No position for the call: ${(0,k.errorToString)(e)}`)}).then(()=>{nU?.done===e&&(nU=null)});return nU={done:e,asked:Date.now()},e}function nV(){return nF&&Date.now()-nF.at<A.HERE.keptMs?nF.found:(navigator.geolocation&&nY(),nF?.found.where.place)?{...nF.found,where:{place:nF.found.where.place,weather:null}}:null}async function nJ(){let e;if((!nF||Date.now()-nF.at>=A.HERE.keptMs-A.HERE.lookMs)&&navigator.geolocation&&navigator.permissions){try{e="granted"===(await navigator.permissions.query({name:"geolocation"})).state}catch{return}e&&await nY()}}let nX=new nj.DefaultChatTransport({api:y.queryKey.textCall}),nZ=()=>nb.useThursdayStore.getState().textModel,nQ=e=>({type:`data-${ny.TEXT_CALL_NOTE}`,id:e.id,data:e});async function n0(e,t,n,r){try{let a=await fetch(y.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,nM.unwrapResult)(await a.json());return"string"==typeof s?s:JSON.stringify(s??null)}catch(e){return`Error: ${(0,k.errorToString)(e)}`}}var n1=e.i(895499);let n2={"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"},n5=e=>e.toLowerCase().replace(/[^a-z0-9 ]/g,"").split(/\s+/).filter(Boolean),n3=(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 i=n[s-1]+ +(t[a-1]!==e[s-1]);r[s]=Math.min(i,n[s]+1,r[s-1]+1)}[n,r]=[r,n]}return n[e.length]}(e,t)<=n,n4={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 n6(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 n7=!1,n9=[];class n8{options;_lastLog;_mockFn;constructor(e={}){const t=e.types||n4;for(const n in this.options=((...e)=>e.reduce((e,t)=>(function e(t,n,r=".",a){if(!n6(n))return e(t,{},r,a);let s=Object.assign({},n);for(let n in t){if("__proto__"===n||"constructor"===n)continue;let i=t[n];null!=i&&(a&&a(s,n,i,r)||(Array.isArray(i)&&Array.isArray(s[n])?s[n]=[...i,...s[n]]:n6(i)&&n6(s[n])?s[n]=e(i,s[n],(r?`${r}.`:"")+n.toString(),a):s[n]=i))}return s})(e,t,"",void 0),{}))({...e,defaults:{...e.defaults},level:re(e.level,t),reporters:[...e.reporters||[]]},{types:n4,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=re(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 n8({...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(){n7=!0}resumeLogs(){for(let e of(n7=!1,n9.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)=>n7?void n9.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:re(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 i=(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 l=this._lastLog.time&&s.date?s.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=s.date,l<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(i,this.options.throttle);return}}catch{}i(!0)}_log(e){for(let t of this.options.reporters)t.log(e,{options:this.options})}}function re(e,t={},n=3){return void 0===e?n:"number"==typeof e?e:t[e]&&void 0!==t[e].level?t[e].level:n}n8.prototype.add=n8.prototype.addReporter,n8.prototype.remove=n8.prototype.removeReporter,n8.prototype.clear=n8.prototype.removeReporter,n8.prototype.withScope=n8.prototype.withTag,n8.prototype.mock=n8.prototype.mockTypes,n8.prototype.pause=n8.prototype.pauseLogs,n8.prototype.resume=n8.prototype.resumeLogs;class rt{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
|
+
`,i=`%c${[r,n].filter(Boolean).join(":")}`;"string"==typeof e.args[0]?t(`${i}%c ${e.args[0]}`,s,"",...e.args.slice(1)):t(i,s,...e.args)}}function rn(e={}){return function(e={}){return new n8(e)}({reporters:e.reporters||[new rt({})],prompt:(e,t={})=>"confirm"===t.type?Promise.resolve(confirm(e)):Promise.resolve(prompt(e)),...e})}rn();var rr=e.i(247167),ra=e.i(379227);let{env:rs={},argv:ri=[],platform:rl=""}=void 0===rr.default?{}:rr.default,ro="NO_COLOR"in rs||ri.includes("--no-color"),ru="FORCE_COLOR"in rs||ri.includes("--color"),rc="dumb"===rs.TERM,rd=ra&&ra.isatty&&ra.isatty(1)&&rs.TERM&&!rc,rh="CI"in rs&&("GITHUB_ACTIONS"in rs||"GITLAB_CI"in rs||"CIRCLECI"in rs),rp=!ro&&(ru||"win32"===rl&&!rc||rd||rh);function rm(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,i=n.slice(Math.max(0,t+r.length)),l=i.indexOf(r)){return s+(l<0?i:e(l,i,r,a))}(s,a,t,n)+t):""}}(`\x1b[${e}m`,`\x1b[${t}m`,n)}let rf={reset:rm(0,0),bold:rm(1,22,"\x1b[22m\x1b[1m"),dim:rm(2,22,"\x1b[22m\x1b[2m"),italic:rm(3,23),underline:rm(4,24),inverse:rm(7,27),hidden:rm(8,28),strikethrough:rm(9,29),black:rm(30,39),red:rm(31,39),green:rm(32,39),yellow:rm(33,39),blue:rm(34,39),magenta:rm(35,39),cyan:rm(36,39),white:rm(37,39),gray:rm(90,39),bgBlack:rm(40,49),bgRed:rm(41,49),bgGreen:rm(42,49),bgYellow:rm(43,49),bgBlue:rm(44,49),bgMagenta:rm(45,49),bgCyan:rm(46,49),bgWhite:rm(47,49),blackBright:rm(90,39),redBright:rm(91,39),greenBright:rm(92,39),yellowBright:rm(93,39),blueBright:rm(94,39),magentaBright:rm(95,39),cyanBright:rm(96,39),whiteBright:rm(97,39),bgBlackBright:rm(100,49),bgRedBright:rm(101,49),bgGreenBright:rm(102,49),bgYellowBright:rm(103,49),bgBlueBright:rm(104,49),bgMagentaBright:rm(105,49),bgCyanBright:rm(106,49),bgWhiteBright:rm(107,49)},rg=function(e=rp){return e?rf:Object.fromEntries(Object.keys(rf).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 rx=rn({level:A.IS_DEV?4:3}),rw=(t=A.APP_NAME,rx.withDefaults({message:(n=`${t}: `,(function(e,t="reset"){return rg[e]||rg[t]})("blackBright")(n))}));var ry=e.i(413168);let rb={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},rv=new TextEncoder;async function rk(e){let t=rS(e);try{return await t.connect(),t}catch(e){throw await t.close(),e}}let rj=["response.completed","response.failed","response.incomplete","response.cancelled"],rS=({initialize:e,audio:t,on:n})=>{let r,a,s,i,l,o,u,c,d,h=!1,p=!1,m=!1,f=0,g=0,x="",w=[],y=new Set,b=new Set,v=new Set,j=new Map,S=!1,N=new Map,T=new Map,E=[],M=null,C=-1/0,_=null,R=()=>{clearTimeout(d),!_||_.unmute||m||p||(_.unmute=crypto.randomUUID(),J.send({type:"session.input_audio.unmute",event_id:_.unmute}))},L=()=>{for(let e of(clearTimeout(u),u=void 0,y))n.turn({...e.turn,fragments:[...e.fragments],done:!0});y.clear()},I=()=>{if(!m){for(let e of(m=!0,clearTimeout(l),clearTimeout(c),clearTimeout(d),U&&clearTimeout(U.timer),U=null,clearInterval(o),L(),M=null,E.splice(0)))e.settle(!1);J.close(),s?.()}},O=e=>{a?.(Error(e)),I(),h&&!p?n.failed(e):p&&n.warn(e)},D=-1/0,$=()=>{if(m||p)return;let e=performance.now(),r=t.levels?.();r&&r.output>.01&&(C=e);let a={speaking:e-C<300,working:[...j.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))},B=()=>{if(!h||m||p||M||!E.length)return;let[e]=E;M=crypto.randomUUID(),J.send({type:`session.${e.kind}.append`,event_id:M,delegation_id:null,content:e.chunks[0]}),c=setTimeout(()=>{n.warn("Live did not acknowledge the conversation update; delivery is unknown."),P(!1)},A.LIVE_CALL.appendMs)},P=e=>{clearTimeout(c),M=null;let[t]=E;t&&(e&&t.chunks.shift(),e&&t.chunks.length||(E.shift(),t.settle(e)),B())},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=w.findLast(e=>e.turn.role===t&&r>=e.turn.seq-A.LIVE_CALL.transcriptGapMs&&r<=e.end+A.LIVE_CALL.transcriptGapMs&&("user"===t||!w.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:[]},w.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}),y.add(s),u??=setTimeout(L,A.LIVE_CALL.transcriptSaveMs)},q=()=>{D=performance.now(),J.send({type:"response.create",event_id:crypto.randomUUID()})},F=(e,t=!1)=>{for(let t of(e.settled=!0,e.held.splice(0)))"fact"in t?Y(t.fact):V(t);let n=e.rerun;e.rerun=!1,n&&!t&&q()},U=null,K=()=>{let e=U;if((U=null,e)&&(clearTimeout(e.timer),!m&&!p)){for(let t of e.held)"fact"in t?Y(t.fact):V(t);e.rerun&&q()}},H=()=>{let e,t=(e=[...j.values()].at(-1))&&!e.settled&&(!e.terminal||e.calls.size>0)?e:void 0;if(t)return t;let n=performance.now()-D;if(!(n>=5e3))return U??={held:[],rerun:!1,timer:setTimeout(K,5e3-n)}},W=async e=>{if(e.terminal&&!e.continued){if(!e.calls.size)return F(e);e.continued=!0,await Promise.all(e.calls.values()),p||m||(F(e,!0),q()),$()}},G=async e=>{e.continued=!0,e.calls.size&&await Promise.all(e.calls.values()),p||m||F(e),$()},Y=e=>J.send({type:"response.item.create",event_id:crypto.randomUUID(),item:{type:"message",role:"developer",content:[{type:"input_text",text:e}]}}),V=({image:e,path:t})=>{try{J.send({type:"response.item.create",event_id:crypto.randomUUID(),item:{type:"message",role:"user",content:[{type:"input_text",text:`${t}, as an image:`},{type:"input_image",image_url:e}]}})}catch(a){let r=(0,k.errorToString)(a);rw.warn("Live picture not sent",{reason:r,bytes:e.length}),Y(`The picture of ${t} did not go through, so nothing on it was seen: ${r}`),n.warn(`${t} did not go through to her: ${r}`)}},J=function({negotiate:e,audio:t,on:n}){let r,a,s,i=null,l=null,o=null,u=!1,c=!1,d=!1,h=null,p=null,m=!1,f=Promise.resolve(),g=!1,x=e=>{for(let t of e?.getTracks()??[])t.stop()},w=e=>{u||d||(d=!0,c?n.dropped(e):a?.(Error(e)))},y=()=>{!c&&g&&(!h||m)&&(c=!0,r?.())};return{async connect(){let c=new RTCPeerConnection;i=c;let d=c.createDataChannel("oai-events");l=d;let f=new Promise((e,t)=>{r=e,a=t});d.onopen=()=>{g=!0,y()},d.onclose=()=>w("The connection to OpenAI Live closed."),d.onerror=()=>w("The connection to OpenAI Live dropped."),c.onconnectionstatechange=()=>{["failed","closed"].includes(c.connectionState)&&w("Could not reach OpenAI Live.")},f.catch(()=>{}),d.onmessage=({data:e})=>{let t;if(!u&&!h&&"string"==typeof e){try{t=JSON.parse(e)}catch{n.dropped("OpenAI Live sent an unreadable event.");return}n.event(t)}},c.ontrack=e=>{if(u)return;let n=e.streams[0]??new MediaStream([e.track]);t.element.srcObject=n,t.listen(n)};let b=await navigator.mediaDevices.getUserMedia({audio:rb});if(u)throw x(b),Error("The call closed before connecting.");for(let e of(o=b,t.hear?.(b),b.getAudioTracks()))c.addTrack(e,b);await c.setLocalDescription(await c.createOffer()),"complete"!==c.iceGatheringState&&await new Promise((e,t)=>{let n=n=>{clearTimeout(a),c.removeEventListener("icegatheringstatechange",r),s=void 0,n?t(n):e()},r=()=>{"complete"===c.iceGatheringState&&n()},a=setTimeout(()=>n(Error("ICE gathering timed out.")),1e4);s=()=>n(Error("The call closed before connecting.")),c.addEventListener("icegatheringstatechange",r),r()});let v=c.localDescription?.sdp;if(!v||u)throw Error("No live SDP offer is available.");let k=await e(v);if(u)throw Error("The call closed before connecting.");if("string"!=typeof k){let e;h=k.relay,await (e=h,new Promise((t,r)=>{let a=new EventSource(e);p=a,a.onopen=()=>t(),a.onmessage=({data:e})=>{let t;if(!u&&"string"==typeof e){try{t=JSON.parse(e)}catch{n.dropped("The call on the plan sent an unreadable event.");return}n.event(t)}},a.onerror=()=>{a.close(),r(Error("Could not follow the call on the plan.")),w("The line to her on the plan dropped.")}})),m=!0}await c.setRemoteDescription({type:"answer",sdp:"string"==typeof k?k:k.sdp}),y(),await f},send(e){if(!u){if(h){let t=h;f=f.then(async()=>{let n=await fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({events:[e]})}),r=await n.json().catch(()=>null);if(!n.ok||!(0,nM.isResultOk)(r))throw Error((0,nM.isResultError)(r)&&r.message||`${n.status}`)}).catch(e=>{w(`The call on the plan did not take what was sent: ${e instanceof Error?e.message:String(e)}`)});return}l?.readyState==="open"&&l.send(JSON.stringify(e))}},limit:()=>h?A.PLAN_CALL.pictureBytes:i?.sctp?.maxMessageSize??null,relayed:()=>null!==h,hush(){x(o)},close:()=>{u||(u=!0,a?.(Error("The call closed before connecting.")),s?.(),x(o),o=null,p?.close(),l?.close(),i?.close(),t.element.srcObject=null)}}}({audio:t,negotiate:async t=>{let n=await e(t);if(!("string"==typeof n?n:n.sdp))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?.(),B();break;case"session.closed":n.finalized?.({reason:e.reason??"closed",seconds:e.usage?.seconds??null}),rw.info("Live session closed",{reason:e.reason,seconds:e.usage?.seconds}),a?.(Error("OpenAI Live closed before startup completed.")),I(),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":R(),z(e,"assistant");break;case"session.input_audio.unmuted":_&&e.client_event_id===_.unmute&&(_=null);break;case"session.instructions.appended":case"session.commentary.appended":case"session.thinking.appended":M&&e.client_event_id===M&&P(!0);break;case"error":{let t=e.error?.message??"OpenAI Live reported an error.";if(!h){O(t);break}if(_?.unmute&&e.error?.client_event_id===_.unmute){O(`She could not hear the microphone again: ${t}`);break}for(let r of(_&&e.error?.client_event_id===_.mute&&(clearTimeout(d),_=null),n.warn(t),M&&e.error?.client_event_id===M&&P(!1),j.values()))r.terminal||r.calls.size||(r.terminal=!0,r.stale=!0,F(r));$();break}case"session.delegation.created":D=performance.now();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=j.get(r);if(!a){let e=[],t=!1;for(let n of j.values())n.settled||n.continued||(n.settled=!0,e.push(...n.held.splice(0)),t||=!!n.rerun);U&&(clearTimeout(U.timer),e.push(...U.held),t||=U.rerun,U=null),a={calls:new Map,held:e,terminal:!1,continued:!1,rerun:t},j.set(r,a)}if(a.stale&&!rj.includes(t.type)&&(a.stale=!1,a.terminal=!1,a.settled=!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===ry.LIVE_HOSTED_TOOLS.webSearch.item){let e=t.item,a="response.output_item.done"===t.type;a&&rw.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,rw.warn("Live backend call cut off; not run",{responseId:r,name:e.name,arguments:e.arguments.slice(0,200)}),a.calls.size&&!S?(S=!0,W(a)):(S=!1,G(a));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,k.errorToString)(e)}`).then(t=>{T.delete(e.call_id),m||p||((e,t)=>{let n=t=>J.send({type:"response.item.create",event_id:crypto.randomUUID(),item:{type:"function_call_output",call_id:e,output:t}});try{n(t)}catch(r){let e=(0,k.errorToString)(r);rw.warn("Live tool output not sent",{reason:e,chars:t.length});try{n(`Error: the result was too large to return (${t.length.toLocaleString("en")} characters: ${e}). Ask for a smaller part of it.`)}catch(e){rw.warn("Live tool output not answered",{reason:(0,k.errorToString)(e)})}}})(e.call_id,t),$()});a.calls.set(e.call_id,s),W(a)}rj.includes(t.type)&&(a.terminal=!0,a.stale=!1,"response.completed"===t.type?(S=!1,rw.debug("Live backend usage",{responseId:r,usage:t.response?.usage}),W(a)):"response.incomplete"===t.type&&a.calls.size&&!S?(S=!0,rw.warn("Live backend response incomplete; continuing once",{responseId:r}),W(a)):(S=!1,G(a),n.warn(t.response?.error?.message??`The Live backend ${t.type.slice(9)}.`)))}}$()}},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."),A.LIVE_CALL.startupMs);try{if(await Promise.all([J.connect(),e]),m)throw Error("The Live call closed during startup.");o=setInterval($,100)}catch(e){throw I(),e}finally{clearTimeout(n),a=void 0}},close:()=>i||(m?Promise.resolve():(p=!0,L(),h)?(i=new Promise(e=>{s=e}),l=setTimeout(()=>{n.warn("Live disconnected without confirming final session usage."),I()},A.LIVE_CALL.closeMs),t.element.muted=!0,J.hush(),J.send({type:"session.close",event_id:crypto.randomUUID()}),i):(I(),Promise.resolve())),append(e,t){let n=function(e){let t=[],n="",r=0,a=e=>{let a=rv.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=rv.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}),B()})},holdInput(e){J.relayed()||!h||m||p||_||e<=0||(_={mute:crypto.randomUUID(),unmute:null},J.send({type:"session.input_audio.mute",event_id:_.mute}),d=setTimeout(R,e))},pictureRoom:e=>{let t=J.limit();return(t&&Number.isFinite(t)&&t>2048?t:65536)-1024-rv.encode(e).length-64},brief(e){let t=e.trim();if(m||p||!t)return;let n=H();n?n.held.push({fact:t}):Y(t)},picture(e,t){if(m||p)return;let n=H();n?n.held.push({image:e,path:t}):V({image:e,path:t})},run(){if(m||p)return;let e=H();e?e.rerun=!0:q(),$()}}};var rN=e.i(218080);function rT(){let e=[],t=null;return{send(n){t?t(n):e.push(n)},open(n){t=n;let r=e;for(let t of(e=[],r))n(t)},close(){t=null},clear(){let t=e;return e=[],t}}}var rE=e.i(567334),rM=e.i(114923);let rA="thursday.here.shown",rC=e=>(0,V.format)(e,"yyyy-MM-dd"),r_=null;var rR=e.i(183414),rL=e.i(838098);async function rI(e,t){let n,r,a,s=t=>({failed:`${e} could not be read: ${(0,k.errorToString)(t)}`});try{n=await fetch(y.queryKey.file(e))}catch(e){return s(e)}if(404===n.status)return{failed:`There is no file at ${e} in the workspace.`};if(403===n.status)return{failed:`${e} is outside the workspace.`};if(!n.ok)return{failed:`${e} could not be read: the file route answered ${n.status}.`};try{r=await n.blob()}catch(e){return s(e)}if(!r.type.startsWith("image/"))return{failed:`${e} is not an image. Read it in the shell instead.`};try{a=await createImageBitmap(r)}catch(t){return{failed:`${e} could not be drawn as a picture: ${(0,k.errorToString)(t)}`}}try{let n=function(e,t){var n,r;let a,s,i=document.createElement("canvas"),l=i.getContext("2d");if(!l)return{failed:"draw"};for(let o of(n=e.width,a=Math.max(n,r=e.height),s=Math.min(a,A.CALL_PICTURE.longestSide),A.CALL_PICTURE.scales.map(e=>{let t=s*e/a;return{width:Math.max(1,Math.round(n*t)),height:Math.max(1,Math.round(r*t))}})))for(let n of(i.width=o.width,i.height=o.height,l.fillStyle="#fff",l.fillRect(0,0,i.width,i.height),l.drawImage(e,0,0,i.width,i.height),A.CALL_PICTURE.qualities)){let e=i.toDataURL("image/jpeg",n);if(e.length<=t)return{url:e}}return{failed:"fit"}}(a,t);if("url"in n)return n;return{failed:"draw"===n.failed?"This browser could not draw the picture.":`${e} would not fit the ${(0,k.formatBytes)(t)} this connection carries, even made smaller.`}}finally{a.close()}}async function rO(e,{fact:t,pictures:n,run:r},a,s){try{let s=[];for(let t of n)s.push({path:t,taken:await a(t,e.pictureRoom(t))});for(let{path:n,taken:r}of(e.brief(t),s))"url"in r?e.picture(r.url,n):e.brief(`${n} could not be put before you as a picture: ${r.failed}`);r&&e.run()}finally{s(t)}}let rD=(0,nn.createServerReference)("7fdc46c435ed862cd5baaefe6b0dbd1be211ffb8f4",nn.callServer,void 0,nn.findSourceMapURL,"openCallAction"),r$=(0,nn.createServerReference)("7fa1ab106875647c2db12157ec630b5906f83a5c68",nn.callServer,void 0,nn.findSourceMapURL,"saveThoughtAction"),rB=(0,nn.createServerReference)("7f4f823a021f867cc74d2a6b64f28e34e9a12369e2",nn.callServer,void 0,nn.findSourceMapURL,"saveTurnsAction"),rP={offer:"the microphone and the offer",globe:"the globe's map",answer:"the server's answer",line:"the line"};function rz(e,t){let n="chatgpt"===e?" on your GPT Subscription":"openai"===e?" on your OpenAI key":"";return t?`Could not start the call${n}`:`The call${n} failed`}class rq extends Error{}let rF=Array(rN.SPECTRUM_BANDS).fill(0),rU=!1;function rK(e){let t=e.replace(/\[[^\]]*\]?|\]/g,"").trim();return/[\p{L}\p{N}]/u.test(t)?t:""}function rH(e,t,n="This call is not being saved"){e.failures>=A.CALL_PAGE.saveFailures||t().then(e=>(0,nM.unwrapResult)(e)).catch(t=>{e.failures+=1,e.failures===A.CALL_PAGE.saveFailures&&nS.toast.add({type:"warning",title:n,description:(0,k.errorToString)(t)})})}var rW=e.i(991268);let rG="(prefers-reduced-motion: reduce)";function rY({turns:e,saying:t}){let[n,a]=(0,w.useState)(""),s=(0,w.useRef)(null),i=e.at(-1);return(0,w.useEffect)(()=>{if(!i||"assistant"!==i.role||t)return;let e=`${i.id}:${i.text.length}`;s.current!==e&&(s.current=e,a(i.text))},[i,t]),(0,D.useAppEvent)({finished:e=>a(`${e.bot} finished: ${e.label}`)}),(0,r.jsx)("div",{role:"status","aria-live":"polite",className:"sr-only",children:n})}var rV=e.i(772581),rJ=e.i(174080),rX=e.i(877267);let rZ="700 9px ui-monospace, SFMono-Regular, Menlo, monospace",rQ=Math.ceil(13.5);function r0(e){let t=document.createElement("canvas");t.width=rQ*e.length,t.height=rQ;let n=t.getContext("2d");return n?(n.textAlign="center",n.textBaseline="middle",n.font=rZ,e.forEach((e,t)=>{n.fillText(e,t*rQ+rQ/2,rQ/2)}),t):null}function r1({status:e}){let t=(0,w.useRef)(null),n=(0,w.useRef)(null),a=(0,w.useRef)(e),[s,i]=(0,w.useState)(!1),l=(0,w.useRef)(null);return(0,w.useEffect)(()=>{"emoji"===(0,rX.faceGlyphs)()&&(l.current=r0(rE.EMOJI_POOL))},[]),(0,w.useEffect)(()=>{let t=a.current;a.current=e,"connecting"!==t||"connecting"===e||"idle"===e||"ending"===e||window.matchMedia("(prefers-reduced-motion: reduce)").matches||i(!0)},[e]),(0,w.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,rE.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,rE.hash)(t+31,e+17),i=Math.hypot(n-u,r-c)/d*(1+.1*Math.sin(3*a+1.3)+.05*Math.sin(7*a-.7)+(s-.5)*.1);i<.1||m.push({x:n,y:r,dd:i,seed:(0,rE.hash)(t,e),grain:s,speck:(0,rE.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,rX.faceGlyphs)(),w=x?null:l.current??r0(rE.EMOJI_POOL);if(!g||!x&&!w)return;x&&(g.textAlign="center",g.textBaseline="middle",g.font=rZ,g.fillStyle=getComputedStyle(e).color);let y=rE.LEVELS-1,b=x?rE.CHAR_RATE:rE.EMOJI_CHAR_RATE,v=rQ/2,k=performance.now(),j=0,S=0,N=()=>{let e=(performance.now()-k)/1e3;if(e>1.9736842105263157)return i(!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,rE.smoothstep)(-.03,.02,a)*(1-(0,rE.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,rE.smoothstep)(.4*e,e,t)))}let i=Math.round(s*y);if(i<1)continue;let l=Math.floor(e*b+10*r.seed);if(w){g.globalAlpha=(0,rE.emojiAlpha)(i,y);let e=Math.floor((0,rE.hash)(97*r.seed,l)*rE.EMOJI_POOL.length);g.drawImage(w,e*rQ,0,rQ,rQ,r.x-v,r.y-v,rQ,rQ);continue}g.globalAlpha=rE.ALPHA_TOP*(i/y);let o=rE.RAMP[i];g.fillText(o[Math.floor((0,rE.hash)(131*r.seed,l)*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,rJ.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 r2=e.i(333495),r5=e.i(435135),r3=e.i(454263);let r4=["▁▄▇▄","▂▆▆▂","▄▇▄▁","▆▆▂▂","▇▄▁▄","▆▂▂▆","▄▁▄▇","▂▂▆▆"];function r6({live:e,ringing:t}){let{owed:n}=tS(),r=no(Object.values(nu()).map(e=>e??null)),a="waiting"===r?null:r;return(0,w.useEffect)(()=>{let r=t?`${A.APP_NAME} is calling`:A.APP_NAME,a=n>0?`(${n}) ${r}`:r;if(!e){document.title=a;return}let s=0;document.title=`${a} ${r4[s]}`;let i=setInterval(()=>{s=(s+1)%r4.length,document.title=`${a} ${r4[s]}`},100);return()=>clearInterval(i)},[e,n,t]),(0,w.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,r3.markAtRest)(z.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 r7={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"}]]};r7.node;let r9=(0,l.default)(r7);var r8=e.i(96892);let ae={name:"brush",size:24,node:[["path",{d:"m11 10 3 3",key:"fzmg1i"}],["path",{d:"M6.5 21A3.5 3.5 0 1 0 3 17.5a2.62 2.62 0 0 1-.708 1.792A1 1 0 0 0 3 21z",key:"p4q2r7"}],["path",{d:"M9.969 17.031 21.378 5.624a1 1 0 0 0-3.002-3.002L6.967 14.031",key:"wy6l02"}]]};ae.node;let at=(0,l.default)(ae);var an=e.i(64801),ar=e.i(463415),aa=e.i(59377),as=e.i(184762),ai=e.i(146538);let al=(0,nn.createServerReference)("7f1d9081c007fcd60cbfe3ca9344829619fc2d4be8",nn.callServer,void 0,nn.findSourceMapURL,"startThreadAction");var ao=e.i(553429),au=e.i(709190);let ac={name:"redo-2",size:24,node:[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]};ac.node;let ad=(0,l.default)(ac),ah={name:"undo-2",size:24,node:[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]};ah.node;let ap=(0,l.default)(ah);var am=e.i(161483);let af=[{label:"Ink",color:null},{label:"Red",color:e$.MARK_INK.red},{label:"Orange",color:e$.MARK_INK.orange},{label:"Yellow",color:e$.MARK_INK.yellow},{label:"Green",color:e$.MARK_INK.green},{label:"Blue",color:e$.MARK_INK.blue},{label:"Violet",color:e$.MARK_INK.violet},{label:"Pink",color:e$.MARK_INK.pink},{label:"Stone",color:e$.MARK_INK.stone}];function ag(e,t,n,r,a){for(let s of(e.lineCap="round",e.lineJoin="round",e.lineWidth=.014*t,r)){let[r,...i]=s.points;if(r){for(let[l,o]of(e.strokeStyle=a(s.pen),e.beginPath(),e.moveTo(r[0]*t,r[1]*n),i))e.lineTo(l*t,o*n);i.length||e.lineTo(r[0]*t+.1,r[1]*n),e.stroke()}}}function ax({open:e,onClose:t,onDone:n,action:a}){let s=(0,w.useRef)([]),i=(0,w.useRef)(null),l=(0,w.useRef)([]),o=(0,w.useRef)([]),[u,c]=(0,w.useState)(0),[,d]=(0,w.useState)(0),h=(0,F.useCommandLabel)("KeyZ"),p=(0,F.useCommandLabel)("KeyZ",!0),[m,f]=(0,w.useState)(0),[g,x]=(0,w.useState)(null),[y,v]=(0,w.useState)(null),[j,S]=(0,w.useState)(!1),N=(0,tB.useIsDark)();(0,F.useEscape)(e,t);let T=(0,w.useCallback)(e=>{let[t,n,r]=N?rE.ORB_INK.dark:rE.ORB_INK.light;return af[e]?.color??`rgb(${t},${n},${r})`},[N]);(0,w.useEffect)(()=>{if(!g)return;let e=new ResizeObserver(([e])=>{let t=e.contentRect.width,n=e.contentRect.height;t>0&&n>0&&v({width:t,height:n})});return e.observe(g),()=>e.disconnect()},[g]),(0,w.useEffect)(()=>{if(!g||!y)return;let e=Math.min(2,window.devicePixelRatio||1);g.width=Math.round(y.width*e),g.height=Math.round(y.height*e);let t=g.getContext("2d");t&&(t.setTransform(e,0,0,e,0,0),ag(t,y.width,y.height,s.current,T))},[g,y,T]);let E=e=>{let t=e.currentTarget.getBoundingClientRect();return[Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),Math.min(1,Math.max(0,(e.clientY-t.top)/t.height))]},C=e=>{let t=g?.getContext("2d");t&&y&&ag(t,y.width,y.height,[{pen:e.pen,points:e.points.slice(-2)}],T)},_=()=>{c(s.current.length),d(e=>e+1);let e=g?.getContext("2d");g&&e&&y&&(e.clearRect(0,0,g.width,g.height),ag(e,y.width,y.height,s.current,T))},R=()=>{l.current.push([...s.current]),o.current=[],d(e=>e+1)},L=(e,t)=>{let n=e.current.pop();n&&(i.current=null,t.current.push(s.current),s.current=n,_())},I=()=>L(l,o),O=()=>L(o,l),D=async()=>{if(g&&y&&s.current.length){S(!0);try{let{width:e,height:t}=y,r=1,a=1,u=0,c=0;for(let e of s.current)for(let[t,n]of e.points)r=Math.min(r,t),a=Math.min(a,n),u=Math.max(u,t),c=Math.max(c,n);let d=.027*e,h=Math.max(0,r*e-d),p=Math.max(0,a*t-d),m=Math.min(e,u*e+d)-h,f=Math.min(t,c*t+d)-p,x=Math.min(Math.min(2,window.devicePixelRatio||1),A.DRAW_PAD.longestSide/Math.max(m,f)),w=document.createElement("canvas");w.width=Math.max(1,Math.round(m*x)),w.height=Math.max(1,Math.round(f*x));let b=w.getContext("2d");if(!b)throw Error("This browser gave no canvas to keep it on.");b.fillStyle=getComputedStyle(g).backgroundColor,b.fillRect(0,0,w.width,w.height),b.setTransform(x,0,0,x,-h*x,-p*x),ag(b,e,t,s.current,T);let v=await new Promise(e=>w.toBlob(e,"image/png"));if(!v)throw Error("This browser could not keep the drawing.");let k=s.current.length;await n(new File([v],"drawing.png",{type:"image/png"}))&&s.current.length===k&&(s.current=[],i.current=null,l.current=[],o.current=[],_())}catch(e){nS.toast.add({type:"error",title:"The drawing could not be kept.",description:(0,k.errorToString)(e)})}finally{S(!1)}}};return(0,r.jsx)(tb.Dialog,{open:e,onOpenChange:e=>!e&&t(),children:(0,r.jsxs)(tb.DialogContent,{showCloseButton:!1,onKeyDown:e=>{if(!(e.metaKey||e.ctrlKey)||e.altKey)return;let t=e.key.toLowerCase();"z"===t?(e.preventDefault(),e.shiftKey?O():I()):"y"===t&&e.ctrlKey&&!e.metaKey&&(e.preventDefault(),O())},className:"w-[min(72rem,calc(100vw-2rem),calc((100dvh-7rem)*2))] max-w-none gap-3 p-3 sm:max-w-none",children:[(0,r.jsx)(tb.DialogTitle,{className:"sr-only",children:"Drawing pad"}),(0,r.jsx)("canvas",{ref:x,"aria-label":"Drawing pad",className:"block aspect-[2/1] w-full cursor-crosshair touch-none rounded-lg bg-background ring-1 ring-foreground/10",onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),R();let t={pen:m,points:[E(e)]};i.current=t,s.current.push(t),C(t),c(s.current.length)},onPointerMove:e=>{let t=i.current;if(!t)return;let n=E(e),r=t.points[t.points.length-1];.002>Math.hypot(n[0]-r[0],n[1]-r[1])||(t.points.push(n),C(t))},onPointerUp:()=>{i.current=null},onPointerCancel:()=>{i.current=null}}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 pl-1",children:af.map((e,t)=>(0,r.jsx)(am.Swatch,{color:e.color,label:e.label,picked:m===t,onPick:()=>f(t)},e.label))}),(0,r.jsxs)(M.Tooltip,{children:[(0,r.jsx)(M.TooltipTrigger,{render:(0,r.jsx)(b.Button,{variant:"ghost",size:"icon","aria-label":"Undo",disabled:!l.current.length,onClick:I}),children:(0,r.jsx)(ap,{})}),(0,r.jsxs)(M.TooltipContent,{children:["Undo",(0,r.jsx)("kbd",{"data-slot":"kbd",className:"bg-background/20 px-1.5 font-mono text-[10px]",children:h})]})]}),(0,r.jsxs)(M.Tooltip,{children:[(0,r.jsx)(M.TooltipTrigger,{render:(0,r.jsx)(b.Button,{variant:"ghost",size:"icon","aria-label":"Redo",disabled:!o.current.length,onClick:O}),children:(0,r.jsx)(ad,{})}),(0,r.jsxs)(M.TooltipContent,{children:["Redo",(0,r.jsx)("kbd",{"data-slot":"kbd",className:"bg-background/20 px-1.5 font-mono text-[10px]",children:p})]})]}),(0,r.jsx)("span",{"aria-hidden":!0,className:"h-4.5 w-px bg-border"}),(0,r.jsx)(b.Button,{variant:"ghost",disabled:!u,onClick:()=>{R(),s.current=[],i.current=null,_()},children:"Clear"}),(0,r.jsx)(b.Button,{disabled:!u,loading:j,onClick:()=>void D(),children:a})]})]})})}let aw={name:ao.ROOM_THURSDAY,description:"A call in writing — she answers here"},ay=e=>/^@(\S*)$/.exec(e.split(/\s/,1)[0]);function ab({written:e,onCall:t=!1}){let{data:n}=(0,W.useServerRoute)(y.queryKey.bot),a=(0,w.useMemo)(()=>[...e?[aw]:[],...n?.length?n.filter(e=>!e.disabled).map(({name:e,icon:t,description:n})=>({name:e,icon:t,description:n})):[R.DEFAULT_BOT]],[n,e]),[i,l]=(0,w.useState)(!1),[o,u]=(0,w.useState)(!1),[c,d]=(0,w.useState)(!1),[h,p]=(0,w.useState)(!1),[m,g]=(0,w.useState)(""),[x,v]=(0,w.useState)(0),[j,S]=(0,w.useState)(!1),N=(0,w.useRef)(t);N.current=t;let T=(0,au.useGivenFiles)({onKept:e=>{if(N.current)return G.screenActs.announce({kind:"gave",paths:e}),"she knows it is here"}}),E=(0,w.useRef)(null),M=(0,w.useRef)(null),A=!!e?.on,[C,L]=(0,w.useState)(null);(0,w.useEffect)(()=>{A||L(null)},[A]);let I=a.find(e=>e.name===C)??(e?aw:a[0]),O=I===aw,D=(0,nc.useCallHeld)(),$=(0,w.useCallback)(e=>{D||(l(!0),e&&(g(e=>ay(e)?e:e?`@ ${e}`:"@"),S(!1),v(0)),requestAnimationFrame(()=>{let t=E.current;t?.focus();let n=t?.value.split(/\s/,1)[0].length??0;e&&t?.setSelectionRange(n,n)}))},[D]),B=(0,G.useRoomOpen)(),{take:P}=T,z=(0,w.useCallback)(e=>(G.writeLine.open(),P(e)),[P]);(0,w.useEffect)(()=>G.writeLine.subscribe($),[$]),(0,w.useEffect)(()=>G.writeLine.onDraw(()=>d(!0)),[]),(0,w.useEffect)(()=>{if("thread"===B)return;let e=e=>{(0,F.typed)(e,"@")&&(0,F.windowKey)(e)&&(e.preventDefault(),G.writeLine.choose())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[B]),(0,w.useEffect)(()=>{if(D)return;let e=e=>!!e.dataTransfer?.types.includes("Files"),t=t=>{e(t)&&(t.preventDefault(),p(!0))},n=e=>{null===e.relatedTarget&&p(!1)},r=t=>{if(!e(t))return;t.preventDefault(),p(!1);let n=[...t.dataTransfer?.files??[]];au.roomDrop.offer(t.target,n)||z(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)}},[z,D]);let[U,K]=(0,nA.useServerAction)(al,{onOk:({id:e})=>{(0,W.revalidate)(y.queryKey.threads),g(""),T.clear(),l(!1),L(null),G.roomOpens.open(e)}}),H=e=>{u(!1),g(e=>ay(e)?e.replace(/^@\S*\s?/,""):e),v(0),E.current?.focus(),L(e.name===aw.name?null:e.name)},Y=j?null:ay(m),V=Y&&!Y[1]?m.replace(/^@\s?/,""):null,J=null!==V&&!V.trim()&&!T.files.length&&!A,X=Y?a.filter(e=>e.name.toLowerCase().startsWith(Y[1].toLowerCase())):a,Z=X.length?x%X.length:0,[Q,ee]=(0,w.useState)(!1),et=K||Q,en=!!m.trim()&&!Y&&!T.arriving&&!et&&!(O&&!e?.runsOn),er=()=>{if(!en)return;let t=T.withPaths(m);O?e&&(ee(!0),e.say(t,T.paths).then(()=>{g(""),T.clear()}).catch(()=>{}).finally(()=>ee(!1))):U(I.name,t)},ea=()=>{if(C)return L(null);A&&e?.end(),l(!1)},es=(0,w.useRef)(t);(0,w.useEffect)(()=>{let e=t&&!es.current;es.current=t,!e||m.trim()||T.files.length||l(!1)},[t,m,T.files.length]);let ei=(i||h||A)&&!B;(0,F.useEscape)(ei,ea),q(ei,"write");let el=K||Q;(0,w.useEffect)(()=>{ei&&!el&&E.current?.focus()},[ei,el]),(0,w.useEffect)(()=>(G.writeLine.shown(ei),()=>G.writeLine.shown(!1)),[ei]);let ec=A&&!!B;(0,w.useEffect)(()=>(G.writeLine.waits(ec),()=>G.writeLine.waits(!1)),[ec]);let ed=eu(),[eh,ep]=(0,w.useState)(ei);(0,w.useEffect)(()=>{if(ei)return void ep(!0);let e=setTimeout(()=>ep(!1),200);return()=>clearTimeout(e)},[ei]);let em=(0,r.jsx)(ax,{open:c,onClose:()=>d(!1),onDone:async e=>{if(d(!1),!N.current)return(await z([e])).length>0;let t=await T.keepApart(e);return!!t&&(N.current?(G.screenActs.announce({kind:"showed",path:t}),nS.toast.add({type:"success",title:"Shown to her"}),!0):(nS.toast.add({type:"error",title:"The call ended before she saw the drawing."}),!1))},action:t?"Show her":"Add to the message"});return eh?(0,r.jsxs)(r.Fragment,{children:[em,h&&(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,k.cn)("@container flex w-160 max-w-full flex-col gap-2",ei?"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:[ed.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:[ed.length," ",1===ed.length?"needs":"need"," a reply"]}),(0,r.jsx)("div",{className:"max-h-[30vh] overflow-y-auto",children:ed.map(e=>(0,r.jsx)(ew,{thread:e,lines:2,onPick:()=>G.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:[(T.files.length>0||h)&&(0,r.jsx)(au.GivenFiles,{files:T.files,onRemove:T.remove,className:"px-0.5 pt-0.5",children:h&&(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)(r9,{className:"size-4"}),"Let go — it waits here"]})}),(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),er()},className:"flex items-end gap-2 @max-md:flex-wrap @max-md:items-center",children:[(0,r.jsxs)(aa.Popover,{open:o||!!Y,onOpenChange:u,children:[(0,r.jsxs)(aa.PopoverTrigger,{render:(0,r.jsx)("button",{type:"button","aria-label":`To ${I.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)(aS,{bot:I,size:22}),I.name,(0,r.jsx)(s.ChevronDown,{className:"size-3 text-muted-foreground"})]}),(0,r.jsxs)(aa.PopoverContent,{side:"top",align:"start",sideOffset:14,initialFocus:!Y&&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"}),X.map((e,t)=>(0,r.jsxs)("button",{type:"button",onClick:()=>H(e),className:(0,k.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",(Y?t===Z:e.name===I.name)&&"bg-muted"),children:[(0,r.jsx)(aS,{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===X.length&&(0,r.jsx)("p",{className:"px-2.5 py-2 text-[13px] text-muted-foreground",children:"Nobody by that name."})]})]}),(0,r.jsx)(as.Textarea,{ref:E,value:m,rows:1,disabled:K||Q,onChange:e=>{let t=e.target.value;g(t),v(0),ay(t)||S(!1)},onPaste:e=>{let t=[...e.clipboardData.files];t.length&&(e.preventDefault(),z(t))},onKeyDown:e=>{let t=(0,F.composing)(e);if("Escape"===e.key&&!t){if(e.preventDefault(),null!==V){if(g(V),!J)return;L(null),l(!1);return}return Y?S(!0):ea()}let n="ArrowDown"===e.key||"ArrowUp"===e.key;if(Y&&n&&!t){let t;return e.preventDefault(),t="ArrowDown"===e.key?1:-1,v(e=>X.length?(e+t+X.length)%X.length:0)}let r="Tab"===e.key&&!e.shiftKey;if(Y&&r&&!t&&X[Z]){e.preventDefault(),H(X[Z]);return}if("Enter"===e.key&&!e.shiftKey&&!t){if(e.preventDefault(),Y){X[Z]&&H(X[Z]);return}er()}},placeholder:T.files.length?"Say what to do with them":A&&O?"Write back":O?"Write to her instead of calling":`Say the whole job — ${I.name} cannot hear the call`,"aria-label":`Message for ${I.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 @max-md:order-first @max-md:basis-full @max-md:px-2 dark:bg-transparent"}),(0,r.jsx)("input",{ref:M,type:"file",multiple:!0,hidden:!0,onChange:e=>{z([...e.target.files??[]]),e.target.value=""}}),(0,r.jsxs)(ar.DropdownMenu,{children:[(0,r.jsx)(ar.DropdownMenuTrigger,{render:(0,r.jsx)("button",{type:"button","aria-label":"Add a file or a drawing",className:"grid size-9 shrink-0 @max-md:ml-auto 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 data-popup-open:bg-muted data-popup-open:text-foreground"}),children:(0,r.jsx)(an.Paperclip,{className:"size-4"})}),(0,r.jsxs)(ar.DropdownMenuContent,{side:"top",align:"end",sideOffset:14,className:"w-64 rounded-[18px] p-1.5",children:[(0,r.jsxs)(ar.DropdownMenuItem,{onClick:()=>M.current?.click(),className:"h-11 gap-2.5 rounded-xl px-2.5 text-[13.5px]",children:[(0,r.jsx)(tD.FolderOpen,{}),"A file from this computer"]}),(0,r.jsxs)(ar.DropdownMenuItem,{onClick:()=>d(!0),className:"h-11 gap-2.5 rounded-xl px-2.5 text-[13.5px]",children:[(0,r.jsx)(at,{}),"Draw something"]})]})]}),(0,r.jsx)("button",{type:"submit","aria-label":"Send",disabled:!en,className:(0,k.cn)("grid size-9 shrink-0 place-items-center rounded-full outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",en?"bg-primary text-primary-foreground hover:bg-primary/85":"bg-muted text-muted-foreground/40"),children:et?(0,r.jsx)("span",{className:"size-3.5 animate-spin rounded-full border-2 border-current/30 border-t-current"}):(0,r.jsx)(r8.ArrowUp,{className:"size-4"})})]})]}),O&&e?.error&&(e.refused?(0,r.jsxs)("div",{className:"flex flex-col items-center gap-0.5 px-4 text-center",children:[(0,r.jsxs)("p",{className:"text-xs leading-5 text-destructive",children:[(0,_.refusedWords)(e.refused),", so she could not answer."]}),(0,r.jsx)("p",{className:"line-clamp-2 font-mono text-[10.5px] leading-4 text-muted-foreground",children:e.error})]}):(0,r.jsx)("p",{className:"px-4 text-center text-xs leading-5 text-destructive",children:e.error})),O&&e?.error&&(0,r.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[e.refused&&(0,r.jsxs)(b.Button,{type:"button",size:"sm",onClick:()=>(0,eo.openSettings)("keys"),children:[(0,r.jsx)(f.Settings2,{}),"Open Settings"]}),(0,r.jsxs)(b.Button,{type:"button",size:"sm",variant:e.refused?"ghost":"brand",disabled:e.busy,onClick:()=>{e.fallback&&nb.useThursdayStore.getState().patch({textModel:e.fallback}),e.again()},children:[(0,r.jsx)(eN.RotateCw,{}),e.fallback?"Send it again on your OpenAI key":"Send it again"]})]}),(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",children:Y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(aN,{keys:["↑↓"],children:"walk"}),(0,r.jsx)(ak,{}),(0,r.jsx)(aN,{keys:["Tab","Enter"],children:"take"}),(0,r.jsx)(ak,{}),(0,r.jsx)(aN,{keys:["Esc"],children:J?"close":"close the list"})]}):(0,r.jsxs)(r.Fragment,{children:[O&&!e?.runsOn?(0,r.jsx)(av,{runsOn:null}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(aN,{keys:["Enter"],children:"send"}),(0,r.jsxs)("span",{className:"contents @max-md:hidden",children:[(0,r.jsx)(ak,{}),(0,r.jsx)(aN,{keys:["@"],children:O?"a bot":"pick a bot"})]}),O&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(ak,{}),(0,r.jsx)(av,{runsOn:e?.runsOn??null})]})]}),(0,r.jsx)(ak,{}),(0,r.jsx)(aN,{keys:["Esc"],children:A?O?"to end":"back to her":"close"})]})})]})})]}):em}function av({runsOn:e}){let t=_.TEXT_MODEL_PROVIDERS.chatgpt.label,n=(0,r.jsx)(ai.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)(ak,{}),(0,r.jsx)(aj,{children:"API keys"})]})}let ak=()=>(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"});function aj({children:e}){return(0,r.jsx)("button",{type:"button",onClick:()=>(0,eo.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 aS({bot:e,size:t}){return e===aw?(0,r.jsx)(z.ThursdayMark,{size:t,className:"shrink-0"}):(0,r.jsx)(L.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 aN({keys:e,children:t}){return(0,r.jsxs)("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[e.map(e=>(0,r.jsx)(aT,{children:e},e)),t]})}function aT({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})}let aE=(0,x.default)(()=>e.A(326970).then(e=>e.HereGlobe),{loadableGenerated:{modules:[246971]},ssr:!1});function aM({status:e,failed:t=!1,messages:n,tool:a,thinkingSince:s=null,thinkingTitle:i=null,ended:l=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:b=!0,written:v=null}){let[j,S]=(0,w.useState)(!1),N=!b&&"idle"===e,T="connecting"===e||"ending"===e,E=!!v?.on,M="idle"!==e&&!T&&!E,C=n.findLast(e=>"assistant"===e.role)?.text??"",_=U(aR),R="sides"===y&&"idle"!==e&&_,L=nx(),I=!R||null!==L,O=(0,w.useMemo)(()=>(0,r5.turnsOf)(n),[n]),D=(0,r5.useTurnFocus)(O,R),$=O.at(-1)?.role,P=function(e,t){let[n,r]=(0,w.useState)(e),a=(0,w.useRef)(e?[e]:[]),s=(0,w.useRef)(Date.now()),i=(0,w.useRef)(!1),l=(0,w.useRef)(null),o=(0,w.useCallback)(()=>{l.current&&clearTimeout(l.current),l.current=null,(a.current.length>1||i.current)&&a.current.length&&(l.current=setTimeout(()=>{a.current.shift(),s.current=Date.now(),r(a.current[0]??null),o()},Math.max(0,s.current+A.CALL_LINE.dwellMs-Date.now())))},[]);return(0,w.useEffect)(()=>{if(!e){i.current=!0,a.current.length<=1&&(a.current=[],r(null)),o();return}i.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,w.useEffect)(()=>{if(!t)return;let e=a.current.at(-1);a.current=e&&!i.current?[e]:[],s.current=Date.now(),r(a.current[0]??null),o()},[t,o]),(0,w.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]),n}(a,"speaking"===e),z=function(e,t){let n=null!==e||t,[r,a]=(0,w.useState)([]),[s,i]=(0,w.useState)(n);return(0,w.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=>aK(t)===aK(e));return r>=0?t.map((t,n)=>n===r?e:t):[...n,e].slice(-4)})},[e]),(0,w.useEffect)(()=>{if(n)return void i(!0);let e=setTimeout(()=>{i(!1),a([])},300);return()=>clearTimeout(e)},[n]),{lines:r,on:n,held:s}}(P,null!==s),[q,F]=(0,w.useState)(!1);(0,w.useEffect)(()=>{"user"!==$?F(!1):z.on&&F(!0)},[$,z.on]);let K=function(e,t,n){let[r,a]=(0,w.useState)(aH),s=e.findLast(e=>"assistant"===e.role),i=s?.id??null,l=s?`${s.id}:${s.text.length}`:null,o=!n&&e.at(-1)?.role==="assistant";(0,w.useEffect)(()=>{a(e=>{let n=e;for(let e of t){let t=aK(e),r=n.owner[t];if(void 0===r){let e=t in n.seen?n.seen[t]:l;if(t in n.seen||(n={...n,seen:{...n.seen,[t]:l}}),!i||e===l&&!o)continue;r=i,n={...n,owner:{...n.owner,[t]:r}}}let a=n.turns[r]??[],s=a.findIndex(e=>aK(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,l,i,o]),(0,w.useEffect)(()=>{e.length||a(aH)},[e.length]);let u=(0,w.useMemo)(()=>t.filter(e=>void 0===r.owner[aK(e)]),[t,r.owner]);return{turns:r.turns,pending:u,latest:i}}(O,z.lines,z.on),H="assistant"===$&&"speaking"===e||"user"===$&&"listening"===e&&!E,W=null!==c&&null===c.missedAt,Y=function(e){let[t,n]=(0,w.useState)(null);return(0,w.useEffect)(()=>{n(e?{...aG,at:Date.now()}:null)},[e]),t}(W),V=(0,nc.useCallHeld)(),J=(0,eo.useSettingsStore)(e=>e.open),X=(0,w.useSyncExternalStore)(e=>{let t=window.matchMedia(rG);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia(rG).matches,()=>!1),Z=(0,B.useCrewAwake)(),Q=(0,G.useRoomOffice)(),ee=(0,rW.useAwayAfter)(Q,aL),et="thread"===(0,G.useRoomOpen)(),en=Q&&"idle"!==e&&!E;return(0,w.useEffect)(()=>G.officeCaption.set(en),[en]),(0,w.useEffect)(()=>()=>G.officeCaption.set(!1),[]),(0,r.jsxs)("div",{className:"relative flex h-full flex-col",inert:V,children:[(0,r.jsx)(rY,{turns:O,saying:H}),(0,r.jsxs)("div",{className:"absolute top-5 right-5 z-10 flex flex-col items-end gap-3",children:[(0,r.jsx)(aI,{}),(0,r.jsx)(ns,{hidden:V||"idle"!==e||null!==c||E}),(0,r.jsx)(ts,{hidden:"idle"!==e||null!==c||E})]}),en&&(0,r.jsxs)("p",{className:"absolute top-5 left-6 z-20 line-clamp-2 max-w-[calc(100%-45rem)] animate-in text-[17px] leading-relaxed fade-in duration-500",children:[(0,r.jsx)("span",{"aria-hidden":!0,className:(0,k.cn)("mr-4 inline-block size-2.5 rounded-full bg-brand align-middle","speaking"===e?"animate-pulse motion-reduce:animate-none":"opacity-55")}),C||("connecting"===e?"Calling":"ending"===e?"Hanging up":"On a call")]}),(0,r.jsxs)("div",{inert:Q,className:(0,k.cn)("flex min-h-0 flex-1 flex-col items-center justify-center gap-5 pt-[7vh] transition-[opacity,scale] duration-500 ease-out motion-reduce:transition-none",Q&&"pointer-events-none scale-[0.97] opacity-0"),children:[(0,r.jsxs)("div",{className:"relative w-[min(20rem,52vw,37.5vh)] [--face-bleed:19.5%]",children:[(0,r.jsxs)("button",{type:"button",disabled:T,onClick:N?()=>S(!0):E&&!b?void 0:u,"aria-label":N?"Add a speech key":M?"End the call":W?"Answer Thursday":"Call Thursday",className:(0,k.cn)("group/face relative block w-full rounded-full outline-none transition-all duration-700 ease-out enabled:active:scale-[0.99] disabled:opacity-70",N&&"opacity-35"),children:[(0,r.jsx)("span",{className:"block",children:(0,r.jsx)(r2.Face,{status:e,failed:t,word:Y??o,getSpectrum:g,covered:V||L?.phase==="world"||ee,held:J||X&&"idle"===e&&!Z,className:"-m-(--face-bleed) w-[calc(100%+2*var(--face-bleed))] max-w-none"})}),(0,r.jsx)("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full opacity-0 ring-3 ring-ring/50 transition-opacity group-focus-visible/face:opacity-100"})]}),(0,r.jsx)(r1,{status:e}),L?.moment.kind==="here"&&(0,r.jsx)(aE,{scene:L.moment.scene,covered:V||ee,onPhase:e=>ng.tell(L.id,e)},L.id),R&&(0,r.jsx)("div",{className:(0,k.cn)("contents",L&&"*:invisible"),children:(0,r.jsx)(r5.SideCaptions,{turns:O,pinned:D.pinned,live:H,onPick:D.pick,under:z.held&&K.pending.length>0?(0,r.jsx)(aW,{lines:K.pending,shown:z.on}):null,ahead:q&&z.held&&K.pending.length>0,typed:E,workOf:e=>{let t=[...K.turns[e]??[],...e===K.latest&&"assistant"===$?K.pending:[]];return t.length?(0,r.jsx)(aW,{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)(aV,{ringing:c,wakePhrase:h,onAnswer:u,onDecline:()=>d?.()}),(0,r.jsxs)("div",{className:(0,k.cn)("contents",c&&"*:invisible"),children:[(0,r.jsx)(aF,{tool:I?P:null,toolUp:null!==P,thinkingSince:s,thinkingTitle:i,micOpen:!E&&("listening"===e||"working"===e||"delegating"===e),getMicSpectrum:x}),(0,r.jsx)(aO,{text:I&&"idle"!==e?C:"",fadeIn:!0,className:"w-full max-w-160 text-center text-base"}),(0,r.jsx)("div",{className:(0,k.cn)("flex flex-col items-center","idle"===e&&"order-first"),children:N?(0,r.jsx)(a6,{open:j,onOpen:()=>S(!0),onClose:()=>S(!1)}):E?(0,r.jsx)("span",{className:"h-6"}):(0,r.jsx)(a1,{status:e,idleLeft:m,since:f,ended:l,behind:R&&D.back,wakePhrase:h,hotkeyLabel:p})})]})]})]}),(0,r.jsxs)(aA,{children:[(0,r.jsx)("div",{inert:et,className:(0,k.cn)("contents *:transition-opacity *:duration-300",et&&"*:pointer-events-none *:opacity-0"),children:(0,r.jsx)(n1.ArtifactView,{talking:"idle"!==e})}),(0,r.jsx)(ab,{written:v,onCall:M}),(0,r.jsx)(e0,{})]})]})}function aA({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 aC=["thursday","memory","bot"];function a_({alert:e}){return e?(0,r.jsx)("span",{"aria-hidden":!0,className:(0,k.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 aR=1e3,aL=500;function aI(){let e=nu(),t=no(t9.filter(e=>!aC.includes(e.id)).map(t=>e[t.id]??null));return(0,r.jsxs)(M.TooltipProvider,{children:[(0,r.jsxs)(S,{className:"bg-background/75 backdrop-blur-md",children:[(0,r.jsx)(S,{children:aC.map(t=>{let n=t9.find(e=>e.id===t);return n?(0,r.jsxs)(M.Tooltip,{children:[(0,r.jsxs)(M.TooltipTrigger,{render:(0,r.jsx)(b.Button,{size:"icon",variant:"outline","aria-label":n.label,onClick:()=>(0,eo.openSettings)(t)}),children:[(0,r.jsx)(n.icon,{className:"text-muted-foreground"}),(0,r.jsx)(a_,{alert:e[t]??null})]}),(0,r.jsx)(M.TooltipContent,{side:"bottom",children:n.label})]},t):null})}),(0,r.jsx)(S,{children:(0,r.jsxs)(b.Button,{variant:"outline",onClick:()=>(0,eo.openSettings)(),className:"gap-1.5 px-2.5 text-[12.5px] font-normal",children:[(0,r.jsx)(f.Settings2,{className:"text-muted-foreground"}),"Settings",(0,r.jsx)(a_,{alert:t})]})})]}),(0,r.jsx)(nt,{})]})}function aO({text:e,lines:t=3,fadeIn:n=!1,className:a}){let l=(0,w.useRef)(null),[o,u]=(0,w.useState)(t),[c,d]=(0,w.useState)(0),[h,p]=(0,w.useState)(e);h!==e&&(p(e),d(0)),(0,w.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,o-t)/t),f=Math.max(0,o-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)(rV.CaptionWords,{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,k.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)(aD,{look:i.ChevronUp,label:"Earlier lines",shown:c<m,onPick:()=>d(e=>Math.min(m,e+1))}),(0,r.jsx)(aD,{look:s.ChevronDown,label:"Later lines",shown:c>0,onPick:()=>d(e=>Math.max(0,e-1))})]})]})}function aD({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,k.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 a$=[{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 aB({live:e,getMicSpectrum:t}){let n=(0,w.useRef)({}),a=(0,w.useRef)(a$.map(()=>0));return(0,w.useEffect)(()=>{if(!e||!t)return;let r=requestAnimationFrame(function e(){let s=t();a$.forEach((e,t)=>{let r=0;for(let t=e.from;t<e.to;t++)r=Math.max(r,s[t]??0);let i=Math.min(1,(r*e.gain)**.8),l=a.current[t],o=l+(i-l)*(i>l?.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:a$.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 aP({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)(aB,{live:e,getMicSpectrum:t}),"Listening"]})}function az({tool:e}){let t="relay"===e.kind?u:(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,W.useServerRoute)(y.queryKey.bot).data,i=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)(aq,{tool:e,bot:i,icon:t}),!e.done&&(0,r.jsx)("span",{className:"absolute inset-0 grid animate-ink place-items-center",children:(0,r.jsx)(aq,{tool:e,bot:i,icon:t,running:!0})})]}),e.done&&e.sources?.length?(0,r.jsx)(E.SourceChips,{sources:e.sources,limit:2,className:"flex-nowrap"}):e.done?(0,r.jsx)("span",{className:(0,k.cn)(a,"text-muted-foreground"),children:n}):(0,r.jsx)(T.ShinyText,{text:n,className:a})]})}function aq({tool:e,bot:t,icon:n,running:a}){return e.bot?(0,r.jsx)("span",{className:(0,k.cn)("flex",!a&&!e.done&&"opacity-40"),children:(0,r.jsx)(L.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,k.cn)("size-3.5",a?"text-foreground":"text-muted-foreground",!a&&!e.done&&"opacity-40")})}function aF({tool:e,toolUp:t,thinkingSince:n,thinkingTitle:a,micOpen:s,getMicSpectrum:i}){let[l,o]=(0,w.useState)(e);(0,w.useEffect)(()=>{e&&o(e)},[e]);let{thought:u,title:c}=function(e,t){let[n,r]=(0,w.useState)(null!==e),[a,s]=(0,w.useState)(t);return(0,w.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)(aB,{live:e,getMicSpectrum:i});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:[l&&(0,r.jsx)(aQ,{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)(az,{tool:l})]})}),u&&(0,r.jsx)(aQ,{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)(a7,{title:c})]})}),(0,r.jsx)(aQ,{at:"col-start-1 row-start-1",shown:p,children:(0,r.jsx)(aP,{live:p,getMicSpectrum:i})})]})})}let aU=[1,.7,.45],aK=e=>e.id??`${e.kind??"tool"}:${e.name}`,aH={turns:{},owner:{},seen:{}};function aW({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,k.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:aU[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)(az,{tool:t})})},aK(t))})})}let aG={text:"CALL",hold:1/0},aY="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 aV({ringing:e,wakePhrase:t,onAnswer:n,onDecline:a}){let s=(0,W.useServerRoute)(y.queryKey.bot).data,i=(e,t)=>{let n=s?.find(t=>t.name===e.bot)?.icon;return(0,r.jsx)(L.BotMark,{size:t,seed:e.bot,color:n?.color,shape:n?.shape,outline:n?.outline,paint:n?.paint,notify:!1,className:"shrink-0"})},{first:l,others:o,missedAt:u}=e,[c,d]=(0,P.useAnswerThread)(),[h,p]=(0,w.useState)(null);if(null!==u){let e=[l,...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)(m,{className:"size-3"}),(0,r.jsxs)("span",{children:["Missed · ",(0,r.jsx)(aJ,{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:aY,children:"Esc"}),"clear"]})]}),e.slice(0,3).map(e=>(0,r.jsxs)("div",{className:"flex h-8.5 items-center gap-2.5",children:[i(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:aZ[e.kind]}),(0,r.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:(0,k.plainText)(e.text)})]},e.id)),e.length>3&&(0,r.jsxs)("p",{className:"mt-1 font-mono text-[10.5px] text-muted-foreground",children:["+",e.length-3," more in the room"]})]}),(0,r.jsx)(b.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",children:["or say ",(0,r.jsx)(aX,{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:[i(l,18),(0,r.jsx)("span",{children:l.bot}),(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,r.jsx)("span",{className:"truncate text-muted-foreground",children:l.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,k.plainText)(l.text)}),l.options.length>0&&(0,r.jsx)("span",{className:"flex max-w-full flex-wrap justify-center gap-1.5",children:l.options.map(e=>(0,r.jsx)(b.Button,{size:"sm",variant:"secondary",loading:h===e,disabled:d,onClick:async()=>{p(e),await c(l,e,l.bot,l.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)(b.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:[i(e,16),(0,r.jsx)("span",{className:"max-w-44 truncate text-foreground",children:e.label}),aZ[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",children:[t&&(0,r.jsxs)("span",{className:"flex items-center gap-1.5",children:["say ",(0,r.jsx)(aX,{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:aY,children:"Esc"}),"not now"]})]})]})}function aJ({at:e}){let[t,n]=(0,w.useState)(()=>Date.now());return(0,w.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),3e4);return()=>clearInterval(e)},[]),t-e<6e4?"just now":(0,a.formatDistanceStrict)(e,t,{addSuffix:!0})}function aX({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)(c.Mic,{className:"size-3"}),e]})}let aZ={question:"asks",done:"finished",stopped:"stopped"};function aQ({at:e,shown:t,children:n}){return(0,r.jsx)("span",{"aria-hidden":!t,className:(0,k.cn)("flex transition-opacity duration-300 ease-out",e,t?"opacity-100":"pointer-events-none opacity-0"),children:n})}let a0={quiet:`${A.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 a1({status:e,idleLeft:t,since:n,ended:a,behind:s,wakePhrase:i,hotkeyLabel:l}){let o,u,c="connecting"===e||"ending"===e,d="idle"!==e&&!c;return c?(u=e,o=(0,r.jsx)(T.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:aY,children:"↓"}),(0,r.jsx)("span",{children:"back to now"})]}):(0,r.jsx)(a9,{since:n}),(0,r.jsx)(a2,{})]})):a?(u=`ended:${a}`,o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("span",{children:["Ended — ",a0[a]]}),(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,r.jsx)("span",{children:"Tap to call again"})]})):i?(u=`wake:${i}`,o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N.Letters,{text:"Tap Thursday, or say"}),(0,r.jsx)(a3,{at:500,children:(0,r.jsx)(aX,{phrase:i})}),(0,r.jsx)(a3,{at:a5,children:(0,r.jsx)(a4,{})})]})):l?(u=`key:${l}`,o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N.Letters,{text:"Tap Thursday, or press"}),(0,r.jsx)(a3,{at:550,children:(0,r.jsx)("kbd",{className:aY,children:l})}),(0,r.jsx)(a3,{at:a5,children:(0,r.jsx)(a4,{})})]})):(u="tap",o=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(N.Letters,{text:"Tap Thursday to talk"}),(0,r.jsx)(a3,{at:a5,children:(0,r.jsx)(a4,{})})]})),(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)}function a2(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,r.jsx)("button",{type:"button",onClick:()=>G.writeLine.draw(),className:"rounded-md outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:"Draw"})]})}let a5=900;function a3({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 a4(){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",children:"@ to write"})]})}function a6({open:e,onOpen:t,onClose:n}){let{data:a}=(0,W.useServerRoute)(y.queryKey.automaticModel),{data:s}=(0,W.useServerRoute)(y.queryKey.config),i=C.LIVE_LINES.find(e=>(0,e4.isConfigUnreadable)(s,_.TEXT_MODEL_PROVIDERS[e].apiKeyName)),l=(0,e3.useVoiceLine)(),o=l.signedIn&&!l.planCalls;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:"Give her a voice"}),(0,r.jsx)(b.Button,{type:"button",size:"icon",variant:"ghost","aria-label":"Not now",onClick:n,className:"-my-1 size-6",children:(0,r.jsx)(g.X,{className:"size-3.5"})})]}),(0,r.jsx)(e3.CallLines,{})]}):(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)(L.BotMark,{size:24,seed:R.DEFAULT_BOT.name,color:R.DEFAULT_BOT.icon?.color,shape:R.DEFAULT_BOT.icon?.shape,outline:R.DEFAULT_BOT.icon?.outline,notify:!1}),(0,r.jsx)(h,{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:"chatgpt"===i?"The ChatGPT sign-in saved for calls can't be unlocked any more — sign in again.":i?"The key saved for calls can't be unlocked any more — add it again.":o?`Your ${(0,_.planName)(l.plan)?`${(0,_.planName)(l.plan)} `:""}ChatGPT plan has no spoken calls — add an OpenAI key. Bots and writing already run on it.`:a&&!a.ref?"Sign in with ChatGPT and calls and bots run on your plan, or add a key.":"Calls need a GPT Subscription or an OpenAI key. Everything else here already works."}),(0,r.jsx)(b.Button,{size:"sm",variant:"brand",onClick:t,className:"h-7 px-3.5",children:"Set up"})]})}function a7({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)(T.ShinyText,{text:t,className:"min-w-0 animate-in truncate fade-in duration-300"},t)})}function a9({since:e}){let[t,n]=(0,w.useState)(()=>Date.now());if((0,w.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"),i=String(a%60).padStart(2,"0");return(0,r.jsxs)("span",{className:"tabular-nums",children:[s,":",i]})}e.s(["Thursday",0,function({ready:t}){let n=function(){let[e,t]=(0,w.useState)(null),n=(0,w.useRef)(e);n.current=e;let r=(0,w.useRef)(new Set),[a]=(0,nA.useServerAction)(nP),s=(0,w.useRef)(null),i=(0,w.useRef)([]),[l,o]=(0,w.useState)([]),u=(0,w.useCallback)(e=>{i.current=e,o(e)},[]),c=(0,w.useRef)(new Map),d=(0,w.useRef)(0),[h,p]=(0,w.useState)(null),m=(0,w.useRef)(()=>{}),f=(0,w.useRef)(!1),[g,x]=(0,w.useState)(null),{messages:b,sendMessage:v,setMessages:j,status:S,stop:N,error:T,clearError:E}=(0,nk.useChat)({transport:nX,onFinish:e=>m.current(e),onData:e=>{if(e.type===`data-${ny.TEXT_CALL_REFUSED}`)return x(e.data.provider);e.type!==`data-${ny.TEXT_CALL_MOVED}`||f.current||(f.current=!0,nS.toast.add({type:"warning",title:"Answering on your OpenAI key",description:e.data.why}))}}),M="submitted"===S||"streaming"===S,C=(0,w.useRef)(b);C.current=b;let _=(0,w.useRef)(T);_.current=T;let R=(0,w.useRef)(""),L=(0,w.useCallback)((e,t=[])=>{let r=n.current;if(!r)return;let a=i.current;u([]);let l=crypto.randomUUID();s.current=l,x(null);let o=nZ();R.current=JSON.stringify(o??null);let c=[...a.map(nQ),...e?[{type:"text",text:e}]:[],...t.map(ny.picturePart)];v(c.length?{parts:c}:void 0,{body:{callId:r.callId,standing:r.standing,runsOn:o,turn:l,where:r.where}})},[v,u]),I=(0,w.useCallback)(()=>{let e=n.current;if(e){for(let e of(n.current=null,t(null),s.current=null,c.current.values()))nC.delete(e.key);c.current.clear(),u([]),d.current=0,f.current=!1,p(null),N(),j([]),E(),nB(e.callId).then(nM.unwrapResult).finally(()=>(0,W.revalidate)(y.queryKey.callHistory(null)))}},[N,j,E,u]),O=(0,w.useRef)(I);O.current=I,(0,w.useEffect)(()=>()=>O.current(),[]);let D=(0,w.useCallback)(e=>{u([...i.current,e]);let t=n.current,r=s.current;t&&r&&nz(t.callId,r,e).then(nM.unwrapResult).catch(()=>{})},[u]);(0,w.useEffect)(()=>G.screenActs.subscribe(e=>{n.current&&D({id:crypto.randomUUID(),text:n$(e),said:!1})}),[D]);let $=(0,w.useCallback)(async(e,i=[])=>{let l=i.filter(nE.isPicture),o=n.current;if(!o){let e=nV();n.current=o={...await a(nZ()),at:Date.now(),where:e?.where??null},r.current=n_(z.current??[]),t(o)}if(d.current=0,s.current)return D({id:crypto.randomUUID(),text:e,said:!0,...l.length?{pictures:l}:{}});E(),L(e,l)},[a,D,E,L]),B=(0,w.useCallback)(()=>{let e=C.current,t=e.at(-1);if(n.current&&t){if("assistant"===t.role){let n=R.current!==JSON.stringify(nZ()??null)?-1:t.parts.findLastIndex(e=>(0,nj.isToolUIPart)(e)&&!e.providerExecuted&&("output-available"===e.state||"output-error"===e.state));u([...(0,ny.notesIn)([{...t,parts:t.parts.slice(n+1)}]),...i.current]),j(n<0?e.slice(0,-1):[...e.slice(0,-1),{...t,parts:t.parts.slice(0,n+1)}])}E(),L(null)}},[L,j,E,u]),{data:P}=(0,W.useServerRoute)(y.queryKey.threads),z=(0,w.useRef)(P);z.current=P;let q=(0,w.useCallback)(()=>{if(!n.current||!z.current)return;let e=nD(z.current),t=new Set(e.map(e=>e.key)),a=i.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&&nC.delete(t.key),c.current.delete(e.id)}u(i.current.filter(e=>!a.includes(e)))}for(let t of e){if(nC.has(t.key)||r.current.has(t.key))continue;nC.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),D(e)}if(s.current||_.current||d.current>=A.TEXT_CALL.autoTurns)return;let l=i.current.filter(e=>c.current.has(e.id)),o=l.length?c.current.get(l[l.length-1].id):null;o&&(d.current+=1,p(o.show),L(null))},[u,D,L]),F=null!==e;(0,w.useEffect)(()=>{F&&P&&q()},[F,P,q]),m.current=({message:e,messages:t,isAbort:r,isError:a,isDisconnect:l})=>{if(r||!n.current)return;s.current=null;let o=new Set((0,ny.notesIn)([e]).map(e=>e.id));if(u(i.current.filter(e=>!o.has(e.id))),a||l)return;let d=new Set((0,ny.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(nM.unwrapResult).catch(e=>nS.toast.add({type:"error",title:"Could not record relay delivery",description:(0,k.errorToString)(e)})),i.current.some(e=>e.said))return L(null);q()},(0,w.useEffect)(()=>{if(M||!h)return;let e=setTimeout(()=>p(null),A.CALL_LINE.lingerMs);return()=>clearTimeout(e)},[M,h]);let U=b.at(-1)?.role==="assistant"?b.at(-1):null,K=U?.parts??[],H=K.at(-1),Y=(0,w.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 b){if("system"===e.role)continue;let r=e.role,a=[],s=0,i=()=>{let t=a.join("\n\n").trim();a=[],n(`${e.id}:${s++}`,r,"assistant"===r?(0,k.captionText)(t):t)};for(let r of e.parts){"text"===r.type&&a.push(r.text);let e=(0,ny.noteOf)(r);e&&(i(),e.said?n(e.id,"user",e.text):t=!0)}i()}let r=new Set((0,ny.notesIn)(b).map(e=>e.id));for(let e of l)e.said&&!r.has(e.id)&&n(e.id,"user",e.text);return e},[b,l]),V=[...K].reverse().find(nj.isToolUIPart),J=V?.toolCallId??null,X=V?(0,nj.getToolName)(V):null,Z=V?.state==="output-available"||V?.state==="output-error",Q=V?.output,ee=(0,w.useMemo)(()=>Z&&X===nN.TOOL_NAMES.web_search?(0,nq.searchSourcesOf)(JSON.stringify(Q??null)):[],[Z,X,Q]),et=Q?.action?.query,en=JSON.stringify({..."string"==typeof et?{query:et}:{},...V?.input??{}}),er=X?(0,nq.toolBot)(X,en,z.current,void 0===Q?void 0:JSON.stringify(Q)):null,ea=X?(0,nq.toolLine)(X,en,er):null,es=H?.type==="text",ei=(0,w.useMemo)(()=>J&&X&&(!es||ee.length)?{id:J,name:X,line:ea,bot:er,done:Z,...ee.length?{sources:ee}:{}}:null,[J,X,ea,er,Z,ee,es]),[el,eo]=(0,w.useState)(null),eu=ei?.done&&!ei.sources?ei.id:null;(0,w.useEffect)(()=>{if(!eu)return;let e=setTimeout(()=>eo(eu),A.CALL_LINE.lingerMs);return()=>clearTimeout(e)},[eu]);let ec=ei&&ei.id!==el?ei:h,ed=!!M&&H?.type!=="text"&&(!ei||!!ei.done),[eh,ep]=(0,w.useState)(null);(0,w.useEffect)(()=>{ep(ed?Date.now():null)},[ed]);let em=[...K].reverse().find(e=>"reasoning"===e.type),ef=ed&&em?.type==="reasoning"&&(0,nq.reasoningTitle)(em.text)||null,eg=e?M?H?.type==="text"?"speaking":ei&&!ei.done&&ei.name===nN.TOOL_NAMES.thread_start?"delegating":"working":"listening":"idle";return{on:null!==e,busy:M,status:eg,messages:Y,tool:ec,thinkingSince:eh,thinkingTitle:ef,since:e?.at??null,error:T?T.message:null,refused:T?g:null,say:$,again:B,end:I}}(),{status:a,failed:s,messages:i,tool:l,thinkingSince:o,thinkingTitle:u,ended:c,faceWord:d,idleLeft:h,since:p,call:m,ringing:f,decline:g,getSpectrum:x,getMicSpectrum:b,wakePhrase:v,hotkey:j}=function(t=!1){let n=(0,w.useRef)(null),{data:r}=(0,W.useServerRoute)(y.queryKey.thursdaySettings),a=(0,w.useRef)(null);a.current=(0,e3.useVoiceLine)(r?.runsOn??null).line;let s=(0,w.useRef)(null),i=(0,w.useRef)(null),[l,o]=(0,w.useState)("idle"),[u,c]=(0,w.useState)(!1),d=(0,w.useRef)(null),h=(0,w.useCallback)(e=>{d.current&&clearTimeout(d.current),d.current=e?setTimeout(()=>c(!1),6e3):null,c(e)},[]),[p,m]=(0,w.useState)([]),[f,g]=(0,w.useState)(null),[x,b]=(0,w.useState)(null),[v,j]=(0,w.useState)(null),[S,N]=(0,w.useState)(null),[T,E]=(0,w.useState)(null),[M,_]=(0,w.useState)(null),[R,L]=(0,w.useState)(null),I=nx(),O=I?.moment.kind==="here"&&null!==I.phase;(0,w.useEffect)(()=>{O&&function(e=new Date){let t=rC(e);try{window.localStorage.setItem(rA,t)}catch{r_=t}}()},[O]),(0,w.useEffect)(()=>{let e,t,n;return t=!1,(n=async()=>{if(clearTimeout(e),"visible"!==document.visibilityState||(e=setTimeout(n,A.HERE.keptMs),await nJ(),t||"visible"!==document.visibilityState))return;let r=nF?nF.at+A.HERE.keptMs-A.HERE.lookMs-Date.now():0;clearTimeout(e),e=setTimeout(n,r>0?r:A.HERE.keptMs)})(),document.addEventListener("visibilitychange",n),window.addEventListener("online",n),()=>{t=!0,clearTimeout(e),document.removeEventListener("visibilitychange",n),window.removeEventListener("online",n)}},[]);let $=(0,w.useRef)(null),B=(0,w.useRef)(null),P=(0,w.useRef)({on:!1,spoke:!1,giveUp:null}),z=(0,w.useRef)(null),q=(0,w.useRef)(0),U=(0,w.useRef)(null),H=(0,w.useRef)(!1),Y=(0,w.useRef)(null),V=(0,w.useRef)(null),J=(0,w.useRef)(null),X=(0,w.useRef)(nC),Z=(0,w.useRef)(new Set),Q=(0,w.useRef)(new Set),ee=(0,w.useRef)([]),et=(0,w.useRef)([]),en=(0,w.useRef)(0),er=(0,w.useRef)(null),ea=(0,w.useRef)(0),es=(0,w.useRef)(!1),ei=(0,w.useRef)(!1),el=(0,w.useRef)(void 0),eo=(0,w.useRef)(null),eu=eo.current??=rT(),ec=(0,w.useRef)(null),ed=ec.current??=rT(),eh=(0,w.useRef)(!1),ep=(0,w.useRef)(!1),em=(0,w.useRef)(!1),ef=(0,w.useRef)(0),eg=(0,w.useCallback)(e=>{U.current&&clearTimeout(U.current),H.current=!1;let t=(0,nq.toolBot)(e.name,e.arguments,el.current);g({id:e.id,name:e.name,line:(0,nq.toolLine)(e.name,e.arguments,t),bot:t,done:!1})},[]),ex=(0,w.useCallback)((e,t)=>{let n=(0,nq.toolBot)(e.name,e.arguments,el.current,t);n&&g(t=>t?.id===e.id&&t.bot!==n?{...t,bot:n,line:(0,nq.toolLine)(e.name,e.arguments,n)}:t)},[]),ew=(0,w.useCallback)(e=>{U.current&&clearTimeout(U.current),H.current=!0,g({...e,done:!1})},[]),ey=(0,w.useCallback)(e=>{g(t=>t?.id===e?{...t,done:!0}:t),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>g(e=>e?.done?null:e),A.CALL_LINE.lingerMs)},[]),eb=(0,w.useCallback)(()=>{if(P.current.giveUp&&clearTimeout(P.current.giveUp),P.current.spoke){for(let e of ee.current)Z.current.delete(e);let e=et.current;e.length&&nT(e).then(nM.unwrapResult).catch(e=>nS.toast.add({type:"error",title:"Could not record relay delivery",description:(0,k.errorToString)(e)}))}et.current=[],ee.current=[],P.current={on:!1,spoke:!1,giveUp:null},H.current&&(H.current=!1,g(e=>e?.kind==="relay"?{...e,done:!0}:e),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>g(e=>e?.kind==="relay"?null:e),A.CALL_LINE.relayLingerMs))},[]),ev=(0,w.useCallback)(()=>{P.current.giveUp&&clearTimeout(P.current.giveUp),P.current={on:!0,spoke:!1,giveUp:setTimeout(eb,A.CALL_RELAY.readMs)}},[eb]),ek=(0,w.useCallback)(e=>{$.current=e,E(e),_(null)},[]),ej=(0,w.useCallback)((e,t)=>{let n=()=>{B.current&&clearTimeout(B.current),B.current=null};if(t){n(),null!==$.current&&ek(null);return}if(e){n(),null===$.current&&ek(Date.now());return}null===$.current||B.current||(B.current=setTimeout(()=>{B.current=null,ek(null)},A.CALL_LINE.thinkingTailMs))},[ek]),eS=(0,w.useCallback)(()=>{let e=n.current,t=el.current;if(!e||!t||P.current.on||ei.current||null!==$.current||er.current)return;let r=es.current;if(es.current=!1,!r&&Date.now()-ea.current<A.CALL_RELAY.quietMs)return;let a=nD(t).filter(e=>!X.current.has(e.key)&&!Q.current.has(e.key)),s=a[0];if(!s)return;let i=a.filter(e=>e.kind===s.kind).slice(0,A.CALL_RELAY.perTurn),l=i.map(e=>e.line);for(let e of i)X.current.add(e.key),Z.current.add(e.key);s.key.startsWith("done:")&&!ng.current()&&L((0,rM.finished)()),ev(),ee.current=i.map(e=>e.key),et.current=i.flatMap(e=>e.relayIds),ew((i.at(-1)??s).show),e.append("commentary",1===l.length?l.join(""):`[${l.length} updates.]
|
|
14
|
+
|
|
15
|
+
${l.join("\n\n")}`).then(e=>{e||(et.current=[],eb())})},[ev,eb,ew]),eN=(0,w.useRef)(l);(0,w.useEffect)(()=>{eN.current=l},[l]);let eT=(0,w.useRef)("listening"),eE=(0,w.useRef)(null),eM=(0,w.useCallback)(()=>{eE.current&&clearTimeout(eE.current),eE.current=null},[]),eA=(0,w.useCallback)(e=>{eN.current=e,o(e)},[]),eC=(0,w.useCallback)(e=>{eT.current=e;let t=eN.current;if("speaking"===e){eM(),eA(e);return}let n="working"===e||"delegating"===e;if(n&&("working"===t||"delegating"===t)){eM(),eA(e);return}n||"listening"!==t?eE.current||(eE.current=setTimeout(()=>{eE.current=null,eA(eT.current)},n?800:600)):eM()},[eM,eA]),e_="idle"!==l&&"connecting"!==l&&"ending"!==l,{data:eR}=(0,W.useServerRoute)(y.queryKey.threads,{refreshInterval:A.INBOX_POLL_MS}),eL=(0,w.useRef)(!1);(0,D.useAppEvent)({hello:()=>{if(!eL.current){eL.current=!0;return}(0,W.revalidateAll)()},threads:()=>void(0,W.revalidate)(y.queryKey.threads),routines:()=>void(0,W.revalidate)(y.queryKey.routines),memory:()=>void(0,W.revalidate)(y.queryKey.memory),mcp:()=>{(0,W.revalidate)(y.queryKey.mcp),(0,W.revalidate)(y.queryKey.mcpTools)},config:()=>{(0,W.revalidate)(y.queryKey.config),(0,W.revalidate)(y.queryKey.llmModel)}});let{data:eI}=(0,W.useServerRoute)(y.queryKey.bot);(0,w.useEffect)(()=>{eR&&G.botThreads.sync(eR,eI)},[eR,eI]),(0,w.useEffect)(()=>{el.current=eR},[eR]);let eO=function({threads:e,resting:t,writing:n}){let r=(0,w.useRef)(Date.now()),[a,s]=(0,w.useState)([]),[i,l]=(0,w.useState)(null),o=a.length>0,u=(0,nb.useThursdayStore)(e=>e.callBack),c=(0,G.useRoomThread)(),d=(0,w.useRef)(new Map);(0,w.useEffect)(()=>{let t=c&&e?.find(e=>e.id===c);t&&d.current.set(t.id,(0,K.toDate)(t.updatedAt).getTime())},[c,e]),(0,w.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||c)return;let i=r.current,o=e.filter(e=>a.has(e.id)&&(0,K.toDate)(e.updatedAt).getTime()>Math.max(i,d.current.get(e.id)??0));o.length&&(r.current=Math.max(...o.map(e=>(0,K.toDate)(e.updatedAt).getTime())),l(null),s(e=>[...e,...o.map(e=>e.id).filter(t=>!e.includes(t))]))},[e,u,t,n,c]),(0,w.useEffect)(()=>{n?(s([]),l(null)):r.current=Date.now()},[n]);let h=(0,w.useCallback)(()=>{s([]),l(null)},[]);(0,F.useEscape)(o,h),(0,w.useEffect)(()=>{if(!o||null!==i)return;let e=setTimeout(()=>l(Date.now()),A.CALL_BACK.ringMs);return()=>clearTimeout(e)},[o,i]),(0,w.useEffect)(()=>{if(o&&null===i){let e;return(e=new Audio("/sounds/ring.ogg")).play().catch(()=>{}),()=>e.pause()}},[o,i]);let p=(0,w.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:i}:null},[a,e,i]);(0,w.useEffect)(()=>{G.ringingThreads.set(a)},[a]);let m=(0,w.useCallback)(()=>{s([]),l(null)},[]);return{ringing:p,isRinging:o,ringingFor:a,answered:m,unanswered:(0,w.useCallback)(e=>{e.length&&(s(t=>[...e,...t.filter(t=>!e.includes(t))]),l(Date.now()))},[]),settle:(0,w.useCallback)(()=>{r.current=Date.now()},[]),decline:h}}({threads:eR,resting:"idle"===l,writing:t}),{answered:eD,unanswered:e$,settle:eB}=eO;(0,w.useEffect)(()=>G.screenActs.subscribe(e=>{if(!eh.current)return;let t=n$(e);"gave"===e.kind?ed.send({fact:t,pictures:e.paths.filter(nE.isPicture)}):"showed"===e.kind?ed.send({fact:t,pictures:[e.path],run:!0}):eu.send(t)}),[eu,ed]);let eP=(0,w.useCallback)(async(e=null)=>{if(em.current)return;em.current=!0,er.current&&clearInterval(er.current),er.current=null,ef.current+=1;let t=n.current,r=V.current;for(let e of(n.current=null,V.current=null,eh.current=!1,ep.current=!1,ng.clear(),es.current=!1,Z.current))X.current.delete(e);Z.current.clear(),eu.close(),eu.clear(),ed.close(),ed.clear(),Y.current?.abort(),Y.current=null,P.current.spoke=!1,eb(),U.current&&clearTimeout(U.current),eM(),eB(),j(null),b(null),o(t?"ending":"idle"),t&&L((0,rM.goodbye)()),m([]),g(null),ek(null),B.current&&clearTimeout(B.current),B.current=null,H.current=!1,await t?.close(),J.current?.(),J.current=null;let a=z.current;z.current=null,em.current=!1,o("idle"),t&&N(e),r&&nB(r,a),t&&i.current&&(i.current.currentTime=0,i.current.play().catch(()=>{}))},[eu,ed,eM,eb,ek]);(0,w.useEffect)(()=>{let e=()=>{let e=V.current;e&&navigator.sendBeacon(y.queryKey.callEnd,e)};return window.addEventListener("pagehide",e),()=>window.removeEventListener("pagehide",e)},[]),(0,w.useEffect)(()=>()=>{ef.current+=1,J.current?.(),J.current=null,n.current?.close(),n.current=null;let e=V.current;for(let t of(V.current=null,eh.current=!1,ep.current=!1,e&&nB(e),Z.current))X.current.delete(t);Z.current.clear(),Y.current?.abort(),Y.current=null,U.current&&clearTimeout(U.current),eE.current&&clearTimeout(eE.current),P.current.giveUp&&clearTimeout(P.current.giveUp),B.current&&clearTimeout(B.current),d.current&&clearTimeout(d.current),er.current&&clearInterval(er.current),ng.clear()},[]);let ez=(0,w.useCallback)(()=>{if(er.current)return;let e=Date.now();er.current=setInterval(()=>{let t=Date.now();((en.current>e-A.CALL_END.unsaidMs?t-Math.max(en.current,e)>=A.CALL_END.quietMs:t-e>=A.CALL_END.unsaidMs)||t-e>=A.CALL_END.maxMs)&&eP("hungUp")},100)},[eP]);(0,w.useEffect)(()=>{if(!e_)return;q.current=Date.now();let e=setInterval(()=>{if(!n.current)return;let e=A.CALL_IDLE.hangUpMs-(Date.now()-q.current);j(e<=A.CALL_IDLE.warnMs?Math.max(0,Math.ceil(e/1e3)):null),e<=0&&!P.current.on&&eP("quiet")},1e3);return()=>clearInterval(e)},[e_,eP]),(0,w.useEffect)(()=>{if(!e_)return;let e=setInterval(eS,1e3);return()=>clearInterval(e)},[e_,eS]);let eq=(0,w.useCallback)(async()=>{let t,r,u=eO.isRinging,c=eO.ringingFor;if(ep.current||em.current)return;if(eh.current||"idle"!==l)return eP();eD(),(0,n1.askToNotify)(),o("connecting"),N(null),h(!1),ep.current=!0,eh.current=!0,z.current=null,eu.clear(),ed.clear(),ef.current+=1;let d=ef.current,p=()=>eh.current&&ef.current===d,f={server:!1},x=a.current,w=(t=performance.now(),r={},{at(e){let n=performance.now();r[e]=n-t,performance.measure(`call ${e}`,{start:t,end:n})},say(){let e=Object.entries(rP).flatMap(([e,t])=>{let n=r[e];return void 0===n?[]:[`${t} at ${Math.round(n)} ms`]});console.debug(`The call opened: ${e.join(", ")}.`)}});try{s.current??=(0,rN.createAudioTap)(),function(e){if("suspended"!==e.state||rU)return;rU=!0;let t=()=>{rU=!1,window.removeEventListener("pointerdown",t),window.removeEventListener("keydown",t),e.resume().catch(()=>{})};window.addEventListener("pointerdown",t),window.addEventListener("keydown",t),nS.toast.add({type:"warning",title:"Tap anywhere to hear her",description:"This call opened on its own, so the browser is holding the audio."})}(s.current.open().context);let t=new Audio("/sounds/start_voice.ogg");i.current??=new Audio("/sounds/end_voice.ogg");let r=nV(),a=r?.where.weather,l=a&&!u&&function(e=new Date){let t=rC(e);if(r_===t)return!1;try{return window.localStorage.getItem(rA)!==t}catch{return!0}}()&&"visible"===document.visibilityState&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches?Promise.race([Promise.all([(0,rR.loadWorld)(),e.A(5735)]).then(()=>!0,e=>(console.warn(`No globe on this call: ${(0,k.errorToString)(e)}`),!1)),new Promise(e=>setTimeout(()=>e(!1),A.HERE.waitMs))]):null,o=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(!o)throw new rq("A call is already on in another tab of this app. Hang up there, or go on there.");J.current=o;let c=new AbortController;Y.current=c;let d={failures:0},y={failures:0},v={callId:"",opening:null,here:null,standing:null,opened:{webSearch:C.LIVE_DEFAULTS.webSearch,readSkills:C.LIVE_DEFAULTS.readSkills}},j=new Map,S=new Map,N=null,T=e=>{let t={query:e.query,sources:e.sources};return rH(d,()=>rB(v.callId,[{id:e.row,role:"tool",tool:nN.TOOL_NAMES.web_search,text:JSON.stringify(t),seq:Math.max(0,Math.round(e.seq)),fragments:null}])),!!e.sources.length&&N===e.id&&(U.current&&clearTimeout(U.current),g(n=>n&&n.id!==e.id?n:{id:e.id,name:nN.TOOL_NAMES.web_search,line:(0,nq.toolLine)(nN.TOOL_NAMES.web_search,JSON.stringify(t)),done:!0,bot:null,sources:e.sources}),!0)},E=await rk({initialize:async e=>{w.at("offer");let t=!!(l&&await l&&"visible"===document.visibilityState);l&&w.at("globe"),f.server=!0;let n=(0,nM.unwrapResult)(await rD(e,u,r?.where??null,t));if(w.at("answer"),!p())throw nB(n.callId),Error("The call closed during startup.");return V.current=n.callId,v.callId=n.callId,v.opening=n.opening,v.here=n.here&&r&&a?{...r.position,code:r.country,weather:a}:null,v.standing=n.standing,v.opened=n.opened,n.relay?{sdp:n.sdp,relay:n.relay}:n.sdp},audio:s.current,on:{runTool:async e=>{if(e.name===nN.TOOL_NAMES.end_call)return ez(),"Ending the call.";if(e.name===nN.TOOL_NAMES.emote){if(ng.current())return"Nothing was shown: their screen is showing where they are for a few seconds more.";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>rE.FACE_WORD_MAX)return{word:null,reply:`Too long: ${n} characters, ${rE.FACE_WORD_MAX} at most. Nothing was shown.`};let r=(0,rE.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&&L({text:t,at:Date.now()}),n}eg(e);let t=e.name===nN.TOOL_NAMES.web_search;t&&(N=e.id);let n=!1;try{let r=await n0(v.callId,e,v.opened,c.signal);ex(e,r);let a=e.name===nN.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&&eu.send((({bot:e,label:t})=>`${e} took "${t}" and is working on it now.`)(a)),t&&(n=T({id:e.id,row:e.item??e.id,query:(0,nq.searchQueryOf)(e.arguments),sources:(0,nq.searchSourcesOf)(r),seq:0})),r}finally{n||ey(e.id)}},search:e=>{if(!e.done){N=e.id,eg({id:e.id,name:nN.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};S.set(e.responseId,t),T(t)||ey(t.id)},cited:(e,t)=>{let n=S.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))],T(n)},reasoning:e=>{let t=(0,nq.reasoningTitle)(e.text);t&&_(t),rH(y,()=>r$(v.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?"":rK(e.text),n=!!t&&t!==rK(j.get(e.id)?.text??"");if(n&&(ea.current=Date.now()),n&&"user"===e.role&&(q.current=Date.now(),N)){let e=N;N=null,g(t=>t?.id===e?null:t)}"tool"!==e.role&&V.current===v.callId&&(j.set(e.id,{seq:e.seq,id:e.id,role:e.role,text:e.text}),m([...j.values()].sort((e,t)=>e.seq-t.seq).slice(-A.CALL_PAGE.scrollback))),e.done&&rH(d,()=>rB(v.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;eC((t=e).speaking?"speaking":t.working||t.tools.length?t.tools.includes(nN.TOOL_NAMES.thread_start)?"delegating":"working":"listening");let n=e.working||e.tools.length>0;ei.current=n,ej(n,e.speaking),e.speaking&&(en.current=Date.now()),(e.speaking&&!P.current.on||e.working||e.tools.length)&&(q.current=Date.now()),P.current.on&&(e.speaking?P.current.spoke=!0:P.current.spoke&&eb())},finalized:e=>{z.current=e},warn:e=>nS.toast.add({type:"warning",title:"Call warning",description:e}),failed:e=>{let t=z.current?.reason;if("expired"===t||"remote_hangup"===t)return void eP("expired"===t?"expired":"closed");if("content"===t){nS.toast.add({type:"warning",title:"Live ended the call",description:"Its safety filter stopped the conversation."}),eP("closed");return}nS.toast.add({type:"error",title:rz(x,!1),description:e}),h(!0),eP(z.current?"closed":"dropped")}}});if(!p())return void await E.close();w.at("line"),w.say(),n.current=E,ep.current=!1,es.current=u,Q.current=u?new Set:n_(el.current??[]);let M=e=>void E.append("thinking",e);eu.open(M),ed.open(e=>void rO(E,e,rI,M).catch(e=>nS.toast.add({type:"error",title:"What you put down did not reach the backend",description:(0,k.errorToString)(e)}))),ea.current=Date.now(),v.here&&ng.show({kind:"here",scene:v.here}),v.opening&&(ev(),E.holdInput(A.LIVE_CALL.openingHoldMs),E.append("instructions",v.opening).then(e=>{e||eb()})),v.standing&&E.brief(v.standing),eA("listening"),b(Date.now()),t.play().catch(()=>{})}catch(e){if(J.current?.(),J.current=null,p()&&e instanceof rq)nS.toast.add({type:"warning",title:"One call at a time",description:e.message});else if(p()){let t;nS.toast.add({type:"error",description:("refused"===(t=(0,rL.micProblem)(e))?"This page is not allowed the microphone. The icon at the left of the address bar opens the site's settings: set Microphone to Allow, then call her again.":"missing"===t?"No microphone was found. Plug one in or switch it on, then call her again.":"busy"===t?"The microphone would not start. Another app may be using it: close that app, then call her again.":null)??(0,k.errorToString)(e),title:f.server?rz(x,!0):"Could not start the call"}),h(!0),u&&e$(c)}if(ef.current!==d)return;V.current&&nB(V.current),V.current=null,ep.current=!1,eh.current=!1,Y.current=null,eu.clear(),ed.clear(),o("idle")}},[l,eP,eg,ex,ey,eC,eA,eu,ed,ev,eb,ej,h,ez,eO.isRinging,eO.ringingFor,eD,e$]);(0,w.useEffect)(()=>{if(!S)return;let e=setTimeout(()=>N(null),A.CALL_ENDED_MS);return()=>clearTimeout(e)},[S]);let eF=(0,w.useCallback)(()=>s.current?.read()??rF,[]),eU=(0,w.useCallback)(()=>s.current?.readMic()??rF,[]),eK=(0,nb.useThursdayStore)(e=>e.wake),[eH,eW]=(0,w.useState)(!1);(0,w.useEffect)(()=>eW(!1),[eK.enabled,eK.phrase]);let eG=(0,nc.useCallHeld)();(0,w.useEffect)(()=>nc.callSignal.onPlace(()=>void eq()),[eq]),function({enabled:e,onWake:t,phrases:n,onError:r}){let a=(0,w.useRef)({onWake:t,onError:r,phrases:n});a.current={onWake:t,onError:r,phrases:n},(0,w.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,i=!0,l=null,o=300;r.lang="en-US",r.continuous=!0,r.interimResults=!0,r.maxAlternatives=3;let u=()=>{if(s){i=!0;try{r.start()}catch{}}};return r.onresult=({resultIndex:e,results:t})=>{if(!s||!i)return;o=300;let{phrases:n,onWake:l}=a.current,u=n.map(n5).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=n5(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 i=r[a],l=Math.max(1,Math.round(i.length*s));return!!(n3(t[n],i,l)&&e(t,n+1,r,a+1,s))||n+1<t.length&&n3(t[n]+t[n+1],i,l)&&e(t,n+2,r,a+1,s)}(e,r,t,0,n))return!0;return!1})(a,e,A.WAKE_TOLERANCE))){i=!1,r.abort(),l(n.trim());return}}}},r.onerror=({error:e})=>{let t=n2[e];t?(s=!1,a.current.onError?.(t)):"network"===e&&(o=Math.min(2*o,1e4))},r.onend=()=>{s&&(l=setTimeout(u,o))},u(),()=>{s=!1,l&&clearTimeout(l),r.onresult=null,r.onerror=null,r.onend=null,r.abort()}},[e])}({enabled:"idle"===l&&eK.enabled&&!eH&&!eG,phrases:[eK.phrase],onWake:()=>void eq(),onError:e=>{eW(!0),nS.toast.add({type:"error",title:"Wake word off",description:e})}});let eY=(0,nb.useThursdayStore)(e=>e.hotkey),eV="connecting"===l||"ending"===l;return(0,F.useHotkey)({enabled:eY.enabled&&!eV&&!eG,combo:eY.enabled&&(0,F.isCombo)(eY.combo)?eY.combo:null,onPress:()=>void eq()}),{status:l,failed:u,messages:p,tool:f,ended:S,thinkingSince:T,thinkingTitle:M,faceWord:R,idleLeft:v,since:x,call:eq,ringing:eO.ringing,decline:eO.decline,getSpectrum:eF,getMicSpectrum:eU,wakePhrase:eK.enabled&&!eH?eK.phrase:null,hotkey:eY.enabled&&(0,F.isCombo)(eY.combo)?eY.combo:null}}(n.on),S=(0,F.useHotkeyLabel)(j),N=(0,nb.useThursdayStore)(e=>e.captionView),{data:T}=(0,W.useServerRoute)(y.queryKey.config),E=(0,e3.useVoiceLine)(),M=E.known?null!==E.line:t,R="idle"!==a,L=n.end;(0,w.useEffect)(()=>{R&&n.on&&L()},[R,n.on,L]);let I=n.on&&!R,O=(0,nb.useThursdayStore)(e=>e.textModel),{settings:$}=(0,nv.useLiveSettings)(),B=$?.backendModel??C.LIVE_DEFAULTS.backendModel,P=(0,w.useMemo)(()=>{let e=e=>(0,e4.isConfigSet)(T,e),t=(0,ny.textCallRunsOn)(e),r=O&&e(_.TEXT_MODEL_PROVIDERS[O.provider].apiKeyName)?O:t?{provider:t,model:B}:null;return{on:I,busy:n.busy,error:n.error,refused:n.refused,say:n.say,again:n.again,end:n.end,runsOn:r,fallback:r?.provider!=="openai"&&e(_.TEXT_MODEL_PROVIDERS.openai.apiKeyName)?{provider:"openai",model:B}:null}},[I,n.busy,n.error,n.refused,n.say,n.again,n.end,T,O,B]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(r6,{live:"idle"!==a,ringing:null!==f}),(0,r.jsx)(aM,{status:I?n.status:a,failed:I?null!==n.error:s,messages:I?n.messages:i,tool:I?n.tool:l,thinkingSince:I?n.thinkingSince:o,thinkingTitle:I?n.thinkingTitle:u,ended:c,faceWord:d,onTap:m,ringing:M?f:null,onDecline:g,wakePhrase:v,hotkeyLabel:S,idleLeft:h,since:p,getSpectrum:I?nw.silentVoice:x,getMicSpectrum:b,captionView:N,callable:M,written:R?null:P})]})}],692888)},456539,638292,129387,231586,745747,234916,895499,114923,838098,991268,772581,435135,e=>{"use strict";var t=e.i(456420);let n={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};n.node;let r=(0,t.default)(n);e.s(["ChevronUp",0,r],456539);let a={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"}]]};a.node;let s=(0,t.default)(a);e.s(["Mic",0,s],638292);var i=e.i(843476),l=e.i(271645);let o=new Intl.Segmenter(void 0,{granularity:"grapheme"});function u({text:e,wraps:t=[]}){let n=(0,l.useMemo)(()=>Array.from(o.segment(e),e=>e.segment),[e]),r=(0,l.useRef)([]),a=0;for(;a<n.length&&n[a]===r.current[a];)a++;(0,l.useEffect)(()=>{r.current=n},[n]);let s=e=>(0,i.jsx)(c,{wait:25*Math.max(0,e-a),children:n[e]},`${n[e]}${e}`),d=[];for(let e=0;e<n.length;){let r=t.find(t=>t.from===e&&t.to>e);if(!r){d.push(s(e)),e+=1;continue}let a=Math.min(r.to,n.length),o=[];for(let t=e;t<a;t++)o.push(s(t));d.push((0,i.jsx)(l.Fragment,{children:r.render(o)},`wrap${e}`)),e=a}return(0,i.jsx)("span",{children:d})}function c({wait:e,children:t}){let[n]=(0,l.useState)(e);return(0,i.jsx)("span",{style:{animationDelay:`${n}ms`},className:"animate-letter motion-reduce:animate-none",children:t})}e.s(["Letters",0,u],129387);var d=e.i(41533);let h={wave:740,done:740,ask:820,took:740,give:900,take:520,stop:1150,read:560},p={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"}},m={key:0,body:"",shape:"animate-crew-breath",turn:"",delayMs:0};function f(){let[e,t]=(0,l.useState)(!0);return(0,l.useEffect)(()=>{let e=setTimeout(()=>t(!1),d.CREW_REST.awakeMs),n=()=>{"visible"===document.visibilityState&&(clearTimeout(e),t(!0),e=setTimeout(()=>t(!1),d.CREW_REST.awakeMs))};return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{clearTimeout(e),window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[]),e}e.s(["motionOf",0,function(e,t){if(!e)return{...m,delayMs:-370*t};let n=p[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}},"useCrewAwake",0,f,"useCrewGestures",0,function(){let[e,t]=(0,l.useState)(new Map),n=(0,l.useRef)(new Map),r=(0,l.useRef)(0);return(0,l.useEffect)(()=>{let e=n.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear()}},[]),[e,(0,l.useCallback)(e=>{e.length&&t(a=>{let s=new Map(a);for(let{bot:a,gesture:i}of e){r.current+=1,s.set(a,{gesture:i,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})},h[i]+1400*("wave"===i)))}return s})},[])]}],231586);let g=!1,x=new Set,w=new Set;e.s(["callSignal",0,{hold(e){if(e!==g)for(let t of(g=e,x))t()},place(){for(let e of w)e()},onPlace:e=>(w.add(e),()=>{w.delete(e)})},"useCallHeld",0,function(){return(0,l.useSyncExternalStore)(e=>(x.add(e),()=>x.delete(e)),()=>g,()=>!1)}],745747);var y=e.i(218080);e.s(["silentVoice",0,function(){let e=performance.now()/1e3;return Array.from({length:y.SPECTRUM_BANDS},(t,n)=>.18+.16*Math.sin(e*(5+.9*n)+1.7*n)**2)}],234916);var b=e.i(263676),v=e.i(511769),k=e.i(798120),j=e.i(167881),S=e.i(6799),N=e.i(630193),T=e.i(451888),E=e.i(807038),M=e.i(635963),A=e.i(978411),C=e.i(83928),_=e.i(616172),R=e.i(245629),L=e.i(393080),I=e.i(283653),O=e.i(647163),D=e.i(621285);let $={2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"},B="thursday.corner-dismissed";function P(){try{let e=JSON.parse(window.localStorage.getItem(B)??"[]");return Array.isArray(e)?e:[]}catch{return[]}}function z(e){try{let t=[...e,...P().filter(t=>!e.includes(t))].slice(0,50);window.localStorage.setItem(B,JSON.stringify(t))}catch{}}function q(e){return{threadId:e.id,label:e.label,bot:e.bot.name,words:(0,O.plainText)(e.outcome??"").slice(0,d.FINISHED_NOTICE.words),paths:(0,_.leadFirst)((0,_.pathsIn)(e.outcome??"")),unchecked:!0}}function F({row:e,children:t}){let n=e.unchecked&&e.paths.length>0,{data:r}=(0,I.useServerRoute)(n?k.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,_.leadFirst)(e.paths.filter(e=>a.has(e)))})}function U({talking:e}){let[t,n]=(0,l.useState)([]),[r,a]=(0,l.useState)(!1);(0,l.useEffect)(()=>{e||a(!1)},[e]);let{data:s}=(0,I.useServerRoute)(k.queryKey.bot),o=(0,A.useBotThreads)(),u=(0,D.useOpenFile)();(0,l.useEffect)(()=>A.fileOpens.subscribe(e=>{u(e)}),[u]),(0,v.useAppEvent)({showFile:e=>u(e.paths[0],e.paths.filter(e=>"image"===(0,_.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),n(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,d.FINISHED_NOTICE.rows))}});let c=(0,l.useRef)(new Set);(0,l.useEffect)(()=>{if(!A.botThreads.primed())return;for(let e of o)("done"===e.status||"cancelled"===e.status)&&c.current.add(e.id);let e=new Set(P()),t=o.filter(t=>(0,T.isUnread)(t)&&!e.has(t.id)).sort((e,t)=>(0,R.toDate)(t.updatedAt).getTime()-(0,R.toDate)(e.updatedAt).getTime()),r=new Set(t.map(e=>e.id));n(e=>{let n=e.filter(e=>!c.current.has(e.threadId)||r.has(e.threadId)),a=[...t.filter(e=>!n.some(t=>t.threadId===e.id)).map(q),...n].slice(0,d.FINISHED_NOTICE.rows);return a.length===e.length&&a.every((t,n)=>t.threadId===e[n].threadId)?e:a})},[o]);let h=e=>{z([e]),n(t=>t.filter(t=>t.threadId!==e))};if(!t.length)return null;let p=t.slice(0,d.FINISHED_NOTICE.shown),m=t.slice(d.FINISHED_NOTICE.shown),f=e&&m.length>0&&!r,g=e=>{z(e),n(t=>t.filter(t=>!e.includes(t.threadId))),(0,N.markSeenAction)(e).then(L.unwrapResult).then(()=>(0,I.revalidate)(k.queryKey.threads)).catch(t=>S.toast.add({type:"error",title:e.length>1?"Could not mark the threads as read":"Could not mark the thread as read",description:(0,O.errorToString)(t)}))};return(0,i.jsx)("div",{className:"pointer-events-none relative col-start-1 row-start-2 w-82 max-w-full",children:(0,i.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:[p.map(e=>(0,i.jsx)(F,{row:e,children:e=>(0,i.jsx)(W,{row:e,bot:s?.find(t=>t.name===e.bot),onOpen:t=>{t?(u(t,e.paths.filter(e=>"image"===(0,_.viewKindOf)(e)),!1,e.threadId),g([e.threadId])):(A.roomOpens.open(e.threadId),h(e.threadId))},onClose:()=>h(e.threadId)})},e.threadId)),f&&(0,i.jsx)(K,{rows:m,bots:s,onOpen:()=>a(!0)}),(f?[]:m).map(e=>(0,i.jsx)(F,{row:e,children:e=>(0,i.jsx)(H,{row:e,bot:s?.find(t=>t.name===e.bot),onOpen:()=>{A.roomOpens.open(e.threadId),h(e.threadId)},onClose:()=>h(e.threadId)})},e.threadId)),t.length>1&&!f&&(0,i.jsxs)("p",{className:"flex shrink-0 items-center gap-2 px-1.5 font-mono text-[10px] text-muted-foreground",children:[(0,i.jsxs)("span",{children:[t.length," new"]}),(0,i.jsx)("span",{className:"flex-1"}),(0,i.jsx)("button",{type:"button",onClick:()=>g(t.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 K({rows:e,bots:t,onOpen:n}){let a=[...new Set(e.map(e=>e.bot))].slice(0,3);return(0,i.jsxs)("button",{type:"button",onClick:n,className:"flex shrink-0 animate-in items-center gap-2 rounded-2xl bg-background py-1.5 pr-2.5 pl-2.5 text-left shadow-black/8 shadow-md ring-1 ring-border outline-none fade-in duration-300 hover:bg-muted/40 focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,i.jsx)("span",{className:"flex shrink-0",children:a.map((e,n)=>{let r=t?.find(t=>t.name===e);return(0,i.jsx)(M.BotMark,{size:18,seed:e,color:r?.icon?.color,shape:r?.icon?.shape,outline:r?.icon?.outline,paint:r?.icon?.paint,notify:!1,resting:!0,className:(0,O.cn)("shrink-0",n>0&&"-ml-1.5")},e)})}),(0,i.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] leading-5",children:[e.length," more finished"]}),(0,i.jsx)(r,{className:"size-3.5 shrink-0 text-muted-foreground"})]})}function H({row:e,bot:t,onOpen:n,onClose:r}){let a=e.paths.length-3,s=f();return(0,i.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,i.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,i.jsx)(M.BotMark,{size:18,seed:e.bot,color:t?.icon?.color,shape:t?.icon?.shape,outline:t?.icon?.outline,paint:t?.icon?.paint,notify:!1,resting:!s,className:"shrink-0"}),(0,i.jsx)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] leading-5",children:e.label}),e.paths.length>0&&(0,i.jsxs)("span",{className:"flex shrink-0 items-center gap-1",children:[e.paths.slice(0,3).map(e=>(0,i.jsx)(C.FileThumb,{path:e,glyph:"size-2.5",className:"size-5 rounded-[6px] ring-1 ring-border"},e)),a>0&&(0,i.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",a]})]})]}),(0,i.jsx)(j.Button,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:r,className:"shrink-0 text-muted-foreground",children:(0,i.jsx)(b.X,{})})]})}function W({row:e,bot:t,onOpen:n,onClose:r}){let a,s=(a=e.paths.length)<=2?2:3===a?3:4,l=e.paths.slice(0,s),o=e.paths.length-l.length,u=f();return(0,i.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,i.jsx)(M.BotMark,{size:32,seed:e.bot,color:t?.icon?.color,shape:t?.icon?.shape,outline:t?.icon?.outline,paint:t?.icon?.paint,notify:!1,resting:!u,className:"shrink-0"}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[(0,i.jsxs)("div",{className:"flex items-start gap-1",children:[(0,i.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,i.jsxs)("span",{className:"flex min-h-8 flex-col justify-center",children:[(0,i.jsx)("span",{className:"truncate font-medium text-[14px] leading-5 tracking-[-0.15px]",children:e.label}),(0,i.jsx)("span",{className:"truncate font-mono text-[10px] leading-[13px] text-muted-foreground",children:e.bot})]}),e.words&&(0,i.jsx)("span",{className:"line-clamp-2 break-keep wrap-anywhere text-[12.5px] leading-normal text-muted-foreground",children:(0,E.shortenPaths)(e.words)})]}),(0,i.jsx)(j.Button,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:r,className:"shrink-0 text-muted-foreground",children:(0,i.jsx)(b.X,{})})]}),l.length>0&&(0,i.jsx)("div",{className:(0,O.cn)("grid gap-1.5 pt-0.5",$[s]),children:l.map((e,t)=>(0,i.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,i.jsx)(C.FileThumb,{path:e,glyph:2===s?"size-6":"size-4",className:"aspect-square w-full rounded-[10px] ring-1 ring-border"}),o>0&&t===l.length-1&&(0,i.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,function({talking:e=!1}){return(0,i.jsx)(D.FileViewer,{children:(0,i.jsx)(U,{talking:e})})},"FinishedCard",0,W,"askToNotify",0,function(){"u"<typeof Notification||"default"===Notification.permission&&Notification.requestPermission().catch(()=>void 0)}],895499);let G=["NIGHT","G'NIGHT","NITE","SLEEP ♥","ZZZ","BYE"],Y=[[22,G],[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,G]],V=(e,t)=>({text:e,at:Date.now(),hold:t});e.s(["awake",0,()=>V("HI",1.6),"finished",0,()=>V("OK",1),"goodbye",0,function(e=new Date){let t,n=e.getHours();return V((t=Y.find(([e])=>n>=e)?.[1]??["BYE"])[Math.floor(Math.random()*t.length)],1.6)}],114923),e.s(["micProblem",0,function(e){let t=e instanceof DOMException?e.name:"";return"NotAllowedError"===t?"refused":"NotFoundError"===t?"missing":"NotReadableError"===t?"busy":null}],838098),e.s(["useAwayAfter",0,function(e,t){let[n,r]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(!e)return void r(!1);let n=setTimeout(()=>r(!0),t);return()=>clearTimeout(n)},[e,t]),e&&n}],991268);var J=e.i(728479),X=e.i(609856);let Z=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Q=e=>Array.from(Z.segment(e)).length;function ee({text:e,animate:t}){let{shown:n,links:r}=(0,l.useMemo)(()=>{let t=[],n="",r=0;for(let a of e.matchAll(O.MARKDOWN_LINK)){let s=Q(n+=e.slice(r,a.index));n+=a[1],t.push({from:s,to:Q(n),href:a[2]}),r=a.index+a[0].length}return{shown:n+e.slice(r),links:t}},[e]);if(t)return(0,i.jsx)(u,{text:n,wraps:r.map(e=>({from:e.from,to:e.to,render:t=>(0,i.jsx)(en,{href:e.href,children:t})}))});let a=Array.from(Z.segment(n),e=>e.segment),s=[],o=0;for(let e of r)s.push(a.slice(o,e.from).join("")),s.push((0,i.jsx)(en,{href:e.href,children:a.slice(e.from,e.to).join("")},e.from)),o=e.to;return s.push(a.slice(o).join("")),(0,i.jsx)(i.Fragment,{children:s})}let et="pointer-events-auto underline decoration-current/35 underline-offset-4 transition-colors hover:decoration-current";function en({href:e,children:t}){let[n]=(0,X.useServerAction)(J.openFileAction);if(/^https?:\/\//i.test(e))return(0,i.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",className:et,onClick:e=>e.stopPropagation(),children:t});let r=(0,_.workspaceRelative)(e);return r?(0,i.jsx)("a",{href:k.queryKey.fileView(r),className:et,onClick:t=>{t.preventDefault(),t.stopPropagation();let r=(0,D.fileTarget)(e);"os"===r.how?n(e):A.fileOpens.open(r.path)||window.open(k.queryKey.fileView(r.path),"_blank")},children:t}):t}e.s(["CaptionWords",0,ee],772581);var er=e.i(319841);let ea={assistant:null,user:null},es="(under)";function ei({role:e,turns:t,pinned:n,saying:r,onPick:a,under:s,ahead:o,workOf:u,whole:c}){let d="user"===e,[h,p]=(0,l.useState)({}),m=(0,l.useRef)(null);(0,l.useEffect)(()=>()=>m.current?.disconnect(),[]);let f=(0,l.useCallback)(e=>{if(e)return m.current??=new ResizeObserver(e=>{p(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})}),m.current.observe(e),()=>m.current?.unobserve(e)},[]),g=t.length-1,x=null===n&&(o||!t.length)?t.length:Math.min(n??g,g),w=(0,l.useRef)(null);if((0,l.useEffect)(()=>{let e=w.current;e&&(e.scrollTop=e.scrollHeight)},[t[x]?.text]),!t.length&&!s)return null;let y=e=>1150/(1150+700*Math.abs(e-x)),b=e=>e===x?1:.78,v=e=>(h[t[e].id]??28.475)*y(e)*b(e),k=x===t.length?s:u?.(t[x].id)??null,j=Array(t.length+1).fill(0);j[x]=-28.475/2;for(let e=x-1;e>=0;e--)j[e]=j[e+1]-49-v(e);let S=k&&x<t.length?(h[es]??0)+8:0;for(let e=x+1;e<t.length;e++)j[e]=j[e-1]+v(e-1)+49+(e-1===x?S:0);let N=k?x===t.length?j[x]:j[x]+(h[t[x].id]??28.475)+8:null;return(0,i.jsxs)("div",{className:(0,O.cn)("pointer-events-none absolute h-0 w-[min(21.25rem,24vw)]",d?"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 s=Math.abs(n-x),l=n<x?x-n<=2:n-x<=2,o=n===x,u=l?o?1:.56*.6**(s-1):0,h=l&&!o,p=14*s*(d?-1:1)/y(n),m=j[n]/y(n);return(0,i.jsx)("div",{ref:f,"data-turn":e.id,"aria-hidden":!l,onClick:h?()=>a(n):void 0,style:{transform:`translate(${p.toFixed(1)}px, ${m.toFixed(1)}px) translateZ(${-700*s}px) scale(${b(n)})`,"--ink":u,"--lift":Math.max(u,.9)},className:(0,O.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",c&&n===t.length-1&&"animate-in fade-in duration-200 motion-reduce:animate-none",d?"left-0 origin-top-left":"right-0 origin-top-right",!l&&"invisible",h&&"pointer-events-auto cursor-pointer",o&&"pointer-events-auto"),children:(0,i.jsxs)("p",{ref:o?w:void 0,className:(0,O.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,i.jsx)("span",{className:(0,O.cn)("mr-4 inline-block size-2.5 rounded-full align-middle",e.id===r?"animate-pulse motion-reduce:animate-none":"opacity-55",d?"bg-foreground":"bg-brand")}),(0,i.jsx)(ee,{text:e.text,animate:n===t.length-1&&!c})]})},e.id)}),k&&(0,i.jsx)("div",{ref:f,"data-turn":es,style:{transform:`translateY(${(N??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,function({turns:e,pinned:t,live:n,onPick:r,under:a=null,ahead:s=!1,workOf:l,typed:o=!1}){let u=e.at(-1);return(0,i.jsx)(i.Fragment,{children:["assistant","user"].map(c=>(0,i.jsx)(ei,{role:c,turns:e.filter(e=>e.role===c),pinned:t[c],saying:n?u?.id:void 0,onPick:e=>r(c,e),under:"assistant"===c?a:null,ahead:"assistant"===c&&s,workOf:"assistant"===c?l:void 0,whole:o&&"user"===c},c))})},"turnsOf",0,function(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},"useTurnFocus",0,function(e,t){let[n,r]=(0,l.useState)(ea);return(0,l.useEffect)(()=>{t||r(ea)},[t]),(0,l.useEffect)(()=>{if(!t)return;let e=e=>{"ArrowDown"!==e.key||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||(0,er.windowKey)(e)&&(e.preventDefault(),r(ea))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]),{pinned:n,pick:(0,l.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}}],435135)},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},618566,(e,t,n)=>{t.exports=e.r(976562)}]);
|