@ironmussa/funny 0.1.0 → 0.1.2
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 +231 -214
- package/bin/funny.js +80 -80
- package/package.json +79 -59
- package/packages/client/dist/assets/AddProjectView-yopCTuKC.js +1 -0
- package/packages/client/dist/assets/AllThreadsView-vCQJYKkF.js +2 -0
- package/packages/client/dist/assets/AnalyticsView-vz1-NSOv.js +36 -0
- package/packages/client/dist/assets/App-BEFplUGa.js +2 -0
- package/packages/client/dist/assets/AutomationInboxView-Dj7f9gOu.js +1 -0
- package/packages/client/dist/assets/CircuitBreakerDialog-C76CZi4q.js +1 -0
- package/packages/client/dist/assets/CommandPalette-7Y8qqH7R.js +1 -0
- package/packages/client/dist/assets/LiveColumnsView-CSRiYBNg.js +1 -0
- package/packages/client/dist/assets/LoginPage-C61IUXzX.js +1 -0
- package/packages/client/dist/assets/MobilePage-B4kbWfE1.js +1 -0
- package/packages/client/dist/assets/MonacoEditorDialog-PPXTSIdX.js +1 -0
- package/packages/client/dist/assets/PreviewBrowser-Bo2zmDPh.js +2 -0
- package/packages/client/dist/assets/PromptInput-Cq_fXmwj.js +1 -0
- package/packages/client/dist/assets/ReviewPane-1r1cuH2I.js +10 -0
- package/packages/client/dist/assets/SettingsDetailView-D-J9TfZx.js +1 -0
- package/packages/client/dist/assets/SetupWizard-BbLWm6BX.js +1 -0
- package/packages/client/dist/assets/Sidebar-3Jd5JyAp.js +1 -0
- package/packages/client/dist/assets/SlideUpPrompt-_ulHi9sN.js +1 -0
- package/packages/client/dist/assets/TerminalPanel-BiLDlQZQ.js +4 -0
- package/packages/client/dist/assets/ThreadListView-DthHUodE.js +1 -0
- package/packages/client/dist/assets/ThreadView-DsqoxCXZ.js +16 -0
- package/packages/client/dist/assets/ToolCallGroup-BgROpRwn.js +22 -0
- package/packages/client/dist/assets/_basePickBy-BeHeP2rS.js +1 -0
- package/packages/client/dist/assets/_baseUniq-CZf5jOXa.js +1 -0
- package/packages/client/dist/assets/ansi_to_html-DYje8R53.js +3 -0
- package/packages/client/dist/assets/app-store-B3iAaYzj.js +1 -0
- package/packages/client/dist/assets/architectureDiagram-VXUJARFQ-CysgSV_T.js +36 -0
- package/packages/client/dist/assets/arrow-down-DQYiOM3D.js +1 -0
- package/packages/client/dist/assets/arrow-right-Bbusk4uX.js +1 -0
- package/packages/client/dist/assets/automation-store-DiFgwQi4.js +1 -0
- package/packages/client/dist/assets/badge-CrCqde50.js +1 -0
- package/packages/client/dist/assets/blockDiagram-VD42YOAC-DU32EjW8.js +122 -0
- package/packages/client/dist/assets/breadcrumb-BiY69_Mg.js +1 -0
- package/packages/client/dist/assets/button-D8qrc3hb.js +1 -0
- package/packages/client/dist/assets/c4Diagram-YG6GDRKO-D31N17G_.js +10 -0
- package/packages/client/dist/assets/check-Dj_ZR5Y7.js +1 -0
- package/packages/client/dist/assets/chevron-down-BJhJsMnL.js +1 -0
- package/packages/client/dist/assets/chevron-left-BVsM9RGq.js +1 -0
- package/packages/client/dist/assets/chevron-right-PEOnBrxM.js +1 -0
- package/packages/client/dist/assets/chevrons-up-down-Sa8XJRBx.js +1 -0
- package/packages/client/dist/assets/chunk-4BX2VUAB-CSqlINSL.js +1 -0
- package/packages/client/dist/assets/chunk-55IACEB6-D5_ai8AA.js +1 -0
- package/packages/client/dist/assets/chunk-B4BG7PRW-DKOAlNfo.js +165 -0
- package/packages/client/dist/assets/chunk-DI55MBZ5-BNwqKgG-.js +220 -0
- package/packages/client/dist/assets/chunk-FMBD7UC4-MKWtG46g.js +15 -0
- package/packages/client/dist/assets/chunk-QN33PNHL-BWGv-iLk.js +1 -0
- package/packages/client/dist/assets/chunk-QZHKN3VN-Brx07f_u.js +1 -0
- package/packages/client/dist/assets/chunk-TZMSLE5B-Cgz2v9ud.js +1 -0
- package/packages/client/dist/assets/circle-x-BNvrcCvx.js +1 -0
- package/packages/client/dist/assets/classDiagram-2ON5EDUG-Bi8VPWgp.js +1 -0
- package/packages/client/dist/assets/classDiagram-v2-WZHVMYZB-Bi8VPWgp.js +1 -0
- package/packages/client/dist/assets/clipboard-list-zkC7qTDO.js +1 -0
- package/packages/client/dist/assets/clone-CzE9L7Ig.js +1 -0
- package/packages/client/dist/assets/collapsible-DP3s_8s3.js +1 -0
- package/packages/client/dist/assets/columns-3-DhvlrNjA.js +1 -0
- package/packages/client/dist/assets/command-DOlrnbnh.js +1 -0
- package/packages/client/dist/assets/copy-DXKK6zMx.js +1 -0
- package/packages/client/dist/assets/cose-bilkent-S5V4N54A-DabFXskf.js +1 -0
- package/packages/client/dist/assets/createLucideIcon-CsWFljth.js +1 -0
- package/packages/client/dist/assets/cytoscape.esm-5J0xJHOV.js +321 -0
- package/packages/client/dist/assets/dagre-6UL2VRFP-BgQrFrWh.js +4 -0
- package/packages/client/dist/assets/diagram-PSM6KHXK-B0rQdwLC.js +24 -0
- package/packages/client/dist/assets/diagram-QEK2KX5R-aX13lt6A.js +43 -0
- package/packages/client/dist/assets/diagram-S2PKOQOG-cgHvdjCm.js +24 -0
- package/packages/client/dist/assets/dialog-DapeOKPE.js +1 -0
- package/packages/client/dist/assets/draft-store-DnVbStYY.js +1 -0
- package/packages/client/dist/assets/dropdown-menu-Bi54WPTK.js +1 -0
- package/packages/client/dist/assets/editor-utils-DgK9pIvP.js +2 -0
- package/packages/client/dist/assets/erDiagram-Q2GNP2WA-DwocRLhB.js +60 -0
- package/packages/client/dist/assets/external-link-Dg0Hq511.js +1 -0
- package/packages/client/dist/assets/eye-BAXsQYWt.js +1 -0
- package/packages/client/dist/assets/eye-off-ICXVwkI1.js +1 -0
- package/packages/client/dist/assets/flowDiagram-NV44I4VS-C0ldc02M.js +162 -0
- package/packages/client/dist/assets/folder-d8RRIu-j.js +1 -0
- package/packages/client/dist/assets/folder-open-BbwqJxUi.js +1 -0
- package/packages/client/dist/assets/ganttDiagram-JELNMOA3-DxdfUar4.js +267 -0
- package/packages/client/dist/assets/git-merge-CB0ebeXg.js +1 -0
- package/packages/client/dist/assets/gitGraphDiagram-V2S2FVAM-uM_Ec7JF.js +65 -0
- package/packages/client/dist/assets/github-DiENtmNz.js +1 -0
- package/packages/client/dist/assets/globe-B1hiCqlb.js +1 -0
- package/packages/client/dist/assets/graph-Qo1vygVG.js +1 -0
- package/packages/client/dist/assets/history-D7cvrs7x.js +1 -0
- package/packages/client/dist/assets/inbox-4g-W9WtW.js +1 -0
- package/packages/client/dist/assets/index-BplxL2Qj.js +1 -0
- package/packages/client/dist/assets/index-DmIp58b6.js +1 -0
- package/packages/client/dist/assets/index-Z_QI94Zg.js +18 -0
- package/packages/client/dist/assets/{index-B0nLATLY.js → index-cSW024sc.js} +1 -1
- package/packages/client/dist/assets/index-zxpgGDAW.css +1 -0
- package/packages/client/dist/assets/infoDiagram-HS3SLOUP-C-koF35b.js +2 -0
- package/packages/client/dist/assets/input-Dyxe5hqI.js +1 -0
- package/packages/client/dist/assets/internal-editor-store-CuhCMFlj.js +1 -0
- package/packages/client/dist/assets/journeyDiagram-XKPGCS4Q-DRqupubT.js +139 -0
- package/packages/client/dist/assets/kanban-definition-3W4ZIXB7-BvWguxdE.js +89 -0
- package/packages/client/dist/assets/katex-DhXJpUyf.js +261 -0
- package/packages/client/dist/assets/layout-UD4laNpY.js +1 -0
- package/packages/client/dist/assets/markdown-9_JKOUHQ.js +29 -0
- package/packages/client/dist/assets/maximize-2-DW-IsQiI.js +1 -0
- package/packages/client/dist/assets/mermaid-C0IQv4mH.js +250 -0
- package/packages/client/dist/assets/mindmap-definition-VGOIOE7T-C0fzBd6g.js +68 -0
- package/packages/client/dist/assets/minimize-2-CWn5BNKr.js +1 -0
- package/packages/client/dist/assets/monaco-CvC2RZDL.js +11 -0
- package/packages/client/dist/assets/{motion-DRu4QWVj.js → motion-Cyp39Uo1.js} +1 -1
- package/packages/client/dist/assets/pencil-pMey300q.js +1 -0
- package/packages/client/dist/assets/pieDiagram-ADFJNKIX-CUBE4hL3.js +30 -0
- package/packages/client/dist/assets/pin-off-DpiyTpTd.js +1 -0
- package/packages/client/dist/assets/pin-uzq68OVB.js +1 -0
- package/packages/client/dist/assets/plus-ChfperZy.js +1 -0
- package/packages/client/dist/assets/popover-CRZjc4jI.js +1 -0
- package/packages/client/dist/assets/project-chip-CkL3EaeE.js +5 -0
- package/packages/client/dist/assets/providers-Bv7fzJNY.js +1 -0
- package/packages/client/dist/assets/quadrantDiagram-AYHSOK5B-DF7I9OHz.js +7 -0
- package/packages/client/dist/assets/refresh-cw-Svvcff2v.js +1 -0
- package/packages/client/dist/assets/requirementDiagram-UZGBJVZJ-BBI4q-3_.js +64 -0
- package/packages/client/dist/assets/review-pane-store-CrK1Czq6.js +1 -0
- package/packages/client/dist/assets/rotate-ccw-DFiWNcpH.js +1 -0
- package/packages/client/dist/assets/sankeyDiagram-TZEHDZUN-lqpKxyZi.js +10 -0
- package/packages/client/dist/assets/scroll-area-Bj4yTRJP.js +1 -0
- package/packages/client/dist/assets/search-JGV9EPmW.js +1 -0
- package/packages/client/dist/assets/select-CkTnmILP.js +1 -0
- package/packages/client/dist/assets/sequenceDiagram-WL72ISMW-DHImpRwJ.js +145 -0
- package/packages/client/dist/assets/shallow-B0DA4RsP.js +1 -0
- package/packages/client/dist/assets/square-BqmNpRIH.js +1 -0
- package/packages/client/dist/assets/stateDiagram-FKZM4ZOC-C7L7Pt_V.js +1 -0
- package/packages/client/dist/assets/stateDiagram-v2-4FDKWEC3-FyYG2QfD.js +1 -0
- package/packages/client/dist/assets/{syntax-qKqB8BhQ.js → syntax-CG1UoaFw.js} +17 -17
- package/packages/client/dist/assets/terminal-CuAYwdh-.js +1 -0
- package/packages/client/dist/assets/timeline-definition-IT6M3QCI-BGABo1HM.js +61 -0
- package/packages/client/dist/assets/trash-2-QvY6JeI_.js +1 -0
- package/packages/client/dist/assets/treemap-GDKQZRPO-DZ7i2Nwu.js +160 -0
- package/packages/client/dist/assets/upload-DXXUmYu2.js +1 -0
- package/packages/client/dist/assets/use-minute-tick-BoS3Ec2H.js +1 -0
- package/packages/client/dist/assets/use-ws-BIe6kKa2.js +48 -0
- package/packages/client/dist/assets/utils-VDOOGGvU.js +2 -0
- package/packages/client/dist/assets/x-AprddF_b.js +1 -0
- package/packages/client/dist/assets/xychartDiagram-PRI3JC2R-D_bazwNo.js +7 -0
- package/packages/client/dist/index.html +9 -13
- package/packages/server/dist/index.js +117479 -69360
- package/packages/server/dist/index.js.map +682 -138
- package/packages/server/dist/pty-helper.mjs +115 -115
- package/packages/client/dist/assets/AddProjectView-CODm54MP.js +0 -1
- package/packages/client/dist/assets/AllThreadsView--Dd7YSK5.js +0 -1
- package/packages/client/dist/assets/AnalyticsView-eRhWGG3y.js +0 -36
- package/packages/client/dist/assets/AutomationInboxView-DwBaGJed.js +0 -1
- package/packages/client/dist/assets/CircuitBreakerDialog-C2iBwp5W.js +0 -1
- package/packages/client/dist/assets/CommandPalette-BXweSrdO.js +0 -1
- package/packages/client/dist/assets/ReviewPane-DxtlJNNu.js +0 -10
- package/packages/client/dist/assets/SettingsDetailView-BKh9OBM2.js +0 -1
- package/packages/client/dist/assets/SetupWizard-BekJX-tc.js +0 -1
- package/packages/client/dist/assets/TerminalPanel-DC4U0OTm.js +0 -4
- package/packages/client/dist/assets/ThreadListView-B6HvQ8NV.js +0 -1
- package/packages/client/dist/assets/arrow-right-3Bby9NNK.js +0 -1
- package/packages/client/dist/assets/command-B76T8z-A.js +0 -1
- package/packages/client/dist/assets/index-BRi6al6L.js +0 -99
- package/packages/client/dist/assets/index-DXO1sSe9.css +0 -1
- package/packages/client/dist/assets/markdown-B7CXSXYD.js +0 -29
- package/packages/client/dist/assets/review-pane-store-BLhxZHRI.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Sidebar-3Jd5JyAp.js","assets/markdown-9_JKOUHQ.js","assets/project-chip-CkL3EaeE.js","assets/createLucideIcon-CsWFljth.js","assets/index-Z_QI94Zg.js","assets/mermaid-C0IQv4mH.js","assets/index-zxpgGDAW.css","assets/use-ws-BIe6kKa2.js","assets/button-D8qrc3hb.js","assets/terminal-CuAYwdh-.js","assets/dialog-DapeOKPE.js","assets/x-AprddF_b.js","assets/input-Dyxe5hqI.js","assets/shallow-B0DA4RsP.js","assets/select-CkTnmILP.js","assets/index-DmIp58b6.js","assets/index-BplxL2Qj.js","assets/chevron-down-BJhJsMnL.js","assets/check-Dj_ZR5Y7.js","assets/badge-CrCqde50.js","assets/scroll-area-Bj4yTRJP.js","assets/use-minute-tick-BoS3Ec2H.js","assets/git-merge-CB0ebeXg.js","assets/circle-x-BNvrcCvx.js","assets/eye-BAXsQYWt.js","assets/external-link-Dg0Hq511.js","assets/automation-store-DiFgwQi4.js","assets/inbox-4g-W9WtW.js","assets/collapsible-DP3s_8s3.js","assets/dropdown-menu-Bi54WPTK.js","assets/chevron-right-PEOnBrxM.js","assets/editor-utils-DgK9pIvP.js","assets/pin-off-DpiyTpTd.js","assets/pin-uzq68OVB.js","assets/square-BqmNpRIH.js","assets/trash-2-QvY6JeI_.js","assets/folder-open-BbwqJxUi.js","assets/folder-d8RRIu-j.js","assets/search-JGV9EPmW.js","assets/pencil-pMey300q.js","assets/plus-ChfperZy.js","assets/columns-3-DhvlrNjA.js","assets/internal-editor-store-CuhCMFlj.js","assets/ThreadView-DsqoxCXZ.js","assets/utils-VDOOGGvU.js","assets/ToolCallGroup-BgROpRwn.js","assets/motion-Cyp39Uo1.js","assets/ansi_to_html-DYje8R53.js","assets/maximize-2-DW-IsQiI.js","assets/PromptInput-Cq_fXmwj.js","assets/popover-CRZjc4jI.js","assets/providers-Bv7fzJNY.js","assets/draft-store-DnVbStYY.js","assets/chevron-left-BVsM9RGq.js","assets/github-DiENtmNz.js","assets/globe-B1hiCqlb.js","assets/copy-DXKK6zMx.js","assets/minimize-2-CWn5BNKr.js","assets/rotate-ccw-DFiWNcpH.js","assets/upload-DXXUmYu2.js","assets/breadcrumb-BiY69_Mg.js","assets/clipboard-list-zkC7qTDO.js","assets/arrow-down-DQYiOM3D.js","assets/AllThreadsView-vCQJYKkF.js","assets/SlideUpPrompt-_ulHi9sN.js","assets/ThreadListView-DthHUodE.js","assets/app-store-B3iAaYzj.js","assets/ReviewPane-1r1cuH2I.js","assets/review-pane-store-CrK1Czq6.js","assets/refresh-cw-Svvcff2v.js","assets/history-D7cvrs7x.js","assets/eye-off-ICXVwkI1.js","assets/TerminalPanel-BiLDlQZQ.js","assets/SettingsDetailView-D-J9TfZx.js","assets/command-DOlrnbnh.js","assets/chevrons-up-down-Sa8XJRBx.js","assets/AutomationInboxView-Dj7f9gOu.js","assets/AddProjectView-yopCTuKC.js","assets/arrow-right-Bbusk4uX.js","assets/AnalyticsView-vz1-NSOv.js","assets/LiveColumnsView-CSRiYBNg.js","assets/CommandPalette-7Y8qqH7R.js","assets/CircuitBreakerDialog-C76CZi4q.js","assets/MonacoEditorDialog-PPXTSIdX.js","assets/monaco-CvC2RZDL.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as w}from"./mermaid-C0IQv4mH.js";import{r as s,j as t}from"./markdown-9_JKOUHQ.js";import{c as J,S as A,B as Q}from"./button-D8qrc3hb.js";import{I as _e,u as Pe}from"./input-Dyxe5hqI.js";import{n as Ne,R as ke,P as Re,C as Z,d as Te,T as ee,D as te,O as ae,m as Ce,a as y,u as E,A as Oe,b as Ee,e as Ae,f as Me,g as De,s as ze}from"./use-ws-BIe6kKa2.js";import{c as u,K as Ve,k as Le,l as Be,m as We,S as K,d as se,u as X,L as $e,M as O,T as He}from"./index-Z_QI94Zg.js";import{X as Ue}from"./x-AprddF_b.js";import{c as S}from"./createLucideIcon-CsWFljth.js";import{T as qe}from"./terminal-CuAYwdh-.js";import{useInternalEditorStore as B}from"./internal-editor-store-CuhCMFlj.js";const Ge=[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]],Ke=S("git-fork",Ge);const Xe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],re=S("panel-left",Xe);const Fe=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Ye=S("server",Fe);const Je=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qe=S("settings",Je);const Ze=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],et=S("sparkles",Ze);const tt=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],at=S("timer",tt);const st=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],rt=S("user",st);const nt=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],it=S("users",nt);var ot="Separator",F="horizontal",lt=["horizontal","vertical"],ne=s.forwardRef((e,a)=>{const{decorative:r,orientation:n=F,...i}=e,c=dt(n)?n:F,b=r?{role:"none"}:{"aria-orientation":c==="vertical"?c:void 0,role:"separator"};return t.jsx(Ne.div,{"data-orientation":c,...b,...i,ref:a})});ne.displayName=ot;function dt(e){return lt.includes(e)}var ie=ne;const oe=s.forwardRef(({className:e,orientation:a="horizontal",decorative:r=!0,...n},i)=>t.jsx(ie,{ref:i,decorative:r,orientation:a,className:u("shrink-0 bg-border",a==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));oe.displayName=ie.displayName;const ct=ke,ut=Re,le=s.forwardRef(({className:e,...a},r)=>t.jsx(ae,{className:u("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:r}));le.displayName=ae.displayName;const ft=J("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),de=s.forwardRef(({side:e="right",className:a,children:r,...n},i)=>t.jsxs(ut,{children:[t.jsx(le,{}),t.jsxs(Z,{ref:i,className:u(ft({side:e}),a),...n,children:[r,t.jsxs(Te,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[t.jsx(Ue,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));de.displayName=Z.displayName;const ce=({className:e,...a})=>t.jsx("div",{className:u("flex flex-col space-y-2 text-center sm:text-left",e),...a});ce.displayName="SheetHeader";const ue=s.forwardRef(({className:e,...a},r)=>t.jsx(ee,{ref:r,className:u("text-lg font-semibold text-foreground",e),...a}));ue.displayName=ee.displayName;const fe=s.forwardRef(({className:e,...a},r)=>t.jsx(te,{ref:r,className:u("text-sm text-muted-foreground",e),...a}));fe.displayName=te.displayName;const $=768;function pt(){const[e,a]=s.useState(void 0);return s.useEffect(()=>{const r=window.matchMedia(`(max-width: ${$-1}px)`),n=()=>{a(window.innerWidth<$)};return r.addEventListener("change",n),a(window.innerWidth<$),()=>r.removeEventListener("change",n)},[]),!!e}const bt="sidebar_state",mt=3600*24*7,ht="18rem",gt="3rem",xt="b",Y="sidebar_width",vt=240,yt=600,pe=s.createContext(null);function M(){const e=s.useContext(pe);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const be=s.forwardRef(({defaultOpen:e=!0,open:a,onOpenChange:r,keyboardShortcut:n=!0,className:i,style:c,children:p,...b},g)=>{const o=pt(),[f,l]=s.useState(!1),[j,m]=s.useState(()=>{const h=localStorage.getItem(Y);return h?Number(h):320}),[k,C]=s.useState(!1),I=s.useCallback(h=>{const v=Math.max(vt,Math.min(yt,h));m(v),localStorage.setItem(Y,String(v))},[]),[D,z]=s.useState(e),_=a??D,P=s.useCallback(h=>{const v=typeof h=="function"?h(_):h;r?r(v):z(v),document.cookie=`${bt}=${v}; path=/; max-age=${mt}`},[r,_]),R=s.useCallback(()=>o?l(h=>!h):P(h=>!h),[o,P,l]);s.useEffect(()=>{if(!n)return;const h=v=>{v.key===xt&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),R())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[R,n]);const V=_?"expanded":"collapsed",W=s.useMemo(()=>({state:V,open:_,setOpen:P,isMobile:o,openMobile:f,setOpenMobile:l,toggleSidebar:R,sidebarWidth:j,setSidebarWidth:I,isResizing:k,setIsResizing:C}),[V,_,P,o,f,l,R,j,I,k,C]);return t.jsx(pe.Provider,{value:W,children:t.jsx(Ve,{delayDuration:0,disableHoverableContent:!0,children:t.jsx("div",{style:{"--sidebar-width":`${j}px`,"--sidebar-width-icon":gt,...c},className:u("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",i),ref:g,...b,children:p})})})});be.displayName="SidebarProvider";const me=s.forwardRef(({side:e="left",variant:a="sidebar",collapsible:r="offcanvas",className:n,children:i,...c},p)=>{const{isMobile:b,state:g,openMobile:o,setOpenMobile:f,isResizing:l}=M();return r==="none"?t.jsx("div",{className:u("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",n),ref:p,...c,children:i}):b?t.jsx(ct,{open:o,onOpenChange:f,...c,children:t.jsxs(de,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":ht},side:e,children:[t.jsxs(ce,{className:"sr-only",children:[t.jsx(ue,{children:"Sidebar"}),t.jsx(fe,{children:"Displays the mobile sidebar."})]}),t.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):t.jsxs("div",{ref:p,className:"group peer hidden text-sidebar-foreground md:block","data-state":g,"data-collapsible":g==="collapsed"?r:"","data-variant":a,"data-side":e,children:[t.jsx("div",{className:u("relative w-[--sidebar-width] bg-transparent",!l&&"transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",a==="floating"||a==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),t.jsx("div",{className:u("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] md:flex",!l&&"transition-[left,right,width] duration-200 ease-linear",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",a==="floating"||a==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...c,children:t.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:i})})]})});me.displayName="Sidebar";const wt=s.forwardRef(({className:e,onClick:a,...r},n)=>{const{toggleSidebar:i}=M();return t.jsxs(Q,{ref:n,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:u("h-7 w-7",e),onClick:c=>{a?.(c),i()},...r,children:[t.jsx(re,{}),t.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});wt.displayName="SidebarTrigger";const St=s.forwardRef(({className:e,...a},r)=>{const{toggleSidebar:n,setSidebarWidth:i,sidebarWidth:c,setIsResizing:p}=M(),b=s.useRef(!1),g=s.useRef(0),o=s.useRef(0),f=s.useCallback(m=>{b.current=!0,g.current=m.clientX,o.current=c,p(!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none",m.target.setPointerCapture(m.pointerId)},[c,p]),l=s.useCallback(m=>{if(!b.current)return;const k=m.clientX-g.current;i(o.current+k)},[i]),j=s.useCallback(m=>{b.current&&(b.current=!1,p(!1),document.body.style.cursor="",document.body.style.userSelect="",m.target.releasePointerCapture(m.pointerId))},[p]);return t.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:m=>{Math.abs(m.clientX-g.current)<5&&n()},onPointerDown:f,onPointerMove:l,onPointerUp:j,title:"Drag to resize, click to toggle",className:u("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","cursor-col-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2","group-data-[state=collapsed]:!hidden",e),...a})});St.displayName="SidebarRail";const he=s.forwardRef(({className:e,...a},r)=>t.jsx("main",{ref:r,className:u("relative flex w-full flex-1 flex-col bg-background","md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...a}));he.displayName="SidebarInset";const jt=s.forwardRef(({className:e,...a},r)=>t.jsx(_e,{ref:r,"data-sidebar":"input",className:u("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...a}));jt.displayName="SidebarInput";const ge=s.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"header",className:u("flex flex-col gap-2 p-2",e),...a}));ge.displayName="SidebarHeader";const It=s.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"footer",className:u("flex flex-col gap-2 p-2",e),...a}));It.displayName="SidebarFooter";const _t=s.forwardRef(({className:e,...a},r)=>t.jsx(oe,{ref:r,"data-sidebar":"separator",className:u("mx-2 w-auto bg-sidebar-border",e),...a}));_t.displayName="SidebarSeparator";const xe=s.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"content",className:u("flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...a}));xe.displayName="SidebarContent";const Pt=s.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group",className:u("relative flex w-full min-w-0 flex-col p-2",e),...a}));Pt.displayName="SidebarGroup";const Nt=s.forwardRef(({className:e,asChild:a=!1,...r},n)=>{const i=a?A:"div";return t.jsx(i,{ref:n,"data-sidebar":"group-label",className:u("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...r})});Nt.displayName="SidebarGroupLabel";const kt=s.forwardRef(({className:e,asChild:a=!1,...r},n)=>{const i=a?A:"button";return t.jsx(i,{ref:n,"data-sidebar":"group-action",className:u("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...r})});kt.displayName="SidebarGroupAction";const Rt=s.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"group-content",className:u("w-full text-sm",e),...a}));Rt.displayName="SidebarGroupContent";const ve=s.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu",className:u("flex w-full min-w-0 flex-col gap-1",e),...a}));ve.displayName="SidebarMenu";const ye=s.forwardRef(({className:e,...a},r)=>t.jsx("li",{ref:r,"data-sidebar":"menu-item",className:u("group/menu-item relative",e),...a}));ye.displayName="SidebarMenuItem";const Tt=J("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),we=s.forwardRef(({asChild:e=!1,isActive:a=!1,variant:r="default",size:n="default",tooltip:i,className:c,...p},b)=>{const g=e?A:"button",{isMobile:o,state:f}=M(),l=t.jsx(g,{ref:b,"data-sidebar":"menu-button","data-size":n,"data-active":a,className:u(Tt({variant:r,size:n}),c),...p});return i?(typeof i=="string"&&(i={children:i}),t.jsxs(Le,{children:[t.jsx(Be,{asChild:!0,children:l}),t.jsx(We,{side:"right",align:"center",hidden:f!=="collapsed"||o,...i})]})):l});we.displayName="SidebarMenuButton";const Ct=s.forwardRef(({className:e,asChild:a=!1,showOnHover:r=!1,...n},i)=>{const c=a?A:"button";return t.jsx(c,{ref:i,"data-sidebar":"menu-action",className:u("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...n})});Ct.displayName="SidebarMenuAction";const Ot=s.forwardRef(({className:e,...a},r)=>t.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:u("pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...a}));Ot.displayName="SidebarMenuBadge";const Et=s.forwardRef(({className:e,showIcon:a=!1,...r},n)=>{const i=s.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return t.jsxs("div",{ref:n,"data-sidebar":"menu-skeleton",className:u("flex h-8 items-center gap-2 rounded-md px-2",e),...r,children:[a&&t.jsx(K,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),t.jsx(K,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":i}})]})});Et.displayName="SidebarMenuSkeleton";const At=s.forwardRef(({className:e,...a},r)=>t.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:u("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...a}));At.displayName="SidebarMenuSub";const Mt=s.forwardRef(({...e},a)=>t.jsx("li",{ref:a,...e}));Mt.displayName="SidebarMenuSubItem";const Dt=s.forwardRef(({asChild:e=!1,size:a="md",isActive:r,className:n,...i},c)=>{const p=e?A:"a";return t.jsx(p,{ref:c,"data-sidebar":"menu-sub-button","data-size":a,"data-active":r,className:u("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",a==="sm"&&"text-xs",a==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",n),...i})});Dt.displayName="SidebarMenuSubButton";const H=[{id:"general",label:"General",icon:Qe},{id:"mcp-server",label:"MCP Server",icon:Ye},{id:"skills",label:"Skills",icon:et},{id:"worktrees",label:"Worktrees",icon:Ke},{id:"startup-commands",label:"Startup Commands",icon:qe},{id:"automations",label:"Automations",icon:at},{id:"archived-threads",label:"Archived Threads",icon:Ce}],zt=H,Vt={general:"settings.general","mcp-server":"settings.mcpServer",skills:"settings.skills",worktrees:"settings.worktrees","startup-commands":"startup.title",automations:"settings.automations","archived-threads":"settings.archivedThreads",users:"users.title",profile:"profile.title"};function xa(){const e=se(),{t:a}=Pe(),r=y(o=>o.setSettingsOpen),n=y(o=>o.activeSettingsPage),i=E(o=>o.selectedProjectId),c=X(o=>o.mode),p=X(o=>o.user),b=i?[...H].filter(o=>o.id!=="archived-threads"):[...H];b.push({id:"profile",label:"Profile",icon:rt}),c==="multi"&&p?.role==="admin"&&b.push({id:"users",label:"Users",icon:it});const g=o=>i?`/projects/${i}/settings/${o}`:`/settings/${o}`;return t.jsxs(me,{collapsible:"offcanvas",children:[t.jsx(ge,{className:"px-4 py-3",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Q,{variant:"ghost",size:"icon-xs",onClick:()=>{r(!1),e(i?`/projects/${i}`:"/")},className:"text-muted-foreground hover:text-foreground",children:t.jsx(Oe,{className:"h-3.5 w-3.5"})}),t.jsx("h1",{className:"text-sm font-medium",children:a("settings.title")})]})}),t.jsx(xe,{className:"px-2 pb-2",children:t.jsx(ve,{children:b.map(o=>{const f=o.icon;return t.jsx(ye,{children:t.jsxs(we,{isActive:n===o.id,onClick:()=>e(g(o.id)),children:[t.jsx(f,{className:"h-4 w-4"}),t.jsx("span",{children:a(Vt[o.id]??o.label)})]})},o.id)})})})]})}function Lt(e){const a=O("/projects/:projectId/settings/:pageId",e);if(a)return{settingsPage:a.params.pageId,projectId:a.params.projectId,threadId:null,globalSearch:!1,inbox:!1,analytics:!1,liveColumns:!1};const r=O("/settings/:pageId",e);if(r)return{settingsPage:r.params.pageId,projectId:null,threadId:null,globalSearch:!1,inbox:!1,analytics:!1,liveColumns:!1};const n=O("/projects/:projectId/threads/:threadId",e);if(n)return{settingsPage:null,projectId:n.params.projectId,threadId:n.params.threadId,globalSearch:!1,inbox:!1,analytics:!1,liveColumns:!1};const i=O("/projects/:projectId",e);if(i)return{settingsPage:null,projectId:i.params.projectId,threadId:null,globalSearch:!1,inbox:!1,analytics:!1,liveColumns:!1};if(e==="/inbox")return{settingsPage:null,projectId:null,threadId:null,globalSearch:!1,inbox:!0,analytics:!1,liveColumns:!1};if(e==="/list")return{settingsPage:null,projectId:null,threadId:null,globalSearch:!0,inbox:!1,analytics:!1,liveColumns:!1};if(e==="/kanban")return{settingsPage:null,projectId:null,threadId:null,globalSearch:!0,inbox:!1,analytics:!1,liveColumns:!1};const c=O("/projects/:projectId/analytics",e);return c?{settingsPage:null,projectId:c.params.projectId,threadId:null,globalSearch:!1,inbox:!1,analytics:!0,liveColumns:!1}:e==="/analytics"?{settingsPage:null,projectId:null,threadId:null,globalSearch:!1,inbox:!1,analytics:!0,liveColumns:!1}:e==="/grid"?{settingsPage:null,projectId:null,threadId:null,globalSearch:!1,inbox:!1,analytics:!1,liveColumns:!0}:{settingsPage:null,projectId:null,threadId:null,globalSearch:!1,inbox:!1,analytics:!1,liveColumns:!1}}const Bt=new Set(zt.map(e=>e.id));function Wt(){const e=$e(),a=E(r=>r.initialized);s.useEffect(()=>{if(!a)return;const{settingsPage:r,projectId:n,threadId:i,globalSearch:c,inbox:p,analytics:b,liveColumns:g}=Lt(e.pathname),o=E.getState(),f=Ee.getState(),l=y.getState();if(r&&Bt.has(r)){l.settingsOpen||l.setSettingsOpen(!0),l.activeSettingsPage!==r&&l.setActiveSettingsPage(r),n&&n!==o.selectedProjectId&&o.selectProject(n);return}if(l.settingsOpen&&l.setSettingsOpen(!1),p){l.automationInboxOpen||l.setAutomationInboxOpen(!0),l.allThreadsProjectId&&l.closeAllThreads();return}if(l.automationInboxOpen&&l.setAutomationInboxOpen(!1),b){n&&n!==o.selectedProjectId&&o.selectProject(n),l.analyticsOpen||l.setAnalyticsOpen(!0),l.allThreadsProjectId&&l.closeAllThreads();return}if(l.analyticsOpen&&l.setAnalyticsOpen(!1),g){l.liveColumnsOpen||l.setLiveColumnsOpen(!0),l.allThreadsProjectId&&l.closeAllThreads();return}if(l.liveColumnsOpen&&l.setLiveColumnsOpen(!1),c){l.showGlobalSearch(),l.kanbanContext&&l.setKanbanContext(null);return}l.allThreadsProjectId&&l.closeAllThreads(),i?((i!==f.selectedThreadId||!f.activeThread||f.activeThread.id!==i)&&f.selectThread(i),n&&n!==o.selectedProjectId&&o.selectProject(n)):n?(f.selectedThreadId&&f.selectThread(null),n!==o.selectedProjectId&&o.selectProject(n)):(f.selectedThreadId&&f.selectThread(null),o.selectedProjectId&&o.selectProject(null))},[e.pathname,e.search,a])}const $t=s.lazy(()=>w(()=>import("./Sidebar-3Jd5JyAp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42])).then(e=>({default:e.AppSidebar}))),Ht=w(()=>import("./ThreadView-DsqoxCXZ.js").then(e=>e.T),__vite__mapDeps([43,5,1,4,6,7,3,8,9,12,19,28,21,22,23,24,14,15,16,17,18,44,45,46,47,30,10,11,20,31,48,49,50,51,52,53,34,54,55,27,36,56,57,58,59,40,60,29,41,25,61,32,33,35,62])).then(e=>({default:e.ThreadView})),Ut=s.lazy(()=>Ht),qt="sidebar_width",Gt=320;function Kt(){let e=Gt;try{const a=localStorage.getItem(qt);a&&(e=Number(a))}catch{}return t.jsx("div",{style:{width:e},className:"flex-shrink-0 border-r border-sidebar-border bg-sidebar"})}function Xt(){const{state:e,toggleSidebar:a}=M();return e==="expanded"?null:t.jsx("button",{onClick:a,className:"flex h-full w-10 flex-shrink-0 cursor-pointer items-start justify-center border-r border-border bg-sidebar pt-3 transition-colors hover:bg-sidebar-accent",title:"Expand sidebar",children:t.jsx(re,{className:"h-4 w-4 text-muted-foreground"})})}const Ft=s.lazy(()=>w(()=>import("./AllThreadsView-vCQJYKkF.js"),__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,64,10,11,49,50,14,15,16,17,18,51,52,53,30,12,34,54,55,21,22,23,24,27,36,56,65,38,66,40,33,35,41,62])).then(e=>({default:e.AllThreadsView}))),U=()=>w(()=>import("./ReviewPane-1r1cuH2I.js"),__vite__mapDeps([67,1,4,5,6,7,3,8,9,10,11,29,16,15,30,12,50,20,68,31,52,18,44,25,69,58,70,59,48,38,71,56,22,42])).then(e=>({default:e.ReviewPane})),Yt=s.lazy(U),Jt=s.lazy(()=>w(()=>import("./TerminalPanel-BiLDlQZQ.js"),__vite__mapDeps([72,5,1,47,13,8,4,6,3,7,9,12,17,11,40,34])).then(e=>({default:e.TerminalPanel}))),Qt=s.lazy(()=>w(()=>import("./SettingsDetailView-D-J9TfZx.js"),__vite__mapDeps([73,1,7,3,4,5,6,8,9,13,60,30,74,10,11,38,50,20,15,51,65,12,21,22,23,24,14,16,17,18,53,66,58,35,26,40,70,39,55,28,25,34,36,75,42])).then(e=>({default:e.SettingsDetailView}))),Zt=s.lazy(()=>w(()=>import("./AutomationInboxView-Dj7f9gOu.js"),__vite__mapDeps([76,1,19,8,4,5,6,3,74,7,9,10,11,38,12,50,26,27,75,18,42])).then(e=>({default:e.AutomationInboxView}))),ea=s.lazy(()=>w(()=>import("./AddProjectView-yopCTuKC.js"),__vite__mapDeps([77,1,7,3,4,5,6,8,9,10,11,12,66,20,15,78,30,38,37,54,18,56,25,55,36,40])).then(e=>({default:e.AddProjectView}))),ta=s.lazy(()=>w(()=>import("./AnalyticsView-vz1-NSOv.js"),__vite__mapDeps([79,1,8,4,5,6,3,20,15,14,16,7,9,17,18,66,12,53,40,61,24])).then(e=>({default:e.AnalyticsView}))),aa=s.lazy(()=>w(()=>import("./LiveColumnsView-CSRiYBNg.js"),__vite__mapDeps([80,1,7,3,4,5,6,8,9,19,12,50,20,15,21,22,23,24,14,16,17,18,66,45,46,44,47,30,10,11,31,48,49,51,52,53,34,54,55,27,36,56,64,41,40,38])).then(e=>({default:e.LiveColumnsView}))),q=()=>w(()=>import("./CommandPalette-7Y8qqH7R.js"),__vite__mapDeps([81,1,74,7,3,4,5,6,8,9,10,11,38,12,36,42])).then(e=>({default:e.CommandPalette})),sa=s.lazy(q);typeof requestIdleCallback=="function"?(requestIdleCallback(()=>{q()}),requestIdleCallback(()=>{U()})):(setTimeout(()=>{q()},2e3),setTimeout(()=>{U()},3e3));const ra=s.lazy(()=>w(()=>import("./CircuitBreakerDialog-C76CZi4q.js"),__vite__mapDeps([82,1,8,4,5,6,3,12,69])).then(e=>({default:e.CircuitBreakerDialog}))),na=s.lazy(()=>w(()=>import("./MonacoEditorDialog-PPXTSIdX.js"),__vite__mapDeps([83,1,84,5,4,6,7,3,8,9,10,11,20,15,12,71,24,57,48])).then(e=>({default:e.MonacoEditorDialog})));function ia(){const e=E(d=>d.loadProjects),a=y(d=>d.reviewPaneOpen);y(d=>d.setReviewPaneOpen);const r=y(d=>d.reviewPaneWidth),n=y(d=>d.setReviewPaneWidth),i=y(d=>d.settingsOpen),c=y(d=>d.allThreadsProjectId),p=y(d=>d.automationInboxOpen),b=y(d=>d.addProjectOpen),g=y(d=>d.analyticsOpen),o=y(d=>d.liveColumnsOpen),f=B(d=>d.isOpen),l=B(d=>d.filePath),j=B(d=>d.initialContent),m=se(),[k,C]=s.useState(!1),I=s.useRef(!1),D=s.useRef(0),z=s.useRef(0),[_,P]=s.useState(!1),R=s.useCallback(d=>{I.current=!0,D.current=d.clientX,z.current=r,P(!0),document.body.style.cursor="col-resize",document.body.style.userSelect="none",d.target.setPointerCapture(d.pointerId)},[r]),V=s.useCallback(d=>{if(!I.current)return;const x=(D.current-d.clientX)/window.innerWidth*100;n(z.current+x)},[n]),W=s.useCallback(d=>{I.current&&(I.current=!1,P(!1),document.body.style.cursor="",document.body.style.userSelect="",d.target.releasePointerCapture(d.pointerId))},[]),[h,v]=s.useState(!1);return s.useEffect(()=>{const d=()=>v(!0);if(typeof requestIdleCallback=="function"){const N=requestIdleCallback(d);return()=>cancelIdleCallback(N)}else{const N=setTimeout(d,3e3);return()=>clearTimeout(N)}},[]),s.useEffect(()=>{ze(m)},[m]),Ae(),Wt(),s.useEffect(()=>{e()},[e]),s.useEffect(()=>{const d=!!window.__TAURI_INTERNALS__,N=x=>{if(x.ctrlKey&&x.key==="k"){x.preventDefault(),x.stopPropagation(),s.startTransition(()=>{C(T=>!T)});return}if(x.ctrlKey&&x.shiftKey&&x.key==="F"){x.preventDefault(),x.stopPropagation(),m("/list");return}if(x.ctrlKey&&x.key==="`"){if(x.preventDefault(),!d)return;const T=De.getState(),{selectedProjectId:L,projects:Se}=E.getState();if(!L)return;if(T.tabs.filter(G=>G.projectId===L).length===0&&!T.panelVisible){const je=Se.find(Ie=>Ie.id===L)?.path??"C:\\";T.addTab({id:crypto.randomUUID(),label:"Terminal 1",cwd:je,alive:!0,projectId:L})}else T.togglePanel()}};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[m]),t.jsxs(be,{defaultOpen:!0,className:"h-screen overflow-hidden",children:[t.jsx(s.Suspense,{fallback:t.jsx(Kt,{}),children:t.jsx($t,{})}),t.jsx(Xt,{}),t.jsxs(he,{className:"flex flex-col overflow-hidden",children:[t.jsx("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:t.jsx(s.Suspense,{children:i?t.jsx(Qt,{}):g?t.jsx(ta,{}):o?t.jsx(aa,{}):p?t.jsx(Zt,{}):b?t.jsx(ea,{}):c?t.jsx(Ft,{}):t.jsx(Ut,{})})}),t.jsx(s.Suspense,{children:t.jsx(Jt,{})})]}),t.jsxs("div",{className:u("relative h-full overflow-hidden flex-shrink-0 border-l border-border bg-sidebar",!_&&"transition-[width,opacity] duration-200 ease-out",a&&!i&&!c?"opacity-100":"w-0 opacity-0 border-l-0"),style:a&&!i&&!c?{width:`${r}vw`}:void 0,children:[a&&!i&&!c&&t.jsx("button",{"aria-label":"Resize review pane",tabIndex:-1,onPointerDown:R,onPointerMove:V,onPointerUp:W,className:"absolute inset-y-0 left-0 z-20 w-4 -translate-x-1/2 cursor-col-resize after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border"}),(h||a)&&t.jsx("div",{className:"h-full",style:{width:`${r}vw`,...a&&!i&&!c?{}:{visibility:"hidden"}},children:t.jsx(s.Suspense,{children:t.jsx(Yt,{})})})]}),t.jsx(Me,{position:"bottom-right",duration:He}),t.jsx(s.Suspense,{children:t.jsx(ra,{})}),t.jsx(s.Suspense,{children:t.jsx(sa,{open:k,onOpenChange:C})}),f&&t.jsx(s.Suspense,{children:t.jsx(na,{open:!0,onOpenChange:d=>{d||B.getState().closeEditor()},filePath:l||"",initialContent:j})})]})}const va=Object.freeze(Object.defineProperty({__proto__:null,App:ia},Symbol.toStringTag,{value:"Module"}));export{va as A,Ke as G,Qe as S,at as T,Vt as a,et as b,Ye as c,xa as d,me as e,ge as f,xe as g,It as h,St as i,zt as s,M as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,j as t}from"./markdown-9_JKOUHQ.js";import{B}from"./badge-CrCqde50.js";import{B as c}from"./button-D8qrc3hb.js";import{C as E,a as M,b as D,c as U,d as $,e as I}from"./command-DOlrnbnh.js";import{I as G}from"./input-Dyxe5hqI.js";import{P as Q,a as V,b as q}from"./popover-CRZjc4jI.js";import{d as H,c as l}from"./index-Z_QI94Zg.js";import{useAutomationStore as p}from"./automation-store-DiFgwQi4.js";import{u as W,a as J,b as A}from"./use-ws-BIe6kKa2.js";import{I as P}from"./inbox-4g-W9WtW.js";import{S as K}from"./App-BEFplUGa.js";import{S as X}from"./search-JGV9EPmW.js";import{C as Y}from"./chevrons-up-down-Sa8XJRBx.js";import{C as k}from"./check-Dj_ZR5Y7.js";import"./createLucideIcon-CsWFljth.js";import"./dialog-DapeOKPE.js";import"./x-AprddF_b.js";import"./mermaid-C0IQv4mH.js";import"./terminal-CuAYwdh-.js";import"./internal-editor-store-CuhCMFlj.js";function ge(){const u=H(),h=W(e=>e.projects),i=p(e=>e.inbox),g=p(e=>e.inboxCount),b=p(e=>e.loadInbox),N=p(e=>e.triageRun),v=J(e=>e.setAutomationInboxOpen),T=A(e=>e.selectThread),F=A(e=>e.selectedThreadId),[a,y]=o.useState(null),[w,f]=o.useState(!1),[d,L]=o.useState("pending"),[m,R]=o.useState(""),C=o.useRef(b);C.current=b,o.useEffect(()=>{C.current()},[]);const S=o.useMemo(()=>{let e=i;if(d!=="all"&&(e=e.filter(s=>s.run.triageStatus===d)),a&&(e=e.filter(s=>s.thread.projectId===a)),m.trim()){const s=m.toLowerCase();e=e.filter(r=>r.automation.name.toLowerCase().includes(s)||r.thread.title.toLowerCase().includes(s)||r.run.summary?.toLowerCase().includes(s))}return e},[i,d,a,m]),j=o.useMemo(()=>{const e=new Set(i.map(s=>s.thread.projectId));return h.filter(s=>e.has(s.id))},[i,h]),O=e=>{T(e)},z=()=>{v(!1),u(a?`/projects/${a}/settings/automations`:"/settings/automations")};return t.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-border px-6 py-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(P,{className:"h-4 w-4 text-muted-foreground"}),t.jsx("h2",{className:"text-sm font-medium",children:"Automation Inbox"}),g>0&&t.jsx(B,{variant:"secondary",className:"h-5 min-w-5 px-1 leading-none",children:g})]}),t.jsxs(c,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-xs text-muted-foreground",onClick:z,children:[t.jsx(K,{className:"h-3.5 w-3.5"}),"Manage Automations"]})]}),t.jsx("div",{className:"flex items-center gap-0 border-b border-border/40 px-6",children:["all","pending","reviewed","dismissed"].map(e=>{const s=d===e,r=e==="all"?i.length:i.filter(x=>x.run.triageStatus===e).length;return t.jsxs("button",{onClick:()=>L(e),className:l("px-4 py-2 text-xs font-medium transition-colors relative border-b-2",s?"text-foreground border-primary":"text-muted-foreground border-transparent hover:text-foreground/80"),children:[e==="all"?"All":e.charAt(0).toUpperCase()+e.slice(1),r>0&&t.jsx("span",{className:l("ml-1.5 text-xs px-1.5 py-0.5 rounded-full",s?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:r})]},e)})}),t.jsx("div",{className:"border-b border-border px-6 py-3",children:t.jsxs("div",{className:"relative",children:[t.jsx(X,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),t.jsx(G,{type:"text",placeholder:"Search by automation name, thread title, or summary...",value:m,onChange:e=>R(e.target.value),className:"h-8 pl-9 pr-3 text-xs"})]})}),j.length>1&&t.jsx("div",{className:"flex items-center gap-2 border-b border-border px-6 py-2",children:t.jsxs(Q,{open:w,onOpenChange:f,children:[t.jsx(V,{asChild:!0,children:t.jsxs(c,{variant:"outline",role:"combobox","aria-expanded":w,className:"h-7 w-[200px] justify-between text-xs font-normal",children:[a?j.find(e=>e.id===a)?.name:"All projects",t.jsx(Y,{className:"ml-2 h-3 w-3 shrink-0 opacity-50"})]})}),t.jsx(q,{className:"w-[200px] p-0",align:"start",children:t.jsxs(E,{children:[t.jsx(M,{placeholder:"Search project...",className:"h-8 text-xs"}),t.jsxs(D,{children:[t.jsx(U,{className:"py-3 text-xs",children:"No project found."}),t.jsxs($,{children:[t.jsxs(I,{value:"all",onSelect:()=>{y(null),f(!1)},className:"text-xs",children:[t.jsx(k,{className:l("mr-2 h-3 w-3",a?"opacity-0":"opacity-100")}),"All projects"]}),j.map(e=>t.jsxs(I,{value:e.name,onSelect:()=>{y(e.id),f(!1)},className:"text-xs",children:[t.jsx(k,{className:l("mr-2 h-3 w-3",a===e.id?"opacity-100":"opacity-0")}),e.name]},e.id))]})]})]})})]})}),t.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:S.length===0?t.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-muted-foreground",children:[t.jsx(P,{className:"mb-3 h-8 w-8 opacity-50"}),t.jsx("p",{className:"text-sm",children:"No pending reviews."}),t.jsx("p",{className:"mt-1 text-xs",children:"Automation results that need review will appear here."})]}):t.jsx("div",{className:"mx-auto max-w-2xl space-y-3",children:S.map(({run:e,automation:s,thread:r})=>{const x=h.find(n=>n.id===r.projectId);return t.jsxs("div",{className:l("rounded-lg border bg-card p-4 space-y-3 cursor-pointer transition-colors",F===r.id?"border-primary/50 bg-accent/30":"border-border/50 hover:border-border"),onClick:()=>O(r.id),children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:s.name}),t.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[x&&t.jsxs("span",{className:"font-medium",children:[x.name," · "]}),r.title]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:l("text-xs px-1.5 py-0.5 rounded-full",e.hasFindings?"bg-status-warning/10 text-status-warning/80":"bg-muted text-muted-foreground"),children:e.hasFindings?"Has findings":"No findings"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:e.completedAt?new Date(e.completedAt).toLocaleString():""})]})]}),e.summary&&t.jsx("p",{className:"text-xs text-muted-foreground",children:e.summary}),t.jsxs("div",{className:"flex items-center justify-end gap-2",children:[t.jsx(c,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:n=>{n.stopPropagation(),v(!1),u(`/projects/${r.projectId}/threads/${r.id}`)},children:"View Thread"}),e.triageStatus==="pending"&&t.jsxs(t.Fragment,{children:[t.jsx(c,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:n=>{n.stopPropagation(),N(e.id,"dismissed")},children:"Dismiss"}),t.jsx(c,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:n=>{n.stopPropagation(),N(e.id,"reviewed")},children:"Mark Reviewed"})]})]})]},e.id)})})})]})}export{ge as AutomationInboxView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./markdown-9_JKOUHQ.js";import{L as o,B as n}from"./button-D8qrc3hb.js";import{x as a}from"./index-Z_QI94Zg.js";import{u as l}from"./input-Dyxe5hqI.js";import{c as m}from"./createLucideIcon-CsWFljth.js";import{R as d}from"./refresh-cw-Svvcff2v.js";import"./mermaid-C0IQv4mH.js";const x=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],f=m("wifi-off",x);function w(){const{t}=l(),s=a(r=>r.state),c=a(r=>r.retryNow);if(s==="closed")return null;const i=s==="half-open";return e.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-background",children:e.jsxs("div",{className:"flex max-w-md flex-col items-center gap-6 px-6 text-center",children:[e.jsx("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10",children:e.jsx(f,{className:"h-8 w-8 text-destructive"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:t("circuitBreaker.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t("circuitBreaker.description")})]}),i?e.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(o,{className:"h-4 w-4 animate-spin"}),t("circuitBreaker.attemptingReconnect")]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:t("circuitBreaker.willRetryAutomatically")}),!i&&e.jsxs(n,{onClick:c,size:"lg",children:[e.jsx(d,{className:"mr-2 h-4 w-4"}),t("circuitBreaker.retryNow")]})]})})}export{w as CircuitBreakerDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./markdown-9_JKOUHQ.js";import{s as u,a as j}from"./App-BEFplUGa.js";import{f,a as g,b as S,c as P,d as r,e as m,g as N}from"./command-DOlrnbnh.js";import{u as v,a as l,c as C}from"./use-ws-BIe6kKa2.js";import{u as w}from"./input-Dyxe5hqI.js";import{F as b}from"./folder-open-BbwqJxUi.js";import{d as $}from"./index-Z_QI94Zg.js";import"./mermaid-C0IQv4mH.js";import"./button-D8qrc3hb.js";import"./createLucideIcon-CsWFljth.js";import"./x-AprddF_b.js";import"./terminal-CuAYwdh-.js";import"./internal-editor-store-CuhCMFlj.js";import"./dialog-DapeOKPE.js";import"./search-JGV9EPmW.js";function A({open:c,onOpenChange:a}){const{t:s}=w(),n=$(),o=v(e=>e.projects),i=l(e=>e.startNewThread),d=l(e=>e.setSettingsOpen),p=e=>{a(!1),i(e),C.getState().fetchForProject(e),n(`/projects/${e}`)},x=e=>{a(!1),d(!0),n(`/settings/${e}`)};return t.jsxs(f,{open:c,onOpenChange:a,children:[t.jsx(g,{placeholder:s("commandPalette.searchPlaceholder")}),t.jsxs(S,{children:[t.jsx(P,{children:s("commandPalette.noResults")}),t.jsx(r,{heading:s("commandPalette.projects"),children:o.length===0?t.jsx("div",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:s("commandPalette.noProjects")}):o.map(e=>t.jsxs(m,{value:`${e.name} ${e.path}`,onSelect:()=>p(e.id),children:[t.jsx(b,{className:"h-4 w-4 flex-shrink-0"}),t.jsxs("div",{className:"flex min-w-0 flex-col",children:[t.jsx("span",{className:"truncate",children:e.name}),t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:e.path})]})]},e.id))}),t.jsx(N,{}),t.jsx(r,{heading:s("commandPalette.settings"),children:u.map(e=>{const h=e.icon;return t.jsxs(m,{value:e.label,onSelect:()=>x(e.id),children:[t.jsx(h,{className:"h-4 w-4"}),t.jsx("span",{children:s(j[e.id]??e.label)})]},e.id)})})]})]})}export{A as CommandPalette};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,j as e,M as ae,d as ne}from"./markdown-9_JKOUHQ.js";import{b as U,u as Z,t as L}from"./use-ws-BIe6kKa2.js";import{B as ee}from"./badge-CrCqde50.js";import{B as H,L as q}from"./button-D8qrc3hb.js";import{u as te,I as z}from"./input-Dyxe5hqI.js";import{P as W,a as F,b as $}from"./popover-CRZjc4jI.js";import{S as le}from"./scroll-area-Bj4yTRJP.js";import{u as ce,s as J,G as ie}from"./use-minute-tick-BoS3Ec2H.js";import{d as de,a as se,b as I,s as oe,c as _}from"./index-Z_QI94Zg.js";import{u as me}from"./app-store-B3iAaYzj.js";import{u as ue,D as pe,T as fe,a as he}from"./ToolCallGroup-BgROpRwn.js";import{P as xe}from"./PromptInput-Cq_fXmwj.js";import{S as Q}from"./SlideUpPrompt-_ulHi9sN.js";import{C as G}from"./columns-3-DhvlrNjA.js";import{P as K}from"./plus-ChfperZy.js";import{S as Y}from"./search-JGV9EPmW.js";import{c as ge}from"./createLucideIcon-CsWFljth.js";import"./terminal-CuAYwdh-.js";import"./mermaid-C0IQv4mH.js";import"./index-DmIp58b6.js";import"./git-merge-CB0ebeXg.js";import"./circle-x-BNvrcCvx.js";import"./eye-BAXsQYWt.js";import"./select-CkTnmILP.js";import"./index-BplxL2Qj.js";import"./chevron-down-BJhJsMnL.js";import"./check-Dj_ZR5Y7.js";import"./motion-Cyp39Uo1.js";import"./utils-VDOOGGvU.js";import"./ansi_to_html-DYje8R53.js";import"./chevron-right-PEOnBrxM.js";import"./dialog-DapeOKPE.js";import"./x-AprddF_b.js";import"./editor-utils-DgK9pIvP.js";import"./maximize-2-DW-IsQiI.js";import"./providers-Bv7fzJNY.js";import"./draft-store-DnVbStYY.js";import"./chevron-left-BVsM9RGq.js";import"./square-BqmNpRIH.js";import"./github-DiENtmNz.js";import"./globe-B1hiCqlb.js";import"./inbox-4g-W9WtW.js";import"./folder-open-BbwqJxUi.js";import"./copy-DXKK6zMx.js";const je=[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],ve=ge("grid-2x2",je),V=new Set(["running","waiting","pending"]),D=new Set(["completed","failed","stopped","interrupted"]),X=5,re=5;function we({cols:i,rows:d,onChange:h}){const[l,p]=n.useState(0),[j,v]=n.useState(0),[u,o]=n.useState(!1),r=u&&l>0?l:i,m=u&&j>0?j:d;return e.jsxs(W,{open:u,onOpenChange:o,children:[e.jsx(F,{asChild:!0,children:e.jsxs(H,{variant:"ghost",className:"h-6 min-w-0 gap-1.5 px-2 text-[10px]",children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),i,"×",d]})}),e.jsxs($,{className:"w-auto p-3",align:"end",sideOffset:4,children:[e.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:`repeat(${X}, 1fr)`},onMouseLeave:()=>{p(0),v(0)},children:Array.from({length:re},(g,f)=>Array.from({length:X},(B,w)=>{const y=w+1<=r&&f+1<=m;return e.jsx("button",{className:_("w-5 h-5 rounded-sm border transition-colors",y?"bg-primary border-primary":"bg-muted/40 border-border hover:border-muted-foreground/40"),onMouseEnter:()=>{p(w+1),v(f+1)},onClick:()=>{h(w+1,f+1),o(!1)}},`${w}-${f}`)}))}),e.jsxs("p",{className:"mt-2 text-center text-[10px] text-muted-foreground",children:[r,"×",m]})]})]})}const be=[ne],ye={code:({className:i,children:d,...h})=>i?.startsWith("language-")?e.jsx("code",{className:_("block bg-muted p-2 rounded text-xs font-mono overflow-x-auto",i),...h,children:d}):e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-xs",...h,children:d}),pre:({children:i})=>e.jsx("pre",{className:"my-2 overflow-x-auto rounded bg-muted p-2 font-mono",children:i})};function Ne(i){const d=[];let h;for(const o of i){const r=o.toolCalls?.some(m=>m.name==="ExitPlanMode");o.content&&o.content.trim()&&!r&&d.push({type:"message",msg:o});for(const m of o.toolCalls??[]){if(m.name==="Write")try{const g=typeof m.input=="string"?JSON.parse(m.input):m.input,f=g?.file_path||"";/plan\.md$/i.test(f)&&typeof g?.content=="string"&&(h=g.content)}catch{}m.name==="ExitPlanMode"&&(m._planText=h||o.content?.trim()||void 0),d.push({type:"toolcall",tc:m})}}const l=new Set(["AskUserQuestion","ExitPlanMode"]),p=[];for(const o of d)if(o.type==="toolcall"){const r=p[p.length-1];!l.has(o.tc.name)&&r?.type==="toolcall"&&r.tc.name===o.tc.name?p[p.length-1]={type:"toolcall-group",name:o.tc.name,calls:[r.tc,o.tc]}:!l.has(o.tc.name)&&r?.type==="toolcall-group"&&r.name===o.tc.name?r.calls.push(o.tc):p.push(o)}else p.push(o);let j=-1;for(let o=p.length-1;o>=0;o--){const r=p[o];if(r.type==="toolcall"&&r.tc.name==="TodoWrite"||r.type==="toolcall-group"&&r.name==="TodoWrite"){j=o;break}}const v=[];for(let o=0;o<p.length;o++){const r=p[o],m=r.type==="toolcall"&&r.tc.name==="TodoWrite"||r.type==="toolcall-group"&&r.name==="TodoWrite";m&&o!==j||(m&&r.type==="toolcall-group"?v.push({type:"toolcall",tc:r.calls[r.calls.length-1]}):v.push(r))}const u=[];for(const o of v)if(o.type==="toolcall"||o.type==="toolcall-group"){const r=u[u.length-1];r?.type==="toolcall-run"?r.items.push(o):r?.type==="toolcall"||r?.type==="toolcall-group"?u[u.length-1]={type:"toolcall-run",items:[r,o]}:u.push(o)}else u.push(o);return u}const Se=n.memo(function({threadId:d}){const{t:h}=te();ue();const[l,p]=n.useState(null),[j,v]=n.useState(!0),u=n.useRef(null),o=n.useRef(!1),r=n.useRef(!1),m=Z(s=>s.projects),g=U(s=>{for(const a of Object.values(s.threadsByProject)){const c=a.find(T=>T.id===d);if(c)return c.status}return null});n.useEffect(()=>{let s=!1;return v(!0),I.getThread(d,50).then(a=>{s||(a.isOk()&&p(a.value),v(!1))}),()=>{s=!0}},[d]);const f=g?V.has(g):!0;n.useEffect(()=>{if(!f)return;const s=setInterval(async()=>{const a=await I.getThread(d,50);a.isOk()&&p(a.value)},3e3);return()=>clearInterval(s)},[d,f]);const B=l?.messages?.length,w=l?.messages?.at(-1)?.content?.length,y=l?.messages?.at(-1)?.toolCalls?.length;n.useLayoutEffect(()=>{const s=u.current;!s||!l||o.current||(r.current?(r.current=!1,requestAnimationFrame(()=>{s.scrollTo({top:s.scrollHeight,behavior:"smooth"})})):s.scrollTop=s.scrollHeight)},[B,w,y]);const P=n.useCallback(()=>{const s=u.current;if(!s)return;const{scrollTop:a,scrollHeight:c,clientHeight:T}=s,A=c-a-T<=80;o.current=!A},[]);n.useEffect(()=>{const s=u.current;if(s)return s.addEventListener("scroll",P,{passive:!0}),()=>s.removeEventListener("scroll",P)},[P]);const C=l?.projectId,k=n.useMemo(()=>C?m.find(a=>a.id===C)?.name??"":"",[C,m]),[b,R]=n.useState(!1),E=n.useCallback(async(s,a,c)=>{if(b||!l)return;R(!0),o.current=!1,r.current=!0,n.startTransition(()=>{me.getState().appendOptimisticMessage(d,s,c,a.model,a.mode)});const{allowedTools:T,disallowedTools:A}=oe(se.getState().toolPermissions);await I.sendMessage(d,s,{provider:a.provider||void 0,model:a.model||void 0,permissionMode:a.mode||void 0,allowedTools:T,disallowedTools:A,fileReferences:a.fileReferences},c),R(!1)},[b,d,l]),M=n.useCallback(async()=>{await I.stopThread(d)},[d]),N=g??l?.status??"idle",t=J[N]?.icon??q,x=J[N]?.className??"";if(j)return e.jsx("div",{className:"flex min-h-0 items-center justify-center rounded-sm border border-border",children:e.jsx(q,{className:"h-5 w-5 animate-spin text-muted-foreground"})});if(!l)return e.jsx("div",{className:"flex min-h-0 items-center justify-center rounded-sm border border-border text-xs text-muted-foreground",children:h("thread.notFound","Thread not found")});const S=N==="running";return e.jsxs("div",{className:"flex min-w-0 flex-col overflow-hidden rounded-sm border border-border",children:[e.jsxs("div",{className:"flex-shrink-0 border-b border-border bg-sidebar/50 px-3 py-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(t,{className:_("h-3.5 w-3.5 shrink-0",x)}),e.jsx("span",{className:"flex-1 truncate text-sm font-medium",title:l.title,children:l.title})]}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-1.5",children:[k&&e.jsx(ee,{variant:"outline",className:"h-4 shrink-0 px-1.5 py-0 text-[10px] font-normal",children:k}),(l.branch||l.baseBranch)&&e.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[e.jsx(ie,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:l.branch||l.baseBranch})]})]})]}),e.jsx(le,{className:"min-h-0 flex-1 px-2 [&_[data-radix-scroll-area-viewport]>div]:!flex [&_[data-radix-scroll-area-viewport]>div]:min-h-full [&_[data-radix-scroll-area-viewport]>div]:!flex-col",viewportRef:u,children:e.jsxs("div",{className:"mt-auto space-y-2 py-2",children:[Ne(l.messages??[]).map(s=>{const a=c=>c.type==="toolcall"?e.jsx("div",{children:e.jsx(fe,{name:c.tc.name,input:c.tc.input,output:c.tc.output,planText:c.tc._planText})},c.tc.id):c.type==="toolcall-group"?e.jsx("div",{children:e.jsx(he,{name:c.name,calls:c.calls})},c.calls[0].id):null;if(s.type==="message"){const c=s.msg;return e.jsx("div",{className:_("text-sm leading-relaxed",c.role==="user"?"max-w-[90%] ml-auto rounded-md px-2 py-1.5 bg-foreground text-background":"w-full text-foreground"),children:c.role==="user"?e.jsx("pre",{className:"max-h-80 overflow-x-auto overflow-y-auto whitespace-pre-wrap break-words font-mono text-xs",children:c.content.trim()}):e.jsx("div",{className:"prose prose-sm max-w-none overflow-x-auto break-words",children:e.jsx(ae,{remarkPlugins:be,components:ye,children:c.content.trim()})})},c.id)}return s.type==="toolcall"||s.type==="toolcall-group"?a(s):s.type==="toolcall-run"?e.jsx("div",{className:"space-y-0.5",children:s.items.map(a)},s.items[0].type==="toolcall"?s.items[0].tc.id:s.items[0].calls[0].id):null}),S&&e.jsxs("div",{className:"flex items-center gap-1.5 py-0.5 text-xs text-muted-foreground",children:[e.jsx(pe,{size:"sm"}),e.jsx("span",{children:h("thread.agentWorking")})]})]})}),e.jsx(xe,{onSubmit:E,onStop:M,loading:b,running:S,placeholder:h("thread.nextPrompt")})]})});function ht(){const{t:i}=te();de(),ce();const d=U(t=>t.threadsByProject),h=Z(t=>t.projects),l=U(t=>t.loadThreadsForProject),p=se(t=>t.toolPermissions),[j,v]=n.useState(()=>{const t=localStorage.getItem("funny:grid-cols");return t?Math.min(Math.max(Number(t),1),X):2}),[u,o]=n.useState(()=>{const t=localStorage.getItem("funny:grid-rows");return t?Math.min(Math.max(Number(t),1),re):2}),r=j*u,[m,g]=n.useState(!1),[f,B]=n.useState(void 0),[w,y]=n.useState(!1),[P,C]=n.useState(!1),[k,b]=n.useState(""),R=n.useCallback(t=>{B(t),g(!0)},[]),E=n.useCallback(async(t,x,S)=>{if(!f||w)return!1;y(!0);const s=h.find(O=>O.id===f),a=x.threadMode||s?.defaultMode||"worktree";if(x.sendToBacklog){const O=await I.createIdleThread({projectId:f,title:t.slice(0,200),mode:a,baseBranch:x.baseBranch,prompt:t,images:S});return O.isErr()?(L.error(O.error.message),y(!1),!1):(await l(f),y(!1),L.success(i("toast.threadCreated",{title:t.slice(0,200)})),!0)}const{allowedTools:c,disallowedTools:T}=oe(p),A=await I.createThread({projectId:f,title:t.slice(0,200),mode:a,model:x.model,prompt:t,permissionMode:x.mode,allowedTools:c,disallowedTools:T,baseBranch:x.baseBranch,images:S});return A.isErr()?(L.error(A.error.message),y(!1),!1):(await l(f),y(!1),L.success(i("toast.threadCreated",{title:t.slice(0,200)})),!0)},[f,w,h,p,l,i]),M=k?h.filter(t=>t.name.toLowerCase().includes(k.toLowerCase())):h;n.useEffect(()=>{const t=()=>{for(const S of h)l(S.id)};t();const x=setInterval(t,5e3);return()=>clearInterval(x)},[h,l]);const N=n.useMemo(()=>{const t=[],x=[];for(const s of Object.values(d))for(const a of s)a.archived||(V.has(a.status)?t.push(a):D.has(a.status)&&x.push(a));x.sort((s,a)=>{const c=new Date(s.completedAt??s.createdAt).getTime();return new Date(a.completedAt??a.createdAt).getTime()-c}),t.sort((s,a)=>new Date(a.createdAt).getTime()-new Date(s.createdAt).getTime());const S=Math.max(0,r-t.length);return[...t,...x.slice(0,S)]},[d,r]);return N.length===0?e.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2 border-b border-border px-4 py-2",children:[e.jsx(G,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:i("live.title","Grid")}),e.jsxs(W,{open:P,onOpenChange:t=>{C(t),t||b("")},children:[e.jsx(F,{asChild:!0,children:e.jsx(H,{variant:"ghost",className:"h-6 min-w-0 gap-1.5 px-2 text-[10px]",children:e.jsx(K,{className:"h-3.5 w-3.5"})})}),e.jsxs($,{align:"start",className:"w-56 p-0",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border/50 px-2.5 py-2",children:[e.jsx(Y,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx(z,{value:k,onChange:t=>b(t.target.value),placeholder:i("kanban.searchProject","Search project..."),className:"h-auto flex-1 border-0 bg-transparent px-0 py-0 text-xs shadow-none placeholder:text-muted-foreground focus-visible:ring-0",autoFocus:!0})]}),e.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:M.length===0?e.jsx("div",{className:"py-3 text-center text-xs text-muted-foreground",children:i("commandPalette.noResults","No results")}):M.map(t=>e.jsxs("button",{className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs transition-colors hover:bg-accent",onClick:()=>{C(!1),b(""),R(t.id)},children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:t.color||"#3b82f6"}}),e.jsx("span",{className:"truncate",children:t.name})]},t.id))})]})]})]}),e.jsx("div",{className:"flex flex-1 items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsx(G,{className:"mx-auto h-10 w-10 text-muted-foreground/40"}),e.jsx("p",{className:"text-sm font-medium",children:i("live.noActiveThreads","No active threads")}),e.jsx("p",{className:"text-xs text-muted-foreground/60",children:i("live.noActiveThreadsDesc","Start some agents and they will appear here in real-time")})]})}),e.jsx(Q,{open:m,onClose:()=>g(!1),onSubmit:E,loading:w,projectId:f})]}):e.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2 border-b border-border px-4 py-2",children:[e.jsx(G,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:i("live.title","Grid")}),e.jsxs(ee,{variant:"outline",className:"h-4 px-1.5 py-0 text-[10px]",children:[N.filter(t=>V.has(t.status)).length," ",i("live.active","active"),N.some(t=>D.has(t.status))&&e.jsxs("span",{className:"ml-1 text-muted-foreground",children:["+ ",N.filter(t=>D.has(t.status)).length," ",i("live.recent","recent")]})]}),e.jsxs(W,{open:P,onOpenChange:t=>{C(t),t||b("")},children:[e.jsx(F,{asChild:!0,children:e.jsx(H,{variant:"ghost",className:"h-6 min-w-0 gap-1.5 px-2 text-[10px]",children:e.jsx(K,{className:"h-3.5 w-3.5"})})}),e.jsxs($,{align:"start",className:"w-56 p-0",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border/50 px-2.5 py-2",children:[e.jsx(Y,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx(z,{value:k,onChange:t=>b(t.target.value),placeholder:i("kanban.searchProject","Search project..."),className:"h-auto flex-1 border-0 bg-transparent px-0 py-0 text-xs shadow-none placeholder:text-muted-foreground focus-visible:ring-0",autoFocus:!0})]}),e.jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:M.length===0?e.jsx("div",{className:"py-3 text-center text-xs text-muted-foreground",children:i("commandPalette.noResults","No results")}):M.map(t=>e.jsxs("button",{className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs transition-colors hover:bg-accent",onClick:()=>{C(!1),b(""),R(t.id)},children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:t.color||"#3b82f6"}}),e.jsx("span",{className:"truncate",children:t.name})]},t.id))})]})]}),e.jsx("div",{className:"ml-auto",children:e.jsx(we,{cols:j,rows:u,onChange:(t,x)=>{v(t),o(x),localStorage.setItem("funny:grid-cols",String(t)),localStorage.setItem("funny:grid-rows",String(x))}})})]}),e.jsx("div",{className:"min-h-0 flex-1 gap-2 overflow-auto p-2",style:{display:"grid",gridTemplateColumns:`repeat(${j}, minmax(400px, 1fr))`,gridTemplateRows:`repeat(${u}, 1fr)`},children:N.slice(0,r).map(t=>e.jsx(Se,{threadId:t.id},t.id))}),e.jsx(Q,{open:m,onClose:()=>g(!1),onSubmit:E,loading:w,projectId:f})]})}export{ht as LiveColumnsView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,j as e}from"./markdown-9_JKOUHQ.js";import{B as g}from"./button-D8qrc3hb.js";import{u as f,I as i}from"./input-Dyxe5hqI.js";import{u as j}from"./index-Z_QI94Zg.js";import"./createLucideIcon-CsWFljth.js";import"./mermaid-C0IQv4mH.js";function I(){const{t:s}=f(),c=j(t=>t.login),[r,m]=a.useState(""),[o,h]=a.useState(""),[n,l]=a.useState(""),[u,d]=a.useState(!1),x=async t=>{t.preventDefault(),l(""),d(!0);try{await c(r,o)}catch(p){l(p.message||s("auth.loginFailed"))}finally{d(!1)}};return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6 rounded-lg border border-border bg-card p-8 shadow-lg",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:s("app.title")}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s("auth.signInPrompt")})]}),e.jsxs("form",{onSubmit:x,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"username",className:"text-sm font-medium text-foreground",children:s("auth.username")}),e.jsx(i,{id:"username",type:"text",value:r,onChange:t=>m(t.target.value),placeholder:s("auth.usernamePlaceholder"),autoFocus:!0,required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"password",className:"text-sm font-medium text-foreground",children:s("auth.password")}),e.jsx(i,{id:"password",type:"password",value:o,onChange:t=>h(t.target.value),placeholder:s("auth.passwordPlaceholder"),required:!0})]}),n&&e.jsx("p",{className:"text-sm text-destructive",children:n}),e.jsx(g,{type:"submit",className:"w-full",disabled:u||!r||!o,children:s(u?"auth.signingIn":"auth.signIn")})]})]})})}export{I as LoginPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as m}from"./markdown-9_JKOUHQ.js";import{e as B,f as E,A as S,t as L}from"./use-ws-BIe6kKa2.js";import{B as k}from"./badge-CrCqde50.js";import{S as D}from"./scroll-area-Bj4yTRJP.js";import{c as M,j as V,T as H,b as T}from"./index-Z_QI94Zg.js";import{g as $,r as C}from"./use-minute-tick-BoS3Ec2H.js";import{u as x}from"./app-store-B3iAaYzj.js";import{s as O,C as W,M as _,S as q,W as U,A as Q,a as z}from"./ThreadView-DsqoxCXZ.js";import{T as G,D as J}from"./ToolCallGroup-BgROpRwn.js";import{P}from"./PromptInput-Cq_fXmwj.js";import{u as y}from"./input-Dyxe5hqI.js";import{L as A}from"./button-D8qrc3hb.js";import{F as K}from"./folder-d8RRIu-j.js";import{P as X}from"./plus-ChfperZy.js";import"./createLucideIcon-CsWFljth.js";import"./terminal-CuAYwdh-.js";import"./mermaid-C0IQv4mH.js";import"./index-DmIp58b6.js";import"./git-merge-CB0ebeXg.js";import"./circle-x-BNvrcCvx.js";import"./eye-BAXsQYWt.js";import"./select-CkTnmILP.js";import"./index-BplxL2Qj.js";import"./chevron-down-BJhJsMnL.js";import"./check-Dj_ZR5Y7.js";import"./collapsible-DP3s_8s3.js";import"./utils-VDOOGGvU.js";import"./minimize-2-CWn5BNKr.js";import"./rotate-ccw-DFiWNcpH.js";import"./upload-DXXUmYu2.js";import"./breadcrumb-BiY69_Mg.js";import"./chevron-right-PEOnBrxM.js";import"./dialog-DapeOKPE.js";import"./x-AprddF_b.js";import"./dropdown-menu-Bi54WPTK.js";import"./popover-CRZjc4jI.js";import"./folder-open-BbwqJxUi.js";import"./columns-3-DhvlrNjA.js";import"./globe-B1hiCqlb.js";import"./external-link-Dg0Hq511.js";import"./square-BqmNpRIH.js";import"./copy-DXKK6zMx.js";import"./clipboard-list-zkC7qTDO.js";import"./pin-off-DpiyTpTd.js";import"./pin-uzq68OVB.js";import"./trash-2-QvY6JeI_.js";import"./editor-utils-DgK9pIvP.js";import"./arrow-down-DQYiOM3D.js";import"./motion-Cyp39Uo1.js";import"./ansi_to_html-DYje8R53.js";import"./maximize-2-DW-IsQiI.js";import"./providers-Bv7fzJNY.js";import"./draft-store-DnVbStYY.js";import"./chevron-left-BVsM9RGq.js";import"./github-DiENtmNz.js";import"./inbox-4g-W9WtW.js";const I={idle:"bg-status-neutral/10 text-status-neutral/80",pending:"bg-status-pending/10 text-status-pending/80",running:"bg-status-info/10 text-status-info/80",waiting:"bg-status-warning/10 text-status-warning/80",completed:"bg-status-success/10 text-status-success/80",failed:"bg-status-error/10 text-status-error/80",stopped:"bg-status-neutral/10 text-status-neutral/80",interrupted:"bg-status-interrupted/10 text-status-interrupted/80"};function F({status:i}){const{t:n}=y(),d=I[i]??I.pending,a={...$(n),completed:n("thread.status.done")};return e.jsxs("span",{className:M("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",d),children:[i==="running"&&e.jsx("span",{className:"mr-1 h-1.5 w-1.5 animate-pulse rounded-full bg-status-info"}),i==="waiting"&&e.jsx("span",{className:"mr-1 h-1.5 w-1.5 animate-pulse rounded-full bg-status-warning"}),a[i]]})}function nt(){const{t:i}=y(),[n,d]=m.useState({screen:"projects"}),[a,u]=m.useState(!1),s=x(c=>c.loadProjects),w=x(c=>c.projects);return B(),m.useEffect(()=>{V().then(()=>s()).finally(()=>u(!0))},[s]),a?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-background text-foreground",children:[n.screen==="projects"&&e.jsx(Y,{projects:w,onSelect:c=>d({screen:"threads",projectId:c})}),n.screen==="threads"&&e.jsx(Z,{projectId:n.projectId,onBack:()=>d({screen:"projects"}),onSelectThread:c=>d({screen:"chat",projectId:n.projectId,threadId:c}),onNewThread:()=>d({screen:"newThread",projectId:n.projectId})}),n.screen==="newThread"&&e.jsx(ee,{projectId:n.projectId,onBack:()=>d({screen:"threads",projectId:n.projectId}),onCreated:c=>d({screen:"chat",projectId:n.projectId,threadId:c})}),n.screen==="chat"&&e.jsx(te,{projectId:n.projectId,threadId:n.threadId,onBack:()=>d({screen:"threads",projectId:n.projectId})})]}),e.jsx(E,{position:"top-center",duration:H})]}):e.jsx("div",{className:"flex h-[100dvh] items-center justify-center bg-background text-foreground",children:e.jsx(A,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}function Y({projects:i,onSelect:n}){const{t:d}=y();return e.jsxs(e.Fragment,{children:[e.jsx("header",{className:"flex shrink-0 items-center border-b border-border px-4 py-3",children:e.jsx("h1",{className:"text-base font-semibold",children:"funny"})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:i.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-4 text-sm text-muted-foreground",children:d("sidebar.noProjects","No projects yet. Add one from the desktop app.")}):e.jsx("div",{className:"space-y-1 p-2",children:i.map(a=>e.jsxs("button",{onClick:()=>n(a.id),className:"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left transition-colors hover:bg-accent active:bg-accent/80",children:[e.jsx(K,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:a.name}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a.path})]})]},a.id))})})]})}function Z({projectId:i,onBack:n,onSelectThread:d,onNewThread:a}){const{t:u}=y(),s=x(r=>r.projects),w=x(r=>r.threadsByProject),c=x(r=>r.loadThreadsForProject),f=s.find(r=>r.id===i),j=w[i]??[];m.useEffect(()=>{c(i)},[i,c]);const g=[...j].filter(r=>!r.archived).sort((r,h)=>{const p=["running","waiting"],b=p.includes(r.status)?0:1,N=p.includes(h.status)?0:1;return b!==N?b-N:new Date(h.createdAt).getTime()-new Date(r.createdAt).getTime()});return e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[e.jsx("button",{onClick:n,"aria-label":u("common.back","Back"),className:"-ml-1 rounded p-1 hover:bg-accent",children:e.jsx(S,{className:"h-5 w-5"})}),e.jsx("h1",{className:"flex-1 truncate text-base font-semibold",children:f?.name??"Project"}),e.jsxs("button",{onClick:a,className:"flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground active:bg-primary/80",children:[e.jsx(X,{className:"h-3.5 w-3.5"}),u("sidebar.newThread","New")]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:g.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-4 text-sm text-muted-foreground",children:u("sidebar.noThreads","No threads yet. Create one to start.")}):e.jsx("div",{className:"space-y-1 p-2",children:g.map(r=>e.jsxs("button",{onClick:()=>d(r.id),className:"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left transition-colors hover:bg-accent active:bg-accent/80",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-medium",children:r.title}),e.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:new Intl.DateTimeFormat(void 0,{dateStyle:"medium"}).format(new Date(r.createdAt))})]}),e.jsx(F,{status:r.status})]},r.id))})})]})}function ee({projectId:i,onBack:n,onCreated:d}){const{t:a}=y(),u=x(r=>r.loadThreadsForProject),c=x(r=>r.projects).find(r=>r.id===i)?.defaultMode??"worktree",[f,j]=m.useState(!1),g=async(r,h,p)=>{if(f)return!1;j(!0);const b=await T.createThread({projectId:i,title:r.slice(0,200),mode:h.threadMode||c,model:h.model,permissionMode:h.mode,baseBranch:h.baseBranch,prompt:r,images:p});return b.isErr()?(L.error(b.error.message),j(!1),!1):(await u(i),d(b.value.id),!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[e.jsx("button",{onClick:n,"aria-label":a("common.back","Back"),className:"-ml-1 rounded p-1 hover:bg-accent",children:e.jsx(S,{className:"h-5 w-5"})}),e.jsx("h1",{className:"text-base font-semibold",children:a("thread.newThread","New Thread")})]}),e.jsx("div",{className:"flex flex-1 items-center justify-center p-4 text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"mb-4 text-4xl",children:"✨"}),e.jsx("p",{className:"text-2xl font-semibold text-foreground",children:a("thread.whatShouldAgentDo")}),e.jsx("p",{className:"mt-2 text-sm",children:a("thread.describeTask")})]})}),e.jsx(P,{onSubmit:g,loading:f,isNewThread:!0,showBacklog:!0,projectId:i})]})}function te({projectId:i,threadId:n,onBack:d}){const{t:a}=y(),u=x(t=>t.selectThread),s=x(t=>t.activeThread),[w,c]=m.useState(!1),f=m.useRef(null),j=m.useRef(!1),g=m.useRef(!1);m.useEffect(()=>(u(n),()=>{u(null)}),[n,u]);const r=O(s),h=[s?.messages?.length,r?.content?.length,r?.toolCalls?.length,s?.status].join(":");m.useEffect(()=>{const t=f.current;if(!t)return;const o=()=>{const{scrollTop:l,scrollHeight:v,clientHeight:R}=t;j.current=v-l-R>80};return t.addEventListener("scroll",o,{passive:!0}),()=>t.removeEventListener("scroll",o)},[]),m.useEffect(()=>{const t=f.current;if(!t)return;const o=()=>{j.current||(g.current?(g.current=!1,t.scrollTo({top:t.scrollHeight,behavior:"smooth"})):t.scrollTop=t.scrollHeight)};o();const l=new MutationObserver(()=>{requestAnimationFrame(o)});l.observe(t,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const v=setTimeout(()=>l.disconnect(),1500);return()=>{clearTimeout(v),l.disconnect()}},[h]);const p=async(t,o,l)=>{if(!s||w)return;c(!0),j.current=!1,g.current=!0,x.getState().appendOptimisticMessage(s.id,t,l,o.model,o.mode);const v=await T.sendMessage(s.id,t,{provider:o.provider||void 0,model:o.model||void 0,permissionMode:o.mode||void 0},l);v.isErr()&&console.error("Send failed:",v.error),c(!1)},b=async()=>{if(!s)return;const t=await T.stopThread(s.id);t.isErr()&&console.error("Stop failed:",t.error)},N=s?.status==="running";return e.jsxs(e.Fragment,{children:[e.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3",children:[e.jsx("button",{onClick:d,"aria-label":a("common.back","Back"),className:"-ml-1 rounded p-1 hover:bg-accent",children:e.jsx(S,{className:"h-5 w-5"})}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("h1",{className:"truncate text-sm font-semibold",children:s?.title??a("thread.loading","Loading...")})}),s&&e.jsx(F,{status:s.status})]}),s?e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"flex-1 p-3",viewportRef:f,children:e.jsxs("div",{className:"space-y-3",children:[s.initInfo&&e.jsx("div",{className:"space-y-1 rounded-lg border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:a("initInfo.model")}),e.jsx("span",{className:"font-mono",children:C(s.initInfo.model,a)})]})}),s.messages?.flatMap(t=>[t.content&&!t.toolCalls?.some(o=>o.name==="ExitPlanMode")&&e.jsxs("div",{className:M("relative group rounded-lg px-3 py-2 text-sm w-fit max-w-full",t.role==="user"?"ml-auto bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground"),children:[t.role!=="user"&&e.jsxs("div",{className:"mb-0.5 flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 text-xs font-medium uppercase text-muted-foreground",children:t.role}),e.jsx(W,{content:t.content})]}),t.images&&t.images.length>0&&e.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:t.images.map((o,l)=>e.jsx("img",{src:`data:${o.source.media_type};base64,${o.source.data}`,alt:`Attachment ${l+1}`,width:128,height:128,className:"max-h-32 rounded border border-border"},`attachment-${l}`))}),t.role==="user"?e.jsxs(e.Fragment,{children:[e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words font-mono text-xs leading-relaxed",children:t.content.trim()}),(t.model||t.permissionMode)&&e.jsxs("div",{className:"mt-1.5 flex gap-1",children:[t.model&&e.jsx(k,{variant:"outline",className:"h-4 border-primary-foreground/20 bg-primary-foreground/10 px-1.5 py-0 text-[10px] font-medium text-primary-foreground/70",children:C(t.model,a)}),t.permissionMode&&e.jsx(k,{variant:"outline",className:"h-4 border-primary-foreground/20 bg-primary-foreground/10 px-1.5 py-0 text-[10px] font-medium text-primary-foreground/70",children:a(`prompt.${t.permissionMode}`)})]})]}):e.jsx("div",{className:"overflow-x-auto break-words text-xs leading-relaxed",children:e.jsx(_,{content:t.content.trim()})})]},t.id),...t.toolCalls?.map(o=>e.jsx(G,{name:o.name,input:o.input,output:o.output,planText:o.name==="ExitPlanMode"&&t.content?.trim()?t.content.trim():void 0,onRespond:o.name==="AskUserQuestion"||o.name==="ExitPlanMode"?l=>p(l,{model:"",mode:""}):void 0},o.id))??[]]),N&&e.jsxs("div",{className:"flex items-center gap-2.5 py-1 text-sm text-muted-foreground",children:[e.jsx(J,{}),e.jsx("span",{className:"text-xs",children:a("thread.agentWorking")})]}),s.status==="waiting"&&s.waitingReason==="question"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-status-warning/80",children:[e.jsx(q,{className:"h-3.5 w-3.5 animate-pulse"}),a("thread.waitingForResponse")]}),s.status==="waiting"&&s.waitingReason!=="question"&&s.waitingReason!=="plan"&&e.jsx(U,{onSend:t=>p(t,{model:"",mode:""})}),s.resultInfo&&!N&&s.status!=="stopped"&&s.status!=="interrupted"&&e.jsx(Q,{status:s.resultInfo.status,cost:s.resultInfo.cost,duration:s.resultInfo.duration,onContinue:s.resultInfo.status==="failed"?()=>p("Continue",{model:"",mode:""}):void 0}),s.status==="interrupted"&&e.jsx(z,{onContinue:()=>p("Continue",{model:"",mode:""})})]})}),e.jsx(P,{onSubmit:p,onStop:b,loading:w,running:N,placeholder:a("thread.nextPrompt")})]}):e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(A,{className:"h-5 w-5 animate-spin text-muted-foreground"})})]})}export{nt as MobilePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,j as e,M as B,d as T}from"./markdown-9_JKOUHQ.js";import{d as I}from"./monaco-CvC2RZDL.js";import{aB as N}from"./mermaid-C0IQv4mH.js";import{F as q,c as S,b as H}from"./index-Z_QI94Zg.js";import{t as b}from"./use-ws-BIe6kKa2.js";import{B as m,L as R}from"./button-D8qrc3hb.js";import{D as V,a as $,b as A,c as G}from"./dialog-DapeOKPE.js";import{S as W}from"./scroll-area-Bj4yTRJP.js";import{u as X}from"./input-Dyxe5hqI.js";import{c as w}from"./createLucideIcon-CsWFljth.js";import{E as Y}from"./eye-off-ICXVwkI1.js";import{E as J}from"./eye-BAXsQYWt.js";import{M as K}from"./minimize-2-CWn5BNKr.js";import{M as P}from"./maximize-2-DW-IsQiI.js";import{X as M}from"./x-AprddF_b.js";import"./terminal-CuAYwdh-.js";import"./index-DmIp58b6.js";const Q=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],U=w("book-open",Q);const Z=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],ee=w("code",Z);const se=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],te=w("save",se);function be({open:s,onOpenChange:a,filePath:r,initialContent:c}){const{t}=X(),{resolvedTheme:u}=q(),[n,i]=o.useState(""),[C,g]=o.useState(""),[j,k]=o.useState(!1),[d,z]=o.useState(!0),[h,E]=o.useState(!1),L=re(r),y=ne(L),x=y==="markdown",[p,O]=o.useState(x),f=n!==C,_=u==="monochrome"?"vs":"funny-dark",D=l=>{l.editor.defineTheme("funny-dark",{base:"vs-dark",inherit:!0,rules:[],colors:{"editor.background":"#000000","editorGutter.background":"#000000","minimap.background":"#0a0a0a"}})};o.useEffect(()=>{!s||!c||(i(c),g(c))},[s,c]);const F=async()=>{k(!0);const l=await H.writeFile(r,n);k(!1),l.isOk()?(g(n),b.success(t("editor.saved","File saved"))):b.error(t("editor.failedToSave","Failed to save file"),{description:l.error.message})},v=()=>{f&&!confirm(t("editor.unsavedChanges","You have unsaved changes. Close without saving?"))||a(!1)};return e.jsx(V,{open:s,onOpenChange:v,children:e.jsxs($,{className:S(h?"max-w-[100vw] max-h-[100vh] w-[100vw] h-[100vh] p-0":"max-w-5xl max-h-[85vh] h-[85vh] p-0","[&>button:last-child]:hidden","!duration-0","overflow-hidden"),children:[e.jsx(A,{className:"overflow-hidden border-b border-border/50 px-6 pb-2 pt-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(G,{className:"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-sm",style:{direction:"rtl",textAlign:"left"},children:r}),e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1",children:[x&&e.jsx(m,{variant:"ghost",size:"icon",onClick:()=>O(!p),title:p?t("editor.showCode","Show code"):t("editor.showPreview","Show preview"),className:"h-8 w-8",children:p?e.jsx(ee,{className:"h-4 w-4"}):e.jsx(U,{className:"h-4 w-4"})}),e.jsx(m,{variant:"ghost",size:"icon",onClick:()=>z(!d),title:t(d?"editor.hideMinimap":"editor.showMinimap"),className:"h-8 w-8",children:d?e.jsx(Y,{className:"h-4 w-4"}):e.jsx(J,{className:"h-4 w-4"})}),e.jsx(m,{variant:"ghost",size:"icon",onClick:()=>E(!h),title:t(h?"editor.exitFullscreen":"editor.fullscreen"),className:"h-8 w-8",children:h?e.jsx(K,{className:"h-4 w-4"}):e.jsx(P,{className:"h-4 w-4"})}),e.jsx(m,{variant:"ghost",size:"icon",onClick:v,title:t("common.close","Close"),className:"h-8 w-8",children:e.jsx(M,{className:"h-4 w-4"})})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:p&&x?e.jsx(W,{className:"h-full",children:e.jsx("div",{className:"prose prose-sm max-w-none px-8 py-6",children:e.jsx(B,{remarkPlugins:[T],components:oe,children:n})})}):e.jsx(I,{height:"100%",language:y,theme:_,beforeMount:D,value:n,onChange:l=>i(l||""),options:{minimap:{enabled:d},fontSize:13,lineNumbers:"on",automaticLayout:!0,scrollBeyondLastLine:!1,wordWrap:"on"}})}),e.jsxs("div",{className:"flex items-center justify-between border-t border-border/50 px-6 py-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:f&&e.jsx("span",{children:t("editor.modified","Modified")})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(m,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(M,{className:"mr-1 h-3.5 w-3.5"}),t("common.cancel","Cancel")]}),e.jsxs(m,{size:"sm",onClick:F,disabled:!f||j,children:[j?e.jsx(R,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):e.jsx(te,{className:"mr-1 h-3.5 w-3.5"}),t("common.save","Save")]})]})]})]})})}function ae({chart:s}){const a=o.useRef(null),[r,c]=o.useState(""),[t,u]=o.useState("");return o.useEffect(()=>{let n=!1;return N.initialize({startOnLoad:!1,theme:"dark"}),N.render(`mermaid-${Math.random().toString(36).slice(2)}`,s).then(({svg:i})=>{n||c(i)}).catch(i=>{n||u(i instanceof Error?i.message:String(i))}),()=>{n=!0}},[s]),t?e.jsx("pre",{className:"overflow-auto rounded bg-red-950/30 p-3 text-xs text-red-400",children:t}):e.jsx("div",{ref:a,className:"my-4 flex justify-center [&>svg]:max-w-full",dangerouslySetInnerHTML:{__html:r}})}const oe={code({className:s,children:a,...r}){return/language-(\w+)/.exec(s||"")?.[1]==="mermaid"?e.jsx(ae,{chart:String(a).trim()}):s?e.jsx("code",{className:S("text-xs",s),...r,children:a}):e.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",...r,children:a})},pre({children:s}){return e.jsx("pre",{className:"overflow-auto rounded-md bg-muted/50 p-3 text-sm",children:s})}};function re(s){const a=s.lastIndexOf("."),r=Math.max(s.lastIndexOf("/"),s.lastIndexOf("\\"));return a>r?s.substring(a+1):""}function ne(s){return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",md:"markdown",mdx:"markdown",json:"json",yaml:"yaml",yml:"yaml",toml:"toml",xml:"xml",html:"html",css:"css",scss:"scss",less:"less",sql:"sql",sh:"shell",bash:"shell",ps1:"powershell",dockerfile:"dockerfile",php:"php",vue:"vue",graphql:"graphql"}[s.toLowerCase()]||"plaintext"}export{be as MonacoEditorDialog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/event-DYHy0FJb.js","assets/core-BEOw45JP.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as p}from"./mermaid-C0IQv4mH.js";import{r as m,j as t}from"./markdown-9_JKOUHQ.js";import{c as E}from"./index-Z_QI94Zg.js";import{X as k}from"./x-AprddF_b.js";import{R as T}from"./refresh-cw-Svvcff2v.js";import{E as R}from"./external-link-Dg0Hq511.js";import"./createLucideIcon-CsWFljth.js";const h=!!window.__TAURI_INTERNALS__;function D(){const[i,u]=m.useState([]),[d,l]=m.useState(null),[w,f]=m.useState(0),s=i.find(e=>e.commandId===d);m.useEffect(()=>{if(!h)return;const e=[];return(async()=>{const{listen:r,emit:c}=await p(async()=>{const{listen:a,emit:o}=await import("./event-DYHy0FJb.js");return{listen:a,emit:o}},__vite__mapDeps([0,1])),I=await r("preview:add-tab",a=>{const o=a.payload;u(n=>n.some(x=>x.commandId===o.commandId)?n:[...n,o]),l(o.commandId)});e.push(I);const j=await r("preview:remove-tab",a=>{const{commandId:o}=a.payload;u(n=>n.filter(y=>y.commandId!==o)),l(n=>n===o?null:n)});e.push(j);const N=await r("preview:focus-tab",a=>{l(a.payload.commandId)});e.push(N);const _=await r("preview:refresh-tab",a=>{f(o=>o+1)});e.push(_),await c("preview:ready",{})})(),()=>{e.forEach(r=>r())}},[]),m.useEffect(()=>{d&&!i.some(e=>e.commandId===d)&&l(i[i.length-1]?.commandId??null)},[i,d]);const b=()=>f(e=>e+1),v=async e=>{if(u(r=>r.filter(c=>c.commandId!==e)),d===e){const r=i.filter(c=>c.commandId!==e);l(r[r.length-1]?.commandId??null)}if(h){const{emit:r}=await p(async()=>{const{emit:c}=await import("./event-DYHy0FJb.js");return{emit:c}},__vite__mapDeps([0,1]));r("preview:tab-closed",{commandId:e})}},g=()=>{s&&window.open(`http://localhost:${s.port}`,"_blank")};return t.jsxs("div",{className:"flex h-screen flex-col bg-background text-foreground",children:[t.jsxs("div",{className:"flex min-h-[36px] items-center border-b border-border bg-muted/30",children:[t.jsx("div",{className:"flex flex-1 items-center overflow-x-auto",children:i.map(e=>t.jsxs("div",{className:E("flex items-center gap-1.5 px-3 py-1.5 text-xs cursor-pointer border-r border-border min-w-0 max-w-[200px] group",e.commandId===d?"bg-background text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:()=>l(e.commandId),children:[t.jsx("span",{className:"truncate",children:e.label}),t.jsxs("span",{className:"flex-shrink-0 text-xs text-muted-foreground/60",children:[":",e.port]}),t.jsx("button",{onClick:r=>{r.stopPropagation(),v(e.commandId)},className:"ml-auto flex-shrink-0 opacity-0 transition-opacity hover:text-status-error group-hover:opacity-100",children:t.jsx(k,{className:"h-3 w-3"})})]},e.commandId))}),s&&t.jsxs("div",{className:"flex flex-shrink-0 items-center gap-1 px-2",children:[t.jsxs("span",{className:"mr-1 font-mono text-xs text-muted-foreground",children:["localhost:",s.port]}),t.jsx("button",{onClick:b,className:"rounded p-1 text-muted-foreground hover:text-foreground",title:"Refresh",children:t.jsx(T,{className:"h-3.5 w-3.5"})}),t.jsx("button",{onClick:g,className:"rounded p-1 text-muted-foreground hover:text-foreground",title:"Open in browser",children:t.jsx(R,{className:"h-3.5 w-3.5"})})]})]}),t.jsx("div",{className:"relative flex-1",children:s?t.jsx("iframe",{src:`http://localhost:${s.port}`,className:"h-full w-full border-0",title:`Preview: ${s.label}`},`${s.commandId}-${w}`):t.jsx("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:"No previews open. Start a command with a port to see it here."})})]})}export{D as PreviewBrowser};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,j as t}from"./markdown-9_JKOUHQ.js";import{u as he,b as A,t as me,A as is}from"./use-ws-BIe6kKa2.js";import{B as _e,L as ft}from"./button-D8qrc3hb.js";import{P as ds,a as us,b as fs}from"./popover-CRZjc4jI.js";import{u as hs,S as ht,a as mt,b as pt,c as xt,d as gt}from"./select-CkTnmILP.js";import{h as kt,n as ms,P as yt,p as ps,H as xs,g as gs,c as L,G as bs,b as V,k as vs,l as ws,m as ks}from"./index-Z_QI94Zg.js";import{p as ys,g as js,a as Ns}from"./providers-Bv7fzJNY.js";import{u as bt}from"./draft-store-DnVbStYY.js";import{X as Oe}from"./x-AprddF_b.js";import{C as Ss}from"./chevron-left-BVsM9RGq.js";import{C as Cs}from"./chevron-right-PEOnBrxM.js";import{u as jt}from"./input-Dyxe5hqI.js";import{c as pe}from"./createLucideIcon-CsWFljth.js";import{S as Ms}from"./square-BqmNpRIH.js";import{G as Is}from"./github-DiENtmNz.js";import{G as Ps}from"./globe-B1hiCqlb.js";import{G as ze}from"./use-minute-tick-BoS3Ec2H.js";import{I as Rs}from"./inbox-4g-W9WtW.js";import{F as Ts}from"./folder-open-BbwqJxUi.js";import{C as Nt}from"./copy-DXKK6zMx.js";import{C as Bs}from"./check-Dj_ZR5Y7.js";const Ds=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Es=pe("arrow-up",Ds);const Fs=[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],vt=pe("file-text",Fs);const As=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Ls=pe("paperclip",As);const $s=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Us=pe("zap",$s);var xe="Switch",[_s]=gs(xe),[Os,zs]=_s(xe),St=s.forwardRef((o,u)=>{const{__scopeSwitch:f,name:i,checked:p,defaultChecked:x,required:y,disabled:w,value:d="on",onCheckedChange:h,form:v,...P}=o,[R,n]=s.useState(null),D=kt(u,I=>n(I)),C=s.useRef(!1),M=R?v||!!R.closest("form"):!0,[T,j]=ms({prop:p,defaultProp:x??!1,onChange:h,caller:xe});return t.jsxs(Os,{scope:f,checked:T,disabled:w,children:[t.jsx(yt.button,{type:"button",role:"switch","aria-checked":T,"aria-required":y,"data-state":Pt(T),"data-disabled":w?"":void 0,disabled:w,value:d,...P,ref:D,onClick:ps(o.onClick,I=>{j(q=>!q),M&&(C.current=I.isPropagationStopped(),C.current||I.stopPropagation())})}),M&&t.jsx(It,{control:R,bubbles:!C.current,name:i,value:d,checked:T,required:y,disabled:w,form:v,style:{transform:"translateX(-100%)"}})]})});St.displayName=xe;var Ct="SwitchThumb",Mt=s.forwardRef((o,u)=>{const{__scopeSwitch:f,...i}=o,p=zs(Ct,f);return t.jsx(yt.span,{"data-state":Pt(p.checked),"data-disabled":p.disabled?"":void 0,...i,ref:u})});Mt.displayName=Ct;var Hs="SwitchBubbleInput",It=s.forwardRef(({__scopeSwitch:o,control:u,checked:f,bubbles:i=!0,...p},x)=>{const y=s.useRef(null),w=kt(y,x),d=hs(f),h=xs(u);return s.useEffect(()=>{const v=y.current;if(!v)return;const P=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(P,"checked").set;if(d!==f&&n){const D=new Event("click",{bubbles:i});n.call(v,f),v.dispatchEvent(D)}},[d,f,i]),t.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:f,...p,tabIndex:-1,ref:w,style:{...p.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});It.displayName=Hs;function Pt(o){return o?"checked":"unchecked"}var Rt=St,Ks=Mt;const Tt=s.forwardRef(({className:o,...u},f)=>t.jsx(Rt,{className:L("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",o),...u,ref:f,children:t.jsx(Ks,{className:L("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Tt.displayName=Rt.displayName;function Vs({images:o,initialIndex:u=0,open:f,onClose:i}){const[p,x]=s.useState(u);s.useEffect(()=>{x(u)},[u,f]);const y=s.useCallback(()=>{x(h=>(h+1)%o.length)},[o.length]),w=s.useCallback(()=>{x(h=>(h-1+o.length)%o.length)},[o.length]);if(s.useEffect(()=>{if(!f)return;const h=v=>{v.key==="Escape"&&i(),v.key==="ArrowRight"&&y(),v.key==="ArrowLeft"&&w()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[f,i,y,w]),!f||o.length===0)return null;const d=o[p];return bs.createPortal(t.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/80 duration-200 animate-in fade-in-0",onClick:i,children:[t.jsx("button",{onClick:i,className:"absolute right-4 top-4 z-10 rounded-full bg-black/50 p-2 text-white transition-colors hover:bg-black/70",children:t.jsx(Oe,{className:"h-5 w-5"})}),o.length>1&&t.jsx("button",{onClick:h=>{h.stopPropagation(),w()},className:"absolute left-4 z-10 rounded-full bg-black/50 p-2 text-white transition-colors hover:bg-black/70",children:t.jsx(Ss,{className:"h-6 w-6"})}),t.jsx("img",{src:d.src,alt:d.alt,className:"max-h-[90vh] max-w-[90vw] rounded-lg object-contain shadow-2xl",onClick:h=>h.stopPropagation()}),o.length>1&&t.jsx("button",{onClick:h=>{h.stopPropagation(),y()},className:"absolute right-4 z-10 rounded-full bg-black/50 p-2 text-white transition-colors hover:bg-black/70",children:t.jsx(Cs,{className:"h-6 w-6"})}),o.length>1&&t.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full bg-black/50 px-3 py-1 text-sm text-white",children:[p+1," / ",o.length]})]}),document.body)}function qs(o){const u=o.match(/[:/]([^/]+\/[^/]+?)(?:\.git)?$/);if(u)return u[1];try{return new URL(o).pathname.replace(/^\//,"").replace(/\.git$/,"")}catch{return o}}function Ws({items:o,label:u,displayValue:f,searchPlaceholder:i,noMatchText:p,emptyText:x,loadingText:y,loading:w,onSelect:d,onCopy:h,triggerClassName:v,triggerTitle:P,width:R="w-[28rem]"}){const[n,D]=s.useState(!1),[C,M]=s.useState(""),[T,j]=s.useState(-1),I=s.useRef(null),q=s.useRef(null),b=s.useRef([]),k=C?o.filter(c=>c.label.toLowerCase().includes(C.toLowerCase())):o;s.useEffect(()=>{j(-1)},[C]),s.useEffect(()=>{if(n&&!C){const c=k.findIndex(g=>g.isSelected);c>=0&&requestAnimationFrame(()=>{b.current[c]?.scrollIntoView({block:"nearest"})})}},[n]);const W=c=>{c.key==="ArrowDown"&&(c.preventDefault(),k.length>0&&(j(0),b.current[0]?.focus(),b.current[0]?.scrollIntoView({block:"nearest"})))},G=(c,g)=>{c.key==="ArrowDown"?(c.preventDefault(),g<k.length-1&&(j(g+1),b.current[g+1]?.focus(),b.current[g+1]?.scrollIntoView({block:"nearest"}))):c.key==="ArrowUp"?(c.preventDefault(),g>0?(j(g-1),b.current[g-1]?.focus(),b.current[g-1]?.scrollIntoView({block:"nearest"})):(j(-1),I.current?.focus())):c.key==="Enter"&&(c.preventDefault(),d(k[g].key),D(!1),M(""))};return t.jsxs(ds,{open:n,onOpenChange:c=>{D(c),c||(M(""),j(-1))},children:[t.jsx(us,{asChild:!0,children:t.jsxs("button",{className:v??"flex max-w-[300px] items-center gap-1 truncate rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:P,tabIndex:-1,children:[t.jsx(ze,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate font-mono",children:f})]})}),t.jsxs(fs,{side:"top",align:"start",className:L(R,"p-0 flex flex-col overflow-hidden"),style:{maxHeight:"min(70vh, 520px)"},onOpenAutoFocus:c=>{c.preventDefault(),I.current?.focus()},children:[t.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2",children:t.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:u})}),t.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain p-1",ref:q,style:{maxHeight:"min(60vh, 440px)"},children:[w&&o.length===0&&y&&t.jsx("p",{className:"py-3 text-center text-sm text-muted-foreground",children:y}),!w&&o.length===0&&x&&t.jsx("p",{className:"py-3 text-center text-sm text-muted-foreground",children:x}),!w&&o.length>0&&k.length===0&&t.jsx("p",{className:"py-3 text-center text-sm text-muted-foreground",children:p}),k.map((c,g)=>t.jsxs("div",{className:"group/item relative",children:[t.jsxs("button",{ref:$=>{b.current[g]=$},onClick:()=>{d(c.key),D(!1),M("")},onKeyDown:$=>G($,g),onFocus:()=>j(g),onMouseEnter:()=>{j(g),b.current[g]?.focus()},className:L("w-full flex items-center gap-2 rounded py-1.5 pl-2 text-left text-xs transition-colors outline-none",h?"pr-7":"pr-2",g===T?"bg-accent text-foreground":c.isSelected?"bg-accent/50 text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"truncate font-mono font-medium",children:c.label}),c.badge&&t.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] leading-none text-muted-foreground",children:c.badge})]}),c.detail&&t.jsx("span",{className:"block truncate font-mono text-xs text-muted-foreground/70",children:c.detail})]}),c.isSelected&&t.jsx(Bs,{className:"h-3 w-3 shrink-0 text-status-info"})]}),h&&t.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover/item:opacity-100",onClick:$=>{$.stopPropagation(),h(c.label)},tabIndex:-1,children:t.jsx(Nt,{className:"h-3 w-3"})})]},c.key))]}),t.jsx("div",{className:"border-t border-border px-2 py-1.5",children:t.jsx("input",{ref:I,type:"text",value:C,onChange:c=>M(c.target.value),onKeyDown:W,placeholder:i,"aria-label":u,autoComplete:"off",className:"w-full bg-transparent text-sm placeholder:text-muted-foreground focus:outline-none"})})]})]})}function wt({branches:o,selected:u,onChange:f}){const{t:i}=jt(),p=s.useMemo(()=>o.map(x=>({key:x,label:x,isSelected:x===u})),[o,u]);return t.jsx(Ws,{items:p,label:i("newThread.baseBranch","Base branch"),displayValue:u||i("newThread.selectBranch"),searchPlaceholder:i("newThread.searchBranches","Search branches…"),noMatchText:i("newThread.noBranchesMatch","No branches match"),onSelect:x=>f(x),onCopy:x=>{navigator.clipboard.writeText(x),me.success("Branch copied")},triggerClassName:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground transition-colors rounded hover:bg-muted truncate max-w-[200px]",width:"w-[30rem]"})}const gr=s.memo(function({onSubmit:u,onStop:f,loading:i=!1,running:p=!1,queuedCount:x=0,isQueueMode:y=!1,placeholder:w,isNewThread:d=!1,showBacklog:h=!1,projectId:v,initialPrompt:P,initialImages:R}){const{t:n}=jt(),D=he(e=>e.projects),C=he(e=>e.selectedProjectId),M=v||C?D.find(e=>e.id===(v||C)):void 0,T=M?.defaultProvider??"claude",j=M?.defaultModel??"sonnet",I=M?.defaultPermissionMode??"autoEdit",q=M?.defaultMode??"worktree",[b,k]=s.useState(P??""),[W,G]=s.useState(`${T}:${j}`),{provider:c,model:g}=s.useMemo(()=>ys(W),[W]),[$,Y]=s.useState(I),[He,Bt]=s.useState(q==="worktree"),Dt=s.useMemo(()=>js(n),[n]),Z=s.useMemo(()=>[{value:"plan",label:n("prompt.plan")},{value:"autoEdit",label:n("prompt.autoEdit")},{value:"confirmEdit",label:n("prompt.askBeforeEdits")}],[n]),ge=A(e=>e.activeThread?.permissionMode),Et=A(e=>e.activeThread?.worktreePath),J=A(e=>e.activeThread?.provider),Q=A(e=>e.activeThread?.model),Ke=A(e=>e.activeThread?.mode),_=A(e=>e.activeThread?.branch),be=A(e=>e.activeThread?.baseBranch),Ve=A(e=>e.activeThread?.contextUsage),[qe,We]=s.useState([]),[Ft,Ge]=s.useState(!1),[Xe,ve]=s.useState(""),[E,O]=s.useState([]),[Ye,At]=s.useState(!1),[Gs,we]=s.useState(null),[ke,ye]=s.useState(null),[Lt,Xs]=s.useState(!1),[ee,je]=s.useState([]),[Ne,X]=s.useState(""),B=s.useRef(null),$t=s.useCallback(e=>{B.current=e,e?.focus()},[]),te=s.useRef(null),[Ut,Ze]=s.useState(!1),[_t,Ot]=s.useState(0),[zt,Se]=s.useState(!1),Ce=s.useRef(!1);s.useEffect(()=>{P&&k(P),R?.length&&O(R)},[P,R]);const[Ht,Me]=s.useState([]),[Ie,Je]=s.useState(!1),[se,re]=s.useState(!1),[Kt,Vt]=s.useState(""),[ae,ne]=s.useState(0),Pe=s.useRef(null),[oe,ce]=s.useState(!1),[Qe,qt]=s.useState(""),[le,ie]=s.useState(0),[U,Wt]=s.useState([]),[Gt,et]=s.useState(!1),[Xt,Yt]=s.useState(!1),[F,z]=s.useState([]),Re=s.useRef(null),tt=s.useRef(-1),Te=s.useRef(void 0),de=he(e=>e.projects),N=he(e=>e.selectedProjectId),S=A(e=>e.selectedThreadId),{setPromptDraft:Be,clearPromptDraft:Zt}=bt(),st=s.useRef(null),rt=s.useRef(b),at=s.useRef(E),nt=s.useRef(F),ot=s.useRef(S);rt.current=b,at.current=E,nt.current=F,ot.current=S,s.useEffect(()=>{const e=st.current;if(st.current=S,e&&e!==S){const r=B.current?.value??b;Be(e,r,E,F)}if(S&&S!==e){const r=bt.getState().drafts[S];k(r?.prompt??""),O(r?.images??[]),z(r?.selectedFiles??[])}else S||(k(""),O([]),z([]))},[S]),s.useEffect(()=>()=>{if(Ce.current)return;const e=ot.current;if(e){const r=B.current?.value??rt.current;Be(e,r,at.current,nt.current)}},[Be]);const De=v||N,ue=s.useMemo(()=>De?de.find(e=>e.id===De)?.path??"":"",[De,de]),[fe,Jt]=s.useState(null),Ee=Et||ue,Fe=fe||Ee;s.useEffect(()=>{Jt(null)},[N,S]),s.useEffect(()=>{Je(!1),Me([])},[N]),s.useEffect(()=>{!d&&ge?Y(ge):d&&Y(I)},[d,ge,I]),s.useEffect(()=>{!d&&J&&Q?G(`${J}:${Q}`):d&&G(`${T}:${j}`)},[d,J,Q,T,j]);const Ae=v||N;s.useEffect(()=>{d&&Ae&&(Ge(!0),(async()=>{const e=await V.listBranches(Ae);if(e.isOk()){const r=e.value;We(r.branches),r.defaultBranch?ve(r.defaultBranch):r.branches.length>0&&ve(r.branches[0])}else We([]);Ge(!1)})())},[d,Ae]),s.useEffect(()=>{!d&&Ke==="local"&&!_&&N?(async()=>{const e=await V.listBranches(N);e.isOk()?we(e.value.currentBranch):we(null)})():we(null)},[d,Ke,_,N]),s.useEffect(()=>{ue?(async()=>{const e=await V.remoteUrl(ue);e.isOk()?ye(e.value.url):ye(null)})():ye(null)},[ue]),s.useEffect(()=>{!d&&N?(async()=>{const e=await V.listBranches(N);if(e.isOk()){const r=e.value;je(r.branches),be?X(be):r.defaultBranch?X(r.defaultBranch):r.currentBranch?X(r.currentBranch):r.branches.length>0&&X(r.branches[0])}else je([])})():je([])},[d,N,be]);const ct=s.useCallback(async()=>{if(Ie)return;const e=N?de.find(a=>a.id===N)?.path:void 0,r=await V.listSkills(e);if(r.isOk()){const a=r.value.skills??[],l=new Map;for(const m of a)(!l.get(m.name)||m.scope==="project")&&l.set(m.name,m);Me(Array.from(l.values()))}else Me([]);Je(!0)},[Ie,N,de]),H=Ht.filter(e=>e.name.toLowerCase().includes(Kt.toLowerCase()));s.useEffect(()=>{const e=b.match(/^\/(\S*)$/);e?(Vt(e[1]),re(!0),ne(0),ct()):re(!1)},[b,ct]),s.useEffect(()=>{if(!se||!Pe.current)return;Pe.current.children[ae]?.scrollIntoView({block:"nearest"})},[ae,se]);const lt=s.useCallback(e=>{k(`/${e.name} `),re(!1),B.current?.focus()},[]),it=s.useCallback(e=>{Te.current&&clearTimeout(Te.current),Te.current=setTimeout(async()=>{const r=fe||Ee;if(!r)return;et(!0);const a=await V.browseFiles(r,e||void 0);a.isOk()&&(Wt(a.value.files),Yt(a.value.truncated)),et(!1)},150)},[fe,Ee]),Qt=s.useCallback((e,r)=>{const l=e.slice(0,r).match(/@([^\s@]*)$/);if(l){const m=l[1];qt(m),ce(!0),ie(0),tt.current=r-l[0].length,it(m)}else ce(!1)},[it]),dt=s.useCallback(e=>{const r=tt.current;k(a=>{const l=a.slice(0,r),m=a.slice(r+Qe.length+1);return`${l}@${e} ${m}`}),z(a=>a.includes(e)?a:[...a,e]),ce(!1),B.current?.focus()},[Qe]);s.useEffect(()=>{if(!oe||!Re.current)return;Re.current.children[le]?.scrollIntoView({block:"nearest"})},[le,oe]),s.useEffect(()=>{B.current?.focus()},[S]),s.useEffect(()=>{p||B.current?.focus()},[p]),s.useEffect(()=>{i||B.current?.focus()},[i]);const Le=s.useRef(0),$e=s.useCallback(()=>{cancelAnimationFrame(Le.current),Le.current=requestAnimationFrame(()=>{const e=B.current;if(!e)return;e.style.height="auto";const r=window.innerHeight*.35;e.style.height=`${Math.min(e.scrollHeight,r)}px`,e.style.overflowY=e.scrollHeight>r?"auto":"hidden"})},[]);s.useEffect(()=>()=>cancelAnimationFrame(Le.current),[]),s.useEffect(()=>{$e()},[b,$e]);const ut=async()=>{if(i)return;if(!b.trim()&&E.length===0){me.warning(n("prompt.emptyPrompt","Please enter a prompt before sending"));return}const e=b,r=E.length>0?E:void 0,a=F.length>0?F.map(m=>({path:m})):void 0;k(""),O([]),z([]),Ce.current=!0,S&&Zt(S),B.current?.focus(),await u(e,{provider:c,model:g,mode:$,...d?{threadMode:He?"worktree":"local",baseBranch:Xe||void 0,sendToBacklog:Ye}:Lt?{threadMode:"worktree",baseBranch:Ne||void 0}:{baseBranch:Ne||void 0},cwd:fe||void 0,fileReferences:a},r)===!1&&(Ce.current=!1,k(e),O(r??[]),z(a?.map(m=>m.path)??[]))},es=e=>{if(oe&&U.length>0){if(e.key==="ArrowDown"){e.preventDefault(),ie(r=>(r+1)%U.length);return}if(e.key==="ArrowUp"){e.preventDefault(),ie(r=>(r-1+U.length)%U.length);return}if(e.key==="Enter"||e.key==="Tab"){e.preventDefault(),dt(U[le]);return}if(e.key==="Escape"){e.preventDefault(),ce(!1);return}}if(se&&H.length>0){if(e.key==="ArrowDown"){e.preventDefault(),ne(r=>(r+1)%H.length);return}if(e.key==="ArrowUp"){e.preventDefault(),ne(r=>(r-1+H.length)%H.length);return}if(e.key==="Enter"||e.key==="Tab"){e.preventDefault(),lt(H[ae]);return}if(e.key==="Escape"){e.preventDefault(),re(!1);return}}if(e.key==="Tab"&&e.shiftKey){e.preventDefault(),Y(r=>{const a=Z.findIndex(l=>l.value===r);return Z[(a+1)%Z.length].value});return}e.key==="Enter"&&!e.shiftKey&&(e.preventDefault(),ut())},ts=async e=>{const r=e.clipboardData?.items;if(r){for(const a of Array.from(r))if(a.type.startsWith("image/")){e.preventDefault();const l=a.getAsFile();l&&await Ue(l)}}},ss=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes("Files")&&Se(!0)},rs=e=>{e.preventDefault(),e.stopPropagation(),e.currentTarget===e.target&&Se(!1)},as=async e=>{if(e.preventDefault(),e.stopPropagation(),Se(!1),i)return;const r=e.dataTransfer?.items;if(r){for(const a of Array.from(r))if(a.type.startsWith("image/")){const l=a.getAsFile();l&&await Ue(l)}else if(a.kind==="file"){const l=a.getAsFile();if(l){const m=l.path||l.name;F.includes(m)||(z(K=>[...K,m]),k(K=>K?`${K} @${m}`:`@${m}`))}}}},ns=async e=>{const r=e.target.files;if(r){for(const a of Array.from(r))await Ue(a);te.current&&(te.current.value="")}},Ue=async e=>new Promise((r,a)=>{const l=new FileReader;l.onload=()=>{const m=l.result.split(",")[1],K=e.type;O(ls=>[...ls,{type:"image",source:{type:"base64",media_type:K,data:m}}]),r()},l.onerror=a,l.readAsDataURL(e)}),os=e=>{O(r=>r.filter((a,l)=>l!==e))},cs=w??n("thread.describeTaskDefault");return t.jsx("div",{className:"border-border px-4 py-3",children:t.jsxs("div",{className:"mx-auto w-full min-w-0 max-w-3xl",children:[E.length>0&&t.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:E.map((e,r)=>t.jsxs("div",{className:"group relative",children:[t.jsx("img",{src:`data:${e.source.media_type};base64,${e.source.data}`,alt:`Attachment ${r+1}`,className:"h-20 max-w-48 cursor-pointer rounded border border-input object-contain transition-opacity hover:opacity-80",onClick:()=>{Ot(r),Ze(!0)}}),t.jsx("button",{onClick:()=>os(r),"aria-label":n("prompt.removeImage","Remove image"),className:"absolute -right-1 -top-1 rounded-full bg-destructive p-0.5 text-destructive-foreground opacity-0 transition-opacity group-hover:opacity-100",disabled:i,children:t.jsx(Oe,{className:"h-3 w-3"})})]},`preview-${r}`))}),t.jsx(Vs,{images:E.map((e,r)=>({src:`data:${e.source.media_type};base64,${e.source.data}`,alt:`Attachment ${r+1}`})),initialIndex:_t,open:Ut,onClose:()=>Ze(!1)}),t.jsxs("div",{className:L("relative rounded-md border bg-input/50",zt?"border-primary border-2 ring-2 ring-primary/20":"border-input focus-within:border-ring"),onDragOver:ss,onDragLeave:rs,onDrop:as,children:[oe&&t.jsx("div",{ref:Re,className:"absolute bottom-full left-0 z-50 mb-1 max-h-52 w-full overflow-y-auto rounded-md border border-border bg-popover text-popover-foreground shadow-md",children:Gt&&U.length===0?t.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:n("prompt.loadingFiles","Loading files…")}):U.length===0?t.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:n("prompt.noFilesMatch","No files match")}):t.jsxs(t.Fragment,{children:[U.map((e,r)=>t.jsxs("button",{className:L("w-full flex items-center gap-2 px-3 py-1.5 text-left text-sm hover:bg-accent transition-colors",r===le&&"bg-accent",F.includes(e)&&"text-primary"),onMouseDown:a=>{a.preventDefault(),dt(e)},onMouseEnter:()=>ie(r),children:[t.jsx(vt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate font-mono text-xs",children:e})]},e)),Xt&&t.jsx("div",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground",children:n("prompt.moreFilesHint","Type to narrow results…")})]})}),se&&t.jsx("div",{ref:Pe,className:"absolute bottom-full left-0 z-50 mb-1 max-h-52 w-full overflow-y-auto rounded-md border border-border bg-popover text-popover-foreground shadow-md",children:H.length===0?t.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:n(Ie?"skills.noSkillsFound":"prompt.loadingSkills")}):H.map((e,r)=>t.jsxs("button",{className:L("w-full flex items-start gap-2 px-3 py-2 text-left text-sm hover:bg-accent transition-colors",r===ae&&"bg-accent"),onMouseDown:a=>{a.preventDefault(),lt(e)},onMouseEnter:()=>ne(r),children:[t.jsx(Us,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"font-mono text-xs font-medium",children:["/",e.name]}),e.description&&t.jsx("div",{className:"truncate text-xs text-muted-foreground",children:e.description})]})]},e.name))}),t.jsx("textarea",{ref:$t,"aria-label":n("prompt.messageLabel","Message"),className:"w-full resize-none bg-transparent px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none",style:{minHeight:"4.5rem"},placeholder:p?n(y?"thread.typeToQueue":"thread.typeToInterrupt"):cs,value:b,onChange:e=>{const r=e.target.value;k(r),$e(),Qt(r,e.target.selectionStart??r.length)},onKeyDown:es,onPaste:ts,rows:1,disabled:i}),F.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1 border-t border-border/50 px-2 py-1",children:F.map(e=>t.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-muted-foreground",title:e,children:[t.jsx(vt,{className:"h-3 w-3 shrink-0"}),e.split("/").pop(),t.jsx("button",{onClick:()=>z(r=>r.filter(a=>a!==e)),"aria-label":n("prompt.removeFile","Remove file"),className:"ml-0.5 hover:text-destructive",children:t.jsx(Oe,{className:"h-3 w-3"})})]},e))}),t.jsx("input",{ref:te,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ns,disabled:i||p}),t.jsx("div",{className:"px-2 py-2.5",children:t.jsxs("div",{className:"no-scrollbar flex h-9 items-center gap-1 overflow-x-auto",children:[t.jsx(_e,{onClick:()=>te.current?.click(),variant:"ghost",size:"icon-sm",tabIndex:-1,"aria-label":n("prompt.attach"),disabled:i,className:"text-muted-foreground hover:text-foreground",children:t.jsx(Ls,{className:"h-4 w-4"})}),t.jsxs(ht,{value:$,onValueChange:Y,children:[t.jsx(mt,{tabIndex:-1,className:"h-7 w-auto min-w-0 shrink-0 border-0 bg-transparent text-xs text-muted-foreground shadow-none hover:bg-accent hover:text-accent-foreground",children:t.jsx(pt,{})}),t.jsx(xt,{children:Z.map(e=>t.jsx(gt,{value:e.value,children:e.label},e.value))})]}),t.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[!d&&(()=>{const e=Ns(J??c??"claude",Q??g??"sonnet"),r=(Ve?.tokenOffset??0)+(Ve?.cumulativeInputTokens??0),a=e>0?Math.min(100,r/e*100):0,l=Math.round(r/1e3),m=a>80?"text-red-500":a>60?"text-amber-500":"text-muted-foreground";return t.jsxs(vs,{children:[t.jsx(ws,{asChild:!0,children:t.jsxs("span",{className:L("cursor-default text-xs tabular-nums",m),children:[a.toFixed(0),"% used"]})}),t.jsxs(ks,{children:["Context: ",l,"K / ",Math.round(e/1e3),"K tokens"]})]})})(),t.jsxs(ht,{value:W,onValueChange:G,children:[t.jsx(mt,{tabIndex:-1,className:"h-7 w-auto min-w-0 shrink-0 border-0 bg-transparent text-xs text-muted-foreground shadow-none hover:bg-accent hover:text-accent-foreground",children:t.jsx(pt,{})}),t.jsx(xt,{children:Dt.map(e=>t.jsxs("div",{children:[t.jsx("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground",children:e.providerLabel}),e.models.map(r=>t.jsx(gt,{value:r.value,children:r.label},r.value))]},e.provider))})]}),x>0&&t.jsxs("span",{className:"inline-flex items-center rounded bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:[x," ",n("prompt.queued")]}),p&&!b.trim()?t.jsx(_e,{onClick:f,variant:"destructive",size:"icon-sm",tabIndex:-1,"aria-label":n("prompt.stopAgent"),children:t.jsx(Ms,{className:"h-3.5 w-3.5"})}):t.jsx(_e,{onClick:ut,disabled:i,size:"icon-sm",tabIndex:-1,"aria-label":p&&y?n("prompt.queueMessage"):n("prompt.send","Send message"),children:i?t.jsx(ft,{className:"h-3.5 w-3.5 animate-spin"}):t.jsx(Es,{className:"h-3.5 w-3.5"})})]})]})}),t.jsx("div",{className:"border-t border-border px-2 py-1.5",children:d?t.jsxs("div",{className:"no-scrollbar flex items-center gap-1 overflow-x-auto",children:[ke&&t.jsxs("span",{className:"flex max-w-[200px] shrink-0 items-center gap-1 truncate px-2 py-1 text-xs text-muted-foreground",children:[ke.includes("github.com")?t.jsx(Is,{className:"h-3 w-3 shrink-0"}):t.jsx(Ps,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate font-mono",children:qs(ke)})]}),Ft?t.jsxs("span",{className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground",children:[t.jsx(ze,{className:"h-3 w-3 shrink-0"}),t.jsx(ft,{className:"h-3 w-3 animate-spin"})]}):qe.length>0&&t.jsx(wt,{branches:qe,selected:Xe,onChange:ve}),t.jsxs("label",{className:"flex shrink-0 cursor-pointer items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx(Tt,{checked:He,onCheckedChange:Bt,tabIndex:-1,className:"h-4 w-7 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input [&>span]:h-3 [&>span]:w-3 [&>span]:data-[state=checked]:translate-x-3"}),t.jsx("span",{children:n("thread.mode.worktree")})]}),h&&t.jsxs("button",{onClick:()=>At(e=>!e),tabIndex:-1,className:L("flex items-center gap-1 px-2 py-1 text-xs rounded transition-colors shrink-0 ml-auto",Ye?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"),title:n("prompt.sendToBacklog"),children:[t.jsx(Rs,{className:"h-3 w-3"}),n("prompt.backlog")]})]}):t.jsxs("div",{className:"flex flex-col gap-1",children:[Fe&&t.jsx("div",{className:"no-scrollbar flex items-center gap-1 overflow-x-auto",children:t.jsxs("span",{className:"group/cwd flex max-w-[400px] shrink-0 items-center gap-1 truncate px-2 py-1 text-xs text-muted-foreground",children:[t.jsx(Ts,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate font-mono",children:Fe}),t.jsx("button",{type:"button",className:"shrink-0 opacity-0 transition-colors hover:text-foreground group-hover/cwd:opacity-100",onClick:()=>{navigator.clipboard.writeText(Fe),me.success("Path copied")},children:t.jsx(Nt,{className:"h-3 w-3"})})]})}),(ee.length>0||_)&&t.jsxs("div",{className:"no-scrollbar flex items-center gap-1 overflow-x-auto",children:[ee.length>0&&t.jsx(wt,{branches:ee,selected:Ne,onChange:X}),_&&ee.length>0&&t.jsx(is,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),_&&t.jsxs("button",{type:"button",className:"flex shrink-0 items-center gap-1 rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted",onClick:()=>{navigator.clipboard.writeText(_),me.success(n("prompt.branchCopied","Branch copied"))},children:[t.jsx(ze,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"font-mono font-medium text-foreground",children:_})]})]})]})})]})]})})});export{Es as A,vt as F,Vs as I,gr as P};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{r as u,j as e}from"./markdown-9_JKOUHQ.js";import{G as ws,c as _,k as P,l as F,m as I,e as vs,a as He,b as p,s as js}from"./index-Z_QI94Zg.js";import{a as pt,u as xt,b as B,c as H,m as bs,l as ys,t as E}from"./use-ws-BIe6kKa2.js";import{L as $,B as S}from"./button-D8qrc3hb.js";import{D as ye,a as Se,b as Ce,c as Ne,d as ke}from"./dialog-DapeOKPE.js";import{D as Ss,a as Cs,b as Ns,c as Q,d as Ge,e as ks,f as Es,g as Ms}from"./dropdown-menu-Bi54WPTK.js";import{u as It,I as Rs}from"./input-Dyxe5hqI.js";import{P as zs,a as Ts,b as Ps}from"./popover-CRZjc4jI.js";import{S as wt,a as vt}from"./scroll-area-Bj4yTRJP.js";import{useReviewPaneStore as jt}from"./review-pane-store-CrK1Czq6.js";import{g as Fs,o as Is}from"./editor-utils-DgK9pIvP.js";import{u as bt}from"./draft-store-DnVbStYY.js";import{C as Xe}from"./check-Dj_ZR5Y7.js";import{X as Ot}from"./x-AprddF_b.js";import{C as Os,P as Ds,F as Ye,R as As,D as Ls}from"./utils-VDOOGGvU.js";import{E as Ze}from"./external-link-Dg0Hq511.js";import{R as _s}from"./refresh-cw-Svvcff2v.js";import{D as Ws,R as $s,A as yt}from"./rotate-ccw-DFiWNcpH.js";import{H as Vs}from"./history-D7cvrs7x.js";import{U as St,E as Bs,G as Hs,a as Ue,b as qe}from"./upload-DXXUmYu2.js";import{c as he}from"./createLucideIcon-CsWFljth.js";import{M as Gs}from"./maximize-2-DW-IsQiI.js";import{S as Us}from"./search-JGV9EPmW.js";import{E as Ct}from"./eye-off-ICXVwkI1.js";import{C as qs}from"./copy-DXKK6zMx.js";import{b as Nt}from"./App-BEFplUGa.js";import{G as Ke}from"./git-merge-CB0ebeXg.js";import"./mermaid-C0IQv4mH.js";import"./terminal-CuAYwdh-.js";import"./index-BplxL2Qj.js";import"./index-DmIp58b6.js";import"./chevron-right-PEOnBrxM.js";import"./internal-editor-store-CuhCMFlj.js";const Ks=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]],Xs=he("clipboard-copy",Ks);const Ys=[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],Zs=he("file-plus",Ys);const Js=[["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:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]],Qs=he("file-x",Js);const er=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]],kt=he("folder-x",er);const tr=[["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"}]],sr=he("panel-right-close",tr);function oe(s,h,r){let n=r.initialDeps??[],t,a=!0;function l(){var c,f,j;let m;r.key&&((c=r.debug)!=null&&c.call(r))&&(m=Date.now());const C=s();if(!(C.length!==n.length||C.some((L,z)=>n[z]!==L)))return t;n=C;let R;if(r.key&&((f=r.debug)!=null&&f.call(r))&&(R=Date.now()),t=h(...C),r.key&&((j=r.debug)!=null&&j.call(r))){const L=Math.round((Date.now()-m)*100)/100,z=Math.round((Date.now()-R)*100)/100,y=z/16,G=(T,te)=>{for(T=String(T);T.length<te;)T=" "+T;return T};console.info(`%c⏱ ${G(z,5)} /${G(L,5)} ms`,`
|
|
2
|
+
font-size: .6rem;
|
|
3
|
+
font-weight: bold;
|
|
4
|
+
color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,r?.key)}return r?.onChange&&!(a&&r.skipInitialOnChange)&&r.onChange(t),a=!1,t}return l.updateDeps=c=>{n=c},l}function Et(s,h){if(s===void 0)throw new Error("Unexpected undefined");return s}const rr=(s,h)=>Math.abs(s-h)<1.01,ir=(s,h,r)=>{let n;return function(...t){s.clearTimeout(n),n=s.setTimeout(()=>h.apply(this,t),r)}},Mt=s=>{const{offsetWidth:h,offsetHeight:r}=s;return{width:h,height:r}},nr=s=>s,ar=s=>{const h=Math.max(s.startIndex-s.overscan,0),r=Math.min(s.endIndex+s.overscan,s.count-1),n=[];for(let t=h;t<=r;t++)n.push(t);return n},or=(s,h)=>{const r=s.scrollElement;if(!r)return;const n=s.targetWindow;if(!n)return;const t=l=>{const{width:c,height:f}=l;h({width:Math.round(c),height:Math.round(f)})};if(t(Mt(r)),!n.ResizeObserver)return()=>{};const a=new n.ResizeObserver(l=>{const c=()=>{const f=l[0];if(f?.borderBoxSize){const j=f.borderBoxSize[0];if(j){t({width:j.inlineSize,height:j.blockSize});return}}t(Mt(r))};s.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()});return a.observe(r,{box:"border-box"}),()=>{a.unobserve(r)}},Rt={passive:!0},zt=typeof window>"u"?!0:"onscrollend"in window,lr=(s,h)=>{const r=s.scrollElement;if(!r)return;const n=s.targetWindow;if(!n)return;let t=0;const a=s.options.useScrollendEvent&&zt?()=>{}:ir(n,()=>{h(t,!1)},s.options.isScrollingResetDelay),l=m=>()=>{const{horizontal:C,isRtl:x}=s.options;t=C?r.scrollLeft*(x&&-1||1):r.scrollTop,a(),h(t,m)},c=l(!0),f=l(!1);r.addEventListener("scroll",c,Rt);const j=s.options.useScrollendEvent&&zt;return j&&r.addEventListener("scrollend",f,Rt),()=>{r.removeEventListener("scroll",c),j&&r.removeEventListener("scrollend",f)}},cr=(s,h,r)=>{if(h?.borderBoxSize){const n=h.borderBoxSize[0];if(n)return Math.round(n[r.options.horizontal?"inlineSize":"blockSize"])}return s[r.options.horizontal?"offsetWidth":"offsetHeight"]},dr=(s,{adjustments:h=0,behavior:r},n)=>{var t,a;const l=s+h;(a=(t=n.scrollElement)==null?void 0:t.scrollTo)==null||a.call(t,{[n.options.horizontal?"left":"top"]:l,behavior:r})};class ur{constructor(h){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let r=null;const n=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(t=>{t.forEach(a=>{const l=()=>{this._measureElement(a.target,a)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var t;(t=n())==null||t.disconnect(),r=null},observe:t=>{var a;return(a=n())==null?void 0:a.observe(t,{box:"border-box"})},unobserve:t=>{var a;return(a=n())==null?void 0:a.unobserve(t)}}})(),this.range=null,this.setOptions=r=>{Object.entries(r).forEach(([n,t])=>{typeof t>"u"&&delete r[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:nr,rangeExtractor:ar,onChange:()=>{},measureElement:cr,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...r}},this.notify=r=>{var n,t;(t=(n=this.options).onChange)==null||t.call(n,this,r)},this.maybeNotify=oe(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(t=>{this.observer.observe(t)}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(t,a)=>{this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=a,this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,n)=>{const t=new Map,a=new Map;for(let l=n-1;l>=0;l--){const c=r[l];if(t.has(c.lane))continue;const f=a.get(c.lane);if(f==null||c.end>f.end?a.set(c.lane,c):c.end<f.end&&t.set(c.lane,!0),t.size===this.options.lanes)break}return a.size===this.options.lanes?Array.from(a.values()).sort((l,c)=>l.end===c.end?l.index-c.index:l.end-c.end)[0]:void 0},this.getMeasurementOptions=oe(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(r,n,t,a,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==c&&(this.lanesChangedFlag=!0),this.prevLanes=c,this.pendingMeasuredCacheIndexes=[],{count:r,paddingStart:n,scrollMargin:t,getItemKey:a,enabled:l,lanes:c}),{key:!1}),this.getMeasurements=oe(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:r,paddingStart:n,scrollMargin:t,getItemKey:a,enabled:l,lanes:c},f)=>{if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const x of this.laneAssignments.keys())x>=r&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const j=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1);const m=this.measurementsCache.slice(0,j),C=new Array(c).fill(void 0);for(let x=0;x<j;x++){const R=m[x];R&&(C[R.lane]=x)}for(let x=j;x<r;x++){const R=a(x),L=this.laneAssignments.get(x);let z,y;if(L!==void 0&&this.options.lanes>1){z=L;const M=C[z],le=M!==void 0?m[M]:void 0;y=le?le.end+this.options.gap:n+t}else{const M=this.options.lanes===1?m[x-1]:this.getFurthestMeasurement(m,x);y=M?M.end+this.options.gap:n+t,z=M?M.lane:x%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(x,z)}const G=f.get(R),T=typeof G=="number"?G:this.options.estimateSize(x),te=y+T;m[x]={index:x,start:y,size:T,end:te,key:R,lane:z},C[z]=x}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=oe(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,n,t,a)=>this.range=r.length>0&&n>0?hr({measurements:r,outerSize:n,scrollOffset:t,lanes:a}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=oe(()=>{let r=null,n=null;const t=this.calculateRange();return t&&(r=t.startIndex,n=t.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,n]},(r,n,t,a,l)=>a===null||l===null?[]:r({startIndex:a,endIndex:l,overscan:n,count:t}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const n=this.options.indexAttribute,t=r.getAttribute(n);return t?parseInt(t,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this._measureElement=(r,n)=>{const t=this.indexFromElement(r),a=this.measurementsCache[t];if(!a)return;const l=a.key,c=this.elementsCache.get(l);c!==r&&(c&&this.observer.unobserve(c),this.observer.observe(r),this.elementsCache.set(l,r)),r.isConnected&&this.resizeItem(t,this.options.measureElement(r,n,this))},this.resizeItem=(r,n)=>{const t=this.measurementsCache[r];if(!t)return;const a=this.itemSizeCache.get(t.key)??t.size,l=n-a;l!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(t,l,this):t.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(t.index),this.itemSizeCache=new Map(this.itemSizeCache.set(t.key,n)),this.notify(!1))},this.measureElement=r=>{if(!r){this.elementsCache.forEach((n,t)=>{n.isConnected||(this.observer.unobserve(n),this.elementsCache.delete(t))});return}this._measureElement(r,void 0)},this.getVirtualItems=oe(()=>[this.getVirtualIndexes(),this.getMeasurements()],(r,n)=>{const t=[];for(let a=0,l=r.length;a<l;a++){const c=r[a],f=n[c];t.push(f)}return t},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=r=>{const n=this.getMeasurements();if(n.length!==0)return Et(n[Dt(0,n.length-1,t=>Et(n[t]).start,r)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(r,n,t=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),l=this.getScrollOffset();n==="auto"&&(n=r>=l+a?"end":"start"),n==="center"?r+=(t-a)/2:n==="end"&&(r-=a);const c=this.getMaxScrollOffset();return Math.max(Math.min(c,r),0)},this.getOffsetForIndex=(r,n="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const t=this.measurementsCache[r];if(!t)return;const a=this.getSize(),l=this.getScrollOffset();if(n==="auto")if(t.end>=l+a-this.options.scrollPaddingEnd)n="end";else if(t.start<=l+this.options.scrollPaddingStart)n="start";else return[l,n];if(n==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),n];const c=n==="end"?t.end+this.options.scrollPaddingEnd:t.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(c,n,t.size),n]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(r,{align:n="start",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(r,n),{adjustments:void 0,behavior:t})},this.scrollToIndex=(r,{align:n="auto",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),r=Math.max(0,Math.min(r,this.options.count-1)),this.currentScrollToIndex=r;let a=0;const l=10,c=j=>{if(!this.targetWindow)return;const m=this.getOffsetForIndex(r,j);if(!m){console.warn("Failed to get offset for index:",r);return}const[C,x]=m;this._scrollToOffset(C,{adjustments:void 0,behavior:t}),this.targetWindow.requestAnimationFrame(()=>{const R=()=>{if(this.currentScrollToIndex!==r)return;const L=this.getScrollOffset(),z=this.getOffsetForIndex(r,x);if(!z){console.warn("Failed to get offset for index:",r);return}rr(z[0],L)||f(x)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(R):R()})},f=j=>{this.targetWindow&&this.currentScrollToIndex===r&&(a++,a<l?this.targetWindow.requestAnimationFrame(()=>c(j)):console.warn(`Failed to scroll to index ${r} after ${l} attempts.`))};c(n)},this.scrollBy=(r,{behavior:n}={})=>{n==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+r,{adjustments:void 0,behavior:n})},this.getTotalSize=()=>{var r;const n=this.getMeasurements();let t;if(n.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=((r=n[n.length-1])==null?void 0:r.end)??0;else{const a=Array(this.options.lanes).fill(null);let l=n.length-1;for(;l>=0&&a.some(c=>c===null);){const c=n[l];a[c.lane]===null&&(a[c.lane]=c.end),l--}t=Math.max(...a.filter(c=>c!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(r,{adjustments:n,behavior:t})=>{this.options.scrollToFn(r,{behavior:t,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(h)}}const Dt=(s,h,r,n)=>{for(;s<=h;){const t=(s+h)/2|0,a=r(t);if(a<n)s=t+1;else if(a>n)h=t-1;else return t}return s>0?s-1:0};function hr({measurements:s,outerSize:h,scrollOffset:r,lanes:n}){const t=s.length-1,a=f=>s[f].start;if(s.length<=n)return{startIndex:0,endIndex:t};let l=Dt(0,t,a,r),c=l;if(n===1)for(;c<t&&s[c].end<r+h;)c++;else if(n>1){const f=Array(n).fill(0);for(;c<t&&f.some(m=>m<r+h);){const m=s[c];f[m.lane]=m.end,c++}const j=Array(n).fill(r+h);for(;l>=0&&j.some(m=>m>=r);){const m=s[l];j[m.lane]=m.start,l--}l=Math.max(0,l-l%n),c=Math.min(t,c+(n-1-c%n))}return{startIndex:l,endIndex:c}}const Tt=typeof document<"u"?u.useLayoutEffect:u.useEffect;function mr({useFlushSync:s=!0,...h}){const r=u.useReducer(()=>({}),{})[1],n={...h,onChange:(a,l)=>{var c;s&&l?ws.flushSync(r):r(),(c=h.onChange)==null||c.call(h,a,l)}},[t]=u.useState(()=>new ur(n));return t.setOptions(n),Tt(()=>t._didMount(),[]),Tt(()=>t._willUpdate()),t}function fr(s){return mr({observeElementRect:or,observeElementOffset:lr,scrollToFn:dr,...s})}function gr(s,h,r=2e3){const n=u.useRef(null),t=u.useRef(h);t.current=h;const a=jt(c=>c.dirtySignal),l=jt(c=>c.dirtyThreadId);u.useEffect(()=>{if(!(!s||l!==s||a===0))return n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,t.current()},r),()=>{n.current&&(clearTimeout(n.current),n.current=null)}},[a,l,s,r])}function Pt(s){const h=s/1e3,r=Math.floor(h/60),n=h%60;return r>0?`${r}:${Math.floor(n).toString().padStart(2,"0")}`:`${n.toFixed(1)}s`}function pr(s,h){const r=u.useRef(new Map),n=u.useRef(new Map),[,t]=u.useState(0);u.useEffect(()=>{h&&(r.current.clear(),n.current.clear())},[h]),u.useEffect(()=>{const l=Date.now();for(const c of s)c.status==="running"&&!r.current.has(c.id)&&(r.current.set(c.id,l),n.current.delete(c.id)),(c.status==="completed"||c.status==="failed")&&!n.current.has(c.id)&&r.current.has(c.id)&&n.current.set(c.id,l),c.status==="pending"&&(r.current.delete(c.id),n.current.delete(c.id))},[s]);const a=s.some(l=>l.status==="running");return u.useEffect(()=>{if(!a)return;const l=setInterval(()=>t(c=>c+1),100);return()=>clearInterval(l)},[a]),l=>{const c=r.current.get(l);return c==null?null:(n.current.get(l)??Date.now())-c}}function xr(s,h){const r=u.useRef(null),[n,t]=u.useState(0);return u.useEffect(()=>{if(s&&!h){r.current=Date.now(),t(0);const a=setInterval(()=>{r.current&&t(Date.now()-r.current)},100);return()=>clearInterval(a)}},[s,h]),n}function wr({open:s,onOpenChange:h,steps:r,title:n}){const{t}=It(),a=r.some(m=>m.status==="running"),l=r.some(m=>m.status==="failed"),c=r.length>0&&!a&&(r.every(m=>m.status==="completed"||m.status==="failed")||l),f=pr(r,s),j=xr(s,c);return e.jsx(ye,{open:s,onOpenChange:c?h:void 0,children:e.jsxs(Se,{className:"max-w-sm",onPointerDownOutside:m=>{c||m.preventDefault()},children:[e.jsxs(Ce,{children:[e.jsx(Ne,{className:"text-sm",children:n}),e.jsx(ke,{className:"sr-only",children:t("review.progress.description","Git operation progress")})]}),e.jsx("div",{className:"space-y-2",children:r.map(m=>{const C=f(m.id);return e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsxs("div",{className:"flex-shrink-0",children:[m.status==="completed"&&e.jsx(Xe,{className:"h-4 w-4 text-emerald-500"}),m.status==="running"&&e.jsx($,{className:"h-4 w-4 animate-spin text-primary"}),m.status==="failed"&&e.jsx(Ot,{className:"h-4 w-4 text-destructive"}),m.status==="pending"&&e.jsx(Os,{className:"h-4 w-4 text-muted-foreground/40"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:_("text-xs",m.status==="completed"&&"text-muted-foreground",m.status==="running"&&"text-foreground font-medium",m.status==="failed"&&"text-destructive font-medium",m.status==="pending"&&"text-muted-foreground/60"),children:m.label}),C!=null&&m.status!=="pending"&&e.jsx("span",{className:"flex-shrink-0 text-[10px] tabular-nums text-muted-foreground/60",children:Pt(C)})]}),m.error&&e.jsx("pre",{className:"mt-0.5 max-h-40 overflow-auto whitespace-pre-wrap break-words font-sans text-[11px] text-destructive/80",children:m.error}),m.url&&m.status==="completed"&&e.jsxs("a",{href:m.url,target:"_blank",rel:"noopener noreferrer",className:"mt-0.5 flex items-center gap-1 text-[11px] text-primary hover:underline",children:[e.jsx(Ze,{className:"h-3 w-3"}),m.url]})]})]},m.id)})}),e.jsxs("div",{className:"flex flex-col items-end gap-2",children:[e.jsx("span",{className:"text-[10px] tabular-nums text-muted-foreground/50",children:Pt(j)}),c&&e.jsx(S,{size:"sm",variant:l?"outline":"default",onClick:()=>h(!1),children:l?t("review.progress.accept","Accept"):t("review.progress.done","Done")})]})]})})}const vr={added:Zs,modified:Ye,deleted:Qs,renamed:Ye},jr=28;function br(s){const h=s.split(`
|
|
5
|
+
`),r=[];for(const n of h)n.startsWith("---")||n.startsWith("+++")||n.startsWith("@@")||(n.startsWith("-")?r.push(n.substring(1)):n.startsWith("+")||r.push(n));return r.join(`
|
|
6
|
+
`)}function yr(s){const h=s.split(`
|
|
7
|
+
`),r=[];for(const n of h)n.startsWith("---")||n.startsWith("+++")||n.startsWith("@@")||(n.startsWith("+")?r.push(n.substring(1)):n.startsWith("-")||r.push(n));return r.join(`
|
|
8
|
+
`)}const Ft=u.memo(function({diff:h,splitView:r=!1}){const n=u.useMemo(()=>br(h),[h]),t=u.useMemo(()=>yr(h),[h]);return e.jsx(As,{oldValue:n,newValue:t,splitView:r,useDarkTheme:!0,hideLineNumbers:!1,showDiffOnly:!0,hideSummary:!0,styles:Ls,codeFoldMessageRenderer:()=>e.jsx(e.Fragment,{})})});function si(){const{t:s}=It(),h=pt(i=>i.setReviewPaneOpen),r=pt(i=>i.reviewPaneOpen),n=xt(i=>i.selectedProjectId),t=B(i=>i.activeThread?.id),a=t?null:n,l=!!(t||a),c=B(i=>{const o=i.activeThread?.worktreePath;if(o)return o;const g=i.activeThread?.projectId??n;return g?xt.getState().projects.find(d=>d.id===g)?.path??"":""}),[f,j]=u.useState([]),[m,C]=u.useState(new Map),[x,R]=u.useState(null),[L,z]=u.useState({total:0,truncated:!1}),[y,G]=u.useState(null),[T,te]=u.useState(!1),[M,le]=u.useState(null),[ce,Ee]=u.useState(""),[O,de]=u.useState(new Set),{setCommitDraft:me,clearCommitDraft:At}=bt(),[se,fe]=u.useState(""),[ge,pe]=u.useState(""),K=t||a,Je=u.useCallback(i=>{fe(o=>{const g=typeof i=="function"?i(o):i;return K&&pe(d=>(me(K,g,d),d)),g})},[K,me]),Qe=u.useCallback(i=>{pe(o=>{const g=typeof i=="function"?i(o):i;return K&&fe(d=>(me(K,d,g),d)),g})},[K,me]),[re,et]=u.useState(!1),[D,tt]=u.useState("commit"),[X,Y]=u.useState(null),[st,Lt]=u.useState([]),[_t,Wt]=u.useState(!1),[rt,it]=u.useState(!1),[Me,nt]=u.useState(!1),[Re,at]=u.useState(!1),[ze,$t]=u.useState([]),[Te,ot]=u.useState(!1),[Pe,lt]=u.useState(!1),[U,ie]=u.useState(null),xe=B(i=>i.activeThread?.mode==="worktree"),W=B(i=>i.activeThread?.baseBranch),we=B(i=>i.activeThread?.branch),Fe=B(i=>!!i.activeThread?.worktreePath),k=B(i=>i.activeThread?.status==="running"),Z=H(i=>t?i.statusByThread[t]:void 0),[Ie,ct]=u.useState(!1),[Oe,dt]=u.useState(!1),[De,Ae]=u.useState(!1),[ee,ne]=u.useState(null),[Le,ve]=u.useState(!1),[Vt,ae]=u.useState([]),[Bt,ue]=u.useState(!1),[Ht,je]=u.useState(""),V=u.useCallback((i,o)=>{ae(g=>g.map(d=>d.id===i?{...d,...o}:d))},[]),Gt=xe&&Fe&&f.length===0&&!T&&Z&&!Z.isMergedIntoBase&&!Le&&(!W||we!==W),Ut=f.length===0&&!T&&Z&&Z.unpushedCommitCount>0&&!Le,ut=u.useRef(null),A=async()=>{if(!l)return;te(!0);const i=t?await p.getDiffSummary(t):await p.projectDiffSummary(a);if(i.isOk()){const o=i.value;j(o.files),z({total:o.total,truncated:o.truncated}),C(new Map),de(d=>{const N=new Set(d),w=new Set(o.files.map(b=>b.path));for(const b of o.files)(!d.has(b.path)&&d.size===0||!d.has(b.path)&&o.files.length>d.size)&&N.add(b.path);for(const b of d)w.has(b)||N.delete(b);return N.size===0?new Set(o.files.map(b=>b.path)):N}),o.files.length>0&&!y&&G(o.files[0].path);const g=y??(o.files.length>0?o.files[0].path:null);if(g){const d=o.files.find(N=>N.path===g);if(d){R(g);const N=t?await p.getFileDiff(t,g,d.staged):await p.projectFileDiff(a,g,d.staged);N.isOk()&&C(w=>new Map(w).set(g,N.value.diff)),R(w=>w===g?null:w)}}}else console.error("Failed to load diff summary:",i.error);te(!1),t?H.getState().fetchForThread(t):a&&H.getState().fetchProjectStatus(a)},ht=async i=>{if(!l||m.has(i))return;const o=f.find(d=>d.path===i);if(!o)return;R(i);const g=t?await p.getFileDiff(t,i,o.staged):await p.projectFileDiff(a,i,o.staged);g.isOk()&&C(d=>new Map(d).set(i,g.value.diff)),R(d=>d===i?null:d)};u.useEffect(()=>{y&&!m.has(y)&&ht(y)},[y]),u.useEffect(()=>{M&&!m.has(M)&&ht(M)},[M]);const _e=u.useRef(!1),mt=t||a;u.useEffect(()=>{j([]),C(new Map),G(null),de(new Set),Ee(""),ve(!1),tt("commit");const i=t||a,o=i?bt.getState().drafts[i]:void 0;fe(o?.commitTitle??""),pe(o?.commitBody??""),r?A():_e.current=!0},[mt]),u.useEffect(()=>{r&&_e.current&&(_e.current=!1,A())},[r]),gr(t,A,2e3);const We=u.useMemo(()=>{if(!ce)return f;const i=ce.toLowerCase();return f.filter(o=>o.path.toLowerCase().includes(i))},[f,ce]),$e=y?m.get(y):void 0,qt=O.size,Kt=f.length,ft=fr({count:We.length,getScrollElement:()=>ut.current,estimateSize:()=>jr,overscan:15}),Xt=i=>{de(o=>{const g=new Set(o);return g.has(i)?g.delete(i):g.add(i),g})},Yt=()=>{O.size===f.length?de(new Set):de(new Set(f.map(i=>i.path)))},Zt=async()=>{if(!l||re)return;et(!0);const i=t?await p.generateCommitMessage(t,!0):await p.projectGenerateCommitMessage(a,!0);i.isOk()?(Je(i.value.title),Qe(i.value.body)):E.error(s("review.generateFailed",{message:i.error.message})),et(!1)},Ve=u.useRef(!1),Jt=async()=>{if(!l||!se.trim()||O.size===0||X||Ve.current)return;Ve.current=!0,Y(D);const i=[],o=f.filter(b=>b.staged&&!O.has(b.path)).map(b=>b.path),g=Array.from(O).filter(b=>{const q=f.find(v=>v.path===b);return q&&!q.staged});o.length>0&&i.push({id:"unstage",label:s("review.progress.unstaging"),status:"pending"}),g.length>0&&i.push({id:"stage",label:s("review.progress.staging"),status:"pending"});const d=D==="amend";i.push({id:"hooks",label:s("review.progress.runningHooks"),status:"pending"}),i.push({id:"commit",label:s(d?"review.progress.amending":"review.progress.committing"),status:"pending"}),(D==="commit-push"||D==="commit-pr")&&i.push({id:"push",label:s("review.progress.pushing"),status:"pending"}),D==="commit-pr"&&i.push({id:"pr",label:s("review.progress.creatingPR"),status:"pending"}),D==="commit-merge"&&i.push({id:"merge",label:s("review.progress.merging"),status:"pending"});const N={commit:s("review.progress.commitTitle"),amend:s("review.progress.amendTitle"),"commit-push":s("review.progress.commitPushTitle"),"commit-pr":s("review.progress.commitPRTitle"),"commit-merge":s("review.progress.commitMergeTitle")};je(N[D]||s("review.progress.commitTitle")),ae(i),ue(!0);const w=(b,q)=>{ae(v=>v.map(J=>J.id===b?{...J,...q}:J))};try{if(o.length>0){w("unstage",{status:"running"});const v=t?await p.unstageFiles(t,o):await p.projectUnstageFiles(a,o);if(v.isErr()){w("unstage",{status:"failed",error:v.error.message}),Y(null);return}w("unstage",{status:"completed"})}if(g.length>0){w("stage",{status:"running"});const v=t?await p.stageFiles(t,g):await p.projectStageFiles(a,g);if(v.isErr()){w("stage",{status:"failed",error:v.error.message}),Y(null);return}w("stage",{status:"completed"})}w("hooks",{status:"running"});const b=ge.trim()?`${se.trim()}
|
|
9
|
+
|
|
10
|
+
${ge.trim()}`:se.trim(),q=t?await p.commit(t,b,d):await p.projectCommit(a,b,d);if(q.isErr()){const v=q.error.message.toLowerCase();v.includes("hook")||v.includes("husky")||v.includes("lint-staged")||v.includes("pre-commit")?w("hooks",{status:"failed",error:q.error.message}):(w("hooks",{status:"completed"}),w("commit",{status:"running"}),w("commit",{status:"failed",error:q.error.message})),Y(null);return}if(w("hooks",{status:"completed"}),w("commit",{status:"running"}),await new Promise(v=>setTimeout(v,50)),w("commit",{status:"completed"}),D==="commit-push"||D==="commit-pr"){w("push",{status:"running"});const v=t?await p.push(t):await p.projectPush(a);if(v.isErr()){w("push",{status:"failed",error:v.error.message}),Y(null),D==="commit-pr"&&await A();return}w("push",{status:"completed"})}if(D==="commit-pr"){w("pr",{status:"running"});const v=await p.createPR(t,se.trim(),ge.trim());if(v.isErr()){w("pr",{status:"failed",error:v.error.message}),Y(null);return}w("pr",{status:"completed",url:v.value.url||void 0})}if(D==="commit-merge"){w("merge",{status:"running"});const v=await p.merge(t,{cleanup:!0});if(v.isErr()){const J=v.error.message.toLowerCase(),xs=J.includes("conflict")||J.includes("rebase failed")||J.includes("merge failed");w("merge",{status:"failed",error:v.error.message}),xs&&ve(!0),Y(null),await A();return}w("merge",{status:"completed"}),await B.getState().refreshActiveThread(),H.getState().fetchForThread(t)}fe(""),pe(""),K&&At(K),Y(null),await A()}finally{Ve.current=!1}},Qt=i=>{ie({type:"revert",path:i})},es=async i=>{if(!l)return;const o=t?await p.revertFiles(t,[i]):await p.projectRevertFiles(a,[i]);o.isErr()?E.error(s("review.revertFailed",{message:o.error.message})):await A()},ts=()=>{const i=O.size>0?Array.from(O):f.map(o=>o.path);i.length!==0&&ie({type:"discard-all",paths:i})},ss=async i=>{if(!l)return;const o=t?await p.revertFiles(t,i):await p.projectRevertFiles(a,i);o.isErr()?E.error(s("review.revertFailed",{message:o.error.message})):(E.success(s("review.discardSuccess",{count:i.length,defaultValue:"{{count}} file(s) discarded"})),await A())},be=async i=>{if(!l)return;const o=t?await p.addToGitignore(t,i):await p.projectAddToGitignore(a,i);o.isErr()?E.error(s("review.ignoreFailed",{message:o.error.message})):(E.success(s("review.ignoreSuccess")),await A())},rs=async()=>{if(!l||Oe)return;dt(!0);const i=[{id:"push",label:s("review.progress.pushing"),status:"running"}];je(s("review.progress.pushTitle")),ae(i),ue(!0);const o=t?await p.push(t):await p.projectPush(a);o.isErr()?V("push",{status:"failed",error:o.error.message}):V("push",{status:"completed"}),dt(!1),t?H.getState().fetchForThread(t):a&&H.getState().fetchProjectStatus(a)},is=async()=>{if(!l||Ie)return;ct(!0);const i=W||"base",o=[{id:"merge",label:s("review.progress.merging"),status:"running"}];je(s("review.progress.mergeTitle",{target:i})),ae(o),ue(!0);const g=await p.merge(t,{cleanup:!0});if(g.isErr()){V("merge",{status:"failed",error:g.error.message});const d=g.error.message.toLowerCase();(d.includes("conflict")||d.includes("rebase failed")||d.includes("merge failed")||d.includes("automatic merge failed")||d.includes("fix conflicts")||d.includes("could not apply"))&&ve(!0)}else V("merge",{status:"completed"}),await B.getState().refreshActiveThread();ct(!1),t?H.getState().fetchForThread(t):a&&H.getState().fetchProjectStatus(a)},ns=async()=>{if(!l||De||!ee)return;Ae(!0);const i=[],o=Z&&Z.unpushedCommitCount>0;if(o&&i.push({id:"push",label:s("review.progress.pushing"),status:"pending"}),i.push({id:"pr",label:s("review.progress.creatingPR"),status:"pending"}),je(s("review.progress.createPRTitle")),ae(i),ue(!0),o){V("push",{status:"running"});const d=t?await p.push(t):await p.projectPush(a);if(d.isErr()){V("push",{status:"failed",error:d.error.message}),Ae(!1);return}V("push",{status:"completed"})}V("pr",{status:"running"});const g=await p.createPR(t,ee.title.trim(),ee.body.trim());g.isErr()?V("pr",{status:"failed",error:g.error.message}):V("pr",{status:"completed",url:g.value.url||void 0}),Ae(!1),ne(null),t?H.getState().fetchForThread(t):a&&H.getState().fetchProjectStatus(a)},as=async()=>{if(!t)return;const o=s("review.agentResolvePrompt",{target:W||"main"}),{allowedTools:g,disallowedTools:d}=js(He.getState().toolPermissions),N=await p.sendMessage(t,o,{allowedTools:g,disallowedTools:d});if(N.isErr()){E.error(N.error.message);return}E.success(s("review.agentResolveSent")),ve(!1)},os=()=>{const i=B.getState().activeThread?.worktreePath;if(!i)return;const o=He.getState().defaultEditor;p.openInEditor(i,o)},ls=i=>{const o=i.split("/"),g=[];for(let d=o.length-1;d>0;d--)g.push("/"+o.slice(0,d).join("/"));return g},cs=i=>{const o=i.lastIndexOf(".");return o===-1||o===i.length-1?null:i.substring(o)},gt=(i,o)=>{const g=o?i:`/${i}`;navigator.clipboard.writeText(g),E.success(s("review.pathCopied"))},ds=async()=>{if(!l||rt)return;it(!0);const i=t?await p.getGitLog(t,20):await p.projectGitLog(a,20);i.isOk()?Lt(i.value.entries):E.error(s("review.logFailed",{message:i.error.message,defaultValue:`Failed to load log: ${i.error.message}`})),it(!1)},us=async()=>{if(!l||Me)return;nt(!0);const i=t?await p.pull(t):await p.projectPull(a);i.isErr()?E.error(s("review.pullFailed",{message:i.error.message,defaultValue:`Pull failed: ${i.error.message}`})):E.success(s("review.pullSuccess","Pulled successfully")),nt(!1),await A()},hs=async()=>{if(!l||Re)return;at(!0);const i=t?await p.stash(t):await p.projectStash(a);i.isErr()?E.error(s("review.stashFailed",{message:i.error.message,defaultValue:`Stash failed: ${i.error.message}`})):E.success(s("review.stashSuccess","Changes stashed")),at(!1),await A(),Be()},ms=async()=>{if(!l||Te)return;ot(!0);const i=t?await p.stashPop(t):await p.projectStashPop(a);i.isErr()?E.error(s("review.stashPopFailed",{message:i.error.message,defaultValue:`Stash pop failed: ${i.error.message}`})):E.success(s("review.stashPopSuccess","Stash applied")),ot(!1),await A(),Be()},Be=async()=>{if(!l)return;const i=t?await p.stashList(t):await p.projectStashList(a);i.isOk()&&$t(i.value.entries)},fs=()=>{ie({type:"reset"})},gs=async()=>{if(!l||Pe)return;lt(!0);const i=t?await p.resetSoft(t):await p.projectResetSoft(a);i.isErr()?E.error(s("review.resetSoftFailed",{message:i.error.message,defaultValue:`Reset failed: ${i.error.message}`})):E.success(s("review.resetSoftSuccess","Last commit undone")),lt(!1),await A()};u.useEffect(()=>{r&&Be()},[mt,r]);const ps=O.size>0&&se.trim().length>0&&!X&&!k;return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-sidebar-border px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("h3",{className:"mr-1 text-xs font-semibold uppercase tracking-wider text-sidebar-foreground",children:s("review.title")}),e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"icon-xs",onClick:A,className:"text-muted-foreground",children:e.jsx(_s,{className:_("h-3.5 w-3.5",T&&"animate-spin")})})}),e.jsx(I,{side:"top",children:s("review.refresh")})]}),e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"icon-xs",onClick:us,disabled:Me,className:"text-muted-foreground",children:e.jsx(Ws,{className:_("h-3.5 w-3.5",Me&&"animate-pulse")})})}),e.jsx(I,{side:"top",children:s("review.pull","Pull")})]}),e.jsxs(zs,{open:_t,onOpenChange:i=>{Wt(i),i&&ds()},children:[e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(Ts,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground",children:e.jsx(Vs,{className:"h-3.5 w-3.5"})})})}),e.jsx(I,{side:"top",children:s("review.log","Commit log")})]}),e.jsx(Ps,{align:"start",className:"max-h-[360px] w-[400px] overflow-auto p-0",children:rt?e.jsxs("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[e.jsx($,{className:"h-3.5 w-3.5 animate-spin"}),s("review.loadingLog","Loading commits…")]}):st.length===0?e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:s("review.noCommits","No commits yet")}):e.jsx("div",{className:"divide-y divide-border",children:st.map(i=>e.jsxs("div",{className:"px-3 py-2 text-xs hover:bg-accent/50",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"font-mono text-[10px] text-primary",children:i.shortHash}),e.jsx("span",{className:"text-muted-foreground",children:i.relativeDate})]}),e.jsx("p",{className:"mt-0.5 truncate text-foreground",children:i.message}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:i.author})]},i.hash))})})]}),f.length>0&&e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"icon-xs",onClick:hs,disabled:Re||!!k,className:"text-muted-foreground",children:e.jsx(bs,{className:_("h-3.5 w-3.5",Re&&"animate-pulse")})})}),e.jsx(I,{side:"top",children:k?s("review.agentRunningTooltip"):s("review.stash","Stash changes")})]}),f.length>0&&e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"icon-xs",onClick:ts,disabled:!!X||!!k,className:"text-muted-foreground",children:e.jsx(St,{className:"h-3.5 w-3.5"})})}),e.jsx(I,{side:"top",children:k?s("review.agentRunningTooltip"):s("review.discard","Discard")})]})]}),e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"icon-xs",onClick:()=>h(!1),className:"text-muted-foreground",children:e.jsx(sr,{className:"h-3.5 w-3.5"})})}),e.jsx(I,{side:"top",children:s("review.close","Close")})]})]}),e.jsxs("div",{className:"flex min-h-0 flex-1",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[y&&e.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2 border-b border-sidebar-border px-3 py-1.5",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",title:y,style:{direction:"rtl",textAlign:"left"},children:y}),$e&&e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"icon-xs",onClick:()=>le(y),className:"flex-shrink-0 text-muted-foreground hover:text-foreground",children:e.jsx(Gs,{className:"h-3.5 w-3.5"})})}),e.jsx(I,{side:"left",children:s("review.expand","Expand")})]})]}),e.jsxs(wt,{className:"w-full flex-1",children:[y?x===y?e.jsxs("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[e.jsx($,{className:"h-3.5 w-3.5 animate-spin"}),"Loading diff\\u2026"]}):$e?e.jsx("div",{className:"relative text-xs [&_.diff-container]:font-mono [&_table]:w-max [&_td:last-child]:w-auto [&_td:last-child]:min-w-0",children:e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"p-2 text-xs text-muted-foreground",children:"Loading diff\\u2026"}),children:e.jsx(Ft,{diff:$e})})}):e.jsx("p",{className:"p-2 text-xs text-muted-foreground",children:s("review.binaryOrNoDiff")}):e.jsx("p",{className:"p-2 text-xs text-muted-foreground",children:s("review.selectFile")}),e.jsx(vt,{orientation:"horizontal"})]})]}),e.jsxs("div",{className:"flex w-[352px] flex-shrink-0 flex-col border-l border-sidebar-border",children:[L.truncated&&e.jsx("div",{className:"border-b border-sidebar-border bg-yellow-500/10 px-3 py-1.5 text-xs text-yellow-600 dark:text-yellow-400",children:s("review.truncatedWarning",{shown:f.length,total:L.total,defaultValue:`Showing ${f.length} of ${L.total} files. Some files were excluded.`})}),f.length>0&&e.jsx("div",{className:"border-b border-sidebar-border px-2 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(Us,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(Rs,{type:"text",placeholder:s("review.searchFiles","Filter files…"),"aria-label":s("review.searchFiles","Filter files"),value:ce,onChange:i=>Ee(i.target.value),className:"h-7 pl-7 pr-7 text-xs md:text-xs"}),ce&&e.jsx(S,{variant:"ghost",size:"icon-xs",onClick:()=>Ee(""),"aria-label":s("review.clearSearch","Clear search"),className:"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground",children:e.jsx(Ot,{className:"h-3 w-3"})})]})}),f.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5 border-b border-sidebar-border px-4 py-1.5",children:[e.jsx("button",{role:"checkbox","aria-checked":O.size===f.length?!0:O.size>0?"mixed":!1,"aria-label":s("review.selectAll","Select all files"),onClick:Yt,className:_("flex items-center justify-center h-3.5 w-3.5 rounded border transition-colors flex-shrink-0",O.size===f.length?"bg-primary border-primary text-primary-foreground":O.size>0?"bg-primary/50 border-primary text-primary-foreground":"border-muted-foreground/40"),children:O.size>0&&e.jsx(Xe,{className:"h-2.5 w-2.5"})}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[qt,"/",Kt," ",s("review.selected","selected")]})]}),T?e.jsxs("div",{className:"flex items-center gap-2 p-3 text-xs text-muted-foreground",children:[e.jsx($,{className:"h-3.5 w-3.5 animate-spin"}),s("review.loading","Loading changes…")]}):f.length===0?e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:s("review.noChanges")}):We.length===0?e.jsx("p",{className:"p-3 text-xs text-muted-foreground",children:s("review.noMatchingFiles","No matching files")}):e.jsx("div",{ref:ut,className:"flex-1 overflow-auto",children:e.jsx("div",{style:{height:`${ft.getTotalSize()}px`,width:"100%",position:"relative"},children:ft.getVirtualItems().map(i=>{const o=We[i.index],g=O.has(o.path);return e.jsxs("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${i.size}px`,transform:`translateY(${i.start}px)`},className:_("group flex items-center gap-1.5 px-4 text-xs cursor-pointer transition-colors",y===o.path?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent/50 text-muted-foreground"),onClick:()=>G(o.path),children:[e.jsx("button",{role:"checkbox","aria-checked":g,"aria-label":s("review.selectFile",{file:o.path,defaultValue:`Select ${o.path}`}),onClick:d=>{d.stopPropagation(),Xt(o.path)},className:_("flex items-center justify-center h-3.5 w-3.5 rounded border transition-colors flex-shrink-0",g?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/40"),children:g&&e.jsx(Xe,{className:"h-2.5 w-2.5"})}),e.jsx("span",{className:"flex-1 truncate font-mono text-[11px]",children:o.path.split("/").pop()}),e.jsx("span",{className:_("text-[10px] font-medium flex-shrink-0",o.status==="added"&&"text-diff-added",o.status==="modified"&&"text-status-pending",o.status==="deleted"&&"text-diff-removed",o.status==="renamed"&&"text-status-info"),children:o.status==="added"?"A":o.status==="modified"?"M":o.status==="deleted"?"D":"R"}),e.jsxs(Ss,{children:[e.jsx(Cs,{asChild:!0,children:e.jsx("button",{onClick:d=>d.stopPropagation(),"aria-label":s("review.moreActions","More actions"),className:"flex h-4 w-4 flex-shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 transition-all hover:text-foreground group-hover:opacity-100 data-[state=open]:opacity-100",children:e.jsx(Bs,{className:"h-3 w-3"})})}),e.jsxs(Ns,{align:"end",className:"min-w-[220px]",children:[e.jsxs(Q,{onClick:()=>{const d=c?`${c}/${o.path}`:o.path;Is(d)},children:[e.jsx(Ze,{}),s("review.openInEditor",{editor:Fs()})]}),e.jsx(Ge,{}),e.jsxs(Q,{onClick:()=>Qt(o.path),className:"text-destructive focus:text-destructive",children:[e.jsx(St,{}),s("review.discardChanges")]}),e.jsx(Ge,{}),e.jsxs(Q,{onClick:()=>be(o.path),children:[e.jsx(Ct,{}),s("review.ignoreFile")]}),(()=>{const d=ls(o.path);return d.length===0?null:d.length===1?e.jsxs(Q,{onClick:()=>be(d[0]),children:[e.jsx(kt,{}),s("review.ignoreFolder")]}):e.jsxs(ks,{children:[e.jsxs(Es,{children:[e.jsx(kt,{}),s("review.ignoreFolder")]}),e.jsx(Ms,{children:d.map(N=>e.jsx(Q,{onClick:()=>be(N),children:N},N))})]})})(),(()=>{const d=cs(o.path);return d?e.jsxs(Q,{onClick:()=>be(`*${d}`),children:[e.jsx(Ct,{}),s("review.ignoreExtension",{ext:d})]}):null})(),e.jsx(Ge,{}),e.jsxs(Q,{onClick:()=>gt(o.path,!1),children:[e.jsx(qs,{}),s("review.copyFilePath")]}),e.jsxs(Q,{onClick:()=>gt(o.path,!0),children:[e.jsx(Xs,{}),s("review.copyRelativePath")]})]})]})]},o.path)})})}),f.length>0&&e.jsxs("div",{className:"flex-shrink-0 space-y-1.5 border-t border-sidebar-border p-2",children:[e.jsx("input",{type:"text",placeholder:s("review.commitTitle"),"aria-label":s("review.commitTitle","Commit title"),value:se,onChange:i=>Je(i.target.value),disabled:!!X||re,className:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),e.jsxs("div",{className:"rounded-md border border-input bg-background focus-within:ring-1 focus-within:ring-ring",children:[e.jsx("textarea",{className:"w-full resize-none bg-transparent px-2 py-1.5 text-xs placeholder:text-muted-foreground focus:outline-none",rows:7,"aria-label":s("review.commitBody","Commit body"),placeholder:s("review.commitBody"),value:ge,onChange:i=>Qe(i.target.value),disabled:!!X||re}),e.jsx("div",{className:"flex items-center px-1.5 py-1",children:e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(S,{variant:"ghost",size:"icon-xs",onClick:Zt,disabled:f.length===0||re||!!X,children:e.jsx(Nt,{className:_("h-2.5 w-2.5",re&&"animate-pulse")})})}),e.jsx(I,{side:"top",children:s(re?"review.generatingCommitMsg":"review.generateCommitMsg")})]})})]}),e.jsx("div",{className:_("grid gap-1 mt-2",xe&&Fe?"grid-cols-5":"grid-cols-3"),children:[{value:"commit",icon:Hs,label:s("review.commit","Commit")},{value:"amend",icon:Ds,label:s("review.amend","Amend")},{value:"commit-push",icon:Ue,label:s("review.commitAndPush","Commit & Push")},...xe&&Fe?[{value:"commit-pr",icon:qe,label:s("review.commitAndCreatePR","Commit & Create PR")},{value:"commit-merge",icon:Ke,label:s("review.commitAndMerge","Commit & Merge")}]:[]].map(({value:i,icon:o,label:g})=>e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsxs("button",{type:"button",onClick:()=>tt(i),disabled:!!X||!!k,className:_("flex flex-col items-center gap-1 rounded-md border p-2 text-center transition-all","hover:bg-accent/50 disabled:opacity-50 disabled:cursor-not-allowed",D===i?"border-primary bg-primary/5 text-foreground":"border-border text-muted-foreground"),children:[e.jsx(o,{className:_("h-4 w-4",D===i&&"text-primary")}),e.jsx("span",{className:"text-[10px] font-medium leading-tight",children:g})]})}),k&&e.jsx(I,{side:"top",children:s("review.agentRunningTooltip")})]},i))}),e.jsx("div",{className:"flex gap-1.5",children:e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx("div",{className:"flex-1",children:e.jsxs(S,{className:"w-full",size:"sm",onClick:Jt,disabled:!ps,children:[X?e.jsx($,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,s("review.continue","Continue")]})})}),k&&e.jsx(I,{side:"top",children:s("review.agentRunningTooltip")})]})})]}),Ut&&e.jsxs("div",{className:"flex-shrink-0 space-y-2 border-t border-sidebar-border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Ue,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:s("review.readyToPush",{count:Z.unpushedCommitCount,defaultValue:`${Z.unpushedCommitCount} commit(s) ready to push`})})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx("span",{className:"flex-1",children:e.jsxs(S,{className:"w-full",size:"sm",onClick:rs,disabled:Oe||!!k,children:[Oe?e.jsx($,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(Ue,{className:"mr-1.5 h-3.5 w-3.5"}),s("review.pushToOrigin","Push to origin")]})})}),k&&e.jsx(I,{side:"top",children:s("review.agentRunningTooltip")})]}),e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"outline",onClick:fs,disabled:Pe||!!k,children:Pe?e.jsx($,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx($s,{className:"h-3.5 w-3.5"})})}),e.jsx(I,{side:"top",children:k?s("review.agentRunningTooltip"):s("review.undoLastCommit","Undo last commit")})]})]})]}),f.length===0&&!T&&ze.length>0&&e.jsxs("div",{className:"flex-shrink-0 space-y-3 border-t border-sidebar-border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(yt,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:s("review.stashedChanges",{count:ze.length,defaultValue:`${ze.length} stash(es) saved`})})]}),e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsxs(S,{className:"w-full",size:"sm",variant:"outline",onClick:ms,disabled:Te||!!k,children:[Te?e.jsx($,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(yt,{className:"mr-1.5 h-3.5 w-3.5"}),s("review.popStash","Pop stash")]})}),k&&e.jsx(I,{side:"top",children:s("review.agentRunningTooltip")})]})]}),Gt&&e.jsxs("div",{className:"flex-shrink-0 space-y-3 border-t border-sidebar-border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Ke,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:s("review.readyToMerge",{target:W||"base",defaultValue:`Ready to merge into ${W||"base"}`})})]}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsxs(S,{className:"flex-1",size:"sm",onClick:is,disabled:Ie||!!k,children:[Ie?e.jsx($,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(Ke,{className:"mr-1.5 h-3.5 w-3.5"}),s("review.mergeIntoBranch",{target:W||"base",defaultValue:`Merge into ${W||"base"}`})]})}),k&&e.jsx(I,{side:"top",children:s("review.agentRunningTooltip")})]}),e.jsxs(P,{children:[e.jsx(F,{asChild:!0,children:e.jsx(S,{size:"sm",variant:"outline",onClick:()=>ne({title:we||"",body:""}),disabled:!!k,children:e.jsx(qe,{className:"h-3.5 w-3.5"})})}),e.jsx(I,{side:"top",children:k?s("review.agentRunningTooltip"):s("review.createPRTooltip",{branch:we,target:W||"base"})})]})]})]}),Le&&e.jsxs("div",{className:"flex-shrink-0 space-y-2 border-t border-sidebar-border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-destructive",children:[e.jsx(ys,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:s("review.mergeConflict",{target:W||"main"})})]}),xe&&e.jsxs(S,{className:"w-full",size:"sm",variant:"outline",onClick:os,children:[e.jsx(Ze,{className:"mr-1.5 h-3.5 w-3.5"}),s("review.openInEditor",{editor:vs[He.getState().defaultEditor]})]}),e.jsxs(S,{className:"w-full",size:"sm",onClick:as,children:[e.jsx(Nt,{className:"mr-1.5 h-3.5 w-3.5"}),s("review.askAgentResolve")]})]})]})]}),e.jsx(ye,{open:!!U,onOpenChange:i=>{i||ie(null)},children:e.jsxs(Se,{className:"max-w-sm",children:[e.jsxs(Ce,{children:[e.jsx(Ne,{children:U?.type==="revert"||U?.type==="discard-all"?s("review.discardChanges","Discard changes"):s("review.undoLastCommit","Undo last commit")}),e.jsx(ke,{children:U?.type==="revert"?s("review.revertConfirm",{paths:U?.path}):U?.type==="discard-all"?s("review.discardAllConfirm",{count:U?.paths?.length,defaultValue:`Discard changes in ${U?.paths?.length} file(s)? This cannot be undone.`}):s("review.resetSoftConfirm","Undo the last commit? Changes will be kept.")})]}),e.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>ie(null),children:s("common.cancel","Cancel")}),e.jsx(S,{variant:"destructive",size:"sm",onClick:async()=>{const i=U;ie(null),i?.type==="revert"&&i.path?await es(i.path):i?.type==="discard-all"&&i.paths?await ss(i.paths):i?.type==="reset"&&await gs()},children:s("common.confirm","Confirm")})]})]})}),e.jsx(ye,{open:!!ee,onOpenChange:i=>{i||ne(null)},children:e.jsxs(Se,{className:"max-w-sm",children:[e.jsxs(Ce,{children:[e.jsx(Ne,{children:s("review.createPR")}),e.jsx(ke,{children:s("review.createPRTooltip",{branch:we,target:W||"base"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{className:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",placeholder:s("review.prTitle","PR title"),value:ee?.title??"",onChange:i=>ne(o=>o&&{...o,title:i.target.value})}),e.jsx("textarea",{className:"w-full resize-none rounded-md border border-input bg-background px-2 py-1.5 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring",rows:4,placeholder:s("review.commitBody","Description (optional)"),value:ee?.body??"",onChange:i=>ne(o=>o&&{...o,body:i.target.value})})]}),e.jsxs("div",{className:"mt-2 flex justify-end gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>ne(null),children:s("common.cancel","Cancel")}),e.jsxs(S,{size:"sm",disabled:!ee?.title.trim()||De,onClick:ns,children:[De?e.jsx($,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):e.jsx(qe,{className:"mr-1.5 h-3.5 w-3.5"}),s("review.createPR")]})]})]})}),e.jsx(ye,{open:!!M,onOpenChange:i=>{i||le(null)},children:e.jsx(Se,{className:"flex h-[85vh] w-[90vw] max-w-[90vw] flex-col gap-0 p-0",children:(()=>{if(!M)return null;const i=f.find(d=>d.path===M);if(!i)return null;const o=m.get(M),g=vr[i.status]||Ye;return e.jsxs(e.Fragment,{children:[e.jsxs(Ce,{className:"flex-shrink-0 overflow-hidden border-b border-border px-4 py-3 pr-10",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[e.jsx(g,{className:"h-4 w-4 flex-shrink-0"}),e.jsx(Ne,{className:"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-sm",style:{direction:"rtl",textAlign:"left"},children:i.path})]}),e.jsx(ke,{className:"sr-only",children:s("review.diffFor",{file:i.path,defaultValue:`Diff for ${i.path}`})})]}),e.jsxs(wt,{className:"min-h-0 flex-1",children:[x===M?e.jsxs("div",{className:"flex items-center gap-2 p-4 text-sm text-muted-foreground",children:[e.jsx($,{className:"h-4 w-4 animate-spin"}),"Loading diff\\u2026"]}):o?e.jsx("div",{className:"[&_.diff-container]:font-mono [&_table]:w-full [&_td]:overflow-hidden [&_td]:text-ellipsis",children:e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading diff\\u2026"}),children:e.jsx(Ft,{diff:o,splitView:!0})})}):e.jsx("p",{className:"p-4 text-sm text-muted-foreground",children:s("review.binaryOrNoDiff")}),e.jsx(vt,{orientation:"horizontal"})]})]})})()})}),e.jsx(wr,{open:Bt,onOpenChange:ue,steps:Vt,title:Ht})]})}export{si as ReviewPane};
|