3 lines
4.8 KiB
JavaScript
Executable file
3 lines
4.8 KiB
JavaScript
Executable file
import{a as R,b as T,c as $}from"./chunk-QRBMAIWT.min.js";import{a as M}from"./chunk-5FWMXAFW.min.js";import"./chunk-N4EFGQ5G.min.js";import"./chunk-LXB37CFX.min.js";import"./chunk-RNO6SWHZ.min.js";import{A as I}from"./chunk-K2MRC2FE.min.js";import{F as S,Ga as d,J as V,Oa as L,Ta as _,Ua as N,ab as B,b as F,c as H,eb as G,h as g,nb as i}from"./chunk-YEACHCAA.min.js";import{d as k}from"./chunk-XUHMPXWX.min.js";var ot=k(F(),1),lt=k(H(),1),st=k(V(),1);var E=s=>L.sanitizeText(s,i()),D={dividerMargin:10,padding:5,textHeight:10,curve:void 0},W=function(s,e,y,a){let t=Object.keys(s);d.info("keys:",t),d.info(s),t.forEach(function(r){var o,c;let l=s[r],p={shape:"rect",id:l.id,domId:l.domId,labelText:E(l.id),labelStyle:"",style:"fill: none; stroke: black",padding:((o=i().flowchart)==null?void 0:o.padding)??((c=i().class)==null?void 0:c.padding)};e.setNode(l.id,p),P(l.classes,e,y,a,l.id),d.info("setNode",p)})},P=function(s,e,y,a,t){let r=Object.keys(s);d.info("keys:",r),d.info(s),r.filter(o=>s[o].parent==t).forEach(function(o){var c,l;let n=s[o],p=n.cssClasses.join(" "),f=N(n.styles),m=n.label??n.id,u=0,b={labelStyle:f.labelStyle,shape:"class_box",labelText:E(m),classData:n,rx:u,ry:u,class:p,style:f.style,id:n.id,domId:n.domId,tooltip:a.db.getTooltip(n.id,t)||"",haveCallback:n.haveCallback,link:n.link,width:n.type==="group"?500:void 0,type:n.type,padding:((c=i().flowchart)==null?void 0:c.padding)??((l=i().class)==null?void 0:l.padding)};e.setNode(n.id,b),t&&e.setParent(n.id,t),d.info("setNode",b)})},J=function(s,e,y,a){d.info(s),s.forEach(function(t,r){var o,c;let l=t,n="",p={labelStyle:"",style:""},f=l.text,m=0,h={labelStyle:p.labelStyle,shape:"note",labelText:E(f),noteData:l,rx:m,ry:m,class:n,style:p.style,id:l.id,domId:l.id,tooltip:"",type:"note",padding:((o=i().flowchart)==null?void 0:o.padding)??((c=i().class)==null?void 0:c.padding)};if(e.setNode(l.id,h),d.info("setNode",h),!l.class||!(l.class in a))return;let b=y+r,x={id:`edgeNote${b}`,classes:"relation",pattern:"dotted",arrowhead:"none",startLabelRight:"",endLabelLeft:"",arrowTypeStart:"none",arrowTypeEnd:"none",style:"fill:none",labelStyle:"",curve:_(D.curve,S)};e.setEdge(l.id,l.class,x,b)})},K=function(s,e){let y=i().flowchart,a=0;s.forEach(function(t){var r;a++;let o={classes:"relation",pattern:t.relation.lineType==1?"dashed":"solid",id:`id_${t.id1}_${t.id2}_${a}`,arrowhead:t.type==="arrow_open"?"none":"normal",startLabelRight:t.relationTitle1==="none"?"":t.relationTitle1,endLabelLeft:t.relationTitle2==="none"?"":t.relationTitle2,arrowTypeStart:z(t.relation.type1),arrowTypeEnd:z(t.relation.type2),style:"fill:none",labelStyle:"",curve:_(y?.curve,S)};if(d.info(o,t),t.style!==void 0){let c=N(t.style);o.style=c.style,o.labelStyle=c.labelStyle}t.text=t.title,t.text===void 0?t.style!==void 0&&(o.arrowheadStyle="fill: #333"):(o.arrowheadStyle="fill: #333",o.labelpos="c",((r=i().flowchart)==null?void 0:r.htmlLabels)??i().htmlLabels?(o.labelType="html",o.label='<span class="edgeLabel">'+t.text+"</span>"):(o.labelType="text",o.label=t.text.replace(L.lineBreakRegex,`
|
|
`),t.style===void 0&&(o.style=o.style||"stroke: #333; stroke-width: 1.5px;fill:none"),o.labelStyle=o.labelStyle.replace("color:","fill:"))),e.setEdge(t.id1,t.id2,o,a)})},Q=function(s){D={...D,...s}},U=async function(s,e,y,a){d.info("Drawing class - ",e);let t=i().flowchart??i().class,r=i().securityLevel;d.info("config:",t);let o=t?.nodeSpacing??50,c=t?.rankSpacing??50,l=new I({multigraph:!0,compound:!0}).setGraph({rankdir:a.db.getDirection(),nodesep:o,ranksep:c,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),n=a.db.getNamespaces(),p=a.db.getClasses(),f=a.db.getRelations(),m=a.db.getNotes();d.info(f),W(n,l,e,a),P(p,l,e,a),K(f,l),J(m,l,f.length+1,p);let u;r==="sandbox"&&(u=g("#i"+e));let h=r==="sandbox"?g(u.nodes()[0].contentDocument.body):g("body"),b=h.select(`[id="${e}"]`),x=h.select("#"+e+" g");if(await M(x,l,["aggregation","extension","composition","dependency","lollipop"],"classDiagram",e),B.insertTitle(b,"classTitleText",t?.titleTopMargin??5,a.db.getDiagramTitle()),G(l,b,t?.diagramPadding,t?.useMaxWidth),!t?.htmlLabels){let C=r==="sandbox"?u.nodes()[0].contentDocument:document,q=C.querySelectorAll('[id="'+e+'"] .edgeLabel .label');for(let w of q){let A=w.getBBox(),v=C.createElementNS("http://www.w3.org/2000/svg","rect");v.setAttribute("rx",0),v.setAttribute("ry",0),v.setAttribute("width",A.width),v.setAttribute("height",A.height),w.insertBefore(v,w.firstChild)}}};function z(s){let e;switch(s){case 0:e="aggregation";break;case 1:e="extension";break;case 2:e="composition";break;case 3:e="dependency";break;case 4:e="lollipop";break;default:e="none"}return e}var X={setConf:Q,draw:U},it={parser:R,db:T,renderer:X,styles:$,init:s=>{s.class||(s.class={}),s.class.arrowMarkerAbsolute=s.arrowMarkerAbsolute,T.clear()}};export{it as diagram};
|
|
//# sourceMappingURL=classDiagram-v2-a2b738ad-P3OHMUUZ.min.js.map
|