import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as ee,T as te,U as ne,V as re,W as ie,X as ae,Y as oe,Z as y,_ as b,a as x,b as se,c as ce,d as le,et as S,f as C,g as ue,h as de,i as w,it as fe,j as pe,k as me,l as he,m as ge,n as T,nt as _e,o as E,p as ve,q as ye,r as D,rt as be,s as xe,t as O,tt as k,u as Se,v as Ce,w as we,x as Te,y as Ee,z as A}from"./graphlib-B8gBHxth.js";var De=/\s/;function Oe(e){for(var t=e.length;t--&&De.test(e.charAt(t)););return t}var ke=/^\s+/;function Ae(e){return e&&e.slice(0,Oe(e)+1).replace(ke,``)}var je=NaN,Me=/^[-+]0x[0-9a-f]+$/i,Ne=/^0b[01]+$/i,Pe=/^0o[0-7]+$/i,Fe=parseInt;function Ie(e){if(typeof e==`number`)return e;if(S(e))return je;if(y(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=y(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=Ae(e);var n=Ne.test(e);return n||Pe.test(e)?Fe(e.slice(2),n?2:8):Me.test(e)?je:+e}var Le=1/0,Re=17976931348623157e292;function j(e){return e?(e=Ie(e),e===Le||e===-Le?(e<0?-1:1)*Re:e===e?e:0):e===0?e:0}function ze(e){var t=j(e),n=t%1;return t===t?n?t-n:t:0}var Be=Object.create,Ve=function(){function e(){}return function(t){if(!y(t))return{};if(Be)return Be(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function He(e,t){var n=-1,r=e.length;for(t||=Array(r);++n1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&F(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r2?t[2]:void 0;for(i&&F(t[0],t[1],i)&&(r=1);++n-1?i[a?t[o]:o]:void 0}}var Wn=Math.max;function Gn(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:ze(n);return i<0&&(i=Wn(r+i,0)),ie(e,C(t,3),i)}var Kn=Un(Gn);function qn(e,t){var n=-1,r=A(e)?Array(e.length):[];return he(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function V(t,n){return(_(t)?e:qn)(t,C(n,3))}function Jn(e,t){return e==null?e:le(e,xe(t),I)}function Yn(e,t){return e&&Se(e,xe(t))}function Xn(e,t){return e>t}var Zn=Object.prototype.hasOwnProperty;function Qn(e,t){return e!=null&&Zn.call(e,t)}function $n(e,t){return e!=null&&de(e,t,Qn)}var er=`[object String]`;function tr(e){return typeof e==`string`||!_(e)&&k(e)&&_e(e)==er}function nr(e,t){return et||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function dr(t,n,r){n=n.length?e(n,function(e){return _(e)?function(t){return te(t,e.length===1?e[0]:e)}:e}):[ae];var i=-1;return n=e(n,o(C)),cr(qn(t,function(t,r,a){return{criteria:e(n,function(e){return e(t)}),index:++i,value:t}}),function(e,t){return ur(e,t,r)})}var fr=ve(`length`),pr=`\\ud800-\\udfff`,mr=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,hr=`\\ufe0e\\ufe0f`,gr=`[`+pr+`]`,G=`[`+mr+`]`,_r=`\\ud83c[\\udffb-\\udfff]`,vr=`(?:`+G+`|`+_r+`)`,yr=`[^`+pr+`]`,br=`(?:\\ud83c[\\udde6-\\uddff]){2}`,xr=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Sr=`\\u200d`,Cr=vr+`?`,wr=`[`+hr+`]?`,Tr=`(?:`+Sr+`(?:`+[yr,br,xr].join(`|`)+`)`+wr+Cr+`)*`,Er=wr+Cr+Tr,Dr=`(?:`+[yr+G+`?`,G,br,xr,gr].join(`|`)+`)`,Or=RegExp(_r+`(?=`+_r+`)|`+Dr+Er,`g`);function kr(e){for(var t=Or.lastIndex=0;Or.test(e);)++t;return t}function Ar(e){return it(e)?kr(e):fr(e)}function jr(e,t){return sr(e,t,function(t,n){return ge(e,n)})}var K=Je(function(e,t){return e==null?{}:jr(e,t)}),Mr=Math.ceil,Nr=Math.max;function Pr(e,t,n,r){for(var i=-1,a=Nr(Mr((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function Fr(e){return function(t,n,r){return r&&typeof r!=`number`&&F(t,n,r)&&(n=r=void 0),t=j(t),n===void 0?(n=t,t=0):n=j(n),r=r===void 0?t1&&F(e,t[0],t[1])?t=[]:n>2&&F(t[0],t[1],t[2])&&(t=[t[0]]),dr(e,r(t,1),[])}),zr=0;function Br(e){var t=++zr;return h(e)+t}function Vr(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r0;--s)if(o=t[s].dequeue(),o){r=r.concat(Yr(e,t,n,o,!0));break}}}return r}function Yr(e,t,n,r,i){var a=i?[]:void 0;return E(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,Zr(t,n,s)}),E(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,Zr(t,n,o)}),e.removeNode(r.v),a}function Xr(e,t){var n=new O,r=0,i=0;E(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),E(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=q(i+r+3).map(function(){return new Ur}),o=r+1;return E(n.nodes(),function(e){Zr(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function Zr(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function Qr(e){E(e.graph().acyclicer===`greedy`?qr(e,t(e)):$r(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,Br(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function $r(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,E(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return E(e.nodes(),i),t}function ei(e){E(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Y(e,t,n,r){var i;do i=Br(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function ti(e){var t=new O().setGraph(e.graph());return E(e.nodes(),function(n){t.setNode(n,e.node(n))}),E(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function ni(e){var t=new O({multigraph:e.isMultigraph()}).setGraph(e.graph());return E(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),E(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function ri(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function X(e){var t=V(q(si(e)+1),function(){return[]});return E(e.nodes(),function(n){var r=e.node(n),i=r.rank;D(i)||(t[i][r.order]=n)}),t}function ii(e){var t=W(V(e.nodes(),function(t){return e.node(t).rank}));E(e.nodes(),function(n){var r=e.node(n);$n(r,`rank`)&&(r.rank-=t)})}function ai(e){var t=W(V(e.nodes(),function(t){return e.node(t).rank})),n=[];E(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;E(n,function(t,n){D(t)&&n%i!==0?--r:r&&E(t,function(t){e.node(t).rank+=r})})}function oi(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),Y(e,`border`,i,t)}function si(e){return U(V(e.nodes(),function(t){var n=e.node(t).rank;if(!D(n))return n}))}function ci(e,t){var n={lhs:[],rhs:[]};return E(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function li(e,t){var n=Pn();try{return t()}finally{console.log(e+` time: `+(Pn()-n)+`ms`)}}function ui(e,t){return t()}function di(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&E(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;ao.lim&&(s=o,c=!0),ar(x(t.edges(),function(t){return c===Wi(e,e.node(t.v),s)&&c!==Wi(e,e.node(t.w),s)}),function(e){return Z(t,e)})}function Vi(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Li(e),Pi(e,t),Hi(e,t)}function Hi(e,t){var n=Ni(e,Kn(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),E(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function Ui(e,t,n){return e.hasEdge(t,n)}function Wi(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function Gi(e){switch(e.graph().ranker){case`network-simplex`:Ji(e);break;case`tight-tree`:qi(e);break;case`longest-path`:Ki(e);break;default:Ji(e)}}var Ki=wi;function qi(e){wi(e),Ti(e)}function Ji(e){$(e)}function Yi(e){var t=Y(e,`root`,{},`_root`),n=Zi(e),r=U(w(n))-1,i=2*r+1;e.graph().nestingRoot=t,E(e.edges(),function(t){e.edge(t).minlen*=i});var a=Qi(e)+1;E(e.children(),function(o){Xi(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function Xi(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=oi(e,`_bt`),l=oi(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,E(s,function(s){Xi(e,t,n,r,i,a,s);var u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-a[o]+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function Zi(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&E(a,function(e){n(e,i+1)}),t[r]=i}return E(e.children(),function(e){n(e,1)}),t}function Qi(e){return T(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function $i(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,E(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function ea(e,t,n){var r={},i;E(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function ta(e,t,n){var r=na(e),i=new O({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return E(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),E(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=D(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function na(e){for(var t;e.hasNode(t=Br(`_root`)););return t}function ra(e,t){for(var n=0,r=1;r0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n})),c}function aa(e){var t={},n=x(e.nodes(),function(t){return!e.children(t).length}),r=V(q(U(V(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){$n(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),E(e.successors(n),i))}return E(J(n,function(t){return e.node(t).rank}),i),r}function oa(e,t){return V(t,function(t){var n=e.inEdges(t);if(n.length){var r=T(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}function sa(e,t){var n={};return E(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};D(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),E(t.edges(),function(e){var t=n[e.v],r=n[e.w];!D(t)&&!D(r)&&(r.indegree++,t.out.push(n[e.w]))}),ca(x(n,function(e){return!e.indegree}))}function ca(e){var t=[];function n(e){return function(t){t.merged||(D(t.barycenter)||D(e.barycenter)||t.barycenter>=e.barycenter)&&la(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),E(i.in.reverse(),n(i)),E(i.out,r(i))}return V(x(t,function(e){return!e.merged}),function(e){return K(e,[`vs`,`i`,`barycenter`,`weight`])})}function la(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function ua(e,t){var n=ci(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=J(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(fa(!!t)),c=da(a,i,c),E(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=da(a,i,c)});var l={vs:L(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function da(e,t,n){for(var r;t.length&&(r=B(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function fa(e){return function(t,n){return t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}}function pa(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=x(i,function(e){return e!==o&&e!==s}));var l=oa(e,i);E(l,function(t){if(e.children(t.v).length){var i=pa(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&ha(t,i)}});var u=sa(l,n);ma(u,c);var d=ua(u,r);if(o&&(d.vs=L([o,d.vs,s]),e.predecessors(o).length)){var f=e.node(e.predecessors(o)[0]),p=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function ma(e,t){E(e,function(e){e.vs=L(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function ha(e,t){D(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function ga(e){var t=si(e),n=_a(e,q(1,t+1),`inEdges`),r=_a(e,q(t-1,-1,-1),`outEdges`),i=aa(e);ya(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){va(s%2?n:r,s%4>=2),i=X(e);var l=ra(e,i);lo||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function Sa(e){var t={},n=0;function r(i){var a=n;E(e.children(i),r),t[i]={low:a,lim:n++}}return E(e.children(),r),t}function Ca(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=B(r);return E(r,function(t,c){var l=Ta(e,t),u=l?e.node(l).order:o;(l||t===s)&&(E(r.slice(a,c+1),function(t){E(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(oo)&&Ea(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return E(n,function(s,c){if(e.node(s).dummy===`border`){var l=e.predecessors(s);l.length&&(a=e.node(l[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return T(t,i),n}function Ta(e,t){if(e.node(t).dummy)return Kn(e.predecessors(t),function(t){return e.node(t).dummy})}function Ea(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Da(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Oa(e,t,n,r){var i={},a={},o={};return E(t,function(e){E(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),E(t,function(e){var t=-1;E(e,function(e){var s=r(e);if(s.length){s=J(s,function(e){return o[e]});for(var c=(s.length-1)/2,l=Math.floor(c),u=Math.ceil(c);l<=u;++l){var d=s[l];a[e]===e&&t{var t=n(` buildLayoutGraph`,()=>Xa(e));n(` runLayout`,()=>Ba(t,n)),n(` updateInputGraph`,()=>Va(e,t))})}function Ba(e,t){t(` makeSpaceForEdgeLabels`,()=>Za(e)),t(` removeSelfEdges`,()=>oo(e)),t(` acyclic`,()=>Qr(e)),t(` nestingGraph.run`,()=>Yi(e)),t(` rank`,()=>Gi(ni(e))),t(` injectEdgeLabelProxies`,()=>Qa(e)),t(` removeEmptyRanks`,()=>ai(e)),t(` nestingGraph.cleanup`,()=>$i(e)),t(` normalizeRanks`,()=>ii(e)),t(` assignRankMinMax`,()=>$a(e)),t(` removeEdgeLabelProxies`,()=>eo(e)),t(` normalize.run`,()=>xi(e)),t(` parentDummyChains`,()=>ba(e)),t(` addBorderSegments`,()=>di(e)),t(` order`,()=>ga(e)),t(` insertSelfEdges`,()=>so(e)),t(` adjustCoordinateSystem`,()=>pi(e)),t(` position`,()=>La(e)),t(` positionSelfEdges`,()=>co(e)),t(` removeBorderNodes`,()=>ao(e)),t(` normalize.undo`,()=>Ci(e)),t(` fixupEdgeLabelCoords`,()=>ro(e)),t(` undoCoordinateSystem`,()=>mi(e)),t(` translateGraph`,()=>to(e)),t(` assignNodeIntersects`,()=>no(e)),t(` reversePoints`,()=>io(e)),t(` acyclic.undo`,()=>ei(e))}function Va(e,t){E(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),E(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Ha=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],Ua={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},Wa=[`acyclicer`,`ranker`,`rankdir`,`align`],Ga=[`width`,`height`],Ka={width:0,height:0},qa=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Ja={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Ya=[`labelpos`];function Xa(e){var t=new O({multigraph:!0,compound:!0}),n=uo(e.graph());return t.setGraph(ir({},Ua,lo(n,Ha),K(n,Wa))),E(e.nodes(),function(n){var r=uo(e.node(n));t.setNode(n,Ln(lo(r,Ga),Ka)),t.setParent(n,e.parent(n))}),E(e.edges(),function(n){var r=uo(e.edge(n));t.setEdge(n,ir({},Ja,lo(r,qa),K(r,Ya)))}),t}function Za(e){var t=e.graph();t.ranksep/=2,E(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Qa(e){E(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);Y(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function $a(e){var t=0;E(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=U(t,r.maxRank))}),e.graph().maxRank=t}function eo(e){E(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function to(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){var a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}E(e.nodes(),function(t){c(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,E(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),E(e.edges(),function(n){var i=e.edge(n);E(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function no(e){E(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(ri(r,a)),n.points.push(ri(i,o))})}function ro(e){E(e.edges(),function(t){var n=e.edge(t);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}})}function io(e){E(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function ao(e){E(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(B(n.borderLeft)),o=e.node(B(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),E(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function oo(e){E(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function so(e){E(X(e),function(t){var n=0;E(t,function(t,r){var i=e.node(t);i.order=r+n,E(i.selfEdges,function(t){Y(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function co(e){E(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function lo(e,t){return H(K(e,t),Number)}function uo(e){var t={};return E(e,function(e,n){t[n.toLowerCase()]=e}),t}export{V as n,z as r,za as t};