ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
37 lines • 153 kB
JavaScript
const he=require("./rolldown-runtime-DGqZhkpL.cjs"),lt=require("./chunk-Y2CYZVJY-DPaYLFFP.cjs"),de=require("./src-D8aDujwE.cjs"),Vt=require("./chunk-I66GZJ75-BzqGKy7F.cjs"),xe=require("./chunk-NSK5VX7P-DcRXFc-R.cjs"),ze=require("./chunk-3NCLNEKW-CHPh0zzA.cjs"),Be=require("./chunk-JWPE2WC7-D8EnWK1B.cjs"),qe=require("./mermaid-parser.core-DQClw8Il.cjs"),ae=require("./chunk-4I5QYGJK-fRI-M8oC.cjs"),ye=require("./chunk-WRU74C26-zS0j4l0M.cjs"),Ie=require("./cytoscape.esm-4GcZbPWU.cjs");var Me=he.__commonJSMin(((L,S)=>{(function(b,N){typeof L=="object"&&typeof S=="object"?S.exports=N():typeof define=="function"&&define.amd?define([],N):typeof L=="object"?L.layoutBase=N():b.layoutBase=N()})(L,function(){return(function(w){var b={};function N(v){if(b[v])return b[v].exports;var o=b[v]={i:v,l:!1,exports:{}};return w[v].call(o.exports,o,o.exports,N),o.l=!0,o.exports}return N.m=w,N.c=b,N.i=function(v){return v},N.d=function(v,o,n){N.o(v,o)||Object.defineProperty(v,o,{configurable:!1,enumerable:!0,get:n})},N.n=function(v){var o=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(o,"a",o),o},N.o=function(v,o){return Object.prototype.hasOwnProperty.call(v,o)},N.p="",N(N.s=28)})([(function(w,b,N){"use strict";function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,w.exports=v}),(function(w,b,N){"use strict";var v=N(2),o=N(8),n=N(9);function t(h,i,d){v.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=h,this.target=i}t.prototype=Object.create(v.prototype);for(var e in v)t[e]=v[e];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(h){if(this.source===h)return this.target;if(this.target===h)return this.source;throw"Node is not incident with this edge"},t.prototype.getOtherEndInGraph=function(h,i){for(var d=this.getOtherEnd(h),r=i.getGraphManager().getRoot();;){if(d.getOwner()==i)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},t.prototype.updateLength=function(){var h=new Array(4);this.isOverlapingSourceAndTarget=o.getIntersection(this.target.getRect(),this.source.getRect(),h),this.isOverlapingSourceAndTarget||(this.lengthX=h[0]-h[2],this.lengthY=h[1]-h[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)},w.exports=t}),(function(w,b,N){"use strict";function v(o){this.vGraphObject=o}w.exports=v}),(function(w,b,N){"use strict";var v=N(2),o=N(10),n=N(13),t=N(0),e=N(16),h=N(5);function i(r,a,f,l){f==null&&l==null&&(l=a),v.call(this,l),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=o.MIN_VALUE,this.inclusionTreeDepth=o.MAX_VALUE,this.vGraphObject=l,this.edges=[],this.graphManager=r,f!=null&&a!=null?this.rect=new n(a.x,a.y,f.width,f.height):this.rect=new n}i.prototype=Object.create(v.prototype);for(var d in v)i[d]=v[d];i.prototype.getEdges=function(){return this.edges},i.prototype.getChild=function(){return this.child},i.prototype.getOwner=function(){return this.owner},i.prototype.getWidth=function(){return this.rect.width},i.prototype.setWidth=function(r){this.rect.width=r},i.prototype.getHeight=function(){return this.rect.height},i.prototype.setHeight=function(r){this.rect.height=r},i.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},i.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},i.prototype.getCenter=function(){return new h(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},i.prototype.getLocation=function(){return new h(this.rect.x,this.rect.y)},i.prototype.getRect=function(){return this.rect},i.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},i.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},i.prototype.setRect=function(r,a){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=a.width,this.rect.height=a.height},i.prototype.setCenter=function(r,a){this.rect.x=r-this.rect.width/2,this.rect.y=a-this.rect.height/2},i.prototype.setLocation=function(r,a){this.rect.x=r,this.rect.y=a},i.prototype.moveBy=function(r,a){this.rect.x+=r,this.rect.y+=a},i.prototype.getEdgeListToNode=function(r){var a=[],f=this;return f.edges.forEach(function(l){if(l.target==r){if(l.source!=f)throw"Incorrect edge source!";a.push(l)}}),a},i.prototype.getEdgesBetween=function(r){var a=[],f=this;return f.edges.forEach(function(l){if(!(l.source==f||l.target==f))throw"Incorrect edge source and/or target";(l.target==r||l.source==r)&&a.push(l)}),a},i.prototype.getNeighborsList=function(){var r=new Set,a=this;return a.edges.forEach(function(f){if(f.source==a)r.add(f.target);else{if(f.target!=a)throw"Incorrect incidency!";r.add(f.source)}}),r},i.prototype.withChildren=function(){var r=new Set,a,f;if(r.add(this),this.child!=null)for(var l=this.child.getNodes(),p=0;p<l.length;p++)a=l[p],f=a.withChildren(),f.forEach(function(g){r.add(g)});return r},i.prototype.getNoOfChildren=function(){var r=0,a;if(this.child==null)r=1;else for(var f=this.child.getNodes(),l=0;l<f.length;l++)a=f[l],r+=a.getNoOfChildren();return r==0&&(r=1),r},i.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},i.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)},i.prototype.scatter=function(){var r,a,f=-t.INITIAL_WORLD_BOUNDARY,l=t.INITIAL_WORLD_BOUNDARY;r=t.WORLD_CENTER_X+e.nextDouble()*(l-f)+f;var p=-t.INITIAL_WORLD_BOUNDARY,g=t.INITIAL_WORLD_BOUNDARY;a=t.WORLD_CENTER_Y+e.nextDouble()*(g-p)+p,this.rect.x=r,this.rect.y=a},i.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var r=this.getChild();if(r.updateBounds(!0),this.rect.x=r.getLeft(),this.rect.y=r.getTop(),this.setWidth(r.getRight()-r.getLeft()),this.setHeight(r.getBottom()-r.getTop()),t.NODE_DIMENSIONS_INCLUDE_LABELS){var a=r.getRight()-r.getLeft(),f=r.getBottom()-r.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(f+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>f?(this.rect.y-=(this.labelHeight-f)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(f+this.labelHeight))}}},i.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},i.prototype.transform=function(r){var a=this.rect.x;a>t.WORLD_BOUNDARY?a=t.WORLD_BOUNDARY:a<-t.WORLD_BOUNDARY&&(a=-t.WORLD_BOUNDARY);var f=this.rect.y;f>t.WORLD_BOUNDARY?f=t.WORLD_BOUNDARY:f<-t.WORLD_BOUNDARY&&(f=-t.WORLD_BOUNDARY);var l=new h(a,f),p=r.inverseTransformPoint(l);this.setLocation(p.x,p.y)},i.prototype.getLeft=function(){return this.rect.x},i.prototype.getRight=function(){return this.rect.x+this.rect.width},i.prototype.getTop=function(){return this.rect.y},i.prototype.getBottom=function(){return this.rect.y+this.rect.height},i.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},w.exports=i}),(function(w,b,N){"use strict";var v=N(0);function o(){}for(var n in v)o[n]=v[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,w.exports=o}),(function(w,b,N){"use strict";function v(o,n){o==null&&n==null?(this.x=0,this.y=0):(this.x=o,this.y=n)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(o){this.x=o},v.prototype.setY=function(o){this.y=o},v.prototype.getDifference=function(o){return new DimensionD(this.x-o.x,this.y-o.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(o){return this.x+=o.width,this.y+=o.height,this},w.exports=v}),(function(w,b,N){"use strict";var v=N(2),o=N(10),n=N(0),t=N(7),e=N(3),h=N(1),i=N(13),d=N(12),r=N(11);function a(l,p,g){v.call(this,g),this.estimatedSize=o.MIN_VALUE,this.margin=n.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=l,p!=null&&p instanceof t?this.graphManager=p:p!=null&&p instanceof Layout&&(this.graphManager=p.graphManager)}a.prototype=Object.create(v.prototype);for(var f in v)a[f]=v[f];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(l,p,g){if(p==null&&g==null){var c=l;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(c)>-1)throw"Node already in graph!";return c.owner=this,this.getNodes().push(c),c}else{var T=l;if(!(this.getNodes().indexOf(p)>-1&&this.getNodes().indexOf(g)>-1))throw"Source or target not in graph!";if(!(p.owner==g.owner&&p.owner==this))throw"Both owners must be this graph!";return p.owner!=g.owner?null:(T.source=p,T.target=g,T.isInterGraph=!1,this.getEdges().push(T),p.edges.push(T),g!=p&&g.edges.push(T),T)}},a.prototype.remove=function(l){var p=l;if(l instanceof e){if(p==null)throw"Node is null!";if(!(p.owner!=null&&p.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var g=p.edges.slice(),c,T=g.length,C=0;C<T;C++)c=g[C],c.isInterGraph?this.graphManager.remove(c):c.source.owner.remove(c);var I=this.nodes.indexOf(p);if(I==-1)throw"Node not in owner node list!";this.nodes.splice(I,1)}else if(l instanceof h){var c=l;if(c==null)throw"Edge is null!";if(!(c.source!=null&&c.target!=null))throw"Source and/or target is null!";if(!(c.source.owner!=null&&c.target.owner!=null&&c.source.owner==this&&c.target.owner==this))throw"Source and/or target owner is invalid!";var F=c.source.edges.indexOf(c),Y=c.target.edges.indexOf(c);if(!(F>-1&&Y>-1))throw"Source and/or target doesn't know this edge!";c.source.edges.splice(F,1),c.target!=c.source&&c.target.edges.splice(Y,1);var I=c.source.owner.getEdges().indexOf(c);if(I==-1)throw"Not in owner's edge list!";c.source.owner.getEdges().splice(I,1)}},a.prototype.updateLeftTop=function(){for(var l=o.MAX_VALUE,p=o.MAX_VALUE,g,c,T,C=this.getNodes(),I=C.length,F=0;F<I;F++){var Y=C[F];g=Y.getTop(),c=Y.getLeft(),l>g&&(l=g),p>c&&(p=c)}return l==o.MAX_VALUE?null:(C[0].getParent().paddingLeft!=null?T=C[0].getParent().paddingLeft:T=this.margin,this.left=p-T,this.top=l-T,new d(this.left,this.top))},a.prototype.updateBounds=function(l){for(var p=o.MAX_VALUE,g=-o.MAX_VALUE,c=o.MAX_VALUE,T=-o.MAX_VALUE,C,I,F,Y,V,$=this.nodes,x=$.length,tt=0;tt<x;tt++){var s=$[tt];l&&s.child!=null&&s.updateBounds(),C=s.getLeft(),I=s.getRight(),F=s.getTop(),Y=s.getBottom(),p>C&&(p=C),g<I&&(g=I),c>F&&(c=F),T<Y&&(T=Y)}var m=new i(p,c,g-p,T-c);p==o.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),$[0].getParent().paddingLeft!=null?V=$[0].getParent().paddingLeft:V=this.margin,this.left=m.x-V,this.right=m.x+m.width+V,this.top=m.y-V,this.bottom=m.y+m.height+V},a.calculateBounds=function(l){for(var p=o.MAX_VALUE,g=-o.MAX_VALUE,c=o.MAX_VALUE,T=-o.MAX_VALUE,C,I,F,Y,V=l.length,$=0;$<V;$++){var x=l[$];C=x.getLeft(),I=x.getRight(),F=x.getTop(),Y=x.getBottom(),p>C&&(p=C),g<I&&(g=I),c>F&&(c=F),T<Y&&(T=Y)}return new i(p,c,g-p,T-c)},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 l=0,p=this.nodes,g=p.length,c=0;c<g;c++){var T=p[c];l+=T.calcEstimatedSize()}return l==0?this.estimatedSize=n.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=l/Math.sqrt(this.nodes.length),this.estimatedSize},a.prototype.updateConnected=function(){var l=this;if(this.nodes.length==0){this.isConnected=!0;return}var p=new r,g=new Set,c=this.nodes[0],T,C;for(c.withChildren().forEach(function(V){p.push(V),g.add(V)});p.length!==0;){c=p.shift(),T=c.getEdges();for(var I=T.length,F=0;F<I;F++)C=T[F].getOtherEndInGraph(c,this),C!=null&&!g.has(C)&&C.withChildren().forEach(function(V){p.push(V),g.add(V)})}if(this.isConnected=!1,g.size>=this.nodes.length){var Y=0;g.forEach(function(V){V.owner==l&&Y++}),Y==this.nodes.length&&(this.isConnected=!0)}},w.exports=a}),(function(w,b,N){"use strict";var v,o=N(1);function n(t){v=N(6),this.layout=t,this.graphs=[],this.edges=[]}n.prototype.addRoot=function(){var t=this.layout.newGraph(),e=this.layout.newNode(null),h=this.add(t,e);return this.setRootGraph(h),this.rootGraph},n.prototype.add=function(t,e,h,i,d){if(h==null&&i==null&&d==null){if(t==null)throw"Graph is null!";if(e==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(e.child!=null)throw"Already has a child!";return t.parent=e,e.child=t,t}else{d=h,i=e,h=t;var r=i.getOwner(),a=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(a!=null&&a.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==a)return h.isInterGraph=!1,r.add(h,i,d);if(h.isInterGraph=!0,h.source=i,h.target=d,this.edges.indexOf(h)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(h),!(h.source!=null&&h.target!=null))throw"Edge source and/or target is null!";if(!(h.source.edges.indexOf(h)==-1&&h.target.edges.indexOf(h)==-1))throw"Edge already in source and/or target incidency list!";return h.source.edges.push(h),h.target.edges.push(h),h}},n.prototype.remove=function(t){if(t instanceof v){var e=t;if(e.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(e==this.rootGraph||e.parent!=null&&e.parent.graphManager==this))throw"Invalid parent node!";var h=[];h=h.concat(e.getEdges());for(var i,d=h.length,r=0;r<d;r++)i=h[r],e.remove(i);var a=[];a=a.concat(e.getNodes());var f;d=a.length;for(var r=0;r<d;r++)f=a[r],e.remove(f);e==this.rootGraph&&this.setRootGraph(null);var l=this.graphs.indexOf(e);this.graphs.splice(l,1),e.parent=null}else if(t instanceof o){if(i=t,i==null)throw"Edge is null!";if(!i.isInterGraph)throw"Not an inter-graph edge!";if(!(i.source!=null&&i.target!=null))throw"Source and/or target is null!";if(!(i.source.edges.indexOf(i)!=-1&&i.target.edges.indexOf(i)!=-1))throw"Source and/or target doesn't know this edge!";var l=i.source.edges.indexOf(i);if(i.source.edges.splice(l,1),l=i.target.edges.indexOf(i),i.target.edges.splice(l,1),!(i.source.owner!=null&&i.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(i.source.owner.getGraphManager().edges.indexOf(i)==-1)throw"Not in owner graph manager's edge list!";var l=i.source.owner.getGraphManager().edges.indexOf(i);i.source.owner.getGraphManager().edges.splice(l,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=[],e=this.getGraphs(),h=e.length,i=0;i<h;i++)t=t.concat(e[i].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){var t=[],e=this.getGraphs();e.length;for(var h=0;h<e.length;h++)t=t.concat(e[h].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,e){if(!(t!=null&&e!=null))throw"assert failed";if(t==e)return!0;var h=t.getOwner(),i;do{if(i=h.getParent(),i==null)break;if(i==e)return!0;if(h=i.getOwner(),h==null)break}while(!0);h=e.getOwner();do{if(i=h.getParent(),i==null)break;if(i==t)return!0;if(h=i.getOwner(),h==null)break}while(!0);return!1},n.prototype.calcLowestCommonAncestors=function(){for(var t,e,h,i,d,r=this.getAllEdges(),a=r.length,f=0;f<a;f++){if(t=r[f],e=t.source,h=t.target,t.lca=null,t.sourceInLca=e,t.targetInLca=h,e==h){t.lca=e.getOwner();continue}for(i=e.getOwner();t.lca==null;){for(t.targetInLca=h,d=h.getOwner();t.lca==null;){if(d==i){t.lca=d;break}if(d==this.rootGraph)break;if(t.lca!=null)throw"assert failed";t.targetInLca=d.getParent(),d=t.targetInLca.getOwner()}if(i==this.rootGraph)break;t.lca==null&&(t.sourceInLca=i.getParent(),i=t.sourceInLca.getOwner())}if(t.lca==null)throw"assert failed"}},n.prototype.calcLowestCommonAncestor=function(t,e){if(t==e)return t.getOwner();var h=t.getOwner();do{if(h==null)break;var i=e.getOwner();do{if(i==null)break;if(i==h)return i;i=i.getParent().getOwner()}while(!0);h=h.getParent().getOwner()}while(!0);return h},n.prototype.calcInclusionTreeDepths=function(t,e){t==null&&e==null&&(t=this.rootGraph,e=1);for(var h,i=t.getNodes(),d=i.length,r=0;r<d;r++)h=i[r],h.inclusionTreeDepth=e,h.child!=null&&this.calcInclusionTreeDepths(h.child,e+1)},n.prototype.includesInvalidEdge=function(){for(var t,e=[],h=this.edges.length,i=0;i<h;i++)t=this.edges[i],this.isOneAncestorOfOther(t.source,t.target)&&e.push(t);for(var i=0;i<e.length;i++)this.remove(e[i]);return!1},w.exports=n}),(function(w,b,N){"use strict";var v=N(12);function o(){}o.calcSeparationAmount=function(n,t,e,h){if(!n.intersects(t))throw"assert failed";var i=new Array(2);this.decideDirectionsForOverlappingNodes(n,t,i),e[0]=Math.min(n.getRight(),t.getRight())-Math.max(n.x,t.x),e[1]=Math.min(n.getBottom(),t.getBottom())-Math.max(n.y,t.y),n.getX()<=t.getX()&&n.getRight()>=t.getRight()?e[0]+=Math.min(t.getX()-n.getX(),n.getRight()-t.getRight()):t.getX()<=n.getX()&&t.getRight()>=n.getRight()&&(e[0]+=Math.min(n.getX()-t.getX(),t.getRight()-n.getRight())),n.getY()<=t.getY()&&n.getBottom()>=t.getBottom()?e[1]+=Math.min(t.getY()-n.getY(),n.getBottom()-t.getBottom()):t.getY()<=n.getY()&&t.getBottom()>=n.getBottom()&&(e[1]+=Math.min(n.getY()-t.getY(),t.getBottom()-n.getBottom()));var d=Math.abs((t.getCenterY()-n.getCenterY())/(t.getCenterX()-n.getCenterX()));t.getCenterY()===n.getCenterY()&&t.getCenterX()===n.getCenterX()&&(d=1);var r=d*e[0],a=e[1]/d;e[0]<a?a=e[0]:r=e[1],e[0]=-1*i[0]*(a/2+h),e[1]=-1*i[1]*(r/2+h)},o.decideDirectionsForOverlappingNodes=function(n,t,e){n.getCenterX()<t.getCenterX()?e[0]=-1:e[0]=1,n.getCenterY()<t.getCenterY()?e[1]=-1:e[1]=1},o.getIntersection2=function(n,t,e){var h=n.getCenterX(),i=n.getCenterY(),d=t.getCenterX(),r=t.getCenterY();if(n.intersects(t))return e[0]=h,e[1]=i,e[2]=d,e[3]=r,!0;var a=n.getX(),f=n.getY(),l=n.getRight(),p=n.getX(),g=n.getBottom(),c=n.getRight(),T=n.getWidthHalf(),C=n.getHeightHalf(),I=t.getX(),F=t.getY(),Y=t.getRight(),V=t.getX(),$=t.getBottom(),x=t.getRight(),tt=t.getWidthHalf(),s=t.getHeightHalf(),m=!1,u=!1;if(h===d){if(i>r)return e[0]=h,e[1]=f,e[2]=d,e[3]=$,!1;if(i<r)return e[0]=h,e[1]=g,e[2]=d,e[3]=F,!1}else if(i===r){if(h>d)return e[0]=a,e[1]=i,e[2]=Y,e[3]=r,!1;if(h<d)return e[0]=l,e[1]=i,e[2]=I,e[3]=r,!1}else{var E=n.height/n.width,y=t.height/t.width,M=(r-i)/(d-h),A=void 0,P=void 0,D=void 0,R=void 0,W=void 0,B=void 0;if(-E===M?h>d?(e[0]=p,e[1]=g,m=!0):(e[0]=l,e[1]=f,m=!0):E===M&&(h>d?(e[0]=a,e[1]=f,m=!0):(e[0]=c,e[1]=g,m=!0)),-y===M?d>h?(e[2]=V,e[3]=$,u=!0):(e[2]=Y,e[3]=F,u=!0):y===M&&(d>h?(e[2]=I,e[3]=F,u=!0):(e[2]=x,e[3]=$,u=!0)),m&&u)return!1;if(h>d?i>r?(A=this.getCardinalDirection(E,M,4),P=this.getCardinalDirection(y,M,2)):(A=this.getCardinalDirection(-E,M,3),P=this.getCardinalDirection(-y,M,1)):i>r?(A=this.getCardinalDirection(-E,M,1),P=this.getCardinalDirection(-y,M,3)):(A=this.getCardinalDirection(E,M,2),P=this.getCardinalDirection(y,M,4)),!m)switch(A){case 1:R=f,D=h+-C/M,e[0]=D,e[1]=R;break;case 2:D=c,R=i+T*M,e[0]=D,e[1]=R;break;case 3:R=g,D=h+C/M,e[0]=D,e[1]=R;break;case 4:D=p,R=i+-T*M,e[0]=D,e[1]=R}if(!u)switch(P){case 1:B=F,W=d+-s/M,e[2]=W,e[3]=B;break;case 2:W=x,B=r+tt*M,e[2]=W,e[3]=B;break;case 3:B=$,W=d+s/M,e[2]=W,e[3]=B;break;case 4:W=V,B=r+-tt*M,e[2]=W,e[3]=B}}return!1},o.getCardinalDirection=function(n,t,e){return n>t?e:1+e%4},o.getIntersection=function(n,t,e,h){if(h==null)return this.getIntersection2(n,t,e);var i=n.x,d=n.y,r=t.x,a=t.y,f=e.x,l=e.y,p=h.x,g=h.y,c=void 0,T=void 0,C=void 0,I=void 0,F=void 0,Y=void 0,V=void 0,$=void 0,x=void 0;return C=a-d,F=i-r,V=r*d-i*a,I=g-l,Y=f-p,$=p*l-f*g,x=C*Y-I*F,x===0?null:(c=(F*$-Y*V)/x,T=(I*V-C*$)/x,new v(c,T))},o.angleOfVector=function(n,t,e,h){var i=void 0;return n!==e?(i=Math.atan((h-t)/(e-n)),e<n?i+=Math.PI:h<t&&(i+=this.TWO_PI)):h<t?i=this.ONE_AND_HALF_PI:i=this.HALF_PI,i},o.doIntersect=function(n,t,e,h){var i=n.x,d=n.y,r=t.x,a=t.y,f=e.x,l=e.y,p=h.x,g=h.y,c=(r-i)*(g-l)-(p-f)*(a-d);if(c===0)return!1;var T=((g-l)*(p-i)+(f-p)*(g-d))/c,C=((d-a)*(p-i)+(r-i)*(g-d))/c;return 0<T&&T<1&&0<C&&C<1},o.findCircleLineIntersections=function(n,t,e,h,i,d,r){var a=(e-n)*(e-n)+(h-t)*(h-t),f=2*((n-i)*(e-n)+(t-d)*(h-t)),l=(n-i)*(n-i)+(t-d)*(t-d)-r*r;if(f*f-4*a*l>=0){var p=(-f+Math.sqrt(f*f-4*a*l))/(2*a),g=(-f-Math.sqrt(f*f-4*a*l))/(2*a),c=null;return p>=0&&p<=1?[p]:g>=0&&g<=1?[g]:c}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,w.exports=o}),(function(w,b,N){"use strict";function v(){}v.sign=function(o){return o>0?1:o<0?-1:0},v.floor=function(o){return o<0?Math.ceil(o):Math.floor(o)},v.ceil=function(o){return o<0?Math.floor(o):Math.ceil(o)},w.exports=v}),(function(w,b,N){"use strict";function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,w.exports=v}),(function(w,b,N){"use strict";var v=(function(){function h(i,d){for(var r=0;r<d.length;r++){var a=d[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(i,a.key,a)}}return function(i,d,r){return d&&h(i.prototype,d),r&&h(i,r),i}})();function o(h,i){if(!(h instanceof i))throw new TypeError("Cannot call a class as a function")}var n=function(i){return{value:i,next:null,prev:null}},t=function(i,d,r,a){return i!==null?i.next=d:a.head=d,r!==null?r.prev=d:a.tail=d,d.prev=i,d.next=r,a.length++,d},e=function(i,d){var r=i.prev,a=i.next;return r!==null?r.next=a:d.head=a,a!==null?a.prev=r:d.tail=r,i.prev=i.next=null,d.length--,i};w.exports=(function(){function h(i){var d=this;o(this,h),this.length=0,this.head=null,this.tail=null,i?.forEach(function(r){return d.push(r)})}return v(h,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(d,r){return t(r.prev,n(d),r,this)}},{key:"insertAfter",value:function(d,r){return t(r,n(d),r.next,this)}},{key:"insertNodeBefore",value:function(d,r){return t(r.prev,d,r,this)}},{key:"insertNodeAfter",value:function(d,r){return t(r,d,r.next,this)}},{key:"push",value:function(d){return t(this.tail,n(d),null,this)}},{key:"unshift",value:function(d){return t(null,n(d),this.head,this)}},{key:"remove",value:function(d){return e(d,this)}},{key:"pop",value:function(){return e(this.tail,this).value}},{key:"popNode",value:function(){return e(this.tail,this)}},{key:"shift",value:function(){return e(this.head,this).value}},{key:"shiftNode",value:function(){return e(this.head,this)}},{key:"get_object_at",value:function(d){if(d<=this.length()){for(var r=1,a=this.head;r<d;)a=a.next,r++;return a.value}}},{key:"set_object_at",value:function(d,r){if(d<=this.length()){for(var a=1,f=this.head;a<d;)f=f.next,a++;f.value=r}}}]),h})()}),(function(w,b,N){"use strict";function v(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)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.getLocation=function(){return new v(this.x,this.y)},v.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)))},v.prototype.move=function(o,n){this.x=o,this.y=n},v.prototype.translate=function(o,n){this.x+=o,this.y+=n},v.prototype.equals=function(o){if(o.constructor.name=="Point"){var n=o;return this.x==n.x&&this.y==n.y}return this==o},v.prototype.toString=function(){return new v().constructor.name+"[x="+this.x+",y="+this.y+"]"},w.exports=v}),(function(w,b,N){"use strict";function v(o,n,t,e){this.x=0,this.y=0,this.width=0,this.height=0,o!=null&&n!=null&&t!=null&&e!=null&&(this.x=o,this.y=n,this.width=t,this.height=e)}v.prototype.getX=function(){return this.x},v.prototype.setX=function(o){this.x=o},v.prototype.getY=function(){return this.y},v.prototype.setY=function(o){this.y=o},v.prototype.getWidth=function(){return this.width},v.prototype.setWidth=function(o){this.width=o},v.prototype.getHeight=function(){return this.height},v.prototype.setHeight=function(o){this.height=o},v.prototype.getRight=function(){return this.x+this.width},v.prototype.getBottom=function(){return this.y+this.height},v.prototype.intersects=function(o){return!(this.getRight()<o.x||this.getBottom()<o.y||o.getRight()<this.x||o.getBottom()<this.y)},v.prototype.getCenterX=function(){return this.x+this.width/2},v.prototype.getMinX=function(){return this.getX()},v.prototype.getMaxX=function(){return this.getX()+this.width},v.prototype.getCenterY=function(){return this.y+this.height/2},v.prototype.getMinY=function(){return this.getY()},v.prototype.getMaxY=function(){return this.getY()+this.height},v.prototype.getWidthHalf=function(){return this.width/2},v.prototype.getHeightHalf=function(){return this.height/2},w.exports=v}),(function(w,b,N){"use strict";var v=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>"u"?"undefined":v(n);return n==null||t!="object"&&t!="function"},w.exports=o}),(function(w,b,N){"use strict";function v(f){if(Array.isArray(f)){for(var l=0,p=Array(f.length);l<f.length;l++)p[l]=f[l];return p}else return Array.from(f)}var o=N(0),n=N(7),t=N(3),e=N(1),h=N(6),i=N(5),d=N(17),r=N(29);function a(f){r.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,f!=null&&(this.isRemoteUse=f)}a.RANDOM_SEED=1,a.prototype=Object.create(r.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 f=new n(this);return this.graphManager=f,f},a.prototype.newGraph=function(f){return new h(null,this.graphManager,f)},a.prototype.newNode=function(f){return new t(this.graphManager,f)},a.prototype.newEdge=function(f){return new e(null,null,f)},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 f;return this.checkLayoutSuccess()?f=!1:f=this.layout(),o.ANIMATE==="during"?!1:(f&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,f)},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 f=this.graphManager.getAllEdges(),l=0;l<f.length;l++)f[l];for(var p=this.graphManager.getRoot().getNodes(),l=0;l<p.length;l++)p[l];this.update(this.graphManager.getRoot())}},a.prototype.update=function(f){if(f==null)this.update2();else if(f instanceof t){var l=f;if(l.getChild()!=null)for(var p=l.getChild().getNodes(),g=0;g<p.length;g++)update(p[g]);l.vGraphObject!=null&&l.vGraphObject.update(l)}else if(f instanceof e){var c=f;c.vGraphObject!=null&&c.vGraphObject.update(c)}else if(f instanceof h){var T=f;T.vGraphObject!=null&&T.vGraphObject.update(T)}},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(f){if(f==null)this.transform(new i(0,0));else{var l=new d,p=this.graphManager.getRoot().updateLeftTop();if(p!=null){l.setWorldOrgX(f.x),l.setWorldOrgY(f.y),l.setDeviceOrgX(p.x),l.setDeviceOrgY(p.y);for(var g=this.getAllNodes(),c,T=0;T<g.length;T++)c=g[T],c.transform(l)}}},a.prototype.positionNodesRandomly=function(f){if(f==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var l,p,g=f.getNodes(),c=0;c<g.length;c++)l=g[c],p=l.getChild(),p==null||p.getNodes().length==0?l.scatter():(this.positionNodesRandomly(p),l.updateBounds())},a.prototype.getFlatForest=function(){for(var f=[],l=!0,p=this.graphManager.getRoot().getNodes(),g=!0,c=0;c<p.length;c++)p[c].getChild()!=null&&(g=!1);if(!g)return f;var T=new Set,C=[],I=new Map,F=[];for(F=F.concat(p);F.length>0&&l;){for(C.push(F[0]);C.length>0&&l;){var Y=C[0];C.splice(0,1),T.add(Y);for(var V=Y.getEdges(),c=0;c<V.length;c++){var $=V[c].getOtherEnd(Y);if(I.get(Y)!=$)if(!T.has($))C.push($),I.set($,Y);else{l=!1;break}}}if(!l)f=[];else{var x=[].concat(v(T));f.push(x);for(var c=0;c<x.length;c++){var tt=x[c],s=F.indexOf(tt);s>-1&&F.splice(s,1)}T=new Set,I=new Map}}return f},a.prototype.createDummyNodesForBendpoints=function(f){for(var l=[],p=f.source,g=this.graphManager.calcLowestCommonAncestor(f.source,f.target),c=0;c<f.bendpoints.length;c++){var T=this.newNode(null);T.setRect(new Point(0,0),new Dimension(1,1)),g.add(T);var C=this.newEdge(null);this.graphManager.add(C,p,T),l.add(T),p=T}var C=this.newEdge(null);return this.graphManager.add(C,p,f.target),this.edgeToDummyNodes.set(f,l),f.isInterGraph()?this.graphManager.remove(f):g.remove(f),l},a.prototype.createBendpointsFromDummyNodes=function(){var f=[];f=f.concat(this.graphManager.getAllEdges()),f=[].concat(v(this.edgeToDummyNodes.keys())).concat(f);for(var l=0;l<f.length;l++){var p=f[l];if(p.bendpoints.length>0){for(var g=this.edgeToDummyNodes.get(p),c=0;c<g.length;c++){var T=g[c],C=new i(T.getCenterX(),T.getCenterY()),I=p.bendpoints.get(c);I.x=C.x,I.y=C.y,T.getOwner().remove(T)}this.graphManager.add(p,p.source,p.target)}}},a.transform=function(f,l,p,g){if(p!=null&&g!=null){var c=l;if(f<=50){var T=l/p;c-=(l-T)/50*(50-f)}else{var C=l*g;c+=(C-l)/50*(f-50)}return c}else{var I,F;return f<=50?(I=9*l/500,F=l/10):(I=9*l/50,F=-8*l),I*f+F}},a.findCenterOfTree=function(f){var l=[];l=l.concat(f);var p=[],g=new Map,c=!1,T=null;(l.length==1||l.length==2)&&(c=!0,T=l[0]);for(var C=0;C<l.length;C++){var I=l[C],F=I.getNeighborsList().size;g.set(I,I.getNeighborsList().size),F==1&&p.push(I)}var Y=[];for(Y=Y.concat(p);!c;){var V=[];V=V.concat(Y),Y=[];for(var C=0;C<l.length;C++){var I=l[C],$=l.indexOf(I);$>=0&&l.splice($,1),I.getNeighborsList().forEach(function(s){if(p.indexOf(s)<0){var m=g.get(s)-1;m==1&&Y.push(s),g.set(s,m)}})}p=p.concat(Y),(l.length==1||l.length==2)&&(c=!0,T=l[0])}return T},a.prototype.setGraphManager=function(f){this.graphManager=f},w.exports=a}),(function(w,b,N){"use strict";function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},w.exports=v}),(function(w,b,N){"use strict";var v=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,e=this.lworldExtX;return e!=0&&(t=this.ldeviceOrgX+(n-this.lworldOrgX)*this.ldeviceExtX/e),t},o.prototype.transformY=function(n){var t=0,e=this.lworldExtY;return e!=0&&(t=this.ldeviceOrgY+(n-this.lworldOrgY)*this.ldeviceExtY/e),t},o.prototype.inverseTransformX=function(n){var t=0,e=this.ldeviceExtX;return e!=0&&(t=this.lworldOrgX+(n-this.ldeviceOrgX)*this.lworldExtX/e),t},o.prototype.inverseTransformY=function(n){var t=0,e=this.ldeviceExtY;return e!=0&&(t=this.lworldOrgY+(n-this.ldeviceOrgY)*this.lworldExtY/e),t},o.prototype.inverseTransformPoint=function(n){return new v(this.inverseTransformX(n.x),this.inverseTransformY(n.y))},w.exports=o}),(function(w,b,N){"use strict";function v(r){if(Array.isArray(r)){for(var a=0,f=Array(r.length);a<r.length;a++)f[a]=r[a];return f}else return Array.from(r)}var o=N(15),n=N(4),t=N(0),e=N(8),h=N(9);function i(){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}i.prototype=Object.create(o.prototype);for(var d in o)i[d]=o[d];i.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=[]},i.prototype.calcIdealEdgeLengths=function(){for(var r,a,f,l,p,g,c,T=this.getGraphManager().getAllEdges(),C=0;C<T.length;C++)r=T[C],a=r.idealLength,r.isInterGraph&&(l=r.getSource(),p=r.getTarget(),g=r.getSourceInLca().getEstimatedSize(),c=r.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(r.idealLength+=g+c-2*t.SIMPLE_NODE_SIZE),f=r.getLca().getInclusionTreeDepth(),r.idealLength+=a*n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(l.getInclusionTreeDepth()+p.getInclusionTreeDepth()-2*f))},i.prototype.initSpringEmbedder=function(){var r=this.getAllNodes().length;this.incremental?(r>n.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*n.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-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):(r>n.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(n.COOLING_ADAPTATION_FACTOR,1-(r-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()},i.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),a,f=0;f<r.length;f++)a=r[f],this.calcSpringForce(a,a.idealLength)},i.prototype.calcRepulsionForces=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,f,l,p,g,c=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),T=new Set,f=0;f<c.length;f++)p=c[f],this.calculateRepulsionForceOfANode(p,T,r,a),T.add(p);else for(f=0;f<c.length;f++)for(p=c[f],l=f+1;l<c.length;l++)g=c[l],p.getOwner()==g.getOwner()&&this.calcRepulsionForce(p,g)},i.prototype.calcGravitationalForces=function(){for(var r,a=this.getAllNodesToApplyGravitation(),f=0;f<a.length;f++)r=a[f],this.calcGravitationalForce(r)},i.prototype.moveNodes=function(){for(var r=this.getAllNodes(),a,f=0;f<r.length;f++)a=r[f],a.move()},i.prototype.calcSpringForce=function(r,a){var f=r.getSource(),l=r.getTarget(),p,g,c,T;if(this.uniformLeafNodeSizes&&f.getChild()==null&&l.getChild()==null)r.updateLengthSimple();else if(r.updateLength(),r.isOverlapingSourceAndTarget)return;p=r.getLength(),p!=0&&(g=r.edgeElasticity*(p-a),c=g*(r.lengthX/p),T=g*(r.lengthY/p),f.springForceX+=c,f.springForceY+=T,l.springForceX-=c,l.springForceY-=T)},i.prototype.calcRepulsionForce=function(r,a){var f=r.getRect(),l=a.getRect(),p=new Array(2),g=new Array(4),c,T,C,I,F,Y,V;if(f.intersects(l)){e.calcSeparationAmount(f,l,p,n.DEFAULT_EDGE_LENGTH/2),Y=2*p[0],V=2*p[1];var $=r.noOfChildren*a.noOfChildren/(r.noOfChildren+a.noOfChildren);r.repulsionForceX-=$*Y,r.repulsionForceY-=$*V,a.repulsionForceX+=$*Y,a.repulsionForceY+=$*V}else this.uniformLeafNodeSizes&&r.getChild()==null&&a.getChild()==null?(c=l.getCenterX()-f.getCenterX(),T=l.getCenterY()-f.getCenterY()):(e.getIntersection(f,l,g),c=g[2]-g[0],T=g[3]-g[1]),Math.abs(c)<n.MIN_REPULSION_DIST&&(c=h.sign(c)*n.MIN_REPULSION_DIST),Math.abs(T)<n.MIN_REPULSION_DIST&&(T=h.sign(T)*n.MIN_REPULSION_DIST),C=c*c+T*T,I=Math.sqrt(C),F=(r.nodeRepulsion/2+a.nodeRepulsion/2)*r.noOfChildren*a.noOfChildren/C,Y=F*c/I,V=F*T/I,r.repulsionForceX-=Y,r.repulsionForceY-=V,a.repulsionForceX+=Y,a.repulsionForceY+=V},i.prototype.calcGravitationalForce=function(r){var a,f,l,p,g,c,T,C;a=r.getOwner(),f=(a.getRight()+a.getLeft())/2,l=(a.getTop()+a.getBottom())/2,p=r.getCenterX()-f,g=r.getCenterY()-l,c=Math.abs(p)+r.getWidth()/2,T=Math.abs(g)+r.getHeight()/2,r.getOwner()==this.graphManager.getRoot()?(C=a.getEstimatedSize()*this.gravityRangeFactor,(c>C||T>C)&&(r.gravitationForceX=-this.gravityConstant*p,r.gravitationForceY=-this.gravityConstant*g)):(C=a.getEstimatedSize()*this.compoundGravityRangeFactor,(c>C||T>C)&&(r.gravitationForceX=-this.gravityConstant*p*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*g*this.compoundGravityConstant))},i.prototype.isConverged=function(){var r,a=!1;return this.totalIterations>this.maxIterations/3&&(a=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,r||a},i.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},i.prototype.calcNoOfChildrenForAllNodes=function(){for(var r,a=this.graphManager.getAllNodes(),f=0;f<a.length;f++)r=a[f],r.noOfChildren=r.getNoOfChildren()},i.prototype.calcGrid=function(r){var a=0,f=0;a=parseInt(Math.ceil((r.getRight()-r.getLeft())/this.repulsionRange)),f=parseInt(Math.ceil((r.getBottom()-r.getTop())/this.repulsionRange));for(var l=new Array(a),p=0;p<a;p++)l[p]=new Array(f);for(var p=0;p<a;p++)for(var g=0;g<f;g++)l[p][g]=new Array;return l},i.prototype.addNodeToGrid=function(r,a,f){var l=0,p=0,g=0,c=0;l=parseInt(Math.floor((r.getRect().x-a)/this.repulsionRange)),p=parseInt(Math.floor((r.getRect().width+r.getRect().x-a)/this.repulsionRange)),g=parseInt(Math.floor((r.getRect().y-f)/this.repulsionRange)),c=parseInt(Math.floor((r.getRect().height+r.getRect().y-f)/this.repulsionRange));for(var T=l;T<=p;T++)for(var C=g;C<=c;C++)this.grid[T][C].push(r),r.setGridCoordinates(l,p,g,c)},i.prototype.updateGrid=function(){var r,a,f=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),r=0;r<f.length;r++)a=f[r],this.addNodeToGrid(a,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},i.prototype.calculateRepulsionForceOfANode=function(r,a,f,l){if(this.totalIterations%n.GRID_CALCULATION_CHECK_PERIOD==1&&f||l){var p=new Set;r.surrounding=new Array;for(var g,c=this.grid,T=r.startX-1;T<r.finishX+2;T++)for(var C=r.startY-1;C<r.finishY+2;C++)if(!(T<0||C<0||T>=c.length||C>=c[0].length)){for(var I=0;I<c[T][C].length;I++)if(g=c[T][C][I],!(r.getOwner()!=g.getOwner()||r==g)&&!a.has(g)&&!p.has(g)){var F=Math.abs(r.getCenterX()-g.getCenterX())-(r.getWidth()/2+g.getWidth()/2),Y=Math.abs(r.getCenterY()-g.getCenterY())-(r.getHeight()/2+g.getHeight()/2);F<=this.repulsionRange&&Y<=this.repulsionRange&&p.add(g)}}r.surrounding=[].concat(v(p))}for(T=0;T<r.surrounding.length;T++)this.calcRepulsionForce(r,r.surrounding[T])},i.prototype.calcRepulsionRange=function(){return 0},w.exports=i}),(function(w,b,N){"use strict";var v=N(1),o=N(4);function n(e,h,i){v.call(this,e,h,i),this.idealLength=o.DEFAULT_EDGE_LENGTH,this.edgeElasticity=o.DEFAULT_SPRING_STRENGTH}n.prototype=Object.create(v.prototype);for(var t in v)n[t]=v[t];w.exports=n}),(function(w,b,N){"use strict";var v=N(3),o=N(4);function n(e,h,i,d){v.call(this,e,h,i,d),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(v.prototype);for(var t in v)n[t]=v[t];n.prototype.setGridCoordinates=function(e,h,i,d){this.startX=e,this.finishX=h,this.startY=i,this.finishY=d},w.exports=n}),(function(w,b,N){"use strict";function v(o,n){this.width=0,this.height=0,o!==null&&n!==null&&(this.height=n,this.width=o)}v.prototype.getWidth=function(){return this.width},v.prototype.setWidth=function(o){this.width=o},v.prototype.getHeight=function(){return this.height},v.prototype.setHeight=function(o){this.height=o},w.exports=v}),(function(w,b,N){"use strict";var v=N(14);function o(){this.map={},this.keys=[]}o.prototype.put=function(n,t){var e=v.createID(n);this.contains(e)||(this.map[e]=t,this.keys.push(n))},o.prototype.contains=function(n){return v.createID(n),this.map[n]!=null},o.prototype.get=function(n){var t=v.createID(n);return this.map[t]},o.prototype.keySet=function(){return this.keys},w.exports=o}),(function(w,b,N){"use strict";var v=N(14);function o(){this.set={}}o.prototype.add=function(n){var t=v.createID(n);this.contains(t)||(this.set[t]=n)},o.prototype.remove=function(n){delete this.set[v.createID(n)]},o.prototype.clear=function(){this.set={}},o.prototype.contains=function(n){return this.set[v.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),e=t.length,h=0;h<e;h++)n.push(this.set[t[h]])},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAll=function(n){for(var t=n.length,e=0;e<t;e++){var h=n[e];this.add(h)}},w.exports=o}),(function(w,b,N){"use strict";function v(){}v.multMat=function(o,n){for(var t=[],e=0;e<o.length;e++){t[e]=[];for(var h=0;h<n[0].length;h++){t[e][h]=0;for(var i=0;i<o[0].length;i++)t[e][h]+=o[e][i]*n[i][h]}}return t},v.transpose=function(o){for(var n=[],t=0;t<o[0].length;t++){n[t]=[];for(var e=0;e<o.length;e++)n[t][e]=o[e][t]}return n},v.multCons=function(o,n){for(var t=[],e=0;e<o.length;e++)t[e]=o[e]*n;return t},v.minusOp=function(o,n){for(var t=[],e=0;e<o.length;e++)t[e]=o[e]-n[e];return t},v.dotProduct=function(o,n){for(var t=0,e=0;e<o.length;e++)t+=o[e]*n[e];return t},v.mag=function(o){return Math.sqrt(this.dotProduct(o,o))},v.normalize=function(o){for(var n=[],t=this.mag(o),e=0;e<o.length;e++)n[e]=o[e]/t;return n},v.multGamma=function(o){for(var n=[],t=0,e=0;e<o.length;e++)t+=o[e];t*=-1/o.length;for(var h=0;h<o.length;h++)n[h]=t+o[h];return n},v.multL=function(o,n,t){for(var e=[],h=[],i=[],d=0;d<n[0].length;d++){for(var r=0,a=0;a<n.length;a++)r+=-.5*n[a][d]*o[a];h[d]=r}for(var f=0;f<t.length;f++){for(var l=0,p=0;p<t.length;p++)l+=t[f][p]*h[p];i[f]=l}for(var g=0;g<n.length;g++){for(var c=0,T=0;T<n[0].length;T++)c+=n[g][T]*i[T];e[g]=c}return e},w.exports=v}),(function(w,b,N){"use strict";var v=(function(){function t(e,h){for(var i=0;i<h.length;i++){var d=h[i];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(e,d.key,d)}}return function(e,h,i){return h&&t(e.prototype,h),i&&t(e,i),e}})();function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=N(11);w.exports=(function(){function t(e,h){o(this,t),(h!==null||h!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var i=void 0;e instanceof n?i=e.size():i=e.length,this._quicksort(e,0,i-1)}return v(t,[{key:"_quicksort",value:function(h,i,d){if(i<d){var r=this._partition(h,i,d);this._quicksort(h,i,r),this._quicksort(h,r+1,d)}}},{key:"_partition",value:function(h,i,d){for(var r=this._get(h,i),a=i,f=d;;){for(;this.compareFunction(r,this._get(h,f));)f--;for(;this.compareFunction(this._get(h,a),r);)a++;if(a<f)this._swap(h,a,f),a++,f--;else return f}}},{key:"_get",value:function(h,i){return h instanceof n?h.get_object_at(i):h[i]}},{key:"_set",value:function(h,i,d){h instanceof n?h.set_object_at(i,d):h[i]=d}},{key:"_swap",value:function(h,i,d){var r=this._get(h,i);this._set(h,i,this._get(h,d)),this._set(h,d,r)}},{key:"_defaultCompareFunction",value:function(h,i){return i>h}}]),t})()}),(function(w,b,N){"use strict";function v(){}v.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(Dt){for(var Tt=[];Dt-- >0;)Tt.push(0);return Tt})(Math.min(this.m+1,this.n)),this.U=(function(Dt){return(function Tt(Xt){if(Xt.length==0)return 0;for(var St=[],Ut=0;Ut<Xt[0];Ut++)St.push(Tt(Xt.slice(1)));return St})(Dt)})([this.m,n]),this.V=(function(Dt){return(function Tt(Xt){if(Xt.length==0)return 0;for(var St=[],Ut=0;Ut<Xt[0];Ut++)St.push(Tt(Xt.slice(1)));return St})(Dt)})([this.n,this.n]);for(var t=(function(Dt){for(var Tt=[];Dt-- >0;)Tt.push(0);return Tt})(this.n),e=(function(Dt){for(var Tt=[];Dt-- >0;)Tt.push(0);return Tt})(this.m),h=!0,i=!0,d=Math.min(this.m-1,this.n),r=Math.max(0,Math.min(this.n-2,this.m)),a=0;a<Math.max(d,r);a++){if(a<d){this.s[a]=0;for(var f=a;f<this.m;f++)this.s[a]=v.hypot(this.s[a],o[f][a]);if(this.s[a]!==0){o[a][a]<0&&(this.s[a]=-this.s[a]);for(var l=a;l<this.m;l++)o[l][a]/=this.s[a];o[a][a]+=1}this.s[a]=-this.s[a]}for(var p=a+1;p<this.n;p++){if((function(Dt,Tt){return Dt&&Tt})(a<d,this.s[a]!==0)){for(var g=0,c=a;c<this.m;c++)g+=o[c][a]*o[c][p];g=-g/o[a][a];for(var T=a;T<this.m;T++)o[T][p]+=g*o[T][a]}t[p]=o[a][p]}if((function(Dt,Tt){return Dt&&Tt})(h,a<d))for(var C=a;C<this.m;C++)this.U[C][a]=o[C][a];if(a<r){t[a]=0;for(var I=a+1;I<this.n;I++)t[a]=v.hypot(t[a],t[I]);if(t[a]!==0){t[a+1]<0&&(t[a]=-t[a]);for(var F=a+1;F<this.n;F++)t[F]/=t[a];t[a+1]+=1}if(t[a]=-t[a],(function(Dt,Tt){return Dt&&Tt})(a+1<this.m,t[a]!==0)){for(var Y=a+1;Y<this.m;Y++)e[Y]=0;for(var V=a+1;V<this.n;V++)for(var $=a+1;$<this.m;$++)e[$]+=t[V]*o[$][V];for(var x=a+1;x<this.n;x++)for(var tt=-t[x]/t[a+1],s=a+1;s<this.m;s++)o[s][x]+=tt*e[s]}if(i)for(var m=a+1;m<this.n;m++)this.V[m][a]=t[m]}}var u=Math.min(this.n,this.m+1);if(d<this.n&&(this.s[d]=o[d][d]),this.m<u&&(this.s[u-1]=0),r+1<u&&(t[r]=o[r][u-1]),t[u-1]=0,h){for(var E=d;E<n;E++){for(var y=0;y<this.m;y++)this.U[y][E]=0;this.U[E][E]=1}for(var M=d-1;M>=0;M--)if(this.s[M]!==0){for(var A=M+1;A<n;A++){for(var P=0,D=M;D<this.m;D++)P+=this.U[D][M]*this.U[D][A];P=-P/this.U[M][M];for(var R=M;R<this.m;R++)this.U[R][A]+=P*this.U[R][M]}for(var W=M;W<this.m;W++)this.U[W][M]=-this.U[W][M];this.U[M][M]=1+this.U[M][M];for(var B=0;B<M-1;B++)this.U[B][M]=0}else{for(var rt=0;rt<this.m;rt++)this.U[rt][M]=0;this.U[M][M]=1}}if(i)for(var K=this.n-1;K>=0;K--){if((function(Dt,Tt){return Dt&&Tt})(K<r,t[K]!==0))for(var U=K+1;U<n;U++){for(var G=0,X=K+1;X<this.n;X++)G+=this.V[X][K]*this.V[X][U];G=-G/this.V[K+1][K];for(var Q=K+1;Q<this.n;Q++)this.V[Q][U]+=G*this.V[Q][K]}for(var at=0;at<this.n;at++)this.V[at][K]=0;this.V[K][K]=1}for(var J=u-1,q=0,Et=Math.pow(2,-52),ft=Math.pow(2,-966);u>0;){var Z=void 0,mt=void 0;for(Z=u-2;Z>=-1&&Z!==-1;Z--)if(Math.abs(t[Z])<=ft+Et*(Math.abs(this.s[Z])+Math.abs(this.s[Z+1]))){t[Z]=0;break}if(Z===u-2)mt=4;else{var ot=void 0;for(ot=u-1;ot>=Z&&ot!==Z;ot--){var wt=(ot!==u?Math.abs(t[ot]):0)+(ot!==Z+1?Math.abs(t[ot-1]):0);if(Math.abs(this.s[ot])<=ft+Et*wt){this.s[ot]=0;break}}ot===Z?mt=3:ot===u-1?mt=1:(mt=2,Z=ot)}switch(Z++,mt){case 1:var Wt=t[u-2];t[u-2]=0;for(var Ot=u-2;Ot>=Z;Ot--){var xt=v.hypot(this.s[Ot],Wt),Gt=this.s[Ot]/xt,$t=Wt/xt;if(this.s[Ot]=xt,Ot!==Z&&(Wt=-$t*t[Ot-1],t[Ot-1]=Gt*t[Ot-1]),i)for(var Ft=0;Ft<this.n;Ft++)xt=Gt*this.V[Ft][Ot]+$t*this.V[Ft][u-1],this.V[Ft][u-1]=-$t*this.V[Ft][Ot]+Gt*this.V[Ft][u-1],this.V[Ft][Ot]=xt}break;case 2:var Bt=t[Z-1];t[Z-1]=0;for(var Yt=Z;Yt<u;Yt++){var qt=v.hypot(this.s[Yt],Bt),Mt=this.s[Yt]/qt,gt=Bt/qt;if(this.s[Yt]=qt,Bt=-gt*t[Yt],t[Yt]=Mt*t[Yt],h)for(var O=0;O<this.m;O++)qt=Mt*this.U[O][Yt]+gt*this.U[O][Z-1],this.U[O][Z-1]=-gt*this.U[O][Yt]+Mt*this.U[O][Z-1],this.U[O][Yt]=qt}break;case 3:var H=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[u-1]),Math.abs(this.s[u-2])),Math.abs(t[u-2])),Math.abs(this.s[Z])),Math.abs(t[Z])),z=this.s[u-1]/H,j=this.s[u-2]/H,k=t[u-2]/H,_=this.s[Z]/H,pt=t[Z]/H,ct=((j+z)*(j-z)+k*k)/2,it=z*k*(z*k),dt=0;(function(Dt,Tt){return Dt||Tt})(ct!==0,it!==0)&&(dt=Math.sqrt(ct*ct+it),ct<0&&(dt=-dt),dt=it/(ct+dt));for(var Lt=(_+z)*(_-z)+dt,At=_*pt,et=Z;et<u-1;et++){var Nt=v.hypot(Lt,At),st=Lt/Nt,nt=At/Nt;if(et!==Z&&(t[et-1]=Nt),Lt=st*this.s[et]+nt*t[et],t[et]=st*t[et]-nt*this.s[et],At=nt*this.s[et+1],this.s[et+1]=st*this.s[et+1],i)for(var ht=0;ht<this.n;ht++)Nt=st*this.V[ht][et]+nt*this.V[ht][et+1],this.V[ht][et+1]=-nt*this.V[ht][et]+st*this.V[ht][et+1],this.V[ht][et]=Nt;if(Nt=v.hypot(Lt,At),st=Lt/Nt,nt=At/Nt,this.s[et]=Nt,Lt=st*t[et]+nt*this.s[et+1],this.s[et+1]=-nt*t[et]+st*this.s[et+1],At=nt*t[et+1],t[et+1]=st*t[et+1],h&&et<this.m-1)for(var yt=0;yt<this.m;yt++)Nt=st*this.U[yt][et]+nt*this.U[yt][et+1],this.U[yt][et+1]=-nt*this.U[yt][et]+st*this.U[yt][et+1],this.U[yt][et]=Nt}t[u-2]=Lt,q=q+1;break;case 4:if(this.s[Z]<=0&&(this.s[Z]=this.s[Z]<0?-this.s[Z]:0,i))for(var ut=0;ut<=J;ut++)this.V[ut][Z]=-this.V[ut][Z];for(;Z<J&&!(this.s[Z]>=this.s[Z+1]);){var Rt=this.s[Z];if(this.s[Z]=this.s[Z+1],this.s[Z+1]=Rt,i&&Z<this.n-1)for(var It=0;It<this.n;It++)Rt=this.V[It][Z+1],this.V[It][Z+1]=this.V[It][Z],this.V[It][Z]=Rt;if(h&&Z<this.m-1)for(var bt=0;bt<this.m;bt++)Rt=this.U[bt][Z+1],this.U[bt][Z+1]=this.U[bt][Z],this.U[bt][Z]=Rt;Z++}q=0,u--}}return{U:this.U,V:this.V,S:this.s}},v.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},w.exports=v}),(function(w,b,N){"use strict";var v=(function(){function n(t,e){for(var h=0;h<e.length;h++){var i=e[h];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,h){return e&&n(t.prototype,e),h&&n(t,h),t}})();function o(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}w.exports=(function(){function n(t,e){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;o(this,n),this.sequence1=t,this.sequence2=e,this.match_score=h,this.mismatch_penalty=i,this.gap_penalty=d,this.iMax=t.length+1,this.jMax=e.length+1,this.grid=new Array(this.iMax);for(var r=0;r<this.iMax;r++){this.grid[r]=new Array(this.jMax);for(var a=0;a<this.jMax;a++)this.grid[r][a]=0}this.tracebackGrid=new Array(this.iMax);for(var f=0;f<this.iMax;f++){this.tracebackGrid[f]=new Array(this.jMax);for(var l=0;l<this.jMax;l++)this.tracebackGrid[f][l]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return v(n,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var e=1;e<this.jMax;e++)this.grid[0][e]=this.grid[0][e-1]+this.gap_penalty,this.tracebackGrid[0][e]=[!1,!1,!0];for(var h=1;h<this.iMax;h++)this.grid[h][0]=this.grid[h-1][0]+this.gap_penalty,this.tracebackGrid[h][0]=[!1,!0,!1];for(var i=1;i<this.iMax;i++)for(var d=1;d<this.jMax;d++){var r=void 0;this.sequence1[i-1]===this.sequence2[d-1]?r=this.grid[i-1][d-1]+this.match_score:r=this.grid[i-1][d-1]+this.mismatch_penalty;var a=this.grid[i-1][d]+this.gap_penalty,f=this.grid[i][d-1]+this.gap_penalty,l=[r,a,f],p=this.arrayAllMaxIndexes(l);this.grid[i][d]=l[p[0]],this.tracebackGrid[i][d]=[p.includes(0),p.includes(1),p.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var e=[];for(e.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});e[0];){var h=e[0],i=this.tracebackGrid[h.pos[0]][h.pos[1]];i[0]&&e.push({pos:[h.pos[0]-1,h.pos[1]-1],seq1:this.sequence1[h.pos[0]-1]+h.seq1,seq2:this.sequence2[h.pos[1]-1]+h.seq2}),i[1]&&e.push({pos:[h.pos[0]-1,h.pos[1]],seq1:this.sequence1[h.pos[0]-1]+h.seq1,seq2:"-"+h.seq2}),i[2]&&e.push({pos:[h.pos[0],h.pos[1]-1],seq1:"-"+h.seq1,seq2:this.sequence2[h.pos[1]-1]+h.seq2}),h.pos[0]===0&&h.pos[1]===0&&this.alignments.push({sequence1:h.seq1,sequence2:h.seq2}),e.shift()}return this.alignments}},{key:"getAllIndexes",value:function(e,h){for(var i=[],d=-1;(d=e.indexOf(h,d+1))!==-1;)i.push(d);return i}},{key:"arrayAllMaxIndexes",value:function(e){return this.getAllIndexes(e,Math.max.apply(null,e))}}]),n})()}),(function(w,b,N){"use strict";var v=function(){};v.FDLayout=N(18),v.FDLayoutConstants=N(4),v.FDLayoutEdge=N(19),v.FDLayoutNode=N(20),v.DimensionD=N(21),v.HashMap=N(22),v.HashSet=N(23),v.IGeometry=N(8),v.IMath=N(9),v.Integer=N(10),v.Point=N(12),v.PointD=N(5),v.RandomSeed=N(16),v.RectangleD=N(13),v.Transform=N(17),v.UniqueIDGeneretor=N(14),v.Quicksort=N(25),v.LinkedList=N(11),v.LGraphObject=N(2),v.LGraph=N(6),v.LEdge=N(1),v.LGraphManager=N(7),v.LNode=N(3),v.Layout=N(15),v.LayoutConstants=N(0),v.NeedlemanWunsch=N(27),v.Matrix=N(24),v.SVD=N(26),w.exports=v}),(function(w,b,N){"use strict";function v(){this.listeners=[]}var o=v.prototype;o.addListener=function(n,t){this.listeners.push({event:n,callback:t})},o.removeListener=function(n,t){for(var e=this.listeners.length;e>=0;e--){var h=this.listeners[e];h.event===n&&h.callback===t&&this.listeners.splice(e,1)}},o.emit=function(n,t){for(var e=0;e<this.listeners.length;e++){var h=this.listeners[e];n===h.event&&h.callback(t)}},w.exports=v})])})})),Ce=he.__commonJSMin(((L,S)=>{(function(b,N){typeof L=="object"&&typeof S=="object"?S.exports=N(Me()):typeof define=="function"&&define.amd?define(["layout-base"],N):typeof L=="object"?L.coseBase=N(Me()):b.coseBase=N(b.layoutBase)})(L,function(w){return(()=>{"use strict";var b={45:((o,n,t)=>{var e={};e.layoutBase=t(551),e.CoSEConstants=t(806),e.CoSEEdge=t(767),e.CoSEGraph=t(880),e.CoSEGraphManager=t(578),e.CoSELayout=t(765),e.CoSENode=t(991),e.ConstraintHandler=t(902),o.exports=e}),806:((o,n,t)=>{var e=t(551).FDLayoutConstants;function h(){}for(var i in e)h[i]=e[i];h.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,h.DEFAULT_RADIAL_SEPARATION=e.DEFAULT_EDGE_LENGTH,h.DEFAULT_COMPONENT_SEPERATION=60,h.TILE=!0,h.TILING_PADDING_VERTICAL=10,h.TILING_PADDING_HORIZONTAL=10,h.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,h.ENFORCE_CONSTRAINTS=!0,h.APPLY_LAYOUT=!0,h.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,h.TREE_REDUCTION_ON_INCREMENTAL=!0,h.PURE_INCREMENTAL=h.DEFAULT_INCREMENTAL,o.exports=h}),767:((o,n,t)=>{var e=t(551).FDLayoutEdge;function h(d,r,a){e.call(this,d,r,a)}h.prototype=Object.create(e.prototype);for(var i in e)h[i]=e[i];o.exports=h}),880:((o,n,t)=>{var e=t(551).LGraph;function h(d,r,a){e.call(this,d,r,a)}h.prototype=Object.create(e.prototype);for(var i in e)h[i]=e[i];o.exports=h}),578:((o,n,t)=>{var e=t(551).LGraphManager;function h(d){e.call(this,d)}h.prototype=Object.create(e.prototype);for(var i in e)h[i]=e[i];o.exports=h}),765:((o,n,t)=>{var e=t(551).FDLayout,h=t(578),i=t(880),d=t(991),r=t(767),a=t(806),f=t(902),l=t(551).FDLayoutConstants,p=t(551).LayoutConstants,g=t(551).Point,c=t(551).PointD,T=t(551).DimensionD,C=t(551).Layout,I=t(551).Integer,F=t(551).IGeometry,Y=t(551).LGraph,V=t(551).Transform,$=t(551).LinkedList;function x(){e.call(this),this.toBeTiled={},this.constraints={}}x.prototype=Object.create(e.prototype);for(var tt in e)x[tt]=e[tt];x.prototype.newGraphManager=function(){var s=new h(this);return this.graphManager=s,s},x.prototype.newGraph=function(s){return new i(null,this.graphManager,s)},x.prototype.newNode=function(s){return new d(this.graphManager,s)},x.prototype.newEdge=function(s){return new r(null,null,s)},x.prototype.initParameters=function(){e.prototype.initParameters.call(this,arguments),this.isSubLayout||(a.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=a.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=a.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)},x.prototype.initSpringEmbedder=function(){e.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},x.prototype.layout=function(){return p.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},x.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(a.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),u=this.nodesWithGravity.filter(function(M){return m.has(M)});this.graphManager.setAllNodesToApplyGravitation(u)}}else{var s=this.getFlatForest();if(s.length>0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),u=this.nodesWithGravity.filter(function(E){return m.has(E)});this.graphManager.setAllNodesToApplyGravitation(u),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(f.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),a.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},x.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 s=new Set(this.getAllNodes()),m=this.nodesWithGravity.filter(function(y){return s.has(y)});this.graphManager.setAllNodesToApplyGravitation(m),this.graphManager.updateBounds(),this.updateGrid(),a.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()),a.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 u=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(u,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},x.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),m={},u=0;u<s.length;u++){var E=s[u].rect,y=s[u].id;m[y]={id:y,x:E.getCenterX(),y:E.getCenterY(),w:E.width,h:E.height}}return m},x.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var s=!1;if(l.ANIMATE==="during")this.emit("layoutstarted");else{for(;!s;)s=this.tick();this.graphManager.updateBounds()}},x.prototype.moveNodes=function(){for(var s=this.getAllNodes(),m,u=0;u<s.length;u++)m=s[u],m.calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var u=0;u<s.length;u++)m=s[u],m.move()},x.prototype.initConstraintVariables=function(){var s=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var m=this.graphManager.getAllNodes(),u=0;u<m.length;u++){var E=m[u];this.idToNodeMap.set(E.id,E)}var y=function G(X){for(var Q=X.getChild().getNodes(),at,J=0,q=0;q<Q.length;q++)at=Q[q],at.getChild()==null?s.fixedNodeSet.has(at.id)&&(J+=100):J+=G(at);return J};if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(Q){s.fixedNodeSet.add(Q.nodeId)});for(var m=this.graphManager.getAllNodes(),E,u=0;u<m.length;u++)if(E=m[u],E.getChild()!=null){var M=y(E);M>0&&(E.fixedNodeWeight=M)}}if(this.constraints.relativePlacementConstraint){var A=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(G){s.fixedNodesOnHorizontal.add(G),s.fixedNodesOnVertical.add(G)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var D=this.constraints.alignmentConstraint.vertical,u=0;u<D.length;u++)this.dummyToNodeForVerticalAlignment.set("dummy"+u,[]),D[u].forEach(function(X){A.set(X,"dummy"+u),s.dummyToNodeForVerticalAlignment.get("dummy"+u).push(X),s.fixedNodeSet.has(X)&&s.fixedNodesOnHorizontal.add("dummy"+u)});if(this.constraints.alignmentConstraint.horizontal)for(var R=this.constraints.alignmentConstraint.horizontal,u=0;u<R.length;u++)this.dummyToNodeForHorizontalAlignment.set("dummy"+u,[]),R[u].forEach(function(X){P.set(X,"dummy"+u),s.dummyToNodeForHorizontalAlignment.get("dummy"+u).push(X),s.fixedNodeSet.has(X)&&s.fixedNodesOnVertical.add("dummy"+u)})}if(a.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(G){var X,Q,at;for(at=G.length-1;at>=2*G.length/3;at--)X=Math.floor(Math.random()*(at+1)),Q=G[at],G[at]=G[X],G[X]=Q;return G},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(G){if(G.left){var X=A.has(G.left)?A.get(G.left):G.left,Q=A.has(G.right)?A.get(G.right):G.right;s.nodesInRelativeHorizontal.includes(X)||(s.nodesInRelativeHorizontal.push(X),s.nodeToRelativeConstraintMapHorizontal.set(X,[]),s.dummyToNodeForVerticalAlignment.has(X)?s.nodeToTempPositionMapHorizontal.set(X,s.idToNodeMap.get(s.dummyToNodeForVerticalAlignment.get(X)[0]).getCenterX()):s.nodeToTempPositionMapHorizontal.set(X,s.idToNodeMap.get(X).getCenterX())),s.nodesInRelativeHorizontal.includes(Q)||(s.nodesInRelativeHorizontal.push(Q),s.nodeToRelativeConstraintMapHorizontal.set(Q,[]),s.dummyToNodeForVerticalAlignment.has(Q)?s.nodeToTempPositionMapHorizontal.set(Q,s.idToNodeMap.get(s.dummyToNodeForVerticalAlignment.get(Q)[0]).getCenterX()):s.nodeToTempPositionMapHorizontal.set(Q,s.idToNodeMap.get(Q).getCenterX())),s.nodeToRelativeConstraintMapHorizontal.get(X).push({right:Q,gap:G.gap}),s.nodeToRelativeConstraintMapHorizontal.get(Q).push({left:X,gap:G.gap})}else{var at=P.has(G.top)?P.get(G.top):G.top,J=P.has(G.bottom)?P.get(G.bottom):G.bottom;s.nodesInRelativeVertical.includes(at)||(s.nodesInRelativeVertical.push(at),s.nodeToRelativeConstraintMapVertical.set(at,[]),s.dummyToNodeForHorizontalAlignment.has(at)?s.nodeToTempPositionMapVertical.set(at,s.idToNodeMap.get(s.dummyToNodeForHorizontalAlignment.get(at)[0]).getCenterY()):s.nodeToTempPositionMapVertical.set(at,s.idToNodeMap.get(at).getCenterY())),s.nodesInRelativeVertical.includes(J)||(s.nodesInRelativeVertical.push(J),s.nodeToRelativeConstraintMapVertical.set(J,[]),s.dummyToNodeForHorizontalAlignment.has(J)?s.nodeToTempPositionMapVertical.set(J,s.idToNodeMap.get(s.dummyToNodeForHorizontalAlignment.get(J)[0]).getCenterY()):s.nodeToTempPositionMapVertical.set(J,s.idToNodeMap.get(J).getCenterY())),s.nodeToRelativeConstraintMapVertical.get(at).push({bottom:J,gap:G.gap}),s.nodeToRelativeConstraintMapVertical.get(J).push({top:at,gap:G.gap})}});else{var W=new Map,B=new Map;this.constraints.relativePlacementConstraint.forEach(function(G){if(G.left){var X=A.has(G.left)?A.get(G.left):G.left,Q=A.has(G.right)?A.get(G.right):G.right;W.has(X)?W.get(X).push(Q):W.set(X,[Q]),W.has(Q)?W.get(Q).push(X):W.set(Q,[X])}else{var at=P.has(G.top)?P.get(G.top):G.top,J=P.has(G.bottom)?P.get(G.bottom):G.bottom;B.has(at)?B.get(at).push(J):B.set(at,[J]),B.has(J)?B.get(J).push(at):B.set(J,[at])}});var rt=function(X,Q){var at=[],J=[],q=new $,Et=new Set,ft=0;return X.forEach(function(Z,mt){if(!Et.has(mt)){at[ft]=[],J[ft]=!1;var ot=mt;for(q.push(ot),Et.add(ot),at[ft].push(ot);q.length!=0;)ot=q.shift(),Q.has(ot)&&(J[ft]=!0),X.get(ot).forEach(function(wt){Et.has(wt)||(q.push(wt),Et.add(wt),at[ft].push(wt))});ft++}}),{components:at,isFixed:J}},K=rt(W,s.fixedNodesOnHorizontal);this.componentsOnHorizontal=K.components,this.fixedComponentsOnHorizontal=K.isFixed;var U=rt(B,s.fixedNodesOnVertical);this.componentsOnVertical=U.components,this.fixedComponentsOnVertical=U.isFixed}}},x.prototype.updateDisplacements=function(){var s=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(U){var G=s.idToNodeMap.get(U.nodeId);G.displacementX=0,G.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var m=this.constraints.alignmentConstraint.vertical,u=0;u<m.length;u++){for(var E=0,y=0;y<m[u].length;y++){if(this.fixedNodeSet.has(m[u][y])){E=0;break}E+=this.idToNodeMap.get(m[u][y]).displacementX}for(var M=E/m[u].length,y=0;y<m[u].length;y++)this.idToNodeMap.get(m[u][y]).displacementX=M}if(this.constraints.alignmentConstraint.horizontal)for(var A=this.constraints.alignmentConstraint.horizontal,u=0;u<A.length;u++){for(var P=0,y=0;y<A[u].length;y++){if(this.fixedNodeSet.has(A[u][y])){P=0;break}P+=this.idToNodeMap.get(A[u][y]).displacementY}for(var D=P/A[u].length,y=0;y<A[u].length;y++)this.idToNodeMap.get(A[u][y]).displacementY=D}}if(this.constraints.relativePlacementConstraint)if(a.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(U){if(!s.fixedNodesOnHorizontal.has(U)){var G=0;s.dummyToNodeForVerticalAlignment.has(U)?G=s.idToNodeMap.get(s.dummyToNodeForVerticalAlignment.get(U)[0]).displacementX:G=s.idToNodeMap.get(U).displacementX,s.nodeToRelativeConstraintMapHorizontal.get(U).forEach(function(X){if(X.right){var Q=s.nodeToTempPositionMapHorizontal.get(X.right)-s.nodeToTempPositionMapHorizontal.get(U)-G;Q<X.gap&&(G-=X.gap-Q)}else{var Q=s.nodeToTempPositionMapHorizontal.get(U)-s.nodeToTempPositionMapHorizontal.get(X.left)+G;Q<X.gap&&(G+=X.gap-Q)}}),s.nodeToTempPositionMapHorizontal.set(U,s.nodeToTempPositionMapHorizontal.get(U)+G),s.dummyToNodeForVerticalAlignment.has(U)?s.dummyToNodeForVerticalAlignment.get(U).forEach(function(X){s.idToNodeMap.get(X).displacementX=G}):s.idToNodeMap.get(U).displacementX=G}}),this.nodesInRelativeVertical.forEach(function(U){if(!s.fixedNodesOnHorizontal.has(U)){var G=0;s.dummyToNodeForHorizontalAlignment.has(U)?G=s.idToNodeMap.get(s.dummyToNodeForHorizontalAlignment.get(U)[0]).displacementY:G=s.idToNodeMap.get(U).displacementY,s.nodeToRelativeConstraintMapVertical.get(U).forEach(function(X){if(X.bottom){var Q=s.nodeToTempPositionMapVertical.get(X.bottom)-s.nodeToTempPositionMapVertical.get(U)-G;Q<X.gap&&(G-=X.gap-Q)}else{var Q=s.nodeToTempPositionMapVertical.get(U)-s.nodeToTempPositionMapVertical.get(X.top)+G;Q<X.gap&&(G+=X.gap-Q)}}),s.nodeToTempPositionMapVertical.set(U,s.nodeToTempPositionMapVertical.get(U)+G),s.dummyToNodeForHorizontalAlignment.has(U)?s.dummyToNodeForHorizontalAlignment.get(U).forEach(function(X){s.idToNodeMap.get(X).displacementY=G}):s.idToNodeMap.get(U).displacementY=G}});else{for(var u=0;u<this.componentsOnHorizontal.length;u++){var R=this.componentsOnHorizontal[u];if(this.fixedComponentsOnHorizontal[u])for(var y=0;y<R.length;y++)this.dummyToNodeForVerticalAlignment.has(R[y])?this.dummyToNodeForVerticalAlignment.get(R[y]).forEach(function(X){s.idToNodeMap.get(X).displacementX=0}):this.idToNodeMap.get(R[y]).displacementX=0;else{for(var W=0,B=0,y=0;y<R.length;y++)if(this.dummyToNodeForVerticalAlignment.has(R[y])){var rt=this.dummyToNodeForVerticalAlignment.get(R[y]);W+=rt.length*this.idToNodeMap.get(rt[0]).displacementX,B+=rt.length}else W+=this.idToNodeMap.get(R[y]).displacementX,B++;for(var K=W/B,y=0;y<R.length;y++)this.dummyToNodeForVerticalAlignment.has(R[y])?this.dummyToNodeForVerticalAlignment.get(R[y]).forEach(function(X){s.idToNodeMap.get(X).displacementX=K}):this.idToNodeMap.get(R[y]).displacementX=K}}for(var u=0;u<this.componentsOnVertical.length;u++){var R=this.componentsOnVertical[u];if(this.fixedComponentsOnVertical[u])for(var y=0;y<R.length;y++)this.dummyToNodeForHorizontalAlignment.has(R[y])?this.dummyToNodeForHorizontalAlignment.get(R[y]).forEach(function(Q){s.idToNodeMap.get(Q).displacementY=0}):this.idToNodeMap.get(R[y]).displacementY=0;else{for(var W=0,B=0,y=0;y<R.length;y++)if(this.dummyToNodeForHorizontalAlignment.has(R[y])){var rt=this.dummyToNodeForHorizontalAlignment.get(R[y]);W+=rt.length*this.idToNodeMap.get(rt[0]).displacementY,B+=rt.length}else W+=this.idToNodeMap.get(R[y]).displacementY,B++;for(var K=W/B,y=0;y<R.length;y++)this.dummyToNodeForHorizontalAlignment.has(R[y])?this.dummyToNodeForHorizontalAlignment.get(R[y]).forEach(function(q){s.idToNodeMap.get(q).displacementY=K}):this.idToNodeMap.get(R[y]).displacementY=K}}}},x.prototype.calculateNodesToApplyGravitationTo=function(){var s=[],m,u=this.graphManager.getGraphs(),E=u.length,y;for(y=0;y<E;y++)m=u[y],m.updateConnected(),m.isConnected||(s=s.concat(m.getNodes()));return s},x.prototype.createBendpoints=function(){var s=[];s=s.concat(this.graphManager.getAllEdges());var m=new Set,u;for(u=0;u<s.length;u++){var E=s[u];if(!m.has(E)){var y=E.getSource(),M=E.getTarget();if(y==M)E.getBendpoints().push(new c),E.getBendpoints().push(new c),this.createDummyNodesForBendpoints(E),m.add(E);else{var A=[];if(A=A.concat(y.getEdgeListToNode(M)),A=A.concat(M.getEdgeListToNode(y)),!m.has(A[0])){if(A.length>1){var P;for(P=0;P<A.length;P++){var D=A[P];D.getBendpoints().push(new c),this.createDummyNodesForBendpoints(D)}}A.forEach(function(R){m.add(R)})}}}if(m.size==s.length)break}},x.prototype.positionNodesRadially=function(s){for(var m=new g(0,0),u=Math.ceil(Math.sqrt(s.length)),E=0,y=0,M=0,A=new c(0,0),P=0;P<s.length;P++){P%u==0&&(M=0,y=E,P!=0&&(y+=a.DEFAULT_COMPONENT_SEPERATION),E=0);var D=s[P],R=C.findCenterOfTree(D);m.x=M,m.y=y,A=x.radialLayout(D,R,m),A.y>E&&(E=Math.floor(A.y)),M=Math.floor(A.x+a.DEFAULT_COMPONENT_SEPERATION)}this.transform(new c(p.WORLD_CENTER_X-A.x/2,p.WORLD_CENTER_Y-A.y/2))},x.radialLayout=function(s,m,u){var E=Math.max(this.maxDiagonalInTree(s),a.DEFAULT_RADIAL_SEPARATION);x.branchRadialLayout(m,null,0,359,0,E);var y=Y.calculateBounds(s),M=new V;M.setDeviceOrgX(y.getMinX()),M.setDeviceOrgY(y.getMinY()),M.setWorldOrgX(u.x),M.setWorldOrgY(u.y);for(var A=0;A<s.length;A++)s[A].transform(M);var P=new c(y.getMaxX(),y.getMaxY());return M.inverseTransformPoint(P)},x.branchRadialLayout=function(s,m,u,E,y,M){var A=(E-u+1)/2;A<0&&(A+=180);var P=(A+u)%360*F.TWO_PI/360,D=y*Math.cos(P),R=y*Math.sin(P);s.setCenter(D,R);var W=[];W=W.concat(s.getEdges());var B=W.length;m!=null&&B--;for(var rt=0,K=W.length,U,G=s.getEdgesBetween(m);G.length>1;){var X=G[0];G.splice(0,1);var Q=W.indexOf(X);Q>=0&&W.splice(Q,1),K--,B--}m!=null?U=(W.indexOf(G[0])+1)%K:U=0;for(var at=Math.abs(E-u)/B,J=U;rt!=B;J=++J%K){var q=W[J].getOtherEnd(s);if(q!=m){var Et=(u+rt*at)%360,ft=(Et+at)%360;x.branchRadialLayout(q,s,Et,ft,y+M,M),rt++}}},x.maxDiagonalInTree=function(s){for(var m=I.MIN_VALUE,u=0;u<s.length;u++){var E=s[u].getDiagonal();E>m&&(m=E)}return m},x.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},x.prototype.groupZeroDegreeMembers=function(){var s=this,m={};this.memberGroups={},this.idToDummyNode={};for(var u=[],E=this.graphManager.getAllNodes(),y=0;y<E.length;y++){var M=E[y],A=M.getParent();this.getNodeDegreeWithChildren(M)===0&&(A.id==null||!this.getToBeTiled(A))&&u.push(M)}for(var y=0;y<u.length;y++){var M=u[y],P=M.getParent().id;typeof m[P]>"u"&&(m[P]=[]),m[P]=m[P].concat(M)}Object.keys(m).forEach(function(D){if(m[D].length>1){var R="DummyCompound_"+D;s.memberGroups[R]=m[D];var W=m[D][0].getParent(),B=new d(s.graphManager);B.id=R,B.paddingLeft=W.paddingLeft||0,B.paddingRight=W.paddingRight||0,B.paddingBottom=W.paddingBottom||0,B.paddingTop=W.paddingTop||0,s.idToDummyNode[R]=B;var rt=s.getGraphManager().add(s.newGraph(),B),K=W.getChild();K.add(B);for(var U=0;U<m[D].length;U++){var G=m[D][U];K.remove(G),rt.add(G)}}})},x.prototype.clearCompounds=function(){var s={},m={};this.performDFSOnCompounds();for(var u=0;u<this.compoundOrder.length;u++)m[this.compoundOrder[u].id]=this.compoundOrder[u],s[this.compoundOrder[u].id]=[].concat(this.compoundOrder[u].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[u].getChild()),this.compoundOrder[u].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(s,m)},x.prototype.clearZeroDegreeMembers=function(){var s=this,m=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(u){var E=s.idToDummyNode[u];if(m[u]=s.tileNodes(s.memberGroups[u],E.paddingLeft+E.paddingRight),E.rect.width=m[u].width,E.rect.height=m[u].height,E.setCenter(m[u].centerX,m[u].centerY),E.labelMarginLeft=0,E.labelMarginTop=0,a.NODE_DIMENSIONS_INCLUDE_LABELS){var y=E.rect.width,M=E.rect.height;E.labelWidth&&(E.labelPosHorizontal=="left"?(E.rect.x-=E.labelWidth,E.setWidth(y+E.labelWidth),E.labelMarginLeft=E.labelWidth):E.labelPosHorizontal=="center"&&E.labelWidth>y?(E.rect.x-=(E.labelWidth-y)/2,E.setWidth(E.labelWidth),E.labelMarginLeft=(E.labelWidth-y)/2):E.labelPosHorizontal=="right"&&E.setWidth(y+E.labelWidth)),E.labelHeight&&(E.labelPosVertical=="top"?(E.rect.y-=E.labelHeight,E.setHeight(M+E.labelHeight),E.labelMarginTop=E.labelHeight):E.labelPosVertical=="center"&&E.labelHeight>M?(E.rect.y-=(E.labelHeight-M)/2,E.setHeight(E.labelHeight),E.labelMarginTop=(E.labelHeight-M)/2):E.labelPosVertical=="bottom"&&E.setHeight(M+E.labelHeight))}})},x.prototype.repopulateCompounds=function(){for(var s=this.compoundOrder.length-1;s>=0;s--){var m=this.compoundOrder[s],u=m.id,E=m.paddingLeft,y=m.paddingTop,M=m.labelMarginLeft,A=m.labelMarginTop;this.adjustLocations(this.tiledMemberPack[u],m.rect.x,m.rect.y,E,y,M,A)}},x.prototype.repopulateZeroDegreeMembers=function(){var s=this,m=this.tiledZeroDegreePack;Object.keys(m).forEach(function(u){var E=s.idToDummyNode[u],y=E.paddingLeft,M=E.paddingTop,A=E.labelMarginLeft,P=E.labelMarginTop;s.adjustLocations(m[u],E.rect.x,E.rect.y,y,M,A,P)})},x.prototype.getToBeTiled=function(s){var m=s.id;if(this.toBeTiled[m]!=null)return this.toBeTiled[m];var u=s.getChild();if(u==null)return this.toBeTiled[m]=!1,!1;for(var E=u.getNodes(),y=0;y<E.length;y++){var M=E[y];if(this.getNodeDegree(M)>0)return this.toBeTiled[m]=!1,!1;if(M.getChild()==null){this.toBeTiled[M.id]=!1;continue}if(!this.getToBeTiled(M))return this.toBeTiled[m]=!1,!1}return this.toBeTiled[m]=!0,!0},x.prototype.getNodeDegree=function(s){s.id;for(var m=s.getEdges(),u=0,E=0;E<m.length;E++){var y=m[E];y.getSource().id!==y.getTarget().id&&(u=u+1)}return u},x.prototype.getNodeDegreeWithChildren=function(s){var m=this.getNodeDegree(s);if(s.getChild()==null)return m;for(var u=s.getChild().getNodes(),E=0;E<u.length;E++){var y=u[E];m+=this.getNodeDegreeWithChildren(y)}return m},x.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},x.prototype.fillCompexOrderByDFS=function(s){for(var m=0;m<s.length;m++){var u=s[m];u.getChild()!=null&&this.fillCompexOrderByDFS(u.getChild().getNodes()),this.getToBeTiled(u)&&this.compoundOrder.push(u)}},x.prototype.adjustLocations=function(s,m,u,E,y,M,A){m+=E+M,u+=y+A;for(var P=m,D=0;D<s.rows.length;D++){var R=s.rows[D];m=P;for(var W=0,B=0;B<R.length;B++){var rt=R[B];rt.rect.x=m,rt.rect.y=u,m+=rt.rect.width+s.horizontalPadding,rt.rect.height>W&&(W=rt.rect.height)}u+=W+s.verticalPadding}},x.prototype.tileCompoundMembers=function(s,m){var u=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(E){var y=m[E];if(u.tiledMemberPack[E]=u.tileNodes(s[E],y.paddingLeft+y.paddingRight),y.rect.width=u.tiledMemberPack[E].width,y.rect.height=u.tiledMemberPack[E].height,y.setCenter(u.tiledMemberPack[E].centerX,u.tiledMemberPack[E].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,a.NODE_DIMENSIONS_INCLUDE_LABELS){var M=y.rect.width,A=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(M+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>M?(y.rect.x-=(y.labelWidth-M)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-M)/2):y.labelPosHorizontal=="right"&&y.setWidth(M+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(A+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>A?(y.rect.y-=(y.labelHeight-A)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-A)/2):y.labelPosVertical=="bottom"&&y.setHeight(A+y.labelHeight))}})},x.prototype.tileNodes=function(s,m){var u=this.tileNodesByFavoringDim(s,m,!0),E=this.tileNodesByFavoringDim(s,m,!1),y=this.getOrgRatio(u),M=this.getOrgRatio(E),A;return M<y?A=E:A=u,A},x.prototype.getOrgRatio=function(s){var m=s.width/s.height;return m<1&&(m=1/m),m},x.prototype.calcIdealRowWidth=function(s,m){var u=a.TILING_PADDING_VERTICAL,E=a.TILING_PADDING_HORIZONTAL,y=s.length,M=0,A=0,P=0;s.forEach(function(U){M+=U.getWidth(),A+=U.getHeight(),U.getWidth()>P&&(P=U.getWidth())});var D=M/y,R=A/y,W=Math.pow(u-E,2)+4*(D+E)*(R+u)*y,B=(E-u+Math.sqrt(W))/(2*(D+E)),rt;m?(rt=Math.ceil(B),rt==B&&rt++):rt=Math.floor(B);var K=rt*(D+E)-E;return P>K&&(K=P),K+=E*2,K},x.prototype.tileNodesByFavoringDim=function(s,m,u){var E=a.TILING_PADDING_VERTICAL,y=a.TILING_PADDING_HORIZONTAL,M=a.TILING_COMPARE_BY,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:m,verticalPadding:E,horizontalPadding:y,centerX:0,centerY:0};M&&(A.idealRowWidth=this.calcIdealRowWidth(s,u));var P=function(G){return G.rect.width*G.rect.height},D=function(G,X){return P(X)-P(G)};s.sort(function(U,G){var X=D;return A.idealRowWidth?(X=M,X(U.id,G.id)):X(U,G)});for(var R=0,W=0,B=0;B<s.length;B++){var rt=s[B];R+=rt.getCenterX(),W+=rt.getCenterY()}A.centerX=R/s.length,A.centerY=W/s.length;for(var B=0;B<s.length;B++){var rt=s[B];if(A.rows.length==0)this.insertNodeToRow(A,rt,0,m);else if(this.canAddHorizontal(A,rt.rect.width,rt.rect.height)){var K=A.rows.length-1;A.idealRowWidth||(K=this.getShortestRowIndex(A)),this.insertNodeToRow(A,rt,K,m)}else this.insertNodeToRow(A,rt,A.rows.length,m);this.shiftToLastRow(A)}return A},x.prototype.insertNodeToRow=function(s,m,u,E){var y=E;u==s.rows.length&&(s.rows.push([]),s.rowWidth.push(y),s.rowHeight.push(0));var M=s.rowWidth[u]+m.rect.width;s.rows[u].length>0&&(M+=s.horizontalPadding),s.rowWidth[u]=M,s.width<M&&(s.width=M);var A=m.rect.height;u>0&&(A+=s.verticalPadding);var P=0;A>s.rowHeight[u]&&(P=s.rowHeight[u],s.rowHeight[u]=A,P=s.rowHeight[u]-P),s.height+=P,s.rows[u].push(m)},x.prototype.getShortestRowIndex=function(s){for(var m=-1,u=Number.MAX_VALUE,E=0;E<s.rows.length;E++)s.rowWidth[E]<u&&(m=E,u=s.rowWidth[E]);return m},x.prototype.getLongestRowIndex=function(s){for(var m=-1,u=Number.MIN_VALUE,E=0;E<s.rows.length;E++)s.rowWidth[E]>u&&(m=E,u=s.rowWidth[E]);return m},x.prototype.canAddHorizontal=function(s,m,u){if(s.idealRowWidth){var E=s.rows.length-1;return s.rowWidth[E]+m+s.horizontalPadding<=s.idealRowWidth}var y=this.getShortestRowIndex(s);if(y<0)return!0;var M=s.rowWidth[y];if(M+s.horizontalPadding+m<=s.width)return!0;var A=0;s.rowHeight[y]<u&&y>0&&(A=u+s.verticalPadding-s.rowHeight[y]);var P;s.width-M>=m+s.horizontalPadding?P=(s.height+A)/(M+m+s.horizontalPadding):P=(s.height+A)/s.width,A=u+s.verticalPadding;var D;return s.width<m?D=(s.height+A)/m:D=(s.height+A)/s.width,D<1&&(D=1/D),P<1&&(P=1/P),P<D},x.prototype.shiftToLastRow=function(s){var m=this.getLongestRowIndex(s),u=s.rowWidth.length-1,E=s.rows[m],y=E[E.length-1],M=y.width+s.horizontalPadding;if(s.width-s.rowWidth[u]>M&&m!=u){E.splice(-1,1),s.rows[u].push(y),s.rowWidth[m]=s.rowWidth[m]-M,s.rowWidth[u]=s.rowWidth[u]+M,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var A=Number.MIN_VALUE,P=0;P<E.length;P++)E[P].height>A&&(A=E[P].height);m>0&&(A+=s.verticalPadding);var D=s.rowHeight[m]+s.rowHeight[u];s.rowHeight[m]=A,s.rowHeight[u]<y.height+s.verticalPadding&&(s.rowHeight[u]=y.height+s.verticalPadding);var R=s.rowHeight[m]+s.rowHeight[u];s.height+=R-D,this.shiftToLastRow(s)}},x.prototype.tilingPreLayout=function(){a.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},x.prototype.tilingPostLayout=function(){a.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},x.prototype.reduceTrees=function(){for(var s=[],m=!0,u;m;){var E=this.graphManager.getAllNodes(),y=[];m=!1;for(var M=0;M<E.length;M++)if(u=E[M],u.getEdges().length==1&&!u.getEdges()[0].isInterGraph&&u.getChild()==null){if(a.PURE_INCREMENTAL){var A=u.getEdges()[0].getOtherEnd(u),P=new T(u.getCenterX()-A.getCenterX(),u.getCenterY()-A.getCenterY());y.push([u,u.getEdges()[0],u.getOwner(),P])}else y.push([u,u.getEdges()[0],u.getOwner()]);m=!0}if(m==!0){for(var D=[],R=0;R<y.length;R++)y[R][0].getEdges().length==1&&(D.push(y[R]),y[R][0].getOwner().remove(y[R][0]));s.push(D),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=s},x.prototype.growTree=function(s){for(var m=s[s.length-1],u,E=0;E<m.length;E++)u=m[E],this.findPlaceforPrunedNode(u),u[2].add(u[0]),u[2].add(u[1],u[1].source,u[1].target);s.splice(s.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},x.prototype.findPlaceforPrunedNode=function(s){var m,u,E=s[0];if(E==s[1].source?u=s[1].target:u=s[1].source,a.PURE_INCREMENTAL)E.setCenter(u.getCenterX()+s[3].getWidth(),u.getCenterY()+s[3].getHeight());else{var y=u.startX,M=u.finishX,A=u.startY,P=u.finishY,D=[0,0,0,0];if(A>0)for(var R=y;R<=M;R++)D[0]+=this.grid[R][A-1].length+this.grid[R][A].length-1;if(M<this.grid.length-1)for(var R=A;R<=P;R++)D[1]+=this.grid[M+1][R].length+this.grid[M][R].length-1;if(P<this.grid[0].length-1)for(var R=y;R<=M;R++)D[2]+=this.grid[R][P+1].length+this.grid[R][P].length-1;if(y>0)for(var R=A;R<=P;R++)D[3]+=this.grid[y-1][R].length+this.grid[y][R].length-1;for(var W=I.MAX_VALUE,B,rt,K=0;K<D.length;K++)D[K]<W?(W=D[K],B=1,rt=K):D[K]==W&&B++;if(B==3&&W==0)D[0]==0&&D[1]==0&&D[2]==0?m=1:D[0]==0&&D[1]==0&&D[3]==0?m=0:D[0]==0&&D[2]==0&&D[3]==0?m=3:D[1]==0&&D[2]==0&&D[3]==0&&(m=2);else if(B==2&&W==0){var U=Math.floor(Math.random()*2);D[0]==0&&D[1]==0?U==0?m=0:m=1:D[0]==0&&D[2]==0?U==0?m=0:m=2:D[0]==0&&D[3]==0?U==0?m=0:m=3:D[1]==0&&D[2]==0?U==0?m=1:m=2:D[1]==0&&D[3]==0?U==0?m=1:m=3:U==0?m=2:m=3}else if(B==4&&W==0){var U=Math.floor(Math.random()*4);m=U}else m=rt;m==0?E.setCenter(u.getCenterX(),u.getCenterY()-u.getHeight()/2-l.DEFAULT_EDGE_LENGTH-E.getHeight()/2):m==1?E.setCenter(u.getCenterX()+u.getWidth()/2+l.DEFAULT_EDGE_LENGTH+E.getWidth()/2,u.getCenterY()):m==2?E.setCenter(u.getCenterX(),u.getCenterY()+u.getHeight()/2+l.DEFAULT_EDGE_LENGTH+E.getHeight()/2):E.setCenter(u.getCenterX()-u.getWidth()/2-l.DEFAULT_EDGE_LENGTH-E.getWidth()/2,u.getCenterY())}},o.exports=x}),991:((o,n,t)=>{var e=t(551).FDLayoutNode,h=t(551).IMath;function i(r,a,f,l){e.call(this,r,a,f,l)}i.prototype=Object.create(e.prototype);for(var d in e)i[d]=e[d];i.prototype.calculateDisplacement=function(){var r=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=r.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=r.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=r.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=r.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>r.coolingFactor*r.maxNodeDisplacement&&(this.displacementX=r.coolingFactor*r.maxNodeDisplacement*h.sign(this.displacementX)),Math.abs(this.displacementY)>r.coolingFactor*r.maxNodeDisplacement&&(this.displacementY=r.coolingFactor*r.maxNodeDisplacement*h.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},i.prototype.propogateDisplacementToChildren=function(r,a){for(var f=this.getChild().getNodes(),l,p=0;p<f.length;p++)l=f[p],l.getChild()==null?(l.displacementX+=r,l.displacementY+=a):l.propogateDisplacementToChildren(r,a)},i.prototype.move=function(){var r=this.graphManager.getLayout();(this.child==null||this.child.getNodes().length==0)&&(this.moveBy(this.displacementX,this.displacementY),r.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},i.prototype.setPred1=function(r){this.pred1=r},i.prototype.getPred1=function(){return pred1},i.prototype.getPred2=function(){return pred2},i.prototype.setNext=function(r){this.next=r},i.prototype.getNext=function(){return next},i.prototype.setProcessed=function(r){this.processed=r},i.prototype.isProcessed=function(){return processed},o.exports=i}),902:((o,n,t)=>{function e(f){if(Array.isArray(f)){for(var l=0,p=Array(f.length);l<f.length;l++)p[l]=f[l];return p}else return Array.from(f)}var h=t(806),i=t(551).LinkedList,d=t(551).Matrix,r=t(551).SVD;function a(){}a.handleConstraints=function(f){var l={};l.fixedNodeConstraint=f.constraints.fixedNodeConstraint,l.alignmentConstraint=f.constraints.alignmentConstraint,l.relativePlacementConstraint=f.constraints.relativePlacementConstraint;for(var p=new Map,g=new Map,c=[],T=[],C=f.getAllNodes(),I=0,F=0;F<C.length;F++){var Y=C[F];Y.getChild()==null&&(g.set(Y.id,I++),c.push(Y.getCenterX()),T.push(Y.getCenterY()),p.set(Y.id,Y))}l.relativePlacementConstraint&&l.relativePlacementConstraint.forEach(function(O){!O.gap&&O.gap!=0&&(O.left?O.gap=h.DEFAULT_EDGE_LENGTH+p.get(O.left).getWidth()/2+p.get(O.right).getWidth()/2:O.gap=h.DEFAULT_EDGE_LENGTH+p.get(O.top).getHeight()/2+p.get(O.bottom).getHeight()/2)});var V=function(H,z){return{x:H.x-z.x,y:H.y-z.y}},$=function(H){var z=0,j=0;return H.forEach(function(k){z+=c[g.get(k)],j+=T[g.get(k)]}),{x:z/H.size,y:j/H.size}},x=function(H,z,j,k,_){function pt(st,nt){var ht=new Set(st),yt=!0,ut=!1,Rt=void 0;try{for(var It=nt[Symbol.iterator](),bt;!(yt=(bt=It.next()).done);yt=!0){var Dt=bt.value;ht.add(Dt)}}catch(Tt){ut=!0,Rt=Tt}finally{try{!yt&&It.return&&It.return()}finally{if(ut)throw Rt}}return ht}var ct=new Map;H.forEach(function(st,nt){ct.set(nt,0)}),H.forEach(function(st,nt){st.forEach(function(ht){ct.set(ht.id,ct.get(ht.id)+1)})});var it=new Map,dt=new Map,Lt=new i;ct.forEach(function(st,nt){st==0?(Lt.push(nt),j||(z=="horizontal"?it.set(nt,g.has(nt)?c[g.get(nt)]:k.get(nt)):it.set(nt,g.has(nt)?T[g.get(nt)]:k.get(nt)))):it.set(nt,Number.NEGATIVE_INFINITY),j&&dt.set(nt,new Set([nt]))}),j&&_.forEach(function(st){var nt=[];if(st.forEach(function(ut){j.has(ut)&&nt.push(ut)}),nt.length>0){var ht=0;nt.forEach(function(ut){z=="horizontal"?(it.set(ut,g.has(ut)?c[g.get(ut)]:k.get(ut)),ht+=it.get(ut)):(it.set(ut,g.has(ut)?T[g.get(ut)]:k.get(ut)),ht+=it.get(ut))}),ht=ht/nt.length,st.forEach(function(ut){j.has(ut)||it.set(ut,ht)})}else{var yt=0;st.forEach(function(ut){z=="horizontal"?yt+=g.has(ut)?c[g.get(ut)]:k.get(ut):yt+=g.has(ut)?T[g.get(ut)]:k.get(ut)}),yt=yt/st.length,st.forEach(function(ut){it.set(ut,yt)})}});for(var At=function(){var nt=Lt.shift();H.get(nt).forEach(function(ht){if(it.get(ht.id)<it.get(nt)+ht.gap)if(j&&j.has(ht.id)){var yt=void 0;if(z=="horizontal"?yt=g.has(ht.id)?c[g.get(ht.id)]:k.get(ht.id):yt=g.has(ht.id)?T[g.get(ht.id)]:k.get(ht.id),it.set(ht.id,yt),yt<it.get(nt)+ht.gap){var ut=it.get(nt)+ht.gap-yt;dt.get(nt).forEach(function(Rt){it.set(Rt,it.get(Rt)-ut)})}}else it.set(ht.id,it.get(nt)+ht.gap);ct.set(ht.id,ct.get(ht.id)-1),ct.get(ht.id)==0&&Lt.push(ht.id),j&&dt.set(ht.id,pt(dt.get(nt),dt.get(ht.id)))})};Lt.length!=0;)At();if(j){var et=new Set;H.forEach(function(st,nt){st.length==0&&et.add(nt)});var Nt=[];dt.forEach(function(st,nt){if(et.has(nt)){var ht=!1,yt=!0,ut=!1,Rt=void 0;try{for(var It=st[Symbol.iterator](),bt;!(yt=(bt=It.next()).done);yt=!0){var Dt=bt.value;j.has(Dt)&&(ht=!0)}}catch(St){ut=!0,Rt=St}finally{try{!yt&&It.return&&It.return()}finally{if(ut)throw Rt}}if(!ht){var Tt=!1,Xt=void 0;Nt.forEach(function(St,Ut){St.has([].concat(e(st))[0])&&(Tt=!0,Xt=Ut)}),Tt?st.forEach(function(St){Nt[Xt].add(St)}):Nt.push(new Set(st))}}}),Nt.forEach(function(st,nt){var ht=Number.POSITIVE_INFINITY,yt=Number.POSITIVE_INFINITY,ut=Number.NEGATIVE_INFINITY,Rt=Number.NEGATIVE_INFINITY,It=!0,bt=!1,Dt=void 0;try{for(var Tt=st[Symbol.iterator](),Xt;!(It=(Xt=Tt.next()).done);It=!0){var St=Xt.value,Ut=void 0;z=="horizontal"?Ut=g.has(St)?c[g.get(St)]:k.get(St):Ut=g.has(St)?T[g.get(St)]:k.get(St);var Kt=it.get(St);Ut<ht&&(ht=Ut),Ut>ut&&(ut=Ut),Kt<yt&&(yt=Kt),Kt>Rt&&(Rt=Kt)}}catch(ee){bt=!0,Dt=ee}finally{try{!It&&Tt.return&&Tt.return()}finally{if(bt)throw Dt}}var le=(ht+ut)/2-(yt+Rt)/2,Jt=!0,_t=!1,jt=void 0;try{for(var Qt=st[Symbol.iterator](),oe;!(Jt=(oe=Qt.next()).done);Jt=!0){var te=oe.value;it.set(te,it.get(te)+le)}}catch(ee){_t=!0,jt=ee}finally{try{!Jt&&Qt.return&&Qt.return()}finally{if(_t)throw jt}}})}return it},tt=function(H){var z=0,j=0,k=0,_=0;if(H.forEach(function(dt){dt.left?c[g.get(dt.left)]-c[g.get(dt.right)]>=0?z++:j++:T[g.get(dt.top)]-T[g.get(dt.bottom)]>=0?k++:_++}),z>j&&k>_)for(var pt=0;pt<g.size;pt++)c[pt]=-1*c[pt],T[pt]=-1*T[pt];else if(z>j)for(var ct=0;ct<g.size;ct++)c[ct]=-1*c[ct];else if(k>_)for(var it=0;it<g.size;it++)T[it]=-1*T[it]},s=function(H){var z=[],j=new i,k=new Set,_=0;return H.forEach(function(pt,ct){if(!k.has(ct)){z[_]=[];var it=ct;for(j.push(it),k.add(it),z[_].push(it);j.length!=0;)it=j.shift(),H.get(it).forEach(function(dt){k.has(dt.id)||(j.push(dt.id),k.add(dt.id),z[_].push(dt.id))});_++}}),z},m=function(H){var z=new Map;return H.forEach(function(j,k){z.set(k,[])}),H.forEach(function(j,k){j.forEach(function(_){z.get(k).push(_),z.get(_.id).push({id:k,gap:_.gap,direction:_.direction})})}),z},u=function(H){var z=new Map;return H.forEach(function(j,k){z.set(k,[])}),H.forEach(function(j,k){j.forEach(function(_){z.get(_.id).push({id:k,gap:_.gap,direction:_.direction})})}),z},E=[],y=[],M=!1,A=!1,P=new Set,D=new Map,R=new Map,W=[];if(l.fixedNodeConstraint&&l.fixedNodeConstraint.forEach(function(O){P.add(O.nodeId)}),l.relativePlacementConstraint&&(l.relativePlacementConstraint.forEach(function(O){O.left?(D.has(O.left)?D.get(O.left).push({id:O.right,gap:O.gap,direction:"horizontal"}):D.set(O.left,[{id:O.right,gap:O.gap,direction:"horizontal"}]),D.has(O.right)||D.set(O.right,[])):(D.has(O.top)?D.get(O.top).push({id:O.bottom,gap:O.gap,direction:"vertical"}):D.set(O.top,[{id:O.bottom,gap:O.gap,direction:"vertical"}]),D.has(O.bottom)||D.set(O.bottom,[]))}),R=m(D),W=s(R)),h.TRANSFORM_ON_CONSTRAINT_HANDLING){if(l.fixedNodeConstraint&&l.fixedNodeConstraint.length>1)l.fixedNodeConstraint.forEach(function(O,H){E[H]=[O.position.x,O.position.y],y[H]=[c[g.get(O.nodeId)],T[g.get(O.nodeId)]]}),M=!0;else if(l.alignmentConstraint)(function(){var O=0;if(l.alignmentConstraint.vertical){for(var H=l.alignmentConstraint.vertical,z=function(it){var dt=new Set;H[it].forEach(function(et){dt.add(et)});var Lt=new Set([].concat(e(dt)).filter(function(et){return P.has(et)})),At=void 0;Lt.size>0?At=c[g.get(Lt.values().next().value)]:At=$(dt).x,H[it].forEach(function(et){E[O]=[At,T[g.get(et)]],y[O]=[c[g.get(et)],T[g.get(et)]],O++})},j=0;j<H.length;j++)z(j);M=!0}if(l.alignmentConstraint.horizontal){for(var k=l.alignmentConstraint.horizontal,_=function(it){var dt=new Set;k[it].forEach(function(et){dt.add(et)});var Lt=new Set([].concat(e(dt)).filter(function(et){return P.has(et)})),At=void 0;Lt.size>0?At=c[g.get(Lt.values().next().value)]:At=$(dt).y,k[it].forEach(function(et){E[O]=[c[g.get(et)],At],y[O]=[c[g.get(et)],T[g.get(et)]],O++})},pt=0;pt<k.length;pt++)_(pt);M=!0}l.relativePlacementConstraint&&(A=!0)})();else if(l.relativePlacementConstraint){for(var B=0,rt=0,K=0;K<W.length;K++)W[K].length>B&&(B=W[K].length,rt=K);if(B<R.size/2)tt(l.relativePlacementConstraint),M=!1,A=!1;else{var U=new Map,G=new Map,X=[];W[rt].forEach(function(O){D.get(O).forEach(function(H){H.direction=="horizontal"?(U.has(O)?U.get(O).push(H):U.set(O,[H]),U.has(H.id)||U.set(H.id,[]),X.push({left:O,right:H.id})):(G.has(O)?G.get(O).push(H):G.set(O,[H]),G.has(H.id)||G.set(H.id,[]),X.push({top:O,bottom:H.id}))})}),tt(X),A=!1;var Q=x(U,"horizontal"),at=x(G,"vertical");W[rt].forEach(function(O,H){y[H]=[c[g.get(O)],T[g.get(O)]],E[H]=[],Q.has(O)?E[H][0]=Q.get(O):E[H][0]=c[g.get(O)],at.has(O)?E[H][1]=at.get(O):E[H][1]=T[g.get(O)]}),M=!0}}if(M){for(var J=void 0,q=d.transpose(E),Et=d.transpose(y),ft=0;ft<q.length;ft++)q[ft]=d.multGamma(q[ft]),Et[ft]=d.multGamma(Et[ft]);var Z=d.multMat(q,d.transpose(Et)),mt=r.svd(Z);J=d.multMat(mt.V,d.transpose(mt.U));for(var ot=0;ot<g.size;ot++){var wt=[c[ot],T[ot]],Wt=[J[0][0],J[1][0]],Ot=[J[0][1],J[1][1]];c[ot]=d.dotProduct(wt,Wt),T[ot]=d.dotProduct(wt,Ot)}A&&tt(l.relativePlacementConstraint)}}if(h.ENFORCE_CONSTRAINTS){if(l.fixedNodeConstraint&&l.fixedNodeConstraint.length>0){var xt={x:0,y:0};l.fixedNodeConstraint.forEach(function(O,H){var z={x:c[g.get(O.nodeId)],y:T[g.get(O.nodeId)]},j=O.position,k=V(j,z);xt.x+=k.x,xt.y+=k.y}),xt.x/=l.fixedNodeConstraint.length,xt.y/=l.fixedNodeConstraint.length,c.forEach(function(O,H){c[H]+=xt.x}),T.forEach(function(O,H){T[H]+=xt.y}),l.fixedNodeConstraint.forEach(function(O){c[g.get(O.nodeId)]=O.position.x,T[g.get(O.nodeId)]=O.position.y})}if(l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var Gt=l.alignmentConstraint.vertical,$t=function(H){var z=new Set;Gt[H].forEach(function(_){z.add(_)});var j=new Set([].concat(e(z)).filter(function(_){return P.has(_)})),k=void 0;j.size>0?k=c[g.get(j.values().next().value)]:k=$(z).x,z.forEach(function(_){P.has(_)||(c[g.get(_)]=k)})},Ft=0;Ft<Gt.length;Ft++)$t(Ft);if(l.alignmentConstraint.horizontal)for(var Bt=l.alignmentConstraint.horizontal,Yt=function(H){var z=new Set;Bt[H].forEach(function(_){z.add(_)});var j=new Set([].concat(e(z)).filter(function(_){return P.has(_)})),k=void 0;j.size>0?k=T[g.get(j.values().next().value)]:k=$(z).y,z.forEach(function(_){P.has(_)||(T[g.get(_)]=k)})},qt=0;qt<Bt.length;qt++)Yt(qt)}l.relativePlacementConstraint&&(function(){var O=new Map,H=new Map,z=new Map,j=new Map,k=new Map,_=new Map,pt=new Set,ct=new Set;if(P.forEach(function(Pt){pt.add(Pt),ct.add(Pt)}),l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var it=l.alignmentConstraint.vertical,dt=function(vt){z.set("dummy"+vt,[]),it[vt].forEach(function(Ct){O.set(Ct,"dummy"+vt),z.get("dummy"+vt).push(Ct),P.has(Ct)&&pt.add("dummy"+vt)}),k.set("dummy"+vt,c[g.get(it[vt][0])])},Lt=0;Lt<it.length;Lt++)dt(Lt);if(l.alignmentConstraint.horizontal)for(var At=l.alignmentConstraint.horizontal,et=function(vt){j.set("dummy"+vt,[]),At[vt].forEach(function(Ct){H.set(Ct,"dummy"+vt),j.get("dummy"+vt).push(Ct),P.has(Ct)&&ct.add("dummy"+vt)}),_.set("dummy"+vt,T[g.get(At[vt][0])])},Nt=0;Nt<At.length;Nt++)et(Nt)}var st=new Map,nt=new Map,ht=function(vt){D.get(vt).forEach(function(Ct){var Zt=void 0,zt=void 0;Ct.direction=="horizontal"?(Zt=O.get(vt)?O.get(vt):vt,O.get(Ct.id)?zt={id:O.get(Ct.id),gap:Ct.gap,direction:Ct.direction}:zt=Ct,st.has(Zt)?st.get(Zt).push(zt):st.set(Zt,[zt]),st.has(zt.id)||st.set(zt.id,[])):(Zt=H.get(vt)?H.get(vt):vt,H.get(Ct.id)?zt={id:H.get(Ct.id),gap:Ct.gap,direction:Ct.direction}:zt=Ct,nt.has(Zt)?nt.get(Zt).push(zt):nt.set(Zt,[zt]),nt.has(zt.id)||nt.set(zt.id,[]))})},yt=!0,ut=!1,Rt=void 0;try{for(var It=D.keys()[Symbol.iterator](),bt;!(yt=(bt=It.next()).done);yt=!0){var Dt=bt.value;ht(Dt)}}catch(Pt){ut=!0,Rt=Pt}finally{try{!yt&&It.return&&It.return()}finally{if(ut)throw Rt}}var Tt=m(st),Xt=m(nt),St=s(Tt),Ut=s(Xt),Kt=u(st),le=u(nt),Jt=[],_t=[];St.forEach(function(Pt,vt){Jt[vt]=[],Pt.forEach(function(Ct){Kt.get(Ct).length==0&&Jt[vt].push(Ct)})}),Ut.forEach(function(Pt,vt){_t[vt]=[],Pt.forEach(function(Ct){le.get(Ct).length==0&&_t[vt].push(Ct)})});var jt=x(st,"horizontal",pt,k,Jt),Qt=x(nt,"vertical",ct,_,_t),oe=function(vt){z.get(vt)?z.get(vt).forEach(function(Ct){c[g.get(Ct)]=jt.get(vt)}):c[g.get(vt)]=jt.get(vt)},te=!0,ee=!1,Ee=void 0;try{for(var fe=jt.keys()[Symbol.iterator](),Te;!(te=(Te=fe.next()).done);te=!0){var ce=Te.value;oe(ce)}}catch(Pt){ee=!0,Ee=Pt}finally{try{!te&&fe.return&&fe.return()}finally{if(ee)throw Ee}}var $e=function(vt){j.get(vt)?j.get(vt).forEach(function(Ct){T[g.get(Ct)]=Qt.get(vt)}):T[g.get(vt)]=Qt.get(vt)},ge=!0,Ne=!1,Le=void 0;try{for(var ue=Qt.keys()[Symbol.iterator](),we;!(ge=(we=ue.next()).done);ge=!0){var ce=we.value;$e(ce)}}catch(Pt){Ne=!0,Le=Pt}finally{try{!ge&&ue.return&&ue.return()}finally{if(Ne)throw Le}}})()}for(var Mt=0;Mt<C.length;Mt++){var gt=C[Mt];gt.getChild()==null&>.setCenter(c[g.get(gt.id)],T[g.get(gt.id)])}},o.exports=a}),551:(o=>{o.exports=w})},N={};function v(o){var n=N[o];if(n!==void 0)return n.exports;var t=N[o]={exports:{}};return b[o](t,t.exports,v),t.exports}return v(45)})()})})),Ze=he.__commonJSMin(((L,S)=>{(function(b,N){typeof L=="object"&&typeof S=="object"?S.exports=N(Ce()):typeof define=="function"&&define.amd?define(["cose-base"],N):typeof L=="object"?L.cytoscapeFcose=N(Ce()):b.cytoscapeFcose=N(b.coseBase)})(L,function(w){return(()=>{"use strict";var b={658:(o=>{o.exports=Object.assign!=null?Object.assign.bind(Object):function(n){for(var t=arguments.length,e=Array(t>1?t-1:0),h=1;h<t;h++)e[h-1]=arguments[h];return e.forEach(function(i){Object.keys(i).forEach(function(d){return n[d]=i[d]})}),n}}),548:((o,n,t)=>{var e=(function(){function d(r,a){var f=[],l=!0,p=!1,g=void 0;try{for(var c=r[Symbol.iterator](),T;!(l=(T=c.next()).done)&&(f.push(T.value),!(a&&f.length===a));l=!0);}catch(C){p=!0,g=C}finally{try{!l&&c.return&&c.return()}finally{if(p)throw g}}return f}return function(r,a){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return d(r,a);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),h=t(140).layoutBase.LinkedList,i={};i.getTopMostNodes=function(d){for(var r={},a=0;a<d.length;a++)r[d[a].id()]=!0;return d.filter(function(f,l){typeof f=="number"&&(f=l);for(var p=f.parent()[0];p!=null;){if(r[p.id()])return!1;p=p.parent()[0]}return!0})},i.connectComponents=function(d,r,a,f){var l=new h,p=new Set,g=[],c=void 0,T=void 0,C=void 0,I=!1,F=1,Y=[],V=[],$=function(){var tt=d.collection();V.push(tt);var s=a[0],m=d.collection();m.merge(s).merge(s.descendants().intersection(r)),g.push(s),m.forEach(function(y){l.push(y),p.add(y),tt.merge(y)});for(var u=function(){s=l.shift();var M=d.collection();s.neighborhood().nodes().forEach(function(D){r.intersection(s.edgesWith(D)).length>0&&M.merge(D)});for(var A=0;A<M.length;A++){var P=M[A];c=a.intersection(P.union(P.ancestors())),c!=null&&!p.has(c[0])&&c.union(c.descendants()).forEach(function(D){l.push(D),p.add(D),tt.merge(D),a.has(D)&&g.push(D)})}};l.length!=0;)u();if(tt.forEach(function(y){r.intersection(y.connectedEdges()).forEach(function(M){tt.has(M.source())&&tt.has(M.target())&&tt.merge(M)})}),g.length==a.length&&(I=!0),!I||I&&F>1){T=g[0],C=T.connectedEdges().length,g.forEach(function(y){y.connectedEdges().length<C&&(C=y.connectedEdges().length,T=y)}),Y.push(T.id());var E=d.collection();E.merge(g[0]),g.forEach(function(y){E.merge(y)}),g=[],a=a.difference(E),F++}};do $();while(!I);return f&&Y.length>0&&f.set("dummy"+(f.size+1),Y),V},i.relocateComponent=function(d,r,a){if(!a.fixedNodeConstraint){var f=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,p=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;if(a.quality=="draft"){var c=!0,T=!1,C=void 0;try{for(var I=r.nodeIndexes[Symbol.iterator](),F;!(c=(F=I.next()).done);c=!0){var Y=F.value,V=e(Y,2),$=V[0],x=V[1],tt=a.cy.getElementById($);if(tt){var s=tt.boundingBox(),m=r.xCoords[x]-s.w/2,u=r.xCoords[x]+s.w/2,E=r.yCoords[x]-s.h/2,y=r.yCoords[x]+s.h/2;m<f&&(f=m),u>l&&(l=u),E<p&&(p=E),y>g&&(g=y)}}}catch(R){T=!0,C=R}finally{try{!c&&I.return&&I.return()}finally{if(T)throw C}}var M=d.x-(l+f)/2,A=d.y-(g+p)/2;r.xCoords=r.xCoords.map(function(R){return R+M}),r.yCoords=r.yCoords.map(function(R){return R+A})}else{Object.keys(r).forEach(function(R){var W=r[R],B=W.getRect().x,rt=W.getRect().x+W.getRect().width,K=W.getRect().y,U=W.getRect().y+W.getRect().height;B<f&&(f=B),rt>l&&(l=rt),K<p&&(p=K),U>g&&(g=U)});var P=d.x-(l+f)/2,D=d.y-(g+p)/2;Object.keys(r).forEach(function(R){var W=r[R];W.setCenter(W.getCenterX()+P,W.getCenterY()+D)})}}},i.calcBoundingBox=function(d,r,a,f){for(var l=Number.MAX_SAFE_INTEGER,p=Number.MIN_SAFE_INTEGER,g=Number.MAX_SAFE_INTEGER,c=Number.MIN_SAFE_INTEGER,T=void 0,C=void 0,I=void 0,F=void 0,Y=d.descendants().not(":parent"),V=Y.length,$=0;$<V;$++){var x=Y[$];T=r[f.get(x.id())]-x.width()/2,C=r[f.get(x.id())]+x.width()/2,I=a[f.get(x.id())]-x.height()/2,F=a[f.get(x.id())]+x.height()/2,l>T&&(l=T),p<C&&(p=C),g>I&&(g=I),c<F&&(c=F)}var tt={};return tt.topLeftX=l,tt.topLeftY=g,tt.width=p-l,tt.height=c-g,tt},i.calcParentsWithoutChildren=function(d,r){var a=d.collection();return r.nodes(":parent").forEach(function(f){var l=!1;f.children().forEach(function(p){p.css("display")!="none"&&(l=!0)}),l||a.merge(f)}),a},o.exports=i}),816:((o,n,t)=>{var e=t(548),h=t(140).CoSELayout,i=t(140).CoSENode,d=t(140).layoutBase.PointD,r=t(140).layoutBase.DimensionD,a=t(140).layoutBase.LayoutConstants,f=t(140).layoutBase.FDLayoutConstants,l=t(140).CoSEConstants;o.exports={coseLayout:function(g,c){var T=g.cy,C=g.eles,I=C.nodes(),F=C.edges(),Y=void 0,V=void 0,$=void 0,x={};g.randomize&&(Y=c.nodeIndexes,V=c.xCoords,$=c.yCoords);var tt=function(D){return typeof D=="function"},s=function(D,R){return tt(D)?D(R):D},m=e.calcParentsWithoutChildren(T,C),u=function P(D,R,W,B){for(var rt=R.length,K=0;K<rt;K++){var U=R[K],G=null;U.intersection(m).length==0&&(G=U.children());var X=void 0,Q=U.layoutDimensions({nodeDimensionsIncludeLabels:B.nodeDimensionsIncludeLabels});if(U.outerWidth()!=null&&U.outerHeight()!=null)if(B.randomize)if(!U.isParent())X=D.add(new i(W.graphManager,new d(V[Y.get(U.id())]-Q.w/2,$[Y.get(U.id())]-Q.h/2),new r(parseFloat(Q.w),parseFloat(Q.h))));else{var at=e.calcBoundingBox(U,V,$,Y);U.intersection(m).length==0?X=D.add(new i(W.graphManager,new d(at.topLeftX,at.topLeftY),new r(at.width,at.height))):X=D.add(new i(W.graphManager,new d(at.topLeftX,at.topLeftY),new r(parseFloat(Q.w),parseFloat(Q.h))))}else X=D.add(new i(W.graphManager,new d(U.position("x")-Q.w/2,U.position("y")-Q.h/2),new r(parseFloat(Q.w),parseFloat(Q.h))));else X=D.add(new i(this.graphManager));if(X.id=U.data("id"),X.nodeRepulsion=s(B.nodeRepulsion,U),X.paddingLeft=parseInt(U.css("padding")),X.paddingTop=parseInt(U.css("padding")),X.paddingRight=parseInt(U.css("padding")),X.paddingBottom=parseInt(U.css("padding")),B.nodeDimensionsIncludeLabels&&(X.labelWidth=U.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,X.labelHeight=U.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,X.labelPosVertical=U.css("text-valign"),X.labelPosHorizontal=U.css("text-halign")),x[U.data("id")]=X,isNaN(X.rect.x)&&(X.rect.x=0),isNaN(X.rect.y)&&(X.rect.y=0),G!=null&&G.length>0){var J=void 0;J=W.getGraphManager().add(W.newGraph(),X),P(J,G,W,B)}}},E=function(D,R,W){for(var B=0,rt=0,K=0;K<W.length;K++){var U=W[K],G=x[U.data("source")],X=x[U.data("target")];if(G&&X&&G!==X&&G.getEdgesBetween(X).length==0){var Q=R.add(D.newEdge(),G,X);Q.id=U.id(),Q.idealLength=s(g.idealEdgeLength,U),Q.edgeElasticity=s(g.edgeElasticity,U),B+=Q.idealLength,rt++}}g.idealEdgeLength!=null&&(rt>0?l.DEFAULT_EDGE_LENGTH=f.DEFAULT_EDGE_LENGTH=B/rt:tt(g.idealEdgeLength)?l.DEFAULT_EDGE_LENGTH=f.DEFAULT_EDGE_LENGTH=50:l.DEFAULT_EDGE_LENGTH=f.DEFAULT_EDGE_LENGTH=g.idealEdgeLength,l.MIN_REPULSION_DIST=f.MIN_REPULSION_DIST=f.DEFAULT_EDGE_LENGTH/10,l.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH)},y=function(D,R){R.fixedNodeConstraint&&(D.constraints.fixedNodeConstraint=R.fixedNodeConstraint),R.alignmentConstraint&&(D.constraints.alignmentConstraint=R.alignmentConstraint),R.relativePlacementConstraint&&(D.constraints.relativePlacementConstraint=R.relativePlacementConstraint)};g.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=f.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.nestingFactor),g.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=f.DEFAULT_GRAVITY_STRENGTH=g.gravity),g.numIter!=null&&(l.MAX_ITERATIONS=f.MAX_ITERATIONS=g.numIter),g.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=f.DEFAULT_GRAVITY_RANGE_FACTOR=g.gravityRange),g.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=f.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.gravityCompound),g.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=f.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.gravityRangeCompound),g.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=f.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.initialEnergyOnIncremental),g.tilingCompareBy!=null&&(l.TILING_COMPARE_BY=g.tilingCompareBy),g.quality=="proof"?a.QUALITY=2:a.QUALITY=0,l.NODE_DIMENSIONS_INCLUDE_LABELS=f.NODE_DIMENSIONS_INCLUDE_LABELS=a.NODE_DIMENSIONS_INCLUDE_LABELS=g.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=f.DEFAULT_INCREMENTAL=a.DEFAULT_INCREMENTAL=!g.randomize,l.ANIMATE=f.ANIMATE=a.ANIMATE=g.animate,l.TILE=g.tile,l.TILING_PADDING_VERTICAL=typeof g.tilingPaddingVertical=="function"?g.tilingPaddingVertical.call():g.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof g.tilingPaddingHorizontal=="function"?g.tilingPaddingHorizontal.call():g.tilingPaddingHorizontal,l.DEFAULT_INCREMENTAL=f.DEFAULT_INCREMENTAL=a.DEFAULT_INCREMENTAL=!0,l.PURE_INCREMENTAL=!g.randomize,a.DEFAULT_UNIFORM_LEAF_NODE_SIZES=g.uniformNodeDimensions,g.step=="transformed"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!1),g.step=="enforced"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!1),g.step=="cose"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!0),g.step=="all"&&(g.randomize?l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!0),g.fixedNodeConstraint||g.alignmentConstraint||g.relativePlacementConstraint?l.TREE_REDUCTION_ON_INCREMENTAL=!1:l.TREE_REDUCTION_ON_INCREMENTAL=!0;var M=new h,A=M.newGraphManager();return u(A.addRoot(),e.getTopMostNodes(I),M,g),E(M,A,F),y(M,g),M.runLayout(),x}}}),212:((o,n,t)=>{var e=(function(){function l(p,g){for(var c=0;c<g.length;c++){var T=g[c];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(p,T.key,T)}}return function(p,g,c){return g&&l(p.prototype,g),c&&l(p,c),p}})();function h(l,p){if(!(l instanceof p))throw new TypeError("Cannot call a class as a function")}var i=t(658),d=t(548),r=t(657).spectralLayout,a=t(816).coseLayout,f=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(p){return 4500},idealEdgeLength:function(p){return 50},edgeElasticity:function(p){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(){}});o.exports=(function(){function l(p){h(this,l),this.options=i({},f,p)}return e(l,[{key:"run",value:function(){var g=this,c=this.options,T=c.cy,C=c.eles,I=[],F=[],Y=void 0,V=[];c.fixedNodeConstraint&&(!Array.isArray(c.fixedNodeConstraint)||c.fixedNodeConstraint.length==0)&&(c.fixedNodeConstraint=void 0),c.alignmentConstraint&&(c.alignmentConstraint.vertical&&(!Array.isArray(c.alignmentConstraint.vertical)||c.alignmentConstraint.vertical.length==0)&&(c.alignmentConstraint.vertical=void 0),c.alignmentConstraint.horizontal&&(!Array.isArray(c.alignmentConstraint.horizontal)||c.alignmentConstraint.horizontal.length==0)&&(c.alignmentConstraint.horizontal=void 0)),c.relativePlacementConstraint&&(!Array.isArray(c.relativePlacementConstraint)||c.relativePlacementConstraint.length==0)&&(c.relativePlacementConstraint=void 0),(c.fixedNodeConstraint||c.alignmentConstraint||c.relativePlacementConstraint)&&(c.tile=!1,c.packComponents=!1);var $=void 0,x=!1;if(T.layoutUtilities&&c.packComponents&&($=T.layoutUtilities("get"),$||($=T.layoutUtilities()),x=!0),C.nodes().length>0)if(x){var m=d.getTopMostNodes(c.eles.nodes());if(Y=d.connectComponents(T,c.eles,m),Y.forEach(function(J){var q=J.boundingBox();V.push({x:q.x1+q.w/2,y:q.y1+q.h/2})}),c.randomize&&Y.forEach(function(J){c.eles=J,I.push(r(c))}),c.quality=="default"||c.quality=="proof"){var u=T.collection();if(c.tile){var E=new Map,y=[],M=[],A=0,P={nodeIndexes:E,xCoords:y,yCoords:M},D=[];if(Y.forEach(function(J,q){J.edges().length==0&&(J.nodes().forEach(function(Et,ft){u.merge(J.nodes()[ft]),Et.isParent()||(P.nodeIndexes.set(J.nodes()[ft].id(),A++),P.xCoords.push(J.nodes()[0].position().x),P.yCoords.push(J.nodes()[0].position().y))}),D.push(q))}),u.length>1){var R=u.boundingBox();V.push({x:R.x1+R.w/2,y:R.y1+R.h/2}),Y.push(u),I.push(P);for(var W=D.length-1;W>=0;W--)Y.splice(D[W],1),I.splice(D[W],1),V.splice(D[W],1)}}Y.forEach(function(J,q){c.eles=J,F.push(a(c,I[q])),d.relocateComponent(V[q],F[q],c)})}else Y.forEach(function(J,q){d.relocateComponent(V[q],I[q],c)});var B=new Set;if(Y.length>1){var rt=[],K=C.filter(function(J){return J.css("display")=="none"});Y.forEach(function(J,q){var Et=void 0;if(c.quality=="draft"&&(Et=I[q].nodeIndexes),J.nodes().not(K).length>0){var ft={};ft.edges=[],ft.nodes=[];var Z=void 0;J.nodes().not(K).forEach(function(mt){if(c.quality=="draft")if(!mt.isParent())Z=Et.get(mt.id()),ft.nodes.push({x:I[q].xCoords[Z]-mt.boundingbox().w/2,y:I[q].yCoords[Z]-mt.boundingbox().h/2,width:mt.boundingbox().w,height:mt.boundingbox().h});else{var ot=d.calcBoundingBox(mt,I[q].xCoords,I[q].yCoords,Et);ft.nodes.push({x:ot.topLeftX,y:ot.topLeftY,width:ot.width,height:ot.height})}else F[q][mt.id()]&&ft.nodes.push({x:F[q][mt.id()].getLeft(),y:F[q][mt.id()].getTop(),width:F[q][mt.id()].getWidth(),height:F[q][mt.id()].getHeight()})}),J.edges().forEach(function(mt){var ot=mt.source(),wt=mt.target();if(ot.css("display")!="none"&&wt.css("display")!="none")if(c.quality=="draft"){var Wt=Et.get(ot.id()),Ot=Et.get(wt.id()),xt=[],Gt=[];if(ot.isParent()){var $t=d.calcBoundingBox(ot,I[q].xCoords,I[q].yCoords,Et);xt.push($t.topLeftX+$t.width/2),xt.push($t.topLeftY+$t.height/2)}else xt.push(I[q].xCoords[Wt]),xt.push(I[q].yCoords[Wt]);if(wt.isParent()){var Ft=d.calcBoundingBox(wt,I[q].xCoords,I[q].yCoords,Et);Gt.push(Ft.topLeftX+Ft.width/2),Gt.push(Ft.topLeftY+Ft.height/2)}else Gt.push(I[q].xCoords[Ot]),Gt.push(I[q].yCoords[Ot]);ft.edges.push({startX:xt[0],startY:xt[1],endX:Gt[0],endY:Gt[1]})}else F[q][ot.id()]&&F[q][wt.id()]&&ft.edges.push({startX:F[q][ot.id()].getCenterX(),startY:F[q][ot.id()].getCenterY(),endX:F[q][wt.id()].getCenterX(),endY:F[q][wt.id()].getCenterY()})}),ft.nodes.length>0&&(rt.push(ft),B.add(q))}});var U=$.packComponents(rt,c.randomize).shifts;if(c.quality=="draft")I.forEach(function(J,q){var Et=J.xCoords.map(function(Z){return Z+U[q].dx}),ft=J.yCoords.map(function(Z){return Z+U[q].dy});J.xCoords=Et,J.yCoords=ft});else{var G=0;B.forEach(function(J){Object.keys(F[J]).forEach(function(q){var Et=F[J][q];Et.setCenter(Et.getCenterX()+U[G].dx,Et.getCenterY()+U[G].dy)}),G++})}}}else{var tt=c.eles.boundingBox();if(V.push({x:tt.x1+tt.w/2,y:tt.y1+tt.h/2}),c.randomize){var s=r(c);I.push(s)}c.quality=="default"||c.quality=="proof"?(F.push(a(c,I[0])),d.relocateComponent(V[0],F[0],c)):d.relocateComponent(V[0],I[0],c)}var X=function(q,Et){if(c.quality=="default"||c.quality=="proof"){typeof q=="number"&&(q=Et);var ft=void 0,Z=void 0,mt=q.data("id");return F.forEach(function(wt){mt in wt&&(ft={x:wt[mt].getRect().getCenterX(),y:wt[mt].getRect().getCenterY()},Z=wt[mt])}),c.nodeDimensionsIncludeLabels&&(Z.labelWidth&&(Z.labelPosHorizontal=="left"?ft.x+=Z.labelWidth/2:Z.labelPosHorizontal=="right"&&(ft.x-=Z.labelWidth/2)),Z.labelHeight&&(Z.labelPosVertical=="top"?ft.y+=Z.labelHeight/2:Z.labelPosVertical=="bottom"&&(ft.y-=Z.labelHeight/2))),ft==null&&(ft={x:q.position("x"),y:q.position("y")}),{x:ft.x,y:ft.y}}else{var ot=void 0;return I.forEach(function(wt){var Wt=wt.nodeIndexes.get(q.id());Wt!=null&&(ot={x:wt.xCoords[Wt],y:wt.yCoords[Wt]})}),ot==null&&(ot={x:q.position("x"),y:q.position("y")}),{x:ot.x,y:ot.y}}};if(c.quality=="default"||c.quality=="proof"||c.randomize){var Q=d.calcParentsWithoutChildren(T,C),at=C.filter(function(J){return J.css("display")=="none"});c.eles=C.not(at),C.nodes().not(":parent").not(at).layoutPositions(g,c,X),Q.length>0&&Q.forEach(function(J){J.position(X(J))})}}}]),l})()}),657:((o,n,t)=>{var e=t(548),h=t(140).layoutBase.Matrix,i=t(140).layoutBase.SVD;o.exports={spectralLayout:function(r){var a=r.cy,f=r.eles,l=f.nodes(),p=f.nodes(":parent"),g=new Map,c=new Map,T=new Map,C=[],I=[],F=[],Y=[],V=[],$=[],x=[],tt=[],s=void 0,m=1e8,u=1e-9,E=r.piTol,y=r.samplingType,M=r.nodeSeparation,A=void 0,P=function(){for(var gt=0,O=0,H=!1;O<A;){gt=Math.floor(Math.random()*s),H=!1;for(var z=0;z<O;z++)if(Y[z]==gt){H=!0;break}if(!H)Y[O]=gt,O++;else continue}},D=function(gt,O,H){for(var z=[],j=0,k=0,_=0,pt=void 0,ct=[],it=0,dt=1,Lt=0;Lt<s;Lt++)ct[Lt]=m;for(z[k]=gt,ct[gt]=0;k>=j;){_=z[j++];for(var At=C[_],et=0;et<At.length;et++)pt=c.get(At[et]),ct[pt]==m&&(ct[pt]=ct[_]+1,z[++k]=pt);$[_][O]=ct[_]*M}if(H){for(var Nt=0;Nt<s;Nt++)$[Nt][O]<V[Nt]&&(V[Nt]=$[Nt][O]);for(var st=0;st<s;st++)V[st]>it&&(it=V[st],dt=st)}return dt},R=function(gt){var O=void 0;if(gt){O=Math.floor(Math.random()*s);for(var z=0;z<s;z++)V[z]=m;for(var j=0;j<A;j++)Y[j]=O,O=D(O,j,gt)}else{P();for(var H=0;H<A;H++)D(Y[H],H,gt,!1)}for(var k=0;k<s;k++)for(var _=0;_<A;_++)$[k][_]*=$[k][_];for(var pt=0;pt<A;pt++)x[pt]=[];for(var ct=0;ct<A;ct++)for(var it=0;it<A;it++)x[ct][it]=$[Y[it]][ct]},W=function(){for(var gt=i.svd(x),O=gt.S,H=gt.U,z=gt.V,j=O[0]*O[0]*O[0],k=[],_=0;_<A;_++){k[_]=[];for(var pt=0;pt<A;pt++)k[_][pt]=0,_==pt&&(k[_][pt]=O[_]/(O[_]*O[_]+j/(O[_]*O[_])))}tt=h.multMat(h.multMat(z,k),h.transpose(H))},B=function(){for(var gt=void 0,O=void 0,H=[],z=[],j=[],k=[],_=0;_<s;_++)H[_]=Math.random(),z[_]=Math.random();H=h.normalize(H),z=h.normalize(z);for(var pt=0,ct=u,it=u,dt=void 0;;){pt++;for(var Lt=0;Lt<s;Lt++)j[Lt]=H[Lt];if(H=h.multGamma(h.multL(h.multGamma(j),$,tt)),gt=h.dotProduct(j,H),H=h.normalize(H),ct=h.dotProduct(j,H),dt=Math.abs(ct/it),dt<=1+E&&dt>=1)break;it=ct}for(var At=0;At<s;At++)j[At]=H[At];for(pt=0,it=u;;){pt++;for(var et=0;et<s;et++)k[et]=z[et];if(k=h.minusOp(k,h.multCons(j,h.dotProduct(j,k))),z=h.multGamma(h.multL(h.multGamma(k),$,tt)),O=h.dotProduct(k,z),z=h.normalize(z),ct=h.dotProduct(k,z),dt=Math.abs(ct/it),dt<=1+E&&dt>=1)break;it=ct}for(var Nt=0;Nt<s;Nt++)k[Nt]=z[Nt];I=h.multCons(j,Math.sqrt(Math.abs(gt))),F=h.multCons(k,Math.sqrt(Math.abs(O)))};e.connectComponents(a,f,e.getTopMostNodes(l),g),p.forEach(function(Mt){e.connectComponents(a,f,e.getTopMostNodes(Mt.descendants().intersection(f)),g)});for(var rt=0,K=0;K<l.length;K++)l[K].isParent()||c.set(l[K].id(),rt++);var U=!0,G=!1,X=void 0;try{for(var Q=g.keys()[Symbol.iterator](),at;!(U=(at=Q.next()).done);U=!0){var J=at.value;c.set(J,rt++)}}catch(Mt){G=!0,X=Mt}finally{try{!U&&Q.return&&Q.return()}finally{if(G)throw X}}for(var q=0;q<c.size;q++)C[q]=[];p.forEach(function(Mt){for(var gt=Mt.children().intersection(f);gt.nodes(":childless").length==0;)gt=gt.nodes()[0].children().intersection(f);var O=0,H=gt.nodes(":childless")[0].connectedEdges().length;gt.nodes(":childless").forEach(function(z,j){z.connectedEdges().length<H&&(H=z.connectedEdges().length,O=j)}),T.set(Mt.id(),gt.nodes(":childless")[O].id())}),l.forEach(function(Mt){var gt=void 0;Mt.isParent()?gt=c.get(T.get(Mt.id())):gt=c.get(Mt.id()),Mt.neighborhood().nodes().forEach(function(O){f.intersection(Mt.edgesWith(O)).length>0&&(O.isParent()?C[gt].push(T.get(O.id())):C[gt].push(O.id()))})});var Et=function(gt){var O=c.get(gt),H=void 0;g.get(gt).forEach(function(z){a.getElementById(z).isParent()?H=T.get(z):H=z,C[O].push(H),C[c.get(H)].push(gt)})},ft=!0,Z=!1,mt=void 0;try{for(var ot=g.keys()[Symbol.iterator](),wt;!(ft=(wt=ot.next()).done);ft=!0){var Wt=wt.value;Et(Wt)}}catch(Mt){Z=!0,mt=Mt}finally{try{!ft&&ot.return&&ot.return()}finally{if(Z)throw mt}}s=c.size;var Ot=void 0;if(s>2){A=s<r.sampleSize?s:r.sampleSize;for(var xt=0;xt<s;xt++)$[xt]=[];for(var Gt=0;Gt<A;Gt++)tt[Gt]=[];return r.quality=="draft"||r.step=="all"?(R(y),W(),B(),Ot={nodeIndexes:c,xCoords:I,yCoords:F}):(c.forEach(function(Mt,gt){I.push(a.getElementById(gt).position("x")),F.push(a.getElementById(gt).position("y"))}),Ot={nodeIndexes:c,xCoords:I,yCoords:F}),Ot}else{var $t=c.keys(),Ft=a.getElementById($t.next().value),Bt=Ft.position(),Yt=Ft.outerWidth();if(I.push(Bt.x),F.push(Bt.y),s==2){var qt=a.getElementById($t.next().value).outerWidth();I.push(Bt.x+Yt/2+qt/2+r.idealEdgeLength),F.push(Bt.y)}return Ot={nodeIndexes:c,xCoords:I,yCoords:F},Ot}}}}),579:((o,n,t)=>{var e=t(212),h=function(d){d&&d("layout","fcose",e)};typeof cytoscape<"u"&&h(cytoscape),o.exports=h}),140:(o=>{o.exports=w})},N={};function v(o){var n=N[o];if(n!==void 0)return n.exports;var t=N[o]={exports:{}};return b[o](t,t.exports,v),t.exports}return v(579)})()})})),ke=he.__toESM(Ze(),1),Ae={L:"left",R:"right",T:"top",B:"bottom"},De={L:lt.__name(L=>`${L},${L/2} 0,${L} 0,0`,"L"),R:lt.__name(L=>`0,${L/2} ${L},0 ${L},${L}`,"R"),T:lt.__name(L=>`0,0 ${L},0 ${L/2},${L}`,"T"),B:lt.__name(L=>`${L/2},0 ${L},${L} 0,${L}`,"B")},se={L:lt.__name((L,S)=>L-S+2,"L"),R:lt.__name((L,S)=>L-2,"R"),T:lt.__name((L,S)=>L-S+2,"T"),B:lt.__name((L,S)=>L-2,"B")},Je=lt.__name(function(L){return Ht(L)?L==="L"?"R":"L":L==="T"?"B":"T"},"getOppositeArchitectureDirection"),Oe=lt.__name(function(L){const S=L;return S==="L"||S==="R"||S==="T"||S==="B"},"isArchitectureDirection"),Ht=lt.__name(function(L){const S=L;return S==="L"||S==="R"},"isArchitectureDirectionX"),kt=lt.__name(function(L){const S=L;return S==="T"||S==="B"},"isArchitectureDirectionY"),me=lt.__name(function(L,S){const w=Ht(L)&&kt(S),b=kt(L)&&Ht(S);return w||b},"isArchitectureDirectionXY"),Qe=lt.__name(function(L){const S=L[0],w=L[1],b=Ht(S)&&kt(w),N=kt(S)&&Ht(w);return b||N},"isArchitecturePairXY"),Ke=lt.__name(function(L){return L!=="LL"&&L!=="RR"&&L!=="TT"&&L!=="BB"},"isValidArchitectureDirectionPair"),ve=lt.__name(function(L,S){const w=`${L}${S}`;return Ke(w)?w:void 0},"getArchitectureDirectionPair"),_e=lt.__name(function([L,S],w){const b=w[0],N=w[1];return Ht(b)?kt(N)?[L+(b==="L"?-1:1),S+(N==="T"?1:-1)]:[L+(b==="L"?-1:1),S]:Ht(N)?[L+(N==="L"?1:-1),S+(b==="T"?1:-1)]:[L,S+(b==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),je=lt.__name(function(L){return L==="LT"||L==="TL"?[1,1]:L==="BL"||L==="LB"?[1,-1]:L==="BR"||L==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),tr=lt.__name(function(L,S){return me(L,S)?"bend":Ht(L)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),er=lt.__name(function(L){return L.type==="service"},"isArchitectureService"),rr=lt.__name(function(L){return L.type==="junction"},"isArchitectureJunction"),Re=lt.__name((L,S)=>{const[w,b]=[L,S].sort();return`${JSON.stringify(w)}-${JSON.stringify(b)}`},"architectureGroupAlignmentKey"),Se=lt.__name(L=>L.data(),"edgeData"),ie=lt.__name(L=>L.data(),"nodeData"),ir=Vt.defaultConfig_default.architecture,Fe=class{constructor(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.elements=new Map,this.diagramId="",this.setAccTitle=Vt.setAccTitle,this.getAccTitle=Vt.getAccTitle,this.setDiagramTitle=Vt.setDiagramTitle,this.getDiagramTitle=Vt.getDiagramTitle,this.getAccDescription=Vt.getAccDescription,this.setAccDescription=Vt.setAccDescription,this.clear()}static{lt.__name(this,"ArchitectureDB")}setDiagramId(L){this.diagramId=L}getDiagramId(){return this.diagramId}clear(){this.nodes=new Map,this.groups=new Map,this.edges=[],this.layoutHints=[],this.registeredIds=new Map,this.dataStructures=void 0,this.elements=new Map,this.diagramId="",Vt.clear()}addService({id:L,icon:S,in:w,title:b,iconText:N}){if(this.registeredIds.has(L))throw new Error(`The service id [${L}] is already in use by another ${this.registeredIds.get(L)}`);if(w!==void 0){if(L===w)throw new Error(`The service [${L}] cannot be placed within itself`);if(!this.registeredIds.has(w))throw new Error(`The service [${L}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds.get(w)==="node")throw new Error(`The service [${L}]'s parent is not a group`)}this.registeredIds.set(L,"node"),this.nodes.set(L,{id:L,type:"service",icon:S,iconText:N,title:b,edges:[],in:w})}getServices(){return[...this.nodes.values()].filter(er)}addJunction({id:L,in:S}){if(this.registeredIds.has(L))throw new Error(`The junction id [${L}] is already in use by another ${this.registeredIds.get(L)}`);if(S!==void 0){if(L===S)throw new Error(`The junction [${L}] cannot be placed within itself`);if(!this.registeredIds.has(S))throw new Error(`The junction [${L}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds.get(S)==="node")throw new Error(`The junction [${L}]'s parent is not a group`)}this.registeredIds.set(L,"node"),this.nodes.set(L,{id:L,type:"junction",edges:[],in:S})}getJunctions(){return[...this.nodes.values()].filter(rr)}getNodes(){return[...this.nodes.values()]}getNode(L){return this.nodes.get(L)??null}addGroup({id:L,icon:S,in:w,title:b}){if(this.registeredIds.has(L))throw new Error(`The group id [${L}] is already in use by another ${this.registeredIds.get(L)}`);if(w!==void 0){if(L===w)throw new Error(`The group [${L}] cannot be placed within itself`);if(!this.registeredIds.has(w))throw new Error(`The group [${L}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds.get(w)==="node")throw new Error(`The group [${L}]'s parent is not a group`)}this.registeredIds.set(L,"group"),this.groups.set(L,{id:L,icon:S,title:b,in:w})}getGroups(){return[...this.groups.values()]}addEdge({lhsId:L,rhsId:S,lhsDir:w,rhsDir:b,lhsInto:N,rhsInto:v,lhsGroup:o,rhsGroup:n,title:t}){if(!Oe(w))throw new Error(`Invalid direction given for left hand side of edge ${L}--${S}. Expected (L,R,T,B) got ${String(w)}`);if(!Oe(b))throw new Error(`Invalid direction given for right hand side of edge ${L}--${S}. Expected (L,R,T,B) got ${String(b)}`);if(!this.nodes.has(L)&&!this.groups.has(L))throw new Error(`The left-hand id [${L}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(!this.nodes.has(S)&&!this.groups.has(S))throw new Error(`The right-hand id [${S}] does not yet exist. Please create the service/group before declaring an edge to it.`);const e=this.nodes.get(L).in,h=this.nodes.get(S).in;if(o&&e&&h&&e==h)throw new Error(`The left-hand id [${L}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(n&&e&&h&&e==h)throw new Error(`The right-hand id [${S}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const i={lhsId:L,lhsDir:w,lhsInto:N,lhsGroup:o,rhsId:S,rhsDir:b,rhsInto:v,rhsGroup:n,title:t};this.edges.push(i);const d=this.nodes.get(L),r=this.nodes.get(S);d&&r&&(d.edges.push(this.edges[this.edges.length-1]),r.edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(L){if(L.members.length<2)throw new Error(`An align directive requires at least two members; got ${L.members.length}`);const S=new Set;L.members.forEach(w=>{if(this.registeredIds.get(w)!=="node")throw new Error(`align ${L.direction} references [${w}], which is not a service or junction`);if(S.has(w))throw new Error(`align ${L.direction} lists [${w}] more than once`);S.add(w)}),this.layoutHints.push(L)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){const L=new Map,S=new Map;for(const[o,n]of this.nodes.entries()){const t=new Map;for(const e of n.edges){const h=this.getNode(e.lhsId)?.in,i=this.getNode(e.rhsId)?.in;if(h&&i&&h!==i){const d=tr(e.lhsDir,e.rhsDir);d!=="bend"&&L.set(Re(h,i),d)}if(e.lhsId===o){const d=ve(e.lhsDir,e.rhsDir);d&&t.set(d,e.rhsId)}else{const d=ve(e.rhsDir,e.lhsDir);d&&t.set(d,e.lhsId)}}S.set(o,t)}const w=new Set,b=new Set(S.keys()),N=lt.__name(o=>{const n=new Map([[o,[0,0]]]),t=[o];for(;t.length>0;){const e=t.shift();if(e){w.add(e),b.delete(e);const h=S.get(e);if(!h)throw new Error(`BFS error: adjacency list for id ${e} not found. Please report this as a bug.`);const i=n.get(e);if(!i)throw new Error(`BFS error: position for id ${e} not found in spatial map. Please report this as a bug.`);const[d,r]=i;h.forEach((a,f)=>{w.has(a)||(n.set(a,_e([d,r],f)),t.push(a))})}}return n},"BFS"),v=[];for(;b.size>0;){const o=b.values().next().value;v.push(N(o))}this.dataStructures={adjList:S,spatialMaps:v,groupAlignments:L}}return this.dataStructures}setElementForId(L,S){this.elements.set(L,S)}getElementById(L){return this.elements.get(L)}getConfig(){return xe.cleanAndMerge({...ir,...Vt.getConfig().architecture})}getConfigField(L){return this.getConfig()[L]}},ar=lt.__name((L,S)=>{Be.populateCommonDb(L,S),L.groups.map(w=>S.addGroup(w)),L.services.map(w=>S.addService({...w,type:"service"})),L.junctions.map(w=>S.addJunction({...w,type:"junction"})),L.edges.map(w=>S.addEdge(w)),L.alignments?.map(w=>S.addLayoutHint({direction:w.direction,members:[...w.members]}))},"populateDb"),be={parser:{yy:void 0},parse:lt.__name(async L=>{const S=await qe.parse("architecture",L);de.log.debug(S);const w=be.parser?.yy;if(!(w instanceof Fe))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");ar(S,w)},"parse")},nr=lt.__name(L=>`
.edge {
stroke-width: ${L.archEdgeWidth};
stroke: ${L.archEdgeColor};
fill: none;
}
.arrow {
fill: ${L.archEdgeArrowColor};
}
.node-bkg {
fill: none;
stroke: ${L.archGroupBorderColor};
stroke-width: ${L.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");function pe(L,S){if(L===0)return S();const w=Math.random;let b=L>>>0;Math.random=function(){b=b+1831565813>>>0;let N=b;return N=Math.imul(N^N>>>15,N|1),N^=N+Math.imul(N^N>>>7,N|61),((N^N>>>14)>>>0)/4294967296};try{return S()}finally{Math.random=w}}lt.__name(pe,"withSeededRandom");var re=lt.__name(L=>`<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${L}</g>`,"wrapIcon"),ne={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:ae.unknownIcon,blank:{body:re("")}}},or=lt.__name(async function(L,S,w,b){const N=w.getConfigField("padding"),v=w.getConfigField("iconSize"),o=v/2,n=v/6,t=n/2;await Promise.all(S.edges().map(async e=>{const{source:h,sourceDir:i,sourceArrow:d,sourceGroup:r,target:a,targetDir:f,targetArrow:l,targetGroup:p,label:g}=Se(e);let{x:c,y:T}=e[0].sourceEndpoint();const{x:C,y:I}=e[0].midpoint();let{x:F,y:Y}=e[0].targetEndpoint();const V=N+4;if(r&&(Ht(i)?c+=i==="L"?-V:V:T+=i==="T"?-V:V+18),p&&(Ht(f)?F+=f==="L"?-V:V:Y+=f==="T"?-V:V+18),!r&&w.getNode(h)?.type==="junction"&&(Ht(i)?c+=i==="L"?o:-o:T+=i==="T"?o:-o),!p&&w.getNode(a)?.type==="junction"&&(Ht(f)?F+=f==="L"?o:-o:Y+=f==="T"?o:-o),e[0]._private.rscratch){const $=L.insert("g");if($.insert("path").attr("d",`M ${c},${T} L ${C},${I} L${F},${Y} `).attr("class","edge").attr("id",`${b}-${xe.getEdgeId(h,a,{prefix:"L"})}`),d){const x=Ht(i)?se[i](c,n):c-t,tt=kt(i)?se[i](T,n):T-t;$.insert("polygon").attr("points",De[i](n)).attr("transform",`translate(${x},${tt})`).attr("class","arrow")}if(l){const x=Ht(f)?se[f](F,n):F-t,tt=kt(f)?se[f](Y,n):Y-t;$.insert("polygon").attr("points",De[f](n)).attr("transform",`translate(${x},${tt})`).attr("class","arrow")}if(g){const x=me(i,f)?"XY":Ht(i)?"X":"Y";let tt=0;x==="X"?tt=Math.abs(c-F):x==="Y"?tt=Math.abs(T-Y)/1.5:tt=Math.abs(c-F)/2;const s=$.append("g");if(await ye.createText(s,g,{useHtmlLabels:!1,width:tt,classes:"architecture-service-label"},Vt.getConfig2()),s.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),x==="X")s.attr("transform","translate("+C+", "+I+")");else if(x==="Y")s.attr("transform","translate("+C+", "+I+") rotate(-90)");else if(x==="XY"){const m=ve(i,f);if(m&&Qe(m)){const u=s.node().getBoundingClientRect(),[E,y]=je(m);s.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*E*y*45})`);const M=s.node().getBoundingClientRect();s.attr("transform",`
translate(${C}, ${I-u.height/2})
translate(${E*M.width/2}, ${y*M.height/2})
rotate(${-1*E*y*45}, 0, ${u.height/2})
`)}}}}}))},"drawEdges"),sr=lt.__name(async function(L,S,w,b){const N=w.getConfigField("padding")*.75,v=w.getConfigField("fontSize"),o=w.getConfigField("iconSize")/2;await Promise.all(S.nodes().map(async n=>{const t=ie(n);if(t.type==="group"){const{h:e,w:h,x1:i,y1:d}=n.boundingBox(),r=L.append("rect");r.attr("id",`${b}-group-${t.id}`).attr("x",i+o).attr("y",d+o).attr("width",h).attr("height",e).attr("class","node-bkg");const a=L.append("g");let f=i,l=d;if(t.icon){const p=a.append("g");p.html(`<g>${await ae.getIconSVG(t.icon,{height:N,width:N,fallbackPrefix:ne.prefix})}</g>`),p.attr("transform","translate("+(f+o+1)+", "+(l+o+1)+")"),f+=N,l+=v/2-1-2}if(t.label){const p=a.append("g");await ye.createText(p,t.label,{useHtmlLabels:!1,width:h,classes:"architecture-service-label"},Vt.getConfig2()),p.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),p.attr("transform","translate("+(f+o+4)+", "+(l+o+2)+")")}w.setElementForId(t.id,r)}}))},"drawGroups"),hr=lt.__name(async function(L,S,w,b){const N=Vt.getConfig2();for(const v of w){const o=S.append("g"),n=L.getConfigField("iconSize");if(v.title){const i=o.append("g");await ye.createText(i,v.title,{useHtmlLabels:!1,width:n*1.5,classes:"architecture-service-label"},N),i.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),i.attr("transform","translate("+n/2+", "+n+")")}const t=o.append("g");if(v.icon)t.html(`<g>${await ae.getIconSVG(v.icon,{height:n,width:n,fallbackPrefix:ne.prefix})}</g>`);else if(v.iconText){t.html(`<g>${await ae.getIconSVG("blank",{height:n,width:n,fallbackPrefix:ne.prefix})}</g>`);const i=t.append("g").append("foreignObject").attr("width",n).attr("height",n).append("div").attr("class","node-icon-text").attr("style",`height: ${n}px;`).append("div").html(Vt.sanitizeText(v.iconText,N)),d=parseInt(window.getComputedStyle(i.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;i.attr("style",`-webkit-line-clamp: ${Math.floor((n-2)/d)};`)}else t.append("path").attr("class","node-bkg").attr("id",`${b}-node-${v.id}`).attr("d",`M0,${n} V5 Q0,0 5,0 H${n-5} Q${n},0 ${n},5 V${n} Z`);o.attr("id",`${b}-service-${v.id}`).attr("class","architecture-service");const{width:e,height:h}=o.node().getBBox();v.width=e,v.height=h,L.setElementForId(v.id,o)}return 0},"drawServices"),lr=lt.__name(function(L,S,w,b){w.forEach(N=>{const v=S.append("g"),o=L.getConfigField("iconSize");v.append("g").append("rect").attr("id",`${b}-node-${N.id}`).attr("fill-opacity","0").attr("width",o).attr("height",o),v.attr("class","architecture-junction");const{width:n,height:t}=v._groups[0][0].getBBox();v.width=n,v.height=t,L.setElementForId(N.id,v)})},"drawJunctions");ae.registerIconPacks([{name:ne.prefix,icons:ne}]);Ie.cytoscape.use(ke.default);function Ge(L,S,w){L.forEach(b=>{S.add({group:"nodes",data:{type:"service",id:b.id,icon:b.icon,label:b.title,parent:b.in,width:w.getConfigField("iconSize"),height:w.getConfigField("iconSize")},classes:"node-service"})})}lt.__name(Ge,"addServices");function Pe(L,S,w){L.forEach(b=>{S.add({group:"nodes",data:{type:"junction",id:b.id,parent:b.in,width:w.getConfigField("iconSize"),height:w.getConfigField("iconSize")},classes:"node-junction"})})}lt.__name(Pe,"addJunctions");function Ue(L,S){S.nodes().map(w=>{const b=ie(w);b.type!=="group"&&(b.x=w.position().x,b.y=w.position().y,L.getElementById(b.id).attr("transform","translate("+(b.x||0)+","+(b.y||0)+")"))})}lt.__name(Ue,"positionNodes");function Ye(L,S){L.forEach(w=>{S.add({group:"nodes",data:{type:"group",id:w.id,icon:w.icon,label:w.title,parent:w.in},classes:"node-group"})})}lt.__name(Ye,"addGroups");function Xe(L,S){L.forEach(w=>{const{lhsId:b,rhsId:N,lhsInto:v,lhsGroup:o,rhsInto:n,lhsDir:t,rhsDir:e,rhsGroup:h,title:i}=w,d=me(w.lhsDir,w.rhsDir)?"segments":"straight",r={id:`${b}-${N}`,label:i,source:b,sourceDir:t,sourceArrow:v,sourceGroup:o,sourceEndpoint:t==="L"?"0 50%":t==="R"?"100% 50%":t==="T"?"50% 0":"50% 100%",target:N,targetDir:e,targetArrow:n,targetGroup:h,targetEndpoint:e==="L"?"0 50%":e==="R"?"100% 50%":e==="T"?"50% 0":"50% 100%"};S.add({group:"edges",data:r,classes:d})})}lt.__name(Xe,"addEdges");function He(L,S,w,b=[]){const N=lt.__name((i,d)=>{const r=new Map;for(const[a,f]of i.entries()){const l=`${a}`;let p=0;const g=[...f.entries()];if(g.length===1){r.set(l,g[0][1]);continue}for(let c=0;c<g.length-1;c++)for(let T=c+1;T<g.length;T++){const[C,I]=g[c],[F,Y]=g[T];if(w.get(Re(C,F))===d)r.set(l,[...r.get(l)??[],...I,...Y]);else if(C==="default"||F==="default")r.set(l,[...r.get(l)??[],...I,...Y]);else{const V=`${l}-${p++}`;r.set(V,I);const $=`${l}-${p++}`;r.set($,Y)}}}return r},"flattenAlignments"),[v,o]=S.map(i=>{const d=new Map,r=new Map;return i.forEach(([a,f],l)=>{const p=L.getNode(l)?.in??"default",g=d.get(f)??new Map;d.has(f)||d.set(f,g);const c=r.get(a)??new Map;r.has(a)||r.set(a,c);for(const T of[g,c]){const C=T.get(p)??[];T.has(p)||T.set(p,C),C.push(l)}}),{horiz:[...N(d,"horizontal").values()].filter(a=>a.length>1),vert:[...N(r,"vertical").values()].filter(a=>a.length>1)}}).reduce(([i,d],{horiz:r,vert:a})=>[[...i,...r],[...d,...a]],[[],[]]),n=new Set;b.forEach(i=>i.members.forEach(d=>n.add(d)));const t=lt.__name(i=>i.filter(d=>!d.some(r=>n.has(r))),"dropOverlapping"),e=t(v),h=t(o);return b.forEach(i=>{i.members.length<2||(i.direction==="row"?e.push([...i.members]):h.push([...i.members]))}),{horizontal:e,vertical:h}}lt.__name(He,"getAlignments");function We(L,S,w=[]){const b=[],N=S.getConfigField("iconSize"),v=S.getConfigField("idealEdgeLengthMultiplier"),o=v*N,n=new Set;w.forEach(h=>{for(let i=0;i<h.members.length-1;i++){const d=h.members[i],r=h.members[i+1];n.add(`${d}|${r}`),n.add(`${r}|${d}`),h.direction==="row"?b.push({left:d,right:r,gap:o}):b.push({top:d,bottom:r,gap:o})}});const t=lt.__name(h=>`${h[0]},${h[1]}`,"posToStr"),e=lt.__name(h=>h.split(",").map(i=>parseInt(i)),"strToPos");return L.forEach(h=>{const i=new Map([...h.entries()].map(([f,l])=>[t(l),f])),d=[t([0,0])],r={},a={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;d.length>0;){const f=d.shift();if(f){r[f]=1;const l=i.get(f);if(l){const p=e(f);Object.entries(a).forEach(([g,c])=>{const T=t([p[0]+c[0],p[1]+c[1]]),C=i.get(T);if(C&&!r[T]){if(d.push(T),n.has(`${l}|${C}`))return;b.push({[Ae[g]]:C,[Ae[Je(g)]]:l,gap:v*N})}})}}}}),b}lt.__name(We,"getRelativeConstraints");function Ve(L,S,w,b,N,{spatialMaps:v,groupAlignments:o}){return new Promise(n=>{const t=de.select_default("body").append("div").attr("id","cy").attr("style","display:none"),e=Ie.cytoscape({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{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":`${N.getConfigField("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:`${N.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});t.remove(),Ye(w,e),Ge(L,e,N),Pe(S,e,N),Xe(b,e);const h=N.getLayoutHints(),i=He(N,v,o,h),d=We(v,N,h),r=N.getConfigField("iconSize"),a=N.getConfigField("idealEdgeLengthMultiplier")*r,f=.5*r,l=N.getConfigField("edgeElasticity"),p=N.getConfigField("seed"),g=e.layout({name:"fcose",quality:"proof",randomize:N.getConfigField("randomize"),nodeSeparation:N.getConfigField("nodeSeparation"),numIter:N.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(c){const[T,C]=c.connectedNodes(),{parent:I}=ie(T),{parent:F}=ie(C);return I===F?a:f},edgeElasticity(c){const[T,C]=c.connectedNodes(),{parent:I}=ie(T),{parent:F}=ie(C);return I===F?l:.001},alignmentConstraint:i,relativePlacementConstraint:d});g.one("layoutstop",()=>{function c(T,C,I,F){let Y,V;const{x:$,y:x}=T,{x:tt,y:s}=C;V=(F-x+($-I)*(x-s)/($-tt))/Math.sqrt(1+Math.pow((x-s)/($-tt),2)),Y=Math.sqrt(Math.pow(F-x,2)+Math.pow(I-$,2)-Math.pow(V,2));const m=Math.sqrt(Math.pow(tt-$,2)+Math.pow(s-x,2));Y=Y/m;let u=(tt-$)*(F-x)-(s-x)*(I-$);switch(!0){case u>=0:u=1;break;case u<0:u=-1}let E=(tt-$)*(I-$)+(s-x)*(F-x);switch(!0){case E>=0:E=1;break;case E<0:E=-1}return V=Math.abs(V)*u,Y=Y*E,{distances:V,weights:Y}}lt.__name(c,"getSegmentWeights"),e.startBatch();for(const T of Object.values(e.edges()))if(T.data?.()){const{x:C,y:I}=T.source().position(),{x:F,y:Y}=T.target().position();if(C!==F&&I!==Y){const V=T.sourceEndpoint(),$=T.targetEndpoint(),{sourceDir:x}=Se(T),[tt,s]=kt(x)?[V.x,$.y]:[$.x,V.y],{weights:m,distances:u}=c(V,$,tt,s);T.style("segment-distances",u),T.style("segment-weights",m)}}e.endBatch(),pe(p,()=>g.run())});try{pe(p,()=>g.run())}catch(c){throw c instanceof RangeError&&c.message.includes("Invalid array length")?new Error("Architecture layout failed: a declared `align row|column` directive likely contradicts the edge directions, or two declared alignments overlap on a shared node. Check that the order of members in each `align` chain is consistent with the edges between them, and that no node appears in two `align` directives along the same axis."):c}e.ready(c=>{de.log.info("Ready",c),n(e)})})}lt.__name(Ve,"layoutArchitecture");var fr={parser:be,get db(){return new Fe},renderer:{draw:lt.__name(async(L,S,w,b)=>{const N=b.db;N.setDiagramId(S);const v=N.getServices(),o=N.getJunctions(),n=N.getGroups(),t=N.getEdges(),e=N.getDataStructures(),h=ze.selectSvgElement(S),i=h.append("g");i.attr("class","architecture-edges");const d=h.append("g");d.attr("class","architecture-services");const r=h.append("g");r.attr("class","architecture-groups"),await hr(N,d,v,S),lr(N,d,o,S);const a=await Ve(v,o,n,t,N,e);await or(i,a,N,S),await sr(r,a,N,S),Ue(N,a),Vt.setupGraphViewbox(void 0,h,N.getConfigField("padding"),N.getConfigField("useMaxWidth"))},"draw")},styles:nr};exports.diagram=fr;