import{Y as M,K as L,z as j}from"./layers.BbI5HnBu-5Vt65KiW.js";import{l as c,g as d,d as x,u as B,Y as R,j as E,_ as D,$ as A,a0 as _}from"./layers.BfHNcLbu-DYQJ5yWQ.js";import{m as Y}from"./layers.C7lIplJU-DsQoPZUe.js";import{x as z}from"./layers.BwUxT4Q5-BvCujCUY.js";import"./layers.B6AgvWr7-CmrKHMSF.js";import"./layers.D4fGb2cV-eafouvEC.js";import"./index-n-59FgrC.js";import"./TaskPanel-FSBo9x0f.js";import"./useTaskTypesData-CgG6u01U.js";import"./IconUser-BvK8eLe8.js";import"./tasks-CZQGFm5u.js";import"./get-env-uyVen0u2.js";import"./IconChevronLeft-CyT72r93.js";import"./use-resize-observer-Bh8oaK16.js";import"./SegmentedControl-D05EYfFd.js";import"./SimpleGrid-DzebcIbT.js";import"./get-base-value-JqT_q0U7.js";import"./TypographyStylesProvider-D2Jq4B6Y.js";import"./clamp--03mf-JJ.js";import"./IconSortDescending-DCVZ-bvF.js";import"./IconGripVertical-Ce_4nROx.js";import"./Accordion-DVbX6gPb.js";import"./layers.Dtn3JFPr-C_LOEhfH.js";import"./layers.DUdXdOlx-xExJAWN5.js";import"./layers.DksgtuUk-C_88R6mw.js";import"./layers.CqVTtuYm-C3YJfAyO.js";import"./layers.DLwuMfdd-B0oSrkCJ.js";const k=i=>E.sanitizeText(i,d());let w={dividerMargin:10,padding:5,textHeight:10,curve:void 0};const O=function(i,t,y,n){const e=Object.keys(i);c.info("keys:",e),c.info(i),e.forEach(function(r){var l,s;const o=i[r],a={shape:"rect",id:o.id,domId:o.domId,labelText:k(o.id),labelStyle:"",style:"fill: none; stroke: black",padding:((l=d().flowchart)==null?void 0:l.padding)??((s=d().class)==null?void 0:s.padding)};t.setNode(o.id,a),$(o.classes,t,y,n,o.id),c.info("setNode",a)})},$=function(i,t,y,n,e){const r=Object.keys(i);c.info("keys:",r),c.info(i),r.filter(l=>i[l].parent==e).forEach(function(l){var s,o;const a=i[l],g=a.cssClasses.join(" "),b=D(a.styles),m=a.label??a.id,p=0,f={labelStyle:b.labelStyle,shape:"class_box",labelText:k(m),classData:a,rx:p,ry:p,class:g,style:b.style,id:a.id,domId:a.domId,tooltip:n.db.getTooltip(a.id,e)||"",haveCallback:a.haveCallback,link:a.link,width:a.type==="group"?500:void 0,type:a.type,padding:((s=d().flowchart)==null?void 0:s.padding)??((o=d().class)==null?void 0:o.padding)};t.setNode(a.id,f),e&&t.setParent(a.id,e),c.info("setNode",f)})},q=function(i,t,y,n){c.info(i),i.forEach(function(e,r){var l,s;const o=e,a="",g={labelStyle:"",style:""},b=o.text,m=0,p={labelStyle:g.labelStyle,shape:"note",labelText:k(b),noteData:o,rx:m,ry:m,class:a,style:g.style,id:o.id,domId:o.id,tooltip:"",type:"note",padding:((l=d().flowchart)==null?void 0:l.padding)??((s=d().class)==null?void 0:s.padding)};if(t.setNode(o.id,p),c.info("setNode",p),!o.class||!(o.class in n))return;const f=y+r,h={id:`edgeNote${f}`,classes:"relation",pattern:"dotted",arrowhead:"none",startLabelRight:"",endLabelLeft:"",arrowTypeStart:"none",arrowTypeEnd:"none",style:"fill:none",labelStyle:"",curve:A(w.curve,_)};t.setEdge(o.id,o.class,h,f)})},F=function(i,t){const y=d().flowchart;let n=0;i.forEach(function(e){var r;n++;const l={classes:"relation",pattern:e.relation.lineType==1?"dashed":"solid",id:`id_${e.id1}_${e.id2}_${n}`,arrowhead:e.type==="arrow_open"?"none":"normal",startLabelRight:e.relationTitle1==="none"?"":e.relationTitle1,endLabelLeft:e.relationTitle2==="none"?"":e.relationTitle2,arrowTypeStart:N(e.relation.type1),arrowTypeEnd:N(e.relation.type2),style:"fill:none",labelStyle:"",curve:A(y==null?void 0:y.curve,_)};if(c.info(l,e),e.style!==void 0){const s=D(e.style);l.style=s.style,l.labelStyle=s.labelStyle}e.text=e.title,e.text===void 0?e.style!==void 0&&(l.arrowheadStyle="fill: #333"):(l.arrowheadStyle="fill: #333",l.labelpos="c",((r=d().flowchart)==null?void 0:r.htmlLabels)??d().htmlLabels?(l.labelType="html",l.label='<span class="edgeLabel">'+e.text+"</span>"):(l.labelType="text",l.label=e.text.replace(E.lineBreakRegex,`
`),e.style===void 0&&(l.style=l.style||"stroke: #333; stroke-width: 1.5px;fill:none"),l.labelStyle=l.labelStyle.replace("color:","fill:"))),t.setEdge(e.id1,e.id2,l,n)})},H=function(i){w={...w,...i}},K=async function(i,t,y,n){c.info("Drawing class - ",t);const e=d().flowchart??d().class,r=d().securityLevel;c.info("config:",e);const l=(e==null?void 0:e.nodeSpacing)??50,s=(e==null?void 0:e.rankSpacing)??50,o=new Y({multigraph:!0,compound:!0}).setGraph({rankdir:n.db.getDirection(),nodesep:l,ranksep:s,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),a=n.db.getNamespaces(),g=n.db.getClasses(),b=n.db.getRelations(),m=n.db.getNotes();c.info(b),O(a,o,t,n),$(g,o,t,n),F(b,o),q(m,o,b.length+1,g);let p;r==="sandbox"&&(p=x("#i"+t));const f=r==="sandbox"?x(p.nodes()[0].contentDocument.body):x("body"),h=f.select(`[id="${t}"]`),C=f.select("#"+t+" g");if(await z(C,o,["aggregation","extension","composition","dependency","lollipop"],"classDiagram",t),B.insertTitle(h,"classTitleText",(e==null?void 0:e.titleTopMargin)??5,n.db.getDiagramTitle()),R(o,h,e==null?void 0:e.diagramPadding,e==null?void 0:e.useMaxWidth),!(e!=null&&e.htmlLabels)){const T=r==="sandbox"?p.nodes()[0].contentDocument:document,I=T.querySelectorAll('[id="'+t+'"] .edgeLabel .label');for(const v of I){const S=v.getBBox(),u=T.createElementNS("http://www.w3.org/2000/svg","rect");u.setAttribute("rx",0),u.setAttribute("ry",0),u.setAttribute("width",S.width),u.setAttribute("height",S.height),v.insertBefore(u,v.firstChild)}}};function N(i){let t;switch(i){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}const P={setConf:H,draw:K},ve={parser:j,db:L,renderer:P,styles:M,init:i=>{i.class||(i.class={}),i.class.arrowMarkerAbsolute=i.arrowMarkerAbsolute,L.clear()}};export{ve as diagram};
