import{a as Y,b as X,c as _,d as F,e as b,f as q,g as kt,h as St}from"./chunk-M6B2YTGW.min.js";import"./chunk-FGL6ROQF.min.js";import{a as yt,b as H}from"./chunk-H6P463MX.min.js";import"./chunk-XLUXVQHP.min.js";import"./chunk-EA6H37XC.min.js";import{a as bt}from"./chunk-J3KNRBB7.min.js";import{A as wt,e as R,g as ot,m as w,t as gt,u as vt,y as xt}from"./chunk-6LZA44UA.min.js";import{F as P,G as mt,Ga as G,J as re,Ja as lt,Na as ct,Oa as dt,Ta as Q,Ua as K,b as te,c as ee,eb as _t,h as y,i as ht,k as ft,nb as U}from"./chunk-VMREMWJS.min.js";import{d as it}from"./chunk-P42HNYSU.min.js";var J={normal:ae,vee:ne,undirected:se};function Lt(r){J=r}function ae(r,e,t,n){var a=r.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),s=a.append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");_(s,t[n+"Style"]),t[n+"Class"]&&s.attr("class",t[n+"Class"])}function ne(r,e,t,n){var a=r.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),s=a.append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");_(s,t[n+"Style"]),t[n+"Class"]&&s.attr("class",t[n+"Class"])}function se(r,e,t,n){var a=r.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),s=a.append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");_(s,t[n+"Style"]),t[n+"Class"]&&s.attr("class",t[n+"Class"])}function Tt(r,e){var t=r;return t.node().appendChild(e.label),_(t,e.labelStyle),t}function Et(r,e){for(var t=r.append("text"),n=ie(e.label).split(`
`),a=0;a<n.length;a++)t.append("tspan").attr("xml:space","preserve").attr("dy","1em").attr("x","1").text(n[a]);return _(t,e.labelStyle),t}function ie(r){for(var e="",t=!1,n,a=0;a<r.length;++a)if(n=r[a],t){switch(n){case"n":e+=`
`;break;default:e+=n}t=!1}else n==="\\"?t=!0:e+=n;return e}function W(r,e,t){var n=e.label,a=r.append("g");e.labelType==="svg"?Tt(a,e):typeof n!="string"||e.labelType==="html"?q(a,e):Et(a,e);var s=a.node().getBBox(),i;switch(t){case"top":i=-e.height/2;break;case"bottom":i=e.height/2-s.height;break;default:i=-s.height/2}return a.attr("transform","translate("+-s.width/2+","+i+")"),a}var Z=function(r,e){var t=e.nodes().filter(function(s){return Y(e,s)}),n=r.selectAll("g.cluster").data(t,function(s){return s});b(n.exit(),e).style("opacity",0).remove();var a=n.enter().append("g").attr("class","cluster").attr("id",function(s){var i=e.node(s);return i.id}).style("opacity",0).each(function(s){var i=e.node(s),o=y(this);y(this).append("rect");var c=o.append("g").attr("class","label");W(c,i,i.clusterLabelPos)});return n=n.merge(a),n=b(n,e).style("opacity",1),n.selectAll("rect").each(function(s){var i=e.node(s),o=y(this);_(o,i.style)}),n};function Nt(r){Z=r}var j=function(r,e){var t=r.selectAll("g.edgeLabel").data(e.edges(),function(a){return X(a)}).classed("update",!0);t.exit().remove(),t.enter().append("g").classed("edgeLabel",!0).style("opacity",0),t=r.selectAll("g.edgeLabel"),t.each(function(a){var s=y(this);s.select(".label").remove();var i=e.edge(a),o=W(s,e.edge(a),0).classed("label",!0),c=o.node().getBBox();i.labelId&&o.attr("id",i.labelId),w(i,"width")||(i.width=c.width),w(i,"height")||(i.height=c.height)});var n;return t.exit?n=t.exit():n=t.selectAll(null),b(n,e).style("opacity",0).remove(),t};function Ct(r){j=r}function pt(r,e){return r.intersect(e)}var tt=function(r,e,t){var n=r.selectAll("g.edgePath").data(e.edges(),function(i){return X(i)}).classed("update",!0),a=pe(n,e);ue(n,e);var s=n.merge!==void 0?n.merge(a):n;return b(s,e).style("opacity",1),s.each(function(i){var o=y(this),c=e.edge(i);c.elem=this,c.id&&o.attr("id",c.id),F(o,c.class,(o.classed("update")?"update ":"")+"edgePath")}),s.selectAll("path.path").each(function(i){var o=e.edge(i);o.arrowheadId=xt("arrowhead");var c=y(this).attr("marker-end",function(){return"url("+le(location.href,o.arrowheadId)+")"}).style("fill","none");b(c,e).attr("d",function(d){return ce(e,d)}),_(c,o.style)}),s.selectAll("defs *").remove(),s.selectAll("defs").each(function(i){var o=e.edge(i),c=t[o.arrowhead];c(y(this),o.arrowheadId,o,"arrowhead")}),s};function At(r){tt=r}function le(r,e){var t=r.split("#")[0];return t+"#"+e}function ce(r,e){var t=r.edge(e),n=r.node(e.v),a=r.node(e.w),s=t.points.slice(1,t.points.length-1);return s.unshift(pt(n,s[0])),s.push(pt(a,s[s.length-1])),It(t,s)}function It(r,e){var t=(mt||ft.line)().x(function(n){return n.x}).y(function(n){return n.y});return(t.curve||t.interpolate)(r.curve),t(e)}function de(r){var e=r.getBBox(),t=r.ownerSVGElement.getScreenCTM().inverse().multiply(r.getScreenCTM()).translate(e.width/2,e.height/2);return{x:t.e,y:t.f}}function pe(r,e){var t=r.enter().append("g").attr("class","edgePath").style("opacity",0);return t.append("path").attr("class","path").attr("d",function(n){var a=e.edge(n),s=e.node(n.v).elem,i=vt(a.points.length).map(function(){return de(s)});return It(a,i)}),t.append("defs"),t}function ue(r,e){var t=r.exit();b(t,e).style("opacity",0).remove()}var et=function(r,e,t){var n=e.nodes().filter(function(i){return!Y(e,i)}),a=r.selectAll("g.node").data(n,function(i){return i}).classed("update",!0);a.exit().remove(),a.enter().append("g").attr("class","node").style("opacity",0),a=r.selectAll("g.node"),a.each(function(i){var o=e.node(i),c=y(this);F(c,o.class,(c.classed("update")?"update ":"")+"node"),c.select("g.label").remove();var d=c.append("g").attr("class","label"),l=W(d,o),m=t[o.shape],p=gt(l.node().getBBox(),"width","height");o.elem=this,o.id&&c.attr("id",o.id),o.labelId&&d.attr("id",o.labelId),w(o,"width")&&(p.width=o.width),w(o,"height")&&(p.height=o.height),p.width+=o.paddingLeft+o.paddingRight,p.height+=o.paddingTop+o.paddingBottom,d.attr("transform","translate("+(o.paddingLeft-o.paddingRight)/2+","+(o.paddingTop-o.paddingBottom)/2+")");var u=y(this);u.select(".label-container").remove();var f=m(u,p,o).classed("label-container",!0);_(f,o.style);var v=f.node().getBBox();o.width=v.width,o.height=v.height});var s;return a.exit?s=a.exit():s=a.selectAll(null),b(s,e).style("opacity",0).remove(),a};function Bt(r){et=r}function Mt(r,e){var t=r.filter(function(){return!y(this).classed("update")});function n(a){var s=e.node(a);return"translate("+s.x+","+s.y+")"}t.attr("transform",n),b(r,e).style("opacity",1).attr("transform",n),b(t.selectAll("rect"),e).attr("width",function(a){return e.node(a).width}).attr("height",function(a){return e.node(a).height}).attr("x",function(a){var s=e.node(a);return-s.width/2}).attr("y",function(a){var s=e.node(a);return-s.height/2})}function Dt(r,e){var t=r.filter(function(){return!y(this).classed("update")});function n(a){var s=e.edge(a);return w(s,"x")?"translate("+s.x+","+s.y+")":""}t.attr("transform",n),b(r,e).style("opacity",1).attr("transform",n)}function Pt(r,e){var t=r.filter(function(){return!y(this).classed("update")});function n(a){var s=e.node(a);return"translate("+s.x+","+s.y+")"}t.attr("transform",n),b(r,e).style("opacity",1).attr("transform",n)}function rt(r,e,t,n){var a=r.x,s=r.y,i=a-n.x,o=s-n.y,c=Math.sqrt(e*e*o*o+t*t*i*i),d=Math.abs(e*t*i/c);n.x<a&&(d=-d);var l=Math.abs(e*t*o/c);return n.y<s&&(l=-l),{x:a+d,y:s+l}}function Rt(r,e,t){return rt(r,e,e,t)}function Ut(r,e,t,n){var a,s,i,o,c,d,l,m,p,u,f,v,h,g,L;if(a=e.y-r.y,i=r.x-e.x,c=e.x*r.y-r.x*e.y,p=a*t.x+i*t.y+c,u=a*n.x+i*n.y+c,!(p!==0&&u!==0&&Gt(p,u))&&(s=n.y-t.y,o=t.x-n.x,d=n.x*t.y-t.x*n.y,l=s*r.x+o*r.y+d,m=s*e.x+o*e.y+d,!(l!==0&&m!==0&&Gt(l,m))&&(f=a*o-s*i,f!==0)))return v=Math.abs(f/2),h=i*d-o*c,g=h<0?(h-v)/f:(h+v)/f,h=s*c-a*d,L=h<0?(h-v)/f:(h+v)/f,{x:g,y:L}}function Gt(r,e){return r*e>0}function E(r,e,t){var n=r.x,a=r.y,s=[],i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;e.forEach(function(f){i=Math.min(i,f.x),o=Math.min(o,f.y)});for(var c=n-r.width/2-i,d=a-r.height/2-o,l=0;l<e.length;l++){var m=e[l],p=e[l<e.length-1?l+1:0],u=Ut(r,t,{x:c+m.x,y:d+m.y},{x:c+p.x,y:d+p.y});u&&s.push(u)}return s.length?(s.length>1&&s.sort(function(f,v){var h=f.x-t.x,g=f.y-t.y,L=Math.sqrt(h*h+g*g),M=v.x-t.x,N=v.y-t.y,nt=Math.sqrt(M*M+N*N);return L<nt?-1:L===nt?0:1}),s[0]):(console.log("NO INTERSECTION FOUND, RETURN NODE CENTER",r),r)}function V(r,e){var t=r.x,n=r.y,a=e.x-t,s=e.y-n,i=r.width/2,o=r.height/2,c,d;return Math.abs(s)*i>Math.abs(a)*o?(s<0&&(o=-o),c=s===0?0:o*a/s,d=o):(a<0&&(i=-i),c=i,d=a===0?0:i*s/a),{x:t+c,y:n+d}}var at={rect:ge,ellipse:ve,circle:xe,diamond:we};function Wt(r){at=r}function ge(r,e,t){var n=r.insert("rect",":first-child").attr("rx",t.rx).attr("ry",t.ry).attr("x",-e.width/2).attr("y",-e.height/2).attr("width",e.width).attr("height",e.height);return t.intersect=function(a){return V(t,a)},n}function ve(r,e,t){var n=e.width/2,a=e.height/2,s=r.insert("ellipse",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("rx",n).attr("ry",a);return t.intersect=function(i){return rt(t,n,a,i)},s}function xe(r,e,t){var n=Math.max(e.width,e.height)/2,a=r.insert("circle",":first-child").attr("x",-e.width/2).attr("y",-e.height/2).attr("r",n);return t.intersect=function(s){return Rt(t,n,s)},a}function we(r,e,t){var n=e.width*Math.SQRT2/2,a=e.height*Math.SQRT2/2,s=[{x:0,y:-a},{x:-n,y:0},{x:0,y:a},{x:n,y:0}],i=r.insert("polygon",":first-child").attr("points",s.map(function(o){return o.x+","+o.y}).join(" "));return t.intersect=function(o){return E(t,s,o)},i}function ut(){var r=function(e,t){Se(t);var n=$(e,"output"),a=$(n,"clusters"),s=$(n,"edgePaths"),i=j($(n,"edgeLabels"),t),o=et($(n,"nodes"),t,at);bt(t),Pt(o,t),Dt(i,t),tt(s,t,J);var c=Z(a,t);Mt(c,t),_e(t)};return r.createNodes=function(e){return arguments.length?(Bt(e),r):et},r.createClusters=function(e){return arguments.length?(Nt(e),r):Z},r.createEdgeLabels=function(e){return arguments.length?(Ct(e),r):j},r.createEdgePaths=function(e){return arguments.length?(At(e),r):tt},r.shapes=function(e){return arguments.length?(Wt(e),r):at},r.arrows=function(e){return arguments.length?(Lt(e),r):J},r}var be={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},ke={arrowhead:"normal",curve:P};function Se(r){r.nodes().forEach(function(e){var t=r.node(e);!w(t,"label")&&!r.children(e).length&&(t.label=e),w(t,"paddingX")&&R(t,{paddingLeft:t.paddingX,paddingRight:t.paddingX}),w(t,"paddingY")&&R(t,{paddingTop:t.paddingY,paddingBottom:t.paddingY}),w(t,"padding")&&R(t,{paddingLeft:t.padding,paddingRight:t.padding,paddingTop:t.padding,paddingBottom:t.padding}),R(t,be),ot(["paddingLeft","paddingRight","paddingTop","paddingBottom"],function(n){t[n]=Number(t[n])}),w(t,"width")&&(t._prevWidth=t.width),w(t,"height")&&(t._prevHeight=t.height)}),r.edges().forEach(function(e){var t=r.edge(e);w(t,"label")||(t.label=""),R(t,ke)})}function _e(r){ot(r.nodes(),function(e){var t=r.node(e);w(t,"_prevWidth")?t.width=t._prevWidth:delete t.width,w(t,"_prevHeight")?t.height=t._prevHeight:delete t.height,delete t._prevWidth,delete t._prevHeight})}function $(r,e){var t=r.select("g."+e);return t.empty()&&(t=r.append("g").attr("class",e)),t}var Cr=it(te(),1),Ar=it(ee(),1),Ir=it(re(),1);function Vt(r,e,t){let n=e.width,a=e.height,s=(n+a)*.9,i=[{x:s/2,y:0},{x:s,y:-s/2},{x:s/2,y:-s},{x:0,y:-s/2}],o=A(r,s,s,i);return t.intersect=function(c){return E(t,i,c)},o}function $t(r,e,t){let a=e.height,s=a/4,i=e.width+2*s,o=[{x:s,y:0},{x:i-s,y:0},{x:i,y:-a/2},{x:i-s,y:-a},{x:s,y:-a},{x:0,y:-a/2}],c=A(r,i,a,o);return t.intersect=function(d){return E(t,o,d)},c}function zt(r,e,t){let n=e.width,a=e.height,s=[{x:-a/2,y:0},{x:n,y:0},{x:n,y:-a},{x:-a/2,y:-a},{x:0,y:-a/2}],i=A(r,n,a,s);return t.intersect=function(o){return E(t,s,o)},i}function Ht(r,e,t){let n=e.width,a=e.height,s=[{x:-2*a/6,y:0},{x:n-a/6,y:0},{x:n+2*a/6,y:-a},{x:a/6,y:-a}],i=A(r,n,a,s);return t.intersect=function(o){return E(t,s,o)},i}function Yt(r,e,t){let n=e.width,a=e.height,s=[{x:2*a/6,y:0},{x:n+a/6,y:0},{x:n-2*a/6,y:-a},{x:-a/6,y:-a}],i=A(r,n,a,s);return t.intersect=function(o){return E(t,s,o)},i}function Xt(r,e,t){let n=e.width,a=e.height,s=[{x:-2*a/6,y:0},{x:n+2*a/6,y:0},{x:n-a/6,y:-a},{x:a/6,y:-a}],i=A(r,n,a,s);return t.intersect=function(o){return E(t,s,o)},i}function Ft(r,e,t){let n=e.width,a=e.height,s=[{x:a/6,y:0},{x:n-a/6,y:0},{x:n+2*a/6,y:-a},{x:-2*a/6,y:-a}],i=A(r,n,a,s);return t.intersect=function(o){return E(t,s,o)},i}function qt(r,e,t){let n=e.width,a=e.height,s=[{x:0,y:0},{x:n+a/2,y:0},{x:n,y:-a/2},{x:n+a/2,y:-a},{x:0,y:-a}],i=A(r,n,a,s);return t.intersect=function(o){return E(t,s,o)},i}function Qt(r,e,t){let n=e.height,a=e.width+n/4,s=r.insert("rect",":first-child").attr("rx",n/2).attr("ry",n/2).attr("x",-a/2).attr("y",-n/2).attr("width",a).attr("height",n);return t.intersect=function(i){return V(t,i)},s}function Kt(r,e,t){let n=e.width,a=e.height,s=[{x:0,y:0},{x:n,y:0},{x:n,y:-a},{x:0,y:-a},{x:0,y:0},{x:-8,y:0},{x:n+8,y:0},{x:n+8,y:-a},{x:-8,y:-a},{x:-8,y:0}],i=A(r,n,a,s);return t.intersect=function(o){return E(t,s,o)},i}function Jt(r,e,t){let n=e.width,a=n/2,s=a/(2.5+n/50),i=e.height+s,o="M 0,"+s+" a "+a+","+s+" 0,0,0 "+n+" 0 a "+a+","+s+" 0,0,0 "+-n+" 0 l 0,"+i+" a "+a+","+s+" 0,0,0 "+n+" 0 l 0,"+-i,c=r.attr("label-offset-y",s).insert("path",":first-child").attr("d",o).attr("transform","translate("+-n/2+","+-(i/2+s)+")");return t.intersect=function(d){let l=V(t,d),m=l.x-t.x;if(a!=0&&(Math.abs(m)<t.width/2||Math.abs(m)==t.width/2&&Math.abs(l.y-t.y)>t.height/2-s)){let p=s*s*(1-m*m/(a*a));p!=0&&(p=Math.sqrt(p)),p=s-p,d.y-t.y>0&&(p=-p),l.y+=p}return l},c}function Ee(r){r.shapes().question=Vt,r.shapes().hexagon=$t,r.shapes().stadium=Qt,r.shapes().subroutine=Kt,r.shapes().cylinder=Jt,r.shapes().rect_left_inv_arrow=zt,r.shapes().lean_right=Ht,r.shapes().lean_left=Yt,r.shapes().trapezoid=Xt,r.shapes().inv_trapezoid=Ft,r.shapes().rect_right_inv_arrow=qt}function Ne(r){r({question:Vt}),r({hexagon:$t}),r({stadium:Qt}),r({subroutine:Kt}),r({cylinder:Jt}),r({rect_left_inv_arrow:zt}),r({lean_right:Ht}),r({lean_left:Yt}),r({trapezoid:Xt}),r({inv_trapezoid:Ft}),r({rect_right_inv_arrow:qt})}function A(r,e,t,n){return r.insert("polygon",":first-child").attr("points",n.map(function(a){return a.x+","+a.y}).join(" ")).attr("transform","translate("+-e/2+","+t/2+")")}var Ce={addToRender:Ee,addToRenderV2:Ne},Zt={},Ae=function(r){let e=Object.keys(r);for(let t of e)Zt[t]=r[t]},Ot=async function(r,e,t,n,a,s){let i=n?n.select(`[id="${t}"]`):y(`[id="${t}"]`),o=a||document,c=Object.keys(r);for(let d of c){let l=r[d],m="default";l.classes.length>0&&(m=l.classes.join(" "));let p=K(l.styles),u=l.text!==void 0?l.text:l.id,f;if(lt(U().flowchart.htmlLabels)){let g={label:await ct(u.replace(/fa[blrs]?:fa-[\w-]+/g,L=>`<i class='${L.replace(":"," ")}'></i>`),U())};f=q(i,g).node(),f.parentNode.removeChild(f)}else{let g=o.createElementNS("http://www.w3.org/2000/svg","text");g.setAttribute("style",p.labelStyle.replace("color:","fill:"));let L=u.split(dt.lineBreakRegex);for(let M of L){let N=o.createElementNS("http://www.w3.org/2000/svg","tspan");N.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),N.setAttribute("dy","1em"),N.setAttribute("x","1"),N.textContent=M,g.appendChild(N)}f=g}let v=0,h="";switch(l.type){case"round":v=5,h="rect";break;case"square":h="rect";break;case"diamond":h="question";break;case"hexagon":h="hexagon";break;case"odd":h="rect_left_inv_arrow";break;case"lean_right":h="lean_right";break;case"lean_left":h="lean_left";break;case"trapezoid":h="trapezoid";break;case"inv_trapezoid":h="inv_trapezoid";break;case"odd_right":h="rect_left_inv_arrow";break;case"circle":h="circle";break;case"ellipse":h="ellipse";break;case"stadium":h="stadium";break;case"subroutine":h="subroutine";break;case"cylinder":h="cylinder";break;case"group":h="rect";break;default:h="rect"}G.warn("Adding node",l.id,l.domId),e.setNode(s.db.lookUpDomId(l.id),{labelType:"svg",labelStyle:p.labelStyle,shape:h,label:f,rx:v,ry:v,class:m,style:p.style,id:s.db.lookUpDomId(l.id)})}},jt=async function(r,e,t){let n=0,a,s;if(r.defaultStyle!==void 0){let i=K(r.defaultStyle);a=i.style,s=i.labelStyle}for(let i of r){n++;let o="L-"+i.start+"-"+i.end,c="LS-"+i.start,d="LE-"+i.end,l={};i.type==="arrow_open"?l.arrowhead="none":l.arrowhead="normal";let m="",p="";if(i.style!==void 0){let u=K(i.style);m=u.style,p=u.labelStyle}else switch(i.stroke){case"normal":m="fill:none",a!==void 0&&(m=a),s!==void 0&&(p=s);break;case"dotted":m="fill:none;stroke-width:2px;stroke-dasharray:3;";break;case"thick":m=" stroke-width: 3.5px;fill:none";break}l.style=m,l.labelStyle=p,i.interpolate!==void 0?l.curve=Q(i.interpolate,P):r.defaultInterpolate!==void 0?l.curve=Q(r.defaultInterpolate,P):l.curve=Q(Zt.curve,P),i.text===void 0?i.style!==void 0&&(l.arrowheadStyle="fill: #333"):(l.arrowheadStyle="fill: #333",l.labelpos="c",lt(U().flowchart.htmlLabels)?(l.labelType="html",l.label=`<span id="L-${o}" class="edgeLabel L-${c}' L-${d}" style="${l.labelStyle}">${await ct(i.text.replace(/fa[blrs]?:fa-[\w-]+/g,u=>`<i class='${u.replace(":"," ")}'></i>`),U())}</span>`):(l.labelType="text",l.label=i.text.replace(dt.lineBreakRegex,`
`),i.style===void 0&&(l.style=l.style||"stroke: #333; stroke-width: 1.5px;fill:none"),l.labelStyle=l.labelStyle.replace("color:","fill:"))),l.id=o,l.class=c+" "+d,l.minlen=i.length||1,e.setEdge(t.db.lookUpDomId(i.start),t.db.lookUpDomId(i.end),l,n)}},Ie=function(r,e){return G.info("Extracting classes"),e.db.getClasses()},Be=async function(r,e,t,n){G.info("Drawing flowchart");let{securityLevel:a,flowchart:s}=U(),i;a==="sandbox"&&(i=y("#i"+e));let o=a==="sandbox"?y(i.nodes()[0].contentDocument.body):y("body"),c=a==="sandbox"?i.nodes()[0].contentDocument:document,d=n.db.getDirection();d===void 0&&(d="TD");let l=s.nodeSpacing||50,m=s.rankSpacing||50,p=new wt({multigraph:!0,compound:!0}).setGraph({rankdir:d,nodesep:l,ranksep:m,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),u,f=n.db.getSubGraphs();for(let x=f.length-1;x>=0;x--)u=f[x],n.db.addVertex(u.id,u.title,"group",void 0,u.classes);let v=n.db.getVertices();G.warn("Get vertices",v);let h=n.db.getEdges(),g=0;for(g=f.length-1;g>=0;g--){u=f[g],ht("cluster").append("text");for(let x=0;x<u.nodes.length;x++)G.warn("Setting subgraph",u.nodes[x],n.db.lookUpDomId(u.nodes[x]),n.db.lookUpDomId(u.id)),p.setParent(n.db.lookUpDomId(u.nodes[x]),n.db.lookUpDomId(u.id))}await Ot(v,p,e,o,c,n),await jt(h,p,n);let L=new ut;Ce.addToRender(L),L.arrows().none=function(S,T,k,D){let I=S.append("marker").attr("id",T).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 0 0 L 0 0 z");_(I,k[D+"Style"])},L.arrows().normal=function(S,T){S.append("marker").attr("id",T).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowheadPath").style("stroke-width",1).style("stroke-dasharray","1,0")};let M=o.select(`[id="${e}"]`),N=o.select("#"+e+" g");for(L(N,p),N.selectAll("g.node").attr("title",function(){return n.db.getTooltip(this.id)}),n.db.indexNodes("subGraph"+g),g=0;g<f.length;g++)if(u=f[g],u.title!=="undefined"){let x=c.querySelectorAll("#"+e+' [id="'+n.db.lookUpDomId(u.id)+'"] rect'),S=c.querySelectorAll("#"+e+' [id="'+n.db.lookUpDomId(u.id)+'"]'),T=x[0].x.baseVal.value,k=x[0].y.baseVal.value,D=x[0].width.baseVal.value,I=y(S[0]).select(".label");I.attr("transform",`translate(${T+D/2}, ${k+14})`),I.attr("id",e+"Text");for(let st=0;st<u.classes.length;st++)S[0].classList.add(u.classes[st])}if(!s.htmlLabels){let x=c.querySelectorAll('[id="'+e+'"] .edgeLabel .label');for(let S of x){let T=S.getBBox(),k=c.createElementNS("http://www.w3.org/2000/svg","rect");k.setAttribute("rx",0),k.setAttribute("ry",0),k.setAttribute("width",T.width),k.setAttribute("height",T.height),S.insertBefore(k,S.firstChild)}}_t(p,M,s.diagramPadding,s.useMaxWidth),Object.keys(v).forEach(function(x){let S=v[x];if(S.link){let T=o.select("#"+e+' [id="'+n.db.lookUpDomId(x)+'"]');if(T){let k=c.createElementNS("http://www.w3.org/2000/svg","a");k.setAttributeNS("http://www.w3.org/2000/svg","class",S.classes.join(" ")),k.setAttributeNS("http://www.w3.org/2000/svg","href",S.link),k.setAttributeNS("http://www.w3.org/2000/svg","rel","noopener"),a==="sandbox"?k.setAttributeNS("http://www.w3.org/2000/svg","target","_top"):S.linkTarget&&k.setAttributeNS("http://www.w3.org/2000/svg","target",S.linkTarget);let D=T.insert(function(){return k},":first-child"),z=T.select(".label-container");z&&D.append(function(){return z.node()});let I=T.select(".label");I&&D.append(function(){return I.node()})}}})},Me={setConf:Ae,addVertices:Ot,addEdges:jt,getClasses:Ie,draw:Be},Dr={parser:yt,db:H,renderer:kt,styles:St,init:r=>{r.flowchart||(r.flowchart={}),r.flowchart.arrowMarkerAbsolute=r.arrowMarkerAbsolute,Me.setConf(r.flowchart),H.clear(),H.setGen("gen-1")}};export{Dr as diagram};
//# sourceMappingURL=flowDiagram-5540d9b9-KWVOFSQF.min.js.map
