@p4code/cli 0.7.1 → 0.7.3

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 (29) hide show
  1. package/dist/bin.mjs +40738 -52057
  2. package/dist/client/assets/DiffPanel-1TZXju6q.js +98 -0
  3. package/dist/client/assets/FilePreviewPanel-DGKHFQQ_.js +2230 -0
  4. package/dist/client/assets/P4DesignScreen-DIBwDYjN.js +19 -0
  5. package/dist/client/assets/P4DesignScreen-D_8l8WCl.css +1 -0
  6. package/dist/client/assets/PreviewPanel-B5bhhzbx.js +2 -0
  7. package/dist/client/assets/PullRequestCodeTab-ENp-K16o.js +251 -0
  8. package/dist/client/assets/entities-fvtdKO2-.js +2 -0
  9. package/dist/client/assets/env-jW24S9HL.js +2 -0
  10. package/dist/client/assets/fileCommentAnnotations-BPIepn3Q.js +2 -0
  11. package/dist/client/assets/{index-I-nORz_l.js → index-B4Nxc2w0.js} +257 -245
  12. package/dist/client/assets/{index-DRONsSry.css → index-XfE7ve8U.css} +1 -1
  13. package/dist/client/assets/previewAssetResource-J1WeeXS-.js +4 -0
  14. package/dist/client/assets/renderFileChildren-B7uYxWA9.js +2 -0
  15. package/dist/client/assets/textarea-CVN2-Kkx.js +47 -0
  16. package/dist/client/assets/toggle-group-Bs73JkcK.js +2 -0
  17. package/dist/client/index.html +6 -3
  18. package/dist/renderer-Dd2mDvu6.mjs +426 -0
  19. package/dist/runtime-Bv8fNDZe.mjs +984 -0
  20. package/dist/src-BLvXVs9y.mjs +17005 -0
  21. package/package.json +6 -1
  22. package/dist/client/assets/DiffPanel-CRdb9_i3.js +0 -98
  23. package/dist/client/assets/FilePreviewPanel-BQsOXww5.js +0 -2230
  24. package/dist/client/assets/PreviewPanel-D5oUQ2mL.js +0 -2
  25. package/dist/client/assets/PullRequestCodeTab-Cl61iwpH.js +0 -251
  26. package/dist/client/assets/fileCommentAnnotations-DLN1BKH9.js +0 -2
  27. package/dist/client/assets/previewAssetResource-6mhfd1nG.js +0 -48
  28. package/dist/client/assets/renderFileChildren-BdcEfybl.js +0 -2
  29. package/dist/client/assets/toggle-group-ffZyRu1q.js +0 -2
