termbeam 1.18.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/package.json +4 -1
  2. package/public/assets/{_basePickBy-CVn0rIeA.js → _basePickBy-CPjv_JEU.js} +1 -1
  3. package/public/assets/{_baseUniq-D-ViDZI1.js → _baseUniq-BtieUu_k.js} +1 -1
  4. package/public/assets/{arc-BWX7iih_.js → arc-Op_Jfgj1.js} +1 -1
  5. package/public/assets/architectureDiagram-Q4EWVU46-BPBC-sFg.js +36 -0
  6. package/public/assets/{blockDiagram-WCTKOSBZ-RZQh_7bp.js → blockDiagram-DXYQGD6D-bhrY5jZb.js} +6 -6
  7. package/public/assets/c4Diagram-AHTNJAMY-Bbj59C07.js +10 -0
  8. package/public/assets/channel-BqlgTU2z.js +1 -0
  9. package/public/assets/{chunk-4BX2VUAB-Cz0Sexay.js → chunk-4BX2VUAB-NTfL5dnQ.js} +1 -1
  10. package/public/assets/chunk-4TB4RGXK-DI71V5fB.js +206 -0
  11. package/public/assets/{chunk-55IACEB6-DhjD4VKO.js → chunk-55IACEB6-DErzjt0v.js} +1 -1
  12. package/public/assets/{chunk-KX2RTZJC-BU-NTTwY.js → chunk-EDXVE4YY-D_8mpmH-.js} +1 -1
  13. package/public/assets/{chunk-FMBD7UC4-H_1l13Rz.js → chunk-FMBD7UC4-DxKx7vX-.js} +1 -1
  14. package/public/assets/chunk-OYMX7WX6-DWu1iUFO.js +231 -0
  15. package/public/assets/{chunk-QZHKN3VN-CrSItx1v.js → chunk-QZHKN3VN-Cnf_5dAG.js} +1 -1
  16. package/public/assets/{chunk-JSJVCQXG-D_GdzPQn.js → chunk-YZCP3GAM-mW6tkOzW.js} +1 -1
  17. package/public/assets/classDiagram-6PBFFD2Q-BUz6cVs_.js +1 -0
  18. package/public/assets/classDiagram-v2-HSJHXN6E-BUz6cVs_.js +1 -0
  19. package/public/assets/clone-RMCUsgPf.js +1 -0
  20. package/public/assets/{cose-bilkent-S5V4N54A-BNYNzK1p.js → cose-bilkent-S5V4N54A-913I4PUt.js} +1 -1
  21. package/public/assets/{dagre-KLK3FWXG-CvP5MaIU.js → dagre-KV5264BT-BDwVAKyX.js} +2 -2
  22. package/public/assets/diagram-5BDNPKRD-OcJJ0e9j.js +10 -0
  23. package/public/assets/diagram-G4DWMVQ6-Dm20tH1B.js +24 -0
  24. package/public/assets/diagram-MMDJMWI5-D-cm46Bv.js +43 -0
  25. package/public/assets/{diagram-P4PSJMXO-D7EqFseu.js → diagram-TYMM5635-CbPn6K5D.js} +1 -1
  26. package/public/assets/erDiagram-SMLLAGMA-4AUfKRLi.js +85 -0
  27. package/public/assets/flowDiagram-DWJPFMVM-BJ4qWDVH.js +162 -0
  28. package/public/assets/{ganttDiagram-A5KZAMGK-C55hiPqb.js → ganttDiagram-T4ZO3ILL-_q7m5Uo2.js} +4 -4
  29. package/public/assets/gitGraphDiagram-UUTBAWPF-Ctcn_coL.js +106 -0
  30. package/public/assets/{graph-mq5DkKwp.js → graph-mh6uBCte.js} +1 -1
  31. package/public/assets/index-2RolNYEW.css +32 -0
  32. package/public/assets/index-CuJ2Kdhb.js +447 -0
  33. package/public/assets/{infoDiagram-LFFYTUFH-Cisyfr_w.js → infoDiagram-42DDH7IO-Cbl2ZkB4.js} +1 -1
  34. package/public/assets/{ishikawaDiagram-PHBUUO56-BjaKmPoV.js → ishikawaDiagram-UXIWVN3A-Buq4uztC.js} +2 -2
  35. package/public/assets/journeyDiagram-VCZTEJTY-CLs6SdFG.js +139 -0
  36. package/public/assets/{kanban-definition-K7BYSVSG-D9TVNfL2.js → kanban-definition-6JOO6SKY-CflX5gNH.js} +8 -8
  37. package/public/assets/{layout-DIfi_3Cg.js → layout-e9E0SnY2.js} +1 -1
  38. package/public/assets/{linear-CNFortHj.js → linear-Bue4Zf_D.js} +1 -1
  39. package/public/assets/mindmap-definition-QFDTVHPH-B8iZj3K3.js +96 -0
  40. package/public/assets/pieDiagram-DEJITSTG-B5dciSBP.js +30 -0
  41. package/public/assets/{quadrantDiagram-337W2JSQ-Dcj0avLR.js → quadrantDiagram-34T5L4WZ-CZaQCVxe.js} +1 -1
  42. package/public/assets/requirementDiagram-MS252O5E-2wYKQi_y.js +84 -0
  43. package/public/assets/{sankeyDiagram-WA2Y5GQK-CpT1bDmZ.js → sankeyDiagram-XADWPNL6-CX5Cdm9d.js} +1 -1
  44. package/public/assets/sequenceDiagram-FGHM5R23-BUWxC38t.js +157 -0
  45. package/public/assets/stateDiagram-FHFEXIEX-85EGIrQk.js +1 -0
  46. package/public/assets/stateDiagram-v2-QKLJ7IA2-OKhwT9tv.js +1 -0
  47. package/public/assets/timeline-definition-GMOUNBTQ-C3BtHzdG.js +120 -0
  48. package/public/assets/{vennDiagram-LZ73GAT5-Ci8AKqD1.js → vennDiagram-DHZGUBPP-Chw5is4z.js} +5 -5
  49. package/public/assets/wardley-RL74JXVD-FEtUMcEE.js +162 -0
  50. package/public/assets/wardleyDiagram-NUSXRM2D-C_sFSy0G.js +20 -0
  51. package/public/assets/xychartDiagram-5P7HB3ND-C9Qs21NZ.js +7 -0
  52. package/public/index.html +2 -2
  53. package/public/sw.js +2 -2
  54. package/src/server/index.js +5 -49
  55. package/src/server/routes.js +59 -72
  56. package/src/server/sessions.js +20 -0
  57. package/src/tunnel/index.js +4 -6
  58. package/src/utils/agent-sessions.js +210 -0
  59. package/src/utils/agents.js +116 -0
  60. package/src/utils/update-check.js +19 -0
  61. package/public/assets/architectureDiagram-2XIMDMQ5-Dr3bqfT2.js +0 -36
  62. package/public/assets/c4Diagram-IC4MRINW-BM1jg1mo.js +0 -10
  63. package/public/assets/channel-N7LACYfb.js +0 -1
  64. package/public/assets/chunk-NQ4KR5QH-_X3IQmYu.js +0 -220
  65. package/public/assets/chunk-WL4C6EOR-XtpH4KKr.js +0 -189
  66. package/public/assets/classDiagram-VBA2DB6C-Ct_F3N6M.js +0 -1
  67. package/public/assets/classDiagram-v2-RAHNMMFH-Ct_F3N6M.js +0 -1
  68. package/public/assets/clone-DfaqXUXL.js +0 -1
  69. package/public/assets/diagram-E7M64L7V-C1ypW2kT.js +0 -24
  70. package/public/assets/diagram-IFDJBPK2-CH5mcu6V.js +0 -43
  71. package/public/assets/erDiagram-INFDFZHY-Dc_91GQC.js +0 -70
  72. package/public/assets/flowDiagram-PKNHOUZH-wUw5Mjvb.js +0 -162
  73. package/public/assets/gitGraphDiagram-K3NZZRJ6-D3HBxR11.js +0 -65
  74. package/public/assets/index-BxVq7AYs.js +0 -394
  75. package/public/assets/index-Cpm34cTy.css +0 -32
  76. package/public/assets/journeyDiagram-4ABVD52K-BNP3C6Ph.js +0 -139
  77. package/public/assets/mindmap-definition-YRQLILUH-CfNe7W8X.js +0 -68
  78. package/public/assets/pieDiagram-SKSYHLDU-C3T1FeFD.js +0 -30
  79. package/public/assets/requirementDiagram-Z7DCOOCP-D4yTZU0p.js +0 -73
  80. package/public/assets/sequenceDiagram-2WXFIKYE-CPsVjHHb.js +0 -145
  81. package/public/assets/stateDiagram-RAJIS63D-CbB0QqSa.js +0 -1
  82. package/public/assets/stateDiagram-v2-FVOUBMTO-CQnYvVz1.js +0 -1
  83. package/public/assets/timeline-definition-YZTLITO2-Bi12ioU0.js +0 -61
  84. package/public/assets/treemap-KZPCXAKY-Ct-pligZ.js +0 -162
  85. package/public/assets/xychartDiagram-JWTSCODW-BsOGuDAL.js +0 -7
