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