Files
Thesis/share/jupyter/lab/static/2709.5140980a9923ec42b67e.js

1 line
34 KiB
JavaScript

"use strict";(self["webpackChunk_jupyterlab_application_top"]=self["webpackChunk_jupyterlab_application_top"]||[]).push([[2709],{85054:(t,e,r)=>{r.d(e,{S:()=>n});var a=r(70416);function n(t,e){if(t.accDescr){e.setAccDescription?.(t.accDescr)}if(t.accTitle){e.setAccTitle?.(t.accTitle)}if(t.title){e.setDiagramTitle?.(t.title)}}(0,a.K2)(n,"populateCommonDb")},75463:(t,e,r)=>{r.d(e,{m:()=>n});var a=r(70416);var n=class{constructor(t){this.init=t;this.records=this.init()}static{(0,a.K2)(this,"ImperativeState")}reset(){this.records=this.init()}}},95090:(t,e,r)=>{r.d(e,{diagram:()=>Rt});var a=r(85054);var n=r(75463);var o=r(29131);var s=r(42418);var c=r(70416);var i=r(24010);var m=r(1218);var d={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4};var h=s.UI.gitGraph;var l=(0,c.K2)((()=>{const t=(0,o.$t)({...h,...(0,s.zj)().gitGraph});return t}),"getConfig");var g=new n.m((()=>{const t=l();const e=t.mainBranchName;const r=t.mainBranchOrder;return{mainBranchName:e,commits:new Map,head:null,branchConfig:new Map([[e,{name:e,order:r}]]),branches:new Map([[e,null]]),currBranch:e,direction:"LR",seq:0,options:{}}}));function f(){return(0,o.yT)({length:7})}(0,c.K2)(f,"getID");function p(t,e){const r=Object.create(null);return t.reduce(((t,a)=>{const n=e(a);if(!r[n]){r[n]=true;t.push(a)}return t}),[])}(0,c.K2)(p,"uniqBy");var $=(0,c.K2)((function(t){g.records.direction=t}),"setDirection");var y=(0,c.K2)((function(t){c.Rm.debug("options str",t);t=t?.trim();t=t||"{}";try{g.records.options=JSON.parse(t)}catch(e){c.Rm.error("error while parsing gitGraph options",e.message)}}),"setOptions");var x=(0,c.K2)((function(){return g.records.options}),"getOptions");var u=(0,c.K2)((function(t){let e=t.msg;let r=t.id;const a=t.type;let n=t.tags;c.Rm.info("commit",e,r,a,n);c.Rm.debug("Entering commit:",e,r,a,n);const o=l();r=s.Y2.sanitizeText(r,o);e=s.Y2.sanitizeText(e,o);n=n?.map((t=>s.Y2.sanitizeText(t,o)));const i={id:r?r:g.records.seq+"-"+f(),message:e,seq:g.records.seq++,type:a??d.NORMAL,tags:n??[],parents:g.records.head==null?[]:[g.records.head.id],branch:g.records.currBranch};g.records.head=i;c.Rm.info("main branch",o.mainBranchName);if(g.records.commits.has(i.id)){c.Rm.warn(`Commit ID ${i.id} already exists`)}g.records.commits.set(i.id,i);g.records.branches.set(g.records.currBranch,i.id);c.Rm.debug("in pushCommit "+i.id)}),"commit");var b=(0,c.K2)((function(t){let e=t.name;const r=t.order;e=s.Y2.sanitizeText(e,l());if(g.records.branches.has(e)){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 ${e}")`)}g.records.branches.set(e,g.records.head!=null?g.records.head.id:null);g.records.branchConfig.set(e,{name:e,order:r});B(e);c.Rm.debug("in createBranch")}),"branch");var w=(0,c.K2)((t=>{let e=t.branch;let r=t.id;const a=t.type;const n=t.tags;const o=l();e=s.Y2.sanitizeText(e,o);if(r){r=s.Y2.sanitizeText(r,o)}const i=g.records.branches.get(g.records.currBranch);const m=g.records.branches.get(e);const h=i?g.records.commits.get(i):void 0;const p=m?g.records.commits.get(m):void 0;if(h&&p&&h.branch===e){throw new Error(`Cannot merge branch '${e}' into itself.`)}if(g.records.currBranch===e){const t=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]};throw t}if(h===void 0||!h){const t=new Error(`Incorrect usage of "merge". Current branch (${g.records.currBranch})has no commits`);t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["commit"]};throw t}if(!g.records.branches.has(e)){const t=new Error('Incorrect usage of "merge". Branch to be merged ('+e+") does not exist");t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:[`branch ${e}`]};throw t}if(p===void 0||!p){const t=new Error('Incorrect usage of "merge". Branch to be merged ('+e+") has no commits");t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:['"commit"']};throw t}if(h===p){const t=new Error('Incorrect usage of "merge". Both branches have same head');t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]};throw t}if(r&&g.records.commits.has(r)){const t=new Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");t.hash={text:`merge ${e} ${r} ${a} ${n?.join(" ")}`,token:`merge ${e} ${r} ${a} ${n?.join(" ")}`,expected:[`merge ${e} ${r}_UNIQUE ${a} ${n?.join(" ")}`]};throw t}const $=m?m:"";const y={id:r||`${g.records.seq}-${f()}`,message:`merged branch ${e} into ${g.records.currBranch}`,seq:g.records.seq++,parents:g.records.head==null?[]:[g.records.head.id,$],branch:g.records.currBranch,type:d.MERGE,customType:a,customId:r?true:false,tags:n??[]};g.records.head=y;g.records.commits.set(y.id,y);g.records.branches.set(g.records.currBranch,y.id);c.Rm.debug(g.records.branches);c.Rm.debug("in mergeBranch")}),"merge");var v=(0,c.K2)((function(t){let e=t.id;let r=t.targetId;let a=t.tags;let n=t.parent;c.Rm.debug("Entering cherryPick:",e,r,a);const o=l();e=s.Y2.sanitizeText(e,o);r=s.Y2.sanitizeText(r,o);a=a?.map((t=>s.Y2.sanitizeText(t,o)));n=s.Y2.sanitizeText(n,o);if(!e||!g.records.commits.has(e)){const t=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]};throw t}const i=g.records.commits.get(e);if(i===void 0||!i){throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided')}if(n&&!(Array.isArray(i.parents)&&i.parents.includes(n))){const t=new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");throw t}const m=i.branch;if(i.type===d.MERGE&&!n){const t=new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");throw t}if(!r||!g.records.commits.has(r)){if(m===g.records.currBranch){const t=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]};throw t}const t=g.records.branches.get(g.records.currBranch);if(t===void 0||!t){const t=new Error(`Incorrect usage of "cherry-pick". Current branch (${g.records.currBranch})has no commits`);t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]};throw t}const o=g.records.commits.get(t);if(o===void 0||!o){const t=new Error(`Incorrect usage of "cherry-pick". Current branch (${g.records.currBranch})has no commits`);t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]};throw t}const s={id:g.records.seq+"-"+f(),message:`cherry-picked ${i?.message} into ${g.records.currBranch}`,seq:g.records.seq++,parents:g.records.head==null?[]:[g.records.head.id,i.id],branch:g.records.currBranch,type:d.CHERRY_PICK,tags:a?a.filter(Boolean):[`cherry-pick:${i.id}${i.type===d.MERGE?`|parent:${n}`:""}`]};g.records.head=s;g.records.commits.set(s.id,s);g.records.branches.set(g.records.currBranch,s.id);c.Rm.debug(g.records.branches);c.Rm.debug("in cherryPick")}}),"cherryPick");var B=(0,c.K2)((function(t){t=s.Y2.sanitizeText(t,l());if(!g.records.branches.has(t)){const e=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);e.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]};throw e}else{g.records.currBranch=t;const e=g.records.branches.get(g.records.currBranch);if(e===void 0||!e){g.records.head=null}else{g.records.head=g.records.commits.get(e)??null}}}),"checkout");function E(t,e,r){const a=t.indexOf(e);if(a===-1){t.push(r)}else{t.splice(a,1,r)}}(0,c.K2)(E,"upsert");function C(t){const e=t.reduce(((t,e)=>{if(t.seq>e.seq){return t}return e}),t[0]);let r="";t.forEach((function(t){if(t===e){r+="\t*"}else{r+="\t|"}}));const a=[r,e.id,e.seq];for(const n in g.records.branches){if(g.records.branches.get(n)===e.id){a.push(n)}}c.Rm.debug(a.join(" "));if(e.parents&&e.parents.length==2&&e.parents[0]&&e.parents[1]){const r=g.records.commits.get(e.parents[0]);E(t,e,r);if(e.parents[1]){t.push(g.records.commits.get(e.parents[1]))}}else if(e.parents.length==0){return}else{if(e.parents[0]){const r=g.records.commits.get(e.parents[0]);E(t,e,r)}}t=p(t,(t=>t.id));C(t)}(0,c.K2)(C,"prettyPrintCommitHistory");var k=(0,c.K2)((function(){c.Rm.debug(g.records.commits);const t=K()[0];C([t])}),"prettyPrint");var L=(0,c.K2)((function(){g.reset();(0,s.IU)()}),"clear");var T=(0,c.K2)((function(){const t=[...g.records.branchConfig.values()].map(((t,e)=>{if(t.order!==null&&t.order!==void 0){return t}return{...t,order:parseFloat(`0.${e}`)}})).sort(((t,e)=>(t.order??0)-(e.order??0))).map((({name:t})=>({name:t})));return t}),"getBranchesAsObjArray");var M=(0,c.K2)((function(){return g.records.branches}),"getBranches");var R=(0,c.K2)((function(){return g.records.commits}),"getCommits");var K=(0,c.K2)((function(){const t=[...g.records.commits.values()];t.forEach((function(t){c.Rm.debug(t.id)}));t.sort(((t,e)=>t.seq-e.seq));return t}),"getCommitsArray");var O=(0,c.K2)((function(){return g.records.currBranch}),"getCurrentBranch");var P=(0,c.K2)((function(){return g.records.direction}),"getDirection");var A=(0,c.K2)((function(){return g.records.head}),"getHead");var q={commitType:d,getConfig:l,setDirection:$,setOptions:y,getOptions:x,commit:u,branch:b,merge:w,cherryPick:v,checkout:B,prettyPrint:k,clear:L,getBranchesAsObjArray:T,getBranches:M,getCommits:R,getCommitsArray:K,getCurrentBranch:O,getDirection:P,getHead:A,setAccTitle:s.SV,getAccTitle:s.iN,getAccDescription:s.m7,setAccDescription:s.EI,setDiagramTitle:s.ke,getDiagramTitle:s.ab};var I=(0,c.K2)(((t,e)=>{(0,a.S)(t,e);if(t.dir){e.setDirection(t.dir)}for(const r of t.statements){G(r,e)}}),"populate");var G=(0,c.K2)(((t,e)=>{const r={Commit:(0,c.K2)((t=>e.commit(W(t))),"Commit"),Branch:(0,c.K2)((t=>e.branch(H(t))),"Branch"),Merge:(0,c.K2)((t=>e.merge(D(t))),"Merge"),Checkout:(0,c.K2)((t=>e.checkout(N(t))),"Checkout"),CherryPicking:(0,c.K2)((t=>e.cherryPick(_(t))),"CherryPicking")};const a=r[t.$type];if(a){a(t)}else{c.Rm.error(`Unknown statement type: ${t.$type}`)}}),"parseStatement");var W=(0,c.K2)((t=>{const e={id:t.id,msg:t.message??"",type:t.type!==void 0?d[t.type]:d.NORMAL,tags:t.tags??void 0};return e}),"parseCommit");var H=(0,c.K2)((t=>{const e={name:t.name,order:t.order??0};return e}),"parseBranch");var D=(0,c.K2)((t=>{const e={branch:t.branch,id:t.id??"",type:t.type!==void 0?d[t.type]:void 0,tags:t.tags??void 0};return e}),"parseMerge");var N=(0,c.K2)((t=>{const e=t.branch;return e}),"parseCheckout");var _=(0,c.K2)((t=>{const e={id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent};return e}),"parseCherryPicking");var S={parse:(0,c.K2)((async t=>{const e=await(0,i.qg)("gitGraph",t);c.Rm.debug(e);I(e,q)}),"parse")};if(void 0){const{it:t,expect:e,describe:r}=void 0;const a={commitType:d,setDirection:vi.fn(),commit:vi.fn(),branch:vi.fn(),merge:vi.fn(),cherryPick:vi.fn(),checkout:vi.fn()};r("GitGraph Parser",(()=>{t("should parse a commit statement",(()=>{const t={$type:"Commit",id:"1",message:"test",tags:["tag1","tag2"],type:"NORMAL"};G(t,a);e(a.commit).toHaveBeenCalledWith({id:"1",msg:"test",tags:["tag1","tag2"],type:0})}));t("should parse a branch statement",(()=>{const t={$type:"Branch",name:"newBranch",order:1};G(t,a);e(a.branch).toHaveBeenCalledWith({name:"newBranch",order:1})}));t("should parse a checkout statement",(()=>{const t={$type:"Checkout",branch:"newBranch"};G(t,a);e(a.checkout).toHaveBeenCalledWith("newBranch")}));t("should parse a merge statement",(()=>{const t={$type:"Merge",branch:"newBranch",id:"1",tags:["tag1","tag2"],type:"NORMAL"};G(t,a);e(a.merge).toHaveBeenCalledWith({branch:"newBranch",id:"1",tags:["tag1","tag2"],type:0})}));t("should parse a cherry picking statement",(()=>{const t={$type:"CherryPicking",id:"1",tags:["tag1","tag2"],parent:"2"};G(t,a);e(a.cherryPick).toHaveBeenCalledWith({id:"1",targetId:"",parent:"2",tags:["tag1","tag2"]})}));t("should parse a langium generated gitGraph ast",(()=>{const t={$type:"GitGraph",statements:[]};const r={$type:"GitGraph",statements:[{$container:t,$type:"Commit",id:"1",message:"test",tags:["tag1","tag2"],type:"NORMAL"},{$container:t,$type:"Branch",name:"newBranch",order:1},{$container:t,$type:"Merge",branch:"newBranch",id:"1",tags:["tag1","tag2"],type:"NORMAL"},{$container:t,$type:"Checkout",branch:"newBranch"},{$container:t,$type:"CherryPicking",id:"1",tags:["tag1","tag2"],parent:"2"}]};I(r,a);e(a.commit).toHaveBeenCalledWith({id:"1",msg:"test",tags:["tag1","tag2"],type:0});e(a.branch).toHaveBeenCalledWith({name:"newBranch",order:1});e(a.merge).toHaveBeenCalledWith({branch:"newBranch",id:"1",tags:["tag1","tag2"],type:0});e(a.checkout).toHaveBeenCalledWith("newBranch")}))}))}var z=(0,s.D7)();var Y=z?.gitGraph;var j=10;var Z=40;var F=4;var U=2;var V=8;var J=new Map;var Q=new Map;var X=30;var tt=new Map;var et=[];var rt=0;var at="LR";var nt=(0,c.K2)((()=>{J.clear();Q.clear();tt.clear();rt=0;et=[];at="LR"}),"clear");var ot=(0,c.K2)((t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","text");const r=typeof t==="string"?t.split(/\\n|\n|<br\s*\/?>/gi):t;r.forEach((t=>{const r=document.createElementNS("http://www.w3.org/2000/svg","tspan");r.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve");r.setAttribute("dy","1em");r.setAttribute("x","0");r.setAttribute("class","row");r.textContent=t.trim();e.appendChild(r)}));return e}),"drawText");var st=(0,c.K2)((t=>{let e;let r;let a;if(at==="BT"){r=(0,c.K2)(((t,e)=>t<=e),"comparisonFunc");a=Infinity}else{r=(0,c.K2)(((t,e)=>t>=e),"comparisonFunc");a=0}t.forEach((t=>{const n=at==="TB"||at=="BT"?Q.get(t)?.y:Q.get(t)?.x;if(n!==void 0&&r(n,a)){e=t;a=n}}));return e}),"findClosestParent");var ct=(0,c.K2)((t=>{let e="";let r=Infinity;t.forEach((t=>{const a=Q.get(t).y;if(a<=r){e=t;r=a}}));return e||void 0}),"findClosestParentBT");var it=(0,c.K2)(((t,e,r)=>{let a=r;let n=r;const o=[];t.forEach((t=>{const r=e.get(t);if(!r){throw new Error(`Commit not found for key ${t}`)}if(r.parents.length){a=dt(r);n=Math.max(a,n)}else{o.push(r)}ht(r,a)}));a=n;o.forEach((t=>{lt(t,a,r)}));t.forEach((t=>{const r=e.get(t);if(r?.parents.length){const t=ct(r.parents);a=Q.get(t).y-Z;if(a<=n){n=a}const e=J.get(r.branch).pos;const o=a-j;Q.set(r.id,{x:e,y:o})}}))}),"setParallelBTPos");var mt=(0,c.K2)((t=>{const e=st(t.parents.filter((t=>t!==null)));if(!e){throw new Error(`Closest parent not found for commit ${t.id}`)}const r=Q.get(e)?.y;if(r===void 0){throw new Error(`Closest parent position not found for commit ${t.id}`)}return r}),"findClosestParentPos");var dt=(0,c.K2)((t=>{const e=mt(t);return e+Z}),"calculateCommitPosition");var ht=(0,c.K2)(((t,e)=>{const r=J.get(t.branch);if(!r){throw new Error(`Branch not found for commit ${t.id}`)}const a=r.pos;const n=e+j;Q.set(t.id,{x:a,y:n});return{x:a,y:n}}),"setCommitPosition");var lt=(0,c.K2)(((t,e,r)=>{const a=J.get(t.branch);if(!a){throw new Error(`Branch not found for commit ${t.id}`)}const n=e+r;const o=a.pos;Q.set(t.id,{x:o,y:n})}),"setRootPosition");var gt=(0,c.K2)(((t,e,r,a,n,o)=>{if(o===d.HIGHLIGHT){t.append("rect").attr("x",r.x-10).attr("y",r.y-10).attr("width",20).attr("height",20).attr("class",`commit ${e.id} commit-highlight${n%V} ${a}-outer`);t.append("rect").attr("x",r.x-6).attr("y",r.y-6).attr("width",12).attr("height",12).attr("class",`commit ${e.id} commit${n%V} ${a}-inner`)}else if(o===d.CHERRY_PICK){t.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",10).attr("class",`commit ${e.id} ${a}`);t.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${e.id} ${a}`);t.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${e.id} ${a}`);t.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke","#fff").attr("class",`commit ${e.id} ${a}`);t.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke","#fff").attr("class",`commit ${e.id} ${a}`)}else{const s=t.append("circle");s.attr("cx",r.x);s.attr("cy",r.y);s.attr("r",e.type===d.MERGE?9:10);s.attr("class",`commit ${e.id} commit${n%V}`);if(o===d.MERGE){const o=t.append("circle");o.attr("cx",r.x);o.attr("cy",r.y);o.attr("r",6);o.attr("class",`commit ${a} ${e.id} commit${n%V}`)}if(o===d.REVERSE){const o=t.append("path");o.attr("d",`M ${r.x-5},${r.y-5}L${r.x+5},${r.y+5}M${r.x-5},${r.y+5}L${r.x+5},${r.y-5}`).attr("class",`commit ${a} ${e.id} commit${n%V}`)}}}),"drawCommitBullet");var ft=(0,c.K2)(((t,e,r,a)=>{if(e.type!==d.CHERRY_PICK&&(e.customId&&e.type===d.MERGE||e.type!==d.MERGE)&&Y?.showCommitLabel){const n=t.append("g");const o=n.insert("rect").attr("class","commit-label-bkg");const s=n.append("text").attr("x",a).attr("y",r.y+25).attr("class","commit-label").text(e.id);const c=s.node()?.getBBox();if(c){o.attr("x",r.posWithOffset-c.width/2-U).attr("y",r.y+13.5).attr("width",c.width+2*U).attr("height",c.height+2*U);if(at==="TB"||at==="BT"){o.attr("x",r.x-(c.width+4*F+5)).attr("y",r.y-12);s.attr("x",r.x-(c.width+4*F)).attr("y",r.y+c.height-12)}else{s.attr("x",r.posWithOffset-c.width/2)}if(Y.rotateCommitLabel){if(at==="TB"||at==="BT"){s.attr("transform","rotate(-45, "+r.x+", "+r.y+")");o.attr("transform","rotate(-45, "+r.x+", "+r.y+")")}else{const t=-7.5-(c.width+10)/25*9.5;const e=10+c.width/25*8.5;n.attr("transform","translate("+t+", "+e+") rotate(-45, "+a+", "+r.y+")")}}}}}),"drawCommitLabel");var pt=(0,c.K2)(((t,e,r,a)=>{if(e.tags.length>0){let n=0;let o=0;let s=0;const c=[];for(const a of e.tags.reverse()){const e=t.insert("polygon");const i=t.append("circle");const m=t.append("text").attr("y",r.y-16-n).attr("class","tag-label").text(a);const d=m.node()?.getBBox();if(!d){throw new Error("Tag bbox not found")}o=Math.max(o,d.width);s=Math.max(s,d.height);m.attr("x",r.posWithOffset-d.width/2);c.push({tag:m,hole:i,rect:e,yOffset:n});n+=20}for(const{tag:t,hole:e,rect:i,yOffset:m}of c){const n=s/2;const c=r.y-19.2-m;i.attr("class","tag-label-bkg").attr("points",`\n ${a-o/2-F/2},${c+U} \n ${a-o/2-F/2},${c-U}\n ${r.posWithOffset-o/2-F},${c-n-U}\n ${r.posWithOffset+o/2+F},${c-n-U}\n ${r.posWithOffset+o/2+F},${c+n+U}\n ${r.posWithOffset-o/2-F},${c+n+U}`);e.attr("cy",c).attr("cx",a-o/2+F/2).attr("r",1.5).attr("class","tag-hole");if(at==="TB"||at==="BT"){const s=a+m;i.attr("class","tag-label-bkg").attr("points",`\n ${r.x},${s+2}\n ${r.x},${s-2}\n ${r.x+j},${s-n-2}\n ${r.x+j+o+4},${s-n-2}\n ${r.x+j+o+4},${s+n+2}\n ${r.x+j},${s+n+2}`).attr("transform","translate(12,12) rotate(45, "+r.x+","+a+")");e.attr("cx",r.x+F/2).attr("cy",s).attr("transform","translate(12,12) rotate(45, "+r.x+","+a+")");t.attr("x",r.x+5).attr("y",s+3).attr("transform","translate(14,14) rotate(45, "+r.x+","+a+")")}}}}),"drawCommitTags");var $t=(0,c.K2)((t=>{const e=t.customType??t.type;switch(e){case d.NORMAL:return"commit-normal";case d.REVERSE:return"commit-reverse";case d.HIGHLIGHT:return"commit-highlight";case d.MERGE:return"commit-merge";case d.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}}),"getCommitClassType");var yt=(0,c.K2)(((t,e,r,a)=>{const n={x:0,y:0};if(t.parents.length>0){const r=st(t.parents);if(r){const o=a.get(r)??n;if(e==="TB"){return o.y+Z}else if(e==="BT"){const e=a.get(t.id)??n;return e.y-Z}else{return o.x+Z}}}else{if(e==="TB"){return X}else if(e==="BT"){const e=a.get(t.id)??n;return e.y-Z}else{return 0}}return 0}),"calculatePosition");var xt=(0,c.K2)(((t,e,r)=>{const a=at==="BT"&&r?e:e+j;const n=at==="TB"||at==="BT"?a:J.get(t.branch)?.pos;const o=at==="TB"||at==="BT"?J.get(t.branch)?.pos:a;if(o===void 0||n===void 0){throw new Error(`Position were undefined for commit ${t.id}`)}return{x:o,y:n,posWithOffset:a}}),"getCommitPosition");var ut=(0,c.K2)(((t,e,r)=>{if(!Y){throw new Error("GitGraph config not found")}const a=t.append("g").attr("class","commit-bullets");const n=t.append("g").attr("class","commit-labels");let o=at==="TB"||at==="BT"?X:0;const s=[...e.keys()];const i=Y?.parallelCommits??false;const m=(0,c.K2)(((t,r)=>{const a=e.get(t)?.seq;const n=e.get(r)?.seq;return a!==void 0&&n!==void 0?a-n:0}),"sortKeys");let d=s.sort(m);if(at==="BT"){if(i){it(d,e,o)}d=d.reverse()}d.forEach((t=>{const s=e.get(t);if(!s){throw new Error(`Commit not found for key ${t}`)}if(i){o=yt(s,at,o,Q)}const c=xt(s,o,i);if(r){const t=$t(s);const e=s.customType??s.type;const r=J.get(s.branch)?.index??0;gt(a,s,c,t,r,e);ft(n,s,c,o);pt(n,s,c,o)}if(at==="TB"||at==="BT"){Q.set(s.id,{x:c.x,y:c.posWithOffset})}else{Q.set(s.id,{x:c.posWithOffset,y:c.y})}o=at==="BT"&&i?o+Z:o+Z+j;if(o>rt){rt=o}}))}),"drawCommits");var bt=(0,c.K2)(((t,e,r,a,n)=>{const o=at==="TB"||at==="BT"?r.x<a.x:r.y<a.y;const s=o?e.branch:t.branch;const i=(0,c.K2)((t=>t.branch===s),"isOnBranchToGetCurve");const m=(0,c.K2)((r=>r.seq>t.seq&&r.seq<e.seq),"isBetweenCommits");return[...n.values()].some((t=>m(t)&&i(t)))}),"shouldRerouteArrow");var wt=(0,c.K2)(((t,e,r=0)=>{const a=t+Math.abs(t-e)/2;if(r>5){return a}const n=et.every((t=>Math.abs(t-a)>=10));if(n){et.push(a);return a}const o=Math.abs(t-e);return wt(t,e-o/5,r+1)}),"findLane");var vt=(0,c.K2)(((t,e,r,a)=>{const n=Q.get(e.id);const o=Q.get(r.id);if(n===void 0||o===void 0){throw new Error(`Commit positions not found for commits ${e.id} and ${r.id}`)}const s=bt(e,r,n,o,a);let c="";let i="";let m=0;let h=0;let l=J.get(r.branch)?.index;if(r.type===d.MERGE&&e.id!==r.parents[0]){l=J.get(e.branch)?.index}let g;if(s){c="A 10 10, 0, 0, 0,";i="A 10 10, 0, 0, 1,";m=10;h=10;const t=n.y<o.y?wt(n.y,o.y):wt(o.y,n.y);const r=n.x<o.x?wt(n.x,o.x):wt(o.x,n.x);if(at==="TB"){if(n.x<o.x){g=`M ${n.x} ${n.y} L ${r-m} ${n.y} ${i} ${r} ${n.y+h} L ${r} ${o.y-m} ${c} ${r+h} ${o.y} L ${o.x} ${o.y}`}else{l=J.get(e.branch)?.index;g=`M ${n.x} ${n.y} L ${r+m} ${n.y} ${c} ${r} ${n.y+h} L ${r} ${o.y-m} ${i} ${r-h} ${o.y} L ${o.x} ${o.y}`}}else if(at==="BT"){if(n.x<o.x){g=`M ${n.x} ${n.y} L ${r-m} ${n.y} ${c} ${r} ${n.y-h} L ${r} ${o.y+m} ${i} ${r+h} ${o.y} L ${o.x} ${o.y}`}else{l=J.get(e.branch)?.index;g=`M ${n.x} ${n.y} L ${r+m} ${n.y} ${i} ${r} ${n.y-h} L ${r} ${o.y+m} ${c} ${r-h} ${o.y} L ${o.x} ${o.y}`}}else{if(n.y<o.y){g=`M ${n.x} ${n.y} L ${n.x} ${t-m} ${c} ${n.x+h} ${t} L ${o.x-m} ${t} ${i} ${o.x} ${t+h} L ${o.x} ${o.y}`}else{l=J.get(e.branch)?.index;g=`M ${n.x} ${n.y} L ${n.x} ${t+m} ${i} ${n.x+h} ${t} L ${o.x-m} ${t} ${c} ${o.x} ${t-h} L ${o.x} ${o.y}`}}}else{c="A 20 20, 0, 0, 0,";i="A 20 20, 0, 0, 1,";m=20;h=20;if(at==="TB"){if(n.x<o.x){if(r.type===d.MERGE&&e.id!==r.parents[0]){g=`M ${n.x} ${n.y} L ${n.x} ${o.y-m} ${c} ${n.x+h} ${o.y} L ${o.x} ${o.y}`}else{g=`M ${n.x} ${n.y} L ${o.x-m} ${n.y} ${i} ${o.x} ${n.y+h} L ${o.x} ${o.y}`}}if(n.x>o.x){c="A 20 20, 0, 0, 0,";i="A 20 20, 0, 0, 1,";m=20;h=20;if(r.type===d.MERGE&&e.id!==r.parents[0]){g=`M ${n.x} ${n.y} L ${n.x} ${o.y-m} ${i} ${n.x-h} ${o.y} L ${o.x} ${o.y}`}else{g=`M ${n.x} ${n.y} L ${o.x+m} ${n.y} ${c} ${o.x} ${n.y+h} L ${o.x} ${o.y}`}}if(n.x===o.x){g=`M ${n.x} ${n.y} L ${o.x} ${o.y}`}}else if(at==="BT"){if(n.x<o.x){if(r.type===d.MERGE&&e.id!==r.parents[0]){g=`M ${n.x} ${n.y} L ${n.x} ${o.y+m} ${i} ${n.x+h} ${o.y} L ${o.x} ${o.y}`}else{g=`M ${n.x} ${n.y} L ${o.x-m} ${n.y} ${c} ${o.x} ${n.y-h} L ${o.x} ${o.y}`}}if(n.x>o.x){c="A 20 20, 0, 0, 0,";i="A 20 20, 0, 0, 1,";m=20;h=20;if(r.type===d.MERGE&&e.id!==r.parents[0]){g=`M ${n.x} ${n.y} L ${n.x} ${o.y+m} ${c} ${n.x-h} ${o.y} L ${o.x} ${o.y}`}else{g=`M ${n.x} ${n.y} L ${o.x-m} ${n.y} ${c} ${o.x} ${n.y-h} L ${o.x} ${o.y}`}}if(n.x===o.x){g=`M ${n.x} ${n.y} L ${o.x} ${o.y}`}}else{if(n.y<o.y){if(r.type===d.MERGE&&e.id!==r.parents[0]){g=`M ${n.x} ${n.y} L ${o.x-m} ${n.y} ${i} ${o.x} ${n.y+h} L ${o.x} ${o.y}`}else{g=`M ${n.x} ${n.y} L ${n.x} ${o.y-m} ${c} ${n.x+h} ${o.y} L ${o.x} ${o.y}`}}if(n.y>o.y){if(r.type===d.MERGE&&e.id!==r.parents[0]){g=`M ${n.x} ${n.y} L ${o.x-m} ${n.y} ${c} ${o.x} ${n.y-h} L ${o.x} ${o.y}`}else{g=`M ${n.x} ${n.y} L ${n.x} ${o.y+m} ${i} ${n.x+h} ${o.y} L ${o.x} ${o.y}`}}if(n.y===o.y){g=`M ${n.x} ${n.y} L ${o.x} ${o.y}`}}}if(g===void 0){throw new Error("Line definition not found")}t.append("path").attr("d",g).attr("class","arrow arrow"+l%V)}),"drawArrow");var Bt=(0,c.K2)(((t,e)=>{const r=t.append("g").attr("class","commit-arrows");[...e.keys()].forEach((t=>{const a=e.get(t);if(a.parents&&a.parents.length>0){a.parents.forEach((t=>{vt(r,e.get(t),a,e)}))}}))}),"drawArrows");var Et=(0,c.K2)(((t,e)=>{const r=t.append("g");e.forEach(((t,e)=>{const a=e%V;const n=J.get(t.name)?.pos;if(n===void 0){throw new Error(`Position not found for branch ${t.name}`)}const o=r.append("line");o.attr("x1",0);o.attr("y1",n);o.attr("x2",rt);o.attr("y2",n);o.attr("class","branch branch"+a);if(at==="TB"){o.attr("y1",X);o.attr("x1",n);o.attr("y2",rt);o.attr("x2",n)}else if(at==="BT"){o.attr("y1",rt);o.attr("x1",n);o.attr("y2",X);o.attr("x2",n)}et.push(n);const s=t.name;const c=ot(s);const i=r.insert("rect");const m=r.insert("g").attr("class","branchLabel");const d=m.insert("g").attr("class","label branch-label"+a);d.node().appendChild(c);const h=c.getBBox();i.attr("class","branchLabelBkg label"+a).attr("rx",4).attr("ry",4).attr("x",-h.width-4-(Y?.rotateCommitLabel===true?30:0)).attr("y",-h.height/2+8).attr("width",h.width+18).attr("height",h.height+4);d.attr("transform","translate("+(-h.width-14-(Y?.rotateCommitLabel===true?30:0))+", "+(n-h.height/2-1)+")");if(at==="TB"){i.attr("x",n-h.width/2-10).attr("y",0);d.attr("transform","translate("+(n-h.width/2-5)+", 0)")}else if(at==="BT"){i.attr("x",n-h.width/2-10).attr("y",rt);d.attr("transform","translate("+(n-h.width/2-5)+", "+rt+")")}else{i.attr("transform","translate(-19, "+(n-h.height/2)+")")}}))}),"drawBranches");var Ct=(0,c.K2)((function(t,e,r,a,n){J.set(t,{pos:e,index:r});e+=50+(n?40:0)+(at==="TB"||at==="BT"?a.width/2:0);return e}),"setBranchPosition");var kt=(0,c.K2)((function(t,e,r,a){nt();c.Rm.debug("in gitgraph renderer",t+"\n","id:",e,r);if(!Y){throw new Error("GitGraph config not found")}const n=Y.rotateCommitLabel??false;const i=a.db;tt=i.getCommits();const d=i.getBranchesAsObjArray();at=i.getDirection();const h=(0,m.Ltv)(`[id="${e}"]`);let l=0;d.forEach(((t,e)=>{const r=ot(t.name);const a=h.append("g");const o=a.insert("g").attr("class","branchLabel");const s=o.insert("g").attr("class","label branch-label");s.node()?.appendChild(r);const c=r.getBBox();l=Ct(t.name,l,e,c,n);s.remove();o.remove();a.remove()}));ut(h,tt,false);if(Y.showBranches){Et(h,d)}Bt(h,tt);ut(h,tt,true);o._K.insertTitle(h,"gitTitleText",Y.titleTopMargin??0,i.getDiagramTitle());(0,s.mj)(void 0,h,Y.diagramPadding,Y.useMaxWidth)}),"draw");var Lt={draw:kt};if(void 0){const{it:t,expect:e,describe:r}=void 0;r("drawText",(()=>{t("should drawText",(()=>{const t=ot("main");e(t).toBeDefined();e(t.children[0].innerHTML).toBe("main")}))}));r("branchPosition",(()=>{const r={x:0,y:0,width:10,height:10,top:0,right:0,bottom:0,left:0,toJSON:(0,c.K2)((()=>""),"toJSON")};t("should setBranchPositions LR with two branches",(()=>{at="LR";const t=Ct("main",0,0,r,true);e(t).toBe(90);e(J.get("main")).toEqual({pos:0,index:0});const a=Ct("develop",t,1,r,true);e(a).toBe(180);e(J.get("develop")).toEqual({pos:t,index:1})}));t("should setBranchPositions TB with two branches",(()=>{at="TB";r.width=34.9921875;const t=Ct("main",0,0,r,true);e(t).toBe(107.49609375);e(J.get("main")).toEqual({pos:0,index:0});r.width=56.421875;const a=Ct("develop",t,1,r,true);e(a).toBe(225.70703125);e(J.get("develop")).toEqual({pos:t,index:1})}))}));r("commitPosition",(()=>{const a=new Map([["commitZero",{id:"ZERO",message:"",seq:0,type:d.NORMAL,tags:[],parents:[],branch:"main"}],["commitA",{id:"A",message:"",seq:1,type:d.NORMAL,tags:[],parents:["ZERO"],branch:"feature"}],["commitB",{id:"B",message:"",seq:2,type:d.NORMAL,tags:[],parents:["A"],branch:"feature"}],["commitM",{id:"M",message:"merged branch feature into main",seq:3,type:d.MERGE,tags:[],parents:["ZERO","B"],branch:"main",customId:true}],["commitC",{id:"C",message:"",seq:4,type:d.NORMAL,tags:[],parents:["ZERO"],branch:"release"}],["commit5_8928ea0",{id:"5-8928ea0",message:"cherry-picked [object Object] into release",seq:5,type:d.CHERRY_PICK,tags:[],parents:["C","M"],branch:"release"}],["commitD",{id:"D",message:"",seq:6,type:d.NORMAL,tags:[],parents:["5-8928ea0"],branch:"release"}],["commit7_ed848ba",{id:"7-ed848ba",message:"cherry-picked [object Object] into release",seq:7,type:d.CHERRY_PICK,tags:[],parents:["D","M"],branch:"release"}]]);let n=0;J.set("main",{pos:0,index:0});J.set("feature",{pos:107.49609375,index:1});J.set("release",{pos:224.03515625,index:2});r("TB",(()=>{n=30;at="TB";const r=new Map([["commitZero",{x:0,y:40,posWithOffset:40}],["commitA",{x:107.49609375,y:90,posWithOffset:90}],["commitB",{x:107.49609375,y:140,posWithOffset:140}],["commitM",{x:0,y:190,posWithOffset:190}],["commitC",{x:224.03515625,y:240,posWithOffset:240}],["commit5_8928ea0",{x:224.03515625,y:290,posWithOffset:290}],["commitD",{x:224.03515625,y:340,posWithOffset:340}],["commit7_ed848ba",{x:224.03515625,y:390,posWithOffset:390}]]);a.forEach(((a,o)=>{t(`should give the correct position for commit ${o}`,(()=>{const t=xt(a,n,false);e(t).toEqual(r.get(o));n+=50}))}))}));r("LR",(()=>{let r=30;at="LR";const n=new Map([["commitZero",{x:0,y:40,posWithOffset:40}],["commitA",{x:107.49609375,y:90,posWithOffset:90}],["commitB",{x:107.49609375,y:140,posWithOffset:140}],["commitM",{x:0,y:190,posWithOffset:190}],["commitC",{x:224.03515625,y:240,posWithOffset:240}],["commit5_8928ea0",{x:224.03515625,y:290,posWithOffset:290}],["commitD",{x:224.03515625,y:340,posWithOffset:340}],["commit7_ed848ba",{x:224.03515625,y:390,posWithOffset:390}]]);a.forEach(((a,o)=>{t(`should give the correct position for commit ${o}`,(()=>{const t=xt(a,r,false);e(t).toEqual(n.get(o));r+=50}))}))}));r("getCommitClassType",(()=>{const r=new Map([["commitZero","commit-normal"],["commitA","commit-normal"],["commitB","commit-normal"],["commitM","commit-merge"],["commitC","commit-normal"],["commit5_8928ea0","commit-cherry-pick"],["commitD","commit-normal"],["commit7_ed848ba","commit-cherry-pick"]]);a.forEach(((a,n)=>{t(`should give the correct class type for commit ${n}`,(()=>{const t=$t(a);e(t).toBe(r.get(n))}))}))}))}));r("building BT parallel commit diagram",(()=>{const r=new Map([["1-abcdefg",{id:"1-abcdefg",message:"",seq:0,type:0,tags:[],parents:[],branch:"main"}],["2-abcdefg",{id:"2-abcdefg",message:"",seq:1,type:0,tags:[],parents:["1-abcdefg"],branch:"main"}],["3-abcdefg",{id:"3-abcdefg",message:"",seq:2,type:0,tags:[],parents:["2-abcdefg"],branch:"develop"}],["4-abcdefg",{id:"4-abcdefg",message:"",seq:3,type:0,tags:[],parents:["3-abcdefg"],branch:"develop"}],["5-abcdefg",{id:"5-abcdefg",message:"",seq:4,type:0,tags:[],parents:["2-abcdefg"],branch:"feature"}],["6-abcdefg",{id:"6-abcdefg",message:"",seq:5,type:0,tags:[],parents:["5-abcdefg"],branch:"feature"}],["7-abcdefg",{id:"7-abcdefg",message:"",seq:6,type:0,tags:[],parents:["2-abcdefg"],branch:"main"}],["8-abcdefg",{id:"8-abcdefg",message:"",seq:7,type:0,tags:[],parents:["7-abcdefg"],branch:"main"}]]);const a=new Map([["1-abcdefg",{x:0,y:40}],["2-abcdefg",{x:0,y:90}],["3-abcdefg",{x:107.49609375,y:140}],["4-abcdefg",{x:107.49609375,y:190}],["5-abcdefg",{x:225.70703125,y:140}],["6-abcdefg",{x:225.70703125,y:190}],["7-abcdefg",{x:0,y:140}],["8-abcdefg",{x:0,y:190}]]);const n=new Map([["1-abcdefg",{x:0,y:210}],["2-abcdefg",{x:0,y:160}],["3-abcdefg",{x:107.49609375,y:110}],["4-abcdefg",{x:107.49609375,y:60}],["5-abcdefg",{x:225.70703125,y:110}],["6-abcdefg",{x:225.70703125,y:60}],["7-abcdefg",{x:0,y:110}],["8-abcdefg",{x:0,y:60}]]);const o=new Map([["1-abcdefg",30],["2-abcdefg",80],["3-abcdefg",130],["4-abcdefg",180],["5-abcdefg",130],["6-abcdefg",180],["7-abcdefg",130],["8-abcdefg",180]]);const s=[...a.keys()];t("should get the correct commit position and current position",(()=>{at="BT";let t=30;Q.clear();J.clear();J.set("main",{pos:0,index:0});J.set("develop",{pos:107.49609375,index:1});J.set("feature",{pos:225.70703125,index:2});Y.parallelCommits=true;r.forEach(((r,n)=>{if(r.parents.length>0){t=dt(r)}const s=ht(r,t);e(s).toEqual(a.get(n));e(t).toEqual(o.get(n))}))}));t("should get the correct commit position after parallel commits",(()=>{Q.clear();J.clear();at="BT";const t=30;Q.clear();J.clear();J.set("main",{pos:0,index:0});J.set("develop",{pos:107.49609375,index:1});J.set("feature",{pos:225.70703125,index:2});it(s,r,t);s.forEach((t=>{const r=Q.get(t);e(r).toEqual(n.get(t))}))}))}));Y.parallelCommits=false;t("add",(()=>{Q.set("parent1",{x:1,y:1});Q.set("parent2",{x:2,y:2});Q.set("parent3",{x:3,y:3});at="LR";const t=["parent1","parent2","parent3"];const r=st(t);e(r).toBe("parent3");Q.clear()}))}var Tt=(0,c.K2)((t=>`\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 ${[0,1,2,3,4,5,6,7].map((e=>`\n .branch-label${e} { fill: ${t["gitBranchLabel"+e]}; }\n .commit${e} { stroke: ${t["git"+e]}; fill: ${t["git"+e]}; }\n .commit-highlight${e} { stroke: ${t["gitInv"+e]}; fill: ${t["gitInv"+e]}; }\n .label${e} { fill: ${t["git"+e]}; }\n .arrow${e} { stroke: ${t["git"+e]}; }\n `)).join("\n")}\n\n .branch {\n stroke-width: 1;\n stroke: ${t.lineColor};\n stroke-dasharray: 2;\n }\n .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}\n .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }\n .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}\n .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }\n .tag-hole { fill: ${t.textColor}; }\n\n .commit-merge {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n }\n .commit-reverse {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n stroke-width: 3;\n }\n .commit-highlight-outer {\n }\n .commit-highlight-inner {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n }\n\n .arrow { stroke-width: 8; stroke-linecap: round; fill: none}\n .gitTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n`),"getStyles");var Mt=Tt;var Rt={parser:S,db:q,renderer:Lt,styles:Mt}}}]);