@agent-spaces/server 0.3.64 → 0.3.67
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.js +4 -0
- package/dist/adapters/claude-code-runtime/index.js +68 -2
- package/dist/adapters/claude-code-runtime/message-format.js +26 -0
- package/dist/adapters/claude-code-runtime/sdk-config.js +12 -0
- package/dist/adapters/codex-function-tool-bridge.js +144 -0
- package/dist/adapters/codex-runtime.js +23 -4
- package/dist/adapters/git.js +25 -7
- package/dist/adapters/hermes-runtime.js +210 -0
- package/dist/agents/agent-message-parts.js +1 -1
- package/dist/agents/commit-agent.js +4 -2
- package/dist/agents/issue-task-controller.js +75 -4
- package/dist/agents/pull-request-agent.js +115 -0
- package/dist/agents/scheduler-agent.js +1 -1
- package/dist/app.js +12 -70
- package/dist/middleware/auth.js +1 -1
- package/dist/package.json +2 -1
- package/dist/routes/agent-sse.js +2 -0
- package/dist/routes/agent.js +3 -0
- package/dist/routes/database.js +1 -0
- package/dist/routes/git.js +197 -317
- package/dist/routes/issue.js +1 -1
- package/dist/routes/notification.js +10 -0
- package/dist/routes/robot-account.js +68 -0
- package/dist/routes/version.js +94 -0
- package/dist/routes/worktree.js +93 -0
- package/dist/services/agent.js +37 -3
- package/dist/services/builtin-tools/kanban-tools.js +4 -0
- package/dist/services/git-operation-log.js +40 -0
- package/dist/services/global-wechat-qr.js +72 -0
- package/dist/services/hook-engine.js +175 -17
- package/dist/services/notification-center.js +9 -0
- package/dist/services/notification-hub/bot-agent.js +3 -1
- package/dist/services/notification-hub/service.js +12 -2
- package/dist/services/robot-account.js +34 -0
- package/dist/services/version.js +59 -0
- package/dist/services/workflow-command-runner.js +23 -0
- package/dist/services/workflow.js +25 -8
- package/dist/services/workspace.js +25 -1
- package/dist/services/worktree.js +207 -0
- package/dist/storage/robot-account-store.js +39 -0
- package/dist/storage/worktree-store.js +33 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +23 -25
- 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/{0n6_4so_afuwk.js → 0-92u-tiuy40a.js} +4 -4
- package/dist/web/_next/static/chunks/{0vbqaynjq8ga..js → 0-yizd8osmas2.js} +1 -1
- package/dist/web/_next/static/chunks/0.ln~3mnv8.69.js +1 -0
- package/dist/web/_next/static/chunks/{0iuf30t0rjsjv.js → 01y3e9pemva7b.js} +10 -10
- package/dist/web/_next/static/chunks/02802taez976w.js +67 -0
- package/dist/web/_next/static/chunks/02l~tmzrgny.~.js +1 -0
- package/dist/web/_next/static/chunks/033.awk90g6eh.js +1 -0
- package/dist/web/_next/static/chunks/03f1bwuynjdmk.js +1 -0
- package/dist/web/_next/static/chunks/04cb4kc9r2pd1.js +1 -0
- package/dist/web/_next/static/chunks/04de6ha5_e3pp.js +1 -0
- package/dist/web/_next/static/chunks/06.kdsa9rr2h1.js +1 -0
- package/dist/web/_next/static/chunks/09he0p79ov1rn.js +1 -0
- package/dist/web/_next/static/chunks/09vpocs4zuc8h.js +1 -0
- package/dist/web/_next/static/chunks/0_o2exgr0e_nh.js +1 -0
- package/dist/web/_next/static/chunks/{0xbaakj0dfc0..js → 0_y9nskc-xt2k.js} +1 -1
- package/dist/web/_next/static/chunks/0clnj-1fi6u8j.js +3 -0
- package/dist/web/_next/static/chunks/0gv40by0zzxs_.js +1 -0
- package/dist/web/_next/static/chunks/0iusr8y88.kjg.js +1 -0
- package/dist/web/_next/static/chunks/{04a4vsq2wknm4.js → 0j-8418fxvkd1.js} +1 -1
- package/dist/web/_next/static/chunks/0j-l7l_k9jt45.js +1 -0
- package/dist/web/_next/static/chunks/0j.wxxyoclma5.js +1 -0
- package/dist/web/_next/static/chunks/0jq.16sozqik..js +3 -0
- package/dist/web/_next/static/chunks/0jw8xdk_fpnp0.css +1 -0
- package/dist/web/_next/static/chunks/0l1lkd-wcotma.js +1 -0
- package/dist/web/_next/static/chunks/0ncxf_zr4n839.js +1 -0
- package/dist/web/_next/static/chunks/0ndo7um~v7vco.js +1 -0
- package/dist/web/_next/static/chunks/0ngk.~kan8wq_.js +1 -0
- package/dist/web/_next/static/chunks/0p3h-h3zj5ujg.js +30 -0
- package/dist/web/_next/static/chunks/0pm-un~-sy3rl.js +1 -0
- package/dist/web/_next/static/chunks/0rt9bofnn6qvn.js +1 -0
- package/dist/web/_next/static/chunks/0t64.9jd00hio.js +3 -0
- package/dist/web/_next/static/chunks/0taui9--5n6-5.js +1 -0
- package/dist/web/_next/static/chunks/0ty39169lh~z3.js +1 -0
- package/dist/web/_next/static/chunks/0uxzi~9b~k4mn.js +31 -0
- package/dist/web/_next/static/chunks/0v8nof~waedlu.js +1 -0
- package/dist/web/_next/static/chunks/{0ctg5qmw7uu.1.js → 0vcfoagnpf.aw.js} +3 -3
- package/dist/web/_next/static/chunks/{08ckpwmmwlors.js → 0wwwq.gyyz0vg.js} +3 -3
- package/dist/web/_next/static/chunks/0x5lak8yz7pm7.js +1 -0
- package/dist/web/_next/static/chunks/0xon_.4-o0_zq.js +7 -0
- package/dist/web/_next/static/chunks/0zjnrbt7inime.js +1 -0
- package/dist/web/_next/static/chunks/0zncg76rgtbm-.js +1 -0
- package/dist/web/_next/static/chunks/0zwebpitvpuv1.js +1 -0
- package/dist/web/_next/static/chunks/0~02o4g-o6n~m.js +1 -0
- package/dist/web/_next/static/chunks/{10l-9myrdo3x9.js → 0~fjezp.k4qk3.js} +1 -1
- package/dist/web/_next/static/chunks/0~sh93re1-_rp.js +1 -0
- package/dist/web/_next/static/chunks/10_niiq0k6o-p.js +5 -0
- package/dist/web/_next/static/chunks/12tjr0_2ccrtq.js +2 -0
- package/dist/web/_next/static/chunks/12x5.go_x9mfk.js +1 -0
- package/dist/web/_next/static/chunks/{1442stwa0gbxe.js → 12~5dk9i9d16t.js} +2 -2
- package/dist/web/_next/static/chunks/13iye4rv5p31b.js +1 -0
- package/dist/web/_next/static/chunks/{01~quun6sefgl.js → 13~y-b.b9rrw4.js} +1 -1
- package/dist/web/_next/static/chunks/151wzhb5q0lo5.js +1 -0
- package/dist/web/_next/static/chunks/18c7g84y01mj0.js +1 -0
- package/dist/web/_next/static/chunks/{turbopack-0ndm2zc_pdptk.js → turbopack-11qjwlynmfc-n.js} +1 -1
- package/dist/web/_not-found/__next._full.txt +30 -29
- 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 +30 -29
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +23 -25
- package/dist/web/login/__next._full.txt +28 -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 +28 -28
- package/dist/web/settings/__next._full.txt +33 -32
- 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 +24 -24
- 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 +24 -24
- package/dist/web/settings/mcps/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/models/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/output-styles/__next._full.txt +24 -24
- package/dist/web/settings/output-styles/__next._head.txt +4 -4
- package/dist/web/settings/output-styles/__next._index.txt +13 -13
- package/dist/web/settings/output-styles/__next._tree.txt +2 -2
- package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +4 -4
- package/dist/web/settings/output-styles/__next.settings.output-styles.txt +3 -3
- package/dist/web/settings/output-styles/__next.settings.txt +5 -5
- package/dist/web/settings/output-styles.html +1 -1
- package/dist/web/settings/output-styles.txt +24 -24
- package/dist/web/settings/prompts/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/providers/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/skills/__next._full.txt +24 -24
- 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 +24 -24
- package/dist/web/settings/tools/__next._full.txt +24 -24
- package/dist/web/settings/tools/__next._head.txt +4 -4
- package/dist/web/settings/tools/__next._index.txt +13 -13
- package/dist/web/settings/tools/__next._tree.txt +2 -2
- package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +4 -4
- package/dist/web/settings/tools/__next.settings.tools.txt +3 -3
- package/dist/web/settings/tools/__next.settings.txt +5 -5
- package/dist/web/settings/tools.html +1 -1
- package/dist/web/settings/tools.txt +24 -24
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +33 -32
- package/dist/web/workflows/__next._full.txt +31 -33
- 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 +31 -33
- package/dist/web/workspace/_/__next._full.txt +28 -29
- 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 -2
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
- 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 +28 -29
- package/dist/web/workspaces/__next._full.txt +29 -31
- 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 +29 -31
- package/dist/ws/agent-prompt.js +32 -3
- package/dist/ws/agent-runner.js +83 -6
- package/package.json +11 -11
- package/dist/web/_next/static/chunks/0-9194nbxy_6d.js +0 -1
- package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +0 -1
- package/dist/web/_next/static/chunks/02mf61htij8g0.js +0 -31
- package/dist/web/_next/static/chunks/04dg4l4hv11q2.js +0 -3
- package/dist/web/_next/static/chunks/04fxddw-y20~-.js +0 -7
- package/dist/web/_next/static/chunks/04w7~5ooz_pwm.js +0 -1
- package/dist/web/_next/static/chunks/05oc21sj24wtq.js +0 -1
- package/dist/web/_next/static/chunks/08kfx8on9oty~.js +0 -1
- package/dist/web/_next/static/chunks/08k~meqbd8d6v.js +0 -1
- package/dist/web/_next/static/chunks/099h96wjsdb25.js +0 -2
- package/dist/web/_next/static/chunks/09h23logvq65m.js +0 -1
- package/dist/web/_next/static/chunks/0a5y-vhf4i5id.js +0 -3
- package/dist/web/_next/static/chunks/0ake2f3x2uan4.js +0 -24
- package/dist/web/_next/static/chunks/0ck8dw_9-1cdx.js +0 -1
- package/dist/web/_next/static/chunks/0ewceguykiut5.js +0 -1
- package/dist/web/_next/static/chunks/0f7cb9li~3jra.js +0 -67
- package/dist/web/_next/static/chunks/0ghs9on7wodrm.js +0 -1
- package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +0 -1
- package/dist/web/_next/static/chunks/0h9cu-k6z5o08.js +0 -1
- package/dist/web/_next/static/chunks/0jb4~3qqkw2ps.js +0 -1
- package/dist/web/_next/static/chunks/0nb8.iteznuvx.js +0 -1
- package/dist/web/_next/static/chunks/0os58q93stt7j.js +0 -3
- package/dist/web/_next/static/chunks/0s9lmk8iauou3.js +0 -1
- package/dist/web/_next/static/chunks/0sp_zbx~w0am7.js +0 -1
- package/dist/web/_next/static/chunks/0tel~zsv4z8l_.js +0 -1
- package/dist/web/_next/static/chunks/0twamv4wr_dbv.js +0 -1
- package/dist/web/_next/static/chunks/0uhol5wafdbl~.js +0 -1
- package/dist/web/_next/static/chunks/0v3a_x4vt42kx.js +0 -5
- package/dist/web/_next/static/chunks/0v7q4mys.mnm..css +0 -1
- package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +0 -1
- package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +0 -1
- package/dist/web/_next/static/chunks/0~3xm80~j9ddg.js +0 -1
- package/dist/web/_next/static/chunks/14s37n6h0_q3x.js +0 -16
- package/dist/web/_next/static/chunks/161ik5kfyuwtd.js +0 -1
- package/dist/web/_next/static/chunks/17k~zbv0_4rep.js +0 -1
- package/public/output-styles/carmack-mode.md +0 -381
- package/public/output-styles/codex-rigor-mode.md +0 -114
- package/public/output-styles/dhh-mode.md +0 -265
- package/public/output-styles/evan-you-mode.md +0 -539
- package/public/output-styles/index.json +0 -37
- package/public/output-styles/jobs-mode.md +0 -369
- package/public/output-styles/linus-mode.md +0 -135
- package/public/output-styles/uncle-bob-mode.md +0 -221
- package/public/prompt/andrej-karpathy-skills.md +0 -65
- package/public/prompt/claude-token-efficient-coding.md +0 -35
- package/public/prompt/index.json +0 -12
- package/public/skills/index.json +0 -92
- package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +0 -243
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +0 -44
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +0 -46
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +0 -124
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +0 -124
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +0 -438
- package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +0 -29
- package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +0 -40
- package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +0 -58
- package/public/skills/superpowers/brainstorming/SKILL.md +0 -164
- package/public/skills/superpowers/brainstorming/scripts/frame-template.html +0 -214
- package/public/skills/superpowers/brainstorming/scripts/helper.js +0 -88
- package/public/skills/superpowers/brainstorming/scripts/server.cjs +0 -354
- package/public/skills/superpowers/brainstorming/scripts/start-server.sh +0 -148
- package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +0 -56
- package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +0 -49
- package/public/skills/superpowers/brainstorming/visual-companion.md +0 -287
- package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +0 -182
- package/public/skills/superpowers/executing-plans/SKILL.md +0 -70
- package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +0 -251
- package/public/skills/superpowers/receiving-code-review/SKILL.md +0 -213
- package/public/skills/superpowers/requesting-code-review/SKILL.md +0 -103
- package/public/skills/superpowers/requesting-code-review/code-reviewer.md +0 -168
- package/public/skills/superpowers/subagent-driven-development/SKILL.md +0 -279
- package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +0 -25
- package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +0 -113
- package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +0 -61
- package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +0 -119
- package/public/skills/superpowers/systematic-debugging/SKILL.md +0 -296
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +0 -115
- package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +0 -122
- package/public/skills/superpowers/systematic-debugging/find-polluter.sh +0 -63
- package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +0 -169
- package/public/skills/superpowers/systematic-debugging/test-academic.md +0 -14
- package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +0 -58
- package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +0 -68
- package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +0 -69
- package/public/skills/superpowers/test-driven-development/SKILL.md +0 -371
- package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +0 -299
- package/public/skills/superpowers/using-git-worktrees/SKILL.md +0 -215
- package/public/skills/superpowers/using-superpowers/SKILL.md +0 -117
- package/public/skills/superpowers/using-superpowers/references/codex-tools.md +0 -59
- package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +0 -42
- package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +0 -51
- package/public/skills/superpowers/verification-before-completion/SKILL.md +0 -139
- package/public/skills/superpowers/writing-plans/SKILL.md +0 -152
- package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +0 -49
- package/public/skills/superpowers/writing-skills/SKILL.md +0 -655
- package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +0 -1150
- package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
- package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +0 -172
- package/public/skills/superpowers/writing-skills/persuasion-principles.md +0 -187
- package/public/skills/superpowers/writing-skills/render-graphs.js +0 -168
- package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +0 -384
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_ssgManifest.js +0 -0
|
@@ -1,3 +0,0 @@
|
|
|
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),c=e.i(157408),d=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),j=e.i(588785),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:c,channels:d=[]}){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(c,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})]})]}),d.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:d.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 cursor-pointer",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:c=!0,onValueChange:d,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)(d),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:c,orientation:m,state:w,value:b}),[f,l,k,i,o,c,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:c,...d}=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:d,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]),ec=r.forwardRef(function(e,t){let{disabled:n,className:s,id:a,render:l,nativeButton:i=!0,style:o,...c}=e,{panelId:d,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?d: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,d]);return(0,U.useRenderElement)("button",e,{state:N,ref:[t,h],props:[C,c,x],stateAttributesMapping:X.triggerOpenStateMapping})});var ed=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,...c}=e,{hiddenUntilFound:d,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??d,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,ed.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`}},c],stateAttributesMapping:ee});return P||R||h?B:null});e.s(["Header",0,en,"Item",0,et,"Panel",0,ep,"Root",0,_,"Trigger",0,ec],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:c,defaultTriggerId:d=null,children:u}=e,m=eX.useStore(o?.store,{open:n,openProp:t,activeTriggerId:d,triggerIdProp:c});(0,e$.useOnFirstRender)(()=>{void 0===t&&!1===m.state.open&&!0===n&&m.update({open:!0,activeTriggerId:d})}),m.useControlledProp("openProp",t),m.useControlledProp("triggerIdProp",c),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 e5=e.i(817955),e3=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:c,style:d,...u}=e,m=eW(!0),p=c?.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,e3.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:e5.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:c="center",sideOffset:d=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:d,align:c,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={...e5.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(),c=l.useState("open"),d=l.useState("instantType"),u=l.useState("transitionStatus"),m=l.useState("popupProps"),p=l.useState("floatingRootContext");(0,em.useOpenChangeComplete)({open:c,ref:l.context.popupRef,onComplete(){c&&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:c,side:i,align:o,instant:d,transitionStatus:u},ref:[t,l.context.popupRef,l.useStateSetter("popupElement")],props:[m,(0,tr.getDisabledMountTransitionStyles)(u),r],stateAttributesMapping:ti})}),tc=r.forwardRef(function(e,t){let{render:n,className:s,style:a,...r}=e,l=eW(),{arrowRef:i,side:o,align:c,arrowUncentered:d,arrowStyles:u}=e7(),m=l.useState("open");return(0,U.useRenderElement)("div",e,{state:{open:m,side:o,align:c,uncentered:d},ref:[i,t],props:[{style:u,"aria-hidden":!0},r],stateAttributesMapping:e5.popupStateMapping})}),td={...e5.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"),c=l.useState("transitionStatus");return(0,U.useRenderElement)("div",e,{state:{open:i,transitionStatus:c},ref:[t],props:[{role:"presentation",hidden:!o,style:{pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none"}},r],stateAttributesMapping:td})}),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(),c=i.useState("instantType"),{children:d,state:u}=(0,tp.usePopupViewport)({store:i,side:o.side,cssVars:tm,children:r}),m={activationDirection:u.activationDirection,transitioning:u.transitioning,instant:c};return(0,U.useRenderElement)("div",e,{state:m,ref:t,props:[l,{children:d}],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,tc,"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),c=(0,r.useMemo)(()=>({data:e,mediaCategory:o,onRemove:t,variant:i}),[e,o,t,i]);return(0,a.jsx)(tj.Provider,{value:c,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"),c=e??o("attachments.remove");return r?(0,a.jsxs)(eE.Button,{"aria-label":c,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:c})]}):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,c]=(0,r.useState)(n),d=t??o,u=(0,r.useCallback)(e=>{void 0===t&&c(e),s?.(e)},[s,t]),m=(0,r.useMemo)(()=>({isOpen:d,setIsOpen:u}),[d,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}),t5=({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)(t3,{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,{})]})})}),t3=({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[c,d]=(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),d(!0),e?.(),setTimeout(()=>d(!1),n)}catch(e){t?.(e)}},x=c?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"})]})})};var nt=e.i(735207),nt=nt,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 nc=e.i(995684),nc=nc,nd=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.default,Write:eI.default,Edit:nc.default,MultiEdit:nr,Bash:tY.default,TodoWrite:nm,Grep:nd.SearchIcon,Glob:nl.default,Search:nd.SearchIcon,SemanticSearch:nd.SearchIcon,WebSearch:ez.default,WebFetch:np,Fetch:np,Task:no,Agent:D.default,Skill:nu.default,AskUserQuestion:ni.default,LoadClaudeMd:nt.default};function nw({text:e,status:t,workspaceId:n}){let s=(0,l.useTranslations)("chat"),i=Array.from(e.trim()).length>=300,[o,c]=(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:s("messageParts.aiMessage")}),i?(0,a.jsx)(eE.Button,{type:"button",variant:"ghost",size:"icon",className:"ml-auto size-5",onClick:()=>c(!o),children:(0,a.jsx)(eh.ChevronDownIcon,{className:(0,M.cn)("size-3.5 transition-transform",o&&"rotate-180")})}):null]}),status:t,children:!i||o?(0,a.jsx)(b.Markdown,{content:e,workspaceId:n}):null})}function nC({chain:e,message:t,workspaceId:n,status:s}){var i,o;let c=(0,ng.useEditorStore)(e=>e.openFile),[d,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 c(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=!d;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",d&&"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,d?(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)(t5,{output:t?`$ ${t}
|
|
2
|
-
${n}`:n})}let c=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(c&&/^(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:c.oldContent,newContent:c.newContent,path:c.path})});let d=(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===d.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:d.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),c=((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:c})},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),c=new Intl.NumberFormat("en-US",{notation:"compact"}).format(s),d=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:[c," / ",d]})]}),(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 c=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:c,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 c=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:c,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 c=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:c,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 c=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:c,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)})),c=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:c},o[0].key),(0,a.jsx)(nY,{title:o[1].title,value:o[1].value,empty:o[1].empty,stats:o[1].stats,totalTokens:c},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:c},o[2].key),(0,a.jsx)(nY,{title:o[3].title,value:o[3].value,empty:o[3].empty,stats:o[3].stats,totalTokens:c},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),[c,d]=(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===c)??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 cursor-pointer",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:d,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 n5({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),c=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)(n3,{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&&c?t?(0,a.jsx)(n9,{content:e.content}):(0,a.jsx)(b.Markdown,{content:n8(e.content),workspaceId:n}):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 n3({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,workspaceId:n});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,workspaceId:n})})})]});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",workspaceId:n},e.id):(0,a.jsx)(nC,{chain:e,message:t,workspaceId:n,status:s?"complete":"active"},e.id)})})]});case"terminal":return(0,a.jsx)(t5,{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,c;let t=(o=e.id,(c=e.approval)&&void 0!==c.approved?{id:c.id,approved:c.approved,reason:c.reason}:{id:c?.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 d=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||d||e.tools?.length?(0,a.jsxs)(ew,{children:[e.instructions?(0,a.jsx)(eC,{children:e.instructions}):null,d?(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:d,workspaceId:n})})]}):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 c=(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?c("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)(n5,{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:c("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 cursor-pointer",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 cursor-pointer",title:"复制",children:z?(0,a.jsx)(p.Check,{className:"h-3.5 w-3.5 text-green-500"}):(0,a.jsx)(d.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 cursor-pointer",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 cursor-pointer",title:"全屏查看",children:(0,a.jsx)(j.Maximize2,{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 cursor-pointer",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,workspaceId:t})})]})]})})]})}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 cursor-pointer"}),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:c,...d},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},...d},[i&&(0,r.createElement)("title",{key:"svg-title"},i),...s.map(([e,t])=>(0,r.createElement)(e,t)),...Array.isArray(c)?c:[c]]));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"}]]),sc=sr("outline","plus","Plus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]),sd=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:c,onToggleNotify:d}){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:c,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 cursor-pointer",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:d,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:c,messages:d=[],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),c=(0,r.useRef)(null),d=(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)(()=>{c.current&&(clearInterval(c.current),c.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)(()=>{d.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 c=(0,su.getToken)(),m="https:"===location.protocol?"wss:":"ws:",p=`${m}//${location.host}/ws/speech?token=${c??""}&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),d.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)(c),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(c.map(e=>[e.id,e]));return k.map(t=>e.get(t)).filter(e=>!!e)},[c,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)?sc:"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 d)t.senderId&&"user"!==t.senderId&&e.set(t.senderId,t.createdAt);return e},[d]),en=(0,r.useMemo)(()=>{let e=Q?.id;return[...c].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)})},[c,Q?.id,et]);(0,r.useEffect)(()=>{R.current=m},[m]),(0,r.useEffect)(()=>{P.current=u},[u]),(0,r.useEffect)(()=>{L.current=c},[c]),(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)},[]),ec=(0,r.useRef)(x);(0,r.useEffect)(()=>{ec.current=x},[x]);let ed=(0,r.useMemo)(()=>sh.default.configure({HTMLAttributes:{class:"mention"},suggestion:{char:"@",items:({query:e})=>{if(ec.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})}),ed,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())}},[ed,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)(sc,{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)(sd,{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 cursor-pointer",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,s5=e.i(583705),s3=e.i(759309),s3=s3,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(79882),as=e.i(478117);function aa({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 cursor-pointer",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 ar=e.i(250226);function al({workspaceId:e,channel:t,agents:n,allChannels:s,onDeleted:o}){let c=(0,l.useTranslations)("chat"),d=(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),ar.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)(s5.Info,{className:"size-3.5"}),c("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"}),c("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:[c("channel.type")," ",c(`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:c("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:c("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:c("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:c("channel.noMembers")}),t.members.map(e=>(0,a.jsx)(aa,{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"}),c("channel.addMember")]})]})]})]}),(0,a.jsxs)("div",{className:"shrink-0 p-3 border-t space-y-1",children:[(0,a.jsxs)(eE.Button,{variant:"ghost",size:"sm",className:"w-full text-xs",onClick:()=>p(e,t.id,{archived:!t.archived}),children:[(0,a.jsx)(an.Archive,{className:"size-3.5 mr-1"}),c(t.archived?"channel.unarchive":"channel.archive")]}),(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"}),c("channel.delete")]})]}),(0,a.jsx)(as.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:c("channel.delete")}),(0,a.jsx)(y.DialogDescription,{children:c("channel.deleteConfirm")})]}),(0,a.jsxs)(y.DialogFooter,{children:[(0,a.jsx)(y.DialogClose,{render:(0,a.jsx)(eE.Button,{variant:"outline"}),children:d("cancel")}),(0,a.jsxs)(eE.Button,{variant:"destructive",onClick:I,children:[(0,a.jsx)(m.Trash2,{className:"size-3.5"}),d("delete")]})]})]})})]})}var ai=e.i(249673),ao=e.i(650654);function ac({messages:e,reverse:t}){var n;let s,l,i,[c,d]=(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=>{d(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;d(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),d(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===c||c<=0?"invisible":""}`,onClick:()=>{null!==c&&c>0&&f(c-1)},children:(0,a.jsx)(ai.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 ${c===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===c||c>=g.length-1?"invisible":""}`,onClick:()=>{null!==c&&c<g.length-1&&f(c+1)},children:(0,a.jsx)(ao.ChevronDown,{className:"size-3.5"})}),u&&null!==c&&(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[c].senderId?"You":(0,o.findAgentById)(g[c].senderId)?.name??g[c].senderId}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:new Date(g[c].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[c],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),au=e.i(327964);let am={general:{status:"online"},issue:{status:"degraded"},agent:{status:"maintenance"}};function ap({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 ax({question:e,onAnswer:t}){let n=(0,l.useTranslations)("chat"),[s,i]=(0,r.useState)(""),[o,c]=(0,r.useState)(!1),d=e=>{let n=e.trim();n&&!o&&(c(!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:()=>d(e),className:"h-8",children:e},e))}):null,(0,a.jsxs)("form",{className:"flex gap-2",onSubmit:e=>{e.preventDefault(),d(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)(s3.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:d,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=d.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,c.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,c.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=am[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:()=>ar.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)(ap,{members:U.members}),(0,a.jsx)("div",{className:"flex-1"}),U.issueId&&(0,a.jsx)(eE.Button,{variant:"ghost",size:"icon-sm",onClick:()=>au.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)(s5.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)(ac,{messages:B,reverse:!0})]}),W?(0,a.jsx)(ax,{question:W,onAnswer:t=>{(0,c.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)(al,{workspaceId:e,channel:U,agents:$,allChannels:d,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))}]);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,448303,e=>{"use strict";var t=e.i(344180),n=e.i(764556),s=e.i(129981),a=e.i(62669),i=e.i(194228),l=e.i(601039),r=e.i(378371),o=e.i(212965),c=e.i(381253),d=e.i(357301),u=e.i(137340),x=e.i(650654),h=e.i(327962),m=e.i(415360),p=e.i(210),f=e.i(253307),g=e.i(953700),j=e.i(450158),b=e.i(486657),C=e.i(363156),y=e.i(691223),v=e.i(244073);function w({workspaceId:e,onInitialized:s}){let a=(0,v.useTranslations)("git.notInitialized"),i=(0,C.useGitStore)(e=>e.initRepo),[l,r]=(0,n.useState)(!1),o=(0,n.useCallback)(async()=>{r(!0),await i(e),r(!1),s()},[e,i,s]);return(0,t.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 p-4",children:[(0,t.jsx)(h.GitBranch,{size:32,className:"text-muted-foreground/40"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:a("message")}),(0,t.jsx)("button",{onClick:o,disabled:l,className:"text-xs px-3 py-1.5 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed",children:a(l?"initializing":"initialize")})]})}var N=e.i(209988),k=e.i(260218),M=e.i(681622);function S({open:e,onOpenChange:s,onSubmit:a}){let i=(0,v.useTranslations)("git.remote"),l=(0,v.useTranslations)("common"),[r,o]=(0,n.useState)("origin"),[c,d]=(0,n.useState)(""),[u,x]=(0,n.useState)(!1),h=async()=>{if(r.trim()&&c.trim()){x(!0);try{await a(r.trim(),c.trim()),d(""),s(!1)}finally{x(!1)}}};return(0,t.jsx)(N.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:i("bindTitle")})}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:i("nameLabel")}),(0,t.jsx)(M.Input,{value:r,onChange:e=>o(e.target.value),placeholder:i("namePlaceholder"),className:"h-8 text-xs"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground mb-1 block",children:i("urlLabel")}),(0,t.jsx)(M.Input,{value:c,onChange:e=>d(e.target.value),placeholder:i("urlPlaceholder"),className:"h-8 text-xs",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})]})]}),(0,t.jsxs)(N.DialogFooter,{children:[(0,t.jsx)(N.DialogClose,{render:(0,t.jsx)(k.Button,{variant:"outline",size:"sm"}),children:l("cancel")}),(0,t.jsx)(k.Button,{size:"sm",onClick:h,disabled:!r.trim()||!c.trim()||u,children:i(u?"adding":"addRemote")})]})]})})}var D=e.i(613812),T=e.i(964970),z=e.i(564822),I=e.i(613087),B=e.i(940361),F=e.i(360112);let $={modified:"text-yellow-600",added:"text-green-600",deleted:"text-red-600",renamed:"text-blue-600",untracked:"text-gray-500",conflicted:"text-red-500"},O={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U",conflicted:"!"};function P(e){return e instanceof Error?e.message:String(e)}function A({open:e,onOpenChange:s,title:a,label:i,placeholder:l,onSubmit:r}){let o=(0,v.useTranslations)("common"),[c,d]=(0,n.useState)(""),u=()=>{c.trim()&&(r(c.trim()),s(!1))};return(0,t.jsx)(N.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:a})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:i}),(0,t.jsx)(M.Input,{value:c,onChange:e=>d(e.target.value),placeholder:l,autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&c.trim()&&u()}})]}),(0,t.jsxs)(N.DialogFooter,{children:[(0,t.jsx)(k.Button,{variant:"outline",onClick:()=>s(!1),children:o("cancel")}),(0,t.jsx)(k.Button,{disabled:!c.trim(),onClick:u,children:o("confirm")})]})]})})}function E({confirm:e,open:n,onOpenChange:s,onConfirm:a}){let i=(0,v.useTranslations)("common"),l=(0,v.useTranslations)("git.changes");return(0,t.jsx)(N.Dialog,{open:n,onOpenChange:s,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:l(e?.type==="all"?"discardAll":"discard")})}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e?.type==="all"?l("confirmDiscardAll"):l("confirmDiscardFile",{file:e?.type==="single"?e.path:""})}),(0,t.jsxs)(N.DialogFooter,{children:[(0,t.jsx)(k.Button,{variant:"outline",onClick:()=>s(!1),children:i("cancel")}),(0,t.jsx)(k.Button,{variant:"destructive",onClick:a,children:l("discard")})]})]})})}var G=e.i(887836);e.i(462506);var H=e.i(950396);let L=(0,G.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-32 text-muted-foreground text-xs",children:"Loading editor..."})});function R({open:e,onOpenChange:n,content:s,onContentChange:a,saving:i,onSave:l}){let r=(0,v.useTranslations)("common"),{resolvedTheme:o}=(0,H.useTheme)();return(0,t.jsx)(N.Dialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-2xl",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:".gitignore"})}),(0,t.jsx)("div",{className:"h-80 border rounded overflow-hidden",children:(0,t.jsx)(L,{height:"100%",language:"plaintext",value:s,onChange:e=>a(e??""),options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},lineNumbers:"on"},theme:"dark"===o?"vs-dark":"vs"})}),(0,t.jsxs)(N.DialogFooter,{children:[(0,t.jsx)(N.DialogClose,{render:(0,t.jsx)(k.Button,{variant:"outline",size:"sm"}),children:r("cancel")}),(0,t.jsx)(k.Button,{size:"sm",onClick:l,disabled:i,children:r(i?"saving":"save")})]})]})})}let U=(0,e.i(433721).default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);function W({x:e,y:s,path:a,onAddToGitignore:i,onOpenFile:l,onDiscard:r,onClose:o}){let u=(0,n.useRef)(null),x=(0,v.useTranslations)("git.changes"),h=(0,v.useTranslations)("common");(0,n.useEffect)(()=>(document.addEventListener("click",o),()=>document.removeEventListener("click",o)),[o]);let m=a.split("/").pop(),p=a.lastIndexOf("/"),f=p>=0?a.substring(0,p+1):a;return(0,t.jsxs)("div",{ref:u,className:"fixed z-[100] bg-popover border rounded-lg shadow-md py-1 text-xs min-w-40 ring-1 ring-foreground/10",style:{left:e,top:s},children:[(0,t.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left cursor-pointer",onClick:()=>{l(a),o()},children:[(0,t.jsx)(c.FileCode,{size:13}),(0,t.jsx)("span",{children:h("open")})]}),(0,t.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left cursor-pointer",onClick:()=>{r(a),o()},children:[(0,t.jsx)(d.RotateCcw,{size:13}),(0,t.jsx)("span",{children:x("discardAll")})]}),(0,t.jsx)("div",{className:"my-1 border-t"}),(0,t.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left cursor-pointer",onClick:()=>i(m),children:[(0,t.jsx)(U,{size:13}),(0,t.jsx)("span",{children:x("ignoreThisFile")}),(0,t.jsx)("span",{className:"ml-auto text-muted-foreground truncate max-w-24",children:m})]}),(0,t.jsxs)("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-accent text-left cursor-pointer",onClick:()=>{f&&i(f)},children:[(0,t.jsx)(U,{size:13}),(0,t.jsx)("span",{children:x("ignoreFilePath",{path:f})})]})]})}var K=e.i(31807),V=e.i(355819);function J({workspaceId:e,entry:n,onRefreshAll:s,onOpenPrompt:a}){let i=(0,v.useTranslations)("git.commits"),{getCommitDiff:l,getRemoteUrl:r,checkout:o,checkoutDetached:c,createBranch:d,deleteBranch:u,createTag:x,cherryPick:h,getMergeBase:m}=(0,C.useGitStore)(),p=(0,y.useEditorStore)(e=>e.openCommitDiff),{activeChannelId:f,sendMessage:g}=(0,K.useChannelStore)(),j=(0,V.useAgentStore)(e=>e.agents),b=async()=>{try{let t=await l(e,n.hash);t.length>0&&p(e,n.hash,n.message,t)}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}},w=async()=>{try{let t=await r(e);if(!t)return void F.toast.error(i("contextMenu.failed"),{description:"No remote URL"});window.open(t.replace(/\.git$/,"")+"/commit/"+n.hash,"_blank")}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}},N=async()=>{try{await o(e,n.hash),F.toast.success(i("contextMenu.checkedOut")),s()}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}},k=async()=>{try{await c(e,n.hash),F.toast.success(i("contextMenu.checkedOut")),s()}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}},M=async()=>{try{await h(e,n.hash),F.toast.success(i("contextMenu.cherryPicked")),s()}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}},S=async()=>{try{let t=await l(e,n.hash);C.useGitStore.setState({diffs:t}),F.toast.info(i("contextMenu.comparingWith",{hash:n.hash.slice(0,7)}))}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}},D=async()=>{try{let t=await m(e);if(!t)return void F.toast.error(i("contextMenu.failed"),{description:"No merge base"});let s=await l(e,n.hash);C.useGitStore.setState({diffs:s}),F.toast.info(i("contextMenu.comparingWith",{hash:t.slice(0,7)}))}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}},T=async()=>{if(!f)return void F.toast.error(i("contextMenu.failed"),{description:"No active channel"});let t=j.find(e=>e.enabled&&"bot"!==e.role&&"scheduler"!==e.role),s=await l(e,n.hash).then(e=>e.map(e=>e.path).join("\n")).catch(()=>"");g(e,f,t?`@${t.name} Explain the changes in commit \`${n.hash.slice(0,7)}\`: ${n.message.split("\n")[0]}
|
|
2
|
-
|
|
3
|
-
Changed files:
|
|
4
|
-
${s}`:`Explain the changes in commit \`${n.hash.slice(0,7)}\`: ${n.message.split("\n")[0]}
|
|
5
|
-
|
|
6
|
-
Changed files:
|
|
7
|
-
${s}`,t?[t.id]:[])};return(0,t.jsxs)(B.ContextMenuContent,{className:"min-w-48",children:[(0,t.jsx)(B.ContextMenuItem,{onClick:b,children:i("contextMenu.openChanges")}),(0,t.jsx)(B.ContextMenuItem,{onClick:w,children:i("contextMenu.openOnGitHub")}),(0,t.jsx)(B.ContextMenuSeparator,{}),(0,t.jsx)(B.ContextMenuItem,{onClick:N,children:i("contextMenu.checkout")}),(0,t.jsx)(B.ContextMenuItem,{onClick:k,children:i("contextMenu.checkoutDetached")}),(0,t.jsx)(B.ContextMenuItem,{onClick:()=>{a(i("contextMenu.createBranch"),i("contextMenu.branchName"),"feature/...",async t=>{try{await d(e,t,n.hash),F.toast.success(i("contextMenu.branchCreated")),s()}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}})},children:i("contextMenu.createBranch")}),(0,t.jsx)(B.ContextMenuItem,{onClick:()=>{let t=C.useGitStore.getState().branches.filter(e=>!e.current);t.length?a(i("contextMenu.deleteBranch"),i("contextMenu.branchToDelete"),t.map(e=>e.name).join(", "),async t=>{try{await u(e,t),F.toast.success(i("contextMenu.branchDeleted")),s()}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}}):F.toast.error(i("contextMenu.failed"),{description:"No other branches"})},children:i("contextMenu.deleteBranch")}),(0,t.jsx)(B.ContextMenuItem,{onClick:()=>{a(i("contextMenu.createTag"),i("contextMenu.tagName"),"v1.0.0",async t=>{try{await x(e,t,n.hash),F.toast.success(i("contextMenu.tagCreated"))}catch(e){F.toast.error(i("contextMenu.failed"),{description:P(e)})}})},children:i("contextMenu.createTag")}),(0,t.jsx)(B.ContextMenuSeparator,{}),(0,t.jsx)(B.ContextMenuItem,{onClick:M,children:i("contextMenu.cherryPick")}),(0,t.jsx)(B.ContextMenuSeparator,{}),(0,t.jsxs)(B.ContextMenuSub,{children:[(0,t.jsx)(B.ContextMenuSubTrigger,{children:i("contextMenu.compareWith")}),(0,t.jsxs)(B.ContextMenuSubContent,{children:[(0,t.jsx)(B.ContextMenuItem,{onClick:S,children:i("contextMenu.compareWithRemote")}),(0,t.jsx)(B.ContextMenuItem,{onClick:D,children:i("contextMenu.compareWithMergeBase")})]})]}),(0,t.jsx)(B.ContextMenuSeparator,{}),(0,t.jsx)(B.ContextMenuItem,{onClick:()=>{navigator.clipboard.writeText(n.hash),F.toast.success(i("contextMenu.commitIdCopied"))},children:i("contextMenu.copyCommitId")}),(0,t.jsx)(B.ContextMenuItem,{onClick:()=>{navigator.clipboard.writeText(n.message),F.toast.success(i("contextMenu.commitMessageCopied"))},children:i("contextMenu.copyCommitMessage")}),(0,t.jsx)(B.ContextMenuSeparator,{}),(0,t.jsx)(B.ContextMenuItem,{onClick:T,children:i("contextMenu.explainChanges")})]})}function X({workspaceId:e,entry:s,onClose:i}){let l=(0,v.useTranslations)("git.commits"),r=(0,z.useIsMobile)(),o=(0,C.useGitStore)(e=>e.getCommitDiff),[c,d]=(0,n.useState)([]),[u,x]=(0,n.useState)(!1),[h,m]=(0,n.useState)(null),p=!!s;(0,n.useEffect)(()=>{if(!s){d([]),m(null);return}x(!0),m(null),o(e,s.hash).then(e=>{d(e),e.length>0&&m(e[0].path)}).catch(()=>d([])).finally(()=>x(!1))},[s,e,o]);let f=c.find(e=>e.path===h),g=(0,n.useCallback)(()=>{i(),d([]),m(null)},[i]);return(0,t.jsx)(N.Dialog,{open:p,onOpenChange:e=>!e&&g(),children:(0,t.jsxs)(N.DialogContent,{className:`${r?"w-[95vw] max-w-[95vw] h-[90vh]":"!max-w-none w-[80vw] h-[80vh]"} flex flex-col p-0 gap-0`,children:[(0,t.jsxs)(N.DialogHeader,{className:"px-4 py-3 border-b shrink-0",children:[(0,t.jsxs)(N.DialogTitle,{className:"text-sm font-medium flex items-center gap-2 flex-wrap",children:[(0,t.jsx)("code",{className:"font-mono text-blue-600",children:s?.hash.slice(0,7)}),(0,t.jsx)("span",{className:"truncate",children:s?.message.split("\n")[0]})]}),s&&(0,t.jsxs)("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{children:s.author}),(0,t.jsx)("span",{children:new Date(s.date).toLocaleString()}),c.length>0&&(0,t.jsx)("span",{children:l("detailFileCount",{count:c.length})})]})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 flex flex-col",children:u?(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,t.jsx)(a.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):r?(0,t.jsx)(_,{diffs:c,selectedFile:h,onSelect:m,selectedDiff:f}):(0,t.jsx)(Y,{diffs:c,selectedFile:h,onSelect:m,selectedDiff:f})})]})})}function Y({diffs:e,selectedFile:n,onSelect:s,selectedDiff:a}){return(0,t.jsxs)("div",{className:"flex-1 min-h-0 flex",children:[(0,t.jsx)("div",{className:"w-48 border-r overflow-auto shrink-0",children:e.map(e=>(0,t.jsxs)("button",{onClick:()=>s(e.path),className:`w-full text-left px-2 py-1.5 text-xs font-mono flex items-center gap-1.5 border-b hover:bg-accent cursor-pointer ${n===e.path?"bg-accent":""}`,children:[(0,t.jsx)(c.FileCode,{size:13,className:"shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"truncate",children:e.path})]},e.path))}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:a?(0,t.jsx)(D.DiffViewer,{oldContent:a.oldContent,newContent:a.newContent,path:a.path,isBinary:a.isBinary}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:"Select a file"})})]})}function _({diffs:e,selectedFile:n,onSelect:s,selectedDiff:a}){return(0,t.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col",children:[(0,t.jsx)("div",{className:"flex overflow-x-auto border-b shrink-0 gap-0.5 px-1 py-1",children:e.map(e=>(0,t.jsx)("button",{onClick:()=>s(e.path),className:`shrink-0 text-xs font-mono px-2 py-1 rounded border ${n===e.path?"bg-accent border-accent":"border-transparent hover:bg-accent/50"} truncate max-w-[140px]`,children:e.path},e.path))}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:a?(0,t.jsx)(D.DiffViewer,{oldContent:a.oldContent,newContent:a.newContent,path:a.path,isBinary:a.isBinary}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:"Select a file"})})]})}e.s(["GitCommitsPanel",0,function({workspaceId:e}){let k=(0,v.useTranslations)("common"),M=(0,v.useTranslations)("git.commits"),G=(0,v.useTranslations)("git.changes"),H=(0,z.useIsMobile)(),{log:L,loading:U,notGitRepo:K,status:V,branches:Y,diffs:_,selectedFile:q,loadStatus:Q,loadDiffs:Z,loadLog:ee,loadBranches:et,commit:en,discard:es,discardAll:ea,stage:ei,unstage:el,resolveFile:er,checkout:eo,selectFile:ec,commitMsg:ed,setCommitMsg:eu,fetchRemote:ex}=(0,C.useGitStore)(),eh=(0,y.useEditorStore)(e=>e.openFile),em=(0,y.useEditorStore)(e=>e.openCommitDiff),[ep,ef]=(0,n.useState)(!1),[eg,ej]=(0,n.useState)(!1),[eb,eC]=(0,n.useState)(!1),[ey,ev]=(0,n.useState)({open:!1,title:"",label:"",placeholder:"",onSubmit:()=>{}}),[ew,eN]=(0,n.useState)(null),[ek,eM]=(0,n.useState)(!1),[eS,eD]=(0,n.useState)(""),[eT,ez]=(0,n.useState)(!1),[eI,eB]=(0,n.useState)(!1),[eF,e$]=(0,n.useState)(null),[eO,eP]=(0,n.useState)(null),eA=V?.ahead??0,eE=V?.behind??0,eG=(V?.files.length??0)>0,eH=_.find(e=>e.path===q),eL=(0,n.useCallback)(async()=>{await ex(e).catch(()=>{}),await Promise.all([Q(e),Z(e),ee(e)])},[e,ex,Q,Z,ee]),eR=(0,n.useCallback)(()=>{eL(),et(e)},[e,eL,et]),{syncing:eU,remoteDialogOpen:eW,setRemoteDialogOpen:eK,handleSync:eV,handleRemoteSubmit:eJ,handleSyncChanges:eX}=function(e,t){let s=(0,v.useTranslations)("git.commits"),a=(0,v.useTranslations)("git.changes"),{push:i,pull:l,getRemotes:r,addRemote:o}=(0,C.useGitStore)(),[c,d]=(0,n.useState)(null),[u,x]=(0,n.useState)(!1),[h,m]=(0,n.useState)(null),p=async n=>{"push"===n?(await i(e),F.toast.success(s("pushedSuccessfully"))):(await l(e),F.toast.success(s("pulledSuccessfully"))),t()},f=async n=>{d(n);try{if(!(await r(e)).length){m(n),x(!0);return}await p(n)}catch(e){P(e)?.includes("No remote")?(m(n),x(!0)):F.toast.error("push"===n?s("pushFailed"):s("pullFailed"),{description:P(e)}),"pull"===n&&await t()}finally{d(null)}},g=async(t,n)=>{await o(e,t,n),F.toast.success(s("remoteAdded")),h&&(await p(h),m(null))},j=(0,n.useCallback)(async()=>{d("push");try{if(!(await r(e)).length)return void x(!0);await i(e),await l(e),F.toast.success(a("syncedSuccessfully")),t()}catch(e){P(e)?.includes("No remote")?x(!0):F.toast.error(a("syncFailed"),{description:P(e)}),await t()}finally{d(null)}},[e,i,l,r,t,a]);return{syncing:c,remoteDialogOpen:u,setRemoteDialogOpen:x,handleSync:f,handleRemoteSubmit:g,handleSyncChanges:j}}(e,eL);(0,n.useEffect)(()=>{eL(),et(e)},[e,eL,et]),(0,n.useEffect)(()=>{let t=setInterval(()=>{Q(e),Z(e)},5e3);return()=>clearInterval(t)},[e,Q,Z]);let eY=(0,n.useCallback)(async t=>{ef(!1),await eo(e,t),eL(),et(e)},[e,eo,eL,et]),e_=(0,n.useCallback)(async()=>{ed.trim()&&(ej(!0),ec(null),await en(e,ed.trim()),eu(""),ej(!1),eL())},[e,ed,en,eL,ec,eu]),eq=(0,n.useCallback)(async()=>{if(!eb&&!eg){eC(!0);try{let t=await fetch(`/api/workspaces/${e}/git/generate-commit-message`,{method:"POST"});if(!t.ok){let e=await t.json().catch(()=>({error:"Failed"}));throw Error(e.error)}let n=await t.json();n.message&&eu(n.message)}catch(e){F.toast.error(P(e)||G("failedCommitMessage"))}finally{eC(!1)}}},[e,eb,eg,eu,G]),eQ=(0,n.useCallback)(e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&e_()},[e_]),eZ=(0,n.useCallback)(e=>{ec(e===q?null:e)},[q,ec]),e0=(0,n.useCallback)((t,n)=>{t.stopPropagation(),eh(e,n)},[e,eh]),e1=(0,n.useCallback)((e,t)=>{e.stopPropagation(),e$({type:"single",path:t})},[]),e3=(0,n.useCallback)(async(t,n,s)=>{t.stopPropagation(),s?await el(e,n):await ei(e,n),eL()},[e,eL,ei,el]),e5=(0,n.useCallback)(async(t,n)=>{await er(e,t,n,!0),ec(null),eL(),F.toast.success("冲突已解决并暂存")},[e,eL,er,ec]),e2=(0,n.useCallback)(()=>{e$({type:"all"})},[]),e4=(0,n.useCallback)(async()=>{eF&&("single"===eF.type?await es(e,eF.path):await ea(e),e$(null),eL())},[e,eF,es,ea,eL]);(0,n.useCallback)(async()=>{try{let t=await fetch(`/api/workspaces/${e}/files/content?path=.gitignore`),n=await t.json();eD(n.content??"")}catch{eD("")}eM(!0)},[e]);let e6=(0,n.useCallback)(async()=>{eB(!0);try{await fetch(`/api/workspaces/${e}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:".gitignore",content:eS})}),eM(!1),eL()}finally{eB(!1)}},[e,eS,eL]),e8=(0,n.useCallback)(async t=>{eN(null);try{let n=await fetch(`/api/workspaces/${e}/files/content?path=.gitignore`),s=(await n.json()).content??"";if(s.split("\n").filter(Boolean).includes(t))return;let a=s&&!s.endsWith("\n")?s+"\n"+t+"\n":s+t+"\n";await fetch(`/api/workspaces/${e}/files/content`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:".gitignore",content:a})}),eL()}catch{}},[e,eL]),e9=(e,t,n,s)=>{ev({open:!0,title:e,label:t,placeholder:n,onSubmit:s})};return K?(0,t.jsxs)("div",{className:"flex flex-col h-full overflow-hidden rounded-t-xl bg-background",children:[(0,t.jsx)("div",{className:"flex items-center px-2 py-1.5 border-b",children:(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:M("title")})}),(0,t.jsx)(w,{workspaceId:e,onInitialized:eL})]}):(0,t.jsxs)("div",{className:`flex h-full overflow-hidden rounded-t-xl bg-background ${H?"flex-col":""}`,children:[(0,t.jsxs)("div",{className:`flex flex-col bg-muted/20 ${H?"w-full border-b max-h-[40%]":"w-64 border-r"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b",children:[(0,t.jsxs)("div",{className:"relative flex-1 min-w-0",children:[(0,t.jsxs)("button",{onClick:()=>ef(!ep),className:"flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground active:opacity-70 transition-all duration-100 cursor-pointer w-full",children:[(0,t.jsx)(h.GitBranch,{size:13,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:V?.branch??"..."}),V&&eG&&(0,t.jsxs)("span",{className:"text-muted-foreground",children:["(",V.files.length,")"]}),(0,t.jsx)(x.ChevronDown,{size:12,className:"shrink-0"})]}),ep&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1 w-48 bg-popover border rounded shadow-md py-0.5 max-h-60 overflow-auto",children:[Y.map(e=>(0,t.jsx)("button",{onClick:()=>eY(e.name),className:`w-full text-left px-2 py-1 text-xs hover:bg-accent active:scale-[0.98] active:bg-accent transition-all duration-100 cursor-pointer truncate ${e.current?"font-semibold text-foreground":"text-muted-foreground"}`,children:e.name},e.name)),0===Y.length&&(0,t.jsx)("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:G("noBranches")})]}),(0,t.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>ef(!1)})]})]}),eG&&(0,t.jsx)("button",{onClick:e2,className:"p-1 text-muted-foreground hover:text-destructive active:scale-90 transition-all duration-100 cursor-pointer",title:G("discardAll"),children:(0,t.jsx)(u.Trash2,{size:13})}),(0,t.jsx)("button",{onClick:()=>{_.length>0&&em(e,"unstaged",G("unstagedChanges"),_)},disabled:!eG,className:"p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer disabled:opacity-30",title:G("viewDiff"),children:(0,t.jsx)(f.FileDiff,{size:13})}),(0,t.jsx)("button",{onClick:eL,className:"p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer",title:k("refresh"),children:(0,t.jsx)(l.RefreshCw,{size:13})})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-auto",children:[V?.files.map(e=>(0,t.jsxs)("div",{onClick:()=>eZ(e.path),onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),eN({x:t.clientX,y:t.clientY,path:e.path})},className:`group w-full text-left px-2 py-1 text-xs font-mono flex items-center gap-1.5 hover:bg-accent cursor-pointer ${q===e.path?"bg-accent":""}`,children:[(0,t.jsx)("span",{className:`w-4 text-center font-bold shrink-0 ${$[e.status]}`,children:O[e.status]}),e.conflicted&&(0,t.jsx)(b.AlertTriangle,{size:12,className:"shrink-0 text-red-500"}),(0,t.jsx)("span",{className:"truncate flex-1",children:e.path}),(0,t.jsxs)("span",{className:"hidden group-hover:flex md:flex items-center gap-0.5 shrink-0",children:[(0,t.jsx)("button",{onClick:t=>e3(t,e.path,e.staged),disabled:e.conflicted,className:"p-0.5 rounded hover:bg-accent/80 active:scale-90 transition-all duration-100 cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",title:e.staged?"Unstage":"Stage",children:e.staged?(0,t.jsx)(j.Minus,{size:13}):(0,t.jsx)(g.Plus,{size:13})}),(0,t.jsx)("button",{onClick:t=>e0(t,e.path),className:"p-0.5 rounded hover:bg-accent/80 active:scale-90 transition-all duration-100 cursor-pointer",title:k("open"),children:(0,t.jsx)(c.FileCode,{size:13})}),(0,t.jsx)("button",{onClick:t=>e1(t,e.path),className:"p-0.5 rounded hover:bg-accent/80 active:scale-90 transition-all duration-100 cursor-pointer",title:G("discardAll"),children:(0,t.jsx)(d.RotateCcw,{size:13})})]})]},e.path)),V?.clean&&(0,t.jsx)("div",{className:"p-2 text-xs text-muted-foreground",children:G("noChanges")})]}),eG?(0,t.jsxs)("div",{className:"border-t p-2 space-y-1.5",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("textarea",{value:ed,onChange:e=>eu(e.target.value),onKeyDown:eQ,placeholder:G("commitMessagePlaceholder"),rows:3,className:"w-full resize-none text-xs px-2 pt-1 pr-8 pb-7 border rounded bg-background disabled:opacity-50",disabled:eg||eb}),(0,t.jsx)("button",{type:"button",onClick:eq,disabled:eb||eg||!eG,className:"absolute bottom-1.5 right-1.5 p-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent active:scale-90 cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-all duration-100",title:"AI generate commit message",children:eb?(0,t.jsx)(a.Loader2,{size:14,className:"animate-spin"}):(0,t.jsx)(m.Sparkles,{size:14})})]}),(0,t.jsx)("button",{onClick:e_,disabled:!ed.trim()||eg,className:"w-full text-xs px-2 py-1 rounded bg-primary text-primary-foreground active:scale-[0.98] transition-all duration-100 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:eg?G("committing"):G("commit")})]}):eA>0?(0,t.jsx)("div",{className:"border-t p-2",children:(0,t.jsxs)("button",{onClick:eX,disabled:null!==eU,className:"w-full text-xs px-2 py-1 rounded bg-primary text-primary-foreground active:scale-[0.98] transition-all duration-100 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-1.5",children:[eU?(0,t.jsx)(a.Loader2,{size:13,className:"animate-spin"}):(0,t.jsx)(s.Upload,{size:13}),eU?G("syncing"):G("syncChanges")]})}):null]}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-2 py-1.5 border-b shrink-0",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:L.length>0?M("titleWithCount",{count:L.length}):M("title")}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)("button",{onClick:()=>eV("push"),disabled:null!==eU,className:"relative p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer disabled:opacity-50",title:eA>0?M("pushNCommits",{count:eA}):"Push",children:["push"===eU?(0,t.jsx)(a.Loader2,{size:13,className:"animate-spin"}):(0,t.jsx)(r.ArrowUp,{size:13}),eA>0&&(0,t.jsx)("span",{className:"absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-foreground px-1 text-[9px] font-medium leading-none text-background",children:eA})]}),(0,t.jsxs)("button",{onClick:()=>eV("pull"),disabled:null!==eU,className:"relative p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer disabled:opacity-50",title:eE>0?M("pullNCommits",{count:eE}):"Pull",children:["pull"===eU?(0,t.jsx)(a.Loader2,{size:13,className:"animate-spin"}):(0,t.jsx)(o.ArrowDown,{size:13}),eE>0&&(0,t.jsx)("span",{className:"absolute -top-1 -right-1 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-foreground px-1 text-[9px] font-medium leading-none text-background",children:eE})]}),(0,t.jsx)("button",{onClick:eL,className:"p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer",children:(0,t.jsx)(l.RefreshCw,{size:13})}),(0,t.jsx)("button",{onClick:()=>ez(!0),className:"p-1 text-muted-foreground hover:text-foreground active:scale-90 transition-all duration-100 cursor-pointer",title:M("settingsTitle"),children:(0,t.jsx)(p.Settings2,{size:13})})]})]}),eH?(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(D.DiffViewer,{oldContent:eH.oldContent,newContent:eH.newContent,path:eH.path,isBinary:eH.isBinary,mergeMode:!!eH.isConflict,onResolve:eH.isConflict?e=>e5(eH.path,e):void 0})}):(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[U&&!L.length&&(0,t.jsx)("div",{className:"p-2 space-y-1",children:(0,t.jsx)(I.SkeletonGroup,{count:6,children:e=>(0,t.jsxs)("div",{className:"px-2 py-1.5 border-b space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(I.Skeleton,{className:"h-3 w-10 rounded"}),(0,t.jsx)(I.Skeleton,{className:"h-3 flex-1"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pl-7",children:[(0,t.jsx)(I.Skeleton,{className:"h-3 w-20"}),(0,t.jsx)(I.Skeleton,{className:"h-3 w-16"})]})]},e)})}),L.map(n=>{let s=!!V?.remoteHeadHash&&n.hash.startsWith(V.remoteHeadHash.substring(0,7)),a=!!V?.headHash&&n.hash.startsWith(V.headHash.substring(0,7));return(0,t.jsxs)(B.ContextMenu,{children:[(0,t.jsx)(B.ContextMenuTrigger,{children:(0,t.jsxs)("div",{onClick:()=>eP(n),className:`px-2 py-1.5 border-b border-l-2 hover:bg-accent cursor-pointer ${a?"border-l-foreground":s?"border-l-blue-500":"border-l-transparent"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,t.jsx)("span",{title:M("remoteTrackingBranch"),children:(0,t.jsx)(i.GitCommitHorizontal,{size:13,className:"shrink-0 text-blue-500"})}),(0,t.jsx)("code",{className:"text-xs font-mono text-blue-600 shrink-0",children:n.hash.slice(0,7)}),(0,t.jsx)("span",{className:"text-xs truncate",children:n.message.split("\n")[0]}),a&&(0,t.jsx)("span",{className:"text-[10px] font-medium text-muted-foreground bg-muted px-1 rounded",children:"HEAD"})]}),(0,t.jsxs)("div",{className:`flex items-center gap-2 mt-0.5 ${s?"pl-[21px]":""}`,children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:n.author}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:new Date(n.date).toLocaleDateString()})]})]})}),(0,t.jsx)(J,{workspaceId:e,entry:n,onRefreshAll:eR,onOpenPrompt:e9})]},n.hash)}),!U&&!L.length&&(0,t.jsx)("div",{className:"p-2 text-xs text-muted-foreground",children:M("noCommits")})]})]}),ew&&(0,t.jsx)(W,{x:ew.x,y:ew.y,path:ew.path,onAddToGitignore:e8,onOpenFile:t=>eh(e,t),onDiscard:e=>e$({type:"single",path:e}),onClose:()=>eN(null)}),(0,t.jsx)(S,{open:eW,onOpenChange:eK,onSubmit:eJ}),(0,t.jsx)(A,{open:ey.open,onOpenChange:e=>ev(t=>({...t,open:e})),title:ey.title,label:ey.label,placeholder:ey.placeholder,onSubmit:e=>{ey.onSubmit(e),ev(e=>({...e,open:!1}))}}),(0,t.jsx)(R,{open:ek,onOpenChange:eM,content:eS,onContentChange:eD,saving:eI,onSave:e6}),(0,t.jsx)(N.Dialog,{open:eT,onOpenChange:ez,children:(0,t.jsxs)(N.DialogContent,{className:"sm:max-w-md",children:[(0,t.jsx)(N.DialogHeader,{children:(0,t.jsx)(N.DialogTitle,{children:M("settingsTitle")})}),(0,t.jsx)(T.GitSettingsForm,{scope:"local",workspaceId:e})]})}),(0,t.jsx)(E,{confirm:eF,open:!!eF,onOpenChange:e=>!e&&e$(null),onConfirm:e4}),(0,t.jsx)(X,{workspaceId:e,entry:eO,onClose:()=>eP(null)})]})}],448303)},514669,e=>{e.n(e.i(448303))}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,600304,759309,e=>{"use strict";let t=(0,e.i(433721).default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);e.s(["default",0,t],759309),e.s(["Send",0,t],600304)},595390,272736,e=>{"use strict";var t=e.i(344180),s=e.i(764556),l=e.i(681622),a=e.i(611176),i=e.i(972846);let r=e=>!["scheduler","task_creator","bot"].includes(e.description||"")&&"agent-generator"!==e.id;function n(e){return e.name?.trim()||e.role}e.s(["MemberPicker",0,function({candidates:e,selected:n,onToggle:o,searchPlaceholder:d,emptyText:c,label:u,filter:f}){let[m,p]=(0,s.useState)(""),h=e.filter(f??r).filter(e=>`${e.label} ${e.description||""}`.toLowerCase().includes(m.toLowerCase()));return(0,t.jsxs)("div",{className:"space-y-2",children:[u&&(0,t.jsx)("label",{className:"text-sm font-medium",children:u}),(0,t.jsx)(l.Input,{value:m,onChange:e=>p(e.target.value),placeholder:d}),(0,t.jsxs)("div",{className:"max-h-40 overflow-y-auto space-y-0.5",children:[0===h.length&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground py-2 text-center",children:c||"No items found"}),h.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>o(e.id),className:"flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[(0,t.jsx)(a.AgentIcon,{agentId:"user"!==e.id?e.id:void 0,name:e.label,className:"size-5 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.label}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:`flex items-center justify-center size-4 rounded border shrink-0 ${n.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input"}`})]},e.id))]}),n.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.map(s=>{let l=e.find(e=>e.id===s),r=l?.label||s;return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs max-w-[160px] min-w-0",children:["user"===s?(0,t.jsx)("span",{className:"truncate",children:r}):(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 min-w-0",children:[(0,t.jsx)(a.AgentIcon,{agentId:s,name:r,className:"size-3.5 rounded-full shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:r})]}),(0,t.jsx)("button",{type:"button",onClick:()=>o(s),className:"hover:text-destructive shrink-0 cursor-pointer",children:(0,t.jsx)(i.X,{className:"size-3"})})]},s)})})]})}],595390),e.s(["getAgentDisplayName",0,n,"getMemberDisplayName",0,function(e,t){if("user"===t)return"user";let s=e.find(e=>e.id===t);return s?n(s):t},"normalizeChannelMembersToAgentIds",0,function(e,t){let s=new Set(e.map(e=>e.id)),l=[],a=new Set;for(let e of t)s.has(e)&&(a.has(e)||(a.add(e),l.push(e)));return l}],272736)},889445,e=>{"use strict";let t=(0,e.i(433721).default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["Play",0,t],889445)},444204,e=>{"use strict";let t=(0,e.i(433721).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);e.s(["Clock",0,t],444204)},583705,e=>{"use strict";let t=(0,e.i(433721).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);e.s(["Info",0,t],583705)},302773,e=>{"use strict";let t=(0,e.i(816709).create)((e,t)=>({workflows:[],currentWorkflow:null,isLoading:!1,loadWorkflows:async()=>{e({isLoading:!0});try{let t=await fetch("/api/workflows"),s=await t.json();e({workflows:s,isLoading:!1})}catch{e({isLoading:!1})}},createWorkflow:async t=>{let s=await fetch("/api/workflows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),l=await s.json();return e(e=>({workflows:[...e.workflows,l]})),l},updateWorkflow:async(e,s)=>{let l=await fetch(`/api/workflows/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await l.json();t().upsertWorkflow(a)},deleteWorkflow:async e=>{await fetch(`/api/workflows/${e}`,{method:"DELETE"}),t().removeWorkflow(e)},duplicateWorkflow:async t=>{let s=await fetch(`/api/workflows/${t}/duplicate`,{method:"POST"}),l=await s.json();e(e=>({workflows:[...e.workflows,l]}))},setCurrentWorkflow:t=>e({currentWorkflow:t}),upsertWorkflow:t=>{e(e=>{let s=e.workflows.findIndex(e=>e.id===t.id);if(-1!==s){let l=[...e.workflows];return l[s]=t,{workflows:l}}return{workflows:[...e.workflows,t]}})},removeWorkflow:t=>{e(e=>({workflows:e.workflows.filter(e=>e.id!==t),currentWorkflow:e.currentWorkflow?.id===t?null:e.currentWorkflow}))}}));e.s(["useWorkflowStore",0,t])},358989,e=>{"use strict";var t=e.i(344180),s=e.i(764556),l=e.i(244073),a=e.i(209988),i=e.i(260218),r=e.i(681622),n=e.i(788010),o=e.i(595390),d=e.i(272736),c=e.i(302773);let u=["draft","planned","in_progress","review_pending","changes_requested","approved","completed","archived"];e.s(["EditIssueDialog",0,function({issue:e,open:f,onOpenChange:m,agents:p=[],onSave:h}){let[x,w]=(0,s.useState)(e.title),[g,k]=(0,s.useState)(e.description),[y,b]=(0,s.useState)(e.status),[j,v]=(0,s.useState)(e.members||[]),[N,C]=(0,s.useState)(!1),[_,S]=(0,s.useState)(e.workflowId??""),{workflows:T,loadWorkflows:W}=(0,c.useWorkflowStore)(),I=(0,l.useTranslations)("issue"),D=(0,l.useTranslations)("common");(0,s.useEffect)(()=>{f&&(w(e.title),k(e.description),b(e.status),v(e.members?.length?[...e.members]:[]),S(e.workflowId??""))},[f,e]),(0,s.useEffect)(()=>{f&&W()},[f,W]);let M=async()=>{if(x.trim()){C(!0);try{await h({title:x.trim(),description:g.trim(),status:y,members:j,workflowId:"__none__"===_?null:_||null}),m(!1)}finally{C(!1)}}},P=(0,s.useMemo)(()=>p.filter(e=>!1!==e.enabled).map(e=>({id:e.id,label:(0,d.getMemberDisplayName)(p,e.id),description:e.role})),[p]);return(0,t.jsx)(a.Dialog,{open:f,onOpenChange:m,children:(0,t.jsxs)(a.DialogContent,{className:"sm:max-w-md max-h-[85vh] p-0 gap-0 flex flex-col overflow-hidden",children:[(0,t.jsxs)(a.DialogHeader,{className:"px-4 py-4 shrink-0",children:[(0,t.jsx)(a.DialogTitle,{children:I("edit.title")}),(0,t.jsx)(a.DialogDescription,{children:I("edit.description")})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto px-4 pb-4",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(r.Input,{placeholder:I("edit.titlePlaceholder"),value:x,onChange:e=>w(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)(n.Textarea,{placeholder:I("edit.descriptionPlaceholder"),value:g,onChange:e=>k(e.target.value),rows:3}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground",children:I("edit.statusLabel")}),(0,t.jsx)("select",{value:y,onChange:e=>b(e.target.value),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:u.map(e=>(0,t.jsx)("option",{value:e,children:I(`status.${e}`)},e))})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-sm font-medium text-foreground",children:"Workflow Template"}),(0,t.jsxs)("select",{value:_||"__none__",onChange:e=>(e=>{if(S(e),!e)return;let t=T.find(t=>t.id===e);if(!t)return;let s=t.nodes.map(e=>e.data.agentConfigId);v(e=>Array.from(new Set([...e,...s])))})("__none__"===e.target.value?"":e.target.value),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[(0,t.jsx)("option",{value:"__none__",children:"None (use default pipeline)"}),T.map(e=>(0,t.jsxs)("option",{value:e.id,children:[e.name," (",e.nodes.length," agents)"]},e.id))]})]}),(0,t.jsx)(o.MemberPicker,{candidates:P,selected:j,onToggle:e=>{v(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},label:I("edit.membersLabel"),searchPlaceholder:I("edit.searchAgent"),emptyText:I("edit.noAgents")}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2",children:[(0,t.jsx)(i.Button,{variant:"outline",onClick:()=>m(!1),children:D("cancel")}),(0,t.jsx)(i.Button,{onClick:M,disabled:!x.trim()||N,children:D(N?"saving":"save")})]})]})})]})})}])}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,668667,e=>{"use strict";let t=(0,e.i(433721).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,t],668667)},822162,e=>{"use strict";var t=e.i(111092),n=e.i(362615),r=e.i(939785);function i(e){var t;let{char:n,allowSpaces:i,allowToIncludeChar:o,allowedPrefixes:a,startOfLine:s,$position:l}=e,u=i&&!o,c=(0,r.escapeForRegEx)(n),d=RegExp(`\\s${c}$`),p=s?"^":"",f=o?"":c,m=u?RegExp(`${p}${c}.*?(?=\\s${f}|$)`,"gm"):RegExp(`${p}(?:^)?${c}[^\\s${f}]*`,"gm"),g=(null==(t=l.nodeBefore)?void 0:t.isText)&&l.nodeBefore.text;if(!g)return null;let h=l.pos-g.length,v=Array.from(g.matchAll(m)).pop();if(!v||void 0===v.input||void 0===v.index)return null;let y=v.input.slice(Math.max(0,v.index-1),v.index),b=RegExp(`^[${null==a?void 0:a.join("")}\0]?$`).test(y);if(null!==a&&!b)return null;let x=h+v.index,w=x+v[0].length;return(u&&d.test(g.slice(w-1,w+1))&&(v[0]+=" ",w+=1),x<l.pos&&w>=l.pos)?{range:{from:x,to:w},query:v[0].slice(n.length),text:v[0]}:null}var o=new t.PluginKey("suggestion");function a({pluginKey:e=o,editor:r,char:s="@",allowSpaces:l=!1,allowToIncludeChar:u=!1,allowedPrefixes:c=[" "],startOfLine:d=!1,decorationTag:p="span",decorationClass:f="suggestion",decorationContent:m="",decorationEmptyClass:g="is-empty",command:h=()=>null,items:v=()=>[],render:y=()=>({}),allow:b=()=>!0,findSuggestionMatch:x=i,shouldShow:w,shouldResetDismissed:O}){let j,E=null==y?void 0:y(),T=l&&!u,A=()=>{let e=r.state.selection.$anchor.pos,{top:t,right:n,bottom:i,left:o}=r.view.coordsAtPos(e);try{return new DOMRect(o,t,n-o,i-t)}catch{return null}},k=(t,n)=>n?()=>{let n=e.getState(r.state),i=null==n?void 0:n.decorationId,o=t.dom.querySelector(`[data-decoration-id="${i}"]`);return(null==o?void 0:o.getBoundingClientRect())||null}:A,C=new t.Plugin({key:e,view(){return{update:async(e,t)=>{var n,i,o,a,s,l,u;let c=null==(n=this.key)?void 0:n.getState(t),d=null==(i=this.key)?void 0:i.getState(e.state),p=c.active&&d.active&&c.range.from!==d.range.from,f=!c.active&&d.active,m=c.active&&!d.active,g=!f&&!m&&c.query!==d.query,y=f||p&&g,b=g||p,x=m||p&&g;if(!y&&!b&&!x)return;let w=x&&!y?c:d,O=e.dom.querySelector(`[data-decoration-id="${w.decorationId}"]`);j={editor:r,range:w.range,query:w.query,text:w.text,items:[],command:e=>h({editor:r,range:w.range,props:e}),decorationNode:O,clientRect:k(e,O)},y&&(null==(o=null==E?void 0:E.onBeforeStart)||o.call(E,j)),b&&(null==(a=null==E?void 0:E.onBeforeUpdate)||a.call(E,j)),(b||y)&&(j.items=await v({editor:r,query:w.query})),x&&(null==(s=null==E?void 0:E.onExit)||s.call(E,j)),b&&(null==(l=null==E?void 0:E.onUpdate)||l.call(E,j)),y&&(null==(u=null==E?void 0:E.onStart)||u.call(E,j))},destroy:()=>{var e;j&&(null==(e=null==E?void 0:E.onExit)||e.call(E,j))}}},state:{init:()=>({active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}),apply(t,n,i,o){let{isEditable:a}=r,{composing:p}=r.view,{selection:f}=t,{empty:m,from:g}=f,h={...n},v=t.getMeta(e);if(v&&v.exit)return h.active=!1,h.decorationId=null,h.range={from:0,to:0},h.query=null,h.text=null,h.dismissedRange=n.active?{...n.range}:n.dismissedRange,h;if(h.composing=p,t.docChanged&&null!==h.dismissedRange&&(h.dismissedRange={from:t.mapping.map(h.dismissedRange.from),to:t.mapping.map(h.dismissedRange.to)}),a&&(m||r.view.composing)){(g<n.range.from||g>n.range.to)&&!p&&!n.composing&&(h.active=!1);let e=x({char:s,allowSpaces:l,allowToIncludeChar:u,allowedPrefixes:c,startOfLine:d,$position:f.$from}),i=`id_${Math.floor(0xffffffff*Math.random())}`;e&&b({editor:r,state:o,range:e.range,isActive:n.active})&&(!w||w({editor:r,range:e.range,query:e.query,text:e.text,transaction:t}))?(null===h.dismissedRange||(({match:e,dismissedRange:t,state:n,transaction:i})=>(null==O?!void 0:!O({editor:r,state:n,range:t,match:e,transaction:i,allowSpaces:T}))&&(T?e.range.from===t.from:e.range.from===t.from&&!(i.docChanged&&i.steps.some(e=>{let t=e.slice;if(!(null==t?void 0:t.content))return!1;let n=t.content.textBetween(0,t.content.size,"\n");return/\s/.test(n)}))))({match:e,dismissedRange:h.dismissedRange,state:o,transaction:t})||(h.dismissedRange=null),null===h.dismissedRange?(h.active=!0,h.decorationId=n.decorationId?n.decorationId:i,h.range=e.range,h.query=e.query,h.text=e.text):h.active=!1):(e||(h.dismissedRange=null),h.active=!1)}else h.active=!1;return h.active||(h.decorationId=null,h.range={from:0,to:0},h.query=null,h.text=null),h}},props:{handleKeyDown(t,n){var i,o;let{active:a,range:s}=C.getState(t.state);if(!a)return!1;if("Escape"===n.key||"Esc"===n.key){let o=C.getState(t.state);return null==(i=null==E?void 0:E.onKeyDown)||i.call(E,{view:t,event:n,range:o.range}),!function(t,n){var i;try{let n=e.getState(t.state),o=(null==n?void 0:n.decorationId)?t.dom.querySelector(`[data-decoration-id="${n.decorationId}"]`):null,a={editor:r,range:(null==n?void 0:n.range)||{from:0,to:0},query:(null==n?void 0:n.query)||null,text:(null==n?void 0:n.text)||null,items:[],command:e=>h({editor:r,range:(null==n?void 0:n.range)||{from:0,to:0},props:e}),decorationNode:o,clientRect:k(t,o)};null==(i=null==E?void 0:E.onExit)||i.call(E,a)}catch{}let o=t.state.tr.setMeta(n,{exit:!0});t.dispatch(o)}(t,e),!0}return(null==(o=null==E?void 0:E.onKeyDown)?void 0:o.call(E,{view:t,event:n,range:s}))||!1},decorations(e){let{active:t,range:r,decorationId:i,query:o}=C.getState(e);if(!t)return null;let a=!(null==o?void 0:o.length),s=[f];return a&&s.push(g),n.DecorationSet.create(e.doc,[n.Decoration.inline(r.from,r.to,{nodeName:p,class:s.join(" "),"data-decoration-id":i,"data-decoration-content":m})])}}});return C}e.s(["Suggestion",0,a,"default",0,a])},780207,e=>{"use strict";var t=e.i(939785),n=e.i(47091),r=e.i(822162),i=e.i(111092);function o(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>(function({editor:e,overrideSuggestionOptions:t,extensionName:n,char:r="@"}){return{editor:e,char:r,pluginKey:new i.PluginKey,command:({editor:e,range:t,props:i})=>{var o,a,s;let l=e.view.state.selection.$to.nodeAfter;(null==(o=null==l?void 0:l.text)?void 0:o.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:n,attrs:{...i,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),null==(s=null==(a=e.view.dom.ownerDocument.defaultView)?void 0:a.getSelection())||s.collapseToEnd()},allow:({state:e,range:t})=>{let r=e.doc.resolve(t.from),i=e.schema.nodes[n];return!!r.parent.type.contentMatch.matchType(i)},...t}})({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function a(e,t){let n=o(e),r=n.find(e=>e.char===t);return r||(n.length?n[0]:null)}var s=t.Node.create({name:"mention",priority:101,addOptions:()=>({HTMLAttributes:{},renderText({node:e,suggestion:t}){var n,r;return`${null!=(n=null==t?void 0:t.char)?n:"@"}${null!=(r=e.attrs.label)?r:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:n,suggestion:r}){var i,o;return["span",(0,t.mergeAttributes)(this.HTMLAttributes,e.HTMLAttributes),`${null!=(i=null==r?void 0:r.char)?i:"@"}${null!=(o=n.attrs.label)?o:n.attrs.id}`]},suggestions:[],suggestion:{}}),group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes:()=>({id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}),parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:n}){let r=a(this,e.attrs.mentionSuggestionChar);if(void 0!==this.options.renderLabel)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",(0,t.mergeAttributes)({"data-type":this.name},this.options.HTMLAttributes,n),this.options.renderLabel({options:this.options,node:e,suggestion:r})];let i={...this.options};i.HTMLAttributes=(0,t.mergeAttributes)({"data-type":this.name},this.options.HTMLAttributes,n);let o=this.options.renderHTML({options:i,node:e,suggestion:r});return"string"==typeof o?["span",(0,t.mergeAttributes)({"data-type":this.name},this.options.HTMLAttributes,n),o]:o},...(0,t.createInlineMarkdownSpec)({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,i,o,a]=r,s=null!=o?o:a;t["char"===i?"mentionSuggestionChar":i]=s,r=n.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${"mentionSuggestionChar"===e?"char":e}="${t}"`).join(" ")}),renderText({node:e}){let t={options:this.options,node:e,suggestion:a(this,e.attrs.mentionSuggestionChar)};return void 0!==this.options.renderLabel?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(t)):this.options.renderText(t)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let r=!1,{selection:i}=t,{empty:o,anchor:a}=i;if(!o)return!1;let s=new n.Node,l=0;return t.doc.nodesBetween(a-1,a,(e,t)=>{if(e.type.name===this.name)return r=!0,s=e,l=t,!1}),r&&e.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,l,l+s.nodeSize),r})}},addProseMirrorPlugins(){return o(this).map(r.Suggestion)}});e.s(["default",0,s])},972097,162519,e=>{"use strict";var t,n,r,i,o,a=e.i(344180),s=e.i(764556),l=e.i(568772),u=e.i(260218),c=e.i(996652),d=e.i(835829),p=e.i(386041),f=e.i(600304);let m=(0,e.i(433721).default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var g=e.i(972846);let h=[];function v(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function y(e){var t=v(e).Element;return e instanceof t||e instanceof Element}function b(e){var t=v(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function x(e){if("u"<typeof ShadowRoot)return!1;var t=v(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}e.s(["ComposerShell",0,function({workspaceId:e,editor:t,canSubmit:n,onSubmit:r,onStop:i,isProcessing:o=!1,actions:v,className:y,dropzoneProps:b,hiddenInput:x,replyLabel:w,onCancelReply:O}){let[j,E]=(0,s.useState)(!1),T=(0,d.useInspectorHistoryStore)(t=>t.histories[e]??h),A=(0,d.useInspectorHistoryStore)(e=>e.loadHistory),k=(0,d.useInspectorHistoryStore)(e=>e.clearHistory);return(0,a.jsx)("div",{className:y,children:(0,a.jsxs)("div",{className:"bg-background border border-border rounded-2xl overflow-hidden",...b,children:[x,w?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b px-3 py-1.5 text-xs text-muted-foreground",children:[(0,a.jsxs)("span",{className:"min-w-0 truncate",children:["回复给 ",w]}),(0,a.jsx)("button",{type:"button",onClick:O,className:"inline-flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted hover:text-foreground cursor-pointer",title:"取消回复",children:(0,a.jsx)(g.X,{className:"size-3"})})]}):null,(0,a.jsx)("div",{className:"px-3 pt-3 pb-2",children:(0,a.jsx)(l.EditorContent,{editor:t})}),(0,a.jsxs)("div",{className:"flex items-center justify-between px-2 pb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[v,(0,a.jsxs)(c.Popover,{open:j,onOpenChange:t=>{E(t),t&&A(e)},children:[(0,a.jsx)(c.PopoverTrigger,{render:(0,a.jsx)(u.Button,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-7 p-0 rounded-full border border-border hover:bg-accent text-muted-foreground",title:"最近定位代码"}),children:(0,a.jsx)(p.Code2,{className:"size-3"})}),(0,a.jsxs)(c.PopoverContent,{align:"start",sideOffset:6,className:"w-80 p-1.5 gap-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-2 py-1.5",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"最近定位代码"}),(0,a.jsx)("button",{type:"button",onClick:()=>k(e),disabled:0===T.length,className:"rounded px-1.5 py-0.5 text-xs text-muted-foreground hover:bg-accent hover:text-foreground disabled:pointer-events-none disabled:opacity-40",children:"清空"})]}),0===T.length?(0,a.jsx)("div",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:"暂无记录"}):(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto",children:T.map(e=>{let n=e.name||e.path.split("/").pop()||e.path;return(0,a.jsxs)("button",{type:"button",onClick:()=>{var n,r,i;return n=e.path,r=e.line,i=e.column,void(t?.chain().focus().insertContent(`${n}:${r}:${i}`).run(),E(!1))},className:"flex w-full flex-col items-start gap-0.5 rounded-md px-2 py-1.5 text-left hover:bg-accent",children:[(0,a.jsx)("span",{className:"w-full truncate text-xs font-medium",children:n}),(0,a.jsxs)("span",{className:"w-full truncate font-mono text-[11px] text-muted-foreground",children:[e.path,":",e.line,":",e.column]})]},e.id)})})]})]})]}),o?(0,a.jsx)(u.Button,{type:"button",onClick:i,className:"size-7 p-0 rounded-full bg-destructive hover:bg-destructive/90 text-destructive-foreground",children:(0,a.jsx)(m,{className:"size-3",fill:"currentColor"})}):n?(0,a.jsx)(u.Button,{type:"button",onClick:r,className:"size-7 p-0 rounded-full bg-primary",children:(0,a.jsx)(f.Send,{className:"size-3"})}):null]})]})})}],972097),e.i(8890);var w=Math.max,O=Math.min,j=Math.round;function E(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function T(){return!/^((?!chrome|android).)*safari/i.test(E())}function A(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var r=e.getBoundingClientRect(),i=1,o=1;t&&b(e)&&(i=e.offsetWidth>0&&j(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&j(r.height)/e.offsetHeight||1);var a=(y(e)?v(e):window).visualViewport,s=!T()&&n,l=(r.left+(s&&a?a.offsetLeft:0))/i,u=(r.top+(s&&a?a.offsetTop:0))/o,c=r.width/i,d=r.height/o;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l,x:l,y:u}}function k(e){var t=v(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function C(e){return e?(e.nodeName||"").toLowerCase():null}function S(e){return((y(e)?e.ownerDocument:e.document)||window.document).documentElement}function L(e){return A(S(e)).left+k(e).scrollLeft}function D(e){return v(e).getComputedStyle(e)}function M(e){var t=D(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function R(e){var t=A(e),n=e.offsetWidth,r=e.offsetHeight;return 1>=Math.abs(t.width-n)&&(n=t.width),1>=Math.abs(t.height-r)&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function N(e){return"html"===C(e)?e:e.assignedSlot||e.parentNode||(x(e)?e.host:null)||S(e)}function H(e,t){void 0===t&&(t=[]);var n,r=function e(t){return["html","body","#document"].indexOf(C(t))>=0?t.ownerDocument.body:b(t)&&M(t)?t:e(N(t))}(e),i=r===(null==(n=e.ownerDocument)?void 0:n.body),o=v(r),a=i?[o].concat(o.visualViewport||[],M(r)?r:[]):r,s=t.concat(a);return i?s:s.concat(H(N(a)))}function P(e){return b(e)&&"fixed"!==D(e).position?e.offsetParent:null}function B(e){for(var t=v(e),n=P(e);n&&["table","td","th"].indexOf(C(n))>=0&&"static"===D(n).position;)n=P(n);return n&&("html"===C(n)||"body"===C(n)&&"static"===D(n).position)?t:n||function(e){var t=/firefox/i.test(E());if(/Trident/i.test(E())&&b(e)&&"fixed"===D(e).position)return null;var n=N(e);for(x(n)&&(n=n.host);b(n)&&0>["html","body"].indexOf(C(n));){var r=D(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||t&&"filter"===r.willChange||t&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(e)||t}var I="bottom",q="right",$="left",V="auto",W=["top",I,q,$],z="start",U="viewport",K="popper",_=W.reduce(function(e,t){return e.concat([t+"-"+z,t+"-end"])},[]),F=[].concat(W,[V]).reduce(function(e,t){return e.concat([t,t+"-"+z,t+"-end"])},[]),X=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Y(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&x(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function G(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function J(e,t,n){var r,i,o,a,s,l,u,c,d,p;return t===U?G(function(e,t){var n=v(e),r=S(e),i=n.visualViewport,o=r.clientWidth,a=r.clientHeight,s=0,l=0;if(i){o=i.width,a=i.height;var u=T();(u||!u&&"fixed"===t)&&(s=i.offsetLeft,l=i.offsetTop)}return{width:o,height:a,x:s+L(e),y:l}}(e,n)):y(t)?((r=A(t,!1,"fixed"===n)).top=r.top+t.clientTop,r.left=r.left+t.clientLeft,r.bottom=r.top+t.clientHeight,r.right=r.left+t.clientWidth,r.width=t.clientWidth,r.height=t.clientHeight,r.x=r.left,r.y=r.top,r):G((i=S(e),a=S(i),s=k(i),l=null==(o=i.ownerDocument)?void 0:o.body,u=w(a.scrollWidth,a.clientWidth,l?l.scrollWidth:0,l?l.clientWidth:0),c=w(a.scrollHeight,a.clientHeight,l?l.scrollHeight:0,l?l.clientHeight:0),d=-s.scrollLeft+L(i),p=-s.scrollTop,"rtl"===D(l||a).direction&&(d+=w(a.clientWidth,l?l.clientWidth:0)-u),{width:u,height:c,x:d,y:p}))}function Q(e){return e.split("-")[0]}function Z(e){return e.split("-")[1]}function ee(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function et(e){var t,n=e.reference,r=e.element,i=e.placement,o=i?Q(i):null,a=i?Z(i):null,s=n.x+n.width/2-r.width/2,l=n.y+n.height/2-r.height/2;switch(o){case"top":t={x:s,y:n.y-r.height};break;case I:t={x:s,y:n.y+n.height};break;case q:t={x:n.x+n.width,y:l};break;case $:t={x:n.x-r.width,y:l};break;default:t={x:n.x,y:n.y}}var u=o?ee(o):null;if(null!=u){var c="y"===u?"height":"width";switch(a){case z:t[u]=t[u]-(n[c]/2-r[c]/2);break;case"end":t[u]=t[u]+(n[c]/2-r[c]/2)}}return t}function en(){return{top:0,right:0,bottom:0,left:0}}function er(e){return Object.assign({},en(),e)}function ei(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}function eo(e,t){void 0===t&&(t={});var n,r,i,o,a,s,l,u,c=t,d=c.placement,p=void 0===d?e.placement:d,f=c.strategy,m=void 0===f?e.strategy:f,g=c.boundary,h=c.rootBoundary,v=c.elementContext,x=void 0===v?K:v,j=c.altBoundary,E=c.padding,T=void 0===E?0:E,k=er("number"!=typeof T?T:ei(T,W)),L=e.rects.popper,M=e.elements[void 0!==j&&j?x===K?"reference":K:x],R=(n=y(M)?M:M.contextElement||S(e.elements.popper),r=void 0===g?"clippingParents":g,i=void 0===h?U:h,l=(s=[].concat("clippingParents"===r?(o=H(N(n)),!y(a=["absolute","fixed"].indexOf(D(n).position)>=0&&b(n)?B(n):n)?[]:o.filter(function(e){return y(e)&&Y(e,a)&&"body"!==C(e)})):[].concat(r),[i]))[0],(u=s.reduce(function(e,t){var r=J(n,t,m);return e.top=w(r.top,e.top),e.right=O(r.right,e.right),e.bottom=O(r.bottom,e.bottom),e.left=w(r.left,e.left),e},J(n,l,m))).width=u.right-u.left,u.height=u.bottom-u.top,u.x=u.left,u.y=u.top,u),P=A(e.elements.reference),$=et({reference:P,element:L,strategy:"absolute",placement:p}),V=G(Object.assign({},L,$)),z=x===K?V:P,_={top:R.top-z.top+k.top,bottom:z.bottom-R.bottom+k.bottom,left:R.left-z.left+k.left,right:z.right-R.right+k.right},F=e.modifiersData.offset;if(x===K&&F){var X=F[p];Object.keys(_).forEach(function(e){var t=[q,I].indexOf(e)>=0?1:-1,n=["top",I].indexOf(e)>=0?"y":"x";_[e]+=X[n]*t})}return _}var ea={placement:"bottom",modifiers:[],strategy:"absolute"};function es(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&"function"==typeof e.getBoundingClientRect)})}var el={passive:!0},eu={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ec(e){var t,n,r,i,o,a,s,l=e.popper,u=e.popperRect,c=e.placement,d=e.variation,p=e.offsets,f=e.position,m=e.gpuAcceleration,g=e.adaptive,h=e.roundOffsets,y=e.isFixed,b=p.x,x=void 0===b?0:b,w=p.y,O=void 0===w?0:w,E="function"==typeof h?h({x:x,y:O}):{x:x,y:O};x=E.x,O=E.y;var T=p.hasOwnProperty("x"),A=p.hasOwnProperty("y"),k=$,C="top",L=window;if(g){var M=B(l),R="clientHeight",N="clientWidth";M===v(l)&&"static"!==D(M=S(l)).position&&"absolute"===f&&(R="scrollHeight",N="scrollWidth"),("top"===c||(c===$||c===q)&&"end"===d)&&(C=I,O-=(y&&M===L&&L.visualViewport?L.visualViewport.height:M[R])-u.height,O*=m?1:-1),(c===$||("top"===c||c===I)&&"end"===d)&&(k=q,x-=(y&&M===L&&L.visualViewport?L.visualViewport.width:M[N])-u.width,x*=m?1:-1)}var H=Object.assign({position:f},g&&eu),P=!0===h?(t={x:x,y:O},n=v(l),r=t.x,i=t.y,{x:j(r*(o=n.devicePixelRatio||1))/o||0,y:j(i*o)/o||0}):{x:x,y:O};return(x=P.x,O=P.y,m)?Object.assign({},H,((s={})[C]=A?"0":"",s[k]=T?"0":"",s.transform=1>=(L.devicePixelRatio||1)?"translate("+x+"px, "+O+"px)":"translate3d("+x+"px, "+O+"px, 0)",s)):Object.assign({},H,((a={})[C]=A?O+"px":"",a[k]=T?x+"px":"",a.transform="",a))}let ed={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];b(i)&&C(i)&&(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)}))})},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},o=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]="",e},{});b(r)&&C(r)&&(Object.assign(r.style,o),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}},requires:["computeStyles"]};var ep={left:"right",right:"left",bottom:"top",top:"bottom"};function ef(e){return e.replace(/left|right|bottom|top/g,function(e){return ep[e]})}var em={start:"end",end:"start"};function eg(e){return e.replace(/start|end/g,function(e){return em[e]})}function eh(e,t,n){return w(e,O(t,n))}function ev(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function ey(e){return["top",q,I,$].some(function(t){return e[t]>=0})}var eb=(r=void 0===(n=(t={defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,o=void 0===i||i,a=r.resize,s=void 0===a||a,l=v(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(e){e.addEventListener("scroll",n.update,el)}),s&&l.addEventListener("resize",n.update,el),function(){o&&u.forEach(function(e){e.removeEventListener("scroll",n.update,el)}),s&&l.removeEventListener("resize",n.update,el)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=et({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=n.adaptive,o=n.roundOffsets,a=void 0===o||o,s={placement:Q(t.placement),variation:Z(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:void 0===r||r,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,ec(Object.assign({},s,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:void 0===i||i,roundOffsets:a})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,ec(Object.assign({},s,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},ed,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.offset,o=void 0===i?[0,0]:i,a=F.reduce(function(e,n){var r,i,a,s,l,u;return e[n]=(r=t.rects,a=[$,"top"].indexOf(i=Q(n))>=0?-1:1,l=(s="function"==typeof o?o(Object.assign({},r,{placement:n})):o)[0],u=s[1],l=l||0,u=(u||0)*a,[$,q].indexOf(i)>=0?{x:u,y:l}:{x:l,y:u}),e},{}),s=a[t.placement],l=s.x,u=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,o=void 0===i||i,a=n.altAxis,s=void 0===a||a,l=n.fallbackPlacements,u=n.padding,c=n.boundary,d=n.rootBoundary,p=n.altBoundary,f=n.flipVariations,m=void 0===f||f,g=n.allowedAutoPlacements,h=t.options.placement,v=Q(h)===h,y=l||(v||!m?[ef(h)]:function(e){if(Q(e)===V)return[];var t=ef(e);return[eg(e),t,eg(t)]}(h)),b=[h].concat(y).reduce(function(e,n){var r,i,o,a,s,l,p,f,h,v,y,b;return e.concat(Q(n)===V?(i=(r={placement:n,boundary:c,rootBoundary:d,padding:u,flipVariations:m,allowedAutoPlacements:g}).placement,o=r.boundary,a=r.rootBoundary,s=r.padding,l=r.flipVariations,f=void 0===(p=r.allowedAutoPlacements)?F:p,0===(y=(v=(h=Z(i))?l?_:_.filter(function(e){return Z(e)===h}):W).filter(function(e){return f.indexOf(e)>=0})).length&&(y=v),Object.keys(b=y.reduce(function(e,n){return e[n]=eo(t,{placement:n,boundary:o,rootBoundary:a,padding:s})[Q(n)],e},{})).sort(function(e,t){return b[e]-b[t]})):n)},[]),x=t.rects.reference,w=t.rects.popper,O=new Map,j=!0,E=b[0],T=0;T<b.length;T++){var A=b[T],k=Q(A),C=Z(A)===z,S=["top",I].indexOf(k)>=0,L=S?"width":"height",D=eo(t,{placement:A,boundary:c,rootBoundary:d,altBoundary:p,padding:u}),M=S?C?q:$:C?I:"top";x[L]>w[L]&&(M=ef(M));var R=ef(M),N=[];if(o&&N.push(D[k]<=0),s&&N.push(D[M]<=0,D[R]<=0),N.every(function(e){return e})){E=A,j=!1;break}O.set(A,N)}if(j)for(var H=m?3:1,P=function(e){var t=b.find(function(t){var n=O.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return E=t,"break"},B=H;B>0&&"break"!==P(B);B--);t.placement!==E&&(t.modifiersData[r]._skip=!0,t.placement=E,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,o=n.altAxis,a=n.boundary,s=n.rootBoundary,l=n.altBoundary,u=n.padding,c=n.tether,d=void 0===c||c,p=n.tetherOffset,f=void 0===p?0:p,m=eo(t,{boundary:a,rootBoundary:s,padding:u,altBoundary:l}),g=Q(t.placement),h=Z(t.placement),v=!h,y=ee(g),b="x"===y?"y":"x",x=t.modifiersData.popperOffsets,j=t.rects.reference,E=t.rects.popper,T="function"==typeof f?f(Object.assign({},t.rects,{placement:t.placement})):f,A="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),k=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,C={x:0,y:0};if(x){if(void 0===i||i){var S,L="y"===y?"top":$,D="y"===y?I:q,M="y"===y?"height":"width",N=x[y],H=N+m[L],P=N-m[D],V=d?-E[M]/2:0,W=h===z?j[M]:E[M],U=h===z?-E[M]:-j[M],K=t.elements.arrow,_=d&&K?R(K):{width:0,height:0},F=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:en(),X=F[L],Y=F[D],G=eh(0,j[M],_[M]),J=v?j[M]/2-V-G-X-A.mainAxis:W-G-X-A.mainAxis,et=v?-j[M]/2+V+G+Y+A.mainAxis:U+G+Y+A.mainAxis,er=t.elements.arrow&&B(t.elements.arrow),ei=er?"y"===y?er.clientTop||0:er.clientLeft||0:0,ea=null!=(S=null==k?void 0:k[y])?S:0,es=eh(d?O(H,N+J-ea-ei):H,N,d?w(P,N+et-ea):P);x[y]=es,C[y]=es-N}if(void 0!==o&&o){var el,eu,ec="x"===y?"top":$,ed="x"===y?I:q,ep=x[b],ef="y"===b?"height":"width",em=ep+m[ec],eg=ep-m[ed],ev=-1!==["top",$].indexOf(g),ey=null!=(eu=null==k?void 0:k[b])?eu:0,eb=ev?em:ep-j[ef]-E[ef]-ey+A.altAxis,ex=ev?ep+j[ef]+E[ef]-ey-A.altAxis:eg,ew=d&&ev?(el=eh(eb,ep,ex))>ex?ex:el:eh(d?eb:em,ep,d?ex:eg);x[b]=ew,C[b]=ew-ep}t.modifiersData[r]=C}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,i=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,s=Q(n.placement),l=ee(s),u=[$,q].indexOf(s)>=0?"height":"width";if(o&&a){var c,d=(c=i.padding,er("number"!=typeof(c="function"==typeof c?c(Object.assign({},n.rects,{placement:n.placement})):c)?c:ei(c,W))),p=R(o),f="y"===l?"top":$,m="y"===l?I:q,g=n.rects.reference[u]+n.rects.reference[l]-a[l]-n.rects.popper[u],h=a[l]-n.rects.reference[l],v=B(o),y=v?"y"===l?v.clientHeight||0:v.clientWidth||0:0,b=d[f],x=y-p[u]-d[m],w=y/2-p[u]/2+(g/2-h/2),O=eh(b,w,x);n.modifiersData[r]=((t={})[l]=O,t.centerOffset=O-w,t)}},effect:function(e){var t=e.state,n=e.options.element,r=void 0===n?"[data-popper-arrow]":n;null==r||("string"!=typeof r||(r=t.elements.popper.querySelector(r)))&&Y(t.elements.popper,r)&&(t.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,o=t.modifiersData.preventOverflow,a=eo(t,{elementContext:"reference"}),s=eo(t,{altBoundary:!0}),l=ev(a,r),u=ev(s,i,o),c=ey(l),d=ey(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}}]}).defaultModifiers)?[]:n,o=void 0===(i=t.defaultOptions)?ea:i,function(e,t,n){void 0===n&&(n=o);var i,a,s={placement:"bottom",orderedModifiers:[],options:Object.assign({},ea,o),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],u=!1,c={state:s,setOptions:function(n){var i,a,u,p,f,m,g="function"==typeof n?n(s.options):n;d(),s.options=Object.assign({},o,s.options,g),s.scrollParents={reference:y(e)?H(e):e.contextElement?H(e.contextElement):[],popper:H(t)};var h=(a=Object.keys(i=[].concat(r,s.options.modifiers).reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{})).map(function(e){return i[e]}),u=new Map,p=new Set,f=[],a.forEach(function(e){u.set(e.name,e)}),a.forEach(function(e){p.has(e.name)||function e(t){p.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach(function(t){if(!p.has(t)){var n=u.get(t);n&&e(n)}}),f.push(t)}(e)}),m=f,X.reduce(function(e,t){return e.concat(m.filter(function(e){return e.phase===t}))},[]));return s.orderedModifiers=h.filter(function(e){return e.enabled}),s.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=e.effect;if("function"==typeof r){var i=r({state:s,name:t,instance:c,options:void 0===n?{}:n});l.push(i||function(){})}}),c.update()},forceUpdate:function(){if(!u){var e=s.elements,t=e.reference,n=e.popper;if(es(t,n)){s.rects={reference:(r=B(n),i="fixed"===s.options.strategy,o=b(r),p=b(r)&&(l=j((a=r.getBoundingClientRect()).width)/r.offsetWidth||1,d=j(a.height)/r.offsetHeight||1,1!==l||1!==d),f=S(r),m=A(t,p,i),g={scrollLeft:0,scrollTop:0},h={x:0,y:0},(o||!o&&!i)&&(("body"!==C(r)||M(f))&&(g=function(e){return e!==v(e)&&b(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:k(e)}(r)),b(r)?(h=A(r,!0),h.x+=r.clientLeft,h.y+=r.clientTop):f&&(h.x=L(f))),{x:m.left+g.scrollLeft-h.x,y:m.top+g.scrollTop-h.y,width:m.width,height:m.height}),popper:R(n)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach(function(e){return s.modifiersData[e.name]=Object.assign({},e.data)});for(var r,i,o,a,l,d,p,f,m,g,h,y=0;y<s.orderedModifiers.length;y++){if(!0===s.reset){s.reset=!1,y=-1;continue}var x=s.orderedModifiers[y],w=x.fn,O=x.options,E=void 0===O?{}:O,T=x.name;"function"==typeof w&&(s=w({state:s,options:E,name:T,instance:c})||s)}}}},update:(i=function(){return new Promise(function(e){c.forceUpdate(),e(s)})},function(){return a||(a=new Promise(function(e){Promise.resolve().then(function(){a=void 0,e(i())})})),a}),destroy:function(){d(),u=!0}};if(!es(e,t))return c;function d(){l.forEach(function(e){return e()}),l=[]}return c.setOptions(n).then(function(e){!u&&n.onFirstUpdate&&n.onFirstUpdate(e)}),c}),ex="tippy-content",ew="tippy-arrow",eO="tippy-svg-arrow",ej={passive:!0,capture:!0},eE=function(){return document.body};function eT(e,t,n){if(Array.isArray(e)){var r=e[t];return null==r?Array.isArray(n)?n[t]:n:r}return e}function eA(e,t){var n=({}).toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function ek(e,t){return"function"==typeof e?e.apply(void 0,t):e}function eC(e,t){var n;return 0===t?e:function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}}function eS(e){return[].concat(e)}function eL(e,t){-1===e.indexOf(t)&&e.push(t)}function eD(e){return[].slice.call(e)}function eM(e){return Object.keys(e).reduce(function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t},{})}function eR(){return document.createElement("div")}function eN(e){return["Element","Fragment"].some(function(t){return eA(e,t)})}function eH(e,t){e.forEach(function(e){e&&(e.style.transitionDuration=t+"ms")})}function eP(e,t){e.forEach(function(e){e&&e.setAttribute("data-state",t)})}function eB(e,t,n){var r=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(t){e[r](t,n)})}function eI(e,t){for(var n,r=t;r;){if(e.contains(r))return!0;r=null==r.getRootNode||null==(n=r.getRootNode())?void 0:n.host}return!1}var eq={isTouch:!1},e$=0;function eV(){!eq.isTouch&&(eq.isTouch=!0,window.performance&&document.addEventListener("mousemove",eW))}function eW(){var e=performance.now();e-e$<20&&(eq.isTouch=!1,document.removeEventListener("mousemove",eW)),e$=e}function ez(){var e=document.activeElement;if(e&&e._tippy&&e._tippy.reference===e){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var eU=!!("u">typeof window&&"u">typeof document)&&!!window.msCrypto,eK=Object.assign({appendTo:eE,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),e_=Object.keys(eK);function eF(e){var t=(e.plugins||[]).reduce(function(t,n){var r,i=n.name,o=n.defaultValue;return i&&(t[i]=void 0!==e[i]?e[i]:null!=(r=eK[i])?r:o),t},{});return Object.assign({},e,t)}function eX(e,t){var n,r=Object.assign({},t,{content:ek(t.content,[e])},t.ignoreAttributes?{}:((n=t.plugins)?Object.keys(eF(Object.assign({},eK,{plugins:n}))):e_).reduce(function(t,n){var r=(e.getAttribute("data-tippy-"+n)||"").trim();if(!r)return t;if("content"===n)t[n]=r;else try{t[n]=JSON.parse(r)}catch(e){t[n]=r}return t},{}));return r.aria=Object.assign({},eK.aria,r.aria),r.aria={expanded:"auto"===r.aria.expanded?t.interactive:r.aria.expanded,content:"auto"===r.aria.content?t.interactive?null:"describedby":r.aria.content},r}function eY(e,t){e.innerHTML=t}function eG(e){var t=eR();return!0===e?t.className=ew:(t.className=eO,eN(e)?t.appendChild(e):eY(t,e)),t}function eJ(e,t){eN(t.content)?(eY(e,""),e.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?eY(e,t.content):e.textContent=t.content)}function eQ(e){var t=e.firstElementChild,n=eD(t.children);return{box:t,content:n.find(function(e){return e.classList.contains(ex)}),arrow:n.find(function(e){return e.classList.contains(ew)||e.classList.contains(eO)}),backdrop:n.find(function(e){return e.classList.contains("tippy-backdrop")})}}function eZ(e){var t=eR(),n=eR();n.className="tippy-box",n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=eR();function i(n,r){var i=eQ(t),o=i.box,a=i.content,s=i.arrow;r.theme?o.setAttribute("data-theme",r.theme):o.removeAttribute("data-theme"),"string"==typeof r.animation?o.setAttribute("data-animation",r.animation):o.removeAttribute("data-animation"),r.inertia?o.setAttribute("data-inertia",""):o.removeAttribute("data-inertia"),o.style.maxWidth="number"==typeof r.maxWidth?r.maxWidth+"px":r.maxWidth,r.role?o.setAttribute("role",r.role):o.removeAttribute("role"),(n.content!==r.content||n.allowHTML!==r.allowHTML)&&eJ(a,e.props),r.arrow?s?n.arrow!==r.arrow&&(o.removeChild(s),o.appendChild(eG(r.arrow))):o.appendChild(eG(r.arrow)):s&&o.removeChild(s)}return r.className=ex,r.setAttribute("data-state","hidden"),eJ(r,e.props),t.appendChild(n),n.appendChild(r),i(e.props,e.props),{popper:t,onUpdate:i}}eZ.$$tippy=!0;var e0=1,e1=[],e2=[];function e9(e,t){void 0===t&&(t={});var n,r=eK.plugins.concat(t.plugins||[]);document.addEventListener("touchstart",eV,ej),window.addEventListener("blur",ez);var i=Object.assign({},t,{plugins:r}),o=(eN(n=e)?[n]:eA(n,"NodeList")?eD(n):Array.isArray(n)?n:eD(document.querySelectorAll(n))).reduce(function(e,t){var n=t&&function(e,t){var n,r,i,o,a,s,l,u,c=eX(e,Object.assign({},eK,eF(eM(t)))),d=!1,p=!1,f=!1,m=!1,g=[],h=eC(K,c.interactiveDebounce),v=e0++,y=(n=c.plugins).filter(function(e,t){return n.indexOf(e)===t}),b={id:v,reference:e,popper:eR(),popperInstance:null,props:c,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:y,clearDelayTimeouts:function(){clearTimeout(r),clearTimeout(i),cancelAnimationFrame(o)},setProps:function(t){if(!b.state.isDestroyed){D("onBeforeUpdate",[b,t]),z();var n=b.props,r=eX(e,Object.assign({},n,eM(t),{ignoreAttributes:!0}));b.props=r,W(),n.interactiveDebounce!==r.interactiveDebounce&&(N(),h=eC(K,r.interactiveDebounce)),n.triggerTarget&&!r.triggerTarget?eS(n.triggerTarget).forEach(function(e){e.removeAttribute("aria-expanded")}):r.triggerTarget&&e.removeAttribute("aria-expanded"),R(),L(),O&&O(n,r),b.popperInstance&&(Y(),J().forEach(function(e){requestAnimationFrame(e._tippy.popperInstance.forceUpdate)})),D("onAfterUpdate",[b,t])}},setContent:function(e){b.setProps({content:e})},show:function(){var t=b.state.isVisible,n=b.state.isDestroyed,r=!b.state.isEnabled,i=eq.isTouch&&!b.props.touch,o=eT(b.props.duration,0,eK.duration);if(!(t||n||r||i||(u||e).hasAttribute("disabled"))&&(D("onShow",[b],!1),!1!==b.props.onShow(b))){if(b.state.isVisible=!0,k()&&(w.style.visibility="visible"),L(),I(),b.state.isMounted||(w.style.transition="none"),k()){var a,s,c,d=eQ(w);eH([d.box,d.content],0)}l=function(){var e;if(b.state.isVisible&&!m){if(m=!0,w.offsetHeight,w.style.transition=b.props.moveTransition,k()&&b.props.animation){var t=eQ(w),n=t.box,r=t.content;eH([n,r],o),eP([n,r],"visible")}M(),R(),eL(e2,b),null==(e=b.popperInstance)||e.forceUpdate(),D("onMount",[b]),b.props.animation&&k()&&$(o,function(){b.state.isShown=!0,D("onShown",[b])})}},s=b.props.appendTo,c=u||e,(a=b.props.interactive&&s===eE||"parent"===s?c.parentNode:ek(s,[c])).contains(w)||a.appendChild(w),b.state.isMounted=!0,Y()}},hide:function(){var e=!b.state.isVisible,t=b.state.isDestroyed,n=!b.state.isEnabled,r=eT(b.props.duration,1,eK.duration);if(!e&&!t&&!n&&(D("onHide",[b],!1),!1!==b.props.onHide(b))){if(b.state.isVisible=!1,b.state.isShown=!1,m=!1,d=!1,k()&&(w.style.visibility="hidden"),N(),q(),L(!0),k()){var i,o=eQ(w),a=o.box,s=o.content;b.props.animation&&(eH([a,s],r),eP([a,s],"hidden"))}(M(),R(),b.props.animation)?k()&&(i=b.unmount,$(r,function(){!b.state.isVisible&&w.parentNode&&w.parentNode.contains(w)&&i()})):b.unmount()}},hideWithInteractivity:function(e){C().addEventListener("mousemove",h),eL(e1,h),h(e)},enable:function(){b.state.isEnabled=!0},disable:function(){b.hide(),b.state.isEnabled=!1},unmount:function(){b.state.isVisible&&b.hide(),b.state.isMounted&&(G(),J().forEach(function(e){e._tippy.unmount()}),w.parentNode&&w.parentNode.removeChild(w),e2=e2.filter(function(e){return e!==b}),b.state.isMounted=!1,D("onHidden",[b]))},destroy:function(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),z(),delete e._tippy,b.state.isDestroyed=!0,D("onDestroy",[b]))}};if(!c.render)return b;var x=c.render(b),w=x.popper,O=x.onUpdate;w.setAttribute("data-tippy-root",""),w.id="tippy-"+b.id,b.popper=w,e._tippy=b,w._tippy=b;var j=y.map(function(e){return e.fn(b)}),E=e.hasAttribute("aria-expanded");return W(),R(),L(),D("onCreate",[b]),c.showOnCreate&&Q(),w.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),w.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&C().addEventListener("mousemove",h)}),b;function T(){var e=b.props.touch;return Array.isArray(e)?e:[e,0]}function A(){return"hold"===T()[0]}function k(){var e;return!!(null!=(e=b.props.render)&&e.$$tippy)}function C(){var t,n,r=(u||e).parentNode;return r&&null!=(n=eS(r)[0])&&null!=(t=n.ownerDocument)&&t.body?n.ownerDocument:document}function S(e){return b.state.isMounted&&!b.state.isVisible||eq.isTouch||a&&"focus"===a.type?0:eT(b.props.delay,+!e,eK.delay)}function L(e){void 0===e&&(e=!1),w.style.pointerEvents=b.props.interactive&&!e?"":"none",w.style.zIndex=""+b.props.zIndex}function D(e,t,n){if(void 0===n&&(n=!0),j.forEach(function(n){n[e]&&n[e].apply(n,t)}),n){var r;(r=b.props)[e].apply(r,t)}}function M(){var t=b.props.aria;if(t.content){var n="aria-"+t.content,r=w.id;eS(b.props.triggerTarget||e).forEach(function(e){var t=e.getAttribute(n);if(b.state.isVisible)e.setAttribute(n,t?t+" "+r:r);else{var i=t&&t.replace(r,"").trim();i?e.setAttribute(n,i):e.removeAttribute(n)}})}}function R(){!E&&b.props.aria.expanded&&eS(b.props.triggerTarget||e).forEach(function(t){b.props.interactive?t.setAttribute("aria-expanded",b.state.isVisible&&t===(u||e)?"true":"false"):t.removeAttribute("aria-expanded")})}function N(){C().removeEventListener("mousemove",h),e1=e1.filter(function(e){return e!==h})}function H(t){if(!eq.isTouch||!f&&"mousedown"!==t.type){var n=t.composedPath&&t.composedPath()[0]||t.target;if(!(b.props.interactive&&eI(w,n))){if(eS(b.props.triggerTarget||e).some(function(e){return eI(e,n)})){if(eq.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else D("onClickOutside",[b,t]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),p=!0,setTimeout(function(){p=!1}),b.state.isMounted||q())}}}function P(){f=!0}function B(){f=!1}function I(){var e=C();e.addEventListener("mousedown",H,!0),e.addEventListener("touchend",H,ej),e.addEventListener("touchstart",B,ej),e.addEventListener("touchmove",P,ej)}function q(){var e=C();e.removeEventListener("mousedown",H,!0),e.removeEventListener("touchend",H,ej),e.removeEventListener("touchstart",B,ej),e.removeEventListener("touchmove",P,ej)}function $(e,t){var n=eQ(w).box;function r(e){e.target===n&&(eB(n,"remove",r),t())}if(0===e)return t();eB(n,"remove",s),eB(n,"add",r),s=r}function V(t,n,r){void 0===r&&(r=!1),eS(b.props.triggerTarget||e).forEach(function(e){e.addEventListener(t,n,r),g.push({node:e,eventType:t,handler:n,options:r})})}function W(){A()&&(V("touchstart",U,{passive:!0}),V("touchend",_,{passive:!0})),b.props.trigger.split(/\s+/).filter(Boolean).forEach(function(e){if("manual"!==e)switch(V(e,U),e){case"mouseenter":V("mouseleave",_);break;case"focus":V(eU?"focusout":"blur",F);break;case"focusin":V("focusout",F)}})}function z(){g.forEach(function(e){var t=e.node,n=e.eventType,r=e.handler,i=e.options;t.removeEventListener(n,r,i)}),g=[]}function U(e){var t,n=!1;if(!(!b.state.isEnabled||X(e))&&!p){var r=(null==(t=a)?void 0:t.type)==="focus";a=e,u=e.currentTarget,R(),!b.state.isVisible&&eA(e,"MouseEvent")&&e1.forEach(function(t){return t(e)}),"click"===e.type&&(0>b.props.trigger.indexOf("mouseenter")||d)&&!1!==b.props.hideOnClick&&b.state.isVisible?n=!0:Q(e),"click"===e.type&&(d=!n),n&&!r&&Z(e)}}function K(t){var n,r,i,o=t.target,a=(u||e).contains(o)||w.contains(o);("mousemove"!==t.type||!a)&&(n=J().concat(w).map(function(e){var t,n=null==(t=e._tippy.popperInstance)?void 0:t.state;return n?{popperRect:e.getBoundingClientRect(),popperState:n,props:c}:null}).filter(Boolean),r=t.clientX,i=t.clientY,n.every(function(e){var t=e.popperRect,n=e.popperState,o=e.props.interactiveBorder,a=n.placement.split("-")[0],s=n.modifiersData.offset;if(!s)return!0;var l="bottom"===a?s.top.y:0,u="top"===a?s.bottom.y:0,c="right"===a?s.left.x:0,d="left"===a?s.right.x:0,p=t.top-i+l>o,f=i-t.bottom-u>o,m=t.left-r+c>o,g=r-t.right-d>o;return p||f||m||g})&&(N(),Z(t)))}function _(e){if(!(X(e)||b.props.trigger.indexOf("click")>=0&&d)){if(b.props.interactive)return void b.hideWithInteractivity(e);Z(e)}}function F(t){0>b.props.trigger.indexOf("focusin")&&t.target!==(u||e)||b.props.interactive&&t.relatedTarget&&w.contains(t.relatedTarget)||Z(t)}function X(e){return!!eq.isTouch&&A()!==e.type.indexOf("touch")>=0}function Y(){G();var t=b.props,n=t.popperOptions,r=t.placement,i=t.offset,o=t.getReferenceClientRect,a=t.moveTransition,s=k()?eQ(w).arrow:null,c=o?{getBoundingClientRect:o,contextElement:o.contextElement||u||e}:e,d=[{name:"offset",options:{offset:i}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!a}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(e){var t=e.state;if(k()){var n=eQ(w).box;["placement","reference-hidden","escaped"].forEach(function(e){"placement"===e?n.setAttribute("data-placement",t.placement):t.attributes.popper["data-popper-"+e]?n.setAttribute("data-"+e,""):n.removeAttribute("data-"+e)}),t.attributes.popper={}}}}];k()&&s&&d.push({name:"arrow",options:{element:s,padding:3}}),d.push.apply(d,(null==n?void 0:n.modifiers)||[]),b.popperInstance=eb(c,w,Object.assign({},n,{placement:r,onFirstUpdate:l,modifiers:d}))}function G(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function J(){return eD(w.querySelectorAll("[data-tippy-root]"))}function Q(e){b.clearDelayTimeouts(),e&&D("onTrigger",[b,e]),I();var t=S(!0),n=T(),i=n[0],o=n[1];eq.isTouch&&"hold"===i&&o&&(t=o),t?r=setTimeout(function(){b.show()},t):b.show()}function Z(e){if(b.clearDelayTimeouts(),D("onUntrigger",[b,e]),!b.state.isVisible)return void q();if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(e.type)>=0)||!d){var t=S(!1);t?i=setTimeout(function(){b.state.isVisible&&b.hide()},t):o=requestAnimationFrame(function(){b.hide()})}}}(t,i);return n&&e.push(n),e},[]);return eN(e)?o[0]:o}e9.defaultProps=eK,e9.setDefaultProps=function(e){Object.keys(e).forEach(function(t){eK[t]=e[t]})},e9.currentInput=eq,Object.assign({},ed,{effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow)}}),e9.setDefaultProps({render:eZ});var e6=e.i(244073);function e4(e){return e.description??e.email??""}let e3=(0,s.forwardRef)(function({items:e,command:t},n){let[r,i]=(0,s.useState)(0),o=(0,s.useRef)(null),l=(0,e6.useTranslations)("composer");(0,s.useEffect)(()=>{i(0)},[e]),(0,s.useEffect)(()=>{o.current?.querySelector('[data-selected="true"]')?.scrollIntoView({block:"nearest"})},[r]);let u=(0,s.useCallback)(n=>{let r=e[n];r&&t(r)},[e,t]);return((0,s.useImperativeHandle)(n,()=>({onKeyDown:({event:t})=>!!e.length&&("ArrowUp"===t.key?(t.preventDefault(),i(t=>(t+e.length-1)%e.length),!0):"ArrowDown"===t.key||"Tab"===t.key?(t.preventDefault(),i(t=>(t+1)%e.length),!0):"Enter"===t.key&&(t.preventDefault(),u(r),!0))}),[e,r,u]),e.length)?(0,a.jsxs)("div",{className:"suggestion-menu",children:[(0,a.jsx)("div",{className:"suggestion-header",children:l("selectOption")}),(0,a.jsx)("div",{className:"suggestion-list",ref:o,children:e.map((e,n)=>{let o=n===r;return(0,a.jsxs)("div",{className:"suggestion-item","data-selected":o?"true":"false",onMouseEnter:()=>i(n),onMouseDown:n=>{n.preventDefault(),t(e)},children:[(0,a.jsx)("div",{className:"suggestion-title",children:e.label??e.name??e.title??e.id}),e4(e)?(0,a.jsx)("div",{className:"suggestion-desc",children:e4(e)}):null]},e.id)})})]}):(0,a.jsx)("div",{className:"suggestion-menu",children:(0,a.jsx)("div",{className:"suggestion-empty",children:l("noMatch")})})});e.s(["createSuggestionRenderer",0,function(){let e=null,t=null;return{onStart(n){e=new l.ReactRenderer(e3,{props:n,editor:n.editor}),n.clientRect&&(t=e9("body",{getReferenceClientRect:()=>n.clientRect?.()??new DOMRect,appendTo:()=>document.body,content:e.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(n){e?.updateProps(n),t?.[0]&&n.clientRect&&t[0].setProps({getReferenceClientRect:()=>n.clientRect?.()??new DOMRect})},onKeyDown:t=>!!e?.ref&&"object"==typeof e.ref&&"onKeyDown"in e.ref&&e.ref.onKeyDown(t),onExit(){t?.[0]?.destroy(),e?.destroy()}}}],162519)},199302,e=>{"use strict";var t=e.i(939785),n=e.i(822162),r=e.i(162519);e.s(["createSlashExtension",0,function(e=()=>[]){return t.Extension.create({name:"slashCommand",addOptions:()=>({suggestion:{char:"/",items:({query:t})=>{var n;let r,i;return n=e(),r=t.toLowerCase(),i=new Set,n.map(e=>e.trim()).filter(e=>!(!e||i.has(e))&&(i.add(e),e.toLowerCase().includes(r))).map(e=>({id:e,title:e,description:"skill"}))},command:({editor:e,range:t,props:n})=>{e.chain().focus().deleteRange(t).insertContent(`[use skill: ${n.id}]`).run()},render:()=>(0,r.createSuggestionRenderer)()}}),addProseMirrorPlugins(){return[(0,n.default)({editor:this.editor,...this.options.suggestion})]}})}])},230698,929709,e=>{"use strict";var t=e.i(344180),n=e.i(764556),r=e.i(209988),i=e.i(260218);let o=(0,e.i(433721).default)("user-plus",[["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:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);e.s(["UserPlus",0,o],929709);var a=e.i(595390);e.s(["AddMemberDialog",0,function({open:e,onOpenChange:s,candidates:l,defaultSelected:u,onAdd:c,filter:d}){let[p,f]=(0,n.useState)([]),[m,g]=(0,n.useState)(0),[h,v]=(0,n.useState)(!1);e&&!h&&(f(u??[]),v(!0));let y=e=>{e||(f([]),v(!1),g(e=>e+1)),s(e)};return(0,t.jsx)(r.Dialog,{open:e,onOpenChange:y,children:(0,t.jsxs)(r.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsxs)(r.DialogHeader,{children:[(0,t.jsx)(r.DialogTitle,{children:"管理成员"}),(0,t.jsx)(r.DialogDescription,{children:"选择或取消选择频道成员"})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,t.jsx)(a.MemberPicker,{candidates:l,filter:d,selected:p,onToggle:e=>{f(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},searchPlaceholder:"搜索成员...",emptyText:"无可用成员"},m),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(i.Button,{variant:"outline",onClick:()=>y(!1),children:"取消"}),(0,t.jsxs)(i.Button,{onClick:()=>{0!==p.length&&(c(p),y(!1))},disabled:0===p.length,children:[(0,t.jsx)(o,{className:"size-3.5 mr-1"}),"确认 (",p.length,")"]})]})]})]})})}],230698)},529658,e=>{"use strict";let t=(0,e.i(433721).default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);e.s(["Users",0,t],529658)},636288,e=>{"use strict";var t=e.i(344180);e.s([],594533),e.i(594533),e.i(8890);var n=e.i(764556),r=e.i(969490),i=e.i(267805);let o=n.createContext(void 0);function a(){let e=n.useContext(o);if(void 0===e)throw Error((0,i.default)(13));return e}let s={imageLoadingStatus:()=>null},l=n.forwardRef(function(e,i){let{className:a,render:l,style:u,...c}=e,[d,p]=n.useState("idle"),f=n.useMemo(()=>({imageLoadingStatus:d,setImageLoadingStatus:p}),[d,p]),m=(0,r.useRenderElement)("span",e,{state:{imageLoadingStatus:d},ref:i,props:c,stateAttributesMapping:s});return(0,t.jsx)(o.Provider,{value:f,children:m})});var u=e.i(29905),c=e.i(277642),d=e.i(273598),p=e.i(282458),f=e.i(254891),m=e.i(863728);let g={...s,...p.transitionStatusMapping},h=n.forwardRef(function(e,t){let{className:i,render:o,onLoadingStatusChange:s,referrerPolicy:l,crossOrigin:p,style:h,...v}=e,y=a(),b=function(e,{referrerPolicy:t,crossOrigin:r}){let[i,o]=n.useState("idle");return(0,c.useIsoLayoutEffect)(()=>{if(!e)return o("error"),m.NOOP;let n=!0,i=new window.Image,a=e=>()=>{n&&o(e)};return o("loading"),i.onload=a("loaded"),i.onerror=a("error"),t&&(i.referrerPolicy=t),i.crossOrigin=r??null,i.src=e,i.complete&&o(i.naturalWidth>0?"loaded":"error"),()=>{n=!1}},[e,r,t]),i}(e.src,{referrerPolicy:l,crossOrigin:p}),x="loaded"===b,{mounted:w,transitionStatus:O,setMounted:j}=(0,f.useTransitionStatus)(x),E=n.useRef(null),T=(0,u.useStableCallback)(e=>{s?.(e),y.setImageLoadingStatus(e)});(0,c.useIsoLayoutEffect)(()=>{"idle"!==b&&T(b)},[b,T]),(0,d.useOpenChangeComplete)({open:x,ref:E,onComplete(){x||j(!1)}});let A=(0,r.useRenderElement)("img",e,{state:{imageLoadingStatus:b,transitionStatus:O},ref:[t,E],props:v,stateAttributesMapping:g,enabled:w});return w?A:null});var v=e.i(232449);let y=n.forwardRef(function(e,t){let{className:i,render:o,delay:l,style:u,...c}=e,{imageLoadingStatus:d}=a(),[p,f]=n.useState(void 0===l),m=(0,v.useTimeout)();return n.useEffect(()=>(void 0!==l&&m.start(l,()=>f(!0)),m.clear),[m,l]),(0,r.useRenderElement)("span",e,{state:{imageLoadingStatus:d},ref:t,props:c,stateAttributesMapping:s,enabled:"loaded"!==d&&p})});e.s(["Fallback",0,y,"Image",0,h,"Root",0,l],505621),e.i(505621);var b=e.i(465458);e.s(["AvatarGroup",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"avatar-group",className:(0,b.cn)("group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",e),...n})},"AvatarGroupCount",0,function({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"avatar-group-count",className:(0,b.cn)("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",e),...n})}],636288)}]);
|