md/assets/architectureDiagram-WQGLKCSC-Dxi_6ZPb.js
2024-09-08 22:35:12 +00:00

37 lines
144 KiB
JavaScript

import{aK as Te,aL as ke,z as qe,_ as nt,aM as Je,aN as Qe,p as Ke,q as je,s as _e,g as tr,c as er,b as rr,d as fe,l as Se,j as ir,r as ar,E as nr,O as or,U as Ne,aO as Ee}from"./index-B6tbrWTF.js";import{p as sr}from"./chunk-OQCM5LHU-BsXIBOpO.js";import{I as hr}from"./chunk-2RYQ3QTB-DJ_JzLjR.js";import{p as lr}from"./gitGraph-YCYPL57B-DTSGC7mO.js";import{c as Fe}from"./cytoscape.esm-H9AIYce1.js";import"./min-CDGEiJAX.js";import"./_baseUniq-DiYoGI0k.js";var be={exports:{}},pe={exports:{}},ye={exports:{}},Oe;function fr(){return Oe||(Oe=1,function(M,Y){(function(G,N){M.exports=N()})(Te,function(){return function(C){var G={};function N(g){if(G[g])return G[g].exports;var s=G[g]={i:g,l:!1,exports:{}};return C[g].call(s.exports,s,s.exports,N),s.l=!0,s.exports}return N.m=C,N.c=G,N.i=function(g){return g},N.d=function(g,s,i){N.o(g,s)||Object.defineProperty(g,s,{configurable:!1,enumerable:!0,get:i})},N.n=function(g){var s=g&&g.__esModule?function(){return g.default}:function(){return g};return N.d(s,"a",s),s},N.o=function(g,s){return Object.prototype.hasOwnProperty.call(g,s)},N.p="",N(N.s=28)}([function(C,G,N){function g(){}g.QUALITY=1,g.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,g.DEFAULT_INCREMENTAL=!1,g.DEFAULT_ANIMATION_ON_LAYOUT=!0,g.DEFAULT_ANIMATION_DURING_LAYOUT=!1,g.DEFAULT_ANIMATION_PERIOD=50,g.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,g.DEFAULT_GRAPH_MARGIN=15,g.NODE_DIMENSIONS_INCLUDE_LABELS=!1,g.SIMPLE_NODE_SIZE=40,g.SIMPLE_NODE_HALF_SIZE=g.SIMPLE_NODE_SIZE/2,g.EMPTY_COMPOUND_NODE_SIZE=40,g.MIN_EDGE_LENGTH=1,g.WORLD_BOUNDARY=1e6,g.INITIAL_WORLD_BOUNDARY=g.WORLD_BOUNDARY/1e3,g.WORLD_CENTER_X=1200,g.WORLD_CENTER_Y=900,C.exports=g},function(C,G,N){var g=N(2),s=N(8),i=N(9);function r(f,a,y){g.call(this,y),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=y,this.bendpoints=[],this.source=f,this.target=a}r.prototype=Object.create(g.prototype);for(var e in g)r[e]=g[e];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,a){for(var y=this.getOtherEnd(f),t=a.getGraphManager().getRoot();;){if(y.getOwner()==a)return y;if(y.getOwner()==t)break;y=y.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=s.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r},function(C,G,N){function g(s){this.vGraphObject=s}C.exports=g},function(C,G,N){var g=N(2),s=N(10),i=N(13),r=N(0),e=N(16),f=N(5);function a(t,h,o,c){o==null&&c==null&&(c=h),g.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=s.MIN_VALUE,this.inclusionTreeDepth=s.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&h!=null?this.rect=new i(h.x,h.y,o.width,o.height):this.rect=new i}a.prototype=Object.create(g.prototype);for(var y in g)a[y]=g[y];a.prototype.getEdges=function(){return this.edges},a.prototype.getChild=function(){return this.child},a.prototype.getOwner=function(){return this.owner},a.prototype.getWidth=function(){return this.rect.width},a.prototype.setWidth=function(t){this.rect.width=t},a.prototype.getHeight=function(){return this.rect.height},a.prototype.setHeight=function(t){this.rect.height=t},a.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},a.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},a.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},a.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},a.prototype.getRect=function(){return this.rect},a.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},a.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},a.prototype.setRect=function(t,h){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=h.width,this.rect.height=h.height},a.prototype.setCenter=function(t,h){this.rect.x=t-this.rect.width/2,this.rect.y=h-this.rect.height/2},a.prototype.setLocation=function(t,h){this.rect.x=t,this.rect.y=h},a.prototype.moveBy=function(t,h){this.rect.x+=t,this.rect.y+=h},a.prototype.getEdgeListToNode=function(t){var h=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";h.push(c)}}),h},a.prototype.getEdgesBetween=function(t){var h=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&h.push(c)}),h},a.prototype.getNeighborsList=function(){var t=new Set,h=this;return h.edges.forEach(function(o){if(o.source==h)t.add(o.target);else{if(o.target!=h)throw"Incorrect incidency!";t.add(o.source)}}),t},a.prototype.withChildren=function(){var t=new Set,h,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),l=0;l<c.length;l++)h=c[l],o=h.withChildren(),o.forEach(function(T){t.add(T)});return t},a.prototype.getNoOfChildren=function(){var t=0,h;if(this.child==null)t=1;else for(var o=this.child.getNodes(),c=0;c<o.length;c++)h=o[c],t+=h.getNoOfChildren();return t==0&&(t=1),t},a.prototype.getEstimatedSize=function(){if(this.estimatedSize==s.MIN_VALUE)throw"assert failed";return this.estimatedSize},a.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},a.prototype.scatter=function(){var t,h,o=-r.INITIAL_WORLD_BOUNDARY,c=r.INITIAL_WORLD_BOUNDARY;t=r.WORLD_CENTER_X+e.nextDouble()*(c-o)+o;var l=-r.INITIAL_WORLD_BOUNDARY,T=r.INITIAL_WORLD_BOUNDARY;h=r.WORLD_CENTER_Y+e.nextDouble()*(T-l)+l,this.rect.x=t,this.rect.y=h},a.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var t=this.getChild();if(t.updateBounds(!0),this.rect.x=t.getLeft(),this.rect.y=t.getTop(),this.setWidth(t.getRight()-t.getLeft()),this.setHeight(t.getBottom()-t.getTop()),r.NODE_DIMENSIONS_INCLUDE_LABELS){var h=t.getRight()-t.getLeft(),o=t.getBottom()-t.getTop();this.labelWidth&&(this.labelPosHorizontal=="left"?(this.rect.x-=this.labelWidth,this.setWidth(h+this.labelWidth)):this.labelPosHorizontal=="center"&&this.labelWidth>h?(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(h+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},a.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==s.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},a.prototype.transform=function(t){var h=this.rect.x;h>r.WORLD_BOUNDARY?h=r.WORLD_BOUNDARY:h<-r.WORLD_BOUNDARY&&(h=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(h,o),l=t.inverseTransformPoint(c);this.setLocation(l.x,l.y)},a.prototype.getLeft=function(){return this.rect.x},a.prototype.getRight=function(){return this.rect.x+this.rect.width},a.prototype.getTop=function(){return this.rect.y},a.prototype.getBottom=function(){return this.rect.y+this.rect.height},a.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=a},function(C,G,N){var g=N(0);function s(){}for(var i in g)s[i]=g[i];s.MAX_ITERATIONS=2500,s.DEFAULT_EDGE_LENGTH=50,s.DEFAULT_SPRING_STRENGTH=.45,s.DEFAULT_REPULSION_STRENGTH=4500,s.DEFAULT_GRAVITY_STRENGTH=.4,s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,s.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,s.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,s.COOLING_ADAPTATION_FACTOR=.33,s.ADAPTATION_LOWER_NODE_LIMIT=1e3,s.ADAPTATION_UPPER_NODE_LIMIT=5e3,s.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,s.MAX_NODE_DISPLACEMENT=s.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,s.MIN_REPULSION_DIST=s.DEFAULT_EDGE_LENGTH/10,s.CONVERGENCE_CHECK_PERIOD=100,s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,s.MIN_EDGE_LENGTH=1,s.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=s},function(C,G,N){function g(s,i){s==null&&i==null?(this.x=0,this.y=0):(this.x=s,this.y=i)}g.prototype.getX=function(){return this.x},g.prototype.getY=function(){return this.y},g.prototype.setX=function(s){this.x=s},g.prototype.setY=function(s){this.y=s},g.prototype.getDifference=function(s){return new DimensionD(this.x-s.x,this.y-s.y)},g.prototype.getCopy=function(){return new g(this.x,this.y)},g.prototype.translate=function(s){return this.x+=s.width,this.y+=s.height,this},C.exports=g},function(C,G,N){var g=N(2),s=N(10),i=N(0),r=N(7),e=N(3),f=N(1),a=N(13),y=N(12),t=N(11);function h(c,l,T){g.call(this,T),this.estimatedSize=s.MIN_VALUE,this.margin=i.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,l!=null&&l instanceof r?this.graphManager=l:l!=null&&l instanceof Layout&&(this.graphManager=l.graphManager)}h.prototype=Object.create(g.prototype);for(var o in g)h[o]=g[o];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(c,l,T){if(l==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var v=c;if(!(this.getNodes().indexOf(l)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(l.owner==T.owner&&l.owner==this))throw"Both owners must be this graph!";return l.owner!=T.owner?null:(v.source=l,v.target=T,v.isInterGraph=!1,this.getEdges().push(v),l.edges.push(v),T!=l&&T.edges.push(v),v)}},h.prototype.remove=function(c){var l=c;if(c instanceof e){if(l==null)throw"Node is null!";if(!(l.owner!=null&&l.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=l.edges.slice(),u,v=T.length,L=0;L<v;L++)u=T[L],u.isInterGraph?this.graphManager.remove(u):u.source.owner.remove(u);var F=this.nodes.indexOf(l);if(F==-1)throw"Node not in owner node list!";this.nodes.splice(F,1)}else if(c instanceof f){var u=c;if(u==null)throw"Edge is null!";if(!(u.source!=null&&u.target!=null))throw"Source and/or target is null!";if(!(u.source.owner!=null&&u.target.owner!=null&&u.source.owner==this&&u.target.owner==this))throw"Source and/or target owner is invalid!";var A=u.source.edges.indexOf(u),P=u.target.edges.indexOf(u);if(!(A>-1&&P>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(A,1),u.target!=u.source&&u.target.edges.splice(P,1);var F=u.source.owner.getEdges().indexOf(u);if(F==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(F,1)}},h.prototype.updateLeftTop=function(){for(var c=s.MAX_VALUE,l=s.MAX_VALUE,T,u,v,L=this.getNodes(),F=L.length,A=0;A<F;A++){var P=L[A];T=P.getTop(),u=P.getLeft(),c>T&&(c=T),l>u&&(l=u)}return c==s.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?v=L[0].getParent().paddingLeft:v=this.margin,this.left=l-v,this.top=c-v,new y(this.left,this.top))},h.prototype.updateBounds=function(c){for(var l=s.MAX_VALUE,T=-s.MAX_VALUE,u=s.MAX_VALUE,v=-s.MAX_VALUE,L,F,A,P,J,V=this.nodes,Q=V.length,D=0;D<Q;D++){var rt=V[D];c&&rt.child!=null&&rt.updateBounds(),L=rt.getLeft(),F=rt.getRight(),A=rt.getTop(),P=rt.getBottom(),l>L&&(l=L),T<F&&(T=F),u>A&&(u=A),v<P&&(v=P)}var n=new a(l,u,T-l,v-u);l==s.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),V[0].getParent().paddingLeft!=null?J=V[0].getParent().paddingLeft:J=this.margin,this.left=n.x-J,this.right=n.x+n.width+J,this.top=n.y-J,this.bottom=n.y+n.height+J},h.calculateBounds=function(c){for(var l=s.MAX_VALUE,T=-s.MAX_VALUE,u=s.MAX_VALUE,v=-s.MAX_VALUE,L,F,A,P,J=c.length,V=0;V<J;V++){var Q=c[V];L=Q.getLeft(),F=Q.getRight(),A=Q.getTop(),P=Q.getBottom(),l>L&&(l=L),T<F&&(T=F),u>A&&(u=A),v<P&&(v=P)}var D=new a(l,u,T-l,v-u);return D},h.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},h.prototype.getEstimatedSize=function(){if(this.estimatedSize==s.MIN_VALUE)throw"assert failed";return this.estimatedSize},h.prototype.calcEstimatedSize=function(){for(var c=0,l=this.nodes,T=l.length,u=0;u<T;u++){var v=l[u];c+=v.calcEstimatedSize()}return c==0?this.estimatedSize=i.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=c/Math.sqrt(this.nodes.length),this.estimatedSize},h.prototype.updateConnected=function(){var c=this;if(this.nodes.length==0){this.isConnected=!0;return}var l=new t,T=new Set,u=this.nodes[0],v,L,F=u.withChildren();for(F.forEach(function(D){l.push(D),T.add(D)});l.length!==0;){u=l.shift(),v=u.getEdges();for(var A=v.length,P=0;P<A;P++){var J=v[P];if(L=J.getOtherEndInGraph(u,this),L!=null&&!T.has(L)){var V=L.withChildren();V.forEach(function(D){l.push(D),T.add(D)})}}}if(this.isConnected=!1,T.size>=this.nodes.length){var Q=0;T.forEach(function(D){D.owner==c&&Q++}),Q==this.nodes.length&&(this.isConnected=!0)}},C.exports=h},function(C,G,N){var g,s=N(1);function i(r){g=N(6),this.layout=r,this.graphs=[],this.edges=[]}i.prototype.addRoot=function(){var r=this.layout.newGraph(),e=this.layout.newNode(null),f=this.add(r,e);return this.setRootGraph(f),this.rootGraph},i.prototype.add=function(r,e,f,a,y){if(f==null&&a==null&&y==null){if(r==null)throw"Graph is null!";if(e==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(e.child!=null)throw"Already has a child!";return r.parent=e,e.child=r,r}else{y=f,a=e,f=r;var t=a.getOwner(),h=y.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==h)return f.isInterGraph=!1,t.add(f,a,y);if(f.isInterGraph=!0,f.source=a,f.target=y,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},i.prototype.remove=function(r){if(r instanceof g){var e=r;if(e.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(e==this.rootGraph||e.parent!=null&&e.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(e.getEdges());for(var a,y=f.length,t=0;t<y;t++)a=f[t],e.remove(a);var h=[];h=h.concat(e.getNodes());var o;y=h.length;for(var t=0;t<y;t++)o=h[t],e.remove(o);e==this.rootGraph&&this.setRootGraph(null);var c=this.graphs.indexOf(e);this.graphs.splice(c,1),e.parent=null}else if(r instanceof s){if(a=r,a==null)throw"Edge is null!";if(!a.isInterGraph)throw"Not an inter-graph edge!";if(!(a.source!=null&&a.target!=null))throw"Source and/or target is null!";if(!(a.source.edges.indexOf(a)!=-1&&a.target.edges.indexOf(a)!=-1))throw"Source and/or target doesn't know this edge!";var c=a.source.edges.indexOf(a);if(a.source.edges.splice(c,1),c=a.target.edges.indexOf(a),a.target.edges.splice(c,1),!(a.source.owner!=null&&a.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(a.source.owner.getGraphManager().edges.indexOf(a)==-1)throw"Not in owner graph manager's edge list!";var c=a.source.owner.getGraphManager().edges.indexOf(a);a.source.owner.getGraphManager().edges.splice(c,1)}},i.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},i.prototype.getGraphs=function(){return this.graphs},i.prototype.getAllNodes=function(){if(this.allNodes==null){for(var r=[],e=this.getGraphs(),f=e.length,a=0;a<f;a++)r=r.concat(e[a].getNodes());this.allNodes=r}return this.allNodes},i.prototype.resetAllNodes=function(){this.allNodes=null},i.prototype.resetAllEdges=function(){this.allEdges=null},i.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},i.prototype.getAllEdges=function(){if(this.allEdges==null){var r=[],e=this.getGraphs();e.length;for(var f=0;f<e.length;f++)r=r.concat(e[f].getEdges());r=r.concat(this.edges),this.allEdges=r}return this.allEdges},i.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},i.prototype.setAllNodesToApplyGravitation=function(r){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=r},i.prototype.getRoot=function(){return this.rootGraph},i.prototype.setRootGraph=function(r){if(r.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=r,r.parent==null&&(r.parent=this.layout.newNode("Root node"))},i.prototype.getLayout=function(){return this.layout},i.prototype.isOneAncestorOfOther=function(r,e){if(!(r!=null&&e!=null))throw"assert failed";if(r==e)return!0;var f=r.getOwner(),a;do{if(a=f.getParent(),a==null)break;if(a==e)return!0;if(f=a.getOwner(),f==null)break}while(!0);f=e.getOwner();do{if(a=f.getParent(),a==null)break;if(a==r)return!0;if(f=a.getOwner(),f==null)break}while(!0);return!1},i.prototype.calcLowestCommonAncestors=function(){for(var r,e,f,a,y,t=this.getAllEdges(),h=t.length,o=0;o<h;o++){if(r=t[o],e=r.source,f=r.target,r.lca=null,r.sourceInLca=e,r.targetInLca=f,e==f){r.lca=e.getOwner();continue}for(a=e.getOwner();r.lca==null;){for(r.targetInLca=f,y=f.getOwner();r.lca==null;){if(y==a){r.lca=y;break}if(y==this.rootGraph)break;if(r.lca!=null)throw"assert failed";r.targetInLca=y.getParent(),y=r.targetInLca.getOwner()}if(a==this.rootGraph)break;r.lca==null&&(r.sourceInLca=a.getParent(),a=r.sourceInLca.getOwner())}if(r.lca==null)throw"assert failed"}},i.prototype.calcLowestCommonAncestor=function(r,e){if(r==e)return r.getOwner();var f=r.getOwner();do{if(f==null)break;var a=e.getOwner();do{if(a==null)break;if(a==f)return a;a=a.getParent().getOwner()}while(!0);f=f.getParent().getOwner()}while(!0);return f},i.prototype.calcInclusionTreeDepths=function(r,e){r==null&&e==null&&(r=this.rootGraph,e=1);for(var f,a=r.getNodes(),y=a.length,t=0;t<y;t++)f=a[t],f.inclusionTreeDepth=e,f.child!=null&&this.calcInclusionTreeDepths(f.child,e+1)},i.prototype.includesInvalidEdge=function(){for(var r,e=[],f=this.edges.length,a=0;a<f;a++)r=this.edges[a],this.isOneAncestorOfOther(r.source,r.target)&&e.push(r);for(var a=0;a<e.length;a++)this.remove(e[a]);return!1},C.exports=i},function(C,G,N){var g=N(12);function s(){}s.calcSeparationAmount=function(i,r,e,f){if(!i.intersects(r))throw"assert failed";var a=new Array(2);this.decideDirectionsForOverlappingNodes(i,r,a),e[0]=Math.min(i.getRight(),r.getRight())-Math.max(i.x,r.x),e[1]=Math.min(i.getBottom(),r.getBottom())-Math.max(i.y,r.y),i.getX()<=r.getX()&&i.getRight()>=r.getRight()?e[0]+=Math.min(r.getX()-i.getX(),i.getRight()-r.getRight()):r.getX()<=i.getX()&&r.getRight()>=i.getRight()&&(e[0]+=Math.min(i.getX()-r.getX(),r.getRight()-i.getRight())),i.getY()<=r.getY()&&i.getBottom()>=r.getBottom()?e[1]+=Math.min(r.getY()-i.getY(),i.getBottom()-r.getBottom()):r.getY()<=i.getY()&&r.getBottom()>=i.getBottom()&&(e[1]+=Math.min(i.getY()-r.getY(),r.getBottom()-i.getBottom()));var y=Math.abs((r.getCenterY()-i.getCenterY())/(r.getCenterX()-i.getCenterX()));r.getCenterY()===i.getCenterY()&&r.getCenterX()===i.getCenterX()&&(y=1);var t=y*e[0],h=e[1]/y;e[0]<h?h=e[0]:t=e[1],e[0]=-1*a[0]*(h/2+f),e[1]=-1*a[1]*(t/2+f)},s.decideDirectionsForOverlappingNodes=function(i,r,e){i.getCenterX()<r.getCenterX()?e[0]=-1:e[0]=1,i.getCenterY()<r.getCenterY()?e[1]=-1:e[1]=1},s.getIntersection2=function(i,r,e){var f=i.getCenterX(),a=i.getCenterY(),y=r.getCenterX(),t=r.getCenterY();if(i.intersects(r))return e[0]=f,e[1]=a,e[2]=y,e[3]=t,!0;var h=i.getX(),o=i.getY(),c=i.getRight(),l=i.getX(),T=i.getBottom(),u=i.getRight(),v=i.getWidthHalf(),L=i.getHeightHalf(),F=r.getX(),A=r.getY(),P=r.getRight(),J=r.getX(),V=r.getBottom(),Q=r.getRight(),D=r.getWidthHalf(),rt=r.getHeightHalf(),n=!1,m=!1;if(f===y){if(a>t)return e[0]=f,e[1]=o,e[2]=y,e[3]=V,!1;if(a<t)return e[0]=f,e[1]=T,e[2]=y,e[3]=A,!1}else if(a===t){if(f>y)return e[0]=h,e[1]=a,e[2]=P,e[3]=t,!1;if(f<y)return e[0]=c,e[1]=a,e[2]=F,e[3]=t,!1}else{var d=i.height/i.width,E=r.height/r.width,p=(t-a)/(y-f),R=void 0,w=void 0,I=void 0,H=void 0,x=void 0,k=void 0;if(-d===p?f>y?(e[0]=l,e[1]=T,n=!0):(e[0]=c,e[1]=o,n=!0):d===p&&(f>y?(e[0]=h,e[1]=o,n=!0):(e[0]=u,e[1]=T,n=!0)),-E===p?y>f?(e[2]=J,e[3]=V,m=!0):(e[2]=P,e[3]=A,m=!0):E===p&&(y>f?(e[2]=F,e[3]=A,m=!0):(e[2]=Q,e[3]=V,m=!0)),n&&m)return!1;if(f>y?a>t?(R=this.getCardinalDirection(d,p,4),w=this.getCardinalDirection(E,p,2)):(R=this.getCardinalDirection(-d,p,3),w=this.getCardinalDirection(-E,p,1)):a>t?(R=this.getCardinalDirection(-d,p,1),w=this.getCardinalDirection(-E,p,3)):(R=this.getCardinalDirection(d,p,2),w=this.getCardinalDirection(E,p,4)),!n)switch(R){case 1:H=o,I=f+-L/p,e[0]=I,e[1]=H;break;case 2:I=u,H=a+v*p,e[0]=I,e[1]=H;break;case 3:H=T,I=f+L/p,e[0]=I,e[1]=H;break;case 4:I=l,H=a+-v*p,e[0]=I,e[1]=H;break}if(!m)switch(w){case 1:k=A,x=y+-rt/p,e[2]=x,e[3]=k;break;case 2:x=Q,k=t+D*p,e[2]=x,e[3]=k;break;case 3:k=V,x=y+rt/p,e[2]=x,e[3]=k;break;case 4:x=J,k=t+-D*p,e[2]=x,e[3]=k;break}}return!1},s.getCardinalDirection=function(i,r,e){return i>r?e:1+e%4},s.getIntersection=function(i,r,e,f){if(f==null)return this.getIntersection2(i,r,e);var a=i.x,y=i.y,t=r.x,h=r.y,o=e.x,c=e.y,l=f.x,T=f.y,u=void 0,v=void 0,L=void 0,F=void 0,A=void 0,P=void 0,J=void 0,V=void 0,Q=void 0;return L=h-y,A=a-t,J=t*y-a*h,F=T-c,P=o-l,V=l*c-o*T,Q=L*P-F*A,Q===0?null:(u=(A*V-P*J)/Q,v=(F*J-L*V)/Q,new g(u,v))},s.angleOfVector=function(i,r,e,f){var a=void 0;return i!==e?(a=Math.atan((f-r)/(e-i)),e<i?a+=Math.PI:f<r&&(a+=this.TWO_PI)):f<r?a=this.ONE_AND_HALF_PI:a=this.HALF_PI,a},s.doIntersect=function(i,r,e,f){var a=i.x,y=i.y,t=r.x,h=r.y,o=e.x,c=e.y,l=f.x,T=f.y,u=(t-a)*(T-c)-(l-o)*(h-y);if(u===0)return!1;var v=((T-c)*(l-a)+(o-l)*(T-y))/u,L=((y-h)*(l-a)+(t-a)*(T-y))/u;return 0<v&&v<1&&0<L&&L<1},s.findCircleLineIntersections=function(i,r,e,f,a,y,t){var h=(e-i)*(e-i)+(f-r)*(f-r),o=2*((i-a)*(e-i)+(r-y)*(f-r)),c=(i-a)*(i-a)+(r-y)*(r-y)-t*t,l=o*o-4*h*c;if(l>=0){var T=(-o+Math.sqrt(o*o-4*h*c))/(2*h),u=(-o-Math.sqrt(o*o-4*h*c))/(2*h),v=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:v}else return null},s.HALF_PI=.5*Math.PI,s.ONE_AND_HALF_PI=1.5*Math.PI,s.TWO_PI=2*Math.PI,s.THREE_PI=3*Math.PI,C.exports=s},function(C,G,N){function g(){}g.sign=function(s){return s>0?1:s<0?-1:0},g.floor=function(s){return s<0?Math.ceil(s):Math.floor(s)},g.ceil=function(s){return s<0?Math.floor(s):Math.ceil(s)},C.exports=g},function(C,G,N){function g(){}g.MAX_VALUE=2147483647,g.MIN_VALUE=-2147483648,C.exports=g},function(C,G,N){var g=function(){function a(y,t){for(var h=0;h<t.length;h++){var o=t[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(y,o.key,o)}}return function(y,t,h){return t&&a(y.prototype,t),h&&a(y,h),y}}();function s(a,y){if(!(a instanceof y))throw new TypeError("Cannot call a class as a function")}var i=function(y){return{value:y,next:null,prev:null}},r=function(y,t,h,o){return y!==null?y.next=t:o.head=t,h!==null?h.prev=t:o.tail=t,t.prev=y,t.next=h,o.length++,t},e=function(y,t){var h=y.prev,o=y.next;return h!==null?h.next=o:t.head=o,o!==null?o.prev=h:t.tail=h,y.prev=y.next=null,t.length--,y},f=function(){function a(y){var t=this;s(this,a),this.length=0,this.head=null,this.tail=null,y!=null&&y.forEach(function(h){return t.push(h)})}return g(a,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(t,h){return r(h.prev,i(t),h,this)}},{key:"insertAfter",value:function(t,h){return r(h,i(t),h.next,this)}},{key:"insertNodeBefore",value:function(t,h){return r(h.prev,t,h,this)}},{key:"insertNodeAfter",value:function(t,h){return r(h,t,h.next,this)}},{key:"push",value:function(t){return r(this.tail,i(t),null,this)}},{key:"unshift",value:function(t){return r(null,i(t),this.head,this)}},{key:"remove",value:function(t){return e(t,this)}},{key:"pop",value:function(){return e(this.tail,this).value}},{key:"popNode",value:function(){return e(this.tail,this)}},{key:"shift",value:function(){return e(this.head,this).value}},{key:"shiftNode",value:function(){return e(this.head,this)}},{key:"get_object_at",value:function(t){if(t<=this.length()){for(var h=1,o=this.head;h<t;)o=o.next,h++;return o.value}}},{key:"set_object_at",value:function(t,h){if(t<=this.length()){for(var o=1,c=this.head;o<t;)c=c.next,o++;c.value=h}}}]),a}();C.exports=f},function(C,G,N){function g(s,i,r){this.x=null,this.y=null,s==null&&i==null&&r==null?(this.x=0,this.y=0):typeof s=="number"&&typeof i=="number"&&r==null?(this.x=s,this.y=i):s.constructor.name=="Point"&&i==null&&r==null&&(r=s,this.x=r.x,this.y=r.y)}g.prototype.getX=function(){return this.x},g.prototype.getY=function(){return this.y},g.prototype.getLocation=function(){return new g(this.x,this.y)},g.prototype.setLocation=function(s,i,r){s.constructor.name=="Point"&&i==null&&r==null?(r=s,this.setLocation(r.x,r.y)):typeof s=="number"&&typeof i=="number"&&r==null&&(parseInt(s)==s&&parseInt(i)==i?this.move(s,i):(this.x=Math.floor(s+.5),this.y=Math.floor(i+.5)))},g.prototype.move=function(s,i){this.x=s,this.y=i},g.prototype.translate=function(s,i){this.x+=s,this.y+=i},g.prototype.equals=function(s){if(s.constructor.name=="Point"){var i=s;return this.x==i.x&&this.y==i.y}return this==s},g.prototype.toString=function(){return new g().constructor.name+"[x="+this.x+",y="+this.y+"]"},C.exports=g},function(C,G,N){function g(s,i,r,e){this.x=0,this.y=0,this.width=0,this.height=0,s!=null&&i!=null&&r!=null&&e!=null&&(this.x=s,this.y=i,this.width=r,this.height=e)}g.prototype.getX=function(){return this.x},g.prototype.setX=function(s){this.x=s},g.prototype.getY=function(){return this.y},g.prototype.setY=function(s){this.y=s},g.prototype.getWidth=function(){return this.width},g.prototype.setWidth=function(s){this.width=s},g.prototype.getHeight=function(){return this.height},g.prototype.setHeight=function(s){this.height=s},g.prototype.getRight=function(){return this.x+this.width},g.prototype.getBottom=function(){return this.y+this.height},g.prototype.intersects=function(s){return!(this.getRight()<s.x||this.getBottom()<s.y||s.getRight()<this.x||s.getBottom()<this.y)},g.prototype.getCenterX=function(){return this.x+this.width/2},g.prototype.getMinX=function(){return this.getX()},g.prototype.getMaxX=function(){return this.getX()+this.width},g.prototype.getCenterY=function(){return this.y+this.height/2},g.prototype.getMinY=function(){return this.getY()},g.prototype.getMaxY=function(){return this.getY()+this.height},g.prototype.getWidthHalf=function(){return this.width/2},g.prototype.getHeightHalf=function(){return this.height/2},C.exports=g},function(C,G,N){var g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i};function s(){}s.lastID=0,s.createID=function(i){return s.isPrimitive(i)?i:(i.uniqueID!=null||(i.uniqueID=s.getString(),s.lastID++),i.uniqueID)},s.getString=function(i){return i==null&&(i=s.lastID),"Object#"+i},s.isPrimitive=function(i){var r=typeof i>"u"?"undefined":g(i);return i==null||r!="object"&&r!="function"},C.exports=s},function(C,G,N){function g(o){if(Array.isArray(o)){for(var c=0,l=Array(o.length);c<o.length;c++)l[c]=o[c];return l}else return Array.from(o)}var s=N(0),i=N(7),r=N(3),e=N(1),f=N(6),a=N(5),y=N(17),t=N(29);function h(o){t.call(this),this.layoutQuality=s.QUALITY,this.createBendsAsNeeded=s.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=s.DEFAULT_INCREMENTAL,this.animationOnLayout=s.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=s.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=s.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=s.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new i(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,o!=null&&(this.isRemoteUse=o)}h.RANDOM_SEED=1,h.prototype=Object.create(t.prototype),h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},h.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},h.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},h.prototype.newGraphManager=function(){var o=new i(this);return this.graphManager=o,o},h.prototype.newGraph=function(o){return new f(null,this.graphManager,o)},h.prototype.newNode=function(o){return new r(this.graphManager,o)},h.prototype.newEdge=function(o){return new e(null,null,o)},h.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},h.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var o;return this.checkLayoutSuccess()?o=!1:o=this.layout(),s.ANIMATE==="during"?!1:(o&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,o)},h.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},h.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var o=this.graphManager.getAllEdges(),c=0;c<o.length;c++)o[c];for(var l=this.graphManager.getRoot().getNodes(),c=0;c<l.length;c++)l[c];this.update(this.graphManager.getRoot())}},h.prototype.update=function(o){if(o==null)this.update2();else if(o instanceof r){var c=o;if(c.getChild()!=null)for(var l=c.getChild().getNodes(),T=0;T<l.length;T++)update(l[T]);if(c.vGraphObject!=null){var u=c.vGraphObject;u.update(c)}}else if(o instanceof e){var v=o;if(v.vGraphObject!=null){var L=v.vGraphObject;L.update(v)}}else if(o instanceof f){var F=o;if(F.vGraphObject!=null){var A=F.vGraphObject;A.update(F)}}},h.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=s.QUALITY,this.animationDuringLayout=s.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=s.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=s.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=s.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=s.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=s.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},h.prototype.transform=function(o){if(o==null)this.transform(new a(0,0));else{var c=new y,l=this.graphManager.getRoot().updateLeftTop();if(l!=null){c.setWorldOrgX(o.x),c.setWorldOrgY(o.y),c.setDeviceOrgX(l.x),c.setDeviceOrgY(l.y);for(var T=this.getAllNodes(),u,v=0;v<T.length;v++)u=T[v],u.transform(c)}}},h.prototype.positionNodesRandomly=function(o){if(o==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var c,l,T=o.getNodes(),u=0;u<T.length;u++)c=T[u],l=c.getChild(),l==null||l.getNodes().length==0?c.scatter():(this.positionNodesRandomly(l),c.updateBounds())},h.prototype.getFlatForest=function(){for(var o=[],c=!0,l=this.graphManager.getRoot().getNodes(),T=!0,u=0;u<l.length;u++)l[u].getChild()!=null&&(T=!1);if(!T)return o;var v=new Set,L=[],F=new Map,A=[];for(A=A.concat(l);A.length>0&&c;){for(L.push(A[0]);L.length>0&&c;){var P=L[0];L.splice(0,1),v.add(P);for(var J=P.getEdges(),u=0;u<J.length;u++){var V=J[u].getOtherEnd(P);if(F.get(P)!=V)if(!v.has(V))L.push(V),F.set(V,P);else{c=!1;break}}}if(!c)o=[];else{var Q=[].concat(g(v));o.push(Q);for(var u=0;u<Q.length;u++){var D=Q[u],rt=A.indexOf(D);rt>-1&&A.splice(rt,1)}v=new Set,F=new Map}}return o},h.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],l=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),u=0;u<o.bendpoints.length;u++){var v=this.newNode(null);v.setRect(new Point(0,0),new Dimension(1,1)),T.add(v);var L=this.newEdge(null);this.graphManager.add(L,l,v),c.add(v),l=v}var L=this.newEdge(null);return this.graphManager.add(L,l,o.target),this.edgeToDummyNodes.set(o,c),o.isInterGraph()?this.graphManager.remove(o):T.remove(o),c},h.prototype.createBendpointsFromDummyNodes=function(){var o=[];o=o.concat(this.graphManager.getAllEdges()),o=[].concat(g(this.edgeToDummyNodes.keys())).concat(o);for(var c=0;c<o.length;c++){var l=o[c];if(l.bendpoints.length>0){for(var T=this.edgeToDummyNodes.get(l),u=0;u<T.length;u++){var v=T[u],L=new a(v.getCenterX(),v.getCenterY()),F=l.bendpoints.get(u);F.x=L.x,F.y=L.y,v.getOwner().remove(v)}this.graphManager.add(l,l.source,l.target)}}},h.transform=function(o,c,l,T){if(l!=null&&T!=null){var u=c;if(o<=50){var v=c/l;u-=(c-v)/50*(50-o)}else{var L=c*T;u+=(L-c)/50*(o-50)}return u}else{var F,A;return o<=50?(F=9*c/500,A=c/10):(F=9*c/50,A=-8*c),F*o+A}},h.findCenterOfTree=function(o){var c=[];c=c.concat(o);var l=[],T=new Map,u=!1,v=null;(c.length==1||c.length==2)&&(u=!0,v=c[0]);for(var L=0;L<c.length;L++){var F=c[L],A=F.getNeighborsList().size;T.set(F,F.getNeighborsList().size),A==1&&l.push(F)}var P=[];for(P=P.concat(l);!u;){var J=[];J=J.concat(P),P=[];for(var L=0;L<c.length;L++){var F=c[L],V=c.indexOf(F);V>=0&&c.splice(V,1);var Q=F.getNeighborsList();Q.forEach(function(n){if(l.indexOf(n)<0){var m=T.get(n),d=m-1;d==1&&P.push(n),T.set(n,d)}})}l=l.concat(P),(c.length==1||c.length==2)&&(u=!0,v=c[0])}return v},h.prototype.setGraphManager=function(o){this.graphManager=o},C.exports=h},function(C,G,N){function g(){}g.seed=1,g.x=0,g.nextDouble=function(){return g.x=Math.sin(g.seed++)*1e4,g.x-Math.floor(g.x)},C.exports=g},function(C,G,N){var g=N(5);function s(i,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}s.prototype.getWorldOrgX=function(){return this.lworldOrgX},s.prototype.setWorldOrgX=function(i){this.lworldOrgX=i},s.prototype.getWorldOrgY=function(){return this.lworldOrgY},s.prototype.setWorldOrgY=function(i){this.lworldOrgY=i},s.prototype.getWorldExtX=function(){return this.lworldExtX},s.prototype.setWorldExtX=function(i){this.lworldExtX=i},s.prototype.getWorldExtY=function(){return this.lworldExtY},s.prototype.setWorldExtY=function(i){this.lworldExtY=i},s.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},s.prototype.setDeviceOrgX=function(i){this.ldeviceOrgX=i},s.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},s.prototype.setDeviceOrgY=function(i){this.ldeviceOrgY=i},s.prototype.getDeviceExtX=function(){return this.ldeviceExtX},s.prototype.setDeviceExtX=function(i){this.ldeviceExtX=i},s.prototype.getDeviceExtY=function(){return this.ldeviceExtY},s.prototype.setDeviceExtY=function(i){this.ldeviceExtY=i},s.prototype.transformX=function(i){var r=0,e=this.lworldExtX;return e!=0&&(r=this.ldeviceOrgX+(i-this.lworldOrgX)*this.ldeviceExtX/e),r},s.prototype.transformY=function(i){var r=0,e=this.lworldExtY;return e!=0&&(r=this.ldeviceOrgY+(i-this.lworldOrgY)*this.ldeviceExtY/e),r},s.prototype.inverseTransformX=function(i){var r=0,e=this.ldeviceExtX;return e!=0&&(r=this.lworldOrgX+(i-this.ldeviceOrgX)*this.lworldExtX/e),r},s.prototype.inverseTransformY=function(i){var r=0,e=this.ldeviceExtY;return e!=0&&(r=this.lworldOrgY+(i-this.ldeviceOrgY)*this.lworldExtY/e),r},s.prototype.inverseTransformPoint=function(i){var r=new g(this.inverseTransformX(i.x),this.inverseTransformY(i.y));return r},C.exports=s},function(C,G,N){function g(t){if(Array.isArray(t)){for(var h=0,o=Array(t.length);h<t.length;h++)o[h]=t[h];return o}else return Array.from(t)}var s=N(15),i=N(4),r=N(0),e=N(8),f=N(9);function a(){s.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}a.prototype=Object.create(s.prototype);for(var y in s)a[y]=s[y];a.prototype.initParameters=function(){s.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},a.prototype.calcIdealEdgeLengths=function(){for(var t,h,o,c,l,T,u,v=this.getGraphManager().getAllEdges(),L=0;L<v.length;L++)t=v[L],h=t.idealLength,t.isInterGraph&&(c=t.getSource(),l=t.getTarget(),T=t.getSourceInLca().getEstimatedSize(),u=t.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(t.idealLength+=T+u-2*r.SIMPLE_NODE_SIZE),o=t.getLca().getInclusionTreeDepth(),t.idealLength+=h*i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(c.getInclusionTreeDepth()+l.getInclusionTreeDepth()-2*o))},a.prototype.initSpringEmbedder=function(){var t=this.getAllNodes().length;this.incremental?(t>i.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},a.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),h,o=0;o<t.length;o++)h=t[o],this.calcSpringForce(h,h.idealLength)},a.prototype.calcRepulsionForces=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,l,T,u=this.getAllNodes(),v;if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),v=new Set,o=0;o<u.length;o++)l=u[o],this.calculateRepulsionForceOfANode(l,v,t,h),v.add(l);else for(o=0;o<u.length;o++)for(l=u[o],c=o+1;c<u.length;c++)T=u[c],l.getOwner()==T.getOwner()&&this.calcRepulsionForce(l,T)},a.prototype.calcGravitationalForces=function(){for(var t,h=this.getAllNodesToApplyGravitation(),o=0;o<h.length;o++)t=h[o],this.calcGravitationalForce(t)},a.prototype.moveNodes=function(){for(var t=this.getAllNodes(),h,o=0;o<t.length;o++)h=t[o],h.move()},a.prototype.calcSpringForce=function(t,h){var o=t.getSource(),c=t.getTarget(),l,T,u,v;if(this.uniformLeafNodeSizes&&o.getChild()==null&&c.getChild()==null)t.updateLengthSimple();else if(t.updateLength(),t.isOverlapingSourceAndTarget)return;l=t.getLength(),l!=0&&(T=t.edgeElasticity*(l-h),u=T*(t.lengthX/l),v=T*(t.lengthY/l),o.springForceX+=u,o.springForceY+=v,c.springForceX-=u,c.springForceY-=v)},a.prototype.calcRepulsionForce=function(t,h){var o=t.getRect(),c=h.getRect(),l=new Array(2),T=new Array(4),u,v,L,F,A,P,J;if(o.intersects(c)){e.calcSeparationAmount(o,c,l,i.DEFAULT_EDGE_LENGTH/2),P=2*l[0],J=2*l[1];var V=t.noOfChildren*h.noOfChildren/(t.noOfChildren+h.noOfChildren);t.repulsionForceX-=V*P,t.repulsionForceY-=V*J,h.repulsionForceX+=V*P,h.repulsionForceY+=V*J}else this.uniformLeafNodeSizes&&t.getChild()==null&&h.getChild()==null?(u=c.getCenterX()-o.getCenterX(),v=c.getCenterY()-o.getCenterY()):(e.getIntersection(o,c,T),u=T[2]-T[0],v=T[3]-T[1]),Math.abs(u)<i.MIN_REPULSION_DIST&&(u=f.sign(u)*i.MIN_REPULSION_DIST),Math.abs(v)<i.MIN_REPULSION_DIST&&(v=f.sign(v)*i.MIN_REPULSION_DIST),L=u*u+v*v,F=Math.sqrt(L),A=(t.nodeRepulsion/2+h.nodeRepulsion/2)*t.noOfChildren*h.noOfChildren/L,P=A*u/F,J=A*v/F,t.repulsionForceX-=P,t.repulsionForceY-=J,h.repulsionForceX+=P,h.repulsionForceY+=J},a.prototype.calcGravitationalForce=function(t){var h,o,c,l,T,u,v,L;h=t.getOwner(),o=(h.getRight()+h.getLeft())/2,c=(h.getTop()+h.getBottom())/2,l=t.getCenterX()-o,T=t.getCenterY()-c,u=Math.abs(l)+t.getWidth()/2,v=Math.abs(T)+t.getHeight()/2,t.getOwner()==this.graphManager.getRoot()?(L=h.getEstimatedSize()*this.gravityRangeFactor,(u>L||v>L)&&(t.gravitationForceX=-this.gravityConstant*l,t.gravitationForceY=-this.gravityConstant*T)):(L=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||v>L)&&(t.gravitationForceX=-this.gravityConstant*l*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},a.prototype.isConverged=function(){var t,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,t||h},a.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},a.prototype.calcNoOfChildrenForAllNodes=function(){for(var t,h=this.graphManager.getAllNodes(),o=0;o<h.length;o++)t=h[o],t.noOfChildren=t.getNoOfChildren()},a.prototype.calcGrid=function(t){var h=0,o=0;h=parseInt(Math.ceil((t.getRight()-t.getLeft())/this.repulsionRange)),o=parseInt(Math.ceil((t.getBottom()-t.getTop())/this.repulsionRange));for(var c=new Array(h),l=0;l<h;l++)c[l]=new Array(o);for(var l=0;l<h;l++)for(var T=0;T<o;T++)c[l][T]=new Array;return c},a.prototype.addNodeToGrid=function(t,h,o){var c=0,l=0,T=0,u=0;c=parseInt(Math.floor((t.getRect().x-h)/this.repulsionRange)),l=parseInt(Math.floor((t.getRect().width+t.getRect().x-h)/this.repulsionRange)),T=parseInt(Math.floor((t.getRect().y-o)/this.repulsionRange)),u=parseInt(Math.floor((t.getRect().height+t.getRect().y-o)/this.repulsionRange));for(var v=c;v<=l;v++)for(var L=T;L<=u;L++)this.grid[v][L].push(t),t.setGridCoordinates(c,l,T,u)},a.prototype.updateGrid=function(){var t,h,o=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),t=0;t<o.length;t++)h=o[t],this.addNodeToGrid(h,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},a.prototype.calculateRepulsionForceOfANode=function(t,h,o,c){if(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&o||c){var l=new Set;t.surrounding=new Array;for(var T,u=this.grid,v=t.startX-1;v<t.finishX+2;v++)for(var L=t.startY-1;L<t.finishY+2;L++)if(!(v<0||L<0||v>=u.length||L>=u[0].length)){for(var F=0;F<u[v][L].length;F++)if(T=u[v][L][F],!(t.getOwner()!=T.getOwner()||t==T)&&!h.has(T)&&!l.has(T)){var A=Math.abs(t.getCenterX()-T.getCenterX())-(t.getWidth()/2+T.getWidth()/2),P=Math.abs(t.getCenterY()-T.getCenterY())-(t.getHeight()/2+T.getHeight()/2);A<=this.repulsionRange&&P<=this.repulsionRange&&l.add(T)}}t.surrounding=[].concat(g(l))}for(v=0;v<t.surrounding.length;v++)this.calcRepulsionForce(t,t.surrounding[v])},a.prototype.calcRepulsionRange=function(){return 0},C.exports=a},function(C,G,N){var g=N(1),s=N(4);function i(e,f,a){g.call(this,e,f,a),this.idealLength=s.DEFAULT_EDGE_LENGTH,this.edgeElasticity=s.DEFAULT_SPRING_STRENGTH}i.prototype=Object.create(g.prototype);for(var r in g)i[r]=g[r];C.exports=i},function(C,G,N){var g=N(3),s=N(4);function i(e,f,a,y){g.call(this,e,f,a,y),this.nodeRepulsion=s.DEFAULT_REPULSION_STRENGTH,this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}i.prototype=Object.create(g.prototype);for(var r in g)i[r]=g[r];i.prototype.setGridCoordinates=function(e,f,a,y){this.startX=e,this.finishX=f,this.startY=a,this.finishY=y},C.exports=i},function(C,G,N){function g(s,i){this.width=0,this.height=0,s!==null&&i!==null&&(this.height=i,this.width=s)}g.prototype.getWidth=function(){return this.width},g.prototype.setWidth=function(s){this.width=s},g.prototype.getHeight=function(){return this.height},g.prototype.setHeight=function(s){this.height=s},C.exports=g},function(C,G,N){var g=N(14);function s(){this.map={},this.keys=[]}s.prototype.put=function(i,r){var e=g.createID(i);this.contains(e)||(this.map[e]=r,this.keys.push(i))},s.prototype.contains=function(i){return g.createID(i),this.map[i]!=null},s.prototype.get=function(i){var r=g.createID(i);return this.map[r]},s.prototype.keySet=function(){return this.keys},C.exports=s},function(C,G,N){var g=N(14);function s(){this.set={}}s.prototype.add=function(i){var r=g.createID(i);this.contains(r)||(this.set[r]=i)},s.prototype.remove=function(i){delete this.set[g.createID(i)]},s.prototype.clear=function(){this.set={}},s.prototype.contains=function(i){return this.set[g.createID(i)]==i},s.prototype.isEmpty=function(){return this.size()===0},s.prototype.size=function(){return Object.keys(this.set).length},s.prototype.addAllTo=function(i){for(var r=Object.keys(this.set),e=r.length,f=0;f<e;f++)i.push(this.set[r[f]])},s.prototype.size=function(){return Object.keys(this.set).length},s.prototype.addAll=function(i){for(var r=i.length,e=0;e<r;e++){var f=i[e];this.add(f)}},C.exports=s},function(C,G,N){function g(){}g.multMat=function(s,i){for(var r=[],e=0;e<s.length;e++){r[e]=[];for(var f=0;f<i[0].length;f++){r[e][f]=0;for(var a=0;a<s[0].length;a++)r[e][f]+=s[e][a]*i[a][f]}}return r},g.transpose=function(s){for(var i=[],r=0;r<s[0].length;r++){i[r]=[];for(var e=0;e<s.length;e++)i[r][e]=s[e][r]}return i},g.multCons=function(s,i){for(var r=[],e=0;e<s.length;e++)r[e]=s[e]*i;return r},g.minusOp=function(s,i){for(var r=[],e=0;e<s.length;e++)r[e]=s[e]-i[e];return r},g.dotProduct=function(s,i){for(var r=0,e=0;e<s.length;e++)r+=s[e]*i[e];return r},g.mag=function(s){return Math.sqrt(this.dotProduct(s,s))},g.normalize=function(s){for(var i=[],r=this.mag(s),e=0;e<s.length;e++)i[e]=s[e]/r;return i},g.multGamma=function(s){for(var i=[],r=0,e=0;e<s.length;e++)r+=s[e];r*=-1/s.length;for(var f=0;f<s.length;f++)i[f]=r+s[f];return i},g.multL=function(s,i,r){for(var e=[],f=[],a=[],y=0;y<i[0].length;y++){for(var t=0,h=0;h<i.length;h++)t+=-.5*i[h][y]*s[h];f[y]=t}for(var o=0;o<r.length;o++){for(var c=0,l=0;l<r.length;l++)c+=r[o][l]*f[l];a[o]=c}for(var T=0;T<i.length;T++){for(var u=0,v=0;v<i[0].length;v++)u+=i[T][v]*a[v];e[T]=u}return e},C.exports=g},function(C,G,N){var g=function(){function e(f,a){for(var y=0;y<a.length;y++){var t=a[y];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(f,t.key,t)}}return function(f,a,y){return a&&e(f.prototype,a),y&&e(f,y),f}}();function s(e,f){if(!(e instanceof f))throw new TypeError("Cannot call a class as a function")}var i=N(11),r=function(){function e(f,a){s(this,e),(a!==null||a!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var y=void 0;f instanceof i?y=f.size():y=f.length,this._quicksort(f,0,y-1)}return g(e,[{key:"_quicksort",value:function(a,y,t){if(y<t){var h=this._partition(a,y,t);this._quicksort(a,y,h),this._quicksort(a,h+1,t)}}},{key:"_partition",value:function(a,y,t){for(var h=this._get(a,y),o=y,c=t;;){for(;this.compareFunction(h,this._get(a,c));)c--;for(;this.compareFunction(this._get(a,o),h);)o++;if(o<c)this._swap(a,o,c),o++,c--;else return c}}},{key:"_get",value:function(a,y){return a instanceof i?a.get_object_at(y):a[y]}},{key:"_set",value:function(a,y,t){a instanceof i?a.set_object_at(y,t):a[y]=t}},{key:"_swap",value:function(a,y,t){var h=this._get(a,y);this._set(a,y,this._get(a,t)),this._set(a,t,h)}},{key:"_defaultCompareFunction",value:function(a,y){return y>a}}]),e}();C.exports=r},function(C,G,N){function g(){}g.svd=function(s){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=s.length,this.n=s[0].length;var i=Math.min(this.m,this.n);this.s=function(Nt){for(var At=[];Nt-- >0;)At.push(0);return At}(Math.min(this.m+1,this.n)),this.U=function(Nt){var At=function Zt(Gt){if(Gt.length==0)return 0;for(var $t=[],Ft=0;Ft<Gt[0];Ft++)$t.push(Zt(Gt.slice(1)));return $t};return At(Nt)}([this.m,i]),this.V=function(Nt){var At=function Zt(Gt){if(Gt.length==0)return 0;for(var $t=[],Ft=0;Ft<Gt[0];Ft++)$t.push(Zt(Gt.slice(1)));return $t};return At(Nt)}([this.n,this.n]);for(var r=function(Nt){for(var At=[];Nt-- >0;)At.push(0);return At}(this.n),e=function(Nt){for(var At=[];Nt-- >0;)At.push(0);return At}(this.m),f=!0,a=Math.min(this.m-1,this.n),y=Math.max(0,Math.min(this.n-2,this.m)),t=0;t<Math.max(a,y);t++){if(t<a){this.s[t]=0;for(var h=t;h<this.m;h++)this.s[t]=g.hypot(this.s[t],s[h][t]);if(this.s[t]!==0){s[t][t]<0&&(this.s[t]=-this.s[t]);for(var o=t;o<this.m;o++)s[o][t]/=this.s[t];s[t][t]+=1}this.s[t]=-this.s[t]}for(var c=t+1;c<this.n;c++){if(function(Nt,At){return Nt&&At}(t<a,this.s[t]!==0)){for(var l=0,T=t;T<this.m;T++)l+=s[T][t]*s[T][c];l=-l/s[t][t];for(var u=t;u<this.m;u++)s[u][c]+=l*s[u][t]}r[c]=s[t][c]}if(function(Nt,At){return At}(f,t<a))for(var v=t;v<this.m;v++)this.U[v][t]=s[v][t];if(t<y){r[t]=0;for(var L=t+1;L<this.n;L++)r[t]=g.hypot(r[t],r[L]);if(r[t]!==0){r[t+1]<0&&(r[t]=-r[t]);for(var F=t+1;F<this.n;F++)r[F]/=r[t];r[t+1]+=1}if(r[t]=-r[t],function(Nt,At){return Nt&&At}(t+1<this.m,r[t]!==0)){for(var A=t+1;A<this.m;A++)e[A]=0;for(var P=t+1;P<this.n;P++)for(var J=t+1;J<this.m;J++)e[J]+=r[P]*s[J][P];for(var V=t+1;V<this.n;V++)for(var Q=-r[V]/r[t+1],D=t+1;D<this.m;D++)s[D][V]+=Q*e[D]}for(var rt=t+1;rt<this.n;rt++)this.V[rt][t]=r[rt]}}var n=Math.min(this.n,this.m+1);a<this.n&&(this.s[a]=s[a][a]),this.m<n&&(this.s[n-1]=0),y+1<n&&(r[y]=s[y][n-1]),r[n-1]=0;{for(var m=a;m<i;m++){for(var d=0;d<this.m;d++)this.U[d][m]=0;this.U[m][m]=1}for(var E=a-1;E>=0;E--)if(this.s[E]!==0){for(var p=E+1;p<i;p++){for(var R=0,w=E;w<this.m;w++)R+=this.U[w][E]*this.U[w][p];R=-R/this.U[E][E];for(var I=E;I<this.m;I++)this.U[I][p]+=R*this.U[I][E]}for(var H=E;H<this.m;H++)this.U[H][E]=-this.U[H][E];this.U[E][E]=1+this.U[E][E];for(var x=0;x<E-1;x++)this.U[x][E]=0}else{for(var k=0;k<this.m;k++)this.U[k][E]=0;this.U[E][E]=1}}for(var W=this.n-1;W>=0;W--){if(function(Nt,At){return Nt&&At}(W<y,r[W]!==0))for(var U=W+1;U<i;U++){for(var et=0,z=W+1;z<this.n;z++)et+=this.V[z][W]*this.V[z][U];et=-et/this.V[W+1][W];for(var O=W+1;O<this.n;O++)this.V[O][U]+=et*this.V[O][W]}for(var X=0;X<this.n;X++)this.V[X][W]=0;this.V[W][W]=1}for(var B=n-1,_=Math.pow(2,-52),lt=Math.pow(2,-966);n>0;){var q=void 0,It=void 0;for(q=n-2;q>=-1&&q!==-1;q--)if(Math.abs(r[q])<=lt+_*(Math.abs(this.s[q])+Math.abs(this.s[q+1]))){r[q]=0;break}if(q===n-2)It=4;else{var Lt=void 0;for(Lt=n-1;Lt>=q&&Lt!==q;Lt--){var dt=(Lt!==n?Math.abs(r[Lt]):0)+(Lt!==q+1?Math.abs(r[Lt-1]):0);if(Math.abs(this.s[Lt])<=lt+_*dt){this.s[Lt]=0;break}}Lt===q?It=3:Lt===n-1?It=1:(It=2,q=Lt)}switch(q++,It){case 1:{var it=r[n-2];r[n-2]=0;for(var ut=n-2;ut>=q;ut--){var Tt=g.hypot(this.s[ut],it),Ct=this.s[ut]/Tt,Dt=it/Tt;this.s[ut]=Tt,ut!==q&&(it=-Dt*r[ut-1],r[ut-1]=Ct*r[ut-1]);for(var mt=0;mt<this.n;mt++)Tt=Ct*this.V[mt][ut]+Dt*this.V[mt][n-1],this.V[mt][n-1]=-Dt*this.V[mt][ut]+Ct*this.V[mt][n-1],this.V[mt][ut]=Tt}}break;case 2:{var xt=r[q-1];r[q-1]=0;for(var St=q;St<n;St++){var Vt=g.hypot(this.s[St],xt),Xt=this.s[St]/Vt,Ut=xt/Vt;this.s[St]=Vt,xt=-Ut*r[St],r[St]=Xt*r[St];for(var bt=0;bt<this.m;bt++)Vt=Xt*this.U[bt][St]+Ut*this.U[bt][q-1],this.U[bt][q-1]=-Ut*this.U[bt][St]+Xt*this.U[bt][q-1],this.U[bt][St]=Vt}}break;case 3:{var Ht=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[n-1]),Math.abs(this.s[n-2])),Math.abs(r[n-2])),Math.abs(this.s[q])),Math.abs(r[q])),Bt=this.s[n-1]/Ht,S=this.s[n-2]/Ht,b=r[n-2]/Ht,$=this.s[q]/Ht,K=r[q]/Ht,Z=((S+Bt)*(S-Bt)+b*b)/2,at=Bt*b*(Bt*b),gt=0;(function(Nt,At){return Nt||At})(Z!==0,at!==0)&&(gt=Math.sqrt(Z*Z+at),Z<0&&(gt=-gt),gt=at/(Z+gt));for(var ot=($+Bt)*($-Bt)+gt,tt=$*K,j=q;j<n-1;j++){var vt=g.hypot(ot,tt),wt=ot/vt,yt=tt/vt;j!==q&&(r[j-1]=vt),ot=wt*this.s[j]+yt*r[j],r[j]=wt*r[j]-yt*this.s[j],tt=yt*this.s[j+1],this.s[j+1]=wt*this.s[j+1];for(var Rt=0;Rt<this.n;Rt++)vt=wt*this.V[Rt][j]+yt*this.V[Rt][j+1],this.V[Rt][j+1]=-yt*this.V[Rt][j]+wt*this.V[Rt][j+1],this.V[Rt][j]=vt;if(vt=g.hypot(ot,tt),wt=ot/vt,yt=tt/vt,this.s[j]=vt,ot=wt*r[j]+yt*this.s[j+1],this.s[j+1]=-yt*r[j]+wt*this.s[j+1],tt=yt*r[j+1],r[j+1]=wt*r[j+1],j<this.m-1)for(var ft=0;ft<this.m;ft++)vt=wt*this.U[ft][j]+yt*this.U[ft][j+1],this.U[ft][j+1]=-yt*this.U[ft][j]+wt*this.U[ft][j+1],this.U[ft][j]=vt}r[n-2]=ot}break;case 4:{if(this.s[q]<=0){this.s[q]=this.s[q]<0?-this.s[q]:0;for(var st=0;st<=B;st++)this.V[st][q]=-this.V[st][q]}for(;q<B&&!(this.s[q]>=this.s[q+1]);){var Mt=this.s[q];if(this.s[q]=this.s[q+1],this.s[q+1]=Mt,q<this.n-1)for(var ct=0;ct<this.n;ct++)Mt=this.V[ct][q+1],this.V[ct][q+1]=this.V[ct][q],this.V[ct][q]=Mt;if(q<this.m-1)for(var ht=0;ht<this.m;ht++)Mt=this.U[ht][q+1],this.U[ht][q+1]=this.U[ht][q],this.U[ht][q]=Mt;q++}n--}break}}var Wt={U:this.U,V:this.V,S:this.s};return Wt},g.hypot=function(s,i){var r=void 0;return Math.abs(s)>Math.abs(i)?(r=i/s,r=Math.abs(s)*Math.sqrt(1+r*r)):i!=0?(r=s/i,r=Math.abs(i)*Math.sqrt(1+r*r)):r=0,r},C.exports=g},function(C,G,N){var g=function(){function r(e,f){for(var a=0;a<f.length;a++){var y=f[a];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(e,y.key,y)}}return function(e,f,a){return f&&r(e.prototype,f),a&&r(e,a),e}}();function s(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function r(e,f){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;s(this,r),this.sequence1=e,this.sequence2=f,this.match_score=a,this.mismatch_penalty=y,this.gap_penalty=t,this.iMax=e.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var h=0;h<this.iMax;h++){this.grid[h]=new Array(this.jMax);for(var o=0;o<this.jMax;o++)this.grid[h][o]=0}this.tracebackGrid=new Array(this.iMax);for(var c=0;c<this.iMax;c++){this.tracebackGrid[c]=new Array(this.jMax);for(var l=0;l<this.jMax;l++)this.tracebackGrid[c][l]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return g(r,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var f=1;f<this.jMax;f++)this.grid[0][f]=this.grid[0][f-1]+this.gap_penalty,this.tracebackGrid[0][f]=[!1,!1,!0];for(var a=1;a<this.iMax;a++)this.grid[a][0]=this.grid[a-1][0]+this.gap_penalty,this.tracebackGrid[a][0]=[!1,!0,!1];for(var y=1;y<this.iMax;y++)for(var t=1;t<this.jMax;t++){var h=void 0;this.sequence1[y-1]===this.sequence2[t-1]?h=this.grid[y-1][t-1]+this.match_score:h=this.grid[y-1][t-1]+this.mismatch_penalty;var o=this.grid[y-1][t]+this.gap_penalty,c=this.grid[y][t-1]+this.gap_penalty,l=[h,o,c],T=this.arrayAllMaxIndexes(l);this.grid[y][t]=l[T[0]],this.tracebackGrid[y][t]=[T.includes(0),T.includes(1),T.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var f=[];for(f.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});f[0];){var a=f[0],y=this.tracebackGrid[a.pos[0]][a.pos[1]];y[0]&&f.push({pos:[a.pos[0]-1,a.pos[1]-1],seq1:this.sequence1[a.pos[0]-1]+a.seq1,seq2:this.sequence2[a.pos[1]-1]+a.seq2}),y[1]&&f.push({pos:[a.pos[0]-1,a.pos[1]],seq1:this.sequence1[a.pos[0]-1]+a.seq1,seq2:"-"+a.seq2}),y[2]&&f.push({pos:[a.pos[0],a.pos[1]-1],seq1:"-"+a.seq1,seq2:this.sequence2[a.pos[1]-1]+a.seq2}),a.pos[0]===0&&a.pos[1]===0&&this.alignments.push({sequence1:a.seq1,sequence2:a.seq2}),f.shift()}return this.alignments}},{key:"getAllIndexes",value:function(f,a){for(var y=[],t=-1;(t=f.indexOf(a,t+1))!==-1;)y.push(t);return y}},{key:"arrayAllMaxIndexes",value:function(f){return this.getAllIndexes(f,Math.max.apply(null,f))}}]),r}();C.exports=i},function(C,G,N){var g=function(){};g.FDLayout=N(18),g.FDLayoutConstants=N(4),g.FDLayoutEdge=N(19),g.FDLayoutNode=N(20),g.DimensionD=N(21),g.HashMap=N(22),g.HashSet=N(23),g.IGeometry=N(8),g.IMath=N(9),g.Integer=N(10),g.Point=N(12),g.PointD=N(5),g.RandomSeed=N(16),g.RectangleD=N(13),g.Transform=N(17),g.UniqueIDGeneretor=N(14),g.Quicksort=N(25),g.LinkedList=N(11),g.LGraphObject=N(2),g.LGraph=N(6),g.LEdge=N(1),g.LGraphManager=N(7),g.LNode=N(3),g.Layout=N(15),g.LayoutConstants=N(0),g.NeedlemanWunsch=N(27),g.Matrix=N(24),g.SVD=N(26),C.exports=g},function(C,G,N){function g(){this.listeners=[]}var s=g.prototype;s.addListener=function(i,r){this.listeners.push({event:i,callback:r})},s.removeListener=function(i,r){for(var e=this.listeners.length;e>=0;e--){var f=this.listeners[e];f.event===i&&f.callback===r&&this.listeners.splice(e,1)}},s.emit=function(i,r){for(var e=0;e<this.listeners.length;e++){var f=this.listeners[e];i===f.event&&f.callback(r)}},C.exports=g}])})}(ye)),ye.exports}var De;function cr(){return De||(De=1,function(M,Y){(function(G,N){M.exports=N(fr())})(Te,function(C){return(()=>{var G={45:(i,r,e)=>{var f={};f.layoutBase=e(551),f.CoSEConstants=e(806),f.CoSEEdge=e(767),f.CoSEGraph=e(880),f.CoSEGraphManager=e(578),f.CoSELayout=e(765),f.CoSENode=e(991),f.ConstraintHandler=e(902),i.exports=f},806:(i,r,e)=>{var f=e(551).FDLayoutConstants;function a(){}for(var y in f)a[y]=f[y];a.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,a.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,a.DEFAULT_COMPONENT_SEPERATION=60,a.TILE=!0,a.TILING_PADDING_VERTICAL=10,a.TILING_PADDING_HORIZONTAL=10,a.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,a.ENFORCE_CONSTRAINTS=!0,a.APPLY_LAYOUT=!0,a.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,a.TREE_REDUCTION_ON_INCREMENTAL=!0,a.PURE_INCREMENTAL=a.DEFAULT_INCREMENTAL,i.exports=a},767:(i,r,e)=>{var f=e(551).FDLayoutEdge;function a(t,h,o){f.call(this,t,h,o)}a.prototype=Object.create(f.prototype);for(var y in f)a[y]=f[y];i.exports=a},880:(i,r,e)=>{var f=e(551).LGraph;function a(t,h,o){f.call(this,t,h,o)}a.prototype=Object.create(f.prototype);for(var y in f)a[y]=f[y];i.exports=a},578:(i,r,e)=>{var f=e(551).LGraphManager;function a(t){f.call(this,t)}a.prototype=Object.create(f.prototype);for(var y in f)a[y]=f[y];i.exports=a},765:(i,r,e)=>{var f=e(551).FDLayout,a=e(578),y=e(880),t=e(991),h=e(767),o=e(806),c=e(902),l=e(551).FDLayoutConstants,T=e(551).LayoutConstants,u=e(551).Point,v=e(551).PointD,L=e(551).DimensionD,F=e(551).Layout,A=e(551).Integer,P=e(551).IGeometry,J=e(551).LGraph,V=e(551).Transform,Q=e(551).LinkedList;function D(){f.call(this),this.toBeTiled={},this.constraints={}}D.prototype=Object.create(f.prototype);for(var rt in f)D[rt]=f[rt];D.prototype.newGraphManager=function(){var n=new a(this);return this.graphManager=n,n},D.prototype.newGraph=function(n){return new y(null,this.graphManager,n)},D.prototype.newNode=function(n){return new t(this.graphManager,n)},D.prototype.newEdge=function(n){return new h(null,null,n)},D.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},D.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},D.prototype.layout=function(){var n=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return n&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},D.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),d=this.nodesWithGravity.filter(function(R){return m.has(R)});this.graphManager.setAllNodesToApplyGravitation(d)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),d=this.nodesWithGravity.filter(function(E){return m.has(E)});this.graphManager.setAllNodesToApplyGravitation(d),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},D.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var n=new Set(this.getAllNodes()),m=this.nodesWithGravity.filter(function(p){return n.has(p)});this.graphManager.setAllNodesToApplyGravitation(m),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var d=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(d,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},D.prototype.getPositionsData=function(){for(var n=this.graphManager.getAllNodes(),m={},d=0;d<n.length;d++){var E=n[d].rect,p=n[d].id;m[p]={id:p,x:E.getCenterX(),y:E.getCenterY(),w:E.width,h:E.height}}return m},D.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var n=!1;if(l.ANIMATE==="during")this.emit("layoutstarted");else{for(;!n;)n=this.tick();this.graphManager.updateBounds()}},D.prototype.moveNodes=function(){for(var n=this.getAllNodes(),m,d=0;d<n.length;d++)m=n[d],m.calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var d=0;d<n.length;d++)m=n[d],m.move()},D.prototype.initConstraintVariables=function(){var n=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var m=this.graphManager.getAllNodes(),d=0;d<m.length;d++){var E=m[d];this.idToNodeMap.set(E.id,E)}var p=function O(X){for(var B=X.getChild().getNodes(),_,lt=0,q=0;q<B.length;q++)_=B[q],_.getChild()==null?n.fixedNodeSet.has(_.id)&&(lt+=100):lt+=O(_);return lt};if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(B){n.fixedNodeSet.add(B.nodeId)});for(var m=this.graphManager.getAllNodes(),E,d=0;d<m.length;d++)if(E=m[d],E.getChild()!=null){var R=p(E);R>0&&(E.fixedNodeWeight=R)}}if(this.constraints.relativePlacementConstraint){var w=new Map,I=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(O){n.fixedNodesOnHorizontal.add(O),n.fixedNodesOnVertical.add(O)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var H=this.constraints.alignmentConstraint.vertical,d=0;d<H.length;d++)this.dummyToNodeForVerticalAlignment.set("dummy"+d,[]),H[d].forEach(function(X){w.set(X,"dummy"+d),n.dummyToNodeForVerticalAlignment.get("dummy"+d).push(X),n.fixedNodeSet.has(X)&&n.fixedNodesOnHorizontal.add("dummy"+d)});if(this.constraints.alignmentConstraint.horizontal)for(var x=this.constraints.alignmentConstraint.horizontal,d=0;d<x.length;d++)this.dummyToNodeForHorizontalAlignment.set("dummy"+d,[]),x[d].forEach(function(X){I.set(X,"dummy"+d),n.dummyToNodeForHorizontalAlignment.get("dummy"+d).push(X),n.fixedNodeSet.has(X)&&n.fixedNodesOnVertical.add("dummy"+d)})}if(o.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(O){var X,B,_;for(_=O.length-1;_>=2*O.length/3;_--)X=Math.floor(Math.random()*(_+1)),B=O[_],O[_]=O[X],O[X]=B;return O},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var X=w.has(O.left)?w.get(O.left):O.left,B=w.has(O.right)?w.get(O.right):O.right;n.nodesInRelativeHorizontal.includes(X)||(n.nodesInRelativeHorizontal.push(X),n.nodeToRelativeConstraintMapHorizontal.set(X,[]),n.dummyToNodeForVerticalAlignment.has(X)?n.nodeToTempPositionMapHorizontal.set(X,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(X)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(X,n.idToNodeMap.get(X).getCenterX())),n.nodesInRelativeHorizontal.includes(B)||(n.nodesInRelativeHorizontal.push(B),n.nodeToRelativeConstraintMapHorizontal.set(B,[]),n.dummyToNodeForVerticalAlignment.has(B)?n.nodeToTempPositionMapHorizontal.set(B,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(B)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(B,n.idToNodeMap.get(B).getCenterX())),n.nodeToRelativeConstraintMapHorizontal.get(X).push({right:B,gap:O.gap}),n.nodeToRelativeConstraintMapHorizontal.get(B).push({left:X,gap:O.gap})}else{var _=I.has(O.top)?I.get(O.top):O.top,lt=I.has(O.bottom)?I.get(O.bottom):O.bottom;n.nodesInRelativeVertical.includes(_)||(n.nodesInRelativeVertical.push(_),n.nodeToRelativeConstraintMapVertical.set(_,[]),n.dummyToNodeForHorizontalAlignment.has(_)?n.nodeToTempPositionMapVertical.set(_,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(_)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(_,n.idToNodeMap.get(_).getCenterY())),n.nodesInRelativeVertical.includes(lt)||(n.nodesInRelativeVertical.push(lt),n.nodeToRelativeConstraintMapVertical.set(lt,[]),n.dummyToNodeForHorizontalAlignment.has(lt)?n.nodeToTempPositionMapVertical.set(lt,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(lt)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(lt,n.idToNodeMap.get(lt).getCenterY())),n.nodeToRelativeConstraintMapVertical.get(_).push({bottom:lt,gap:O.gap}),n.nodeToRelativeConstraintMapVertical.get(lt).push({top:_,gap:O.gap})}});else{var k=new Map,W=new Map;this.constraints.relativePlacementConstraint.forEach(function(O){if(O.left){var X=w.has(O.left)?w.get(O.left):O.left,B=w.has(O.right)?w.get(O.right):O.right;k.has(X)?k.get(X).push(B):k.set(X,[B]),k.has(B)?k.get(B).push(X):k.set(B,[X])}else{var _=I.has(O.top)?I.get(O.top):O.top,lt=I.has(O.bottom)?I.get(O.bottom):O.bottom;W.has(_)?W.get(_).push(lt):W.set(_,[lt]),W.has(lt)?W.get(lt).push(_):W.set(lt,[_])}});var U=function(X,B){var _=[],lt=[],q=new Q,It=new Set,Lt=0;return X.forEach(function(dt,it){if(!It.has(it)){_[Lt]=[],lt[Lt]=!1;var ut=it;for(q.push(ut),It.add(ut),_[Lt].push(ut);q.length!=0;){ut=q.shift(),B.has(ut)&&(lt[Lt]=!0);var Tt=X.get(ut);Tt.forEach(function(Ct){It.has(Ct)||(q.push(Ct),It.add(Ct),_[Lt].push(Ct))})}Lt++}}),{components:_,isFixed:lt}},et=U(k,n.fixedNodesOnHorizontal);this.componentsOnHorizontal=et.components,this.fixedComponentsOnHorizontal=et.isFixed;var z=U(W,n.fixedNodesOnVertical);this.componentsOnVertical=z.components,this.fixedComponentsOnVertical=z.isFixed}}},D.prototype.updateDisplacements=function(){var n=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(z){var O=n.idToNodeMap.get(z.nodeId);O.displacementX=0,O.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var m=this.constraints.alignmentConstraint.vertical,d=0;d<m.length;d++){for(var E=0,p=0;p<m[d].length;p++){if(this.fixedNodeSet.has(m[d][p])){E=0;break}E+=this.idToNodeMap.get(m[d][p]).displacementX}for(var R=E/m[d].length,p=0;p<m[d].length;p++)this.idToNodeMap.get(m[d][p]).displacementX=R}if(this.constraints.alignmentConstraint.horizontal)for(var w=this.constraints.alignmentConstraint.horizontal,d=0;d<w.length;d++){for(var I=0,p=0;p<w[d].length;p++){if(this.fixedNodeSet.has(w[d][p])){I=0;break}I+=this.idToNodeMap.get(w[d][p]).displacementY}for(var H=I/w[d].length,p=0;p<w[d].length;p++)this.idToNodeMap.get(w[d][p]).displacementY=H}}if(this.constraints.relativePlacementConstraint)if(o.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(z){if(!n.fixedNodesOnHorizontal.has(z)){var O=0;n.dummyToNodeForVerticalAlignment.has(z)?O=n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(z)[0]).displacementX:O=n.idToNodeMap.get(z).displacementX,n.nodeToRelativeConstraintMapHorizontal.get(z).forEach(function(X){if(X.right){var B=n.nodeToTempPositionMapHorizontal.get(X.right)-n.nodeToTempPositionMapHorizontal.get(z)-O;B<X.gap&&(O-=X.gap-B)}else{var B=n.nodeToTempPositionMapHorizontal.get(z)-n.nodeToTempPositionMapHorizontal.get(X.left)+O;B<X.gap&&(O+=X.gap-B)}}),n.nodeToTempPositionMapHorizontal.set(z,n.nodeToTempPositionMapHorizontal.get(z)+O),n.dummyToNodeForVerticalAlignment.has(z)?n.dummyToNodeForVerticalAlignment.get(z).forEach(function(X){n.idToNodeMap.get(X).displacementX=O}):n.idToNodeMap.get(z).displacementX=O}}),this.nodesInRelativeVertical.forEach(function(z){if(!n.fixedNodesOnHorizontal.has(z)){var O=0;n.dummyToNodeForHorizontalAlignment.has(z)?O=n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(z)[0]).displacementY:O=n.idToNodeMap.get(z).displacementY,n.nodeToRelativeConstraintMapVertical.get(z).forEach(function(X){if(X.bottom){var B=n.nodeToTempPositionMapVertical.get(X.bottom)-n.nodeToTempPositionMapVertical.get(z)-O;B<X.gap&&(O-=X.gap-B)}else{var B=n.nodeToTempPositionMapVertical.get(z)-n.nodeToTempPositionMapVertical.get(X.top)+O;B<X.gap&&(O+=X.gap-B)}}),n.nodeToTempPositionMapVertical.set(z,n.nodeToTempPositionMapVertical.get(z)+O),n.dummyToNodeForHorizontalAlignment.has(z)?n.dummyToNodeForHorizontalAlignment.get(z).forEach(function(X){n.idToNodeMap.get(X).displacementY=O}):n.idToNodeMap.get(z).displacementY=O}});else{for(var d=0;d<this.componentsOnHorizontal.length;d++){var x=this.componentsOnHorizontal[d];if(this.fixedComponentsOnHorizontal[d])for(var p=0;p<x.length;p++)this.dummyToNodeForVerticalAlignment.has(x[p])?this.dummyToNodeForVerticalAlignment.get(x[p]).forEach(function(X){n.idToNodeMap.get(X).displacementX=0}):this.idToNodeMap.get(x[p]).displacementX=0;else{for(var k=0,W=0,p=0;p<x.length;p++)if(this.dummyToNodeForVerticalAlignment.has(x[p])){var U=this.dummyToNodeForVerticalAlignment.get(x[p]);k+=U.length*this.idToNodeMap.get(U[0]).displacementX,W+=U.length}else k+=this.idToNodeMap.get(x[p]).displacementX,W++;for(var et=k/W,p=0;p<x.length;p++)this.dummyToNodeForVerticalAlignment.has(x[p])?this.dummyToNodeForVerticalAlignment.get(x[p]).forEach(function(X){n.idToNodeMap.get(X).displacementX=et}):this.idToNodeMap.get(x[p]).displacementX=et}}for(var d=0;d<this.componentsOnVertical.length;d++){var x=this.componentsOnVertical[d];if(this.fixedComponentsOnVertical[d])for(var p=0;p<x.length;p++)this.dummyToNodeForHorizontalAlignment.has(x[p])?this.dummyToNodeForHorizontalAlignment.get(x[p]).forEach(function(B){n.idToNodeMap.get(B).displacementY=0}):this.idToNodeMap.get(x[p]).displacementY=0;else{for(var k=0,W=0,p=0;p<x.length;p++)if(this.dummyToNodeForHorizontalAlignment.has(x[p])){var U=this.dummyToNodeForHorizontalAlignment.get(x[p]);k+=U.length*this.idToNodeMap.get(U[0]).displacementY,W+=U.length}else k+=this.idToNodeMap.get(x[p]).displacementY,W++;for(var et=k/W,p=0;p<x.length;p++)this.dummyToNodeForHorizontalAlignment.has(x[p])?this.dummyToNodeForHorizontalAlignment.get(x[p]).forEach(function(q){n.idToNodeMap.get(q).displacementY=et}):this.idToNodeMap.get(x[p]).displacementY=et}}}},D.prototype.calculateNodesToApplyGravitationTo=function(){var n=[],m,d=this.graphManager.getGraphs(),E=d.length,p;for(p=0;p<E;p++)m=d[p],m.updateConnected(),m.isConnected||(n=n.concat(m.getNodes()));return n},D.prototype.createBendpoints=function(){var n=[];n=n.concat(this.graphManager.getAllEdges());var m=new Set,d;for(d=0;d<n.length;d++){var E=n[d];if(!m.has(E)){var p=E.getSource(),R=E.getTarget();if(p==R)E.getBendpoints().push(new v),E.getBendpoints().push(new v),this.createDummyNodesForBendpoints(E),m.add(E);else{var w=[];if(w=w.concat(p.getEdgeListToNode(R)),w=w.concat(R.getEdgeListToNode(p)),!m.has(w[0])){if(w.length>1){var I;for(I=0;I<w.length;I++){var H=w[I];H.getBendpoints().push(new v),this.createDummyNodesForBendpoints(H)}}w.forEach(function(x){m.add(x)})}}}if(m.size==n.length)break}},D.prototype.positionNodesRadially=function(n){for(var m=new u(0,0),d=Math.ceil(Math.sqrt(n.length)),E=0,p=0,R=0,w=new v(0,0),I=0;I<n.length;I++){I%d==0&&(R=0,p=E,I!=0&&(p+=o.DEFAULT_COMPONENT_SEPERATION),E=0);var H=n[I],x=F.findCenterOfTree(H);m.x=R,m.y=p,w=D.radialLayout(H,x,m),w.y>E&&(E=Math.floor(w.y)),R=Math.floor(w.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new v(T.WORLD_CENTER_X-w.x/2,T.WORLD_CENTER_Y-w.y/2))},D.radialLayout=function(n,m,d){var E=Math.max(this.maxDiagonalInTree(n),o.DEFAULT_RADIAL_SEPARATION);D.branchRadialLayout(m,null,0,359,0,E);var p=J.calculateBounds(n),R=new V;R.setDeviceOrgX(p.getMinX()),R.setDeviceOrgY(p.getMinY()),R.setWorldOrgX(d.x),R.setWorldOrgY(d.y);for(var w=0;w<n.length;w++){var I=n[w];I.transform(R)}var H=new v(p.getMaxX(),p.getMaxY());return R.inverseTransformPoint(H)},D.branchRadialLayout=function(n,m,d,E,p,R){var w=(E-d+1)/2;w<0&&(w+=180);var I=(w+d)%360,H=I*P.TWO_PI/360,x=p*Math.cos(H),k=p*Math.sin(H);n.setCenter(x,k);var W=[];W=W.concat(n.getEdges());var U=W.length;m!=null&&U--;for(var et=0,z=W.length,O,X=n.getEdgesBetween(m);X.length>1;){var B=X[0];X.splice(0,1);var _=W.indexOf(B);_>=0&&W.splice(_,1),z--,U--}m!=null?O=(W.indexOf(X[0])+1)%z:O=0;for(var lt=Math.abs(E-d)/U,q=O;et!=U;q=++q%z){var It=W[q].getOtherEnd(n);if(It!=m){var Lt=(d+et*lt)%360,dt=(Lt+lt)%360;D.branchRadialLayout(It,n,Lt,dt,p+R,R),et++}}},D.maxDiagonalInTree=function(n){for(var m=A.MIN_VALUE,d=0;d<n.length;d++){var E=n[d],p=E.getDiagonal();p>m&&(m=p)}return m},D.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},D.prototype.groupZeroDegreeMembers=function(){var n=this,m={};this.memberGroups={},this.idToDummyNode={};for(var d=[],E=this.graphManager.getAllNodes(),p=0;p<E.length;p++){var R=E[p],w=R.getParent();this.getNodeDegreeWithChildren(R)===0&&(w.id==null||!this.getToBeTiled(w))&&d.push(R)}for(var p=0;p<d.length;p++){var R=d[p],I=R.getParent().id;typeof m[I]>"u"&&(m[I]=[]),m[I]=m[I].concat(R)}Object.keys(m).forEach(function(H){if(m[H].length>1){var x="DummyCompound_"+H;n.memberGroups[x]=m[H];var k=m[H][0].getParent(),W=new t(n.graphManager);W.id=x,W.paddingLeft=k.paddingLeft||0,W.paddingRight=k.paddingRight||0,W.paddingBottom=k.paddingBottom||0,W.paddingTop=k.paddingTop||0,n.idToDummyNode[x]=W;var U=n.getGraphManager().add(n.newGraph(),W),et=k.getChild();et.add(W);for(var z=0;z<m[H].length;z++){var O=m[H][z];et.remove(O),U.add(O)}}})},D.prototype.clearCompounds=function(){var n={},m={};this.performDFSOnCompounds();for(var d=0;d<this.compoundOrder.length;d++)m[this.compoundOrder[d].id]=this.compoundOrder[d],n[this.compoundOrder[d].id]=[].concat(this.compoundOrder[d].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[d].getChild()),this.compoundOrder[d].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(n,m)},D.prototype.clearZeroDegreeMembers=function(){var n=this,m=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(d){var E=n.idToDummyNode[d];if(m[d]=n.tileNodes(n.memberGroups[d],E.paddingLeft+E.paddingRight),E.rect.width=m[d].width,E.rect.height=m[d].height,E.setCenter(m[d].centerX,m[d].centerY),E.labelMarginLeft=0,E.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var p=E.rect.width,R=E.rect.height;E.labelWidth&&(E.labelPosHorizontal=="left"?(E.rect.x-=E.labelWidth,E.setWidth(p+E.labelWidth),E.labelMarginLeft=E.labelWidth):E.labelPosHorizontal=="center"&&E.labelWidth>p?(E.rect.x-=(E.labelWidth-p)/2,E.setWidth(E.labelWidth),E.labelMarginLeft=(E.labelWidth-p)/2):E.labelPosHorizontal=="right"&&E.setWidth(p+E.labelWidth)),E.labelHeight&&(E.labelPosVertical=="top"?(E.rect.y-=E.labelHeight,E.setHeight(R+E.labelHeight),E.labelMarginTop=E.labelHeight):E.labelPosVertical=="center"&&E.labelHeight>R?(E.rect.y-=(E.labelHeight-R)/2,E.setHeight(E.labelHeight),E.labelMarginTop=(E.labelHeight-R)/2):E.labelPosVertical=="bottom"&&E.setHeight(R+E.labelHeight))}})},D.prototype.repopulateCompounds=function(){for(var n=this.compoundOrder.length-1;n>=0;n--){var m=this.compoundOrder[n],d=m.id,E=m.paddingLeft,p=m.paddingTop,R=m.labelMarginLeft,w=m.labelMarginTop;this.adjustLocations(this.tiledMemberPack[d],m.rect.x,m.rect.y,E,p,R,w)}},D.prototype.repopulateZeroDegreeMembers=function(){var n=this,m=this.tiledZeroDegreePack;Object.keys(m).forEach(function(d){var E=n.idToDummyNode[d],p=E.paddingLeft,R=E.paddingTop,w=E.labelMarginLeft,I=E.labelMarginTop;n.adjustLocations(m[d],E.rect.x,E.rect.y,p,R,w,I)})},D.prototype.getToBeTiled=function(n){var m=n.id;if(this.toBeTiled[m]!=null)return this.toBeTiled[m];var d=n.getChild();if(d==null)return this.toBeTiled[m]=!1,!1;for(var E=d.getNodes(),p=0;p<E.length;p++){var R=E[p];if(this.getNodeDegree(R)>0)return this.toBeTiled[m]=!1,!1;if(R.getChild()==null){this.toBeTiled[R.id]=!1;continue}if(!this.getToBeTiled(R))return this.toBeTiled[m]=!1,!1}return this.toBeTiled[m]=!0,!0},D.prototype.getNodeDegree=function(n){n.id;for(var m=n.getEdges(),d=0,E=0;E<m.length;E++){var p=m[E];p.getSource().id!==p.getTarget().id&&(d=d+1)}return d},D.prototype.getNodeDegreeWithChildren=function(n){var m=this.getNodeDegree(n);if(n.getChild()==null)return m;for(var d=n.getChild().getNodes(),E=0;E<d.length;E++){var p=d[E];m+=this.getNodeDegreeWithChildren(p)}return m},D.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},D.prototype.fillCompexOrderByDFS=function(n){for(var m=0;m<n.length;m++){var d=n[m];d.getChild()!=null&&this.fillCompexOrderByDFS(d.getChild().getNodes()),this.getToBeTiled(d)&&this.compoundOrder.push(d)}},D.prototype.adjustLocations=function(n,m,d,E,p,R,w){m+=E+R,d+=p+w;for(var I=m,H=0;H<n.rows.length;H++){var x=n.rows[H];m=I;for(var k=0,W=0;W<x.length;W++){var U=x[W];U.rect.x=m,U.rect.y=d,m+=U.rect.width+n.horizontalPadding,U.rect.height>k&&(k=U.rect.height)}d+=k+n.verticalPadding}},D.prototype.tileCompoundMembers=function(n,m){var d=this;this.tiledMemberPack=[],Object.keys(n).forEach(function(E){var p=m[E];if(d.tiledMemberPack[E]=d.tileNodes(n[E],p.paddingLeft+p.paddingRight),p.rect.width=d.tiledMemberPack[E].width,p.rect.height=d.tiledMemberPack[E].height,p.setCenter(d.tiledMemberPack[E].centerX,d.tiledMemberPack[E].centerY),p.labelMarginLeft=0,p.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var R=p.rect.width,w=p.rect.height;p.labelWidth&&(p.labelPosHorizontal=="left"?(p.rect.x-=p.labelWidth,p.setWidth(R+p.labelWidth),p.labelMarginLeft=p.labelWidth):p.labelPosHorizontal=="center"&&p.labelWidth>R?(p.rect.x-=(p.labelWidth-R)/2,p.setWidth(p.labelWidth),p.labelMarginLeft=(p.labelWidth-R)/2):p.labelPosHorizontal=="right"&&p.setWidth(R+p.labelWidth)),p.labelHeight&&(p.labelPosVertical=="top"?(p.rect.y-=p.labelHeight,p.setHeight(w+p.labelHeight),p.labelMarginTop=p.labelHeight):p.labelPosVertical=="center"&&p.labelHeight>w?(p.rect.y-=(p.labelHeight-w)/2,p.setHeight(p.labelHeight),p.labelMarginTop=(p.labelHeight-w)/2):p.labelPosVertical=="bottom"&&p.setHeight(w+p.labelHeight))}})},D.prototype.tileNodes=function(n,m){var d=this.tileNodesByFavoringDim(n,m,!0),E=this.tileNodesByFavoringDim(n,m,!1),p=this.getOrgRatio(d),R=this.getOrgRatio(E),w;return R<p?w=E:w=d,w},D.prototype.getOrgRatio=function(n){var m=n.width,d=n.height,E=m/d;return E<1&&(E=1/E),E},D.prototype.calcIdealRowWidth=function(n,m){var d=o.TILING_PADDING_VERTICAL,E=o.TILING_PADDING_HORIZONTAL,p=n.length,R=0,w=0,I=0;n.forEach(function(z){R+=z.getWidth(),w+=z.getHeight(),z.getWidth()>I&&(I=z.getWidth())});var H=R/p,x=w/p,k=Math.pow(d-E,2)+4*(H+E)*(x+d)*p,W=(E-d+Math.sqrt(k))/(2*(H+E)),U;m?(U=Math.ceil(W),U==W&&U++):U=Math.floor(W);var et=U*(H+E)-E;return I>et&&(et=I),et+=E*2,et},D.prototype.tileNodesByFavoringDim=function(n,m,d){var E=o.TILING_PADDING_VERTICAL,p=o.TILING_PADDING_HORIZONTAL,R=o.TILING_COMPARE_BY,w={rows:[],rowWidth:[],rowHeight:[],width:0,height:m,verticalPadding:E,horizontalPadding:p,centerX:0,centerY:0};R&&(w.idealRowWidth=this.calcIdealRowWidth(n,d));var I=function(O){return O.rect.width*O.rect.height},H=function(O,X){return I(X)-I(O)};n.sort(function(z,O){var X=H;return w.idealRowWidth?(X=R,X(z.id,O.id)):X(z,O)});for(var x=0,k=0,W=0;W<n.length;W++){var U=n[W];x+=U.getCenterX(),k+=U.getCenterY()}w.centerX=x/n.length,w.centerY=k/n.length;for(var W=0;W<n.length;W++){var U=n[W];if(w.rows.length==0)this.insertNodeToRow(w,U,0,m);else if(this.canAddHorizontal(w,U.rect.width,U.rect.height)){var et=w.rows.length-1;w.idealRowWidth||(et=this.getShortestRowIndex(w)),this.insertNodeToRow(w,U,et,m)}else this.insertNodeToRow(w,U,w.rows.length,m);this.shiftToLastRow(w)}return w},D.prototype.insertNodeToRow=function(n,m,d,E){var p=E;if(d==n.rows.length){var R=[];n.rows.push(R),n.rowWidth.push(p),n.rowHeight.push(0)}var w=n.rowWidth[d]+m.rect.width;n.rows[d].length>0&&(w+=n.horizontalPadding),n.rowWidth[d]=w,n.width<w&&(n.width=w);var I=m.rect.height;d>0&&(I+=n.verticalPadding);var H=0;I>n.rowHeight[d]&&(H=n.rowHeight[d],n.rowHeight[d]=I,H=n.rowHeight[d]-H),n.height+=H,n.rows[d].push(m)},D.prototype.getShortestRowIndex=function(n){for(var m=-1,d=Number.MAX_VALUE,E=0;E<n.rows.length;E++)n.rowWidth[E]<d&&(m=E,d=n.rowWidth[E]);return m},D.prototype.getLongestRowIndex=function(n){for(var m=-1,d=Number.MIN_VALUE,E=0;E<n.rows.length;E++)n.rowWidth[E]>d&&(m=E,d=n.rowWidth[E]);return m},D.prototype.canAddHorizontal=function(n,m,d){if(n.idealRowWidth){var E=n.rows.length-1,p=n.rowWidth[E];return p+m+n.horizontalPadding<=n.idealRowWidth}var R=this.getShortestRowIndex(n);if(R<0)return!0;var w=n.rowWidth[R];if(w+n.horizontalPadding+m<=n.width)return!0;var I=0;n.rowHeight[R]<d&&R>0&&(I=d+n.verticalPadding-n.rowHeight[R]);var H;n.width-w>=m+n.horizontalPadding?H=(n.height+I)/(w+m+n.horizontalPadding):H=(n.height+I)/n.width,I=d+n.verticalPadding;var x;return n.width<m?x=(n.height+I)/m:x=(n.height+I)/n.width,x<1&&(x=1/x),H<1&&(H=1/H),H<x},D.prototype.shiftToLastRow=function(n){var m=this.getLongestRowIndex(n),d=n.rowWidth.length-1,E=n.rows[m],p=E[E.length-1],R=p.width+n.horizontalPadding;if(n.width-n.rowWidth[d]>R&&m!=d){E.splice(-1,1),n.rows[d].push(p),n.rowWidth[m]=n.rowWidth[m]-R,n.rowWidth[d]=n.rowWidth[d]+R,n.width=n.rowWidth[instance.getLongestRowIndex(n)];for(var w=Number.MIN_VALUE,I=0;I<E.length;I++)E[I].height>w&&(w=E[I].height);m>0&&(w+=n.verticalPadding);var H=n.rowHeight[m]+n.rowHeight[d];n.rowHeight[m]=w,n.rowHeight[d]<p.height+n.verticalPadding&&(n.rowHeight[d]=p.height+n.verticalPadding);var x=n.rowHeight[m]+n.rowHeight[d];n.height+=x-H,this.shiftToLastRow(n)}},D.prototype.tilingPreLayout=function(){o.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},D.prototype.tilingPostLayout=function(){o.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},D.prototype.reduceTrees=function(){for(var n=[],m=!0,d;m;){var E=this.graphManager.getAllNodes(),p=[];m=!1;for(var R=0;R<E.length;R++)if(d=E[R],d.getEdges().length==1&&!d.getEdges()[0].isInterGraph&&d.getChild()==null){if(o.PURE_INCREMENTAL){var w=d.getEdges()[0].getOtherEnd(d),I=new L(d.getCenterX()-w.getCenterX(),d.getCenterY()-w.getCenterY());p.push([d,d.getEdges()[0],d.getOwner(),I])}else p.push([d,d.getEdges()[0],d.getOwner()]);m=!0}if(m==!0){for(var H=[],x=0;x<p.length;x++)p[x][0].getEdges().length==1&&(H.push(p[x]),p[x][0].getOwner().remove(p[x][0]));n.push(H),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=n},D.prototype.growTree=function(n){for(var m=n.length,d=n[m-1],E,p=0;p<d.length;p++)E=d[p],this.findPlaceforPrunedNode(E),E[2].add(E[0]),E[2].add(E[1],E[1].source,E[1].target);n.splice(n.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},D.prototype.findPlaceforPrunedNode=function(n){var m,d,E=n[0];if(E==n[1].source?d=n[1].target:d=n[1].source,o.PURE_INCREMENTAL)E.setCenter(d.getCenterX()+n[3].getWidth(),d.getCenterY()+n[3].getHeight());else{var p=d.startX,R=d.finishX,w=d.startY,I=d.finishY,H=0,x=0,k=0,W=0,U=[H,k,x,W];if(w>0)for(var et=p;et<=R;et++)U[0]+=this.grid[et][w-1].length+this.grid[et][w].length-1;if(R<this.grid.length-1)for(var et=w;et<=I;et++)U[1]+=this.grid[R+1][et].length+this.grid[R][et].length-1;if(I<this.grid[0].length-1)for(var et=p;et<=R;et++)U[2]+=this.grid[et][I+1].length+this.grid[et][I].length-1;if(p>0)for(var et=w;et<=I;et++)U[3]+=this.grid[p-1][et].length+this.grid[p][et].length-1;for(var z=A.MAX_VALUE,O,X,B=0;B<U.length;B++)U[B]<z?(z=U[B],O=1,X=B):U[B]==z&&O++;if(O==3&&z==0)U[0]==0&&U[1]==0&&U[2]==0?m=1:U[0]==0&&U[1]==0&&U[3]==0?m=0:U[0]==0&&U[2]==0&&U[3]==0?m=3:U[1]==0&&U[2]==0&&U[3]==0&&(m=2);else if(O==2&&z==0){var _=Math.floor(Math.random()*2);U[0]==0&&U[1]==0?_==0?m=0:m=1:U[0]==0&&U[2]==0?_==0?m=0:m=2:U[0]==0&&U[3]==0?_==0?m=0:m=3:U[1]==0&&U[2]==0?_==0?m=1:m=2:U[1]==0&&U[3]==0?_==0?m=1:m=3:_==0?m=2:m=3}else if(O==4&&z==0){var _=Math.floor(Math.random()*4);m=_}else m=X;m==0?E.setCenter(d.getCenterX(),d.getCenterY()-d.getHeight()/2-l.DEFAULT_EDGE_LENGTH-E.getHeight()/2):m==1?E.setCenter(d.getCenterX()+d.getWidth()/2+l.DEFAULT_EDGE_LENGTH+E.getWidth()/2,d.getCenterY()):m==2?E.setCenter(d.getCenterX(),d.getCenterY()+d.getHeight()/2+l.DEFAULT_EDGE_LENGTH+E.getHeight()/2):E.setCenter(d.getCenterX()-d.getWidth()/2-l.DEFAULT_EDGE_LENGTH-E.getWidth()/2,d.getCenterY())}},i.exports=D},991:(i,r,e)=>{var f=e(551).FDLayoutNode,a=e(551).IMath;function y(h,o,c,l){f.call(this,h,o,c,l)}y.prototype=Object.create(f.prototype);for(var t in f)y[t]=f[t];y.prototype.calculateDisplacement=function(){var h=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=h.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=h.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=h.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=h.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>h.coolingFactor*h.maxNodeDisplacement&&(this.displacementX=h.coolingFactor*h.maxNodeDisplacement*a.sign(this.displacementX)),Math.abs(this.displacementY)>h.coolingFactor*h.maxNodeDisplacement&&(this.displacementY=h.coolingFactor*h.maxNodeDisplacement*a.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},y.prototype.propogateDisplacementToChildren=function(h,o){for(var c=this.getChild().getNodes(),l,T=0;T<c.length;T++)l=c[T],l.getChild()==null?(l.displacementX+=h,l.displacementY+=o):l.propogateDisplacementToChildren(h,o)},y.prototype.move=function(){var h=this.graphManager.getLayout();(this.child==null||this.child.getNodes().length==0)&&(this.moveBy(this.displacementX,this.displacementY),h.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},y.prototype.setPred1=function(h){this.pred1=h},y.prototype.getPred1=function(){return pred1},y.prototype.getPred2=function(){return pred2},y.prototype.setNext=function(h){this.next=h},y.prototype.getNext=function(){return next},y.prototype.setProcessed=function(h){this.processed=h},y.prototype.isProcessed=function(){return processed},i.exports=y},902:(i,r,e)=>{function f(c){if(Array.isArray(c)){for(var l=0,T=Array(c.length);l<c.length;l++)T[l]=c[l];return T}else return Array.from(c)}var a=e(806),y=e(551).LinkedList,t=e(551).Matrix,h=e(551).SVD;function o(){}o.handleConstraints=function(c){var l={};l.fixedNodeConstraint=c.constraints.fixedNodeConstraint,l.alignmentConstraint=c.constraints.alignmentConstraint,l.relativePlacementConstraint=c.constraints.relativePlacementConstraint;for(var T=new Map,u=new Map,v=[],L=[],F=c.getAllNodes(),A=0,P=0;P<F.length;P++){var J=F[P];J.getChild()==null&&(u.set(J.id,A++),v.push(J.getCenterX()),L.push(J.getCenterY()),T.set(J.id,J))}l.relativePlacementConstraint&&l.relativePlacementConstraint.forEach(function(S){!S.gap&&S.gap!=0&&(S.left?S.gap=a.DEFAULT_EDGE_LENGTH+T.get(S.left).getWidth()/2+T.get(S.right).getWidth()/2:S.gap=a.DEFAULT_EDGE_LENGTH+T.get(S.top).getHeight()/2+T.get(S.bottom).getHeight()/2)});var V=function(b,$){return{x:b.x-$.x,y:b.y-$.y}},Q=function(b){var $=0,K=0;return b.forEach(function(Z){$+=v[u.get(Z)],K+=L[u.get(Z)]}),{x:$/b.size,y:K/b.size}},D=function(b,$,K,Z,at){function gt(ft,st){var Mt=new Set(ft),ct=!0,ht=!1,Wt=void 0;try{for(var Nt=st[Symbol.iterator](),At;!(ct=(At=Nt.next()).done);ct=!0){var Zt=At.value;Mt.add(Zt)}}catch(Gt){ht=!0,Wt=Gt}finally{try{!ct&&Nt.return&&Nt.return()}finally{if(ht)throw Wt}}return Mt}var ot=new Map;b.forEach(function(ft,st){ot.set(st,0)}),b.forEach(function(ft,st){ft.forEach(function(Mt){ot.set(Mt.id,ot.get(Mt.id)+1)})});var tt=new Map,j=new Map,vt=new y;ot.forEach(function(ft,st){ft==0?(vt.push(st),K||($=="horizontal"?tt.set(st,u.has(st)?v[u.get(st)]:Z.get(st)):tt.set(st,u.has(st)?L[u.get(st)]:Z.get(st)))):tt.set(st,Number.NEGATIVE_INFINITY),K&&j.set(st,new Set([st]))}),K&&at.forEach(function(ft){var st=[];if(ft.forEach(function(ht){K.has(ht)&&st.push(ht)}),st.length>0){var Mt=0;st.forEach(function(ht){$=="horizontal"?(tt.set(ht,u.has(ht)?v[u.get(ht)]:Z.get(ht)),Mt+=tt.get(ht)):(tt.set(ht,u.has(ht)?L[u.get(ht)]:Z.get(ht)),Mt+=tt.get(ht))}),Mt=Mt/st.length,ft.forEach(function(ht){K.has(ht)||tt.set(ht,Mt)})}else{var ct=0;ft.forEach(function(ht){$=="horizontal"?ct+=u.has(ht)?v[u.get(ht)]:Z.get(ht):ct+=u.has(ht)?L[u.get(ht)]:Z.get(ht)}),ct=ct/ft.length,ft.forEach(function(ht){tt.set(ht,ct)})}});for(var wt=function(){var st=vt.shift(),Mt=b.get(st);Mt.forEach(function(ct){if(tt.get(ct.id)<tt.get(st)+ct.gap)if(K&&K.has(ct.id)){var ht=void 0;if($=="horizontal"?ht=u.has(ct.id)?v[u.get(ct.id)]:Z.get(ct.id):ht=u.has(ct.id)?L[u.get(ct.id)]:Z.get(ct.id),tt.set(ct.id,ht),ht<tt.get(st)+ct.gap){var Wt=tt.get(st)+ct.gap-ht;j.get(st).forEach(function(Nt){tt.set(Nt,tt.get(Nt)-Wt)})}}else tt.set(ct.id,tt.get(st)+ct.gap);ot.set(ct.id,ot.get(ct.id)-1),ot.get(ct.id)==0&&vt.push(ct.id),K&&j.set(ct.id,gt(j.get(st),j.get(ct.id)))})};vt.length!=0;)wt();if(K){var yt=new Set;b.forEach(function(ft,st){ft.length==0&&yt.add(st)});var Rt=[];j.forEach(function(ft,st){if(yt.has(st)){var Mt=!1,ct=!0,ht=!1,Wt=void 0;try{for(var Nt=ft[Symbol.iterator](),At;!(ct=(At=Nt.next()).done);ct=!0){var Zt=At.value;K.has(Zt)&&(Mt=!0)}}catch(Ft){ht=!0,Wt=Ft}finally{try{!ct&&Nt.return&&Nt.return()}finally{if(ht)throw Wt}}if(!Mt){var Gt=!1,$t=void 0;Rt.forEach(function(Ft,qt){Ft.has([].concat(f(ft))[0])&&(Gt=!0,$t=qt)}),Gt?ft.forEach(function(Ft){Rt[$t].add(Ft)}):Rt.push(new Set(ft))}}}),Rt.forEach(function(ft,st){var Mt=Number.POSITIVE_INFINITY,ct=Number.POSITIVE_INFINITY,ht=Number.NEGATIVE_INFINITY,Wt=Number.NEGATIVE_INFINITY,Nt=!0,At=!1,Zt=void 0;try{for(var Gt=ft[Symbol.iterator](),$t;!(Nt=($t=Gt.next()).done);Nt=!0){var Ft=$t.value,qt=void 0;$=="horizontal"?qt=u.has(Ft)?v[u.get(Ft)]:Z.get(Ft):qt=u.has(Ft)?L[u.get(Ft)]:Z.get(Ft);var _t=tt.get(Ft);qt<Mt&&(Mt=qt),qt>ht&&(ht=qt),_t<ct&&(ct=_t),_t>Wt&&(Wt=_t)}}catch(ie){At=!0,Zt=ie}finally{try{!Nt&&Gt.return&&Gt.return()}finally{if(At)throw Zt}}var ce=(Mt+ht)/2-(ct+Wt)/2,Kt=!0,te=!1,ee=void 0;try{for(var jt=ft[Symbol.iterator](),se;!(Kt=(se=jt.next()).done);Kt=!0){var re=se.value;tt.set(re,tt.get(re)+ce)}}catch(ie){te=!0,ee=ie}finally{try{!Kt&&jt.return&&jt.return()}finally{if(te)throw ee}}})}return tt},rt=function(b){var $=0,K=0,Z=0,at=0;if(b.forEach(function(j){j.left?v[u.get(j.left)]-v[u.get(j.right)]>=0?$++:K++:L[u.get(j.top)]-L[u.get(j.bottom)]>=0?Z++:at++}),$>K&&Z>at)for(var gt=0;gt<u.size;gt++)v[gt]=-1*v[gt],L[gt]=-1*L[gt];else if($>K)for(var ot=0;ot<u.size;ot++)v[ot]=-1*v[ot];else if(Z>at)for(var tt=0;tt<u.size;tt++)L[tt]=-1*L[tt]},n=function(b){var $=[],K=new y,Z=new Set,at=0;return b.forEach(function(gt,ot){if(!Z.has(ot)){$[at]=[];var tt=ot;for(K.push(tt),Z.add(tt),$[at].push(tt);K.length!=0;){tt=K.shift();var j=b.get(tt);j.forEach(function(vt){Z.has(vt.id)||(K.push(vt.id),Z.add(vt.id),$[at].push(vt.id))})}at++}}),$},m=function(b){var $=new Map;return b.forEach(function(K,Z){$.set(Z,[])}),b.forEach(function(K,Z){K.forEach(function(at){$.get(Z).push(at),$.get(at.id).push({id:Z,gap:at.gap,direction:at.direction})})}),$},d=function(b){var $=new Map;return b.forEach(function(K,Z){$.set(Z,[])}),b.forEach(function(K,Z){K.forEach(function(at){$.get(at.id).push({id:Z,gap:at.gap,direction:at.direction})})}),$},E=[],p=[],R=!1,w=!1,I=new Set,H=new Map,x=new Map,k=[];if(l.fixedNodeConstraint&&l.fixedNodeConstraint.forEach(function(S){I.add(S.nodeId)}),l.relativePlacementConstraint&&(l.relativePlacementConstraint.forEach(function(S){S.left?(H.has(S.left)?H.get(S.left).push({id:S.right,gap:S.gap,direction:"horizontal"}):H.set(S.left,[{id:S.right,gap:S.gap,direction:"horizontal"}]),H.has(S.right)||H.set(S.right,[])):(H.has(S.top)?H.get(S.top).push({id:S.bottom,gap:S.gap,direction:"vertical"}):H.set(S.top,[{id:S.bottom,gap:S.gap,direction:"vertical"}]),H.has(S.bottom)||H.set(S.bottom,[]))}),x=m(H),k=n(x)),a.TRANSFORM_ON_CONSTRAINT_HANDLING){if(l.fixedNodeConstraint&&l.fixedNodeConstraint.length>1)l.fixedNodeConstraint.forEach(function(S,b){E[b]=[S.position.x,S.position.y],p[b]=[v[u.get(S.nodeId)],L[u.get(S.nodeId)]]}),R=!0;else if(l.alignmentConstraint)(function(){var S=0;if(l.alignmentConstraint.vertical){for(var b=l.alignmentConstraint.vertical,$=function(tt){var j=new Set;b[tt].forEach(function(yt){j.add(yt)});var vt=new Set([].concat(f(j)).filter(function(yt){return I.has(yt)})),wt=void 0;vt.size>0?wt=v[u.get(vt.values().next().value)]:wt=Q(j).x,b[tt].forEach(function(yt){E[S]=[wt,L[u.get(yt)]],p[S]=[v[u.get(yt)],L[u.get(yt)]],S++})},K=0;K<b.length;K++)$(K);R=!0}if(l.alignmentConstraint.horizontal){for(var Z=l.alignmentConstraint.horizontal,at=function(tt){var j=new Set;Z[tt].forEach(function(yt){j.add(yt)});var vt=new Set([].concat(f(j)).filter(function(yt){return I.has(yt)})),wt=void 0;vt.size>0?wt=v[u.get(vt.values().next().value)]:wt=Q(j).y,Z[tt].forEach(function(yt){E[S]=[v[u.get(yt)],wt],p[S]=[v[u.get(yt)],L[u.get(yt)]],S++})},gt=0;gt<Z.length;gt++)at(gt);R=!0}l.relativePlacementConstraint&&(w=!0)})();else if(l.relativePlacementConstraint){for(var W=0,U=0,et=0;et<k.length;et++)k[et].length>W&&(W=k[et].length,U=et);if(W<x.size/2)rt(l.relativePlacementConstraint),R=!1,w=!1;else{var z=new Map,O=new Map,X=[];k[U].forEach(function(S){H.get(S).forEach(function(b){b.direction=="horizontal"?(z.has(S)?z.get(S).push(b):z.set(S,[b]),z.has(b.id)||z.set(b.id,[]),X.push({left:S,right:b.id})):(O.has(S)?O.get(S).push(b):O.set(S,[b]),O.has(b.id)||O.set(b.id,[]),X.push({top:S,bottom:b.id}))})}),rt(X),w=!1;var B=D(z,"horizontal"),_=D(O,"vertical");k[U].forEach(function(S,b){p[b]=[v[u.get(S)],L[u.get(S)]],E[b]=[],B.has(S)?E[b][0]=B.get(S):E[b][0]=v[u.get(S)],_.has(S)?E[b][1]=_.get(S):E[b][1]=L[u.get(S)]}),R=!0}}if(R){for(var lt=void 0,q=t.transpose(E),It=t.transpose(p),Lt=0;Lt<q.length;Lt++)q[Lt]=t.multGamma(q[Lt]),It[Lt]=t.multGamma(It[Lt]);var dt=t.multMat(q,t.transpose(It)),it=h.svd(dt);lt=t.multMat(it.V,t.transpose(it.U));for(var ut=0;ut<u.size;ut++){var Tt=[v[ut],L[ut]],Ct=[lt[0][0],lt[1][0]],Dt=[lt[0][1],lt[1][1]];v[ut]=t.dotProduct(Tt,Ct),L[ut]=t.dotProduct(Tt,Dt)}w&&rt(l.relativePlacementConstraint)}}if(a.ENFORCE_CONSTRAINTS){if(l.fixedNodeConstraint&&l.fixedNodeConstraint.length>0){var mt={x:0,y:0};l.fixedNodeConstraint.forEach(function(S,b){var $={x:v[u.get(S.nodeId)],y:L[u.get(S.nodeId)]},K=S.position,Z=V(K,$);mt.x+=Z.x,mt.y+=Z.y}),mt.x/=l.fixedNodeConstraint.length,mt.y/=l.fixedNodeConstraint.length,v.forEach(function(S,b){v[b]+=mt.x}),L.forEach(function(S,b){L[b]+=mt.y}),l.fixedNodeConstraint.forEach(function(S){v[u.get(S.nodeId)]=S.position.x,L[u.get(S.nodeId)]=S.position.y})}if(l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var xt=l.alignmentConstraint.vertical,St=function(b){var $=new Set;xt[b].forEach(function(at){$.add(at)});var K=new Set([].concat(f($)).filter(function(at){return I.has(at)})),Z=void 0;K.size>0?Z=v[u.get(K.values().next().value)]:Z=Q($).x,$.forEach(function(at){I.has(at)||(v[u.get(at)]=Z)})},Vt=0;Vt<xt.length;Vt++)St(Vt);if(l.alignmentConstraint.horizontal)for(var Xt=l.alignmentConstraint.horizontal,Ut=function(b){var $=new Set;Xt[b].forEach(function(at){$.add(at)});var K=new Set([].concat(f($)).filter(function(at){return I.has(at)})),Z=void 0;K.size>0?Z=L[u.get(K.values().next().value)]:Z=Q($).y,$.forEach(function(at){I.has(at)||(L[u.get(at)]=Z)})},bt=0;bt<Xt.length;bt++)Ut(bt)}l.relativePlacementConstraint&&function(){var S=new Map,b=new Map,$=new Map,K=new Map,Z=new Map,at=new Map,gt=new Set,ot=new Set;if(I.forEach(function(Yt){gt.add(Yt),ot.add(Yt)}),l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var tt=l.alignmentConstraint.vertical,j=function(Et){$.set("dummy"+Et,[]),tt[Et].forEach(function(Ot){S.set(Ot,"dummy"+Et),$.get("dummy"+Et).push(Ot),I.has(Ot)&&gt.add("dummy"+Et)}),Z.set("dummy"+Et,v[u.get(tt[Et][0])])},vt=0;vt<tt.length;vt++)j(vt);if(l.alignmentConstraint.horizontal)for(var wt=l.alignmentConstraint.horizontal,yt=function(Et){K.set("dummy"+Et,[]),wt[Et].forEach(function(Ot){b.set(Ot,"dummy"+Et),K.get("dummy"+Et).push(Ot),I.has(Ot)&&ot.add("dummy"+Et)}),at.set("dummy"+Et,L[u.get(wt[Et][0])])},Rt=0;Rt<wt.length;Rt++)yt(Rt)}var ft=new Map,st=new Map,Mt=function(Et){H.get(Et).forEach(function(Ot){var Jt=void 0,kt=void 0;Ot.direction=="horizontal"?(Jt=S.get(Et)?S.get(Et):Et,S.get(Ot.id)?kt={id:S.get(Ot.id),gap:Ot.gap,direction:Ot.direction}:kt=Ot,ft.has(Jt)?ft.get(Jt).push(kt):ft.set(Jt,[kt]),ft.has(kt.id)||ft.set(kt.id,[])):(Jt=b.get(Et)?b.get(Et):Et,b.get(Ot.id)?kt={id:b.get(Ot.id),gap:Ot.gap,direction:Ot.direction}:kt=Ot,st.has(Jt)?st.get(Jt).push(kt):st.set(Jt,[kt]),st.has(kt.id)||st.set(kt.id,[]))})},ct=!0,ht=!1,Wt=void 0;try{for(var Nt=H.keys()[Symbol.iterator](),At;!(ct=(At=Nt.next()).done);ct=!0){var Zt=At.value;Mt(Zt)}}catch(Yt){ht=!0,Wt=Yt}finally{try{!ct&&Nt.return&&Nt.return()}finally{if(ht)throw Wt}}var Gt=m(ft),$t=m(st),Ft=n(Gt),qt=n($t),_t=d(ft),ce=d(st),Kt=[],te=[];Ft.forEach(function(Yt,Et){Kt[Et]=[],Yt.forEach(function(Ot){_t.get(Ot).length==0&&Kt[Et].push(Ot)})}),qt.forEach(function(Yt,Et){te[Et]=[],Yt.forEach(function(Ot){ce.get(Ot).length==0&&te[Et].push(Ot)})});var ee=D(ft,"horizontal",gt,Z,Kt),jt=D(st,"vertical",ot,at,te),se=function(Et){$.get(Et)?$.get(Et).forEach(function(Ot){v[u.get(Ot)]=ee.get(Et)}):v[u.get(Et)]=ee.get(Et)},re=!0,ie=!1,Le=void 0;try{for(var ge=ee.keys()[Symbol.iterator](),Me;!(re=(Me=ge.next()).done);re=!0){var ue=Me.value;se(ue)}}catch(Yt){ie=!0,Le=Yt}finally{try{!re&&ge.return&&ge.return()}finally{if(ie)throw Le}}var Ze=function(Et){K.get(Et)?K.get(Et).forEach(function(Ot){L[u.get(Ot)]=jt.get(Et)}):L[u.get(Et)]=jt.get(Et)},ve=!0,Ae=!1,Ce=void 0;try{for(var de=jt.keys()[Symbol.iterator](),we;!(ve=(we=de.next()).done);ve=!0){var ue=we.value;Ze(ue)}}catch(Yt){Ae=!0,Ce=Yt}finally{try{!ve&&de.return&&de.return()}finally{if(Ae)throw Ce}}}()}for(var Ht=0;Ht<F.length;Ht++){var Bt=F[Ht];Bt.getChild()==null&&Bt.setCenter(v[u.get(Bt.id)],L[u.get(Bt.id)])}},i.exports=o},551:i=>{i.exports=C}},N={};function g(i){var r=N[i];if(r!==void 0)return r.exports;var e=N[i]={exports:{}};return G[i](e,e.exports,g),e.exports}var s=g(45);return s})()})}(pe)),pe.exports}(function(M,Y){(function(G,N){M.exports=N(cr())})(Te,function(C){return(()=>{var G={658:i=>{i.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments.length,f=Array(e>1?e-1:0),a=1;a<e;a++)f[a-1]=arguments[a];return f.forEach(function(y){Object.keys(y).forEach(function(t){return r[t]=y[t]})}),r}},548:(i,r,e)=>{var f=function(){function t(h,o){var c=[],l=!0,T=!1,u=void 0;try{for(var v=h[Symbol.iterator](),L;!(l=(L=v.next()).done)&&(c.push(L.value),!(o&&c.length===o));l=!0);}catch(F){T=!0,u=F}finally{try{!l&&v.return&&v.return()}finally{if(T)throw u}}return c}return function(h,o){if(Array.isArray(h))return h;if(Symbol.iterator in Object(h))return t(h,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=e(140).layoutBase.LinkedList,y={};y.getTopMostNodes=function(t){for(var h={},o=0;o<t.length;o++)h[t[o].id()]=!0;var c=t.filter(function(l,T){typeof l=="number"&&(l=T);for(var u=l.parent()[0];u!=null;){if(h[u.id()])return!1;u=u.parent()[0]}return!0});return c},y.connectComponents=function(t,h,o,c){var l=new a,T=new Set,u=[],v=void 0,L=void 0,F=void 0,A=!1,P=1,J=[],V=[],Q=function(){var rt=t.collection();V.push(rt);var n=o[0],m=t.collection();m.merge(n).merge(n.descendants().intersection(h)),u.push(n),m.forEach(function(p){l.push(p),T.add(p),rt.merge(p)});for(var d=function(){n=l.shift();var R=t.collection();n.neighborhood().nodes().forEach(function(x){h.intersection(n.edgesWith(x)).length>0&&R.merge(x)});for(var w=0;w<R.length;w++){var I=R[w];if(v=o.intersection(I.union(I.ancestors())),v!=null&&!T.has(v[0])){var H=v.union(v.descendants());H.forEach(function(x){l.push(x),T.add(x),rt.merge(x),o.has(x)&&u.push(x)})}}};l.length!=0;)d();if(rt.forEach(function(p){h.intersection(p.connectedEdges()).forEach(function(R){rt.has(R.source())&&rt.has(R.target())&&rt.merge(R)})}),u.length==o.length&&(A=!0),!A||A&&P>1){L=u[0],F=L.connectedEdges().length,u.forEach(function(p){p.connectedEdges().length<F&&(F=p.connectedEdges().length,L=p)}),J.push(L.id());var E=t.collection();E.merge(u[0]),u.forEach(function(p){E.merge(p)}),u=[],o=o.difference(E),P++}};do Q();while(!A);return c&&J.length>0&&c.set("dummy"+(c.size+1),J),V},y.relocateComponent=function(t,h,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var v=!0,L=!1,F=void 0;try{for(var A=h.nodeIndexes[Symbol.iterator](),P;!(v=(P=A.next()).done);v=!0){var J=P.value,V=f(J,2),Q=V[0],D=V[1],rt=o.cy.getElementById(Q);if(rt){var n=rt.boundingBox(),m=h.xCoords[D]-n.w/2,d=h.xCoords[D]+n.w/2,E=h.yCoords[D]-n.h/2,p=h.yCoords[D]+n.h/2;m<c&&(c=m),d>l&&(l=d),E<T&&(T=E),p>u&&(u=p)}}}catch(x){L=!0,F=x}finally{try{!v&&A.return&&A.return()}finally{if(L)throw F}}var R=t.x-(l+c)/2,w=t.y-(u+T)/2;h.xCoords=h.xCoords.map(function(x){return x+R}),h.yCoords=h.yCoords.map(function(x){return x+w})}else{Object.keys(h).forEach(function(x){var k=h[x],W=k.getRect().x,U=k.getRect().x+k.getRect().width,et=k.getRect().y,z=k.getRect().y+k.getRect().height;W<c&&(c=W),U>l&&(l=U),et<T&&(T=et),z>u&&(u=z)});var I=t.x-(l+c)/2,H=t.y-(u+T)/2;Object.keys(h).forEach(function(x){var k=h[x];k.setCenter(k.getCenterX()+I,k.getCenterY()+H)})}}},y.calcBoundingBox=function(t,h,o,c){for(var l=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER,L=void 0,F=void 0,A=void 0,P=void 0,J=t.descendants().not(":parent"),V=J.length,Q=0;Q<V;Q++){var D=J[Q];L=h[c.get(D.id())]-D.width()/2,F=h[c.get(D.id())]+D.width()/2,A=o[c.get(D.id())]-D.height()/2,P=o[c.get(D.id())]+D.height()/2,l>L&&(l=L),T<F&&(T=F),u>A&&(u=A),v<P&&(v=P)}var rt={};return rt.topLeftX=l,rt.topLeftY=u,rt.width=T-l,rt.height=v-u,rt},y.calcParentsWithoutChildren=function(t,h){var o=t.collection();return h.nodes(":parent").forEach(function(c){var l=!1;c.children().forEach(function(T){T.css("display")!="none"&&(l=!0)}),l||o.merge(c)}),o},i.exports=y},816:(i,r,e)=>{var f=e(548),a=e(140).CoSELayout,y=e(140).CoSENode,t=e(140).layoutBase.PointD,h=e(140).layoutBase.DimensionD,o=e(140).layoutBase.LayoutConstants,c=e(140).layoutBase.FDLayoutConstants,l=e(140).CoSEConstants,T=function(v,L){var F=v.cy,A=v.eles,P=A.nodes(),J=A.edges(),V=void 0,Q=void 0,D=void 0,rt={};v.randomize&&(V=L.nodeIndexes,Q=L.xCoords,D=L.yCoords);var n=function(x){return typeof x=="function"},m=function(x,k){return n(x)?x(k):x},d=f.calcParentsWithoutChildren(F,A),E=function H(x,k,W,U){for(var et=k.length,z=0;z<et;z++){var O=k[z],X=null;O.intersection(d).length==0&&(X=O.children());var B=void 0,_=O.layoutDimensions({nodeDimensionsIncludeLabels:U.nodeDimensionsIncludeLabels});if(O.outerWidth()!=null&&O.outerHeight()!=null)if(U.randomize)if(!O.isParent())B=x.add(new y(W.graphManager,new t(Q[V.get(O.id())]-_.w/2,D[V.get(O.id())]-_.h/2),new h(parseFloat(_.w),parseFloat(_.h))));else{var lt=f.calcBoundingBox(O,Q,D,V);O.intersection(d).length==0?B=x.add(new y(W.graphManager,new t(lt.topLeftX,lt.topLeftY),new h(lt.width,lt.height))):B=x.add(new y(W.graphManager,new t(lt.topLeftX,lt.topLeftY),new h(parseFloat(_.w),parseFloat(_.h))))}else B=x.add(new y(W.graphManager,new t(O.position("x")-_.w/2,O.position("y")-_.h/2),new h(parseFloat(_.w),parseFloat(_.h))));else B=x.add(new y(this.graphManager));if(B.id=O.data("id"),B.nodeRepulsion=m(U.nodeRepulsion,O),B.paddingLeft=parseInt(O.css("padding")),B.paddingTop=parseInt(O.css("padding")),B.paddingRight=parseInt(O.css("padding")),B.paddingBottom=parseInt(O.css("padding")),U.nodeDimensionsIncludeLabels&&(B.labelWidth=O.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,B.labelHeight=O.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,B.labelPosVertical=O.css("text-valign"),B.labelPosHorizontal=O.css("text-halign")),rt[O.data("id")]=B,isNaN(B.rect.x)&&(B.rect.x=0),isNaN(B.rect.y)&&(B.rect.y=0),X!=null&&X.length>0){var q=void 0;q=W.getGraphManager().add(W.newGraph(),B),H(q,X,W,U)}}},p=function(x,k,W){for(var U=0,et=0,z=0;z<W.length;z++){var O=W[z],X=rt[O.data("source")],B=rt[O.data("target")];if(X&&B&&X!==B&&X.getEdgesBetween(B).length==0){var _=k.add(x.newEdge(),X,B);_.id=O.id(),_.idealLength=m(v.idealEdgeLength,O),_.edgeElasticity=m(v.edgeElasticity,O),U+=_.idealLength,et++}}v.idealEdgeLength!=null&&(et>0?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=U/et:n(v.idealEdgeLength)?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=v.idealEdgeLength,l.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,l.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},R=function(x,k){k.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=k.fixedNodeConstraint),k.alignmentConstraint&&(x.constraints.alignmentConstraint=k.alignmentConstraint),k.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=k.relativePlacementConstraint)};v.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.nestingFactor),v.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=v.gravity),v.numIter!=null&&(l.MAX_ITERATIONS=c.MAX_ITERATIONS=v.numIter),v.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=v.gravityRange),v.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.gravityCompound),v.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.gravityRangeCompound),v.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.initialEnergyOnIncremental),v.tilingCompareBy!=null&&(l.TILING_COMPARE_BY=v.tilingCompareBy),v.quality=="proof"?o.QUALITY=2:o.QUALITY=0,l.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=v.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!v.randomize,l.ANIMATE=c.ANIMATE=o.ANIMATE=v.animate,l.TILE=v.tile,l.TILING_PADDING_VERTICAL=typeof v.tilingPaddingVertical=="function"?v.tilingPaddingVertical.call():v.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof v.tilingPaddingHorizontal=="function"?v.tilingPaddingHorizontal.call():v.tilingPaddingHorizontal,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,l.PURE_INCREMENTAL=!v.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=v.uniformNodeDimensions,v.step=="transformed"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!1),v.step=="enforced"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!1),v.step=="cose"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!0),v.step=="all"&&(v.randomize?l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!0),v.fixedNodeConstraint||v.alignmentConstraint||v.relativePlacementConstraint?l.TREE_REDUCTION_ON_INCREMENTAL=!1:l.TREE_REDUCTION_ON_INCREMENTAL=!0;var w=new a,I=w.newGraphManager();return E(I.addRoot(),f.getTopMostNodes(P),w,v),p(w,I,J),R(w,v),w.runLayout(),rt};i.exports={coseLayout:T}},212:(i,r,e)=>{var f=function(){function v(L,F){for(var A=0;A<F.length;A++){var P=F[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(L,P.key,P)}}return function(L,F,A){return F&&v(L.prototype,F),A&&v(L,A),L}}();function a(v,L){if(!(v instanceof L))throw new TypeError("Cannot call a class as a function")}var y=e(658),t=e(548),h=e(657),o=h.spectralLayout,c=e(816),l=c.coseLayout,T=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(L){return 4500},idealEdgeLength:function(L){return 50},edgeElasticity:function(L){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),u=function(){function v(L){a(this,v),this.options=y({},T,L)}return f(v,[{key:"run",value:function(){var F=this,A=this.options,P=A.cy,J=A.eles,V=[],Q=[],D=void 0,rt=[];A.fixedNodeConstraint&&(!Array.isArray(A.fixedNodeConstraint)||A.fixedNodeConstraint.length==0)&&(A.fixedNodeConstraint=void 0),A.alignmentConstraint&&(A.alignmentConstraint.vertical&&(!Array.isArray(A.alignmentConstraint.vertical)||A.alignmentConstraint.vertical.length==0)&&(A.alignmentConstraint.vertical=void 0),A.alignmentConstraint.horizontal&&(!Array.isArray(A.alignmentConstraint.horizontal)||A.alignmentConstraint.horizontal.length==0)&&(A.alignmentConstraint.horizontal=void 0)),A.relativePlacementConstraint&&(!Array.isArray(A.relativePlacementConstraint)||A.relativePlacementConstraint.length==0)&&(A.relativePlacementConstraint=void 0);var n=A.fixedNodeConstraint||A.alignmentConstraint||A.relativePlacementConstraint;n&&(A.tile=!1,A.packComponents=!1);var m=void 0,d=!1;if(P.layoutUtilities&&A.packComponents&&(m=P.layoutUtilities("get"),m||(m=P.layoutUtilities()),d=!0),J.nodes().length>0)if(d){var R=t.getTopMostNodes(A.eles.nodes());if(D=t.connectComponents(P,A.eles,R),D.forEach(function(dt){var it=dt.boundingBox();rt.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),A.randomize&&D.forEach(function(dt){A.eles=dt,V.push(o(A))}),A.quality=="default"||A.quality=="proof"){var w=P.collection();if(A.tile){var I=new Map,H=[],x=[],k=0,W={nodeIndexes:I,xCoords:H,yCoords:x},U=[];if(D.forEach(function(dt,it){dt.edges().length==0&&(dt.nodes().forEach(function(ut,Tt){w.merge(dt.nodes()[Tt]),ut.isParent()||(W.nodeIndexes.set(dt.nodes()[Tt].id(),k++),W.xCoords.push(dt.nodes()[0].position().x),W.yCoords.push(dt.nodes()[0].position().y))}),U.push(it))}),w.length>1){var et=w.boundingBox();rt.push({x:et.x1+et.w/2,y:et.y1+et.h/2}),D.push(w),V.push(W);for(var z=U.length-1;z>=0;z--)D.splice(U[z],1),V.splice(U[z],1),rt.splice(U[z],1)}}D.forEach(function(dt,it){A.eles=dt,Q.push(l(A,V[it])),t.relocateComponent(rt[it],Q[it],A)})}else D.forEach(function(dt,it){t.relocateComponent(rt[it],V[it],A)});var O=new Set;if(D.length>1){var X=[],B=J.filter(function(dt){return dt.css("display")=="none"});D.forEach(function(dt,it){var ut=void 0;if(A.quality=="draft"&&(ut=V[it].nodeIndexes),dt.nodes().not(B).length>0){var Tt={};Tt.edges=[],Tt.nodes=[];var Ct=void 0;dt.nodes().not(B).forEach(function(Dt){if(A.quality=="draft")if(!Dt.isParent())Ct=ut.get(Dt.id()),Tt.nodes.push({x:V[it].xCoords[Ct]-Dt.boundingbox().w/2,y:V[it].yCoords[Ct]-Dt.boundingbox().h/2,width:Dt.boundingbox().w,height:Dt.boundingbox().h});else{var mt=t.calcBoundingBox(Dt,V[it].xCoords,V[it].yCoords,ut);Tt.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else Q[it][Dt.id()]&&Tt.nodes.push({x:Q[it][Dt.id()].getLeft(),y:Q[it][Dt.id()].getTop(),width:Q[it][Dt.id()].getWidth(),height:Q[it][Dt.id()].getHeight()})}),dt.edges().forEach(function(Dt){var mt=Dt.source(),xt=Dt.target();if(mt.css("display")!="none"&&xt.css("display")!="none")if(A.quality=="draft"){var St=ut.get(mt.id()),Vt=ut.get(xt.id()),Xt=[],Ut=[];if(mt.isParent()){var bt=t.calcBoundingBox(mt,V[it].xCoords,V[it].yCoords,ut);Xt.push(bt.topLeftX+bt.width/2),Xt.push(bt.topLeftY+bt.height/2)}else Xt.push(V[it].xCoords[St]),Xt.push(V[it].yCoords[St]);if(xt.isParent()){var Ht=t.calcBoundingBox(xt,V[it].xCoords,V[it].yCoords,ut);Ut.push(Ht.topLeftX+Ht.width/2),Ut.push(Ht.topLeftY+Ht.height/2)}else Ut.push(V[it].xCoords[Vt]),Ut.push(V[it].yCoords[Vt]);Tt.edges.push({startX:Xt[0],startY:Xt[1],endX:Ut[0],endY:Ut[1]})}else Q[it][mt.id()]&&Q[it][xt.id()]&&Tt.edges.push({startX:Q[it][mt.id()].getCenterX(),startY:Q[it][mt.id()].getCenterY(),endX:Q[it][xt.id()].getCenterX(),endY:Q[it][xt.id()].getCenterY()})}),Tt.nodes.length>0&&(X.push(Tt),O.add(it))}});var _=m.packComponents(X,A.randomize).shifts;if(A.quality=="draft")V.forEach(function(dt,it){var ut=dt.xCoords.map(function(Ct){return Ct+_[it].dx}),Tt=dt.yCoords.map(function(Ct){return Ct+_[it].dy});dt.xCoords=ut,dt.yCoords=Tt});else{var lt=0;O.forEach(function(dt){Object.keys(Q[dt]).forEach(function(it){var ut=Q[dt][it];ut.setCenter(ut.getCenterX()+_[lt].dx,ut.getCenterY()+_[lt].dy)}),lt++})}}}else{var E=A.eles.boundingBox();if(rt.push({x:E.x1+E.w/2,y:E.y1+E.h/2}),A.randomize){var p=o(A);V.push(p)}A.quality=="default"||A.quality=="proof"?(Q.push(l(A,V[0])),t.relocateComponent(rt[0],Q[0],A)):t.relocateComponent(rt[0],V[0],A)}var q=function(it,ut){if(A.quality=="default"||A.quality=="proof"){typeof it=="number"&&(it=ut);var Tt=void 0,Ct=void 0,Dt=it.data("id");return Q.forEach(function(xt){Dt in xt&&(Tt={x:xt[Dt].getRect().getCenterX(),y:xt[Dt].getRect().getCenterY()},Ct=xt[Dt])}),A.nodeDimensionsIncludeLabels&&(Ct.labelWidth&&(Ct.labelPosHorizontal=="left"?Tt.x+=Ct.labelWidth/2:Ct.labelPosHorizontal=="right"&&(Tt.x-=Ct.labelWidth/2)),Ct.labelHeight&&(Ct.labelPosVertical=="top"?Tt.y+=Ct.labelHeight/2:Ct.labelPosVertical=="bottom"&&(Tt.y-=Ct.labelHeight/2))),Tt==null&&(Tt={x:it.position("x"),y:it.position("y")}),{x:Tt.x,y:Tt.y}}else{var mt=void 0;return V.forEach(function(xt){var St=xt.nodeIndexes.get(it.id());St!=null&&(mt={x:xt.xCoords[St],y:xt.yCoords[St]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(A.quality=="default"||A.quality=="proof"||A.randomize){var It=t.calcParentsWithoutChildren(P,J),Lt=J.filter(function(dt){return dt.css("display")=="none"});A.eles=J.not(Lt),J.nodes().not(":parent").not(Lt).layoutPositions(F,A,q),It.length>0&&It.forEach(function(dt){dt.position(q(dt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),v}();i.exports=u},657:(i,r,e)=>{var f=e(548),a=e(140).layoutBase.Matrix,y=e(140).layoutBase.SVD,t=function(o){var c=o.cy,l=o.eles,T=l.nodes(),u=l.nodes(":parent"),v=new Map,L=new Map,F=new Map,A=[],P=[],J=[],V=[],Q=[],D=[],rt=[],n=[],m=void 0,d=1e8,E=1e-9,p=o.piTol,R=o.samplingType,w=o.nodeSeparation,I=void 0,H=function(){for(var b=0,$=0,K=!1;$<I;){b=Math.floor(Math.random()*m),K=!1;for(var Z=0;Z<$;Z++)if(V[Z]==b){K=!0;break}if(!K)V[$]=b,$++;else continue}},x=function(b,$,K){for(var Z=[],at=0,gt=0,ot=0,tt=void 0,j=[],vt=0,wt=1,yt=0;yt<m;yt++)j[yt]=d;for(Z[gt]=b,j[b]=0;gt>=at;){ot=Z[at++];for(var Rt=A[ot],ft=0;ft<Rt.length;ft++)tt=L.get(Rt[ft]),j[tt]==d&&(j[tt]=j[ot]+1,Z[++gt]=tt);D[ot][$]=j[ot]*w}if(K){for(var st=0;st<m;st++)D[st][$]<Q[st]&&(Q[st]=D[st][$]);for(var Mt=0;Mt<m;Mt++)Q[Mt]>vt&&(vt=Q[Mt],wt=Mt)}return wt},k=function(b){var $=void 0;if(b){$=Math.floor(Math.random()*m);for(var Z=0;Z<m;Z++)Q[Z]=d;for(var at=0;at<I;at++)V[at]=$,$=x($,at,b)}else{H();for(var K=0;K<I;K++)x(V[K],K,b)}for(var gt=0;gt<m;gt++)for(var ot=0;ot<I;ot++)D[gt][ot]*=D[gt][ot];for(var tt=0;tt<I;tt++)rt[tt]=[];for(var j=0;j<I;j++)for(var vt=0;vt<I;vt++)rt[j][vt]=D[V[vt]][j]},W=function(){for(var b=y.svd(rt),$=b.S,K=b.U,Z=b.V,at=$[0]*$[0]*$[0],gt=[],ot=0;ot<I;ot++){gt[ot]=[];for(var tt=0;tt<I;tt++)gt[ot][tt]=0,ot==tt&&(gt[ot][tt]=$[ot]/($[ot]*$[ot]+at/($[ot]*$[ot])))}n=a.multMat(a.multMat(Z,gt),a.transpose(K))},U=function(){for(var b=void 0,$=void 0,K=[],Z=[],at=[],gt=[],ot=0;ot<m;ot++)K[ot]=Math.random(),Z[ot]=Math.random();K=a.normalize(K),Z=a.normalize(Z);for(var tt=E,j=E,vt=void 0;;){for(var wt=0;wt<m;wt++)at[wt]=K[wt];if(K=a.multGamma(a.multL(a.multGamma(at),D,n)),b=a.dotProduct(at,K),K=a.normalize(K),tt=a.dotProduct(at,K),vt=Math.abs(tt/j),vt<=1+p&&vt>=1)break;j=tt}for(var yt=0;yt<m;yt++)at[yt]=K[yt];for(j=E;;){for(var Rt=0;Rt<m;Rt++)gt[Rt]=Z[Rt];if(gt=a.minusOp(gt,a.multCons(at,a.dotProduct(at,gt))),Z=a.multGamma(a.multL(a.multGamma(gt),D,n)),$=a.dotProduct(gt,Z),Z=a.normalize(Z),tt=a.dotProduct(gt,Z),vt=Math.abs(tt/j),vt<=1+p&&vt>=1)break;j=tt}for(var ft=0;ft<m;ft++)gt[ft]=Z[ft];P=a.multCons(at,Math.sqrt(Math.abs(b))),J=a.multCons(gt,Math.sqrt(Math.abs($)))};f.connectComponents(c,l,f.getTopMostNodes(T),v),u.forEach(function(S){f.connectComponents(c,l,f.getTopMostNodes(S.descendants().intersection(l)),v)});for(var et=0,z=0;z<T.length;z++)T[z].isParent()||L.set(T[z].id(),et++);var O=!0,X=!1,B=void 0;try{for(var _=v.keys()[Symbol.iterator](),lt;!(O=(lt=_.next()).done);O=!0){var q=lt.value;L.set(q,et++)}}catch(S){X=!0,B=S}finally{try{!O&&_.return&&_.return()}finally{if(X)throw B}}for(var It=0;It<L.size;It++)A[It]=[];u.forEach(function(S){for(var b=S.children().intersection(l);b.nodes(":childless").length==0;)b=b.nodes()[0].children().intersection(l);var $=0,K=b.nodes(":childless")[0].connectedEdges().length;b.nodes(":childless").forEach(function(Z,at){Z.connectedEdges().length<K&&(K=Z.connectedEdges().length,$=at)}),F.set(S.id(),b.nodes(":childless")[$].id())}),T.forEach(function(S){var b=void 0;S.isParent()?b=L.get(F.get(S.id())):b=L.get(S.id()),S.neighborhood().nodes().forEach(function($){l.intersection(S.edgesWith($)).length>0&&($.isParent()?A[b].push(F.get($.id())):A[b].push($.id()))})});var Lt=function(b){var $=L.get(b),K=void 0;v.get(b).forEach(function(Z){c.getElementById(Z).isParent()?K=F.get(Z):K=Z,A[$].push(K),A[L.get(K)].push(b)})},dt=!0,it=!1,ut=void 0;try{for(var Tt=v.keys()[Symbol.iterator](),Ct;!(dt=(Ct=Tt.next()).done);dt=!0){var Dt=Ct.value;Lt(Dt)}}catch(S){it=!0,ut=S}finally{try{!dt&&Tt.return&&Tt.return()}finally{if(it)throw ut}}m=L.size;var mt=void 0;if(m>2){I=m<o.sampleSize?m:o.sampleSize;for(var xt=0;xt<m;xt++)D[xt]=[];for(var St=0;St<I;St++)n[St]=[];return o.quality=="draft"||o.step=="all"?(k(R),W(),U(),mt={nodeIndexes:L,xCoords:P,yCoords:J}):(L.forEach(function(S,b){P.push(c.getElementById(b).position("x")),J.push(c.getElementById(b).position("y"))}),mt={nodeIndexes:L,xCoords:P,yCoords:J}),mt}else{var Vt=L.keys(),Xt=c.getElementById(Vt.next().value),Ut=Xt.position(),bt=Xt.outerWidth();if(P.push(Ut.x),J.push(Ut.y),m==2){var Ht=c.getElementById(Vt.next().value),Bt=Ht.outerWidth();P.push(Ut.x+bt/2+Bt/2+o.idealEdgeLength),J.push(Ut.y)}return mt={nodeIndexes:L,xCoords:P,yCoords:J},mt}};i.exports={spectralLayout:t}},579:(i,r,e)=>{var f=e(212),a=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&a(cytoscape),i.exports=a},140:i=>{i.exports=C}},N={};function g(i){var r=N[i];if(r!==void 0)return r.exports;var e=N[i]={exports:{}};return G[i](e,e.exports,g),e.exports}var s=g(579);return s})()})})(be);var gr=be.exports;const ur=ke(gr);var xe={L:"left",R:"right",T:"top",B:"bottom"},Re={L:nt(M=>`${M},${M/2} 0,${M} 0,0`,"L"),R:nt(M=>`0,${M/2} ${M},0 ${M},${M}`,"R"),T:nt(M=>`0,0 ${M},0 ${M/2},${M}`,"T"),B:nt(M=>`${M/2},0 ${M},${M} 0,${M}`,"B")},he={L:nt((M,Y)=>M-Y+2,"L"),R:nt((M,Y)=>M-2,"R"),T:nt((M,Y)=>M-Y+2,"T"),B:nt((M,Y)=>M-2,"B")},vr=nt(function(M){return zt(M)?M==="L"?"R":"L":M==="T"?"B":"T"},"getOppositeArchitectureDirection"),Ie=nt(function(M){const Y=M;return Y==="L"||Y==="R"||Y==="T"||Y==="B"},"isArchitectureDirection"),zt=nt(function(M){const Y=M;return Y==="L"||Y==="R"},"isArchitectureDirectionX"),Qt=nt(function(M){const Y=M;return Y==="T"||Y==="B"},"isArchitectureDirectionY"),Pe=nt(function(M,Y){const C=zt(M)&&Qt(Y),G=Qt(M)&&zt(Y);return C||G},"isArchitectureDirectionXY"),dr=nt(function(M){const Y=M[0],C=M[1],G=zt(Y)&&Qt(C),N=Qt(Y)&&zt(C);return G||N},"isArchitecturePairXY"),pr=nt(function(M){return M!=="LL"&&M!=="RR"&&M!=="TT"&&M!=="BB"},"isValidArchitectureDirectionPair"),me=nt(function(M,Y){const C=`${M}${Y}`;return pr(C)?C:void 0},"getArchitectureDirectionPair"),yr=nt(function([M,Y],C){const G=C[0],N=C[1];return zt(G)?Qt(N)?[M+(G==="L"?-1:1),Y+(N==="T"?1:-1)]:[M+(G==="L"?-1:1),Y]:zt(N)?[M+(N==="L"?1:-1),Y+(G==="T"?1:-1)]:[M,Y+(G==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Er=nt(function(M){return M==="LT"||M==="TL"?[1,1]:M==="BL"||M==="LB"?[1,-1]:M==="BR"||M==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),mr=nt(function(M){return M.type==="service"},"isArchitectureService"),Tr=nt(function(M){return M.type==="junction"},"isArchitectureJunction"),Ge=nt(M=>M.data(),"edgeData"),ne=nt(M=>M.data(),"nodeData"),Ue=qe.architecture,pt=new hr(()=>({nodes:{},groups:{},edges:[],registeredIds:{},config:Ue,dataStructures:void 0,elements:{}})),Nr=nt(()=>{pt.reset(),ar()},"clear"),Lr=nt(function({id:M,icon:Y,in:C,title:G,iconText:N}){if(pt.records.registeredIds[M]!==void 0)throw new Error(`The service id [${M}] is already in use by another ${pt.records.registeredIds[M]}`);if(C!==void 0){if(M===C)throw new Error(`The service [${M}] cannot be placed within itself`);if(pt.records.registeredIds[C]===void 0)throw new Error(`The service [${M}]'s parent does not exist. Please make sure the parent is created before this service`);if(pt.records.registeredIds[C]==="node")throw new Error(`The service [${M}]'s parent is not a group`)}pt.records.registeredIds[M]="node",pt.records.nodes[M]={id:M,type:"service",icon:Y,iconText:N,title:G,edges:[],in:C}},"addService"),Mr=nt(()=>Object.values(pt.records.nodes).filter(mr),"getServices"),Ar=nt(function({id:M,in:Y}){pt.records.registeredIds[M]="node",pt.records.nodes[M]={id:M,type:"junction",edges:[],in:Y}},"addJunction"),Cr=nt(()=>Object.values(pt.records.nodes).filter(Tr),"getJunctions"),wr=nt(()=>Object.values(pt.records.nodes),"getNodes"),Or=nt(M=>pt.records.nodes[M],"getNode"),Dr=nt(function({id:M,icon:Y,in:C,title:G}){if(pt.records.registeredIds[M]!==void 0)throw new Error(`The group id [${M}] is already in use by another ${pt.records.registeredIds[M]}`);if(C!==void 0){if(M===C)throw new Error(`The group [${M}] cannot be placed within itself`);if(pt.records.registeredIds[C]===void 0)throw new Error(`The group [${M}]'s parent does not exist. Please make sure the parent is created before this group`);if(pt.records.registeredIds[C]==="node")throw new Error(`The group [${M}]'s parent is not a group`)}pt.records.registeredIds[M]="group",pt.records.groups[M]={id:M,icon:Y,title:G,in:C}},"addGroup"),xr=nt(()=>Object.values(pt.records.groups),"getGroups"),Rr=nt(function({lhsId:M,rhsId:Y,lhsDir:C,rhsDir:G,lhsInto:N,rhsInto:g,lhsGroup:s,rhsGroup:i,title:r}){if(!Ie(C))throw new Error(`Invalid direction given for left hand side of edge ${M}--${Y}. Expected (L,R,T,B) got ${C}`);if(!Ie(G))throw new Error(`Invalid direction given for right hand side of edge ${M}--${Y}. Expected (L,R,T,B) got ${G}`);if(pt.records.nodes[M]===void 0&&pt.records.groups[M]===void 0)throw new Error(`The left-hand id [${M}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(pt.records.nodes[Y]===void 0&&pt.records.groups[M]===void 0)throw new Error(`The right-hand id [${Y}] does not yet exist. Please create the service/group before declaring an edge to it.`);const e=pt.records.nodes[M].in,f=pt.records.nodes[Y].in;if(s&&e&&f&&e==f)throw new Error(`The left-hand id [${M}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(i&&e&&f&&e==f)throw new Error(`The right-hand id [${Y}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const a={lhsId:M,lhsDir:C,lhsInto:N,lhsGroup:s,rhsId:Y,rhsDir:G,rhsInto:g,rhsGroup:i,title:r};pt.records.edges.push(a),pt.records.nodes[M]&&pt.records.nodes[Y]&&(pt.records.nodes[M].edges.push(pt.records.edges[pt.records.edges.length-1]),pt.records.nodes[Y].edges.push(pt.records.edges[pt.records.edges.length-1]))},"addEdge"),Ir=nt(()=>pt.records.edges,"getEdges"),Sr=nt(()=>{if(pt.records.dataStructures===void 0){const M=Object.entries(pt.records.nodes).reduce((s,[i,r])=>(s[i]=r.edges.reduce((e,f)=>{if(f.lhsId===i){const a=me(f.lhsDir,f.rhsDir);a&&(e[a]=f.rhsId)}else{const a=me(f.rhsDir,f.lhsDir);a&&(e[a]=f.lhsId)}return e},{}),s),{}),Y=Object.keys(M)[0],C={[Y]:1},G=Object.keys(M).reduce((s,i)=>i===Y?s:{...s,[i]:1},{}),N=nt(s=>{const i={[s]:[0,0]},r=[s];for(;r.length>0;){const e=r.shift();if(e){C[e]=1,delete G[e];const f=M[e],[a,y]=i[e];Object.entries(f).forEach(([t,h])=>{C[h]||(i[h]=yr([a,y],t),r.push(h))})}}return i},"BFS"),g=[N(Y)];for(;Object.keys(G).length>0;)g.push(N(Object.keys(G)[0]));pt.records.dataStructures={adjList:M,spatialMaps:g}}return pt.records.dataStructures},"getDataStructures"),Fr=nt((M,Y)=>{pt.records.elements[M]=Y},"setElementForId"),br=nt(M=>pt.records.elements[M],"getElementById"),le={clear:Nr,setDiagramTitle:Ke,getDiagramTitle:je,setAccTitle:_e,getAccTitle:tr,setAccDescription:er,getAccDescription:rr,addService:Lr,getServices:Mr,addJunction:Ar,getJunctions:Cr,getNodes:wr,getNode:Or,addGroup:Dr,getGroups:xr,addEdge:Rr,getEdges:Ir,setElementForId:Fr,getElementById:br,getDataStructures:Sr};function Pt(M){const Y=fe().architecture;return Y!=null&&Y[M]?Y[M]:Ue[M]}nt(Pt,"getConfigField");var Pr=nt((M,Y)=>{sr(M,Y),M.groups.map(Y.addGroup),M.services.map(C=>Y.addService({...C,type:"service"})),M.junctions.map(C=>Y.addJunction({...C,type:"junction"})),M.edges.map(Y.addEdge)},"populateDb"),Gr={parse:nt(async M=>{const Y=await lr("architecture",M);Se.debug(Y),Pr(Y,le)},"parse")},Ur=nt(M=>`
.edge {
stroke-width: ${M.archEdgeWidth};
stroke: ${M.archEdgeColor};
fill: none;
}
.arrow {
fill: ${M.archEdgeArrowColor};
}
.node-bkg {
fill: none;
stroke: ${M.archGroupBorderColor};
stroke-width: ${M.archGroupBorderWidth};
stroke-dasharray: 8;
}
.node-icon-text {
display: flex;
align-items: center;
}
.node-icon-text > div {
color: #fff;
margin: 1px;
height: fit-content;
text-align: center;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
}
`,"getStyles"),Yr=Ur,ae=nt(M=>`<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${M}</g>`,"wrapIcon"),oe={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:ae('<path id="b" data-name="4" d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="c" data-name="3" d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path id="d" data-name="2" d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse id="e" data-name="1" cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},server:{body:ae('<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"/><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"/></g>')},disk:{body:ae('<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"/>')},internet:{body:ae('<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},cloud:{body:ae('<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"/>')},unknown:Je,blank:{body:ae("")}}},Xr=nt(async function(M,Y){const C=Pt("padding"),G=Pt("iconSize"),N=G/2,g=G/6,s=g/2;await Promise.all(Y.edges().map(async i=>{var P,J;const{source:r,sourceDir:e,sourceArrow:f,sourceGroup:a,target:y,targetDir:t,targetArrow:h,targetGroup:o,label:c}=Ge(i);let{x:l,y:T}=i[0].sourceEndpoint();const{x:u,y:v}=i[0].midpoint();let{x:L,y:F}=i[0].targetEndpoint();const A=C+4;if(a&&(zt(e)?l+=e==="L"?-A:A:T+=e==="T"?-A:A+18),o&&(zt(t)?L+=t==="L"?-A:A:F+=t==="T"?-A:A+18),!a&&((P=le.getNode(r))==null?void 0:P.type)==="junction"&&(zt(e)?l+=e==="L"?N:-N:T+=e==="T"?N:-N),!o&&((J=le.getNode(y))==null?void 0:J.type)==="junction"&&(zt(t)?L+=t==="L"?N:-N:F+=t==="T"?N:-N),i[0]._private.rscratch){const V=M.insert("g");if(V.insert("path").attr("d",`M ${l},${T} L ${u},${v} L${L},${F} `).attr("class","edge"),f){const Q=zt(e)?he[e](l,g):l-s,D=Qt(e)?he[e](T,g):T-s;V.insert("polygon").attr("points",Re[e](g)).attr("transform",`translate(${Q},${D})`).attr("class","arrow")}if(h){const Q=zt(t)?he[t](L,g):L-s,D=Qt(t)?he[t](F,g):F-s;V.insert("polygon").attr("points",Re[t](g)).attr("transform",`translate(${Q},${D})`).attr("class","arrow")}if(c){const Q=Pe(e,t)?"XY":zt(e)?"X":"Y";let D=0;Q==="X"?D=Math.abs(l-L):Q==="Y"?D=Math.abs(T-F)/1.5:D=Math.abs(l-L)/2;const rt=V.append("g");if(await Ne(rt,c,{useHtmlLabels:!1,width:D,classes:"architecture-service-label"},fe()),rt.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),Q==="X")rt.attr("transform","translate("+u+", "+v+")");else if(Q==="Y")rt.attr("transform","translate("+u+", "+v+") rotate(-90)");else if(Q==="XY"){const n=me(e,t);if(n&&dr(n)){const m=rt.node().getBoundingClientRect(),[d,E]=Er(n);rt.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*d*E*45})`);const p=rt.node().getBoundingClientRect();rt.attr("transform",`
translate(${u}, ${v-m.height/2})
translate(${d*p.width/2}, ${E*p.height/2})
rotate(${-1*d*E*45}, 0, ${m.height/2})
`)}}}}}))},"drawEdges"),Hr=nt(async function(M,Y){const G=Pt("padding")*.75,N=Pt("fontSize"),s=Pt("iconSize")/2;await Promise.all(Y.nodes().map(async i=>{const r=ne(i);if(r.type==="group"){const{h:e,w:f,x1:a,y1:y}=i.boundingBox();M.append("rect").attr("x",a+s).attr("y",y+s).attr("width",f).attr("height",e).attr("class","node-bkg");const t=M.append("g");let h=a,o=y;if(r.icon){const c=t.append("g");c.html(`<g>${await Ee(r.icon,{height:G,width:G,fallbackPrefix:oe.prefix})}</g>`),c.attr("transform","translate("+(h+s+1)+", "+(o+s+1)+")"),h+=G,o+=N/2-1-2}if(r.label){const c=t.append("g");await Ne(c,r.label,{useHtmlLabels:!1,width:f,classes:"architecture-service-label"},fe()),c.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),c.attr("transform","translate("+(h+s+4)+", "+(o+s+2)+")")}}}))},"drawGroups"),Wr=nt(async function(M,Y,C){for(const G of C){const N=Y.append("g"),g=Pt("iconSize");if(G.title){const e=N.append("g");await Ne(e,G.title,{useHtmlLabels:!1,width:g*1.5,classes:"architecture-service-label"},fe()),e.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),e.attr("transform","translate("+g/2+", "+g+")")}const s=N.append("g");if(G.icon)s.html(`<g>${await Ee(G.icon,{height:g,width:g,fallbackPrefix:oe.prefix})}</g>`);else if(G.iconText){s.html(`<g>${await Ee("blank",{height:g,width:g,fallbackPrefix:oe.prefix})}</g>`);const a=s.append("g").append("foreignObject").attr("width",g).attr("height",g).append("div").attr("class","node-icon-text").attr("style",`height: ${g}px;`).append("div").html(G.iconText),y=parseInt(window.getComputedStyle(a.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;a.attr("style",`-webkit-line-clamp: ${Math.floor((g-2)/y)};`)}else s.append("path").attr("class","node-bkg").attr("id","node-"+G.id).attr("d",`M0 ${g} v${-g} q0,-5 5,-5 h${g} q5,0 5,5 v${g} H0 Z`);N.attr("class","architecture-service");const{width:i,height:r}=N._groups[0][0].getBBox();G.width=i,G.height=r,M.setElementForId(G.id,N)}return 0},"drawServices"),Vr=nt(function(M,Y,C){C.forEach(G=>{const N=Y.append("g"),g=Pt("iconSize");N.append("g").append("rect").attr("id","node-"+G.id).attr("fill-opacity","0").attr("width",g).attr("height",g),N.attr("class","architecture-junction");const{width:i,height:r}=N._groups[0][0].getBBox();N.width=i,N.height=r,M.setElementForId(G.id,N)})},"drawJunctions");Qe([{name:oe.prefix,icons:oe}]);Fe.use(ur);function Ye(M,Y){M.forEach(C=>{Y.add({group:"nodes",data:{type:"service",id:C.id,icon:C.icon,label:C.title,parent:C.in,width:Pt("iconSize"),height:Pt("iconSize")},classes:"node-service"})})}nt(Ye,"addServices");function Xe(M,Y){M.forEach(C=>{Y.add({group:"nodes",data:{type:"junction",id:C.id,parent:C.in,width:Pt("iconSize"),height:Pt("iconSize")},classes:"node-junction"})})}nt(Xe,"addJunctions");function He(M,Y){Y.nodes().map(C=>{const G=ne(C);if(G.type==="group")return;G.x=C.position().x,G.y=C.position().y,M.getElementById(G.id).attr("transform","translate("+(G.x||0)+","+(G.y||0)+")")})}nt(He,"positionNodes");function We(M,Y){M.forEach(C=>{Y.add({group:"nodes",data:{type:"group",id:C.id,icon:C.icon,label:C.title,parent:C.in},classes:"node-group"})})}nt(We,"addGroups");function Ve(M,Y){M.forEach(C=>{const{lhsId:G,rhsId:N,lhsInto:g,lhsGroup:s,rhsInto:i,lhsDir:r,rhsDir:e,rhsGroup:f,title:a}=C,y=Pe(C.lhsDir,C.rhsDir)?"segments":"straight",t={id:`${G}-${N}`,label:a,source:G,sourceDir:r,sourceArrow:g,sourceGroup:s,sourceEndpoint:r==="L"?"0 50%":r==="R"?"100% 50%":r==="T"?"50% 0":"50% 100%",target:N,targetDir:e,targetArrow:i,targetGroup:f,targetEndpoint:e==="L"?"0 50%":e==="R"?"100% 50%":e==="T"?"50% 0":"50% 100%"};Y.add({group:"edges",data:t,classes:y})})}nt(Ve,"addEdges");function ze(M){const Y=M.map(N=>{const g={},s={};return Object.entries(N).forEach(([i,[r,e]])=>{g[e]||(g[e]=[]),s[r]||(s[r]=[]),g[e].push(i),s[r].push(i)}),{horiz:Object.values(g).filter(i=>i.length>1),vert:Object.values(s).filter(i=>i.length>1)}}),[C,G]=Y.reduce(([N,g],{horiz:s,vert:i})=>[[...N,...s],[...g,...i]],[[],[]]);return{horizontal:C,vertical:G}}nt(ze,"getAlignments");function Be(M){const Y=[],C=nt(N=>`${N[0]},${N[1]}`,"posToStr"),G=nt(N=>N.split(",").map(g=>parseInt(g)),"strToPos");return M.forEach(N=>{const g=Object.fromEntries(Object.entries(N).map(([e,f])=>[C(f),e])),s=[C([0,0])],i={},r={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;s.length>0;){const e=s.shift();if(e){i[e]=1;const f=g[e];if(f){const a=G(e);Object.entries(r).forEach(([y,t])=>{const h=C([a[0]+t[0],a[1]+t[1]]),o=g[h];o&&!i[h]&&(s.push(h),Y.push({[xe[y]]:o,[xe[vr(y)]]:f,gap:1.5*Pt("iconSize")}))})}}}}),Y}nt(Be,"getRelativeConstraints");function $e(M,Y,C,G,{spatialMaps:N}){return new Promise(g=>{const s=ir("body").append("div").attr("id","cy").attr("style","display:none"),i=Fe({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight",label:"data(label)","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${Pt("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${Pt("padding")}px`}}]});s.remove(),We(C,i),Ye(M,i),Xe(Y,i),Ve(G,i);const r=ze(N),e=Be(N),f=i.layout({name:"fcose",quality:"proof",styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(a){const[y,t]=a.connectedNodes(),{parent:h}=ne(y),{parent:o}=ne(t);return h===o?1.5*Pt("iconSize"):.5*Pt("iconSize")},edgeElasticity(a){const[y,t]=a.connectedNodes(),{parent:h}=ne(y),{parent:o}=ne(t);return h===o?.45:.001},alignmentConstraint:r,relativePlacementConstraint:e});f.one("layoutstop",()=>{var y;function a(t,h,o,c){let l,T;const{x:u,y:v}=t,{x:L,y:F}=h;T=(c-v+(u-o)*(v-F)/(u-L))/Math.sqrt(1+Math.pow((v-F)/(u-L),2)),l=Math.sqrt(Math.pow(c-v,2)+Math.pow(o-u,2)-Math.pow(T,2));const A=Math.sqrt(Math.pow(L-u,2)+Math.pow(F-v,2));l=l/A;let P=(L-u)*(c-v)-(F-v)*(o-u);switch(!0){case P>=0:P=1;break;case P<0:P=-1;break}let J=(L-u)*(o-u)+(F-v)*(c-v);switch(!0){case J>=0:J=1;break;case J<0:J=-1;break}return T=Math.abs(T)*P,l=l*J,{distances:T,weights:l}}nt(a,"getSegmentWeights"),i.startBatch();for(const t of Object.values(i.edges()))if((y=t.data)!=null&&y.call(t)){const{x:h,y:o}=t.source().position(),{x:c,y:l}=t.target().position();if(h!==c&&o!==l){const T=t.sourceEndpoint(),u=t.targetEndpoint(),{sourceDir:v}=Ge(t),[L,F]=Qt(v)?[T.x,u.y]:[u.x,T.y],{weights:A,distances:P}=a(T,u,L,F);t.style("segment-distances",P),t.style("segment-weights",A)}}i.endBatch(),f.run()}),f.run(),i.ready(a=>{Se.info("Ready",a),g(i)})})}nt($e,"layoutArchitecture");var zr=nt(async(M,Y,C,G)=>{const N=G.db,g=N.getServices(),s=N.getJunctions(),i=N.getGroups(),r=N.getEdges(),e=N.getDataStructures(),f=nr(Y),a=f.append("g");a.attr("class","architecture-edges");const y=f.append("g");y.attr("class","architecture-services");const t=f.append("g");t.attr("class","architecture-groups"),await Wr(N,y,g),Vr(N,y,s);const h=await $e(g,s,i,r,e);await Xr(a,h),await Hr(t,h),He(N,h),or(void 0,f,Pt("padding"),Pt("useMaxWidth"))},"draw"),Br={draw:zr},jr={parser:Gr,db:le,renderer:Br,styles:Yr};export{jr as diagram};