import{o as e}from"./rolldown-runtime-Bhmf7a9N.js";import"./lucide-7srpeIMw.js";import{C as t,L as n,R as r,Rt as i,T as a,_ as o,b as s,hn as c,mn as l,s as u,un as d}from"./mermaid-7ea9cbd6-DmivzQ7-.js";import{t as f}from"./graphlib-B7zpM-Rl.js";import"./dagre-GVwvKV-L.js";import{n as p,r as m,t as h}from"./styles-b4e223ce-DbaZhm9A.js";import{t as g}from"./index-5325376f-B7yS05tn.js";e(c(),1),l();var _=e=>u.sanitizeText(e,o()),v={dividerMargin:10,padding:5,textHeight:10,curve:void 0},y=function(e,t,n,r){let i=Object.keys(e);a.info(`keys:`,i),a.info(e),i.forEach(function(i){let s=e[i],c={shape:`rect`,id:s.id,domId:s.domId,labelText:_(s.id),labelStyle:``,style:`fill: none; stroke: black`,padding:o().flowchart?.padding??o().class?.padding};t.setNode(s.id,c),b(s.classes,t,n,r,s.id),a.info(`setNode`,c)})},b=function(e,t,n,r,i){let c=Object.keys(e);a.info(`keys:`,c),a.info(e),c.filter(t=>e[t].parent==i).forEach(function(n){let c=e[n],l=c.cssClasses.join(` `),u=s(c.styles),d=c.label??c.id,f={labelStyle:u.labelStyle,shape:`class_box`,labelText:_(d),classData:c,rx:0,ry:0,class:l,style:u.style,id:c.id,domId:c.domId,tooltip:r.db.getTooltip(c.id,i)||``,haveCallback:c.haveCallback,link:c.link,width:c.type===`group`?500:void 0,type:c.type,padding:o().flowchart?.padding??o().class?.padding};t.setNode(c.id,f),i&&t.setParent(c.id,i),a.info(`setNode`,f)})},x=function(e,n,r,s){a.info(e),e.forEach(function(e,c){let l=e,u={labelStyle:``,style:``},d=l.text,f={labelStyle:u.labelStyle,shape:`note`,labelText:_(d),noteData:l,rx:0,ry:0,class:``,style:u.style,id:l.id,domId:l.id,tooltip:``,type:`note`,padding:o().flowchart?.padding??o().class?.padding};if(n.setNode(l.id,f),a.info(`setNode`,f),!l.class||!(l.class in s))return;let p=r+c,m={id:`edgeNote${p}`,classes:`relation`,pattern:`dotted`,arrowhead:`none`,startLabelRight:``,endLabelLeft:``,arrowTypeStart:`none`,arrowTypeEnd:`none`,style:`fill:none`,labelStyle:``,curve:t(v.curve,i)};n.setEdge(l.id,l.class,m,p)})},S=function(e,n){let r=o().flowchart,c=0;e.forEach(function(e){c++;let l={classes:`relation`,pattern:e.relation.lineType==1?`dashed`:`solid`,id:`id_${e.id1}_${e.id2}_${c}`,arrowhead:e.type===`arrow_open`?`none`:`normal`,startLabelRight:e.relationTitle1===`none`?``:e.relationTitle1,endLabelLeft:e.relationTitle2===`none`?``:e.relationTitle2,arrowTypeStart:T(e.relation.type1),arrowTypeEnd:T(e.relation.type2),style:`fill:none`,labelStyle:``,curve:t(r?.curve,i)};if(a.info(l,e),e.style!==void 0){let t=s(e.style);l.style=t.style,l.labelStyle=t.labelStyle}e.text=e.title,e.text===void 0?e.style!==void 0&&(l.arrowheadStyle=`fill: #333`):(l.arrowheadStyle=`fill: #333`,l.labelpos=`c`,o().flowchart?.htmlLabels??o().htmlLabels?(l.labelType=`html`,l.label=`<span class="edgeLabel">`+e.text+`</span>`):(l.labelType=`text`,l.label=e.text.replace(u.lineBreakRegex,`
`),e.style===void 0&&(l.style=l.style||`stroke: #333; stroke-width: 1.5px;fill:none`),l.labelStyle=l.labelStyle.replace(`color:`,`fill:`))),n.setEdge(e.id1,e.id2,l,c)})},C=function(e){v={...v,...e}},w=async function(e,t,i,s){a.info(`Drawing class - `,t);let c=o().flowchart??o().class,l=o().securityLevel;a.info(`config:`,c);let u=c?.nodeSpacing??50,p=c?.rankSpacing??50,m=new f({multigraph:!0,compound:!0}).setGraph({rankdir:s.db.getDirection(),nodesep:u,ranksep:p,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),h=s.db.getNamespaces(),_=s.db.getClasses(),v=s.db.getRelations(),C=s.db.getNotes();a.info(v),y(h,m,t,s),b(_,m,t,s),S(v,m),x(C,m,v.length+1,_);let w;l===`sandbox`&&(w=d(`#i`+t));let T=d(l===`sandbox`?w.nodes()[0].contentDocument.body:`body`),E=T.select(`[id="${t}"]`);if(await g(T.select(`#`+t+` g`),m,[`aggregation`,`extension`,`composition`,`dependency`,`lollipop`],`classDiagram`,t),r.insertTitle(E,`classTitleText`,c?.titleTopMargin??5,s.db.getDiagramTitle()),n(m,E,c?.diagramPadding,c?.useMaxWidth),!c?.htmlLabels){let e=l===`sandbox`?w.nodes()[0].contentDocument:document,n=e.querySelectorAll(`[id="`+t+`"] .edgeLabel .label`);for(let t of n){let n=t.getBBox(),r=e.createElementNS(`http://www.w3.org/2000/svg`,`rect`);r.setAttribute(`rx`,0),r.setAttribute(`ry`,0),r.setAttribute(`width`,n.width),r.setAttribute(`height`,n.height),t.insertBefore(r,t.firstChild)}}};function T(e){let t;switch(e){case 0:t=`aggregation`;break;case 1:t=`extension`;break;case 2:t=`composition`;break;case 3:t=`dependency`;break;case 4:t=`lollipop`;break;default:t=`none`}return t}var E={parser:p,db:h,renderer:{setConf:C,draw:w},styles:m,init:e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute,h.clear()}};export{E as diagram};