f7cloud_client/apps/text/js/gitGraphDiagram-NY62KEGX-CoAlzKsu.chunk.mjs
2026-03-05 13:40:40 +00:00

67 lines
24 KiB
JavaScript

import{p as K}from"./chunk-4BX2VUAB-CXxCl32T.chunk.mjs";import{I as Y}from"./chunk-QZHKN3VN-BN6G8Q4W.chunk.mjs";import{_ as h,t as U,q as V,s as J,g as Q,a as X,b as Z,l as u,c as rr,d as tr,u as er,E as or,z as ar,k as E,F as nr,G as cr,H as ir,I as sr}from"./mermaid.core-DrJfu-9d.chunk.mjs";import{p as dr}from"./treemap-KMMF4GRG-BHT9xVli.chunk.mjs";import"./index-CRQM6PVi.chunk.mjs";import"./emoji-picker-MDCGxHB0.chunk.mjs";import"./NcLoadingIcon-ZJnsd-es.chunk.mjs";import"./vue.runtime.esm-CLeelJur.chunk.mjs";import"./index-DxwFe63_.chunk.mjs";import"./_baseUniq-pf37y4On.chunk.mjs";import"./_basePickBy-Dy1ViJhr.chunk.mjs";import"./clone-DchRqQR-.chunk.mjs";var f={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},hr=ir.gitGraph,P=h(()=>nr({...hr,...cr().gitGraph}),"getConfig"),s=new Y(()=>{const t=P(),r=t.mainBranchName,a=t.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:a}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function O(){return sr({length:7})}h(O,"getID");function D(t,r){const a=Object.create(null);return t.reduce((n,e)=>{const o=r(e);return a[o]||(a[o]=!0,n.push(e)),n},[])}h(D,"uniqBy");var mr=h(function(t){s.records.direction=t},"setDirection"),$r=h(function(t){u.debug("options str",t),t=t?.trim(),t=t||"{}";try{s.records.options=JSON.parse(t)}catch(r){u.error("error while parsing gitGraph options",r.message)}},"setOptions"),lr=h(function(){return s.records.options},"getOptions"),gr=h(function(t){let r=t.msg,a=t.id;const n=t.type;let e=t.tags;u.info("commit",r,a,n,e),u.debug("Entering commit:",r,a,n,e);const o=P();a=E.sanitizeText(a,o),r=E.sanitizeText(r,o),e=e?.map(c=>E.sanitizeText(c,o));const d={id:a||s.records.seq+"-"+O(),message:r,seq:s.records.seq++,type:n??f.NORMAL,tags:e??[],parents:s.records.head==null?[]:[s.records.head.id],branch:s.records.currBranch};s.records.head=d,u.info("main branch",o.mainBranchName),s.records.commits.has(d.id)&&u.warn(`Commit ID ${d.id} already exists`),s.records.commits.set(d.id,d),s.records.branches.set(s.records.currBranch,d.id),u.debug("in pushCommit "+d.id)},"commit"),yr=h(function(t){let r=t.name;const a=t.order;if(r=E.sanitizeText(r,P()),s.records.branches.has(r))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 ${r}")`);s.records.branches.set(r,s.records.head!=null?s.records.head.id:null),s.records.branchConfig.set(r,{name:r,order:a}),N(r),u.debug("in createBranch")},"branch"),pr=h(t=>{let r=t.branch,a=t.id;const n=t.type,e=t.tags,o=P();r=E.sanitizeText(r,o),a&&(a=E.sanitizeText(a,o));const d=s.records.branches.get(s.records.currBranch),c=s.records.branches.get(r),l=d?s.records.commits.get(d):void 0,m=c?s.records.commits.get(c):void 0;if(l&&m&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(s.records.currBranch===r){const i=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},i}if(l===void 0||!l){const i=new Error(`Incorrect usage of "merge". Current branch (${s.records.currBranch})has no commits`);throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},i}if(!s.records.branches.has(r)){const i=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},i}if(m===void 0||!m){const i=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},i}if(l===m){const i=new Error('Incorrect usage of "merge". Both branches have same head');throw i.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},i}if(a&&s.records.commits.has(a)){const i=new Error('Incorrect usage of "merge". Commit with id:'+a+" already exists, use different custom id");throw i.hash={text:`merge ${r} ${a} ${n} ${e?.join(" ")}`,token:`merge ${r} ${a} ${n} ${e?.join(" ")}`,expected:[`merge ${r} ${a}_UNIQUE ${n} ${e?.join(" ")}`]},i}const $=c||"",g={id:a||`${s.records.seq}-${O()}`,message:`merged branch ${r} into ${s.records.currBranch}`,seq:s.records.seq++,parents:s.records.head==null?[]:[s.records.head.id,$],branch:s.records.currBranch,type:f.MERGE,customType:n,customId:!!a,tags:e??[]};s.records.head=g,s.records.commits.set(g.id,g),s.records.branches.set(s.records.currBranch,g.id),u.debug(s.records.branches),u.debug("in mergeBranch")},"merge"),fr=h(function(t){let r=t.id,a=t.targetId,n=t.tags,e=t.parent;u.debug("Entering cherryPick:",r,a,n);const o=P();if(r=E.sanitizeText(r,o),a=E.sanitizeText(a,o),n=n?.map(l=>E.sanitizeText(l,o)),e=E.sanitizeText(e,o),!r||!s.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${a}`,token:`cherryPick ${r} ${a}`,expected:["cherry-pick abc"]},l}const d=s.records.commits.get(r);if(d===void 0||!d)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(e&&!(Array.isArray(d.parents)&&d.parents.includes(e)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const c=d.branch;if(d.type===f.MERGE&&!e)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!a||!s.records.commits.has(a)){if(c===s.records.currBranch){const g=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw g.hash={text:`cherryPick ${r} ${a}`,token:`cherryPick ${r} ${a}`,expected:["cherry-pick abc"]},g}const l=s.records.branches.get(s.records.currBranch);if(l===void 0||!l){const g=new Error(`Incorrect usage of "cherry-pick". Current branch (${s.records.currBranch})has no commits`);throw g.hash={text:`cherryPick ${r} ${a}`,token:`cherryPick ${r} ${a}`,expected:["cherry-pick abc"]},g}const m=s.records.commits.get(l);if(m===void 0||!m){const g=new Error(`Incorrect usage of "cherry-pick". Current branch (${s.records.currBranch})has no commits`);throw g.hash={text:`cherryPick ${r} ${a}`,token:`cherryPick ${r} ${a}`,expected:["cherry-pick abc"]},g}const $={id:s.records.seq+"-"+O(),message:`cherry-picked ${d?.message} into ${s.records.currBranch}`,seq:s.records.seq++,parents:s.records.head==null?[]:[s.records.head.id,d.id],branch:s.records.currBranch,type:f.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${d.id}${d.type===f.MERGE?`|parent:${e}`:""}`]};s.records.head=$,s.records.commits.set($.id,$),s.records.branches.set(s.records.currBranch,$.id),u.debug(s.records.branches),u.debug("in cherryPick")}},"cherryPick"),N=h(function(t){if(t=E.sanitizeText(t,P()),s.records.branches.has(t)){s.records.currBranch=t;const r=s.records.branches.get(s.records.currBranch);r===void 0||!r?s.records.head=null:s.records.head=s.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw r.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},r}},"checkout");function H(t,r,a){const n=t.indexOf(r);n===-1?t.push(a):t.splice(n,1,a)}h(H,"upsert");function z(t){const r=t.reduce((e,o)=>e.seq>o.seq?e:o,t[0]);let a="";t.forEach(function(e){e===r?a+=" *":a+=" |"});const n=[a,r.id,r.seq];for(const e in s.records.branches)s.records.branches.get(e)===r.id&&n.push(e);if(u.debug(n.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const e=s.records.commits.get(r.parents[0]);H(t,r,e),r.parents[1]&&t.push(s.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const e=s.records.commits.get(r.parents[0]);H(t,r,e)}}t=D(t,e=>e.id),z(t)}h(z,"prettyPrintCommitHistory");var xr=h(function(){u.debug(s.records.commits);const t=W()[0];z([t])},"prettyPrint"),ur=h(function(){s.reset(),ar()},"clear"),br=h(function(){return[...s.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"),wr=h(function(){return s.records.branches},"getBranches"),Br=h(function(){return s.records.commits},"getCommits"),W=h(function(){const t=[...s.records.commits.values()];return t.forEach(function(r){u.debug(r.id)}),t.sort((r,a)=>r.seq-a.seq),t},"getCommitsArray"),Er=h(function(){return s.records.currBranch},"getCurrentBranch"),kr=h(function(){return s.records.direction},"getDirection"),Cr=h(function(){return s.records.head},"getHead"),j={commitType:f,getConfig:P,setDirection:mr,setOptions:$r,getOptions:lr,commit:gr,branch:yr,merge:pr,cherryPick:fr,checkout:N,prettyPrint:xr,clear:ur,getBranchesAsObjArray:br,getBranches:wr,getCommits:Br,getCommitsArray:W,getCurrentBranch:Er,getDirection:kr,getHead:Cr,setAccTitle:Z,getAccTitle:X,getAccDescription:Q,setAccDescription:J,setDiagramTitle:V,getDiagramTitle:U},Lr=h((t,r)=>{K(t,r),t.dir&&r.setDirection(t.dir);for(const a of t.statements)Tr(a,r)},"populate"),Tr=h((t,r)=>{const a={Commit:h(n=>r.commit(Mr(n)),"Commit"),Branch:h(n=>r.branch(vr(n)),"Branch"),Merge:h(n=>r.merge(Pr(n)),"Merge"),Checkout:h(n=>r.checkout(Rr(n)),"Checkout"),CherryPicking:h(n=>r.cherryPick(Ir(n)),"CherryPicking")}[t.$type];a?a(t):u.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),Mr=h(t=>({id:t.id,msg:t.message??"",type:t.type!==void 0?f[t.type]:f.NORMAL,tags:t.tags??void 0}),"parseCommit"),vr=h(t=>({name:t.name,order:t.order??0}),"parseBranch"),Pr=h(t=>({branch:t.branch,id:t.id??"",type:t.type!==void 0?f[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),Rr=h(t=>t.branch,"parseCheckout"),Ir=h(t=>({id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),Ar={parse:h(async t=>{const r=await dr("gitGraph",t);u.debug(r),Lr(r,j)},"parse")},Gr=rr(),B=Gr?.gitGraph,T=10,M=40,k=4,C=2,v=8,b=new Map,w=new Map,A=30,R=new Map,G=[],L=0,y="LR",Or=h(()=>{b.clear(),w.clear(),R.clear(),L=0,G=[],y="LR"},"clear"),F=h(t=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof t=="string"?t.split(/\\n|\n|<br\s*\/?>/gi):t).forEach(a=>{const n=document.createElementNS("http://www.w3.org/2000/svg","tspan");n.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),n.setAttribute("dy","1em"),n.setAttribute("x","0"),n.setAttribute("class","row"),n.textContent=a.trim(),r.appendChild(n)}),r},"drawText"),_=h(t=>{let r,a,n;return y==="BT"?(a=h((e,o)=>e<=o,"comparisonFunc"),n=1/0):(a=h((e,o)=>e>=o,"comparisonFunc"),n=0),t.forEach(e=>{const o=y==="TB"||y=="BT"?w.get(e)?.y:w.get(e)?.x;o!==void 0&&a(o,n)&&(r=e,n=o)}),r},"findClosestParent"),qr=h(t=>{let r="",a=1/0;return t.forEach(n=>{const e=w.get(n).y;e<=a&&(r=n,a=e)}),r||void 0},"findClosestParentBT"),Hr=h((t,r,a)=>{let n=a,e=a;const o=[];t.forEach(d=>{const c=r.get(d);if(!c)throw new Error(`Commit not found for key ${d}`);c.parents.length?(n=Sr(c),e=Math.max(n,e)):o.push(c),Dr(c,n)}),n=e,o.forEach(d=>{Nr(d,n,a)}),t.forEach(d=>{const c=r.get(d);if(c?.parents.length){const l=qr(c.parents);n=w.get(l).y-M,n<=e&&(e=n);const m=b.get(c.branch).pos,$=n-T;w.set(c.id,{x:m,y:$})}})},"setParallelBTPos"),zr=h(t=>{const r=_(t.parents.filter(n=>n!==null));if(!r)throw new Error(`Closest parent not found for commit ${t.id}`);const a=w.get(r)?.y;if(a===void 0)throw new Error(`Closest parent position not found for commit ${t.id}`);return a},"findClosestParentPos"),Sr=h(t=>zr(t)+M,"calculateCommitPosition"),Dr=h((t,r)=>{const a=b.get(t.branch);if(!a)throw new Error(`Branch not found for commit ${t.id}`);const n=a.pos,e=r+T;return w.set(t.id,{x:n,y:e}),{x:n,y:e}},"setCommitPosition"),Nr=h((t,r,a)=>{const n=b.get(t.branch);if(!n)throw new Error(`Branch not found for commit ${t.id}`);const e=r+a,o=n.pos;w.set(t.id,{x:o,y:e})},"setRootPosition"),Wr=h((t,r,a,n,e,o)=>{if(o===f.HIGHLIGHT)t.append("rect").attr("x",a.x-10).attr("y",a.y-10).attr("width",20).attr("height",20).attr("class",`commit ${r.id} commit-highlight${e%v} ${n}-outer`),t.append("rect").attr("x",a.x-6).attr("y",a.y-6).attr("width",12).attr("height",12).attr("class",`commit ${r.id} commit${e%v} ${n}-inner`);else if(o===f.CHERRY_PICK)t.append("circle").attr("cx",a.x).attr("cy",a.y).attr("r",10).attr("class",`commit ${r.id} ${n}`),t.append("circle").attr("cx",a.x-3).attr("cy",a.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${r.id} ${n}`),t.append("circle").attr("cx",a.x+3).attr("cy",a.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${r.id} ${n}`),t.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 ${r.id} ${n}`),t.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 ${r.id} ${n}`);else{const d=t.append("circle");if(d.attr("cx",a.x),d.attr("cy",a.y),d.attr("r",r.type===f.MERGE?9:10),d.attr("class",`commit ${r.id} commit${e%v}`),o===f.MERGE){const c=t.append("circle");c.attr("cx",a.x),c.attr("cy",a.y),c.attr("r",6),c.attr("class",`commit ${n} ${r.id} commit${e%v}`)}o===f.REVERSE&&t.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 ${n} ${r.id} commit${e%v}`)}},"drawCommitBullet"),jr=h((t,r,a,n)=>{if(r.type!==f.CHERRY_PICK&&(r.customId&&r.type===f.MERGE||r.type!==f.MERGE)&&B?.showCommitLabel){const e=t.append("g"),o=e.insert("rect").attr("class","commit-label-bkg"),d=e.append("text").attr("x",n).attr("y",a.y+25).attr("class","commit-label").text(r.id),c=d.node()?.getBBox();if(c&&(o.attr("x",a.posWithOffset-c.width/2-C).attr("y",a.y+13.5).attr("width",c.width+2*C).attr("height",c.height+2*C),y==="TB"||y==="BT"?(o.attr("x",a.x-(c.width+4*k+5)).attr("y",a.y-12),d.attr("x",a.x-(c.width+4*k)).attr("y",a.y+c.height-12)):d.attr("x",a.posWithOffset-c.width/2),B.rotateCommitLabel))if(y==="TB"||y==="BT")d.attr("transform","rotate(-45, "+a.x+", "+a.y+")"),o.attr("transform","rotate(-45, "+a.x+", "+a.y+")");else{const l=-7.5-(c.width+10)/25*9.5,m=10+c.width/25*8.5;e.attr("transform","translate("+l+", "+m+") rotate(-45, "+n+", "+a.y+")")}}},"drawCommitLabel"),Fr=h((t,r,a,n)=>{if(r.tags.length>0){let e=0,o=0,d=0;const c=[];for(const l of r.tags.reverse()){const m=t.insert("polygon"),$=t.append("circle"),g=t.append("text").attr("y",a.y-16-e).attr("class","tag-label").text(l),i=g.node()?.getBBox();if(!i)throw new Error("Tag bbox not found");o=Math.max(o,i.width),d=Math.max(d,i.height),g.attr("x",a.posWithOffset-i.width/2),c.push({tag:g,hole:$,rect:m,yOffset:e}),e+=20}for(const{tag:l,hole:m,rect:$,yOffset:g}of c){const i=d/2,x=a.y-19.2-g;if($.attr("class","tag-label-bkg").attr("points",`
${n-o/2-k/2},${x+C}
${n-o/2-k/2},${x-C}
${a.posWithOffset-o/2-k},${x-i-C}
${a.posWithOffset+o/2+k},${x-i-C}
${a.posWithOffset+o/2+k},${x+i+C}
${a.posWithOffset-o/2-k},${x+i+C}`),m.attr("cy",x).attr("cx",n-o/2+k/2).attr("r",1.5).attr("class","tag-hole"),y==="TB"||y==="BT"){const p=n+g;$.attr("class","tag-label-bkg").attr("points",`
${a.x},${p+2}
${a.x},${p-2}
${a.x+T},${p-i-2}
${a.x+T+o+4},${p-i-2}
${a.x+T+o+4},${p+i+2}
${a.x+T},${p+i+2}`).attr("transform","translate(12,12) rotate(45, "+a.x+","+n+")"),m.attr("cx",a.x+k/2).attr("cy",p).attr("transform","translate(12,12) rotate(45, "+a.x+","+n+")"),l.attr("x",a.x+5).attr("y",p+3).attr("transform","translate(14,14) rotate(45, "+a.x+","+n+")")}}}},"drawCommitTags"),_r=h(t=>{switch(t.customType??t.type){case f.NORMAL:return"commit-normal";case f.REVERSE:return"commit-reverse";case f.HIGHLIGHT:return"commit-highlight";case f.MERGE:return"commit-merge";case f.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),Kr=h((t,r,a,n)=>{const e={x:0,y:0};if(t.parents.length>0){const o=_(t.parents);if(o){const d=n.get(o)??e;return r==="TB"?d.y+M:r==="BT"?(n.get(t.id)??e).y-M:d.x+M}}else return r==="TB"?A:r==="BT"?(n.get(t.id)??e).y-M:0;return 0},"calculatePosition"),Yr=h((t,r,a)=>{const n=y==="BT"&&a?r:r+T,e=y==="TB"||y==="BT"?n:b.get(t.branch)?.pos,o=y==="TB"||y==="BT"?b.get(t.branch)?.pos:n;if(o===void 0||e===void 0)throw new Error(`Position were undefined for commit ${t.id}`);return{x:o,y:e,posWithOffset:n}},"getCommitPosition"),S=h((t,r,a)=>{if(!B)throw new Error("GitGraph config not found");const n=t.append("g").attr("class","commit-bullets"),e=t.append("g").attr("class","commit-labels");let o=y==="TB"||y==="BT"?A:0;const d=[...r.keys()],c=B?.parallelCommits??!1,l=h(($,g)=>{const i=r.get($)?.seq,x=r.get(g)?.seq;return i!==void 0&&x!==void 0?i-x:0},"sortKeys");let m=d.sort(l);y==="BT"&&(c&&Hr(m,r,o),m=m.reverse()),m.forEach($=>{const g=r.get($);if(!g)throw new Error(`Commit not found for key ${$}`);c&&(o=Kr(g,y,o,w));const i=Yr(g,o,c);if(a){const x=_r(g),p=g.customType??g.type,q=b.get(g.branch)?.index??0;Wr(n,g,i,x,q,p),jr(e,g,i,o),Fr(e,g,i,o)}y==="TB"||y==="BT"?w.set(g.id,{x:i.x,y:i.posWithOffset}):w.set(g.id,{x:i.posWithOffset,y:i.y}),o=y==="BT"&&c?o+M:o+M+T,o>L&&(L=o)})},"drawCommits"),Ur=h((t,r,a,n,e)=>{const o=(y==="TB"||y==="BT"?a.x<n.x:a.y<n.y)?r.branch:t.branch,d=h(l=>l.branch===o,"isOnBranchToGetCurve"),c=h(l=>l.seq>t.seq&&l.seq<r.seq,"isBetweenCommits");return[...e.values()].some(l=>c(l)&&d(l))},"shouldRerouteArrow"),I=h((t,r,a=0)=>{const n=t+Math.abs(t-r)/2;if(a>5)return n;if(G.every(o=>Math.abs(o-n)>=10))return G.push(n),n;const e=Math.abs(t-r);return I(t,r-e/5,a+1)},"findLane"),Vr=h((t,r,a,n)=>{const e=w.get(r.id),o=w.get(a.id);if(e===void 0||o===void 0)throw new Error(`Commit positions not found for commits ${r.id} and ${a.id}`);const d=Ur(r,a,e,o,n);let c="",l="",m=0,$=0,g=b.get(a.branch)?.index;a.type===f.MERGE&&r.id!==a.parents[0]&&(g=b.get(r.branch)?.index);let i;if(d){c="A 10 10, 0, 0, 0,",l="A 10 10, 0, 0, 1,",m=10,$=10;const x=e.y<o.y?I(e.y,o.y):I(o.y,e.y),p=e.x<o.x?I(e.x,o.x):I(o.x,e.x);y==="TB"?e.x<o.x?i=`M ${e.x} ${e.y} L ${p-m} ${e.y} ${l} ${p} ${e.y+$} L ${p} ${o.y-m} ${c} ${p+$} ${o.y} L ${o.x} ${o.y}`:(g=b.get(r.branch)?.index,i=`M ${e.x} ${e.y} L ${p+m} ${e.y} ${c} ${p} ${e.y+$} L ${p} ${o.y-m} ${l} ${p-$} ${o.y} L ${o.x} ${o.y}`):y==="BT"?e.x<o.x?i=`M ${e.x} ${e.y} L ${p-m} ${e.y} ${c} ${p} ${e.y-$} L ${p} ${o.y+m} ${l} ${p+$} ${o.y} L ${o.x} ${o.y}`:(g=b.get(r.branch)?.index,i=`M ${e.x} ${e.y} L ${p+m} ${e.y} ${l} ${p} ${e.y-$} L ${p} ${o.y+m} ${c} ${p-$} ${o.y} L ${o.x} ${o.y}`):e.y<o.y?i=`M ${e.x} ${e.y} L ${e.x} ${x-m} ${c} ${e.x+$} ${x} L ${o.x-m} ${x} ${l} ${o.x} ${x+$} L ${o.x} ${o.y}`:(g=b.get(r.branch)?.index,i=`M ${e.x} ${e.y} L ${e.x} ${x+m} ${l} ${e.x+$} ${x} L ${o.x-m} ${x} ${c} ${o.x} ${x-$} L ${o.x} ${o.y}`)}else c="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",m=20,$=20,y==="TB"?(e.x<o.x&&(a.type===f.MERGE&&r.id!==a.parents[0]?i=`M ${e.x} ${e.y} L ${e.x} ${o.y-m} ${c} ${e.x+$} ${o.y} L ${o.x} ${o.y}`:i=`M ${e.x} ${e.y} L ${o.x-m} ${e.y} ${l} ${o.x} ${e.y+$} L ${o.x} ${o.y}`),e.x>o.x&&(c="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",m=20,$=20,a.type===f.MERGE&&r.id!==a.parents[0]?i=`M ${e.x} ${e.y} L ${e.x} ${o.y-m} ${l} ${e.x-$} ${o.y} L ${o.x} ${o.y}`:i=`M ${e.x} ${e.y} L ${o.x+m} ${e.y} ${c} ${o.x} ${e.y+$} L ${o.x} ${o.y}`),e.x===o.x&&(i=`M ${e.x} ${e.y} L ${o.x} ${o.y}`)):y==="BT"?(e.x<o.x&&(a.type===f.MERGE&&r.id!==a.parents[0]?i=`M ${e.x} ${e.y} L ${e.x} ${o.y+m} ${l} ${e.x+$} ${o.y} L ${o.x} ${o.y}`:i=`M ${e.x} ${e.y} L ${o.x-m} ${e.y} ${c} ${o.x} ${e.y-$} L ${o.x} ${o.y}`),e.x>o.x&&(c="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",m=20,$=20,a.type===f.MERGE&&r.id!==a.parents[0]?i=`M ${e.x} ${e.y} L ${e.x} ${o.y+m} ${c} ${e.x-$} ${o.y} L ${o.x} ${o.y}`:i=`M ${e.x} ${e.y} L ${o.x-m} ${e.y} ${c} ${o.x} ${e.y-$} L ${o.x} ${o.y}`),e.x===o.x&&(i=`M ${e.x} ${e.y} L ${o.x} ${o.y}`)):(e.y<o.y&&(a.type===f.MERGE&&r.id!==a.parents[0]?i=`M ${e.x} ${e.y} L ${o.x-m} ${e.y} ${l} ${o.x} ${e.y+$} L ${o.x} ${o.y}`:i=`M ${e.x} ${e.y} L ${e.x} ${o.y-m} ${c} ${e.x+$} ${o.y} L ${o.x} ${o.y}`),e.y>o.y&&(a.type===f.MERGE&&r.id!==a.parents[0]?i=`M ${e.x} ${e.y} L ${o.x-m} ${e.y} ${c} ${o.x} ${e.y-$} L ${o.x} ${o.y}`:i=`M ${e.x} ${e.y} L ${e.x} ${o.y+m} ${l} ${e.x+$} ${o.y} L ${o.x} ${o.y}`),e.y===o.y&&(i=`M ${e.x} ${e.y} L ${o.x} ${o.y}`));if(i===void 0)throw new Error("Line definition not found");t.append("path").attr("d",i).attr("class","arrow arrow"+g%v)},"drawArrow"),Jr=h((t,r)=>{const a=t.append("g").attr("class","commit-arrows");[...r.keys()].forEach(n=>{const e=r.get(n);e.parents&&e.parents.length>0&&e.parents.forEach(o=>{Vr(a,r.get(o),e,r)})})},"drawArrows"),Qr=h((t,r)=>{const a=t.append("g");r.forEach((n,e)=>{const o=e%v,d=b.get(n.name)?.pos;if(d===void 0)throw new Error(`Position not found for branch ${n.name}`);const c=a.append("line");c.attr("x1",0),c.attr("y1",d),c.attr("x2",L),c.attr("y2",d),c.attr("class","branch branch"+o),y==="TB"?(c.attr("y1",A),c.attr("x1",d),c.attr("y2",L),c.attr("x2",d)):y==="BT"&&(c.attr("y1",L),c.attr("x1",d),c.attr("y2",A),c.attr("x2",d)),G.push(d);const l=n.name,m=F(l),$=a.insert("rect"),g=a.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+o);g.node().appendChild(m);const i=m.getBBox();$.attr("class","branchLabelBkg label"+o).attr("rx",4).attr("ry",4).attr("x",-i.width-4-(B?.rotateCommitLabel===!0?30:0)).attr("y",-i.height/2+8).attr("width",i.width+18).attr("height",i.height+4),g.attr("transform","translate("+(-i.width-14-(B?.rotateCommitLabel===!0?30:0))+", "+(d-i.height/2-1)+")"),y==="TB"?($.attr("x",d-i.width/2-10).attr("y",0),g.attr("transform","translate("+(d-i.width/2-5)+", 0)")):y==="BT"?($.attr("x",d-i.width/2-10).attr("y",L),g.attr("transform","translate("+(d-i.width/2-5)+", "+L+")")):$.attr("transform","translate(-19, "+(d-i.height/2)+")")})},"drawBranches"),Xr=h(function(t,r,a,n,e){return b.set(t,{pos:r,index:a}),r+=50+(e?40:0)+(y==="TB"||y==="BT"?n.width/2:0),r},"setBranchPosition"),Zr=h(function(t,r,a,n){if(Or(),u.debug("in gitgraph renderer",t+`
`,"id:",r,a),!B)throw new Error("GitGraph config not found");const e=B.rotateCommitLabel??!1,o=n.db;R=o.getCommits();const d=o.getBranchesAsObjArray();y=o.getDirection();const c=tr(`[id="${r}"]`);let l=0;d.forEach((m,$)=>{const g=F(m.name),i=c.append("g"),x=i.insert("g").attr("class","branchLabel"),p=x.insert("g").attr("class","label branch-label");p.node()?.appendChild(g);const q=g.getBBox();l=Xr(m.name,l,$,q,e),p.remove(),x.remove(),i.remove()}),S(c,R,!1),B.showBranches&&Qr(c,d),Jr(c,R),S(c,R,!0),er.insertTitle(c,"gitTitleText",B.titleTopMargin??0,o.getDiagramTitle()),or(void 0,c,B.diagramPadding,B.useMaxWidth)},"draw"),rt={draw:Zr},tt=h(t=>`
.commit-id,
.commit-msg,
.branch-label {
fill: lightgrey;
color: lightgrey;
font-family: 'trebuchet ms', verdana, arial, sans-serif;
font-family: var(--mermaid-font-family);
}
${[0,1,2,3,4,5,6,7].map(r=>`
.branch-label${r} { fill: ${t["gitBranchLabel"+r]}; }
.commit${r} { stroke: ${t["git"+r]}; fill: ${t["git"+r]}; }
.commit-highlight${r} { stroke: ${t["gitInv"+r]}; fill: ${t["gitInv"+r]}; }
.label${r} { fill: ${t["git"+r]}; }
.arrow${r} { stroke: ${t["git"+r]}; }
`).join(`
`)}
.branch {
stroke-width: 1;
stroke: ${t.lineColor};
stroke-dasharray: 2;
}
.commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
.commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
.tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
.tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
.tag-hole { fill: ${t.textColor}; }
.commit-merge {
stroke: ${t.primaryColor};
fill: ${t.primaryColor};
}
.commit-reverse {
stroke: ${t.primaryColor};
fill: ${t.primaryColor};
stroke-width: 3;
}
.commit-highlight-outer {
}
.commit-highlight-inner {
stroke: ${t.primaryColor};
fill: ${t.primaryColor};
}
.arrow { stroke-width: 8; stroke-linecap: round; fill: none}
.gitTitleText {
text-anchor: middle;
font-size: 18px;
fill: ${t.textColor};
}
`,"getStyles"),et=tt,yt={parser:Ar,db:j,renderer:rt,styles:et};export{yt as diagram};
//# sourceMappingURL=gitGraphDiagram-NY62KEGX-CoAlzKsu.chunk.mjs.map