import{_ as s,q as x,b as f,s as C,t as B,g as T,a as y,H as u,l as k,L as V,e as _,F as N,A as S,I as A}from"./mermaid.core-Bkagz0ng.js";import{p as D}from"./chunk-4BX2VUAB-ON6Q2-BG.js";import{I}from"./chunk-QZHKN3VN-BvTJSM_S.js";import{p as $}from"./wardley-L42UT6IY-B80co7OP.js";import"./index-DCHPAUp3.js";var d=new I(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),H=s(()=>{d.reset(),S()},"clear"),L=s(()=>d.records.stack[0],"getRoot"),X=s(()=>d.records.cnt,"getCount"),z=A.treeView,R=s(()=>u(z,N().treeView),"getConfig"),W=s((e,t)=>{for(;e<=d.records.stack[d.records.stack.length-1].level;)d.records.stack.pop();const a={id:d.records.cnt++,level:e,name:t,children:[]};d.records.stack[d.records.stack.length-1].children.push(a),d.records.stack.push(a)},"addNode"),E={clear:H,addNode:W,getRoot:L,getCount:X,getConfig:R,getAccTitle:y,getAccDescription:T,getDiagramTitle:B,setAccDescription:C,setAccTitle:f,setDiagramTitle:x},m=E,F=s(e=>{D(e,m),e.nodes.map(t=>m.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),M={parse:s(async e=>{const t=await $("treeView",e);k.debug(t),F(t)},"parse")},Y=s((e,t,a,n,o)=>{const c=n.append("text").text(a.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:g,width:r}=c.node().getBBox(),l=g+o.paddingY*2,i=r+o.paddingX*2;c.attr("x",e+o.paddingX),c.attr("y",t+l/2),a.BBox={x:e,y:t,width:i,height:l}},"positionLabel"),b=s((e,t,a,n,o,c)=>e.append("line").attr("x1",t).attr("y1",a).attr("x2",n).attr("y2",o).attr("stroke-width",c).attr("class","treeView-node-line"),"positionLine"),q=s((e,t,a)=>{let n=0,o=0;const c=s((r,l,i,h)=>{const v=h*(i.rowIndent+i.paddingX);Y(v,n,l,r,i);const{height:p,width:w}=l.BBox;b(r,v-i.rowIndent,n+p/2,v,n+p/2,i.lineThickness),o=Math.max(o,v+w),n+=p},"drawNode"),g=s((r,l=0)=>{c(e,r,a,l),r.children.forEach(p=>{g(p,l+1)});const{x:i,y:h,height:v}=r.BBox;if(r.children.length){const{y:p,height:w}=r.children[r.children.length-1].BBox;b(e,i+a.paddingX,h+v,i+a.paddingX,p+w/2+a.lineThickness/2,a.lineThickness)}},"processNode");return g(t),{totalHeight:n,totalWidth:o}},"drawTree"),j=s((e,t,a,n)=>{k.debug(`Rendering treeView diagram
`+e);const o=n.db,c=o.getRoot(),g=o.getConfig(),r=V(t),l=r.append("g");l.attr("class","tree-view");const{totalHeight:i,totalWidth:h}=q(l,c,g);r.attr("viewBox",`-${g.lineThickness/2} 0 ${h} ${i}`),_(r,i,h,g.useMaxWidth)},"draw"),G={draw:j},J=G,K={labelFontSize:"16px",labelColor:"black",lineColor:"black"},O=s(({treeView:e})=>{const{labelFontSize:t,labelColor:a,lineColor:n}=u(K,e);return`
    .treeView-node-label {
        font-size: ${t};
        fill: ${a};
    }
    .treeView-node-line {
        stroke: ${n};
    }
    `},"styles"),P=O,ae={db:m,renderer:J,parser:M,styles:P};export{ae as diagram};
