agent-tower 0.6.0-beta.0 → 0.6.0-beta.1
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/README.md +2 -0
- package/dist/executors/__tests__/providers-availability.test.js +18 -1
- package/dist/executors/__tests__/providers-availability.test.js.map +1 -1
- package/dist/executors/index.js +2 -2
- package/dist/executors/index.js.map +1 -1
- package/dist/routes/__tests__/providers.test.js +16 -0
- package/dist/routes/__tests__/providers.test.js.map +1 -1
- package/dist/routes/providers.d.ts.map +1 -1
- package/dist/routes/providers.js +12 -5
- package/dist/routes/providers.js.map +1 -1
- package/dist/routes/system.d.ts.map +1 -1
- package/dist/routes/system.js +1 -7
- package/dist/routes/system.js.map +1 -1
- package/dist/runtime/__tests__/acp-agent-definitions.test.js +7 -0
- package/dist/runtime/__tests__/acp-agent-definitions.test.js.map +1 -1
- package/dist/runtime/__tests__/acp-driver-cleanup.test.js +3 -1
- package/dist/runtime/__tests__/acp-driver-cleanup.test.js.map +1 -1
- package/dist/runtime/__tests__/acp-driver-lifecycle.test.d.ts +2 -0
- package/dist/runtime/__tests__/acp-driver-lifecycle.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/acp-driver-lifecycle.test.js +241 -0
- package/dist/runtime/__tests__/acp-driver-lifecycle.test.js.map +1 -0
- package/dist/runtime/__tests__/acp-history-reconciler.test.d.ts +2 -0
- package/dist/runtime/__tests__/acp-history-reconciler.test.d.ts.map +1 -0
- package/dist/runtime/__tests__/acp-history-reconciler.test.js +69 -0
- package/dist/runtime/__tests__/acp-history-reconciler.test.js.map +1 -0
- package/dist/runtime/__tests__/runtime-coordinator.test.js +41 -0
- package/dist/runtime/__tests__/runtime-coordinator.test.js.map +1 -1
- package/dist/runtime/acp/acp-driver.d.ts.map +1 -1
- package/dist/runtime/acp/acp-driver.js +61 -26
- package/dist/runtime/acp/acp-driver.js.map +1 -1
- package/dist/runtime/acp/agents/codex.d.ts.map +1 -1
- package/dist/runtime/acp/agents/codex.js +2 -0
- package/dist/runtime/acp/agents/codex.js.map +1 -1
- package/dist/runtime/acp/agents/pi-coding-agent.d.ts.map +1 -1
- package/dist/runtime/acp/agents/pi-coding-agent.js +6 -4
- package/dist/runtime/acp/agents/pi-coding-agent.js.map +1 -1
- package/dist/runtime/acp/history-reconciler.d.ts +8 -0
- package/dist/runtime/acp/history-reconciler.d.ts.map +1 -0
- package/dist/runtime/acp/history-reconciler.js +82 -0
- package/dist/runtime/acp/history-reconciler.js.map +1 -0
- package/dist/runtime/contracts.d.ts +4 -0
- package/dist/runtime/contracts.d.ts.map +1 -1
- package/dist/runtime/runtime-coordinator.d.ts +2 -1
- package/dist/runtime/runtime-coordinator.d.ts.map +1 -1
- package/dist/runtime/runtime-coordinator.js +27 -7
- package/dist/runtime/runtime-coordinator.js.map +1 -1
- package/dist/services/__tests__/session-manager.lifecycle.test.js +4 -2
- package/dist/services/__tests__/session-manager.lifecycle.test.js.map +1 -1
- package/dist/services/__tests__/session-manager.team-run.test.js +6 -0
- package/dist/services/__tests__/session-manager.team-run.test.js.map +1 -1
- package/dist/services/mcp-config.integration.test.d.ts +2 -0
- package/dist/services/mcp-config.integration.test.d.ts.map +1 -0
- package/dist/services/mcp-config.integration.test.js +75 -0
- package/dist/services/mcp-config.integration.test.js.map +1 -0
- package/dist/services/mcp-config.service.d.ts +10 -3
- package/dist/services/mcp-config.service.d.ts.map +1 -1
- package/dist/services/mcp-config.service.js +70 -18
- package/dist/services/mcp-config.service.js.map +1 -1
- package/dist/services/mcp-config.service.test.js +44 -13
- package/dist/services/mcp-config.service.test.js.map +1 -1
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +27 -9
- package/dist/services/session-manager.js.map +1 -1
- package/dist/utils/process-launch.d.ts.map +1 -1
- package/dist/utils/process-launch.js +1 -3
- package/dist/utils/process-launch.js.map +1 -1
- package/dist/utils/process-launch.test.js +2 -17
- package/dist/utils/process-launch.test.js.map +1 -1
- package/dist/web/agent-icons/codex.svg +4 -1
- package/dist/web/agent-icons/grok-build.svg +5 -0
- package/dist/web/agent-icons/kiro-cli.svg +6 -0
- package/dist/web/agent-icons/opencode.svg +5 -0
- package/dist/web/agent-icons/pi-coding-agent.svg +5 -0
- package/dist/web/agent-icons/qwen-code.svg +13 -0
- package/dist/web/assets/{AgentDemoPage-BpUO2gR6.js → AgentDemoPage-XrttOpQW.js} +1 -1
- package/dist/web/assets/{AgentEnvironmentSettingsPage-CSBMaAvL.js → AgentEnvironmentSettingsPage-CAo0bCpZ.js} +1 -1
- package/dist/web/assets/{AgentLogo-C190Z6bw.js → AgentLogo-BCwbooTN.js} +1 -1
- package/dist/web/assets/{ConversationPage-Cer_WtdC.js → ConversationPage-kyHuICil.js} +1 -1
- package/dist/web/assets/{CreateTaskInput-ByeWDjc8.js → CreateTaskInput-B67vzMJD.js} +1 -1
- package/dist/web/assets/{DemoPage-Dpb9aAKX.js → DemoPage-DHMh9-zU.js} +1 -1
- package/dist/web/assets/{GeneralSettingsPage-TqbAsCZM.js → GeneralSettingsPage-DvWaqR9O.js} +1 -1
- package/dist/web/assets/{Icons-CyNNz4Z5.js → Icons-DADUmnB1.js} +1 -1
- package/dist/web/assets/{LoadingPreviewPage-DmH1TGln.js → LoadingPreviewPage-Dk91Ua1W.js} +1 -1
- package/dist/web/assets/{McpSettingsPage-z1_NcsMR.js → McpSettingsPage-CH8jFyxp.js} +1 -1
- package/dist/web/assets/{MemberAvatar-BPoYS6Il.js → MemberAvatar-l-WCdlLA.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-CNsRJ6nN.js → NotificationSettingsPage-Byu8b9X3.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-g1RKcEbo.js → ProfileSettingsPage-BdylqWUj.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-j2v5fLfg.js → ProjectKanbanPage--cx6wNDR.js} +3 -3
- package/dist/web/assets/{ProjectSettingsPage-Cp89NvwE.js → ProjectSettingsPage-6psG0Vfc.js} +1 -1
- package/dist/web/assets/ProviderSettingsPage-BPEEkhtA.js +93 -0
- package/dist/web/assets/{SettingsMasterDetail-BYB-1oyf.js → SettingsMasterDetail-DTGIIGdI.js} +1 -1
- package/dist/web/assets/{TeamSettingsPage-Y2zCVbVD.js → TeamSettingsPage-BXuG4Bou.js} +1 -1
- package/dist/web/assets/{arc-BmDnqN7Q.js → arc-DrcjdWTE.js} +1 -1
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-BIG4K9gT.js → architectureDiagram-3BPJPVTR-CAoBhXSL.js} +1 -1
- package/dist/web/assets/{arrow-left-CB4qTjQs.js → arrow-left-CCWDjOmp.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-CowveYw0.js → blockDiagram-GPEHLZMM-CcTSBbUq.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-CLjbYgNG.js → c4Diagram-AAUBKEIU-BuUKdgUg.js} +1 -1
- package/dist/web/assets/channel-Bh_PCZNP.js +1 -0
- package/dist/web/assets/check-BN_PVKzE.js +1 -0
- package/dist/web/assets/{chevron-down-BXYCSpWd.js → chevron-down-BQcW9sFf.js} +1 -1
- package/dist/web/assets/{chevron-right-CkcSaX8x.js → chevron-right-pH923eYp.js} +1 -1
- package/dist/web/assets/{chevron-up-Y8L6pbzc.js → chevron-up-DyQW115F.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-DRf_miP4.js → chunk-2J33WTMH-BWNSmQa8.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-C6Ne_vwR.js → chunk-4BX2VUAB-Blldhw0k.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-DejCglMr.js → chunk-55IACEB6-hTffyPXL.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-B0MC9Ojc.js → chunk-727SXJPM-Cd48r7c-.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-D9f4hbMX.js → chunk-AQP2D5EJ-BdDrOIL7.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-k90hkOQq.js → chunk-FMBD7UC4-6XIvQYVJ.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-CX2-qxPx.js → chunk-ND2GUHAM-BJlcb_pB.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-CpFs7UD0.js → chunk-QZHKN3VN-3TZzFkxK.js} +1 -1
- package/dist/web/assets/{circle-alert-ClX4sQ2K.js → circle-alert-oa-BQ5e7.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-B0lQFDoP.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-B0lQFDoP.js +1 -0
- package/dist/web/assets/{code-block-OCS4YCEC-_lkU1VUC.js → code-block-OCS4YCEC-xJQWFyR7.js} +1 -1
- package/dist/web/assets/{confirm-dialog-BJwzwwOk.js → confirm-dialog-CRiC3xBd.js} +1 -1
- package/dist/web/assets/{copy-jQAntc98.js → copy-DaoAUKTO.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-CLWAfEVg.js → cose-bilkent-S5V4N54A-Cjcm-rW_.js} +1 -1
- package/dist/web/assets/{cssMode-q0rL0Hjc.js → cssMode-_D6u4YDd.js} +1 -1
- package/dist/web/assets/{dagre-BM42HDAG-DKviWU-X.js → dagre-BM42HDAG-YqubcAJi.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-L6emXRJ1.js → diagram-2AECGRRQ-Dk4ayFqg.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-CXGUerks.js → diagram-5GNKFQAL-CQ0joYfB.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-C8FHXqeH.js → diagram-KO2AKTUF-DmuZzIdW.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-Cng_aa5j.js → diagram-LMA3HP47-YTPEfEZy.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-BEC6IDf4.js → diagram-OG6HWLK6-DmwRuz8-.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-BWMCTdYK.js → erDiagram-TEJ5UH35-LRL_DMXa.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-aAEYIyx2.js → flowDiagram-I6XJVG4X-ELBDyOvk.js} +1 -1
- package/dist/web/assets/{folder-picker-CioQjSzV.js → folder-picker-WUhXxIM5.js} +1 -1
- package/dist/web/assets/{freemarker2-DZgAIr6s.js → freemarker2-DxJFkRz5.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-DVqWnwcH.js → ganttDiagram-6RSMTGT7-D0e9ILuF.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-BVWrTXBv.js → gitGraphDiagram-PVQCEYII-Ck6OXXw0.js} +1 -1
- package/dist/web/assets/{handlebars-9RRQrLUb.js → handlebars-djdO6ZKR.js} +1 -1
- package/dist/web/assets/{html-BVI4F9TT.js → html-CHeBxmFi.js} +1 -1
- package/dist/web/assets/{htmlMode-t0djrjSv.js → htmlMode-SZh8FaPi.js} +1 -1
- package/dist/web/assets/{index-Da9mzleR.js → index-CjdqAcbu.js} +4 -4
- package/dist/web/assets/{index-RYlllU6n.js → index-D9kBRMR0.js} +3 -3
- package/dist/web/assets/{infoDiagram-5YYISTIA-DYG1ew4x.js → infoDiagram-5YYISTIA-Cx8be-MV.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-COBW1j3-.js → ishikawaDiagram-YF4QCWOH-Dlc7akl7.js} +1 -1
- package/dist/web/assets/javascript-l6fV6hf7.js +1 -0
- package/dist/web/assets/{journeyDiagram-JHISSGLW-BI_FlncW.js → journeyDiagram-JHISSGLW-BVDSbS9-.js} +1 -1
- package/dist/web/assets/{jsonMode-A5wuW-PC.js → jsonMode-B5CJhoWd.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-BKrHEd7r.js → kanban-definition-UN3LZRKU-nFR0zB7B.js} +1 -1
- package/dist/web/assets/{layers-BZMh9pqm.js → layers-Bo4aml98.js} +1 -1
- package/dist/web/assets/{linear-DyoMQJGq.js → linear-BCWZjcpP.js} +1 -1
- package/dist/web/assets/{liquid-HXqG_RIQ.js → liquid-DkFOeJ6J.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-s3xWnrXc.js → lspLanguageFeatures-Cbk7wEkj.js} +1 -1
- package/dist/web/assets/{mdx-k_7JTYp2.js → mdx-BOPNdexu.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-orMHhlAj.js → mermaid-NOHMQCX5-DWQaYVL0.js} +45 -45
- package/dist/web/assets/{message-square-CStQg7sr.js → message-square-DxbkpGqF.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-CKOIIjUJ.js → mindmap-definition-RKZ34NQL-LI7W1FIX.js} +1 -1
- package/dist/web/assets/{modal-ZYdX5Krr.js → modal-Cymk-6Df.js} +1 -1
- package/dist/web/assets/{monaco-DX9iObLO.js → monaco-Bc-Z2u8N.js} +3 -3
- package/dist/web/assets/{pencil-DoB4p30x.js → pencil-DOL2nlgg.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-BW18kL8l.js → pieDiagram-4H26LBE5-mgUzAFkk.js} +1 -1
- package/dist/web/assets/{python-abx8p9WS.js → python-D_wlYLCL.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-Df_F1INR.js → quadrantDiagram-W4KKPZXB-CaDF2kqA.js} +1 -1
- package/dist/web/assets/{razor-DGdDlX86.js → razor-DBFVg4JU.js} +1 -1
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-De6R8t8O.js → requirementDiagram-4Y6WPE33-DhmHdr_0.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-ChlLeN5m.js → sankeyDiagram-5OEKKPKP-B7qnGfue.js} +1 -1
- package/dist/web/assets/{select-B9kjO67b.js → select-BpKQyMvD.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-CPVnbcvz.js → sequenceDiagram-3UESZ5HK-D2LhPgpM.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-BFS1G-aJ.js → stateDiagram-AJRCARHV-ClkO4Gu5.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-YnSeSD_N.js +1 -0
- package/dist/web/assets/{switch-C2r5pofB.js → switch-BJ4Ar_OA.js} +1 -1
- package/dist/web/assets/{textarea-BB3UoYxg.js → textarea-DjwjAAG8.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-C1Rgs32y.js → timeline-definition-PNZ67QCA-DhGIG-GC.js} +1 -1
- package/dist/web/assets/{trash-2-BNiAEW-6.js → trash-2-R46i6Uus.js} +1 -1
- package/dist/web/assets/{tsMode-DHruHjGh.js → tsMode-CKaqpIrz.js} +1 -1
- package/dist/web/assets/{typescript-SLYiKRhJ.js → typescript-DsixnGVt.js} +1 -1
- package/dist/web/assets/{upload-BLLmywZY.js → upload-CgWqsmdI.js} +1 -1
- package/dist/web/assets/{use-profiles-OJaV4lOv.js → use-profiles-BlGgvdYm.js} +1 -1
- package/dist/web/assets/{use-projects-D_Sq7ahS.js → use-projects-Cuv0A0RC.js} +1 -1
- package/dist/web/assets/{use-providers-SSHcslI-.js → use-providers-DLcAY6E1.js} +1 -1
- package/dist/web/assets/{useNormalizedLogs-DeA-fso_.js → useNormalizedLogs-tfxFAJOF.js} +1 -1
- package/dist/web/assets/{vennDiagram-CIIHVFJN-DLGPZTKg.js → vennDiagram-CIIHVFJN-BngQhsYJ.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-BVMPWfq9.js → wardley-L42UT6IY-BEY6sftT.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-_KXuEg6G.js → wardleyDiagram-YWT4CUSO-IH_Yh-cw.js} +1 -1
- package/dist/web/assets/{xml-BmreQojr.js → xml-dEcQ1gzo.js} +1 -1
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-a-Do3v5G.js → xychartDiagram-2RQKCTM6-BdrGFDsr.js} +1 -1
- package/dist/web/assets/{yaml-CJoLHuqv.js → yaml-BfGVqGj4.js} +1 -1
- package/dist/web/index.html +1 -1
- package/node_modules/@agent-tower/shared/dist/agent-runtime-support.d.ts +2 -0
- package/node_modules/@agent-tower/shared/dist/agent-runtime-support.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/agent-runtime-support.js +5 -0
- package/node_modules/@agent-tower/shared/dist/agent-runtime-support.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/assets/ProviderSettingsPage-B-bBs2qN.js +0 -93
- package/dist/web/assets/channel-BsOpjSZw.js +0 -1
- package/dist/web/assets/check-BVOtZt28.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-KkLqUSdB.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-KkLqUSdB.js +0 -1
- package/dist/web/assets/javascript-DaUCpDvL.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-DSxC8AfE.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-
|
|
2
|
-
import{ah as Uc,ai as Qn,aj as qc,ak as Kc,al as Xc,k as He,r as S,am as ae,z as ps,m as Bt,an as _s,n as Ft,p as Ce,o as bt,q as de,u as ce,j as t,a9 as gt,V as ga,W as Yc,l as se,Z as Ds,B as Te,ao as va,ap as xa,aq as _a,af as vs,X as Yt,ar as ln,as as Vc,O as dr,at as Gc,D as Qc,au as Zc,av as Jc,aw as ed,T as ur,t as rt,P as Jt,Q as ct,U as Ns,a5 as Fr,a3 as Ke,ax as hr,ay as td,az as cn,ag as sd,ad as rd,ae as id,aA as ba,aB as dn,aC as ya,aD as Sa,aE as wa,aF as nd,aG as od,a0 as ad,aH as ld,aI as cd,aJ as dd,Y as Zn,a8 as Jn}from"./index-RYlllU6n.js";import{S as dt,u as un,A as hn,l as ud,F as Ca,m as hd,o as fd,Q as fn,p as md,q as At,W as _t,r as ka,C as ir,t as Ar,v as pd,w as gd,T as vd,h as Nt,b as zr,x as Ea,y as Ht}from"./mermaid-NOHMQCX5-orMHhlAj.js";import{C as mn}from"./confirm-dialog-BJwzwwOk.js";import{c as ja,a as Na,b as Ra,I as Aa,d as Ta,A as eo,G as Ma}from"./Icons-CyNNz4Z5.js";import{C as wt}from"./chevron-down-BXYCSpWd.js";import{C as Mt}from"./chevron-right-CkcSaX8x.js";import{d as pn,S as xd,u as gn,A as nr,c as vn,G as Da,Z as _d,e as xn,T as _n,f as bd,g as bn,h as to,i as yd,b as Pa,j as La,a as Ia,k as Oa,R as Ba,P as Fa,l as Wr,m as Sd,C as so,B as ro}from"./CreateTaskInput-ByeWDjc8.js";import{a as wd,F as Cd,b as kd}from"./folder-picker-CioQjSzV.js";import{M as ti}from"./message-square-CStQg7sr.js";import{L as Ps}from"./layers-BZMh9pqm.js";import{P as yn,u as za,a as Wa,T as Hr}from"./useNormalizedLogs-DeA-fso_.js";import{u as Bs}from"./use-providers-SSHcslI-.js";import{A as si}from"./AgentLogo-C190Z6bw.js";import{M as $t}from"./MemberAvatar-BPoYS6Il.js";import{C as Ha}from"./chevron-up-Y8L6pbzc.js";import{C as Vt}from"./check-BVOtZt28.js";import{M as ns}from"./modal-ZYdX5Krr.js";import{S as es}from"./select-B9kjO67b.js";import{P as ts,T as Sn}from"./trash-2-BNiAEW-6.js";import{T as Ed}from"./textarea-BB3UoYxg.js";import{F as $a,e as jd,d as Nd,f as Rd,u as Ad}from"./use-projects-D_Sq7ahS.js";import{U as $r}from"./upload-BLLmywZY.js";import{A as Ls}from"./arrow-left-CB4qTjQs.js";import{C as io}from"./copy-jQAntc98.js";var Td=class extends Uc{constructor(e,s){super(e,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Qn()})}getOptimisticResult(e){return e.behavior=Qn(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,s){const{state:r}=e,o=super.createResult(e,s),{isFetching:g,isRefetching:p,isError:v,isRefetchError:n}=o,i=r.fetchMeta?.fetchMore?.direction,l=v&&i==="forward",d=g&&i==="forward",c=v&&i==="backward",m=g&&i==="backward";return{...o,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Kc(s,r.data),hasPreviousPage:qc(s,r.data),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:c,isFetchingPreviousPage:m,isRefetchError:n&&!l&&!c,isRefetching:p&&!d&&!m}}};function wn(e,s){return Xc(e,Td)}const Md=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ua=He("arrow-right",Md);const Dd=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],qa=He("ban",Dd);const Pd=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ld=He("chevron-left",Pd);const Id=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],Od=He("clipboard-paste",Id);const Bd=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Rs=He("clock-3",Bd);const Fd=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ri=He("code-xml",Fd);const zd=[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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"}]],no=He("copy-plus",zd);const Wd=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Hd=He("earth",Wd);const $d=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Ka=He("ellipsis-vertical",$d);const Ud=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],qd=He("file-braces-corner",Ud);const Kd=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Ur=He("file-code-corner",Kd);const Xd=[["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 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Yd=He("file-exclamation-point",Xd);const Vd=[["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"}]],ii=He("folder-open",Vd);const Gd=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],Fs=He("git-graph",Gd);const Qd=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Is=He("history",Qd);const Zd=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Jd=He("maximize",Zd);const eu=[["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"}]],tu=He("panel-left-close",eu);const su=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],ru=He("panel-left-open",su);const iu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],nu=He("panel-right-close",iu);const ou=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],qi=He("panel-right-open",ou);const au=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],lu=He("pen-line",au);const cu=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Xt=He("play",cu);const du=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Xa=He("settings-2",du);const uu=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],oo=He("smartphone",uu);const hu=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Tr=He("user-plus",hu);const fu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],mu=He("zoom-in",fu);const pu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],gu=He("zoom-out",pu),ni=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function zs(e){const s=Object.prototype.toString.call(e);return s==="[object Window]"||s==="[object global]"}function Cn(e){return"nodeType"in e}function yt(e){var s,r;return e?zs(e)?e:Cn(e)&&(s=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?s:window:window}function kn(e){const{Document:s}=yt(e);return e instanceof s}function fr(e){return zs(e)?!1:e instanceof yt(e).HTMLElement}function Ya(e){return e instanceof yt(e).SVGElement}function Ws(e){return e?zs(e)?e.document:Cn(e)?kn(e)?e:fr(e)||Ya(e)?e.ownerDocument:document:document:document}const Gt=ni?S.useLayoutEffect:S.useEffect;function oi(e){const s=S.useRef(e);return Gt(()=>{s.current=e}),S.useCallback(function(){for(var r=arguments.length,o=new Array(r),g=0;g<r;g++)o[g]=arguments[g];return s.current==null?void 0:s.current(...o)},[])}function vu(){const e=S.useRef(null),s=S.useCallback((o,g)=>{e.current=setInterval(o,g)},[]),r=S.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[s,r]}function or(e,s){s===void 0&&(s=[e]);const r=S.useRef(e);return Gt(()=>{r.current!==e&&(r.current=e)},s),r}function mr(e,s){const r=S.useRef();return S.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...s])}function qr(e){const s=oi(e),r=S.useRef(null),o=S.useCallback(g=>{g!==r.current&&s?.(g,r.current),r.current=g},[]);return[r,o]}function Kr(e){const s=S.useRef();return S.useEffect(()=>{s.current=e},[e]),s.current}let Ci={};function ai(e,s){return S.useMemo(()=>{if(s)return s;const r=Ci[e]==null?0:Ci[e]+1;return Ci[e]=r,e+"-"+r},[e,s])}function Va(e){return function(s){for(var r=arguments.length,o=new Array(r>1?r-1:0),g=1;g<r;g++)o[g-1]=arguments[g];return o.reduce((p,v)=>{const n=Object.entries(v);for(const[i,l]of n){const d=p[i];d!=null&&(p[i]=d+e*l)}return p},{...s})}}const Ms=Va(1),Xr=Va(-1);function xu(e){return"clientX"in e&&"clientY"in e}function En(e){if(!e)return!1;const{KeyboardEvent:s}=yt(e.target);return s&&e instanceof s}function _u(e){if(!e)return!1;const{TouchEvent:s}=yt(e.target);return s&&e instanceof s}function Yr(e){if(_u(e)){if(e.touches&&e.touches.length){const{clientX:s,clientY:r}=e.touches[0];return{x:s,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:s,clientY:r}=e.changedTouches[0];return{x:s,y:r}}}return xu(e)?{x:e.clientX,y:e.clientY}:null}const ar=Object.freeze({Translate:{toString(e){if(!e)return;const{x:s,y:r}=e;return"translate3d("+(s?Math.round(s):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:s,scaleY:r}=e;return"scaleX("+s+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[ar.Translate.toString(e),ar.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:s,duration:r,easing:o}=e;return s+" "+r+"ms "+o}}}),ao="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bu(e){return e.matches(ao)?e:e.querySelector(ao)}const yu={display:"none"};function Su(e){let{id:s,value:r}=e;return ae.createElement("div",{id:s,style:yu},r)}function wu(e){let{id:s,announcement:r,ariaLiveType:o="assertive"}=e;const g={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ae.createElement("div",{id:s,style:g,role:"status","aria-live":o,"aria-atomic":!0},r)}function Cu(){const[e,s]=S.useState("");return{announce:S.useCallback(o=>{o!=null&&s(o)},[]),announcement:e}}const Ga=S.createContext(null);function ku(e){const s=S.useContext(Ga);S.useEffect(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(e)},[e,s])}function Eu(){const[e]=S.useState(()=>new Set),s=S.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[S.useCallback(o=>{let{type:g,event:p}=o;e.forEach(v=>{var n;return(n=v[g])==null?void 0:n.call(v,p)})},[e]),s]}const ju={draggable:`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-Bc-Z2u8N.js","assets/index-D9kBRMR0.js","assets/index-CjAJoGg5.css","assets/monaco-Dvl_Svmm.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{ah as Uc,ai as Qn,aj as qc,ak as Kc,al as Xc,k as He,r as S,am as ae,z as ps,m as Bt,an as _s,n as Ft,p as Ce,o as bt,q as de,u as ce,j as t,a9 as gt,V as ga,W as Yc,l as se,Z as Ds,B as Te,ao as va,ap as xa,aq as _a,af as vs,X as Yt,ar as ln,as as Vc,O as dr,at as Gc,D as Qc,au as Zc,av as Jc,aw as ed,T as ur,t as rt,P as Jt,Q as ct,U as Ns,a5 as Fr,a3 as Ke,ax as hr,ay as td,az as cn,ag as sd,ad as rd,ae as id,aA as ba,aB as dn,aC as ya,aD as Sa,aE as wa,aF as nd,aG as od,a0 as ad,aH as ld,aI as cd,aJ as dd,Y as Zn,a8 as Jn}from"./index-D9kBRMR0.js";import{S as dt,u as un,A as hn,l as ud,F as Ca,m as hd,o as fd,Q as fn,p as md,q as At,W as _t,r as ka,C as ir,t as Ar,v as pd,w as gd,T as vd,h as Nt,b as zr,x as Ea,y as Ht}from"./mermaid-NOHMQCX5-DWQaYVL0.js";import{C as mn}from"./confirm-dialog-CRiC3xBd.js";import{c as ja,a as Na,b as Ra,I as Aa,d as Ta,A as eo,G as Ma}from"./Icons-DADUmnB1.js";import{C as wt}from"./chevron-down-BQcW9sFf.js";import{C as Mt}from"./chevron-right-pH923eYp.js";import{d as pn,S as xd,u as gn,A as nr,c as vn,G as Da,Z as _d,e as xn,T as _n,f as bd,g as bn,h as to,i as yd,b as Pa,j as La,a as Ia,k as Oa,R as Ba,P as Fa,l as Wr,m as Sd,C as so,B as ro}from"./CreateTaskInput-B67vzMJD.js";import{a as wd,F as Cd,b as kd}from"./folder-picker-WUhXxIM5.js";import{M as ti}from"./message-square-DxbkpGqF.js";import{L as Ps}from"./layers-Bo4aml98.js";import{P as yn,u as za,a as Wa,T as Hr}from"./useNormalizedLogs-tfxFAJOF.js";import{u as Bs}from"./use-providers-DLcAY6E1.js";import{A as si}from"./AgentLogo-BCwbooTN.js";import{M as $t}from"./MemberAvatar-l-WCdlLA.js";import{C as Ha}from"./chevron-up-DyQW115F.js";import{C as Vt}from"./check-BN_PVKzE.js";import{M as ns}from"./modal-Cymk-6Df.js";import{S as es}from"./select-BpKQyMvD.js";import{P as ts,T as Sn}from"./trash-2-R46i6Uus.js";import{T as Ed}from"./textarea-DjwjAAG8.js";import{F as $a,e as jd,d as Nd,f as Rd,u as Ad}from"./use-projects-Cuv0A0RC.js";import{U as $r}from"./upload-CgWqsmdI.js";import{A as Ls}from"./arrow-left-CCWDjOmp.js";import{C as io}from"./copy-DaoAUKTO.js";var Td=class extends Uc{constructor(e,s){super(e,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Qn()})}getOptimisticResult(e){return e.behavior=Qn(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,s){const{state:r}=e,o=super.createResult(e,s),{isFetching:g,isRefetching:p,isError:v,isRefetchError:n}=o,i=r.fetchMeta?.fetchMore?.direction,l=v&&i==="forward",d=g&&i==="forward",c=v&&i==="backward",m=g&&i==="backward";return{...o,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Kc(s,r.data),hasPreviousPage:qc(s,r.data),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:c,isFetchingPreviousPage:m,isRefetchError:n&&!l&&!c,isRefetching:p&&!d&&!m}}};function wn(e,s){return Xc(e,Td)}const Md=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ua=He("arrow-right",Md);const Dd=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],qa=He("ban",Dd);const Pd=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ld=He("chevron-left",Pd);const Id=[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]],Od=He("clipboard-paste",Id);const Bd=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Rs=He("clock-3",Bd);const Fd=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],ri=He("code-xml",Fd);const zd=[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["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"}]],no=He("copy-plus",zd);const Wd=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Hd=He("earth",Wd);const $d=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],Ka=He("ellipsis-vertical",$d);const Ud=[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],qd=He("file-braces-corner",Ud);const Kd=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Ur=He("file-code-corner",Kd);const Xd=[["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 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Yd=He("file-exclamation-point",Xd);const Vd=[["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"}]],ii=He("folder-open",Vd);const Gd=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]],Fs=He("git-graph",Gd);const Qd=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Is=He("history",Qd);const Zd=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Jd=He("maximize",Zd);const eu=[["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"}]],tu=He("panel-left-close",eu);const su=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],ru=He("panel-left-open",su);const iu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],nu=He("panel-right-close",iu);const ou=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],qi=He("panel-right-open",ou);const au=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],lu=He("pen-line",au);const cu=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Xt=He("play",cu);const du=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Xa=He("settings-2",du);const uu=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],oo=He("smartphone",uu);const hu=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Tr=He("user-plus",hu);const fu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],mu=He("zoom-in",fu);const pu=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],gu=He("zoom-out",pu),ni=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function zs(e){const s=Object.prototype.toString.call(e);return s==="[object Window]"||s==="[object global]"}function Cn(e){return"nodeType"in e}function yt(e){var s,r;return e?zs(e)?e:Cn(e)&&(s=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?s:window:window}function kn(e){const{Document:s}=yt(e);return e instanceof s}function fr(e){return zs(e)?!1:e instanceof yt(e).HTMLElement}function Ya(e){return e instanceof yt(e).SVGElement}function Ws(e){return e?zs(e)?e.document:Cn(e)?kn(e)?e:fr(e)||Ya(e)?e.ownerDocument:document:document:document}const Gt=ni?S.useLayoutEffect:S.useEffect;function oi(e){const s=S.useRef(e);return Gt(()=>{s.current=e}),S.useCallback(function(){for(var r=arguments.length,o=new Array(r),g=0;g<r;g++)o[g]=arguments[g];return s.current==null?void 0:s.current(...o)},[])}function vu(){const e=S.useRef(null),s=S.useCallback((o,g)=>{e.current=setInterval(o,g)},[]),r=S.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[s,r]}function or(e,s){s===void 0&&(s=[e]);const r=S.useRef(e);return Gt(()=>{r.current!==e&&(r.current=e)},s),r}function mr(e,s){const r=S.useRef();return S.useMemo(()=>{const o=e(r.current);return r.current=o,o},[...s])}function qr(e){const s=oi(e),r=S.useRef(null),o=S.useCallback(g=>{g!==r.current&&s?.(g,r.current),r.current=g},[]);return[r,o]}function Kr(e){const s=S.useRef();return S.useEffect(()=>{s.current=e},[e]),s.current}let Ci={};function ai(e,s){return S.useMemo(()=>{if(s)return s;const r=Ci[e]==null?0:Ci[e]+1;return Ci[e]=r,e+"-"+r},[e,s])}function Va(e){return function(s){for(var r=arguments.length,o=new Array(r>1?r-1:0),g=1;g<r;g++)o[g-1]=arguments[g];return o.reduce((p,v)=>{const n=Object.entries(v);for(const[i,l]of n){const d=p[i];d!=null&&(p[i]=d+e*l)}return p},{...s})}}const Ms=Va(1),Xr=Va(-1);function xu(e){return"clientX"in e&&"clientY"in e}function En(e){if(!e)return!1;const{KeyboardEvent:s}=yt(e.target);return s&&e instanceof s}function _u(e){if(!e)return!1;const{TouchEvent:s}=yt(e.target);return s&&e instanceof s}function Yr(e){if(_u(e)){if(e.touches&&e.touches.length){const{clientX:s,clientY:r}=e.touches[0];return{x:s,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:s,clientY:r}=e.changedTouches[0];return{x:s,y:r}}}return xu(e)?{x:e.clientX,y:e.clientY}:null}const ar=Object.freeze({Translate:{toString(e){if(!e)return;const{x:s,y:r}=e;return"translate3d("+(s?Math.round(s):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:s,scaleY:r}=e;return"scaleX("+s+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[ar.Translate.toString(e),ar.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:s,duration:r,easing:o}=e;return s+" "+r+"ms "+o}}}),ao="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function bu(e){return e.matches(ao)?e:e.querySelector(ao)}const yu={display:"none"};function Su(e){let{id:s,value:r}=e;return ae.createElement("div",{id:s,style:yu},r)}function wu(e){let{id:s,announcement:r,ariaLiveType:o="assertive"}=e;const g={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ae.createElement("div",{id:s,style:g,role:"status","aria-live":o,"aria-atomic":!0},r)}function Cu(){const[e,s]=S.useState("");return{announce:S.useCallback(o=>{o!=null&&s(o)},[]),announcement:e}}const Ga=S.createContext(null);function ku(e){const s=S.useContext(Ga);S.useEffect(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(e)},[e,s])}function Eu(){const[e]=S.useState(()=>new Set),s=S.useCallback(o=>(e.add(o),()=>e.delete(o)),[e]);return[S.useCallback(o=>{let{type:g,event:p}=o;e.forEach(v=>{var n;return(n=v[g])==null?void 0:n.call(v,p)})},[e]),s]}const ju={draggable:`
|
|
3
3
|
To pick up a draggable item, press the space bar.
|
|
4
4
|
While dragging, use the arrow keys to move the item.
|
|
5
5
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -68,7 +68,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
68
68
|
.transform-component-module_content__FBWxo img {
|
|
69
69
|
pointer-events: none;
|
|
70
70
|
}
|
|
71
|
-
`,Xo={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};Zg(Jg);var ev=function(e){var s=e.children,r=e.wrapperClass,o=r===void 0?"":r,g=e.contentClass,p=g===void 0?"":g,v=e.wrapperStyle,n=e.contentStyle,i=e.wrapperProps,l=i===void 0?{}:i,d=e.contentProps,c=d===void 0?{}:d,m=S.useContext(mi),x=m.init,w=m.cleanupWindowEvents,y=S.useRef(null),a=S.useRef(null);return S.useEffect(function(){var h=y.current,u=a.current;return h!==null&&u!==null&&x&&x?.(h,u),function(){w?.()}},[]),ae.createElement("div",is({},l,{ref:y,className:"".concat(tn.wrapperClass," ").concat(Xo.wrapper," ").concat(o),style:v}),ae.createElement("div",is({},c,{ref:a,className:"".concat(tn.contentClass," ").concat(Xo.content," ").concat(p),style:n}),s))},Jl=function(){var e=S.useContext(mi);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},tv=function(){var e=Jl();return Zr(e)};function sv(e){var s=Jl(),r=S.useState(e(sn(s))),o=r[0],g=r[1];return S.useEffect(function(){var p=!0,v=s.onChange(function(n){p&&g(e(sn(n.instance)))});return function(){v(),p=!1}},[e,s]),o}function rv(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}function iv(e,s){return Bt({queryKey:de.files.tree(e||"",s),queryFn:()=>Ce.get("/files/tree",{params:{workingDir:e||"",path:s}}),enabled:!!e})}function nv(e,s){return Bt({queryKey:de.files.content(e||"",s||""),queryFn:()=>Ce.get("/files/read",{params:{workingDir:e||"",path:s||""}}),enabled:!!e&&!!s})}function ov(e){const s=bt();return S.useCallback(()=>{e&&s.invalidateQueries({queryKey:["files","tree",e]})},[s,e])}function av(){const e=bt();return Ft({mutationFn:s=>Ce.post("/files/write",s),onSuccess:(s,r)=>{const o=de.files.content(r.workingDir,r.path),g=e.getQueryData(o);e.setQueryData(o,{content:r.content,language:g?.language||rv(r.path)})}})}function lv(e,s){return e==="/"?`/${s}`:`${e}/${s}`}function cv(e,s){return e==="/"?s:`${e.slice(1)}/${s}`}const dv=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function uv(e){if(e.type==="directory")return null;const s=e.name.split(".").pop()?.toLowerCase();return s&&dv.has(s)?ka:s==="ts"||s==="tsx"||s==="js"||s==="jsx"?Ur:s==="json"?qd:s==="md"||s==="mdx"||s==="txt"?Ca:Cd}const Yo=({depth:e,active:s,onClick:r,leftIcon:o,rightIcon:g,label:p})=>t.jsxs("button",{type:"button",onClick:r,className:se("w-full flex items-center gap-2 rounded px-2 py-1 text-left text-xs hover:bg-neutral-100",s&&"bg-neutral-100 text-neutral-900"),style:{paddingLeft:8+e*14},children:[t.jsx("span",{className:"shrink-0",children:g}),t.jsx("span",{className:"shrink-0 text-neutral-500",children:o}),t.jsx("span",{className:"truncate text-neutral-700",children:p})]}),ec=({workingDir:e,path:s,depth:r,expanded:o,toggleDir:g,onFileSelect:p,selectedFilePath:v})=>{const{t:n}=ce(),{data:i,isLoading:l,isError:d}=iv(e,s),c=S.useMemo(()=>i?.items??[],[i?.items]);return l?t.jsx("div",{className:"text-xs text-neutral-400 px-2 py-1",style:{paddingLeft:8+r*14},children:n("Loading...")}):d?t.jsx("div",{className:"text-xs text-red-600 px-2 py-1",style:{paddingLeft:8+r*14},children:n("Failed to load")}):t.jsx("div",{className:"space-y-0.5",children:c.map(m=>{if(m.type==="directory"){const h=lv(s,m.name),u=o.has(h);return t.jsxs("div",{children:[t.jsx(Yo,{depth:r,onClick:()=>g(h),rightIcon:u?t.jsx(wt,{size:14,className:"text-neutral-400"}):t.jsx(Mt,{size:14,className:"text-neutral-400"}),leftIcon:u?t.jsx(ii,{size:14,className:"text-amber-500"}):t.jsx($a,{size:14,className:"text-amber-500"}),label:m.name}),u&&t.jsx(ec,{workingDir:e,path:h,depth:r+1,expanded:o,toggleDir:g,onFileSelect:p,selectedFilePath:v})]},h)}const x=cv(s,m.name),w=uv(m),y=v===x,a=w===ka;return t.jsx(Yo,{depth:r,active:y,onClick:()=>p(x),rightIcon:t.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:w?t.jsx(w,{size:14,className:a?"text-emerald-600":"text-sky-600"}):null,label:m.name},x)})})},hv=({workingDir:e,className:s,onFileSelect:r,selectedFilePath:o,onCollapse:g})=>{const{t:p}=ce(),[v,n]=S.useState(()=>new Set),i=ov(e),l=S.useCallback(d=>{n(c=>{const m=new Set(c);return m.has(d)?m.delete(d):m.add(d),m})},[]);return t.jsxs("div",{className:se("h-full flex flex-col",s),children:[t.jsxs("div",{className:"px-3 py-2 border-b border-neutral-200 bg-neutral-50/80 flex items-center justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[11px] font-semibold text-neutral-600 uppercase tracking-wider",children:p("Files")}),t.jsx("div",{className:"text-[11px] text-neutral-400 truncate",children:e||p("No working directory")})]}),t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&t.jsx("button",{type:"button",onClick:i,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:p("Refresh file tree"),children:t.jsx(hr,{size:13})}),g&&t.jsx("button",{type:"button",onClick:g,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:p("Collapse file tree"),children:t.jsx(tu,{size:13})})]})]}),t.jsx("div",{className:"flex-1 overflow-auto scrollbar-app-thin p-2",children:e?t.jsx(ec,{workingDir:e,path:"/",depth:0,expanded:v,toggleDir:l,onFileSelect:r,selectedFilePath:o}):t.jsx("div",{className:"text-xs text-neutral-500 px-2 py-2",children:p("No workspace selected.")})})]})},fv=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function mv(e){const s=e.split(".").pop()?.toLowerCase();return s?fv.has(s):!1}function pv(e,s){const r=dr(),o=new URLSearchParams({workingDir:e,path:s});return`${r}/files/image?${o.toString()}`}const gv=({filePath:e})=>{const{t:s}=ce(),{zoomIn:r,zoomOut:o,centerView:g}=tv(),p=sv(n=>n.state.scale),v=Math.round(p*100);return t.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-neutral-200 bg-neutral-50/80 shrink-0",children:[t.jsx("button",{type:"button",onClick:()=>o(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:s("Zoom out"),children:t.jsx(gu,{size:14})}),t.jsxs("button",{type:"button",onClick:()=>g(1),className:"px-1.5 py-0.5 rounded hover:bg-neutral-200 text-[11px] text-neutral-600 tabular-nums min-w-[40px] text-center transition-colors",title:s("Reset zoom"),children:[v,"%"]}),t.jsx("button",{type:"button",onClick:()=>r(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:s("Zoom in"),children:t.jsx(mu,{size:14})}),t.jsx("button",{type:"button",onClick:()=>g(1),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors ml-1",title:s("Fit to view"),children:t.jsx(Jd,{size:13})}),t.jsx("span",{className:"ml-2 text-[11px] text-neutral-400 truncate",children:e})]})},vv=({workingDir:e,filePath:s})=>{const{t:r}=ce(),[o,g]=S.useState(!1),p=pv(e,s);return o?t.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:r("Failed to load image.")}):t.jsx(Qg,{initialScale:1,minScale:.1,maxScale:10,centerOnInit:!0,doubleClick:{mode:"toggle"},children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx(gv,{filePath:s}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-[repeating-conic-gradient(#f3f3f3_0%_25%,#fff_0%_50%)] bg-[length:16px_16px]",children:t.jsx(ev,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx("img",{src:p,alt:s,className:"max-w-full max-h-full object-contain rounded shadow-sm",draggable:!1,onError:()=>g(!0)})})})]})})};function xv(e){const s=e.split("/");return s[s.length-1]||e}function _v(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}const bv=({active:e,name:s,isDirty:r,onClick:o,onClose:g})=>{const{t:p}=ce();return t.jsxs("button",{type:"button",onClick:o,className:se("group flex items-center gap-2 px-3 py-2 rounded-t-md border-t border-x -mb-px min-w-[120px] max-w-[240px]",e?"bg-white border-neutral-200 text-neutral-900":"bg-neutral-100/60 border-transparent text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100"),children:[t.jsx("span",{className:se("w-2 h-2 rounded-full",r?"bg-amber-500":"bg-transparent")}),t.jsx("span",{className:"truncate flex-1 text-left text-xs",children:s}),t.jsx("span",{onClick:g,className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-neutral-200 rounded transition-all shrink-0","aria-label":p("Close tab"),title:p("Close"),children:t.jsx(Yt,{size:12})})]})},yv=ae.forwardRef(function({workingDir:s,className:r,readOnly:o=!1},g){const{t:p}=ce(),[v,n]=S.useState([]),[i,l]=S.useState(null),[d,c]=S.useState(!1),[m,x]=S.useState(!1),[w,y]=S.useState(0),[a,h]=S.useState(null),u=S.useRef(null),f=av();S.useEffect(()=>{let z=!1;return td(async()=>{const{preloadMonaco:$}=await import("./monaco-DX9iObLO.js").then(q=>q.m);return{preloadMonaco:$}},__vite__mapDeps([0,1,2,3])).then(({preloadMonaco:$})=>$()).then(()=>{z||c(!0)}).catch(()=>{z||x(!0)}),()=>{z=!0}},[]);const[b,C]=S.useState(280),[k,E]=S.useState(!1),[_,j]=S.useState(!1),A=S.useRef(280),P=S.useCallback(()=>{E(z=>(z?C(A.current):A.current=b,!z))},[b]),T=S.useCallback(z=>{z.preventDefault(),j(!0);const $=z.clientX,q=b,N=X=>{const K=X.clientX-$,ne=Math.min(480,Math.max(160,q+K));C(ne)},H=()=>{j(!1),document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",H)};document.addEventListener("mousemove",N),document.addEventListener("mouseup",H)},[b]);S.useEffect(()=>{n([]),l(null),h(null)},[s]);const D=S.useMemo(()=>v.find(z=>z.path===i)||null,[v,i]),{data:W,isFetching:I,isError:B,error:F}=nv(s,D?.isImage?null:i);S.useEffect(()=>{!i||!W||n(z=>z.map($=>$.path!==i||$.isDirty||$.loaded?$:{...$,language:W.language||$.language,content:W.content,savedContent:W.content,isDirty:!1,loaded:!0}))},[i,W]);const R=S.useCallback((z,$,q)=>{n(N=>{if(N.find(K=>K.path===z))return N;const X=mv(z);return[...N,{path:z,name:xv(z),language:_v(z),content:"",savedContent:"",isDirty:!1,loaded:X,isImage:X}]}),l(z),h($?{path:z,line:$,column:q}:null)},[]);ae.useImperativeHandle(g,()=>({openFile:R}),[R]);const M=S.useCallback(z=>{n($=>{const q=$.filter(N=>N.path!==z);return l(N=>N!==z?N:q.length?q[q.length-1].path:null),q})},[]),L=S.useCallback(z=>{n($=>$.map(q=>{if(q.path!==i)return q;const N=z!==q.savedContent;return{...q,content:z,isDirty:N}}))},[i]),O=S.useCallback(async()=>{o||!s||!D||(await f.mutateAsync({workingDir:s,path:D.path,content:D.content}),n(z=>z.map($=>$.path===D.path?{...$,savedContent:$.content,isDirty:!1,loaded:!0}:$)))},[D,o,f,s]),U=S.useRef(()=>{});S.useEffect(()=>{U.current=()=>{O().catch(()=>{})}},[O]),S.useEffect(()=>{const z=$=>{o||($.metaKey||$.ctrlKey)&&$.key.toLowerCase()==="s"&&($.preventDefault(),U.current())};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[o]);const Y=S.useCallback((z,$)=>{u.current=z,y(q=>q+1),z.addCommand($.KeyMod.CtrlCmd|$.KeyCode.KeyS,()=>{U.current()})},[]);return S.useEffect(()=>{if(!a||a.path!==i||!D?.loaded)return;const z=u.current,$=z?.getModel();if(!z||!$)return;const q=Math.min(a.line,$.getLineCount()),N=Math.min(a.column??1,$.getLineMaxColumn(q)),H={lineNumber:q,column:N};z.setPosition(H),z.revealPositionInCenter(H),z.focus(),h(null)},[i,D?.loaded,w,a]),t.jsxs("div",{className:se("flex h-full overflow-hidden bg-white",r),style:_?{userSelect:"none",cursor:"col-resize"}:void 0,children:[t.jsx("div",{className:"border-r border-neutral-200 bg-white shrink-0 overflow-hidden relative",style:{width:k?36:b,transition:_?"none":"width 0.15s ease"},children:k?t.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:t.jsx("button",{type:"button",onClick:P,className:"p-1.5 rounded hover:bg-neutral-100 text-neutral-500 hover:text-neutral-700 transition-colors",title:p("Expand file tree"),children:t.jsx(ru,{size:16})})}):t.jsx(t.Fragment,{children:t.jsx(hv,{workingDir:s,onFileSelect:R,selectedFilePath:D?.path||null,onCollapse:P},s||"no-working-dir")})}),!k&&t.jsx("div",{onMouseDown:T,className:se("w-1 shrink-0 cursor-col-resize transition-colors",_?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 overflow-x-auto shrink-0",children:[v.length===0?t.jsx("div",{className:"px-2 pb-2 text-xs text-neutral-500",children:p("No open files")}):v.map(z=>t.jsx(bv,{active:z.path===i,name:z.name,isDirty:z.isDirty,onClick:()=>l(z.path),onClose:$=>{$.stopPropagation(),M(z.path)}},z.path)),t.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[o&&t.jsx("span",{className:"text-[11px] text-neutral-400",children:p("Read-only")}),f.isPending&&t.jsxs("span",{className:"flex items-center gap-2 text-xs text-neutral-500",children:[t.jsx(Ke,{size:14,className:"animate-spin"}),p("Saving")]}),D?.isDirty&&!f.isPending&&t.jsx("span",{className:"text-[11px] text-amber-600",children:p("Unsaved")})]})]}),t.jsx("div",{className:"flex-1 min-h-0 relative",children:s?D?D.isImage?t.jsx(vv,{workingDir:s,filePath:D.path}):m?t.jsx("div",{className:"h-full flex items-center justify-center text-red-600 text-sm",children:p("Failed to load editor.")}):d?t.jsxs(t.Fragment,{children:[t.jsx(Hp,{path:D.path,value:D.content,language:D.language,theme:"vs-light",height:"100%",onChange:o?void 0:z=>L(z??""),onMount:Y,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0,readOnly:o}}),I&&!D.loaded&&t.jsx("div",{className:"absolute inset-0 bg-white/60 flex items-center justify-center",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-600",children:[t.jsx(Ke,{size:14,className:"animate-spin"}),p("Loading file...")]})}),B&&t.jsxs("div",{className:"absolute bottom-2 left-2 right-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1",children:[p("Failed to load file"),F instanceof Error?`: ${F.message}`:""]})]}):t.jsxs("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:[t.jsx(Ke,{size:14,className:"animate-spin mr-2"}),p("Loading editor...")]}):t.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:p("Select a file from the tree to open.")}):t.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:p("No workspace selected.")})})]})]})});function pi(e,s={}){const r=_s(g=>g.visibleContext),o=pl(e,r);return Bt({queryKey:de.git.changes(e||""),queryFn:()=>Ce.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e&&(s.enabled??!0),refetchInterval:o,refetchIntervalInBackground:!1,refetchOnWindowFocus:o?"always":!1,refetchOnReconnect:o?"always":!1})}function tc(e,s,r){const o=_s(p=>p.visibleContext),g=pl(e,o);return Bt({queryKey:de.git.diff(e||"",s||"",r),queryFn:()=>Ce.get("/git/diff",{params:{workingDir:e||"",path:s||"",type:r}}),enabled:!!e&&!!s,refetchInterval:g,refetchIntervalInBackground:!1,refetchOnWindowFocus:g?"always":!1,refetchOnReconnect:g?"always":!1})}function $n(e,s){return Bt({queryKey:de.git.commitFiles(e||"",s||""),queryFn:()=>Ce.get("/git/commit-files",{params:{workingDir:e||"",hash:s||""}}),enabled:!!e&&!!s})}function Un(e,s,r){return Bt({queryKey:de.git.commitDiff(e||"",s||"",r||""),queryFn:()=>Ce.get("/git/commit-diff",{params:{workingDir:e||"",hash:s||"",path:r||""}}),enabled:!!e&&!!s&&!!r})}function sc({isOpen:e,onClose:s,branchName:r,targetBranch:o,commitMessage:g,isPending:p,error:v,onConfirm:n}){const{t:i}=ce(),[l,d]=S.useState(""),[c,m]=S.useState(!1);S.useEffect(()=>{e&&(m(!1),d(g??""))},[e]),S.useEffect(()=>{c||!e||d(g??"")},[g,c,e]);const x=()=>{p||s()};return t.jsx(ns,{isOpen:e,onClose:x,title:i("提交变更"),className:"max-w-md",action:t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:x,disabled:p,className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:i("取消")}),t.jsx("button",{onClick:()=>n(l.trim()||void 0),disabled:p,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-primary-foreground bg-primary hover:bg-primary/90 rounded-md transition-colors disabled:opacity-50",children:p?t.jsxs(t.Fragment,{children:[t.jsx(Ke,{size:14,className:"animate-spin"}),i("正在提交...")]}):t.jsxs(t.Fragment,{children:[t.jsx($r,{size:14}),i("确认提交")]})})]}),children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-muted font-mono text-xs text-muted-foreground",children:r}),t.jsx(Ua,{size:14,className:"text-muted-foreground/70 shrink-0"}),t.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-muted font-mono text-xs text-muted-foreground",children:o})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-foreground mb-1.5",children:i("提交消息")}),t.jsx("textarea",{value:l,onChange:w=>{m(!0),d(w.target.value)},placeholder:i("请描述本次修改的内容"),rows:4,className:"w-full px-3 py-2 rounded-md border border-input text-sm font-mono text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:ring-2 focus:ring-ring/30 focus:border-ring resize-none"}),t.jsx("p",{className:"mt-1.5 text-[11px] text-muted-foreground/70 leading-relaxed",children:i("建议以 feat、fix、docs、refactor、chore 开头,保持提交记录清晰。feat 新增功能,fix 修复问题,docs 文档更新,refactor 代码重构,chore 日常维护。")}),!l.trim()&&t.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground/70",children:i("留空将使用默认消息")})]}),v&&t.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:v})]})})}function Es(e,s){const r=e[s];return typeof r=="string"&&r.length>0?r:void 0}function rc(e){if(!(e instanceof cn)||e.status!==409)return;const s=e.details;if(s.code!=="MERGE_CONFLICT"||s.conflictOp!==ir.REBASE&&s.conflictOp!==ir.MERGE||!Array.isArray(s.conflictedFiles)||!s.conflictedFiles.every(o=>typeof o=="string"))return;const r=s.mergeStrategy==="squash"||s.mergeStrategy==="no_ff"?s.mergeStrategy:void 0;return{conflictOp:s.conflictOp,conflictedFiles:s.conflictedFiles,mergeAborted:typeof s.mergeAborted=="boolean"?s.mergeAborted:void 0,mergeStrategy:r,sourceBranch:Es(s,"sourceBranch"),targetBranch:Es(s,"targetBranch"),sourceWorktreePath:Es(s,"sourceWorktreePath"),targetWorktreePath:Es(s,"targetWorktreePath"),sourceWorkspaceId:Es(s,"sourceWorkspaceId"),targetWorkspaceId:Es(s,"targetWorkspaceId")}}function Vo(e,s,r,o){const g=rc(e);if(g){r(g);return}o(e instanceof Error?e.message:s)}function ic({workspaceId:e,branchName:s,targetBranch:r,commitMessage:o,committedFileCount:g,onRefreshCommitMessage:p,onConflict:v,onResolveConflicts:n}){const{t:i}=ce(),{data:l,isLoading:d}=Pn(e),c=xl(),m=vl(),x=Ln(),[w,y]=S.useState(!1),[a,h]=S.useState(null);if(S.useEffect(()=>{w&&p?.()},[w,p]),d||!l)return t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-muted-foreground/70 border-b border-border/60",children:[t.jsx(Ke,{size:14,className:"animate-spin"}),t.jsx("span",{className:"text-xs",children:i("正在检查工作区状态...")})]});const u=l.conflictedFiles.length>0,f=l.operation!=="idle",b=l.hasUncommittedChanges||l.untrackedCount>0,C=l.uncommittedCount+l.untrackedCount,k=!u&&!f&&!b,E=l.operation==="idle"&&l.ahead===0&&l.behind===0&&!b&&!u,_=()=>{h(null),c.mutate(e,{onError:T=>{Vo(T,i("更新失败,请稍后重试"),D=>v(D),h)}})},j=()=>{h(null),y(!0)},A=T=>{h(null),m.mutate({id:e,commitMessage:T},{onSuccess:()=>y(!1),onError:D=>{Vo(D,i("提交失败,请稍后重试"),W=>{y(!1),v(W)},h)}})},P=()=>{m.isPending||(y(!1),h(null))};return E?t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-muted-foreground/70 border-b border-border/60",children:[t.jsx(sd,{size:13}),t.jsx("span",{className:"text-xs",children:i("当前分支还没有任何变更")})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-b border-border bg-background",children:t.jsxs("div",{className:"px-3 py-2",children:[a&&t.jsx("div",{className:"mb-2 px-2.5 py-1.5 rounded-md bg-red-50 border border-red-200 text-[11px] text-red-700",children:a}),b&&t.jsxs("div",{className:"flex items-center gap-2 mb-2 px-2.5 py-1.5 rounded-md bg-amber-50 border border-amber-200 text-[11px] text-amber-800",children:[t.jsx(Yd,{size:12,className:"shrink-0"}),t.jsx("span",{children:i("{count} 个本地改动未处理,需要先整理后再继续",{count:C})})]}),u&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-amber-700",children:[t.jsx(ur,{size:13,className:"shrink-0"}),t.jsx("span",{children:i("{count} 个文件存在冲突,需要处理后继续",{count:l.conflictedFiles.length})})]}),t.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[t.jsx("button",{onClick:n,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium text-amber-800 bg-amber-100 hover:bg-amber-200 border border-amber-200 transition-colors",children:i("处理冲突")}),t.jsx("button",{onClick:()=>x.mutate(e),disabled:x.isPending,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs text-muted-foreground hover:bg-muted border border-border transition-colors disabled:opacity-50",children:x.isPending?i("正在撤销..."):i("撤销操作")})]})]}),f&&!u&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-info",children:[t.jsx(Ke,{size:13,className:"animate-spin shrink-0"}),t.jsx("span",{children:l.operation==="rebase"?i("正在同步源分支更新..."):i("正在提交变更...")})]}),t.jsxs("button",{onClick:()=>x.mutate(e),disabled:x.isPending,className:"flex items-center gap-1.5 ml-auto px-2.5 py-1 rounded-md text-xs text-muted-foreground hover:bg-muted border border-border transition-colors disabled:opacity-50",children:[t.jsx(rd,{size:12}),x.isPending?i("正在撤销..."):i("撤销操作")]})]}),!u&&!f&&(l.behind>0||l.ahead>0)&&t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[l.behind>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:i("源分支 {branch} 有 {count} 个更新",{branch:r,count:l.behind})}),t.jsxs("button",{onClick:_,disabled:!k||c.isPending,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium text-primary-foreground bg-primary hover:bg-primary/90 transition-colors disabled:opacity-50",children:[t.jsx(hr,{size:12}),c.isPending?i("正在同步..."):i("同步更新")]})]}),l.ahead>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:i("{count} 个文件变更,可以安全提交",{count:g??l.ahead})}),l.behind===0&&!b?t.jsxs("button",{onClick:j,disabled:m.isPending,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium text-primary-foreground bg-primary hover:bg-primary/90 transition-colors disabled:opacity-50",children:[t.jsx($r,{size:12}),i("提交变更")]}):t.jsxs("button",{disabled:!0,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs text-muted-foreground/60 bg-muted/60 border border-border cursor-not-allowed",title:i(b?"需要先处理本地改动":"需要先同步源分支更新"),children:[t.jsx($r,{size:12}),i("提交变更")]})]})]})]})}),t.jsx(sc,{isOpen:w,onClose:P,branchName:s,targetBranch:r,commitMessage:o,isPending:m.isPending,error:a,onConfirm:A})]})}const Oi=50,Bi=400,Go={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"},Qo={M:"bg-amber-500",A:"bg-emerald-500",D:"bg-red-500",R:"bg-blue-500"};function nc(e){const s=e.split("/");return s[s.length-1]||e}function Sv(e){const s=e.lastIndexOf("/");return s>0?e.slice(0,s):""}function wv(e){const r=Math.floor(Date.now()/1e3)-e;return r<60?gt("{count}s ago",{count:r}):r<3600?gt("{count}m ago",{count:Math.floor(r/60)}):r<86400?gt("{count}h ago",{count:Math.floor(r/3600)}):r<604800?gt("{count}d ago",{count:Math.floor(r/86400)}):new Date(e*1e3).toLocaleDateString()}function Br(e,s){return e.kind==="working"?`${e.diffType}:${s}`:`${e.hash}:${s}`}const nn=({additions:e,deletions:s,className:r})=>e===void 0&&s===void 0?null:t.jsxs("span",{className:se("flex items-center gap-1 font-mono text-[11px] shrink-0",r),children:[e!==void 0&&e>0&&t.jsxs("span",{className:"text-emerald-600",children:["+",e]}),s!==void 0&&s>0&&t.jsxs("span",{className:"text-red-600",children:["-",s]}),(e??0)===0&&(s??0)===0&&t.jsx("span",{className:"text-muted-foreground/60",children:"0"})]}),Cv=({line:e,lineNum:s})=>{let r="",o="text-foreground/90";return e.startsWith("+")&&!e.startsWith("+++")?r="bg-success/10":e.startsWith("-")&&!e.startsWith("---")?r="bg-destructive/10":e.startsWith("@@")?(r="bg-info/5",o="text-info"):(e.startsWith("diff ")||e.startsWith("index "))&&(o="text-muted-foreground/70"),t.jsxs("div",{className:se("flex",r),children:[t.jsx("span",{className:"w-10 shrink-0 text-right pr-2 text-muted-foreground/60 select-none border-r border-border/60",children:s}),t.jsx("span",{className:se("pl-2 whitespace-pre",o),children:e})]})},oc=({diff:e})=>{const{t:s}=ce(),[r,o]=S.useState(!1),g=S.useMemo(()=>e.split(`
|
|
71
|
+
`,Xo={wrapper:"transform-component-module_wrapper__SPB86",content:"transform-component-module_content__FBWxo"};Zg(Jg);var ev=function(e){var s=e.children,r=e.wrapperClass,o=r===void 0?"":r,g=e.contentClass,p=g===void 0?"":g,v=e.wrapperStyle,n=e.contentStyle,i=e.wrapperProps,l=i===void 0?{}:i,d=e.contentProps,c=d===void 0?{}:d,m=S.useContext(mi),x=m.init,w=m.cleanupWindowEvents,y=S.useRef(null),a=S.useRef(null);return S.useEffect(function(){var h=y.current,u=a.current;return h!==null&&u!==null&&x&&x?.(h,u),function(){w?.()}},[]),ae.createElement("div",is({},l,{ref:y,className:"".concat(tn.wrapperClass," ").concat(Xo.wrapper," ").concat(o),style:v}),ae.createElement("div",is({},c,{ref:a,className:"".concat(tn.contentClass," ").concat(Xo.content," ").concat(p),style:n}),s))},Jl=function(){var e=S.useContext(mi);if(!e)throw new Error("Transform context must be placed inside TransformWrapper");return e},tv=function(){var e=Jl();return Zr(e)};function sv(e){var s=Jl(),r=S.useState(e(sn(s))),o=r[0],g=r[1];return S.useEffect(function(){var p=!0,v=s.onChange(function(n){p&&g(e(sn(n.instance)))});return function(){v(),p=!1}},[e,s]),o}function rv(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}function iv(e,s){return Bt({queryKey:de.files.tree(e||"",s),queryFn:()=>Ce.get("/files/tree",{params:{workingDir:e||"",path:s}}),enabled:!!e})}function nv(e,s){return Bt({queryKey:de.files.content(e||"",s||""),queryFn:()=>Ce.get("/files/read",{params:{workingDir:e||"",path:s||""}}),enabled:!!e&&!!s})}function ov(e){const s=bt();return S.useCallback(()=>{e&&s.invalidateQueries({queryKey:["files","tree",e]})},[s,e])}function av(){const e=bt();return Ft({mutationFn:s=>Ce.post("/files/write",s),onSuccess:(s,r)=>{const o=de.files.content(r.workingDir,r.path),g=e.getQueryData(o);e.setQueryData(o,{content:r.content,language:g?.language||rv(r.path)})}})}function lv(e,s){return e==="/"?`/${s}`:`${e}/${s}`}function cv(e,s){return e==="/"?s:`${e.slice(1)}/${s}`}const dv=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function uv(e){if(e.type==="directory")return null;const s=e.name.split(".").pop()?.toLowerCase();return s&&dv.has(s)?ka:s==="ts"||s==="tsx"||s==="js"||s==="jsx"?Ur:s==="json"?qd:s==="md"||s==="mdx"||s==="txt"?Ca:Cd}const Yo=({depth:e,active:s,onClick:r,leftIcon:o,rightIcon:g,label:p})=>t.jsxs("button",{type:"button",onClick:r,className:se("w-full flex items-center gap-2 rounded px-2 py-1 text-left text-xs hover:bg-neutral-100",s&&"bg-neutral-100 text-neutral-900"),style:{paddingLeft:8+e*14},children:[t.jsx("span",{className:"shrink-0",children:g}),t.jsx("span",{className:"shrink-0 text-neutral-500",children:o}),t.jsx("span",{className:"truncate text-neutral-700",children:p})]}),ec=({workingDir:e,path:s,depth:r,expanded:o,toggleDir:g,onFileSelect:p,selectedFilePath:v})=>{const{t:n}=ce(),{data:i,isLoading:l,isError:d}=iv(e,s),c=S.useMemo(()=>i?.items??[],[i?.items]);return l?t.jsx("div",{className:"text-xs text-neutral-400 px-2 py-1",style:{paddingLeft:8+r*14},children:n("Loading...")}):d?t.jsx("div",{className:"text-xs text-red-600 px-2 py-1",style:{paddingLeft:8+r*14},children:n("Failed to load")}):t.jsx("div",{className:"space-y-0.5",children:c.map(m=>{if(m.type==="directory"){const h=lv(s,m.name),u=o.has(h);return t.jsxs("div",{children:[t.jsx(Yo,{depth:r,onClick:()=>g(h),rightIcon:u?t.jsx(wt,{size:14,className:"text-neutral-400"}):t.jsx(Mt,{size:14,className:"text-neutral-400"}),leftIcon:u?t.jsx(ii,{size:14,className:"text-amber-500"}):t.jsx($a,{size:14,className:"text-amber-500"}),label:m.name}),u&&t.jsx(ec,{workingDir:e,path:h,depth:r+1,expanded:o,toggleDir:g,onFileSelect:p,selectedFilePath:v})]},h)}const x=cv(s,m.name),w=uv(m),y=v===x,a=w===ka;return t.jsx(Yo,{depth:r,active:y,onClick:()=>p(x),rightIcon:t.jsx("span",{className:"inline-block w-[14px]"}),leftIcon:w?t.jsx(w,{size:14,className:a?"text-emerald-600":"text-sky-600"}):null,label:m.name},x)})})},hv=({workingDir:e,className:s,onFileSelect:r,selectedFilePath:o,onCollapse:g})=>{const{t:p}=ce(),[v,n]=S.useState(()=>new Set),i=ov(e),l=S.useCallback(d=>{n(c=>{const m=new Set(c);return m.has(d)?m.delete(d):m.add(d),m})},[]);return t.jsxs("div",{className:se("h-full flex flex-col",s),children:[t.jsxs("div",{className:"px-3 py-2 border-b border-neutral-200 bg-neutral-50/80 flex items-center justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[11px] font-semibold text-neutral-600 uppercase tracking-wider",children:p("Files")}),t.jsx("div",{className:"text-[11px] text-neutral-400 truncate",children:e||p("No working directory")})]}),t.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e&&t.jsx("button",{type:"button",onClick:i,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:p("Refresh file tree"),children:t.jsx(hr,{size:13})}),g&&t.jsx("button",{type:"button",onClick:g,className:"p-1 rounded hover:bg-neutral-200 text-neutral-400 hover:text-neutral-700 transition-colors",title:p("Collapse file tree"),children:t.jsx(tu,{size:13})})]})]}),t.jsx("div",{className:"flex-1 overflow-auto scrollbar-app-thin p-2",children:e?t.jsx(ec,{workingDir:e,path:"/",depth:0,expanded:v,toggleDir:l,onFileSelect:r,selectedFilePath:o}):t.jsx("div",{className:"text-xs text-neutral-500 px-2 py-2",children:p("No workspace selected.")})})]})},fv=new Set(["png","jpg","jpeg","gif","bmp","webp","svg","ico","avif"]);function mv(e){const s=e.split(".").pop()?.toLowerCase();return s?fv.has(s):!1}function pv(e,s){const r=dr(),o=new URLSearchParams({workingDir:e,path:s});return`${r}/files/image?${o.toString()}`}const gv=({filePath:e})=>{const{t:s}=ce(),{zoomIn:r,zoomOut:o,centerView:g}=tv(),p=sv(n=>n.state.scale),v=Math.round(p*100);return t.jsxs("div",{className:"flex items-center gap-1 px-3 py-1.5 border-b border-neutral-200 bg-neutral-50/80 shrink-0",children:[t.jsx("button",{type:"button",onClick:()=>o(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:s("Zoom out"),children:t.jsx(gu,{size:14})}),t.jsxs("button",{type:"button",onClick:()=>g(1),className:"px-1.5 py-0.5 rounded hover:bg-neutral-200 text-[11px] text-neutral-600 tabular-nums min-w-[40px] text-center transition-colors",title:s("Reset zoom"),children:[v,"%"]}),t.jsx("button",{type:"button",onClick:()=>r(.5),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors",title:s("Zoom in"),children:t.jsx(mu,{size:14})}),t.jsx("button",{type:"button",onClick:()=>g(1),className:"p-1 rounded hover:bg-neutral-200 text-neutral-500 hover:text-neutral-700 transition-colors ml-1",title:s("Fit to view"),children:t.jsx(Jd,{size:13})}),t.jsx("span",{className:"ml-2 text-[11px] text-neutral-400 truncate",children:e})]})},vv=({workingDir:e,filePath:s})=>{const{t:r}=ce(),[o,g]=S.useState(!1),p=pv(e,s);return o?t.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:r("Failed to load image.")}):t.jsx(Qg,{initialScale:1,minScale:.1,maxScale:10,centerOnInit:!0,doubleClick:{mode:"toggle"},children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx(gv,{filePath:s}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden bg-[repeating-conic-gradient(#f3f3f3_0%_25%,#fff_0%_50%)] bg-[length:16px_16px]",children:t.jsx(ev,{wrapperStyle:{width:"100%",height:"100%"},contentStyle:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx("img",{src:p,alt:s,className:"max-w-full max-h-full object-contain rounded shadow-sm",draggable:!1,onError:()=>g(!0)})})})]})})};function xv(e){const s=e.split("/");return s[s.length-1]||e}function _v(e){switch(e.split(".").pop()?.toLowerCase()){case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"md":case"mdx":return"markdown";case"css":return"css";case"scss":return"scss";case"html":return"html";case"yml":case"yaml":return"yaml";case"sh":return"shell";case"py":return"python";case"go":return"go";case"rs":return"rust";default:return"plaintext"}}const bv=({active:e,name:s,isDirty:r,onClick:o,onClose:g})=>{const{t:p}=ce();return t.jsxs("button",{type:"button",onClick:o,className:se("group flex items-center gap-2 px-3 py-2 rounded-t-md border-t border-x -mb-px min-w-[120px] max-w-[240px]",e?"bg-white border-neutral-200 text-neutral-900":"bg-neutral-100/60 border-transparent text-neutral-500 hover:text-neutral-700 hover:bg-neutral-100"),children:[t.jsx("span",{className:se("w-2 h-2 rounded-full",r?"bg-amber-500":"bg-transparent")}),t.jsx("span",{className:"truncate flex-1 text-left text-xs",children:s}),t.jsx("span",{onClick:g,className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-neutral-200 rounded transition-all shrink-0","aria-label":p("Close tab"),title:p("Close"),children:t.jsx(Yt,{size:12})})]})},yv=ae.forwardRef(function({workingDir:s,className:r,readOnly:o=!1},g){const{t:p}=ce(),[v,n]=S.useState([]),[i,l]=S.useState(null),[d,c]=S.useState(!1),[m,x]=S.useState(!1),[w,y]=S.useState(0),[a,h]=S.useState(null),u=S.useRef(null),f=av();S.useEffect(()=>{let z=!1;return td(async()=>{const{preloadMonaco:$}=await import("./monaco-Bc-Z2u8N.js").then(q=>q.m);return{preloadMonaco:$}},__vite__mapDeps([0,1,2,3])).then(({preloadMonaco:$})=>$()).then(()=>{z||c(!0)}).catch(()=>{z||x(!0)}),()=>{z=!0}},[]);const[b,C]=S.useState(280),[k,E]=S.useState(!1),[_,j]=S.useState(!1),A=S.useRef(280),P=S.useCallback(()=>{E(z=>(z?C(A.current):A.current=b,!z))},[b]),T=S.useCallback(z=>{z.preventDefault(),j(!0);const $=z.clientX,q=b,N=X=>{const K=X.clientX-$,ne=Math.min(480,Math.max(160,q+K));C(ne)},H=()=>{j(!1),document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",H)};document.addEventListener("mousemove",N),document.addEventListener("mouseup",H)},[b]);S.useEffect(()=>{n([]),l(null),h(null)},[s]);const D=S.useMemo(()=>v.find(z=>z.path===i)||null,[v,i]),{data:W,isFetching:I,isError:B,error:F}=nv(s,D?.isImage?null:i);S.useEffect(()=>{!i||!W||n(z=>z.map($=>$.path!==i||$.isDirty||$.loaded?$:{...$,language:W.language||$.language,content:W.content,savedContent:W.content,isDirty:!1,loaded:!0}))},[i,W]);const R=S.useCallback((z,$,q)=>{n(N=>{if(N.find(K=>K.path===z))return N;const X=mv(z);return[...N,{path:z,name:xv(z),language:_v(z),content:"",savedContent:"",isDirty:!1,loaded:X,isImage:X}]}),l(z),h($?{path:z,line:$,column:q}:null)},[]);ae.useImperativeHandle(g,()=>({openFile:R}),[R]);const M=S.useCallback(z=>{n($=>{const q=$.filter(N=>N.path!==z);return l(N=>N!==z?N:q.length?q[q.length-1].path:null),q})},[]),L=S.useCallback(z=>{n($=>$.map(q=>{if(q.path!==i)return q;const N=z!==q.savedContent;return{...q,content:z,isDirty:N}}))},[i]),O=S.useCallback(async()=>{o||!s||!D||(await f.mutateAsync({workingDir:s,path:D.path,content:D.content}),n(z=>z.map($=>$.path===D.path?{...$,savedContent:$.content,isDirty:!1,loaded:!0}:$)))},[D,o,f,s]),U=S.useRef(()=>{});S.useEffect(()=>{U.current=()=>{O().catch(()=>{})}},[O]),S.useEffect(()=>{const z=$=>{o||($.metaKey||$.ctrlKey)&&$.key.toLowerCase()==="s"&&($.preventDefault(),U.current())};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[o]);const Y=S.useCallback((z,$)=>{u.current=z,y(q=>q+1),z.addCommand($.KeyMod.CtrlCmd|$.KeyCode.KeyS,()=>{U.current()})},[]);return S.useEffect(()=>{if(!a||a.path!==i||!D?.loaded)return;const z=u.current,$=z?.getModel();if(!z||!$)return;const q=Math.min(a.line,$.getLineCount()),N=Math.min(a.column??1,$.getLineMaxColumn(q)),H={lineNumber:q,column:N};z.setPosition(H),z.revealPositionInCenter(H),z.focus(),h(null)},[i,D?.loaded,w,a]),t.jsxs("div",{className:se("flex h-full overflow-hidden bg-white",r),style:_?{userSelect:"none",cursor:"col-resize"}:void 0,children:[t.jsx("div",{className:"border-r border-neutral-200 bg-white shrink-0 overflow-hidden relative",style:{width:k?36:b,transition:_?"none":"width 0.15s ease"},children:k?t.jsx("div",{className:"h-full flex items-start pt-2 justify-center",children:t.jsx("button",{type:"button",onClick:P,className:"p-1.5 rounded hover:bg-neutral-100 text-neutral-500 hover:text-neutral-700 transition-colors",title:p("Expand file tree"),children:t.jsx(ru,{size:16})})}):t.jsx(t.Fragment,{children:t.jsx(hv,{workingDir:s,onFileSelect:R,selectedFilePath:D?.path||null,onCollapse:P},s||"no-working-dir")})}),!k&&t.jsx("div",{onMouseDown:T,className:se("w-1 shrink-0 cursor-col-resize transition-colors",_?"bg-blue-400":"bg-transparent hover:bg-blue-300")}),t.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 overflow-x-auto shrink-0",children:[v.length===0?t.jsx("div",{className:"px-2 pb-2 text-xs text-neutral-500",children:p("No open files")}):v.map(z=>t.jsx(bv,{active:z.path===i,name:z.name,isDirty:z.isDirty,onClick:()=>l(z.path),onClose:$=>{$.stopPropagation(),M(z.path)}},z.path)),t.jsxs("div",{className:"ml-auto flex items-center gap-2 pb-2 pr-1",children:[o&&t.jsx("span",{className:"text-[11px] text-neutral-400",children:p("Read-only")}),f.isPending&&t.jsxs("span",{className:"flex items-center gap-2 text-xs text-neutral-500",children:[t.jsx(Ke,{size:14,className:"animate-spin"}),p("Saving")]}),D?.isDirty&&!f.isPending&&t.jsx("span",{className:"text-[11px] text-amber-600",children:p("Unsaved")})]})]}),t.jsx("div",{className:"flex-1 min-h-0 relative",children:s?D?D.isImage?t.jsx(vv,{workingDir:s,filePath:D.path}):m?t.jsx("div",{className:"h-full flex items-center justify-center text-red-600 text-sm",children:p("Failed to load editor.")}):d?t.jsxs(t.Fragment,{children:[t.jsx(Hp,{path:D.path,value:D.content,language:D.language,theme:"vs-light",height:"100%",onChange:o?void 0:z=>L(z??""),onMount:Y,options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"off",automaticLayout:!0,readOnly:o}}),I&&!D.loaded&&t.jsx("div",{className:"absolute inset-0 bg-white/60 flex items-center justify-center",children:t.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-600",children:[t.jsx(Ke,{size:14,className:"animate-spin"}),p("Loading file...")]})}),B&&t.jsxs("div",{className:"absolute bottom-2 left-2 right-2 text-xs text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1",children:[p("Failed to load file"),F instanceof Error?`: ${F.message}`:""]})]}):t.jsxs("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:[t.jsx(Ke,{size:14,className:"animate-spin mr-2"}),p("Loading editor...")]}):t.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:p("Select a file from the tree to open.")}):t.jsx("div",{className:"h-full flex items-center justify-center text-neutral-500 text-sm",children:p("No workspace selected.")})})]})]})});function pi(e,s={}){const r=_s(g=>g.visibleContext),o=pl(e,r);return Bt({queryKey:de.git.changes(e||""),queryFn:()=>Ce.get("/git/changes",{params:{workingDir:e||""}}),enabled:!!e&&(s.enabled??!0),refetchInterval:o,refetchIntervalInBackground:!1,refetchOnWindowFocus:o?"always":!1,refetchOnReconnect:o?"always":!1})}function tc(e,s,r){const o=_s(p=>p.visibleContext),g=pl(e,o);return Bt({queryKey:de.git.diff(e||"",s||"",r),queryFn:()=>Ce.get("/git/diff",{params:{workingDir:e||"",path:s||"",type:r}}),enabled:!!e&&!!s,refetchInterval:g,refetchIntervalInBackground:!1,refetchOnWindowFocus:g?"always":!1,refetchOnReconnect:g?"always":!1})}function $n(e,s){return Bt({queryKey:de.git.commitFiles(e||"",s||""),queryFn:()=>Ce.get("/git/commit-files",{params:{workingDir:e||"",hash:s||""}}),enabled:!!e&&!!s})}function Un(e,s,r){return Bt({queryKey:de.git.commitDiff(e||"",s||"",r||""),queryFn:()=>Ce.get("/git/commit-diff",{params:{workingDir:e||"",hash:s||"",path:r||""}}),enabled:!!e&&!!s&&!!r})}function sc({isOpen:e,onClose:s,branchName:r,targetBranch:o,commitMessage:g,isPending:p,error:v,onConfirm:n}){const{t:i}=ce(),[l,d]=S.useState(""),[c,m]=S.useState(!1);S.useEffect(()=>{e&&(m(!1),d(g??""))},[e]),S.useEffect(()=>{c||!e||d(g??"")},[g,c,e]);const x=()=>{p||s()};return t.jsx(ns,{isOpen:e,onClose:x,title:i("提交变更"),className:"max-w-md",action:t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:x,disabled:p,className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:i("取消")}),t.jsx("button",{onClick:()=>n(l.trim()||void 0),disabled:p,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-primary-foreground bg-primary hover:bg-primary/90 rounded-md transition-colors disabled:opacity-50",children:p?t.jsxs(t.Fragment,{children:[t.jsx(Ke,{size:14,className:"animate-spin"}),i("正在提交...")]}):t.jsxs(t.Fragment,{children:[t.jsx($r,{size:14}),i("确认提交")]})})]}),children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-muted font-mono text-xs text-muted-foreground",children:r}),t.jsx(Ua,{size:14,className:"text-muted-foreground/70 shrink-0"}),t.jsx("span",{className:"px-2 py-0.5 rounded-sm bg-muted font-mono text-xs text-muted-foreground",children:o})]}),t.jsxs("div",{children:[t.jsx("label",{className:"block text-xs font-medium text-foreground mb-1.5",children:i("提交消息")}),t.jsx("textarea",{value:l,onChange:w=>{m(!0),d(w.target.value)},placeholder:i("请描述本次修改的内容"),rows:4,className:"w-full px-3 py-2 rounded-md border border-input text-sm font-mono text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:ring-2 focus:ring-ring/30 focus:border-ring resize-none"}),t.jsx("p",{className:"mt-1.5 text-[11px] text-muted-foreground/70 leading-relaxed",children:i("建议以 feat、fix、docs、refactor、chore 开头,保持提交记录清晰。feat 新增功能,fix 修复问题,docs 文档更新,refactor 代码重构,chore 日常维护。")}),!l.trim()&&t.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground/70",children:i("留空将使用默认消息")})]}),v&&t.jsx("div",{className:"px-3 py-2 rounded-md bg-red-50 border border-red-200 text-sm text-red-700",children:v})]})})}function Es(e,s){const r=e[s];return typeof r=="string"&&r.length>0?r:void 0}function rc(e){if(!(e instanceof cn)||e.status!==409)return;const s=e.details;if(s.code!=="MERGE_CONFLICT"||s.conflictOp!==ir.REBASE&&s.conflictOp!==ir.MERGE||!Array.isArray(s.conflictedFiles)||!s.conflictedFiles.every(o=>typeof o=="string"))return;const r=s.mergeStrategy==="squash"||s.mergeStrategy==="no_ff"?s.mergeStrategy:void 0;return{conflictOp:s.conflictOp,conflictedFiles:s.conflictedFiles,mergeAborted:typeof s.mergeAborted=="boolean"?s.mergeAborted:void 0,mergeStrategy:r,sourceBranch:Es(s,"sourceBranch"),targetBranch:Es(s,"targetBranch"),sourceWorktreePath:Es(s,"sourceWorktreePath"),targetWorktreePath:Es(s,"targetWorktreePath"),sourceWorkspaceId:Es(s,"sourceWorkspaceId"),targetWorkspaceId:Es(s,"targetWorkspaceId")}}function Vo(e,s,r,o){const g=rc(e);if(g){r(g);return}o(e instanceof Error?e.message:s)}function ic({workspaceId:e,branchName:s,targetBranch:r,commitMessage:o,committedFileCount:g,onRefreshCommitMessage:p,onConflict:v,onResolveConflicts:n}){const{t:i}=ce(),{data:l,isLoading:d}=Pn(e),c=xl(),m=vl(),x=Ln(),[w,y]=S.useState(!1),[a,h]=S.useState(null);if(S.useEffect(()=>{w&&p?.()},[w,p]),d||!l)return t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-muted-foreground/70 border-b border-border/60",children:[t.jsx(Ke,{size:14,className:"animate-spin"}),t.jsx("span",{className:"text-xs",children:i("正在检查工作区状态...")})]});const u=l.conflictedFiles.length>0,f=l.operation!=="idle",b=l.hasUncommittedChanges||l.untrackedCount>0,C=l.uncommittedCount+l.untrackedCount,k=!u&&!f&&!b,E=l.operation==="idle"&&l.ahead===0&&l.behind===0&&!b&&!u,_=()=>{h(null),c.mutate(e,{onError:T=>{Vo(T,i("更新失败,请稍后重试"),D=>v(D),h)}})},j=()=>{h(null),y(!0)},A=T=>{h(null),m.mutate({id:e,commitMessage:T},{onSuccess:()=>y(!1),onError:D=>{Vo(D,i("提交失败,请稍后重试"),W=>{y(!1),v(W)},h)}})},P=()=>{m.isPending||(y(!1),h(null))};return E?t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-muted-foreground/70 border-b border-border/60",children:[t.jsx(sd,{size:13}),t.jsx("span",{className:"text-xs",children:i("当前分支还没有任何变更")})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"border-b border-border bg-background",children:t.jsxs("div",{className:"px-3 py-2",children:[a&&t.jsx("div",{className:"mb-2 px-2.5 py-1.5 rounded-md bg-red-50 border border-red-200 text-[11px] text-red-700",children:a}),b&&t.jsxs("div",{className:"flex items-center gap-2 mb-2 px-2.5 py-1.5 rounded-md bg-amber-50 border border-amber-200 text-[11px] text-amber-800",children:[t.jsx(Yd,{size:12,className:"shrink-0"}),t.jsx("span",{children:i("{count} 个本地改动未处理,需要先整理后再继续",{count:C})})]}),u&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-amber-700",children:[t.jsx(ur,{size:13,className:"shrink-0"}),t.jsx("span",{children:i("{count} 个文件存在冲突,需要处理后继续",{count:l.conflictedFiles.length})})]}),t.jsxs("div",{className:"flex items-center gap-1.5 ml-auto",children:[t.jsx("button",{onClick:n,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium text-amber-800 bg-amber-100 hover:bg-amber-200 border border-amber-200 transition-colors",children:i("处理冲突")}),t.jsx("button",{onClick:()=>x.mutate(e),disabled:x.isPending,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs text-muted-foreground hover:bg-muted border border-border transition-colors disabled:opacity-50",children:x.isPending?i("正在撤销..."):i("撤销操作")})]})]}),f&&!u&&t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-info",children:[t.jsx(Ke,{size:13,className:"animate-spin shrink-0"}),t.jsx("span",{children:l.operation==="rebase"?i("正在同步源分支更新..."):i("正在提交变更...")})]}),t.jsxs("button",{onClick:()=>x.mutate(e),disabled:x.isPending,className:"flex items-center gap-1.5 ml-auto px-2.5 py-1 rounded-md text-xs text-muted-foreground hover:bg-muted border border-border transition-colors disabled:opacity-50",children:[t.jsx(rd,{size:12}),x.isPending?i("正在撤销..."):i("撤销操作")]})]}),!u&&!f&&(l.behind>0||l.ahead>0)&&t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[l.behind>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:i("源分支 {branch} 有 {count} 个更新",{branch:r,count:l.behind})}),t.jsxs("button",{onClick:_,disabled:!k||c.isPending,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium text-primary-foreground bg-primary hover:bg-primary/90 transition-colors disabled:opacity-50",children:[t.jsx(hr,{size:12}),c.isPending?i("正在同步..."):i("同步更新")]})]}),l.ahead>0&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:i("{count} 个文件变更,可以安全提交",{count:g??l.ahead})}),l.behind===0&&!b?t.jsxs("button",{onClick:j,disabled:m.isPending,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium text-primary-foreground bg-primary hover:bg-primary/90 transition-colors disabled:opacity-50",children:[t.jsx($r,{size:12}),i("提交变更")]}):t.jsxs("button",{disabled:!0,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs text-muted-foreground/60 bg-muted/60 border border-border cursor-not-allowed",title:i(b?"需要先处理本地改动":"需要先同步源分支更新"),children:[t.jsx($r,{size:12}),i("提交变更")]})]})]})]})}),t.jsx(sc,{isOpen:w,onClose:P,branchName:s,targetBranch:r,commitMessage:o,isPending:m.isPending,error:a,onConfirm:A})]})}const Oi=50,Bi=400,Go={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"},Qo={M:"bg-amber-500",A:"bg-emerald-500",D:"bg-red-500",R:"bg-blue-500"};function nc(e){const s=e.split("/");return s[s.length-1]||e}function Sv(e){const s=e.lastIndexOf("/");return s>0?e.slice(0,s):""}function wv(e){const r=Math.floor(Date.now()/1e3)-e;return r<60?gt("{count}s ago",{count:r}):r<3600?gt("{count}m ago",{count:Math.floor(r/60)}):r<86400?gt("{count}h ago",{count:Math.floor(r/3600)}):r<604800?gt("{count}d ago",{count:Math.floor(r/86400)}):new Date(e*1e3).toLocaleDateString()}function Br(e,s){return e.kind==="working"?`${e.diffType}:${s}`:`${e.hash}:${s}`}const nn=({additions:e,deletions:s,className:r})=>e===void 0&&s===void 0?null:t.jsxs("span",{className:se("flex items-center gap-1 font-mono text-[11px] shrink-0",r),children:[e!==void 0&&e>0&&t.jsxs("span",{className:"text-emerald-600",children:["+",e]}),s!==void 0&&s>0&&t.jsxs("span",{className:"text-red-600",children:["-",s]}),(e??0)===0&&(s??0)===0&&t.jsx("span",{className:"text-muted-foreground/60",children:"0"})]}),Cv=({line:e,lineNum:s})=>{let r="",o="text-foreground/90";return e.startsWith("+")&&!e.startsWith("+++")?r="bg-success/10":e.startsWith("-")&&!e.startsWith("---")?r="bg-destructive/10":e.startsWith("@@")?(r="bg-info/5",o="text-info"):(e.startsWith("diff ")||e.startsWith("index "))&&(o="text-muted-foreground/70"),t.jsxs("div",{className:se("flex",r),children:[t.jsx("span",{className:"w-10 shrink-0 text-right pr-2 text-muted-foreground/60 select-none border-r border-border/60",children:s}),t.jsx("span",{className:se("pl-2 whitespace-pre",o),children:e})]})},oc=({diff:e})=>{const{t:s}=ce(),[r,o]=S.useState(!1),g=S.useMemo(()=>e.split(`
|
|
72
72
|
`),[e]);if(!e.trim())return t.jsx("div",{className:"py-6 text-center text-muted-foreground/70 text-xs",children:s("没有可显示的差异内容")});const p=!r&&g.length>Bi,v=p?g.slice(0,Bi):g;return t.jsxs("div",{className:"overflow-x-auto scrollbar-app-thin font-mono text-xs leading-5",children:[v.map((n,i)=>t.jsx(Cv,{line:n,lineNum:i+1},i)),p&&t.jsx("button",{type:"button",onClick:()=>o(!0),className:"w-full py-2 text-xs text-info hover:bg-info/5 transition-colors",children:s("还有 {count} 行变更被折叠,点击展开全部",{count:g.length-Bi})})]})},kv=({workingDir:e,path:s,diffType:r,enabled:o})=>{const{t:g}=ce(),{data:p,isLoading:v,isError:n}=tc(e,o?s:null,r);return!o||v?t.jsxs("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:[t.jsx(Ke,{size:14,className:"animate-spin mr-2"}),t.jsx("span",{className:"text-xs",children:g("正在加载差异...")})]}):n?t.jsx("div",{className:"py-6 text-center text-destructive text-xs",children:g("差异加载失败")}):t.jsx(oc,{diff:p?.diff||""})},Ev=({workingDir:e,hash:s,path:r,enabled:o})=>{const{t:g}=ce(),{data:p,isLoading:v,isError:n}=Un(e,o?s:null,o?r:null);return!o||v?t.jsxs("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:[t.jsx(Ke,{size:14,className:"animate-spin mr-2"}),t.jsx("span",{className:"text-xs",children:g("正在加载差异...")})]}):n?t.jsx("div",{className:"py-6 text-center text-destructive text-xs",children:g("差异加载失败")}):t.jsx(oc,{diff:p?.diff||""})},Fi=({entry:e,source:s,workingDir:r,flash:o,registerNode:g})=>{const[p,v]=S.useState(!1),[n,i]=S.useState(!1),l=S.useRef(null),d=Br(s,e.path);S.useEffect(()=>(g(d,l.current),()=>g(d,null)),[d,g]),S.useEffect(()=>{const x=l.current;if(!x||n)return;const w=new IntersectionObserver(y=>{y.some(a=>a.isIntersecting)&&(i(!0),w.disconnect())},{rootMargin:"300px 0px"});return w.observe(x),()=>w.disconnect()},[n]);const c=Go[e.status]||Go.M,m=Sv(e.path);return t.jsxs("div",{ref:l,"data-card-key":d,className:se("rounded-md border border-border bg-background overflow-hidden transition-shadow",o&&"ring-2 ring-info/40"),children:[t.jsxs("button",{type:"button",onClick:()=>v(x=>!x),className:"w-full flex items-center gap-2 px-3 py-2 bg-muted/40 hover:bg-muted/70 transition-colors text-left",children:[p?t.jsx(Mt,{size:13,className:"text-muted-foreground/70 shrink-0"}):t.jsx(wt,{size:13,className:"text-muted-foreground/70 shrink-0"}),t.jsx("span",{className:se("w-4 h-4 flex items-center justify-center text-[11px] font-semibold border rounded-sm shrink-0",c),children:e.status}),t.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:nc(e.path)}),m&&t.jsx("span",{className:"text-[11px] text-muted-foreground/70 truncate",children:m}),t.jsx("span",{className:"ml-auto"}),t.jsx(nn,{additions:e.additions,deletions:e.deletions})]}),!p&&t.jsx("div",{className:"border-t border-border/60",children:s.kind==="working"?t.jsx(kv,{workingDir:r,path:e.path,diffType:s.diffType,enabled:n}):t.jsx(Ev,{workingDir:r,hash:s.hash,path:e.path,enabled:n})})]})};function jv(e){const s={name:"",path:"",dirs:new Map,files:[]};for(const r of e){const o=r.path.split("/");let g=s;for(let p=0;p<o.length-1;p++){const v=o[p];g.dirs.has(v)||g.dirs.set(v,{name:v,path:g.path?`${g.path}/${v}`:v,dirs:new Map,files:[]}),g=g.dirs.get(v)}g.files.push(r)}return ac(s)}function ac(e){const s=new Map;for(const r of e.dirs.values()){let o=ac(r);for(;o.dirs.size===1&&o.files.length===0;){const g=[...o.dirs.values()][0];o={...g,name:`${o.name}/${g.name}`}}s.set(o.name,o)}return{...e,dirs:s}}const Nv=({dir:e,depth:s,activeKey:r,onSelect:o})=>{const[g,p]=S.useState(!0);return t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>p(v=>!v),className:"flex items-center gap-1.5 w-full px-2 py-1 rounded-sm hover:bg-muted/60 text-left",style:{paddingLeft:8+s*12},children:[g?t.jsx(ii,{size:12,className:"text-muted-foreground/70 shrink-0"}):t.jsx($a,{size:12,className:"text-muted-foreground/70 shrink-0"}),t.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:e.name})]}),g&&t.jsx(lc,{node:e,depth:s+1,activeKey:r,onSelect:o})]})},lc=({node:e,depth:s,activeKey:r,onSelect:o})=>t.jsxs(t.Fragment,{children:[[...e.dirs.values()].sort((g,p)=>g.name.localeCompare(p.name)).map(g=>t.jsx(Nv,{dir:g,depth:s,activeKey:r,onSelect:o},g.path)),e.files.slice().sort((g,p)=>g.path.localeCompare(p.path)).map(g=>{const p=r===g.cardKey;return t.jsxs("button",{type:"button",onClick:()=>o(g),className:se("flex items-center gap-1.5 w-full px-2 py-1 rounded-sm text-left",p?"bg-muted":"hover:bg-muted/60"),style:{paddingLeft:8+s*12},title:g.path,children:[t.jsx("span",{className:se("w-1.5 h-1.5 rounded-full shrink-0",Qo[g.status]||Qo.M)}),t.jsx("span",{className:se("text-xs truncate",p?"text-foreground font-medium":"text-foreground/90"),children:nc(g.path)})]},g.cardKey)})]}),Rv=({workingDir:e,selectedHash:s,onSelectCommit:r})=>{const{t:o}=ce(),{data:g,isLoading:p,fetchNextPage:v,hasNextPage:n,isFetchingNextPage:i}=wn({queryKey:de.git.log(e),queryFn:({pageParam:d=0})=>Ce.get("/git/log",{params:{workingDir:e,limit:String(Oi),skip:String(d)}}),initialPageParam:0,getNextPageParam:(d,c)=>d.commits.length<Oi?void 0:c.length*Oi}),l=g?.pages.flatMap(d=>d.commits)||[];return p?t.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 text-muted-foreground/70 text-[11px]",children:[t.jsx(Ke,{size:11,className:"animate-spin"}),t.jsx("span",{children:o("正在加载提交记录...")})]}):l.length===0?t.jsx("div",{className:"px-3 py-2 text-[11px] text-muted-foreground/60",children:o("暂无提交记录")}):t.jsxs("div",{className:"space-y-px px-1.5 pb-1.5",children:[l.map(d=>{const c=s===d.hash;return t.jsxs("button",{type:"button",onClick:()=>r(d),className:se("flex items-start gap-1.5 w-full px-1.5 py-1 rounded-sm text-left group",c?"bg-muted":"hover:bg-muted/60"),title:d.message,children:[t.jsx("span",{className:se("w-1.5 h-1.5 rounded-full mt-1.5 shrink-0 transition-colors",c?"bg-brand":"bg-border group-hover:bg-muted-foreground/60")}),t.jsxs("span",{className:"flex-1 min-w-0",children:[t.jsx("span",{className:se("block text-xs truncate",c?"text-foreground font-medium":"text-foreground/90"),children:d.message}),t.jsxs("span",{className:"block text-[11px] text-muted-foreground/70 truncate",children:[t.jsx("span",{className:"font-mono",children:d.shortHash})," · ",d.author," · ",wv(d.timestamp)]})]})]},d.hash)}),n&&t.jsx("button",{type:"button",onClick:()=>v(),disabled:i,className:"w-full py-1.5 text-[11px] text-muted-foreground hover:text-foreground hover:bg-muted/60 rounded-sm transition-colors flex items-center justify-center gap-1.5",children:i?t.jsxs(t.Fragment,{children:[t.jsx(Ke,{size:11,className:"animate-spin"})," ",o("正在加载...")]}):o("加载更多提交")})]})},Av=({workingDir:e,workspaceId:s,branchName:r,targetBranch:o,commitMessage:g,canRunGitOperations:p,onRefreshCommitMessage:v,onConflict:n,onResolveConflicts:i})=>{const{t:l}=ce(),[d,c]=S.useState({kind:"overview"}),[m,x]=S.useState(""),[w,y]=S.useState(null),[a,h]=S.useState(null),{data:u,isLoading:f,isError:b}=pi(e),C=d.kind==="commit"?d.commit.hash:null,{data:k,isLoading:E}=$n(e,C),_=S.useRef(new Map),j=S.useRef(null),A=S.useRef(null),P=S.useCallback((z,$)=>{$?_.current.set(z,$):_.current.delete(z)},[]),{uncommitted:T,committed:D,commitFiles:W}=S.useMemo(()=>{const z=N=>!m.trim()||N.path.toLowerCase().includes(m.trim().toLowerCase());if(d.kind==="commit"){const N={kind:"commit",hash:d.commit.hash},H=(k?.files||[]).filter(z).map(X=>({...X,cardKey:Br(N,X.path)}));return{uncommitted:[],committed:[],commitFiles:H}}const $=(u?.uncommitted||[]).filter(z).map(N=>({...N,cardKey:Br({kind:"working",diffType:"uncommitted"},N.path)})),q=(u?.committed||[]).filter(z).map(N=>({...N,cardKey:Br({kind:"working",diffType:"committed"},N.path)}));return{uncommitted:$,committed:q,commitFiles:[]}},[d,u,k,m]),I=d.kind==="commit"?W:[...T,...D],B=S.useMemo(()=>jv(I),[I]),F=S.useMemo(()=>{let z=0,$=0;for(const q of I)z+=q.additions??0,$+=q.deletions??0;return{additions:z,deletions:$,files:I.length}},[I]),R=S.useCallback(()=>{const z=j.current;if(!z)return;const $=z.getBoundingClientRect().top;let q=null,N=Number.NEGATIVE_INFINITY;for(const[H,X]of _.current){const K=X.getBoundingClientRect().top-$;K<=48&&K>N&&(N=K,q=H)}if(!q){let H=null,X=Number.POSITIVE_INFINITY;for(const[K,ne]of _.current){const te=ne.getBoundingClientRect().top-$;te<X&&(X=te,H=K)}q=H}y(q)},[]);S.useEffect(()=>{const z=j.current;if(!z)return;let $=0;const q=()=>{cancelAnimationFrame($),$=requestAnimationFrame(R)};return z.addEventListener("scroll",q,{passive:!0}),()=>{z.removeEventListener("scroll",q),cancelAnimationFrame($)}},[R]);const M=S.useCallback(z=>{const $=_.current.get(z.cardKey);$&&($.scrollIntoView({behavior:"smooth",block:"start"}),y(z.cardKey),h(z.cardKey),A.current&&clearTimeout(A.current),A.current=setTimeout(()=>h(null),1200))},[]),L=S.useCallback(z=>{c($=>$.kind==="commit"&&$.commit.hash===z.hash?{kind:"overview"}:{kind:"commit",commit:z}),x(""),y(null),j.current?.scrollTo({top:0})},[]),O=S.useCallback(()=>{c({kind:"overview"}),x(""),y(null),j.current?.scrollTo({top:0})},[]);if(!e)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm bg-background h-full",children:l("未选择工作区")});const U=p&&s&&r&&o,Y=d.kind==="commit"?E:f;return t.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col bg-background",children:[U&&n&&i&&t.jsx(ic,{workspaceId:s,branchName:r,targetBranch:o,commitMessage:g,committedFileCount:u?.committed?.length,onRefreshCommitMessage:v,onConflict:n,onResolveConflicts:i}),t.jsx("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border/60 shrink-0 min-h-[37px]",children:d.kind==="overview"?t.jsxs(t.Fragment,{children:[t.jsx(Fs,{size:14,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-xs font-semibold text-foreground",children:l("代码审查")}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:l("{count} 个文件",{count:F.files})}),t.jsx(nn,{additions:F.additions,deletions:F.deletions}),r&&o&&t.jsxs("span",{className:"ml-auto flex items-center gap-1 text-[11px] text-muted-foreground/70 font-mono truncate",children:[t.jsx("span",{className:"truncate",children:r}),t.jsx(Ls,{size:10,className:"rotate-180 shrink-0"}),t.jsx("span",{className:"truncate",children:o})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:O,className:"flex items-center gap-1 px-1.5 py-0.5 -ml-1.5 rounded-sm text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 transition-colors shrink-0",children:[t.jsx(Ls,{size:12}),l("全部变更")]}),t.jsx("span",{className:"text-muted-foreground/40 text-xs",children:"/"}),t.jsx("span",{className:"text-[11px] font-mono text-muted-foreground shrink-0",children:d.commit.shortHash}),t.jsx("span",{className:"text-xs text-foreground truncate",children:d.commit.message}),t.jsx(nn,{className:"ml-auto",additions:F.additions,deletions:F.deletions})]})}),t.jsxs("div",{className:"flex flex-1 min-h-0",children:[t.jsx("div",{ref:j,className:"flex-1 min-w-0 overflow-y-auto scrollbar-app-thin",children:Y?t.jsx("div",{className:"p-3 space-y-3",children:[0,1].map(z=>t.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[t.jsx("div",{className:"h-8 bg-muted/60 animate-pulse"}),t.jsxs("div",{className:"p-3 space-y-2",children:[t.jsx("div",{className:"h-3 w-2/3 bg-muted animate-pulse rounded-sm"}),t.jsx("div",{className:"h-3 w-1/2 bg-muted animate-pulse rounded-sm"}),t.jsx("div",{className:"h-3 w-3/4 bg-muted animate-pulse rounded-sm"})]})]},z))}):b&&d.kind==="overview"?t.jsx("div",{className:"flex-1 flex items-center justify-center py-16 text-destructive text-sm",children:l("变更加载失败")}):I.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-muted-foreground/60",children:[t.jsx(Ur,{size:28,className:"mb-2"}),t.jsx("span",{className:"text-xs",children:m.trim()?l("没有匹配筛选条件的文件"):d.kind==="commit"?l("该提交没有文件变更"):l("没有待审查的变更")})]}):d.kind==="commit"?t.jsx("div",{className:"p-3 space-y-3",children:W.map(z=>t.jsx(Fi,{entry:z,source:{kind:"commit",hash:d.commit.hash},workingDir:e,flash:a===z.cardKey,registerNode:P},z.cardKey))}):t.jsxs("div",{className:"p-3 space-y-4",children:[T.length>0&&t.jsxs("section",{children:[t.jsxs("div",{className:"sticky top-0 z-10 -mx-3 px-5 py-1.5 bg-background/95 backdrop-blur-sm",children:[t.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:l("未提交")}),t.jsx("span",{className:"ml-2 text-[11px] text-muted-foreground/70",children:T.length})]}),t.jsx("div",{className:"space-y-3 mt-1",children:T.map(z=>t.jsx(Fi,{entry:z,source:{kind:"working",diffType:"uncommitted"},workingDir:e,flash:a===z.cardKey,registerNode:P},z.cardKey))})]}),D.length>0&&t.jsxs("section",{children:[t.jsxs("div",{className:"sticky top-0 z-10 -mx-3 px-5 py-1.5 bg-background/95 backdrop-blur-sm",children:[t.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:l("已提交")}),t.jsx("span",{className:"ml-2 text-[11px] text-muted-foreground/70",children:D.length})]}),t.jsx("div",{className:"space-y-3 mt-1",children:D.map(z=>t.jsx(Fi,{entry:z,source:{kind:"working",diffType:"committed"},workingDir:e,flash:a===z.cardKey,registerNode:P},z.cardKey))})]})]})}),t.jsxs("aside",{className:"shrink-0 border-l border-border flex flex-col min-h-0",style:{width:"clamp(15rem, 24%, 22rem)"},children:[t.jsx("div",{className:"p-2 shrink-0",children:t.jsxs("div",{className:"relative",children:[t.jsx(pn,{size:12,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground/60"}),t.jsx("input",{value:m,onChange:z=>x(z.target.value),placeholder:l("筛选文件..."),className:"w-full pl-6.5 pr-2 py-1.5 rounded-md border border-input bg-background text-xs text-foreground placeholder:text-muted-foreground/60 focus:outline-none focus:ring-2 focus:ring-ring/30 focus:border-ring"})]})}),t.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin px-1.5 pb-1.5 min-h-0",children:I.length===0?t.jsx("div",{className:"px-2 py-3 text-[11px] text-muted-foreground/60",children:m.trim()?l("无匹配文件"):l("暂无变更文件")}):t.jsx(lc,{node:B,depth:0,activeKey:w,onSelect:M})}),t.jsxs("div",{className:"shrink-0 border-t border-border/60 max-h-[40%] flex flex-col min-h-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 shrink-0",children:[t.jsx(Is,{size:12,className:"text-muted-foreground"}),t.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:l("提交记录")})]}),t.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin min-h-0",children:t.jsx(Rv,{workingDir:e,selectedHash:C,onSelectCommit:L})})]})]})]})]})},zi=50,Zo={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function Tv(e){const r=Math.floor(Date.now()/1e3)-e;return r<60?gt("{count}s ago",{count:r}):r<3600?gt("{count}m ago",{count:Math.floor(r/60)}):r<86400?gt("{count}h ago",{count:Math.floor(r/3600)}):r<604800?gt("{count}d ago",{count:Math.floor(r/86400)}):new Date(e*1e3).toLocaleDateString()}function Mv(e){const s=e.split("/");return s[s.length-1]||e}function Dv(e){const s=e.lastIndexOf("/");return s>0?e.slice(0,s):""}const Pv=({line:e,lineNum:s})=>{let r="",o="text-foreground/90";return e.startsWith("+")&&!e.startsWith("+++")?r="bg-success/10":e.startsWith("-")&&!e.startsWith("---")?r="bg-destructive/10":e.startsWith("@@")?(r="bg-info/5",o="text-info"):(e.startsWith("diff ")||e.startsWith("index "))&&(o="text-muted-foreground/70"),t.jsxs("div",{className:se("flex",r),children:[t.jsx("span",{className:"w-10 shrink-0 text-right pr-2 text-muted-foreground/60 select-none border-r border-border/60",children:s}),t.jsx("span",{className:se("pl-2 whitespace-pre",o),children:e})]})},Lv=({workingDir:e,hash:s,filePath:r})=>{const{t:o}=ce(),{data:g,isLoading:p,isError:v}=Un(e,s,r);if(p)return t.jsxs("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:[t.jsx(Ke,{size:16,className:"animate-spin mr-2"}),t.jsx("span",{className:"text-xs",children:o("Loading diff...")})]});if(v)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive text-xs",children:o("Failed to load diff.")});const n=g?.diff||"";if(!n.trim())return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground/70 text-xs",children:o("No diff content available.")});const i=n.split(`
|
|
73
73
|
`);return t.jsx("div",{className:"flex-1 overflow-auto scrollbar-app-thin font-mono text-xs leading-5",children:i.map((l,d)=>t.jsx(Pv,{line:l,lineNum:d+1},d))})},Iv=({workingDir:e,hash:s,selectedPath:r,onSelectFile:o})=>{const{t:g}=ce(),{data:p,isLoading:v}=$n(e,s);if(v)return t.jsxs("div",{className:"pl-7 py-1 text-xs text-muted-foreground/70 flex items-center gap-1",children:[t.jsx(Ke,{size:12,className:"animate-spin"}),t.jsx("span",{children:g("Loading...")})]});const n=p?.files||[];return n.length===0?t.jsx("div",{className:"pl-7 py-1 text-xs text-muted-foreground/70",children:g("No files changed")}):t.jsx("div",{className:"pl-7 pb-1 space-y-0.5",children:n.map(i=>{const l=Zo[i.status]||Zo.M,d=Dv(i.path);return t.jsxs("button",{type:"button",onClick:c=>{c.stopPropagation(),o(i.path)},className:se("flex items-center gap-2 px-1.5 py-1 rounded-sm cursor-pointer w-full text-left",r===i.path?"bg-muted":"hover:bg-muted/60"),children:[t.jsx("span",{className:se("w-4 h-4 flex items-center justify-center text-[11px] font-semibold border rounded-sm shrink-0",l),children:i.status}),t.jsx("span",{className:"text-xs text-foreground truncate",children:Mv(i.path)}),d&&t.jsx("span",{className:"text-[11px] text-muted-foreground/70 truncate ml-auto shrink-0",children:d})]},i.path)})})},Ov=({workingDir:e})=>{const{t:s}=ce(),r=_s(E=>E.visibleContext),o=sf(e,r),{data:g,isLoading:p,isError:v,fetchNextPage:n,hasNextPage:i,isFetchingNextPage:l}=wn({queryKey:de.git.log(e||""),queryFn:({pageParam:E=0})=>Ce.get("/git/log",{params:{workingDir:e||"",limit:String(zi),skip:String(E)}}),initialPageParam:0,getNextPageParam:(E,_)=>E.commits.length<zi?void 0:_.length*zi,enabled:!!e,refetchInterval:o,refetchIntervalInBackground:!1,refetchOnWindowFocus:o?"always":!1,refetchOnReconnect:o?"always":!1}),d=g?.pages.flatMap(E=>E.commits)||[],[c,m]=S.useState(null),[x,w]=S.useState(null),[y,a]=S.useState(280),[h,u]=S.useState(!1),f=S.useCallback(E=>{E.preventDefault(),u(!0);const _=E.clientX,j=y,A=T=>{const D=Math.min(480,Math.max(180,j+(T.clientX-_)));a(D)},P=()=>{u(!1),document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",P)};document.addEventListener("mousemove",A),document.addEventListener("mouseup",P)},[y]),b=E=>{c===E?(m(null),w(null)):(m(E),w(null))},C=S.useRef(null);if(!e)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm bg-background h-full",children:s("No workspace selected.")});if(p)return t.jsxs("div",{className:"flex-1 flex items-center justify-center text-muted-foreground bg-background h-full",children:[t.jsx(Ke,{size:16,className:"animate-spin mr-2"}),t.jsx("span",{className:"text-sm",children:s("Loading history...")})]});if(v)return t.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive text-sm bg-background h-full",children:s("Failed to load history.")});if(d.length===0)return t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center py-12 text-muted-foreground/60 bg-background h-full",children:[t.jsx(Is,{size:28,className:"mb-2"}),t.jsx("span",{className:"text-xs",children:s("No commit history")})]});const k=d.find(E=>E.hash===c);return t.jsxs("div",{className:"flex h-full bg-background",style:h?{userSelect:"none",cursor:"col-resize"}:void 0,children:[t.jsxs("div",{className:"border-r border-border flex flex-col shrink-0",style:{width:y},children:[t.jsx("div",{className:"px-3 py-2.5 border-b border-border/60 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Is,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-xs font-semibold text-foreground",children:s("History")}),t.jsx("span",{className:"text-[11px] bg-muted px-1.5 py-0.5 rounded-full text-muted-foreground",children:d.length})]})}),t.jsxs("div",{ref:C,className:"flex-1 overflow-auto scrollbar-app-thin p-1.5",children:[d.map(E=>{const _=c===E.hash;return t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>b(E.hash),className:se("flex items-start gap-2 px-2 py-1.5 rounded-sm cursor-pointer w-full text-left group",_?"bg-muted":"hover:bg-muted/60"),children:[t.jsx("div",{className:"flex flex-col items-center shrink-0 pt-1",children:t.jsx("div",{className:se("w-2 h-2 rounded-full shrink-0 transition-colors",_?"bg-brand":"bg-border group-hover:bg-muted-foreground/60")})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"text-[11px] font-mono text-muted-foreground shrink-0",children:E.shortHash}),t.jsx("span",{className:"text-xs text-foreground truncate flex-1",children:E.message}),t.jsx(Mt,{size:12,className:se("shrink-0 text-muted-foreground/70 transition-transform",_&&"rotate-90")})]}),t.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:E.author}),t.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:Tv(E.timestamp)})]})]})]}),_&&t.jsxs(t.Fragment,{children:[E.body&&t.jsx("div",{className:"pl-7 pr-2 py-1.5 text-[11px] text-muted-foreground whitespace-pre-wrap leading-5 border-l-2 border-border ml-3",children:E.body}),t.jsx(Iv,{workingDir:e,hash:E.hash,selectedPath:x,onSelectFile:w})]})]},E.hash)}),i&&t.jsx("button",{type:"button",onClick:()=>n(),disabled:l,className:"w-full py-2 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/60 rounded-sm transition-colors flex items-center justify-center gap-1.5",children:l?t.jsxs(t.Fragment,{children:[t.jsx(Ke,{size:12,className:"animate-spin"})," ",s("Loading...")]}):s("Load more")})]})]}),t.jsx("div",{onMouseDown:f,className:se("w-1 shrink-0 cursor-col-resize transition-colors",h?"bg-info/60":"bg-transparent hover:bg-info/30")}),t.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:x&&c?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"px-3 py-2 border-b border-border/60 flex items-center gap-2 shrink-0",children:[t.jsx(Ur,{size:14,className:"text-muted-foreground"}),t.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:x}),t.jsxs("span",{className:"text-[11px] text-muted-foreground/70",children:["(",k?.shortHash,")"]})]}),t.jsx(Lv,{workingDir:e,hash:c,filePath:x})]}):t.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground/60",children:t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(Ur,{size:28}),t.jsx("span",{className:"text-xs",children:s(c?"Select a file to view diff":"Select a commit to view changes")})]})})})]})},Jo=dr();function Bv(e){if(!Jo)return e;try{const s=new URL(Jo);return new URL(e,s.origin).toString()}catch{return e}}function cc(e){return{...e,viewUrl:e.viewUrl?Bv(e.viewUrl):null}}function Fv(e){return Bt({queryKey:de.previews.status(e??""),queryFn:async()=>{const s=await Ce.get(`/previews/${e}/status`);return cc(s)},enabled:!!e,refetchOnWindowFocus:!1})}function zv(e){const s=bt();return Ft({mutationFn:async r=>{const o=await Ce.put(`/previews/${e}/config`,{target:r});return cc(o)},onSuccess:r=>{e&&(s.setQueryData(de.previews.status(e),r),s.invalidateQueries({queryKey:de.workspaces.all}))}})}function Wv(){return window.location.protocol==="https:"?"remote":"local"}function Hv(e,s){const[r,o]=S.useState(null),[g,p]=S.useState(!1),[v,n]=S.useState(null),[i,l]=S.useState(0);return S.useEffect(()=>{if(!e||!s?.ready||!s.target){o(null),p(!1),n(null);return}let d=!1,c=null,m=null;o(null);const x=y=>{Ce.delete(`/previews/${e}/sessions/${y}`).catch(()=>{})};return(async()=>{p(!0),n(null);try{const y={mode:Wv(),localHostname:window.location.hostname},a=await Ce.post(`/previews/${e}/sessions`,y);if(d){x(a.id);return}c=a.id,o(a),m=window.setInterval(async()=>{if(c)try{const h=await Ce.post(`/previews/${e}/sessions/${c}/heartbeat`);d||(o(h),n(null))}catch(h){!d&&h instanceof cn&&h.status===404?l(u=>u+1):d||n(h instanceof Error?h:new Error("Preview session heartbeat failed"))}},3e4)}catch(y){d||(o(null),n(y instanceof Error?y:new Error("Failed to open preview session")))}finally{d||p(!1)}})(),()=>{d=!0,m!==null&&window.clearInterval(m),c&&x(c)}},[i,s?.ready,s?.target,e]),{session:r,isOpening:g,error:v,retry:()=>l(d=>d+1)}}const $v="agent-tower-preview",Uv="agent-tower-preview-host";function qv(){return"3000, localhost:3000, http://127.0.0.1:5173"}function Kv(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function Xv(e){return t.jsx(Yv,{...e},e.workspaceId??"no-workspace")}function Yv({workspaceId:e,readOnly:s,navigationRequest:r,onNavigationRequestHandled:o}){const{t:g}=ce(),{data:p,isLoading:v,refetch:n,isFetching:i}=Fv(e),l=zv(e),{session:d,isOpening:c,error:m,retry:x}=Hv(e,p),w=S.useRef(null),y=S.useRef(null),a=S.useRef(null),h=S.useRef(null),u=S.useRef(null),f=S.useRef(null),[b,C]=S.useState(0),[k,E]=S.useState({target:null,address:"",iframeSrc:null,isFrameLoading:!1}),_=Kv(d?.viewUrl),j=p&&k.target!==p.target?{target:p.target,address:p.target??"",iframeSrc:null,isFrameLoading:!1}:p&&!p.ready&&k.iframeSrc?{...k,iframeSrc:null,isFrameLoading:!1}:k,A=S.useCallback(F=>{E(R=>({...p&&R.target!==p.target?{target:p.target,address:p.target??"",iframeSrc:null,isFrameLoading:!1}:R,...F}))},[p]);S.useEffect(()=>{if(!d||d.target!==p?.target)return;const F=u.current!==_;u.current=_,E(R=>{const M=r&&f.current!==r.id?Ar(r.url,d.target,d.viewUrl):null;if(!F&&R.iframeSrc&&R.target===d.target&&M?.kind!=="proxy")return R;let L=R.iframeSrc;if(M?.kind==="proxy")L=M.url;else if(!L||R.target!==d.target||F){const U=a.current;if(U)L=pd(d.viewUrl,U);else{const Y=Ar(R.address||d.target,d.target,d.viewUrl);L=Y?.kind==="proxy"?Y.url:d.viewUrl}}a.current=null;const O=h.current;return O&&!O.closed&&L&&O.location.replace(L),h.current=null,{target:d.target,address:M?.kind==="proxy"?r?.url??R.address:R.address||d.target,iframeSrc:L,isFrameLoading:!!L}})},[r,d,_,p?.target]),S.useEffect(()=>()=>{h.current?.close()},[]);const P=S.useCallback(async(F,R=!1)=>{const M=Ar(F,p?.target??null,d?.viewUrl??null);if(!M||!e)return;if(M.kind==="proxy"){if(R){window.open(M.url,"_blank","noopener,noreferrer");return}E({target:p?.target??null,address:F,iframeSrc:M.url,isFrameLoading:!0});return}if(s)return;const L=R?window.open("about:blank","_blank"):null;L&&(L.opener=null);try{a.current=M.path,h.current=L;const O=await l.mutateAsync(M.target);E({target:O.target,address:F.trim(),iframeSrc:null,isFrameLoading:!!O.ready}),C(U=>U+1),rt.success(g("Preview target saved")),O.ready||(h.current?.close(),h.current=null)}catch(O){h.current?.close(),h.current=null,a.current=null;const U=O instanceof Error?O.message:g("Failed to save preview target");rt.error(U)}},[d?.viewUrl,s,p?.target,g,l,e]);S.useEffect(()=>{if(!r||v||f.current===r.id)return;const F=window.setTimeout(()=>{f.current=r.id,o?.(r.id),P(r.url)},0);return()=>window.clearTimeout(F)},[v,P,r,o]),S.useEffect(()=>{const F=R=>{if(R.source!==w.current?.contentWindow)return;const M=R.data;if(!(!M||M.source!==$v)){if(M.type==="location"&&typeof M.href=="string"){const L=gd(p?.target??null,d?.viewUrl??null,M.href,window.location.href);L&&document.activeElement!==y.current&&A({target:p?.target??j.target,address:L,isFrameLoading:!1});return}M.type==="navigate-loopback"&&typeof M.href=="string"&&P(M.href,M.newTab===!0)}};return window.addEventListener("message",F),()=>window.removeEventListener("message",F)},[j.target,P,A,d?.viewUrl,p?.target]);const T=F=>{w.current?.contentWindow?.postMessage({source:Uv,action:F},"*")},D=F=>{F.preventDefault(),P(j.address)},W=async()=>{const F=await n();if(!F.data?.ready){A({target:F.data?.target??j.target,iframeSrc:null,isFrameLoading:!1});return}if(!d||!j.iframeSrc){x();return}A({isFrameLoading:!0}),T("reload")},I=()=>{if(!d?.viewUrl)return;const F=Ar(j.address||d.target,d.target,d.viewUrl),R=F?.kind==="proxy"?F.url:d.viewUrl;window.open(R,"_blank","noopener,noreferrer")};if(!e)return t.jsx("div",{className:"h-full flex items-center justify-center bg-white text-sm text-neutral-500",children:g("No active workspace.")});const B=v||i||l.isPending||c;return t.jsxs("div",{className:"h-full flex flex-col bg-white",children:[t.jsxs("div",{className:"shrink-0 border-b border-neutral-200 bg-neutral-50 px-2 py-2",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(Te,{type:"button",size:"icon-sm",variant:"ghost",onClick:()=>T("back"),disabled:!j.iframeSrc,title:g("Back"),"aria-label":g("Back"),children:t.jsx(Ls,{})}),t.jsx(Te,{type:"button",size:"icon-sm",variant:"ghost",onClick:()=>T("forward"),disabled:!j.iframeSrc,title:g("Forward"),"aria-label":g("Forward"),children:t.jsx(Ua,{})}),t.jsx(Te,{type:"button",size:"icon-sm",variant:"ghost",onClick:j.isFrameLoading?()=>{T("stop"),A({isFrameLoading:!1})}:W,disabled:!j.isFrameLoading&&i,title:j.isFrameLoading?g("Stop loading"):g("Refresh preview"),"aria-label":j.isFrameLoading?g("Stop loading"):g("Refresh preview"),children:j.isFrameLoading?t.jsx(Yt,{}):i?t.jsx(Ke,{className:"animate-spin"}):t.jsx(hr,{})}),t.jsxs("form",{className:"relative min-w-0 flex-1",onSubmit:D,children:[t.jsx(Hd,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-neutral-400"}),t.jsx("input",{ref:y,value:j.address,onChange:F=>A({address:F.target.value}),onKeyDown:F=>{F.key==="Enter"&&F.nativeEvent.isComposing&&F.preventDefault()},disabled:s||l.isPending,placeholder:qv(),"aria-label":g("Preview address"),className:"h-8 w-full min-w-0 rounded-md border border-neutral-200 bg-white pl-8 pr-2.5 text-xs text-neutral-800 outline-none transition-colors placeholder:text-neutral-400 focus:border-neutral-400 disabled:bg-neutral-100 disabled:text-neutral-400"})]}),t.jsx(Te,{type:"button",size:"icon-sm",variant:"ghost",onClick:I,disabled:!j.iframeSrc,title:g("Open preview in new tab"),"aria-label":g("Open preview in new tab"),children:t.jsx(ln,{})})]}),t.jsxs("div",{className:"mt-1 flex min-h-4 items-center justify-between gap-2 px-1 text-[11px] leading-4",children:[t.jsx("span",{className:"truncate text-neutral-500",children:B?g("Checking preview target..."):m?m.message:p?.ready?`${g("Proxying")} ${p.target}`:p?.configured?`${g("Preview target is not reachable")}${p.error?`: ${p.error}`:""}`:g("Enter a local preview URL on the Agent Tower machine.")}),t.jsx("span",{className:"shrink-0 text-neutral-400",children:g("Loopback only")})]})]}),t.jsx("div",{className:"relative flex-1 min-h-0 bg-white",children:j.iframeSrc?t.jsx("iframe",{ref:w,src:j.iframeSrc,title:g("Preview"),className:"absolute inset-0 h-full w-full border-0 bg-white",sandbox:"allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts",allow:"clipboard-read; clipboard-write; fullscreen",onLoad:()=>A({isFrameLoading:!1})},b):t.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-4 text-center text-sm text-neutral-500",children:p?.configured?p.ready&&c?g("Checking preview target..."):g("Start the preview server, then refresh."):g("Configure a local preview target to display it here.")})})]})}function Vv(e){switch(e){case At.ACTIVE:return"border-emerald-200 bg-emerald-50 text-emerald-700";case At.MERGED:return"border-blue-200 bg-blue-50 text-blue-700";case At.HIBERNATED:return"border-amber-200 bg-amber-50 text-amber-700";case At.ABANDONED:return"border-neutral-200 bg-neutral-50 text-neutral-500"}}function ea(e){switch(e){case"Main":return"border-indigo-200 bg-indigo-50 text-indigo-700";case"Child":return"border-cyan-200 bg-cyan-50 text-cyan-700";default:return"border-neutral-200 bg-neutral-50 text-neutral-600"}}function Gv(e){return e.length<=34?e:`...${e.slice(-31)}`}function dc({workspaces:e,teamRun:s,selectedWorkspaceId:r,onSelectWorkspace:o,disabled:g,className:p,buttonClassName:v}){const{t:n}=ce(),[i,l]=S.useState(!1),d=S.useRef(null),c=S.useMemo(()=>Bn(e,s),[e,s]),m=c.find(x=>x.workspace.id===r)??c[0];return S.useEffect(()=>{if(!i)return;const x=w=>{d.current&&!d.current.contains(w.target)&&l(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[i]),c.length<=1?null:t.jsxs("div",{ref:d,className:se("relative",p),children:[t.jsxs("button",{type:"button",onClick:()=>l(x=>!x),disabled:g,className:se("inline-flex h-8 max-w-[340px] items-center gap-2 rounded-md border border-neutral-200 bg-white px-2.5 text-left text-xs text-neutral-700 transition-colors hover:border-neutral-300 hover:bg-neutral-50 disabled:cursor-not-allowed disabled:opacity-50",v),title:n("Workspace"),children:[t.jsx(Ps,{size:14,className:"shrink-0 text-neutral-500"}),t.jsx("span",{className:se("shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-medium",ea(m.roleLabel)),children:n(m.roleLabel)}),t.jsx("span",{className:"min-w-0 truncate font-medium text-neutral-900",children:n(m.displayName)}),t.jsx("span",{className:"min-w-0 truncate font-mono text-[11px] text-neutral-500",children:Gv(Os(m.workspace))}),t.jsx(wt,{size:13,className:se("shrink-0 text-neutral-400 transition-transform",i&&"rotate-180")})]}),i&&t.jsx("div",{className:"absolute left-0 top-full z-50 mt-2 w-[420px] max-w-[calc(100vw-2rem)] rounded-lg border border-neutral-200 bg-white py-1.5 shadow-lg",children:c.map(x=>{const w=x.workspace.id===m.workspace.id;return t.jsxs("button",{type:"button",onClick:()=>{o(x.workspace.id),l(!1)},className:se("flex w-full items-start gap-2 px-3 py-2 text-left transition-colors hover:bg-neutral-50",w&&"bg-neutral-50"),children:[t.jsx("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-neutral-200 bg-white text-neutral-500",children:w?t.jsx(Vt,{size:13}):t.jsx(Da,{size:13})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("span",{className:"truncate text-xs font-medium text-neutral-900",children:n(x.displayName)}),t.jsx("span",{className:se("shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-medium",ea(x.roleLabel)),children:n(x.roleLabel)}),t.jsx("span",{className:se("shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-medium",Vv(x.workspace.status)),children:x.workspace.status})]}),t.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-neutral-500",children:Os(x.workspace)}),t.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[10px] text-neutral-400",children:[x.ownerName&&t.jsxs("span",{children:[n("Owner"),": ",x.ownerName]}),x.parentBranchName&&t.jsxs("span",{children:[n("Parent"),": ",x.parentBranchName]}),t.jsx("span",{children:x.workspace.id.slice(0,8)})]})]})]},x.workspace.id)})})]})}const Qv=[{key:"review",label:"Changes",icon:t.jsx(Fs,{size:14})},{key:"editor",label:"Editor",icon:t.jsx(ri,{size:14})},{key:"terminal",label:"Terminal",icon:t.jsx(Fr,{size:14})},{key:"preview",label:"Preview",icon:t.jsx(Ma,{size:14})}],Zv=[{key:"history",label:"History",icon:t.jsx(Is,{size:14})},{key:"editor",label:"Editor",icon:t.jsx(ri,{size:14})},{key:"terminal",label:"Terminal",icon:t.jsx(Fr,{size:14})},{key:"preview",label:"Preview",icon:t.jsx(Ma,{size:14})}],Jv=({active:e,onClick:s,icon:r,label:o})=>t.jsxs("button",{type:"button",onClick:s,className:se("flex shrink-0 items-center gap-2 px-4 py-2 text-xs font-medium transition-all rounded-t-md border-t border-x -mb-px whitespace-nowrap",e?"bg-white border-neutral-200 text-neutral-900 shadow-[0_-2px_6px_rgba(0,0,0,0.02)] z-10":"bg-transparent border-transparent text-neutral-500 hover:text-neutral-700 hover:bg-neutral-200/50"),children:[r,t.jsx("span",{children:o})]}),e0=({active:e,onClick:s,icon:r,label:o})=>t.jsx("button",{type:"button",onClick:s,title:o,"aria-label":o,"aria-pressed":e,className:se("flex h-9 w-9 items-center justify-center rounded-lg border text-muted-foreground transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",e?"border-neutral-900 bg-neutral-900 text-white shadow-sm":"border-transparent hover:border-border hover:bg-background hover:text-foreground"),children:r}),uc=ae.memo(function({className:s,sessionId:r,workspaceId:o,workingDir:g,projectId:p,hideChanges:v,gitAvailable:n=!0,readOnly:i,repoDeleted:l,teamRun:d,teamStatus:c,gitProps:m,workspaces:x,selectedWorkspaceId:w,onSelectWorkspace:y,variant:a="tabs",expanded:h,onExpandedChange:u,minContentWidth:f=520,tabRef:b,previewRequest:C,onPreviewRequestHandled:k}){const{t:E}=ce(),_=_s(G=>G.setVisibleContext),j=a==="rail",[A,P]=S.useState(!1),T=j?h??A:!0,D=S.useCallback(G=>{h===void 0&&P(G),u?.(G)},[h,u]),W=S.useMemo(()=>{const G=v?Zv:Qv,pe=n?G:G.filter(Ae=>Ae.key!=="review"&&Ae.key!=="history"),ie=i?pe.filter(Ae=>Ae.key!=="terminal"):pe;return d?[{key:"team-status",label:"Team Status",icon:t.jsx(vs,{size:14})},...ie]:ie},[n,v,i,d]),[I,B]=S.useState(()=>C?"preview":n?v?"history":"review":"editor"),F=S.useRef(null),R=S.useRef(0),[M,L]=S.useState(),O=S.useCallback(G=>{B(G),j&&D(!0)},[j,D]);S.useImperativeHandle(b,()=>({setTab:G=>O(G),openFile:(G,pe,ie)=>{O("editor"),requestAnimationFrame(()=>F.current?.openFile(G,pe,ie))},openPreview:(G,pe)=>{R.current+=1,L({id:R.current,url:G,workspaceId:pe}),O("preview")}}),[O]);const U=C??M,Y=U?.workspaceId&&U.workspaceId!==o?void 0:U,z=S.useCallback(G=>{L(pe=>pe?.id===G?void 0:pe),k?.(G)},[k]),{data:$}=jd(p??""),q=S.useMemo(()=>{if(!$?.quickCommands)return[];try{return JSON.parse($.quickCommands)}catch{return[]}},[$?.quickCommands]),[N,H]=S.useState([]),X=S.useRef(void 0);S.useEffect(()=>{g&&g!==X.current&&(X.current=g,H(G=>G.includes(g)?G:[...G,g]))},[g]),S.useEffect(()=>{W.some(G=>G.key===I)||B(W[0]?.key??"editor")},[I,W]),S.useEffect(()=>{if(j&&!T)return;const G=I==="review"?"changes":I==="history"?"history":null;if(!o||!g||!G){_(null);return}return _({workspaceId:o,workingDir:g,tab:G}),()=>{_(null)}},[I,T,j,_,g,o]);const K=!!y&&Bn(x,d).length>1,ne=W.find(G=>G.key===I)??W[0],te=ne?E(ne.label):"",he=i?t.jsx("div",{className:"mx-2 mt-2 rounded-lg border border-neutral-200 bg-neutral-50 px-3 py-2 text-xs text-neutral-500",children:E(l?"项目已删除且本地仓库文件已清理。这里只保留历史视图。":"项目已删除。Workspace 以只读模式展示历史内容。")}):null,le=t.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[K&&t.jsx("div",{className:"shrink-0 px-3 py-1.5 border-b border-neutral-100 bg-neutral-50/60",children:t.jsx(dc,{workspaces:x,teamRun:d,selectedWorkspaceId:w,onSelectWorkspace:y,buttonClassName:"h-7 text-[11px]"})}),t.jsxs("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[I==="team-status"&&d&&c,I==="editor"&&t.jsx(yv,{ref:F,workingDir:g,readOnly:i}),N.map(G=>{const pe=I==="terminal"&&g===G;return t.jsx("div",{"aria-hidden":!pe,className:"absolute inset-0 h-full w-full min-h-0 min-w-0 overflow-hidden",style:{display:pe?"block":"none"},children:t.jsx(Dm,{cwd:G,isVisible:pe,quickCommands:q})},G)}),I==="preview"&&t.jsx(Xv,{workspaceId:o,readOnly:i,navigationRequest:Y,onNavigationRequestHandled:z}),I==="review"&&t.jsx(Av,{workingDir:g,workspaceId:o,branchName:m?.branchName,targetBranch:m?.targetBranch,commitMessage:m?.commitMessage,canRunGitOperations:m?.canRunGitOperations,onRefreshCommitMessage:m?.onRefreshCommitMessage,onConflict:m?.onConflict,onResolveConflicts:m?.onResolveConflicts}),I==="history"&&t.jsx(Ov,{workingDir:g})]})]});return j?t.jsxs("div",{className:se("flex h-full w-full min-w-0 bg-white",s),children:[t.jsx("div",{className:"flex h-full w-12 shrink-0 flex-col items-center gap-1 border-l border-border bg-muted/35 px-1.5 py-2",children:W.map(G=>t.jsx(e0,{active:T&&I===G.key,onClick:()=>O(G.key),icon:G.icon,label:E(G.label)},G.key))}),T&&t.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col border-l border-border bg-background",style:{minWidth:f},children:[he,t.jsxs("div",{className:"flex h-10 shrink-0 items-center justify-between gap-3 border-b border-border bg-background px-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-sm font-semibold text-foreground",children:[t.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border bg-muted/35 text-muted-foreground",children:ne?.icon}),t.jsx("span",{className:"truncate",children:te})]}),t.jsx("button",{type:"button",onClick:()=>D(!1),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",title:E("收起"),"aria-label":E("收起"),children:t.jsx(nu,{size:15})})]}),le]})]}):t.jsxs("div",{className:se("flex h-full w-full min-w-0 flex-col bg-white",s),children:[i&&he,t.jsx("div",{className:"flex items-center overflow-x-auto scrollbar-app-thin px-2 pt-2 border-b border-neutral-200 bg-neutral-100/80 shrink-0 gap-1 select-none",children:W.map(G=>t.jsx(Jv,{active:I===G.key,onClick:()=>O(G.key),icon:G.icon,label:E(G.label)},G.key))}),le]})}),ta=1500,t0=3e3;function s0(e){const[s,r]=S.useState(null),o=S.useRef(0),g=S.useRef(null),p=S.useRef(null);return S.useEffect(()=>{if(!e)return;const v=()=>{p.current&&(clearTimeout(p.current),p.current=null)},n=Jt.connect(),i=d=>{r(d),p.current=setTimeout(()=>r(null),t0)},l=d=>{if(d.taskId!==e)return;const c={status:d.status,currentCommand:d.currentCommand,currentIndex:d.currentIndex,totalCommands:d.totalCommands,error:d.error};if(d.status==="running"){v(),g.current=null,o.current===0&&(o.current=Date.now()),r(c);return}const m=o.current>0?Date.now()-o.current:0,x=ta-m;o.current===0?(o.current=Date.now(),r({status:"running",totalCommands:d.totalCommands,currentIndex:d.totalCommands}),g.current=c,p.current=setTimeout(()=>i(c),ta)):x>0?(g.current=c,v(),p.current=setTimeout(()=>i(c),x)):i(c)};return n.on(ct.WORKSPACE_SETUP_PROGRESS,l),()=>{n.off(ct.WORKSPACE_SETUP_PROGRESS,l),v(),o.current=0,g.current=null}},[e]),s}function hc({isOpen:e,onClose:s,onStarted:r,taskId:o,projectId:g,taskTitle:p,taskDescription:v,taskPrompt:n,projectIsGitRepo:i=!0,projectWorktreeReady:l=!0,projectGitReason:d}){const{t:c}=ce(),[m,x]=S.useState(""),[w,y]=S.useState(""),[a,h]=S.useState(_t.WORKTREE),[u,f]=S.useState(null),[b,C]=S.useState("idle"),[k,E]=S.useState(null),_=bt(),j=gl(o),A=xn(),P=Nd(),{data:T,isLoading:D}=Bs(),W=u?.isGitRepo??i,I=u?.worktreeReady??l,B=u?.reason??d,F=W!==!1&&I!==!1;S.useEffect(()=>{if(!e||!T)return;const N=T.find(H=>H.availability.type!=="NOT_FOUND");N&&x(N.provider.id)},[e,T]),S.useEffect(()=>{if(e){const N=[p];v&&N.push(v),y(n?.trim()||N.join(`
|
|
74
74
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as U,r as o,p as de,j as e,X as se,S as K,_ as ue,g as Q,s as H,l as W,T as me,B as z,$ as xe,a0 as pe,t as _}from"./index-RYlllU6n.js";import{F as X,u as fe,a as he,b as ge,c as je}from"./use-projects-D_Sq7ahS.js";import{F as V,a as ve,b as be}from"./folder-picker-CioQjSzV.js";import{P as re,T as ye}from"./trash-2-BNiAEW-6.js";import{M as Y}from"./modal-ZYdX5Krr.js";import{S as Ne}from"./SettingsMasterDetail-BYB-1oyf.js";import"./chevron-right-CkcSaX8x.js";import"./circle-alert-ClX4sQ2K.js";import"./check-BVOtZt28.js";import"./arrow-left-CB4qTjQs.js";function Pe({value:t,onChange:y,repoPath:N,placeholder:k,disabled:a,disabledMessage:c}){const{t:d}=U(),[l,j]=o.useState(""),[h,n]=o.useState([]),[u,x]=o.useState(!1),[p,v]=o.useState(-1),b=o.useRef(null),E=o.useRef(null),R=o.useRef(void 0),q=o.useCallback(async s=>{if(a||!N||!s){n([]),x(!1);return}try{const i=await de.get("/filesystem/complete",{params:{basePath:N,prefix:s}});n(i.results),x(i.results.length>0),v(-1)}catch{n([]),x(!1)}},[a,N]);o.useEffect(()=>{if(clearTimeout(R.current),!l){n([]),x(!1);return}return R.current=setTimeout(()=>q(l),200),()=>clearTimeout(R.current)},[l,q]),o.useEffect(()=>{const s=i=>{E.current&&!E.current.contains(i.target)&&b.current&&!b.current.contains(i.target)&&x(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{if(a)return;const i=s.trim();!i||t.includes(i)||(y([...t,i]),j(""),x(!1),b.current?.focus())},S=s=>{a||y(t.filter((i,A)=>A!==s))},D=s=>{a||(s.type==="directory"?(j(s.path),b.current?.focus()):w(s.path))},M=(s,i)=>{a||(i.stopPropagation(),w(s.path.replace(/\/$/,"")))},F=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||a||(u&&h.length>0?s.key==="ArrowDown"?(s.preventDefault(),v(i=>Math.min(i+1,h.length-1))):s.key==="ArrowUp"?(s.preventDefault(),v(i=>Math.max(i-1,-1))):s.key==="Enter"?(s.preventDefault(),p>=0?D(h[p]):w(l)):s.key==="Escape"&&x(!1):s.key==="Enter"&&(s.preventDefault(),w(l)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((s,i)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>S(i),disabled:a,className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0 disabled:cursor-not-allowed disabled:hover:text-neutral-300",children:e.jsx(se,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:b,type:"text",value:l,onChange:s=>j(s.target.value),onKeyDown:F,onFocus:()=>{l&&h.length>0&&x(!0)},placeholder:k??d("输入文件路径..."),disabled:a,className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300 disabled:cursor-not-allowed disabled:bg-neutral-50 disabled:text-neutral-400"}),e.jsxs("button",{onClick:()=>w(l),disabled:a||!l.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(re,{size:14}),e.jsx("span",{children:d("添加")})]})]}),u&&e.jsx("div",{ref:E,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:h.map((s,i)=>e.jsxs("button",{onClick:()=>D(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${i===p?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:A=>M(s,A),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:d("添加此目录"),children:e.jsx(ve,{size:14})})]},s.path))})]}),a&&c&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c})]})}function ke({value:t,onChange:y}){const{t:N}=U(),[k,a]=o.useState(""),[c,d]=o.useState(""),l=()=>{const n=k.trim(),u=c.trim();!n||!u||(y([...t,{name:n,command:u}]),a(""),d(""))},j=n=>{y(t.filter((u,x)=>x!==n))},h=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),l())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((n,u)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:n.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:n.command}),e.jsx("button",{onClick:()=>j(u),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(se,{size:14})})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:k,onChange:n=>a(n.target.value),onKeyDown:h,placeholder:N("名称"),className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:c,onChange:n=>d(n.target.value),onKeyDown:h,placeholder:N("命令"),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:l,disabled:!k.trim()||!c.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(re,{size:14}),e.jsx("span",{children:N("添加")})]})]})]})}function Z(t){return t?t.split(",").map(y=>y.trim()).filter(Boolean):[]}function ee(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function te(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function qe(){const{t}=U(),{data:y,isLoading:N}=fe({limit:100,includeArchived:!0}),k=he(),a=ge(),c=je(),[d,l]=o.useState(""),[j,h]=o.useState(null),[n,u]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[x,p]=o.useState(!1),[v,b]=o.useState(null),[E,R]=o.useState(!1),[q,w]=o.useState(!1),[S,D]=o.useState(!1),[M,F]=o.useState(!1),[s,i]=o.useState(""),[A,$]=o.useState(!1),C=y?.data??[],g=o.useMemo(()=>C.filter(r=>!r.archivedAt),[C]),I=o.useMemo(()=>C.filter(r=>r.archivedAt),[C]),f=g.find(r=>r.id===d),T=o.useMemo(()=>C.find(r=>r.id===v)??null,[v,C]);if(o.useEffect(()=>{!d&&g.length>0&&l(g[0].id)},[g,d]),o.useEffect(()=>{if(j){g.some(r=>r.id===j)&&(l(j),h(null));return}d&&!g.some(r=>r.id===d)&&(l(g[0]?.id??""),p(!1))},[g,j,d]),o.useEffect(()=>{f&&!x&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)})},[f,x]),N)return e.jsx(K,{className:"max-w-5xl",children:e.jsx(ue,{})});if(C.length===0)return e.jsxs(K,{className:"max-w-5xl",children:[e.jsx(Q,{title:t("项目配置")}),e.jsx(H,{message:t("暂无项目,请先创建项目")})]});const ne=()=>{d&&k.mutate({id:d,copyFiles:n.copyFiles.length>0?n.copyFiles.join(", "):null,setupScript:n.setupScript.trim()||null,quickCommands:n.quickCommands.length>0?JSON.stringify(n.quickCommands):null},{onSuccess:()=>p(!1)})},oe=r=>{h(null),l(r),p(!1),$(!0)},ae=()=>{f&&(b(f.id),D(!1),F(!1),R(!0))},O=()=>{a.isPending||(R(!1),b(null),D(!1),F(!1))},ie=async()=>{if(v)try{await a.mutateAsync({id:v,deleteRepo:S}),_.success(t(S?"项目已删除,并清理了本地文件":"项目已删除")),p(!1),O()}catch{}},le=r=>{const m=I.find(P=>P.id===r);b(r),i(m?.repoDeletedAt?m.repoPath:""),w(!0)},L=()=>{c.isPending||(w(!1),b(null),i(""))},ce=async()=>{if(!(!v||T?.repoDeletedAt&&!s.trim()))try{const m=await c.mutateAsync({id:v,repoPath:s.trim()||void 0});_.success(t("项目已恢复"));for(const P of m.warnings)_.warning(P);p(!1),h(m.project.id),l(m.project.id),L()}catch{}},J=T?.name??t("this project"),G=!!T?.repoDeletedAt,B=f?.isGitRepo!==!1&&f?.worktreeReady!==!1;return e.jsxs(e.Fragment,{children:[e.jsxs(K,{className:"max-w-5xl",children:[e.jsx(Q,{title:t("项目配置")}),g.length===0&&I.length===0?e.jsx(H,{message:t("暂无项目,请先创建项目")}):e.jsx(Ne,{items:g,selectedId:d,onSelectItem:oe,getItemId:r=>r.id,mobileShowDetail:A,onMobileBack:()=>$(!1),renderListItem:(r,m)=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:W("h-2 w-2 rounded-full shrink-0",m?"bg-primary-foreground/60":te(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:W("truncate text-[11px] font-mono",m?"text-primary-foreground/70":"text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:I.length>0?()=>e.jsxs("div",{className:"pt-3 mt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 mb-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t("已删除")}),e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:I.length})]}),I.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>le(r.id),disabled:c.isPending,className:"shrink-0 text-[11px] hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","aria-label":t("恢复项目"),children:e.jsx(pe,{size:12})})]},r.id))]}):void 0,renderDetail:r=>r?e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:W("h-2.5 w-2.5 rounded-full shrink-0",te(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isGitRepo===!1&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:t("Local project")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),r.isGitRepo===!1&&e.jsx("div",{className:"mb-5 rounded-lg border border-info/25 bg-info/8 px-3 py-2 text-xs leading-relaxed text-info/90",children:t("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun.")}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsxs("div",{className:"py-5 first:pt-0",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("自动复制文件")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 时自动从主仓库复制的文件或目录,适用于 .env、node_modules 等不在 git 管理中的文件。支持 glob。")})]}),e.jsx(Pe,{value:n.copyFiles,onChange:m=>{u(P=>({...P,copyFiles:m})),p(!0)},repoPath:r.repoPath,disabled:!B,disabledMessage:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:m=>{u(P=>({...P,setupScript:m.target.value})),p(!0)},placeholder:`pnpm install
|
|
1
|
+
import{u as U,r as o,p as de,j as e,X as se,S as K,_ as ue,g as Q,s as H,l as W,T as me,B as z,$ as xe,a0 as pe,t as _}from"./index-D9kBRMR0.js";import{F as X,u as fe,a as he,b as ge,c as je}from"./use-projects-Cuv0A0RC.js";import{F as V,a as ve,b as be}from"./folder-picker-WUhXxIM5.js";import{P as re,T as ye}from"./trash-2-R46i6Uus.js";import{M as Y}from"./modal-Cymk-6Df.js";import{S as Ne}from"./SettingsMasterDetail-DTGIIGdI.js";import"./chevron-right-pH923eYp.js";import"./circle-alert-oa-BQ5e7.js";import"./check-BN_PVKzE.js";import"./arrow-left-CCWDjOmp.js";function Pe({value:t,onChange:y,repoPath:N,placeholder:k,disabled:a,disabledMessage:c}){const{t:d}=U(),[l,j]=o.useState(""),[h,n]=o.useState([]),[u,x]=o.useState(!1),[p,v]=o.useState(-1),b=o.useRef(null),E=o.useRef(null),R=o.useRef(void 0),q=o.useCallback(async s=>{if(a||!N||!s){n([]),x(!1);return}try{const i=await de.get("/filesystem/complete",{params:{basePath:N,prefix:s}});n(i.results),x(i.results.length>0),v(-1)}catch{n([]),x(!1)}},[a,N]);o.useEffect(()=>{if(clearTimeout(R.current),!l){n([]),x(!1);return}return R.current=setTimeout(()=>q(l),200),()=>clearTimeout(R.current)},[l,q]),o.useEffect(()=>{const s=i=>{E.current&&!E.current.contains(i.target)&&b.current&&!b.current.contains(i.target)&&x(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{if(a)return;const i=s.trim();!i||t.includes(i)||(y([...t,i]),j(""),x(!1),b.current?.focus())},S=s=>{a||y(t.filter((i,A)=>A!==s))},D=s=>{a||(s.type==="directory"?(j(s.path),b.current?.focus()):w(s.path))},M=(s,i)=>{a||(i.stopPropagation(),w(s.path.replace(/\/$/,"")))},F=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||a||(u&&h.length>0?s.key==="ArrowDown"?(s.preventDefault(),v(i=>Math.min(i+1,h.length-1))):s.key==="ArrowUp"?(s.preventDefault(),v(i=>Math.max(i-1,-1))):s.key==="Enter"?(s.preventDefault(),p>=0?D(h[p]):w(l)):s.key==="Escape"&&x(!1):s.key==="Enter"&&(s.preventDefault(),w(l)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((s,i)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>S(i),disabled:a,className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0 disabled:cursor-not-allowed disabled:hover:text-neutral-300",children:e.jsx(se,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:b,type:"text",value:l,onChange:s=>j(s.target.value),onKeyDown:F,onFocus:()=>{l&&h.length>0&&x(!0)},placeholder:k??d("输入文件路径..."),disabled:a,className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300 disabled:cursor-not-allowed disabled:bg-neutral-50 disabled:text-neutral-400"}),e.jsxs("button",{onClick:()=>w(l),disabled:a||!l.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(re,{size:14}),e.jsx("span",{children:d("添加")})]})]}),u&&e.jsx("div",{ref:E,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:h.map((s,i)=>e.jsxs("button",{onClick:()=>D(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${i===p?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:A=>M(s,A),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:d("添加此目录"),children:e.jsx(ve,{size:14})})]},s.path))})]}),a&&c&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c})]})}function ke({value:t,onChange:y}){const{t:N}=U(),[k,a]=o.useState(""),[c,d]=o.useState(""),l=()=>{const n=k.trim(),u=c.trim();!n||!u||(y([...t,{name:n,command:u}]),a(""),d(""))},j=n=>{y(t.filter((u,x)=>x!==n))},h=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),l())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((n,u)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:n.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:n.command}),e.jsx("button",{onClick:()=>j(u),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(se,{size:14})})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:k,onChange:n=>a(n.target.value),onKeyDown:h,placeholder:N("名称"),className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:c,onChange:n=>d(n.target.value),onKeyDown:h,placeholder:N("命令"),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:l,disabled:!k.trim()||!c.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(re,{size:14}),e.jsx("span",{children:N("添加")})]})]})]})}function Z(t){return t?t.split(",").map(y=>y.trim()).filter(Boolean):[]}function ee(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function te(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function qe(){const{t}=U(),{data:y,isLoading:N}=fe({limit:100,includeArchived:!0}),k=he(),a=ge(),c=je(),[d,l]=o.useState(""),[j,h]=o.useState(null),[n,u]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[x,p]=o.useState(!1),[v,b]=o.useState(null),[E,R]=o.useState(!1),[q,w]=o.useState(!1),[S,D]=o.useState(!1),[M,F]=o.useState(!1),[s,i]=o.useState(""),[A,$]=o.useState(!1),C=y?.data??[],g=o.useMemo(()=>C.filter(r=>!r.archivedAt),[C]),I=o.useMemo(()=>C.filter(r=>r.archivedAt),[C]),f=g.find(r=>r.id===d),T=o.useMemo(()=>C.find(r=>r.id===v)??null,[v,C]);if(o.useEffect(()=>{!d&&g.length>0&&l(g[0].id)},[g,d]),o.useEffect(()=>{if(j){g.some(r=>r.id===j)&&(l(j),h(null));return}d&&!g.some(r=>r.id===d)&&(l(g[0]?.id??""),p(!1))},[g,j,d]),o.useEffect(()=>{f&&!x&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)})},[f,x]),N)return e.jsx(K,{className:"max-w-5xl",children:e.jsx(ue,{})});if(C.length===0)return e.jsxs(K,{className:"max-w-5xl",children:[e.jsx(Q,{title:t("项目配置")}),e.jsx(H,{message:t("暂无项目,请先创建项目")})]});const ne=()=>{d&&k.mutate({id:d,copyFiles:n.copyFiles.length>0?n.copyFiles.join(", "):null,setupScript:n.setupScript.trim()||null,quickCommands:n.quickCommands.length>0?JSON.stringify(n.quickCommands):null},{onSuccess:()=>p(!1)})},oe=r=>{h(null),l(r),p(!1),$(!0)},ae=()=>{f&&(b(f.id),D(!1),F(!1),R(!0))},O=()=>{a.isPending||(R(!1),b(null),D(!1),F(!1))},ie=async()=>{if(v)try{await a.mutateAsync({id:v,deleteRepo:S}),_.success(t(S?"项目已删除,并清理了本地文件":"项目已删除")),p(!1),O()}catch{}},le=r=>{const m=I.find(P=>P.id===r);b(r),i(m?.repoDeletedAt?m.repoPath:""),w(!0)},L=()=>{c.isPending||(w(!1),b(null),i(""))},ce=async()=>{if(!(!v||T?.repoDeletedAt&&!s.trim()))try{const m=await c.mutateAsync({id:v,repoPath:s.trim()||void 0});_.success(t("项目已恢复"));for(const P of m.warnings)_.warning(P);p(!1),h(m.project.id),l(m.project.id),L()}catch{}},J=T?.name??t("this project"),G=!!T?.repoDeletedAt,B=f?.isGitRepo!==!1&&f?.worktreeReady!==!1;return e.jsxs(e.Fragment,{children:[e.jsxs(K,{className:"max-w-5xl",children:[e.jsx(Q,{title:t("项目配置")}),g.length===0&&I.length===0?e.jsx(H,{message:t("暂无项目,请先创建项目")}):e.jsx(Ne,{items:g,selectedId:d,onSelectItem:oe,getItemId:r=>r.id,mobileShowDetail:A,onMobileBack:()=>$(!1),renderListItem:(r,m)=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:W("h-2 w-2 rounded-full shrink-0",m?"bg-primary-foreground/60":te(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:W("truncate text-[11px] font-mono",m?"text-primary-foreground/70":"text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:I.length>0?()=>e.jsxs("div",{className:"pt-3 mt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 mb-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t("已删除")}),e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:I.length})]}),I.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>le(r.id),disabled:c.isPending,className:"shrink-0 text-[11px] hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","aria-label":t("恢复项目"),children:e.jsx(pe,{size:12})})]},r.id))]}):void 0,renderDetail:r=>r?e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:W("h-2.5 w-2.5 rounded-full shrink-0",te(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isGitRepo===!1&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:t("Local project")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),r.isGitRepo===!1&&e.jsx("div",{className:"mb-5 rounded-lg border border-info/25 bg-info/8 px-3 py-2 text-xs leading-relaxed text-info/90",children:t("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun.")}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsxs("div",{className:"py-5 first:pt-0",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("自动复制文件")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 时自动从主仓库复制的文件或目录,适用于 .env、node_modules 等不在 git 管理中的文件。支持 glob。")})]}),e.jsx(Pe,{value:n.copyFiles,onChange:m=>{u(P=>({...P,copyFiles:m})),p(!0)},repoPath:r.repoPath,disabled:!B,disabledMessage:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:m=>{u(P=>({...P,setupScript:m.target.value})),p(!0)},placeholder:`pnpm install
|
|
2
2
|
pnpm run setup`,rows:4,disabled:!B,className:"w-full rounded-lg border border-input bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-none disabled:cursor-not-allowed disabled:opacity-50"}),!B&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("常用命令")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("在终端中可快速执行的命令,不会自动运行。")})]}),e.jsx(ke,{value:n.quickCommands,onChange:m=>{u(P=>({...P,quickCommands:m})),p(!0)}})]})]}),e.jsx("div",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/10 p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(me,{size:15,className:"text-destructive mt-0.5 shrink-0","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:t("删除项目")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("项目将从默认列表隐藏,历史记录保留。可选同时删除本地文件。")})]})]}),e.jsxs(z,{size:"sm",variant:"destructive",className:"shrink-0",onClick:ae,disabled:a.isPending||c.isPending,children:[e.jsx(ye,{size:13}),t("删除项目")]})]})}),x&&e.jsx(xe,{saving:k.isPending,onSave:ne,onCancel:()=>{f&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)}),p(!1)},className:"-mx-5"})]}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:g.length>0?t("选择一个项目查看配置"):t("当前没有可配置的项目")})})]}),e.jsx(Y,{isOpen:E,onClose:O,title:t("Delete Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"outline",onClick:O,disabled:a.isPending,children:t("Cancel")}),e.jsx(z,{variant:"destructive",onClick:ie,disabled:a.isPending||S&&!M,children:a.isPending?t("Deleting..."):t("Delete Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t("项目「{title}」将从默认项目列表隐藏,但历史任务、workspace 和会话记录仍会保留。",{title:J})}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted px-3 py-3",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:r=>{D(r.target.checked),r.target.checked||F(!1)},className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t("同时删除本地项目文件")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("勾选后会删除项目路径指向的本地目录,并禁用代码/Git 相关能力。")})]})]}),S&&e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:t("勾选后会连项目文件一起删除,请谨慎选择。")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("恢复该项目时需要重新绑定一个有效的项目路径。")}),e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-xs text-foreground",children:[e.jsx("input",{type:"checkbox",checked:M,onChange:r=>F(r.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsx("span",{children:t("我已确认这会删除本地项目文件")})]})]}),a.isError&&e.jsx("p",{className:"text-xs text-destructive",children:a.error instanceof Error?a.error.message:t("Failed to delete project")})]})}),e.jsx(Y,{isOpen:q,onClose:L,title:t("Restore Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"outline",onClick:L,disabled:c.isPending,children:t("Cancel")}),e.jsx(z,{onClick:ce,disabled:c.isPending||G&&!s.trim(),children:c.isPending?t("Restoring..."):t("Restore Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:G?t("项目「{title}」的本地项目文件已删除。恢复前需要重新绑定一个有效的项目路径。",{title:J}):t("恢复后,项目会重新出现在默认项目列表中。")}),G&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1.5",children:t("Project Path")}),e.jsx(be,{value:s,onChange:i,validationMode:"directory"}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("Agent Tower 会尽量校验项目 identity;如果 remote URL 或目录名不同,会给出警告但允许继续。")})]}),c.isError&&e.jsx("p",{className:"text-xs text-destructive",children:c.error instanceof Error?c.error.message:t("Failed to restore project")})]})})]})}export{qe as ProjectSettingsPage};
|