@nice2dev/ui 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +50 -29
- package/css/legacy-bg-text-aliases.css +65 -61
- package/dist/NiceCodeEditor-Bc81wiaN.js +1134 -0
- package/dist/NiceCodeEditor-D6f8KdHN.js +1134 -0
- package/dist/NiceCodeEditor-DE3saxyt.cjs +260 -0
- package/dist/NiceCodeEditor-DZM16My5.cjs +260 -0
- package/dist/NiceCodeEditor-HqmcJjmZ.js +1179 -0
- package/dist/NiceColorPicker-6EqXaDj0.cjs +1 -0
- package/dist/NiceColorPicker-BiEWqWnd.js +596 -0
- package/dist/NiceColorPicker-Cuc6YXqz.cjs +1 -0
- package/dist/NiceColorPicker-DMATcNWG.js +596 -0
- package/dist/NiceColorPicker-R3O1nemp.js +596 -0
- package/dist/NiceConfirmDialog-B0e10fRL.cjs +1 -0
- package/dist/NiceConfirmDialog-BBDgEMHv.js +81 -0
- package/dist/NiceConfirmDialog-C7kdr8jJ.js +81 -0
- package/dist/NiceConfirmDialog-DMHqPfFM.js +81 -0
- package/dist/NiceConfirmDialog-ZJpQLQQS.cjs +1 -0
- package/dist/NiceDataGrid-BzUw4dSu.cjs +10 -0
- package/dist/NiceDataGrid-CPKcVOVz.js +1743 -0
- package/dist/NiceDataGrid-DJr33WMy.cjs +10 -0
- package/dist/NiceDataGrid-D_4gZ1Hu.js +1736 -0
- package/dist/NiceDataGrid-DlUAaXhD.js +1736 -0
- package/dist/NiceDocumentViewer-8ghRVtfO.js +672 -0
- package/dist/NiceDocumentViewer-ChWtA_Ry.cjs +180 -0
- package/dist/NiceDocumentViewer-DwLUV7Tc.js +672 -0
- package/dist/NiceDocumentViewer-goMzF1w3.cjs +180 -0
- package/dist/NiceDocumentViewer-gt1mxzP8.js +672 -0
- package/dist/NiceForm-CHEAHxDw.js +4805 -0
- package/dist/NiceForm-CJUp1CL0.cjs +1 -0
- package/dist/NiceForm-Cp_RH3Yj.js +4805 -0
- package/dist/NiceForm-a6tGr6ss.js +4819 -0
- package/dist/NiceForm-jU89oe2S.cjs +1 -0
- package/dist/NiceGantt-BnQwyTfG.cjs +1 -0
- package/dist/NiceGantt-D8coFAvK.js +328 -0
- package/dist/NiceGantt-DOZfT6r5.js +328 -0
- package/dist/NiceGantt-DQzH1V-R.js +328 -0
- package/dist/NiceGantt-jQ8ZpXko.cjs +1 -0
- package/dist/NiceHtmlEditor-B1nlXJNW.cjs +10 -0
- package/dist/NiceHtmlEditor-Bv3VqJPG.js +862 -0
- package/dist/NiceHtmlEditor-CKsGj-Ei.cjs +10 -0
- package/dist/NiceHtmlEditor-CloMgyzg.js +841 -0
- package/dist/NiceHtmlEditor-DUAHmkWI.js +841 -0
- package/dist/NiceLoginForm-Ce_QLnLf.js +736 -0
- package/dist/NiceLoginForm-DLpNTQlR.cjs +1 -0
- package/dist/NiceLoginForm-Dg0286Cc.js +736 -0
- package/dist/NiceLoginForm-X05Vadeg.js +708 -0
- package/dist/NiceLoginForm-f_dBCnUi.cjs +1 -0
- package/dist/NiceMention-BByI4nFG.js +11120 -0
- package/dist/NiceMention-C2TPiMph.cjs +430 -0
- package/dist/NiceMention-C67vT6m0.js +11145 -0
- package/dist/NiceMention-D1cdy63w.cjs +430 -0
- package/dist/NiceMention-QIuggb9Y.js +11122 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-CHaan9al.js +95 -0
- package/dist/NiceModal-Czq6OEAT.js +95 -0
- package/dist/NiceModal-D-HFwawr.js +95 -0
- package/dist/NiceModal-DOy2XTzc.cjs +1 -0
- package/dist/NiceModal-DkawKzEE.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-1CsP8Zst.js +6997 -0
- package/dist/NiceModuleLifecyclePanel-Bkx4Yg-3.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-C5oYtczk.js +6999 -0
- package/dist/NiceModuleLifecyclePanel-DCcy2yYi.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-DqdgW-0s.js +7004 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-7od5KUa3.cjs +1 -0
- package/dist/NicePagination-DMrkR8hH.cjs +1 -0
- package/dist/NicePagination-DQmZpsSQ.js +179 -0
- package/dist/NicePagination-DipQRjPq.js +172 -0
- package/dist/NicePagination-KhlVXYaT.js +172 -0
- package/dist/NicePivotGrid-B-KthuqL.cjs +152 -0
- package/dist/NicePivotGrid-CLCTHkKO.cjs +152 -0
- package/dist/NicePivotGrid-DV54FCsH.js +1174 -0
- package/dist/NicePivotGrid-DoWLUPUs.js +1167 -0
- package/dist/NicePivotGrid-etwpfccz.js +1167 -0
- package/dist/NiceSavedQueryPanel-BABkTNc5.js +5129 -0
- package/dist/NiceSavedQueryPanel-Cfeig83P.cjs +586 -0
- package/dist/NiceSavedQueryPanel-DTWRLseb.cjs +586 -0
- package/dist/NiceSavedQueryPanel-Dy154sxE.js +5129 -0
- package/dist/NiceSavedQueryPanel-v7AffOOe.js +5129 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceScheduler-BEgB7ZgF.cjs +5 -0
- package/dist/NiceScheduler-C9JprsEI.cjs +5 -0
- package/dist/NiceScheduler-DSP-PPh0.js +1645 -0
- package/dist/NiceScheduler-DuPnaA3t.js +1652 -0
- package/dist/NiceScheduler-Oa89YZx9.js +1645 -0
- package/dist/NiceSelect-A336yeLZ.js +433 -0
- package/dist/NiceSelect-B5hTbqi2.js +433 -0
- package/dist/NiceSelect-BYSgDYzq.cjs +1 -0
- package/dist/NiceSelect-Dudf2T5T.js +433 -0
- package/dist/NiceSelect-DwBAIrX7.cjs +1 -0
- package/dist/NiceWindow-B6zjBTl9.cjs +1 -0
- package/dist/NiceWindow-BKQEx7Vf.js +1623 -0
- package/dist/NiceWindow-BnTH7Gy0.js +1623 -0
- package/dist/NiceWindow-CZN9NVZw.cjs +1 -0
- package/dist/NiceWindow-lxtPR7yZ.js +1623 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-B8_V3_nq.cjs +882 -0
- package/dist/charts-BZgyyybE.js +31933 -0
- package/dist/charts-FuDk5-r6.js +31958 -0
- package/dist/charts-INj3yFo5.js +31946 -0
- package/dist/charts-NolNXKUL.cjs +882 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-A_A6c7an.js +795 -0
- package/dist/core-B2iH2J_X.js +795 -0
- package/dist/core-BmspZEfD.js +795 -0
- package/dist/core-DAfLOet6.cjs +1 -0
- package/dist/core-ZG3bgnBR.cjs +1 -0
- package/dist/data-branching-B3TOqXAO.cjs +1 -0
- package/dist/data-branching-BUGiICDZ.js +6275 -0
- package/dist/data-branching-DMXmcocj.js +6275 -0
- package/dist/data-branching-YE8P9M5P.js +6275 -0
- package/dist/data-branching-t6uhAwIm.cjs +1 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +7 -2
- package/dist/data.mjs +3 -3
- package/dist/devops-BhV3OmF7.js +8285 -0
- package/dist/devops-BqUxnbRi.cjs +17 -0
- package/dist/devops-Bx-Qwj9w.cjs +17 -0
- package/dist/devops-DYZatW45.js +8251 -0
- package/dist/devops-R98k2zpd.js +8251 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +29 -16
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +35 -20
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +445 -445
- package/dist/index.css +1 -1
- package/dist/index.d.ts +190 -111
- package/dist/index.mjs +16635 -16351
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +31 -18
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +17 -14
- package/dist/navigation.mjs +130 -130
- package/dist/no-code-BPaAS4wW.cjs +332 -0
- package/dist/no-code-CBwUVL1i.js +7447 -0
- package/dist/no-code-CjktkQ50.js +7447 -0
- package/dist/no-code-DW2NrRba.js +7447 -0
- package/dist/no-code-DmFxrZ5T.cjs +332 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.d.ts +2 -2
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +4 -4
- package/dist/overlays.mjs +2 -2
- package/dist/pickerCommons-C4XWRUvH.cjs +1 -0
- package/dist/pickerCommons-C_BpYs_m.cjs +1 -0
- package/dist/pickerCommons-DAOXH_u5.js +1122 -0
- package/dist/pickerCommons-Dn4wnDco.js +1122 -0
- package/dist/pickerCommons-DskswPS5.js +1122 -0
- package/dist/pickerCommons.css +1 -1
- package/dist/style.css +7 -7
- package/package.json +3 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),n=require("./charts-NolNXKUL.cjs"),i=require("react"),ge=[],ue=["var(--nice-color-success, #22c55e)","var(--nice-color-primary, #3b82f6)","var(--nice-color-warning, #f59e0b)","var(--nice-color-accent-pink, #ec4899)","var(--nice-color-accent, #8b5cf6)","var(--nice-info, #14b8a6)","var(--nice-warning, #f97316)","var(--nice-color-error, #ef4444)","var(--nice-color-accent, #6366f1)","var(--nice-success, #84cc16)"],fe=24,me=40,be=28,Be=6,Me=4;function Ne(h,k,z,E){const O=[],U=[],V=new Map;h.forEach((m,y)=>V.set(m.hash,y));const W=new Map,M=[],H=new Map;let Y=0;const A=new Map;if(k.forEach(m=>{if(!m.lastCommit)return;const y=A.get(m.lastCommit)||[];y.push({type:m.isRemote?"remote":"branch",name:m.name,commit:m.lastCommit,color:m.isHead?"var(--nice-color-success, #22c55e)":m.isRemote?"var(--nice-text-muted, #6b7280)":"var(--nice-color-primary, #3b82f6)"}),A.set(m.lastCommit,y)}),z.forEach(m=>{const y=A.get(m.commit)||[];y.push({type:"tag",name:m.name,commit:m.commit,color:"var(--nice-color-warning, #f59e0b)"}),A.set(m.commit,y)}),E){const m=A.get(E)||[];m.push({type:"head",name:"HEAD",commit:E,color:"var(--nice-color-error, #ef4444)"}),A.set(E,m)}return h.forEach((m,y)=>{let R=M.findIndex(T=>T===m.hash);R===-1&&(R=M.findIndex(T=>T===null),R===-1&&(R=M.length,M.push(null))),H.has(R)||(H.set(R,ue[Y%ue.length]),Y++),W.set(m.hash,R);const N=H.get(R)||ue[0];O.push({commit:m,x:R,y,color:N,refs:A.get(m.hash)||[]}),m.parents.forEach((T,_)=>{const P=V.get(T);if(P!==void 0){let D=W.get(T);D===void 0&&(_===0?(D=R,M[R]=T):(D=M.findIndex(Z=>Z===null),D===-1?(D=M.length,M.push(T)):M[D]=T),W.set(T,D));const K=H.get(D)||N;U.push({from:m.hash,to:T,fromX:R,fromY:y,toX:D,toY:P,color:_===0?N:K,type:_===0?R===D?"straight":"branch":"merge"})}}),(m.parents.length===0||!h.slice(y+1).some(T=>T.parents.includes(m.hash)))&&(M[R]=null)}),{nodes:O,edges:U}}const Te=({nodes:h,edges:k,selectedHash:z,compact:E,onNodeClick:O,onNodeDoubleClick:U})=>{const V=E?be:me,W=E?Me:Be,H=(Math.max(...h.map(y=>y.x),0)+2)*fe,Y=(h.length+1)*V,A=y=>fe/2+y*fe,m=y=>V/2+y*V;return e.jsxs("svg",{width:H,height:Y,style:{minWidth:H,minHeight:Y,display:"block"},children:[k.map((y,R)=>{const N=A(y.fromX),T=m(y.fromY),_=A(y.toX),P=m(y.toY);if(y.type==="straight")return e.jsx("line",{x1:N,y1:T,x2:_,y2:P,stroke:y.color,strokeWidth:2},R);const D=(T+P)/2,K=`M ${N} ${T} C ${N} ${D}, ${_} ${D}, ${_} ${P}`;return e.jsx("path",{d:K,fill:"none",stroke:y.color,strokeWidth:2,strokeDasharray:y.type==="merge"?"4,2":void 0},R)}),h.map(y=>{const R=A(y.x),N=m(y.y),T=y.commit.hash===z,_=y.commit.isMerge;return e.jsxs("g",{onClick:()=>O(y.commit.hash),onDoubleClick:()=>U(y.commit.hash),style:{cursor:"pointer"},children:[T&&e.jsx("circle",{cx:R,cy:N,r:W+4,fill:"none",stroke:"var(--nice-bg, #fff)",strokeWidth:2}),e.jsx("circle",{cx:R,cy:N,r:W,fill:_?"var(--nice-bg-elevated, #1e1e1e)":y.color,stroke:y.color,strokeWidth:_?2:0}),y.refs.length>0&&!E&&e.jsx("foreignObject",{x:R+10,y:N-8,width:200,height:16,children:e.jsx("div",{style:{display:"flex",gap:4,whiteSpace:"nowrap"},children:y.refs.map((P,D)=>e.jsxs("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:500,background:`${P.color}22`,color:P.color,border:`1px solid ${P.color}44`},children:[P.type==="tag"?e.jsx(n.oa,{name:"tag",size:10}):P.type==="head"?e.jsx(n.oa,{name:"cursor",size:10}):null,(P.type==="tag"||P.type==="head")&&" ",P.name]},D))})})]},y.commit.hash)})]})},ye=({commits:h=ge,branches:k=ge,tags:z=ge,head:E,selectedCommit:O,branchFilter:U,authorFilter:V,dateRange:W,searchQuery:M,maxCommits:H=100,showRemotes:Y=!0,showTags:A=!0,compact:m=!1,onCommitSelect:y,onCommitDoubleClick:R,onBranchCheckout:N,onBranchCreate:T,onTagCreate:_,onCherryPick:P,onRevert:D,onReset:K,onCompare:Z,onViewDiff:$,className:S,style:j,"data-testid":g})=>{const[G,w]=i.useState(O),[I,re]=i.useState(null),[L,F]=i.useState(!1),[ee,c]=i.useState(null),a=i.useRef(null),x=O??G,v=i.useMemo(()=>{let p=h;if(U&&U.length>0){const C=new Set;k.filter(Q=>U.includes(Q.name)).forEach(Q=>{Q.lastCommit&&C.add(Q.lastCommit)}),p=p.filter(Q=>C.has(Q.hash))}if(V&&V.length>0&&(p=p.filter(C=>V.some(Q=>C.author.name.toLowerCase().includes(Q.toLowerCase())||C.author.email.toLowerCase().includes(Q.toLowerCase())))),W&&(W.from&&(p=p.filter(C=>C.date>=W.from)),W.to&&(p=p.filter(C=>C.date<=W.to))),M&&M.trim()){const C=M.toLowerCase();p=p.filter(Q=>Q.hash.toLowerCase().includes(C)||Q.shortHash.toLowerCase().includes(C)||Q.message.toLowerCase().includes(C)||Q.author.name.toLowerCase().includes(C))}return p.slice(0,H)},[h,U,V,W,M,H,k]),{nodes:s,edges:B}=i.useMemo(()=>Ne(v,Y?k:k.filter(p=>!p.isRemote),A?z:[],E),[v,k,z,E,Y,A]),b=i.useMemo(()=>v.find(p=>p.hash===x),[v,x]),l=i.useCallback(p=>{if(L&&ee)Z?.(ee,p),F(!1),c(null);else if(L)c(p);else{w(p);const C=v.find(Q=>Q.hash===p);C&&y?.(C)}},[L,ee,v,y,Z]),r=i.useCallback(p=>{const C=v.find(Q=>Q.hash===p);C&&(R?.(C),$?.(p))},[v,R,$]),o=i.useCallback((p,C)=>{p.preventDefault(),re({x:p.clientX,y:p.clientY,commit:C})},[]),u=i.useCallback(()=>re(null),[]),f=p=>{const Q=new Date().getTime()-p.getTime(),ne=Math.floor(Q/(1e3*60*60*24));return ne===0?"Today":ne===1?"Yesterday":ne<7?`${ne} days ago`:p.toLocaleDateString()},q=m?be:me;return e.jsxs("div",{className:`nice-git-graph ${S||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...j},"data-testid":g,onClick:u,children:[e.jsxs("div",{ref:a,style:{flex:1,overflow:"auto",display:"flex"},children:[e.jsx("div",{style:{flexShrink:0,borderRight:"1px solid var(--nice-border-color, #333)"},children:e.jsx(Te,{nodes:s,edges:B,selectedHash:x,compact:m,onNodeClick:l,onNodeDoubleClick:r})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[s.map(p=>e.jsxs("div",{onClick:()=>l(p.commit.hash),onDoubleClick:()=>r(p.commit.hash),onContextMenu:C=>o(C,p.commit),style:{height:q,padding:"0 12px",display:"flex",alignItems:"center",gap:12,cursor:"pointer",background:p.commit.hash===x?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderBottom:"1px solid var(--nice-bg-secondary, #2a2a2a)"},children:[p.commit.author.avatar?e.jsx("img",{src:p.commit.author.avatar,alt:"",style:{width:m?20:24,height:m?20:24,borderRadius:"50%",flexShrink:0}}):e.jsx("div",{style:{width:m?20:24,height:m?20:24,borderRadius:"50%",background:p.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:m?10:12,color:"var(--nice-bg-primary, #fff)",fontWeight:600,flexShrink:0},children:p.commit.author.name.charAt(0).toUpperCase()}),e.jsx("div",{style:{flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:m?12:13},children:p.commit.message}),p.commit.stats&&!m&&e.jsxs("div",{style:{display:"flex",gap:8,fontSize:11,color:"var(--nice-text-muted, #888)",flexShrink:0},children:[e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",p.commit.stats.additions]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",p.commit.stats.deletions]})]}),e.jsx("code",{style:{fontSize:m?10:11,color:"var(--nice-text-muted, #888)",fontFamily:"monospace",flexShrink:0},children:p.commit.shortHash}),!m&&e.jsx("span",{style:{fontSize:11,color:"var(--nice-text-muted, #888)",flexShrink:0,width:100},children:p.commit.author.name}),e.jsx("span",{style:{fontSize:m?10:11,color:"var(--nice-text-muted, #666)",flexShrink:0,width:m?60:80,textAlign:"right"},children:f(p.commit.date)})]},p.commit.hash)),v.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:13},children:"No commits match the filters"})]})]}),b&&!m&&e.jsxs("div",{style:{width:320,borderLeft:"1px solid var(--nice-border-color, #333)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid var(--nice-border-color, #333)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[b.author.avatar?e.jsx("img",{src:b.author.avatar,alt:"",style:{width:32,height:32,borderRadius:"50%"}}):e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:"var(--nice-color-primary, #3b82f6)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-bg-primary, #fff)",fontWeight:600},children:b.author.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:b.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:b.author.email})]})]}),e.jsx("code",{style:{fontSize:11,color:"var(--nice-text-muted, #888)",fontFamily:"monospace"},children:b.hash})]}),e.jsxs("div",{style:{padding:16,borderBottom:"1px solid var(--nice-border-color, #333)"},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,marginBottom:8},children:b.message}),b.body&&e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #aaa)",whiteSpace:"pre-wrap",maxHeight:120,overflow:"auto"},children:b.body})]}),b.stats&&e.jsxs("div",{style:{padding:16,borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:16},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:20,fontWeight:600},children:b.stats.filesChanged}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:"files changed"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:["+",b.stats.additions]}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:"additions"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:["-",b.stats.deletions]}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:"deletions"})]})]}),e.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("button",{onClick:()=>$?.(b.hash),style:{padding:"8px 12px",borderRadius:4,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:"View Changes"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>P?.(b.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Cherry Pick"}),e.jsx("button",{onClick:()=>D?.(b.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Revert"})]}),e.jsx("button",{onClick:()=>T?.(b.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Create Branch Here"}),e.jsx("button",{onClick:()=>_?.(b.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Create Tag Here"}),e.jsx("button",{onClick:()=>{F(!0),c(b.hash)},style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Compare with..."})]})]}),L&&e.jsxs("div",{style:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",borderRadius:4,fontSize:12,fontWeight:500},children:[ee?`Select commit to compare with ${ee.slice(0,7)}`:"Select first commit",e.jsx("button",{onClick:()=>{F(!1),c(null)},style:{marginLeft:12,padding:"2px 8px",background:"var(--nice-overlay-light-20, rgba(255, 255, 255, 0.2))",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Cancel"})]}),I&&e.jsx("div",{style:{position:"fixed",left:I.x,top:I.y,background:"var(--nice-bg-elevated, #252525)",border:"1px solid var(--nice-border-color, #444)",borderRadius:6,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",minWidth:160,zIndex:1e3},children:[{label:"View Changes",onClick:()=>$?.(I.commit.hash)},{label:"Cherry Pick",onClick:()=>P?.(I.commit.hash)},{label:"Revert",onClick:()=>D?.(I.commit.hash)},{divider:!0},{label:"Create Branch",onClick:()=>T?.(I.commit.hash)},{label:"Create Tag",onClick:()=>_?.(I.commit.hash)},{divider:!0},{label:"Reset Soft",onClick:()=>K?.(I.commit.hash,"soft")},{label:"Reset Mixed",onClick:()=>K?.(I.commit.hash,"mixed")},{label:"Reset Hard",onClick:()=>K?.(I.commit.hash,"hard"),danger:!0}].map((p,C)=>"divider"in p?e.jsx("div",{style:{height:1,background:"var(--nice-bg-tertiary, #444)",margin:"4px 0"}},C):e.jsx("button",{onClick:()=>{p.onClick?.(),u()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in p&&p.danger?"var(--nice-color-error, #ef4444)":"var(--nice-bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:Q=>{Q.currentTarget.style.background="var(--nice-bg-tertiary, #333)"},onMouseOut:Q=>{Q.currentTarget.style.background="transparent"},children:p.label},C))})]})},$e=Object.freeze(Object.defineProperty({__proto__:null,NiceGitGraph:ye},Symbol.toStringTag,{value:"Module"})),ve=({branches:h,currentBranch:k,defaultBranch:z="main",protectionRules:E=[],showRemotes:O=!0,selectedBranch:U,onBranchSelect:V,onCheckout:W,onCreateBranch:M,onDeleteBranch:H,onRenameBranch:Y,onMerge:A,onRebase:m,onSetUpstream:y,onPush:R,onPull:N,onCompare:T,onProtectionChange:_,className:P,style:D,"data-testid":K})=>{const[Z,$]=i.useState(""),[S,j]=i.useState("all"),[g,G]=i.useState(),[w,I]=i.useState(!1),[re,L]=i.useState(!1),[F,ee]=i.useState(!1),[c,a]=i.useState(""),[x,v]=i.useState(k||z),[s,B]=i.useState(""),[b,l]=i.useState(k||z),[r,o]=i.useState(null),u=U??g,f=i.useMemo(()=>{let d=h;if(S==="local"?d=d.filter(X=>!X.isRemote):S==="remote"?d=d.filter(X=>X.isRemote):O||(d=d.filter(X=>!X.isRemote)),Z.trim()){const X=Z.toLowerCase();d=d.filter(t=>t.name.toLowerCase().includes(X))}return d.sort((X,t)=>X.isHead?-1:t.isHead?1:X.name===z?-1:t.name===z?1:X.isRemote!==t.isRemote?X.isRemote?1:-1:X.name.localeCompare(t.name))},[h,S,O,Z,z]),q=i.useMemo(()=>{const d=f.filter(t=>!t.isRemote),X=f.filter(t=>t.isRemote);return{local:d,remote:X}},[f]),p=i.useCallback(d=>{G(d),V?.(d)},[V]),C=i.useCallback((d,X)=>{d.preventDefault(),o({x:d.clientX,y:d.clientY,branch:X})},[]),Q=i.useCallback(()=>o(null),[]),ne=i.useCallback(()=>{c.trim()&&(M?.(c.trim(),x),a(""),I(!1))},[c,x,M]),le=i.useCallback(()=>{s&&b&&s!==b&&(A?.(s,b),L(!1))},[s,b,A]),de=d=>{if(!d)return"-";const t=new Date().getTime()-d.getTime(),ie=Math.floor(t/(1e3*60*60*24));return ie===0?"Today":ie===1?"Yesterday":ie<7?`${ie} days ago`:ie<30?`${Math.floor(ie/7)} weeks ago`:d.toLocaleDateString()},J=i.useMemo(()=>h.find(d=>d.name===u),[h,u]),se=i.useCallback(d=>E.some(X=>new RegExp(X.pattern.replace(/\*/g,".*")).test(d)),[E]),ae=q.local,ce=d=>{const X=d.name===u,t=d.isHead,ie=d.name===z,te=se(d.name);return e.jsxs("div",{onClick:()=>p(d.name),onDoubleClick:()=>W?.(d.name),onContextMenu:Ie=>C(Ie,d),style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",cursor:"pointer",background:X?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":t?"rgba(34, 197, 94, 0.08)":"transparent",borderLeft:t?"3px solid var(--nice-success, #22c55e)":"3px solid transparent"},children:[e.jsx(n.oa,{name:d.isRemote?"cloud":t?"map-pin":"box",size:16}),e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:t?600:400,color:t?"var(--nice-color-success, #22c55e)":"var(--nice-text-primary, #e0e0e0)"},children:d.name}),e.jsxs("div",{style:{display:"flex",gap:4},children:[ie&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"var(--nice-primary-tint-15, #3b82f622)",color:"var(--nice-color-primary, #3b82f6)",border:"1px solid #3b82f644"},children:"default"}),te&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 6px",borderRadius:4,fontSize:10,background:"var(--nice-warning-tint-15, #f59e0b22)",color:"var(--nice-color-warning, #f59e0b)",border:"1px solid #f59e0b44"},children:[e.jsx(n.oa,{name:"lock",size:10})," protected"]})]}),d.upstream&&(d.ahead||d.behind)&&e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10,color:"var(--nice-text-muted, #888)"},children:[d.ahead?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(n.oa,{name:"arrow-up",size:10}),d.ahead]}):null,d.behind?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"var(--nice-color-error, #ef4444)"},children:[e.jsx(n.oa,{name:"arrow-down",size:10}),d.behind]}):null]}),d.lastCommit&&e.jsx("span",{style:{fontSize:10,color:"var(--nice-text-muted, #666)",width:80,textAlign:"right"},children:de(d.lastCommit.date)})]},d.name)};return e.jsxs("div",{className:`nice-branch-manager ${P||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...D},"data-testid":K,onClick:Q,children:[e.jsxs("div",{style:{width:350,display:"flex",flexDirection:"column",borderRight:"1px solid var(--nice-border-color, #333)"},children:[e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--nice-border-color, #333)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx(n.oa,{name:"box",size:18}),e.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Branches"}),e.jsxs("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"var(--nice-bg-tertiary, #333)",borderRadius:10,fontSize:11},children:[h.filter(d=>!d.isRemote).length," local"]})]}),e.jsx("input",{type:"text",placeholder:"Search branches...",value:Z,onChange:d=>$(d.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-bg-primary, #fff)",fontSize:12,marginBottom:8}}),e.jsx("div",{style:{display:"flex",gap:4},children:["all","local","remote"].map(d=>e.jsx("button",{onClick:()=>j(d),style:{flex:1,padding:"6px 0",borderRadius:4,border:"none",background:S===d?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:d},d))})]}),e.jsxs("div",{style:{padding:8,borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:8},children:[e.jsxs("button",{onClick:()=>I(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.oa,{name:"plus",size:14})," New Branch"]}),e.jsxs("button",{onClick:()=>L(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.oa,{name:"shuffle",size:14})," 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:"var(--nice-text-muted, #888)",textTransform:"uppercase",background:"var(--nice-bg-elevated, #252525)"},children:["Local (",q.local.length,")"]}),q.local.map(ce)]}),O&&q.remote.length>0&&S!=="local"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"8px 12px",fontSize:10,fontWeight:600,color:"var(--nice-text-muted, #888)",textTransform:"uppercase",background:"var(--nice-bg-elevated, #252525)",marginTop:8},children:["Remote (",q.remote.length,")"]}),q.remote.map(ce)]}),f.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:12},children:"No branches match the filter"})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:J?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:16,borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.oa,{name:J.isRemote?"cloud":J.isHead?"map-pin":"box",size:24}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:J.name}),J.description&&e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--nice-text-muted, #888)"},children:J.description})]}),J.isHead&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"4px 12px",borderRadius:4,background:"var(--nice-success-tint-15, #22c55e22)",color:"var(--nice-color-success, #22c55e)",fontSize:12,fontWeight:500},children:[e.jsx(n.oa,{name:"check",size:14})," Current"]})]})}),e.jsxs("div",{style:{padding:16,borderBottom:"1px solid var(--nice-border-color, #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:"var(--nice-text-muted, #888)",marginBottom:4},children:"Upstream"}),e.jsx("div",{style:{fontSize:13},children:J.upstream||e.jsx("span",{style:{color:"var(--nice-text-muted, #666)"},children:"Not set"})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)",marginBottom:4},children:"Sync Status"}),e.jsx("div",{style:{display:"flex",gap:8,fontSize:13},children:J.upstream?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(n.oa,{name:"arrow-up",size:13})," ",J.ahead||0," ","ahead"]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--nice-color-error, #ef4444)"},children:[e.jsx(n.oa,{name:"arrow-down",size:13})," ",J.behind||0," ","behind"]})]}):e.jsx("span",{style:{color:"var(--nice-text-muted, #666)"},children:"-"})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)",marginBottom:4},children:"Last Commit"}),e.jsx("div",{style:{fontSize:13},children:J.lastCommit?e.jsxs(e.Fragment,{children:[e.jsx("code",{style:{fontSize:11,color:"var(--nice-text-muted, #aaa)"},children:J.lastCommit.hash.slice(0,7)})," ",de(J.lastCommit.date)]}):e.jsx("span",{style:{color:"var(--nice-text-muted, #666)"},children:"-"})})]})]}),J.lastCommit&&e.jsxs("div",{style:{marginTop:16,padding:12,background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:6,fontSize:12},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:4},children:J.lastCommit.message}),e.jsxs("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:["by ",J.lastCommit.author]})]})]}),e.jsx("div",{style:{padding:16},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8},children:[!J.isHead&&e.jsxs("button",{onClick:()=>W?.(J.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.oa,{name:"map-pin",size:14})," Checkout"]}),J.upstream&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>N?.(J.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.oa,{name:"arrow-down",size:14})," Pull"]}),e.jsxs("button",{onClick:()=>R?.(J.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-accent, #8b5cf6)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.oa,{name:"arrow-up",size:14})," Push"]})]}),!J.upstream&&!J.isRemote&&e.jsx("button",{onClick:()=>y?.(J.name,`origin/${J.name}`),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"Set Upstream"}),e.jsxs("button",{onClick:()=>{B(J.name),l(k||z),L(!0)},style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.oa,{name:"shuffle",size:14})," Merge into..."]}),e.jsxs("button",{onClick:()=>T?.(z,J.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.oa,{name:"shuffle",size:14})," Compare"]}),!J.isHead&&!J.isRemote&&!se(J.name)&&e.jsxs("button",{onClick:()=>H?.(J.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.oa,{name:"trash",size:14})," Delete"]})]})})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #666)",fontSize:13},children:"Select a branch to view details"})}),w&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>I(!1),children:e.jsxs("div",{style:{width:400,background:"var(--nice-bg-elevated, #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:"var(--nice-text-muted, #888)",marginBottom:4},children:"Branch Name"}),e.jsx("input",{type:"text",placeholder:"feature/my-feature",value:c,onChange:d=>a(d.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:13},autoFocus:!0})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:4},children:"Based on"}),e.jsx("select",{value:x,onChange:d=>v(d.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:13},children:ae.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:()=>I(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"Cancel"}),e.jsx("button",{onClick:ne,disabled:!c.trim(),style:{padding:"10px 20px",borderRadius:6,border:"none",background:c.trim()?"var(--nice-color-success, #22c55e)":"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:c.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Create Branch"})]})]})}),re&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>L(!1),children:e.jsxs("div",{style:{width:400,background:"var(--nice-bg-elevated, #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:"var(--nice-text-muted, #888)",marginBottom:4},children:"Merge from"}),e.jsxs("select",{value:s,onChange:d=>B(d.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:13},children:[e.jsx("option",{value:"",children:"Select branch..."}),ae.map(d=>e.jsx("option",{value:d.name,children:d.name},d.name))]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 0",color:"var(--nice-text-muted, #888)"},children:[e.jsx(n.oa,{name:"arrow-down",size:14})," into ",e.jsx(n.oa,{name:"arrow-down",size:14})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:4},children:"Merge into"}),e.jsx("select",{value:b,onChange:d=>l(d.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:13},children:ae.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:()=>L(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"Cancel"}),e.jsx("button",{onClick:le,disabled:!s||!b||s===b,style:{padding:"10px 20px",borderRadius:6,border:"none",background:s&&b&&s!==b?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:s&&b&&s!==b?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Merge"})]})]})}),r&&e.jsx("div",{style:{position:"fixed",left:r.x,top:r.y,background:"var(--nice-bg-elevated, #252525)",border:"1px solid var(--nice-border-color, #444)",borderRadius:6,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",minWidth:160,zIndex:1e3},children:[!r.branch.isHead&&{label:"Checkout",onClick:()=>W?.(r.branch.name)},{label:"Compare",onClick:()=>T?.(z,r.branch.name)},{label:"Merge into current",onClick:()=>A?.(r.branch.name,k||z)},{divider:!0},!r.branch.isRemote&&{label:"Rename",onClick:()=>{const d=prompt("New name:",r.branch.name);d&&Y?.(r.branch.name,d)}},!r.branch.isHead&&!r.branch.isRemote&&!se(r.branch.name)&&{label:"Delete",onClick:()=>H?.(r.branch.name),danger:!0}].filter(Boolean).map((d,X)=>d?"divider"in d?e.jsx("div",{style:{height:1,background:"var(--nice-bg-tertiary, #444)",margin:"4px 0"}},X):e.jsx("button",{onClick:()=>{d.onClick?.(),Q()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in d&&d.danger?"var(--nice-color-error, #ef4444)":"var(--nice-bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:t=>t.currentTarget.style.background="var(--nice-bg-tertiary, #333)",onMouseOut:t=>t.currentTarget.style.background="transparent",children:d.label},X):null)})]})},We=Object.freeze(Object.defineProperty({__proto__:null,NiceBranchManager:ve},Symbol.toStringTag,{value:"Module"})),_e=[],Pe=[{target:".nice-merge-request-builder",titleKey:"tutorial.mergeRequestBuilder.intro.title",title:"Merge request builder",contentKey:"tutorial.mergeRequestBuilder.intro.content",content:"Pick source and target branches, write the title and description, add reviewers, labels and linked issues, then preview and submit.",placement:"auto"}],je=({branches:h=_e,users:k=[],labels:z=[],issues:E=[],templates:O=[],diff:U,currentBranch:V,defaultTargetBranch:W="main",initialSourceBranch:M,platform:H="github",onSubmit:Y,onCancel:A,onBranchChange:m,onPreview:y,tutorial:R,className:N,style:T,"data-testid":_})=>{const[P,D]=i.useState(""),[K,Z]=i.useState(""),[$,S]=i.useState(M||V||""),[j,g]=i.useState(W),[G,w]=i.useState(!1),[I,re]=i.useState([]),[L,F]=i.useState([]),[ee,c]=i.useState([]),[a,x]=i.useState([]),[v,s]=i.useState(!1),[B,b]=i.useState(!0),[l,r]=i.useState(!1),[o,u]=i.useState(!1),[f,q]=i.useState(!1),[p,C]=i.useState(!1),Q=i.useMemo(()=>$?$.replace(/^(feature|bugfix|hotfix|release)\//,"").replace(/[-_]/g," ").replace(/\b\w/g,ie=>ie.toUpperCase()):"",[$]),ne=i.useMemo(()=>h.filter(t=>!t.isRemote),[h]),le=i.useCallback((t,ie)=>{S(t),g(ie),m?.(t,ie)},[m]),de=i.useCallback(()=>{if(!$||!j||!P.trim())return;const t={title:P.trim(),description:K.trim(),sourceBranch:$,targetBranch:j,isDraft:G,labels:I,reviewers:L,assignees:ee,linkedIssues:a,squashCommits:v,deleteSourceBranch:B};Y?.(t)},[P,K,$,j,G,I,L,ee,a,v,B,Y]),J=t=>{Z(t.content),C(!1)},se=t=>{re(ie=>ie.includes(t)?ie.filter(te=>te!==t):[...ie,t])},ae=t=>{F(ie=>ie.includes(t)?ie.filter(te=>te!==t):[...ie,t])},ce=t=>{x(ie=>ie.includes(t)?ie.filter(te=>te!==t):[...ie,t])},d={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"}},X=$&&j&&$!==j&&P.trim();return e.jsxs("div",{className:`nice-merge-request-builder ${N||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",position:"relative",...T},"data-testid":_,children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(n.Ql,{steps:n.Yl(R,Pe)})}),e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)",display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.oa,{name:"shuffle",size:24}),e.jsxs("div",{children:[e.jsxs("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:[G?"Draft ":"",d[H].title]}),e.jsxs("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--nice-text-muted, #888)"},children:["Create a new ",H==="gitlab"?"merge":"pull"," request"]})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[e.jsxs("div",{style:{background:"var(--nice-bg-elevated, #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:"var(--nice-text-muted, #888)",marginBottom:4},children:"From"}),e.jsxs("select",{value:$,onChange:t=>le(t.target.value,j),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:13},children:[e.jsx("option",{value:"",children:"Select source branch..."}),ne.map(t=>e.jsx("option",{value:t.name,children:t.name},t.name))]})]}),e.jsx("div",{style:{padding:"20px 0 0"},children:e.jsx("span",{style:{fontSize:20,color:"var(--nice-text-muted, #888)"},children:"→"})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11,color:"var(--nice-text-muted, #888)",marginBottom:4},children:"Into"}),e.jsx("select",{value:j,onChange:t=>le($,t.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:13},children:ne.map(t=>e.jsx("option",{value:t.name,children:t.name},t.name))})]})]}),U&&e.jsxs("div",{style:{marginTop:12,padding:"8px 12px",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:6,display:"flex",gap:16,fontSize:12},children:[e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",U.additions," additions"]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",U.deletions," deletions"]}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #888)"},children:[U.changedFiles," files changed"]})]}),$===j&&$&&e.jsx("div",{style:{marginTop:12,padding:"8px 12px",background:"var(--nice-danger-tint-15, #ef444422)",color:"var(--nice-color-error, #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:"var(--nice-text-muted, #888)",marginBottom:6},children:"Title"}),e.jsx("input",{type:"text",value:P,onChange:t=>D(t.target.value),placeholder:Q||"Enter a title...",style:{width:"100%",padding:"12px 16px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-bg-primary, #fff)",fontSize:14}}),!P&&Q&&e.jsxs("button",{onClick:()=>D(Q),style:{marginTop:4,padding:0,background:"none",border:"none",color:"var(--nice-color-primary, #3b82f6)",fontSize:11,cursor:"pointer"},children:['Use suggested: "',Q,'"']})]}),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:"var(--nice-text-muted, #888)"},children:"Description"}),O.length>0&&e.jsxs("button",{onClick:()=>C(!p),style:{padding:"4px 8px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-muted, #888)",fontSize:11,cursor:"pointer"},children:[e.jsx(n.oa,{name:"edit",size:14})," Templates"]})]}),e.jsx("textarea",{value:K,onChange:t=>Z(t.target.value),placeholder:"Describe your changes...",rows:8,style:{width:"100%",padding:"12px 16px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-bg-primary, #fff)",fontSize:13,resize:"vertical",fontFamily:"inherit"}})]}),p&&O.length>0&&e.jsxs("div",{style:{marginBottom:16,padding:12,background:"var(--nice-bg-elevated, #252525)",borderRadius:6,border:"1px solid var(--nice-border-color, #444)"},children:[e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:8},children:"Select Template"}),O.map(t=>e.jsxs("button",{onClick:()=>J(t),style:{display:"block",width:"100%",padding:"8px 12px",marginBottom:4,borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:[e.jsx("div",{style:{fontWeight:500},children:t.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:t.description})]},t.id))]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16,marginBottom:20},children:[e.jsxs("div",{children:[e.jsx("button",{onClick:()=>r(!l),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"tag",size:14})," Labels"]}),I.length>0&&e.jsxs("span",{style:{color:"var(--nice-color-primary, #3b82f6)"},children:["(",I.length,")"]})]})}),l&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--nice-bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:z.map(t=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:I.includes(t.id),onChange:()=>se(t.id)}),e.jsx("span",{style:{width:12,height:12,borderRadius:"50%",background:t.color}}),e.jsx("span",{style:{fontSize:12},children:t.name})]},t.id))})]}),e.jsxs("div",{children:[e.jsx("button",{onClick:()=>u(!o),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"users",size:14})," Reviewers"]}),L.length>0&&e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["(",L.length,")"]})]})}),o&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--nice-bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:k.map(t=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:L.includes(t.id),onChange:()=>ae(t.id)}),t.avatar?e.jsx("img",{src:t.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"var(--nice-text-muted, #666)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:t.name[0]}),e.jsx("span",{style:{fontSize:12},children:t.name})]},t.id))})]}),e.jsxs("div",{children:[e.jsx("button",{onClick:()=>q(!f),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",color:"var(--nice-bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"link",size:14})," Linked Issues"]}),a.length>0&&e.jsxs("span",{style:{color:"var(--nice-color-accent, #8b5cf6)"},children:["(",a.length,")"]})]})}),f&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--nice-bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:E.filter(t=>t.state==="open").map(t=>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(t.id),onChange:()=>ce(t.id)}),e.jsxs("span",{style:{fontSize:12,color:"var(--nice-text-muted, #888)"},children:["#",t.number]}),e.jsx("span",{style:{fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.title})]},t.id))})]}),e.jsx("div",{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",cursor:"pointer",fontSize:12},children:[e.jsx("input",{type:"checkbox",checked:G,onChange:t=>w(t.target.checked)}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"edit",size:14})," Create as Draft"]})]})})]}),e.jsxs("div",{style:{background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:16,marginBottom:20},children:[e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #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:v,onChange:t=>s(t.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:B,onChange:t=>b(t.target.checked)}),"Delete source branch after merge"]})]})]}),U&&U.files.length>0&&e.jsxs("div",{style:{background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:16},children:[e.jsxs("div",{style:{fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:12},children:["Changed Files (",U.changedFiles,")"]}),e.jsx("div",{style:{maxHeight:200,overflow:"auto"},children:U.files.map(t=>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:t.status==="added"?"var(--nice-color-success, #22c55e)":t.status==="deleted"?"var(--nice-color-error, #ef4444)":t.status==="renamed"?"var(--nice-color-primary, #3b82f6)":"var(--nice-color-warning, #f59e0b)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,color:"var(--nice-bg-primary, #fff)"},children:t.status==="added"?"+":t.status==="deleted"?"-":t.status==="renamed"?"→":"M"}),e.jsx("span",{style:{flex:1,fontFamily:"monospace",fontSize:11},children:t.path}),e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)",fontSize:11},children:["+",t.additions]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)",fontSize:11},children:["-",t.deletions]})]},t.path))})]})]}),e.jsxs("div",{style:{padding:"16px 20px",borderTop:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:12},children:[e.jsx("button",{onClick:A,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:()=>y?.({title:P,description:K,sourceBranch:$,targetBranch:j,isDraft:G,labels:I,reviewers:L,assignees:ee,linkedIssues:a,squashCommits:v,deleteSourceBranch:B}),disabled:!X,style:{padding:"10px 20px",borderRadius:6,border:"none",background:X?"var(--nice-bg-tertiary, #333)":"var(--nice-bg-elevated, #222)",color:X?"var(--nice-bg-primary, #fff)":"var(--nice-text-muted, #666)",cursor:X?"pointer":"not-allowed",fontSize:13},children:"Preview"}),e.jsx("button",{onClick:de,disabled:!X,style:{padding:"10px 24px",borderRadius:6,border:"none",background:X?"var(--nice-color-success, #22c55e)":"var(--nice-bg-elevated, #222)",color:X?"var(--nice-bg-primary, #fff)":"var(--nice-text-muted, #666)",cursor:X?"pointer":"not-allowed",fontSize:13,fontWeight:500},children:G?"Create Draft":d[H].btn})]})]})},Ae=Object.freeze(Object.defineProperty({__proto__:null,NiceMergeRequestBuilder:je},Symbol.toStringTag,{value:"Module"})),Ee=[],ke=({files:h=Ee,viewMode:k,showWhitespace:z,comments:E=[],selectedFile:O,showFileTree:U=!0,contextLines:V=3,baseRef:W,headRef:M,onFileSelect:H,onViewModeChange:Y,onAddComment:A,onResolveComment:m,onExpandChunk:y,className:R,style:N,"data-testid":T})=>{const[_,P]=i.useState("split"),[D,K]=i.useState(!1),[Z,$]=i.useState(void 0),[S,j]=i.useState(new Set),[g,G]=i.useState(null),w=k??_,I=z??D,re=O??Z??h[0]?.path,L=i.useMemo(()=>h.find(l=>l.path===re),[h,re]),F=i.useMemo(()=>({additions:h.reduce((l,r)=>l+r.additions,0),deletions:h.reduce((l,r)=>l+r.deletions,0)}),[h]),ee=i.useCallback(l=>{$(l),H?.(l)},[H]),c=i.useCallback(l=>{P(l),Y?.(l)},[Y]),a=i.useCallback((l,r)=>{const o=`${l}:${r}`;j(u=>{const f=new Set(u);return f.has(o)?f.delete(o):f.add(o),f}),y?.(l,r)},[y]),x=i.useMemo(()=>E.filter(l=>l.filePath===re),[E,re]),v=l=>{switch(l){case"added":return{icon:"+",color:"var(--nice-color-success, #22c55e)"};case"deleted":return{icon:"-",color:"var(--nice-color-error, #ef4444)"};case"modified":return{icon:"M",color:"var(--nice-color-warning, #f59e0b)"};case"renamed":return{icon:"→",color:"var(--nice-color-primary, #3b82f6)"};case"copied":return{icon:"C",color:"var(--nice-color-accent, #8b5cf6)"}}},s=(l,r,o)=>{const u=l.type==="addition"?"var(--nice-success-tint-10, rgba(34, 197, 94, 0.1))":l.type==="deletion"?"var(--nice-danger-tint-10, rgba(239, 68, 68, 0.1))":l.type==="header"?"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))":"transparent",f=l.type==="addition"?"var(--nice-success-light, #4ade80)":l.type==="deletion"?"var(--nice-danger-light, #f87171)":l.type==="header"?"var(--nice-color-primary-light, #60a5fa)":"var(--nice-text-primary, #e0e0e0)",q=o==="old"?l.lineNumberOld:o==="new"?l.lineNumberNew:void 0,p=I?l.content.replace(/ /g,"·").replace(/\t/g,"→ "):l.content;return e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:u,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:"var(--nice-text-muted, #666)",background:"var(--nice-overlay-20, rgba(0, 0, 0, 0.2))",userSelect:"none",borderRight:"1px solid var(--nice-border-color, #333)"},children:q}),w==="unified"&&e.jsx("div",{style:{width:20,textAlign:"center",color:f,fontWeight:600},children:l.type==="addition"?"+":l.type==="deletion"?"-":" "}),e.jsx("div",{style:{flex:1,padding:"0 8px",color:f,whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:p||" "}),A&&q&&l.type!=="header"&&e.jsx("button",{onClick:()=>G({filePath:re,line:q,side:o||"new",body:""}),style:{width:24,border:"none",background:"transparent",color:"var(--nice-color-primary, #3b82f6)",cursor:"pointer",opacity:.3,transition:"opacity 0.2s"},onMouseEnter:C=>C.currentTarget.style.opacity="1",onMouseLeave:C=>C.currentTarget.style.opacity="0.3","aria-label":"Add comment",children:e.jsx(n.oa,{name:"message",size:14})})]},`${r}-${o||"unified"}`)},B=l=>e.jsx("div",{style:{borderTop:"1px solid var(--nice-border-color, #333)"},children:l.chunks.map((r,o)=>{const u=`${l.path}:${o}`;return S.has(u),e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>a(l.path,o),style:{padding:"6px 12px",background:"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))",borderBottom:"1px solid var(--nice-border-color, #333)",fontSize:11,color:"var(--nice-color-primary-light, #60a5fa)",cursor:"pointer",fontFamily:"monospace"},children:["@@ -",r.oldStart,",",r.oldLines," +",r.newStart,",",r.newLines," @@"," ",r.header||""]}),r.lines.map((f,q)=>s(f,q))]},o)})}),b=l=>e.jsx("div",{style:{borderTop:"1px solid var(--nice-border-color, #333)"},children:l.chunks.map((r,o)=>{const u=[],f=[];for(const p of r.lines)(p.type==="deletion"||p.type==="context")&&u.push(p),(p.type==="addition"||p.type==="context")&&f.push(p);const q=Math.max(u.length,f.length);for(;u.length<q;)u.push({content:"",type:"context"});for(;f.length<q;)f.push({content:"",type:"context"});return e.jsxs("div",{children:[e.jsxs("div",{style:{padding:"6px 12px",background:"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))",borderBottom:"1px solid var(--nice-border-color, #333)",fontSize:11,color:"var(--nice-color-primary-light, #60a5fa)",fontFamily:"monospace"},children:["@@ -",r.oldStart,",",r.oldLines," +",r.newStart,",",r.newLines," @@"," ",r.header||""]}),e.jsxs("div",{style:{display:"flex"},children:[e.jsx("div",{style:{flex:1,borderRight:"1px solid var(--nice-border-color, #444)"},children:u.map((p,C)=>s(p,C,"old"))}),e.jsx("div",{style:{flex:1},children:f.map((p,C)=>s(p,C,"new"))})]})]},o)})});return e.jsxs("div",{className:`nice-git-diff-viewer ${R||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...N},"data-testid":T,children:[U&&e.jsxs("div",{style:{width:280,borderRight:"1px solid var(--nice-border-color, #333)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx(n.oa,{name:"folder",size:16}),e.jsx("span",{style:{fontWeight:600,fontSize:13},children:"Changed Files"}),e.jsx("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"var(--nice-bg-tertiary, #333)",borderRadius:10,fontSize:11},children:h.length})]}),(W||M)&&e.jsxs("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:[W&&e.jsx("span",{children:W}),W&&M&&e.jsx("span",{style:{margin:"0 4px"},children:"→"}),M&&e.jsx("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:M})]})]}),e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:12,fontSize:12},children:[e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",F.additions]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",F.deletions]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:h.map(l=>{const r=v(l.status),o=l.path===re;return e.jsxs("div",{onClick:()=>ee(l.path),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",cursor:"pointer",background:o?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderLeft:o?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:2,background:r.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--nice-bg-primary, #fff)",fontWeight:600},children:r.icon}),e.jsx("span",{style:{flex:1,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.path.split("/").pop()}),e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10},children:[l.additions>0&&e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",l.additions]}),l.deletions>0&&e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",l.deletions]})]})]},l.path)})})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)",display:"flex",alignItems:"center",gap:16},children:[L&&e.jsx("div",{style:{flex:1,fontSize:13,fontFamily:"monospace"},children:L.oldPath&&L.oldPath!==L.path?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:L.oldPath}),e.jsx("span",{style:{margin:"0 8px",color:"var(--nice-text-muted, #888)"},children:"→"}),e.jsx("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:L.path})]}):L.path}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>c("unified"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:w==="unified"?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Unified"}),e.jsx("button",{onClick:()=>c("split"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:w==="split"?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Split"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--nice-text-muted, #888)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:I,onChange:l=>K(l.target.checked)}),"Show whitespace"]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:L?L.binary?e.jsxs("div",{style:{padding:40,textAlign:"center",color:"var(--nice-text-muted, #888)"},children:[e.jsx(n.oa,{name:"box",size:48}),e.jsx("p",{children:"Binary file cannot be displayed"})]}):w==="split"?b(L):B(L):e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--nice-text-muted, #666)"},children:"Select a file to view changes"})}),x.length>0&&e.jsxs("div",{style:{borderTop:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)",maxHeight:200,overflow:"auto"},children:[e.jsxs("div",{style:{padding:"8px 16px",fontSize:12,fontWeight:600,borderBottom:"1px solid var(--nice-border-color, #333)"},children:["Comments (",x.length,")"]}),x.map(l=>e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--nice-border-color, #333)",opacity:l.resolved?.5:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[l.author.avatar?e.jsx("img",{src:l.author.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"var(--nice-text-muted, #666)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:l.author.name[0]}),e.jsx("span",{style:{fontSize:12,fontWeight:500},children:l.author.name}),e.jsxs("span",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:["Line ",l.line," (",l.side,")"]}),l.resolved&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"var(--nice-success-tint-15, #22c55e22)",color:"var(--nice-color-success, #22c55e)"},children:"Resolved"}),m&&!l.resolved&&e.jsx("button",{onClick:()=>m(l.id),style:{marginLeft:"auto",padding:"4px 8px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-muted, #888)",cursor:"pointer",fontSize:10},children:"Resolve"})]}),e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-secondary, #ccc)"},children:l.body})]},l.id))]}),g&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>G(null),children:e.jsxs("div",{style:{width:400,background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:20},onClick:l=>l.stopPropagation(),children:[e.jsxs("h3",{style:{margin:"0 0 12px",fontSize:14},children:["Add comment on line ",g.line]}),e.jsx("textarea",{value:g.body,onChange:l=>G({...g,body:l.target.value}),placeholder:"Write a comment...",rows:4,style:{width:"100%",padding:12,borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:13,resize:"vertical"},autoFocus:!0}),e.jsxs("div",{style:{marginTop:12,display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>G(null),style:{padding:"8px 16px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"Cancel"}),e.jsx("button",{onClick:()=>{g.body.trim()&&(A?.(g.filePath,g.line,g.side,g.body.trim()),G(null))},disabled:!g.body.trim(),style:{padding:"8px 16px",borderRadius:4,border:"none",background:g.body.trim()?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:g.body.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Add Comment"})]})]})})]})]})},De=Object.freeze(Object.defineProperty({__proto__:null,NiceGitDiffViewer:ke},Symbol.toStringTag,{value:"Module"})),Le=(h,k)=>{const E=new Date().getTime()-h.getTime(),O=Math.floor(E/(1e3*60*60*24));return O===0?"today":O===1?"yesterday":O<7?`${O} days ago`:O<30?`${Math.floor(O/7)} weeks ago`:O<365?`${Math.floor(O/30)} months ago`:`${Math.floor(O/365)} years ago`},Oe=h=>{const z=new Date().getTime()-h.getTime(),E=Math.floor(z/(1e3*60*60*24));return E<7?"var(--nice-primary-tint-30, rgba(59, 130, 246, 0.3))":E<30?"var(--nice-success-tint-30, rgba(34, 197, 94, 0.3))":E<90?"var(--nice-warning-tint-30, rgba(234, 179, 8, 0.3))":E<365?"var(--nice-warning-tint-30, rgba(249, 115, 22, 0.3))":"var(--nice-danger-tint-30, rgba(239, 68, 68, 0.3))"},oe=h=>{const k=["var(--nice-color-primary, #3b82f6)","var(--nice-color-success, #22c55e)","var(--nice-color-warning, #f59e0b)","var(--nice-color-error, #ef4444)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-info, #06b6d4)","var(--nice-color-accent-pink, #ec4899)","var(--nice-info, #14b8a6)","var(--nice-warning, #f97316)","var(--nice-color-accent, #6366f1)"];let z=0;for(let E=0;E<h.length;E++)z=(z<<5)-z+h.charCodeAt(E),z=z&z;return k[Math.abs(z)%k.length]},Se=({file:h,viewMode:k="inline",showAgeHeatmap:z=!0,showAvatars:E=!0,groupHunks:O=!0,highlightOnHover:U=!0,timeZone:V,dateRange:W,authorFilter:M,selectedLine:H,syntaxTheme:Y="dark",onLineClick:A,onCommitClick:m,onAuthorClick:y,onBlameParent:R,className:N,style:T,"data-testid":_="nice-git-blame"})=>{const[P,D]=i.useState(null),[K,Z]=i.useState(null),[$,S]=i.useState(null),j=i.useMemo(()=>{const a=[];return h.hunks.forEach(x=>{x.lines.forEach(v=>{a.push(v)})}),a.sort((x,v)=>x.lineNumber-v.lineNumber)},[h.hunks]),g=i.useMemo(()=>j.filter(a=>!(W?.from&&a.commit.timestamp<W.from||W?.to&&a.commit.timestamp>W.to||M&&M.length>0&&!M.includes(a.commit.author.id))),[j,W,M]),G=i.useMemo(()=>{if(!O)return g.map(s=>({startLine:s.lineNumber,endLine:s.lineNumber,commit:s.commit,lines:[s],isFirstOfCommit:!0}));const a=[];let x=null;const v=new Set;return g.forEach(s=>{if(!x||x.commit.id!==s.commit.id){const B=!v.has(s.commit.id);v.add(s.commit.id),x={startLine:s.lineNumber,endLine:s.lineNumber,commit:s.commit,lines:[s],isFirstOfCommit:B},a.push(x)}else x.endLine=s.lineNumber,x.lines.push(s)}),a},[g,O]),w=i.useMemo(()=>{const a=new Map;return j.forEach(x=>{a.has(x.commit.author.id)||a.set(x.commit.author.id,x.commit.author)}),Array.from(a.values())},[j]),I=i.useMemo(()=>{const a=new Map;return j.forEach(x=>{a.has(x.commit.id)||a.set(x.commit.id,x.commit)}),Array.from(a.values()).sort((x,v)=>v.timestamp.getTime()-x.timestamp.getTime())},[j]),re=i.useCallback(a=>{A?.(a)},[A]),L=i.useCallback((a,x)=>{x.stopPropagation(),K===a.id?Z(null):Z(a.id),m?.(a)},[K,m]),F=(a,x)=>{const v=x===0,s=a.commit,B=U&&P===s.id;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0 12px",minWidth:k==="inline"?280:40,background:B?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":z?Oe(s.timestamp):"transparent",borderRight:`3px solid ${oe(s.author.id)}`,cursor:"pointer",transition:"background 0.15s"},onMouseEnter:()=>D(s.id),onMouseLeave:()=>D(null),onClick:b=>L(s,b),children:[v&&k==="inline"&&e.jsxs(e.Fragment,{children:[E&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:oe(s.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,color:"var(--nice-bg-primary, #fff)",fontWeight:500,flexShrink:0},title:s.author.name,children:s.author.avatar?e.jsx("img",{src:s.author.avatar,alt:s.author.name,style:{width:"100%",height:"100%",borderRadius:"50%"}}):s.author.name[0].toUpperCase()}),e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[e.jsx("div",{style:{fontSize:11,fontFamily:"monospace",color:"var(--nice-text-muted, #6b7280)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.shortId}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #9ca3af)",whiteSpace:"nowrap"},children:Le(s.timestamp)})]})]}),k==="gutter"&&v&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:oe(s.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--nice-bg-primary, #fff)"},title:`${s.author.name} - ${s.shortId}
|
|
2
|
+
${s.message}`,children:s.author.name[0].toUpperCase()})]})},ee=a=>{if($!==a.lineNumber||k!=="tooltip")return null;const x=a.commit;return e.jsxs("div",{style:{position:"absolute",left:60,top:-8,zIndex:100,background:"var(--nice-text-primary, #1f2937)",border:"1px solid var(--nice-text, #374151)",borderRadius:8,padding:12,boxShadow:"0 4px 12px var(--nice-overlay-30, 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:oe(x.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-bg-primary, #fff)",fontWeight:500},children:x.author.name[0].toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,color:"var(--nice-border-color, #e5e7eb)"},children:x.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #9ca3af)"},children:x.author.email})]})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12,color:"var(--nice-color-primary-light, #60a5fa)",marginBottom:4},children:x.shortId}),e.jsx("div",{style:{fontSize:13,color:"var(--nice-border-color, #e5e7eb)",marginBottom:8},children:x.message}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #6b7280)"},children:x.timestamp.toLocaleString()}),x.parents&&x.parents.length>0&&R&&e.jsxs("button",{onClick:()=>R(x),style:{marginTop:8,padding:"4px 8px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--nice-border-color, #e5e7eb)",fontSize:11,cursor:"pointer"},children:[e.jsx(n.oa,{name:"arrow-up",size:11})," Blame parent"]})]})},c=a=>K!==a.id?null:e.jsx("div",{style:{background:"var(--nice-text-primary, #1f2937)",borderBottom:"1px solid var(--nice-text, #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:oe(a.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-bg-primary, #fff)",fontSize:20,fontWeight:500,flexShrink:0},children:a.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:"var(--nice-border-color, #e5e7eb)"},children:a.author.name}),e.jsx("span",{style:{fontSize:11,color:"var(--nice-text-muted, #6b7280)"},children:a.author.email})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13,color:"var(--nice-color-primary-light, #60a5fa)",marginBottom:8},children:a.id}),e.jsx("div",{style:{fontSize:14,color:"var(--nice-border-color, #e5e7eb)",marginBottom:8,lineHeight:1.5},children:a.message}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,fontSize:12,color:"var(--nice-text-muted, #9ca3af)"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(n.oa,{name:"calendar",size:12})," ",a.timestamp.toLocaleString()]}),a.parents&&a.parents.length>0&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(n.oa,{name:"cursor",size:12})," ",a.parents.length," parent(s)"]})]}),R&&a.parents&&a.parents.length>0&&e.jsxs("button",{onClick:()=>R(a),style:{marginTop:12,padding:"6px 12px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",fontSize:12,cursor:"pointer"},children:[e.jsx(n.oa,{name:"arrow-up",size:12})," Blame in parent commit"]})]})]})});return e.jsxs("div",{className:`nice-git-blame ${N||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:Y==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-primary, #ffffff)",color:Y==="dark"?"var(--nice-text-primary, #e6edf3)":"var(--nice-text-primary, #1f2937)",fontFamily:"system-ui, sans-serif",...T},"data-testid":_,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:Y==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.oa,{name:"clipboard",size:16}),e.jsx("span",{style:{fontWeight:500},children:h.path}),e.jsxs("span",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:["at ",h.revision.substring(0,7)]})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:e.jsxs("span",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:[I.length," commits by ",w.length," author(s)"]})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:Y==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",flexWrap:"wrap"},children:[w.slice(0,10).map(a=>e.jsxs("div",{onClick:()=>y?.(a),style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer"},children:[e.jsx("div",{style:{width:12,height:12,borderRadius:"50%",background:oe(a.id)}}),e.jsx("span",{style:{fontSize:12},children:a.name})]},a.id)),w.length>10&&e.jsxs("span",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:["+",w.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:G.map((a,x)=>e.jsxs(i.Fragment,{children:[a.isFirstOfCommit&&K===a.commit.id&&c(a.commit),a.lines.map((v,s)=>e.jsxs("div",{onClick:()=>re(v),onMouseEnter:()=>S(v.lineNumber),onMouseLeave:()=>S(null),style:{display:"flex",alignItems:"stretch",background:H===v.lineNumber?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":U&&P===a.commit.id?"var(--nice-primary-tint-8, rgba(59, 130, 246, 0.08))":"transparent",borderLeft:H===v.lineNumber?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",position:"relative"},children:[F(a,s),e.jsx("div",{style:{padding:"0 12px",color:"var(--nice-text-muted, #6e7681)",textAlign:"right",minWidth:50,userSelect:"none",background:Y==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-secondary, #f6f8fa)",borderRight:"1px solid var(--nice-border, #30363d)"},children:v.lineNumber}),e.jsx("div",{style:{flex:1,padding:"0 16px",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:v.content}),k==="tooltip"&&ee(v)]},v.lineNumber))]},`${a.commit.id}-${a.startLine}`))}),z&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,padding:"8px 16px",borderTop:"1px solid var(--nice-border, #30363d)",background:Y==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",fontSize:11,color:"var(--nice-text-muted, #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:"var(--nice-primary-tint-30, 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:"var(--nice-success-tint-30, 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:"var(--nice-warning-tint-30, 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:"var(--nice-warning-tint-30, 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:"var(--nice-danger-tint-30, rgba(239, 68, 68, 0.3))",borderRadius:2}}),e.jsx("span",{children:">1 year"})]})]})]})},Fe=Object.freeze(Object.defineProperty({__proto__:null,NiceGitBlame:Se},Symbol.toStringTag,{value:"Module"})),He=h=>{if(!h.resolved)return[];switch(h.resolution){case"ours":return h.oursContent;case"theirs":return h.theirsContent;case"both":return[...h.oursContent,...h.theirsContent];case"custom":return h.customContent||[];default:return[]}},Ce=({file:h,context:k,viewMode:z="split",showLineNumbers:E=!0,showBase:O=!1,currentConflictIndex:U,syntaxTheme:V="dark",onResolve:W,onResolveAll:M,onNavigateConflict:H,onSave:Y,onCancel:A,className:m,style:y,"data-testid":R="nice-git-conflict-resolver"})=>{const[N,T]=i.useState(h.conflicts),[_,P]=i.useState(U??0),[D,K]=i.useState(null),[Z,$]=i.useState(""),S=i.useMemo(()=>N.filter(s=>!s.resolved).length,[N]),j=i.useMemo(()=>N.filter(s=>s.resolved).length,[N]),g=N[_],G=i.useCallback((s,B,b)=>{T(r=>r.map(o=>o.id===s?{...o,resolved:!0,resolution:B,customContent:b}:o)),K(null),W?.(s,B,b);const l=N.findIndex((r,o)=>o>_&&!r.resolved);l!==-1&&(P(l),H?.(l))},[N,_,W,H]),w=i.useCallback(s=>{T(B=>B.map(b=>b.resolved?b:{...b,resolved:!0,resolution:s})),M?.(s)},[M]),I=i.useCallback(s=>{const B=s==="prev"?Math.max(0,_-1):Math.min(N.length-1,_+1);P(B),H?.(B)},[_,N.length,H]),re=i.useCallback(()=>{g&&(K(g.id),$(g.oursContent.join(`
|
|
3
|
+
`)))},[g]),L=i.useCallback(()=>{D&&G(D,"custom",Z.split(`
|
|
4
|
+
`))},[D,Z,G]),F=i.useCallback(()=>{const s=h.content.split(`
|
|
5
|
+
`);let B=[],b=0;N.forEach(l=>{B=[...B,...s.slice(b,l.startLine-1)],B=[...B,...He(l)],b=l.endLine}),B=[...B,...s.slice(b)],Y?.(B.join(`
|
|
6
|
+
`))},[h.content,N,Y]),ee=(s,B,b,l)=>e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,borderLeft:`3px solid ${b}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:`${b}20`,borderBottom:"1px solid var(--nice-border, #30363d)"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:500,color:b},children:s}),l&&e.jsx("button",{onClick:l,style:{padding:"4px 10px",background:b,border:"none",borderRadius:4,color:"var(--nice-bg-primary, #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:B.map((r,o)=>e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:V==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-primary, #fff)"},children:[E&&e.jsx("span",{style:{padding:"0 12px",color:"var(--nice-text-muted, #6e7681)",textAlign:"right",minWidth:40,borderRight:"1px solid var(--nice-border, #30363d)",userSelect:"none"},children:o+1}),e.jsx("span",{style:{padding:"0 12px",whiteSpace:"pre"},children:r||" "})]},o))})]}),c=()=>g?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[e.jsxs("div",{style:{background:"var(--nice-success-tint-10, rgba(34, 197, 94, 0.1))",borderLeft:"3px solid var(--nice-success, #22c55e)"},children:[e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--nice-border, #30363d)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontSize:12,color:"var(--nice-color-success, #22c55e)",fontWeight:500},children:["← Ours (",k?.oursCommit.branch||"HEAD",")"]}),e.jsx("button",{onClick:()=>G(g.id,"ours"),style:{padding:"4px 10px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",fontSize:11,cursor:"pointer"},children:"Accept Ours"})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:g.oursContent.join(`
|
|
7
|
+
`)})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 12px",background:"var(--nice-text-primary, #1f2937)"},children:[e.jsx("div",{style:{flex:1,height:1,background:"var(--nice-text-secondary, #374151)"}}),e.jsx("span",{style:{color:"var(--nice-text-muted, #9ca3af)",fontSize:11},children:"VS"}),e.jsx("div",{style:{flex:1,height:1,background:"var(--nice-text-secondary, #374151)"}})]}),e.jsxs("div",{style:{background:"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))",borderLeft:"3px solid var(--nice-primary, #3b82f6)"},children:[e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--nice-border, #30363d)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontSize:12,color:"var(--nice-color-primary, #3b82f6)",fontWeight:500},children:["→ Theirs (",k?.theirsCommit.branch||"incoming",")"]}),e.jsx("button",{onClick:()=>G(g.id,"theirs"),style:{padding:"4px 10px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",fontSize:11,cursor:"pointer"},children:"Accept Theirs"})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:g.theirsContent.join(`
|
|
8
|
+
`)})]})]}):null,a=()=>g?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[ee(`← Ours (${k?.oursCommit.branch||"HEAD"})`,g.oursContent,"var(--nice-color-success, #22c55e)",()=>G(g.id,"ours")),O&&ee("Base (ancestor)",g.baseContent,"var(--nice-text-muted, #6b7280)"),ee(`→ Theirs (${k?.theirsCommit.branch||"incoming"})`,g.theirsContent,"var(--nice-color-primary, #3b82f6)",()=>G(g.id,"theirs"))]}):null,x=()=>g?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[ee(`← Ours (${k?.oursCommit.branch||"HEAD"})`,g.oursContent,"var(--nice-color-success, #22c55e)",()=>G(g.id,"ours")),ee("Base",g.baseContent,"var(--nice-text-muted, #6b7280)"),ee(`→ Theirs (${k?.theirsCommit.branch||"incoming"})`,g.theirsContent,"var(--nice-color-primary, #3b82f6)",()=>G(g.id,"theirs"))]}):null,v=()=>D!==g?.id?null:e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:e.jsxs("div",{style:{width:"80%",maxWidth:800,background:"var(--nice-text-primary, #1f2937)",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-text, #374151)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontWeight:500},children:[e.jsx(n.oa,{name:"edit",size:14})," Edit Resolution"]}),e.jsx("button",{onClick:()=>K(null),"aria-label":"Close editor",style:{background:"transparent",border:"none",color:"var(--nice-text-muted, #9ca3af)",cursor:"pointer",fontSize:18},children:e.jsx(n.oa,{name:"close",size:18})})]}),e.jsx("textarea",{value:Z,onChange:s=>$(s.target.value),style:{width:"100%",height:300,padding:16,fontFamily:"monospace",fontSize:13,background:"var(--nice-bg-canvas, #0d1117)",color:"var(--nice-text-primary, #e6edf3)",border:"none",resize:"none"}}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-text, #374151)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>K(null),style:{padding:"8px 16px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:L,style:{padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer"},children:"Save Changes"})]})]})});return e.jsxs("div",{className:`nice-git-conflict-resolver ${m||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:V==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-primary, #ffffff)",color:V==="dark"?"var(--nice-text-primary, #e6edf3)":"var(--nice-text-primary, #1f2937)",fontFamily:"system-ui, sans-serif",position:"relative",...y},"data-testid":R,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:V==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.oa,{name:"warning",size:18}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:h.path}),e.jsxs("div",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:[N.length," conflict(s) • ",j," resolved • ",S," ","remaining"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:A,style:{padding:"6px 12px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer"},children:"Cancel"}),e.jsxs("button",{onClick:F,disabled:S>0,style:{padding:"6px 12px",background:S>0?"var(--nice-text-secondary, #374151)":"var(--nice-color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:S>0?"not-allowed":"pointer",opacity:S>0?.5:1,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"check",size:14})," Save Resolved"]})]})]}),k&&e.jsxs("div",{style:{display:"flex",gap:24,padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:V==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",fontSize:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:"← Ours:"}),e.jsx("span",{children:k.oursCommit.branch}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #8b949e)",fontFamily:"monospace"},children:["(",k.oursCommit.shortId,")"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{color:"var(--nice-color-primary, #3b82f6)"},children:"→ Theirs:"}),e.jsx("span",{children:k.theirsCommit.branch}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #8b949e)",fontFamily:"monospace"},children:["(",k.theirsCommit.shortId,")"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:V==="dark"?"var(--nice-text-primary, #1f2937)":"var(--nice-bg-secondary, #f0f0f0)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>I("prev"),disabled:_===0,style:{padding:"4px 8px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",cursor:_===0?"not-allowed":"pointer",opacity:_===0?.5:1},children:"← Prev"}),e.jsxs("span",{style:{padding:"0 8px"},children:["Conflict ",_+1," of ",N.length,g?.resolved&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginLeft:8,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(n.oa,{name:"check",size:14})," Resolved"]})]}),e.jsx("button",{onClick:()=>I("next"),disabled:_===N.length-1,style:{padding:"4px 8px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",cursor:_===N.length-1?"not-allowed":"pointer",opacity:_===N.length-1?.5:1},children:"Next →"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>w("ours"),disabled:S===0,style:{padding:"4px 10px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",fontSize:11,cursor:S===0?"not-allowed":"pointer",opacity:S===0?.5:1},children:"Accept All Ours"}),e.jsx("button",{onClick:()=>w("theirs"),disabled:S===0,style:{padding:"4px 10px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",fontSize:11,cursor:S===0?"not-allowed":"pointer",opacity:S===0?.5:1},children:"Accept All Theirs"})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[g&&!g.resolved&&e.jsxs(e.Fragment,{children:[z==="inline"&&c(),z==="split"&&a(),z==="three-way"&&x()]}),g?.resolved&&e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(n.oa,{name:"check",size:48}),e.jsx("span",{style:{fontSize:18},children:"Conflict Resolved"}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #8b949e)",fontSize:13},children:["Resolution: ",g.resolution]}),e.jsxs("button",{onClick:()=>T(s=>s.map(B=>B.id===g.id?{...B,resolved:!1,resolution:void 0}:B)),style:{padding:"8px 16px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"reply",size:14})," Re-resolve"]})]})]}),g&&!g.resolved&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,padding:"12px 16px",borderTop:"1px solid var(--nice-border, #30363d)",background:V==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsxs("button",{onClick:()=>G(g.id,"ours"),style:{padding:"8px 20px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"check",size:14})," Accept Ours"]}),e.jsxs("button",{onClick:()=>G(g.id,"theirs"),style:{padding:"8px 20px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"check",size:14})," Accept Theirs"]}),e.jsxs("button",{onClick:()=>G(g.id,"both"),style:{padding:"8px 20px",background:"var(--nice-color-accent, #8b5cf6)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"shuffle",size:14})," Accept Both"]}),e.jsxs("button",{onClick:re,style:{padding:"8px 20px",background:"var(--nice-color-warning, #f59e0b)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"edit",size:14})," Edit Manually"]})]}),v()]})},Ge=Object.freeze(Object.defineProperty({__proto__:null,NiceGitConflictResolver:Ce},Symbol.toStringTag,{value:"Module"})),pe={"pre-commit":{title:"Pre-commit",description:"Runs before commit is created. Good for linting and formatting.",icon:"check"},"prepare-commit-msg":{title:"Prepare Commit Message",description:"Runs before commit message editor opens. Can modify default message.",icon:"edit"},"commit-msg":{title:"Commit Message",description:"Validates commit message format (e.g., conventional commits).",icon:"message"},"post-commit":{title:"Post-commit",description:"Runs after commit is created. Good for notifications.",icon:"upload"},"pre-push":{title:"Pre-push",description:"Runs before push. Good for running tests.",icon:"rocket"},"pre-rebase":{title:"Pre-rebase",description:"Runs before rebase starts.",icon:"shuffle"},"post-merge":{title:"Post-merge",description:"Runs after merge completes. Good for dependency updates.",icon:"link"},"post-checkout":{title:"Post-checkout",description:"Runs after checkout completes.",icon:"download"},"pre-auto-gc":{title:"Pre-auto GC",description:"Runs before automatic garbage collection.",icon:"trash"}},qe=[{id:"eslint-staged",name:"ESLint (staged files)",description:"Run ESLint on staged JavaScript/TypeScript files",icon:"search",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:"edit",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:"flask",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:"book",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:"clipboard",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:"lock",category:"security",hook:"pre-commit",actions:[{type:"custom",name:"Detect Secrets",command:"npx secretlint",runOn:"staged",enabled:!0,failOnError:!0}]}],ze=({hooks:h,defaultHooks:k,templates:z=qe,manager:E="husky",repoPath:O,selectedHook:U,onHookChange:V,onHooksChange:W,onHookToggle:M,onActionAdd:H,onActionRemove:Y,onActionUpdate:A,onInstall:m,onUninstall:y,onExport:R,className:N,style:T,"data-testid":_="nice-git-hooks"})=>{const P=h!==void 0&&W!==void 0,D=i.useRef([]),K=i.useCallback(r=>{const o=D.current;D.current=r,V&&r.filter(u=>!o.includes(u)).forEach(u=>V(u)),W?.(r)},[V,W]),[Z,$]=n.Vu({value:P?h:void 0,defaultValue:P?k:k??h,fallbackValue:[],onChange:K,componentName:"NiceGitHooks"});D.current=Z;const[S,j]=i.useState(U||null),[g,G]=i.useState(!1),[w,I]=i.useState(null),[re,L]=i.useState(!1),F=i.useMemo(()=>Z.find(r=>r.type===S),[Z,S]),ee=i.useCallback((r,o)=>{$(u=>u.map(f=>f.type===r?{...f,enabled:o}:f)),M?.(r,o)},[M,$]),c=i.useCallback(r=>{if(!S)return;const o=r?r.actions.map((u,f)=>({...u,id:crypto.randomUUID(),order:(F?.actions.length||0)+f})):[{id:crypto.randomUUID(),type:"custom",name:"New Action",command:'echo "Hello"',order:F?.actions.length||0,enabled:!0,failOnError:!0}];$(u=>u.map(f=>f.type===S?{...f,actions:[...f.actions,...o]}:f)),o.forEach(u=>H?.(S,u)),G(!1)},[S,F,H,$]),a=i.useCallback(r=>{S&&($(o=>o.map(u=>u.type===S?{...u,actions:u.actions.filter(f=>f.id!==r)}:u)),Y?.(S,r))},[S,Y,$]),x=i.useCallback(r=>{S&&($(o=>o.map(u=>u.type===S?{...u,actions:u.actions.map(f=>f.id===r.id?r:f)}:u)),I(null),A?.(S,r))},[S,A,$]),v=i.useCallback((r,o)=>{if(!F)return;const u=[...F.actions],f=u.findIndex(p=>p.id===r);if(f===-1)return;const q=o==="up"?f-1:f+1;q<0||q>=u.length||([u[f],u[q]]=[u[q],u[f]],u.forEach((p,C)=>p.order=C),$(p=>p.map(C=>C.type===S?{...C,actions:u}:C)))},[F,S,$]),s=i.useCallback(r=>{const o=["#!/bin/sh",""];return r.verbose&&o.push("set -x"),o.push("# Generated by NiceGitHooks",`# Hook: ${r.type}`,""),r.actions.forEach(u=>{if(!u.enabled){o.push(`# [DISABLED] ${u.name}`);return}if(o.push(`# ${u.name}`),u.condition){const{type:q,operator:p,value:C}=u.condition;q==="branch"?(o.push("BRANCH=$(git rev-parse --abbrev-ref HEAD)"),p==="equals"?o.push(`if [ "$BRANCH" != "${C}" ]; then exit 0; fi`):p==="matches"&&o.push(`if ! echo "$BRANCH" | grep -q "${C}"; then exit 0; fi`)):q==="env"&&o.push(`if [ -z "$${C}" ]; then exit 0; fi`)}let f=u.command;u.runOn==="staged"&&u.filePatterns?.length&&(u.filePatterns.map(q=>`'${q}'`).join(" "),f=`git diff --cached --name-only --diff-filter=ACM | grep -E "${u.filePatterns.join("|")}" | xargs ${f}`),o.push(f),u.failOnError&&(o.push("if [ $? -ne 0 ]; then"),o.push(` echo "❌ ${u.name} failed""`),o.push(" exit 1"),o.push("fi")),o.push("")}),o.push("exit 0"),o.join(`
|
|
9
|
+
`)},[]),B=r=>({lint:"search",test:"flask",format:"edit",typecheck:"book",build:"settings",custom:"settings"})[r],b=()=>w?e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:e.jsxs("div",{style:{width:"90%",maxWidth:600,background:"var(--nice-text-primary, #1f2937)",borderRadius:12,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-text, #374151)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontWeight:500,fontSize:16,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"edit",size:16})," Edit Action"]}),e.jsx("button",{onClick:()=>I(null),"aria-label":"Close",style:{background:"none",border:"none",color:"var(--nice-text-muted, #9ca3af)",cursor:"pointer",fontSize:20},children:e.jsx(n.oa,{name:"close",size:18})})]}),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:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:"Name"}),e.jsx("input",{type:"text",value:w.name,onChange:r=>I({...w,name:r.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--nice-bg-primary, #fff)"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:"Type"}),e.jsxs("select",{value:w.type,onChange:r=>I({...w,type:r.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--nice-bg-primary, #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:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:"Command"}),e.jsx("textarea",{value:w.command,onChange:r=>I({...w,command:r.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--nice-bg-primary, #fff)",fontFamily:"monospace",minHeight:80,resize:"vertical"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:"Run On"}),e.jsxs("select",{value:w.runOn||"all",onChange:r=>I({...w,runOn:r.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--nice-bg-primary, #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:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:"File Patterns (comma-separated)"}),e.jsx("input",{type:"text",value:w.filePatterns?.join(", ")||"",onChange:r=>I({...w,filePatterns:r.target.value.split(",").map(o=>o.trim()).filter(Boolean)}),placeholder:"*.ts, *.tsx, *.js",style:{width:"100%",padding:"8px 12px",background:"var(--nice-text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--nice-bg-primary, #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:w.enabled,onChange:r=>I({...w,enabled:r.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:w.failOnError,onChange:r=>I({...w,failOnError:r.target.checked})}),e.jsx("span",{style:{fontSize:13},children:"Fail on error"})]})]})]}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-text, #374151)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>I(null),style:{padding:"8px 16px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:()=>x(w),style:{padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer"},children:"Save"})]})]})}):null,l=()=>{if(!re||!F)return null;const r=s(F);return e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"var(--nice-overlay-80, 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:"var(--nice-text-primary, #1f2937)",borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-text, #374151)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontWeight:500,fontSize:16,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"file",size:16})," Script Preview: ",F.type]}),e.jsx("button",{onClick:()=>L(!1),"aria-label":"Close",style:{background:"none",border:"none",color:"var(--nice-text-muted, #9ca3af)",cursor:"pointer",fontSize:20},children:e.jsx(n.oa,{name:"close",size:18})})]}),e.jsx("pre",{style:{flex:1,margin:0,padding:20,background:"var(--nice-bg-canvas, #0d1117)",color:"var(--nice-text-primary, #e6edf3)",fontFamily:"monospace",fontSize:13,overflow:"auto"},children:r}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-text, #374151)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(r)},style:{padding:"8px 16px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"clipboard",size:14})," Copy"]}),e.jsx("button",{onClick:()=>L(!1),style:{padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer"},children:"Close"})]})]})})};return e.jsxs("div",{className:`nice-git-hooks ${N||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-canvas, #0d1117)",color:"var(--nice-text-primary, #e6edf3)",fontFamily:"system-ui, sans-serif",...T},"data-testid":_,children:[e.jsxs("div",{style:{width:280,borderRight:"1px solid var(--nice-border, #30363d)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",fontWeight:500,display:"flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"link",size:16})," Git Hooks"]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:Object.entries(pe).map(([r,o])=>{const u=Z.find(p=>p.type===r),f=S===r,q=u?.actions.length||0;return e.jsxs("div",{onClick:()=>j(r),style:{padding:"12px 16px",cursor:"pointer",background:f?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderLeft:f?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.oa,{name:o.icon,size:18}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:500},children:o.title}),e.jsxs("div",{style:{fontSize:11,color:"var(--nice-text-muted, #8b949e)"},children:[q," action",q!==1?"s":""]})]}),e.jsx("button",{onClick:p=>{p.stopPropagation(),ee(r,!u?.enabled)},style:{width:36,height:20,borderRadius:10,background:u?.enabled?"var(--nice-color-success, #22c55e)":"var(--nice-text-secondary, #374151)",border:"none",cursor:"pointer",position:"relative",transition:"background 0.2s"},children:e.jsx("div",{style:{position:"absolute",top:2,left:u?.enabled?18:2,width:16,height:16,borderRadius:"50%",background:"var(--nice-bg-primary, #fff)",transition:"left 0.2s"}})})]},r)})}),e.jsx("div",{style:{padding:12,borderTop:"1px solid var(--nice-border, #30363d)",display:"flex",gap:8},children:e.jsx("button",{onClick:()=>R?.(Z,"husky"),style:{flex:1,padding:"8px 12px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",fontSize:12,cursor:"pointer"},children:"Export"})})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:F?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-border, #30363d)",background:"var(--nice-bg-elevated, #161b22)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8},children:[e.jsx(n.oa,{name:pe[F.type].icon,size:24}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:18,fontWeight:500},children:pe[F.type].title}),e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:pe[F.type].description})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12},children:[e.jsxs("button",{onClick:()=>L(!0),style:{padding:"6px 12px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",fontSize:12,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"file",size:14})," Preview Script"]}),e.jsxs("button",{onClick:()=>m?.(F.type),style:{padding:"6px 12px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",fontSize:12,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"download",size:14})," Install"]}),e.jsxs("button",{onClick:()=>y?.(F.type),style:{padding:"6px 12px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",fontSize:12,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"close",size:14})," Uninstall"]})]})]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:F.actions.length===0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:40,color:"var(--nice-text-muted, #8b949e)"},children:[e.jsx(n.oa,{name:"box",size:48}),e.jsx("span",{style:{marginTop:16},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:F.actions.sort((r,o)=>r.order-o.order).map((r,o)=>e.jsxs("div",{style:{padding:16,background:"var(--nice-bg-elevated, #161b22)",borderRadius:8,border:"1px solid var(--nice-border, #30363d)",opacity:r.enabled?1:.5},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.oa,{name:B(r.type),size:20}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:r.name}),e.jsx("code",{style:{fontSize:11,color:"var(--nice-text-muted, #8b949e)",background:"var(--nice-bg-canvas, #0d1117)",padding:"2px 6px",borderRadius:4},children:r.command})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>v(r.id,"up"),disabled:o===0,"aria-label":"Move up",style:{padding:"4px 8px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",cursor:o===0?"not-allowed":"pointer",opacity:o===0?.5:1},children:e.jsx(n.oa,{name:"arrow-up",size:14})}),e.jsx("button",{onClick:()=>v(r.id,"down"),disabled:o===F.actions.length-1,"aria-label":"Move down",style:{padding:"4px 8px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",cursor:o===F.actions.length-1?"not-allowed":"pointer",opacity:o===F.actions.length-1?.5:1},children:e.jsx(n.oa,{name:"arrow-down",size:14})}),e.jsx("button",{onClick:()=>I(r),"aria-label":"Edit action",style:{padding:"4px 8px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",cursor:"pointer"},children:e.jsx(n.oa,{name:"edit",size:14})}),e.jsx("button",{onClick:()=>a(r.id),"aria-label":"Remove action",style:{padding:"4px 8px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",cursor:"pointer"},children:e.jsx(n.oa,{name:"trash",size:14})})]})]}),r.filePatterns&&r.filePatterns.length>0&&e.jsxs("div",{style:{marginTop:8,fontSize:11,color:"var(--nice-text-muted, #8b949e)"},children:["Files: ",r.filePatterns.join(", ")]}),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[r.runOn&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"var(--nice-color-primary-active, #1d4ed8)",borderRadius:4},children:r.runOn}),r.failOnError&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"var(--nice-color-error, #b91c1c)",borderRadius:4},children:"fail on error"})]})]},r.id))})}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-border, #30363d)",display:"flex",gap:8},children:[e.jsxs("button",{onClick:()=>G(!g),style:{padding:"10px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"plus",size:14})," Add from Template"]}),e.jsxs("button",{onClick:()=>c(),style:{padding:"10px 16px",background:"var(--nice-text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"settings",size:14})," Custom Action"]})]}),g&&e.jsxs("div",{style:{position:"absolute",bottom:70,left:300,width:400,maxHeight:300,overflow:"auto",background:"var(--nice-text-primary, #1f2937)",border:"1px solid var(--nice-text, #374151)",borderRadius:8,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",zIndex:50},children:[z.filter(r=>r.hook===S).map(r=>e.jsxs("div",{onClick:()=>c(r),style:{padding:12,cursor:"pointer",borderBottom:"1px solid var(--nice-text, #374151)",display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.oa,{name:r.icon,size:24}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:r.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #8b949e)"},children:r.description})]})]},r.id)),z.filter(r=>r.hook===S).length===0&&e.jsx("div",{style:{padding:20,textAlign:"center",color:"var(--nice-text-muted, #8b949e)"},children:"No templates for this hook type"})]})]}):e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #8b949e)"},children:[e.jsx(n.oa,{name:"link",size:64}),e.jsx("span",{style:{fontSize:18,marginTop:16},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"})]})}),b(),l()]})},Ve=Object.freeze(Object.defineProperty({__proto__:null,NiceGitHooks:ze},Symbol.toStringTag,{value:"Module"})),he=i.forwardRef(({menubar:h,toolbar:k,sidebar:z,sidebarWidth:E=220,rightSidebar:O,rightSidebarWidth:U=280,children:V,bottomPanel:W,bottomPanelHeight:M,statusBar:H,height:Y="100%",flush:A=!1,className:m,style:y,id:R,"data-testid":N},T)=>{const _=`nice-app-shell__sidebar${A?" nice-app-shell__sidebar--flush":""}`;return e.jsxs("div",{ref:T,id:R,"data-testid":N,className:`nice-app-shell${m?` ${m}`:""}`,style:{height:Y,...y},children:[h!=null&&e.jsx("div",{className:`nice-app-shell__menubar${A?" nice-app-shell__chrome--flush":""}`,children:h}),k!=null&&e.jsx("div",{className:`nice-app-shell__toolbar${A?" nice-app-shell__chrome--flush":""}`,children:k}),e.jsxs("div",{className:"nice-app-shell__body",children:[z!=null&&e.jsx("aside",{className:_,style:A?void 0:{width:E},children:z}),e.jsx("main",{className:"nice-app-shell__content",children:V}),O!=null&&e.jsx("aside",{className:`${_} nice-app-shell__sidebar--right`,style:A?void 0:{width:U},children:O})]}),W!=null&&e.jsx("div",{className:`nice-app-shell__bottom${A?" nice-app-shell__bottom--flush":""}`,style:M!=null?{height:M}:void 0,children:W}),H!=null&&e.jsx("div",{className:"nice-app-shell__status",children:H})]})});he.displayName="NiceAppShell";const Ue={id:"",name:"",repository:"",triggers:[],stages:[],variables:[],secrets:[],isEnabled:!0,createdAt:new Date(0),updatedAt:new Date(0)},Ye=[],Je=[{target:".nice-pipeline-editor",titleKey:"tutorial.pipelineEditor.intro.title",title:"Pipeline editor",contentKey:"tutorial.pipelineEditor.intro.content",content:"Build a CI/CD pipeline from stages, jobs and steps; set triggers, variables and secrets; then validate, save and run it.",placement:"auto"}],Xe={push:"upload",pull_request:"shuffle",schedule:"clock",manual:"cursor",tag:"tag",workflow_dispatch:"zap"},Ke={script:"file",action:"settings",checkout:"download",upload_artifact:"upload",download_artifact:"download",docker:"box",deploy:"rocket"},we=({pipeline:h,defaultPipeline:k,templates:z,runners:E=Ye,environments:O,onPipelineChange:U,onStageAdd:V,onStageRemove:W,onStageMove:M,onJobAdd:H,onJobRemove:Y,onStepAdd:A,onStepRemove:m,onVariableAdd:y,onVariableRemove:R,onSecretAdd:N,onSecretRemove:T,onTemplateApply:_,onSave:P,onRun:D,onValidate:K,tutorial:Z,className:$,style:S,"data-testid":j})=>{const[g,G]=n.Vu({value:h,defaultValue:k,fallbackValue:Ue,onChange:U,componentName:"NicePipelineEditor"}),[w,I]=i.useState("visual"),[re,L]=i.useState(null),[F,ee]=i.useState(null),[c,a]=i.useState(!1),x=g.stages.find(r=>r.id===re),v=x?.jobs.find(r=>r.id===F),s=i.useMemo(()=>{const r=[];return r.push(`name: ${g.name}`),r.push(""),r.push("on:"),g.triggers.forEach(o=>{r.push(` ${o}:`),(o==="push"||o==="pull_request")&&(r.push(" branches:"),r.push(` - ${g.branch||"main"}`))}),r.push(""),g.variables.length>0&&(r.push("env:"),g.variables.filter(o=>!o.isSecret).forEach(o=>{r.push(` ${o.name}: ${o.value}`)}),r.push("")),r.push("jobs:"),g.stages.forEach(o=>{o.jobs.forEach(u=>{r.push(` ${o.name.toLowerCase().replace(/\s+/g,"-")}-${u.name.toLowerCase().replace(/\s+/g,"-")}:`),r.push(` name: ${u.name}`),u.runner&&r.push(` runs-on: ${u.runner}`),o.dependsOn?.length&&r.push(` needs: [${o.dependsOn.join(", ")}]`),r.push(" steps:"),u.steps.forEach(f=>{f.type==="checkout"?r.push(" - uses: actions/checkout@v4"):f.type==="action"&&f.action?(r.push(` - uses: ${f.action}${f.actionVersion?`@${f.actionVersion}`:""}`),f.with&&Object.keys(f.with).length>0&&(r.push(" with:"),Object.entries(f.with).forEach(([q,p])=>{r.push(` ${q}: ${p}`)}))):f.type==="script"&&f.script&&(r.push(` - name: ${f.name}`),r.push(" run: |"),f.script.split(`
|
|
10
|
+
`).forEach(q=>{r.push(` ${q}`)}))})})}),r.join(`
|
|
11
|
+
`)},[g]),B=e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx(n.oa,{name:"settings",size:20}),e.jsx("input",{type:"text",value:g.name,onChange:r=>G({...g,name:r.target.value}),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:"14px",fontWeight:500,width:"250px"}})]}),e.jsx("div",{style:{flex:1}}),e.jsx(n.Ql,{steps:n.Yl(Z,Je)}),e.jsx("button",{onClick:()=>a(!0),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"clipboard",size:14})," Templates"]})}),e.jsx("button",{onClick:K,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"check",size:14})," Validate"]})}),e.jsx("button",{onClick:P,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"12px",fontWeight:500},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"save",size:14})," Save"]})}),e.jsx("button",{onClick:D,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"12px",fontWeight:500},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"play",size:14})," Run Pipeline"]})})]}),b=e.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #1e1e1e)"},children:[{id:"visual",icon:"palette",label:"Visual Editor"},{id:"yaml",icon:"edit",label:"YAML"},{id:"triggers",icon:"zap",label:"Triggers"},{id:"variables",icon:"settings",label:"Variables"}].map(r=>e.jsx("button",{onClick:()=>I(r.id),style:{padding:"10px 20px",border:"none",background:w===r.id?"var(--nice-bg-elevated, #1e1e1e)":"transparent",color:w===r.id?"var(--nice-bg-primary, #fff)":"var(--nice-text-muted, #888)",cursor:"pointer",fontSize:"12px",borderBottom:w===r.id?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:r.icon,size:14})," ",r.label]})},r.id))}),l=e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",height:"100%"},children:[w==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{width:"300px",borderRight:"1px solid var(--nice-border-color, #333)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontWeight:500,fontSize:"13px"},children:"Stages"}),e.jsx("button",{onClick:V,style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"+ Add Stage"})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"8px"},children:[g.stages.map((r,o)=>e.jsxs("div",{children:[o>0&&e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"4px",color:"var(--nice-bg-tertiary, #444)"},children:e.jsx(n.oa,{name:"arrow-down",size:14})}),e.jsxs("div",{onClick:()=>{L(r.id),ee(null)},style:{padding:"12px",background:re===r.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:re===r.id?"1px solid var(--nice-primary, #3b82f6)":"1px solid var(--nice-border-color, #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:r.name}),e.jsxs("div",{style:{display:"flex",gap:"4px"},children:[o>0&&e.jsx("button",{"aria-label":"Move stage up",onClick:u=>{u.stopPropagation(),M(r.id,"up")},style:{padding:"2px 4px",background:"var(--nice-bg-tertiary, #333)",border:"none",borderRadius:"2px",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(n.oa,{name:"arrow-up",size:12})}),o<g.stages.length-1&&e.jsx("button",{"aria-label":"Move stage down",onClick:u=>{u.stopPropagation(),M(r.id,"down")},style:{padding:"2px 4px",background:"var(--nice-bg-tertiary, #333)",border:"none",borderRadius:"2px",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(n.oa,{name:"arrow-down",size:12})}),e.jsx("button",{"aria-label":"Remove stage",onClick:u=>{u.stopPropagation(),W(r.id)},style:{padding:"2px 4px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:"2px",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(n.oa,{name:"close",size:12})})]})]}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:[r.jobs.length," job",r.jobs.length!==1?"s":""," •"," ",r.parallel?"Parallel":"Sequential"]})]})]},r.id)),g.stages.length===0&&e.jsx("div",{style:{textAlign:"center",color:"var(--nice-text-muted, #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:x?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",justifyContent:"space-between",alignItems:"center",background:"var(--nice-bg-elevated, #252525)"},children:[e.jsxs("span",{style:{fontWeight:500},children:["Stage: ",x.name]}),e.jsx("button",{onClick:()=>H(x.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-bg-primary, #fff)",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 var(--nice-border-color, #333)",overflow:"auto",padding:"8px"},children:x.jobs.map(r=>e.jsxs("div",{onClick:()=>ee(r.id),style:{padding:"10px",marginBottom:"4px",background:F===r.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--nice-bg-elevated, #252525)",borderRadius:"6px",cursor:"pointer",border:F===r.id?"1px solid var(--nice-primary, #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:r.name}),e.jsx("button",{"aria-label":"Remove job",onClick:o=>{o.stopPropagation(),Y(x.id,r.id)},style:{padding:"2px 4px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:"2px",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"9px"},children:e.jsx(n.oa,{name:"close",size:11})})]}),e.jsxs("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)",marginTop:"4px"},children:[r.steps.length," steps"]})]},r.id))}),v?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: ",v.name]}),e.jsx("button",{onClick:()=>A(x.id,v.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-accent, #8b5cf6)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"+ Add Step"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"12px",marginBottom:"16px",padding:"12px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)",display:"block",marginBottom:"4px"},children:"Runner"}),e.jsxs("select",{style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"",children:"Select runner..."}),E.map(r=>e.jsxs("option",{value:r.id,children:[r.name," (",r.os,")"]},r.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)",display:"block",marginBottom:"4px"},children:"Environment"}),e.jsxs("select",{style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"",children:"No environment"}),O.map(r=>e.jsxs("option",{value:r.id,children:[r.name,r.protection?" (protected)":""]},r.id))]})]})]}),v.steps.map((r,o)=>e.jsxs("div",{style:{marginBottom:"8px",padding:"12px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[e.jsx(n.oa,{name:Ke[r.type],size:16}),e.jsx("span",{style:{fontSize:"12px",fontWeight:500,flex:1},children:r.name}),e.jsx("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)",padding:"2px 6px",background:"var(--nice-bg-tertiary, #333)",borderRadius:"4px"},children:r.type}),e.jsx("button",{"aria-label":"Remove step",onClick:()=>m(x.id,v.id,r.id),style:{padding:"2px 6px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:"4px",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(n.oa,{name:"close",size:12})})]}),r.type==="script"&&r.script&&e.jsx("pre",{style:{margin:0,padding:"8px",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:"4px",fontSize:"10px",fontFamily:"monospace",overflow:"auto"},children:r.script}),r.type==="action"&&e.jsxs("div",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:["uses: ",r.action,r.actionVersion&&`@${r.actionVersion}`]})]},r.id)),v.steps.length===0&&e.jsx("div",{style:{textAlign:"center",color:"var(--nice-text-muted, #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:"var(--nice-text-muted, #666)"},children:"Select a job to edit its steps"})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #666)"},children:"Select a stage to view its jobs"})})]}),w==="yaml"&&e.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:e.jsx("pre",{style:{margin:0,padding:"16px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px",fontFamily:"monospace",fontSize:"12px",lineHeight:"1.6",whiteSpace:"pre-wrap"},children:s})}),w==="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(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"16px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:g.triggers.includes(r)?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:[e.jsx("input",{type:"checkbox",checked:g.triggers.includes(r),onChange:o=>{const u=o.target.checked?[...g.triggers,r]:g.triggers.filter(f=>f!==r);G({...g,triggers:u})}}),e.jsx(n.oa,{name:Xe[r],size:24}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:"13px"},children:r.replace("_"," ")}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:[r==="push"&&"Run on push to branch",r==="pull_request"&&"Run on PR/MR",r==="schedule"&&"Run on schedule (cron)",r==="manual"&&"Manual trigger only",r==="tag"&&"Run on tag push",r==="workflow_dispatch"&&"API/UI trigger"]})]})]},r))})]}),w==="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:y,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"+ Add Variable"}),e.jsx("button",{onClick:N,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-warning, #f59e0b)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.oa,{name:"lock",size:12})," Add Secret"]})})]})]}),e.jsxs("div",{style:{background:"var(--nice-bg-elevated, #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:"var(--nice-bg-elevated, #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:g.variables.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",fontFamily:"monospace"},children:r.name}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)"},children:r.isSecret?"••••••••":r.value}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",textAlign:"center"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",borderRadius:"4px",background:r.isSecret?"var(--nice-warning-tint-15, #f59e0b22)":"var(--nice-primary-tint-15, #3b82f622)",color:r.isSecret?"var(--nice-color-warning, #f59e0b)":"var(--nice-color-primary, #3b82f6)",fontSize:"10px"},children:[r.isSecret&&e.jsx(n.oa,{name:"lock",size:10}),r.isSecret?"Secret":"Variable"]})}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",textAlign:"right"},children:e.jsx("button",{onClick:()=>R(r.name),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Remove"})})]},r.name))})]}),g.variables.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:"12px"},children:"No variables defined"})]})]})]});return e.jsxs(e.Fragment,{children:[e.jsx(he,{className:`nice-pipeline-editor ${$||""}`,style:{background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",...S},flush:!0,menubar:B,toolbar:b,"data-testid":j,children:l}),c&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"600px",maxHeight:"80vh",background:"var(--nice-bg-elevated, #252525)",borderRadius:"12px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px",borderBottom:"1px solid var(--nice-border-color, #333)"},children:[e.jsx("span",{style:{fontWeight:600},children:"Pipeline Templates"}),e.jsx("button",{"aria-label":"Close templates",onClick:()=>a(!1),style:{background:"none",border:"none",color:"var(--nice-text-muted, #888)",cursor:"pointer",fontSize:"18px"},children:e.jsx(n.oa,{name:"close",size:18})})]}),e.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",padding:"16px"},children:z.map(r=>e.jsxs("div",{onClick:()=>{_(r),a(!1)},style:{display:"flex",alignItems:"center",gap:"16px",padding:"16px",marginBottom:"8px",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:"8px",cursor:"pointer"},children:[e.jsx(n.oa,{name:r.icon,size:32}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:"14px",marginBottom:"4px"},children:r.name}),e.jsx("div",{style:{fontSize:"12px",color:"var(--nice-text-muted, #888)"},children:r.description}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #666)",marginTop:"4px"},children:r.category})]})]},r.id))})]})})]})},Qe=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineEditor:we},Symbol.toStringTag,{value:"Module"})),Ze=[],xe={queued:{color:"var(--nice-text-muted, #6b7280)",icon:"clock",label:"Queued"},pending:{color:"var(--nice-text-muted, #6b7280)",icon:"clock",label:"Pending"},waiting:{color:"var(--nice-color-warning, #f59e0b)",icon:"pause",label:"Waiting"},in_progress:{color:"var(--nice-color-primary, #3b82f6)",icon:"refresh",label:"In Progress"},running:{color:"var(--nice-color-primary, #3b82f6)",icon:"refresh",label:"Running"},completed:{color:"var(--nice-color-success, #22c55e)",icon:"check",label:"Completed"},success:{color:"var(--nice-color-success, #22c55e)",icon:"check",label:"Success"},failed:{color:"var(--nice-color-error, #ef4444)",icon:"close",label:"Failed"},failure:{color:"var(--nice-color-error, #ef4444)",icon:"close",label:"Failed"},cancelled:{color:"var(--nice-text-muted, #6b7280)",icon:"close",label:"Cancelled"},skipped:{color:"var(--nice-text-muted, #6b7280)",icon:"skip-forward",label:"Skipped"}},Re=({runs:h=Ze,stats:k,selectedRunId:z,onRunSelect:E,onCancel:O,onRerun:U,onRerunFromStage:V,onDownloadArtifact:W,onDownloadLogs:M,onApprove:H,onReject:Y,className:A,style:m,"data-testid":y})=>{const[R,N]=i.useState("all"),[T,_]=i.useState("all"),[P,D]=i.useState(new Set),[K,Z]=i.useState(new Set),[$,S]=i.useState(null),j=h.find(c=>c.id===z),g=i.useMemo(()=>h.filter(c=>!(R!=="all"&&c.status!==R||T!=="all"&&c.branch!==T)),[h,R,T]),G=i.useMemo(()=>[...new Set(h.map(c=>c.branch))],[h]),w=c=>{if(!c)return"-";const a=Math.floor(c/1e3);if(a<60)return`${a}s`;const x=Math.floor(a/60),v=a%60;if(x<60)return`${x}m ${v}s`;const s=Math.floor(x/60),B=x%60;return`${s}h ${B}m`},I=c=>c?new Date(c).toLocaleString():"-",re=c=>c<1024?`${c} B`:c<1024*1024?`${(c/1024).toFixed(1)} KB`:`${(c/(1024*1024)).toFixed(1)} MB`,L=c=>{D(a=>{const x=new Set(a);return x.has(c)?x.delete(c):x.add(c),x})},F=c=>{Z(a=>{const x=new Set(a);return x.has(c)?x.delete(c):x.add(c),x})},ee=()=>{if(!$||!j)return[];for(const c of j.stages)for(const a of c.jobs)if(a.id===$.jobId)return a.steps.find(v=>v.id===$.stepId)?.logs||[];return[]};return e.jsxs("div",{className:`nice-pipeline-monitor ${A||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",...m},"data-testid":y,children:[e.jsxs("div",{style:{width:"400px",borderRight:"1px solid var(--nice-border-color, #333)",display:"flex",flexDirection:"column"},children:[k&&e.jsx("div",{style:{padding:"16px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #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:"var(--nice-color-primary, #3b82f6)"},children:k.totalRuns}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:"Total Runs"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:[k.successRate.toFixed(0),"%"]}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:"Success Rate"})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--nice-color-warning, #f59e0b)"},children:w(k.avgDuration)}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:"Avg Duration"})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:k.failedRuns}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:"Failed"})]})]})}),e.jsxs("div",{style:{padding:"12px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:"8px"},children:[e.jsxs("select",{value:R,onChange:c=>N(c.target.value),style:{flex:1,padding:"6px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",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:T,onChange:c=>_(c.target.value),style:{flex:1,padding:"6px",borderRadius:"4px",border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-bg-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"all",children:"All Branches"}),G.map(c=>e.jsx("option",{value:c,children:c},c))]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[g.map(c=>{const a=xe[c.status];return e.jsxs("div",{onClick:()=>E(c.id),style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",cursor:"pointer",background:z===c.id?"var(--nice-primary-tint-10, 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:{display:"inline-flex",color:a.color,animation:c.status==="in_progress"?"spin 1s linear infinite":"none"},children:e.jsx(n.oa,{name:a.icon,size:16})}),e.jsxs("span",{style:{flex:1,fontWeight:500,fontSize:"13px"},children:[c.pipelineName," #",c.runNumber]}),e.jsx("span",{style:{padding:"2px 8px",borderRadius:"4px",background:`${a.color}22`,color:a.color,fontSize:"10px"},children:a.label})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:[e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(n.oa,{name:"shuffle",size:12})," ",c.branch]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:c.commit.sha.slice(0,7)}),e.jsx("span",{children:"•"}),e.jsx("span",{children:w(c.duration)})]}),e.jsx("div",{style:{marginTop:"6px",fontSize:"11px",color:"var(--nice-text-muted, #666)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:c.commit.message})]},c.id)}),g.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:"12px"},children:"No pipeline runs match the filters"})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:j?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #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:[j.pipelineName," #",j.runNumber]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"12px",color:"var(--nice-text-muted, #888)"},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[j.commit.authorAvatar&&e.jsx("img",{src:j.commit.authorAvatar,alt:"",style:{width:"16px",height:"16px",borderRadius:"50%"}}),j.commit.author]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(n.oa,{name:"shuffle",size:12})," ",j.branch]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(n.oa,{name:"edit",size:12})," ",j.commit.sha.slice(0,7)]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[(j.status==="in_progress"||j.status==="queued"||j.status==="waiting")&&e.jsx("button",{onClick:()=>O(j.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"Cancel"}),e.jsx("button",{onClick:()=>U(j.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"Re-run"}),e.jsxs("button",{onClick:()=>M(j.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"11px",display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(n.oa,{name:"download",size:14})," Logs"]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"16px",fontSize:"12px"},children:[e.jsxs("span",{children:["Started: ",I(j.startedAt)]}),j.completedAt&&e.jsxs("span",{children:["Completed: ",I(j.completedAt)]}),e.jsxs("span",{children:["Duration: ",w(j.duration)]})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[e.jsx("div",{style:{marginBottom:"24px"},children:j.stages.map((c,a)=>{const x=xe[c.status],v=P.has(c.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>L(c.id),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:`2px solid ${x.color}44`},children:[e.jsx("span",{style:{color:"var(--nice-text-muted, #666)",display:"inline-flex"},children:e.jsx(n.oa,{name:v?"chevron-down":"chevron-right",size:14})}),e.jsx("span",{style:{display:"inline-flex",color:x.color},children:e.jsx(n.oa,{name:x.icon,size:16})}),e.jsx("span",{style:{flex:1,fontWeight:500},children:c.name}),e.jsx("span",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:w(c.duration)}),c.status==="waiting"&&H&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:s=>{s.stopPropagation(),H(j.id,c.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Approve"}),e.jsx("button",{onClick:s=>{s.stopPropagation(),Y?.(j.id,c.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Reject"})]}),e.jsx("button",{onClick:s=>{s.stopPropagation(),V(j.id,c.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Re-run from here"})]}),v&&e.jsx("div",{style:{marginLeft:"32px",marginTop:"8px"},children:c.jobs.map(s=>{const B=xe[s.status],b=K.has(s.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>F(s.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:"6px",cursor:"pointer",borderLeft:`3px solid ${B.color}`},children:[e.jsx("span",{style:{color:"var(--nice-text-muted, #666)",display:"inline-flex"},children:e.jsx(n.oa,{name:b?"chevron-down":"chevron-right",size:12})}),e.jsx("span",{style:{display:"inline-flex",color:B.color},children:e.jsx(n.oa,{name:B.icon,size:14})}),e.jsx("span",{style:{flex:1,fontSize:"12px"},children:s.name}),s.runner&&e.jsxs("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #666)",display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(n.oa,{name:"monitor",size:12})," ",s.runner]}),e.jsx("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:w(s.duration)})]}),b&&e.jsx("div",{style:{marginLeft:"24px",marginTop:"4px"},children:s.steps.map(l=>{const r=xe[l.status];return e.jsxs("div",{onClick:()=>S({jobId:s.id,stepId:l.id}),style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 10px",marginBottom:"2px",background:"transparent",borderRadius:"4px",cursor:l.logs?.length?"pointer":"default"},children:[e.jsx("span",{style:{display:"inline-flex",color:r.color},children:e.jsx(n.oa,{name:r.icon,size:12})}),e.jsx("span",{style:{flex:1,fontSize:"11px"},children:l.name}),e.jsx("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:w(l.duration)}),l.logs?.length?e.jsx("span",{style:{display:"inline-flex",color:"var(--nice-text-muted, #666)"},children:e.jsx(n.oa,{name:"file",size:10})}):null]},l.id)})})]},s.id)})}),a<j.stages.length-1&&e.jsx("div",{style:{marginLeft:"24px",padding:"4px 0",color:"var(--nice-bg-tertiary, #444)",display:"flex"},children:e.jsx(n.oa,{name:"arrow-down",size:14})})]},c.id)})}),j.artifacts.length>0&&e.jsxs("div",{style:{marginTop:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",color:"var(--nice-text-muted, #888)"},children:"Artifacts"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"8px"},children:j.artifacts.map(c=>e.jsxs("div",{onClick:()=>W(c),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer"},children:[e.jsx("span",{style:{display:"inline-flex"},children:e.jsx(n.oa,{name:"box",size:24})}),e.jsxs("div",{style:{flex:1,overflow:"hidden"},children:[e.jsx("div",{style:{fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:c.name}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:re(c.size)})]}),e.jsx("span",{style:{display:"inline-flex"},children:e.jsx(n.oa,{name:"download",size:16})})]},c.id))})]})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #666)"},children:"Select a pipeline run to view details"})}),$&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"80%",height:"80%",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontWeight:500},children:"Step Logs"}),e.jsx("button",{onClick:()=>S(null),"aria-label":"Close logs",style:{background:"none",border:"none",color:"var(--nice-text-muted, #888)",cursor:"pointer",display:"inline-flex",alignItems:"center"},children:e.jsx(n.oa,{name:"close",size:18})})]}),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:"var(--nice-text-secondary, #d4d4d4)"},children:ee().join(`
|
|
12
|
+
`)||"No logs available"})})]})}),e.jsx("style",{children:`
|
|
13
|
+
@keyframes spin {
|
|
14
|
+
from { transform: rotate(0deg); }
|
|
15
|
+
to { transform: rotate(360deg); }
|
|
16
|
+
}
|
|
17
|
+
`})]})},er=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineMonitor:Re},Symbol.toStringTag,{value:"Module"}));exports.NiceAppShell=he;exports.NiceBranchManager=ve;exports.NiceBranchManager$1=We;exports.NiceGitBlame=Se;exports.NiceGitBlame$1=Fe;exports.NiceGitConflictResolver=Ce;exports.NiceGitConflictResolver$1=Ge;exports.NiceGitDiffViewer=ke;exports.NiceGitDiffViewer$1=De;exports.NiceGitGraph=ye;exports.NiceGitGraph$1=$e;exports.NiceGitHooks=ze;exports.NiceGitHooks$1=Ve;exports.NiceMergeRequestBuilder=je;exports.NiceMergeRequestBuilder$1=Ae;exports.NicePipelineEditor=we;exports.NicePipelineEditor$1=Qe;exports.NicePipelineMonitor=Re;exports.NicePipelineMonitor$1=er;
|