@pi-chamber/web 1.0.6-rc.3 → 1.0.6-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{DiagramView-Dq5w8TCG.js → DiagramView--XO16VPB.js} +1 -1
- package/dist/assets/DiffView-Duy2_7Gp.js +18 -0
- package/dist/assets/{FileSaveConflictDialog-dFqLbFzT.js → FileSaveConflictDialog-B1DvL9zy.js} +2 -2
- package/dist/assets/FilesView-CjjPpE4c.js +6 -0
- package/dist/assets/{GitHubDetailScaffold-B2HRjT8V.js → GitHubDetailScaffold-DqxAKqCT.js} +4 -4
- package/dist/assets/{GitHubLinkPicker-D7I3J9_O.js → GitHubLinkPicker-ELF_chia.js} +1 -1
- package/dist/assets/GitHubListPrimitives-C2nGTntk.js +1 -0
- package/dist/assets/GitView-5fIq2nzM.js +9 -0
- package/dist/assets/IssuesSurface-Dq5A_bWq.js +7 -0
- package/dist/assets/{JsonTreeView-BJr5kBg4.js → JsonTreeView-BjFFSUwi.js} +1 -1
- package/dist/assets/MarkdownRendererImpl-B9Cu4TCh.js +12 -0
- package/dist/assets/{PatchDiff-B6RBZULC.js → PatchDiff-CTqTTcg7.js} +1 -1
- package/dist/assets/{PierreDiffViewer-YJJQkE7t.js → PierreDiffViewer-H2f4pJ1k.js} +15 -3
- package/dist/assets/PullRequestsSurface-DPpb2RW_.js +2 -0
- package/dist/assets/SessionSwitcherContent-B5DaBWZU.js +1 -0
- package/dist/assets/{SessionSwitcherDropdown-CEAid1Bd.js → SessionSwitcherDropdown-D86FaZg_.js} +2 -2
- package/dist/assets/SessionUnreadDot-CY9-1iV2.js +1 -0
- package/dist/assets/SettingsView-CiIuOi_E.js +6 -0
- package/dist/assets/{SettingsWindow-5dK-buUn.js → SettingsWindow-Bw1dUoJ1.js} +1 -1
- package/dist/assets/{StickyHorizontalScrollbar-p7EbL2-E.js → StickyHorizontalScrollbar-DNsbTLS7.js} +1 -1
- package/dist/assets/{ToolOutputDialog-gITobhpo.js → ToolOutputDialog-aR4kcgKL.js} +5 -5
- package/dist/assets/{ToolPartDiffPreview-nOJxBl-Y.js → ToolPartDiffPreview-B_wWmhtE.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-BmJk6XJm.js → VirtualizedFileDiff-BYby097w.js} +4 -4
- package/dist/assets/{Virtualizer-DNJrJKVb.js → Virtualizer-okhy9Aq3.js} +1 -1
- package/dist/assets/{collapsible-0yfy07W2.js → collapsible-Dz0bPrJ_.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-BCFpa-1q.js → computeVirtualFileMetrics-8MuwxSC6.js} +1 -1
- package/dist/assets/{contextFileOpenGuard-BCi5nTZp.js → contextFileOpenGuard-fZ2NIQMQ.js} +1 -1
- package/dist/assets/fileTreeStatus-BzhMMLA9.js +7 -0
- package/dist/assets/gitStatusPredicates-Cyh9UhYX.js +1 -0
- package/dist/assets/{githubLink-CCmFsyTF.js → githubLink-D2PznPcI.js} +2 -2
- package/dist/assets/{index-BaeFf5Q8.js → index-BX5pAOQX.js} +1 -1
- package/dist/assets/index-Cs2nBW_t.js +11 -0
- package/dist/assets/index-tmO0fZa4.css +1 -0
- package/dist/assets/main-7vBNPBMb.js +137 -0
- package/dist/assets/{main-CgXs2e27.js → main-BI6qe8pz.js} +2 -2
- package/dist/assets/{markdownCore-DTNVLpYS.js → markdownCore-D5jiabKe.js} +1 -1
- package/dist/assets/{miniChat-CrAin_em.js → miniChat-B3up4Bnz.js} +2 -2
- package/dist/assets/{mobile-EK9oTupb.js → mobile-B4vLFgBc.js} +2 -2
- package/dist/assets/{nativeFileSave-Bhafll_7.js → nativeFileSave-DpBH1Sa3.js} +1 -1
- package/dist/assets/{pi-session-focus-preference-BoN1cyoG.js → pi-session-focus-preference-BrB72skF.js} +3 -3
- package/dist/assets/{renderDiffWithHighlighter-DixZh5Zd.js → renderDiffWithHighlighter-B6T04JGG.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-CX10w321.js +2 -0
- package/dist/assets/{renderFileWithHighlighter-s6fQq9eg.js → renderFileWithHighlighter-DtAcGyJr.js} +1 -1
- package/dist/assets/renderMobileApp-C9n-BhPZ.js +11 -0
- package/dist/assets/runtimeEndpointReset-aGyXPXPs.js +62 -0
- package/dist/assets/{runtimeSurface-CJN1oo_1.js → runtimeSurface-DiP2a57a.js} +1 -1
- package/dist/assets/useAppFontEffects-Oyin3dgQ.js +215 -0
- package/dist/assets/useGitHubRemoteSearch-CZ9Hauw0.js +1 -0
- package/dist/assets/useSwitcherItems-BSqDA1IF.js +1 -0
- package/dist/assets/{vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js → vendor-aparajita-capacitor-secure-storage-DVZvgYu4.js} +1 -1
- package/dist/assets/{vendor-base-ui-C7vVMZTg.js → vendor-base-ui-BCqPBzDj.js} +1 -1
- package/dist/assets/{vendor-boot-CoTxysn6.js → vendor-boot-3SaHYVb1.js} +18 -18
- package/dist/assets/{vendor-capacitor-app-NX6DULfp.js → vendor-capacitor-app-NbQ-WiPS.js} +1 -1
- package/dist/assets/{vendor-capacitor-keyboard-DJD81I9f.js → vendor-capacitor-keyboard-CgrHt8iN.js} +1 -1
- package/dist/assets/{vendor-capacitor-status-bar-DV24OoQV.js → vendor-capacitor-status-bar-CWt0OF5t.js} +1 -1
- package/dist/assets/{vendor-codemirror-autocomplete-qsuH4Dh-.js → vendor-codemirror-autocomplete-WThuuUAz.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-angular-ZHWyBf7j.js → vendor-codemirror-lang-angular-BbLGCxF6.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-cpp-pCTOmv-k.js → vendor-codemirror-lang-cpp-Cceks-9O.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-css-2bFuyM70.js → vendor-codemirror-lang-css-D1wpUg3Z.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-go-DrG_c7D7.js → vendor-codemirror-lang-go-Cv0zXHHM.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-html-BV8lrR8v.js → vendor-codemirror-lang-html-DbL8oT9H.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-java-DrsvH6T2.js → vendor-codemirror-lang-java-CNugenuC.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-javascript-Dkzl3s07.js → vendor-codemirror-lang-javascript-Bx_FIyZF.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-jinja-8Nn3bnoP.js → vendor-codemirror-lang-jinja-DDGjB3Zq.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-json-CsdmtHhi.js → vendor-codemirror-lang-json-DIvqf9Pb.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-less-DJuZ4cZe.js → vendor-codemirror-lang-less-D8r9dGG1.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-liquid-D2RO-Pzr.js → vendor-codemirror-lang-liquid-B24mguYi.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-markdown-C0Zu3b3n.js → vendor-codemirror-lang-markdown-v3yG2sbf.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-php-CuDtt2Zj.js → vendor-codemirror-lang-php-BcZGalqy.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-python-Cv2exx_M.js → vendor-codemirror-lang-python-b-JqEwQy.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-rust-C4TxJ6Rg.js → vendor-codemirror-lang-rust-B1uZxDW-.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sass-BmtPz8kf.js → vendor-codemirror-lang-sass-DqPrngKp.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sql-BF1ZaXqJ.js → vendor-codemirror-lang-sql-UyCnpt-k.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-vue-DZgXrP2k.js → vendor-codemirror-lang-vue-xDwYkovV.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-wast-DsnaGtL_.js → vendor-codemirror-lang-wast-CF3169p_.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-xml-D8DzzFat.js → vendor-codemirror-lang-xml-FCtVhuOb.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-yaml-D5hBv7m6.js → vendor-codemirror-lang-yaml-g0sPmAnv.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-vn2RyN9T.js → vendor-codemirror-language-data-B03xgzP2.js} +2 -2
- package/dist/assets/{vendor-codemirror-search-BVCYIV0D.js → vendor-codemirror-search-Dw3Wpu15.js} +1 -1
- package/dist/assets/{vendor-lezer-cpp-vqXSn3lv.js → vendor-lezer-cpp-Cu3E-KUI.js} +1 -1
- package/dist/assets/{vendor-lezer-css-JnEzSyZR.js → vendor-lezer-css-Cb8vp67u.js} +1 -1
- package/dist/assets/{vendor-lezer-go-dD2gQMIL.js → vendor-lezer-go-BTsIaOm7.js} +1 -1
- package/dist/assets/{vendor-lezer-html-Cr3U-1pu.js → vendor-lezer-html-UQMsUwj-.js} +1 -1
- package/dist/assets/{vendor-lezer-java-CRM0IMCo.js → vendor-lezer-java-BIWrFrAx.js} +1 -1
- package/dist/assets/{vendor-lezer-javascript-B3s21DIS.js → vendor-lezer-javascript-BH2Etgoy.js} +1 -1
- package/dist/assets/{vendor-lezer-json-DPFM6EBV.js → vendor-lezer-json-CE-QUCwM.js} +1 -1
- package/dist/assets/{vendor-lezer-lr-Bllrq8hY.js → vendor-lezer-lr-HY6Yc0Vr.js} +1 -1
- package/dist/assets/{vendor-lezer-markdown-6-3PLvXG.js → vendor-lezer-markdown-xFL3Evwf.js} +1 -1
- package/dist/assets/{vendor-lezer-php-DOyzfHRl.js → vendor-lezer-php-Cr_mQGrG.js} +1 -1
- package/dist/assets/{vendor-lezer-python-CdHdN5qt.js → vendor-lezer-python-BNRFWCb0.js} +1 -1
- package/dist/assets/{vendor-lezer-rust-CqnW8EMH.js → vendor-lezer-rust-BvfOK5cU.js} +1 -1
- package/dist/assets/{vendor-lezer-sass-BbcF4y6A.js → vendor-lezer-sass-qoxiLisk.js} +1 -1
- package/dist/assets/{vendor-lezer-xml-C31AyWoo.js → vendor-lezer-xml--x8SSpqU.js} +1 -1
- package/dist/assets/{vendor-lezer-yaml-Cv908yC2.js → vendor-lezer-yaml-BDo1JaEr.js} +1 -1
- package/dist/assets/{vendor-replit-codemirror-vim-Cwhyn_5f.js → vendor-replit-codemirror-vim-D1Fe7FiY.js} +1 -1
- package/dist/assets/{web-components-Bz5oGa3p.js → web-components-CkTNGkJ2.js} +4 -4
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +1 -1
- package/server/lib/git/DOCUMENTATION.md +1 -0
- package/server/lib/git/routes.js +14 -0
- package/server/lib/git/routes.test.js +37 -0
- package/server/lib/git/service.js +27 -0
- package/server/lib/git/service.test.js +32 -0
- package/server/lib/pi/archive-store.js +38 -10
- package/server/lib/pi/archive-store.test.js +10 -0
- package/server/lib/pi/routes.js +107 -2
- package/server/lib/pi/routes.test.js +255 -0
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +5 -1
- package/server/lib/pi/session-daemon/session-daemon-engines.test.js +18 -0
- package/server/lib/pi/session-daemon/session-daemon.js +24 -1
- package/server/lib/pi/session-shelf-store.js +252 -0
- package/server/lib/pi/session-shelf-store.test.js +174 -0
- package/server/lib/pi/ui-settings-store.js +60 -0
- package/server/lib/pi/ui-settings-store.test.js +105 -6
- package/dist/assets/DiffView-CFIjN2zy.js +0 -18
- package/dist/assets/FilesView-D0b2mEKA.js +0 -6
- package/dist/assets/GitHubListPrimitives-Dw5LAmzm.js +0 -1
- package/dist/assets/GitView-Dhr7qVeI.js +0 -9
- package/dist/assets/IssuesSurface-Bya7OsRl.js +0 -7
- package/dist/assets/MarkdownRendererImpl-DadkFPCz.js +0 -12
- package/dist/assets/PullRequestsSurface-D8JpzP5l.js +0 -2
- package/dist/assets/SessionSwitcherContent-CJ6C2ZKG.js +0 -1
- package/dist/assets/SessionUnreadDot-I1_tmqY9.js +0 -1
- package/dist/assets/SettingsView-B-b76XDV.js +0 -6
- package/dist/assets/gitStatusPredicates-BQOqDJU1.js +0 -1
- package/dist/assets/index-C2ISrmRR.js +0 -11
- package/dist/assets/index-DgwThEwf.css +0 -1
- package/dist/assets/main-DoVzQV56.js +0 -137
- package/dist/assets/renderElectronMiniChatApp-0MqKeGfI.js +0 -2
- package/dist/assets/renderMobileApp-BLoXL_J8.js +0 -11
- package/dist/assets/runtimeEndpointReset-Bv2Y1fMm.js +0 -62
- package/dist/assets/useAppFontEffects-D2xXdmYC.js +0 -215
- package/dist/assets/useFilesViewSearch-BKotcAUN.js +0 -7
- package/dist/assets/useGitHubRemoteSearch-CZ92xKSw.js +0 -1
- package/dist/assets/useSwitcherItems-BfA4omGb.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/useAppFontEffects-Oyin3dgQ.js","assets/index-Cs2nBW_t.js","assets/vendor-zustand-CXhN0IMY.js","assets/vendor-react-Bz1tRBxM.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-fuse.js-t_7AcMTv.js","assets/index-tmO0fZa4.css","assets/vendor-boot-3SaHYVb1.js","assets/runtimeSurface-DiP2a57a.js","assets/nativeFileSave-DpBH1Sa3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as Ne}from"./vendor-vite-runtime-DD1OZmLC.js";import{j as e,bW as We,bX as Ye,bY as Xe,bZ as Qe,b_ as Ze}from"./vendor-boot-3SaHYVb1.js";import{R as o}from"./vendor-react-Bz1tRBxM.js";import{u as le,a as Le,b as mt,c as ht,G as ft,d as xt,e as pt,f as gt,r as bt,g as et,t as vt,h as ce,i as yt,j as jt,k as wt,l as kt,m as Ct,n as Nt,o as St}from"./useGitHubRemoteSearch-CZ9Hauw0.js";import{z as Ee,t as G,c6 as Rt,B as P,I as M,at as Lt,b2 as tt,a$ as Me,b0 as ze,b1 as $e,d_ as Et,d$ as Ft,o as Se,bv as we,bT as Pt,y as Tt}from"./useAppFontEffects-Oyin3dgQ.js";import{aR as I,L as Mt,aZ as zt,aS as $t,a_ as At,a$ as Dt,b0 as Gt,b1 as Ht,b2 as qt,b3 as Ae,b4 as It,b5 as Ot,b6 as Bt,b7 as _t,b8 as Ut,b9 as Vt,ba as Kt,bb as Jt}from"./runtimeEndpointReset-aGyXPXPs.js";import{c as Wt,d as Yt,s as Xt,m as Qt,g as st,e as Zt,f as es,h as ge,l as ts,G as ss,i as te,j as ns,k as as,n as ls,o as os,b as fe,u as is,p as rs,q as cs,r as ds,t as De,w as ke,x as Ce,y as us,z as Ge,A as He,B as qe,C as nt,D as ms,E as Ie,F as hs,H as fs,I as xs,J as ps,K as gs,P as be,L as he,M as bs,a as vs,N as ys,O as js,Q as ws}from"./GitHubDetailScaffold-DqxAKqCT.js";import{f as xe,aH as ks,p as Cs,h as Ns,j as Ss}from"./index-Cs2nBW_t.js";import{S as ve,G as Rs}from"./GitHubListPrimitives-C2nGTntk.js";import{P as Ls}from"./PierreDiffViewer-H2f4pJ1k.js";import{c as Es,p as Fs}from"./vendor-zustand-CXhN0IMY.js";import"./vendor-clsx-B-dksMZM.js";import"./runtimeSurface-DiP2a57a.js";import"./nativeFileSave-DpBH1Sa3.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./SessionUnreadDot-CY9-1iV2.js";/* empty css */import"./permissionStore-zIpxq9Pq.js";import"./vendor-dompurify-BGCr_sdL.js";import"./web-components-CkTNGkJ2.js";import"./computeVirtualFileMetrics-8MuwxSC6.js";import"./vendor-shiki-BEwTOAFg.js";import"./vendor-shikijs-core-Ck_OPM_T.js";import"./vendor-shikijs-types-CPSbSeK6.js";import"./vendor-shikijs-vscode-textmate-DPFxvYtK.js";import"./vendor-hast-util-to-html-O3stl53j.js";import"./vendor-html-void-elements-CkdplsNl.js";import"./vendor-property-information-C40bX6nM.js";import"./vendor-zwitch-C2o2j-tx.js";import"./vendor-stringify-entities-CsH1VEn9.js";import"./vendor-character-entities-legacy-BpoLgcEt.js";import"./vendor-character-entities-html4-D7taRCQ7.js";import"./vendor-ccount-c2V3InAJ.js";import"./vendor-comma-separated-tokens-D8TqSuIK.js";import"./vendor-space-separated-tokens-DD3iYX1K.js";import"./vendor-hast-util-whitespace-D4Wp6AEg.js";import"./vendor-shikijs-engine-oniguruma-DPWuIF1G.js";import"./themeResolver-DrfmQi8i.js";import"./vendor-pierre-theming-BO6EPniU.js";import"./vendor-shikijs-engine-javascript-DL394yyj.js";import"./vendor-oniguruma-to-es-DgwFOwdE.js";import"./vendor-oniguruma-parser-BrbMHgHx.js";import"./vendor-regex-BBWcyTkg.js";import"./vendor-regex-utilities-2BQyy0xI.js";import"./vendor-regex-recursion-JU4mF-dD.js";import"./vendor-shikijs-transformers-CZWsLLKm.js";import"./VirtualizedFileDiff-BYby097w.js";import"./renderDiffWithHighlighter-B6T04JGG.js";import"./vendor-diff-C3JhlQdm.js";import"./StickyHorizontalScrollbar-DNsbTLS7.js";import"./appThemeRegistry-Ca8eGRB9.js";import"./registerCustomTheme-C-h6lsYW.js";const Fe=()=>{const t=Ee(),[s,n]=o.useState(null);return{send:o.useCallback(async l=>{const d=t.github;if(!d)return G.error("GitHub is not available in this runtime"),!1;n(l.key);try{const c=await d.agentContext(l.directory,l.repo,l.contextType,l.number,l.contextOptions),r=Wt({kind:l.kind,repo:l.repo,number:l.number,detail:l.detail}),f=Yt({kind:l.kind,repo:l.repo,number:l.number,contextText:c.text}),x=Rt.getState();x.setPendingInputText(r,"append");const k=x.pendingSyntheticParts??[];return x.setPendingSyntheticParts([...k,{text:f,synthetic:!0}]),G.success("Added to composer"),!0}catch(c){return G.error(c instanceof Error?c.message:"Failed to fetch GitHub context"),!1}finally{n(null)}},[t.github]),sendingKey:s}},Ps=800,Ts=3,Pe={added:{icon:"add-circle",letter:"A",tint:"text-[var(--status-success)]"},removed:{icon:"subtract",letter:"D",tint:"text-[var(--status-error)]"},modified:{icon:"pencil",letter:"M",tint:"text-[var(--status-warning)]"},renamed:{icon:"expand-up-down",letter:"R",tint:"text-[var(--status-info)]"},other:{icon:"file",letter:"•",tint:"text-muted-foreground"}},at=t=>{switch((t??"").toLowerCase()){case"added":return"added";case"removed":return"removed";case"modified":return"modified";case"renamed":return"renamed";default:return"other"}},lt=t=>Pe[t].icon,Ms=t=>Pe[t].letter,Re=t=>Pe[t].tint,ot=t=>{const s=t.lastIndexOf("/");return s<0?{dir:"",base:t}:{dir:t.slice(0,s),base:t.slice(s+1)}},it=t=>{const s=typeof t.additions=="number"?t.additions:0,n=typeof t.deletions=="number"?t.deletions:0;return s!==0||n!==0?s+n:typeof t.changes=="number"?t.changes:0},rt=t=>it(t)>Ps,zs=t=>{const s=new Map;for(const a of t){const l=a.filename.lastIndexOf("/"),d=l<0?"":a.filename.slice(0,l),c=s.get(d);c?c.push(a):s.set(d,[a])}const n=[...s.entries()].map(([a,l])=>({folder:a,files:[...l].sort((d,c)=>d.filename.localeCompare(c.filename,void 0,{sensitivity:"base"}))}));return n.sort((a,l)=>a.folder===""?1:l.folder===""?-1:a.folder.localeCompare(l.folder,void 0,{sensitivity:"base"})),n},$s=t=>{let s=0,n=0;for(const a of t)s+=typeof a.additions=="number"?a.additions:0,n+=typeof a.deletions=="number"?a.deletions:0;return{additions:s,deletions:n}},As=t=>{const s={};return t.forEach((n,a)=>{s[n.filename]=a>=Ts||rt(n)}),s},Ds=(t,s,n)=>{if(!s)return null;const a=t.split("/");if(a.length!==3||a.some(r=>r.length===0))return null;const[l,d,c]=a;return`https://${l}/${d}/${c}/blob/${s}/${n}`},Gs=({comment:t,onRemove:s})=>e.jsxs("div",{className:"rounded-md border border-dashed border-border p-2.5 typography-ui text-foreground",contentEditable:!1,onPointerDown:n=>n.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(M,{name:"chat-1",className:"size-3.5 shrink-0","aria-hidden":"true"}),e.jsx("span",{children:"Pending — sent when you submit the review"}),e.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Discard this comment",title:"Discard this comment",onClick:s,className:"ml-auto size-6",children:e.jsx(M,{name:"delete-bin",className:"size-3.5"})})]}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap break-words",children:t.body})]}),Oe=({thread:t,replyAllowed:s,replyDisabledReason:n,resolveAllowed:a,resolveDisabledReason:l,busy:d,onReply:c,onToggleResolved:r})=>{const[f,x]=o.useState(!t.resolved),[k,m]=o.useState(!1),[g,p]=o.useState(""),[z,F]=o.useState(!1),L=t.comments.length,j=async()=>{const b=g.trim();if(!(b.length===0||z||d)){F(!0);try{await c(b)&&(p(""),m(!1))}finally{F(!1)}}};return e.jsxs("div",{className:"rounded-md border border-border/60 bg-[var(--surface-elevated)] p-2.5 typography-ui text-foreground",contentEditable:!1,onPointerDown:b=>b.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(M,{name:t.resolved?"check":"chat-1",className:xe("size-3.5 shrink-0",t.resolved?"text-[var(--status-success)]":""),"aria-hidden":"true"}),e.jsxs("button",{type:"button",className:"hover:text-foreground","aria-expanded":f,onClick:()=>x(b=>!b),children:[t.resolved?"Resolved":"Open"," · ",L," ",L===1?"comment":"comments"]}),e.jsx(P,{type:"button",variant:"ghost",size:"xs",className:"ml-auto",disabled:!a||d,title:l??(t.resolved?"Reopen this conversation":"Resolve this conversation"),"aria-label":t.resolved?"Reopen conversation":"Resolve conversation",onClick:r,children:t.resolved?"Unresolve":"Resolve"})]}),f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 flex flex-col gap-2",children:t.comments.map((b,i)=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"typography-micro text-muted-foreground",children:b.author?.login??"ghost"}),e.jsx(ss,{markdown:b.body,html:b.bodyHtml??null,fallbackUrl:b.url})]},b.id??`${t.id}-${i}`))}),s?k?e.jsxs("div",{className:"mt-2",children:[e.jsx("textarea",{autoFocus:!0,value:g,rows:2,placeholder:"Reply","aria-label":"Reply to this conversation",disabled:z||d,onChange:b=>p(b.target.value),onKeyDown:b=>{b.nativeEvent.isComposing||(b.key==="Escape"&&(b.preventDefault(),m(!1)),b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&!b.shiftKey&&!b.altKey&&!b.repeat&&(b.preventDefault(),b.stopPropagation(),j()))},className:"min-h-12 w-full rounded-md border border-border bg-[var(--surface-elevated)] p-2 typography-ui text-foreground"}),e.jsxs("div",{className:"mt-1.5 flex justify-end gap-1.5",children:[e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>m(!1),children:"Cancel"}),e.jsx(P,{type:"button",variant:"default",size:"xs",disabled:z||d||g.trim().length===0,onClick:()=>{j()},children:z?"Replying…":"Reply"})]})]}):e.jsx(P,{type:"button",variant:"ghost",size:"xs",className:"mt-2",onClick:()=>m(!0),children:"Reply"}):n?e.jsxs("p",{className:"mt-2 typography-micro text-muted-foreground",title:n,children:["Reply unavailable — ",n.charAt(0).toLowerCase()+n.slice(1)]}):null]}):null]})},Hs=({path:t,line:s,sendingToAgent:n,onCancel:a,onAddToReview:l,onSendToAgent:d})=>{const[c,r]=o.useState(""),f=o.useRef(null),x=c.trim();o.useLayoutEffect(()=>{const m=window.requestAnimationFrame(()=>{f.current?.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(m)},[]);const k=()=>{x&&l(x)};return e.jsxs("div",{className:"rounded-md border border-border/60 bg-[var(--surface-elevated)] p-2.5",contentEditable:!1,onPointerDown:m=>m.stopPropagation(),children:[e.jsxs("p",{className:"truncate font-mono typography-micro text-muted-foreground",title:`${t}:${s}`,children:[t,":",s]}),e.jsx("textarea",{ref:f,value:c,rows:3,placeholder:"Add a comment…","aria-label":`Comment on ${t} line ${s}`,onChange:m=>r(m.target.value),onFocus:m=>{const g=m.currentTarget.value.length;m.currentTarget.setSelectionRange(g,g)},onKeyDown:m=>{m.nativeEvent.isComposing||(m.key==="Escape"&&(m.preventDefault(),a()),m.key==="Enter"&&(m.metaKey||m.ctrlKey)&&!m.shiftKey&&!m.altKey&&!m.repeat&&(m.preventDefault(),m.stopPropagation(),k()))},className:"mt-1.5 min-h-16 w-full rounded-md border border-border bg-[var(--surface-elevated)] p-2 typography-ui text-foreground"}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx("span",{className:"mr-auto typography-micro text-muted-foreground",children:"Ctrl/Cmd+Enter to add"}),e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:a,children:"Cancel"}),e.jsx(P,{type:"button",variant:"outline",size:"xs",disabled:!x||n,title:"Send this line to the agent",onClick:()=>d(x),children:n?"Sending…":"Send to agent"}),e.jsx(P,{type:"button",variant:"default",size:"xs",disabled:!x,onClick:k,children:"Add to review"})]})]})},qs=({file:t,collapsed:s,onToggleCollapse:n,viewed:a,onToggleViewed:l,blobUrl:d,threads:c,directory:r,repo:f,number:x,github:k,access:m,onThreadsChanged:g})=>{const p=I(w=>w.threadAction),z=le(w=>w.removeComment),F=le(w=>w.addComment),L=Le(f,x),[j,b]=o.useState(null),[i,C]=o.useState(!1),{send:h,sendingKey:O}=Fe(),{original:N,modified:E}=o.useMemo(()=>Xt(t.patch),[t.patch]),T=o.useMemo(()=>Qt(t.patch),[t.patch]),B=`pr-${x}-file-${t.filename}`,V=st(m),S=Zt(m),A=es(m),K=o.useCallback(w=>{if(!w||!V.allowed)return;const H=(w.endSide??w.side??"additions")==="deletions"?"deletions":"additions",ie=H==="deletions"?T.syntheticToOld.get(w.end):T.syntheticToNew.get(w.end);if(ie==null){G.error("That line is outside the rendered hunks");return}b({synthLine:w.end,side:H,realLine:ie,realSide:H==="deletions"?"LEFT":"RIGHT"})},[V.allowed,T]),_=at(t.status),{dir:Q,base:R}=ot(t.filename),q=rt(t),[y,de]=o.useState(!1),X=q&&!y&&!a&&t.patch!=null,ee=c.filter(w=>!w.resolved).length,Z=o.useMemo(()=>L.filter(w=>w.path===t.filename),[L,t.filename]),{annotations:se,orphans:ne}=o.useMemo(()=>{const w=new Map,D=[],H=($,U)=>{const W=`${$}:${U}`;let J=w.get(W);return J||(J={side:$,synthLine:U,threads:[],pendings:[]},w.set(W,J)),J};for(const $ of c){const U=$.line??$.originalLine??null;if(U==null){D.push($);continue}let W,J;if($.diffSide==="LEFT"?(J="deletions",W=T.oldToSynthetic.get(U)):$.diffSide==="RIGHT"?(J="additions",W=T.newToSynthetic.get(U)):(W=T.newToSynthetic.get(U),J="additions",W==null&&(W=T.oldToSynthetic.get(U),J="deletions")),W==null){D.push($);continue}H(J,W).threads.push($)}for(const $ of Z){if($.line==null)continue;const U=$.side==="LEFT"?"deletions":"additions",W=U==="deletions"?T.oldToSynthetic.get($.line):T.newToSynthetic.get($.line);W!=null&&H(U,W).pendings.push($)}return j&&H(j.side,j.synthLine),{annotations:[...w.values()].sort(($,U)=>$.synthLine-U.synthLine).map($=>({side:$.side,lineNumber:$.synthLine,metadata:{threads:$.threads,pendings:$.pendings,draft:j&&j.side===$.side&&j.synthLine===$.synthLine?{realLine:j.realLine,realSide:j.realSide}:null}})),orphans:D}},[c,Z,j,T]),oe=o.useCallback(async(w,D)=>{const H=w.comments[w.comments.length-1]?.id??null;if(typeof H!="number")return G.error("Cannot reply to this thread yet"),!1;if(i)return!1;C(!0);try{return(await p(r,f,x,w.id,{action:"reply",body:D,commentId:H},k)).ok?(G.success("Reply posted"),g(),!0):(G.error("Failed to post reply"),!1)}finally{C(!1)}},[r,f,x,k,p,i,g]),ae=o.useCallback(w=>{i||(C(!0),p(r,f,x,w.id,w.resolved?{action:"unresolve"}:{action:"resolve"},k).then(D=>{D.ok?(G.success(w.resolved?"Thread reopened":"Thread resolved"),g()):G.error("Failed to update thread")}).finally(()=>C(!1)))},[r,f,x,k,p,i,g]),ue=o.useCallback(w=>e.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2",contentEditable:!1,onPointerDown:D=>D.stopPropagation(),children:[w.metadata.threads.map(D=>e.jsx(Oe,{thread:D,replyAllowed:S.allowed,replyDisabledReason:S.reason,resolveAllowed:A.allowed,resolveDisabledReason:A.reason,busy:i,onReply:H=>oe(D,H),onToggleResolved:()=>ae(D)},D.id)),w.metadata.pendings.map(D=>e.jsx(Gs,{comment:D,onRemove:()=>z(f,x,D.id)},D.id)),w.metadata.draft?e.jsx(Hs,{path:t.filename,line:w.metadata.draft.realLine,sendingToAgent:O===`${B}-draft-agent`,onCancel:()=>b(null),onAddToReview:D=>{const H=w.metadata.draft;H&&(F(f,x,{path:t.filename,body:D,line:H.realLine,side:H.realSide}),b(null),G.success("Added to review"))},onSendToAgent:D=>{const H=w.metadata.draft;H&&h({key:`${B}-draft-agent`,kind:"lines",directory:r,repo:f,number:x,contextType:"pr",contextOptions:{includeDiff:!0},detail:`${t.filename} line ${H.realLine} ("${D.trim()}")`})}}):null]}),[S.allowed,S.reason,A.allowed,A.reason,i,oe,ae,z,F,f,x,t.filename,B,O,r,h]);return e.jsxs("article",{className:"overflow-hidden rounded-md border border-border/60",children:[e.jsxs("div",{className:"sticky top-8 z-[5] flex items-center gap-1.5 bg-[var(--surface-muted)] px-2 py-1.5",children:[e.jsx(P,{type:"button",variant:"ghost",size:"icon",onClick:()=>n(t.filename),"aria-label":s?`Expand ${t.filename}`:`Collapse ${t.filename}`,title:s?"Expand":"Collapse",className:"size-6",children:e.jsx(M,{name:s?"arrow-right-s":"arrow-down-s",className:"size-4"})}),e.jsx(M,{name:lt(_),className:xe("size-3.5 shrink-0",Re(_)),"aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono typography-micro",title:t.filename,children:[Q?e.jsxs("span",{className:"text-muted-foreground",children:[Q,"/"]}):null,e.jsx("span",{className:"text-foreground",children:R})]}),_!=="other"?e.jsx("span",{className:xe("shrink-0 rounded px-1 font-mono typography-micro",Re(_)),title:t.status??void 0,children:Ms(_)}):null,e.jsx(ge,{additions:t.additions,deletions:t.deletions,className:"typography-micro"}),c.length>0||Z.length>0?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 typography-micro text-muted-foreground",title:`${c.length} ${c.length===1?"conversation":"conversations"}${Z.length>0?`, ${Z.length} pending`:""}`,children:[e.jsx(M,{name:"chat-1",className:"size-3.5","aria-hidden":"true"}),c.length>0?e.jsx("span",{className:"tabular-nums",children:ee>0?ee:c.length}):null,Z.length>0?e.jsxs("span",{className:"tabular-nums",children:["+",Z.length]}):null]}):null,e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5",onClick:w=>w.stopPropagation(),children:[e.jsx(Lt,{checked:a,onChange:w=>l(t.filename,w),ariaLabel:a?`Mark ${t.filename} as not viewed`:`Mark ${t.filename} as viewed`}),e.jsx("span",{className:"typography-micro text-muted-foreground",children:"Viewed"})]}),e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{h({key:`${B}-agent`,kind:"file",directory:r,repo:f,number:x,contextType:"pr",contextOptions:{includeDiff:!0},detail:t.filename})},disabled:O===`${B}-agent`,"aria-label":`Send ${t.filename} to agent`,children:"Send to agent"})]}),s?null:e.jsxs("div",{className:"flex flex-col gap-2 p-2",children:[ne.length>0?e.jsxs("div",{className:"flex flex-col gap-1.5 rounded-md bg-[var(--surface-muted)] px-2 py-2",children:[e.jsxs("p",{className:"typography-micro text-muted-foreground",children:["Other conversations (",ne.length,") — ",ne.length===1?"this line is":"these lines are"," no longer in the diff"]}),ne.map(w=>e.jsx(Oe,{thread:w,replyAllowed:S.allowed,replyDisabledReason:S.reason,resolveAllowed:A.allowed,resolveDisabledReason:A.reason,busy:i,onReply:D=>oe(w,D),onToggleResolved:()=>ae(w)},w.id))]}):null,X?e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--surface-muted)] px-3 py-3 typography-ui",children:[e.jsx(M,{name:"file",className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),e.jsxs("p",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:["Large diff — ",it(t)," changed lines"]}),e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>de(!0),children:"Load diff"})]}):t.patch?e.jsx("div",{className:"min-h-24 overflow-hidden",children:e.jsx(Ls,{original:N,modified:E,language:ts(t.filename),fileName:t.filename,renderSideBySide:!1,layout:"inline",enableGutterUtility:V.allowed&&j===null,enableLineSelection:V.allowed&&j===null,onGutterUtilityClick:K,onLineSelectionEnd:K,lineAnnotations:se,renderAnnotation:w=>ue(w)})}):e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-[var(--surface-muted)] px-3 py-3 typography-ui",children:[e.jsx(M,{name:"file",className:"size-4 shrink-0 text-muted-foreground","aria-hidden":"true"}),e.jsx("p",{className:"min-w-0 flex-1 text-muted-foreground",children:"Diff not available for this file."}),d?e.jsx(P,{type:"button",variant:"link",size:"sm",asChild:!0,children:e.jsx("a",{href:d,target:"_blank",rel:"noreferrer",children:"Open on GitHub"})}):null]})]})]})},Is=o.memo(qs),Os=({directory:t,repo:s,number:n,github:a,pr:l,access:d,onCommented:c})=>{const r=I(i=>i.addComment),f=I(i=>i.performAction),x=le(i=>i.clearCommentDraft),{draft:k,onDraftChange:m,flushDraft:g}=mt(s,n),{busy:p,error:z,submit:F}=ht({postComment:i=>r(t,s,n,i,a),runFollowUp:i=>f(t,s,n,i,a),verbs:{close:"close",reopen:"reopen"},doneLabels:{close:"Closed with comment",reopen:"Reopened with comment"},afterPost:()=>{m(""),x(s,n),c()}}),L=st(d),j=l.state==="open"?"close":l.state==="closed"?"reopen":null,b=j?te(j,l,d):null;return L.allowed?e.jsx(ft,{draft:k,onDraftChange:m,onDraftBlur:g,ariaLabel:"Leave a comment on this pull request",busy:p,error:z,disabledReason:L.reason,followUp:j?{id:j,label:j==="close"?"Close with comment":"Reopen with comment",busyLabel:j==="close"?"Closing…":"Reopening…",onRun:()=>{F(j,k)},allowed:b?.allowed===!0,reason:b?.reason}:null,onSubmitComment:()=>{F("comment",k)}}):null},Bs={comment:"Comment",approve:"Approve","request-changes":"Request changes"},_s=({repo:t,number:s,verdicts:n,summary:a,verdict:l,pendingCount:d,busy:c,textareaRef:r,onSubmit:f})=>{const x=le(p=>p.setSummary),k=le(p=>p.setVerdict),m=n.includes(l)?l:n[0]??"comment",g=as({verdict:m,summary:a,pendingCount:d});return e.jsxs("div",{children:[e.jsx(Mt,{ref:r,rows:3,value:a,placeholder:"Summarize your review (optional)","aria-label":"Review summary",disabled:c,onChange:p=>x(t,s,p.target.value),onKeyDown:p=>{p.nativeEvent.isComposing||p.key==="Enter"&&(p.metaKey||p.ctrlKey)&&!p.shiftKey&&!p.altKey&&!p.repeat&&(p.preventDefault(),p.stopPropagation(),g&&!c&&f())}}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsxs("label",{className:"inline-flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:"sr-only",children:"Review verdict"}),e.jsx("select",{value:m,disabled:c,onChange:p=>k(t,s,p.target.value),"aria-label":"Review verdict",className:"h-7 max-w-40 truncate rounded-md border border-border bg-[var(--surface-elevated)] px-1.5 typography-micro text-foreground",children:n.map(p=>e.jsx("option",{value:p,children:Bs[p]},p))})]}),e.jsx(P,{type:"button",variant:"default",size:"xs",disabled:c||!g,title:g?`Submit review${d>0?` with ${d} ${d===1?"line comment":"line comments"}`:""}`:"Add a summary or a line comment first",onClick:f,children:c?"Submitting…":"Submit review"})]})]})},ct=({directory:t,repo:s,number:n,github:a,access:l,size:d="sm",onReviewSubmitted:c})=>{const r=I(T=>T.submitReview),f=le(T=>T.removeComments),x=le(T=>T.clearSummary),k=le(T=>T.clearComments),m=Le(s,n),g=xt(s,n),p=pt(s,n),[z,F]=o.useState(!1),[L,j]=o.useState(!1),b=o.useRef(null),i=o.useMemo(()=>ns(l),[l]),C=i.includes(p)?p:i[0]??"comment",h=m.length,O=h>0||g.trim().length>0;if(o.useEffect(()=>{if(!z)return;const T=window.requestAnimationFrame(()=>b.current?.focus({preventScroll:!0}));return()=>window.cancelAnimationFrame(T)},[z]),i.length===0)return null;const N=async()=>{if(L)return;const T=g,B=[...m];j(!0);try{const V=B.map(A=>({path:A.path,body:A.body,...A.line!=null?{line:A.line}:{},...A.side?{side:A.side}:{}})),S=await r(t,s,n,{event:C,body:T.trim()?T:void 0,comments:V},a);if(!S.ok){G.error(S.error?.kind==="failed"?S.error.message:"Failed to submit review");return}f(s,n,B.map(A=>A.id)),x(s,n,T),G.success(C==="approve"?"Pull request approved":C==="request-changes"?"Changes requested":"Review submitted"),F(!1),c?.()}finally{j(!1)}},E=h>0?`Review · ${h}`:"Review";return e.jsxs(We,{open:z,onOpenChange:F,children:[e.jsxs(Ye,{render:e.jsx(P,{type:"button",variant:h>0?"default":"outline",size:d,className:"shrink-0","aria-label":h>0?`Review pull request, ${h} ${h===1?"line comment":"line comments"} pending`:"Review pull request",title:O?"Finish your review":"Approve, request changes, or comment with a review"}),children:[e.jsx(M,{name:"file-check",className:"size-3.5","aria-hidden":"true"}),E]}),e.jsx(Xe,{children:e.jsx(Qe,{className:"z-50",side:"top",align:"end",sideOffset:8,collisionPadding:8,children:e.jsxs(Ze,{"aria-label":"Review pull request",className:"w-[min(24rem,calc(100vw-2rem))] rounded-lg border border-border/60 bg-[var(--surface-elevated)] p-3 shadow-lg",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate typography-ui-label text-foreground",children:h>0?`Review · ${h} ${h===1?"line comment":"line comments"}`:"Review pull request"}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[h>0?e.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Discard pending line comments",title:"Discard pending line comments",disabled:L,onClick:()=>k(s,n),className:"size-6",children:e.jsx(M,{name:"delete-bin",className:"size-3.5"})}):null,e.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Close review",onClick:()=>F(!1),className:"size-6",children:e.jsx(M,{name:"close",className:"size-3.5"})})]})]}),e.jsx(_s,{repo:s,number:n,verdicts:i,summary:g,verdict:C,pendingCount:h,busy:L,textareaRef:b,onSubmit:()=>{N()}})]})})})]})},ye=(t,s)=>`${t}#${s}`,Be=50,Us=Object.freeze([]),_e=(t,s)=>{const n=Object.keys(t);if(n.length<=Be)return t;const a={};for(const l of n.slice(n.length-Be))a[l]=t[l];if(!(s in a)&&s in t){const l=Object.keys(a)[0];delete a[l],a[s]=t[s]}return a},pe=Es()(Fs((t,s)=>({entries:{},setViewed:(n,a,l,d)=>{const c=ye(n,a);(s().entries[c]?.viewed.includes(l)??!1)!==d&&t(x=>{const k=x.entries[c]??{viewed:[],headSha:null},m=d?[...k.viewed,l]:k.viewed.filter(g=>g!==l);return{entries:_e({...x.entries,[c]:{...k,viewed:m}},c)}})},syncHeadSha:(n,a,l)=>{const d=ye(n,a),c=s().entries[d];c&&c.headSha===(l??null)||t(r=>({entries:_e({...r.entries,[d]:{viewed:[],headSha:l??null}},d)}))},resetForRuntimeSwitch:()=>t({entries:{}})}),{name:"pichamber:github-viewed-files",version:1,storage:ks(),partialize:t=>({entries:t.entries})}));typeof window<"u"&&Cs(()=>{pe.getState().resetForRuntimeSwitch()});const Vs=(t,s)=>pe(n=>n.entries[ye(t,s)]?.viewed??Us),Ks=(t,s)=>pe(n=>n.entries[ye(t,s)]?.viewed.length??0),Ue=20,Js=[],Ws=[],Ve=t=>`pr-file-${encodeURIComponent(t)}`,dt=o.memo(({file:t,viewed:s,threadCount:n,pendingCount:a,showDir:l,onSelectFile:d})=>{const c=at(t.status),{dir:r,base:f}=ot(t.filename);return e.jsxs("button",{type:"button",onClick:()=>d(t.filename),title:t.filename,"aria-label":`Go to ${t.filename}`,className:"flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-left hover:bg-interactive-hover",children:[e.jsx(M,{name:lt(c),className:xe("size-3.5 shrink-0",Re(c)),"aria-hidden":"true"}),e.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono typography-micro",children:[l&&r?e.jsxs("span",{className:"text-muted-foreground",children:[r,"/"]}):null,e.jsx("span",{className:"text-foreground",children:f})]}),e.jsx(ge,{additions:t.additions,deletions:t.deletions,className:"typography-micro"}),n>0?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 typography-micro text-muted-foreground",title:`${n} ${n===1?"conversation":"conversations"}`,children:[e.jsx(M,{name:"chat-1",className:"size-3","aria-hidden":"true"}),e.jsx("span",{className:"tabular-nums",children:n})]}):null,a>0?e.jsxs("span",{className:"shrink-0 tabular-nums typography-micro text-muted-foreground",title:`${a} pending`,children:["+",a]}):null,s?e.jsx(M,{name:"check",className:"size-3.5 shrink-0 text-[var(--status-success)]","aria-label":"Viewed"}):null]})});dt.displayName="FileJumpRow";const ut=({files:t,viewedPaths:s,threadCounts:n,pendingCounts:a,onSelectFile:l})=>{const[d,c]=o.useState(""),r=o.useMemo(()=>zs(t),[t]),f=o.useMemo(()=>new Set(s),[s]),x=d.trim().toLowerCase(),k=o.useMemo(()=>x?r.map(m=>({...m,files:m.files.filter(g=>g.filename.toLowerCase().includes(x))})).filter(m=>m.files.length>0):r,[r,x]);return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-1",children:[e.jsx(tt,{value:d,onChange:m=>c(m.target.value),placeholder:"Filter files","aria-label":"Filter files",className:"h-7 shrink-0 typography-micro"}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",role:"list","aria-label":"Changed files",children:k.length===0?e.jsx("p",{className:"px-1.5 py-2 typography-micro text-muted-foreground",children:t.length===0?"No changed files":"No files match"}):k.map(m=>e.jsxs("div",{role:"group","aria-label":m.folder||"Repository root",children:[r.length>1?e.jsx("p",{className:"truncate px-1.5 pt-1.5 pb-0.5 typography-micro text-muted-foreground",title:m.folder||"/",children:m.folder||"/"}):null,m.files.map(g=>e.jsx(dt,{file:g,viewed:f.has(g.filename),threadCount:n.get(g.filename)??0,pendingCount:a.get(g.filename)??0,showDir:r.length<=1,onSelectFile:l},g.filename))]},m.folder))})]})},Ys=t=>{const[s,n]=o.useState(!1),{onSelectFile:a}=t,l=o.useCallback(d=>{n(!1),a(d)},[a]);return e.jsxs(We,{open:s,onOpenChange:n,children:[e.jsxs(Ye,{render:e.jsx(P,{type:"button",variant:"ghost",size:"xs",className:"shrink-0","aria-label":`Jump to file, ${t.files.length} ${t.files.length===1?"file":"files"}`,title:"Jump to file"}),children:[e.jsx(M,{name:"file",className:"size-3.5","aria-hidden":"true"}),"Files"]}),e.jsx(Xe,{children:e.jsx(Qe,{className:"z-50",side:"bottom",align:"start",sideOffset:4,collisionPadding:8,children:e.jsx(Ze,{"aria-label":"Jump to file",className:"flex max-h-[min(28rem,calc(100dvh-4rem))] w-[min(22rem,calc(100vw-2rem))] flex-col rounded-lg border border-border/60 bg-[var(--surface-elevated)] p-1.5 shadow-lg",children:e.jsx(ut,{...t,onSelectFile:l})})})})]})},Xs=48,Qs=(t,s)=>{const[n,a]=o.useState(null);return o.useLayoutEffect(()=>{if(!s)return;const l=t.current?.closest("[data-diff-virtual-root]");if(!(l instanceof HTMLElement))return;const d=()=>{const r=Math.max(160,Math.floor(l.clientHeight-Xs));a(f=>f===r?f:r)};if(d(),typeof ResizeObserver>"u")return;const c=new ResizeObserver(d);return c.observe(l),()=>c.disconnect()},[t,s]),n},Zs=t=>{const{directory:s,repo:n,number:a,github:l,access:d,headSha:c=null}=t,r=t.files?.files??Js,f=Vs(n,a),x=Ks(n,a),k=Le(n,a);o.useEffect(()=>{pe.getState().syncHeadSha(n,a,c)},[n,a,c]);const m=o.useMemo(()=>As(r),[r]),g=o.useRef(m);g.current=m;const p=o.useRef(r);p.current=r;const[z,F]=o.useState({}),[L,j]=o.useState(Ue),b=o.useMemo(()=>$s(r),[r]),i=o.useMemo(()=>{const R=new Map;for(const q of t.threads){if(!q.path)continue;const y=R.get(q.path)??[];y.push(q),R.set(q.path,y)}return R},[t.threads]),C=o.useMemo(()=>{const R=new Map;for(const[q,y]of i)R.set(q,y.length);return R},[i]),h=o.useMemo(()=>{const R=new Map;for(const q of k)R.set(q.path,(R.get(q.path)??0)+1);return R},[k]),O=o.useCallback(R=>{F(q=>({...q,[R]:!(q[R]??g.current[R]??!1)}))},[]),N=o.useCallback(()=>{F(Object.fromEntries(p.current.map(R=>[R.filename,!1])))},[]),E=o.useCallback(()=>{F(Object.fromEntries(p.current.map(R=>[R.filename,!0])))},[]),T=o.useCallback((R,q)=>{pe.getState().setViewed(n,a,R,q),F(y=>({...y,[R]:q}))},[n,a]),B=o.useCallback(R=>{F(y=>y[R]??g.current[R]??!1?{...y,[R]:!1}:y);const q=p.current.findIndex(y=>y.filename===R);q>=0&&j(y=>q<y?y:q+1),requestAnimationFrame(()=>{document.getElementById(Ve(R))?.scrollIntoView({block:"start"})})},[]),V=o.useMemo(()=>r.slice(0,L),[r,L]),S=o.useRef(null),A=Qs(S,V.length>0),K=o.useMemo(()=>new Set(f),[f]),_=r.length===1?"1 file":`${r.length} files`,Q=r.length===0?"Nothing viewed yet":`${x}/${r.length} viewed`;return e.jsxs("section",{"aria-label":"Changed files",className:"@container flex flex-col gap-2","data-diff-virtual-content":!0,children:[e.jsx(ve,{error:t.filesError,onRetry:t.onRetryFiles,label:"Changed files"}),e.jsx(ve,{error:t.threadsError,onRetry:t.onRetryDetail,label:"Review threads"}),e.jsxs("div",{className:"sticky top-0 z-10 flex h-8 shrink-0 items-center gap-2 border-b border-border/60 bg-[var(--surface-background)] px-1 text-[12px]",children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:_}),e.jsx(ge,{additions:b.additions,deletions:b.deletions}),e.jsxs("span",{className:"shrink-0 tabular-nums text-muted-foreground","aria-label":Q,children:[x,"/",r.length," viewed"]}),e.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[e.jsx(ct,{directory:s,repo:n,number:a,github:l,access:d,size:"xs",onReviewSubmitted:t.onReviewSubmitted}),e.jsx("span",{className:"@4xl:hidden",children:e.jsx(Ys,{files:r,viewedPaths:f,threadCounts:C,pendingCounts:h,onSelectFile:B})}),e.jsx(P,{type:"button",variant:"ghost",size:"icon",onClick:N,"aria-label":"Expand all files",title:"Expand all files",className:"size-7",children:e.jsx(M,{name:"expand-up-down",className:"size-3.5"})}),e.jsx(P,{type:"button",variant:"ghost",size:"icon",onClick:E,"aria-label":"Collapse all files",title:"Collapse all files",className:"size-7",children:e.jsx(M,{name:"collapse-vertical",className:"size-3.5"})})]})]}),t.filesLoading&&V.length===0?e.jsx(Rs,{rows:5,label:"Loading changed files"}):null,!t.filesLoading&&V.length===0?e.jsx("p",{className:"px-1 py-4 typography-micro text-muted-foreground",children:"No changed files"}):null,V.length>0?e.jsxs("div",{className:"flex min-h-0 items-start gap-3",children:[e.jsx("aside",{ref:S,"aria-label":"Changed files",style:A!=null?{height:A}:void 0,className:"sticky top-10 hidden max-h-[calc(100dvh-10rem)] w-60 shrink-0 flex-col @4xl:flex",children:e.jsx(ut,{files:r,viewedPaths:f,threadCounts:C,pendingCounts:h,onSelectFile:B})}),e.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:V.map(R=>e.jsx("div",{id:Ve(R.filename),className:"scroll-mt-12",children:e.jsx(Is,{file:R,collapsed:z[R.filename]??m[R.filename]??!1,onToggleCollapse:O,viewed:K.has(R.filename),onToggleViewed:T,blobUrl:Ds(n,c,R.filename),threads:i.get(R.filename)??Ws,directory:s,repo:n,number:a,github:l,access:d,onThreadsChanged:t.onRetryDetail})},R.filename))})]}):null,r.length>L?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>j(L+Ue),children:"Show more files"})}):null,t.filesHasMore?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:t.onLoadMoreFiles,children:"Load more files"})}):null]})},en=({directory:t,repo:s,number:n,github:a,checks:l,checksError:d,checksLoading:c,onRetryChecks:r,onOpenFilesAtLine:f})=>{const[x,k]=o.useState({}),[m,g]=o.useState({}),{send:p,sendingKey:z}=Fe(),F=ls(l);return e.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-1 py-1",children:[e.jsx("p",{className:"min-w-0 flex-1 typography-micro text-muted-foreground","aria-live":"polite",children:F?F.text:c?"Loading checks…":"No checks reported for this pull request."}),F&&F.failed>0?e.jsxs(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{p({key:`pr-${n}-failed-checks`,kind:"checks",directory:t,repo:s,number:n,contextType:"checks"})},disabled:z===`pr-${n}-failed-checks`,"aria-label":"Send failed checks to agent",title:"Send failed checks to agent",children:[e.jsx(M,{name:"send-plane-2",className:"size-3.5"}),"Send failures to agent"]}):null,e.jsxs(P,{type:"button",variant:"ghost",size:"xs",onClick:r,"aria-label":"Refresh checks",title:"Refresh checks",children:[e.jsx(M,{name:"refresh",className:xe("size-3.5",c&&"animate-spin")}),"Refresh"]})]}),e.jsx(ve,{error:d,onRetry:r,label:"Checks"}),l?e.jsx(tn,{checks:l,directory:t,repo:s,number:n,github:a,expandedJobs:x,onToggleJob:L=>k(j=>({...j,[L]:!j[L]})),jobSteps:m,setJobSteps:g,sendingKey:z,send:p,onOpenFilesAtLine:f}):null]})},tn=({checks:t,directory:s,repo:n,number:a,github:l,expandedJobs:d,onToggleJob:c,jobSteps:r,setJobSteps:f,sendingKey:x,send:k,onOpenFilesAtLine:m})=>{const g=I(i=>i.rerunFailedChecks),[p,z]=o.useState({}),F=async i=>{const C=`run-${i.id??i.name}`;if(c(C),!(d[C]||r[C]||i.id==null)){f(h=>({...h,[C]:{steps:[],loading:!0}}));try{const O=(await l.checkJobs(s,n,i.runId??null,i.id)).jobs[0];f(E=>({...E,[C]:{steps:O?.steps??[],loading:!1}}));const N=await l.checkAnnotations(s,n,i.id).catch(()=>null);N&&z(E=>({...E,[i.id]:{loading:!1,items:N.annotations}}))}catch{f(h=>({...h,[C]:{steps:[],loading:!1}}))}}},L=async i=>{(await g(s,n,i,l)).ok?G.success("Re-run requested"):G.error("Re-run failed")},j=i=>{const C=`run-${i.id??i.name}`,h=d[C]??!1,O=r[C],N=os(i);return e.jsxs("div",{className:"rounded-md px-2 py-2 hover:bg-interactive-hover",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(fe,{state:i.conclusion??i.status}),e.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui text-foreground",title:i.name,children:i.name}),i.conclusion?e.jsx("span",{className:"typography-micro text-muted-foreground",children:i.conclusion}):null,e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{F(i)},"aria-expanded":h,"aria-label":`${h?"Collapse":"Expand"} ${i.name}`,children:"Details"}),N&&i.runId!=null?e.jsx(P,{type:"button",variant:"outline",size:"xs",onClick:()=>{L(i.runId)},children:"Re-run"}):null,N?e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{k({key:`${C}-agent`,kind:"check",directory:s,repo:n,number:a,contextType:"checks",detail:i.name})},disabled:x===`${C}-agent`,"aria-label":`Send ${i.name} to agent`,children:"Send to agent"}):null]}),h?e.jsxs("div",{className:"mt-1.5 flex flex-col gap-1 border-t border-border/60 pt-1.5",children:[O?.loading?e.jsx("span",{className:"typography-micro text-muted-foreground",children:"Loading steps…"}):null,(O?.steps??[]).map((E,T)=>e.jsxs("div",{className:"flex items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(fe,{state:E.conclusion??E.status}),e.jsx("span",{className:"truncate",children:E.name}),E.conclusion?e.jsxs("span",{children:["· ",E.conclusion]}):null]},`${E.name}-${T}`)),i.id!=null&&p[i.id]?.items?.length?e.jsx("div",{className:"flex flex-col gap-1",children:p[i.id]?.items.map((E,T)=>e.jsxs("div",{className:"typography-micro text-muted-foreground",children:[E.path&&E.startLine&&m?e.jsxs("button",{type:"button",className:"font-mono underline",onClick:()=>m(E.path,E.startLine),children:[E.path,":",E.startLine]}):e.jsxs("span",{className:"font-mono",children:[E.path,E.startLine?`:${E.startLine}`:""]})," ",E.title?e.jsxs("span",{className:"text-foreground",children:[E.title," — "]}):null,E.message]},T))}):null]}):null]},C)},b=(i,C)=>e.jsxs("div",{className:"flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-interactive-hover",children:[e.jsx(fe,{state:i.state}),e.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui text-foreground",title:i.context,children:i.context}),i.description?e.jsx("span",{className:"truncate typography-micro text-muted-foreground",children:i.description}):null]},`${i.context}-${C}`);return e.jsxs("div",{className:"flex flex-col gap-1",children:[t.sectionErrors?.runs||t.sectionErrors?.statuses?e.jsx("div",{className:"rounded-md border border-[var(--status-warning-border)] bg-[var(--status-warning-background)] px-2 py-1 typography-micro text-foreground",role:"alert",children:"Some check sources failed to load; counts below are partial, not empty."}):null,t.runs.length>0?e.jsx("div",{className:"flex flex-col","aria-label":"Check runs",children:t.runs.map(j)}):null,t.statuses.length>0?e.jsx("div",{className:"flex flex-col","aria-label":"Commit statuses",children:t.statuses.map(b)}):null,t.runs.length===0&&t.statuses.length===0?e.jsx("p",{className:"typography-ui text-muted-foreground",children:"No checks reported for this pull request."}):null]})},Ke=({pr:t})=>e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(nt,{login:t.author?.login,avatarUrl:t.author?.avatarUrl,size:"xs"}),t.author?.login??"ghost"]}),t.updatedAt?` · updated ${gs(t.updatedAt)}`:"",t.draft?" · Draft":""]}),Je=({pr:t,filesCount:s})=>e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"shrink-0 truncate",title:t.base,children:t.base}),e.jsx("span",{className:"shrink-0","aria-label":"receives changes from",children:"←"}),e.jsx("code",{className:"min-w-0 flex-1 truncate",title:t.head,children:t.head}),typeof s=="number"?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 tabular-nums",children:[e.jsx(M,{name:"file-code",className:"size-3 shrink-0","aria-hidden":"true"}),s," ",s===1?"file":"files"]}):null,e.jsx(ge,{additions:t.additions,deletions:t.deletions})]}),sn=({repo:t,pr:s,access:n,acting:a,mergeMethod:l,onMergeMethodChange:d,onRun:c,checkingOut:r,onCheckout:f,onCopyLink:x,askSending:k,onAskAgent:m})=>{const g=I(N=>N.setMergeMethod),p=s.state==="open",z=be.filter(N=>te(N.id,s,n).allowed),F=z.some(N=>N.id===l)?l:z[0]?.id??l,L=te(F,s,n),j=te("ready",s,n),b=te("draft",s,n),i=te("close",s,n),C=te("reopen",s,n),h=be.find(N=>N.id===F)??be[0],O=z.length===0||a;return e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 pt-1 pb-2","aria-label":"Pull request actions",children:[p&&!s.draft?e.jsxs("span",{role:"group","aria-label":"Merge pull request",className:"inline-flex shrink-0 items-center gap-1",children:[e.jsx(ce,{copy:he(F,s.base,s.head),busy:a,disabled:!L.allowed,disabledReason:L.reason??`Merge via ${h.label}`,label:F==="merge"?"Merge pull request":h.label,icon:e.jsx(M,{name:"git-merge",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c(F)}),e.jsxs(Me,{modal:!1,children:[e.jsx(ze,{asChild:!0,children:e.jsx(P,{type:"button",variant:"default",size:"xs",className:"shrink-0 px-1.5",title:"Merge options","aria-label":"Merge options",disabled:O,children:e.jsx(M,{name:"arrow-down-s",className:"size-3.5"})})}),e.jsx($e,{align:"start",className:"w-72",children:e.jsx(Et,{value:F,onValueChange:N=>{const E=N;d(E),g(t,E)},children:be.map(N=>{const E=te(N.id,s,n);return e.jsx(Ft,{value:N.id,disabled:!E.allowed,title:E.reason??N.description,children:e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"truncate",children:N.label}),e.jsx("span",{className:"truncate typography-micro text-muted-foreground",children:N.description})]})},N.id)})})})]})]}):null,p&&s.draft?e.jsx(ce,{copy:he("ready",s.base,s.head),busy:a,disabled:!j.allowed,disabledReason:j.reason??"Ready for review",label:"Ready for review",icon:e.jsx(M,{name:"git-pull-request",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c("ready")}):null,p&&!s.draft?e.jsx(ce,{copy:he("draft",s.base,s.head),busy:a,variant:"outline",disabled:!b.allowed,disabledReason:b.reason??"Convert to draft",label:"Convert to draft",icon:e.jsx(M,{name:"pencil",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c("draft")}):null,p?e.jsx(ce,{copy:he("close",s.base,s.head),busy:a,destructive:!0,variant:"outline",disabled:!i.allowed,disabledReason:i.reason??"Close pull request",label:"Close",icon:e.jsx(M,{name:"close",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c("close")}):e.jsxs(P,{type:"button",variant:"outline",size:"xs",className:"shrink-0",onClick:()=>c("reopen"),disabled:!C.allowed||a,title:C.reason??"Reopen pull request","aria-label":"Reopen pull request",children:[e.jsx(M,{name:"history",className:"size-3.5","aria-hidden":"true"}),"Reopen"]}),e.jsxs(P,{type:"button",variant:"outline",size:"xs",className:"shrink-0",onClick:()=>f("worktree"),disabled:r,title:"Check out in a new worktree","aria-label":"Check out in a new worktree",children:[e.jsx(M,{name:"git-branch",className:"size-3.5","aria-hidden":"true"}),r?"Checking out…":"Check out"]}),e.jsx(ce,{copy:{title:"Check out this branch here?",detail:"This switches your current checkout to the PR branch. Uncommitted work may be disrupted.",confirm:"Check out here",progress:"Checking out…"},busy:r,variant:"outline",label:"Check out here",icon:e.jsx(M,{name:"git-branch",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>f("current")}),e.jsxs(P,{type:"button",variant:"outline",size:"xs",className:"shrink-0",onClick:m,disabled:k,title:"Send pull request context to the agent composer","aria-label":"Ask agent about this pull request",children:[e.jsx(M,{name:"send-plane-2",className:"size-3.5","aria-hidden":"true"}),k?"Asking…":"Ask agent"]}),e.jsxs(P,{type:"button",variant:"ghost",size:"xs",className:"shrink-0",onClick:()=>{Se(s.url)},title:"Review on GitHub","aria-label":"Review on GitHub",children:[e.jsx(M,{name:"external-link",className:"size-3.5","aria-hidden":"true"}),"Review on GitHub"]}),e.jsxs(Me,{modal:!1,children:[e.jsx(ze,{asChild:!0,children:e.jsx(P,{type:"button",variant:"ghost",size:"xs",className:"shrink-0 px-1.5","aria-label":"More pull request actions",title:"More pull request actions",children:e.jsx(M,{name:"more-2",className:"size-4"})})}),e.jsxs($e,{align:"end",className:"w-60",children:[e.jsxs(we,{onClick:()=>{Se(s.url)},children:[e.jsx(M,{name:"external-link",className:"size-3.5"}),"Open on GitHub"]}),e.jsxs(we,{onClick:x,children:[e.jsx(M,{name:"file-copy",className:"size-3.5"}),"Copy link"]}),e.jsx(Pt,{}),e.jsxs(we,{onClick:()=>f("worktree"),disabled:r,children:[e.jsx(M,{name:"git-branch",className:"size-3.5"}),"Check out in new worktree"]})]})]})]})},nn=({pr:t,access:s,acting:n,onRun:a})=>{const l=bs(t);if(!l)return null;const d=te("update-branch",t,s),c=l.tone==="error"?"border-[var(--status-error-border)] bg-[var(--status-error-background)] text-foreground":"border-[var(--status-warning-border)] bg-[var(--status-warning-background)] text-foreground",r=l.tone==="error"?"text-[var(--status-error)]":"text-[var(--status-warning)]";return e.jsxs("div",{className:`mx-3 mb-2 flex flex-wrap items-center gap-x-2 gap-y-1.5 rounded-md border px-2.5 py-2 ${c}`,role:"status",children:[e.jsx(M,{name:l.icon,className:`size-4 shrink-0 ${r}`,"aria-hidden":"true"}),e.jsxs("p",{className:"min-w-0 flex-1 basis-48",children:[e.jsxs("span",{className:"typography-ui-label font-medium",children:[l.title," ",e.jsx("code",{className:"font-mono",children:t.base})]}),e.jsx("span",{className:"block typography-micro text-muted-foreground",children:l.detail})]}),l.canUpdate?e.jsx(ce,{copy:he("update-branch",t.base,t.head),busy:n,variant:"outline",disabled:!d.allowed,disabledReason:d.reason??"Update branch",label:"Update branch",icon:e.jsx(M,{name:"refresh",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>a("update-branch")}):e.jsxs(P,{type:"button",variant:"outline",size:"xs",className:"shrink-0",onClick:()=>{Se(t.url)},title:"Resolve conflicts on GitHub","aria-label":"Resolve conflicts on GitHub",children:[e.jsx(M,{name:"external-link",className:"size-3.5","aria-hidden":"true"}),"Resolve on GitHub"]})]})},an=t=>{const{directory:s,repo:n,number:a,github:l,detail:d}=t,c=I(u=>u.performAction),r=I(u=>u.updateTitleBody),f=I(u=>u.checkout),[x,k]=o.useState("summary"),[m,g]=o.useState(!1),[p,z]=o.useState(()=>zt(n)??"merge"),[F,L]=o.useState(!1),[j,b]=o.useState(""),[i,C]=o.useState(!1),[h,O]=o.useState(""),[N,E]=o.useState("newest"),[T,B]=o.useState(1),[V,S]=o.useState(!1),[A,K]=o.useState(null),_=gt(n,a),{send:Q,sendingKey:R}=Fe(),q=is(s,n),y=d?.pr??null,de=d?.sectionErrors??null,X=o.useMemo(()=>({capabilities:d?.capabilities??null,isAuthor:rs(y?.author?.login,d?.viewerLogin),permissionFallback:d?.viewerPermission?.fallback===!0}),[d?.capabilities,d?.viewerLogin,d?.viewerPermission?.fallback,y?.author?.login]),ee=cs(y,X);o.useEffect(()=>{k("summary"),L(!1),C(!1),B(1),K(null)},[n,a]);const Z=o.useCallback(async u=>{g(!0);try{const Y=await c(s,n,a,u,l);if(!Y.ok){G.error(Y.error?.kind==="failed"?Y.error.message:"Action failed");return}u==="close"?G.success("Pull request closed"):u==="reopen"?G.success("Pull request reopened"):u==="update-branch"?G.success("Branch update requested"):u==="ready"?G.success("Marked as ready for review"):u==="draft"?G.success("Converted to draft"):G.success("Pull request merged")}finally{g(!1)}},[s,n,a,l,c]),se=o.useCallback(()=>{Q({key:`pr-${a}-ask`,kind:"pr",directory:s,repo:n,number:a,contextType:"pr"})},[Q,s,n,a]),ne=o.useCallback(async()=>{if(!j.trim()){G.error("Enter a title");return}const u=await r(s,n,a,{title:j.trim()},l);u.ok?(G.success("Title updated"),L(!1)):G.error(u.error?.kind==="failed"?u.error.message:"Failed to update title")},[j,s,n,a,l,r]),oe=o.useCallback(async()=>{const u=await r(s,n,a,{body:h},l);u.ok?(G.success("Description updated"),C(!1)):G.error(u.error?.kind==="failed"?u.error.message:"Failed to update description")},[h,s,n,a,l,r]),ae=Ee().git,ue=o.useCallback(async u=>{if(u==="current"){const Y=await Ne(()=>import("./useAppFontEffects-Oyin3dgQ.js").then(re=>re.ez),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(re=>re.useGitStore.getState().directories.get(s)?.status??null).catch(()=>null);if(Y&&!Y.isClean){G.error("Working tree has uncommitted changes. Commit or stash first, or use New worktree.");return}}S(!0);try{const Y=await f(s,n,a,u,l);Y.ok?(await bt(s,ae),K({path:Y.path??null,branch:Y.branch??""}),G.success(u==="worktree"?"Worktree created":"Branch checked out")):G.error(Y.error?.kind==="failed"?Y.error.message:"Checkout failed")}finally{S(!1)}},[s,n,a,l,ae,f]),w=o.useCallback(()=>{A?.path&&Ne(async()=>{const{useSessionUIStore:u}=await import("./useAppFontEffects-Oyin3dgQ.js").then(Y=>Y.ew);return{useSessionUIStore:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(({useSessionUIStore:u})=>{u.getState().openNewSessionDraft({directoryOverride:A.path}),Ns.getState().setActiveMainTab("chat")})},[A]),D=ds(y?.url),H=o.useMemo(()=>{const u=[...t.comments];return u.sort((Y,je)=>{const re=Y.createdAt?Date.parse(Y.createdAt):0,Te=je.createdAt?Date.parse(je.createdAt):0;return N==="newest"?Te-re:re-Te}),u},[t.comments,N]),$=H.slice(0,T*20),U=$.filter(u=>!De(u.author?.login)),W=$.filter(u=>De(u.author?.login));if(t.detailError&&!d)return e.jsx(ke,{header:e.jsx(Ce,{onBack:t.onBack,backLabel:"Back to pull requests",repoName:q,number:a,openLabel:`Open pull request #${a} on GitHub`,title:`Pull request #${a}`}),tabs:[],activeTab:"",onTabChange:()=>{},children:e.jsx(et,{info:vt(t.detailError),onRetry:t.onRetryDetail})});if(!y){const u=t.seed&&t.seed.number===a?t.seed:null;return e.jsx(ke,{header:e.jsx(Ce,{onBack:t.onBack,backLabel:"Back to pull requests",repoName:q,number:a,url:u?.url??null,numberTintClass:u?He("pr",u.state,u.draft):void 0,statePill:u?e.jsx(Ge,{kind:"pr",state:u.state,draft:u.draft}):void 0,openLabel:`Open pull request #${a} on GitHub`,title:u?.title??null,meta:u?e.jsx(Ke,{pr:u}):void 0,branches:u?e.jsx(Je,{pr:u,filesCount:u.changedFiles??null}):void 0}),tabs:[],activeTab:"",onTabChange:()=>{},children:e.jsx(us,{label:"Loading pull request"})})}const J=t.checks?.summary??null,me=t.files?.files.length??y.changedFiles??0,v=_>0&&!t.hideFilesTab?`${me} · ${_} pending`:String(me);return e.jsx(ke,{header:e.jsxs(e.Fragment,{children:[e.jsx(Ce,{onBack:t.onBack,backLabel:"Back to pull requests",repoName:q,number:y.number,url:y.url,numberTintClass:He("pr",y.state,y.draft),statePill:e.jsx(Ge,{kind:"pr",state:y.state,draft:y.draft}),openLabel:`Open pull request #${y.number} on GitHub`,title:y.title,onEditTitle:()=>{b(y.title),L(!0)},editTitleLabel:"Edit pull request title",editTitleDisabledReason:ee.allowed?null:ee.reason,meta:e.jsx(Ke,{pr:y}),branches:e.jsx(Je,{pr:y,filesCount:me})}),e.jsx(sn,{directory:s,repo:n,number:a,github:l,pr:y,access:X,acting:m,mergeMethod:p,onMergeMethodChange:z,onRun:u=>{Z(u)},checkingOut:V,onCheckout:u=>{ue(u)},onCopyLink:D,askSending:R===`pr-${a}-ask`,onAskAgent:se}),e.jsx(nn,{pr:y,access:X,acting:m,onRun:u=>{Z(u)}})]}),tabs:[{id:"summary",label:"Summary"},...t.hideFilesTab?[]:[{id:"files",label:"Code",hint:v}],{id:"checks",label:"Checks",hint:J?`${J.success}/${J.total}`:void 0,glyph:J?e.jsx(fe,{state:J.state}):void 0}],activeTab:x,onTabChange:u=>k(u),children:e.jsxs("div",{className:"flex flex-col gap-1 px-3 py-2",children:[t.detailStale?e.jsxs("p",{className:"typography-micro text-muted-foreground",role:"note",children:["Showing saved details — last refresh failed."," ",e.jsx("button",{type:"button",className:"underline",onClick:t.onRetryDetail,children:"Retry"})]}):null,X.permissionFallback?e.jsx("p",{className:"typography-micro text-muted-foreground",role:"note",children:"Permissions could not be loaded — actions stay enabled and any failure will be shown after you act."}):null,F?e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 py-1",children:[e.jsx(tt,{value:j,onChange:u=>b(u.target.value),"aria-label":"Pull request title",className:"h-7"}),e.jsx(P,{type:"button",variant:"default",size:"xs",onClick:()=>{ne()},children:"Save"}),e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>L(!1),children:"Cancel"})]}):null,A?e.jsxs("p",{className:"flex flex-wrap items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(M,{name:"check",className:"size-3.5 shrink-0 text-[var(--status-success)]"}),e.jsxs("span",{children:["Ready on ",A.branch,A.path?` at ${A.path}`:"","."]}),A.path?e.jsx(P,{type:"button",variant:"default",size:"xs",onClick:w,children:"Open session here"}):null,e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>K(null),"aria-label":"Dismiss checkout result",children:"Dismiss"})]}):null,x==="summary"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5 py-1",children:[e.jsx(qe,{icon:"user",label:"Reviewers",children:e.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5",children:[y.requestedReviewers.length===0?e.jsx("span",{className:"typography-micro text-muted-foreground",children:"None"}):y.requestedReviewers.map(u=>e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 typography-micro text-muted-foreground",children:[e.jsx(nt,{login:u.login,avatarUrl:u.avatarUrl,size:"xs"}),e.jsx("span",{className:"truncate",children:u.login})]},u.login)),e.jsxs("span",{className:"typography-micro tabular-nums text-muted-foreground",children:[y.reviewSummary.approvals," approvals · ",y.reviewSummary.changesRequested," changes requested ·"," ",y.reviewSummary.commented," commented"]})]})}),e.jsx(qe,{icon:"list-unordered",label:"Labels",children:e.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:y.labels.length===0?e.jsx("span",{className:"typography-micro text-muted-foreground",children:"None"}):y.labels.map(u=>e.jsx(ms,{name:u.name,color:u.color},u.name))})})]}),e.jsx(Ie,{id:`pr-${a}-description`,title:"Description",action:i?void 0:e.jsx(P,{type:"button",variant:"ghost",size:"xs",onClick:()=>{O(y.body??""),C(!0)},"aria-label":"Edit description",title:ee.reason??"Edit description",disabled:!ee.allowed,children:"Edit"}),children:i?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("textarea",{value:h,onChange:u=>O(u.target.value),rows:6,"aria-label":"Pull request description",className:"min-h-24 w-full rounded-md border border-border bg-[var(--surface-elevated)] p-2 typography-ui text-foreground"}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(P,{type:"button",variant:"default",size:"sm",onClick:()=>{oe()},children:"Save"}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>C(!1),children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(hs,{markdown:y.body??"",html:y.bodyHtml??null,fallbackUrl:y.url,label:"pull request description"}),y.body?.trim()?null:e.jsx("p",{className:"typography-micro text-muted-foreground",children:"No description provided."})]})}),e.jsx(Ie,{id:`pr-${a}-comments`,title:`Comments${H.length?` (${H.length})`:""}`,action:e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[t.hideFilesTab?e.jsx(ct,{directory:s,repo:n,number:a,github:l,access:X,size:"xs",onReviewSubmitted:t.onRetryDetail}):null,e.jsx(ps,{order:N,onToggle:()=>E(N==="newest"?"oldest":"newest")})]}),children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(ve,{error:t.commentsError,onRetry:t.onRetryComments,label:"Comments"}),U.map(u=>e.jsx(fs,{comment:u},u.id)),e.jsx(xs,{comments:W}),t.commentsLoading&&H.length===0&&!t.commentsError?e.jsx("p",{className:"typography-micro text-muted-foreground",children:"Loading comments…"}):null,H.length===0&&!t.commentsLoading&&!t.commentsError?e.jsx("p",{className:"typography-micro text-muted-foreground",children:"No comments yet."}):null,H.length>$.length?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>B(T+1),children:"Show older comments"})}):t.commentsHasMore?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:t.onLoadMoreComments,disabled:t.commentsLoading,children:t.commentsLoading?"Loading…":"Load older comments"})}):null,e.jsx(Os,{directory:s,repo:n,number:a,github:l,pr:y,access:X,onCommented:()=>{t.onRetryComments(),t.onRetryDetail()}})]})})]}):null,x==="files"&&!t.hideFilesTab?e.jsx(Zs,{files:t.files,filesLoading:t.filesLoading,filesError:t.filesError,filesHasMore:t.filesHasMore,onLoadMoreFiles:t.onLoadMoreFiles,onRetryFiles:t.onRetryFiles,threads:t.threads,threadsError:de?.threads??null,onRetryDetail:t.onRetryDetail,directory:s,repo:n,number:a,github:l,access:X,headSha:y.headSha??null,onReviewSubmitted:t.onRetryDetail},`${n}#${a}`):null,x==="checks"?e.jsx(en,{directory:s,repo:n,number:a,github:l,checks:t.checks,checksError:t.checksError,checksLoading:t.checksLoading,onRetryChecks:t.onRetryChecks,onOpenFilesAtLine:t.onOpenFilesAtLine}):null]})})},ln=({items:t,hasMore:s,isLoadingMore:n,isLoading:a,isRefreshing:l,stale:d,error:c,filters:r,checksByUrl:f,incompleteNotice:x=null,remote:k=null,numberJump:m=null,onFiltersChange:g,onClearFilters:p,onLoadMore:z,onRetry:F,onOpen:L,headerActionsSlot:j=null,headerActionsPresentation:b="drawer"})=>{const i=r.state==="open"&&r.involvement==="all"&&!r.search.trim(),C=o.useCallback(h=>e.jsx("li",{role:"listitem",children:e.jsx(yt,{glyph:e.jsx(vs,{kind:"pr",state:h.state,draft:h.draft}),glyphBelow:e.jsx(fe,{state:(h.url?f[h.url]:void 0)??null}),number:`#${h.number}`,title:h.title,status:e.jsx(ge,{additions:h.additions,deletions:h.deletions,className:"typography-micro"}),meta:e.jsxs(e.Fragment,{children:[e.jsx(jt,{login:h.author?.login,avatarUrl:h.author?.avatarUrl}),e.jsx(wt,{head:h.head,base:h.base}),h.draft?e.jsx("span",{className:"shrink-0 rounded bg-[var(--surface-muted)] px-1 typography-micro text-muted-foreground",children:"Draft"}):null]}),updatedAt:h.updatedAt,onOpen:()=>L(h.number),ariaLabel:`Open pull request #${h.number} ${h.title}`})},h.number),[f,L]);return e.jsx(kt,{items:t,renderRow:C,hasMore:s,isLoadingMore:n,isLoading:a,isRefreshing:l,stale:d,error:c,searchValue:r.search,onSearchChange:h=>g({search:h}),searchPlaceholder:"Search pull requests, or label:bug",searchAriaLabel:"Search pull requests",toolbarControls:e.jsx(Ct,{stateValue:r.state,stateOptions:ws.map(h=>({id:h.id,label:h.label})),onStateChange:h=>g({state:h}),involvementValue:r.involvement,involvementOptions:js.map(h=>({id:h.id,label:h.label})),onInvolvementChange:h=>g({involvement:h}),sortValue:r.sort,sortOptions:ys.map(h=>({id:h.id,label:h.label})),onSortChange:h=>g({sort:h}),sortAriaLabel:"Sort pull requests"}),headerActionsSlot:j,headerActionsPresentation:b,isDefaultFilters:i,noItemsTitle:r.state==="open"?"No open pull requests":"No pull requests yet",noItemsBody:"Pull requests for this repository appear here.",noItemsIcon:"git-pull-request",listAriaLabel:"Pull requests",skeletonLabel:"Loading pull requests",incompleteNotice:x,remote:k,numberJump:m,numberJumpKind:"pull request",onClearFilters:p,onLoadMore:z,onRetry:F,onOpen:L})},on=t=>{const s=$t(n=>n.results);return o.useMemo(()=>{const n=At(s),a={};for(const l of t){if(!l.url)continue;const d=n.get(l.url);d!==void 0&&(a[l.url]=d)}return a},[t,s])},da=({hideFilesTab:t=!1,headerActionsSlot:s=null,headerActionsPresentation:n="drawer"})=>{const a=Tt()??"";return a?e.jsx(rn,{directory:a,hideFilesTab:t,headerActionsSlot:s,headerActionsPresentation:n}):e.jsx("div",{className:"flex h-full items-center justify-center p-6 text-center",children:e.jsx("p",{className:"typography-ui text-muted-foreground",children:"Open a project to browse pull requests."})})},rn=({directory:t,hideFilesTab:s,headerActionsSlot:n=null,headerActionsPresentation:a="drawer"})=>{const d=Ee().github??null,[c,r]=o.useState(!1),[f,x]=o.useState(!1),k=o.useRef(null);return o.useEffect(()=>Dt(),[]),e.jsx(Nt,{directory:t,isRefreshing:c,onRefresh:()=>k.current?.(),children:({repo:m,directory:g})=>e.jsx(cn,{directory:g,repo:m,github:d,refreshing:c,setRefreshing:r,loadingMore:f,setLoadingMore:x,refreshRef:k,hideFilesTab:s,headerActionsSlot:n,headerActionsPresentation:a},m)})},cn=({directory:t,repo:s,github:n,refreshing:a,setRefreshing:l,loadingMore:d,setLoadingMore:c,refreshRef:r,hideFilesTab:f,headerActionsSlot:x=null,headerActionsPresentation:k="drawer"})=>{const m=I(v=>v.ensureCollectionsFresh),g=I(v=>v.searchRemote),p=I(v=>v.loadMoreRemote),z=I(v=>v.loadMoreCollection),F=I(v=>v.refreshAllForScope),L=I(v=>v.selectPullRequest),j=I(v=>v.setFilters),b=I(v=>v.resetFilters),i=Gt(t,s),C=Ht(t),h=qt(),O=C.repo===s?C.number:null,N=i.state==="open"?"open":i.state==="all"?"both":"closed";o.useEffect(()=>{if(!n)return;let v=!1;return l(!0),m(t,s,N,n).then(()=>{v||l(!1)}).catch(()=>{v||l(!1)}),()=>{v=!0}},[t,s,n,N]),o.useEffect(()=>{if(!n)return;const v=()=>{typeof document<"u"&&document.hidden||m(t,s,N,n).catch(()=>{})};return window.addEventListener("focus",v),document.addEventListener("visibilitychange",v),()=>{window.removeEventListener("focus",v),document.removeEventListener("visibilitychange",v)}},[t,s,n,N]);const E=Ae(s,"open"),T=Ae(s,"closed"),B=o.useMemo(()=>It(s),[s,E?.data,T?.data]),V=o.useMemo(()=>new Set(B.map(v=>v.number)),[B]),S=o.useMemo(()=>Ot(B,{state:i.state,involvement:i.involvement,search:i.search,sort:i.sort,viewerLogin:h}),[B,i.state,i.involvement,i.search,i.sort,h]),A=on(S),K=N==="both"?[E,T]:[N==="open"?E:T],_=K.some(v=>v?.data!=null),Q=_&&K.every(v=>v?.data?.nextCursor==null),R=K.reduce((v,u)=>v+(u?.data?.items.length??0),0),q=K.find(v=>v?.error)?.error??null,y=K.some(v=>v?.isLoading),de=K.some(v=>v?.stale),X=i.search.trim(),ee=i.involvement!=="all"&&!h,Z=X.length>0||i.involvement!=="all",se=o.useMemo(()=>({state:i.state,involvement:i.involvement,q:X}),[i.state,i.involvement,X]),ne=`${se.state}|${se.involvement}|${se.q}`,oe=!Q&&_&&S.length===0&&(X.length>0||ee),ae=o.useCallback(v=>n?g(t,s,v,n):Promise.resolve(null),[t,s,n,g]),ue=o.useCallback(v=>n?p(t,s,v,n):Promise.resolve(null),[t,s,n,p]),{remoteView:w,numberJump:D,remotePending:H,handleSearchAll:ie}=St({repo:s,query:se,queryKey:ne,autoRemote:oe,indexNumbers:V,visibleItems:S,searchText:X,useRemoteEntry:Jt,runSearch:ae,runLoadMore:ue}),$=o.useMemo(()=>{if(Q||!_||!Z)return null;const v=S.length===1?"1 match":`${S.length} matches`,u=R===1?"1 most recent loaded pull request":`${R} most recent loaded pull requests`;return`Showing ${v} from the ${u}`},[Q,_,Z,S.length,R]),U=o.useCallback(()=>{n&&(l(!0),F(t,s,n).then(()=>{l(!1)}).catch(()=>l(!1)))},[t,s,n,F,l]);o.useEffect(()=>(r.current=U,()=>{r.current===U&&(r.current=null)}),[r,U]);const W=o.useCallback(()=>{if(!n)return;c(!0);const v=N==="both"?["open","closed"]:[N];Promise.all(v.map(u=>z(t,s,u,n))).then(()=>c(!1)).catch(()=>c(!1))},[t,s,N,n,z,c]),J=o.useCallback(v=>{L(t,s,v)},[t,s,L]),me=o.useCallback(()=>{L(t,null,null)},[t,L]);return n?O!=null?e.jsx(dn,{directory:t,repo:s,number:O,github:n,onBack:me,hideFilesTab:f,seed:Bt(s,O)}):e.jsx(ln,{items:S,headerActionsSlot:x,headerActionsPresentation:k,hasMore:K.some(v=>v?.data?.nextCursor!=null),isLoadingMore:d,isLoading:y,isRefreshing:a&&_,stale:de,error:q,filters:i,checksByUrl:A,incompleteNotice:$?{summary:$,searching:H,onSearchAll:ie}:null,remote:w,numberJump:D,onFiltersChange:v=>j(t,s,v),onClearFilters:()=>b(t,s),onLoadMore:W,onRetry:U,onOpen:J}):e.jsx(et,{info:{reason:"failed",message:"GitHub is not available in this runtime."}})},dn=({directory:t,repo:s,number:n,github:a,onBack:l,hideFilesTab:d,seed:c})=>{const r=I(S=>S.ensureDetail),f=I(S=>S.ensureComments),x=I(S=>S.ensureFiles),k=I(S=>S.ensureChecks),m=I(S=>S.loadMoreFiles),g=I(S=>S.loadMoreComments),p=I(S=>S.refreshComments),z=I(S=>S.refreshDetail),F=I(S=>S.refreshChecks);o.useEffect(()=>{r(t,s,n,a).catch(()=>{}),f(t,s,n,a).catch(()=>{}),d||x(t,s,n,a).catch(()=>{}),k(t,s,n,a).catch(()=>{})},[t,s,n,d]);const L=_t(s,n),j=Ut(s,n),b=Vt(s,n),i=Kt(s,n),C=L?.data?.detail??null,h=o.useCallback((S,A)=>{const K=Ss(t);Ne(async()=>{const{useUIStore:_}=await import("./index-Cs2nBW_t.js").then(Q=>Q.cM);return{useUIStore:_}},__vite__mapDeps([1,2,3,4,5,6,7,8])).then(({useUIStore:_})=>{_.getState().openContextFileAtLine(K,S,A)}).catch(()=>{})},[t]),O=o.useCallback(()=>{m(t,s,n,a).catch(()=>{})},[t,s,n,a,m]),N=o.useCallback(()=>{g(t,s,n,a).catch(()=>{})},[t,s,n,a,g]),E=o.useCallback(()=>{p(t,s,n,a).catch(()=>{})},[t,s,n,a,p]),T=o.useCallback(()=>{z(t,s,n,a).catch(()=>{})},[t,s,n,a,z]),B=o.useCallback(()=>{x(t,s,n,a).catch(()=>{})},[t,s,n,a,x]),V=o.useCallback(()=>{F(t,s,n,a).catch(()=>{})},[t,s,n,a,F]);return e.jsx(an,{hideFilesTab:d,seed:c,directory:t,repo:s,number:n,github:a,detail:C,detailError:L?.error??null,detailStale:L?.stale??!1,files:b?.data??null,filesError:b?.error??null,filesLoading:b?.isLoading??!1,filesHasMore:b?.data?.nextCursor!=null,onLoadMoreFiles:O,checks:i?.data??null,checksError:i?.error??null,checksLoading:i?.isLoading??!1,reviews:C?.reviews??[],threads:C?.threads??[],comments:j?.data?.comments??[],commentsError:j?.error??null,commentsLoading:j?.isLoading??!1,commentsHasMore:j?.data?.nextCursor!=null,onLoadMoreComments:N,onRetryComments:E,onBack:l,onRetryDetail:T,onRetryFiles:B,onRetryChecks:V,onOpenFilesAtLine:h})};export{da as PullRequestsSurface};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,ba as k}from"./vendor-boot-3SaHYVb1.js";import{R as f}from"./vendor-react-Bz1tRBxM.js";import{h as w,I as x,i as E,j as M,k as G,v as q,m as B,n as F,r as H,q as z}from"./useAppFontEffects-Oyin3dgQ.js";import{u as J}from"./useSwitcherItems-BSqDA1IF.js";import{h as K,f as C}from"./index-Cs2nBW_t.js";import{a as O,S as Q,f as V}from"./SessionUnreadDot-CY9-1iV2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-DiP2a57a.js";import"./nativeFileSave-DpBH1Sa3.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";function le({onSelect:s,variant:m,scopeProjectId:d}){const i=J(!0,{scopeProjectId:d}),o=w(t=>t.openNewSessionDraft),a=K(t=>t.setActiveMainTab),l=f.useCallback(()=>{a("chat"),s(),o()},[s,o,a]),[c,p]=f.useState(new Set),u=f.useCallback(t=>{p(h=>{const r=new Set(h);return r.has(t)?r.delete(t):r.add(t),r})},[]);return e.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(k,{onClick:l,className:C("group relative flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),children:[e.jsx(x,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:"New session"})]}),i.length===0?e.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:"No recent sessions"}):i.map(t=>e.jsx(D,{item:t,depth:0,variant:m,expandedParents:c,toggleParent:u,closeDropdown:s},t.node.session.id))]})})}function D({item:s,depth:m,variant:d,expandedParents:i,toggleParent:o,closeDropdown:a}){const{node:l,secondaryMeta:c}=s,p=l.session,u=l.children.length>0,t=i.has(p.id);return e.jsxs(e.Fragment,{children:[e.jsx(W,{session:p,depth:m,variant:d,secondaryMeta:c,hasChildren:u,isExpanded:t,onToggleExpand:u?()=>o(p.id):void 0,closeDropdown:a}),u&&t?l.children.map(h=>e.jsx(D,{item:{node:h,projectId:s.projectId,groupDirectory:s.groupDirectory,secondaryMeta:c},depth:m+1,variant:d,expandedParents:i,toggleParent:o,closeDropdown:a},h.session.id)):null]})}function W({session:s,depth:m,variant:d,secondaryMeta:i,hasChildren:o,isExpanded:a,onToggleExpand:l,closeDropdown:c}){const p=w(n=>n.currentSessionId),u=w(n=>n.setCurrentSession),t=E(s.id),h=M(s.id),r=G(s.id),g=p===s.id,L=q(s),N=t?.type??"idle",b=N==="busy"||N==="retry",S=B({pendingInput:r,isStreaming:b,unseenCount:h,isActive:g}),v=S==="needs-input",A=v&&r?F(r.kind,r.count):null,T=S==="unread",U=s.time?.updated||s.time?.created||Date.now(),P=V(U),y=i?.projectLabel?.trim()||null,j=i?.branchLabel?.trim()||null,I=j&&j!=="HEAD"?j:null,R=f.useCallback(()=>{if(g){c();return}const n=H(s);u(s.id,n??null),c()},[c,g,s,u]);return e.jsxs(k,{onClick:n=>{if(n.target?.closest("[data-switcher-expand]")){n.preventDefault();return}R()},"data-slot":"session-switcher-item",className:C("group relative flex w-full cursor-pointer items-start gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),style:{paddingLeft:8+m*12},children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[d==="compact"&&o?e.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:n=>{n.preventDefault(),n.stopPropagation(),l?.()},className:"inline-flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded text-subtle-foreground hover:text-foreground","aria-label":a?"Collapse subsessions":"Expand subsessions",children:a?e.jsx(x,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):e.jsx(x,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:L})]}),d==="default"?e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 truncate text-subtle-foreground leading-tight typography-micro",children:[o?e.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:n=>{n.preventDefault(),n.stopPropagation(),l?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-subtle-foreground hover:text-foreground","aria-label":a?"Collapse subsessions":"Expand subsessions",children:a?e.jsx(x,{name:"arrow-down-s",className:"h-3 w-3"}):e.jsx(x,{name:"arrow-right-s",className:"h-3 w-3"})}):null,e.jsx("span",{className:"flex-shrink-0",children:b?e.jsx(O,{sessionId:s.id,running:!0}):T?e.jsx(Q,{label:"Session complete"}):P}),y?e.jsx("span",{className:"truncate",children:y}):null,I?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(x,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-subtle-foreground"}),e.jsx("span",{className:"truncate",children:I})]}):null]}):null]}),v?e.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:e.jsx(z,{label:A??"Needs input"})}):b?e.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary animate-busy-pulse","aria-label":"Session active",title:"Session active"})}):null]})}export{le as default};
|
package/dist/assets/{SessionSwitcherDropdown-CEAid1Bd.js → SessionSwitcherDropdown-D86FaZg_.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionSwitcherContent-
|
|
2
|
-
import{_ as m}from"./vendor-vite-runtime-DD1OZmLC.js";import{j as e}from"./vendor-boot-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionSwitcherContent-B5DaBWZU.js","assets/vendor-boot-3SaHYVb1.js","assets/vendor-react-Bz1tRBxM.js","assets/vendor-clsx-B-dksMZM.js","assets/useAppFontEffects-Oyin3dgQ.js","assets/index-Cs2nBW_t.js","assets/vendor-zustand-CXhN0IMY.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-tailwind-merge-BKkUfl9q.js","assets/vendor-fuse.js-t_7AcMTv.js","assets/index-tmO0fZa4.css","assets/runtimeSurface-DiP2a57a.js","assets/nativeFileSave-DpBH1Sa3.js","assets/useSwitcherItems-BSqDA1IF.js","assets/SessionUnreadDot-CY9-1iV2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as m}from"./vendor-vite-runtime-DD1OZmLC.js";import{j as e}from"./vendor-boot-3SaHYVb1.js";import{a as c,R as d}from"./vendor-react-Bz1tRBxM.js";import{a$ as l,b0 as x,b1 as f}from"./useAppFontEffects-Oyin3dgQ.js";import{h as n,f as u}from"./index-Cs2nBW_t.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-zustand-CXhN0IMY.js";import"./runtimeSurface-DiP2a57a.js";import"./nativeFileSave-DpBH1Sa3.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";const w=d.lazy(()=>m(()=>import("./SessionSwitcherContent-B5DaBWZU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])));function R({children:p,variant:t="default",scopeProjectId:a=null,align:i="start"}){const r=n(o=>o.isSessionDropdownOpen),s=n(o=>o.setSessionDropdownOpen);return e.jsxs(l,{open:r,onOpenChange:s,modal:!1,children:[e.jsx(x,{asChild:!0,children:p}),e.jsx(f,{align:i,sideOffset:6,className:u("overflow-hidden p-1 max-w-[calc(100vw-32px)]",t==="compact"?"w-[280px]":"w-[360px]"),children:r?e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:"Loading…"}),children:e.jsx(w,{onSelect:()=>s(!1),variant:t,scopeProjectId:a})}):null})]})}export{R as SessionSwitcherDropdown};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bW as b,cL as D,cM as y,cN as p}from"./useAppFontEffects-Oyin3dgQ.js";import{j as d}from"./vendor-boot-3SaHYVb1.js";import"./vendor-react-Bz1tRBxM.js";import{f as h}from"./index-Cs2nBW_t.js";const F=(e,t,o)=>{const r=`${o}:`,a=new Set([...t].filter(s=>s.startsWith(r)));return e.size===a.size&&[...a].every(s=>e.has(s))?e:a},I=(e,t)=>{const o=new Set(e);return o.has(t)?o.delete(t):o.add(t),o},w=e=>{const t=new Date(e),o=new Date,r=(i,n)=>i.getFullYear()===n.getFullYear()&&i.getMonth()===n.getMonth()&&i.getDate()===n.getDate(),a=new Date(o);return a.setDate(o.getDate()-1),r(t,o)?"Today":r(t,a)?"Yesterday":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}).replace(",","")},j=e=>{const t=new Date,o=new Date(e);if(((a,s)=>a.getFullYear()===s.getFullYear()&&a.getMonth()===s.getMonth()&&a.getDate()===s.getDate())(o,t)){const a=Date.now()-e;return a<6e4?"Just now":a<36e5?`${Math.floor(a/6e4)}min ago`:`${Math.floor(a/36e5)}h ago`}return w(e)},z=e=>{const t=Math.max(0,Date.now()-e),o=6e4,r=60*o,a=24*r,s=7*a,i=30*a,n=365*a;return t<r?`${Math.max(1,Math.floor(t/o))}m`:t<a?`${Math.floor(t/r)}h`:t<s?`${Math.floor(t/a)}d ago`:t<5*s?`${Math.floor(t/s)}w ago`:t<n?`${Math.floor(t/i)}mo`:`${Math.floor(t/n)}y ago`},m=e=>e.toLowerCase().replace(/[-_]/g,"").trim(),E=(e,t)=>e?m(e)!==m(t):!1,k=e=>{const t=new Map;return e.forEach(o=>{t.set(o.id,o)}),Array.from(t.values())},P=(e,t)=>b({label:e.label,path:e.normalizedPath},t),Y="calc(1.25rem * var(--padding-scale, 1))",g="size-4 shrink-0",M="min-w-0 truncate typography-ui-label font-normal",S=g,x=M,$="group relative my-0.5 flex w-full cursor-pointer items-center gap-1.5 rounded-xl px-3 py-2 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",_=$,T=e=>e?S:g,U=e=>e?x:M,f=1e3,l=60*f,c=60*l,C=e=>{const t=Math.max(0,e);return t<l?`${Math.floor(t/f)}s`:t<c?`${Math.floor(t/l)}m ${Math.floor(t%l/f)}s`:`${Math.floor(t/c)}h ${Math.floor(t%c/l)}m`},v=1e3,B=({sessionId:e,running:t,className:o})=>{const r=D(e),a=y(e),s=p(t,v),i=t?Math.max(0,s-(r??s)):a;if(i===void 0)return null;const n=C(i),u=t?`Active for ${n}`:`Last turn took ${n}`;return d.jsx("span",{className:h("shrink-0 tabular-nums",t?"text-primary":"text-[var(--status-info)]",o),"aria-label":u,title:u,children:n})};function K({label:e,className:t}){return d.jsx("span",{className:h("size-1.5 shrink-0 rounded-full bg-foreground",t),"aria-label":e,title:e})}export{K as S,B as a,j as b,M as c,k as d,T as e,z as f,U as g,_ as h,$ as i,E as j,Y as k,P as l,F as m,g as s,I as t};
|