import{Y as M,K as L,z as j}from"./layers.BbI5HnBu-DqsNBB6u.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-DoBpzOGI.js";import{m as Y}from"./layers.C7lIplJU-DZsL1XrW.js";import{x as z}from"./layers.BwUxT4Q5-DBD_8f9x.js";import"./layers.B6AgvWr7-Bq9IA4iY.js";import"./layers.D4fGb2cV-B5XFCW96.js";import"./index-DTC0Ed21.js";import"./TaskPanel-DL-lNNa-.js";import"./tasks-ClycqzjK.js";import"./IconUser-Bh9n--nN.js";import"./tasks-R9G1-k7v.js";import"./IconChevronLeft-DwnMQlxZ.js";import"./use-resize-observer-B2T5TxF-.js";import"./useTaskTypesData-DEDxUwkB.js";import"./PillsInput-BQBRVlfT.js";import"./SegmentedControl-CI2D3wRP.js";import"./get-base-value-JqT_q0U7.js";import"./ColorSwatch-DyLoUEeW.js";import"./TypographyStylesProvider-B4wTcLh8.js";import"./clamp-Bw9v46PI.js";import"./IconGripVertical-A4WphpSm.js";import"./Accordion-BmslGzqa.js";import"./layers.Dtn3JFPr-Cp4Fd7tq.js";import"./layers.DUdXdOlx-DkXuWGBn.js";import"./layers.DksgtuUk-g5u_Khqt.js";import"./layers.CqVTtuYm-C3YJfAyO.js";import"./layers.DLwuMfdd-B0oSrkCJ.js";import"./_flatRest-IJQXWsZt.js";import"./uniqueId-BjBDjfz6.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],m=a.cssClasses.join(" "),b=D(a.styles),g=a.label??a.id,p=0,f={labelStyle:b.labelStyle,shape:"class_box",labelText:k(g),classData:a,rx:p,ry:p,class:m,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="",m={labelStyle:"",style:""},b=o.text,g=0,p={labelStyle:m.labelStyle,shape:"note",labelText:k(b),noteData:o,rx:g,ry:g,class:a,style:m.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(),m=n.db.getClasses(),b=n.db.getRelations(),g=n.db.getNotes();c.info(b),O(a,o,t,n),$(m,o,t,n),F(b,o),q(g,o,b.length+1,m);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},we={parser:j,db:L,renderer:P,styles:M,init:i=>{i.class||(i.class={}),i.class.arrowMarkerAbsolute=i.arrowMarkerAbsolute,L.clear()}};export{we as diagram};
