@pi-chamber/web 1.0.6-rc.4 → 1.0.6-rc.6

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.
Files changed (121) hide show
  1. package/dist/assets/{DiagramView-BZ--w7Lh.js → DiagramView-BxBfOrN5.js} +1 -1
  2. package/dist/assets/{DiffView-Dtn6otnT.js → DiffView-CSC9GMrb.js} +3 -3
  3. package/dist/assets/{FileSaveConflictDialog-p1ik30al.js → FileSaveConflictDialog-C_MNWp6w.js} +1 -1
  4. package/dist/assets/{FilesView-D0Z0VmQm.js → FilesView-DeN6KmNt.js} +4 -4
  5. package/dist/assets/{GitHubDetailScaffold-a27RksFo.js → GitHubDetailScaffold-CrtJwlqV.js} +2 -2
  6. package/dist/assets/{GitHubLinkPicker-B0CfzNfk.js → GitHubLinkPicker-g6w8K95J.js} +1 -1
  7. package/dist/assets/GitHubListPrimitives-lAi2ywE3.js +1 -0
  8. package/dist/assets/{GitView-BNkoaVYl.js → GitView-D9_em8Vx.js} +5 -5
  9. package/dist/assets/IssuesSurface-DCiHe6TE.js +7 -0
  10. package/dist/assets/{JsonTreeView-CEiJsFnP.js → JsonTreeView-D64mTfTx.js} +1 -1
  11. package/dist/assets/{MarkdownRendererImpl-418ChlsN.js → MarkdownRendererImpl-DwE90rTA.js} +3 -3
  12. package/dist/assets/PatchDiff-CcIwURzW.js +1 -0
  13. package/dist/assets/{PierreDiffViewer-CkuyY9ne.js → PierreDiffViewer-tN7awL0-.js} +2 -2
  14. package/dist/assets/PullRequestsSurface-iX4r3QlS.js +2 -0
  15. package/dist/assets/{SessionSwitcherContent-DkfjRgwv.js → SessionSwitcherContent-DrrM0ObM.js} +1 -1
  16. package/dist/assets/{SessionSwitcherDropdown-CEw8BEs6.js → SessionSwitcherDropdown-B9_0JwY7.js} +2 -2
  17. package/dist/assets/SessionUnreadDot-Bpgp2gLO.js +1 -0
  18. package/dist/assets/SettingsView-C4hec1iy.js +6 -0
  19. package/dist/assets/{SettingsWindow-D03Z9QyW.js → SettingsWindow-Bepcpy0R.js} +1 -1
  20. package/dist/assets/{StickyHorizontalScrollbar-CONTbZgX.js → StickyHorizontalScrollbar-DNsbTLS7.js} +1 -1
  21. package/dist/assets/{ToolOutputDialog-DibddNlz.js → ToolOutputDialog-Dl9-vpvL.js} +5 -5
  22. package/dist/assets/{ToolPartDiffPreview-Bx7T1M2f.js → ToolPartDiffPreview-CLlHEPYD.js} +1 -1
  23. package/dist/assets/{VirtualizedFileDiff-BY-mDMT8.js → VirtualizedFileDiff-D9OpUpR3.js} +4 -4
  24. package/dist/assets/{Virtualizer-cIf8dSOQ.js → Virtualizer-okhy9Aq3.js} +1 -1
  25. package/dist/assets/{collapsible-BhQdnj8G.js → collapsible-ZT74WYMA.js} +1 -1
  26. package/dist/assets/{computeVirtualFileMetrics-CzkFqhaU.js → computeVirtualFileMetrics-CDv_UBXL.js} +1 -1
  27. package/dist/assets/{contextFileOpenGuard-CjCOK8EB.js → contextFileOpenGuard-BJ2sAhZG.js} +1 -1
  28. package/dist/assets/{fileTreeStatus-CPTpyKOV.js → fileTreeStatus-B2PDFobt.js} +2 -2
  29. package/dist/assets/{gitStatusPredicates-_GNbGCCb.js → gitStatusPredicates-BDdOjxH_.js} +1 -1
  30. package/dist/assets/{githubLink-CwIFogWd.js → githubLink-wwC2_C_9.js} +2 -2
  31. package/dist/assets/index-BaLCg7tL.css +1 -0
  32. package/dist/assets/{index-DjOKW10B.js → index-MXKT8Ir9.js} +1 -1
  33. package/dist/assets/index-fmzQmSSv.js +11 -0
  34. package/dist/assets/{main-C51a3z3b.js → main-CnW7qm2b.js} +2 -2
  35. package/dist/assets/{main-1wmEZ4Is.js → main-DmHVgAh0.js} +4 -4
  36. package/dist/assets/{markdownCore-Dsr6dY5C.js → markdownCore-DOFhfL5i.js} +2 -2
  37. package/dist/assets/{miniChat-DCxCx1fF.js → miniChat-D_Wl2jlx.js} +2 -2
  38. package/dist/assets/{mobile-D6Ac2Mu3.js → mobile-Cl-KcfGW.js} +2 -2
  39. package/dist/assets/{nativeFileSave-P_Eg5Dgb.js → nativeFileSave-B4Rg6n8u.js} +1 -1
  40. package/dist/assets/{pi-session-focus-preference-DjDyjZ1C.js → pi-session-focus-preference-BqEU9Iq6.js} +3 -3
  41. package/dist/assets/{renderDiffWithHighlighter-CK_inhQE.js → renderDiffWithHighlighter-U7WjeGm9.js} +1 -1
  42. package/dist/assets/{renderElectronMiniChatApp-wBNgFl0U.js → renderElectronMiniChatApp-BJxNc9OP.js} +2 -2
  43. package/dist/assets/{renderFileWithHighlighter-B_PFeRW5.js → renderFileWithHighlighter-DiwpFgMp.js} +1 -1
  44. package/dist/assets/{renderMobileApp-B3mhxGnb.js → renderMobileApp-d5KpyvBc.js} +3 -3
  45. package/dist/assets/runtimeEndpointReset-Cd4yJDsk.js +62 -0
  46. package/dist/assets/{runtimeSurface-C3YPOBlg.js → runtimeSurface-X62LLBLv.js} +1 -1
  47. package/dist/assets/{useAppFontEffects-CoFst31H.js → useAppFontEffects-FKnY7Fe2.js} +92 -92
  48. package/dist/assets/useGitHubRemoteSearch-4QMXIODG.js +1 -0
  49. package/dist/assets/{useSwitcherItems-DHCCg4GF.js → useSwitcherItems-DtCNsq8u.js} +1 -1
  50. package/dist/assets/{vendor-aparajita-capacitor-secure-storage-B9_YeZyx.js → vendor-aparajita-capacitor-secure-storage-DVZvgYu4.js} +1 -1
  51. package/dist/assets/{vendor-base-ui-CKSCJw-4.js → vendor-base-ui-BCqPBzDj.js} +1 -1
  52. package/dist/assets/{vendor-boot-Ciu-Edvy.js → vendor-boot-3SaHYVb1.js} +1 -1
  53. package/dist/assets/{vendor-capacitor-app-Bpy_aPMq.js → vendor-capacitor-app-NbQ-WiPS.js} +1 -1
  54. package/dist/assets/{vendor-capacitor-keyboard-DO8AIjrZ.js → vendor-capacitor-keyboard-CgrHt8iN.js} +1 -1
  55. package/dist/assets/{vendor-capacitor-status-bar-SQkytwUW.js → vendor-capacitor-status-bar-CWt0OF5t.js} +1 -1
  56. package/dist/assets/{vendor-codemirror-autocomplete-CInQsE8a.js → vendor-codemirror-autocomplete-WThuuUAz.js} +1 -1
  57. package/dist/assets/{vendor-codemirror-lang-angular-QbsN3LGE.js → vendor-codemirror-lang-angular-BbLGCxF6.js} +1 -1
  58. package/dist/assets/{vendor-codemirror-lang-cpp-BT5U7lxV.js → vendor-codemirror-lang-cpp-Cceks-9O.js} +1 -1
  59. package/dist/assets/{vendor-codemirror-lang-css-dF-Dxbty.js → vendor-codemirror-lang-css-D1wpUg3Z.js} +1 -1
  60. package/dist/assets/{vendor-codemirror-lang-go-e4dp1bar.js → vendor-codemirror-lang-go-Cv0zXHHM.js} +1 -1
  61. package/dist/assets/{vendor-codemirror-lang-html-DKcbBVQ4.js → vendor-codemirror-lang-html-DbL8oT9H.js} +1 -1
  62. package/dist/assets/{vendor-codemirror-lang-java-CB2-FWv6.js → vendor-codemirror-lang-java-CNugenuC.js} +1 -1
  63. package/dist/assets/{vendor-codemirror-lang-javascript-B1zJk7xE.js → vendor-codemirror-lang-javascript-Bx_FIyZF.js} +1 -1
  64. package/dist/assets/{vendor-codemirror-lang-jinja-BsERjdSd.js → vendor-codemirror-lang-jinja-DDGjB3Zq.js} +1 -1
  65. package/dist/assets/{vendor-codemirror-lang-json-C0pZ0NhY.js → vendor-codemirror-lang-json-DIvqf9Pb.js} +1 -1
  66. package/dist/assets/{vendor-codemirror-lang-less-_N9HmR4h.js → vendor-codemirror-lang-less-D8r9dGG1.js} +1 -1
  67. package/dist/assets/{vendor-codemirror-lang-liquid-D02xJRCD.js → vendor-codemirror-lang-liquid-B24mguYi.js} +1 -1
  68. package/dist/assets/{vendor-codemirror-lang-markdown-_6ojeUuZ.js → vendor-codemirror-lang-markdown-v3yG2sbf.js} +1 -1
  69. package/dist/assets/{vendor-codemirror-lang-php-DguCnbJA.js → vendor-codemirror-lang-php-BcZGalqy.js} +1 -1
  70. package/dist/assets/{vendor-codemirror-lang-python-Byr5gw5f.js → vendor-codemirror-lang-python-b-JqEwQy.js} +1 -1
  71. package/dist/assets/{vendor-codemirror-lang-rust-DN6Wh0eK.js → vendor-codemirror-lang-rust-B1uZxDW-.js} +1 -1
  72. package/dist/assets/{vendor-codemirror-lang-sass-DOlEW7q1.js → vendor-codemirror-lang-sass-DqPrngKp.js} +1 -1
  73. package/dist/assets/{vendor-codemirror-lang-sql-BJzE9Dby.js → vendor-codemirror-lang-sql-UyCnpt-k.js} +1 -1
  74. package/dist/assets/{vendor-codemirror-lang-vue-DR8E-2nr.js → vendor-codemirror-lang-vue-xDwYkovV.js} +1 -1
  75. package/dist/assets/{vendor-codemirror-lang-wast-n6lcDH5S.js → vendor-codemirror-lang-wast-CF3169p_.js} +1 -1
  76. package/dist/assets/{vendor-codemirror-lang-xml-Cf2lmlmY.js → vendor-codemirror-lang-xml-FCtVhuOb.js} +1 -1
  77. package/dist/assets/{vendor-codemirror-lang-yaml-DSR_E0yh.js → vendor-codemirror-lang-yaml-g0sPmAnv.js} +1 -1
  78. package/dist/assets/{vendor-codemirror-language-data-CSid5JuX.js → vendor-codemirror-language-data-B03xgzP2.js} +2 -2
  79. package/dist/assets/{vendor-codemirror-search-8lY3lt6q.js → vendor-codemirror-search-Dw3Wpu15.js} +1 -1
  80. package/dist/assets/{vendor-lezer-cpp-DZYTDKiD.js → vendor-lezer-cpp-Cu3E-KUI.js} +1 -1
  81. package/dist/assets/{vendor-lezer-css-6qV4fYNQ.js → vendor-lezer-css-Cb8vp67u.js} +1 -1
  82. package/dist/assets/{vendor-lezer-go-BDi_Iblq.js → vendor-lezer-go-BTsIaOm7.js} +1 -1
  83. package/dist/assets/{vendor-lezer-html-BjqcY-oJ.js → vendor-lezer-html-UQMsUwj-.js} +1 -1
  84. package/dist/assets/{vendor-lezer-java-J2BXqz1h.js → vendor-lezer-java-BIWrFrAx.js} +1 -1
  85. package/dist/assets/{vendor-lezer-javascript-CiQ9F8yX.js → vendor-lezer-javascript-BH2Etgoy.js} +1 -1
  86. package/dist/assets/{vendor-lezer-json-BxN83KKR.js → vendor-lezer-json-CE-QUCwM.js} +1 -1
  87. package/dist/assets/{vendor-lezer-lr-BVsDua_K.js → vendor-lezer-lr-HY6Yc0Vr.js} +1 -1
  88. package/dist/assets/{vendor-lezer-markdown-BkMtRQ3X.js → vendor-lezer-markdown-xFL3Evwf.js} +1 -1
  89. package/dist/assets/{vendor-lezer-php-B3XqnXdP.js → vendor-lezer-php-Cr_mQGrG.js} +1 -1
  90. package/dist/assets/{vendor-lezer-python-D342CidI.js → vendor-lezer-python-BNRFWCb0.js} +1 -1
  91. package/dist/assets/{vendor-lezer-rust-Dbfg_4LA.js → vendor-lezer-rust-BvfOK5cU.js} +1 -1
  92. package/dist/assets/{vendor-lezer-sass-ClxPaFt1.js → vendor-lezer-sass-qoxiLisk.js} +1 -1
  93. package/dist/assets/{vendor-lezer-xml-I_S6FQ1u.js → vendor-lezer-xml--x8SSpqU.js} +1 -1
  94. package/dist/assets/{vendor-lezer-yaml-COA6HWLP.js → vendor-lezer-yaml-BDo1JaEr.js} +1 -1
  95. package/dist/assets/{vendor-replit-codemirror-vim-7IE2zVmx.js → vendor-replit-codemirror-vim-D1Fe7FiY.js} +1 -1
  96. package/dist/assets/{web-components-CzkvK_V5.js → web-components-D5QImbWv.js} +4 -4
  97. package/dist/index.html +4 -4
  98. package/dist/mini-chat.html +3 -3
  99. package/dist/mobile.html +3 -3
  100. package/package.json +1 -1
  101. package/server/lib/pi/archive-store.js +38 -10
  102. package/server/lib/pi/archive-store.test.js +10 -0
  103. package/server/lib/pi/routes.js +65 -18
  104. package/server/lib/pi/routes.test.js +189 -8
  105. package/server/lib/pi/session-daemon/DOCUMENTATION.md +5 -1
  106. package/server/lib/pi/session-daemon/session-daemon-engines.test.js +18 -0
  107. package/server/lib/pi/session-daemon/session-daemon.js +24 -1
  108. package/server/lib/pi/session-shelf-store.js +155 -84
  109. package/server/lib/pi/session-shelf-store.test.js +134 -33
  110. package/server/lib/pi/ui-settings-store.js +59 -0
  111. package/server/lib/pi/ui-settings-store.test.js +105 -6
  112. package/dist/assets/GitHubListPrimitives-LFdR70l6.js +0 -1
  113. package/dist/assets/IssuesSurface-D4kD7_VW.js +0 -7
  114. package/dist/assets/PatchDiff-BtOv_oLB.js +0 -1
  115. package/dist/assets/PullRequestsSurface-PML07zr-.js +0 -2
  116. package/dist/assets/SessionUnreadDot-DXUn8-ss.js +0 -1
  117. package/dist/assets/SettingsView-BvUeFUqw.js +0 -6
  118. package/dist/assets/index-Cfrwo5uQ.js +0 -11
  119. package/dist/assets/index-D7k62S9M.css +0 -1
  120. package/dist/assets/runtimeEndpointReset-D8lAOCUB.js +0 -62
  121. package/dist/assets/useGitHubRemoteSearch-C0-6hhMJ.js +0 -1
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/useAppFontEffects-CoFst31H.js","assets/index-Cfrwo5uQ.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-D7k62S9M.css","assets/vendor-boot-Ciu-Edvy.js","assets/runtimeSurface-C3YPOBlg.js","assets/nativeFileSave-P_Eg5Dgb.js"])))=>i.map(i=>d[i]);
2
- import{_ as Ne}from"./vendor-vite-runtime-DD1OZmLC.js";import{j as e,bX as Ye,bY as Xe,bZ as Qe,b_ as Ze,b$ as et}from"./vendor-boot-Ciu-Edvy.js";import{R as o}from"./vendor-react-Bz1tRBxM.js";import{u as le,a as Le,b as ht,c as ft,G as xt,d as pt,e as gt,f as bt,r as vt,g as tt,t as yt,h as ce,i as jt,j as wt,k as kt,l as Ct,m as Nt,n as St,o as Rt}from"./useGitHubRemoteSearch-C0-6hhMJ.js";import{z as Ee,t as H,b$ as Lt,B as P,I as z,at as Et,b2 as st,a$ as Me,b0 as ze,b1 as Ae,dT as Ft,dU as Pt,o as Se,bu as we,bM as Tt,y as Mt}from"./useAppFontEffects-CoFst31H.js";import{aR as O,L as zt,aZ as At,aS as $t,a_ as Dt,a$ as Gt,b0 as Ht,b1 as qt,b2 as It,b3 as $e,b4 as Ot,b5 as Bt,b6 as _t,b7 as Ut,b8 as Vt,b9 as Kt,ba as Jt,bb as Wt}from"./runtimeEndpointReset-D8lAOCUB.js";import{c as Yt,d as Xt,s as Qt,m as Zt,g as nt,e as es,f as ts,h as ge,l as ss,G as ns,i as te,j as as,k as ls,n as os,o as is,b as fe,u as rs,p as cs,q as ds,r as us,t as De,w as ke,x as Ce,y as ms,z as Ge,A as He,B as qe,C as at,D as hs,E as Ie,F as fs,H as xs,I as ps,J as gs,K as bs,P as be,L as he,M as vs,a as ys,N as Oe,O as js,Q as ws}from"./GitHubDetailScaffold-a27RksFo.js";import{f as xe,aP as ks,o as Cs,h as Ns,n as Ss}from"./index-Cfrwo5uQ.js";import{S as ve,G as Rs}from"./GitHubListPrimitives-LFdR70l6.js";import{P as Ls}from"./PierreDiffViewer-CkuyY9ne.js";import{c as Es,p as Fs}from"./vendor-zustand-CXhN0IMY.js";import"./vendor-clsx-B-dksMZM.js";import"./runtimeSurface-C3YPOBlg.js";import"./nativeFileSave-P_Eg5Dgb.js";import"./vendor-tailwind-merge-BKkUfl9q.js";import"./vendor-fuse.js-t_7AcMTv.js";import"./SessionUnreadDot-DXUn8-ss.js";/* empty css */import"./permissionStore-zIpxq9Pq.js";import"./vendor-dompurify-BGCr_sdL.js";import"./web-components-CzkvK_V5.js";import"./computeVirtualFileMetrics-CzkFqhaU.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-BY-mDMT8.js";import"./renderDiffWithHighlighter-CK_inhQE.js";import"./vendor-diff-C3JhlQdm.js";import"./StickyHorizontalScrollbar-CONTbZgX.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 H.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=Yt({kind:l.kind,repo:l.repo,number:l.number,detail:l.detail}),x=Xt({kind:l.kind,repo:l.repo,number:l.number,contextText:c.text}),p=Lt.getState();p.setPendingInputText(r,"append");const k=p.pendingSyntheticParts??[];return p.setPendingSyntheticParts([...k,{text:x,synthetic:!0}]),H.success("Added to composer"),!0}catch(c){return H.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"}},lt=t=>{switch((t??"").toLowerCase()){case"added":return"added";case"removed":return"removed";case"modified":return"modified";case"renamed":return"renamed";default:return"other"}},ot=t=>Pe[t].icon,Ms=t=>Pe[t].letter,Re=t=>Pe[t].tint,it=t=>{const s=t.lastIndexOf("/");return s<0?{dir:"",base:t}:{dir:t.slice(0,s),base:t.slice(s+1)}},rt=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},ct=t=>rt(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},As=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}},$s=t=>{const s={};return t.forEach((n,a)=>{s[n.filename]=a>=Ts||ct(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(z,{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(z,{name:"delete-bin",className:"size-3.5"})})]}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap break-words",children:t.body})]}),Be=({thread:t,replyAllowed:s,replyDisabledReason:n,resolveAllowed:a,resolveDisabledReason:l,busy:d,onReply:c,onToggleResolved:r})=>{const[x,p]=o.useState(!t.resolved),[k,m]=o.useState(!1),[b,h]=o.useState(""),[A,F]=o.useState(!1),T=t.comments.length,j=async()=>{const g=b.trim();if(!(g.length===0||A||d)){F(!0);try{await c(g)&&(h(""),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:g=>g.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(z,{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":x,onClick:()=>p(g=>!g),children:[t.resolved?"Resolved":"Open"," · ",T," ",T===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"})]}),x?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 flex flex-col gap-2",children:t.comments.map((g,i)=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"typography-micro text-muted-foreground",children:g.author?.login??"ghost"}),e.jsx(ns,{markdown:g.body,html:g.bodyHtml??null,fallbackUrl:g.url})]},g.id??`${t.id}-${i}`))}),s?k?e.jsxs("div",{className:"mt-2",children:[e.jsx("textarea",{autoFocus:!0,value:b,rows:2,placeholder:"Reply","aria-label":"Reply to this conversation",disabled:A||d,onChange:g=>h(g.target.value),onKeyDown:g=>{g.nativeEvent.isComposing||(g.key==="Escape"&&(g.preventDefault(),m(!1)),g.key==="Enter"&&(g.metaKey||g.ctrlKey)&&!g.shiftKey&&!g.altKey&&!g.repeat&&(g.preventDefault(),g.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:A||d||b.trim().length===0,onClick:()=>{j()},children:A?"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(""),x=o.useRef(null),p=c.trim();o.useLayoutEffect(()=>{const m=window.requestAnimationFrame(()=>{x.current?.focus({preventScroll:!0})});return()=>window.cancelAnimationFrame(m)},[]);const k=()=>{p&&l(p)};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:x,value:c,rows:3,placeholder:"Add a comment…","aria-label":`Comment on ${t} line ${s}`,onChange:m=>r(m.target.value),onFocus:m=>{const b=m.currentTarget.value.length;m.currentTarget.setSelectionRange(b,b)},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:!p||n,title:"Send this line to the agent",onClick:()=>d(p),children:n?"Sending…":"Send to agent"}),e.jsx(P,{type:"button",variant:"default",size:"xs",disabled:!p,onClick:k,children:"Add to review"})]})]})},qs=({file:t,collapsed:s,onToggleCollapse:n,viewed:a,onToggleViewed:l,blobUrl:d,threads:c,directory:r,repo:x,number:p,github:k,access:m,onThreadsChanged:b})=>{const h=O(w=>w.threadAction),A=le(w=>w.removeComment),F=le(w=>w.addComment),T=Le(x,p),[j,g]=o.useState(null),[i,C]=o.useState(!1),{send:L,sendingKey:f}=Fe(),{original:N,modified:E}=o.useMemo(()=>Qt(t.patch),[t.patch]),M=o.useMemo(()=>Zt(t.patch),[t.patch]),B=`pr-${p}-file-${t.filename}`,V=nt(m),S=es(m),D=ts(m),K=o.useCallback(w=>{if(!w||!V.allowed)return;const q=(w.endSide??w.side??"additions")==="deletions"?"deletions":"additions",ie=q==="deletions"?M.syntheticToOld.get(w.end):M.syntheticToNew.get(w.end);if(ie==null){H.error("That line is outside the rendered hunks");return}g({synthLine:w.end,side:q,realLine:ie,realSide:q==="deletions"?"LEFT":"RIGHT"})},[V.allowed,M]),_=lt(t.status),{dir:Q,base:R}=it(t.filename),I=ct(t),[y,de]=o.useState(!1),X=I&&!y&&!a&&t.patch!=null,ee=c.filter(w=>!w.resolved).length,Z=o.useMemo(()=>T.filter(w=>w.path===t.filename),[T,t.filename]),{annotations:se,orphans:ne}=o.useMemo(()=>{const w=new Map,G=[],q=($,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){G.push($);continue}let W,J;if($.diffSide==="LEFT"?(J="deletions",W=M.oldToSynthetic.get(U)):$.diffSide==="RIGHT"?(J="additions",W=M.newToSynthetic.get(U)):(W=M.newToSynthetic.get(U),J="additions",W==null&&(W=M.oldToSynthetic.get(U),J="deletions")),W==null){G.push($);continue}q(J,W).threads.push($)}for(const $ of Z){if($.line==null)continue;const U=$.side==="LEFT"?"deletions":"additions",W=U==="deletions"?M.oldToSynthetic.get($.line):M.newToSynthetic.get($.line);W!=null&&q(U,W).pendings.push($)}return j&&q(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:G}},[c,Z,j,M]),oe=o.useCallback(async(w,G)=>{const q=w.comments[w.comments.length-1]?.id??null;if(typeof q!="number")return H.error("Cannot reply to this thread yet"),!1;if(i)return!1;C(!0);try{return(await h(r,x,p,w.id,{action:"reply",body:G,commentId:q},k)).ok?(H.success("Reply posted"),b(),!0):(H.error("Failed to post reply"),!1)}finally{C(!1)}},[r,x,p,k,h,i,b]),ae=o.useCallback(w=>{i||(C(!0),h(r,x,p,w.id,w.resolved?{action:"unresolve"}:{action:"resolve"},k).then(G=>{G.ok?(H.success(w.resolved?"Thread reopened":"Thread resolved"),b()):H.error("Failed to update thread")}).finally(()=>C(!1)))},[r,x,p,k,h,i,b]),ue=o.useCallback(w=>e.jsxs("div",{className:"flex flex-col gap-1.5 px-3 py-2",contentEditable:!1,onPointerDown:G=>G.stopPropagation(),children:[w.metadata.threads.map(G=>e.jsx(Be,{thread:G,replyAllowed:S.allowed,replyDisabledReason:S.reason,resolveAllowed:D.allowed,resolveDisabledReason:D.reason,busy:i,onReply:q=>oe(G,q),onToggleResolved:()=>ae(G)},G.id)),w.metadata.pendings.map(G=>e.jsx(Gs,{comment:G,onRemove:()=>A(x,p,G.id)},G.id)),w.metadata.draft?e.jsx(Hs,{path:t.filename,line:w.metadata.draft.realLine,sendingToAgent:f===`${B}-draft-agent`,onCancel:()=>g(null),onAddToReview:G=>{const q=w.metadata.draft;q&&(F(x,p,{path:t.filename,body:G,line:q.realLine,side:q.realSide}),g(null),H.success("Added to review"))},onSendToAgent:G=>{const q=w.metadata.draft;q&&L({key:`${B}-draft-agent`,kind:"lines",directory:r,repo:x,number:p,contextType:"pr",contextOptions:{includeDiff:!0},detail:`${t.filename} line ${q.realLine} ("${G.trim()}")`})}}):null]}),[S.allowed,S.reason,D.allowed,D.reason,i,oe,ae,A,F,x,p,t.filename,B,f,r,L]);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(z,{name:s?"arrow-right-s":"arrow-down-s",className:"size-4"})}),e.jsx(z,{name:ot(_),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(z,{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(Et,{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:()=>{L({key:`${B}-agent`,kind:"file",directory:r,repo:x,number:p,contextType:"pr",contextOptions:{includeDiff:!0},detail:t.filename})},disabled:f===`${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(Be,{thread:w,replyAllowed:S.allowed,replyDisabledReason:S.reason,resolveAllowed:D.allowed,resolveDisabledReason:D.reason,busy:i,onReply:G=>oe(w,G),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(z,{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 — ",rt(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:ss(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(z,{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=O(i=>i.addComment),x=O(i=>i.performAction),p=le(i=>i.clearCommentDraft),{draft:k,onDraftChange:m,flushDraft:b}=ht(s,n),{busy:h,error:A,submit:F}=ft({postComment:i=>r(t,s,n,i,a),runFollowUp:i=>x(t,s,n,i,a),verbs:{close:"close",reopen:"reopen"},doneLabels:{close:"Closed with comment",reopen:"Reopened with comment"},afterPost:()=>{m(""),p(s,n),c()}}),T=nt(d),j=l.state==="open"?"close":l.state==="closed"?"reopen":null,g=j?te(j,l,d):null;return T.allowed?e.jsx(xt,{draft:k,onDraftChange:m,onDraftBlur:b,ariaLabel:"Leave a comment on this pull request",busy:h,error:A,disabledReason:T.reason,followUp:j?{id:j,label:j==="close"?"Close with comment":"Reopen with comment",busyLabel:j==="close"?"Closing…":"Reopening…",onRun:()=>{F(j,k)},allowed:g?.allowed===!0,reason:g?.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:x})=>{const p=le(h=>h.setSummary),k=le(h=>h.setVerdict),m=n.includes(l)?l:n[0]??"comment",b=ls({verdict:m,summary:a,pendingCount:d});return e.jsxs("div",{children:[e.jsx(zt,{ref:r,rows:3,value:a,placeholder:"Summarize your review (optional)","aria-label":"Review summary",disabled:c,onChange:h=>p(t,s,h.target.value),onKeyDown:h=>{h.nativeEvent.isComposing||h.key==="Enter"&&(h.metaKey||h.ctrlKey)&&!h.shiftKey&&!h.altKey&&!h.repeat&&(h.preventDefault(),h.stopPropagation(),b&&!c&&x())}}),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:h=>k(t,s,h.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(h=>e.jsx("option",{value:h,children:Bs[h]},h))})]}),e.jsx(P,{type:"button",variant:"default",size:"xs",disabled:c||!b,title:b?`Submit review${d>0?` with ${d} ${d===1?"line comment":"line comments"}`:""}`:"Add a summary or a line comment first",onClick:x,children:c?"Submitting…":"Submit review"})]})]})},dt=({directory:t,repo:s,number:n,github:a,access:l,size:d="sm",onReviewSubmitted:c})=>{const r=O(M=>M.submitReview),x=le(M=>M.removeComments),p=le(M=>M.clearSummary),k=le(M=>M.clearComments),m=Le(s,n),b=pt(s,n),h=gt(s,n),[A,F]=o.useState(!1),[T,j]=o.useState(!1),g=o.useRef(null),i=o.useMemo(()=>as(l),[l]),C=i.includes(h)?h:i[0]??"comment",L=m.length,f=L>0||b.trim().length>0;if(o.useEffect(()=>{if(!A)return;const M=window.requestAnimationFrame(()=>g.current?.focus({preventScroll:!0}));return()=>window.cancelAnimationFrame(M)},[A]),i.length===0)return null;const N=async()=>{if(T)return;const M=b,B=[...m];j(!0);try{const V=B.map(D=>({path:D.path,body:D.body,...D.line!=null?{line:D.line}:{},...D.side?{side:D.side}:{}})),S=await r(t,s,n,{event:C,body:M.trim()?M:void 0,comments:V},a);if(!S.ok){H.error(S.error?.kind==="failed"?S.error.message:"Failed to submit review");return}x(s,n,B.map(D=>D.id)),p(s,n,M),H.success(C==="approve"?"Pull request approved":C==="request-changes"?"Changes requested":"Review submitted"),F(!1),c?.()}finally{j(!1)}},E=L>0?`Review · ${L}`:"Review";return e.jsxs(Ye,{open:A,onOpenChange:F,children:[e.jsxs(Xe,{render:e.jsx(P,{type:"button",variant:L>0?"default":"outline",size:d,className:"shrink-0","aria-label":L>0?`Review pull request, ${L} ${L===1?"line comment":"line comments"} pending`:"Review pull request",title:f?"Finish your review":"Approve, request changes, or comment with a review"}),children:[e.jsx(z,{name:"file-check",className:"size-3.5","aria-hidden":"true"}),E]}),e.jsx(Qe,{children:e.jsx(Ze,{className:"z-50",side:"top",align:"end",sideOffset:8,collisionPadding:8,children:e.jsxs(et,{"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:L>0?`Review · ${L} ${L===1?"line comment":"line comments"}`:"Review pull request"}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[L>0?e.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Discard pending line comments",title:"Discard pending line comments",disabled:T,onClick:()=>k(s,n),className:"size-6",children:e.jsx(z,{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(z,{name:"close",className:"size-3.5"})})]})]}),e.jsx(_s,{repo:s,number:n,verdicts:i,summary:b,verdict:C,pendingCount:L,busy:T,textareaRef:g,onSubmit:()=>{N()}})]})})})]})},ye=(t,s)=>`${t}#${s}`,_e=50,Us=Object.freeze([]),Ue=(t,s)=>{const n=Object.keys(t);if(n.length<=_e)return t;const a={};for(const l of n.slice(n.length-_e))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(p=>{const k=p.entries[c]??{viewed:[],headSha:null},m=d?[...k.viewed,l]:k.viewed.filter(b=>b!==l);return{entries:Ue({...p.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:Ue({...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),Ve=20,Js=[],Ws=[],Ke=t=>`pr-file-${encodeURIComponent(t)}`,ut=o.memo(({file:t,viewed:s,threadCount:n,pendingCount:a,showDir:l,onSelectFile:d})=>{const c=lt(t.status),{dir:r,base:x}=it(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(z,{name:ot(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:x})]}),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(z,{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(z,{name:"check",className:"size-3.5 shrink-0 text-[var(--status-success)]","aria-label":"Viewed"}):null]})});ut.displayName="FileJumpRow";const mt=({files:t,viewedPaths:s,threadCounts:n,pendingCounts:a,onSelectFile:l})=>{const[d,c]=o.useState(""),r=o.useMemo(()=>zs(t),[t]),x=o.useMemo(()=>new Set(s),[s]),p=d.trim().toLowerCase(),k=o.useMemo(()=>p?r.map(m=>({...m,files:m.files.filter(b=>b.filename.toLowerCase().includes(p))})).filter(m=>m.files.length>0):r,[r,p]);return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-1",children:[e.jsx(st,{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(b=>e.jsx(ut,{file:b,viewed:x.has(b.filename),threadCount:n.get(b.filename)??0,pendingCount:a.get(b.filename)??0,showDir:r.length<=1,onSelectFile:l},b.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(Ye,{open:s,onOpenChange:n,children:[e.jsxs(Xe,{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(z,{name:"file",className:"size-3.5","aria-hidden":"true"}),"Files"]}),e.jsx(Qe,{children:e.jsx(Ze,{className:"z-50",side:"bottom",align:"start",sideOffset:4,collisionPadding:8,children:e.jsx(et,{"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(mt,{...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(x=>x===r?x: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,x=Vs(n,a),p=Ks(n,a),k=Le(n,a);o.useEffect(()=>{pe.getState().syncHeadSha(n,a,c)},[n,a,c]);const m=o.useMemo(()=>$s(r),[r]),b=o.useRef(m);b.current=m;const h=o.useRef(r);h.current=r;const[A,F]=o.useState({}),[T,j]=o.useState(Ve),g=o.useMemo(()=>As(r),[r]),i=o.useMemo(()=>{const R=new Map;for(const I of t.threads){if(!I.path)continue;const y=R.get(I.path)??[];y.push(I),R.set(I.path,y)}return R},[t.threads]),C=o.useMemo(()=>{const R=new Map;for(const[I,y]of i)R.set(I,y.length);return R},[i]),L=o.useMemo(()=>{const R=new Map;for(const I of k)R.set(I.path,(R.get(I.path)??0)+1);return R},[k]),f=o.useCallback(R=>{F(I=>({...I,[R]:!(I[R]??b.current[R]??!1)}))},[]),N=o.useCallback(()=>{F(Object.fromEntries(h.current.map(R=>[R.filename,!1])))},[]),E=o.useCallback(()=>{F(Object.fromEntries(h.current.map(R=>[R.filename,!0])))},[]),M=o.useCallback((R,I)=>{pe.getState().setViewed(n,a,R,I),F(y=>({...y,[R]:I}))},[n,a]),B=o.useCallback(R=>{F(y=>y[R]??b.current[R]??!1?{...y,[R]:!1}:y);const I=h.current.findIndex(y=>y.filename===R);I>=0&&j(y=>I<y?y:I+1),requestAnimationFrame(()=>{document.getElementById(Ke(R))?.scrollIntoView({block:"start"})})},[]),V=o.useMemo(()=>r.slice(0,T),[r,T]),S=o.useRef(null),D=Qs(S,V.length>0),K=o.useMemo(()=>new Set(x),[x]),_=r.length===1?"1 file":`${r.length} files`,Q=r.length===0?"Nothing viewed yet":`${p}/${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:g.additions,deletions:g.deletions}),e.jsxs("span",{className:"shrink-0 tabular-nums text-muted-foreground","aria-label":Q,children:[p,"/",r.length," viewed"]}),e.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[e.jsx(dt,{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:x,threadCounts:C,pendingCounts:L,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(z,{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(z,{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:D!=null?{height:D}:void 0,className:"sticky top-10 hidden max-h-[calc(100dvh-10rem)] w-60 shrink-0 flex-col @4xl:flex",children:e.jsx(mt,{files:r,viewedPaths:x,threadCounts:C,pendingCounts:L,onSelectFile:B})}),e.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:V.map(R=>e.jsx("div",{id:Ke(R.filename),className:"scroll-mt-12",children:e.jsx(Is,{file:R,collapsed:A[R.filename]??m[R.filename]??!1,onToggleCollapse:f,viewed:K.has(R.filename),onToggleViewed:M,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>T?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>j(T+Ve),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:x})=>{const[p,k]=o.useState({}),[m,b]=o.useState({}),{send:h,sendingKey:A}=Fe(),F=os(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:()=>{h({key:`pr-${n}-failed-checks`,kind:"checks",directory:t,repo:s,number:n,contextType:"checks"})},disabled:A===`pr-${n}-failed-checks`,"aria-label":"Send failed checks to agent",title:"Send failed checks to agent",children:[e.jsx(z,{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(z,{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:p,onToggleJob:T=>k(j=>({...j,[T]:!j[T]})),jobSteps:m,setJobSteps:b,sendingKey:A,send:h,onOpenFilesAtLine:x}):null]})},tn=({checks:t,directory:s,repo:n,number:a,github:l,expandedJobs:d,onToggleJob:c,jobSteps:r,setJobSteps:x,sendingKey:p,send:k,onOpenFilesAtLine:m})=>{const b=O(i=>i.rerunFailedChecks),[h,A]=o.useState({}),F=async i=>{const C=`run-${i.id??i.name}`;if(c(C),!(d[C]||r[C]||i.id==null)){x(L=>({...L,[C]:{steps:[],loading:!0}}));try{const f=(await l.checkJobs(s,n,i.runId??null,i.id)).jobs[0];x(E=>({...E,[C]:{steps:f?.steps??[],loading:!1}}));const N=await l.checkAnnotations(s,n,i.id).catch(()=>null);N&&A(E=>({...E,[i.id]:{loading:!1,items:N.annotations}}))}catch{x(L=>({...L,[C]:{steps:[],loading:!1}}))}}},T=async i=>{(await b(s,n,i,l)).ok?H.success("Re-run requested"):H.error("Re-run failed")},j=i=>{const C=`run-${i.id??i.name}`,L=d[C]??!1,f=r[C],N=is(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":L,"aria-label":`${L?"Collapse":"Expand"} ${i.name}`,children:"Details"}),N&&i.runId!=null?e.jsx(P,{type:"button",variant:"outline",size:"xs",onClick:()=>{T(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:p===`${C}-agent`,"aria-label":`Send ${i.name} to agent`,children:"Send to agent"}):null]}),L?e.jsxs("div",{className:"mt-1.5 flex flex-col gap-1 border-t border-border/60 pt-1.5",children:[f?.loading?e.jsx("span",{className:"typography-micro text-muted-foreground",children:"Loading steps…"}):null,(f?.steps??[]).map((E,M)=>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}-${M}`)),i.id!=null&&h[i.id]?.items?.length?e.jsx("div",{className:"flex flex-col gap-1",children:h[i.id]?.items.map((E,M)=>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]},M))}):null]}):null]},C)},g=(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(g)}):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]})},Je=({pr:t})=>e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(at,{login:t.author?.login,avatarUrl:t.author?.avatarUrl,size:"xs"}),t.author?.login??"ghost"]}),t.updatedAt?` · updated ${bs(t.updatedAt)}`:"",t.draft?" · Draft":""]}),We=({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(z,{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:x,onCopyLink:p,askSending:k,onAskAgent:m})=>{const b=O(N=>N.setMergeMethod),h=s.state==="open",A=be.filter(N=>te(N.id,s,n).allowed),F=A.some(N=>N.id===l)?l:A[0]?.id??l,T=te(F,s,n),j=te("ready",s,n),g=te("draft",s,n),i=te("close",s,n),C=te("reopen",s,n),L=be.find(N=>N.id===F)??be[0],f=A.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:[h&&!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:!T.allowed,disabledReason:T.reason??`Merge via ${L.label}`,label:F==="merge"?"Merge pull request":L.label,icon:e.jsx(z,{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:f,children:e.jsx(z,{name:"arrow-down-s",className:"size-3.5"})})}),e.jsx(Ae,{align:"start",className:"w-72",children:e.jsx(Ft,{value:F,onValueChange:N=>{const E=N;d(E),b(t,E)},children:be.map(N=>{const E=te(N.id,s,n);return e.jsx(Pt,{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,h&&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(z,{name:"git-pull-request",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c("ready")}):null,h&&!s.draft?e.jsx(ce,{copy:he("draft",s.base,s.head),busy:a,variant:"outline",disabled:!g.allowed,disabledReason:g.reason??"Convert to draft",label:"Convert to draft",icon:e.jsx(z,{name:"pencil",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>c("draft")}):null,h?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(z,{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(z,{name:"history",className:"size-3.5","aria-hidden":"true"}),"Reopen"]}),e.jsxs(P,{type:"button",variant:"outline",size:"xs",className:"shrink-0",onClick:()=>x("worktree"),disabled:r,title:"Check out in a new worktree","aria-label":"Check out in a new worktree",children:[e.jsx(z,{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(z,{name:"git-branch",className:"size-3.5","aria-hidden":"true"}),onConfirm:()=>x("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(z,{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(z,{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(z,{name:"more-2",className:"size-4"})})}),e.jsxs(Ae,{align:"end",className:"w-60",children:[e.jsxs(we,{onClick:()=>{Se(s.url)},children:[e.jsx(z,{name:"external-link",className:"size-3.5"}),"Open on GitHub"]}),e.jsxs(we,{onClick:p,children:[e.jsx(z,{name:"file-copy",className:"size-3.5"}),"Copy link"]}),e.jsx(Tt,{}),e.jsxs(we,{onClick:()=>x("worktree"),disabled:r,children:[e.jsx(z,{name:"git-branch",className:"size-3.5"}),"Check out in new worktree"]})]})]})]})},nn=({pr:t,access:s,acting:n,onRun:a})=>{const l=vs(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(z,{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(z,{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(z,{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=O(u=>u.performAction),r=O(u=>u.updateTitleBody),x=O(u=>u.checkout),[p,k]=o.useState("summary"),[m,b]=o.useState(!1),[h,A]=o.useState(()=>At(n)??"merge"),[F,T]=o.useState(!1),[j,g]=o.useState(""),[i,C]=o.useState(!1),[L,f]=o.useState(""),[N,E]=o.useState("newest"),[M,B]=o.useState(1),[V,S]=o.useState(!1),[D,K]=o.useState(null),_=bt(n,a),{send:Q,sendingKey:R}=Fe(),I=rs(s,n),y=d?.pr??null,de=d?.sectionErrors??null,X=o.useMemo(()=>({capabilities:d?.capabilities??null,isAuthor:cs(y?.author?.login,d?.viewerLogin),permissionFallback:d?.viewerPermission?.fallback===!0}),[d?.capabilities,d?.viewerLogin,d?.viewerPermission?.fallback,y?.author?.login]),ee=ds(y,X);o.useEffect(()=>{k("summary"),T(!1),C(!1),B(1),K(null)},[n,a]);const Z=o.useCallback(async u=>{b(!0);try{const Y=await c(s,n,a,u,l);if(!Y.ok){H.error(Y.error?.kind==="failed"?Y.error.message:"Action failed");return}u==="close"?H.success("Pull request closed"):u==="reopen"?H.success("Pull request reopened"):u==="update-branch"?H.success("Branch update requested"):u==="ready"?H.success("Marked as ready for review"):u==="draft"?H.success("Converted to draft"):H.success("Pull request merged")}finally{b(!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()){H.error("Enter a title");return}const u=await r(s,n,a,{title:j.trim()},l);u.ok?(H.success("Title updated"),T(!1)):H.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:L},l);u.ok?(H.success("Description updated"),C(!1)):H.error(u.error?.kind==="failed"?u.error.message:"Failed to update description")},[L,s,n,a,l,r]),ae=Ee().git,ue=o.useCallback(async u=>{if(u==="current"){const Y=await Ne(()=>import("./useAppFontEffects-CoFst31H.js").then(re=>re.es),__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){H.error("Working tree has uncommitted changes. Commit or stash first, or use New worktree.");return}}S(!0);try{const Y=await x(s,n,a,u,l);Y.ok?(await vt(s,ae),K({path:Y.path??null,branch:Y.branch??""}),H.success(u==="worktree"?"Worktree created":"Branch checked out")):H.error(Y.error?.kind==="failed"?Y.error.message:"Checkout failed")}finally{S(!1)}},[s,n,a,l,ae,x]),w=o.useCallback(()=>{D?.path&&Ne(async()=>{const{useSessionUIStore:u}=await import("./useAppFontEffects-CoFst31H.js").then(Y=>Y.ep);return{useSessionUIStore:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(({useSessionUIStore:u})=>{u.getState().openNewSessionDraft({directoryOverride:D.path}),Ns.getState().setActiveMainTab("chat")})},[D]),G=us(y?.url),q=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]),$=q.slice(0,M*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:I,number:a,openLabel:`Open pull request #${a} on GitHub`,title:`Pull request #${a}`}),tabs:[],activeTab:"",onTabChange:()=>{},children:e.jsx(tt,{info:yt(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:I,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(Je,{pr:u}):void 0,branches:u?e.jsx(We,{pr:u,filesCount:u.changedFiles??null}):void 0}),tabs:[],activeTab:"",onTabChange:()=>{},children:e.jsx(ms,{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:I,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:()=>{g(y.title),T(!0)},editTitleLabel:"Edit pull request title",editTitleDisabledReason:ee.allowed?null:ee.reason,meta:e.jsx(Je,{pr:y}),branches:e.jsx(We,{pr:y,filesCount:me})}),e.jsx(sn,{directory:s,repo:n,number:a,github:l,pr:y,access:X,acting:m,mergeMethod:h,onMergeMethodChange:A,onRun:u=>{Z(u)},checkingOut:V,onCheckout:u=>{ue(u)},onCopyLink:G,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:p,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(st,{value:j,onChange:u=>g(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:()=>T(!1),children:"Cancel"})]}):null,D?e.jsxs("p",{className:"flex flex-wrap items-center gap-1.5 typography-micro text-muted-foreground",children:[e.jsx(z,{name:"check",className:"size-3.5 shrink-0 text-[var(--status-success)]"}),e.jsxs("span",{children:["Ready on ",D.branch,D.path?` at ${D.path}`:"","."]}),D.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,p==="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(at,{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(hs,{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:()=>{f(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:L,onChange:u=>f(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(fs,{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${q.length?` (${q.length})`:""}`,action:e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[t.hideFilesTab?e.jsx(dt,{directory:s,repo:n,number:a,github:l,access:X,size:"xs",onReviewSubmitted:t.onRetryDetail}):null,e.jsx(gs,{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(xs,{comment:u},u.id)),e.jsx(ps,{comments:W}),t.commentsLoading&&q.length===0&&!t.commentsError?e.jsx("p",{className:"typography-micro text-muted-foreground",children:"Loading comments…"}):null,q.length===0&&!t.commentsLoading&&!t.commentsError?e.jsx("p",{className:"typography-micro text-muted-foreground",children:"No comments yet."}):null,q.length>$.length?e.jsx("div",{children:e.jsx(P,{type:"button",variant:"outline",size:"sm",onClick:()=>B(M+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,p==="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,p==="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:x,countComplete:p=!0,incompleteNotice:k=null,remote:m=null,numberJump:b=null,onFiltersChange:h,onClearFilters:A,onLoadMore:F,onRetry:T,onOpen:j,headerActionsSlot:g=null,headerActionsPresentation:i="drawer"})=>{const C=r.state==="open"&&r.involvement==="all"&&!r.search.trim(),L=o.useCallback(f=>e.jsx("li",{role:"listitem",children:e.jsx(jt,{glyph:e.jsx(ys,{kind:"pr",state:f.state,draft:f.draft}),glyphBelow:e.jsx(fe,{state:(f.url?x[f.url]:void 0)??null}),number:`#${f.number}`,title:f.title,status:e.jsx(ge,{additions:f.additions,deletions:f.deletions,className:"typography-micro"}),meta:e.jsxs(e.Fragment,{children:[e.jsx(wt,{login:f.author?.login,avatarUrl:f.author?.avatarUrl}),e.jsx(kt,{head:f.head,base:f.base}),f.draft?e.jsx("span",{className:"shrink-0 rounded bg-[var(--surface-muted)] px-1 typography-micro text-muted-foreground",children:"Draft"}):null]}),updatedAt:f.updatedAt,onOpen:()=>j(f.number),ariaLabel:`Open pull request #${f.number} ${f.title}`})},f.number),[x,j]);return e.jsx(Ct,{items:t,renderRow:L,hasMore:s,isLoadingMore:n,isLoading:a,isRefreshing:l,stale:d,error:c,searchValue:r.search,onSearchChange:f=>h({search:f}),searchPlaceholder:"Search pull requests, or label:bug",searchAriaLabel:"Search pull requests",toolbarControls:e.jsx(Nt,{stateValue:r.state,stateOptions:Oe.map(f=>({id:f.id,label:f.label})),onStateChange:f=>h({state:f}),involvementValue:r.involvement,involvementOptions:ws.map(f=>({id:f.id,label:f.label})),onInvolvementChange:f=>h({involvement:f}),sortValue:r.sort,sortOptions:js.map(f=>({id:f.id,label:f.label})),onSortChange:f=>h({sort:f}),sortAriaLabel:"Sort pull requests"}),headerActionsSlot:g,headerActionsPresentation:i,isDefaultFilters:C,stateLabel:Oe.find(f=>f.id===r.state)?.label??r.state,kindSingular:"pull request",kindPlural:"pull requests",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",updatedAtOf:f=>f.updatedAt,countComplete:p,incompleteNotice:k,remote:m,numberJump:b,numberJumpKind:"pull request",onClearFilters:A,onLoadMore:F,onRetry:T,onOpen:j})},on=t=>{const s=$t(n=>n.results);return o.useMemo(()=>{const n=Dt(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=Mt()??"";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),[x,p]=o.useState(!1),k=o.useRef(null);return o.useEffect(()=>Gt(),[]),e.jsx(St,{directory:t,isRefreshing:c,onRefresh:()=>k.current?.(),children:({repo:m,directory:b})=>e.jsx(cn,{directory:b,repo:m,github:d,refreshing:c,setRefreshing:r,loadingMore:x,setLoadingMore:p,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:x,headerActionsSlot:p=null,headerActionsPresentation:k="drawer"})=>{const m=O(v=>v.ensureCollectionsFresh),b=O(v=>v.searchRemote),h=O(v=>v.loadMoreRemote),A=O(v=>v.loadMoreCollection),F=O(v=>v.refreshAllForScope),T=O(v=>v.selectPullRequest),j=O(v=>v.setFilters),g=O(v=>v.resetFilters),i=Ht(t,s),C=qt(t),L=It(),f=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=$e(s,"open"),M=$e(s,"closed"),B=o.useMemo(()=>Ot(s),[s,E?.data,M?.data]),V=o.useMemo(()=>new Set(B.map(v=>v.number)),[B]),S=o.useMemo(()=>Bt(B,{state:i.state,involvement:i.involvement,search:i.search,sort:i.sort,viewerLogin:L}),[B,i.state,i.involvement,i.search,i.sort,L]),D=on(S),K=N==="both"?[E,M]:[N==="open"?E:M],_=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),I=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"&&!L,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?b(t,s,v,n):Promise.resolve(null),[t,s,n,b]),ue=o.useCallback(v=>n?h(t,s,v,n):Promise.resolve(null),[t,s,n,h]),{remoteView:w,numberJump:G,remotePending:q,handleSearchAll:ie}=Rt({repo:s,query:se,queryKey:ne,autoRemote:oe,indexNumbers:V,visibleItems:S,searchText:X,useRemoteEntry:Wt,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=>A(t,s,u,n))).then(()=>c(!1)).catch(()=>c(!1))},[t,s,N,n,A,c]),J=o.useCallback(v=>{T(t,s,v)},[t,s,T]),me=o.useCallback(()=>{T(t,null,null)},[t,T]);return n?f!=null?e.jsx(dn,{directory:t,repo:s,number:f,github:n,onBack:me,hideFilesTab:x,seed:_t(s,f)}):e.jsx(ln,{items:S,headerActionsSlot:p,headerActionsPresentation:k,hasMore:K.some(v=>v?.data?.nextCursor!=null),isLoadingMore:d,isLoading:y,isRefreshing:a&&_,stale:de,error:I,filters:i,checksByUrl:D,countComplete:Q,incompleteNotice:$?{summary:$,searching:q,onSearchAll:ie}:null,remote:w,numberJump:G,onFiltersChange:v=>j(t,s,v),onClearFilters:()=>g(t,s),onLoadMore:W,onRetry:U,onOpen:J}):e.jsx(tt,{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=O(S=>S.ensureDetail),x=O(S=>S.ensureComments),p=O(S=>S.ensureFiles),k=O(S=>S.ensureChecks),m=O(S=>S.loadMoreFiles),b=O(S=>S.loadMoreComments),h=O(S=>S.refreshComments),A=O(S=>S.refreshDetail),F=O(S=>S.refreshChecks);o.useEffect(()=>{r(t,s,n,a).catch(()=>{}),x(t,s,n,a).catch(()=>{}),d||p(t,s,n,a).catch(()=>{}),k(t,s,n,a).catch(()=>{})},[t,s,n,d]);const T=Ut(s,n),j=Vt(s,n),g=Kt(s,n),i=Jt(s,n),C=T?.data?.detail??null,L=o.useCallback((S,D)=>{const K=Ss(t);Ne(async()=>{const{useUIStore:_}=await import("./index-Cfrwo5uQ.js").then(Q=>Q.cX);return{useUIStore:_}},__vite__mapDeps([1,2,3,4,5,6,7,8])).then(({useUIStore:_})=>{_.getState().openContextFileAtLine(K,S,D)}).catch(()=>{})},[t]),f=o.useCallback(()=>{m(t,s,n,a).catch(()=>{})},[t,s,n,a,m]),N=o.useCallback(()=>{b(t,s,n,a).catch(()=>{})},[t,s,n,a,b]),E=o.useCallback(()=>{h(t,s,n,a).catch(()=>{})},[t,s,n,a,h]),M=o.useCallback(()=>{A(t,s,n,a).catch(()=>{})},[t,s,n,a,A]),B=o.useCallback(()=>{p(t,s,n,a).catch(()=>{})},[t,s,n,a,p]),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:T?.error??null,detailStale:T?.stale??!1,files:g?.data??null,filesError:g?.error??null,filesLoading:g?.isLoading??!1,filesHasMore:g?.data?.nextCursor!=null,onLoadMoreFiles:f,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:M,onRetryFiles:B,onRetryChecks:V,onOpenFilesAtLine:L})};export{da as PullRequestsSurface};
@@ -1 +0,0 @@
1
- import{bP as M,cE as b,cF as p,cG as w}from"./useAppFontEffects-CoFst31H.js";import{q as m,f as h}from"./index-Cfrwo5uQ.js";import{j as g}from"./vendor-boot-Ciu-Edvy.js";import"./vendor-react-Bz1tRBxM.js";const k=(e,t,a)=>{const r=`${a}:`,s=new Set([...t].filter(o=>o.startsWith(r)));return e.size===s.size&&[...s].every(o=>e.has(o))?e:s},z=(e,t)=>{const a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a},S=e=>{const t=new Date(e),a=new Date,r=(n,i)=>n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate(),s=new Date(a);return s.setDate(a.getDate()-1),r(t,a)?"Today":r(t,s)?"Yesterday":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}).replace(",","")},E=e=>{const t=new Date,a=new Date(e);if(((s,o)=>s.getFullYear()===o.getFullYear()&&s.getMonth()===o.getMonth()&&s.getDate()===o.getDate())(a,t)){const s=Date.now()-e;return s<6e4?"Just now":s<36e5?`${Math.floor(s/6e4)}min ago`:`${Math.floor(s/36e5)}h ago`}return S(e)},I=e=>{const t=Math.max(0,Date.now()-e),a=6e4,r=60*a,s=24*r,o=7*s,n=30*s,i=365*s;return t<r?`${Math.max(1,Math.floor(t/a))}m`:t<s?`${Math.floor(t/r)}h`:t<o?`${Math.floor(t/s)}d ago`:t<5*o?`${Math.floor(t/o)}w ago`:t<i?`${Math.floor(t/n)}mo`:`${Math.floor(t/i)}y ago`},d=e=>e.toLowerCase().replace(/[-_]/g,"").trim(),P=(e,t)=>e?d(e)!==d(t):!1,R=e=>{const t=new Map;return e.forEach(a=>{t.set(a.id,a)}),Array.from(t.values())},j=e=>`__archived__:${e}`,Y=(e,t)=>{const a=m(e.directory??null),r=m(e.project?.worktree??null),s=a??r;if(!s)return"unassigned";if(t&&s===t)return"project root";const n=(t&&s.startsWith(`${t}/`)?s.slice(t.length+1):s).split("/").filter(Boolean);return n[n.length-1]??"unassigned"},B=(e,t)=>M({label:e.label,path:e.normalizedPath},t),K="calc(1.25rem * var(--padding-scale, 1))",y="size-4 shrink-0",D="min-w-0 truncate typography-ui-label font-normal",x=y,v=D,$="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=$,U=e=>e?x:y,W=e=>e?v:D,u=1e3,l=60*u,c=60*l,C=e=>{const t=Math.max(0,e);return t<l?`${Math.floor(t/u)}s`:t<c?`${Math.floor(t/l)}m ${Math.floor(t%l/u)}s`:`${Math.floor(t/c)}h ${Math.floor(t%c/l)}m`},L=1e3,O=({sessionId:e,running:t,className:a})=>{const r=b(e),s=p(e),o=w(t,L),n=t?Math.max(0,o-(r??o)):s;if(n===void 0)return null;const i=C(n),f=t?`Active for ${i}`:`Last turn took ${i}`;return g.jsx("span",{className:h("shrink-0 tabular-nums",t?"text-primary":"text-[var(--status-info)]",a),"aria-label":f,title:f,children:i})};function q({label:e,className:t}){return g.jsx("span",{className:h("size-1.5 shrink-0 rounded-full bg-foreground",t),"aria-label":e,title:e})}export{q as S,O as a,E as b,D as c,R as d,U as e,I as f,j as g,W as h,T as i,$ as j,P as k,K as l,B as m,k as n,Y as r,y as s,z as t};