@agent-spaces/server 0.3.61 → 0.3.63
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/dist/adapters/agent-runtime-types.js +12 -0
- package/dist/adapters/claude-code-runtime/index.js +22 -0
- package/dist/adapters/claude-code-runtime/sdk-config.js +34 -10
- package/dist/adapters/codex-runtime.js +2 -2
- package/dist/adapters/git.js +29 -13
- package/dist/adapters/langchain-runtime.js +2 -2
- package/dist/adapters/open-agent-sdk-runtime.js +2 -2
- package/dist/agents/agent-message-parts.js +27 -3
- package/dist/agents/commit-agent.js +1 -0
- package/dist/agents/issue-agent-progress.js +4 -2
- package/dist/agents/issue-agent-runner.js +5 -5
- package/dist/agents/issue-task-controller.js +95 -14
- package/dist/app.js +74 -5
- package/dist/package.json +1 -1
- package/dist/routes/agent-sse.js +4 -2
- package/dist/routes/channel.js +21 -4
- package/dist/routes/file.js +87 -1
- package/dist/routes/hooks.js +88 -0
- package/dist/routes/issue.js +59 -1
- package/dist/routes/output-style.js +48 -0
- package/dist/routes/prompt-template.js +2 -2
- package/dist/routes/skill.js +97 -3
- package/dist/routes/task.js +13 -1
- package/dist/services/agent.js +45 -16
- package/dist/services/hook-engine.js +118 -0
- package/dist/services/issue.js +6 -0
- package/dist/services/notification-hub/bot-agent.js +1 -0
- package/dist/services/output-style.js +134 -0
- package/dist/services/persistent-agent-context.js +37 -4
- package/dist/services/prompt-template.js +2 -2
- package/dist/services/skill.js +275 -40
- package/dist/storage/hook-store.js +55 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +25 -23
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +13 -13
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/0-1bfvfwifh-m.js +1 -0
- package/dist/web/_next/static/chunks/0-f~0xmwl__u5.js +1 -0
- package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +1 -0
- package/dist/web/_next/static/chunks/002_j970b9gdx.js +1 -0
- package/dist/web/_next/static/chunks/014x2qbuiszni.js +3 -0
- package/dist/web/_next/static/chunks/01iqv28_snwus.js +1 -0
- package/dist/web/_next/static/chunks/02c22g~xd-y30.js +19 -0
- package/dist/web/_next/static/chunks/02mf61htij8g0.js +31 -0
- package/dist/web/_next/static/chunks/03scq1-0ykve3.js +1 -0
- package/dist/web/_next/static/chunks/046me66nilkff.js +1 -0
- package/dist/web/_next/static/chunks/04v-pqqs-2lvp.css +1 -0
- package/dist/web/_next/static/chunks/05f8cnmzqd5wb.js +1 -0
- package/dist/web/_next/static/chunks/{0zd1o3u04~qvo.js → 05psi2gtx~bev.js} +7 -7
- package/dist/web/_next/static/chunks/{12odetnu-lyrr.js → 06whz1~s_7pva.js} +12 -12
- package/dist/web/_next/static/chunks/06w~.izyfylap.js +1 -0
- package/dist/web/_next/static/chunks/08kfx8on9oty~.js +1 -0
- package/dist/web/_next/static/chunks/09t62a89~jesc.js +3 -0
- package/dist/web/_next/static/chunks/09y_3krccdd~u.js +1 -0
- package/dist/web/_next/static/chunks/{0njy89g5coeyi.js → 0_8dm7bxp18xo.js} +6 -6
- package/dist/web/_next/static/chunks/0_e~hmntdfop9.js +1 -0
- package/dist/web/_next/static/chunks/0_udc.6.tueey.js +1 -0
- package/dist/web/_next/static/chunks/0_vi1a~g4wx46.js +3 -0
- package/dist/web/_next/static/chunks/{05iy4.c-1cfhd.js → 0aa6bcdmtpekn.js} +1 -1
- package/dist/web/_next/static/chunks/{0tvd~rxgf0oh_.js → 0bbmx45w_h5np.js} +1 -1
- package/dist/web/_next/static/chunks/0cke33d38fnby.js +90 -0
- package/dist/web/_next/static/chunks/{0w1iudd1d46sw.js → 0ctg5qmw7uu.1.js} +2 -2
- package/dist/web/_next/static/chunks/0cyq~8xb~r5fc.js +1 -0
- package/dist/web/_next/static/chunks/0ewceguykiut5.js +1 -0
- package/dist/web/_next/static/chunks/0fxa1edqr7dve.js +1 -0
- package/dist/web/_next/static/chunks/{0202ia13sijwb.js → 0h18ej5yf974e.js} +1 -1
- package/dist/web/_next/static/chunks/0hra80eyuu37u.js +1 -0
- package/dist/web/_next/static/chunks/0i39jifmxla7q.js +1 -0
- package/dist/web/_next/static/chunks/0ie7y4k2ncvnn.js +1 -0
- package/dist/web/_next/static/chunks/0igc~uli58ncw.js +2 -0
- package/dist/web/_next/static/chunks/0kof5qdg8c2-k.js +71 -0
- package/dist/web/_next/static/chunks/{08o-zmr-40r5g.js → 0m11vvph7q94-.js} +1 -1
- package/dist/web/_next/static/chunks/0msb2mi3hiu5_.js +67 -0
- package/dist/web/_next/static/chunks/0np.d~hc1-pmh.js +4 -0
- package/dist/web/_next/static/chunks/{0qpq0~_58fe9a.js → 0oaq67r7ix.vg.js} +1 -1
- package/dist/web/_next/static/chunks/0ogpc3f3keopc.js +3 -0
- package/dist/web/_next/static/chunks/{0d_dp_4ofz0l3.css → 0ojcao3hdm36s.css} +0 -1
- package/dist/web/_next/static/chunks/0p1n8bvfnpl41.js +1 -0
- package/dist/web/_next/static/chunks/{0gig.k.rq8d0x.js → 0ppr271hz0xoq.js} +1 -1
- package/dist/web/_next/static/chunks/0s_dva~eh2yhi.js +3 -0
- package/dist/web/_next/static/chunks/0typj55ox8d5i.js +1 -0
- package/dist/web/_next/static/chunks/0w2p4ldi2aymp.js +1 -0
- package/dist/web/_next/static/chunks/{0..g0jl-8qup7.js → 0xoo17yef_b8g.js} +1 -1
- package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +1 -0
- package/dist/web/_next/static/chunks/0y09i51u6ixq5.js +1 -0
- package/dist/web/_next/static/chunks/0za1r07-6az6w.js +1 -0
- package/dist/web/_next/static/chunks/0zc0xgp5ourcn.js +1 -0
- package/dist/web/_next/static/chunks/0zmhdridea1s5.js +90 -0
- package/dist/web/_next/static/chunks/0~u.5r3-t7179.js +1 -0
- package/dist/web/_next/static/chunks/10.alq.6stmld.js +1 -0
- package/dist/web/_next/static/chunks/11-czmcci_55y.js +1 -0
- package/dist/web/_next/static/chunks/11b3zgk1etlkw.js +7 -0
- package/dist/web/_next/static/chunks/11k-.49r~1mfm.js +1 -0
- package/dist/web/_next/static/chunks/11qp8r5dotf7d.js +1 -0
- package/dist/web/_next/static/chunks/128ugqd34tr_-.js +1 -0
- package/dist/web/_next/static/chunks/12mxlicp247c8.js +1 -0
- package/dist/web/_next/static/chunks/135w27dd8c19s.js +5 -0
- package/dist/web/_next/static/chunks/13~y-b.b9rrw4.js +1 -0
- package/dist/web/_next/static/chunks/{0jokpgh485~28.js → 14hqmid8q4apf.js} +11 -11
- package/dist/web/_next/static/chunks/16sg-lflc8csx.js +1 -0
- package/dist/web/_next/static/chunks/176dc-dtokxxi.js +16 -0
- package/dist/web/_next/static/chunks/17g-0pqre.anw.js +1 -0
- package/dist/web/_next/static/chunks/17oc2l.ekcs8b.css +1 -0
- package/dist/web/_next/static/chunks/{turbopack-0lrdxynxb9-1t.js → turbopack-0ndm2zc_pdptk.js} +1 -1
- package/dist/web/_not-found/__next._full.txt +29 -30
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +13 -13
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +29 -30
- package/dist/web/icons/file_type_audio.svg +3 -1
- package/dist/web/icons/file_type_video.svg +10 -1
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +25 -23
- package/dist/web/login/__next._full.txt +30 -28
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +13 -13
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +30 -28
- package/dist/web/settings/__next._full.txt +32 -31
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +13 -13
- package/dist/web/settings/__next._tree.txt +2 -2
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +35 -34
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +13 -13
- package/dist/web/settings/agents/__next._tree.txt +2 -2
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +35 -34
- package/dist/web/settings/mcps/__next._full.txt +35 -34
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +13 -13
- package/dist/web/settings/mcps/__next._tree.txt +2 -2
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +35 -34
- package/dist/web/settings/models/__next._full.txt +35 -34
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +13 -13
- package/dist/web/settings/models/__next._tree.txt +2 -2
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +35 -34
- package/dist/web/settings/output-styles/__next._full.txt +43 -0
- package/dist/web/settings/output-styles/__next._head.txt +6 -0
- package/dist/web/settings/output-styles/__next._index.txt +15 -0
- package/dist/web/settings/output-styles/__next._tree.txt +8 -0
- package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +9 -0
- package/dist/web/settings/output-styles/__next.settings.output-styles.txt +5 -0
- package/dist/web/settings/output-styles/__next.settings.txt +7 -0
- package/dist/web/settings/output-styles.html +1 -0
- package/dist/web/settings/output-styles.txt +43 -0
- package/dist/web/settings/prompts/__next._full.txt +35 -34
- package/dist/web/settings/prompts/__next._head.txt +4 -4
- package/dist/web/settings/prompts/__next._index.txt +13 -13
- package/dist/web/settings/prompts/__next._tree.txt +2 -2
- package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
- package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
- package/dist/web/settings/prompts/__next.settings.txt +5 -5
- package/dist/web/settings/prompts.html +1 -1
- package/dist/web/settings/prompts.txt +35 -34
- package/dist/web/settings/providers/__next._full.txt +35 -34
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +13 -13
- package/dist/web/settings/providers/__next._tree.txt +2 -2
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +35 -34
- package/dist/web/settings/skills/__next._full.txt +35 -34
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +13 -13
- package/dist/web/settings/skills/__next._tree.txt +2 -2
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +35 -34
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +32 -31
- package/dist/web/workflows/__next._full.txt +32 -30
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +13 -13
- package/dist/web/workflows/__next._tree.txt +2 -2
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +32 -30
- package/dist/web/workspace/_/__next._full.txt +30 -70
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +13 -13
- package/dist/web/workspace/_/__next._tree.txt +2 -17
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -18
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +30 -70
- package/dist/web/workspaces/__next._full.txt +31 -29
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +13 -13
- package/dist/web/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +31 -29
- package/dist/ws/agent-runner.js +55 -33
- package/dist/ws/message-parts.js +61 -2
- package/package.json +1 -1
- package/public/output-styles/carmack-mode.md +381 -0
- package/public/output-styles/codex-rigor-mode.md +114 -0
- package/public/output-styles/dhh-mode.md +265 -0
- package/public/output-styles/evan-you-mode.md +539 -0
- package/public/output-styles/index.json +37 -0
- package/public/output-styles/jobs-mode.md +369 -0
- package/public/output-styles/linus-mode.md +135 -0
- package/public/output-styles/uncle-bob-mode.md +221 -0
- package/public/prompt/andrej-karpathy-skills.md +65 -0
- package/public/prompt/claude-token-efficient-coding.md +35 -0
- package/public/prompt/index.json +12 -0
- package/public/skills/index.json +92 -0
- package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +243 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +44 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +46 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +124 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +124 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +438 -0
- package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +29 -0
- package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +40 -0
- package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +58 -0
- package/public/skills/superpowers/brainstorming/SKILL.md +164 -0
- package/public/skills/superpowers/brainstorming/scripts/frame-template.html +214 -0
- package/public/skills/superpowers/brainstorming/scripts/helper.js +88 -0
- package/public/skills/superpowers/brainstorming/scripts/server.cjs +354 -0
- package/public/skills/superpowers/brainstorming/scripts/start-server.sh +148 -0
- package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +56 -0
- package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/public/skills/superpowers/brainstorming/visual-companion.md +287 -0
- package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +182 -0
- package/public/skills/superpowers/executing-plans/SKILL.md +70 -0
- package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +251 -0
- package/public/skills/superpowers/receiving-code-review/SKILL.md +213 -0
- package/public/skills/superpowers/requesting-code-review/SKILL.md +103 -0
- package/public/skills/superpowers/requesting-code-review/code-reviewer.md +168 -0
- package/public/skills/superpowers/subagent-driven-development/SKILL.md +279 -0
- package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +25 -0
- package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +113 -0
- package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +119 -0
- package/public/skills/superpowers/systematic-debugging/SKILL.md +296 -0
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +115 -0
- package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +122 -0
- package/public/skills/superpowers/systematic-debugging/find-polluter.sh +63 -0
- package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +169 -0
- package/public/skills/superpowers/systematic-debugging/test-academic.md +14 -0
- package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +58 -0
- package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +68 -0
- package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +69 -0
- package/public/skills/superpowers/test-driven-development/SKILL.md +371 -0
- package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +299 -0
- package/public/skills/superpowers/using-git-worktrees/SKILL.md +215 -0
- package/public/skills/superpowers/using-superpowers/SKILL.md +117 -0
- package/public/skills/superpowers/using-superpowers/references/codex-tools.md +59 -0
- package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +42 -0
- package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +51 -0
- package/public/skills/superpowers/verification-before-completion/SKILL.md +139 -0
- package/public/skills/superpowers/writing-plans/SKILL.md +152 -0
- package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/public/skills/superpowers/writing-skills/SKILL.md +655 -0
- package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +1150 -0
- package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +172 -0
- package/public/skills/superpowers/writing-skills/persuasion-principles.md +187 -0
- package/public/skills/superpowers/writing-skills/render-graphs.js +168 -0
- package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +384 -0
- package/dist/web/_next/static/chunks/0-1pn22sg~67u.js +0 -2
- package/dist/web/_next/static/chunks/01gi~q0c6ez6..js +0 -1
- package/dist/web/_next/static/chunks/03me5_ir..2ix.js +0 -1
- package/dist/web/_next/static/chunks/05eu2fdixf7c9.js +0 -1
- package/dist/web/_next/static/chunks/0_-c.y2qq4ax4.js +0 -270
- package/dist/web/_next/static/chunks/0_g3irbniww6d.js +0 -3
- package/dist/web/_next/static/chunks/0cs830n97dgjy.js +0 -1
- package/dist/web/_next/static/chunks/0g-0n6glz_z6w.js +0 -1
- package/dist/web/_next/static/chunks/0gyede80jpy3n.js +0 -4
- package/dist/web/_next/static/chunks/0hrbuvzuxrjfl.js +0 -1
- package/dist/web/_next/static/chunks/0ju52ko_nh7gi.js +0 -1
- package/dist/web/_next/static/chunks/0mny8i81aenx3.js +0 -1
- package/dist/web/_next/static/chunks/0nsu~f3voe~0i.js +0 -5
- package/dist/web/_next/static/chunks/0sz8_nijfiz0p.js +0 -1
- package/dist/web/_next/static/chunks/0u7_qd9hzqwac.js +0 -1
- package/dist/web/_next/static/chunks/0w3o.7vi.dlm6.js +0 -1
- package/dist/web/_next/static/chunks/0wv0h27jafag4.js +0 -1
- package/dist/web/_next/static/chunks/0wwvc4zc2q6bn.js +0 -1
- package/dist/web/_next/static/chunks/0x4b-a2ixww6m.js +0 -1
- package/dist/web/_next/static/chunks/0xwqf.llmm_u2.js +0 -31
- package/dist/web/_next/static/chunks/0~w6ugk9s5p-h.css +0 -1
- package/dist/web/_next/static/chunks/125nunjfj2fj0.js +0 -1
- package/dist/web/_next/static/chunks/1285yqy_oirb-.js +0 -1
- package/dist/web/_next/static/chunks/13ess~4pdmxma.js +0 -1
- package/dist/web/_next/static/chunks/14n8i2xz4_y-e.js +0 -1
- package/public/avatars/1777813826407-bea0ja-minimax.svg +0 -1
- package/public/avatars/1777813967088-3xlvd0-minimax.svg +0 -1
- package/public/avatars/1777814041714-yp0qeq-minimax.svg +0 -1
- package/public/avatars/1777904986095-rg26je-icon.png +0 -0
- package/public/avatars/1778953228323-5je54x-user.jpg +0 -0
- package/public/avatars/1778954057880-g01q6y-user.jpg +0 -0
- /package/dist/web/_next/static/{HUlYEknPhyW7dRmJ5mFdG → OoXAsPtrUWjC1l898FSvI}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{HUlYEknPhyW7dRmJ5mFdG → OoXAsPtrUWjC1l898FSvI}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{HUlYEknPhyW7dRmJ5mFdG → OoXAsPtrUWjC1l898FSvI}/_ssgManifest.js +0 -0
- /package/public/avatars/{1777815865622-08wp9m-user.jpg → user.jpg} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,360112,t=>{"use strict";var e=t.i(764556),a=t.i(106206);let r=Array(12).fill(0),o=({visible:t,className:a})=>e.default.createElement("div",{className:["sonner-loading-wrapper",a].filter(Boolean).join(" "),"data-visible":t},e.default.createElement("div",{className:"sonner-spinner"},r.map((t,a)=>e.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),n=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},e.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),s=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},e.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),i=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},e.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),l=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},e.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),d=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),c=1,u=new class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:a,...r}=t,o="number"==typeof(null==t?void 0:t.id)||(null==(e=t.id)?void 0:e.length)>0?t.id:c++,n=this.toasts.find(t=>t.id===o),s=void 0===t.dismissible||t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),n?this.toasts=this.toasts.map(e=>e.id===o?(this.publish({...e,...t,id:o,title:a}),{...e,...t,id:o,dismissible:s,title:a}):e):this.addToast({title:a,...r,dismissible:s,id:o}),o},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(e=>e({id:t,dismiss:!0})))):this.toasts.forEach(t=>{this.subscribers.forEach(e=>e({id:t.id,dismiss:!0}))}),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,a)=>{let r,o;if(!a)return;void 0!==a.loading&&(o=this.create({...a,promise:t,type:"loading",message:a.loading,description:"function"!=typeof a.description?a.description:void 0}));let n=Promise.resolve(t instanceof Function?t():t),s=void 0!==o,i=n.then(async t=>{if(r=["resolve",t],e.default.isValidElement(t))s=!1,this.create({id:o,type:"default",message:t});else if(f(t)&&!t.ok){s=!1;let r="function"==typeof a.error?await a.error(`HTTP error! status: ${t.status}`):a.error,n="function"==typeof a.description?await a.description(`HTTP error! status: ${t.status}`):a.description,i="object"!=typeof r||e.default.isValidElement(r)?{message:r}:r;this.create({id:o,type:"error",description:n,...i})}else if(t instanceof Error){s=!1;let r="function"==typeof a.error?await a.error(t):a.error,n="function"==typeof a.description?await a.description(t):a.description,i="object"!=typeof r||e.default.isValidElement(r)?{message:r}:r;this.create({id:o,type:"error",description:n,...i})}else if(void 0!==a.success){s=!1;let r="function"==typeof a.success?await a.success(t):a.success,n="function"==typeof a.description?await a.description(t):a.description,i="object"!=typeof r||e.default.isValidElement(r)?{message:r}:r;this.create({id:o,type:"success",description:n,...i})}}).catch(async t=>{if(r=["reject",t],void 0!==a.error){s=!1;let r="function"==typeof a.error?await a.error(t):a.error,n="function"==typeof a.description?await a.description(t):a.description,i="object"!=typeof r||e.default.isValidElement(r)?{message:r}:r;this.create({id:o,type:"error",description:n,...i})}}).finally(()=>{s&&(this.dismiss(o),o=void 0),null==a.finally||a.finally.call(a)}),l=()=>new Promise((t,e)=>i.then(()=>"reject"===r[0]?e(r[1]):t(r[1])).catch(e));return"string"!=typeof o&&"number"!=typeof o?{unwrap:l}:Object.assign(o,{unwrap:l})},this.custom=(t,e)=>{let a=(null==e?void 0:e.id)||c++;return this.create({jsx:t(a),id:a,...e}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},f=t=>t&&"object"==typeof t&&"ok"in t&&"boolean"==typeof t.ok&&"status"in t&&"number"==typeof t.status,m=Object.assign((t,e)=>{let a=(null==e?void 0:e.id)||c++;return u.addToast({title:t,...e,id:a}),a},{success:u.success,info:u.info,warning:u.warning,error:u.error,custom:u.custom,message:u.message,promise:u.promise,dismiss:u.dismiss,loading:u.loading},{getHistory:()=>u.toasts,getToasts:()=>u.getActiveToasts()});function p(t){return void 0!==t.label}function h(...t){return t.filter(Boolean).join(" ")}!function(t){if(!t||"u"<typeof document)return;let e=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",e.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");let g=t=>{var a,r,c,u,f,m,g,v,y,b,x,w,k;let{invert:E,toast:S,unstyled:N,interacting:T,setHeights:j,visibleToasts:M,heights:C,index:B,toasts:I,expanded:z,removeToast:L,defaultRichColors:P,closeButton:$,style:R,cancelButtonStyle:A,actionButtonStyle:D,className:Y="",descriptionClassName:H="",duration:U,position:O,gap:V,expandByDefault:F,classNames:X,icons:q,closeButtonAriaLabel:K="Close toast"}=t,[G,J]=e.default.useState(null),[W,_]=e.default.useState(null),[Q,Z]=e.default.useState(!1),[tt,te]=e.default.useState(!1),[ta,tr]=e.default.useState(!1),[to,tn]=e.default.useState(!1),[ts,ti]=e.default.useState(!1),[tl,td]=e.default.useState(0),[tc,tu]=e.default.useState(0),tf=e.default.useRef(S.duration||U||4e3),tm=e.default.useRef(null),tp=e.default.useRef(null),th=0===B,tg=B+1<=M,tv=S.type,ty=!1!==S.dismissible,tb=S.className||"",tx=S.descriptionClassName||"",tw=e.default.useMemo(()=>C.findIndex(t=>t.toastId===S.id)||0,[C,S.id]),tk=e.default.useMemo(()=>{var t;return null!=(t=S.closeButton)?t:$},[S.closeButton,$]),tE=e.default.useMemo(()=>S.duration||U||4e3,[S.duration,U]),tS=e.default.useRef(0),tN=e.default.useRef(0),tT=e.default.useRef(0),tj=e.default.useRef(null),[tM,tC]=O.split("-"),tB=e.default.useMemo(()=>C.reduce((t,e,a)=>a>=tw?t:t+e.height,0),[C,tw]),tI=(()=>{let[t,a]=e.default.useState(document.hidden);return e.default.useEffect(()=>{let t=()=>{a(document.hidden)};return document.addEventListener("visibilitychange",t),()=>window.removeEventListener("visibilitychange",t)},[]),t})(),tz=S.invert||E,tL="loading"===tv;tN.current=e.default.useMemo(()=>tw*V+tB,[tw,tB]),e.default.useEffect(()=>{tf.current=tE},[tE]),e.default.useEffect(()=>{Z(!0)},[]),e.default.useEffect(()=>{let t=tp.current;if(t){let e=t.getBoundingClientRect().height;return tu(e),j(t=>[{toastId:S.id,height:e,position:S.position},...t]),()=>j(t=>t.filter(t=>t.toastId!==S.id))}},[j,S.id]),e.default.useLayoutEffect(()=>{if(!Q)return;let t=tp.current,e=t.style.height;t.style.height="auto";let a=t.getBoundingClientRect().height;t.style.height=e,tu(a),j(t=>t.find(t=>t.toastId===S.id)?t.map(t=>t.toastId===S.id?{...t,height:a}:t):[{toastId:S.id,height:a,position:S.position},...t])},[Q,S.title,S.description,j,S.id,S.jsx,S.action,S.cancel]);let tP=e.default.useCallback(()=>{te(!0),td(tN.current),j(t=>t.filter(t=>t.toastId!==S.id)),setTimeout(()=>{L(S)},200)},[S,L,j,tN]);e.default.useEffect(()=>{let t;if((!S.promise||"loading"!==tv)&&S.duration!==1/0&&"loading"!==S.type){if(z||T||tI){if(tT.current<tS.current){let t=new Date().getTime()-tS.current;tf.current=tf.current-t}tT.current=new Date().getTime()}else tf.current!==1/0&&(tS.current=new Date().getTime(),t=setTimeout(()=>{null==S.onAutoClose||S.onAutoClose.call(S,S),tP()},tf.current));return()=>clearTimeout(t)}},[z,T,S,tv,tI,tP]),e.default.useEffect(()=>{S.delete&&(tP(),null==S.onDismiss||S.onDismiss.call(S,S))},[tP,S.delete]);let t$=S.icon||(null==q?void 0:q[tv])||(t=>{switch(t){case"success":return n;case"info":return i;case"warning":return s;case"error":return l;default:return null}})(tv);return e.default.createElement("li",{tabIndex:0,ref:tp,className:h(Y,tb,null==X?void 0:X.toast,null==S||null==(a=S.classNames)?void 0:a.toast,null==X?void 0:X.default,null==X?void 0:X[tv],null==S||null==(r=S.classNames)?void 0:r[tv]),"data-sonner-toast":"","data-rich-colors":null!=(b=S.richColors)?b:P,"data-styled":!(S.jsx||S.unstyled||N),"data-mounted":Q,"data-promise":!!S.promise,"data-swiped":ts,"data-removed":tt,"data-visible":tg,"data-y-position":tM,"data-x-position":tC,"data-index":B,"data-front":th,"data-swiping":ta,"data-dismissible":ty,"data-type":tv,"data-invert":tz,"data-swipe-out":to,"data-swipe-direction":W,"data-expanded":!!(z||F&&Q),"data-testid":S.testId,style:{"--index":B,"--toasts-before":B,"--z-index":I.length-B,"--offset":`${tt?tl:tN.current}px`,"--initial-height":F?"auto":`${tc}px`,...R,...S.style},onDragEnd:()=>{tr(!1),J(null),tj.current=null},onPointerDown:t=>{2===t.button||tL||!ty||(tm.current=new Date,td(tN.current),t.target.setPointerCapture(t.pointerId),"BUTTON"!==t.target.tagName&&(tr(!0),tj.current={x:t.clientX,y:t.clientY}))},onPointerUp:()=>{var t,e,a,r,o;if(to||!ty)return;tj.current=null;let n=Number((null==(t=tp.current)?void 0:t.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),s=Number((null==(e=tp.current)?void 0:e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),i=new Date().getTime()-(null==(a=tm.current)?void 0:a.getTime()),l="x"===G?n:s,d=Math.abs(l)/i;if(Math.abs(l)>=45||d>.11){td(tN.current),null==S.onDismiss||S.onDismiss.call(S,S),"x"===G?_(n>0?"right":"left"):_(s>0?"down":"up"),tP(),tn(!0);return}null==(r=tp.current)||r.style.setProperty("--swipe-amount-x","0px"),null==(o=tp.current)||o.style.setProperty("--swipe-amount-y","0px"),ti(!1),tr(!1),J(null)},onPointerMove:e=>{var a,r,o,n;if(!tj.current||!ty||(null==(a=window.getSelection())?void 0:a.toString().length)>0)return;let s=e.clientY-tj.current.y,i=e.clientX-tj.current.x,l=null!=(n=t.swipeDirections)?n:function(t){let[e,a]=t.split("-"),r=[];return e&&r.push(e),a&&r.push(a),r}(O);!G&&(Math.abs(i)>1||Math.abs(s)>1)&&J(Math.abs(i)>Math.abs(s)?"x":"y");let d={x:0,y:0},c=t=>1/(1.5+Math.abs(t)/20);if("y"===G){if(l.includes("top")||l.includes("bottom"))if(l.includes("top")&&s<0||l.includes("bottom")&&s>0)d.y=s;else{let t=s*c(s);d.y=Math.abs(t)<Math.abs(s)?t:s}}else if("x"===G&&(l.includes("left")||l.includes("right")))if(l.includes("left")&&i<0||l.includes("right")&&i>0)d.x=i;else{let t=i*c(i);d.x=Math.abs(t)<Math.abs(i)?t:i}(Math.abs(d.x)>0||Math.abs(d.y)>0)&&ti(!0),null==(r=tp.current)||r.style.setProperty("--swipe-amount-x",`${d.x}px`),null==(o=tp.current)||o.style.setProperty("--swipe-amount-y",`${d.y}px`)}},tk&&!S.jsx&&"loading"!==tv?e.default.createElement("button",{"aria-label":K,"data-disabled":tL,"data-close-button":!0,onClick:tL||!ty?()=>{}:()=>{tP(),null==S.onDismiss||S.onDismiss.call(S,S)},className:h(null==X?void 0:X.closeButton,null==S||null==(c=S.classNames)?void 0:c.closeButton)},null!=(x=null==q?void 0:q.close)?x:d):null,(tv||S.icon||S.promise)&&null!==S.icon&&((null==q?void 0:q[tv])!==null||S.icon)?e.default.createElement("div",{"data-icon":"",className:h(null==X?void 0:X.icon,null==S||null==(u=S.classNames)?void 0:u.icon)},S.promise||"loading"===S.type&&!S.icon?S.icon||((null==q?void 0:q.loading)?e.default.createElement("div",{className:h(null==X?void 0:X.loader,null==S||null==(k=S.classNames)?void 0:k.loader,"sonner-loader"),"data-visible":"loading"===tv},q.loading):e.default.createElement(o,{className:h(null==X?void 0:X.loader,null==S||null==(w=S.classNames)?void 0:w.loader),visible:"loading"===tv})):null,"loading"!==S.type?t$:null):null,e.default.createElement("div",{"data-content":"",className:h(null==X?void 0:X.content,null==S||null==(f=S.classNames)?void 0:f.content)},e.default.createElement("div",{"data-title":"",className:h(null==X?void 0:X.title,null==S||null==(m=S.classNames)?void 0:m.title)},S.jsx?S.jsx:"function"==typeof S.title?S.title():S.title),S.description?e.default.createElement("div",{"data-description":"",className:h(H,tx,null==X?void 0:X.description,null==S||null==(g=S.classNames)?void 0:g.description)},"function"==typeof S.description?S.description():S.description):null),e.default.isValidElement(S.cancel)?S.cancel:S.cancel&&p(S.cancel)?e.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:S.cancelButtonStyle||A,onClick:t=>{!p(S.cancel)||ty&&(null==S.cancel.onClick||S.cancel.onClick.call(S.cancel,t),tP())},className:h(null==X?void 0:X.cancelButton,null==S||null==(v=S.classNames)?void 0:v.cancelButton)},S.cancel.label):null,e.default.isValidElement(S.action)?S.action:S.action&&p(S.action)?e.default.createElement("button",{"data-button":!0,"data-action":!0,style:S.actionButtonStyle||D,onClick:t=>{!p(S.action)||(null==S.action.onClick||S.action.onClick.call(S.action,t),t.defaultPrevented||tP())},className:h(null==X?void 0:X.actionButton,null==S||null==(y=S.classNames)?void 0:y.actionButton)},S.action.label):null)};function v(){if("u"<typeof window||"u"<typeof document)return"ltr";let t=document.documentElement.getAttribute("dir");return"auto"!==t&&t?t:window.getComputedStyle(document.documentElement).direction}let y=e.default.forwardRef(function(t,r){let{id:o,invert:n,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:l,closeButton:d,className:c,offset:f,mobileOffset:m,theme:p="light",richColors:h,duration:y,style:b,visibleToasts:x=3,toastOptions:w,dir:k=v(),gap:E=14,icons:S,containerAriaLabel:N="Notifications"}=t,[T,j]=e.default.useState([]),M=e.default.useMemo(()=>o?T.filter(t=>t.toasterId===o):T.filter(t=>!t.toasterId),[T,o]),C=e.default.useMemo(()=>Array.from(new Set([s].concat(M.filter(t=>t.position).map(t=>t.position)))),[M,s]),[B,I]=e.default.useState([]),[z,L]=e.default.useState(!1),[P,$]=e.default.useState(!1),[R,A]=e.default.useState("system"!==p?p:"u">typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),D=e.default.useRef(null),Y=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),H=e.default.useRef(null),U=e.default.useRef(!1),O=e.default.useCallback(t=>{j(e=>{var a;return(null==(a=e.find(e=>e.id===t.id))?void 0:a.delete)||u.dismiss(t.id),e.filter(({id:e})=>e!==t.id)})},[]);return e.default.useEffect(()=>u.subscribe(t=>{t.dismiss?requestAnimationFrame(()=>{j(e=>e.map(e=>e.id===t.id?{...e,delete:!0}:e))}):setTimeout(()=>{a.default.flushSync(()=>{j(e=>{let a=e.findIndex(e=>e.id===t.id);return -1!==a?[...e.slice(0,a),{...e[a],...t},...e.slice(a+1)]:[t,...e]})})})}),[T]),e.default.useEffect(()=>{if("system"!==p)return void A(p);if("system"===p&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?A("dark"):A("light")),"u"<typeof window)return;let t=window.matchMedia("(prefers-color-scheme: dark)");try{t.addEventListener("change",({matches:t})=>{t?A("dark"):A("light")})}catch(e){t.addListener(({matches:t})=>{try{t?A("dark"):A("light")}catch(t){console.error(t)}})}},[p]),e.default.useEffect(()=>{T.length<=1&&L(!1)},[T]),e.default.useEffect(()=>{let t=t=>{var e,a;i.every(e=>t[e]||t.code===e)&&(L(!0),null==(a=D.current)||a.focus()),"Escape"===t.code&&(document.activeElement===D.current||(null==(e=D.current)?void 0:e.contains(document.activeElement)))&&L(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[i]),e.default.useEffect(()=>{if(D.current)return()=>{H.current&&(H.current.focus({preventScroll:!0}),H.current=null,U.current=!1)}},[D.current]),e.default.createElement("section",{ref:r,"aria-label":`${N} ${Y}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},C.map((a,r)=>{var o;let s,[i,u]=a.split("-");return M.length?e.default.createElement("ol",{key:a,dir:"auto"===k?v():k,tabIndex:-1,ref:D,className:c,"data-sonner-toaster":!0,"data-sonner-theme":R,"data-y-position":i,"data-x-position":u,style:{"--front-toast-height":`${(null==(o=B[0])?void 0:o.height)||0}px`,"--width":"356px","--gap":`${E}px`,...b,...(s={},[f,m].forEach((t,e)=>{let a=1===e,r=a?"--mobile-offset":"--offset",o=a?"16px":"24px";function n(t){["top","right","bottom","left"].forEach(e=>{s[`${r}-${e}`]="number"==typeof t?`${t}px`:t})}"number"==typeof t||"string"==typeof t?n(t):"object"==typeof t?["top","right","bottom","left"].forEach(e=>{void 0===t[e]?s[`${r}-${e}`]=o:s[`${r}-${e}`]="number"==typeof t[e]?`${t[e]}px`:t[e]}):n(o)}),s)},onBlur:t=>{U.current&&!t.currentTarget.contains(t.relatedTarget)&&(U.current=!1,H.current&&(H.current.focus({preventScroll:!0}),H.current=null))},onFocus:t=>{!(t.target instanceof HTMLElement&&"false"===t.target.dataset.dismissible)&&(U.current||(U.current=!0,H.current=t.relatedTarget))},onMouseEnter:()=>L(!0),onMouseMove:()=>L(!0),onMouseLeave:()=>{P||L(!1)},onDragEnd:()=>L(!1),onPointerDown:t=>{t.target instanceof HTMLElement&&"false"===t.target.dataset.dismissible||$(!0)},onPointerUp:()=>$(!1)},M.filter(t=>!t.position&&0===r||t.position===a).map((r,o)=>{var s,i;return e.default.createElement(g,{key:r.id,icons:S,index:o,toast:r,defaultRichColors:h,duration:null!=(s=null==w?void 0:w.duration)?s:y,className:null==w?void 0:w.className,descriptionClassName:null==w?void 0:w.descriptionClassName,invert:n,visibleToasts:x,closeButton:null!=(i=null==w?void 0:w.closeButton)?i:d,interacting:P,position:a,style:null==w?void 0:w.style,unstyled:null==w?void 0:w.unstyled,classNames:null==w?void 0:w.classNames,cancelButtonStyle:null==w?void 0:w.cancelButtonStyle,actionButtonStyle:null==w?void 0:w.actionButtonStyle,closeButtonAriaLabel:null==w?void 0:w.closeButtonAriaLabel,removeToast:O,toasts:M.filter(t=>t.position==r.position),heights:B.filter(t=>t.position==r.position),setHeights:I,expandByDefault:l,gap:E,expanded:z,swipeDirections:t.swipeDirections})})):null}))});t.s(["Toaster",0,y,"toast",0,m,"useSonner",0,function(){let[t,r]=e.default.useState([]);return e.default.useEffect(()=>u.subscribe(t=>{t.dismiss?setTimeout(()=>{a.default.flushSync(()=>{r(e=>e.filter(e=>e.id!==t.id))})}):setTimeout(()=>{a.default.flushSync(()=>{r(e=>{let a=e.findIndex(e=>e.id===t.id);return -1!==a?[...e.slice(0,a),{...e[a],...t},...e.slice(a+1)]:[t,...e]})})})}),[]),{toasts:t}}])},842809,203922,t=>{"use strict";let e=new Map;function a(t,a,r){return null==t?"":(function(t,a){let r=JSON.stringify({locale:t,options:a}),o=e.get(r);if(o)return o;let n=new Intl.NumberFormat(t,a);return e.set(r,n),n})(a,r).format(t)}t.s(["formatNumber",0,a,"formatNumberValue",0,function(t,e,r){return null==t?"":r?a(t,e,r):a(t/100,e,{style:"percent"})}],842809),t.s(["valueToPercent",0,function(t,e,a){return(t-e)*100/(a-e)}],203922)},817854,t=>{"use strict";var e=t.i(344180),a=t.i(465458);t.s(["Label",0,function({className:t,...r}){return(0,e.jsx)("label",{"data-slot":"label",className:(0,a.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...r})}])},517432,t=>{"use strict";var e=t.i(56032),a=t.i(863728);function r(){return a.NOOP}function o(){return!1}function n(){return!0}t.s(["useIsHydrating",0,function(){return(0,e.useSyncExternalStore)(r,o,n)}])},950396,t=>{"use strict";var e=t.i(344180),a=t.i(764556),r=t.i(799543);let o=(0,a.createContext)({theme:"system",setTheme:()=>{},resolvedTheme:"light"}),n="agent-spaces-theme",s={light:"#ffffff",dark:"#0f1117"};function i(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function l(t){var e;let a,r="system"===t?i():t,o=document.documentElement;o.classList.remove("light","dark"),o.classList.add(r),o.style.colorScheme=r,e=r,(a=document.querySelector('meta[name="theme-color"]'))||((a=document.createElement("meta")).name="theme-color",document.head.appendChild(a)),a.content=s[e],window.AgentSpacesStatusBar?.setTheme(e)}t.s(["ThemeProvider",0,function({children:t,defaultTheme:d="system"}){(0,r.useServerInsertedHTML)(()=>(0,e.jsx)("script",{dangerouslySetInnerHTML:{__html:`(function(){try{var t=localStorage.getItem('${n}');var d=t==='dark'||((!t||t==='system')&&matchMedia('(prefers-color-scheme:dark)').matches);var r=d?'dark':'light';document.documentElement.classList.add(r);document.documentElement.style.colorScheme=r;var m=document.querySelector('meta[name="theme-color"]');if(!m){m=document.createElement('meta');m.name='theme-color';document.head.appendChild(m)}m.content=d?'${s.dark}':'${s.light}';if(window.AgentSpacesStatusBar){window.AgentSpacesStatusBar.setTheme(r)}}catch(e){}})()`}},"theme-init"));let c=(0,a.useSyncExternalStore)(t=>{let e=window.matchMedia("(prefers-color-scheme: dark)");return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},()=>i(),()=>"light"),u=(0,a.useSyncExternalStore)(t=>(window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)),()=>localStorage.getItem(n)||d,()=>d),f="system"===u?c:u,m=(0,a.useCallback)(t=>{localStorage.setItem(n,t),l(t),window.dispatchEvent(new StorageEvent("storage",{key:n}))},[]);return(0,a.useEffect)(()=>{l(u)},[u,c]),(0,e.jsx)(o.Provider,{value:{theme:u,setTheme:m,resolvedTheme:f},children:t})},"useTheme",0,function(){return(0,a.useContext)(o)}])},327962,t=>{"use strict";let e=(0,t.i(433721).default)("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);t.s(["GitBranch",0,e],327962)},951841,t=>{"use strict";let e;var a=t.i(764556);t.s(["useUserAvatar",0,function(){let[t,r]=(0,a.useState)(()=>void 0!==e?e:localStorage.getItem("userAvatarUrl"));return(0,a.useEffect)(()=>{void 0===e&&fetch("/api/user/settings").then(t=>t.json()).then(t=>{t.avatarUrl&&(e=t.avatarUrl,r(t.avatarUrl),localStorage.setItem("userAvatarUrl",t.avatarUrl))}).catch(()=>{})},[]),t}])},92457,t=>{"use strict";let e=(0,t.i(433721).default)("monitor",[["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"}]]);t.s(["Monitor",0,e],92457)},882469,551157,t=>{"use strict";let e=(0,t.i(433721).default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);t.s(["default",0,e],551157),t.s(["Globe",0,e],882469)},964970,t=>{"use strict";var e=t.i(344180),a=t.i(764556),r=t.i(244073),o=t.i(260218),n=t.i(681622),s=t.i(817854),i=t.i(360112),l=t.i(437122);t.s(["GitSettingsForm",0,function({scope:t,workspaceId:d}){let c=(0,r.useTranslations)("git.settings"),u=(0,r.useTranslations)("common"),[f,m]=(0,a.useState)(""),[p,h]=(0,a.useState)(""),[g,v]=(0,a.useState)(""),[y,b]=(0,a.useState)(""),[x,w]=(0,a.useState)(!0),[k,E]=(0,a.useState)(!1),S=async()=>{w(!0);try{let e="global"===t?"/api/git-config":`/api/workspaces/${d}/git/config`,a=await fetch(e,{headers:(0,l.authHeaders)()});if(a.ok){let t=await a.json();m(t.name??""),h(t.email??""),v(t.proxy??"")}if("local"===t&&d){let t=await fetch(`/api/workspaces/${d}/git/remote-url`,{headers:(0,l.authHeaders)()});if(t.ok){let e=await t.json();b(e.url??"")}}}catch{}w(!1)};(0,a.useEffect)(()=>{S()},[t,d]);let N=async()=>{E(!0);try{let e="global"===t?"/api/git-config":`/api/workspaces/${d}/git/config`;if(!(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...(0,l.authHeaders)()},body:JSON.stringify({name:f,email:p,proxy:g})})).ok){i.toast.error(c("saveFailed")),E(!1);return}"local"===t&&d&&y&&await fetch(`/api/workspaces/${d}/git/remotes`,{method:"POST",headers:{"Content-Type":"application/json",...(0,l.authHeaders)()},body:JSON.stringify({name:"origin",url:y})}),i.toast.success(c("saved"))}catch{i.toast.error(c("saveFailed"))}E(!1)};return x?(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:c("loading")}):(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"global"===t?c("globalScopeDescription"):c("localScopeDescription")}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(s.Label,{className:"text-xs text-muted-foreground",children:c("name")}),(0,e.jsx)(n.Input,{className:"h-7 text-xs",value:f,onChange:t=>m(t.target.value),placeholder:c("namePlaceholder")})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(s.Label,{className:"text-xs text-muted-foreground",children:c("email")}),(0,e.jsx)(n.Input,{className:"h-7 text-xs",value:p,onChange:t=>h(t.target.value),placeholder:c("emailPlaceholder")})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(s.Label,{className:"text-xs text-muted-foreground",children:c("proxy")}),(0,e.jsx)(n.Input,{className:"h-7 text-xs",value:g,onChange:t=>v(t.target.value),placeholder:c("proxyPlaceholder")})]}),"local"===t&&(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(s.Label,{className:"text-xs text-muted-foreground",children:c("remoteUrl")}),(0,e.jsx)(n.Input,{className:"h-7 text-xs",value:y,onChange:t=>b(t.target.value),placeholder:c("remoteUrlPlaceholder")})]}),(0,e.jsx)(o.Button,{size:"sm",className:"text-xs",onClick:N,disabled:k,children:u(k?"loading":"save")})]})}])}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,360112,t=>{"use strict";var e=t.i(764556),a=t.i(106206);let o=Array(12).fill(0),n=({visible:t,className:a})=>e.default.createElement("div",{className:["sonner-loading-wrapper",a].filter(Boolean).join(" "),"data-visible":t},e.default.createElement("div",{className:"sonner-spinner"},o.map((t,a)=>e.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),r=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},e.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),s=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},e.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),i=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},e.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),l=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},e.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),d=e.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},e.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),c=1,u=new class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:a,...o}=t,n="number"==typeof(null==t?void 0:t.id)||(null==(e=t.id)?void 0:e.length)>0?t.id:c++,r=this.toasts.find(t=>t.id===n),s=void 0===t.dismissible||t.dismissible;return this.dismissedToasts.has(n)&&this.dismissedToasts.delete(n),r?this.toasts=this.toasts.map(e=>e.id===n?(this.publish({...e,...t,id:n,title:a}),{...e,...t,id:n,dismissible:s,title:a}):e):this.addToast({title:a,...o,dismissible:s,id:n}),n},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(e=>e({id:t,dismiss:!0})))):this.toasts.forEach(t=>{this.subscribers.forEach(e=>e({id:t.id,dismiss:!0}))}),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,a)=>{let o,n;if(!a)return;void 0!==a.loading&&(n=this.create({...a,promise:t,type:"loading",message:a.loading,description:"function"!=typeof a.description?a.description:void 0}));let r=Promise.resolve(t instanceof Function?t():t),s=void 0!==n,i=r.then(async t=>{if(o=["resolve",t],e.default.isValidElement(t))s=!1,this.create({id:n,type:"default",message:t});else if(f(t)&&!t.ok){s=!1;let o="function"==typeof a.error?await a.error(`HTTP error! status: ${t.status}`):a.error,r="function"==typeof a.description?await a.description(`HTTP error! status: ${t.status}`):a.description,i="object"!=typeof o||e.default.isValidElement(o)?{message:o}:o;this.create({id:n,type:"error",description:r,...i})}else if(t instanceof Error){s=!1;let o="function"==typeof a.error?await a.error(t):a.error,r="function"==typeof a.description?await a.description(t):a.description,i="object"!=typeof o||e.default.isValidElement(o)?{message:o}:o;this.create({id:n,type:"error",description:r,...i})}else if(void 0!==a.success){s=!1;let o="function"==typeof a.success?await a.success(t):a.success,r="function"==typeof a.description?await a.description(t):a.description,i="object"!=typeof o||e.default.isValidElement(o)?{message:o}:o;this.create({id:n,type:"success",description:r,...i})}}).catch(async t=>{if(o=["reject",t],void 0!==a.error){s=!1;let o="function"==typeof a.error?await a.error(t):a.error,r="function"==typeof a.description?await a.description(t):a.description,i="object"!=typeof o||e.default.isValidElement(o)?{message:o}:o;this.create({id:n,type:"error",description:r,...i})}}).finally(()=>{s&&(this.dismiss(n),n=void 0),null==a.finally||a.finally.call(a)}),l=()=>new Promise((t,e)=>i.then(()=>"reject"===o[0]?e(o[1]):t(o[1])).catch(e));return"string"!=typeof n&&"number"!=typeof n?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,e)=>{let a=(null==e?void 0:e.id)||c++;return this.create({jsx:t(a),id:a,...e}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},f=t=>t&&"object"==typeof t&&"ok"in t&&"boolean"==typeof t.ok&&"status"in t&&"number"==typeof t.status,p=Object.assign((t,e)=>{let a=(null==e?void 0:e.id)||c++;return u.addToast({title:t,...e,id:a}),a},{success:u.success,info:u.info,warning:u.warning,error:u.error,custom:u.custom,message:u.message,promise:u.promise,dismiss:u.dismiss,loading:u.loading},{getHistory:()=>u.toasts,getToasts:()=>u.getActiveToasts()});function m(t){return void 0!==t.label}function h(...t){return t.filter(Boolean).join(" ")}!function(t){if(!t||"u"<typeof document)return;let e=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",e.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");let g=t=>{var a,o,c,u,f,p,g,v,b,y,w,x,F;let{invert:E,toast:k,unstyled:S,interacting:C,setHeights:P,visibleToasts:T,heights:j,index:N,toasts:D,expanded:M,removeToast:B,defaultRichColors:R,closeButton:$,style:z,cancelButtonStyle:I,actionButtonStyle:L,className:Y="",descriptionClassName:A="",duration:O,position:U,gap:H,expandByDefault:V,classNames:X,icons:J,closeButtonAriaLabel:K="Close toast"}=t,[_,W]=e.default.useState(null),[q,G]=e.default.useState(null),[Q,Z]=e.default.useState(!1),[tt,te]=e.default.useState(!1),[ta,to]=e.default.useState(!1),[tn,tr]=e.default.useState(!1),[ts,ti]=e.default.useState(!1),[tl,td]=e.default.useState(0),[tc,tu]=e.default.useState(0),tf=e.default.useRef(k.duration||O||4e3),tp=e.default.useRef(null),tm=e.default.useRef(null),th=0===N,tg=N+1<=T,tv=k.type,tb=!1!==k.dismissible,ty=k.className||"",tw=k.descriptionClassName||"",tx=e.default.useMemo(()=>j.findIndex(t=>t.toastId===k.id)||0,[j,k.id]),tF=e.default.useMemo(()=>{var t;return null!=(t=k.closeButton)?t:$},[k.closeButton,$]),tE=e.default.useMemo(()=>k.duration||O||4e3,[k.duration,O]),tk=e.default.useRef(0),tS=e.default.useRef(0),tC=e.default.useRef(0),tP=e.default.useRef(null),[tT,tj]=U.split("-"),tN=e.default.useMemo(()=>j.reduce((t,e,a)=>a>=tx?t:t+e.height,0),[j,tx]),tD=(()=>{let[t,a]=e.default.useState(document.hidden);return e.default.useEffect(()=>{let t=()=>{a(document.hidden)};return document.addEventListener("visibilitychange",t),()=>window.removeEventListener("visibilitychange",t)},[]),t})(),tM=k.invert||E,tB="loading"===tv;tS.current=e.default.useMemo(()=>tx*H+tN,[tx,tN]),e.default.useEffect(()=>{tf.current=tE},[tE]),e.default.useEffect(()=>{Z(!0)},[]),e.default.useEffect(()=>{let t=tm.current;if(t){let e=t.getBoundingClientRect().height;return tu(e),P(t=>[{toastId:k.id,height:e,position:k.position},...t]),()=>P(t=>t.filter(t=>t.toastId!==k.id))}},[P,k.id]),e.default.useLayoutEffect(()=>{if(!Q)return;let t=tm.current,e=t.style.height;t.style.height="auto";let a=t.getBoundingClientRect().height;t.style.height=e,tu(a),P(t=>t.find(t=>t.toastId===k.id)?t.map(t=>t.toastId===k.id?{...t,height:a}:t):[{toastId:k.id,height:a,position:k.position},...t])},[Q,k.title,k.description,P,k.id,k.jsx,k.action,k.cancel]);let tR=e.default.useCallback(()=>{te(!0),td(tS.current),P(t=>t.filter(t=>t.toastId!==k.id)),setTimeout(()=>{B(k)},200)},[k,B,P,tS]);e.default.useEffect(()=>{let t;if((!k.promise||"loading"!==tv)&&k.duration!==1/0&&"loading"!==k.type){if(M||C||tD){if(tC.current<tk.current){let t=new Date().getTime()-tk.current;tf.current=tf.current-t}tC.current=new Date().getTime()}else tf.current!==1/0&&(tk.current=new Date().getTime(),t=setTimeout(()=>{null==k.onAutoClose||k.onAutoClose.call(k,k),tR()},tf.current));return()=>clearTimeout(t)}},[M,C,k,tv,tD,tR]),e.default.useEffect(()=>{k.delete&&(tR(),null==k.onDismiss||k.onDismiss.call(k,k))},[tR,k.delete]);let t$=k.icon||(null==J?void 0:J[tv])||(t=>{switch(t){case"success":return r;case"info":return i;case"warning":return s;case"error":return l;default:return null}})(tv);return e.default.createElement("li",{tabIndex:0,ref:tm,className:h(Y,ty,null==X?void 0:X.toast,null==k||null==(a=k.classNames)?void 0:a.toast,null==X?void 0:X.default,null==X?void 0:X[tv],null==k||null==(o=k.classNames)?void 0:o[tv]),"data-sonner-toast":"","data-rich-colors":null!=(y=k.richColors)?y:R,"data-styled":!(k.jsx||k.unstyled||S),"data-mounted":Q,"data-promise":!!k.promise,"data-swiped":ts,"data-removed":tt,"data-visible":tg,"data-y-position":tT,"data-x-position":tj,"data-index":N,"data-front":th,"data-swiping":ta,"data-dismissible":tb,"data-type":tv,"data-invert":tM,"data-swipe-out":tn,"data-swipe-direction":q,"data-expanded":!!(M||V&&Q),"data-testid":k.testId,style:{"--index":N,"--toasts-before":N,"--z-index":D.length-N,"--offset":`${tt?tl:tS.current}px`,"--initial-height":V?"auto":`${tc}px`,...z,...k.style},onDragEnd:()=>{to(!1),W(null),tP.current=null},onPointerDown:t=>{2===t.button||tB||!tb||(tp.current=new Date,td(tS.current),t.target.setPointerCapture(t.pointerId),"BUTTON"!==t.target.tagName&&(to(!0),tP.current={x:t.clientX,y:t.clientY}))},onPointerUp:()=>{var t,e,a,o,n;if(tn||!tb)return;tP.current=null;let r=Number((null==(t=tm.current)?void 0:t.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),s=Number((null==(e=tm.current)?void 0:e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),i=new Date().getTime()-(null==(a=tp.current)?void 0:a.getTime()),l="x"===_?r:s,d=Math.abs(l)/i;if(Math.abs(l)>=45||d>.11){td(tS.current),null==k.onDismiss||k.onDismiss.call(k,k),"x"===_?G(r>0?"right":"left"):G(s>0?"down":"up"),tR(),tr(!0);return}null==(o=tm.current)||o.style.setProperty("--swipe-amount-x","0px"),null==(n=tm.current)||n.style.setProperty("--swipe-amount-y","0px"),ti(!1),to(!1),W(null)},onPointerMove:e=>{var a,o,n,r;if(!tP.current||!tb||(null==(a=window.getSelection())?void 0:a.toString().length)>0)return;let s=e.clientY-tP.current.y,i=e.clientX-tP.current.x,l=null!=(r=t.swipeDirections)?r:function(t){let[e,a]=t.split("-"),o=[];return e&&o.push(e),a&&o.push(a),o}(U);!_&&(Math.abs(i)>1||Math.abs(s)>1)&&W(Math.abs(i)>Math.abs(s)?"x":"y");let d={x:0,y:0},c=t=>1/(1.5+Math.abs(t)/20);if("y"===_){if(l.includes("top")||l.includes("bottom"))if(l.includes("top")&&s<0||l.includes("bottom")&&s>0)d.y=s;else{let t=s*c(s);d.y=Math.abs(t)<Math.abs(s)?t:s}}else if("x"===_&&(l.includes("left")||l.includes("right")))if(l.includes("left")&&i<0||l.includes("right")&&i>0)d.x=i;else{let t=i*c(i);d.x=Math.abs(t)<Math.abs(i)?t:i}(Math.abs(d.x)>0||Math.abs(d.y)>0)&&ti(!0),null==(o=tm.current)||o.style.setProperty("--swipe-amount-x",`${d.x}px`),null==(n=tm.current)||n.style.setProperty("--swipe-amount-y",`${d.y}px`)}},tF&&!k.jsx&&"loading"!==tv?e.default.createElement("button",{"aria-label":K,"data-disabled":tB,"data-close-button":!0,onClick:tB||!tb?()=>{}:()=>{tR(),null==k.onDismiss||k.onDismiss.call(k,k)},className:h(null==X?void 0:X.closeButton,null==k||null==(c=k.classNames)?void 0:c.closeButton)},null!=(w=null==J?void 0:J.close)?w:d):null,(tv||k.icon||k.promise)&&null!==k.icon&&((null==J?void 0:J[tv])!==null||k.icon)?e.default.createElement("div",{"data-icon":"",className:h(null==X?void 0:X.icon,null==k||null==(u=k.classNames)?void 0:u.icon)},k.promise||"loading"===k.type&&!k.icon?k.icon||((null==J?void 0:J.loading)?e.default.createElement("div",{className:h(null==X?void 0:X.loader,null==k||null==(F=k.classNames)?void 0:F.loader,"sonner-loader"),"data-visible":"loading"===tv},J.loading):e.default.createElement(n,{className:h(null==X?void 0:X.loader,null==k||null==(x=k.classNames)?void 0:x.loader),visible:"loading"===tv})):null,"loading"!==k.type?t$:null):null,e.default.createElement("div",{"data-content":"",className:h(null==X?void 0:X.content,null==k||null==(f=k.classNames)?void 0:f.content)},e.default.createElement("div",{"data-title":"",className:h(null==X?void 0:X.title,null==k||null==(p=k.classNames)?void 0:p.title)},k.jsx?k.jsx:"function"==typeof k.title?k.title():k.title),k.description?e.default.createElement("div",{"data-description":"",className:h(A,tw,null==X?void 0:X.description,null==k||null==(g=k.classNames)?void 0:g.description)},"function"==typeof k.description?k.description():k.description):null),e.default.isValidElement(k.cancel)?k.cancel:k.cancel&&m(k.cancel)?e.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:k.cancelButtonStyle||I,onClick:t=>{!m(k.cancel)||tb&&(null==k.cancel.onClick||k.cancel.onClick.call(k.cancel,t),tR())},className:h(null==X?void 0:X.cancelButton,null==k||null==(v=k.classNames)?void 0:v.cancelButton)},k.cancel.label):null,e.default.isValidElement(k.action)?k.action:k.action&&m(k.action)?e.default.createElement("button",{"data-button":!0,"data-action":!0,style:k.actionButtonStyle||L,onClick:t=>{!m(k.action)||(null==k.action.onClick||k.action.onClick.call(k.action,t),t.defaultPrevented||tR())},className:h(null==X?void 0:X.actionButton,null==k||null==(b=k.classNames)?void 0:b.actionButton)},k.action.label):null)};function v(){if("u"<typeof window||"u"<typeof document)return"ltr";let t=document.documentElement.getAttribute("dir");return"auto"!==t&&t?t:window.getComputedStyle(document.documentElement).direction}let b=e.default.forwardRef(function(t,o){let{id:n,invert:r,position:s="bottom-right",hotkey:i=["altKey","KeyT"],expand:l,closeButton:d,className:c,offset:f,mobileOffset:p,theme:m="light",richColors:h,duration:b,style:y,visibleToasts:w=3,toastOptions:x,dir:F=v(),gap:E=14,icons:k,containerAriaLabel:S="Notifications"}=t,[C,P]=e.default.useState([]),T=e.default.useMemo(()=>n?C.filter(t=>t.toasterId===n):C.filter(t=>!t.toasterId),[C,n]),j=e.default.useMemo(()=>Array.from(new Set([s].concat(T.filter(t=>t.position).map(t=>t.position)))),[T,s]),[N,D]=e.default.useState([]),[M,B]=e.default.useState(!1),[R,$]=e.default.useState(!1),[z,I]=e.default.useState("system"!==m?m:"u">typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=e.default.useRef(null),Y=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=e.default.useRef(null),O=e.default.useRef(!1),U=e.default.useCallback(t=>{P(e=>{var a;return(null==(a=e.find(e=>e.id===t.id))?void 0:a.delete)||u.dismiss(t.id),e.filter(({id:e})=>e!==t.id)})},[]);return e.default.useEffect(()=>u.subscribe(t=>{t.dismiss?requestAnimationFrame(()=>{P(e=>e.map(e=>e.id===t.id?{...e,delete:!0}:e))}):setTimeout(()=>{a.default.flushSync(()=>{P(e=>{let a=e.findIndex(e=>e.id===t.id);return -1!==a?[...e.slice(0,a),{...e[a],...t},...e.slice(a+1)]:[t,...e]})})})}),[C]),e.default.useEffect(()=>{if("system"!==m)return void I(m);if("system"===m&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?I("dark"):I("light")),"u"<typeof window)return;let t=window.matchMedia("(prefers-color-scheme: dark)");try{t.addEventListener("change",({matches:t})=>{t?I("dark"):I("light")})}catch(e){t.addListener(({matches:t})=>{try{t?I("dark"):I("light")}catch(t){console.error(t)}})}},[m]),e.default.useEffect(()=>{C.length<=1&&B(!1)},[C]),e.default.useEffect(()=>{let t=t=>{var e,a;i.every(e=>t[e]||t.code===e)&&(B(!0),null==(a=L.current)||a.focus()),"Escape"===t.code&&(document.activeElement===L.current||(null==(e=L.current)?void 0:e.contains(document.activeElement)))&&B(!1)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[i]),e.default.useEffect(()=>{if(L.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,O.current=!1)}},[L.current]),e.default.createElement("section",{ref:o,"aria-label":`${S} ${Y}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},j.map((a,o)=>{var n;let s,[i,u]=a.split("-");return T.length?e.default.createElement("ol",{key:a,dir:"auto"===F?v():F,tabIndex:-1,ref:L,className:c,"data-sonner-toaster":!0,"data-sonner-theme":z,"data-y-position":i,"data-x-position":u,style:{"--front-toast-height":`${(null==(n=N[0])?void 0:n.height)||0}px`,"--width":"356px","--gap":`${E}px`,...y,...(s={},[f,p].forEach((t,e)=>{let a=1===e,o=a?"--mobile-offset":"--offset",n=a?"16px":"24px";function r(t){["top","right","bottom","left"].forEach(e=>{s[`${o}-${e}`]="number"==typeof t?`${t}px`:t})}"number"==typeof t||"string"==typeof t?r(t):"object"==typeof t?["top","right","bottom","left"].forEach(e=>{void 0===t[e]?s[`${o}-${e}`]=n:s[`${o}-${e}`]="number"==typeof t[e]?`${t[e]}px`:t[e]}):r(n)}),s)},onBlur:t=>{O.current&&!t.currentTarget.contains(t.relatedTarget)&&(O.current=!1,A.current&&(A.current.focus({preventScroll:!0}),A.current=null))},onFocus:t=>{!(t.target instanceof HTMLElement&&"false"===t.target.dataset.dismissible)&&(O.current||(O.current=!0,A.current=t.relatedTarget))},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{R||B(!1)},onDragEnd:()=>B(!1),onPointerDown:t=>{t.target instanceof HTMLElement&&"false"===t.target.dataset.dismissible||$(!0)},onPointerUp:()=>$(!1)},T.filter(t=>!t.position&&0===o||t.position===a).map((o,n)=>{var s,i;return e.default.createElement(g,{key:o.id,icons:k,index:n,toast:o,defaultRichColors:h,duration:null!=(s=null==x?void 0:x.duration)?s:b,className:null==x?void 0:x.className,descriptionClassName:null==x?void 0:x.descriptionClassName,invert:r,visibleToasts:w,closeButton:null!=(i=null==x?void 0:x.closeButton)?i:d,interacting:R,position:a,style:null==x?void 0:x.style,unstyled:null==x?void 0:x.unstyled,classNames:null==x?void 0:x.classNames,cancelButtonStyle:null==x?void 0:x.cancelButtonStyle,actionButtonStyle:null==x?void 0:x.actionButtonStyle,closeButtonAriaLabel:null==x?void 0:x.closeButtonAriaLabel,removeToast:U,toasts:T.filter(t=>t.position==o.position),heights:N.filter(t=>t.position==o.position),setHeights:D,expandByDefault:l,gap:E,expanded:M,swipeDirections:t.swipeDirections})})):null}))});t.s(["Toaster",0,b,"toast",0,p,"useSonner",0,function(){let[t,o]=e.default.useState([]);return e.default.useEffect(()=>u.subscribe(t=>{t.dismiss?setTimeout(()=>{a.default.flushSync(()=>{o(e=>e.filter(e=>e.id!==t.id))})}):setTimeout(()=>{a.default.flushSync(()=>{o(e=>{let a=e.findIndex(e=>e.id===t.id);return -1!==a?[...e.slice(0,a),{...e[a],...t},...e.slice(a+1)]:[t,...e]})})})}),[]),{toasts:t}}])},691223,t=>{"use strict";var e=t.i(816709);let a=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico"]),o=new Set([".mp4",".webm",".ogg",".mov"]),n=new Set([".mp3",".wav",".flac",".aac",".m4a",".opus"]),r=new Set([".svg"]),s=new Set([".md",".mdx"]);function i(t){let e="."+t.split(".").pop()?.toLowerCase();return a.has(e)?"image":o.has(e)?"video":n.has(e)?"audio":r.has(e)?"svg":s.has(e)?"markdown":null}let l="__commit_diff__:";function d(t){return t.startsWith(l)}function c(t){return t.slice(l.length)}let u=null;function f(){u&&(clearTimeout(u),u=null)}function p(t){f(),u=setTimeout(()=>{u=null,h.getState().saveEditorState(t)},500)}function m(t){return t.replace(/\r\n?/g,"\n")}let h=(0,e.create)((t,e)=>({tree:[],treeLoading:!1,loadingDirs:new Set,openFiles:[],modifiedFileContents:{},activeFilePath:null,pendingJump:null,revealPath:null,commitDiffs:{},loadTree:async e=>{t({treeLoading:!0});try{let a=await fetch(`/api/workspaces/${e}/files/tree?depth=1`),o=await a.json();t({tree:o,treeLoading:!1})}catch{t({treeLoading:!1})}},loadDirectory:async(a,o)=>{let{tree:n,loadingDirs:r}=e(),s=t=>{for(let e of t){if(e.path===o)return e;if(e.children){let t=s(e.children);if(t)return t}}};if(s(n)?.children!==void 0||r.has(o))return;let i=new Set(r);i.add(o),t({loadingDirs:i});try{let n=await fetch(`/api/workspaces/${a}/files/tree?path=${encodeURIComponent(o)}&depth=1`),r=await n.json(),s=t=>t.map(t=>t.path===o?{...t,children:r}:t.children?{...t,children:s(t.children)}:t),i=new Set(e().loadingDirs);i.delete(o),t({tree:s(e().tree),loadingDirs:i})}catch{let a=new Set(e().loadingDirs);a.delete(o),t({loadingDirs:a})}},openFile:async(a,o)=>{if(e().openFiles.find(t=>t.path===o)){t({activeFilePath:o}),p(a);return}let n=o.split("/").pop()||o,r=i(o);if(r&&"svg"!==r&&"markdown"!==r){t(t=>({openFiles:[...t.openFiles,{path:o,name:n,content:"",modified:!1,mediaType:r}],activeFilePath:o})),p(a);return}let s=await fetch(`/api/workspaces/${a}/files/content?path=${encodeURIComponent(o)}`),l=await s.json();t(t=>({openFiles:[...t.openFiles,{path:o,name:n,content:l.content,modified:!1,mediaType:r||void 0}],activeFilePath:o})),p(a)},saveFile:async(a,o)=>{let n=e().openFiles.find(t=>t.path===o);if(!n)return;let r=e().modifiedFileContents[o]??n.content;await fetch(`/api/workspaces/${a}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:o,content:r})}),t(t=>({openFiles:t.openFiles.map(t=>t.path===o?{...t,content:r,modified:!1}:t),modifiedFileContents:Object.fromEntries(Object.entries(t.modifiedFileContents).filter(([t])=>t!==o))}))},updateContent:(e,a)=>{t(t=>({openFiles:t.openFiles.map(t=>t.path!==e?t:{...t,modified:m(t.content)!==m(a)}),modifiedFileContents:(()=>{let o=t.openFiles.find(t=>t.path===e);if(!o)return t.modifiedFileContents;let n={...t.modifiedFileContents};return m(o.content)===m(a)?delete n[e]:n[e]=a,n})()}))},refreshFile:async(a,o)=>{let n=e().openFiles.find(t=>t.path===o);if(n&&!n.modified)try{let e=await fetch(`/api/workspaces/${a}/files/content?path=${encodeURIComponent(o)}`),r=await e.json();r.content!==n.content&&t(t=>({openFiles:t.openFiles.map(t=>t.path===o?{...t,content:r.content}:t)}))}catch{}},closeFile:(e,a)=>{t(t=>{let e=t.openFiles.filter(t=>t.path!==a),o=t.activeFilePath===a?e.length>0?e[e.length-1].path:null:t.activeFilePath,n={...t.commitDiffs};d(a)&&delete n[c(a)];let r={...t.modifiedFileContents};return delete r[a],{openFiles:e,activeFilePath:o,commitDiffs:n,modifiedFileContents:r}}),p(e)},setActiveFile:(e,a)=>{t({activeFilePath:a}),p(e)},jumpToPosition:async(a,o,n,r,s,i)=>{await e().openFile(a,o),t({pendingJump:{path:o,line:n,column:r,endLine:s,endColumn:i}})},clearPendingJump:()=>t({pendingJump:null}),setRevealPath:e=>t({revealPath:e}),clearRevealPath:()=>t({revealPath:null}),resetEditorState:()=>{f(),t({tree:[],treeLoading:!1,loadingDirs:new Set,openFiles:[],modifiedFileContents:{},activeFilePath:null,pendingJump:null,revealPath:null,commitDiffs:{}})},loadEditorState:async a=>{e().resetEditorState();try{let e=await fetch(`/api/workspaces/${a}/files/editor-state`),{openFilePaths:o=[],activeFilePath:n=null,pinnedPaths:r=[]}=await e.json();if(0===o.length)return void t({openFiles:[],activeFilePath:null,modifiedFileContents:{}});let s=new Set(r),l=[];for(let t of o)try{let e=t.split("/").pop()||t,o=i(t);if(o&&"svg"!==o&&"markdown"!==o)l.push({path:t,name:e,content:"",modified:!1,mediaType:o,pinned:s.has(t)||void 0});else{let n=await fetch(`/api/workspaces/${a}/files/content?path=${encodeURIComponent(t)}`),r=await n.json();l.push({path:t,name:e,content:r.content,modified:!1,mediaType:o||void 0,pinned:s.has(t)||void 0})}}catch{}let d=n&&l.find(t=>t.path===n)?n:l.length>0?l[l.length-1].path:null;t({openFiles:l,activeFilePath:d,commitDiffs:{},modifiedFileContents:{}})}catch{t({openFiles:[],activeFilePath:null,commitDiffs:{},modifiedFileContents:{}})}},saveEditorState:async t=>{let{openFiles:a,activeFilePath:o}=e(),n=a.filter(t=>!d(t.path)),r=o&&!d(o)?o:null,s=n.filter(t=>t.pinned).map(t=>t.path);try{await fetch(`/api/workspaces/${t}/files/editor-state`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({openFilePaths:n.map(t=>t.path),activeFilePath:r,pinnedPaths:s})})}catch{}},openCommitDiff:(e,a,o,n)=>{let r=l+a;t(t=>t.openFiles.find(t=>t.path===r)?{activeFilePath:r,commitDiffs:{...t.commitDiffs,[a]:{diffs:n,message:o}}}:{openFiles:[...t.openFiles,{path:r,name:a.slice(0,7),content:"",modified:!1}],activeFilePath:r,commitDiffs:{...t.commitDiffs,[a]:{diffs:n,message:o}}})},closeCommitDiff:(t,a)=>{let o=l+a;e().closeFile(t,o)},togglePin:(e,a)=>{t(t=>{let e=t.openFiles.map(t=>t.path===a?{...t,pinned:!t.pinned}:t);return{openFiles:[...e.filter(t=>t.pinned),...e.filter(t=>!t.pinned)]}}),p(e)},reorderFiles:(e,a)=>{t({openFiles:a}),p(e)},closeOthers:(e,a)=>{t(t=>{let e=t.openFiles.filter(t=>t.path===a||t.pinned),o=new Set(e.map(t=>t.path)),n=Object.fromEntries(Object.entries(t.modifiedFileContents).filter(([t])=>o.has(t)));return{openFiles:e,activeFilePath:e.some(e=>e.path===t.activeFilePath)?t.activeFilePath:a,modifiedFileContents:n}}),p(e)},closeToLeft:(e,a)=>{t(t=>{let e=t.openFiles.findIndex(t=>t.path===a);if(e<=0)return t;let o=t.openFiles.filter((t,a)=>a>=e||t.pinned),n=new Set(o.map(t=>t.path)),r=Object.fromEntries(Object.entries(t.modifiedFileContents).filter(([t])=>n.has(t)));return{openFiles:o,activeFilePath:o.some(e=>e.path===t.activeFilePath)?t.activeFilePath:a,modifiedFileContents:r}}),p(e)},closeToRight:(e,a)=>{t(t=>{let e=t.openFiles.findIndex(t=>t.path===a);if(e<0||e>=t.openFiles.length-1)return t;let o=t.openFiles.filter((t,a)=>a<=e||t.pinned),n=new Set(o.map(t=>t.path)),r=Object.fromEntries(Object.entries(t.modifiedFileContents).filter(([t])=>n.has(t)));return{openFiles:o,activeFilePath:o.some(e=>e.path===t.activeFilePath)?t.activeFilePath:a,modifiedFileContents:r}}),p(e)}}));t.s(["getCommitHashFromPath",0,c,"getMediaType",0,i,"isCommitDiffPath",0,d,"useEditorStore",0,h])}]);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,885761,e=>{"use strict";var t,n,s,a=e.i(344180),r=e.i(764556),l=e.i(244073),i=e.i(31807),o=e.i(355819),d=e.i(157408),c=e.i(159619),u=e.i(962562),m=e.i(137340),p=e.i(344118),x=e.i(444204),h=e.i(433721);let g=(0,h.default)("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]);var f=e.i(244996),v=e.i(668667);let j=(0,h.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);var y=e.i(209988),b=e.i(555060),N=e.i(611176),k=e.i(951841),w=e.i(996652),C=e.i(426022);let S=(0,h.default)("user-minus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);function T({open:e,onOpenChange:t,memberName:n,displayName:s,channelId:l,workspaceId:d,channels:c=[]}){let[u,m]=(0,r.useState)(!1),{channels:p,updateChannel:x}=(0,i.useChannelStore)(),h=(0,o.useAgentStore)(e=>e.agents),g="user"!==n?h.find(e=>e.id===n):void 0,f=s||g?.name||n,v=(0,k.useUserAvatar)(),j="user"===n?v:null,b=p.find(e=>e.id===l),w=b?.members.includes(n),M=async()=>{if(b&&w){m(!0);try{let e=(i.useChannelStore.getState().channels.find(e=>e.id===l)??b).members.filter(e=>e!==n);i.useChannelStore.setState(t=>({channels:t.channels.map(t=>t.id===l?{...t,members:e}:t)})),await x(d,l,{members:e}),t(!1)}finally{m(!1)}}};return(0,a.jsx)(y.Dialog,{open:e,onOpenChange:t,children:(0,a.jsxs)(y.DialogContent,{className:"sm:max-w-sm",children:[(0,a.jsxs)(y.DialogHeader,{children:[(0,a.jsx)(y.DialogTitle,{children:"成员信息"}),(0,a.jsx)(y.DialogDescription,{})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 pt-2",children:[(0,a.jsx)(N.AgentIcon,{agentId:"user"!==n?n:void 0,name:f,avatarUrl:j||void 0,className:"size-12 rounded-full"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium truncate",children:f}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"user"===n?"成员":g?.role||n})]})]}),c.length>0&&(0,a.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"所在频道"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:c.map(e=>(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:[(0,a.jsx)(C.MessageSquare,{className:"size-3"}),e]},e))})]}),w&&"user"!==n&&(0,a.jsxs)("button",{onClick:M,disabled:u,className:"flex items-center justify-center gap-2 w-full mt-2 px-3 py-2 rounded-md text-sm text-destructive hover:bg-destructive/10 disabled:opacity-50 transition-colors",children:[(0,a.jsx)(S,{className:"size-4"}),u?"移除中...":"从频道移除"]})]})})}var M=e.i(465458);let I=({size:e=16})=>(0,a.jsxs)("svg",{height:e,strokeLinejoin:"round",style:{color:"currentcolor"},viewBox:"0 0 16 16",width:e,children:[(0,a.jsx)("title",{children:"Loader"}),(0,a.jsxs)("g",{clipPath:"url(#clip0_2393_1490)",children:[(0,a.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,a.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),(0,a.jsx)("defs",{children:(0,a.jsx)("clipPath",{id:"clip0_2393_1490",children:(0,a.jsx)("rect",{fill:"white",height:"16",width:"16"})})})]}),z=({className:e,size:t=16,...n})=>(0,a.jsx)("div",{className:(0,M.cn)("inline-flex animate-spin items-center justify-center",e),...n,children:(0,a.jsx)(I,{size:t})});var D=e.i(946899),D=D;e.s([],352264),e.i(352264),e.i(8890);var R=e.i(535270),P=e.i(29905),A=e.i(756432),O=e.i(189131),E=e.i(267805);let $=r.createContext(void 0);function L(){let e=r.useContext($);if(void 0===e)throw Error((0,E.default)(10));return e}var U=e.i(969490),B=e.i(602453),F=e.i(742665);let W={value:()=>null},_=r.forwardRef(function(e,t){let{render:n,className:s,disabled:l=!1,hiddenUntilFound:i,keepMounted:o,loopFocus:d=!0,onValueChange:c,multiple:u=!1,orientation:m="vertical",value:p,defaultValue:x,style:h,...g}=e,f=(0,O.useDirection)(),v=r.useMemo(()=>{if(void 0===p)return x??[]},[p,x]),j=(0,P.useStableCallback)(c),y=r.useRef([]),[b,N]=(0,R.useControlled)({controlled:p,default:v,name:"Accordion",state:"value"}),k=(0,P.useStableCallback)((e,t)=>{let n=(0,B.createChangeEventDetails)(F.REASONS.none);if(u)if(t){let t=b.slice();if(t.push(e),j(t,n),n.isCanceled)return;N(t)}else{let t=b.filter(t=>t!==e);if(j(t,n),n.isCanceled)return;N(t)}else{let t=b[0]===e?[]:[e];if(j(t,n),n.isCanceled)return;N(t)}}),w=r.useMemo(()=>({value:b,disabled:l,orientation:m}),[b,l,m]),C=r.useMemo(()=>({accordionItemRefs:y,direction:f,disabled:l,handleValueChange:k,hiddenUntilFound:i??!1,keepMounted:o??!1,loopFocus:d,orientation:m,state:w,value:b}),[f,l,k,i,o,d,m,w,b]),S=(0,U.useRenderElement)("div",e,{state:w,ref:t,props:[{dir:f,role:"region"},g],stateAttributesMapping:W});return(0,a.jsx)($.Provider,{value:C,children:(0,a.jsx)(A.CompositeList,{elementsRef:y,children:S})})});var H=e.i(204133),q=e.i(139236),V=e.i(257295),G=e.i(619279),K=e.i(296615);let J=r.createContext(void 0);function Q(){let e=r.useContext(J);if(void 0===e)throw Error((0,E.default)(9));return e}var X=e.i(439485),Y=e.i(282458);let Z=((t={}).index="data-index",t.disabled="data-disabled",t.open="data-open",t),ee={...X.collapsibleOpenStateMapping,index:e=>Number.isInteger(e)?{[Z.index]:String(e)}:null,...Y.transitionStatusMapping,value:()=>null},et=r.forwardRef(function(e,t){let{className:n,disabled:s=!1,onOpenChange:l,render:i,value:o,style:d,...c}=e,{ref:u,index:m}=(0,K.useCompositeListItem)(),p=(0,H.useMergedRefs)(t,u),{disabled:x,handleValueChange:h,state:g,value:f}=L(),v=(0,q.useBaseUiId)(),j=o??v,y=s||x,b=r.useMemo(()=>{if(!f)return!1;for(let e=0;e<f.length;e+=1)if(f[e]===j)return!0;return!1},[f,j]),N=(0,P.useStableCallback)((e,t)=>{l?.(e,t),t.isCanceled||h(j,e)}),k=(0,V.useCollapsibleRoot)({open:b,onOpenChange:N,disabled:y}),w=r.useMemo(()=>({open:k.open,disabled:k.disabled,hidden:!k.mounted,transitionStatus:k.transitionStatus}),[k.open,k.disabled,k.mounted,k.transitionStatus]),C=r.useMemo(()=>({...k,onOpenChange:N,state:w}),[k,w,N]),S=r.useMemo(()=>({...g,index:m,disabled:y,open:b}),[y,m,b,g]),[T,M]=r.useState((0,q.useBaseUiId)()),I=r.useMemo(()=>({open:b,state:S,setTriggerId:M,triggerId:T}),[b,S,M,T]),z=(0,U.useRenderElement)("div",e,{state:S,ref:p,props:c,stateAttributesMapping:ee});return(0,a.jsx)(G.CollapsibleRootContext.Provider,{value:C,children:(0,a.jsx)(J.Provider,{value:I,children:z})})}),en=r.forwardRef(function(e,t){let{render:n,className:s,style:a,...r}=e,{state:l}=Q();return(0,U.useRenderElement)("h3",e,{state:l,ref:t,props:r,stateAttributesMapping:ee})});var es=e.i(568769),ea=e.i(277642),er=e.i(931709),el=e.i(100229),ei=e.i(150129);let eo=new Set([el.ARROW_DOWN,el.ARROW_UP,el.ARROW_RIGHT,el.ARROW_LEFT,el.HOME,el.END]),ed=r.forwardRef(function(e,t){let{disabled:n,className:s,id:a,render:l,nativeButton:i=!0,style:o,...d}=e,{panelId:c,open:u,handleTrigger:m,disabled:p}=(0,G.useCollapsibleRootContext)(),{getButtonProps:x,buttonRef:h}=(0,er.useButton)({disabled:n??p,focusableWhenDisabled:!0,native:i,composite:!0}),{accordionItemRefs:g,direction:f,loopFocus:v,orientation:j}=L(),y="rtl"===f,b="horizontal"===j,{state:N,setTriggerId:k,triggerId:w}=Q();(0,ea.useIsoLayoutEffect)(()=>(a&&k(a),()=>{k(void 0)}),[a,k]);let C=r.useMemo(()=>({"aria-controls":u?c:void 0,"aria-expanded":u,id:w,tabIndex:0,onClick:m,onKeyDown(e){if(!eo.has(e.key))return;(0,ei.stopEvent)(e);let t=function(e){let{current:t}=e,n=[];for(let e=0;e<t.length;e+=1){let s=t[e];if(!(0,es.isElementDisabled)(s)){let e=s?.querySelector('[type="button"], [role="button"]');e&&!(0,es.isElementDisabled)(e)&&n.push(e)}}return n}(g),n=t.length-1,s=-1,a=t.indexOf(e.currentTarget);function r(){s=v?a+1>n?0:a+1:Math.min(a+1,n)}function l(){s=v&&0===a?n:a-1}switch(e.key){case el.ARROW_DOWN:b||r();break;case el.ARROW_UP:b||l();break;case el.ARROW_RIGHT:b&&(y?l():r());break;case el.ARROW_LEFT:b&&(y?r():l());break;case"Home":s=0;break;case"End":s=n}s>-1&&t[s].focus()}}),[g,m,w,b,y,v,u,c]);return(0,U.useRenderElement)("button",e,{state:N,ref:[t,h],props:[C,d,x],stateAttributesMapping:X.triggerOpenStateMapping})});var ec=e.i(18158);let eu=((n={}).accordionPanelHeight="--accordion-panel-height",n.accordionPanelWidth="--accordion-panel-width",n);var em=e.i(273598);let ep=r.forwardRef(function(e,t){let{className:n,hiddenUntilFound:s,keepMounted:a,id:l,render:i,style:o,...d}=e,{hiddenUntilFound:c,keepMounted:u}=L(),{abortControllerRef:m,animationTypeRef:p,height:x,mounted:h,onOpenChange:g,open:f,panelId:v,panelRef:j,runOnceAnimationsFinish:y,setDimensions:b,setHiddenUntilFound:N,setKeepMounted:k,setMounted:w,setOpen:C,setVisible:S,transitionDimensionRef:T,visible:M,width:I,setPanelIdState:z,transitionStatus:D}=(0,G.useCollapsibleRootContext)(),R=s??c,P=a??u;(0,ea.useIsoLayoutEffect)(()=>{if(l)return z(l),()=>{z(void 0)}},[l,z]),(0,ea.useIsoLayoutEffect)(()=>{N(R)},[N,R]),(0,ea.useIsoLayoutEffect)(()=>{k(P)},[k,P]),(0,em.useOpenChangeComplete)({open:f&&"idle"===D,ref:j,onComplete(){f&&b({width:void 0,height:void 0})}});let{props:A}=(0,ec.useCollapsiblePanel)({abortControllerRef:m,animationTypeRef:p,externalRef:t,height:x,hiddenUntilFound:R,id:l??v,keepMounted:P,mounted:h,onOpenChange:g,open:f,panelRef:j,runOnceAnimationsFinish:y,setDimensions:b,setMounted:w,setOpen:C,setVisible:S,transitionDimensionRef:T,visible:M,width:I}),{state:O,triggerId:E}=Q(),$=r.useMemo(()=>({...O,transitionStatus:D}),[O,D]),B=(0,U.useRenderElement)("div",e,{state:$,ref:[t,j],props:[A,{"aria-labelledby":E,role:"region",style:{[eu.accordionPanelHeight]:void 0===x?"auto":`${x}px`,[eu.accordionPanelWidth]:void 0===I?"auto":`${I}px`}},d],stateAttributesMapping:ee});return P||R||h?B:null});e.s(["Header",0,en,"Item",0,et,"Panel",0,ep,"Root",0,_,"Trigger",0,ed],127284);var ex=e.i(127284),ex=ex,eh=e.i(250438),eg=e.i(380797),eg=eg;function ef({className:e,...t}){return(0,a.jsx)(ex.Root,{"data-slot":"accordion",className:(0,M.cn)("flex w-full flex-col",e),...t})}function ev({className:e,...t}){return(0,a.jsx)(ex.Item,{"data-slot":"accordion-item",className:(0,M.cn)("not-last:border-b",e),...t})}function ej({className:e,children:t,...n}){return(0,a.jsx)(ex.Header,{className:"flex",children:(0,a.jsxs)(ex.Trigger,{"data-slot":"accordion-trigger",className:(0,M.cn)("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...n,children:[t,(0,a.jsx)(eh.ChevronDownIcon,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),(0,a.jsx)(eg.default,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function ey({className:e,children:t,...n}){return(0,a.jsx)(ex.Panel,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...n,children:(0,a.jsx)("div",{className:(0,M.cn)("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:t})})}var eb=e.i(562918);let eN=(0,r.memo)(({className:e,...t})=>(0,a.jsx)("div",{className:(0,M.cn)("not-prose w-full rounded-md border",e),...t})),ek=(0,r.memo)(({className:e,name:t,model:n,...s})=>(0,a.jsx)("div",{className:(0,M.cn)("flex w-full items-center justify-between gap-4 p-3",e),...s,children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(D.default,{className:"size-4 text-muted-foreground"}),(0,a.jsx)("span",{className:"font-medium text-sm",children:t}),n&&(0,a.jsx)(eb.Badge,{className:"font-mono text-xs",variant:"secondary",children:n})]})})),ew=(0,r.memo)(({className:e,...t})=>(0,a.jsx)("div",{className:(0,M.cn)("space-y-4 p-4 pt-0",e),...t})),eC=(0,r.memo)(({className:e,children:t,...n})=>{let s=(0,l.useTranslations)("chat");return(0,a.jsxs)("div",{className:(0,M.cn)("space-y-2",e),...n,children:[(0,a.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:s("subagent.instructions")}),(0,a.jsx)("div",{className:"rounded-md bg-muted/50 p-3 text-muted-foreground text-sm",children:(0,a.jsx)("p",{children:t})})]})}),eS=(0,r.memo)(({className:e,...t})=>{let n=(0,l.useTranslations)("chat");return(0,a.jsxs)("div",{className:(0,M.cn)("space-y-2",e),children:[(0,a.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:n("subagent.tools")}),(0,a.jsx)(ef,{className:"rounded-md border",multiple:!0,...t})]})}),eT=(0,r.memo)(({className:e,tool:t,value:n,...s})=>{let r="jsonSchema"in t&&t.jsonSchema?t.jsonSchema:t.inputSchema,i=(0,l.useTranslations)("chat");return(0,a.jsxs)(ev,{className:(0,M.cn)("border-b last:border-b-0",e),value:n,...s,children:[(0,a.jsx)(ej,{className:"px-3 py-2 text-sm hover:no-underline",children:t.description??i("subagent.noDescription")}),(0,a.jsx)(ey,{className:"px-3 pb-3",children:(0,a.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,a.jsx)("pre",{className:"overflow-auto p-3 font-mono text-xs",children:JSON.stringify(r,null,2)})})})]})}),eM=(0,r.memo)(({className:e,schema:t,...n})=>{let s=(0,l.useTranslations)("chat");return(0,a.jsxs)("div",{className:(0,M.cn)("space-y-2",e),...n,children:[(0,a.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:s("subagent.outputSchema")}),(0,a.jsx)("div",{className:"rounded-md bg-muted/50",children:(0,a.jsx)("pre",{className:"overflow-auto p-3 font-mono text-xs",children:t})})]})});eN.displayName="Agent",ek.displayName="AgentHeader",ew.displayName="AgentContent",eC.displayName="AgentInstructions",eS.displayName="AgentTools",eT.displayName="AgentTool",eM.displayName="AgentOutput";var eI=e.i(905724),eI=eI,ez=e.i(551157),ez=ez;let eD=(0,h.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),eR=(0,h.default)("music-2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]),eP=(0,h.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),eA=(0,h.default)("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);var eO=e.i(422373),eE=e.i(260218);e.s([],339090),e.i(339090);var e$=e.i(166392),eL=e.i(538501),eU=e.i(427396),eB=e.i(389124);let eF=r.createContext(void 0);function eW(e){let t=r.useContext(eF);if(void 0===t&&!e)throw Error((0,E.default)(50));return t}var e_=e.i(106206),eH=e.i(332976),eq=e.i(493696),eV=e.i(549154),eG=e.i(695011),eK=e.i(561213),eJ=e.i(107164);let eQ={...eG.popupStoreSelectors,instantType:(0,eH.createSelector)(e=>e.instantType),hasViewport:(0,eH.createSelector)(e=>e.hasViewport)};class eX extends eq.ReactStore{constructor(e){super({...(0,eG.createInitialPopupStoreState)(),instantType:void 0,hasViewport:!1,...e},{popupRef:r.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new eK.PopupTriggerMap,closeDelayRef:{current:300}},eQ)}setOpen=(e,t)=>{let n=t.reason,s=n===F.REASONS.triggerHover,a=e&&n===F.REASONS.triggerFocus,r=!e&&(n===F.REASONS.triggerPress||n===F.REASONS.escapeKey);if(t.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let l=()=>{let s={open:e};a?s.instantType="focus":r?s.instantType="dismiss":n===F.REASONS.triggerHover&&(s.instantType=void 0);let l=t.trigger?.id??null;(l||e)&&(s.activeTriggerId=l,s.activeTriggerElement=t.trigger??null),this.update(s)};s?e_.flushSync(l):l()};static useStore(e,t){let n=(0,eV.useRefWithInit)(()=>new eX(t)).current,s=e??n,a=(0,eJ.useSyncedFloatingRootContext)({popupStore:s,onOpenChange:s.setOpen});return s.state.floatingRootContext=a,s}}var eY=e.i(279501);function eZ(e){let{open:t,defaultOpen:n=!1,onOpenChange:s,onOpenChangeComplete:l,actionsRef:i,handle:o,triggerId:d,defaultTriggerId:c=null,children:u}=e,m=eX.useStore(o?.store,{open:n,openProp:t,activeTriggerId:c,triggerIdProp:d});(0,e$.useOnFirstRender)(()=>{void 0===t&&!1===m.state.open&&!0===n&&m.update({open:!0,activeTriggerId:c})}),m.useControlledProp("openProp",t),m.useControlledProp("triggerIdProp",d),m.useContextCallback("onOpenChange",s),m.useContextCallback("onOpenChangeComplete",l);let p=m.useState("open"),x=m.select("floatingRootContext"),h=m.useState("activeTriggerId"),g=m.useState("payload");(0,eY.useImplicitActiveTrigger)(m);let{forceUnmount:f}=(0,eY.useOpenStateTransitions)(p,m);(0,ea.useIsoLayoutEffect)(()=>{p&&null==h&&m.set("payload",void 0)},[m,h,p]);let v=r.useCallback(()=>{m.setOpen(!1,(0,B.createChangeEventDetails)(F.REASONS.imperativeAction))},[m]);r.useImperativeHandle(i,()=>({unmount:f,close:v}),[f,v]);let j=(0,eL.useDismiss)(x),{getReferenceProps:y,getTriggerProps:b,getFloatingProps:N}=(0,eU.useInteractions)([j]),k=r.useMemo(()=>y(),[y]),w=r.useMemo(()=>b(),[b]),C=r.useMemo(()=>N(),[N]);return m.useSyncedValues({activeTriggerProps:k,inactiveTriggerProps:w,popupProps:C}),(0,a.jsx)(eF.Provider,{value:m,children:"function"==typeof u?u({payload:g}):u})}let e0=r.createContext(void 0);var e1=e.i(384389);let e2=r.forwardRef(function(e,t){let{keepMounted:n=!1,...s}=e;return eW().useState("mounted")||n?(0,a.jsx)(e0.Provider,{value:n,children:(0,a.jsx)(e1.FloatingPortalLite,{ref:t,...s})}):null});var e3=e.i(817955),e5=e.i(499198),e4=e.i(604921),e6=e.i(480283);let e9=r.forwardRef(function(e,t){let{render:n,className:s,delay:a,closeDelay:l,id:i,payload:o,handle:d,style:c,...u}=e,m=eW(!0),p=d?.store??m;if(!p)throw Error((0,E.default)(89));let x=(0,q.useBaseUiId)(i),h=p.useState("isTriggerActive",x),g=p.useState("isOpenedByTrigger",x),f=p.useState("floatingRootContext"),v=r.useRef(null),j=a??600,y=l??300,{registerTrigger:b,isMountedByThisTrigger:N}=(0,eY.useTriggerDataForwarding)(x,v,p,{payload:o});(0,ea.useIsoLayoutEffect)(()=>{N&&(p.context.closeDelayRef.current=y)},[p,N,y]);let k=(0,e6.useHoverReferenceInteraction)(f,{mouseOnly:!0,move:!1,handleClose:(0,e5.safePolygon)(),delay:()=>({open:j,close:y}),triggerElementRef:v,isActiveTrigger:h,isClosing:()=>"ending"===p.select("transitionStatus")}),w=(0,e4.useFocus)(f,{delay:j}),C=p.useState("triggerProps",N);return(0,U.useRenderElement)("a",e,{state:{open:g},ref:[t,b,v],props:[k,w.reference,C,{id:x},u],stateAttributesMapping:e3.triggerOpenStateMapping})}),e8=r.createContext(void 0);function e7(){let e=r.useContext(e8);if(void 0===e)throw Error((0,E.default)(49));return e}var te=e.i(576557),tt=e.i(576487),tn=e.i(909852),ts=e.i(263635);let ta=r.forwardRef(function(e,t){let{render:n,className:s,anchor:l,positionMethod:i="absolute",side:o="bottom",align:d="center",sideOffset:c=0,alignOffset:u=0,collisionBoundary:m="clipping-ancestors",collisionPadding:p=5,arrowPadding:x=5,sticky:h=!1,disableAnchorTracking:g=!1,collisionAvoidance:f=tt.POPUP_COLLISION_AVOIDANCE,style:v,...j}=e,y=eW(),b=function(){let e=r.useContext(e0);if(void 0===e)throw Error((0,E.default)(48));return e}(),N=(0,eB.useFloatingNodeId)(),k=y.useState("open"),w=y.useState("mounted"),C=y.useState("floatingRootContext"),S=y.useState("instantType"),T=y.useState("transitionStatus"),M=y.useState("hasViewport"),I=(0,te.useAnchorPositioning)({anchor:l,floatingRootContext:C,positionMethod:i,mounted:w,side:o,sideOffset:c,align:d,alignOffset:u,arrowPadding:x,collisionBoundary:m,collisionPadding:p,sticky:h,disableAnchorTracking:g,keepMounted:b,nodeId:N,collisionAvoidance:f,adaptiveOrigin:M?tn.adaptiveOrigin:void 0}),z={open:k,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:S},D=(0,ts.usePositioner)(e,z,{styles:I.positionerStyles,transitionStatus:T,props:j,refs:[t,y.useStateSetter("positionerElement")],hidden:!w,inert:!k});return(0,a.jsx)(e8.Provider,{value:I,children:(0,a.jsx)(eB.FloatingNode,{id:N,children:D})})});var tr=e.i(328657),tl=e.i(795914);let ti={...e3.popupStateMapping,...Y.transitionStatusMapping},to=r.forwardRef(function(e,t){let{className:n,render:s,style:a,...r}=e,l=eW(),{side:i,align:o}=e7(),d=l.useState("open"),c=l.useState("instantType"),u=l.useState("transitionStatus"),m=l.useState("popupProps"),p=l.useState("floatingRootContext");(0,em.useOpenChangeComplete)({open:d,ref:l.context.popupRef,onComplete(){d&&l.context.onOpenChangeComplete?.(!0)}});let x=(0,P.useStableCallback)(()=>l.context.closeDelayRef.current);return(0,tl.useHoverFloatingInteraction)(p,{closeDelay:x}),(0,U.useRenderElement)("div",e,{state:{open:d,side:i,align:o,instant:c,transitionStatus:u},ref:[t,l.context.popupRef,l.useStateSetter("popupElement")],props:[m,(0,tr.getDisabledMountTransitionStyles)(u),r],stateAttributesMapping:ti})}),td=r.forwardRef(function(e,t){let{render:n,className:s,style:a,...r}=e,l=eW(),{arrowRef:i,side:o,align:d,arrowUncentered:c,arrowStyles:u}=e7(),m=l.useState("open");return(0,U.useRenderElement)("div",e,{state:{open:m,side:o,align:d,uncentered:c},ref:[i,t],props:[{style:u,"aria-hidden":!0},r],stateAttributesMapping:e3.popupStateMapping})}),tc={...e3.popupStateMapping,...Y.transitionStatusMapping},tu=r.forwardRef(function(e,t){let{render:n,className:s,style:a,...r}=e,l=eW(),i=l.useState("open"),o=l.useState("mounted"),d=l.useState("transitionStatus");return(0,U.useRenderElement)("div",e,{state:{open:i,transitionStatus:d},ref:[t],props:[{role:"presentation",hidden:!o,style:{pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none"}},r],stateAttributesMapping:tc})}),tm=((s={}).popupWidth="--popup-width",s.popupHeight="--popup-height",s);var tp=e.i(3310);let tx={activationDirection:e=>e?{"data-activation-direction":e}:null},th=r.forwardRef(function(e,t){let{render:n,className:s,style:a,children:r,...l}=e,i=eW(),o=e7(),d=i.useState("instantType"),{children:c,state:u}=(0,tp.usePopupViewport)({store:i,side:o.side,cssVars:tm,children:r}),m={activationDirection:u.activationDirection,transitioning:u.transitioning,instant:d};return(0,U.useRenderElement)("div",e,{state:m,ref:t,props:[l,{children:c}],stateAttributesMapping:tx})});class tg{constructor(){this.store=new eX}open(e){let t=e?this.store.context.triggerElements.getById(e):void 0;if(e&&!t)throw Error((0,E.default)(88,e));this.store.setOpen(!0,(0,B.createChangeEventDetails)(F.REASONS.imperativeAction,void 0,t))}close(){this.store.setOpen(!1,(0,B.createChangeEventDetails)(F.REASONS.imperativeAction,void 0,void 0))}get isOpen(){return this.store.state.open}}e.s(["Arrow",0,td,"Backdrop",0,tu,"Handle",0,tg,"Popup",0,to,"Portal",0,e2,"Positioner",0,ta,"Root",0,function(e){return eW(!0)?(0,a.jsx)(eZ,{...e}):(0,a.jsx)(eB.FloatingTree,{children:(0,a.jsx)(eZ,{...e})})},"Trigger",0,e9,"Viewport",0,th,"createHandle",0,function(){return new tg}],981923),e.i(981923);let tf=e=>{if("source-document"===e.type)return"source";let t=e.mediaType??"";return t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/")||t.startsWith("text/")?"document":"unknown"},tv=(0,r.createContext)(null),tj=(0,r.createContext)(null),ty=()=>{let e=(0,r.useContext)(tj);if(!e)throw Error("Attachment components must be used within <Attachment>");return e},tb=({variant:e="grid",className:t,children:n,...s})=>{let l=(0,r.useMemo)(()=>({variant:e}),[e]);return(0,a.jsx)(tv.Provider,{value:l,children:(0,a.jsx)("div",{className:(0,M.cn)("flex items-start","list"===e?"flex-col gap-2":"flex-wrap gap-2","grid"===e&&"ml-auto w-fit",t),...s,children:n})})},tN=({data:e,onRemove:t,className:n,children:s,...l})=>{let{variant:i}=(0,r.useContext)(tv)??{variant:"grid"},o=tf(e),d=(0,r.useMemo)(()=>({data:e,mediaCategory:o,onRemove:t,variant:i}),[e,o,t,i]);return(0,a.jsx)(tj.Provider,{value:d,children:(0,a.jsx)("div",{className:(0,M.cn)("group relative","grid"===i&&"size-24 overflow-hidden rounded-lg","inline"===i&&["flex h-8 cursor-pointer select-none items-center gap-1.5","rounded-md border border-border px-1.5","font-medium text-sm transition-all","hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"],"list"===i&&["flex w-full items-center gap-3 rounded-lg border p-3","hover:bg-accent/50"],n),...l,children:s})})},tk=({fallbackIcon:e,className:t,...n})=>{let{data:s,mediaCategory:r,variant:l}=ty(),i="inline"===l?"size-3":"size-4";return(0,a.jsx)("div",{className:(0,M.cn)("flex shrink-0 items-center justify-center overflow-hidden","grid"===l&&"size-full bg-muted","inline"===l&&"size-5 rounded bg-background","list"===l&&"size-12 rounded bg-muted",t),...n,children:(()=>{if("image"===r&&"file"===s.type&&s.url){let e,t;return e=s.url,t=s.filename,"grid"===l?(0,a.jsx)("img",{alt:t||"Image",className:"size-full object-cover",height:96,src:e,width:96}):(0,a.jsx)("img",{alt:t||"Image",className:"size-full rounded object-cover",height:20,src:e,width:20})}if("video"===r&&"file"===s.type&&s.url)return(0,a.jsx)("video",{className:"size-full object-cover",muted:!0,src:s.url});let t={image:eD,video:eA,audio:eR,source:ez.default,document:eI.default,unknown:eP}[r];return e??(0,a.jsx)(t,{className:(0,M.cn)(i,"text-muted-foreground")})})()})},tw=({showMediaType:e=!1,className:t,...n})=>{let{data:s,variant:r}=ty(),i=function(e){let t=(0,l.useTranslations)("chat");if("source-document"===e.type)return e.title||e.filename||t("attachments.source");let n=tf(e);return e.filename||t("image"===n?"attachments.image":"attachments.attachment")}(s);return"grid"===r?null:(0,a.jsxs)("div",{className:(0,M.cn)("min-w-0 flex-1",t),...n,children:[(0,a.jsx)("span",{className:"block truncate",children:i}),e&&s.mediaType&&(0,a.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:s.mediaType})]})},tC=({label:e,className:t,children:n,...s})=>{let{onRemove:r,variant:i}=ty(),o=(0,l.useTranslations)("chat"),d=e??o("attachments.remove");return r?(0,a.jsxs)(eE.Button,{"aria-label":d,className:(0,M.cn)("grid"===i&&["absolute top-2 right-2 size-6 rounded-full p-0","bg-background/80 backdrop-blur-sm","opacity-0 transition-opacity group-hover:opacity-100","hover:bg-background","[&>svg]:size-3"],"inline"===i&&["size-5 rounded p-0","opacity-0 transition-opacity group-hover:opacity-100","[&>svg]:size-2.5"],"list"===i&&["size-8 shrink-0 rounded p-0","[&>svg]:size-4"],t),onClick:e=>{e.stopPropagation(),r()},type:"button",variant:"ghost",...s,children:[n??(0,a.jsx)(eO.XIcon,{}),(0,a.jsx)("span",{className:"sr-only",children:d})]}):null};function tS({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,M.cn)("rounded-lg border bg-background p-3 text-sm",e),...t})}function tT({className:e,...t}){return(0,a.jsx)("div",{"data-slot":"alert-description",className:(0,M.cn)("text-muted-foreground",e),...t})}let tM=(0,r.createContext)(null),tI=()=>{let e=(0,r.useContext)(tM);if(!e)throw Error("Confirmation components must be used within Confirmation");return e},tz=({className:e,approval:t,state:n,...s})=>t&&"input-streaming"!==n&&"input-available"!==n?(0,a.jsx)(tM.Provider,{value:{approval:t,state:n},children:(0,a.jsx)(tS,{className:(0,M.cn)("flex flex-col gap-2",e),...s})}):null,tD=({className:e,...t})=>(0,a.jsx)(tT,{className:(0,M.cn)("inline",e),...t}),tR=({children:e})=>{let{state:t}=tI();return"approval-requested"!==t?null:e},tP=({children:e})=>{let{approval:t,state:n}=tI();return t?.approved&&("approval-responded"===n||"output-denied"===n||"output-available"===n)?e:null},tA=({children:e})=>{let{approval:t,state:n}=tI();return t?.approved!==!1||"approval-responded"!==n&&"output-denied"!==n&&"output-available"!==n?null:e},tO=({className:e,...t})=>{let{state:n}=tI();return"approval-requested"!==n?null:(0,a.jsx)("div",{className:(0,M.cn)("flex items-center justify-end gap-2 self-end",e),...t})},tE=e=>(0,a.jsx)(eE.Button,{className:"h-8 px-3 text-sm",type:"button",...e});var t$=e.i(757106),t$=t$;let tL=(0,h.default)("dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]]);var tU=e.i(256186);let tB=(0,r.createContext)(null);function tF(e){let t=e.trim(),n=t.replace(/^\[[^\]]+\]\s+subagent progress\s+\|\s*/i,""),s=n!==t;return/^Claude$/i.test(n)||/^(Reading|Searching)(\.{1,3}|…)?$/i.test(n)||s&&/^(Reading|Searching)\s+\S.+$/i.test(n)||/^(Read|Search|Grep|Glob|SemanticSearch|WebSearch)\s+running\s+\(\d+s\)$/i.test(n)}let tW=()=>{let e=(0,r.useContext)(tB);if(!e)throw Error("ChainOfThought components must be used within ChainOfThought");return e},t_=(0,r.memo)(({className:e,open:t,defaultOpen:n=!1,onOpenChange:s,children:l,...i})=>{let[o,d]=(0,r.useState)(n),c=t??o,u=(0,r.useCallback)(e=>{void 0===t&&d(e),s?.(e)},[s,t]),m=(0,r.useMemo)(()=>({isOpen:c,setIsOpen:u}),[c,u]);return(0,a.jsx)(tB.Provider,{value:m,children:(0,a.jsx)("div",{className:(0,M.cn)("not-prose max-w-prose overflow-hidden space-y-4",e),...i,children:l})})}),tH=(0,r.memo)(({className:e,children:t,loading:n,...s})=>{let{isOpen:r,setIsOpen:i}=tW(),o=(0,l.useTranslations)("chat");return(0,a.jsx)(tU.Collapsible,{onOpenChange:i,open:r,children:(0,a.jsxs)(tU.CollapsibleTrigger,{className:(0,M.cn)("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...s,children:[(0,a.jsx)(t$.default,{className:"size-4"}),(0,a.jsx)("span",{className:"flex-1 text-left",children:t??o("chainOfThought.defaultHeader")}),n&&(0,a.jsx)(z,{size:14}),(0,a.jsx)(eh.ChevronDownIcon,{className:(0,M.cn)("size-4 transition-transform",r?"rotate-180":"rotate-0")})]})})}),tq=(0,r.memo)(({className:e,icon:t=tL,label:n,description:s,status:r="complete",children:l,...i})=>(0,a.jsxs)("div",{className:(0,M.cn)("flex gap-2 text-sm",{complete:"text-muted-foreground",active:"text-foreground",pending:"text-muted-foreground/50"}[r],"fade-in-0 slide-in-from-top-2 animate-in",e),...i,children:[(0,a.jsxs)("div",{className:"relative mt-0.5",children:[(0,a.jsx)(t,{className:"size-4"}),(0,a.jsx)("div",{className:"-mx-px absolute top-7 bottom-0 left-1/2 w-px bg-border"})]}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,a.jsx)("div",{children:n}),s&&(0,a.jsx)("div",{className:"text-muted-foreground text-xs",children:s}),l]})]})),tV=(0,r.memo)(({className:e,...t})=>(0,a.jsx)("div",{className:(0,M.cn)("flex flex-wrap items-center gap-2",e),...t})),tG=(0,r.memo)(({className:e,children:t,...n})=>(0,a.jsx)(eb.Badge,{className:(0,M.cn)("gap-1 px-2 py-0.5 font-normal text-xs",e),variant:"secondary",...n,children:t})),tK=(0,r.memo)(({className:e,children:t,...n})=>{let{isOpen:s}=tW();return(0,a.jsx)(tU.Collapsible,{open:s,children:(0,a.jsx)(tU.CollapsibleContent,{className:(0,M.cn)("mt-2 space-y-3","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t})})}),tJ=(0,r.memo)(({className:e,children:t,caption:n,...s})=>(0,a.jsxs)("div",{className:(0,M.cn)("mt-2 space-y-2",e),...s,children:[(0,a.jsx)("div",{className:"relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3",children:t}),n&&(0,a.jsx)("p",{className:"text-muted-foreground text-xs",children:n})]}));t_.displayName="ChainOfThought",tH.displayName="ChainOfThoughtHeader",tq.displayName="ChainOfThoughtStep",tV.displayName="ChainOfThoughtSearchResults",tG.displayName="ChainOfThoughtSearchResult",tK.displayName="ChainOfThoughtContent",tJ.displayName="ChainOfThoughtImage";var tQ=e.i(299648),tX=e.i(839374),tX=tX,tY=e.i(184591),tY=tY,tZ=e.i(875350),t0=e.i(341807);let t1=(0,r.memo)(({children:e,as:t="p",className:n,duration:s=2,spread:l=2})=>{let i=(0,r.useMemo)(()=>(e?.length??0)*l,[e,l]);return(0,a.jsx)(t,{children:(0,a.jsx)(t0.motion.span,{animate:{backgroundPosition:"0% center"},className:(0,M.cn)("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",n),initial:{backgroundPosition:"100% center"},style:{"--spread":`${i}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:1/0,duration:s,ease:"linear"},children:e})})}),t2=(0,r.createContext)({output:"",isStreaming:!1,autoScroll:!0}),t3=({output:e,isStreaming:t=!1,autoScroll:n=!0,onClear:s,className:r,children:l,...i})=>(0,a.jsx)(t2.Provider,{value:{output:e,isStreaming:t,autoScroll:n,onClear:s},children:(0,a.jsx)("div",{className:(0,M.cn)("flex flex-col overflow-hidden rounded-lg border bg-zinc-950 text-zinc-100",r),...i,children:l??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t5,{children:[(0,a.jsx)(t4,{}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(t6,{}),(0,a.jsxs)(t9,{children:[(0,a.jsx)(t8,{}),s&&(0,a.jsx)(t7,{})]})]})]}),(0,a.jsx)(ne,{})]})})}),t5=({className:e,children:t,...n})=>(0,a.jsx)("div",{className:(0,M.cn)("flex items-center justify-between border-zinc-800 border-b px-4 py-2",e),...n,children:t}),t4=({className:e,children:t,...n})=>{let s=(0,l.useTranslations)("chat");return(0,a.jsxs)("div",{className:(0,M.cn)("flex items-center gap-2 text-sm text-zinc-400",e),...n,children:[(0,a.jsx)(tY.default,{className:"size-4"}),t??s("terminal.title")]})},t6=({className:e,children:t,...n})=>{let{isStreaming:s}=(0,r.useContext)(t2),i=(0,l.useTranslations)("chat");return s?(0,a.jsx)("div",{className:(0,M.cn)("flex items-center gap-2 text-xs text-zinc-400",e),...n,children:t??(0,a.jsx)(t1,{className:"w-16",children:i("terminal.running")})}):null},t9=({className:e,children:t,...n})=>(0,a.jsx)("div",{className:(0,M.cn)("flex items-center gap-1",e),...n,children:t}),t8=({onCopy:e,onError:t,timeout:n=2e3,children:s,className:i,...o})=>{let[d,c]=(0,r.useState)(!1),{output:u}=(0,r.useContext)(t2),m=(0,l.useTranslations)("chat"),p=async()=>{if(!navigator?.clipboard?.writeText)return void t?.(Error(m("terminal.clipboardUnavailable")));try{await navigator.clipboard.writeText(u),c(!0),e?.(),setTimeout(()=>c(!1),n)}catch(e){t?.(e)}},x=d?tQ.CheckIcon:tX.default;return(0,a.jsx)(eE.Button,{className:(0,M.cn)("size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",i),onClick:p,size:"icon",variant:"ghost",...o,children:s??(0,a.jsx)(x,{size:14})})},t7=({children:e,className:t,...n})=>{let{onClear:s}=(0,r.useContext)(t2);return s?(0,a.jsx)(eE.Button,{className:(0,M.cn)("size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",t),onClick:s,size:"icon",variant:"ghost",...n,children:e??(0,a.jsx)(tZ.Trash2Icon,{size:14})}):null},ne=({className:e,children:t,...n})=>{let{output:s,isStreaming:l,autoScroll:i}=(0,r.useContext)(t2),o=(0,r.useRef)(null);return(0,r.useEffect)(()=>{i&&o.current&&(o.current.scrollTop=o.current.scrollHeight)},[s,i]),(0,a.jsx)("div",{className:(0,M.cn)("max-h-96 overflow-auto p-4 font-mono text-sm leading-relaxed",e),ref:o,...n,children:t??(0,a.jsxs)("pre",{className:"whitespace-pre-wrap break-words",children:[s.replace(/\u001b\[[0-9;]*m/g,""),l&&(0,a.jsx)("span",{className:"ml-0.5 inline-block h-4 w-2 animate-pulse bg-zinc-100"})]})})},nt=(0,h.default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);var D=D,nn=e.i(444741),nn=nn;let ns=(0,h.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var tX=tX,na=e.i(867295),na=na;let nr=(0,h.default)("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);var eI=eI,nl=e.i(361421),nl=nl,ez=ez,ni=e.i(294543),ni=ni;let no=(0,h.default)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]);var nd=e.i(995684),nd=nd,nc=e.i(367914),nu=e.i(656744),nu=nu;let nm=(0,h.default)("square-check",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var tY=tY;let np=(0,h.default)("webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);var nx=e.i(212068),nx=nx,nh=e.i(940361),ng=e.i(691223),nf=e.i(613812),nv=e.i(887836);e.i(462506);var nj=e.i(950396);function ny(){let e=(0,l.useTranslations)("chat");return(0,a.jsx)("div",{className:"flex h-full items-center justify-center text-muted-foreground text-xs",children:e("readonlyCodeBlock.loading")})}let nb=(0,nv.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,a.jsx)(ny,{})});function nN({value:e,language:t="plaintext",title:n,height:s=220}){let{resolvedTheme:r}=(0,nj.useTheme)();return(0,a.jsxs)("div",{className:"overflow-hidden rounded-md border bg-background",children:[n?(0,a.jsx)("div",{className:"border-b bg-muted/30 px-2 py-1 font-mono text-muted-foreground text-xs",children:n}):null,(0,a.jsx)("div",{style:{height:s},children:(0,a.jsx)(nb,{height:"100%",language:t,value:e,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,lineNumbers:"on",renderLineHighlight:"none",wordWrap:"on",folding:!1,overviewRulerLanes:0},theme:"dark"===r?"vs-dark":"vs"})})]})}let nk={Read:nt,Write:eI.default,Edit:nd.default,MultiEdit:nr,Bash:tY.default,TodoWrite:nm,Grep:nc.SearchIcon,Glob:nl.default,Search:nc.SearchIcon,SemanticSearch:nc.SearchIcon,WebSearch:ez.default,WebFetch:np,Fetch:np,Task:no,Agent:D.default,Skill:nu.default,AskUserQuestion:ni.default,LoadClaudeMd:nt};function nw({text:e,status:t}){let n=(0,l.useTranslations)("chat"),s=Array.from(e.trim()).length>=300,[i,o]=(0,r.useState)(!1);return(0,a.jsx)(tq,{icon:no,label:(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5",children:[(0,a.jsx)("span",{children:n("messageParts.aiMessage")}),s?(0,a.jsx)(eE.Button,{type:"button",variant:"ghost",size:"icon",className:"ml-auto size-5",onClick:()=>o(!i),children:(0,a.jsx)(eh.ChevronDownIcon,{className:(0,M.cn)("size-3.5 transition-transform",i&&"rotate-180")})}):null]}),status:t,children:!s||i?(0,a.jsx)(b.Markdown,{content:e}):null})}function nC({chain:e,message:t,workspaceId:n,status:s}){var i,o;let d=(0,ng.useEditorStore)(e=>e.openFile),[c,u]=(0,r.useState)(!1),[m,p]=(0,r.useState)(null),[x,h]=(0,r.useState)(!1),[g,f]=(0,r.useState)(null),[v,j]=(0,r.useState)(!1),[y,b]=(0,r.useState)(!1),N=(0,l.useTranslations)("chat"),k=async()=>{e.filePath&&await d(n,e.filePath)},w=(0,r.useCallback)(async()=>{if(m||!e.detailId)return m;h(!0),f(null);try{let s=await fetch(`/api/workspaces/${n}/channels/${t.channelId}/messages/${t.id}/tool-details/${e.detailId}`);if(!s.ok)throw Error(await s.text());let a=await s.json();return p(a),a}catch(e){return f(e instanceof Error?e.message:N("messageParts.failedToLoadDetails")),null}finally{h(!1)}},[m,e.detailId,n,t.channelId,t.id,N]),C=async()=>{let e=!c;u(e),e&&!x&&await w()},S=async()=>{var t;let n=m??await w(),s=n?void 0!==(t=n).input||void 0!==t.output?JSON.stringify({input:t.input,output:t.output},null,2):t.raw??"":e.command??e.title;try{await navigator.clipboard.writeText(s),j(!0),setTimeout(()=>j(!1),1500)}catch{}},T=async()=>{await w(),b(!0)};return(0,a.jsxs)(tq,{icon:(i=e.toolName,i&&nk[i]?nk[i]:i?.startsWith("mcp__")||i?.startsWith("mcp-")?nx.default:"complete"===s?nn.default:ns),label:(0,a.jsxs)(nh.ContextMenu,{children:[(0,a.jsxs)(nh.ContextMenuTrigger,{className:"group/tool-step flex min-w-0 items-center gap-1.5 overflow-hidden",children:[(0,a.jsx)("span",{className:"shrink-0",children:e.filePath?e.title.replace(RegExp(`\\s+${((o=e.filePath).split(/[\\/]/).filter(Boolean).at(-1)??o).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`),""):e.title}),e.description?(0,a.jsx)("span",{className:"min-w-0 shrink truncate text-muted-foreground text-xs",children:e.description}):null,e.filePath?(0,a.jsxs)(eE.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 max-w-48 shrink gap-1 px-1.5 text-xs",onClick:k,children:[(0,a.jsx)(eI.default,{className:"size-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.filePath})]}):null,(0,a.jsx)("div",{className:"ml-auto flex shrink-0 items-center",children:e.detailId?(0,a.jsx)(eE.Button,{type:"button",variant:"ghost",size:"icon",className:"size-5",onClick:C,children:(0,a.jsx)(eh.ChevronDownIcon,{className:(0,M.cn)("size-3.5 transition-transform",c&&"rotate-180")})}):null})]}),(0,a.jsxs)(nh.ContextMenuContent,{children:[(0,a.jsxs)(nh.ContextMenuItem,{onClick:S,children:[v?(0,a.jsx)(tQ.CheckIcon,{className:"size-4 text-green-500"}):(0,a.jsx)(tX.default,{className:"size-4"}),N("messageParts.copy")]}),(0,a.jsxs)(nh.ContextMenuItem,{onClick:T,children:[(0,a.jsx)(na.default,{className:"size-4"}),N("messageParts.view")]})]})]}),description:e.command,status:s,children:[e.answer?(0,a.jsxs)("div",{className:"rounded-md border bg-muted/30 px-3 py-2 text-sm",children:[(0,a.jsx)("div",{className:"text-muted-foreground text-xs",children:N("messageParts.result")}),(0,a.jsx)("div",{className:"font-medium",children:e.answer})]}):null,c?(0,a.jsx)("div",{className:"space-y-2",children:x?(0,a.jsx)("div",{className:"rounded-md border bg-muted/40 p-2 text-muted-foreground text-xs",children:N("messageParts.loadingDetails")}):g?(0,a.jsx)("div",{className:"rounded-md border bg-muted/40 p-2 text-destructive text-xs",children:g}):m?(0,a.jsx)(nS,{detail:m,toolName:e.toolName,filePath:e.filePath}):(0,a.jsx)("div",{className:"rounded-md border bg-muted/40 p-2 text-muted-foreground text-xs",children:N("messageParts.noDetails")})}):null,(0,a.jsx)(nI,{open:y,onOpenChange:b,detail:m,toolName:e.toolName,loading:x,error:g,t:N})]})}function nS({detail:e,toolName:t,filePath:n}){var s,r;let i,o=(0,l.useTranslations)("chat");if(/^(Bash|Shell|Command)$/i.test(t??"")){let t=function(e){if(!e||"object"!=typeof e)return"string"==typeof e?e:void 0;let t=e.command??e.Command;return"string"==typeof t?t:void 0}(e.input),n="string"==typeof e.output?e.output:JSON.stringify(e.output??"",null,2);return(0,a.jsx)(t3,{output:t?`$ ${t}
|
|
2
|
+
${n}`:n})}let d=function(e,t,n){if(!e||"object"!=typeof e)return null;let s=nz(e.file_path)??nz(e.path)??n??"edit",a=function(e){if(!e||"object"!=typeof e)return;let t=nz(e.content);if(void 0!==t)return t;let n=e.file;if(n&&"object"==typeof n)return nz(n.content)}(t),r=nz(e.old_string),l=nz(e.new_string);if(void 0!==r&&void 0!==l)return{path:s,oldContent:r,newContent:a??l};let i=Array.isArray(e.edits)?e.edits:[];return i.length>0?{path:s,oldContent:i.map((e,t)=>e&&"object"==typeof e?nz(e.old_string)??`#${t+1}`:`#${t+1}`).join("\n\n"),newContent:a??i.map((e,t)=>e&&"object"==typeof e?nz(e.new_string)??`#${t+1}`:`#${t+1}`).join("\n\n")}:null}(e.input,e.output,n);if(d&&/^(Edit|MultiEdit)$/i.test(t??""))return(0,a.jsx)("div",{className:"h-80 overflow-hidden rounded-md border bg-background",children:(0,a.jsx)(nf.DiffViewer,{oldContent:d.oldContent,newContent:d.newContent,path:d.path})});let c=(s=e,r=o,i=[],void 0!==s.input&&i.push({title:r("messageParts.input"),value:nT(s.input),language:nM(s.input)?"json":"plaintext",height:180}),void 0!==s.output&&i.push({title:r("messageParts.output"),value:nT(s.output),language:nM(s.output)?"json":"plaintext",height:220}),i);return 0===c.length&&e.raw?(0,a.jsx)(nN,{title:o("messageParts.raw"),value:e.raw,language:"plaintext"}):(0,a.jsx)("div",{className:"space-y-2",children:c.map(e=>(0,a.jsx)(nN,{title:e.title,value:e.value,language:e.language,height:e.height},e.title))})}function nT(e){return"string"==typeof e?e:JSON.stringify(e,null,2)}function nM(e){return"string"!=typeof e}function nI({open:e,onOpenChange:t,detail:n,toolName:s,loading:r,error:l,t:i}){return(0,a.jsx)(y.Dialog,{open:e,onOpenChange:t,children:(0,a.jsxs)(y.DialogContent,{className:"sm:max-w-3xl",children:[(0,a.jsx)(y.DialogHeader,{children:(0,a.jsx)(y.DialogTitle,{children:s??i("messageParts.raw")})}),r?(0,a.jsx)("div",{className:"py-8 text-center text-muted-foreground text-sm",children:i("messageParts.loadingDetails")}):l?(0,a.jsx)("div",{className:"py-8 text-center text-destructive text-sm",children:l}):n?(0,a.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,a.jsx)(nN,{title:i("messageParts.input"),value:nT(n.input)||"-",language:nM(n.input)?"json":"plaintext",height:320}),(0,a.jsx)(nN,{title:i("messageParts.output"),value:nT(n.output)||"-",language:nM(n.output)?"json":"plaintext",height:320})]}):(0,a.jsx)("div",{className:"py-8 text-center text-muted-foreground text-sm",children:i("messageParts.noDetails")})]})})}function nz(e){return"string"==typeof e?e:void 0}var D=D,nD=e.i(191118),nR=e.i(812057),nP=e.i(368942),nA=e.i(660748);let nO=(0,r.createContext)(null),nE=()=>{let e=(0,r.useContext)(nO);if(!e)throw Error("Context components must be used within Context");return e},n$=({usedTokens:e,maxTokens:t,usage:n,modelId:s,children:r,...l})=>(0,a.jsx)(nO.Provider,{value:{usedTokens:e,maxTokens:t,usage:n,modelId:s},children:(0,a.jsx)(w.Popover,{...l,children:r})}),nL=()=>{let{usedTokens:e,maxTokens:t,usage:n}=nE(),s=e-(n?.cachedInputTokens??0),r=2*Math.PI*10;return(0,a.jsxs)("svg",{"aria-label":"Model context usage",height:"20",role:"img",style:{color:"currentcolor"},viewBox:"0 0 24 24",width:"20",children:[(0,a.jsx)("circle",{cx:12,cy:12,fill:"none",opacity:"0.25",r:10,stroke:"currentColor",strokeWidth:2}),(0,a.jsx)("circle",{cx:12,cy:12,fill:"none",opacity:"0.7",r:10,stroke:"currentColor",strokeDasharray:`${r} ${r}`,strokeDashoffset:r*(1-s/t),strokeLinecap:"round",strokeWidth:2,style:{transformOrigin:"center",transform:"rotate(-90deg)"}})]})},nU=({children:e,...t})=>{let{usedTokens:n,maxTokens:s,usage:l}=nE(),i=n-(l?.cachedInputTokens??0),o=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}).format(i/s),d=((0,r.isValidElement)(e)?e:void 0)??(0,a.jsxs)(eE.Button,{type:"button",variant:"ghost",...t,children:[(0,a.jsx)("span",{className:"font-medium text-muted-foreground",children:o}),(0,a.jsx)(nL,{})]});return(0,a.jsx)(w.PopoverTrigger,{render:d})},nB=({className:e,...t})=>(0,a.jsx)(w.PopoverContent,{className:(0,M.cn)("min-w-60 divide-y overflow-hidden p-0",e),...t}),nF=({children:e,className:t,...n})=>{let{usedTokens:s,maxTokens:r,usage:l}=nE(),i=(s-(l?.cachedInputTokens??0))/r,o=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}).format(i),d=new Intl.NumberFormat("en-US",{notation:"compact"}).format(s),c=new Intl.NumberFormat("en-US",{notation:"compact"}).format(r);return(0,a.jsx)("div",{className:(0,M.cn)("w-full space-y-2 p-3",t),...n,children:e??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 text-xs",children:[(0,a.jsx)("p",{children:o}),(0,a.jsxs)("p",{className:"font-mono text-muted-foreground",children:[d," / ",c]})]}),(0,a.jsx)("div",{className:"space-y-2",children:(0,a.jsx)(nA.Progress,{className:"bg-muted",value:100*i})})]})})},nW=({children:e,className:t,...n})=>(0,a.jsx)("div",{className:(0,M.cn)("w-full p-3",t),...n,children:e}),n_=({children:e,className:t,...n})=>{let{modelId:s,usage:r}=nE(),i=(0,l.useTranslations)("chat"),o=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,a.jsx)("div",{className:(0,M.cn)("flex w-full items-center justify-between gap-3 bg-secondary p-3 text-xs",t),...n,children:e??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:i("context.totalCost")}),(0,a.jsx)("span",{children:o})]})})},nH=({className:e,children:t,...n})=>{let{usage:s,modelId:r}=nE(),i=(0,l.useTranslations)("chat"),o=s?.inputTokens??0;if(t)return t;if(!o)return null;let d=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,a.jsxs)("div",{className:(0,M.cn)("flex items-center justify-between text-xs",e),...n,children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:i("context.input")}),(0,a.jsx)(nK,{costText:d,tokens:o})]})},nq=({className:e,children:t,...n})=>{let{usage:s,modelId:r}=nE(),i=(0,l.useTranslations)("chat"),o=s?.outputTokens??0;if(t)return t;if(!o)return null;let d=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,a.jsxs)("div",{className:(0,M.cn)("flex items-center justify-between text-xs",e),...n,children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:i("context.output")}),(0,a.jsx)(nK,{costText:d,tokens:o})]})},nV=({className:e,children:t,...n})=>{let{usage:s,modelId:r}=nE(),i=(0,l.useTranslations)("chat"),o=s?.reasoningTokens??0;if(t)return t;if(!o)return null;let d=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,a.jsxs)("div",{className:(0,M.cn)("flex items-center justify-between text-xs",e),...n,children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:i("context.reasoning")}),(0,a.jsx)(nK,{costText:d,tokens:o})]})},nG=({className:e,children:t,...n})=>{let{usage:s,modelId:r}=nE(),i=(0,l.useTranslations)("chat"),o=s?.cachedInputTokens??0;if(t)return t;if(!o)return null;let d=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format((void 0)??0);return(0,a.jsxs)("div",{className:(0,M.cn)("flex items-center justify-between text-xs",e),...n,children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:i("context.cache")}),(0,a.jsx)(nK,{costText:d,tokens:o})]})},nK=({tokens:e,costText:t})=>(0,a.jsxs)("span",{children:[void 0===e?"—":new Intl.NumberFormat("en-US",{notation:"compact"}).format(e),t?(0,a.jsxs)("span",{className:"ml-2 text-muted-foreground",children:["• ",t]}):null]});function nJ(e){return{inputTokens:e.usage?.inputTokens??0,outputTokens:e.usage?.outputTokens??0,totalTokens:e.usage?.totalTokens??e.usedTokens,cachedInputTokens:e.usage?.cachedInputTokens??0,reasoningTokens:e.usage?.reasoningTokens??0,inputTokenDetails:{noCacheTokens:void 0,cacheReadTokens:void 0,cacheWriteTokens:void 0},outputTokenDetails:{textTokens:void 0,reasoningTokens:void 0}}}function nQ({part:e}){let t=e.agentContext,n=nJ(e),s=n.inputTokens+n.outputTokens+n.reasoningTokens,r=n.totalTokens>0?n.cachedInputTokens/n.totalTokens:0,l=function(e){if(e?.length)return JSON.stringify(e.map(e=>({id:e.id,type:e.type,title:e.title,toolUseId:e.toolUseId,toolName:e.toolName,characters:e.characters,tokens:e.tokens,text:e.text})),null,2)}(t?.outputItems)??t?.output,i=function(e){if(e?.length)return e.reduce((e,t)=>({characters:e.characters+(t.characters??0),tokens:e.tokens+(t.tokens??0)}),{characters:0,tokens:0})}(t?.outputItems)??nZ(t?.output),o=[{key:"systemPrompt",title:"提示词信息",value:t?.systemPrompt,empty:"此 agent 未配置独立 system prompt。"},{key:"userPrompt",title:"输入信息",value:t?.userPrompt,empty:"旧消息未记录用户输入。"},{key:"fullPrompt",title:"完整上下文",value:t?.fullPrompt,empty:"旧消息未记录完整 prompt。"},{key:"output",title:"输出信息",value:l,empty:"暂无输出信息。",stats:i}].map(e=>({...e,stats:e.stats??nZ(e.value)})),d=o.reduce((e,t)=>e+t.stats.tokens,0);return(0,a.jsxs)("div",{className:"flex flex-col gap-4 h-full",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)(eb.Badge,{variant:"secondary",children:t?.name||t?.role||"Agent"}),t?.runtime?(0,a.jsx)(eb.Badge,{variant:"outline",children:t.runtime}):null,t?.model||e.modelId?(0,a.jsx)(eb.Badge,{variant:"outline",children:t?.model||e.modelId}):null,t?.sessionId?(0,a.jsx)("span",{className:"font-mono text-[11px] text-muted-foreground",children:t.sessionId}):null]}),(0,a.jsxs)("div",{className:"grid gap-2 sm:grid-cols-3 xl:grid-cols-6",children:[(0,a.jsx)(nX,{label:"有效上下文",value:s,helper:"输入 + 输出 + 推理,不含缓存命中",emphasize:!0}),(0,a.jsx)(nX,{label:"总用量(含缓存)",value:n.totalTokens,helper:"provider usage total"}),(0,a.jsx)(nX,{label:"新输入",value:n.inputTokens}),(0,a.jsx)(nX,{label:"输出",value:n.outputTokens}),(0,a.jsx)(nX,{label:"推理",value:n.reasoningTokens}),(0,a.jsx)(nX,{label:"缓存输入",value:n.cachedInputTokens,helper:`${n0(r)} of total`})]}),(0,a.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,a.jsx)(nY,{title:o[0].title,value:o[0].value,empty:o[0].empty,stats:o[0].stats,totalTokens:d},o[0].key),(0,a.jsx)(nY,{title:o[1].title,value:o[1].value,empty:o[1].empty,stats:o[1].stats,totalTokens:d},o[1].key)]}),(0,a.jsxs)("div",{className:"flex flex-1 flex-col gap-4 min-h-0",children:[(0,a.jsx)(nY,{title:o[2].title,value:o[2].value,empty:o[2].empty,stats:o[2].stats,totalTokens:d},o[2].key),(0,a.jsx)(nY,{title:o[3].title,value:o[3].value,empty:o[3].empty,stats:o[3].stats,totalTokens:d},o[3].key)]})]})}function nX({label:e,value:t,helper:n,emphasize:s}){return(0,a.jsxs)("div",{className:(0,M.cn)("rounded-md border bg-muted/30 p-3",s&&"border-primary/30 bg-primary/5"),children:[(0,a.jsx)("div",{className:"text-[11px] text-muted-foreground",children:e}),(0,a.jsx)("div",{className:(0,M.cn)("mt-1 font-mono text-sm",s&&"font-semibold text-primary"),children:n1(t??0)}),n?(0,a.jsx)("div",{className:"mt-1 text-[10px] text-muted-foreground",children:n}):null]})}function nY({title:e,value:t,empty:n,stats:s,totalTokens:r}){let l=r>0?s.tokens/r:0;return(0,a.jsxs)("section",{className:"min-w-0 overflow-hidden flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("h4",{className:"text-xs font-medium text-muted-foreground",children:e}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-1.5 font-mono text-[10px] text-muted-foreground",children:[(0,a.jsx)("span",{children:n0(l)}),(0,a.jsxs)("span",{children:[n1(s.characters)," 字"]}),(0,a.jsxs)("span",{children:[n1(s.tokens)," tokens"]})]})]}),(0,a.jsx)("pre",{className:(0,M.cn)("min-w-0 flex-1 min-h-0 whitespace-pre-wrap break-words rounded-md border bg-muted/30 p-3 font-mono text-xs leading-relaxed text-foreground overflow-auto",!t?.trim()&&"text-muted-foreground",!t?.trim()&&"text-muted-foreground"),children:t?.trim()||n})]})}function nZ(e){var t;let n,s,a=e?.trim()??"";return a?{characters:Array.from(a).length,tokens:(t=a,n=t.match(/[㐀-鿿豈-]/g)?.length??0,s=t.replace(/[㐀-鿿豈-]/g," "),Math.max(1,Math.ceil(n+.75*(s.match(/[A-Za-z0-9_]+|[^\sA-Za-z0-9_]/g)?.length??0))))}:{characters:0,tokens:0}}function n0(e){return new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}).format(e)}function n1(e){return new Intl.NumberFormat("en-US").format(e)}function n2({message:e}){let t=(0,r.useMemo)(()=>e.parts?.filter(e=>"context"===e.type)??[],[e.parts]),n=t[t.length-1],[s,l]=(0,r.useState)(!1),[i,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(),u=(0,nP.useLLMStore)(e=>e.models),m=(0,nP.useLLMStore)(e=>e.ensure),p=n?.modelId?u.find(e=>e.modelId===n.modelId||e.name===n.modelId):void 0,x=p?.maxContextTokens??n?.maxTokens;if((0,r.useEffect)(()=>{n&&m()},[m,n]),!n||!x)return null;let h=t.reduce((e,t)=>e+t.usedTokens,0),g=t.reduce((e,t)=>({inputTokens:e.inputTokens+(t.usage?.inputTokens??0),outputTokens:e.outputTokens+(t.usage?.outputTokens??0),totalTokens:e.totalTokens+(t.usage?.totalTokens??t.usedTokens),cachedInputTokens:e.cachedInputTokens+(t.usage?.cachedInputTokens??0),reasoningTokens:e.reasoningTokens+(t.usage?.reasoningTokens??0)}),{inputTokens:0,outputTokens:0,totalTokens:0,cachedInputTokens:0,reasoningTokens:0}),f=t.length>1?{...n,usedTokens:h,usage:g}:n,v=nJ(f),j=t.find(e=>e.id===d)??t[0];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(n$,{usedTokens:f.usedTokens,maxTokens:x,modelId:f.modelId,usage:v,open:s,onOpenChange:l,children:[(0,a.jsx)(nU,{className:"h-5 gap-1 px-1.5 text-[10px]"}),(0,a.jsxs)(nB,{children:[(0,a.jsx)(nF,{}),(0,a.jsxs)(nW,{className:"space-y-2",children:[(0,a.jsx)(nH,{}),(0,a.jsx)(nq,{}),(0,a.jsx)(nV,{}),(0,a.jsx)(nG,{})]}),(0,a.jsx)(n_,{}),(0,a.jsx)("div",{className:"border-t px-3 py-2",children:(0,a.jsx)("button",{type:"button",className:"w-full text-center text-xs text-primary hover:underline",onClick:()=>{l(!1),o(!0)},children:"查看详情 →"})})]})]}),(0,a.jsx)(y.Dialog,{open:i,onOpenChange:o,children:(0,a.jsxs)(y.DialogContent,{className:"!flex !w-[min(920px,calc(100vw-2rem))] !max-w-[min(920px,calc(100vw-2rem))] !flex-col gap-0 overflow-hidden p-0",children:[(0,a.jsxs)(y.DialogHeader,{className:"border-b px-5 py-4",children:[(0,a.jsx)(y.DialogTitle,{className:"text-base",children:"Agent 上下文结构"}),(0,a.jsxs)(y.DialogDescription,{className:"text-xs",children:["此条消息包含 ",t.length," 次 agent 运行。选择 tab 查看提示词、输入、输出和 token 消耗。"]})]}),t.length?(0,a.jsxs)(nR.Tabs,{value:j?.id,onValueChange:c,className:"min-h-0 flex flex-1 gap-0",children:[(0,a.jsx)("div",{className:"flex w-56 shrink-0 flex-col border-r",children:(0,a.jsx)(nR.TabsList,{className:"!flex h-auto w-full flex-col items-stretch gap-1 rounded-none border-0 bg-transparent p-2",children:t.map((e,t)=>(0,a.jsxs)(nR.TabsTrigger,{value:e.id,className:"!w-full justify-start gap-2 px-3 py-2 text-xs",children:[(0,a.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-full bg-muted font-mono text-[10px] text-muted-foreground",children:t+1}),(0,a.jsx)(D.default,{className:"size-3.5 shrink-0"}),(0,a.jsx)("span",{className:"min-w-0 truncate",children:e.agentContext?.name||e.agentContext?.role||`Agent ${t+1}`})]},e.id))})}),(0,a.jsx)(nD.ScrollArea,{className:"max-h-[min(68vh,720px)] min-w-0 flex-1",children:t.map(e=>(0,a.jsx)(nR.TabsContent,{value:e.id,className:"m-0 min-w-0 p-5",children:(0,a.jsx)(nQ,{part:e})},e.id))})]}):null]})})]})}function n3({message:e,isUser:t,workspaceId:n}){let s=(0,l.useTranslations)("chat"),r=e.parts??[],i=r.filter(e=>"context"!==e.type),o=i.some(e=>"text"===e.type),d=0===r.length&&e.content;return(0,a.jsxs)("div",{className:"space-y-3 min-w-0 overflow-hidden",children:[e.attachments?.length?(0,a.jsx)(n6,{attachments:e.attachments,isUser:t}):null,i.length>0?i.map(t=>(0,a.jsx)(n5,{part:function(e){if("text"!==e.type)return e;let t=n8(e.text);return t===e.text?e:{...e,text:t}}(t),message:e,workspaceId:n},t.id)):null,!o&&d?t?(0,a.jsx)(n9,{content:e.content}):(0,a.jsx)(b.Markdown,{content:n8(e.content)}):null,"pending"===e.status&&0===i.length?(0,a.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,a.jsx)(z,{size:14}),(0,a.jsx)("span",{children:s("messageParts.agentProcessing")})]}):null]})}function n5({part:e,message:t,workspaceId:n}){let s=(0,l.useTranslations)("chat");switch(e.type){case"text":return(0,a.jsx)(b.Markdown,{content:e.text});case"user_message":return(0,a.jsx)(n4,{text:e.text,senderName:e.senderName||"用户"});case"reasoning":return(0,a.jsxs)(t_,{defaultOpen:"streaming"===e.status,className:"max-w-none",children:[(0,a.jsx)(tH,{loading:"streaming"===e.status,children:s("streaming"===e.status?"messageParts.agentThinking":"messageParts.aiIntermediateOutput")}),(0,a.jsx)(tK,{className:"max-h-[300px] overflow-y-auto",children:(0,a.jsx)("div",{className:"pl-6 text-xs text-muted-foreground",children:(0,a.jsx)(b.Markdown,{content:e.text})})})]});case"chain":let r=e.chains.filter(e=>!tF(e.text??e.description??e.title)),i=r.filter(e=>"message"!==e.kind).length;if(0===r.length)return null;return(0,a.jsxs)(t_,{defaultOpen:"pending"===t.status,className:"max-w-none",children:[(0,a.jsx)(tH,{loading:"pending"===t.status||"streaming"===t.status,children:s("messageParts.chainSteps",{count:i})}),(0,a.jsx)(tK,{className:"max-h-[300px] overflow-y-auto",children:r.map(e=>{let s="completed"===e.status;return"message"===e.kind?(0,a.jsx)(nw,{text:e.text??e.title,status:s?"complete":"active"},e.id):(0,a.jsx)(nC,{chain:e,message:t,workspaceId:n,status:s?"complete":"active"},e.id)})})]});case"terminal":return(0,a.jsx)(t3,{output:e.command?`$ ${e.command}
|
|
3
|
+
${e.output}`:e.output,isStreaming:"streaming"===e.status,className:"error"===e.status?"border-destructive/40":void 0});case"confirmation":{var o,d;let t=(o=e.id,(d=e.approval)&&void 0!==d.approved?{id:d.id,approved:d.approved,reason:d.reason}:{id:d?.id??o});return(0,a.jsxs)(tz,{approval:t,state:void 0===t.approved?"approval-requested":"approval-responded",children:[(0,a.jsxs)(tD,{children:[(0,a.jsxs)(tR,{children:[e.title,e.description?(0,a.jsx)("span",{className:"block text-xs",children:e.description}):null]}),(0,a.jsx)(tP,{children:e.title}),(0,a.jsx)(tA,{children:e.approval?.reason??e.title})]}),(0,a.jsxs)(tO,{children:[(0,a.jsx)(tE,{variant:"outline",children:s("messageParts.reject")}),(0,a.jsx)(tE,{children:s("messageParts.approve")})]})]})}case"context":case"ask_user_question":default:return null;case"subagent":let c=e.output&&!tF(e.output)?e.output:void 0;return(0,a.jsxs)(eN,{children:[(0,a.jsx)(ek,{name:e.name,model:e.model}),e.instructions||c||e.tools?.length?(0,a.jsxs)(ew,{children:[e.instructions?(0,a.jsx)(eC,{children:e.instructions}):null,c?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("span",{className:"font-medium text-muted-foreground text-sm",children:s("messageParts.result")}),(0,a.jsx)("div",{className:"rounded-md bg-muted/50 p-3 text-sm",children:(0,a.jsx)(b.Markdown,{content:c})})]}):null,e.tools?.length?(0,a.jsx)(eS,{children:e.tools.map((e,t)=>(0,a.jsx)(eT,{value:`tool-${t}`,tool:{description:e.description??e.name,inputSchema:e.inputSchema,jsonSchema:e.jsonSchema}},`${e.name??"tool"}-${t}`))}):null]}):null]})}}function n4({text:e,senderName:t}){return(0,a.jsxs)("div",{className:"not-prose rounded-md border border-primary/20 bg-primary/5 px-3 py-2 text-sm",children:[(0,a.jsxs)("div",{className:"mb-1 text-xs font-medium text-primary",children:[t,":"]}),(0,a.jsx)(n9,{content:e})]})}function n6({attachments:e,isUser:t}){return(0,a.jsx)(tb,{variant:"inline",className:t?"justify-end":"justify-start",children:e.map((e,t)=>{var n,s;return(0,a.jsxs)(tN,{data:(n=e,s=t,{id:`${n.path||n.name}-${s}`,type:"file",filename:n.name,mediaType:n.type,url:n.url||n.path}),children:[(0,a.jsx)(tk,{}),(0,a.jsx)(tw,{showMediaType:!0})]},`${e.path}-${t}`)})})}function n9({content:e}){return/<[a-z][\s\S]*>/i.test(e)?(0,a.jsx)("span",{className:"tiptap tiptap-message",dangerouslySetInnerHTML:{__html:e}}):(0,a.jsx)("span",{className:"whitespace-pre-wrap break-all",children:e})}function n8(e){let t=[...e.split(/\r?\n/)];for(;t.length>1&&t.length%2==0;){let e=t.length/2,n=t.slice(0,e),s=t.slice(e);if(n7(n.join("\n"))!==n7(s.join("\n")))break;t=n}return t.join("\n")}function n7(e){return e.trim().replace(/\s+/g," ")}function se({message:e,workspaceId:t,onEdit:n,onDelete:s,onReply:i}){let d=(0,l.useTranslations)("common"),h="user"===e.senderId,w=(0,o.useAgentStore)(e=>e.agents),C=h?void 0:w.find(t=>t.id===e.senderId),S=h?d("you"):C?.name||e.senderId,M=(0,k.useUserAvatar)(),I=new Date(e.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),[z,D]=(0,r.useState)(!1),[R,P]=(0,r.useState)(!1),[A,O]=(0,r.useState)(!1),E=e.replies??[],$="streaming"===e.status||"pending"===e.status||"waiting_for_user"===e.status,[L,U]=(0,r.useState)(()=>e.metadata?.duration??0);(0,r.useEffect)(()=>{if(!$&&e.metadata?.duration!=null)return void U(e.metadata.duration);if(!$)return;let t=new Date(e.createdAt).getTime();U(Date.now()-t);let n=setInterval(()=>U(Date.now()-t),1e3);return()=>clearInterval(n)},[e.metadata?.duration,e.createdAt,$]);let B=!h&&($||"completed"===e.status||"error"===e.status)&&L>0,F=(0,r.useCallback)(async()=>{let t=st(e.content)?e.content.replace(/<[^>]*>/g,""):e.content;await navigator.clipboard.writeText(t),D(!0),setTimeout(()=>D(!1),2e3)},[e.content]);return(0,a.jsxs)("div",{className:`group flex gap-2 px-3 py-1.5 ${h?"flex-row-reverse":""}`,children:[(0,a.jsx)(N.AgentIcon,{agentId:h?void 0:e.senderId,name:S,avatarUrl:h&&M||void 0,onClick:()=>P(!0),className:"size-7 rounded-full"}),(0,a.jsxs)("div",{className:`flex flex-col min-w-0 w-[80%] ${h?"items-end":"items-start"}`,children:[!h&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-foreground",children:S}),e.senderRole&&(0,a.jsx)("span",{className:"text-[10px] bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:e.senderRole}),e.metadata?.model&&(0,a.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground",children:e.metadata.model}),(0,a.jsx)(n2,{message:e}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:I})]}),(0,a.jsxs)("div",{className:`min-w-0 max-w-full text-sm rounded-lg px-3 py-2 ${h?"bg-primary text-primary-foreground":"bg-muted"}`,children:[(0,a.jsx)(n3,{message:e,isUser:h,workspaceId:t}),(E.length>0||B)&&(0,a.jsxs)("div",{className:"mt-1 flex items-center justify-between gap-3 border-t border-border/30 pt-1",children:[(0,a.jsx)(sn,{replies:E,currentUserLabel:d("you")}),(0,a.jsxs)("div",{className:"ml-auto flex items-center justify-end gap-1",children:[!$&&"completed"===e.status&&(0,a.jsx)(f.CheckCircle2,{className:"h-3 w-3 text-green-500 shrink-0"}),!$&&"error"===e.status&&(0,a.jsx)(v.XCircle,{className:"h-3 w-3 text-destructive shrink-0"}),B&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.Clock,{className:"h-3 w-3 text-muted-foreground"}),(0,a.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[function(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m ${t%60}s`;let s=Math.floor(n/60);return`${s}h ${n%60}m`}(L),$&&(0,a.jsx)("span",{className:"animate-pulse ml-0.5",children:"..."})]})]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-0.5 h-6 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,a.jsx)("button",{onClick:()=>i?.(e),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"回复",children:(0,a.jsx)(g,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("button",{onClick:F,className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"复制",children:z?(0,a.jsx)(p.Check,{className:"h-3.5 w-3.5 text-green-500"}):(0,a.jsx)(c.Copy,{className:"h-3.5 w-3.5"})}),h&&(0,a.jsx)("button",{onClick:()=>n?.(e),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"编辑",children:(0,a.jsx)(u.Pencil,{className:"h-3.5 w-3.5"})}),!h&&e.content&&(0,a.jsx)("button",{onClick:()=>O(!0),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"全屏查看",children:(0,a.jsx)(j,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("button",{onClick:()=>s?.(e),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-destructive transition-colors",title:"删除",children:(0,a.jsx)(m.Trash2,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsx)(T,{open:R,onOpenChange:P,memberName:e.senderId,channelId:e.channelId,workspaceId:t}),!h&&A&&(0,a.jsx)(y.Dialog,{open:A,onOpenChange:O,children:(0,a.jsxs)(y.DialogPortal,{children:[(0,a.jsx)(y.DialogOverlay,{}),(0,a.jsxs)(y.DialogContent,{className:"max-w-4xl max-h-[85vh] flex flex-col gap-0",children:[(0,a.jsx)(y.DialogHeader,{children:(0,a.jsx)(y.DialogTitle,{children:S})}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-6 pb-6",children:(0,a.jsx)(b.Markdown,{content:st(e.content)?e.content.replace(/<[^>]*>/g,""):e.content})})]})]})})]})}function st(e){return/<[a-z][\s\S]*>/i.test(e)}function sn({replies:e,currentUserLabel:t}){return 0===e.length?(0,a.jsx)("span",{className:"min-w-0"}):(0,a.jsxs)(w.Popover,{children:[(0,a.jsxs)(w.PopoverTrigger,{render:(0,a.jsx)("button",{type:"button",className:"min-w-0 truncate text-[11px] text-muted-foreground transition-colors hover:text-foreground"}),children:["有 ",e.length," 条回复消息"]}),(0,a.jsx)(w.PopoverContent,{align:"start",sideOffset:4,className:"w-96 max-w-[calc(100vw-2rem)] p-2",children:(0,a.jsx)("div",{className:"max-h-96 space-y-2 overflow-y-auto pr-1",children:e.map(e=>(0,a.jsxs)("div",{className:"rounded-md border bg-muted/30 px-3 py-2 text-sm",children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center justify-between gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)("span",{children:"user"===e.senderId?t:e.senderRole||e.senderId}),(0,a.jsx)("span",{children:new Date(e.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),(0,a.jsx)("div",{className:"whitespace-pre-wrap break-words",children:st(e.content)?e.content.replace(/<[^>]*>/g,""):e.content})]},e.id))})})]})}var ss=e.i(917955),sa={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};let sr=(e,t,n,s)=>{let a=(0,r.forwardRef)(({color:n="currentColor",size:a=24,stroke:l=2,title:i,className:o,children:d,...c},u)=>(0,r.createElement)("svg",{ref:u,...sa[e],width:a,height:a,className:["tabler-icon",`tabler-icon-${t}`,o].join(" "),..."filled"===e?{fill:n}:{strokeWidth:l,stroke:n},...c},[i&&(0,r.createElement)("title",{key:"svg-title"},i),...s.map(([e,t])=>(0,r.createElement)(e,t)),...Array.isArray(d)?d:[d]]));return a.displayName=`${n}`,a},sl=sr("outline","chevron-up","ChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),si=sr("outline","microphone","Microphone",[["path",{d:"M9 5a3 3 0 0 1 3 -3a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3a3 3 0 0 1 -3 -3l0 -5",key:"svg-0"}],["path",{d:"M5 10a7 7 0 0 0 14 0",key:"svg-1"}],["path",{d:"M8 21l8 0",key:"svg-2"}],["path",{d:"M12 17l0 4",key:"svg-3"}]]),so=sr("outline","paperclip","Paperclip",[["path",{d:"M15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3l6.5 -6.5a3 3 0 0 0 -6 -6l-6.5 6.5a4.5 4.5 0 0 0 9 9l6.5 -6.5",key:"svg-0"}]]),sd=sr("outline","plus","Plus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]),sc=sr("outline","wand","Wand",[["path",{d:"M6 21l15 -15l-3 -3l-15 15l3 3",key:"svg-0"}],["path",{d:"M15 6l3 3",key:"svg-1"}],["path",{d:"M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2",key:"svg-2"}],["path",{d:"M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2",key:"svg-3"}]]);var su=e.i(437122),sm=e.i(568772),sp=e.i(99567),sx=e.i(332339),sh=e.i(780207),sg=e.i(898822),sf=e.i(972097),sv=e.i(162519),sj=e.i(199302),sy=e.i(939785),sb=e.i(111092),sN=e.i(822162);let sk=new sb.PluginKey("agentResourceSuggestion"),sw=new sb.PluginKey("fileSearchSuggestion");var sC=e.i(444433),sS=e.i(230698),sT=e.i(272736);let sM=sr("outline","file-text","FileText",[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",key:"svg-1"}],["path",{d:"M9 9l1 0",key:"svg-2"}],["path",{d:"M9 13l6 0",key:"svg-3"}],["path",{d:"M9 17l6 0",key:"svg-4"}]]),sI=sr("outline","message-circle-plus","MessageCirclePlus",[["path",{d:"M12.007 19.98a9.869 9.869 0 0 1 -4.307 -.98l-4.7 1l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c1.992 1.7 2.93 4.04 2.747 6.34",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}]]),sz=sr("outline","tools","Tools",[["path",{d:"M3 21h4l13 -13a1.5 1.5 0 0 0 -4 -4l-13 13v4",key:"svg-0"}],["path",{d:"M14.5 5.5l4 4",key:"svg-1"}],["path",{d:"M12 8l-5 -5l-4 4l5 5",key:"svg-2"}],["path",{d:"M7 8l-1.5 1.5",key:"svg-3"}],["path",{d:"M16 12l5 5l-4 4l-5 -5",key:"svg-4"}],["path",{d:"M16 17l-1.5 1.5",key:"svg-5"}]]);function sD(e){let t=new Set,n=e=>{if(e&&("mention"===e.type&&"string"==typeof e.attrs?.id&&t.add(e.attrs.id),Array.isArray(e.content)))for(let t of e.content)n(t)};return n(e),[...t]}function sR(e,t){return e?{type:"doc",content:e.split("\n").map(e=>{let n=function(e,t){let n,s=[],a=/@(\S+)/g,r=0;for(;null!==(n=a.exec(e));){n.index>r&&s.push({type:"text",text:e.slice(r,n.index)});let l=n[1],i=t.find(e=>e.name===l||e.id===l||e.role===l);i?s.push({type:"mention",attrs:{id:i.id,label:i.name||i.role}}):s.push({type:"text",text:n[0]}),r=a.lastIndex}return r<e.length&&s.push({type:"text",text:e.slice(r)}),s}(e,t);return{type:"paragraph",content:n.length>0?n:void 0}})}:{type:"doc",content:[{type:"paragraph"}]}}async function sP(e){let t=new FormData;t.append("file",e.file);let n=await fetch("/api/upload",{method:"POST",body:t});if(!n.ok)throw Error(`Upload failed: ${e.file.name}`);let s=await n.json();return{name:s.name,path:s.url,url:s.url,type:s.type,size:s.size}}let sA=sr("outline","pin","Pin",[["path",{d:"M15 4.5l-4 4l-4 1.5l-1.5 1.5l7 7l1.5 -1.5l1.5 -4l4 -4",key:"svg-0"}],["path",{d:"M9 15l-4.5 4.5",key:"svg-1"}],["path",{d:"M14.5 4l5.5 5.5",key:"svg-2"}]]),sO=sr("filled","pin-filled","PinFilled",[["path",{d:"M15.113 3.21l.094 .083l5.5 5.5a1 1 0 0 1 -1.175 1.59l-3.172 3.171l-1.424 3.797a1 1 0 0 1 -.158 .277l-.07 .08l-1.5 1.5a1 1 0 0 1 -1.32 .082l-.095 -.083l-2.793 -2.792l-3.793 3.792a1 1 0 0 1 -1.497 -1.32l.083 -.094l3.792 -3.793l-2.792 -2.793a1 1 0 0 1 -.083 -1.32l.083 -.094l1.5 -1.5a1 1 0 0 1 .258 -.187l.098 -.042l3.796 -1.425l3.171 -3.17a1 1 0 0 1 1.497 -1.26z",key:"svg-0"}]]),sE=sr("outline","user-plus","UserPlus",[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M16 19h6",key:"svg-1"}],["path",{d:"M19 16v6",key:"svg-2"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4",key:"svg-3"}]]),s$=sr("outline","bell","Bell",[["path",{d:"M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6",key:"svg-0"}],["path",{d:"M9 17v1a3 3 0 0 0 6 0v-1",key:"svg-1"}]]),sL=sr("outline","bell-off","BellOff",[["path",{d:"M9.346 5.353c.21 -.129 .428 -.246 .654 -.353a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3m-1 3h-13a4 4 0 0 0 2 -3v-3a6.996 6.996 0 0 1 1.273 -3.707",key:"svg-0"}],["path",{d:"M9 17v1a3 3 0 0 0 6 0v-1",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]]);function sU({agents:e,activeAgent:t,pinnedMentionId:n,isPinned:s,channel:r,onActivateAgent:i,onTogglePin:o,onOpenAddMember:d,onToggleNotify:c}){let u=(0,l.useTranslations)("chat");return(0,a.jsxs)("div",{className:"flex items-center gap-1 mb-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-none flex-1 min-w-0",children:[(0,a.jsx)("button",{type:"button",onClick:d,className:"shrink-0 inline-flex items-center justify-center size-6 rounded-full text-muted-foreground border border-dashed border-muted-foreground/40 hover:bg-accent hover:text-foreground transition-all",title:u("input.manageMembers"),children:(0,a.jsx)(sE,{className:"size-3.5"})}),e.map(e=>{let r=e.id===t?.id;return(0,a.jsxs)("button",{type:"button",onClick:()=>i(e),className:(0,M.cn)("shrink-0 inline-flex items-center gap-1 h-6 pl-0.5 pr-1 rounded-full text-xs transition-all",r?"bg-primary/10 text-primary border border-primary/30":"text-muted-foreground border border-transparent hover:bg-accent"),children:[(0,a.jsx)(N.AgentIcon,{agentId:e.id,name:e.name||e.role,avatarUrl:e.avatarUrl,className:"size-5 rounded-full text-[9px]"}),(0,a.jsx)("span",{className:"max-w-[80px] truncate",children:e.name||e.role}),r?(0,a.jsx)("span",{role:"button",tabIndex:0,onClick:e=>{e.stopPropagation(),o()},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.stopPropagation(),o())},className:(0,M.cn)("inline-flex items-center justify-center size-4 rounded-full hover:bg-primary/20 transition-colors",s?"text-primary":"text-primary/50"),title:s?u("input.unpinAgent"):u("input.pinAgent"),children:s?(0,a.jsx)(sO,{className:"size-2.5"}):(0,a.jsx)(sA,{className:"size-2.5"})}):n===e.id?(0,a.jsx)(sO,{className:"size-2.5 text-muted-foreground/50"}):null]},e.id)})]}),(0,a.jsx)("button",{type:"button",onClick:c,className:(0,M.cn)("shrink-0 inline-flex items-center gap-1 h-6 px-1.5 rounded-full text-xs transition-all",r.notifyOnComplete?"bg-primary/10 text-primary border border-primary/30":"text-muted-foreground border border-transparent hover:bg-accent"),title:u("input.notifyOnComplete"),children:r.notifyOnComplete?(0,a.jsx)(s$,{className:"size-3"}):(0,a.jsx)(sL,{className:"size-3"})})]})}let sB=sr("outline","chevron-down","ChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]),sF=sr("outline","circle-check","CircleCheck",[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l2 2l4 -4",key:"svg-1"}]]),sW=sr("outline","circle-dashed","CircleDashed",[["path",{d:"M8.56 3.69a9 9 0 0 0 -2.92 1.95",key:"svg-0"}],["path",{d:"M3.69 8.56a9 9 0 0 0 -.69 3.44",key:"svg-1"}],["path",{d:"M3.69 15.44a9 9 0 0 0 1.95 2.92",key:"svg-2"}],["path",{d:"M8.56 20.31a9 9 0 0 0 3.44 .69",key:"svg-3"}],["path",{d:"M15.44 20.31a9 9 0 0 0 2.92 -1.95",key:"svg-4"}],["path",{d:"M20.31 15.44a9 9 0 0 0 .69 -3.44",key:"svg-5"}],["path",{d:"M20.31 8.56a9 9 0 0 0 -1.95 -2.92",key:"svg-6"}],["path",{d:"M15.44 3.69a9 9 0 0 0 -3.44 -.69",key:"svg-7"}]]),s_=sr("outline","loader-2","Loader2",[["path",{d:"M12 3a9 9 0 1 0 9 9",key:"svg-0"}]]),sH=sr("outline","plug","Plug",[["path",{d:"M9.785 6l8.215 8.215l-2.054 2.054a5.81 5.81 0 1 1 -8.215 -8.215l2.054 -2.054",key:"svg-0"}],["path",{d:"M4 20l3.5 -3.5",key:"svg-1"}],["path",{d:"M15 4l-3.5 3.5",key:"svg-2"}],["path",{d:"M20 9l-3.5 3.5",key:"svg-3"}]]),sq=sr("outline","puzzle","Puzzle",[["path",{d:"M4 7h3a1 1 0 0 0 1 -1v-1a2 2 0 0 1 4 0v1a1 1 0 0 0 1 1h3a1 1 0 0 1 1 1v3a1 1 0 0 0 1 1h1a2 2 0 0 1 0 4h-1a1 1 0 0 0 -1 1v3a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1v-1a2 2 0 0 0 -4 0v1a1 1 0 0 1 -1 1h-3a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1h1a2 2 0 0 0 0 -4h-1a1 1 0 0 1 -1 -1v-3a1 1 0 0 1 1 -1",key:"svg-0"}]]),sV=sr("outline","trash","Trash",[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]]);function sG(e,t){return e.subject||e.title||e.activeForm||e.content||t}function sK({mcps:e,skills:t,tools:n,todos:s,onClearTodos:r}){let i=(0,l.useTranslations)("chat");return(0,a.jsxs)("div",{className:"flex items-center gap-0 pt-2",children:[(0,a.jsxs)(ss.DropdownMenu,{children:[(0,a.jsxs)(ss.DropdownMenuTrigger,{render:(0,a.jsx)(eE.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 rounded-full border border-transparent hover:bg-accent text-muted-foreground text-xs"}),children:[(0,a.jsx)(sH,{className:"size-3"}),(0,a.jsxs)("span",{children:[i("input.mcp"),e.length?` ${e.length}`:""]}),(0,a.jsx)(sB,{className:"size-3"})]}),(0,a.jsx)(ss.DropdownMenuContent,{align:"start",className:"min-w-[200px] max-w-xs rounded-2xl p-1.5 bg-popover border-border",children:(0,a.jsx)(ss.DropdownMenuGroup,{className:"space-y-1",children:e.length?e.map(e=>(0,a.jsxs)(ss.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs truncate",children:[(0,a.jsx)(sH,{size:16,className:"opacity-60 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e})]},e)):(0,a.jsxs)(ss.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs text-muted-foreground",children:[(0,a.jsx)(sH,{size:16,className:"opacity-60"}),i("input.noMcp")]})})})]}),(0,a.jsxs)(ss.DropdownMenu,{children:[(0,a.jsxs)(ss.DropdownMenuTrigger,{render:(0,a.jsx)(eE.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 rounded-full border border-transparent hover:bg-accent text-muted-foreground text-xs"}),children:[(0,a.jsx)(sq,{className:"size-3"}),(0,a.jsxs)("span",{children:[i("input.skill"),t.length?` ${t.length}`:""]}),(0,a.jsx)(sB,{className:"size-3"})]}),(0,a.jsx)(ss.DropdownMenuContent,{align:"start",className:"min-w-[200px] max-w-xs rounded-2xl p-1.5 bg-popover border-border",children:(0,a.jsx)(ss.DropdownMenuGroup,{className:"space-y-1",children:t.length?t.map(e=>(0,a.jsxs)(ss.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs truncate",children:[(0,a.jsx)(sq,{size:16,className:"opacity-60 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e})]},e)):(0,a.jsxs)(ss.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs text-muted-foreground",children:[(0,a.jsx)(sq,{size:16,className:"opacity-60"}),i("input.noSkills")]})})})]}),(0,a.jsxs)(ss.DropdownMenu,{children:[(0,a.jsxs)(ss.DropdownMenuTrigger,{render:(0,a.jsx)(eE.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 rounded-full border border-transparent hover:bg-accent text-muted-foreground text-xs"}),children:[(0,a.jsx)(sz,{className:"size-3"}),(0,a.jsxs)("span",{children:[i("input.tools"),n.length?` ${n.length}`:""]}),(0,a.jsx)(sB,{className:"size-3"})]}),(0,a.jsx)(ss.DropdownMenuContent,{align:"start",className:"min-w-[200px] max-w-xs rounded-2xl p-1.5 bg-popover border-border",children:(0,a.jsx)(ss.DropdownMenuGroup,{className:"space-y-1",children:n.length?n.map(({name:e,label:t,icon:n})=>(0,a.jsxs)(ss.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs truncate",children:[(0,a.jsx)(n,{size:16,className:"opacity-60 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:t})]},e)):(0,a.jsxs)(ss.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs text-muted-foreground",children:[(0,a.jsx)(sz,{size:16,className:"opacity-60"}),i("input.noTools")]})})})]}),s&&s.length>0&&(0,a.jsxs)(ss.DropdownMenu,{children:[(0,a.jsxs)(ss.DropdownMenuTrigger,{render:(0,a.jsx)(eE.Button,{variant:"ghost",size:"sm",className:"h-6 px-2 rounded-full border border-transparent hover:bg-accent text-muted-foreground text-xs"}),children:[(0,a.jsx)(sF,{className:"size-3"}),(0,a.jsxs)("span",{children:[i("input.todos")," ",s.length]}),(0,a.jsx)(sB,{className:"size-3"})]}),(0,a.jsxs)(ss.DropdownMenuContent,{align:"start",className:"w-80 rounded-2xl p-1.5 bg-popover border-border",children:[(0,a.jsx)(ss.DropdownMenuGroup,{className:"space-y-0.5",children:s.map((e,t)=>(0,a.jsxs)(ss.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs gap-2",onSelect:e=>e.preventDefault(),children:["completed"===e.status?(0,a.jsx)(sF,{size:14,className:"text-green-500 shrink-0"}):"in_progress"===e.status?(0,a.jsx)(s_,{size:14,className:"text-blue-500 shrink-0 animate-spin",style:{animationDuration:"3s"}}):(0,a.jsx)(sW,{size:14,className:"text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:(0,M.cn)("todo-text-scroll","completed"===e.status&&"line-through text-muted-foreground"),children:sG(e,i("untitledTodo"))})]},e.id||`${sG(e,i("untitledTodo"))}-${t}`))}),r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ss.DropdownMenuSeparator,{}),(0,a.jsxs)(ss.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs text-destructive focus:text-destructive gap-2 justify-center cursor-pointer",onClick:e=>{e.stopPropagation(),r()},children:[(0,a.jsx)(sV,{size:14}),i("input.clearTodos")]})]})]})]}),(0,a.jsx)("div",{className:"flex-1"})]})}let sJ=(0,r.forwardRef)(function({channelName:e,channelId:t,workspaceId:n,channel:s,agents:d,messages:c=[],onSend:u,isProcessing:m=!1,onStop:p,replyTo:x,onCancelReply:h},g){let f=(0,l.useTranslations)("chat"),[v,j]=(0,r.useState)(!1),{isRecording:y,start:b,stop:N}=function(){let[e,t]=(0,r.useState)(!1),[n,s]=(0,r.useState)(null),a=(0,r.useRef)(null),l=(0,r.useRef)(null),i=(0,r.useRef)(null),o=(0,r.useRef)(null),d=(0,r.useRef)(null),c=(0,r.useRef)(()=>{}),u=(0,r.useCallback)(async()=>{let e=(0,su.getToken)();console.log("[speech] loading config, token:",e?"present":"missing");let t=await fetch("/api/speech-recognition",{headers:e?{Authorization:`Bearer ${e}`}:{}});if(console.log("[speech] config response status:",t.status),!t.ok)return null;let n=await t.json();return console.log("[speech] configs found:",n.length,n.length>0?n[0]:""),n.length>0?n[0]:null},[]),m=(0,r.useCallback)(()=>{d.current&&(clearInterval(d.current),d.current=null),i.current?.disconnect(),l.current?.close(),o.current?.getTracks().forEach(e=>e.stop()),a.current?.readyState===WebSocket.OPEN&&(a.current.send(JSON.stringify({type:"end"})),a.current.close()),a.current=null,i.current=null,l.current=null,o.current=null,t(!1)},[]);return(0,r.useEffect)(()=>{c.current=m},[m]),{isRecording:e,start:(0,r.useCallback)(async e=>{let n,r=await u();if(!r)return console.warn("[speech] no config found, aborting"),!1;s(r);let d=(0,su.getToken)(),m="https:"===location.protocol?"wss:":"ws:",p=`${m}//${location.host}/ws/speech?token=${d??""}&configId=${r.id}`;console.log("[speech] connecting to",p.replace(/token=[^&]+/,"token=***"));let x=new WebSocket(p);a.current=x,x.onmessage=t=>{try{let n=JSON.parse(t.data);if(n.error)return void console.error("[speech] error from server:",n.error);n.text&&(console.log("[speech] result:",n.text,"isFinal:",n.isFinal),e(n.text,n.isFinal))}catch(e){console.error("[speech] failed to parse message:",e)}},x.onerror=e=>{console.error("[speech] WebSocket error",e),c.current()};try{await new Promise((e,t)=>{x.onopen=()=>{console.log("[speech] WebSocket connected"),e()},x.onerror=e=>{console.error("[speech] WebSocket connect failed",e),t(Error("WS connect failed"))}})}catch{return!1}try{n=await navigator.mediaDevices.getUserMedia({audio:{sampleRate:16e3,channelCount:1,echoCancellation:!0}}),console.log("[speech] microphone acquired, tracks:",n.getAudioTracks().length)}catch(e){return console.error("[speech] microphone access denied:",e),x.close(),!1}o.current=n;let h=new AudioContext({sampleRate:16e3});l.current=h,console.log("[speech] AudioContext sampleRate:",h.sampleRate);let g=h.createMediaStreamSource(n),f=h.createScriptProcessor(4096,1,1);i.current=f;let v=0;return f.onaudioprocess=e=>{if(x.readyState!==WebSocket.OPEN)return;let t=e.inputBuffer.getChannelData(0),n=new Int16Array(t.length);for(let e=0;e<t.length;e++){let s=Math.max(-1,Math.min(1,t[e]));n[e]=s<0?32768*s:32767*s}x.send(n.buffer),(++v<=3||v%50==0)&&console.log("[speech] sent audio chunk #",v,"size:",n.buffer.byteLength)},g.connect(f),f.connect(h.destination),t(!0),!0},[u]),stop:m,config:n}}(),[k,w]=(0,r.useState)([]),[C,S]=(0,r.useState)([]),[T,I]=(0,r.useState)(!1),[z,D]=(0,r.useState)(!1),R=(0,r.useRef)(m),P=(0,r.useRef)(u),A=(0,r.useRef)(null),O=(0,r.useRef)(null),E=(0,r.useRef)(!1),$=(0,r.useRef)(null),L=(0,r.useRef)(d),U=(0,r.useRef)(s),B=(0,r.useRef)([]),F=(0,r.useRef)({mcps:[],tools:[]}),{saveDraft:W,clearDraft:_,updateChannel:H}=(0,i.useChannelStore)(),[q,V]=(0,r.useState)(!1),G=(0,o.useAgentStore)(e=>e.agents),K=s.pinnedMentionId,J=K===k[0]&&!!K,Q=(0,r.useMemo)(()=>{if(0===k.length)return[];let e=new Map(d.map(e=>[e.id,e]));return k.map(t=>e.get(t)).filter(e=>!!e)},[d,k])[0],X=(0,r.useMemo)(()=>(function(e){if(!e)return[];let t=e.mcpServers;return!t||"object"!=typeof t||Array.isArray(t)?[]:Object.keys(t)})(Q?.mcps),[Q?.mcps]),Y=(0,r.useMemo)(()=>Q?.skills??[],[Q?.skills]),Z=(0,r.useMemo)(()=>{let e=new Set(Q?.tools??[]);return(sC.BUILT_IN_AGENT_TOOLS??[]).filter(t=>e.has(t.name)).map(e=>{var t;return{...e,icon:"CreateCurrentChannelIssue"===(t=e.name)?sd:"ViewCurrentChannelIssue"===t?sM:"AddCurrentChannelComment"===t?sI:sz}})},[Q?.tools]),ee=(0,r.useMemo)(()=>Z.map(e=>({name:e.name,label:e.label})),[Z]),et=(0,r.useMemo)(()=>{let e=new Map;for(let t of c)t.senderId&&"user"!==t.senderId&&e.set(t.senderId,t.createdAt);return e},[c]),en=(0,r.useMemo)(()=>{let e=Q?.id;return[...d].sort((t,n)=>{if(t.id===e)return -1;if(n.id===e)return 1;let s=et.get(t.id)??"";return(et.get(n.id)??"").localeCompare(s)})},[d,Q?.id,et]);(0,r.useEffect)(()=>{R.current=m},[m]),(0,r.useEffect)(()=>{P.current=u},[u]),(0,r.useEffect)(()=>{L.current=d},[d]),(0,r.useEffect)(()=>{U.current=s},[s]),(0,r.useEffect)(()=>{B.current=Y},[Y]),(0,r.useEffect)(()=>{F.current={mcps:X,tools:ee}},[X,ee]);let es=(0,r.useCallback)(e=>{O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{e.trim()?W(n,t,e):_(n,t)},1e3)},[n,t,W,_]),ea=(0,r.useCallback)(async()=>{let e=A.current;if(!e||R.current||E.current)return;let s=e.getText().trim();if(!s&&0===C.length)return;let a=sD(e.getJSON());E.current=!0,I(!0),O.current&&(clearTimeout(O.current),O.current=null);try{let r=await Promise.all(C.map(sP));P.current(s?function(e){if(!e)return e;let t=e.replace(/<\/?p>/g,"");return/<[^>]+>/.test(t)?e:e.replace(/<\/p>\s*<p>/g,"\n").replace(/<\/?p>/g,"")}(e.getHTML()):"",a,r,x?.id),e.commands.clearContent(),S(e=>(e.forEach(e=>URL.revokeObjectURL(e.preview)),[])),w([]),h?.(),_(n,t)}finally{E.current=!1,I(!1)}},[C,n,t,x?.id,h,_]),{getRootProps:er,getInputProps:el,open:ei}=(0,sg.useDropzone)({noClick:!0,noKeyboard:!0,multiple:!0,accept:{"image/*":[],"application/pdf":[".pdf"],"application/msword":[".doc"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"text/*":[".txt",".md",".csv",".json"]},onDrop:e=>{S(t=>[...t,...e.map(e=>({file:e,preview:URL.createObjectURL(e)}))])}});(0,r.useEffect)(()=>()=>{C.forEach(e=>URL.revokeObjectURL(e.preview))},[C]);let eo=(0,r.useCallback)((e,t)=>{let{tr:n}=e.state,s=!1,a=[];e.state.doc.descendants((e,n)=>{"mention"===e.type.name&&e.attrs?.id!==t&&a.push({pos:n,nodeSize:e.nodeSize})});for(let e=a.length-1;e>=0;e--){let{pos:t,nodeSize:r}=a[e];n.delete(t,t+r),s=!0}s&&e.view.dispatch(n)},[]),ed=(0,r.useRef)(x);(0,r.useEffect)(()=>{ed.current=x},[x]);let ec=(0,r.useMemo)(()=>sh.default.configure({HTMLAttributes:{class:"mention"},suggestion:{char:"@",items:({query:e})=>{if(ed.current)return[];let t=e.toLowerCase();return L.current.filter(e=>!1!==e.enabled&&`${e.name} ${e.role} ${e.description||""}`.toLowerCase().includes(t)).slice(0,6).map(e=>({id:e.id,label:e.name||e.role,description:`${e.role}${e.description?` \xb7 ${e.description}`:""}`}))},command:({editor:e,range:t,props:n})=>{eo(e,n.id),e.chain().focus().insertContentAt(t,[{type:"mention",attrs:n}]).run()},render:()=>(0,sv.createSuggestionRenderer)()}}),[eo]),eu=(0,r.useMemo)(()=>(0,sj.createSlashExtension)(()=>B.current),[]),em=(0,r.useMemo)(()=>{let e;return e=null,sy.Extension.create({name:"fileSearch",addOptions:()=>({suggestion:{char:"#",items:async({query:t})=>{if(!t.trim())return[];e?.abort(),e=new AbortController;try{let s=await fetch(`/api/workspaces/${n}/search/files?q=${encodeURIComponent(t.trim())}`,{signal:e.signal});if(!s.ok)return[];return((await s.json()).results||[]).filter(e=>"file"===e.type).slice(0,10).map(e=>({id:e.path,title:e.name,description:e.path}))}catch{return[]}},command:({editor:e,range:t,props:n})=>{e.chain().focus().deleteRange(t).insertContent(n.description+" ").run()},render:()=>(0,sv.createSuggestionRenderer)()}}),addProseMirrorPlugins(){return[(0,sN.default)({pluginKey:sw,editor:this.editor,...this.options.suggestion})]}})},[n]),ep=(0,r.useMemo)(()=>(function(e=()=>({mcps:[],tools:[]})){return sy.Extension.create({name:"agentResource",addOptions:()=>({suggestion:{char:"$",items:({query:t})=>(function({mcps:e,tools:t},n){let s=n.toLowerCase(),a=new Set,r=[];for(let t of e){let e=t.trim(),n=`mcp:${e}`;!(!e||a.has(n))&&(a.add(n),e.toLowerCase().includes(s)&&r.push({id:n,title:e,description:"mcp",kind:"mcp",value:e}))}for(let e of t){let t=e.name.trim(),n=e.label.trim()||t,l=`tool:${t}`;!(!t||a.has(l))&&(a.add(l),`${t} ${n}`.toLowerCase().includes(s)&&r.push({id:l,title:n,description:`tool \xb7 ${t}`,kind:"tool",value:t}))}return r})(e(),t),command:({editor:e,range:t,props:n})=>{e.chain().focus().deleteRange(t).insertContent(`[use ${n.kind}: ${n.value}]`).run()},render:()=>(0,sv.createSuggestionRenderer)()}}),addProseMirrorPlugins(){return[(0,sN.default)({pluginKey:sk,editor:this.editor,...this.options.suggestion})]}})})(()=>F.current),[]),ex=(0,r.useRef)(ea);ex.current=ea;let eh=(0,sm.useEditor)({immediatelyRender:!1,extensions:[sp.default,sx.default.configure({placeholder:f("input.placeholder",{channel:e})}),ec,eu,ep,em],editorProps:{attributes:{class:"tiptap tiptap-chat"},handleKeyDown:(e,t)=>"Enter"===t.key&&!t.shiftKey&&!document.querySelector(".suggestion-menu")&&(t.preventDefault(),ex.current(),!0),handlePaste:(e,t)=>{let n,s=t.clipboardData?.getData("text/html");if(s?.includes('data-type="mention"'))return!1;let a=t.clipboardData?.getData("text/plain");if(!a||!/@\S+/.test(a))return!1;let r=L.current;if(0===r.length)return!1;let l=/@(\S+)/g,i=!1;for(;null!==(n=l.exec(a));)if(r.some(e=>e.name===n[1]||e.id===n[1]||e.role===n[1])){i=!0;break}if(!i)return!1;let o=A.current;return!!o&&(o.commands.insertContent(sR(a,r)),!0)}},content:"",onUpdate:({editor:e})=>{let t=sD(e.getJSON());w(e=>e.length===t.length&&e.every((e,n)=>e===t[n])?e:t),es(e.getHTML())}},[ec,eu,ep,em,e]);(0,r.useEffect)(()=>{A.current=eh},[eh]);let eg=(0,r.useCallback)(e=>{if(!eh||k[0]===e.id)return;eo(eh,e.id);let t=eh.getText().trim(),n=[{type:"mention",attrs:{id:e.id,label:e.name||e.role}},{type:"text",text:" "+t}];eh.commands.setContent({type:"doc",content:[{type:"paragraph",content:n}]},{emitUpdate:!0}),eh.commands.focus("end")},[eh,k,eo]);(0,r.useEffect)(()=>{if(!eh||$.current===t)return;$.current=t,O.current&&(clearTimeout(O.current),O.current=null);let e=U.current.draft,n=U.current.pinnedMentionId,s=n?L.current.find(e=>e.id===n):void 0,a=e?.content?e.content:s?[{type:"mention",attrs:{id:s.id,label:s.name||s.role}},{type:"text",text:" "}]:"";eh.commands.setContent(a,{emitUpdate:!1}),w(sD(eh.getJSON()))},[eh,t]),(0,r.useImperativeHandle)(g,()=>({setContent:(e,t)=>{if(eh){if(e.includes('data-type="mention"'))eh.commands.setContent(e,{emitUpdate:!1});else{let n=/<[a-z][\s\S]*>/i.test(e)?e.replace(/<[^>]*>/g,""):e,s=t??L.current;s.length>0&&/@\S+/.test(n)?eh.commands.setContent(sR(n,s),{emitUpdate:!1}):eh.commands.setContent(n,{emitUpdate:!1})}eh.commands.focus("end")}},focus:()=>{eh?.commands.focus("end")}}),[eh]);let ef=(0,r.useCallback)(()=>{ea()},[ea]),ev=(!!(0,sm.useEditorState)({editor:eh,selector:e=>!!e.editor?.getText().trim()})||C.length>0)&&!T,ej=(0,r.useCallback)(e=>{S(t=>{let n=[...t],[s]=n.splice(e,1);return s&&URL.revokeObjectURL(s.preview),n})},[]),ey=(0,r.useCallback)(()=>{let e=k[0];e&&H(n,t,{pinnedMentionId:J?void 0:e})},[k,J,n,t,H]),eb=(0,r.useCallback)(()=>{y?N():b((e,t)=>{let n=A.current;n&&t&&n.chain().focus().insertContent(e).run()})},[y,b,N]),eN=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(ss.DropdownMenu,{children:[(0,a.jsx)(ss.DropdownMenuTrigger,{render:(0,a.jsx)(eE.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full border border-border hover:bg-accent"}),children:(0,a.jsx)(sd,{className:"size-3"})}),(0,a.jsx)(ss.DropdownMenuContent,{align:"start",className:"max-w-xs rounded-2xl p-1.5",children:(0,a.jsx)(ss.DropdownMenuGroup,{className:"space-y-1",children:(0,a.jsxs)(ss.DropdownMenuItem,{className:"rounded-[calc(1rem-6px)] text-xs",onClick:ei,children:[(0,a.jsx)(so,{size:16,className:"opacity-60"}),f("input.attachFiles")]})})})]}),(0,a.jsxs)(eE.Button,{variant:"ghost",size:"sm",onClick:()=>D(!z),className:(0,M.cn)("h-7 px-2 rounded-full border border-border hover:bg-accent",{"bg-primary/10 text-primary border-primary/30":z,"text-muted-foreground":!z}),children:[(0,a.jsx)(sc,{className:"size-3"}),(0,a.jsx)("span",{className:"text-xs",children:f("input.autoMode")})]}),(0,a.jsx)(eE.Button,{variant:"ghost",size:"sm",onClick:eb,className:(0,M.cn)("h-7 w-7 p-0 rounded-full border border-border hover:bg-accent",{"bg-red-500/10 text-red-500 border-red-500/30 animate-pulse":y,"text-muted-foreground":!y}),title:f(y?"input.voiceStop":"input.voiceStart"),children:(0,a.jsx)(si,{className:"size-3"})})]});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex justify-center -mt-0.5",children:(0,a.jsx)("button",{type:"button",onClick:()=>j(e=>!e),className:"p-0.5 text-muted-foreground/60 hover:text-foreground transition-colors",children:(0,a.jsx)(sl,{className:(0,M.cn)("size-3.5 transition-transform",v&&"rotate-180")})})}),!v&&(0,a.jsxs)("div",{className:"border-t px-4 py-2",children:[!x&&(0,a.jsx)(sU,{agents:en,activeAgent:Q,pinnedMentionId:K,isPinned:J,channel:s,onActivateAgent:eg,onTogglePin:ey,onOpenAddMember:()=>V(!0),onToggleNotify:()=>H(n,t,{notifyOnComplete:!s.notifyOnComplete})}),(0,a.jsx)(sf.ComposerShell,{workspaceId:n,editor:eh,canSubmit:ev,onSubmit:ef,onStop:p,isProcessing:m||T,actions:eN,dropzoneProps:er(),hiddenInput:(0,a.jsx)("input",{...el(),"data-chat-file-input":""}),replyLabel:x?.label,onCancelReply:h}),C.length>0&&(0,a.jsx)(tb,{variant:"inline",className:"mt-2 justify-start",children:C.map((e,t)=>(0,a.jsxs)(tN,{data:{id:`${e.file.name}-${e.file.lastModified}`,type:"file",filename:e.file.name,mediaType:e.file.type,url:e.preview},onRemove:()=>ej(t),children:[(0,a.jsx)(tk,{}),(0,a.jsx)(tw,{}),(0,a.jsx)(tC,{})]},`${e.file.name}-${e.file.lastModified}-${t}`))}),(0,a.jsx)(sK,{mcps:X,skills:Y,tools:Z,todos:s.todos,onClearTodos:()=>H(n,t,{todos:[]})})]}),(0,a.jsx)(sS.AddMemberDialog,{open:q,onOpenChange:V,candidates:G.filter(e=>!1!==e.enabled).map(e=>({id:e.id,label:(0,sT.getAgentDisplayName)(e),description:e.role})),defaultSelected:s.members,onAdd:e=>{let s=G.filter(e=>!1!==e.enabled);H(n,t,{members:(0,sT.normalizeChannelMembersToAgentIds)(s,e)})}})]})});var sQ=e.i(681622),sX=e.i(613087);let sY=({className:e,status:t,...n})=>(0,a.jsx)(eb.Badge,{className:(0,M.cn)("flex items-center gap-2","group",t,e),variant:"secondary",...n}),sZ=({className:e,...t})=>(0,a.jsxs)("span",{className:(0,M.cn)("relative flex h-2 w-2",e),...t,children:[(0,a.jsx)("span",{className:(0,M.cn)("absolute inline-flex h-full w-full animate-ping rounded-full opacity-75","group-[.online]:bg-emerald-500","group-[.offline]:bg-red-500","group-[.maintenance]:bg-blue-500","group-[.degraded]:bg-amber-500")}),(0,a.jsx)("span",{className:(0,M.cn)("relative inline-flex h-2 w-2 rounded-full","group-[.online]:bg-emerald-500","group-[.offline]:bg-red-500","group-[.maintenance]:bg-blue-500","group-[.degraded]:bg-amber-500")})]}),s0=({className:e,children:t,...n})=>(0,a.jsx)("span",{className:(0,M.cn)("text-muted-foreground",e),...n,children:t??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"hidden group-[.online]:block",children:"Online"}),(0,a.jsx)("span",{className:"hidden group-[.offline]:block",children:"Offline"}),(0,a.jsx)("span",{className:"hidden group-[.maintenance]:block",children:"Maintenance"}),(0,a.jsx)("span",{className:"hidden group-[.degraded]:block",children:"Degraded"})]})});var s1=e.i(767467),s2=ni,s3=e.i(583705),s5=e.i(759309),s5=s5,s4=e.i(307858),s6=e.i(14452),s9=e.i(227634),s8=e.i(325443),s7=e.i(511800),ae=e.i(529658),at=e.i(929709),an=e.i(478117);function as({name:e,agentId:t,description:n,onClick:s}){return(0,a.jsxs)("button",{type:"button",onClick:s,className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left transition-colors",children:[(0,a.jsx)(N.AgentIcon,{agentId:t,name:e,className:"size-7 rounded-full"}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block text-sm truncate",children:e}),n&&(0,a.jsx)("span",{className:"block text-xs text-muted-foreground truncate",children:n})]})]})}var aa=e.i(250226);function ar({workspaceId:e,channel:t,agents:n,allChannels:s,onDeleted:o}){let d=(0,l.useTranslations)("chat"),c=(0,l.useTranslations)("common"),{updateChannel:p,deleteChannel:x}=(0,i.useChannelStore)(),[h,g]=(0,r.useState)(!1),[f,v]=(0,r.useState)(!1),[j,b]=(0,r.useState)(""),[N,k]=(0,r.useState)(!1),[w,C]=(0,r.useState)(!1),S=n.filter(e=>!1!==e.enabled),M=S.map(e=>({id:e.id,label:(0,sT.getAgentDisplayName)(e),description:e.role})),I=async()=>{await x(e,t.id),C(!1),aa.useMobilePanelStore.getState().setActivePanel("channel-list"),o?.()};return(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 h-12 border-b shrink-0",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:["agent"===t.type?(0,a.jsx)(s8.Bot,{className:"size-4 text-muted-foreground shrink-0"}):"issue"===t.type?(0,a.jsx)(s7.AlertCircle,{className:"size-4 text-muted-foreground shrink-0"}):(0,a.jsx)(s9.Hash,{className:"size-4 text-muted-foreground shrink-0"}),(0,a.jsxs)("span",{className:"text-sm font-medium truncate",children:["#",t.name]})]})}),(0,a.jsxs)(nR.Tabs,{defaultValue:"info",className:"flex flex-col flex-1 min-h-0",children:[(0,a.jsxs)(nR.TabsList,{className:"w-full rounded-none border-b bg-transparent h-9 p-0 shrink-0",children:[(0,a.jsxs)(nR.TabsTrigger,{value:"info",className:"flex-1 gap-1.5 data-[state=active]:shadow-none data-[state=active]:border-b-2 data-[state=active]:border-primary rounded-none",children:[(0,a.jsx)(s3.Info,{className:"size-3.5"}),d("channel.info")]}),(0,a.jsxs)(nR.TabsTrigger,{value:"members",className:"flex-1 gap-1.5 data-[state=active]:shadow-none data-[state=active]:border-b-2 data-[state=active]:border-primary rounded-none",children:[(0,a.jsx)(ae.Users,{className:"size-3.5"}),d("channel.members")]})]}),(0,a.jsxs)(nD.ScrollArea,{className:"flex-1 min-h-0",children:[(0,a.jsxs)(nR.TabsContent,{value:"info",className:"p-4 mt-0 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex items-center justify-center size-10 rounded-lg bg-muted",children:"agent"===t.type?(0,a.jsx)(s8.Bot,{className:"size-5 text-muted-foreground"}):"issue"===t.type?(0,a.jsx)(s7.AlertCircle,{className:"size-5 text-muted-foreground"}):(0,a.jsx)(s9.Hash,{className:"size-5 text-muted-foreground"})}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("p",{className:"text-sm font-medium",children:["#",t.name]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:[d("channel.type")," ",d(`channel.${t.type}`)]})]}),(0,a.jsx)(eE.Button,{variant:"ghost",size:"icon-sm",onClick:()=>g(!0),children:(0,a.jsx)(u.Pencil,{className:"size-3.5"})})]}),(0,a.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:d("channel.channelId")}),(0,a.jsxs)("span",{className:"font-mono text-xs",children:[t.id.slice(0,8),"..."]})]}),(0,a.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:d("channel.memberCount")}),(0,a.jsx)("span",{children:t.members.length})]}),(0,a.jsxs)("div",{className:"flex justify-between py-1 border-b",children:[(0,a.jsx)("span",{className:"text-muted-foreground",children:d("channel.createdAt")}),(0,a.jsx)("span",{children:new Date(t.createdAt).toLocaleDateString()})]})]})]}),(0,a.jsxs)(nR.TabsContent,{value:"members",className:"p-4 mt-0 space-y-1",children:[0===t.members.length&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:d("channel.noMembers")}),t.members.map(e=>(0,a.jsx)(as,{name:(0,sT.getMemberDisplayName)(S,e),agentId:"user"!==e?e:void 0,description:"user"!==e?e:void 0,onClick:()=>{b(e),v(!0)}},e)),(0,a.jsxs)(eE.Button,{variant:"ghost",size:"sm",className:"w-full mt-2 text-xs text-muted-foreground",onClick:()=>k(!0),children:[(0,a.jsx)(at.UserPlus,{className:"size-3.5 mr-1"}),d("channel.addMember")]})]})]})]}),(0,a.jsx)("div",{className:"shrink-0 p-3 border-t",children:(0,a.jsxs)(eE.Button,{variant:"ghost",size:"sm",className:"w-full text-xs text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>C(!0),children:[(0,a.jsx)(m.Trash2,{className:"size-3.5 mr-1"}),d("channel.delete")]})}),(0,a.jsx)(an.ChannelDialog,{open:h,onOpenChange:g,workspaceId:e,channel:t,agents:n,onSubmit:n=>p(e,t.id,{...n,members:(0,sT.normalizeChannelMembersToAgentIds)(S,n.members)})}),(0,a.jsx)(T,{open:f,onOpenChange:v,memberName:j,displayName:(0,sT.getMemberDisplayName)(S,j),channelId:t.id,workspaceId:e,channels:s.filter(e=>e.members.includes(j)).map(e=>e.name)}),(0,a.jsx)(sS.AddMemberDialog,{open:N,onOpenChange:k,candidates:M,defaultSelected:t.members,onAdd:n=>{p(e,t.id,{members:(0,sT.normalizeChannelMembersToAgentIds)(S,n)})}}),(0,a.jsx)(y.Dialog,{open:w,onOpenChange:C,children:(0,a.jsxs)(y.DialogContent,{children:[(0,a.jsxs)(y.DialogHeader,{children:[(0,a.jsx)(y.DialogTitle,{children:d("channel.delete")}),(0,a.jsx)(y.DialogDescription,{children:d("channel.deleteConfirm")})]}),(0,a.jsxs)(y.DialogFooter,{children:[(0,a.jsx)(y.DialogClose,{render:(0,a.jsx)(eE.Button,{variant:"outline"}),children:c("cancel")}),(0,a.jsxs)(eE.Button,{variant:"destructive",onClick:I,children:[(0,a.jsx)(m.Trash2,{className:"size-3.5"}),c("delete")]})]})]})})]})}var al=e.i(249673),ai=e.i(650654);function ao({messages:e,reverse:t}){var n;let s,l,i,[d,c]=(0,r.useState)(null),[u,m]=(0,r.useState)(!1),[p,x]=(0,r.useState)(0),h=(0,r.useRef)(null),g=t?[...e].reverse():e,f=(0,r.useCallback)(e=>{c(e);let t=document.getElementById(`msg-${g[e].id}`);t?.scrollIntoView({behavior:"smooth",block:"center"})},[g]),v=(0,r.useCallback)((e,t)=>{if(!t||!h.current)return;c(e);let n=h.current.getBoundingClientRect(),s=t.getBoundingClientRect();x(s.top-n.top+s.height/2)},[]);return 0===g.length?null:(0,a.jsxs)("div",{ref:h,className:"absolute right-2 top-1/2 -translate-y-1/2 z-10 flex flex-col items-center",onMouseEnter:()=>m(!0),onMouseLeave:()=>{m(!1),c(null)},children:[(0,a.jsx)("button",{className:`flex-shrink-0 mb-0.5 flex items-center justify-center size-5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-all ${u?"opacity-100":"opacity-0 pointer-events-none"} ${null===d||d<=0?"invisible":""}`,onClick:()=>{null!==d&&d>0&&f(d-1)},children:(0,a.jsx)(al.ChevronUp,{className:"size-3.5"})}),(0,a.jsx)("div",{className:"flex-1 w-full max-h-[70vh] overflow-y-auto scrollbar-none",children:(0,a.jsx)("div",{className:"flex flex-col gap-[3px] px-1 py-0.5",children:g.map((e,t)=>(0,a.jsx)("div",{className:"flex justify-center",children:(0,a.jsx)("button",{className:`h-[4px] rounded-full transition-all duration-150 ${d===t?"bg-primary w-6":"user"===e.senderId?"bg-primary/30 hover:bg-primary/50 w-5":"bg-muted-foreground/25 hover:bg-muted-foreground/40 w-5"}`,onClick:()=>f(t),onMouseEnter:e=>v(t,e.currentTarget)})},e.id))})}),(0,a.jsx)("button",{className:`flex-shrink-0 mt-0.5 flex items-center justify-center size-5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/80 transition-all ${u?"opacity-100":"opacity-0 pointer-events-none"} ${null===d||d>=g.length-1?"invisible":""}`,onClick:()=>{null!==d&&d<g.length-1&&f(d+1)},children:(0,a.jsx)(ai.ChevronDown,{className:"size-3.5"})}),u&&null!==d&&(0,a.jsxs)("div",{className:"absolute right-full mr-3 w-56 rounded-lg border bg-popover p-2.5 shadow-lg z-50 animate-in fade-in-0 zoom-in-95 duration-75",style:{top:p,transform:"translateY(-50%)"},children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,a.jsx)("span",{className:"font-medium text-xs",children:"user"===g[d].senderId?"You":(0,o.findAgentById)(g[d].senderId)?.name??g[d].senderId}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:new Date(g[d].createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-3 leading-relaxed",children:(n=g[d],l=(s=n.parts?.find(e=>"text"===e.type))?s.text:n.content,(i=/<[a-z][\s\S]*>/i.test(l)?l.replace(/<[^>]*>/g,""):l).length>150?i.slice(0,150)+"...":i)})]})]})}var ad=e.i(636288),ac=e.i(327964);let au={general:{status:"online"},issue:{status:"degraded"},agent:{status:"maintenance"}};function am({members:e}){let t=e.filter(e=>"user"!==e).slice(0,4),n=e.length-t.length-!!e.includes("user");return(0,a.jsxs)(ad.AvatarGroup,{className:"ml-1 [&>[data-slot=avatar]]:size-5",children:[t.map(e=>(0,a.jsx)(N.AgentIcon,{agentId:e,className:"size-5 rounded-full"},e)),n>0&&(0,a.jsxs)(ad.AvatarGroupCount,{className:"!size-5 text-[10px]",children:["+",n]})]})}function ap({question:e,onAnswer:t}){let n=(0,l.useTranslations)("chat"),[s,i]=(0,r.useState)(""),[o,d]=(0,r.useState)(!1),c=e=>{let n=e.trim();n&&!o&&(d(!0),t(n),i(""))};return(0,a.jsx)("div",{className:"border-t bg-background px-4 py-3",children:(0,a.jsx)("div",{className:"rounded-md border bg-muted/30 p-3",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(s2.default,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-3",children:[(0,a.jsx)("div",{className:"text-sm font-medium",children:e.question}),e.choices.length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:e.choices.map(e=>(0,a.jsx)(eE.Button,{type:"button",size:"sm",variant:"outline",disabled:o,onClick:()=>c(e),className:"h-8",children:e},e))}):null,(0,a.jsxs)("form",{className:"flex gap-2",onSubmit:e=>{e.preventDefault(),c(s)},children:[(0,a.jsx)(sQ.Input,{value:s,onChange:e=>i(e.target.value),disabled:o,className:"h-8 text-sm",placeholder:n("pendingQuestion.placeholder")}),(0,a.jsx)(eE.Button,{type:"submit",size:"icon-sm",disabled:!s.trim()||o,children:(0,a.jsx)(s5.default,{className:"size-3.5"})})]})]})]})})})}e.s(["ChatPanel",0,function({workspaceId:e}){let t=(0,l.useTranslations)("chat"),n=(0,l.useTranslations)("common"),{activeChannelId:s,channels:c,messages:u,loadMessages:p,loadChannelState:x,sendMessage:h,addMessage:g,updateMessage:f,stopProcessingMessages:v,deleteMessage:j,clearMessages:b,upsertChannel:N}=(0,i.useChannelStore)(),k=(0,r.useRef)(null),[w,C]=(0,r.useState)(!1),[S,T]=(0,r.useState)(null),[M,I]=(0,r.useState)(!1),[z,D]=(0,r.useState)(null),[R,P]=(0,r.useState)(!1),[A,O]=(0,r.useState)(!1),E=(0,r.useRef)(null),$=(0,o.useAgentStore)(e=>e.agents),L=(0,o.useAgentStore)(e=>e.ensure),U=c.find(e=>e.id===s),B=(0,r.useMemo)(()=>s&&u[s]||[],[s,u]),F=B[B.length-1]?.status,W=(0,r.useMemo)(()=>(function(e){for(let t=e.length-1;t>=0;t-=1){let n=e[t];if("waiting_for_user"!==n.status)continue;let s=n.parts?.find(e=>"ask_user_question"===e.type&&"answered"!==e.status);if(s&&"ask_user_question"===s.type)return{messageId:n.id,questionId:s.id,question:s.question,choices:s.choices??[]}}return null})(B),[B]),_=(0,r.useMemo)(()=>{if(!U)return[];let e=new Map($.filter(e=>!1!==e.enabled).map(e=>[e.id,e]));return U.members.map(t=>e.get(t)).filter(e=>!!e)},[$,U]);(0,r.useEffect)(()=>{s&&(O(!1),P(!0),p(e,s).finally(()=>P(!1))),L()},[s,e,p,L]),(0,r.useEffect)(()=>{let t=(0,d.getWS)(e),n=t.on("channel.message",e=>{e.channelId===s&&g(e.channelId,e)}),a=t.on("channel.message.updated",e=>{e.channelId===s&&f(e.channelId,e)}),r=t.on("channel.message.deleted",e=>{e.channelId===s&&j(e.channelId,e.messageId)}),l=t.on("channel.messages.cleared",e=>{e.channelId===s&&i.useChannelStore.setState(e=>({messages:{...e.messages,[s]:[]}}))}),o=t.on("channel.updated",e=>{e.id===s&&N(e)});return()=>{n(),a(),r(),l(),o()}},[e,s,g,f,j,N]),(0,r.useEffect)(()=>{let e=k.current?.parentElement;e&&(e.scrollTop=0)},[B.length]),(0,r.useEffect)(()=>{if(!s||!e||!(F&&["pending","streaming","waiting_for_user"].includes(F)||A))return;let t=!1,n=async()=>{let n=await x(e,s);!t&&n&&(O(n.active),await p(e,s))},a=setInterval(n,3e3);return n(),()=>{t=!0,clearInterval(a)}},[s,e,A,F,p,x]);let H=(0,r.useCallback)((t,n,a,r)=>{s&&h(e,s,t,n,a,r)},[e,s,h]),q=A||B.length>0&&["pending","streaming","waiting_for_user"].includes(B[B.length-1].status??""),V=(0,r.useCallback)(()=>{s&&(v(s),(0,d.getWS)(e).send("channel.stop",{channelId:s}))},[e,s,v]),G=(0,r.useCallback)(e=>{E.current?.setContent(e.content,_)},[_]),K=(0,r.useCallback)(e=>{T(e)},[]),J=(0,r.useCallback)(e=>{let t="user"===e.senderId?void 0:$.find(t=>t.id===e.senderId);D({id:e.id,label:"user"===e.senderId?n("you"):t?.name||e.senderId}),E.current?.focus?.()},[$,n]),Q=(0,r.useCallback)(async()=>{S&&(await fetch(`/api/workspaces/${e}/channels/${S.channelId}/messages/${S.id}`,{method:"DELETE"}),T(null))},[e,S]);if(!U)return(0,a.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:t("emptyState")});let X=(()=>{let e=au[U.type];if(0===B.length)return{label:t("status.idle"),status:"degraded"};let n=B[B.length-1].status;if("waiting_for_user"===n)return{label:t("status.waitingForUser"),status:"degraded"};if("streaming"===n||"pending"===n)return{label:t("status.running"),status:"maintenance"};if("completed"===n)return{label:t("status.success"),status:"online"};if("error"===n){let e=B.slice(-3);return e.length>=3&&e.every(e=>"error"===e.status)?{label:t("status.error"),status:"offline"}:{label:t("status.running"),status:"degraded"}}return{label:t(`channelType.${U.type}`),status:e.status}})();return(0,a.jsxs)("div",{className:"flex h-full",children:[(0,a.jsxs)("div",{className:"flex flex-col flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b",children:[(0,a.jsx)(eE.Button,{variant:"ghost",size:"icon-sm",className:"md:hidden shrink-0",onClick:()=>aa.useMobilePanelStore.getState().setActivePanel("channel-list"),children:(0,a.jsx)(s1.ArrowLeft,{className:"size-4"})}),(0,a.jsxs)("span",{className:"text-sm font-semibold truncate shrink min-w-0",children:["# ",U.name]}),(0,a.jsxs)(sY,{status:X.status,children:[(0,a.jsx)(sZ,{}),(0,a.jsx)(s0,{children:X.label})]}),(0,a.jsx)(am,{members:U.members}),(0,a.jsx)("div",{className:"flex-1"}),U.issueId&&(0,a.jsx)(eE.Button,{variant:"ghost",size:"icon-sm",onClick:()=>ac.useIssueStore.getState().setActiveIssue(U.issueId),title:t("viewRelatedIssue"),children:(0,a.jsx)(s4.ExternalLink,{className:"size-4"})}),B.length>0&&(0,a.jsx)(eE.Button,{variant:"ghost",size:"icon-sm",onClick:()=>I(!0),children:(0,a.jsx)(m.Trash2,{className:"size-4"})}),(0,a.jsx)(eE.Button,{variant:"ghost",size:"icon-sm",onClick:()=>C(!0),children:(0,a.jsx)(s3.Info,{className:"size-4"})})]}),(0,a.jsxs)("div",{className:"flex-1 min-h-0 relative",children:[(0,a.jsxs)("div",{className:"h-full overflow-y-auto overflow-x-hidden py-2",children:[R&&0===B.length?(0,a.jsx)("div",{className:"space-y-4 px-4",children:Array.from({length:4},(e,t)=>(0,a.jsxs)("div",{className:"flex gap-3",children:[(0,a.jsx)(sX.Skeleton,{className:"size-6 rounded-full shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(sX.Skeleton,{className:"h-4 w-20"}),(0,a.jsx)(sX.Skeleton,{className:"h-3 w-12"})]}),(0,a.jsx)(sX.Skeleton,{className:"h-4 w-full"}),(0,a.jsx)(sX.Skeleton,{className:"h-4 w-3/4"})]})]},t))}):null,!R&&[...B].reverse().map(t=>(0,a.jsx)("div",{id:`msg-${t.id}`,children:(0,a.jsx)(se,{message:t,workspaceId:e,onEdit:G,onDelete:K,onReply:J})},t.id)),(0,a.jsx)("div",{ref:k})]}),(0,a.jsx)(ao,{messages:B,reverse:!0})]}),W?(0,a.jsx)(ap,{question:W,onAnswer:t=>{(0,d.getWS)(e).send("channel.answer_question",{channelId:U.id,messageId:W.messageId,questionId:W.questionId,answer:t})}}):null,(0,a.jsx)(sJ,{ref:E,channelName:U.name,channelId:U.id,workspaceId:e,channel:U,agents:_,messages:B,onSend:H,isProcessing:q,onStop:V,replyTo:z,onCancelReply:()=>D(null)})]}),(0,a.jsx)(s6.Sheet,{open:w,onOpenChange:C,children:(0,a.jsxs)(s6.SheetContent,{side:"right",className:"w-80 p-0 gap-0",children:[(0,a.jsxs)(s6.SheetHeader,{className:"sr-only",children:[(0,a.jsx)(s6.SheetTitle,{children:U.name}),(0,a.jsx)(s6.SheetDescription,{children:"Channel info panel"})]}),(0,a.jsx)(ar,{workspaceId:e,channel:U,agents:$,allChannels:c,onDeleted:()=>C(!1)})]})}),(0,a.jsx)(y.Dialog,{open:!!S,onOpenChange:e=>{e||T(null)},children:(0,a.jsxs)(y.DialogContent,{children:[(0,a.jsxs)(y.DialogHeader,{children:[(0,a.jsx)(y.DialogTitle,{children:t("deleteMessage.title")}),(0,a.jsx)(y.DialogDescription,{children:t("deleteMessage.description")})]}),(0,a.jsxs)(y.DialogFooter,{children:[(0,a.jsx)(y.DialogClose,{render:(0,a.jsx)(eE.Button,{variant:"outline"}),children:n("cancel")}),(0,a.jsxs)(eE.Button,{variant:"destructive",onClick:Q,children:[(0,a.jsx)(m.Trash2,{className:"size-3.5"}),n("delete")]})]})]})}),(0,a.jsx)(y.Dialog,{open:M,onOpenChange:I,children:(0,a.jsxs)(y.DialogContent,{children:[(0,a.jsxs)(y.DialogHeader,{children:[(0,a.jsx)(y.DialogTitle,{children:t("clearMessages.title")}),(0,a.jsx)(y.DialogDescription,{children:t("clearMessages.description",{channel:U?.name})})]}),(0,a.jsxs)(y.DialogFooter,{children:[(0,a.jsx)(y.DialogClose,{render:(0,a.jsx)(eE.Button,{variant:"outline"}),children:n("cancel")}),(0,a.jsxs)(eE.Button,{variant:"destructive",onClick:async()=>{U&&await b(e,U.id),I(!1)},children:[(0,a.jsx)(m.Trash2,{className:"size-3.5"}),t("clearMessages.confirm")]})]})]})})]})}],885761)},773354,e=>{e.n(e.i(885761))}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,386041,t=>{"use strict";let e=(0,t.i(433721).default)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);t.s(["Code2",0,e],386041)},835829,t=>{"use strict";function e(t){return`agent-spaces:inspector-history:${t}`}function s(t){try{var s;return s=JSON.parse(localStorage.getItem(e(t))||"[]"),Array.isArray(s)?s.filter(t=>t&&"object"==typeof t&&"string"==typeof t.path&&"number"==typeof t.line).map(t=>({...t,column:"number"==typeof t.column?t.column:1,timestamp:"number"==typeof t.timestamp?t.timestamp:Date.now()})).slice(0,50):[]}catch{return[]}}function i(t,s){localStorage.setItem(e(t),JSON.stringify(s.slice(0,50)))}let a=(0,t.i(816709).create)(t=>({histories:{},loadHistory:e=>{let i=s(e);t(t=>({histories:{...t.histories,[e]:i}}))},addEntry:(e,a)=>{let r={...a,id:a.id??`${a.timestamp}-${Math.random().toString(36).slice(2,8)}`,column:a.column??1,timestamp:a.timestamp??Date.now()},o=s(e).filter(t=>t.path!==r.path||t.line!==r.line||t.column!==r.column),n=[r,...o].slice(0,50);i(e,n),t(t=>({histories:{...t.histories,[e]:n}}))},setHistory:(e,s)=>{i(e,s),t(t=>({histories:{...t.histories,[e]:s}}))},clearHistory:e=>{i(e,[]),t(t=>({histories:{...t.histories,[e]:[]}}))}}));t.s(["useInspectorHistoryStore",0,a])},194228,t=>{"use strict";let e=(0,t.i(433721).default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);t.s(["GitCommitHorizontal",0,e],194228)},253307,t=>{"use strict";let e=(0,t.i(433721).default)("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);t.s(["FileDiff",0,e],253307)},363156,t=>{"use strict";var e=t.i(816709);let s=/not a git repository/i;function i(t){return t instanceof Error&&s.test(t.message)}let a=(0,e.create)(t=>({status:null,diffs:[],selectedFile:null,log:[],branches:[],loading:!1,error:null,notGitRepo:!1,loadStatus:async e=>{try{let s=await fetch(`/api/workspaces/${e}/git/status`);if(!s.ok)throw Error(await s.text());let i=await s.json();t({status:i,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),notGitRepo:i(e)})}},loadDiffs:async(e,s)=>{t({loading:!0});try{let i=s?`/api/workspaces/${e}/git/diff?path=${encodeURIComponent(s)}`:`/api/workspaces/${e}/git/diff`,a=await fetch(i);if(!a.ok)throw Error(await a.text());let r=await a.json();t({diffs:r,loading:!1,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),loading:!1,notGitRepo:i(e)})}},loadLog:async e=>{try{let s=await fetch(`/api/workspaces/${e}/git/log`);if(!s.ok)throw Error(await s.text());let i=await s.json();t({log:i,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),notGitRepo:i(e)})}},loadBranches:async e=>{try{let s=await fetch(`/api/workspaces/${e}/git/branches`);if(!s.ok)throw Error(await s.text());let i=await s.json();t({branches:i,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e),notGitRepo:i(e)})}},initRepo:async e=>{try{let s=await fetch(`/api/workspaces/${e}/git/init`,{method:"POST"});if(!s.ok)throw Error(await s.text());t({error:null,notGitRepo:!1})}catch(e){t({error:e instanceof Error?e.message:String(e)})}},commit:async(e,s)=>{try{let t=await fetch(`/api/workspaces/${e}/git/commit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:s})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},discard:async(e,s)=>{try{let t=await fetch(`/api/workspaces/${e}/git/discard`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},discardAll:async e=>{try{let t=await fetch(`/api/workspaces/${e}/git/discard-all`,{method:"POST"});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},checkout:async(e,s)=>{try{let t=await fetch(`/api/workspaces/${e}/git/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({branch:s})});if(!t.ok)throw Error(await t.text())}catch(e){t({error:e instanceof Error?e.message:String(e)})}},push:async t=>{let e=await fetch(`/api/workspaces/${t}/git/push`,{method:"POST"});if(!e.ok)throw Error((await e.json().catch(()=>({error:"Push failed"}))).error)},pull:async t=>{let e=await fetch(`/api/workspaces/${t}/git/pull`,{method:"POST"});if(!e.ok)throw Error((await e.json().catch(()=>({error:"Pull failed"}))).error)},getRemotes:async t=>{let e=await fetch(`/api/workspaces/${t}/git/remotes`);if(!e.ok)throw Error(await e.text());return e.json()},addRemote:async(t,e,s)=>{let i=await fetch(`/api/workspaces/${t}/git/remotes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,url:s})});if(!i.ok)throw Error((await i.json().catch(()=>({error:"Failed to add remote"}))).error)},selectFile:e=>t({selectedFile:e}),checkoutDetached:async(t,e)=>{let s=await fetch(`/api/workspaces/${t}/git/checkout-detached`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:e})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error)},cherryPick:async(t,e)=>{let s=await fetch(`/api/workspaces/${t}/git/cherry-pick`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitHash:e})});if(!s.ok)throw Error((await s.json().catch(()=>({}))).error)},createBranch:async(t,e,s)=>{let i=await fetch(`/api/workspaces/${t}/git/create-branch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,startPoint:s})});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error)},deleteBranch:async(t,e,s)=>{let i=await fetch(`/api/workspaces/${t}/git/delete-branch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,force:s})});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error)},createTag:async(t,e,s)=>{let i=await fetch(`/api/workspaces/${t}/git/create-tag`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,commitHash:s})});if(!i.ok)throw Error((await i.json().catch(()=>({}))).error)},getCommitDiff:async(t,e)=>{let s=await fetch(`/api/workspaces/${t}/git/commit-diff?hash=${encodeURIComponent(e)}`);if(!s.ok)throw Error((await s.json().catch(()=>({}))).error);return s.json()},getRemoteUrl:async t=>{let e=await fetch(`/api/workspaces/${t}/git/remote-url`);if(!e.ok)throw Error((await e.json().catch(()=>({}))).error);return(await e.json()).url},getMergeBase:async t=>{let e=await fetch(`/api/workspaces/${t}/git/merge-base`);if(!e.ok)throw Error((await e.json().catch(()=>({}))).error);return(await e.json()).hash}}));t.s(["useGitStore",0,a])},524360,t=>{"use strict";var e=t.i(816709),s=t.i(360112);let i=new Map,a=(0,e.create)((t,e)=>({sessions:[],activeId:null,ws:null,workspaceId:null,_initialized:!1,_restored:!1,init:(a,r)=>{let o=e();if(o._initialized&&o.ws===a)return;let n=o.workspaceId!==a.workspaceId;n&&i.clear(),t({ws:a,workspaceId:a.workspaceId,sessions:n?[]:o.sessions,activeId:n?null:o.activeId,_initialized:!0,_restored:!1}),a.on("terminal.created",e=>{let{sessionId:s,cwd:i,shell:a}=e;t(t=>t.sessions.some(t=>t.id===s)?t:{sessions:[...t.sessions,{id:s,cwd:i,shell:a}],activeId:s})}),a.on("terminal.error",t=>{let{error:e}=t;s.toast.error(e)}),a.on("terminal.closed",e=>{let{sessionId:s}=e;t(t=>{let e=t.sessions.filter(t=>t.id!==s),i=t.activeId===s?e[0]?.id??null:t.activeId;return{sessions:e,activeId:i}})}),a.on("terminal.sessions",e=>{let{sessions:s}=e;t(t=>{let e=new Map(t.sessions.map(t=>[t.id,t])),a=s.map(t=>{let s=e.get(t.sessionId);return t.buffer&&i.set(t.sessionId,t.buffer),{...s,id:t.sessionId,cwd:t.cwd,shell:t.shell??s?.shell}}),r=!!t.activeId&&a.some(e=>e.id===t.activeId);for(let t of s)t.buffer||i.delete(t.sessionId);return{sessions:a,activeId:r?t.activeId:a[0]?.id??null,_restored:!0}}),r?.()})},createSession:(t,s)=>{let{ws:i}=e();i?.send("terminal.create",{sessionId:crypto.randomUUID?.()??crypto.getRandomValues(new Uint8Array(16)).reduce((t,e)=>t+e.toString(16).padStart(2,"0"),""),shell:t,cwd:s})},setActive:e=>t({activeId:e}),setSessionName:(e,s)=>t(t=>({sessions:t.sessions.map(t=>t.id===e?{...t,name:s}:t)})),removeSession:s=>{let{ws:i,sessions:a,activeId:r}=e();i?.send("terminal.close",{sessionId:s});let o=a.filter(t=>t.id!==s),n=r===s?o[0]?.id??null:r;t({sessions:o,activeId:n})},sendInput:(t,s)=>{e().ws?.send("terminal.input",{sessionId:t,data:s})},resize:(t,s,i)=>{e().ws?.send("terminal.resize",{sessionId:t,cols:s,rows:i})}}));t.s(["consumeSessionBuffer",0,function(t){let e=i.get(t);return i.delete(t),e},"useTerminalStore",0,a])},191441,t=>{"use strict";let e=(0,t.i(433721).default)("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]);t.s(["ListChecks",0,e],191441)},404175,t=>{"use strict";var e=t.i(344180),s=t.i(227634),i=t.i(191441),a=t.i(451534),r=t.i(386041),o=t.i(426022),n=t.i(989484);let c=(0,t.i(433721).default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var l=t.i(253307),h=t.i(194228),d=t.i(210),p=t.i(255742);let u=[{id:"channel-list",icon:s.Hash,group:"channel"},{id:"chat",icon:o.MessageSquare,group:"channel"},{id:"issue-list",icon:i.ListChecks,group:"issue"},{id:"issue-detail",icon:l.FileDiff,group:"issue"},{id:"workfolder",icon:a.FolderOpen,group:"workfolder"},{id:"code-editor",icon:r.Code2,group:"workfolder"},{id:"terminal",icon:c,group:"tools"},{id:"git-commits",icon:h.GitCommitHorizontal,group:"git"},{id:"project-settings",icon:d.Settings2,group:"settings"},{id:"code-favorites",icon:p.Star,group:"workfolder"}],m={"channel-list":(0,e.jsx)(s.Hash,{size:16}),"issue-list":(0,e.jsx)(i.ListChecks,{size:16}),workfolder:(0,e.jsx)(a.FolderOpen,{size:16}),"code-editor":(0,e.jsx)(r.Code2,{size:16}),chat:(0,e.jsx)(o.MessageSquare,{size:16}),"issue-detail":(0,e.jsx)(n.FileText,{size:16}),terminal:(0,e.jsx)(c,{size:16}),"git-commits":(0,e.jsx)(h.GitCommitHorizontal,{size:16}),"project-settings":(0,e.jsx)(d.Settings2,{size:16}),"code-favorites":(0,e.jsx)(p.Star,{size:16}),...{}};function f(t,s,i,a,r){if("git-commits"===t&&s&&!s.clean){let t=s.insertions>0||s.deletions>0,i=(0,e.jsx)("span",{className:"ml-1 text-[10px] font-medium leading-none flex items-center gap-0.5",children:t?(0,e.jsxs)(e.Fragment,{children:[s.insertions>0&&(0,e.jsxs)("span",{className:"text-green-600",children:["+",s.insertions]}),s.deletions>0&&(0,e.jsxs)("span",{className:"text-red-500",children:["-",s.deletions]})]}):(0,e.jsx)("span",{className:"text-orange-500",children:s.files.length})}),a=s.files.length;return{trailing:i,badge:a>0?(0,e.jsx)("span",{className:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] rounded-full bg-blue-500 text-white text-[9px] font-medium leading-none flex items-center justify-center px-0.5",children:a}):null}}if("terminal"===t&&i.length>0)return{trailing:null,badge:(0,e.jsx)("span",{className:"absolute -top-1 -right-1.5 min-w-[14px] h-[14px] rounded-full bg-green-500 text-white text-[9px] font-medium leading-none flex items-center justify-center px-0.5",children:i.length})};let o=(0,e.jsxs)("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[(0,e.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75"}),(0,e.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-blue-500"})]});return"channel-list"===t&&Object.values(a).some(t=>t.some(t=>"streaming"===t.status||"pending"===t.status))||"issue-detail"===t&&r.some(t=>"pending"===t.status||"running"===t.status||"retrying"===t.status||"waiting_review"===t.status)?{trailing:null,badge:o}:{trailing:null,badge:null}}t.s(["RIGHT_TO_LEFT_TAB_MAP",0,{"code-editor":"workfolder",chat:"channel-list","issue-detail":"issue-list"},"TAB_ITEMS",0,u,"getTabBadge",0,f,"renderTabIcon",0,function(t,s,i,a,r,o){let n=m[t];if(!n)return null;let{trailing:c,badge:l}=f(t,i,a,r,o);return(0,e.jsxs)("span",{title:s,className:"flex items-center justify-center",children:[(0,e.jsxs)("span",{className:"relative",children:[n,l]}),c]})}],404175)},202411,t=>{t.v(e=>Promise.all(["static/chunks/0cyq~8xb~r5fc.js","static/chunks/09t62a89~jesc.js"].map(e=>t.l(e))).then(()=>e(388576)))},136450,t=>{t.v(e=>Promise.all(["static/chunks/0xoo17yef_b8g.js","static/chunks/15hca2.5le07..js","static/chunks/0lcc9r.o.p.sc.js","static/chunks/12mxlicp247c8.js","static/chunks/016xz2o-hv3am.js","static/chunks/0bbmx45w_h5np.js","static/chunks/014x2qbuiszni.js","static/chunks/0kof5qdg8c2-k.js","static/chunks/0.006.ycpe92w.js","static/chunks/0ow~co9wcleka.js","static/chunks/05psi2gtx~bev.js","static/chunks/0_8dm7bxp18xo.js","static/chunks/0-~4vw4_9z_0_.js","static/chunks/0-utii~i2fncd.js","static/chunks/0tl6o7zu1j1r-.css","static/chunks/0ay4fv-nniykh.css","static/chunks/0pldvk5_h__t7.css","static/chunks/08.u~dmq20cak.css","static/chunks/15rf3~h7sugz4.css","static/chunks/0-wkj-hzh444r.css","static/chunks/14_y_s_5rhsd1.css","static/chunks/0z8ipjj2z-3al.css","static/chunks/06vadtvw631k5.css","static/chunks/16~udgv7eel6a.css","static/chunks/0qad.lgvtlt0b.css","static/chunks/0mt-7av8yrg0o.css","static/chunks/0brrgp3ki5w4_.css","static/chunks/16i87txo0qh0h.css","static/chunks/0ojcao3hdm36s.css"].map(e=>t.l(e))).then(()=>e(538691)))},58872,t=>{t.v(e=>Promise.all(["static/chunks/0_udc.6.tueey.js","static/chunks/02c22g~xd-y30.js","static/chunks/17oc2l.ekcs8b.css"].map(e=>t.l(e))).then(()=>e(608745)))},329052,t=>{t.v(e=>Promise.all(["static/chunks/0p1n8bvfnpl41.js"].map(e=>t.l(e))).then(()=>e(878166)))},126861,t=>{t.v(e=>Promise.all(["static/chunks/0_e~hmntdfop9.js","static/chunks/0s_dva~eh2yhi.js","static/chunks/0cke33d38fnby.js","static/chunks/12mxlicp247c8.js"].map(e=>t.l(e))).then(()=>e(773354)))},124383,t=>{t.v(e=>Promise.all(["static/chunks/11qp8r5dotf7d.js"].map(e=>t.l(e))).then(()=>e(783481)))},318599,t=>{t.v(e=>Promise.all(["static/chunks/10.alq.6stmld.js","static/chunks/0zmhdridea1s5.js","static/chunks/0msb2mi3hiu5_.js"].map(e=>t.l(e))).then(()=>e(706304)))},222445,t=>{t.v(e=>Promise.all(["static/chunks/0zc0xgp5ourcn.js","static/chunks/11b3zgk1etlkw.js"].map(e=>t.l(e))).then(()=>e(514669)))},78906,t=>{t.v(e=>Promise.all(["static/chunks/176dc-dtokxxi.js"].map(e=>t.l(e))).then(()=>e(985646)))},857328,t=>{t.v(e=>Promise.all(["static/chunks/0xt-8wk21gs7g.js"].map(e=>t.l(e))).then(()=>e(306649)))},3725,t=>{t.v(e=>Promise.all(["static/chunks/0-f~0xmwl__u5.js"].map(e=>t.l(e))).then(()=>e(722705)))}]);
|