@@ -0,0 +1,98 @@
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{Dc as i,Di as a,Ei as o,En as s,F as c,Fs as l,Is as u,L as d,Ls as ee,Mn as te,Oi as f,P as p,Rc as ne,Rl as m,Rs as h,Ti as re,Wc as g,Xc as _,Y as v,et as y,l as b,ll as x,mi as S,nl as ie,ui as C,vi as w,wi as ae,xn as T,yi as E}from"./textarea-CVN2-Kkx.js";import{g as D,x as oe}from"./previewAssetResource-J1WeeXS-.js";import{_ as se,m as O}from"./entities-fvtdKO2-.js";import{a as k,c as A,i as j,n as M,o as ce,r as le,s as ue,t as de}from"./toggle-group-Bs73JkcK.js";import{D as fe,Fi as pe,Nr as me,O as he,Sr as ge,X as _e,Xr as ve,Z as ye,Zr as be,cr as xe,ct as Se,dr as Ce,dt as we,fr as Te,ft as Ee,gr as De,h as Oe,ji as ke,k as N,lr as Ae,lt as je,mr as Me,ni as Ne,ot as Pe,p as Fe,pr as Ie,st as Le,ti as Re,ur as ze,ut as Be,xr as Ve,yr as He}from"./index-B4Nxc2w0.js";import{a as Ue,n as We}from"./fileCommentAnnotations-BPIepn3Q.js";var Ge=h(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),P=e(n(),1);function Ke({threadRef:e,filePath:t,activeCwd:n,openInEditor:r,openFileSurface:a}){if(e){if(a){a(t);return}i.getState().openFile(e,t);return}r(n?D(t,n):t)}var F=r();function qe(e,t){let n=(0,F.c)(4),r=He(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}var I=t(),Je=[];function Ye(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function L(e,t,n){let r=Ye(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function Xe(e){let t=(0,F.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:c,className:l,renderHeaderPrefix:u}=e,d=T($e),ee=T(z),f;t[0]===a?f=t[1]:(f=e=>e.getComposerDraft(a)?.reviewComments??Je,t[0]=a,t[1]=f);let p=T(f),[ne,m]=(0,P.useState)(null),[h,re]=(0,P.useState)(null),g;t[2]===n?g=t[3]:(g=new Map(n.map(Qe)),t[2]=n,t[3]=g);let _=g,v;if(t[4]!==h||t[5]!==n||t[6]!==p||t[7]!==r){let e;t[9]!==h||t[10]!==p||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=p.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=te(t,n);return r?L(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=h?.fileKey===i?[...o,h.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:Le(`${a?`1`:`0`}:${s.flatMap(R).join(`:`)}`)}},t[9]=h,t[10]=p,t[11]=r,t[12]=e):e=t[12],v=n.map(e),t[4]=h,t[5]=n,t[6]=p,t[7]=r,t[8]=v}else v=t[8];let y=v,b;t[13]!==a||t[14]!==h?.annotation||t[15]!==ee?(b=e=>{m(null),h?.annotation.metadata.entries.some(t=>t.id===e)?re(null):ee(a,e)},t[13]=a,t[14]=h?.annotation,t[15]=ee,t[16]=b):b=t[16];let x=b,S;t[17]!==d||t[18]!==a||t[19]!==h||t[20]!==_||t[21]!==r||t[22]!==i?(S=(e,t)=>{let n=h?.annotation.metadata.entries.find(t=>t.id===e),o=h?_.get(h.fileKey):void 0;if(!n||!o)return;let c=s({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});c&&d(a,c),m(null),re(null)},t[17]=d,t[18]=a,t[19]=h,t[20]=_,t[21]=r,t[22]=i,t[23]=S):S=t[23];let ie=S,C;t[24]!==_||t[25]!==r||t[26]!==i?(C=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=_.get(n.id);if(!a)return;let o=We(),c=s({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});c&&re({fileKey:n.id,annotation:{side:Ye(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:c.rangeLabel,text:``}]}}})},t[24]=_,t[25]=r,t[26]=i,t[27]=C):C=t[27];let w=C,ae=h!==null,E;t[28]===c?E=t[29]:(E=c?{ref:c}:{},t[28]=c,t[29]=E);let D;t[30]===l?D=t[31]:(D=l?{className:l}:{},t[30]=l,t[31]=D);let oe=!ae,se=!ae,O;t[32]!==w||t[33]!==o||t[34]!==se||t[35]!==oe?(O={...o,enableGutterUtility:oe,enableLineSelection:se,onLineSelectionEnd:w},t[32]=w,t[33]=o,t[34]=se,t[35]=oe,t[36]=O):O=t[36];let A;t[37]===u?A=t[38]:(A=e=>e.type===`diff`?u(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=u,t[38]=A);let j;t[39]!==x||t[40]!==ie?(j=e=>(0,I.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,I.jsx)(Ue,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>x(e.id),onComment:t=>ie(e.id,t),onDelete:()=>x(e.id)},e.id))}),t[39]=x,t[40]=ie,t[41]=j):j=t[41];let M;return t[42]!==y||t[43]!==ne||t[44]!==O||t[45]!==A||t[46]!==j||t[47]!==E||t[48]!==D?(M=(0,I.jsx)(k,{...E,...D,items:y,selectedLines:ne,onSelectedLinesChange:m,options:O,renderHeaderPrefix:A,renderAnnotation:j}),t[42]=y,t[43]=ne,t[44]=O,t[45]=A,t[46]=j,t[47]=E,t[48]=D,t[49]=M):M=t[49],M}function R(e){return e.metadata.entries.map(Ze)}function Ze(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Qe(e){return[e.fileKey,e]}function z(e){return e.removeReviewComment}function $e(e){return e.addReviewComment}function et(e){return{diffPreview:g(e,{label:`environment-data:review:diff-preview`,tag:m.reviewGetDiffPreview,staleTimeMs:5e3})}}var tt=et(y);function B(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function nt(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&B(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function rt(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var V=`__automatic_base_ref__`,it=new Set,at=`
2
+ [data-diffs-header],
3
+ [data-diff],
4
+ [data-file],
5
+ [data-error-wrapper],
6
+ [data-virtualizer-buffer] {
7
+ --diffs-header-font-family: var(--font-sans) !important;
8
+ --diffs-font-family: var(--font-mono) !important;
9
+ --diffs-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
10
+ --diffs-light-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
11
+ --diffs-dark-bg: color-mix(in srgb, var(--card) 90%, var(--background)) !important;
12
+ --diffs-token-light-bg: transparent;
13
+ --diffs-token-dark-bg: transparent;
14
+
15
+ --diffs-bg-context-override: color-mix(in srgb, var(--background) 97%, var(--foreground));
16
+ --diffs-bg-hover-override: color-mix(in srgb, var(--background) 94%, var(--foreground));
17
+ --diffs-bg-separator-override: color-mix(in srgb, var(--background) 95%, var(--foreground));
18
+ --diffs-bg-buffer-override: color-mix(in srgb, var(--background) 90%, var(--foreground));
19
+
20
+ --diffs-bg-addition-override: color-mix(in srgb, var(--background) 92%, var(--success));
21
+ --diffs-bg-addition-number-override: color-mix(in srgb, var(--background) 88%, var(--success));
22
+ --diffs-bg-addition-hover-override: color-mix(in srgb, var(--background) 85%, var(--success));
23
+ --diffs-bg-addition-emphasis-override: color-mix(in srgb, var(--background) 80%, var(--success));
24
+
25
+ --diffs-bg-deletion-override: color-mix(in srgb, var(--background) 92%, var(--destructive));
26
+ --diffs-bg-deletion-number-override: color-mix(in srgb, var(--background) 88%, var(--destructive));
27
+ --diffs-bg-deletion-hover-override: color-mix(in srgb, var(--background) 85%, var(--destructive));
28
+ --diffs-bg-deletion-emphasis-override: color-mix(
29
+ in srgb,
30
+ var(--background) 80%,
31
+ var(--destructive)
32
+ );
33
+
34
+ background-color: var(--diffs-bg) !important;
35
+ }
36
+
37
+ [data-file-info] {
38
+ background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
39
+ border-block-color: var(--border) !important;
40
+ color: var(--foreground) !important;
41
+ }
42
+
43
+ [data-diffs-header] {
44
+ position: sticky !important;
45
+ top: 0;
46
+ z-index: 4;
47
+ background-color: color-mix(in srgb, var(--card) 94%, var(--foreground)) !important;
48
+ border-bottom: 1px solid var(--border) !important;
49
+ align-items: center !important;
50
+ font-family: var(--font-sans) !important;
51
+ font-size: 12px !important;
52
+ line-height: 1 !important;
53
+ min-height: 32px !important;
54
+ padding-block: 6px !important;
55
+ }
56
+
57
+ [data-diffs-header] [data-header-content] {
58
+ align-items: center !important;
59
+ line-height: 1 !important;
60
+ }
61
+
62
+ [data-diffs-header] [data-metadata] {
63
+ align-items: center !important;
64
+ line-height: 1 !important;
65
+ font-variant-numeric: tabular-nums;
66
+ }
67
+
68
+ [data-diffs-header] [data-additions-count],
69
+ [data-diffs-header] [data-deletions-count] {
70
+ font-family: var(--font-mono) !important;
71
+ font-size: 11px !important;
72
+ font-variant-numeric: tabular-nums;
73
+ line-height: 1 !important;
74
+ }
75
+
76
+ [data-diffs-header] [data-change-icon],
77
+ [data-diffs-header] [data-rename-icon] {
78
+ display: block;
79
+ flex-shrink: 0;
80
+ }
81
+
82
+ [data-title] {
83
+ cursor: pointer;
84
+ transition:
85
+ color 120ms ease,
86
+ text-decoration-color 120ms ease;
87
+ text-decoration: underline;
88
+ text-decoration-color: transparent;
89
+ text-underline-offset: 2px;
90
+ font-family: var(--font-sans) !important;
91
+ }
92
+
93
+ [data-title]:hover {
94
+ color: color-mix(in srgb, var(--foreground) 84%, var(--primary)) !important;
95
+ text-decoration-color: currentColor;
96
+ }
97
+ `;function H({mode:e=`inline`,composerDraftTarget:t,initialGitScope:n,threadRef:r}){let{resolvedTheme:i}=oe(),s=be(),[te]=(0,P.useState)(n),[m,h]=(0,P.useState)(`stacked`),[g,y]=(0,P.useState)(s.wordWrap),[T,D]=(0,P.useState)(s.diffIgnoreWhitespace),[k,Oe]=(0,P.useState)(``),[Le,He]=(0,P.useState)(()=>({scopeKey:null,fileKeys:it})),Ue=(0,P.useRef)(null),We=r.threadId,F=se(r),Je=F?.projectId??null,Ye=O(F&&Je?{environmentId:F.environmentId,projectId:Je}:null),L=F?.worktreePath??Ye?.workspaceRoot,R=ne(v.configValueAtom(F?.environmentId??null)),Ze=Ve(F?.environmentId??null,R?.availableEditors??[]),Qe=b(F!=null&&L!=null?ve.status({environmentId:F.environmentId,input:{cwd:L}}):null),z=N(e=>he(e.byThreadKey,r,te===`unstaged`)),$e=Qe.data?.isRepo??!0,{turnDiffSummaries:et,inferredCheckpointTurnCountByTurnId:B}=fe(F),H=(0,P.useMemo)(()=>[...et].toSorted((e,t)=>{let n=e.checkpointTurnCount??B[e.turnId]??0,r=t.checkpointTurnCount??B[t.turnId]??0;return n===r?t.completedAt.localeCompare(e.completedAt):r-n}),[B,et]);(0,P.useEffect)(()=>{z.kind===`turn`&&N.getState().reconcileTurnSelection(r,H.map(e=>e.turnId))},[z,H,r]);let U=z.kind===`turn`?z.turnId:null,W=z.kind===`unstaged`?`unstaged`:`branch`,G=z.kind===`branch`?z.baseRef:null,ot=z.kind===`turn`?z.filePath:null,st=z.kind===`turn`?z.revealRequestId:0,K=U===null?void 0:H.find(e=>e.turnId===U)??H[0],q=K&&(K.checkpointTurnCount??B[K.turnId]),ct=H[0],lt=U===null?W===`unstaged`?`Working tree`:`Branch changes`:K?.turnId===ct?.turnId?`Latest turn`:`Turn ${q??`?`}`,ut=K?`turn:${K.turnId}`:W,J=`${r.environmentId}:${r.threadId}:${ut}`,dt=Le.scopeKey===J?Le.fileKeys:it,ft=K?`Turn ${q??`?`}`:W===`unstaged`?`Working tree`:`Branch changes`,pt=(0,P.useMemo)(()=>typeof q==`number`?{fromTurnCount:Math.max(0,q-1),toTurnCount:q}:null,[q]),mt=qe({environmentId:F?.environmentId??null,threadId:We,fromTurnCount:pt?.fromTurnCount??null,toTurnCount:pt?.toTurnCount??null,ignoreWhitespace:T,cacheScope:K?`turn:${K.turnId}`:null},{enabled:$e&&K!==void 0}),ht=b(U===null&&F&&L?tt.diffPreview({environmentId:F.environmentId,input:{cwd:L,...G?{baseRef:G}:{},ignoreWhitespace:T}}):null),gt=U===null&&ht.error?.includes(`configured workspace root`)===!0&&R?.cwd!==void 0&&R.cwd!==L,_t=b(gt&&F&&R?tt.diffPreview({environmentId:F.environmentId,input:{cwd:R.cwd,...G?{baseRef:G}:{},ignoreWhitespace:T}}):null),Y=gt?_t:ht,X=Y.data?.sources.find(e=>e.kind===(W===`unstaged`?`working-tree`:`branch-range`)),vt=b(U===null&&W===`branch`&&F&&Y.data?.cwd?ve.listRefs({environmentId:F.environmentId,input:{cwd:Y.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...k.trim().length>0?{query:k.trim()}:{},limit:100}}):null),yt=b(U===null&&W===`branch`&&F&&Y.data?.cwd?ve.listRefs({environmentId:F.environmentId,input:{cwd:Y.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...k.trim().length>0?{query:k.trim()}:{},limit:100}}):null),bt=nt(vt.data?.refs.filter(e=>e.name!==X?.headRef)??[],yt.data?.refs??[]),xt=rt(bt,k),St=e=>G&&G===e.remote?.name?G:e.local?.name??e.remote?.name??e.id,Ct=[V,...bt.map(St)],wt=[...k.trim().length===0?[V]:[],...xt.map(St)],Tt=X?.diff,Z=K?mt.data?.diff:Tt,Et=!K&&X?.truncated===!0,Dt=K?mt.isPending:Y.isPending,Ot=K?mt.error:Y.error,kt=typeof Z==`string`&&Z.trim().length===0,Q=(0,P.useMemo)(()=>Be(Z,`diff-panel:${i}`,{compactPartialHunkOffsets:U===null}),[i,Z,U]),At=(0,P.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>Ee(e).localeCompare(Ee(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,P.useMemo)(()=>At.map(e=>{let t=Pe(e);return{fileDiff:e,filePath:Ee(e),fileKey:t,collapsed:dt.has(t)}}),[dt,At]),jt=(0,P.useMemo)(()=>$.map(e=>e.fileKey),[$]),Mt=le(jt,dt),Nt=(0,P.useMemo)(()=>je(At),[At]);(0,P.useEffect)(()=>{if(!ot)return;let e=$.find(e=>e.filePath===ot);e&&Ue.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,ot,st]);let Pt=De({threadRef:r,workspaceRoot:L??null}),Ft=(0,P.useCallback)(e=>{Ke({threadRef:r,filePath:e,activeCwd:L,openFileSurface:Pt,openInEditor:e=>{(async()=>{let t=await Ze(e);t._tag===`Failure`&&!_(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,environmentId:r.environmentId,threadId:r.threadId,...x(ie(t))})})()}})},[L,Pt,Ze,r]),It=(0,P.useCallback)(e=>{He(t=>{let n=new Set(t.scopeKey===J?t.fileKeys:[]);return n.has(e)?n.delete(e):n.add(e),{scopeKey:J,fileKeys:n}})},[J]),Lt=(0,P.useCallback)(()=>{He(e=>{let t=e.scopeKey===J?e.fileKeys:it;return{scopeKey:J,fileKeys:j(jt,t)}})},[J,jt]),Rt=e=>{N.getState().selectTurn(r,e)},zt=e=>{N.getState().selectGitScope(r,e)},Bt=e=>{N.getState().selectBranchBaseRef(r,e)};return(0,I.jsx)(ye,{mode:e,header:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3 [-webkit-app-region:no-drag]`,children:[(0,I.jsxs)(S,{children:[(0,I.jsxs)(a,{className:`inline-flex h-6 max-w-full items-center gap-1 rounded-md bg-muted/70 px-2 text-xs font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Diff scope: ${lt}`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:lt}),(0,I.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,I.jsxs)(E,{align:`start`,className:`w-60`,children:[(0,I.jsx)(w,{className:U===null&&W===`unstaged`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`unstaged`),children:(0,I.jsx)(`span`,{children:`Working tree`})}),(0,I.jsx)(w,{className:U===null&&W===`branch`?`bg-foreground/[0.08]`:void 0,onClick:()=>zt(`branch`),children:(0,I.jsx)(`span`,{children:`Branch changes`})}),(0,I.jsx)(w,{className:U!==null&&K?.turnId===ct?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{ct&&Rt(ct.turnId)},children:(0,I.jsx)(`span`,{children:`Latest turn`})}),(0,I.jsxs)(ae,{children:[(0,I.jsx)(o,{children:`Turn`}),(0,I.jsx)(re,{className:`w-64`,children:H.map(e=>{let t=e.checkpointTurnCount??B[e.turnId]??`?`;return(0,I.jsxs)(w,{className:e.turnId===K?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>Rt(e.turnId),children:[(0,I.jsxs)(`span`,{children:[`Turn `,t]}),(0,I.jsx)(`span`,{className:`ml-auto text-xs tabular-nums text-muted-foreground`,children:me(e.completedAt,s.timestampFormat)})]},e.turnId)})})]})]})]}),U===null&&W===`branch`&&X?.baseRef&&(0,I.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2 overflow-hidden text-xs text-muted-foreground`,title:`${X.headRef??`HEAD`} → ${X.baseRef}`,"aria-label":`Comparing ${X.headRef??`HEAD`} against ${X.baseRef}`,children:[(0,I.jsx)(`span`,{className:`min-w-0 max-w-48 truncate`,children:X.headRef??`HEAD`}),(0,I.jsx)(pe,{className:`size-3.5 shrink-0 opacity-70`}),(0,I.jsxs)(xe,{items:Ct,filteredItems:wt,value:G??V,onOpenChange:e=>{e||Oe(``)},onValueChange:e=>{e&&Bt(e===V?null:e)},children:[(0,I.jsxs)(Me,{className:`inline-flex min-w-0 max-w-48 items-center gap-1 overflow-hidden rounded-md px-1.5 py-1 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,"aria-label":`Change comparison target. Currently ${X.baseRef}`,children:[(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:X.baseRef}),(0,I.jsx)(u,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,I.jsxs)(Ie,{align:`start`,className:`w-72 min-w-0 max-w-[calc(100vw-1rem)] overflow-hidden [&>[data-slot=combobox-popup]]:min-w-0 [&>[data-slot=combobox-popup]]:overflow-hidden`,children:[(0,I.jsx)(`div`,{className:`min-w-0 shrink-0 px-3 pt-2.5`,children:(0,I.jsxs)(`div`,{className:`relative -translate-y-px border-b border-border/70 pb-1.5 transition-colors focus-within:border-ring`,children:[(0,I.jsx)(Ne,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,I.jsx)(ze,{className:`[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5`,inputClassName:`rounded-none bg-transparent text-sm`,placeholder:`Search refs...`,showTrigger:!1,size:`sm`,unstyled:!0,value:k,onChange:e=>Oe(e.target.value)})]})}),(0,I.jsxs)(`div`,{className:`grid shrink-0 grid-cols-[1rem_minmax(0,1fr)] items-center gap-2 border-b border-border/70 ps-3 pe-6.5 pt-2 pb-1.5 font-medium text-[10px] text-muted-foreground uppercase tracking-wide`,children:[(0,I.jsx)(`span`,{"aria-hidden":`true`}),(0,I.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center`,children:[(0,I.jsx)(`span`,{children:`Branch`}),(0,I.jsx)(`span`,{className:`text-right`,children:`Remote`})]})]}),(0,I.jsx)(Ae,{children:`No matching refs.`}),(0,I.jsxs)(Te,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,I.jsx)(Ce,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:V,children:(0,I.jsx)(`span`,{className:`block min-w-0 truncate`,children:`Automatic`})}),bt.map(e=>{let t=St(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,I.jsx)(Ce,{className:`h-8 w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)] py-0`,contentClassName:`w-full min-w-0 overflow-hidden`,value:t,children:(0,I.jsxs)(`div`,{className:`grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden`,children:[(0,I.jsx)(`span`,{className:`block min-w-0 truncate pe-2`,children:e.label}),n?(0,I.jsx)(`div`,{className:`flex justify-end`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,I.jsx)(ge,{"aria-label":`Use remote version of ${e.label}`,checked:r,className:`[--thumb-size:--spacing(3)]`,onCheckedChange:t=>{let n=t?e.remote?.name:e.local?.name;n&&Bt(n)}})}):e.remote?(0,I.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,title:`Remote only`,children:(0,I.jsx)(ee,{"aria-hidden":`true`,className:`size-3`})}):null]})},e.id)})]})]})]})]})]}),(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[$.length>0&&(0,I.jsx)(Fe,{additions:Nt.additions,deletions:Nt.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,I.jsxs)(p,{children:[(0,I.jsx)(d,{render:(0,I.jsx)(C,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Mt?`Expand all files`:`Collapse all files`,onClick:Lt}),children:Mt?(0,I.jsx)(ke,{className:`size-3`}):(0,I.jsx)(A,{className:`size-3`})}),(0,I.jsx)(c,{side:`top`,children:Mt?`Expand all files`:`Collapse all files`})]}),(0,I.jsxs)(M,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[m],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&h(t)},children:[(0,I.jsx)(de,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,I.jsx)(ce,{className:`size-3`})}),(0,I.jsx)(de,{"aria-label":`Split diff view`,value:`split`,children:(0,I.jsx)(ue,{className:`size-3`})})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(d,{render:(0,I.jsx)(de,{"aria-label":g?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:g,onPressedChange:e=>{y(!!e)}}),children:(0,I.jsx)(Re,{className:`size-3`})}),(0,I.jsx)(c,{side:`top`,children:g?`Disable line wrapping`:`Enable line wrapping`})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(d,{render:(0,I.jsx)(de,{"aria-label":T?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:T,onPressedChange:e=>{D(!!e)}}),children:(0,I.jsx)(Ge,{className:`size-3`})}),(0,I.jsx)(c,{side:`top`,children:T?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:F?$e?U!==null&&H.length===0?(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`No completed turns yet.`}):(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(`div`,{className:`diff-panel-viewport flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[Et&&(0,I.jsx)(`p`,{className:`shrink-0 border-b border-border/70 bg-muted/40 px-3 py-1.5 text-[11px] text-muted-foreground`,children:`This diff was truncated because it exceeded the preview limit. The changes shown are incomplete.`}),Ot&&!Q&&(0,I.jsx)(`div`,{className:`px-3`,children:(0,I.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:Ot})}),Q?Q.kind===`files`?(0,I.jsx)(`div`,{className:`min-h-0 flex-1`,onClickCapture:e=>{let t=(e.nativeEvent.composedPath?.()??[]).find(e=>e instanceof HTMLElement&&e.hasAttribute(`data-title`))?.textContent?.trim();t&&Ft(t)},children:(0,I.jsx)(Xe,{viewerRef:Ue,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:ut,sectionTitle:ft,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=Ee(e);return(0,I.jsxs)(p,{children:[(0,I.jsx)(d,{render:(0,I.jsx)(`button`,{type:`button`,className:f(`inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 transition-colors hover:bg-foreground/10 focus-visible:outline-hidden`,Se(e)),"aria-label":n?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!n,onClick:e=>{e.stopPropagation(),It(t)}}),children:n?(0,I.jsx)(l,{className:`size-4`}):(0,I.jsx)(u,{className:`size-4`})}),(0,I.jsx)(c,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:m===`split`?`split`:`unified`,lineDiffType:`none`,overflow:g?`wrap`:`scroll`,theme:we(i),themeType:i,unsafeCSS:at,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},J??ut)}):(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:Q.reason}),(0,I.jsx)(`pre`,{className:f(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,g?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):Dt?(0,I.jsx)(_e,{label:K?`Loading checkpoint diff...`:W===`unstaged`?`Loading working tree diff...`:`Loading branch diff...`}):(0,I.jsx)(`div`,{className:`flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70`,children:(0,I.jsx)(`p`,{children:kt?`No net changes in this selection.`:`No patch available for this selection.`})})]})}):(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Turn diffs are unavailable because this project is not a git repository.`}):(0,I.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:`Select a thread to inspect turn diffs.`})})}export{Oe as DiffWorkerPoolProvider,H as default};
98
+ //# sourceMappingURL=DiffPanel-1TZXju6q.js.map