@dagrejs/dagre 2.0.1 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dagre.cjs.js +1 -1
- package/dist/dagre.cjs.js.map +3 -3
- package/dist/dagre.d.ts +3 -2
- package/dist/dagre.esm.js +1 -1
- package/dist/dagre.esm.js.map +4 -4
- package/dist/dagre.js +14 -4
- package/dist/dagre.js.map +2 -2
- package/dist/dagre.min.js +1 -1
- package/dist/dagre.min.js.map +3 -3
- package/package.json +2 -2
package/dist/dagre.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Graph as ImportedGraph, Node as GraphNode, Edge as GraphEdge } from '@d
|
|
|
3
3
|
// --- Graphlib Exports (Public API of dagre.graphlib) ---
|
|
4
4
|
|
|
5
5
|
export namespace graphlib {
|
|
6
|
-
export
|
|
6
|
+
export { ImportedGraph as Graph };
|
|
7
7
|
|
|
8
8
|
export namespace json {
|
|
9
9
|
function read(graph: any): Graph;
|
|
@@ -51,6 +51,7 @@ export interface GraphLabel {
|
|
|
51
51
|
marginy?: number | undefined;
|
|
52
52
|
acyclicer?: string | undefined;
|
|
53
53
|
ranker?: string | undefined;
|
|
54
|
+
rankalign?: 'top' | 'center' | 'bottom' | undefined;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
export interface NodeConfig {
|
|
@@ -101,4 +102,4 @@ export type Node<T = {}> = T & {
|
|
|
101
102
|
rx?: number | undefined;
|
|
102
103
|
ry?: number | undefined;
|
|
103
104
|
shape?: string | undefined;
|
|
104
|
-
};
|
|
105
|
+
};
|
package/dist/dagre.esm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var g=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var A=p((ai,Y)=>{var L=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,r=t._prev;if(r!==t)return D(r),r}enqueue(t){let r=this._sentinel;t._prev&&t._next&&D(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r}toString(){let t=[],r=this._sentinel,n=r._prev;for(;n!==r;)t.push(JSON.stringify(n,Ot)),n=n._prev;return"["+t.join(", ")+"]"}};function D(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ot(e,t){if(e!=="_next"&&e!=="_prev")return t}Y.exports=L});var z=p((li,W)=>{var It=g("@dagrejs/graphlib").Graph,qt=A();W.exports=Rt;var Lt=()=>1;function Rt(e,t){if(e.nodeCount()<=1)return[];let r=Mt(e,t||Lt);return Ct(r.graph,r.buckets,r.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w))}function Ct(e,t,r){let n=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)R(e,t,r,o);for(;o=i.dequeue();)R(e,t,r,o);if(e.nodeCount()){for(let l=t.length-2;l>0;--l)if(o=t[l].dequeue(),o){n=n.concat(R(e,t,r,o,!0));break}}}return n}function R(e,t,r,n,i){let a=i?[]:void 0;return e.inEdges(n.v).forEach(o=>{let l=e.edge(o),s=e.node(o.v);i&&a.push({v:o.v,w:o.w}),s.out-=l,C(t,r,s)}),e.outEdges(n.v).forEach(o=>{let l=e.edge(o),s=o.w,d=e.node(s);d.in-=l,C(t,r,d)}),e.removeNode(n.v),a}function Mt(e,t){let r=new It,n=0,i=0;e.nodes().forEach(l=>{r.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let s=r.edge(l.v,l.w)||0,d=t(l),u=s+d;r.setEdge(l.v,l.w,u),i=Math.max(i,r.node(l.v).out+=d),n=Math.max(n,r.node(l.w).in+=d)});let a=Tt(i+n+3).map(()=>new qt),o=n+1;return r.nodes().forEach(l=>{C(a,o,r.node(l))}),{graph:r,buckets:a,zeroIdx:o}}function C(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function Tt(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t}});var m=p((si,Z)=>{"use strict";var X=g("@dagrejs/graphlib").Graph;Z.exports={addBorderNode:Dt,addDummyNode:H,applyWithChunking:N,asNonCompoundGraph:_t,buildLayerMatrix:Vt,intersectRect:Gt,mapValues:Ut,maxRank:J,normalizeRanks:Ft,notime:zt,partition:At,pick:Ht,predecessorWeights:Pt,range:Q,removeEmptyRanks:Bt,simplify:jt,successorWeights:St,time:Wt,uniqueId:K,zipObject:M};function H(e,t,r,n){for(var i=n;e.hasNode(i);)i=K(n);return r.dummy=t,e.setNode(i,r),i}function jt(e){let t=new X().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function _t(e){let t=new X({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t}function St(e){let t=e.nodes().map(r=>{let n={};return e.outEdges(r).forEach(i=>{n[i.w]=(n[i.w]||0)+e.edge(i).weight}),n});return M(e.nodes(),t)}function Pt(e){let t=e.nodes().map(r=>{let n={};return e.inEdges(r).forEach(i=>{n[i.v]=(n[i.v]||0)+e.edge(i).weight}),n});return M(e.nodes(),t)}function Gt(e,t){let r=e.x,n=e.y,i=t.x-r,a=t.y-n,o=e.width/2,l=e.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let s,d;return Math.abs(a)*o>Math.abs(i)*l?(a<0&&(l=-l),s=l*i/a,d=l):(i<0&&(o=-o),s=o,d=o*a/i),{x:r+s,y:n+d}}function Vt(e){let t=Q(J(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),i=n.rank;i!==void 0&&(t[i][n.order]=r)}),t}function Ft(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MAX_VALUE:i}),r=N(Math.min,t);e.nodes().forEach(n=>{let i=e.node(n);Object.hasOwn(i,"rank")&&(i.rank-=r)})}function Bt(e){let t=e.nodes().map(o=>e.node(o).rank).filter(o=>o!==void 0),r=N(Math.min,t),n=[];e.nodes().forEach(o=>{let l=e.node(o).rank-r;n[l]||(n[l]=[]),n[l].push(o)});let i=0,a=e.graph().nodeRankFactor;Array.from(n).forEach((o,l)=>{o===void 0&&l%a!==0?--i:o!==void 0&&i&&o.forEach(s=>e.node(s).rank+=i)})}function Dt(e,t,r,n){let i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),H(e,"border",i,t)}function Yt(e,t=U){let r=[];for(let n=0;n<e.length;n+=t){let i=e.slice(n,n+t);r.push(i)}return r}var U=65535;function N(e,t){if(t.length>U){let r=Yt(t);return e.apply(null,r.map(n=>e.apply(null,n)))}else return e.apply(null,t)}function J(e){let r=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return N(Math.max,r)}function At(e,t){let r={lhs:[],rhs:[]};return e.forEach(n=>{t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function Wt(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}}function zt(e,t){return t()}var Xt=0;function K(e){var t=++Xt;return e+(""+t)}function Q(e,t,r=1){t==null&&(t=e,e=0);let n=a=>a<t;r<0&&(n=a=>t<a);let i=[];for(let a=e;n(a);a+=r)i.push(a);return i}function Ht(e,t){let r={};for(let n of t)e[n]!==void 0&&(r[n]=e[n]);return r}function Ut(e,t){let r=t;return typeof t=="string"&&(r=n=>n[t]),Object.entries(e).reduce((n,[i,a])=>(n[i]=r(a,i),n),{})}function M(e,t){return e.reduce((r,n,i)=>(r[n]=t[i],r),{})}});var ee=p((di,$)=>{"use strict";var Jt=z(),Kt=m().uniqueId;$.exports={run:Qt,undo:$t};function Qt(e){(e.graph().acyclicer==="greedy"?Jt(e,r(e)):Zt(e)).forEach(n=>{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,Kt("rev"))});function r(n){return i=>n.edge(i).weight}}function Zt(e){let t=[],r={},n={};function i(a){Object.hasOwn(n,a)||(n[a]=!0,r[a]=!0,e.outEdges(a).forEach(o=>{Object.hasOwn(r,o.w)?t.push(o):i(o.w)}),delete r[a])}return e.nodes().forEach(i),t}function $t(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}});var re=p((ui,te)=>{"use strict";var er=m();te.exports={run:tr,undo:nr};function tr(e){e.graph().dummyChains=[],e.edges().forEach(t=>rr(e,t))}function rr(e,t){let r=t.v,n=e.node(r).rank,i=t.w,a=e.node(i).rank,o=t.name,l=e.edge(t),s=l.labelRank;if(a===n+1)return;e.removeEdge(t);let d,u,h;for(h=0,++n;n<a;++h,++n)l.points=[],u={width:0,height:0,edgeLabel:l,edgeObj:t,rank:n},d=er.addDummyNode(e,"edge",u,"_d"),n===s&&(u.width=l.width,u.height=l.height,u.dummy="edge-label",u.labelpos=l.labelpos),e.setEdge(r,d,{weight:l.weight},o),h===0&&e.graph().dummyChains.push(d),r=d;e.setEdge(r,i,{weight:l.weight},o)}function nr(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,i;for(e.setEdge(r.edgeObj,n);r.dummy;)i=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=i,r=e.node(t)})}});var v=p((hi,ne)=>{"use strict";var{applyWithChunking:ir}=m();ne.exports={longestPath:or,slack:ar};function or(e){var t={};function r(n){var i=e.node(n);if(Object.hasOwn(t,n))return i.rank;t[n]=!0;let a=e.outEdges(n).map(l=>l==null?Number.POSITIVE_INFINITY:r(l.w)-e.edge(l).minlen);var o=ir(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),i.rank=o}e.sources().forEach(r)}function ar(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}});var T=p((fi,ie)=>{"use strict";var lr=g("@dagrejs/graphlib").Graph,O=v().slack;ie.exports=sr;function sr(e){var t=new lr({directed:!1}),r=e.nodes()[0],n=e.nodeCount();t.setNode(r,{});for(var i,a;dr(t,e)<n;)i=ur(t,e),a=t.hasNode(i.v)?O(e,i):-O(e,i),hr(t,e,a);return t}function dr(e,t){function r(n){t.nodeEdges(n).forEach(i=>{var a=i.v,o=n===a?i.w:a;!e.hasNode(o)&&!O(t,i)&&(e.setNode(o,{}),e.setEdge(n,o,{}),r(o))})}return e.nodes().forEach(r),e.nodeCount()}function ur(e,t){return t.edges().reduce((n,i)=>{let a=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=O(t,i)),a<n[0]?[a,i]:n},[Number.POSITIVE_INFINITY,null])[1]}function hr(e,t,r){e.nodes().forEach(n=>t.node(n).rank+=r)}});var ce=p((ci,fe)=>{"use strict";var fr=T(),oe=v().slack,cr=v().longestPath,pr=g("@dagrejs/graphlib").alg.preorder,mr=g("@dagrejs/graphlib").alg.postorder,br=m().simplify;fe.exports=y;y.initLowLimValues=_;y.initCutValues=j;y.calcCutValue=le;y.leaveEdge=de;y.enterEdge=ue;y.exchangeEdges=he;function y(e){e=br(e),cr(e);var t=fr(e);_(t),j(t,e);for(var r,n;r=de(t);)n=ue(t,e,r),he(t,e,r,n)}function j(e,t){var r=mr(e,e.nodes());r=r.slice(0,r.length-1),r.forEach(n=>wr(e,t,n))}function wr(e,t,r){var n=e.node(r),i=n.parent;e.edge(r,i).cutvalue=le(e,t,r)}function le(e,t,r){var n=e.node(r),i=n.parent,a=!0,o=t.edge(r,i),l=0;return o||(a=!1,o=t.edge(i,r)),l=o.weight,t.nodeEdges(r).forEach(s=>{var d=s.v===r,u=d?s.w:s.v;if(u!==i){var h=d===a,f=t.edge(s).weight;if(l+=h?f:-f,gr(e,r,u)){var c=e.edge(r,u).cutvalue;l+=h?-c:c}}}),l}function _(e,t){arguments.length<2&&(t=e.nodes()[0]),se(e,{},1,t)}function se(e,t,r,n,i){var a=r,o=e.node(n);return t[n]=!0,e.neighbors(n).forEach(l=>{Object.hasOwn(t,l)||(r=se(e,t,r,l,n))}),o.low=a,o.lim=r++,i?o.parent=i:delete o.parent,r}function de(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function ue(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var a=e.node(n),o=e.node(i),l=a,s=!1;a.lim>o.lim&&(l=o,s=!0);var d=t.edges().filter(u=>s===ae(e,e.node(u.v),l)&&s!==ae(e,e.node(u.w),l));return d.reduce((u,h)=>oe(t,h)<oe(t,u)?h:u)}function he(e,t,r,n){var i=r.v,a=r.w;e.removeEdge(i,a),e.setEdge(n.v,n.w,{}),_(e),j(e,t),Er(e,t)}function Er(e,t){var r=e.nodes().find(i=>!t.node(i).parent),n=pr(e,r);n=n.slice(1),n.forEach(i=>{var a=e.node(i).parent,o=t.edge(i,a),l=!1;o||(o=t.edge(a,i),l=!0),t.node(i).rank=t.node(a).rank+(l?o.minlen:-o.minlen)})}function gr(e,t,r){return e.hasEdge(t,r)}function ae(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}});var we=p((pi,be)=>{"use strict";var kr=v(),me=kr.longestPath,xr=T(),yr=ce();be.exports=vr;function vr(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case"network-simplex":pe(e);break;case"tight-tree":Or(e);break;case"longest-path":Nr(e);break;case"none":break;default:pe(e)}}var Nr=me;function Or(e){me(e),xr(e)}function pe(e){yr(e)}});var ge=p((mi,Ee)=>{Ee.exports=Ir;function Ir(e){let t=Lr(e);e.graph().dummyChains.forEach(r=>{let n=e.node(r),i=n.edgeObj,a=qr(e,t,i.v,i.w),o=a.path,l=a.lca,s=0,d=o[s],u=!0;for(;r!==i.w;){if(n=e.node(r),u){for(;(d=o[s])!==l&&e.node(d).maxRank<n.rank;)s++;d===l&&(u=!1)}if(!u){for(;s<o.length-1&&e.node(d=o[s+1]).minRank<=n.rank;)s++;d=o[s]}e.setParent(r,d),r=e.successors(r)[0]}})}function qr(e,t,r,n){let i=[],a=[],o=Math.min(t[r].low,t[n].low),l=Math.max(t[r].lim,t[n].lim),s,d;s=r;do s=e.parent(s),i.push(s);while(s&&(t[s].low>o||l>t[s].lim));for(d=s,s=n;(s=e.parent(s))!==d;)a.push(s);return{path:i.concat(a.reverse()),lca:d}}function Lr(e){let t={},r=0;function n(i){let a=r;e.children(i).forEach(n),t[i]={low:a,lim:r++}}return e.children().forEach(n),t}});var ye=p((bi,xe)=>{var I=m();xe.exports={run:Rr,cleanup:Tr};function Rr(e){let t=I.addDummyNode(e,"root",{},"_root"),r=Cr(e),n=Object.values(r),i=I.applyWithChunking(Math.max,n)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=a);let o=Mr(e)+1;e.children().forEach(l=>ke(e,t,a,o,i,r,l)),e.graph().nodeRankFactor=a}function ke(e,t,r,n,i,a,o){let l=e.children(o);if(!l.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:r});return}let s=I.addBorderNode(e,"_bt"),d=I.addBorderNode(e,"_bb"),u=e.node(o);e.setParent(s,o),u.borderTop=s,e.setParent(d,o),u.borderBottom=d,l.forEach(h=>{ke(e,t,r,n,i,a,h);let f=e.node(h),c=f.borderTop?f.borderTop:h,b=f.borderBottom?f.borderBottom:h,w=f.borderTop?n:2*n,x=c!==b?1:i-a[o]+1;e.setEdge(s,c,{weight:w,minlen:x,nestingEdge:!0}),e.setEdge(b,d,{weight:w,minlen:x,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,s,{weight:0,minlen:i+a[o]})}function Cr(e){var t={};function r(n,i){var a=e.children(n);a&&a.length&&a.forEach(o=>r(o,i+1)),t[n]=i}return e.children().forEach(n=>r(n,1)),t}function Mr(e){return e.edges().reduce((t,r)=>t+e.edge(r).weight,0)}function Tr(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(r=>{var n=e.edge(r);n.nestingEdge&&e.removeEdge(r)})}});var Oe=p((wi,Ne)=>{var jr=m();Ne.exports=_r;function _r(e){function t(r){let n=e.children(r),i=e.node(r);if(n.length&&n.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let a=i.minRank,o=i.maxRank+1;a<o;++a)ve(e,"borderLeft","_bl",r,i,a),ve(e,"borderRight","_br",r,i,a)}}e.children().forEach(t)}function ve(e,t,r,n,i,a){let o={width:0,height:0,rank:a,borderType:t},l=i[t][a-1],s=jr.addDummyNode(e,"border",o,r);i[t][a]=s,e.setParent(s,n),l&&e.setEdge(l,s,{weight:1})}});var Re=p((Ei,Le)=>{"use strict";Le.exports={adjust:Sr,undo:Pr};function Sr(e){let t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&qe(e)}function Pr(e){let t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&Gr(e),(t==="lr"||t==="rl")&&(Vr(e),qe(e))}function qe(e){e.nodes().forEach(t=>Ie(e.node(t))),e.edges().forEach(t=>Ie(e.edge(t)))}function Ie(e){let t=e.width;e.width=e.height,e.height=t}function Gr(e){e.nodes().forEach(t=>S(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(S),Object.hasOwn(r,"y")&&S(r)})}function S(e){e.y=-e.y}function Vr(e){e.nodes().forEach(t=>P(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(P),Object.hasOwn(r,"x")&&P(r)})}function P(e){let t=e.x;e.x=e.y,e.y=t}});var Te=p((gi,Me)=>{"use strict";var Ce=m();Me.exports=Fr;function Fr(e){let t={},r=e.nodes().filter(s=>!e.children(s).length),n=r.map(s=>e.node(s).rank),i=Ce.applyWithChunking(Math.max,n),a=Ce.range(i+1).map(()=>[]);function o(s){if(t[s])return;t[s]=!0;let d=e.node(s);a[d.rank].push(s),e.successors(s).forEach(o)}return r.sort((s,d)=>e.node(s).rank-e.node(d).rank).forEach(o),a}});var _e=p((ki,je)=>{"use strict";var Br=m().zipObject;je.exports=Dr;function Dr(e,t){let r=0;for(let n=1;n<t.length;++n)r+=Yr(e,t[n-1],t[n]);return r}function Yr(e,t,r){let n=Br(r,r.map((d,u)=>u)),i=t.flatMap(d=>e.outEdges(d).map(u=>({pos:n[u.w],weight:e.edge(u).weight})).sort((u,h)=>u.pos-h.pos)),a=1;for(;a<r.length;)a<<=1;let o=2*a-1;a-=1;let l=new Array(o).fill(0),s=0;return i.forEach(d=>{let u=d.pos+a;l[u]+=d.weight;let h=0;for(;u>0;)u%2&&(h+=l[u+1]),u=u-1>>1,l[u]+=d.weight;s+=d.weight*h}),s}});var Pe=p((xi,Se)=>{Se.exports=Ar;function Ar(e,t=[]){return t.map(r=>{let n=e.inEdges(r);if(n.length){let i=n.reduce((a,o)=>{let l=e.edge(o),s=e.node(o.v);return{sum:a.sum+l.weight*s.order,weight:a.weight+l.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}});var Ve=p((yi,Ge)=>{"use strict";var Wr=m();Ge.exports=zr;function zr(e,t){let r={};e.forEach((i,a)=>{let o=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};i.barycenter!==void 0&&(o.barycenter=i.barycenter,o.weight=i.weight)}),t.edges().forEach(i=>{let a=r[i.v],o=r[i.w];a!==void 0&&o!==void 0&&(o.indegree++,a.out.push(r[i.w]))});let n=Object.values(r).filter(i=>!i.indegree);return Xr(n)}function Xr(e){let t=[];function r(i){return a=>{a.merged||(a.barycenter===void 0||i.barycenter===void 0||a.barycenter>=i.barycenter)&&Hr(i,a)}}function n(i){return a=>{a.in.push(i),--a.indegree===0&&e.push(a)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(r(i)),i.out.forEach(n(i))}return t.filter(i=>!i.merged).map(i=>Wr.pick(i,["vs","i","barycenter","weight"]))}function Hr(e,t){let r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}});var De=p((vi,Be)=>{var Ur=m();Be.exports=Jr;function Jr(e,t){let r=Ur.partition(e,u=>Object.hasOwn(u,"barycenter")),n=r.lhs,i=r.rhs.sort((u,h)=>h.i-u.i),a=[],o=0,l=0,s=0;n.sort(Kr(!!t)),s=Fe(a,i,s),n.forEach(u=>{s+=u.vs.length,a.push(u.vs),o+=u.barycenter*u.weight,l+=u.weight,s=Fe(a,i,s)});let d={vs:a.flat(!0)};return l&&(d.barycenter=o/l,d.weight=l),d}function Fe(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}function Kr(e){return(t,r)=>t.barycenter<r.barycenter?-1:t.barycenter>r.barycenter?1:e?r.i-t.i:t.i-r.i}});var We=p((Ni,Ae)=>{var Qr=Pe(),Zr=Ve(),$r=De();Ae.exports=Ye;function Ye(e,t,r,n){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,l=a?a.borderRight:void 0,s={};o&&(i=i.filter(f=>f!==o&&f!==l));let d=Qr(e,i);d.forEach(f=>{if(e.children(f.v).length){let c=Ye(e,f.v,r,n);s[f.v]=c,Object.hasOwn(c,"barycenter")&&tn(f,c)}});let u=Zr(d,r);en(u,s);let h=$r(u,n);if(o&&(h.vs=[o,h.vs,l].flat(!0),e.predecessors(o).length)){let f=e.node(e.predecessors(o)[0]),c=e.node(e.predecessors(l)[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+f.order+c.order)/(h.weight+2),h.weight+=2}return h}function en(e,t){e.forEach(r=>{r.vs=r.vs.flatMap(n=>t[n]?t[n].vs:n)})}function tn(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}});var Xe=p((Oi,ze)=>{var rn=g("@dagrejs/graphlib").Graph,nn=m();ze.exports=on;function on(e,t,r,n){n||(n=e.nodes());let i=an(e),a=new rn({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(o=>e.node(o));return n.forEach(o=>{let l=e.node(o),s=e.parent(o);(l.rank===t||l.minRank<=t&&t<=l.maxRank)&&(a.setNode(o),a.setParent(o,s||i),e[r](o).forEach(d=>{let u=d.v===o?d.w:d.v,h=a.edge(u,o),f=h!==void 0?h.weight:0;a.setEdge(u,o,{weight:e.edge(d).weight+f})}),Object.hasOwn(l,"minRank")&&a.setNode(o,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]}))}),a}function an(e){for(var t;e.hasNode(t=nn.uniqueId("_root")););return t}});var Ue=p((Ii,He)=>{He.exports=ln;function ln(e,t,r){let n={},i;r.forEach(a=>{let o=e.parent(a),l,s;for(;o;){if(l=e.parent(o),l?(s=n[l],n[l]=o):(s=i,i=o),s&&s!==o){t.setEdge(s,o);return}o=l}})}});var $e=p((qi,Ze)=>{"use strict";var sn=Te(),dn=_e(),un=We(),hn=Xe(),fn=Ue(),cn=g("@dagrejs/graphlib").Graph,q=m();Ze.exports=Qe;function Qe(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,Qe);return}let r=q.maxRank(e),n=Je(e,q.range(1,r+1),"inEdges"),i=Je(e,q.range(r-1,-1,-1),"outEdges"),a=sn(e);if(Ke(e,a),t.disableOptimalOrderHeuristic)return;let o=Number.POSITIVE_INFINITY,l,s=t.constraints||[];for(let d=0,u=0;u<4;++d,++u){pn(d%2?n:i,d%4>=2,s),a=q.buildLayerMatrix(e);let h=dn(e,a);h<o?(u=0,l=Object.assign({},a),o=h):h===o&&(l=structuredClone(a))}Ke(e,l)}function Je(e,t,r){let n=new Map,i=(a,o)=>{n.has(a)||n.set(a,[]),n.get(a).push(o)};for(let a of e.nodes()){let o=e.node(a);if(typeof o.rank=="number"&&i(o.rank,a),typeof o.minRank=="number"&&typeof o.maxRank=="number")for(let l=o.minRank;l<=o.maxRank;l++)l!==o.rank&&i(l,a)}return t.map(function(a){return hn(e,a,r,n.get(a)||[])})}function pn(e,t,r){let n=new cn;e.forEach(function(i){r.forEach(l=>n.setEdge(l.left,l.right));let a=i.graph().root,o=un(i,a,n,t);o.vs.forEach((l,s)=>i.node(l).order=s),fn(i,n,o.vs)})}function Ke(e,t){Object.values(t).forEach(r=>r.forEach((n,i)=>e.node(n).order=i))}});var dt=p((Li,st)=>{"use strict";var mn=g("@dagrejs/graphlib").Graph,k=m();st.exports={positionX:En,findType1Conflicts:et,findType2Conflicts:tt,addConflict:G,hasConflict:rt,verticalAlignment:nt,horizontalCompaction:it,alignCoordinates:at,findSmallestWidthAlignment:ot,balance:lt};function et(e,t){let r={};function n(i,a){let o=0,l=0,s=i.length,d=a[a.length-1];return a.forEach((u,h)=>{let f=bn(e,u),c=f?e.node(f).order:s;(f||u===d)&&(a.slice(l,h+1).forEach(b=>{e.predecessors(b).forEach(w=>{let x=e.node(w),B=x.order;(B<o||c<B)&&!(x.dummy&&e.node(b).dummy)&&G(r,w,b)})}),l=h+1,o=c)}),a}return t.length&&t.reduce(n),r}function tt(e,t){let r={};function n(a,o,l,s,d){let u;k.range(o,l).forEach(h=>{u=a[h],e.node(u).dummy&&e.predecessors(u).forEach(f=>{let c=e.node(f);c.dummy&&(c.order<s||c.order>d)&&G(r,f,u)})})}function i(a,o){let l=-1,s,d=0;return o.forEach((u,h)=>{if(e.node(u).dummy==="border"){let f=e.predecessors(u);f.length&&(s=e.node(f[0]).order,n(o,d,h,l,s),d=h,l=s)}n(o,d,o.length,s,a.length)}),o}return t.length&&t.reduce(i),r}function bn(e,t){if(e.node(t).dummy)return e.predecessors(t).find(r=>e.node(r).dummy)}function G(e,t,r){if(t>r){let i=t;t=r,r=i}let n=e[t];n||(e[t]=n={}),n[r]=!0}function rt(e,t,r){if(t>r){let n=t;t=r,r=n}return!!e[t]&&Object.hasOwn(e[t],r)}function nt(e,t,r,n){let i={},a={},o={};return t.forEach(l=>{l.forEach((s,d)=>{i[s]=s,a[s]=s,o[s]=d})}),t.forEach(l=>{let s=-1;l.forEach(d=>{let u=n(d);if(u.length){u=u.sort((f,c)=>o[f]-o[c]);let h=(u.length-1)/2;for(let f=Math.floor(h),c=Math.ceil(h);f<=c;++f){let b=u[f];a[d]===d&&s<o[b]&&!rt(r,d,b)&&(a[b]=d,a[d]=i[d]=i[b],s=o[b])}}})}),{root:i,align:a}}function it(e,t,r,n,i){let a={},o=wn(e,t,r,i),l=i?"borderLeft":"borderRight";function s(h,f){let c=o.nodes().slice(),b={},w=c.pop();for(;w;){if(b[w])h(w);else{b[w]=!0,c.push(w);for(let x of f(w))c.push(x)}w=c.pop()}}function d(h){a[h]=o.inEdges(h).reduce((f,c)=>Math.max(f,a[c.v]+o.edge(c)),0)}function u(h){let f=o.outEdges(h).reduce((b,w)=>Math.min(b,a[w.w]-o.edge(w)),Number.POSITIVE_INFINITY),c=e.node(h);f!==Number.POSITIVE_INFINITY&&c.borderType!==l&&(a[h]=Math.max(a[h],f))}return s(d,o.predecessors.bind(o)),s(u,o.successors.bind(o)),Object.keys(n).forEach(h=>a[h]=a[r[h]]),a}function wn(e,t,r,n){let i=new mn,a=e.graph(),o=gn(a.nodesep,a.edgesep,n);return t.forEach(l=>{let s;l.forEach(d=>{let u=r[d];if(i.setNode(u),s){var h=r[s],f=i.edge(h,u);i.setEdge(h,u,Math.max(o(e,d,s),f||0))}s=d})}),i}function ot(e,t){return Object.values(t).reduce((r,n)=>{let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([l,s])=>{let d=kn(e,l)/2;i=Math.max(s+d,i),a=Math.min(s-d,a)});let o=i-a;return o<r[0]&&(r=[o,n]),r},[Number.POSITIVE_INFINITY,null])[1]}function at(e,t){let r=Object.values(t),n=k.applyWithChunking(Math.min,r),i=k.applyWithChunking(Math.max,r);["u","d"].forEach(a=>{["l","r"].forEach(o=>{let l=a+o,s=e[l];if(s===t)return;let d=Object.values(s),u=n-k.applyWithChunking(Math.min,d);o!=="l"&&(u=i-k.applyWithChunking(Math.max,d)),u&&(e[l]=k.mapValues(s,h=>h+u))})})}function lt(e,t){return k.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let i=Object.values(e).map(a=>a[n]).sort((a,o)=>a-o);return(i[1]+i[2])/2}})}function En(e){let t=k.buildLayerMatrix(e),r=Object.assign(et(e,t),tt(e,t)),n={},i;["u","d"].forEach(o=>{i=o==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(h=>Object.values(h).reverse()));let s=(o==="u"?e.predecessors:e.successors).bind(e),d=nt(e,i,r,s),u=it(e,i,d.root,d.align,l==="r");l==="r"&&(u=k.mapValues(u,h=>-h)),n[o+l]=u})});let a=ot(e,n);return at(n,a),lt(n,e.graph().align)}function gn(e,t,r){return(n,i,a)=>{let o=n.node(i),l=n.node(a),s=0,d;if(s+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":d=-o.width/2;break;case"r":d=o.width/2;break}if(d&&(s+=r?d:-d),d=0,s+=(o.dummy?t:e)/2,s+=(l.dummy?t:e)/2,s+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":d=l.width/2;break;case"r":d=-l.width/2;break}return d&&(s+=r?d:-d),d=0,s}}function kn(e,t){return e.node(t).width}});var ft=p((Ri,ht)=>{"use strict";var ut=m(),xn=dt().positionX;ht.exports=yn;function yn(e){e=ut.asNonCompoundGraph(e),vn(e),Object.entries(xn(e)).forEach(([t,r])=>e.node(t).x=r)}function vn(e){let t=ut.buildLayerMatrix(e),r=e.graph().ranksep,n=0;t.forEach(i=>{let a=i.reduce((o,l)=>{let s=e.node(l).height;return o>s?o:s},0);i.forEach(o=>e.node(o).y=n+a/2),n+=a+r})}});var gt=p((Ci,Et)=>{"use strict";var ct=ee(),pt=re(),Nn=we(),On=m().normalizeRanks,In=ge(),qn=m().removeEmptyRanks,mt=ye(),Ln=Oe(),bt=Re(),Rn=$e(),Cn=ft(),E=m(),Mn=g("@dagrejs/graphlib").Graph;Et.exports=Tn;function Tn(e,t={}){let r=t.debugTiming?E.time:E.notime;return r("layout",()=>{let n=r(" buildLayoutGraph",()=>Yn(e));return r(" runLayout",()=>jn(n,r,t)),r(" updateInputGraph",()=>_n(e,n)),n})}function jn(e,t,r){t(" makeSpaceForEdgeLabels",()=>An(e)),t(" removeSelfEdges",()=>Zn(e)),t(" acyclic",()=>ct.run(e)),t(" nestingGraph.run",()=>mt.run(e)),t(" rank",()=>Nn(E.asNonCompoundGraph(e))),t(" injectEdgeLabelProxies",()=>Wn(e)),t(" removeEmptyRanks",()=>qn(e)),t(" nestingGraph.cleanup",()=>mt.cleanup(e)),t(" normalizeRanks",()=>On(e)),t(" assignRankMinMax",()=>zn(e)),t(" removeEdgeLabelProxies",()=>Xn(e)),t(" normalize.run",()=>pt.run(e)),t(" parentDummyChains",()=>In(e)),t(" addBorderSegments",()=>Ln(e)),t(" order",()=>Rn(e,r)),t(" insertSelfEdges",()=>$n(e)),t(" adjustCoordinateSystem",()=>bt.adjust(e)),t(" position",()=>Cn(e)),t(" positionSelfEdges",()=>ei(e)),t(" removeBorderNodes",()=>Qn(e)),t(" normalize.undo",()=>pt.undo(e)),t(" fixupEdgeLabelCoords",()=>Jn(e)),t(" undoCoordinateSystem",()=>bt.undo(e)),t(" translateGraph",()=>Hn(e)),t(" assignNodeIntersects",()=>Un(e)),t(" reversePoints",()=>Kn(e)),t(" acyclic.undo",()=>ct.undo(e))}function _n(e,t){e.nodes().forEach(r=>{let n=e.node(r),i=t.node(r);n&&(n.x=i.x,n.y=i.y,n.order=i.order,n.rank=i.rank,t.children(r).length&&(n.width=i.width,n.height=i.height))}),e.edges().forEach(r=>{let n=e.edge(r),i=t.edge(r);n.points=i.points,Object.hasOwn(i,"x")&&(n.x=i.x,n.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Sn=["nodesep","edgesep","ranksep","marginx","marginy"],Pn={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Gn=["acyclicer","ranker","rankdir","align"],Vn=["width","height","rank"],wt={width:0,height:0},Fn=["minlen","weight","width","height","labeloffset"],Bn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Dn=["labelpos"];function Yn(e){let t=new Mn({multigraph:!0,compound:!0}),r=F(e.graph());return t.setGraph(Object.assign({},Pn,V(r,Sn),E.pick(r,Gn))),e.nodes().forEach(n=>{let i=F(e.node(n)),a=V(i,Vn);Object.keys(wt).forEach(o=>{a[o]===void 0&&(a[o]=wt[o])}),t.setNode(n,a),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let i=F(e.edge(n));t.setEdge(n,Object.assign({},Bn,V(i,Fn),E.pick(i,Dn)))}),t}function An(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(r=>{let n=e.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function Wn(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.width&&r.height){let n=e.node(t.v),a={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};E.addDummyNode(e,"edge-proxy",a,"_ep")}})}function zn(e){let t=0;e.nodes().forEach(r=>{let n=e.node(r);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,t=Math.max(t,n.maxRank))}),e.graph().maxRank=t}function Xn(e){e.nodes().forEach(t=>{let r=e.node(t);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(t))})}function Hn(e){let t=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=e.graph(),o=a.marginx||0,l=a.marginy||0;function s(d){let u=d.x,h=d.y,f=d.width,c=d.height;t=Math.min(t,u-f/2),r=Math.max(r,u+f/2),n=Math.min(n,h-c/2),i=Math.max(i,h+c/2)}e.nodes().forEach(d=>s(e.node(d))),e.edges().forEach(d=>{let u=e.edge(d);Object.hasOwn(u,"x")&&s(u)}),t-=o,n-=l,e.nodes().forEach(d=>{let u=e.node(d);u.x-=t,u.y-=n}),e.edges().forEach(d=>{let u=e.edge(d);u.points.forEach(h=>{h.x-=t,h.y-=n}),Object.hasOwn(u,"x")&&(u.x-=t),Object.hasOwn(u,"y")&&(u.y-=n)}),a.width=r-t+o,a.height=i-n+l}function Un(e){e.edges().forEach(t=>{let r=e.edge(t),n=e.node(t.v),i=e.node(t.w),a,o;r.points?(a=r.points[0],o=r.points[r.points.length-1]):(r.points=[],a=i,o=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(i,o))})}function Jn(e){e.edges().forEach(t=>{let r=e.edge(t);if(Object.hasOwn(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Kn(e){e.edges().forEach(t=>{let r=e.edge(t);r.reversed&&r.points.reverse()})}function Qn(e){e.nodes().forEach(t=>{if(e.children(t).length){let r=e.node(t),n=e.node(r.borderTop),i=e.node(r.borderBottom),a=e.node(r.borderLeft[r.borderLeft.length-1]),o=e.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(o.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Zn(e){e.edges().forEach(t=>{if(t.v===t.w){var r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function $n(e){var t=E.buildLayerMatrix(e);t.forEach(r=>{var n=0;r.forEach((i,a)=>{var o=e.node(i);o.order=a+n,(o.selfEdges||[]).forEach(l=>{E.addDummyNode(e,"selfedge",{width:l.label.width,height:l.label.height,rank:o.rank,order:a+ ++n,e:l.e,label:l.label},"_se")}),delete o.selfEdges})})}function ei(e){e.nodes().forEach(t=>{var r=e.node(t);if(r.dummy==="selfedge"){var n=e.node(r.e.v),i=n.x+n.width/2,a=n.y,o=r.x-i,l=n.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*o/3,y:a-l},{x:i+5*o/6,y:a-l},{x:i+o,y:a},{x:i+5*o/6,y:a+l},{x:i+2*o/3,y:a+l}],r.label.x=r.x,r.label.y=r.y}})}function V(e,t){return E.mapValues(E.pick(e,t),Number)}function F(e){var t={};return e&&Object.entries(e).forEach(([r,n])=>{typeof r=="string"&&(r=r.toLowerCase()),t[r]=n}),t}});var xt=p((Mi,kt)=>{var ti=m(),ri=g("@dagrejs/graphlib").Graph;kt.exports={debugOrdering:ni};function ni(e){let t=ti.buildLayerMatrix(e),r=new ri({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(n=>{r.setNode(n,{label:n}),r.setParent(n,"layer"+e.node(n).rank)}),e.edges().forEach(n=>r.setEdge(n.v,n.w,{},n.name)),t.forEach((n,i)=>{let a="layer"+i;r.setNode(a,{rank:"same"}),n.reduce((o,l)=>(r.setEdge(o,l,{style:"invis"}),l))}),r}});var vt=p((Ti,yt)=>{yt.exports="2.0.1"});var ii=p((ji,Nt)=>{Nt.exports={graphlib:g("@dagrejs/graphlib"),layout:gt(),debug:xt(),util:{time:m().time,notime:m().notime},version:vt()}});export default ii();
|
|
1
|
+
var v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var y=v((Fi,ee)=>{var Vt=Object.defineProperty,At=(e,t,r)=>t in e?Vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),k=(e,t,r)=>At(e,typeof t!="symbol"?t+"":t,r),R=E((e,t)=>{"use strict";var r="\0",n="\0",i="",o=class{constructor(d){k(this,"_isDirected",!0),k(this,"_isMultigraph",!1),k(this,"_isCompound",!1),k(this,"_label"),k(this,"_defaultNodeLabelFn",()=>{}),k(this,"_defaultEdgeLabelFn",()=>{}),k(this,"_nodes",{}),k(this,"_in",{}),k(this,"_preds",{}),k(this,"_out",{}),k(this,"_sucs",{}),k(this,"_edgeObjs",{}),k(this,"_edgeLabels",{}),k(this,"_nodeCount",0),k(this,"_edgeCount",0),k(this,"_parent"),k(this,"_children"),d&&(this._isDirected=Object.hasOwn(d,"directed")?d.directed:!0,this._isMultigraph=Object.hasOwn(d,"multigraph")?d.multigraph:!1,this._isCompound=Object.hasOwn(d,"compound")?d.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[n]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(d){return this._label=d,this}graph(){return this._label}setDefaultNodeLabel(d){return this._defaultNodeLabelFn=d,typeof d!="function"&&(this._defaultNodeLabelFn=()=>d),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var d=this;return this.nodes().filter(h=>Object.keys(d._in[h]).length===0)}sinks(){var d=this;return this.nodes().filter(h=>Object.keys(d._out[h]).length===0)}setNodes(d,h){var f=arguments,m=this;return d.forEach(function(p){f.length>1?m.setNode(p,h):m.setNode(p)}),this}setNode(d,h){return Object.hasOwn(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=h),this):(this._nodes[d]=arguments.length>1?h:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=n,this._children[d]={},this._children[n][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)}node(d){return this._nodes[d]}hasNode(d){return Object.hasOwn(this._nodes,d)}removeNode(d){var h=this;if(Object.hasOwn(this._nodes,d)){var f=m=>h.removeEdge(h._edgeObjs[m]);delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],this.children(d).forEach(function(m){h.setParent(m)}),delete this._children[d]),Object.keys(this._in[d]).forEach(f),delete this._in[d],delete this._preds[d],Object.keys(this._out[d]).forEach(f),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this}setParent(d,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(h===void 0)h=n;else{h+="";for(var f=h;f!==void 0;f=this.parent(f))if(f===d)throw new Error("Setting "+h+" as parent of "+d+" would create a cycle");this.setNode(h)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=h,this._children[h][d]=!0,this}_removeFromParentsChildList(d){delete this._children[this._parent[d]][d]}parent(d){if(this._isCompound){var h=this._parent[d];if(h!==n)return h}}children(d=n){if(this._isCompound){var h=this._children[d];if(h)return Object.keys(h)}else{if(d===n)return this.nodes();if(this.hasNode(d))return[]}}predecessors(d){var h=this._preds[d];if(h)return Object.keys(h)}successors(d){var h=this._sucs[d];if(h)return Object.keys(h)}neighbors(d){var h=this.predecessors(d);if(h){let m=new Set(h);for(var f of this.successors(d))m.add(f);return Array.from(m.values())}}isLeaf(d){var h;return this.isDirected()?h=this.successors(d):h=this.neighbors(d),h.length===0}filterNodes(d){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var f=this;Object.entries(this._nodes).forEach(function([w,b]){d(w)&&h.setNode(w,b)}),Object.values(this._edgeObjs).forEach(function(w){h.hasNode(w.v)&&h.hasNode(w.w)&&h.setEdge(w,f.edge(w))});var m={};function p(w){var b=f.parent(w);return b===void 0||h.hasNode(b)?(m[w]=b,b):b in m?m[b]:p(b)}return this._isCompound&&h.nodes().forEach(w=>h.setParent(w,p(w))),h}setDefaultEdgeLabel(d){return this._defaultEdgeLabelFn=d,typeof d!="function"&&(this._defaultEdgeLabelFn=()=>d),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(d,h){var f=this,m=arguments;return d.reduce(function(p,w){return m.length>1?f.setEdge(p,w,h):f.setEdge(p,w),w}),this}setEdge(){var d,h,f,m,p=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(d=w.v,h=w.w,f=w.name,arguments.length===2&&(m=arguments[1],p=!0)):(d=w,h=arguments[1],f=arguments[3],arguments.length>2&&(m=arguments[2],p=!0)),d=""+d,h=""+h,f!==void 0&&(f=""+f);var b=l(this._isDirected,d,h,f);if(Object.hasOwn(this._edgeLabels,b))return p&&(this._edgeLabels[b]=m),this;if(f!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(h),this._edgeLabels[b]=p?m:this._defaultEdgeLabelFn(d,h,f);var g=u(this._isDirected,d,h,f);return d=g.v,h=g.w,Object.freeze(g),this._edgeObjs[b]=g,s(this._preds[h],d),s(this._sucs[d],h),this._in[h][b]=g,this._out[d][b]=g,this._edgeCount++,this}edge(d,h,f){var m=arguments.length===1?c(this._isDirected,arguments[0]):l(this._isDirected,d,h,f);return this._edgeLabels[m]}edgeAsObj(){let d=this.edge(...arguments);return typeof d!="object"?{label:d}:d}hasEdge(d,h,f){var m=arguments.length===1?c(this._isDirected,arguments[0]):l(this._isDirected,d,h,f);return Object.hasOwn(this._edgeLabels,m)}removeEdge(d,h,f){var m=arguments.length===1?c(this._isDirected,arguments[0]):l(this._isDirected,d,h,f),p=this._edgeObjs[m];return p&&(d=p.v,h=p.w,delete this._edgeLabels[m],delete this._edgeObjs[m],a(this._preds[h],d),a(this._sucs[d],h),delete this._in[h][m],delete this._out[d][m],this._edgeCount--),this}inEdges(d,h){return this.isDirected()?this.filterEdges(this._in[d],d,h):this.nodeEdges(d,h)}outEdges(d,h){return this.isDirected()?this.filterEdges(this._out[d],d,h):this.nodeEdges(d,h)}nodeEdges(d,h){if(d in this._nodes)return this.filterEdges({...this._in[d],...this._out[d]},d,h)}filterEdges(d,h,f){if(d){var m=Object.values(d);return f?m.filter(function(p){return p.v===h&&p.w===f||p.v===f&&p.w===h}):m}}};function s(d,h){d[h]?d[h]++:d[h]=1}function a(d,h){--d[h]||delete d[h]}function l(d,h,f,m){var p=""+h,w=""+f;if(!d&&p>w){var b=p;p=w,w=b}return p+i+w+i+(m===void 0?r:m)}function u(d,h,f,m){var p=""+h,w=""+f;if(!d&&p>w){var b=p;p=w,w=b}var g={v:p,w};return m&&(g.name=m),g}function c(d,h){return l(d,h.v,h.w,h.name)}t.exports=o}),Yt=E((e,t)=>{t.exports="3.0.2"}),Bt=E((e,t)=>{t.exports={Graph:R(),version:Yt()}}),Wt=E((e,t)=>{var r=R();t.exports={write:n,read:s};function n(a){var l={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:i(a),edges:o(a)};return a.graph()!==void 0&&(l.value=structuredClone(a.graph())),l}function i(a){return a.nodes().map(function(l){var u=a.node(l),c=a.parent(l),d={v:l};return u!==void 0&&(d.value=u),c!==void 0&&(d.parent=c),d})}function o(a){return a.edges().map(function(l){var u=a.edge(l),c={v:l.v,w:l.w};return l.name!==void 0&&(c.name=l.name),u!==void 0&&(c.value=u),c})}function s(a){var l=new r(a.options).setGraph(a.value);return a.nodes.forEach(function(u){l.setNode(u.v,u.value),u.parent&&l.setParent(u.v,u.parent)}),a.edges.forEach(function(u){l.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),l}}),U=E((e,t)=>{t.exports=n;var r=()=>1;function n(o,s,a,l){return i(o,String(s),a||r,l||function(u){return o.outEdges(u)})}function i(o,s,a,l){var u={},c=!0,d=0,h=o.nodes(),f=function(b){var g=a(b);u[b.v].distance+g<u[b.w].distance&&(u[b.w]={distance:u[b.v].distance+g,predecessor:b.v},c=!0)},m=function(){h.forEach(function(b){l(b).forEach(function(g){var I=g.v===b?g.v:g.w,Gt=I===g.v?g.w:g.v;f({v:I,w:Gt})})})};h.forEach(function(b){var g=b===s?0:Number.POSITIVE_INFINITY;u[b]={distance:g}});for(var p=h.length,w=1;w<p&&(c=!1,d++,m(),!!c);w++);if(d===p-1&&(c=!1,m(),c))throw new Error("The graph contains a negative weight cycle");return u}}),zt=E((e,t)=>{t.exports=r;function r(n){var i={},o=[],s;function a(l){Object.hasOwn(i,l)||(i[l]=!0,s.push(l),n.successors(l).forEach(a),n.predecessors(l).forEach(a))}return n.nodes().forEach(function(l){s=[],a(l),s.length&&o.push(s)}),o}}),K=E((e,t)=>{var r=class{constructor(){k(this,"_arr",[]),k(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(n){return n.key})}has(n){return Object.hasOwn(this._keyIndices,n)}priority(n){var i=this._keyIndices[n];if(i!==void 0)return this._arr[i].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(n,i){var o=this._keyIndices;if(n=String(n),!Object.hasOwn(o,n)){var s=this._arr,a=s.length;return o[n]=a,s.push({key:n,priority:i}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key}decrease(n,i){var o=this._keyIndices[n];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)}_heapify(n){var i=this._arr,o=2*n,s=o+1,a=n;o<i.length&&(a=i[o].priority<i[a].priority?o:a,s<i.length&&(a=i[s].priority<i[a].priority?s:a),a!==n&&(this._swap(n,a),this._heapify(a)))}_decrease(n){for(var i=this._arr,o=i[n].priority,s;n!==0&&(s=n>>1,!(i[s].priority<o));)this._swap(n,s),n=s}_swap(n,i){var o=this._arr,s=this._keyIndices,a=o[n],l=o[i];o[n]=l,o[i]=a,s[l.key]=n,s[a.key]=i}};t.exports=r}),T=E((e,t)=>{var r=K();t.exports=i;var n=()=>1;function i(s,a,l,u){var c=function(d){return s.outEdges(d)};return o(s,String(a),l||n,u||c)}function o(s,a,l,u){var c={},d=new r,h,f,m=function(p){var w=p.v!==h?p.v:p.w,b=c[w],g=l(p),I=f.distance+g;if(g<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+g);I<b.distance&&(b.distance=I,b.predecessor=h,d.decrease(w,I))};for(s.nodes().forEach(function(p){var w=p===a?0:Number.POSITIVE_INFINITY;c[p]={distance:w},d.add(p,w)});d.size()>0&&(h=d.removeMin(),f=c[h],f.distance!==Number.POSITIVE_INFINITY);)u(h).forEach(m);return c}}),Xt=E((e,t)=>{var r=T();t.exports=n;function n(i,o,s){return i.nodes().reduce(function(a,l){return a[l]=r(i,l,o,s),a},{})}}),Ht=E((e,t)=>{t.exports=r;function r(i,o,s){if(i[o].predecessor!==void 0)throw new Error("Invalid source vertex");if(i[s].predecessor===void 0&&s!==o)throw new Error("Invalid destination vertex");return{weight:i[s].distance,path:n(i,o,s)}}function n(i,o,s){for(var a=[],l=s;l!==o;)a.push(l),l=i[l].predecessor;return a.push(o),a.reverse()}}),Q=E((e,t)=>{t.exports=r;function r(n){var i=0,o=[],s={},a=[];function l(u){var c=s[u]={onStack:!0,lowlink:i,index:i++};if(o.push(u),n.successors(u).forEach(function(f){Object.hasOwn(s,f)?s[f].onStack&&(c.lowlink=Math.min(c.lowlink,s[f].index)):(l(f),c.lowlink=Math.min(c.lowlink,s[f].lowlink))}),c.lowlink===c.index){var d=[],h;do h=o.pop(),s[h].onStack=!1,d.push(h);while(u!==h);a.push(d)}}return n.nodes().forEach(function(u){Object.hasOwn(s,u)||l(u)}),a}}),Ut=E((e,t)=>{var r=Q();t.exports=n;function n(i){return r(i).filter(function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}}),Kt=E((e,t)=>{t.exports=n;var r=()=>1;function n(o,s,a){return i(o,s||r,a||function(l){return o.outEdges(l)})}function i(o,s,a){var l={},u=o.nodes();return u.forEach(function(c){l[c]={},l[c][c]={distance:0},u.forEach(function(d){c!==d&&(l[c][d]={distance:Number.POSITIVE_INFINITY})}),a(c).forEach(function(d){var h=d.v===c?d.w:d.v,f=s(d);l[c][h]={distance:f,predecessor:c}})}),u.forEach(function(c){var d=l[c];u.forEach(function(h){var f=l[h];u.forEach(function(m){var p=f[c],w=d[m],b=f[m],g=p.distance+w.distance;g<b.distance&&(b.distance=g,b.predecessor=w.predecessor)})})}),l}}),J=E((e,t)=>{function r(i){var o={},s={},a=[];function l(u){if(Object.hasOwn(s,u))throw new n;Object.hasOwn(o,u)||(s[u]=!0,o[u]=!0,i.predecessors(u).forEach(l),delete s[u],a.push(u))}if(i.sinks().forEach(l),Object.keys(o).length!==i.nodeCount())throw new n;return a}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),Qt=E((e,t)=>{var r=J();t.exports=n;function n(i){try{r(i)}catch(o){if(o instanceof r.CycleException)return!1;throw o}return!0}}),Z=E((e,t)=>{t.exports=r;function r(i,o,s,a,l){Array.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c={};return o.forEach(function(d){if(!i.hasNode(d))throw new Error("Graph does not have node: "+d);l=n(i,d,s==="post",c,u,a,l)}),l}function n(i,o,s,a,l,u,c){return Object.hasOwn(a,o)||(a[o]=!0,s||(c=u(c,o)),l(o).forEach(function(d){c=n(i,d,s,a,l,u,c)}),s&&(c=u(c,o))),c}}),$=E((e,t)=>{var r=Z();t.exports=n;function n(i,o,s){return r(i,o,s,function(a,l){return a.push(l),a},[])}}),Jt=E((e,t)=>{var r=$();t.exports=n;function n(i,o){return r(i,o,"post")}}),Zt=E((e,t)=>{var r=$();t.exports=n;function n(i,o){return r(i,o,"pre")}}),$t=E((e,t)=>{var r=R(),n=K();t.exports=i;function i(o,s){var a=new r,l={},u=new n,c;function d(f){var m=f.v===c?f.w:f.v,p=u.priority(m);if(p!==void 0){var w=s(f);w<p&&(l[m]=c,u.decrease(m,w))}}if(o.nodeCount()===0)return a;o.nodes().forEach(function(f){u.add(f,Number.POSITIVE_INFINITY),a.setNode(f)}),u.decrease(o.nodes()[0],0);for(var h=!1;u.size()>0;){if(c=u.removeMin(),Object.hasOwn(l,c))a.setEdge(c,l[c]);else{if(h)throw new Error("Input graph is not connected: "+o);h=!0}o.nodeEdges(c).forEach(d)}return a}}),er=E((e,t)=>{var r=T(),n=U();t.exports=i;function i(s,a,l,u){return o(s,a,l,u||function(c){return s.outEdges(c)})}function o(s,a,l,u){if(l===void 0)return r(s,a,l,u);for(var c=!1,d=s.nodes(),h=0;h<d.length;h++){for(var f=u(d[h]),m=0;m<f.length;m++){var p=f[m],w=p.v===d[h]?p.v:p.w,b=w===p.v?p.w:p.v;l({v:w,w:b})<0&&(c=!0)}if(c)return n(s,a,l,u)}return r(s,a,l,u)}}),tr=E((e,t)=>{t.exports={bellmanFord:U(),components:zt(),dijkstra:T(),dijkstraAll:Xt(),extractPath:Ht(),findCycles:Ut(),floydWarshall:Kt(),isAcyclic:Qt(),postorder:Jt(),preorder:Zt(),prim:$t(),shortestPaths:er(),reduce:Z(),tarjan:Q(),topsort:J()}}),H=Bt();ee.exports={Graph:H.Graph,json:Wt(),alg:tr(),version:H.version}});var ne=v((Ai,re)=>{var S=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,r=t._prev;if(r!==t)return te(r),r}enqueue(t){let r=this._sentinel;t._prev&&t._next&&te(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r}toString(){let t=[],r=this._sentinel,n=r._prev;for(;n!==r;)t.push(JSON.stringify(n,rr)),n=n._prev;return"["+t.join(", ")+"]"}};function te(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function rr(e,t){if(e!=="_next"&&e!=="_prev")return t}re.exports=S});var oe=v((Yi,ie)=>{var nr=y().Graph,ir=ne();ie.exports=sr;var or=()=>1;function sr(e,t){if(e.nodeCount()<=1)return[];let r=dr(e,t||or);return ar(r.graph,r.buckets,r.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w))}function ar(e,t,r){let n=[],i=t[t.length-1],o=t[0],s;for(;e.nodeCount();){for(;s=o.dequeue();)P(e,t,r,s);for(;s=i.dequeue();)P(e,t,r,s);if(e.nodeCount()){for(let a=t.length-2;a>0;--a)if(s=t[a].dequeue(),s){n=n.concat(P(e,t,r,s,!0));break}}}return n}function P(e,t,r,n,i){let o=i?[]:void 0;return e.inEdges(n.v).forEach(s=>{let a=e.edge(s),l=e.node(s.v);i&&o.push({v:s.v,w:s.w}),l.out-=a,F(t,r,l)}),e.outEdges(n.v).forEach(s=>{let a=e.edge(s),l=s.w,u=e.node(l);u.in-=a,F(t,r,u)}),e.removeNode(n.v),o}function dr(e,t){let r=new nr,n=0,i=0;e.nodes().forEach(a=>{r.setNode(a,{v:a,in:0,out:0})}),e.edges().forEach(a=>{let l=r.edge(a.v,a.w)||0,u=t(a),c=l+u;r.setEdge(a.v,a.w,c),i=Math.max(i,r.node(a.v).out+=u),n=Math.max(n,r.node(a.w).in+=u)});let o=lr(i+n+3).map(()=>new ir),s=n+1;return r.nodes().forEach(a=>{F(o,s,r.node(a))}),{graph:r,buckets:o,zeroIdx:s}}function F(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function lr(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t}});var _=v((Bi,ce)=>{"use strict";var se=y().Graph;ce.exports={addBorderNode:vr,addDummyNode:ae,applyWithChunking:C,asNonCompoundGraph:hr,buildLayerMatrix:mr,intersectRect:pr,mapValues:Or,maxRank:le,normalizeRanks:wr,notime:kr,partition:Er,pick:xr,predecessorWeights:fr,range:he,removeEmptyRanks:br,simplify:ur,successorWeights:cr,time:_r,uniqueId:ue,zipObject:D};function ae(e,t,r,n){for(var i=n;e.hasNode(i);)i=ue(n);return r.dummy=t,e.setNode(i,r),i}function ur(e){let t=new se().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function hr(e){let t=new se({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t}function cr(e){let t=e.nodes().map(r=>{let n={};return e.outEdges(r).forEach(i=>{n[i.w]=(n[i.w]||0)+e.edge(i).weight}),n});return D(e.nodes(),t)}function fr(e){let t=e.nodes().map(r=>{let n={};return e.inEdges(r).forEach(i=>{n[i.v]=(n[i.v]||0)+e.edge(i).weight}),n});return D(e.nodes(),t)}function pr(e,t){let r=e.x,n=e.y,i=t.x-r,o=t.y-n,s=e.width/2,a=e.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");let l,u;return Math.abs(o)*s>Math.abs(i)*a?(o<0&&(a=-a),l=a*i/o,u=a):(i<0&&(s=-s),l=s,u=s*o/i),{x:r+l,y:n+u}}function mr(e){let t=he(le(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),i=n.rank;i!==void 0&&(t[i][n.order]=r)}),t}function wr(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MAX_VALUE:i}),r=C(Math.min,t);e.nodes().forEach(n=>{let i=e.node(n);Object.hasOwn(i,"rank")&&(i.rank-=r)})}function br(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),r=C(Math.min,t),n=[];e.nodes().forEach(s=>{let a=e.node(s).rank-r;n[a]||(n[a]=[]),n[a].push(s)});let i=0,o=e.graph().nodeRankFactor;Array.from(n).forEach((s,a)=>{s===void 0&&a%o!==0?--i:s!==void 0&&i&&s.forEach(l=>e.node(l).rank+=i)})}function vr(e,t,r,n){let i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),ae(e,"border",i,t)}function gr(e,t=de){let r=[];for(let n=0;n<e.length;n+=t){let i=e.slice(n,n+t);r.push(i)}return r}var de=65535;function C(e,t){if(t.length>de){let r=gr(t);return e.apply(null,r.map(n=>e.apply(null,n)))}else return e.apply(null,t)}function le(e){let r=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return C(Math.max,r)}function Er(e,t){let r={lhs:[],rhs:[]};return e.forEach(n=>{t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function _r(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}}function kr(e,t){return t()}var yr=0;function ue(e){var t=++yr;return e+(""+t)}function he(e,t,r=1){t==null&&(t=e,e=0);let n=o=>o<t;r<0&&(n=o=>t<o);let i=[];for(let o=e;n(o);o+=r)i.push(o);return i}function xr(e,t){let r={};for(let n of t)e[n]!==void 0&&(r[n]=e[n]);return r}function Or(e,t){let r=t;return typeof t=="string"&&(r=n=>n[t]),Object.entries(e).reduce((n,[i,o])=>(n[i]=r(o,i),n),{})}function D(e,t){return e.reduce((r,n,i)=>(r[n]=t[i],r),{})}});var pe=v((Wi,fe)=>{"use strict";var Nr=oe(),Ir=_().uniqueId;fe.exports={run:jr,undo:Lr};function jr(e){(e.graph().acyclicer==="greedy"?Nr(e,r(e)):Cr(e)).forEach(n=>{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,Ir("rev"))});function r(n){return i=>n.edge(i).weight}}function Cr(e){let t=[],r={},n={};function i(o){Object.hasOwn(n,o)||(n[o]=!0,r[o]=!0,e.outEdges(o).forEach(s=>{Object.hasOwn(r,s.w)?t.push(s):i(s.w)}),delete r[o])}return e.nodes().forEach(i),t}function Lr(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}});var we=v((zi,me)=>{"use strict";var qr=_();me.exports={run:Mr,undo:Tr};function Mr(e){e.graph().dummyChains=[],e.edges().forEach(t=>Rr(e,t))}function Rr(e,t){let r=t.v,n=e.node(r).rank,i=t.w,o=e.node(i).rank,s=t.name,a=e.edge(t),l=a.labelRank;if(o===n+1)return;e.removeEdge(t);let u,c,d;for(d=0,++n;n<o;++d,++n)a.points=[],c={width:0,height:0,edgeLabel:a,edgeObj:t,rank:n},u=qr.addDummyNode(e,"edge",c,"_d"),n===l&&(c.width=a.width,c.height=a.height,c.dummy="edge-label",c.labelpos=a.labelpos),e.setEdge(r,u,{weight:a.weight},s),d===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,i,{weight:a.weight},s)}function Tr(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,i;for(e.setEdge(r.edgeObj,n);r.dummy;)i=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=i,r=e.node(t)})}});var j=v((Xi,be)=>{"use strict";var{applyWithChunking:Sr}=_();be.exports={longestPath:Pr,slack:Fr};function Pr(e){var t={};function r(n){var i=e.node(n);if(Object.hasOwn(t,n))return i.rank;t[n]=!0;let o=e.outEdges(n).map(a=>a==null?Number.POSITIVE_INFINITY:r(a.w)-e.edge(a).minlen);var s=Sr(Math.min,o);return s===Number.POSITIVE_INFINITY&&(s=0),i.rank=s}e.sources().forEach(r)}function Fr(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}});var G=v((Hi,ve)=>{"use strict";var Dr=y().Graph,L=j().slack;ve.exports=Gr;function Gr(e){var t=new Dr({directed:!1}),r=e.nodes()[0],n=e.nodeCount();t.setNode(r,{});for(var i,o;Vr(t,e)<n;)i=Ar(t,e),o=t.hasNode(i.v)?L(e,i):-L(e,i),Yr(t,e,o);return t}function Vr(e,t){function r(n){t.nodeEdges(n).forEach(i=>{var o=i.v,s=n===o?i.w:o;!e.hasNode(s)&&!L(t,i)&&(e.setNode(s,{}),e.setEdge(n,s,{}),r(s))})}return e.nodes().forEach(r),e.nodeCount()}function Ar(e,t){return t.edges().reduce((n,i)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(o=L(t,i)),o<n[0]?[o,i]:n},[Number.POSITIVE_INFINITY,null])[1]}function Yr(e,t,r){e.nodes().forEach(n=>t.node(n).rank+=r)}});var Ie=v((Ui,Ne)=>{"use strict";var Br=G(),ge=j().slack,Wr=j().longestPath,zr=y().alg.preorder,Xr=y().alg.postorder,Hr=_().simplify;Ne.exports=N;N.initLowLimValues=A;N.initCutValues=V;N.calcCutValue=_e;N.leaveEdge=ye;N.enterEdge=xe;N.exchangeEdges=Oe;function N(e){e=Hr(e),Wr(e);var t=Br(e);A(t),V(t,e);for(var r,n;r=ye(t);)n=xe(t,e,r),Oe(t,e,r,n)}function V(e,t){var r=Xr(e,e.nodes());r=r.slice(0,r.length-1),r.forEach(n=>Ur(e,t,n))}function Ur(e,t,r){var n=e.node(r),i=n.parent;e.edge(r,i).cutvalue=_e(e,t,r)}function _e(e,t,r){var n=e.node(r),i=n.parent,o=!0,s=t.edge(r,i),a=0;return s||(o=!1,s=t.edge(i,r)),a=s.weight,t.nodeEdges(r).forEach(l=>{var u=l.v===r,c=u?l.w:l.v;if(c!==i){var d=u===o,h=t.edge(l).weight;if(a+=d?h:-h,Qr(e,r,c)){var f=e.edge(r,c).cutvalue;a+=d?-f:f}}}),a}function A(e,t){arguments.length<2&&(t=e.nodes()[0]),ke(e,{},1,t)}function ke(e,t,r,n,i){var o=r,s=e.node(n);return t[n]=!0,e.neighbors(n).forEach(a=>{Object.hasOwn(t,a)||(r=ke(e,t,r,a,n))}),s.low=o,s.lim=r++,i?s.parent=i:delete s.parent,r}function ye(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function xe(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var o=e.node(n),s=e.node(i),a=o,l=!1;o.lim>s.lim&&(a=s,l=!0);var u=t.edges().filter(c=>l===Ee(e,e.node(c.v),a)&&l!==Ee(e,e.node(c.w),a));return u.reduce((c,d)=>ge(t,d)<ge(t,c)?d:c)}function Oe(e,t,r,n){var i=r.v,o=r.w;e.removeEdge(i,o),e.setEdge(n.v,n.w,{}),A(e),V(e,t),Kr(e,t)}function Kr(e,t){var r=e.nodes().find(i=>!t.node(i).parent),n=zr(e,r);n=n.slice(1),n.forEach(i=>{var o=e.node(i).parent,s=t.edge(i,o),a=!1;s||(s=t.edge(o,i),a=!0),t.node(i).rank=t.node(o).rank+(a?s.minlen:-s.minlen)})}function Qr(e,t,r){return e.hasEdge(t,r)}function Ee(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}});var qe=v((Ki,Le)=>{"use strict";var Jr=j(),Ce=Jr.longestPath,Zr=G(),$r=Ie();Le.exports=en;function en(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case"network-simplex":je(e);break;case"tight-tree":rn(e);break;case"longest-path":tn(e);break;case"none":break;default:je(e)}}var tn=Ce;function rn(e){Ce(e),Zr(e)}function je(e){$r(e)}});var Re=v((Qi,Me)=>{Me.exports=nn;function nn(e){let t=sn(e);e.graph().dummyChains.forEach(r=>{let n=e.node(r),i=n.edgeObj,o=on(e,t,i.v,i.w),s=o.path,a=o.lca,l=0,u=s[l],c=!0;for(;r!==i.w;){if(n=e.node(r),c){for(;(u=s[l])!==a&&e.node(u).maxRank<n.rank;)l++;u===a&&(c=!1)}if(!c){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=n.rank;)l++;u=s[l]}e.setParent(r,u),r=e.successors(r)[0]}})}function on(e,t,r,n){let i=[],o=[],s=Math.min(t[r].low,t[n].low),a=Math.max(t[r].lim,t[n].lim),l,u;l=r;do l=e.parent(l),i.push(l);while(l&&(t[l].low>s||a>t[l].lim));for(u=l,l=n;(l=e.parent(l))!==u;)o.push(l);return{path:i.concat(o.reverse()),lca:u}}function sn(e){let t={},r=0;function n(i){let o=r;e.children(i).forEach(n),t[i]={low:o,lim:r++}}return e.children().forEach(n),t}});var Pe=v((Ji,Se)=>{var q=_();Se.exports={run:an,cleanup:un};function an(e){let t=q.addDummyNode(e,"root",{},"_root"),r=dn(e),n=Object.values(r),i=q.applyWithChunking(Math.max,n)-1,o=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(a=>e.edge(a).minlen*=o);let s=ln(e)+1;e.children().forEach(a=>Te(e,t,o,s,i,r,a)),e.graph().nodeRankFactor=o}function Te(e,t,r,n,i,o,s){let a=e.children(s);if(!a.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:r});return}let l=q.addBorderNode(e,"_bt"),u=q.addBorderNode(e,"_bb"),c=e.node(s);e.setParent(l,s),c.borderTop=l,e.setParent(u,s),c.borderBottom=u,a.forEach(d=>{Te(e,t,r,n,i,o,d);let h=e.node(d),f=h.borderTop?h.borderTop:d,m=h.borderBottom?h.borderBottom:d,p=h.borderTop?n:2*n,w=f!==m?1:i-o[s]+1;e.setEdge(l,f,{weight:p,minlen:w,nestingEdge:!0}),e.setEdge(m,u,{weight:p,minlen:w,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:i+o[s]})}function dn(e){var t={};function r(n,i){var o=e.children(n);o&&o.length&&o.forEach(s=>r(s,i+1)),t[n]=i}return e.children().forEach(n=>r(n,1)),t}function ln(e){return e.edges().reduce((t,r)=>t+e.edge(r).weight,0)}function un(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(r=>{var n=e.edge(r);n.nestingEdge&&e.removeEdge(r)})}});var Ge=v((Zi,De)=>{var hn=_();De.exports=cn;function cn(e){function t(r){let n=e.children(r),i=e.node(r);if(n.length&&n.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let o=i.minRank,s=i.maxRank+1;o<s;++o)Fe(e,"borderLeft","_bl",r,i,o),Fe(e,"borderRight","_br",r,i,o)}}e.children().forEach(t)}function Fe(e,t,r,n,i,o){let s={width:0,height:0,rank:o,borderType:t},a=i[t][o-1],l=hn.addDummyNode(e,"border",s,r);i[t][o]=l,e.setParent(l,n),a&&e.setEdge(a,l,{weight:1})}});var Be=v(($i,Ye)=>{"use strict";Ye.exports={adjust:fn,undo:pn};function fn(e){let t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&Ae(e)}function pn(e){let t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&mn(e),(t==="lr"||t==="rl")&&(wn(e),Ae(e))}function Ae(e){e.nodes().forEach(t=>Ve(e.node(t))),e.edges().forEach(t=>Ve(e.edge(t)))}function Ve(e){let t=e.width;e.width=e.height,e.height=t}function mn(e){e.nodes().forEach(t=>Y(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(Y),Object.hasOwn(r,"y")&&Y(r)})}function Y(e){e.y=-e.y}function wn(e){e.nodes().forEach(t=>B(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(B),Object.hasOwn(r,"x")&&B(r)})}function B(e){let t=e.x;e.x=e.y,e.y=t}});var Xe=v((eo,ze)=>{"use strict";var We=_();ze.exports=bn;function bn(e){let t={},r=e.nodes().filter(l=>!e.children(l).length),n=r.map(l=>e.node(l).rank),i=We.applyWithChunking(Math.max,n),o=We.range(i+1).map(()=>[]);function s(l){if(t[l])return;t[l]=!0;let u=e.node(l);o[u.rank].push(l),e.successors(l).forEach(s)}return r.sort((l,u)=>e.node(l).rank-e.node(u).rank).forEach(s),o}});var Ue=v((to,He)=>{"use strict";var vn=_().zipObject;He.exports=gn;function gn(e,t){let r=0;for(let n=1;n<t.length;++n)r+=En(e,t[n-1],t[n]);return r}function En(e,t,r){let n=vn(r,r.map((u,c)=>c)),i=t.flatMap(u=>e.outEdges(u).map(c=>({pos:n[c.w],weight:e.edge(c).weight})).sort((c,d)=>c.pos-d.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;o-=1;let a=new Array(s).fill(0),l=0;return i.forEach(u=>{let c=u.pos+o;a[c]+=u.weight;let d=0;for(;c>0;)c%2&&(d+=a[c+1]),c=c-1>>1,a[c]+=u.weight;l+=u.weight*d}),l}});var Qe=v((ro,Ke)=>{Ke.exports=_n;function _n(e,t=[]){return t.map(r=>{let n=e.inEdges(r);if(n.length){let i=n.reduce((o,s)=>{let a=e.edge(s),l=e.node(s.v);return{sum:o.sum+a.weight*l.order,weight:o.weight+a.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}});var Ze=v((no,Je)=>{"use strict";var kn=_();Je.exports=yn;function yn(e,t){let r={};e.forEach((i,o)=>{let s=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};i.barycenter!==void 0&&(s.barycenter=i.barycenter,s.weight=i.weight)}),t.edges().forEach(i=>{let o=r[i.v],s=r[i.w];o!==void 0&&s!==void 0&&(s.indegree++,o.out.push(r[i.w]))});let n=Object.values(r).filter(i=>!i.indegree);return xn(n)}function xn(e){let t=[];function r(i){return o=>{o.merged||(o.barycenter===void 0||i.barycenter===void 0||o.barycenter>=i.barycenter)&&On(i,o)}}function n(i){return o=>{o.in.push(i),--o.indegree===0&&e.push(o)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(r(i)),i.out.forEach(n(i))}return t.filter(i=>!i.merged).map(i=>kn.pick(i,["vs","i","barycenter","weight"]))}function On(e,t){let r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}});var tt=v((io,et)=>{var Nn=_();et.exports=In;function In(e,t){let r=Nn.partition(e,c=>Object.hasOwn(c,"barycenter")),n=r.lhs,i=r.rhs.sort((c,d)=>d.i-c.i),o=[],s=0,a=0,l=0;n.sort(jn(!!t)),l=$e(o,i,l),n.forEach(c=>{l+=c.vs.length,o.push(c.vs),s+=c.barycenter*c.weight,a+=c.weight,l=$e(o,i,l)});let u={vs:o.flat(!0)};return a&&(u.barycenter=s/a,u.weight=a),u}function $e(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}function jn(e){return(t,r)=>t.barycenter<r.barycenter?-1:t.barycenter>r.barycenter?1:e?r.i-t.i:t.i-r.i}});var it=v((oo,nt)=>{var Cn=Qe(),Ln=Ze(),qn=tt();nt.exports=rt;function rt(e,t,r,n){let i=e.children(t),o=e.node(t),s=o?o.borderLeft:void 0,a=o?o.borderRight:void 0,l={};s&&(i=i.filter(h=>h!==s&&h!==a));let u=Cn(e,i);u.forEach(h=>{if(e.children(h.v).length){let f=rt(e,h.v,r,n);l[h.v]=f,Object.hasOwn(f,"barycenter")&&Rn(h,f)}});let c=Ln(u,r);Mn(c,l);let d=qn(c,n);if(s&&(d.vs=[s,d.vs,a].flat(!0),e.predecessors(s).length)){let h=e.node(e.predecessors(s)[0]),f=e.node(e.predecessors(a)[0]);Object.hasOwn(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+h.order+f.order)/(d.weight+2),d.weight+=2}return d}function Mn(e,t){e.forEach(r=>{r.vs=r.vs.flatMap(n=>t[n]?t[n].vs:n)})}function Rn(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}});var st=v((so,ot)=>{var Tn=y().Graph,Sn=_();ot.exports=Pn;function Pn(e,t,r,n){n||(n=e.nodes());let i=Fn(e),o=new Tn({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(s=>e.node(s));return n.forEach(s=>{let a=e.node(s),l=e.parent(s);(a.rank===t||a.minRank<=t&&t<=a.maxRank)&&(o.setNode(s),o.setParent(s,l||i),e[r](s).forEach(u=>{let c=u.v===s?u.w:u.v,d=o.edge(c,s),h=d!==void 0?d.weight:0;o.setEdge(c,s,{weight:e.edge(u).weight+h})}),Object.hasOwn(a,"minRank")&&o.setNode(s,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]}))}),o}function Fn(e){for(var t;e.hasNode(t=Sn.uniqueId("_root")););return t}});var dt=v((ao,at)=>{at.exports=Dn;function Dn(e,t,r){let n={},i;r.forEach(o=>{let s=e.parent(o),a,l;for(;s;){if(a=e.parent(s),a?(l=n[a],n[a]=s):(l=i,i=s),l&&l!==s){t.setEdge(l,s);return}s=a}})}});var ft=v((lo,ct)=>{"use strict";var Gn=Xe(),Vn=Ue(),An=it(),Yn=st(),Bn=dt(),Wn=y().Graph,M=_();ct.exports=ht;function ht(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,ht);return}let r=M.maxRank(e),n=lt(e,M.range(1,r+1),"inEdges"),i=lt(e,M.range(r-1,-1,-1),"outEdges"),o=Gn(e);if(ut(e,o),t.disableOptimalOrderHeuristic)return;let s=Number.POSITIVE_INFINITY,a,l=t.constraints||[];for(let u=0,c=0;c<4;++u,++c){zn(u%2?n:i,u%4>=2,l),o=M.buildLayerMatrix(e);let d=Vn(e,o);d<s?(c=0,a=Object.assign({},o),s=d):d===s&&(a=structuredClone(o))}ut(e,a)}function lt(e,t,r){let n=new Map,i=(o,s)=>{n.has(o)||n.set(o,[]),n.get(o).push(s)};for(let o of e.nodes()){let s=e.node(o);if(typeof s.rank=="number"&&i(s.rank,o),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let a=s.minRank;a<=s.maxRank;a++)a!==s.rank&&i(a,o)}return t.map(function(o){return Yn(e,o,r,n.get(o)||[])})}function zn(e,t,r){let n=new Wn;e.forEach(function(i){r.forEach(a=>n.setEdge(a.left,a.right));let o=i.graph().root,s=An(i,o,n,t);s.vs.forEach((a,l)=>i.node(a).order=l),Bn(i,n,s.vs)})}function ut(e,t){Object.values(t).forEach(r=>r.forEach((n,i)=>e.node(n).order=i))}});var yt=v((uo,kt)=>{"use strict";var Xn=y().Graph,O=_();kt.exports={positionX:Kn,findType1Conflicts:pt,findType2Conflicts:mt,addConflict:W,hasConflict:wt,verticalAlignment:bt,horizontalCompaction:vt,alignCoordinates:Et,findSmallestWidthAlignment:gt,balance:_t};function pt(e,t){let r={};function n(i,o){let s=0,a=0,l=i.length,u=o[o.length-1];return o.forEach((c,d)=>{let h=Hn(e,c),f=h?e.node(h).order:l;(h||c===u)&&(o.slice(a,d+1).forEach(m=>{e.predecessors(m).forEach(p=>{let w=e.node(p),b=w.order;(b<s||f<b)&&!(w.dummy&&e.node(m).dummy)&&W(r,p,m)})}),a=d+1,s=f)}),o}return t.length&&t.reduce(n),r}function mt(e,t){let r={};function n(o,s,a,l,u){let c;O.range(s,a).forEach(d=>{c=o[d],e.node(c).dummy&&e.predecessors(c).forEach(h=>{let f=e.node(h);f.dummy&&(f.order<l||f.order>u)&&W(r,h,c)})})}function i(o,s){let a=-1,l,u=0;return s.forEach((c,d)=>{if(e.node(c).dummy==="border"){let h=e.predecessors(c);h.length&&(l=e.node(h[0]).order,n(s,u,d,a,l),u=d,a=l)}n(s,u,s.length,l,o.length)}),s}return t.length&&t.reduce(i),r}function Hn(e,t){if(e.node(t).dummy)return e.predecessors(t).find(r=>e.node(r).dummy)}function W(e,t,r){if(t>r){let i=t;t=r,r=i}let n=e[t];n||(e[t]=n={}),n[r]=!0}function wt(e,t,r){if(t>r){let n=t;t=r,r=n}return!!e[t]&&Object.hasOwn(e[t],r)}function bt(e,t,r,n){let i={},o={},s={};return t.forEach(a=>{a.forEach((l,u)=>{i[l]=l,o[l]=l,s[l]=u})}),t.forEach(a=>{let l=-1;a.forEach(u=>{let c=n(u);if(c.length){c=c.sort((h,f)=>s[h]-s[f]);let d=(c.length-1)/2;for(let h=Math.floor(d),f=Math.ceil(d);h<=f;++h){let m=c[h];o[u]===u&&l<s[m]&&!wt(r,u,m)&&(o[m]=u,o[u]=i[u]=i[m],l=s[m])}}})}),{root:i,align:o}}function vt(e,t,r,n,i){let o={},s=Un(e,t,r,i),a=i?"borderLeft":"borderRight";function l(d,h){let f=s.nodes().slice(),m={},p=f.pop();for(;p;){if(m[p])d(p);else{m[p]=!0,f.push(p);for(let w of h(p))f.push(w)}p=f.pop()}}function u(d){o[d]=s.inEdges(d).reduce((h,f)=>Math.max(h,o[f.v]+s.edge(f)),0)}function c(d){let h=s.outEdges(d).reduce((m,p)=>Math.min(m,o[p.w]-s.edge(p)),Number.POSITIVE_INFINITY),f=e.node(d);h!==Number.POSITIVE_INFINITY&&f.borderType!==a&&(o[d]=Math.max(o[d],h))}return l(u,s.predecessors.bind(s)),l(c,s.successors.bind(s)),Object.keys(n).forEach(d=>o[d]=o[r[d]]),o}function Un(e,t,r,n){let i=new Xn,o=e.graph(),s=Qn(o.nodesep,o.edgesep,n);return t.forEach(a=>{let l;a.forEach(u=>{let c=r[u];if(i.setNode(c),l){var d=r[l],h=i.edge(d,c);i.setEdge(d,c,Math.max(s(e,u,l),h||0))}l=u})}),i}function gt(e,t){return Object.values(t).reduce((r,n)=>{let i=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([a,l])=>{let u=Jn(e,a)/2;i=Math.max(l+u,i),o=Math.min(l-u,o)});let s=i-o;return s<r[0]&&(r=[s,n]),r},[Number.POSITIVE_INFINITY,null])[1]}function Et(e,t){let r=Object.values(t),n=O.applyWithChunking(Math.min,r),i=O.applyWithChunking(Math.max,r);["u","d"].forEach(o=>{["l","r"].forEach(s=>{let a=o+s,l=e[a];if(l===t)return;let u=Object.values(l),c=n-O.applyWithChunking(Math.min,u);s!=="l"&&(c=i-O.applyWithChunking(Math.max,u)),c&&(e[a]=O.mapValues(l,d=>d+c))})})}function _t(e,t){return O.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let i=Object.values(e).map(o=>o[n]).sort((o,s)=>o-s);return(i[1]+i[2])/2}})}function Kn(e){let t=O.buildLayerMatrix(e),r=Object.assign(pt(e,t),mt(e,t)),n={},i;["u","d"].forEach(s=>{i=s==="u"?t:Object.values(t).reverse(),["l","r"].forEach(a=>{a==="r"&&(i=i.map(d=>Object.values(d).reverse()));let l=(s==="u"?e.predecessors:e.successors).bind(e),u=bt(e,i,r,l),c=vt(e,i,u.root,u.align,a==="r");a==="r"&&(c=O.mapValues(c,d=>-d)),n[s+a]=c})});let o=gt(e,n);return Et(n,o),_t(n,e.graph().align)}function Qn(e,t,r){return(n,i,o)=>{let s=n.node(i),a=n.node(o),l=0,u;if(l+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(l+=r?u:-u),u=0,l+=(s.dummy?t:e)/2,l+=(a.dummy?t:e)/2,l+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=a.width/2;break;case"r":u=-a.width/2;break}return u&&(l+=r?u:-u),u=0,l}}function Jn(e,t){return e.node(t).width}});var Nt=v((ho,Ot)=>{"use strict";var xt=_(),Zn=yt().positionX;Ot.exports=$n;function $n(e){e=xt.asNonCompoundGraph(e),ei(e),Object.entries(Zn(e)).forEach(([t,r])=>e.node(t).x=r)}function ei(e){let t=xt.buildLayerMatrix(e),r=e.graph().ranksep,n=e.graph().rankalign,i=0;t.forEach(o=>{let s=o.reduce((a,l)=>{let u=e.node(l).height;return a>u?a:u},0);o.forEach(a=>{let l=e.node(a);n==="top"?l.y=i+l.height/2:n==="bottom"?l.y=i+s-l.height/2:l.y=i+s/2}),i+=s+r})}});var Rt=v((co,Mt)=>{"use strict";var It=pe(),jt=we(),ti=qe(),ri=_().normalizeRanks,ni=Re(),ii=_().removeEmptyRanks,Ct=Pe(),oi=Ge(),Lt=Be(),si=ft(),ai=Nt(),x=_(),di=y().Graph;Mt.exports=li;function li(e,t={}){let r=t.debugTiming?x.time:x.notime;return r("layout",()=>{let n=r(" buildLayoutGraph",()=>gi(e));return r(" runLayout",()=>ui(n,r,t)),r(" updateInputGraph",()=>hi(e,n)),n})}function ui(e,t,r){t(" makeSpaceForEdgeLabels",()=>Ei(e)),t(" removeSelfEdges",()=>Ci(e)),t(" acyclic",()=>It.run(e)),t(" nestingGraph.run",()=>Ct.run(e)),t(" rank",()=>ti(x.asNonCompoundGraph(e))),t(" injectEdgeLabelProxies",()=>_i(e)),t(" removeEmptyRanks",()=>ii(e)),t(" nestingGraph.cleanup",()=>Ct.cleanup(e)),t(" normalizeRanks",()=>ri(e)),t(" assignRankMinMax",()=>ki(e)),t(" removeEdgeLabelProxies",()=>yi(e)),t(" normalize.run",()=>jt.run(e)),t(" parentDummyChains",()=>ni(e)),t(" addBorderSegments",()=>oi(e)),t(" order",()=>si(e,r)),t(" insertSelfEdges",()=>Li(e)),t(" adjustCoordinateSystem",()=>Lt.adjust(e)),t(" position",()=>ai(e)),t(" positionSelfEdges",()=>qi(e)),t(" removeBorderNodes",()=>ji(e)),t(" normalize.undo",()=>jt.undo(e)),t(" fixupEdgeLabelCoords",()=>Ni(e)),t(" undoCoordinateSystem",()=>Lt.undo(e)),t(" translateGraph",()=>xi(e)),t(" assignNodeIntersects",()=>Oi(e)),t(" reversePoints",()=>Ii(e)),t(" acyclic.undo",()=>It.undo(e))}function hi(e,t){e.nodes().forEach(r=>{let n=e.node(r),i=t.node(r);n&&(n.x=i.x,n.y=i.y,n.order=i.order,n.rank=i.rank,t.children(r).length&&(n.width=i.width,n.height=i.height))}),e.edges().forEach(r=>{let n=e.edge(r),i=t.edge(r);n.points=i.points,Object.hasOwn(i,"x")&&(n.x=i.x,n.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var ci=["nodesep","edgesep","ranksep","marginx","marginy"],fi={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},pi=["acyclicer","ranker","rankdir","align","rankalign"],mi=["width","height","rank"],qt={width:0,height:0},wi=["minlen","weight","width","height","labeloffset"],bi={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},vi=["labelpos"];function gi(e){let t=new di({multigraph:!0,compound:!0}),r=X(e.graph());return t.setGraph(Object.assign({},fi,z(r,ci),x.pick(r,pi))),e.nodes().forEach(n=>{let i=X(e.node(n)),o=z(i,mi);Object.keys(qt).forEach(s=>{o[s]===void 0&&(o[s]=qt[s])}),t.setNode(n,o),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let i=X(e.edge(n));t.setEdge(n,Object.assign({},bi,z(i,wi),x.pick(i,vi)))}),t}function Ei(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(r=>{let n=e.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function _i(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.width&&r.height){let n=e.node(t.v),o={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};x.addDummyNode(e,"edge-proxy",o,"_ep")}})}function ki(e){let t=0;e.nodes().forEach(r=>{let n=e.node(r);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,t=Math.max(t,n.maxRank))}),e.graph().maxRank=t}function yi(e){e.nodes().forEach(t=>{let r=e.node(t);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(t))})}function xi(e){let t=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,o=e.graph(),s=o.marginx||0,a=o.marginy||0;function l(u){let c=u.x,d=u.y,h=u.width,f=u.height;t=Math.min(t,c-h/2),r=Math.max(r,c+h/2),n=Math.min(n,d-f/2),i=Math.max(i,d+f/2)}e.nodes().forEach(u=>l(e.node(u))),e.edges().forEach(u=>{let c=e.edge(u);Object.hasOwn(c,"x")&&l(c)}),t-=s,n-=a,e.nodes().forEach(u=>{let c=e.node(u);c.x-=t,c.y-=n}),e.edges().forEach(u=>{let c=e.edge(u);c.points.forEach(d=>{d.x-=t,d.y-=n}),Object.hasOwn(c,"x")&&(c.x-=t),Object.hasOwn(c,"y")&&(c.y-=n)}),o.width=r-t+s,o.height=i-n+a}function Oi(e){e.edges().forEach(t=>{let r=e.edge(t),n=e.node(t.v),i=e.node(t.w),o,s;r.points?(o=r.points[0],s=r.points[r.points.length-1]):(r.points=[],o=i,s=n),r.points.unshift(x.intersectRect(n,o)),r.points.push(x.intersectRect(i,s))})}function Ni(e){e.edges().forEach(t=>{let r=e.edge(t);if(Object.hasOwn(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Ii(e){e.edges().forEach(t=>{let r=e.edge(t);r.reversed&&r.points.reverse()})}function ji(e){e.nodes().forEach(t=>{if(e.children(t).length){let r=e.node(t),n=e.node(r.borderTop),i=e.node(r.borderBottom),o=e.node(r.borderLeft[r.borderLeft.length-1]),s=e.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-o.x),r.height=Math.abs(i.y-n.y),r.x=o.x+r.width/2,r.y=n.y+r.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Ci(e){e.edges().forEach(t=>{if(t.v===t.w){var r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Li(e){var t=x.buildLayerMatrix(e);t.forEach(r=>{var n=0;r.forEach((i,o)=>{var s=e.node(i);s.order=o+n,(s.selfEdges||[]).forEach(a=>{x.addDummyNode(e,"selfedge",{width:a.label.width,height:a.label.height,rank:s.rank,order:o+ ++n,e:a.e,label:a.label},"_se")}),delete s.selfEdges})})}function qi(e){e.nodes().forEach(t=>{var r=e.node(t);if(r.dummy==="selfedge"){var n=e.node(r.e.v),i=n.x+n.width/2,o=n.y,s=r.x-i,a=n.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*s/3,y:o-a},{x:i+5*s/6,y:o-a},{x:i+s,y:o},{x:i+5*s/6,y:o+a},{x:i+2*s/3,y:o+a}],r.label.x=r.x,r.label.y=r.y}})}function z(e,t){return x.mapValues(x.pick(e,t),Number)}function X(e){var t={};return e&&Object.entries(e).forEach(([r,n])=>{typeof r=="string"&&(r=r.toLowerCase()),t[r]=n}),t}});var St=v((fo,Tt)=>{var Mi=_(),Ri=y().Graph;Tt.exports={debugOrdering:Ti};function Ti(e){let t=Mi.buildLayerMatrix(e),r=new Ri({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(n=>{r.setNode(n,{label:n}),r.setParent(n,"layer"+e.node(n).rank)}),e.edges().forEach(n=>r.setEdge(n.v,n.w,{},n.name)),t.forEach((n,i)=>{let o="layer"+i;r.setNode(o,{rank:"same"}),n.reduce((s,a)=>(r.setEdge(s,a,{style:"invis"}),a))}),r}});var Ft=v((po,Pt)=>{Pt.exports="2.0.4"});var Si=v((mo,Dt)=>{Dt.exports={graphlib:y(),layout:Rt(),debug:St(),util:{time:_().time,notime:_().notime},version:Ft()}});export default Si();
|
|
2
2
|
/*! For license information please see dagre.esm.js.LEGAL.txt */
|
|
3
3
|
//# sourceMappingURL=dagre.esm.js.map
|