diffhub 0.1.17 → 0.1.18

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 (31) hide show
  1. package/.next/standalone/apps/cli/.next/BUILD_ID +1 -1
  2. package/.next/standalone/apps/cli/.next/build-manifest.json +3 -3
  3. package/.next/standalone/apps/cli/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/apps/cli/.next/server/app/_global-error.html +1 -1
  5. package/.next/standalone/apps/cli/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/standalone/apps/cli/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/standalone/apps/cli/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/standalone/apps/cli/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/standalone/apps/cli/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/standalone/apps/cli/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/standalone/apps/cli/.next/server/app/_not-found.html +1 -1
  12. package/.next/standalone/apps/cli/.next/server/app/_not-found.rsc +1 -1
  13. package/.next/standalone/apps/cli/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  14. package/.next/standalone/apps/cli/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  15. package/.next/standalone/apps/cli/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  16. package/.next/standalone/apps/cli/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  17. package/.next/standalone/apps/cli/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  18. package/.next/standalone/apps/cli/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  19. package/.next/standalone/apps/cli/.next/server/app/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/apps/cli/.next/server/chunks/ssr/_07okxca._.js +3 -3
  21. package/.next/standalone/apps/cli/.next/server/middleware-build-manifest.js +3 -3
  22. package/.next/standalone/apps/cli/.next/server/pages/404.html +1 -1
  23. package/.next/standalone/apps/cli/.next/server/pages/500.html +1 -1
  24. package/.next/standalone/apps/cli/.next/server/server-reference-manifest.js +1 -1
  25. package/.next/standalone/apps/cli/.next/server/server-reference-manifest.json +1 -1
  26. package/.next/standalone/apps/cli/.next/static/chunks/{0qozxk3in_yip.js → 0_c51bp34uyv_.js} +3 -3
  27. package/.next/standalone/apps/cli/package.json +1 -1
  28. package/package.json +1 -1
  29. /package/.next/standalone/apps/cli/.next/static/{8rORhRJDOFN7qtGNAmPym → 97YS4C2mw92wvzoWra45x}/_buildManifest.js +0 -0
  30. /package/.next/standalone/apps/cli/.next/static/{8rORhRJDOFN7qtGNAmPym → 97YS4C2mw92wvzoWra45x}/_clientMiddlewareManifest.js +0 -0
  31. /package/.next/standalone/apps/cli/.next/static/{8rORhRJDOFN7qtGNAmPym → 97YS4C2mw92wvzoWra45x}/_ssgManifest.js +0 -0
@@ -13,7 +13,7 @@
13
13
 
14
14
  Please address the following:
15
15
 
