@p4code/cli 0.6.24 → 0.6.26
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/bin.mjs +18 -1
- package/dist/client/assets/DiffPanel-CCBgaF6s.js +98 -0
- package/dist/client/assets/{FilePreviewPanel-C7ngBXF-.js → FilePreviewPanel-DqZyd2jl.js} +14 -14
- package/dist/client/assets/PreviewPanel-RwQk6r6H.js +2 -0
- package/dist/client/assets/PullRequestCodeTab-C9C_XdYT.js +251 -0
- package/dist/client/assets/{fileCommentAnnotations-C2JSM-zL.js → fileCommentAnnotations-CwI-NvB3.js} +2 -2
- package/dist/client/assets/{index-5hUhmVTf.css → index-DhY8VFAz.css} +1 -1
- package/dist/client/assets/{index-fTeMTF9d.js → index-yXckItiP.js} +248 -242
- package/dist/client/assets/previewAssetResource-CGmfO5X4.js +48 -0
- package/dist/client/assets/renderFileChildren-DRF_j-Q5.js +2 -0
- package/dist/client/assets/toggle-group-u4G3TzWK.js +2 -0
- package/dist/client/index.html +3 -3
- package/package.json +1 -1
- package/dist/client/assets/DiffPanel-DKGgJtv3.js +0 -98
- package/dist/client/assets/PreviewPanel-_UKb7Ewm.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-DehcM8Oz.js +0 -251
- package/dist/client/assets/previewAssetResource-oGlljcp1.js +0 -48
- package/dist/client/assets/renderFileChildren-iL3qsont.js +0 -2
- package/dist/client/assets/toggle-group-BHvVXeVb.js +0 -2
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-CLAvuQ-D.js";import{$ as i,$a as a,Ba as o,Cl as s,Dt as c,Ga as l,Kr as u,La as d,Sl as f,Wa as p,Wl as m,_t as h,b as g,bt as _,bu as v,eo as y,ft as b,gt as x,ml as S,pl as C,ru as w,vl as T,wl as E,xl as D,yt as O}from"./previewAssetResource-oGlljcp1.js";import{a as k,c as A,n as j,o as M,r as N,s as ee,t as te}from"./toggle-group-BHvVXeVb.js";import{B as P,Fr as ne,G as re,H as ie,Ir as ae,J as oe,K as se,Lr as ce,Qr as le,U as ue,V as de,W as fe,Wr as pe,X as F,Xr as me,Yr as he,_ as ge,ai as _e,at as ve,dt as ye,ft as I,gr as be,hr as xe,lt as Se,mr as Ce,oi as we,ot as Te,pt as Ee,q as De,st as Oe,ut as ke,vr as Ae}from"./index-fTeMTF9d.js";var je=E(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Me=E(`message-square-off`,[[`path`,{d:`M19 19H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.7.7 0 0 1 2 21.286V5a2 2 0 0 1 1.184-1.826`,key:`1wyg69`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v11.344`,key:`mhl4k6`}]]),L=e(n(),1),Ne=new Set([`pnpm-lock.yaml`,`yarn.lock`,`package-lock.json`,`bun.lockb`,`Cargo.lock`,`go.sum`,`composer.lock`,`Gemfile.lock`]),Pe=new Set([`__snapshots__`,`__generated__`,`dist`,`build`,`vendor`]),R=new Set([`__tests__`,`tests`,`test`]),z=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`];function Fe(e){let t=e.split(`/`),n=t.at(-1)??``;return Ne.has(n)||n.endsWith(`.snap`)||n.endsWith(`.min.js`)||n.endsWith(`.min.css`)||/\.generated\./.test(n)||t.slice(0,-1).some(e=>Pe.has(e))?`generated`:/\.(?:test|spec)\./.test(n)||t.slice(0,-1).some(e=>R.has(e))?`test`:`source`}function Ie(e){let t=e.lastIndexOf(`.`);return t>e.lastIndexOf(`/`)?e.slice(0,t):e}function Le(e){return Ie(e.split(`/`).at(-1)??``)}function Re(e,t){let n=e.split(`/`).slice(0,-1);for(let e of t.split(`/`))e===`.`||e===``||(e===`..`?n.pop():n.push(e));return n.join(`/`)}var ze=/(?:\bfrom|\bimport|\brequire\s*\()\s*\(?\s*["']([^"']+)["']/g;function Be(e,t,n,r){let i=new Set;for(let a of t){ze.lastIndex=0;let t=ze.exec(a);for(;t!==null;){let o=t[1]??``,s=o.startsWith(`.`)?Re(e,o):o,c=z.find(e=>s.endsWith(e)),l=c===void 0?s:s.slice(0,-c.length),u=n.get(l)??n.get(`${l}/index`)??r.get(Le(l));u!==void 0&&u!==e&&i.add(u),t=ze.exec(a)}}return i}function Ve(e,t){let n=new Set(e),r=[],i=[...e].sort((e,t)=>e.localeCompare(t));for(;n.size>0;){let e=i.filter(e=>n.has(e)),a=e.find(e=>[...t.get(e)??[]].every(e=>!n.has(e)))??e[0];n.delete(a),r.push(a)}return r}function B(e){return(e.split(`/`).at(-1)??``).replace(/\.(?:test|spec)\..*$/,``).replace(/\.[^.]+$/,``)}function He(e){let t=new Map;for(let n of e)t.set(I(n),n);let n=new Map;for(let e of t.keys())n.set(e,Fe(e));let r=[...t.keys()].filter(e=>n.get(e)===`source`),i=new Map,a=new Set,o=new Map;for(let e of r){i.set(Ie(e),e);let t=Le(e);o.has(t)&&a.add(t),o.set(t,e)}for(let e of a)o.delete(e);let s=new Map;for(let e of r){let n=t.get(e);s.set(e,Be(e,[...n.additionLines,...n.deletionLines],i,o))}let c=Ve(r,s),l=new Map;c.forEach((e,t)=>{let n=Le(e);l.has(n)||l.set(n,t)});let u=[...t.keys()].filter(e=>n.get(e)===`test`).sort((e,t)=>(l.get(B(e))??2**53-1)-(l.get(B(t))??2**53-1)||e.localeCompare(t)),d=[...t.keys()].filter(e=>n.get(e)===`generated`).sort((e,t)=>e.localeCompare(t));return[...c,...u,...d].map(e=>t.get(e))}function Ue(e,t){return async n=>{let r=I(n),i=n.prevName?I({...n,name:n.prevName}):r,a=await e({changeType:n.type,oldPath:i,newPath:r}),o={name:r,contents:a.newContents,cacheKey:`${t}:new:${r}`};return n.type===`rename-pure`?{oldFile:null,newFile:o}:{oldFile:{name:i,contents:a.oldContents,cacheKey:`${t}:old:${i}`},newFile:o}}}function We(e,t){return Ue(async({changeType:n,oldPath:r,newPath:i})=>{let a=await e({environmentId:t.environmentId,input:{...t.reference,...t.commit===null?{}:{commit:t.commit},changeType:n,oldPath:r,newPath:i}});if(a._tag!==`Success`)throw v(a);return a.value},t.cacheKey)}var V=r();function H(e,t,n){return!n&&(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&t.trim().length>0}var U=t();function Ge(e){let t=(0,V.c)(43),{kind:n,rangeLabel:r,text:a,onTextChange:o,onCancel:s,onComment:c,onDelete:l,placeholder:u,submitLabel:f,pending:p,secondaryAction:m}=e,h=u===void 0?`Add a comment…`:u,g=f===void 0?`Comment`:f,_=p===void 0?!1:p,[v,y]=(0,L.useState)(``),b=n===`draft`&&!o?v:a,x;t[0]===b?x=t[1]:(x=b.trim(),t[0]=b,t[1]=x);let S=x;if(n===`comment`){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(me,{className:`mt-0.5 size-3.5 shrink-0 text-primary/70`,"aria-hidden":`true`}),t[2]=e):e=t[2];let n;t[3]===b?n=t[4]:(n=(0,U.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-[13px] leading-5`,children:b}),t[3]=b,t[4]=n);let r;t[5]===l?r=t[6]:(r=l?(0,U.jsx)(d,{className:`-my-1 -mr-1 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/comment:opacity-100 focus-visible:opacity-100 max-sm:opacity-100`,variant:`ghost`,size:`icon-xs`,"aria-label":`Delete comment`,onClick:l,children:(0,U.jsx)(ae,{className:`size-3`})}):null,t[5]=l,t[6]=r);let i;return t[7]!==n||t[8]!==r?(i=(0,U.jsxs)(`div`,{"data-diff-comment-annotation":!0,className:`group/comment flex min-w-0 items-start gap-2.5 border-s-2 border-primary/55 bg-primary/[0.045] px-3 py-2.5 font-sans text-foreground`,contentEditable:!1,onPointerDown:K,children:[e,n,r]}),t[7]=n,t[8]=r,t[9]=i):i=t[9],i}let C=`Comment on lines ${r}`,w;t[10]===o?w=t[11]:(w=e=>(o??y)(e.target.value),t[10]=o,t[11]=w);let T;t[12]!==s||t[13]!==c||t[14]!==_||t[15]!==S?(T=e=>{e.key===`Escape`&&(e.preventDefault(),s()),H(e,S,_)&&(e.preventDefault(),c(S))},t[12]=s,t[13]=c,t[14]=_,t[15]=S,t[16]=T):T=t[16];let E;t[17]!==b||t[18]!==h||t[19]!==C||t[20]!==w||t[21]!==T?(E=(0,U.jsx)(i,{autoFocus:!0,unstyled:!0,className:`relative inline-flex w-full rounded-md border border-border/50 bg-background/20 font-sans text-foreground transition-colors focus-within:border-border/70 [&_[data-slot=textarea]]:min-h-12 [&_[data-slot=textarea]]:cursor-text [&_[data-slot=textarea]]:px-2.5 [&_[data-slot=textarea]]:py-1.5 [&_[data-slot=textarea]]:font-sans [&_[data-slot=textarea]]:text-xs [&_[data-slot=textarea]]:leading-5 max-sm:[&_[data-slot=textarea]]:min-h-12`,size:`sm`,value:b,placeholder:h,"aria-label":C,onChange:w,onFocus:W,onKeyDown:T}),t[17]=b,t[18]=h,t[19]=C,t[20]=w,t[21]=T,t[22]=E):E=t[22];let D;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,U.jsx)(`span`,{className:`mr-auto text-[10px] text-muted-foreground/70`,children:`⌘/Ctrl Enter to send`}),t[23]=D):D=t[23];let O;t[24]===s?O=t[25]:(O=(0,U.jsx)(d,{className:`text-muted-foreground hover:text-foreground`,variant:`ghost`,size:`xs`,onClick:s,children:`Cancel`}),t[24]=s,t[25]=O);let k;t[26]!==m||t[27]!==S?(k=m?(0,U.jsxs)(d,{size:`xs`,variant:`outline`,disabled:!m.allowEmpty&&!S,onClick:()=>m.onAction(S),children:[m.icon,m.label]}):null,t[26]=m,t[27]=S,t[28]=k):k=t[28];let A=_||!S,j;t[29]!==c||t[30]!==S?(j=()=>c(S),t[29]=c,t[30]=S,t[31]=j):j=t[31];let M;t[32]!==g||t[33]!==A||t[34]!==j?(M=(0,U.jsx)(d,{size:`xs`,disabled:A,onClick:j,children:g}),t[32]=g,t[33]=A,t[34]=j,t[35]=M):M=t[35];let N;t[36]!==O||t[37]!==k||t[38]!==M?(N=(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1`,children:[D,O,k,M]}),t[36]=O,t[37]=k,t[38]=M,t[39]=N):N=t[39];let ee;return t[40]!==N||t[41]!==E?(ee=(0,U.jsxs)(`div`,{"data-diff-comment-annotation":!0,className:`px-3 py-2 font-sans text-foreground`,contentEditable:!1,onPointerDown:G,children:[E,N]}),t[40]=N,t[41]=E,t[42]=ee):ee=t[42],ee}function W(e){let t=e.currentTarget.value.length;e.currentTarget.setSelectionRange(t,t)}function G(e){return e.stopPropagation()}function K(e){return e.stopPropagation()}var q=`${ve}
|
|
2
|
-
:is(
|
|
3
|
-
[data-line],
|
|
4
|
-
[data-line-annotation],
|
|
5
|
-
[data-merge-conflict],
|
|
6
|
-
[data-merge-conflict-actions],
|
|
7
|
-
[data-no-newline]
|
|
8
|
-
)[data-selected-line] {
|
|
9
|
-
--diffs-line-bg: light-dark(
|
|
10
|
-
color-mix(
|
|
11
|
-
in lab,
|
|
12
|
-
var(--code-background) 88%,
|
|
13
|
-
color-mix(in srgb, var(--code-background) 50%, var(--diffs-modified-base))
|
|
14
|
-
),
|
|
15
|
-
color-mix(
|
|
16
|
-
in lab,
|
|
17
|
-
var(--code-background) 80%,
|
|
18
|
-
color-mix(in srgb, var(--code-background) 70%, var(--diffs-modified-base))
|
|
19
|
-
)
|
|
20
|
-
) !important;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:is([data-gutter-buffer], [data-column-number])[data-selected-line] {
|
|
24
|
-
--diffs-line-bg: light-dark(
|
|
25
|
-
color-mix(
|
|
26
|
-
in lab,
|
|
27
|
-
var(--code-background) 91%,
|
|
28
|
-
color-mix(in srgb, var(--code-background) 35%, var(--diffs-modified-base))
|
|
29
|
-
),
|
|
30
|
-
color-mix(
|
|
31
|
-
in lab,
|
|
32
|
-
var(--code-background) 85%,
|
|
33
|
-
color-mix(in srgb, var(--code-background) 60%, var(--diffs-modified-base))
|
|
34
|
-
)
|
|
35
|
-
) !important;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
[data-indicators="bars"]
|
|
39
|
-
:is([data-column-number], [data-gutter-buffer="annotation"])[data-selected-line] {
|
|
40
|
-
position: relative;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
[data-indicators="bars"]
|
|
44
|
-
:is([data-column-number], [data-gutter-buffer="annotation"])[data-selected-line]::before {
|
|
45
|
-
position: absolute !important;
|
|
46
|
-
inset-block: 0 !important;
|
|
47
|
-
inset-inline-start: 0 !important;
|
|
48
|
-
display: block !important;
|
|
49
|
-
width: 4px !important;
|
|
50
|
-
min-width: 4px !important;
|
|
51
|
-
max-width: 4px !important;
|
|
52
|
-
height: auto !important;
|
|
53
|
-
padding: 0 !important;
|
|
54
|
-
content: "" !important;
|
|
55
|
-
background-color: var(--diffs-modified-base) !important;
|
|
56
|
-
background-image: none !important;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
[data-file-info] {
|
|
60
|
-
background-color: var(--code-background) !important;
|
|
61
|
-
border-block-color: transparent !important;
|
|
62
|
-
color: var(--code-foreground) !important;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
[data-diffs-header] {
|
|
66
|
-
position: sticky !important;
|
|
67
|
-
top: 0;
|
|
68
|
-
z-index: 4;
|
|
69
|
-
background-color: var(--code-background) !important;
|
|
70
|
-
border-bottom-color: transparent !important;
|
|
71
|
-
align-items: center !important;
|
|
72
|
-
font-family: var(--font-sans) !important;
|
|
73
|
-
font-size: 12px !important;
|
|
74
|
-
line-height: 1 !important;
|
|
75
|
-
min-height: 32px !important;
|
|
76
|
-
padding-block: 6px !important;
|
|
77
|
-
padding-inline: 8px 12px !important;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
[data-diffs-header]:hover {
|
|
81
|
-
/* A native scrollbar gutter cannot be painted by descendants. Use an inset edge cue instead
|
|
82
|
-
of a full-width band that would look accidentally clipped at the gutter. */
|
|
83
|
-
background-color: var(--code-background) !important;
|
|
84
|
-
box-shadow: inset 3px 0 color-mix(in srgb, var(--code-foreground) 24%, transparent);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"]) {
|
|
88
|
-
height: 24px !important;
|
|
89
|
-
margin-block: 0 !important;
|
|
90
|
-
background-color: var(--code-background) !important;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
94
|
-
[data-separator-wrapper] {
|
|
95
|
-
padding-inline: 8px 12px !important;
|
|
96
|
-
background-color: transparent !important;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
100
|
-
[data-separator-content] {
|
|
101
|
-
gap: 8px;
|
|
102
|
-
padding-inline: 0 !important;
|
|
103
|
-
background-color: transparent !important;
|
|
104
|
-
color: color-mix(in srgb, var(--code-foreground) 52%, var(--code-background)) !important;
|
|
105
|
-
font-family: var(--font-sans) !important;
|
|
106
|
-
font-size: 11px !important;
|
|
107
|
-
text-decoration: none !important;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
111
|
-
[data-unmodified-lines] {
|
|
112
|
-
display: flex !important;
|
|
113
|
-
min-width: 0;
|
|
114
|
-
flex: 1 1 auto;
|
|
115
|
-
align-items: center;
|
|
116
|
-
gap: 8px;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
|
|
120
|
-
[data-unmodified-lines] {
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
125
|
-
[data-unmodified-lines]::before,
|
|
126
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
127
|
-
[data-unmodified-lines]::after {
|
|
128
|
-
width: auto;
|
|
129
|
-
height: 1px;
|
|
130
|
-
flex: 1 1 auto;
|
|
131
|
-
content: "";
|
|
132
|
-
background-color: color-mix(in srgb, var(--code-background) 92%, var(--code-foreground));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
|
|
136
|
-
[data-separator-wrapper] {
|
|
137
|
-
grid-template-columns: 0 minmax(0, 1fr) !important;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"])[data-expand-index]
|
|
141
|
-
[data-separator-content] {
|
|
142
|
-
grid-column: 2 !important;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/* Visually hidden rather than display: none so the expand action stays keyboard-reachable. */
|
|
146
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"])
|
|
147
|
-
[data-expand-button] {
|
|
148
|
-
position: absolute !important;
|
|
149
|
-
width: 1px !important;
|
|
150
|
-
height: 1px !important;
|
|
151
|
-
margin: -1px !important;
|
|
152
|
-
padding: 0 !important;
|
|
153
|
-
overflow: hidden !important;
|
|
154
|
-
clip-path: inset(50%) !important;
|
|
155
|
-
border: 0 !important;
|
|
156
|
-
white-space: nowrap !important;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
|
|
160
|
-
[data-expand-button]
|
|
161
|
-
)
|
|
162
|
-
[data-separator-content] {
|
|
163
|
-
cursor: pointer;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
|
|
167
|
-
[data-expand-button]
|
|
168
|
-
):is(:hover, :focus-within)
|
|
169
|
-
[data-separator-content] {
|
|
170
|
-
color: color-mix(in srgb, var(--code-foreground) 76%, var(--code-background)) !important;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
|
|
174
|
-
[data-expand-button]
|
|
175
|
-
):is(:hover, :focus-within)
|
|
176
|
-
[data-unmodified-lines]::before,
|
|
177
|
-
:is([data-separator="line-info"], [data-separator="line-info-basic"]):has(
|
|
178
|
-
[data-expand-button]
|
|
179
|
-
):is(:hover, :focus-within)
|
|
180
|
-
[data-unmodified-lines]::after {
|
|
181
|
-
background-color: color-mix(in srgb, var(--code-background) 84%, var(--code-foreground));
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
[data-diffs-header] [data-header-content] {
|
|
185
|
-
align-items: center !important;
|
|
186
|
-
line-height: 1 !important;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
[data-diffs-header] [data-metadata] {
|
|
190
|
-
align-items: center !important;
|
|
191
|
-
line-height: 1 !important;
|
|
192
|
-
font-variant-numeric: tabular-nums;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
[data-diffs-header] [data-additions-count],
|
|
196
|
-
[data-diffs-header] [data-deletions-count] {
|
|
197
|
-
font-family: var(--font-mono) !important;
|
|
198
|
-
font-size: 11px !important;
|
|
199
|
-
font-variant-numeric: tabular-nums;
|
|
200
|
-
line-height: 1 !important;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
[data-diffs-header] [data-change-icon],
|
|
204
|
-
[data-diffs-header] [data-rename-icon] {
|
|
205
|
-
display: block;
|
|
206
|
-
flex-shrink: 0;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
[data-title] {
|
|
210
|
-
cursor: pointer;
|
|
211
|
-
transition:
|
|
212
|
-
color 120ms ease,
|
|
213
|
-
text-decoration-color 120ms ease;
|
|
214
|
-
text-decoration: underline;
|
|
215
|
-
text-decoration-color: transparent;
|
|
216
|
-
text-underline-offset: 2px;
|
|
217
|
-
font-family: var(--font-sans) !important;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
[data-title]:hover {
|
|
221
|
-
color: color-mix(in srgb, var(--code-foreground) 84%, var(--primary)) !important;
|
|
222
|
-
text-decoration-color: currentColor;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/* Expanding a file mounts its body all at once; easing it in matches the 200ms the app's
|
|
226
|
-
collapsibles take. Appearance only — the viewer owns geometry, so height cannot animate.
|
|
227
|
-
Departing content cuts, the same one-way rule the pull request chrome fold follows. */
|
|
228
|
-
[data-diff],
|
|
229
|
-
[data-file] {
|
|
230
|
-
transition: opacity 200ms ease-out;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
@starting-style {
|
|
234
|
-
[data-diff],
|
|
235
|
-
[data-file] {
|
|
236
|
-
opacity: 0;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
@media (prefers-reduced-motion: reduce) {
|
|
241
|
-
[data-diff],
|
|
242
|
-
[data-file] {
|
|
243
|
-
transition: none;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
`;function Ke(e){let t=(0,V.c)(18),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({options:r,viewerRef:o,className:n,unsafeCSSExtra:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===o?s=t[7]:(s=o?{ref:o}:{},t[6]=o,t[7]=s);let c=n?`diff-render-surface outline-none ${n}`:`diff-render-surface outline-none`,l=a?`${q}\n${a}`:q,u,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u={diffHeaderHeight:32,hunkSeparatorHeight:24,spacing:0,paddingTop:0,paddingBottom:0},d={paddingTop:0,paddingBottom:0,gap:0},t[8]=u,t[9]=d):(u=t[8],d=t[9]);let f;t[10]!==r||t[11]!==l?(f={...r,unsafeCSS:l,itemMetrics:u,layout:d},t[10]=r,t[11]=l,t[12]=f):f=t[12];let p;return t[13]!==i||t[14]!==s||t[15]!==c||t[16]!==f?(p=(0,U.jsx)(k,{...i,...s,className:c,options:f}),t[13]=i,t[14]=s,t[15]=c,t[16]=f,t[17]=p):p=t[17],p}var qe=`mx-3 my-2 rounded-xl border border-border/70 bg-background p-3 text-sm shadow-sm`;function Je(e){return t=>{t.key===`Escape`&&e.onCancel&&(t.preventDefault(),e.onCancel()),H(t,e.value,e.pending)&&(t.preventDefault(),e.onSubmit())}}function Ye(e){let t=(0,V.c)(11),{comment:n,onRemove:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=y(qe,`border-dashed`),t[0]=i):i=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(he,{className:`size-3.5`}),o=(0,U.jsx)(`span`,{children:`Pending — sent when you submit the review`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(ae,{className:`size-3.5`}),t[3]=s):s=t[3];let c;t[4]===r?c=t[5]:(c=(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[a,o,(0,U.jsx)(d,{size:`icon-xs`,variant:`ghost`,className:`ml-auto`,"aria-label":`Discard this comment`,onClick:r,children:s})]}),t[4]=r,t[5]=c);let l;t[6]===n.body?l=t[7]:(l=(0,U.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap leading-relaxed`,children:n.body}),t[6]=n.body,t[7]=l);let u;return t[8]!==c||t[9]!==l?(u=(0,U.jsxs)(`div`,{className:i,contentEditable:!1,onPointerDown:Xe,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function Xe(e){return e.stopPropagation()}function Ze({thread:e,workspaceRoot:t,canReply:n,canResolve:r,canReact:a,environmentId:o,reference:s,pending:c,fixPending:l,fixLabel:u=`Fix in a thread`,onFix:f,onReply:p,canEditComment:m,onEditComment:h,onToggleResolved:g,onReacted:_}){let[v,y]=(0,L.useState)(!e.isResolved),[b,x]=(0,L.useState)(!1),[S,C]=(0,L.useState)(``),[w,E]=(0,L.useState)(null),[D,O]=(0,L.useState)(!1),k=(0,L.useRef)(!1),A=async(e,t)=>{if(D)return;O(!0);let n=await h(e,t);O(!1),n&&E(null)},j=async()=>{let e=S.trim();if(!(e.length===0||c||k.current)){k.current=!0;try{await p(e)&&(C(``),x(!1))}finally{k.current=!1}}};return(0,U.jsxs)(`div`,{className:qe,contentEditable:!1,onPointerDown:e=>e.stopPropagation(),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[e.isResolved?(0,U.jsx)(T,{className:`size-3.5 text-emerald-600 dark:text-emerald-500`}):(0,U.jsx)(je,{className:`size-3.5`}),(0,U.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,"aria-expanded":v,onClick:()=>y(e=>!e),children:[e.isResolved?`Resolved`:`Open`,` · `,e.comments.length,` `,e.comments.length===1?`comment`:`comments`]}),e.isOutdated?(0,U.jsx)(`span`,{children:`outdated`}):null,f?(0,U.jsxs)(d,{size:`xs`,variant:`ghost`,className:`ml-auto`,disabled:c||l,onClick:f,children:[(0,U.jsx)(le,{className:`size-3`}),l?`Preparing...`:u]}):null,r?(0,U.jsx)(d,{size:`xs`,variant:`ghost`,className:f?void 0:`ml-auto`,disabled:c,onClick:g,children:e.isResolved?`Unresolve`:`Resolve`}):null]}),v?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mt-2 space-y-3`,children:e.comments.map(e=>(0,U.jsxs)(`article`,{className:`group min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(re,{actor:e.author,className:`text-foreground`}),(0,U.jsx)(`span`,{children:Ae(e.createdAt)})]}),w===e.id?(0,U.jsx)(de,{className:`mt-1`,value:e.body,cwd:t,label:`Edit comment`,saving:D,onSave:t=>void A(e.id,t),onCancel:()=>E(null)}):(0,U.jsxs)(`div`,{className:`mt-1 flex items-start gap-1`,children:[(0,U.jsx)(ie,{className:`min-w-0 flex-1 text-sm`,text:e.body,cwd:t}),m(e)?(0,U.jsx)(d,{size:`icon-xs`,variant:`ghost`,className:`shrink-0 text-muted-foreground opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:opacity-100`,"aria-label":`Edit comment`,onClick:()=>E(e.id),children:(0,U.jsx)(pe,{className:`size-3`})}):null]}),(0,U.jsx)(P,{className:`mt-1.5`,reactions:e.reactions??[],canReact:a,subjectId:e.id,environmentId:o,reference:s,onRefresh:_})]},e.id))}),n?b?(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(i,{autoFocus:!0,size:`sm`,value:S,placeholder:`Reply`,"aria-label":`Reply to this conversation`,onChange:e=>C(e.target.value),onKeyDown:Je({value:S,pending:c,onSubmit:()=>void j(),onCancel:()=>x(!1)})}),(0,U.jsxs)(`div`,{className:`mt-2 flex justify-end gap-2`,children:[(0,U.jsx)(d,{size:`xs`,variant:`ghost`,onClick:()=>x(!1),children:`Cancel`}),(0,U.jsx)(d,{size:`xs`,disabled:c||S.trim().length===0,onClick:()=>void j(),children:`Reply`})]})]}):(0,U.jsx)(d,{size:`xs`,variant:`ghost`,className:`mt-2 px-1`,onClick:()=>x(!0),children:`Reply`}):null]}):null]})}var J=0;function Qe(){return J+=1,`pending-review-comment-${J}`}function $e(e){return`${e.projectId}/${e.repository}#${e.number}`}var et=[],Y=w()(e=>({drafts:{},summaries:{},addComment:(t,n)=>e(e=>({drafts:{...e.drafts,[t]:[...e.drafts[t]??et,n]}})),removeComment:(t,n)=>e(e=>{let r=(e.drafts[t]??et).filter(e=>e.id!==n);if(r.length>0)return{drafts:{...e.drafts,[t]:r}};let{[t]:i,...a}=e.drafts;return{drafts:a}}),removeComments:(t,n)=>e(e=>{let r=new Set(n),i=(e.drafts[t]??et).filter(e=>!r.has(e.id));if(i.length>0)return{drafts:{...e.drafts,[t]:i}};let{[t]:a,...o}=e.drafts;return{drafts:o}}),clear:t=>e(e=>{let{[t]:n,...r}=e.drafts;return{drafts:r}}),setSummary:(t,n)=>e(e=>({summaries:{...e.summaries,[t]:n}})),clearSummary:(t,n)=>e(e=>{if(e.summaries[t]!==n)return e;let{[t]:r,...i}=e.summaries;return{summaries:i}})}));function tt(e){let t=(0,V.c)(2),n;return t[0]===e?n=t[1]:(n=t=>t.drafts[$e(e)]??et,t[0]=e,t[1]=n),Y(n)}var nt=[{value:`comment`,label:`Comment`,sent:`Review submitted`,icon:(0,U.jsx)(he,{className:`size-3`})},{value:`approve`,label:`Approve`,sent:`Pull request approved`,icon:(0,U.jsx)(s,{className:`size-3`})},{value:`request-changes`,label:`Request changes`,sent:`Changes requested`,icon:(0,U.jsx)(_e,{className:`size-3`})}];function rt(e){let t=(0,V.c)(13),{environmentId:n,reference:r,verdicts:a,onSubmitted:o}=e,[s,c]=(0,L.useState)(!1),l=tt(r),u=$e(r),f=Y(e=>e.summaries[u]??``),p=Y(ct),m=Y(st),h=Y(ot),g=Y(at),v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={reportFailure:!1},t[0]=v):v=t[0];let y=_(F.submitReview,v),x;t[1]===a?x=t[2]:(x=e=>a.includes(e.value),t[1]=a,t[2]=x);let S=nt.filter(x);if(S.length===0)return null;let C=async e=>{if(s)return;let t=f,i=l;c(!0);let a=await y({environmentId:n,input:{...r,verdict:e.value,body:t,comments:i}});if(c(!1),a._tag===`Failure`){b.add({type:`error`,title:`The review could not be submitted`});return}m(u,i.map(it)),g(u,t),b.add({type:`success`,title:e.sent}),o()},w;t[3]!==f||t[4]!==l.length?(w=e=>e===`approve`||f.trim().length>0||l.length>0,t[3]=f,t[4]=l.length,t[5]=w):w=t[5];let T=w,E=l.length===0?`No line comments yet`:`${l.length} ${l.length===1?`comment`:`comments`} pending`,D;t[6]===E?D=t[7]:(D=(0,U.jsx)(`span`,{children:E}),t[6]=E,t[7]=D);let O=l.length>0?(0,U.jsx)(d,{size:`xs`,variant:`ghost`,disabled:s,onClick:()=>p(u),children:`Discard`}):null,k;t[8]!==D||t[9]!==O?(k=(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[D,O]}),t[8]=D,t[9]=O,t[10]=k):k=t[10];let A=S.map(e=>(0,U.jsx)(d,{size:`xs`,variant:e.value===`comment`?`outline`:`default`,disabled:s||!T(e.value),onClick:()=>void C(e),children:(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[e.icon,e.label]})},e.value)),j;return t[11]===A?j=t[12]:(j=(0,U.jsx)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-2`,children:A}),t[11]=A,t[12]=j),(0,U.jsxs)(`div`,{className:`px-4 py-3`,children:[k,(0,U.jsx)(i,{size:`sm`,className:`mt-2`,value:f,placeholder:`Summarize your review (optional)`,"aria-label":`Review summary`,onChange:e=>h(u,e.target.value)}),j]})}function it(e){return e.id}function at(e){return e.clearSummary}function ot(e){return e.setSummary}function st(e){return e.removeComments}function ct(e){return e.clear}function lt(e,t,n){return e.hunks.some(e=>t===`left`?n>=e.deletionStart&&n<e.deletionStart+e.deletionCount:n>=e.additionStart&&n<e.additionStart+e.additionCount)}function ut(e,t,n){let r=t!==`expanded`;return n.has(e)?!r:r}var dt=10,ft=`
|
|
247
|
-
[data-diffs-header] [data-additions-count],
|
|
248
|
-
[data-diffs-header] [data-deletions-count] {
|
|
249
|
-
display: none !important;
|
|
250
|
-
}`,pt=[];function mt(e){return e===`left`?`deletions`:`additions`}function ht(e){return e===`deletions`?`left`:`right`}function X({environmentId:e,reference:t,detail:n,selectedCommitOid:r,onSelectedCommitChange:i,pendingFinding:s,fixFindingLabel:v=`Fix in a thread`,onFixFinding:w,onAddToAgentSelection:T,onRefresh:E,refreshToken:k=0}){let{resolvedTheme:P}=g(),re=ne(),[ie,ae]=(0,L.useState)(()=>new Set),[le,de]=(0,L.useState)(dt),[pe,me]=(0,L.useState)(null),[_e,ve]=(0,L.useState)(`stacked`),[Ae,je]=(0,L.useState)(re.wordWrap),[Ne,Pe]=(0,L.useState)(null),[R,z]=(0,L.useState)(null),[Fe,Ie]=(0,L.useState)(!1),[Le,Re]=(0,L.useState)(!1),[ze,Be]=(0,L.useState)(!1),[Ve,B]=(0,L.useState)({key:``,cursor:null,slices:pt}),Ue=(0,L.useRef)(new Map),V=$e(t),H=r,W=H===null?V:`${V}@${H}`;(0,L.useEffect)(()=>{z(null),Pe(null),ae(new Set),me(null),de(dt),Re(!1),B({key:W,cursor:null,slices:pt}),Ue.current.clear()},[W]);let G=Ve.key===W?Ve.slices:pt,K=Ve.key===W?Ve.cursor:null,q=c(F.diff({environmentId:e,input:{...t,...K===null?{}:{cursor:K},...H===null?{}:{commit:H}}}));(0,L.useEffect)(()=>{let e=q.data;e!==null&&B(t=>{let n=t.key===W?t.slices:pt,r={cursor:K,patch:e.patch,truncated:e.truncated,nextCursor:e.nextCursor,omittedFileStats:e.omittedFileStats??[]},i=n.findIndex(e=>e.cursor===K);if(i===-1)return{key:W,cursor:K,slices:[...n,r]};let a=n[i];return a!==void 0&&a.patch===r.patch&&a.truncated===r.truncated&&a.nextCursor===r.nextCursor&&a.omittedFileStats.length===r.omittedFileStats.length&&a.omittedFileStats.every((e,t)=>{let n=r.omittedFileStats[t];return n!==void 0&&n.path===e.path&&n.additions===e.additions&&n.deletions===e.deletions})?t:{key:W,cursor:K,slices:[...n.slice(0,i),r]}})},[K,q.data,W]);let qe=m(F.diff({environmentId:e,input:{...t,...H===null?{}:{commit:H}}})),Je=(0,L.useRef)(k);(0,L.useEffect)(()=>{Je.current!==k&&(Je.current=k,B({key:W,cursor:null,slices:pt}),qe())},[k,W,qe]);let Xe=V,J=tt(t),et=Y(e=>e.addComment),nt=Y(e=>e.removeComment),it=_(F.replyToThread,{reportFailure:!1}),at=_(F.setThreadResolution,{reportFailure:!1}),ot=_(F.updateComment,{reportFailure:!1}),st=_(F.diffFileContents),ct=(0,L.useMemo)(()=>We(st,{environmentId:e,reference:t,commit:H,cacheKey:`pull-request:${V}:${n.updatedAt}:${H??`all`}`}),[H,n.updatedAt,e,st,t,V]),X=(0,L.useMemo)(()=>{let e=n.capabilities.review,t=n.viewerPermissions;return{inlineComment:e.inlineComment&&t.comment,reply:e.reply&&t.comment,resolve:e.resolve&&t.resolve,verdicts:e.verdicts.filter(e=>t.verdicts.includes(e))}},[n.capabilities.review,n.viewerPermissions]),gt=X.inlineComment&&H===null,_t=(0,L.useMemo)(()=>G.map(e=>{let t=`pull-request:${W}:${P}:${e.cursor??`first`}:${Oe(e.patch)}`,n=Ue.current.get(t);if(n)return n;let r=ke(e.patch,t,{compactPartialHunkOffsets:!0});return r&&Ue.current.set(t,r),r}),[G,P,W]),Z=(0,L.useMemo)(()=>_t.flatMap(e=>e?.kind===`files`?He(e.files):[]),[_t]),Q=G.at(-1)?.nextCursor??null,vt=G.some(e=>e.truncated)||_t.some(e=>e?.kind===`raw`),yt=(0,L.useMemo)(()=>{let e=new Set;if(H!==null)return e;for(let t of Z){let r=I(t);for(let i of n.reviewThreads)i.path===r&&i.line!==null&<(t,i.side,i.line)&&e.add(i.id)}return e},[H,n.reviewThreads,Z]),$=(0,L.useMemo)(()=>Z.map(e=>{let t=Te(e),r=I(e),i=new Map,a=(e,t)=>{let n=`${e}:${t}`,r=i.get(n);if(r)return r;let a={side:e,line:t,threads:[],pending:[],draft:!1};return i.set(n,a),a};for(let e of n.reviewThreads)e.path!==r||e.line===null||yt.has(e.id)&&a(e.side,e.line).threads.push(e);if(H===null)for(let e of J)e.path===r&&a(e.side,e.line).pending.push(e);R?.fileKey===t&&(a(R.side,R.line).draft=!0);let o=ut(t,pe,ie),s=[...i.values()].map(e=>({side:mt(e.side),lineNumber:e.line,metadata:{threads:e.threads,pending:e.pending,draft:e.draft}}));return{id:t,type:`diff`,fileDiff:e,annotations:s,collapsed:o,version:Oe(`${o?`1`:`0`}:${s.map(({side:e,lineNumber:t,metadata:n})=>`${e}:${t}:${n.draft?`d`:``}:${n.pending.map(e=>`${e.id}:${e.body}`).join(`,`)}:${n.threads.map(e=>`${e.id}:${e.isResolved?`r`:``}:${e.isOutdated?`o`:``}:${e.comments.map(e=>`${e.id}:${e.author?.login??``}:${e.createdAt}:${e.body}:${(e.reactions??[]).map(e=>`${e.content}:${e.count}:${e.viewerHasReacted?`v`:``}`).join(`,`)}`).join(`;`)}`).join(`,`)}`).join(`|`)}`)}}),[H,n.reviewThreads,R,Z,pe,J,yt,ie]),bt=(0,L.useMemo)(()=>Se(Z),[Z]),xt=(0,L.useMemo)(()=>new Map(G.flatMap(e=>e.omittedFileStats.map(e=>[e.path,e]))),[G]),St=(0,L.useMemo)(()=>$.map(e=>e.id),[$]),Ct=(0,L.useMemo)(()=>new Set($.filter(e=>e.collapsed===!0).map(e=>e.id)),[$]),wt=N(St,Ct),[Tt,Et]=(0,L.useState)(null);(0,L.useEffect)(()=>{if(Tt===null||Q===null||Q===K||q.isPending||q.error!==null)return;let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&B(e=>({...e,cursor:Q}))},{rootMargin:`240px`});return e.observe(Tt),()=>e.disconnect()},[K,q.error,q.isPending,Q,Tt]);let Dt=(0,L.useCallback)(e=>ae(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[]),Ot=()=>{me(N(St,Ct)?`expanded`:`folded`),ae(new Set)},kt=(0,L.useMemo)(()=>n.commits.toSorted((e,t)=>Date.parse(t.committedDate)-Date.parse(e.committedDate)),[n.commits]),At=(0,L.useCallback)((e,t)=>{if(!e||!gt)return;let n=t.item;if(n.type!==`diff`)return;let r=Z.find(e=>Te(e)===n.id);if(!r)return;let i=I(r),a=Ee(r);z({fileKey:n.id,path:i,oldPath:a===i?null:a,line:e.end,side:ht(e.endSide??e.side),range:e})},[gt,Z]),jt=(0,L.useCallback)((e,t,r)=>{let i=Z.find(t=>Te(t)===e.fileKey),a=i===void 0?null:u({id:`pull-request-selection:${e.fileKey}:${e.range.start}:${e.range.end}`,sectionId:`pull-request:${n.number}`,sectionTitle:`PR #${n.number} review`,filePath:e.path,fileDiff:i,range:e.range,text:t});z(null),Pe(null),a!==null&&r(a)},[n.number,Z]),Mt=(0,L.useCallback)(()=>Q===null?null:(0,U.jsx)(`div`,{ref:Et,className:`flex items-center justify-center gap-2 py-2 text-xs text-muted-foreground`,children:q.error===null?q.isPending?`Loading more files...`:null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:`The rest of this diff could not be loaded.`}),(0,U.jsx)(d,{size:`xs`,variant:`outline`,onClick:()=>q.refresh(),children:`Retry`})]})}),[Q,q.error,q.isPending,q.refresh]),Nt=(0,L.useCallback)(e=>{let t=e.collapsed===!0;return(0,U.jsx)(`button`,{type:`button`,"aria-expanded":!t,"aria-label":t?`Expand diff`:`Collapse diff`,className:y(`mr-1 inline-flex size-5 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground`),onClick:t=>{t.stopPropagation(),Dt(e.id)},children:t?(0,U.jsx)(D,{className:`size-4`}):(0,U.jsx)(f,{className:`size-4`})})},[Dt]),Pt=(0,L.useCallback)(e=>{if(e.type!==`diff`)return null;let t=0,n=0;for(let r of e.fileDiff.hunks)t+=r.additionLines,n+=r.deletionLines;if(t===0&&n===0){let r=xt.get(I(e.fileDiff));r&&({additions:t,deletions:n}=r)}return(0,U.jsx)(se,{additions:t,deletions:n,className:`font-mono text-[11px]`})},[xt]),Ft=(0,L.useMemo)(()=>({diffStyle:_e===`split`?`split`:`unified`,lineDiffType:`none`,overflow:Ae?`wrap`:`scroll`,theme:ye(P),themeType:P,stickyHeaders:!0,loadDiffFiles:ct,enableGutterUtility:gt&&R===null,enableLineSelection:gt&&R===null,onGutterUtilityClick:At,onLineSelectionEnd:At}),[_e,Ae,P,ct,gt,R,At]),It=(0,L.useCallback)(async(e,t)=>{if(Fe)return!1;Ie(!0);let n=await t();return Ie(!1),n._tag===`Failure`?(b.add({type:`error`,title:e}),!1):(E(),!0)},[E,Fe]),Lt=(0,L.useCallback)(r=>(0,U.jsx)(Ze,{thread:r,workspaceRoot:n.workspaceRoot,canReply:X.reply,canResolve:X.resolve,canReact:n.capabilities.reactions===!0,environmentId:e,reference:t,pending:Fe,fixPending:s===fe({kind:`thread`,thread:r}),fixLabel:v,...w?{onFix:()=>w({kind:`thread`,thread:r})}:{},onReply:n=>It(`Reply could not be posted`,()=>it({environmentId:e,input:{...t,threadId:r.id,body:n}})),canEditComment:e=>ue(n,{author:e.author,kind:`review-comment`}),onEditComment:(n,r)=>It(`The comment could not be saved`,()=>ot({environmentId:e,input:{...t,commentId:n,kind:`review-comment`,body:r}})),onToggleResolved:()=>void It(`The conversation could not be updated`,()=>at({environmentId:e,input:{...t,threadId:r.id,resolved:!r.isResolved}})),onReacted:E},`${t.projectId}#${t.number}:${r.id}`),[n,e,v,E,w,s,t,it,X.reply,X.resolve,It,at,Fe,ot]),Rt=(0,L.useCallback)(e=>(0,U.jsxs)(`div`,{className:`py-1 font-sans text-foreground`,children:[e.metadata.threads.map(Lt),e.metadata.pending.map(e=>(0,U.jsx)(Ye,{comment:e,onRemove:()=>nt(Xe,e.id)},e.id)),e.metadata.draft&&R?(0,U.jsx)(Ge,{kind:`draft`,rangeLabel:`${R.path}:${R.line}`,text:``,submitLabel:`Add to review`,...T?{secondaryAction:{label:`Add to agent`,onAction:e=>jt(R,e,t=>T({comment:t,request:e}))}}:{},onCancel:()=>{z(null),Pe(null)},onComment:e=>{et(Xe,{id:Qe(),path:R.path,...R.oldPath===null?{}:{oldPath:R.oldPath},line:R.line,side:R.side,body:e}),z(null),Pe(null)}}):null]}),[et,jt,R,T,nt,Lt,Xe]),zt=X.verdicts.length===0?null:(0,U.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 z-10`,children:ze?(0,U.jsxs)(`div`,{className:`chat-composer-glass pointer-events-auto absolute inset-x-3 bottom-3 rounded-xl border border-border/60 shadow-lg`,children:[(0,U.jsx)(d,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":`Close review`,className:`absolute right-2 top-2`,onClick:()=>Be(!1),children:(0,U.jsx)(C,{className:`size-3.5`})}),(0,U.jsx)(rt,{environmentId:e,reference:t,verdicts:X.verdicts,onSubmitted:()=>{E(),Be(!1)}})]}):(0,U.jsxs)(`button`,{type:`button`,className:`chat-composer-glass pointer-events-auto absolute bottom-3 right-4 flex items-center gap-1.5 rounded-full border border-border/60 px-3 py-1.5 text-xs font-medium shadow-lg`,onClick:()=>Be(!0),children:[(0,U.jsx)(he,{className:`size-3.5`}),`Review`,J.length>0?(0,U.jsx)(`span`,{className:`flex size-4 items-center justify-center rounded-full bg-accent text-[10px] tabular-nums text-accent-foreground`,children:J.length}):null]})}),Bt=kt.find(e=>e.oid===H);(0,L.useEffect)(()=>{H!==null&&Bt===void 0&&i(null)},[H,i,Bt]);let Vt=Bt?Bt.messageHeadline:`All commits`,Ht=(0,U.jsxs)(`div`,{className:`surface-subheader justify-between gap-2 px-4 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[kt.length>0?(0,U.jsxs)(o,{children:[(0,U.jsxs)(a,{className:`inline-flex h-6 max-w-64 items-center gap-1 rounded-md bg-accent px-2 text-xs font-medium text-accent-foreground outline-none transition-colors hover:bg-accent/80 focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${Vt}`,children:[(0,U.jsx)(`span`,{className:`truncate`,children:Vt}),(0,U.jsx)(f,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,U.jsxs)(l,{align:`start`,className:`w-80`,children:[(0,U.jsx)(p,{className:H===null?`bg-foreground/[0.08]`:void 0,onClick:()=>i(null),children:(0,U.jsx)(`span`,{children:`All commits`})}),kt.slice(0,le).map(e=>(0,U.jsxs)(p,{className:e.oid===H?`bg-foreground/[0.08]`:void 0,onClick:()=>i(e.oid),children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,title:e.messageHeadline,children:e.messageHeadline}),(0,U.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-xs text-muted-foreground`,children:e.oid.slice(0,7)})]},e.oid)),kt.length>le?(0,U.jsx)(p,{closeOnClick:!1,onClick:()=>de(e=>e+dt),children:(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Show more (`,kt.length-le,` left)`]})}):null]})]}):null,(0,U.jsxs)(De,{children:[(0,U.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[Z.length,` `,Z.length===1?`file`:`files`,Q===null?``:`+`]}),vt?(0,U.jsxs)(x,{children:[(0,U.jsx)(O,{render:(0,U.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,U.jsx)(S,{"aria-label":`Some of this diff was not shown`,className:`size-3.5 text-amber-600 dark:text-amber-500`})}),(0,U.jsx)(h,{side:`bottom`,children:`The host withheld part of this diff — a binary file, or a change too large to inline.`})]}):null,H!==null&&X.inlineComment?(0,U.jsxs)(x,{children:[(0,U.jsx)(O,{render:(0,U.jsx)(`span`,{className:`flex shrink-0 items-center`}),children:(0,U.jsx)(Me,{"aria-label":`Line comments are written from the whole change`,className:`size-3.5`})}),(0,U.jsx)(h,{side:`bottom`,children:`A comment is anchored to the whole change, so switch to All commits to write one.`})]}):null]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(se,{additions:bt.additions,deletions:bt.deletions,className:`mr-1`}),St.length>0?(0,U.jsxs)(x,{children:[(0,U.jsx)(O,{render:(0,U.jsx)(d,{type:`button`,size:`icon-sm`,variant:`ghost`,"aria-label":wt?`Expand all files`:`Collapse all files`,onClick:Ot}),children:wt?(0,U.jsx)(we,{className:`size-3.5`}):(0,U.jsx)(A,{className:`size-3.5`})}),(0,U.jsx)(h,{side:`top`,children:wt?`Expand all files`:`Collapse all files`})]}):null,(0,U.jsxs)(j,{className:`shrink-0 gap-1`,size:`sm`,value:[_e],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&ve(t)},children:[(0,U.jsx)(te,{"aria-label":`Stacked diff view`,value:`stacked`,variant:`ghost`,children:(0,U.jsx)(M,{className:`size-3.5`})}),(0,U.jsx)(te,{"aria-label":`Split diff view`,value:`split`,variant:`ghost`,children:(0,U.jsx)(ee,{className:`size-3.5`})})]}),(0,U.jsxs)(x,{children:[(0,U.jsx)(O,{render:(0,U.jsx)(te,{"aria-label":Ae?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`ghost`,size:`sm`,pressed:Ae,onPressedChange:e=>{je(!!e)}}),children:(0,U.jsx)(ce,{className:`size-3.5`})}),(0,U.jsx)(h,{side:`top`,children:Ae?`Disable line wrapping`:`Enable line wrapping`})]})]})]}),Ut=e=>(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ht,(0,U.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`h-full overflow-auto`,children:e}),zt]})]});if(q.isPending&&G.length===0)return Ut((0,U.jsx)(oe,{label:`Loading pull request diff...`}));if(q.error&&G.length===0)return Ut((0,U.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:q.error}));let Wt=Q===null?_t.flatMap(e=>e?.kind===`raw`?[e]:[]):[];if(Z.length===0&&Wt.length>0)return Ut((0,U.jsx)(`div`,{className:`space-y-4 px-4 py-5`,children:Wt.map(e=>(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,U.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))}));if($.length===0&&Q===null)return Ut((0,U.jsx)(`p`,{className:`px-4 py-5 text-sm text-muted-foreground`,children:H===null?`This pull request has no file changes.`:`This commit has no file changes.`}));let Gt=n.reviewThreads.filter(e=>!yt.has(e.id)),Kt=new Map;for(let e of Gt){let t=Kt.get(e.path);t?t.push(e):Kt.set(e.path,[e])}let qt=Wt.length===0?null:(0,U.jsx)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-5`,children:Wt.map(e=>(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.reason}),(0,U.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs`,children:e.text})]},`${e.reason}:${e.text.slice(0,64)}`))});return(0,U.jsx)(ge,{children:(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[Ht,Kt.size>0?(0,U.jsxs)(Ce,{className:`shrink-0 border-b border-border/60`,open:Le,onOpenChange:Re,children:[(0,U.jsx)(`h2`,{children:(0,U.jsxs)(be,{className:`flex w-full items-center gap-1.5 px-4 py-2 text-left text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:Q===null?`Conversations not on the current diff`:`Conversations not on the diff loaded so far`}),(0,U.jsx)(D,{"aria-hidden":!0,className:y(`size-3.5 transition-transform`,Le&&`rotate-90`)}),(0,U.jsx)(`span`,{"aria-hidden":!0,className:`tabular-nums`,children:Gt.length}),(0,U.jsx)(`span`,{className:`sr-only`,children:Gt.length===1?`1 conversation`:`${Gt.length} conversations`})]})}),(0,U.jsx)(xe,{children:(0,U.jsx)(`div`,{className:`max-h-64 space-y-3 overflow-auto px-4 pb-3`,children:[...Kt].map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`truncate px-3 text-xs text-muted-foreground`,title:e,children:e}),(0,U.jsx)(`div`,{className:`mt-1 space-y-2`,children:t.map(e=>(0,U.jsxs)(`div`,{children:[e.line===null?null:(0,U.jsxs)(`p`,{className:`px-3 text-xs text-muted-foreground`,children:[`Line `,e.line]}),Lt(e)]},e.id))})]},e))})})]}):null,(0,U.jsxs)(`div`,{className:`relative min-h-0 flex-1`,onClickCapture:e=>{let t=e.nativeEvent.composedPath?.()??[];for(let e of t)if(e instanceof HTMLElement){if(e instanceof HTMLButtonElement||e instanceof HTMLAnchorElement)return;if(e.hasAttribute(`data-diffs-header`)){let t=e.querySelector(`[data-title]`)?.textContent?.trim();if(t===void 0||t===``)return;let n=$.find(e=>I(e.fileDiff)===t);n!==void 0&&Dt(n.id);return}}},children:[(0,U.jsx)(Ke,{className:`h-full overflow-auto [scrollbar-gutter:stable]`,items:$,selectedLines:Ne,onSelectedLinesChange:Pe,options:Ft,renderCodeViewFooter:Mt,renderHeaderPrefix:Nt,renderHeaderMetadata:Pt,renderAnnotation:Rt,unsafeCSSExtra:ft}),zt]}),qt]})})}export{X as PullRequestCodeTab,X as default};
|
|
251
|
-
//# sourceMappingURL=PullRequestCodeTab-DehcM8Oz.js.map
|