@agent-spaces/server 0.3.64 → 0.3.65
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/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/git.js +13 -6
- package/dist/agents/agent-message-parts.js +1 -1
- package/dist/agents/commit-agent.js +4 -2
- package/dist/agents/issue-task-controller.js +6 -2
- package/dist/app.js +6 -68
- package/dist/routes/agent-sse.js +1 -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/robot-account.js +68 -0
- package/dist/services/agent.js +36 -2
- 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-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/workspace.js +2 -0
- package/dist/storage/robot-account-store.js +39 -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/{04a4vsq2wknm4.js → 0-a.-hl3wv99k.js} +1 -1
- package/dist/web/_next/static/chunks/{0ctg5qmw7uu.1.js → 0-pi.67w.ymsr.js} +3 -3
- package/dist/web/_next/static/chunks/0-v_p6j5u3_9l.js +1 -0
- package/dist/web/_next/static/chunks/0.-x29t-8gk0r.js +1 -0
- package/dist/web/_next/static/chunks/0.6b64sy0g5.3.js +3 -0
- package/dist/web/_next/static/chunks/0.l5e8~r7_0~p.js +1 -0
- package/dist/web/_next/static/chunks/00-syqzi-6zxr.js +1 -0
- package/dist/web/_next/static/chunks/02802taez976w.js +67 -0
- package/dist/web/_next/static/chunks/02j4sr9psucf-.js +1 -0
- package/dist/web/_next/static/chunks/033.awk90g6eh.js +1 -0
- package/dist/web/_next/static/chunks/06.kdsa9rr2h1.js +1 -0
- package/dist/web/_next/static/chunks/06si8l0doqe8p.js +1 -0
- package/dist/web/_next/static/chunks/08ugbvzr20drp.js +2 -0
- package/dist/web/_next/static/chunks/{0n6_4so_afuwk.js → 08x85faoz58i7.js} +2 -2
- package/dist/web/_next/static/chunks/{0v3a_x4vt42kx.js → 0_cqojbge48kq.js} +1 -1
- package/dist/web/_next/static/chunks/{0a5y-vhf4i5id.js → 0d6~~lv0-6kex.js} +1 -1
- package/dist/web/_next/static/chunks/{0vbqaynjq8ga..js → 0db14450oqzhg.js} +1 -1
- package/dist/web/_next/static/chunks/0gdwop9cnpmtu.js +1 -0
- package/dist/web/_next/static/chunks/0j-l7l_k9jt45.js +1 -0
- package/dist/web/_next/static/chunks/0kbvoxla7f751.js +1 -0
- package/dist/web/_next/static/chunks/{1442stwa0gbxe.js → 0l2w0qz1ea7ql.js} +2 -2
- package/dist/web/_next/static/chunks/0p3h-h3zj5ujg.js +30 -0
- package/dist/web/_next/static/chunks/0paaat8y96ayc.js +7 -0
- package/dist/web/_next/static/chunks/0pm-un~-sy3rl.js +1 -0
- package/dist/web/_next/static/chunks/0pq318f8xgafg.js +1 -0
- package/dist/web/_next/static/chunks/0t6s8of0qr6nc.js +1 -0
- package/dist/web/_next/static/chunks/0u6h-hqc_i52e.js +1 -0
- package/dist/web/_next/static/chunks/0uxzi~9b~k4mn.js +31 -0
- package/dist/web/_next/static/chunks/{08ckpwmmwlors.js → 0vis~lx0nxgn-.js} +2 -2
- package/dist/web/_next/static/chunks/{10l-9myrdo3x9.js → 0w7.tb29958zj.js} +1 -1
- package/dist/web/_next/static/chunks/0yd.m1afqg.2t.js +3 -0
- package/dist/web/_next/static/chunks/0yhbr8hl09b-5.js +1 -0
- package/dist/web/_next/static/chunks/0zncg76rgtbm-.js +1 -0
- package/dist/web/_next/static/chunks/0~~_ltu6dx_ch.js +1 -0
- package/dist/web/_next/static/chunks/{0iuf30t0rjsjv.js → 11cchuwoupmbf.js} +1 -1
- package/dist/web/_next/static/chunks/12oxcgyhpaxw~.js +1 -0
- package/dist/web/_next/static/chunks/1452eibz62gs6.css +1 -0
- package/dist/web/_next/static/chunks/16zlreiems5cn.js +1 -0
- package/dist/web/_next/static/chunks/18awqjk9-o5m0.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-runner.js +82 -6
- package/package.json +10 -11
- package/dist/web/_next/static/chunks/0-9194nbxy_6d.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/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/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/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/0ppr271hz0xoq.js +0 -1
- 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/0v7q4mys.mnm..css +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 → x4-CsKe6qUQyFDWVtfvUg}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → x4-CsKe6qUQyFDWVtfvUg}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → x4-CsKe6qUQyFDWVtfvUg}/_ssgManifest.js +0 -0
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,481258,(e,t,r)=>{"use strict";r._=function(e){return e&&e.__esModule?e:{default:e}}},64791,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={bindSnapshot:function(){return c},createAsyncLocalStorage:function(){return a},createSnapshot:function(){return l}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class u{disable(){throw i}getStore(){}run(){throw i}exit(){throw i}enterWith(){throw i}static bind(e){return e}}let s="u">typeof globalThis&&globalThis.AsyncLocalStorage;function a(){return s?new s:new u}function c(e){return s?s.bind(e):u.bind(e)}function l(){return s?s.snapshot():function(e,...t){return e(...t)}}},12267,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,e.r(64791).createAsyncLocalStorage)()},94932,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorage",{enumerable:!0,get:function(){return n.workAsyncStorageInstance}});let n=e.r(12267)},981225,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={BailoutToCSRError:function(){return u},isBailoutToCSRError:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let i="BAILOUT_TO_CLIENT_SIDE_RENDERING";class u extends Error{constructor(e){super(`Bail out to client-side rendering: ${e}`),this.reason=e,this.digest=i}}function s(e){return"object"==typeof e&&null!==e&&"digest"in e&&e.digest===i}},136203,(e,t,r)=>{"use strict";var n=Symbol.for("react.transitional.element");function o(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in r={},t)"key"!==i&&(r[i]=t[i]);else r=t;return{$$typeof:n,type:e,key:o,ref:void 0!==(t=r.ref)?t:null,props:r}}r.Fragment=Symbol.for("react.fragment"),r.jsx=o,r.jsxs=o},344180,(e,t,r)=>{"use strict";t.exports=e.r(136203)},893300,(e,t,r)=>{var n={229:function(e){var t,r,n,o=e.exports={};function i(){throw Error("setTimeout has not been defined")}function u(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(e){r=u}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}var a=[],c=!1,l=-1;function f(){c&&n&&(c=!1,n.length?a=n.concat(a):l=-1,a.length&&d())}function d(){if(!c){var e=s(f);c=!0;for(var t=a.length;t;){for(n=a,a=[];++l<t;)n&&n[l].run();l=-1,t=a.length}n=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function y(){}o.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];a.push(new p(e,t)),1!==a.length||c||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(e){return[]},o.binding=function(e){throw Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw Error("process.chdir is not supported")},o.umask=function(){return 0}}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}},u=!0;try{n[e](r,r.exports,i),u=!1}finally{u&&delete o[e]}return r.exports}i.ab="/ROOT/node_modules/.pnpm/next@16.2.4_@babel+core@7.29.0_react-dom@19.2.4_react@19.2.4__react@19.2.4/node_modules/next/dist/compiled/process/",t.exports=i(229)},8890,(e,t,r)=>{"use strict";var n,o;t.exports=(null==(n=e.g.process)?void 0:n.env)&&"object"==typeof(null==(o=e.g.process)?void 0:o.env)?e.g.process:e.r(893300)},627685,(e,t,r)=>{"use strict";var n=e.i(8890),o=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),l=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),h=Symbol.iterator,v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,m={};function x(e,t,r){this.props=e,this.context=t,this.refs=m,this.updater=r||v}function S(){}function O(e,t,r){this.props=e,this.context=t,this.refs=m,this.updater=r||v}x.prototype.isReactComponent={},x.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},x.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=x.prototype;var j=O.prototype=new S;j.constructor=O,_(j,x.prototype),j.isPureReactComponent=!0;var E=Array.isArray;function T(){}var w={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function C(e,t,r){var n=r.ref;return{$$typeof:o,type:e,key:t,ref:void 0!==n?n:null,props:r}}function P(e){return"object"==typeof e&&null!==e&&e.$$typeof===o}var k=/\/+/g;function A(e,t){var r,n;return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36)}function H(e,t,r){if(null==e)return e;var n=[],u=0;return!function e(t,r,n,u,s){var a,c,l,f=typeof t;("undefined"===f||"boolean"===f)&&(t=null);var d=!1;if(null===t)d=!0;else switch(f){case"bigint":case"string":case"number":d=!0;break;case"object":switch(t.$$typeof){case o:case i:d=!0;break;case y:return e((d=t._init)(t._payload),r,n,u,s)}}if(d)return s=s(t),d=""===u?"."+A(t,0):u,E(s)?(n="",null!=d&&(n=d.replace(k,"$&/")+"/"),e(s,r,n,"",function(e){return e})):null!=s&&(P(s)&&(a=s,c=n+(null==s.key||t&&t.key===s.key?"":(""+s.key).replace(k,"$&/")+"/")+d,s=C(a.type,c,a.props)),r.push(s)),1;d=0;var p=""===u?".":u+":";if(E(t))for(var g=0;g<t.length;g++)f=p+A(u=t[g],g),d+=e(u,r,n,f,s);else if("function"==typeof(g=null===(l=t)||"object"!=typeof l?null:"function"==typeof(l=h&&l[h]||l["@@iterator"])?l:null))for(t=g.call(t),g=0;!(u=t.next()).done;)f=p+A(u=u.value,g++),d+=e(u,r,n,f,s);else if("object"===f){if("function"==typeof t.then)return e(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(T,T):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(t),r,n,u,s);throw Error("Objects are not valid as a React child (found: "+("[object Object]"===(r=String(t))?"object with keys {"+Object.keys(t).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.")}return d}(e,n,"","",function(e){return t.call(r,e,u++)}),n}function M(e){if(-1===e._status){var t=(0,e._result)();t.then(function(r){(0===e._status||-1===e._status)&&(e._status=1,e._result=r,void 0===t.status&&(t.status="fulfilled",t.value=r))},function(r){(0===e._status||-1===e._status)&&(e._status=2,e._result=r,void 0===t.status&&(t.status="rejected",t.reason=r))}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var I="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof n.default&&"function"==typeof n.default.emit)return void n.default.emit("uncaughtException",e);console.error(e)};function L(e){var t=w.T,r={};r.types=null!==t?t.types:null,w.T=r;try{var n=e(),o=w.S;null!==o&&o(r,n),"object"==typeof n&&null!==n&&"function"==typeof n.then&&n.then(T,I)}catch(e){I(e)}finally{null!==t&&null!==r.types&&(t.types=r.types),w.T=t}}function N(e){var t=w.T;if(null!==t){var r=t.types;null===r?t.types=[e]:-1===r.indexOf(e)&&r.push(e)}else L(N.bind(null,e))}r.Activity=g,r.Children={map:H,forEach:function(e,t,r){H(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return H(e,function(){t++}),t},toArray:function(e){return H(e,function(e){return e})||[]},only:function(e){if(!P(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},r.Component=x,r.Fragment=u,r.Profiler=a,r.PureComponent=O,r.StrictMode=s,r.Suspense=d,r.ViewTransition=b,r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,r.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},r.addTransitionType=N,r.cache=function(e){return function(){return e.apply(null,arguments)}},r.cacheSignal=function(){return null},r.cloneElement=function(e,t,r){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var n=_({},e.props),o=e.key;if(null!=t)for(i in void 0!==t.key&&(o=""+t.key),t)R.call(t,i)&&"key"!==i&&"__self"!==i&&"__source"!==i&&("ref"!==i||void 0!==t.ref)&&(n[i]=t[i]);var i=arguments.length-2;if(1===i)n.children=r;else if(1<i){for(var u=Array(i),s=0;s<i;s++)u[s]=arguments[s+2];n.children=u}return C(e.type,o,n)},r.createContext=function(e){return(e={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:c,_context:e},e},r.createElement=function(e,t,r){var n,o={},i=null;if(null!=t)for(n in void 0!==t.key&&(i=""+t.key),t)R.call(t,n)&&"key"!==n&&"__self"!==n&&"__source"!==n&&(o[n]=t[n]);var u=arguments.length-2;if(1===u)o.children=r;else if(1<u){for(var s=Array(u),a=0;a<u;a++)s[a]=arguments[a+2];o.children=s}if(e&&e.defaultProps)for(n in u=e.defaultProps)void 0===o[n]&&(o[n]=u[n]);return C(e,i,o)},r.createRef=function(){return{current:null}},r.forwardRef=function(e){return{$$typeof:f,render:e}},r.isValidElement=P,r.lazy=function(e){return{$$typeof:y,_payload:{_status:-1,_result:e},_init:M}},r.memo=function(e,t){return{$$typeof:p,type:e,compare:void 0===t?null:t}},r.startTransition=L,r.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},r.use=function(e){return w.H.use(e)},r.useActionState=function(e,t,r){return w.H.useActionState(e,t,r)},r.useCallback=function(e,t){return w.H.useCallback(e,t)},r.useContext=function(e){return w.H.useContext(e)},r.useDebugValue=function(){},r.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},r.useEffect=function(e,t){return w.H.useEffect(e,t)},r.useEffectEvent=function(e){return w.H.useEffectEvent(e)},r.useId=function(){return w.H.useId()},r.useImperativeHandle=function(e,t,r){return w.H.useImperativeHandle(e,t,r)},r.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},r.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},r.useMemo=function(e,t){return w.H.useMemo(e,t)},r.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},r.useReducer=function(e,t,r){return w.H.useReducer(e,t,r)},r.useRef=function(e){return w.H.useRef(e)},r.useState=function(e){return w.H.useState(e)},r.useSyncExternalStore=function(e,t,r){return w.H.useSyncExternalStore(e,t,r)},r.useTransition=function(){return w.H.useTransition()},r.version="19.3.0-canary-3f0b9e61-20260317"},764556,(e,t,r)=>{"use strict";t.exports=e.r(627685)},251007,(e,t,r)=>{"use strict";var n=e.r(764556);function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var u={d:{f:i,r:function(){throw Error(o(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},s=Symbol.for("react.portal"),a=Symbol.for("react.optimistic_key"),c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){return"font"===e?"":"string"==typeof t?"use-credentials"===t?t:"":void 0}r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,r.createPortal=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType)throw Error(o(299));return function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:s,key:null==n?null:n===a?a:""+n,children:e,containerInfo:t,implementation:r}}(e,t,null,r)},r.flushSync=function(e){var t=c.T,r=u.p;try{if(c.T=null,u.p=2,e)return e()}finally{c.T=t,u.p=r,u.d.f()}},r.preconnect=function(e,t){"string"==typeof e&&(t=t?"string"==typeof(t=t.crossOrigin)?"use-credentials"===t?t:"":void 0:null,u.d.C(e,t))},r.prefetchDNS=function(e){"string"==typeof e&&u.d.D(e)},r.preinit=function(e,t){if("string"==typeof e&&t&&"string"==typeof t.as){var r=t.as,n=l(r,t.crossOrigin),o="string"==typeof t.integrity?t.integrity:void 0,i="string"==typeof t.fetchPriority?t.fetchPriority:void 0;"style"===r?u.d.S(e,"string"==typeof t.precedence?t.precedence:void 0,{crossOrigin:n,integrity:o,fetchPriority:i}):"script"===r&&u.d.X(e,{crossOrigin:n,integrity:o,fetchPriority:i,nonce:"string"==typeof t.nonce?t.nonce:void 0})}},r.preinitModule=function(e,t){if("string"==typeof e)if("object"==typeof t&&null!==t){if(null==t.as||"script"===t.as){var r=l(t.as,t.crossOrigin);u.d.M(e,{crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0})}}else null==t&&u.d.M(e)},r.preload=function(e,t){if("string"==typeof e&&"object"==typeof t&&null!==t&&"string"==typeof t.as){var r=t.as,n=l(r,t.crossOrigin);u.d.L(e,r,{crossOrigin:n,integrity:"string"==typeof t.integrity?t.integrity:void 0,nonce:"string"==typeof t.nonce?t.nonce:void 0,type:"string"==typeof t.type?t.type:void 0,fetchPriority:"string"==typeof t.fetchPriority?t.fetchPriority:void 0,referrerPolicy:"string"==typeof t.referrerPolicy?t.referrerPolicy:void 0,imageSrcSet:"string"==typeof t.imageSrcSet?t.imageSrcSet:void 0,imageSizes:"string"==typeof t.imageSizes?t.imageSizes:void 0,media:"string"==typeof t.media?t.media:void 0})}},r.preloadModule=function(e,t){if("string"==typeof e)if(t){var r=l(t.as,t.crossOrigin);u.d.m(e,{as:"string"==typeof t.as&&"script"!==t.as?t.as:void 0,crossOrigin:r,integrity:"string"==typeof t.integrity?t.integrity:void 0})}else u.d.m(e)},r.requestFormReset=function(e){u.d.r(e)},r.unstable_batchedUpdates=function(e,t){return e(t)},r.useFormState=function(e,t,r){return c.H.useFormState(e,t,r)},r.useFormStatus=function(){return c.H.useHostTransitionStatus()},r.version="19.3.0-canary-3f0b9e61-20260317"},106206,(e,t,r)=>{"use strict";!function e(){if("u">typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),t.exports=e.r(251007)},744066,(e,t,r)=>{"use strict";function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(n=function(e){return e?r:t})(e)}r._=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=n(t);if(r&&r.has(e))return r.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var s=i?Object.getOwnPropertyDescriptor(e,u):null;s&&(s.get||s.set)?Object.defineProperty(o,u,s):o[u]=e[u]}return o.default=e,r&&r.set(e,o),o}},745137,(e,t,r)=>{"use strict";let n;Object.defineProperty(r,"__esModule",{value:!0});var o={getAssetToken:function(){return a},getAssetTokenQuery:function(){return c},getDeploymentId:function(){return u},getDeploymentIdQuery:function(){return s}};for(var i in o)Object.defineProperty(r,i,{enumerable:!0,get:o[i]});function u(){return n}function s(e=!1){let t=n;return t?`${e?"&":"?"}dpl=${t}`:""}function a(){return!1}function c(e=!1){return""}"u">typeof window?(n=document.documentElement.dataset.dplId,delete document.documentElement.dataset.dplId):n=void 0},549424,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"handleISRError",{enumerable:!0,get:function(){return o}});let n="u"<typeof window?e.r(94932).workAsyncStorage:void 0;function o({error:e}){if(n){let t=n.getStore();if(t?.isStaticGeneration)throw e&&console.error(e),e}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},57426,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"HeadManagerContext",{enumerable:!0,get:function(){return n}});let n=e.r(481258)._(e.r(764556)).default.createContext({})},801149,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={WarningIcon:function(){return a},errorStyles:function(){return u},errorThemeCss:function(){return s}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});e.r(481258);let i=e.r(344180);e.r(764556);let u={container:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},card:{marginTop:"-32px",maxWidth:"325px",padding:"32px 28px",textAlign:"left"},icon:{marginBottom:"24px"},title:{fontSize:"24px",fontWeight:500,letterSpacing:"-0.02em",lineHeight:"32px",margin:"0 0 12px 0",color:"var(--next-error-title)"},message:{fontSize:"14px",fontWeight:400,lineHeight:"21px",margin:"0 0 20px 0",color:"var(--next-error-message)"},form:{margin:0},buttonGroup:{display:"flex",gap:"8px",alignItems:"center"},button:{display:"inline-flex",alignItems:"center",justifyContent:"center",height:"32px",padding:"0 12px",fontSize:"14px",fontWeight:500,lineHeight:"20px",borderRadius:"6px",cursor:"pointer",color:"var(--next-error-btn-text)",background:"var(--next-error-btn-bg)",border:"var(--next-error-btn-border)"},buttonSecondary:{display:"inline-flex",alignItems:"center",justifyContent:"center",height:"32px",padding:"0 12px",fontSize:"14px",fontWeight:500,lineHeight:"20px",borderRadius:"6px",cursor:"pointer",color:"var(--next-error-btn-secondary-text)",background:"var(--next-error-btn-secondary-bg)",border:"var(--next-error-btn-secondary-border)"},digestFooter:{position:"fixed",bottom:"32px",left:"0",right:"0",textAlign:"center",fontFamily:'ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace',fontSize:"12px",lineHeight:"18px",fontWeight:400,margin:"0",color:"var(--next-error-digest)"}},s=`
|
|
2
|
-
:root {
|
|
3
|
-
--next-error-bg: #fff;
|
|
4
|
-
--next-error-text: #171717;
|
|
5
|
-
--next-error-title: #171717;
|
|
6
|
-
--next-error-message: #171717;
|
|
7
|
-
--next-error-digest: #666666;
|
|
8
|
-
--next-error-btn-text: #fff;
|
|
9
|
-
--next-error-btn-bg: #171717;
|
|
10
|
-
--next-error-btn-border: none;
|
|
11
|
-
--next-error-btn-secondary-text: #171717;
|
|
12
|
-
--next-error-btn-secondary-bg: transparent;
|
|
13
|
-
--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);
|
|
14
|
-
}
|
|
15
|
-
@media (prefers-color-scheme: dark) {
|
|
16
|
-
:root {
|
|
17
|
-
--next-error-bg: #0a0a0a;
|
|
18
|
-
--next-error-text: #ededed;
|
|
19
|
-
--next-error-title: #ededed;
|
|
20
|
-
--next-error-message: #ededed;
|
|
21
|
-
--next-error-digest: #a0a0a0;
|
|
22
|
-
--next-error-btn-text: #0a0a0a;
|
|
23
|
-
--next-error-btn-bg: #ededed;
|
|
24
|
-
--next-error-btn-border: none;
|
|
25
|
-
--next-error-btn-secondary-text: #ededed;
|
|
26
|
-
--next-error-btn-secondary-bg: transparent;
|
|
27
|
-
--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }
|
|
31
|
-
`.replace(/\n\s*/g,"");function a(){return(0,i.jsx)("svg",{width:"32",height:"32",viewBox:"-0.2 -1.5 32 32",fill:"none",style:u.icon,children:(0,i.jsx)("path",{d:"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z",fill:"var(--next-error-title)"})})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},785502,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return u}}),e.r(481258);let n=e.r(344180);e.r(764556);let o=e.r(549424),i=e.r(801149),u=function({error:e}){let t=e?.digest,r=!!t;return(0,o.handleISRError)({error:e}),(0,n.jsxs)("html",{id:"__next_error__",children:[(0,n.jsx)("head",{children:(0,n.jsx)("style",{dangerouslySetInnerHTML:{__html:i.errorThemeCss}})}),(0,n.jsxs)("body",{children:[(0,n.jsx)("div",{style:i.errorStyles.container,children:(0,n.jsxs)("div",{style:i.errorStyles.card,children:[(0,n.jsx)(i.WarningIcon,{}),(0,n.jsx)("h1",{style:i.errorStyles.title,children:"This page couldn’t load"}),(0,n.jsx)("p",{style:i.errorStyles.message,children:r?"A server error occurred. Reload to try again.":"Reload to try again, or go back."}),(0,n.jsxs)("div",{style:i.errorStyles.buttonGroup,children:[(0,n.jsx)("form",{style:i.errorStyles.form,children:(0,n.jsx)("button",{type:"submit",style:i.errorStyles.button,children:"Reload"})}),!r&&(0,n.jsx)("button",{type:"button",style:i.errorStyles.buttonSecondary,onClick:()=>{window.history.length>1?window.history.back():window.location.href="/"},children:"Back"})]})]})}),t&&(0,n.jsxs)("p",{style:i.errorStyles.digestFooter,children:["ERROR ",t]})]})]})};("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)}]);
|
|
@@ -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")})]})]})})]})})}])}]);
|