16
- ${t.join("\n")}`})(ei);await navigator.clipboard.writeText(e),ey.current&&clearTimeout(ey.current),ed(!0),ey.current=setTimeout(()=>ed(!1),2e3)}catch{}},Q[1]=ei,Q[2]=n):n=Q[2];let eS=n;if(Q[3]===Symbol.for("react.memo_cache_sentinel")?(o=()=>eh(!1),Q[3]=o):o=Q[3],t=o,(J=(0,h.c)(5))[0]!==eb||J[1]!==t||J[2]!==em?(G=()=>{if(!em)return;let e=e=>{eb.current&&!eb.current.contains(e.target)&&t()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},Z=[eb,t,em],J[0]=eb,J[1]=t,J[2]=em,J[3]=G,J[4]=Z):(G=J[3],Z=J[4]),(0,b.useEffect)(G,Z),Q[4]!==et||Q[5]!==ee||Q[6]!==ef||Q[7]!==en||Q[8]!==er){let e,t,r,n,o,h,g,b,y,w,k,S,E,T,N,O,P,M,L,A,z,I,{className:D,label:_}="connecting"===en?{className:"bg-muted-foreground/50",label:"Connecting"}:"live"===en?{className:"bg-diff-green",label:"Live"}:{className:"bg-amber-500",label:"Polling"};R=_,s=lz,c=400,p="flex h-[52px] items-center gap-2 border-b border-border bg-card px-4 text-sm",Q[21]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)(lD,{render:(0,m.jsx)(lW,{className:"-ml-1"})}),Q[21]=e):e=Q[21],Q[22]===Symbol.for("react.memo_cache_sentinel")?(v=(0,m.jsxs)(lI,{children:[e,(0,m.jsxs)(l_,{side:"bottom",className:"flex items-center gap-2",children:[(0,m.jsx)("span",{children:"Toggle sidebar"}),(0,m.jsx)(e9,{children:"⌘B"})]})]}),Q[22]=v):v=Q[22],Q[23]!==ee?(t=(0,m.jsx)("button",{type:"button",onClick:()=>ek(ee,"branch"),className:"relative whitespace-nowrap rounded-md border border-border bg-background px-2.5 py-1 font-mono text-xs text-muted-foreground cursor-pointer hover:bg-secondary"}),Q[23]=ee,Q[24]=t):t=Q[24];let $="branch"===ef?"opacity-0":"opacity-100";Q[25]!==$?(r=((...e)=>e4(K(e)))("transition-opacity duration-150",$),Q[25]=$,Q[26]=r):r=Q[26],Q[27]!==ee?(n=lZ(ee),Q[27]=ee,Q[28]=n):n=Q[28],Q[29]!==r||Q[30]!==n?(o=(0,m.jsx)("span",{className:r,children:n}),Q[29]=r,Q[30]=n,Q[31]=o):o=Q[31];let B="branch"===ef?"opacity-100":"opacity-0";Q[32]!==B?(h=((...e)=>e4(K(e)))("absolute inset-0 flex items-center justify-center text-diff-green transition-opacity duration-150",B),Q[32]=B,Q[33]=h):h=Q[33],Q[34]===Symbol.for("react.memo_cache_sentinel")?(g=(0,m.jsx)(x,{size:14}),Q[34]=g):g=Q[34],Q[35]!==h?(b=(0,m.jsx)("span",{className:h,children:g}),Q[35]=h,Q[36]=b):b=Q[36],Q[37]!==t||Q[38]!==o||Q[39]!==b?(y=(0,m.jsxs)(lD,{render:t,children:[o,b]}),Q[37]=t,Q[38]=o,Q[39]=b,Q[40]=y):y=Q[40];let F="branch"===ef?"Copied!":"Click to copy";Q[41]!==F?(w=(0,m.jsx)(l_,{side:"bottom",children:F}),Q[41]=F,Q[42]=w):w=Q[42],Q[43]!==y||Q[44]!==w?(k=(0,m.jsxs)(lI,{children:[y,w]}),Q[43]=y,Q[44]=w,Q[45]=k):k=Q[45],Q[46]===Symbol.for("react.memo_cache_sentinel")?(S=(0,m.jsx)(C,{size:12,className:"text-muted-foreground/50 shrink-0"}),Q[46]=S):S=Q[46],Q[47]!==et?(E=(0,m.jsx)("button",{type:"button",onClick:()=>ek(et,"base"),className:"relative whitespace-nowrap rounded-md border border-border bg-background px-2.5 py-1 font-mono text-xs text-muted-foreground cursor-pointer hover:bg-secondary"}),Q[47]=et,Q[48]=E):E=Q[48];let H="base"===ef?"opacity-0":"opacity-100";Q[49]!==H?(T=((...e)=>e4(K(e)))("transition-opacity duration-150",H),Q[49]=H,Q[50]=T):T=Q[50],Q[51]!==et?(N=lZ(et),Q[51]=et,Q[52]=N):N=Q[52],Q[53]!==T||Q[54]!==N?(O=(0,m.jsx)("span",{className:T,children:N}),Q[53]=T,Q[54]=N,Q[55]=O):O=Q[55];let W="base"===ef?"opacity-100":"opacity-0";Q[56]!==W?(P=((...e)=>e4(K(e)))("absolute inset-0 flex items-center justify-center text-diff-green transition-opacity duration-150",W),Q[56]=W,Q[57]=P):P=Q[57],Q[58]===Symbol.for("react.memo_cache_sentinel")?(M=(0,m.jsx)(x,{size:14}),Q[58]=M):M=Q[58],Q[59]!==P?(L=(0,m.jsx)("span",{className:P,children:M}),Q[59]=P,Q[60]=L):L=Q[60],Q[61]!==E||Q[62]!==O||Q[63]!==L?(A=(0,m.jsxs)(lD,{render:E,children:[O,L]}),Q[61]=E,Q[62]=O,Q[63]=L,Q[64]=A):A=Q[64];let V="base"===ef?"Copied!":"Click to copy";Q[65]!==V?(z=(0,m.jsx)(l_,{side:"bottom",children:V}),Q[65]=V,Q[66]=z):z=Q[66],Q[67]!==A||Q[68]!==z?(I=(0,m.jsxs)(lI,{children:[A,z]}),Q[67]=A,Q[68]=z,Q[69]=I):I=Q[69],Q[70]!==k||Q[71]!==I?(j=(0,m.jsxs)("div",{className:"flex items-center gap-1.5",children:[k,S,I]}),Q[70]=k,Q[71]=I,Q[72]=j):j=Q[72],Q[73]===Symbol.for("react.memo_cache_sentinel")?(a=(0,m.jsx)("div",{className:"flex-1"}),Q[73]=a):a=Q[73],f="flex items-center gap-0.5",l=lI,i=lD,Q[74]===Symbol.for("react.memo_cache_sentinel")?(d=(0,m.jsx)("div",{className:"flex items-center pr-1.5"}),Q[74]=d):d=Q[74],u=((...e)=>e4(K(e)))("mx-1 size-1.5 rounded-full",D,er&&"animate-pulse"),Q[4]=et,Q[5]=ee,Q[6]=ef,Q[7]=en,Q[8]=er,Q[9]=i,Q[10]=l,Q[11]=s,Q[12]=a,Q[13]=c,Q[14]=u,Q[15]=d,Q[16]=f,Q[17]=p,Q[18]=v,Q[19]=j,Q[20]=R}else i=Q[9],l=Q[10],s=Q[11],a=Q[12],c=Q[13],u=Q[14],d=Q[15],f=Q[16],p=Q[17],v=Q[18],j=Q[19],R=Q[20];Q[75]!==u?(T=(0,m.jsx)("span",{className:u}),Q[75]=u,Q[76]=T):T=Q[76],Q[77]!==i||Q[78]!==T||Q[79]!==d?(N=(0,m.jsx)(i,{render:d,children:T}),Q[77]=i,Q[78]=T,Q[79]=d,Q[80]=N):N=Q[80],Q[81]!==R?(O=(0,m.jsx)(l_,{side:"bottom",children:R}),Q[81]=R,Q[82]=O):O=Q[82],Q[83]!==l||Q[84]!==N||Q[85]!==O?(P=(0,m.jsxs)(l,{children:[N,O]}),Q[83]=l,Q[84]=N,Q[85]=O,Q[86]=P):P=Q[86],Q[87]!==eo?(M=(0,m.jsx)(lJ,{syncNotice:eo}),Q[87]=eo,Q[88]=M):M=Q[88],Q[89]===Symbol.for("react.memo_cache_sentinel")?(L=()=>eh(l3),Q[89]=L):L=Q[89];let eE="uncommitted"===el?"Uncommitted":"All",eC=em&&"rotate-180";Q[90]!==eC?(A=((...e)=>e4(K(e)))("transition-transform duration-150",eC),Q[90]=eC,Q[91]=A):A=Q[91],Q[92]!==A?(z=(0,m.jsx)(y,{size:10,className:A}),Q[92]=A,Q[93]=z):z=Q[93],Q[94]!==eE||Q[95]!==z?(I=(0,m.jsxs)(e8,{variant:"ghost",size:"xs",onClick:L,className:"text-muted-foreground hover:text-foreground hover:bg-secondary gap-1",children:[eE,z]}),Q[94]=eE,Q[95]=z,Q[96]=I):I=Q[96],Q[97]!==el||Q[98]!==em||Q[99]!==es?(D=em&&(0,m.jsx)("div",{className:"absolute right-0 top-full mt-1 z-50 min-w-[200px] rounded-lg border border-border bg-card shadow-lg dark:shadow-none py-1 overflow-hidden",children:lG.map(e=>{let{value:t,label:r}=e;return(0,m.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between px-3 py-2 text-sm text-left hover:bg-secondary/50 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50",onClick:()=>{es(t),eh(!1)},children:[(0,m.jsx)("span",{className:((...e)=>e4(K(e)))("text-foreground",el===t&&"font-medium"),children:r}),el===t&&(0,m.jsx)(x,{size:14,className:"text-diff-green shrink-0"})]},t)})}),Q[97]=el,Q[98]=em,Q[99]=es,Q[100]=D):D=Q[100],Q[101]!==I||Q[102]!==D?(_=(0,m.jsxs)("div",{className:"relative",ref:eb,children:[I,D]}),Q[101]=I,Q[102]=D,Q[103]=_):_=Q[103],Q[104]!==ei.length||Q[105]!==eu||Q[106]!==eS?($=ei.length>0&&(0,m.jsxs)(lI,{children:[(0,m.jsxs)(lD,{render:(0,m.jsx)(e8,{variant:"ghost",size:"xs",onClick:eS,className:"text-muted-foreground hover:text-foreground hover:bg-secondary"}),children:[eu?(0,m.jsx)(x,{"data-icon":"inline-start"}):(0,m.jsx)(w,{"data-icon":"inline-start"}),eu?"Copied!":`Copy ${ei.length} comment${1===ei.length?"":"s"}`]}),(0,m.jsx)(l_,{side:"bottom",children:"Copy all comments as AI prompt"})]}),Q[104]=ei.length,Q[105]=eu,Q[106]=eS,Q[107]=$):$=Q[107],Q[108]!==ea||Q[109]!==ec?(B=(0,m.jsx)(e8,{variant:"ghost",size:"icon-xs",onClick:()=>ec("split"===ea?"stacked":"split"),className:"text-muted-foreground hover:text-foreground hover:bg-secondary"}),Q[108]=ea,Q[109]=ec,Q[110]=B):B=Q[110],Q[111]===Symbol.for("react.memo_cache_sentinel")?(F=(0,m.jsx)(E,{size:14}),Q[111]=F):F=Q[111],Q[112]!==B?(H=(0,m.jsx)(lD,{render:B,children:F}),Q[112]=B,Q[113]=H):H=Q[113];let ej="split"===ea?"Switch to unified view (S)":"Switch to split view (S)";return Q[114]!==ej?(W=(0,m.jsx)(l_,{side:"bottom",children:ej}),Q[114]=ej,Q[115]=W):W=Q[115],Q[116]!==H||Q[117]!==W?(V=(0,m.jsxs)(lI,{children:[H,W]}),Q[116]=H,Q[117]=W,Q[118]=V):V=Q[118],Q[119]!==eg||Q[120]!==ev||Q[121]!==ex?(U=eg&&(0,m.jsxs)(lI,{children:[(0,m.jsx)(lD,{render:(0,m.jsx)(e8,{variant:"ghost",size:"icon-xs",onClick:()=>ex("dark"===ev?"light":"dark"),className:"text-muted-foreground hover:text-foreground hover:bg-secondary"}),children:"dark"===ev?(0,m.jsx)(k,{size:14}):(0,m.jsx)(S,{size:14})}),(0,m.jsx)(l_,{side:"bottom",children:"dark"===ev?"Switch to light mode":"Switch to dark mode"})]}),Q[119]=eg,Q[120]=ev,Q[121]=ex,Q[122]=U):U=Q[122],Q[123]!==P||Q[124]!==M||Q[125]!==_||Q[126]!==$||Q[127]!==V||Q[128]!==U||Q[129]!==f?(q=(0,m.jsxs)("div",{className:f,children:[P,M,_,$,V,U]}),Q[123]=P,Q[124]=M,Q[125]=_,Q[126]=$,Q[127]=V,Q[128]=U,Q[129]=f,Q[130]=q):q=Q[130],Q[131]!==a||Q[132]!==q||Q[133]!==p||Q[134]!==v||Q[135]!==j?(X=(0,m.jsxs)("header",{className:p,children:[v,j,a,q]}),Q[131]=a,Q[132]=q,Q[133]=p,Q[134]=v,Q[135]=j,Q[136]=X):X=Q[136],Q[137]!==s||Q[138]!==c||Q[139]!==X?(Y=(0,m.jsx)(s,{delay:c,children:X}),Q[137]=s,Q[138]=c,Q[139]=X,Q[140]=Y):Y=Q[140],Y};function l1(){return lQ}function l2(){return!0}function l5(){return!1}function l3(e){return!e}let l4=v("BubbleDotsIcon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:2,d:"M4.002 7c0-1.6568 1.3431-3 3-3h9.9999c1.6569 0 3.0001 1.3431 3.0001 3v8.0358c0 1.6568-1.3432 3-3 3h-1.6263a1 1 0 0 0-.638.2299l-2.74 2.2701-2.7037-2.2664a1 1 0 0 0-.6424-.2336H7.0019c-1.6568 0-3-1.3432-3-3z"}),b.createElement("path",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"square",strokeWidth:.75,d:"M6.875 11.25a.875.875 0 1 0 1.75 0 .875.875 0 0 0-1.75 0Zm4.25 0a.875.875 0 1 0 1.7501-.0001.875.875 0 0 0-1.7501.0001Zm4.25 0a.875.875 0 1 0 1.7501-.0001.875.875 0 0 0-1.7501.0001Z"})))),l6=v("Folder1Icon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v9c0 1.6569 1.3431 3 3 3h12c1.6569 0 3-1.3431 3-3v-6c0-1.6569-1.3431-3-3-3h-4.9296a2 2 0 0 1-1.6641-.8906l-.8126-1.2188A2 2 0 0 0 8.9297 4H6C4.3431 4 3 5.3431 3 7"})))),l7=v("FolderOpenFilledIcon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 3C3.7909 3 2 4.7909 2 7v10.5592C2 18.9072 3.0928 20 4.4408 20H18.045a3.0002 3.0002 0 0 0 2.8487-2.1052l1.6557-5.2983c.3657-1.1701-.3952-2.3574-1.5494-2.5647V9c0-1.6569-1.3431-3-3-3h-4.9296a1 1 0 0 1-.8321-.4453l-.5157-.7735A4 4 0 0 0 8.3945 3zm13 7V9c0-.5523-.4477-1-1-1h-4.9296a3 3 0 0 1-2.4962-1.3359l-.5157-.7735A2 2 0 0 0 8.3945 5H6c-1.1046 0-2 .8954-2 2v10.5592a.4407.4407 0 0 0 .8615.1315l1.7454-5.5855A3 3 0 0 1 9.4704 10z",clipRule:"evenodd"})))),l8=v("MagnifyingGlassIcon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeWidth:2,d:"m20 20-3.95-3.95M18 11c0 3.866-3.134 7-7 7s-7-3.134-7-7 3.134-7 7-7 7 3.134 7 7Z"})))),l9=e=>{let t,r,n,o,i=(0,h.c)(7);i[0]!==e?({size:r,...t}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]);let l=void 0===r?16:r;return i[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("path",{d:"M1 1.75C1 .784 1.784 0 2.75 0h7.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25V4.664a.25.25 0 0 0-.073-.177l-2.914-2.914a.25.25 0 0 0-.177-.073ZM8 3.25a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0V7h-1.5a.75.75 0 0 1 0-1.5h1.5V4A.75.75 0 0 1 8 3.25Zm-3 8a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Z"}),i[3]=n):n=i[3],i[4]!==t||i[5]!==l?(o=(0,m.jsx)("svg",{viewBox:"0 0 16 16",width:l,height:l,fill:"currentColor","aria-hidden":"true",focusable:"false",...t,children:n}),i[4]=t,i[5]=l,i[6]=o):o=i[6],o},se=e=>{let t,r,n,o,i=(0,h.c)(7);i[0]!==e?({size:r,...t}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]);let l=void 0===r?16:r;return i[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("path",{d:"M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V4.664a.25.25 0 0 0-.073-.177l-2.914-2.914a.25.25 0 0 0-.177-.073Zm4.48 3.758a.75.75 0 0 1 .755.745l.01 1.497h1.497a.75.75 0 0 1 0 1.5H9v1.507a.75.75 0 0 1-1.5 0V9.005l-1.502.01a.75.75 0 0 1-.01-1.5l1.507-.01-.01-1.492a.75.75 0 0 1 .745-.755Z"}),i[3]=n):n=i[3],i[4]!==t||i[5]!==l?(o=(0,m.jsx)("svg",{viewBox:"0 0 16 16",width:l,height:l,fill:"currentColor","aria-hidden":"true",focusable:"false",...t,children:n}),i[4]=t,i[5]=l,i[6]=o):o=i[6],o},st=e=>{let t,r,n,o,i=(0,h.c)(7);i[0]!==e?({size:r,...t}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]);let l=void 0===r?16:r;return i[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("path",{d:"M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V4.664a.25.25 0 0 0-.073-.177l-2.914-2.914a.25.25 0 0 0-.177-.073Zm4.5 6h2.242a.75.75 0 0 1 0 1.5h-2.24l-2.254.015a.75.75 0 0 1-.01-1.5Z"}),i[3]=n):n=i[3],i[4]!==t||i[5]!==l?(o=(0,m.jsx)("svg",{viewBox:"0 0 16 16",width:l,height:l,fill:"currentColor","aria-hidden":"true",focusable:"false",...t,children:n}),i[4]=t,i[5]=l,i[6]=o):o=i[6],o},sr="diffhub:file-tree:expand-all",sn="diffhub:file-tree:collapse-all",so=e=>e.map(e=>{if("file"===e.type)return e;let t=so(e.children);if(1===t.length&&"folder"===t[0].type){let r=t[0];return{...r,name:`${e.name}/${r.name}`}}return{...e,children:t}}),si=(e,t=[])=>{for(let r of e)"folder"===r.type&&(t.push(r.path),si(r.children,t));return t},sl=(0,b.memo)(function(e){let t,r,n,o,i,l,s,a,c,u,d=(0,h.c)(30),{node:f,depth:p,isSelected:g,commentCount:b,onNavigate:v}=e,x=16*p+8,{insertions:y,deletions:w}=f.fileStat,k=l9;y>0&&0===w?k=se:w>0&&0===y&&(k=st);let S="shrink-0 text-sidebar-foreground/40";y>0&&0===w?S="shrink-0 text-diff-green":w>0&&0===y&&(S="shrink-0 text-destructive");let E=g?"true":void 0,C=g?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground";d[0]!==C?(t=((...e)=>e4(K(e)))("flex w-full cursor-pointer items-center gap-1.5 py-1 text-left transition-colors",C),d[0]=C,d[1]=t):t=d[1];let j=g?"true":void 0;return d[2]!==x?(r={containIntrinsicBlockSize:"26px",contentVisibility:"auto",paddingLeft:x,paddingRight:8},d[2]=x,d[3]=r):r=d[3],d[4]!==f.path||d[5]!==v?(n=()=>v(f.path),d[4]=f.path,d[5]=v,d[6]=n):n=d[6],d[7]!==k||d[8]!==S?(o=(0,m.jsx)(k,{size:16,className:S}),d[7]=k,d[8]=S,d[9]=o):o=d[9],d[10]===Symbol.for("react.memo_cache_sentinel")?(i=(0,m.jsx)("span",{className:"flex-1 truncate text-[12px] leading-tight text-muted-foreground"}),d[10]=i):i=d[10],d[11]!==f.name?(l=(0,m.jsx)(lD,{render:i,children:f.name}),d[11]=f.name,d[12]=l):l=d[12],d[13]!==f.path?(s=(0,m.jsx)(l_,{side:"right",children:f.path}),d[13]=f.path,d[14]=s):s=d[14],d[15]!==s||d[16]!==l?(a=(0,m.jsxs)(lI,{children:[l,s]}),d[15]=s,d[16]=l,d[17]=a):a=d[17],d[18]!==b?(c=b>0&&(0,m.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 text-[10px] text-sidebar-foreground/50",children:[(0,m.jsx)(l4,{size:10}),b]}),d[18]=b,d[19]=c):c=d[19],d[20]!==f.path||d[21]!==E||d[22]!==a||d[23]!==c||d[24]!==t||d[25]!==j||d[26]!==r||d[27]!==n||d[28]!==o?(u=(0,m.jsxs)("button",{type:"button","aria-current":E,className:t,"data-file-path":f.path,"data-selected":j,style:r,onClick:n,children:[o,a,c]}),d[20]=f.path,d[21]=E,d[22]=a,d[23]=c,d[24]=t,d[25]=j,d[26]=r,d[27]=n,d[28]=o,d[29]=u):u=d[29],u}),ss=(0,b.memo)(function(e){let t,r,n,o,i,l,s,a,c,u,d,f,p,g,v,x,y,w=(0,h.c)(50),{node:k,depth:S,isCollapsed:E,onToggle:C,children:j}=e,R=16*S+8;if(w[0]!==R||w[1]!==E||w[2]!==k.name||w[3]!==k.path||w[4]!==C){let e=(d=e6(k.name)).split("/");i="button",l=!E,s="flex w-full items-center gap-1.5 py-1 text-left transition-colors hover:bg-sidebar-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-ring",w[16]!==R?(a={paddingLeft:R,paddingRight:8},w[16]=R,w[17]=a):a=w[17],w[18]!==k.path||w[19]!==C?(c=()=>C(k.path),w[18]=k.path,w[19]=C,w[20]=c):c=w[20],w[21]!==E?(u=E?(0,m.jsx)(l6,{size:16,className:"shrink-0 text-sidebar-foreground/50"}):(0,m.jsx)(l7,{size:16,className:"shrink-0 text-sidebar-foreground/50"}),w[21]=E,w[22]=u):u=w[22],r=lI,t=lD,w[23]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("span",{className:"truncate text-[12px] text-muted-foreground"}),w[23]=n):n=w[23],o=e.map((t,r)=>{let n=e.slice(0,r+1).join("/");return(0,m.jsxs)(b.Fragment,{children:[t,r<e.length-1&&(0,m.jsx)("span",{className:"text-sidebar-foreground/30",children:"/"})]},n)}),w[0]=R,w[1]=E,w[2]=k.name,w[3]=k.path,w[4]=C,w[5]=t,w[6]=r,w[7]=n,w[8]=o,w[9]=i,w[10]=l,w[11]=s,w[12]=a,w[13]=c,w[14]=u,w[15]=d}else t=w[5],r=w[6],n=w[7],o=w[8],i=w[9],l=w[10],s=w[11],a=w[12],c=w[13],u=w[14],d=w[15];return w[24]!==t||w[25]!==n||w[26]!==o?(f=(0,m.jsx)(t,{render:n,children:o}),w[24]=t,w[25]=n,w[26]=o,w[27]=f):f=w[27],w[28]!==k.name||w[29]!==d?(p=k.name!==d&&(0,m.jsx)(l_,{side:"right",children:k.name}),w[28]=k.name,w[29]=d,w[30]=p):p=w[30],w[31]!==r||w[32]!==p||w[33]!==f?(g=(0,m.jsxs)(r,{children:[f,p]}),w[31]=r,w[32]=p,w[33]=f,w[34]=g):g=w[34],w[35]!==g||w[36]!==i||w[37]!==l||w[38]!==s||w[39]!==a||w[40]!==c||w[41]!==u?(v=(0,m.jsxs)("button",{type:i,"aria-expanded":l,className:s,style:a,onClick:c,children:[u,g]}),w[35]=g,w[36]=i,w[37]=l,w[38]=s,w[39]=a,w[40]=c,w[41]=u,w[42]=v):v=w[42],w[43]!==j||w[44]!==R||w[45]!==E?(x=!E&&(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)("div",{className:"pointer-events-none absolute inset-y-0 border-l border-sidebar-border/60",style:{left:R+8}}),j]}),w[43]=j,w[44]=R,w[45]=E,w[46]=x):x=w[46],w[47]!==v||w[48]!==x?(y=(0,m.jsxs)(m.Fragment,{children:[v,x]}),w[47]=v,w[48]=x,w[49]=y):y=w[49],y}),sa=(0,b.memo)(function e({nodes:t,depth:r,selectedFile:n,commentsByFile:o,collapsedFolders:i,onToggleFolder:l,onNavigate:s}){return t.map(t=>"folder"===t.type?(0,m.jsx)(ss,{node:t,depth:r,isCollapsed:i.has(t.path),onToggle:l,children:(0,m.jsx)(e,{nodes:t.children,depth:r+1,selectedFile:n,commentsByFile:o,collapsedFolders:i,onToggleFolder:l,onNavigate:s})},t.path):(0,m.jsx)(sl,{node:t,depth:r,isSelected:n===t.path,commentCount:o.get(t.path)??0,onNavigate:s},t.path))}),sc=e=>{let t,r,n,o,i,l,s,a,c,u,d,f,p,g,v,x,y,w,k,S,E,C,j,R,T,N=(0,h.c)(65),{files:O,selectedFile:P,onSelectFile:M,comments:L,filterQuery:A,onFilterChange:z,isLoading:I,insertions:D,deletions:_,sidebarWidth:$,onSidebarWidthChange:B}=e;N[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Set,N[0]=t):t=N[0];let[F,H]=(0,b.useState)(t),W=(0,b.useRef)(null);N[1]!==B?(r=()=>{let e=()=>{W.current=null,document.body.style.cursor="",document.body.style.userSelect=""},t=e=>{W.current&&B(Math.max(8,W.current.startWidth+e.clientX-W.current.startX))},r=()=>{W.current&&e()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",r),window.addEventListener("blur",r),()=>{e(),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),window.removeEventListener("blur",r)}},n=[B],N[1]=B,N[2]=r,N[3]=n):(r=N[2],n=N[3]),(0,b.useEffect)(r,n),N[4]!==$?(o=e=>{e.preventDefault(),W.current={startWidth:$,startX:e.clientX},document.body.style.cursor="col-resize",document.body.style.userSelect="none"},N[4]=$,N[5]=o):o=N[5];let V=o;N[6]!==O||N[7]!==A?(i=A?O.filter(e=>e.file.toLowerCase().includes(A.toLowerCase())):O,N[6]=O,N[7]=A,N[8]=i):i=N[8];let U=i;N[9]!==U?(l=so((e=>{let t={files:[],folders:{}};for(let r of e){let e=r.file.split("/"),n=t;for(let t=0;t<e.length-1;t+=1){let r=e[t];n.folders[r]||(n.folders[r]={files:[],folders:{}}),n=n.folders[r]}n.files.push(r)}let r=(e,t,n)=>{let o=n?`${n}/${e}`:e,i=[];for(let[e,n]of Object.entries(t.folders).toSorted())i.push(r(e,n,o));for(let e of t.files){let t=e.file.split("/");i.push({fileStat:e,name:t.at(-1)??e.file,path:e.file,type:"file"})}return{children:i,name:e,path:o,type:"folder"}},n=[];for(let[e,o]of Object.entries(t.folders).toSorted())n.push(r(e,o,""));for(let e of t.files)n.push({fileStat:e,name:e.file,path:e.file,type:"file"});return n})(U)),N[9]=U,N[10]=l):l=N[10];let q=l;N[11]!==q?(s=si(q),N[11]=q,N[12]=s):s=N[12];let K=s;if(N[13]!==K?(c=()=>{let e=()=>{H(new Set)},t=()=>{H(new Set(K))};return window.addEventListener(sr,e),window.addEventListener(sn,t),()=>{window.removeEventListener(sr,e),window.removeEventListener(sn,t)}},a=[K],N[13]=K,N[14]=a,N[15]=c):(a=N[14],c=N[15]),(0,b.useEffect)(c,a),N[16]!==L){for(let e of(u=new Map,L))u.set(e.file,(u.get(e.file)??0)+1);N[16]=L,N[17]=u}else u=N[17];let X=u;N[18]===Symbol.for("react.memo_cache_sentinel")?(d=e=>{H(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},N[18]=d):d=N[18];let Y=d;N[19]!==M?(f=e=>{let t=new CustomEvent("diffhub:file:navigate",{cancelable:!0,detail:{file:e,source:"sidebar"}});window.dispatchEvent(t)&&M(e,"auto")},N[19]=M,N[20]=f):f=N[20];let G=f;if(void 0!==I&&I){let e;N[21]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:(0,m.jsx)("p",{className:"animate-pulse text-xs text-sidebar-foreground/50",children:"Loading…"})}),N[21]=e):e=N[21],p=e}else if(0===U.length){let e,t,r;N[22]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("p",{className:"text-xs text-sidebar-foreground/50",children:"No changes"}),N[22]=e):e=N[22],N[23]!==A?(t=A&&(0,m.jsxs)("p",{className:"text-[10px] text-sidebar-foreground/30",children:["No files match “",A,"”"]}),N[23]=A,N[24]=t):t=N[24],N[25]!==t?(r=(0,m.jsxs)("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[e,t]}),N[25]=t,N[26]=r):r=N[26],p=r}else{let e;N[27]!==F||N[28]!==X||N[29]!==G||N[30]!==P||N[31]!==q?(e=(0,m.jsx)(sa,{nodes:q,depth:0,selectedFile:P,commentsByFile:X,collapsedFolders:F,onToggleFolder:Y,onNavigate:G}),N[27]=F,N[28]=X,N[29]=G,N[30]=P,N[31]=q,N[32]=e):e=N[32],p=e}N[33]===Symbol.for("react.memo_cache_sentinel")?(g=(0,m.jsx)(l8,{size:12,className:"pointer-events-none absolute left-2.5 text-sidebar-foreground/40"}),N[33]=g):g=N[33],N[34]!==z?(v=e=>z(e.target.value),N[34]=z,N[35]=v):v=N[35],N[36]!==A||N[37]!==v?(x=(0,m.jsx)("input",{type:"text",value:A,onChange:v,placeholder:"Filter files…","aria-label":"Filter files",className:"w-full rounded-md border border-sidebar-border bg-sidebar-accent py-1.5 pl-7 pr-7 text-xs text-sidebar-foreground placeholder:text-sidebar-foreground/40 transition-colors focus:border-sidebar-ring/50 focus:outline-none"}),N[36]=A,N[37]=v,N[38]=x):x=N[38],N[39]!==A||N[40]!==z?(y=A&&(0,m.jsx)("button",{type:"button",onClick:()=>z(""),"aria-label":"Clear filter",className:"absolute right-2 text-sm leading-none text-sidebar-foreground/40 transition-colors hover:text-sidebar-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-ring",children:"×"}),N[39]=A,N[40]=z,N[41]=y):y=N[41],N[42]!==x||N[43]!==y?(w=(0,m.jsx)(lU,{className:"border-b border-sidebar-border h-[52px] flex-row items-center py-0 px-2",children:(0,m.jsxs)("div",{className:"relative flex w-full items-center",children:[g,x,y]})}),N[42]=x,N[43]=y,N[44]=w):w=N[44],N[45]!==p?(k=(0,m.jsx)(lK,{className:"gap-0 py-1",children:p}),N[45]=p,N[46]=k):k=N[46];let Z=1===O.length?"file":"files";return N[47]!==O.length||N[48]!==Z?(S=(0,m.jsxs)("span",{children:[O.length," ",Z]}),N[47]=O.length,N[48]=Z,N[49]=S):S=N[49],N[50]!==D?(E=D>0&&(0,m.jsxs)("span",{className:"text-diff-green",children:["+",D]}),N[50]=D,N[51]=E):E=N[51],N[52]!==_?(C=_>0&&(0,m.jsxs)("span",{className:"text-destructive",children:["−",_]}),N[52]=_,N[53]=C):C=N[53],N[54]!==S||N[55]!==E||N[56]!==C?(j=(0,m.jsx)(lq,{className:"border-t border-sidebar-border px-3 py-2",children:(0,m.jsxs)("div",{className:"flex items-center gap-2 text-[12px] font-mono text-sidebar-foreground/60",children:[S,E,C]})}),N[54]=S,N[55]=E,N[56]=C,N[57]=j):j=N[57],N[58]!==V?(R=(0,m.jsx)("div",{"aria-hidden":!0,className:"absolute inset-y-0 right-0 z-20 w-[5px] cursor-col-resize after:absolute after:inset-y-0 after:left-1/2 after:-translate-x-1/2 after:w-px after:transition-colors hover:after:bg-sidebar-border",onMouseDown:V}),N[58]=V,N[59]=R):R=N[59],N[60]!==w||N[61]!==k||N[62]!==j||N[63]!==R?(T=(0,m.jsx)(lz,{delay:400,children:(0,m.jsxs)(lH,{collapsible:"offcanvas",className:"overflow-hidden border-r border-sidebar-border",children:[w,k,j,R]})}),N[60]=w,N[61]=k,N[62]=j,N[63]=R,N[64]=T):T=N[64],T};var su=e.i(70703),sd=b;let sf={dark:{addition:"#3fb950",deletion:"#f85149"},light:{addition:"#1a7f37",deletion:"#d1242f"}},sp={dark:{additionBg:"#2ea04326",additionBgNumber:"#3fb9504d",additionEmphasis:"#2ea04366",deletionBg:"#f851491a",deletionBgNumber:"#f851494d",deletionEmphasis:"#f8514966"},light:{additionBg:"#dafbe1",additionBgNumber:"#aceebb",additionEmphasis:"#aceebb",deletionBg:"#ffebe9",deletionBgNumber:"#ffcecb",deletionEmphasis:"#ffcecb"}},sm=e=>{let t,r,n,o,i,l,s,a,c=(0,h.c)(22),{value:u,label:d,copiedLabel:f,delay:p,className:g}=e,v=void 0===d?"Copy file path":d,y=void 0===f?"Copied!":f,k=void 0===p?400:p,[S,E]=(0,b.useState)(!1);c[0]!==u?(t=async()=>{try{await navigator.clipboard.writeText(u),E(!0),setTimeout(()=>E(!1),1500)}catch{}},c[0]=u,c[1]=t):t=c[1];let C=t,j=S?y:v,R=S?"text-diff-green":"text-muted-foreground hover:text-foreground hover:bg-secondary";c[2]!==g||c[3]!==R?(r=((...e)=>e4(K(e)))("size-6",R,g),c[2]=g,c[3]=R,c[4]=r):r=c[4],c[5]!==C||c[6]!==j||c[7]!==r?(n=(0,m.jsx)(e8,{variant:"ghost",size:"icon-xs",onClick:C,"aria-label":j,className:r}),c[5]=C,c[6]=j,c[7]=r,c[8]=n):n=c[8],c[9]!==S?(o=S?(0,m.jsx)(x,{size:12}):(0,m.jsx)(w,{size:12}),c[9]=S,c[10]=o):o=c[10],c[11]!==n||c[12]!==o?(i=(0,m.jsx)(lD,{render:n,children:o}),c[11]=n,c[12]=o,c[13]=i):i=c[13];let T=S?y:v;return c[14]!==T?(l=(0,m.jsx)(l_,{side:"bottom",children:T}),c[14]=T,c[15]=l):l=c[15],c[16]!==i||c[17]!==l?(s=(0,m.jsxs)(lI,{children:[i,l]}),c[16]=i,c[17]=l,c[18]=s):s=c[18],c[19]!==k||c[20]!==s?(a=(0,m.jsx)(lz,{delay:k,children:s}),c[19]=k,c[20]=s,c[21]=a):a=c[21],a},sh=e=>{let t,r,n,o,i,l,s,a,c,u,d,f,p,g,b,v,x,w,k,S,E,C,j,R,T,N=(0,h.c)(64),{file:O,insertions:P,deletions:M,commentCount:L,repoPath:A,collapsed:z,active:I,onToggleCollapse:D,headingId:_,panelId:$}=e,B=void 0!==z&&z;if(N[0]!==O){let e=(n=e6(O)).lastIndexOf("/");t=-1===e?"":n.slice(0,e),r=-1===e?n:n.slice(e+1),N[0]=O,N[1]=t,N[2]=r,N[3]=n}else t=N[1],r=N[2],n=N[3];let F=r;N[4]!==O||N[5]!==D?(o=()=>{D?D():window.dispatchEvent(new CustomEvent("diffhub:file:toggle-collapse",{detail:{file:O}}))},N[4]=O,N[5]=D,N[6]=o):o=N[6];let H=o,W=void 0!==I&&I?"true":void 0,V=B?"collapsed":"expanded",U=!B,q=B?"Expand file section":"Collapse file section";N[7]!==H||N[8]!==$||N[9]!==U||N[10]!==q?(i=(0,m.jsx)(e8,{variant:"ghost",size:"icon-xs",onClick:H,"aria-expanded":U,"aria-controls":$,"aria-label":q,className:"text-muted-foreground hover:bg-transparent active:bg-transparent aria-expanded:bg-transparent"}),N[7]=H,N[8]=$,N[9]=U,N[10]=q,N[11]=i):i=N[11];let X=B&&"-rotate-90";N[12]!==X?(l=((...e)=>e4(K(e)))("transition-transform duration-150",X),N[12]=X,N[13]=l):l=N[13],N[14]!==l?(s=(0,m.jsx)(y,{size:14,className:l}),N[14]=l,N[15]=s):s=N[15],N[16]!==s||N[17]!==i?(a=(0,m.jsx)(lD,{render:i,children:s}),N[16]=s,N[17]=i,N[18]=a):a=N[18];let Y=B?"Expand file section":"Collapse file section";N[19]!==Y?(c=(0,m.jsx)(l_,{side:"bottom",children:Y}),N[19]=Y,N[20]=c):c=N[20],N[21]!==a||N[22]!==c?(u=(0,m.jsxs)(lI,{children:[a,c]}),N[21]=a,N[22]=c,N[23]=u):u=N[23],N[24]===Symbol.for("react.memo_cache_sentinel")?(d=(0,m.jsx)("span",{className:"flex min-w-0 items-center gap-1"}),N[24]=d):d=N[24],N[25]!==t?(f=t&&(0,m.jsxs)("span",{className:"text-muted-foreground truncate shrink",children:[t,"/"]}),N[25]=t,N[26]=f):f=N[26],N[27]!==F?(p=(0,m.jsx)("span",{className:"text-muted-foreground font-normal shrink-0",children:F}),N[27]=F,N[28]=p):p=N[28],N[29]!==f||N[30]!==p?(g=(0,m.jsxs)("span",{className:"flex min-w-0 items-baseline gap-0 font-mono",children:[f,p]}),N[29]=f,N[30]=p,N[31]=g):g=N[31];let G=`${A}/${O}`;return N[32]!==G?(b=(0,m.jsx)(sm,{value:G}),N[32]=G,N[33]=b):b=N[33],N[34]!==g||N[35]!==b?(v=(0,m.jsxs)(lD,{render:d,children:[g,b]}),N[34]=g,N[35]=b,N[36]=v):v=N[36],N[37]!==O||N[38]!==n?(x=O!==n&&(0,m.jsx)(l_,{side:"bottom",children:O}),N[37]=O,N[38]=n,N[39]=x):x=N[39],N[40]!==v||N[41]!==x?(w=(0,m.jsxs)(lI,{children:[v,x]}),N[40]=v,N[41]=x,N[42]=w):w=N[42],N[43]!==P?(k=P>0&&(0,m.jsxs)("span",{className:"font-mono text-[12px] text-diff-green",children:["+",P]}),N[43]=P,N[44]=k):k=N[44],N[45]!==M?(S=M>0&&(0,m.jsxs)("span",{className:"font-mono text-[12px] text-destructive",children:["−",M]}),N[45]=M,N[46]=S):S=N[46],N[47]!==k||N[48]!==S?(E=(0,m.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[k,S]}),N[47]=k,N[48]=S,N[49]=E):E=N[49],N[50]!==w||N[51]!==E?(C=(0,m.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[w,E]}),N[50]=w,N[51]=E,N[52]=C):C=N[52],N[53]!==_||N[54]!==u||N[55]!==C?(j=(0,m.jsxs)("h3",{id:_,className:"flex min-w-0 flex-1 items-center gap-2 text-[12px] font-normal",children:[u,C]}),N[53]=_,N[54]=u,N[55]=C,N[56]=j):j=N[56],N[57]!==L?(R=L>0&&(0,m.jsxs)("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full bg-diff-purple/10 text-diff-purple text-[10px] shrink-0",children:[(0,m.jsx)(l4,{size:10}),L]}),N[57]=L,N[58]=R):R=N[58],N[59]!==j||N[60]!==R||N[61]!==W||N[62]!==V?(T=(0,m.jsx)(lz,{delay:400,children:(0,m.jsxs)("div",{"data-active":W,"data-state":V,className:"flex items-center gap-2 px-3 h-9 border-b border-border bg-card sticky top-[52px] z-10",children:[j,R]})}),N[59]=j,N[60]=R,N[61]=W,N[62]=V,N[63]=T):T=N[63],T},sg=v("BranchIcon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("circle",{cx:6.5,cy:6,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),b.createElement("circle",{cx:6.5,cy:18,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),b.createElement("circle",{cx:17.5,cy:6,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),b.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6.5 8v8M17.5 8v1c0 1.6569-1.3431 3-3 3h-5c-1.6569 0-3 1.3431-3 3v1"})))),sb=v("TrashCan2Icon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 6v12c0 1.6569 1.3431 3 3 3h6c1.6569 0 3-1.3431 3-3V6M6 6h12M6 6H4m14 0h2M9 6c0-1.6569 1.3431-3 3-3s3 1.3431 3 3m-1 5v5m-4-5v5"})))),sv=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg border-dashed p-6 text-center md:p-12",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sx=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("flex max-w-sm flex-col items-center gap-2 text-center",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty-header",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sy=Y("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{defaultVariants:{variant:"default"},variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}}}),sw=e=>{let t,r,n,o,i,l=(0,h.c)(11);l[0]!==e?({className:t,variant:n,...r}=e,l[0]=e,l[1]=t,l[2]=r,l[3]=n):(t=l[1],r=l[2],n=l[3]);let s=void 0===n?"default":n;return l[4]!==t||l[5]!==s?(o=((...e)=>e4(K(e)))(sy({className:t,variant:s})),l[4]=t,l[5]=s,l[6]=o):o=l[6],l[7]!==r||l[8]!==o||l[9]!==s?(i=(0,m.jsx)("div",{className:o,"data-slot":"empty-icon","data-variant":s,...r}),l[7]=r,l[8]=o,l[9]=s,l[10]=i):i=l[10],i},sk=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("font-medium text-lg tracking-tight",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty-title",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sS=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("text-muted-foreground text-sm/relaxed [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty-description",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sE=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("flex w-full min-w-0 max-w-sm flex-col items-center gap-4 text-balance text-sm",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty-content",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sC={"[must-fix]":{border:"border-l-destructive",text:"text-destructive"},"[nit]":{border:"border-l-muted-foreground/40",text:"text-muted-foreground"},"[question]":{border:"border-l-diff-purple",text:"text-diff-purple"},"[suggestion]":{border:"border-l-diff-green",text:"text-diff-green"}},sj=[],sR=null,sT=null,sN=0,sO=()=>{let e,t,r,n,o,i,l,s,a,c,u,d=(0,h.c)(11);return d[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("div",{className:"h-9 border-b border-border bg-card"}),d[0]=e):e=d[0],d[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-diff-green/20"}),d[1]=t):t=d[1],d[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-diff-green/5",children:[t,(0,m.jsx)("div",{className:"h-2 rounded bg-diff-green/15",style:{width:"67%"}})]}),d[2]=r):r=d[2],d[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-muted"}),d[3]=n):n=d[3],d[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3",children:[n,(0,m.jsx)("div",{className:"h-2 rounded bg-muted",style:{width:"82%"}})]}),d[4]=o):o=d[4],d[5]===Symbol.for("react.memo_cache_sentinel")?(i=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-destructive/20"}),d[5]=i):i=d[5],d[6]===Symbol.for("react.memo_cache_sentinel")?(l=(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-destructive/5",children:[i,(0,m.jsx)("div",{className:"h-2 rounded bg-destructive/15",style:{width:"54%"}})]}),d[6]=l):l=d[6],d[7]===Symbol.for("react.memo_cache_sentinel")?(s=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-muted"}),d[7]=s):s=d[7],d[8]===Symbol.for("react.memo_cache_sentinel")?(a=(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3",children:[s,(0,m.jsx)("div",{className:"h-2 rounded bg-muted",style:{width:"78%"}})]}),d[8]=a):a=d[8],d[9]===Symbol.for("react.memo_cache_sentinel")?(c=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-diff-green/20"}),d[9]=c):c=d[9],d[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,m.jsxs)("div",{className:"animate-pulse",children:[e,(0,m.jsxs)("div",{children:[r,o,l,a,(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-diff-green/5",children:[c,(0,m.jsx)("div",{className:"h-2 rounded bg-diff-green/15",style:{width:"91%"}})]})]})]}),d[10]=u):u=d[10],u},sP=e=>{let t,r,n,o,i=(0,h.c)(12),{onRender:l,variant:s,changes:a}=e,c="large"===s;i[0]!==l?(t=(0,m.jsx)(e8,{size:"sm",variant:"default",onClick:l,children:"Load diff"}),i[0]=l,i[1]=t):t=i[1];let u=c?"Large diffs are not rendered by default.":"Diff rendering is deferred until this file becomes active or visible.";return i[2]!==u?(r=(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:u}),i[2]=u,i[3]=r):r=i[3],i[4]!==a||i[5]!==c?(n=c&&void 0!==a?(0,m.jsxs)("p",{className:"text-xs text-muted-foreground/70",children:[a.toLocaleString()," changed lines"]}):null,i[4]=a,i[5]=c,i[6]=n):n=i[6],i[7]!==t||i[8]!==r||i[9]!==n||i[10]!==s?(o=(0,m.jsxs)("div",{className:"mx-4 my-4 flex flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border bg-muted/20 p-6","data-testid":"deferred-diff-placeholder","data-variant":s,children:[t,r,n]}),i[7]=t,i[8]=r,i[9]=n,i[10]=s,i[11]=o):o=i[11],o};class sM extends sd.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("[diffhub] PatchDiff threw",{componentStack:t.componentStack,error:e.message,file:this.props.file})}render(){return this.state.error?(0,m.jsxs)("div",{className:"px-4 py-6 text-sm text-destructive",children:["Failed to render diff for this file: ",this.state.error.message]}):this.props.children}}let sL=(0,su.default)(()=>e.A(15910).then(e=>({default:e.PatchDiff})).catch(e=>(console.error("[diffhub] Failed to load PatchDiff",e),{default:()=>(0,m.jsxs)("div",{className:"p-4 text-destructive text-sm",children:["Failed to load diff viewer: ",String(e)]})})),{loadableGenerated:{modules:[11251]},loading:()=>(0,m.jsx)(sO,{}),ssr:!1}),sA=e=>{let t,r,n,o,i,l,s,a,c,u,d,f=(0,h.c)(32),{onSubmit:p,onCancel:g}=e,[b,v]=(0,sd.useState)(""),[x,y]=(0,sd.useState)(null),[w,k]=(0,sd.useState)(!1);f[0]!==b||f[1]!==w||f[2]!==p?(t=async()=>{let e=b.trim();!e||w||(y(null),k(!0),await p(e,"").catch(sH)||y("Failed to save comment."),k(!1))},f[0]=b,f[1]=w,f[2]=p,f[3]=t):t=f[3];let S=t;f[4]===Symbol.for("react.memo_cache_sentinel")?(r=e=>v(e.target.value),f[4]=r):r=f[4],f[5]!==b||f[6]!==S||f[7]!==g?(n=e=>{("Enter"===e.key&&e.metaKey||"Return"===e.key)&&b.trim()&&S(),"Escape"===e.key&&g()},f[5]=b,f[6]=S,f[7]=g,f[8]=n):n=f[8],f[9]!==b||f[10]!==n?(o=(0,m.jsx)("textarea",{ref:sF,value:b,onChange:r,placeholder:"Add a comment for the AI",rows:3,onKeyDown:n,className:"w-full resize-none rounded border-0 bg-transparent px-0 py-0 font-sans text-sm text-foreground placeholder:text-muted-foreground focus:outline-none"}),f[9]=b,f[10]=n,f[11]=o):o=f[11],f[12]!==g?(i=(0,m.jsx)(e8,{variant:"ghost",size:"sm",onClick:g,children:"Cancel"}),f[12]=g,f[13]=i):i=f[13],f[14]!==b||f[15]!==w?(l=!b.trim()||w,f[14]=b,f[15]=w,f[16]=l):l=f[16],f[17]!==S?(s=()=>void S(),f[17]=S,f[18]=s):s=f[18];let E=w?"Saving…":"Comment";return f[19]!==l||f[20]!==s||f[21]!==E?(a=(0,m.jsx)(e8,{size:"sm",disabled:l,onClick:s,children:E}),f[19]=l,f[20]=s,f[21]=E,f[22]=a):a=f[22],f[23]!==i||f[24]!==a?(c=(0,m.jsxs)("div",{className:"mt-2 flex justify-end gap-2",children:[i,a]}),f[23]=i,f[24]=a,f[25]=c):c=f[25],f[26]!==x?(u=x&&(0,m.jsx)("p",{className:"mt-2 text-xs text-destructive",children:x}),f[26]=x,f[27]=u):u=f[27],f[28]!==c||f[29]!==u||f[30]!==o?(d=(0,m.jsxs)("div",{className:"my-1 mx-4 rounded-md border border-border bg-background p-3 shadow-lg dark:shadow-none",children:[o,c,u]}),f[28]=c,f[29]=u,f[30]=o,f[31]=d):d=f[31],d},sz=e=>{let t,r,n,o,i,l,s,a,c,u,d,f,p,g,b,v,y,k,S,E,C,j,R,T,N,O=(0,h.c)(60),{comment:P,onDelete:M}=e,[L,A]=(0,sd.useState)(!1),[z,I]=(0,sd.useState)(null),[D,_]=(0,sd.useState)(!1),$=(0,sd.useRef)(null);O[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>()=>{$.current&&(clearTimeout($.current),$.current=null)},r=[],O[0]=t,O[1]=r):(t=O[0],r=O[1]),(0,sd.useEffect)(t,r),O[2]!==P.body||O[3]!==P.tag?(n=async()=>{let e=P.tag?`${P.tag} ${P.body}`:P.body;try{await navigator.clipboard.writeText(e),$.current&&clearTimeout($.current),A(!0),$.current=setTimeout(()=>{A(!1),$.current=null},1500)}catch{}},O[2]=P.body,O[3]=P.tag,O[4]=n):n=O[4];let B=n;O[5]!==D||O[6]!==M?(o=async()=>{D||(I(null),_(!0),await M().catch(sW)||I("Failed to delete comment."),_(!1))},O[5]=D,O[6]=M,O[7]=o):o=O[7];let F=o,H=P.tag?sC[P.tag]?.border??"border-l-ring/40":"border-l-ring/40";O[8]!==H?(i=((...e)=>e4(K(e)))("group my-1 mx-4 rounded-md border border-border bg-card shadow-sm dark:shadow-none overflow-hidden border-l-2",H),O[8]=H,O[9]=i):i=O[9],O[10]!==P.tag?(l=P.tag&&(0,m.jsx)("span",{className:((...e)=>e4(K(e)))("shrink-0 mt-0.5 text-[11px]",sC[P.tag]?.text??"text-muted-foreground"),children:P.tag}),O[10]=P.tag,O[11]=l):l=O[11],O[12]!==P.body?(s=(0,m.jsx)("p",{className:"flex-1 text-sm text-foreground leading-relaxed",children:P.body}),O[12]=P.body,O[13]=s):s=O[13];let W=L?"Comment copied":"Copy comment",V=L?"text-diff-green":"text-muted-foreground hover:text-foreground hover:bg-secondary";O[14]!==V?(a=((...e)=>e4(K(e)))("rounded p-1 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50",V),O[14]=V,O[15]=a):a=O[15],O[16]!==B||O[17]!==a||O[18]!==W?(c=(0,m.jsx)("button",{type:"button",onClick:B,"aria-label":W,className:a}),O[16]=B,O[17]=a,O[18]=W,O[19]=c):c=O[19],O[20]!==L?(u=L?(0,m.jsx)(x,{size:12}):(0,m.jsx)(w,{size:12}),O[20]=L,O[21]=u):u=O[21],O[22]!==c||O[23]!==u?(d=(0,m.jsx)(lD,{render:c,children:u}),O[22]=c,O[23]=u,O[24]=d):d=O[24];let U=L?"Copied!":"Copy comment";return O[25]!==U?(f=(0,m.jsx)(l_,{side:"top",children:U}),O[25]=U,O[26]=f):f=O[26],O[27]!==d||O[28]!==f?(p=(0,m.jsxs)(lI,{children:[d,f]}),O[27]=d,O[28]=f,O[29]=p):p=O[29],O[30]!==F||O[31]!==D?(g=(0,m.jsx)("button",{type:"button",onClick:F,"aria-label":"Delete comment",disabled:D,className:"rounded p-1 text-muted-foreground transition-colors hover:text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50"}),O[30]=F,O[31]=D,O[32]=g):g=O[32],O[33]===Symbol.for("react.memo_cache_sentinel")?(b=(0,m.jsx)(sb,{size:12}),O[33]=b):b=O[33],O[34]!==g?(v=(0,m.jsx)(lD,{render:g,children:b}),O[34]=g,O[35]=v):v=O[35],O[36]===Symbol.for("react.memo_cache_sentinel")?(y=(0,m.jsx)(l_,{side:"top",children:"Delete comment"}),O[36]=y):y=O[36],O[37]!==v?(k=(0,m.jsxs)(lI,{children:[v,y]}),O[37]=v,O[38]=k):k=O[38],O[39]!==p||O[40]!==k?(S=(0,m.jsx)(lz,{delay:400,children:(0,m.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:[p,k]})}),O[39]=p,O[40]=k,O[41]=S):S=O[41],O[42]!==S||O[43]!==l||O[44]!==s?(E=(0,m.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[l,s,S]}),O[42]=S,O[43]=l,O[44]=s,O[45]=E):E=O[45],O[46]!==P.lineNumber?(C=(0,m.jsxs)("span",{children:["L",P.lineNumber]}),O[46]=P.lineNumber,O[47]=C):C=O[47],O[48]!==P.createdAt?(j=P.createdAt&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{children:"·"}),(0,m.jsx)("span",{children:(e=>{let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let n=Math.floor(r/60);if(n<24)return`${n}h ago`;let o=Math.floor(n/24);return`${o}d ago`})(P.createdAt)})]}),O[48]=P.createdAt,O[49]=j):j=O[49],O[50]!==C||O[51]!==j?(R=(0,m.jsxs)("div",{className:"border-t border-border/40 px-3 py-1 flex items-center gap-2 text-[10px] text-muted-foreground/60",children:[C,j]}),O[50]=C,O[51]=j,O[52]=R):R=O[52],O[53]!==z?(T=z&&(0,m.jsx)("p",{className:"px-3 pb-2 text-xs text-destructive",children:z}),O[53]=z,O[54]=T):T=O[54],O[55]!==E||O[56]!==R||O[57]!==T||O[58]!==i?(N=(0,m.jsxs)("div",{className:i,children:[E,R,T]}),O[55]=E,O[56]=R,O[57]=T,O[58]=i,O[59]=N):N=O[59],N},sI=e=>`diff-${encodeURIComponent(e)}`,sD=(0,sd.memo)(function(e){let t,r,n=(0,h.c)(5),{getHoveredLine:o,onCommentTargetChange:i}=e;n[0]!==o||n[1]!==i?(t=()=>{let e=o();e&&i({lineNumber:e.lineNumber,side:e.side})},n[0]=o,n[1]=i,n[2]=t):t=n[2];let l=t;return n[3]!==l?(r=(0,m.jsx)("button",{type:"button",className:"diffhub-gutter-btn",title:"Add comment for AI",onClick:l,children:"+"}),n[3]=l,n[4]=r):r=n[4],r}),s_=(0,sd.memo)(function(e){let t,r,n,o,i,l,s,a=(0,h.c)(59),{file:c,filePatch:u,layout:d,prerenderedHTML:f,shouldRenderPatch:p,comments:b,fileStat:v,isLargeFile:x,collapsed:y,active:w,sectionId:k,onToggleCollapse:S,repoPath:E,commentTarget:C,onCommentTargetChange:j,onRenderPatch:R,onAddComment:T,onDeleteComment:N}=e,O=void 0!==w&&w,{resolvedTheme:P}=(0,g.useTheme)(),M=`${k}-header`,L=`${k}-panel`;a[0]!==C||a[1]!==c||a[2]!==b?(t=b.map(sV),C&&t.push({lineNumber:C.lineNumber,metadata:{file:c,type:"input"},side:C.side}),a[0]=C,a[1]=c,a[2]=b,a[3]=t):t=a[3];let A=t;a[4]!==c||a[5]!==T||a[6]!==j||a[7]!==N?(r=e=>{let t=e.metadata;return t?"input"===t.type?(0,m.jsx)(sA,{onSubmit:async(t,r)=>{let n=await T(c,e.lineNumber,e.side,t,r);return n&&j(null),n},onCancel:()=>j(null)}):"comment"===t.type?(0,m.jsx)(sz,{comment:t.comment,onDelete:()=>N(t.comment.id)}):null:null},a[4]=c,a[5]=T,a[6]=j,a[7]=N,a[8]=r):r=a[8];let z=r;a[9]!==j?(n=e=>(0,m.jsx)(sD,{getHoveredLine:e,onCommentTargetChange:j}),a[9]=j,a[10]=n):n=a[10];let I=n;a[11]!==R?(o=()=>{R()},a[11]=R,a[12]=o):o=a[12];let D=o,_=y&&null===C,$=null;if(!_)if(u)if(p){let e,t,r,n,o,i,l=f?.["light"===P?"light":"dark"],s="light"===P?"light":"dark";a[14]!==s?(e={colorScheme:s},a[14]=s,a[15]=e):e=a[15];let p="split"===d?"split":"unified";a[16]===Symbol.for("react.memo_cache_sentinel")?(t={dark:"github-dark",light:"github-light"},a[16]=t):t=a[16];let h="light"===P?"light":"dark",g=P??"dark";if(a[17]!==g){let e,t;e=sf[g],t=sp[g],r=`
16
+ ${t.join("\n")}`})(ei);await navigator.clipboard.writeText(e),ey.current&&clearTimeout(ey.current),ed(!0),ey.current=setTimeout(()=>ed(!1),2e3)}catch{}},Q[1]=ei,Q[2]=n):n=Q[2];let eS=n;if(Q[3]===Symbol.for("react.memo_cache_sentinel")?(o=()=>eh(!1),Q[3]=o):o=Q[3],t=o,(J=(0,h.c)(5))[0]!==eb||J[1]!==t||J[2]!==em?(G=()=>{if(!em)return;let e=e=>{eb.current&&!eb.current.contains(e.target)&&t()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},Z=[eb,t,em],J[0]=eb,J[1]=t,J[2]=em,J[3]=G,J[4]=Z):(G=J[3],Z=J[4]),(0,b.useEffect)(G,Z),Q[4]!==et||Q[5]!==ee||Q[6]!==ef||Q[7]!==en||Q[8]!==er){let e,t,r,n,o,h,g,b,y,w,k,S,E,T,N,O,P,M,L,A,z,I,{className:D,label:_}="connecting"===en?{className:"bg-muted-foreground/50",label:"Connecting"}:"live"===en?{className:"bg-diff-green",label:"Live"}:{className:"bg-amber-500",label:"Polling"};R=_,s=lz,c=400,p="flex h-[52px] items-center gap-2 border-b border-border bg-card px-4 text-sm",Q[21]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)(lD,{render:(0,m.jsx)(lW,{className:"-ml-1"})}),Q[21]=e):e=Q[21],Q[22]===Symbol.for("react.memo_cache_sentinel")?(v=(0,m.jsxs)(lI,{children:[e,(0,m.jsxs)(l_,{side:"bottom",className:"flex items-center gap-2",children:[(0,m.jsx)("span",{children:"Toggle sidebar"}),(0,m.jsx)(e9,{children:"⌘B"})]})]}),Q[22]=v):v=Q[22],Q[23]!==ee?(t=(0,m.jsx)("button",{type:"button",onClick:()=>ek(ee,"branch"),className:"relative whitespace-nowrap rounded-md border border-border bg-background px-2.5 py-1 font-mono text-xs text-muted-foreground cursor-pointer hover:bg-secondary"}),Q[23]=ee,Q[24]=t):t=Q[24];let $="branch"===ef?"opacity-0":"opacity-100";Q[25]!==$?(r=((...e)=>e4(K(e)))("transition-opacity duration-150",$),Q[25]=$,Q[26]=r):r=Q[26],Q[27]!==ee?(n=lZ(ee),Q[27]=ee,Q[28]=n):n=Q[28],Q[29]!==r||Q[30]!==n?(o=(0,m.jsx)("span",{className:r,children:n}),Q[29]=r,Q[30]=n,Q[31]=o):o=Q[31];let B="branch"===ef?"opacity-100":"opacity-0";Q[32]!==B?(h=((...e)=>e4(K(e)))("absolute inset-0 flex items-center justify-center text-diff-green transition-opacity duration-150",B),Q[32]=B,Q[33]=h):h=Q[33],Q[34]===Symbol.for("react.memo_cache_sentinel")?(g=(0,m.jsx)(x,{size:14}),Q[34]=g):g=Q[34],Q[35]!==h?(b=(0,m.jsx)("span",{className:h,children:g}),Q[35]=h,Q[36]=b):b=Q[36],Q[37]!==t||Q[38]!==o||Q[39]!==b?(y=(0,m.jsxs)(lD,{render:t,children:[o,b]}),Q[37]=t,Q[38]=o,Q[39]=b,Q[40]=y):y=Q[40];let F="branch"===ef?"Copied!":"Click to copy";Q[41]!==F?(w=(0,m.jsx)(l_,{side:"bottom",children:F}),Q[41]=F,Q[42]=w):w=Q[42],Q[43]!==y||Q[44]!==w?(k=(0,m.jsxs)(lI,{children:[y,w]}),Q[43]=y,Q[44]=w,Q[45]=k):k=Q[45],Q[46]===Symbol.for("react.memo_cache_sentinel")?(S=(0,m.jsx)(C,{size:12,className:"text-muted-foreground/50 shrink-0"}),Q[46]=S):S=Q[46],Q[47]!==et?(E=(0,m.jsx)("button",{type:"button",onClick:()=>ek(et,"base"),className:"relative whitespace-nowrap rounded-md border border-border bg-background px-2.5 py-1 font-mono text-xs text-muted-foreground cursor-pointer hover:bg-secondary"}),Q[47]=et,Q[48]=E):E=Q[48];let H="base"===ef?"opacity-0":"opacity-100";Q[49]!==H?(T=((...e)=>e4(K(e)))("transition-opacity duration-150",H),Q[49]=H,Q[50]=T):T=Q[50],Q[51]!==et?(N=lZ(et),Q[51]=et,Q[52]=N):N=Q[52],Q[53]!==T||Q[54]!==N?(O=(0,m.jsx)("span",{className:T,children:N}),Q[53]=T,Q[54]=N,Q[55]=O):O=Q[55];let W="base"===ef?"opacity-100":"opacity-0";Q[56]!==W?(P=((...e)=>e4(K(e)))("absolute inset-0 flex items-center justify-center text-diff-green transition-opacity duration-150",W),Q[56]=W,Q[57]=P):P=Q[57],Q[58]===Symbol.for("react.memo_cache_sentinel")?(M=(0,m.jsx)(x,{size:14}),Q[58]=M):M=Q[58],Q[59]!==P?(L=(0,m.jsx)("span",{className:P,children:M}),Q[59]=P,Q[60]=L):L=Q[60],Q[61]!==E||Q[62]!==O||Q[63]!==L?(A=(0,m.jsxs)(lD,{render:E,children:[O,L]}),Q[61]=E,Q[62]=O,Q[63]=L,Q[64]=A):A=Q[64];let V="base"===ef?"Copied!":"Click to copy";Q[65]!==V?(z=(0,m.jsx)(l_,{side:"bottom",children:V}),Q[65]=V,Q[66]=z):z=Q[66],Q[67]!==A||Q[68]!==z?(I=(0,m.jsxs)(lI,{children:[A,z]}),Q[67]=A,Q[68]=z,Q[69]=I):I=Q[69],Q[70]!==k||Q[71]!==I?(j=(0,m.jsxs)("div",{className:"flex items-center gap-1.5",children:[k,S,I]}),Q[70]=k,Q[71]=I,Q[72]=j):j=Q[72],Q[73]===Symbol.for("react.memo_cache_sentinel")?(a=(0,m.jsx)("div",{className:"flex-1"}),Q[73]=a):a=Q[73],f="flex items-center gap-0.5",l=lI,i=lD,Q[74]===Symbol.for("react.memo_cache_sentinel")?(d=(0,m.jsx)("div",{className:"flex items-center pr-1.5"}),Q[74]=d):d=Q[74],u=((...e)=>e4(K(e)))("mx-1 size-1.5 rounded-full",D,er&&"animate-pulse"),Q[4]=et,Q[5]=ee,Q[6]=ef,Q[7]=en,Q[8]=er,Q[9]=i,Q[10]=l,Q[11]=s,Q[12]=a,Q[13]=c,Q[14]=u,Q[15]=d,Q[16]=f,Q[17]=p,Q[18]=v,Q[19]=j,Q[20]=R}else i=Q[9],l=Q[10],s=Q[11],a=Q[12],c=Q[13],u=Q[14],d=Q[15],f=Q[16],p=Q[17],v=Q[18],j=Q[19],R=Q[20];Q[75]!==u?(T=(0,m.jsx)("span",{className:u}),Q[75]=u,Q[76]=T):T=Q[76],Q[77]!==i||Q[78]!==T||Q[79]!==d?(N=(0,m.jsx)(i,{render:d,children:T}),Q[77]=i,Q[78]=T,Q[79]=d,Q[80]=N):N=Q[80],Q[81]!==R?(O=(0,m.jsx)(l_,{side:"bottom",children:R}),Q[81]=R,Q[82]=O):O=Q[82],Q[83]!==l||Q[84]!==N||Q[85]!==O?(P=(0,m.jsxs)(l,{children:[N,O]}),Q[83]=l,Q[84]=N,Q[85]=O,Q[86]=P):P=Q[86],Q[87]!==eo?(M=(0,m.jsx)(lJ,{syncNotice:eo}),Q[87]=eo,Q[88]=M):M=Q[88],Q[89]===Symbol.for("react.memo_cache_sentinel")?(L=()=>eh(l3),Q[89]=L):L=Q[89];let eE="uncommitted"===el?"Uncommitted":"All",eC=em&&"rotate-180";Q[90]!==eC?(A=((...e)=>e4(K(e)))("transition-transform duration-150",eC),Q[90]=eC,Q[91]=A):A=Q[91],Q[92]!==A?(z=(0,m.jsx)(y,{size:10,className:A}),Q[92]=A,Q[93]=z):z=Q[93],Q[94]!==eE||Q[95]!==z?(I=(0,m.jsxs)(e8,{variant:"ghost",size:"xs",onClick:L,className:"text-muted-foreground hover:text-foreground hover:bg-secondary gap-1",children:[eE,z]}),Q[94]=eE,Q[95]=z,Q[96]=I):I=Q[96],Q[97]!==el||Q[98]!==em||Q[99]!==es?(D=em&&(0,m.jsx)("div",{className:"absolute right-0 top-full mt-1 z-50 min-w-[200px] rounded-lg border border-border bg-card shadow-lg dark:shadow-none py-1 overflow-hidden",children:lG.map(e=>{let{value:t,label:r}=e;return(0,m.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between px-3 py-2 text-sm text-left hover:bg-secondary/50 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50",onClick:()=>{es(t),eh(!1)},children:[(0,m.jsx)("span",{className:((...e)=>e4(K(e)))("text-foreground",el===t&&"font-medium"),children:r}),el===t&&(0,m.jsx)(x,{size:14,className:"text-diff-green shrink-0"})]},t)})}),Q[97]=el,Q[98]=em,Q[99]=es,Q[100]=D):D=Q[100],Q[101]!==I||Q[102]!==D?(_=(0,m.jsxs)("div",{className:"relative",ref:eb,children:[I,D]}),Q[101]=I,Q[102]=D,Q[103]=_):_=Q[103],Q[104]!==ei.length||Q[105]!==eu||Q[106]!==eS?($=ei.length>0&&(0,m.jsxs)(lI,{children:[(0,m.jsxs)(lD,{render:(0,m.jsx)(e8,{variant:"ghost",size:"xs",onClick:eS,className:"text-muted-foreground hover:text-foreground hover:bg-secondary"}),children:[eu?(0,m.jsx)(x,{"data-icon":"inline-start"}):(0,m.jsx)(w,{"data-icon":"inline-start"}),eu?"Copied!":`Copy ${ei.length} comment${1===ei.length?"":"s"}`]}),(0,m.jsx)(l_,{side:"bottom",children:"Copy all comments as AI prompt"})]}),Q[104]=ei.length,Q[105]=eu,Q[106]=eS,Q[107]=$):$=Q[107],Q[108]!==ea||Q[109]!==ec?(B=(0,m.jsx)(e8,{variant:"ghost",size:"icon-xs",onClick:()=>ec("split"===ea?"stacked":"split"),className:"text-muted-foreground hover:text-foreground hover:bg-secondary"}),Q[108]=ea,Q[109]=ec,Q[110]=B):B=Q[110],Q[111]===Symbol.for("react.memo_cache_sentinel")?(F=(0,m.jsx)(E,{size:14}),Q[111]=F):F=Q[111],Q[112]!==B?(H=(0,m.jsx)(lD,{render:B,children:F}),Q[112]=B,Q[113]=H):H=Q[113];let ej="split"===ea?"Switch to unified view (S)":"Switch to split view (S)";return Q[114]!==ej?(W=(0,m.jsx)(l_,{side:"bottom",children:ej}),Q[114]=ej,Q[115]=W):W=Q[115],Q[116]!==H||Q[117]!==W?(V=(0,m.jsxs)(lI,{children:[H,W]}),Q[116]=H,Q[117]=W,Q[118]=V):V=Q[118],Q[119]!==eg||Q[120]!==ev||Q[121]!==ex?(U=eg&&(0,m.jsxs)(lI,{children:[(0,m.jsx)(lD,{render:(0,m.jsx)(e8,{variant:"ghost",size:"icon-xs",onClick:()=>ex("dark"===ev?"light":"dark"),className:"text-muted-foreground hover:text-foreground hover:bg-secondary"}),children:"dark"===ev?(0,m.jsx)(k,{size:14}):(0,m.jsx)(S,{size:14})}),(0,m.jsx)(l_,{side:"bottom",children:"dark"===ev?"Switch to light mode":"Switch to dark mode"})]}),Q[119]=eg,Q[120]=ev,Q[121]=ex,Q[122]=U):U=Q[122],Q[123]!==P||Q[124]!==M||Q[125]!==_||Q[126]!==$||Q[127]!==V||Q[128]!==U||Q[129]!==f?(q=(0,m.jsxs)("div",{className:f,children:[P,M,_,$,V,U]}),Q[123]=P,Q[124]=M,Q[125]=_,Q[126]=$,Q[127]=V,Q[128]=U,Q[129]=f,Q[130]=q):q=Q[130],Q[131]!==a||Q[132]!==q||Q[133]!==p||Q[134]!==v||Q[135]!==j?(X=(0,m.jsxs)("header",{className:p,children:[v,j,a,q]}),Q[131]=a,Q[132]=q,Q[133]=p,Q[134]=v,Q[135]=j,Q[136]=X):X=Q[136],Q[137]!==s||Q[138]!==c||Q[139]!==X?(Y=(0,m.jsx)(s,{delay:c,children:X}),Q[137]=s,Q[138]=c,Q[139]=X,Q[140]=Y):Y=Q[140],Y};function l1(){return lQ}function l2(){return!0}function l5(){return!1}function l3(e){return!e}let l4=v("BubbleDotsIcon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:2,d:"M4.002 7c0-1.6568 1.3431-3 3-3h9.9999c1.6569 0 3.0001 1.3431 3.0001 3v8.0358c0 1.6568-1.3432 3-3 3h-1.6263a1 1 0 0 0-.638.2299l-2.74 2.2701-2.7037-2.2664a1 1 0 0 0-.6424-.2336H7.0019c-1.6568 0-3-1.3432-3-3z"}),b.createElement("path",{fill:"currentColor",stroke:"currentColor",strokeLinecap:"square",strokeWidth:.75,d:"M6.875 11.25a.875.875 0 1 0 1.75 0 .875.875 0 0 0-1.75 0Zm4.25 0a.875.875 0 1 0 1.7501-.0001.875.875 0 0 0-1.7501.0001Zm4.25 0a.875.875 0 1 0 1.7501-.0001.875.875 0 0 0-1.7501.0001Z"})))),l6=v("Folder1Icon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v9c0 1.6569 1.3431 3 3 3h12c1.6569 0 3-1.3431 3-3v-6c0-1.6569-1.3431-3-3-3h-4.9296a2 2 0 0 1-1.6641-.8906l-.8126-1.2188A2 2 0 0 0 8.9297 4H6C4.3431 4 3 5.3431 3 7"})))),l7=v("FolderOpenFilledIcon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 3C3.7909 3 2 4.7909 2 7v10.5592C2 18.9072 3.0928 20 4.4408 20H18.045a3.0002 3.0002 0 0 0 2.8487-2.1052l1.6557-5.2983c.3657-1.1701-.3952-2.3574-1.5494-2.5647V9c0-1.6569-1.3431-3-3-3h-4.9296a1 1 0 0 1-.8321-.4453l-.5157-.7735A4 4 0 0 0 8.3945 3zm13 7V9c0-.5523-.4477-1-1-1h-4.9296a3 3 0 0 1-2.4962-1.3359l-.5157-.7735A2 2 0 0 0 8.3945 5H6c-1.1046 0-2 .8954-2 2v10.5592a.4407.4407 0 0 0 .8615.1315l1.7454-5.5855A3 3 0 0 1 9.4704 10z",clipRule:"evenodd"})))),l8=v("MagnifyingGlassIcon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeWidth:2,d:"m20 20-3.95-3.95M18 11c0 3.866-3.134 7-7 7s-7-3.134-7-7 3.134-7 7-7 7 3.134 7 7Z"})))),l9=e=>{let t,r,n,o,i=(0,h.c)(7);i[0]!==e?({size:r,...t}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]);let l=void 0===r?16:r;return i[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("path",{d:"M1 1.75C1 .784 1.784 0 2.75 0h7.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16H2.75A1.75 1.75 0 0 1 1 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25V4.664a.25.25 0 0 0-.073-.177l-2.914-2.914a.25.25 0 0 0-.177-.073ZM8 3.25a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0V7h-1.5a.75.75 0 0 1 0-1.5h1.5V4A.75.75 0 0 1 8 3.25Zm-3 8a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1-.75-.75Z"}),i[3]=n):n=i[3],i[4]!==t||i[5]!==l?(o=(0,m.jsx)("svg",{viewBox:"0 0 16 16",width:l,height:l,fill:"currentColor","aria-hidden":"true",focusable:"false",...t,children:n}),i[4]=t,i[5]=l,i[6]=o):o=i[6],o},se=e=>{let t,r,n,o,i=(0,h.c)(7);i[0]!==e?({size:r,...t}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]);let l=void 0===r?16:r;return i[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("path",{d:"M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V4.664a.25.25 0 0 0-.073-.177l-2.914-2.914a.25.25 0 0 0-.177-.073Zm4.48 3.758a.75.75 0 0 1 .755.745l.01 1.497h1.497a.75.75 0 0 1 0 1.5H9v1.507a.75.75 0 0 1-1.5 0V9.005l-1.502.01a.75.75 0 0 1-.01-1.5l1.507-.01-.01-1.492a.75.75 0 0 1 .745-.755Z"}),i[3]=n):n=i[3],i[4]!==t||i[5]!==l?(o=(0,m.jsx)("svg",{viewBox:"0 0 16 16",width:l,height:l,fill:"currentColor","aria-hidden":"true",focusable:"false",...t,children:n}),i[4]=t,i[5]=l,i[6]=o):o=i[6],o},st=e=>{let t,r,n,o,i=(0,h.c)(7);i[0]!==e?({size:r,...t}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]);let l=void 0===r?16:r;return i[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("path",{d:"M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V4.664a.25.25 0 0 0-.073-.177l-2.914-2.914a.25.25 0 0 0-.177-.073Zm4.5 6h2.242a.75.75 0 0 1 0 1.5h-2.24l-2.254.015a.75.75 0 0 1-.01-1.5Z"}),i[3]=n):n=i[3],i[4]!==t||i[5]!==l?(o=(0,m.jsx)("svg",{viewBox:"0 0 16 16",width:l,height:l,fill:"currentColor","aria-hidden":"true",focusable:"false",...t,children:n}),i[4]=t,i[5]=l,i[6]=o):o=i[6],o},sr="diffhub:file-tree:expand-all",sn="diffhub:file-tree:collapse-all",so=e=>e.map(e=>{if("file"===e.type)return e;let t=so(e.children);if(1===t.length&&"folder"===t[0].type){let r=t[0];return{...r,name:`${e.name}/${r.name}`}}return{...e,children:t}}),si=(e,t=[])=>{for(let r of e)"folder"===r.type&&(t.push(r.path),si(r.children,t));return t},sl=(0,b.memo)(function(e){let t,r,n,o,i,l,s,a,c,u,d=(0,h.c)(30),{node:f,depth:p,isSelected:g,commentCount:b,onNavigate:v}=e,x=16*p+8,{insertions:y,deletions:w}=f.fileStat,k=l9;y>0&&0===w?k=se:w>0&&0===y&&(k=st);let S="shrink-0 text-sidebar-foreground/40";y>0&&0===w?S="shrink-0 text-diff-green":w>0&&0===y&&(S="shrink-0 text-destructive");let E=g?"true":void 0,C=g?"bg-sidebar-accent text-sidebar-accent-foreground":"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground";d[0]!==C?(t=((...e)=>e4(K(e)))("flex w-full cursor-pointer items-center gap-1.5 py-1 text-left transition-colors",C),d[0]=C,d[1]=t):t=d[1];let j=g?"true":void 0;return d[2]!==x?(r={containIntrinsicBlockSize:"26px",contentVisibility:"auto",paddingLeft:x,paddingRight:8},d[2]=x,d[3]=r):r=d[3],d[4]!==f.path||d[5]!==v?(n=()=>v(f.path),d[4]=f.path,d[5]=v,d[6]=n):n=d[6],d[7]!==k||d[8]!==S?(o=(0,m.jsx)(k,{size:16,className:S}),d[7]=k,d[8]=S,d[9]=o):o=d[9],d[10]===Symbol.for("react.memo_cache_sentinel")?(i=(0,m.jsx)("span",{className:"flex-1 truncate text-[12px] leading-tight text-muted-foreground"}),d[10]=i):i=d[10],d[11]!==f.name?(l=(0,m.jsx)(lD,{render:i,children:f.name}),d[11]=f.name,d[12]=l):l=d[12],d[13]!==f.path?(s=(0,m.jsx)(l_,{side:"right",children:f.path}),d[13]=f.path,d[14]=s):s=d[14],d[15]!==s||d[16]!==l?(a=(0,m.jsxs)(lI,{children:[l,s]}),d[15]=s,d[16]=l,d[17]=a):a=d[17],d[18]!==b?(c=b>0&&(0,m.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 text-[10px] text-sidebar-foreground/50",children:[(0,m.jsx)(l4,{size:10}),b]}),d[18]=b,d[19]=c):c=d[19],d[20]!==f.path||d[21]!==E||d[22]!==a||d[23]!==c||d[24]!==t||d[25]!==j||d[26]!==r||d[27]!==n||d[28]!==o?(u=(0,m.jsxs)("button",{type:"button","aria-current":E,className:t,"data-file-path":f.path,"data-selected":j,style:r,onClick:n,children:[o,a,c]}),d[20]=f.path,d[21]=E,d[22]=a,d[23]=c,d[24]=t,d[25]=j,d[26]=r,d[27]=n,d[28]=o,d[29]=u):u=d[29],u}),ss=(0,b.memo)(function(e){let t,r,n,o,i,l,s,a,c,u,d,f,p,g,v,x,y,w=(0,h.c)(50),{node:k,depth:S,isCollapsed:E,onToggle:C,children:j}=e,R=16*S+8;if(w[0]!==R||w[1]!==E||w[2]!==k.name||w[3]!==k.path||w[4]!==C){let e=(d=e6(k.name)).split("/");i="button",l=!E,s="flex w-full items-center gap-1.5 py-1 text-left transition-colors hover:bg-sidebar-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-ring",w[16]!==R?(a={paddingLeft:R,paddingRight:8},w[16]=R,w[17]=a):a=w[17],w[18]!==k.path||w[19]!==C?(c=()=>C(k.path),w[18]=k.path,w[19]=C,w[20]=c):c=w[20],w[21]!==E?(u=E?(0,m.jsx)(l6,{size:16,className:"shrink-0 text-sidebar-foreground/50"}):(0,m.jsx)(l7,{size:16,className:"shrink-0 text-sidebar-foreground/50"}),w[21]=E,w[22]=u):u=w[22],r=lI,t=lD,w[23]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("span",{className:"truncate text-[12px] text-muted-foreground"}),w[23]=n):n=w[23],o=e.map((t,r)=>{let n=e.slice(0,r+1).join("/");return(0,m.jsxs)(b.Fragment,{children:[t,r<e.length-1&&(0,m.jsx)("span",{className:"text-sidebar-foreground/30",children:"/"})]},n)}),w[0]=R,w[1]=E,w[2]=k.name,w[3]=k.path,w[4]=C,w[5]=t,w[6]=r,w[7]=n,w[8]=o,w[9]=i,w[10]=l,w[11]=s,w[12]=a,w[13]=c,w[14]=u,w[15]=d}else t=w[5],r=w[6],n=w[7],o=w[8],i=w[9],l=w[10],s=w[11],a=w[12],c=w[13],u=w[14],d=w[15];return w[24]!==t||w[25]!==n||w[26]!==o?(f=(0,m.jsx)(t,{render:n,children:o}),w[24]=t,w[25]=n,w[26]=o,w[27]=f):f=w[27],w[28]!==k.name||w[29]!==d?(p=k.name!==d&&(0,m.jsx)(l_,{side:"right",children:k.name}),w[28]=k.name,w[29]=d,w[30]=p):p=w[30],w[31]!==r||w[32]!==p||w[33]!==f?(g=(0,m.jsxs)(r,{children:[f,p]}),w[31]=r,w[32]=p,w[33]=f,w[34]=g):g=w[34],w[35]!==g||w[36]!==i||w[37]!==l||w[38]!==s||w[39]!==a||w[40]!==c||w[41]!==u?(v=(0,m.jsxs)("button",{type:i,"aria-expanded":l,className:s,style:a,onClick:c,children:[u,g]}),w[35]=g,w[36]=i,w[37]=l,w[38]=s,w[39]=a,w[40]=c,w[41]=u,w[42]=v):v=w[42],w[43]!==j||w[44]!==R||w[45]!==E?(x=!E&&(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)("div",{className:"pointer-events-none absolute inset-y-0 border-l border-sidebar-border/60",style:{left:R+8}}),j]}),w[43]=j,w[44]=R,w[45]=E,w[46]=x):x=w[46],w[47]!==v||w[48]!==x?(y=(0,m.jsxs)(m.Fragment,{children:[v,x]}),w[47]=v,w[48]=x,w[49]=y):y=w[49],y}),sa=(0,b.memo)(function e({nodes:t,depth:r,selectedFile:n,commentsByFile:o,collapsedFolders:i,onToggleFolder:l,onNavigate:s}){return t.map(t=>"folder"===t.type?(0,m.jsx)(ss,{node:t,depth:r,isCollapsed:i.has(t.path),onToggle:l,children:(0,m.jsx)(e,{nodes:t.children,depth:r+1,selectedFile:n,commentsByFile:o,collapsedFolders:i,onToggleFolder:l,onNavigate:s})},t.path):(0,m.jsx)(sl,{node:t,depth:r,isSelected:n===t.path,commentCount:o.get(t.path)??0,onNavigate:s},t.path))}),sc=e=>{let t,r,n,o,i,l,s,a,c,u,d,f,p,g,v,x,y,w,k,S,E,C,j,R,T,N=(0,h.c)(65),{files:O,selectedFile:P,onSelectFile:M,comments:L,filterQuery:A,onFilterChange:z,isLoading:I,insertions:D,deletions:_,sidebarWidth:$,onSidebarWidthChange:B}=e;N[0]===Symbol.for("react.memo_cache_sentinel")?(t=new Set,N[0]=t):t=N[0];let[F,H]=(0,b.useState)(t),W=(0,b.useRef)(null);N[1]!==B?(r=()=>{let e=()=>{W.current=null,document.body.style.cursor="",document.body.style.userSelect=""},t=e=>{W.current&&B(Math.max(8,W.current.startWidth+e.clientX-W.current.startX))},r=()=>{W.current&&e()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",r),window.addEventListener("blur",r),()=>{e(),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),window.removeEventListener("blur",r)}},n=[B],N[1]=B,N[2]=r,N[3]=n):(r=N[2],n=N[3]),(0,b.useEffect)(r,n),N[4]!==$?(o=e=>{e.preventDefault(),W.current={startWidth:$,startX:e.clientX},document.body.style.cursor="col-resize",document.body.style.userSelect="none"},N[4]=$,N[5]=o):o=N[5];let V=o;N[6]!==O||N[7]!==A?(i=A?O.filter(e=>e.file.toLowerCase().includes(A.toLowerCase())):O,N[6]=O,N[7]=A,N[8]=i):i=N[8];let U=i;N[9]!==U?(l=so((e=>{let t={files:[],folders:{}};for(let r of e){let e=r.file.split("/"),n=t;for(let t=0;t<e.length-1;t+=1){let r=e[t];n.folders[r]||(n.folders[r]={files:[],folders:{}}),n=n.folders[r]}n.files.push(r)}let r=(e,t,n)=>{let o=n?`${n}/${e}`:e,i=[];for(let[e,n]of Object.entries(t.folders).toSorted())i.push(r(e,n,o));for(let e of t.files){let t=e.file.split("/");i.push({fileStat:e,name:t.at(-1)??e.file,path:e.file,type:"file"})}return{children:i,name:e,path:o,type:"folder"}},n=[];for(let[e,o]of Object.entries(t.folders).toSorted())n.push(r(e,o,""));for(let e of t.files)n.push({fileStat:e,name:e.file,path:e.file,type:"file"});return n})(U)),N[9]=U,N[10]=l):l=N[10];let q=l;N[11]!==q?(s=si(q),N[11]=q,N[12]=s):s=N[12];let K=s;if(N[13]!==K?(c=()=>{let e=()=>{H(new Set)},t=()=>{H(new Set(K))};return window.addEventListener(sr,e),window.addEventListener(sn,t),()=>{window.removeEventListener(sr,e),window.removeEventListener(sn,t)}},a=[K],N[13]=K,N[14]=a,N[15]=c):(a=N[14],c=N[15]),(0,b.useEffect)(c,a),N[16]!==L){for(let e of(u=new Map,L))u.set(e.file,(u.get(e.file)??0)+1);N[16]=L,N[17]=u}else u=N[17];let X=u;N[18]===Symbol.for("react.memo_cache_sentinel")?(d=e=>{H(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},N[18]=d):d=N[18];let Y=d;N[19]!==M?(f=e=>{let t=new CustomEvent("diffhub:file:navigate",{cancelable:!0,detail:{file:e,source:"sidebar"}});window.dispatchEvent(t)&&M(e,"auto")},N[19]=M,N[20]=f):f=N[20];let G=f;if(void 0!==I&&I){let e;N[21]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:(0,m.jsx)("p",{className:"animate-pulse text-xs text-sidebar-foreground/50",children:"Loading…"})}),N[21]=e):e=N[21],p=e}else if(0===U.length){let e,t,r;N[22]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("p",{className:"text-xs text-sidebar-foreground/50",children:"No changes"}),N[22]=e):e=N[22],N[23]!==A?(t=A&&(0,m.jsxs)("p",{className:"text-[10px] text-sidebar-foreground/30",children:["No files match “",A,"”"]}),N[23]=A,N[24]=t):t=N[24],N[25]!==t?(r=(0,m.jsxs)("div",{className:"flex flex-col items-center gap-2 px-4 py-8 text-center",children:[e,t]}),N[25]=t,N[26]=r):r=N[26],p=r}else{let e;N[27]!==F||N[28]!==X||N[29]!==G||N[30]!==P||N[31]!==q?(e=(0,m.jsx)(sa,{nodes:q,depth:0,selectedFile:P,commentsByFile:X,collapsedFolders:F,onToggleFolder:Y,onNavigate:G}),N[27]=F,N[28]=X,N[29]=G,N[30]=P,N[31]=q,N[32]=e):e=N[32],p=e}N[33]===Symbol.for("react.memo_cache_sentinel")?(g=(0,m.jsx)(l8,{size:12,className:"pointer-events-none absolute left-2.5 text-sidebar-foreground/40"}),N[33]=g):g=N[33],N[34]!==z?(v=e=>z(e.target.value),N[34]=z,N[35]=v):v=N[35],N[36]!==A||N[37]!==v?(x=(0,m.jsx)("input",{type:"text",value:A,onChange:v,placeholder:"Filter files…","aria-label":"Filter files",className:"w-full rounded-md border border-sidebar-border bg-sidebar-accent py-1.5 pl-7 pr-7 text-xs text-sidebar-foreground placeholder:text-sidebar-foreground/40 transition-colors focus:border-sidebar-ring/50 focus:outline-none"}),N[36]=A,N[37]=v,N[38]=x):x=N[38],N[39]!==A||N[40]!==z?(y=A&&(0,m.jsx)("button",{type:"button",onClick:()=>z(""),"aria-label":"Clear filter",className:"absolute right-2 text-sm leading-none text-sidebar-foreground/40 transition-colors hover:text-sidebar-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-sidebar-ring",children:"×"}),N[39]=A,N[40]=z,N[41]=y):y=N[41],N[42]!==x||N[43]!==y?(w=(0,m.jsx)(lU,{className:"border-b border-sidebar-border h-[52px] flex-row items-center py-0 px-2",children:(0,m.jsxs)("div",{className:"relative flex w-full items-center",children:[g,x,y]})}),N[42]=x,N[43]=y,N[44]=w):w=N[44],N[45]!==p?(k=(0,m.jsx)(lK,{className:"gap-0 py-1",children:p}),N[45]=p,N[46]=k):k=N[46];let Z=1===O.length?"file":"files";return N[47]!==O.length||N[48]!==Z?(S=(0,m.jsxs)("span",{children:[O.length," ",Z]}),N[47]=O.length,N[48]=Z,N[49]=S):S=N[49],N[50]!==D?(E=D>0&&(0,m.jsxs)("span",{className:"text-diff-green",children:["+",D]}),N[50]=D,N[51]=E):E=N[51],N[52]!==_?(C=_>0&&(0,m.jsxs)("span",{className:"text-destructive",children:["−",_]}),N[52]=_,N[53]=C):C=N[53],N[54]!==S||N[55]!==E||N[56]!==C?(j=(0,m.jsx)(lq,{className:"border-t border-sidebar-border px-3 py-2",children:(0,m.jsxs)("div",{className:"flex items-center gap-2 text-[12px] font-mono text-sidebar-foreground/60",children:[S,E,C]})}),N[54]=S,N[55]=E,N[56]=C,N[57]=j):j=N[57],N[58]!==V?(R=(0,m.jsx)("div",{"aria-hidden":!0,className:"absolute inset-y-0 right-0 z-20 w-[5px] cursor-col-resize after:absolute after:inset-y-0 after:left-1/2 after:-translate-x-1/2 after:w-px after:transition-colors hover:after:bg-sidebar-border",onMouseDown:V}),N[58]=V,N[59]=R):R=N[59],N[60]!==w||N[61]!==k||N[62]!==j||N[63]!==R?(T=(0,m.jsx)(lz,{delay:400,children:(0,m.jsxs)(lH,{collapsible:"offcanvas",className:"overflow-hidden border-r border-sidebar-border",children:[w,k,j,R]})}),N[60]=w,N[61]=k,N[62]=j,N[63]=R,N[64]=T):T=N[64],T};var su=e.i(70703),sd=b;let sf={dark:{addition:"#3fb950",deletion:"#f85149"},light:{addition:"#1a7f37",deletion:"#d1242f"}},sp={dark:{additionBg:"#2ea04326",additionBgNumber:"#3fb9504d",additionEmphasis:"#2ea04366",deletionBg:"#f851491a",deletionBgNumber:"#f851494d",deletionEmphasis:"#f8514966"},light:{additionBg:"#dafbe1",additionBgNumber:"#aceebb",additionEmphasis:"#aceebb",deletionBg:"#ffebe9",deletionBgNumber:"#ffcecb",deletionEmphasis:"#ffcecb"}},sm=e=>{let t,r,n,o,i,l,s,a,c=(0,h.c)(22),{value:u,label:d,copiedLabel:f,delay:p,className:g}=e,v=void 0===d?"Copy file path":d,y=void 0===f?"Copied!":f,k=void 0===p?400:p,[S,E]=(0,b.useState)(!1);c[0]!==u?(t=async()=>{try{await navigator.clipboard.writeText(u),E(!0),setTimeout(()=>E(!1),1500)}catch{}},c[0]=u,c[1]=t):t=c[1];let C=t,j=S?y:v,R=S?"text-diff-green":"text-muted-foreground hover:text-foreground hover:bg-secondary";c[2]!==g||c[3]!==R?(r=((...e)=>e4(K(e)))("size-6",R,g),c[2]=g,c[3]=R,c[4]=r):r=c[4],c[5]!==C||c[6]!==j||c[7]!==r?(n=(0,m.jsx)(e8,{variant:"ghost",size:"icon-xs",onClick:C,"aria-label":j,className:r}),c[5]=C,c[6]=j,c[7]=r,c[8]=n):n=c[8],c[9]!==S?(o=S?(0,m.jsx)(x,{size:12}):(0,m.jsx)(w,{size:12}),c[9]=S,c[10]=o):o=c[10],c[11]!==n||c[12]!==o?(i=(0,m.jsx)(lD,{render:n,children:o}),c[11]=n,c[12]=o,c[13]=i):i=c[13];let T=S?y:v;return c[14]!==T?(l=(0,m.jsx)(l_,{side:"bottom",children:T}),c[14]=T,c[15]=l):l=c[15],c[16]!==i||c[17]!==l?(s=(0,m.jsxs)(lI,{children:[i,l]}),c[16]=i,c[17]=l,c[18]=s):s=c[18],c[19]!==k||c[20]!==s?(a=(0,m.jsx)(lz,{delay:k,children:s}),c[19]=k,c[20]=s,c[21]=a):a=c[21],a},sh=e=>{let t,r,n,o,i,l,s,a,c,u,d,f,p,g,b,v,x,w,k,S,E,C,j,R,T,N=(0,h.c)(64),{file:O,insertions:P,deletions:M,commentCount:L,repoPath:A,collapsed:z,active:I,onToggleCollapse:D,headingId:_,panelId:$}=e,B=void 0!==z&&z;if(N[0]!==O){let e=(n=e6(O)).lastIndexOf("/");t=-1===e?"":n.slice(0,e),r=-1===e?n:n.slice(e+1),N[0]=O,N[1]=t,N[2]=r,N[3]=n}else t=N[1],r=N[2],n=N[3];let F=r;N[4]!==O||N[5]!==D?(o=()=>{D?D():window.dispatchEvent(new CustomEvent("diffhub:file:toggle-collapse",{detail:{file:O}}))},N[4]=O,N[5]=D,N[6]=o):o=N[6];let H=o,W=void 0!==I&&I?"true":void 0,V=B?"collapsed":"expanded",U=!B,q=B?"Expand file section":"Collapse file section";N[7]!==H||N[8]!==$||N[9]!==U||N[10]!==q?(i=(0,m.jsx)(e8,{variant:"ghost",size:"icon-xs",onClick:H,"aria-expanded":U,"aria-controls":$,"aria-label":q,className:"text-muted-foreground hover:bg-transparent active:bg-transparent aria-expanded:bg-transparent"}),N[7]=H,N[8]=$,N[9]=U,N[10]=q,N[11]=i):i=N[11];let X=B&&"-rotate-90";N[12]!==X?(l=((...e)=>e4(K(e)))("transition-transform duration-150",X),N[12]=X,N[13]=l):l=N[13],N[14]!==l?(s=(0,m.jsx)(y,{size:14,className:l}),N[14]=l,N[15]=s):s=N[15],N[16]!==s||N[17]!==i?(a=(0,m.jsx)(lD,{render:i,children:s}),N[16]=s,N[17]=i,N[18]=a):a=N[18];let Y=B?"Expand file section":"Collapse file section";N[19]!==Y?(c=(0,m.jsx)(l_,{side:"bottom",children:Y}),N[19]=Y,N[20]=c):c=N[20],N[21]!==a||N[22]!==c?(u=(0,m.jsxs)(lI,{children:[a,c]}),N[21]=a,N[22]=c,N[23]=u):u=N[23],N[24]===Symbol.for("react.memo_cache_sentinel")?(d=(0,m.jsx)("span",{className:"flex min-w-0 items-center gap-1"}),N[24]=d):d=N[24],N[25]!==t?(f=t&&(0,m.jsxs)("span",{className:"text-muted-foreground truncate shrink",children:[t,"/"]}),N[25]=t,N[26]=f):f=N[26],N[27]!==F?(p=(0,m.jsx)("span",{className:"text-muted-foreground font-normal shrink-0",children:F}),N[27]=F,N[28]=p):p=N[28],N[29]!==f||N[30]!==p?(g=(0,m.jsxs)("span",{className:"flex min-w-0 items-baseline gap-0 font-mono",children:[f,p]}),N[29]=f,N[30]=p,N[31]=g):g=N[31];let G=`${A}/${O}`;return N[32]!==G?(b=(0,m.jsx)(sm,{value:G}),N[32]=G,N[33]=b):b=N[33],N[34]!==g||N[35]!==b?(v=(0,m.jsxs)(lD,{render:d,children:[g,b]}),N[34]=g,N[35]=b,N[36]=v):v=N[36],N[37]!==O||N[38]!==n?(x=O!==n&&(0,m.jsx)(l_,{side:"bottom",children:O}),N[37]=O,N[38]=n,N[39]=x):x=N[39],N[40]!==v||N[41]!==x?(w=(0,m.jsxs)(lI,{children:[v,x]}),N[40]=v,N[41]=x,N[42]=w):w=N[42],N[43]!==P?(k=P>0&&(0,m.jsxs)("span",{className:"font-mono text-[12px] text-diff-green",children:["+",P]}),N[43]=P,N[44]=k):k=N[44],N[45]!==M?(S=M>0&&(0,m.jsxs)("span",{className:"font-mono text-[12px] text-destructive",children:["−",M]}),N[45]=M,N[46]=S):S=N[46],N[47]!==k||N[48]!==S?(E=(0,m.jsxs)("span",{className:"flex items-center gap-1 shrink-0",children:[k,S]}),N[47]=k,N[48]=S,N[49]=E):E=N[49],N[50]!==w||N[51]!==E?(C=(0,m.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[w,E]}),N[50]=w,N[51]=E,N[52]=C):C=N[52],N[53]!==_||N[54]!==u||N[55]!==C?(j=(0,m.jsxs)("h3",{id:_,className:"flex min-w-0 flex-1 items-center gap-2 text-[12px] font-normal",children:[u,C]}),N[53]=_,N[54]=u,N[55]=C,N[56]=j):j=N[56],N[57]!==L?(R=L>0&&(0,m.jsxs)("div",{className:"flex items-center gap-1 px-1.5 py-0.5 rounded-full bg-diff-purple/10 text-diff-purple text-[10px] shrink-0",children:[(0,m.jsx)(l4,{size:10}),L]}),N[57]=L,N[58]=R):R=N[58],N[59]!==j||N[60]!==R||N[61]!==W||N[62]!==V?(T=(0,m.jsx)(lz,{delay:400,children:(0,m.jsxs)("div",{"data-active":W,"data-state":V,className:"flex items-center gap-2 px-3 h-9 border-b border-border bg-card sticky top-[52px] z-10",children:[j,R]})}),N[59]=j,N[60]=R,N[61]=W,N[62]=V,N[63]=T):T=N[63],T},sg=v("BranchIcon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("circle",{cx:6.5,cy:6,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),b.createElement("circle",{cx:6.5,cy:18,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),b.createElement("circle",{cx:17.5,cy:6,r:2,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2}),b.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6.5 8v8M17.5 8v1c0 1.6569-1.3431 3-3 3h-5c-1.6569 0-3 1.3431-3 3v1"})))),sb=v("TrashCan2Icon",(0,b.forwardRef)((e,t)=>b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",ref:t,...e},b.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 6v12c0 1.6569 1.3431 3 3 3h6c1.6569 0 3-1.3431 3-3V6M6 6h12M6 6H4m14 0h2M9 6c0-1.6569 1.3431-3 3-3s3 1.3431 3 3m-1 5v5m-4-5v5"})))),sv=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 text-balance rounded-lg border-dashed p-6 text-center md:p-12",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sx=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("flex max-w-sm flex-col items-center gap-2 text-center",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty-header",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sy=Y("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{defaultVariants:{variant:"default"},variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}}}),sw=e=>{let t,r,n,o,i,l=(0,h.c)(11);l[0]!==e?({className:t,variant:n,...r}=e,l[0]=e,l[1]=t,l[2]=r,l[3]=n):(t=l[1],r=l[2],n=l[3]);let s=void 0===n?"default":n;return l[4]!==t||l[5]!==s?(o=((...e)=>e4(K(e)))(sy({className:t,variant:s})),l[4]=t,l[5]=s,l[6]=o):o=l[6],l[7]!==r||l[8]!==o||l[9]!==s?(i=(0,m.jsx)("div",{className:o,"data-slot":"empty-icon","data-variant":s,...r}),l[7]=r,l[8]=o,l[9]=s,l[10]=i):i=l[10],i},sk=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("font-medium text-lg tracking-tight",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty-title",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sS=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("text-muted-foreground text-sm/relaxed [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty-description",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sE=e=>{let t,r,n,o,i=(0,h.c)(8);return i[0]!==e?({className:t,...r}=e,i[0]=e,i[1]=t,i[2]=r):(t=i[1],r=i[2]),i[3]!==t?(n=((...e)=>e4(K(e)))("flex w-full min-w-0 max-w-sm flex-col items-center gap-4 text-balance text-sm",t),i[3]=t,i[4]=n):n=i[4],i[5]!==r||i[6]!==n?(o=(0,m.jsx)("div",{className:n,"data-slot":"empty-content",...r}),i[5]=r,i[6]=n,i[7]=o):o=i[7],o},sC={"[must-fix]":{border:"border-l-destructive",text:"text-destructive"},"[nit]":{border:"border-l-muted-foreground/40",text:"text-muted-foreground"},"[question]":{border:"border-l-diff-purple",text:"text-diff-purple"},"[suggestion]":{border:"border-l-diff-green",text:"text-diff-green"}},sj=[],sR=null,sT=null,sN=0,sO=()=>{let e,t,r,n,o,i,l,s,a,c,u,d=(0,h.c)(11);return d[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("div",{className:"h-9 border-b border-border bg-card"}),d[0]=e):e=d[0],d[1]===Symbol.for("react.memo_cache_sentinel")?(t=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-diff-green/20"}),d[1]=t):t=d[1],d[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-diff-green/5",children:[t,(0,m.jsx)("div",{className:"h-2 rounded bg-diff-green/15",style:{width:"67%"}})]}),d[2]=r):r=d[2],d[3]===Symbol.for("react.memo_cache_sentinel")?(n=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-muted"}),d[3]=n):n=d[3],d[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3",children:[n,(0,m.jsx)("div",{className:"h-2 rounded bg-muted",style:{width:"82%"}})]}),d[4]=o):o=d[4],d[5]===Symbol.for("react.memo_cache_sentinel")?(i=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-destructive/20"}),d[5]=i):i=d[5],d[6]===Symbol.for("react.memo_cache_sentinel")?(l=(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-destructive/5",children:[i,(0,m.jsx)("div",{className:"h-2 rounded bg-destructive/15",style:{width:"54%"}})]}),d[6]=l):l=d[6],d[7]===Symbol.for("react.memo_cache_sentinel")?(s=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-muted"}),d[7]=s):s=d[7],d[8]===Symbol.for("react.memo_cache_sentinel")?(a=(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3",children:[s,(0,m.jsx)("div",{className:"h-2 rounded bg-muted",style:{width:"78%"}})]}),d[8]=a):a=d[8],d[9]===Symbol.for("react.memo_cache_sentinel")?(c=(0,m.jsx)("div",{className:"h-2 w-6 shrink-0 rounded bg-diff-green/20"}),d[9]=c):c=d[9],d[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,m.jsxs)("div",{className:"animate-pulse",children:[e,(0,m.jsxs)("div",{children:[r,o,l,a,(0,m.jsxs)("div",{className:"flex h-[22px] items-center gap-3 px-3 bg-diff-green/5",children:[c,(0,m.jsx)("div",{className:"h-2 rounded bg-diff-green/15",style:{width:"91%"}})]})]})]}),d[10]=u):u=d[10],u},sP=e=>{let t,r,n,o,i=(0,h.c)(12),{onRender:l,variant:s,changes:a}=e,c="large"===s;i[0]!==l?(t=(0,m.jsx)(e8,{size:"sm",variant:"default",onClick:l,children:"Load diff"}),i[0]=l,i[1]=t):t=i[1];let u=c?"Large diffs are not rendered by default.":"Diff rendering is deferred. Load this file to render its diff.";return i[2]!==u?(r=(0,m.jsx)("p",{className:"text-sm text-muted-foreground",children:u}),i[2]=u,i[3]=r):r=i[3],i[4]!==a||i[5]!==c?(n=c&&void 0!==a?(0,m.jsxs)("p",{className:"text-xs text-muted-foreground/70",children:[a.toLocaleString()," changed lines"]}):null,i[4]=a,i[5]=c,i[6]=n):n=i[6],i[7]!==t||i[8]!==r||i[9]!==n||i[10]!==s?(o=(0,m.jsxs)("div",{className:"mx-4 my-4 flex flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border bg-muted/20 p-6","data-testid":"deferred-diff-placeholder","data-variant":s,children:[t,r,n]}),i[7]=t,i[8]=r,i[9]=n,i[10]=s,i[11]=o):o=i[11],o};class sM extends sd.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("[diffhub] PatchDiff threw",{componentStack:t.componentStack,error:e.message,file:this.props.file})}render(){return this.state.error?(0,m.jsxs)("div",{className:"px-4 py-6 text-sm text-destructive",children:["Failed to render diff for this file: ",this.state.error.message]}):this.props.children}}let sL=(0,su.default)(()=>e.A(15910).then(e=>({default:e.PatchDiff})).catch(e=>(console.error("[diffhub] Failed to load PatchDiff",e),{default:()=>(0,m.jsxs)("div",{className:"p-4 text-destructive text-sm",children:["Failed to load diff viewer: ",String(e)]})})),{loadableGenerated:{modules:[11251]},loading:()=>(0,m.jsx)(sO,{}),ssr:!1}),sA=e=>{let t,r,n,o,i,l,s,a,c,u,d,f=(0,h.c)(32),{onSubmit:p,onCancel:g}=e,[b,v]=(0,sd.useState)(""),[x,y]=(0,sd.useState)(null),[w,k]=(0,sd.useState)(!1);f[0]!==b||f[1]!==w||f[2]!==p?(t=async()=>{let e=b.trim();!e||w||(y(null),k(!0),await p(e,"").catch(sH)||y("Failed to save comment."),k(!1))},f[0]=b,f[1]=w,f[2]=p,f[3]=t):t=f[3];let S=t;f[4]===Symbol.for("react.memo_cache_sentinel")?(r=e=>v(e.target.value),f[4]=r):r=f[4],f[5]!==b||f[6]!==S||f[7]!==g?(n=e=>{("Enter"===e.key&&e.metaKey||"Return"===e.key)&&b.trim()&&S(),"Escape"===e.key&&g()},f[5]=b,f[6]=S,f[7]=g,f[8]=n):n=f[8],f[9]!==b||f[10]!==n?(o=(0,m.jsx)("textarea",{ref:sF,value:b,onChange:r,placeholder:"Add a comment for the AI",rows:3,onKeyDown:n,className:"w-full resize-none rounded border-0 bg-transparent px-0 py-0 font-sans text-sm text-foreground placeholder:text-muted-foreground focus:outline-none"}),f[9]=b,f[10]=n,f[11]=o):o=f[11],f[12]!==g?(i=(0,m.jsx)(e8,{variant:"ghost",size:"sm",onClick:g,children:"Cancel"}),f[12]=g,f[13]=i):i=f[13],f[14]!==b||f[15]!==w?(l=!b.trim()||w,f[14]=b,f[15]=w,f[16]=l):l=f[16],f[17]!==S?(s=()=>void S(),f[17]=S,f[18]=s):s=f[18];let E=w?"Saving…":"Comment";return f[19]!==l||f[20]!==s||f[21]!==E?(a=(0,m.jsx)(e8,{size:"sm",disabled:l,onClick:s,children:E}),f[19]=l,f[20]=s,f[21]=E,f[22]=a):a=f[22],f[23]!==i||f[24]!==a?(c=(0,m.jsxs)("div",{className:"mt-2 flex justify-end gap-2",children:[i,a]}),f[23]=i,f[24]=a,f[25]=c):c=f[25],f[26]!==x?(u=x&&(0,m.jsx)("p",{className:"mt-2 text-xs text-destructive",children:x}),f[26]=x,f[27]=u):u=f[27],f[28]!==c||f[29]!==u||f[30]!==o?(d=(0,m.jsxs)("div",{className:"my-1 mx-4 rounded-md border border-border bg-background p-3 shadow-lg dark:shadow-none",children:[o,c,u]}),f[28]=c,f[29]=u,f[30]=o,f[31]=d):d=f[31],d},sz=e=>{let t,r,n,o,i,l,s,a,c,u,d,f,p,g,b,v,y,k,S,E,C,j,R,T,N,O=(0,h.c)(60),{comment:P,onDelete:M}=e,[L,A]=(0,sd.useState)(!1),[z,I]=(0,sd.useState)(null),[D,_]=(0,sd.useState)(!1),$=(0,sd.useRef)(null);O[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>()=>{$.current&&(clearTimeout($.current),$.current=null)},r=[],O[0]=t,O[1]=r):(t=O[0],r=O[1]),(0,sd.useEffect)(t,r),O[2]!==P.body||O[3]!==P.tag?(n=async()=>{let e=P.tag?`${P.tag} ${P.body}`:P.body;try{await navigator.clipboard.writeText(e),$.current&&clearTimeout($.current),A(!0),$.current=setTimeout(()=>{A(!1),$.current=null},1500)}catch{}},O[2]=P.body,O[3]=P.tag,O[4]=n):n=O[4];let B=n;O[5]!==D||O[6]!==M?(o=async()=>{D||(I(null),_(!0),await M().catch(sW)||I("Failed to delete comment."),_(!1))},O[5]=D,O[6]=M,O[7]=o):o=O[7];let F=o,H=P.tag?sC[P.tag]?.border??"border-l-ring/40":"border-l-ring/40";O[8]!==H?(i=((...e)=>e4(K(e)))("group my-1 mx-4 rounded-md border border-border bg-card shadow-sm dark:shadow-none overflow-hidden border-l-2",H),O[8]=H,O[9]=i):i=O[9],O[10]!==P.tag?(l=P.tag&&(0,m.jsx)("span",{className:((...e)=>e4(K(e)))("shrink-0 mt-0.5 text-[11px]",sC[P.tag]?.text??"text-muted-foreground"),children:P.tag}),O[10]=P.tag,O[11]=l):l=O[11],O[12]!==P.body?(s=(0,m.jsx)("p",{className:"flex-1 text-sm text-foreground leading-relaxed",children:P.body}),O[12]=P.body,O[13]=s):s=O[13];let W=L?"Comment copied":"Copy comment",V=L?"text-diff-green":"text-muted-foreground hover:text-foreground hover:bg-secondary";O[14]!==V?(a=((...e)=>e4(K(e)))("rounded p-1 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50",V),O[14]=V,O[15]=a):a=O[15],O[16]!==B||O[17]!==a||O[18]!==W?(c=(0,m.jsx)("button",{type:"button",onClick:B,"aria-label":W,className:a}),O[16]=B,O[17]=a,O[18]=W,O[19]=c):c=O[19],O[20]!==L?(u=L?(0,m.jsx)(x,{size:12}):(0,m.jsx)(w,{size:12}),O[20]=L,O[21]=u):u=O[21],O[22]!==c||O[23]!==u?(d=(0,m.jsx)(lD,{render:c,children:u}),O[22]=c,O[23]=u,O[24]=d):d=O[24];let U=L?"Copied!":"Copy comment";return O[25]!==U?(f=(0,m.jsx)(l_,{side:"top",children:U}),O[25]=U,O[26]=f):f=O[26],O[27]!==d||O[28]!==f?(p=(0,m.jsxs)(lI,{children:[d,f]}),O[27]=d,O[28]=f,O[29]=p):p=O[29],O[30]!==F||O[31]!==D?(g=(0,m.jsx)("button",{type:"button",onClick:F,"aria-label":"Delete comment",disabled:D,className:"rounded p-1 text-muted-foreground transition-colors hover:text-destructive hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/50"}),O[30]=F,O[31]=D,O[32]=g):g=O[32],O[33]===Symbol.for("react.memo_cache_sentinel")?(b=(0,m.jsx)(sb,{size:12}),O[33]=b):b=O[33],O[34]!==g?(v=(0,m.jsx)(lD,{render:g,children:b}),O[34]=g,O[35]=v):v=O[35],O[36]===Symbol.for("react.memo_cache_sentinel")?(y=(0,m.jsx)(l_,{side:"top",children:"Delete comment"}),O[36]=y):y=O[36],O[37]!==v?(k=(0,m.jsxs)(lI,{children:[v,y]}),O[37]=v,O[38]=k):k=O[38],O[39]!==p||O[40]!==k?(S=(0,m.jsx)(lz,{delay:400,children:(0,m.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity duration-150",children:[p,k]})}),O[39]=p,O[40]=k,O[41]=S):S=O[41],O[42]!==S||O[43]!==l||O[44]!==s?(E=(0,m.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[l,s,S]}),O[42]=S,O[43]=l,O[44]=s,O[45]=E):E=O[45],O[46]!==P.lineNumber?(C=(0,m.jsxs)("span",{children:["L",P.lineNumber]}),O[46]=P.lineNumber,O[47]=C):C=O[47],O[48]!==P.createdAt?(j=P.createdAt&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{children:"·"}),(0,m.jsx)("span",{children:(e=>{let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let n=Math.floor(r/60);if(n<24)return`${n}h ago`;let o=Math.floor(n/24);return`${o}d ago`})(P.createdAt)})]}),O[48]=P.createdAt,O[49]=j):j=O[49],O[50]!==C||O[51]!==j?(R=(0,m.jsxs)("div",{className:"border-t border-border/40 px-3 py-1 flex items-center gap-2 text-[10px] text-muted-foreground/60",children:[C,j]}),O[50]=C,O[51]=j,O[52]=R):R=O[52],O[53]!==z?(T=z&&(0,m.jsx)("p",{className:"px-3 pb-2 text-xs text-destructive",children:z}),O[53]=z,O[54]=T):T=O[54],O[55]!==E||O[56]!==R||O[57]!==T||O[58]!==i?(N=(0,m.jsxs)("div",{className:i,children:[E,R,T]}),O[55]=E,O[56]=R,O[57]=T,O[58]=i,O[59]=N):N=O[59],N},sI=e=>`diff-${encodeURIComponent(e)}`,sD=(0,sd.memo)(function(e){let t,r,n=(0,h.c)(5),{getHoveredLine:o,onCommentTargetChange:i}=e;n[0]!==o||n[1]!==i?(t=()=>{let e=o();e&&i({lineNumber:e.lineNumber,side:e.side})},n[0]=o,n[1]=i,n[2]=t):t=n[2];let l=t;return n[3]!==l?(r=(0,m.jsx)("button",{type:"button",className:"diffhub-gutter-btn",title:"Add comment for AI",onClick:l,children:"+"}),n[3]=l,n[4]=r):r=n[4],r}),s_=(0,sd.memo)(function(e){let t,r,n,o,i,l,s,a=(0,h.c)(59),{file:c,filePatch:u,layout:d,prerenderedHTML:f,shouldRenderPatch:p,comments:b,fileStat:v,isLargeFile:x,collapsed:y,active:w,sectionId:k,onToggleCollapse:S,repoPath:E,commentTarget:C,onCommentTargetChange:j,onRenderPatch:R,onAddComment:T,onDeleteComment:N}=e,O=void 0!==w&&w,{resolvedTheme:P}=(0,g.useTheme)(),M=`${k}-header`,L=`${k}-panel`;a[0]!==C||a[1]!==c||a[2]!==b?(t=b.map(sV),C&&t.push({lineNumber:C.lineNumber,metadata:{file:c,type:"input"},side:C.side}),a[0]=C,a[1]=c,a[2]=b,a[3]=t):t=a[3];let A=t;a[4]!==c||a[5]!==T||a[6]!==j||a[7]!==N?(r=e=>{let t=e.metadata;return t?"input"===t.type?(0,m.jsx)(sA,{onSubmit:async(t,r)=>{let n=await T(c,e.lineNumber,e.side,t,r);return n&&j(null),n},onCancel:()=>j(null)}):"comment"===t.type?(0,m.jsx)(sz,{comment:t.comment,onDelete:()=>N(t.comment.id)}):null:null},a[4]=c,a[5]=T,a[6]=j,a[7]=N,a[8]=r):r=a[8];let z=r;a[9]!==j?(n=e=>(0,m.jsx)(sD,{getHoveredLine:e,onCommentTargetChange:j}),a[9]=j,a[10]=n):n=a[10];let I=n;a[11]!==R?(o=()=>{R()},a[11]=R,a[12]=o):o=a[12];let D=o,_=y&&null===C,$=null;if(!_)if(u)if(p){let e,t,r,n,o,i,l=f?.["light"===P?"light":"dark"],s="light"===P?"light":"dark";a[14]!==s?(e={colorScheme:s},a[14]=s,a[15]=e):e=a[15];let p="split"===d?"split":"unified";a[16]===Symbol.for("react.memo_cache_sentinel")?(t={dark:"github-dark",light:"github-light"},a[16]=t):t=a[16];let h="light"===P?"light":"dark",g=P??"dark";if(a[17]!==g){let e,t;e=sf[g],t=sp[g],r=`
17
17
  [data-diff-span] { border-radius: 0; }
