@p4code/cli 0.2.8 → 0.2.10

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.
@@ -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{Ac as i,H as a,Mc as o,Q as s,Qt as c,Yc as ee,Z as l,Zi as u,aa as d,b as f,ct as p,da as te,dl as m,ea as ne,el as h,et as g,fa as _,gl as re,h as v,ia as y,jc as b,kc as ie,ma as x,nn as S,nr as ae,ol as oe,pa as C,pr as w,sr as se,ua as T,zl as E,zm as D,zt as O}from"./previewAssetResource-BSROvnGK.js";import{t as k}from"./arrow-right-BVNtWG8x.js";import{a as ce,i as A,n as j,o as le,r as ue,s as de,t as fe}from"./toggle-group-D1LwJnHy.js";import{Ar as pe,F as me,Fr as he,I as ge,J as _e,L as ve,Lr as ye,Nr as be,R as M,Y as xe,_ as Se,ai as Ce,ar as we,at as Te,cr as Ee,ct as De,dr as Oe,h as ke,ii as Ae,ir as je,it as Me,jr as Ne,kr as Pe,lr as Fe,lt as Ie,or as Le,ot as Re,pr as ze,rr as Be,rt as Ve,sr as He,st as Ue,ur as We,yr as Ge}from"./index-CMTkzFln.js";import{a as N,n as Ke}from"./fileCommentAnnotations-DvUUWTQU.js";var qe=o(`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 Je({threadRef:e,filePath:t,activeCwd:n,openInEditor:r,openFileSurface:i}){if(e){if(i){i(t);return}a.getState().openFile(e,t);return}r(n?v(t,n):t)}var F=r();function Ye(e,t){let n=(0,F.c)(4),r=ze(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(),Xe=[];function Ze(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function L(e,t,n){let r=Ze(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 Qe(e){let t=(0,F.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:s,className:c,renderHeaderPrefix:ee}=e,l=ae(tt),u=ae(z),d;t[0]===a?d=t[1]:(d=e=>e.getComposerDraft(a)?.reviewComments??Xe,t[0]=a,t[1]=d);let f=ae(d),[p,te]=(0,P.useState)(null),[m,ne]=(0,P.useState)(null),h;t[2]===n?h=t[3]:(h=new Map(n.map(et)),t[2]=n,t[3]=h);let g=h,_;if(t[4]!==m||t[5]!==n||t[6]!==f||t[7]!==r){let e;t[9]!==m||t[10]!==f||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=f.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=w(t,n);return r?L(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=m?.fileKey===i?[...o,m.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:Me(`${a?`1`:`0`}:${s.flatMap(R).join(`:`)}`)}},t[9]=m,t[10]=f,t[11]=r,t[12]=e):e=t[12],_=n.map(e),t[4]=m,t[5]=n,t[6]=f,t[7]=r,t[8]=_}else _=t[8];let re=_,v;t[13]!==a||t[14]!==m?.annotation||t[15]!==u?(v=e=>{te(null),m?.annotation.metadata.entries.some(t=>t.id===e)?ne(null):u(a,e)},t[13]=a,t[14]=m?.annotation,t[15]=u,t[16]=v):v=t[16];let y=v,b;t[17]!==l||t[18]!==a||t[19]!==m||t[20]!==g||t[21]!==r||t[22]!==i?(b=(e,t)=>{let n=m?.annotation.metadata.entries.find(t=>t.id===e),o=m?g.get(m.fileKey):void 0;if(!n||!o)return;let s=se({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});s&&l(a,s),te(null),ne(null)},t[17]=l,t[18]=a,t[19]=m,t[20]=g,t[21]=r,t[22]=i,t[23]=b):b=t[23];let ie=b,x;t[24]!==g||t[25]!==r||t[26]!==i?(x=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=g.get(n.id);if(!a)return;let o=Ke(),s=se({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});s&&ne({fileKey:n.id,annotation:{side:Ze(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:s.rangeLabel,text:``}]}}})},t[24]=g,t[25]=r,t[26]=i,t[27]=x):x=t[27];let S=x,oe=m!==null,C;t[28]===s?C=t[29]:(C=s?{ref:s}:{},t[28]=s,t[29]=C);let T;t[30]===c?T=t[31]:(T=c?{className:c}:{},t[30]=c,t[31]=T);let E=!oe,D=!oe,O;t[32]!==S||t[33]!==o||t[34]!==D||t[35]!==E?(O={...o,enableGutterUtility:E,enableLineSelection:D,onLineSelectionEnd:S},t[32]=S,t[33]=o,t[34]=D,t[35]=E,t[36]=O):O=t[36];let k;t[37]===ee?k=t[38]:(k=e=>e.type===`diff`?ee(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=ee,t[38]=k);let A;t[39]!==y||t[40]!==ie?(A=e=>(0,I.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,I.jsx)(N,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>y(e.id),onComment:t=>ie(e.id,t),onDelete:()=>y(e.id)},e.id))}),t[39]=y,t[40]=ie,t[41]=A):A=t[41];let j;return t[42]!==re||t[43]!==p||t[44]!==O||t[45]!==k||t[46]!==A||t[47]!==C||t[48]!==T?(j=(0,I.jsx)(ce,{...C,...T,items:re,selectedLines:p,onSelectedLinesChange:te,options:O,renderHeaderPrefix:k,renderAnnotation:A}),t[42]=re,t[43]=p,t[44]=O,t[45]=k,t[46]=A,t[47]=C,t[48]=T,t[49]=j):j=t[49],j}function R(e){return e.metadata.entries.map($e)}function $e(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function et(e){return[e.fileKey,e]}function z(e){return e.removeReviewComment}function tt(e){return e.addReviewComment}function nt(e){return{diffPreview:h(e,{label:`environment-data:review:diff-preview`,tag:E.reviewGetDiffPreview,staleTimeMs:5e3})}}var rt=nt(S);function B(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function it(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 at(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__`,ot=new Set,st=`
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}){let{resolvedTheme:r}=f(),a=be(),[o]=(0,P.useState)(n),[h,v]=(0,P.useState)(`stacked`),[S,ae]=(0,P.useState)(a.wordWrap),[w,se]=(0,P.useState)(a.diffIgnoreWhitespace),[E,ce]=(0,P.useState)(``),[Se,Me]=(0,P.useState)(()=>({scopeKey:null,fileKeys:ot})),ze=(0,P.useRef)(null),N=D({strict:!1,select:e=>O(e)}),Ke=N?.threadId??null,F=Ne(N),Xe=F?.projectId??null,Ze=pe(F&&Xe?{environmentId:F.environmentId,projectId:Xe}:null),L=F?.worktreePath??Ze?.workspaceRoot,R=ee(c.configValueAtom(F?.environmentId??null)),$e=Oe(F?.environmentId??null,R?.availableEditors??[]),et=p(F!=null&&L!=null?Pe.status({environmentId:F.environmentId,input:{cwd:L}}):null),z=M(e=>ve(e.byThreadKey,N,o===`unstaged`)),tt=et.data?.isRepo??!0,{turnDiffSummaries:nt,inferredCheckpointTurnCountByTurnId:B}=ge(F),H=(0,P.useMemo)(()=>[...nt].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,nt]);(0,P.useEffect)(()=>{!N||z.kind!==`turn`||M.getState().reconcileTurnSelection(N,H.map(e=>e.turnId))},[z,H,N]);let U=z.kind===`turn`?z.turnId:null,W=z.kind===`unstaged`?`unstaged`:`branch`,G=z.kind===`branch`?z.baseRef:null,ct=z.kind===`turn`?z.filePath:null,lt=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]),ut=H[0],dt=U===null?W===`unstaged`?`Working tree`:`Branch changes`:K?.turnId===ut?.turnId?`Latest turn`:`Turn ${q??`?`}`,ft=K?`turn:${K.turnId}`:W,J=N?`${N.environmentId}:${N.threadId}:${ft}`:null,pt=Se.scopeKey===J?Se.fileKeys:ot,mt=K?`Turn ${q??`?`}`:W===`unstaged`?`Working tree`:`Branch changes`,ht=(0,P.useMemo)(()=>typeof q==`number`?{fromTurnCount:Math.max(0,q-1),toTurnCount:q}:null,[q]),gt=Ye({environmentId:F?.environmentId??null,threadId:Ke,fromTurnCount:ht?.fromTurnCount??null,toTurnCount:ht?.toTurnCount??null,ignoreWhitespace:w,cacheScope:K?`turn:${K.turnId}`:null},{enabled:tt&&K!==void 0}),_t=p(U===null&&F&&L?rt.diffPreview({environmentId:F.environmentId,input:{cwd:L,...G?{baseRef:G}:{},ignoreWhitespace:w}}):null),vt=U===null&&_t.error?.includes(`configured workspace root`)===!0&&R?.cwd!==void 0&&R.cwd!==L,yt=p(vt&&F&&R?rt.diffPreview({environmentId:F.environmentId,input:{cwd:R.cwd,...G?{baseRef:G}:{},ignoreWhitespace:w}}):null),Y=vt?yt:_t,X=Y.data?.sources.find(e=>e.kind===(W===`unstaged`?`working-tree`:`branch-range`)),bt=p(U===null&&W===`branch`&&F&&Y.data?.cwd?Pe.listRefs({environmentId:F.environmentId,input:{cwd:Y.data.cwd,includeMatchingRemoteRefs:!0,refKind:`local`,...E.trim().length>0?{query:E.trim()}:{},limit:100}}):null),xt=p(U===null&&W===`branch`&&F&&Y.data?.cwd?Pe.listRefs({environmentId:F.environmentId,input:{cwd:Y.data.cwd,includeMatchingRemoteRefs:!0,refKind:`remote`,...E.trim().length>0?{query:E.trim()}:{},limit:100}}):null),St=it(bt.data?.refs.filter(e=>e.name!==X?.headRef)??[],xt.data?.refs??[]),Ct=at(St,E),wt=e=>G&&G===e.remote?.name?G:e.local?.name??e.remote?.name??e.id,Tt=[V,...St.map(wt)],Et=[...E.trim().length===0?[V]:[],...Ct.map(wt)],Dt=X?.diff,Z=K?gt.data?.diff:Dt,Ot=!K&&X?.truncated===!0,kt=K?gt.isPending:Y.isPending,At=K?gt.error:Y.error,jt=typeof Z==`string`&&Z.trim().length===0,Q=(0,P.useMemo)(()=>Ue(Z,`diff-panel:${r}`,{compactPartialHunkOffsets:U===null}),[r,Z,U]),Mt=(0,P.useMemo)(()=>!Q||Q.kind!==`files`?[]:Q.files.toSorted((e,t)=>Ie(e).localeCompare(Ie(t),void 0,{numeric:!0,sensitivity:`base`})),[Q]),$=(0,P.useMemo)(()=>Mt.map(e=>{let t=Ve(e);return{fileDiff:e,filePath:Ie(e),fileKey:t,collapsed:pt.has(t)}}),[pt,Mt]),Nt=(0,P.useMemo)(()=>$.map(e=>e.fileKey),[$]),Pt=ue(Nt,pt),Ft=(0,P.useMemo)(()=>Re(Mt),[Mt]);(0,P.useEffect)(()=>{if(!ct)return;let e=$.find(e=>e.filePath===ct);e&&ze.current?.scrollTo({type:`item`,id:e.fileKey,align:`start`})},[$,ct,lt]);let It=me({threadRef:N,workspaceRoot:L??null}),Lt=(0,P.useCallback)(e=>{Je({threadRef:N,filePath:e,activeCwd:L,openFileSurface:It,openInEditor:e=>{(async()=>{let t=await $e(e);t._tag===`Failure`&&!oe(t)&&console.warn(`Failed to open diff file in editor.`,{operation:`open-diff-file`,...N?{environmentId:N.environmentId,threadId:N.threadId}:{},...re(m(t))})})()}})},[L,It,$e,N]),Rt=(0,P.useCallback)(e=>{Me(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]),zt=(0,P.useCallback)(()=>{Me(e=>{let t=e.scopeKey===J?e.fileKeys:ot;return{scopeKey:J,fileKeys:A(Nt,t)}})},[J,Nt]),Bt=e=>{N&&M.getState().selectTurn(N,e)},Vt=e=>{N&&M.getState().selectGitScope(N,e)},Ht=e=>{N&&M.getState().selectBranchBaseRef(N,e)};return(0,I.jsx)(xe,{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)(ne,{children:[(0,I.jsxs)(C,{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: ${dt}`,children:[(0,I.jsx)(`span`,{className:`truncate`,children:dt}),(0,I.jsx)(i,{className:`size-3.5 shrink-0 text-muted-foreground`})]}),(0,I.jsxs)(d,{align:`start`,className:`w-60`,children:[(0,I.jsx)(y,{className:U===null&&W===`unstaged`?`bg-foreground/[0.08]`:void 0,onClick:()=>Vt(`unstaged`),children:(0,I.jsx)(`span`,{children:`Working tree`})}),(0,I.jsx)(y,{className:U===null&&W===`branch`?`bg-foreground/[0.08]`:void 0,onClick:()=>Vt(`branch`),children:(0,I.jsx)(`span`,{children:`Branch changes`})}),(0,I.jsx)(y,{className:U!==null&&K?.turnId===ut?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>{ut&&Bt(ut.turnId)},children:(0,I.jsx)(`span`,{children:`Latest turn`})}),(0,I.jsxs)(T,{children:[(0,I.jsx)(_,{children:`Turn`}),(0,I.jsx)(te,{className:`w-64`,children:H.map(e=>{let t=e.checkpointTurnCount??B[e.turnId]??`?`;return(0,I.jsxs)(y,{className:e.turnId===K?.turnId?`bg-foreground/[0.08]`:void 0,onClick:()=>Bt(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:Ge(e.completedAt,a.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)(k,{className:`size-3.5 shrink-0 opacity-70`}),(0,I.jsxs)(je,{items:Tt,filteredItems:Et,value:G??V,onOpenChange:e=>{e||ce(``)},onValueChange:e=>{e&&Ht(e===V?null:e)},children:[(0,I.jsxs)(We,{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)(i,{className:`size-3.5 shrink-0 opacity-70`})]}),(0,I.jsxs)(Fe,{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)(ye,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1.5 left-0 size-4 shrink-0 text-muted-foreground/55`}),(0,I.jsx)(Le,{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:E,onChange:e=>ce(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)(we,{children:`No matching refs.`}),(0,I.jsxs)(Ee,{className:`max-h-64 min-w-0 overflow-x-hidden`,children:[(0,I.jsx)(He,{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`})}),St.map(e=>{let t=wt(e),n=e.local!==null&&e.remote!==null,r=e.remote?.name===t;return(0,I.jsx)(He,{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)(Be,{"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&&Ht(n)}})}):e.remote?(0,I.jsx)(`span`,{className:`flex justify-end text-muted-foreground`,title:`Remote only`,children:(0,I.jsx)(b,{"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)(ke,{additions:Ft.additions,deletions:Ft.deletions,className:`mr-1 text-[11px]`,layout:`inline`}),$.length>0&&(0,I.jsxs)(l,{children:[(0,I.jsx)(g,{render:(0,I.jsx)(u,{type:`button`,size:`icon-xs`,variant:`outline`,"aria-label":Pt?`Expand all files`:`Collapse all files`,onClick:zt}),children:Pt?(0,I.jsx)(Ae,{className:`size-3`}):(0,I.jsx)(Ce,{className:`size-3`})}),(0,I.jsx)(s,{side:`top`,children:Pt?`Expand all files`:`Collapse all files`})]}),(0,I.jsxs)(j,{className:`shrink-0`,variant:`outline`,size:`xs`,value:[h],onValueChange:e=>{let t=e[0];(t===`stacked`||t===`split`)&&v(t)},children:[(0,I.jsx)(fe,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,I.jsx)(le,{className:`size-3`})}),(0,I.jsx)(fe,{"aria-label":`Split diff view`,value:`split`,children:(0,I.jsx)(de,{className:`size-3`})})]}),(0,I.jsxs)(l,{children:[(0,I.jsx)(g,{render:(0,I.jsx)(fe,{"aria-label":S?`Disable diff line wrapping`:`Enable diff line wrapping`,variant:`outline`,size:`xs`,pressed:S,onPressedChange:e=>{ae(!!e)}}),children:(0,I.jsx)(he,{className:`size-3`})}),(0,I.jsx)(s,{side:`top`,children:S?`Disable line wrapping`:`Enable line wrapping`})]}),(0,I.jsxs)(l,{children:[(0,I.jsx)(g,{render:(0,I.jsx)(fe,{"aria-label":w?`Show whitespace changes`:`Hide whitespace changes`,variant:`outline`,size:`xs`,pressed:w,onPressedChange:e=>{se(!!e)}}),children:(0,I.jsx)(qe,{className:`size-3`})}),(0,I.jsx)(s,{side:`top`,children:w?`Show whitespace changes`:`Hide whitespace changes`})]})]})]}),children:F?tt?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:[Ot&&(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.`}),At&&!Q&&(0,I.jsx)(`div`,{className:`px-3`,children:(0,I.jsx)(`p`,{className:`mb-2 text-[11px] text-red-500/80`,children:At})}),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&&Lt(t)},children:(0,I.jsx)(Qe,{viewerRef:ze,className:`diff-render-surface h-full min-h-0 overflow-auto`,files:$,sectionId:ft,sectionTitle:mt,composerDraftTarget:t,renderHeaderPrefix:(e,t,n)=>{let r=Ie(e);return(0,I.jsxs)(l,{children:[(0,I.jsx)(g,{render:(0,I.jsx)(`button`,{type:`button`,className:x(`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`,Te(e)),"aria-label":n?`Expand ${r}`:`Collapse ${r}`,"aria-expanded":!n,onClick:e=>{e.stopPropagation(),Rt(t)}}),children:n?(0,I.jsx)(ie,{className:`size-4`}):(0,I.jsx)(i,{className:`size-4`})}),(0,I.jsx)(s,{side:`top`,children:n?`Expand diff`:`Collapse diff`})]})},options:{diffStyle:h===`split`?`split`:`unified`,lineDiffType:`none`,overflow:S?`wrap`:`scroll`,theme:De(r),themeType:r,unsafeCSS:st,stickyHeaders:!0,itemMetrics:{diffHeaderHeight:33},layout:{paddingTop:0,paddingBottom:8,gap:8}}},J??ft)}):(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:x(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,S?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:Q.text})]})}):kt?(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:jt?`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{Se as DiffWorkerPoolProvider,H as default};
98
+ //# sourceMappingURL=DiffPanel-L2u-0Rsl.js.map