gbehem/Data_Visualization_Project_RQ2
0
1var J;import"./chunk-TCCFYFTB-49JL9s9e.js";import"./main-DrBRErTM.js";import"./purify.es-BBn8CPhf.js";import{u as Q}from"./src-Bp_72rVO.js";import{g as X,i as Z,m as tt}from"./chunk-S3R3BYOJ-qrwvlUdq.js";import{n as h,r as u}from"./src-CW27-Kjl.js";import{B as rt,C as et,K as at,U as ot,_ as it,a as st,b as ct,d as nt,s as k,v as dt,y as ht,z as mt}from"./chunk-ABZYJK2D-D_Wumzom.js";import"./dist-COnmrAVZ.js";import"./chunk-UMXZTB3W-Bt-_br31.js";import"./chunk-4F5CHEZ2-BGeTOmrq.js";import"./chunk-FRFDVMJY-CUDE-MUX.js";import"./chunk-SJTYNZTY-C9cwtT3h.js";import"./chunk-PL6DKKU2-DMqBvHTF.js";import"./chunk-TQ3KTPDO-CUyT9lNN.js";import"./chunk-B2363JML-Cmh9TPpj.js";import{t as lt}from"./chunk-4BX2VUAB-DOQhLGwX.js";import{t as $t}from"./mermaid-parser.core-DR82IMb2.js";import{t as yt}from"./chunk-QZHKN3VN-D3EIvP2i.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},gt=nt.gitGraph,A=h(()=>Z({...gt,...ht().gitGraph}),"getConfig"),n=new yt(()=>{let r=A(),t=r.mainBranchName,a=r.mainBranchOrder;return{mainBranchName:t,commits:new Map,head:null,branchConfig:new Map([[t,{name:t,order:a}]]),branches:new Map([[t,null]]),currBranch:t,direction:"LR",seq:0,options:{}}});function z(){return tt({length:7})}h(z,"getID");function j(r,t){let a=Object.create(null);return r.reduce((i,e)=>{let o=t(e);return a[o]||(a[o]=!0,i.push(e)),i},[])}h(j,"uniqBy");var pt=h(function(r){n.records.direction=r},"setDirection"),xt=h(function(r){u.debug("options str",r),r=r==null?void 0:r.trim(),r||(r="{}");try{n.records.options=JSON.parse(r)}catch(t){u.error("error while parsing gitGraph options",t.message)}},"setOptions"),ft=h(function(){return n.records.options},"getOptions"),ut=h(function(r){let t=r.msg,a=r.id,i=r.type,e=r.tags;u.info("commit",t,a,i,e),u.debug("Entering commit:",t,a,i,e);let o=A();a=k.sanitizeText(a,o),t=k.sanitizeText(t,o),e=e==null?void 0:e.map(s=>k.sanitizeText(s,o));let c={id:a||n.records.seq+"-"+z(),message:t,seq:n.records.seq++,type:i??p.NORMAL,tags:e??[],parents:n.records.head==null?[]:[n.records.head.id],branch:n.records.currBranch};n.records.head=c,u.info("main branch",o.mainBranchName),n.records.commits.has(c.id)&&u.warn(`Commit ID ${c.id} already exists`),n.records.commits.set(c.id,c),n.records.branches.set(n.records.currBranch,c.id),u.debug("in pushCommit "+c.id)},"commit"),bt=h(function(r){let t=r.name,a=r.order;if(t=k.sanitizeText(t,A()),n.records.branches.has(t))throw 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}")`);n.records.branches.set(t,n.records.head==null?null:n.records.head.id),n.records.branchConfig.set(t,{name:t,order:a}),_(t),u.debug("in createBranch")},"branch"),wt=h(r=>{let t=r.branch,a=r.id,i=r.type,e=r.tags,o=A();t=k.sanitizeText(t,o),a&&(a=k.sanitizeText(a,o));let c=n.records.branches.get(n.records.currBranch),s=n.records.branches.get(t),m=c?n.records.commits.get(c):void 0,$=s?n.records.commits.get(s):void 0;if(m&&$&&m.branch===t)throw Error(`Cannot merge branch '${t}' into itself.`);if(n.records.currBranch===t){let d=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},d}if(m===void 0||!m){let d=Error(`Incorrect usage of "merge". Current branch (${n.records.currBranch})has no commits`);throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["commit"]},d}if(!n.records.branches.has(t)){let d=Error('Incorrect usage of "merge". Branch to be merged ('+t+") does not exist");throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:[`branch ${t}`]},d}if($===void 0||!$){let d=Error('Incorrect usage of "merge". Branch to be merged ('+t+") has no commits");throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:['"commit"']},d}if(m===$){let d=Error('Incorrect usage of "merge". Both branches have same head');throw d.hash={text:`merge ${t}`,token:`merge ${t}`,expected:["branch abc"]},d}if(a&&n.records.commits.has(a)){let d=Error('Incorrect usage of "merge". Commit with id:'+a+" already exists, use different custom id");throw d.hash={text:`merge ${t} ${a} ${i} ${e==null?void 0:e.join(" ")}`,token:`merge ${t} ${a} ${i} ${e==null?void 0:e.join(" ")}`,expected:[`merge ${t} ${a}_UNIQUE ${i} ${e==null?void 0:e.join(" ")}`]},d}let l=s||"",y={id:a||`${n.records.seq}-${z()}`,message:`merged branch ${t} into ${n.records.currBranch}`,seq:n.records.seq++,parents:n.records.head==null?[]:[n.records.head.id,l],branch:n.records.currBranch,type:p.MERGE,customType:i,customId:!!a,tags:e??[]};n.records.head=y,n.records.commits.set(y.id,y),n.records.branches.set(n.records.currBranch,y.id),u.debug(n.records.branches),u.debug("in mergeBranch")},"merge"),Bt=h(function(r){let t=r.id,a=r.targetId,i=r.tags,e=r.parent;u.debug("Entering cherryPick:",t,a,i);let o=A();if(t=k.sanitizeText(t,o),a=k.sanitizeText(a,o),i=i==null?void 0:i.map(m=>k.sanitizeText(m,o)),e=k.sanitizeText(e,o),!t||!n.records.commits.has(t)){let m=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw m.hash={text:`cherryPick ${t} ${a}`,token:`cherryPick ${t} ${a}`,expected:["cherry-pick abc"]},m}let c=n.records.commits.get(t);if(c===void 0||!c)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(e&&!(Array.isArray(c.parents)&&c.parents.includes(e)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let s=c.branch;if(c.type===p.MERGE&&!e)throw Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!a||!n.records.commits.has(a)){if(s===n.records.currBranch){let y=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw y.hash={text:`cherryPick ${t} ${a}`,token:`cherryPick ${t} ${a}`,expected:["cherry-pick abc"]},y}let m=n.records.branches.get(n.records.currBranch);if(m===void 0||!m){let y=Error(`Incorrect usage of "cherry-pick". Current branch (${n.records.currBranch})has no commits`);throw y.hash={text:`cherryPick ${t} ${a}`,token:`cherryPick ${t} ${a}`,expected:["cherry-pick abc"]},y}let $=n.records.commits.get(m);if($===void 0||!$){let y=Error(`Incorrect usage of "cherry-pick". Current branch (${n.records.currBranch})has no commits`);throw y.hash={text:`cherryPick ${t} ${a}`,token:`cherryPick ${t} ${a}`,expected:["cherry-pick abc"]},y}let l={id:n.records.seq+"-"+z(),message:`cherry-picked ${c==null?void 0:c.message} into ${n.records.currBranch}`,seq:n.records.seq++,parents:n.records.head==null?[]:[n.records.head.id,c.id],branch:n.records.currBranch,type:p.CHERRY_PICK,tags:i?i.filter(Boolean):[`cherry-pick:${c.id}${c.type===p.MERGE?`|parent:${e}`:""}`]};n.records.head=l,n.records.commits.set(l.id,l),n.records.branches.set(n.records.currBranch,l.id),u.debug(n.records.branches),u.debug("in cherryPick")}},"cherryPick"),_=h(function(r){if(r=k.sanitizeText(r,A()),n.records.branches.has(r)){n.records.currBranch=r;let t=n.records.branches.get(n.records.currBranch);t===void 0||!t?n.records.head=null:n.records.head=n.records.commits.get(t)??null}else{let t=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${r}")`);throw t.hash={text:`checkout ${r}`,token:`checkout ${r}`,expected:[`branch ${r}`]},t}},"checkout");function D(r,t,a){let i=r.indexOf(t);i===-1?r.push(a):r.splice(i,1,a)}h(D,"upsert");function N(r){let t=r.reduce((e,o)=>e.seq>o.seq?e:o,r[0]),a="";r.forEach(function(e){e===t?a+=" *":a+=" |"});let i=[a,t.id,t.seq];for(let e in n.records.branches)n.records.branches.get(e)===t.id&&i.push(e);if(u.debug(i.join(" ")),t.parents&&t.parents.length==2&&t.parents[0]&&t.parents[1]){let e=n.records.commits.get(t.parents[0]);D(r,t,e),t.parents[1]&&r.push(n.records.commits.get(t.parents[1]))}else{if(t.parents.length==0)return;if(t.parents[0]){let e=n.records.commits.get(t.parents[0]);D(r,t,e)}}r=j(r,e=>e.id),N(r)}h(N,"prettyPrintCommitHistory");var Et=h(function(){u.debug(n.records.commits);let r=K()[0];N([r])},"prettyPrint"),Ct=h(function(){n.reset(),st()},"clear"),kt=h(function(){return[...n.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),Lt=h(function(){return n.records.branches},"getBranches"),Tt=h(function(){return n.records.commits},"getCommits"),K=h(function(){let r=[...n.records.commits.values()];return r.forEach(function(t){u.debug(t.id)}),r.sort((t,a)=>t.seq-a.seq),r},"getCommitsArray"),F={commitType:p,getConfig:A,setDirection:pt,setOptions:xt,getOptions:ft,commit:ut,branch:bt,merge:wt,cherryPick:Bt,checkout:_,prettyPrint:Et,clear:Ct,getBranchesAsObjArray:kt,getBranches:Lt,getCommits:Tt,getCommitsArray:K,getCurrentBranch:h(function(){return n.records.currBranch},"getCurrentBranch"),getDirection:h(function(){return n.records.direction},"getDirection"),getHead:h(function(){return n.records.head},"getHead"),setAccTitle:rt,getAccTitle:dt,getAccDescription:it,setAccDescription:mt,setDiagramTitle:ot,getDiagramTitle:et},Mt=h((r,t)=>{lt(r,t),r.dir&&t.setDirection(r.dir);for(let a of r.statements)vt(a,t)},"populate"),vt=h((r,t)=>{let a={Commit:h(i=>t.commit(Pt(i)),"Commit"),Branch:h(i=>t.branch(Rt(i)),"Branch"),Merge:h(i=>t.merge(At(i)),"Merge"),Checkout:h(i=>t.checkout(Gt(i)),"Checkout"),CherryPicking:h(i=>t.cherryPick(Ot(i)),"CherryPicking")}[r.$type];a?a(r):u.error(`Unknown statement type: ${r.$type}`)},"parseStatement"),Pt=h(r=>({id:r.id,msg:r.message??"",type:r.type===void 0?p.NORMAL:p[r.type],tags:r.tags??void 0}),"parseCommit"),Rt=h(r=>({name:r.name,order:r.order??0}),"parseBranch"),At=h(r=>({branch:r.branch,id:r.id??"",type:r.type===void 0?void 0:p[r.type],tags:r.tags??void 0}),"parseMerge"),Gt=h(r=>r.branch,"parseCheckout"),Ot=h(r=>{var t;return{id:r.id,targetId:"",tags:((t=r.tags)==null?void 0:t.length)===0?void 0:r.tags,parent:r.parent}},"parseCherryPicking"),It={parse:h(async r=>{let t=await $t("gitGraph",r);u.debug(t),Mt(t,F)},"parse")},f=(J=ct())==null?void 0:J.gitGraph,v=10,P=40,L=4,T=2,G=8,E=new Map,C=new Map,H=30,I=new Map,S=[],R=0,g="LR",qt=h(()=>{E.clear(),C.clear(),I.clear(),R=0,S=[],g="LR"},"clear"),Y=h(r=>{let t=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof r=="string"?r.split(/\\n|\n|<br\s*\/?>/gi):r).forEach(a=>{let i=document.createElementNS("http://www.w3.org/2000/svg","tspan");i.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),i.setAttribute("dy","1em"),i.setAttribute("x","0"),i.setAttribute("class","row"),i.textContent=a.trim(),t.appendChild(i)}),t},"drawText"),U=h(r=>{let t,a,i;return g==="BT"?(a=h((e,o)=>e<=o,"comparisonFunc"),i=1/0):(a=h((e,o)=>e>=o,"comparisonFunc"),i=0),r.forEach(e=>{var c,s;let o=g==="TB"||g=="BT"?(c=C.get(e))==null?void 0:c.y:(s=C.get(e))==null?void 0:s.x;o!==void 0&&a(o,i)&&(t=e,i=o)}),t},"findClosestParent"),zt=h(r=>{let t="",a=1/0;return r.forEach(i=>{let e=C.get(i).y;e<=a&&(t=i,a=e)}),t||void 0},"findClosestParentBT"),Ht=h((r,t,a)=>{let i=a,e=a,o=[];r.forEach(c=>{let s=t.get(c);if(!s)throw Error(`Commit not found for key ${c}`);s.parents.length?(i=Dt(s),e=Math.max(i,e)):o.push(s),Nt(s,i)}),i=e,o.forEach(c=>{Wt(c,i,a)}),r.forEach(c=>{let s=t.get(c);if(s!=null&&s.parents.length){let m=zt(s.parents);i=C.get(m).y-P,i<=e&&(e=i);let $=E.get(s.branch).pos,l=i-v;C.set(s.id,{x:$,y:l})}})},"setParallelBTPos"),St=h(r=>{var i;let t=U(r.parents.filter(e=>e!==null));if(!t)throw Error(`Closest parent not found for commit ${r.id}`);let a=(i=C.get(t))==null?void 0:i.y;if(a===void 0)throw Error(`Closest parent position not found for commit ${r.id}`);return a},"findClosestParentPos"),Dt=h(r=>St(r)+P,"calculateCommitPosition"),Nt=h((r,t)=>{let a=E.get(r.branch);if(!a)throw Error(`Branch not found for commit ${r.id}`);let i=a.pos,e=t+v;return C.set(r.id,{x:i,y:e}),{x:i,y:e}},"setCommitPosition"),Wt=h((r,t,a)=>{let i=E.get(r.branch);if(!i)throw Error(`Branch not found for commit ${r.id}`);let e=t+a,o=i.pos;C.set(r.id,{x:o,y:e})},"setRootPosition"),jt=h((r,t,a,i,e,o)=>{if(o===p.HIGHLIGHT)r.append("rect").attr("x",a.x-10).attr("y",a.y-10).attr("width",20).attr("height",20).attr("class",`commit ${t.id} commit-highlight${e%G} ${i}-outer`),r.append("rect").attr("x",a.x-6).attr("y",a.y-6).attr("width",12).attr("height",12).attr("class",`commit ${t.id} commit${e%G} ${i}-inner`);else if(o===p.CHERRY_PICK)r.append("circle").attr("cx",a.x).attr("cy",a.y).attr("r",10).attr("class",`commit ${t.id} ${i}`),r.append("circle").attr("cx",a.x-3).attr("cy",a.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${t.id} ${i}`),r.append("circle").attr("cx",a.x+3).attr("cy",a.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${t.id} ${i}`),r.append("line").attr("x1",a.x+3).attr("y1",a.y+1).attr("x2",a.x).attr("y2",a.y-5).attr("stroke","#fff").attr("class",`commit ${t.id} ${i}`),r.append("line").attr("x1",a.x-3).attr("y1",a.y+1).attr("x2",a.x).attr("y2",a.y-5).attr("stroke","#fff").attr("class",`commit ${t.id} ${i}`);else{let c=r.append("circle");if(c.attr("cx",a.x),c.attr("cy",a.y),c.attr("r",t.type===p.MERGE?9:10),c.attr("class",`commit ${t.id} commit${e%G}`),o===p.MERGE){let s=r.append("circle");s.attr("cx",a.x),s.attr("cy",a.y),s.attr("r",6),s.attr("class",`commit ${i} ${t.id} commit${e%G}`)}o===p.REVERSE&&r.append("path").attr("d",`M ${a.x-5},${a.y-5}L${a.x+5},${a.y+5}M${a.x-5},${a.y+5}L${a.x+5},${a.y-5}`).attr("class",`commit ${i} ${t.id} commit${e%G}`)}},"drawCommitBullet"),_t=h((r,t,a,i)=>{var e;if(t.type!==p.CHERRY_PICK&&(t.customId&&t.type===p.MERGE||t.type!==p.MERGE)&&(f!=null&&f.showCommitLabel)){let o=r.append("g"),c=o.insert("rect").attr("class","commit-label-bkg"),s=o.append("text").attr("x",i).attr("y",a.y+25).attr("class","commit-label").text(t.id),m=(e=s.node())==null?void 0:e.getBBox();if(m&&(c.attr("x",a.posWithOffset-m.width/2-T).attr("y",a.y+13.5).attr("width",m.width+2*T).attr("height",m.height+2*T),g==="TB"||g==="BT"?(c.attr("x",a.x-(m.width+4*L+5)).attr("y",a.y-12),s.attr("x",a.x-(m.width+4*L)).attr("y",a.y+m.height-12)):s.attr("x",a.posWithOffset-m.width/2),f.rotateCommitLabel))if(g==="TB"||g==="BT")s.attr("transform","rotate(-45, "+a.x+", "+a.y+")"),c.attr("transform","rotate(-45, "+a.x+", "+a.y+")");else{let $=-7.5-(m.width+10)/25*9.5,l=10+m.width/25*8.5;o.attr("transform","translate("+$+", "+l+") rotate(-45, "+i+", "+a.y+")")}}},"drawCommitLabel"),Kt=h((r,t,a,i)=>{var e;if(t.tags.length>0){let o=0,c=0,s=0,m=[];for(let $ of t.tags.reverse()){let l=r.insert("polygon"),y=r.append("circle"),d=r.append("text").attr("y",a.y-16-o).attr("class","tag-label").text($),x=(e=d.node())==null?void 0:e.getBBox();if(!x)throw Error("Tag bbox not found");c=Math.max(c,x.width),s=Math.max(s,x.height),d.attr("x",a.posWithOffset-x.width/2),m.push({tag:d,hole:y,rect:l,yOffset:o}),o+=20}for(let{tag:$,hole:l,rect:y,yOffset:d}of m){let x=s/2,b=a.y-19.2-d;if(y.attr("class","tag-label-bkg").attr("points",`2 ${i-c/2-L/2},${b+T} 3 ${i-c/2-L/2},${b-T}4 ${a.posWithOffset-c/2-L},${b-x-T}5 ${a.posWithOffset+c/2+L},${b-x-T}6 ${a.posWithOffset+c/2+L},${b+x+T}7 ${a.posWithOffset-c/2-L},${b+x+T}`),l.attr("cy",b).attr("cx",i-c/2+L/2).attr("r",1.5).attr("class","tag-hole"),g==="TB"||g==="BT"){let w=i+d;y.attr("class","tag-label-bkg").attr("points",`8 ${a.x},${w+2}9 ${a.x},${w-2}10 ${a.x+v},${w-x-2}11 ${a.x+v+c+4},${w-x-2}12 ${a.x+v+c+4},${w+x+2}13 ${a.x+v},${w+x+2}`).attr("transform","translate(12,12) rotate(45, "+a.x+","+i+")"),l.attr("cx",a.x+L/2).attr("cy",w).attr("transform","translate(12,12) rotate(45, "+a.x+","+i+")"),$.attr("x",a.x+5).attr("y",w+3).attr("transform","translate(14,14) rotate(45, "+a.x+","+i+")")}}}},"drawCommitTags"),Ft=h(r=>{switch(r.customType??r.type){case p.NORMAL:return"commit-normal";case p.REVERSE:return"commit-reverse";case p.HIGHLIGHT:return"commit-highlight";case p.MERGE:return"commit-merge";case p.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),Yt=h((r,t,a,i)=>{let e={x:0,y:0};if(r.parents.length>0){let o=U(r.parents);if(o){let c=i.get(o)??e;return t==="TB"?c.y+P:t==="BT"?(i.get(r.id)??e).y-P:c.x+P}}else return t==="TB"?H:t==="BT"?(i.get(r.id)??e).y-P:0;return 0},"calculatePosition"),Ut=h((r,t,a)=>{var c,s;let i=g==="BT"&&a?t:t+v,e=g==="TB"||g==="BT"?i:(c=E.get(r.branch))==null?void 0:c.pos,o=g==="TB"||g==="BT"?(s=E.get(r.branch))==null?void 0:s.pos:i;if(o===void 0||e===void 0)throw Error(`Position were undefined for commit ${r.id}`);return{x:o,y:e,posWithOffset:i}},"getCommitPosition"),V=h((r,t,a)=>{if(!f)throw Error("GitGraph config not found");let i=r.append("g").attr("class","commit-bullets"),e=r.append("g").attr("class","commit-labels"),o=g==="TB"||g==="BT"?H:0,c=[...t.keys()],s=(f==null?void 0:f.parallelCommits)??!1,m=h((l,y)=>{var b,w;let d=(b=t.get(l))==null?void 0:b.seq,x=(w=t.get(y))==null?void 0:w.seq;return d!==void 0&&x!==void 0?d-x:0},"sortKeys"),$=c.sort(m);g==="BT"&&(s&&Ht($,t,o),$=$.reverse()),$.forEach(l=>{var x;let y=t.get(l);if(!y)throw Error(`Commit not found for key ${l}`);s&&(o=Yt(y,g,o,C));let d=Ut(y,o,s);if(a){let b=Ft(y),w=y.customType??y.type;jt(i,y,d,b,((x=E.get(y.branch))==null?void 0:x.index)??0,w),_t(e,y,d,o),Kt(e,y,d,o)}g==="TB"||g==="BT"?C.set(y.id,{x:d.x,y:d.posWithOffset}):C.set(y.id,{x:d.posWithOffset,y:d.y}),o=g==="BT"&&s?o+P:o+P+v,o>R&&(R=o)})},"drawCommits"),Vt=h((r,t,a,i,e)=>{let o=(g==="TB"||g==="BT"?a.x<i.x:a.y<i.y)?t.branch:r.branch,c=h(m=>m.branch===o,"isOnBranchToGetCurve"),s=h(m=>m.seq>r.seq&&m.seq<t.seq,"isBetweenCommits");return[...e.values()].some(m=>s(m)&&c(m))},"shouldRerouteArrow"),q=h((r,t,a=0)=>{let i=r+Math.abs(r-t)/2;return a>5?i:S.every(e=>Math.abs(e-i)>=10)?(S.push(i),i):q(r,t-Math.abs(r-t)/5,a+1)},"findLane"),Jt=h((r,t,a,i)=>{var x,b,w,O,W;let e=C.get(t.id),o=C.get(a.id);if(e===void 0||o===void 0)throw Error(`Commit positions not found for commits ${t.id} and ${a.id}`);let c=Vt(t,a,e,o,i),s="",m="",$=0,l=0,y=(x=E.get(a.branch))==null?void 0:x.index;a.type===p.MERGE&&t.id!==a.parents[0]&&(y=(b=E.get(t.branch))==null?void 0:b.index);let d;if(c){s="A 10 10, 0, 0, 0,",m="A 10 10, 0, 0, 1,",$=10,l=10;let M=e.y<o.y?q(e.y,o.y):q(o.y,e.y),B=e.x<o.x?q(e.x,o.x):q(o.x,e.x);g==="TB"?e.x<o.x?d=`M ${e.x} ${e.y} L ${B-$} ${e.y} ${m} ${B} ${e.y+l} L ${B} ${o.y-$} ${s} ${B+l} ${o.y} L ${o.x} ${o.y}`:(y=(w=E.get(t.branch))==null?void 0:w.index,d=`M ${e.x} ${e.y} L ${B+$} ${e.y} ${s} ${B} ${e.y+l} L ${B} ${o.y-$} ${m} ${B-l} ${o.y} L ${o.x} ${o.y}`):g==="BT"?e.x<o.x?d=`M ${e.x} ${e.y} L ${B-$} ${e.y} ${s} ${B} ${e.y-l} L ${B} ${o.y+$} ${m} ${B+l} ${o.y} L ${o.x} ${o.y}`:(y=(O=E.get(t.branch))==null?void 0:O.index,d=`M ${e.x} ${e.y} L ${B+$} ${e.y} ${m} ${B} ${e.y-l} L ${B} ${o.y+$} ${s} ${B-l} ${o.y} L ${o.x} ${o.y}`):e.y<o.y?d=`M ${e.x} ${e.y} L ${e.x} ${M-$} ${s} ${e.x+l} ${M} L ${o.x-$} ${M} ${m} ${o.x} ${M+l} L ${o.x} ${o.y}`:(y=(W=E.get(t.branch))==null?void 0:W.index,d=`M ${e.x} ${e.y} L ${e.x} ${M+$} ${m} ${e.x+l} ${M} L ${o.x-$} ${M} ${s} ${o.x} ${M-l} L ${o.x} ${o.y}`)}else s="A 20 20, 0, 0, 0,",m="A 20 20, 0, 0, 1,",$=20,l=20,g==="TB"?(e.x<o.x&&(d=a.type===p.MERGE&&t.id!==a.parents[0]?`M ${e.x} ${e.y} L ${e.x} ${o.y-$} ${s} ${e.x+l} ${o.y} L ${o.x} ${o.y}`:`M ${e.x} ${e.y} L ${o.x-$} ${e.y} ${m} ${o.x} ${e.y+l} L ${o.x} ${o.y}`),e.x>o.x&&(s="A 20 20, 0, 0, 0,",m="A 20 20, 0, 0, 1,",$=20,l=20,d=a.type===p.MERGE&&t.id!==a.parents[0]?`M ${e.x} ${e.y} L ${e.x} ${o.y-$} ${m} ${e.x-l} ${o.y} L ${o.x} ${o.y}`:`M ${e.x} ${e.y} L ${o.x+$} ${e.y} ${s} ${o.x} ${e.y+l} L ${o.x} ${o.y}`),e.x===o.x&&(d=`M ${e.x} ${e.y} L ${o.x} ${o.y}`)):g==="BT"?(e.x<o.x&&(d=a.type===p.MERGE&&t.id!==a.parents[0]?`M ${e.x} ${e.y} L ${e.x} ${o.y+$} ${m} ${e.x+l} ${o.y} L ${o.x} ${o.y}`:`M ${e.x} ${e.y} L ${o.x-$} ${e.y} ${s} ${o.x} ${e.y-l} L ${o.x} ${o.y}`),e.x>o.x&&(s="A 20 20, 0, 0, 0,",m="A 20 20, 0, 0, 1,",$=20,l=20,d=a.type===p.MERGE&&t.id!==a.parents[0]?`M ${e.x} ${e.y} L ${e.x} ${o.y+$} ${s} ${e.x-l} ${o.y} L ${o.x} ${o.y}`:`M ${e.x} ${e.y} L ${o.x-$} ${e.y} ${s} ${o.x} ${e.y-l} L ${o.x} ${o.y}`),e.x===o.x&&(d=`M ${e.x} ${e.y} L ${o.x} ${o.y}`)):(e.y<o.y&&(d=a.type===p.MERGE&&t.id!==a.parents[0]?`M ${e.x} ${e.y} L ${o.x-$} ${e.y} ${m} ${o.x} ${e.y+l} L ${o.x} ${o.y}`:`M ${e.x} ${e.y} L ${e.x} ${o.y-$} ${s} ${e.x+l} ${o.y} L ${o.x} ${o.y}`),e.y>o.y&&(d=a.type===p.MERGE&&t.id!==a.parents[0]?`M ${e.x} ${e.y} L ${o.x-$} ${e.y} ${s} ${o.x} ${e.y-l} L ${o.x} ${o.y}`:`M ${e.x} ${e.y} L ${e.x} ${o.y+$} ${m} ${e.x+l} ${o.y} L ${o.x} ${o.y}`),e.y===o.y&&(d=`M ${e.x} ${e.y} L ${o.x} ${o.y}`));if(d===void 0)throw Error("Line definition not found");r.append("path").attr("d",d).attr("class","arrow arrow"+y%G)},"drawArrow"),Qt=h((r,t)=>{let a=r.append("g").attr("class","commit-arrows");[...t.keys()].forEach(i=>{let e=t.get(i);e.parents&&e.parents.length>0&&e.parents.forEach(o=>{Jt(a,t.get(o),e,t)})})},"drawArrows"),Xt=h((r,t)=>{let a=r.append("g");t.forEach((i,e)=>{var x;let o=e%G,c=(x=E.get(i.name))==null?void 0:x.pos;if(c===void 0)throw Error(`Position not found for branch ${i.name}`);let s=a.append("line");s.attr("x1",0),s.attr("y1",c),s.attr("x2",R),s.attr("y2",c),s.attr("class","branch branch"+o),g==="TB"?(s.attr("y1",H),s.attr("x1",c),s.attr("y2",R),s.attr("x2",c)):g==="BT"&&(s.attr("y1",R),s.attr("x1",c),s.attr("y2",H),s.attr("x2",c)),S.push(c);let m=i.name,$=Y(m),l=a.insert("rect"),y=a.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+o);y.node().appendChild($);let d=$.getBBox();l.attr("class","branchLabelBkg label"+o).attr("rx",4).attr("ry",4).attr("x",-d.width-4-((f==null?void 0:f.rotateCommitLabel)===!0?30:0)).attr("y",-d.height/2+8).attr("width",d.width+18).attr("height",d.height+4),y.attr("transform","translate("+(-d.width-14-((f==null?void 0:f.rotateCommitLabel)===!0?30:0))+", "+(c-d.height/2-1)+")"),g==="TB"?(l.attr("x",c-d.width/2-10).attr("y",0),y.attr("transform","translate("+(c-d.width/2-5)+", 0)")):g==="BT"?(l.attr("x",c-d.width/2-10).attr("y",R),y.attr("transform","translate("+(c-d.width/2-5)+", "+R+")")):l.attr("transform","translate(-19, "+(c-d.height/2)+")")})},"drawBranches"),Zt=h(function(r,t,a,i,e){return E.set(r,{pos:t,index:a}),t+=50+(e?40:0)+(g==="TB"||g==="BT"?i.width/2:0),t},"setBranchPosition"),tr={parser:It,db:F,renderer:{draw:h(function(r,t,a,i){if(qt(),u.debug("in gitgraph renderer",r+`14`,"id:",t,a),!f)throw Error("GitGraph config not found");let e=f.rotateCommitLabel??!1,o=i.db;I=o.getCommits();let c=o.getBranchesAsObjArray();g=o.getDirection();let s=Q(`[id="${t}"]`),m=0;c.forEach(($,l)=>{var O;let y=Y($.name),d=s.append("g"),x=d.insert("g").attr("class","branchLabel"),b=x.insert("g").attr("class","label branch-label");(O=b.node())==null||O.appendChild(y);let w=y.getBBox();m=Zt($.name,m,l,w,e),b.remove(),x.remove(),d.remove()}),V(s,I,!1),f.showBranches&&Xt(s,c),Qt(s,I),V(s,I,!0),X.insertTitle(s,"gitTitleText",f.titleTopMargin??0,o.getDiagramTitle()),at(void 0,s,f.diagramPadding,f.useMaxWidth)},"draw")},styles:h(r=>`15 .commit-id,16 .commit-msg,17 .branch-label {18 fill: lightgrey;19 color: lightgrey;20 font-family: 'trebuchet ms', verdana, arial, sans-serif;21 font-family: var(--mermaid-font-family);22 }23 ${[0,1,2,3,4,5,6,7].map(t=>`24 .branch-label${t} { fill: ${r["gitBranchLabel"+t]}; }25 .commit${t} { stroke: ${r["git"+t]}; fill: ${r["git"+t]}; }26 .commit-highlight${t} { stroke: ${r["gitInv"+t]}; fill: ${r["gitInv"+t]}; }27 .label${t} { fill: ${r["git"+t]}; }28 .arrow${t} { stroke: ${r["git"+t]}; }29 `).join(`30`)}31 32 .branch {33 stroke-width: 1;34 stroke: ${r.lineColor};35 stroke-dasharray: 2;36 }37 .commit-label { font-size: ${r.commitLabelFontSize}; fill: ${r.commitLabelColor};}38 .commit-label-bkg { font-size: ${r.commitLabelFontSize}; fill: ${r.commitLabelBackground}; opacity: 0.5; }39 .tag-label { font-size: ${r.tagLabelFontSize}; fill: ${r.tagLabelColor};}40 .tag-label-bkg { fill: ${r.tagLabelBackground}; stroke: ${r.tagLabelBorder}; }41 .tag-hole { fill: ${r.textColor}; }42 43 .commit-merge {44 stroke: ${r.primaryColor};45 fill: ${r.primaryColor};46 }47 .commit-reverse {48 stroke: ${r.primaryColor};49 fill: ${r.primaryColor};50 stroke-width: 3;51 }52 .commit-highlight-outer {53 }54 .commit-highlight-inner {55 stroke: ${r.primaryColor};56 fill: ${r.primaryColor};57 }58 59 .arrow { stroke-width: 8; stroke-linecap: round; fill: none}60 .gitTitleText {61 text-anchor: middle;62 font-size: 18px;63 fill: ${r.textColor};64 }65`,"getStyles")};export{tr as diagram};66 