18
18
  :host {
19
19
  /* Base colors for additions/deletions */
@@ -36,5 +36,5 @@ ${t.join("\n")}`})(ei);await navigator.clipboard.writeText(e),ey.current&&clearT
36
36
  --diffs-fg-number-addition-override: ${e.addition};
37
37
  --diffs-fg-number-deletion-override: ${e.deletion};
38
38
  }
39
- `,a[17]=g,a[18]=r}else r=a[18];a[19]!==h||a[20]!==r||a[21]!==p?(n={diffStyle:p,disableFileHeader:!0,disableLineNumbers:!1,enableGutterUtility:!0,expansionLineCount:20,hunkSeparators:"line-info",lineDiffType:"word-alt",lineHoverHighlight:"disabled",maxLineDiffLength:500,overflow:"wrap",theme:t,themeType:h,unsafeCSS:r},a[19]=h,a[20]=r,a[21]=p,a[22]=n):n=a[22],a[23]!==c||a[24]!==u||a[25]!==A||a[26]!==z||a[27]!==I||a[28]!==n||a[29]!==l||a[30]!==e?(o=(0,m.jsx)(sL,{patch:u,prerenderedHTML:l,disableWorkerPool:!0,style:e,options:n,lineAnnotations:A,renderAnnotation:z,renderGutterUtility:I},c),a[23]=c,a[24]=u,a[25]=A,a[26]=z,a[27]=I,a[28]=n,a[29]=l,a[30]=e,a[31]=o):o=a[31],a[32]!==c||a[33]!==o?(i=(0,m.jsx)(sM,{file:c,children:o}),a[32]=c,a[33]=o,a[34]=i):i=a[34],$=i}else{let e,t=x?"large":"auto",r=v?.changes;a[35]!==D||a[36]!==t||a[37]!==r?(e=(0,m.jsx)(sP,{onRender:D,variant:t,changes:r}),a[35]=D,a[36]=t,a[37]=r,a[38]=e):e=a[38],$=e}else{let e;a[13]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("div",{className:"px-4 py-6 text-sm text-muted-foreground",children:"No textual patch available for this file."}),a[13]=e):e=a[13],$=e}let B=v?.insertions??0,F=v?.deletions??0;return a[39]!==O||a[40]!==y||a[41]!==c||a[42]!==b.length||a[43]!==M||a[44]!==S||a[45]!==L||a[46]!==E||a[47]!==B||a[48]!==F?(i=(0,m.jsx)(sh,{file:c,insertions:B,deletions:F,commentCount:b.length,repoPath:E,collapsed:y,active:O,onToggleCollapse:S,headingId:M,panelId:L}),a[39]=O,a[40]=y,a[41]=c,a[42]=b.length,a[43]=M,a[44]=S,a[45]=L,a[46]=E,a[47]=B,a[48]=F,a[49]=i):i=a[49],a[50]!==M||a[51]!==_||a[52]!==$||a[53]!==L?(l=(0,m.jsx)("div",{id:L,role:"region","aria-labelledby":M,hidden:_,children:$}),a[50]=M,a[51]=_,a[52]=$,a[53]=L,a[54]=l):l=a[54],a[55]!==c||a[56]!==i||a[57]!==l?(s=(0,m.jsxs)("div",{"data-filename":c,className:"font-sans",children:[i,l]}),a[55]=c,a[56]=i,a[57]=l,a[58]=s):s=a[58],s}),s$=(0,sd.memo)(function(e){let t,r,n,o,i,l,s,a,c,u=(0,h.c)(33),{file:d,filePatch:f,layout:p,prerenderedHTML:g,deferPatchRendering:b,isLargeFile:v,comments:x,fileStat:y,collapsed:w,active:k,onToggleCollapse:S,onVisible:E,repoPath:C,onAddComment:j,onDeleteComment:R}=e,T=(0,sd.useRef)(null),[N,O]=(0,sd.useState)(null),P=b||v;u[0]!==k||u[1]!==P?(t=()=>!P||k,u[0]=k,u[1]=P,u[2]=t):t=u[2];let[M,L]=(0,sd.useState)(t);!M&&(k||null!==N)&&L(!0),u[3]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{L(!0)},u[3]=r):r=u[3];let A=r,z=M||!P,I=(0,sd.useRef)(E);u[4]!==E?(n=()=>{I.current=E},o=[E],u[4]=E,u[5]=n,u[6]=o):(n=u[5],o=u[6]),(0,sd.useEffect)(n,o),u[7]!==d?(i=()=>{let e=T.current;if(!e||"u"<typeof IntersectionObserver)return;let t=new IntersectionObserver(e=>{let[t]=e;if(t){var r;t.isIntersecting&&t.intersectionRatio>=.35&&(r=I.current,sR=d,sT=r,0===sN&&(sN=requestAnimationFrame(()=>{sN=0;let e=sR,t=sT;sR=null,sT=null,e&&t&&t(e)})))}},{rootMargin:"-52px 0px -55% 0px",threshold:[.35,.6]});return t.observe(e),()=>t.disconnect()},l=[d],u[7]=d,u[8]=i,u[9]=l):(i=u[8],l=u[9]),(0,sd.useEffect)(i,l),u[10]!==d?(s=sI(d),u[10]=d,u[11]=s):s=u[11];let D=s,_=g?.[p];return u[12]!==k||u[13]!==w||u[14]!==N||u[15]!==x||u[16]!==d||u[17]!==f||u[18]!==y||u[19]!==v||u[20]!==p||u[21]!==j||u[22]!==R||u[23]!==S||u[24]!==C||u[25]!==D||u[26]!==z||u[27]!==_?(a=(0,m.jsx)(s_,{file:d,filePatch:f,layout:p,prerenderedHTML:_,shouldRenderPatch:z,comments:x,fileStat:y,isLargeFile:v,collapsed:w,active:k,sectionId:D,onToggleCollapse:S,repoPath:C,commentTarget:N,onCommentTargetChange:O,onRenderPatch:A,onAddComment:j,onDeleteComment:R}),u[12]=k,u[13]=w,u[14]=N,u[15]=x,u[16]=d,u[17]=f,u[18]=y,u[19]=v,u[20]=p,u[21]=j,u[22]=R,u[23]=S,u[24]=C,u[25]=D,u[26]=z,u[27]=_,u[28]=a):a=u[28],u[29]!==d||u[30]!==D||u[31]!==a?(c=(0,m.jsx)("section",{ref:T,id:D,"data-file-section":d,className:"scroll-mt-[52px]",children:a}),u[29]=d,u[30]=D,u[31]=a,u[32]=c):c=u[32],c}),sB=e=>{let t,r,n,o,i,l,s,a=(0,h.c)(47),{patchesByFile:c,prerenderedHTMLByFile:u,layout:d,comments:f,onAddComment:p,onDeleteComment:g,activeFileId:b,fileStats:v,collapsedFiles:x,onToggleCollapse:y,onActiveFileChange:w,repoPath:k}=e;if(a[0]!==v){for(let e of(t=new Map,v))t.set(e.file,e);a[0]=v,a[1]=t}else t=a[1];let S=t;a[2]!==S||a[3]!==v||a[4]!==c?(r=(e=>{let t={files:[],folders:new Map};for(let r of e){let e=r.split("/"),n=t;for(let t=0;t<e.length-1;t+=1){let r=e[t];n.folders.has(r)||n.folders.set(r,{files:[],folders:new Map});let o=n.folders.get(r);o&&(n=o)}n.files.push(r)}let r=[],n=e=>{for(let[,t]of[...e.folders.entries()].toSorted((e,t)=>e[0].localeCompare(t[0])))n(t);let t=[...e.files].toSorted((e,t)=>{let r=e.split("/").at(-1)??e,n=t.split("/").at(-1)??t;return r.localeCompare(n)});r.push(...t)};return n(t),r})([...v.map(sU),...Object.keys(c).filter(e=>!S.has(e))]),a[2]=S,a[3]=v,a[4]=c,a[5]=r):r=a[5];let E=r;if(a[6]!==f){for(let e of(n=new Map,f)){let t=n.get(e.file);t?t.push(e):n.set(e.file,[e])}a[6]=f,a[7]=n}else n=a[7];let C=n;a[8]!==E.length||a[9]!==u?(o=E.length>=24&&0===Object.keys(u??{}).length,a[8]=E.length,a[9]=u,a[10]=o):o=a[10];let j=o;if(a[11]!==y||a[12]!==E){for(let e of(i=new Map,E))i.set(e,()=>y(e));a[11]=y,a[12]=E,a[13]=i}else i=a[13];let R=i;if(0===E.length){let e,t;return a[14]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsxs)(sx,{children:[(0,m.jsx)(sw,{variant:"icon",children:(0,m.jsx)(sg,{})}),(0,m.jsx)(sk,{children:"No changes"}),(0,m.jsx)(sS,{children:"The working tree is clean relative to the base branch"})]}),a[14]=e):e=a[14],a[15]===Symbol.for("react.memo_cache_sentinel")?(t=(0,m.jsxs)(sv,{className:"h-full",children:[e,(0,m.jsx)(sE,{children:(0,m.jsxs)("p",{className:"text-xs text-muted-foreground/60",children:["Press ",(0,m.jsx)(e9,{children:"r"})," to refresh"]})})]}),a[15]=t):t=a[15],t}if(a[16]!==b||a[17]!==x||a[18]!==C||a[19]!==j||a[20]!==S||a[21]!==d||a[22]!==w||a[23]!==p||a[24]!==g||a[25]!==E||a[26]!==c||a[27]!==u||a[28]!==k||a[29]!==R){let e;a[31]!==b||a[32]!==x||a[33]!==C||a[34]!==j||a[35]!==S||a[36]!==d||a[37]!==w||a[38]!==p||a[39]!==g||a[40]!==c||a[41]!==u||a[42]!==k||a[43]!==R?(e=e=>{var t;let r=S.get(e),n=c[e]??"",o=void 0!==r&&(t=n.length,!r.binary&&(r.changes>=500||void 0!==t&&t>=5e5));return(0,m.jsx)(s$,{file:e,filePatch:n,layout:d,prerenderedHTML:u?.[e],deferPatchRendering:j,isLargeFile:o,comments:C.get(e)??sj,fileStat:r,collapsed:x.has(e),active:b===e,onToggleCollapse:R.get(e),onVisible:w,repoPath:k,onAddComment:p,onDeleteComment:g},e)},a[31]=b,a[32]=x,a[33]=C,a[34]=j,a[35]=S,a[36]=d,a[37]=w,a[38]=p,a[39]=g,a[40]=c,a[41]=u,a[42]=k,a[43]=R,a[44]=e):e=a[44],l=E.map(e),a[16]=b,a[17]=x,a[18]=C,a[19]=j,a[20]=S,a[21]=d,a[22]=w,a[23]=p,a[24]=g,a[25]=E,a[26]=c,a[27]=u,a[28]=k,a[29]=R,a[30]=l}else l=a[30];return a[45]!==l?(s=(0,m.jsx)("div",{id:"diff-container",children:l}),a[45]=l,a[46]=s):s=a[46],s};function sF(e){e?.focus({preventScroll:!0})}function sH(){return!1}function sW(){return!1}function sV(e){return{lineNumber:e.lineNumber,metadata:{comment:e,type:"comment"},side:"left"===e.side?"deletions":"additions"}}function sU(e){return e.file}let sq=[1e3,2e3,5e3],sK=(e,t,r)=>{let[n,o]=(0,b.useState)(t);return(0,b.useEffect)(()=>{try{let t=localStorage.getItem(e);null!==t&&(!r||r.includes(t))&&o(t)}catch{}},[e,r]),[n,(0,b.useCallback)(t=>{o(r=>{let n="function"==typeof t?t(r):t;try{localStorage.setItem(e,n)}catch{}return n})},[e])]},sX=["split","stacked"],sY=["all","uncommitted"],sG=e=>{let t,r=(0,h.c)(3),{text:n,pulse:o}=e,i=`text-muted-foreground text-sm${void 0!==o&&o?" animate-pulse":""}`;return r[0]!==i||r[1]!==n?(t=(0,m.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,m.jsx)("div",{className:i,children:n})}),r[0]=i,r[1]=n,r[2]=t):t=r[2],t},sZ=e=>{let t=sI(e);if(window.CSS?.escape)return`#${window.CSS.escape(t)}`;let r=t.replaceAll(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g,"\\$&");return`#${r}`},sJ=e=>{let t,r,n,o,i=(0,h.c)(10),{notice:l}=e,s="border-border bg-muted/40 text-muted-foreground";"destructive"===l.tone?s="border-destructive/30 bg-destructive/10 text-destructive":"warning"===l.tone&&(s="border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400");let a=`border-b px-4 py-2 text-xs ${s}`;return i[0]!==l.label?(t=(0,m.jsx)("span",{className:"font-medium",children:l.label}),i[0]=l.label,i[1]=t):t=i[1],i[2]!==l.detail?(r=l.detail&&(0,m.jsx)("span",{className:"text-xs opacity-80",children:l.detail}),i[2]=l.detail,i[3]=r):r=i[3],i[4]!==t||i[5]!==r?(n=(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[t,r]}),i[4]=t,i[5]=r,i[6]=n):n=i[6],i[7]!==a||i[8]!==n?(o=(0,m.jsx)("div",{className:a,children:n}),i[7]=a,i[8]=n,i[9]=o):o=i[9],o},sQ=e=>{let t,r,n,o=(0,h.c)(33),{filesData:i,deferredDiffData:l,diffError:s,syncNotice:a,layout:c,comments:u,onAddComment:d,onDeleteComment:f,selectedFile:p,collapsedFiles:g,onToggleCollapse:b,onActiveFileChange:v,repoPath:x,diffWatchdogTripped:y,diffHintShown:w,onRetryDiff:k}=e;if(null===i){let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)(sG,{text:"Loading diff…",pulse:!0}),o[0]=e):e=o[0],e}if(0===i.files.length){let e;return o[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)(sG,{text:"No changes"}),o[1]=e):e=o[1],e}if(!l){let e;if(s){let e;return o[2]!==s?(e=(0,m.jsx)(sG,{text:s}),o[2]=s,o[3]=e):e=o[3],e}if(y){let e,t,r;return o[4]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("div",{className:"text-muted-foreground text-sm",children:"Still loading the diff…"}),t=(0,m.jsx)("div",{className:"text-muted-foreground text-xs opacity-80",children:"Large diffs take longer on first load."}),o[4]=e,o[5]=t):(e=o[4],t=o[5]),o[6]!==k?(r=(0,m.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3",children:[e,t,(0,m.jsx)(e8,{size:"sm",variant:"default",onClick:k,children:"Retry"})]}),o[6]=k,o[7]=r):r=o[7],r}if(w){let e,t,r,n=`Loading diff${i?` (${i.files.length} files)…`:"…"}`;return o[8]!==n?(e=(0,m.jsx)("div",{className:"text-muted-foreground animate-pulse text-sm",children:n}),o[8]=n,o[9]=e):e=o[9],o[10]===Symbol.for("react.memo_cache_sentinel")?(t=(0,m.jsx)("div",{className:"text-muted-foreground text-xs opacity-80",children:"Large diffs take longer on first load."}),o[10]=t):t=o[10],o[11]!==e?(r=(0,m.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[e,t]}),o[11]=e,o[12]=r):r=o[12],r}let t=`Loading diff${i?` (${i.files.length} files)…`:"…"}`;return o[13]!==t?(e=(0,m.jsx)(sG,{text:t,pulse:!0}),o[13]=t,o[14]=e):e=o[14],e}return o[15]!==a?(t=a&&(0,m.jsx)(sJ,{notice:a}),o[15]=a,o[16]=t):t=o[16],o[17]!==g||o[18]!==u||o[19]!==l.patchesByFile||o[20]!==l.prerenderedHTMLByFile||o[21]!==i.files||o[22]!==c||o[23]!==v||o[24]!==d||o[25]!==f||o[26]!==b||o[27]!==x||o[28]!==p?(r=(0,m.jsx)(sB,{patchesByFile:l.patchesByFile,prerenderedHTMLByFile:l.prerenderedHTMLByFile,layout:c,comments:u,onAddComment:d,onDeleteComment:f,activeFileId:p,fileStats:i.files,collapsedFiles:g,onToggleCollapse:b,onActiveFileChange:v,repoPath:x}),o[17]=g,o[18]=u,o[19]=l.patchesByFile,o[20]=l.prerenderedHTMLByFile,o[21]=i.files,o[22]=c,o[23]=v,o[24]=d,o[25]=f,o[26]=b,o[27]=x,o[28]=p,o[29]=r):r=o[29],o[30]!==t||o[31]!==r?(n=(0,m.jsxs)(m.Fragment,{children:[t,r]}),o[30]=t,o[31]=r,o[32]=n):n=o[32],n};e.s(["DiffApp",0,({repoPath:e,defaultSidebarOpen:t=!0})=>{let[r,n]=(0,b.useState)(null),[o,i]=(0,b.useState)([]),[l,s]=(0,b.useState)(null),a=(0,b.useRef)(null),[c,u]=(0,b.useState)(null),[d,f]=sK("diffhub-layout","stacked",sX),{resolvedTheme:p}=(0,g.useTheme)(),h="light"===p?"light":"dark",v=(0,b.useRef)(d),x=(0,b.useRef)(h),[y,w]=(0,b.useState)(""),[k,S]=(0,b.useState)(256),[E,C]=(0,b.useState)(!1),[j,R]=(0,b.useState)(null),[T,N]=(0,b.useState)(null),[O,P]=(0,b.useState)(!1),[M,L]=sK("diffhub-diffMode","all",sY),A=(0,b.useRef)(M),z=(0,b.useRef)(null),I=(0,b.useRef)(null),D=(0,b.useRef)(null),_=(0,b.useRef)(null),$=(0,b.useRef)(!1),B=(0,b.useRef)(!1),F=(0,b.useRef)(()=>Promise.resolve()),H=(0,b.useRef)(!1),W=(0,b.useRef)(!1),V=(0,b.useRef)(0),U=(0,b.useRef)(0),q=(0,b.useRef)(null),[K,X]=(0,b.useState)(!1),[Y,G]=(0,b.useState)(!1),[,Z]=(0,b.useTransition)(),[J,Q]=(0,b.useState)(()=>new Set);(0,b.useEffect)(()=>{A.current=M},[M]),(0,b.useEffect)(()=>{Q(new Set(((e,t)=>{try{let r=localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}})(`diffhub-collapsed:${e}`,[])))},[e]);let ee=(0,b.useCallback)(t=>{Q(r=>{let n=t(r);if(n===r)return r;try{localStorage.setItem(`diffhub-collapsed:${e}`,JSON.stringify([...n]))}catch{}return n})},[e]),et=(0,b.useCallback)(()=>{let e=new URLSearchParams;"uncommitted"===A.current&&e.set("mode","uncommitted");let t=e.toString();return t?`?${t}`:""},[]),er=(0,b.useCallback)(()=>{let e=new URLSearchParams;_.current&&e.set("generation",_.current),"uncommitted"===A.current&&e.set("mode","uncommitted"),e.set("layout",v.current),e.set("theme",x.current);let t=e.toString();return t?`?${t}`:""},[]),en=(0,b.useCallback)(async e=>{let t=_.current,r=D.current;q.current=Date.now(),X(!1),N(null),console.info("[diffhub] fetchDiff start",{fingerprint:r,generation:t,mode:A.current,requestId:e});let n=new AbortController,o=setTimeout(()=>{n.abort(Error("Diff request timed out"))},15e3);try{var i,l;let o,s,a=await fetch(`/api/diff${er()}`,{signal:n.signal});if(!a.ok){let n=(await a.json().catch(()=>({error:"Failed to load diff"}))).error??`Failed to load diff (${a.status})`;console.error("[diffhub] fetchDiff non-ok response",{fingerprint:r,generation:t,mode:A.current,requestId:e,responseStatus:a.status,responseStatusText:a.statusText,serverError:n}),e===V.current&&N(n);return}let c=(i=await a.json(),l=r??"unknown",o=i.patchesByFile??Object.fromEntries((e=>{let t=new Map,r=/^diff --git a\/(.+?) b\/(.+)$/gm,n=[],o=r.exec(e);for(;o;)n.push({file:o[2],start:o.index}),o=r.exec(e);for(let[r,o]of n.entries()){let i=n[r+1]?.start??e.length,l=e.slice(o.start,i).trimEnd();t.set(o.file,l?`${l}
40
- `:"")}return t})(i.patch??"")),{baseBranch:i.baseBranch,branch:i.branch,generation:i.generation,mergeBase:i.mergeBase,patchesByFile:o,prerenderedHTMLByFile:i.prerenderedHTMLByFile,reviewKeysByFile:i.reviewKeysByFile??(s=i.generation,Object.fromEntries(Object.entries(o).map(([e,t])=>[e,`${s}:${(e=>{let t=0;for(let r=0;r<e.length;r+=1)t=Math.trunc(Math.imul(31,t)+(e.codePointAt(r)??0));return Math.abs(t).toString(36)})(`${e}:${t}`)}`]))),sourceFingerprint:l});if(e!==V.current||r!==D.current||t!==_.current){console.info("[diffhub] fetchDiff response stale",{fingerprint:r,generation:t,latestRequestId:V.current,requestId:e}),null!==_.current&&(U.current+=1,U.current>=3&&(console.warn("[diffhub] fetchDiff stale-drop limit reached, invalidating",{drops:U.current}),U.current=0,V.current+=1,I.current=null,u(null)),W.current=!0);return}U.current=0,console.info("[diffhub] fetchDiff success",{fileCount:Object.keys(c.patchesByFile).length,fingerprint:r,generation:c.generation,requestId:e}),Z(()=>u(c))}catch(n){console.error("[diffhub] fetchDiff threw",{error:n,fingerprint:r,generation:t,mode:A.current,requestId:e}),e===V.current&&N(n instanceof Error?n.message:String(n))}finally{clearTimeout(o)}},[er,Z]),eo=(0,b.useCallback)(async()=>{if(W.current=!0,!H.current){for(H.current=!0,P(!0);W.current;)W.current=!1,V.current+=1,await en(V.current);H.current=!1,P(!1)}},[en]);(0,b.useEffect)(()=>{(v.current!==d||x.current!==h)&&(v.current=d,x.current=h,V.current+=1,I.current=null,u(null),eo())},[d,h,eo]);let ei=(0,b.useRef)(c),el=(0,b.useRef)(T);(0,b.useEffect)(()=>{ei.current=c},[c]),(0,b.useEffect)(()=>{el.current=T},[T]);let es=(0,b.useCallback)(e=>{if(D.current=e.fingerprint,_.current=e.generation,0===e.files.length){a.current=null,V.current+=1,(0,b.startTransition)(()=>{s(null),u(null)}),N(null),I.current=e.fingerprint;return}let t=a.current;t&&e.files.some(e=>e.file===t)||(a.current=t=e.files[0]?.file??null,(0,b.startTransition)(()=>s(t)));let r=e.fingerprint!==I.current,n=ei.current?.generation===e.generation;(r||!n||null!==el.current)&&(I.current=e.fingerprint,r&&(V.current+=1),eo())},[eo]),ea=(0,b.useCallback)(()=>{V.current+=1,I.current=null,D.current=null,_.current=null,u(null),N(null)},[]),ec=(0,b.useCallback)(async(e=!1)=>{let t=()=>{e||C(!1),$.current=!1,B.current&&(B.current=!1,queueMicrotask(()=>{F.current(!0)}))};if($.current){B.current=!0;return}$.current=!0,e||C(!0),R(null);let r=await Promise.all([fetch(`/api/files${et()}`),fetch("/api/comments").then(async e=>{if(!e.ok)throw Error(`Failed to load comments (${e.status})`);return await e.json()}).catch(e=>(console.error("[diffhub] comments refresh failed",{error:e}),null))]).catch(e=>(R(e instanceof Error?e.message:String(e)),null));if(!r)return void t();let[o,l]=r;if(!o.ok){R((await o.json().catch(()=>({error:"Network error"}))).error??"Failed to load files"),t();return}let s=await o.json();(0,b.startTransition)(()=>{n(s),null!==l&&i(l)}),es(s),t()},[et,es]);(0,b.useEffect)(()=>{F.current=ec},[ec]);let eu=(0,b.useRef)(!1),ed=(0,b.useRef)(!1);(0,b.useEffect)(()=>{let e=null,t=()=>{eu.current=!0,e&&clearTimeout(e),e=setTimeout(()=>{eu.current=!1,ed.current&&(ed.current=!1,F.current(!0))},200)};return window.addEventListener("scroll",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),e&&clearTimeout(e)}},[]);let ef=(0,b.useCallback)(()=>{if(eu.current){ed.current=!0;return}F.current(!0)},[]),ep=(e=>{let[t,r]=(0,b.useState)("connecting"),n=(0,b.useEffectEvent)(e),o=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let e=!1,t=0,i=null,l=new AbortController,s=async()=>{if(!e)try{let i=null===o.current?"":`?revision=${o.current}`,a=await fetch(`/api/watch${i}`,{cache:"no-store",signal:l.signal});if(e)return;if(!a.ok)throw Error(`Watch request failed with status ${a.status}`);let c=await a.json();if(e)return;t=0,r("live");let u=o.current;o.current=c.revision,c.changed&&null!==u&&c.revision!==u&&n(),e||queueMicrotask(()=>{e||s()})}catch(n){if(e||l.signal.aborted)return;if(console.error("[diffhub] file watch failed",{error:n,failureCount:t+=1}),t>10){console.error("[diffhub] file watch: max retries exceeded, stopping"),r("fallback");return}r(t>=sq.length?"fallback":"connecting"),i=setTimeout(()=>{i=null,e||s()},sq[Math.min(t-1,sq.length-1)])}};return r("connecting"),s(),()=>{e=!0,l.abort(),i&&clearTimeout(i)}},[]),t})(ef),em=(0,b.useCallback)(()=>{ec()},[ec]),eh=(0,b.useCallback)(()=>{X(!1),G(!1),N(null),V.current+=1,I.current=null,u(null),eo()},[eo]);(0,b.useEffect)(()=>{ec()},[ec]),(0,b.useEffect)(()=>{let e=setInterval(ef,"live"===ep?3e4:5e3);return()=>clearInterval(e)},[ep,ef]),(0,b.useEffect)(()=>{if(!r||0===r.files.length||c||T)return void X(!1);let e=setTimeout(()=>X(!0),2e4);return()=>clearTimeout(e)},[r,c,T]),(0,b.useEffect)(()=>{if(!r||0===r.files.length||c||T)return void G(!1);let e=setTimeout(()=>G(!0),1e4);return()=>clearTimeout(e)},[r,c,T]);let eg=(0,b.useCallback)((e,t=800)=>{z.current={file:e,until:Date.now()+t},a.current=e,(0,b.startTransition)(()=>s(e))},[]),eb=(0,b.useCallback)((e,t="smooth")=>{eg(e),ee(t=>{if(t.has(e)){let r=new Set(t);return r.delete(e),r}return t});let r=e=>{e.scrollIntoView({behavior:t,block:"start"})},n=document.querySelector(sZ(e));if(n)return void r(n);let o=document.querySelector("#diff-container");if(!o)return;let i=new MutationObserver(()=>{let t=document.querySelector(sZ(e));t&&(i.disconnect(),r(t))});i.observe(o,{childList:!0,subtree:!0}),setTimeout(()=>i.disconnect(),5e3)},[eg,ee]),ev=(0,b.useCallback)(e=>{let t=z.current;if(t){if(Date.now()>t.until)z.current=null;else if(t.file!==e)return}a.current!==e&&(a.current=e,(0,b.startTransition)(()=>s(e)))},[]),ex=(0,b.useCallback)(e=>{eg(e),ee(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[eg,ee]),ey=(0,b.useCallback)(()=>{ee(()=>new Set((r?.files??[]).map(e=>e.file)))},[r,ee]),ew=(0,b.useCallback)(()=>{ee(()=>new Set)},[ee]);(0,b.useEffect)(()=>{let e=e=>{if(!(e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLInputElement)){if("s"!==e.key||e.metaKey||e.ctrlKey||f(e=>"split"===e?"stacked":"split"),"/"!==e.key&&"t"!==e.key.toLowerCase()||e.metaKey||e.ctrlKey||(e.preventDefault(),document.querySelector('input[placeholder="Filter files…"]')?.focus()),"c"===e.key.toLowerCase()&&!e.metaKey&&!e.ctrlKey&&l){if(e.shiftKey)return void ey();ex(l)}if("e"!==e.key.toLowerCase()||!e.shiftKey||e.metaKey||e.ctrlKey||ew(),"r"!==e.key||e.metaKey||e.ctrlKey||ec(),"j"===e.key||"k"===e.key){let t=r?.files??[];if(0===t.length)return;let n=t.findIndex(e=>e.file===l),o="j"===e.key?t[n+1]:t[n-1];o&&eb(o.file)}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ey,ew,r,ec,eb,l,f,ex]);let ek=(0,b.useCallback)(e=>{A.current=e,L(e),ea(),ec(!1)},[ea,ec,L]),eS=(0,b.useCallback)(async(e,t,r,n,o)=>{let l=await fetch("/api/comments",{body:JSON.stringify({body:n,file:e,lineNumber:t,side:"deletions"===r?"left":"right",tag:o}),headers:{"Content-Type":"application/json"},method:"POST"});if(!l.ok)return console.error("[diffhub] add comment failed",{error:(await l.json().catch(()=>({error:"Failed to save comment"}))).error??`Failed to save comment (${l.status})`}),!1;let s=await l.json();return i(e=>[...e,s]),!0},[]),eE=(0,b.useCallback)(async e=>{let t=await fetch(`/api/comments?id=${e}`,{method:"DELETE"});return t.ok?(i(t=>t.filter(t=>t.id!==e)),!0):(console.error("[diffhub] delete comment failed",{error:(await t.json().catch(()=>({error:"Failed to delete comment"}))).error??`Failed to delete comment (${t.status})`}),!1)},[]),eC=j&&null!==r?{detail:j,label:"Background refresh failed",tone:"destructive"}:T&&c?{detail:T,label:"Diff refresh failed",tone:"destructive"}:"fallback"===ep?{detail:"Live watch is unavailable, so the app is polling every 5 seconds",label:"Polling fallback",tone:"warning"}:null;return j&&null===r?(0,m.jsx)(lF,{className:"min-h-svh",defaultOpen:t,children:(0,m.jsxs)(lV,{className:"flex flex-col h-svh items-center justify-center gap-4",children:[(0,m.jsxs)("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-6 py-4 text-sm text-destructive max-w-md text-center",children:[(0,m.jsx)("p",{className:"font-semibold mb-1",children:"Failed to load diff"}),(0,m.jsx)("p",{className:"text-xs opacity-80",children:j})]}),(0,m.jsx)(e8,{variant:"outline",onClick:em,children:"Retry"})]})}):(0,m.jsxs)(lF,{className:"min-h-svh",defaultOpen:t,style:{"--sidebar-width":`${k}px`},children:[(0,m.jsx)(sc,{files:r?.files??[],selectedFile:l,onSelectFile:eb,comments:o,filterQuery:y,onFilterChange:w,isLoading:null===r,insertions:r?.insertions??0,deletions:r?.deletions??0,sidebarWidth:k,onSidebarWidthChange:S}),(0,m.jsxs)(lV,{className:"flex flex-col min-h-svh",children:[(0,m.jsx)("div",{className:"sticky top-0 z-20",children:(0,m.jsx)(l0,{branch:r?.branch??"…",baseBranch:r?.baseBranch??"main",refreshing:E||O,fileWatchState:ep,comments:o,diffMode:M,onDiffModeChange:ek,layout:d,onLayoutChange:f,syncNotice:eC})}),(0,m.jsx)(sQ,{filesData:r,deferredDiffData:c,diffError:T,syncNotice:eC,layout:d,comments:o,onAddComment:eS,onDeleteComment:eE,selectedFile:l,collapsedFiles:J,onToggleCollapse:ex,onActiveFileChange:ev,repoPath:e,diffWatchdogTripped:K,diffHintShown:Y,onRetryDiff:eh})]})]})}],93190)}]);
39
+ `,a[17]=g,a[18]=r}else r=a[18];a[19]!==h||a[20]!==r||a[21]!==p?(n={diffStyle:p,disableFileHeader:!0,disableLineNumbers:!1,enableGutterUtility:!0,expansionLineCount:20,hunkSeparators:"line-info",lineDiffType:"word-alt",lineHoverHighlight:"disabled",maxLineDiffLength:500,overflow:"wrap",theme:t,themeType:h,unsafeCSS:r},a[19]=h,a[20]=r,a[21]=p,a[22]=n):n=a[22],a[23]!==c||a[24]!==u||a[25]!==A||a[26]!==z||a[27]!==I||a[28]!==n||a[29]!==l||a[30]!==e?(o=(0,m.jsx)(sL,{patch:u,prerenderedHTML:l,disableWorkerPool:!0,style:e,options:n,lineAnnotations:A,renderAnnotation:z,renderGutterUtility:I},c),a[23]=c,a[24]=u,a[25]=A,a[26]=z,a[27]=I,a[28]=n,a[29]=l,a[30]=e,a[31]=o):o=a[31],a[32]!==c||a[33]!==o?(i=(0,m.jsx)(sM,{file:c,children:o}),a[32]=c,a[33]=o,a[34]=i):i=a[34],$=i}else{let e,t=x?"large":"auto",r=v?.changes;a[35]!==D||a[36]!==t||a[37]!==r?(e=(0,m.jsx)(sP,{onRender:D,variant:t,changes:r}),a[35]=D,a[36]=t,a[37]=r,a[38]=e):e=a[38],$=e}else{let e;a[13]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("div",{className:"px-4 py-6 text-sm text-muted-foreground",children:"No textual patch available for this file."}),a[13]=e):e=a[13],$=e}let B=v?.insertions??0,F=v?.deletions??0;return a[39]!==O||a[40]!==y||a[41]!==c||a[42]!==b.length||a[43]!==M||a[44]!==S||a[45]!==L||a[46]!==E||a[47]!==B||a[48]!==F?(i=(0,m.jsx)(sh,{file:c,insertions:B,deletions:F,commentCount:b.length,repoPath:E,collapsed:y,active:O,onToggleCollapse:S,headingId:M,panelId:L}),a[39]=O,a[40]=y,a[41]=c,a[42]=b.length,a[43]=M,a[44]=S,a[45]=L,a[46]=E,a[47]=B,a[48]=F,a[49]=i):i=a[49],a[50]!==M||a[51]!==_||a[52]!==$||a[53]!==L?(l=(0,m.jsx)("div",{id:L,role:"region","aria-labelledby":M,hidden:_,children:$}),a[50]=M,a[51]=_,a[52]=$,a[53]=L,a[54]=l):l=a[54],a[55]!==c||a[56]!==i||a[57]!==l?(s=(0,m.jsxs)("div",{"data-filename":c,className:"font-sans",children:[i,l]}),a[55]=c,a[56]=i,a[57]=l,a[58]=s):s=a[58],s}),s$=(0,sd.memo)(function(e){let t,r,n,o,i,l,s,a,c,u,d=(0,h.c)(41),{file:f,filePatch:p,layout:g,prerenderedHTML:b,deferPatchRendering:v,isLargeFile:x,forceRender:y,comments:w,fileStat:k,collapsed:S,active:E,onToggleCollapse:C,onVisible:j,repoPath:R,onAddComment:T,onDeleteComment:N}=e,O=(0,sd.useRef)(null),[P,M]=(0,sd.useState)(null),L=v||x;d[0]!==y||d[1]!==L?(t=()=>!L||y,d[0]=y,d[1]=L,d[2]=t):t=d[2];let[A,z]=(0,sd.useState)(t);!A&&(y||null!==P)&&z(!0),d[3]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{z(!0)},d[3]=r):r=d[3];let I=r,D=A||y||null!==P||!L,_=(0,sd.useRef)(j);d[4]!==j?(n=()=>{_.current=j},o=[j],d[4]=j,d[5]=n,d[6]=o):(n=d[5],o=d[6]),(0,sd.useEffect)(n,o),d[7]!==f?(i=()=>{let e=O.current;if(!e||"u"<typeof IntersectionObserver)return;let t=new IntersectionObserver(e=>{let[t]=e;if(t){var r;t.isIntersecting&&t.intersectionRatio>=.35&&(r=_.current,sR=f,sT=r,0===sN&&(sN=requestAnimationFrame(()=>{sN=0;let e=sR,t=sT;sR=null,sT=null,e&&t&&t(e)})))}},{rootMargin:"-52px 0px -55% 0px",threshold:[.35,.6]});return t.observe(e),()=>t.disconnect()},l=[f],d[7]=f,d[8]=i,d[9]=l):(i=d[8],l=d[9]),(0,sd.useEffect)(i,l),d[10]!==f?(s=sI(f),d[10]=f,d[11]=s):s=d[11];let $=s;e:{let e,t,r=E?"auto":"none";if(S||D){let e;d[12]!==r?(e={overflowAnchor:r},d[12]=r,d[13]=e):e=d[13],a=e;break e}if(d[14]!==k)e=Math.min(960,Math.max(128,22*(k?.changes??1))),d[14]=k,d[15]=e;else e=d[15];d[16]!==r||d[17]!==e?(t={minHeight:e,overflowAnchor:r},d[16]=r,d[17]=e,d[18]=t):t=d[18],a=t}let B=a,F=b?.[g];return d[19]!==E||d[20]!==S||d[21]!==P||d[22]!==w||d[23]!==f||d[24]!==p||d[25]!==k||d[26]!==x||d[27]!==g||d[28]!==T||d[29]!==N||d[30]!==C||d[31]!==R||d[32]!==$||d[33]!==D||d[34]!==F?(c=(0,m.jsx)(s_,{file:f,filePatch:p,layout:g,prerenderedHTML:F,shouldRenderPatch:D,comments:w,fileStat:k,isLargeFile:x,collapsed:S,active:E,sectionId:$,onToggleCollapse:C,repoPath:R,commentTarget:P,onCommentTargetChange:M,onRenderPatch:I,onAddComment:T,onDeleteComment:N}),d[19]=E,d[20]=S,d[21]=P,d[22]=w,d[23]=f,d[24]=p,d[25]=k,d[26]=x,d[27]=g,d[28]=T,d[29]=N,d[30]=C,d[31]=R,d[32]=$,d[33]=D,d[34]=F,d[35]=c):c=d[35],d[36]!==f||d[37]!==$||d[38]!==B||d[39]!==c?(u=(0,m.jsx)("section",{ref:O,id:$,"data-file-section":f,className:"scroll-mt-[52px]",style:B,children:c}),d[36]=f,d[37]=$,d[38]=B,d[39]=c,d[40]=u):u=d[40],u}),sB=e=>{let t,r,n,o,i,l,s,a=(0,h.c)(49),{patchesByFile:c,prerenderedHTMLByFile:u,layout:d,comments:f,onAddComment:p,onDeleteComment:g,activeFileId:b,fileStats:v,collapsedFiles:x,onToggleCollapse:y,onActiveFileChange:w,forceRenderFiles:k,repoPath:S}=e;if(a[0]!==v){for(let e of(t=new Map,v))t.set(e.file,e);a[0]=v,a[1]=t}else t=a[1];let E=t;a[2]!==E||a[3]!==v||a[4]!==c?(r=(e=>{let t={files:[],folders:new Map};for(let r of e){let e=r.split("/"),n=t;for(let t=0;t<e.length-1;t+=1){let r=e[t];n.folders.has(r)||n.folders.set(r,{files:[],folders:new Map});let o=n.folders.get(r);o&&(n=o)}n.files.push(r)}let r=[],n=e=>{for(let[,t]of[...e.folders.entries()].toSorted((e,t)=>e[0].localeCompare(t[0])))n(t);let t=[...e.files].toSorted((e,t)=>{let r=e.split("/").at(-1)??e,n=t.split("/").at(-1)??t;return r.localeCompare(n)});r.push(...t)};return n(t),r})([...v.map(sU),...Object.keys(c).filter(e=>!E.has(e))]),a[2]=E,a[3]=v,a[4]=c,a[5]=r):r=a[5];let C=r;if(a[6]!==f){for(let e of(n=new Map,f)){let t=n.get(e.file);t?t.push(e):n.set(e.file,[e])}a[6]=f,a[7]=n}else n=a[7];let j=n;a[8]!==C.length||a[9]!==u?(o=C.length>=24&&0===Object.keys(u??{}).length,a[8]=C.length,a[9]=u,a[10]=o):o=a[10];let R=o;if(a[11]!==y||a[12]!==C){for(let e of(i=new Map,C))i.set(e,()=>y(e));a[11]=y,a[12]=C,a[13]=i}else i=a[13];let T=i;if(0===C.length){let e,t;return a[14]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsxs)(sx,{children:[(0,m.jsx)(sw,{variant:"icon",children:(0,m.jsx)(sg,{})}),(0,m.jsx)(sk,{children:"No changes"}),(0,m.jsx)(sS,{children:"The working tree is clean relative to the base branch"})]}),a[14]=e):e=a[14],a[15]===Symbol.for("react.memo_cache_sentinel")?(t=(0,m.jsxs)(sv,{className:"h-full",children:[e,(0,m.jsx)(sE,{children:(0,m.jsxs)("p",{className:"text-xs text-muted-foreground/60",children:["Press ",(0,m.jsx)(e9,{children:"r"})," to refresh"]})})]}),a[15]=t):t=a[15],t}if(a[16]!==b||a[17]!==x||a[18]!==j||a[19]!==R||a[20]!==E||a[21]!==k||a[22]!==d||a[23]!==w||a[24]!==p||a[25]!==g||a[26]!==C||a[27]!==c||a[28]!==u||a[29]!==S||a[30]!==T){let e;a[32]!==b||a[33]!==x||a[34]!==j||a[35]!==R||a[36]!==E||a[37]!==k||a[38]!==d||a[39]!==w||a[40]!==p||a[41]!==g||a[42]!==c||a[43]!==u||a[44]!==S||a[45]!==T?(e=e=>{var t;let r=E.get(e),n=c[e]??"",o=void 0!==r&&(t=n.length,!r.binary&&(r.changes>=500||void 0!==t&&t>=5e5));return(0,m.jsx)(s$,{file:e,filePatch:n,layout:d,prerenderedHTML:u?.[e],deferPatchRendering:R,isLargeFile:o,forceRender:k?.has(e)??!1,comments:j.get(e)??sj,fileStat:r,collapsed:x.has(e),active:b===e,onToggleCollapse:T.get(e),onVisible:w,repoPath:S,onAddComment:p,onDeleteComment:g},e)},a[32]=b,a[33]=x,a[34]=j,a[35]=R,a[36]=E,a[37]=k,a[38]=d,a[39]=w,a[40]=p,a[41]=g,a[42]=c,a[43]=u,a[44]=S,a[45]=T,a[46]=e):e=a[46],l=C.map(e),a[16]=b,a[17]=x,a[18]=j,a[19]=R,a[20]=E,a[21]=k,a[22]=d,a[23]=w,a[24]=p,a[25]=g,a[26]=C,a[27]=c,a[28]=u,a[29]=S,a[30]=T,a[31]=l}else l=a[31];return a[47]!==l?(s=(0,m.jsx)("div",{id:"diff-container",children:l}),a[47]=l,a[48]=s):s=a[48],s};function sF(e){e?.focus({preventScroll:!0})}function sH(){return!1}function sW(){return!1}function sV(e){return{lineNumber:e.lineNumber,metadata:{comment:e,type:"comment"},side:"left"===e.side?"deletions":"additions"}}function sU(e){return e.file}let sq=[1e3,2e3,5e3],sK=(e,t,r)=>{let[n,o]=(0,b.useState)(t);return(0,b.useEffect)(()=>{try{let t=localStorage.getItem(e);null!==t&&(!r||r.includes(t))&&o(t)}catch{}},[e,r]),[n,(0,b.useCallback)(t=>{o(r=>{let n="function"==typeof t?t(r):t;try{localStorage.setItem(e,n)}catch{}return n})},[e])]},sX=["split","stacked"],sY=["all","uncommitted"],sG=e=>{let t,r=(0,h.c)(3),{text:n,pulse:o}=e,i=`text-muted-foreground text-sm${void 0!==o&&o?" animate-pulse":""}`;return r[0]!==i||r[1]!==n?(t=(0,m.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,m.jsx)("div",{className:i,children:n})}),r[0]=i,r[1]=n,r[2]=t):t=r[2],t},sZ=e=>{let t=sI(e);if(window.CSS?.escape)return`#${window.CSS.escape(t)}`;let r=t.replaceAll(/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g,"\\$&");return`#${r}`},sJ=e=>{let t,r,n,o,i=(0,h.c)(10),{notice:l}=e,s="border-border bg-muted/40 text-muted-foreground";"destructive"===l.tone?s="border-destructive/30 bg-destructive/10 text-destructive":"warning"===l.tone&&(s="border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400");let a=`border-b px-4 py-2 text-xs ${s}`;return i[0]!==l.label?(t=(0,m.jsx)("span",{className:"font-medium",children:l.label}),i[0]=l.label,i[1]=t):t=i[1],i[2]!==l.detail?(r=l.detail&&(0,m.jsx)("span",{className:"text-xs opacity-80",children:l.detail}),i[2]=l.detail,i[3]=r):r=i[3],i[4]!==t||i[5]!==r?(n=(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[t,r]}),i[4]=t,i[5]=r,i[6]=n):n=i[6],i[7]!==a||i[8]!==n?(o=(0,m.jsx)("div",{className:a,children:n}),i[7]=a,i[8]=n,i[9]=o):o=i[9],o},sQ=e=>{let t,r,n,o=(0,h.c)(34),{filesData:i,deferredDiffData:l,diffError:s,syncNotice:a,layout:c,comments:u,onAddComment:d,onDeleteComment:f,selectedFile:p,collapsedFiles:g,forceRenderFiles:b,onToggleCollapse:v,onActiveFileChange:x,repoPath:y,diffWatchdogTripped:w,diffHintShown:k,onRetryDiff:S}=e;if(null===i){let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)(sG,{text:"Loading diff…",pulse:!0}),o[0]=e):e=o[0],e}if(0===i.files.length){let e;return o[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)(sG,{text:"No changes"}),o[1]=e):e=o[1],e}if(!l){let e;if(s){let e;return o[2]!==s?(e=(0,m.jsx)(sG,{text:s}),o[2]=s,o[3]=e):e=o[3],e}if(w){let e,t,r;return o[4]===Symbol.for("react.memo_cache_sentinel")?(e=(0,m.jsx)("div",{className:"text-muted-foreground text-sm",children:"Still loading the diff…"}),t=(0,m.jsx)("div",{className:"text-muted-foreground text-xs opacity-80",children:"Large diffs take longer on first load."}),o[4]=e,o[5]=t):(e=o[4],t=o[5]),o[6]!==S?(r=(0,m.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-3",children:[e,t,(0,m.jsx)(e8,{size:"sm",variant:"default",onClick:S,children:"Retry"})]}),o[6]=S,o[7]=r):r=o[7],r}if(k){let e,t,r,n=`Loading diff${i?` (${i.files.length} files)…`:"…"}`;return o[8]!==n?(e=(0,m.jsx)("div",{className:"text-muted-foreground animate-pulse text-sm",children:n}),o[8]=n,o[9]=e):e=o[9],o[10]===Symbol.for("react.memo_cache_sentinel")?(t=(0,m.jsx)("div",{className:"text-muted-foreground text-xs opacity-80",children:"Large diffs take longer on first load."}),o[10]=t):t=o[10],o[11]!==e?(r=(0,m.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[e,t]}),o[11]=e,o[12]=r):r=o[12],r}let t=`Loading diff${i?` (${i.files.length} files)…`:"…"}`;return o[13]!==t?(e=(0,m.jsx)(sG,{text:t,pulse:!0}),o[13]=t,o[14]=e):e=o[14],e}return o[15]!==a?(t=a&&(0,m.jsx)(sJ,{notice:a}),o[15]=a,o[16]=t):t=o[16],o[17]!==g||o[18]!==u||o[19]!==l.patchesByFile||o[20]!==l.prerenderedHTMLByFile||o[21]!==i.files||o[22]!==b||o[23]!==c||o[24]!==x||o[25]!==d||o[26]!==f||o[27]!==v||o[28]!==y||o[29]!==p?(r=(0,m.jsx)(sB,{patchesByFile:l.patchesByFile,prerenderedHTMLByFile:l.prerenderedHTMLByFile,layout:c,comments:u,onAddComment:d,onDeleteComment:f,activeFileId:p,fileStats:i.files,collapsedFiles:g,forceRenderFiles:b,onToggleCollapse:v,onActiveFileChange:x,repoPath:y}),o[17]=g,o[18]=u,o[19]=l.patchesByFile,o[20]=l.prerenderedHTMLByFile,o[21]=i.files,o[22]=b,o[23]=c,o[24]=x,o[25]=d,o[26]=f,o[27]=v,o[28]=y,o[29]=p,o[30]=r):r=o[30],o[31]!==t||o[32]!==r?(n=(0,m.jsxs)(m.Fragment,{children:[t,r]}),o[31]=t,o[32]=r,o[33]=n):n=o[33],n};e.s(["DiffApp",0,({repoPath:e,defaultSidebarOpen:t=!0})=>{let[r,n]=(0,b.useState)(null),[o,i]=(0,b.useState)([]),[l,s]=(0,b.useState)(null),a=(0,b.useRef)(null),[c,u]=(0,b.useState)(null),[d,f]=sK("diffhub-layout","stacked",sX),{resolvedTheme:p}=(0,g.useTheme)(),h="light"===p?"light":"dark",v=(0,b.useRef)(d),x=(0,b.useRef)(h),[y,w]=(0,b.useState)(""),[k,S]=(0,b.useState)(256),[E,C]=(0,b.useState)(!1),[j,R]=(0,b.useState)(null),[T,N]=(0,b.useState)(null),[O,P]=(0,b.useState)(!1),[M,L]=sK("diffhub-diffMode","all",sY),A=(0,b.useRef)(M),z=(0,b.useRef)(null),I=(0,b.useRef)(null),D=(0,b.useRef)(null),_=(0,b.useRef)(null),$=(0,b.useRef)(!1),B=(0,b.useRef)(!1),F=(0,b.useRef)(()=>Promise.resolve()),H=(0,b.useRef)(!1),W=(0,b.useRef)(!1),V=(0,b.useRef)(0),U=(0,b.useRef)(0),q=(0,b.useRef)(null),[K,X]=(0,b.useState)(!1),[Y,G]=(0,b.useState)(!1),[,Z]=(0,b.useTransition)(),[J,Q]=(0,b.useState)(()=>new Set),[ee,et]=(0,b.useState)(()=>new Set);(0,b.useEffect)(()=>{A.current=M},[M]),(0,b.useEffect)(()=>{Q(new Set(((e,t)=>{try{let r=localStorage.getItem(e);return r?JSON.parse(r):t}catch{return t}})(`diffhub-collapsed:${e}`,[])))},[e]);let er=(0,b.useCallback)(t=>{Q(r=>{let n=t(r);if(n===r)return r;try{localStorage.setItem(`diffhub-collapsed:${e}`,JSON.stringify([...n]))}catch{}return n})},[e]),en=(0,b.useCallback)(()=>{let e=new URLSearchParams;"uncommitted"===A.current&&e.set("mode","uncommitted");let t=e.toString();return t?`?${t}`:""},[]),eo=(0,b.useCallback)(()=>{let e=new URLSearchParams;_.current&&e.set("generation",_.current),"uncommitted"===A.current&&e.set("mode","uncommitted"),e.set("layout",v.current),e.set("theme",x.current);let t=e.toString();return t?`?${t}`:""},[]),ei=(0,b.useCallback)(async e=>{let t=_.current,r=D.current;q.current=Date.now(),X(!1),N(null),console.info("[diffhub] fetchDiff start",{fingerprint:r,generation:t,mode:A.current,requestId:e});let n=new AbortController,o=setTimeout(()=>{n.abort(Error("Diff request timed out"))},15e3);try{var i,l;let o,s,a=await fetch(`/api/diff${eo()}`,{signal:n.signal});if(!a.ok){let n=(await a.json().catch(()=>({error:"Failed to load diff"}))).error??`Failed to load diff (${a.status})`;console.error("[diffhub] fetchDiff non-ok response",{fingerprint:r,generation:t,mode:A.current,requestId:e,responseStatus:a.status,responseStatusText:a.statusText,serverError:n}),e===V.current&&N(n);return}let c=(i=await a.json(),l=r??"unknown",o=i.patchesByFile??Object.fromEntries((e=>{let t=new Map,r=/^diff --git a\/(.+?) b\/(.+)$/gm,n=[],o=r.exec(e);for(;o;)n.push({file:o[2],start:o.index}),o=r.exec(e);for(let[r,o]of n.entries()){let i=n[r+1]?.start??e.length,l=e.slice(o.start,i).trimEnd();t.set(o.file,l?`${l}
40
+ `:"")}return t})(i.patch??"")),{baseBranch:i.baseBranch,branch:i.branch,generation:i.generation,mergeBase:i.mergeBase,patchesByFile:o,prerenderedHTMLByFile:i.prerenderedHTMLByFile,reviewKeysByFile:i.reviewKeysByFile??(s=i.generation,Object.fromEntries(Object.entries(o).map(([e,t])=>[e,`${s}:${(e=>{let t=0;for(let r=0;r<e.length;r+=1)t=Math.trunc(Math.imul(31,t)+(e.codePointAt(r)??0));return Math.abs(t).toString(36)})(`${e}:${t}`)}`]))),sourceFingerprint:l});if(e!==V.current||r!==D.current||t!==_.current){console.info("[diffhub] fetchDiff response stale",{fingerprint:r,generation:t,latestRequestId:V.current,requestId:e}),null!==_.current&&(U.current+=1,U.current>=3&&(console.warn("[diffhub] fetchDiff stale-drop limit reached, invalidating",{drops:U.current}),U.current=0,V.current+=1,I.current=null,u(null)),W.current=!0);return}U.current=0,console.info("[diffhub] fetchDiff success",{fileCount:Object.keys(c.patchesByFile).length,fingerprint:r,generation:c.generation,requestId:e}),Z(()=>u(c))}catch(n){console.error("[diffhub] fetchDiff threw",{error:n,fingerprint:r,generation:t,mode:A.current,requestId:e}),e===V.current&&N(n instanceof Error?n.message:String(n))}finally{clearTimeout(o)}},[eo,Z]),el=(0,b.useCallback)(async()=>{if(W.current=!0,!H.current){for(H.current=!0,P(!0);W.current;)W.current=!1,V.current+=1,await ei(V.current);H.current=!1,P(!1)}},[ei]);(0,b.useEffect)(()=>{(v.current!==d||x.current!==h)&&(v.current=d,x.current=h,V.current+=1,I.current=null,u(null),el())},[d,h,el]);let es=(0,b.useRef)(c),ea=(0,b.useRef)(T);(0,b.useEffect)(()=>{es.current=c},[c]),(0,b.useEffect)(()=>{ea.current=T},[T]);let ec=(0,b.useCallback)(e=>{et(t=>{let r=null;for(let n of e)!n||t.has(n)||(r??=new Set(t)).add(n);return r??t})},[]),eu=(0,b.useCallback)(e=>{if(D.current=e.fingerprint,_.current=e.generation,0===e.files.length){a.current=null,V.current+=1,(0,b.startTransition)(()=>{s(null),u(null)}),N(null),I.current=e.fingerprint;return}let t=a.current;t&&e.files.some(e=>e.file===t)||(a.current=t=e.files[0]?.file??null,(0,b.startTransition)(()=>s(t))),ec([t]);let r=e.fingerprint!==I.current,n=es.current?.generation===e.generation;(r||!n||null!==ea.current)&&(I.current=e.fingerprint,r&&(V.current+=1),el())},[ec,el]),ed=(0,b.useCallback)(()=>{V.current+=1,I.current=null,D.current=null,_.current=null,u(null),N(null)},[]),ef=(0,b.useCallback)(async(e=!1)=>{let t=()=>{e||C(!1),$.current=!1,B.current&&(B.current=!1,queueMicrotask(()=>{F.current(!0)}))};if($.current){B.current=!0;return}$.current=!0,e||C(!0),R(null);let r=await Promise.all([fetch(`/api/files${en()}`),fetch("/api/comments").then(async e=>{if(!e.ok)throw Error(`Failed to load comments (${e.status})`);return await e.json()}).catch(e=>(console.error("[diffhub] comments refresh failed",{error:e}),null))]).catch(e=>(R(e instanceof Error?e.message:String(e)),null));if(!r)return void t();let[o,l]=r;if(!o.ok){R((await o.json().catch(()=>({error:"Network error"}))).error??"Failed to load files"),t();return}let s=await o.json();(0,b.startTransition)(()=>{n(s),null!==l&&i(l)}),eu(s),t()},[en,eu]);(0,b.useEffect)(()=>{F.current=ef},[ef]);let ep=(0,b.useRef)(!1),em=(0,b.useRef)(!1);(0,b.useEffect)(()=>{let e=null,t=()=>{ep.current=!0,e&&clearTimeout(e),e=setTimeout(()=>{ep.current=!1,em.current&&(em.current=!1,F.current(!0))},200)};return window.addEventListener("scroll",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),e&&clearTimeout(e)}},[]);let eh=(0,b.useCallback)(()=>{if(ep.current){em.current=!0;return}F.current(!0)},[]),eg=(e=>{let[t,r]=(0,b.useState)("connecting"),n=(0,b.useEffectEvent)(e),o=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let e=!1,t=0,i=null,l=new AbortController,s=async()=>{if(!e)try{let i=null===o.current?"":`?revision=${o.current}`,a=await fetch(`/api/watch${i}`,{cache:"no-store",signal:l.signal});if(e)return;if(!a.ok)throw Error(`Watch request failed with status ${a.status}`);let c=await a.json();if(e)return;t=0,r("live");let u=o.current;o.current=c.revision,c.changed&&null!==u&&c.revision!==u&&n(),e||queueMicrotask(()=>{e||s()})}catch(n){if(e||l.signal.aborted)return;if(console.error("[diffhub] file watch failed",{error:n,failureCount:t+=1}),t>10){console.error("[diffhub] file watch: max retries exceeded, stopping"),r("fallback");return}r(t>=sq.length?"fallback":"connecting"),i=setTimeout(()=>{i=null,e||s()},sq[Math.min(t-1,sq.length-1)])}};return r("connecting"),s(),()=>{e=!0,l.abort(),i&&clearTimeout(i)}},[]),t})(eh),eb=(0,b.useCallback)(()=>{ef()},[ef]),ev=(0,b.useCallback)(()=>{X(!1),G(!1),N(null),V.current+=1,I.current=null,u(null),el()},[el]);(0,b.useEffect)(()=>{ef()},[ef]),(0,b.useEffect)(()=>{let e=setInterval(eh,"live"===eg?3e4:5e3);return()=>clearInterval(e)},[eg,eh]),(0,b.useEffect)(()=>{if(!r||0===r.files.length||c||T)return void X(!1);let e=setTimeout(()=>X(!0),2e4);return()=>clearTimeout(e)},[r,c,T]),(0,b.useEffect)(()=>{if(!r||0===r.files.length||c||T)return void G(!1);let e=setTimeout(()=>G(!0),1e4);return()=>clearTimeout(e)},[r,c,T]);let ex=(0,b.useCallback)((e,t=800)=>{z.current={file:e,until:Date.now()+t},a.current=e,(0,b.startTransition)(()=>s(e))},[]),ey=(0,b.useCallback)((e,t="smooth")=>{ex(e);let n=r?.files.map(e=>e.file)??[],o=n.indexOf(e);ec([e,n[o-1],n[o+1]]),er(t=>{if(t.has(e)){let r=new Set(t);return r.delete(e),r}return t});let i=e=>{e.scrollIntoView({behavior:t,block:"start"})},l=document.querySelector(sZ(e));if(l)return void i(l);let s=document.querySelector("#diff-container");if(!s)return;let a=new MutationObserver(()=>{let t=document.querySelector(sZ(e));t&&(a.disconnect(),i(t))});a.observe(s,{childList:!0,subtree:!0}),setTimeout(()=>a.disconnect(),5e3)},[ec,r,ex,er]),ew=(0,b.useCallback)(e=>{let t=z.current;if(t){if(Date.now()>t.until)z.current=null;else if(t.file!==e)return}a.current!==e&&(a.current=e,(0,b.startTransition)(()=>s(e)))},[]),ek=(0,b.useCallback)(e=>{ex(e),er(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[ex,er]),eS=(0,b.useCallback)(()=>{er(()=>new Set((r?.files??[]).map(e=>e.file)))},[r,er]),eE=(0,b.useCallback)(()=>{er(()=>new Set)},[er]);(0,b.useEffect)(()=>{let e=e=>{if(!(e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLInputElement)){if("s"!==e.key||e.metaKey||e.ctrlKey||f(e=>"split"===e?"stacked":"split"),"/"!==e.key&&"t"!==e.key.toLowerCase()||e.metaKey||e.ctrlKey||(e.preventDefault(),document.querySelector('input[placeholder="Filter files…"]')?.focus()),"c"===e.key.toLowerCase()&&!e.metaKey&&!e.ctrlKey&&l){if(e.shiftKey)return void eS();ek(l)}if("e"!==e.key.toLowerCase()||!e.shiftKey||e.metaKey||e.ctrlKey||eE(),"r"!==e.key||e.metaKey||e.ctrlKey||ef(),"j"===e.key||"k"===e.key){let t=r?.files??[];if(0===t.length)return;let n=t.findIndex(e=>e.file===l),o="j"===e.key?t[n+1]:t[n-1];o&&ey(o.file)}}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eS,eE,r,ef,ey,l,f,ek]);let eC=(0,b.useCallback)(e=>{A.current=e,L(e),ed(),ef(!1)},[ed,ef,L]),ej=(0,b.useCallback)(async(e,t,r,n,o)=>{let l=await fetch("/api/comments",{body:JSON.stringify({body:n,file:e,lineNumber:t,side:"deletions"===r?"left":"right",tag:o}),headers:{"Content-Type":"application/json"},method:"POST"});if(!l.ok)return console.error("[diffhub] add comment failed",{error:(await l.json().catch(()=>({error:"Failed to save comment"}))).error??`Failed to save comment (${l.status})`}),!1;let s=await l.json();return i(e=>[...e,s]),!0},[]),eR=(0,b.useCallback)(async e=>{let t=await fetch(`/api/comments?id=${e}`,{method:"DELETE"});return t.ok?(i(t=>t.filter(t=>t.id!==e)),!0):(console.error("[diffhub] delete comment failed",{error:(await t.json().catch(()=>({error:"Failed to delete comment"}))).error??`Failed to delete comment (${t.status})`}),!1)},[]),eT=j&&null!==r?{detail:j,label:"Background refresh failed",tone:"destructive"}:T&&c?{detail:T,label:"Diff refresh failed",tone:"destructive"}:"fallback"===eg?{detail:"Live watch is unavailable, so the app is polling every 5 seconds",label:"Polling fallback",tone:"warning"}:null;return j&&null===r?(0,m.jsx)(lF,{className:"min-h-svh",defaultOpen:t,children:(0,m.jsxs)(lV,{className:"flex flex-col h-svh items-center justify-center gap-4",children:[(0,m.jsxs)("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-6 py-4 text-sm text-destructive max-w-md text-center",children:[(0,m.jsx)("p",{className:"font-semibold mb-1",children:"Failed to load diff"}),(0,m.jsx)("p",{className:"text-xs opacity-80",children:j})]}),(0,m.jsx)(e8,{variant:"outline",onClick:eb,children:"Retry"})]})}):(0,m.jsxs)(lF,{className:"min-h-svh",defaultOpen:t,style:{"--sidebar-width":`${k}px`},children:[(0,m.jsx)(sc,{files:r?.files??[],selectedFile:l,onSelectFile:ey,comments:o,filterQuery:y,onFilterChange:w,isLoading:null===r,insertions:r?.insertions??0,deletions:r?.deletions??0,sidebarWidth:k,onSidebarWidthChange:S}),(0,m.jsxs)(lV,{className:"flex flex-col min-h-svh",children:[(0,m.jsx)("div",{className:"sticky top-0 z-20",children:(0,m.jsx)(l0,{branch:r?.branch??"…",baseBranch:r?.baseBranch??"main",refreshing:E||O,fileWatchState:eg,comments:o,diffMode:M,onDiffModeChange:eC,layout:d,onLayoutChange:f,syncNotice:eT})}),(0,m.jsx)(sQ,{filesData:r,deferredDiffData:c,diffError:T,syncNotice:eT,layout:d,comments:o,onAddComment:ej,onDeleteComment:eR,selectedFile:l,collapsedFiles:J,forceRenderFiles:ee,onToggleCollapse:ek,onActiveFileChange:ew,repoPath:e,diffWatchdogTripped:K,diffHintShown:Y,onRetryDiff:ev})]})]})}],93190)}]);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diffhub",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "GitHub PR-style local diff viewer — review your git changes in the browser",
5
5
  "keywords": [
6
6
  "ai",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diffhub",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "GitHub PR-style local diff viewer — review your git changes in the browser",
5
5
  "keywords": [
6
6
  "ai",