@nice2dev/ui 1.2.2 → 1.3.0
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 +433 -0
- package/dist/NiceButton-CnAIqCbd.js +101 -0
- package/dist/NiceButton-DzCqkG5a.cjs +1 -0
- package/dist/NiceCodeEditor-CK6B54mu.js +1215 -0
- package/dist/NiceCodeEditor-bJReZPDO.cjs +268 -0
- package/dist/NiceColorPicker-BV3olE3M.cjs +1 -0
- package/dist/NiceColorPicker-CyY-4q89.js +552 -0
- package/dist/NiceDataGrid-BQIqitMM.cjs +10 -0
- package/dist/NiceDataGrid-C1eI6Pso.js +2267 -0
- package/dist/NiceForm-CfAPcXdX.cjs +1 -0
- package/dist/NiceForm-DfKYNQti.js +5017 -0
- package/dist/NiceGantt-TEXbAELi.js +333 -0
- package/dist/NiceGantt-s2cgt5zD.cjs +1 -0
- package/dist/NiceHtmlEditor-CDZeF_zG.cjs +10 -0
- package/dist/NiceHtmlEditor-CdWgddg3.js +901 -0
- package/dist/NiceLoginForm-DRPldHXa.js +808 -0
- package/dist/NiceLoginForm-IGLUCQUE.cjs +1 -0
- package/dist/NiceMention-CgDp0sl9.cjs +430 -0
- package/dist/NiceMention-DBvFvx71.js +11653 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-BlYhFDhP.js +80 -0
- package/dist/NiceModal-DmWz2PDM.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-D8EoXqBy.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-SN6G7t64.js +7189 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-BJS65foT.js +200 -0
- package/dist/NicePagination-D_3GfWp5.cjs +1 -0
- package/dist/NicePivotGrid-D_kRF1Dt.js +1180 -0
- package/dist/NicePivotGrid-DqluEkCI.cjs +152 -0
- package/dist/NiceSavedQueryPanel-C2Tn1cMW.js +5311 -0
- package/dist/NiceSavedQueryPanel-DDKtL1AA.cjs +586 -0
- package/dist/NiceScheduler-GJLvkXJ3.cjs +5 -0
- package/dist/NiceScheduler-UT49u2Vq.js +1710 -0
- package/dist/NiceSelect-CdUHd8rj.cjs +1 -0
- package/dist/NiceSelect-fOelG_QB.js +495 -0
- package/dist/NiceWindow-CqSsTjrS.cjs +1 -0
- package/dist/NiceWindow-DZLPhXbR.js +2223 -0
- package/dist/charts-BYQwl_GS.js +4789 -0
- package/dist/charts-C6iOu0H6.cjs +768 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-lazy-B_laOXNf.cjs +1 -0
- package/dist/core-lazy-VQEjdz0L.js +351 -0
- package/dist/data-branching-7rpktFJ-.cjs +1 -0
- package/dist/data-branching-BS0aFUMu.js +6428 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.mjs +3 -3
- package/dist/devops-CFytAJQr.cjs +18 -0
- package/dist/devops-CW8YY_zA.js +9122 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.css +1 -0
- package/dist/devops.mjs +5 -5
- package/dist/editors.cjs +1 -1
- package/dist/editors.mjs +8 -8
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +21 -16
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +262 -257
- package/dist/index.css +1 -1
- package/dist/index.d.ts +374 -20
- package/dist/index.mjs +21602 -20317
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +31 -0
- package/dist/navigation.mjs +404 -354
- package/dist/no-code-BaAI_sJR.js +8318 -0
- package/dist/no-code-oQTeAtnW.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +5 -0
- package/dist/overlays.mjs +1 -1
- package/dist/pickerCommons-BQi6IEAt.js +661 -0
- package/dist/pickerCommons-DvQptSPX.cjs +1 -0
- package/dist/style.css +7 -4
- package/package.json +4 -3
package/dist/data-branching.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./data-branching-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./data-branching-7rpktFJ-.cjs");exports.NiceDataBranchGraph=a.NiceDataBranchGraph;exports.NiceDataBranchManager=a.NiceDataBranchManager;exports.NiceDataConflictResolver=a.NiceDataConflictResolver;exports.NiceDataDiffViewer=a.NiceDataDiffViewer;exports.NiceDataMergeBuilder=a.NiceDataMergeBuilder;exports.NiceDataSnapshot=a.NiceDataSnapshot;
|
package/dist/data-branching.mjs
CHANGED
package/dist/data.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./NiceDataGrid-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./NiceDataGrid-BQIqitMM.cjs"),e=require("./NiceSavedQueryPanel-DDKtL1AA.cjs"),r=require("./NicePivotGrid-DqluEkCI.cjs");exports.NiceDataGrid=i.NiceDataGrid;exports.applyColumnOrder=i.applyColumnOrder;exports.buildColumnGroupSegments=i.buildColumnGroupSegments;exports.buildGridState=i.buildGridState;exports.computeAggregate=i.computeAggregate;exports.escapeCsvField=i.escapeCsvField;exports.formatNumberPattern=i.formatNumberPattern;exports.measureColumnContentWidth=i.measureColumnContentWidth;exports.readStoredGridState=i.readStoredGridState;exports.writeStoredGridState=i.writeStoredGridState;exports.NiceDataGridAI=e.NiceDataGridAI;exports.NiceKanbanBoard=e.NiceKanbanBoard;exports.NiceList=e.NiceList;exports.NiceModuleGrid=e.NiceModuleGrid;exports.NiceReconciliationView=e.NiceReconciliationView;exports.NiceSavedQueryPanel=e.NiceSavedQueryPanel;exports.NiceSpreadsheet=e.NiceSpreadsheet;exports.NiceTable=e.NiceTable;exports.NiceTileView=e.NiceTileView;exports.NiceTreeGrid=e.NiceTreeGrid;exports.NiceTreeList=e.NiceTreeList;exports.NiceTreeView=e.NiceTreeView;exports.NicePivotGrid=r.NicePivotGrid;exports.NicePivotGridFieldChooser=r.NicePivotGridFieldChooser;
|
package/dist/data.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as i, a as r, b as s, c as t, d, e as o, f as c, m as N, r as l, w as m } from "./NiceDataGrid-
|
|
2
|
-
import { N as u, a as G, b as p, c as S, d as b, e as f, f as C, g, h as w, i as T, j as h, k as v } from "./NiceSavedQueryPanel-
|
|
3
|
-
import { N as x, a as V } from "./NicePivotGrid-
|
|
1
|
+
import { N as i, a as r, b as s, c as t, d, e as o, f as c, m as N, r as l, w as m } from "./NiceDataGrid-C1eI6Pso.js";
|
|
2
|
+
import { N as u, a as G, b as p, c as S, d as b, e as f, f as C, g, h as w, i as T, j as h, k as v } from "./NiceSavedQueryPanel-C2Tn1cMW.js";
|
|
3
|
+
import { N as x, a as V } from "./NicePivotGrid-D_kRF1Dt.js";
|
|
4
4
|
export {
|
|
5
5
|
i as NiceDataGrid,
|
|
6
6
|
u as NiceDataGridAI,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),n=require("@nice2dev/ui-core"),o=require("react"),qe=require("react-dom");function Se(l){const h=l?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");if(!h)return"";const w=h.getAttribute("data-theme");return w==="dark"||h.classList.contains("nice-dark")||h.classList.contains("dark")?"nice-dark":w==="light"||h.classList.contains("nice-light")?"nice-light":""}const Ge={info:e.jsx(n.NiceIcon,{name:"info",size:28}),warning:e.jsx(n.NiceIcon,{name:"warning",size:28}),error:e.jsx(n.NiceIcon,{name:"error",size:28}),success:e.jsx(n.NiceIcon,{name:"success",size:28})},Ce=({visible:l,message:h,header:w,icon:M,variant:_="warning",acceptLabel:L,rejectLabel:$,onAccept:A,onReject:T,closeOnOverlay:N=!1,closeOnEscape:S=!0,showReject:O=!0,size:z="md",className:j,style:C})=>{const{t:k}=n.useNiceTranslation(),B=o.useRef(null),v=$??k("confirm.reject","No");if(n.useOverlayFocus(B,{open:l,onClose:T,closeOnEscape:S,closeHint:O?v:void 0}),o.useEffect(()=>(l?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[l]),!l)return null;const i=M??Ge[_],R=L??k("confirm.accept","Yes");return e.jsx("div",{className:"nice-modal-overlay",role:"presentation",onClick:G=>{G.stopPropagation(),N&&G.target===G.currentTarget&&T()},onKeyDown:G=>{G.key!=="Escape"&&G.stopPropagation()},children:e.jsxs("div",{ref:B,className:`nice-confirm nice-confirm--${_} nice-confirm--${z} ${j||""}`,style:C,role:"alertdialog","aria-modal":"true","aria-label":w,"aria-describedby":"nice-confirm-message",children:[w&&e.jsx("div",{className:"nice-confirm__header",children:e.jsx("h3",{className:"nice-confirm__title",children:w})}),e.jsxs("div",{className:"nice-confirm__body",children:[i&&e.jsx("div",{className:`nice-confirm__icon nice-confirm__icon--${_}`,children:i}),e.jsx("div",{id:"nice-confirm-message",className:"nice-confirm__message",children:h})]}),e.jsxs("div",{className:"nice-confirm__footer",children:[O&&e.jsx("button",{type:"button",className:"nice-btn nice-btn--ghost nice-btn--md",onClick:T,children:v}),e.jsx("button",{type:"button",className:`nice-btn nice-btn--${_==="error"?"error":"primary"} nice-btn--md`,onClick:A,autoFocus:!0,children:R})]})]})})},je=new Set,Ke=(l,h)=>{if(Object.is(l,h))return!0;try{return JSON.stringify(l)===JSON.stringify(h)}catch{return!1}};function we(l,h,w,M,_,L="on its own the prop is only the initial value"){const $=o.useRef(M);if(process.env.NODE_ENV==="production"||_){$.current=M;return}const A=`${l}.${h}`;M!==void 0&&!je.has(A)&&!Ke(M,$.current)&&(je.add(A),console.warn(`[Nice2Dev] <${l}> \`${h}\` changed after mount without \`${w}\`, so the change is ignored: ${L}. Pass \`${w}\` to control it.`)),$.current=M}const me=[],be=["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)"],ve=24,ze=40,Re=28,Ve=6,Ue=4;function Ye(l,h,w,M){const _=[],L=[],$=new Map;l.forEach((z,j)=>$.set(z.hash,j));const A=new Map,T=[],N=new Map;let S=0;const O=new Map;if(h.forEach(z=>{if(!z.lastCommit)return;const j=O.get(z.lastCommit)||[];j.push({type:z.isRemote?"remote":"branch",name:z.name,commit:z.lastCommit,color:z.isHead?"var(--nice-color-success, #22c55e)":z.isRemote?"var(--nice-text-muted, #6b7280)":"var(--nice-color-primary, #3b82f6)"}),O.set(z.lastCommit,j)}),w.forEach(z=>{const j=O.get(z.commit)||[];j.push({type:"tag",name:z.name,commit:z.commit,color:"var(--nice-color-warning, #f59e0b)"}),O.set(z.commit,j)}),M){const z=O.get(M)||[];z.push({type:"head",name:"HEAD",commit:M,color:"var(--nice-color-error, #ef4444)"}),O.set(M,z)}return l.forEach((z,j)=>{let C=T.findIndex(B=>B===z.hash);C===-1&&(C=T.findIndex(B=>B===null),C===-1&&(C=T.length,T.push(null))),N.has(C)||(N.set(C,be[S%be.length]),S++),A.set(z.hash,C);const k=N.get(C)||be[0];_.push({commit:z,x:C,y:j,color:k,refs:O.get(z.hash)||[]}),z.parents.forEach((B,v)=>{const i=$.get(B);if(i!==void 0){let R=A.get(B);R===void 0&&(v===0?(R=C,T[C]=B):(R=T.findIndex(y=>y===null),R===-1?(R=T.length,T.push(B)):T[R]=B),A.set(B,R));const G=N.get(R)||k;L.push({from:z.hash,to:B,fromX:C,fromY:j,toX:R,toY:i,color:v===0?k:G,type:v===0?C===R?"straight":"branch":"merge"})}}),(z.parents.length===0||!l.slice(j+1).some(B=>B.parents.includes(z.hash)))&&(T[C]=null)}),{nodes:_,edges:L}}const Je=({nodes:l,edges:h,selectedHash:w,compact:M,onNodeClick:_,onNodeDoubleClick:L})=>{const $=M?Re:ze,A=M?Ue:Ve,N=(Math.max(...l.map(j=>j.x),0)+2)*ve,S=(l.length+1)*$,O=j=>ve/2+j*ve,z=j=>$/2+j*$;return e.jsxs("svg",{width:N,height:S,style:{minWidth:N,minHeight:S,display:"block"},children:[h.map((j,C)=>{const k=O(j.fromX),B=z(j.fromY),v=O(j.toX),i=z(j.toY);if(j.type==="straight")return e.jsx("line",{x1:k,y1:B,x2:v,y2:i,stroke:j.color,strokeWidth:2},C);const R=(B+i)/2,G=`M ${k} ${B} C ${k} ${R}, ${v} ${R}, ${v} ${i}`;return e.jsx("path",{d:G,fill:"none",stroke:j.color,strokeWidth:2,strokeDasharray:j.type==="merge"?"4,2":void 0},C)}),l.map(j=>{const C=O(j.x),k=z(j.y),B=j.commit.hash===w,v=j.commit.isMerge;return e.jsxs("g",{onClick:()=>_(j.commit.hash),onDoubleClick:()=>L(j.commit.hash),style:{cursor:"pointer"},children:[B&&e.jsx("circle",{cx:C,cy:k,r:A+4,fill:"none",stroke:"var(--nice-bg, #fff)",strokeWidth:2}),e.jsx("circle",{cx:C,cy:k,r:A,fill:v?"var(--nice-bg-elevated, #1e1e1e)":j.color,stroke:j.color,strokeWidth:v?2:0}),j.refs.length>0&&!M&&e.jsx("foreignObject",{x:C+10,y:k-8,width:200,height:16,children:e.jsx("div",{style:{display:"flex",gap:4,whiteSpace:"nowrap"},children:j.refs.map((i,R)=>e.jsxs("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:500,background:`${i.color}22`,color:i.color,border:`1px solid ${i.color}44`},children:[i.type==="tag"?e.jsx(n.NiceIcon,{name:"tag",size:10}):i.type==="head"?e.jsx(n.NiceIcon,{name:"cursor",size:10}):null,(i.type==="tag"||i.type==="head")&&" ",i.name]},R))})})]},j.commit.hash)})]})},Ie=({commits:l=me,branches:h=me,tags:w=me,head:M,selectedCommit:_,branchFilter:L,authorFilter:$,dateRange:A,searchQuery:T,maxCommits:N=100,showRemotes:S=!0,showTags:O=!0,compact:z=!1,onCommitSelect:j,onCommitDoubleClick:C,onBranchCheckout:k,onBranchCreate:B,onTagCreate:v,onCherryPick:i,onRevert:R,onReset:G,onCompare:y,onViewDiff:ee,className:K,style:P,"data-testid":c})=>{const{t:a,lang:W}=n.useNiceTranslation(),[D,Y]=o.useState(_),[J,X]=o.useState(null),[V,Z]=o.useState(!1),[f,x]=o.useState(null),g=o.useRef(null),E=_??D,p=o.useMemo(()=>{let m=l;if(L&&L.length>0){const b=new Set;h.filter(F=>L.includes(F.name)).forEach(F=>{F.lastCommit&&b.add(F.lastCommit)}),m=m.filter(F=>b.has(F.hash))}if($&&$.length>0&&(m=m.filter(b=>$.some(F=>b.author.name.toLowerCase().includes(F.toLowerCase())||b.author.email.toLowerCase().includes(F.toLowerCase())))),A&&(A.from&&(m=m.filter(b=>b.date>=A.from)),A.to&&(m=m.filter(b=>b.date<=A.to))),T&&T.trim()){const b=T.toLowerCase();m=m.filter(F=>F.hash.toLowerCase().includes(b)||F.shortHash.toLowerCase().includes(b)||F.message.toLowerCase().includes(b)||F.author.name.toLowerCase().includes(b))}return m.slice(0,N)},[l,L,$,A,T,N,h]),{nodes:H,edges:q}=o.useMemo(()=>Ye(p,S?h:h.filter(m=>!m.isRemote),O?w:[],M),[p,h,w,M,S,O]),s=o.useMemo(()=>p.find(m=>m.hash===E),[p,E]),t=o.useCallback(m=>{if(V&&f)y?.(f,m),Z(!1),x(null);else if(V)x(m);else{Y(m);const b=p.find(F=>F.hash===m);b&&j?.(b)}},[V,f,p,j,y]),d=o.useCallback(m=>{const b=p.find(F=>F.hash===m);b&&(C?.(b),ee?.(m))},[p,C,ee]),u=o.useCallback((m,b)=>{m.preventDefault(),X({x:m.clientX,y:m.clientY,commit:b})},[]),I=o.useCallback(()=>X(null),[]),te=m=>{const F=new Date().getTime()-m.getTime(),ne=Math.floor(F/(1e3*60*60*24));return ne===0?a("gitGraph.today","Today"):ne===1?a("gitGraph.yesterday","Yesterday"):ne<7?new Intl.RelativeTimeFormat(W).format(-ne,"day"):m.toLocaleDateString(W)},Q=z?Re:ze;return e.jsxs("div",{role:"presentation",className:`nice-git-graph ${K||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...P},"data-testid":c,onClick:I,children:[e.jsxs("div",{ref:g,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(Je,{nodes:H,edges:q,selectedHash:E,compact:z,onNodeClick:t,onNodeDoubleClick:d})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[H.map(m=>e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>t(m.commit.hash),onDoubleClick:()=>d(m.commit.hash),onContextMenu:b=>u(b,m.commit),style:{height:Q,padding:"0 12px",display:"flex",alignItems:"center",gap:12,cursor:"pointer",background:m.commit.hash===E?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderBottom:"1px solid var(--nice-bg-secondary, #2a2a2a)"},children:[m.commit.author.avatar?e.jsx("img",{src:m.commit.author.avatar,alt:"",style:{width:z?20:24,height:z?20:24,borderRadius:"50%",flexShrink:0}}):e.jsx("div",{style:{width:z?20:24,height:z?20:24,borderRadius:"50%",background:m.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:z?10:12,color:"var(--nice-color-white, #fff)",fontWeight:600,flexShrink:0},children:m.commit.author.name.charAt(0).toUpperCase()}),e.jsx("div",{style:{flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:z?12:13},children:m.commit.message}),m.commit.stats&&!z&&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:["+",m.commit.stats.additions]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",m.commit.stats.deletions]})]}),e.jsx("code",{style:{fontSize:z?10:11,color:"var(--nice-text-muted, #888)",fontFamily:"monospace",flexShrink:0},children:m.commit.shortHash}),!z&&e.jsx("span",{style:{fontSize:11,color:"var(--nice-text-muted, #888)",flexShrink:0,width:100},children:m.commit.author.name}),e.jsx("span",{style:{fontSize:z?10:11,color:"var(--nice-text-muted, #666)",flexShrink:0,width:z?60:80,textAlign:"right"},children:te(m.commit.date)})]},m.commit.hash)),p.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:13},children:a("gitGraph.noCommitsMatchTheFilters","No commits match the filters")})]})]}),s&&!z&&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:[s.author.avatar?e.jsx("img",{src:s.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-text-on-primary, #fff)",fontWeight:600},children:s.author.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:s.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:s.author.email})]})]}),e.jsx("code",{style:{fontSize:11,color:"var(--nice-text-muted, #888)",fontFamily:"monospace"},children:s.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:s.message}),s.body&&e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #aaa)",whiteSpace:"pre-wrap",maxHeight:120,overflow:"auto"},children:s.body})]}),s.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:s.stats.filesChanged}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:a("gitGraph.filesChanged","files changed")})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:["+",s.stats.additions]}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:a("gitGraph.additions","additions")})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:["-",s.stats.deletions]}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:a("gitGraph.deletions","deletions")})]})]}),e.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("button",{onClick:()=>ee?.(s.hash),style:{padding:"8px 12px",borderRadius:4,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:a("gitGraph.viewChanges","View Changes")}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>i?.(s.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:a("gitGraph.cherryPick","Cherry Pick")}),e.jsx("button",{onClick:()=>R?.(s.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:a("gitGraph.revert","Revert")})]}),e.jsx("button",{onClick:()=>B?.(s.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:a("gitGraph.createBranchHere","Create Branch Here")}),e.jsx("button",{onClick:()=>v?.(s.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:a("gitGraph.createTagHere","Create Tag Here")}),e.jsx("button",{onClick:()=>{Z(!0),x(s.hash)},style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:a("gitGraph.compareWith","Compare with...")})]})]}),V&&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:[f?a("gitGraph.selectCommitToCompareWith","Select commit to compare with {compareBase}").replace("{compareBase}",String(f.slice(0,7))):a("gitGraph.selectFirstCommit","Select first commit"),e.jsx("button",{onClick:()=>{Z(!1),x(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-color-white, #fff)",cursor:"pointer",fontSize:11},children:a("gitGraph.cancel","Cancel")})]}),J&&e.jsx("div",{style:{position:"fixed",left:J.x,top:J.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:a("gitGraph.viewChanges","View Changes"),onClick:()=>ee?.(J.commit.hash)},{label:a("gitGraph.cherryPick","Cherry Pick"),onClick:()=>i?.(J.commit.hash)},{label:a("gitGraph.revert","Revert"),onClick:()=>R?.(J.commit.hash)},{divider:!0},{label:a("gitGraph.createBranch","Create Branch"),onClick:()=>B?.(J.commit.hash)},{label:a("gitGraph.createTag","Create Tag"),onClick:()=>v?.(J.commit.hash)},{divider:!0},{label:a("gitGraph.resetSoft","Reset Soft"),onClick:()=>G?.(J.commit.hash,"soft")},{label:a("gitGraph.resetMixed","Reset Mixed"),onClick:()=>G?.(J.commit.hash,"mixed")},{label:a("gitGraph.resetHard","Reset Hard"),onClick:()=>G?.(J.commit.hash,"hard"),danger:!0}].map((m,b)=>"divider"in m?e.jsx("div",{style:{height:1,background:"var(--nice-bg-tertiary, #444)",margin:"4px 0"}},b):e.jsx("button",{onClick:()=>{m.onClick?.(),I()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in m&&m.danger?"var(--nice-color-error, #ef4444)":"var(--nice-text-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:F=>{F.currentTarget.style.background="var(--nice-bg-tertiary, #333)"},onMouseOut:F=>{F.currentTarget.style.background="transparent"},children:m.label},b))})]})},Xe=Object.freeze(Object.defineProperty({__proto__:null,NiceGitGraph:Ie},Symbol.toStringTag,{value:"Module"})),ye=({open:l,onSubmit:h,onCancel:w,title:M,message:_,defaultValue:L="",placeholder:$,inputType:A="text",confirmLabel:T,cancelLabel:N,className:S="",style:O})=>{const{t:z}=n.useNiceTranslation(),[j,C]=o.useState(L),k=o.useRef(null),B=o.useRef(null);return o.useEffect(()=>{l&&C(L)},[l,L]),n.useOverlayFocus(B,{open:l,onClose:w,initialFocus:k,closeHint:typeof N=="string"?N:void 0}),l?e.jsx("div",{className:`nice-prompt-dialog ${S}`,style:O,role:"presentation",onClick:v=>{v.target===v.currentTarget&&w()},onKeyDown:v=>{v.key!=="Escape"&&v.stopPropagation()},children:e.jsxs("div",{ref:B,role:"dialog","aria-modal":"true","aria-labelledby":"nice-prompt-title",className:"nice-prompt-dialog__panel",children:[e.jsx("h2",{id:"nice-prompt-title",className:"nice-prompt-dialog__title",children:M}),_&&e.jsx("p",{className:"nice-prompt-dialog__message",children:_}),e.jsx("input",{ref:k,type:A,value:j,placeholder:$,className:"nice-prompt-dialog__input",onChange:v=>C(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h(j))}}),e.jsxs("div",{className:"nice-prompt-dialog__actions",children:[e.jsx("button",{type:"button",className:"nice-prompt-dialog__btn nice-prompt-dialog__btn--cancel",onClick:w,children:N??z("cancel","Cancel")}),e.jsx("button",{type:"button",className:"nice-prompt-dialog__btn nice-prompt-dialog__btn--confirm",onClick:()=>h(j),children:T??z("ok","OK")})]})]})}):null};process.env.NODE_ENV!=="production"&&(ye.displayName="NicePromptDialog");function Ne(){const[l,h]=o.useState(null),w=o.useRef(null),M=o.useCallback(N=>{const S=w.current;S&&(S.kind==="prompt"?S.resolve(null):S.resolve(!1)),w.current=N,h(N)},[]),_=o.useCallback(()=>{w.current=null,h(null)},[]),L=o.useCallback(N=>new Promise(S=>M({kind:"prompt",request:N,resolve:S})),[M]),$=o.useCallback(N=>new Promise(S=>M({kind:"confirm",request:N,resolve:S})),[M]),A=o.useCallback(N=>new Promise(S=>M({kind:"alert",request:N,resolve:()=>S()})),[M]);let T=null;if(l?.kind==="prompt"){const{resolve:N,request:S}=l;T=e.jsx(ye,{open:!0,...S,onSubmit:O=>{_(),N(O)},onCancel:()=>{_(),N(null)}})}else if(l){const{resolve:N,request:S,kind:O}=l;T=e.jsx(Ce,{visible:!0,...S,variant:S.variant??(O==="alert"?"info":"warning"),showReject:O!=="alert",onAccept:()=>{_(),N(!0)},onReject:()=>{_(),N(!1)}})}return{prompt:L,confirm:$,alert:A,element:T}}const Ze=[],Be=({branches:l=Ze,currentBranch:h,defaultBranch:w="main",protectionRules:M=[],showRemotes:_=!0,selectedBranch:L,onBranchSelect:$,onCheckout:A,onCreateBranch:T,onDeleteBranch:N,onRenameBranch:S,onMerge:O,onRebase:z,onSetUpstream:j,onPush:C,onPull:k,onCompare:B,onProtectionChange:v,className:i,style:R,"data-testid":G})=>{const{t:y,lang:ee}=n.useNiceTranslation(),K=Ne(),[P,c]=o.useState(""),[a,W]=o.useState("all"),[D,Y]=o.useState(),[J,X]=o.useState(!1),[V,Z]=o.useState(!1),[f,x]=o.useState(!1),[g,E]=o.useState(""),[p,H]=o.useState(h||w),[q,s]=o.useState(""),[t,d]=o.useState(h||w),[u,I]=o.useState(null),te=L??D,Q=o.useMemo(()=>{let r=l;if(a==="local"?r=r.filter(U=>!U.isRemote):a==="remote"?r=r.filter(U=>U.isRemote):_||(r=r.filter(U=>!U.isRemote)),P.trim()){const U=P.toLowerCase();r=r.filter(ie=>ie.name.toLowerCase().includes(U))}return r.sort((U,ie)=>U.isHead?-1:ie.isHead?1:U.name===w?-1:ie.name===w?1:U.isRemote!==ie.isRemote?U.isRemote?1:-1:U.name.localeCompare(ie.name))},[l,a,_,P,w]),m=o.useMemo(()=>{const r=Q.filter(ie=>!ie.isRemote),U=Q.filter(ie=>ie.isRemote);return{local:r,remote:U}},[Q]),b=o.useCallback(r=>{Y(r),$?.(r)},[$]),F=o.useCallback((r,U)=>{r.preventDefault(),I({x:r.clientX,y:r.clientY,branch:U})},[]),ne=o.useCallback(()=>I(null),[]),ce=o.useCallback(()=>{g.trim()&&(T?.(g.trim(),p),E(""),X(!1))},[g,p,T]),he=o.useCallback(()=>{q&&t&&q!==t&&(O?.(q,t),Z(!1))},[q,t,O]),xe=r=>{if(!r)return"-";const ie=new Date().getTime()-r.getTime(),se=Math.floor(ie/(1e3*60*60*24));if(se===0)return y("branchManager.today","Today");if(se===1)return y("branchManager.yesterday","Yesterday");const ue=new Intl.RelativeTimeFormat(ee);return se<7?ue.format(-se,"day"):se<30?ue.format(-Math.floor(se/7),"week"):r.toLocaleDateString(ee)},re=o.useMemo(()=>l.find(r=>r.name===te),[l,te]),de=o.useCallback(r=>M.some(U=>new RegExp(U.pattern.replace(/\*/g,".*")).test(r)),[M]),ae=m.local,oe=r=>{const U=r.name===te,ie=r.isHead,se=r.name===w,ue=de(r.name);return e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>b(r.name),onDoubleClick:()=>A?.(r.name),onContextMenu:We=>F(We,r),style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",cursor:"pointer",background:U?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":ie?"color-mix(in srgb, var(--nice-color-success, #22c55e) 8%, transparent)":"transparent",borderLeft:ie?"3px solid var(--nice-success, #22c55e)":"3px solid transparent"},children:[e.jsx(n.NiceIcon,{name:r.isRemote?"cloud":ie?"map-pin":"box",size:16}),e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:ie?600:400,color:ie?"var(--nice-color-success, #22c55e)":"var(--nice-text-primary, #e0e0e0)"},children:r.name}),e.jsxs("div",{style:{display:"flex",gap:4},children:[se&&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 color-mix(in srgb, var(--nice-color-primary, #3b82f6) 27%, transparent)"},children:y("branchManager.default","default")}),ue&&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 color-mix(in srgb, var(--nice-color-warning, #f59e0b) 27%, transparent)"},children:[e.jsx(n.NiceIcon,{name:"lock",size:10})," ",y("branchManager.protected","protected")]})]}),r.upstream&&(r.ahead||r.behind)&&e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10,color:"var(--nice-text-muted, #888)"},children:[r.ahead?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(n.NiceIcon,{name:"arrow-up",size:10}),r.ahead]}):null,r.behind?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:2,color:"var(--nice-color-error, #ef4444)"},children:[e.jsx(n.NiceIcon,{name:"arrow-down",size:10}),r.behind]}):null]}),r.lastCommit&&e.jsx("span",{style:{fontSize:10,color:"var(--nice-text-muted, #666)",width:80,textAlign:"right"},children:xe(r.lastCommit.date)})]},r.name)};return e.jsxs("div",{role:"presentation",className:`nice-branch-manager ${i||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...R},"data-testid":G,onClick:ne,children:[K.element,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.NiceIcon,{name:"box",size:18}),e.jsx("span",{style:{fontWeight:600,fontSize:14},children:y("branchManager.branches","Branches")}),e.jsx("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"var(--nice-bg-tertiary, #333)",borderRadius:10,fontSize:11},children:y("branchManager.local","{branches} local").replace("{branches}",String(l.filter(r=>!r.isRemote).length))})]}),e.jsx("input",{type:"text",placeholder:y("branchManager.searchBranches","Search branches..."),value:P,onChange:r=>c(r.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-text-primary, #fff)",fontSize:12,marginBottom:8}}),e.jsx("div",{style:{display:"flex",gap:4},children:["all","local","remote"].map(r=>e.jsx("button",{onClick:()=>W(r),style:{flex:1,padding:"6px 0",borderRadius:4,border:"none",background:a===r?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:a===r?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:r},r))})]}),e.jsxs("div",{style:{padding:8,borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:8},children:[e.jsxs("button",{onClick:()=>X(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"plus",size:14})," ",y("branchManager.newBranch","New Branch")]}),e.jsxs("button",{onClick:()=>Z(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"shuffle",size:14})," ",y("branchManager.merge","Merge")]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[m.local.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:"8px 12px",fontSize:10,fontWeight:600,color:"var(--nice-text-muted, #888)",textTransform:"uppercase",background:"var(--nice-bg-elevated, #252525)"},children:y("branchManager.local2","Local ({local})").replace("{local}",String(m.local.length))}),m.local.map(oe)]}),_&&m.remote.length>0&&a!=="local"&&e.jsxs(e.Fragment,{children:[e.jsx("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:y("branchManager.remote","Remote ({remote})").replace("{remote}",String(m.remote.length))}),m.remote.map(oe)]}),Q.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:12},children:y("branchManager.noBranchesMatchTheFilter","No branches match the filter")})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:re?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.NiceIcon,{name:re.isRemote?"cloud":re.isHead?"map-pin":"box",size:24}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:re.name}),re.description&&e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--nice-text-muted, #888)"},children:re.description})]}),re.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.NiceIcon,{name:"check",size:14})," ",y("branchManager.current","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:y("branchManager.upstream","Upstream")}),e.jsx("div",{style:{fontSize:13},children:re.upstream||e.jsx("span",{style:{color:"var(--nice-text-muted, #666)"},children:y("branchManager.notSet","Not set")})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #888)",marginBottom:4},children:y("branchManager.syncStatus","Sync Status")}),e.jsx("div",{style:{display:"flex",gap:8,fontSize:13},children:re.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.NiceIcon,{name:"arrow-up",size:13})," ",y("branchManager.ahead","{ahead} ahead").replace("{ahead}",String(re.ahead||0))]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,color:"var(--nice-color-error, #ef4444)"},children:[e.jsx(n.NiceIcon,{name:"arrow-down",size:13})," ",y("branchManager.behind","{behind} behind").replace("{behind}",String(re.behind||0))]})]}):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:y("branchManager.lastCommit","Last Commit")}),e.jsx("div",{style:{fontSize:13},children:re.lastCommit?e.jsxs(e.Fragment,{children:[e.jsx("code",{style:{fontSize:11,color:"var(--nice-text-muted, #aaa)"},children:re.lastCommit.hash.slice(0,7)})," ",xe(re.lastCommit.date)]}):e.jsx("span",{style:{color:"var(--nice-text-muted, #666)"},children:"-"})})]})]}),re.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:re.lastCommit.message}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:y("branchManager.by","by {author}").replace("{author}",String(re.lastCommit.author))})]})]}),e.jsx("div",{style:{padding:16},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8},children:[!re.isHead&&e.jsxs("button",{onClick:()=>A?.(re.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"map-pin",size:14})," ",y("branchManager.checkout","Checkout")]}),re.upstream&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>k?.(re.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"arrow-down",size:14})," ",y("branchManager.pull","Pull")]}),e.jsxs("button",{onClick:()=>C?.(re.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-accent, #8b5cf6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"arrow-up",size:14})," ",y("branchManager.push","Push")]})]}),!re.upstream&&!re.isRemote&&e.jsx("button",{onClick:()=>j?.(re.name,`origin/${re.name}`),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12},children:y("branchManager.setUpstream","Set Upstream")}),e.jsxs("button",{onClick:()=>{s(re.name),d(h||w),Z(!0)},style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"shuffle",size:14})," ",y("branchManager.mergeInto","Merge into...")]}),e.jsxs("button",{onClick:()=>B?.(w,re.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"shuffle",size:14})," ",y("branchManager.compare","Compare")]}),!re.isHead&&!re.isRemote&&!de(re.name)&&e.jsxs("button",{onClick:()=>N?.(re.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:12,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"trash",size:14})," ",y("branchManager.delete","Delete")]})]})})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #666)",fontSize:13},children:y("branchManager.selectABranchToView","Select a branch to view details")})}),J&&e.jsx("div",{role:"presentation",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:()=>X(!1),children:e.jsxs("div",{role:"presentation",style:{width:400,background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:24},onClick:r=>r.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:y("branchManager.createNewBranch","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:y("branchManager.branchName","Branch Name")}),e.jsx("input",{type:"text",placeholder:y("branchManager.featureMyFeature","feature/my-feature"),value:g,onChange:r=>E(r.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-text-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:y("branchManager.basedOn","Based on")}),e.jsx("select",{value:p,onChange:r=>H(r.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-text-primary, #fff)",fontSize:13},children:ae.map(r=>e.jsxs("option",{value:r.name,children:[r.name," ",r.isHead?y("branchManager.current2","(current)"):""]},r.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>X(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12},children:y("branchManager.cancel","Cancel")}),e.jsx("button",{onClick:ce,disabled:!g.trim(),style:{padding:"10px 20px",borderRadius:6,border:"none",background:g.trim()?"var(--nice-color-success, #22c55e)":"var(--nice-bg-tertiary, #333)",color:g.trim()?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:g.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:y("branchManager.createBranch","Create Branch")})]})]})}),V&&e.jsx("div",{role:"presentation",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:()=>Z(!1),children:e.jsxs("div",{role:"presentation",style:{width:400,background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:24},onClick:r=>r.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:y("branchManager.mergeBranches","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:y("branchManager.mergeFrom","Merge from")}),e.jsxs("select",{value:q,onChange:r=>s(r.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-text-primary, #fff)",fontSize:13},children:[e.jsx("option",{value:"",children:y("branchManager.selectBranch","Select branch...")}),ae.map(r=>e.jsx("option",{value:r.name,children:r.name},r.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.NiceIcon,{name:"arrow-down",size:14})," ",y("branchManager.into","into")," ",e.jsx(n.NiceIcon,{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:y("branchManager.mergeInto2","Merge into")}),e.jsx("select",{value:t,onChange:r=>d(r.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-text-primary, #fff)",fontSize:13},children:ae.map(r=>e.jsxs("option",{value:r.name,children:[r.name," ",r.isHead?y("branchManager.current2","(current)"):""]},r.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>Z(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12},children:y("branchManager.cancel","Cancel")}),e.jsx("button",{onClick:he,disabled:!q||!t||q===t,style:{padding:"10px 20px",borderRadius:6,border:"none",background:q&&t&&q!==t?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:q&&t&&q!==t?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:q&&t&&q!==t?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:y("branchManager.merge","Merge")})]})]})}),u&&e.jsx("div",{style:{position:"fixed",left:u.x,top:u.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:[!u.branch.isHead&&{label:y("branchManager.checkout","Checkout"),onClick:()=>A?.(u.branch.name)},{label:y("branchManager.compare","Compare"),onClick:()=>B?.(w,u.branch.name)},{label:y("branchManager.mergeIntoCurrent","Merge into current"),onClick:()=>O?.(u.branch.name,h||w)},{divider:!0},!u.branch.isRemote&&{label:y("branchManager.rename","Rename"),onClick:()=>{const r=u.branch.name;K.prompt({title:y("branchManager.renamePrompt","New branch name"),defaultValue:r}).then(U=>{U&&S?.(r,U)})}},!u.branch.isHead&&!u.branch.isRemote&&!de(u.branch.name)&&{label:y("branchManager.delete","Delete"),onClick:()=>N?.(u.branch.name),danger:!0}].filter(Boolean).map((r,U)=>r?"divider"in r?e.jsx("div",{style:{height:1,background:"var(--nice-bg-tertiary, #444)",margin:"4px 0"}},U):e.jsx("button",{onClick:()=>{r.onClick?.(),ne()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in r&&r.danger?"var(--nice-color-error, #ef4444)":"var(--nice-text-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:ie=>ie.currentTarget.style.background="var(--nice-bg-tertiary, #333)",onMouseOut:ie=>ie.currentTarget.style.background="transparent",children:r.label},U):null)})]})},Qe=Object.freeze(Object.defineProperty({__proto__:null,NiceBranchManager:Be},Symbol.toStringTag,{value:"Module"})),et=[],tt=[{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"}],Me=({branches:l=et,users:h=[],labels:w=[],issues:M=[],templates:_=[],diff:L,currentBranch:$,defaultTargetBranch:A="main",initialSourceBranch:T,platform:N="github",onSubmit:S,onCancel:O,onBranchChange:z,onPreview:j,tutorial:C,className:k,style:B,"data-testid":v})=>{const{t:i}=n.useNiceTranslation(),[R,G]=o.useState(""),[y,ee]=o.useState(""),[K,P]=o.useState(T||$||""),[c,a]=o.useState(A),[W,D]=o.useState(!1),[Y,J]=o.useState([]),[X,V]=o.useState([]),[Z,f]=o.useState([]),[x,g]=o.useState([]),[E,p]=o.useState(!1),[H,q]=o.useState(!0),[s,t]=o.useState(!1),[d,u]=o.useState(!1),[I,te]=o.useState(!1),[Q,m]=o.useState(!1),b=o.useMemo(()=>K?K.replace(/^(feature|bugfix|hotfix|release)\//,"").replace(/[-_]/g," ").replace(/\b\w/g,U=>U.toUpperCase()):"",[K]),F=o.useMemo(()=>l.filter(r=>!r.isRemote),[l]),ne=o.useCallback((r,U)=>{P(r),a(U),z?.(r,U)},[z]),ce=o.useCallback(()=>{if(!K||!c||!R.trim())return;const r={title:R.trim(),description:y.trim(),sourceBranch:K,targetBranch:c,isDraft:W,labels:Y,reviewers:X,assignees:Z,linkedIssues:x,squashCommits:E,deleteSourceBranch:H};S?.(r)},[R,y,K,c,W,Y,X,Z,x,E,H,S]),he=r=>{ee(r.content),m(!1)},xe=r=>{J(U=>U.includes(r)?U.filter(ie=>ie!==r):[...U,r])},re=r=>{V(U=>U.includes(r)?U.filter(ie=>ie!==r):[...U,r])},de=r=>{g(U=>U.includes(r)?U.filter(ie=>ie!==r):[...U,r])},ae={github:{title:i("mergeRequestBuilder.pullRequest","Pull Request"),btn:"Create Pull Request"},gitlab:{title:i("mergeRequestBuilder.mergeRequest","Merge Request"),btn:"Create Merge Request"},bitbucket:{title:i("mergeRequestBuilder.pullRequest","Pull Request"),btn:"Create Pull Request"},azure:{title:i("mergeRequestBuilder.pullRequest","Pull Request"),btn:"Create Pull Request"}},oe=K&&c&&K!==c&&R.trim();return e.jsxs("div",{className:`nice-merge-request-builder ${k||""}`,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",...B},"data-testid":v,children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(n.NiceTutorialButton,{steps:n.resolveTutorial(C,tt)})}),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.NiceIcon,{name:"shuffle",size:24}),e.jsxs("div",{children:[e.jsxs("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:[W?`${i("mergeRequestBuilder.draft","Draft")} `:"",ae[N].title]}),e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--nice-text-muted, #888)"},children:N==="gitlab"?i("mergeRequestBuilder.createMergeRequest","Create a new merge request"):i("mergeRequestBuilder.createPullRequest","Create a new 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:i("mergeRequestBuilder.from","From")}),e.jsxs("select",{value:K,onChange:r=>ne(r.target.value,c),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-text-primary, #fff)",fontSize:13},children:[e.jsx("option",{value:"",children:i("mergeRequestBuilder.selectSourceBranch","Select source branch...")}),F.map(r=>e.jsx("option",{value:r.name,children:r.name},r.name))]})]}),e.jsx("div",{style:{padding:"20px 0 0"},children:e.jsx("span",{style:{fontSize:20,color:"var(--nice-text-muted, #888)"},children:e.jsx(n.NiceIcon,{name:"arrow-right",size:20})})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11,color:"var(--nice-text-muted, #888)",marginBottom:4},children:i("mergeRequestBuilder.into","Into")}),e.jsx("select",{value:c,onChange:r=>ne(K,r.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-text-primary, #fff)",fontSize:13},children:F.map(r=>e.jsx("option",{value:r.name,children:r.name},r.name))})]})]}),L&&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.jsx("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:i("mergeRequestBuilder.additions","+{additions} additions").replace("{additions}",String(L.additions))}),e.jsx("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:i("mergeRequestBuilder.deletions","-{deletions} deletions").replace("{deletions}",String(L.deletions))}),e.jsx("span",{style:{color:"var(--nice-text-muted, #888)"},children:i("mergeRequestBuilder.filesChanged","{changedFiles} files changed").replace("{changedFiles}",String(L.changedFiles))})]}),K===c&&K&&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:i("mergeRequestBuilder.sourceAndTargetBranchesCannot","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:i("mergeRequestBuilder.title","Title")}),e.jsx("input",{type:"text",value:R,onChange:r=>G(r.target.value),placeholder:b||i("mergeRequestBuilder.enterATitle","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-text-primary, #fff)",fontSize:14}}),!R&&b&&e.jsx("button",{onClick:()=>G(b),style:{marginTop:4,padding:0,background:"none",border:"none",color:"var(--nice-color-primary, #3b82f6)",fontSize:11,cursor:"pointer"},children:i("mergeRequestBuilder.useSuggested",'Use suggested: "{suggestedTitle}"').replace("{suggestedTitle}",String(b))})]}),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:i("mergeRequestBuilder.description","Description")}),_.length>0&&e.jsxs("button",{onClick:()=>m(!Q),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.NiceIcon,{name:"edit",size:14})," ",i("mergeRequestBuilder.templates","Templates")]})]}),e.jsx("textarea",{value:y,onChange:r=>ee(r.target.value),placeholder:i("mergeRequestBuilder.describeYourChanges","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-text-primary, #fff)",fontSize:13,resize:"vertical",fontFamily:"inherit"}})]}),Q&&_.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:i("mergeRequestBuilder.selectTemplate","Select Template")}),_.map(r=>e.jsxs("button",{onClick:()=>he(r),style:{display:"block",width:"100%",padding:"8px 12px",marginBottom:4,borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:[e.jsx("div",{style:{fontWeight:500},children:r.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:r.description})]},r.id))]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16,marginBottom:20},children:[e.jsxs("div",{children:[e.jsx("button",{onClick:()=>t(!s),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-text-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.NiceIcon,{name:"tag",size:14})," ",i("mergeRequestBuilder.labels","Labels")]}),Y.length>0&&e.jsxs("span",{style:{color:"var(--nice-color-primary, #3b82f6)"},children:["(",Y.length,")"]})]})}),s&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--nice-bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:w.map(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:Y.includes(r.id),onChange:()=>xe(r.id)}),e.jsx("span",{style:{width:12,height:12,borderRadius:"50%",background:r.color}}),e.jsx("span",{style:{fontSize:12},children:r.name})]},r.id))})]}),e.jsxs("div",{children:[e.jsx("button",{onClick:()=>u(!d),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-text-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.NiceIcon,{name:"users",size:14})," ",i("mergeRequestBuilder.reviewers","Reviewers")]}),X.length>0&&e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["(",X.length,")"]})]})}),d&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--nice-bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:h.map(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:X.includes(r.id),onChange:()=>re(r.id)}),r.avatar?e.jsx("img",{src:r.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"var(--nice-bg-tertiary, #666)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:r.name[0]}),e.jsx("span",{style:{fontSize:12},children:r.name})]},r.id))})]}),e.jsxs("div",{children:[e.jsx("button",{onClick:()=>te(!I),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-text-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.NiceIcon,{name:"link",size:14})," ",i("mergeRequestBuilder.linkedIssues","Linked Issues")]}),x.length>0&&e.jsxs("span",{style:{color:"var(--nice-color-accent, #8b5cf6)"},children:["(",x.length,")"]})]})}),I&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--nice-bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:M.filter(r=>r.state==="open").map(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:x.includes(r.id),onChange:()=>de(r.id)}),e.jsxs("span",{style:{fontSize:12,color:"var(--nice-text-muted, #888)"},children:["#",r.number]}),e.jsx("span",{style:{fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.title})]},r.id))})]}),e.jsx("div",{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:6,border:"1px solid var(--nice-border-color, #444)",background:"var(--nice-bg-elevated, #252525)",cursor:"pointer",fontSize:12},children:[e.jsx("input",{type:"checkbox",checked:W,onChange:r=>D(r.target.checked)}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"edit",size:14})," ",i("mergeRequestBuilder.createAsDraft","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:i("mergeRequestBuilder.mergeOptions","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:E,onChange:r=>p(r.target.checked)}),i("mergeRequestBuilder.squashCommitsOnMerge","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:H,onChange:r=>q(r.target.checked)}),i("mergeRequestBuilder.deleteSourceBranchAfterMerge","Delete source branch after merge")]})]})]}),L&&L.files.length>0&&e.jsxs("div",{style:{background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:16},children:[e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #888)",marginBottom:12},children:i("mergeRequestBuilder.changedFiles","Changed Files ({changedFiles})").replace("{changedFiles}",String(L.changedFiles))}),e.jsx("div",{style:{maxHeight:200,overflow:"auto"},children:L.files.map(r=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,fontSize:12},children:[e.jsx("span",{style:{width:12,height:12,borderRadius:2,background:r.status==="added"?"var(--nice-color-success, #22c55e)":r.status==="deleted"?"var(--nice-color-error, #ef4444)":r.status==="renamed"?"var(--nice-color-primary, #3b82f6)":"var(--nice-color-warning, #f59e0b)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,color:"var(--nice-color-white, #fff)"},children:r.status==="added"?"+":r.status==="deleted"?"-":r.status==="renamed"?"R":"M"}),e.jsx("span",{style:{flex:1,fontFamily:"monospace",fontSize:11},children:r.path}),e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)",fontSize:11},children:["+",r.additions]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)",fontSize:11},children:["-",r.deletions]})]},r.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:O,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:13},children:i("mergeRequestBuilder.cancel","Cancel")}),e.jsx("button",{onClick:()=>j?.({title:R,description:y,sourceBranch:K,targetBranch:c,isDraft:W,labels:Y,reviewers:X,assignees:Z,linkedIssues:x,squashCommits:E,deleteSourceBranch:H}),disabled:!oe,style:{padding:"10px 20px",borderRadius:6,border:"none",background:oe?"var(--nice-bg-tertiary, #333)":"var(--nice-bg-elevated, #222)",color:oe?"var(--nice-text-primary, #fff)":"var(--nice-text-muted, #666)",cursor:oe?"pointer":"not-allowed",fontSize:13},children:i("mergeRequestBuilder.preview","Preview")}),e.jsx("button",{onClick:ce,disabled:!oe,style:{padding:"10px 24px",borderRadius:6,border:"none",background:oe?"var(--nice-color-success, #22c55e)":"var(--nice-bg-elevated, #222)",color:oe?"var(--nice-color-white, #fff)":"var(--nice-text-muted, #666)",cursor:oe?"pointer":"not-allowed",fontSize:13,fontWeight:500},children:W?i("mergeRequestBuilder.createDraft","Create Draft"):ae[N].btn})]})]})},nt=Object.freeze(Object.defineProperty({__proto__:null,NiceMergeRequestBuilder:Me},Symbol.toStringTag,{value:"Module"})),rt=[],Ee=({files:l=rt,viewMode:h,showWhitespace:w,comments:M=[],selectedFile:_,showFileTree:L=!0,contextLines:$=3,baseRef:A,headRef:T,onFileSelect:N,onViewModeChange:S,onAddComment:O,onResolveComment:z,onExpandChunk:j,className:C,style:k,"data-testid":B})=>{const{t:v}=n.useNiceTranslation(),[i,R]=o.useState("split"),[G,y]=o.useState(!1),[ee,K]=o.useState(void 0),[P,c]=o.useState(new Set),[a,W]=o.useState(null),D=h??i,Y=w??G,J=_??ee??l[0]?.path,X=o.useMemo(()=>l.find(s=>s.path===J),[l,J]),V=o.useMemo(()=>({additions:l.reduce((s,t)=>s+t.additions,0),deletions:l.reduce((s,t)=>s+t.deletions,0)}),[l]),Z=o.useCallback(s=>{K(s),N?.(s)},[N]),f=o.useCallback(s=>{R(s),S?.(s)},[S]),x=o.useCallback((s,t)=>{const d=`${s}:${t}`;c(u=>{const I=new Set(u);return I.has(d)?I.delete(d):I.add(d),I}),j?.(s,t)},[j]),g=o.useMemo(()=>M.filter(s=>s.filePath===J),[M,J]),E=s=>{switch(s){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:"R",color:"var(--nice-color-primary, #3b82f6)"};case"copied":return{icon:"C",color:"var(--nice-color-accent, #8b5cf6)"}}},p=(s,t,d)=>{const u=s.type==="addition"?"var(--nice-success-tint-10, rgba(34, 197, 94, 0.1))":s.type==="deletion"?"var(--nice-danger-tint-10, rgba(239, 68, 68, 0.1))":s.type==="header"?"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))":"transparent",I=s.type==="addition"?"var(--nice-success-text, #4ade80)":s.type==="deletion"?"var(--nice-danger-text, #f87171)":s.type==="header"?"var(--nice-info-text, #60a5fa)":"var(--nice-text-primary, #e0e0e0)",te=d==="old"?s.lineNumberOld:d==="new"?s.lineNumberNew:void 0,Q=Y?s.content.replace(/ /g,"·").replace(/\t/g,"→ "):s.content;return e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:u,minHeight:20,fontSize:12,fontFamily:'"JetBrains Mono", "Fira Code", monospace'},children:[te!==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:te}),D==="unified"&&e.jsx("div",{style:{width:20,textAlign:"center",color:I,fontWeight:600},children:s.type==="addition"?"+":s.type==="deletion"?"-":" "}),e.jsx("div",{style:{flex:1,padding:"0 8px",color:I,whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:Q||" "}),O&&te&&s.type!=="header"&&e.jsx("button",{type:"button",onClick:()=>W({filePath:J,line:te,side:d||"new",body:""}),style:{width:24,border:"none",background:"transparent",color:"var(--nice-color-primary, #3b82f6)",cursor:"pointer",opacity:.3,transition:"opacity 0.2s"},onMouseEnter:m=>m.currentTarget.style.opacity="1",onMouseLeave:m=>m.currentTarget.style.opacity="0.3",onFocus:m=>m.currentTarget.style.opacity="1",onBlur:m=>m.currentTarget.style.opacity="0.3","aria-label":v("gitDiffViewer.addComment","Add comment"),children:e.jsx(n.NiceIcon,{name:"message",size:14})})]},`${t}-${d||"unified"}`)},H=s=>e.jsx("div",{style:{borderTop:"1px solid var(--nice-border-color, #333)"},children:s.chunks.map((t,d)=>{const u=`${s.path}:${d}`;return P.has(u),e.jsxs("div",{children:[e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>x(s.path,d),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:["@@ -",t.oldStart,",",t.oldLines," +",t.newStart,",",t.newLines," @@"," ",t.header||""]}),t.lines.map((I,te)=>p(I,te))]},d)})}),q=s=>e.jsx("div",{style:{borderTop:"1px solid var(--nice-border-color, #333)"},children:s.chunks.map((t,d)=>{const u=[],I=[];for(const Q of t.lines)(Q.type==="deletion"||Q.type==="context")&&u.push(Q),(Q.type==="addition"||Q.type==="context")&&I.push(Q);const te=Math.max(u.length,I.length);for(;u.length<te;)u.push({content:"",type:"context"});for(;I.length<te;)I.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:["@@ -",t.oldStart,",",t.oldLines," +",t.newStart,",",t.newLines," @@"," ",t.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((Q,m)=>p(Q,m,"old"))}),e.jsx("div",{style:{flex:1},children:I.map((Q,m)=>p(Q,m,"new"))})]})]},d)})});return e.jsxs("div",{className:`nice-git-diff-viewer ${C||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...k},"data-testid":B,children:[L&&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.NiceIcon,{name:"folder",size:16}),e.jsx("span",{style:{fontWeight:600,fontSize:13},children:v("gitDiffViewer.changedFiles","Changed Files")}),e.jsx("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"var(--nice-bg-tertiary, #333)",borderRadius:10,fontSize:11},children:l.length})]}),(A||T)&&e.jsxs("div",{style:{fontSize:11,color:"var(--nice-text-muted, #888)"},children:[A&&e.jsx("span",{children:A}),A&&T&&e.jsx("span",{style:{margin:"0 4px"},children:e.jsx(n.NiceIcon,{name:"arrow-right",size:12})}),T&&e.jsx("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:T})]})]}),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:["+",V.additions]}),e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",V.deletions]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:l.map(s=>{const t=E(s.status),d=s.path===J;return e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>Z(s.path),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",cursor:"pointer",background:d?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderLeft:d?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:2,background:t.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--nice-color-white, #fff)",fontWeight:600},children:t.icon}),e.jsx("span",{style:{flex:1,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.path.split("/").pop()}),e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10},children:[s.additions>0&&e.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:["+",s.additions]}),s.deletions>0&&e.jsxs("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:["-",s.deletions]})]})]},s.path)})})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",background:"var(--nice-bg-elevated, #252525)",display:"flex",alignItems:"center",gap:16},children:[X&&e.jsx("div",{style:{flex:1,fontSize:13,fontFamily:"monospace"},children:X.oldPath&&X.oldPath!==X.path?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--nice-color-error, #ef4444)"},children:X.oldPath}),e.jsx("span",{style:{margin:"0 8px",color:"var(--nice-text-muted, #888)"},children:e.jsx(n.NiceIcon,{name:"arrow-right",size:12})}),e.jsx("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:X.path})]}):X.path}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>f("unified"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:D==="unified"?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:D==="unified"?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:v("gitDiffViewer.unified","Unified")}),e.jsx("button",{onClick:()=>f("split"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:D==="split"?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:D==="split"?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:11},children:v("gitDiffViewer.split","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:Y,onChange:s=>y(s.target.checked)}),v("gitDiffViewer.showWhitespace","Show whitespace")]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:X?X.binary?e.jsxs("div",{style:{padding:40,textAlign:"center",color:"var(--nice-text-muted, #888)"},children:[e.jsx(n.NiceIcon,{name:"box",size:48}),e.jsx("p",{children:v("gitDiffViewer.binaryFileCannotBeDisplayed","Binary file cannot be displayed")})]}):D==="split"?q(X):H(X):e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--nice-text-muted, #666)"},children:v("gitDiffViewer.selectAFileToView","Select a file to view changes")})}),g.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.jsx("div",{style:{padding:"8px 16px",fontSize:12,fontWeight:600,borderBottom:"1px solid var(--nice-border-color, #333)"},children:v("gitDiffViewer.comments","Comments ({fileComments})").replace("{fileComments}",String(g.length))}),g.map(s=>e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--nice-border-color, #333)",opacity:s.resolved?.5:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[s.author.avatar?e.jsx("img",{src:s.author.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"var(--nice-bg-tertiary, #666)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:s.author.name[0]}),e.jsx("span",{style:{fontSize:12,fontWeight:500},children:s.author.name}),e.jsx("span",{style:{fontSize:10,color:"var(--nice-text-muted, #888)"},children:(s.side==="old"?v("gitDiffViewer.lineOld","Line {line} (old)"):v("gitDiffViewer.lineNew","Line {line} (new)")).replace("{line}",String(s.line))}),s.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:v("gitDiffViewer.resolved","Resolved")}),z&&!s.resolved&&e.jsx("button",{onClick:()=>z(s.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:v("gitDiffViewer.resolve","Resolve")})]}),e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-secondary, #ccc)"},children:s.body})]},s.id))]}),a&&e.jsx("div",{role:"presentation",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:()=>W(null),children:e.jsxs("div",{role:"presentation",style:{width:400,background:"var(--nice-bg-elevated, #252525)",borderRadius:8,padding:20},onClick:s=>s.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 12px",fontSize:14},children:v("gitDiffViewer.addCommentOnLine","Add comment on line {line}").replace("{line}",String(a.line))}),e.jsx("textarea",{value:a.body,onChange:s=>W({...a,body:s.target.value}),placeholder:v("gitDiffViewer.writeAComment","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-text-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:()=>W(null),style:{padding:"8px 16px",borderRadius:4,border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:12},children:v("gitDiffViewer.cancel","Cancel")}),e.jsx("button",{onClick:()=>{a.body.trim()&&(O?.(a.filePath,a.line,a.side,a.body.trim()),W(null))},disabled:!a.body.trim(),style:{padding:"8px 16px",borderRadius:4,border:"none",background:a.body.trim()?"var(--nice-color-primary, #3b82f6)":"var(--nice-bg-tertiary, #333)",color:a.body.trim()?"var(--nice-color-white, #fff)":"var(--nice-text-primary, #fff)",cursor:a.body.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:v("gitDiffViewer.addComment2","Add Comment")})]})]})})]})]})},it=Object.freeze(Object.defineProperty({__proto__:null,NiceGitDiffViewer:Ee},Symbol.toStringTag,{value:"Module"})),ot=(l,h)=>{const M=new Date().getTime()-l.getTime(),_=Math.floor(M/(1e3*60*60*24));return _===0?"today":_===1?"yesterday":_<7?`${_} days ago`:_<30?`${Math.floor(_/7)} weeks ago`:_<365?`${Math.floor(_/30)} months ago`:`${Math.floor(_/365)} years ago`},st=l=>{const w=new Date().getTime()-l.getTime(),M=Math.floor(w/(1e3*60*60*24));return M<7?"var(--nice-primary-tint-30, rgba(59, 130, 246, 0.3))":M<30?"var(--nice-success-tint-30, rgba(34, 197, 94, 0.3))":M<90?"var(--nice-warning-tint-30, rgba(234, 179, 8, 0.3))":M<365?"var(--nice-warning-tint-30, rgba(249, 115, 22, 0.3))":"var(--nice-danger-tint-30, rgba(239, 68, 68, 0.3))"},le=l=>{const h=["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 w=0;for(let M=0;M<l.length;M++)w=(w<<5)-w+l.charCodeAt(M),w=w&w;return h[Math.abs(w)%h.length]},Te=({file:l,viewMode:h="inline",showAgeHeatmap:w=!0,showAvatars:M=!0,groupHunks:_=!0,highlightOnHover:L=!0,timeZone:$,dateRange:A,authorFilter:T,selectedLine:N,syntaxTheme:S="dark",onLineClick:O,onCommitClick:z,onAuthorClick:j,onBlameParent:C,className:k,style:B,"data-testid":v="nice-git-blame"})=>{const{t:i}=n.useNiceTranslation(),[R,G]=o.useState(null),[y,ee]=o.useState(null),[K,P]=o.useState(null),c=o.useMemo(()=>{const x=[];return l.hunks.forEach(g=>{g.lines.forEach(E=>{x.push(E)})}),x.sort((g,E)=>g.lineNumber-E.lineNumber)},[l.hunks]),a=o.useMemo(()=>c.filter(x=>!(A?.from&&x.commit.timestamp<A.from||A?.to&&x.commit.timestamp>A.to||T&&T.length>0&&!T.includes(x.commit.author.id))),[c,A,T]),W=o.useMemo(()=>{if(!_)return a.map(p=>({startLine:p.lineNumber,endLine:p.lineNumber,commit:p.commit,lines:[p],isFirstOfCommit:!0}));const x=[];let g=null;const E=new Set;return a.forEach(p=>{if(!g||g.commit.id!==p.commit.id){const H=!E.has(p.commit.id);E.add(p.commit.id),g={startLine:p.lineNumber,endLine:p.lineNumber,commit:p.commit,lines:[p],isFirstOfCommit:H},x.push(g)}else g.endLine=p.lineNumber,g.lines.push(p)}),x},[a,_]),D=o.useMemo(()=>{const x=new Map;return c.forEach(g=>{x.has(g.commit.author.id)||x.set(g.commit.author.id,g.commit.author)}),Array.from(x.values())},[c]),Y=o.useMemo(()=>{const x=new Map;return c.forEach(g=>{x.has(g.commit.id)||x.set(g.commit.id,g.commit)}),Array.from(x.values()).sort((g,E)=>E.timestamp.getTime()-g.timestamp.getTime())},[c]),J=o.useCallback(x=>{O?.(x)},[O]),X=o.useCallback((x,g)=>{g.stopPropagation(),y===x.id?ee(null):ee(x.id),z?.(x)},[y,z]),V=(x,g)=>{const E=g===0,p=x.commit,H=L&&R===p.id;return e.jsxs("div",{role:E?"button":void 0,tabIndex:E?0:void 0,onKeyDown:E?n.clickOnActivationKey:void 0,style:{display:"flex",alignItems:"center",gap:8,padding:"0 12px",minWidth:h==="inline"?280:40,background:H?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":w?st(p.timestamp):"transparent",borderRight:`3px solid ${le(p.author.id)}`,cursor:"pointer",transition:"background 0.15s"},onMouseEnter:()=>G(p.id),onMouseLeave:()=>G(null),onClick:q=>X(p,q),children:[E&&h==="inline"&&e.jsxs(e.Fragment,{children:[M&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:le(p.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,color:"var(--nice-text-primary, #0f172a)",fontWeight:500,flexShrink:0},title:p.author.name,children:p.author.avatar?e.jsx("img",{src:p.author.avatar,alt:p.author.name,style:{width:"100%",height:"100%",borderRadius:"50%"}}):p.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:p.shortId}),e.jsx("div",{style:{fontSize:10,color:"var(--nice-text-muted, #9ca3af)",whiteSpace:"nowrap"},children:ot(p.timestamp)})]})]}),h==="gutter"&&E&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:le(p.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--nice-text-primary, #0f172a)"},title:`${p.author.name} - ${p.shortId}
|
|
2
|
+
${p.message}`,children:p.author.name[0].toUpperCase()})]})},Z=x=>{if(K!==x.lineNumber||h!=="tooltip")return null;const g=x.commit;return e.jsxs("div",{style:{position:"absolute",left:60,top:-8,zIndex:100,background:"var(--nice-bg-elevated, #ffffff)",border:"1px solid var(--nice-border-color, #e2e8f0)",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:le(g.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-primary, #0f172a)",fontWeight:500},children:g.author.name[0].toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,color:"var(--nice-text-secondary, #475569)"},children:g.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #9ca3af)"},children:g.author.email})]})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12,color:"var(--nice-color-primary-light, #60a5fa)",marginBottom:4},children:g.shortId}),e.jsx("div",{style:{fontSize:13,color:"var(--nice-text-secondary, #475569)",marginBottom:8},children:g.message}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #6b7280)"},children:g.timestamp.toLocaleString()}),g.parents&&g.parents.length>0&&C&&e.jsxs("button",{onClick:()=>C(g),style:{marginTop:8,padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-secondary, #475569)",fontSize:11,cursor:"pointer"},children:[e.jsx(n.NiceIcon,{name:"arrow-up",size:11})," ",i("gitBlame.blameParent","Blame parent")]})]})},f=x=>y!==x.id?null:e.jsx("div",{style:{background:"var(--nice-bg-elevated, #ffffff)",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",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:le(x.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-primary, #0f172a)",fontSize:20,fontWeight:500,flexShrink:0},children:x.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-text-secondary, #475569)"},children:x.author.name}),e.jsx("span",{style:{fontSize:11,color:"var(--nice-text-muted, #6b7280)"},children:x.author.email})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13,color:"var(--nice-color-primary-light, #60a5fa)",marginBottom:8},children:x.id}),e.jsx("div",{style:{fontSize:14,color:"var(--nice-text-secondary, #475569)",marginBottom:8,lineHeight:1.5},children:x.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.NiceIcon,{name:"calendar",size:12})," ",x.timestamp.toLocaleString()]}),x.parents&&x.parents.length>0&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(n.NiceIcon,{name:"cursor",size:12})," ",i("gitBlame.parentS","{parents} parent(s)").replace("{parents}",String(x.parents.length))]})]}),C&&x.parents&&x.parents.length>0&&e.jsxs("button",{onClick:()=>C(x),style:{marginTop:12,padding:"6px 12px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",fontSize:12,cursor:"pointer"},children:[e.jsx(n.NiceIcon,{name:"arrow-up",size:12})," ",i("gitBlame.blameInParentCommit","Blame in parent commit")]})]})]})});return e.jsxs("div",{className:`nice-git-blame ${k||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:S==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-primary, #ffffff)",color:S==="dark"?"var(--nice-text-primary, #e6edf3)":"var(--nice-text-primary, #ffffff)",fontFamily:"system-ui, sans-serif",...B},"data-testid":v,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:S==="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.NiceIcon,{name:"clipboard",size:16}),e.jsx("span",{style:{fontWeight:500},children:l.path}),e.jsx("span",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:i("gitBlame.at","at {revision}").replace("{revision}",String(l.revision.substring(0,7)))})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:e.jsx("span",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:i("gitBlame.commitsByAuthorS","{commits} commits by {authors} author(s)").replace("{commits}",String(Y.length)).replace("{authors}",String(D.length))})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:S==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",flexWrap:"wrap"},children:[D.slice(0,10).map(x=>e.jsxs("div",{role:j?"button":void 0,tabIndex:j?0:void 0,onKeyDown:j?n.clickOnActivationKey:void 0,onClick:()=>j?.(x),style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer"},children:[e.jsx("div",{style:{width:12,height:12,borderRadius:"50%",background:le(x.id)}}),e.jsx("span",{style:{fontSize:12},children:x.name})]},x.id)),D.length>10&&e.jsx("span",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:i("gitBlame.more","+{authors} more").replace("{authors}",String(D.length-10))})]}),e.jsx("div",{style:{flex:1,overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,lineHeight:"20px"},children:W.map((x,g)=>e.jsxs(o.Fragment,{children:[x.isFirstOfCommit&&y===x.commit.id&&f(x.commit),x.lines.map((E,p)=>e.jsxs("div",{role:"presentation",onClick:()=>J(E),onMouseEnter:()=>P(E.lineNumber),onMouseLeave:()=>P(null),style:{display:"flex",alignItems:"stretch",background:N===E.lineNumber?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":L&&R===x.commit.id?"var(--nice-primary-tint-8, rgba(59, 130, 246, 0.08))":"transparent",borderLeft:N===E.lineNumber?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",position:"relative"},children:[V(x,p),e.jsx("div",{style:{padding:"0 12px",color:"var(--nice-text-muted, #6e7681)",textAlign:"right",minWidth:50,userSelect:"none",background:S==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-secondary, #f6f8fa)",borderRight:"1px solid var(--nice-border, #30363d)"},children:E.lineNumber}),e.jsx("div",{style:{flex:1,padding:"0 16px",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:E.content}),h==="tooltip"&&Z(E)]},E.lineNumber))]},`${x.commit.id}-${x.startLine}`))}),w&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,padding:"8px 16px",borderTop:"1px solid var(--nice-border, #30363d)",background:S==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",fontSize:11,color:"var(--nice-text-muted, #8b949e)"},children:[e.jsx("span",{children:i("gitBlame.age","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:i("gitBlame.n1Week","<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:i("gitBlame.n1Month","<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:i("gitBlame.n3Months","<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:i("gitBlame.n1Year","<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:i("gitBlame.n1Year2",">1 year")})]})]})]})},at=Object.freeze(Object.defineProperty({__proto__:null,NiceGitBlame:Te},Symbol.toStringTag,{value:"Module"})),lt=l=>{if(!l.resolved)return[];switch(l.resolution){case"ours":return l.oursContent;case"theirs":return l.theirsContent;case"both":return[...l.oursContent,...l.theirsContent];case"custom":return l.customContent||[];default:return[]}},_e=({file:l,context:h,viewMode:w="split",showLineNumbers:M=!0,showBase:_=!1,currentConflictIndex:L,syntaxTheme:$="dark",onResolve:A,onResolveAll:T,onNavigateConflict:N,onSave:S,onCancel:O,className:z,style:j,"data-testid":C="nice-git-conflict-resolver"})=>{const{t:k}=n.useNiceTranslation(),[B,v]=o.useState(l.conflicts),[i,R]=o.useState(L??0),[G,y]=o.useState(null),[ee,K]=o.useState(""),P=o.useMemo(()=>B.filter(p=>!p.resolved).length,[B]),c=o.useMemo(()=>B.filter(p=>p.resolved).length,[B]),a=B[i],W=o.useCallback((p,H,q)=>{v(t=>t.map(d=>d.id===p?{...d,resolved:!0,resolution:H,customContent:q}:d)),y(null),A?.(p,H,q);const s=B.findIndex((t,d)=>d>i&&!t.resolved);s!==-1&&(R(s),N?.(s))},[B,i,A,N]),D=o.useCallback(p=>{v(H=>H.map(q=>q.resolved?q:{...q,resolved:!0,resolution:p})),T?.(p)},[T]),Y=o.useCallback(p=>{const H=p==="prev"?Math.max(0,i-1):Math.min(B.length-1,i+1);R(H),N?.(H)},[i,B.length,N]),J=o.useCallback(()=>{a&&(y(a.id),K(a.oursContent.join(`
|
|
3
|
+
`)))},[a]),X=o.useCallback(()=>{G&&W(G,"custom",ee.split(`
|
|
4
|
+
`))},[G,ee,W]),V=o.useCallback(()=>{const p=l.content.split(`
|
|
5
|
+
`);let H=[],q=0;B.forEach(s=>{H=[...H,...p.slice(q,s.startLine-1)],H=[...H,...lt(s)],q=s.endLine}),H=[...H,...p.slice(q)],S?.(H.join(`
|
|
6
|
+
`))},[l.content,B,S]),Z=(p,H,q,s)=>e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,borderLeft:`3px solid ${q}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:`${q}20`,borderBottom:"1px solid var(--nice-border, #30363d)"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:500,color:q},children:p}),s&&e.jsx("button",{onClick:s,style:{padding:"4px 10px",background:q,border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",fontSize:11,cursor:"pointer"},children:k("gitConflictResolver.accept","Accept")})]}),e.jsx("div",{style:{flex:1,overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,lineHeight:"20px"},children:H.map((t,d)=>e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:$==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-primary, #fff)"},children:[M&&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:d+1}),e.jsx("span",{style:{padding:"0 12px",whiteSpace:"pre"},children:t||" "})]},d))})]}),f=()=>a?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:[e.jsx(n.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.oursBranch","Ours ({branch})").replace("{branch}",h?.oursCommit.branch||"HEAD")]}),e.jsx("button",{onClick:()=>W(a.id,"ours"),style:{padding:"4px 10px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",fontSize:11,cursor:"pointer"},children:k("gitConflictResolver.acceptOurs","Accept Ours")})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:a.oursContent.join(`
|
|
7
|
+
`)})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 12px",background:"var(--nice-bg-elevated, #ffffff)"},children:[e.jsx("div",{style:{flex:1,height:1,background:"var(--nice-border-color, #e2e8f0)"}}),e.jsx("span",{style:{color:"var(--nice-text-muted, #9ca3af)",fontSize:11},children:k("gitConflictResolver.vs","VS")}),e.jsx("div",{style:{flex:1,height:1,background:"var(--nice-border-color, #e2e8f0)"}})]}),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:[e.jsx(n.NiceIcon,{name:"arrow-right",size:14})," ",k("gitConflictResolver.theirsBranch","Theirs ({branch})").replace("{branch}",h?.theirsCommit.branch||"incoming")]}),e.jsx("button",{onClick:()=>W(a.id,"theirs"),style:{padding:"4px 10px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",fontSize:11,cursor:"pointer"},children:k("gitConflictResolver.acceptTheirs","Accept Theirs")})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:a.theirsContent.join(`
|
|
8
|
+
`)})]})]}):null,x=()=>a?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[Z(e.jsxs(e.Fragment,{children:[e.jsx(n.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.oursBranch","Ours ({branch})").replace("{branch}",h?.oursCommit.branch||"HEAD")]}),a.oursContent,"var(--nice-color-success, #22c55e)",()=>W(a.id,"ours")),_&&Z(k("gitConflictResolver.baseAncestor","Base (ancestor)"),a.baseContent,"var(--nice-text-muted, #6b7280)"),Z(e.jsxs(e.Fragment,{children:[e.jsx(n.NiceIcon,{name:"arrow-right",size:14})," ",k("gitConflictResolver.theirsBranch","Theirs ({branch})").replace("{branch}",h?.theirsCommit.branch||"incoming")]}),a.theirsContent,"var(--nice-color-primary, #3b82f6)",()=>W(a.id,"theirs"))]}):null,g=()=>a?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[Z(e.jsxs(e.Fragment,{children:[e.jsx(n.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.oursBranch","Ours ({branch})").replace("{branch}",h?.oursCommit.branch||"HEAD")]}),a.oursContent,"var(--nice-color-success, #22c55e)",()=>W(a.id,"ours")),Z(k("gitConflictResolver.base","Base"),a.baseContent,"var(--nice-text-muted, #6b7280)"),Z(e.jsxs(e.Fragment,{children:[e.jsx(n.NiceIcon,{name:"arrow-right",size:14})," ",k("gitConflictResolver.theirsBranch","Theirs ({branch})").replace("{branch}",h?.theirsCommit.branch||"incoming")]}),a.theirsContent,"var(--nice-color-primary, #3b82f6)",()=>W(a.id,"theirs"))]}):null,E=()=>G!==a?.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-bg-elevated, #ffffff)",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",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.NiceIcon,{name:"edit",size:14})," ",k("gitConflictResolver.editResolution","Edit Resolution")]}),e.jsx("button",{onClick:()=>y(null),"aria-label":k("gitConflictResolver.closeEditor","Close editor"),style:{background:"transparent",border:"none",color:"var(--nice-text-muted, #9ca3af)",cursor:"pointer",fontSize:18},children:e.jsx(n.NiceIcon,{name:"close",size:18})})]}),e.jsx("textarea",{value:ee,onChange:p=>K(p.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-border-color, #e2e8f0)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>y(null),style:{padding:"8px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},children:k("gitConflictResolver.cancel","Cancel")}),e.jsx("button",{onClick:X,style:{padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer"},children:k("gitConflictResolver.saveChanges","Save Changes")})]})]})});return e.jsxs("div",{className:`nice-git-conflict-resolver ${z||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:$==="dark"?"var(--nice-bg-canvas, #0d1117)":"var(--nice-bg-primary, #ffffff)",color:$==="dark"?"var(--nice-text-primary, #e6edf3)":"var(--nice-text-primary, #ffffff)",fontFamily:"system-ui, sans-serif",position:"relative",...j},"data-testid":C,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:$==="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.NiceIcon,{name:"warning",size:18}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:l.path}),e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:k("gitConflictResolver.conflictSResolvedRemaining","{conflicts} conflict(s) • {resolvedCount} resolved • {unresolvedCount} remaining").replace("{conflicts}",String(B.length)).replace("{resolvedCount}",String(c)).replace("{unresolvedCount}",String(P))})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:O,style:{padding:"6px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},children:k("gitConflictResolver.cancel","Cancel")}),e.jsxs("button",{onClick:V,disabled:P>0,style:{padding:"6px 12px",background:P>0?"var(--nice-bg-tertiary, #e2e8f0)":"var(--nice-color-success, #22c55e)",border:"none",borderRadius:6,color:P>0?"var(--nice-text-muted, #94a3b8)":"var(--nice-color-white, #fff)",cursor:P>0?"not-allowed":"pointer",opacity:P>0?.5:1,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"check",size:14})," ",k("gitConflictResolver.saveResolved","Save Resolved")]})]})]}),h&&e.jsxs("div",{style:{display:"flex",gap:24,padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:$==="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.jsxs("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(n.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.oursLabel","Ours:")]}),e.jsx("span",{children:h.oursCommit.branch}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #8b949e)",fontFamily:"monospace"},children:["(",h.oursCommit.shortId,")"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("span",{style:{color:"var(--nice-color-primary, #3b82f6)"},children:[e.jsx(n.NiceIcon,{name:"arrow-right",size:14})," ",k("gitConflictResolver.theirsLabel","Theirs:")]}),e.jsx("span",{children:h.theirsCommit.branch}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #8b949e)",fontFamily:"monospace"},children:["(",h.theirsCommit.shortId,")"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:$==="dark"?"var(--nice-bg-elevated, #ffffff)":"var(--nice-bg-secondary, #f0f0f0)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsxs("button",{onClick:()=>Y("prev"),disabled:i===0,style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:i===0?"not-allowed":"pointer",opacity:i===0?.5:1},children:[e.jsx(n.NiceIcon,{name:"arrow-left",size:14})," ",k("gitConflictResolver.prev","Prev")]}),e.jsxs("span",{style:{padding:"0 8px"},children:[k("gitConflictResolver.conflictOf","Conflict {current} of {total}").replace("{current}",String(i+1)).replace("{total}",String(B.length)),a?.resolved&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginLeft:8,color:"var(--nice-color-success, #22c55e)"},children:[e.jsx(n.NiceIcon,{name:"check",size:14})," ",k("gitConflictResolver.resolved","Resolved")]})]}),e.jsxs("button",{onClick:()=>Y("next"),disabled:i===B.length-1,style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:i===B.length-1?"not-allowed":"pointer",opacity:i===B.length-1?.5:1},children:[k("gitConflictResolver.next","Next")," ",e.jsx(n.NiceIcon,{name:"arrow-right",size:14})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>D("ours"),disabled:P===0,style:{padding:"4px 10px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",fontSize:11,cursor:P===0?"not-allowed":"pointer",opacity:P===0?.5:1},children:k("gitConflictResolver.acceptAllOurs","Accept All Ours")}),e.jsx("button",{onClick:()=>D("theirs"),disabled:P===0,style:{padding:"4px 10px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",fontSize:11,cursor:P===0?"not-allowed":"pointer",opacity:P===0?.5:1},children:k("gitConflictResolver.acceptAllTheirs","Accept All Theirs")})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[a&&!a.resolved&&e.jsxs(e.Fragment,{children:[w==="inline"&&f(),w==="split"&&x(),w==="three-way"&&g()]}),a?.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.NiceIcon,{name:"check",size:48}),e.jsx("span",{style:{fontSize:18},children:k("gitConflictResolver.conflictResolved","Conflict Resolved")}),e.jsx("span",{style:{color:"var(--nice-text-muted, #8b949e)",fontSize:13},children:k("gitConflictResolver.resolution","Resolution: {resolution}").replace("{resolution}",String(a.resolution??""))}),e.jsxs("button",{onClick:()=>v(p=>p.map(H=>H.id===a.id?{...H,resolved:!1,resolution:void 0}:H)),style:{padding:"8px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"reply",size:14})," ",k("gitConflictResolver.reResolve","Re-resolve")]})]})]}),a&&!a.resolved&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,padding:"12px 16px",borderTop:"1px solid var(--nice-border, #30363d)",background:$==="dark"?"var(--nice-bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsxs("button",{onClick:()=>W(a.id,"ours"),style:{padding:"8px 20px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"check",size:14})," ",k("gitConflictResolver.acceptOurs","Accept Ours")]}),e.jsxs("button",{onClick:()=>W(a.id,"theirs"),style:{padding:"8px 20px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"check",size:14})," ",k("gitConflictResolver.acceptTheirs","Accept Theirs")]}),e.jsxs("button",{onClick:()=>W(a.id,"both"),style:{padding:"8px 20px",background:"var(--nice-color-accent, #8b5cf6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"shuffle",size:14})," ",k("gitConflictResolver.acceptBoth","Accept Both")]}),e.jsxs("button",{onClick:J,style:{padding:"8px 20px",background:"var(--nice-color-warning, #f59e0b)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"edit",size:14})," ",k("gitConflictResolver.editManually","Edit Manually")]})]}),E()]})},ct=Object.freeze(Object.defineProperty({__proto__:null,NiceGitConflictResolver:_e},Symbol.toStringTag,{value:"Module"})),ge={"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"}},dt=[{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}]}],Ae=({hooks:l,defaultHooks:h,templates:w=dt,manager:M="husky",repoPath:_,selectedHook:L,onHookChange:$,onHooksChange:A,onHookToggle:T,onActionAdd:N,onActionRemove:S,onActionUpdate:O,onInstall:z,onUninstall:j,onExport:C,className:k,style:B,"data-testid":v="nice-git-hooks"})=>{const{t:i}=n.useNiceTranslation(),R=l!==void 0&&A!==void 0,G=o.useRef([]),y=o.useCallback(t=>{const d=G.current;G.current=t,$&&t.filter(u=>!d.includes(u)).forEach(u=>$(u)),A?.(t)},[$,A]),[ee,K]=n.useControllableState({value:R?l:void 0,defaultValue:R?h:h??l,fallbackValue:[],onChange:y,componentName:"NiceGitHooks"});G.current=ee,we("NiceGitHooks","hooks","onHooksChange",l,R);const[P,c]=o.useState(L||null),[a,W]=o.useState(!1),[D,Y]=o.useState(null),[J,X]=o.useState(!1),V=o.useMemo(()=>ee.find(t=>t.type===P),[ee,P]),Z=o.useCallback((t,d)=>{K(u=>u.map(I=>I.type===t?{...I,enabled:d}:I)),T?.(t,d)},[T,K]),f=o.useCallback(t=>{if(!P)return;const d=t?t.actions.map((u,I)=>({...u,id:n.createId(),order:(V?.actions.length||0)+I})):[{id:n.createId(),type:"custom",name:"New Action",command:'echo "Hello"',order:V?.actions.length||0,enabled:!0,failOnError:!0}];K(u=>u.map(I=>I.type===P?{...I,actions:[...I.actions,...d]}:I)),d.forEach(u=>N?.(P,u)),W(!1)},[P,V,N,K]),x=o.useCallback(t=>{P&&(K(d=>d.map(u=>u.type===P?{...u,actions:u.actions.filter(I=>I.id!==t)}:u)),S?.(P,t))},[P,S,K]),g=o.useCallback(t=>{P&&(K(d=>d.map(u=>u.type===P?{...u,actions:u.actions.map(I=>I.id===t.id?t:I)}:u)),Y(null),O?.(P,t))},[P,O,K]),E=o.useCallback((t,d)=>{if(!V)return;const u=[...V.actions],I=u.findIndex(Q=>Q.id===t);if(I===-1)return;const te=d==="up"?I-1:I+1;te<0||te>=u.length||([u[I],u[te]]=[u[te],u[I]],u.forEach((Q,m)=>Q.order=m),K(Q=>Q.map(m=>m.type===P?{...m,actions:u}:m)))},[V,P,K]),p=o.useCallback(t=>{const d=["#!/bin/sh",""];return t.verbose&&d.push("set -x"),d.push("# Generated by NiceGitHooks",`# Hook: ${t.type}`,""),t.actions.forEach(u=>{if(!u.enabled){d.push(`# [DISABLED] ${u.name}`);return}if(d.push(`# ${u.name}`),u.condition){const{type:te,operator:Q,value:m}=u.condition;te==="branch"?(d.push("BRANCH=$(git rev-parse --abbrev-ref HEAD)"),Q==="equals"?d.push(`if [ "$BRANCH" != "${m}" ]; then exit 0; fi`):Q==="matches"&&d.push(`if ! echo "$BRANCH" | grep -q "${m}"; then exit 0; fi`)):te==="env"&&d.push(`if [ -z "$${m}" ]; then exit 0; fi`)}let I=u.command;u.runOn==="staged"&&u.filePatterns?.length&&(u.filePatterns.map(te=>`'${te}'`).join(" "),I=`git diff --cached --name-only --diff-filter=ACM | grep -E "${u.filePatterns.join("|")}" | xargs ${I}`),d.push(I),u.failOnError&&(d.push("if [ $? -ne 0 ]; then"),d.push(` echo "❌ ${u.name} failed""`),d.push(" exit 1"),d.push("fi")),d.push("")}),d.push("exit 0"),d.join(`
|
|
9
|
+
`)},[]),H=t=>({lint:"search",test:"flask",format:"edit",typecheck:"book",build:"settings",custom:"settings"})[t],q=()=>D?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-bg-elevated, #ffffff)",borderRadius:12,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",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.NiceIcon,{name:"edit",size:16})," ",i("gitHooks.editAction","Edit Action")]}),e.jsx("button",{onClick:()=>Y(null),"aria-label":i("gitHooks.close","Close"),style:{background:"none",border:"none",color:"var(--nice-text-muted, #9ca3af)",cursor:"pointer",fontSize:20},children:e.jsx(n.NiceIcon,{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:i("gitHooks.name","Name")}),e.jsx("input",{type:"text",value:D.name,onChange:t=>Y({...D,name:t.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:i("gitHooks.type","Type")}),e.jsxs("select",{value:D.type,onChange:t=>Y({...D,type:t.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)"},children:[e.jsx("option",{value:"lint",children:i("gitHooks.lint","Lint")}),e.jsx("option",{value:"test",children:i("gitHooks.test","Test")}),e.jsx("option",{value:"format",children:i("gitHooks.format","Format")}),e.jsx("option",{value:"typecheck",children:i("gitHooks.typecheck","Typecheck")}),e.jsx("option",{value:"build",children:i("gitHooks.build","Build")}),e.jsx("option",{value:"custom",children:i("gitHooks.custom","Custom")})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:i("gitHooks.command","Command")}),e.jsx("textarea",{value:D.command,onChange:t=>Y({...D,command:t.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",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:i("gitHooks.runOn","Run On")}),e.jsxs("select",{value:D.runOn||"all",onChange:t=>Y({...D,runOn:t.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)"},children:[e.jsx("option",{value:"all",children:i("gitHooks.allFiles","All files")}),e.jsx("option",{value:"staged",children:i("gitHooks.stagedFilesOnly","Staged files only")}),e.jsx("option",{value:"changed",children:i("gitHooks.changedFiles","Changed files")})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--nice-text-muted, #9ca3af)",marginBottom:4},children:i("gitHooks.filePatternsCommaSeparated","File Patterns (comma-separated)")}),e.jsx("input",{type:"text",value:D.filePatterns?.join(", ")||"",onChange:t=>Y({...D,filePatterns:t.target.value.split(",").map(d=>d.trim()).filter(Boolean)}),placeholder:i("gitHooks.tsTsxJs","*.ts, *.tsx, *.js"),style:{width:"100%",padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"1px solid var(--nice-border-color, #cbd5e1)",borderRadius:6,color:"var(--nice-text-primary, #0f172a)"}})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:D.enabled,onChange:t=>Y({...D,enabled:t.target.checked})}),e.jsx("span",{style:{fontSize:13},children:i("gitHooks.enabled","Enabled")})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:D.failOnError,onChange:t=>Y({...D,failOnError:t.target.checked})}),e.jsx("span",{style:{fontSize:13},children:i("gitHooks.failOnError","Fail on error")})]})]})]}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>Y(null),style:{padding:"8px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},children:i("gitHooks.cancel","Cancel")}),e.jsx("button",{onClick:()=>g(D),style:{padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer"},children:i("gitHooks.save","Save")})]})]})}):null,s=()=>{if(!J||!V)return null;const t=p(V);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-bg-elevated, #ffffff)",borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",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.NiceIcon,{name:"file",size:16})," ",i("gitHooks.scriptPreview","Script Preview: {type}").replace("{type}",String(V.type))]}),e.jsx("button",{onClick:()=>X(!1),"aria-label":i("gitHooks.close","Close"),style:{background:"none",border:"none",color:"var(--nice-text-muted, #9ca3af)",cursor:"pointer",fontSize:20},children:e.jsx(n.NiceIcon,{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:t}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(t)},style:{padding:"8px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"clipboard",size:14})," ",i("gitHooks.copy","Copy")]}),e.jsx("button",{onClick:()=>X(!1),style:{padding:"8px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer"},children:i("gitHooks.close","Close")})]})]})})};return e.jsxs("div",{className:`nice-git-hooks ${k||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-canvas, #0d1117)",color:"var(--nice-text-primary, #e6edf3)",fontFamily:"system-ui, sans-serif",...B},"data-testid":v,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.NiceIcon,{name:"link",size:16})," ",i("gitHooks.gitHooks","Git Hooks")]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:Object.entries(ge).map(([t,d])=>{const u=ee.find(Q=>Q.type===t),I=P===t,te=u?.actions.length||0;return e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>c(t),style:{padding:"12px 16px",cursor:"pointer",background:I?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderLeft:I?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.NiceIcon,{name:d.icon,size:18}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:500},children:d.title}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #8b949e)"},children:te!==1?i("gitHooks.actionsMany","{actionCount} actions").replace("{actionCount}",String(te)):i("gitHooks.actionsOne","{actionCount} action").replace("{actionCount}",String(te))})]}),e.jsx("button",{onClick:Q=>{Q.stopPropagation(),Z(t,!u?.enabled)},style:{width:36,height:20,borderRadius:10,background:u?.enabled?"var(--nice-color-success, #22c55e)":"var(--nice-bg-tertiary, #cbd5e1)",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"}})})]},t)})}),e.jsx("div",{style:{padding:12,borderTop:"1px solid var(--nice-border, #30363d)",display:"flex",gap:8},children:e.jsx("button",{onClick:()=>C?.(ee,"husky"),style:{flex:1,padding:"8px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",fontSize:12,cursor:"pointer"},children:i("gitHooks.export","Export")})})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:V?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.NiceIcon,{name:ge[V.type].icon,size:24}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:18,fontWeight:500},children:ge[V.type].title}),e.jsx("div",{style:{fontSize:12,color:"var(--nice-text-muted, #8b949e)"},children:ge[V.type].description})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12},children:[e.jsxs("button",{onClick:()=>X(!0),style:{padding:"6px 12px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",fontSize:12,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"file",size:14})," ",i("gitHooks.previewScript","Preview Script")]}),e.jsxs("button",{onClick:()=>z?.(V.type),style:{padding:"6px 12px",background:"var(--nice-color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",fontSize:12,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"download",size:14})," ",i("gitHooks.install","Install")]}),e.jsxs("button",{onClick:()=>j?.(V.type),style:{padding:"6px 12px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",fontSize:12,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"close",size:14})," ",i("gitHooks.uninstall","Uninstall")]})]})]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:V.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.NiceIcon,{name:"box",size:48}),e.jsx("span",{style:{marginTop:16},children:i("gitHooks.noActionsConfigured","No actions configured")}),e.jsx("span",{style:{fontSize:12,marginTop:4},children:i("gitHooks.addAnActionFromTemplates","Add an action from templates or create a custom one")})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:V.actions.sort((t,d)=>t.order-d.order).map((t,d)=>e.jsxs("div",{style:{padding:16,background:"var(--nice-bg-elevated, #161b22)",borderRadius:8,border:"1px solid var(--nice-border, #30363d)",opacity:t.enabled?1:.5},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.NiceIcon,{name:H(t.type),size:20}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:t.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:t.command})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>E(t.id,"up"),disabled:d===0,"aria-label":i("gitHooks.moveUp","Move up"),style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:d===0?"not-allowed":"pointer",opacity:d===0?.5:1},children:e.jsx(n.NiceIcon,{name:"arrow-up",size:14})}),e.jsx("button",{onClick:()=>E(t.id,"down"),disabled:d===V.actions.length-1,"aria-label":i("gitHooks.moveDown","Move down"),style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:d===V.actions.length-1?"not-allowed":"pointer",opacity:d===V.actions.length-1?.5:1},children:e.jsx(n.NiceIcon,{name:"arrow-down",size:14})}),e.jsx("button",{onClick:()=>Y(t),"aria-label":i("gitHooks.editAction2","Edit action"),style:{padding:"4px 8px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:4,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer"},children:e.jsx(n.NiceIcon,{name:"edit",size:14})}),e.jsx("button",{onClick:()=>x(t.id),"aria-label":i("gitHooks.removeAction","Remove action"),style:{padding:"4px 8px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:4,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer"},children:e.jsx(n.NiceIcon,{name:"trash",size:14})})]})]}),t.filePatterns&&t.filePatterns.length>0&&e.jsx("div",{style:{marginTop:8,fontSize:11,color:"var(--nice-text-muted, #8b949e)"},children:i("gitHooks.files","Files: {filePatterns}").replace("{filePatterns}",String(t.filePatterns.join(", ")))}),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[t.runOn&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"var(--nice-color-primary-active, #1d4ed8)",borderRadius:4},children:t.runOn}),t.failOnError&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"var(--nice-color-error, #b91c1c)",borderRadius:4},children:i("gitHooks.failOnError2","fail on error")})]})]},t.id))})}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-border, #30363d)",display:"flex",gap:8},children:[e.jsxs("button",{onClick:()=>W(!a),style:{padding:"10px 16px",background:"var(--nice-color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontWeight:500,display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"plus",size:14})," ",i("gitHooks.addFromTemplate","Add from Template")]}),e.jsxs("button",{onClick:()=>f(),style:{padding:"10px 16px",background:"var(--nice-bg-secondary, #f8fafc)",border:"none",borderRadius:6,color:"var(--nice-text-primary, #0f172a)",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"settings",size:14})," ",i("gitHooks.customAction","Custom Action")]})]}),a&&e.jsxs("div",{style:{position:"absolute",bottom:70,left:300,width:400,maxHeight:300,overflow:"auto",background:"var(--nice-bg-elevated, #ffffff)",border:"1px solid var(--nice-border-color, #e2e8f0)",borderRadius:8,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",zIndex:50},children:[w.filter(t=>t.hook===P).map(t=>e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>f(t),style:{padding:12,cursor:"pointer",borderBottom:"1px solid var(--nice-border-color, #e2e8f0)",display:"flex",alignItems:"center",gap:12},children:[e.jsx(n.NiceIcon,{name:t.icon,size:24}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:t.name}),e.jsx("div",{style:{fontSize:11,color:"var(--nice-text-muted, #8b949e)"},children:t.description})]})]},t.id)),w.filter(t=>t.hook===P).length===0&&e.jsx("div",{style:{padding:20,textAlign:"center",color:"var(--nice-text-muted, #8b949e)"},children:i("gitHooks.noTemplatesForThisHook","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.NiceIcon,{name:"link",size:64}),e.jsx("span",{style:{fontSize:18,marginTop:16},children:i("gitHooks.selectAHookToConfigure","Select a hook to configure")}),e.jsx("span",{style:{fontSize:12,marginTop:4},children:i("gitHooks.clickOnAHookFrom","Click on a hook from the list to start editing")})]})}),q(),s()]})},pt=Object.freeze(Object.defineProperty({__proto__:null,NiceGitHooks:Ae},Symbol.toStringTag,{value:"Module"})),xt=[...n.NICE_KEYBOARD_NUMERIC,[{value:"-"},{value:","},{...n.NICE_KEY_ENTER,width:1}]];function ut(l){const h=(l??"en").slice(0,2).toLowerCase();return h in n.NICE_KEYBOARD_LAYOUTS?h:"en"}function gt(l){const h=n.NICE_KEYBOARD_LAYOUTS[l]?.accents;if(!h)return null;const w=[...new Set(Object.values(h).flat())];return w.length?w.map(M=>({value:M})):null}const Oe=Object.assign(function({value:h,defaultValue:w,caret:M,onChange:_,onSubmit:L,onClose:$,language:A,languages:T,layout:N="text",multiline:S=!1,masked:O=!1,maxLength:z,enterLabel:j,showPreview:C=!0,fieldLabel:k,modal:B=!0,className:v,style:i}){const{t:R,lang:G}=n.useNiceTranslation(),y=o.useRef(null),[ee,K]=n.useControllableState({value:h,defaultValue:w,fallbackValue:"",componentName:"NiceOnScreenKeyboard"}),[P,c]=o.useState(null),a=Math.max(0,Math.min(ee.length,M??P??ee.length)),W=o.useMemo(()=>({text:ee,caret:a}),[ee,a]),D=A??ut(G),Y=o.useMemo(()=>T&&T.length>0?T:[D],[T,D]),J=o.useMemo(()=>[{kind:"letters",lang:Y[0]},{kind:"symbols"},...Y.slice(1).map(b=>({kind:"letters",lang:b}))],[Y]),[X,V]=o.useState(0),Z=J[Math.min(X,J.length-1)],[f,x]=o.useState(!1),g=o.useMemo(()=>{if(N==="number")return xt;const b=Z.kind==="letters"?Z.lang:Y[0],F=n.buildKeyboardRows(b,"compact",Z.kind==="symbols",Y.length>1,j),ne=Z.kind==="letters"?gt(b):null;return ne?[...F.slice(0,-1),ne,F[F.length-1]]:F},[N,Z,Y,j]),E=o.useCallback(b=>{b.text===W.text&&b.caret===W.caret||(K(b.text),c(b.caret),_?.(b.text,b.caret))},[W,_,K]),p=o.useCallback(b=>E(n.insertAtCaret(W,b,z)),[E,W,z]),H=o.useCallback(()=>E(n.deleteBeforeCaret(W)),[E,W]),q=o.useCallback(b=>E(n.moveTextCaret(W,b)),[E,W]),s=o.useCallback(b=>V(F=>(F+b+J.length)%J.length),[J.length]),t=b=>{switch(b.type){case"backspace":H();return;case"enter":S?p(`
|
|
10
|
+
`):L?.(ee);return;case"shift":case"caps":x(F=>!F);return;case"space":p(" ");return;case"tab":p(" ");return;case"lang":s(1);return;case"fn":b.value==="123"||b.value==="ABC"||b.value==="#+="?V(Z.kind==="symbols"?0:J.findIndex(F=>F.kind==="symbols")):(b.value==="Clear"||b.value==="C")&&E({text:"",caret:0});return;default:{const F=f&&b.value.length===1?b.value.toUpperCase():b.value;p(F),f&&x(!1)}}};n.useOverlayFocus(y,{open:B,modal:!0,onClose:()=>$?.()}),n.useIntent(["secondary","tertiary","pagePrev","pageNext","sectionPrev","sectionNext","menu"],b=>{const F={secondary:H,tertiary:()=>p(" "),pagePrev:()=>q(-1),pageNext:()=>q(1),sectionPrev:()=>s(-1),sectionNext:()=>s(1),menu:()=>L?.(ee)};if(b.source==="keyboard"&&b.intent!=="secondary")return!1;F[b.intent]?.()},{ref:y}),n.useInputHints(y,[{intent:"activate",label:R("osk.type","Type")},{intent:"secondary",label:R("osk.delete","Delete")},{intent:"tertiary",label:R("touchKeyboard.space","Space")},{intent:"pageNext",label:R("osk.cursor","Cursor")},{intent:"sectionNext",label:R("osk.layout","Layout")},{intent:"menu",label:R("osk.done","Done")},{intent:"back",label:R("osk.close","Close")}]);const d=o.useRef({backspace:H,typeChars:p});d.current={backspace:H,typeChars:p},o.useEffect(()=>{const b=y.current;if(!b)return;const F=ne=>{ne.ctrlKey||ne.metaKey||ne.altKey||ne.defaultPrevented||(ne.key==="Backspace"?(ne.preventDefault(),d.current.backspace()):ne.key.length===1&&ne.key!==" "&&(ne.preventDefault(),d.current.typeChars(ne.key)))};return b.addEventListener("keydown",F),()=>b.removeEventListener("keydown",F)},[]);const u=b=>{switch(b.type){case"backspace":return R("touchKeyboard.backspace","Backspace");case"enter":return S?R("osk.newLine","New line"):j??R("touchKeyboard.enter","Enter");case"space":return R("touchKeyboard.space","Space");case"shift":case"caps":return R("osk.shift","Shift");case"tab":return R("input.key.tab","Tab");case"lang":return R("touchKeyboard.language","Lang");case"fn":return b.value==="ABC"?R("osk.letters","Letters"):b.value==="123"||b.value==="#+="?R("osk.symbols","Symbols"):b.label??b.value;default:return f&&b.value.length===1?b.value.toUpperCase():b.value}},I=b=>{switch(b.type){case"backspace":return e.jsxs(e.Fragment,{children:[e.jsx(n.NiceIcon,{name:"key-backspace",size:18}),e.jsx(n.NiceControlHint,{intent:"secondary",always:!0})]});case"enter":return e.jsxs(e.Fragment,{children:[j&&!S?e.jsx("span",{className:"nice-osk__key-text",children:j}):e.jsx(n.NiceIcon,{name:"key-enter",size:18}),!S&&e.jsx(n.NiceControlHint,{intent:"menu",always:!0})]});case"space":return e.jsxs(e.Fragment,{children:[e.jsx(n.NiceIcon,{name:"key-space",size:18}),e.jsx(n.NiceControlHint,{intent:"tertiary",always:!0})]});case"shift":case"caps":return e.jsx(n.NiceIcon,{name:"key-shift",size:18});case"tab":return e.jsx(n.NiceIcon,{name:"key-tab",size:18});case"lang":return e.jsx(n.NiceIcon,{name:"globe",size:18});default:return e.jsx("span",{className:"nice-osk__key-text",children:u(b)})}},te=g.length>1?g[Math.min(1,g.length-1)][0]:g[0]?.[0],Q=O?"•".repeat(ee.length):ee,m=N==="text"&&Z.kind==="letters"&&n.isRtlKeyboardLanguage(Z.lang);return e.jsxs("div",{ref:y,className:`nice-osk${v?` ${v}`:""}`,style:i,role:B?"dialog":"group","aria-modal":B||void 0,"aria-label":R("osk.label","On-screen keyboard"),children:[C&&e.jsxs("div",{className:"nice-osk__preview",children:[k&&e.jsx("span",{className:"nice-osk__preview-label",children:k}),e.jsxs("span",{className:"nice-osk__preview-text",dir:m?"rtl":void 0,children:[Q.slice(0,a),e.jsx("span",{className:"nice-osk__caret","aria-hidden":"true"}),Q.slice(a)]})]}),e.jsx("div",{className:"nice-osk__keys",dir:m?"rtl":void 0,children:g.map((b,F)=>e.jsx("div",{className:"nice-osk__row",children:b.map((ne,ce)=>e.jsx("button",{type:"button",className:`nice-osk__key nice-osk__key--${ne.type??"char"}${(ne.type==="shift"||ne.type==="caps")&&f?" nice-osk__key--active":""}`,style:{flexGrow:ne.width??1},onClick:()=>t(ne),"aria-label":u(ne),"aria-pressed":ne.type==="shift"||ne.type==="caps"?f:void 0,"data-autofocus":ne===te?"":void 0,children:I(ne)},`${F}-${ce}-${ne.value}`))},F))}),e.jsxs("div",{className:"nice-osk__bar",children:[e.jsxs("button",{type:"button",className:"nice-osk__bar-btn",onClick:()=>q(-1),"aria-label":R("osk.cursorLeft","Cursor left"),children:[e.jsx(n.NiceIcon,{name:"chevron-left",size:16}),e.jsx(n.NiceControlHint,{intent:"pagePrev",always:!0})]}),e.jsxs("button",{type:"button",className:"nice-osk__bar-btn",onClick:()=>q(1),"aria-label":R("osk.cursorRight","Cursor right"),children:[e.jsx(n.NiceControlHint,{intent:"pageNext",always:!0}),e.jsx(n.NiceIcon,{name:"chevron-right",size:16})]}),e.jsx("span",{className:"nice-osk__bar-spacer"}),e.jsxs("button",{type:"button",className:"nice-osk__bar-btn",onClick:()=>$?.(),"aria-label":R("osk.close","Close"),children:[e.jsx(n.NiceControlHint,{intent:"back",always:!0}),e.jsx(n.NiceIcon,{name:"close",size:16})]})]})]})},{displayName:"NiceOnScreenKeyboard"});function ke(l){return(l instanceof HTMLTextAreaElement||l instanceof Element&&n.isTextInput(l))&&!l.readOnly&&!l.disabled}function ft(l){return l.labels?.[0]?.textContent?.trim()||l.getAttribute("aria-label")||l.placeholder||void 0}const pe=[];function De(){const{t:l}=n.useNiceTranslation(),[h]=n.useInputPreferences(),w=n.useInputMethod();n.useInputEngine();const M=o.useRef({}),[_,L]=o.useState(null),[$,A]=o.useState({text:"",caret:0}),T=o.useRef(w);T.current=w,o.useEffect(()=>{const v=M.current;return pe.push(v),()=>{pe.splice(pe.indexOf(v),1)}},[]);const N=o.useCallback(v=>{let i=v.value.length;try{i=v.selectionEnd??i}catch{}A({text:v.value,caret:i}),L({el:v,before:v.value})},[]);if(o.useEffect(()=>{if(h.onScreenKeyboard==="never")return;const v=R=>{const G=R.detail;pe[0]===M.current&&G.engaged&&(G.source==="gamepad"||G.source==="remote")&&ke(R.target)&&N(R.target)},i=R=>{h.onScreenKeyboard==="always"&&T.current==="touch"&&pe[0]===M.current&&ke(R.target)&&N(R.target)};return document.addEventListener(n.NICE_ENGAGE_EVENT,v),document.addEventListener("focusin",i),()=>{document.removeEventListener(n.NICE_ENGAGE_EVENT,v),document.removeEventListener("focusin",i)}},[h.onScreenKeyboard,N]),!_||typeof document>"u")return null;const{el:S}=_,O=()=>{S.value!==_.before&&S.dispatchEvent(new Event("change",{bubbles:!0})),L(null)},z=()=>{O(),window.setTimeout(()=>{const v=new KeyboardEvent("keydown",{key:"Enter",bubbles:!0,cancelable:!0});if(S.dispatchEvent(v),!v.defaultPrevented&&S instanceof HTMLInputElement&&S.form)try{S.form.requestSubmit()}catch{}},0)},j=S.getAttribute("inputmode"),C=j==="numeric"||j==="decimal"||j==="tel"||S.type==="tel",k=S.getAttribute("enterkeyhint"),B=S.type==="search"||k==="search"?l("osk.search","Search"):k==="send"?l("osk.send","Send"):k==="go"?l("osk.go","Go"):k==="next"?l("osk.next","Next"):void 0;return qe.createPortal(e.jsx("div",{className:`nice-osk-host ${Se(S)}`,children:e.jsx(Oe,{value:$.text,caret:$.caret,onChange:(v,i)=>{A({text:v,caret:i}),n.setFieldText(S,v,i)},onSubmit:S instanceof HTMLTextAreaElement?()=>O():()=>z(),onClose:O,layout:C?"number":"text",multiline:S instanceof HTMLTextAreaElement,masked:S.type==="password",maxLength:S.maxLength>0?S.maxLength:void 0,enterLabel:B,fieldLabel:ft(S)})}),document.body)}const ht={"data-nice-focus-scope":"spatial","data-nice-arrows":"spatial"};function Pe(){return n.useInputEngine(),ht}function $e({position:l,block:h}){return e.jsxs(e.Fragment,{children:[l!=="none"&&e.jsx(n.NiceInputHintBar,{visibility:"pad",position:l,className:`${h}__hint-bar`}),e.jsx(De,{})]})}const He=Object.assign(o.forwardRef(({menubar:l,toolbar:h,sidebar:w,sidebarWidth:M=220,rightSidebar:_,rightSidebarWidth:L=280,children:$,bottomPanel:A,bottomPanelHeight:T,statusBar:N,height:S="100%",flush:O=!1,hintBar:z="bottom",className:j,style:C,id:k,"data-testid":B},v)=>{const{t:i}=n.useNiceTranslation(),R=Pe(),G=`nice-app-shell__sidebar${O?" nice-app-shell__sidebar--flush":""}`;return e.jsxs("div",{ref:v,id:k,"data-testid":B,className:`nice-app-shell${j?` ${j}`:""}`,style:{height:S,...C},...R,children:[l!=null&&e.jsx("div",{className:`nice-app-shell__menubar${O?" nice-app-shell__chrome--flush":""}`,"data-nice-region":i("appShell.region.menubar","Menu bar"),children:l}),h!=null&&e.jsx("div",{className:`nice-app-shell__toolbar${O?" nice-app-shell__chrome--flush":""}`,"data-nice-region":i("appShell.region.toolbar","Toolbar"),children:h}),e.jsxs("div",{className:"nice-app-shell__body",children:[w!=null&&e.jsx("aside",{className:G,style:O?void 0:{width:M},children:w}),e.jsx("main",{className:"nice-app-shell__content",children:$}),_!=null&&e.jsx("aside",{className:`${G} nice-app-shell__sidebar--right`,style:O?void 0:{width:L},children:_})]}),A!=null&&e.jsx("div",{className:`nice-app-shell__bottom${O?" nice-app-shell__bottom--flush":""}`,style:T!=null?{height:T}:void 0,"data-nice-region":i("appShell.region.bottom","Bottom panel"),children:A}),N!=null&&e.jsx("div",{className:"nice-app-shell__status","data-nice-region":i("appShell.region.status","Status bar"),children:N}),e.jsx($e,{position:z,block:"nice-app-shell"})]})}),{displayName:"NiceAppShell"}),mt=[],bt=[],vt={id:"",name:"",repository:"",triggers:[],stages:[],variables:[],secrets:[],isEnabled:!0,createdAt:new Date(0),updatedAt:new Date(0)},yt=[],jt=[{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"}],kt={push:"upload",pull_request:"shuffle",schedule:"clock",manual:"cursor",tag:"tag",workflow_dispatch:"zap"},St={script:"file",action:"settings",checkout:"download",upload_artifact:"upload",download_artifact:"download",docker:"box",deploy:"rocket"},Le=({pipeline:l,defaultPipeline:h,templates:w=mt,runners:M=yt,environments:_=bt,onPipelineChange:L,onStageAdd:$,onStageRemove:A,onStageMove:T,onJobAdd:N,onJobRemove:S,onStepAdd:O,onStepRemove:z,onVariableAdd:j,onVariableRemove:C,onSecretAdd:k,onSecretRemove:B,onTemplateApply:v,onSave:i,onRun:R,onValidate:G,tutorial:y,className:ee,style:K,"data-testid":P})=>{const{t:c}=n.useNiceTranslation(),[a,W]=n.useControllableState({value:l,defaultValue:h,fallbackValue:vt,onChange:L,componentName:"NicePipelineEditor"}),[D,Y]=o.useState("visual"),[J,X]=o.useState(null),[V,Z]=o.useState(null),[f,x]=o.useState(!1),g=a.stages.find(t=>t.id===J),E=g?.jobs.find(t=>t.id===V),p=o.useMemo(()=>{const t=[];return t.push(`name: ${a.name}`),t.push(""),t.push("on:"),a.triggers.forEach(d=>{t.push(` ${d}:`),(d==="push"||d==="pull_request")&&(t.push(" branches:"),t.push(` - ${a.branch||"main"}`))}),t.push(""),a.variables.length>0&&(t.push("env:"),a.variables.filter(d=>!d.isSecret).forEach(d=>{t.push(` ${d.name}: ${d.value}`)}),t.push("")),t.push("jobs:"),a.stages.forEach(d=>{d.jobs.forEach(u=>{t.push(` ${d.name.toLowerCase().replace(/\s+/g,"-")}-${u.name.toLowerCase().replace(/\s+/g,"-")}:`),t.push(` name: ${u.name}`),u.runner&&t.push(` runs-on: ${u.runner}`),d.dependsOn?.length&&t.push(` needs: [${d.dependsOn.join(", ")}]`),t.push(" steps:"),u.steps.forEach(I=>{I.type==="checkout"?t.push(" - uses: actions/checkout@v4"):I.type==="action"&&I.action?(t.push(` - uses: ${I.action}${I.actionVersion?`@${I.actionVersion}`:""}`),I.with&&Object.keys(I.with).length>0&&(t.push(" with:"),Object.entries(I.with).forEach(([te,Q])=>{t.push(` ${te}: ${Q}`)}))):I.type==="script"&&I.script&&(t.push(` - name: ${I.name}`),t.push(" run: |"),I.script.split(`
|
|
11
|
+
`).forEach(te=>{t.push(` ${te}`)}))})})}),t.join(`
|
|
12
|
+
`)},[a]),H=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.NiceIcon,{name:"settings",size:20}),e.jsx("input",{type:"text",value:a.name,onChange:t=>W({...a,name:t.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-text-primary, #fff)",fontSize:"14px",fontWeight:500,width:"250px"}})]}),e.jsx("div",{style:{flex:1}}),e.jsx(n.NiceTutorialButton,{steps:n.resolveTutorial(y,jt)}),e.jsx("button",{onClick:()=>x(!0),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"clipboard",size:14})," ",c("pipelineEditor.templates","Templates")]})}),e.jsx("button",{onClick:G,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"check",size:14})," ",c("pipelineEditor.validate","Validate")]})}),e.jsx("button",{onClick:i,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"12px",fontWeight:500},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"save",size:14})," ",c("pipelineEditor.save","Save")]})}),e.jsx("button",{onClick:R,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"12px",fontWeight:500},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"play",size:14})," ",c("pipelineEditor.runPipeline","Run Pipeline")]})})]}),q=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:c("pipelineEditor.visualEditor","Visual Editor")},{id:"yaml",icon:"edit",label:"YAML"},{id:"triggers",icon:"zap",label:c("pipelineEditor.triggers","Triggers")},{id:"variables",icon:"settings",label:c("pipelineEditor.variables","Variables")}].map(t=>e.jsx("button",{onClick:()=>Y(t.id),style:{padding:"10px 20px",border:"none",background:D===t.id?"var(--nice-bg-elevated, #1e1e1e)":"transparent",color:D===t.id?"var(--nice-text-primary, #fff)":"var(--nice-text-muted, #888)",cursor:"pointer",fontSize:"12px",borderBottom:D===t.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.NiceIcon,{name:t.icon,size:14})," ",t.label]})},t.id))}),s=e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",height:"100%"},children:[D==="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:c("pipelineEditor.stages","Stages")}),e.jsx("button",{onClick:$,style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:c("pipelineEditor.addStage","+ Add Stage")})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"8px"},children:[a.stages.map((t,d)=>e.jsxs("div",{children:[d>0&&e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"4px",color:"var(--nice-text-primary, #444)"},children:e.jsx(n.NiceIcon,{name:"arrow-down",size:14})}),e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>{X(t.id),Z(null)},style:{padding:"12px",background:J===t.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:J===t.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:t.name}),e.jsxs("div",{style:{display:"flex",gap:"4px"},children:[d>0&&e.jsx("button",{"aria-label":c("pipelineEditor.moveStageUp","Move stage up"),onClick:u=>{u.stopPropagation(),T(t.id,"up")},style:{padding:"2px 4px",background:"var(--nice-bg-tertiary, #333)",border:"none",borderRadius:"2px",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(n.NiceIcon,{name:"arrow-up",size:12})}),d<a.stages.length-1&&e.jsx("button",{"aria-label":c("pipelineEditor.moveStageDown","Move stage down"),onClick:u=>{u.stopPropagation(),T(t.id,"down")},style:{padding:"2px 4px",background:"var(--nice-bg-tertiary, #333)",border:"none",borderRadius:"2px",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(n.NiceIcon,{name:"arrow-down",size:12})}),e.jsx("button",{"aria-label":c("pipelineEditor.removeStage","Remove stage"),onClick:u=>{u.stopPropagation(),A(t.id)},style:{padding:"2px 4px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:"2px",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(n.NiceIcon,{name:"close",size:12})})]})]}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:[t.jobs.length!==1?c("pipelineEditor.jobsMany","{count} jobs").replace("{count}",String(t.jobs.length)):c("pipelineEditor.jobsOne","{count} job").replace("{count}",String(t.jobs.length))," ","•"," ",t.parallel?c("pipelineEditor.parallel","Parallel"):c("pipelineEditor.sequential","Sequential")]})]})]},t.id)),a.stages.length===0&&e.jsx("div",{style:{textAlign:"center",color:"var(--nice-text-muted, #666)",padding:"24px",fontSize:"12px"},children:c("pipelineEditor.noStagesYetAddA","No stages yet. Add a stage to get started.")})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:g?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.jsx("span",{style:{fontWeight:500},children:c("pipelineEditor.stage","Stage: {name}").replace("{name}",String(g.name))}),e.jsx("button",{onClick:()=>N(g.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:c("pipelineEditor.addJob","+ 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:g.jobs.map(t=>e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>Z(t.id),style:{padding:"10px",marginBottom:"4px",background:V===t.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--nice-bg-elevated, #252525)",borderRadius:"6px",cursor:"pointer",border:V===t.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:t.name}),e.jsx("button",{"aria-label":c("pipelineEditor.removeJob","Remove job"),onClick:d=>{d.stopPropagation(),S(g.id,t.id)},style:{padding:"2px 4px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:"2px",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"9px"},children:e.jsx(n.NiceIcon,{name:"close",size:11})})]}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)",marginTop:"4px"},children:c("pipelineEditor.steps","{steps} steps").replace("{steps}",String(t.steps.length))})]},t.id))}),E?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.jsx("h3",{style:{margin:0,fontSize:"14px"},children:c("pipelineEditor.job","Job: {name}").replace("{name}",String(E.name))}),e.jsx("button",{onClick:()=>O(g.id,E.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-accent, #8b5cf6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:c("pipelineEditor.addStep","+ 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:c("pipelineEditor.runner","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-text-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"",children:c("pipelineEditor.selectRunner","Select runner...")}),M.map(t=>e.jsxs("option",{value:t.id,children:[t.name," (",t.os,")"]},t.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)",display:"block",marginBottom:"4px"},children:c("pipelineEditor.environment","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-text-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"",children:c("pipelineEditor.noEnvironment","No environment")}),_.map(t=>e.jsxs("option",{value:t.id,children:[t.name,t.protection?c("pipelineEditor.protected"," (protected)"):""]},t.id))]})]})]}),E.steps.map((t,d)=>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.NiceIcon,{name:St[t.type],size:16}),e.jsx("span",{style:{fontSize:"12px",fontWeight:500,flex:1},children:t.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:t.type}),e.jsx("button",{"aria-label":c("pipelineEditor.removeStep","Remove step"),onClick:()=>z(g.id,E.id,t.id),style:{padding:"2px 6px",background:"var(--nice-color-error, #ef4444)",border:"none",borderRadius:"4px",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:e.jsx(n.NiceIcon,{name:"close",size:12})})]}),t.type==="script"&&t.script&&e.jsx("pre",{style:{margin:0,padding:"8px",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:"4px",fontSize:"10px",fontFamily:"monospace",overflow:"auto"},children:t.script}),t.type==="action"&&e.jsxs("div",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:["uses: ",t.action,t.actionVersion&&`@${t.actionVersion}`]})]},t.id)),E.steps.length===0&&e.jsx("div",{style:{textAlign:"center",color:"var(--nice-text-muted, #666)",padding:"24px",fontSize:"12px"},children:c("pipelineEditor.noStepsYetAddA","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:c("pipelineEditor.selectAJobToEdit","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:c("pipelineEditor.selectAStageToView","Select a stage to view its jobs")})})]}),D==="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:p})}),D==="triggers"&&e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"14px"},children:c("pipelineEditor.pipelineTriggers","Pipeline Triggers")}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"16px"},children:["push","pull_request","schedule","manual","tag","workflow_dispatch"].map(t=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"16px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:a.triggers.includes(t)?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:[e.jsx("input",{type:"checkbox",checked:a.triggers.includes(t),onChange:d=>{const u=d.target.checked?[...a.triggers,t]:a.triggers.filter(I=>I!==t);W({...a,triggers:u})}}),e.jsx(n.NiceIcon,{name:kt[t],size:24}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:"13px"},children:t.replace("_"," ")}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:[t==="push"&&c("pipelineEditor.runOnPushToBranch","Run on push to branch"),t==="pull_request"&&c("pipelineEditor.runOnPrMr","Run on PR/MR"),t==="schedule"&&c("pipelineEditor.runOnScheduleCron","Run on schedule (cron)"),t==="manual"&&c("pipelineEditor.manualTriggerOnly","Manual trigger only"),t==="tag"&&c("pipelineEditor.runOnTagPush","Run on tag push"),t==="workflow_dispatch"&&c("pipelineEditor.apiUiTrigger","API/UI trigger")]})]})]},t))})]}),D==="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:c("pipelineEditor.variablesSecrets","Variables & Secrets")}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("button",{onClick:j,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:c("pipelineEditor.addVariable","+ Add Variable")}),e.jsx("button",{onClick:k,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-warning, #f59e0b)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(n.NiceIcon,{name:"lock",size:12})," ",c("pipelineEditor.addSecret","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:c("pipelineEditor.name","Name")}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"left",fontWeight:500},children:c("pipelineEditor.value","Value")}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"center",fontWeight:500},children:c("pipelineEditor.type","Type")}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"right",fontWeight:500},children:c("pipelineEditor.actions","Actions")})]})}),e.jsx("tbody",{children:a.variables.map(t=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",fontFamily:"monospace"},children:t.name}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)"},children:t.isSecret?"••••••••":t.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:t.isSecret?"var(--nice-warning-tint-15, #f59e0b22)":"var(--nice-primary-tint-15, #3b82f622)",color:t.isSecret?"var(--nice-color-warning, #f59e0b)":"var(--nice-color-primary, #3b82f6)",fontSize:"10px"},children:[t.isSecret&&e.jsx(n.NiceIcon,{name:"lock",size:10}),t.isSecret?c("pipelineEditor.secret","Secret"):c("pipelineEditor.variable","Variable")]})}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",textAlign:"right"},children:e.jsx("button",{onClick:()=>C(t.name),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:c("pipelineEditor.remove","Remove")})})]},t.name))})]}),a.variables.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:"12px"},children:c("pipelineEditor.noVariablesDefined","No variables defined")})]})]})]});return e.jsxs(e.Fragment,{children:[e.jsx(He,{className:`nice-pipeline-editor ${ee||""}`,style:{background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",...K},flush:!0,menubar:H,toolbar:q,"data-testid":P,children:s}),f&&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:c("pipelineEditor.pipelineTemplates","Pipeline Templates")}),e.jsx("button",{"aria-label":c("pipelineEditor.closeTemplates","Close templates"),onClick:()=>x(!1),style:{background:"none",border:"none",color:"var(--nice-text-muted, #888)",cursor:"pointer",fontSize:"18px"},children:e.jsx(n.NiceIcon,{name:"close",size:18})})]}),e.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",padding:"16px"},children:w.map(t=>e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>{v(t),x(!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.NiceIcon,{name:t.icon,size:32}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:"14px",marginBottom:"4px"},children:t.name}),e.jsx("div",{style:{fontSize:"12px",color:"var(--nice-text-muted, #888)"},children:t.description}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #666)",marginTop:"4px"},children:t.category})]})]},t.id))})]})})]})},Ct=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineEditor:Le},Symbol.toStringTag,{value:"Module"})),wt=[],fe={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"}},Fe=({runs:l=wt,stats:h,selectedRunId:w,onRunSelect:M,onCancel:_,onRerun:L,onRerunFromStage:$,onDownloadArtifact:A,onDownloadLogs:T,onApprove:N,onReject:S,className:O,style:z,"data-testid":j})=>{const{t:C}=n.useNiceTranslation(),[k,B]=o.useState("all"),[v,i]=o.useState("all"),[R,G]=o.useState(new Set),[y,ee]=o.useState(new Set),[K,P]=o.useState(null),c=l.find(f=>f.id===w),a=o.useMemo(()=>l.filter(f=>!(k!=="all"&&f.status!==k||v!=="all"&&f.branch!==v)),[l,k,v]),W=o.useMemo(()=>[...new Set(l.map(f=>f.branch))],[l]),D=f=>{if(!f)return"-";const x=Math.floor(f/1e3);if(x<60)return`${x}s`;const g=Math.floor(x/60),E=x%60;if(g<60)return`${g}m ${E}s`;const p=Math.floor(g/60),H=g%60;return`${p}h ${H}m`},Y=f=>f?new Date(f).toLocaleString():"-",J=f=>f<1024?`${f} B`:f<1024*1024?`${(f/1024).toFixed(1)} KB`:`${(f/(1024*1024)).toFixed(1)} MB`,X=f=>{G(x=>{const g=new Set(x);return g.has(f)?g.delete(f):g.add(f),g})},V=f=>{ee(x=>{const g=new Set(x);return g.has(f)?g.delete(f):g.add(f),g})},Z=()=>{if(!K||!c)return[];for(const f of c.stages)for(const x of f.jobs)if(x.id===K.jobId)return x.steps.find(E=>E.id===K.stepId)?.logs||[];return[]};return e.jsxs("div",{className:`nice-pipeline-monitor ${O||""}`,style:{display:"flex",height:"100%",background:"var(--nice-bg-elevated, #1e1e1e)",color:"var(--nice-text-primary, #e0e0e0)",...z},"data-testid":j,children:[e.jsxs("div",{style:{width:"400px",borderRight:"1px solid var(--nice-border-color, #333)",display:"flex",flexDirection:"column"},children:[h&&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:h.totalRuns}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:C("pipelineMonitor.totalRuns","Total Runs")})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--nice-color-success, #22c55e)"},children:[h.successRate.toFixed(0),"%"]}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:C("pipelineMonitor.successRate","Success Rate")})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--nice-color-warning, #f59e0b)"},children:D(h.avgDuration)}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:C("pipelineMonitor.avgDuration","Avg Duration")})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--nice-color-error, #ef4444)"},children:h.failedRuns}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:C("pipelineMonitor.failed","Failed")})]})]})}),e.jsxs("div",{style:{padding:"12px",borderBottom:"1px solid var(--nice-border-color, #333)",display:"flex",gap:"8px"},children:[e.jsxs("select",{value:k,onChange:f=>B(f.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-text-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"all",children:C("pipelineMonitor.allStatus","All Status")}),e.jsx("option",{value:"in_progress",children:C("pipelineMonitor.inProgress","In Progress")}),e.jsx("option",{value:"completed",children:C("pipelineMonitor.completed","Completed")}),e.jsx("option",{value:"failed",children:C("pipelineMonitor.failed","Failed")}),e.jsx("option",{value:"cancelled",children:C("pipelineMonitor.cancelled","Cancelled")})]}),e.jsxs("select",{value:v,onChange:f=>i(f.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-text-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"all",children:C("pipelineMonitor.allBranches","All Branches")}),W.map(f=>e.jsx("option",{value:f,children:f},f))]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[a.map(f=>{const x=fe[f.status];return e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>M(f.id),style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border-color, #333)",cursor:"pointer",background:w===f.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:x.color,animation:f.status==="in_progress"?"spin 1s linear infinite":"none"},children:e.jsx(n.NiceIcon,{name:x.icon,size:16})}),e.jsxs("span",{style:{flex:1,fontWeight:500,fontSize:"13px"},children:[f.pipelineName," #",f.runNumber]}),e.jsx("span",{style:{padding:"2px 8px",borderRadius:"4px",background:`${x.color}22`,color:x.color,fontSize:"10px"},children:x.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.NiceIcon,{name:"shuffle",size:12})," ",f.branch]}),e.jsx("span",{children:"•"}),e.jsx("span",{children:f.commit.sha.slice(0,7)}),e.jsx("span",{children:"•"}),e.jsx("span",{children:D(f.duration)})]}),e.jsx("div",{style:{marginTop:"6px",fontSize:"11px",color:"var(--nice-text-muted, #666)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:f.commit.message})]},f.id)}),a.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--nice-text-muted, #666)",fontSize:"12px"},children:C("pipelineMonitor.noPipelineRunsMatchThe","No pipeline runs match the filters")})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:c?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:[c.pipelineName," #",c.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:[c.commit.authorAvatar&&e.jsx("img",{src:c.commit.authorAvatar,alt:"",style:{width:"16px",height:"16px",borderRadius:"50%"}}),c.commit.author]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(n.NiceIcon,{name:"shuffle",size:12})," ",c.branch]}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(n.NiceIcon,{name:"edit",size:12})," ",c.commit.sha.slice(0,7)]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[(c.status==="in_progress"||c.status==="queued"||c.status==="waiting")&&e.jsx("button",{onClick:()=>_(c.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:C("pipelineMonitor.cancel","Cancel")}),e.jsx("button",{onClick:()=>L(c.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-color-primary, #3b82f6)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:C("pipelineMonitor.reRun","Re-run")}),e.jsxs("button",{onClick:()=>T(c.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"11px",display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(n.NiceIcon,{name:"download",size:14})," ",C("pipelineMonitor.logs","Logs")]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"16px",fontSize:"12px"},children:[e.jsx("span",{children:C("pipelineMonitor.started","Started: {time}").replace("{time}",String(Y(c.startedAt)))}),c.completedAt&&e.jsx("span",{children:C("pipelineMonitor.completed2","Completed: {time}").replace("{time}",String(Y(c.completedAt)))}),e.jsx("span",{children:C("pipelineMonitor.duration","Duration: {duration}").replace("{duration}",String(D(c.duration)))})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[e.jsx("div",{style:{marginBottom:"24px"},children:c.stages.map((f,x)=>{const g=fe[f.status],E=R.has(f.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>X(f.id),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"var(--nice-bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:`2px solid ${g.color}44`},children:[e.jsx("span",{style:{color:"var(--nice-text-muted, #666)",display:"inline-flex"},children:e.jsx(n.NiceIcon,{name:E?"chevron-down":"chevron-right",size:14})}),e.jsx("span",{style:{display:"inline-flex",color:g.color},children:e.jsx(n.NiceIcon,{name:g.icon,size:16})}),e.jsx("span",{style:{flex:1,fontWeight:500},children:f.name}),e.jsx("span",{style:{fontSize:"11px",color:"var(--nice-text-muted, #888)"},children:D(f.duration)}),f.status==="waiting"&&N&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:p=>{p.stopPropagation(),N(c.id,f.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-success, #22c55e)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:C("pipelineMonitor.approve","Approve")}),e.jsx("button",{onClick:p=>{p.stopPropagation(),S?.(c.id,f.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-color-error, #ef4444)",color:"var(--nice-text-on-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:C("pipelineMonitor.reject","Reject")})]}),e.jsx("button",{onClick:p=>{p.stopPropagation(),$(c.id,f.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--nice-bg-tertiary, #333)",color:"var(--nice-text-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:C("pipelineMonitor.reRunFromHere","Re-run from here")})]}),E&&e.jsx("div",{style:{marginLeft:"32px",marginTop:"8px"},children:f.jobs.map(p=>{const H=fe[p.status],q=y.has(p.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>V(p.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:"var(--nice-bg-elevated, #1e1e1e)",borderRadius:"6px",cursor:"pointer",borderLeft:`3px solid ${H.color}`},children:[e.jsx("span",{style:{color:"var(--nice-text-muted, #666)",display:"inline-flex"},children:e.jsx(n.NiceIcon,{name:q?"chevron-down":"chevron-right",size:12})}),e.jsx("span",{style:{display:"inline-flex",color:H.color},children:e.jsx(n.NiceIcon,{name:H.icon,size:14})}),e.jsx("span",{style:{flex:1,fontSize:"12px"},children:p.name}),p.runner&&e.jsxs("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #666)",display:"inline-flex",alignItems:"center",gap:"4px"},children:[e.jsx(n.NiceIcon,{name:"monitor",size:12})," ",p.runner]}),e.jsx("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:D(p.duration)})]}),q&&e.jsx("div",{style:{marginLeft:"24px",marginTop:"4px"},children:p.steps.map(s=>{const t=fe[s.status];return e.jsxs("div",{role:s.logs?.length?"button":void 0,tabIndex:s.logs?.length?0:void 0,onKeyDown:s.logs?.length?n.clickOnActivationKey:void 0,onClick:()=>P({jobId:p.id,stepId:s.id}),style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 10px",marginBottom:"2px",background:"transparent",borderRadius:"4px",cursor:s.logs?.length?"pointer":"default"},children:[e.jsx("span",{style:{display:"inline-flex",color:t.color},children:e.jsx(n.NiceIcon,{name:t.icon,size:12})}),e.jsx("span",{style:{flex:1,fontSize:"11px"},children:s.name}),e.jsx("span",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:D(s.duration)}),s.logs?.length?e.jsx("span",{style:{display:"inline-flex",color:"var(--nice-text-muted, #666)"},children:e.jsx(n.NiceIcon,{name:"file",size:10})}):null]},s.id)})})]},p.id)})}),x<c.stages.length-1&&e.jsx("div",{style:{marginLeft:"24px",padding:"4px 0",color:"var(--nice-text-primary, #444)",display:"flex"},children:e.jsx(n.NiceIcon,{name:"arrow-down",size:14})})]},f.id)})}),c.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:C("pipelineMonitor.artifacts","Artifacts")}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"8px"},children:c.artifacts.map(f=>e.jsxs("div",{role:"button",tabIndex:0,onKeyDown:n.clickOnActivationKey,onClick:()=>A(f),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.NiceIcon,{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:f.name}),e.jsx("div",{style:{fontSize:"10px",color:"var(--nice-text-muted, #888)"},children:J(f.size)})]}),e.jsx("span",{style:{display:"inline-flex"},children:e.jsx(n.NiceIcon,{name:"download",size:16})})]},f.id))})]})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--nice-text-muted, #666)"},children:C("pipelineMonitor.selectAPipelineRunTo","Select a pipeline run to view details")})}),K&&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:C("pipelineMonitor.stepLogs","Step Logs")}),e.jsx("button",{onClick:()=>P(null),"aria-label":C("pipelineMonitor.closeLogs","Close logs"),style:{background:"none",border:"none",color:"var(--nice-text-muted, #888)",cursor:"pointer",display:"inline-flex",alignItems:"center"},children:e.jsx(n.NiceIcon,{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:Z().join(`
|
|
13
|
+
`)||"No logs available"})})]})}),e.jsx("style",{children:`
|
|
14
|
+
@keyframes spin {
|
|
15
|
+
from { transform: rotate(0deg); }
|
|
16
|
+
to { transform: rotate(360deg); }
|
|
17
|
+
}
|
|
18
|
+
`})]})},zt=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineMonitor:Fe},Symbol.toStringTag,{value:"Module"}));exports.NiceAppShell=He;exports.NiceBranchManager=Be;exports.NiceBranchManager$1=Qe;exports.NiceConfirmDialog=Ce;exports.NiceGitBlame=Te;exports.NiceGitBlame$1=at;exports.NiceGitConflictResolver=_e;exports.NiceGitConflictResolver$1=ct;exports.NiceGitDiffViewer=Ee;exports.NiceGitDiffViewer$1=it;exports.NiceGitGraph=Ie;exports.NiceGitGraph$1=Xe;exports.NiceGitHooks=Ae;exports.NiceGitHooks$1=pt;exports.NiceMergeRequestBuilder=Me;exports.NiceMergeRequestBuilder$1=nt;exports.NiceOnScreenKeyboard=Oe;exports.NiceOnScreenKeyboardHost=De;exports.NicePipelineEditor=Le;exports.NicePipelineEditor$1=Ct;exports.NicePipelineMonitor=Fe;exports.NicePipelineMonitor$1=zt;exports.NicePromptDialog=ye;exports.ShellHintBar=$e;exports.scopeThemeClass=Se;exports.useIgnoredPropChangeWarning=we;exports.useNiceDialogs=Ne;exports.useShellInput=Pe;
|