@nice2dev/ui 1.0.5 β†’ 1.0.8

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 (130) hide show
  1. package/README.md +253 -207
  2. package/dist/NiceAPIFlow.doc-DnQLPUie.js +30 -0
  3. package/dist/NiceAPIFlow.doc-Dx4qw1lm.cjs +6 -0
  4. package/dist/NiceBranchManager.doc-BXjiENlD.cjs +6 -0
  5. package/dist/NiceBranchManager.doc-xLB82YwU.js +30 -0
  6. package/dist/NiceButton-B5RXLDwI.cjs +1 -0
  7. package/dist/NiceButton-CDiS45Ya.cjs +1 -0
  8. package/dist/NiceButton-D9l39Rs7.js +595 -0
  9. package/dist/NiceButton-DmTHNHet.js +450 -0
  10. package/dist/NiceCodeTemplate.doc-BWxTE4C_.cjs +6 -0
  11. package/dist/NiceCodeTemplate.doc-CA2U5F-v.js +30 -0
  12. package/dist/NiceDataBranchGraph.doc-CkitupWc.js +29 -0
  13. package/dist/NiceDataBranchGraph.doc-DDUgipqH.cjs +5 -0
  14. package/dist/NiceDataBranchManager.doc-B0ODKOs4.js +30 -0
  15. package/dist/NiceDataBranchManager.doc-CC5o8ihs.cjs +6 -0
  16. package/dist/NiceDataConflictResolver.doc-CdzScNie.cjs +5 -0
  17. package/dist/NiceDataConflictResolver.doc-V8vxYAeo.js +29 -0
  18. package/dist/NiceDataDiffViewer.doc-CR14Bq3A.cjs +6 -0
  19. package/dist/NiceDataDiffViewer.doc-w2I2QjhX.js +30 -0
  20. package/dist/NiceDataMapper.doc-C7jSyHRM.js +30 -0
  21. package/dist/NiceDataMapper.doc-DXjQHz87.cjs +6 -0
  22. package/dist/NiceDataMergeBuilder.doc-CV32WC_w.cjs +6 -0
  23. package/dist/NiceDataMergeBuilder.doc-DtuYb3nx.js +30 -0
  24. package/dist/NiceDataSnapshot.doc-CFLkY3ry.js +30 -0
  25. package/dist/NiceDataSnapshot.doc-CpZyQ17u.cjs +6 -0
  26. package/dist/NiceErrorBoundary-BAeqfoSc.cjs +1 -0
  27. package/dist/NiceErrorBoundary-D1hh5GGe.js +732 -0
  28. package/dist/NiceErrorBoundary-Dta4TGee.cjs +1 -0
  29. package/dist/NiceErrorBoundary-niMx1aSJ.js +837 -0
  30. package/dist/NiceEventOrchestrator.doc-C4SJfIDV.js +30 -0
  31. package/dist/NiceEventOrchestrator.doc-CxjsLxBG.cjs +6 -0
  32. package/dist/NiceGitBlame.doc-BG3_K9_0.cjs +6 -0
  33. package/dist/NiceGitBlame.doc-DrJABEat.js +30 -0
  34. package/dist/NiceGitConflictResolver.doc-BK7hAfz6.js +30 -0
  35. package/dist/NiceGitConflictResolver.doc-CgroGM9_.cjs +6 -0
  36. package/dist/NiceGitDiffViewer.doc-BAwgcY_3.cjs +6 -0
  37. package/dist/NiceGitDiffViewer.doc-BXKJeP-E.js +30 -0
  38. package/dist/NiceGitGraph.doc-B-WtGuzn.cjs +5 -0
  39. package/dist/NiceGitGraph.doc-DxnDPCgC.js +29 -0
  40. package/dist/NiceGitHooks.doc-BrEizvMp.js +29 -0
  41. package/dist/NiceGitHooks.doc-C4EdV5zj.cjs +5 -0
  42. package/dist/NiceMergeRequestBuilder.doc-C5p8mYuh.cjs +6 -0
  43. package/dist/NiceMergeRequestBuilder.doc-Ct9RCmU8.js +30 -0
  44. package/dist/NiceModuleLifecyclePanel-BapdidD6.js +4776 -0
  45. package/dist/NiceModuleLifecyclePanel-Brg1RLwi.cjs +1 -0
  46. package/dist/NiceModuleLifecyclePanel-CsFsm534.cjs +1 -0
  47. package/dist/NiceModuleLifecyclePanel-I_TXRiiY.js +5053 -0
  48. package/dist/NicePinCodeInput-4q8yULuo.js +13359 -0
  49. package/dist/NicePinCodeInput-CrMfdxxc.js +15287 -0
  50. package/dist/NicePinCodeInput-D0aF9MK8.cjs +692 -0
  51. package/dist/NicePinCodeInput-eD2q8nGa.cjs +692 -0
  52. package/dist/NicePinCodeInput.css +1 -0
  53. package/dist/NicePipelineEditor.doc-0eGt8zbX.cjs +5 -0
  54. package/dist/NicePipelineEditor.doc-DTmaOebn.js +29 -0
  55. package/dist/NicePipelineMonitor.doc-67CmsRcf.cjs +5 -0
  56. package/dist/NicePipelineMonitor.doc-mSMdhuG8.js +29 -0
  57. package/dist/NiceSavedQueryPanel-BZNvqSQW.cjs +596 -0
  58. package/dist/NiceSavedQueryPanel-CUAsdOjJ.js +6190 -0
  59. package/dist/NiceSavedQueryPanel-DUw8plYP.js +5666 -0
  60. package/dist/NiceSavedQueryPanel-xpk09zy1.cjs +596 -0
  61. package/dist/NiceSavedQueryPanel.css +1 -0
  62. package/dist/NiceStateDesigner.doc-B36u0hNU.js +29 -0
  63. package/dist/NiceStateDesigner.doc-MPmvNHSx.cjs +5 -0
  64. package/dist/NiceStockChart-CHlOnWzN.cjs +287 -0
  65. package/dist/NiceStockChart-Cpmv9_Cc.js +2341 -0
  66. package/dist/NiceStockChart.css +1 -0
  67. package/dist/NiceTestBuilder.doc-BFInj8GJ.js +30 -0
  68. package/dist/NiceTestBuilder.doc-CB03U_uR.cjs +6 -0
  69. package/dist/NiceToggle-C1UKGXmJ.js +209 -0
  70. package/dist/NiceToggle-CaY1u82g.js +277 -0
  71. package/dist/NiceToggle-DFJFQv_Z.cjs +1 -0
  72. package/dist/NiceToggle-lVi-ETi0.cjs +1 -0
  73. package/dist/NiceWindow-D1awkyFl.js +1636 -0
  74. package/dist/NiceWindow-IdHAcP70.cjs +1 -0
  75. package/dist/NiceWindow-SiCaREbq.js +1408 -0
  76. package/dist/NiceWindow-yARTUJsg.cjs +1 -0
  77. package/dist/charts-Bx_kNBsE.js +4280 -0
  78. package/dist/charts-DECVsCHX.cjs +754 -0
  79. package/dist/charts.cjs +1 -0
  80. package/dist/charts.css +1 -0
  81. package/dist/charts.d.ts +1043 -0
  82. package/dist/charts.mjs +23 -0
  83. package/dist/core-BZBTsGWN.cjs +96 -0
  84. package/dist/core-BpghV7Ls.js +17555 -0
  85. package/dist/core-CfXsl755.js +16305 -0
  86. package/dist/core-DGJSUW64.cjs +96 -0
  87. package/dist/data-branching-De4ExX-S.cjs +1 -0
  88. package/dist/data-branching-DiRfob1f.js +6071 -0
  89. package/dist/data-branching.cjs +1 -0
  90. package/dist/data-branching.d.ts +401 -0
  91. package/dist/data-branching.mjs +9 -0
  92. package/dist/data.cjs +1 -0
  93. package/dist/data.d.ts +2003 -0
  94. package/dist/data.mjs +21 -0
  95. package/dist/devops-BnYinjkT.cjs +17 -0
  96. package/dist/devops-Ckh57eti.js +7198 -0
  97. package/dist/devops.cjs +1 -0
  98. package/dist/devops.d.ts +758 -0
  99. package/dist/devops.mjs +12 -0
  100. package/dist/editors.cjs +1 -0
  101. package/dist/editors.d.ts +2728 -0
  102. package/dist/editors.mjs +66 -0
  103. package/dist/feedback.cjs +1 -0
  104. package/dist/feedback.d.ts +339 -0
  105. package/dist/feedback.mjs +16 -0
  106. package/dist/index-C853adw1.cjs +6199 -0
  107. package/dist/index-CBIZ6mTQ.cjs +5734 -0
  108. package/dist/index-CIl98Vbm.js +72951 -0
  109. package/dist/index-CNwVELPJ.js +62857 -0
  110. package/dist/index-CUx_-gKK.cjs +1 -0
  111. package/dist/index-x8mRM4Jc.js +17 -0
  112. package/dist/index.cjs +1 -7866
  113. package/dist/index.css +1 -0
  114. package/dist/index.d.ts +4888 -180
  115. package/dist/index.mjs +1021 -105889
  116. package/dist/lazy.cjs +1 -0
  117. package/dist/lazy.d.ts +1880 -0
  118. package/dist/lazy.mjs +98 -0
  119. package/dist/navigation.cjs +1 -0
  120. package/dist/navigation.d.ts +1862 -0
  121. package/dist/navigation.mjs +576 -0
  122. package/dist/no-code-BCuadkm4.cjs +332 -0
  123. package/dist/no-code-TL7PyulA.js +7005 -0
  124. package/dist/no-code.cjs +1 -0
  125. package/dist/no-code.d.ts +870 -0
  126. package/dist/no-code.mjs +13 -0
  127. package/dist/overlays.cjs +1 -0
  128. package/dist/overlays.d.ts +706 -0
  129. package/dist/overlays.mjs +482 -0
  130. package/package.json +51 -1
