chunk-LUX5WYVM.min.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import{a as H}from"./chunk-5FWMXAFW.min.js";import{A as F}from"./chunk-K2MRC2FE.min.js";import{F as $,Ga as u,Ja as U,K as V,L as M,Na as A,Oa as B,T as R,Ta as L,Ua as E,ab as j,eb as K,h as _,i as P,ma as q,nb as v}from"./chunk-YEACHCAA.min.js";function ne(e,l){return!!e.children(l).length}function se(e){return I(e.v)+":"+I(e.w)+":"+I(e.name)}var Z=/:/g;function I(e){return e?String(e).replace(Z,"\\:"):""}function W(e,l){l&&e.attr("style",l)}function ie(e,l,c){l&&e.attr("class",l).attr("class",c+" "+e.attr("class"))}function ce(e,l){var c=l.graph();if(q(c)){var a=c.transition;if(R(a))return a(e)}return e}function X(e,l){var c=e.append("foreignObject").attr("width","100000"),a=c.append("xhtml:div");a.attr("xmlns","http://www.w3.org/1999/xhtml");var i=l.label;switch(typeof i){case"function":a.insert(i);break;case"object":a.insert(function(){return i});break;default:a.html(i)}W(a,l.labelStyle),a.style("display","inline-block"),a.style("white-space","nowrap");var d=a.node().getBoundingClientRect();return c.attr("width",d.width).attr("height",d.height),c}var J={},ee=function(e){let l=Object.keys(e);for(let c of l)J[c]=e[c]},Q=async function(e,l,c,a,i,d){let w=a.select(`[id="${c}"]`),n=Object.keys(e);for(let p of n){let r=e[p],y="default";r.classes.length>0&&(y=r.classes.join(" ")),y=y+" flowchart-label";let h=E(r.styles),t=r.text!==void 0?r.text:r.id,s;if(u.info("vertex",r,r.labelType),r.labelType==="markdown")u.info("vertex",r,r.labelType);else if(U(v().flowchart.htmlLabels))s=X(w,{label:t}).node(),s.parentNode.removeChild(s);else{let k=i.createElementNS("http://www.w3.org/2000/svg","text");k.setAttribute("style",h.labelStyle.replace("color:","fill:"));let C=t.split(B.lineBreakRegex);for(let N of C){let S=i.createElementNS("http://www.w3.org/2000/svg","tspan");S.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),S.setAttribute("dy","1em"),S.setAttribute("x","1"),S.textContent=N,k.appendChild(S)}s=k}let b=0,o="";switch(r.type){case"round":b=5,o="rect";break;case"square":o="rect";break;case"diamond":o="question";break;case"hexagon":o="hexagon";break;case"odd":o="rect_left_inv_arrow";break;case"lean_right":o="lean_right";break;case"lean_left":o="lean_left";break;case"trapezoid":o="trapezoid";break;case"inv_trapezoid":o="inv_trapezoid";break;case"odd_right":o="rect_left_inv_arrow";break;case"circle":o="circle";break;case"ellipse":o="ellipse";break;case"stadium":o="stadium";break;case"subroutine":o="subroutine";break;case"cylinder":o="cylinder";break;case"group":o="rect";break;case"doublecircle":o="doublecircle";break;default:o="rect"}let T=await A(t,v());l.setNode(r.id,{labelStyle:h.labelStyle,shape:o,labelText:T,labelType:r.labelType,rx:b,ry:b,class:y,style:h.style,id:r.id,link:r.link,linkTarget:r.linkTarget,tooltip:d.db.getTooltip(r.id)||"",domId:d.db.lookUpDomId(r.id),haveCallback:r.haveCallback,width:r.type==="group"?500:void 0,dir:r.dir,type:r.type,props:r.props,padding:v().flowchart.padding}),u.info("setNode",{labelStyle:h.labelStyle,labelType:r.labelType,shape:o,labelText:T,rx:b,ry:b,class:y,style:h.style,id:r.id,domId:d.db.lookUpDomId(r.id),width:r.type==="group"?500:void 0,type:r.type,dir:r.dir,props:r.props,padding:v().flowchart.padding})}},Y=async function(e,l,c){u.info("abc78 edges = ",e);let a=0,i={},d,w;if(e.defaultStyle!==void 0){let n=E(e.defaultStyle);d=n.style,w=n.labelStyle}for(let n of e){a++;let p="L-"+n.start+"-"+n.end;i[p]===void 0?(i[p]=0,u.info("abc78 new entry",p,i[p])):(i[p]++,u.info("abc78 new entry",p,i[p]));let r=p+"-"+i[p];u.info("abc78 new link id to be used is",p,r,i[p]);let y="LS-"+n.start,h="LE-"+n.end,t={style:"",labelStyle:""};switch(t.minlen=n.length||1,n.type==="arrow_open"?t.arrowhead="none":t.arrowhead="normal",t.arrowTypeStart="arrow_open",t.arrowTypeEnd="arrow_open",n.type){case"double_arrow_cross":t.arrowTypeStart="arrow_cross";case"arrow_cross":t.arrowTypeEnd="arrow_cross";break;case"double_arrow_point":t.arrowTypeStart="arrow_point";case"arrow_point":t.arrowTypeEnd="arrow_point";break;case"double_arrow_circle":t.arrowTypeStart="arrow_circle";case"arrow_circle":t.arrowTypeEnd="arrow_circle";break}let s="",b="";switch(n.stroke){case"normal":s="fill:none;",d!==void 0&&(s=d),w!==void 0&&(b=w),t.thickness="normal",t.pattern="solid";break;case"dotted":t.thickness="normal",t.pattern="dotted",t.style="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":t.thickness="thick",t.pattern="solid",t.style="stroke-width: 3.5px;fill:none;";break;case"invisible":t.thickness="invisible",t.pattern="solid",t.style="stroke-width: 0;fill:none;";break}if(n.style!==void 0){let o=E(n.style);s=o.style,b=o.labelStyle}t.style=t.style+=s,t.labelStyle=t.labelStyle+=b,n.interpolate!==void 0?t.curve=L(n.interpolate,$):e.defaultInterpolate!==void 0?t.curve=L(e.defaultInterpolate,$):t.curve=L(J.curve,$),n.text===void 0?n.style!==void 0&&(t.arrowheadStyle="fill: #333"):(t.arrowheadStyle="fill: #333",t.labelpos="c"),t.labelType=n.labelType,t.label=await A(n.text.replace(B.lineBreakRegex,`
  2. `),v()),n.style===void 0&&(t.style=t.style||"stroke: #333; stroke-width: 1.5px;fill:none;"),t.labelStyle=t.labelStyle.replace("color:","fill:"),t.id=r,t.classes="flowchart-link "+y+" "+h,l.setEdge(n.start,n.end,t,a)}},te=function(e,l){return l.db.getClasses()},re=async function(e,l,c,a){u.info("Drawing flowchart");let i=a.db.getDirection();i===void 0&&(i="TD");let{securityLevel:d,flowchart:w}=v(),n=w.nodeSpacing||50,p=w.rankSpacing||50,r;d==="sandbox"&&(r=_("#i"+l));let y=d==="sandbox"?_(r.nodes()[0].contentDocument.body):_("body"),h=d==="sandbox"?r.nodes()[0].contentDocument:document,t=new F({multigraph:!0,compound:!0}).setGraph({rankdir:i,nodesep:n,ranksep:p,marginx:0,marginy:0}).setDefaultEdgeLabel(function(){return{}}),s,b=a.db.getSubGraphs();u.info("Subgraphs - ",b);for(let f=b.length-1;f>=0;f--)s=b[f],u.info("Subgraph - ",s),a.db.addVertex(s.id,{text:s.title,type:s.labelType},"group",void 0,s.classes,s.dir);let o=a.db.getVertices(),T=a.db.getEdges();u.info("Edges",T);let k=0;for(k=b.length-1;k>=0;k--){s=b[k],P("cluster").append("text");for(let f=0;f<s.nodes.length;f++)u.info("Setting up subgraphs",s.nodes[f],s.id),t.setParent(s.nodes[f],s.id)}await Q(o,t,l,y,h,a),await Y(T,t);let C=y.select(`[id="${l}"]`),N=y.select("#"+l+" g");if(await H(N,t,["point","circle","cross"],"flowchart",l),j.insertTitle(C,"flowchartTitleText",w.titleTopMargin,a.db.getDiagramTitle()),K(t,C,w.diagramPadding,w.useMaxWidth),a.db.indexNodes("subGraph"+k),!w.htmlLabels){let f=h.querySelectorAll('[id="'+l+'"] .edgeLabel .label');for(let x of f){let m=x.getBBox(),g=h.createElementNS("http://www.w3.org/2000/svg","rect");g.setAttribute("rx",0),g.setAttribute("ry",0),g.setAttribute("width",m.width),g.setAttribute("height",m.height),x.insertBefore(g,x.firstChild)}}Object.keys(o).forEach(function(f){let x=o[f];if(x.link){let m=_("#"+l+' [id="'+f+'"]');if(m){let g=h.createElementNS("http://www.w3.org/2000/svg","a");g.setAttributeNS("http://www.w3.org/2000/svg","class",x.classes.join(" ")),g.setAttributeNS("http://www.w3.org/2000/svg","href",x.link),g.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),d==="sandbox"?g.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):x.linkTarget&&g.setAttributeNS("http://www.w3.org/2000/svg","target",x.linkTarget);let D=m.insert(function(){return g},":first-child"),z=m.select(".label-container");z&&D.append(function(){return z.node()});let G=m.select(".label");G&&D.append(function(){return G.node()})}}})},ge={setConf:ee,addVertices:Q,addEdges:Y,getClasses:te,draw:re},le=(e,l)=>{let c=M,a=c(e,"r"),i=c(e,"g"),d=c(e,"b");return V(a,i,d,l)},ae=e=>`.label {
  3. font-family: ${e.fontFamily};
  4. color: ${e.nodeTextColor||e.textColor};
  5. }
  6. .cluster-label text {
  7. fill: ${e.titleColor};
  8. }
  9. .cluster-label span,p {
  10. color: ${e.titleColor};
  11. }
  12. .label text,span,p {
  13. fill: ${e.nodeTextColor||e.textColor};
  14. color: ${e.nodeTextColor||e.textColor};
  15. }
  16. .node rect,
  17. .node circle,
  18. .node ellipse,
  19. .node polygon,
  20. .node path {
  21. fill: ${e.mainBkg};
  22. stroke: ${e.nodeBorder};
  23. stroke-width: 1px;
  24. }
  25. .flowchart-label text {
  26. text-anchor: middle;
  27. }
  28. // .flowchart-label .text-outer-tspan {
  29. // text-anchor: middle;
  30. // }
  31. // .flowchart-label .text-inner-tspan {
  32. // text-anchor: start;
  33. // }
  34. .node .katex path {
  35. fill: #000;
  36. stroke: #000;
  37. stroke-width: 1px;
  38. }
  39. .node .label {
  40. text-align: center;
  41. }
  42. .node.clickable {
  43. cursor: pointer;
  44. }
  45. .arrowheadPath {
  46. fill: ${e.arrowheadColor};
  47. }
  48. .edgePath .path {
  49. stroke: ${e.lineColor};
  50. stroke-width: 2.0px;
  51. }
  52. .flowchart-link {
  53. stroke: ${e.lineColor};
  54. fill: none;
  55. }
  56. .edgeLabel {
  57. background-color: ${e.edgeLabelBackground};
  58. rect {
  59. opacity: 0.5;
  60. background-color: ${e.edgeLabelBackground};
  61. fill: ${e.edgeLabelBackground};
  62. }
  63. text-align: center;
  64. }
  65. /* For html labels only */
  66. .labelBkg {
  67. background-color: ${le(e.edgeLabelBackground,.5)};
  68. // background-color:
  69. }
  70. .cluster rect {
  71. fill: ${e.clusterBkg};
  72. stroke: ${e.clusterBorder};
  73. stroke-width: 1px;
  74. }
  75. .cluster text {
  76. fill: ${e.titleColor};
  77. }
  78. .cluster span,p {
  79. color: ${e.titleColor};
  80. }
  81. /* .cluster div {
  82. color: ${e.titleColor};
  83. } */
  84. div.mermaidTooltip {
  85. position: absolute;
  86. text-align: center;
  87. max-width: 200px;
  88. padding: 2px;
  89. font-family: ${e.fontFamily};
  90. font-size: 12px;
  91. background: ${e.tertiaryColor};
  92. border: 1px solid ${e.border2};
  93. border-radius: 2px;
  94. pointer-events: none;
  95. z-index: 100;
  96. }
  97. .flowchartTitleText {
  98. text-anchor: middle;
  99. font-size: 18px;
  100. fill: ${e.textColor};
  101. }
  102. `,ye=ae;export{ne as a,se as b,W as c,ie as d,ce as e,X as f,ge as g,ye as h};
  103. //# sourceMappingURL=chunk-LUX5WYVM.min.js.map