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