import{a as $}from"/vendor/chunk-PUJ34RIG.js";import{a as D}from"/vendor/chunk-U66IPOSN.js";import{a as _}from"/vendor/chunk-F5EEOFFZ.js";import{a as A}from"/vendor/chunk-PWK6AAVM.js";import"/vendor/chunk-SGDNQ7RF.js";import"/vendor/chunk-7FKUSZDD.js";import"/vendor/chunk-U4KMCNBI.js";import"/vendor/chunk-UIFYWUJB.js";import"/vendor/chunk-GVKRJ2RS.js";import"/vendor/chunk-5AMIBS4A.js";import"/vendor/chunk-UD4BHG5Z.js";import"/vendor/chunk-OVRY3LFK.js";import"/vendor/chunk-R4B6XPNC.js";import"/vendor/chunk-VNQL7NYS.js";import"/vendor/chunk-BEN46RUL.js";import{o as u}from"/vendor/chunk-IXALBLWE.js";import"/vendor/chunk-3F3BRHQE.js";import{A as k,N as x,S as C,T as B,U as T,V as y,W as V,X as N,Y as S,q as f}from"/vendor/chunk-VN7363SK.js";import{b as o,d as w}from"/vendor/chunk-6GL7Y2SV.js";import"/vendor/chunk-3XDOZQYC.js";import"/vendor/chunk-Z7XRVN22.js";var l=new $(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),z=o(()=>{l.reset(),C()},"clear"),H=o(()=>l.records.stack[0],"getRoot"),I=o(()=>l.records.cnt,"getCount"),L=f.treeView,R=o(()=>u(L,k().treeView),"getConfig"),W=o((e,t)=>{for(;e<=l.records.stack[l.records.stack.length-1].level;)l.records.stack.pop();let r={id:l.records.cnt++,level:e,name:t,children:[]};l.records.stack[l.records.stack.length-1].children.push(r),l.records.stack.push(r)},"addNode"),E={clear:z,addNode:W,getRoot:H,getCount:I,getConfig:R,getAccTitle:T,getAccDescription:V,getDiagramTitle:S,setAccDescription:y,setAccTitle:B,setDiagramTitle:N},b=E,M=o(e=>{D(e,b),e.nodes.map(t=>b.addNode(t.indent?parseInt(t.indent):0,t.name))},"populate"),F={parse:o(async e=>{let t=await A("treeView",e);w.debug(t),M(t)},"parse")},Y=o((e,t,r,n,s)=>{let c=n.append("text").text(r.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:g,width:a}=c.node().getBBox(),d=g+s.paddingY*2,i=a+s.paddingX*2;c.attr("x",e+s.paddingX),c.attr("y",t+d/2),r.BBox={x:e,y:t,width:i,height:d}},"positionLabel"),X=o((e,t,r,n,s,c)=>e.append("line").attr("x1",t).attr("y1",r).attr("x2",n).attr("y2",s).attr("stroke-width",c).attr("class","treeView-node-line"),"positionLine"),j=o((e,t,r)=>{let n=0,s=0,c=o((a,d,i,h)=>{let m=h*(i.rowIndent+i.paddingX);Y(m,n,d,a,i);let{height:p,width:v}=d.BBox;X(a,m-i.rowIndent,n+p/2,m,n+p/2,i.lineThickness),s=Math.max(s,m+v),n+=p},"drawNode"),g=o((a,d=0)=>{c(e,a,r,d),a.children.forEach(p=>{g(p,d+1)});let{x:i,y:h,height:m}=a.BBox;if(a.children.length){let{y:p,height:v}=a.children[a.children.length-1].BBox;X(e,i+r.paddingX,h+m,i+r.paddingX,p+v/2+r.lineThickness/2,r.lineThickness)}},"processNode");return g(t),{totalHeight:n,totalWidth:s}},"drawTree"),q=o((e,t,r,n)=>{w.debug(`Rendering treeView diagram
`+e);let s=n.db,c=s.getRoot(),g=s.getConfig(),a=_(t),d=a.append("g");d.attr("class","tree-view");let{totalHeight:i,totalWidth:h}=j(d,c,g);a.attr("viewBox",`-${g.lineThickness/2} 0 ${h} ${i}`),x(a,i,h,g.useMaxWidth)},"draw"),G={draw:q},J=G,K={labelFontSize:"16px",labelColor:"black",lineColor:"black"},O=o(({treeView:e})=>{let{labelFontSize:t,labelColor:r,lineColor:n}=u(K,e);return`
    .treeView-node-label {
        font-size: ${t};
        fill: ${r};
    }
    .treeView-node-line {
        stroke: ${n};
    }
    `},"styles"),P=O,oe={db:b,renderer:J,parser:F,styles:P};export{oe as diagram};
