import{a as fe}from"./chunk-T5OCTHI4.mjs";import{a as pe}from"./chunk-JQRUD6KW.mjs";import{a as le}from"./chunk-2T2R6R2M.mjs";import"./chunk-UP6H54XL.mjs";import"./chunk-UXSXWOXI.mjs";import"./chunk-C62D2QBJ.mjs";import"./chunk-CEXFNPSA.mjs";import"./chunk-RERM46MO.mjs";import"./chunk-J5EP6P6S.mjs";import"./chunk-RLI5ZMPA.mjs";import"./chunk-2UTLFMKG.mjs";import"./chunk-RKZBBQEN.mjs";import{h as de,o as he,p as ge}from"./chunk-QA3QBVWF.mjs";import"./chunk-KNLZD3CH.mjs";import{G as E,S as te,T as re,U as ne,V as oe,W as ae,X as se,Y as ie,_ as S,ca as ce,j as ee,t as q}from"./chunk-67TQ5CYL.mjs";import{b as B,h as me}from"./chunk-7W6UQGC5.mjs";import"./chunk-KGYTTC2M.mjs";import"./chunk-4R4BOZG6.mjs";import{a as h}from"./chunk-AQ6EADP3.mjs";var $={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4};var De=ee.gitGraph,v=h(()=>he({...De,...q().gitGraph}),"getConfig"),m=new fe(()=>{let e=v(),t=e.mainBranchName,r=e.mainBranchOrder;return{mainBranchName:t,commits:new Map,head:null,branchConfig:new Map([[t,{name:t,order:r}]]),branches:new Map([[t,null]]),currBranch:t,direction:"LR",seq:0,options:{}}});function Z(){return de({length:7})}h(Z,"getID");function Le(e,t){let r=Object.create(null);return e.reduce((a,s)=>{let c=t(s);return r[c]||(r[c]=!0,a.push(s)),a},[])}h(Le,"uniqBy");var Ge=h(function(e){m.records.direction=e},"setDirection"),Pe=h(function(e){B.debug("options str",e),e=e?.trim(),e=e||"{}";try{m.records.options=JSON.parse(e)}catch(t){B.error("error while parsing gitGraph options",t.message)}},"setOptions"),Oe=h(function(){return m.records.options},"getOptions"),Re=h(function(e){let t=e.msg,r=e.id,a=e.type,s=e.tags;B.info("commit",t,r,a,s),B.debug("Entering commit:",t,r,a,s);let c=v();r=E.sanitizeText(r,c),t=E.sanitizeText(t,c),s=s?.map(n=>E.sanitizeText(n,c));let o={id:r||m.records.seq+"-"+Z(),message:t,seq:m.records.seq++,type:a??$.NORMAL,tags:s??[],parents:m.records.head==null?[]:[m.records.head.id],branch:m.records.currBranch};m.records.head=o,B.info("main branch",c.mainBranchName),m.records.commits.has(o.id)&&B.warn(`Commit ID ${o.id} already exists`),m.records.commits.set(o.id,o),m.records.branches.set(m.records.currBranch,o.id),B.debug("in pushCommit "+o.id)},"commit"),ve=h(function(e){let t=e.name,r=e.order;if(t=E.sanitizeText(t,v()),m.records.branches.has(t))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${t}")`);m.records.branches.set(t,m.records.head!=null?m.records.head.id:null),m.records.branchConfig.set(t,{name:t,order:r}),$e(t),B.debug("in createBranch")},"branch"),Ae=h(e=>{let t=e.branch,r=e.id,a=e.type,s=e.tags,c=v();t=E.sanitizeText(t,c),r&&(r=E.sanitizeText(r,c));let o=m.records.branches.get(m.records.currBranch),n=m.records.branches.get(t),d=o?m.records.commits.get(o):void 0,l=n?m.records.commits.get(n):void 0;if(d&&l&&d.branch===t)throw new Error(`Cannot merge branch '${t}' into itself.`);if(m.records.currBranch===t){let i=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw i.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},i}if(d===void 0||!d){let i=new Error(`Incorrect usage of "merge". Current branch (${m.records.currBranch})has no commits`);throw i.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["commit"]},i}if(!m.records.branches.has(t)){let i=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") does not exist");throw i.hash={text:`merge ${t}`,token:`merge ${t}`,expected:[`branch ${t}`]},i}if(l===void 0||!l){let i=new Error('Incorrect usage of "merge". Branch to be merged ('+t+") has no commits");throw i.hash={text:`merge ${t}`,token:`merge ${t}`,expected:['"commit"']},i}if(d===l){let i=new Error('Incorrect usage of "merge". Both branches have same head');throw i.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},i}if(r&&m.records.commits.has(r)){let i=new Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");throw i.hash={text:`merge ${t} ${r} ${a} ${s?.join(" ")}`,token:`merge ${t} ${r} ${a} ${s?.join(" ")}`,expected:[`merge ${t} ${r}_UNIQUE ${a} ${s?.join(" ")}`]},i}let p=n||"",g={id:r||`${m.records.seq}-${Z()}`,message:`merged branch ${t} into ${m.records.currBranch}`,seq:m.records.seq++,parents:m.records.head==null?[]:[m.records.head.id,p],branch:m.records.currBranch,type:$.MERGE,customType:a,customId:!!r,tags:s??[]};m.records.head=g,m.records.commits.set(g.id,g),m.records.branches.set(m.records.currBranch,g.id),B.debug(m.records.branches),B.debug("in mergeBranch")},"merge"),Ie=h(function(e){let t=e.id,r=e.targetId,a=e.tags,s=e.parent;B.debug("Entering cherryPick:",t,r,a);let c=v();if(t=E.sanitizeText(t,c),r=E.sanitizeText(r,c),a=a?.map(d=>E.sanitizeText(d,c)),s=E.sanitizeText(s,c),!t||!m.records.commits.has(t)){let d=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw d.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},d}let o=m.records.commits.get(t);if(o===void 0||!o)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(s&&!(Array.isArray(o.parents)&&o.parents.includes(s)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let n=o.branch;if(o.type===$.MERGE&&!s)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!m.records.commits.has(r)){if(n===m.records.currBranch){let g=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw g.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},g}let d=m.records.branches.get(m.records.currBranch);if(d===void 0||!d){let g=new Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw g.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},g}let l=m.records.commits.get(d);if(l===void 0||!l){let g=new Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw g.hash={text:`cherryPick ${t} ${r}`,token:`cherryPick ${t} ${r}`,expected:["cherry-pick abc"]},g}let p={id:m.records.seq+"-"+Z(),message:`cherry-picked ${o?.message} into ${m.records.currBranch}`,seq:m.records.seq++,parents:m.records.head==null?[]:[m.records.head.id,o.id],branch:m.records.currBranch,type:$.CHERRY_PICK,tags:a?a.filter(Boolean):[`cherry-pick:${o.id}${o.type===$.MERGE?`|parent:${s}`:""}`]};m.records.head=p,m.records.commits.set(p.id,p),m.records.branches.set(m.records.currBranch,p.id),B.debug(m.records.branches),B.debug("in cherryPick")}},"cherryPick"),$e=h(function(e){if(e=E.sanitizeText(e,v()),m.records.branches.has(e)){m.records.currBranch=e;let t=m.records.branches.get(m.records.currBranch);t===void 0||!t?m.records.head=null:m.records.head=m.records.commits.get(t)??null}else{let t=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw t.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},t}},"checkout");function ye(e,t,r){let a=e.indexOf(t);a===-1?e.push(r):e.splice(a,1,r)}h(ye,"upsert");function ue(e){let t=e.reduce((s,c)=>s.seq>c.seq?s:c,e[0]),r="";e.forEach(function(s){s===t?r+=" *":r+=" |"});let a=[r,t.id,t.seq];for(let s in m.records.branches)m.records.branches.get(s)===t.id&&a.push(s);if(B.debug(a.join(" ")),t.parents&&t.parents.length==2&&t.parents[0]&&t.parents[1]){let s=m.records.commits.get(t.parents[0]);ye(e,t,s),t.parents[1]&&e.push(m.records.commits.get(t.parents[1]))}else{if(t.parents.length==0)return;if(t.parents[0]){let s=m.records.commits.get(t.parents[0]);ye(e,t,s)}}e=Le(e,s=>s.id),ue(e)}h(ue,"prettyPrintCommitHistory");var He=h(function(){B.debug(m.records.commits);let e=xe()[0];ue([e])},"prettyPrint"),Se=h(function(){m.reset(),te()},"clear"),_e=h(function(){return[...m.records.branchConfig.values()].map((t,r)=>t.order!==null&&t.order!==void 0?t:{...t,order:parseFloat(`0.${r}`)}).sort((t,r)=>(t.order??0)-(r.order??0)).map(({name:t})=>({name:t}))},"getBranchesAsObjArray"),qe=h(function(){return m.records.branches},"getBranches"),We=h(function(){return m.records.commits},"getCommits"),xe=h(function(){let e=[...m.records.commits.values()];return e.forEach(function(t){B.debug(t.id)}),e.sort((t,r)=>t.seq-r.seq),e},"getCommitsArray"),Ne=h(function(){return m.records.currBranch},"getCurrentBranch"),je=h(function(){return m.records.direction},"getDirection"),Fe=h(function(){return m.records.head},"getHead"),F={commitType:$,getConfig:v,setDirection:Ge,setOptions:Pe,getOptions:Oe,commit:Re,branch:ve,merge:Ae,cherryPick:Ie,checkout:$e,prettyPrint:He,clear:Se,getBranchesAsObjArray:_e,getBranches:qe,getCommits:We,getCommitsArray:xe,getCurrentBranch:Ne,getDirection:je,getHead:Fe,setAccTitle:re,getAccTitle:ne,getAccDescription:ae,setAccDescription:oe,setDiagramTitle:se,getDiagramTitle:ie};var ze=h((e,t)=>{pe(e,t),e.dir&&t.setDirection(e.dir);for(let r of e.statements)Ye(r,t)},"populate"),Ye=h((e,t)=>{let a={Commit:h(s=>t.commit(Ve(s)),"Commit"),Branch:h(s=>t.branch(Ke(s)),"Branch"),Merge:h(s=>t.merge(Ue(s)),"Merge"),Checkout:h(s=>t.checkout(Ze(s)),"Checkout"),CherryPicking:h(s=>t.cherryPick(Xe(s)),"CherryPicking")}[e.$type];a?a(e):B.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ve=h(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?$[e.type]:$.NORMAL,tags:e.tags??void 0}),"parseCommit"),Ke=h(e=>({name:e.name,order:e.order??0}),"parseBranch"),Ue=h(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?$[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ze=h(e=>e.branch,"parseCheckout"),Xe=h(e=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),be={parse:h(async e=>{let t=await le("gitGraph",e);B.debug(t),ze(t,F)},"parse")};var O=10,R=40,D=4,G=2,A=8,V=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),X=12,J=new Set(["redux-color","redux-dark-color"]),Je=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),I=h((e,t,r=!1)=>r&&e>0?(e-1)%(t-1)+1:e%t,"calcColorIndex"),w=new Map,T=new Map,z=30,W=new Map,Y=[],P=0,y="LR",Qe=h(()=>{w.clear(),T.clear(),W.clear(),P=0,Y=[],y="LR"},"clear"),Ce=h(e=>{let t=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|
/gi):e).forEach(a=>{let s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),s.setAttribute("class","row"),s.textContent=a.trim(),t.appendChild(s)}),t},"drawText"),ke=h(e=>{let t,r,a;return y==="BT"?(r=h((s,c)=>s<=c,"comparisonFunc"),a=1/0):(r=h((s,c)=>s>=c,"comparisonFunc"),a=0),e.forEach(s=>{let c=y==="TB"||y=="BT"?T.get(s)?.y:T.get(s)?.x;c!==void 0&&r(c,a)&&(t=s,a=c)}),t},"findClosestParent"),et=h(e=>{let t="",r=1/0;return e.forEach(a=>{let s=T.get(a).y;s<=r&&(t=a,r=s)}),t||void 0},"findClosestParentBT"),tt=h((e,t,r)=>{let a=r,s=r,c=[];e.forEach(o=>{let n=t.get(o);if(!n)throw new Error(`Commit not found for key ${o}`);n.parents.length?(a=nt(n),s=Math.max(a,s)):c.push(n),ot(n,a)}),a=s,c.forEach(o=>{at(o,a,r)}),e.forEach(o=>{let n=t.get(o);if(n?.parents.length){let d=et(n.parents);a=T.get(d).y-R,a<=s&&(s=a);let l=w.get(n.branch).pos,p=a-O;T.set(n.id,{x:l,y:p})}})},"setParallelBTPos"),rt=h(e=>{let t=ke(e.parents.filter(a=>a!==null));if(!t)throw new Error(`Closest parent not found for commit ${e.id}`);let r=T.get(t)?.y;if(r===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return r},"findClosestParentPos"),nt=h(e=>rt(e)+R,"calculateCommitPosition"),ot=h((e,t)=>{let r=w.get(e.branch);if(!r)throw new Error(`Branch not found for commit ${e.id}`);let a=r.pos,s=t+O;return T.set(e.id,{x:a,y:s}),{x:a,y:s}},"setCommitPosition"),at=h((e,t,r)=>{let a=w.get(e.branch);if(!a)throw new Error(`Branch not found for commit ${e.id}`);let s=t+r,c=a.pos;T.set(e.id,{x:c,y:s})},"setRootPosition"),st=h((e,t,r,a,s,c)=>{let{theme:o}=S(),n=V.has(o??""),d=J.has(o??""),l=Je.has(o??"");if(c===$.HIGHLIGHT)e.append("rect").attr("x",r.x-10+(n?3:0)).attr("y",r.y-10+(n?3:0)).attr("width",n?14:20).attr("height",n?14:20).attr("class",`commit ${t.id} commit-highlight${I(s,A,d)} ${a}-outer`),e.append("rect").attr("x",r.x-6+(n?2:0)).attr("y",r.y-6+(n?2:0)).attr("width",n?8:12).attr("height",n?8:12).attr("class",`commit ${t.id} commit${I(s,A,d)} ${a}-inner`);else if(c===$.CHERRY_PICK)e.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",n?7:10).attr("class",`commit ${t.id} ${a}`),e.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",n?2.5:2.75).attr("fill",l?"#000000":"#fff").attr("class",`commit ${t.id} ${a}`),e.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",n?2.5:2.75).attr("fill",l?"#000000":"#fff").attr("class",`commit ${t.id} ${a}`),e.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",l?"#000000":"#fff").attr("class",`commit ${t.id} ${a}`),e.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke",l?"#000000":"#fff").attr("class",`commit ${t.id} ${a}`);else{let p=e.append("circle");if(p.attr("cx",r.x),p.attr("cy",r.y),p.attr("r",n?7:10),p.attr("class",`commit ${t.id} commit${I(s,A,d)}`),c===$.MERGE){let g=e.append("circle");g.attr("cx",r.x),g.attr("cy",r.y),g.attr("r",n?5:6),g.attr("class",`commit ${a} ${t.id} commit${I(s,A,d)}`)}if(c===$.REVERSE){let g=e.append("path"),i=n?4:5;g.attr("d",`M ${r.x-i},${r.y-i}L${r.x+i},${r.y+i}M${r.x-i},${r.y+i}L${r.x+i},${r.y-i}`).attr("class",`commit ${a} ${t.id} commit${I(s,A,d)}`)}}},"drawCommitBullet"),it=h((e,t,r,a,s)=>{if(t.type!==$.CHERRY_PICK&&(t.customId&&t.type===$.MERGE||t.type!==$.MERGE)&&s.showCommitLabel){let c=e.append("g"),o=c.insert("rect").attr("class","commit-label-bkg"),n=c.append("text").attr("x",a).attr("y",r.y+25).attr("class","commit-label").text(t.id),d=n.node()?.getBBox();if(d&&(o.attr("x",r.posWithOffset-d.width/2-G).attr("y",r.y+13.5).attr("width",d.width+2*G).attr("height",d.height+2*G),y==="TB"||y==="BT"?(o.attr("x",r.x-(d.width+4*D+5)).attr("y",r.y-12),n.attr("x",r.x-(d.width+4*D)).attr("y",r.y+d.height-12)):n.attr("x",r.posWithOffset-d.width/2),s.rotateCommitLabel))if(y==="TB"||y==="BT")n.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),o.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{let l=-7.5-(d.width+10)/25*9.5,p=10+d.width/25*8.5;c.attr("transform","translate("+l+", "+p+") rotate(-45, "+a+", "+r.y+")")}}},"drawCommitLabel"),ct=h((e,t,r,a)=>{if(t.tags.length>0){let s=0,c=0,o=0,n=[];for(let d of t.tags.reverse()){let l=e.insert("polygon"),p=e.append("circle"),g=e.append("text").attr("y",r.y-16-s).attr("class","tag-label").text(d),i=g.node()?.getBBox();if(!i)throw new Error("Tag bbox not found");c=Math.max(c,i.width),o=Math.max(o,i.height),g.attr("x",r.posWithOffset-i.width/2),n.push({tag:g,hole:p,rect:l,yOffset:s}),s+=20}for(let{tag:d,hole:l,rect:p,yOffset:g}of n){let i=o/2,u=r.y-19.2-g;if(p.attr("class","tag-label-bkg").attr("points",`
${a-c/2-D/2},${u+G}
${a-c/2-D/2},${u-G}
${r.posWithOffset-c/2-D},${u-i-G}
${r.posWithOffset+c/2+D},${u-i-G}
${r.posWithOffset+c/2+D},${u+i+G}
${r.posWithOffset-c/2-D},${u+i+G}`),l.attr("cy",u).attr("cx",a-c/2+D/2).attr("r",1.5).attr("class","tag-hole"),y==="TB"||y==="BT"){let f=a+g;p.attr("class","tag-label-bkg").attr("points",`
${r.x},${f+2}
${r.x},${f-2}
${r.x+O},${f-i-2}
${r.x+O+c+4},${f-i-2}
${r.x+O+c+4},${f+i+2}
${r.x+O},${f+i+2}`).attr("transform","translate(12,12) rotate(45, "+r.x+","+a+")"),l.attr("cx",r.x+D/2).attr("cy",f).attr("transform","translate(12,12) rotate(45, "+r.x+","+a+")"),d.attr("x",r.x+5).attr("y",f+3).attr("transform","translate(14,14) rotate(45, "+r.x+","+a+")")}}}},"drawCommitTags"),mt=h(e=>{switch(e.customType??e.type){case $.NORMAL:return"commit-normal";case $.REVERSE:return"commit-reverse";case $.HIGHLIGHT:return"commit-highlight";case $.MERGE:return"commit-merge";case $.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),dt=h((e,t,r,a)=>{let s={x:0,y:0};if(e.parents.length>0){let c=ke(e.parents);if(c){let o=a.get(c)??s;return t==="TB"?o.y+R:t==="BT"?(a.get(e.id)??s).y-R:o.x+R}}else return t==="TB"?z:t==="BT"?(a.get(e.id)??s).y-R:0;return 0},"calculatePosition"),ht=h((e,t,r)=>{let a=y==="BT"&&r?t:t+O,s=w.get(e.branch)?.pos,c=y==="TB"||y==="BT"?w.get(e.branch)?.pos:a;if(c===void 0||s===void 0)throw new Error(`Position were undefined for commit ${e.id}`);let o=V.has(S().theme??""),n=y==="TB"||y==="BT"?a:s+(o?X/2+1:-2);return{x:c,y:n,posWithOffset:a}},"getCommitPosition"),Be=h((e,t,r,a)=>{let s=e.append("g").attr("class","commit-bullets"),c=e.append("g").attr("class","commit-labels"),o=y==="TB"||y==="BT"?z:0,n=[...t.keys()],d=a.parallelCommits??!1,l=h((g,i)=>{let u=t.get(g)?.seq,f=t.get(i)?.seq;return u!==void 0&&f!==void 0?u-f:0},"sortKeys"),p=n.sort(l);y==="BT"&&(d&&tt(p,t,o),p=p.reverse()),p.forEach(g=>{let i=t.get(g);if(!i)throw new Error(`Commit not found for key ${g}`);d&&(o=dt(i,y,o,T));let u=ht(i,o,d);if(r){let f=mt(i),x=i.customType??i.type,b=w.get(i.branch)?.index??0;st(s,i,u,f,b,x),it(c,i,u,o,a),ct(c,i,u,o)}y==="TB"||y==="BT"?T.set(i.id,{x:u.x,y:u.posWithOffset}):T.set(i.id,{x:u.posWithOffset,y:u.y}),o=y==="BT"&&d?o+R:o+R+O,o>P&&(P=o)})},"drawCommits"),gt=h((e,t,r,a,s)=>{let o=(y==="TB"||y==="BT"?r.xl.branch===o,"isOnBranchToGetCurve"),d=h(l=>l.seq>e.seq&&l.seqd(l)&&n(l))},"shouldRerouteArrow"),N=h((e,t,r=0)=>{let a=e+Math.abs(e-t)/2;if(r>5)return a;if(Y.every(o=>Math.abs(o-a)>=10))return Y.push(a),a;let c=Math.abs(e-t);return N(e,t-c/5,r+1)},"findLane"),lt=h((e,t,r,a)=>{let{theme:s}=S(),c=J.has(s??""),o=T.get(t.id),n=T.get(r.id);if(o===void 0||n===void 0)throw new Error(`Commit positions not found for commits ${t.id} and ${r.id}`);let d=gt(t,r,o,n,a),l="",p="",g=0,i=0,u=w.get(r.branch)?.index;r.type===$.MERGE&&t.id!==r.parents[0]&&(u=w.get(t.branch)?.index);let f;if(d){l="A 10 10, 0, 0, 0,",p="A 10 10, 0, 0, 1,",g=10,i=10;let x=o.yn.x&&(l="A 20 20, 0, 0, 0,",p="A 20 20, 0, 0, 1,",g=20,i=20,r.type===$.MERGE&&t.id!==r.parents[0]?f=`M ${o.x} ${o.y} L ${o.x} ${n.y-g} ${p} ${o.x-i} ${n.y} L ${n.x} ${n.y}`:f=`M ${o.x} ${o.y} L ${n.x+g} ${o.y} ${l} ${n.x} ${o.y+i} L ${n.x} ${n.y}`),o.x===n.x&&(f=`M ${o.x} ${o.y} L ${n.x} ${n.y}`)):y==="BT"?(o.xn.x&&(l="A 20 20, 0, 0, 0,",p="A 20 20, 0, 0, 1,",g=20,i=20,r.type===$.MERGE&&t.id!==r.parents[0]?f=`M ${o.x} ${o.y} L ${o.x} ${n.y+g} ${l} ${o.x-i} ${n.y} L ${n.x} ${n.y}`:f=`M ${o.x} ${o.y} L ${n.x+g} ${o.y} ${p} ${n.x} ${o.y-i} L ${n.x} ${n.y}`),o.x===n.x&&(f=`M ${o.x} ${o.y} L ${n.x} ${n.y}`)):(o.yn.y&&(r.type===$.MERGE&&t.id!==r.parents[0]?f=`M ${o.x} ${o.y} L ${n.x-g} ${o.y} ${l} ${n.x} ${o.y-i} L ${n.x} ${n.y}`:f=`M ${o.x} ${o.y} L ${o.x} ${n.y+g} ${p} ${o.x+i} ${n.y} L ${n.x} ${n.y}`),o.y===n.y&&(f=`M ${o.x} ${o.y} L ${n.x} ${n.y}`));if(f===void 0)throw new Error("Line definition not found");e.append("path").attr("d",f).attr("class","arrow arrow"+I(u,A,c))},"drawArrow"),pt=h((e,t)=>{let r=e.append("g").attr("class","commit-arrows");[...t.keys()].forEach(a=>{let s=t.get(a);s.parents&&s.parents.length>0&&s.parents.forEach(c=>{lt(r,t.get(c),s,t)})})},"drawArrows"),ft=h((e,t,r,a)=>{let{look:s,theme:c,themeVariables:o}=S(),{dropShadow:n,THEME_COLOR_LIMIT:d}=o,l=V.has(c??""),p=J.has(c??""),g=e.append("g");t.forEach((i,u)=>{let f=I(u,l?d:A,p),x=w.get(i.name)?.pos;if(x===void 0)throw new Error(`Position not found for branch ${i.name}`);let b=y==="TB"||y==="BT"?x:l?x+X/2+1:x-2,C=g.append("line");C.attr("x1",0),C.attr("y1",b),C.attr("x2",P),C.attr("y2",b),C.attr("class","branch branch"+f),y==="TB"?(C.attr("y1",z),C.attr("x1",x),C.attr("y2",P),C.attr("x2",x)):y==="BT"&&(C.attr("y1",P),C.attr("x1",x),C.attr("y2",z),C.attr("x2",x)),Y.push(b);let K=i.name,_=Ce(K),M=g.insert("rect"),L=g.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+f);L.node().appendChild(_);let k=_.getBBox(),Q=l?0:4,j=l?16:0,H=l?X:0;s==="neo"&&M.attr("data-look","neo"),M.attr("class","branchLabelBkg label"+f).attr("style",s==="neo"?`filter:${l?`url(#${a}-drop-shadow)`:n}`:"").attr("rx",Q).attr("ry",Q).attr("x",-k.width-4-(r.rotateCommitLabel===!0?30:0)).attr("y",-k.height/2+10).attr("width",k.width+18+j).attr("height",k.height+4+H),L.attr("transform","translate("+(-k.width-14-(r.rotateCommitLabel===!0?30:0)+j/2)+", "+(b-k.height/2-2)+")"),y==="TB"?(M.attr("x",x-k.width/2-10).attr("y",0),L.attr("transform","translate("+(x-k.width/2-5)+", 0)"),l&&(M.attr("transform",`translate(${-j/2-3}, ${-H-10})`),L.attr("transform","translate("+(x-k.width/2-5)+", "+(-H*2+7)+")"))):y==="BT"?(M.attr("x",x-k.width/2-10).attr("y",P),L.attr("transform","translate("+(x-k.width/2-5)+", "+P+")"),l&&(M.attr("transform",`translate(${-j/2-3}, ${H+10})`),L.attr("transform","translate("+(x-k.width/2-5)+", "+(P+H*2+4)+")"))):M.attr("transform","translate(-19, "+(b-12-H/2)+")")})},"drawBranches"),yt=h(function(e,t,r,a,s){return w.set(e,{pos:t,index:r}),t+=50+(s?40:0)+(y==="TB"||y==="BT"?a.width/2:0),t},"setBranchPosition"),$t=h(function(e,t,r,a){Qe(),B.debug("in gitgraph renderer",e+`
`,"id:",t,r);let s=a.db;if(!s.getConfig){B.error("getConfig method is not available on db");return}let c=s.getConfig(),o=c.rotateCommitLabel??!1;W=s.getCommits();let n=s.getBranchesAsObjArray();y=s.getDirection();let d=me(`[id="${t}"]`),{look:l,theme:p,themeVariables:g}=S(),{useGradient:i,gradientStart:u,gradientStop:f,filterColor:x}=g;if(i){let C=d.append("defs").append("linearGradient").attr("id",t+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");C.append("stop").attr("offset","0%").attr("stop-color",u).attr("stop-opacity",1),C.append("stop").attr("offset","100%").attr("stop-color",f).attr("stop-opacity",1)}l==="neo"&&V.has(p??"")&&d.append("defs").append("filter").attr("id",t+"-drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",x);let b=0;n.forEach((C,K)=>{let _=Ce(C.name),M=d.append("g"),U=M.insert("g").attr("class","branchLabel"),L=U.insert("g").attr("class","label branch-label");L.node()?.appendChild(_);let k=_.getBBox();b=yt(C.name,b,K,k,o),L.remove(),U.remove(),M.remove()}),Be(d,W,!1,c),c.showBranches&&ft(d,n,c,t),pt(d,W),Be(d,W,!0,c),ge.insertTitle(d,"gitTitleText",c.titleTopMargin??0,s.getDiagramTitle()),ce(void 0,d,c.diagramPadding,c.useMaxWidth)},"draw"),we={draw:$t};var Te=8,Ee=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),ut=new Set(["redux-color","redux-dark-color"]),xt=new Set(["neo","neo-dark"]),bt=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),Bt=new Set(["redux","redux-dark","redux-color","redux-dark-color","neo","neo-dark"]),Ct=h(e=>{let{svgId:t}=e,r="";if(e.useGradient&&t)for(let a=0;a{let t=q(),{theme:r,themeVariables:a}=t,{borderColorArray:s}=a,c=Ee.has(r);if(xt.has(r)){let o="";for(let n=0;n`${Array.from({length:e.THEME_COLOR_LIMIT},(t,r)=>r).map(t=>{let r=t%Te;return`
.branch-label${t} { fill: ${e["gitBranchLabel"+r]}; }
.commit${t} { stroke: ${e["git"+r]}; fill: ${e["git"+r]}; }
.commit-highlight${t} { stroke: ${e["gitInv"+r]}; fill: ${e["gitInv"+r]}; }
.label${t} { fill: ${e["git"+r]}; }
.arrow${t} { stroke: ${e["git"+r]}; }
`}).join(`
`)}`,"normalTheme"),Tt=h(e=>{let t=q(),{theme:r}=t,a=Bt.has(r);return`
.commit-id,
.commit-msg,
.branch-label {
fill: lightgrey;
color: lightgrey;
font-family: 'trebuchet ms', verdana, arial, sans-serif;
font-family: var(--mermaid-font-family);
}
${a?kt(e):wt(e)}
.branch {
stroke-width: ${e.strokeWidth};
stroke: ${e.commitLineColor??e.lineColor};
stroke-dasharray: ${a?"4 2":"2"};
}
.commit-label { font-size: ${e.commitLabelFontSize}; fill: ${a?e.nodeBorder:e.commitLabelColor}; ${a?`font-weight:${e.noteFontWeight};`:""}}
.commit-label-bkg { font-size: ${e.commitLabelFontSize}; fill: ${a?"transparent":e.commitLabelBackground}; opacity: ${a?"":.5}; }
.tag-label { font-size: ${e.tagLabelFontSize}; fill: ${e.tagLabelColor};}
.tag-label-bkg { fill: ${a?e.mainBkg:e.tagLabelBackground}; stroke: ${a?e.nodeBorder:e.tagLabelBorder}; ${a?`filter:${e.dropShadow}`:""} }
.tag-hole { fill: ${e.textColor}; }
.commit-merge {
stroke: ${a?e.mainBkg:e.primaryColor};
fill: ${a?e.mainBkg:e.primaryColor};
}
.commit-reverse {
stroke: ${a?e.mainBkg:e.primaryColor};
fill: ${a?e.mainBkg:e.primaryColor};
stroke-width: ${a?e.strokeWidth:3};
}
.commit-highlight-outer {
}
.commit-highlight-inner {
stroke: ${a?e.mainBkg:e.primaryColor};
fill: ${a?e.mainBkg:e.primaryColor};
}
.arrow {
/* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */
stroke-width: ${Ee.has(r)?e.strokeWidth:8};
stroke-linecap: round;
fill: none
}
.gitTitleText {
text-anchor: middle;
font-size: 18px;
fill: ${e.textColor};
}
`},"getStyles"),Me=Tt;var or={parser:be,db:F,renderer:we,styles:Me};export{or as diagram};