package.dist.chunks.mermaid.esm.min.chunk-FASC7IG4.mjs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mermaid Show documentation
Show all versions of mermaid Show documentation
Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.
The newest version!
import{a as E}from"./chunk-ZN7TASNU.mjs";import{D as y,E as G,F as x,G as P,H as V,J as B,K as k,L as S,N as yr,P as O,T as A,U as Z,d as N,f as _r,h as Q,i as wr,k as R,n as u,p as I,q as z,s as _,u as br,v as Er,x as q,z as L}from"./chunk-5ZJXQJOJ.mjs";import{O as F,T as Y,z as vr}from"./chunk-6BY5RJGC.mjs";import{a as s}from"./chunk-GTKDMUJJ.mjs";function g(r,e,n,t){var o;do o=A(t);while(r.hasNode(o));return n.dummy=e,r.setNode(o,n),o}s(g,"addDummyNode");function xr(r){var e=new E().setGraph(r.graph());return u(r.nodes(),function(n){e.setNode(n,r.node(n))}),u(r.edges(),function(n){var t=e.edge(n.v,n.w)||{weight:0,minlen:1},o=r.edge(n);e.setEdge(n.v,n.w,{weight:t.weight+o.weight,minlen:Math.max(t.minlen,o.minlen)})}),e}s(xr,"simplify");function X(r){var e=new E({multigraph:r.isMultigraph()}).setGraph(r.graph());return u(r.nodes(),function(n){r.children(n).length||e.setNode(n,r.node(n))}),u(r.edges(),function(n){e.setEdge(n,r.edge(n))}),e}s(X,"asNonCompoundGraph");function $(r,e){var n=r.x,t=r.y,o=e.x-n,a=e.y-t,i=r.width/2,f=r.height/2;if(!o&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var d,c;return Math.abs(a)*i>Math.abs(o)*f?(a<0&&(f=-f),d=f*o/a,c=f):(o<0&&(i=-i),d=i,c=i*a/o),{x:n+d,y:t+c}}s($,"intersectRect");function C(r){var e=_(k(er(r)+1),function(){return[]});return u(r.nodes(),function(n){var t=r.node(n),o=t.rank;y(o)||(e[o][t.order]=n)}),e}s(C,"buildLayerMatrix");function kr(r){var e=P(_(r.nodes(),function(n){return r.node(n).rank}));u(r.nodes(),function(n){var t=r.node(n);q(t,"rank")&&(t.rank-=e)})}s(kr,"normalizeRanks");function gr(r){var e=P(_(r.nodes(),function(a){return r.node(a).rank})),n=[];u(r.nodes(),function(a){var i=r.node(a).rank-e;n[i]||(n[i]=[]),n[i].push(a)});var t=0,o=r.graph().nodeRankFactor;u(n,function(a,i){y(a)&&i%o!==0?--t:t&&u(a,function(f){r.node(f).rank+=t})})}s(gr,"removeEmptyRanks");function rr(r,e,n,t){var o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=t),g(r,"border",o,e)}s(rr,"addBorderNode");function er(r){return x(_(r.nodes(),function(e){var n=r.node(e).rank;if(!y(n))return n}))}s(er,"maxRank");function Nr(r,e){var n={lhs:[],rhs:[]};return u(r,function(t){e(t)?n.lhs.push(t):n.rhs.push(t)}),n}s(Nr,"partition");function Ir(r,e){var n=Q();try{return e()}finally{console.log(r+" time: "+(Q()-n)+"ms")}}s(Ir,"time");function Or(r,e){return e()}s(Or,"notime");function Pr(r){function e(n){var t=r.children(n),o=r.node(n);if(t.length&&u(t,e),Object.prototype.hasOwnProperty.call(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var a=o.minRank,i=o.maxRank+1;a0;--f)if(i=e[f].dequeue(),i){t=t.concat(or(r,e,n,i,!0));break}}}return t}s(be,"doGreedyFAS");function or(r,e,n,t,o){var a=o?[]:void 0;return u(r.inEdges(t.v),function(i){var f=r.edge(i),d=r.node(i.v);o&&a.push({v:i.v,w:i.w}),d.out-=f,ar(e,n,d)}),u(r.outEdges(t.v),function(i){var f=r.edge(i),d=i.w,c=r.node(d);c.in-=f,ar(e,n,c)}),r.removeNode(t.v),a}s(or,"removeNode");function Ee(r,e){var n=new E,t=0,o=0;u(r.nodes(),function(f){n.setNode(f,{v:f,in:0,out:0})}),u(r.edges(),function(f){var d=n.edge(f.v,f.w)||0,c=e(f),h=d+c;n.setEdge(f.v,f.w,h),o=Math.max(o,n.node(f.v).out+=c),t=Math.max(t,n.node(f.w).in+=c)});var a=k(o+t+3).map(function(){return new H}),i=t+1;return u(n.nodes(),function(f){ar(a,i,n.node(f))}),{graph:n,buckets:a,zeroIdx:i}}s(Ee,"buildState");function ar(r,e,n){n.out?n.in?r[n.out-n.in+e].enqueue(n):r[r.length-1].enqueue(n):r[0].enqueue(n)}s(ar,"assignBucket");function Fr(r){var e=r.graph().acyclicer==="greedy"?Mr(r,n(r)):ye(r);u(e,function(t){var o=r.edge(t);r.removeEdge(t),o.forwardName=t.name,o.reversed=!0,r.setEdge(t.w,t.v,o,A("rev"))});function n(t){return function(o){return t.edge(o).weight}}s(n,"weightFn")}s(Fr,"run");function ye(r){var e=[],n={},t={};function o(a){Object.prototype.hasOwnProperty.call(t,a)||(t[a]=!0,n[a]=!0,u(r.outEdges(a),function(i){Object.prototype.hasOwnProperty.call(n,i.w)?e.push(i):o(i.w)}),delete n[a])}return s(o,"dfs"),u(r.nodes(),o),e}s(ye,"dfsFAS");function Gr(r){u(r.edges(),function(e){var n=r.edge(e);if(n.reversed){r.removeEdge(e);var t=n.forwardName;delete n.reversed,delete n.forwardName,r.setEdge(e.w,e.v,n,t)}})}s(Gr,"undo");function Br(r){r.graph().dummyChains=[],u(r.edges(),function(e){xe(r,e)})}s(Br,"run");function xe(r,e){var n=e.v,t=r.node(n).rank,o=e.w,a=r.node(o).rank,i=e.name,f=r.edge(e),d=f.labelRank;if(a!==t+1){r.removeEdge(e);var c=void 0,h,l;for(l=0,++t;ti.lim&&(f=i,d=!0);var c=I(e.edges(),function(h){return d===zr(r,r.node(h.v),f)&&d!==zr(r,r.node(h.w),f)});return V(c,function(h){return M(e,h)})}s(Xr,"enterEdge");function Hr(r,e,n,t){var o=n.v,a=n.w;r.removeEdge(o,a),r.setEdge(t.v,t.w,{}),dr(r),ur(r,e),Te(r,e)}s(Hr,"exchangeEdges");function Te(r,e){var n=z(r.nodes(),function(o){return!e.node(o).parent}),t=fr(r,n);t=t.slice(1),u(t,function(o){var a=r.node(o).parent,i=e.edge(o,a),f=!1;i||(i=e.edge(a,o),f=!0),e.node(o).rank=e.node(a).rank+(f?i.minlen:-i.minlen)})}s(Te,"updateRanks");function je(r,e,n){return r.hasEdge(e,n)}s(je,"isTreeEdge");function zr(r,e,n){return n.low<=e.lim&&e.lim<=n.lim}s(zr,"isDescendant");function cr(r){switch(r.graph().ranker){case"network-simplex":Jr(r);break;case"tight-tree":Se(r);break;case"longest-path":Re(r);break;default:Jr(r)}}s(cr,"rank");var Re=U;function Se(r){U(r),J(r)}s(Se,"tightTreeRanker");function Jr(r){j(r)}s(Jr,"networkSimplexRanker");function Kr(r){var e=g(r,"root",{},"_root"),n=Me(r),t=x(L(n))-1,o=2*t+1;r.graph().nestingRoot=e,u(r.edges(),function(i){r.edge(i).minlen*=o});var a=Fe(r)+1;u(r.children(),function(i){Qr(r,e,o,a,t,n,i)}),r.graph().nodeRankFactor=o}s(Kr,"run");function Qr(r,e,n,t,o,a,i){var f=r.children(i);if(!f.length){i!==e&&r.setEdge(e,i,{weight:0,minlen:n});return}var d=rr(r,"_bt"),c=rr(r,"_bb"),h=r.node(i);r.setParent(d,i),h.borderTop=d,r.setParent(c,i),h.borderBottom=c,u(f,function(l){Qr(r,e,n,t,o,a,l);var p=r.node(l),m=p.borderTop?p.borderTop:l,v=p.borderBottom?p.borderBottom:l,b=p.borderTop?t:2*t,D=m!==v?1:o-a[i]+1;r.setEdge(d,m,{weight:b,minlen:D,nestingEdge:!0}),r.setEdge(v,c,{weight:b,minlen:D,nestingEdge:!0})}),r.parent(i)||r.setEdge(e,d,{weight:0,minlen:o+a[i]})}s(Qr,"dfs");function Me(r){var e={};function n(t,o){var a=r.children(t);a&&a.length&&u(a,function(i){n(i,o+1)}),e[t]=o}return s(n,"dfs"),u(r.children(),function(t){n(t,1)}),e}s(Me,"treeDepths");function Fe(r){return S(r.edges(),function(e,n){return e+r.edge(n).weight},0)}s(Fe,"sumWeights");function Zr(r){var e=r.graph();r.removeNode(e.nestingRoot),delete e.nestingRoot,u(r.edges(),function(n){var t=r.edge(n);t.nestingEdge&&r.removeEdge(n)})}s(Zr,"cleanup");function $r(r,e,n){var t={},o;u(n,function(a){for(var i=r.parent(a),f,d;i;){if(f=r.parent(i),f?(d=t[f],t[f]=i):(d=o,o=i),d&&d!==i){e.setEdge(d,i);return}i=f}})}s($r,"addSubgraphConstraints");function re(r,e,n){var t=Ve(r),o=new E({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(a){return r.node(a)});return u(r.nodes(),function(a){var i=r.node(a),f=r.parent(a);(i.rank===e||i.minRank<=e&&e<=i.maxRank)&&(o.setNode(a),o.setParent(a,f||t),u(r[n](a),function(d){var c=d.v===a?d.w:d.v,h=o.edge(c,a),l=y(h)?0:h.weight;o.setEdge(c,a,{weight:r.edge(d).weight+l})}),Object.prototype.hasOwnProperty.call(i,"minRank")&&o.setNode(a,{borderLeft:i.borderLeft[e],borderRight:i.borderRight[e]}))}),o}s(re,"buildLayerGraph");function Ve(r){for(var e;r.hasNode(e=A("_root")););return e}s(Ve,"createRootNode");function ee(r,e){for(var n=0,t=1;t0;)h%2&&(l+=f[h+1]),h=h-1>>1,f[h]+=c.weight;d+=c.weight*l})),d}s(Be,"twoLayerCrossCount");function ne(r){var e={},n=I(r.nodes(),function(f){return!r.children(f).length}),t=x(_(n,function(f){return r.node(f).rank})),o=_(k(t+1),function(){return[]});function a(f){if(!q(e,f)){e[f]=!0;var d=r.node(f);o[d.rank].push(f),u(r.successors(f),a)}}s(a,"dfs");var i=O(n,function(f){return r.node(f).rank});return u(i,a),o}s(ne,"initOrder");function te(r,e){return _(e,function(n){var t=r.inEdges(n);if(t.length){var o=S(t,function(a,i){var f=r.edge(i),d=r.node(i.v);return{sum:a.sum+f.weight*d.order,weight:a.weight+f.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:n}})}s(te,"barycenter");function oe(r,e){var n={};u(r,function(o,a){var i=n[o.v]={indegree:0,in:[],out:[],vs:[o.v],i:a};y(o.barycenter)||(i.barycenter=o.barycenter,i.weight=o.weight)}),u(e.edges(),function(o){var a=n[o.v],i=n[o.w];!y(a)&&!y(i)&&(i.indegree++,a.out.push(n[o.w]))});var t=I(n,function(o){return!o.indegree});return Ae(t)}s(oe,"resolveConflicts");function Ae(r){var e=[];function n(a){return function(i){i.merged||(y(i.barycenter)||y(a.barycenter)||i.barycenter>=a.barycenter)&&De(a,i)}}s(n,"handleIn");function t(a){return function(i){i.in.push(a),--i.indegree===0&&r.push(i)}}for(s(t,"handleOut");r.length;){var o=r.pop();e.push(o),u(o.in.reverse(),n(o)),u(o.out,t(o))}return _(I(e,function(a){return!a.merged}),function(a){return B(a,["vs","i","barycenter","weight"])})}s(Ae,"doResolveConflicts");function De(r,e){var n=0,t=0;r.weight&&(n+=r.barycenter*r.weight,t+=r.weight),e.weight&&(n+=e.barycenter*e.weight,t+=e.weight),r.vs=e.vs.concat(r.vs),r.barycenter=n/t,r.weight=t,r.i=Math.min(e.i,r.i),e.merged=!0}s(De,"mergeEntries");function ie(r,e){var n=Nr(r,function(h){return Object.prototype.hasOwnProperty.call(h,"barycenter")}),t=n.lhs,o=O(n.rhs,function(h){return-h.i}),a=[],i=0,f=0,d=0;t.sort(Ye(!!e)),d=ae(a,o,d),u(t,function(h){d+=h.vs.length,a.push(h.vs),i+=h.barycenter*h.weight,f+=h.weight,d=ae(a,o,d)});var c={vs:N(a)};return f&&(c.barycenter=i/f,c.weight=f),c}s(ie,"sort");function ae(r,e,n){for(var t;e.length&&(t=R(e)).i<=n;)e.pop(),r.push(t.vs),n++;return n}s(ae,"consumeUnsortable");function Ye(r){return function(e,n){return e.barycentern.barycenter?1:r?n.i-e.i:e.i-n.i}}s(Ye,"compareWithBias");function hr(r,e,n,t){var o=r.children(e),a=r.node(e),i=a?a.borderLeft:void 0,f=a?a.borderRight:void 0,d={};i&&(o=I(o,function(v){return v!==i&&v!==f}));var c=te(r,o);u(c,function(v){if(r.children(v.v).length){var b=hr(r,v.v,n,t);d[v.v]=b,Object.prototype.hasOwnProperty.call(b,"barycenter")&&Ue(v,b)}});var h=oe(c,n);ze(h,d);var l=ie(h,t);if(i&&(l.vs=N([i,l.vs,f]),r.predecessors(i).length)){var p=r.node(r.predecessors(i)[0]),m=r.node(r.predecessors(f)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+p.order+m.order)/(l.weight+2),l.weight+=2}return l}s(hr,"sortSubgraph");function ze(r,e){u(r,function(n){n.vs=N(n.vs.map(function(t){return e[t]?e[t].vs:t}))})}s(ze,"expandSubgraphs");function Ue(r,e){y(r.barycenter)?(r.barycenter=e.barycenter,r.weight=e.weight):(r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight)}s(Ue,"mergeBarycenters");function ue(r){var e=er(r),n=se(r,k(1,e+1),"inEdges"),t=se(r,k(e-1,-1,-1),"outEdges"),o=ne(r);fe(r,o);for(var a=Number.POSITIVE_INFINITY,i,f=0,d=0;d<4;++f,++d){We(f%2?n:t,f%4>=2),o=C(r);var c=ee(r,o);ci||f>e[d].lim));for(c=d,d=t;(d=r.parent(d))!==c;)a.push(d);return{path:o.concat(a.reverse()),lca:c}}s(qe,"findPath");function Xe(r){var e={},n=0;function t(o){var a=n;u(r.children(o),t),e[o]={low:a,lim:n++}}return s(t,"dfs"),u(r.children(),t),e}s(Xe,"postorder");function He(r,e){var n={};function t(o,a){var i=0,f=0,d=o.length,c=R(a);return u(a,function(h,l){var p=Ke(r,h),m=p?r.node(p).order:d;(p||h===c)&&(u(a.slice(f,l+1),function(v){u(r.predecessors(v),function(b){var D=r.node(b),mr=D.order;(mrc)&&ce(n,p,h)})})}s(t,"scan");function o(a,i){var f=-1,d,c=0;return u(i,function(h,l){if(r.node(h).dummy==="border"){var p=r.predecessors(h);p.length&&(d=r.node(p[0]).order,t(i,c,l,f,d),c=l,f=d)}t(i,c,i.length,d,a.length)}),i}return s(o,"visitLayer"),S(e,o),n}s(Je,"findType2Conflicts");function Ke(r,e){if(r.node(e).dummy)return z(r.predecessors(e),function(n){return r.node(n).dummy})}s(Ke,"findOtherInnerSegmentNode");function ce(r,e,n){if(e>n){var t=e;e=n,n=t}var o=r[e];o||(r[e]=o={}),o[n]=!0}s(ce,"addConflict");function Qe(r,e,n){if(e>n){var t=e;e=n,n=t}return!!r[e]&&Object.prototype.hasOwnProperty.call(r[e],n)}s(Qe,"hasConflict");function Ze(r,e,n,t){var o={},a={},i={};return u(e,function(f){u(f,function(d,c){o[d]=d,a[d]=d,i[d]=c})}),u(e,function(f){var d=-1;u(f,function(c){var h=t(c);if(h.length){h=O(h,function(b){return i[b]});for(var l=(h.length-1)/2,p=Math.floor(l),m=Math.ceil(l);p<=m;++p){var v=h[p];a[c]===c&&d{var t=n(" buildLayoutGraph",()=>bn(r));n(" runLayout",()=>un(t,n)),n(" updateInputGraph",()=>dn(r,t))})}s(fn,"layout");function un(r,e){e(" makeSpaceForEdgeLabels",()=>En(r)),e(" removeSelfEdges",()=>Pn(r)),e(" acyclic",()=>Fr(r)),e(" nestingGraph.run",()=>Kr(r)),e(" rank",()=>cr(X(r))),e(" injectEdgeLabelProxies",()=>yn(r)),e(" removeEmptyRanks",()=>gr(r)),e(" nestingGraph.cleanup",()=>Zr(r)),e(" normalizeRanks",()=>kr(r)),e(" assignRankMinMax",()=>xn(r)),e(" removeEdgeLabelProxies",()=>kn(r)),e(" normalize.run",()=>Br(r)),e(" parentDummyChains",()=>de(r)),e(" addBorderSegments",()=>Pr(r)),e(" order",()=>ue(r)),e(" insertSelfEdges",()=>Cn(r)),e(" adjustCoordinateSystem",()=>Tr(r)),e(" position",()=>le(r)),e(" positionSelfEdges",()=>Tn(r)),e(" removeBorderNodes",()=>Ln(r)),e(" normalize.undo",()=>Ar(r)),e(" fixupEdgeLabelCoords",()=>In(r)),e(" undoCoordinateSystem",()=>jr(r)),e(" translateGraph",()=>gn(r)),e(" assignNodeIntersects",()=>Nn(r)),e(" reversePoints",()=>On(r)),e(" acyclic.undo",()=>Gr(r))}s(un,"runLayout");function dn(r,e){u(r.nodes(),function(n){var t=r.node(n),o=e.node(n);t&&(t.x=o.x,t.y=o.y,e.children(n).length&&(t.width=o.width,t.height=o.height))}),u(r.edges(),function(n){var t=r.edge(n),o=e.edge(n);t.points=o.points,Object.prototype.hasOwnProperty.call(o,"x")&&(t.x=o.x,t.y=o.y)}),r.graph().width=e.graph().width,r.graph().height=e.graph().height}s(dn,"updateInputGraph");var cn=["nodesep","edgesep","ranksep","marginx","marginy"],hn={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ln=["acyclicer","ranker","rankdir","align"],pn=["width","height"],mn={width:0,height:0},vn=["minlen","weight","width","height","labeloffset"],_n={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},wn=["labelpos"];function bn(r){var e=new E({multigraph:!0,compound:!0}),n=pr(r.graph());return e.setGraph(Y({},hn,lr(n,cn),B(n,ln))),u(r.nodes(),function(t){var o=pr(r.node(t));e.setNode(t,wr(lr(o,pn),mn)),e.setParent(t,r.parent(t))}),u(r.edges(),function(t){var o=pr(r.edge(t));e.setEdge(t,Y({},_n,lr(o,vn),B(o,wn)))}),e}s(bn,"buildLayoutGraph");function En(r){var e=r.graph();e.ranksep/=2,u(r.edges(),function(n){var t=r.edge(n);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}s(En,"makeSpaceForEdgeLabels");function yn(r){u(r.edges(),function(e){var n=r.edge(e);if(n.width&&n.height){var t=r.node(e.v),o=r.node(e.w),a={rank:(o.rank-t.rank)/2+t.rank,e};g(r,"edge-proxy",a,"_ep")}})}s(yn,"injectEdgeLabelProxies");function xn(r){var e=0;u(r.nodes(),function(n){var t=r.node(n);t.borderTop&&(t.minRank=r.node(t.borderTop).rank,t.maxRank=r.node(t.borderBottom).rank,e=x(e,t.maxRank))}),r.graph().maxRank=e}s(xn,"assignRankMinMax");function kn(r){u(r.nodes(),function(e){var n=r.node(e);n.dummy==="edge-proxy"&&(r.edge(n.e).labelRank=n.rank,r.removeNode(e))})}s(kn,"removeEdgeLabelProxies");function gn(r){var e=Number.POSITIVE_INFINITY,n=0,t=Number.POSITIVE_INFINITY,o=0,a=r.graph(),i=a.marginx||0,f=a.marginy||0;function d(c){var h=c.x,l=c.y,p=c.width,m=c.height;e=Math.min(e,h-p/2),n=Math.max(n,h+p/2),t=Math.min(t,l-m/2),o=Math.max(o,l+m/2)}s(d,"getExtremes"),u(r.nodes(),function(c){d(r.node(c))}),u(r.edges(),function(c){var h=r.edge(c);Object.prototype.hasOwnProperty.call(h,"x")&&d(h)}),e-=i,t-=f,u(r.nodes(),function(c){var h=r.node(c);h.x-=e,h.y-=t}),u(r.edges(),function(c){var h=r.edge(c);u(h.points,function(l){l.x-=e,l.y-=t}),Object.prototype.hasOwnProperty.call(h,"x")&&(h.x-=e),Object.prototype.hasOwnProperty.call(h,"y")&&(h.y-=t)}),a.width=n-e+i,a.height=o-t+f}s(gn,"translateGraph");function Nn(r){u(r.edges(),function(e){var n=r.edge(e),t=r.node(e.v),o=r.node(e.w),a,i;n.points?(a=n.points[0],i=n.points[n.points.length-1]):(n.points=[],a=o,i=t),n.points.unshift($(t,a)),n.points.push($(o,i))})}s(Nn,"assignNodeIntersects");function In(r){u(r.edges(),function(e){var n=r.edge(e);if(Object.prototype.hasOwnProperty.call(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}s(In,"fixupEdgeLabelCoords");function On(r){u(r.edges(),function(e){var n=r.edge(e);n.reversed&&n.points.reverse()})}s(On,"reversePointsForReversedEdges");function Ln(r){u(r.nodes(),function(e){if(r.children(e).length){var n=r.node(e),t=r.node(n.borderTop),o=r.node(n.borderBottom),a=r.node(R(n.borderLeft)),i=r.node(R(n.borderRight));n.width=Math.abs(i.x-a.x),n.height=Math.abs(o.y-t.y),n.x=a.x+n.width/2,n.y=t.y+n.height/2}}),u(r.nodes(),function(e){r.node(e).dummy==="border"&&r.removeNode(e)})}s(Ln,"removeBorderNodes");function Pn(r){u(r.edges(),function(e){if(e.v===e.w){var n=r.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:r.edge(e)}),r.removeEdge(e)}})}s(Pn,"removeSelfEdges");function Cn(r){var e=C(r);u(e,function(n){var t=0;u(n,function(o,a){var i=r.node(o);i.order=a+t,u(i.selfEdges,function(f){g(r,"selfedge",{width:f.label.width,height:f.label.height,rank:i.rank,order:a+ ++t,e:f.e,label:f.label},"_se")}),delete i.selfEdges})})}s(Cn,"insertSelfEdges");function Tn(r){u(r.nodes(),function(e){var n=r.node(e);if(n.dummy==="selfedge"){var t=r.node(n.e.v),o=t.x+t.width/2,a=t.y,i=n.x-o,f=t.height/2;r.setEdge(n.e,n.label),r.removeNode(e),n.label.points=[{x:o+2*i/3,y:a-f},{x:o+5*i/6,y:a-f},{x:o+i,y:a},{x:o+5*i/6,y:a+f},{x:o+2*i/3,y:a+f}],n.label.x=n.x,n.label.y=n.y}})}s(Tn,"positionSelfEdges");function lr(r,e){return G(B(r,e),Number)}s(lr,"selectNumberAttrs");function pr(r){var e={};return u(r,function(n,t){e[t.toLowerCase()]=n}),e}s(pr,"canonicalize");export{fn as a};