mirror of
https://github.com/vacp2p/vac.dev.git
synced 2026-08-31 04:01:11 +00:00
1 line
30 KiB
JavaScript
1 line
30 KiB
JavaScript
"use strict";(self.webpackChunkresearch_logos_co=self.webpackChunkresearch_logos_co||[]).push([[4879],{48252:(t,r,e)=>{function o(t,r){t.accDescr&&r.setAccDescription?.(t.accDescr),t.accTitle&&r.setAccTitle?.(t.accTitle),t.title&&r.setDiagramTitle?.(t.title)}e.d(r,{S:()=>o}),(0,e(40797).K2)(o,"populateCommonDb")},64879:(t,r,e)=>{e.d(r,{diagram:()=>Rt});var o=e(48252),n=e(72938),a=e(4137),i=e(17726),s=e(40797),c=e(78731),d=e(70451),h={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},$=i.UI.gitGraph,m=(0,s.K2)((()=>(0,a.$t)({...$,...(0,i.zj)().gitGraph})),"getConfig"),l=new n.m((()=>{const t=m(),r=t.mainBranchName,e=t.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:e}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}}));function g(){return(0,a.yT)({length:7})}function p(t,r){const e=Object.create(null);return t.reduce(((t,o)=>{const n=r(o);return e[n]||(e[n]=!0,t.push(o)),t}),[])}(0,s.K2)(g,"getID"),(0,s.K2)(p,"uniqBy");var y=(0,s.K2)((function(t){l.records.direction=t}),"setDirection"),f=(0,s.K2)((function(t){s.Rm.debug("options str",t),t=t?.trim(),t=t||"{}";try{l.records.options=JSON.parse(t)}catch(r){s.Rm.error("error while parsing gitGraph options",r.message)}}),"setOptions"),x=(0,s.K2)((function(){return l.records.options}),"getOptions"),u=(0,s.K2)((function(t){let r=t.msg,e=t.id;const o=t.type;let n=t.tags;s.Rm.info("commit",r,e,o,n),s.Rm.debug("Entering commit:",r,e,o,n);const a=m();e=i.Y2.sanitizeText(e,a),r=i.Y2.sanitizeText(r,a),n=n?.map((t=>i.Y2.sanitizeText(t,a)));const c={id:e||l.records.seq+"-"+g(),message:r,seq:l.records.seq++,type:o??h.NORMAL,tags:n??[],parents:null==l.records.head?[]:[l.records.head.id],branch:l.records.currBranch};l.records.head=c,s.Rm.info("main branch",a.mainBranchName),l.records.commits.has(c.id)&&s.Rm.warn(`Commit ID ${c.id} already exists`),l.records.commits.set(c.id,c),l.records.branches.set(l.records.currBranch,c.id),s.Rm.debug("in pushCommit "+c.id)}),"commit"),b=(0,s.K2)((function(t){let r=t.name;const e=t.order;if(r=i.Y2.sanitizeText(r,m()),l.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}")`);l.records.branches.set(r,null!=l.records.head?l.records.head.id:null),l.records.branchConfig.set(r,{name:r,order:e}),B(r),s.Rm.debug("in createBranch")}),"branch"),w=(0,s.K2)((t=>{let r=t.branch,e=t.id;const o=t.type,n=t.tags,a=m();r=i.Y2.sanitizeText(r,a),e&&(e=i.Y2.sanitizeText(e,a));const c=l.records.branches.get(l.records.currBranch),d=l.records.branches.get(r),$=c?l.records.commits.get(c):void 0,p=d?l.records.commits.get(d):void 0;if($&&p&&$.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(l.records.currBranch===r){const t=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},t}if(void 0===$||!$){const t=new Error(`Incorrect usage of "merge". Current branch (${l.records.currBranch})has no commits`);throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},t}if(!l.records.branches.has(r)){const t=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},t}if(void 0===p||!p){const t=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},t}if($===p){const t=new Error('Incorrect usage of "merge". Both branches have same head');throw t.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},t}if(e&&l.records.commits.has(e)){const t=new Error('Incorrect usage of "merge". Commit with id:'+e+" already exists, use different custom id");throw t.hash={text:`merge ${r} ${e} ${o} ${n?.join(" ")}`,token:`merge ${r} ${e} ${o} ${n?.join(" ")}`,expected:[`merge ${r} ${e}_UNIQUE ${o} ${n?.join(" ")}`]},t}const y=d||"",f={id:e||`${l.records.seq}-${g()}`,message:`merged branch ${r} into ${l.records.currBranch}`,seq:l.records.seq++,parents:null==l.records.head?[]:[l.records.head.id,y],branch:l.records.currBranch,type:h.MERGE,customType:o,customId:!!e,tags:n??[]};l.records.head=f,l.records.commits.set(f.id,f),l.records.branches.set(l.records.currBranch,f.id),s.Rm.debug(l.records.branches),s.Rm.debug("in mergeBranch")}),"merge"),k=(0,s.K2)((function(t){let r=t.id,e=t.targetId,o=t.tags,n=t.parent;s.Rm.debug("Entering cherryPick:",r,e,o);const a=m();if(r=i.Y2.sanitizeText(r,a),e=i.Y2.sanitizeText(e,a),o=o?.map((t=>i.Y2.sanitizeText(t,a))),n=i.Y2.sanitizeText(n,a),!r||!l.records.commits.has(r)){const t=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw t.hash={text:`cherryPick ${r} ${e}`,token:`cherryPick ${r} ${e}`,expected:["cherry-pick abc"]},t}const c=l.records.commits.get(r);if(void 0===c||!c)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(n&&(!Array.isArray(c.parents)||!c.parents.includes(n))){throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.")}const d=c.branch;if(c.type===h.MERGE&&!n){throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.")}if(!e||!l.records.commits.has(e)){if(d===l.records.currBranch){const t=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw t.hash={text:`cherryPick ${r} ${e}`,token:`cherryPick ${r} ${e}`,expected:["cherry-pick abc"]},t}const t=l.records.branches.get(l.records.currBranch);if(void 0===t||!t){const t=new Error(`Incorrect usage of "cherry-pick". Current branch (${l.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${r} ${e}`,token:`cherryPick ${r} ${e}`,expected:["cherry-pick abc"]},t}const a=l.records.commits.get(t);if(void 0===a||!a){const t=new Error(`Incorrect usage of "cherry-pick". Current branch (${l.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${r} ${e}`,token:`cherryPick ${r} ${e}`,expected:["cherry-pick abc"]},t}const i={id:l.records.seq+"-"+g(),message:`cherry-picked ${c?.message} into ${l.records.currBranch}`,seq:l.records.seq++,parents:null==l.records.head?[]:[l.records.head.id,c.id],branch:l.records.currBranch,type:h.CHERRY_PICK,tags:o?o.filter(Boolean):[`cherry-pick:${c.id}${c.type===h.MERGE?`|parent:${n}`:""}`]};l.records.head=i,l.records.commits.set(i.id,i),l.records.branches.set(l.records.currBranch,i.id),s.Rm.debug(l.records.branches),s.Rm.debug("in cherryPick")}}),"cherryPick"),B=(0,s.K2)((function(t){if(t=i.Y2.sanitizeText(t,m()),!l.records.branches.has(t)){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}{l.records.currBranch=t;const r=l.records.branches.get(l.records.currBranch);l.records.head=void 0!==r&&r?l.records.commits.get(r)??null:null}}),"checkout");function E(t,r,e){const o=t.indexOf(r);-1===o?t.push(e):t.splice(o,1,e)}function C(t){const r=t.reduce(((t,r)=>t.seq>r.seq?t:r),t[0]);let e="";t.forEach((function(t){e+=t===r?"\t*":"\t|"}));const o=[e,r.id,r.seq];for(const n in l.records.branches)l.records.branches.get(n)===r.id&&o.push(n);if(s.Rm.debug(o.join(" ")),r.parents&&2==r.parents.length&&r.parents[0]&&r.parents[1]){const e=l.records.commits.get(r.parents[0]);E(t,r,e),r.parents[1]&&t.push(l.records.commits.get(r.parents[1]))}else{if(0==r.parents.length)return;if(r.parents[0]){const e=l.records.commits.get(r.parents[0]);E(t,r,e)}}C(t=p(t,(t=>t.id)))}(0,s.K2)(E,"upsert"),(0,s.K2)(C,"prettyPrintCommitHistory");var T=(0,s.K2)((function(){s.Rm.debug(l.records.commits);C([v()[0]])}),"prettyPrint"),L=(0,s.K2)((function(){l.reset(),(0,i.IU)()}),"clear"),K=(0,s.K2)((function(){return[...l.records.branchConfig.values()].map(((t,r)=>null!==t.order&&void 0!==t.order?t:{...t,order:parseFloat(`0.${r}`)})).sort(((t,r)=>(t.order??0)-(r.order??0))).map((({name:t})=>({name:t})))}),"getBranchesAsObjArray"),M=(0,s.K2)((function(){return l.records.branches}),"getBranches"),R=(0,s.K2)((function(){return l.records.commits}),"getCommits"),v=(0,s.K2)((function(){const t=[...l.records.commits.values()];return t.forEach((function(t){s.Rm.debug(t.id)})),t.sort(((t,r)=>t.seq-r.seq)),t}),"getCommitsArray"),I={commitType:h,getConfig:m,setDirection:y,setOptions:f,getOptions:x,commit:u,branch:b,merge:w,cherryPick:k,checkout:B,prettyPrint:T,clear:L,getBranchesAsObjArray:K,getBranches:M,getCommits:R,getCommitsArray:v,getCurrentBranch:(0,s.K2)((function(){return l.records.currBranch}),"getCurrentBranch"),getDirection:(0,s.K2)((function(){return l.records.direction}),"getDirection"),getHead:(0,s.K2)((function(){return l.records.head}),"getHead"),setAccTitle:i.SV,getAccTitle:i.iN,getAccDescription:i.m7,setAccDescription:i.EI,setDiagramTitle:i.ke,getDiagramTitle:i.ab},P=(0,s.K2)(((t,r)=>{(0,o.S)(t,r),t.dir&&r.setDirection(t.dir);for(const e of t.statements)O(e,r)}),"populate"),O=(0,s.K2)(((t,r)=>{const e={Commit:(0,s.K2)((t=>r.commit(A(t))),"Commit"),Branch:(0,s.K2)((t=>r.branch(G(t))),"Branch"),Merge:(0,s.K2)((t=>r.merge(S(t))),"Merge"),Checkout:(0,s.K2)((t=>r.checkout(D(t))),"Checkout"),CherryPicking:(0,s.K2)((t=>r.cherryPick(H(t))),"CherryPicking")}[t.$type];e?e(t):s.Rm.error(`Unknown statement type: ${t.$type}`)}),"parseStatement"),A=(0,s.K2)((t=>({id:t.id,msg:t.message??"",type:void 0!==t.type?h[t.type]:h.NORMAL,tags:t.tags??void 0})),"parseCommit"),G=(0,s.K2)((t=>({name:t.name,order:t.order??0})),"parseBranch"),S=(0,s.K2)((t=>({branch:t.branch,id:t.id??"",type:void 0!==t.type?h[t.type]:void 0,tags:t.tags??void 0})),"parseMerge"),D=(0,s.K2)((t=>t.branch),"parseCheckout"),H=(0,s.K2)((t=>({id:t.id,targetId:"",tags:0===t.tags?.length?void 0:t.tags,parent:t.parent})),"parseCherryPicking"),W={parse:(0,s.K2)((async t=>{const r=await(0,c.qg)("gitGraph",t);s.Rm.debug(r),P(r,I)}),"parse")};var q=10,_=40,z=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),Y=new Set(["redux-color","redux-dark-color"]),j=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),N=(0,s.K2)(((t,r,e=!1)=>e&&t>0?(t-1)%(r-1)+1:t%r),"calcColorIndex"),F=new Map,V=new Map,U=new Map,J=[],Q=0,X="LR",Z=(0,s.K2)((()=>{F.clear(),V.clear(),U.clear(),Q=0,J=[],X="LR"}),"clear"),tt=(0,s.K2)((t=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return("string"==typeof t?t.split(/\\n|\n|<br\s*\/?>/gi):t).forEach((t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","tspan");e.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),e.setAttribute("dy","1em"),e.setAttribute("x","0"),e.setAttribute("class","row"),e.textContent=t.trim(),r.appendChild(e)})),r}),"drawText"),rt=(0,s.K2)((t=>{let r,e,o;return"BT"===X?(e=(0,s.K2)(((t,r)=>t<=r),"comparisonFunc"),o=1/0):(e=(0,s.K2)(((t,r)=>t>=r),"comparisonFunc"),o=0),t.forEach((t=>{const n="TB"===X||"BT"==X?V.get(t)?.y:V.get(t)?.x;void 0!==n&&e(n,o)&&(r=t,o=n)})),r}),"findClosestParent"),et=(0,s.K2)((t=>{let r="",e=1/0;return t.forEach((t=>{const o=V.get(t).y;o<=e&&(r=t,e=o)})),r||void 0}),"findClosestParentBT"),ot=(0,s.K2)(((t,r,e)=>{let o=e,n=e;const a=[];t.forEach((t=>{const e=r.get(t);if(!e)throw new Error(`Commit not found for key ${t}`);e.parents.length?(o=at(e),n=Math.max(o,n)):a.push(e),it(e,o)})),o=n,a.forEach((t=>{st(t,o,e)})),t.forEach((t=>{const e=r.get(t);if(e?.parents.length){const t=et(e.parents);o=V.get(t).y-_,o<=n&&(n=o);const r=F.get(e.branch).pos,a=o-q;V.set(e.id,{x:r,y:a})}}))}),"setParallelBTPos"),nt=(0,s.K2)((t=>{const r=rt(t.parents.filter((t=>null!==t)));if(!r)throw new Error(`Closest parent not found for commit ${t.id}`);const e=V.get(r)?.y;if(void 0===e)throw new Error(`Closest parent position not found for commit ${t.id}`);return e}),"findClosestParentPos"),at=(0,s.K2)((t=>nt(t)+_),"calculateCommitPosition"),it=(0,s.K2)(((t,r)=>{const e=F.get(t.branch);if(!e)throw new Error(`Branch not found for commit ${t.id}`);const o=e.pos,n=r+q;return V.set(t.id,{x:o,y:n}),{x:o,y:n}}),"setCommitPosition"),st=(0,s.K2)(((t,r,e)=>{const o=F.get(t.branch);if(!o)throw new Error(`Branch not found for commit ${t.id}`);const n=r+e,a=o.pos;V.set(t.id,{x:a,y:n})}),"setRootPosition"),ct=(0,s.K2)(((t,r,e,o,n,a)=>{const{theme:s}=(0,i.D7)(),c=z.has(s??""),d=Y.has(s??""),$=j.has(s??"");if(a===h.HIGHLIGHT)t.append("rect").attr("x",e.x-10+(c?3:0)).attr("y",e.y-10+(c?3:0)).attr("width",c?14:20).attr("height",c?14:20).attr("class",`commit ${r.id} commit-highlight${N(n,8,d)} ${o}-outer`),t.append("rect").attr("x",e.x-6+(c?2:0)).attr("y",e.y-6+(c?2:0)).attr("width",c?8:12).attr("height",c?8:12).attr("class",`commit ${r.id} commit${N(n,8,d)} ${o}-inner`);else if(a===h.CHERRY_PICK)t.append("circle").attr("cx",e.x).attr("cy",e.y).attr("r",c?7:10).attr("class",`commit ${r.id} ${o}`),t.append("circle").attr("cx",e.x-3).attr("cy",e.y+2).attr("r",c?2.5:2.75).attr("fill",$?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),t.append("circle").attr("cx",e.x+3).attr("cy",e.y+2).attr("r",c?2.5:2.75).attr("fill",$?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),t.append("line").attr("x1",e.x+3).attr("y1",e.y+1).attr("x2",e.x).attr("y2",e.y-5).attr("stroke",$?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`),t.append("line").attr("x1",e.x-3).attr("y1",e.y+1).attr("x2",e.x).attr("y2",e.y-5).attr("stroke",$?"#000000":"#fff").attr("class",`commit ${r.id} ${o}`);else{const i=t.append("circle");if(i.attr("cx",e.x),i.attr("cy",e.y),i.attr("r",c?7:10),i.attr("class",`commit ${r.id} commit${N(n,8,d)}`),a===h.MERGE){const a=t.append("circle");a.attr("cx",e.x),a.attr("cy",e.y),a.attr("r",c?5:6),a.attr("class",`commit ${o} ${r.id} commit${N(n,8,d)}`)}if(a===h.REVERSE){const a=c?4:5;t.append("path").attr("d",`M ${e.x-a},${e.y-a}L${e.x+a},${e.y+a}M${e.x-a},${e.y+a}L${e.x+a},${e.y-a}`).attr("class",`commit ${o} ${r.id} commit${N(n,8,d)}`)}}}),"drawCommitBullet"),dt=(0,s.K2)(((t,r,e,o,n)=>{if(r.type!==h.CHERRY_PICK&&(r.customId&&r.type===h.MERGE||r.type!==h.MERGE)&&n.showCommitLabel){const a=t.append("g"),i=a.insert("rect").attr("class","commit-label-bkg"),s=a.append("text").attr("x",o).attr("y",e.y+25).attr("class","commit-label").text(r.id),c=s.node()?.getBBox();if(c&&(i.attr("x",e.posWithOffset-c.width/2-2).attr("y",e.y+13.5).attr("width",c.width+4).attr("height",c.height+4),"TB"===X||"BT"===X?(i.attr("x",e.x-(c.width+16+5)).attr("y",e.y-12),s.attr("x",e.x-(c.width+16)).attr("y",e.y+c.height-12)):s.attr("x",e.posWithOffset-c.width/2),n.rotateCommitLabel))if("TB"===X||"BT"===X)s.attr("transform","rotate(-45, "+e.x+", "+e.y+")"),i.attr("transform","rotate(-45, "+e.x+", "+e.y+")");else{const t=-7.5-(c.width+10)/25*9.5,r=10+c.width/25*8.5;a.attr("transform","translate("+t+", "+r+") rotate(-45, "+o+", "+e.y+")")}}}),"drawCommitLabel"),ht=(0,s.K2)(((t,r,e,o)=>{if(r.tags.length>0){let n=0,a=0,i=0;const s=[];for(const o of r.tags.reverse()){const r=t.insert("polygon"),c=t.append("circle"),d=t.append("text").attr("y",e.y-16-n).attr("class","tag-label").text(o),h=d.node()?.getBBox();if(!h)throw new Error("Tag bbox not found");a=Math.max(a,h.width),i=Math.max(i,h.height),d.attr("x",e.posWithOffset-h.width/2),s.push({tag:d,hole:c,rect:r,yOffset:n}),n+=20}for(const{tag:t,hole:r,rect:c,yOffset:d}of s){const n=i/2,s=e.y-19.2-d;if(c.attr("class","tag-label-bkg").attr("points",`\n ${o-a/2-2},${s+2} \n ${o-a/2-2},${s-2}\n ${e.posWithOffset-a/2-4},${s-n-2}\n ${e.posWithOffset+a/2+4},${s-n-2}\n ${e.posWithOffset+a/2+4},${s+n+2}\n ${e.posWithOffset-a/2-4},${s+n+2}`),r.attr("cy",s).attr("cx",o-a/2+2).attr("r",1.5).attr("class","tag-hole"),"TB"===X||"BT"===X){const i=o+d;c.attr("class","tag-label-bkg").attr("points",`\n ${e.x},${i+2}\n ${e.x},${i-2}\n ${e.x+q},${i-n-2}\n ${e.x+q+a+4},${i-n-2}\n ${e.x+q+a+4},${i+n+2}\n ${e.x+q},${i+n+2}`).attr("transform","translate(12,12) rotate(45, "+e.x+","+o+")"),r.attr("cx",e.x+2).attr("cy",i).attr("transform","translate(12,12) rotate(45, "+e.x+","+o+")"),t.attr("x",e.x+5).attr("y",i+3).attr("transform","translate(14,14) rotate(45, "+e.x+","+o+")")}}}}),"drawCommitTags"),$t=(0,s.K2)((t=>{switch(t.customType??t.type){case h.NORMAL:return"commit-normal";case h.REVERSE:return"commit-reverse";case h.HIGHLIGHT:return"commit-highlight";case h.MERGE:return"commit-merge";case h.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}}),"getCommitClassType"),mt=(0,s.K2)(((t,r,e,o)=>{const n={x:0,y:0};if(!(t.parents.length>0)){if("TB"===r)return 30;if("BT"===r){return(o.get(t.id)??n).y-_}return 0}{const e=rt(t.parents);if(e){const a=o.get(e)??n;if("TB"===r)return a.y+_;if("BT"===r){return(o.get(t.id)??n).y-_}return a.x+_}}return 0}),"calculatePosition"),lt=(0,s.K2)(((t,r,e)=>{const o="BT"===X&&e?r:r+q,n=F.get(t.branch)?.pos,a="TB"===X||"BT"===X?F.get(t.branch)?.pos:o;if(void 0===a||void 0===n)throw new Error(`Position were undefined for commit ${t.id}`);const s=z.has((0,i.D7)().theme??"");return{x:a,y:"TB"===X||"BT"===X?o:n+(s?7:-2),posWithOffset:o}}),"getCommitPosition"),gt=(0,s.K2)(((t,r,e,o)=>{const n=t.append("g").attr("class","commit-bullets"),a=t.append("g").attr("class","commit-labels");let i="TB"===X||"BT"===X?30:0;const c=[...r.keys()],d=o.parallelCommits??!1,h=(0,s.K2)(((t,e)=>{const o=r.get(t)?.seq,n=r.get(e)?.seq;return void 0!==o&&void 0!==n?o-n:0}),"sortKeys");let $=c.sort(h);"BT"===X&&(d&&ot($,r,i),$=$.reverse()),$.forEach((t=>{const s=r.get(t);if(!s)throw new Error(`Commit not found for key ${t}`);d&&(i=mt(s,X,i,V));const c=lt(s,i,d);if(e){const t=$t(s),r=s.customType??s.type,e=F.get(s.branch)?.index??0;ct(n,s,c,t,e,r),dt(a,s,c,i,o),ht(a,s,c,i)}"TB"===X||"BT"===X?V.set(s.id,{x:c.x,y:c.posWithOffset}):V.set(s.id,{x:c.posWithOffset,y:c.y}),i="BT"===X&&d?i+_:i+_+q,i>Q&&(Q=i)}))}),"drawCommits"),pt=(0,s.K2)(((t,r,e,o,n)=>{const a=("TB"===X||"BT"===X?e.x<o.x:e.y<o.y)?r.branch:t.branch,i=(0,s.K2)((t=>t.branch===a),"isOnBranchToGetCurve"),c=(0,s.K2)((e=>e.seq>t.seq&&e.seq<r.seq),"isBetweenCommits");return[...n.values()].some((t=>c(t)&&i(t)))}),"shouldRerouteArrow"),yt=(0,s.K2)(((t,r,e=0)=>{const o=t+Math.abs(t-r)/2;if(e>5)return o;if(J.every((t=>Math.abs(t-o)>=10)))return J.push(o),o;const n=Math.abs(t-r);return yt(t,r-n/5,e+1)}),"findLane"),ft=(0,s.K2)(((t,r,e,o)=>{const{theme:n}=(0,i.D7)(),a=Y.has(n??""),s=V.get(r.id),c=V.get(e.id);if(void 0===s||void 0===c)throw new Error(`Commit positions not found for commits ${r.id} and ${e.id}`);const d=pt(r,e,s,c,o);let $,m="",l="",g=0,p=0,y=F.get(e.branch)?.index;if(e.type===h.MERGE&&r.id!==e.parents[0]&&(y=F.get(r.branch)?.index),d){m="A 10 10, 0, 0, 0,",l="A 10 10, 0, 0, 1,",g=10,p=10;const t=s.y<c.y?yt(s.y,c.y):yt(c.y,s.y),e=s.x<c.x?yt(s.x,c.x):yt(c.x,s.x);"TB"===X?s.x<c.x?$=`M ${s.x} ${s.y} L ${e-g} ${s.y} ${l} ${e} ${s.y+p} L ${e} ${c.y-g} ${m} ${e+p} ${c.y} L ${c.x} ${c.y}`:(y=F.get(r.branch)?.index,$=`M ${s.x} ${s.y} L ${e+g} ${s.y} ${m} ${e} ${s.y+p} L ${e} ${c.y-g} ${l} ${e-p} ${c.y} L ${c.x} ${c.y}`):"BT"===X?s.x<c.x?$=`M ${s.x} ${s.y} L ${e-g} ${s.y} ${m} ${e} ${s.y-p} L ${e} ${c.y+g} ${l} ${e+p} ${c.y} L ${c.x} ${c.y}`:(y=F.get(r.branch)?.index,$=`M ${s.x} ${s.y} L ${e+g} ${s.y} ${l} ${e} ${s.y-p} L ${e} ${c.y+g} ${m} ${e-p} ${c.y} L ${c.x} ${c.y}`):s.y<c.y?$=`M ${s.x} ${s.y} L ${s.x} ${t-g} ${m} ${s.x+p} ${t} L ${c.x-g} ${t} ${l} ${c.x} ${t+p} L ${c.x} ${c.y}`:(y=F.get(r.branch)?.index,$=`M ${s.x} ${s.y} L ${s.x} ${t+g} ${l} ${s.x+p} ${t} L ${c.x-g} ${t} ${m} ${c.x} ${t-p} L ${c.x} ${c.y}`)}else m="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",g=20,p=20,"TB"===X?(s.x<c.x&&($=e.type===h.MERGE&&r.id!==e.parents[0]?`M ${s.x} ${s.y} L ${s.x} ${c.y-g} ${m} ${s.x+p} ${c.y} L ${c.x} ${c.y}`:`M ${s.x} ${s.y} L ${c.x-g} ${s.y} ${l} ${c.x} ${s.y+p} L ${c.x} ${c.y}`),s.x>c.x&&(m="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",g=20,p=20,$=e.type===h.MERGE&&r.id!==e.parents[0]?`M ${s.x} ${s.y} L ${s.x} ${c.y-g} ${l} ${s.x-p} ${c.y} L ${c.x} ${c.y}`:`M ${s.x} ${s.y} L ${c.x+g} ${s.y} ${m} ${c.x} ${s.y+p} L ${c.x} ${c.y}`),s.x===c.x&&($=`M ${s.x} ${s.y} L ${c.x} ${c.y}`)):"BT"===X?(s.x<c.x&&($=e.type===h.MERGE&&r.id!==e.parents[0]?`M ${s.x} ${s.y} L ${s.x} ${c.y+g} ${l} ${s.x+p} ${c.y} L ${c.x} ${c.y}`:`M ${s.x} ${s.y} L ${c.x-g} ${s.y} ${m} ${c.x} ${s.y-p} L ${c.x} ${c.y}`),s.x>c.x&&(m="A 20 20, 0, 0, 0,",l="A 20 20, 0, 0, 1,",g=20,p=20,$=e.type===h.MERGE&&r.id!==e.parents[0]?`M ${s.x} ${s.y} L ${s.x} ${c.y+g} ${m} ${s.x-p} ${c.y} L ${c.x} ${c.y}`:`M ${s.x} ${s.y} L ${c.x+g} ${s.y} ${l} ${c.x} ${s.y-p} L ${c.x} ${c.y}`),s.x===c.x&&($=`M ${s.x} ${s.y} L ${c.x} ${c.y}`)):(s.y<c.y&&($=e.type===h.MERGE&&r.id!==e.parents[0]?`M ${s.x} ${s.y} L ${c.x-g} ${s.y} ${l} ${c.x} ${s.y+p} L ${c.x} ${c.y}`:`M ${s.x} ${s.y} L ${s.x} ${c.y-g} ${m} ${s.x+p} ${c.y} L ${c.x} ${c.y}`),s.y>c.y&&($=e.type===h.MERGE&&r.id!==e.parents[0]?`M ${s.x} ${s.y} L ${c.x-g} ${s.y} ${m} ${c.x} ${s.y-p} L ${c.x} ${c.y}`:`M ${s.x} ${s.y} L ${s.x} ${c.y+g} ${l} ${s.x+p} ${c.y} L ${c.x} ${c.y}`),s.y===c.y&&($=`M ${s.x} ${s.y} L ${c.x} ${c.y}`));if(void 0===$)throw new Error("Line definition not found");t.append("path").attr("d",$).attr("class","arrow arrow"+N(y,8,a))}),"drawArrow"),xt=(0,s.K2)(((t,r)=>{const e=t.append("g").attr("class","commit-arrows");[...r.keys()].forEach((t=>{const o=r.get(t);o.parents&&o.parents.length>0&&o.parents.forEach((t=>{ft(e,r.get(t),o,r)}))}))}),"drawArrows"),ut=(0,s.K2)(((t,r,e,o)=>{const{look:n,theme:a,themeVariables:s}=(0,i.D7)(),{dropShadow:c,THEME_COLOR_LIMIT:d}=s,h=z.has(a??""),$=Y.has(a??""),m=t.append("g");r.forEach(((t,r)=>{const a=N(r,h?d:8,$),i=F.get(t.name)?.pos;if(void 0===i)throw new Error(`Position not found for branch ${t.name}`);const s="TB"===X||"BT"===X?i:h?i+6+1:i-2,l=m.append("line");l.attr("x1",0),l.attr("y1",s),l.attr("x2",Q),l.attr("y2",s),l.attr("class","branch branch"+a),"TB"===X?(l.attr("y1",30),l.attr("x1",i),l.attr("y2",Q),l.attr("x2",i)):"BT"===X&&(l.attr("y1",Q),l.attr("x1",i),l.attr("y2",30),l.attr("x2",i)),J.push(s);const g=t.name,p=tt(g),y=m.insert("rect"),f=m.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+a);f.node().appendChild(p);const x=p.getBBox(),u=h?0:4,b=h?16:0,w=h?12:0;"neo"===n&&y.attr("data-look","neo"),y.attr("class","branchLabelBkg label"+a).attr("style","neo"===n?`filter:${h?`url(#${o}-drop-shadow)`:c}`:"").attr("rx",u).attr("ry",u).attr("x",-x.width-4-(!0===e.rotateCommitLabel?30:0)).attr("y",-x.height/2+10).attr("width",x.width+18+b).attr("height",x.height+4+w),f.attr("transform","translate("+(-x.width-14-(!0===e.rotateCommitLabel?30:0)+b/2)+", "+(s-x.height/2-2)+")"),"TB"===X?(y.attr("x",i-x.width/2-10).attr("y",0),f.attr("transform","translate("+(i-x.width/2-5)+", 0)"),h&&(y.attr("transform",`translate(${-b/2-3}, ${-w-10})`),f.attr("transform","translate("+(i-x.width/2-5)+", "+(2*-w+7)+")"))):"BT"===X?(y.attr("x",i-x.width/2-10).attr("y",Q),f.attr("transform","translate("+(i-x.width/2-5)+", "+Q+")"),h&&(y.attr("transform",`translate(${-b/2-3}, ${w+10})`),f.attr("transform","translate("+(i-x.width/2-5)+", "+(Q+2*w+4)+")"))):y.attr("transform","translate(-19, "+(s-12-w/2)+")")}))}),"drawBranches"),bt=(0,s.K2)((function(t,r,e,o,n){return F.set(t,{pos:r,index:e}),r+=50+(n?40:0)+("TB"===X||"BT"===X?o.width/2:0)}),"setBranchPosition"),wt={draw:(0,s.K2)((function(t,r,e,o){Z(),s.Rm.debug("in gitgraph renderer",t+"\n","id:",r,e);const n=o.db;if(!n.getConfig)return void s.Rm.error("getConfig method is not available on db");const c=n.getConfig(),h=c.rotateCommitLabel??!1;U=n.getCommits();const $=n.getBranchesAsObjArray();X=n.getDirection();const m=(0,d.Ltv)(`[id="${r}"]`),{look:l,theme:g,themeVariables:p}=(0,i.D7)(),{useGradient:y,gradientStart:f,gradientStop:x,filterColor:u}=p;if(y){const t=m.append("defs").append("linearGradient").attr("id",r+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");t.append("stop").attr("offset","0%").attr("stop-color",f).attr("stop-opacity",1),t.append("stop").attr("offset","100%").attr("stop-color",x).attr("stop-opacity",1)}"neo"===l&&z.has(g??"")&&m.append("defs").append("filter").attr("id",r+"-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",u);let b=0;$.forEach(((t,r)=>{const e=tt(t.name),o=m.append("g"),n=o.insert("g").attr("class","branchLabel"),a=n.insert("g").attr("class","label branch-label");a.node()?.appendChild(e);const i=e.getBBox();b=bt(t.name,b,r,i,h),a.remove(),n.remove(),o.remove()})),gt(m,U,!1,c),c.showBranches&&ut(m,$,c,r),xt(m,U),gt(m,U,!0,c),a._K.insertTitle(m,"gitTitleText",c.titleTopMargin??0,n.getDiagramTitle()),(0,i.mj)(void 0,m,c.diagramPadding,c.useMaxWidth)}),"draw")};var kt=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),Bt=new Set(["redux-color","redux-dark-color"]),Et=new Set(["neo","neo-dark"]),Ct=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),Tt=new Set(["redux","redux-dark","redux-color","redux-dark-color","neo","neo-dark"]),Lt=(0,s.K2)((t=>{const{svgId:r}=t;let e="";if(t.useGradient&&r)for(let o=0;o<t.THEME_COLOR_LIMIT;o++)e+=`\n .label${o} { fill: ${t.mainBkg}; stroke: url(${r}-gradient); stroke-width: ${t.strokeWidth};}\n `;return e}),"genGitGraphGradient"),Kt=(0,s.K2)((t=>{const r=(0,i.zj)(),{theme:e,themeVariables:o}=r,{borderColorArray:n}=o,a=kt.has(e);if(Et.has(e)){let r="";for(let e=0;e<t.THEME_COLOR_LIMIT;e++)if(0===e)r+=`\n .branch-label${e} { fill: ${t.nodeBorder};}\n .commit${e} { stroke: ${t.nodeBorder}; }\n .commit-highlight${e} { stroke: ${t.nodeBorder}; fill: ${t.nodeBorder}; }\n .arrow${e} { stroke: ${t.nodeBorder}; }\n .commit-bullets { fill: ${t.nodeBorder}; }\n .commit-cherry-pick${e} { stroke: ${t.nodeBorder}; }\n ${Lt(t)}`;else{const o=e%8;r+=`\n .branch-label${e} { fill: ${t["gitBranchLabel"+o]}; }\n .commit${e} { stroke: ${t["git"+o]}; fill: ${t["git"+o]}; }\n .commit-highlight${e} { stroke: ${t["gitInv"+o]}; fill: ${t["gitInv"+o]}; }\n .arrow${e} { stroke: ${t["git"+o]}; }\n `}return r}if(Bt.has(e)){let r="";for(let o=0;o<t.THEME_COLOR_LIMIT;o++)if(0===o)r+=`\n .branch-label${o} { fill: ${t.nodeBorder}; ${a?`font-weight:${t.noteFontWeight}`:""} }\n .commit${o} { stroke: ${t.nodeBorder}; }\n .commit-highlight${o} { stroke: ${t.nodeBorder}; fill: ${t.mainBkg}; }\n .label${o} { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; stroke-width: ${t.strokeWidth}; ${a?`font-weight:${t.noteFontWeight}`:""} }\n .arrow${o} { stroke: ${t.nodeBorder}; }\n .commit-bullets { fill: ${t.nodeBorder}; }\n `;else{const i=o%n.length;r+=`\n .branch-label${o} { fill: ${t.nodeBorder}; ${a?`font-weight:${t.noteFontWeight}`:""} }\n .commit${o} { stroke: ${n[i]}; fill: ${n[i]}; }\n .commit-highlight${o} { stroke: ${n[i]}; fill: ${n[i]}; }\n .label${o} { fill: ${Ct.has(e)?t.mainBkg:n[i]}; stroke: ${n[i]}; stroke-width: ${t.strokeWidth}; }\n .arrow${o} { stroke: ${n[i]}; }\n `}return r}{let r="";for(let e=0;e<t.THEME_COLOR_LIMIT;e++)r+=`\n .branch-label${e} { fill: ${t.nodeBorder}; ${a?`font-weight:${t.noteFontWeight}`:""} }\n .commit${e} { stroke: ${t.nodeBorder}; }\n .commit-highlight${e} { stroke: ${t.nodeBorder}; fill: ${t.nodeBorder}; }\n .label${e} { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; stroke-width: ${t.strokeWidth}; ${a?`font-weight:${t.noteFontWeight}`:""}}\n .arrow${e} { stroke: ${t.nodeBorder}; }\n .commit-bullets { fill: ${t.nodeBorder}; }\n .commit-cherry-pick${e} { stroke: ${t.nodeBorder}; }\n `;return r}}),"genColor"),Mt=(0,s.K2)((t=>`${Array.from({length:t.THEME_COLOR_LIMIT},((t,r)=>r)).map((r=>{const e=r%8;return`\n .branch-label${r} { fill: ${t["gitBranchLabel"+e]}; }\n .commit${r} { stroke: ${t["git"+e]}; fill: ${t["git"+e]}; }\n .commit-highlight${r} { stroke: ${t["gitInv"+e]}; fill: ${t["gitInv"+e]}; }\n .label${r} { fill: ${t["git"+e]}; }\n .arrow${r} { stroke: ${t["git"+e]}; }\n `})).join("\n")}`),"normalTheme"),Rt={parser:W,db:I,renderer:wt,styles:(0,s.K2)((t=>{const r=(0,i.zj)(),{theme:e}=r,o=Tt.has(e);return`\n .commit-id,\n .commit-msg,\n .branch-label {\n fill: lightgrey;\n color: lightgrey;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n \n ${o?Kt(t):Mt(t)}\n\n .branch {\n stroke-width: ${t.strokeWidth};\n stroke: ${t.commitLineColor??t.lineColor};\n stroke-dasharray: ${o?"4 2":"2"};\n }\n .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${o?t.nodeBorder:t.commitLabelColor}; ${o?`font-weight:${t.noteFontWeight};`:""}}\n .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${o?"transparent":t.commitLabelBackground}; opacity: ${o?"":.5}; }\n .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}\n .tag-label-bkg { fill: ${o?t.mainBkg:t.tagLabelBackground}; stroke: ${o?t.nodeBorder:t.tagLabelBorder}; ${o?`filter:${t.dropShadow}`:""} }\n .tag-hole { fill: ${t.textColor}; }\n\n .commit-merge {\n stroke: ${o?t.mainBkg:t.primaryColor};\n fill: ${o?t.mainBkg:t.primaryColor};\n }\n .commit-reverse {\n stroke: ${o?t.mainBkg:t.primaryColor};\n fill: ${o?t.mainBkg:t.primaryColor};\n stroke-width: ${o?t.strokeWidth:3};\n }\n .commit-highlight-outer {\n }\n .commit-highlight-inner {\n stroke: ${o?t.mainBkg:t.primaryColor};\n fill: ${o?t.mainBkg:t.primaryColor};\n }\n\n .arrow {\n /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */\n stroke-width: ${kt.has(e)?t.strokeWidth:8};\n stroke-linecap: round;\n fill: none\n }\n .gitTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n`}),"getStyles")}},72938:(t,r,e)=>{e.d(r,{m:()=>n});var o=e(40797),n=class{constructor(t){this.init=t,this.records=this.init()}static{(0,o.K2)(this,"ImperativeState")}reset(){this.records=this.init()}}}}]); |