@agent-spaces/server 0.3.64 → 0.3.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/agent-runtime.js +4 -0
- package/dist/adapters/claude-code-runtime/index.js +68 -2
- package/dist/adapters/claude-code-runtime/message-format.js +26 -0
- package/dist/adapters/claude-code-runtime/sdk-config.js +12 -0
- package/dist/adapters/codex-function-tool-bridge.js +144 -0
- package/dist/adapters/codex-runtime.js +23 -4
- package/dist/adapters/git.js +25 -7
- package/dist/adapters/hermes-runtime.js +210 -0
- package/dist/agents/agent-message-parts.js +1 -1
- package/dist/agents/commit-agent.js +4 -2
- package/dist/agents/issue-task-controller.js +75 -4
- package/dist/agents/pull-request-agent.js +115 -0
- package/dist/agents/scheduler-agent.js +1 -1
- package/dist/app.js +12 -70
- package/dist/middleware/auth.js +1 -1
- package/dist/package.json +2 -1
- package/dist/routes/agent-sse.js +2 -0
- package/dist/routes/agent.js +3 -0
- package/dist/routes/database.js +1 -0
- package/dist/routes/git.js +197 -317
- package/dist/routes/issue.js +1 -1
- package/dist/routes/notification.js +10 -0
- package/dist/routes/robot-account.js +68 -0
- package/dist/routes/version.js +94 -0
- package/dist/routes/worktree.js +93 -0
- package/dist/services/agent.js +37 -3
- package/dist/services/builtin-tools/kanban-tools.js +4 -0
- package/dist/services/git-operation-log.js +40 -0
- package/dist/services/global-wechat-qr.js +72 -0
- package/dist/services/hook-engine.js +175 -17
- package/dist/services/notification-center.js +9 -0
- package/dist/services/notification-hub/bot-agent.js +3 -1
- package/dist/services/notification-hub/service.js +12 -2
- package/dist/services/robot-account.js +34 -0
- package/dist/services/version.js +59 -0
- package/dist/services/workflow-command-runner.js +23 -0
- package/dist/services/workflow.js +25 -8
- package/dist/services/workspace.js +25 -1
- package/dist/services/worktree.js +207 -0
- package/dist/storage/robot-account-store.js +39 -0
- package/dist/storage/worktree-store.js +33 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +23 -25
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +13 -13
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/{0n6_4so_afuwk.js → 0-92u-tiuy40a.js} +4 -4
- package/dist/web/_next/static/chunks/{0vbqaynjq8ga..js → 0-yizd8osmas2.js} +1 -1
- package/dist/web/_next/static/chunks/0.ln~3mnv8.69.js +1 -0
- package/dist/web/_next/static/chunks/{0iuf30t0rjsjv.js → 01y3e9pemva7b.js} +10 -10
- package/dist/web/_next/static/chunks/02802taez976w.js +67 -0
- package/dist/web/_next/static/chunks/02l~tmzrgny.~.js +1 -0
- package/dist/web/_next/static/chunks/033.awk90g6eh.js +1 -0
- package/dist/web/_next/static/chunks/03f1bwuynjdmk.js +1 -0
- package/dist/web/_next/static/chunks/04cb4kc9r2pd1.js +1 -0
- package/dist/web/_next/static/chunks/04de6ha5_e3pp.js +1 -0
- package/dist/web/_next/static/chunks/06.kdsa9rr2h1.js +1 -0
- package/dist/web/_next/static/chunks/09he0p79ov1rn.js +1 -0
- package/dist/web/_next/static/chunks/09vpocs4zuc8h.js +1 -0
- package/dist/web/_next/static/chunks/0_o2exgr0e_nh.js +1 -0
- package/dist/web/_next/static/chunks/{0xbaakj0dfc0..js → 0_y9nskc-xt2k.js} +1 -1
- package/dist/web/_next/static/chunks/0clnj-1fi6u8j.js +3 -0
- package/dist/web/_next/static/chunks/0gv40by0zzxs_.js +1 -0
- package/dist/web/_next/static/chunks/0iusr8y88.kjg.js +1 -0
- package/dist/web/_next/static/chunks/{04a4vsq2wknm4.js → 0j-8418fxvkd1.js} +1 -1
- package/dist/web/_next/static/chunks/0j-l7l_k9jt45.js +1 -0
- package/dist/web/_next/static/chunks/0j.wxxyoclma5.js +1 -0
- package/dist/web/_next/static/chunks/0jq.16sozqik..js +3 -0
- package/dist/web/_next/static/chunks/0jw8xdk_fpnp0.css +1 -0
- package/dist/web/_next/static/chunks/0l1lkd-wcotma.js +1 -0
- package/dist/web/_next/static/chunks/0ncxf_zr4n839.js +1 -0
- package/dist/web/_next/static/chunks/0ndo7um~v7vco.js +1 -0
- package/dist/web/_next/static/chunks/0ngk.~kan8wq_.js +1 -0
- package/dist/web/_next/static/chunks/0p3h-h3zj5ujg.js +30 -0
- package/dist/web/_next/static/chunks/0pm-un~-sy3rl.js +1 -0
- package/dist/web/_next/static/chunks/0rt9bofnn6qvn.js +1 -0
- package/dist/web/_next/static/chunks/0t64.9jd00hio.js +3 -0
- package/dist/web/_next/static/chunks/0taui9--5n6-5.js +1 -0
- package/dist/web/_next/static/chunks/0ty39169lh~z3.js +1 -0
- package/dist/web/_next/static/chunks/0uxzi~9b~k4mn.js +31 -0
- package/dist/web/_next/static/chunks/0v8nof~waedlu.js +1 -0
- package/dist/web/_next/static/chunks/{0ctg5qmw7uu.1.js → 0vcfoagnpf.aw.js} +3 -3
- package/dist/web/_next/static/chunks/{08ckpwmmwlors.js → 0wwwq.gyyz0vg.js} +3 -3
- package/dist/web/_next/static/chunks/0x5lak8yz7pm7.js +1 -0
- package/dist/web/_next/static/chunks/0xon_.4-o0_zq.js +7 -0
- package/dist/web/_next/static/chunks/0zjnrbt7inime.js +1 -0
- package/dist/web/_next/static/chunks/0zncg76rgtbm-.js +1 -0
- package/dist/web/_next/static/chunks/0zwebpitvpuv1.js +1 -0
- package/dist/web/_next/static/chunks/0~02o4g-o6n~m.js +1 -0
- package/dist/web/_next/static/chunks/{10l-9myrdo3x9.js → 0~fjezp.k4qk3.js} +1 -1
- package/dist/web/_next/static/chunks/0~sh93re1-_rp.js +1 -0
- package/dist/web/_next/static/chunks/10_niiq0k6o-p.js +5 -0
- package/dist/web/_next/static/chunks/12tjr0_2ccrtq.js +2 -0
- package/dist/web/_next/static/chunks/12x5.go_x9mfk.js +1 -0
- package/dist/web/_next/static/chunks/{1442stwa0gbxe.js → 12~5dk9i9d16t.js} +2 -2
- package/dist/web/_next/static/chunks/13iye4rv5p31b.js +1 -0
- package/dist/web/_next/static/chunks/{01~quun6sefgl.js → 13~y-b.b9rrw4.js} +1 -1
- package/dist/web/_next/static/chunks/151wzhb5q0lo5.js +1 -0
- package/dist/web/_next/static/chunks/18c7g84y01mj0.js +1 -0
- package/dist/web/_next/static/chunks/{turbopack-0ndm2zc_pdptk.js → turbopack-11qjwlynmfc-n.js} +1 -1
- package/dist/web/_not-found/__next._full.txt +30 -29
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +13 -13
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +30 -29
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +23 -25
- package/dist/web/login/__next._full.txt +28 -28
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +13 -13
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +28 -28
- package/dist/web/settings/__next._full.txt +33 -32
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +13 -13
- package/dist/web/settings/__next._tree.txt +2 -2
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +24 -24
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +13 -13
- package/dist/web/settings/agents/__next._tree.txt +2 -2
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +24 -24
- package/dist/web/settings/mcps/__next._full.txt +24 -24
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +13 -13
- package/dist/web/settings/mcps/__next._tree.txt +2 -2
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +24 -24
- package/dist/web/settings/models/__next._full.txt +24 -24
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +13 -13
- package/dist/web/settings/models/__next._tree.txt +2 -2
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +24 -24
- package/dist/web/settings/output-styles/__next._full.txt +24 -24
- package/dist/web/settings/output-styles/__next._head.txt +4 -4
- package/dist/web/settings/output-styles/__next._index.txt +13 -13
- package/dist/web/settings/output-styles/__next._tree.txt +2 -2
- package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +4 -4
- package/dist/web/settings/output-styles/__next.settings.output-styles.txt +3 -3
- package/dist/web/settings/output-styles/__next.settings.txt +5 -5
- package/dist/web/settings/output-styles.html +1 -1
- package/dist/web/settings/output-styles.txt +24 -24
- package/dist/web/settings/prompts/__next._full.txt +24 -24
- package/dist/web/settings/prompts/__next._head.txt +4 -4
- package/dist/web/settings/prompts/__next._index.txt +13 -13
- package/dist/web/settings/prompts/__next._tree.txt +2 -2
- package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
- package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
- package/dist/web/settings/prompts/__next.settings.txt +5 -5
- package/dist/web/settings/prompts.html +1 -1
- package/dist/web/settings/prompts.txt +24 -24
- package/dist/web/settings/providers/__next._full.txt +24 -24
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +13 -13
- package/dist/web/settings/providers/__next._tree.txt +2 -2
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +24 -24
- package/dist/web/settings/skills/__next._full.txt +24 -24
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +13 -13
- package/dist/web/settings/skills/__next._tree.txt +2 -2
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +24 -24
- package/dist/web/settings/tools/__next._full.txt +24 -24
- package/dist/web/settings/tools/__next._head.txt +4 -4
- package/dist/web/settings/tools/__next._index.txt +13 -13
- package/dist/web/settings/tools/__next._tree.txt +2 -2
- package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +4 -4
- package/dist/web/settings/tools/__next.settings.tools.txt +3 -3
- package/dist/web/settings/tools/__next.settings.txt +5 -5
- package/dist/web/settings/tools.html +1 -1
- package/dist/web/settings/tools.txt +24 -24
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +33 -32
- package/dist/web/workflows/__next._full.txt +31 -33
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +13 -13
- package/dist/web/workflows/__next._tree.txt +2 -2
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +31 -33
- package/dist/web/workspace/_/__next._full.txt +28 -29
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +13 -13
- package/dist/web/workspace/_/__next._tree.txt +2 -2
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +28 -29
- package/dist/web/workspaces/__next._full.txt +29 -31
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +13 -13
- package/dist/web/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +29 -31
- package/dist/ws/agent-prompt.js +32 -3
- package/dist/ws/agent-runner.js +83 -6
- package/package.json +11 -11
- package/dist/web/_next/static/chunks/0-9194nbxy_6d.js +0 -1
- package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +0 -1
- package/dist/web/_next/static/chunks/02mf61htij8g0.js +0 -31
- package/dist/web/_next/static/chunks/04dg4l4hv11q2.js +0 -3
- package/dist/web/_next/static/chunks/04fxddw-y20~-.js +0 -7
- package/dist/web/_next/static/chunks/04w7~5ooz_pwm.js +0 -1
- package/dist/web/_next/static/chunks/05oc21sj24wtq.js +0 -1
- package/dist/web/_next/static/chunks/08kfx8on9oty~.js +0 -1
- package/dist/web/_next/static/chunks/08k~meqbd8d6v.js +0 -1
- package/dist/web/_next/static/chunks/099h96wjsdb25.js +0 -2
- package/dist/web/_next/static/chunks/09h23logvq65m.js +0 -1
- package/dist/web/_next/static/chunks/0a5y-vhf4i5id.js +0 -3
- package/dist/web/_next/static/chunks/0ake2f3x2uan4.js +0 -24
- package/dist/web/_next/static/chunks/0ck8dw_9-1cdx.js +0 -1
- package/dist/web/_next/static/chunks/0ewceguykiut5.js +0 -1
- package/dist/web/_next/static/chunks/0f7cb9li~3jra.js +0 -67
- package/dist/web/_next/static/chunks/0ghs9on7wodrm.js +0 -1
- package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +0 -1
- package/dist/web/_next/static/chunks/0h9cu-k6z5o08.js +0 -1
- package/dist/web/_next/static/chunks/0jb4~3qqkw2ps.js +0 -1
- package/dist/web/_next/static/chunks/0nb8.iteznuvx.js +0 -1
- package/dist/web/_next/static/chunks/0os58q93stt7j.js +0 -3
- package/dist/web/_next/static/chunks/0s9lmk8iauou3.js +0 -1
- package/dist/web/_next/static/chunks/0sp_zbx~w0am7.js +0 -1
- package/dist/web/_next/static/chunks/0tel~zsv4z8l_.js +0 -1
- package/dist/web/_next/static/chunks/0twamv4wr_dbv.js +0 -1
- package/dist/web/_next/static/chunks/0uhol5wafdbl~.js +0 -1
- package/dist/web/_next/static/chunks/0v3a_x4vt42kx.js +0 -5
- package/dist/web/_next/static/chunks/0v7q4mys.mnm..css +0 -1
- package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +0 -1
- package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +0 -1
- package/dist/web/_next/static/chunks/0~3xm80~j9ddg.js +0 -1
- package/dist/web/_next/static/chunks/14s37n6h0_q3x.js +0 -16
- package/dist/web/_next/static/chunks/161ik5kfyuwtd.js +0 -1
- package/dist/web/_next/static/chunks/17k~zbv0_4rep.js +0 -1
- package/public/output-styles/carmack-mode.md +0 -381
- package/public/output-styles/codex-rigor-mode.md +0 -114
- package/public/output-styles/dhh-mode.md +0 -265
- package/public/output-styles/evan-you-mode.md +0 -539
- package/public/output-styles/index.json +0 -37
- package/public/output-styles/jobs-mode.md +0 -369
- package/public/output-styles/linus-mode.md +0 -135
- package/public/output-styles/uncle-bob-mode.md +0 -221
- package/public/prompt/andrej-karpathy-skills.md +0 -65
- package/public/prompt/claude-token-efficient-coding.md +0 -35
- package/public/prompt/index.json +0 -12
- package/public/skills/index.json +0 -92
- package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +0 -243
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +0 -44
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +0 -46
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +0 -124
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +0 -124
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +0 -438
- package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +0 -29
- package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +0 -40
- package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +0 -58
- package/public/skills/superpowers/brainstorming/SKILL.md +0 -164
- package/public/skills/superpowers/brainstorming/scripts/frame-template.html +0 -214
- package/public/skills/superpowers/brainstorming/scripts/helper.js +0 -88
- package/public/skills/superpowers/brainstorming/scripts/server.cjs +0 -354
- package/public/skills/superpowers/brainstorming/scripts/start-server.sh +0 -148
- package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +0 -56
- package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +0 -49
- package/public/skills/superpowers/brainstorming/visual-companion.md +0 -287
- package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +0 -182
- package/public/skills/superpowers/executing-plans/SKILL.md +0 -70
- package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +0 -251
- package/public/skills/superpowers/receiving-code-review/SKILL.md +0 -213
- package/public/skills/superpowers/requesting-code-review/SKILL.md +0 -103
- package/public/skills/superpowers/requesting-code-review/code-reviewer.md +0 -168
- package/public/skills/superpowers/subagent-driven-development/SKILL.md +0 -279
- package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +0 -25
- package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +0 -113
- package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +0 -61
- package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +0 -119
- package/public/skills/superpowers/systematic-debugging/SKILL.md +0 -296
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +0 -158
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +0 -115
- package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +0 -122
- package/public/skills/superpowers/systematic-debugging/find-polluter.sh +0 -63
- package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +0 -169
- package/public/skills/superpowers/systematic-debugging/test-academic.md +0 -14
- package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +0 -58
- package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +0 -68
- package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +0 -69
- package/public/skills/superpowers/test-driven-development/SKILL.md +0 -371
- package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +0 -299
- package/public/skills/superpowers/using-git-worktrees/SKILL.md +0 -215
- package/public/skills/superpowers/using-superpowers/SKILL.md +0 -117
- package/public/skills/superpowers/using-superpowers/references/codex-tools.md +0 -59
- package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +0 -42
- package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +0 -51
- package/public/skills/superpowers/verification-before-completion/SKILL.md +0 -139
- package/public/skills/superpowers/writing-plans/SKILL.md +0 -152
- package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +0 -49
- package/public/skills/superpowers/writing-skills/SKILL.md +0 -655
- package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +0 -1150
- package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
- package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +0 -172
- package/public/skills/superpowers/writing-skills/persuasion-principles.md +0 -187
- package/public/skills/superpowers/writing-skills/render-graphs.js +0 -168
- package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +0 -384
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{e8w3vd9Eov_LDYWj_0zsE → rGXyAK8rgod1NjF3bLZAY}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,177053,e=>{"use strict";var t=e.i(344180),n=e.i(523592);{let e=window.fetch,t="__api_patched__";window[t]||(window[t]=!0,window.fetch=function(t,r){if("string"==typeof t&&t.startsWith("/api/")){let e=(0,n.getActiveServerUrl)();e&&(t=`${e}${t}`)}return e.call(window,t,r)})}var r=e.i(764556),a=e.i(799543),s=e.i(437122),i=e.i(233297),o=e.i(286117),l=e.i(260218),c=e.i(486657),d=e.i(601039),u=e.i(939760);e.s(["AuthGuard",0,function({children:e}){let m=(0,a.usePathname)(),p=(0,a.useRouter)(),[f,h]=(0,r.useState)("checking"),[g,x]=(0,r.useState)(""),v=(0,o.isLoginPath)(m),b=(0,r.useCallback)(()=>{if(v)return void h("ok");if(!(0,s.isAuthenticated)())return void(0,i.tauriNavigate)(p,"/login",!0);h("checking");let e=(0,s.getToken)();fetch("/api/auth/check",{headers:null!==e?{Authorization:`Bearer ${e}`}:{}}).then(e=>401===e.status||403===e.status?((0,s.removeToken)(),(0,i.tauriNavigate)(p,"/login",!0),null):e.ok?e.json():{authenticated:!0}).then(e=>{null!==e&&(e.authenticated?h("ok"):((0,s.removeToken)(),(0,i.tauriNavigate)(p,"/login",!0)))}).catch(()=>{let e=(0,n.getActiveServer)();x(e?`无法连接到服务器 ${e.name} (${e.url})`:"无法连接到服务器"),h("error")})},[v,p]);return((0,r.useEffect)(()=>{b()},[b]),v)?(0,t.jsx)(t.Fragment,{children:e}):"checking"===f?null:"error"===f?(0,t.jsx)("div",{className:"flex h-[var(--app-content-height)] items-center justify-center bg-background",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 text-center px-6 max-w-md",children:[(0,t.jsx)(c.AlertTriangle,{className:"size-12 text-destructive"}),(0,t.jsx)("h2",{className:"text-lg font-semibold",children:"连接失败"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:g}),(0,t.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:b,children:[(0,t.jsx)(d.RefreshCw,{className:"size-4 mr-1"}),"重试"]}),(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>{(0,s.removeToken)(),(0,i.tauriNavigate)(p,"/login",!0)},children:[(0,t.jsx)(u.Settings,{className:"size-4 mr-1"}),"切换服务器"]})]})]})}):(0,t.jsx)(t.Fragment,{children:e})}],177053)},640376,e=>{"use strict";let t=(0,e.i(816709).create)((e,t)=>({open:!1,commands:[],setOpen:t=>e({open:t}),toggle:()=>e(e=>({open:!e.open})),register:n=>(e(e=>e.commands.some(e=>e.id===n.id)?e:{commands:[...e.commands,n]}),()=>t().unregister(n.id)),registerMany:t=>{let n=new Set(t.map(e=>e.id));return e(e=>({commands:[...e.commands.filter(e=>!n.has(e.id)),...t]})),()=>e(e=>({commands:e.commands.filter(e=>!n.has(e.id))}))},unregister:t=>e(e=>({commands:e.commands.filter(e=>e.id!==t)}))}));e.s(["useCommandPalette",0,t])},478189,(e,t,n)=>{"use strict";t.exports="/__open-stack-frame-in-editor"},994876,e=>{"use strict";var t=e.i(344180),n=e.i(799543),r=e.i(764556),a=e.i(370383),s=e.i(928542),i=e.i(294237),o=e.i(564822),l=e.i(465458),c=e.i(260218),d=e.i(681622);e.i(362962);var u=e.i(14452);e.i(613087);var m=e.i(638322),p=e.i(651850),p=p;let f="sidebar_state",h=r.createContext(null);function g(){let e=r.useContext(h);if(!e)throw Error("useSidebar must be used within a SidebarProvider.");return e}function x({defaultOpen:e=!0,open:n,onOpenChange:a,className:s,style:i,children:c,...d}){let u=(0,o.useIsMobile)(),[m,p]=r.useState(!1),[g,v]=r.useState(e),b=n??g;r.useEffect(()=>{if(void 0!==n)return;let e=document.cookie.match(RegExp(`(?:^|; )${f}=([^;]*)`));e&&v("true"===e[1])},[n]);let w=r.useCallback(e=>{let t="function"==typeof e?e(b):e;a?a(t):v(t),document.cookie=`${f}=${t}; path=/; max-age=604800`},[a,b]),j=r.useCallback(()=>u?p(e=>!e):w(e=>!e),[u,w,p]);r.useEffect(()=>{let e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),j())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[j]);let y=b||u&&m?"expanded":"collapsed",N=r.useMemo(()=>({state:y,open:b,setOpen:w,isMobile:u,openMobile:m,setOpenMobile:p,toggleSidebar:j}),[y,b,w,u,m,p,j]);return(0,t.jsx)(h.Provider,{value:N,children:(0,t.jsx)("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"16rem","--sidebar-width-icon":"3rem",...i},className:(0,l.cn)("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",s),...d,children:c})})}function v({side:e="left",variant:n="sidebar",collapsible:r="offcanvas",className:a,children:s,dir:i,...o}){let{isMobile:c,state:d,openMobile:m,setOpenMobile:p}=g();return"none"===r?(0,t.jsx)("div",{"data-slot":"sidebar",className:(0,l.cn)("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...o,children:s}):c?(0,t.jsx)(u.Sheet,{open:m,onOpenChange:p,...o,children:(0,t.jsxs)(u.SheetContent,{dir:i,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:e,children:[(0,t.jsxs)(u.SheetHeader,{className:"sr-only",children:[(0,t.jsx)(u.SheetTitle,{children:"Sidebar"}),(0,t.jsx)(u.SheetDescription,{children:"Displays the mobile sidebar."})]}),(0,t.jsx)("div",{className:"flex h-full w-full flex-col",children:s})]})}):(0,t.jsxs)("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":d,"data-collapsible":"collapsed"===d?r:"","data-variant":n,"data-side":e,"data-slot":"sidebar",children:[(0,t.jsx)("div",{"data-slot":"sidebar-gap",className:(0,l.cn)("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===n||"inset"===n?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),(0,t.jsx)("div",{"data-slot":"sidebar-container","data-side":e,className:(0,l.cn)("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex","floating"===n||"inset"===n?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...o,children:(0,t.jsx)("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col overflow-hidden group-data-[variant=floating]:rounded-xl group-data-[variant=floating]:bg-transparent",children:s})})]})}function b({className:e,onClick:n,...r}){let{toggleSidebar:a}=g();return(0,t.jsxs)(c.Button,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:(0,l.cn)(e),onClick:e=>{n?.(e),a()},...r,children:[(0,t.jsx)(p.default,{}),(0,t.jsx)("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function w({className:e,...n}){return(0,t.jsx)("main",{"data-slot":"sidebar-inset",className:(0,l.cn)("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...n})}function j({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:(0,l.cn)("flex flex-col gap-2 p-2 shrink-0",e),...n})}function y({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:(0,l.cn)("flex flex-col gap-2 p-2 shrink-0",e),...n})}function N({className:e,...n}){return(0,t.jsx)("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:(0,l.cn)("flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...n})}function k({className:e,...n}){return(0,t.jsx)("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:(0,l.cn)("flex w-full min-w-0 flex-col gap-0",e),...n})}function S({className:e,...n}){return(0,t.jsx)("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:(0,l.cn)("group/menu-item relative",e),...n})}let C=(0,i.cva)("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function E({render:e,isActive:n=!1,variant:r="default",size:i="default",tooltip:o,className:c,...d}){let{isMobile:u,state:p}=g(),f=(0,s.useRender)({defaultTagName:"button",props:(0,a.mergeProps)({className:(0,l.cn)(C({variant:r,size:i}),c)},d),render:o?(0,t.jsx)(m.TooltipTrigger,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:i,active:n}});return o?("string"==typeof o&&(o={children:o}),(0,t.jsxs)(m.Tooltip,{children:[f,(0,t.jsx)(m.TooltipContent,{side:"right",align:"center",hidden:"collapsed"!==p||u,...o})]})):f}function D({className:e,...n}){return(0,t.jsx)("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:(0,l.cn)("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",e),...n})}function I({render:e,size:t="md",isActive:n=!1,className:r,...i}){return(0,s.useRender)({defaultTagName:"a",props:(0,a.mergeProps)({className:(0,l.cn)("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",r)},i),render:e,state:{slot:"sidebar-menu-sub-button",sidebar:"menu-sub-button",size:t,active:n}})}var T=e.i(244073),M=e.i(233297),P=e.i(341807),z=e.i(411649),_=e.i(451534),A=e.i(939760),O=e.i(325443),L=e.i(990336),R=e.i(100559),$=e.i(962562),F=e.i(137340),W=e.i(244644),B=e.i(327962),U=e.i(415360),H=e.i(426022),K=e.i(191202),V=e.i(433721);let q=(0,V.default)("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);var X=e.i(227634),G=e.i(592039),J=e.i(164202),Y=e.i(119211),Z=e.i(683640),Q=e.i(324216),ee=e.i(588591),et=e.i(86477),en=e.i(549705),er=e.i(238300),ea=e.i(625873),es=e.i(756638),ei=e.i(841734),eo=e.i(22906),el=e.i(887836),ec=e.i(209988),ed=e.i(191118),eu=e.i(226624),em=e.i(917955),ep=e.i(188815),ef=e.i(129981),eh=e.i(953700),eg=e.i(111343),ex=e.i(401058),ev=e.i(262232),eb=e.i(816709),ew=e.i(437122);let ej=(0,eb.create)(e=>({hooks:[],selectedName:null,loading:!1,fetchHooks:async t=>{e({loading:!0});try{let n=await (0,ew.fetchWithAuth)(`/api/workspaces/${t}/hooks`),r=await n.json();e({hooks:r,loading:!1})}catch{e({loading:!1})}},createHook:async(t,n)=>{let r={name:n,enabled:!0,hooks:{PreToolUse:[],PostToolUse:[]}};await (0,ew.fetchWithAuth)(`/api/workspaces/${t}/hooks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),e(e=>({hooks:[...e.hooks,r],selectedName:n}))},updateHook:async(t,n,r)=>{await (0,ew.fetchWithAuth)(`/api/workspaces/${t}/hooks/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),e(e=>({hooks:e.hooks.map(e=>e.name===n?r:e)}))},deleteHook:async(t,n)=>{await (0,ew.fetchWithAuth)(`/api/workspaces/${t}/hooks/${n}`,{method:"DELETE"}),e(e=>({hooks:e.hooks.filter(e=>e.name!==n),selectedName:e.selectedName===n?null:e.selectedName}))},uploadHook:async(t,n)=>{let r=await (0,ew.fetchWithAuth)(`/api/workspaces/${t}/hooks/upload`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n})}),a=await r.json();e(e=>({hooks:[...e.hooks,a],selectedName:a.name}))},applyToWorkspace:async(e,t,n)=>{await (0,ew.fetchWithAuth)(`/api/workspaces/${e}/hooks/${t}/apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetWorkspaceId:n})})},setSelectedName:t=>e({selectedName:t}),reset:()=>e({hooks:[],selectedName:null,loading:!1})}));var ey=e.i(361031);e.i(462506);let eN=(0,el.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-full text-muted-foreground text-sm",children:"Loading editor..."})});function ek({open:e,onOpenChange:n,standalone:a}){(0,T.useTranslations)();let{hooks:s,selectedName:i,loading:o,fetchHooks:u,createHook:m,updateHook:p,deleteHook:f,uploadHook:h,applyToWorkspace:g,setSelectedName:x}=ej(),{workspaces:v}=(0,ey.useWorkspaceStore)(),b=v[0]?.id,[w,j]=(0,r.useState)(""),[y,N]=(0,r.useState)(""),[k,S]=(0,r.useState)(!1),[C,E]=(0,r.useState)(!1),[D,I]=(0,r.useState)(!1);(0,r.useEffect)(()=>{e&&b&&u(b)},[e,b,u]);let M=s.find(e=>e.name===i);(0,r.useEffect)(()=>{M?(j(JSON.stringify(M,null,2)),I(!1)):j("")},[M]);let P=(0,r.useCallback)(async()=>{if(b&&i)try{let e=JSON.parse(w);await p(b,i,e),I(!1)}catch(e){console.error("Invalid JSON:",e instanceof Error?e.message:String(e))}},[b,i,w,p]),z=(0,r.useCallback)(async()=>{b&&y.trim()&&(await m(b,y.trim()),N(""),S(!1))},[b,y,m]),_=(0,r.useCallback)(async()=>{b&&i&&await f(b,i)},[b,i,f]),A=(0,r.useCallback)(()=>{let e=document.createElement("input");e.type="file",e.accept=".json",e.onchange=async e=>{let t=e.target.files?.[0];if(!t||!b)return;let n=await t.text();await h(b,n)},e.click()},[b,h]),O=(0,r.useCallback)(async e=>{b&&i&&(await g(b,i,e),E(!1))},[b,i,g]),L=(0,r.useCallback)(async(e,t)=>{if(!b)return;let n=s.find(t=>t.name===e);n&&await p(b,e,{...n,enabled:t})},[b,s,p]),R=(0,t.jsxs)("div",{className:"flex h-[500px]",children:[(0,t.jsxs)("div",{className:"w-52 border-r flex flex-col",children:[(0,t.jsxs)("div",{className:"p-2 border-b flex gap-1",children:[(0,t.jsx)(c.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>S(!0),children:(0,t.jsx)(eh.Plus,{className:"size-3.5"})}),(0,t.jsx)(c.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:A,children:(0,t.jsx)(ef.Upload,{className:"size-3.5"})})]}),k&&(0,t.jsxs)("div",{className:"p-2 border-b flex gap-1",children:[(0,t.jsx)(d.Input,{value:y,onChange:e=>N(e.target.value),placeholder:"hook name",className:"h-7 text-xs",onKeyDown:e=>"Enter"===e.key&&z(),autoFocus:!0}),(0,t.jsx)(c.Button,{size:"sm",className:"h-7 text-xs",onClick:z,children:"OK"})]}),(0,t.jsx)(ed.ScrollArea,{className:"flex-1",children:o?(0,t.jsx)("div",{className:"p-3 text-xs text-muted-foreground",children:"Loading..."}):0===s.length?(0,t.jsx)("div",{className:"p-3 text-xs text-muted-foreground",children:"No hooks"}):s.map(e=>(0,t.jsxs)("div",{className:(0,l.cn)("flex items-center gap-2 px-3 py-1.5 cursor-pointer text-xs hover:bg-accent",i===e.name&&"bg-accent"),onClick:()=>x(e.name),children:[(0,t.jsx)(eu.Switch,{checked:e.enabled,onCheckedChange:t=>L(e.name,t),className:"scale-75",onClick:e=>e.stopPropagation()}),(0,t.jsx)("span",{className:"truncate flex-1",children:e.name})]},e.name))})]}),(0,t.jsx)("div",{className:"flex-1 flex flex-col",children:M?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-3 py-1.5 border-b",children:[(0,t.jsx)("span",{className:"text-xs font-medium",children:M.name}),(0,t.jsxs)("div",{className:"flex gap-1",children:[(0,t.jsxs)(c.Button,{size:"sm",variant:"ghost",className:"h-7 text-xs gap-1",onClick:()=>E(!0),children:[(0,t.jsx)(ev.ArrowRightLeft,{className:"size-3"}),"Apply"]}),(0,t.jsxs)(c.Button,{size:"sm",variant:"ghost",className:"h-7 text-xs gap-1",onClick:P,disabled:!D,children:[(0,t.jsx)(eg.Save,{className:"size-3"}),"Save"]}),(0,t.jsxs)(em.DropdownMenu,{children:[(0,t.jsx)(em.DropdownMenuTrigger,{children:(0,t.jsx)(c.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",children:(0,t.jsx)(ex.MoreVertical,{className:"size-3"})})}),(0,t.jsx)(em.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(em.DropdownMenuItem,{className:"text-destructive text-xs",onClick:_,children:[(0,t.jsx)(F.Trash2,{className:"size-3 mr-1"})," Delete"]})})]})]})]}),C&&(0,t.jsxs)("div",{className:"px-3 py-2 border-b bg-muted/50",children:[(0,t.jsx)("div",{className:"text-xs mb-1",children:"Apply to workspace:"}),(0,t.jsx)(ep.SearchSelect,{options:v.filter(e=>e.id!==b).map(e=>({value:e.id,label:e.name})),value:"",onChange:O,placeholder:"Select workspace..."})]}),(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(eN,{height:"100%",language:"json",theme:"vs-dark",value:w,onChange:e=>{j(e||""),I(!0)},options:{minimap:{enabled:!1},fontSize:12,lineNumbers:"on",scrollBeyondLastLine:!1,wordWrap:"on"}})})]}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Select a hook to edit"})})]});return a?R:(0,t.jsx)(ec.Dialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(ec.DialogContent,{className:"!max-w-[80vw] p-0 overflow-hidden",children:[(0,t.jsxs)(ec.DialogHeader,{className:"px-4 pt-4",children:[(0,t.jsx)(ec.DialogTitle,{children:"Hooks"}),(0,t.jsx)(ec.DialogDescription,{children:"Manage per-tool-call hooks for this workspace"})]}),R]})})}var eS=e.i(996652),eC=e.i(460578),eE=e.i(611176),eD=e.i(887354),eI=e.i(989484),eT=e.i(973370),eM=e.i(977694),eP=e.i(239340);let ez=(0,el.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-full text-muted-foreground text-sm",children:"Loading editor..."})});function e_({open:e,onOpenChange:n}){let a=(0,T.useTranslations)("agentCommands"),s=(0,T.useTranslations)("common"),[i,o]=(0,r.useState)([]),[u,m]=(0,r.useState)([]),[p,f]=(0,r.useState)(!1),[h,g]=(0,r.useState)(""),[x,v]=(0,r.useState)(""),[b,w]=(0,r.useState)(""),[j,y]=(0,r.useState)(!1),[N,k]=(0,r.useState)([]),[S,C]=(0,r.useState)(null),[E,D]=(0,r.useState)(!1),[I,M]=(0,r.useState)(""),[P,z]=(0,r.useState)(""),[_,A]=(0,r.useState)(""),[O,L]=(0,r.useState)(""),[R,$]=(0,r.useState)(!1),[W,B]=(0,r.useState)(null),[U,H]=(0,r.useState)([]),[K,V]=(0,r.useState)(!1),q=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/agent-commands/agents");if(e.ok){let t=await e.json();o(t),t.length>0&&!x&&A(t[0].agentId)}}catch{}},[x]),X=(0,r.useCallback)(async()=>{f(!0);try{let e=await fetch("/api/agent-commands/all");e.ok&&m(await e.json())}catch{}f(!1)},[]);(0,r.useEffect)(()=>{e&&(q(),X())},[e,q,X]);let G=Array.from(new Set(u.map(e=>e.group).filter(Boolean))),J=u.filter(e=>{if(h){let t=h.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.content.toLowerCase().includes(t))return!1}if(x&&e.agentId!==x)return!1;if(b){if("__none__"===b){if(e.group)return!1}else if(e.group!==b)return!1}return!0}),Y=async()=>{if(0===N.length)return;let e=x||(i.length>0?i[0].agentId:"");if(e){if(1===N.length){let t=await N[0].file.text(),n=N[0].file.name.replace(/\.(md|txt|markdown)$/i,"");k([]),y(!1),C(null),D(!0),M(n),L(t),A(e),z("");return}for(let t of N){let n=await t.file.text(),r=t.file.name.replace(/\.(md|txt|markdown)$/i,"");await fetch(`/api/agent-commands/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:r,content:n})})}k([]),y(!1),X()}},Z=()=>{C(null),D(!1),M(""),L(""),z("")},Q=async()=>{if(I.trim()&&O.trim()&&_){$(!0);try{S?(await fetch(`/api/agent-commands/${_}/${S.name}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:O,group:P})})).ok&&(Z(),X()):(await fetch(`/api/agent-commands/${_}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:I,content:O,group:P||void 0})})).ok&&(Z(),X())}catch{}$(!1)}},ee=async e=>{try{let t=e.group?`?group=${encodeURIComponent(e.group)}`:"";(await fetch(`/api/agent-commands/${e.agentId}/${e.name}${t}`,{method:"DELETE"})).ok&&X()}catch{}},et=async()=>{if(W&&0!==U.length){V(!0);try{await fetch(`/api/agent-commands/${W.agentId}/${W.name}/apply`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({group:W.group,agentIds:U})}),B(null),X()}catch{}V(!1)}},en=e&&!S&&!E&&!W,er=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ec.DialogHeader,{children:(0,t.jsx)("div",{className:"flex items-center justify-between pr-8",children:(0,t.jsxs)("div",{className:"hidden md:block",children:[(0,t.jsx)(ec.DialogTitle,{children:a("title")}),(0,t.jsx)(ec.DialogDescription,{children:a("description")})]})})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto shrink-0",children:[(0,t.jsxs)(eS.Popover,{open:j,onOpenChange:y,children:[(0,t.jsx)(eS.PopoverTrigger,{render:(0,t.jsxs)(c.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(ef.Upload,{className:"size-3.5 mr-1"}),a("import")]})}),(0,t.jsx)(eS.PopoverContent,{className:"w-80",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:a("importTitle")}),(0,t.jsx)(eC.FileUpload,{value:N,onChange:k,accept:{"text/markdown":[".md",".txt"],"":[".md",".txt"]},placeholder:a("importPlaceholder"),maxFiles:10}),(0,t.jsx)(c.Button,{size:"sm",onClick:Y,disabled:0===N.length,className:"w-full",children:a("importConfirm")})]})})]}),(0,t.jsxs)(c.Button,{variant:"outline",size:"sm",onClick:()=>{C(null),D(!0),M(""),L(""),z(""),A(x||(i.length>0?i[0].agentId:""))},children:[(0,t.jsx)(eh.Plus,{className:"size-3.5 mr-1"}),a("create")]})]}),(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsx)(ed.ScrollArea,{className:"hidden md:block w-44 shrink-0",children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 pr-2",children:[(0,t.jsx)("div",{className:"space-y-1",children:(0,t.jsxs)(c.Button,{variant:x||b?"ghost":"secondary",size:"sm",className:"w-full justify-start",onClick:()=>{v(""),w("")},children:[(0,t.jsx)(eI.FileText,{className:"size-3.5 mr-1.5"}),a("allAgents")]})}),i.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:a("selectAgent")}),i.map(e=>(0,t.jsxs)(c.Button,{variant:x===e.agentId?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{v(e.agentId),w("")},children:[(0,t.jsx)(eE.AgentIcon,{agentId:e.agentId,name:e.agentName,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.agentName}),(0,t.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:e.commandCount})]},e.agentId))]}),G.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:a("filterGroups")}),G.map(e=>(0,t.jsxs)(c.Button,{variant:b===e?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{w(b===e?"":e),v("")},children:[(0,t.jsx)(eT.Folder,{className:"size-3.5 mr-1.5"}),(0,t.jsx)("span",{className:"truncate",children:e})]},e)),u.some(e=>!e.group)&&(0,t.jsxs)(c.Button,{variant:"__none__"===b?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{w("__none__"===b?"":"__none__"),v("")},children:[(0,t.jsx)(eI.FileText,{className:"size-3.5 mr-1.5"}),a("filterNoGroup")]})]})]})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3 min-h-0",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(eD.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(d.Input,{value:h,onChange:e=>g(e.target.value),placeholder:a("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 overflow-x-auto",children:[(0,t.jsx)("button",{className:(0,l.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors shrink-0 border",x||b?"border-input text-muted-foreground":"bg-muted border-muted"),onClick:()=>{v(""),w("")},children:a("allAgents")}),i.slice(0,5).map(e=>(0,t.jsx)("button",{className:(0,l.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors shrink-0 border",x===e.agentId?"bg-muted border-muted":"border-input text-muted-foreground"),onClick:()=>{v(e.agentId),w("")},children:e.agentName},e.agentId))]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(eD.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(d.Input,{value:h,onChange:e=>g(e.target.value),placeholder:a("search"),className:"pl-8"})]}),(0,t.jsx)(ed.ScrollArea,{className:"flex-1 min-h-0",children:p?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:s("loading")}):0===J.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:a("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:J.map(e=>{var n;let r;return(0,t.jsx)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{C(e),D(!1),M(e.name),L(e.content),z(e.group),A(e.agentId)},children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),e.group&&(0,t.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium",children:e.group}),!x&&(0,t.jsx)(eE.AgentIcon,{agentId:e.agentId,name:e.agentName||e.agentId,avatarUrl:(n=e.agentId,r=i.find(e=>e.agentId===n),r?.avatarUrl),className:"size-4 rounded-full"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.content.slice(0,120).replace(/^#\s+/,"")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(c.Button,{variant:"outline",size:"sm",className:"h-6 px-1.5 text-xs",onClick:()=>{B(e),H([])},children:[(0,t.jsx)(eM.Rocket,{className:"size-3 mr-0.5"}),a("apply")]}),(0,t.jsxs)(em.DropdownMenu,{children:[(0,t.jsx)(em.DropdownMenuTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(ex.MoreVertical,{className:"size-3.5"})}),(0,t.jsx)(em.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(em.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>ee(e),children:[(0,t.jsx)(F.Trash2,{className:"size-3.5 mr-1.5"}),a("delete")]})})]})]})]})},`${e.agentId}-${e.group}-${e.name}`)})})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ec.Dialog,{open:en,onOpenChange:n,children:(0,t.jsx)(ec.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:er})}),(0,t.jsx)(ec.Dialog,{open:!!S||E,onOpenChange:e=>{e||Z()},children:(0,t.jsxs)(ec.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(ec.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(ec.DialogTitle,{children:S?a("editTitle",{name:S.name}):a("createTitle")}),(0,t.jsx)(ec.DialogDescription,{children:a("editDescription")})]}),(0,t.jsxs)(c.Button,{size:"sm",onClick:Q,disabled:R||!I.trim()||!O.trim(),children:[(0,t.jsx)(eg.Save,{className:"size-3.5 mr-1"}),s("save")]})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 pb-2",children:[(0,t.jsx)(d.Input,{value:I,onChange:e=>M(e.target.value),placeholder:a("namePlaceholder"),disabled:!!S,className:"flex-1"}),(0,t.jsx)(d.Input,{value:P,onChange:e=>z(e.target.value),placeholder:a("groupPlaceholder"),className:"w-40"})]}),(0,t.jsx)("div",{className:"flex-1 min-h-0",children:(0,t.jsx)(ez,{height:"100%",language:"markdown",value:O,onChange:e=>L(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})})]})}),(0,t.jsx)(eP.AgentPickerDialog,{open:!!W,onClose:()=>B(null),onConfirm:et,title:a("applyTitle",{name:W?.name||""}),description:a("applyDescription"),agents:i.map(e=>({id:e.agentId,name:e.agentName,avatarUrl:e.avatarUrl})),selected:U,onToggle:e=>H(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),cancelText:s("cancel"),confirmText:a("applyConfirm",{count:U.length}),loading:K})]})}var eA=e.i(113519),eO=e.i(256186),eL=e.i(650654),eR=e.i(249673),e$=e.i(315775),eF=e.i(267624);function eW({routes:e,pathname:a}){let{state:s,isMobile:i,setOpenMobile:o}=g(),c="collapsed"===s,[d,u]=(0,r.useState)(new Set),m=(0,n.useRouter)(),p=(0,T.useTranslations)("common"),f=e=>{i&&o(!1),(0,M.tauriNavigate)(m,e)};return(0,t.jsx)(k,{children:e.map(e=>{let n=!c&&d.has(e.id),r=!!e.subs?.length,s=r||!!e.onAdd;return(0,t.jsx)(S,{children:s?c?(0,t.jsxs)(eS.Popover,{children:[(0,t.jsx)(eS.PopoverTrigger,{render:(0,t.jsx)(E,{className:"justify-center text-muted-foreground hover:bg-sidebar-muted hover:text-foreground",tooltip:e.title}),children:e.icon}),(0,t.jsxs)(eS.PopoverContent,{side:"right",sideOffset:8,className:"w-56 p-1.5",children:[(0,t.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground mb-1",children:e.title}),e.subs?.map(n=>(0,t.jsxs)("div",{className:"group/sub relative flex items-center",children:[n.onClick?(0,t.jsxs)("button",{type:"button",onClick:n.onClick,className:(0,l.cn)("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm cursor-pointer",a===n.link?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[n.icon,n.title]}):(0,t.jsxs)("button",{type:"button",onClick:()=>f(n.link),className:(0,l.cn)("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm cursor-pointer",a===n.link?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[n.icon,n.title]}),n.menuItems&&n.menuItems.length>0&&(0,t.jsxs)(em.DropdownMenu,{children:[(0,t.jsx)(em.DropdownMenuTrigger,{className:"absolute right-1 flex items-center justify-center rounded-md p-0.5 opacity-0 group-hover/sub:opacity-100 hover:bg-accent transition-opacity cursor-pointer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(e$.MoreHorizontal,{className:"size-3.5 text-muted-foreground"})}),(0,t.jsx)(em.DropdownMenuContent,{align:"end",side:"right",children:n.menuItems.map(e=>(0,t.jsxs)(em.DropdownMenuItem,{variant:e.variant,onClick:e.onClick,children:[e.icon,e.label]},e.label))})]})]},`${e.id}-${n.title}`)),e.onAdd&&(0,t.jsxs)("button",{type:"button",onClick:e.onAdd,className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground mt-0.5 cursor-pointer",children:[(0,t.jsx)(eh.Plus,{className:"size-3.5"}),e.addLabel??p("add")]}),e.manageLink&&(0,t.jsxs)("button",{type:"button",onClick:()=>f(e.manageLink),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground mt-0.5 cursor-pointer",children:[(0,t.jsx)(eF.LayoutGrid,{className:"size-3.5"}),p("manage")]})]})]}):(0,t.jsxs)(eO.Collapsible,{open:n,onOpenChange:t=>u(n=>{let r=new Set(n);return t?r.add(e.id):r.delete(e.id),r}),className:"w-full",children:[(0,t.jsxs)(eO.CollapsibleTrigger,{render:(0,t.jsx)(E,{className:(0,l.cn)("group/hdr flex flex-1 items-center rounded-lg px-2 transition-colors",n?"bg-sidebar-muted text-foreground":"text-muted-foreground hover:bg-sidebar-muted hover:text-foreground")}),children:[e.icon,(0,t.jsx)("span",{className:"ml-2 flex-1 text-sm font-medium",children:e.title}),r&&(0,t.jsx)("span",{children:n?(0,t.jsx)(eR.ChevronUp,{className:"size-4"}):(0,t.jsx)(eL.ChevronDown,{className:"size-4"})})]}),(0,t.jsx)(eO.CollapsibleContent,{children:(0,t.jsxs)(D,{className:"my-1 ml-3.5",children:[e.subs?.map(n=>(0,t.jsx)(S,{className:"h-auto",children:(0,t.jsxs)("div",{className:"group/sub relative flex items-center",children:[(0,t.jsx)(I,{render:n.onClick?(0,t.jsx)("button",{type:"button",onClick:n.onClick,className:(0,l.cn)("flex w-full items-center rounded-md px-4 py-1.5 text-sm font-medium cursor-pointer",a===n.link?"bg-sidebar-accent text-sidebar-accent-foreground":"text-muted-foreground hover:bg-sidebar-muted hover:text-foreground")}):(0,t.jsx)("button",{type:"button",onClick:()=>f(n.link),className:(0,l.cn)("flex w-full items-center rounded-md px-4 py-1.5 text-sm font-medium cursor-pointer",a===n.link?"bg-sidebar-accent text-sidebar-accent-foreground":"text-muted-foreground hover:bg-sidebar-muted hover:text-foreground")}),children:n.title}),n.menuItems&&n.menuItems.length>0&&(0,t.jsxs)(em.DropdownMenu,{children:[(0,t.jsx)(em.DropdownMenuTrigger,{className:"absolute right-1 flex items-center justify-center rounded-md p-0.5 opacity-0 group-hover/sub:opacity-100 hover:bg-sidebar-muted transition-opacity cursor-pointer",onClick:e=>e.stopPropagation(),children:(0,t.jsx)(e$.MoreHorizontal,{className:"size-3.5 text-muted-foreground"})}),(0,t.jsx)(em.DropdownMenuContent,{align:"end",side:"right",children:n.menuItems.map(e=>(0,t.jsxs)(em.DropdownMenuItem,{variant:e.variant,onClick:e.onClick,children:[e.icon,e.label]},e.label))})]})]})},`${e.id}-${n.title}`)),e.onAdd&&(0,t.jsx)(S,{children:(0,t.jsxs)("button",{type:"button",onClick:e.onAdd,className:"flex w-full items-center gap-2 rounded-md px-4 py-1.5 text-sm font-medium text-muted-foreground hover:bg-sidebar-muted hover:text-foreground cursor-pointer",children:[(0,t.jsx)(eh.Plus,{className:"size-3.5"}),e.addLabel??p("add")]})}),e.manageLink&&(0,t.jsx)(S,{children:(0,t.jsxs)("button",{type:"button",onClick:()=>f(e.manageLink),className:"flex w-full items-center gap-2 rounded-md px-4 py-1.5 text-sm font-medium text-muted-foreground hover:bg-sidebar-muted hover:text-foreground cursor-pointer",children:[(0,t.jsx)(eF.LayoutGrid,{className:"size-3.5"}),p("manage")]})})]})})]}):(0,t.jsxs)(E,{tooltip:e.title,render:(0,t.jsx)("button",{type:"button",onClick:()=>f(e.link),className:(0,l.cn)("flex items-center rounded-lg px-2 transition-colors cursor-pointer text-muted-foreground hover:bg-sidebar-muted hover:text-foreground",c&&"justify-center")}),children:[e.icon,!c&&(0,t.jsx)("span",{className:"ml-2 text-sm font-medium",children:e.title})]})},e.id)})})}var eB=e.i(36539),eB=eB,eU=e.i(875350),eH=e.i(506037),eK=e.i(487122),eV=e.i(238153),eq=e.i(492421),eX=e.i(632713),eG=e.i(539392),eJ=e.i(516467);function eY(e,t){let n=(0,eJ.toDate)(e)-(0,eJ.toDate)(t);return n<0?-1:n>0?1:n}var eZ=e.i(511518),eQ=e.i(731285),e0=e.i(936765);function e1(e,t){return function(e,t,n){var r;let a,s=(0,eq.getDefaultOptions)(),i=n?.locale??s.locale??eV.defaultLocale,o=eY(e,t);if(isNaN(o))throw RangeError("Invalid time value");let l=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:o}),[c,d]=(0,eG.normalizeDates)(n?.in,...o>0?[t,e]:[e,t]),u=(r=void 0,e=>{let t=(r?Math[r]:Math.trunc)(e);return 0===t?0:t})(((0,eJ.toDate)(d)-(0,eJ.toDate)(c))/1e3),m=Math.round((u-((0,eX.getTimezoneOffsetInMilliseconds)(d)-(0,eX.getTimezoneOffsetInMilliseconds)(c))/1e3)/60);if(m<2)if(n?.includeSeconds)if(u<5)return i.formatDistance("lessThanXSeconds",5,l);else if(u<10)return i.formatDistance("lessThanXSeconds",10,l);else if(u<20)return i.formatDistance("lessThanXSeconds",20,l);else if(u<40)return i.formatDistance("halfAMinute",0,l);else if(u<60)return i.formatDistance("lessThanXMinutes",1,l);else return i.formatDistance("xMinutes",1,l);else if(0===m)return i.formatDistance("lessThanXMinutes",1,l);else return i.formatDistance("xMinutes",m,l);if(m<45)return i.formatDistance("xMinutes",m,l);if(m<90)return i.formatDistance("aboutXHours",1,l);if(m<eZ.minutesInDay){let e=Math.round(m/60);return i.formatDistance("aboutXHours",e,l)}if(m<2520)return i.formatDistance("xDays",1,l);else if(m<eZ.minutesInMonth){let e=Math.round(m/eZ.minutesInDay);return i.formatDistance("xDays",e,l)}else if(m<2*eZ.minutesInMonth)return a=Math.round(m/eZ.minutesInMonth),i.formatDistance("aboutXMonths",a,l);if((a=function(e,t){var n;let r,a,[s,i,o]=(0,eG.normalizeDates)(void 0,e,e,t),l=eY(i,o),c=Math.abs((0,eQ.differenceInCalendarMonths)(i,o));if(c<1)return 0;1===i.getMonth()&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-l*c);let d=eY(i,o)===-l;+(r=(0,eJ.toDate)(s,void 0),n=void 0,(a=(0,eJ.toDate)(r,n?.in)).setHours(23,59,59,999),a)==+(0,e0.endOfMonth)(r,void 0)&&1===c&&1===eY(s,o)&&(d=!1);let u=l*(c-d);return 0===u?0:u}(d,c))<12){let e=Math.round(m/eZ.minutesInMonth);return i.formatDistance("xMonths",e,l)}{let e=a%12,t=Math.trunc(a/12);return e<3?i.formatDistance("aboutXYears",t,l):e<9?i.formatDistance("overXYears",t,l):i.formatDistance("almostXYears",t+1,l)}}(e,(0,eK.constructFrom)(e,Date.now()),t)}let e2=(0,V.default)("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);var e5=e.i(440897),e5=e5;let e3={issue_completed:"✓",issue_failed:"✕",task_completed:"✓",task_failed:"✕",channel_agent_completed:"✓"},e4={issue_completed:"text-green-600 bg-green-100 dark:bg-green-900/30 dark:text-green-400",issue_failed:"text-red-600 bg-red-100 dark:bg-red-900/30 dark:text-red-400",task_completed:"text-green-600 bg-green-100 dark:bg-green-900/30 dark:text-green-400",task_failed:"text-red-600 bg-red-100 dark:bg-red-900/30 dark:text-red-400",channel_agent_completed:"text-blue-600 bg-blue-100 dark:bg-blue-900/30 dark:text-blue-400"};function e6({open:e,onOpenChange:n,workspaceId:a,initialNotification:s}){let i=(0,T.useTranslations)("sidebar.notifications"),o=(0,eH.useNotificationStore)(e=>e.notifications),d=(0,eH.useNotificationStore)(e=>e.markRead),u=(0,eH.useNotificationStore)(e=>e.markAllRead),m=(0,eH.useNotificationStore)(e=>e.clearAll),p=(0,eH.useNotificationStore)(e=>e.remove),[f,h]=(0,r.useState)(null),g=s&&!f?s:f;return(0,t.jsx)(ec.Dialog,{open:e,onOpenChange:e=>{e||h(null),n(e)},children:(0,t.jsxs)(ec.DialogContent,{className:"sm:max-w-lg max-h-[80vh] flex flex-col gap-0 overflow-hidden p-0",children:[(0,t.jsx)(ec.DialogHeader,{className:"px-6 py-4 border-b shrink-0",children:(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(ec.DialogTitle,{children:i("centerTitle")}),o.some(e=>!e.read)&&(0,t.jsx)("span",{className:"inline-flex items-center justify-center size-5 rounded-full bg-blue-500 text-[10px] font-medium text-white",children:o.filter(e=>!e.read).length})]})})}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:g?(0,t.jsxs)("div",{className:"px-6 py-4",children:[(0,t.jsxs)("button",{onClick:()=>h(null),className:"inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground mb-3 transition-colors",children:[(0,t.jsx)(e5.default,{className:"size-3.5"}),i("backToList")]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold truncate",children:g.title}),(0,t.jsxs)("span",{className:(0,l.cn)("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium",e4[g.type]??""),children:[e3[g.type]??""," ",i(`type.${g.type}`,{defaultValue:g.type})]})]}),g.description&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:g.description}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e1(new Date(g.createdAt),{addSuffix:!0})}),Object.keys(g.data).length>0&&(0,t.jsx)("pre",{className:"mt-3 text-xs bg-muted rounded p-3 overflow-auto",children:JSON.stringify(g.data,null,2)})]}):0===o.length?(0,t.jsx)("div",{className:"px-6 py-12 text-center text-sm text-muted-foreground",children:i("empty")}):(0,t.jsx)("div",{className:"divide-y",children:o.map(e=>(0,t.jsxs)("button",{className:(0,l.cn)("flex w-full items-start gap-3 px-6 py-3.5 text-left hover:bg-accent/50 transition-colors",!e.read&&"bg-accent/30"),onClick:()=>{e.read||d(a,e.id),h(e)},children:[(0,t.jsx)("div",{className:(0,l.cn)("mt-1 size-2 rounded-full shrink-0",e.read?"bg-transparent":"bg-blue-500")}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate",children:e.title}),e.description&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-1 mt-0.5",children:e.description}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:e1(new Date(e.createdAt),{addSuffix:!0})})]})]},e.id))})}),!g&&o.length>0&&(0,t.jsxs)("div",{className:"px-6 py-3 border-t shrink-0 flex items-center justify-between",children:[o.some(e=>!e.read)&&(0,t.jsxs)(c.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>u(a),children:[(0,t.jsx)(e2,{className:"size-3.5"}),i("markAllRead")]}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)(c.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1 text-destructive",onClick:()=>{m(a),n(!1)},children:[(0,t.jsx)(eU.Trash2Icon,{className:"size-3.5"}),i("clearAll")]})]}),g&&(0,t.jsx)("div",{className:"px-6 py-3 border-t shrink-0 flex justify-end",children:(0,t.jsxs)(c.Button,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1 text-destructive",onClick:()=>{p(a,g.id),h(null)},children:[(0,t.jsx)(eU.Trash2Icon,{className:"size-3.5"}),i("delete")]})})]})})}function e8({workspaceId:e}){let n=(0,T.useTranslations)("sidebar.notifications"),a=(0,eH.useNotificationStore)(e=>e.notifications),s=(0,eH.useNotificationStore)(e=>e.markRead),i=(0,eH.useNotificationStore)(e=>e.clearAll),o=a.filter(e=>!e.read).length,[d,u]=(0,r.useState)(!1),[m,p]=(0,r.useState)(!1),[f,h]=(0,r.useState)(null),g=a.slice(0,5);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(eS.Popover,{open:d,onOpenChange:u,children:[(0,t.jsxs)(eS.PopoverTrigger,{render:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"rounded-full relative","aria-label":n("openAriaLabel")}),children:[(0,t.jsx)(eB.default,{className:"size-5"}),o>0&&(0,t.jsx)("span",{className:"absolute -top-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-red-500 text-[10px] font-medium text-white",children:o>9?"9+":o})]}),(0,t.jsxs)(eS.PopoverContent,{side:"right",className:"w-80 max-h-[70dvh] my-6 p-0",align:"start",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b",children:[(0,t.jsx)("span",{className:"text-sm font-semibold",children:n("title")}),a.length>0&&(0,t.jsx)("div",{className:"flex gap-1",children:(0,t.jsx)(c.Button,{variant:"ghost",size:"icon",className:"size-7",onClick:()=>i(e),title:n("clearAll"),children:(0,t.jsx)(eU.Trash2Icon,{className:"size-3.5"})})})]}),(0,t.jsx)(ed.ScrollArea,{className:"max-h-[50dvh] overflow-hidden",children:0===g.length?(0,t.jsx)("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:n("empty")}):(0,t.jsx)("div",{className:"divide-y",children:g.map(n=>(0,t.jsxs)("button",{className:(0,l.cn)("flex w-full items-start gap-3 px-4 py-3 text-left hover:bg-accent/50 transition-colors",!n.read&&"bg-accent/30"),onClick:()=>{n.read||s(e,n.id),h(n),p(!0)},children:[(0,t.jsx)("div",{className:(0,l.cn)("mt-1 size-2 rounded-full shrink-0",n.read?"bg-transparent":"bg-blue-500")}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate",children:n.title}),n.description&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-0.5",children:n.description}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:e1(new Date(n.createdAt),{addSuffix:!0})})]})]},n.id))})}),a.length>5&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"border-t"}),(0,t.jsx)("button",{className:"w-full px-4 py-2.5 text-sm text-muted-foreground hover:text-primary hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{h(null),u(!1),p(!0)},children:n("viewAll")})]})]})]}),(0,t.jsx)(e6,{open:m,onOpenChange:p,workspaceId:e,initialNotification:f})]})}var e9=e.i(344118);let e7=(0,V.default)("chevrons-up-down",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);var te=e.i(210),tt=e.i(523592);function tn({open:e,onOpenChange:n,editingId:a,servers:s,onSave:i}){let o=(0,T.useTranslations)("sidebar"),l=(0,T.useTranslations)("common"),[u,m]=r.useState(""),[p,f]=r.useState(""),[h,g]=r.useState("");return r.useEffect(()=>{if(e&&a){let e=s.find(e=>e.id===a);e&&(m(e.name),f(e.url),g(e.secret||""))}else e&&(m(""),f(""),g(""))},[e,a,s]),(0,t.jsx)(ec.Dialog,{open:e,onOpenChange:n,children:(0,t.jsxs)(ec.DialogContent,{children:[(0,t.jsxs)(ec.DialogHeader,{children:[(0,t.jsx)(ec.DialogTitle,{children:o(a?"server.editServer":"server.addServer")}),(0,t.jsx)(ec.DialogDescription,{children:o(a?"server.editDescription":"server.addDescription")})]}),(0,t.jsxs)("div",{className:"space-y-4 py-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:l("name")}),(0,t.jsx)(d.Input,{value:u,onChange:e=>m(e.target.value),placeholder:"My Server"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:o("server.url")}),(0,t.jsx)(d.Input,{value:p,onChange:e=>f(e.target.value),placeholder:"http://192.168.1.100:3100",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:o("server.secret")}),(0,t.jsx)(d.Input,{type:"password",value:h,onChange:e=>g(e.target.value),placeholder:o("server.secretPlaceholder"),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})]})]}),(0,t.jsxs)(ec.DialogFooter,{children:[(0,t.jsx)(c.Button,{variant:"outline",onClick:()=>n(!1),children:l("cancel")}),(0,t.jsx)(c.Button,{onClick:()=>{if(!u.trim()||!p.trim())return;let e=p.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),a?i(s.map(t=>t.id===a?{...t,name:u.trim(),url:e,secret:h.trim()||void 0}:t)):i([...s,{id:Date.now().toString(),name:u.trim(),url:e,secret:h.trim()||void 0}]),n(!1)},disabled:!u.trim()||!p.trim(),children:l(a?"save":"add")})]})]})})}var tr=e.i(894920),ta=e.i(691223);function ts(){let{isMobile:e}=g(),n=(0,T.useTranslations)("sidebar"),[a,s]=r.useState(tt.loadServers),[i,o]=r.useState(tt.loadActiveId),[l,c]=r.useState(!1),[d,u]=r.useState(null),[m,p]=r.useState(!1),f=a.find(e=>e.id===i)||a[0],h=r.useCallback(e=>{ta.useEditorStore.getState().resetEditorState(),o(e.id),(0,tt.saveActiveId)(e.id),(0,tt.setActiveServerCookie)(e.url),window.location.href="/"},[]),x=r.useCallback(e=>{if("default"===e)return;let t=a.filter(t=>t.id!==e);if(s(t),(0,tt.saveServers)(t),i===e){let e=t.find(e=>"default"===e.id)||t[0];e&&h(e)}},[i,a,h]);return f?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(k,{children:(0,t.jsx)(S,{children:(0,t.jsxs)(em.DropdownMenu,{children:[(0,t.jsxs)(em.DropdownMenuTrigger,{render:(0,t.jsx)(E,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"}),children:[(0,t.jsx)("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-background text-foreground",children:(0,t.jsx)(R.Server,{className:"size-4"})}),(0,t.jsxs)("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[(0,t.jsx)("span",{className:"truncate font-semibold",children:f.name}),(0,t.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:f.url.replace(/^https?:\/\//,"")})]}),(0,t.jsx)(e7,{className:"ml-auto"})]}),(0,t.jsxs)(em.DropdownMenuContent,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg mb-4",align:"start",side:e?"bottom":"right",sideOffset:4,children:[(0,t.jsx)(em.DropdownMenuGroup,{children:(0,t.jsx)(em.DropdownMenuLabel,{className:"text-xs text-muted-foreground",children:n("server.servers")})}),a.map(e=>(0,t.jsxs)(em.DropdownMenuItem,{onClick:()=>h(e),className:"gap-2 p-2",children:[(0,t.jsx)("div",{className:"flex size-6 items-center justify-center rounded-sm border",children:(0,t.jsx)(R.Server,{className:"size-3.5 shrink-0"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-sm truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.url})]}),e.id===i&&(0,t.jsx)(e9.Check,{className:"size-4 text-primary shrink-0"})]},e.id)),(0,t.jsx)(em.DropdownMenuSeparator,{}),(0,t.jsxs)(em.DropdownMenuItem,{className:"gap-2 p-2",onClick:()=>{u(null),c(!0)},children:[(0,t.jsx)("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:(0,t.jsx)(eh.Plus,{className:"size-4"})}),(0,t.jsx)("div",{className:"font-medium text-muted-foreground",children:n("server.addServer")})]}),(0,t.jsxs)(em.DropdownMenuItem,{className:"gap-2 p-2",onClick:()=>p(!0),children:[(0,t.jsx)("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:(0,t.jsx)(te.Settings2,{className:"size-4"})}),(0,t.jsx)("div",{className:"font-medium text-muted-foreground",children:n("server.manageServers")})]})]})]})})}),(0,t.jsx)(tn,{open:l,onOpenChange:c,editingId:d,servers:a,onSave:e=>{s(e),(0,tt.saveServers)(e);let t=d?e.find(e=>e.id===d):e[e.length-1];d&&t&&d===i&&(0,tt.setActiveServerCookie)(t.url)}}),(0,t.jsx)(tr.ServerManagerDialog,{open:m,onOpenChange:p,servers:a,activeId:i,onUpdate:e=>{s(e),(0,tt.saveServers)(e);let t=e.find(e=>e.id===i);t&&(0,tt.setActiveServerCookie)(t.url)},onRemove:x,onSwitch:h})]}):null}var ti=e.i(524),to=e.i(640376),tl=e.i(31807),tc=e.i(327964),td=e.i(250226),tu=e.i(974915),tm=e.i(286117);function tp(e){return`/workspace/${e}`}function tf(){let{state:e,toggleSidebar:a}=g(),{matchesEvent:s}=(0,tu.useKeyboardShortcuts)(),i=(0,n.usePathname)(),c=(0,n.useRouter)(),d=(0,T.useTranslations)("sidebar"),u=(0,T.useTranslations)("common"),m="collapsed"===e,p=(0,tm.isWorkspacePath)(i),f=(0,o.useIsMobile)(),h=(0,tm.workspaceIdFromLocation)(i,window.location.search),x=(0,ey.useWorkspaceStore)(e=>e.workspaces),w=(0,ey.useWorkspaceStore)(e=>e.setWorkspaces),k=(0,ey.useWorkspaceStore)(e=>e.upsertWorkspace),S=(0,ey.useWorkspaceStore)(e=>e.removeWorkspace),[C,E]=(0,r.useState)(!1),[D,I]=(0,r.useState)(!1),[V,el]=(0,r.useState)(!1),[ec,ed]=(0,r.useState)(!1),[eu,em]=(0,r.useState)(!1),[ep,ef]=(0,r.useState)(!1),[eh,eg]=(0,r.useState)(!1),[ex,ev]=(0,r.useState)(!1),[eb,ew]=(0,r.useState)(!1),[ej,eN]=(0,r.useState)(!1),[eS,eC]=(0,r.useState)(!1),[eE,eD]=(0,r.useState)(!1),[eI,eT]=(0,r.useState)(null),eM=(0,ey.useWorkspaceStore)(e=>e.createDialogOpen),eP=(0,ey.useWorkspaceStore)(e=>e.setCreateDialogOpen),[ez,eO]=(0,r.useState)(void 0),eL=(0,r.useCallback)(()=>{fetch("/api/workspaces").then(e=>e.json()).then(w).catch(()=>{})},[w]);(0,r.useEffect)(()=>{eL()},[eL]),(0,r.useEffect)(()=>{let e=()=>a(),t=e=>{let t=e.detail,n={agents:"/settings/agents",skills:"/settings/skills",prompts:"/settings/prompts","output-styles":"/settings/output-styles",mcps:"/settings/mcps",models:"/settings/models",providers:"/settings/providers",hooks:"/settings",commands:"/settings",settings:"/settings"};if(f&&n[t])return void c.push(n[t]);let r={agents:E,skills:em,prompts:ef,"output-styles":eg,mcps:ev,models:el,providers:ed,hooks:ew,commands:eN,tools:eC,settings:I};r[t]&&r[t](!0)};return window.addEventListener("toggle-sidebar",e),window.addEventListener("open-dialog",t),()=>{window.removeEventListener("toggle-sidebar",e),window.removeEventListener("open-dialog",t)}},[a,f]),(0,r.useEffect)(()=>{let e=e=>{s("toggleSidebar",e)&&(e.preventDefault(),a())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,s]);let eR=(0,to.useCommandPalette)(e=>e.registerMany);(0,r.useEffect)(()=>{let e=(e,t)=>{f||!t?c.push(e):t(!0)};return eR([{id:"toggle-sidebar",label:"Toggle Sidebar",group:"View",icon:q,action:()=>a()},{id:"latest-channel",label:"Open Latest Channel",group:"Navigation",icon:X.Hash,action:()=>{let{channels:e,setActiveChannel:t}=tl.useChannelStore.getState();e.length>0&&(t(e[e.length-1].id),td.useMobilePanelStore.getState().setActivePanel("chat"))}},{id:"latest-issue",label:"Open Latest Issue",group:"Navigation",icon:G.CircleDot,action:()=>{let{issues:e,setActiveIssue:t}=tc.useIssueStore.getState();e.length>0&&(t(e[e.length-1].id),td.useMobilePanelStore.getState().setActivePanel("issue-detail"))}},{id:"open-settings",label:"Open General Settings",group:"Settings",icon:A.Settings,action:()=>e("/settings",I)},{id:"open-agents",label:"Open Agent Settings",group:"Settings",icon:O.Bot,action:()=>e("/settings/agents",E)},{id:"open-skills",label:"Open Skills Settings",group:"Settings",icon:U.Sparkles,action:()=>e("/settings/skills",em)},{id:"open-prompts",label:"Open Prompt Settings",group:"Settings",icon:H.MessageSquare,action:()=>e("/settings/prompts",ef)},{id:"open-output-styles",label:"Open Output Style Settings",group:"Settings",icon:$.Pencil,action:()=>e("/settings/output-styles",eg)},{id:"open-mcps",label:"Open MCP Settings",group:"Settings",icon:K.Plug,action:()=>e("/settings/mcps",ev)},{id:"open-models",label:"Open Model Settings",group:"Settings",icon:L.Brain,action:()=>{f?c.push("/settings/models"):(eO(void 0),el(!0))}},{id:"open-providers",label:"Open Provider Settings",group:"Settings",icon:R.Server,action:()=>e("/settings/providers",ed)},{id:"open-hooks",label:"Open Hook Settings",group:"Settings",icon:J.Zap,action:()=>{f?c.push("/settings"):ew(!0)}},{id:"open-commands",label:"Open Agent Commands",group:"Settings",icon:Z.Terminal,action:()=>{f?c.push("/settings"):eN(!0)}},{id:"open-tools",label:"Open Tools Settings",group:"Settings",icon:Y.Wrench,action:()=>{f?c.push("/settings/tools"):eC(!0)}},{id:"open-workflows",label:"Open Workflow Settings",group:"Navigation",icon:B.GitBranch,action:()=>{c.push("/workflows")}}])},[eR,a,f]);let e$=async e=>{if(eI){let t=await fetch(`/api/workspaces/${eI.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});k(await t.json())}else{let t=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});k(await t.json())}},eF=async e=>{if(await fetch(`/api/workspaces/${e.id}`,{method:"DELETE"}),S(e.id),h===e.id){let t=x.filter(t=>t.id!==e.id);(0,M.tauriNavigate)(c,t.length>0?tp(t[0].id):"/")}},eB=[{id:"home",title:d("nav.home"),icon:(0,t.jsx)(z.Home,{className:"size-4"}),link:"/"},{id:"workspaces",title:d("nav.workspaces"),icon:(0,t.jsx)(_.FolderOpen,{className:"size-4"}),link:"/",onAdd:()=>{eT(null),eD(!0)},addLabel:d("nav.addWorkspace"),manageLink:"/workspaces",subs:[...x.filter(e=>!e.isWorktree).map(e=>({title:e.name,link:tp(e.id),icon:(0,t.jsx)(_.FolderOpen,{className:"size-4"}),menuItems:[{label:u("edit"),icon:(0,t.jsx)($.Pencil,{className:"size-3.5"}),onClick:()=>{eT(e),eD(!0)}},{label:u("open"),icon:(0,t.jsx)(W.FolderSearch,{className:"size-3.5"}),onClick:()=>fetch(`/api/workspaces/${e.id}/reveal`,{method:"POST"})},{label:u("delete"),icon:(0,t.jsx)(F.Trash2,{className:"size-3.5"}),variant:"destructive",onClick:()=>eF(e)}]}))]},{id:"workflows",title:d("nav.workflows"),icon:(0,t.jsx)(B.GitBranch,{className:"size-4"}),link:"/workflows"},{id:"settings",title:d("nav.settings"),icon:(0,t.jsx)(A.Settings,{className:"size-4"}),link:"#",subs:f?[{title:d("nav.general"),link:"/settings",icon:(0,t.jsx)(Y.Wrench,{className:"size-3.5"})},{title:d("nav.agents"),link:"/settings/agents",icon:(0,t.jsx)(O.Bot,{className:"size-3.5"})},{title:d("nav.skills"),link:"/settings/skills",icon:(0,t.jsx)(U.Sparkles,{className:"size-3.5"})},{title:d("nav.prompts"),link:"/settings/prompts",icon:(0,t.jsx)(H.MessageSquare,{className:"size-3.5"})},{title:d("nav.outputStyles"),link:"/settings/output-styles",icon:(0,t.jsx)($.Pencil,{className:"size-3.5"})},{title:d("nav.mcps"),link:"/settings/mcps",icon:(0,t.jsx)(K.Plug,{className:"size-3.5"})},{title:d("nav.tools"),link:"/settings/tools",icon:(0,t.jsx)(Y.Wrench,{className:"size-3.5"})},{title:d("nav.models"),link:"/settings/models",icon:(0,t.jsx)(L.Brain,{className:"size-3.5"})},{title:d("nav.providers"),link:"/settings/providers",icon:(0,t.jsx)(R.Server,{className:"size-3.5"})}]:[{title:d("nav.general"),link:"#",icon:(0,t.jsx)(Y.Wrench,{className:"size-3.5"}),onClick:()=>I(!0)},{title:d("nav.agents"),link:"#",icon:(0,t.jsx)(O.Bot,{className:"size-3.5"}),onClick:()=>E(!0)},{title:d("nav.skills"),link:"#",icon:(0,t.jsx)(U.Sparkles,{className:"size-3.5"}),onClick:()=>em(!0)},{title:d("nav.prompts"),link:"#",icon:(0,t.jsx)(H.MessageSquare,{className:"size-3.5"}),onClick:()=>ef(!0)},{title:d("nav.outputStyles"),link:"#",icon:(0,t.jsx)($.Pencil,{className:"size-3.5"}),onClick:()=>eg(!0)},{title:d("nav.mcps"),link:"#",icon:(0,t.jsx)(K.Plug,{className:"size-3.5"}),onClick:()=>ev(!0)},{title:d("nav.tools"),link:"#",icon:(0,t.jsx)(Y.Wrench,{className:"size-3.5"}),onClick:()=>eC(!0)},{title:d("nav.models"),link:"#",icon:(0,t.jsx)(L.Brain,{className:"size-3.5"}),onClick:()=>{eO(void 0),el(!0)}},{title:d("nav.providers"),link:"#",icon:(0,t.jsx)(R.Server,{className:"size-3.5"}),onClick:()=>ed(!0)},{title:d("nav.hooks"),link:"#",icon:(0,t.jsx)(J.Zap,{className:"size-3.5"}),onClick:()=>ew(!0)},{title:d("nav.commands"),link:"#",icon:(0,t.jsx)(Z.Terminal,{className:"size-3.5"}),onClick:()=>eN(!0)}]}];return(0,t.jsxs)(v,{variant:"floating",collapsible:"icon",className:(0,l.cn)("overflow-hidden",p&&"bg-[#f2f3f5] dark:bg-[#0f1117]"),children:[(0,t.jsxs)(j,{className:(0,l.cn)("flex shrink-0 rounded-xl border border-border bg-card mx-2 mt-2 px-3 py-2.5 shadow-[0_1px_3px_rgba(0,0,0,0.04)]",m?"flex-row items-center justify-between gap-y-4 md:flex-col md:items-center md:justify-center":"flex-row items-center justify-between"),children:[(0,t.jsx)("a",{href:"#",className:"flex items-center gap-2",children:(0,t.jsx)(Q.UserIcon,{size:m?"sm":"md"})}),(0,t.jsxs)(P.motion.div,{className:(0,l.cn)("flex items-center gap-2",m?"flex-row md:flex-col-reverse":"flex-row"),initial:{opacity:0},animate:{opacity:1},transition:{duration:.8},children:[(0,t.jsx)(e8,{workspaceId:h??""}),(0,t.jsx)(b,{})]},m?"header-collapsed":"header-expanded")]}),(0,t.jsx)(N,{className:"min-h-0 overflow-y-auto group-data-[collapsible=icon]:overflow-y-auto gap-2 mx-2 my-2 rounded-xl border border-border bg-card p-2 shadow-[0_1px_3px_rgba(0,0,0,0.04)]",children:(0,t.jsx)(eW,{routes:eB,pathname:i})}),(0,t.jsx)(y,{className:"shrink-0 mx-2 mb-2 rounded-xl border border-border bg-card p-2 shadow-[0_1px_3px_rgba(0,0,0,0.04)]",children:(0,t.jsx)(ts,{})}),(0,t.jsx)(ee.AgentDialog,{open:C,onOpenChange:E}),(0,t.jsx)(ea.SkillsDialog,{open:eu,onOpenChange:em}),(0,t.jsx)(es.PromptsDialog,{open:ep,onOpenChange:ef}),(0,t.jsx)(ei.OutputStylesDialog,{open:eh,onOpenChange:eg}),(0,t.jsx)(eo.McpsDialog,{open:ex,onOpenChange:ev}),(0,t.jsx)(ek,{open:eb,onOpenChange:ew}),(0,t.jsx)(e_,{open:ej,onOpenChange:eN}),(0,t.jsx)(eA.ToolsDialog,{open:eS,onOpenChange:eC}),(0,t.jsx)(er.SettingsDialog,{open:D,onOpenChange:I}),(0,t.jsx)(et.ModelsDialog,{open:V,onOpenChange:el,initialProvider:ez}),(0,t.jsx)(en.ProvidersDialog,{open:ec,onOpenChange:ed,onAddModel:e=>{eO(e),el(!0)}}),(0,t.jsx)(ti.WorkspaceDialog,{open:eE||eM,onOpenChange:e=>{eD(e),e||(eP(!1),eT(null))},workspace:eM?null:eI,onSubmit:e$})]})}var th=p;function tg(){let e=(0,ey.useWorkspaceStore)(e=>e.workspaces),{toggleSidebar:r}=g(),a=(0,n.useRouter)(),s=(0,n.usePathname)(),i=(0,n.useSearchParams)(),o=(0,tm.workspaceIdFromLocation)(s,i.toString());return(0,t.jsxs)("div",{className:"flex items-center h-12 px-3 bg-transparent overflow-x-auto shrink-0",children:[(0,t.jsx)("button",{onClick:()=>r(),className:"flex items-center justify-center size-8 rounded-lg text-muted-foreground hover:bg-accent/50 transition-colors shrink-0 md:hidden cursor-pointer",children:(0,t.jsx)(th.default,{size:16})}),(0,t.jsx)("div",{className:"flex items-center gap-1 rounded-xl p-1",children:e.filter(e=>!e.isWorktree).map(e=>(0,t.jsx)("button",{onClick:()=>{var t;return(0,M.tauriNavigate)(a,(t=e.id,`/workspace/${t}`))},className:(0,l.cn)("flex items-center gap-1.5 px-3.5 h-7 text-[13px] font-medium rounded-lg transition-all whitespace-nowrap",o===e.id?"bg-primary text-primary-foreground shadow-[rgba(0,0,0,0.08)_0px_4px_6px]":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:(0,t.jsx)("span",{className:"max-w-[160px] truncate",children:e.name})},e.id))})]})}e.i(8890);var tx=e.i(478189);function tv(){let[e,t]=(0,r.useState)(!1),[n,a]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{a(!0)},[]),(0,r.useEffect)(()=>{if(!e)return;let n=e=>{e.preventDefault(),e.stopPropagation();let n=e.target;if(!(n instanceof HTMLElement))return;let r=function(e){let t=e.closest("[data-inspector-relative-path]");if(t?.dataset.inspectorRelativePath)return{relativePath:t.dataset.inspectorRelativePath,lineNumber:t.dataset.inspectorLine??"1",columnNumber:t.dataset.inspectorColumn??"1"};let n=function e(t){if(!t)return;let n=Object.keys(t).find(e=>e.startsWith("__reactFiber$")||e.startsWith("__reactInternalInstance$"));return n?t[n]:e(t.parentElement)}(e);for(;n;){let e=n._debugSource??n._debugOwner?._debugSource;if(e?.fileName&&e.lineNumber)return{absolutePath:e.fileName,lineNumber:String(e.lineNumber),columnNumber:String(e.columnNumber??1)};n=n.return??void 0}}(n);t(!1),r&&(e=>{if(!e)return;let t="codeInfo"in e?e.codeInfo:e,{lineNumber:n,columnNumber:r,relativePath:a,absolutePath:s}=t,i=!!a,o=i?a:s;if(!o)return console.error("[react-dev-inspector] Cannot open editor without source fileName",t);let l=i?`${tx.default}/relative`:tx.default;fetch(`${l}?${new URLSearchParams({fileName:o,lineNumber:n,colNumber:r})}`)})(r)};return window.addEventListener("click",n,!0),()=>window.removeEventListener("click",n,!0)},[e]),null}e.s(["AppShell",0,function({children:e}){let a=(0,n.usePathname)(),[s,i]=(0,r.useState)(()=>{let e=localStorage.getItem("showWorkspaceTabs");return null===e||"false"!==e});return((0,r.useEffect)(()=>{let e=e=>i(e.detail);return window.addEventListener("workspace-tabs-visibility",e),()=>window.removeEventListener("workspace-tabs-visibility",e)},[]),(0,tm.isLoginPath)(a))?(0,t.jsx)(t.Fragment,{children:e}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tv,{}),(0,t.jsxs)(x,{className:"h-[var(--app-content-height)] min-h-0 bg-[#f2f3f5] dark:bg-[#0f1117]",children:[(0,t.jsx)(tf,{}),(0,t.jsxs)(w,{className:"!bg-transparent",children:[s&&(0,t.jsx)(tg,{}),e]})]})]})}],994876)},984642,e=>{"use strict";var t=e.i(344180),n=e.i(640376),r=e.i(683640),a=e.i(417092);e.s(["ConsolePanel",0,function(){let e=(0,n.useCommandPalette)(e=>e.toggle),s=(0,n.useCommandPalette)(e=>e.open);return(0,t.jsx)(a.FloatingBall,{lsKey:"console-panel:pos",onClick:e,visible:!s,style:{background:"#3b82f6",color:"white",boxShadow:"0 4px 12px rgba(59,130,246,0.4)"},children:(0,t.jsx)(r.Terminal,{size:18})})}])},694819,e=>{"use strict";var t=e.i(764556),n=e.i(515104);function r(){let e=document.documentElement,t=window.visualViewport,r=(0,n.isNativeEnvironment)()&&/Android/i.test(navigator.userAgent)?window.__agentSpacesNativeInsets?.top??0:0,a=t?.height??window.innerHeight,s=t?Math.max(0,window.innerHeight-t.height-t.offsetTop):0,i=Math.max(s,(0,n.isNativeEnvironment)()&&/Android/i.test(navigator.userAgent)?window.__agentSpacesNativeInsets?.keyboard??0:0),o=s>0?a:Math.max(0,window.innerHeight-i),l=Math.max(0,o-r);e.style.setProperty("--app-viewport-height",`${o}px`),e.style.setProperty("--app-content-height",`${l}px`),e.style.setProperty("--keyboard-inset-height",`${i}px`),e.style.setProperty("--app-top-inset",`${r}px`)}e.s(["ViewportInsets",0,function(){return(0,t.useEffect)(()=>{r();let e=e=>(function(e){if(!(e instanceof HTMLElement&&e.matches("input, textarea, [contenteditable='true'], [contenteditable='']")))return;let t=()=>{r(),e.scrollIntoView({block:"nearest",inline:"nearest"})};t(),window.setTimeout(t,60),window.setTimeout(t,180),window.setTimeout(t,360)})(e.target),t=window.visualViewport;return t?.addEventListener("resize",r),t?.addEventListener("scroll",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),window.addEventListener("agent-spaces-native-insets",r),document.addEventListener("focusin",e),()=>{t?.removeEventListener("resize",r),t?.removeEventListener("scroll",r),window.removeEventListener("resize",r),window.removeEventListener("orientationchange",r),window.removeEventListener("agent-spaces-native-insets",r),document.removeEventListener("focusin",e)}},[]),null}])},701341,e=>{"use strict";var t=e.i(344180),n=e.i(764556),r=e.i(515104);async function a(e){if(!(0,r.isFlutterEnvironment)())return;let t=window.__flutterBridge;if(t?.invoke)try{await t.invoke("setZoom",{scale:e/100})}catch{}}e.s(["ZoomWrapper",0,function({children:e}){return(0,n.useEffect)(()=>{let e=localStorage.getItem("pageZoom");if(e){let t=Number(e);t>=50&&t<=200&&a(t)}let t=e=>{let t=e.detail;"number"==typeof t&&t>=50&&t<=200&&a(t)};return window.addEventListener("zoom-change",t),()=>window.removeEventListener("zoom-change",t)},[]),(0,t.jsx)(t.Fragment,{children:e})}])},698679,e=>{"use strict";let t,n,r;var a,s,i,o,l,c,d,u,m,p=e.i(344180),f=e.i(764556),h=/[\\\/_+.#"@\[\(\{&]/,g=/[\\\/_+.#"@\[\(\{&]/g,x=/[\s-]/,v=/[\s-]/g;function b(e){return e.toLowerCase().replace(v," ")}function w(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function j(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function y(...e){return t=>{let n=!1,r=e.map(e=>{let r=j(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():j(e[t],null)}}}}function N(...e){return f.useCallback(y(...e),e)}"u">typeof window&&window.document&&window.document.createElement;var k=globalThis?.document?f.useLayoutEffect:()=>{},S=f[" useId ".trim().toString()]||(()=>void 0),C=0;function E(e){let[t,n]=f.useState(S());return k(()=>{e||n(e=>e??String(C++))},[e]),e||(t?`radix-${t}`:"")}f[" useEffectEvent ".trim().toString()],f[" useInsertionEffect ".trim().toString()];var D=f[" useInsertionEffect ".trim().toString()]||k;Symbol("RADIX:SYNC_STATE");var I=e.i(106206);function T(e){var t;let n,r=(t=e,(n=f.forwardRef((e,t)=>{let{children:n,...r}=e;if(f.isValidElement(n)){var a;let e,s,i=(a=n,(s=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(s=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),o=function(e,t){let n={...t};for(let r in t){let a=e[r],s=t[r];/^on[A-Z]/.test(r)?a&&s?n[r]=(...e)=>{let t=s(...e);return a(...e),t}:a&&(n[r]=a):"style"===r?n[r]={...a,...s}:"className"===r&&(n[r]=[a,s].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==f.Fragment&&(o.ref=t?y(t,i):i),f.cloneElement(n,o)}return f.Children.count(n)>1?f.Children.only(null):null})).displayName=`${t}.SlotClone`,n),a=f.forwardRef((e,t)=>{let{children:n,...a}=e,s=f.Children.toArray(n),i=s.find(P);if(i){let e=i.props.children,n=s.map(t=>t!==i?t:f.Children.count(e)>1?f.Children.only(null):f.isValidElement(e)?e.props.children:null);return(0,p.jsx)(r,{...a,ref:t,children:f.isValidElement(e)?f.cloneElement(e,void 0,n):null})}return(0,p.jsx)(r,{...a,ref:t,children:n})});return a.displayName=`${e}.Slot`,a}var M=Symbol("radix.slottable");function P(e){return f.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===M}var z=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=T(`Primitive.${t}`),r=f.forwardRef((e,r)=>{let{asChild:a,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,p.jsx)(a?n:t,{...s,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function _(e){let t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...e)=>t.current?.(...e),[])}var A="dismissableLayer.update",O=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),L=f.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:i,onDismiss:o,...l}=e,c=f.useContext(O),[d,m]=f.useState(null),h=d?.ownerDocument??globalThis?.document,[,g]=f.useState({}),x=N(t,e=>m(e)),v=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),j=v.indexOf(b),y=d?v.indexOf(d):-1,k=c.layersWithOutsidePointerEventsDisabled.size>0,S=y>=j,C=function(e,t=globalThis?.document){let n=_(e),r=f.useRef(!1),a=f.useRef(()=>{});return f.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){$("dismissableLayer.pointerDownOutside",n,s,{discrete:!0})},s={originalEvent:e};"touch"===e.pointerType?(t.removeEventListener("click",a.current),a.current=r,t.addEventListener("click",a.current,{once:!0})):r()}else t.removeEventListener("click",a.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",e)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",e),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}(e=>{let t=e.target,n=[...c.branches].some(e=>e.contains(t));S&&!n&&(a?.(e),i?.(e),e.defaultPrevented||o?.())},h),E=function(e,t=globalThis?.document){let n=_(e),r=f.useRef(!1);return f.useEffect(()=>{let e=e=>{e.target&&!r.current&&$("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{let t=e.target;![...c.branches].some(e=>e.contains(t))&&(s?.(e),i?.(e),e.defaultPrevented||o?.())},h);return!function(e,t=globalThis?.document){let n=_(e);f.useEffect(()=>{let e=e=>{"Escape"===e.key&&n(e)};return t.addEventListener("keydown",e,{capture:!0}),()=>t.removeEventListener("keydown",e,{capture:!0})},[n,t])}(e=>{y===c.layers.size-1&&(r?.(e),!e.defaultPrevented&&o&&(e.preventDefault(),o()))},h),f.useEffect(()=>{if(d)return n&&(0===c.layersWithOutsidePointerEventsDisabled.size&&(u=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),R(),()=>{n&&1===c.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=u)}},[d,h,n,c]),f.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),R())},[d,c]),f.useEffect(()=>{let e=()=>g({});return document.addEventListener(A,e),()=>document.removeEventListener(A,e)},[]),(0,p.jsx)(z.div,{...l,ref:x,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:w(e.onFocusCapture,E.onFocusCapture),onBlurCapture:w(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:w(e.onPointerDownCapture,C.onPointerDownCapture)})});function R(){let e=new CustomEvent(A);document.dispatchEvent(e)}function $(e,t,n,{discrete:r}){let a=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});if(t&&a.addEventListener(e,t,{once:!0}),r)a&&I.flushSync(()=>a.dispatchEvent(s));else a.dispatchEvent(s)}L.displayName="DismissableLayer",f.forwardRef((e,t)=>{let n=f.useContext(O),r=f.useRef(null),a=N(t,r);return f.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,p.jsx)(z.div,{...e,ref:a})}).displayName="DismissableLayerBranch";var F="focusScope.autoFocusOnMount",W="focusScope.autoFocusOnUnmount",B={bubbles:!1,cancelable:!0},U=f.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=e,[o,l]=f.useState(null),c=_(a),d=_(s),u=f.useRef(null),m=N(t,e=>l(e)),h=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(r){let e=function(e){if(h.paused||!o)return;let t=e.target;o.contains(t)?u.current=t:V(u.current,{select:!0})},t=function(e){if(h.paused||!o)return;let t=e.relatedTarget;null!==t&&(o.contains(t)||V(u.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let n=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&V(o)});return o&&n.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),n.disconnect()}}},[r,o,h.paused]),f.useEffect(()=>{if(o){q.add(h);let e=document.activeElement;if(!o.contains(e)){let t=new CustomEvent(F,B);o.addEventListener(F,c),o.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(V(r,{select:t}),document.activeElement!==n)return}(H(o).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&V(o))}return()=>{o.removeEventListener(F,c),setTimeout(()=>{let t=new CustomEvent(W,B);o.addEventListener(W,d),o.dispatchEvent(t),t.defaultPrevented||V(e??document.body,{select:!0}),o.removeEventListener(W,d),q.remove(h)},0)}}},[o,c,d,h]);let g=f.useCallback(e=>{if(!n&&!r||h.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){var s;let t,r=e.currentTarget,[i,o]=[K(t=H(s=r),s),K(t.reverse(),s)];i&&o?e.shiftKey||a!==o?e.shiftKey&&a===i&&(e.preventDefault(),n&&V(o,{select:!0})):(e.preventDefault(),n&&V(i,{select:!0})):a===r&&e.preventDefault()}},[n,r,h.paused]);return(0,p.jsx)(z.div,{tabIndex:-1,...i,ref:m,onKeyDown:g})});function H(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function K(e,t){for(let n of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(n,{upTo:t}))return n}function V(e,{select:t=!1}={}){if(e&&e.focus){var n;let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&(n=e)instanceof HTMLInputElement&&"select"in n&&t&&e.select()}}U.displayName="FocusScope";var q=(r=[],{add(e){let t=r[0];e!==t&&t?.pause(),(r=X(r,e)).unshift(e)},remove(e){r=X(r,e),r[0]?.resume()}});function X(e,t){let n=[...e],r=n.indexOf(t);return -1!==r&&n.splice(r,1),n}var G=f.forwardRef((e,t)=>{let{container:n,...r}=e,[a,s]=f.useState(!1);k(()=>s(!0),[]);let i=n||a&&globalThis?.document?.body;return i?I.default.createPortal((0,p.jsx)(z.div,{...r,ref:t}),i):null});G.displayName="Portal";var J=e=>{var t;let n,r,{present:a,children:s}=e,i=function(e){var t,n;let[r,a]=f.useState(),s=f.useRef(null),i=f.useRef(e),o=f.useRef("none"),[l,c]=(t=e?"mounted":"unmounted",n={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},f.useReducer((e,t)=>n[e][t]??e,t));return f.useEffect(()=>{let e=Y(s.current);o.current="mounted"===l?e:"none"},[l]),k(()=>{let t=s.current,n=i.current;if(n!==e){let r=o.current,a=Y(t);e?c("MOUNT"):"none"===a||t?.display==="none"?c("UNMOUNT"):n&&r!==a?c("ANIMATION_OUT"):c("UNMOUNT"),i.current=e}},[e,c]),k(()=>{if(r){let e,t=r.ownerDocument.defaultView??window,n=n=>{let a=Y(s.current).includes(CSS.escape(n.animationName));if(n.target===r&&a&&(c("ANIMATION_END"),!i.current)){let n=r.style.animationFillMode;r.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=n)})}},a=e=>{e.target===r&&(o.current=Y(s.current))};return r.addEventListener("animationstart",a),r.addEventListener("animationcancel",n),r.addEventListener("animationend",n),()=>{t.clearTimeout(e),r.removeEventListener("animationstart",a),r.removeEventListener("animationcancel",n),r.removeEventListener("animationend",n)}}c("ANIMATION_END")},[r,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:f.useCallback(e=>{s.current=e?getComputedStyle(e):null,a(e)},[])}}(a),o="function"==typeof s?s({present:i.isPresent}):f.Children.only(s),l=N(i.ref,(t=o,(r=(n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in n&&n.isReactWarning)?t.ref:(r=(n=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in n&&n.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof s||i.isPresent?f.cloneElement(o,{ref:l}):null};function Y(e){return e?.animationName||"none"}J.displayName="Presence";var Z=0;function Q(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ee=e.i(824627),et="right-scroll-bar-position",en="width-before-scroll-bar";function er(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var ea="u">typeof window?f.useLayoutEffect:f.useEffect,es=new WeakMap,ei=(void 0===a&&(a={}),(void 0===s&&(s=function(e){return e}),i=[],o=!1,l={read:function(){if(o)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:null},useMedium:function(e){var t=s(e,o);return i.push(t),function(){i=i.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(o=!0;i.length;){var t=i;i=[],t.forEach(e)}i={push:function(t){return e(t)},filter:function(){return i}}},assignMedium:function(e){o=!0;var t=[];if(i.length){var n=i;i=[],n.forEach(e),t=i}var r=function(){var n=t;t=[],n.forEach(e)},a=function(){return Promise.resolve().then(r)};a(),i={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),i}}}}).options=(0,ee.__assign)({async:!0,ssr:!1},a),l),eo=function(){},el=f.forwardRef(function(e,t){var n,r,a,s,i=f.useRef(null),o=f.useState({onScrollCapture:eo,onWheelCapture:eo,onTouchMoveCapture:eo}),l=o[0],c=o[1],d=e.forwardProps,u=e.children,m=e.className,p=e.removeScrollBar,h=e.enabled,g=e.shards,x=e.sideCar,v=e.noRelative,b=e.noIsolation,w=e.inert,j=e.allowPinchZoom,y=e.as,N=e.gapMode,k=(0,ee.__rest)(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=(n=[i,t],r=function(e){return n.forEach(function(t){return er(t,e)})},(a=(0,f.useState)(function(){return{value:null,callback:r,facade:{get current(){return a.value},set current(value){var e=a.value;e!==value&&(a.value=value,a.callback(value,e))}}}})[0]).callback=r,s=a.facade,ea(function(){var e=es.get(s);if(e){var t=new Set(e),r=new Set(n),a=s.current;t.forEach(function(e){r.has(e)||er(e,null)}),r.forEach(function(e){t.has(e)||er(e,a)})}es.set(s,n)},[n]),s),C=(0,ee.__assign)((0,ee.__assign)({},k),l);return f.createElement(f.Fragment,null,h&&f.createElement(x,{sideCar:ei,removeScrollBar:p,shards:g,noRelative:v,noIsolation:b,inert:w,setCallbacks:c,allowPinchZoom:!!j,lockRef:i,gapMode:N}),d?f.cloneElement(f.Children.only(u),(0,ee.__assign)((0,ee.__assign)({},C),{ref:S})):f.createElement(void 0===y?"div":y,(0,ee.__assign)({},C,{className:m,ref:S}),u))});el.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},el.classNames={fullWidth:en,zeroRight:et};var ec=function(e){var t=e.sideCar,n=(0,ee.__rest)(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return f.createElement(r,(0,ee.__assign)({},n))};ec.isSideCarExport=!0;var ed=function(){var e=0,t=null;return{add:function(n){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=m||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var r,a;(r=t).styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n)),a=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(a)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},eu=function(){var e=ed();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},em=function(){var e=eu();return function(t){return e(t.styles,t.dynamic),null}},ep={left:0,top:0,right:0,gap:0},ef=function(e){return parseInt(e||"",10)||0},eh=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[ef(n),ef(r),ef(a)]},eg=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return ep;var t=eh(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},ex=em(),ev="data-scroll-locked",eb=function(e,t,n,r){var a=e.left,s=e.top,i=e.right,o=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(o,"px ").concat(r,";\n }\n body[").concat(ev,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(s,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(o,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(o,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(et," {\n right: ").concat(o,"px ").concat(r,";\n }\n \n .").concat(en," {\n margin-right: ").concat(o,"px ").concat(r,";\n }\n \n .").concat(et," .").concat(et," {\n right: 0 ").concat(r,";\n }\n \n .").concat(en," .").concat(en," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(ev,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(o,"px;\n }\n")},ew=function(){var e=parseInt(document.body.getAttribute(ev)||"0",10);return isFinite(e)?e:0},ej=function(){f.useEffect(function(){return document.body.setAttribute(ev,(ew()+1).toString()),function(){var e=ew()-1;e<=0?document.body.removeAttribute(ev):document.body.setAttribute(ev,e.toString())}},[])},ey=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=void 0===r?"margin":r;ej();var s=f.useMemo(function(){return eg(a)},[a]);return f.createElement(ex,{styles:eb(s,!t,a,n?"":"!important")})},eN=!1;if("u">typeof window)try{var ek=Object.defineProperty({},"passive",{get:function(){return eN=!0,!0}});window.addEventListener("test",ek,ek),window.removeEventListener("test",ek,ek)}catch(e){eN=!1}var eS=!!eN&&{passive:!1},eC=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&(n.overflowY!==n.overflowX||"TEXTAREA"===e.tagName||"visible"!==n[t])},eE=function(e,t){var n=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),eD(e,r)){var a=eI(e,r);if(a[1]>a[2])return!0}r=r.parentNode}while(r&&r!==n.body)return!1},eD=function(e,t){return"v"===e?eC(t,"overflowY"):eC(t,"overflowX")},eI=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},eT=function(e,t,n,r,a){var s,i=(s=window.getComputedStyle(t).direction,"h"===e&&"rtl"===s?-1:1),o=i*r,l=n.target,c=t.contains(l),d=!1,u=o>0,m=0,p=0;do{if(!l)break;var f=eI(e,l),h=f[0],g=f[1]-f[2]-i*h;(h||g)&&eD(e,l)&&(m+=g,p+=h);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&l!==document.body||c&&(t.contains(l)||t===l))return u&&(a&&1>Math.abs(m)||!a&&o>m)?d=!0:!u&&(a&&1>Math.abs(p)||!a&&-o>p)&&(d=!0),d},eM=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},eP=function(e){return[e.deltaX,e.deltaY]},ez=function(e){return e&&"current"in e?e.current:e},e_=0,eA=[];let eO=(c=function(e){var t=f.useRef([]),n=f.useRef([0,0]),r=f.useRef(),a=f.useState(e_++)[0],s=f.useState(em)[0],i=f.useRef(e);f.useEffect(function(){i.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=(0,ee.__spreadArray)([e.lockRef.current],(e.shards||[]).map(ez),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var o=f.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,s=eM(e),o=n.current,l="deltaX"in e?e.deltaX:o[0]-s[0],c="deltaY"in e?e.deltaY:o[1]-s[1],d=e.target,u=Math.abs(l)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var m=window.getSelection(),p=m&&m.anchorNode;if(p&&(p===d||p.contains(d)))return!1;var f=eE(u,d);if(!f)return!0;if(f?a=u:(a="v"===u?"h":"v",f=eE(u,d)),!f)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=a),!a)return!0;var h=r.current||a;return eT(h,t,e,"h"===h?l:c,!0)},[]),l=f.useCallback(function(e){if(eA.length&&eA[eA.length-1]===s){var n="deltaY"in e?eP(e):eM(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===n[0]&&r[1]===n[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var a=(i.current.shards||[]).map(ez).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?o(e,a[0]):!i.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=f.useCallback(function(e,n,r,a){var s={name:e,delta:n,target:r,should:a,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(s),setTimeout(function(){t.current=t.current.filter(function(e){return e!==s})},1)},[]),d=f.useCallback(function(e){n.current=eM(e),r.current=void 0},[]),u=f.useCallback(function(t){c(t.type,eP(t),t.target,o(t,e.lockRef.current))},[]),m=f.useCallback(function(t){c(t.type,eM(t),t.target,o(t,e.lockRef.current))},[]);f.useEffect(function(){return eA.push(s),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:m}),document.addEventListener("wheel",l,eS),document.addEventListener("touchmove",l,eS),document.addEventListener("touchstart",d,eS),function(){eA=eA.filter(function(e){return e!==s}),document.removeEventListener("wheel",l,eS),document.removeEventListener("touchmove",l,eS),document.removeEventListener("touchstart",d,eS)}},[]);var p=e.removeScrollBar,h=e.inert;return f.createElement(f.Fragment,null,h?f.createElement(s,{styles:"\n .block-interactivity-".concat(a," {pointer-events: none;}\n .allow-interactivity-").concat(a," {pointer-events: all;}\n")}):null,p?f.createElement(ey,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},ei.useMedium(c),ec);var eL=f.forwardRef(function(e,t){return f.createElement(el,(0,ee.__assign)({},e,{ref:t,sideCar:eO}))});eL.classNames=el.classNames;var eR=new WeakMap,e$=new WeakMap,eF={},eW=0,eB=function(e){return e&&(e.host||eB(e.parentNode))},eU=function(e,t,n,r){var a=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var n=eB(e);return n&&t.contains(n)?n:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});eF[n]||(eF[n]=new WeakMap);var s=eF[n],i=[],o=new Set,l=new Set(a),c=function(e){!e||o.has(e)||(o.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){!e||l.has(e)||Array.prototype.forEach.call(e.children,function(e){if(o.has(e))d(e);else try{var t=e.getAttribute(r),a=null!==t&&"false"!==t,l=(eR.get(e)||0)+1,c=(s.get(e)||0)+1;eR.set(e,l),s.set(e,c),i.push(e),1===l&&a&&e$.set(e,!0),1===c&&e.setAttribute(n,"true"),a||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),o.clear(),eW++,function(){i.forEach(function(e){var t=eR.get(e)-1,a=s.get(e)-1;eR.set(e,t),s.set(e,a),t||(e$.has(e)||e.removeAttribute(r),e$.delete(e)),a||e.removeAttribute(n)}),--eW||(eR=new WeakMap,eR=new WeakMap,e$=new WeakMap,eF={})}},eH=function(e,t,n){void 0===n&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),eU(r,a,n,"aria-hidden")):function(){return null}},eK="Dialog",[eV,eq]=function(e,t=[]){let n=[],r=()=>{let t=n.map(e=>f.createContext(e));return function(n){let r=n?.[e]||t;return f.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){let a=f.createContext(r),s=n.length;n=[...n,r];let i=t=>{let{scope:n,children:r,...i}=t,o=n?.[e]?.[s]||a,l=f.useMemo(()=>i,Object.values(i));return(0,p.jsx)(o.Provider,{value:l,children:r})};return i.displayName=t+"Provider",[i,function(n,i){let o=i?.[e]?.[s]||a,l=f.useContext(o);if(l)return l;if(void 0!==r)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let a=n(e)[`__scope${r}`];return{...t,...a}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}(r,...t)]}(eK),[eX,eG]=eV(eK),eJ=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:s,modal:i=!0}=e,o=f.useRef(null),l=f.useRef(null),[c,d]=function({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[a,s,i]=function({defaultProp:e,onChange:t}){let[n,r]=f.useState(e),a=f.useRef(n),s=f.useRef(t);return D(()=>{s.current=t},[t]),f.useEffect(()=>{a.current!==n&&(s.current?.(n),a.current=n)},[n,a]),[n,r,s]}({defaultProp:t,onChange:n}),o=void 0!==e,l=o?e:a;{let t=f.useRef(void 0!==e);f.useEffect(()=>{let e=t.current;if(e!==o){let t=o?"controlled":"uncontrolled";console.warn(`${r} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=o},[o,r])}return[l,f.useCallback(t=>{if(o){let n="function"==typeof t?t(e):t;n!==e&&i.current?.(n)}else s(t)},[o,e,s,i])]}({prop:r,defaultProp:a??!1,onChange:s,caller:eK});return(0,p.jsx)(eX,{scope:t,triggerRef:o,contentRef:l,contentId:E(),titleId:E(),descriptionId:E(),open:c,onOpenChange:d,onOpenToggle:f.useCallback(()=>d(e=>!e),[d]),modal:i,children:n})};eJ.displayName=eK;var eY="DialogTrigger";f.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=eG(eY,n),s=N(t,a.triggerRef);return(0,p.jsx)(z.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":ta(a.open),...r,ref:s,onClick:w(e.onClick,a.onOpenToggle)})}).displayName=eY;var eZ="DialogPortal",[eQ,e0]=eV(eZ,{forceMount:void 0}),e1=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:a}=e,s=eG(eZ,t);return(0,p.jsx)(eQ,{scope:t,forceMount:n,children:f.Children.map(r,e=>(0,p.jsx)(J,{present:n||s.open,children:(0,p.jsx)(G,{asChild:!0,container:a,children:e})}))})};e1.displayName=eZ;var e2="DialogOverlay",e5=f.forwardRef((e,t)=>{let n=e0(e2,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,s=eG(e2,e.__scopeDialog);return s.modal?(0,p.jsx)(J,{present:r||s.open,children:(0,p.jsx)(e4,{...a,ref:t})}):null});e5.displayName=e2;var e3=T("DialogOverlay.RemoveScroll"),e4=f.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=eG(e2,n);return(0,p.jsx)(eL,{as:e3,allowPinchZoom:!0,shards:[a.contentRef],children:(0,p.jsx)(z.div,{"data-state":ta(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),e6="DialogContent",e8=f.forwardRef((e,t)=>{let n=e0(e6,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,s=eG(e6,e.__scopeDialog);return(0,p.jsx)(J,{present:r||s.open,children:s.modal?(0,p.jsx)(e9,{...a,ref:t}):(0,p.jsx)(e7,{...a,ref:t})})});e8.displayName=e6;var e9=f.forwardRef((e,t)=>{let n=eG(e6,e.__scopeDialog),r=f.useRef(null),a=N(t,n.contentRef,r);return f.useEffect(()=>{let e=r.current;if(e)return eH(e)},[]),(0,p.jsx)(te,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:w(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:w(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:w(e.onFocusOutside,e=>e.preventDefault())})}),e7=f.forwardRef((e,t)=>{let n=eG(e6,e.__scopeDialog),r=f.useRef(!1),a=f.useRef(!1);return(0,p.jsx)(te,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));let s=t.target;n.triggerRef.current?.contains(s)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})}),te=f.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:s,...i}=e,o=eG(e6,n),l=f.useRef(null),c=N(t,l);return f.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Q()),document.body.insertAdjacentElement("beforeend",e[1]??Q()),Z++,()=>{1===Z&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Z--}},[]),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(U,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:s,children:(0,p.jsx)(L,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":ta(o.open),...i,ref:c,onDismiss:()=>o.onOpenChange(!1)})}),(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(tl,{titleId:o.titleId}),(0,p.jsx)(tc,{contentRef:l,descriptionId:o.descriptionId})]})]})}),tt="DialogTitle";f.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=eG(tt,n);return(0,p.jsx)(z.h2,{id:a.titleId,...r,ref:t})}).displayName=tt;var tn="DialogDescription";f.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=eG(tn,n);return(0,p.jsx)(z.p,{id:a.descriptionId,...r,ref:t})}).displayName=tn;var tr="DialogClose";function ta(e){return e?"open":"closed"}f.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=eG(tr,n);return(0,p.jsx)(z.button,{type:"button",...r,ref:t,onClick:w(e.onClick,()=>a.onOpenChange(!1))})}).displayName=tr;var ts="DialogTitleWarning",[ti,to]=(d={contentName:e6,titleName:tt,docsSlug:"dialog"},t=f.createContext(d),(n=e=>{let{children:n,...r}=e,a=f.useMemo(()=>r,Object.values(r));return(0,p.jsx)(t.Provider,{value:a,children:n})}).displayName=ts+"Provider",[n,function(e){let n=f.useContext(t);if(n)return n;if(void 0!==d)return d;throw Error(`\`${e}\` must be used within \`${ts}\``)}]),tl=({titleId:e})=>{let t=to(ts),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
|
+
|
|
3
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
|
+
|
|
5
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},tc=({contentRef:e,descriptionId:t})=>{let n=to("DialogDescriptionWarning"),r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${n.contentName}}.`;return f.useEffect(()=>{let n=e.current?.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},td='[cmdk-group=""]',tu='[cmdk-group-items=""]',tm='[cmdk-item=""]',tp=`${tm}:not([aria-disabled="true"])`,tf="cmdk-item-select",th="data-value",tg=(e,t,n)=>{var r;return r=e,function e(t,n,r,a,s,i,o){if(i===n.length)return s===t.length?1:.99;var l=`${s},${i}`;if(void 0!==o[l])return o[l];for(var c,d,u,m,p=a.charAt(i),f=r.indexOf(p,s),b=0;f>=0;)(c=e(t,n,r,a,f+1,i+1,o))>b&&(f===s?c*=1:h.test(t.charAt(f-1))?(c*=.8,(u=t.slice(s,f-1).match(g))&&s>0&&(c*=Math.pow(.999,u.length))):x.test(t.charAt(f-1))?(c*=.9,(m=t.slice(s,f-1).match(v))&&s>0&&(c*=Math.pow(.999,m.length))):(c*=.17,s>0&&(c*=Math.pow(.999,f-s))),t.charAt(f)!==n.charAt(i)&&(c*=.9999)),(c<.1&&r.charAt(f-1)===a.charAt(i+1)||a.charAt(i+1)===a.charAt(i)&&r.charAt(f-1)!==a.charAt(i))&&.1*(d=e(t,n,r,a,f+1,i+2,o))>c&&(c=.1*d),c>b&&(b=c),f=r.indexOf(p,f+1);return o[l]=b,b}(r=n&&n.length>0?`${r+" "+n.join(" ")}`:r,t,b(r),b(t),0,0,{})},tx=f.createContext(void 0),tv=f.createContext(void 0),tb=f.createContext(void 0),tw=f.forwardRef((e,t)=>{let n=tT(()=>{var t,n;return{search:"",value:null!=(n=null!=(t=e.value)?t:e.defaultValue)?n:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=tT(()=>new Set),a=tT(()=>new Map),s=tT(()=>new Map),i=tT(()=>new Set),o=tD(e),{label:l,children:c,value:d,onValueChange:u,filter:m,shouldFilter:p,loop:h,disablePointerSelection:g=!1,vimBindings:x=!0,...v}=e,b=E(),w=E(),j=E(),y=f.useRef(null),N=tz();tI(()=>{if(void 0!==d){let e=d.trim();n.current.value=e,k.emit()}},[d]),tI(()=>{N(6,M)},[]);let k=f.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var a,s,i,l;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)T(),D(),N(1,I);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(j);e?e.focus():null==(a=document.getElementById(b))||a.focus()}if(N(7,()=>{var e;n.current.selectedItemId=null==(e=P())?void 0:e.id,k.emit()}),r||N(5,M),(null==(s=o.current)?void 0:s.value)!==void 0){null==(l=(i=o.current).onValueChange)||l.call(i,null!=t?t:"");return}}k.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),S=f.useMemo(()=>({value:(e,t,r)=>{var a;t!==(null==(a=s.current.get(e))?void 0:a.value)&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,C(t,r)),N(2,()=>{D(),k.emit()}))},item:(e,t)=>(r.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),N(3,()=>{T(),D(),n.current.value||I(),k.emit()}),()=>{s.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=P();N(4,()=>{T(),(null==t?void 0:t.getAttribute("id"))===e&&I(),k.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{s.current.delete(e),a.current.delete(e)}),filter:()=>o.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:b,inputId:j,labelId:w,listInnerRef:y}),[]);function C(e,t){var r,a;let s=null!=(a=null==(r=o.current)?void 0:r.filter)?a:tg;return e?s(e,n.current.search,t):0}function D(){if(!n.current.search||!1===o.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=a.current.get(n),s=0;r.forEach(t=>{s=Math.max(e.get(t),s)}),t.push([n,s])});let r=y.current;_().sort((t,n)=>{var r,a;let s=t.getAttribute("id"),i=n.getAttribute("id");return(null!=(r=e.get(i))?r:0)-(null!=(a=e.get(s))?a:0)}).forEach(e=>{let t=e.closest(tu);t?t.appendChild(e.parentElement===t?e:e.closest(`${tu} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${tu} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let n=null==(t=y.current)?void 0:t.querySelector(`${td}[${th}="${encodeURIComponent(e[0])}"]`);null==n||n.parentElement.appendChild(n)})}function I(){let e=_().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(th);k.setState("value",t||void 0)}function T(){var e,t,i,l;if(!n.current.search||!1===o.current.shouldFilter){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let c=0;for(let a of r.current){let r=C(null!=(t=null==(e=s.current.get(a))?void 0:e.value)?t:"",null!=(l=null==(i=s.current.get(a))?void 0:i.keywords)?l:[]);n.current.filtered.items.set(a,r),r>0&&c++}for(let[e,t]of a.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=c}function M(){var e,t,n;let r=P();r&&((null==(e=r.parentElement)?void 0:e.firstChild)===r&&(null==(n=null==(t=r.closest(td))?void 0:t.querySelector('[cmdk-group-heading=""]'))||n.scrollIntoView({block:"nearest"})),r.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=y.current)?void 0:e.querySelector(`${tm}[aria-selected="true"]`)}function _(){var e;return Array.from((null==(e=y.current)?void 0:e.querySelectorAll(tp))||[])}function A(e){let t=_()[e];t&&k.setState("value",t.getAttribute(th))}function O(e){var t;let n=P(),r=_(),a=r.findIndex(e=>e===n),s=r[a+e];null!=(t=o.current)&&t.loop&&(s=a+e<0?r[r.length-1]:a+e===r.length?r[0]:r[a+e]),s&&k.setState("value",s.getAttribute(th))}function L(e){let t=P(),n=null==t?void 0:t.closest(td),r;for(;n&&!r;)r=null==(n=e>0?function(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}(n,td):function(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}(n,td))?void 0:n.querySelector(tp);r?k.setState("value",r.getAttribute(th)):O(e)}let R=()=>A(_().length-1),$=e=>{e.preventDefault(),e.metaKey?R():e.altKey?L(1):O(1)},F=e=>{e.preventDefault(),e.metaKey?A(0):e.altKey?L(-1):O(-1)};return f.createElement(z.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=v.onKeyDown)||t.call(v,e);let n=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||n))switch(e.key){case"n":case"j":x&&e.ctrlKey&&$(e);break;case"ArrowDown":$(e);break;case"p":case"k":x&&e.ctrlKey&&F(e);break;case"ArrowUp":F(e);break;case"Home":e.preventDefault(),A(0);break;case"End":e.preventDefault(),R();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(tf);t.dispatchEvent(e)}}}}},f.createElement("label",{"cmdk-label":"",htmlFor:S.inputId,id:S.labelId,style:tA},l),t_(e,e=>f.createElement(tv.Provider,{value:k},f.createElement(tx.Provider,{value:S},e))))}),tj=f.forwardRef((e,t)=>{var n,r;let a=E(),s=f.useRef(null),i=f.useContext(tb),o=f.useContext(tx),l=tD(e),c=null!=(r=null==(n=l.current)?void 0:n.forceMount)?r:null==i?void 0:i.forceMount;tI(()=>{if(!c)return o.item(a,null==i?void 0:i.id)},[c]);let d=tP(a,s,[e.value,e.children,s],e.keywords),u=f.useContext(tv),m=tM(e=>e.value&&e.value===d.current),p=tM(e=>!!c||!1===o.filter()||!e.search||e.filtered.items.get(a)>0);function h(){var e,t;g(),null==(t=(e=l.current).onSelect)||t.call(e,d.current)}function g(){u.setState("value",d.current,!0)}if(f.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(tf,h),()=>t.removeEventListener(tf,h)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:x,value:v,onSelect:b,forceMount:w,keywords:j,...N}=e;return f.createElement(z.div,{ref:y(s,t),...N,id:a,"cmdk-item":"",role:"option","aria-disabled":!!x,"aria-selected":!!m,"data-disabled":!!x,"data-selected":!!m,onPointerMove:x||o.getDisablePointerSelection()?void 0:g,onClick:x?void 0:h},e.children)}),ty=f.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...s}=e,i=E(),o=f.useRef(null),l=f.useRef(null),c=E(),d=f.useContext(tx),u=tM(e=>!!a||!1===d.filter()||!e.search||e.filtered.groups.has(i));tI(()=>d.group(i),[]),tP(i,o,[e.value,e.heading,l]);let m=f.useMemo(()=>({id:i,forceMount:a}),[a]);return f.createElement(z.div,{ref:y(o,t),...s,"cmdk-group":"",role:"presentation",hidden:!u||void 0},n&&f.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),t_(e,e=>f.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},f.createElement(tb.Provider,{value:m},e))))}),tN=f.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=f.useRef(null),s=tM(e=>!e.search);return n||s?f.createElement(z.div,{ref:y(a,t),...r,"cmdk-separator":"",role:"separator"}):null}),tk=f.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=null!=e.value,s=f.useContext(tv),i=tM(e=>e.search),o=tM(e=>e.selectedItemId),l=f.useContext(tx);return f.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),f.createElement(z.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":o,id:l.inputId,type:"text",value:a?e.value:i,onChange:e=>{a||s.setState("search",e.target.value),null==n||n(e.target.value)}})}),tS=f.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,s=f.useRef(null),i=f.useRef(null),o=tM(e=>e.selectedItemId),l=f.useContext(tx);return f.useEffect(()=>{if(i.current&&s.current){let e=i.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty("--cmdk-list-height",n.toFixed(1)+"px")})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),f.createElement(z.div,{ref:y(s,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:l.listId},t_(e,e=>f.createElement("div",{ref:y(i,l.listInnerRef),"cmdk-list-sizer":""},e)))}),tC=f.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:s,container:i,...o}=e;return f.createElement(eJ,{open:n,onOpenChange:r},f.createElement(e1,{container:i},f.createElement(e5,{"cmdk-overlay":"",className:a}),f.createElement(e8,{"aria-label":e.label,"cmdk-dialog":"",className:s},f.createElement(tw,{ref:t,...o}))))}),tE=Object.assign(tw,{List:tS,Item:tj,Input:tk,Group:ty,Separator:tN,Dialog:tC,Empty:f.forwardRef((e,t)=>tM(e=>0===e.filtered.count)?f.createElement(z.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:f.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...s}=e;return f.createElement(z.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},t_(e,e=>f.createElement("div",{"aria-hidden":!0},e)))})});function tD(e){let t=f.useRef(e);return tI(()=>{t.current=e}),t}var tI="u"<typeof window?f.useEffect:f.useLayoutEffect;function tT(e){let t=f.useRef();return void 0===t.current&&(t.current=e()),t}function tM(e){let t=f.useContext(tv),n=()=>e(t.snapshot());return f.useSyncExternalStore(t.subscribe,n,n)}function tP(e,t,n,r=[]){let a=f.useRef(),s=f.useContext(tx);return tI(()=>{var i;let o=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():a.current}})(),l=r.map(e=>e.trim());s.value(e,o,l),null==(i=t.current)||i.setAttribute(th,o),a.current=o}),a}var tz=()=>{let[e,t]=f.useState(),n=tT(()=>new Map);return tI(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function t_({asChild:e,children:t},n){let r;return e&&f.isValidElement(t)?f.cloneElement("function"==typeof(r=t.type)?r(t.props):"render"in r?r.render(t.props):t,{ref:t.ref},n(t.props.children)):n(t)}var tA={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},tO=e.i(465458),tL=e.i(209988),tR=e.i(294237);function t$({className:e,...t}){return(0,p.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,tO.cn)("group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",e),...t})}e.i(260218),e.i(681622),e.i(788010);let tF=(0,tR.cva)("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function tW({className:e,align:t="inline-start",...n}){return(0,p.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:(0,tO.cn)(tF({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}(0,tR.cva)("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});var tB=e.i(367914);function tU({className:e,...t}){return(0,p.jsx)(tE,{"data-slot":"command",className:(0,tO.cn)("flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",e),...t})}function tH({title:e="Command Palette",description:t="Search for a command to run...",children:n,className:r,showCloseButton:a=!1,...s}){return(0,p.jsxs)(tL.Dialog,{...s,children:[(0,p.jsxs)(tL.DialogHeader,{className:"sr-only",children:[(0,p.jsx)(tL.DialogTitle,{children:e}),(0,p.jsx)(tL.DialogDescription,{children:t})]}),(0,p.jsx)(tL.DialogContent,{className:(0,tO.cn)("overflow-hidden rounded-xl! p-0",r),showCloseButton:a,children:n})]})}function tK({className:e,...t}){return(0,p.jsx)("div",{"data-slot":"command-input-wrapper",className:"p-1 pb-0",children:(0,p.jsxs)(t$,{className:"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!",children:[(0,p.jsx)(tE.Input,{"data-slot":"command-input",className:(0,tO.cn)("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t}),(0,p.jsx)(tW,{children:(0,p.jsx)(tB.SearchIcon,{className:"size-4 shrink-0 opacity-50"})})]})})}function tV({className:e,...t}){return(0,p.jsx)(tE.List,{"data-slot":"command-list",className:(0,tO.cn)("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",e),...t})}function tq({className:e,...t}){return(0,p.jsx)(tE.Empty,{"data-slot":"command-empty",className:(0,tO.cn)("py-6 text-center text-sm",e),...t})}function tX({className:e,...t}){return(0,p.jsx)(tE.Group,{"data-slot":"command-group",className:(0,tO.cn)("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",e),...t})}function tG({className:e,children:t,...n}){return(0,p.jsx)(tE.Item,{"data-slot":"command-item",className:(0,tO.cn)("group/command-item relative flex w-full cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 hover:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground",e),...n,children:t})}function tJ({className:e,...t}){return(0,p.jsx)("span",{"data-slot":"command-shortcut",className:(0,tO.cn)("ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",e),...t})}var tY=e.i(640376),tZ=e.i(974915),tQ=e.i(227634),t0=e.i(938306),t1=e.i(953700),t2=e.i(31807);let t5={prefix:"channel",aliases:["ch","c"],label:"Channel",icon:tQ.Hash,search:e=>{let{channels:t,setActiveChannel:n,setCreateDialogOpen:r}=t2.useChannelStore.getState(),a=e.toLowerCase();return[{id:"__create_channel__",label:"新建频道",icon:t1.Plus,action:()=>setTimeout(()=>r(!0),300)},...t.filter(e=>e.name.toLowerCase().includes(a)).map(e=>({id:e.id,label:e.name,description:e.type,icon:t0.MessageCircle,action:()=>n(e.id)}))]}};var t3=e.i(592039),t4=e.i(511800),t6=e.i(327964);let t8={prefix:"issue",aliases:["i","bug"],label:"Issue",icon:t3.CircleDot,search:e=>{let{issues:t,setActiveIssue:n,setCreateDialogOpen:r}=t6.useIssueStore.getState(),a=e.toLowerCase();return[{id:"__create_issue__",label:"新建议题",icon:t1.Plus,action:()=>setTimeout(()=>r(!0),300)},...t.filter(e=>e.title.toLowerCase().includes(a)||e.description?.toLowerCase().includes(a)).map(e=>({id:e.id,label:e.title,description:e.status,icon:t4.AlertCircle,action:()=>n(e.id)}))]}};var t9=e.i(984178),t7=e.i(381253),ne=e.i(691223),nt=e.i(437122);let nn=new Set(["ts","tsx","js","jsx","py","rs","go","java","c","cpp","h","css","scss","html","json","yaml","yml","md","sql","sh"]),nr={prefix:"file",aliases:["f","open"],label:"File",icon:t9.FileIcon,search:async e=>{let{openFile:t}=ne.useEditorStore.getState(),{workspaceId:n}=t2.useChannelStore.getState();if(!n)return[];let r=await (0,nt.fetchWithAuth)(`/api/workspaces/${n}/search/files?q=${encodeURIComponent(e)}`);return r.ok?((await r.json()).results??[]).map(e=>{var r;let a;return{id:e.path,label:e.name,description:e.path,icon:(r=e.path,a=r.split(".").pop()?.toLowerCase()??"",nn.has(a)?t7.FileCode:t9.FileIcon),action:()=>t(n,e.path)}}):[]}};var na=e.i(451534);let ns=(0,e.i(433721).default)("briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);var ni=e.i(361031),no=e.i(233297);let nl={prefix:"workspace",aliases:["w","ws"],label:"Workspace",icon:na.FolderOpen,search:e=>{let{workspaces:t,setCreateDialogOpen:n}=ni.useWorkspaceStore.getState(),r=e.toLowerCase();return[{id:"__create_workspace__",label:"新建 Workspace",icon:t1.Plus,action:()=>setTimeout(()=>n(!0),300)},...t.filter(e=>e.name.toLowerCase().includes(r)||e.boundDirs.some(e=>e.toLowerCase().includes(r))).map(e=>({id:e.id,label:e.name,description:e.boundDirs[0],icon:ns,action:()=>{let t=(0,no.toStaticHref)(`/workspace/${e.id}`);window.location.href=t}}))]}};var nc=e.i(100559),nd=e.i(882469),nu=e.i(523592);let nm=[t5,t8,nr,nl,{prefix:"server",aliases:["s","sv"],label:"Server",icon:nc.Server,search:e=>{let t=(0,nu.loadServers)(),n=(0,nu.loadActiveId)(),r=e.toLowerCase();return t.filter(e=>e.name.toLowerCase().includes(r)||e.url.toLowerCase().includes(r)).map(e=>({id:e.id,label:e.name+(e.id===n?" (active)":""),description:e.url,icon:nd.Globe,action:()=>{ne.useEditorStore.getState().resetEditorState(),(0,nu.saveActiveId)(e.id),(0,nu.setActiveServerCookie)(e.url),window.location.reload()}}))}}];function np(e){for(let t of nm)for(let n of[t.prefix,...t.aliases])if(e===n+" "||e.startsWith(n+" "))return{provider:t,keyword:e.slice(n.length+1)};return null}var nf=e.i(244073);e.s(["CommandPalette",0,function(){let e=(0,nf.useTranslations)("commandPalette"),{open:t,setOpen:n,toggle:r,commands:a}=(0,tY.useCommandPalette)(),{matchesEvent:s}=(0,tZ.useKeyboardShortcuts)(),[i,o]=(0,f.useState)("");(0,f.useEffect)(()=>{let e=e=>{s("commandPalette",e)&&(e.preventDefault(),r())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r,s]),(0,f.useEffect)(()=>{if(!t){o("");let e=document.querySelector("[cmdk-input]");e&&(e.value="")}},[t]);let l=(0,f.useMemo)(()=>np(i),[i]),[c,d]=(0,f.useState)([]),[u,m]=(0,f.useState)(!1);(0,f.useEffect)(()=>{let e=np(i);if(!e){d([]),m(!1);return}let t=e.provider.search(e.keyword);if(t instanceof Promise){m(!0);let e=!1;return t.then(t=>{e||d(t)}).finally(()=>{e||m(!1)}),()=>{e=!0}}d(t),m(!1)},[i]);let h=(0,f.useMemo)(()=>{let e=new Map;for(let t of a){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return e},[a]),g=(0,f.useMemo)(()=>nm.map(e=>({id:`hint:${e.prefix}`,label:e.prefix,description:[...e.aliases].join(", "),icon:e.icon})),[]),x=!!l;return(0,p.jsx)(tH,{open:t,onOpenChange:n,title:e("title"),description:e("description"),children:(0,p.jsxs)(tU,{shouldFilter:!l,children:[(0,p.jsx)(tK,{placeholder:e("placeholder"),value:i,onValueChange:o}),(0,p.jsxs)(tV,{children:[(0,p.jsx)(tq,{children:e("empty")}),x&&(0,p.jsx)(tX,{heading:l.provider.label,children:u?(0,p.jsx)("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"..."}):0===c.length?(0,p.jsx)("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:e("noResults")}):c.slice(0,10).map(e=>(0,p.jsxs)(tG,{value:e.label,onSelect:()=>{n(!1),e.action()},children:[e.icon&&(0,p.jsx)(e.icon,{className:"size-4 shrink-0"}),(0,p.jsx)("span",{className:"truncate min-w-0",children:e.label}),e.description&&(0,p.jsx)("span",{className:"ml-auto shrink-0 text-xs text-muted-foreground truncate max-w-[200px]",children:e.description})]},e.id))}),!l&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(tX,{heading:"Search",children:g.map(e=>(0,p.jsxs)(tG,{value:e.label,className:"[&>svg:last-child]:hidden!",onSelect:()=>o(e.label+" "),children:[e.icon&&(0,p.jsx)(e.icon,{className:"size-4 shrink-0"}),(0,p.jsx)("span",{className:"truncate min-w-0",children:e.label}),e.description&&(0,p.jsx)("span",{className:"ml-auto text-xs text-muted-foreground text-right shrink-0",children:e.description})]},e.id))}),[...h.entries()].map(([e,t])=>(0,p.jsx)(tX,{heading:e,children:t.map(e=>(0,p.jsxs)(tG,{value:e.label,onSelect:()=>{n(!1),e.action()},children:[e.icon&&(0,p.jsx)(e.icon,{className:"size-4 shrink-0"}),(0,p.jsx)("span",{className:"truncate min-w-0",children:e.label}),e.shortcut&&(0,p.jsx)(tJ,{children:e.shortcut})]},e.id))},e))]})]})]})})}],698679)}]);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,564822,e=>{"use strict";var t=e.i(764556);e.s(["useIsMobile",0,function(){let[e,r]=t.useState(void 0);return t.useEffect(()=>{let e=window.matchMedia("(max-width: 767px)"),t=()=>{r(window.innerWidth<768)};return e.addEventListener("change",t),r(window.innerWidth<768),()=>e.removeEventListener("change",t)},[]),!!e}])},304271,485599,e=>{"use strict";function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){var r,a;r=t,a=n[t],(r=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(r))in e?Object.defineProperty(e,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[r]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e){return function t(){for(var r=this,n=arguments.length,a=Array(n),i=0;i<n;i++)a[i]=arguments[i];return a.length>=e.length?e.apply(this,a):function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return t.apply(r,[].concat(a,n))}}}function o(e){return({}).toString.call(e).includes("Object")}function l(e){return"function"==typeof e}var d,c,u=s(function(e,t){throw Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),m=function(e,t){return o(t)||u("changeType"),Object.keys(t).some(function(t){return!Object.prototype.hasOwnProperty.call(e,t)})&&u("changeField"),t},p=function(e){l(e)||u("selectorType")},f=function(e){l(e)||o(e)||u("handlerType"),o(e)&&Object.values(e).some(function(e){return!l(e)})&&u("handlersType")},h=function(e){e||u("initialIsRequired"),o(e)||u("initialType"),Object.keys(e).length||u("initialContent")};function g(e,t){return l(t)?t(e.current):t}function v(e,t){return e.current=i(i({},e.current),t),t}function x(e,t,r){return l(t)?t(e.current):Object.keys(r).forEach(function(r){var n;return null==(n=t[r])?void 0:n.call(t,e.current[r])}),r}var y={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},b=(d=function(e,t){throw Error(e[t]||e.default)},function e(){for(var t=this,r=arguments.length,n=Array(r),a=0;a<r;a++)n[a]=arguments[a];return n.length>=d.length?d.apply(this,n):function(){for(var r=arguments.length,a=Array(r),i=0;i<r;i++)a[i]=arguments[i];return e.apply(t,[].concat(n,a))}})(y),j=function(e){return(e||b("configIsRequired"),({}).toString.call(e).includes("Object")||b("configType"),e.urls)?(console.warn(y.deprecation),{paths:{vs:e.urls.monacoBase}}):e},w=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}},k={type:"cancelation",msg:"operation is manually canceled"};function S(e){var t=!1,r=new Promise(function(r,n){e.then(function(e){return t?n(k):r(e)}),e.catch(n)});return r.cancel=function(){return t=!0},r}var M=["monaco"],N=function(e){if(Array.isArray(e))return e}(c=({create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};h(e),f(t);var r={current:e},n=s(x)(r,t),a=s(v)(r),i=s(m)(e),o=s(g)(r);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return p(e),e(r.current)},function(e){(function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}})(n,a,i,o)(e)}]}}).create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}))||function(e){var t=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,n,a,i,s=[],o=!0,l=!1;try{a=(t=t.call(e)).next,!1;for(;!(o=(r=a.call(t)).done)&&(s.push(r.value),2!==s.length);o=!0);}catch(e){l=!0,n=e}finally{try{if(!o&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(l)throw n}}return s}}(c)||function(e){if(e){if("string"==typeof e)return t(e,2);var r=({}).toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,2):void 0}}(c)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),C=N[0],O=N[1];function P(e){return document.body.appendChild(e)}function E(e){var t,r,n=C(function(e){return{config:e.config,reject:e.reject}}),a=(t="".concat(n.config.paths.vs,"/loader.js"),r=document.createElement("script"),t&&(r.src=t),r);return a.onload=function(){return e()},a.onerror=n.reject,a}function T(){var e=C(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){var r=t.m||t;I(r),e.resolve(r)},function(t){e.reject(t)})}function I(e){C().monaco||O({monaco:e})}var D=new Promise(function(e,t){return O({resolve:e,reject:t})}),z={config:function(e){var t=j(e),r=t.monaco,a=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&({}).propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(t,M);O(function(e){return{config:function e(t,r){return Object.keys(r).forEach(function(n){r[n]instanceof Object&&t[n]&&Object.assign(r[n],e(t[n],r[n]))}),n(n({},t),r)}(e.config,a),monaco:r}})},init:function(){var e=C(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(O({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),S(D);if(window.monaco&&window.monaco.editor)return I(window.monaco),e.resolve(window.monaco),S(D);w(P,E)(T)}return S(D)},__getMonacoInstance:function(){return C(function(e){return e.monaco})}};e.s(["default",0,z],485599);var L=e.i(764556),A={display:"flex",position:"relative",textAlign:"initial"},R={width:"100%"},B={display:"none"},_={display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"},K=function({children:e}){return L.default.createElement("div",{style:_},e)},F=(0,L.memo)(function({width:e,height:t,isEditorReady:r,loading:n,_ref:a,className:i,wrapperProps:s}){return L.default.createElement("section",{style:{...A,width:e,height:t},...s},!r&&L.default.createElement(K,null,n),L.default.createElement("div",{ref:a,style:{...R,...!r&&B},className:i}))}),U=function(e){(0,L.useEffect)(e,[])},V=function(e,t,r=!0){let n=(0,L.useRef)(!0);(0,L.useEffect)(n.current||!r?()=>{n.current=!1}:e,t)};function q(){}function H(e,t,r,n){var a,i,s,o,l,d;return a=e,i=n,a.editor.getModel($(a,i))||(s=e,o=t,l=r,d=n,s.editor.createModel(o,l,d?$(s,d):void 0))}function $(e,t){return e.Uri.parse(t)}var G=(0,L.memo)(function({original:e,modified:t,language:r,originalLanguage:n,modifiedLanguage:a,originalModelPath:i,modifiedModelPath:s,keepCurrentOriginalModel:o=!1,keepCurrentModifiedModel:l=!1,theme:d="light",loading:c="Loading...",options:u={},height:m="100%",width:p="100%",className:f,wrapperProps:h={},beforeMount:g=q,onMount:v=q}){let[x,y]=(0,L.useState)(!1),[b,j]=(0,L.useState)(!0),w=(0,L.useRef)(null),k=(0,L.useRef)(null),S=(0,L.useRef)(null),M=(0,L.useRef)(v),N=(0,L.useRef)(g),C=(0,L.useRef)(!1);U(()=>{let e=z.init();return e.then(e=>(k.current=e)&&j(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>{let t;return w.current?(t=w.current?.getModel(),void(o||t?.original?.dispose(),l||t?.modified?.dispose(),w.current?.dispose())):e.cancel()}}),V(()=>{if(w.current&&k.current){let t=w.current.getOriginalEditor(),a=H(k.current,e||"",n||r||"text",i||"");a!==t.getModel()&&t.setModel(a)}},[i],x),V(()=>{if(w.current&&k.current){let e=w.current.getModifiedEditor(),n=H(k.current,t||"",a||r||"text",s||"");n!==e.getModel()&&e.setModel(n)}},[s],x),V(()=>{let e=w.current.getModifiedEditor();e.getOption(k.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[t],x),V(()=>{w.current?.getModel()?.original.setValue(e||"")},[e],x),V(()=>{let{original:e,modified:t}=w.current.getModel();k.current.editor.setModelLanguage(e,n||r||"text"),k.current.editor.setModelLanguage(t,a||r||"text")},[r,n,a],x),V(()=>{k.current?.editor.setTheme(d)},[d],x),V(()=>{w.current?.updateOptions(u)},[u],x);let O=(0,L.useCallback)(()=>{if(!k.current)return;N.current(k.current);let o=H(k.current,e||"",n||r||"text",i||""),l=H(k.current,t||"",a||r||"text",s||"");w.current?.setModel({original:o,modified:l})},[r,t,a,e,n,i,s]),P=(0,L.useCallback)(()=>{!C.current&&S.current&&(w.current=k.current.editor.createDiffEditor(S.current,{automaticLayout:!0,...u}),O(),k.current?.editor.setTheme(d),y(!0),C.current=!0)},[u,d,O]);return(0,L.useEffect)(()=>{x&&M.current(w.current,k.current)},[x]),(0,L.useEffect)(()=>{b||x||P()},[b,x,P]),L.default.createElement(F,{width:p,height:m,isEditorReady:x,loading:c,_ref:S,className:f,wrapperProps:h})}),W=function(e){let t=(0,L.useRef)();return(0,L.useEffect)(()=>{t.current=e},[e]),t.current},J=new Map,Y=(0,L.memo)(function({defaultValue:e,defaultLanguage:t,defaultPath:r,value:n,language:a,path:i,theme:s="light",line:o,loading:l="Loading...",options:d={},overrideServices:c={},saveViewState:u=!0,keepCurrentModel:m=!1,width:p="100%",height:f="100%",className:h,wrapperProps:g={},beforeMount:v=q,onMount:x=q,onChange:y,onValidate:b=q}){let[j,w]=(0,L.useState)(!1),[k,S]=(0,L.useState)(!0),M=(0,L.useRef)(null),N=(0,L.useRef)(null),C=(0,L.useRef)(null),O=(0,L.useRef)(x),P=(0,L.useRef)(v),E=(0,L.useRef)(),T=(0,L.useRef)(n),I=W(i),D=(0,L.useRef)(!1),A=(0,L.useRef)(!1);U(()=>{let e=z.init();return e.then(e=>(M.current=e)&&S(!1)).catch(e=>e?.type!=="cancelation"&&console.error("Monaco initialization: error:",e)),()=>N.current?void(E.current?.dispose(),m?u&&J.set(i,N.current.saveViewState()):N.current.getModel()?.dispose(),N.current.dispose()):e.cancel()}),V(()=>{let s=H(M.current,e||n||"",t||a||"",i||r||"");s!==N.current?.getModel()&&(u&&J.set(I,N.current?.saveViewState()),N.current?.setModel(s),u&&N.current?.restoreViewState(J.get(i)))},[i],j),V(()=>{N.current?.updateOptions(d)},[d],j),V(()=>{N.current&&void 0!==n&&(N.current.getOption(M.current.editor.EditorOption.readOnly)?N.current.setValue(n):n!==N.current.getValue()&&(A.current=!0,N.current.executeEdits("",[{range:N.current.getModel().getFullModelRange(),text:n,forceMoveMarkers:!0}]),N.current.pushUndoStop(),A.current=!1))},[n],j),V(()=>{let e=N.current?.getModel();e&&a&&M.current?.editor.setModelLanguage(e,a)},[a],j),V(()=>{void 0!==o&&N.current?.revealLine(o)},[o],j),V(()=>{M.current?.editor.setTheme(s)},[s],j);let R=(0,L.useCallback)(()=>{if(!(!C.current||!M.current)&&!D.current){P.current(M.current);let l=i||r,m=H(M.current,n||e||"",t||a||"",l||"");N.current=M.current?.editor.create(C.current,{model:m,automaticLayout:!0,...d},c),u&&N.current.restoreViewState(J.get(l)),M.current.editor.setTheme(s),void 0!==o&&N.current.revealLine(o),w(!0),D.current=!0}},[e,t,r,n,a,i,d,c,u,s,o]);return(0,L.useEffect)(()=>{j&&O.current(N.current,M.current)},[j]),(0,L.useEffect)(()=>{k||j||R()},[k,j,R]),T.current=n,(0,L.useEffect)(()=>{j&&y&&(E.current?.dispose(),E.current=N.current?.onDidChangeModelContent(e=>{A.current||y(N.current.getValue(),e)}))},[j,y]),(0,L.useEffect)(()=>{if(j){let e=M.current.editor.onDidChangeMarkers(e=>{let t=N.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=M.current.editor.getModelMarkers({resource:t});b?.(e)}});return()=>{e?.dispose()}}return()=>{}},[j,b]),L.default.createElement(F,{width:p,height:f,isEditorReady:j,loading:l,_ref:C,className:h,wrapperProps:g})});e.s(["DiffEditor",0,G,"Editor",0,Y,"default",0,Y,"useMonaco",0,function(){let[e,t]=(0,L.useState)(z.__getMonacoInstance());return U(()=>{let r;return e||(r=z.init()).then(e=>{t(e)}),()=>r?.cancel()}),e}],304271)},462506,e=>{"use strict";e.i(304271);var t=e.i(485599),t=t;t.default.config({paths:{vs:"/monaco/vs"}}),e.s([],462506)},969170,457318,e=>{"use strict";var t=e.i(433721);let r=(0,t.default)("file-question-mark",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);e.s(["FileQuestion",0,r],969170);let n=(0,t.default)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);e.s(["Filter",0,n],457318)},355479,e=>{"use strict";let t=(0,e.i(433721).default)("split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);e.s(["Split",0,t],355479)},613812,e=>{"use strict";var t=e.i(344180);e.i(462506);var r=e.i(304271),n=e.i(764556),a=e.i(950396),i=e.i(564822),s=e.i(465458),o=e.i(344118),l=e.i(969170),d=e.i(457318),c=e.i(355479);function u({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty",className:(0,s.cn)("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-xl border-dashed p-6 text-center text-balance",e),...r})}function m({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-header",className:(0,s.cn)("flex max-w-sm flex-col items-center gap-2",e),...r})}let p=(0,e.i(294237).cva)("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{variant:"default"}});function f({className:e,variant:r="default",...n}){return(0,t.jsx)("div",{"data-slot":"empty-icon","data-variant":r,className:(0,s.cn)(p({variant:r,className:e})),...n})}function h({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-title",className:(0,s.cn)("font-heading text-sm font-medium tracking-tight",e),...r})}function g({className:e,...r}){return(0,t.jsx)("div",{"data-slot":"empty-description",className:(0,s.cn)("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...r})}e.s(["DiffViewer",0,function({oldContent:e,newContent:p,path:v,isBinary:x,compactDiff:y=!0,mergeMode:b=!1,onResolve:j}){let w,k=(w=v.split(".").pop()?.toLowerCase())?({ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",md:"markdown",css:"css",html:"html",py:"python",rs:"rust",go:"go",yaml:"yaml",yml:"yaml"})[w]:void 0,S=(0,n.useRef)(null),{resolvedTheme:M}=(0,a.useTheme)(),N=(0,i.useIsMobile)(),[C,O]=(0,n.useState)(y),[P,E]=(0,n.useState)(null),T=(0,n.useCallback)(e=>{S.current=e},[]);(0,n.useEffect)(()=>()=>{let e=S.current;e&&(e.setModel(null),S.current=null)},[]);let I=(0,n.useMemo)(()=>C?function(e,t){let r=e.split("\n"),n=t.split("\n"),a=r.length,i=n.length;if(e===t||a*i>4e6)return null;let s=Array.from({length:a+1},()=>Array(i+1).fill(0));for(let e=a-1;e>=0;e--)for(let t=i-1;t>=0;t--)r[e]===n[t]?s[e][t]=s[e+1][t+1]+1:s[e][t]=Math.max(s[e+1][t],s[e][t+1]);let o=new Set,l=new Set,d=0,c=0;for(;d<a&&c<i;)r[d]===n[c]?(o.add(d),l.add(c),d++,c++):s[d+1][c]>=s[d][c+1]?d++:c++;let u=new Set,m=new Set;for(let e=0;e<a;e++)if(!o.has(e))for(let t=Math.max(0,e-10);t<=Math.min(a-1,e+10);t++)u.add(t);for(let e=0;e<i;e++)if(!l.has(e))for(let t=Math.max(0,e-10);t<=Math.min(i-1,e+10);t++)m.add(t);function p(e){let t=Array.from(e).sort((e,t)=>e-t);if(0===t.length)return[];let r=[[t[0],t[0]]];for(let e=1;e<t.length;e++){let n=r[r.length-1];t[e]<=n[1]+1?n[1]=t[e]:r.push([t[e],t[e]])}return r}let f=p(u),h=p(m);if(0===f.length&&0===h.length)return null;let g="···";function v(e,t){let r=[];for(let n=0;n<t.length;n++){let[a,i]=t[n];(n>0||a>0)&&r.push(g);for(let t=a;t<=i;t++)r.push(e[t])}return t.length>0&&t[t.length-1][1]<e.length-1&&r.push(g),r}return{oldLines:v(r,f),newLines:v(n,h)}}(e,p):null,[C,e,p]),D=I?I.oldLines.join("\n"):e,z=I?I.newLines.join("\n"):p,L=(0,n.useCallback)(async t=>{if(j&&!P){E(t);try{await j("left"===t?e:p,t)}finally{E(null)}}},[p,e,j,P]),A=!e,R=!p,B=A&&R;return(0,t.jsxs)("div",{className:"h-full w-full flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-2 py-1 border-b bg-muted/30",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",children:v}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[b&&j&&(0,t.jsxs)(t.Fragment,{children:[!A&&(0,t.jsxs)("button",{onClick:()=>L("left"),disabled:null!==P,className:"flex items-center gap-1 text-xs px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent disabled:opacity-50",title:"保留左侧",children:["left"===P?(0,t.jsx)(o.Check,{className:"h-3 w-3"}):(0,t.jsx)(c.Split,{className:"h-3 w-3 rotate-180"}),"保留左侧"]}),!R&&(0,t.jsxs)("button",{onClick:()=>L("right"),disabled:null!==P,className:"flex items-center gap-1 text-xs px-1.5 py-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-accent disabled:opacity-50",title:"保留右侧",children:["right"===P?(0,t.jsx)(o.Check,{className:"h-3 w-3"}):(0,t.jsx)(c.Split,{className:"h-3 w-3"}),"保留右侧"]})]}),!B&&!x&&(0,t.jsxs)("button",{onClick:()=>O(e=>!e),className:(0,s.cn)("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",C?"text-blue-600 dark:text-blue-400 bg-blue-500/10":"text-muted-foreground hover:text-foreground"),title:C?"显示全部代码":"只看修改部分",children:[(0,t.jsx)(d.Filter,{className:"h-3 w-3"}),C?"紧凑":"全部"]})]})]}),(0,t.jsx)("div",{className:"flex-1",children:x?(0,t.jsxs)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm gap-2",children:[(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),(0,t.jsx)("polyline",{points:"14 2 14 8 20 8"})]}),"二进制文件,不支持预览"]}):B?(0,t.jsx)(u,{className:"h-full border-0",children:(0,t.jsxs)(m,{children:[(0,t.jsx)(f,{variant:"icon",children:(0,t.jsx)(l.FileQuestion,{})}),(0,t.jsx)(h,{children:"无内容"}),(0,t.jsx)(g,{children:"该文件没有可显示的内容"})]})}):A?(0,t.jsx)(r.DiffEditor,{original:"",modified:z,language:k,theme:"dark"===M?"vs-dark":"vs",onMount:T,options:{readOnly:!0,renderSideBySide:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:"on"}}):(0,t.jsx)(r.DiffEditor,{original:D,modified:z,language:k,theme:"dark"===M?"vs-dark":"vs",onMount:T,options:{readOnly:!0,renderSideBySide:!N,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,lineNumbers:"on"}})})]})}],613812)},159619,839374,e=>{"use strict";let t=(0,e.i(433721).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["default",0,t],839374),e.s(["Copy",0,t],159619)},683640,184591,e=>{"use strict";let t=(0,e.i(433721).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["default",0,t],184591),e.s(["Terminal",0,t],683640)},451534,680422,e=>{"use strict";let t=(0,e.i(433721).default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);e.s(["default",0,t],680422),e.s(["FolderOpen",0,t],451534)},558680,e=>{"use strict";let t=(0,e.i(433721).default)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["default",0,t])},650654,e=>{"use strict";var t=e.i(558680);e.s(["ChevronDown",()=>t.default])},459250,e=>{"use strict";var t=e.i(764556);let r=t.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});e.s(["CompositeListContext",0,r,"useCompositeListContext",0,function(){return t.useContext(r)}])},296615,e=>{"use strict";var t,r=e.i(764556),n=e.i(277642),a=e.i(459250);let i=((t={})[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t);e.s(["useCompositeListItem",0,function(e={}){let{label:t,metadata:s,textRef:o,indexGuessBehavior:l,index:d}=e,{register:c,unregister:u,subscribeMapChange:m,elementsRef:p,labelsRef:f,nextIndexRef:h}=(0,a.useCompositeListContext)(),g=r.useRef(-1),[v,x]=r.useState(d??(l===i.GuessFromOrder?()=>{if(-1===g.current){let e=h.current;h.current+=1,g.current=e}return g.current}:-1)),y=r.useRef(null),b=r.useCallback(e=>{if(y.current=e,-1!==v&&null!==e&&(p.current[v]=e,f)){let r=void 0!==t;f.current[v]=r?t:o?.current?.textContent??e.textContent}},[v,p,f,t,o]);return(0,n.useIsoLayoutEffect)(()=>{if(null!=d)return;let e=y.current;if(e)return c(e,s),()=>{u(e)}},[d,c,u,s]),(0,n.useIsoLayoutEffect)(()=>{if(null==d)return m(e=>{let t=y.current?e.get(y.current)?.index:null;null!=t&&x(t)})},[d,m,x]),r.useMemo(()=>({ref:b,index:v}),[v,b])}])},756432,e=>{"use strict";var t=e.i(764556),r=e.i(549154),n=e.i(29905),a=e.i(277642),i=e.i(459250),s=e.i(344180);function o(){return new Map}function l(){return new Set}function d(e,t){let r=e.compareDocumentPosition(t);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}e.s(["CompositeList",0,function(e){let{children:c,elementsRef:u,labelsRef:m,onMapChange:p}=e,f=(0,n.useStableCallback)(p),h=t.useRef(0),g=(0,r.useRefWithInit)(l).current,v=(0,r.useRefWithInit)(o).current,[x,y]=t.useState(0),b=t.useRef(x),j=(0,n.useStableCallback)((e,t)=>{v.set(e,t??null),b.current+=1,y(b.current)}),w=(0,n.useStableCallback)(e=>{v.delete(e),b.current+=1,y(b.current)}),k=t.useMemo(()=>{let e=new Map;return Array.from(v.keys()).filter(e=>e.isConnected).sort(d).forEach((t,r)=>{let n=v.get(t)??{};e.set(t,{...n,index:r})}),e},[v,x]);(0,a.useIsoLayoutEffect)(()=>{if("function"!=typeof MutationObserver||0===k.size)return;let e=new MutationObserver(e=>{let t=new Set,r=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(r),e.addedNodes.forEach(r)}),0===t.size&&(b.current+=1,y(b.current))});return k.forEach((t,r)=>{r.parentElement&&e.observe(r.parentElement,{childList:!0})}),()=>{e.disconnect()}},[k]),(0,a.useIsoLayoutEffect)(()=>{b.current===x&&(u.current.length!==k.size&&(u.current.length=k.size),m&&m.current.length!==k.size&&(m.current.length=k.size),h.current=k.size),f(k)},[f,k,u,m,x]),(0,a.useIsoLayoutEffect)(()=>()=>{u.current=[]},[u]),(0,a.useIsoLayoutEffect)(()=>()=>{m&&(m.current=[])},[m]);let S=(0,n.useStableCallback)(e=>(g.add(e),()=>{g.delete(e)}));(0,a.useIsoLayoutEffect)(()=>{g.forEach(e=>e(k))},[g,k]);let M=t.useMemo(()=>({register:j,unregister:w,subscribeMapChange:S,elementsRef:u,labelsRef:m,nextIndexRef:h}),[j,w,S,u,m,h]);return(0,s.jsx)(i.CompositeListContext.Provider,{value:M,children:c})}])},530909,e=>{"use strict";var t=e.i(764556),r=e.i(204133),n=e.i(352360),a=e.i(296615);e.s(["useCompositeItem",0,function(e={}){let{highlightItemOnHover:i,highlightedIndex:s,onHighlightedIndexChange:o}=(0,n.useCompositeRootContext)(),{ref:l,index:d}=(0,a.useCompositeListItem)(e),c=s===d,u=t.useRef(null),m=(0,r.useMergedRefs)(l,u);return{compositeProps:t.useMemo(()=>({tabIndex:c?0:-1,onFocus(){o(d)},onMouseMove(){let e=u.current;if(!i||!e)return;let t=e.hasAttribute("disabled")||"true"===e.ariaDisabled;c||t||e.focus()}}),[c,o,d,i]),compositeRef:m,index:d}}])},50153,e=>{"use strict";let t=(0,e.i(433721).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",0,t])},971109,e=>{"use strict";var t=e.i(267805),r=e.i(764556);let n=r.createContext(void 0);e.s(["useToolbarRootContext",0,function(e){let a=r.useContext(n);if(void 0===a&&!e)throw Error((0,t.default)(69));return a}])},122702,e=>{"use strict";var t=e.i(863728),r=e.i(969490),n=e.i(530909);e.s(["CompositeItem",0,function(e){let{render:a,className:i,style:s,state:o=t.EMPTY_OBJECT,props:l=t.EMPTY_ARRAY,refs:d=t.EMPTY_ARRAY,metadata:c,stateAttributesMapping:u,tag:m="div",...p}=e,{compositeProps:f,compositeRef:h}=(0,n.useCompositeItem)({metadata:c});return(0,r.useRenderElement)(m,e,{state:o,ref:[...d,h],props:[f,...l,p],stateAttributesMapping:u})}])},972846,e=>{"use strict";var t=e.i(912248);e.s(["X",()=>t.default])},730774,e=>{"use strict";var t=e.i(641645),r=e.i(92615);e.s(["getCssDimensions",0,function(e){let n=(0,r.getComputedStyle)(e),a=parseFloat(n.width)||0,i=parseFloat(n.height)||0,s=(0,r.isHTMLElement)(e),o=s?e.offsetWidth:a,l=s?e.offsetHeight:i;return((0,t.round)(a)!==o||(0,t.round)(i)!==l)&&(a=o,i=l),{width:a,height:i}}])},917955,e=>{"use strict";var t=e.i(344180),r=e.i(648224),n=e.i(465458),a=e.i(932031);function i({align:e="start",alignOffset:a=0,side:s="bottom",sideOffset:o=4,className:l,...d}){return(0,t.jsx)(r.Menu.Portal,{children:(0,t.jsx)(r.Menu.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:a,side:s,sideOffset:o,children:(0,t.jsx)(r.Menu.Popup,{"data-slot":"dropdown-menu-content",className:(0,n.cn)("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",l),...d})})})}e.i(299648),e.s(["DropdownMenu",0,function({...e}){return(0,t.jsx)(r.Menu.Root,{"data-slot":"dropdown-menu",...e})},"DropdownMenuContent",0,i,"DropdownMenuGroup",0,function({...e}){return(0,t.jsx)(r.Menu.Group,{"data-slot":"dropdown-menu-group",...e})},"DropdownMenuItem",0,function({className:e,inset:a,variant:i="default",...s}){return(0,t.jsx)(r.Menu.Item,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":i,className:(0,n.cn)("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...s})},"DropdownMenuLabel",0,function({className:e,inset:a,...i}){return(0,t.jsx)(r.Menu.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":a,className:(0,n.cn)("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",e),...i})},"DropdownMenuSeparator",0,function({className:e,...a}){return(0,t.jsx)(r.Menu.Separator,{"data-slot":"dropdown-menu-separator",className:(0,n.cn)("-mx-1 my-1 h-px bg-border",e),...a})},"DropdownMenuShortcut",0,function({className:e,...r}){return(0,t.jsx)("span",{"data-slot":"dropdown-menu-shortcut",className:(0,n.cn)("ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",e),...r})},"DropdownMenuSub",0,function({...e}){return(0,t.jsx)(r.Menu.SubmenuRoot,{"data-slot":"dropdown-menu-sub",...e})},"DropdownMenuSubContent",0,function({align:e="start",alignOffset:r=-3,side:a="right",sideOffset:s=0,className:o,...l}){return(0,t.jsx)(i,{"data-slot":"dropdown-menu-sub-content",className:(0,n.cn)("w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",o),align:e,alignOffset:r,side:a,sideOffset:s,...l})},"DropdownMenuSubTrigger",0,function({className:e,inset:i,children:s,...o}){return(0,t.jsxs)(r.Menu.SubmenuTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":i,className:(0,n.cn)("flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,(0,t.jsx)(a.ChevronRightIcon,{className:"ml-auto"})]})},"DropdownMenuTrigger",0,function({...e}){return(0,t.jsx)(r.Menu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}])},129981,e=>{"use strict";let t=(0,e.i(433721).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",0,t],129981)},750012,e=>{"use strict";let t=(0,e.i(433721).default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["default",0,t])},887354,e=>{"use strict";var t=e.i(750012);e.s(["Search",()=>t.default])},562918,928542,e=>{"use strict";var t=e.i(370383),r=e.i(969490);function n(e){return(0,r.useRenderElement)(e.defaultTagName??"div",e,e)}e.s(["useRender",0,n],928542);var a=e.i(294237),i=e.i(465458);let s=(0,a.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});e.s(["Badge",0,function({className:e,variant:r="default",render:a,...o}){return n({defaultTagName:"span",props:(0,t.mergeProps)({className:(0,i.cn)(s({variant:r}),e)},o),render:a,state:{slot:"badge",variant:r}})}],562918)},368942,e=>{"use strict";let t=(0,e.i(816709).create)((e,t)=>({models:[],providers:[],loaded:!1,ensure:async()=>{if(!t().loaded)try{let[t,r]=await Promise.all([fetch("/api/models").then(e=>e.json()),fetch("/api/providers").then(e=>e.json())]);e({models:t,providers:r,loaded:!0})}catch{}},addModel:t=>e(e=>({models:[...e.models,t]})),updateModel:t=>e(e=>({models:e.models.map(e=>e.id===t.id?t:e)})),removeModel:t=>e(e=>({models:e.models.filter(e=>e.id!==t)})),addProvider:t=>e(e=>({providers:[...e.providers,t]})),updateProvider:t=>e(e=>({providers:e.providers.map(e=>e.id===t.id?t:e)})),removeProvider:t=>e(e=>({providers:e.providers.filter(e=>e.id!==t)}))}));e.s(["useLLMStore",0,t])},426022,e=>{"use strict";let t=(0,e.i(433721).default)("message-square",[["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"}]]);e.s(["MessageSquare",0,t],426022)},943997,e=>{"use strict";let t=(0,e.i(433721).default)("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);e.s(["Database",0,t],943997)},227634,e=>{"use strict";let t=(0,e.i(433721).default)("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);e.s(["Hash",0,t],227634)},799543,(e,t,r)=>{t.exports=e.r(233331)},189131,e=>{"use strict";var t=e.i(764556);let r=t.createContext(void 0);e.s(["useDirection",0,function(){let e=t.useContext(r);return e?.direction??"ltr"}])},137340,288556,e=>{"use strict";let t=(0,e.i(433721).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["default",0,t],288556),e.s(["Trash2",0,t],137340)},953700,e=>{"use strict";let t=(0,e.i(433721).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,t],953700)},950396,e=>{"use strict";var t=e.i(344180),r=e.i(764556),n=e.i(799543);let a=(0,r.createContext)({theme:"system",setTheme:()=>{},resolvedTheme:"light"}),i="agent-spaces-theme",s={light:"#ffffff",dark:"#0f1117"};function o(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function l(e){var t;let r,n="system"===e?o():e,a=document.documentElement;a.classList.remove("light","dark"),a.classList.add(n),a.style.colorScheme=n,t=n,(r=document.querySelector('meta[name="theme-color"]'))||((r=document.createElement("meta")).name="theme-color",document.head.appendChild(r)),r.content=s[t],window.AgentSpacesStatusBar?.setTheme(t)}e.s(["ThemeProvider",0,function({children:e,defaultTheme:d="system"}){(0,n.useServerInsertedHTML)(()=>(0,t.jsx)("script",{dangerouslySetInnerHTML:{__html:`(function(){try{var t=localStorage.getItem('${i}');var d=t==='dark'||((!t||t==='system')&&matchMedia('(prefers-color-scheme:dark)').matches);var r=d?'dark':'light';document.documentElement.classList.add(r);document.documentElement.style.colorScheme=r;var m=document.querySelector('meta[name="theme-color"]');if(!m){m=document.createElement('meta');m.name='theme-color';document.head.appendChild(m)}m.content=d?'${s.dark}':'${s.light}';if(window.AgentSpacesStatusBar){window.AgentSpacesStatusBar.setTheme(r)}var f=localStorage.getItem('customFont');document.documentElement.dataset.customFont=f?'true':'false';if(f){var ff=f;try{var c=JSON.parse(localStorage.getItem('customFonts')||'[]');var cf=Array.isArray(c)&&c.find(function(x){return x&&x.name===f});if(cf&&cf.url){ff=f.replace(/\\.\\w+$/,'');var id='font-'+f.replace(/[^a-zA-Z0-9]/g,'-');if(!document.getElementById(id)){var s=document.createElement('style');s.id=id;s.textContent='@font-face { font-family: "'+ff.replace(/"/g,'\\\\22 ')+'"; src: url("'+String(cf.url).replace(/"/g,'\\\\22 ')+'"); }';document.head.appendChild(s)}}}catch(e){}var v=ff==='system-ui'||ff==='monospace'?ff:'"'+ff.replace(/"/g,'\\\\22 ')+'"';['--font-app','--font-sans','--font-heading','--font-mid','--font-mono'].forEach(function(k){document.documentElement.style.setProperty(k,v)})}}catch(e){}})()`}},"theme-init"));let c=(0,r.useSyncExternalStore)(e=>{let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>o(),()=>"light"),u=(0,r.useSyncExternalStore)(e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),()=>localStorage.getItem(i)||d,()=>d),m="system"===u?c:u,p=(0,r.useCallback)(e=>{localStorage.setItem(i,e),l(e),window.dispatchEvent(new StorageEvent("storage",{key:i}))},[]);return(0,r.useEffect)(()=>{l(u)},[u,c]),(0,t.jsx)(a.Provider,{value:{theme:u,setTheme:p,resolvedTheme:m},children:e})},"useTheme",0,function(){return(0,r.useContext)(a)}])},325443,946899,e=>{"use strict";let t=(0,e.i(433721).default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);e.s(["default",0,t],946899),e.s(["Bot",0,t],325443)},188815,e=>{"use strict";var t=e.i(344180),r=e.i(764556),n=e.i(465458),a=e.i(681622),i=e.i(344118),s=e.i(650654),o=e.i(953700);e.s(["SearchSelect",0,function({value:e,onChange:l,options:d,placeholder:c="Select...",searchPlaceholder:u="Search...",allowCustom:m=!0,className:p}){let f=(0,r.useRef)(null),[h,g]=(0,r.useState)(!1),[v,x]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=e=>{f.current&&!f.current.contains(e.target)&&g(!1)};return h&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[h]);let y=d.filter(e=>(e.label??e.value).toLowerCase().includes(v.toLowerCase())),b=d.some(e=>e.value.toLowerCase()===v.toLowerCase()),j=d.find(t=>t.value===e),w=e&&!d.some(t=>t.value===e),k=e=>{l(e),g(!1),x("")};return(0,t.jsxs)("div",{ref:f,className:(0,n.cn)("relative",p),children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{g(!0),x("")},className:(0,n.cn)("flex h-8 w-full items-center justify-between gap-2 rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none hover:bg-muted/50 focus-visible:border-ring dark:bg-input/30"),children:[(0,t.jsx)("span",{className:(0,n.cn)("truncate",!e&&"text-muted-foreground"),children:j?j.label??j.value:w?e:c}),(0,t.jsx)(s.ChevronDown,{className:"size-3.5 shrink-0 opacity-50"})]}),h&&(0,t.jsxs)("div",{className:"absolute inset-x-0 top-full z-50 mt-1 rounded-lg border bg-popover p-1 shadow-md",children:[(0,t.jsx)(a.Input,{value:v,onChange:e=>x(e.target.value),placeholder:u,className:"h-7 text-xs",onKeyDown:e=>{"Enter"===e.key&&m&&v.trim()&&(e.preventDefault(),k(v.trim())),"Escape"===e.key&&g(!1)},autoFocus:!0}),(0,t.jsxs)("div",{className:"mt-1 max-h-48 overflow-y-auto",children:[y.map(r=>(0,t.jsxs)("button",{type:"button",className:(0,n.cn)("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs hover:bg-muted/50",e===r.value&&"bg-muted"),onClick:()=>k(r.value),children:[(0,t.jsx)(i.Check,{className:(0,n.cn)("size-3 shrink-0",e===r.value?"opacity-100":"opacity-0")}),(0,t.jsx)("span",{className:"truncate",children:r.label??r.value})]},r.value)),m&&v.trim()&&!b&&(0,t.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-xs text-primary hover:bg-muted/50 cursor-pointer",onClick:()=>k(v.trim()),children:[(0,t.jsx)(o.Plus,{className:"size-3 shrink-0"}),(0,t.jsxs)("span",{className:"truncate",children:['Use "',v.trim(),'"']})]}),!y.length&&!v.trim()&&(0,t.jsx)("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No results"})]})]})]})}])},415360,656744,e=>{"use strict";let t=(0,e.i(433721).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["default",0,t],656744),e.s(["Sparkles",0,t],415360)},511588,e=>{"use strict";let t=(0,e.i(433721).default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);e.s(["WandSparkles",0,t],511588)},673478,e=>{"use strict";let t=(0,e.i(433721).default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);e.s(["Cpu",0,t],673478)},965322,282180,e=>{"use strict";var t=e.i(344180),r=e.i(764556),n=e.i(244073),a=e.i(355819),i=e.i(260218),s=e.i(788010),o=e.i(209988),l=e.i(444433);let d=[{value:"anthropic-messages",labelKey:"anthropicMessages"},{value:"openai-chat-completions",labelKey:"openaiChatCompletions"},{value:"openai-responses",labelKey:"openaiResponses"},{value:"openai-responses-to-anthropic-messages",labelKey:"openaiResponsesToAnthropic"},{value:"openai-chat-completions-to-anthropic-messages",labelKey:"openaiChatToAnthropic"},{value:"gemini-generate-content",labelKey:"geminiGenerateContent"}],c=[{value:"claude-code",labelKey:"claudeCode"},{value:"open-agent-sdk",labelKey:"openAgentSdk"},{value:"codex",labelKey:"codex"},{value:"langchain",labelKey:"langchain"},{value:"hermes",labelKey:"hermes"}],u=["agent","scheduler","task_creator","bot"],m=(l.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name),p=new Set(["openai-responses-to-anthropic-messages","openai-chat-completions-to-anthropic-messages"]);function f(e){return{mcpServers:Object.fromEntries(e.map(e=>[e,{}]))}}function h(e){return e.map(e=>({name:`${e}.md`,content:`# ${e}
|
|
2
|
+
`}))}let g={agent:{name:"Agent",role:"agent",description:"通用 Agent,可在 workflow 中承担任意执行节点",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:f([]),skills:h(["coding","debugging","testing"]),tools:m,systemPrompt:"你是通用 Agent。根据 issue 和当前任务上下文完成被分配的工作,遵循项目规范,必要时修改代码、运行验证,并清晰汇报结果。",outputStyle:"",temperature:.3,maxTokens:8192,enabled:!0},scheduler:{name:"Scheduler",role:"scheduler",description:"任务调度者,负责任务分发和协调",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:f([]),skills:h(["planning","task-split"]),tools:m,systemPrompt:"你是调度者 Agent。负责接收用户任务,分析任务类型,分发给合适的执行者。你需要跟踪任务状态,确保所有子任务按时完成。",outputStyle:"",temperature:.3,maxTokens:4096,enabled:!0},task_creator:{name:"Task Creator",role:"task_creator",description:"任务创建者,负责把 issue 拆成可执行任务",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:f([]),skills:h(["planning","task-split"]),tools:m,systemPrompt:"你是任务创建者 Agent。负责读取 issue 上下文,把需求拆分为少量可执行任务,并用系统工具写入任务列表。只创建真正需要独立执行的任务,避免把细碎步骤拆成任务。",outputStyle:"",temperature:.3,maxTokens:4096,enabled:!0},bot:{name:"Bot Agent",role:"bot",description:"消息机器人,负责处理外部聊天平台中的用户消息",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"anthropic-messages",modelId:"claude-sonnet-4-6",apiBase:"",apiKey:"",workingDir:"",mcps:{},skills:[],tools:m,systemPrompt:"你是 Agent Spaces 的消息机器人。你会简洁回答来自外部聊天平台的用户消息。不要执行危险操作;需要用户提供更多信息时直接询问。",outputStyle:"",temperature:.3,maxTokens:4096,enabled:!0}};function v(e){var t,r;return{...e,name:e.name||"New Agent",description:e.description||"",avatarUrl:e.avatarUrl||"",runtimeKind:e.runtimeKind||"open-agent-sdk",modelProvider:e.modelProvider||"",modelId:e.modelId||"claude-sonnet-4-6",apiBase:e.apiBase||"",apiKey:e.apiKey||"",workingDir:e.workingDir||"",mcps:(t=e.mcps)||{},skills:Array.isArray(r=e.skills)?r.map(e=>"string"==typeof e?{name:e.endsWith(".md")?e:`${e}.md`}:e):[],tools:function(e){if(!Array.isArray(e))return m;let t=new Set((l.BUILT_IN_AGENT_TOOLS??[]).map(e=>e.name));return e.filter(e=>t.has(e))}(e.tools),systemPrompt:e.systemPrompt||"",outputStyle:e.outputStyle||"",temperature:e.temperature??.3,maxTokens:e.maxTokens??4096,enabled:e.enabled??!0}}function x(e){let{id:t,...r}=e;return{...r,modelProvider:r.modelProvider||void 0}}function y(e){return{id:`draft-${e}-${Date.now()}`,...g[e],mcps:structuredClone(g[e].mcps),skills:g[e].skills.map(e=>({...e})),tools:[...g[e].tools]}}function b(e){return e.id.startsWith("draft-")}function j(e){return!!(e&&p.has(e))}function w({icon:e,title:r,children:n}){return(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[e,r]}),n]})}function k({label:e,children:r}){return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:e}),r]})}function S({icon:e,title:r,action:n}){return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[e,(0,t.jsx)("span",{className:"truncate",children:r})]}),n?(0,t.jsx)("div",{className:"shrink-0",children:n}):null]})}e.s(["FieldGroup",0,k,"PROVIDER_OPTIONS",0,d,"ROLE_COLORS",0,{agent:"bg-gray-500/10 text-gray-600 border-gray-200",scheduler:"bg-blue-500/10 text-blue-600 border-blue-200",task_creator:"bg-green-500/10 text-green-600 border-green-200",bot:"bg-cyan-500/10 text-cyan-600 border-cyan-200"},"ROLE_OPTIONS",0,u,"RUNTIME_OPTIONS",0,c,"Section",0,w,"SectionHeader",0,S,"isAnthropicBridgeProvider",0,j,"isDraftAgent",0,b,"newAgentDraft",0,y,"newEmptyAgent",0,function(){return{id:`draft-empty-${Date.now()}`,name:"",role:"agent",description:"",avatarUrl:"",runtimeKind:"claude-code",modelProvider:"",modelId:"",apiBase:"",apiKey:"",workingDir:"",mcps:{},skills:[],tools:m,systemPrompt:"",outputStyle:"",temperature:.3,maxTokens:4096,enabled:!0}},"normalizeAgent",0,v,"serializeAgent",0,x],282180);var M=e.i(368942),N=e.i(611176),C=e.i(681622),O=e.i(188815),P=e.i(465458),E=e.i(972846),T=e.i(673478),I=e.i(433721);let D=(0,I.default)("plug-zap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);var z=e.i(451534),L=e.i(119211),A=e.i(415360),R=e.i(426022);let B=(0,I.default)("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]]);var _=e.i(129981),K=e.i(511588),F=e.i(344118),U=e.i(613812),V=e.i(113519);function q({agent:e,roleOptions:a,testing:u,testResult:m,onChange:p,onMcpChange:f,onAddSkillFiles:h,onRemoveSkill:g,onTestConnection:v}){let x=(0,n.useTranslations)("agent"),[y,b]=(0,r.useState)(()=>JSON.stringify(e.mcps,null,2)),[j,I]=(0,r.useState)(null),[H,$]=(0,r.useState)([]),[G,W]=(0,r.useState)(!1),[J,Y]=(0,r.useState)(""),[X,Q]=(0,r.useState)(!1),[Z,ee]=(0,r.useState)(""),[et,er]=(0,r.useState)(null),[en,ea]=(0,r.useState)(!1),[ei,es]=(0,r.useState)(!1),[eo,el]=(0,r.useState)(""),{models:ed,providers:ec,ensure:eu}=(0,M.useLLMStore)(),em=ed.filter(e=>!e.embedding);(0,r.useEffect)(()=>{eu()},[eu]),(0,r.useEffect)(()=>{b(JSON.stringify(e.mcps,null,2))},[e.mcps]);let ep=(0,r.useCallback)(e=>{p("apiBase",e.apiBase),p("apiKey",e.apiKey);let t=em.filter(t=>t.provider===e.name).map(e=>({value:e.modelId,label:e.name}));$(t),t.length>0&&p("modelId",t[0].value)},[em,p]),ef=async e=>{if(!e?.length)return;let t=Array.from(e).filter(e=>e.name.toLowerCase().endsWith(".md"));h(await Promise.all(t.map(async e=>({name:e.name,content:await e.text()}))))},eh=async()=>{let t=J.trim();if(t){Q(!0),er(null);try{let r=await fetch("/api/agents/presets/optimize-prompt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:t,currentPrompt:e.systemPrompt})}),n=await r.json();if(!r.ok)throw Error(n.error||"Failed to optimize prompt");ee(n.systemPrompt?.trim()||""),el(e.systemPrompt),W(!1),ea(!0)}catch(e){er(e instanceof Error?e.message:"优化提示词失败")}finally{Q(!1)}}},eg=e=>{W(e),e||X||(Y(""),er(null))};return(0,t.jsxs)("div",{className:"flex flex-col gap-5 p-5",children:[(0,t.jsxs)(w,{icon:(0,t.jsx)(R.MessageSquare,{className:"size-3.5"}),title:x("detail.basic"),children:[(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1.5",children:[(0,t.jsx)(N.AgentIcon,{name:e.name,avatarUrl:e.avatarUrl,apiBase:e.apiBase,className:"size-16 rounded-xl border border-input"}),(0,t.jsxs)("label",{className:"text-[10px] text-primary cursor-pointer hover:underline",children:[x("detail.uploadAvatar"),(0,t.jsx)("input",{type:"file",accept:"image/*",className:"hidden",onChange:async e=>{let t=e.target.files?.[0];if(!t)return;let r=new FileReader;r.onload=async()=>{try{let e=await fetch("/api/upload/avatar",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataUrl:r.result,filename:t.name})}),n=await e.json();n.url&&p("avatarUrl",n.url)}catch{}},r.readAsDataURL(t),e.target.value=""}})]}),e.avatarUrl&&(0,t.jsx)("button",{type:"button",className:"text-[10px] text-destructive hover:underline cursor-pointer",onClick:()=>p("avatarUrl",""),children:x("detail.removeAvatar")})]}),(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-2.5",children:[(0,t.jsx)(k,{label:x("detail.name"),children:(0,t.jsx)(C.Input,{value:e.name,onChange:e=>p("name",e.target.value)})}),(0,t.jsx)(k,{label:x("detail.role"),children:(0,t.jsx)("select",{value:e.role,onChange:e=>p("role",e.target.value),className:"h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:a.map(e=>(0,t.jsx)("option",{value:e,children:e},e))})})]})]}),(0,t.jsx)(k,{label:x("detail.description"),children:(0,t.jsx)(C.Input,{value:e.description,onChange:e=>p("description",e.target.value)})}),(0,t.jsx)(k,{label:x("detail.agentRuntime"),children:(0,t.jsx)(O.SearchSelect,{value:e.runtimeKind??"",onChange:e=>p("runtimeKind",e),options:c.map(e=>({value:e.value,label:x(`runtime.${e.labelKey}`)})),placeholder:x("detail.runtimePlaceholder"),searchPlaceholder:x("detail.runtimeSearchPlaceholder"),allowCustom:!1})})]}),(0,t.jsx)(w,{icon:(0,t.jsx)(z.FolderOpen,{className:"size-3.5"}),title:x("detail.workingDirectory"),children:(0,t.jsx)(C.Input,{value:e.workingDir,onChange:e=>p("workingDir",e.target.value),placeholder:x("detail.workingDirPlaceholder")})}),(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)(S,{icon:(0,t.jsx)(A.Sparkles,{className:"size-3.5"}),title:x("detail.systemPrompt"),action:(0,t.jsxs)(i.Button,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>W(!0),children:[(0,t.jsx)(K.WandSparkles,{className:"size-3.5"}),x("detail.optimizePrompt")]})}),(0,t.jsx)(s.Textarea,{value:e.systemPrompt,onChange:e=>p("systemPrompt",e.target.value),placeholder:x("detail.systemPromptPlaceholder"),className:"min-h-24 text-xs"})]}),(0,t.jsx)(w,{icon:(0,t.jsx)(A.Sparkles,{className:"size-3.5"}),title:x("detail.outputStyle"),children:(0,t.jsx)(s.Textarea,{value:e.outputStyle,onChange:e=>p("outputStyle",e.target.value),placeholder:x("detail.outputStylePlaceholder"),className:"min-h-24 text-xs"})}),(0,t.jsxs)(w,{icon:(0,t.jsx)(L.Wrench,{className:"size-3.5"}),title:x("detail.mcpServers"),children:[(0,t.jsx)(s.Textarea,{value:y,onChange:e=>(e=>{b(e);try{let t=JSON.parse(e);if(!t||"object"!=typeof t||Array.isArray(t))throw Error("MCP config must be a JSON object");I(null),f(t)}catch(e){I(e instanceof Error?e.message:"Invalid JSON")}})(e.target.value),placeholder:'{\n "mcpServers": {}\n}',className:"min-h-28 font-mono text-xs"}),j&&(0,t.jsx)("div",{className:"text-xs text-destructive",children:j})]}),(0,t.jsxs)(w,{icon:(0,t.jsx)(L.Wrench,{className:"size-3.5"}),title:x("detail.tools"),children:[(0,t.jsx)(i.Button,{variant:"outline",size:"sm",className:"w-full",onClick:()=>es(!0),children:x("detail.enabledToolsCount",{count:e.tools.length,total:(l.BUILT_IN_AGENT_TOOLS??[]).length})}),(0,t.jsx)(V.ToolsDialog,{open:ei,onOpenChange:es,selectable:!0,selectedTools:e.tools,onSelectedToolsChange:e=>p("tools",e)})]}),(0,t.jsxs)(w,{icon:(0,t.jsx)(T.Cpu,{className:"size-3.5"}),title:x("detail.skills"),children:[(0,t.jsx)("div",{className:"mb-2 flex flex-wrap gap-1.5",children:e.skills.map((e,r)=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-medium text-foreground",children:[e.name,(0,t.jsx)("button",{type:"button",onClick:()=>g(r),className:"hover:text-destructive cursor-pointer",children:(0,t.jsx)(E.X,{className:"size-2.5"})})]},r))}),(0,t.jsxs)("label",{className:"flex h-8 cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-input text-xs text-muted-foreground hover:bg-muted/50",children:[(0,t.jsx)(_.Upload,{className:"size-3.5"}),x("detail.uploadSkills"),(0,t.jsx)("input",{type:"file",accept:".md,text/markdown",multiple:!0,className:"hidden",onChange:e=>{ef(e.target.files),e.target.value=""}})]})]}),(0,t.jsxs)(w,{icon:(0,t.jsx)(B,{className:"size-3.5"}),title:x("detail.model"),children:[(0,t.jsxs)("div",{className:"space-y-2.5",children:[(0,t.jsx)(k,{label:x("detail.provider"),children:(0,t.jsx)(O.SearchSelect,{value:ec.find(t=>t.apiBase===e.apiBase&&t.apiKey===e.apiKey)?.name||"",onChange:e=>{let t=ec.find(t=>t.name===e);t&&ep(t)},options:ec.map(e=>({value:e.name,label:e.name})),placeholder:x("detail.providerPlaceholder"),searchPlaceholder:x("detail.providerSearchPlaceholder"),allowCustom:!1})}),(0,t.jsx)(k,{label:x("detail.modelField"),children:(0,t.jsx)(O.SearchSelect,{value:e.modelId,onChange:e=>p("modelId",e),options:H.length>0?H:[{value:e.modelId||"",label:e.modelId||x("detail.selectProviderFirst")}],placeholder:x("detail.modelPlaceholder"),searchPlaceholder:x("detail.modelSearchPlaceholder")})}),(0,t.jsx)(k,{label:x("detail.apiMessageType"),children:(0,t.jsx)(O.SearchSelect,{value:e.modelProvider||"",onChange:e=>p("modelProvider",e),options:d.map(e=>({value:e.value,label:x(`provider.${e.labelKey}`)})),placeholder:x("detail.apiMessageTypePlaceholder"),searchPlaceholder:x("detail.apiMessageTypeSearchPlaceholder"),allowCustom:!1})}),(0,t.jsx)(k,{label:x("detail.apiBase"),children:(0,t.jsx)(C.Input,{value:e.apiBase,onChange:e=>p("apiBase",e.target.value),placeholder:x("detail.apiBasePlaceholder"),className:"h-7 text-xs"})}),(0,t.jsx)(k,{label:x("detail.apiKey"),children:(0,t.jsx)(C.Input,{type:"password",value:e.apiKey,onChange:e=>p("apiKey",e.target.value),placeholder:x("detail.apiKeyPlaceholder"),className:"h-7 text-xs"})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:x("detail.validateHelper")}),(0,t.jsxs)(i.Button,{type:"button",variant:"outline",size:"sm",onClick:v,disabled:u||!e.apiBase||!e.apiKey||!e.modelId,children:[(0,t.jsx)(D,{className:"size-3.5"}),u?x("detail.testing"):x("detail.test")]})]}),m&&(0,t.jsxs)("div",{className:(0,P.cn)("rounded-md border px-3 py-2 text-xs",m.success?"border-green-500/30 bg-green-500/10 text-green-700":"border-destructive/30 bg-destructive/10 text-destructive"),children:[m.message,m.debug&&(0,t.jsxs)("div",{className:"mt-2 space-y-1 font-mono text-[10px] opacity-80",children:[m.debug.status&&(0,t.jsxs)("div",{children:[x("debug.status")," ",m.debug.status]}),m.debug.provider&&(0,t.jsxs)("div",{children:[x("debug.provider")," ",m.debug.provider]}),m.debug.requestUrl&&(0,t.jsxs)("div",{children:[x("debug.url")," ",m.debug.requestUrl]}),m.debug.model&&(0,t.jsxs)("div",{children:[x("debug.model")," ",m.debug.model]}),m.debug.responseBody&&(0,t.jsxs)("div",{className:"max-h-20 overflow-auto whitespace-pre-wrap",children:[x("debug.body")," ",m.debug.responseBody]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(k,{label:x("detail.temperature"),children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"range",min:0,max:2,step:.1,value:e.temperature,onChange:e=>p("temperature",parseFloat(e.target.value)),className:"flex-1"}),(0,t.jsx)("span",{className:"w-8 text-right font-mono text-xs",children:e.temperature})]})}),(0,t.jsx)(k,{label:x("detail.maxTokens"),children:(0,t.jsx)(C.Input,{type:"number",value:e.maxTokens,onChange:e=>p("maxTokens",parseInt(e.target.value)||0),className:"h-7 text-xs"})})]})]}),(0,t.jsx)(o.Dialog,{open:G,onOpenChange:eg,children:(0,t.jsxs)(o.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(o.DialogHeader,{children:[(0,t.jsx)(o.DialogTitle,{children:x("detail.optimizePrompt")}),(0,t.jsx)(o.DialogDescription,{children:x("detail.optimizePromptDescription")})]}),(0,t.jsx)(s.Textarea,{value:J,onChange:e=>Y(e.target.value),placeholder:x("detail.optimizePromptPlaceholder"),className:"min-h-32 text-sm"}),et&&(0,t.jsx)("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:et}),(0,t.jsxs)(o.DialogFooter,{children:[(0,t.jsx)(i.Button,{variant:"outline",onClick:()=>eg(!1),disabled:X,children:x("detail.cancel")}),(0,t.jsx)(i.Button,{onClick:eh,disabled:X||!J.trim(),children:X?x("detail.optimizing"):x("detail.optimizeConfirm")})]})]})}),(0,t.jsx)(o.Dialog,{open:en,onOpenChange:ea,children:(0,t.jsxs)(o.DialogContent,{className:"!w-[min(92vw,1200px)] !max-w-[min(92vw,1200px)] !h-[85vh] flex flex-col gap-0 overflow-hidden p-0",children:[(0,t.jsxs)(o.DialogHeader,{className:"border-b px-4 py-3",children:[(0,t.jsx)(o.DialogTitle,{children:x("detail.optimizePreviewTitle")}),(0,t.jsx)(o.DialogDescription,{children:x("detail.optimizePreviewDescription")})]}),(0,t.jsxs)("div",{className:"grid min-h-0 flex-1 grid-cols-1 lg:grid-cols-2",children:[(0,t.jsx)("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r",children:(0,t.jsx)(U.DiffViewer,{oldContent:eo,newContent:Z,path:"system-prompt.md"})}),(0,t.jsxs)("div",{className:"flex min-h-0 flex-col border-t lg:border-t-0",children:[(0,t.jsxs)("div",{className:"border-b px-4 py-3",children:[(0,t.jsx)("div",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:x("detail.optimizeRequest")}),(0,t.jsx)("div",{className:"mt-2 whitespace-pre-wrap text-sm text-foreground",children:J})]}),(0,t.jsxs)("div",{className:"flex-1 min-h-0 overflow-auto px-4 py-3",children:[(0,t.jsx)("div",{className:"mb-2 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:x("detail.optimizedPrompt")}),(0,t.jsx)("pre",{className:"whitespace-pre-wrap text-sm leading-6 text-foreground",children:Z})]})]})]}),(0,t.jsxs)(o.DialogFooter,{className:"border-t m-1",children:[(0,t.jsxs)(i.Button,{variant:"outline",onClick:()=>ea(!1),children:[(0,t.jsx)(E.X,{className:"size-3.5"}),x("detail.cancel")]}),(0,t.jsxs)(i.Button,{onClick:()=>{Z.trim()&&(p("systemPrompt",Z),ea(!1),ee(""),el(""),Y(""))},children:[(0,t.jsx)(F.Check,{className:"size-3.5"}),x("detail.applyOptimizedPrompt")]})]})]})})]})}let H=(0,r.forwardRef)(function({agent:e,roleOptions:l=u,onSaved:d,onBack:c,showFooter:m=!0,autoOpenGenerate:p=!1,presetBasePath:f="/api/agents/presets"},h){let g=(0,n.useTranslations)("agent"),w=(0,n.useTranslations)("common"),[k,S]=(0,r.useState)({...e}),[M,N]=(0,r.useState)(!1),[C,O]=(0,r.useState)(!1),[P,E]=(0,r.useState)(null),[T,I]=(0,r.useState)(null),[D,z]=(0,r.useState)(0),[L,A]=(0,r.useState)(p),[R,B]=(0,r.useState)(""),[_,K]=(0,r.useState)(!1);(0,r.useImperativeHandle)(h,()=>({reset(){S(t=>{if(!t)return{...e};let{modelProvider:r,modelId:n,apiBase:a,apiKey:i,runtimeKind:s}=t;return{...e,modelProvider:r,modelId:n,apiBase:a,apiKey:i,runtimeKind:s}}),E(null),z(e=>e+1)},openGenerate(){A(!0)}}));let F=async()=>{if(k){N(!0),I(null);try{let e=b(k),t=x(k),r=await fetch(e?f:`${f}/${k.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e?t:k)});if(!r.ok)throw Error(await r.text());let n=await r.json(),i=v(n);"/api/agents/presets"===f&&a.useAgentStore.setState(t=>({agents:e?[...t.agents,n]:t.agents.map(e=>e.id===n.id?n:e)})),d(i)}catch{I(g("error.saveFailed"))}finally{N(!1)}}},U=async()=>{if(k){O(!0),E(null),I(null);try{let e=await fetch(`${f}/test-connection`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}),t=await e.json();E({success:!!t.success,message:t.message||t.error||g("error.connectionTestFailed"),debug:t.debug?{...t.debug,status:e.status}:{status:e.status}})}catch(e){E({success:!1,message:e instanceof Error?e.message:g("error.connectionTestFailed")})}finally{O(!1)}}},V=async()=>{let e=R.trim();if(e){K(!0),I(null);try{let t=await fetch(`${f}/generate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:e})}),r=await t.json();if(!t.ok)throw Error(r.error||"Failed to generate agent");let n=k??y(l[0]??"agent"),a={...n,name:r.name?.trim()||n.name,description:r.description?.trim()||n.description,systemPrompt:r.systemPrompt?.trim()||n.systemPrompt};S(a),A(!1),B(""),E(null)}catch(e){I(e instanceof Error?e.message:"智能创建 Agent 失败")}finally{K(!1)}}};return(0,t.jsxs)(t.Fragment,{children:[T&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:T}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,t.jsx)(q,{agent:k,roleOptions:l,testing:C,testResult:P,onChange:(e,t)=>{S(r=>r?"modelProvider"===e?{...r,modelProvider:t,runtimeKind:j(t)?"claude-code":r.runtimeKind}:"runtimeKind"===e?{...r,runtimeKind:t}:{...r,[e]:t}:r)},onMcpChange:e=>{S(t=>t?{...t,mcps:e}:t)},onAddSkillFiles:e=>{if(!k)return;let t=new Set(k.skills.map(e=>e.name));S(r=>r?{...r,skills:[...r.skills.filter(t=>!e.some(e=>e.name===t.name)),...e.filter(e=>e.name&&!t.has(e.name)),...e.filter(e=>t.has(e.name))]}:r)},onRemoveSkill:e=>{k&&S(t=>t?{...t,skills:t.skills.filter((t,r)=>r!==e)}:t)},onTestConnection:U},`${k.id}-${D}`)}),m&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,t.jsx)(i.Button,{variant:"outline",size:"sm",onClick:c,disabled:M,children:w("cancel")}),(0,t.jsx)(i.Button,{size:"sm",onClick:F,disabled:M,children:w(M?"saving":"save")})]}),(0,t.jsx)(o.Dialog,{open:L,onOpenChange:A,children:(0,t.jsxs)(o.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(o.DialogHeader,{children:[(0,t.jsx)(o.DialogTitle,{children:"智能创建 Agent"}),(0,t.jsx)(o.DialogDescription,{children:"输入 Agent 的职责、使用场景和约束,系统会生成名称、描述和 Markdown 系统提示。"})]}),(0,t.jsx)(s.Textarea,{value:R,onChange:e=>B(e.target.value),placeholder:"例如:创建一个代码评审 Agent,专注发现 TypeScript/React 项目中的缺陷、回归风险和缺失测试。",className:"min-h-32 text-sm"}),(0,t.jsxs)(o.DialogFooter,{children:[(0,t.jsx)(i.Button,{variant:"outline",onClick:()=>A(!1),disabled:_,children:w("cancel")}),(0,t.jsx)(i.Button,{onClick:V,disabled:_||!R.trim(),children:_?"生成中...":"生成"})]})]})})]})});e.s(["AgentEditor",0,H],965322)}]);
|
|
@@ -0,0 +1 @@
|
|
|
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)},896841,e=>{"use strict";var t=e.i(344180),s=e.i(764556),i=e.i(244073),a=e.i(191118),n=e.i(31807),o=e.i(327964),r=e.i(355819),c=e.i(361031),l=e.i(588591),d=e.i(62669),u=e.i(515104),m=e.i(226624),p=e.i(817854),x=e.i(451534),h=e.i(227634),f=e.i(191441);function g({icon:e,label:s,value:i}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:e}),(0,t.jsx)("span",{className:"text-muted-foreground shrink-0",children:s}),(0,t.jsx)("span",{className:"truncate text-foreground ml-auto",title:i,children:i})]})}function j({workspace:e,channelCount:a,issueCount:n}){let o=(0,i.useTranslations)("projectSettings"),[r,c]=(0,s.useState)(!0===e.autoProcessIssues),[l,u]=(0,s.useState)(!1!==e.hooksEnabled),[v,b]=(0,s.useState)(!1),N=async t=>{if(!v){b(!0);try{let s=await fetch(`/api/workspaces/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({autoProcessIssues:t})}),i=await s.json();c(!0===i.autoProcessIssues)}finally{b(!1)}}},w=async t=>{if(!v){b(!0);try{let s=await fetch(`/api/workspaces/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({hooksEnabled:t})}),i=await s.json();u(!1!==i.hooksEnabled)}finally{b(!1)}}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:o("info.title")}),(0,t.jsx)(g,{icon:(0,t.jsx)(x.FolderOpen,{size:14}),label:o("info.path"),value:e.boundDirs[0]??"-"}),(0,t.jsx)(g,{icon:(0,t.jsx)(h.Hash,{size:14}),label:o("info.channels"),value:String(a)}),(0,t.jsx)(g,{icon:(0,t.jsx)(f.ListChecks,{size:14}),label:o("info.issues"),value:String(n)})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:o("automation.title")}),(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md border px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,t.jsx)(p.Label,{htmlFor:"auto-process",className:"text-sm font-medium",children:o("automation.autoProcess")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:o("automation.autoProcessDescription")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[v&&(0,t.jsx)(d.Loader2,{className:"h-3 w-3 animate-spin text-muted-foreground"}),(0,t.jsx)(m.Switch,{id:"auto-process",checked:r,onCheckedChange:N,disabled:v})]})]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:o("hooks.title")}),(0,t.jsxs)("div",{className:"flex items-center justify-between rounded-md border px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,t.jsx)(p.Label,{htmlFor:"hooks-enabled",className:"text-sm font-medium",children:o("hooks.enableHooks")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:o("hooks.enableHooksDescription")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[v&&(0,t.jsx)(d.Loader2,{className:"h-3 w-3 animate-spin text-muted-foreground"}),(0,t.jsx)(m.Switch,{id:"hooks-enabled",checked:l,onCheckedChange:w,disabled:v})]})]})]})]})}var v=e.i(260218),b=e.i(812057),N=e.i(36539),N=N,w=e.i(325443),y=e.i(244996),k=e.i(92457),S=e.i(600304),T=e.i(360112);let C=[{value:"issue_started",labelKey:"events.issueStarted"},{value:"issue_completed",labelKey:"events.issueCompleted"},{value:"issue_task_completed",labelKey:"events.taskCompleted"},{value:"channel_agent_completed",labelKey:"events.channelAgentCompleted"}];function P(){return{enabled:!1,provider:"lark",events:["issue_started","issue_completed","issue_task_completed"],lark:{},wechat:{}}}function A({workspaceId:e,workspace:a,notificationDraft:n,setNotificationDraft:o,setWorkspace:r,botAgents:l,agentDialogOpen:x,setAgentDialogOpen:h}){let f=(0,i.useTranslations)("projectSettings"),g=(0,i.useTranslations)("common"),[j,F]=(0,s.useState)(!1),[E,R]=(0,s.useState)(!1),[L,O]=(0,s.useState)(!1),[I,D]=(0,s.useState)("default"),[z,$]=(0,s.useState)(!1),[B,_]=(0,s.useState)([]);(0,s.useEffect)(()=>{fetch("/api/robot-accounts").then(e=>e.json()).then(e=>_(e)).catch(()=>{})},[]);let U=(0,c.useWorkspaceStore)(e=>e.upsertWorkspace);(0,s.useEffect)(()=>{$((0,u.isNativeAndroidEnvironment)()),(0,u.getNotificationPermission)().then(D)},[]);let G=async t=>{if(!a||j)return null;F(!0);try{let s=await fetch(`/api/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationSettings:t})});if(!s.ok){let e=await s.json().catch(()=>null);throw Error(e?.error||"Failed to save notification settings")}let i=await s.json();return r(i),U(i),o(i.notificationSettings??P()),i}catch(e){return T.toast.error(f("notifications.saveFailed"),{description:e instanceof Error?e.message:void 0}),null}finally{F(!1)}},K=e=>{let t={...n,...e,lark:{...n.lark,...e.lark},wechat:{...n.wechat,...e.wechat},native:{...n.native,...e.native}};o(t),G(t)},J=async()=>{if(!E){R(!0);try{if(!await G(n))throw Error("Failed to save notification settings");let t=await fetch(`/api/workspaces/${e}/notifications/start`,{method:"POST"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to start notification service")}let s=await t.json();s.workspace?(r(s.workspace),o(s.workspace.notificationSettings??P())):o({...n,serviceRunning:!0}),T.toast.success(f("notifications.startSuccess"))}catch(e){T.toast.error(f("notifications.startFailed"),{description:e instanceof Error?e.message:void 0})}finally{R(!1)}}},W=async()=>{if(!E){R(!0);try{let t=await fetch(`/api/workspaces/${e}/notifications/stop`,{method:"POST"});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to stop notification service")}let s=await t.json();s.workspace?(r(s.workspace),o(s.workspace.notificationSettings??P())):o({...n,serviceRunning:!1}),T.toast.success(f("notifications.stopSuccess"))}catch(e){T.toast.error(f("notifications.stopFailed"),{description:e instanceof Error?e.message:void 0})}finally{R(!1)}}},H=async()=>{if(!L){O(!0);try{let t=await fetch(`/api/workspaces/${e}/notifications/test`,{method:"POST"}),s=await t.json().catch(()=>null);if(!t.ok)throw Error(s?.reason||s?.error||"Failed to send test notification");T.toast.success(f("notifications.testSuccess"))}catch(e){T.toast.error(f("notifications.testFailed"),{description:e instanceof Error?e.message:void 0})}finally{O(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:f("notifications.title")}),(0,t.jsxs)("div",{className:"space-y-4 rounded-md border px-3 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,t.jsx)(p.Label,{htmlFor:"message-notifications",className:"text-sm font-medium",children:f("notifications.messageNotifications")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:f("notifications.messageNotificationsDescription")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[j&&(0,t.jsx)(d.Loader2,{className:"h-3 w-3 animate-spin text-muted-foreground"}),(0,t.jsx)(m.Switch,{id:"message-notifications",checked:n.enabled,onCheckedChange:e=>K({enabled:e}),disabled:j})]})]}),n.enabled&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)(b.Tabs,{value:n.provider,onValueChange:e=>K({provider:e}),className:"flex flex-col",children:[(0,t.jsxs)(b.TabsList,{className:"grid w-full grid-cols-3",children:[(0,t.jsx)(b.TabsTrigger,{value:"lark",children:f("notifications.lark")}),(0,t.jsx)(b.TabsTrigger,{value:"wechat",children:f("notifications.wechat")}),(0,t.jsx)(b.TabsTrigger,{value:"native",children:f("notifications.native")})]}),(0,t.jsxs)(b.TabsContent,{value:"lark",className:"space-y-3 pt-2",children:[(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)(p.Label,{className:"text-xs text-muted-foreground",children:f("notifications.selectRobotAccount")}),(0,t.jsxs)("select",{value:n.robotAccountId??"",onChange:e=>K({robotAccountId:e.target.value||void 0}),disabled:j,className:"h-8 min-w-0 flex-1 rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:[(0,t.jsx)("option",{value:"",children:f("notifications.selectRobotAccount")}),B.filter(e=>"lark"===e.type).map(e=>(0,t.jsxs)("option",{value:e.id,children:[e.name," (",e.lark?.appId,")"]},e.id))]}),0===B.filter(e=>"lark"===e.type).length&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:f("notifications.noRobotAccount")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:n.serviceRunning?"outline":"default",onClick:n.serviceRunning?W:J,disabled:E||j||!n.robotAccountId,children:[E?(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(S.Send,{className:"mr-2 h-3.5 w-3.5"}),n.serviceRunning?f("notifications.stopService"):f("notifications.startService")]}),(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:H,disabled:L||j||!n.serviceRunning,children:[L&&(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),f("notifications.testSend")]})]})]}),(0,t.jsxs)(b.TabsContent,{value:"wechat",className:"space-y-3 pt-2",children:[(0,t.jsxs)("div",{className:"grid gap-2",children:[(0,t.jsx)(p.Label,{className:"text-xs text-muted-foreground",children:f("notifications.selectRobotAccount")}),(0,t.jsxs)("select",{value:n.robotAccountId??"",onChange:e=>K({robotAccountId:e.target.value||void 0}),disabled:j,className:"h-8 min-w-0 flex-1 rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:[(0,t.jsx)("option",{value:"",children:f("notifications.selectRobotAccount")}),B.filter(e=>"wechat"===e.type).map(e=>(0,t.jsxs)("option",{value:e.id,children:[e.name," (",e.wechat?.accountId,")"]},e.id))]}),0===B.filter(e=>"wechat"===e.type).length&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:f("notifications.noRobotAccount")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:n.serviceRunning?"outline":"default",onClick:n.serviceRunning?W:J,disabled:E||j||!n.robotAccountId,children:[E?(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(S.Send,{className:"mr-2 h-3.5 w-3.5"}),n.serviceRunning?f("notifications.stopService"):f("notifications.startService")]}),(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:H,disabled:L||j||!n.serviceRunning,children:[L&&(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),f("notifications.testSend")]})]})]}),(0,t.jsxs)(b.TabsContent,{value:"native",className:"space-y-3 pt-2",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:f("notifications.nativeDescription")}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(k.Monitor,{className:"h-4 w-4 text-muted-foreground"}),(0,t.jsxs)("span",{className:"font-medium",children:["granted"===I&&(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(y.CheckCircle2,{className:"h-4 w-4 text-emerald-600"}),f("notifications.nativePermissionGranted")]}),"denied"===I&&f("notifications.nativePermissionDenied"),"default"===I&&f("notifications.nativePermissionDefault"),"unsupported"===I&&f("notifications.nativePermissionUnsupported")]})]}),"unsupported"!==I&&"granted"!==I&&(0,t.jsx)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:async()=>{let e=await (0,u.requestNotificationPermission)();D(e),"granted"===e?(K({native:{permissionGranted:!0}}),T.toast.success(f("notifications.nativePermissionGrantedToast"))):"denied"===e&&T.toast.error(f("notifications.nativePermissionDeniedToast"))},disabled:"denied"===I,children:f("notifications.nativeRequestPermission")})]}),z&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border px-3 py-2.5",children:[(0,t.jsxs)("div",{className:"space-y-0.5 pr-4",children:[(0,t.jsx)(p.Label,{htmlFor:"android-ongoing-task-notification",className:"text-sm font-medium",children:f("notifications.androidOngoingTaskNotification")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:f("notifications.androidOngoingTaskNotificationDescription")})]}),(0,t.jsx)(m.Switch,{id:"android-ongoing-task-notification",checked:n.native?.androidOngoingTaskNotification??!1,onCheckedChange:e=>K({native:{permissionGranted:n.native?.permissionGranted,androidOngoingTaskNotification:e}}),disabled:j||"granted"!==I})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,t.jsx)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:async()=>{try{await (0,u.sendNativeNotification)("Agent Spaces",f("notifications.nativeTestSuccess")),T.toast.success(f("notifications.nativeTestSent"),{duration:5e3})}catch(e){T.toast.error(`${f("notifications.nativeTestFailed")}: ${e instanceof Error?e.message:e}`,{duration:5e3})}},disabled:"granted"!==I,children:f("notifications.testSend")})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)(w.Bot,{className:"h-3.5 w-3.5"}),f("botAgent.title")]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("select",{value:n.botAgentId??"",onChange:e=>{K({botAgentId:e.target.value||void 0})},disabled:j,className:"h-8 min-w-0 flex-1 rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none focus-visible:border-ring dark:bg-input/30",children:[(0,t.jsx)("option",{value:"",children:f("botAgent.selectAgent")}),l.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,t.jsx)(v.Button,{type:"button",size:"sm",variant:"outline",onClick:()=>h(!0),children:g("manage")})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[(0,t.jsx)(N.default,{className:"h-3.5 w-3.5"}),f("events.title")]}),(0,t.jsx)("div",{className:"grid gap-2",children:C.map(e=>(0,t.jsxs)("label",{className:"flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:[(0,t.jsx)("input",{type:"checkbox",className:"h-4 w-4 accent-primary",checked:n.events.includes(e.value),onChange:t=>{var s,i;let a;return s=e.value,i=t.target.checked,a=new Set(n.events),void(i?a.add(s):a.delete(s),K({events:Array.from(a)}))},disabled:j}),(0,t.jsx)("span",{children:f(e.labelKey)})]},e.value))})]})]})]})]})}var F=e.i(788010),E=e.i(583705),R=e.i(638322);function L({workspaceId:e,initialPrompt:a}){let n=(0,i.useTranslations)("projectSettings"),[o,r]=(0,s.useState)(a),[c,l]=(0,s.useState)(a),[u,m]=(0,s.useState)(!1),x=o!==c,h=async()=>{if(!u){m(!0);try{let t=await fetch(`/api/workspaces/${e}/prompt`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:o})});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error||"Failed to save workspace prompt")}let s=await t.json();r(s.prompt),l(s.prompt),T.toast.success(n("prompt.saveSuccess"))}catch(e){T.toast.error(n("prompt.saveFailed"),{description:e instanceof Error?e.message:void 0})}finally{m(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("h4",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:n("prompt.title")}),(0,t.jsxs)("div",{className:"space-y-3 rounded-md border px-3 py-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(p.Label,{htmlFor:"workspace-prompt",className:"text-sm font-medium",children:n("prompt.workspacePrompt")}),(0,t.jsx)(R.TooltipProvider,{delay:200,children:(0,t.jsxs)(R.Tooltip,{children:[(0,t.jsx)(R.TooltipTrigger,{className:"inline-flex",children:(0,t.jsx)(E.Info,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),(0,t.jsx)(R.TooltipContent,{side:"top",className:"max-w-xs",children:(0,t.jsx)("p",{children:n("prompt.description")})})]})})]}),(0,t.jsx)(F.Textarea,{id:"workspace-prompt",value:o,onChange:e=>r(e.target.value),className:"min-h-36 resize-y text-sm"}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)(v.Button,{type:"button",size:"sm",onClick:h,disabled:u||!x,children:[u&&(0,t.jsx)(d.Loader2,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),n("prompt.savePrompt")]})})]})]})}e.s(["ProjectSettingsPanel",0,function({workspaceId:e}){let m=(0,i.useTranslations)("projectSettings"),[p,x]=(0,s.useState)(null),[h,f]=(0,s.useState)(""),[g,v]=(0,s.useState)(!0),[b,N]=(0,s.useState)(!1),[w,y]=(0,s.useState)(P()),k=(0,n.useChannelStore)(e=>e.channels),S=(0,o.useIssueStore)(e=>e.issues),T=(0,r.useAgentStore)(e=>e.agents).filter(e=>"bot"===e.role&&!1!==e.enabled),C=(0,c.useWorkspaceStore)(e=>e.upsertWorkspace);return((0,s.useEffect)(()=>{Promise.all([fetch(`/api/workspaces/${e}`).then(e=>e.json()),fetch(`/api/workspaces/${e}/prompt`).then(e=>e.json())]).then(([t,s])=>{x(t),C(t),f(s.prompt??"");let i=t.notificationSettings??P();y(i),v(!1),(0,u.getNotificationPermission)().then(t=>{if("granted"===t&&"native"===i.provider&&!i.native?.permissionGranted){let t={...i,native:{...i.native,permissionGranted:!0}};y(t),fetch(`/api/workspaces/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationSettings:t})}).then(e=>e.json()).then(e=>{x(e),C(e)})}})}).catch(()=>v(!1))},[e,C]),g)?(0,t.jsxs)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:[(0,t.jsx)(d.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),m("loading")]}):p?(0,t.jsxs)(a.ScrollArea,{className:"h-full",children:[(0,t.jsx)("div",{className:"flex items-center px-2 py-1.5 border-b text-xs font-medium text-muted-foreground",children:(0,t.jsx)("span",{children:m("title")})}),(0,t.jsxs)("div",{className:"p-4 space-y-6",children:[(0,t.jsx)(j,{workspace:p,channelCount:k.length,issueCount:S.length}),(0,t.jsx)(A,{workspaceId:e,workspace:p,notificationDraft:w,setNotificationDraft:y,setWorkspace:x,botAgents:T,agentDialogOpen:b,setAgentDialogOpen:N}),(0,t.jsx)(L,{workspaceId:e,initialPrompt:h})]}),(0,t.jsx)(l.AgentDialog,{open:b,onOpenChange:N,roleFilter:"bot"})]}):(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:m("workspaceNotFound")})}],896841)},985646,e=>{e.n(e.i(896841))}]);
|