@@ -1,65 +0,0 @@
1
- import{p as V}from"./chunk-4BX2VUAB-Cz0Sexay.js";import{I as X}from"./chunk-QZHKN3VN-CrSItx1v.js";import{q as J,p as Q,s as Z,g as rr,a as er,b as tr,_ as $,l as m,d as ar,u as sr,D as nr,z as or,k as E,E as cr,F as ir,G as dr,H as hr}from"./index-BxVq7AYs.js";import{p as lr}from"./treemap-KZPCXAKY-Ct-pligZ.js";import"./_baseUniq-D-ViDZI1.js";import"./_basePickBy-CVn0rIeA.js";import"./clone-DfaqXUXL.js";var p={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},$r=ir.gitGraph,q=$(()=>cr({...$r,...dr().gitGraph}),"getConfig"),i=new X(()=>{const t=q(),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 z(){return hr({length:7})}$(z,"getID");function W(t,r){const a=Object.create(null);return t.reduce((n,e)=>{const s=r(e);return a[s]||(a[s]=!0,n.push(e)),n},[])}$(W,"uniqBy");var fr=$(function(t){i.records.direction=t},"setDirection"),yr=$(function(t){m.debug("options str",t),t=t==null?void 0:t.trim(),t=t||"{}";try{i.records.options=JSON.parse(t)}catch(r){m.error("error while parsing gitGraph options",r.message)}},"setOptions"),gr=$(function(){return i.records.options},"getOptions"),xr=$(function(t){let r=t.msg,a=t.id;const n=t.type;let e=t.tags;m.info("commit",r,a,n,e),m.debug("Entering commit:",r,a,n,e);const s=q();a=E.sanitizeText(a,s),r=E.sanitizeText(r,s),e=e==null?void 0:e.map(c=>E.sanitizeText(c,s));const o={id:a||i.records.seq+"-"+z(),message:r,seq:i.records.seq++,type:n??p.NORMAL,tags:e??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=o,m.info("main branch",s.mainBranchName),i.records.commits.has(o.id)&&m.warn(`Commit ID ${o.id} already exists`),i.records.commits.set(o.id,o),i.records.branches.set(i.records.currBranch,o.id),m.debug("in pushCommit "+o.id)},"commit"),ur=$(function(t){let r=t.name;const a=t.order;if(r=E.sanitizeText(r,q()),i.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}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:a}),S(r),m.debug("in createBranch")},"branch"),pr=$(t=>{let r=t.branch,a=t.id;const n=t.type,e=t.tags,s=q();r=E.sanitizeText(r,s),a&&(a=E.sanitizeText(a,s));const o=i.records.branches.get(i.records.currBranch),c=i.records.branches.get(r),d=o?i.records.commits.get(o):void 0,h=c?i.records.commits.get(c):void 0;if(d&&h&&d.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){const l=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw l.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},l}if(d===void 0||!d){const l=new Error(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throw l.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},l}if(!i.records.branches.has(r)){const l=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw l.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},l}if(h===void 0||!h){const l=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw l.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},l}if(d===h){const l=new Error('Incorrect usage of "merge". Both branches have same head');throw l.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},l}if(a&&i.records.commits.has(a)){const l=new Error('Incorrect usage of "merge". Commit with id:'+a+" already exists, use different custom id");throw l.hash={text:`merge ${r} ${a} ${n} ${e==null?void 0:e.join(" ")}`,token:`merge ${r} ${a} ${n} ${e==null?void 0:e.join(" ")}`,expected:[`merge ${r} ${a}_UNIQUE ${n} ${e==null?void 0:e.join(" ")}`]},l}const f=c||"",y={id:a||`${i.records.seq}-${z()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,f],branch:i.records.currBranch,type:p.MERGE,customType:n,customId:!!a,tags:e??[]};i.records.head=y,i.records.commits.set(y.id,y),i.records.branches.set(i.records.currBranch,y.id),m.debug(i.records.branches),m.debug("in mergeBranch")},"merge"),br=$(function(t){let r=t.id,a=t.targetId,n=t.tags,e=t.parent;m.debug("Entering cherryPick:",r,a,n);const s=q();if(r=E.sanitizeText(r,s),a=E.sanitizeText(a,s),n=n==null?void 0:n.map(d=>E.sanitizeText(d,s)),e=E.sanitizeText(e,s),!r||!i.records.commits.has(r)){const d=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw d.hash={text:`cherryPick ${r} ${a}`,token:`cherryPick ${r} ${a}`,expected:["cherry-pick abc"]},d}const o=i.records.commits.get(r);if(o===void 0||!o)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(e&&!(Array.isArray(o.parents)&&o.parents.includes(e)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const c=o.branch;if(o.type===p.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||!i.records.commits.has(a)){if(c===i.records.currBranch){const y=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw y.hash={text:`cherryPick ${r} ${a}`,token:`cherryPick ${r} ${a}`,expected:["cherry-pick abc"]},y}const d=i.records.branches.get(i.records.currBranch);if(d===void 0||!d){const y=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw y.hash={text:`cherryPick ${r} ${a}`,token:`cherryPick ${r} ${a}`,expected:["cherry-pick abc"]},y}const h=i.records.commits.get(d);if(h===void 0||!h){const y=new Error(`Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits`);throw y.hash={text:`cherryPick ${r} ${a}`,token:`cherryPick ${r} ${a}`,expected:["cherry-pick abc"]},y}const f={id:i.records.seq+"-"+z(),message:`cherry-picked ${o==null?void 0:o.message} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,o.id],branch:i.records.currBranch,type:p.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${o.id}${o.type===p.MERGE?`|parent:${e}`:""}`]};i.records.head=f,i.records.commits.set(f.id,f),i.records.branches.set(i.records.currBranch,f.id),m.debug(i.records.branches),m.debug("in cherryPick")}},"cherryPick"),S=$(function(t){if(t=E.sanitizeText(t,q()),i.records.branches.has(t)){i.records.currBranch=t;const r=i.records.branches.get(i.records.currBranch);r===void 0||!r?i.records.head=null:i.records.head=i.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 D(t,r,a){const n=t.indexOf(r);n===-1?t.push(a):t.splice(n,1,a)}$(D,"upsert");function F(t){const r=t.reduce((e,s)=>e.seq>s.seq?e:s,t[0]);let a="";t.forEach(function(e){e===r?a+=" *":a+=" |"});const n=[a,r.id,r.seq];for(const e in i.records.branches)i.records.branches.get(e)===r.id&&n.push(e);if(m.debug(n.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const e=i.records.commits.get(r.parents[0]);D(t,r,e),r.parents[1]&&t.push(i.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const e=i.records.commits.get(r.parents[0]);D(t,r,e)}}t=W(t,e=>e.id),F(t)}$(F,"prettyPrintCommitHistory");var mr=$(function(){m.debug(i.records.commits);const t=j()[0];F([t])},"prettyPrint"),wr=$(function(){i.reset(),or()},"clear"),vr=$(function(){return[...i.records.branchConfig.values()].map((r,a)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${a}`)}).sort((r,a)=>(r.order??0)-(a.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),Cr=$(function(){return i.records.branches},"getBranches"),Er=$(function(){return i.records.commits},"getCommits"),j=$(function(){const t=[...i.records.commits.values()];return t.forEach(function(r){m.debug(r.id)}),t.sort((r,a)=>r.seq-a.seq),t},"getCommitsArray"),Br=$(function(){return i.records.currBranch},"getCurrentBranch"),Tr=$(function(){return i.records.direction},"getDirection"),Lr=$(function(){return i.records.head},"getHead"),Y={commitType:p,getConfig:q,setDirection:fr,setOptions:yr,getOptions:gr,commit:xr,branch:ur,merge:pr,cherryPick:br,checkout:S,prettyPrint:mr,clear:wr,getBranchesAsObjArray:vr,getBranches:Cr,getCommits:Er,getCommitsArray:j,getCurrentBranch:Br,getDirection:Tr,getHead:Lr,setAccTitle:tr,getAccTitle:er,getAccDescription:rr,setAccDescription:Z,setDiagramTitle:Q,getDiagramTitle:J},kr=$((t,r)=>{V(t,r),t.dir&&r.setDirection(t.dir);for(const a of t.statements)Mr(a,r)},"populate"),Mr=$((t,r)=>{const n={Commit:$(e=>r.commit(Ir(e)),"Commit"),Branch:$(e=>r.branch(Rr(e)),"Branch"),Merge:$(e=>r.merge(Gr(e)),"Merge"),Checkout:$(e=>r.checkout(Or(e)),"Checkout"),CherryPicking:$(e=>r.cherryPick(qr(e)),"CherryPicking")}[t.$type];n?n(t):m.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),Ir=$(t=>({id:t.id,msg:t.message??"",type:t.type!==void 0?p[t.type]:p.NORMAL,tags:t.tags??void 0}),"parseCommit"),Rr=$(t=>({name:t.name,order:t.order??0}),"parseBranch"),Gr=$(t=>({branch:t.branch,id:t.id??"",type:t.type!==void 0?p[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),Or=$(t=>t.branch,"parseCheckout"),qr=$(t=>{var a;return{id:t.id,targetId:"",tags:((a=t.tags)==null?void 0:a.length)===0?void 0:t.tags,parent:t.parent}},"parseCherryPicking"),Hr={parse:$(async t=>{const r=await lr("gitGraph",t);m.debug(r),kr(r,Y)},"parse")},I=10,R=40,B=4,L=2,O=8,v=new Map,C=new Map,P=30,H=new Map,_=[],M=0,x="LR",Ar=$(()=>{v.clear(),C.clear(),H.clear(),M=0,_=[],x="LR"},"clear"),K=$(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(n=>{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=n.trim(),r.appendChild(e)}),r},"drawText"),U=$(t=>{let r,a,n;return x==="BT"?(a=$((e,s)=>e<=s,"comparisonFunc"),n=1/0):(a=$((e,s)=>e>=s,"comparisonFunc"),n=0),t.forEach(e=>{var o,c;const s=x==="TB"||x=="BT"?(o=C.get(e))==null?void 0:o.y:(c=C.get(e))==null?void 0:c.x;s!==void 0&&a(s,n)&&(r=e,n=s)}),r},"findClosestParent"),Pr=$(t=>{let r="",a=1/0;return t.forEach(n=>{const e=C.get(n).y;e<=a&&(r=n,a=e)}),r||void 0},"findClosestParentBT"),_r=$((t,r,a)=>{let n=a,e=a;const s=[];t.forEach(o=>{const c=r.get(o);if(!c)throw new Error(`Commit not found for key ${o}`);c.parents.length?(n=Dr(c),e=Math.max(n,e)):s.push(c),Fr(c,n)}),n=e,s.forEach(o=>{Nr(o,n,a)}),t.forEach(o=>{const c=r.get(o);if(c!=null&&c.parents.length){const d=Pr(c.parents);n=C.get(d).y-R,n<=e&&(e=n);const h=v.get(c.branch).pos,f=n-I;C.set(c.id,{x:h,y:f})}})},"setParallelBTPos"),zr=$(t=>{var n;const r=U(t.parents.filter(e=>e!==null));if(!r)throw new Error(`Closest parent not found for commit ${t.id}`);const a=(n=C.get(r))==null?void 0:n.y;if(a===void 0)throw new Error(`Closest parent position not found for commit ${t.id}`);return a},"findClosestParentPos"),Dr=$(t=>zr(t)+R,"calculateCommitPosition"),Fr=$((t,r)=>{const a=v.get(t.branch);if(!a)throw new Error(`Branch not found for commit ${t.id}`);const n=a.pos,e=r+I;return C.set(t.id,{x:n,y:e}),{x:n,y:e}},"setCommitPosition"),Nr=$((t,r,a)=>{const n=v.get(t.branch);if(!n)throw new Error(`Branch not found for commit ${t.id}`);const e=r+a,s=n.pos;C.set(t.id,{x:s,y:e})},"setRootPosition"),Wr=$((t,r,a,n,e,s)=>{if(s===p.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%O} ${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%O} ${n}-inner`);else if(s===p.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 o=t.append("circle");if(o.attr("cx",a.x),o.attr("cy",a.y),o.attr("r",r.type===p.MERGE?9:10),o.attr("class",`commit ${r.id} commit${e%O}`),s===p.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%O}`)}s===p.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%O}`)}},"drawCommitBullet"),Sr=$((t,r,a,n,e)=>{var s;if(r.type!==p.CHERRY_PICK&&(r.customId&&r.type===p.MERGE||r.type!==p.MERGE)&&e.showCommitLabel){const o=t.append("g"),c=o.insert("rect").attr("class","commit-label-bkg"),d=o.append("text").attr("x",n).attr("y",a.y+25).attr("class","commit-label").text(r.id),h=(s=d.node())==null?void 0:s.getBBox();if(h&&(c.attr("x",a.posWithOffset-h.width/2-L).attr("y",a.y+13.5).attr("width",h.width+2*L).attr("height",h.height+2*L),x==="TB"||x==="BT"?(c.attr("x",a.x-(h.width+4*B+5)).attr("y",a.y-12),d.attr("x",a.x-(h.width+4*B)).attr("y",a.y+h.height-12)):d.attr("x",a.posWithOffset-h.width/2),e.rotateCommitLabel))if(x==="TB"||x==="BT")d.attr("transform","rotate(-45, "+a.x+", "+a.y+")"),c.attr("transform","rotate(-45, "+a.x+", "+a.y+")");else{const f=-7.5-(h.width+10)/25*9.5,y=10+h.width/25*8.5;o.attr("transform","translate("+f+", "+y+") rotate(-45, "+n+", "+a.y+")")}}},"drawCommitLabel"),jr=$((t,r,a,n)=>{var e;if(r.tags.length>0){let s=0,o=0,c=0;const d=[];for(const h of r.tags.reverse()){const f=t.insert("polygon"),y=t.append("circle"),l=t.append("text").attr("y",a.y-16-s).attr("class","tag-label").text(h),g=(e=l.node())==null?void 0:e.getBBox();if(!g)throw new Error("Tag bbox not found");o=Math.max(o,g.width),c=Math.max(c,g.height),l.attr("x",a.posWithOffset-g.width/2),d.push({tag:l,hole:y,rect:f,yOffset:s}),s+=20}for(const{tag:h,hole:f,rect:y,yOffset:l}of d){const g=c/2,u=a.y-19.2-l;if(y.attr("class","tag-label-bkg").attr("points",`
2
- ${n-o/2-B/2},${u+L}
3
- ${n-o/2-B/2},${u-L}
4
- ${a.posWithOffset-o/2-B},${u-g-L}
5
- ${a.posWithOffset+o/2+B},${u-g-L}
6
- ${a.posWithOffset+o/2+B},${u+g+L}
7
- ${a.posWithOffset-o/2-B},${u+g+L}`),f.attr("cy",u).attr("cx",n-o/2+B/2).attr("r",1.5).attr("class","tag-hole"),x==="TB"||x==="BT"){const b=n+l;y.attr("class","tag-label-bkg").attr("points",`
8
- ${a.x},${b+2}
9
- ${a.x},${b-2}
10
- ${a.x+I},${b-g-2}
11
- ${a.x+I+o+4},${b-g-2}
12
- ${a.x+I+o+4},${b+g+2}
13
- ${a.x+I},${b+g+2}`).attr("transform","translate(12,12) rotate(45, "+a.x+","+n+")"),f.attr("cx",a.x+B/2).attr("cy",b).attr("transform","translate(12,12) rotate(45, "+a.x+","+n+")"),h.attr("x",a.x+5).attr("y",b+3).attr("transform","translate(14,14) rotate(45, "+a.x+","+n+")")}}}},"drawCommitTags"),Yr=$(t=>{switch(t.customType??t.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"),Kr=$((t,r,a,n)=>{const e={x:0,y:0};if(t.parents.length>0){const s=U(t.parents);if(s){const o=n.get(s)??e;return r==="TB"?o.y+R:r==="BT"?(n.get(t.id)??e).y-R:o.x+R}}else return r==="TB"?P:r==="BT"?(n.get(t.id)??e).y-R:0;return 0},"calculatePosition"),Ur=$((t,r,a)=>{var o,c;const n=x==="BT"&&a?r:r+I,e=x==="TB"||x==="BT"?n:(o=v.get(t.branch))==null?void 0:o.pos,s=x==="TB"||x==="BT"?(c=v.get(t.branch))==null?void 0:c.pos:n;if(s===void 0||e===void 0)throw new Error(`Position were undefined for commit ${t.id}`);return{x:s,y:e,posWithOffset:n}},"getCommitPosition"),N=$((t,r,a,n)=>{const e=t.append("g").attr("class","commit-bullets"),s=t.append("g").attr("class","commit-labels");let o=x==="TB"||x==="BT"?P:0;const c=[...r.keys()],d=n.parallelCommits??!1,h=$((y,l)=>{var b,T;const g=(b=r.get(y))==null?void 0:b.seq,u=(T=r.get(l))==null?void 0:T.seq;return g!==void 0&&u!==void 0?g-u:0},"sortKeys");let f=c.sort(h);x==="BT"&&(d&&_r(f,r,o),f=f.reverse()),f.forEach(y=>{var u;const l=r.get(y);if(!l)throw new Error(`Commit not found for key ${y}`);d&&(o=Kr(l,x,o,C));const g=Ur(l,o,d);if(a){const b=Yr(l),T=l.customType??l.type,G=((u=v.get(l.branch))==null?void 0:u.index)??0;Wr(e,l,g,b,G,T),Sr(s,l,g,o,n),jr(s,l,g,o)}x==="TB"||x==="BT"?C.set(l.id,{x:g.x,y:g.posWithOffset}):C.set(l.id,{x:g.posWithOffset,y:g.y}),o=x==="BT"&&d?o+R:o+R+I,o>M&&(M=o)})},"drawCommits"),Vr=$((t,r,a,n,e)=>{const o=(x==="TB"||x==="BT"?a.x<n.x:a.y<n.y)?r.branch:t.branch,c=$(h=>h.branch===o,"isOnBranchToGetCurve"),d=$(h=>h.seq>t.seq&&h.seq<r.seq,"isBetweenCommits");return[...e.values()].some(h=>d(h)&&c(h))},"shouldRerouteArrow"),A=$((t,r,a=0)=>{const n=t+Math.abs(t-r)/2;if(a>5)return n;if(_.every(o=>Math.abs(o-n)>=10))return _.push(n),n;const s=Math.abs(t-r);return A(t,r-s/5,a+1)},"findLane"),Xr=$((t,r,a,n)=>{var g,u,b,T,G;const e=C.get(r.id),s=C.get(a.id);if(e===void 0||s===void 0)throw new Error(`Commit positions not found for commits ${r.id} and ${a.id}`);const o=Vr(r,a,e,s,n);let c="",d="",h=0,f=0,y=(g=v.get(a.branch))==null?void 0:g.index;a.type===p.MERGE&&r.id!==a.parents[0]&&(y=(u=v.get(r.branch))==null?void 0:u.index);let l;if(o){c="A 10 10, 0, 0, 0,",d="A 10 10, 0, 0, 1,",h=10,f=10;const k=e.y<s.y?A(e.y,s.y):A(s.y,e.y),w=e.x<s.x?A(e.x,s.x):A(s.x,e.x);x==="TB"?e.x<s.x?l=`M ${e.x} ${e.y} L ${w-h} ${e.y} ${d} ${w} ${e.y+f} L ${w} ${s.y-h} ${c} ${w+f} ${s.y} L ${s.x} ${s.y}`:(y=(b=v.get(r.branch))==null?void 0:b.index,l=`M ${e.x} ${e.y} L ${w+h} ${e.y} ${c} ${w} ${e.y+f} L ${w} ${s.y-h} ${d} ${w-f} ${s.y} L ${s.x} ${s.y}`):x==="BT"?e.x<s.x?l=`M ${e.x} ${e.y} L ${w-h} ${e.y} ${c} ${w} ${e.y-f} L ${w} ${s.y+h} ${d} ${w+f} ${s.y} L ${s.x} ${s.y}`:(y=(T=v.get(r.branch))==null?void 0:T.index,l=`M ${e.x} ${e.y} L ${w+h} ${e.y} ${d} ${w} ${e.y-f} L ${w} ${s.y+h} ${c} ${w-f} ${s.y} L ${s.x} ${s.y}`):e.y<s.y?l=`M ${e.x} ${e.y} L ${e.x} ${k-h} ${c} ${e.x+f} ${k} L ${s.x-h} ${k} ${d} ${s.x} ${k+f} L ${s.x} ${s.y}`:(y=(G=v.get(r.branch))==null?void 0:G.index,l=`M ${e.x} ${e.y} L ${e.x} ${k+h} ${d} ${e.x+f} ${k} L ${s.x-h} ${k} ${c} ${s.x} ${k-f} L ${s.x} ${s.y}`)}else c="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",h=20,f=20,x==="TB"?(e.x<s.x&&(a.type===p.MERGE&&r.id!==a.parents[0]?l=`M ${e.x} ${e.y} L ${e.x} ${s.y-h} ${c} ${e.x+f} ${s.y} L ${s.x} ${s.y}`:l=`M ${e.x} ${e.y} L ${s.x-h} ${e.y} ${d} ${s.x} ${e.y+f} L ${s.x} ${s.y}`),e.x>s.x&&(c="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",h=20,f=20,a.type===p.MERGE&&r.id!==a.parents[0]?l=`M ${e.x} ${e.y} L ${e.x} ${s.y-h} ${d} ${e.x-f} ${s.y} L ${s.x} ${s.y}`:l=`M ${e.x} ${e.y} L ${s.x+h} ${e.y} ${c} ${s.x} ${e.y+f} L ${s.x} ${s.y}`),e.x===s.x&&(l=`M ${e.x} ${e.y} L ${s.x} ${s.y}`)):x==="BT"?(e.x<s.x&&(a.type===p.MERGE&&r.id!==a.parents[0]?l=`M ${e.x} ${e.y} L ${e.x} ${s.y+h} ${d} ${e.x+f} ${s.y} L ${s.x} ${s.y}`:l=`M ${e.x} ${e.y} L ${s.x-h} ${e.y} ${c} ${s.x} ${e.y-f} L ${s.x} ${s.y}`),e.x>s.x&&(c="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",h=20,f=20,a.type===p.MERGE&&r.id!==a.parents[0]?l=`M ${e.x} ${e.y} L ${e.x} ${s.y+h} ${c} ${e.x-f} ${s.y} L ${s.x} ${s.y}`:l=`M ${e.x} ${e.y} L ${s.x+h} ${e.y} ${d} ${s.x} ${e.y-f} L ${s.x} ${s.y}`),e.x===s.x&&(l=`M ${e.x} ${e.y} L ${s.x} ${s.y}`)):(e.y<s.y&&(a.type===p.MERGE&&r.id!==a.parents[0]?l=`M ${e.x} ${e.y} L ${s.x-h} ${e.y} ${d} ${s.x} ${e.y+f} L ${s.x} ${s.y}`:l=`M ${e.x} ${e.y} L ${e.x} ${s.y-h} ${c} ${e.x+f} ${s.y} L ${s.x} ${s.y}`),e.y>s.y&&(a.type===p.MERGE&&r.id!==a.parents[0]?l=`M ${e.x} ${e.y} L ${s.x-h} ${e.y} ${c} ${s.x} ${e.y-f} L ${s.x} ${s.y}`:l=`M ${e.x} ${e.y} L ${e.x} ${s.y+h} ${d} ${e.x+f} ${s.y} L ${s.x} ${s.y}`),e.y===s.y&&(l=`M ${e.x} ${e.y} L ${s.x} ${s.y}`));if(l===void 0)throw new Error("Line definition not found");t.append("path").attr("d",l).attr("class","arrow arrow"+y%O)},"drawArrow"),Jr=$((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(s=>{Xr(a,r.get(s),e,r)})})},"drawArrows"),Qr=$((t,r,a)=>{const n=t.append("g");r.forEach((e,s)=>{var b;const o=s%O,c=(b=v.get(e.name))==null?void 0:b.pos;if(c===void 0)throw new Error(`Position not found for branch ${e.name}`);const d=n.append("line");d.attr("x1",0),d.attr("y1",c),d.attr("x2",M),d.attr("y2",c),d.attr("class","branch branch"+o),x==="TB"?(d.attr("y1",P),d.attr("x1",c),d.attr("y2",M),d.attr("x2",c)):x==="BT"&&(d.attr("y1",M),d.attr("x1",c),d.attr("y2",P),d.attr("x2",c)),_.push(c);const h=e.name,f=K(h),y=n.insert("rect"),g=n.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+o);g.node().appendChild(f);const u=f.getBBox();y.attr("class","branchLabelBkg label"+o).attr("rx",4).attr("ry",4).attr("x",-u.width-4-(a.rotateCommitLabel===!0?30:0)).attr("y",-u.height/2+8).attr("width",u.width+18).attr("height",u.height+4),g.attr("transform","translate("+(-u.width-14-(a.rotateCommitLabel===!0?30:0))+", "+(c-u.height/2-1)+")"),x==="TB"?(y.attr("x",c-u.width/2-10).attr("y",0),g.attr("transform","translate("+(c-u.width/2-5)+", 0)")):x==="BT"?(y.attr("x",c-u.width/2-10).attr("y",M),g.attr("transform","translate("+(c-u.width/2-5)+", "+M+")")):y.attr("transform","translate(-19, "+(c-u.height/2)+")")})},"drawBranches"),Zr=$(function(t,r,a,n,e){return v.set(t,{pos:r,index:a}),r+=50+(e?40:0)+(x==="TB"||x==="BT"?n.width/2:0),r},"setBranchPosition"),re=$(function(t,r,a,n){Ar(),m.debug("in gitgraph renderer",t+`
14
- `,"id:",r,a);const e=n.db;if(!e.getConfig){m.error("getConfig method is not available on db");return}const s=e.getConfig(),o=s.rotateCommitLabel??!1;H=e.getCommits();const c=e.getBranchesAsObjArray();x=e.getDirection();const d=ar(`[id="${r}"]`);let h=0;c.forEach((f,y)=>{var G;const l=K(f.name),g=d.append("g"),u=g.insert("g").attr("class","branchLabel"),b=u.insert("g").attr("class","label branch-label");(G=b.node())==null||G.appendChild(l);const T=l.getBBox();h=Zr(f.name,h,y,T,o),b.remove(),u.remove(),g.remove()}),N(d,H,!1,s),s.showBranches&&Qr(d,c,s),Jr(d,H),N(d,H,!0,s),sr.insertTitle(d,"gitTitleText",s.titleTopMargin??0,e.getDiagramTitle()),nr(void 0,d,s.diagramPadding,s.useMaxWidth)},"draw"),ee={draw:re},te=$(t=>`
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(r=>`
24
- .branch-label${r} { fill: ${t["gitBranchLabel"+r]}; }
25
- .commit${r} { stroke: ${t["git"+r]}; fill: ${t["git"+r]}; }
26
- .commit-highlight${r} { stroke: ${t["gitInv"+r]}; fill: ${t["gitInv"+r]}; }
27
- .label${r} { fill: ${t["git"+r]}; }
28
- .arrow${r} { stroke: ${t["git"+r]}; }
29
- `).join(`
30
- `)}
31
-
32
- .branch {
33
- stroke-width: 1;
34
- stroke: ${t.lineColor};
35
- stroke-dasharray: 2;
36
- }
37
- .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
38
- .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
39
- .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
40
- .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
41
- .tag-hole { fill: ${t.textColor}; }
42
-
43
- .commit-merge {
44
- stroke: ${t.primaryColor};
45
- fill: ${t.primaryColor};
46
- }
47
- .commit-reverse {
48
- stroke: ${t.primaryColor};
49
- fill: ${t.primaryColor};
50
- stroke-width: 3;
51
- }
52
- .commit-highlight-outer {
53
- }
54
- .commit-highlight-inner {
55
- stroke: ${t.primaryColor};
56
- fill: ${t.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: ${t.textColor};
64
- }
65
- `,"getStyles"),ae=te,le={parser:Hr,db:Y,renderer:ee,styles:ae};export{le as diagram};