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-LUX5WYVM.min.js";import"./chunk-5FWMXAFW.min.js";import{a as yt,b as H}from"./chunk-CA32PY7O.min.js";import"./chunk-N4EFGQ5G.min.js";import"./chunk-LXB37CFX.min.js";import{a as bt}from"./chunk-RNO6SWHZ.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-K2MRC2FE.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-YEACHCAA.min.js";import{d as it}from"./chunk-XUHMPXWX.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;a0}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;l1&&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 LMath.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.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=>``),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=`${await ct(i.text.replace(/fa[blrs]?:fa-[\w-]+/g,u=>``),U())}`):(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{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-b222e15a-KHGBC5KH.min.js.map