package/dist/data.mjs ADDED
@@ -0,0 +1,21 @@
1
+ import { N as a, a as s, b as c, c as r, d as N, e as d, f as o, g as t, h as l, i as n, j as G, k as p, l as T, m as g, n as v, o as w, p as V, q as b } from "./NiceSavedQueryPanel-CUAsdOjJ.js";
2
+ export {
3
+ a as NiceCardView,
4
+ s as NiceDataGrid,
5
+ c as NiceDataGridAI,
6
+ r as NiceKanbanBoard,
7
+ N as NiceList,
8
+ d as NiceModuleGrid,
9
+ o as NicePivotGrid,
10
+ t as NicePivotGridFieldChooser,
11
+ l as NiceReconciliationView,
12
+ n as NiceSavedQueryPanel,
13
+ G as NiceSpreadsheet,
14
+ p as NiceTable,
15
+ T as NiceTileView,
16
+ g as NiceTreeGrid,
17
+ v as NiceTreeList,
18
+ w as NiceTreeView,
19
+ V as computeAggregate,
20
+ b as escapeCsvField
21
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";const e=require("react/jsx-runtime"),o=require("react"),pe=["#22c55e","#3b82f6","#f59e0b","#ec4899","#8b5cf6","#14b8a6","#f97316","#ef4444","#6366f1","#84cc16"],xe=24,he=40,ue=28,ze=6,Re=4;function Ie(x,j,z,N){const A=[],q=[],G=new Map;x.forEach((g,m)=>G.set(g.hash,m));const M=new Map,T=[],L=new Map;let U=0;const _=new Map;if(j.forEach(g=>{if(!g.lastCommit)return;const m=_.get(g.lastCommit)||[];m.push({type:g.isRemote?"remote":"branch",name:g.name,commit:g.lastCommit,color:g.isHead?"#22c55e":g.isRemote?"#6b7280":"#3b82f6"}),_.set(g.lastCommit,m)}),z.forEach(g=>{const m=_.get(g.commit)||[];m.push({type:"tag",name:g.name,commit:g.commit,color:"#f59e0b"}),_.set(g.commit,m)}),N){const g=_.get(N)||[];g.push({type:"head",name:"HEAD",commit:N,color:"#ef4444"}),_.set(N,g)}return x.forEach((g,m)=>{let w=T.findIndex(C=>C===g.hash);w===-1&&(w=T.findIndex(C=>C===null),w===-1&&(w=T.length,T.push(null))),L.has(w)||(L.set(w,pe[U%pe.length]),U++),M.set(g.hash,w);const B=L.get(w)||pe[0];A.push({commit:g,x:w,y:m,color:B,refs:_.get(g.hash)||[]}),g.parents.forEach((C,v)=>{const y=G.get(C);if(y!==void 0){let W=M.get(C);W===void 0&&(v===0?(W=w,T[w]=C):(W=T.findIndex(P=>P===null),W===-1?(W=T.length,T.push(C)):T[W]=C),M.set(C,W));const V=L.get(W)||B;q.push({from:g.hash,to:C,fromX:w,fromY:m,toX:W,toY:y,color:v===0?B:V,type:v===0?w===W?"straight":"branch":"merge"})}}),(g.parents.length===0||!x.slice(m+1).some(C=>C.parents.includes(g.hash)))&&(T[w]=null)}),{nodes:A,edges:q}}const Be=({nodes:x,edges:j,selectedHash:z,compact:N,onNodeClick:A,onNodeDoubleClick:q})=>{const G=N?ue:he,M=N?Re:ze,L=(Math.max(...x.map(m=>m.x),0)+2)*xe,U=(x.length+1)*G,_=m=>xe/2+m*xe,g=m=>G/2+m*G;return e.jsxs("svg",{width:L,height:U,style:{minWidth:L,minHeight:U,display:"block"},children:[j.map((m,w)=>{const B=_(m.fromX),C=g(m.fromY),v=_(m.toX),y=g(m.toY);if(m.type==="straight")return e.jsx("line",{x1:B,y1:C,x2:v,y2:y,stroke:m.color,strokeWidth:2},w);const W=(C+y)/2,V=`M ${B} ${C} C ${B} ${W}, ${v} ${W}, ${v} ${y}`;return e.jsx("path",{d:V,fill:"none",stroke:m.color,strokeWidth:2,strokeDasharray:m.type==="merge"?"4,2":void 0},w)}),x.map(m=>{const w=_(m.x),B=g(m.y),C=m.commit.hash===z,v=m.commit.isMerge;return e.jsxs("g",{onClick:()=>A(m.commit.hash),onDoubleClick:()=>q(m.commit.hash),style:{cursor:"pointer"},children:[C&&e.jsx("circle",{cx:w,cy:B,r:M+4,fill:"none",stroke:"#fff",strokeWidth:2}),e.jsx("circle",{cx:w,cy:B,r:M,fill:v?"#1e1e1e":m.color,stroke:m.color,strokeWidth:v?2:0}),m.refs.length>0&&!N&&e.jsx("foreignObject",{x:w+10,y:B-8,width:200,height:16,children:e.jsx("div",{style:{display:"flex",gap:4,whiteSpace:"nowrap"},children:m.refs.map((y,W)=>e.jsxs("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:500,background:`${y.color}22`,color:y.color,border:`1px solid ${y.color}44`},children:[y.type==="tag"?"🏷️ ":y.type==="head"?"πŸ‘‰ ":"",y.name]},W))})})]},m.commit.hash)})]})},fe=({commits:x,branches:j,tags:z,head:N,selectedCommit:A,branchFilter:q,authorFilter:G,dateRange:M,searchQuery:T,maxCommits:L=100,showRemotes:U=!0,showTags:_=!0,compact:g=!1,onCommitSelect:m,onCommitDoubleClick:w,onBranchCheckout:B,onBranchCreate:C,onTagCreate:v,onCherryPick:y,onRevert:W,onReset:V,onCompare:P,onViewDiff:D,className:b,style:S,"data-testid":h})=>{const[k,E]=o.useState(A),[F,K]=o.useState(null),[O,Y]=o.useState(!1),[X,a]=o.useState(null),t=o.useRef(null),l=A??k,i=o.useMemo(()=>{let u=x;if(q&&q.length>0){const I=new Set;j.filter(J=>q.includes(J.name)).forEach(J=>{J.lastCommit&&I.add(J.lastCommit)}),u=u.filter(J=>I.has(J.hash))}if(G&&G.length>0&&(u=u.filter(I=>G.some(J=>I.author.name.toLowerCase().includes(J.toLowerCase())||I.author.email.toLowerCase().includes(J.toLowerCase())))),M&&(M.from&&(u=u.filter(I=>I.date>=M.from)),M.to&&(u=u.filter(I=>I.date<=M.to))),T&&T.trim()){const I=T.toLowerCase();u=u.filter(J=>J.hash.toLowerCase().includes(I)||J.shortHash.toLowerCase().includes(I)||J.message.toLowerCase().includes(I)||J.author.name.toLowerCase().includes(I))}return u.slice(0,L)},[x,q,G,M,T,L,j]),{nodes:n,edges:p}=o.useMemo(()=>Ie(i,U?j:j.filter(u=>!u.isRemote),_?z:[],N),[i,j,z,N,U,_]),c=o.useMemo(()=>i.find(u=>u.hash===l),[i,l]),s=o.useCallback(u=>{if(O&&X)P?.(X,u),Y(!1),a(null);else if(O)a(u);else{E(u);const I=i.find(J=>J.hash===u);I&&m?.(I)}},[O,X,i,m,P]),f=o.useCallback(u=>{const I=i.find(J=>J.hash===u);I&&(w?.(I),D?.(u))},[i,w,D]),R=o.useCallback((u,I)=>{u.preventDefault(),K({x:u.clientX,y:u.clientY,commit:I})},[]),ee=o.useCallback(()=>K(null),[]),Z=u=>{const J=new Date().getTime()-u.getTime(),ne=Math.floor(J/(1e3*60*60*24));return ne===0?"Today":ne===1?"Yesterday":ne<7?`${ne} days ago`:u.toLocaleDateString()},Q=g?ue:he;return e.jsxs("div",{className:`nice-git-graph ${b||""}`,style:{display:"flex",height:"100%",background:"#1e1e1e",color:"#e0e0e0",fontFamily:"system-ui, sans-serif",...S},"data-testid":h,onClick:ee,children:[e.jsxs("div",{ref:t,style:{flex:1,overflow:"auto",display:"flex"},children:[e.jsx("div",{style:{flexShrink:0,borderRight:"1px solid #333"},children:e.jsx(Be,{nodes:n,edges:p,selectedHash:l,compact:g,onNodeClick:s,onNodeDoubleClick:f})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[n.map(u=>e.jsxs("div",{onClick:()=>s(u.commit.hash),onDoubleClick:()=>f(u.commit.hash),onContextMenu:I=>R(I,u.commit),style:{height:Q,padding:"0 12px",display:"flex",alignItems:"center",gap:12,cursor:"pointer",background:u.commit.hash===l?"rgba(59, 130, 246, 0.15)":"transparent",borderBottom:"1px solid #2a2a2a"},children:[u.commit.author.avatar?e.jsx("img",{src:u.commit.author.avatar,alt:"",style:{width:g?20:24,height:g?20:24,borderRadius:"50%",flexShrink:0}}):e.jsx("div",{style:{width:g?20:24,height:g?20:24,borderRadius:"50%",background:u.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:g?10:12,color:"#fff",fontWeight:600,flexShrink:0},children:u.commit.author.name.charAt(0).toUpperCase()}),e.jsx("div",{style:{flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:g?12:13},children:u.commit.message}),u.commit.stats&&!g&&e.jsxs("div",{style:{display:"flex",gap:8,fontSize:11,color:"#888",flexShrink:0},children:[e.jsxs("span",{style:{color:"#22c55e"},children:["+",u.commit.stats.additions]}),e.jsxs("span",{style:{color:"#ef4444"},children:["-",u.commit.stats.deletions]})]}),e.jsx("code",{style:{fontSize:g?10:11,color:"#888",fontFamily:"monospace",flexShrink:0},children:u.commit.shortHash}),!g&&e.jsx("span",{style:{fontSize:11,color:"#888",flexShrink:0,width:100},children:u.commit.author.name}),e.jsx("span",{style:{fontSize:g?10:11,color:"#666",flexShrink:0,width:g?60:80,textAlign:"right"},children:Z(u.commit.date)})]},u.commit.hash)),i.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"#666",fontSize:13},children:"No commits match the filters"})]})]}),c&&!g&&e.jsxs("div",{style:{width:320,borderLeft:"1px solid #333",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid #333"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[c.author.avatar?e.jsx("img",{src:c.author.avatar,alt:"",style:{width:32,height:32,borderRadius:"50%"}}):e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:"#3b82f6",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontWeight:600},children:c.author.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:c.author.name}),e.jsx("div",{style:{fontSize:11,color:"#888"},children:c.author.email})]})]}),e.jsx("code",{style:{fontSize:11,color:"#888",fontFamily:"monospace"},children:c.hash})]}),e.jsxs("div",{style:{padding:16,borderBottom:"1px solid #333"},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,marginBottom:8},children:c.message}),c.body&&e.jsx("div",{style:{fontSize:12,color:"#aaa",whiteSpace:"pre-wrap",maxHeight:120,overflow:"auto"},children:c.body})]}),c.stats&&e.jsxs("div",{style:{padding:16,borderBottom:"1px solid #333",display:"flex",gap:16},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:20,fontWeight:600},children:c.stats.filesChanged}),e.jsx("div",{style:{fontSize:10,color:"#888"},children:"files changed"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"#22c55e"},children:["+",c.stats.additions]}),e.jsx("div",{style:{fontSize:10,color:"#888"},children:"additions"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"#ef4444"},children:["-",c.stats.deletions]}),e.jsx("div",{style:{fontSize:10,color:"#888"},children:"deletions"})]})]}),e.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("button",{onClick:()=>D?.(c.hash),style:{padding:"8px 12px",borderRadius:4,border:"none",background:"#3b82f6",color:"white",cursor:"pointer",fontSize:12,fontWeight:500},children:"View Changes"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>y?.(c.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:11},children:"Cherry Pick"}),e.jsx("button",{onClick:()=>W?.(c.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:11},children:"Revert"})]}),e.jsx("button",{onClick:()=>C?.(c.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:11},children:"Create Branch Here"}),e.jsx("button",{onClick:()=>v?.(c.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:11},children:"Create Tag Here"}),e.jsx("button",{onClick:()=>{Y(!0),a(c.hash)},style:{padding:"6px 10px",borderRadius:4,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:11},children:"Compare with..."})]})]}),O&&e.jsxs("div",{style:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",padding:"8px 16px",background:"#3b82f6",borderRadius:4,fontSize:12,fontWeight:500},children:[X?`Select commit to compare with ${X.slice(0,7)}`:"Select first commit",e.jsx("button",{onClick:()=>{Y(!1),a(null)},style:{marginLeft:12,padding:"2px 8px",background:"rgba(255,255,255,0.2)",border:"none",borderRadius:4,color:"white",cursor:"pointer",fontSize:11},children:"Cancel"})]}),F&&e.jsx("div",{style:{position:"fixed",left:F.x,top:F.y,background:"#252525",border:"1px solid #444",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.3)",minWidth:160,zIndex:1e3},children:[{label:"View Changes",onClick:()=>D?.(F.commit.hash)},{label:"Cherry Pick",onClick:()=>y?.(F.commit.hash)},{label:"Revert",onClick:()=>W?.(F.commit.hash)},{divider:!0},{label:"Create Branch",onClick:()=>C?.(F.commit.hash)},{label:"Create Tag",onClick:()=>v?.(F.commit.hash)},{divider:!0},{label:"Reset Soft",onClick:()=>V?.(F.commit.hash,"soft")},{label:"Reset Mixed",onClick:()=>V?.(F.commit.hash,"mixed")},{label:"Reset Hard",onClick:()=>V?.(F.commit.hash,"hard"),danger:!0}].map((u,I)=>"divider"in u?e.jsx("div",{style:{height:1,background:"#444",margin:"4px 0"}},I):e.jsx("button",{onClick:()=>{u.onClick?.(),ee()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in u&&u.danger?"#ef4444":"white",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:J=>{J.currentTarget.style.background="#333"},onMouseOut:J=>{J.currentTarget.style.background="transparent"},children:u.label},I))})]})},Me=Object.freeze(Object.defineProperty({__proto__:null,NiceGitGraph:fe},Symbol.toStringTag,{value:"Module"})),ge=({branches:x,currentBranch:j,defaultBranch:z="main",protectionRules:N=[],showRemotes:A=!0,selectedBranch:q,onBranchSelect:G,onCheckout:M,onCreateBranch:T,onDeleteBranch:L,onRenameBranch:U,onMerge:_,onRebase:g,onSetUpstream:m,onPush:w,onPull:B,onCompare:C,onProtectionChange:v,className:y,style:W,"data-testid":V})=>{const[P,D]=o.useState(""),[b,S]=o.useState("all"),[h,k]=o.useState(),[E,F]=o.useState(!1),[K,O]=o.useState(!1),[Y,X]=o.useState(!1),[a,t]=o.useState(""),[l,i]=o.useState(j||z),[n,p]=o.useState(""),[c,s]=o.useState(j||z),[f,R]=o.useState(null),ee=q??h,Z=o.useMemo(()=>{let d=x;if(b==="local"?d=d.filter(r=>!r.isRemote):b==="remote"?d=d.filter(r=>r.isRemote):A||(d=d.filter(r=>!r.isRemote)),P.trim()){const r=P.toLowerCase();d=d.filter($=>$.name.toLowerCase().includes(r))}return d.sort((r,$)=>r.isHead?-1:$.isHead?1:r.name===z?-1:$.name===z?1:r.isRemote!==$.isRemote?r.isRemote?1:-1:r.name.localeCompare($.name))},[x,b,A,P,z]),Q=o.useMemo(()=>{const d=Z.filter($=>!$.isRemote),r=Z.filter($=>$.isRemote);return{local:d,remote:r}},[Z]),u=o.useCallback(d=>{k(d),G?.(d)},[G]),I=o.useCallback((d,r)=>{d.preventDefault(),R({x:d.clientX,y:d.clientY,branch:r})},[]),J=o.useCallback(()=>R(null),[]),ne=o.useCallback(()=>{a.trim()&&(T?.(a.trim(),l),t(""),F(!1))},[a,l,T]),ce=o.useCallback(()=>{n&&c&&n!==c&&(_?.(n,c),O(!1))},[n,c,_]),le=d=>{if(!d)return"-";const $=new Date().getTime()-d.getTime(),te=Math.floor($/(1e3*60*60*24));return te===0?"Today":te===1?"Yesterday":te<7?`${te} days ago`:te<30?`${Math.floor(te/7)} weeks ago`:d.toLocaleDateString()},H=o.useMemo(()=>x.find(d=>d.name===ee),[x,ee]),oe=o.useCallback(d=>N.some(r=>new RegExp(r.pattern.replace(/\*/g,".*")).test(d)),[N]),se=Q.local,re=d=>{const r=d.name===ee,$=d.isHead,te=d.name===z,Ce=oe(d.name);return e.jsxs("div",{onClick:()=>u(d.name),onDoubleClick:()=>M?.(d.name),onContextMenu:we=>I(we,d),style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",cursor:"pointer",background:r?"rgba(59, 130, 246, 0.15)":$?"rgba(34, 197, 94, 0.08)":"transparent",borderLeft:$?"3px solid #22c55e":"3px solid transparent"},children:[e.jsx("span",{style:{fontSize:16},children:d.isRemote?"☁️":$?"πŸ“":"🌿"}),e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:$?600:400,color:$?"#22c55e":"#e0e0e0"},children:d.name}),e.jsxs("div",{style:{display:"flex",gap:4},children:[te&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"#3b82f622",color:"#3b82f6",border:"1px solid #3b82f644"},children:"default"}),Ce&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"#f59e0b22",color:"#f59e0b",border:"1px solid #f59e0b44"},children:"πŸ”’ protected"})]}),d.upstream&&(d.ahead||d.behind)&&e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10,color:"#888"},children:[d.ahead?e.jsxs("span",{style:{color:"#22c55e"},children:["↑",d.ahead]}):null,d.behind?e.jsxs("span",{style:{color:"#ef4444"},children:["↓",d.behind]}):null]}),d.lastCommit&&e.jsx("span",{style:{fontSize:10,color:"#666",width:80,textAlign:"right"},children:le(d.lastCommit.date)})]},d.name)};return e.jsxs("div",{className:`nice-branch-manager ${y||""}`,style:{display:"flex",height:"100%",background:"#1e1e1e",color:"#e0e0e0",fontFamily:"system-ui, sans-serif",...W},"data-testid":V,onClick:J,children:[e.jsxs("div",{style:{width:350,display:"flex",flexDirection:"column",borderRight:"1px solid #333"},children:[e.jsxs("div",{style:{padding:12,borderBottom:"1px solid #333"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("span",{style:{fontSize:18},children:"🌳"}),e.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Branches"}),e.jsxs("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"#333",borderRadius:10,fontSize:11},children:[x.filter(d=>!d.isRemote).length," local"]})]}),e.jsx("input",{type:"text",placeholder:"Search branches...",value:P,onChange:d=>D(d.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:6,border:"1px solid #444",background:"#252525",color:"white",fontSize:12,marginBottom:8}}),e.jsx("div",{style:{display:"flex",gap:4},children:["all","local","remote"].map(d=>e.jsx("button",{onClick:()=>S(d),style:{flex:1,padding:"6px 0",borderRadius:4,border:"none",background:b===d?"#3b82f6":"#333",color:"white",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:d},d))})]}),e.jsxs("div",{style:{padding:8,borderBottom:"1px solid #333",display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>F(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"#22c55e",color:"white",cursor:"pointer",fontSize:12,fontWeight:500},children:"+ New Branch"}),e.jsx("button",{onClick:()=>O(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"#3b82f6",color:"white",cursor:"pointer",fontSize:12,fontWeight:500},children:"‡ Merge"})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[Q.local.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"8px 12px",fontSize:10,fontWeight:600,color:"#888",textTransform:"uppercase",background:"#252525"},children:["Local (",Q.local.length,")"]}),Q.local.map(re)]}),A&&Q.remote.length>0&&b!=="local"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"8px 12px",fontSize:10,fontWeight:600,color:"#888",textTransform:"uppercase",background:"#252525",marginTop:8},children:["Remote (",Q.remote.length,")"]}),Q.remote.map(re)]}),Z.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"#666",fontSize:12},children:"No branches match the filter"})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:H?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:16,borderBottom:"1px solid #333",background:"#252525"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:24},children:H.isRemote?"☁️":H.isHead?"πŸ“":"🌿"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:H.name}),H.description&&e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"#888"},children:H.description})]}),H.isHead&&e.jsx("span",{style:{padding:"4px 12px",borderRadius:4,background:"#22c55e22",color:"#22c55e",fontSize:12,fontWeight:500},children:"βœ“ Current"})]})}),e.jsxs("div",{style:{padding:16,borderBottom:"1px solid #333"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:16},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"#888",marginBottom:4},children:"Upstream"}),e.jsx("div",{style:{fontSize:13},children:H.upstream||e.jsx("span",{style:{color:"#666"},children:"Not set"})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"#888",marginBottom:4},children:"Sync Status"}),e.jsx("div",{style:{display:"flex",gap:8,fontSize:13},children:H.upstream?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{color:"#22c55e"},children:["↑ ",H.ahead||0," ahead"]}),e.jsxs("span",{style:{color:"#ef4444"},children:["↓ ",H.behind||0," behind"]})]}):e.jsx("span",{style:{color:"#666"},children:"-"})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"#888",marginBottom:4},children:"Last Commit"}),e.jsx("div",{style:{fontSize:13},children:H.lastCommit?e.jsxs(e.Fragment,{children:[e.jsx("code",{style:{fontSize:11,color:"#aaa"},children:H.lastCommit.hash.slice(0,7)})," ",le(H.lastCommit.date)]}):e.jsx("span",{style:{color:"#666"},children:"-"})})]})]}),H.lastCommit&&e.jsxs("div",{style:{marginTop:16,padding:12,background:"#1e1e1e",borderRadius:6,fontSize:12},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:4},children:H.lastCommit.message}),e.jsxs("div",{style:{fontSize:11,color:"#888"},children:["by ",H.lastCommit.author]})]})]}),e.jsx("div",{style:{padding:16},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8},children:[!H.isHead&&e.jsx("button",{onClick:()=>M?.(H.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"#22c55e",color:"white",cursor:"pointer",fontSize:12,fontWeight:500},children:"πŸ“ Checkout"}),H.upstream&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>B?.(H.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"#3b82f6",color:"white",cursor:"pointer",fontSize:12,fontWeight:500},children:"↓ Pull"}),e.jsx("button",{onClick:()=>w?.(H.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"#8b5cf6",color:"white",cursor:"pointer",fontSize:12,fontWeight:500},children:"↑ Push"})]}),!H.upstream&&!H.isRemote&&e.jsx("button",{onClick:()=>m?.(H.name,`origin/${H.name}`),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:12},children:"Set Upstream"}),e.jsx("button",{onClick:()=>{p(H.name),s(j||z),O(!0)},style:{padding:"10px 16px",borderRadius:6,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:12},children:"‡ Merge into..."}),e.jsx("button",{onClick:()=>C?.(z,H.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:12},children:"πŸ”€ Compare"}),!H.isHead&&!H.isRemote&&!oe(H.name)&&e.jsx("button",{onClick:()=>L?.(H.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"#ef4444",color:"white",cursor:"pointer",fontSize:12},children:"πŸ—‘ Delete"})]})})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#666",fontSize:13},children:"Select a branch to view details"})}),E&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>F(!1),children:e.jsxs("div",{style:{width:400,background:"#252525",borderRadius:8,padding:24},onClick:d=>d.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:"Create New Branch"}),e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#888",marginBottom:4},children:"Branch Name"}),e.jsx("input",{type:"text",placeholder:"feature/my-feature",value:a,onChange:d=>t(d.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:13},autoFocus:!0})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#888",marginBottom:4},children:"Based on"}),e.jsx("select",{value:l,onChange:d=>i(d.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:13},children:se.map(d=>e.jsxs("option",{value:d.name,children:[d.name," ",d.isHead?"(current)":""]},d.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>F(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:12},children:"Cancel"}),e.jsx("button",{onClick:ne,disabled:!a.trim(),style:{padding:"10px 20px",borderRadius:6,border:"none",background:a.trim()?"#22c55e":"#333",color:"white",cursor:a.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Create Branch"})]})]})}),K&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>O(!1),children:e.jsxs("div",{style:{width:400,background:"#252525",borderRadius:8,padding:24},onClick:d=>d.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:"Merge Branches"}),e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#888",marginBottom:4},children:"Merge from"}),e.jsxs("select",{value:n,onChange:d=>p(d.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:13},children:[e.jsx("option",{value:"",children:"Select branch..."}),se.map(d=>e.jsx("option",{value:d.name,children:d.name},d.name))]})]}),e.jsx("div",{style:{textAlign:"center",padding:"8px 0",color:"#888"},children:"↓ into ↓"}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#888",marginBottom:4},children:"Merge into"}),e.jsx("select",{value:c,onChange:d=>s(d.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:13},children:se.map(d=>e.jsxs("option",{value:d.name,children:[d.name," ",d.isHead?"(current)":""]},d.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>O(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:12},children:"Cancel"}),e.jsx("button",{onClick:ce,disabled:!n||!c||n===c,style:{padding:"10px 20px",borderRadius:6,border:"none",background:n&&c&&n!==c?"#3b82f6":"#333",color:"white",cursor:n&&c&&n!==c?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Merge"})]})]})}),f&&e.jsx("div",{style:{position:"fixed",left:f.x,top:f.y,background:"#252525",border:"1px solid #444",borderRadius:6,boxShadow:"0 4px 12px rgba(0,0,0,0.3)",minWidth:160,zIndex:1e3},children:[!f.branch.isHead&&{label:"Checkout",onClick:()=>M?.(f.branch.name)},{label:"Compare",onClick:()=>C?.(z,f.branch.name)},{label:"Merge into current",onClick:()=>_?.(f.branch.name,j||z)},{divider:!0},!f.branch.isRemote&&{label:"Rename",onClick:()=>{const d=prompt("New name:",f.branch.name);d&&U?.(f.branch.name,d)}},!f.branch.isHead&&!f.branch.isRemote&&!oe(f.branch.name)&&{label:"Delete",onClick:()=>L?.(f.branch.name),danger:!0}].filter(Boolean).map((d,r)=>d?"divider"in d?e.jsx("div",{style:{height:1,background:"#444",margin:"4px 0"}},r):e.jsx("button",{onClick:()=>{d.onClick?.(),J()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in d&&d.danger?"#ef4444":"white",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:$=>$.currentTarget.style.background="#333",onMouseOut:$=>$.currentTarget.style.background="transparent",children:d.label},r):null)})]})},Te=Object.freeze(Object.defineProperty({__proto__:null,NiceBranchManager:ge},Symbol.toStringTag,{value:"Module"})),me=({branches:x,users:j=[],labels:z=[],issues:N=[],templates:A=[],diff:q,currentBranch:G,defaultTargetBranch:M="main",initialSourceBranch:T,platform:L="github",onSubmit:U,onCancel:_,onBranchChange:g,onPreview:m,className:w,style:B,"data-testid":C})=>{const[v,y]=o.useState(""),[W,V]=o.useState(""),[P,D]=o.useState(T||G||""),[b,S]=o.useState(M),[h,k]=o.useState(!1),[E,F]=o.useState([]),[K,O]=o.useState([]),[Y,X]=o.useState([]),[a,t]=o.useState([]),[l,i]=o.useState(!1),[n,p]=o.useState(!0),[c,s]=o.useState(!1),[f,R]=o.useState(!1),[ee,Z]=o.useState(!1),[Q,u]=o.useState(!1),I=o.useMemo(()=>P?P.replace(/^(feature|bugfix|hotfix|release)\//,"").replace(/[-_]/g," ").replace(/\b\w/g,$=>$.toUpperCase()):"",[P]),J=o.useMemo(()=>x.filter(r=>!r.isRemote),[x]),ne=o.useCallback((r,$)=>{D(r),S($),g?.(r,$)},[g]),ce=o.useCallback(()=>{if(!P||!b||!v.trim())return;const r={title:v.trim(),description:W.trim(),sourceBranch:P,targetBranch:b,isDraft:h,labels:E,reviewers:K,assignees:Y,linkedIssues:a,squashCommits:l,deleteSourceBranch:n};U?.(r)},[v,W,P,b,h,E,K,Y,a,l,n,U]),le=r=>{V(r.content),u(!1)},H=r=>{F($=>$.includes(r)?$.filter(te=>te!==r):[...$,r])},oe=r=>{O($=>$.includes(r)?$.filter(te=>te!==r):[...$,r])},se=r=>{t($=>$.includes(r)?$.filter(te=>te!==r):[...$,r])},re={github:{title:"Pull Request",btn:"Create Pull Request"},gitlab:{title:"Merge Request",btn:"Create Merge Request"},bitbucket:{title:"Pull Request",btn:"Create Pull Request"},azure:{title:"Pull Request",btn:"Create Pull Request"}},d=P&&b&&P!==b&&v.trim();return e.jsxs("div",{className:`nice-merge-request-builder ${w||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"#1e1e1e",color:"#e0e0e0",fontFamily:"system-ui, sans-serif",...B},"data-testid":C,children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid #333",background:"#252525",display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:24},children:"πŸ”€"}),e.jsxs("div",{children:[e.jsxs("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:[h?"Draft ":"",re[L].title]}),e.jsxs("p",{style:{margin:"4px 0 0",fontSize:12,color:"#888"},children:["Create a new ",L==="gitlab"?"merge":"pull"," request"]})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[e.jsxs("div",{style:{background:"#252525",borderRadius:8,padding:16,marginBottom:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"center"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11,color:"#888",marginBottom:4},children:"From"}),e.jsxs("select",{value:P,onChange:r=>ne(r.target.value,b),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:13},children:[e.jsx("option",{value:"",children:"Select source branch..."}),J.map(r=>e.jsx("option",{value:r.name,children:r.name},r.name))]})]}),e.jsx("div",{style:{padding:"20px 0 0"},children:e.jsx("span",{style:{fontSize:20,color:"#888"},children:"β†’"})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11,color:"#888",marginBottom:4},children:"Into"}),e.jsx("select",{value:b,onChange:r=>ne(P,r.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:13},children:J.map(r=>e.jsx("option",{value:r.name,children:r.name},r.name))})]})]}),q&&e.jsxs("div",{style:{marginTop:12,padding:"8px 12px",background:"#1e1e1e",borderRadius:6,display:"flex",gap:16,fontSize:12},children:[e.jsxs("span",{style:{color:"#22c55e"},children:["+",q.additions," additions"]}),e.jsxs("span",{style:{color:"#ef4444"},children:["-",q.deletions," deletions"]}),e.jsxs("span",{style:{color:"#888"},children:[q.changedFiles," files changed"]})]}),P===b&&P&&e.jsx("div",{style:{marginTop:12,padding:"8px 12px",background:"#ef444422",color:"#ef4444",borderRadius:6,fontSize:12},children:"Source and target branches cannot be the same"})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#888",marginBottom:6},children:"Title"}),e.jsx("input",{type:"text",value:v,onChange:r=>y(r.target.value),placeholder:I||"Enter a title...",style:{width:"100%",padding:"12px 16px",borderRadius:6,border:"1px solid #444",background:"#252525",color:"white",fontSize:14}}),!v&&I&&e.jsxs("button",{onClick:()=>y(I),style:{marginTop:4,padding:0,background:"none",border:"none",color:"#3b82f6",fontSize:11,cursor:"pointer"},children:['Use suggested: "',I,'"']})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[e.jsx("label",{style:{fontSize:12,color:"#888"},children:"Description"}),A.length>0&&e.jsx("button",{onClick:()=>u(!Q),style:{padding:"4px 8px",borderRadius:4,border:"none",background:"#333",color:"#888",fontSize:11,cursor:"pointer"},children:"πŸ“ Templates"})]}),e.jsx("textarea",{value:W,onChange:r=>V(r.target.value),placeholder:"Describe your changes...",rows:8,style:{width:"100%",padding:"12px 16px",borderRadius:6,border:"1px solid #444",background:"#252525",color:"white",fontSize:13,resize:"vertical",fontFamily:"inherit"}})]}),Q&&A.length>0&&e.jsxs("div",{style:{marginBottom:16,padding:12,background:"#252525",borderRadius:6,border:"1px solid #444"},children:[e.jsx("div",{style:{fontSize:12,color:"#888",marginBottom:8},children:"Select Template"}),A.map(r=>e.jsxs("button",{onClick:()=>le(r),style:{display:"block",width:"100%",padding:"8px 12px",marginBottom:4,borderRadius:4,border:"none",background:"#333",color:"white",textAlign:"left",cursor:"pointer",fontSize:12},children:[e.jsx("div",{style:{fontWeight:500},children:r.name}),e.jsx("div",{style:{fontSize:11,color:"#888"},children:r.description})]},r.id))]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16,marginBottom:20},children:[e.jsxs("div",{children:[e.jsx("button",{onClick:()=>s(!c),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#252525",color:"white",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"🏷️ Labels"}),E.length>0&&e.jsxs("span",{style:{color:"#3b82f6"},children:["(",E.length,")"]})]})}),c&&e.jsx("div",{style:{marginTop:8,padding:8,background:"#333",borderRadius:6,maxHeight:200,overflow:"auto"},children:z.map(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:E.includes(r.id),onChange:()=>H(r.id)}),e.jsx("span",{style:{width:12,height:12,borderRadius:"50%",background:r.color}}),e.jsx("span",{style:{fontSize:12},children:r.name})]},r.id))})]}),e.jsxs("div",{children:[e.jsx("button",{onClick:()=>R(!f),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#252525",color:"white",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"πŸ‘₯ Reviewers"}),K.length>0&&e.jsxs("span",{style:{color:"#22c55e"},children:["(",K.length,")"]})]})}),f&&e.jsx("div",{style:{marginTop:8,padding:8,background:"#333",borderRadius:6,maxHeight:200,overflow:"auto"},children:j.map(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:K.includes(r.id),onChange:()=>oe(r.id)}),r.avatar?e.jsx("img",{src:r.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"#666",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:r.name[0]}),e.jsx("span",{style:{fontSize:12},children:r.name})]},r.id))})]}),e.jsxs("div",{children:[e.jsx("button",{onClick:()=>Z(!ee),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#252525",color:"white",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"πŸ”— Linked Issues"}),a.length>0&&e.jsxs("span",{style:{color:"#8b5cf6"},children:["(",a.length,")"]})]})}),ee&&e.jsx("div",{style:{marginTop:8,padding:8,background:"#333",borderRadius:6,maxHeight:200,overflow:"auto"},children:N.filter(r=>r.state==="open").map(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:a.includes(r.id),onChange:()=>se(r.id)}),e.jsxs("span",{style:{fontSize:12,color:"#888"},children:["#",r.number]}),e.jsx("span",{style:{fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.title})]},r.id))})]}),e.jsx("div",{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:6,border:"1px solid #444",background:"#252525",cursor:"pointer",fontSize:12},children:[e.jsx("input",{type:"checkbox",checked:h,onChange:r=>k(r.target.checked)}),e.jsx("span",{children:"πŸ“ Create as Draft"})]})})]}),e.jsxs("div",{style:{background:"#252525",borderRadius:8,padding:16,marginBottom:20},children:[e.jsx("div",{style:{fontSize:12,color:"#888",marginBottom:12},children:"Merge Options"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:12},children:[e.jsx("input",{type:"checkbox",checked:l,onChange:r=>i(r.target.checked)}),"Squash commits on merge"]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:12},children:[e.jsx("input",{type:"checkbox",checked:n,onChange:r=>p(r.target.checked)}),"Delete source branch after merge"]})]})]}),q&&q.files.length>0&&e.jsxs("div",{style:{background:"#252525",borderRadius:8,padding:16},children:[e.jsxs("div",{style:{fontSize:12,color:"#888",marginBottom:12},children:["Changed Files (",q.changedFiles,")"]}),e.jsx("div",{style:{maxHeight:200,overflow:"auto"},children:q.files.map(r=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,fontSize:12},children:[e.jsx("span",{style:{width:12,height:12,borderRadius:2,background:r.status==="added"?"#22c55e":r.status==="deleted"?"#ef4444":r.status==="renamed"?"#3b82f6":"#f59e0b",display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,color:"white"},children:r.status==="added"?"+":r.status==="deleted"?"-":r.status==="renamed"?"β†’":"M"}),e.jsx("span",{style:{flex:1,fontFamily:"monospace",fontSize:11},children:r.path}),e.jsxs("span",{style:{color:"#22c55e",fontSize:11},children:["+",r.additions]}),e.jsxs("span",{style:{color:"#ef4444",fontSize:11},children:["-",r.deletions]})]},r.path))})]})]}),e.jsxs("div",{style:{padding:"16px 20px",borderTop:"1px solid #333",background:"#252525",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:12},children:[e.jsx("button",{onClick:_,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:()=>m?.({title:v,description:W,sourceBranch:P,targetBranch:b,isDraft:h,labels:E,reviewers:K,assignees:Y,linkedIssues:a,squashCommits:l,deleteSourceBranch:n}),disabled:!d,style:{padding:"10px 20px",borderRadius:6,border:"none",background:d?"#333":"#222",color:d?"white":"#666",cursor:d?"pointer":"not-allowed",fontSize:13},children:"Preview"}),e.jsx("button",{onClick:ce,disabled:!d,style:{padding:"10px 24px",borderRadius:6,border:"none",background:d?"#22c55e":"#222",color:d?"white":"#666",cursor:d?"pointer":"not-allowed",fontSize:13,fontWeight:500},children:h?"Create Draft":re[L].btn})]})]})},We=Object.freeze(Object.defineProperty({__proto__:null,NiceMergeRequestBuilder:me},Symbol.toStringTag,{value:"Module"})),be=({files:x,viewMode:j,showWhitespace:z,comments:N=[],selectedFile:A,showFileTree:q=!0,contextLines:G=3,baseRef:M,headRef:T,onFileSelect:L,onViewModeChange:U,onAddComment:_,onResolveComment:g,onExpandChunk:m,className:w,style:B,"data-testid":C})=>{const[v,y]=o.useState("split"),[W,V]=o.useState(!1),[P,D]=o.useState(x[0]?.path),[b,S]=o.useState(new Set),[h,k]=o.useState(null),E=j??v,F=z??W,K=A??P,O=o.useMemo(()=>x.find(s=>s.path===K),[x,K]),Y=o.useMemo(()=>({additions:x.reduce((s,f)=>s+f.additions,0),deletions:x.reduce((s,f)=>s+f.deletions,0)}),[x]),X=o.useCallback(s=>{D(s),L?.(s)},[L]),a=o.useCallback(s=>{y(s),U?.(s)},[U]),t=o.useCallback((s,f)=>{const R=`${s}:${f}`;S(ee=>{const Z=new Set(ee);return Z.has(R)?Z.delete(R):Z.add(R),Z}),m?.(s,f)},[m]),l=o.useMemo(()=>N.filter(s=>s.filePath===K),[N,K]),i=s=>{switch(s){case"added":return{icon:"+",color:"#22c55e"};case"deleted":return{icon:"-",color:"#ef4444"};case"modified":return{icon:"M",color:"#f59e0b"};case"renamed":return{icon:"β†’",color:"#3b82f6"};case"copied":return{icon:"C",color:"#8b5cf6"}}},n=(s,f,R)=>{const ee=s.type==="addition"?"rgba(34, 197, 94, 0.1)":s.type==="deletion"?"rgba(239, 68, 68, 0.1)":s.type==="header"?"rgba(59, 130, 246, 0.1)":"transparent",Z=s.type==="addition"?"#4ade80":s.type==="deletion"?"#f87171":s.type==="header"?"#60a5fa":"#e0e0e0",Q=R==="old"?s.lineNumberOld:R==="new"?s.lineNumberNew:void 0,u=F?s.content.replace(/ /g,"Β·").replace(/\t/g,"β†’ "):s.content;return e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:ee,minHeight:20,fontSize:12,fontFamily:'"JetBrains Mono", "Fira Code", monospace'},children:[Q!==void 0&&e.jsx("div",{style:{minWidth:50,padding:"0 8px",textAlign:"right",color:"#666",background:"rgba(0,0,0,0.2)",userSelect:"none",borderRight:"1px solid #333"},children:Q}),E==="unified"&&e.jsx("div",{style:{width:20,textAlign:"center",color:Z,fontWeight:600},children:s.type==="addition"?"+":s.type==="deletion"?"-":" "}),e.jsx("div",{style:{flex:1,padding:"0 8px",color:Z,whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:u||" "}),_&&Q&&s.type!=="header"&&e.jsx("button",{onClick:()=>k({filePath:K,line:Q,side:R||"new",body:""}),style:{width:24,border:"none",background:"transparent",color:"#3b82f6",cursor:"pointer",opacity:.3,transition:"opacity 0.2s"},onMouseEnter:I=>I.currentTarget.style.opacity="1",onMouseLeave:I=>I.currentTarget.style.opacity="0.3",children:"πŸ’¬"})]},`${f}-${R||"unified"}`)},p=s=>e.jsx("div",{style:{borderTop:"1px solid #333"},children:s.chunks.map((f,R)=>{const ee=`${s.path}:${R}`;return b.has(ee),e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>t(s.path,R),style:{padding:"6px 12px",background:"rgba(59, 130, 246, 0.1)",borderBottom:"1px solid #333",fontSize:11,color:"#60a5fa",cursor:"pointer",fontFamily:"monospace"},children:["@@ -",f.oldStart,",",f.oldLines," +",f.newStart,",",f.newLines," @@"," ",f.header||""]}),f.lines.map((Z,Q)=>n(Z,Q))]},R)})}),c=s=>e.jsx("div",{style:{borderTop:"1px solid #333"},children:s.chunks.map((f,R)=>{const ee=[],Z=[];for(const u of f.lines)(u.type==="deletion"||u.type==="context")&&ee.push(u),(u.type==="addition"||u.type==="context")&&Z.push(u);const Q=Math.max(ee.length,Z.length);for(;ee.length<Q;)ee.push({content:"",type:"context"});for(;Z.length<Q;)Z.push({content:"",type:"context"});return e.jsxs("div",{children:[e.jsxs("div",{style:{padding:"6px 12px",background:"rgba(59, 130, 246, 0.1)",borderBottom:"1px solid #333",fontSize:11,color:"#60a5fa",fontFamily:"monospace"},children:["@@ -",f.oldStart,",",f.oldLines," +",f.newStart,",",f.newLines," @@"," ",f.header||""]}),e.jsxs("div",{style:{display:"flex"},children:[e.jsx("div",{style:{flex:1,borderRight:"1px solid #444"},children:ee.map((u,I)=>n(u,I,"old"))}),e.jsx("div",{style:{flex:1},children:Z.map((u,I)=>n(u,I,"new"))})]})]},R)})});return e.jsxs("div",{className:`nice-git-diff-viewer ${w||""}`,style:{display:"flex",height:"100%",background:"#1e1e1e",color:"#e0e0e0",fontFamily:"system-ui, sans-serif",...B},"data-testid":C,children:[q&&e.jsxs("div",{style:{width:280,borderRight:"1px solid #333",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:12,borderBottom:"1px solid #333",background:"#252525"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{fontSize:16},children:"πŸ“"}),e.jsx("span",{style:{fontWeight:600,fontSize:13},children:"Changed Files"}),e.jsx("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"#333",borderRadius:10,fontSize:11},children:x.length})]}),(M||T)&&e.jsxs("div",{style:{fontSize:11,color:"#888"},children:[M&&e.jsx("span",{children:M}),M&&T&&e.jsx("span",{style:{margin:"0 4px"},children:"β†’"}),T&&e.jsx("span",{style:{color:"#22c55e"},children:T})]})]}),e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid #333",display:"flex",gap:12,fontSize:12},children:[e.jsxs("span",{style:{color:"#22c55e"},children:["+",Y.additions]}),e.jsxs("span",{style:{color:"#ef4444"},children:["-",Y.deletions]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:x.map(s=>{const f=i(s.status),R=s.path===K;return e.jsxs("div",{onClick:()=>X(s.path),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",cursor:"pointer",background:R?"rgba(59, 130, 246, 0.15)":"transparent",borderLeft:R?"2px solid #3b82f6":"2px solid transparent"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:2,background:f.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"white",fontWeight:600},children:f.icon}),e.jsx("span",{style:{flex:1,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.path.split("/").pop()}),e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10},children:[s.additions>0&&e.jsxs("span",{style:{color:"#22c55e"},children:["+",s.additions]}),s.deletions>0&&e.jsxs("span",{style:{color:"#ef4444"},children:["-",s.deletions]})]})]},s.path)})})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid #333",background:"#252525",display:"flex",alignItems:"center",gap:16},children:[O&&e.jsx("div",{style:{flex:1,fontSize:13,fontFamily:"monospace"},children:O.oldPath&&O.oldPath!==O.path?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"#ef4444"},children:O.oldPath}),e.jsx("span",{style:{margin:"0 8px",color:"#888"},children:"β†’"}),e.jsx("span",{style:{color:"#22c55e"},children:O.path})]}):O.path}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>a("unified"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:E==="unified"?"#3b82f6":"#333",color:"white",cursor:"pointer",fontSize:11},children:"Unified"}),e.jsx("button",{onClick:()=>a("split"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:E==="split"?"#3b82f6":"#333",color:"white",cursor:"pointer",fontSize:11},children:"Split"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"#888",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:F,onChange:s=>V(s.target.checked)}),"Show whitespace"]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:O?O.binary?e.jsxs("div",{style:{padding:40,textAlign:"center",color:"#888"},children:[e.jsx("span",{style:{fontSize:48},children:"πŸ“¦"}),e.jsx("p",{children:"Binary file cannot be displayed"})]}):E==="split"?c(O):p(O):e.jsx("div",{style:{padding:40,textAlign:"center",color:"#666"},children:"Select a file to view changes"})}),l.length>0&&e.jsxs("div",{style:{borderTop:"1px solid #333",background:"#252525",maxHeight:200,overflow:"auto"},children:[e.jsxs("div",{style:{padding:"8px 16px",fontSize:12,fontWeight:600,borderBottom:"1px solid #333"},children:["Comments (",l.length,")"]}),l.map(s=>e.jsxs("div",{style:{padding:12,borderBottom:"1px solid #333",opacity:s.resolved?.5:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[s.author.avatar?e.jsx("img",{src:s.author.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"#666",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:s.author.name[0]}),e.jsx("span",{style:{fontSize:12,fontWeight:500},children:s.author.name}),e.jsxs("span",{style:{fontSize:10,color:"#888"},children:["Line ",s.line," (",s.side,")"]}),s.resolved&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"#22c55e22",color:"#22c55e"},children:"Resolved"}),g&&!s.resolved&&e.jsx("button",{onClick:()=>g(s.id),style:{marginLeft:"auto",padding:"4px 8px",borderRadius:4,border:"none",background:"#333",color:"#888",cursor:"pointer",fontSize:10},children:"Resolve"})]}),e.jsx("div",{style:{fontSize:12,color:"#ccc"},children:s.body})]},s.id))]}),h&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>k(null),children:e.jsxs("div",{style:{width:400,background:"#252525",borderRadius:8,padding:20},onClick:s=>s.stopPropagation(),children:[e.jsxs("h3",{style:{margin:"0 0 12px",fontSize:14},children:["Add comment on line ",h.line]}),e.jsx("textarea",{value:h.body,onChange:s=>k({...h,body:s.target.value}),placeholder:"Write a comment...",rows:4,style:{width:"100%",padding:12,borderRadius:6,border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:13,resize:"vertical"},autoFocus:!0}),e.jsxs("div",{style:{marginTop:12,display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>k(null),style:{padding:"8px 16px",borderRadius:4,border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:12},children:"Cancel"}),e.jsx("button",{onClick:()=>{h.body.trim()&&(_?.(h.filePath,h.line,h.side,h.body.trim()),k(null))},disabled:!h.body.trim(),style:{padding:"8px 16px",borderRadius:4,border:"none",background:h.body.trim()?"#3b82f6":"#333",color:"white",cursor:h.body.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Add Comment"})]})]})})]})]})},$e=Object.freeze(Object.defineProperty({__proto__:null,NiceGitDiffViewer:be},Symbol.toStringTag,{value:"Module"})),Ne=(x,j)=>{const N=new Date().getTime()-x.getTime(),A=Math.floor(N/(1e3*60*60*24));return A===0?"today":A===1?"yesterday":A<7?`${A} days ago`:A<30?`${Math.floor(A/7)} weeks ago`:A<365?`${Math.floor(A/30)} months ago`:`${Math.floor(A/365)} years ago`},Ae=x=>{const z=new Date().getTime()-x.getTime(),N=Math.floor(z/(1e3*60*60*24));return N<7?"rgba(59, 130, 246, 0.3)":N<30?"rgba(34, 197, 94, 0.3)":N<90?"rgba(234, 179, 8, 0.3)":N<365?"rgba(249, 115, 22, 0.3)":"rgba(239, 68, 68, 0.3)"},ie=x=>{const j=["#3b82f6","#22c55e","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899","#14b8a6","#f97316","#6366f1"];let z=0;for(let N=0;N<x.length;N++)z=(z<<5)-z+x.charCodeAt(N),z=z&z;return j[Math.abs(z)%j.length]},ye=({file:x,viewMode:j="inline",showAgeHeatmap:z=!0,showAvatars:N=!0,groupHunks:A=!0,highlightOnHover:q=!0,timeZone:G,dateRange:M,authorFilter:T,selectedLine:L,syntaxTheme:U="dark",onLineClick:_,onCommitClick:g,onAuthorClick:m,onBlameParent:w,className:B,style:C,"data-testid":v="nice-git-blame"})=>{const[y,W]=o.useState(null),[V,P]=o.useState(null),[D,b]=o.useState(null),S=o.useMemo(()=>{const t=[];return x.hunks.forEach(l=>{l.lines.forEach(i=>{t.push(i)})}),t.sort((l,i)=>l.lineNumber-i.lineNumber)},[x.hunks]),h=o.useMemo(()=>S.filter(t=>!(M?.from&&t.commit.timestamp<M.from||M?.to&&t.commit.timestamp>M.to||T&&T.length>0&&!T.includes(t.commit.author.id))),[S,M,T]),k=o.useMemo(()=>{if(!A)return h.map(n=>({startLine:n.lineNumber,endLine:n.lineNumber,commit:n.commit,lines:[n],isFirstOfCommit:!0}));const t=[];let l=null;const i=new Set;return h.forEach(n=>{if(!l||l.commit.id!==n.commit.id){const p=!i.has(n.commit.id);i.add(n.commit.id),l={startLine:n.lineNumber,endLine:n.lineNumber,commit:n.commit,lines:[n],isFirstOfCommit:p},t.push(l)}else l.endLine=n.lineNumber,l.lines.push(n)}),t},[h,A]),E=o.useMemo(()=>{const t=new Map;return S.forEach(l=>{t.has(l.commit.author.id)||t.set(l.commit.author.id,l.commit.author)}),Array.from(t.values())},[S]),F=o.useMemo(()=>{const t=new Map;return S.forEach(l=>{t.has(l.commit.id)||t.set(l.commit.id,l.commit)}),Array.from(t.values()).sort((l,i)=>i.timestamp.getTime()-l.timestamp.getTime())},[S]),K=o.useCallback(t=>{_?.(t)},[_]),O=o.useCallback((t,l)=>{l.stopPropagation(),V===t.id?P(null):P(t.id),g?.(t)},[V,g]),Y=(t,l)=>{const i=l===0,n=t.commit,p=q&&y===n.id;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0 12px",minWidth:j==="inline"?280:40,background:p?"rgba(59, 130, 246, 0.15)":z?Ae(n.timestamp):"transparent",borderRight:`3px solid ${ie(n.author.id)}`,cursor:"pointer",transition:"background 0.15s"},onMouseEnter:()=>W(n.id),onMouseLeave:()=>W(null),onClick:c=>O(n,c),children:[i&&j==="inline"&&e.jsxs(e.Fragment,{children:[N&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:ie(n.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,color:"#fff",fontWeight:500,flexShrink:0},title:n.author.name,children:n.author.avatar?e.jsx("img",{src:n.author.avatar,alt:n.author.name,style:{width:"100%",height:"100%",borderRadius:"50%"}}):n.author.name[0].toUpperCase()}),e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[e.jsx("div",{style:{fontSize:11,fontFamily:"monospace",color:"#6b7280",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:n.shortId}),e.jsx("div",{style:{fontSize:10,color:"#9ca3af",whiteSpace:"nowrap"},children:Ne(n.timestamp)})]})]}),j==="gutter"&&i&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:ie(n.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"#fff"},title:`${n.author.name} - ${n.shortId}
2
+ ${n.message}`,children:n.author.name[0].toUpperCase()})]})},X=t=>{if(D!==t.lineNumber||j!=="tooltip")return null;const l=t.commit;return e.jsxs("div",{style:{position:"absolute",left:60,top:-8,zIndex:100,background:"#1f2937",border:"1px solid #374151",borderRadius:8,padding:12,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",minWidth:320},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:ie(l.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontWeight:500},children:l.author.name[0].toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,color:"#e5e7eb"},children:l.author.name}),e.jsx("div",{style:{fontSize:11,color:"#9ca3af"},children:l.author.email})]})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12,color:"#60a5fa",marginBottom:4},children:l.shortId}),e.jsx("div",{style:{fontSize:13,color:"#e5e7eb",marginBottom:8},children:l.message}),e.jsx("div",{style:{fontSize:11,color:"#6b7280"},children:l.timestamp.toLocaleString()}),l.parents&&l.parents.length>0&&w&&e.jsx("button",{onClick:()=>w(l),style:{marginTop:8,padding:"4px 8px",background:"#374151",border:"none",borderRadius:4,color:"#e5e7eb",fontSize:11,cursor:"pointer"},children:"⬆ Blame parent"})]})},a=t=>V!==t.id?null:e.jsx("div",{style:{background:"#1f2937",borderBottom:"1px solid #374151",padding:16},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:ie(t.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"#fff",fontSize:20,fontWeight:500,flexShrink:0},children:t.author.name[0].toUpperCase()}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontWeight:500,color:"#e5e7eb"},children:t.author.name}),e.jsx("span",{style:{fontSize:11,color:"#6b7280"},children:t.author.email})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13,color:"#60a5fa",marginBottom:8},children:t.id}),e.jsx("div",{style:{fontSize:14,color:"#e5e7eb",marginBottom:8,lineHeight:1.5},children:t.message}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,fontSize:12,color:"#9ca3af"},children:[e.jsxs("span",{children:["πŸ“… ",t.timestamp.toLocaleString()]}),t.parents&&t.parents.length>0&&e.jsxs("span",{children:["πŸ‘† ",t.parents.length," parent(s)"]})]}),w&&t.parents&&t.parents.length>0&&e.jsx("button",{onClick:()=>w(t),style:{marginTop:12,padding:"6px 12px",background:"#3b82f6",border:"none",borderRadius:6,color:"#fff",fontSize:12,cursor:"pointer"},children:"⬆ Blame in parent commit"})]})]})});return e.jsxs("div",{className:`nice-git-blame ${B||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:U==="dark"?"#0d1117":"#ffffff",color:U==="dark"?"#e6edf3":"#1f2937",fontFamily:"system-ui, sans-serif",...C},"data-testid":v,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #30363d",background:U==="dark"?"#161b22":"#f6f8fa"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:16},children:"πŸ“‹"}),e.jsx("span",{style:{fontWeight:500},children:x.path}),e.jsxs("span",{style:{fontSize:12,color:"#8b949e"},children:["at ",x.revision.substring(0,7)]})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:e.jsxs("span",{style:{fontSize:12,color:"#8b949e"},children:[F.length," commits by ",E.length," author(s)"]})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,padding:"8px 16px",borderBottom:"1px solid #30363d",background:U==="dark"?"#161b22":"#f6f8fa",flexWrap:"wrap"},children:[E.slice(0,10).map(t=>e.jsxs("div",{onClick:()=>m?.(t),style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer"},children:[e.jsx("div",{style:{width:12,height:12,borderRadius:"50%",background:ie(t.id)}}),e.jsx("span",{style:{fontSize:12},children:t.name})]},t.id)),E.length>10&&e.jsxs("span",{style:{fontSize:12,color:"#8b949e"},children:["+",E.length-10," more"]})]}),e.jsx("div",{style:{flex:1,overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,lineHeight:"20px"},children:k.map((t,l)=>e.jsxs(o.Fragment,{children:[t.isFirstOfCommit&&V===t.commit.id&&a(t.commit),t.lines.map((i,n)=>e.jsxs("div",{onClick:()=>K(i),onMouseEnter:()=>b(i.lineNumber),onMouseLeave:()=>b(null),style:{display:"flex",alignItems:"stretch",background:L===i.lineNumber?"rgba(59, 130, 246, 0.2)":q&&y===t.commit.id?"rgba(59, 130, 246, 0.08)":"transparent",borderLeft:L===i.lineNumber?"2px solid #3b82f6":"2px solid transparent",position:"relative"},children:[Y(t,n),e.jsx("div",{style:{padding:"0 12px",color:"#6e7681",textAlign:"right",minWidth:50,userSelect:"none",background:U==="dark"?"#0d1117":"#f6f8fa",borderRight:"1px solid #30363d"},children:i.lineNumber}),e.jsx("div",{style:{flex:1,padding:"0 16px",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:i.content}),j==="tooltip"&&X(i)]},i.lineNumber))]},`${t.commit.id}-${t.startLine}`))}),z&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,padding:"8px 16px",borderTop:"1px solid #30363d",background:U==="dark"?"#161b22":"#f6f8fa",fontSize:11,color:"#8b949e"},children:[e.jsx("span",{children:"Age:"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"rgba(59, 130, 246, 0.3)",borderRadius:2}}),e.jsx("span",{children:"<1 week"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"rgba(34, 197, 94, 0.3)",borderRadius:2}}),e.jsx("span",{children:"<1 month"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"rgba(234, 179, 8, 0.3)",borderRadius:2}}),e.jsx("span",{children:"<3 months"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"rgba(249, 115, 22, 0.3)",borderRadius:2}}),e.jsx("span",{children:"<1 year"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"rgba(239, 68, 68, 0.3)",borderRadius:2}}),e.jsx("span",{children:">1 year"})]})]})]})},Pe=Object.freeze(Object.defineProperty({__proto__:null,NiceGitBlame:ye},Symbol.toStringTag,{value:"Module"})),De=x=>{if(!x.resolved)return[];switch(x.resolution){case"ours":return x.oursContent;case"theirs":return x.theirsContent;case"both":return[...x.oursContent,...x.theirsContent];case"custom":return x.customContent||[];default:return[]}},je=({file:x,context:j,viewMode:z="split",showLineNumbers:N=!0,showBase:A=!1,currentConflictIndex:q,syntaxTheme:G="dark",onResolve:M,onResolveAll:T,onNavigateConflict:L,onSave:U,onCancel:_,className:g,style:m,"data-testid":w="nice-git-conflict-resolver"})=>{const[B,C]=o.useState(x.conflicts),[v,y]=o.useState(q??0),[W,V]=o.useState(null),[P,D]=o.useState(""),b=o.useMemo(()=>B.filter(n=>!n.resolved).length,[B]),S=o.useMemo(()=>B.filter(n=>n.resolved).length,[B]),h=B[v],k=o.useCallback((n,p,c)=>{C(f=>f.map(R=>R.id===n?{...R,resolved:!0,resolution:p,customContent:c}:R)),V(null),M?.(n,p,c);const s=B.findIndex((f,R)=>R>v&&!f.resolved);s!==-1&&(y(s),L?.(s))},[B,v,M,L]),E=o.useCallback(n=>{C(p=>p.map(c=>c.resolved?c:{...c,resolved:!0,resolution:n})),T?.(n)},[T]),F=o.useCallback(n=>{const p=n==="prev"?Math.max(0,v-1):Math.min(B.length-1,v+1);y(p),L?.(p)},[v,B.length,L]),K=o.useCallback(()=>{h&&(V(h.id),D(h.oursContent.join(`
3
+ `)))},[h]),O=o.useCallback(()=>{W&&k(W,"custom",P.split(`
4
+ `))},[W,P,k]),Y=o.useCallback(()=>{const n=x.content.split(`
5
+ `);let p=[],c=0;B.forEach(s=>{p=[...p,...n.slice(c,s.startLine-1)],p=[...p,...De(s)],c=s.endLine}),p=[...p,...n.slice(c)],U?.(p.join(`
6
+ `))},[x.content,B,U]),X=(n,p,c,s)=>e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,borderLeft:`3px solid ${c}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:`${c}20`,borderBottom:"1px solid #30363d"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:500,color:c},children:n}),s&&e.jsx("button",{onClick:s,style:{padding:"4px 10px",background:c,border:"none",borderRadius:4,color:"#fff",fontSize:11,cursor:"pointer"},children:"Accept"})]}),e.jsx("div",{style:{flex:1,overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,lineHeight:"20px"},children:p.map((f,R)=>e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:G==="dark"?"#0d1117":"#fff"},children:[N&&e.jsx("span",{style:{padding:"0 12px",color:"#6e7681",textAlign:"right",minWidth:40,borderRight:"1px solid #30363d",userSelect:"none"},children:R+1}),e.jsx("span",{style:{padding:"0 12px",whiteSpace:"pre"},children:f||" "})]},R))})]}),a=()=>h?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[e.jsxs("div",{style:{background:"rgba(34, 197, 94, 0.1)",borderLeft:"3px solid #22c55e"},children:[e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid #30363d",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontSize:12,color:"#22c55e",fontWeight:500},children:["← Ours (",j?.oursCommit.branch||"HEAD",")"]}),e.jsx("button",{onClick:()=>k(h.id,"ours"),style:{padding:"4px 10px",background:"#22c55e",border:"none",borderRadius:4,color:"#fff",fontSize:11,cursor:"pointer"},children:"Accept Ours"})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:h.oursContent.join(`
7
+ `)})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 12px",background:"#1f2937"},children:[e.jsx("div",{style:{flex:1,height:1,background:"#374151"}}),e.jsx("span",{style:{color:"#9ca3af",fontSize:11},children:"VS"}),e.jsx("div",{style:{flex:1,height:1,background:"#374151"}})]}),e.jsxs("div",{style:{background:"rgba(59, 130, 246, 0.1)",borderLeft:"3px solid #3b82f6"},children:[e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid #30363d",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontSize:12,color:"#3b82f6",fontWeight:500},children:["β†’ Theirs (",j?.theirsCommit.branch||"incoming",")"]}),e.jsx("button",{onClick:()=>k(h.id,"theirs"),style:{padding:"4px 10px",background:"#3b82f6",border:"none",borderRadius:4,color:"#fff",fontSize:11,cursor:"pointer"},children:"Accept Theirs"})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:h.theirsContent.join(`
8
+ `)})]})]}):null,t=()=>h?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[X(`← Ours (${j?.oursCommit.branch||"HEAD"})`,h.oursContent,"#22c55e",()=>k(h.id,"ours")),A&&X("Base (ancestor)",h.baseContent,"#6b7280"),X(`β†’ Theirs (${j?.theirsCommit.branch||"incoming"})`,h.theirsContent,"#3b82f6",()=>k(h.id,"theirs"))]}):null,l=()=>h?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[X(`← Ours (${j?.oursCommit.branch||"HEAD"})`,h.oursContent,"#22c55e",()=>k(h.id,"ours")),X("Base",h.baseContent,"#6b7280"),X(`β†’ Theirs (${j?.theirsCommit.branch||"incoming"})`,h.theirsContent,"#3b82f6",()=>k(h.id,"theirs"))]}):null,i=()=>W!==h?.id?null:e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.8)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:e.jsxs("div",{style:{width:"80%",maxWidth:800,background:"#1f2937",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid #374151",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontWeight:500},children:"✏️ Edit Resolution"}),e.jsx("button",{onClick:()=>V(null),style:{background:"transparent",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:18},children:"βœ•"})]}),e.jsx("textarea",{value:P,onChange:n=>D(n.target.value),style:{width:"100%",height:300,padding:16,fontFamily:"monospace",fontSize:13,background:"#0d1117",color:"#e6edf3",border:"none",resize:"none"}}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid #374151",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>V(null),style:{padding:"8px 16px",background:"#374151",border:"none",borderRadius:6,color:"#fff",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:O,style:{padding:"8px 16px",background:"#3b82f6",border:"none",borderRadius:6,color:"#fff",cursor:"pointer"},children:"Save Changes"})]})]})});return e.jsxs("div",{className:`nice-git-conflict-resolver ${g||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:G==="dark"?"#0d1117":"#ffffff",color:G==="dark"?"#e6edf3":"#1f2937",fontFamily:"system-ui, sans-serif",position:"relative",...m},"data-testid":w,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #30363d",background:G==="dark"?"#161b22":"#f6f8fa"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:18},children:"⚠️"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:x.path}),e.jsxs("div",{style:{fontSize:12,color:"#8b949e"},children:[B.length," conflict(s) β€’ ",S," resolved β€’ ",b," ","remaining"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:_,style:{padding:"6px 12px",background:"#374151",border:"none",borderRadius:6,color:"#fff",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:Y,disabled:b>0,style:{padding:"6px 12px",background:b>0?"#374151":"#22c55e",border:"none",borderRadius:6,color:"#fff",cursor:b>0?"not-allowed":"pointer",opacity:b>0?.5:1},children:"βœ“ Save Resolved"})]})]}),j&&e.jsxs("div",{style:{display:"flex",gap:24,padding:"8px 16px",borderBottom:"1px solid #30363d",background:G==="dark"?"#161b22":"#f6f8fa",fontSize:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{color:"#22c55e"},children:"← Ours:"}),e.jsx("span",{children:j.oursCommit.branch}),e.jsxs("span",{style:{color:"#8b949e",fontFamily:"monospace"},children:["(",j.oursCommit.shortId,")"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{color:"#3b82f6"},children:"β†’ Theirs:"}),e.jsx("span",{children:j.theirsCommit.branch}),e.jsxs("span",{style:{color:"#8b949e",fontFamily:"monospace"},children:["(",j.theirsCommit.shortId,")"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:"1px solid #30363d",background:G==="dark"?"#1f2937":"#f0f0f0"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>F("prev"),disabled:v===0,style:{padding:"4px 8px",background:"#374151",border:"none",borderRadius:4,color:"#fff",cursor:v===0?"not-allowed":"pointer",opacity:v===0?.5:1},children:"← Prev"}),e.jsxs("span",{style:{padding:"0 8px"},children:["Conflict ",v+1," of ",B.length,h?.resolved&&e.jsx("span",{style:{marginLeft:8,color:"#22c55e"},children:"βœ“ Resolved"})]}),e.jsx("button",{onClick:()=>F("next"),disabled:v===B.length-1,style:{padding:"4px 8px",background:"#374151",border:"none",borderRadius:4,color:"#fff",cursor:v===B.length-1?"not-allowed":"pointer",opacity:v===B.length-1?.5:1},children:"Next β†’"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>E("ours"),disabled:b===0,style:{padding:"4px 10px",background:"#22c55e",border:"none",borderRadius:4,color:"#fff",fontSize:11,cursor:b===0?"not-allowed":"pointer",opacity:b===0?.5:1},children:"Accept All Ours"}),e.jsx("button",{onClick:()=>E("theirs"),disabled:b===0,style:{padding:"4px 10px",background:"#3b82f6",border:"none",borderRadius:4,color:"#fff",fontSize:11,cursor:b===0?"not-allowed":"pointer",opacity:b===0?.5:1},children:"Accept All Theirs"})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[h&&!h.resolved&&e.jsxs(e.Fragment,{children:[z==="inline"&&a(),z==="split"&&t(),z==="three-way"&&l()]}),h?.resolved&&e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,color:"#22c55e"},children:[e.jsx("span",{style:{fontSize:48},children:"βœ“"}),e.jsx("span",{style:{fontSize:18},children:"Conflict Resolved"}),e.jsxs("span",{style:{color:"#8b949e",fontSize:13},children:["Resolution: ",h.resolution]}),e.jsx("button",{onClick:()=>C(n=>n.map(p=>p.id===h.id?{...p,resolved:!1,resolution:void 0}:p)),style:{padding:"8px 16px",background:"#374151",border:"none",borderRadius:6,color:"#fff",cursor:"pointer"},children:"↩ Re-resolve"})]})]}),h&&!h.resolved&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,padding:"12px 16px",borderTop:"1px solid #30363d",background:G==="dark"?"#161b22":"#f6f8fa"},children:[e.jsx("button",{onClick:()=>k(h.id,"ours"),style:{padding:"8px 20px",background:"#22c55e",border:"none",borderRadius:6,color:"#fff",cursor:"pointer",fontWeight:500},children:"βœ“ Accept Ours"}),e.jsx("button",{onClick:()=>k(h.id,"theirs"),style:{padding:"8px 20px",background:"#3b82f6",border:"none",borderRadius:6,color:"#fff",cursor:"pointer",fontWeight:500},children:"βœ“ Accept Theirs"}),e.jsx("button",{onClick:()=>k(h.id,"both"),style:{padding:"8px 20px",background:"#8b5cf6",border:"none",borderRadius:6,color:"#fff",cursor:"pointer",fontWeight:500},children:"↔ Accept Both"}),e.jsx("button",{onClick:K,style:{padding:"8px 20px",background:"#f59e0b",border:"none",borderRadius:6,color:"#fff",cursor:"pointer",fontWeight:500},children:"✏️ Edit Manually"})]}),i()]})},Le=Object.freeze(Object.defineProperty({__proto__:null,NiceGitConflictResolver:je},Symbol.toStringTag,{value:"Module"})),de={"pre-commit":{title:"Pre-commit",description:"Runs before commit is created. Good for linting and formatting.",icon:"βœ“"},"prepare-commit-msg":{title:"Prepare Commit Message",description:"Runs before commit message editor opens. Can modify default message.",icon:"πŸ“"},"commit-msg":{title:"Commit Message",description:"Validates commit message format (e.g., conventional commits).",icon:"πŸ’¬"},"post-commit":{title:"Post-commit",description:"Runs after commit is created. Good for notifications.",icon:"πŸ“€"},"pre-push":{title:"Pre-push",description:"Runs before push. Good for running tests.",icon:"πŸš€"},"pre-rebase":{title:"Pre-rebase",description:"Runs before rebase starts.",icon:"πŸ”€"},"post-merge":{title:"Post-merge",description:"Runs after merge completes. Good for dependency updates.",icon:"πŸ”—"},"post-checkout":{title:"Post-checkout",description:"Runs after checkout completes.",icon:"πŸ“₯"},"pre-auto-gc":{title:"Pre-auto GC",description:"Runs before automatic garbage collection.",icon:"πŸ—‘οΈ"}},Ee=[{id:"eslint-staged",name:"ESLint (staged files)",description:"Run ESLint on staged JavaScript/TypeScript files",icon:"πŸ”",category:"lint",hook:"pre-commit",actions:[{type:"lint",name:"ESLint",command:"npx eslint --fix",runOn:"staged",filePatterns:["*.js","*.jsx","*.ts","*.tsx"],enabled:!0,failOnError:!0}]},{id:"prettier-staged",name:"Prettier (staged files)",description:"Format staged files with Prettier",icon:"✨",category:"lint",hook:"pre-commit",actions:[{type:"format",name:"Prettier",command:"npx prettier --write",runOn:"staged",filePatterns:["*.js","*.jsx","*.ts","*.tsx","*.css","*.json","*.md"],enabled:!0,failOnError:!1}]},{id:"jest-tests",name:"Jest Tests",description:"Run Jest tests before push",icon:"πŸ§ͺ",category:"test",hook:"pre-push",actions:[{type:"test",name:"Jest",command:"npm test",runOn:"all",enabled:!0,failOnError:!0}]},{id:"typecheck",name:"TypeScript Check",description:"Run TypeScript compiler check",icon:"πŸ“˜",category:"quality",hook:"pre-commit",actions:[{type:"typecheck",name:"tsc",command:"npx tsc --noEmit",runOn:"all",enabled:!0,failOnError:!0}]},{id:"conventional-commits",name:"Conventional Commits",description:"Validate commit message format",icon:"πŸ“‹",category:"quality",hook:"commit-msg",actions:[{type:"custom",name:"Commitlint",command:"npx commitlint --edit $1",enabled:!0,failOnError:!0}]},{id:"secrets-scan",name:"Secret Detection",description:"Scan for accidentally committed secrets",icon:"πŸ”",category:"security",hook:"pre-commit",actions:[{type:"custom",name:"Detect Secrets",command:"npx secretlint",runOn:"staged",enabled:!0,failOnError:!0}]}],ve=({hooks:x,templates:j=Ee,manager:z="husky",repoPath:N,selectedHook:A,onHookChange:q,onHookToggle:G,onActionAdd:M,onActionRemove:T,onActionUpdate:L,onInstall:U,onUninstall:_,onExport:g,className:m,style:w,"data-testid":B="nice-git-hooks"})=>{const[C,v]=o.useState(x),[y,W]=o.useState(A||null),[V,P]=o.useState(!1),[D,b]=o.useState(null),[S,h]=o.useState(!1),k=o.useMemo(()=>C.find(i=>i.type===y),[C,y]),E=o.useCallback((i,n)=>{v(p=>p.map(c=>c.type===i?{...c,enabled:n}:c)),G?.(i,n)},[G]),F=o.useCallback(i=>{if(!y)return;const n=i?i.actions.map((p,c)=>({...p,id:crypto.randomUUID(),order:(k?.actions.length||0)+c})):[{id:crypto.randomUUID(),type:"custom",name:"New Action",command:'echo "Hello"',order:k?.actions.length||0,enabled:!0,failOnError:!0}];v(p=>p.map(c=>c.type===y?{...c,actions:[...c.actions,...n]}:c)),n.forEach(p=>M?.(y,p)),P(!1)},[y,k,M]),K=o.useCallback(i=>{y&&(v(n=>n.map(p=>p.type===y?{...p,actions:p.actions.filter(c=>c.id!==i)}:p)),T?.(y,i))},[y,T]),O=o.useCallback(i=>{y&&(v(n=>n.map(p=>p.type===y?{...p,actions:p.actions.map(c=>c.id===i.id?i:c)}:p)),b(null),L?.(y,i))},[y,L]),Y=o.useCallback((i,n)=>{if(!k)return;const p=[...k.actions],c=p.findIndex(f=>f.id===i);if(c===-1)return;const s=n==="up"?c-1:c+1;s<0||s>=p.length||([p[c],p[s]]=[p[s],p[c]],p.forEach((f,R)=>f.order=R),v(f=>f.map(R=>R.type===y?{...R,actions:p}:R)))},[k,y]),X=o.useCallback(i=>{const n=["#!/bin/sh",""];return i.verbose&&n.push("set -x"),n.push("# Generated by NiceGitHooks",`# Hook: ${i.type}`,""),i.actions.forEach(p=>{if(!p.enabled){n.push(`# [DISABLED] ${p.name}`);return}if(n.push(`# ${p.name}`),p.condition){const{type:s,operator:f,value:R}=p.condition;s==="branch"?(n.push("BRANCH=$(git rev-parse --abbrev-ref HEAD)"),f==="equals"?n.push(`if [ "$BRANCH" != "${R}" ]; then exit 0; fi`):f==="matches"&&n.push(`if ! echo "$BRANCH" | grep -q "${R}"; then exit 0; fi`)):s==="env"&&n.push(`if [ -z "$${R}" ]; then exit 0; fi`)}let c=p.command;p.runOn==="staged"&&p.filePatterns?.length&&(p.filePatterns.map(s=>`'${s}'`).join(" "),c=`git diff --cached --name-only --diff-filter=ACM | grep -E "${p.filePatterns.join("|")}" | xargs ${c}`),n.push(c),p.failOnError&&(n.push("if [ $? -ne 0 ]; then"),n.push(` echo "❌ ${p.name} failed""`),n.push(" exit 1"),n.push("fi")),n.push("")}),n.push("exit 0"),n.join(`
9
+ `)},[]),a=i=>({lint:"πŸ”",test:"πŸ§ͺ",format:"✨",typecheck:"πŸ“˜",build:"πŸ”¨",custom:"βš™οΈ"})[i],t=()=>D?e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.8)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:e.jsxs("div",{style:{width:"90%",maxWidth:600,background:"#1f2937",borderRadius:12,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid #374151",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontWeight:500,fontSize:16},children:"✏️ Edit Action"}),e.jsx("button",{onClick:()=>b(null),style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:20},children:"βœ•"})]}),e.jsxs("div",{style:{padding:20,display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#9ca3af",marginBottom:4},children:"Name"}),e.jsx("input",{type:"text",value:D.name,onChange:i=>b({...D,name:i.target.value}),style:{width:"100%",padding:"8px 12px",background:"#374151",border:"1px solid #4b5563",borderRadius:6,color:"#fff"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#9ca3af",marginBottom:4},children:"Type"}),e.jsxs("select",{value:D.type,onChange:i=>b({...D,type:i.target.value}),style:{width:"100%",padding:"8px 12px",background:"#374151",border:"1px solid #4b5563",borderRadius:6,color:"#fff"},children:[e.jsx("option",{value:"lint",children:"πŸ” Lint"}),e.jsx("option",{value:"test",children:"πŸ§ͺ Test"}),e.jsx("option",{value:"format",children:"✨ Format"}),e.jsx("option",{value:"typecheck",children:"πŸ“˜ Typecheck"}),e.jsx("option",{value:"build",children:"πŸ”¨ Build"}),e.jsx("option",{value:"custom",children:"βš™οΈ Custom"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#9ca3af",marginBottom:4},children:"Command"}),e.jsx("textarea",{value:D.command,onChange:i=>b({...D,command:i.target.value}),style:{width:"100%",padding:"8px 12px",background:"#374151",border:"1px solid #4b5563",borderRadius:6,color:"#fff",fontFamily:"monospace",minHeight:80,resize:"vertical"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#9ca3af",marginBottom:4},children:"Run On"}),e.jsxs("select",{value:D.runOn||"all",onChange:i=>b({...D,runOn:i.target.value}),style:{width:"100%",padding:"8px 12px",background:"#374151",border:"1px solid #4b5563",borderRadius:6,color:"#fff"},children:[e.jsx("option",{value:"all",children:"All files"}),e.jsx("option",{value:"staged",children:"Staged files only"}),e.jsx("option",{value:"changed",children:"Changed files"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"#9ca3af",marginBottom:4},children:"File Patterns (comma-separated)"}),e.jsx("input",{type:"text",value:D.filePatterns?.join(", ")||"",onChange:i=>b({...D,filePatterns:i.target.value.split(",").map(n=>n.trim()).filter(Boolean)}),placeholder:"*.ts, *.tsx, *.js",style:{width:"100%",padding:"8px 12px",background:"#374151",border:"1px solid #4b5563",borderRadius:6,color:"#fff"}})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:D.enabled,onChange:i=>b({...D,enabled:i.target.checked})}),e.jsx("span",{style:{fontSize:13},children:"Enabled"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:D.failOnError,onChange:i=>b({...D,failOnError:i.target.checked})}),e.jsx("span",{style:{fontSize:13},children:"Fail on error"})]})]})]}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid #374151",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>b(null),style:{padding:"8px 16px",background:"#374151",border:"none",borderRadius:6,color:"#fff",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:()=>O(D),style:{padding:"8px 16px",background:"#3b82f6",border:"none",borderRadius:6,color:"#fff",cursor:"pointer"},children:"Save"})]})]})}):null,l=()=>{if(!S||!k)return null;const i=X(k);return e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.8)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:e.jsxs("div",{style:{width:"90%",maxWidth:700,maxHeight:"80vh",background:"#1f2937",borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid #374151",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontWeight:500,fontSize:16},children:["πŸ“œ Script Preview: ",k.type]}),e.jsx("button",{onClick:()=>h(!1),style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:20},children:"βœ•"})]}),e.jsx("pre",{style:{flex:1,margin:0,padding:20,background:"#0d1117",color:"#e6edf3",fontFamily:"monospace",fontSize:13,overflow:"auto"},children:i}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid #374151",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(i)},style:{padding:"8px 16px",background:"#374151",border:"none",borderRadius:6,color:"#fff",cursor:"pointer"},children:"πŸ“‹ Copy"}),e.jsx("button",{onClick:()=>h(!1),style:{padding:"8px 16px",background:"#3b82f6",border:"none",borderRadius:6,color:"#fff",cursor:"pointer"},children:"Close"})]})]})})};return e.jsxs("div",{className:`nice-git-hooks ${m||""}`,style:{display:"flex",height:"100%",background:"#0d1117",color:"#e6edf3",fontFamily:"system-ui, sans-serif",...w},"data-testid":B,children:[e.jsxs("div",{style:{width:280,borderRight:"1px solid #30363d",display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid #30363d",fontWeight:500},children:"πŸͺ Git Hooks"}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:Object.entries(de).map(([i,n])=>{const p=C.find(f=>f.type===i),c=y===i,s=p?.actions.length||0;return e.jsxs("div",{onClick:()=>W(i),style:{padding:"12px 16px",cursor:"pointer",background:c?"rgba(59, 130, 246, 0.15)":"transparent",borderLeft:c?"2px solid #3b82f6":"2px solid transparent",display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:18},children:n.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:500},children:n.title}),e.jsxs("div",{style:{fontSize:11,color:"#8b949e"},children:[s," action",s!==1?"s":""]})]}),e.jsx("button",{onClick:f=>{f.stopPropagation(),E(i,!p?.enabled)},style:{width:36,height:20,borderRadius:10,background:p?.enabled?"#22c55e":"#374151",border:"none",cursor:"pointer",position:"relative",transition:"background 0.2s"},children:e.jsx("div",{style:{position:"absolute",top:2,left:p?.enabled?18:2,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 0.2s"}})})]},i)})}),e.jsx("div",{style:{padding:12,borderTop:"1px solid #30363d",display:"flex",gap:8},children:e.jsx("button",{onClick:()=>g?.(C,"husky"),style:{flex:1,padding:"8px 12px",background:"#374151",border:"none",borderRadius:6,color:"#fff",fontSize:12,cursor:"pointer"},children:"Export"})})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:k?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid #30363d",background:"#161b22"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8},children:[e.jsx("span",{style:{fontSize:24},children:de[k.type].icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:18,fontWeight:500},children:de[k.type].title}),e.jsx("div",{style:{fontSize:12,color:"#8b949e"},children:de[k.type].description})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12},children:[e.jsx("button",{onClick:()=>h(!0),style:{padding:"6px 12px",background:"#374151",border:"none",borderRadius:6,color:"#fff",fontSize:12,cursor:"pointer"},children:"πŸ“œ Preview Script"}),e.jsx("button",{onClick:()=>U?.(k.type),style:{padding:"6px 12px",background:"#22c55e",border:"none",borderRadius:6,color:"#fff",fontSize:12,cursor:"pointer"},children:"⬇️ Install"}),e.jsx("button",{onClick:()=>_?.(k.type),style:{padding:"6px 12px",background:"#ef4444",border:"none",borderRadius:6,color:"#fff",fontSize:12,cursor:"pointer"},children:"❌ Uninstall"})]})]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:k.actions.length===0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:40,color:"#8b949e"},children:[e.jsx("span",{style:{fontSize:48,marginBottom:16},children:"πŸ“­"}),e.jsx("span",{children:"No actions configured"}),e.jsx("span",{style:{fontSize:12,marginTop:4},children:"Add an action from templates or create a custom one"})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:k.actions.sort((i,n)=>i.order-n.order).map((i,n)=>e.jsxs("div",{style:{padding:16,background:"#161b22",borderRadius:8,border:"1px solid #30363d",opacity:i.enabled?1:.5},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:20},children:a(i.type)}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:i.name}),e.jsx("code",{style:{fontSize:11,color:"#8b949e",background:"#0d1117",padding:"2px 6px",borderRadius:4},children:i.command})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>Y(i.id,"up"),disabled:n===0,style:{padding:"4px 8px",background:"#374151",border:"none",borderRadius:4,color:"#fff",cursor:n===0?"not-allowed":"pointer",opacity:n===0?.5:1},children:"↑"}),e.jsx("button",{onClick:()=>Y(i.id,"down"),disabled:n===k.actions.length-1,style:{padding:"4px 8px",background:"#374151",border:"none",borderRadius:4,color:"#fff",cursor:n===k.actions.length-1?"not-allowed":"pointer",opacity:n===k.actions.length-1?.5:1},children:"↓"}),e.jsx("button",{onClick:()=>b(i),style:{padding:"4px 8px",background:"#374151",border:"none",borderRadius:4,color:"#fff",cursor:"pointer"},children:"✏️"}),e.jsx("button",{onClick:()=>K(i.id),style:{padding:"4px 8px",background:"#ef4444",border:"none",borderRadius:4,color:"#fff",cursor:"pointer"},children:"πŸ—‘οΈ"})]})]}),i.filePatterns&&i.filePatterns.length>0&&e.jsxs("div",{style:{marginTop:8,fontSize:11,color:"#8b949e"},children:["Files: ",i.filePatterns.join(", ")]}),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[i.runOn&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"#1d4ed8",borderRadius:4},children:i.runOn}),i.failOnError&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"#b91c1c",borderRadius:4},children:"fail on error"})]})]},i.id))})}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid #30363d",display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>P(!V),style:{padding:"10px 16px",background:"#3b82f6",border:"none",borderRadius:6,color:"#fff",cursor:"pointer",fontWeight:500},children:"βž• Add from Template"}),e.jsx("button",{onClick:()=>F(),style:{padding:"10px 16px",background:"#374151",border:"none",borderRadius:6,color:"#fff",cursor:"pointer"},children:"βš™οΈ Custom Action"})]}),V&&e.jsxs("div",{style:{position:"absolute",bottom:70,left:300,width:400,maxHeight:300,overflow:"auto",background:"#1f2937",border:"1px solid #374151",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",zIndex:50},children:[j.filter(i=>i.hook===y).map(i=>e.jsxs("div",{onClick:()=>F(i),style:{padding:12,cursor:"pointer",borderBottom:"1px solid #374151",display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:24},children:i.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:i.name}),e.jsx("div",{style:{fontSize:11,color:"#8b949e"},children:i.description})]})]},i.id)),j.filter(i=>i.hook===y).length===0&&e.jsx("div",{style:{padding:20,textAlign:"center",color:"#8b949e"},children:"No templates for this hook type"})]})]}):e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#8b949e"},children:[e.jsx("span",{style:{fontSize:64,marginBottom:16},children:"πŸͺ"}),e.jsx("span",{style:{fontSize:18},children:"Select a hook to configure"}),e.jsx("span",{style:{fontSize:12,marginTop:4},children:"Click on a hook from the list to start editing"})]})}),t(),l()]})},Oe=Object.freeze(Object.defineProperty({__proto__:null,NiceGitHooks:ve},Symbol.toStringTag,{value:"Module"})),Fe={push:"πŸ“€",pull_request:"πŸ”€",schedule:"⏰",manual:"πŸ‘†",tag:"🏷️",workflow_dispatch:"⚑"},_e={script:"πŸ“œ",action:"βš™οΈ",checkout:"πŸ“₯",upload_artifact:"πŸ“€",download_artifact:"πŸ“₯",docker:"🐳",deploy:"πŸš€"},ke=({pipeline:x,templates:j,runners:z,environments:N,onPipelineChange:A,onStageAdd:q,onStageRemove:G,onStageMove:M,onJobAdd:T,onJobRemove:L,onStepAdd:U,onStepRemove:_,onVariableAdd:g,onVariableRemove:m,onSecretAdd:w,onSecretRemove:B,onTemplateApply:C,onSave:v,onRun:y,onValidate:W,className:V,style:P,"data-testid":D})=>{const[b,S]=o.useState("visual"),[h,k]=o.useState(null),[E,F]=o.useState(null),[K,O]=o.useState(!1),Y=x.stages.find(t=>t.id===h),X=Y?.jobs.find(t=>t.id===E),a=o.useMemo(()=>{const t=[];return t.push(`name: ${x.name}`),t.push(""),t.push("on:"),x.triggers.forEach(l=>{t.push(` ${l}:`),(l==="push"||l==="pull_request")&&(t.push(" branches:"),t.push(` - ${x.branch||"main"}`))}),t.push(""),x.variables.length>0&&(t.push("env:"),x.variables.filter(l=>!l.isSecret).forEach(l=>{t.push(` ${l.name}: ${l.value}`)}),t.push("")),t.push("jobs:"),x.stages.forEach(l=>{l.jobs.forEach(i=>{t.push(` ${l.name.toLowerCase().replace(/\s+/g,"-")}-${i.name.toLowerCase().replace(/\s+/g,"-")}:`),t.push(` name: ${i.name}`),i.runner&&t.push(` runs-on: ${i.runner}`),l.dependsOn?.length&&t.push(` needs: [${l.dependsOn.join(", ")}]`),t.push(" steps:"),i.steps.forEach(n=>{n.type==="checkout"?t.push(" - uses: actions/checkout@v4"):n.type==="action"&&n.action?(t.push(` - uses: ${n.action}${n.actionVersion?`@${n.actionVersion}`:""}`),n.with&&Object.keys(n.with).length>0&&(t.push(" with:"),Object.entries(n.with).forEach(([p,c])=>{t.push(` ${p}: ${c}`)}))):n.type==="script"&&n.script&&(t.push(` - name: ${n.name}`),t.push(" run: |"),n.script.split(`
10
+ `).forEach(p=>{t.push(` ${p}`)}))})})}),t.join(`
11
+ `)},[x]);return e.jsxs("div",{className:`nice-pipeline-editor ${V||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"#1e1e1e",color:"#e0e0e0",...P},"data-testid":D,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderBottom:"1px solid #333",background:"#252525"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"20px"},children:"βš™οΈ"}),e.jsx("input",{type:"text",value:x.name,onChange:t=>A({...x,name:t.target.value}),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:"14px",fontWeight:500,width:"250px"}})]}),e.jsx("div",{style:{flex:1}}),e.jsx("button",{onClick:()=>O(!0),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:"12px"},children:"πŸ“‹ Templates"}),e.jsx("button",{onClick:W,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:"12px"},children:"βœ“ Validate"}),e.jsx("button",{onClick:v,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"#3b82f6",color:"white",cursor:"pointer",fontSize:"12px",fontWeight:500},children:"πŸ’Ύ Save"}),e.jsx("button",{onClick:y,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"#22c55e",color:"white",cursor:"pointer",fontSize:"12px",fontWeight:500},children:"β–Ά Run Pipeline"})]}),e.jsx("div",{style:{display:"flex",borderBottom:"1px solid #333"},children:[{id:"visual",label:"🎨 Visual Editor"},{id:"yaml",label:"πŸ“ YAML"},{id:"triggers",label:"⚑ Triggers"},{id:"variables",label:"πŸ”§ Variables"}].map(t=>e.jsx("button",{onClick:()=>S(t.id),style:{padding:"10px 20px",border:"none",background:b===t.id?"#1e1e1e":"transparent",color:b===t.id?"white":"#888",cursor:"pointer",fontSize:"12px",borderBottom:b===t.id?"2px solid #3b82f6":"2px solid transparent"},children:t.label},t.id))}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[b==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{width:"300px",borderRight:"1px solid #333",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px",borderBottom:"1px solid #333",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontWeight:500,fontSize:"13px"},children:"Stages"}),e.jsx("button",{onClick:q,style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"#3b82f6",color:"white",cursor:"pointer",fontSize:"11px"},children:"+ Add Stage"})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"8px"},children:[x.stages.map((t,l)=>e.jsxs("div",{children:[l>0&&e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"4px"},children:e.jsx("span",{style:{color:"#444"},children:"↓"})}),e.jsxs("div",{onClick:()=>{k(t.id),F(null)},style:{padding:"12px",background:h===t.id?"rgba(59, 130, 246, 0.2)":"#252525",borderRadius:"8px",cursor:"pointer",border:h===t.id?"1px solid #3b82f6":"1px solid #333"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[e.jsx("span",{style:{fontWeight:500,fontSize:"13px"},children:t.name}),e.jsxs("div",{style:{display:"flex",gap:"4px"},children:[l>0&&e.jsx("button",{onClick:i=>{i.stopPropagation(),M(t.id,"up")},style:{padding:"2px 4px",background:"#333",border:"none",borderRadius:"2px",color:"white",cursor:"pointer",fontSize:"10px"},children:"↑"}),l<x.stages.length-1&&e.jsx("button",{onClick:i=>{i.stopPropagation(),M(t.id,"down")},style:{padding:"2px 4px",background:"#333",border:"none",borderRadius:"2px",color:"white",cursor:"pointer",fontSize:"10px"},children:"↓"}),e.jsx("button",{onClick:i=>{i.stopPropagation(),G(t.id)},style:{padding:"2px 4px",background:"#ef4444",border:"none",borderRadius:"2px",color:"white",cursor:"pointer",fontSize:"10px"},children:"βœ•"})]})]}),e.jsxs("div",{style:{fontSize:"11px",color:"#888"},children:[t.jobs.length," job",t.jobs.length!==1?"s":""," β€’"," ",t.parallel?"Parallel":"Sequential"]})]})]},t.id)),x.stages.length===0&&e.jsx("div",{style:{textAlign:"center",color:"#666",padding:"24px",fontSize:"12px"},children:"No stages yet. Add a stage to get started."})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:Y?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid #333",display:"flex",justifyContent:"space-between",alignItems:"center",background:"#252525"},children:[e.jsxs("span",{style:{fontWeight:500},children:["Stage: ",Y.name]}),e.jsx("button",{onClick:()=>T(Y.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"#22c55e",color:"white",cursor:"pointer",fontSize:"11px"},children:"+ Add Job"})]}),e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[e.jsx("div",{style:{width:"200px",borderRight:"1px solid #333",overflow:"auto",padding:"8px"},children:Y.jobs.map(t=>e.jsxs("div",{onClick:()=>F(t.id),style:{padding:"10px",marginBottom:"4px",background:E===t.id?"rgba(59, 130, 246, 0.2)":"#252525",borderRadius:"6px",cursor:"pointer",border:E===t.id?"1px solid #3b82f6":"1px solid transparent"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontSize:"12px",fontWeight:500},children:t.name}),e.jsx("button",{onClick:l=>{l.stopPropagation(),L(Y.id,t.id)},style:{padding:"2px 4px",background:"#ef4444",border:"none",borderRadius:"2px",color:"white",cursor:"pointer",fontSize:"9px"},children:"βœ•"})]}),e.jsxs("div",{style:{fontSize:"10px",color:"#888",marginTop:"4px"},children:[t.steps.length," steps"]})]},t.id))}),X?e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[e.jsxs("h3",{style:{margin:0,fontSize:"14px"},children:["Job: ",X.name]}),e.jsx("button",{onClick:()=>U(Y.id,X.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"#8b5cf6",color:"white",cursor:"pointer",fontSize:"11px"},children:"+ Add Step"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"12px",marginBottom:"16px",padding:"12px",background:"#252525",borderRadius:"8px"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"11px",color:"#888",display:"block",marginBottom:"4px"},children:"Runner"}),e.jsxs("select",{style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:"11px"},children:[e.jsx("option",{value:"",children:"Select runner..."}),z.map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.os,")"]},t.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"11px",color:"#888",display:"block",marginBottom:"4px"},children:"Environment"}),e.jsxs("select",{style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:"11px"},children:[e.jsx("option",{value:"",children:"No environment"}),N.map(t=>e.jsxs("option",{value:t.id,children:[t.name," ",t.protection&&"πŸ”’"]},t.id))]})]})]}),X.steps.map((t,l)=>e.jsxs("div",{style:{marginBottom:"8px",padding:"12px",background:"#252525",borderRadius:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:_e[t.type]}),e.jsx("span",{style:{fontSize:"12px",fontWeight:500,flex:1},children:t.name}),e.jsx("span",{style:{fontSize:"10px",color:"#888",padding:"2px 6px",background:"#333",borderRadius:"4px"},children:t.type}),e.jsx("button",{onClick:()=>_(Y.id,X.id,t.id),style:{padding:"2px 6px",background:"#ef4444",border:"none",borderRadius:"4px",color:"white",cursor:"pointer",fontSize:"10px"},children:"βœ•"})]}),t.type==="script"&&t.script&&e.jsx("pre",{style:{margin:0,padding:"8px",background:"#1e1e1e",borderRadius:"4px",fontSize:"10px",fontFamily:"monospace",overflow:"auto"},children:t.script}),t.type==="action"&&e.jsxs("div",{style:{fontSize:"11px",color:"#888"},children:["uses: ",t.action,t.actionVersion&&`@${t.actionVersion}`]})]},t.id)),X.steps.length===0&&e.jsx("div",{style:{textAlign:"center",color:"#666",padding:"24px",fontSize:"12px"},children:"No steps yet. Add a step to define what this job does."})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},children:"Select a job to edit its steps"})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},children:"Select a stage to view its jobs"})})]}),b==="yaml"&&e.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:e.jsx("pre",{style:{margin:0,padding:"16px",background:"#252525",borderRadius:"8px",fontFamily:"monospace",fontSize:"12px",lineHeight:"1.6",whiteSpace:"pre-wrap"},children:a})}),b==="triggers"&&e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"14px"},children:"Pipeline Triggers"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"16px"},children:["push","pull_request","schedule","manual","tag","workflow_dispatch"].map(t=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"16px",background:"#252525",borderRadius:"8px",cursor:"pointer",border:x.triggers.includes(t)?"2px solid #3b82f6":"2px solid transparent"},children:[e.jsx("input",{type:"checkbox",checked:x.triggers.includes(t),onChange:l=>{const i=l.target.checked?[...x.triggers,t]:x.triggers.filter(n=>n!==t);A({...x,triggers:i})}}),e.jsx("span",{style:{fontSize:"24px"},children:Fe[t]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:"13px"},children:t.replace("_"," ")}),e.jsxs("div",{style:{fontSize:"11px",color:"#888"},children:[t==="push"&&"Run on push to branch",t==="pull_request"&&"Run on PR/MR",t==="schedule"&&"Run on schedule (cron)",t==="manual"&&"Manual trigger only",t==="tag"&&"Run on tag push",t==="workflow_dispatch"&&"API/UI trigger"]})]})]},t))})]}),b==="variables"&&e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[e.jsx("h3",{style:{margin:0,fontSize:"14px"},children:"Variables & Secrets"}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("button",{onClick:g,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"#3b82f6",color:"white",cursor:"pointer",fontSize:"11px"},children:"+ Add Variable"}),e.jsx("button",{onClick:w,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"#f59e0b",color:"white",cursor:"pointer",fontSize:"11px"},children:"πŸ”’ Add Secret"})]})]}),e.jsxs("div",{style:{background:"#252525",borderRadius:"8px",overflow:"hidden"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#1e1e1e"},children:[e.jsx("th",{style:{padding:"10px 16px",textAlign:"left",fontWeight:500},children:"Name"}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"left",fontWeight:500},children:"Value"}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"center",fontWeight:500},children:"Type"}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"right",fontWeight:500},children:"Actions"})]})}),e.jsx("tbody",{children:x.variables.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid #333",fontFamily:"monospace"},children:t.name}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid #333"},children:t.isSecret?"β€’β€’β€’β€’β€’β€’β€’β€’":t.value}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid #333",textAlign:"center"},children:e.jsx("span",{style:{padding:"2px 8px",borderRadius:"4px",background:t.isSecret?"#f59e0b22":"#3b82f622",color:t.isSecret?"#f59e0b":"#3b82f6",fontSize:"10px"},children:t.isSecret?"πŸ”’ Secret":"Variable"})}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid #333",textAlign:"right"},children:e.jsx("button",{onClick:()=>m(t.name),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"#ef4444",color:"white",cursor:"pointer",fontSize:"10px"},children:"Remove"})})]},t.name))})]}),x.variables.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"#666",fontSize:"12px"},children:"No variables defined"})]})]})]}),K&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"600px",maxHeight:"80vh",background:"#252525",borderRadius:"12px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px",borderBottom:"1px solid #333"},children:[e.jsx("span",{style:{fontWeight:600},children:"Pipeline Templates"}),e.jsx("button",{onClick:()=>O(!1),style:{background:"none",border:"none",color:"#888",cursor:"pointer",fontSize:"18px"},children:"βœ•"})]}),e.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",padding:"16px"},children:j.map(t=>e.jsxs("div",{onClick:()=>{C(t),O(!1)},style:{display:"flex",alignItems:"center",gap:"16px",padding:"16px",marginBottom:"8px",background:"#1e1e1e",borderRadius:"8px",cursor:"pointer"},children:[e.jsx("span",{style:{fontSize:"32px"},children:t.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:"14px",marginBottom:"4px"},children:t.name}),e.jsx("div",{style:{fontSize:"12px",color:"#888"},children:t.description}),e.jsx("div",{style:{fontSize:"10px",color:"#666",marginTop:"4px"},children:t.category})]})]},t.id))})]})})]})},He=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineEditor:ke},Symbol.toStringTag,{value:"Module"})),ae={queued:{color:"#6b7280",icon:"⏳",label:"Queued"},pending:{color:"#6b7280",icon:"⏳",label:"Pending"},waiting:{color:"#f59e0b",icon:"⏸️",label:"Waiting"},in_progress:{color:"#3b82f6",icon:"πŸ”„",label:"In Progress"},running:{color:"#3b82f6",icon:"πŸ”„",label:"Running"},completed:{color:"#22c55e",icon:"βœ“",label:"Completed"},success:{color:"#22c55e",icon:"βœ“",label:"Success"},failed:{color:"#ef4444",icon:"βœ•",label:"Failed"},failure:{color:"#ef4444",icon:"βœ•",label:"Failed"},cancelled:{color:"#6b7280",icon:"⊘",label:"Cancelled"},skipped:{color:"#6b7280",icon:"β†·",label:"Skipped"}},Se=({runs:x,stats:j,selectedRunId:z,onRunSelect:N,onCancel:A,onRerun:q,onRerunFromStage:G,onDownloadArtifact:M,onDownloadLogs:T,onApprove:L,onReject:U,className:_,style:g,"data-testid":m})=>{const[w,B]=o.useState("all"),[C,v]=o.useState("all"),[y,W]=o.useState(new Set),[V,P]=o.useState(new Set),[D,b]=o.useState(null),S=x.find(a=>a.id===z),h=o.useMemo(()=>x.filter(a=>!(w!=="all"&&a.status!==w||C!=="all"&&a.branch!==C)),[x,w,C]),k=o.useMemo(()=>[...new Set(x.map(a=>a.branch))],[x]),E=a=>{if(!a)return"-";const t=Math.floor(a/1e3);if(t<60)return`${t}s`;const l=Math.floor(t/60),i=t%60;if(l<60)return`${l}m ${i}s`;const n=Math.floor(l/60),p=l%60;return`${n}h ${p}m`},F=a=>a?new Date(a).toLocaleString():"-",K=a=>a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`,O=a=>{W(t=>{const l=new Set(t);return l.has(a)?l.delete(a):l.add(a),l})},Y=a=>{P(t=>{const l=new Set(t);return l.has(a)?l.delete(a):l.add(a),l})},X=()=>{if(!D||!S)return[];for(const a of S.stages)for(const t of a.jobs)if(t.id===D.jobId)return t.steps.find(i=>i.id===D.stepId)?.logs||[];return[]};return e.jsxs("div",{className:`nice-pipeline-monitor ${_||""}`,style:{display:"flex",height:"100%",background:"#1e1e1e",color:"#e0e0e0",...g},"data-testid":m,children:[e.jsxs("div",{style:{width:"400px",borderRight:"1px solid #333",display:"flex",flexDirection:"column"},children:[j&&e.jsx("div",{style:{padding:"16px",borderBottom:"1px solid #333",background:"#252525"},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px",textAlign:"center"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"#3b82f6"},children:j.totalRuns}),e.jsx("div",{style:{fontSize:"10px",color:"#888"},children:"Total Runs"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:"20px",fontWeight:600,color:"#22c55e"},children:[j.successRate.toFixed(0),"%"]}),e.jsx("div",{style:{fontSize:"10px",color:"#888"},children:"Success Rate"})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"#f59e0b"},children:E(j.avgDuration)}),e.jsx("div",{style:{fontSize:"10px",color:"#888"},children:"Avg Duration"})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"#ef4444"},children:j.failedRuns}),e.jsx("div",{style:{fontSize:"10px",color:"#888"},children:"Failed"})]})]})}),e.jsxs("div",{style:{padding:"12px",borderBottom:"1px solid #333",display:"flex",gap:"8px"},children:[e.jsxs("select",{value:w,onChange:a=>B(a.target.value),style:{flex:1,padding:"6px",borderRadius:"4px",border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:"11px"},children:[e.jsx("option",{value:"all",children:"All Status"}),e.jsx("option",{value:"in_progress",children:"In Progress"}),e.jsx("option",{value:"completed",children:"Completed"}),e.jsx("option",{value:"failed",children:"Failed"}),e.jsx("option",{value:"cancelled",children:"Cancelled"})]}),e.jsxs("select",{value:C,onChange:a=>v(a.target.value),style:{flex:1,padding:"6px",borderRadius:"4px",border:"1px solid #444",background:"#1e1e1e",color:"white",fontSize:"11px"},children:[e.jsx("option",{value:"all",children:"All Branches"}),k.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[h.map(a=>{const t=ae[a.status];return e.jsxs("div",{onClick:()=>N(a.id),style:{padding:"12px 16px",borderBottom:"1px solid #333",cursor:"pointer",background:z===a.id?"rgba(59, 130, 246, 0.1)":"transparent"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"6px"},children:[e.jsx("span",{style:{fontSize:"16px",animation:a.status==="in_progress"?"spin 1s linear infinite":"none"},children:t.icon}),e.jsxs("span",{style:{flex:1,fontWeight:500,fontSize:"13px"},children:[a.pipelineName," #",a.runNumber]}),e.jsx("span",{style:{padding:"2px 8px",borderRadius:"4px",background:`${t.color}22`,color:t.color,fontSize:"10px"},children:t.label})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"11px",color:"#888"},children:[e.jsxs("span",{children:["πŸ”€ ",a.branch]}),e.jsx("span",{children:"β€’"}),e.jsx("span",{children:a.commit.sha.slice(0,7)}),e.jsx("span",{children:"β€’"}),e.jsx("span",{children:E(a.duration)})]}),e.jsx("div",{style:{marginTop:"6px",fontSize:"11px",color:"#666",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a.commit.message})]},a.id)}),h.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"#666",fontSize:"12px"},children:"No pipeline runs match the filters"})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:S?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid #333",background:"#252525"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"12px"},children:[e.jsxs("div",{children:[e.jsxs("h2",{style:{margin:"0 0 4px 0",fontSize:"16px",fontWeight:500},children:[S.pipelineName," #",S.runNumber]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"12px",color:"#888"},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[S.commit.authorAvatar&&e.jsx("img",{src:S.commit.authorAvatar,alt:"",style:{width:"16px",height:"16px",borderRadius:"50%"}}),S.commit.author]}),e.jsxs("span",{children:["πŸ”€ ",S.branch]}),e.jsxs("span",{children:["πŸ“ ",S.commit.sha.slice(0,7)]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[(S.status==="in_progress"||S.status==="queued"||S.status==="waiting")&&e.jsx("button",{onClick:()=>A(S.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"#ef4444",color:"white",cursor:"pointer",fontSize:"11px"},children:"Cancel"}),e.jsx("button",{onClick:()=>q(S.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"#3b82f6",color:"white",cursor:"pointer",fontSize:"11px"},children:"Re-run"}),e.jsx("button",{onClick:()=>T(S.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:"11px"},children:"πŸ“₯ Logs"})]})]}),e.jsxs("div",{style:{display:"flex",gap:"16px",fontSize:"12px"},children:[e.jsxs("span",{children:["Started: ",F(S.startedAt)]}),S.completedAt&&e.jsxs("span",{children:["Completed: ",F(S.completedAt)]}),e.jsxs("span",{children:["Duration: ",E(S.duration)]})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[e.jsx("div",{style:{marginBottom:"24px"},children:S.stages.map((a,t)=>{const l=ae[a.status],i=y.has(a.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>O(a.id),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"#252525",borderRadius:"8px",cursor:"pointer",border:`2px solid ${l.color}44`},children:[e.jsx("span",{style:{color:"#666"},children:i?"β–Ό":"β–Ά"}),e.jsx("span",{style:{fontSize:"16px"},children:l.icon}),e.jsx("span",{style:{flex:1,fontWeight:500},children:a.name}),e.jsx("span",{style:{fontSize:"11px",color:"#888"},children:E(a.duration)}),a.status==="waiting"&&L&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:n=>{n.stopPropagation(),L(S.id,a.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"#22c55e",color:"white",cursor:"pointer",fontSize:"10px"},children:"Approve"}),e.jsx("button",{onClick:n=>{n.stopPropagation(),U?.(S.id,a.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"#ef4444",color:"white",cursor:"pointer",fontSize:"10px"},children:"Reject"})]}),e.jsx("button",{onClick:n=>{n.stopPropagation(),G(S.id,a.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"#333",color:"white",cursor:"pointer",fontSize:"10px"},children:"Re-run from here"})]}),i&&e.jsx("div",{style:{marginLeft:"32px",marginTop:"8px"},children:a.jobs.map(n=>{const p=ae[n.status],c=V.has(n.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>Y(n.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:"#1e1e1e",borderRadius:"6px",cursor:"pointer",borderLeft:`3px solid ${p.color}`},children:[e.jsx("span",{style:{color:"#666",fontSize:"10px"},children:c?"β–Ό":"β–Ά"}),e.jsx("span",{style:{fontSize:"14px"},children:p.icon}),e.jsx("span",{style:{flex:1,fontSize:"12px"},children:n.name}),n.runner&&e.jsxs("span",{style:{fontSize:"10px",color:"#666"},children:["πŸ–₯️ ",n.runner]}),e.jsx("span",{style:{fontSize:"10px",color:"#888"},children:E(n.duration)})]}),c&&e.jsx("div",{style:{marginLeft:"24px",marginTop:"4px"},children:n.steps.map(s=>{const f=ae[s.status];return e.jsxs("div",{onClick:()=>b({jobId:n.id,stepId:s.id}),style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 10px",marginBottom:"2px",background:"transparent",borderRadius:"4px",cursor:s.logs?.length?"pointer":"default"},children:[e.jsx("span",{style:{fontSize:"12px"},children:f.icon}),e.jsx("span",{style:{flex:1,fontSize:"11px"},children:s.name}),e.jsx("span",{style:{fontSize:"10px",color:"#888"},children:E(s.duration)}),s.logs?.length?e.jsx("span",{style:{fontSize:"10px",color:"#666"},children:"πŸ“„"}):null]},s.id)})})]},n.id)})}),t<S.stages.length-1&&e.jsx("div",{style:{marginLeft:"24px",padding:"4px 0",color:"#444"},children:"↓"})]},a.id)})}),S.artifacts.length>0&&e.jsxs("div",{style:{marginTop:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",color:"#888"},children:"Artifacts"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"8px"},children:S.artifacts.map(a=>e.jsxs("div",{onClick:()=>M(a),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"#252525",borderRadius:"8px",cursor:"pointer"},children:[e.jsx("span",{style:{fontSize:"24px"},children:"πŸ“¦"}),e.jsxs("div",{style:{flex:1,overflow:"hidden"},children:[e.jsx("div",{style:{fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a.name}),e.jsx("div",{style:{fontSize:"10px",color:"#888"},children:K(a.size)})]}),e.jsx("span",{style:{fontSize:"16px"},children:"πŸ“₯"})]},a.id))})]})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"#666"},children:"Select a pipeline run to view details"})}),D&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.8)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"80%",height:"80%",background:"#1e1e1e",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid #333",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontWeight:500},children:"Step Logs"}),e.jsx("button",{onClick:()=>b(null),style:{background:"none",border:"none",color:"#888",cursor:"pointer",fontSize:"18px"},children:"βœ•"})]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:"12px"},children:e.jsx("pre",{style:{margin:0,fontFamily:"monospace",fontSize:"11px",lineHeight:"1.5",whiteSpace:"pre-wrap",color:"#d4d4d4"},children:X().join(`
12
+ `)||"No logs available"})})]})}),e.jsx("style",{children:`
13
+ @keyframes spin {
14
+ from { transform: rotate(0deg); }
15
+ to { transform: rotate(360deg); }
16
+ }
17
+ `})]})},Ge=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineMonitor:Se},Symbol.toStringTag,{value:"Module"}));exports.NiceBranchManager=ge;exports.NiceBranchManager$1=Te;exports.NiceGitBlame=ye;exports.NiceGitBlame$1=Pe;exports.NiceGitConflictResolver=je;exports.NiceGitConflictResolver$1=Le;exports.NiceGitDiffViewer=be;exports.NiceGitDiffViewer$1=$e;exports.NiceGitGraph=fe;exports.NiceGitGraph$1=Me;exports.NiceGitHooks=ve;exports.NiceGitHooks$1=Oe;exports.NiceMergeRequestBuilder=me;exports.NiceMergeRequestBuilder$1=We;exports.NicePipelineEditor=ke;exports.NicePipelineEditor$1=He;exports.NicePipelineMonitor=Se;exports.NicePipelineMonitor$1=Ge;