@ironmussa/funny 0.1.6 → 0.1.7
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/package.json +6 -2
- package/packages/client/dist/assets/{AcceptInvitePage-Dy5B7DII.js → AcceptInvitePage-BjMGmkD4.js} +1 -1
- package/packages/client/dist/assets/{ActivityPane-CV-MhQ_w.js → ActivityPane-Cl-bUP3W.js} +1 -1
- package/packages/client/dist/assets/{AddProjectView-CtW0xjNI.js → AddProjectView-DZuks8BQ.js} +1 -1
- package/packages/client/dist/assets/{AllThreadsView-Cf2UKLJT.js → AllThreadsView-DdT3QdFb.js} +1 -1
- package/packages/client/dist/assets/{AnalyticsView-YsDXUQUQ.js → AnalyticsView-b_BZhrh1.js} +1 -1
- package/packages/client/dist/assets/{App-C4O1uemY.js → App-CY9kuarV.js} +3 -3
- package/packages/client/dist/assets/{AutomationInboxView-Cj4jEXBW.js → AutomationInboxView-BQfGidRk.js} +1 -1
- package/packages/client/dist/assets/{BrowserPanel-CDhQ4pqq.js → BrowserPanel-CY_wB1AB.js} +1 -1
- package/packages/client/dist/assets/{BrowserPreview-mlb1GznK.js → BrowserPreview-2gdJqMpN.js} +1 -1
- package/packages/client/dist/assets/{CircuitBreakerDialog-IM7SsKrh.js → CircuitBreakerDialog-B6kP1aCS.js} +1 -1
- package/packages/client/dist/assets/{CommandPalette-DeUqe9ev.js → CommandPalette-DeBQCdqo.js} +1 -1
- package/packages/client/dist/assets/{CommentsPane-D6mo7vNO.js → CommentsPane-JY0CN5R2.js} +1 -1
- package/packages/client/dist/assets/{CsvTable-Bmlrdqi0.js → CsvTable-CaJ4BQ4d.js} +1 -1
- package/packages/client/dist/assets/{FileSearchDialog-DOht2aCz.js → FileSearchDialog-C2RhpM7Z.js} +1 -1
- package/packages/client/dist/assets/{FileTree-C-k9qiIl.js → FileTree-Bl25zGAE.js} +1 -1
- package/packages/client/dist/assets/{FolderPicker-Ccn8T963.js → FolderPicker-CpXi_ZrF.js} +1 -1
- package/packages/client/dist/assets/{GeneralSettingsView-70nd75Ez.js → GeneralSettingsView-f8pBncJY.js} +2 -2
- package/packages/client/dist/assets/{GitProgressModal-D0sRB_fY.js → GitProgressModal-CJG5MsSI.js} +1 -1
- package/packages/client/dist/assets/{LiveColumnsView-Dtj6sjhY.js → LiveColumnsView-DwUkXA8m.js} +1 -1
- package/packages/client/dist/assets/{LoginPage-CX5SoY9d.js → LoginPage-CkgRw9Ji.js} +1 -1
- package/packages/client/dist/assets/{MediaPreview-CSLd2xQQ.js → MediaPreview-DmMe4hGN.js} +1 -1
- package/packages/client/dist/assets/{MediaPreviewDialog-b3uRxGUy.js → MediaPreviewDialog-DHIv3gai.js} +1 -1
- package/packages/client/dist/assets/{MermaidBlock--PnCK6OJ.js → MermaidBlock-BZLj2TmL.js} +1 -1
- package/packages/client/dist/assets/{MobilePage-Z6RW3JRa.js → MobilePage-BRWC2SVo.js} +2 -2
- package/packages/client/dist/assets/{MonacoEditorDialog-W6AzCK4P.js → MonacoEditorDialog-CTUQ5NFr.js} +1 -1
- package/packages/client/dist/assets/{OrchestratorView-Bk_chlQ2.js → OrchestratorView-wTF6Ae0A.js} +1 -1
- package/packages/client/dist/assets/{PreferencesPanel-aHOy4y8T.js → PreferencesPanel-CpIL485D.js} +1 -1
- package/packages/client/dist/assets/{PreviewBrowser-C2HgO5nb.js → PreviewBrowser-CEXO1tHq.js} +1 -1
- package/packages/client/dist/assets/{ProjectFilesPane-B3eZDUID.js → ProjectFilesPane-02_p9zry.js} +1 -1
- package/packages/client/dist/assets/{ProjectHeader-D8OTTLq1.js → ProjectHeader-TWkvwAxm.js} +1 -1
- package/packages/client/dist/assets/{ProjectHooksSettings-oE9zynCA.js → ProjectHooksSettings-CIaY32WM.js} +1 -1
- package/packages/client/dist/assets/{ReviewPane-DodN13Ot.js → ReviewPane-DHTvq8t1.js} +1 -1
- package/packages/client/dist/assets/{SearchablePicker-BRZ5MGoM.js → SearchablePicker-BJnuJVEi.js} +1 -1
- package/packages/client/dist/assets/{SettingsDetailView-1z4FmtOi.js → SettingsDetailView-eBDvn5cS.js} +1 -1
- package/packages/client/dist/assets/{SettingsPageContent-CypV-sTN.js → SettingsPageContent-CiHRUvG3.js} +3 -3
- package/packages/client/dist/assets/{SetupWizard-DCtmS7Go.js → SetupWizard-B8rFRPma.js} +1 -1
- package/packages/client/dist/assets/{Sidebar-DG8RI-WX.js → Sidebar-CPU0yoaQ.js} +1 -1
- package/packages/client/dist/assets/{StashTab-CH8c3zKD.js → StashTab-BswTfOlb.js} +1 -1
- package/packages/client/dist/assets/{TestRunnerPane-Dx19F3V9.js → TestRunnerPane-DZXDbHCu.js} +1 -1
- package/packages/client/dist/assets/{TextSearchDialog-CLPa_FJZ.js → TextSearchDialog-BUMBp448.js} +1 -1
- package/packages/client/dist/assets/{ThreadPowerline-zo87eggE.js → ThreadPowerline-CSegubLW.js} +1 -1
- package/packages/client/dist/assets/{ThreadStatusPin-DQr-M4nV.js → ThreadStatusPin-DhrEC0n-.js} +1 -1
- package/packages/client/dist/assets/{ThreadView-42eEYL7W.js → ThreadView-hYXeM23q.js} +1 -1
- package/packages/client/dist/assets/{app-store-CfgpkFla.js → app-store-DKW9sVHv.js} +1 -1
- package/packages/client/dist/assets/{automation-store-CeG5quCS.js → automation-store-C8v9UlHX.js} +1 -1
- package/packages/client/dist/assets/{browser-panel-store-NtcEgowi.js → browser-panel-store-CSx5jc7O.js} +2 -2
- package/packages/client/dist/assets/{button-CZ967bB8.js → button-B9Ypx1uQ.js} +1 -1
- package/packages/client/dist/assets/{combine-BhTXrTft.js → combine-CIrCcf3o.js} +1 -1
- package/packages/client/dist/assets/{comment-store-CK5G8WPn.js → comment-store-BfRTY3FY.js} +1 -1
- package/packages/client/dist/assets/{diff-parse-PPACfn0L.js → diff-parse-DgLol0S6.js} +1 -1
- package/packages/client/dist/assets/{element-A6J8F7_i.js → element-yfBHMYal.js} +1 -1
- package/packages/client/dist/assets/{go-to-thread-BNBZv0ib.js → go-to-thread-DD0G5vFp.js} +1 -1
- package/packages/client/dist/assets/{index-DCJpZz6M.js → index-DNxUSLe_.js} +2 -2
- package/packages/client/dist/assets/{input-C2LWQS5Y.js → input-CJ3TsT2L.js} +1 -1
- package/packages/client/dist/assets/{items-azeOGVff.js → items-7qqySF-X.js} +1 -1
- package/packages/client/dist/assets/{job-store-Bxebwj0k.js → job-store-0PeOgBpX.js} +1 -1
- package/packages/client/dist/assets/{kbd-GnT1qEi9.js → kbd-d4Wzagpn.js} +1 -1
- package/packages/client/dist/assets/{loading-state-CZgfErMi.js → loading-state-yLj5fYb6.js} +1 -1
- package/packages/client/dist/assets/{markdown-components-gp0WAMTj.js → markdown-components-DxMKBjnh.js} +1 -1
- package/packages/client/dist/assets/{native-git-store-KpsndLzH.js → native-git-store-CCenGgLt.js} +1 -1
- package/packages/client/dist/assets/{orchestrator-store-CgmJPyrE.js → orchestrator-store-DP8UohlO.js} +1 -1
- package/packages/client/dist/assets/{pipeline-approval-store-B7WMnOHB.js → pipeline-approval-store-BiH1mYlB.js} +1 -1
- package/packages/client/dist/assets/{pr-detail-store-DetZmOmN.js → pr-detail-store-DHF0exs_.js} +1 -1
- package/packages/client/dist/assets/{providers-tWTQl7V7.js → providers-Dd9yhyUY.js} +1 -1
- package/packages/client/dist/assets/{sidebar-D6F-jed-.js → sidebar-Dzb_F1kj.js} +1 -1
- package/packages/client/dist/assets/{tabs-DK0DleVt.js → tabs-Cu3cWMHb.js} +1 -1
- package/packages/client/dist/assets/{test-store-20Ippy2V.js → test-store-D72ZqWH2.js} +1 -1
- package/packages/client/dist/assets/{tooltip-icon-button-DD8fKyR8.js → tooltip-icon-button-8C1wJ-l9.js} +1 -1
- package/packages/client/dist/assets/use-active-thread-id-ZlJtsqq4.js +1 -0
- package/packages/client/dist/assets/{use-branch-switch-DiWo4rV_.js → use-branch-switch-C45m2mx7.js} +1 -1
- package/packages/client/dist/assets/{use-image-lightbox-Wc7UJrhB.js → use-image-lightbox-CsMDwY1v.js} +1 -1
- package/packages/client/dist/assets/{use-stable-navigate-skK7Gqvr.js → use-stable-navigate-Cz_jWBHP.js} +1 -1
- package/packages/client/dist/assets/{use-terminal-scope-CFAKbZrD.js → use-terminal-scope-BX8zAMzc.js} +1 -1
- package/packages/client/dist/assets/{use-thread-creation-O-5GoSUZ.js → use-thread-creation-DSLV7F8I.js} +1 -1
- package/packages/client/dist/assets/{use-thread-search-BvRo6Jmy.js → use-thread-search-CXsiNqRR.js} +1 -1
- package/packages/client/dist/assets/{use-todo-panel-DE66QQ1x.js → use-todo-panel-DjPuehjq.js} +1 -1
- package/packages/client/dist/assets/{use-unified-prompt-model-groups-BFPXD7t_.js → use-unified-prompt-model-groups-wdA26Vnd.js} +1 -1
- package/packages/client/dist/assets/{use-ws-DSu9Bw5F.js → use-ws-AWIhcFYo.js} +3 -3
- package/packages/client/dist/assets/{visualizer-loader-Dsa-0UOJ.js → visualizer-loader-oxC04P38.js} +1 -1
- package/packages/client/dist/assets/{watcher-store-CPHW6IK4.js → watcher-store-gym76Ag_.js} +1 -1
- package/packages/client/dist/index.html +1 -1
- package/packages/runtime/dist/index.js +2 -2
- package/packages/runtime/dist/index.js.map +1 -1
- package/packages/client/dist/assets/use-active-thread-id-E8-K63Gj.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/markdown-DBtwZWLP.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/icons-sqwAEN28.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{$n as t,A as n,Ar as r,B as i,Bn as a,Ct as o,E as s,Fr as c,Hn as l,It as u,K as d,Kn as f,Ln as p,Lt as m,Mn as h,Mr as g,Ot as _,Pn as v,Pr as y,Q as b,Qn as x,Rn as S,Rt as C,S as w,St as T,Ut as E,Vn as D,W as O,Y as k,Zn as A,_ as j,_r as M,ar as N,b as P,bn as F,cn as I,dr as L,en as ee,er as te,fn as ne,fr as re,g as ie,gn as R,gr as ae,hn as oe,hr as se,i as ce,ir as le,k as z,ln as B,lr as V,mn as ue,on as de,ot as fe,p as pe,pn as me,rr as he,sn as ge,sr as _e,st as ve,tn as ye,tr as be,ur as xe,v as Se,vr as Ce,xn as we,y as Te,yn as Ee,yr as De,z as Oe,zn as ke,zr as Ae}from"./icons-sqwAEN28.js";import{At as je}from"./mermaid-DOtnPRYX.js";import{o as Me}from"./markdown-DBtwZWLP.js";import{t as H}from"./useTranslation-DAPPK3Hy.js";import{t as Ne}from"./telemetry-BE4cJhqj.js";import{B as U,F as Pe,G as W,P as G,R as Fe,V as Ie,W as K,d as Le,dt as Re,f as ze,j as Be,lt as q,q as J,u as Ve}from"./index-DCJpZz6M.js";import{t as Y}from"./button-CZ967bB8.js";import{$ as He,$n as Ue,$r as We,An as Ge,B as Ke,Cn as qe,Dn as Je,Dr as Ye,Gn as Xe,Gr as Ze,H as Qe,Hn as $e,In as et,Jn as X,Jr as tt,Kn as nt,Lt as rt,Mn as it,Nn as at,On as ot,Ot as st,Pt as ct,Qn as lt,R as ut,Rn as dt,Tt as ft,Un as pt,Ur as Z,V as mt,Vr as ht,Wn as gt,Xr as _t,Yn as vt,Yr as yt,Z as bt,Zn as xt,at as St,bn as Ct,bt as wt,ct as Tt,en as Et,er as Dt,et as Ot,gt as kt,hn as At,in as jt,jn as Mt,jt as Nt,kn as Pt,kt as Ft,mn as It,mt as Lt,nt as Rt,ot as zt,pt as Bt,qr as Vt,rt as Ht,sr as Ut,st as Wt,tr as Gt,tt as Kt,ut as qt,vn as Jt,vr as Yt,vt as Xt,wn as Zt,yn as Qt,yr as $t,z as en,zn as tn}from"./items-azeOGVff.js";import{a as nn,i as rn,n as an,r as on}from"./GitProgressModal-D0sRB_fY.js";import{t as sn}from"./input-C2LWQS5Y.js";import{n as cn,r as ln,t as un}from"./FileTree-C-k9qiIl.js";import{t as dn}from"./loading-state-CZgfErMi.js";import{i as fn,n as pn,t as mn,x as hn}from"./diff-parse-PPACfn0L.js";import{i as gn,n as _n,r as vn,t as yn}from"./tabs-DK0DleVt.js";import{n as bn,r as xn,t as Sn}from"./markdown-components-gp0WAMTj.js";import{n as Cn,r as wn}from"./pr-detail-store-DetZmOmN.js";import{n as Tn}from"./review-pane-store-B31R8Yhv.js";var Q=e(Ae(),1),$=e(Me(),1);function En({open:e,onOpenChange:t,shortHash:n,onCreate:r}){let{t:i}=H(),[a,o]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{e&&o(``)},[e]);let s=a.trim(),c=s.length>0&&!s.startsWith(`-`)&&/^[A-Za-z0-9._/@^~:{}=-]+$/.test(s),l=()=>{c&&(r(s),t(!1))};return(0,$.jsx)(Ze,{open:e,onOpenChange:t,children:(0,$.jsxs)(Vt,{className:`max-w-sm`,children:[(0,$.jsxs)(_t,{children:[(0,$.jsx)(We,{children:i(`graph.createBranchTitle`,`Create branch`)}),(0,$.jsx)(tt,{children:i(`graph.createBranchDesc`,{hash:n,defaultValue:`Create a new branch starting at ${n} and switch to it.`})})]}),(0,$.jsx)(sn,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),l())},placeholder:i(`graph.createBranchPlaceholder`,`branch name`),"data-testid":`create-branch-name`}),(0,$.jsxs)(yt,{children:[(0,$.jsx)(Y,{variant:`outline`,onClick:()=>t(!1),"data-testid":`create-branch-cancel`,children:i(`common.cancel`,`Cancel`)}),(0,$.jsx)(Y,{onClick:l,disabled:!c,"data-testid":`create-branch-confirm`,children:i(`graph.createBranchConfirm`,`Create branch`)})]})]})})}function Dn({pending:e,onConfirm:t,onCancel:n}){let{t:r}=H(),i=e?{checkout:{title:r(`history.confirmCheckoutTitle`,`Checkout Commit`),description:r(`history.confirmCheckoutDesc`,`This will switch to a detached HEAD at this commit. Any uncommitted changes may be lost. Continue?`),confirmLabel:r(`history.confirmCheckoutButton`,`Checkout`),variant:`default`},revert:{title:r(`history.confirmRevertTitle`,`Revert Commit`),description:r(`history.confirmRevertDesc`,`This will create a new commit that undoes the changes from this commit. Continue?`),confirmLabel:r(`history.confirmRevertButton`,`Revert`),variant:`default`},reset:{title:r(`history.confirmResetTitle`,`Hard Reset Branch`),description:r(`history.confirmResetDesc`,`Are you sure you want to hard reset the current branch to this commit? This will discard all changes and commits after this point. This action cannot be undone.`),confirmLabel:r(`history.confirmResetButton`,`Reset Branch`),variant:`destructive`},"cherry-pick":{title:r(`history.confirmCherryPickTitle`,`Cherry-pick Commit`),description:r(`history.confirmCherryPickDesc`,`This will apply this commit's changes onto the current branch as a new commit. If it conflicts, the working tree is left mid-cherry-pick for you to resolve. Continue?`),confirmLabel:r(`history.confirmCherryPickButton`,`Cherry-pick`),variant:`default`},"merge-current-into":{title:r(`history.confirmMergeCurrentIntoTitle`,{branch:e.hash,defaultValue:`Merge into ${e.hash}`}),description:r(`history.confirmMergeCurrentIntoDesc`,{branch:e.hash,defaultValue:`This will switch to ${e.hash} and merge the current branch into it. Continue?`}),confirmLabel:r(`history.confirmMergeCurrentIntoButton`,`Merge`),variant:`default`},"rebase-current-onto":{title:r(`history.confirmRebaseCurrentOntoTitle`,{branch:e.hash,defaultValue:`Rebase onto ${e.hash}`}),description:r(`history.confirmRebaseCurrentOntoDesc`,{branch:e.hash,defaultValue:`This will replay the current branch on top of ${e.hash}. If it conflicts, the working tree is left mid-rebase for you to resolve. Continue?`}),confirmLabel:r(`history.confirmRebaseCurrentOntoButton`,`Rebase`),variant:`default`}}[e.kind]:null;return(0,$.jsx)(Ut,{open:!!e,onOpenChange:e=>{e||n()},title:i?.title??``,description:i?.description??``,confirmLabel:i?.confirmLabel,variant:i?.variant??`destructive`,onConfirm:t,onCancel:n})}function On({effectiveThreadId:e,projectModeId:t,onAfterAction:n,onSuccess:r}){let{t:i}=H(),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=!!(e||t),u=(0,Q.useCallback)(()=>{e?pt.getState().fetchForThread(e,!0):t&&pt.getState().fetchProjectStatus(t,!0),n()},[e,t,n]);return{pending:a,inProgress:s,hasGitContext:l,request:(0,Q.useCallback)((e,t)=>{l&&o({kind:e,hash:t})},[l]),cancel:(0,Q.useCallback)(()=>o(null),[]),confirm:(0,Q.useCallback)(async()=>{if(!a||s||!l)return;let{kind:n,hash:d}=a;c(!0);let f=await(()=>{switch(n){case`checkout`:return e?G.checkoutCommit(e,d):G.projectCheckoutCommit(t,d);case`revert`:return e?G.revertCommit(e,d):G.projectRevertCommit(t,d);case`reset`:return e?G.resetHard(e,d):G.projectResetHard(t,d);case`cherry-pick`:return e?G.cherryPick(e,d):G.projectCherryPick(t,d);case`merge-current-into`:return e?G.mergeCurrentBranchInto(e,d):G.projectMergeCurrentBranchInto(t,d);case`rebase-current-onto`:return e?G.rebaseCurrentBranchOnto(e,d):G.projectRebaseCurrentBranchOnto(t,d)}})();if(f.isOk()){let e={checkout:i(`history.checkoutSuccess`,`Switched to commit (detached HEAD)`),revert:i(`history.revertSuccess`,`Commit reverted successfully`),reset:i(`history.resetSuccess`,`Branch reset to this commit`),"cherry-pick":i(`history.cherryPickSuccess`,`Commit cherry-picked onto current branch`),"merge-current-into":i(`history.mergeCurrentIntoSuccess`,{branch:d,defaultValue:`Merged current branch into ${d}`}),"rebase-current-onto":i(`history.rebaseCurrentOntoSuccess`,{branch:d,defaultValue:`Rebased current branch onto ${d}`})};Z.success(e[n]),r?.(n)}else gt(f.error);c(!1),o(null),u()},[a,s,l,e,t,r,u,i]),pushBranch:(0,Q.useCallback)(async n=>{if(!l||s)return;c(!0);let r=await(e?G.pushBranch(e,n):G.projectPushBranch(t,n));r.isOk()?Z.success(i(`history.pushBranchSuccess`,{branch:n,defaultValue:`Pushed ${n} to origin`})):gt(r.error),c(!1),u()},[l,s,e,t,u,i]),createBranch:(0,Q.useCallback)(async(n,r)=>{if(!l||s)return;c(!0);let a=await(e?G.createBranch(e,n,r):G.projectCreateBranch(t,n,r));a.isOk()?Z.success(i(`history.createBranchSuccess`,{branch:n,defaultValue:`Created and switched to ${n}`})):gt(a.error),c(!1),u()},[l,s,e,t,u,i])}}function kn(e){return e.branch&&e.onto?`${e.branch} -> ${e.onto}`:e.branch?e.branch:e.onto?`onto ${e.onto}`:null}function An(e){let t=new Map;for(let n of e){let e=new Set(n.commitHashes);n.startHash&&e.add(n.startHash),n.finishHash&&e.add(n.finishHash);for(let t of n.commitPairs??[])e.add(t.originalHash),e.add(t.rebasedHash);for(let r of e){let e=t.get(r);e?e.push(n):t.set(r,[n])}}return t}function jn(e,t){let n=new Set(t.map(e=>e.hash)),r=[],i=new Set;for(let t of e)for(let e of t.commitPairs??[]){if(!n.has(e.originalHash)||!n.has(e.rebasedHash))continue;let a=`${t.id}:${e.originalHash}->${e.rebasedHash}`;i.has(a)||(i.add(a),r.push({event:t,sourceHash:e.originalHash,sourceShortHash:e.originalShortHash,targetHash:e.rebasedHash,targetShortHash:e.rebasedShortHash,subject:e.subject}))}return r}var Mn=[],Nn=[],Pn=[];function Fn({hash:e,shortHash:t,githubUrl:n,effectiveThreadId:r,projectModeId:i,localBranches:o=Mn,targetBranches:s=Nn,rebaseEvents:c=Pn,onSelectRebaseEvent:l,onAfterAction:u,onOpenChange:d,triggerClassName:p}){let{t:m}=H(),[h,g]=(0,Q.useState)(!1),_=e=>{g(e),d?.(e)},[v,y]=(0,Q.useState)(!1),{pending:b,request:S,cancel:C,confirm:w,hasGitContext:T,pushBranch:E,createBranch:D}=On({effectiveThreadId:r,projectModeId:i,onAfterAction:u}),k=e=>void navigator.clipboard.writeText(e).then(()=>Z.success(m(`history.hashCopied`,{hash:t,defaultValue:`Copied ${t}`})),()=>Z.error(m(`history.hashCopyFailed`,`Failed to copy hash`))),A=c[0]??null,j=A?kn(A):null,M=A?c.length>1?m(`graph.viewRebaseDetailsCount`,{count:c.length,defaultValue:`View rebase details (${c.length})`}):m(`graph.viewRebaseDetails`,`View rebase details`):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Xe,{open:h,onOpenChange:_,children:[(0,$.jsx)(Gt,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,tabIndex:-1,onClick:e=>e.stopPropagation(),className:q(`text-muted-foreground hover:text-foreground shrink-0`,p??q(`ml-auto opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100`,h&&`opacity-100`)),"data-testid":`graph-commit-more-${t}`,children:(0,$.jsx)(a,{className:`icon-sm`})})}),(0,$.jsxs)(nt,{align:`end`,side:`bottom`,className:`w-64`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(X,{onClick:()=>k(e),"data-testid":`graph-commit-menu-copy-sha-${t}`,children:[(0,$.jsx)(ye,{className:`icon-sm`}),m(`graph.copySha`,`Copy commit SHA`)]}),(0,$.jsxs)(X,{onClick:()=>k(t),"data-testid":`graph-commit-menu-copy-short-${t}`,children:[(0,$.jsx)(f,{className:`icon-sm`}),m(`graph.copyShortSha`,`Copy short SHA`)]}),n&&(0,$.jsxs)(X,{onClick:()=>window.open(n,`_blank`,`noopener,noreferrer`),"data-testid":`graph-commit-menu-github-${t}`,children:[(0,$.jsx)(ke,{className:`icon-sm`}),m(`history.viewOnGithub`,`View on GitHub`)]}),A&&l&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xt,{}),(0,$.jsxs)(X,{onClick:()=>{l(A),_(!1)},"data-testid":`graph-commit-menu-rebase-details-${t}`,children:[(0,$.jsx)(me,{className:`icon-sm`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:j?`${M}: ${j}`:M})]})]}),T&&(0,$.jsxs)($.Fragment,{children:[o.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xt,{}),o.map(e=>(0,$.jsxs)(X,{onClick:()=>void E(e),"data-testid":`graph-commit-menu-push-${e}`,children:[(0,$.jsx)(x,{className:`icon-sm`}),m(`graph.pushBranchToOrigin`,{branch:e,defaultValue:`Push ${e} to origin`})]},e))]}),(0,$.jsx)(xt,{}),(0,$.jsxs)(X,{onClick:()=>y(!0),"data-testid":`graph-commit-menu-create-branch-${t}`,children:[(0,$.jsx)(ue,{className:`icon-sm`}),m(`graph.createBranchHere`,`Create branch from here`)]}),s.map(e=>(0,$.jsxs)(X,{onClick:()=>S(`merge-current-into`,e),"data-testid":`graph-commit-menu-merge-current-into-${e}`,children:[(0,$.jsx)(B,{className:`icon-sm`}),m(`graph.mergeCurrentIntoBranch`,{branch:e,defaultValue:`Merge current branch into ${e}`})]},`merge-current-into:${e}`)),s.map(e=>(0,$.jsxs)(X,{onClick:()=>S(`rebase-current-onto`,e),"data-testid":`graph-commit-menu-rebase-current-onto-${e}`,children:[(0,$.jsx)(me,{className:`icon-sm`}),m(`graph.rebaseCurrentOntoBranch`,{branch:e,defaultValue:`Rebase current branch onto ${e}`})]},`rebase-current-onto:${e}`)),(0,$.jsxs)(X,{onClick:()=>S(`cherry-pick`,e),"data-testid":`graph-commit-menu-cherry-pick-${t}`,children:[(0,$.jsx)(Ce,{className:`icon-sm`}),m(`graph.cherryPick`,`Cherry-pick onto current branch`)]}),(0,$.jsx)(xt,{}),(0,$.jsxs)(X,{onClick:()=>S(`checkout`,e),"data-testid":`graph-commit-menu-checkout-${t}`,children:[(0,$.jsx)(me,{className:`icon-sm`}),m(`history.checkout`,`Checkout`)]}),(0,$.jsxs)(X,{onClick:()=>S(`revert`,e),"data-testid":`graph-commit-menu-revert-${t}`,children:[(0,$.jsx)(O,{className:`icon-sm`}),m(`history.revert`,`Revert`)]}),(0,$.jsxs)(X,{className:`text-destructive focus:text-destructive`,onClick:()=>S(`reset`,e),"data-testid":`graph-commit-menu-reset-${t}`,children:[(0,$.jsx)(ee,{className:`icon-sm`}),m(`graph.resetToHere`,`Reset branch to here`)]})]})]})]}),(0,$.jsx)(Dn,{pending:b,onConfirm:w,onCancel:C}),(0,$.jsx)(En,{open:v,onOpenChange:y,shortHash:t,onCreate:t=>void D(t,e)})]})}var In=[[217,.8,.58],[142,.62,.45],[263,.68,.6],[38,.9,.52],[0,.78,.6],[190,.8,.45],[330,.72,.58],[165,.64,.42]].map(([e,t,n])=>dt(e,t,n));function Ln(e){let t=In.length;return In[(e%t+t)%t]}function Rn(e){return tn(Ln(e),.74)}var zn=1.6,Bn=e=>e*16+16/2;function Vn(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?``:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var Hn=(0,Q.memo)(function({row:e,laneCount:t,height:n,avatarUrl:r,authorName:i,committerAvatarUrl:a,committerName:o,connectUp:s,nodeYFrac:c=.5}){let l=t*16,u=e=>e*n,d=e=>u(e===.5?c:e),f=(0,Q.useId)(),p=(0,Q.useId)(),m=Bn(e.commitLane),h=u(c),g=Rn(e.nodeColor),_=r?``:Vn(i??``),v=a?``:Vn(o??``),y=Math.min(16/2,Math.max(6,Math.round(n*.15))),b=Math.max(3,Math.round(y/2)),x=Math.max(4,Math.round(y*.56)),S=m+y*.62,C=h+y*.62;return(0,$.jsxs)(`svg`,{width:l,height:n,className:`shrink-0`,style:{width:l,height:n,overflow:`visible`},"aria-hidden":`true`,children:[e.segments.map((e,t)=>{let n=Bn(e.fromLane),r=d(e.fromY),i=Bn(e.toLane),a=d(e.toY),o=Rn(e.color);if(n===i)return(0,$.jsx)(`line`,{x1:n,y1:r,x2:i,y2:a,stroke:o,strokeWidth:zn},t);let s=e.fromY===.5,c=s?n:i,l=s?r:a,u=s?i:n,f=s?a:r,p=Math.min(16/2,Math.abs(l-f),Math.abs(c-u)),m=Math.sign(c-u);return(0,$.jsx)(`path`,{d:`M ${u} ${f} L ${u} ${l-Math.sign(l-f)*p} Q ${u} ${l} ${u+m*p} ${l} L ${c} ${l}`,fill:`none`,stroke:o,strokeWidth:zn,strokeLinecap:`round`,strokeLinejoin:`round`},t)}),s&&(0,$.jsx)(`line`,{x1:m,y1:0,x2:m,y2:h,stroke:g,strokeWidth:zn,strokeDasharray:`2 2`}),r?(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`defs`,{children:(0,$.jsx)(`clipPath`,{id:f,children:(0,$.jsx)(`circle`,{cx:m,cy:h,r:y})})}),(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:`hsl(var(--background))`}),(0,$.jsx)(`image`,{href:r,x:m-y,y:h-y,width:y*2,height:y*2,clipPath:`url(#${f})`,preserveAspectRatio:`xMidYMid slice`}),(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:`none`,stroke:g,strokeWidth:zn})]}):_?(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:`hsl(var(--background))`}),(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:g,fillOpacity:.22}),(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:`none`,stroke:g,strokeWidth:zn}),(0,$.jsx)(`text`,{x:m,y:h,textAnchor:`middle`,dominantBaseline:`central`,className:`font-sans`,fontSize:y+1,fontWeight:600,fill:g,children:_})]}):(0,$.jsx)(`circle`,{cx:m,cy:h,r:b,fill:g,stroke:`hsl(var(--background))`,strokeWidth:1}),o?(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`circle`,{cx:S,cy:C,r:x+1.5,fill:`hsl(var(--background))`,stroke:g,strokeWidth:1}),a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`defs`,{children:(0,$.jsx)(`clipPath`,{id:p,children:(0,$.jsx)(`circle`,{cx:S,cy:C,r:x})})}),(0,$.jsx)(`image`,{href:a,x:S-x,y:C-x,width:x*2,height:x*2,clipPath:`url(#${p})`,preserveAspectRatio:`xMidYMid slice`})]}):v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`circle`,{cx:S,cy:C,r:x,fill:g,fillOpacity:.28}),(0,$.jsx)(`text`,{x:S,y:C,textAnchor:`middle`,dominantBaseline:`central`,className:`font-sans`,fontSize:Math.max(4,x+1),fontWeight:700,fill:g,children:v})]}):(0,$.jsx)(`circle`,{cx:S,cy:C,r:Math.max(2.5,x-1),fill:g})]}):null]})});function Un(e,t){switch(t.state){case`synced`:return e(`graph.branchStateSynced`,`Synced`);case`ahead`:return e(`graph.branchStateAhead`,{count:t.ahead,defaultValue:`Ahead ${t.ahead}`});case`behind`:return e(`graph.branchStateBehind`,{count:t.behind,defaultValue:`Behind ${t.behind}`});case`diverged`:return e(`graph.branchStateDiverged`,{ahead:t.ahead,behind:t.behind,defaultValue:`Diverged ${t.ahead}/${t.behind}`});case`local-only`:return e(`graph.branchStateLocalOnly`,`Local only`);case`remote-only`:return e(`graph.branchStateRemoteOnly`,`Remote only`)}}function Wn(e,t){switch(t.primaryAction){case`push`:return e(`review.push`,`Push`);case`pull`:return e(`review.pull`,`Pull`);case`publish`:return e(`graph.publishBranch`,`Publish`);case`checkout`:return e(`history.checkout`,`Checkout`);case`sync`:return e(`graph.syncBranch`,`Sync`);case`none`:return e(`graph.noBranchAction`,`Up to date`)}}function Gn(e,t){return t.primaryAction===`push`||t.primaryAction===`publish`?e(`graph.pushBranchToOrigin`,{branch:t.branch,defaultValue:`Push ${t.branch} to origin`}):t.primaryAction===`pull`&&t.isCurrent?e(`review.pull`,`Pull`):t.primaryAction===`checkout`?e(`graph.checkoutBeforePull`,`Checkout this branch first`):t.primaryAction===`sync`?e(`graph.syncBranchFromHistory`,`Use History to choose merge or rebase`):Wn(e,t)}function Kn(e){let t=e.indexOf(`/`);return t>=0?e.slice(t+1):e}function qn(e){return e.kind===`tag`||e.name===`HEAD`?null:e.kind===`remote`?Kn(e.name):e.name}function Jn(e){return e.kind===`remote`?Kn(e.name):e.name}function Yn(e){return e.kind===`tag`?s:e.kind===`remote`?A:e.syncedRemote?te:T}function Xn(e,t,n){let r=t.pullRequest?e(`graph.pullRequest`,{number:t.pullRequest.number,state:t.pullRequest.state,defaultValue:`PR #${t.pullRequest.number} (${t.pullRequest.state})`}):null,i;return i=t.kind===`tag`?t.name:t.kind===`remote`?e(`graph.remoteBranch`,{ref:t.name,defaultValue:`${t.name} (remote branch)`}):t.syncedRemote?e(`graph.branchSynced`,{ref:t.name,remote:t.syncedRemote,defaultValue:t.isCurrent?`${t.name} (current branch · in sync with ${t.syncedRemote})`:`${t.name} (in sync with ${t.syncedRemote})`}):t.isCurrent?e(`graph.currentBranch`,{ref:t.name,defaultValue:`${t.name} (current branch)`}):t.name,[i,n?Un(e,n):null,r].filter(Boolean).join(` · `)}function Zn(e,t,n){if(t.kind===`tag`)return e(`graph.tag`,`Tag`);if(!n)return null;switch(n.state){case`synced`:return null;case`ahead`:return t.kind===`local`?String(n.ahead):null;case`behind`:return t.kind===`remote`?String(n.behind):null;case`diverged`:return e(`graph.branchChipDiverged`,`Diverged`);case`local-only`:return null;case`remote-only`:return null}}function Qn({ref:e,summary:t}){let{t:n}=H(),r=t?.localRef??n(`graph.notPresent`,`Not present`),i=t?.remoteRef??n(`graph.notPresent`,`Not present`);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 text-xs`,"data-testid":`graph-branch-detail-${e.name}`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-muted-foreground text-[10px] font-medium uppercase`,children:n(`graph.branch`,`Branch`)}),(0,$.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t?.branch??e.name})]}),(0,$.jsxs)(`dl`,{className:`grid grid-cols-[64px_minmax(0,1fr)] gap-x-3 gap-y-1.5`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.local`,`Local`)}),(0,$.jsx)(`dd`,{className:`min-w-0 truncate font-mono`,title:r,children:r}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.origin`,`Origin`)}),(0,$.jsx)(`dd`,{className:`min-w-0 truncate font-mono`,title:i,children:i}),t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.state`,`State`)}),(0,$.jsx)(`dd`,{children:Un(n,t)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.localAhead`,`Ahead`)}),(0,$.jsx)(`dd`,{children:t.ahead}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.originAhead`,`Behind`)}),(0,$.jsx)(`dd`,{children:t.behind}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.action`,`Action`)}),(0,$.jsx)(`dd`,{children:Gn(n,t)})]}):null]})]})}function $n({refs:e,branchSummaryByName:t,actionInProgress:n,color:r,searchQuery:i,onPushBranch:a,onPullCurrentBranch:o}){let{t:s}=H();if(e.length===0)return null;let c=et(r),u=i.trim().length>0;return(0,$.jsx)(`div`,{className:`inline-flex min-w-0 shrink items-center gap-1`,"data-testid":`graph-ref-chips`,children:e.map(e=>{let d=qn(e),f=d?t.get(d):void 0,p=e.kind===`local`&&!!f&&(f.primaryAction===`push`||f.primaryAction===`publish`),m=e.kind===`remote`&&!!f&&f.primaryAction===`pull`&&f.isCurrent,h=m?`pull:${d}`:`push:${d}`,g=!!d&&n===h,_=Yn(e),v=m?l:j,y=Zn(s,e,f),b=Jn(e);return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{className:`inline-flex min-w-0 items-center gap-0.5 rounded-full px-1 py-px transition-[filter] hover:brightness-90`,style:{backgroundColor:r,color:c},"data-testid":`graph-ref-chip-${e.kind}:${e.name}`,children:(0,$.jsxs)(Ge,{children:[(0,$.jsx)(it,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`focus-visible:ring-ring/70 inline-flex min-w-0 items-center gap-0.5 rounded-full px-0.5 text-left outline-hidden focus-visible:ring-1`,"aria-label":Xn(s,e,f),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),"data-testid":`graph-branch-info-${e.name}`,children:[(0,$.jsx)(_,{className:`icon-2xs shrink-0`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:q(`truncate text-[10px] leading-tight font-medium whitespace-nowrap`,e.kind===`local`&&e.isCurrent&&`font-bold`),children:u?(0,$.jsx)(at,{text:b,query:i}):b})]})}),(0,$.jsx)(Mt,{side:`bottom`,align:`start`,className:`w-72 p-3`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(Qn,{ref:e,summary:f})})]})}),(p||m)&&d&&f?(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,variant:`default`,size:`xs`,"aria-label":Gn(s,f),className:`h-auto min-h-0 shrink-0 gap-0.5 rounded-full px-1.5 py-px text-[10px] leading-tight font-semibold [&_svg]:!size-2.5`,disabled:!!n,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation(),p?a(d):o(d)},"data-testid":`graph-branch-action-${d}`,children:[y?(0,$.jsx)(`span`,{"data-testid":`graph-branch-status-${e.name}`,children:y}):(0,$.jsx)(`span`,{children:Wn(s,f)}),(0,$.jsx)(v,{className:q(g&&`animate-pulse`),"data-testid":`graph-branch-action-icon-${d}`})]})}),(0,$.jsx)(W,{side:`top`,children:Gn(s,f)})]}):null]},`${e.kind}:${e.name}`)})})}async function er(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var tr=/^(?:(\d+)\+)?([^@\s]+)@users\.noreply\.github\.com$/i;async function nr(e){if(!e)return null;let t=e.trim().toLowerCase();if(!t)return null;let n=t.match(tr);if(n){let e=n[1],t=n[2];return e?`https://avatars.githubusercontent.com/u/${e}?size=64`:`https://github.com/${encodeURIComponent(t)}.png?size=64`}return`https://gravatar.com/avatar/${await er(t)}?s=64&d=identicon`}var rr=Be(`avatar-cache`),ir=6e4,ar=300,or=new Map,sr=new Map;function cr(e){let t=or.get(e);return t&&t.expiresAt>Date.now()?t.objectUrl:null}function lr(){for(;or.size>ar;){let e=or.keys().next().value;if(e===void 0)break;let t=or.get(e);t&&URL.revokeObjectURL(t.objectUrl),or.delete(e)}}async function ur(e){try{let t=await fetch(e,{mode:`cors`,credentials:`omit`});if(!t.ok)return rr.debug(`avatar fetch non-ok`,{status:t.status}),null;let n=await t.blob(),r=URL.createObjectURL(n),i=or.get(e);return i&&URL.revokeObjectURL(i.objectUrl),or.set(e,{objectUrl:r,expiresAt:Date.now()+ir}),lr(),r}catch(e){return rr.debug(`avatar fetch failed`,{error:e instanceof Error?e.message:String(e)}),null}}function dr(e){let[t,n]=(0,Q.useState)(()=>e?cr(e)??void 0:void 0);return(0,Q.useEffect)(()=>{if(!e){n(void 0);return}let t=cr(e);if(t){n(t);return}n(void 0);let r=!0,i=sr.get(e);return i||(i=ur(e).finally(()=>sr.delete(e)),sr.set(e,i)),i.then(t=>{r&&n(t??e)}),()=>{r=!1}},[e]),t}var fr=new Map,pr={xs:{avatar:`h-3.5 w-3.5`,text:`text-[8px]`},sm:{avatar:`h-4 w-4`,text:`text-[9px]`}};function mr({name:e,avatarUrl:t,email:n,size:r=`xs`,className:i,children:a}){let{avatar:o,text:s}=pr[r],[c,l]=(0,Q.useState)(()=>n?fr.get(n)??null:null);(0,Q.useEffect)(()=>{if(!n||t||fr.has(n))return;let e=!1;return nr(n).then(t=>{e||!t||(fr.set(n,t),l(t))}),()=>{e=!0}},[n,t]);let u=dr(t??c);return(0,$.jsxs)(`span`,{className:q(`flex min-w-0 items-center gap-1 truncate`,i),children:[(0,$.jsxs)(Je,{className:o,children:[u&&(0,$.jsx)(Pt,{src:u,alt:e}),(0,$.jsx)(ot,{name:e,className:s,children:e.charAt(0).toUpperCase()})]}),(0,$.jsx)(`span`,{className:`truncate`,children:a??e})]})}function hr({direction:e,onResize:t,onResizeStart:n,onResizeEnd:r}){let i=(0,Q.useRef)(!1),a=(0,Q.useRef)(0),[o,s]=(0,Q.useState)(!1),c=e===`horizontal`?`col-resize`:`row-resize`;return{resizing:o,handlePointerDown:(0,Q.useCallback)(t=>{i.current=!0,a.current=e===`horizontal`?t.clientX:t.clientY,s(!0),Object.assign(document.body.style,{cursor:c,userSelect:`none`}),t.target.setPointerCapture(t.pointerId),n?.()},[e,c,n]),handlePointerMove:(0,Q.useCallback)(n=>{i.current&&t((e===`horizontal`?n.clientX:n.clientY)-a.current)},[e,t]),handlePointerUp:(0,Q.useCallback)(e=>{i.current&&(i.current=!1,s(!1),Object.assign(document.body.style,{cursor:``,userSelect:``}),e.target.releasePointerCapture(e.pointerId),r?.())},[r])}}var gr=(0,Q.forwardRef)(function({direction:e,resizing:t,onPointerDown:n,onPointerMove:r,onPointerUp:i,onClick:a,className:o,"data-testid":s,...c},l){let u=e===`horizontal`;return(0,$.jsx)(`button`,{ref:l,"aria-label":`Resize`,tabIndex:-1,onPointerDown:n,onPointerMove:r,onPointerUp:i,onClick:a,className:q(`relative z-10 shrink-0`,u?`w-1.5 cursor-col-resize after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-border after:transition-all after:ease-linear hover:after:w-[3px] hover:after:bg-ring/50`:`h-1.5 cursor-row-resize after:absolute after:inset-x-0 after:top-1/2 after:h-px after:-translate-y-1/2 after:bg-border after:transition-all after:ease-linear hover:after:h-[3px] hover:after:bg-ring/50`,u&&t&&`after:w-[3px]! after:bg-ring/50!`,!u&&t&&`after:h-[3px]! after:bg-ring/50!`,o),"data-testid":s,...c})});async function _r(e,t=e=>navigator.clipboard.writeText(e)){return await t(e.hash),e.shortHash}var vr=`commit-detail-dialog:sidebar-width`,yr=180,br=600,xr=280;function Sr({selectedCommit:e,selectedHash:t,effectiveThreadId:n,projectModeId:r,githubAvatarBySha:i,onClose:a,onAfterAction:o}){let{t:s}=H(),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(()=>{let e=Number(localStorage.getItem(vr));return Number.isFinite(e)&&e>=yr&&e<=br?e:xr}),k=(0,Q.useRef)(E),{resizing:A,handlePointerDown:j,handlePointerMove:M,handlePointerUp:N}=hr({direction:`horizontal`,onResizeStart:()=>{k.current=E},onResize:e=>{D(Math.max(yr,Math.min(br,k.current+e)))}});(0,Q.useEffect)(()=>{A||localStorage.setItem(vr,String(E))},[A,E]);let P=!!(n||r),{pending:F,inProgress:I,request:L,cancel:te,confirm:re}=On({effectiveThreadId:n,projectModeId:r,onAfterAction:o,onSuccess:a}),ie=e=>I&&F?.kind===e,R=(0,Q.useCallback)(()=>{e&&_r(e).then(e=>Z.success(s(`history.hashCopied`,{hash:e,defaultValue:`Copied ${e}`})),()=>Z.error(s(`history.hashCopyFailed`,`Failed to copy hash`)))},[e,s]);(0,Q.useEffect)(()=>{if(!t||!P){l([]),p(null),_(``);return}let i=!1;return d(!0),p(e?.body.trim()||null),_(``),(async()=>{let[e,a]=await Promise.all([n?G.getCommitFiles(n,t):G.projectCommitFiles(r,t),n?G.getCommitBody(n,t):G.projectCommitBody(r,t)]);if(!i){if(e.isOk()){if(l(e.value.files),e.value.files.length>0){let a=e.value.files[0].path;x(a),T(!0),C(null);let o=n?await G.getCommitFileDiff(n,t,a):await G.projectCommitFileDiff(r,t,a);!i&&o.isOk()&&C(o.value.diff),i||T(!1)}}else Z.error(s(`review.logFailed`,{message:e.error.message,defaultValue:`Failed to load commit files: ${e.error.message}`})),l([]);a.isOk()&&a.value.body&&p(a.value.body),d(!1)}})(),()=>{i=!0}},[t,e?.body,P,n,r,s]);let ae=(0,Q.useCallback)(async e=>{if(!t||!P)return;x(e),T(!0),C(null);let i=n?await G.getCommitFileDiff(n,t,e):await G.projectCommitFileDiff(r,t,e);i.isOk()?C(i.value.diff):Z.error(`Failed to load diff: ${i.error.message}`),T(!1)},[t,P,n,r]),oe=(0,Q.useMemo)(()=>{let e=c.map(e=>({path:e.path,status:e.status===`copied`?`renamed`:e.status,staged:!1,additions:e.additions,deletions:e.deletions}));if(!g.trim())return e;if(v)return e.filter(e=>e.path.includes(g));let t=g.toLowerCase();return e.filter(e=>e.path.toLowerCase().includes(t))},[c,g,v]),se=(0,Q.useMemo)(()=>{let e=new Map;return b&&S&&e.set(b,S),e},[b,S]),le=()=>{a(),x(null),C(null)};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ze,{open:!!t,onOpenChange:e=>{e||le()},children:(0,$.jsxs)(Vt,{className:`flex h-[85vh] max-w-[90vw] flex-col gap-0 p-0`,"data-testid":`commit-detail-dialog`,children:[(0,$.jsxs)(`div`,{className:`border-border shrink-0 border-b px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(We,{className:`text-sm leading-tight font-semibold`,children:e?.message??`Commit details`}),(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:le,className:`text-muted-foreground sr-only shrink-0`,"data-testid":`commit-detail-close`,children:(0,$.jsx)(ce,{className:`icon-xs`})})]}),(0,$.jsx)(tt,{className:`sr-only`,children:`Commit detail with file changes and diffs`}),e&&(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 pt-1 text-[11px]`,children:[(0,$.jsx)(ne,{className:`icon-xs shrink-0`}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:R,className:`text-primary shrink-0 cursor-pointer border-0 bg-transparent p-0 font-mono hover:underline`,"data-testid":`commit-detail-hash-${e.shortHash}`,children:(0,$.jsx)(`code`,{children:e.shortHash})})}),(0,$.jsx)(W,{side:`bottom`,children:s(`history.copyHash`,`Click to copy hash`)})]}),(0,$.jsx)(mr,{name:e.author,email:e.authorEmail,avatarUrl:i.get(e.hash),size:`sm`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:Et(e.relativeDate)}),(0,$.jsxs)(`span`,{className:`text-muted-foreground shrink-0`,children:[`· `,c.length,` file`,c.length===1?``:`s`]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`xs`,onClick:()=>t&&L(`checkout`,t),disabled:I,"data-testid":`commit-checkout-btn`,children:[ie(`checkout`)?(0,$.jsx)(m,{className:`animate-spin`}):(0,$.jsx)(me,{}),s(`history.checkout`,`Checkout`)]})}),(0,$.jsx)(W,{side:`bottom`,children:s(`history.checkoutTooltip`,`Checkout this commit (detached HEAD)`)})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`xs`,onClick:()=>t&&L(`revert`,t),disabled:I,"data-testid":`commit-revert-btn`,children:[ie(`revert`)?(0,$.jsx)(m,{className:`animate-spin`}):(0,$.jsx)(O,{}),s(`history.revert`,`Revert`)]})}),(0,$.jsx)(W,{side:`bottom`,children:s(`history.revertTooltip`,`Undo this commit with a new commit`)})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`xs`,className:`text-destructive hover:text-destructive`,onClick:()=>t&&L(`reset`,t),disabled:I,"data-testid":`commit-reset-btn`,children:[ie(`reset`)?(0,$.jsx)(m,{className:`animate-spin`}):(0,$.jsx)(ee,{}),s(`history.reset`,`Reset`)]})}),(0,$.jsx)(W,{side:`bottom`,children:s(`history.resetTooltip`,`Hard reset branch to this commit`)})]}),(0,$.jsx)(`div`,{className:`bg-border mx-1 h-4 w-px`}),(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:le,className:`text-muted-foreground shrink-0`,"data-testid":`commit-detail-close`,children:(0,$.jsx)(ce,{className:`icon-xs`})})]})]}),f&&(0,$.jsx)(jt,{className:`mt-1.5 max-h-[80px]`,children:(0,$.jsx)(`p`,{className:`text-muted-foreground text-[11px] whitespace-pre-wrap`,children:f})})]}),u?(0,$.jsx)(dn,{testId:`commit-detail-loading`,label:s(`review.loading`,`Loading changes…`)}):(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col`,style:{width:E},"data-testid":`commit-detail-file-tree`,children:[c.length>0&&(0,$.jsx)(`div`,{className:`border-sidebar-border shrink-0 border-b px-2 py-1`,children:(0,$.jsx)(It,{query:g,onQueryChange:_,placeholder:s(`review.searchFiles`,`Filter files…`),totalMatches:oe.length,resultLabel:g?`${oe.length}/${c.length}`:``,caseSensitive:v,onCaseSensitiveChange:y,onClose:g?()=>_(``):void 0,autoFocus:!1,testIdPrefix:`commit-detail-file-filter`})}),(0,$.jsx)(jt,{className:`min-h-0 flex-1`,children:c.length===0?(0,$.jsx)(`div`,{className:`text-muted-foreground py-4 text-center text-xs`,children:s(`history.noFiles`,`No files changed`)}):oe.length===0?(0,$.jsx)(`div`,{className:`text-muted-foreground py-4 text-center text-xs`,children:s(`history.noMatchingFiles`,`No matching files`)}):(0,$.jsx)(un,{files:oe,selectedFile:b,onFileClick:ae,testIdPrefix:`commit-detail`,searchQuery:g||void 0})})]}),(0,$.jsx)(gr,{direction:`horizontal`,resizing:A,onPointerDown:j,onPointerMove:M,onPointerUp:N,"data-testid":`commit-detail-sidebar-resize`}),(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,"data-testid":`commit-detail-diff-pane`,children:b?(0,$.jsx)(fn,{filePath:b,oldValue:S?pn(S):``,newValue:S?mn(S):``,loading:w,rawDiff:S??void 0,files:oe,onFileSelect:ae,diffCache:se}):(0,$.jsxs)(`div`,{className:`text-muted-foreground flex flex-1 flex-col items-center justify-center gap-2`,children:[(0,$.jsx)(h,{className:`size-8 opacity-30`}),(0,$.jsx)(`p`,{className:`text-xs`,children:s(`history.selectFile`,`Select a file to view changes`)})]})})]})]})}),(0,$.jsx)(Dn,{pending:F,onConfirm:re,onCancel:te})]})}var Cr={sm:{badge:`h-6 px-2 text-sm`,icon:`h-3.5 w-3.5`},xs:{badge:`h-5 px-1.5 text-xs`,icon:`h-3 w-3`},compact:{badge:`h-[15px] px-1 text-[10px]`,icon:`h-2.5 w-2.5`},xxs:{badge:`h-4 px-1 text-[10px]`,icon:`h-2.5 w-2.5`}},wr={OPEN:`border-emerald-300/70 bg-emerald-50 text-emerald-700 hover:border-emerald-400 hover:text-emerald-800 dark:border-emerald-400/35 dark:bg-emerald-400/15 dark:text-emerald-200 dark:hover:border-emerald-300/60 dark:hover:text-emerald-100`,MERGED:`border-violet-300/70 bg-violet-50 text-violet-700 hover:border-violet-400 hover:text-violet-800 dark:border-violet-400/35 dark:bg-violet-400/15 dark:text-violet-200 dark:hover:border-violet-300/60 dark:hover:text-violet-100`,CLOSED:`border-rose-300/70 bg-rose-50 text-rose-700 hover:border-rose-400 hover:text-rose-800 dark:border-rose-400/35 dark:bg-rose-400/15 dark:text-rose-200 dark:hover:border-rose-300/60 dark:hover:text-rose-100`};function Tr({prNumber:e,prState:t=`OPEN`,prUrl:n,size:r=`xs`,showExternalIcon:i=!!n,className:a,...o}){let{t:s}=H(),c=Cr[r],l=t===`OPEN`?s(`thread.prOpen`,{number:e,defaultValue:`PR #${e}`}):t===`MERGED`?s(`thread.prMerged`,{number:e,defaultValue:`PR #${e} (merged)`}):s(`thread.prClosed`,{number:e,defaultValue:`PR #${e} (closed)`}),u=q(`inline-flex shrink-0 items-center gap-0.5 rounded-[3px] border leading-none font-semibold focus-visible:ring-ring focus-visible:ring-1 focus-visible:outline-none`,c.badge,wr[t],!n&&`cursor-default`,a),d=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{children:[`#`,e]}),i?(0,$.jsx)(ke,{className:c.icon,"aria-hidden":`true`}):null]});return n?(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>{e.stopPropagation()},onKeyDown:e=>e.stopPropagation(),className:u,"data-testid":o[`data-testid`],"aria-label":l,children:d})}),(0,$.jsx)(W,{side:`top`,className:`text-xs`,children:l})]}):(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`span`,{className:u,"data-testid":o[`data-testid`],children:d})}),(0,$.jsx)(W,{side:`top`,className:`text-xs`,children:l})]})}function Er({icon:e,title:t,description:n,action:r,className:i,testId:a}){return(0,$.jsxs)(`div`,{"data-testid":a,className:q(`flex h-full w-full flex-col items-center justify-center gap-2 p-4 text-center text-muted-foreground`,i),children:[e&&(0,$.jsx)(e,{className:`size-8 opacity-40`}),(0,$.jsx)(`p`,{className:`text-xs`,children:t}),n&&(0,$.jsx)(`div`,{className:`text-muted-foreground/70 text-[10px]`,children:n}),r&&(0,$.jsx)(`div`,{className:`mt-1`,children:r})]})}var Dr={default:{time:`group-hover:opacity-0 group-hover:pointer-events-none`,menu:`group-hover:opacity-100`},thread:{time:`group-hover/thread:opacity-0 group-hover/thread:pointer-events-none`,menu:`group-hover/thread:opacity-100`}};function Or({time:e,timeClassName:t,children:n,open:r=!1,group:i=`default`,className:a}){let o=Dr[i];return(0,$.jsxs)(`div`,{className:q(`grid place-items-center justify-items-center`,a),children:[(0,$.jsx)(`span`,{className:q(`col-start-1 row-start-1`,o.time,t,r&&`pointer-events-none opacity-0`),children:e}),(0,$.jsx)(`div`,{className:q(`col-start-1 row-start-1 flex items-center opacity-0`,o.menu,r&&`opacity-100!`),children:n})]})}function kr(e,t,n){return e?t:n}function Ar(e,t,n,r){return e&&(!t||n&&!!r)}function jr(e,t,n){return e?t:n}function Mr(){return kr($t(e=>e.liveColumnsOpen),$t(e=>e.gridSelectedThreadId),rt(e=>e.selectedThreadId))}function Nr(){let e=$t(e=>e.liveColumnsOpen),t=ct($t(e=>e.gridSelectedThreadId)),n=Ye(e=>e.selectedProjectId);return jr(e,t?.projectId||null,n)}function Pr(e,t,n){let r=$e(e),i=pt(n=>!e&&t?n.statusByProject[t]:void 0),a=e?r:i;return(0,Q.useEffect)(()=>{n&&(e?pt.getState().fetchForThread(e):t&&pt.getState().fetchProjectStatus(t))},[n,e,t]),{status:a,dirty:!!a&&a.state!==`clean`&&(a.linesAdded>0||a.linesDeleted>0||(a.dirtyFileCount??0)>0)}}var Fr=0,Ir=.5,Lr=1;function Rr(e){let t=[],n=[],r=0,i=new Set(e.map(e=>e.hash)),a=()=>{let e=t.indexOf(null);return e===-1?t.length:e};for(let o of e){let e=t.slice(),s=t.indexOf(o.hash);s===-1&&(s=a());for(let e=0;e<t.length;e++)t[e]===o.hash&&(t[e]=null);for(;t.length<=s;)t.push(null);t[s]=null;let c=(e,n)=>{let r=t.indexOf(e);if(r!==-1&&!i.has(e))return r;if(n!==null&&(t[n]===null||t[n]===void 0)){for(;t.length<=n;)t.push(null);return t[n]=e,n}let o=a();for(;t.length<=o;)t.push(null);return t[o]=e,o},l=[];o.parentHashes.forEach((e,t)=>{let n=c(e,t===0?s:null);l.push(n)});let u=[],d=new Set,f=e=>{let t=`${e.fromLane},${e.fromY},${e.toLane},${e.toY}`;d.has(t)||(d.add(t),u.push(e))};for(let n=0;n<e.length;n++){let r=e[n];r!==null&&(r===o.hash?f({fromLane:n,fromY:Fr,toLane:s,toY:Ir,color:n}):t[n]===r&&f({fromLane:n,fromY:Fr,toLane:n,toY:Lr,color:n}))}for(let e of l)f({fromLane:s,fromY:Ir,toLane:e,toY:Lr,color:e});n.push({commitLane:s,nodeColor:s,segments:u});let p=Math.max(t.length,e.length,s+1,...l.map(e=>e+1));for(p>r&&(r=p);t.length>0&&t[t.length-1]===null;)t.pop()}return{rows:n,laneCount:Math.max(r,1)}}function zr(e,t){let n=t.trim().toLowerCase();return!!(!n||e.hash?.toLowerCase().includes(n)||e.shortHash?.toLowerCase().includes(n)||e.message.toLowerCase().includes(n)||e.body&&e.body.toLowerCase().includes(n)||e.refs?.some(e=>e.name.toLowerCase().includes(n)))}function Br(e){if(!e||e===`exists`)return null;let t=Nt(e);return t?.includes(`github.com`)?t.replace(/\/$/,``):null}function Vr(e,t){return`${e.replace(/\/$/,``)}/commit/${t}`}function Hr(e,t,n){return!e||n?null:Vr(e,t)}var Ur=e=>e.slice(e.indexOf(`/`)+1);function Wr(e,t){return typeof e==`string`?e.includes(`/`)?{name:e,kind:t.has(Ur(e))?`remote`:`local`}:{name:e,kind:/^v?\d/.test(e)?`tag`:`local`}:e}function Gr(e,t){let n=e.filter(e=>(typeof e==`string`?e:e.name).trim()!==``),r=new Set(n.map(e=>typeof e==`string`?e:e.name)),i=n.map(e=>Wr(e,r)),a=new Set(i.filter(e=>e.kind===`local`).map(e=>e.name)),o=new Map;for(let e of i){if(e.kind!==`remote`)continue;let t=Ur(e.name);a.has(t)&&!o.has(t)&&o.set(t,e)}let s=[];for(let e of i)if(!(e.kind===`remote`&&o.get(Ur(e.name))===e))if(e.kind===`tag`)s.push({kind:`tag`,name:e.name,isCurrent:!1});else if(e.kind===`remote`){let t={kind:`remote`,name:e.name,isCurrent:!1};e.pullRequest&&(t.pullRequest=e.pullRequest),s.push(t)}else{let n=o.get(e.name),r={kind:`local`,name:e.name,isCurrent:!!t&&e.name===t,syncedRemote:n?.name},i=e.pullRequest??n?.pullRequest;i&&(r.pullRequest=i),s.push(r)}return s}function Kr(e){let t=qr(e);return t.length>0?t.join(`, `):null}function qr(e){let t=[],n=[];for(let r of e)r.kind===`local`&&r.name!==`HEAD`?t.push(r.name):r.kind===`remote`&&n.push(r.name);return t.length>0?t:n.length>0?n:[]}function Jr(e){let t=new Set;for(let n of e)n.kind===`local`&&n.name!==`HEAD`?(t.add(n.name),n.syncedRemote&&t.add(Ur(n.syncedRemote))):n.kind===`remote`&&t.add(Ur(n.name));return t}function Yr(e,t){for(let n of e)if(t.has(n))return!0;return!1}function Xr(e,t,n){let r=e.get(t);r?r.includes(n)||r.push(n):e.set(t,[n])}function Zr(e){let t=new Map(e.map(e=>[e.hash,e])),n=new Map;for(let r of e){let e=qr(Gr(r.refs,r.headBranch));if(e.length===0)continue;let i=[r.hash],a=new Set;for(;i.length>0;){let r=i.pop();if(a.has(r))continue;a.add(r);for(let t of e)Xr(n,r,t);let o=t.get(r);if(o)for(let e of o.parentHashes??[])t.has(e)&&i.push(e)}}return n}function Qr(e){let t=new Map(e.map(e=>[e.hash,e])),n=new Map;for(let r of e){let e=Jr(Gr(r.refs,r.headBranch)),i=[...r.parentHashes??[]],a=new Set;for(;i.length>0;){let o=i.shift();if(a.has(o))continue;a.add(o);let s=t.get(o);if(!s)continue;let c=Gr(s.refs,s.headBranch),l=Kr(c);if(l&&!Yr(e,Jr(c))){n.set(r.hash,l);break}i.push(...s.parentHashes??[])}}return n}function $r(e){let t=new Map(e.map(e=>[e.hash,e])),n=Zr(e),r=new Map;for(let i of e){let e=i.parentHashes?.[0];if(!e)continue;let a=t.get(e);if(!a){r.set(i.hash,{commit:e.slice(0,7),branchLabels:[]});continue}let o=a.shortHash??a.hash.slice(0,7),s=qr(Gr(a.refs,a.headBranch)),c=s.length>0?s:n.get(a.hash)??[];r.set(i.hash,{commit:o,branchLabels:c})}return r}function ei(e,t){let n=new Map(t.map(e=>[e.hash,e])),r=new Map;for(let t of e){let e=n.get(t.sourceHash),i=(e?Kr(Gr(e.refs,e.headBranch)):null)??t.event?.branch??t.event?.onto??t.sourceShortHash??t.sourceHash.slice(0,7);i&&Xr(r,t.targetHash,i)}return new Map(Array.from(r,([e,t])=>[e,t.join(`, `)]))}function ti(e){let t=new Map(e.map(e=>[e.hash,e])),n=new Set,r=new Set;for(let t of e)for(let e of t.refs)e.kind===`remote`&&n.add(t.hash),e.kind===`local`&&e.name!==`HEAD`&&r.add(t.hash);let i=e=>{let n=new Set,r=[...e];for(;r.length>0;){let e=r.pop();if(n.has(e))continue;n.add(e);let i=t.get(e);if(i)for(let e of i.parentHashes)t.has(e)&&r.push(e)}return n},a=i(n),o=i(r),s=new Set;for(let e of a)o.has(e)||s.add(e);return s}function ni(e,t){let n=new Set;if(!e)return n;let r=[e];for(;r.length>0;){let e=r.pop();if(n.has(e))continue;n.add(e);let i=t.get(e);if(i)for(let e of i.parentHashes)t.has(e)&&r.push(e)}return n}function ri(e,t){let n=0;for(let r of e)t.has(r)||(n+=1);return n}function ii(e){let t=new Map(e.map(e=>[e.hash,e])),n=new Map,r=e=>{let t=n.get(e);if(t)return t;let r={branch:e,isCurrent:!1,ahead:0,behind:0,state:`local-only`,primaryAction:`publish`};return n.set(e,r),r};for(let t of e)for(let e of t.refs)if(!(e.kind===`tag`||e.name===`HEAD`)){if(e.kind===`local`){let n=r(e.name);n.localRef=e.name,n.localHash=t.hash,n.isCurrent||=t.headBranch===e.name}else if(e.kind===`remote`){let n=r(Ur(e.name));(!n.remoteRef||e.name.startsWith(`origin/`))&&(n.remoteRef=e.name,n.remoteHash=t.hash)}}for(let e of n.values())if(e.localHash&&e.remoteHash){if(e.localHash===e.remoteHash){e.state=`synced`,e.primaryAction=`none`,e.ahead=0,e.behind=0;continue}let n=ni(e.localHash,t),r=ni(e.remoteHash,t);e.ahead=ri(n,r),e.behind=ri(r,n),r.has(e.localHash)?(e.state=`behind`,e.primaryAction=e.isCurrent?`pull`:`checkout`):n.has(e.remoteHash)?(e.state=`ahead`,e.primaryAction=`push`):(e.state=`diverged`,e.primaryAction=e.isCurrent?`sync`:`checkout`)}else e.localHash?(e.state=`local-only`,e.primaryAction=`publish`,e.ahead=0,e.behind=0):(e.state=`remote-only`,e.primaryAction=`checkout`,e.ahead=0,e.behind=0);return[...n.values()].sort((e,t)=>{if(e.isCurrent!==t.isCurrent)return e.isCurrent?-1:1;let n={diverged:0,ahead:1,behind:2,"local-only":3,"remote-only":4,synced:5},r=n[e.state]-n[t.state];return r===0?e.branch.localeCompare(t.branch):r})}var ai=8;function oi({laneGutterWidth:e,railWidth:t,leftInset:n=12}){return n+e+t/2}function si({sourceLane:e,targetLane:t}){return Math.max(e??t,t)+1}function ci({sourceLane:e,targetLane:t,laneCount:n}){return si({sourceLane:e,targetLane:t})>=n}function li({sourceX:e,sourceY:t,targetX:n,targetY:r,railX:i,radius:a=ai}){let o=r-t,s=i-e,c=n-i;if(o===0||s===0||c===0)return`M ${e} ${t} L ${i} ${t} L ${i} ${r} L ${n} ${r}`;let l=Math.sign(o),u=Math.sign(s),d=Math.sign(c),f=Math.min(a,Math.abs(s),Math.abs(o)/2),p=Math.min(a,Math.abs(c),Math.abs(o)/2);return[`M ${e} ${t}`,`L ${i-u*f} ${t}`,`Q ${i} ${t} ${i} ${t+l*f}`,`L ${i} ${r-l*p}`,`Q ${i} ${r} ${i+d*p} ${r}`,`L ${n} ${r}`].join(` `)}var ui=Be(`commit-graph`),di=new Map;function fi(e){return!!e.committer&&(e.committer!==e.author||!!e.committerEmail&&e.committerEmail!==e.authorEmail)}var pi=80,mi=10.5,hi=16,gi=40,_i=2e3;function vi(e){return 12+e*16+16/2}function yi(e){return vi(e)+16/2+2}function bi(e){return Math.max(e,1)}function xi({visible:e}){let{t}=H(),n=Math.round(mi*1.5)+6,r=(0,Q.useCallback)(e=>e.refs.length>0?43:n,[n,43]),a=Nr(),o=Mr()||void 0,s=o?null:a,c=ft(),l=!!(o||s),[u,d]=(0,Q.useState)([]),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!0),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(new Set),[S,C]=(0,Q.useState)(new Set),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)([]),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(new Map),M=wi(u),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(``),L=(0,Q.useRef)(!1),ee=(0,Q.useRef)(!1),te=(0,Q.useRef)(null),re=(0,Q.useRef)([]),ie=`${o||s||``}::${g}`,R=(0,Q.useCallback)(async(e=0,n=!1)=>{if(!l||L.current)return null;L.current=!0,p(!0);let r=performance.now(),i=te.current?.signal,a=o?await G.getGitGraphLog(o,pi,g,e,i):await G.projectGitGraphLog(s,pi,g,e,i);if(i?.aborted)return L.current=!1,null;let c=null;if(a.isOk()){let{entries:e,hasMore:t,unpushedHashes:i,unpulledHashes:o=[]}=a.value,s=n?[...re.current,...e]:e;re.current=s,d(s),h(t),x(e=>{if(!n)return new Set(i);let t=new Set(e);for(let e of i)t.add(e);return t}),C(e=>{if(!n)return new Set(o);let t=new Set(e);for(let e of o)t.add(e);return t}),Ne(`git.graph_log.loaded`,performance.now()-r,{attributes:{count:String(e.length),append:String(n)}}),c={entries:s,hasMore:t}}else a.error.message!==`Request aborted`&&(ui.warn(`graph-log load failed`,{error:a.error.message}),Z.error(t(`review.logFailed`,{message:a.error.message,defaultValue:`Failed to load log: ${a.error.message}`})));return p(!1),L.current=!1,c},[l,o,s,g,t]),ae=(0,Q.useCallback)(()=>{!m||L.current||R(u.length,!0)},[m,u.length,R]),oe=(0,Q.useCallback)(()=>{ee.current=!0,R(0,!1)},[R]);(0,Q.useEffect)(()=>{te.current?.abort(),te.current=new AbortController,L.current=!1,ee.current=!1,re.current=[],d([]),h(!1),x(new Set),C(new Set),D([]),k(null),I(``),e&&l&&(ee.current=!0,R(0,!1))},[ie]),(0,Q.useEffect)(()=>{e&&l&&!ee.current&&(ee.current=!0,R(0,!1))},[e,l,R]),(0,Q.useEffect)(()=>{if(!e||!l)return;let t=new AbortController;return(o?G.getReflogEvents(o,t.signal):G.projectReflogEvents(s,t.signal)).then(e=>{t.signal.aborted||(e.isOk()?D(e.value.events):e.error.message!==`Request aborted`&&(ui.warn(`reflog-events load failed`,{error:e.error.message}),D([])))}),()=>t.abort()},[e,l,o,s]);let se=s??a??c??null;(0,Q.useEffect)(()=>{if(!se){P(null);return}let e=new AbortController;return G.projectGetRemoteUrl(se,e.signal).then(t=>{e.signal.aborted||!t.isOk()||P(Br(t.value.remoteUrl))}),()=>e.abort()},[se]);let ce=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{j(new Map),ce.current=new Set},[ie]);let le=s??a??c??null;(0,Q.useEffect)(()=>{if(!le||u.length===0)return;let e=u.find(e=>!A.has(e.hash)&&!ce.current.has(e.hash));if(!e)return;ce.current.add(e.hash);let t=!1;return G.githubCommitAuthors(le,{sha:e.hash,per_page:100}).then(e=>{if(t||e.isErr())return;let n=e.value.authors;n.length!==0&&j(e=>{let t=new Map(e);for(let e of n)e.avatar_url&&t.set(e.sha,e.avatar_url);return t})}),()=>{t=!0}},[le,u,A]);let z=F.trim().length>0,B=(0,Q.useMemo)(()=>z?u.filter(e=>zr(e,F)):u,[u,F,z]),V=(0,Q.useMemo)(()=>ti(u),[u]),ue=(0,Q.useMemo)(()=>An(E),[E]),de=(0,Q.useMemo)(()=>z?[]:jn(E,B),[B,z,E]),fe=(0,Q.useMemo)(()=>ei(de,B),[B,de]),pe=(0,Q.useMemo)(()=>z?new Map:Qr(B),[B,z]),me=(0,Q.useMemo)(()=>$r(B),[B]),he=(0,Q.useMemo)(()=>z?{rows:B.map(()=>({commitLane:0,nodeColor:0,segments:[]})),laneCount:1}:Rr(B.map(e=>({hash:e.hash,parentHashes:e.parentHashes}))),[B,z]),ge=bi(he.laneCount),_e=ge*16+(0,Q.useMemo)(()=>{if(de.length===0)return 0;let e=new Map;for(let t=0;t<B.length;t+=1){let n=he.rows[t];n&&e.set(B[t].hash,n.commitLane)}for(let t of de){let n=e.get(t.targetHash);if(n!==void 0&&ci({sourceLane:e.get(t.sourceHash)??null,targetLane:n,laneCount:ge}))return hi}return 0},[B,ge,he.rows,de]),{status:ve,dirty:ye}=Pr(o,s,!!e&&l&&u.length>0),be=!z&&ye?ve:void 0,xe=(0,Q.useRef)(null),Se=!z&&m,Ce=Yt({count:B.length+ +!!Se,getScrollElement:()=>xe.current,estimateSize:e=>e>=B.length?n:r(B[e]),getItemKey:e=>e>=B.length?`__sentinel__`:B[e].hash,overscan:12});(0,Q.useEffect)(()=>{Ce.measure()},[n,43,Ce]);let we=Ce.getVirtualItems(),Te=we[we.length-1]?.index;(0,Q.useEffect)(()=>{!Se||Te===void 0||Te>=u.length-5&&ae()},[Te,u.length,Se,ae]),(0,Q.useEffect)(()=>{!z||!m||L.current||u.length>=_i||R(u.length,!0)},[z,m,u.length,R]);let Ee=(0,Q.useCallback)(()=>{I(``)},[]),De=u.find(e=>e.hash===v),Oe=(0,Q.useMemo)(()=>ii(u),[u]),ke=(0,Q.useMemo)(()=>new Map(Oe.map(e=>[e.branch,e])),[Oe]),Ae=(0,Q.useCallback)(()=>{o?pt.getState().fetchForThread(o,!0):s&&pt.getState().fetchProjectStatus(s,!0)},[o,s]),je=(0,Q.useCallback)(async e=>{if(!l||w)return;T(`push:${e}`);let n=o?await G.pushBranch(o,e):await G.projectPushBranch(s,e);n.isOk()?Z.success(t(`history.pushBranchSuccess`,{branch:e,defaultValue:`Pushed ${e} to origin`})):Z.error(t(`review.pushFailed`,{message:n.error.message,defaultValue:`Push failed: ${n.error.message}`})),T(null),Ae(),oe()},[l,w,o,s,Ae,oe,t]),Me=(0,Q.useCallback)(async e=>{if(!l||w)return;T(`pull:${e}`);let n=o?await G.pull(o,`ff-only`):await G.projectPull(s,`ff-only`);n.isOk()?Z.success(t(`review.pullSuccess`,`Pulled successfully`)):Z.error(t(`review.pullFailed`,{message:n.error.message,defaultValue:`Pull failed: ${n.error.message}`})),T(null),Ae(),oe()},[l,w,o,s,Ae,oe,t]);return l?(0,$.jsxs)(`div`,{className:`flex h-full w-full min-w-0 flex-col overflow-hidden`,"data-testid":`commit-graph-tab`,children:[(0,$.jsx)(Ti,{logLoading:f,allBranches:g,commitCount:u.length,onRefresh:oe,onToggleAllBranches:()=>_(e=>!e)}),(0,$.jsx)(`div`,{className:`border-sidebar-border bg-background border-b px-2 py-1`,children:(0,$.jsx)(It,{query:F,onQueryChange:I,totalMatches:B.length,loading:z&&f,onClose:z?Ee:void 0,autoFocus:!1,placeholder:t(`graph.searchPlaceholder`,`Search branches & commits`),testIdPrefix:`graph-search`,resultLabel:z?t(`graph.matchCount`,{count:B.length,defaultValue:`${B.length} matches`}):``})}),!z&&be&&(0,$.jsx)(Ei,{status:be,firstRow:he.rows[0],laneCount:ge,gutterWidth:_e,rowHeight:n}),(0,$.jsx)(`div`,{className:`flex flex-1 flex-col overflow-y-auto`,ref:xe,children:f&&u.length===0?(0,$.jsx)(dn,{testId:`graph-loading`,label:t(`review.loadingLog`,`Loading commits…`)}):B.length===0?z?(0,$.jsx)(Er,{icon:i,title:t(`graph.noMatches`,`No commits match your search`)}):(0,$.jsx)(Er,{icon:ne,title:t(`review.noCommits`,`No commits yet`)}):(0,$.jsxs)(`div`,{style:{height:Ce.getTotalSize(),width:`100%`,position:`relative`},children:[(0,$.jsx)(Ci,{links:de,entries:B,layoutRows:he.rows,gutterWidth:_e,rowHeightFor:r}),we.map(e=>{if(e.index>=B.length)return(0,$.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:n,transform:`translateY(${e.start}px)`},className:`flex items-center justify-center`,children:(0,$.jsx)(dn,{fill:!1,layout:`inline`,size:`compact`,testId:`graph-loading-more`,label:t(`history.loadingMore`,`Loading more…`)})},`__sentinel__`);let i=B[e.index];return(0,$.jsx)(Di,{entry:i,graphRow:he.rows[e.index],laneCount:ge,gutterWidth:_e,selected:v===i.hash,avatarUrl:A.get(i.hash)??M.get(i.authorEmail),committerAvatarUrl:M.get(i.committerEmail),githubBrowseBaseUrl:N,effectiveThreadId:o,projectModeId:s,onAfterAction:oe,branchSummaryByName:ke,branchActionInProgress:w,onPushBranch:je,onPullCurrentBranch:Me,rebaseEvents:ue.get(i.hash)??[],onSelectRebaseEvent:k,forkedFromRefLabel:pe.get(i.hash)??fe.get(i.hash)??null,parentLabel:me.get(i.hash)??null,unpushed:b.has(i.hash),unpulled:S.has(i.hash)||V.has(i.hash),connectToWip:!!be&&e.index===0,searchQuery:F,transform:e.start,rowHeight:r(i),onSelect:()=>y(v===i.hash?null:i.hash)},i.hash)})]})}),(0,$.jsx)(Sr,{selectedCommit:De,selectedHash:v,effectiveThreadId:o,projectModeId:s,githubAvatarBySha:A,onClose:()=>y(null),onAfterAction:oe}),(0,$.jsx)(Oi,{event:O,onClose:()=>k(null)})]}):(0,$.jsx)(Er,{title:t(`review.noProject`,`Select a project to view history`)})}function Si(e,t){return e.refs.length===0?t/2:(t-37)/2+15/2}function Ci({links:e,entries:t,layoutRows:n,gutterWidth:r,rowHeightFor:i}){let a=(0,Q.useId)();if(e.length===0)return null;let o=0,s=new Map;for(let e=0;e<t.length;e+=1){let r=t[e],a=n[e],c=i(r);a&&s.set(r.hash,{top:o,nodeY:Si(r,c),lane:a.commitLane}),o+=c}let c=[];for(let t of e){let e=s.get(t.sourceHash),n=s.get(t.targetHash);e&&n&&c.push({link:t,source:e,target:n})}if(c.length===0)return null;let l=oi({laneGutterWidth:c.reduce((e,{source:t,target:n})=>{let r=si({sourceLane:t.lane,targetLane:n.lane});return Math.max(e,r)},0)*16,railWidth:hi}),u=Math.max(r+12,l+12,64);return(0,$.jsxs)(`svg`,{className:`pointer-events-none absolute top-0 left-0 z-20`,style:{width:u,height:o,overflow:`visible`},width:u,height:o,"aria-hidden":`true`,"data-testid":`graph-rebase-copy-links`,children:[(0,$.jsx)(`defs`,{children:(0,$.jsx)(`marker`,{id:a,markerWidth:`6`,markerHeight:`6`,refX:`5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,$.jsx)(`path`,{d:`M 0 0 L 6 3 L 0 6 z`,fill:`var(--terminal-yellow)`})})}),c.map(({link:e,source:t,target:n})=>{let r=oi({laneGutterWidth:si({sourceLane:t.lane,targetLane:n.lane})*16,railWidth:hi}),i=n.top+n.nodeY;return(0,$.jsx)(`g`,{children:(0,$.jsx)(`path`,{d:li({sourceX:yi(t.lane),sourceY:t.top+t.nodeY,targetX:yi(n.lane),targetY:i,railX:r}),fill:`none`,stroke:`var(--terminal-yellow)`,strokeWidth:1.4,strokeDasharray:`3 3`,strokeLinecap:`round`,strokeLinejoin:`round`,markerEnd:`url(#${a})`,opacity:.9})},`${e.event.id}:${e.sourceHash}:${e.targetHash}`)})]})}function wi(e){let[t,n]=(0,Q.useState)(()=>new Map(di));return(0,Q.useEffect)(()=>{let r=[...new Set(e.flatMap(e=>[e.authorEmail,e.committerEmail]).filter(e=>!!e))].filter(e=>!t.has(e));if(r.length===0)return;let i=!1;return Promise.all(r.map(async e=>[e,await nr(e)])).then(e=>{if(i)return;let t=e.filter(e=>!!e[1]);t.length!==0&&n(e=>{let n=new Map(e);for(let[e,r]of t)n.set(e,r),di.set(e,r);return n})}),()=>{i=!0}},[e,t]),t}function Ti({logLoading:e,allBranches:t,commitCount:n,onRefresh:r,onToggleAllBranches:i}){let{t:a}=H();return(0,$.jsxs)(`div`,{className:`border-sidebar-border bg-background flex items-center gap-1 border-b px-2 py-1`,children:[(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,onClick:r,disabled:e,"data-testid":`graph-refresh`,children:(0,$.jsx)(k,{className:q(`icon-base`,e&&`animate-spin`)})}),(0,$.jsxs)(Y,{variant:t?`secondary`:`ghost`,size:`sm`,className:`h-8 gap-1 px-2 text-xs`,onClick:i,"data-testid":`graph-toggle-all-branches`,children:[(0,$.jsx)(me,{className:`icon-base`}),a(`graph.allBranches`,`All branches`)]}),(0,$.jsx)(`span`,{className:`text-muted-foreground ml-auto text-[10px]`,children:a(`graph.commitCount`,{count:n,defaultValue:`${n} commits`})})]})}function Ei({status:e,firstRow:t,laneCount:n,gutterWidth:r,rowHeight:i}){let{t:a}=H(),o=$t(e=>e.setReviewSubTab),s=Math.min(t?.commitLane??0,Math.max(0,n-1))*16+16/2,c=i/2,l=Rn(t?.nodeColor??0),u=Math.min(16/2,Math.max(5,Math.round(i*.15)));return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(`changes`),style:{height:i},className:`hover:bg-accent/50 flex w-full shrink-0 cursor-pointer items-center gap-2 overflow-hidden pr-2 pl-3 text-left transition-colors`,"data-testid":`graph-wip-row`,children:[(0,$.jsx)(`div`,{style:{width:r},className:`shrink-0 self-stretch`,children:(0,$.jsxs)(`svg`,{width:r,height:i,style:{width:r,height:i,overflow:`visible`},"aria-hidden":`true`,children:[(0,$.jsx)(`line`,{x1:s,y1:c,x2:s,y2:i,stroke:l,strokeWidth:1.6,strokeDasharray:`2 2`}),(0,$.jsx)(`circle`,{cx:s,cy:c,r:u,fill:`hsl(var(--background))`,stroke:l,strokeWidth:1.6,strokeDasharray:`2 2`})]})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 pl-1`,children:[(0,$.jsx)(`span`,{className:`text-foreground truncate text-xs leading-tight font-medium`,children:a(`graph.uncommittedChanges`,`Uncommitted changes`)}),(0,$.jsx)(At,{linesAdded:e.linesAdded,linesDeleted:e.linesDeleted,dirtyFileCount:e.dirtyFileCount,size:`xs`})]})]})}function Di({entry:e,graphRow:t,laneCount:n,gutterWidth:r,selected:i,avatarUrl:a,committerAvatarUrl:o,githubBrowseBaseUrl:s,effectiveThreadId:c,projectModeId:l,onAfterAction:u,branchSummaryByName:d,branchActionInProgress:f,onPushBranch:p,onPullCurrentBranch:m,rebaseEvents:h,onSelectRebaseEvent:g,forkedFromRefLabel:_,parentLabel:v,unpushed:y,unpulled:b,connectToWip:x,searchQuery:S,transform:C,rowHeight:w,onSelect:T}){let{t:E}=H(),[D,O]=(0,Q.useState)(!1),k=dr(a),A=fi(e),j=dr(A?o:void 0),M=Rn(t?.nodeColor??0),N=(0,Q.useMemo)(()=>Gr(e.refs,e.headBranch),[e.refs,e.headBranch]),P=(0,Q.useMemo)(()=>{let e=new Set;return N.flatMap(t=>{if(!t.pullRequest)return[];let n=t.pullRequest.url||String(t.pullRequest.number);return e.has(n)?[]:(e.add(n),[t.pullRequest])})},[N]),F=(0,Q.useMemo)(()=>N.filter(e=>e.kind===`local`&&!e.syncedRemote&&e.name!==`HEAD`).map(e=>e.name),[N]),I=(0,Q.useMemo)(()=>N.filter(e=>e.kind===`local`&&e.name!==`HEAD`).map(e=>e.name).filter(e=>!d.get(e)?.isCurrent),[d,N]),L=Hr(s,e.hash,y),ee=(0,Q.useMemo)(()=>(0,$.jsx)(ki,{relativeDate:e.relativeDate}),[e.relativeDate]),te=N.length>0,ne=Math.round(mi*1.5),re=Si(e,w),ie=te?re/w:.5;return(0,$.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:w,transform:`translateY(${C}px)`},children:(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:T,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),T())},className:q(`group relative flex h-full w-full cursor-pointer items-center gap-2 overflow-hidden pl-3 pr-2 text-left transition-colors`,i?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-accent/50`),"data-testid":`graph-commit-${e.shortHash}`,children:[te&&t&&(()=>{let e=Math.min(16/2,Math.max(6,Math.round(w*.15))),n=12+t.commitLane*16+16/2,i=12+r+8+4;return(0,$.jsx)(`svg`,{className:`pointer-events-none absolute inset-0`,style:{overflow:`visible`},"aria-hidden":`true`,children:(0,$.jsx)(`line`,{x1:n+e,y1:re,x2:i,y2:re,stroke:M,strokeWidth:1.6,strokeLinecap:`round`})})})(),t&&(()=>{let i=t.commitLane*16+16/2,a=2*Math.min(16/2,Math.max(6,Math.round(w*.15))),o=A?a+8:a;return(0,$.jsxs)(`div`,{style:{width:r},className:`relative shrink-0 self-stretch`,children:[(0,$.jsx)(Hn,{row:t,laneCount:n,height:w,avatarUrl:k,authorName:e.author,committerAvatarUrl:j,committerName:A?e.committer:void 0,connectUp:x,nodeYFrac:ie}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`div`,{"aria-hidden":!0,className:`absolute -translate-x-1/2 -translate-y-1/2`,style:{left:i,top:ie*w,width:o,height:o}})}),(0,$.jsx)(W,{side:`top`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{children:E(`graph.nodeAuthor`,{author:e.author,defaultValue:`Author: ${e.author}`})}),A?(0,$.jsx)(`span`,{children:E(`graph.nodeCommitter`,{committer:e.committer,defaultValue:`Committed by: ${e.committer}`})}):null,_?(0,$.jsx)(`span`,{children:E(`graph.nodeBranchedFrom`,{branch:_,defaultValue:`Branched from: ${_}`})}):null,v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:E(`graph.nodeParent`,{parent:v.commit,defaultValue:`Parent: ${v.commit}`})}),v.branchLabels.length>0?(0,$.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4`,children:v.branchLabels.map(e=>(0,$.jsx)(`li`,{title:e,children:Ft(e,gi)},e))}):null]}):null,y&&(0,$.jsx)(`span`,{children:E(`history.unpushed`,`Not pushed`)})]})})]})]})})(),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center pl-1`,children:[N.length>0&&(0,$.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 shrink-0 items-center overflow-hidden`,style:{height:15},children:[(0,$.jsx)($n,{refs:N,branchSummaryByName:d,actionInProgress:f,color:M,searchQuery:S,onPushBranch:p,onPullCurrentBranch:m}),P.map(e=>(0,$.jsx)(Tr,{prNumber:e.number,prState:e.state,prUrl:e.url,size:`compact`,className:`ml-1`,"data-testid":`graph-pr-badge-${e.number}`},e.url))]}),(0,$.jsxs)(`div`,{className:`flex w-full min-w-0 shrink-0 items-center gap-1.5`,style:{height:ne},children:[(0,$.jsx)(at,{text:e.message,query:S,className:`text-foreground min-w-0 flex-1 truncate text-xs leading-tight font-medium`}),(0,$.jsx)(Ai,{unpushed:y,unpulled:b,shortHash:e.shortHash,className:`ml-auto`})]})]}),(0,$.jsx)(Or,{time:ee,timeClassName:`text-muted-foreground text-[10px]`,open:D,className:`min-w-12 self-center`,children:(0,$.jsx)(Fn,{hash:e.hash,shortHash:e.shortHash,githubUrl:L,effectiveThreadId:c,projectModeId:l,localBranches:F,targetBranches:I,rebaseEvents:h,onSelectRebaseEvent:g,onAfterAction:u,onOpenChange:O,triggerClassName:`text-muted-foreground hover:text-foreground`})})]})})}function Oi({event:e,onClose:t}){let{t:n}=H();return(0,$.jsx)(Ze,{open:!!e,onOpenChange:e=>!e&&t(),children:(0,$.jsx)(Vt,{className:`max-h-[80vh] max-w-2xl overflow-hidden p-0`,"data-testid":`rebase-event-dialog`,children:e&&(()=>{let t=e.commitPairs??[],r=t.length||e.commitHashes.length;return(0,$.jsxs)(`div`,{className:`flex max-h-[80vh] min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`border-sidebar-border border-b px-4 py-3`,children:[(0,$.jsx)(We,{className:`text-sm leading-tight font-semibold`,children:n(`graph.rebaseDetailsTitle`,`Rebase details`)}),(0,$.jsx)(tt,{className:`text-muted-foreground mt-1 text-xs`,children:e.completed?n(`graph.rebaseDetailsDescription`,{count:r,defaultValue:`${r} commits replayed from local reflog`}):n(`graph.rebaseDetailsIncomplete`,`Partial rebase details from local reflog`)})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto px-4 py-3 text-xs`,children:[(0,$.jsxs)(`dl`,{className:`grid grid-cols-[96px_minmax(0,1fr)] gap-x-3 gap-y-2`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseBranch`,`Branch`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.branch??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseOnto`,`Onto`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.onto??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseStarted`,`Started`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.startedAt??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseFinished`,`Finished`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.finishedAt??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseBefore`,`Before`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.startShortHash??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseAfter`,`After`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.finishShortHash??`-`})]}),t.length>0&&(0,$.jsxs)(`div`,{className:`border-sidebar-border mt-4 border-t pt-3`,children:[(0,$.jsx)(`div`,{className:`text-muted-foreground mb-2 text-[10px] font-medium uppercase`,children:n(`graph.rebaseCommitPairs`,`Rewritten commits`)}),(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,$.jsxs)(`div`,{className:`bg-muted/40 grid grid-cols-[80px_16px_80px_minmax(0,1fr)] items-center gap-2 rounded px-2 py-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.originalShortHash}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,$.jsx)(`span`,{className:`font-mono`,children:e.rebasedShortHash}),(0,$.jsx)(`span`,{className:`truncate`,children:e.subject})]},`${e.originalHash}:${e.rebasedHash}`))})]}),(0,$.jsxs)(`div`,{className:`border-sidebar-border mt-4 border-t pt-3`,children:[(0,$.jsx)(`div`,{className:`text-muted-foreground mb-2 text-[10px] font-medium uppercase`,children:n(`graph.rebaseSteps`,`Reflog steps`)}),(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.steps.map(e=>(0,$.jsxs)(`div`,{className:`bg-muted/40 grid grid-cols-[72px_88px_minmax(0,1fr)] gap-2 rounded px-2 py-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.shortHash}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.action}),(0,$.jsx)(`span`,{className:`truncate`,children:e.message})]},`${e.selector}:${e.action}:${e.hash}`))})]})]})]})})()})})}function ki({relativeDate:e}){return(0,$.jsx)(`span`,{children:Et(e)})}function Ai({unpushed:e,unpulled:t=!1,shortHash:n,className:r}){let{t:i}=H();return!e&&!t?null:(0,$.jsxs)(`span`,{className:q(`inline-flex shrink-0 items-center gap-1`,r),children:[e&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`span`,{"aria-label":i(`history.unpushed`,`Not pushed`),className:`inline-flex shrink-0`,"data-testid":`graph-unpushed-${n}`,children:(0,$.jsx)(xe,{className:`icon-sm text-primary [&_path]:stroke-primary-foreground [&_circle]:fill-current`,"data-testid":`graph-unpushed-icon-${n}`,strokeWidth:3})})}),(0,$.jsx)(W,{side:`top`,children:i(`history.unpushed`,`Not pushed`)})]}),t&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`span`,{"aria-label":i(`history.unpulled`,`Not pulled`),className:`inline-flex shrink-0`,"data-testid":`graph-unpulled-${n}`,children:(0,$.jsx)(L,{className:`icon-sm text-primary [&_path]:stroke-primary-foreground [&_circle]:fill-current`,"data-testid":`graph-unpulled-icon-${n}`,strokeWidth:3})})}),(0,$.jsx)(W,{side:`top`,children:i(`history.unpulled`,`Not pulled`)})]})]})}function ji({count:e,className:t,...n}){return(0,$.jsx)(`span`,{className:q(`absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-blue-500 px-1 text-[10px] leading-none font-bold tabular-nums text-white`,t),"data-testid":n[`data-testid`],children:e})}function Mi({onPull:e,onFetch:n,pullInProgress:r,fetchInProgress:i,unpulledCommitCount:a,testIdPrefix:o}){let{t:s}=H();return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`icon-sm`,onClick:e,disabled:r,className:`text-muted-foreground relative`,"data-testid":`${o}-pull`,children:[(0,$.jsx)(l,{className:q(`icon-base`,r&&`animate-pulse`)}),a>0&&(0,$.jsx)(ji,{count:a})]})}),(0,$.jsx)(W,{side:`top`,children:a>0?s(`review.readyToPull`,{count:a,defaultValue:`${a} commit(s) to pull`}):s(`review.pull`,`Pull`)})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:n,disabled:i,className:`text-muted-foreground`,"data-testid":`${o}-fetch-origin`,children:(0,$.jsx)(t,{className:q(`icon-base`,i&&`animate-pulse`)})})}),(0,$.jsx)(W,{side:`top`,children:s(`review.fetchOrigin`,`Fetch from origin`)})]})]})}function Ni({onPush:e,pushInProgress:t,unpushedCommitCount:n,disabled:r,testIdPrefix:i}){let{t:a}=H();return(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`icon-sm`,onClick:e,disabled:r??(t||n===0),className:`text-muted-foreground relative`,"data-testid":`${i}-push`,children:[(0,$.jsx)(j,{className:q(`icon-base`,t&&`animate-pulse`)}),n>0&&(0,$.jsx)(ji,{count:n})]})}),(0,$.jsx)(W,{side:`top`,children:n>0?a(`review.readyToPush`,{count:n,defaultValue:`${n} commit(s) ready to push`}):a(`review.pushToOrigin`,`Push to origin`)})]})}var Pi=Be(`publish-repo-dialog`),Fi=/^(https?:\/\/|git:\/\/|ssh:\/\/|git@[^\s:]+:)/;function Ii({projectId:e,projectPath:t,open:n,onOpenChange:r,onSuccess:i}){let a=t.split(`/`).filter(Boolean).pop()??``,[o,s]=(0,Q.useState)(`github`),[c,l]=(0,Q.useState)(a),[d,f]=(0,Q.useState)(``),[p,h]=(0,Q.useState)(!0),[g,_]=(0,Q.useState)(`__personal__`),[v,y]=(0,Q.useState)([]),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(!n)return;s(`github`),l(a),f(``),h(!0),_(`__personal__`),T(null),O(``),M(null);let t=new AbortController;return x(!0),G.projectGetGhOrgs(e,t.signal).then(e=>{e.isOk()&&y(e.value.orgs)}).then(()=>x(!1),()=>x(!1)),()=>t.abort()},[n,e,a]);let N=(0,Q.useCallback)(async()=>{if(!c.trim())return;C(!0),T(null);let t=await G.projectPublish(e,{name:c.trim(),description:d.trim()||void 0,org:g===`__personal__`?void 0:g,private:p});if(C(!1),t.isErr()){let n=String(t.error?.message??t.error);Pi.warn(`publish.github.failed`,{projectId:e,error:n}),n.includes(`already exists`)?T(`Repository "${c}" already exists. Choose a different name.`):n.includes(`GitHub token`)?T(`GitHub token required. Set one in Settings > Profile.`):T(n);return}Pi.info(`publish.github.success`,{projectId:e}),i(t.value.repoUrl)},[e,c,d,g,p,i]),P=(0,Q.useCallback)(async()=>{let t=D.trim();if(!t)return;if(!Fi.test(t)){M(`URL must start with https://, ssh://, git:// or use the git@host:path form.`);return}A(!0),M(null);let n=await G.projectSetRemoteUrl(e,t);if(A(!1),n.isErr()){let t=String(n.error?.message??n.error);Pi.warn(`publish.remote.failed`,{projectId:e,error:t}),M(t);return}Pi.info(`publish.remote.success`,{projectId:e}),i(t)},[e,D,i]),F=Fi.test(D.trim());return(0,$.jsx)(Ze,{open:n,onOpenChange:r,children:(0,$.jsxs)(Vt,{className:`sm:max-w-[460px]`,"data-testid":`publish-repo-dialog`,children:[(0,$.jsxs)(_t,{children:[(0,$.jsx)(We,{children:`Publish Repository`}),(0,$.jsx)(tt,{children:`Create a new GitHub repository or attach this project to an existing remote.`})]}),(0,$.jsxs)(yn,{value:o,onValueChange:e=>s(e),children:[(0,$.jsxs)(vn,{className:`grid w-full grid-cols-2`,children:[(0,$.jsxs)(gn,{value:`github`,"data-testid":`publish-tab-github`,children:[(0,$.jsx)(kt,{className:`mr-1.5 size-3.5`}),`GitHub`]}),(0,$.jsxs)(gn,{value:`remote`,"data-testid":`publish-tab-remote`,children:[(0,$.jsx)(E,{className:`mr-1.5 size-3.5`}),`Remote URL`]})]}),(0,$.jsx)(_n,{value:`github`,className:`mt-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium`,children:`Owner`}),(0,$.jsxs)(Wt,{value:g,onValueChange:_,disabled:b||S,children:[(0,$.jsx)(Bt,{"data-testid":`publish-repo-owner`,children:(0,$.jsx)(Lt,{})}),(0,$.jsxs)(Tt,{children:[(0,$.jsx)(qt,{value:`__personal__`,children:`Personal account`}),v.map(e=>(0,$.jsx)(qt,{value:e,children:e},e))]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium`,children:`Repository name`}),(0,$.jsx)(sn,{"data-testid":`publish-repo-name`,value:c,onChange:e=>l(e.target.value),placeholder:`my-repo`,disabled:S,autoFocus:!0})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsxs)(`label`,{className:`text-sm font-medium`,children:[`Description `,(0,$.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,$.jsx)(sn,{"data-testid":`publish-repo-description`,value:d,onChange:e=>f(e.target.value),placeholder:`Short description`,disabled:S})]}),(0,$.jsxs)(`div`,{className:q(`flex items-center justify-between rounded-md border px-3 py-2.5`,`bg-muted/30`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p?(0,$.jsx)(u,{className:`text-muted-foreground size-4`}):(0,$.jsx)(de,{className:`text-muted-foreground size-4`}),(0,$.jsx)(`span`,{className:`text-sm`,children:p?`Private`:`Public`})]}),(0,$.jsx)(zt,{"data-testid":`publish-repo-private`,checked:p,onCheckedChange:h,disabled:S})]}),w&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`publish-repo-error`,children:w})]})}),(0,$.jsx)(_n,{value:`remote`,className:`mt-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium`,children:`Remote URL`}),(0,$.jsx)(sn,{"data-testid":`publish-remote-url`,value:D,onChange:e=>O(e.target.value),placeholder:`https://github.com/user/repo.git`,disabled:k,autoFocus:!0}),(0,$.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Sets `,(0,$.jsx)(`code`,{className:`text-foreground`,children:`origin`}),` on this project. The remote must already exist; create the empty repository on your provider first, then push from the toolbar.`]})]}),j&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`publish-remote-error`,children:j})]})})]}),(0,$.jsxs)(yt,{children:[(0,$.jsx)(Y,{variant:`outline`,onClick:()=>r(!1),disabled:S||k,"data-testid":`publish-repo-cancel`,children:`Cancel`}),o===`github`?(0,$.jsxs)(Y,{onClick:N,disabled:S||!c.trim(),"data-testid":`publish-repo-submit`,children:[S&&(0,$.jsx)(m,{className:`icon-base mr-2 animate-spin`}),`Publish repository`]}):(0,$.jsxs)(Y,{onClick:P,disabled:k||!F,"data-testid":`publish-remote-submit`,children:[k&&(0,$.jsx)(m,{className:`icon-base mr-2 animate-spin`}),`Save remote`]})]})]})})}function Li({open:e,onOpenChange:t,errorMessage:n,onChoose:r}){let{t:i}=H(),[a,o]=(0,Q.useState)(`rebase`);return(0,Q.useEffect)(()=>{e&&o(`rebase`)},[e]),(0,$.jsx)(Ze,{open:e,onOpenChange:t,children:(0,$.jsxs)(Vt,{"data-testid":`pull-strategy-dialog`,children:[(0,$.jsxs)(_t,{children:[(0,$.jsx)(We,{children:i(`review.pullStrategy.title`,`Branches have diverged`)}),(0,$.jsx)(tt,{children:i(`review.pullStrategy.description`,`Your local branch and the remote both have commits the other doesn’t. Choose how to reconcile them.`)})]}),(0,$.jsx)(`div`,{className:`bg-muted/30 text-muted-foreground rounded-md border p-3 font-mono text-xs`,children:n}),(0,$.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,$.jsxs)(`button`,{type:`button`,"data-testid":`pull-strategy-rebase`,onClick:()=>o(`rebase`),className:q(`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors`,a===`rebase`?`border-primary bg-primary/10`:`border-border hover:bg-accent/50`),children:[(0,$.jsx)(O,{className:`icon-base mt-0.5 shrink-0`}),(0,$.jsxs)(`span`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`text-foreground text-sm font-medium`,children:i(`review.pullStrategy.rebase`,`Rebase`)}),(0,$.jsx)(`span`,{className:`text-muted-foreground mt-1.5 text-xs`,children:i(`review.pullStrategy.rebaseHint`,`Replay your local commits on top of the remote (linear history).`)})]})]}),(0,$.jsxs)(`button`,{type:`button`,"data-testid":`pull-strategy-merge`,onClick:()=>o(`merge`),className:q(`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors`,a===`merge`?`border-primary bg-primary/10`:`border-border hover:bg-accent/50`),children:[(0,$.jsx)(B,{className:`icon-base mt-0.5 shrink-0`}),(0,$.jsxs)(`span`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`text-foreground text-sm font-medium`,children:i(`review.pullStrategy.merge`,`Merge`)}),(0,$.jsx)(`span`,{className:`text-muted-foreground mt-1.5 text-xs`,children:i(`review.pullStrategy.mergeHint`,`Create a merge commit that joins both histories.`)})]})]})]}),(0,$.jsxs)(yt,{children:[(0,$.jsx)(Y,{type:`button`,variant:`outline`,onClick:()=>t(!1),"data-testid":`pull-strategy-cancel`,children:i(`common.cancel`,`Cancel`)}),(0,$.jsx)(Y,{type:`button`,onClick:()=>r(a),"data-testid":`pull-strategy-confirm`,children:i(`common.confirm`,`Confirm`)})]})]})})}function Ri(e){let t=e.toLowerCase();return t.includes(`not possible to fast-forward`)||t.includes(`can't be fast-forwarded`)||t.includes(`diverging branches`)||t.includes(`non-fast-forward`)}function zi(e,t){let n=[`Fix GitHub issue #${e.number}: ${e.title}`,`URL: https://github.com/${t.owner}/${t.repo}/issues/${e.number}`];return e.labels.length>0&&n.push(``,`Labels: ${e.labels.map(e=>e.name).join(`, `)}`),n.join(`
|
|
2
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{$n as t,A as n,Ar as r,B as i,Bn as a,Ct as o,E as s,Fr as c,Hn as l,It as u,K as d,Kn as f,Ln as p,Lt as m,Mn as h,Mr as g,Ot as _,Pn as v,Pr as y,Q as b,Qn as x,Rn as S,Rt as C,S as w,St as T,Ut as E,Vn as D,W as O,Y as k,Zn as A,_ as j,_r as M,ar as N,b as P,bn as F,cn as I,dr as L,en as ee,er as te,fn as ne,fr as re,g as ie,gn as R,gr as ae,hn as oe,hr as se,i as ce,ir as le,k as z,ln as B,lr as V,mn as ue,on as de,ot as fe,p as pe,pn as me,rr as he,sn as ge,sr as _e,st as ve,tn as ye,tr as be,ur as xe,v as Se,vr as Ce,xn as we,y as Te,yn as Ee,yr as De,z as Oe,zn as ke,zr as Ae}from"./icons-sqwAEN28.js";import{At as je}from"./mermaid-DOtnPRYX.js";import{o as Me}from"./markdown-DBtwZWLP.js";import{t as H}from"./useTranslation-DAPPK3Hy.js";import{t as Ne}from"./telemetry-BE4cJhqj.js";import{B as U,F as Pe,G as W,P as G,R as Fe,V as Ie,W as K,d as Le,dt as Re,f as ze,j as Be,lt as q,q as J,u as Ve}from"./index-DNxUSLe_.js";import{t as Y}from"./button-B9Ypx1uQ.js";import{$ as He,$n as Ue,$r as We,An as Ge,B as Ke,Cn as qe,Dn as Je,Dr as Ye,Gn as Xe,Gr as Ze,H as Qe,Hn as $e,In as et,Jn as X,Jr as tt,Kn as nt,Lt as rt,Mn as it,Nn as at,On as ot,Ot as st,Pt as ct,Qn as lt,R as ut,Rn as dt,Tt as ft,Un as pt,Ur as Z,V as mt,Vr as ht,Wn as gt,Xr as _t,Yn as vt,Yr as yt,Z as bt,Zn as xt,at as St,bn as Ct,bt as wt,ct as Tt,en as Et,er as Dt,et as Ot,gt as kt,hn as At,in as jt,jn as Mt,jt as Nt,kn as Pt,kt as Ft,mn as It,mt as Lt,nt as Rt,ot as zt,pt as Bt,qr as Vt,rt as Ht,sr as Ut,st as Wt,tr as Gt,tt as Kt,ut as qt,vn as Jt,vr as Yt,vt as Xt,wn as Zt,yn as Qt,yr as $t,z as en,zn as tn}from"./items-7qqySF-X.js";import{a as nn,i as rn,n as an,r as on}from"./GitProgressModal-CJG5MsSI.js";import{t as sn}from"./input-CJ3TsT2L.js";import{n as cn,r as ln,t as un}from"./FileTree-Bl25zGAE.js";import{t as dn}from"./loading-state-yLj5fYb6.js";import{i as fn,n as pn,t as mn,x as hn}from"./diff-parse-DgLol0S6.js";import{i as gn,n as _n,r as vn,t as yn}from"./tabs-Cu3cWMHb.js";import{n as bn,r as xn,t as Sn}from"./markdown-components-DxMKBjnh.js";import{n as Cn,r as wn}from"./pr-detail-store-DHF0exs_.js";import{n as Tn}from"./review-pane-store-B31R8Yhv.js";var Q=e(Ae(),1),$=e(Me(),1);function En({open:e,onOpenChange:t,shortHash:n,onCreate:r}){let{t:i}=H(),[a,o]=(0,Q.useState)(``);(0,Q.useEffect)(()=>{e&&o(``)},[e]);let s=a.trim(),c=s.length>0&&!s.startsWith(`-`)&&/^[A-Za-z0-9._/@^~:{}=-]+$/.test(s),l=()=>{c&&(r(s),t(!1))};return(0,$.jsx)(Ze,{open:e,onOpenChange:t,children:(0,$.jsxs)(Vt,{className:`max-w-sm`,children:[(0,$.jsxs)(_t,{children:[(0,$.jsx)(We,{children:i(`graph.createBranchTitle`,`Create branch`)}),(0,$.jsx)(tt,{children:i(`graph.createBranchDesc`,{hash:n,defaultValue:`Create a new branch starting at ${n} and switch to it.`})})]}),(0,$.jsx)(sn,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),l())},placeholder:i(`graph.createBranchPlaceholder`,`branch name`),"data-testid":`create-branch-name`}),(0,$.jsxs)(yt,{children:[(0,$.jsx)(Y,{variant:`outline`,onClick:()=>t(!1),"data-testid":`create-branch-cancel`,children:i(`common.cancel`,`Cancel`)}),(0,$.jsx)(Y,{onClick:l,disabled:!c,"data-testid":`create-branch-confirm`,children:i(`graph.createBranchConfirm`,`Create branch`)})]})]})})}function Dn({pending:e,onConfirm:t,onCancel:n}){let{t:r}=H(),i=e?{checkout:{title:r(`history.confirmCheckoutTitle`,`Checkout Commit`),description:r(`history.confirmCheckoutDesc`,`This will switch to a detached HEAD at this commit. Any uncommitted changes may be lost. Continue?`),confirmLabel:r(`history.confirmCheckoutButton`,`Checkout`),variant:`default`},revert:{title:r(`history.confirmRevertTitle`,`Revert Commit`),description:r(`history.confirmRevertDesc`,`This will create a new commit that undoes the changes from this commit. Continue?`),confirmLabel:r(`history.confirmRevertButton`,`Revert`),variant:`default`},reset:{title:r(`history.confirmResetTitle`,`Hard Reset Branch`),description:r(`history.confirmResetDesc`,`Are you sure you want to hard reset the current branch to this commit? This will discard all changes and commits after this point. This action cannot be undone.`),confirmLabel:r(`history.confirmResetButton`,`Reset Branch`),variant:`destructive`},"cherry-pick":{title:r(`history.confirmCherryPickTitle`,`Cherry-pick Commit`),description:r(`history.confirmCherryPickDesc`,`This will apply this commit's changes onto the current branch as a new commit. If it conflicts, the working tree is left mid-cherry-pick for you to resolve. Continue?`),confirmLabel:r(`history.confirmCherryPickButton`,`Cherry-pick`),variant:`default`},"merge-current-into":{title:r(`history.confirmMergeCurrentIntoTitle`,{branch:e.hash,defaultValue:`Merge into ${e.hash}`}),description:r(`history.confirmMergeCurrentIntoDesc`,{branch:e.hash,defaultValue:`This will switch to ${e.hash} and merge the current branch into it. Continue?`}),confirmLabel:r(`history.confirmMergeCurrentIntoButton`,`Merge`),variant:`default`},"rebase-current-onto":{title:r(`history.confirmRebaseCurrentOntoTitle`,{branch:e.hash,defaultValue:`Rebase onto ${e.hash}`}),description:r(`history.confirmRebaseCurrentOntoDesc`,{branch:e.hash,defaultValue:`This will replay the current branch on top of ${e.hash}. If it conflicts, the working tree is left mid-rebase for you to resolve. Continue?`}),confirmLabel:r(`history.confirmRebaseCurrentOntoButton`,`Rebase`),variant:`default`}}[e.kind]:null;return(0,$.jsx)(Ut,{open:!!e,onOpenChange:e=>{e||n()},title:i?.title??``,description:i?.description??``,confirmLabel:i?.confirmLabel,variant:i?.variant??`destructive`,onConfirm:t,onCancel:n})}function On({effectiveThreadId:e,projectModeId:t,onAfterAction:n,onSuccess:r}){let{t:i}=H(),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=!!(e||t),u=(0,Q.useCallback)(()=>{e?pt.getState().fetchForThread(e,!0):t&&pt.getState().fetchProjectStatus(t,!0),n()},[e,t,n]);return{pending:a,inProgress:s,hasGitContext:l,request:(0,Q.useCallback)((e,t)=>{l&&o({kind:e,hash:t})},[l]),cancel:(0,Q.useCallback)(()=>o(null),[]),confirm:(0,Q.useCallback)(async()=>{if(!a||s||!l)return;let{kind:n,hash:d}=a;c(!0);let f=await(()=>{switch(n){case`checkout`:return e?G.checkoutCommit(e,d):G.projectCheckoutCommit(t,d);case`revert`:return e?G.revertCommit(e,d):G.projectRevertCommit(t,d);case`reset`:return e?G.resetHard(e,d):G.projectResetHard(t,d);case`cherry-pick`:return e?G.cherryPick(e,d):G.projectCherryPick(t,d);case`merge-current-into`:return e?G.mergeCurrentBranchInto(e,d):G.projectMergeCurrentBranchInto(t,d);case`rebase-current-onto`:return e?G.rebaseCurrentBranchOnto(e,d):G.projectRebaseCurrentBranchOnto(t,d)}})();if(f.isOk()){let e={checkout:i(`history.checkoutSuccess`,`Switched to commit (detached HEAD)`),revert:i(`history.revertSuccess`,`Commit reverted successfully`),reset:i(`history.resetSuccess`,`Branch reset to this commit`),"cherry-pick":i(`history.cherryPickSuccess`,`Commit cherry-picked onto current branch`),"merge-current-into":i(`history.mergeCurrentIntoSuccess`,{branch:d,defaultValue:`Merged current branch into ${d}`}),"rebase-current-onto":i(`history.rebaseCurrentOntoSuccess`,{branch:d,defaultValue:`Rebased current branch onto ${d}`})};Z.success(e[n]),r?.(n)}else gt(f.error);c(!1),o(null),u()},[a,s,l,e,t,r,u,i]),pushBranch:(0,Q.useCallback)(async n=>{if(!l||s)return;c(!0);let r=await(e?G.pushBranch(e,n):G.projectPushBranch(t,n));r.isOk()?Z.success(i(`history.pushBranchSuccess`,{branch:n,defaultValue:`Pushed ${n} to origin`})):gt(r.error),c(!1),u()},[l,s,e,t,u,i]),createBranch:(0,Q.useCallback)(async(n,r)=>{if(!l||s)return;c(!0);let a=await(e?G.createBranch(e,n,r):G.projectCreateBranch(t,n,r));a.isOk()?Z.success(i(`history.createBranchSuccess`,{branch:n,defaultValue:`Created and switched to ${n}`})):gt(a.error),c(!1),u()},[l,s,e,t,u,i])}}function kn(e){return e.branch&&e.onto?`${e.branch} -> ${e.onto}`:e.branch?e.branch:e.onto?`onto ${e.onto}`:null}function An(e){let t=new Map;for(let n of e){let e=new Set(n.commitHashes);n.startHash&&e.add(n.startHash),n.finishHash&&e.add(n.finishHash);for(let t of n.commitPairs??[])e.add(t.originalHash),e.add(t.rebasedHash);for(let r of e){let e=t.get(r);e?e.push(n):t.set(r,[n])}}return t}function jn(e,t){let n=new Set(t.map(e=>e.hash)),r=[],i=new Set;for(let t of e)for(let e of t.commitPairs??[]){if(!n.has(e.originalHash)||!n.has(e.rebasedHash))continue;let a=`${t.id}:${e.originalHash}->${e.rebasedHash}`;i.has(a)||(i.add(a),r.push({event:t,sourceHash:e.originalHash,sourceShortHash:e.originalShortHash,targetHash:e.rebasedHash,targetShortHash:e.rebasedShortHash,subject:e.subject}))}return r}var Mn=[],Nn=[],Pn=[];function Fn({hash:e,shortHash:t,githubUrl:n,effectiveThreadId:r,projectModeId:i,localBranches:o=Mn,targetBranches:s=Nn,rebaseEvents:c=Pn,onSelectRebaseEvent:l,onAfterAction:u,onOpenChange:d,triggerClassName:p}){let{t:m}=H(),[h,g]=(0,Q.useState)(!1),_=e=>{g(e),d?.(e)},[v,y]=(0,Q.useState)(!1),{pending:b,request:S,cancel:C,confirm:w,hasGitContext:T,pushBranch:E,createBranch:D}=On({effectiveThreadId:r,projectModeId:i,onAfterAction:u}),k=e=>void navigator.clipboard.writeText(e).then(()=>Z.success(m(`history.hashCopied`,{hash:t,defaultValue:`Copied ${t}`})),()=>Z.error(m(`history.hashCopyFailed`,`Failed to copy hash`))),A=c[0]??null,j=A?kn(A):null,M=A?c.length>1?m(`graph.viewRebaseDetailsCount`,{count:c.length,defaultValue:`View rebase details (${c.length})`}):m(`graph.viewRebaseDetails`,`View rebase details`):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(Xe,{open:h,onOpenChange:_,children:[(0,$.jsx)(Gt,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,tabIndex:-1,onClick:e=>e.stopPropagation(),className:q(`text-muted-foreground hover:text-foreground shrink-0`,p??q(`ml-auto opacity-0 transition-opacity focus-visible:opacity-100 group-hover:opacity-100`,h&&`opacity-100`)),"data-testid":`graph-commit-more-${t}`,children:(0,$.jsx)(a,{className:`icon-sm`})})}),(0,$.jsxs)(nt,{align:`end`,side:`bottom`,className:`w-64`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(X,{onClick:()=>k(e),"data-testid":`graph-commit-menu-copy-sha-${t}`,children:[(0,$.jsx)(ye,{className:`icon-sm`}),m(`graph.copySha`,`Copy commit SHA`)]}),(0,$.jsxs)(X,{onClick:()=>k(t),"data-testid":`graph-commit-menu-copy-short-${t}`,children:[(0,$.jsx)(f,{className:`icon-sm`}),m(`graph.copyShortSha`,`Copy short SHA`)]}),n&&(0,$.jsxs)(X,{onClick:()=>window.open(n,`_blank`,`noopener,noreferrer`),"data-testid":`graph-commit-menu-github-${t}`,children:[(0,$.jsx)(ke,{className:`icon-sm`}),m(`history.viewOnGithub`,`View on GitHub`)]}),A&&l&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xt,{}),(0,$.jsxs)(X,{onClick:()=>{l(A),_(!1)},"data-testid":`graph-commit-menu-rebase-details-${t}`,children:[(0,$.jsx)(me,{className:`icon-sm`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:j?`${M}: ${j}`:M})]})]}),T&&(0,$.jsxs)($.Fragment,{children:[o.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(xt,{}),o.map(e=>(0,$.jsxs)(X,{onClick:()=>void E(e),"data-testid":`graph-commit-menu-push-${e}`,children:[(0,$.jsx)(x,{className:`icon-sm`}),m(`graph.pushBranchToOrigin`,{branch:e,defaultValue:`Push ${e} to origin`})]},e))]}),(0,$.jsx)(xt,{}),(0,$.jsxs)(X,{onClick:()=>y(!0),"data-testid":`graph-commit-menu-create-branch-${t}`,children:[(0,$.jsx)(ue,{className:`icon-sm`}),m(`graph.createBranchHere`,`Create branch from here`)]}),s.map(e=>(0,$.jsxs)(X,{onClick:()=>S(`merge-current-into`,e),"data-testid":`graph-commit-menu-merge-current-into-${e}`,children:[(0,$.jsx)(B,{className:`icon-sm`}),m(`graph.mergeCurrentIntoBranch`,{branch:e,defaultValue:`Merge current branch into ${e}`})]},`merge-current-into:${e}`)),s.map(e=>(0,$.jsxs)(X,{onClick:()=>S(`rebase-current-onto`,e),"data-testid":`graph-commit-menu-rebase-current-onto-${e}`,children:[(0,$.jsx)(me,{className:`icon-sm`}),m(`graph.rebaseCurrentOntoBranch`,{branch:e,defaultValue:`Rebase current branch onto ${e}`})]},`rebase-current-onto:${e}`)),(0,$.jsxs)(X,{onClick:()=>S(`cherry-pick`,e),"data-testid":`graph-commit-menu-cherry-pick-${t}`,children:[(0,$.jsx)(Ce,{className:`icon-sm`}),m(`graph.cherryPick`,`Cherry-pick onto current branch`)]}),(0,$.jsx)(xt,{}),(0,$.jsxs)(X,{onClick:()=>S(`checkout`,e),"data-testid":`graph-commit-menu-checkout-${t}`,children:[(0,$.jsx)(me,{className:`icon-sm`}),m(`history.checkout`,`Checkout`)]}),(0,$.jsxs)(X,{onClick:()=>S(`revert`,e),"data-testid":`graph-commit-menu-revert-${t}`,children:[(0,$.jsx)(O,{className:`icon-sm`}),m(`history.revert`,`Revert`)]}),(0,$.jsxs)(X,{className:`text-destructive focus:text-destructive`,onClick:()=>S(`reset`,e),"data-testid":`graph-commit-menu-reset-${t}`,children:[(0,$.jsx)(ee,{className:`icon-sm`}),m(`graph.resetToHere`,`Reset branch to here`)]})]})]})]}),(0,$.jsx)(Dn,{pending:b,onConfirm:w,onCancel:C}),(0,$.jsx)(En,{open:v,onOpenChange:y,shortHash:t,onCreate:t=>void D(t,e)})]})}var In=[[217,.8,.58],[142,.62,.45],[263,.68,.6],[38,.9,.52],[0,.78,.6],[190,.8,.45],[330,.72,.58],[165,.64,.42]].map(([e,t,n])=>dt(e,t,n));function Ln(e){let t=In.length;return In[(e%t+t)%t]}function Rn(e){return tn(Ln(e),.74)}var zn=1.6,Bn=e=>e*16+16/2;function Vn(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?``:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var Hn=(0,Q.memo)(function({row:e,laneCount:t,height:n,avatarUrl:r,authorName:i,committerAvatarUrl:a,committerName:o,connectUp:s,nodeYFrac:c=.5}){let l=t*16,u=e=>e*n,d=e=>u(e===.5?c:e),f=(0,Q.useId)(),p=(0,Q.useId)(),m=Bn(e.commitLane),h=u(c),g=Rn(e.nodeColor),_=r?``:Vn(i??``),v=a?``:Vn(o??``),y=Math.min(16/2,Math.max(6,Math.round(n*.15))),b=Math.max(3,Math.round(y/2)),x=Math.max(4,Math.round(y*.56)),S=m+y*.62,C=h+y*.62;return(0,$.jsxs)(`svg`,{width:l,height:n,className:`shrink-0`,style:{width:l,height:n,overflow:`visible`},"aria-hidden":`true`,children:[e.segments.map((e,t)=>{let n=Bn(e.fromLane),r=d(e.fromY),i=Bn(e.toLane),a=d(e.toY),o=Rn(e.color);if(n===i)return(0,$.jsx)(`line`,{x1:n,y1:r,x2:i,y2:a,stroke:o,strokeWidth:zn},t);let s=e.fromY===.5,c=s?n:i,l=s?r:a,u=s?i:n,f=s?a:r,p=Math.min(16/2,Math.abs(l-f),Math.abs(c-u)),m=Math.sign(c-u);return(0,$.jsx)(`path`,{d:`M ${u} ${f} L ${u} ${l-Math.sign(l-f)*p} Q ${u} ${l} ${u+m*p} ${l} L ${c} ${l}`,fill:`none`,stroke:o,strokeWidth:zn,strokeLinecap:`round`,strokeLinejoin:`round`},t)}),s&&(0,$.jsx)(`line`,{x1:m,y1:0,x2:m,y2:h,stroke:g,strokeWidth:zn,strokeDasharray:`2 2`}),r?(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`defs`,{children:(0,$.jsx)(`clipPath`,{id:f,children:(0,$.jsx)(`circle`,{cx:m,cy:h,r:y})})}),(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:`hsl(var(--background))`}),(0,$.jsx)(`image`,{href:r,x:m-y,y:h-y,width:y*2,height:y*2,clipPath:`url(#${f})`,preserveAspectRatio:`xMidYMid slice`}),(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:`none`,stroke:g,strokeWidth:zn})]}):_?(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:`hsl(var(--background))`}),(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:g,fillOpacity:.22}),(0,$.jsx)(`circle`,{cx:m,cy:h,r:y,fill:`none`,stroke:g,strokeWidth:zn}),(0,$.jsx)(`text`,{x:m,y:h,textAnchor:`middle`,dominantBaseline:`central`,className:`font-sans`,fontSize:y+1,fontWeight:600,fill:g,children:_})]}):(0,$.jsx)(`circle`,{cx:m,cy:h,r:b,fill:g,stroke:`hsl(var(--background))`,strokeWidth:1}),o?(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`circle`,{cx:S,cy:C,r:x+1.5,fill:`hsl(var(--background))`,stroke:g,strokeWidth:1}),a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`defs`,{children:(0,$.jsx)(`clipPath`,{id:p,children:(0,$.jsx)(`circle`,{cx:S,cy:C,r:x})})}),(0,$.jsx)(`image`,{href:a,x:S-x,y:C-x,width:x*2,height:x*2,clipPath:`url(#${p})`,preserveAspectRatio:`xMidYMid slice`})]}):v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`circle`,{cx:S,cy:C,r:x,fill:g,fillOpacity:.28}),(0,$.jsx)(`text`,{x:S,y:C,textAnchor:`middle`,dominantBaseline:`central`,className:`font-sans`,fontSize:Math.max(4,x+1),fontWeight:700,fill:g,children:v})]}):(0,$.jsx)(`circle`,{cx:S,cy:C,r:Math.max(2.5,x-1),fill:g})]}):null]})});function Un(e,t){switch(t.state){case`synced`:return e(`graph.branchStateSynced`,`Synced`);case`ahead`:return e(`graph.branchStateAhead`,{count:t.ahead,defaultValue:`Ahead ${t.ahead}`});case`behind`:return e(`graph.branchStateBehind`,{count:t.behind,defaultValue:`Behind ${t.behind}`});case`diverged`:return e(`graph.branchStateDiverged`,{ahead:t.ahead,behind:t.behind,defaultValue:`Diverged ${t.ahead}/${t.behind}`});case`local-only`:return e(`graph.branchStateLocalOnly`,`Local only`);case`remote-only`:return e(`graph.branchStateRemoteOnly`,`Remote only`)}}function Wn(e,t){switch(t.primaryAction){case`push`:return e(`review.push`,`Push`);case`pull`:return e(`review.pull`,`Pull`);case`publish`:return e(`graph.publishBranch`,`Publish`);case`checkout`:return e(`history.checkout`,`Checkout`);case`sync`:return e(`graph.syncBranch`,`Sync`);case`none`:return e(`graph.noBranchAction`,`Up to date`)}}function Gn(e,t){return t.primaryAction===`push`||t.primaryAction===`publish`?e(`graph.pushBranchToOrigin`,{branch:t.branch,defaultValue:`Push ${t.branch} to origin`}):t.primaryAction===`pull`&&t.isCurrent?e(`review.pull`,`Pull`):t.primaryAction===`checkout`?e(`graph.checkoutBeforePull`,`Checkout this branch first`):t.primaryAction===`sync`?e(`graph.syncBranchFromHistory`,`Use History to choose merge or rebase`):Wn(e,t)}function Kn(e){let t=e.indexOf(`/`);return t>=0?e.slice(t+1):e}function qn(e){return e.kind===`tag`||e.name===`HEAD`?null:e.kind===`remote`?Kn(e.name):e.name}function Jn(e){return e.kind===`remote`?Kn(e.name):e.name}function Yn(e){return e.kind===`tag`?s:e.kind===`remote`?A:e.syncedRemote?te:T}function Xn(e,t,n){let r=t.pullRequest?e(`graph.pullRequest`,{number:t.pullRequest.number,state:t.pullRequest.state,defaultValue:`PR #${t.pullRequest.number} (${t.pullRequest.state})`}):null,i;return i=t.kind===`tag`?t.name:t.kind===`remote`?e(`graph.remoteBranch`,{ref:t.name,defaultValue:`${t.name} (remote branch)`}):t.syncedRemote?e(`graph.branchSynced`,{ref:t.name,remote:t.syncedRemote,defaultValue:t.isCurrent?`${t.name} (current branch · in sync with ${t.syncedRemote})`:`${t.name} (in sync with ${t.syncedRemote})`}):t.isCurrent?e(`graph.currentBranch`,{ref:t.name,defaultValue:`${t.name} (current branch)`}):t.name,[i,n?Un(e,n):null,r].filter(Boolean).join(` · `)}function Zn(e,t,n){if(t.kind===`tag`)return e(`graph.tag`,`Tag`);if(!n)return null;switch(n.state){case`synced`:return null;case`ahead`:return t.kind===`local`?String(n.ahead):null;case`behind`:return t.kind===`remote`?String(n.behind):null;case`diverged`:return e(`graph.branchChipDiverged`,`Diverged`);case`local-only`:return null;case`remote-only`:return null}}function Qn({ref:e,summary:t}){let{t:n}=H(),r=t?.localRef??n(`graph.notPresent`,`Not present`),i=t?.remoteRef??n(`graph.notPresent`,`Not present`);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 text-xs`,"data-testid":`graph-branch-detail-${e.name}`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-muted-foreground text-[10px] font-medium uppercase`,children:n(`graph.branch`,`Branch`)}),(0,$.jsx)(`div`,{className:`truncate font-mono font-semibold`,children:t?.branch??e.name})]}),(0,$.jsxs)(`dl`,{className:`grid grid-cols-[64px_minmax(0,1fr)] gap-x-3 gap-y-1.5`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.local`,`Local`)}),(0,$.jsx)(`dd`,{className:`min-w-0 truncate font-mono`,title:r,children:r}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.origin`,`Origin`)}),(0,$.jsx)(`dd`,{className:`min-w-0 truncate font-mono`,title:i,children:i}),t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.state`,`State`)}),(0,$.jsx)(`dd`,{children:Un(n,t)}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.localAhead`,`Ahead`)}),(0,$.jsx)(`dd`,{children:t.ahead}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.originAhead`,`Behind`)}),(0,$.jsx)(`dd`,{children:t.behind}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.action`,`Action`)}),(0,$.jsx)(`dd`,{children:Gn(n,t)})]}):null]})]})}function $n({refs:e,branchSummaryByName:t,actionInProgress:n,color:r,searchQuery:i,onPushBranch:a,onPullCurrentBranch:o}){let{t:s}=H();if(e.length===0)return null;let c=et(r),u=i.trim().length>0;return(0,$.jsx)(`div`,{className:`inline-flex min-w-0 shrink items-center gap-1`,"data-testid":`graph-ref-chips`,children:e.map(e=>{let d=qn(e),f=d?t.get(d):void 0,p=e.kind===`local`&&!!f&&(f.primaryAction===`push`||f.primaryAction===`publish`),m=e.kind===`remote`&&!!f&&f.primaryAction===`pull`&&f.isCurrent,h=m?`pull:${d}`:`push:${d}`,g=!!d&&n===h,_=Yn(e),v=m?l:j,y=Zn(s,e,f),b=Jn(e);return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(`div`,{className:`inline-flex min-w-0 items-center gap-0.5 rounded-full px-1 py-px transition-[filter] hover:brightness-90`,style:{backgroundColor:r,color:c},"data-testid":`graph-ref-chip-${e.kind}:${e.name}`,children:(0,$.jsxs)(Ge,{children:[(0,$.jsx)(it,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:`focus-visible:ring-ring/70 inline-flex min-w-0 items-center gap-0.5 rounded-full px-0.5 text-left outline-hidden focus-visible:ring-1`,"aria-label":Xn(s,e,f),onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),"data-testid":`graph-branch-info-${e.name}`,children:[(0,$.jsx)(_,{className:`icon-2xs shrink-0`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:q(`truncate text-[10px] leading-tight font-medium whitespace-nowrap`,e.kind===`local`&&e.isCurrent&&`font-bold`),children:u?(0,$.jsx)(at,{text:b,query:i}):b})]})}),(0,$.jsx)(Mt,{side:`bottom`,align:`start`,className:`w-72 p-3`,onClick:e=>e.stopPropagation(),children:(0,$.jsx)(Qn,{ref:e,summary:f})})]})}),(p||m)&&d&&f?(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{type:`button`,variant:`default`,size:`xs`,"aria-label":Gn(s,f),className:`h-auto min-h-0 shrink-0 gap-0.5 rounded-full px-1.5 py-px text-[10px] leading-tight font-semibold [&_svg]:!size-2.5`,disabled:!!n,onPointerDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation(),p?a(d):o(d)},"data-testid":`graph-branch-action-${d}`,children:[y?(0,$.jsx)(`span`,{"data-testid":`graph-branch-status-${e.name}`,children:y}):(0,$.jsx)(`span`,{children:Wn(s,f)}),(0,$.jsx)(v,{className:q(g&&`animate-pulse`),"data-testid":`graph-branch-action-icon-${d}`})]})}),(0,$.jsx)(W,{side:`top`,children:Gn(s,f)})]}):null]},`${e.kind}:${e.name}`)})})}async function er(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var tr=/^(?:(\d+)\+)?([^@\s]+)@users\.noreply\.github\.com$/i;async function nr(e){if(!e)return null;let t=e.trim().toLowerCase();if(!t)return null;let n=t.match(tr);if(n){let e=n[1],t=n[2];return e?`https://avatars.githubusercontent.com/u/${e}?size=64`:`https://github.com/${encodeURIComponent(t)}.png?size=64`}return`https://gravatar.com/avatar/${await er(t)}?s=64&d=identicon`}var rr=Be(`avatar-cache`),ir=6e4,ar=300,or=new Map,sr=new Map;function cr(e){let t=or.get(e);return t&&t.expiresAt>Date.now()?t.objectUrl:null}function lr(){for(;or.size>ar;){let e=or.keys().next().value;if(e===void 0)break;let t=or.get(e);t&&URL.revokeObjectURL(t.objectUrl),or.delete(e)}}async function ur(e){try{let t=await fetch(e,{mode:`cors`,credentials:`omit`});if(!t.ok)return rr.debug(`avatar fetch non-ok`,{status:t.status}),null;let n=await t.blob(),r=URL.createObjectURL(n),i=or.get(e);return i&&URL.revokeObjectURL(i.objectUrl),or.set(e,{objectUrl:r,expiresAt:Date.now()+ir}),lr(),r}catch(e){return rr.debug(`avatar fetch failed`,{error:e instanceof Error?e.message:String(e)}),null}}function dr(e){let[t,n]=(0,Q.useState)(()=>e?cr(e)??void 0:void 0);return(0,Q.useEffect)(()=>{if(!e){n(void 0);return}let t=cr(e);if(t){n(t);return}n(void 0);let r=!0,i=sr.get(e);return i||(i=ur(e).finally(()=>sr.delete(e)),sr.set(e,i)),i.then(t=>{r&&n(t??e)}),()=>{r=!1}},[e]),t}var fr=new Map,pr={xs:{avatar:`h-3.5 w-3.5`,text:`text-[8px]`},sm:{avatar:`h-4 w-4`,text:`text-[9px]`}};function mr({name:e,avatarUrl:t,email:n,size:r=`xs`,className:i,children:a}){let{avatar:o,text:s}=pr[r],[c,l]=(0,Q.useState)(()=>n?fr.get(n)??null:null);(0,Q.useEffect)(()=>{if(!n||t||fr.has(n))return;let e=!1;return nr(n).then(t=>{e||!t||(fr.set(n,t),l(t))}),()=>{e=!0}},[n,t]);let u=dr(t??c);return(0,$.jsxs)(`span`,{className:q(`flex min-w-0 items-center gap-1 truncate`,i),children:[(0,$.jsxs)(Je,{className:o,children:[u&&(0,$.jsx)(Pt,{src:u,alt:e}),(0,$.jsx)(ot,{name:e,className:s,children:e.charAt(0).toUpperCase()})]}),(0,$.jsx)(`span`,{className:`truncate`,children:a??e})]})}function hr({direction:e,onResize:t,onResizeStart:n,onResizeEnd:r}){let i=(0,Q.useRef)(!1),a=(0,Q.useRef)(0),[o,s]=(0,Q.useState)(!1),c=e===`horizontal`?`col-resize`:`row-resize`;return{resizing:o,handlePointerDown:(0,Q.useCallback)(t=>{i.current=!0,a.current=e===`horizontal`?t.clientX:t.clientY,s(!0),Object.assign(document.body.style,{cursor:c,userSelect:`none`}),t.target.setPointerCapture(t.pointerId),n?.()},[e,c,n]),handlePointerMove:(0,Q.useCallback)(n=>{i.current&&t((e===`horizontal`?n.clientX:n.clientY)-a.current)},[e,t]),handlePointerUp:(0,Q.useCallback)(e=>{i.current&&(i.current=!1,s(!1),Object.assign(document.body.style,{cursor:``,userSelect:``}),e.target.releasePointerCapture(e.pointerId),r?.())},[r])}}var gr=(0,Q.forwardRef)(function({direction:e,resizing:t,onPointerDown:n,onPointerMove:r,onPointerUp:i,onClick:a,className:o,"data-testid":s,...c},l){let u=e===`horizontal`;return(0,$.jsx)(`button`,{ref:l,"aria-label":`Resize`,tabIndex:-1,onPointerDown:n,onPointerMove:r,onPointerUp:i,onClick:a,className:q(`relative z-10 shrink-0`,u?`w-1.5 cursor-col-resize after:absolute after:inset-y-0 after:left-1/2 after:w-px after:-translate-x-1/2 after:bg-border after:transition-all after:ease-linear hover:after:w-[3px] hover:after:bg-ring/50`:`h-1.5 cursor-row-resize after:absolute after:inset-x-0 after:top-1/2 after:h-px after:-translate-y-1/2 after:bg-border after:transition-all after:ease-linear hover:after:h-[3px] hover:after:bg-ring/50`,u&&t&&`after:w-[3px]! after:bg-ring/50!`,!u&&t&&`after:h-[3px]! after:bg-ring/50!`,o),"data-testid":s,...c})});async function _r(e,t=e=>navigator.clipboard.writeText(e)){return await t(e.hash),e.shortHash}var vr=`commit-detail-dialog:sidebar-width`,yr=180,br=600,xr=280;function Sr({selectedCommit:e,selectedHash:t,effectiveThreadId:n,projectModeId:r,githubAvatarBySha:i,onClose:a,onAfterAction:o}){let{t:s}=H(),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(()=>{let e=Number(localStorage.getItem(vr));return Number.isFinite(e)&&e>=yr&&e<=br?e:xr}),k=(0,Q.useRef)(E),{resizing:A,handlePointerDown:j,handlePointerMove:M,handlePointerUp:N}=hr({direction:`horizontal`,onResizeStart:()=>{k.current=E},onResize:e=>{D(Math.max(yr,Math.min(br,k.current+e)))}});(0,Q.useEffect)(()=>{A||localStorage.setItem(vr,String(E))},[A,E]);let P=!!(n||r),{pending:F,inProgress:I,request:L,cancel:te,confirm:re}=On({effectiveThreadId:n,projectModeId:r,onAfterAction:o,onSuccess:a}),ie=e=>I&&F?.kind===e,R=(0,Q.useCallback)(()=>{e&&_r(e).then(e=>Z.success(s(`history.hashCopied`,{hash:e,defaultValue:`Copied ${e}`})),()=>Z.error(s(`history.hashCopyFailed`,`Failed to copy hash`)))},[e,s]);(0,Q.useEffect)(()=>{if(!t||!P){l([]),p(null),_(``);return}let i=!1;return d(!0),p(e?.body.trim()||null),_(``),(async()=>{let[e,a]=await Promise.all([n?G.getCommitFiles(n,t):G.projectCommitFiles(r,t),n?G.getCommitBody(n,t):G.projectCommitBody(r,t)]);if(!i){if(e.isOk()){if(l(e.value.files),e.value.files.length>0){let a=e.value.files[0].path;x(a),T(!0),C(null);let o=n?await G.getCommitFileDiff(n,t,a):await G.projectCommitFileDiff(r,t,a);!i&&o.isOk()&&C(o.value.diff),i||T(!1)}}else Z.error(s(`review.logFailed`,{message:e.error.message,defaultValue:`Failed to load commit files: ${e.error.message}`})),l([]);a.isOk()&&a.value.body&&p(a.value.body),d(!1)}})(),()=>{i=!0}},[t,e?.body,P,n,r,s]);let ae=(0,Q.useCallback)(async e=>{if(!t||!P)return;x(e),T(!0),C(null);let i=n?await G.getCommitFileDiff(n,t,e):await G.projectCommitFileDiff(r,t,e);i.isOk()?C(i.value.diff):Z.error(`Failed to load diff: ${i.error.message}`),T(!1)},[t,P,n,r]),oe=(0,Q.useMemo)(()=>{let e=c.map(e=>({path:e.path,status:e.status===`copied`?`renamed`:e.status,staged:!1,additions:e.additions,deletions:e.deletions}));if(!g.trim())return e;if(v)return e.filter(e=>e.path.includes(g));let t=g.toLowerCase();return e.filter(e=>e.path.toLowerCase().includes(t))},[c,g,v]),se=(0,Q.useMemo)(()=>{let e=new Map;return b&&S&&e.set(b,S),e},[b,S]),le=()=>{a(),x(null),C(null)};return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ze,{open:!!t,onOpenChange:e=>{e||le()},children:(0,$.jsxs)(Vt,{className:`flex h-[85vh] max-w-[90vw] flex-col gap-0 p-0`,"data-testid":`commit-detail-dialog`,children:[(0,$.jsxs)(`div`,{className:`border-border shrink-0 border-b px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(We,{className:`text-sm leading-tight font-semibold`,children:e?.message??`Commit details`}),(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:le,className:`text-muted-foreground sr-only shrink-0`,"data-testid":`commit-detail-close`,children:(0,$.jsx)(ce,{className:`icon-xs`})})]}),(0,$.jsx)(tt,{className:`sr-only`,children:`Commit detail with file changes and diffs`}),e&&(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 pt-1 text-[11px]`,children:[(0,$.jsx)(ne,{className:`icon-xs shrink-0`}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:R,className:`text-primary shrink-0 cursor-pointer border-0 bg-transparent p-0 font-mono hover:underline`,"data-testid":`commit-detail-hash-${e.shortHash}`,children:(0,$.jsx)(`code`,{children:e.shortHash})})}),(0,$.jsx)(W,{side:`bottom`,children:s(`history.copyHash`,`Click to copy hash`)})]}),(0,$.jsx)(mr,{name:e.author,email:e.authorEmail,avatarUrl:i.get(e.hash),size:`sm`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:Et(e.relativeDate)}),(0,$.jsxs)(`span`,{className:`text-muted-foreground shrink-0`,children:[`· `,c.length,` file`,c.length===1?``:`s`]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`xs`,onClick:()=>t&&L(`checkout`,t),disabled:I,"data-testid":`commit-checkout-btn`,children:[ie(`checkout`)?(0,$.jsx)(m,{className:`animate-spin`}):(0,$.jsx)(me,{}),s(`history.checkout`,`Checkout`)]})}),(0,$.jsx)(W,{side:`bottom`,children:s(`history.checkoutTooltip`,`Checkout this commit (detached HEAD)`)})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`xs`,onClick:()=>t&&L(`revert`,t),disabled:I,"data-testid":`commit-revert-btn`,children:[ie(`revert`)?(0,$.jsx)(m,{className:`animate-spin`}):(0,$.jsx)(O,{}),s(`history.revert`,`Revert`)]})}),(0,$.jsx)(W,{side:`bottom`,children:s(`history.revertTooltip`,`Undo this commit with a new commit`)})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`xs`,className:`text-destructive hover:text-destructive`,onClick:()=>t&&L(`reset`,t),disabled:I,"data-testid":`commit-reset-btn`,children:[ie(`reset`)?(0,$.jsx)(m,{className:`animate-spin`}):(0,$.jsx)(ee,{}),s(`history.reset`,`Reset`)]})}),(0,$.jsx)(W,{side:`bottom`,children:s(`history.resetTooltip`,`Hard reset branch to this commit`)})]}),(0,$.jsx)(`div`,{className:`bg-border mx-1 h-4 w-px`}),(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:le,className:`text-muted-foreground shrink-0`,"data-testid":`commit-detail-close`,children:(0,$.jsx)(ce,{className:`icon-xs`})})]})]}),f&&(0,$.jsx)(jt,{className:`mt-1.5 max-h-[80px]`,children:(0,$.jsx)(`p`,{className:`text-muted-foreground text-[11px] whitespace-pre-wrap`,children:f})})]}),u?(0,$.jsx)(dn,{testId:`commit-detail-loading`,label:s(`review.loading`,`Loading changes…`)}):(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col`,style:{width:E},"data-testid":`commit-detail-file-tree`,children:[c.length>0&&(0,$.jsx)(`div`,{className:`border-sidebar-border shrink-0 border-b px-2 py-1`,children:(0,$.jsx)(It,{query:g,onQueryChange:_,placeholder:s(`review.searchFiles`,`Filter files…`),totalMatches:oe.length,resultLabel:g?`${oe.length}/${c.length}`:``,caseSensitive:v,onCaseSensitiveChange:y,onClose:g?()=>_(``):void 0,autoFocus:!1,testIdPrefix:`commit-detail-file-filter`})}),(0,$.jsx)(jt,{className:`min-h-0 flex-1`,children:c.length===0?(0,$.jsx)(`div`,{className:`text-muted-foreground py-4 text-center text-xs`,children:s(`history.noFiles`,`No files changed`)}):oe.length===0?(0,$.jsx)(`div`,{className:`text-muted-foreground py-4 text-center text-xs`,children:s(`history.noMatchingFiles`,`No matching files`)}):(0,$.jsx)(un,{files:oe,selectedFile:b,onFileClick:ae,testIdPrefix:`commit-detail`,searchQuery:g||void 0})})]}),(0,$.jsx)(gr,{direction:`horizontal`,resizing:A,onPointerDown:j,onPointerMove:M,onPointerUp:N,"data-testid":`commit-detail-sidebar-resize`}),(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,"data-testid":`commit-detail-diff-pane`,children:b?(0,$.jsx)(fn,{filePath:b,oldValue:S?pn(S):``,newValue:S?mn(S):``,loading:w,rawDiff:S??void 0,files:oe,onFileSelect:ae,diffCache:se}):(0,$.jsxs)(`div`,{className:`text-muted-foreground flex flex-1 flex-col items-center justify-center gap-2`,children:[(0,$.jsx)(h,{className:`size-8 opacity-30`}),(0,$.jsx)(`p`,{className:`text-xs`,children:s(`history.selectFile`,`Select a file to view changes`)})]})})]})]})}),(0,$.jsx)(Dn,{pending:F,onConfirm:re,onCancel:te})]})}var Cr={sm:{badge:`h-6 px-2 text-sm`,icon:`h-3.5 w-3.5`},xs:{badge:`h-5 px-1.5 text-xs`,icon:`h-3 w-3`},compact:{badge:`h-[15px] px-1 text-[10px]`,icon:`h-2.5 w-2.5`},xxs:{badge:`h-4 px-1 text-[10px]`,icon:`h-2.5 w-2.5`}},wr={OPEN:`border-emerald-300/70 bg-emerald-50 text-emerald-700 hover:border-emerald-400 hover:text-emerald-800 dark:border-emerald-400/35 dark:bg-emerald-400/15 dark:text-emerald-200 dark:hover:border-emerald-300/60 dark:hover:text-emerald-100`,MERGED:`border-violet-300/70 bg-violet-50 text-violet-700 hover:border-violet-400 hover:text-violet-800 dark:border-violet-400/35 dark:bg-violet-400/15 dark:text-violet-200 dark:hover:border-violet-300/60 dark:hover:text-violet-100`,CLOSED:`border-rose-300/70 bg-rose-50 text-rose-700 hover:border-rose-400 hover:text-rose-800 dark:border-rose-400/35 dark:bg-rose-400/15 dark:text-rose-200 dark:hover:border-rose-300/60 dark:hover:text-rose-100`};function Tr({prNumber:e,prState:t=`OPEN`,prUrl:n,size:r=`xs`,showExternalIcon:i=!!n,className:a,...o}){let{t:s}=H(),c=Cr[r],l=t===`OPEN`?s(`thread.prOpen`,{number:e,defaultValue:`PR #${e}`}):t===`MERGED`?s(`thread.prMerged`,{number:e,defaultValue:`PR #${e} (merged)`}):s(`thread.prClosed`,{number:e,defaultValue:`PR #${e} (closed)`}),u=q(`inline-flex shrink-0 items-center gap-0.5 rounded-[3px] border leading-none font-semibold focus-visible:ring-ring focus-visible:ring-1 focus-visible:outline-none`,c.badge,wr[t],!n&&`cursor-default`,a),d=(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{children:[`#`,e]}),i?(0,$.jsx)(ke,{className:c.icon,"aria-hidden":`true`}):null]});return n?(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>{e.stopPropagation()},onKeyDown:e=>e.stopPropagation(),className:u,"data-testid":o[`data-testid`],"aria-label":l,children:d})}),(0,$.jsx)(W,{side:`top`,className:`text-xs`,children:l})]}):(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`span`,{className:u,"data-testid":o[`data-testid`],children:d})}),(0,$.jsx)(W,{side:`top`,className:`text-xs`,children:l})]})}function Er({icon:e,title:t,description:n,action:r,className:i,testId:a}){return(0,$.jsxs)(`div`,{"data-testid":a,className:q(`flex h-full w-full flex-col items-center justify-center gap-2 p-4 text-center text-muted-foreground`,i),children:[e&&(0,$.jsx)(e,{className:`size-8 opacity-40`}),(0,$.jsx)(`p`,{className:`text-xs`,children:t}),n&&(0,$.jsx)(`div`,{className:`text-muted-foreground/70 text-[10px]`,children:n}),r&&(0,$.jsx)(`div`,{className:`mt-1`,children:r})]})}var Dr={default:{time:`group-hover:opacity-0 group-hover:pointer-events-none`,menu:`group-hover:opacity-100`},thread:{time:`group-hover/thread:opacity-0 group-hover/thread:pointer-events-none`,menu:`group-hover/thread:opacity-100`}};function Or({time:e,timeClassName:t,children:n,open:r=!1,group:i=`default`,className:a}){let o=Dr[i];return(0,$.jsxs)(`div`,{className:q(`grid place-items-center justify-items-center`,a),children:[(0,$.jsx)(`span`,{className:q(`col-start-1 row-start-1`,o.time,t,r&&`pointer-events-none opacity-0`),children:e}),(0,$.jsx)(`div`,{className:q(`col-start-1 row-start-1 flex items-center opacity-0`,o.menu,r&&`opacity-100!`),children:n})]})}function kr(e,t,n){return e?t:n}function Ar(e,t,n,r){return e&&(!t||n&&!!r)}function jr(e,t,n){return e?t:n}function Mr(){return kr($t(e=>e.liveColumnsOpen),$t(e=>e.gridSelectedThreadId),rt(e=>e.selectedThreadId))}function Nr(){let e=$t(e=>e.liveColumnsOpen),t=ct($t(e=>e.gridSelectedThreadId)),n=Ye(e=>e.selectedProjectId);return jr(e,t?.projectId||null,n)}function Pr(e,t,n){let r=$e(e),i=pt(n=>!e&&t?n.statusByProject[t]:void 0),a=e?r:i;return(0,Q.useEffect)(()=>{n&&(e?pt.getState().fetchForThread(e):t&&pt.getState().fetchProjectStatus(t))},[n,e,t]),{status:a,dirty:!!a&&a.state!==`clean`&&(a.linesAdded>0||a.linesDeleted>0||(a.dirtyFileCount??0)>0)}}var Fr=0,Ir=.5,Lr=1;function Rr(e){let t=[],n=[],r=0,i=new Set(e.map(e=>e.hash)),a=()=>{let e=t.indexOf(null);return e===-1?t.length:e};for(let o of e){let e=t.slice(),s=t.indexOf(o.hash);s===-1&&(s=a());for(let e=0;e<t.length;e++)t[e]===o.hash&&(t[e]=null);for(;t.length<=s;)t.push(null);t[s]=null;let c=(e,n)=>{let r=t.indexOf(e);if(r!==-1&&!i.has(e))return r;if(n!==null&&(t[n]===null||t[n]===void 0)){for(;t.length<=n;)t.push(null);return t[n]=e,n}let o=a();for(;t.length<=o;)t.push(null);return t[o]=e,o},l=[];o.parentHashes.forEach((e,t)=>{let n=c(e,t===0?s:null);l.push(n)});let u=[],d=new Set,f=e=>{let t=`${e.fromLane},${e.fromY},${e.toLane},${e.toY}`;d.has(t)||(d.add(t),u.push(e))};for(let n=0;n<e.length;n++){let r=e[n];r!==null&&(r===o.hash?f({fromLane:n,fromY:Fr,toLane:s,toY:Ir,color:n}):t[n]===r&&f({fromLane:n,fromY:Fr,toLane:n,toY:Lr,color:n}))}for(let e of l)f({fromLane:s,fromY:Ir,toLane:e,toY:Lr,color:e});n.push({commitLane:s,nodeColor:s,segments:u});let p=Math.max(t.length,e.length,s+1,...l.map(e=>e+1));for(p>r&&(r=p);t.length>0&&t[t.length-1]===null;)t.pop()}return{rows:n,laneCount:Math.max(r,1)}}function zr(e,t){let n=t.trim().toLowerCase();return!!(!n||e.hash?.toLowerCase().includes(n)||e.shortHash?.toLowerCase().includes(n)||e.message.toLowerCase().includes(n)||e.body&&e.body.toLowerCase().includes(n)||e.refs?.some(e=>e.name.toLowerCase().includes(n)))}function Br(e){if(!e||e===`exists`)return null;let t=Nt(e);return t?.includes(`github.com`)?t.replace(/\/$/,``):null}function Vr(e,t){return`${e.replace(/\/$/,``)}/commit/${t}`}function Hr(e,t,n){return!e||n?null:Vr(e,t)}var Ur=e=>e.slice(e.indexOf(`/`)+1);function Wr(e,t){return typeof e==`string`?e.includes(`/`)?{name:e,kind:t.has(Ur(e))?`remote`:`local`}:{name:e,kind:/^v?\d/.test(e)?`tag`:`local`}:e}function Gr(e,t){let n=e.filter(e=>(typeof e==`string`?e:e.name).trim()!==``),r=new Set(n.map(e=>typeof e==`string`?e:e.name)),i=n.map(e=>Wr(e,r)),a=new Set(i.filter(e=>e.kind===`local`).map(e=>e.name)),o=new Map;for(let e of i){if(e.kind!==`remote`)continue;let t=Ur(e.name);a.has(t)&&!o.has(t)&&o.set(t,e)}let s=[];for(let e of i)if(!(e.kind===`remote`&&o.get(Ur(e.name))===e))if(e.kind===`tag`)s.push({kind:`tag`,name:e.name,isCurrent:!1});else if(e.kind===`remote`){let t={kind:`remote`,name:e.name,isCurrent:!1};e.pullRequest&&(t.pullRequest=e.pullRequest),s.push(t)}else{let n=o.get(e.name),r={kind:`local`,name:e.name,isCurrent:!!t&&e.name===t,syncedRemote:n?.name},i=e.pullRequest??n?.pullRequest;i&&(r.pullRequest=i),s.push(r)}return s}function Kr(e){let t=qr(e);return t.length>0?t.join(`, `):null}function qr(e){let t=[],n=[];for(let r of e)r.kind===`local`&&r.name!==`HEAD`?t.push(r.name):r.kind===`remote`&&n.push(r.name);return t.length>0?t:n.length>0?n:[]}function Jr(e){let t=new Set;for(let n of e)n.kind===`local`&&n.name!==`HEAD`?(t.add(n.name),n.syncedRemote&&t.add(Ur(n.syncedRemote))):n.kind===`remote`&&t.add(Ur(n.name));return t}function Yr(e,t){for(let n of e)if(t.has(n))return!0;return!1}function Xr(e,t,n){let r=e.get(t);r?r.includes(n)||r.push(n):e.set(t,[n])}function Zr(e){let t=new Map(e.map(e=>[e.hash,e])),n=new Map;for(let r of e){let e=qr(Gr(r.refs,r.headBranch));if(e.length===0)continue;let i=[r.hash],a=new Set;for(;i.length>0;){let r=i.pop();if(a.has(r))continue;a.add(r);for(let t of e)Xr(n,r,t);let o=t.get(r);if(o)for(let e of o.parentHashes??[])t.has(e)&&i.push(e)}}return n}function Qr(e){let t=new Map(e.map(e=>[e.hash,e])),n=new Map;for(let r of e){let e=Jr(Gr(r.refs,r.headBranch)),i=[...r.parentHashes??[]],a=new Set;for(;i.length>0;){let o=i.shift();if(a.has(o))continue;a.add(o);let s=t.get(o);if(!s)continue;let c=Gr(s.refs,s.headBranch),l=Kr(c);if(l&&!Yr(e,Jr(c))){n.set(r.hash,l);break}i.push(...s.parentHashes??[])}}return n}function $r(e){let t=new Map(e.map(e=>[e.hash,e])),n=Zr(e),r=new Map;for(let i of e){let e=i.parentHashes?.[0];if(!e)continue;let a=t.get(e);if(!a){r.set(i.hash,{commit:e.slice(0,7),branchLabels:[]});continue}let o=a.shortHash??a.hash.slice(0,7),s=qr(Gr(a.refs,a.headBranch)),c=s.length>0?s:n.get(a.hash)??[];r.set(i.hash,{commit:o,branchLabels:c})}return r}function ei(e,t){let n=new Map(t.map(e=>[e.hash,e])),r=new Map;for(let t of e){let e=n.get(t.sourceHash),i=(e?Kr(Gr(e.refs,e.headBranch)):null)??t.event?.branch??t.event?.onto??t.sourceShortHash??t.sourceHash.slice(0,7);i&&Xr(r,t.targetHash,i)}return new Map(Array.from(r,([e,t])=>[e,t.join(`, `)]))}function ti(e){let t=new Map(e.map(e=>[e.hash,e])),n=new Set,r=new Set;for(let t of e)for(let e of t.refs)e.kind===`remote`&&n.add(t.hash),e.kind===`local`&&e.name!==`HEAD`&&r.add(t.hash);let i=e=>{let n=new Set,r=[...e];for(;r.length>0;){let e=r.pop();if(n.has(e))continue;n.add(e);let i=t.get(e);if(i)for(let e of i.parentHashes)t.has(e)&&r.push(e)}return n},a=i(n),o=i(r),s=new Set;for(let e of a)o.has(e)||s.add(e);return s}function ni(e,t){let n=new Set;if(!e)return n;let r=[e];for(;r.length>0;){let e=r.pop();if(n.has(e))continue;n.add(e);let i=t.get(e);if(i)for(let e of i.parentHashes)t.has(e)&&r.push(e)}return n}function ri(e,t){let n=0;for(let r of e)t.has(r)||(n+=1);return n}function ii(e){let t=new Map(e.map(e=>[e.hash,e])),n=new Map,r=e=>{let t=n.get(e);if(t)return t;let r={branch:e,isCurrent:!1,ahead:0,behind:0,state:`local-only`,primaryAction:`publish`};return n.set(e,r),r};for(let t of e)for(let e of t.refs)if(!(e.kind===`tag`||e.name===`HEAD`)){if(e.kind===`local`){let n=r(e.name);n.localRef=e.name,n.localHash=t.hash,n.isCurrent||=t.headBranch===e.name}else if(e.kind===`remote`){let n=r(Ur(e.name));(!n.remoteRef||e.name.startsWith(`origin/`))&&(n.remoteRef=e.name,n.remoteHash=t.hash)}}for(let e of n.values())if(e.localHash&&e.remoteHash){if(e.localHash===e.remoteHash){e.state=`synced`,e.primaryAction=`none`,e.ahead=0,e.behind=0;continue}let n=ni(e.localHash,t),r=ni(e.remoteHash,t);e.ahead=ri(n,r),e.behind=ri(r,n),r.has(e.localHash)?(e.state=`behind`,e.primaryAction=e.isCurrent?`pull`:`checkout`):n.has(e.remoteHash)?(e.state=`ahead`,e.primaryAction=`push`):(e.state=`diverged`,e.primaryAction=e.isCurrent?`sync`:`checkout`)}else e.localHash?(e.state=`local-only`,e.primaryAction=`publish`,e.ahead=0,e.behind=0):(e.state=`remote-only`,e.primaryAction=`checkout`,e.ahead=0,e.behind=0);return[...n.values()].sort((e,t)=>{if(e.isCurrent!==t.isCurrent)return e.isCurrent?-1:1;let n={diverged:0,ahead:1,behind:2,"local-only":3,"remote-only":4,synced:5},r=n[e.state]-n[t.state];return r===0?e.branch.localeCompare(t.branch):r})}var ai=8;function oi({laneGutterWidth:e,railWidth:t,leftInset:n=12}){return n+e+t/2}function si({sourceLane:e,targetLane:t}){return Math.max(e??t,t)+1}function ci({sourceLane:e,targetLane:t,laneCount:n}){return si({sourceLane:e,targetLane:t})>=n}function li({sourceX:e,sourceY:t,targetX:n,targetY:r,railX:i,radius:a=ai}){let o=r-t,s=i-e,c=n-i;if(o===0||s===0||c===0)return`M ${e} ${t} L ${i} ${t} L ${i} ${r} L ${n} ${r}`;let l=Math.sign(o),u=Math.sign(s),d=Math.sign(c),f=Math.min(a,Math.abs(s),Math.abs(o)/2),p=Math.min(a,Math.abs(c),Math.abs(o)/2);return[`M ${e} ${t}`,`L ${i-u*f} ${t}`,`Q ${i} ${t} ${i} ${t+l*f}`,`L ${i} ${r-l*p}`,`Q ${i} ${r} ${i+d*p} ${r}`,`L ${n} ${r}`].join(` `)}var ui=Be(`commit-graph`),di=new Map;function fi(e){return!!e.committer&&(e.committer!==e.author||!!e.committerEmail&&e.committerEmail!==e.authorEmail)}var pi=80,mi=10.5,hi=16,gi=40,_i=2e3;function vi(e){return 12+e*16+16/2}function yi(e){return vi(e)+16/2+2}function bi(e){return Math.max(e,1)}function xi({visible:e}){let{t}=H(),n=Math.round(mi*1.5)+6,r=(0,Q.useCallback)(e=>e.refs.length>0?43:n,[n,43]),a=Nr(),o=Mr()||void 0,s=o?null:a,c=ft(),l=!!(o||s),[u,d]=(0,Q.useState)([]),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!0),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(new Set),[S,C]=(0,Q.useState)(new Set),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)([]),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(new Map),M=wi(u),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(``),L=(0,Q.useRef)(!1),ee=(0,Q.useRef)(!1),te=(0,Q.useRef)(null),re=(0,Q.useRef)([]),ie=`${o||s||``}::${g}`,R=(0,Q.useCallback)(async(e=0,n=!1)=>{if(!l||L.current)return null;L.current=!0,p(!0);let r=performance.now(),i=te.current?.signal,a=o?await G.getGitGraphLog(o,pi,g,e,i):await G.projectGitGraphLog(s,pi,g,e,i);if(i?.aborted)return L.current=!1,null;let c=null;if(a.isOk()){let{entries:e,hasMore:t,unpushedHashes:i,unpulledHashes:o=[]}=a.value,s=n?[...re.current,...e]:e;re.current=s,d(s),h(t),x(e=>{if(!n)return new Set(i);let t=new Set(e);for(let e of i)t.add(e);return t}),C(e=>{if(!n)return new Set(o);let t=new Set(e);for(let e of o)t.add(e);return t}),Ne(`git.graph_log.loaded`,performance.now()-r,{attributes:{count:String(e.length),append:String(n)}}),c={entries:s,hasMore:t}}else a.error.message!==`Request aborted`&&(ui.warn(`graph-log load failed`,{error:a.error.message}),Z.error(t(`review.logFailed`,{message:a.error.message,defaultValue:`Failed to load log: ${a.error.message}`})));return p(!1),L.current=!1,c},[l,o,s,g,t]),ae=(0,Q.useCallback)(()=>{!m||L.current||R(u.length,!0)},[m,u.length,R]),oe=(0,Q.useCallback)(()=>{ee.current=!0,R(0,!1)},[R]);(0,Q.useEffect)(()=>{te.current?.abort(),te.current=new AbortController,L.current=!1,ee.current=!1,re.current=[],d([]),h(!1),x(new Set),C(new Set),D([]),k(null),I(``),e&&l&&(ee.current=!0,R(0,!1))},[ie]),(0,Q.useEffect)(()=>{e&&l&&!ee.current&&(ee.current=!0,R(0,!1))},[e,l,R]),(0,Q.useEffect)(()=>{if(!e||!l)return;let t=new AbortController;return(o?G.getReflogEvents(o,t.signal):G.projectReflogEvents(s,t.signal)).then(e=>{t.signal.aborted||(e.isOk()?D(e.value.events):e.error.message!==`Request aborted`&&(ui.warn(`reflog-events load failed`,{error:e.error.message}),D([])))}),()=>t.abort()},[e,l,o,s]);let se=s??a??c??null;(0,Q.useEffect)(()=>{if(!se){P(null);return}let e=new AbortController;return G.projectGetRemoteUrl(se,e.signal).then(t=>{e.signal.aborted||!t.isOk()||P(Br(t.value.remoteUrl))}),()=>e.abort()},[se]);let ce=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{j(new Map),ce.current=new Set},[ie]);let le=s??a??c??null;(0,Q.useEffect)(()=>{if(!le||u.length===0)return;let e=u.find(e=>!A.has(e.hash)&&!ce.current.has(e.hash));if(!e)return;ce.current.add(e.hash);let t=!1;return G.githubCommitAuthors(le,{sha:e.hash,per_page:100}).then(e=>{if(t||e.isErr())return;let n=e.value.authors;n.length!==0&&j(e=>{let t=new Map(e);for(let e of n)e.avatar_url&&t.set(e.sha,e.avatar_url);return t})}),()=>{t=!0}},[le,u,A]);let z=F.trim().length>0,B=(0,Q.useMemo)(()=>z?u.filter(e=>zr(e,F)):u,[u,F,z]),V=(0,Q.useMemo)(()=>ti(u),[u]),ue=(0,Q.useMemo)(()=>An(E),[E]),de=(0,Q.useMemo)(()=>z?[]:jn(E,B),[B,z,E]),fe=(0,Q.useMemo)(()=>ei(de,B),[B,de]),pe=(0,Q.useMemo)(()=>z?new Map:Qr(B),[B,z]),me=(0,Q.useMemo)(()=>$r(B),[B]),he=(0,Q.useMemo)(()=>z?{rows:B.map(()=>({commitLane:0,nodeColor:0,segments:[]})),laneCount:1}:Rr(B.map(e=>({hash:e.hash,parentHashes:e.parentHashes}))),[B,z]),ge=bi(he.laneCount),_e=ge*16+(0,Q.useMemo)(()=>{if(de.length===0)return 0;let e=new Map;for(let t=0;t<B.length;t+=1){let n=he.rows[t];n&&e.set(B[t].hash,n.commitLane)}for(let t of de){let n=e.get(t.targetHash);if(n!==void 0&&ci({sourceLane:e.get(t.sourceHash)??null,targetLane:n,laneCount:ge}))return hi}return 0},[B,ge,he.rows,de]),{status:ve,dirty:ye}=Pr(o,s,!!e&&l&&u.length>0),be=!z&&ye?ve:void 0,xe=(0,Q.useRef)(null),Se=!z&&m,Ce=Yt({count:B.length+ +!!Se,getScrollElement:()=>xe.current,estimateSize:e=>e>=B.length?n:r(B[e]),getItemKey:e=>e>=B.length?`__sentinel__`:B[e].hash,overscan:12});(0,Q.useEffect)(()=>{Ce.measure()},[n,43,Ce]);let we=Ce.getVirtualItems(),Te=we[we.length-1]?.index;(0,Q.useEffect)(()=>{!Se||Te===void 0||Te>=u.length-5&&ae()},[Te,u.length,Se,ae]),(0,Q.useEffect)(()=>{!z||!m||L.current||u.length>=_i||R(u.length,!0)},[z,m,u.length,R]);let Ee=(0,Q.useCallback)(()=>{I(``)},[]),De=u.find(e=>e.hash===v),Oe=(0,Q.useMemo)(()=>ii(u),[u]),ke=(0,Q.useMemo)(()=>new Map(Oe.map(e=>[e.branch,e])),[Oe]),Ae=(0,Q.useCallback)(()=>{o?pt.getState().fetchForThread(o,!0):s&&pt.getState().fetchProjectStatus(s,!0)},[o,s]),je=(0,Q.useCallback)(async e=>{if(!l||w)return;T(`push:${e}`);let n=o?await G.pushBranch(o,e):await G.projectPushBranch(s,e);n.isOk()?Z.success(t(`history.pushBranchSuccess`,{branch:e,defaultValue:`Pushed ${e} to origin`})):Z.error(t(`review.pushFailed`,{message:n.error.message,defaultValue:`Push failed: ${n.error.message}`})),T(null),Ae(),oe()},[l,w,o,s,Ae,oe,t]),Me=(0,Q.useCallback)(async e=>{if(!l||w)return;T(`pull:${e}`);let n=o?await G.pull(o,`ff-only`):await G.projectPull(s,`ff-only`);n.isOk()?Z.success(t(`review.pullSuccess`,`Pulled successfully`)):Z.error(t(`review.pullFailed`,{message:n.error.message,defaultValue:`Pull failed: ${n.error.message}`})),T(null),Ae(),oe()},[l,w,o,s,Ae,oe,t]);return l?(0,$.jsxs)(`div`,{className:`flex h-full w-full min-w-0 flex-col overflow-hidden`,"data-testid":`commit-graph-tab`,children:[(0,$.jsx)(Ti,{logLoading:f,allBranches:g,commitCount:u.length,onRefresh:oe,onToggleAllBranches:()=>_(e=>!e)}),(0,$.jsx)(`div`,{className:`border-sidebar-border bg-background border-b px-2 py-1`,children:(0,$.jsx)(It,{query:F,onQueryChange:I,totalMatches:B.length,loading:z&&f,onClose:z?Ee:void 0,autoFocus:!1,placeholder:t(`graph.searchPlaceholder`,`Search branches & commits`),testIdPrefix:`graph-search`,resultLabel:z?t(`graph.matchCount`,{count:B.length,defaultValue:`${B.length} matches`}):``})}),!z&&be&&(0,$.jsx)(Ei,{status:be,firstRow:he.rows[0],laneCount:ge,gutterWidth:_e,rowHeight:n}),(0,$.jsx)(`div`,{className:`flex flex-1 flex-col overflow-y-auto`,ref:xe,children:f&&u.length===0?(0,$.jsx)(dn,{testId:`graph-loading`,label:t(`review.loadingLog`,`Loading commits…`)}):B.length===0?z?(0,$.jsx)(Er,{icon:i,title:t(`graph.noMatches`,`No commits match your search`)}):(0,$.jsx)(Er,{icon:ne,title:t(`review.noCommits`,`No commits yet`)}):(0,$.jsxs)(`div`,{style:{height:Ce.getTotalSize(),width:`100%`,position:`relative`},children:[(0,$.jsx)(Ci,{links:de,entries:B,layoutRows:he.rows,gutterWidth:_e,rowHeightFor:r}),we.map(e=>{if(e.index>=B.length)return(0,$.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:n,transform:`translateY(${e.start}px)`},className:`flex items-center justify-center`,children:(0,$.jsx)(dn,{fill:!1,layout:`inline`,size:`compact`,testId:`graph-loading-more`,label:t(`history.loadingMore`,`Loading more…`)})},`__sentinel__`);let i=B[e.index];return(0,$.jsx)(Di,{entry:i,graphRow:he.rows[e.index],laneCount:ge,gutterWidth:_e,selected:v===i.hash,avatarUrl:A.get(i.hash)??M.get(i.authorEmail),committerAvatarUrl:M.get(i.committerEmail),githubBrowseBaseUrl:N,effectiveThreadId:o,projectModeId:s,onAfterAction:oe,branchSummaryByName:ke,branchActionInProgress:w,onPushBranch:je,onPullCurrentBranch:Me,rebaseEvents:ue.get(i.hash)??[],onSelectRebaseEvent:k,forkedFromRefLabel:pe.get(i.hash)??fe.get(i.hash)??null,parentLabel:me.get(i.hash)??null,unpushed:b.has(i.hash),unpulled:S.has(i.hash)||V.has(i.hash),connectToWip:!!be&&e.index===0,searchQuery:F,transform:e.start,rowHeight:r(i),onSelect:()=>y(v===i.hash?null:i.hash)},i.hash)})]})}),(0,$.jsx)(Sr,{selectedCommit:De,selectedHash:v,effectiveThreadId:o,projectModeId:s,githubAvatarBySha:A,onClose:()=>y(null),onAfterAction:oe}),(0,$.jsx)(Oi,{event:O,onClose:()=>k(null)})]}):(0,$.jsx)(Er,{title:t(`review.noProject`,`Select a project to view history`)})}function Si(e,t){return e.refs.length===0?t/2:(t-37)/2+15/2}function Ci({links:e,entries:t,layoutRows:n,gutterWidth:r,rowHeightFor:i}){let a=(0,Q.useId)();if(e.length===0)return null;let o=0,s=new Map;for(let e=0;e<t.length;e+=1){let r=t[e],a=n[e],c=i(r);a&&s.set(r.hash,{top:o,nodeY:Si(r,c),lane:a.commitLane}),o+=c}let c=[];for(let t of e){let e=s.get(t.sourceHash),n=s.get(t.targetHash);e&&n&&c.push({link:t,source:e,target:n})}if(c.length===0)return null;let l=oi({laneGutterWidth:c.reduce((e,{source:t,target:n})=>{let r=si({sourceLane:t.lane,targetLane:n.lane});return Math.max(e,r)},0)*16,railWidth:hi}),u=Math.max(r+12,l+12,64);return(0,$.jsxs)(`svg`,{className:`pointer-events-none absolute top-0 left-0 z-20`,style:{width:u,height:o,overflow:`visible`},width:u,height:o,"aria-hidden":`true`,"data-testid":`graph-rebase-copy-links`,children:[(0,$.jsx)(`defs`,{children:(0,$.jsx)(`marker`,{id:a,markerWidth:`6`,markerHeight:`6`,refX:`5`,refY:`3`,orient:`auto`,markerUnits:`strokeWidth`,children:(0,$.jsx)(`path`,{d:`M 0 0 L 6 3 L 0 6 z`,fill:`var(--terminal-yellow)`})})}),c.map(({link:e,source:t,target:n})=>{let r=oi({laneGutterWidth:si({sourceLane:t.lane,targetLane:n.lane})*16,railWidth:hi}),i=n.top+n.nodeY;return(0,$.jsx)(`g`,{children:(0,$.jsx)(`path`,{d:li({sourceX:yi(t.lane),sourceY:t.top+t.nodeY,targetX:yi(n.lane),targetY:i,railX:r}),fill:`none`,stroke:`var(--terminal-yellow)`,strokeWidth:1.4,strokeDasharray:`3 3`,strokeLinecap:`round`,strokeLinejoin:`round`,markerEnd:`url(#${a})`,opacity:.9})},`${e.event.id}:${e.sourceHash}:${e.targetHash}`)})]})}function wi(e){let[t,n]=(0,Q.useState)(()=>new Map(di));return(0,Q.useEffect)(()=>{let r=[...new Set(e.flatMap(e=>[e.authorEmail,e.committerEmail]).filter(e=>!!e))].filter(e=>!t.has(e));if(r.length===0)return;let i=!1;return Promise.all(r.map(async e=>[e,await nr(e)])).then(e=>{if(i)return;let t=e.filter(e=>!!e[1]);t.length!==0&&n(e=>{let n=new Map(e);for(let[e,r]of t)n.set(e,r),di.set(e,r);return n})}),()=>{i=!0}},[e,t]),t}function Ti({logLoading:e,allBranches:t,commitCount:n,onRefresh:r,onToggleAllBranches:i}){let{t:a}=H();return(0,$.jsxs)(`div`,{className:`border-sidebar-border bg-background flex items-center gap-1 border-b px-2 py-1`,children:[(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,onClick:r,disabled:e,"data-testid":`graph-refresh`,children:(0,$.jsx)(k,{className:q(`icon-base`,e&&`animate-spin`)})}),(0,$.jsxs)(Y,{variant:t?`secondary`:`ghost`,size:`sm`,className:`h-8 gap-1 px-2 text-xs`,onClick:i,"data-testid":`graph-toggle-all-branches`,children:[(0,$.jsx)(me,{className:`icon-base`}),a(`graph.allBranches`,`All branches`)]}),(0,$.jsx)(`span`,{className:`text-muted-foreground ml-auto text-[10px]`,children:a(`graph.commitCount`,{count:n,defaultValue:`${n} commits`})})]})}function Ei({status:e,firstRow:t,laneCount:n,gutterWidth:r,rowHeight:i}){let{t:a}=H(),o=$t(e=>e.setReviewSubTab),s=Math.min(t?.commitLane??0,Math.max(0,n-1))*16+16/2,c=i/2,l=Rn(t?.nodeColor??0),u=Math.min(16/2,Math.max(5,Math.round(i*.15)));return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(`changes`),style:{height:i},className:`hover:bg-accent/50 flex w-full shrink-0 cursor-pointer items-center gap-2 overflow-hidden pr-2 pl-3 text-left transition-colors`,"data-testid":`graph-wip-row`,children:[(0,$.jsx)(`div`,{style:{width:r},className:`shrink-0 self-stretch`,children:(0,$.jsxs)(`svg`,{width:r,height:i,style:{width:r,height:i,overflow:`visible`},"aria-hidden":`true`,children:[(0,$.jsx)(`line`,{x1:s,y1:c,x2:s,y2:i,stroke:l,strokeWidth:1.6,strokeDasharray:`2 2`}),(0,$.jsx)(`circle`,{cx:s,cy:c,r:u,fill:`hsl(var(--background))`,stroke:l,strokeWidth:1.6,strokeDasharray:`2 2`})]})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 pl-1`,children:[(0,$.jsx)(`span`,{className:`text-foreground truncate text-xs leading-tight font-medium`,children:a(`graph.uncommittedChanges`,`Uncommitted changes`)}),(0,$.jsx)(At,{linesAdded:e.linesAdded,linesDeleted:e.linesDeleted,dirtyFileCount:e.dirtyFileCount,size:`xs`})]})]})}function Di({entry:e,graphRow:t,laneCount:n,gutterWidth:r,selected:i,avatarUrl:a,committerAvatarUrl:o,githubBrowseBaseUrl:s,effectiveThreadId:c,projectModeId:l,onAfterAction:u,branchSummaryByName:d,branchActionInProgress:f,onPushBranch:p,onPullCurrentBranch:m,rebaseEvents:h,onSelectRebaseEvent:g,forkedFromRefLabel:_,parentLabel:v,unpushed:y,unpulled:b,connectToWip:x,searchQuery:S,transform:C,rowHeight:w,onSelect:T}){let{t:E}=H(),[D,O]=(0,Q.useState)(!1),k=dr(a),A=fi(e),j=dr(A?o:void 0),M=Rn(t?.nodeColor??0),N=(0,Q.useMemo)(()=>Gr(e.refs,e.headBranch),[e.refs,e.headBranch]),P=(0,Q.useMemo)(()=>{let e=new Set;return N.flatMap(t=>{if(!t.pullRequest)return[];let n=t.pullRequest.url||String(t.pullRequest.number);return e.has(n)?[]:(e.add(n),[t.pullRequest])})},[N]),F=(0,Q.useMemo)(()=>N.filter(e=>e.kind===`local`&&!e.syncedRemote&&e.name!==`HEAD`).map(e=>e.name),[N]),I=(0,Q.useMemo)(()=>N.filter(e=>e.kind===`local`&&e.name!==`HEAD`).map(e=>e.name).filter(e=>!d.get(e)?.isCurrent),[d,N]),L=Hr(s,e.hash,y),ee=(0,Q.useMemo)(()=>(0,$.jsx)(ki,{relativeDate:e.relativeDate}),[e.relativeDate]),te=N.length>0,ne=Math.round(mi*1.5),re=Si(e,w),ie=te?re/w:.5;return(0,$.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:w,transform:`translateY(${C}px)`},children:(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:T,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),T())},className:q(`group relative flex h-full w-full cursor-pointer items-center gap-2 overflow-hidden pl-3 pr-2 text-left transition-colors`,i?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-accent/50`),"data-testid":`graph-commit-${e.shortHash}`,children:[te&&t&&(()=>{let e=Math.min(16/2,Math.max(6,Math.round(w*.15))),n=12+t.commitLane*16+16/2,i=12+r+8+4;return(0,$.jsx)(`svg`,{className:`pointer-events-none absolute inset-0`,style:{overflow:`visible`},"aria-hidden":`true`,children:(0,$.jsx)(`line`,{x1:n+e,y1:re,x2:i,y2:re,stroke:M,strokeWidth:1.6,strokeLinecap:`round`})})})(),t&&(()=>{let i=t.commitLane*16+16/2,a=2*Math.min(16/2,Math.max(6,Math.round(w*.15))),o=A?a+8:a;return(0,$.jsxs)(`div`,{style:{width:r},className:`relative shrink-0 self-stretch`,children:[(0,$.jsx)(Hn,{row:t,laneCount:n,height:w,avatarUrl:k,authorName:e.author,committerAvatarUrl:j,committerName:A?e.committer:void 0,connectUp:x,nodeYFrac:ie}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`div`,{"aria-hidden":!0,className:`absolute -translate-x-1/2 -translate-y-1/2`,style:{left:i,top:ie*w,width:o,height:o}})}),(0,$.jsx)(W,{side:`top`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{children:E(`graph.nodeAuthor`,{author:e.author,defaultValue:`Author: ${e.author}`})}),A?(0,$.jsx)(`span`,{children:E(`graph.nodeCommitter`,{committer:e.committer,defaultValue:`Committed by: ${e.committer}`})}):null,_?(0,$.jsx)(`span`,{children:E(`graph.nodeBranchedFrom`,{branch:_,defaultValue:`Branched from: ${_}`})}):null,v?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:E(`graph.nodeParent`,{parent:v.commit,defaultValue:`Parent: ${v.commit}`})}),v.branchLabels.length>0?(0,$.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4`,children:v.branchLabels.map(e=>(0,$.jsx)(`li`,{title:e,children:Ft(e,gi)},e))}):null]}):null,y&&(0,$.jsx)(`span`,{children:E(`history.unpushed`,`Not pushed`)})]})})]})]})})(),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center pl-1`,children:[N.length>0&&(0,$.jsxs)(`div`,{className:`mb-1.5 flex min-w-0 shrink-0 items-center overflow-hidden`,style:{height:15},children:[(0,$.jsx)($n,{refs:N,branchSummaryByName:d,actionInProgress:f,color:M,searchQuery:S,onPushBranch:p,onPullCurrentBranch:m}),P.map(e=>(0,$.jsx)(Tr,{prNumber:e.number,prState:e.state,prUrl:e.url,size:`compact`,className:`ml-1`,"data-testid":`graph-pr-badge-${e.number}`},e.url))]}),(0,$.jsxs)(`div`,{className:`flex w-full min-w-0 shrink-0 items-center gap-1.5`,style:{height:ne},children:[(0,$.jsx)(at,{text:e.message,query:S,className:`text-foreground min-w-0 flex-1 truncate text-xs leading-tight font-medium`}),(0,$.jsx)(Ai,{unpushed:y,unpulled:b,shortHash:e.shortHash,className:`ml-auto`})]})]}),(0,$.jsx)(Or,{time:ee,timeClassName:`text-muted-foreground text-[10px]`,open:D,className:`min-w-12 self-center`,children:(0,$.jsx)(Fn,{hash:e.hash,shortHash:e.shortHash,githubUrl:L,effectiveThreadId:c,projectModeId:l,localBranches:F,targetBranches:I,rebaseEvents:h,onSelectRebaseEvent:g,onAfterAction:u,onOpenChange:O,triggerClassName:`text-muted-foreground hover:text-foreground`})})]})})}function Oi({event:e,onClose:t}){let{t:n}=H();return(0,$.jsx)(Ze,{open:!!e,onOpenChange:e=>!e&&t(),children:(0,$.jsx)(Vt,{className:`max-h-[80vh] max-w-2xl overflow-hidden p-0`,"data-testid":`rebase-event-dialog`,children:e&&(()=>{let t=e.commitPairs??[],r=t.length||e.commitHashes.length;return(0,$.jsxs)(`div`,{className:`flex max-h-[80vh] min-h-0 flex-col`,children:[(0,$.jsxs)(`div`,{className:`border-sidebar-border border-b px-4 py-3`,children:[(0,$.jsx)(We,{className:`text-sm leading-tight font-semibold`,children:n(`graph.rebaseDetailsTitle`,`Rebase details`)}),(0,$.jsx)(tt,{className:`text-muted-foreground mt-1 text-xs`,children:e.completed?n(`graph.rebaseDetailsDescription`,{count:r,defaultValue:`${r} commits replayed from local reflog`}):n(`graph.rebaseDetailsIncomplete`,`Partial rebase details from local reflog`)})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto px-4 py-3 text-xs`,children:[(0,$.jsxs)(`dl`,{className:`grid grid-cols-[96px_minmax(0,1fr)] gap-x-3 gap-y-2`,children:[(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseBranch`,`Branch`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.branch??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseOnto`,`Onto`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.onto??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseStarted`,`Started`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.startedAt??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseFinished`,`Finished`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.finishedAt??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseBefore`,`Before`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.startShortHash??`-`}),(0,$.jsx)(`dt`,{className:`text-muted-foreground`,children:n(`graph.rebaseAfter`,`After`)}),(0,$.jsx)(`dd`,{className:`font-mono`,children:e.finishShortHash??`-`})]}),t.length>0&&(0,$.jsxs)(`div`,{className:`border-sidebar-border mt-4 border-t pt-3`,children:[(0,$.jsx)(`div`,{className:`text-muted-foreground mb-2 text-[10px] font-medium uppercase`,children:n(`graph.rebaseCommitPairs`,`Rewritten commits`)}),(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.map(e=>(0,$.jsxs)(`div`,{className:`bg-muted/40 grid grid-cols-[80px_16px_80px_minmax(0,1fr)] items-center gap-2 rounded px-2 py-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.originalShortHash}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,$.jsx)(`span`,{className:`font-mono`,children:e.rebasedShortHash}),(0,$.jsx)(`span`,{className:`truncate`,children:e.subject})]},`${e.originalHash}:${e.rebasedHash}`))})]}),(0,$.jsxs)(`div`,{className:`border-sidebar-border mt-4 border-t pt-3`,children:[(0,$.jsx)(`div`,{className:`text-muted-foreground mb-2 text-[10px] font-medium uppercase`,children:n(`graph.rebaseSteps`,`Reflog steps`)}),(0,$.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:e.steps.map(e=>(0,$.jsxs)(`div`,{className:`bg-muted/40 grid grid-cols-[72px_88px_minmax(0,1fr)] gap-2 rounded px-2 py-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:e.shortHash}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:e.action}),(0,$.jsx)(`span`,{className:`truncate`,children:e.message})]},`${e.selector}:${e.action}:${e.hash}`))})]})]})]})})()})})}function ki({relativeDate:e}){return(0,$.jsx)(`span`,{children:Et(e)})}function Ai({unpushed:e,unpulled:t=!1,shortHash:n,className:r}){let{t:i}=H();return!e&&!t?null:(0,$.jsxs)(`span`,{className:q(`inline-flex shrink-0 items-center gap-1`,r),children:[e&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`span`,{"aria-label":i(`history.unpushed`,`Not pushed`),className:`inline-flex shrink-0`,"data-testid":`graph-unpushed-${n}`,children:(0,$.jsx)(xe,{className:`icon-sm text-primary [&_path]:stroke-primary-foreground [&_circle]:fill-current`,"data-testid":`graph-unpushed-icon-${n}`,strokeWidth:3})})}),(0,$.jsx)(W,{side:`top`,children:i(`history.unpushed`,`Not pushed`)})]}),t&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`span`,{"aria-label":i(`history.unpulled`,`Not pulled`),className:`inline-flex shrink-0`,"data-testid":`graph-unpulled-${n}`,children:(0,$.jsx)(L,{className:`icon-sm text-primary [&_path]:stroke-primary-foreground [&_circle]:fill-current`,"data-testid":`graph-unpulled-icon-${n}`,strokeWidth:3})})}),(0,$.jsx)(W,{side:`top`,children:i(`history.unpulled`,`Not pulled`)})]})]})}function ji({count:e,className:t,...n}){return(0,$.jsx)(`span`,{className:q(`absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-blue-500 px-1 text-[10px] leading-none font-bold tabular-nums text-white`,t),"data-testid":n[`data-testid`],children:e})}function Mi({onPull:e,onFetch:n,pullInProgress:r,fetchInProgress:i,unpulledCommitCount:a,testIdPrefix:o}){let{t:s}=H();return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`icon-sm`,onClick:e,disabled:r,className:`text-muted-foreground relative`,"data-testid":`${o}-pull`,children:[(0,$.jsx)(l,{className:q(`icon-base`,r&&`animate-pulse`)}),a>0&&(0,$.jsx)(ji,{count:a})]})}),(0,$.jsx)(W,{side:`top`,children:a>0?s(`review.readyToPull`,{count:a,defaultValue:`${a} commit(s) to pull`}):s(`review.pull`,`Pull`)})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:n,disabled:i,className:`text-muted-foreground`,"data-testid":`${o}-fetch-origin`,children:(0,$.jsx)(t,{className:q(`icon-base`,i&&`animate-pulse`)})})}),(0,$.jsx)(W,{side:`top`,children:s(`review.fetchOrigin`,`Fetch from origin`)})]})]})}function Ni({onPush:e,pushInProgress:t,unpushedCommitCount:n,disabled:r,testIdPrefix:i}){let{t:a}=H();return(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`icon-sm`,onClick:e,disabled:r??(t||n===0),className:`text-muted-foreground relative`,"data-testid":`${i}-push`,children:[(0,$.jsx)(j,{className:q(`icon-base`,t&&`animate-pulse`)}),n>0&&(0,$.jsx)(ji,{count:n})]})}),(0,$.jsx)(W,{side:`top`,children:n>0?a(`review.readyToPush`,{count:n,defaultValue:`${n} commit(s) ready to push`}):a(`review.pushToOrigin`,`Push to origin`)})]})}var Pi=Be(`publish-repo-dialog`),Fi=/^(https?:\/\/|git:\/\/|ssh:\/\/|git@[^\s:]+:)/;function Ii({projectId:e,projectPath:t,open:n,onOpenChange:r,onSuccess:i}){let a=t.split(`/`).filter(Boolean).pop()??``,[o,s]=(0,Q.useState)(`github`),[c,l]=(0,Q.useState)(a),[d,f]=(0,Q.useState)(``),[p,h]=(0,Q.useState)(!0),[g,_]=(0,Q.useState)(`__personal__`),[v,y]=(0,Q.useState)([]),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(!1),[j,M]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(!n)return;s(`github`),l(a),f(``),h(!0),_(`__personal__`),T(null),O(``),M(null);let t=new AbortController;return x(!0),G.projectGetGhOrgs(e,t.signal).then(e=>{e.isOk()&&y(e.value.orgs)}).then(()=>x(!1),()=>x(!1)),()=>t.abort()},[n,e,a]);let N=(0,Q.useCallback)(async()=>{if(!c.trim())return;C(!0),T(null);let t=await G.projectPublish(e,{name:c.trim(),description:d.trim()||void 0,org:g===`__personal__`?void 0:g,private:p});if(C(!1),t.isErr()){let n=String(t.error?.message??t.error);Pi.warn(`publish.github.failed`,{projectId:e,error:n}),n.includes(`already exists`)?T(`Repository "${c}" already exists. Choose a different name.`):n.includes(`GitHub token`)?T(`GitHub token required. Set one in Settings > Profile.`):T(n);return}Pi.info(`publish.github.success`,{projectId:e}),i(t.value.repoUrl)},[e,c,d,g,p,i]),P=(0,Q.useCallback)(async()=>{let t=D.trim();if(!t)return;if(!Fi.test(t)){M(`URL must start with https://, ssh://, git:// or use the git@host:path form.`);return}A(!0),M(null);let n=await G.projectSetRemoteUrl(e,t);if(A(!1),n.isErr()){let t=String(n.error?.message??n.error);Pi.warn(`publish.remote.failed`,{projectId:e,error:t}),M(t);return}Pi.info(`publish.remote.success`,{projectId:e}),i(t)},[e,D,i]),F=Fi.test(D.trim());return(0,$.jsx)(Ze,{open:n,onOpenChange:r,children:(0,$.jsxs)(Vt,{className:`sm:max-w-[460px]`,"data-testid":`publish-repo-dialog`,children:[(0,$.jsxs)(_t,{children:[(0,$.jsx)(We,{children:`Publish Repository`}),(0,$.jsx)(tt,{children:`Create a new GitHub repository or attach this project to an existing remote.`})]}),(0,$.jsxs)(yn,{value:o,onValueChange:e=>s(e),children:[(0,$.jsxs)(vn,{className:`grid w-full grid-cols-2`,children:[(0,$.jsxs)(gn,{value:`github`,"data-testid":`publish-tab-github`,children:[(0,$.jsx)(kt,{className:`mr-1.5 size-3.5`}),`GitHub`]}),(0,$.jsxs)(gn,{value:`remote`,"data-testid":`publish-tab-remote`,children:[(0,$.jsx)(E,{className:`mr-1.5 size-3.5`}),`Remote URL`]})]}),(0,$.jsx)(_n,{value:`github`,className:`mt-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium`,children:`Owner`}),(0,$.jsxs)(Wt,{value:g,onValueChange:_,disabled:b||S,children:[(0,$.jsx)(Bt,{"data-testid":`publish-repo-owner`,children:(0,$.jsx)(Lt,{})}),(0,$.jsxs)(Tt,{children:[(0,$.jsx)(qt,{value:`__personal__`,children:`Personal account`}),v.map(e=>(0,$.jsx)(qt,{value:e,children:e},e))]})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium`,children:`Repository name`}),(0,$.jsx)(sn,{"data-testid":`publish-repo-name`,value:c,onChange:e=>l(e.target.value),placeholder:`my-repo`,disabled:S,autoFocus:!0})]}),(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsxs)(`label`,{className:`text-sm font-medium`,children:[`Description `,(0,$.jsx)(`span`,{className:`text-muted-foreground font-normal`,children:`(optional)`})]}),(0,$.jsx)(sn,{"data-testid":`publish-repo-description`,value:d,onChange:e=>f(e.target.value),placeholder:`Short description`,disabled:S})]}),(0,$.jsxs)(`div`,{className:q(`flex items-center justify-between rounded-md border px-3 py-2.5`,`bg-muted/30`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p?(0,$.jsx)(u,{className:`text-muted-foreground size-4`}):(0,$.jsx)(de,{className:`text-muted-foreground size-4`}),(0,$.jsx)(`span`,{className:`text-sm`,children:p?`Private`:`Public`})]}),(0,$.jsx)(zt,{"data-testid":`publish-repo-private`,checked:p,onCheckedChange:h,disabled:S})]}),w&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`publish-repo-error`,children:w})]})}),(0,$.jsx)(_n,{value:`remote`,className:`mt-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,$.jsx)(`label`,{className:`text-sm font-medium`,children:`Remote URL`}),(0,$.jsx)(sn,{"data-testid":`publish-remote-url`,value:D,onChange:e=>O(e.target.value),placeholder:`https://github.com/user/repo.git`,disabled:k,autoFocus:!0}),(0,$.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Sets `,(0,$.jsx)(`code`,{className:`text-foreground`,children:`origin`}),` on this project. The remote must already exist; create the empty repository on your provider first, then push from the toolbar.`]})]}),j&&(0,$.jsx)(`p`,{className:`text-destructive text-sm`,"data-testid":`publish-remote-error`,children:j})]})})]}),(0,$.jsxs)(yt,{children:[(0,$.jsx)(Y,{variant:`outline`,onClick:()=>r(!1),disabled:S||k,"data-testid":`publish-repo-cancel`,children:`Cancel`}),o===`github`?(0,$.jsxs)(Y,{onClick:N,disabled:S||!c.trim(),"data-testid":`publish-repo-submit`,children:[S&&(0,$.jsx)(m,{className:`icon-base mr-2 animate-spin`}),`Publish repository`]}):(0,$.jsxs)(Y,{onClick:P,disabled:k||!F,"data-testid":`publish-remote-submit`,children:[k&&(0,$.jsx)(m,{className:`icon-base mr-2 animate-spin`}),`Save remote`]})]})]})})}function Li({open:e,onOpenChange:t,errorMessage:n,onChoose:r}){let{t:i}=H(),[a,o]=(0,Q.useState)(`rebase`);return(0,Q.useEffect)(()=>{e&&o(`rebase`)},[e]),(0,$.jsx)(Ze,{open:e,onOpenChange:t,children:(0,$.jsxs)(Vt,{"data-testid":`pull-strategy-dialog`,children:[(0,$.jsxs)(_t,{children:[(0,$.jsx)(We,{children:i(`review.pullStrategy.title`,`Branches have diverged`)}),(0,$.jsx)(tt,{children:i(`review.pullStrategy.description`,`Your local branch and the remote both have commits the other doesn’t. Choose how to reconcile them.`)})]}),(0,$.jsx)(`div`,{className:`bg-muted/30 text-muted-foreground rounded-md border p-3 font-mono text-xs`,children:n}),(0,$.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,$.jsxs)(`button`,{type:`button`,"data-testid":`pull-strategy-rebase`,onClick:()=>o(`rebase`),className:q(`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors`,a===`rebase`?`border-primary bg-primary/10`:`border-border hover:bg-accent/50`),children:[(0,$.jsx)(O,{className:`icon-base mt-0.5 shrink-0`}),(0,$.jsxs)(`span`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`text-foreground text-sm font-medium`,children:i(`review.pullStrategy.rebase`,`Rebase`)}),(0,$.jsx)(`span`,{className:`text-muted-foreground mt-1.5 text-xs`,children:i(`review.pullStrategy.rebaseHint`,`Replay your local commits on top of the remote (linear history).`)})]})]}),(0,$.jsxs)(`button`,{type:`button`,"data-testid":`pull-strategy-merge`,onClick:()=>o(`merge`),className:q(`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors`,a===`merge`?`border-primary bg-primary/10`:`border-border hover:bg-accent/50`),children:[(0,$.jsx)(B,{className:`icon-base mt-0.5 shrink-0`}),(0,$.jsxs)(`span`,{className:`flex flex-col`,children:[(0,$.jsx)(`span`,{className:`text-foreground text-sm font-medium`,children:i(`review.pullStrategy.merge`,`Merge`)}),(0,$.jsx)(`span`,{className:`text-muted-foreground mt-1.5 text-xs`,children:i(`review.pullStrategy.mergeHint`,`Create a merge commit that joins both histories.`)})]})]})]}),(0,$.jsxs)(yt,{children:[(0,$.jsx)(Y,{type:`button`,variant:`outline`,onClick:()=>t(!1),"data-testid":`pull-strategy-cancel`,children:i(`common.cancel`,`Cancel`)}),(0,$.jsx)(Y,{type:`button`,onClick:()=>r(a),"data-testid":`pull-strategy-confirm`,children:i(`common.confirm`,`Confirm`)})]})]})})}function Ri(e){let t=e.toLowerCase();return t.includes(`not possible to fast-forward`)||t.includes(`can't be fast-forwarded`)||t.includes(`diverging branches`)||t.includes(`non-fast-forward`)}function zi(e,t){let n=[`Fix GitHub issue #${e.number}: ${e.title}`,`URL: https://github.com/${t.owner}/${t.repo}/issues/${e.number}`];return e.labels.length>0&&n.push(``,`Labels: ${e.labels.map(e=>e.name).join(`, `)}`),n.join(`
|
|
3
3
|
`)}var Bi=Be(`issues-tab`);function Vi(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24)return`${r}h`;let i=Math.floor(r/24);return i<30?`${i}d`:`${Math.floor(i/30)}mo`}function Hi({visible:e}){let{t}=H(),n=Ye(e=>e.selectedProjectId),r=ft()??n,i=$t(e=>e.startNewThreadFromIssue),[a,o]=(0,Q.useState)([]),[s,c]=(0,Q.useState)(`open`),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,h]=(0,Q.useState)(1),[g,v]=(0,Q.useState)(!1),[y,x]=(0,Q.useState)(null),S=(0,Q.useRef)(!1),C=(0,Q.useCallback)(async(e,n)=>{if(!r)return;u(!0),f(null);let i=await G.githubIssuesEnriched(r,{state:s,page:e,per_page:30});if(i.isOk()){let e=i.value;o(t=>n?[...t,...e.issues]:e.issues),v(e.hasMore),x({owner:e.owner,repo:e.repo})}else Bi.error(`failed to load issues`,{projectId:r,state:s,error:i.error.message}),f(i.error.message||t(`issues.error`,`Failed to load issues`));u(!1)},[r,s,t]);(0,Q.useEffect)(()=>{!e||!r||(S.current=!0,h(1),o([]),C(1,!1))},[e,r,s,C]);let w=()=>{let e=p+1;h(e),C(e,!0)},T=()=>{h(1),C(1,!1)},E=(0,Q.useCallback)(e=>{!r||!y||i(r,{prompt:zi(e,y),branchName:e.suggestedBranchName,title:e.title})},[r,y,i]),D=e=>e===`open`?t(`issues.open`,`Open`):t(`issues.closed`,`Closed`);return r?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`issues-tab`,children:[(0,$.jsxs)(`div`,{className:`border-sidebar-border flex items-center gap-1 border-b px-2 py-1`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:T,disabled:l,className:`text-muted-foreground shrink-0`,"data-testid":`issues-refresh`,children:(0,$.jsx)(k,{className:q(`icon-base`,l&&`animate-spin`)})})}),(0,$.jsx)(W,{side:`bottom`,children:t(`common.refresh`,`Refresh`)})]}),(0,$.jsxs)(Wt,{value:s,onValueChange:e=>c(e),children:[(0,$.jsxs)(Bt,{size:`xs`,className:`w-auto gap-1`,"data-testid":`issues-state-trigger`,children:[(0,$.jsx)(_e,{className:`icon-xs opacity-70`}),(0,$.jsx)(`span`,{children:D(s)})]}),(0,$.jsx)(Tt,{children:[`open`,`closed`].map(e=>(0,$.jsx)(qt,{value:e,className:`text-xs`,"data-testid":`issues-filter-${e}`,children:D(e)},e))})]}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`}),y&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,asChild:!0,className:`text-muted-foreground shrink-0`,"data-testid":`issues-open-github`,children:(0,$.jsx)(`a`,{href:`https://github.com/${y.owner}/${y.repo}/issues`,target:`_blank`,rel:`noopener noreferrer`,children:(0,$.jsx)(ke,{className:`icon-base`})})})}),(0,$.jsx)(W,{side:`bottom`,children:t(`issues.viewOnGithub`,`View on GitHub`)})]})]}),l&&a.length===0?(0,$.jsx)(dn,{fill:!0,testId:`issues-loading`,label:t(`review.issues.loading`,`Loading issues…`)}):d?(0,$.jsxs)(`div`,{className:`text-muted-foreground flex flex-1 flex-col items-center justify-center px-4 py-12 text-center text-sm`,children:[(0,$.jsx)(`p`,{children:t(`issues.error`,`Failed to load issues`)}),(0,$.jsx)(`p`,{className:`mt-1 text-xs`,children:d})]}):a.length===0?(0,$.jsx)(Er,{icon:_e,title:s===`open`?t(`review.issues.noOpenIssues`,`No open issues`):t(`review.issues.noClosedIssues`,`No closed issues`)}):(0,$.jsxs)(jt,{className:`min-h-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`divide-sidebar-border divide-y`,children:a.map(e=>(0,$.jsxs)(`div`,{className:`group hover:bg-sidebar-accent/50 flex items-start gap-2 px-3 py-2 transition-colors`,"data-testid":`issue-item-${e.number}`,children:[e.state===`open`?(0,$.jsx)(_e,{className:`icon-base mt-0.5 shrink-0 text-green-500`}):(0,$.jsx)(V,{className:`icon-base mt-0.5 shrink-0 text-purple-500`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`flex items-baseline gap-1.5`,children:(0,$.jsx)(`a`,{href:e.html_url,target:`_blank`,rel:`noopener noreferrer`,className:`hover:text-primary line-clamp-2 text-xs leading-tight font-medium transition-colors`,children:e.title})}),e.body?(0,$.jsx)(`p`,{className:`text-muted-foreground mt-1 line-clamp-3 text-[10px] whitespace-pre-wrap`,"data-testid":`issue-body-${e.number}`,children:e.body}):null,(0,$.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-1.5`,children:[(0,$.jsxs)(`span`,{className:`text-muted-foreground text-[10px]`,children:[`#`,e.number]}),e.labels.map(e=>(0,$.jsx)(St,{variant:`outline`,className:`h-3.5 px-1 text-[9px] leading-none`,style:{borderColor:`#${e.color}`,color:`#${e.color}`},children:e.name},e.name)),e.linkedBranch&&(0,$.jsxs)(St,{variant:`outline`,className:`h-3.5 gap-0.5 border-emerald-500/30 px-1 text-[9px] leading-none text-emerald-500`,children:[(0,$.jsx)(me,{className:`size-2.5`}),(0,$.jsx)(`span`,{className:`max-w-[100px] truncate`,children:e.linkedBranch})]}),e.linkedPR&&(0,$.jsx)(Tr,{prNumber:e.linkedPR.number,prState:e.linkedPR.state===`merged`?`MERGED`:e.linkedPR.state===`closed`?`CLOSED`:`OPEN`,prUrl:e.linkedPR.url,size:`xxs`}),(0,$.jsx)(`span`,{className:`text-muted-foreground text-[10px]`,children:Vi(e.created_at)}),e.user&&(0,$.jsx)(`span`,{className:`text-muted-foreground text-[10px]`,children:e.user.login}),e.comments>0&&(0,$.jsxs)(`span`,{className:`text-muted-foreground flex items-center gap-0.5 text-[10px]`,children:[(0,$.jsx)(_,{className:`icon-xs`}),e.comments]})]})]}),!e.linkedBranch&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`sm`,className:`size-6 shrink-0 p-0 opacity-0 transition-opacity group-hover:opacity-100`,onClick:()=>E(e),"data-testid":`issue-create-thread-${e.number}`,children:(0,$.jsx)(b,{className:`size-3.5`})})}),(0,$.jsx)(W,{side:`left`,children:(0,$.jsx)(`p`,{children:t(`issues.createThread`,`Create thread`)})})]})]},e.number))}),g&&(0,$.jsx)(`div`,{className:`border-sidebar-border flex justify-center border-t py-2`,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:w,disabled:l,className:`text-xs`,"data-testid":`issues-load-more`,children:[l?(0,$.jsx)(m,{className:`icon-xs mr-1 animate-spin`}):null,t(`issues.loadMore`,`Load more`)]})})]})]}):(0,$.jsx)(Er,{icon:_e,title:t(`review.issues.noProject`,`Select a project to view issues`)})}var Ui={sort:`newest`,labels:[],authors:[],assignees:[],reviewers:[]};function Wi(e){return e.labels.length>0||e.authors.length>0||e.assignees.length>0||e.reviewers.length>0}var Gi=[`newest`,`oldest`,`recently-updated`,`least-recently-updated`,`most-commented`],Ki=[`open`,`closed`,`all`];function qi({icon:e,label:t,options:n,selected:r,onChange:i,searchPlaceholder:a,emptyText:o,disabled:s,testId:c}){let l=e=>{i(r.includes(e)?r.filter(t=>t!==e):[...r,e])},u=r.length>0;return(0,$.jsxs)(Ge,{children:[(0,$.jsx)(it,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,disabled:s,"data-testid":c,className:q(`inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs whitespace-nowrap transition-colors disabled:opacity-50`,u?`bg-accent text-accent-foreground border-accent-foreground/20`:`border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground bg-transparent`),children:[e,(0,$.jsx)(`span`,{children:t}),u&&(0,$.jsx)(`span`,{className:`bg-primary text-primary-foreground ml-0.5 rounded-full px-1 text-[9px] leading-4 font-semibold`,children:r.length}),(0,$.jsx)(M,{className:`icon-xs opacity-50`})]})}),(0,$.jsx)(Mt,{align:`start`,className:`w-[240px] p-0`,children:(0,$.jsxs)(bt,{filter:(e,t)=>+!!e.toLowerCase().includes(t.toLowerCase()),children:[(0,$.jsx)(Kt,{placeholder:a,className:`h-9 text-xs`,"data-testid":`${c}-search`}),(0,$.jsxs)(Ht,{children:[(0,$.jsx)(He,{children:o}),(0,$.jsx)(Ot,{children:n.map(e=>{let t=r.includes(e.value);return(0,$.jsxs)(Rt,{value:e.label,onSelect:()=>l(e.value),className:`text-xs`,"data-testid":`${c}-option-${e.value}`,children:[(0,$.jsx)(`span`,{className:q(`flex h-3.5 w-3.5 items-center justify-center rounded-sm border`,t?`bg-primary border-primary text-primary-foreground`:`border-muted-foreground/30`),children:t&&(0,$.jsx)(De,{className:`icon-2xs`})}),e.color!==void 0&&(0,$.jsx)(`span`,{className:`size-2.5 shrink-0 rounded-full`,style:{backgroundColor:`#${e.color}`}}),e.avatarUrl&&(0,$.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`size-3.5 shrink-0 rounded-full`}),(0,$.jsx)(`span`,{className:`flex-1 truncate`,children:e.label})]},e.value)})})]})]})})]})}function Ji({value:e,onChange:t,options:n,optionsLoading:i,state:a,onStateChange:o,showState:c=!0,showBorder:l=!0,className:u}){let{t:d}=H(),f=e=>({open:d(`review.pullRequests.open`,`Open`),closed:d(`review.pullRequests.closed`,`Closed`),all:d(`review.pullRequests.all`,`All`)})[e],m=e=>({newest:d(`review.pullRequests.sort.newest`,`Newest`),oldest:d(`review.pullRequests.sort.oldest`,`Oldest`),"recently-updated":d(`review.pullRequests.sort.recentlyUpdated`,`Recently updated`),"least-recently-updated":d(`review.pullRequests.sort.leastRecentlyUpdated`,`Least recently updated`),"most-commented":d(`review.pullRequests.sort.mostCommented`,`Most commented`)})[e],h=(n?.labels??[]).map(e=>({value:e.name,label:e.name,color:e.color})),g=(n?.users??[]).map(e=>({value:e.login,label:e.login,avatarUrl:e.avatar_url})),_=i||g.length===0,v=Wi(e);return(0,$.jsxs)(`div`,{className:q(`flex flex-wrap items-center gap-1.5`,l&&`border-sidebar-border border-b px-2 py-1.5`,u),"data-testid":`prs-filter-bar`,children:[c&&(0,$.jsxs)(Wt,{value:a,onValueChange:e=>o(e),children:[(0,$.jsxs)(Bt,{size:`xs`,className:`w-auto gap-1`,"data-testid":`prs-state-trigger`,children:[(0,$.jsx)(_e,{className:`icon-xs opacity-70`}),(0,$.jsx)(`span`,{children:f(a)})]}),(0,$.jsx)(Tt,{children:Ki.map(e=>(0,$.jsx)(qt,{value:e,className:`text-xs`,"data-testid":`prs-filter-${e}`,children:f(e)},e))})]}),(0,$.jsxs)(Wt,{value:e.sort,onValueChange:n=>t({...e,sort:n}),children:[(0,$.jsxs)(Bt,{size:`xs`,className:`w-auto gap-1`,"data-testid":`prs-sort-trigger`,children:[(0,$.jsx)(r,{className:`icon-xs opacity-70`}),(0,$.jsx)(`span`,{children:m(e.sort)})]}),(0,$.jsx)(Tt,{children:Gi.map(e=>(0,$.jsx)(qt,{value:e,className:`text-xs`,"data-testid":`prs-sort-${e}`,children:m(e)},e))})]}),(0,$.jsx)(qi,{icon:(0,$.jsx)(s,{className:`icon-xs opacity-70`}),label:d(`review.pullRequests.filter.labels`,`Labels`),options:h,selected:e.labels,onChange:n=>t({...e,labels:n}),searchPlaceholder:d(`review.pullRequests.filter.searchLabels`,`Search labels…`),emptyText:d(`review.pullRequests.filter.noLabels`,`No labels`),disabled:i||h.length===0,testId:`prs-filter-labels`}),(0,$.jsx)(qi,{icon:(0,$.jsx)(pe,{className:`icon-xs opacity-70`}),label:d(`review.pullRequests.filter.author`,`Author`),options:g,selected:e.authors,onChange:n=>t({...e,authors:n}),searchPlaceholder:d(`review.pullRequests.filter.searchUsers`,`Search users…`),emptyText:d(`review.pullRequests.filter.noUsers`,`No users`),disabled:_,testId:`prs-filter-author`}),(0,$.jsx)(qi,{icon:(0,$.jsx)(ie,{className:`icon-xs opacity-70`}),label:d(`review.pullRequests.filter.assignee`,`Assignee`),options:g,selected:e.assignees,onChange:n=>t({...e,assignees:n}),searchPlaceholder:d(`review.pullRequests.filter.searchUsers`,`Search users…`),emptyText:d(`review.pullRequests.filter.noUsers`,`No users`),disabled:_,testId:`prs-filter-assignee`}),(0,$.jsx)(qi,{icon:(0,$.jsx)(p,{className:`icon-xs opacity-70`}),label:d(`review.pullRequests.filter.reviewer`,`Reviewer`),options:g,selected:e.reviewers,onChange:n=>t({...e,reviewers:n}),searchPlaceholder:d(`review.pullRequests.filter.searchUsers`,`Search users…`),emptyText:d(`review.pullRequests.filter.noUsers`,`No users`),disabled:_,testId:`prs-filter-reviewer`}),v&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t({...e,labels:[],authors:[],assignees:[],reviewers:[]}),className:`text-muted-foreground hover:text-foreground inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-xs transition-colors`,"data-testid":`prs-filter-clear`,children:[(0,$.jsx)(ce,{className:`icon-xs`}),d(`review.pullRequests.filter.clear`,`Clear`)]})]})}var Yi=Be(`pinned-pr-card`),Xi=(0,Q.lazy)(()=>je(async()=>{let{default:e}=await import(`./markdown-DBtwZWLP.js`).then(e=>e.n);return{default:e}},__vite__mapDeps([0,1,2])).then(({default:e})=>({default:function({content:t}){return(0,$.jsx)(e,{remarkPlugins:xn,components:Sn,children:t})}})));function Zi(e){if(!e)return``;let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}var Qi={"+1":`👍`,"-1":`👎`,laugh:`😄`,hooray:`🎉`,confused:`😕`,heart:`❤️`,rocket:`🚀`,eyes:`👀`},$i=[`+1`,`-1`,`laugh`,`hooray`,`confused`,`heart`,`rocket`,`eyes`];function ea(e){return e?.total??0}function ta(e){return e?[{key:`+1`,count:e.plus1},{key:`-1`,count:e.minus1},{key:`laugh`,count:e.laugh},{key:`hooray`,count:e.hooray},{key:`confused`,count:e.confused},{key:`heart`,count:e.heart},{key:`rocket`,count:e.rocket},{key:`eyes`,count:e.eyes}].filter(e=>e.count>0):[]}function na({reactions:e,onReact:t,disabled:r,testIdBase:i}){let[a,o]=(0,Q.useState)(!1);return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[ta(e).map(({key:e,count:n})=>(0,$.jsxs)(Y,{variant:`outline`,size:`xs`,className:`h-5 gap-1 px-1.5 text-[10px]`,disabled:r,onClick:()=>t(e),"data-testid":`${i}-reaction-${e}`,children:[(0,$.jsx)(`span`,{children:Qi[e]}),(0,$.jsx)(`span`,{children:n})]},e)),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,className:`text-muted-foreground`,disabled:r,onClick:()=>o(e=>!e),"data-testid":`${i}-react-open`,children:(0,$.jsx)(n,{className:`icon-xs`})})}),(0,$.jsx)(W,{side:`top`,children:`Add reaction`})]}),a&&(0,$.jsx)(`div`,{className:`border-border bg-popover absolute top-full left-0 z-10 mt-1 flex gap-0.5 rounded-md border p-1 shadow-md`,"data-testid":`${i}-react-picker`,children:$i.map(e=>(0,$.jsx)(`button`,{className:`hover:bg-accent rounded px-1 text-sm`,onClick:()=>{t(e),o(!1)},"data-testid":`${i}-react-${e}`,children:Qi[e]},e))})]})]})}function ra({body:e}){let t=(e??``).trim();return t?(0,$.jsx)(`div`,{className:bn,children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap`,children:t}),children:(0,$.jsx)(Xi,{content:t})})}):(0,$.jsx)(`span`,{className:`text-muted-foreground italic`,children:`(empty)`})}function ia({initial:e,onCancel:t,onSave:n,saving:r,testId:i}){let[a,o]=(0,Q.useState)(e);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`textarea`,{className:`border-border bg-background focus:ring-ring w-full rounded-md border p-2 text-xs focus:ring-1 focus:outline-hidden`,rows:3,value:a,onChange:e=>o(e.target.value),"data-testid":`${i}-textarea`}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1.5`,children:[(0,$.jsx)(Y,{variant:`ghost`,size:`xs`,onClick:t,"data-testid":`${i}-cancel`,children:`Cancel`}),(0,$.jsx)(Y,{size:`xs`,onClick:()=>n(a),disabled:r||a.trim()===e.trim()||!a.trim(),"data-testid":`${i}-save`,children:r?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):`Save`})]})]})}function aa({pr:e,projectId:t,currentUserLogin:n,onMerged:r}){let{t:i}=H(),[a,o]=(0,Q.useState)([]),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!0),[f,p]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(!1),[j,N]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[L,ee]=(0,Q.useState)(null),[te,ne]=(0,Q.useState)(null),re=(0,Q.useCallback)(async()=>{u(!0),p(null);let[n,r]=await Promise.all([G.githubPRThreads(t,e.number),G.githubPRConversation(t,e.number)]);n.isOk()&&o(n.value.threads),r.isOk()&&c(r.value),(n.isErr()||r.isErr())&&p(n.isErr()?n.error.message:r.isErr()?r.error.message:`Failed to load PR data`),u(!1)},[t,e.number]);(0,Q.useEffect)(()=>{re()},[re]);let ie=async n=>{g(!0),p(null);let a=await G.githubPRMerge(t,e.number,n);if(a.isOk()&&a.value.merged)y(!0),r?.(e.number);else{let t=a.isErr()?a.error.message:i(`review.pullRequests.mergeFailed`,`Failed to merge pull request`);Yi.error(`pr_merge_failed`,{error:t,prNumber:e.number,method:n}),p(t)}g(!1)},R=async()=>{let n=D.trim();if(!n)return;A(!0);let r=await G.githubPRCommentCreate(t,e.number,n);r.isOk()?(c(e=>e?{...e,comments:[...e.comments,r.value]}:{comments:[r.value],reviews:[]}),O(``)):(Yi.error(`pr_comment_create_failed`,{error:r.error.message,prNumber:e.number}),p(r.error.message)),A(!1)},ae=async n=>{let r=S.trim();if(!r)return;let i=n.comments[0]?.id;if(!i)return;E(!0);let a=await G.githubPRReviewReply(t,e.number,i,r);a.isOk()?(o(e=>e.map(e=>e.id===n.id?{...e,comments:[...e.comments,a.value]}:e)),C(``),x(null)):(Yi.error(`pr_review_reply_failed`,{error:a.error.message}),p(a.error.message)),E(!1)},oe=async e=>{if(!e.node_id)return;ne(e.node_id);let n=await G.githubPRThreadResolve(t,e.node_id,!e.is_resolved);n.isOk()?o(t=>t.map(t=>t.node_id===e.node_id?{...t,is_resolved:n.value.is_resolved}:t)):(Yi.error(`pr_thread_resolve_failed`,{error:n.error.message}),p(n.error.message)),ne(null)},se=async(e,n,r)=>{let i=await G.githubPRReaction(t,e,n,r);i.isOk()?e===`issue`&&c(e=>e&&{...e,comments:e.comments.map(e=>e.id===n?{...e,reactions:oa(e.reactions,r)}:e)}):Yi.error(`pr_reaction_failed`,{error:i.error.message})},le=async(e,n,r,i)=>{I(i);let a=await G.githubPRCommentEdit(t,e,n,r);a.isOk()?(e===`issue`?c(e=>e&&{...e,comments:e.comments.map(e=>e.id===n?{...e,body:a.value.body,updated_at:a.value.updated_at,reactions:a.value.reactions}:e)}):o(e=>e.map(e=>({...e,comments:e.comments.map(e=>e.id===n?{...e,body:a.value.body,updated_at:a.value.updated_at}:e)}))),N(null)):(Yi.error(`pr_comment_edit_failed`,{error:a.error.message}),p(a.error.message)),I(null)},z=async(e,n,r)=>{if(!confirm(i(`review.pullRequests.confirmDelete`,`Delete this comment?`)))return;ee(r);let a=await G.githubPRCommentDelete(t,e,n);a.isOk()?e===`issue`?c(e=>e&&{...e,comments:e.comments.filter(e=>e.id!==n)}):o(e=>e.map(e=>({...e,comments:e.comments.filter(e=>e.id!==n)})).filter(e=>e.comments.length>0)):(Yi.error(`pr_comment_delete_failed`,{error:a.error.message}),p(a.error.message)),ee(null)},ue=e=>!!n&&e.toLowerCase()===n.toLowerCase(),de=(e,t,n)=>{let r=`review-${t.id}`,i=j===r;return(0,$.jsxs)(`div`,{className:q(`flex flex-col gap-1`,!n&&`pl-3`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,$.jsx)(mr,{name:t.author,avatarUrl:t.author_avatar_url,size:`xs`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Zi(t.created_at)}),t.author_association&&t.author_association!==`NONE`&&(0,$.jsx)(St,{variant:`outline`,className:`h-3.5 px-1 text-[9px]`,children:t.author_association}),(0,$.jsx)(`div`,{className:`flex-1`}),ue(t.author)&&!i&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>N(r),"data-testid":`pinned-pr-review-edit-${t.id}`,children:(0,$.jsx)(fe,{className:`icon-xs`})})}),(0,$.jsx)(W,{side:`top`,children:`Edit`})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,disabled:L===r,onClick:()=>z(`review`,t.id,r),"data-testid":`pinned-pr-review-delete-${t.id}`,children:L===r?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):(0,$.jsx)(P,{className:`icon-xs`})})}),(0,$.jsx)(W,{side:`top`,children:`Delete`})]})]})]}),i?(0,$.jsx)(ia,{initial:t.body,saving:F===r,onCancel:()=>N(null),onSave:e=>le(`review`,t.id,e,r),testId:`pinned-pr-review-edit-form-${t.id}`}):(0,$.jsx)(ra,{body:t.body})]},t.id)},pe=e=>{let t=`issue-${e.id}`,n=j===t;return(0,$.jsxs)(`div`,{className:`border-border bg-background flex flex-col gap-1.5 rounded-md border p-2`,"data-testid":`pinned-pr-comment-${e.id}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,$.jsx)(mr,{name:e.author,avatarUrl:e.author_avatar_url,size:`xs`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Zi(e.created_at)}),e.author_association&&e.author_association!==`NONE`&&(0,$.jsx)(St,{variant:`outline`,className:`h-3.5 px-1 text-[9px]`,children:e.author_association}),(0,$.jsx)(`div`,{className:`flex-1`}),ue(e.author)&&!n&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>N(t),"data-testid":`pinned-pr-comment-edit-${e.id}`,children:(0,$.jsx)(fe,{className:`icon-xs`})})}),(0,$.jsx)(W,{side:`top`,children:`Edit`})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,disabled:L===t,onClick:()=>z(`issue`,e.id,t),"data-testid":`pinned-pr-comment-delete-${e.id}`,children:L===t?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):(0,$.jsx)(P,{className:`icon-xs`})})}),(0,$.jsx)(W,{side:`top`,children:`Delete`})]})]})]}),n?(0,$.jsx)(ia,{initial:e.body,saving:F===t,onCancel:()=>N(null),onSave:n=>le(`issue`,e.id,n,t),testId:`pinned-pr-comment-edit-form-${e.id}`}):(0,$.jsx)(ra,{body:e.body}),(0,$.jsx)(na,{reactions:e.reactions,onReact:t=>se(`issue`,e.id,t),testIdBase:`pinned-pr-comment-${e.id}`})]},e.id)},me=e=>{let t={APPROVED:{label:`Approved`,cls:`text-green-600 border-green-600/40`},CHANGES_REQUESTED:{label:`Changes requested`,cls:`text-red-600 border-red-600/40`},COMMENTED:{label:`Commented`,cls:`text-muted-foreground`},DISMISSED:{label:`Dismissed`,cls:`text-muted-foreground`},PENDING:{label:`Pending`,cls:`text-muted-foreground`}}[e.state];return(0,$.jsxs)(`div`,{className:`border-border bg-background flex flex-col gap-1.5 rounded-md border p-2`,"data-testid":`pinned-pr-review-${e.id}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,$.jsx)(mr,{name:e.author,avatarUrl:e.author_avatar_url,size:`xs`}),(0,$.jsx)(St,{variant:`outline`,className:q(`h-3.5 px-1 text-[9px]`,t.cls),children:t.label}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Zi(e.submitted_at)})]}),e.body&&(0,$.jsx)(ra,{body:e.body})]},e.id)},he=(0,Q.useMemo)(()=>{let e=new Map;for(let t of a){let n=e.get(t.path)??[];n.push(t),e.set(t.path,n)}return e},[a]),ge=a.filter(e=>!e.is_resolved).length,ve=v||!!e.merged_at,ye=e.state===`open`&&!e.draft&&!ve,be=[{method:`squash`,label:i(`review.pullRequests.squashAndMerge`,`Squash and merge`),hint:i(`review.pullRequests.squashHint`,`Combine all commits into one`)},{method:`merge`,label:i(`review.pullRequests.createMergeCommit`,`Create a merge commit`),hint:i(`review.pullRequests.mergeHint`,`Keep all commits`)},{method:`rebase`,label:i(`review.pullRequests.rebaseAndMerge`,`Rebase and merge`),hint:i(`review.pullRequests.rebaseHint`,`Rebase commits onto the base`)}];return(0,$.jsxs)(`div`,{className:`border-sidebar-border bg-sidebar-accent/10 flex flex-col gap-3 border-b p-3`,"data-testid":`pinned-pr-card-${e.number}`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,$.jsx)(Tr,{prNumber:e.number,prState:ve?`MERGED`:e.state===`closed`?`CLOSED`:`OPEN`,prUrl:e.html_url,size:`xxs`,"data-testid":`pinned-pr-link-${e.number}`}),(0,$.jsx)(`span`,{className:`text-sm font-semibold`,children:e.title})]})}),ve&&(0,$.jsxs)(St,{variant:`outline`,className:`shrink-0 gap-1 border-purple-500/30 bg-purple-500/15 text-[10px] text-purple-400`,"data-testid":`pinned-pr-merged-badge-${e.number}`,children:[(0,$.jsx)(B,{className:`size-2.5`}),i(`review.pullRequests.merged`,`Merged`)]}),ye&&(0,$.jsxs)(Xe,{children:[(0,$.jsx)(Gt,{asChild:!0,children:(0,$.jsxs)(Y,{size:`xs`,className:`shrink-0 gap-1`,disabled:h,"data-testid":`pinned-pr-merge-${e.number}`,children:[h?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):(0,$.jsx)(B,{className:`icon-xs`}),i(`review.pullRequests.merge`,`Merge`),(0,$.jsx)(M,{className:`icon-xs`})]})}),(0,$.jsxs)(nt,{align:`end`,className:`w-56`,children:[(0,$.jsx)(vt,{children:i(`review.pullRequests.mergeMethod`,`Merge method`)}),(0,$.jsx)(xt,{}),be.map(({method:t,label:n,hint:r})=>(0,$.jsxs)(X,{onSelect:()=>ie(t),className:`flex flex-col items-start gap-0.5`,"data-testid":`pinned-pr-merge-${t}-${e.number}`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium`,children:n}),(0,$.jsx)(`span`,{className:`text-muted-foreground text-[10px]`,children:r})]},t))]})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,asChild:!0,className:`text-muted-foreground shrink-0`,"data-testid":`pinned-pr-open-github-${e.number}`,children:(0,$.jsx)(`a`,{href:e.html_url,target:`_blank`,rel:`noopener noreferrer`,children:(0,$.jsx)(ke,{className:`icon-xs`})})})}),(0,$.jsx)(W,{side:`top`,children:`Open on GitHub`})]})]}),e.body&&(0,$.jsx)(`div`,{className:`border-border bg-background rounded-md border p-2`,children:(0,$.jsx)(ra,{body:e.body})})]}),l&&(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 text-xs`,children:[(0,$.jsx)(m,{className:`icon-xs animate-spin`}),i(`review.pullRequests.loadingConversation`,`Loading conversation…`)]}),f&&(0,$.jsx)(`div`,{className:`border-destructive/40 bg-destructive/10 text-destructive rounded-md border p-2 text-xs`,children:f}),!l&&a.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 text-[10px] font-medium tracking-wide uppercase`,children:[(0,$.jsx)(_,{className:`size-3`}),(0,$.jsxs)(`span`,{children:[i(`review.pullRequests.reviewThreads`,`Review threads`),` (`,a.length,ge>0?` · ${ge} unresolved`:``,`)`]})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:Array.from(he.entries()).map(([e,t])=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`div`,{className:`text-muted-foreground truncate font-mono text-[10px]`,title:e,children:e}),t.map(e=>{let t=te===e.node_id;return(0,$.jsxs)(`div`,{className:q(`flex flex-col gap-2 rounded-md border p-2`,e.is_resolved?`border-border/40 bg-background/50 opacity-70`:`border-border bg-background`),"data-testid":`pinned-pr-thread-${e.id}`,children:[(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 text-[10px]`,children:[e.is_resolved?(0,$.jsx)(V,{className:`size-3 text-green-600`}):(0,$.jsx)(_e,{className:`size-3`}),(0,$.jsxs)(`span`,{children:[`Line `,e.line??e.original_line??`?`,e.is_outdated?` (outdated)`:``]}),(0,$.jsx)(`div`,{className:`flex-1`}),e.node_id&&(0,$.jsx)(Y,{variant:`ghost`,size:`xs`,className:`h-5 gap-1 px-1.5 text-[10px]`,disabled:t,onClick:()=>oe(e),"data-testid":`pinned-pr-thread-resolve-${e.id}`,children:t?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):e.is_resolved?`Unresolve`:`Resolve`})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.comments.map((t,n)=>de(e,t,n===0))}),b===e.id?(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 pl-3`,children:[(0,$.jsx)(`textarea`,{className:`border-border bg-background focus:ring-ring w-full rounded-md border p-2 text-xs focus:ring-1 focus:outline-hidden`,rows:2,value:S,onChange:e=>C(e.target.value),placeholder:`Reply…`,"data-testid":`pinned-pr-thread-reply-textarea-${e.id}`}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1.5`,children:[(0,$.jsx)(Y,{variant:`ghost`,size:`xs`,onClick:()=>{x(null),C(``)},"data-testid":`pinned-pr-thread-reply-cancel-${e.id}`,children:(0,$.jsx)(ce,{className:`icon-xs`})}),(0,$.jsx)(Y,{size:`xs`,disabled:!S.trim()||T,onClick:()=>ae(e),"data-testid":`pinned-pr-thread-reply-send-${e.id}`,children:T?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):(0,$.jsx)(Oe,{className:`icon-xs`})})]})]}):(0,$.jsx)(`div`,{className:`pl-3`,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`xs`,className:`h-5 gap-1 px-1.5 text-[10px]`,onClick:()=>{x(e.id),C(``)},"data-testid":`pinned-pr-thread-reply-open-${e.id}`,children:[(0,$.jsx)(d,{className:`icon-xs`}),`Reply`]})})]},e.id)})]},e))})]}),!l&&s&&s.reviews.length>0&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 text-[10px] font-medium tracking-wide uppercase`,children:[(0,$.jsx)(w,{className:`size-3`}),(0,$.jsxs)(`span`,{children:[i(`review.pullRequests.reviews`,`Reviews`),` (`,s.reviews.length,`)`]})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:s.reviews.map(me)})]}),!l&&s&&(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 text-[10px] font-medium tracking-wide uppercase`,children:[(0,$.jsx)(_,{className:`size-3`}),(0,$.jsxs)(`span`,{children:[i(`review.pullRequests.conversation`,`Conversation`),` (`,s.comments.length,`)`]})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:s.comments.map(pe)}),(0,$.jsxs)(`div`,{className:`border-border bg-background flex flex-col gap-1.5 rounded-md border p-2`,children:[(0,$.jsx)(`textarea`,{className:`border-border bg-background focus:ring-ring w-full rounded-md border p-2 text-xs focus:ring-1 focus:outline-hidden`,rows:3,value:D,onChange:e=>O(e.target.value),placeholder:i(`review.pullRequests.newCommentPlaceholder`,`Leave a comment…`),"data-testid":`pinned-pr-new-comment-textarea`}),(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(Y,{size:`xs`,disabled:!D.trim()||k,onClick:R,"data-testid":`pinned-pr-new-comment-send`,children:k?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Oe,{className:`icon-xs`}),i(`common.send`,`Send`)]})})})]})]}),!l&&a.length===0&&s&&s.comments.length===0&&(0,$.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:i(`review.pullRequests.noConversation`,`No conversation yet.`)})]})}function oa(e,t){let n={...e,total:ea(e)+1};switch(t){case`+1`:n.plus1+=1;break;case`-1`:n.minus1+=1;break;case`laugh`:n.laugh+=1;break;case`hooray`:n.hooray+=1;break;case`confused`:n.confused+=1;break;case`heart`:n.heart+=1;break;case`rocket`:n.rocket+=1;break;case`eyes`:n.eyes+=1;break}return n}var sa=3e4,ca=6;function la({check:e}){if(e.status!==`completed`)return(0,$.jsx)(m,{className:`icon-sm shrink-0 animate-spin text-yellow-500`});switch(e.conclusion){case`success`:case`neutral`:case`skipped`:return(0,$.jsx)(V,{className:`size-3.5 shrink-0 text-green-500`});case`failure`:case`timed_out`:case`action_required`:return(0,$.jsx)(N,{className:`size-3.5 shrink-0 text-red-500`});case`cancelled`:return(0,$.jsx)(le,{className:`text-muted-foreground size-3.5 shrink-0`});default:return(0,$.jsx)(be,{className:`size-3.5 shrink-0 text-yellow-500`})}}function ua({state:e,draft:t,merged:n}){return n?(0,$.jsxs)(St,{variant:`outline`,size:`xxs`,className:`gap-1 border-purple-500/30 bg-purple-500/15 text-purple-400`,children:[(0,$.jsx)(B,{className:`size-2.5`}),`Merged`]}):e===`closed`?(0,$.jsxs)(St,{variant:`outline`,size:`xxs`,className:`gap-1 border-red-500/30 bg-red-500/15 text-red-400`,children:[(0,$.jsx)(I,{className:`size-2.5`}),`Closed`]}):t?(0,$.jsxs)(St,{variant:`outline`,size:`xxs`,className:`border-muted-foreground/30 bg-muted text-muted-foreground gap-1`,children:[(0,$.jsx)(ge,{className:`size-2.5`}),`Draft`]}):(0,$.jsxs)(St,{variant:`outline`,size:`xxs`,className:`gap-1 border-green-500/30 bg-green-500/15 text-green-400`,children:[(0,$.jsx)(ge,{className:`size-2.5`}),`Open`]})}function da({decision:e}){if(!e)return null;switch(e){case`APPROVED`:return(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-green-400`,children:[(0,$.jsx)(V,{className:`size-3.5`}),` Approved`]});case`CHANGES_REQUESTED`:return(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-red-400`,children:[(0,$.jsx)(re,{className:`size-3.5`}),` Changes requested`]});case`REVIEW_REQUIRED`:return(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-yellow-400`,children:[(0,$.jsx)(be,{className:`size-3.5`}),` Review required`]});default:return null}}function fa({mergeable:e,merged:t}){if(t)return null;switch(e){case`mergeable`:return(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-green-400`,children:[(0,$.jsx)(B,{className:`size-3.5`}),` Ready to merge`]});case`conflicting`:return(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-[11px] text-red-400`,children:[(0,$.jsx)(re,{className:`size-3.5`}),` Merge conflicts`]});default:return null}}function pa({projectId:e,prNumber:t,prUrl:n,prState:r,visible:i}){let{detail:a,loadingDetail:o,rateLimited:s}=Cn(e,t),[c,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!i||!e||!t)return;let n=wn.getState();return n.fetchPRDetail(e,t),n.fetchPRThreads(e,t),u.current=setInterval(()=>{let n=wn.getState();n.rateLimited||(n.fetchPRDetail(e,t),n.fetchPRThreads(e,t))},sa),()=>{u.current&&clearInterval(u.current)}},[i,e,t]);let d=a?.checks?a.checks.toSorted((e,t)=>{let n=e=>e.status===`completed`?e.conclusion===`failure`||e.conclusion===`timed_out`||e.conclusion===`action_required`?0:e.conclusion===`success`||e.conclusion===`neutral`||e.conclusion===`skipped`?2:1:1;return n(e)-n(t)}):[],f=c?d:d.slice(0,ca),p=d.length>ca,h=d.length,g=!!a&&!a.merged&&(a.mergeable_state===`mergeable`||a.mergeable_state===`conflicting`);return(0,$.jsxs)(`div`,{className:`border-sidebar-border bg-muted/30 border-b px-3 py-2 text-xs`,"data-testid":`pr-summary-card`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 text-[11px] break-words`,children:[a?(0,$.jsx)(`span`,{className:`text-foreground font-medium`,"data-testid":`pr-summary-title`,children:a.title}):(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`Pull request`}),` `,(0,$.jsx)(Tr,{prNumber:t,prState:a?.merged?`MERGED`:a?.state===`closed`?`CLOSED`:r,prUrl:a?.html_url??n,size:`xxs`,className:`inline-flex align-middle`,"data-testid":`pr-summary-number`})]}),s&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{children:(0,$.jsx)(`span`,{className:`shrink-0 text-[11px] text-yellow-500`,children:`Rate limited`})}),(0,$.jsx)(W,{children:`GitHub API rate limit reached. Polling paused.`})]})]}),(0,$.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-2`,children:[a?(0,$.jsx)(ua,{state:a.state,draft:a.draft,merged:a.merged}):(0,$.jsx)(ua,{state:r===`CLOSED`?`closed`:`open`,draft:!1,merged:r===`MERGED`}),a&&(0,$.jsx)(At,{linesAdded:a.additions,linesDeleted:a.deletions,dirtyFileCount:a.changed_files,variant:`pr`,size:`xxs`,tooltips:!0}),a&&(0,$.jsx)(da,{decision:a.review_decision})]}),a&&a.base.ref&&a.head.ref&&(0,$.jsxs)(`p`,{className:`text-muted-foreground mt-1.5 text-[11px] break-words`,"data-testid":`pr-summary-merge-info`,children:[a.user?.login&&(0,$.jsx)(`span`,{className:`text-foreground font-medium`,children:a.user.login}),` `,`wants to merge`,` `,(0,$.jsxs)(`span`,{className:`text-foreground font-medium`,children:[a.commits,` `,a.commits===1?`commit`:`commits`]}),` `,`into `,(0,$.jsx)(`span`,{className:`text-foreground font-mono`,children:a.base.ref}),` from`,` `,(0,$.jsx)(`span`,{className:`text-foreground font-mono`,children:a.head.ref})]}),a&&(h>0||g)&&(0,$.jsxs)(mt,{open:c,onOpenChange:l,className:`mt-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[h>0&&(0,$.jsxs)(en,{className:`text-muted-foreground hover:text-foreground flex items-center gap-1 text-[11px]`,"data-testid":`pr-summary-checks-toggle`,children:[c?(0,$.jsx)(M,{className:`size-3.5`}):(0,$.jsx)(se,{className:`size-3.5`}),(0,$.jsxs)(`span`,{children:[`CI Checks (`,a.checks_passed,`/`,h,` passed)`,a.checks_failed>0&&(0,$.jsxs)(`span`,{className:`ml-1 text-red-400`,children:[a.checks_failed,` failed`]}),a.checks_pending>0&&(0,$.jsxs)(`span`,{className:`ml-1 text-yellow-400`,children:[a.checks_pending,` pending`]})]})]}),(0,$.jsx)(fa,{mergeable:a.mergeable_state,merged:a.merged})]}),h>0&&(0,$.jsx)(Ke,{children:(0,$.jsxs)(`div`,{className:`mt-1 space-y-0.5 pl-4`,"data-testid":`pr-summary-checks-list`,children:[f.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px]`,children:[(0,$.jsx)(la,{check:e}),(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),e.app_name&&(0,$.jsxs)(`span`,{className:`text-muted-foreground shrink-0`,children:[`(`,e.app_name,`)`]}),e.html_url&&(0,$.jsx)(`a`,{href:e.html_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground hover:text-foreground ml-auto shrink-0`,"data-testid":`pr-check-link-${e.id}`,children:(0,$.jsx)(ke,{className:`size-3.5`})})]},e.id)),p&&!c&&(0,$.jsxs)(`button`,{className:`text-primary text-[11px] hover:underline`,onClick:()=>l(!0),"data-testid":`pr-summary-show-more-checks`,children:[`+`,d.length-ca,` more`]})]})})]}),!a&&o&&(0,$.jsxs)(`div`,{className:`text-muted-foreground mt-1 flex items-center gap-2`,children:[(0,$.jsx)(m,{className:`icon-sm animate-spin`}),(0,$.jsx)(`span`,{className:`text-[11px]`,children:`Loading PR details…`})]})]})}var ma=Be(`pr-detail-dialog`);function ha(e){return e.slice(0,7)}function ga(e){return e.split(`
|
|
4
4
|
`)[0]}function _a(e){return e.map(e=>({path:e.filename,status:e.status===`removed`?`deleted`:e.status===`renamed`||e.status===`copied`?`renamed`:e.status===`added`?`added`:`modified`,staged:!1,additions:e.additions,deletions:e.deletions}))}function va({open:e,onOpenChange:t,projectId:n,pr:r}){let i=r.number,a=r.title,o=r.html_url,[s,c]=(0,Q.useState)([]),[l,u]=(0,Q.useState)([]),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(`all`),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(``),[O,k]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{e&&(_(null),y(null),x(`all`),C(null),(async()=>{f(!0),m(!0);let[e,t]=await Promise.all([G.githubPRFiles(n,i),G.githubPRCommits(n,i)]);e.isOk()?(c(e.value.files),e.value.files.length>0&&y(e.value.files[0].filename)):(ma.error(`Failed to fetch PR files`,{error:e.error}),_(e.error.message||`Failed to load PR files`)),f(!1),t.isOk()?u(t.value.commits):ma.error(`Failed to fetch PR commits`,{error:t.error}),m(!1)})())},[e,n,i]),(0,Q.useEffect)(()=>{if(b===`all`){C(null);return}let e=!1;return T(!0),G.githubPRFiles(n,i,b).then(t=>{e||(t.isOk()?C(t.value.files):(ma.error(`Failed to fetch commit files`,{error:t.error}),C([])),T(!1))}),()=>{e=!0}},[b,n,i]);let A=S??s,j=(0,Q.useMemo)(()=>{if(!E)return A;if(O)return A.filter(e=>e.filename.includes(E));let e=E.toLowerCase();return A.filter(t=>t.filename.toLowerCase().includes(e))},[A,E,O]),M=(0,Q.useMemo)(()=>_a(j),[j]),N=(0,Q.useCallback)(async e=>{let t=await G.githubPRRevertFile(n,i,e);if(t.isOk()){let r=t.value.action===`deleted`?`removed`:`reverted to base`;Z.success(`${e} ${r}`);let a=await G.githubPRFiles(n,i,b===`all`?void 0:b);a.isOk()&&(b===`all`?c(a.value.files):C(a.value.files)),v===e&&y(null)}else ma.error(`Failed to revert file`,{error:t.error}),Z.error(t.error.message||`Failed to revert file`)},[n,i,b,v]),P=(0,Q.useMemo)(()=>{let e=new Map;for(let t of A)t.patch&&e.set(t.filename,`--- a/${t.filename}\n+++ b/${t.filename}\n${t.patch}`);return e},[A]),F=(0,Q.useCallback)(async e=>{let t=await G.githubPRFileContent(n,i,e);if(t.isErr())return ma.error(`Failed to fetch full file`,{error:t.error}),Z.error(`Failed to load full file`),null;let{baseContent:r,headContent:a}=t.value,o=A.find(t=>t.filename===e);return{oldValue:r,newValue:a,rawDiff:o?.patch?`--- a/${e}\n+++ b/${e}\n${o.patch}`:void 0}},[n,i,A]),I=(0,Q.useMemo)(()=>A.reduce((e,t)=>e+t.additions,0),[A]),L=(0,Q.useMemo)(()=>A.reduce((e,t)=>e+t.deletions,0),[A]),ee=d||p;return(0,$.jsx)(Ze,{open:e,onOpenChange:t,children:(0,$.jsxs)(Vt,{className:`flex h-[85vh] max-w-[90vw] flex-col gap-0 p-0`,"data-testid":`pr-detail-dialog`,children:[(0,$.jsxs)(`div`,{className:`border-border shrink-0 border-b px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(We,{className:`text-sm leading-tight font-semibold`,children:a}),(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>t(!1),className:`text-muted-foreground shrink-0`,"data-testid":`pr-detail-close`,children:(0,$.jsx)(ce,{className:`icon-xs`})})]}),(0,$.jsx)(tt,{className:`sr-only`,children:`Pull request detail with file changes and diffs`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-1.5 text-[11px]`,children:[(0,$.jsxs)(`span`,{className:`text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`text-foreground font-medium`,children:r.user?.login??`unknown`}),` wants to merge `,l.length>0?(0,$.jsxs)($.Fragment,{children:[l.length,` commit`,l.length===1?``:`s`]}):`commits`,` into `]}),(0,$.jsx)(Qe,{branch:r.base.ref,size:`xs`}),(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`from`}),(0,$.jsx)(Qe,{branch:r.head.ref,size:`xs`}),(0,$.jsx)(Tr,{prNumber:i,prState:r.merged_at?`MERGED`:r.state===`closed`?`CLOSED`:`OPEN`,prUrl:o,size:`xxs`,"data-testid":`pr-detail-badge`}),(0,$.jsx)(ua,{state:r.state,draft:r.draft,merged:!!r.merged_at})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,$.jsxs)(Wt,{value:b,onValueChange:x,children:[(0,$.jsxs)(Bt,{className:`h-6 w-auto max-w-[400px] text-[11px]`,"data-testid":`pr-detail-commit-select`,children:[(0,$.jsx)(ne,{className:`text-muted-foreground mr-1 size-3 shrink-0`}),(0,$.jsx)(Lt,{placeholder:`All commits`,children:b===`all`?(0,$.jsxs)(`span`,{className:`text-[11px]`,children:[`All commits (`,l.length,`)`]}):(0,$.jsx)(`span`,{className:`truncate text-[11px]`,children:ga(l.find(e=>e.sha===b)?.message??b)})})]}),(0,$.jsxs)(Tt,{className:`max-w-[480px]`,children:[(0,$.jsx)(qt,{value:`all`,"data-testid":`pr-detail-commit-all`,children:(0,$.jsxs)(`span`,{className:`text-[11px]`,children:[`All commits (`,l.length,`)`]})}),l.map(e=>(0,$.jsx)(qt,{value:e.sha,"data-testid":`pr-detail-commit-${ha(e.sha)}`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-0.5`,children:[(0,$.jsx)(`span`,{className:`truncate text-[11px]`,children:ga(e.message)}),(0,$.jsxs)(`span`,{className:`text-muted-foreground text-[10px]`,children:[(0,$.jsx)(`span`,{className:`font-mono`,children:ha(e.sha)}),e.author?.login&&(0,$.jsxs)($.Fragment,{children:[` · `,e.author.login]}),e.date&&(0,$.jsxs)($.Fragment,{children:[` · `,new Date(e.date).toLocaleDateString()]})]})]})},e.sha))]})]}),(0,$.jsx)(At,{linesAdded:I,linesDeleted:L,dirtyFileCount:A.length,variant:`pr`,size:`xxs`,tooltips:!0})]})]}),ee?(0,$.jsx)(dn,{testId:`pr-detail-loading`,label:`Loading PR data…`}):g?(0,$.jsx)(`div`,{className:`text-muted-foreground flex flex-1 items-center justify-center text-xs`,children:g}):(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`border-border flex w-[280px] shrink-0 flex-col border-r`,"data-testid":`pr-detail-file-tree`,children:[A.length>0&&(0,$.jsx)(`div`,{className:`border-sidebar-border shrink-0 border-b px-2 py-1`,children:(0,$.jsx)(It,{query:E,onQueryChange:D,placeholder:`Filter files…`,totalMatches:j.length,resultLabel:E?`${j.length}/${A.length}`:``,caseSensitive:O,onCaseSensitiveChange:k,onClose:E?()=>D(``):void 0,autoFocus:!1,testIdPrefix:`pr-detail-file-filter`})}),(0,$.jsx)(jt,{className:`min-h-0 flex-1`,children:w?(0,$.jsx)(dn,{testId:`pr-detail-files-loading`,label:`Loading…`}):M.length===0?(0,$.jsx)(`div`,{className:`text-muted-foreground py-4 text-center text-xs`,children:E?`No matching files`:`No files changed`}):(0,$.jsx)(un,{files:M,selectedFile:v,onFileClick:y,onRevertFile:N,revertLabel:`Revert to base`,diffStatsSize:`xxs`,searchQuery:E,testIdPrefix:`pr-detail`})})]}),(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,"data-testid":`pr-detail-diff-pane`,children:v?(0,$.jsx)(fn,{filePath:v,oldValue:``,newValue:``,rawDiff:P.get(v),files:M,diffCache:P,onFileSelect:y,onRequestFullDiff:F}):(0,$.jsxs)(`div`,{className:`text-muted-foreground flex flex-1 flex-col items-center justify-center gap-2`,children:[(0,$.jsx)(h,{className:`size-8 opacity-30`}),(0,$.jsx)(`p`,{className:`text-xs`,children:`Select a file to view changes`})]})})]})]})})}var ya=Be(`pull-requests-tab`),ba=new Set([`main`,`master`]);function xa(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}function Sa({visible:e}){let{t}=H(),n=Ye(e=>e.selectedProjectId),r=ft(),i=wt(),a=st(),o=r??n,s=r===null?void 0:Re({branch:i,worktreePath:a}),c=Ye(e=>o?e.branchByProject[o]:void 0),l=s||c,u=Ye(e=>e.projects.find(e=>e.id===o))?.defaultBranch||void 0,d=(0,Q.useMemo)(()=>l?u?l===u:ba.has(l):!0,[l,u]),[f,p]=(0,Q.useState)([]),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(1),[w,T]=(0,Q.useState)(`open`),[E,D]=(0,Q.useState)(null),O=(0,Q.useRef)(!1),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(void 0),[P,F]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(Ui),[ee,te]=(0,Q.useState)(null),[ne,re]=(0,Q.useState)(!1),ie=Wi(I),R=!d&&!P&&!ie,ae=R?`all`:w;(0,Q.useEffect)(()=>{let e=!1;return G.githubStatus().then(t=>{e||t.isOk()&&t.value.connected&&N(t.value.login)}),()=>{e=!0}},[]),(0,Q.useEffect)(()=>{if(!e||!o)return;let t=!1;return re(!0),G.githubPRFilterOptions(o).then(e=>{t||(e.isOk()?te(e.value):ya.error(`failed to load PR filter options`,{projectId:o,error:e.error.message}),re(!1))}),()=>{t=!0}},[e,o]),(0,Q.useEffect)(()=>{L(Ui),te(null)},[o]);let oe=(0,Q.useCallback)(async(e,n)=>{if(!o)return;g(!0),v(null);let r=ie?await G.githubPRsSearch(o,{state:ae,page:e,per_page:30,sort:I.sort,labels:I.labels,authors:I.authors,assignees:I.assignees,reviewers:I.reviewers}):await G.githubPRs(o,{state:ae,page:e,per_page:30,sort:I.sort});if(r.isOk()){let e=r.value;p(t=>n?[...t,...e.prs]:e.prs),b(e.hasMore),D({owner:e.owner,repo:e.repo})}else ya.error(`failed to load pull requests`,{projectId:o,state:ae,error:r.error.message}),v(r.error.message||t(`review.pullRequests.fetchError`,`Failed to load pull requests`));g(!1)},[o,ae,ie,I,t]);(0,Q.useEffect)(()=>{!e||!o||(O.current||=!0,S(1),p([]),oe(1,!1))},[e,o,ae,oe]),(0,Q.useEffect)(()=>{F(!1)},[l]);let se=()=>{let e=x+1;S(e),oe(e,!0)},ce=()=>{S(1),oe(1,!1)},{currentBranchPRs:le,otherPRs:z}=(0,Q.useMemo)(()=>{if(!l)return{currentBranchPRs:[],otherPRs:f};let e=[],t=[];for(let n of f)n.head.ref===l?e.push(n):t.push(n);return{currentBranchPRs:e,otherPRs:t}},[f,l]);return o?(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-testid":`pull-requests-tab`,children:[(0,$.jsxs)(`div`,{className:`border-sidebar-border flex items-center gap-1.5 overflow-x-auto border-b px-2 py-1.5`,"data-testid":`prs-toolbar`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:ce,disabled:h,className:`text-muted-foreground shrink-0`,"data-testid":`prs-refresh`,children:(0,$.jsx)(k,{className:q(`icon-base`,h&&`animate-spin`)})})}),(0,$.jsx)(W,{side:`bottom`,children:t(`common.refresh`,`Refresh`)})]}),R&&l&&(0,$.jsxs)(`div`,{className:`bg-sidebar-accent/50 text-muted-foreground flex min-w-0 items-center gap-1.5 rounded-md px-2 py-0.5 text-xs`,"data-testid":`prs-branch-focus-indicator`,children:[(0,$.jsx)(me,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate font-mono text-[11px]`,children:(0,$.jsx)(`bdi`,{children:l})})]}),(0,$.jsx)(Ji,{value:I,onChange:L,options:ee,optionsLoading:ne,state:w,onStateChange:T,showState:!R,showBorder:!1,className:`min-w-max flex-nowrap`}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`}),!d&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>F(e=>!e),className:q(`shrink-0`,P?`text-foreground`:`text-muted-foreground`),"data-testid":`prs-toggle-view-all`,children:(0,$.jsx)(C,{className:`icon-base`})})}),(0,$.jsx)(W,{side:`bottom`,children:P?t(`review.pullRequests.focusOnBranch`,`Focus on current branch`):t(`review.pullRequests.viewAll`,`View all pull requests`)})]}),E&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,asChild:!0,className:`text-muted-foreground shrink-0`,"data-testid":`prs-open-github`,children:(0,$.jsx)(`a`,{href:`https://github.com/${E.owner}/${E.repo}/pulls`,target:`_blank`,rel:`noopener noreferrer`,children:(0,$.jsx)(ke,{className:`icon-base`})})})}),(0,$.jsx)(W,{side:`bottom`,children:t(`review.pullRequests.openOnGithub`,`Open on GitHub`)})]})]}),h&&f.length===0?(0,$.jsx)(dn,{testId:`prs-loading`,label:t(`review.pullRequests.loading`,`Loading pull requests…`)}):_?(0,$.jsx)(Er,{title:_,action:(0,$.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:ce,className:`gap-1.5`,"data-testid":`prs-retry`,children:[(0,$.jsx)(k,{className:`icon-xs`}),t(`common.retry`,`Retry`)]})}):R&&le.length===0?(0,$.jsx)(Er,{testId:`prs-branch-empty`,icon:ge,title:t(`review.pullRequests.noPRForBranch`,`No pull request for this branch yet`),description:l?(0,$.jsx)(`span`,{className:`font-mono`,children:(0,$.jsx)(`bdi`,{children:l})}):void 0,action:(0,$.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:()=>F(!0),className:`gap-1.5 text-xs`,"data-testid":`prs-view-all-cta`,children:[(0,$.jsx)(C,{className:`icon-xs`}),t(`review.pullRequests.viewAll`,`View all pull requests`)]})}):!R&&f.length===0?(0,$.jsx)(Er,{icon:ge,title:ie?t(`review.pullRequests.noMatchingPRs`,`No pull requests match these filters`):w===`open`?t(`review.pullRequests.noOpenPRs`,`No open pull requests`):w===`closed`?t(`review.pullRequests.noClosedPRs`,`No closed pull requests`):t(`review.pullRequests.noPRs`,`No pull requests`)}):(0,$.jsx)(jt,{className:`flex min-h-0 flex-1 flex-col`,children:R?(0,$.jsx)(`div`,{className:`flex flex-col`,children:le.map(e=>(0,$.jsx)(aa,{pr:e,projectId:o,currentUserLogin:M,onMerged:ce},e.number))}):(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[le.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground flex items-center gap-1.5 border-b px-3 py-1 text-[10px] font-medium tracking-wide uppercase`,"data-testid":`prs-current-branch-header`,children:[(0,$.jsx)(me,{className:`size-3`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[t(`review.pullRequests.currentBranch`,`Current branch`),l?(0,$.jsxs)($.Fragment,{children:[` `,`· `,(0,$.jsx)(`bdi`,{children:l})]}):null]})]}),(0,$.jsx)(`div`,{className:`flex flex-col`,children:le.map(e=>(0,$.jsx)(aa,{pr:e,projectId:o,currentUserLogin:M,onMerged:ce},e.number))})]}),z.length>0&&(0,$.jsxs)($.Fragment,{children:[le.length>0&&(0,$.jsx)(`div`,{className:`border-sidebar-border bg-sidebar-accent/30 text-muted-foreground border-b px-3 py-1 text-[10px] font-medium tracking-wide uppercase`,"data-testid":`prs-other-header`,children:t(`review.pullRequests.otherPRs`,`Other pull requests`)}),(0,$.jsx)(`div`,{className:`divide-sidebar-border flex flex-col divide-y`,children:z.map(e=>{let n=e.merged_at?`MERGED`:e.state===`closed`?`CLOSED`:`OPEN`;return(0,$.jsx)(`button`,{type:`button`,onClick:()=>j(e),className:`group hover:bg-sidebar-accent/50 flex w-full items-start gap-2 px-3 py-2.5 text-left text-xs transition-colors`,"data-testid":`pr-item-${e.number}`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,$.jsx)(Tr,{prNumber:e.number,prState:n,prUrl:e.html_url,size:`xxs`,"data-testid":`pr-number-link-${e.number}`}),(0,$.jsx)(`span`,{className:`leading-tight font-medium`,children:e.title})]}),e.labels.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.labels.map(e=>{let t=tn(`#${e.color}`);return(0,$.jsx)(`span`,{className:`rounded-full px-1.5 py-0 text-[9px] leading-4 font-medium`,style:{backgroundColor:t,color:et(t)},children:e.name},e.name)})}),(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 text-[10px]`,children:[e.user&&(0,$.jsx)(mr,{name:e.user.login,avatarUrl:e.user.avatar_url,size:`xs`}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:xa(e.created_at)}),e.draft&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(St,{variant:`outline`,className:`h-3.5 px-1 py-0 text-[9px] leading-none`,children:t(`review.pullRequests.draft`,`Draft`)})]})]})]})},e.number)})})]}),y&&(0,$.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`sm`,onClick:se,disabled:h,className:`gap-1.5 text-xs`,"data-testid":`prs-load-more`,children:[h?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):null,t(`review.pullRequests.loadMore`,`Load more`)]})})]})}),A&&o&&(0,$.jsx)(va,{open:!!A,onOpenChange:e=>{e||j(null)},projectId:o,pr:A})]}):(0,$.jsx)(Er,{icon:ge,title:t(`review.pullRequests.noProject`,`Select a project to view pull requests`)})}var Ca=24,wa=24,Ta=12;function Ea(e){let t=e.split(`/`),n=[];for(let e=t.length-1;e>0;e--)n.push(`/`+t.slice(0,e).join(`/`));return n}function Da(e){let t=e.lastIndexOf(`.`);return t===-1||t===e.length-1?null:e.substring(t)}function Oa({summaries:e,filteredDiffs:t,checkedCount:n,totalCount:r,toggleAll:a,hasFolders:o,allFoldersCollapsed:s,collapsedFolders:l,handleCollapseAllFolders:u,handleExpandAllFolders:d,loading:p,loadError:m,refresh:g,fileSearch:_,treeRows:b,selectedFile:x,setSelectedFile:C,expandedFile:w,setExpandedFile:T,loadDiffForFile:E,checkedFiles:k,toggleFile:A,toggleFolder:j,toggleSubmodule:M,expandedSubmodules:N,fileSelectionState:P,setFileSelectionState:I,setSelectAllSignal:L,setDeselectAllSignal:ee,handleStageFile:te,handleUnstageFile:ne,handleRevertFile:re,handleDiscardFolder:ie,handleIgnore:ae,handleCopyPath:ce,handleOpenDirectory:le,basePath:z,readOnly:B}){let{t:V}=H(),ue=(0,Q.useRef)(null),de=(0,Q.useRef)(0),fe=Yt({count:b.length,getScrollElement:()=>ue.current,estimateSize:e=>b[e]?.kind===`folder`?wa:Ca,getItemKey:e=>{let t=b[e];return t.kind===`folder`?`d:${t.path}`:t.kind===`submodule-status`?`s:${t.submodulePath}:${t.state}`:`f:${t.file.path}`},overscan:15});return(0,$.jsxs)($.Fragment,{children:[e.length>0&&(0,$.jsxs)(`div`,{className:`border-sidebar-border flex h-8 items-center gap-1.5 border-b py-1.5 pr-2 pl-2`,children:[(0,$.jsx)(hn,{state:n===r&&r>0?`checked`:n>0?`indeterminate`:`unchecked`,onToggle:a,"aria-label":V(`review.selectAll`,`Select all files`),"data-testid":`review-select-all`}),(0,$.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[n,`/`,r,` `,V(`review.selected`,`selected`)]}),o&&(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-0.5`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:u,disabled:s,"data-testid":`review-collapse-all`,className:`text-muted-foreground`,children:(0,$.jsx)(we,{className:`icon-xs`})})}),(0,$.jsx)(W,{side:`top`,children:V(`common.collapseAll`,`Collapse all folders`)})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:d,disabled:l.size===0,"data-testid":`review-expand-all`,className:`text-muted-foreground`,children:(0,$.jsx)(Ee,{className:`icon-xs`})})}),(0,$.jsx)(W,{side:`top`,children:V(`common.expandAll`,`Expand all folders`)})]})]})]}),(0,$.jsx)(`div`,{ref:ue,className:`min-h-0 flex-1 overflow-auto`,children:p&&e.length===0?(0,$.jsx)(dn,{testId:`review-changes-loading`,label:V(`review.loading`,`Loading changes…`)}):m?(0,$.jsx)(Er,{testId:`review-load-error`,icon:Te,title:V(`review.loadFailed`,`Failed to load changes`),action:(0,$.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:g,className:`gap-1.5`,"data-testid":`review-retry`,children:[(0,$.jsx)(O,{className:`icon-xs`}),V(`common.retry`,`Retry`)]})}):e.length===0&&!p?(0,$.jsx)(Er,{icon:v,title:V(`review.noChanges`)}):t.length===0&&!p?(0,$.jsx)(Er,{icon:i,title:V(`review.noMatchingFiles`,`No matching files`)}):(0,$.jsx)(`div`,{className:q(p&&`pointer-events-none`),children:(0,$.jsx)(`div`,{style:{height:`${fe.getTotalSize()}px`,width:`100%`,position:`relative`},children:fe.getVirtualItems().map(e=>{let t=b[e.index],n=`${8+t.depth*Ta}px`;if(t.kind===`submodule-status`){let r=t.state===`loading`?V(`review.submoduleLoading`,{defaultValue:`Loading submodule files…`}):t.state===`error`?t.message??V(`review.submoduleError`,{defaultValue:`Failed to load submodule`}):V(`review.submoduleEmpty`,{defaultValue:`No changes inside submodule`});return(0,$.jsx)(`div`,{className:`text-muted-foreground/80 flex items-center gap-1.5 text-xs italic`,style:{position:`absolute`,top:0,left:0,width:`100%`,height:`${e.size}px`,transform:`translateY(${e.start}px)`,paddingLeft:n},"data-testid":`review-submodule-status-${t.submodulePath}`,children:(0,$.jsx)(`span`,{className:`truncate`,children:r})},`submodule-status-${t.submodulePath}-${t.state}`)}if(t.kind===`folder`){let r=l.has(t.path);return(0,$.jsxs)(`div`,{className:`group text-muted-foreground hover:bg-sidebar-accent/50 flex cursor-pointer items-center gap-1.5 text-xs select-none`,style:{position:`absolute`,top:0,left:0,width:`100%`,height:`${e.size}px`,transform:`translateY(${e.start}px)`,paddingLeft:n},onClick:()=>j(t.path),draggable:!0,onDragStart:e=>{Jt(e.dataTransfer,{path:t.path,fileType:`folder`})},"data-testid":`review-folder-${t.path}`,children:[(0,$.jsx)(se,{className:q(`icon-sm shrink-0 transition-transform`,!r&&`rotate-90`)}),r?(0,$.jsx)(oe,{className:`icon-base text-muted-foreground/70 shrink-0`}):(0,$.jsx)(Ee,{className:`icon-base text-muted-foreground/70 shrink-0`}),(0,$.jsx)(at,{text:t.label,query:_,className:`font-mono-explorer flex-1 truncate text-xs`}),(0,$.jsx)(At,{linesAdded:t.additions,linesDeleted:t.deletions,size:`xs`}),(0,$.jsx)(`span`,{className:`invisible shrink-0 text-xs font-medium`,children:`M`}),(0,$.jsxs)(Xe,{onOpenChange:e=>{e||(de.current=Date.now())},children:[(0,$.jsx)(Gt,{asChild:!0,children:(0,$.jsx)(`button`,{onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),"aria-label":V(`review.moreActions`,`More actions`),className:`text-muted-foreground hover:bg-sidebar-accent hover:text-foreground flex size-6 shrink-0 items-center justify-center rounded opacity-0 transition-all group-hover:opacity-100 data-[state=open]:opacity-100`,"data-testid":`review-folder-menu-${t.path}`,children:(0,$.jsx)(D,{className:`icon-sm`})})}),(0,$.jsxs)(nt,{align:`end`,className:`min-w-[220px]`,onCloseAutoFocus:e=>e.preventDefault(),children:[z&&(0,$.jsxs)(X,{onClick:e=>{e.stopPropagation(),le(t.path,!1)},"data-testid":`review-folder-open-directory-${t.path}`,children:[(0,$.jsx)(F,{}),V(`sidebar.openDirectory`)]}),!B&&(0,$.jsxs)(X,{onClick:e=>{e.stopPropagation(),ie(t.path)},className:`text-destructive focus:text-destructive`,"data-testid":`review-folder-discard-${t.path}`,children:[(0,$.jsx)(Se,{}),V(`review.discardFolder`)]}),!B&&(()=>{let e=[`/`+t.path,...Ea(t.path)];return e.length===1?(0,$.jsxs)(X,{onClick:t=>{t.stopPropagation(),ae(e[0])},"data-testid":`review-folder-ignore-${t.path}`,children:[(0,$.jsx)(R,{}),V(`review.ignoreFolder`)]}):(0,$.jsxs)(lt,{children:[(0,$.jsxs)(Dt,{onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),"data-testid":`review-folder-ignore-${t.path}`,children:[(0,$.jsx)(R,{}),V(`review.ignoreFolder`)]}),(0,$.jsx)(Ue,{onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:e.map(e=>(0,$.jsx)(X,{onClick:t=>{t.stopPropagation(),ae(e)},"data-testid":`review-folder-ignore-${t.path}-option-${e}`,children:e},e))})]})})()]})]})]},`folder-${t.path}`)}let r=t.file,i=k.has(r.path),a=P.get(r.path),o=i&&a===`partial`;return(0,$.jsxs)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,height:`${e.size}px`,transform:`translateY(${e.start}px)`,paddingLeft:n},className:q(`group flex items-center gap-1.5 text-xs cursor-pointer`,x===r.path?`bg-sidebar-accent text-sidebar-accent-foreground`:`hover:bg-sidebar-accent/50 text-muted-foreground`),onClick:()=>{Date.now()-de.current<400||(C(r.path),T(r.path),E(r.path))},draggable:!0,onDragStart:e=>{Jt(e.dataTransfer,{path:r.path,fileType:`file`})},children:[(0,$.jsx)(hn,{state:o?`indeterminate`:i?`checked`:`unchecked`,onToggle:e=>{e.stopPropagation(),o||!i?(i||A(r.path),w===r.path&&L(e=>e+1),I(e=>{let t=new Map(e);return t.set(r.path,`all`),t})):(A(r.path),w===r.path&&ee(e=>e+1),I(e=>{let t=new Map(e);return t.set(r.path,`none`),t}))},"aria-label":V(`review.selectFile`,{file:r.path,defaultValue:`Select ${r.path}`}),"data-testid":`review-file-checkbox-${r.path}`}),r.kind===`submodule`&&(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation(),M(r.path)},"aria-label":N.has(r.path)?V(`review.collapseSubmodule`,{defaultValue:`Collapse submodule`}):V(`review.expandSubmodule`,{defaultValue:`Expand submodule`}),className:`text-muted-foreground hover:text-foreground flex size-4 shrink-0 items-center justify-center rounded`,"data-testid":`review-submodule-toggle-${r.path}`,children:(0,$.jsx)(se,{className:q(`icon-sm transition-transform`,N.has(r.path)&&`rotate-90`)})}),r.kind===`submodule`?(0,$.jsx)(me,{className:`icon-base shrink-0 text-purple-500 dark:text-purple-400`,"data-testid":`review-submodule-icon-${r.path}`}):(0,$.jsx)(Qt,{filePath:r.path,className:`icon-base text-muted-foreground/80 shrink-0`}),(0,$.jsx)(at,{text:r.path.split(`/`).pop()||r.path,query:_,className:`font-mono-explorer flex-1 truncate text-xs`}),r.kind===`submodule`&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`span`,{className:`shrink-0 rounded-sm border border-purple-500/40 bg-purple-500/10 px-1 text-[10px] tracking-wide text-purple-600 uppercase dark:text-purple-300`,"data-testid":`review-submodule-badge-${r.path}`,children:r.nestedDirty&&r.nestedDirty.dirtyFileCount>0?V(`review.submoduleDirtyCount`,{count:r.nestedDirty.dirtyFileCount,defaultValue:`submodule · {{count}}`}):V(`review.submodule`,{defaultValue:`submodule`})})}),(0,$.jsxs)(W,{side:`top`,className:`max-w-xs text-xs`,children:[(0,$.jsx)(`div`,{className:`font-medium`,children:V(`review.submoduleTooltip`,{defaultValue:`Nested git repository (gitlink)`})}),r.nestedDirty&&(0,$.jsxs)(`div`,{className:`mt-1 space-y-0.5 font-mono`,children:[r.nestedDirty.pointerMoved&&(0,$.jsx)(`div`,{children:V(`review.submodulePointerMoved`,{defaultValue:`Gitlink pointer moved (parent-visible change).`})}),(0,$.jsx)(`div`,{children:V(`review.submoduleDirtyLine`,{count:r.nestedDirty.dirtyFileCount,defaultValue:`{{count}} file(s) dirty inside`})}),(r.nestedDirty.linesAdded>0||r.nestedDirty.linesDeleted>0)&&(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`span`,{className:`text-diff-added`,children:[`+`,r.nestedDirty.linesAdded]}),` `,(0,$.jsxs)(`span`,{className:`text-diff-removed`,children:[`-`,r.nestedDirty.linesDeleted]}),` `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:V(`review.submoduleLines`,{defaultValue:`lines`})})]})]}),(0,$.jsx)(`div`,{className:`text-muted-foreground mt-1`,children:V(`review.submoduleExpandHint`,{defaultValue:`Click the arrow to expand inner files.`})})]})]}),(0,$.jsx)(At,{linesAdded:r.kind===`submodule`&&r.nestedDirty?r.nestedDirty.linesAdded:r.additions??0,linesDeleted:r.kind===`submodule`&&r.nestedDirty?r.nestedDirty.linesDeleted:r.deletions??0,size:`xs`}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,style:{color:r.status===`conflicted`?`hsl(0 72% 51%)`:r.status===`added`?`hsl(142 40% 45%)`:r.status===`modified`?`hsl(30 90% 55%)`:r.status===`deleted`?`hsl(0 45% 55%)`:`hsl(200 80% 60%)`},children:r.status===`conflicted`?`C`:r.status===`added`?`A`:r.status===`modified`?`M`:r.status===`deleted`?`D`:`R`}),(0,$.jsxs)(Xe,{onOpenChange:e=>{e||(de.current=Date.now())},children:[(0,$.jsx)(Gt,{asChild:!0,children:(0,$.jsx)(`button`,{onClick:e=>{e.stopPropagation()},onPointerDown:e=>{e.stopPropagation()},"aria-label":V(`review.moreActions`,`More actions`),className:`text-muted-foreground hover:bg-sidebar-accent hover:text-foreground flex size-6 shrink-0 items-center justify-center rounded opacity-0 transition-all group-hover:opacity-100 data-[state=open]:opacity-100`,children:(0,$.jsx)(D,{className:`icon-sm`})})}),(0,$.jsxs)(nt,{align:`end`,className:`min-w-[220px]`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,$.jsxs)(X,{onClick:e=>{if(e.stopPropagation(),!z){Z.error(V(`review.openFileNoBasePath`));return}qe(`${z}/${r.path}`)},children:[(0,$.jsx)(ke,{}),V(`review.openInEditor`,{editor:Ct()})]}),(0,$.jsxs)(X,{onClick:e=>{if(e.stopPropagation(),!z){Z.error(V(`review.openFileNoBasePath`));return}Zt(`${z}/${r.path}`)},"data-testid":`review-open-internal-editor-${r.path}`,children:[(0,$.jsx)(h,{}),V(`review.openInInternalEditor`)]}),z&&(0,$.jsxs)(X,{onClick:e=>{e.stopPropagation(),le(r.path,!0)},"data-testid":`review-file-open-directory-${r.path}`,children:[(0,$.jsx)(F,{}),V(`sidebar.openDirectory`)]}),!B&&(0,$.jsx)(xt,{}),!B&&(r.staged?(0,$.jsxs)(X,{onClick:e=>{e.stopPropagation(),ne(r.path)},"data-testid":`review-unstage-file-${r.path}`,children:[(0,$.jsx)(c,{}),V(`review.unstageFile`,{defaultValue:`Unstage file`})]}):(0,$.jsxs)(X,{onClick:e=>{e.stopPropagation(),te(r.path)},"data-testid":`review-stage-file-${r.path}`,children:[(0,$.jsx)(y,{}),V(`review.stageFile`,{defaultValue:`Stage file`})]})),!B&&(0,$.jsxs)(X,{onClick:e=>{e.stopPropagation(),re(r.path)},className:`text-destructive focus:text-destructive`,children:[(0,$.jsx)(Se,{}),V(`review.discardChanges`)]}),!B&&(0,$.jsx)(xt,{}),!B&&(0,$.jsxs)(X,{onClick:e=>{e.stopPropagation(),ae(r.path)},children:[(0,$.jsx)(S,{}),V(`review.ignoreFile`)]}),!B&&(()=>{let e=Ea(r.path);return e.length===0?null:e.length===1?(0,$.jsxs)(X,{onClick:t=>{t.stopPropagation(),ae(e[0])},children:[(0,$.jsx)(R,{}),V(`review.ignoreFolder`)]}):(0,$.jsxs)(lt,{children:[(0,$.jsxs)(Dt,{onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsx)(R,{}),V(`review.ignoreFolder`)]}),(0,$.jsx)(Ue,{onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:e.map(e=>(0,$.jsx)(X,{onClick:t=>{t.stopPropagation(),ae(e)},children:e},e))})]})})(),!B&&(()=>{let e=Da(r.path);return e?(0,$.jsxs)(X,{onClick:t=>{t.stopPropagation(),ae(`*${e}`)},children:[(0,$.jsx)(S,{}),V(`review.ignoreExtension`,{ext:e})]}):null})(),(0,$.jsx)(xt,{}),(0,$.jsxs)(X,{onClick:e=>{e.stopPropagation(),ce(r.path,!1)},children:[(0,$.jsx)(f,{}),V(`review.copyFilePath`)]}),(0,$.jsxs)(X,{onClick:e=>{e.stopPropagation(),ce(r.path,!0)},children:[(0,$.jsx)(he,{}),V(`review.copyRelativePath`)]})]})]})]},r.path)})})})})]})}function ka({refresh:e,loading:t,handlePull:n,handleFetchOrigin:r,pullInProgress:i,fetchInProgress:a,handlePushOnly:s,pushInProgress:c,remoteUrl:l,setPublishDialogOpen:u,unpushedCommitCount:d,threadBranch:f,baseBranch:p,isOnDifferentBranch:m,openMergeDialog:h,mergeInProgress:g,setPrDialog:_,summaries:v,checkedFiles:x,handleStageSelected:C,handleUnstageAll:w,handleStashSelected:T,handleDiscardAll:E,handleIgnoreFiles:D,actionInProgress:O,stashInProgress:A,gitStatus:M,isAgentRunning:N,readOnly:P}){let{t:F}=H();return P?(0,$.jsx)(`div`,{className:`border-sidebar-border flex items-center gap-1 border-b px-2 py-1`,children:(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:e,className:`text-muted-foreground`,"data-testid":`review-refresh`,children:(0,$.jsx)(k,{className:q(`icon-base`,t&&`animate-spin`)})})}),(0,$.jsx)(W,{side:`top`,children:F(`review.refresh`)})]})}):(0,$.jsxs)(`div`,{className:`border-sidebar-border flex items-center gap-1 border-b px-2 py-1`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:e,className:`text-muted-foreground`,"data-testid":`review-refresh`,children:(0,$.jsx)(k,{className:q(`icon-base`,t&&`animate-spin`)})})}),(0,$.jsx)(W,{side:`top`,children:F(`review.refresh`)})]}),(0,$.jsx)(Mi,{onPull:n,onFetch:r,pullInProgress:i,fetchInProgress:a,unpulledCommitCount:M?.unpulledCommitCount??0,testIdPrefix:`review`}),l===null?(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>u(!0),className:`text-muted-foreground relative`,"data-testid":`review-publish-toolbar`,children:[(0,$.jsx)(j,{className:`icon-base`}),d>0&&(0,$.jsx)(ji,{count:d})]})}),(0,$.jsx)(W,{side:`top`,children:d>0?F(`review.publishWithCommits`,{count:d,defaultValue:`Publish repository (${d} commit(s) to push)`}):F(`review.publishRepo`,`Publish repository`)})]}):(0,$.jsx)(Ni,{onPush:s,pushInProgress:c,unpushedCommitCount:d,testIdPrefix:`review`}),!!f&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:h,disabled:g||v.length>0,className:`text-muted-foreground`,"data-testid":`review-merge-toolbar`,children:(0,$.jsx)(B,{className:q(`icon-base`,g&&`animate-pulse`)})})}),(0,$.jsx)(W,{side:`top`,children:v.length>0?F(`review.commitFirst`,`Commit changes before merging`):F(`review.mergeIntoBranch`,{target:p||`base`,defaultValue:`Merge into branch`})})]}),m&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:M?.prNumber?(()=>{let e=M.prState??`OPEN`;return(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>window.open(M.prUrl,`_blank`),className:`text-muted-foreground`,"data-testid":`review-view-pr-toolbar`,children:(0,$.jsx)(e===`MERGED`?B:e===`CLOSED`?I:ge,{className:`icon-base ${e===`MERGED`?`text-purple-500`:e===`CLOSED`?`text-red-500`:`text-green-500`}`})})})():(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>_({title:f||``,body:``}),disabled:!!N,className:`text-muted-foreground`,"data-testid":`review-create-pr-toolbar`,children:(0,$.jsx)(ge,{className:`icon-base`})})}),(0,$.jsx)(W,{side:`top`,children:M?.prNumber?F(`review.viewPR`,{number:M.prNumber,defaultValue:`View PR #${M.prNumber}`}):N?F(`review.agentRunningTooltip`):F(`review.createPRTooltip`,{branch:f,target:p||`base`})})]}),v.length>0&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:C,disabled:!!O||!!N,className:`text-muted-foreground`,"data-testid":`review-stage-selected`,children:(0,$.jsx)(b,{className:`icon-base`})})}),(0,$.jsx)(W,{side:`top`,children:N?F(`review.agentRunningTooltip`):x.size>0?F(`review.stageSelected`,{defaultValue:`Stage selected`}):F(`review.stageAll`,{defaultValue:`Stage all`})})]}),v.some(e=>e.staged)&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:w,disabled:!!O||!!N,className:`text-muted-foreground`,"data-testid":`review-unstage-selected`,children:(0,$.jsx)(o,{className:`icon-base`})})}),(0,$.jsx)(W,{side:`top`,children:N?F(`review.agentRunningTooltip`):x.size>0?F(`review.unstageSelected`,{defaultValue:`Unstage selected`}):F(`review.unstageAll`,{defaultValue:`Unstage all`})})]}),v.length>0&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:T,disabled:!!O||!!N||A,className:`text-muted-foreground`,"data-testid":`review-stash-selected`,children:(0,$.jsx)(y,{className:q(`icon-base`,A&&`animate-pulse`)})})}),(0,$.jsx)(W,{side:`top`,children:N?F(`review.agentRunningTooltip`):x.size>0?F(`review.stashSelected`,{defaultValue:`Stash selected`}):F(`review.stashAll`,{defaultValue:`Stash all`})})]}),v.length>0&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:E,disabled:!!O||!!N,className:`text-muted-foreground`,"data-testid":`review-discard-all`,children:(0,$.jsx)(Se,{className:`icon-base`})})}),(0,$.jsx)(W,{side:`top`,children:N?F(`review.agentRunningTooltip`):F(`review.discard`,`Discard`)})]}),v.length>0&&(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:D,disabled:!!O,className:`text-muted-foreground`,"data-testid":`review-ignore-files`,children:(0,$.jsx)(S,{className:`icon-base`})})}),(0,$.jsx)(W,{side:`top`,children:x.size>0?`Add ${x.size} file(s) to .gitignore`:`Add all to .gitignore`})]})]})}function Aa({steps:e,showTotal:t=!0}){let n=(0,Q.useMemo)(()=>e.filter(e=>e.status!==`pending`),[e]),r=rn(e,!0),i=nn(e,r);return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[n.map(e=>{let t=r(e.id);return(0,$.jsxs)(`div`,{className:q(`flex items-start gap-2.5 rounded-md px-2 py-1 transition-colors`,e.status===`running`&&`bg-primary/8`),children:[(0,$.jsxs)(`div`,{className:`mt-0.5 shrink-0`,children:[e.status===`completed`&&(0,$.jsx)(De,{className:`icon-base text-emerald-500`}),e.status===`running`&&(0,$.jsx)(m,{className:`icon-base text-primary animate-spin`}),e.status===`failed`&&(0,$.jsx)(ce,{className:`icon-base text-destructive`})]}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:q(`text-xs`,e.status===`completed`&&`text-muted-foreground`,e.status===`running`&&`font-medium text-foreground`,e.status===`failed`&&`font-medium text-destructive`),children:e.label}),t!=null&&(0,$.jsx)(`span`,{className:`text-muted-foreground/60 shrink-0 text-[10px] tabular-nums`,children:on(t)})]}),e.url&&e.status===`completed`&&(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary mt-0.5 flex items-center gap-1 text-[11px] hover:underline`,children:[(0,$.jsx)(ke,{className:`icon-xs`}),e.url]}),e.subItems&&e.subItems.length>0&&(0,$.jsx)(an,{subItems:e.subItems,parentStatus:e.status}),e.error&&!(e.subItems&&e.subItems.length>0)&&(0,$.jsx)(jt,{className:`bg-destructive/5 mt-0.5 max-h-40 rounded`,children:(0,$.jsx)(`pre`,{className:`text-destructive/80 p-1.5 font-mono text-[11px] wrap-break-word whitespace-pre-wrap`,children:e.error})})]})]},e.id)}),t&&n.length>0&&(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(`span`,{className:`text-muted-foreground/50 text-[10px] tabular-nums`,children:on(i)})})]})}function ja({commitEntry:e,commitProgressId:t,setActionInProgress:n,summaries:r,commitInProgress:i,commitTitle:a,commitBody:o,setCommitTitle:s,setCommitBody:c,generatingMsg:l,handleGenerateCommitMsg:u,selectedAction:d,setSelectedAction:f,actionInProgress:p,isOnDifferentBranch:h,gitStatus:g,canCommit:_,handleCommitAction:v,isAgentRunning:y,effectiveThreadId:b,hasRebaseConflict:x,baseBranch:S,isWorktree:C,handleOpenInEditorConflict:w,handleAskAgentResolve:T,readOnly:E}){let{t:D}=H();return E?null:(0,$.jsxs)($.Fragment,{children:[e&&(0,$.jsxs)(`div`,{className:`border-sidebar-border shrink-0 space-y-2 border-t p-2`,children:[(0,$.jsx)(`p`,{className:`text-foreground text-xs font-medium`,children:e.title}),(0,$.jsx)(Aa,{steps:e.steps}),(()=>{let r=e.steps.some(e=>e.status===`failed`);return!e.steps.some(e=>e.status===`running`)&&(e.steps.every(e=>e.status===`completed`||e.status===`failed`)||r)&&r?(0,$.jsx)(Y,{size:`sm`,variant:`outline`,className:`w-full`,onClick:()=>{ht.getState().finishCommit(t),n(null)},children:D(`review.progress.dismiss`,`Dismiss`)}):null})()]}),r.length>0&&!i&&(0,$.jsxs)(`div`,{className:`border-sidebar-border shrink-0 space-y-1.5 border-t p-2`,children:[(0,$.jsx)(sn,{type:`text`,placeholder:D(`review.commitTitle`),"aria-label":D(`review.commitTitle`,`Commit title`),"data-testid":`review-commit-title`,value:a,onChange:e=>s(e.target.value),disabled:!!p||l,className:`h-auto px-2 py-1.5 text-xs`}),(0,$.jsxs)(`div`,{className:`border-input bg-background focus-within:border-ring focus-within:ring-ring/50 rounded-md border focus-within:ring-1`,children:[(0,$.jsx)(`textarea`,{className:`placeholder:text-muted-foreground w-full resize-none bg-transparent px-2 py-1.5 text-xs focus-visible:outline-hidden`,rows:7,"aria-label":D(`review.commitBody`,`Commit body`),"data-testid":`review-commit-body`,placeholder:D(`review.commitBody`),value:o,onChange:e=>c(e.target.value),disabled:!!p||l}),(0,$.jsx)(`div`,{className:`flex items-center px-1.5 py-1`,children:(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:u,disabled:r.length===0||l||!!p,"data-testid":`review-generate-commit-msg`,children:(0,$.jsx)(z,{className:q(`icon-2xs`,l&&`animate-pulse`)})})}),(0,$.jsx)(W,{side:`top`,children:D(l?`review.generatingCommitMsg`:`review.generateCommitMsg`)})]})})]}),(0,$.jsx)(`div`,{className:q(`grid gap-1 mt-2`,h?g?.prNumber?`grid-cols-4`:`grid-cols-5`:`grid-cols-3`),children:[{value:`commit`,icon:ne,label:D(`review.commit`,`Commit`),testId:`review-action-commit`},{value:`amend`,icon:ve,label:D(`review.amend`,`Amend`),testId:`review-action-amend`},{value:`commit-push`,icon:j,label:D(`review.commitAndPush`,`Commit & Push`),testId:`review-action-commit-push`},...!g?.prNumber&&h?[{value:`commit-pr`,icon:ge,label:D(`review.commitAndCreatePR`,`Commit & Create PR`),testId:`review-action-commit-pr`}]:[],...h?[{value:`commit-merge`,icon:B,label:D(`review.commitAndMerge`,`Commit & Merge`),testId:`review-action-commit-merge`}]:[]].map(({value:e,icon:t,label:n,testId:r})=>(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>f(e),disabled:!!p||!!y&&!b,"data-testid":r,className:q(`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===e?`border-primary bg-primary/5 text-foreground`:`border-border text-muted-foreground`),children:[(0,$.jsx)(t,{className:q(`icon-base`,d===e&&`text-primary`)}),(0,$.jsx)(`span`,{className:`text-xs leading-tight font-medium`,children:n})]})}),y&&(0,$.jsx)(W,{side:`top`,children:D(`review.agentRunningTooltip`)})]},e))}),(0,$.jsx)(`div`,{className:`flex gap-1.5`,children:(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsxs)(Y,{className:`w-full`,size:`sm`,onClick:v,disabled:!_,"data-testid":`review-commit-execute`,children:[p?(0,$.jsx)(m,{className:`icon-sm mr-1.5 animate-spin`}):null,D(`review.continue`,`Continue`)]})})}),y&&(0,$.jsx)(W,{side:`top`,children:D(`review.agentRunningTooltip`)})]})})]}),x&&(0,$.jsxs)(`div`,{className:`border-sidebar-border shrink-0 space-y-2 border-t p-3`,children:[(0,$.jsxs)(`div`,{className:`text-destructive flex items-center gap-2 text-xs`,children:[(0,$.jsx)(Te,{className:`icon-sm`}),(0,$.jsx)(`span`,{children:D(`review.mergeConflict`,{target:S||`main`})})]}),C&&(0,$.jsxs)(Y,{className:`w-full`,size:`sm`,variant:`outline`,onClick:w,children:[(0,$.jsx)(ke,{className:`icon-sm mr-1.5`}),D(`review.openInEditor`,{editor:Le[ze.getState().defaultEditor]})]}),(0,$.jsxs)(Y,{className:`w-full`,size:`sm`,onClick:T,children:[(0,$.jsx)(z,{className:`icon-sm mr-1.5`}),D(`review.askAgentResolve`)]})]})]})}function Ma({truncatedInfo:e,summaries:t,prSummary:n,search:r,toolbar:i,filesPanel:a,commitDraft:o}){let{t:s}=H();return(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[e.truncated&&(0,$.jsx)(`div`,{className:`border-sidebar-border border-b bg-yellow-500/10 px-3 py-1.5 text-xs text-yellow-600 dark:text-yellow-400`,children:s(`review.truncatedWarning`,{shown:t.length,total:e.total,defaultValue:`Showing ${t.length} of ${e.total} files. Some files were excluded.`})}),(0,$.jsx)(ka,{...i}),n&&(0,$.jsx)(pa,{...n}),(0,$.jsx)(`div`,{className:`border-sidebar-border bg-background border-b px-2 py-1`,children:(0,$.jsx)(It,{...r})}),(0,$.jsx)(Oa,{...a}),(0,$.jsx)(ja,{...o})]})})}function Na(e){return(0,$.jsx)(_n,{value:`changes`,className:`flex min-h-0 flex-1 data-[state=inactive]:hidden`,forceMount:!0,children:(0,$.jsx)(Ma,{...e})})}function Pa(e){let t=e.worktreePath??e.lightThread?.worktreePath;if(t)return t;let n=e.threadProjectId??e.lightThread?.projectId??e.selectedProjectId;return n?e.projects.find(e=>e.id===n)?.path??``:``}function Fa(e){let{setCommitDraft:t}=ut(),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(``),o=(0,Q.useRef)(n);o.current=n;let s=(0,Q.useRef)(i);s.current=i;let c=(0,Q.useCallback)(n=>{r(r=>{let i=typeof n==`function`?n(r):n;return e&&t(e,i,s.current),i})},[e,t]),l=(0,Q.useCallback)(n=>{a(r=>{let i=typeof n==`function`?n(r):n;return e&&t(e,o.current,i),i})},[e,t]);return(0,Q.useEffect)(()=>{let t=e?ut.getState().drafts[e]:void 0;r(t?.commitTitle??``),a(t?.commitBody??``)},[e]),{commitTitle:n,commitBody:i,setCommitTitle:c,setCommitBody:l,commitTitleRef:o,commitBodyRef:s}}function Ia({hasGitContext:e,effectiveThreadId:t,projectModeId:n,threadProjectId:r,selectedProjectId:i,summaries:a,checkedFiles:o,commitTitle:s,commitBody:c,draftId:l,setCommitTitle:u,setCommitBody:d,baseBranch:f,threadBranch:p,currentBranch:m,refresh:h}){let{t:g}=H(),{clearCommitDraft:_}=ut(),[v,y]=(0,Q.useState)(`commit`),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(null),[M,N]=(0,Q.useState)(!1),P=(0,Q.useRef)(!1),F=(0,Q.useRef)(!1),I=t||n||``,L=ht(e=>e.activeCommits[I]),ee=!!L,te=(0,Q.useRef)(L);return(0,Q.useEffect)(()=>{let e=te.current;if(te.current=L,e&&!L){x(null),P.current=!1,C(!1),T(!1),D(!1),F.current=!0,h(),t&&(e.action===`commit-merge`||e.action===`merge`)&&(rt.getState().refreshActiveThread(),rt.getState().refreshAllLoadedThreads());return}if(!L)return;let n=L.steps.some(e=>e.status===`failed`),r=L.steps.every(e=>e.status===`completed`);if(n){x(null),P.current=!1,C(!1),T(!1),D(!1);let e=L.steps.find(e=>e.id===`merge`&&e.status===`failed`);if(e?.error){let t=e.error.toLowerCase();(t.includes(`conflict`)||t.includes(`rebase failed`)||t.includes(`merge failed`)||t.includes(`automatic merge failed`)||t.includes(`fix conflicts`)||t.includes(`could not apply`))&&N(!0)}let t=L.steps.find(e=>e.id===`hooks`&&e.status===`failed`);if(t?.error){let e=t.subItems?.find(e=>e.status===`failed`);Z.error(g(`review.hookFailed`,`Pre-commit hook failed: {{hook}}`,{hook:e?.label||`unknown`}))}h()}if(r&&e&&!e.steps.every(e=>e.status===`completed`)){let e=L.action;e===`push`||(e===`merge`||e===`commit-merge`?Z.success(g(`review.mergeSuccess`,{branch:p||`branch`,target:f||`base`,defaultValue:`Merged "${p||`branch`}" into "${f||`base`}" successfully`})):e===`create-pr`?Z.success(g(`review.prSuccess`,`Pull request created`)):Z.success(g(`review.commitSuccess`,`Changes committed successfully`)))}},[L]),{selectedAction:v,setSelectedAction:y,actionInProgress:b,setActionInProgress:x,pushInProgress:S,mergeInProgress:w,prInProgress:E,prDialog:O,setPrDialog:k,mergeDialog:A,setMergeDialog:j,hasRebaseConflict:M,setHasRebaseConflict:N,justCompletedWorkflowRef:F,commitInProgress:ee,commitEntry:L,commitProgressId:I,handleCommitAction:(0,Q.useCallback)(async()=>{if(!e||!s.trim()||o.size===0||b||P.current)return;P.current=!0,x(v);let r=a.filter(e=>e.staged&&!o.has(e.path)).map(e=>e.path),i=Array.from(o).filter(e=>{let t=a.find(t=>t.path===e);return t&&!t.staged}),f={action:v,message:c.trim()?`${s.trim()}\n\n${c.trim()}`:s.trim(),filesToStage:i,filesToUnstage:r,amend:v===`amend`,prTitle:v===`commit-pr`?s.trim():void 0,prBody:v===`commit-pr`?c.trim():void 0,cleanup:v===`commit-merge`},p=t?await U.startWorkflow(t,f):await U.projectStartWorkflow(n,f);if(p.isErr()){gt(p.error),x(null),P.current=!1;return}u(``),d(``),l&&_(l)},[e,s,c,o,b,v,a,t,n,l,_,u,d]),handlePushOnly:(0,Q.useCallback)(async()=>{if(!e||S)return;C(!0);let r=t?await U.startWorkflow(t,{action:`push`}):await U.projectStartWorkflow(n,{action:`push`});r.isErr()&&(gt(r.error),C(!1))},[e,S,t,n]),openMergeDialog:(0,Q.useCallback)(async()=>{let e=r??i??``;if(!e)return;j({targetBranch:f||``,branches:[],loading:!0});let t=await Fe.listBranches(e);if(t.isOk()){let e=t.value,n=e.branches.filter(e=>e!==m),r=f&&n.includes(f)?f:e.defaultBranch&&n.includes(e.defaultBranch)?e.defaultBranch:n[0]||``;j(e=>e?{...e,targetBranch:r,branches:n,loading:!1}:null)}else j(null),gt(t.error)},[r,i,f,m]),handleMergeWithTarget:(0,Q.useCallback)(async()=>{if(!e||w||!A?.targetBranch)return;T(!0);let r={action:`merge`,cleanup:!0,targetBranch:A.targetBranch},i=t?await U.startWorkflow(t,r):await U.projectStartWorkflow(n,r);i.isErr()&&(gt(i.error),T(!1)),j(null)},[e,w,A,t,n]),handleCreatePROnly:(0,Q.useCallback)(async()=>{if(!e||E||!O)return;D(!0);let r=t?await U.startWorkflow(t,{action:`create-pr`,prTitle:O.title.trim(),prBody:O.body.trim()}):await U.projectStartWorkflow(n,{action:`create-pr`,prTitle:O.title.trim(),prBody:O.body.trim()});if(r.isErr()){gt(r.error),D(!1);return}k(null)},[e,E,O,t,n])}}function La(e,t,n=1e3,r=!0){let i=(0,Q.useRef)(null),a=(0,Q.useRef)(t);a.current=t;let o=(0,Q.useRef)(!1),s=Tn(e=>e.dirtySignal),c=Tn(e=>e.dirtyThreadId);(0,Q.useEffect)(()=>{if(!(!e||c!==e||s===0)){if(!r){o.current=!0;return}return i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,a.current()},n),()=>{i.current&&=(clearTimeout(i.current),null)}}},[s,c,e,n,r]),(0,Q.useEffect)(()=>{r&&o.current&&(o.current=!1,a.current())},[r])}function Ra({hasGitContext:e,effectiveThreadId:t,projectModeId:n,selectedFile:r,expandedFile:i,reviewPaneOpen:a,summaries:o,setSummaries:s,submoduleExpansions:c,setSelectedFile:l,setCheckedFiles:u,dirtyFileCount:d,linesAdded:f,linesDeleted:p}){let m=(0,Q.useCallback)(e=>{for(let[t,n]of c){let r=`${t}/`;if(!e.startsWith(r))continue;let i=e.slice(r.length),a=n.find(e=>e.path===i);if(a)return{submodulePath:t,innerPath:i,staged:a.staged}}return null},[c]),[h,g]=(0,Q.useState)(new Map),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)({total:0,truncated:!1}),[x,S]=(0,Q.useState)(!1),[C,w]=(0,Q.useState)(!1),T=(0,Q.useRef)(null),E=(0,Q.useRef)(0),D=(0,Q.useRef)(!1),O=(0,Q.useRef)(!1),k=(0,Q.useRef)(null),A=(0,Q.useCallback)(async()=>{if(!e)return;D.current=!0;let a=++E.current;T.current?.abort();let o=new AbortController;T.current=o;let{signal:c}=o;S(!0),w(!1),t?pt.getState().fetchForThread(t):n&&pt.getState().fetchProjectStatus(n);try{let e=t?await U.getDiffSummary(t,void 0,void 0,c):await U.projectDiffSummary(n,void 0,void 0,c);if(E.current!==a||c.aborted)return;if(e.isOk()){let o=e.value,d=new Set(o.files.map(e=>e.path)),f=r&&d.has(r)?r:o.files.length>0?o.files[0].path:null,p=f?o.files.find(e=>e.path===f):void 0,m=i&&i!==f&&d.has(i)?i:null,h=m?o.files.find(e=>e.path===m):void 0,_=async(e,r)=>{v(e);let i=t?await U.getFileDiff(t,e,r,c):await U.projectFileDiff(n,e,r,c);E.current===a&&i.isOk()&&!c.aborted&&g(t=>new Map(t).set(e,i.value.diff)),v(t=>t===e?null:t)};s(o.files),b({total:o.total,truncated:o.truncated}),g(new Map);let y=[];f&&p&&!c.aborted&&y.push(_(f,p.staged)),m&&h&&!c.aborted&&y.push(_(m,h.staged)),u(e=>{let t=new Set(e),n=new Set(o.files.map(e=>e.path));for(let n of o.files)(!e.has(n.path)&&e.size===0||!e.has(n.path)&&o.files.length>e.size)&&t.add(n.path);for(let r of e)n.has(r)||t.delete(r);return t.size===0?new Set(o.files.map(e=>e.path)):t}),f!==r&&l(f),y.length>0&&await Promise.all(y)}else console.error(`Failed to load diff summary:`,e.error),w(!0)}finally{E.current===a&&(S(!1),D.current=!1)}},[e,t,n,r,i,l,u]),j=(0,Q.useCallback)(async r=>{if(!e||h.has(r))return;let i=m(r),a=i?null:o.find(e=>e.path===r);if(!i&&!a)return;let s=T.current?.signal;v(r);let c=i?t?await U.getSubmoduleFileDiff(t,i.submodulePath,i.innerPath,i.staged,s):await U.projectSubmoduleFileDiff(n,i.submodulePath,i.innerPath,i.staged,s):t?await U.getFileDiff(t,r,a.staged,s):await U.projectFileDiff(n,r,a.staged,s);c.isOk()&&!s?.aborted&&g(e=>new Map(e).set(r,c.value.diff)),v(e=>e===r?null:e)},[e,h,o,t,n,m]),M=(0,Q.useCallback)(async r=>{if(!e)return null;let i=m(r),a=i?null:o.find(e=>e.path===r);if(!i&&!a)return null;let s=T.current?.signal,c=i?t?await U.getSubmoduleFileDiff(t,i.submodulePath,i.innerPath,i.staged,s,`full`):await U.projectSubmoduleFileDiff(n,i.submodulePath,i.innerPath,i.staged,s,`full`):t?await U.getFileDiff(t,r,a.staged,s,`full`):await U.projectFileDiff(n,r,a.staged,s,`full`);return c.isOk()&&!s?.aborted?{oldValue:pn(c.value.diff),newValue:mn(c.value.diff),rawDiff:c.value.diff}:null},[e,o,t,n,m]);return(0,Q.useEffect)(()=>{r&&!h.has(r)&&!D.current&&j(r)},[r]),(0,Q.useEffect)(()=>{i&&!h.has(i)&&j(i)},[i]),(0,Q.useEffect)(()=>{a&&O.current&&(O.current=!1,A())},[a]),(0,Q.useEffect)(()=>{if(!a||!e||o.length>0||x){(!e||o.length>0)&&(k.current=null);return}let r=[t??n??`unknown`,d??0,f??0,p??0].join(`:`);k.current!==r&&(k.current=r,A())},[a,e,t,n,d,f,p,o.length,x,C,A]),La(t,A,2e3,a),{diffCache:h,loadingDiff:_,loading:x,loadError:C,truncatedInfo:y,setDiffCache:g,setLoadError:w,abortRef:T,needsRefreshRef:O,refresh:A,loadDiffForFile:j,requestFullDiff:M}}function za({summaries:e,fileSearch:t,fileSearchCaseSensitive:n,effectiveThreadId:r,projectModeId:i}){let[a,o]=(0,Q.useState)(new Set),[s,c]=(0,Q.useState)(new Set),[l,u]=(0,Q.useState)(new Map),[d,f]=(0,Q.useState)(new Map),p=(0,Q.useCallback)(e=>{for(let[t,n]of l){let r=`${t}/`;if(!e.startsWith(r))continue;let i=e.slice(r.length),a=n.find(e=>e.path===i);if(a)return{submodulePath:t,innerPath:i,staged:a.staged}}return null},[l]),m=(0,Q.useMemo)(()=>{if(!t)return e;if(n)return e.filter(e=>e.path.includes(t));let r=t.toLowerCase();return e.filter(e=>e.path.toLowerCase().includes(r))},[e,t,n]),h=(0,Q.useCallback)(async e=>{let t=s.has(e);if(c(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),!t&&!l.has(e)){f(t=>{let n=new Map(t);return n.set(e,{state:`loading`}),n});try{let t=r?await U.getSubmoduleDiffSummary(r,e):i?await U.projectSubmoduleDiffSummary(i,e):null;if(!t)return;if(t.isErr()){f(n=>{let r=new Map(n);return r.set(e,{state:`error`,message:t.error.message}),r});return}let n=t.value;n.files.length===0?f(t=>{let n=new Map(t);return n.set(e,{state:`empty`}),n}):(u(t=>{let r=new Map(t);return r.set(e,n.files),r}),f(t=>{let n=new Map(t);return n.delete(e),n}))}catch(t){f(n=>{let r=new Map(n);return r.set(e,{state:`error`,message:t instanceof Error?t.message:String(t)}),r})}}},[s,l,r,i]),g=(0,Q.useMemo)(()=>cn(m,a,l,d,s),[m,a,l,d,s]),_=(0,Q.useCallback)(e=>{o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=(0,Q.useCallback)(()=>{o(ln(m))},[m]),y=(0,Q.useCallback)(()=>{o(new Set)},[]),b=(0,Q.useMemo)(()=>g.some(e=>e.kind===`folder`),[g]),x=(0,Q.useMemo)(()=>b?g.every(e=>e.kind!==`folder`||a.has(e.path)):!1,[g,a,b]),S=(0,Q.useMemo)(()=>g.filter(e=>e.kind===`file`),[g]);return{filteredDiffs:m,collapsedFolders:a,toggleFolder:_,handleCollapseAllFolders:v,handleExpandAllFolders:y,hasFolders:b,allFoldersCollapsed:x,expandedSubmodules:s,submoduleExpansions:l,toggleSubmodule:h,resolveSubmoduleEntry:p,treeRows:g,visibleFiles:S,visiblePaths:(0,Q.useMemo)(()=>new Set(S.map(e=>e.file.path)),[S])}}function Ba({hasGitContext:e,draftId:t,effectiveThreadId:n,projectModeId:r,setCommitTitle:i,setCommitBody:a}){let{t:o}=H(),s=Tn(e=>t?e.generatingCommitMsg[t]??!1:!1),c=Tn(e=>e.setGeneratingCommitMsg),l=(0,Q.useRef)(null);return{generatingMsg:s,handleGenerateCommitMsg:(0,Q.useCallback)(async()=>{if(!e||s)return;let u=t,d=n,f=r;if(!u)return;l.current?.abort();let p=new AbortController;l.current=p,c(u,!0);try{let e=d?await U.generateCommitMessage(d,!0,p.signal):await U.projectGenerateCommitMessage(f,!0,p.signal);if(p.signal.aborted)return;e.isOk()?(ut.getState().setCommitDraft(u,e.value.title,e.value.body),(rt.getState().selectedThreadId||Ye.getState().selectedProjectId)===u&&(i(e.value.title),a(e.value.body))):p.signal.aborted||Z.error(o(`review.generateFailed`,{message:e.error.message}))}finally{c(u,!1),l.current===p&&(l.current=null)}},[e,s,t,n,r,c,i,a,o]),abortGenerate:(0,Q.useCallback)(()=>{l.current?.abort()},[])}}function Va({remoteCheckProjectId:e,hasRemoteBranch:t}){let[n,r]=(0,Q.useState)(void 0),[i,a]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(!e){r(void 0);return}if(t){r(`exists`);return}let n=new AbortController;return U.projectGetRemoteUrl(e,n.signal).then(e=>{!n.signal.aborted&&e.isOk()&&r(e.value.remoteUrl)}),()=>n.abort()},[e,t]),{remoteUrl:n,publishDialogOpen:i,setPublishDialogOpen:a,handlePublishSuccess:(0,Q.useCallback)(t=>{r(t),a(!1),e&&pt.getState().fetchProjectStatus(e,!0),Z.success(`Repository ready`)},[e])}}var Ha=Be(`review-actions`);function Ua({hasGitContext:e,effectiveThreadId:t,projectModeId:n,summaries:r,checkedFiles:i,expandedFile:a,selectedFile:o,baseBranch:s,basePath:c,refresh:l,loadDiffForFile:u,setDiffCache:d,setHasRebaseConflict:f,setConfirmDialog:p,refreshStashList:m}){let{t:h}=H(),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)({open:!1,errorMessage:``}),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(new Map),[A,j]=(0,Q.useState)(0),[M,N]=(0,Q.useState)(0),P=(0,Q.useCallback)(e=>p({type:`revert`,path:e}),[p]),F=(0,Q.useCallback)(async r=>{if(!e)return;let i=t?await U.revertFiles(t,[r]):await U.projectRevertFiles(n,[r]);i.isErr()?Z.error(h(`review.revertFailed`,{message:i.error.message})):(Z.success(h(`review.revertSuccess`,{path:r,defaultValue:`{{path}} reverted`})),await l())},[e,t,n,l,h]),I=(0,Q.useCallback)(()=>{let e=i.size>0?Array.from(i):r.map(e=>e.path);e.length!==0&&p({type:`discard-all`,paths:e})},[i,r,p]),L=(0,Q.useCallback)(e=>{let t=e.endsWith(`/`)?e:`${e}/`,n=r.map(e=>e.path).filter(e=>e.startsWith(t));n.length!==0&&p({type:`discard-all`,paths:n})},[r,p]),ee=(0,Q.useCallback)(async r=>{if(!e)return;let i=t?await U.revertFiles(t,r):await U.projectRevertFiles(n,r);i.isErr()?Z.error(h(`review.revertFailed`,{message:i.error.message})):(Z.success(h(`review.discardSuccess`,{count:r.length,defaultValue:`{{count}} file(s) discarded`})),await l())},[e,t,n,l,h]),te=(0,Q.useCallback)(()=>{let e=i.size>0?Array.from(i):r.map(e=>e.path);e.length!==0&&p({type:`ignore`,paths:e})},[i,r,p]),ne=(0,Q.useCallback)(async r=>{if(!e)return;let i=t?await U.addPatternsToGitignore(t,r):await U.projectAddPatternsToGitignore(n,r);i.isErr()?Z.error(`Failed to update .gitignore: ${i.error.message}`):(Z.success(`${r.length} path(s) added to .gitignore`),await l())},[e,t,n,l]),re=(0,Q.useCallback)(async r=>{if(!e)return;let i=t?await U.addToGitignore(t,r):await U.projectAddToGitignore(n,r);i.isErr()?Z.error(h(`review.ignoreFailed`,{message:i.error.message})):(Z.success(h(`review.ignoreSuccess`)),await l())},[e,t,n,l,h]),ie=(0,Q.useCallback)(async()=>{if(!e||w)return;T(!0);let r=t?await U.resetSoft(t):await U.projectResetSoft(n);r.isErr()?Z.error(h(`review.resetSoftFailed`,{message:r.error.message,defaultValue:`Reset failed: ${r.error.message}`})):Z.success(h(`review.resetSoftSuccess`,`Last commit undone`)),T(!1),await l()},[e,w,t,n,l,h]),R=(0,Q.useCallback)(async r=>{e&&((t?await U.stageFiles(t,[r]):await U.projectStageFiles(n,[r])).isErr()?Z.error(h(`review.stageFailed`,{path:r,defaultValue:`Failed to stage {{path}}`})):(Z.success(h(`review.stageSuccess`,{path:r,defaultValue:`{{path}} staged`})),await l()))},[e,t,n,l,h]),ae=(0,Q.useCallback)(async r=>{e&&((t?await U.unstageFiles(t,[r]):await U.projectUnstageFiles(n,[r])).isErr()?Z.error(h(`review.unstageFailed`,{path:r,defaultValue:`Failed to unstage {{path}}`})):(Z.success(h(`review.unstageSuccess`,{path:r,defaultValue:`{{path}} unstaged`})),await l()))},[e,t,n,l,h]),oe=(0,Q.useCallback)(async()=>{if(!e)return;let a=i.size>0?Array.from(i).filter(e=>{let t=r.find(t=>t.path===e);return t&&!t.staged}):r.filter(e=>!e.staged).map(e=>e.path);if(a.length===0){Z.info(h(`review.allAlreadyStaged`,{defaultValue:`All files already staged`}));return}(t?await U.stageFiles(t,a):await U.projectStageFiles(n,a)).isErr()?Z.error(h(`review.stageFailed`,{path:`${a.length} files`,defaultValue:`Failed to stage {{path}}`})):(Z.success(h(`review.stageSelectedSuccess`,{count:a.length,defaultValue:`{{count}} file(s) staged`})),await l())},[e,i,r,t,n,l,h]),se=(0,Q.useCallback)(async()=>{if(!e)return;let a=i.size>0?Array.from(i).filter(e=>{let t=r.find(t=>t.path===e);return t&&t.staged}):r.filter(e=>e.staged).map(e=>e.path);if(a.length===0){Z.info(h(`review.noneStaged`,{defaultValue:`No staged files to unstage`}));return}(t?await U.unstageFiles(t,a):await U.projectUnstageFiles(n,a)).isErr()?Z.error(h(`review.unstageFailed`,{path:`${a.length} files`,defaultValue:`Failed to unstage {{path}}`})):(Z.success(h(`review.unstageSelectedSuccess`,{count:a.length,defaultValue:`{{count}} file(s) unstaged`})),await l())},[e,i,r,t,n,l,h]),ce=(0,Q.useCallback)(async r=>{if(!e)return;D(!0);let i=t?await U.stagePatch(t,r):await U.projectStagePatch(n,r);D(!1),i.isErr()?gt(i.error,h(`review.stageFailed`,{path:`selected lines`,defaultValue:`Failed to stage {{path}}`})):(Z.success(h(`review.stageLinesSuccess`,{defaultValue:`Selected lines staged`})),await l())},[e,t,n,l,h]),le=(0,Q.useCallback)((e,t)=>{k(n=>{if(n.get(e)===t)return n;let r=new Map(n);return r.set(e,t),r})},[]),z=(0,Q.useCallback)(async(r,i)=>{let s=a||o;if(!s||!e)return;let c=i===`ours`?`current`:i===`theirs`?`incoming`:`both`,f=t?await U.resolveConflict(t,s,r,i):await U.projectResolveConflict(n,s,r,i);f.isErr()?Z.error(`Failed to resolve conflict: ${f.error.message}`):(Z.success(`Conflict ${r+1} resolved (${c})`+(f.value.remainingConflicts>0?` — ${f.value.remainingConflicts} remaining`:` — file resolved`)),d(e=>{let t=new Map(e);return t.delete(s),t}),u(s),await l())},[a,o,e,t,n,l,u,d]),B=(0,Q.useCallback)(async()=>{if(!t)return;let e=h(`review.agentResolvePrompt`,{target:s||`main`}),{allowedTools:n,disallowedTools:r}=Ve(ze.getState().toolPermissions),i=await Pe.sendMessage(t,e,{allowedTools:n,disallowedTools:r});if(i.isErr()){gt(i.error);return}Z.success(h(`review.agentResolveSent`)),f(!1)},[t,s,f,h]),V=(0,Q.useCallback)(()=>{if(!t)return;let e=Xt(t)?.worktreePath;if(!e)return;let n=ze.getState().defaultEditor;Ie.openInEditor(e,n)},[t]),ue=(0,Q.useCallback)(async e=>{let r=t?await U.pull(t,e):await U.projectPull(n,e);if(r.isErr()){let t=r.error.message;if(e===`ff-only`&&Ri(t)){y({open:!0,errorMessage:t});return}Z.error(h(`review.pullFailed`,{message:t,defaultValue:`Pull failed: ${t}`}))}else Z.success(h(`review.pullSuccess`,`Pulled successfully`));t?pt.getState().fetchForThread(t,!0):n&&pt.getState().fetchProjectStatus(n,!0),await l()},[t,n,l,h]);return{pullInProgress:g,fetchInProgress:b,stashInProgress:S,resetInProgress:w,patchStagingInProgress:E,pullStrategyDialog:v,setPullStrategyDialog:y,fileSelectionState:O,setFileSelectionState:k,selectAllSignal:A,setSelectAllSignal:j,deselectAllSignal:M,setDeselectAllSignal:N,handleRevertFile:P,executeRevert:F,handleDiscardAll:I,handleDiscardFolder:L,executeDiscardAll:ee,handleIgnoreFiles:te,executeIgnoreFiles:ne,handleIgnore:re,executeResetSoft:ie,handleStageFile:R,handleUnstageFile:ae,handleStageSelected:oe,handleUnstageAll:se,handleStagePatch:ce,handleSelectionStateChange:le,handleResolveConflict:z,handleAskAgentResolve:B,handleOpenInEditorConflict:V,handlePull:(0,Q.useCallback)(async()=>{if(!(!e||g)){_(!0);try{await ue(`ff-only`)}finally{_(!1)}}},[e,g,ue]),handlePullStrategyChosen:(0,Q.useCallback)(async e=>{if(y({open:!1,errorMessage:``}),!g){_(!0);try{await ue(e)}finally{_(!1)}}},[g,ue]),handleFetchOrigin:(0,Q.useCallback)(async()=>{if(!e||b)return;x(!0);let r=t?await U.fetchOrigin(t):await U.projectFetchOrigin(n);if(r.isErr()){let e=r.error.message,t=/auth|token|credential|permission|denied|403|fatal:/i.test(e)||r.error.type===`INTERNAL`;Z.error(t?h(`review.fetchAuthFailed`,{defaultValue:`Fetch failed: authentication error. Check your GitHub token in Settings > Profile.`}):h(`review.fetchFailed`,{message:e,defaultValue:`Fetch failed: ${e}`}))}else Z.success(h(`review.fetchSuccess`,`Fetched from origin`));x(!1),t?pt.getState().fetchForThread(t,!0):n&&pt.getState().fetchProjectStatus(n,!0),await l()},[e,b,t,n,l,h]),handleStash:(0,Q.useCallback)(async()=>{if(!e||S)return;C(!0);let r=t?await U.stash(t):await U.projectStash(n);r.isErr()?Z.error(h(`review.stashFailed`,{message:r.error.message,defaultValue:`Stash failed: ${r.error.message}`})):Z.success(h(`review.stashSuccess`,`Changes stashed`)),C(!1),await l(),m()},[e,S,t,n,l,m,h]),handleStashSelected:(0,Q.useCallback)(async()=>{if(!e||S)return;let a=i.size>0?Array.from(i):r.map(e=>e.path);if(a.length===0)return;C(!0);let o=t?await U.stash(t,a):await U.projectStash(n,a);o.isErr()?Z.error(h(`review.stashFailed`,{message:o.error.message,defaultValue:`Stash failed: ${o.error.message}`})):Z.success(h(`review.stashSelectedSuccess`,{count:a.length,defaultValue:`{{count}} file(s) stashed`})),C(!1),await l(),m()},[e,S,i,r,t,n,l,m,h]),handleCopyPath:(0,Q.useCallback)((e,t)=>{let n=t?e:c?`${c}/${e}`:e;navigator.clipboard.writeText(n),Z.success(h(`review.pathCopied`))},[c,h]),handleOpenDirectory:(0,Q.useCallback)(async(e,t)=>{if(!c)return;let n=t?e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``:e,r=n?`${c}/${n}`:c,i=await Ie.openDirectory({path:r});i.isErr()&&(Ha.error(`Failed to open directory`,{path:r,error:String(i.error)}),Z.error(h(`review.openDirectoryError`,`Failed to open directory`)))},[c,h])}}function Wa({hasGitContext:e,effectiveThreadId:t,projectModeId:n,currentBranch:r,abortRef:i,reviewPaneOpen:a,reviewSubTab:o,refresh:s,gitContextKey:c}){let[l,u]=(0,Q.useState)([]),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(``),[k,A]=(0,Q.useState)(!1),j=(0,Q.useMemo)(()=>r?l.filter(e=>{let t=e.message.match(/^(?:WIP )?[Oo]n ([^:]+):/);return t?t[1]===r:!0}):l,[l,r]),M=(0,Q.useCallback)(async()=>{if(!e)return;let r=i.current?.signal,a=t?await U.stashList(t,r):await U.projectStashList(n,r);a.isOk()&&!r?.aborted&&u(a.value.entries)},[e,t,n,i]),N=(0,Q.useCallback)(async()=>{if(!e||d)return;f(!0);let r=t?await U.stashPop(t):await U.projectStashPop(n);r.isErr()?Z.error(`Stash pop failed: ${r.error.message}`):Z.success(`Stash applied`),f(!1),await s(),M()},[e,d,t,n,s,M]),P=(0,Q.useCallback)(async r=>{if(!e||p)return;m(r);let i=t?await U.stashDrop(t,r):await U.projectStashDrop(n,r);i.isErr()?Z.error(`Drop stash failed: ${i.error.message}`):Z.success(`Stash discarded`),m(null),g(null),v([]),await s(),M()},[e,p,t,n,s,M]),F=(0,Q.useCallback)(async(r,i)=>{if(!e)return;S(i),E(!0),w(null);let a=t?await U.stashFileDiff(t,r,i):await U.projectStashFileDiff(n,r,i);a.isOk()?w(a.value.diff):Z.error(`Failed to load diff: ${a.error.message}`),E(!1)},[e,t,n]);(0,Q.useEffect)(()=>{a&&o===`stash`&&M()},[c,a,o]),(0,Q.useEffect)(()=>{if(!h||!e){v([]),S(null),w(null),O(``);return}let r=!1;return b(!0),O(``),(async()=>{let e=t?await U.stashShow(t,h):await U.projectStashShow(n,h);if(!r){if(e.isOk()){if(v(e.value.files),e.value.files.length>0){let i=e.value.files[0].path;S(i),E(!0),w(null);let a=t?await U.stashFileDiff(t,h,i):await U.projectStashFileDiff(n,h,i);!r&&a.isOk()&&w(a.value.diff),r||E(!1)}}else Z.error(`Failed to load stash files: ${e.error.message}`),v([]);r||b(!1)}})(),()=>{r=!0}},[h,e,t,n]);let I=(0,Q.useMemo)(()=>{let e=_.map(e=>({path:e.path,status:`modified`,staged:!1,additions:e.additions,deletions:e.deletions}));if(!D.trim())return e;if(k)return e.filter(e=>e.path.includes(D));let t=D.toLowerCase();return e.filter(e=>e.path.toLowerCase().includes(t))},[_,D,k]);return{stashEntries:l,filteredStashEntries:j,selectedStashIndex:h,setSelectedStashIndex:g,selectedStashEntry:(0,Q.useMemo)(()=>h?l.find(e=>e.index.replace(`stash@{`,``).replace(`}`,``)===h)??null:null,[h,l]),stashFiles:_,stashTreeFiles:I,stashFilesLoading:y,stashDialogFile:x,stashDialogDiff:C,stashDialogDiffLoading:T,stashDialogDiffCache:(0,Q.useMemo)(()=>{let e=new Map;return x&&C&&e.set(x,C),e},[x,C]),stashFileSearch:D,setStashFileSearch:O,stashFileSearchCaseSensitive:k,setStashFileSearchCaseSensitive:A,stashPopInProgress:d,stashDropInProgress:p,handleStashPop:N,executeStashDrop:P,loadStashFileDiff:F,refreshStashList:M}}function Ga(e){let{effectiveThreadId:t,projectModeId:n,hasGitContext:r,gitContextKey:i,threadProjectId:a,selectedProjectId:o,baseBranch:s,threadBranch:c,currentBranch:l,basePath:u,isAgentRunning:d,gitStatus:f,unpushedCommitCount:p,remoteCheckProjectId:m,reviewPaneOpen:h,reviewSubTab:g,setReviewPaneOpen:_,setConfirmDialog:v}=e,[y,b]=(0,Q.useState)([]),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(!1),[k,A]=(0,Q.useState)(new Set),j=t||n,{commitTitle:M,commitBody:N,setCommitTitle:P,setCommitBody:F,commitTitleRef:I,commitBodyRef:L}=Fa(j),{generatingMsg:ee,handleGenerateCommitMsg:te,abortGenerate:ne}=Ba({hasGitContext:r,draftId:j,effectiveThreadId:t,projectModeId:n,setCommitTitle:P,setCommitBody:F}),{remoteUrl:re,publishDialogOpen:ie,setPublishDialogOpen:R,handlePublishSuccess:ae}=Va({remoteCheckProjectId:m,hasRemoteBranch:f?.hasRemoteBranch}),oe=!!t&&!!s&&!!c&&c!==s,{filteredDiffs:se,collapsedFolders:ce,toggleFolder:le,handleCollapseAllFolders:z,handleExpandAllFolders:B,hasFolders:V,allFoldersCollapsed:ue,expandedSubmodules:de,submoduleExpansions:fe,toggleSubmodule:pe,resolveSubmoduleEntry:me,treeRows:he,visibleFiles:ge,visiblePaths:_e}=za({summaries:y,fileSearch:T,fileSearchCaseSensitive:D,effectiveThreadId:t,projectModeId:n}),{diffCache:ve,loadingDiff:ye,loading:be,loadError:xe,truncatedInfo:Se,setDiffCache:Ce,setLoadError:we,abortRef:Te,needsRefreshRef:Ee,refresh:De,loadDiffForFile:Oe,requestFullDiff:ke}=Ra({hasGitContext:r,effectiveThreadId:t,projectModeId:n,selectedFile:x,expandedFile:C,reviewPaneOpen:h,summaries:y,setSummaries:b,submoduleExpansions:fe,setSelectedFile:S,setCheckedFiles:A,dirtyFileCount:f?.dirtyFileCount,linesAdded:f?.linesAdded,linesDeleted:f?.linesDeleted}),Ae=Wa({hasGitContext:r,effectiveThreadId:t,projectModeId:n,currentBranch:l,abortRef:Te,reviewPaneOpen:h,reviewSubTab:g,refresh:De,gitContextKey:i??``}),{selectedAction:je,setSelectedAction:Me,actionInProgress:H,setActionInProgress:Ne,pushInProgress:U,mergeInProgress:Pe,prInProgress:W,prDialog:G,setPrDialog:Fe,mergeDialog:Ie,setMergeDialog:K,hasRebaseConflict:Le,setHasRebaseConflict:Re,justCompletedWorkflowRef:ze,commitInProgress:Be,commitEntry:q,commitProgressId:J,handleCommitAction:Ve,handlePushOnly:Y,openMergeDialog:He,handleMergeWithTarget:Ue,handleCreatePROnly:We}=Ia({hasGitContext:r,effectiveThreadId:t,projectModeId:n,threadProjectId:a,selectedProjectId:o,summaries:y,checkedFiles:k,commitTitle:M,commitBody:N,draftId:j,setCommitTitle:P,setCommitBody:F,baseBranch:s,threadBranch:c,currentBranch:l,refresh:De}),{pullInProgress:Ge,fetchInProgress:Ke,stashInProgress:qe,resetInProgress:Je,patchStagingInProgress:Ye,pullStrategyDialog:Xe,setPullStrategyDialog:Ze,fileSelectionState:Qe,setFileSelectionState:$e,selectAllSignal:et,setSelectAllSignal:X,deselectAllSignal:tt,setDeselectAllSignal:nt,handleRevertFile:rt,executeRevert:it,handleDiscardAll:at,handleDiscardFolder:ot,executeDiscardAll:st,handleIgnoreFiles:ct,executeIgnoreFiles:lt,handleIgnore:ut,executeResetSoft:dt,handleStageFile:ft,handleUnstageFile:pt,handleStageSelected:Z,handleUnstageAll:mt,handleStagePatch:ht,handleSelectionStateChange:gt,handleResolveConflict:_t,handleAskAgentResolve:vt,handleOpenInEditorConflict:yt,handlePull:bt,handlePullStrategyChosen:xt,handleFetchOrigin:St,handleStash:Ct,handleStashSelected:wt,handleCopyPath:Tt,handleOpenDirectory:Et}=Ua({hasGitContext:r,effectiveThreadId:t,projectModeId:n,summaries:y,checkedFiles:k,expandedFile:C,selectedFile:x,baseBranch:s,basePath:u,refresh:De,loadDiffForFile:Oe,setDiffCache:Ce,setHasRebaseConflict:Re,setConfirmDialog:v,refreshStashList:Ae.refreshStashList});(0,Q.useEffect)(()=>{ze.current&&!be&&y.length===0&&Ae.stashEntries.length===0&&p===0&&!Le&&(ze.current=!1,_(!1))},[be,y.length,Ae.stashEntries.length,p,Le,_,ze]);let Dt=(0,Q.useRef)(void 0),Ot=(0,Q.useRef)(void 0);return(0,Q.useEffect)(()=>{let e=i!==Dt.current,t=l!==Ot.current,n=!e&&t&&Ot.current===void 0&&l!==void 0;Dt.current=i,Ot.current=l,!n&&(Te.current?.abort(),ne(),b([]),Ce(new Map),S(null),A(new Set),E(``),Re(!1),we(!1),Me(`commit`),h?De():Ee.current=!0)},[i,l]),(0,Q.useEffect)(()=>{je===`commit-pr`&&f?.prNumber&&Me(`commit`)},[je,f?.prNumber,Me]),{summaries:y,setSummaries:b,selectedFile:x,setSelectedFile:S,expandedFile:C,setExpandedFile:w,fileSearch:T,setFileSearch:E,fileSearchCaseSensitive:D,setFileSearchCaseSensitive:O,checkedFiles:k,setCheckedFiles:A,checkedCount:[...k].filter(e=>_e.has(e)).length,totalCount:ge.length,toggleFile:(0,Q.useCallback)(e=>{A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),toggleAll:(0,Q.useCallback)(()=>{let e=_e;[...e].every(e=>k.has(e))?A(t=>{let n=new Set(t);for(let t of e)n.delete(t);return n}):A(t=>new Set([...t,...e]))},[_e,k]),canCommit:k.size>0&&M.trim().length>0&&!H&&(t?!0:!d),isOnDifferentBranch:oe,commitTitle:M,commitBody:N,setCommitTitle:P,setCommitBody:F,commitTitleRef:I,commitBodyRef:L,generatingMsg:ee,handleGenerateCommitMsg:te,abortGenerate:ne,remoteUrl:re,publishDialogOpen:ie,setPublishDialogOpen:R,handlePublishSuccess:ae,filteredDiffs:se,collapsedFolders:ce,toggleFolder:le,handleCollapseAllFolders:z,handleExpandAllFolders:B,hasFolders:V,allFoldersCollapsed:ue,expandedSubmodules:de,submoduleExpansions:fe,toggleSubmodule:pe,resolveSubmoduleEntry:me,treeRows:he,visibleFiles:ge,visiblePaths:_e,diffCache:ve,loadingDiff:ye,loading:be,loadError:xe,truncatedInfo:Se,setDiffCache:Ce,setLoadError:we,abortRef:Te,needsRefreshRef:Ee,refresh:De,loadDiffForFile:Oe,requestFullDiff:ke,stash:Ae,selectedAction:je,setSelectedAction:Me,actionInProgress:H,setActionInProgress:Ne,pushInProgress:U,mergeInProgress:Pe,prInProgress:W,prDialog:G,setPrDialog:Fe,mergeDialog:Ie,setMergeDialog:K,hasRebaseConflict:Le,setHasRebaseConflict:Re,commitInProgress:Be,commitEntry:q,commitProgressId:J,handleCommitAction:Ve,handlePushOnly:Y,openMergeDialog:He,handleMergeWithTarget:Ue,handleCreatePROnly:We,pullInProgress:Ge,fetchInProgress:Ke,stashInProgress:qe,resetInProgress:Je,patchStagingInProgress:Ye,pullStrategyDialog:Xe,setPullStrategyDialog:Ze,fileSelectionState:Qe,setFileSelectionState:$e,selectAllSignal:et,setSelectAllSignal:X,deselectAllSignal:tt,setDeselectAllSignal:nt,handleRevertFile:rt,executeRevert:it,handleDiscardAll:at,handleDiscardFolder:ot,executeDiscardAll:st,handleIgnoreFiles:ct,executeIgnoreFiles:lt,handleIgnore:ut,executeResetSoft:dt,handleStageFile:ft,handleUnstageFile:pt,handleStageSelected:Z,handleUnstageAll:mt,handleStagePatch:ht,handleSelectionStateChange:gt,handleResolveConflict:_t,handleAskAgentResolve:vt,handleOpenInEditorConflict:yt,handlePull:bt,handlePullStrategyChosen:xt,handleFetchOrigin:St,handleStash:Ct,handleStashSelected:wt,handleCopyPath:Tt,handleOpenDirectory:Et}}var Ka=768;function qa(){let[e,t]=Q.useState(void 0);return Q.useEffect(()=>{let e=window.matchMedia(`(max-width: ${Ka-1}px)`),n=()=>{t(window.innerWidth<Ka)};return e.addEventListener(`change`,n),t(window.innerWidth<Ka),()=>e.removeEventListener(`change`,n)},[]),!!e}function Ja({expandedFile:e,expandedSummary:t,expandedDiffContent:n,ExpandedIcon:r,onClose:i,onFileSelect:a,fileSearch:o,setFileSearch:s,fileSearchCaseSensitive:c,setFileSearchCaseSensitive:l,filteredDiffs:u,summaries:d,checkedFiles:f,toggleFile:p,onRevertFile:m,onIgnore:h,basePath:g,loadingDiff:_,diffCache:v,prThreads:y,requestFullDiff:b,handleResolveConflict:x,handleStagePatch:S,patchStagingInProgress:C,handleSelectionStateChange:w,selectAllSignal:T,deselectAllSignal:E}){let{t:D}=H();return(0,$.jsx)(Ze,{open:!!e,onOpenChange:e=>{e||i()},children:(0,$.jsxs)(Vt,{className:`flex h-[85vh] max-w-[90vw] flex-col gap-0 p-0 duration-0 data-[state=closed]:animate-none data-[state=open]:animate-none`,overlayClassName:`data-[state=closed]:animate-none data-[state=open]:animate-none`,"data-testid":`expanded-diff-overlay`,children:[(0,$.jsx)(We,{className:`sr-only`,children:t?.path??D(`review.diffViewer`,`Diff viewer`)}),(0,$.jsx)(tt,{className:`sr-only`,children:D(`review.diffViewerDescription`,`View and stage changes for the selected file`)}),e&&(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`border-border flex w-[280px] shrink-0 flex-col border-r`,"data-testid":`expanded-diff-file-tree`,children:[(0,$.jsx)(`div`,{className:`border-sidebar-border shrink-0 border-b px-2 py-1`,children:(0,$.jsx)(It,{query:o,onQueryChange:s,placeholder:D(`review.searchFiles`,`Filter files…`),totalMatches:u.length,resultLabel:o?`${u.length}/${d.length}`:``,caseSensitive:c,onCaseSensitiveChange:l,onClose:o?()=>s(``):void 0,autoFocus:!1,testIdPrefix:`expanded-diff-file-filter`})}),(0,$.jsx)(jt,{className:`min-h-0 flex-1`,children:(0,$.jsx)(un,{files:u,selectedFile:e,onFileClick:a,checkedFiles:f,onToggleFile:p,onRevertFile:m,onIgnore:h,basePath:g,searchQuery:o||void 0,testIdPrefix:`expanded-diff`})})]}),(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,$.jsx)(fn,{filePath:t?.path||``,oldValue:n?pn(n):``,newValue:n?mn(n):``,icon:r,loading:_===e,rawDiff:n,files:d,diffCache:v,onClose:i,prReviewThreads:y,onRequestFullDiff:b,onResolveConflict:x,selectable:!0,onStagePatch:S,stagingInProgress:C,onSelectionStateChange:w,selectAllSignal:T,deselectAllSignal:E})})]})]})})}function Ya({expandedFile:e,expandedSummary:t,expandedDiffContent:n,ExpandedIcon:r,onClose:i,onFileSelect:a,filteredDiffs:o,summaries:s,loadingDiff:c,diffCache:l,prThreads:u,requestFullDiff:d,handleResolveConflict:f}){let{t:p}=H();if(!e)return null;let m=o.findIndex(t=>t.path===e),h=m>0,_=m>=0&&m<o.length-1;return(0,$.jsxs)(`div`,{className:`bg-background fixed inset-0 z-[60] flex flex-col`,"data-testid":`mobile-diff-overlay`,children:[(0,$.jsxs)(`header`,{className:`border-border flex h-12 shrink-0 items-center gap-1 border-b px-2`,children:[(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,onClick:i,"aria-label":p(`common.back`,`Back`),"data-testid":`mobile-diff-back`,children:(0,$.jsx)(g,{className:`icon-lg`})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1`}),m>=0&&(0,$.jsxs)(`span`,{className:`text-muted-foreground shrink-0 px-1 text-xs tabular-nums`,"data-testid":`mobile-diff-position`,children:[m+1,`/`,o.length]}),(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,onClick:()=>{h&&a(o[m-1].path)},disabled:!h,"aria-label":p(`review.previousFile`,`Previous file`),"data-testid":`mobile-diff-prev`,children:(0,$.jsx)(ae,{className:`icon-lg`})}),(0,$.jsx)(Y,{variant:`ghost`,size:`icon`,onClick:()=>{_&&a(o[m+1].path)},disabled:!_,"aria-label":p(`review.nextFile`,`Next file`),"data-testid":`mobile-diff-next`,children:(0,$.jsx)(se,{className:`icon-lg`})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,$.jsx)(fn,{filePath:t?.path||``,oldValue:n?pn(n):``,newValue:n?mn(n):``,icon:r,loading:c===e,rawDiff:n,files:s,diffCache:l,prReviewThreads:u,onRequestFullDiff:d,onResolveConflict:f,initialViewMode:`unified`})})]})}function Xa(e){return qa()?(0,$.jsx)(Ya,{expandedFile:e.expandedFile,expandedSummary:e.expandedSummary,expandedDiffContent:e.expandedDiffContent,ExpandedIcon:e.ExpandedIcon,onClose:e.onClose,onFileSelect:e.onFileSelect,filteredDiffs:e.filteredDiffs,summaries:e.summaries,loadingDiff:e.loadingDiff,diffCache:e.diffCache,prThreads:e.prThreads,requestFullDiff:e.requestFullDiff,handleResolveConflict:e.handleResolveConflict}):(0,$.jsx)(Ja,{...e})}function Za({prDialog:e,setPrDialog:t,threadBranch:n,baseBranch:r,prInProgress:i,handleCreatePROnly:a}){let{t:o}=H();return(0,$.jsx)(Ze,{open:!!e,onOpenChange:e=>{e||t(null)},children:(0,$.jsxs)(Vt,{className:`max-w-sm`,children:[(0,$.jsxs)(_t,{children:[(0,$.jsx)(We,{children:o(`review.createPR`)}),(0,$.jsx)(tt,{children:o(`review.createPRTooltip`,{branch:n,target:r||`base`})})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(sn,{placeholder:o(`review.prTitle`,`PR title`),"data-testid":`review-pr-title`,value:e?.title??``,onChange:e=>t(t=>t&&{...t,title:e.target.value})}),(0,$.jsx)(`textarea`,{className:`border-input bg-background placeholder:text-muted-foreground focus-visible:ring-ring/50 w-full resize-none rounded-md border px-2 py-1.5 text-xs focus-visible:ring-1 focus-visible:outline-hidden`,rows:4,placeholder:o(`review.commitBody`,`Description (optional)`),"data-testid":`review-pr-body`,value:e?.body??``,onChange:e=>t(t=>t&&{...t,body:e.target.value})})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,$.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>t(null),"data-testid":`review-pr-cancel`,children:o(`common.cancel`,`Cancel`)}),(0,$.jsxs)(Y,{size:`sm`,disabled:!e?.title.trim()||i,onClick:a,"data-testid":`review-pr-create`,children:[i?(0,$.jsx)(m,{className:`icon-sm mr-1.5 animate-spin`}):(0,$.jsx)(ge,{className:`icon-sm mr-1.5`}),o(`review.createPR`)]})]})]})})}function Qa({mergeDialog:e,setMergeDialog:t,currentBranch:n,mergeInProgress:r,handleMergeWithTarget:i}){let{t:a}=H();return(0,$.jsx)(Ze,{open:!!e,onOpenChange:e=>{e||t(null)},children:(0,$.jsxs)(Vt,{className:`max-w-sm`,children:[(0,$.jsxs)(_t,{children:[(0,$.jsx)(We,{children:a(`review.mergeIntoBranch`,{target:``,defaultValue:`Merge into branch`})}),(0,$.jsx)(tt,{children:a(`review.mergeDescription`,{source:n,defaultValue:`Merge ${n} into the selected target branch.`})})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`label`,{className:`text-muted-foreground text-xs font-medium`,children:a(`review.targetBranch`,`Target branch`)}),e?.loading?(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 py-2 text-xs`,children:[(0,$.jsx)(m,{className:`icon-sm animate-spin`}),a(`common.loading`,`Loading...`)]}):(0,$.jsxs)(Wt,{value:e?.targetBranch,onValueChange:e=>t(t=>t?{...t,targetBranch:e}:null),children:[(0,$.jsx)(Bt,{className:`h-8 text-xs`,"data-testid":`review-merge-target-select`,children:(0,$.jsx)(Lt,{placeholder:a(`review.selectBranch`,`Select branch`)})}),(0,$.jsx)(Tt,{children:e?.branches.map(e=>(0,$.jsx)(qt,{value:e,className:`text-xs`,children:e},e))})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,$.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>t(null),"data-testid":`review-merge-cancel`,children:a(`common.cancel`,`Cancel`)}),(0,$.jsxs)(Y,{size:`sm`,disabled:!e?.targetBranch||e?.loading||r,onClick:i,"data-testid":`review-merge-confirm`,children:[r?(0,$.jsx)(m,{className:`icon-sm mr-1.5 animate-spin`}):(0,$.jsx)(B,{className:`icon-sm mr-1.5`}),a(`review.merge`,`Merge`)]})]})]})})}function $a({confirmDialog:e,setConfirmDialog:t,executeRevert:n,executeDiscardAll:r,executeIgnoreFiles:i,executeResetSoft:a,executeStashDrop:o,pullStrategyDialog:s,setPullStrategyDialog:c,handlePullStrategyChosen:l,prDialog:u,setPrDialog:d,threadBranch:f,baseBranch:p,prInProgress:m,handleCreatePROnly:h,mergeDialog:g,setMergeDialog:_,currentBranch:v,mergeInProgress:y,handleMergeWithTarget:b,publishProjectId:x,publishProjectPath:S,publishDialogOpen:C,setPublishDialogOpen:w,handlePublishSuccess:T}){let{t:E}=H();return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ut,{open:!!e,onOpenChange:e=>{e||t(null)},title:e?.type===`revert`||e?.type===`discard-all`?E(`review.discardChanges`,`Discard changes`):e?.type===`ignore`?`Add to .gitignore`:e?.type===`drop-stash`?E(`review.dropStashTitle`,`Discard stash`):E(`review.undoLastCommit`,`Undo last commit`),description:e?.type===`revert`?E(`review.revertConfirm`,{paths:e?.path}):e?.type===`discard-all`?E(`review.discardAllConfirm`,{count:e?.paths?.length,defaultValue:`Discard changes in ${e?.paths?.length} file(s)? This cannot be undone.`}):e?.type===`ignore`?`Add ${e?.paths?.length} file(s) to .gitignore?`:e?.type===`drop-stash`?E(`review.dropStashConfirm`,`Drop this stash entry? This cannot be undone.`):E(`review.resetSoftConfirm`,`Undo the last commit? Changes will be kept.`),cancelLabel:E(`common.cancel`,`Cancel`),confirmLabel:E(`common.confirm`,`Confirm`),onCancel:()=>t(null),onConfirm:async()=>{let s=e;t(null),s?.type===`revert`&&s.path?await n(s.path):s?.type===`discard-all`&&s.paths?await r(s.paths):s?.type===`reset`?await a():s?.type===`ignore`&&s.paths?await i(s.paths):s?.type===`drop-stash`&&s.stashIndex!=null&&await o(s.stashIndex)}}),(0,$.jsx)(Li,{open:s.open,onOpenChange:e=>c(t=>({...t,open:e})),errorMessage:s.errorMessage,onChoose:l}),(0,$.jsx)(Za,{prDialog:u,setPrDialog:d,threadBranch:f,baseBranch:p,prInProgress:m,handleCreatePROnly:h}),(0,$.jsx)(Qa,{mergeDialog:g,setMergeDialog:_,currentBranch:v,mergeInProgress:y,handleMergeWithTarget:b}),(0,$.jsx)(Ii,{projectId:x,projectPath:S,open:C,onOpenChange:w,onSuccess:T})]})}function eo({stash:e,currentBranch:t,isAgentRunning:n,onRequestDrop:r}){let{t:i}=H(),{stashEntries:a,filteredStashEntries:o,selectedStashIndex:s,setSelectedStashIndex:l,selectedStashEntry:u,stashFiles:d,stashTreeFiles:f,stashFilesLoading:p,stashDialogFile:g,stashDialogDiff:_,stashDialogDiffLoading:v,stashDialogDiffCache:b,stashFileSearch:x,setStashFileSearch:S,stashFileSearchCaseSensitive:C,setStashFileSearchCaseSensitive:w,stashPopInProgress:T,stashDropInProgress:E,handleStashPop:D,loadStashFileDiff:O}=e;return o.length===0?(0,$.jsx)(Er,{icon:y,title:t?i(`review.noStashesOnBranch`,{branch:t,defaultValue:`No stashed changes on ${t}`}):i(`review.noStashes`,`No stashed changes`),description:a.length>0?i(`review.stashesOnOtherBranches`,{count:a.length,defaultValue:`${a.length} stash(es) on other branches`}):void 0}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(jt,{className:`flex min-h-0 flex-1 flex-col`,children:(0,$.jsx)(`div`,{className:`divide-sidebar-border flex flex-col divide-y`,children:o.map(e=>{let t=e.index.replace(`stash@{`,``).replace(`}`,``);return(0,$.jsxs)(`div`,{role:`button`,tabIndex:0,className:`hover:bg-sidebar-accent/50 flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left text-xs transition-colors`,onClick:()=>l(t),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l(t))},"data-testid":`stash-entry-${t}`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate font-medium`,children:e.message}),(0,$.jsx)(`span`,{className:`text-muted-foreground text-[10px]`,children:e.relativeDate})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground hover:bg-sidebar-accent shrink-0 rounded p-1 transition-colors disabled:pointer-events-none disabled:opacity-50`,onClick:e=>{e.stopPropagation(),D()},disabled:T||!!n||t!==`0`,"data-testid":`stash-pop-${t}`,children:T&&t===`0`?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):(0,$.jsx)(c,{className:`icon-xs`})})}),(0,$.jsx)(W,{side:`left`,children:t===`0`?i(`review.popStash`,`Pop stash`):i(`review.popStashOnlyLatest`,`Only the latest stash can be popped`)})]}),(0,$.jsxs)(K,{children:[(0,$.jsx)(J,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-destructive hover:bg-sidebar-accent shrink-0 rounded p-1 transition-colors disabled:pointer-events-none disabled:opacity-50`,onClick:e=>{e.stopPropagation(),r(t)},disabled:!!E||!!n,"data-testid":`stash-drop-${t}`,children:E===t?(0,$.jsx)(m,{className:`icon-xs animate-spin`}):(0,$.jsx)(P,{className:`icon-xs`})})}),(0,$.jsx)(W,{side:`left`,children:i(`review.dropStash`,`Discard stash`)})]})]},e.index)})})}),(0,$.jsx)(Ze,{open:!!s,onOpenChange:e=>{e||l(null)},children:(0,$.jsxs)(Vt,{className:`flex h-[85vh] max-w-[90vw] flex-col gap-0 p-0`,"data-testid":`stash-detail-dialog`,children:[(0,$.jsxs)(`div`,{className:`border-border shrink-0 border-b px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(We,{className:`text-sm leading-tight font-semibold`,children:u?.message??i(`review.stashDetails`,`Stash details`)}),(0,$.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>l(null),className:`text-muted-foreground shrink-0`,"data-testid":`stash-detail-close`,children:(0,$.jsx)(ce,{className:`icon-xs`})})]}),(0,$.jsx)(tt,{className:`sr-only`,children:i(`review.stashDetailsDesc`,`Stash detail with file changes and diffs`)}),u&&(0,$.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-1.5 pt-1 text-[11px]`,children:[(0,$.jsx)(y,{className:`icon-xs shrink-0`}),(0,$.jsx)(`code`,{className:`text-primary shrink-0 font-mono`,children:u.index}),(0,$.jsx)(`span`,{className:`shrink-0`,children:u.relativeDate}),(0,$.jsxs)(`span`,{className:`text-muted-foreground shrink-0`,children:[`· `,d.length,` file`,d.length===1?``:`s`]})]})]}),p?(0,$.jsx)(dn,{testId:`stash-detail-loading`,label:i(`review.loading`,`Loading changes…`)}):(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`border-border flex w-[280px] shrink-0 flex-col border-r`,"data-testid":`stash-detail-file-tree`,children:[d.length>0&&(0,$.jsx)(`div`,{className:`border-sidebar-border shrink-0 border-b px-2 py-1`,children:(0,$.jsx)(It,{query:x,onQueryChange:S,placeholder:i(`review.searchFiles`,`Filter files…`),totalMatches:f.length,resultLabel:x?`${f.length}/${d.length}`:``,caseSensitive:C,onCaseSensitiveChange:w,onClose:x?()=>S(``):void 0,autoFocus:!1,testIdPrefix:`stash-detail-file-filter`})}),(0,$.jsx)(jt,{className:`min-h-0 flex-1`,children:d.length===0?(0,$.jsx)(`div`,{className:`text-muted-foreground py-4 text-center text-xs`,children:i(`review.noFiles`,`No files`)}):f.length===0?(0,$.jsx)(`div`,{className:`text-muted-foreground py-4 text-center text-xs`,children:i(`history.noMatchingFiles`,`No matching files`)}):(0,$.jsx)(un,{files:f,selectedFile:g,onFileClick:e=>s&&O(s,e),testIdPrefix:`stash-detail`,searchQuery:x||void 0})})]}),(0,$.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,"data-testid":`stash-detail-diff-pane`,children:g?(0,$.jsx)(fn,{filePath:g,oldValue:_?pn(_):``,newValue:_?mn(_):``,loading:v,rawDiff:_??void 0,files:f,onFileSelect:e=>s&&O(s,e),diffCache:b}):(0,$.jsxs)(`div`,{className:`text-muted-foreground flex flex-1 flex-col items-center justify-center gap-2`,children:[(0,$.jsx)(h,{className:`size-8 opacity-30`}),(0,$.jsx)(`p`,{className:`text-xs`,children:i(`history.selectFile`,`Select a file to view changes`)})]})})]})]})})]})}export{gr as C,Tr as S,Mr as _,Ga as a,Or as b,Ma as c,fa as d,da as f,Nr as g,xi as h,qa as i,Sa as l,zi as m,$a as n,Pa as o,Hi as p,Xa as r,Na as s,eo as t,la as u,kr as v,hr as w,Er as x,Ar as y};
|