HomeDashboard/.venv/lib/python3.12/site-packages/nicegui/elements/mermaid/dist/architectureDiagram-KNYM2FM5-c302dij-.js
2026-01-03 14:54:18 +01:00

3 lines
144 KiB
JavaScript

import{G as t}from"./chunk-MBJCTAW2-BUTDUcjL.js";import{c as e}from"./chunk-4KE642ED-DMtXVwOD.js";import{s as i}from"./chunk-VSLJSFIP-LusxAA0C.js";import{p as r}from"./treemap-75Q7IDZK-HKTH2UG6-CtK1P-cI.js";import{m as n,K as o,Z as a,j as s,X as h,J as l,Q as d,a6 as c,ap as g,L as u,O as p,u as f,l as y,t as m,au as v,h as E,aF as N,k as T,q as A,a5 as w,aG as _,aH as L}from"./index-Bd_j0xvv.js";import"./chunk-5ZJXQJOJ-BQpwB-Bn.js";var C=w((t,e)=>{n(function(i,r){"object"==typeof t&&"object"==typeof e?e.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof t?t.layoutBase=r():i.layoutBase=r()},"webpackUniversalModuleDefinition")(t,function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return n(i,"__webpack_require__"),i.m=t,i.c=e,i.i=function(t){return t},i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},i.n=function(t){var e=t&&t.__esModule?n(function(){return t.default},"getDefault"):n(function(){return t},"getModuleExports");return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=28)}([function(t,e,i){function r(){}n(r,"LayoutConstants"),r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,t.exports=r},function(t,e,i){var r=i(2),o=i(8),a=i(9);function s(t,e,i){r.call(this,i),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=i,this.bendpoints=[],this.source=t,this.target=e}for(var h in n(s,"LEdge"),s.prototype=Object.create(r.prototype),r)s[h]=r[h];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(t){if(this.source===t)return this.target;if(this.target===t)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(t,e){for(var i=this.getOtherEnd(t),r=e.getGraphManager().getRoot();;){if(i.getOwner()==e)return i;if(i.getOwner()==r)break;i=i.getOwner().getParent()}return null},s.prototype.updateLength=function(){var t=new Array(4);this.isOverlapingSourceAndTarget=o.getIntersection(this.target.getRect(),this.source.getRect(),t),this.isOverlapingSourceAndTarget||(this.lengthX=t[0]-t[2],this.lengthY=t[1]-t[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.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=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=s},function(t,e,i){function r(t){this.vGraphObject=t}n(r,"LGraphObject"),t.exports=r},function(t,e,i){var r=i(2),o=i(10),a=i(13),s=i(0),h=i(16),l=i(5);function d(t,e,i,n){null==i&&null==n&&(n=e),r.call(this,n),null!=t.graphManager&&(t=t.graphManager),this.estimatedSize=o.MIN_VALUE,this.inclusionTreeDepth=o.MAX_VALUE,this.vGraphObject=n,this.edges=[],this.graphManager=t,this.rect=null!=i&&null!=e?new a(e.x,e.y,i.width,i.height):new a}for(var c in n(d,"LNode"),d.prototype=Object.create(r.prototype),r)d[c]=r[c];d.prototype.getEdges=function(){return this.edges},d.prototype.getChild=function(){return this.child},d.prototype.getOwner=function(){return this.owner},d.prototype.getWidth=function(){return this.rect.width},d.prototype.setWidth=function(t){this.rect.width=t},d.prototype.getHeight=function(){return this.rect.height},d.prototype.setHeight=function(t){this.rect.height=t},d.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},d.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},d.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},d.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},d.prototype.getRect=function(){return this.rect},d.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},d.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},d.prototype.setRect=function(t,e){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=e.width,this.rect.height=e.height},d.prototype.setCenter=function(t,e){this.rect.x=t-this.rect.width/2,this.rect.y=e-this.rect.height/2},d.prototype.setLocation=function(t,e){this.rect.x=t,this.rect.y=e},d.prototype.moveBy=function(t,e){this.rect.x+=t,this.rect.y+=e},d.prototype.getEdgeListToNode=function(t){var e=[],i=this;return i.edges.forEach(function(r){if(r.target==t){if(r.source!=i)throw"Incorrect edge source!";e.push(r)}}),e},d.prototype.getEdgesBetween=function(t){var e=[],i=this;return i.edges.forEach(function(r){if(r.source!=i&&r.target!=i)throw"Incorrect edge source and/or target";(r.target==t||r.source==t)&&e.push(r)}),e},d.prototype.getNeighborsList=function(){var t=new Set,e=this;return e.edges.forEach(function(i){if(i.source==e)t.add(i.target);else{if(i.target!=e)throw"Incorrect incidency!";t.add(i.source)}}),t},d.prototype.withChildren=function(){var t=new Set;if(t.add(this),null!=this.child)for(var e=this.child.getNodes(),i=0;i<e.length;i++)e[i].withChildren().forEach(function(e){t.add(e)});return t},d.prototype.getNoOfChildren=function(){var t=0;if(null==this.child)t=1;else for(var e=this.child.getNodes(),i=0;i<e.length;i++)t+=e[i].getNoOfChildren();return 0==t&&(t=1),t},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){return null==this.child?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)},d.prototype.scatter=function(){var t,e,i=-s.INITIAL_WORLD_BOUNDARY,r=s.INITIAL_WORLD_BOUNDARY;t=s.WORLD_CENTER_X+h.nextDouble()*(r-i)+i;var n=-s.INITIAL_WORLD_BOUNDARY,o=s.INITIAL_WORLD_BOUNDARY;e=s.WORLD_CENTER_Y+h.nextDouble()*(o-n)+n,this.rect.x=t,this.rect.y=e},d.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var t=this.getChild();if(t.updateBounds(!0),this.rect.x=t.getLeft(),this.rect.y=t.getTop(),this.setWidth(t.getRight()-t.getLeft()),this.setHeight(t.getBottom()-t.getTop()),s.NODE_DIMENSIONS_INCLUDE_LABELS){var e=t.getRight()-t.getLeft(),i=t.getBottom()-t.getTop();this.labelWidth&&("left"==this.labelPosHorizontal?(this.rect.x-=this.labelWidth,this.setWidth(e+this.labelWidth)):"center"==this.labelPosHorizontal&&this.labelWidth>e?(this.rect.x-=(this.labelWidth-e)/2,this.setWidth(this.labelWidth)):"right"==this.labelPosHorizontal&&this.setWidth(e+this.labelWidth)),this.labelHeight&&("top"==this.labelPosVertical?(this.rect.y-=this.labelHeight,this.setHeight(i+this.labelHeight)):"center"==this.labelPosVertical&&this.labelHeight>i?(this.rect.y-=(this.labelHeight-i)/2,this.setHeight(this.labelHeight)):"bottom"==this.labelPosVertical&&this.setHeight(i+this.labelHeight))}}},d.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},d.prototype.transform=function(t){var e=this.rect.x;e>s.WORLD_BOUNDARY?e=s.WORLD_BOUNDARY:e<-s.WORLD_BOUNDARY&&(e=-s.WORLD_BOUNDARY);var i=this.rect.y;i>s.WORLD_BOUNDARY?i=s.WORLD_BOUNDARY:i<-s.WORLD_BOUNDARY&&(i=-s.WORLD_BOUNDARY);var r=new l(e,i),n=t.inverseTransformPoint(r);this.setLocation(n.x,n.y)},d.prototype.getLeft=function(){return this.rect.x},d.prototype.getRight=function(){return this.rect.x+this.rect.width},d.prototype.getTop=function(){return this.rect.y},d.prototype.getBottom=function(){return this.rect.y+this.rect.height},d.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},t.exports=d},function(t,e,i){var r=i(0);function o(){}for(var a in n(o,"FDLayoutConstants"),r)o[a]=r[a];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=3*o.MAX_NODE_DISPLACEMENT_INCREMENTAL,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,t.exports=o},function(t,e,i){function r(t,e){null==t&&null==e?(this.x=0,this.y=0):(this.x=t,this.y=e)}n(r,"PointD"),r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(t){this.x=t},r.prototype.setY=function(t){this.y=t},r.prototype.getDifference=function(t){return new DimensionD(this.x-t.x,this.y-t.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(t){return this.x+=t.width,this.y+=t.height,this},t.exports=r},function(t,e,i){var r=i(2),o=i(10),a=i(0),s=i(7),h=i(3),l=i(1),d=i(13),c=i(12),g=i(11);function u(t,e,i){r.call(this,i),this.estimatedSize=o.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=t,null!=e&&e instanceof s?this.graphManager=e:null!=e&&e instanceof Layout&&(this.graphManager=e.graphManager)}for(var p in n(u,"LGraph"),u.prototype=Object.create(r.prototype),r)u[p]=r[p];u.prototype.getNodes=function(){return this.nodes},u.prototype.getEdges=function(){return this.edges},u.prototype.getGraphManager=function(){return this.graphManager},u.prototype.getParent=function(){return this.parent},u.prototype.getLeft=function(){return this.left},u.prototype.getRight=function(){return this.right},u.prototype.getTop=function(){return this.top},u.prototype.getBottom=function(){return this.bottom},u.prototype.isConnected=function(){return this.isConnected},u.prototype.add=function(t,e,i){if(null==e&&null==i){var r=t;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(r)>-1)throw"Node already in graph!";return r.owner=this,this.getNodes().push(r),r}var n=t;if(!(this.getNodes().indexOf(e)>-1&&this.getNodes().indexOf(i)>-1))throw"Source or target not in graph!";if(e.owner!=i.owner||e.owner!=this)throw"Both owners must be this graph!";return e.owner!=i.owner?null:(n.source=e,n.target=i,n.isInterGraph=!1,this.getEdges().push(n),e.edges.push(n),i!=e&&i.edges.push(n),n)},u.prototype.remove=function(t){var e=t;if(t instanceof h){if(null==e)throw"Node is null!";if(null==e.owner||e.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var i=e.edges.slice(),r=i.length,n=0;n<r;n++)(o=i[n]).isInterGraph?this.graphManager.remove(o):o.source.owner.remove(o);if(-1==(a=this.nodes.indexOf(e)))throw"Node not in owner node list!";this.nodes.splice(a,1)}else if(t instanceof l){var o;if(null==(o=t))throw"Edge is null!";if(null==o.source||null==o.target)throw"Source and/or target is null!";if(null==o.source.owner||null==o.target.owner||o.source.owner!=this||o.target.owner!=this)throw"Source and/or target owner is invalid!";var a,s=o.source.edges.indexOf(o),d=o.target.edges.indexOf(o);if(!(s>-1&&d>-1))throw"Source and/or target doesn't know this edge!";if(o.source.edges.splice(s,1),o.target!=o.source&&o.target.edges.splice(d,1),-1==(a=o.source.owner.getEdges().indexOf(o)))throw"Not in owner's edge list!";o.source.owner.getEdges().splice(a,1)}},u.prototype.updateLeftTop=function(){for(var t,e,i,r=o.MAX_VALUE,n=o.MAX_VALUE,a=this.getNodes(),s=a.length,h=0;h<s;h++){var l=a[h];r>(t=l.getTop())&&(r=t),n>(e=l.getLeft())&&(n=e)}return r==o.MAX_VALUE?null:(i=null!=a[0].getParent().paddingLeft?a[0].getParent().paddingLeft:this.margin,this.left=n-i,this.top=r-i,new c(this.left,this.top))},u.prototype.updateBounds=function(t){for(var e,i,r,n,a,s=o.MAX_VALUE,h=-o.MAX_VALUE,l=o.MAX_VALUE,c=-o.MAX_VALUE,g=this.nodes,u=g.length,p=0;p<u;p++){var f=g[p];t&&null!=f.child&&f.updateBounds(),s>(e=f.getLeft())&&(s=e),h<(i=f.getRight())&&(h=i),l>(r=f.getTop())&&(l=r),c<(n=f.getBottom())&&(c=n)}var y=new d(s,l,h-s,c-l);s==o.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),a=null!=g[0].getParent().paddingLeft?g[0].getParent().paddingLeft:this.margin,this.left=y.x-a,this.right=y.x+y.width+a,this.top=y.y-a,this.bottom=y.y+y.height+a},u.calculateBounds=function(t){for(var e,i,r,n,a=o.MAX_VALUE,s=-o.MAX_VALUE,h=o.MAX_VALUE,l=-o.MAX_VALUE,c=t.length,g=0;g<c;g++){var u=t[g];a>(e=u.getLeft())&&(a=e),s<(i=u.getRight())&&(s=i),h>(r=u.getTop())&&(h=r),l<(n=u.getBottom())&&(l=n)}return new d(a,h,s-a,l-h)},u.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},u.prototype.getEstimatedSize=function(){if(this.estimatedSize==o.MIN_VALUE)throw"assert failed";return this.estimatedSize},u.prototype.calcEstimatedSize=function(){for(var t=0,e=this.nodes,i=e.length,r=0;r<i;r++){t+=e[r].calcEstimatedSize()}return this.estimatedSize=0==t?a.EMPTY_COMPOUND_NODE_SIZE:t/Math.sqrt(this.nodes.length),this.estimatedSize},u.prototype.updateConnected=function(){var t=this;if(0!=this.nodes.length){var e,i,r=new g,n=new Set,o=this.nodes[0];for(o.withChildren().forEach(function(t){r.push(t),n.add(t)});0!==r.length;)for(var a=(e=(o=r.shift()).getEdges()).length,s=0;s<a;s++){if(null!=(i=e[s].getOtherEndInGraph(o,this))&&!n.has(i))i.withChildren().forEach(function(t){r.push(t),n.add(t)})}if(this.isConnected=!1,n.size>=this.nodes.length){var h=0;n.forEach(function(e){e.owner==t&&h++}),h==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},t.exports=u},function(t,e,i){var r,o=i(1);function a(t){r=i(6),this.layout=t,this.graphs=[],this.edges=[]}n(a,"LGraphManager"),a.prototype.addRoot=function(){var t=this.layout.newGraph(),e=this.layout.newNode(null),i=this.add(t,e);return this.setRootGraph(i),this.rootGraph},a.prototype.add=function(t,e,i,r,n){if(null==i&&null==r&&null==n){if(null==t)throw"Graph is null!";if(null==e)throw"Parent node is null!";if(this.graphs.indexOf(t)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(t),null!=t.parent)throw"Already has a parent!";if(null!=e.child)throw"Already has a child!";return t.parent=e,e.child=t,t}n=i,i=t;var o=(r=e).getOwner(),a=n.getOwner();if(null==o||o.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==a||a.getGraphManager()!=this)throw"Target not in this graph mgr!";if(o==a)return i.isInterGraph=!1,o.add(i,r,n);if(i.isInterGraph=!0,i.source=r,i.target=n,this.edges.indexOf(i)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(i),null==i.source||null==i.target)throw"Edge source and/or target is null!";if(-1!=i.source.edges.indexOf(i)||-1!=i.target.edges.indexOf(i))throw"Edge already in source and/or target incidency list!";return i.source.edges.push(i),i.target.edges.push(i),i},a.prototype.remove=function(t){if(t instanceof r){var e=t;if(e.getGraphManager()!=this)throw"Graph not in this graph mgr";if(e!=this.rootGraph&&(null==e.parent||e.parent.graphManager!=this))throw"Invalid parent node!";for(var i,n=[],a=(n=n.concat(e.getEdges())).length,s=0;s<a;s++)i=n[s],e.remove(i);var h,l=[];a=(l=l.concat(e.getNodes())).length;for(s=0;s<a;s++)h=l[s],e.remove(h);e==this.rootGraph&&this.setRootGraph(null);var d=this.graphs.indexOf(e);this.graphs.splice(d,1),e.parent=null}else if(t instanceof o){if(null==(i=t))throw"Edge is null!";if(!i.isInterGraph)throw"Not an inter-graph edge!";if(null==i.source||null==i.target)throw"Source and/or target is null!";if(-1==i.source.edges.indexOf(i)||-1==i.target.edges.indexOf(i))throw"Source and/or target doesn't know this edge!";d=i.source.edges.indexOf(i);if(i.source.edges.splice(d,1),d=i.target.edges.indexOf(i),i.target.edges.splice(d,1),null==i.source.owner||null==i.source.owner.getGraphManager())throw"Edge owner graph or owner graph manager is null!";if(-1==i.source.owner.getGraphManager().edges.indexOf(i))throw"Not in owner graph manager's edge list!";d=i.source.owner.getGraphManager().edges.indexOf(i);i.source.owner.getGraphManager().edges.splice(d,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(null==this.allNodes){for(var t=[],e=this.getGraphs(),i=e.length,r=0;r<i;r++)t=t.concat(e[r].getNodes());this.allNodes=t}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(null==this.allEdges){for(var t=[],e=this.getGraphs(),i=(e.length,0);i<e.length;i++)t=t.concat(e[i].getEdges());t=t.concat(this.edges),this.allEdges=t}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(t){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=t},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(t){if(t.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=t,null==t.parent&&(t.parent=this.layout.newNode("Root node"))},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(t,e){if(null==t||null==e)throw"assert failed";if(t==e)return!0;for(var i,r=t.getOwner();;){if(null==(i=r.getParent()))break;if(i==e)return!0;if(null==(r=i.getOwner()))break}for(r=e.getOwner();;){if(null==(i=r.getParent()))break;if(i==t)return!0;if(null==(r=i.getOwner()))break}return!1},a.prototype.calcLowestCommonAncestors=function(){for(var t,e,i,r,n,o=this.getAllEdges(),a=o.length,s=0;s<a;s++)if(e=(t=o[s]).source,i=t.target,t.lca=null,t.sourceInLca=e,t.targetInLca=i,e!=i){for(r=e.getOwner();null==t.lca;){for(t.targetInLca=i,n=i.getOwner();null==t.lca;){if(n==r){t.lca=n;break}if(n==this.rootGraph)break;if(null!=t.lca)throw"assert failed";t.targetInLca=n.getParent(),n=t.targetInLca.getOwner()}if(r==this.rootGraph)break;null==t.lca&&(t.sourceInLca=r.getParent(),r=t.sourceInLca.getOwner())}if(null==t.lca)throw"assert failed"}else t.lca=e.getOwner()},a.prototype.calcLowestCommonAncestor=function(t,e){if(t==e)return t.getOwner();for(var i=t.getOwner();;){if(null==i)break;for(var r=e.getOwner();;){if(null==r)break;if(r==i)return r;r=r.getParent().getOwner()}i=i.getParent().getOwner()}return i},a.prototype.calcInclusionTreeDepths=function(t,e){null==t&&null==e&&(t=this.rootGraph,e=1);for(var i,r=t.getNodes(),n=r.length,o=0;o<n;o++)(i=r[o]).inclusionTreeDepth=e,null!=i.child&&this.calcInclusionTreeDepths(i.child,e+1)},a.prototype.includesInvalidEdge=function(){for(var t,e=[],i=this.edges.length,r=0;r<i;r++)t=this.edges[r],this.isOneAncestorOfOther(t.source,t.target)&&e.push(t);for(r=0;r<e.length;r++)this.remove(e[r]);return!1},t.exports=a},function(t,e,i){var r=i(12);function o(){}n(o,"IGeometry"),o.calcSeparationAmount=function(t,e,i,r){if(!t.intersects(e))throw"assert failed";var n=new Array(2);this.decideDirectionsForOverlappingNodes(t,e,n),i[0]=Math.min(t.getRight(),e.getRight())-Math.max(t.x,e.x),i[1]=Math.min(t.getBottom(),e.getBottom())-Math.max(t.y,e.y),t.getX()<=e.getX()&&t.getRight()>=e.getRight()?i[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight()):e.getX()<=t.getX()&&e.getRight()>=t.getRight()&&(i[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight())),t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()?i[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()):e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()&&(i[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()));var o=Math.abs((e.getCenterY()-t.getCenterY())/(e.getCenterX()-t.getCenterX()));e.getCenterY()===t.getCenterY()&&e.getCenterX()===t.getCenterX()&&(o=1);var a=o*i[0],s=i[1]/o;i[0]<s?s=i[0]:a=i[1],i[0]=-1*n[0]*(s/2+r),i[1]=-1*n[1]*(a/2+r)},o.decideDirectionsForOverlappingNodes=function(t,e,i){t.getCenterX()<e.getCenterX()?i[0]=-1:i[0]=1,t.getCenterY()<e.getCenterY()?i[1]=-1:i[1]=1},o.getIntersection2=function(t,e,i){var r=t.getCenterX(),n=t.getCenterY(),o=e.getCenterX(),a=e.getCenterY();if(t.intersects(e))return i[0]=r,i[1]=n,i[2]=o,i[3]=a,!0;var s=t.getX(),h=t.getY(),l=t.getRight(),d=t.getX(),c=t.getBottom(),g=t.getRight(),u=t.getWidthHalf(),p=t.getHeightHalf(),f=e.getX(),y=e.getY(),m=e.getRight(),v=e.getX(),E=e.getBottom(),N=e.getRight(),T=e.getWidthHalf(),A=e.getHeightHalf(),w=!1,_=!1;if(r===o){if(n>a)return i[0]=r,i[1]=h,i[2]=o,i[3]=E,!1;if(n<a)return i[0]=r,i[1]=c,i[2]=o,i[3]=y,!1}else if(n===a){if(r>o)return i[0]=s,i[1]=n,i[2]=m,i[3]=a,!1;if(r<o)return i[0]=l,i[1]=n,i[2]=f,i[3]=a,!1}else{var L=t.height/t.width,C=e.height/e.width,I=(a-n)/(o-r),M=void 0,x=void 0,O=void 0,D=void 0,b=void 0,R=void 0;if(-L===I?r>o?(i[0]=d,i[1]=c,w=!0):(i[0]=l,i[1]=h,w=!0):L===I&&(r>o?(i[0]=s,i[1]=h,w=!0):(i[0]=g,i[1]=c,w=!0)),-C===I?o>r?(i[2]=v,i[3]=E,_=!0):(i[2]=m,i[3]=y,_=!0):C===I&&(o>r?(i[2]=f,i[3]=y,_=!0):(i[2]=N,i[3]=E,_=!0)),w&&_)return!1;if(r>o?n>a?(M=this.getCardinalDirection(L,I,4),x=this.getCardinalDirection(C,I,2)):(M=this.getCardinalDirection(-L,I,3),x=this.getCardinalDirection(-C,I,1)):n>a?(M=this.getCardinalDirection(-L,I,1),x=this.getCardinalDirection(-C,I,3)):(M=this.getCardinalDirection(L,I,2),x=this.getCardinalDirection(C,I,4)),!w)switch(M){case 1:D=h,O=r+-p/I,i[0]=O,i[1]=D;break;case 2:O=g,D=n+u*I,i[0]=O,i[1]=D;break;case 3:D=c,O=r+p/I,i[0]=O,i[1]=D;break;case 4:O=d,D=n+-u*I,i[0]=O,i[1]=D}if(!_)switch(x){case 1:R=y,b=o+-A/I,i[2]=b,i[3]=R;break;case 2:b=N,R=a+T*I,i[2]=b,i[3]=R;break;case 3:R=E,b=o+A/I,i[2]=b,i[3]=R;break;case 4:b=v,R=a+-T*I,i[2]=b,i[3]=R}}return!1},o.getCardinalDirection=function(t,e,i){return t>e?i:1+i%4},o.getIntersection=function(t,e,i,n){if(null==n)return this.getIntersection2(t,e,i);var o,a,s,h,l,d,c,g=t.x,u=t.y,p=e.x,f=e.y,y=i.x,m=i.y,v=n.x,E=n.y;return l=p*u-g*f,d=v*m-y*E,0===(c=(o=f-u)*(h=y-v)-(a=E-m)*(s=g-p))?null:new r((s*d-h*l)/c,(a*l-o*d)/c)},o.angleOfVector=function(t,e,i,r){var n=void 0;return t!==i?(n=Math.atan((r-e)/(i-t)),i<t?n+=Math.PI:r<e&&(n+=this.TWO_PI)):n=r<e?this.ONE_AND_HALF_PI:this.HALF_PI,n},o.doIntersect=function(t,e,i,r){var n=t.x,o=t.y,a=e.x,s=e.y,h=i.x,l=i.y,d=r.x,c=r.y,g=(a-n)*(c-l)-(d-h)*(s-o);if(0===g)return!1;var u=((c-l)*(d-n)+(h-d)*(c-o))/g,p=((o-s)*(d-n)+(a-n)*(c-o))/g;return 0<u&&u<1&&0<p&&p<1},o.findCircleLineIntersections=function(t,e,i,r,n,o,a){var s=(i-t)*(i-t)+(r-e)*(r-e),h=2*((t-n)*(i-t)+(e-o)*(r-e)),l=(t-n)*(t-n)+(e-o)*(e-o)-a*a;if(h*h-4*s*l>=0){var d=(-h+Math.sqrt(h*h-4*s*l))/(2*s),c=(-h-Math.sqrt(h*h-4*s*l))/(2*s);return d>=0&&d<=1?[d]:c>=0&&c<=1?[c]:null}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,t.exports=o},function(t,e,i){function r(){}n(r,"IMath"),r.sign=function(t){return t>0?1:t<0?-1:0},r.floor=function(t){return t<0?Math.ceil(t):Math.floor(t)},r.ceil=function(t){return t<0?Math.floor(t):Math.ceil(t)},t.exports=r},function(t,e,i){function r(){}n(r,"Integer"),r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,t.exports=r},function(t,e,i){var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return n(t,"defineProperties"),function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}();function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n(o,"_classCallCheck");var a=n(function(t){return{value:t,next:null,prev:null}},"nodeFrom"),s=n(function(t,e,i,r){return null!==t?t.next=e:r.head=e,null!==i?i.prev=e:r.tail=e,e.prev=t,e.next=i,r.length++,e},"add"),h=n(function(t,e){var i=t.prev,r=t.next;return null!==i?i.next=r:e.head=r,null!==r?r.prev=i:e.tail=i,t.prev=t.next=null,e.length--,t},"_remove"),l=function(){function t(e){var i=this;o(this,t),this.length=0,this.head=null,this.tail=null,e?.forEach(function(t){return i.push(t)})}return n(t,"LinkedList"),r(t,[{key:"size",value:n(function(){return this.length},"size")},{key:"insertBefore",value:n(function(t,e){return s(e.prev,a(t),e,this)},"insertBefore")},{key:"insertAfter",value:n(function(t,e){return s(e,a(t),e.next,this)},"insertAfter")},{key:"insertNodeBefore",value:n(function(t,e){return s(e.prev,t,e,this)},"insertNodeBefore")},{key:"insertNodeAfter",value:n(function(t,e){return s(e,t,e.next,this)},"insertNodeAfter")},{key:"push",value:n(function(t){return s(this.tail,a(t),null,this)},"push")},{key:"unshift",value:n(function(t){return s(null,a(t),this.head,this)},"unshift")},{key:"remove",value:n(function(t){return h(t,this)},"remove")},{key:"pop",value:n(function(){return h(this.tail,this).value},"pop")},{key:"popNode",value:n(function(){return h(this.tail,this)},"popNode")},{key:"shift",value:n(function(){return h(this.head,this).value},"shift")},{key:"shiftNode",value:n(function(){return h(this.head,this)},"shiftNode")},{key:"get_object_at",value:n(function(t){if(t<=this.length()){for(var e=1,i=this.head;e<t;)i=i.next,e++;return i.value}},"get_object_at")},{key:"set_object_at",value:n(function(t,e){if(t<=this.length()){for(var i=1,r=this.head;i<t;)r=r.next,i++;r.value=e}},"set_object_at")}]),t}();t.exports=l},function(t,e,i){function r(t,e,i){this.x=null,this.y=null,null==t&&null==e&&null==i?(this.x=0,this.y=0):"number"==typeof t&&"number"==typeof e&&null==i?(this.x=t,this.y=e):"Point"==t.constructor.name&&null==e&&null==i&&(i=t,this.x=i.x,this.y=i.y)}n(r,"Point"),r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(t,e,i){"Point"==t.constructor.name&&null==e&&null==i?(i=t,this.setLocation(i.x,i.y)):"number"==typeof t&&"number"==typeof e&&null==i&&(parseInt(t)==t&&parseInt(e)==e?this.move(t,e):(this.x=Math.floor(t+.5),this.y=Math.floor(e+.5)))},r.prototype.move=function(t,e){this.x=t,this.y=e},r.prototype.translate=function(t,e){this.x+=t,this.y+=e},r.prototype.equals=function(t){if("Point"==t.constructor.name){var e=t;return this.x==e.x&&this.y==e.y}return this==t},r.prototype.toString=function(){return(new r).constructor.name+"[x="+this.x+",y="+this.y+"]"},t.exports=r},function(t,e,i){function r(t,e,i,r){this.x=0,this.y=0,this.width=0,this.height=0,null!=t&&null!=e&&null!=i&&null!=r&&(this.x=t,this.y=e,this.width=i,this.height=r)}n(r,"RectangleD"),r.prototype.getX=function(){return this.x},r.prototype.setX=function(t){this.x=t},r.prototype.getY=function(){return this.y},r.prototype.setY=function(t){this.y=t},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(t){this.width=t},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(t){this.height=t},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(t){return!(this.getRight()<t.x||this.getBottom()<t.y||t.getRight()<this.x||t.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},t.exports=r},function(t,e,i){var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function o(){}n(o,"UniqueIDGeneretor"),o.lastID=0,o.createID=function(t){return o.isPrimitive(t)?t:(null!=t.uniqueID||(t.uniqueID=o.getString(),o.lastID++),t.uniqueID)},o.getString=function(t){return null==t&&(t=o.lastID),"Object#"+t},o.isPrimitive=function(t){var e=typeof t>"u"?"undefined":r(t);return null==t||"object"!=e&&"function"!=e},t.exports=o},function(t,e,i){function r(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}n(r,"_toConsumableArray");var o=i(0),a=i(7),s=i(3),h=i(1),l=i(6),d=i(5),c=i(17),g=i(29);function u(t){g.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 a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=t&&(this.isRemoteUse=t)}n(u,"Layout"),u.RANDOM_SEED=1,u.prototype=Object.create(g.prototype),u.prototype.getGraphManager=function(){return this.graphManager},u.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},u.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},u.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},u.prototype.newGraphManager=function(){var t=new a(this);return this.graphManager=t,t},u.prototype.newGraph=function(t){return new l(null,this.graphManager,t)},u.prototype.newNode=function(t){return new s(this.graphManager,t)},u.prototype.newEdge=function(t){return new h(null,null,t)},u.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},u.prototype.runLayout=function(){var t;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),t=!this.checkLayoutSuccess()&&this.layout(),"during"!==o.ANIMATE&&(t&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,t)},u.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},u.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var t=this.graphManager.getAllEdges(),e=0;e<t.length;e++)t[e];var i=this.graphManager.getRoot().getNodes();for(e=0;e<i.length;e++)i[e];this.update(this.graphManager.getRoot())}},u.prototype.update=function(t){if(null==t)this.update2();else if(t instanceof s){var e=t;if(null!=e.getChild())for(var i=e.getChild().getNodes(),r=0;r<i.length;r++)update(i[r]);if(null!=e.vGraphObject)e.vGraphObject.update(e)}else if(t instanceof h){var n=t;if(null!=n.vGraphObject)n.vGraphObject.update(n)}else if(t instanceof l){var o=t;if(null!=o.vGraphObject)o.vGraphObject.update(o)}},u.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)},u.prototype.transform=function(t){if(null==t)this.transform(new d(0,0));else{var e=new c,i=this.graphManager.getRoot().updateLeftTop();if(null!=i){e.setWorldOrgX(t.x),e.setWorldOrgY(t.y),e.setDeviceOrgX(i.x),e.setDeviceOrgY(i.y);for(var r=this.getAllNodes(),n=0;n<r.length;n++)r[n].transform(e)}}},u.prototype.positionNodesRandomly=function(t){if(null==t)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var e,i,r=t.getNodes(),n=0;n<r.length;n++)null==(i=(e=r[n]).getChild())||0==i.getNodes().length?e.scatter():(this.positionNodesRandomly(i),e.updateBounds())},u.prototype.getFlatForest=function(){for(var t=[],e=!0,i=this.graphManager.getRoot().getNodes(),n=!0,o=0;o<i.length;o++)null!=i[o].getChild()&&(n=!1);if(!n)return t;var a=new Set,s=[],h=new Map,l=[];for(l=l.concat(i);l.length>0&&e;){for(s.push(l[0]);s.length>0&&e;){var d=s[0];s.splice(0,1),a.add(d);var c=d.getEdges();for(o=0;o<c.length;o++){var g=c[o].getOtherEnd(d);if(h.get(d)!=g){if(a.has(g)){e=!1;break}s.push(g),h.set(g,d)}}}if(e){var u=[].concat(r(a));t.push(u);for(o=0;o<u.length;o++){var p=u[o],f=l.indexOf(p);f>-1&&l.splice(f,1)}a=new Set,h=new Map}else t=[]}return t},u.prototype.createDummyNodesForBendpoints=function(t){for(var e=[],i=t.source,r=this.graphManager.calcLowestCommonAncestor(t.source,t.target),n=0;n<t.bendpoints.length;n++){var o=this.newNode(null);o.setRect(new Point(0,0),new Dimension(1,1)),r.add(o);var a=this.newEdge(null);this.graphManager.add(a,i,o),e.add(o),i=o}a=this.newEdge(null);return this.graphManager.add(a,i,t.target),this.edgeToDummyNodes.set(t,e),t.isInterGraph()?this.graphManager.remove(t):r.remove(t),e},u.prototype.createBendpointsFromDummyNodes=function(){var t=[];t=t.concat(this.graphManager.getAllEdges()),t=[].concat(r(this.edgeToDummyNodes.keys())).concat(t);for(var e=0;e<t.length;e++){var i=t[e];if(i.bendpoints.length>0){for(var n=this.edgeToDummyNodes.get(i),o=0;o<n.length;o++){var a=n[o],s=new d(a.getCenterX(),a.getCenterY()),h=i.bendpoints.get(o);h.x=s.x,h.y=s.y,a.getOwner().remove(a)}this.graphManager.add(i,i.source,i.target)}}},u.transform=function(t,e,i,r){if(null!=i&&null!=r){var n=e;if(t<=50)n-=(e-e/i)/50*(50-t);else n+=(e*r-e)/50*(t-50);return n}var o,a;return t<=50?(o=9*e/500,a=e/10):(o=9*e/50,a=-8*e),o*t+a},u.findCenterOfTree=function(t){var e=[];e=e.concat(t);var i=[],r=new Map,n=!1,o=null;(1==e.length||2==e.length)&&(n=!0,o=e[0]);for(var a=0;a<e.length;a++){var s=(d=e[a]).getNeighborsList().size;r.set(d,d.getNeighborsList().size),1==s&&i.push(d)}var h=[];for(h=h.concat(i);!n;){var l=[];l=l.concat(h),h=[];for(a=0;a<e.length;a++){var d=e[a],c=e.indexOf(d);c>=0&&e.splice(c,1),d.getNeighborsList().forEach(function(t){if(i.indexOf(t)<0){var e=r.get(t)-1;1==e&&h.push(t),r.set(t,e)}})}i=i.concat(h),(1==e.length||2==e.length)&&(n=!0,o=e[0])}return o},u.prototype.setGraphManager=function(t){this.graphManager=t},t.exports=u},function(t,e,i){function r(){}n(r,"RandomSeed"),r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},t.exports=r},function(t,e,i){var r=i(5);function o(t,e){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}n(o,"Transform"),o.prototype.getWorldOrgX=function(){return this.lworldOrgX},o.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},o.prototype.getWorldOrgY=function(){return this.lworldOrgY},o.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},o.prototype.getWorldExtX=function(){return this.lworldExtX},o.prototype.setWorldExtX=function(t){this.lworldExtX=t},o.prototype.getWorldExtY=function(){return this.lworldExtY},o.prototype.setWorldExtY=function(t){this.lworldExtY=t},o.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},o.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},o.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},o.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},o.prototype.getDeviceExtX=function(){return this.ldeviceExtX},o.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},o.prototype.getDeviceExtY=function(){return this.ldeviceExtY},o.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},o.prototype.transformX=function(t){var e=0,i=this.lworldExtX;return 0!=i&&(e=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/i),e},o.prototype.transformY=function(t){var e=0,i=this.lworldExtY;return 0!=i&&(e=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/i),e},o.prototype.inverseTransformX=function(t){var e=0,i=this.ldeviceExtX;return 0!=i&&(e=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/i),e},o.prototype.inverseTransformY=function(t){var e=0,i=this.ldeviceExtY;return 0!=i&&(e=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/i),e},o.prototype.inverseTransformPoint=function(t){return new r(this.inverseTransformX(t.x),this.inverseTransformY(t.y))},t.exports=o},function(t,e,i){function r(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}n(r,"_toConsumableArray");var o=i(15),a=i(4),s=i(0),h=i(8),l=i(9);function d(){o.call(this),this.useSmartIdealEdgeLengthCalculation=a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=a.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=a.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=a.MAX_ITERATIONS}for(var c in n(d,"FDLayout"),d.prototype=Object.create(o.prototype),o)d[c]=o[c];d.prototype.initParameters=function(){o.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},d.prototype.calcIdealEdgeLengths=function(){for(var t,e,i,r,n,o,h,l=this.getGraphManager().getAllEdges(),d=0;d<l.length;d++)e=(t=l[d]).idealLength,t.isInterGraph&&(r=t.getSource(),n=t.getTarget(),o=t.getSourceInLca().getEstimatedSize(),h=t.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(t.idealLength+=o+h-2*s.SIMPLE_NODE_SIZE),i=t.getLca().getInclusionTreeDepth(),t.idealLength+=e*a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(r.getInclusionTreeDepth()+n.getInclusionTreeDepth()-2*i))},d.prototype.initSpringEmbedder=function(){var t=this.getAllNodes().length;this.incremental?(t>a.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(t-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},d.prototype.calcSpringForces=function(){for(var t,e=this.getAllEdges(),i=0;i<e.length;i++)t=e[i],this.calcSpringForce(t,t.idealLength)},d.prototype.calcRepulsionForces=function(){var t,e,i,r,n,o=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],h=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),n=new Set,t=0;t<h.length;t++)i=h[t],this.calculateRepulsionForceOfANode(i,n,o,s),n.add(i);else for(t=0;t<h.length;t++)for(i=h[t],e=t+1;e<h.length;e++)r=h[e],i.getOwner()==r.getOwner()&&this.calcRepulsionForce(i,r)},d.prototype.calcGravitationalForces=function(){for(var t,e=this.getAllNodesToApplyGravitation(),i=0;i<e.length;i++)t=e[i],this.calcGravitationalForce(t)},d.prototype.moveNodes=function(){for(var t=this.getAllNodes(),e=0;e<t.length;e++)t[e].move()},d.prototype.calcSpringForce=function(t,e){var i,r,n,o,a=t.getSource(),s=t.getTarget();if(this.uniformLeafNodeSizes&&null==a.getChild()&&null==s.getChild())t.updateLengthSimple();else if(t.updateLength(),t.isOverlapingSourceAndTarget)return;0!=(i=t.getLength())&&(n=(r=t.edgeElasticity*(i-e))*(t.lengthX/i),o=r*(t.lengthY/i),a.springForceX+=n,a.springForceY+=o,s.springForceX-=n,s.springForceY-=o)},d.prototype.calcRepulsionForce=function(t,e){var i,r,n,o,s,d,c,g=t.getRect(),u=e.getRect(),p=new Array(2),f=new Array(4);if(g.intersects(u)){h.calcSeparationAmount(g,u,p,a.DEFAULT_EDGE_LENGTH/2),d=2*p[0],c=2*p[1];var y=t.noOfChildren*e.noOfChildren/(t.noOfChildren+e.noOfChildren);t.repulsionForceX-=y*d,t.repulsionForceY-=y*c,e.repulsionForceX+=y*d,e.repulsionForceY+=y*c}else this.uniformLeafNodeSizes&&null==t.getChild()&&null==e.getChild()?(i=u.getCenterX()-g.getCenterX(),r=u.getCenterY()-g.getCenterY()):(h.getIntersection(g,u,f),i=f[2]-f[0],r=f[3]-f[1]),Math.abs(i)<a.MIN_REPULSION_DIST&&(i=l.sign(i)*a.MIN_REPULSION_DIST),Math.abs(r)<a.MIN_REPULSION_DIST&&(r=l.sign(r)*a.MIN_REPULSION_DIST),n=i*i+r*r,o=Math.sqrt(n),d=(s=(t.nodeRepulsion/2+e.nodeRepulsion/2)*t.noOfChildren*e.noOfChildren/n)*i/o,c=s*r/o,t.repulsionForceX-=d,t.repulsionForceY-=c,e.repulsionForceX+=d,e.repulsionForceY+=c},d.prototype.calcGravitationalForce=function(t){var e,i,r,n,o,a,s,h;i=((e=t.getOwner()).getRight()+e.getLeft())/2,r=(e.getTop()+e.getBottom())/2,n=t.getCenterX()-i,o=t.getCenterY()-r,a=Math.abs(n)+t.getWidth()/2,s=Math.abs(o)+t.getHeight()/2,t.getOwner()==this.graphManager.getRoot()?(a>(h=e.getEstimatedSize()*this.gravityRangeFactor)||s>h)&&(t.gravitationForceX=-this.gravityConstant*n,t.gravitationForceY=-this.gravityConstant*o):(a>(h=e.getEstimatedSize()*this.compoundGravityRangeFactor)||s>h)&&(t.gravitationForceX=-this.gravityConstant*n*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*o*this.compoundGravityConstant)},d.prototype.isConverged=function(){var t,e=!1;return this.totalIterations>this.maxIterations/3&&(e=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,t||e},d.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},d.prototype.calcNoOfChildrenForAllNodes=function(){for(var t,e=this.graphManager.getAllNodes(),i=0;i<e.length;i++)(t=e[i]).noOfChildren=t.getNoOfChildren()},d.prototype.calcGrid=function(t){var e,i;e=parseInt(Math.ceil((t.getRight()-t.getLeft())/this.repulsionRange)),i=parseInt(Math.ceil((t.getBottom()-t.getTop())/this.repulsionRange));for(var r=new Array(e),n=0;n<e;n++)r[n]=new Array(i);for(n=0;n<e;n++)for(var o=0;o<i;o++)r[n][o]=new Array;return r},d.prototype.addNodeToGrid=function(t,e,i){var r,n,o,a;r=parseInt(Math.floor((t.getRect().x-e)/this.repulsionRange)),n=parseInt(Math.floor((t.getRect().width+t.getRect().x-e)/this.repulsionRange)),o=parseInt(Math.floor((t.getRect().y-i)/this.repulsionRange)),a=parseInt(Math.floor((t.getRect().height+t.getRect().y-i)/this.repulsionRange));for(var s=r;s<=n;s++)for(var h=o;h<=a;h++)this.grid[s][h].push(t),t.setGridCoordinates(r,n,o,a)},d.prototype.updateGrid=function(){var t,e,i=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),t=0;t<i.length;t++)e=i[t],this.addNodeToGrid(e,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},d.prototype.calculateRepulsionForceOfANode=function(t,e,i,n){if(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&i||n){var o=new Set;t.surrounding=new Array;for(var s,h=this.grid,l=t.startX-1;l<t.finishX+2;l++)for(var d=t.startY-1;d<t.finishY+2;d++)if(!(l<0||d<0||l>=h.length||d>=h[0].length))for(var c=0;c<h[l][d].length;c++)if(s=h[l][d][c],t.getOwner()==s.getOwner()&&t!=s&&!e.has(s)&&!o.has(s)){var g=Math.abs(t.getCenterX()-s.getCenterX())-(t.getWidth()/2+s.getWidth()/2),u=Math.abs(t.getCenterY()-s.getCenterY())-(t.getHeight()/2+s.getHeight()/2);g<=this.repulsionRange&&u<=this.repulsionRange&&o.add(s)}t.surrounding=[].concat(r(o))}for(l=0;l<t.surrounding.length;l++)this.calcRepulsionForce(t,t.surrounding[l])},d.prototype.calcRepulsionRange=function(){return 0},t.exports=d},function(t,e,i){var r=i(1),o=i(4);function a(t,e,i){r.call(this,t,e,i),this.idealLength=o.DEFAULT_EDGE_LENGTH,this.edgeElasticity=o.DEFAULT_SPRING_STRENGTH}for(var s in n(a,"FDLayoutEdge"),a.prototype=Object.create(r.prototype),r)a[s]=r[s];t.exports=a},function(t,e,i){var r=i(3),o=i(4);function a(t,e,i,n){r.call(this,t,e,i,n),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=[]}for(var s in n(a,"FDLayoutNode"),a.prototype=Object.create(r.prototype),r)a[s]=r[s];a.prototype.setGridCoordinates=function(t,e,i,r){this.startX=t,this.finishX=e,this.startY=i,this.finishY=r},t.exports=a},function(t,e,i){function r(t,e){this.width=0,this.height=0,null!==t&&null!==e&&(this.height=e,this.width=t)}n(r,"DimensionD"),r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(t){this.width=t},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(t){this.height=t},t.exports=r},function(t,e,i){var r=i(14);function o(){this.map={},this.keys=[]}n(o,"HashMap"),o.prototype.put=function(t,e){var i=r.createID(t);this.contains(i)||(this.map[i]=e,this.keys.push(t))},o.prototype.contains=function(t){return r.createID(t),null!=this.map[t]},o.prototype.get=function(t){var e=r.createID(t);return this.map[e]},o.prototype.keySet=function(){return this.keys},t.exports=o},function(t,e,i){var r=i(14);function o(){this.set={}}n(o,"HashSet"),o.prototype.add=function(t){var e=r.createID(t);this.contains(e)||(this.set[e]=t)},o.prototype.remove=function(t){delete this.set[r.createID(t)]},o.prototype.clear=function(){this.set={}},o.prototype.contains=function(t){return this.set[r.createID(t)]==t},o.prototype.isEmpty=function(){return 0===this.size()},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAllTo=function(t){for(var e=Object.keys(this.set),i=e.length,r=0;r<i;r++)t.push(this.set[e[r]])},o.prototype.size=function(){return Object.keys(this.set).length},o.prototype.addAll=function(t){for(var e=t.length,i=0;i<e;i++){var r=t[i];this.add(r)}},t.exports=o},function(t,e,i){function r(){}n(r,"Matrix"),r.multMat=function(t,e){for(var i=[],r=0;r<t.length;r++){i[r]=[];for(var n=0;n<e[0].length;n++){i[r][n]=0;for(var o=0;o<t[0].length;o++)i[r][n]+=t[r][o]*e[o][n]}}return i},r.transpose=function(t){for(var e=[],i=0;i<t[0].length;i++){e[i]=[];for(var r=0;r<t.length;r++)e[i][r]=t[r][i]}return e},r.multCons=function(t,e){for(var i=[],r=0;r<t.length;r++)i[r]=t[r]*e;return i},r.minusOp=function(t,e){for(var i=[],r=0;r<t.length;r++)i[r]=t[r]-e[r];return i},r.dotProduct=function(t,e){for(var i=0,r=0;r<t.length;r++)i+=t[r]*e[r];return i},r.mag=function(t){return Math.sqrt(this.dotProduct(t,t))},r.normalize=function(t){for(var e=[],i=this.mag(t),r=0;r<t.length;r++)e[r]=t[r]/i;return e},r.multGamma=function(t){for(var e=[],i=0,r=0;r<t.length;r++)i+=t[r];i*=-1/t.length;for(var n=0;n<t.length;n++)e[n]=i+t[n];return e},r.multL=function(t,e,i){for(var r=[],n=[],o=[],a=0;a<e[0].length;a++){for(var s=0,h=0;h<e.length;h++)s+=-.5*e[h][a]*t[h];n[a]=s}for(var l=0;l<i.length;l++){for(var d=0,c=0;c<i.length;c++)d+=i[l][c]*n[c];o[l]=d}for(var g=0;g<e.length;g++){for(var u=0,p=0;p<e[0].length;p++)u+=e[g][p]*o[p];r[g]=u}return r},t.exports=r},function(t,e,i){var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return n(t,"defineProperties"),function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}();function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n(o,"_classCallCheck");var a=i(11),s=function(){function t(e,i){o(this,t),(null!==i||void 0!==i)&&(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=e instanceof a?e.size():e.length,this._quicksort(e,0,r-1)}return n(t,"Quicksort"),r(t,[{key:"_quicksort",value:n(function(t,e,i){if(e<i){var r=this._partition(t,e,i);this._quicksort(t,e,r),this._quicksort(t,r+1,i)}},"_quicksort")},{key:"_partition",value:n(function(t,e,i){for(var r=this._get(t,e),n=e,o=i;;){for(;this.compareFunction(r,this._get(t,o));)o--;for(;this.compareFunction(this._get(t,n),r);)n++;if(!(n<o))return o;this._swap(t,n,o),n++,o--}},"_partition")},{key:"_get",value:n(function(t,e){return t instanceof a?t.get_object_at(e):t[e]},"_get")},{key:"_set",value:n(function(t,e,i){t instanceof a?t.set_object_at(e,i):t[e]=i},"_set")},{key:"_swap",value:n(function(t,e,i){var r=this._get(t,e);this._set(t,e,this._get(t,i)),this._set(t,i,r)},"_swap")},{key:"_defaultCompareFunction",value:n(function(t,e){return e>t},"_defaultCompareFunction")}]),t}();t.exports=s},function(t,e,i){function r(){}n(r,"SVD"),r.svd=function(t){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=t.length,this.n=t[0].length;var e=Math.min(this.m,this.n);this.s=function(t){for(var e=[];t-- >0;)e.push(0);return e}(Math.min(this.m+1,this.n)),this.U=function(t){return n(function t(e){if(0==e.length)return 0;for(var i=[],r=0;r<e[0];r++)i.push(t(e.slice(1)));return i},"allocate")(t)}([this.m,e]),this.V=function(t){return n(function t(e){if(0==e.length)return 0;for(var i=[],r=0;r<e[0];r++)i.push(t(e.slice(1)));return i},"allocate")(t)}([this.n,this.n]);for(var i=function(t){for(var e=[];t-- >0;)e.push(0);return e}(this.n),o=function(t){for(var e=[];t-- >0;)e.push(0);return e}(this.m),a=!0,s=Math.min(this.m-1,this.n),h=Math.max(0,Math.min(this.n-2,this.m)),l=0;l<Math.max(s,h);l++){if(l<s){this.s[l]=0;for(var d=l;d<this.m;d++)this.s[l]=r.hypot(this.s[l],t[d][l]);if(0!==this.s[l]){t[l][l]<0&&(this.s[l]=-this.s[l]);for(var c=l;c<this.m;c++)t[c][l]/=this.s[l];t[l][l]+=1}this.s[l]=-this.s[l]}for(var g=l+1;g<this.n;g++){if(function(t,e){return t&&e}(l<s,0!==this.s[l])){for(var u=0,p=l;p<this.m;p++)u+=t[p][l]*t[p][g];u=-u/t[l][l];for(var f=l;f<this.m;f++)t[f][g]+=u*t[f][l]}i[g]=t[l][g]}if(function(t,e){return e}(0,l<s))for(var y=l;y<this.m;y++)this.U[y][l]=t[y][l];if(l<h){i[l]=0;for(var m=l+1;m<this.n;m++)i[l]=r.hypot(i[l],i[m]);if(0!==i[l]){i[l+1]<0&&(i[l]=-i[l]);for(var v=l+1;v<this.n;v++)i[v]/=i[l];i[l+1]+=1}if(i[l]=-i[l],function(t,e){return t&&e}(l+1<this.m,0!==i[l])){for(var E=l+1;E<this.m;E++)o[E]=0;for(var N=l+1;N<this.n;N++)for(var T=l+1;T<this.m;T++)o[T]+=i[N]*t[T][N];for(var A=l+1;A<this.n;A++)for(var w=-i[A]/i[l+1],_=l+1;_<this.m;_++)t[_][A]+=w*o[_]}for(var L=l+1;L<this.n;L++)this.V[L][l]=i[L]}}var C=Math.min(this.n,this.m+1);s<this.n&&(this.s[s]=t[s][s]),this.m<C&&(this.s[C-1]=0),h+1<C&&(i[h]=t[h][C-1]),i[C-1]=0;for(var I=s;I<e;I++){for(var M=0;M<this.m;M++)this.U[M][I]=0;this.U[I][I]=1}for(var x=s-1;x>=0;x--)if(0!==this.s[x]){for(var O=x+1;O<e;O++){for(var D=0,b=x;b<this.m;b++)D+=this.U[b][x]*this.U[b][O];D=-D/this.U[x][x];for(var R=x;R<this.m;R++)this.U[R][O]+=D*this.U[R][x]}for(var G=x;G<this.m;G++)this.U[G][x]=-this.U[G][x];this.U[x][x]=1+this.U[x][x];for(var F=0;F<x-1;F++)this.U[F][x]=0}else{for(var S=0;S<this.m;S++)this.U[S][x]=0;this.U[x][x]=1}for(var P=this.n-1;P>=0;P--){if(function(t,e){return t&&e}(P<h,0!==i[P]))for(var U=P+1;U<e;U++){for(var k=0,Y=P+1;Y<this.n;Y++)k+=this.V[Y][P]*this.V[Y][U];k=-k/this.V[P+1][P];for(var H=P+1;H<this.n;H++)this.V[H][U]+=k*this.V[H][P]}for(var X=0;X<this.n;X++)this.V[X][P]=0;this.V[P][P]=1}for(var z=C-1,B=Math.pow(2,-52),V=Math.pow(2,-966);C>0;){var W=void 0,j=void 0;for(W=C-2;W>=-1&&-1!==W;W--)if(Math.abs(i[W])<=V+B*(Math.abs(this.s[W])+Math.abs(this.s[W+1]))){i[W]=0;break}if(W===C-2)j=4;else{var q=void 0;for(q=C-1;q>=W&&q!==W;q--){var $=(q!==C?Math.abs(i[q]):0)+(q!==W+1?Math.abs(i[q-1]):0);if(Math.abs(this.s[q])<=V+B*$){this.s[q]=0;break}}q===W?j=3:q===C-1?j=1:(j=2,W=q)}switch(W++,j){case 1:var Z=i[C-2];i[C-2]=0;for(var J=C-2;J>=W;J--){var Q=r.hypot(this.s[J],Z),K=this.s[J]/Q,tt=Z/Q;this.s[J]=Q,J!==W&&(Z=-tt*i[J-1],i[J-1]=K*i[J-1]);for(var et=0;et<this.n;et++)Q=K*this.V[et][J]+tt*this.V[et][C-1],this.V[et][C-1]=-tt*this.V[et][J]+K*this.V[et][C-1],this.V[et][J]=Q}break;case 2:var it=i[W-1];i[W-1]=0;for(var rt=W;rt<C;rt++){var nt=r.hypot(this.s[rt],it),ot=this.s[rt]/nt,at=it/nt;this.s[rt]=nt,it=-at*i[rt],i[rt]=ot*i[rt];for(var st=0;st<this.m;st++)nt=ot*this.U[st][rt]+at*this.U[st][W-1],this.U[st][W-1]=-at*this.U[st][rt]+ot*this.U[st][W-1],this.U[st][rt]=nt}break;case 3:var ht=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[C-1]),Math.abs(this.s[C-2])),Math.abs(i[C-2])),Math.abs(this.s[W])),Math.abs(i[W])),lt=this.s[C-1]/ht,dt=this.s[C-2]/ht,ct=i[C-2]/ht,gt=this.s[W]/ht,ut=i[W]/ht,pt=((dt+lt)*(dt-lt)+ct*ct)/2,ft=lt*ct*(lt*ct),yt=0;(function(t,e){return t||e})(0!==pt,0!==ft)&&(yt=Math.sqrt(pt*pt+ft),pt<0&&(yt=-yt),yt=ft/(pt+yt));for(var mt=(gt+lt)*(gt-lt)+yt,vt=gt*ut,Et=W;Et<C-1;Et++){var Nt=r.hypot(mt,vt),Tt=mt/Nt,At=vt/Nt;Et!==W&&(i[Et-1]=Nt),mt=Tt*this.s[Et]+At*i[Et],i[Et]=Tt*i[Et]-At*this.s[Et],vt=At*this.s[Et+1],this.s[Et+1]=Tt*this.s[Et+1];for(var wt=0;wt<this.n;wt++)Nt=Tt*this.V[wt][Et]+At*this.V[wt][Et+1],this.V[wt][Et+1]=-At*this.V[wt][Et]+Tt*this.V[wt][Et+1],this.V[wt][Et]=Nt;if(Tt=mt/(Nt=r.hypot(mt,vt)),At=vt/Nt,this.s[Et]=Nt,mt=Tt*i[Et]+At*this.s[Et+1],this.s[Et+1]=-At*i[Et]+Tt*this.s[Et+1],vt=At*i[Et+1],i[Et+1]=Tt*i[Et+1],Et<this.m-1)for(var _t=0;_t<this.m;_t++)Nt=Tt*this.U[_t][Et]+At*this.U[_t][Et+1],this.U[_t][Et+1]=-At*this.U[_t][Et]+Tt*this.U[_t][Et+1],this.U[_t][Et]=Nt}i[C-2]=mt;break;case 4:if(this.s[W]<=0&&(this.s[W]=this.s[W]<0?-this.s[W]:0,a))for(var Lt=0;Lt<=z;Lt++)this.V[Lt][W]=-this.V[Lt][W];for(;W<z&&!(this.s[W]>=this.s[W+1]);){var Ct=this.s[W];if(this.s[W]=this.s[W+1],this.s[W+1]=Ct,W<this.n-1)for(var It=0;It<this.n;It++)Ct=this.V[It][W+1],this.V[It][W+1]=this.V[It][W],this.V[It][W]=Ct;if(W<this.m-1)for(var Mt=0;Mt<this.m;Mt++)Ct=this.U[Mt][W+1],this.U[Mt][W+1]=this.U[Mt][W],this.U[Mt][W]=Ct;W++}C--}}return{U:this.U,V:this.V,S:this.s}},r.hypot=function(t,e){var i=void 0;return Math.abs(t)>Math.abs(e)?(i=e/t,i=Math.abs(t)*Math.sqrt(1+i*i)):0!=e?(i=t/e,i=Math.abs(e)*Math.sqrt(1+i*i)):i=0,i},t.exports=r},function(t,e,i){var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return n(t,"defineProperties"),function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}();function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n(o,"_classCallCheck");var a=function(){function t(e,i){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;o(this,t),this.sequence1=e,this.sequence2=i,this.match_score=r,this.mismatch_penalty=n,this.gap_penalty=a,this.iMax=e.length+1,this.jMax=i.length+1,this.grid=new Array(this.iMax);for(var s=0;s<this.iMax;s++){this.grid[s]=new Array(this.jMax);for(var h=0;h<this.jMax;h++)this.grid[s][h]=0}this.tracebackGrid=new Array(this.iMax);for(var l=0;l<this.iMax;l++){this.tracebackGrid[l]=new Array(this.jMax);for(var d=0;d<this.jMax;d++)this.tracebackGrid[l][d]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return n(t,"NeedlemanWunsch"),r(t,[{key:"getScore",value:n(function(){return this.score},"getScore")},{key:"getAlignments",value:n(function(){return this.alignments},"getAlignments")},{key:"computeGrids",value:n(function(){for(var t=1;t<this.jMax;t++)this.grid[0][t]=this.grid[0][t-1]+this.gap_penalty,this.tracebackGrid[0][t]=[!1,!1,!0];for(var e=1;e<this.iMax;e++)this.grid[e][0]=this.grid[e-1][0]+this.gap_penalty,this.tracebackGrid[e][0]=[!1,!0,!1];for(var i=1;i<this.iMax;i++)for(var r=1;r<this.jMax;r++){var n=[this.sequence1[i-1]===this.sequence2[r-1]?this.grid[i-1][r-1]+this.match_score:this.grid[i-1][r-1]+this.mismatch_penalty,this.grid[i-1][r]+this.gap_penalty,this.grid[i][r-1]+this.gap_penalty],o=this.arrayAllMaxIndexes(n);this.grid[i][r]=n[o[0]],this.tracebackGrid[i][r]=[o.includes(0),o.includes(1),o.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]},"computeGrids")},{key:"alignmentTraceback",value:n(function(){var t=[];for(t.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});t[0];){var e=t[0],i=this.tracebackGrid[e.pos[0]][e.pos[1]];i[0]&&t.push({pos:[e.pos[0]-1,e.pos[1]-1],seq1:this.sequence1[e.pos[0]-1]+e.seq1,seq2:this.sequence2[e.pos[1]-1]+e.seq2}),i[1]&&t.push({pos:[e.pos[0]-1,e.pos[1]],seq1:this.sequence1[e.pos[0]-1]+e.seq1,seq2:"-"+e.seq2}),i[2]&&t.push({pos:[e.pos[0],e.pos[1]-1],seq1:"-"+e.seq1,seq2:this.sequence2[e.pos[1]-1]+e.seq2}),0===e.pos[0]&&0===e.pos[1]&&this.alignments.push({sequence1:e.seq1,sequence2:e.seq2}),t.shift()}return this.alignments},"alignmentTraceback")},{key:"getAllIndexes",value:n(function(t,e){for(var i=[],r=-1;-1!==(r=t.indexOf(e,r+1));)i.push(r);return i},"getAllIndexes")},{key:"arrayAllMaxIndexes",value:n(function(t){return this.getAllIndexes(t,Math.max.apply(null,t))},"arrayAllMaxIndexes")}]),t}();t.exports=a},function(t,e,i){var r=n(function(){},"layoutBase");r.FDLayout=i(18),r.FDLayoutConstants=i(4),r.FDLayoutEdge=i(19),r.FDLayoutNode=i(20),r.DimensionD=i(21),r.HashMap=i(22),r.HashSet=i(23),r.IGeometry=i(8),r.IMath=i(9),r.Integer=i(10),r.Point=i(12),r.PointD=i(5),r.RandomSeed=i(16),r.RectangleD=i(13),r.Transform=i(17),r.UniqueIDGeneretor=i(14),r.Quicksort=i(25),r.LinkedList=i(11),r.LGraphObject=i(2),r.LGraph=i(6),r.LEdge=i(1),r.LGraphManager=i(7),r.LNode=i(3),r.Layout=i(15),r.LayoutConstants=i(0),r.NeedlemanWunsch=i(27),r.Matrix=i(24),r.SVD=i(26),t.exports=r},function(t,e,i){function r(){this.listeners=[]}n(r,"Emitter");var o=r.prototype;o.addListener=function(t,e){this.listeners.push({event:t,callback:e})},o.removeListener=function(t,e){for(var i=this.listeners.length;i>=0;i--){var r=this.listeners[i];r.event===t&&r.callback===e&&this.listeners.splice(i,1)}},o.emit=function(t,e){for(var i=0;i<this.listeners.length;i++){var r=this.listeners[i];t===r.event&&r.callback(e)}},t.exports=r}])})}),I=w((t,e)=>{n(function(i,r){"object"==typeof t&&"object"==typeof e?e.exports=r(C()):"function"==typeof define&&define.amd?define(["layout-base"],r):"object"==typeof t?t.coseBase=r(C()):i.coseBase=r(i.layoutBase)},"webpackUniversalModuleDefinition")(t,function(t){return(()=>{var e={45:(t,e,i)=>{var r={};r.layoutBase=i(551),r.CoSEConstants=i(806),r.CoSEEdge=i(767),r.CoSEGraph=i(880),r.CoSEGraphManager=i(578),r.CoSELayout=i(765),r.CoSENode=i(991),r.ConstraintHandler=i(902),t.exports=r},806:(t,e,i)=>{var r=i(551).FDLayoutConstants;function o(){}for(var a in n(o,"CoSEConstants"),r)o[a]=r[a];o.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,o.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,o.DEFAULT_COMPONENT_SEPERATION=60,o.TILE=!0,o.TILING_PADDING_VERTICAL=10,o.TILING_PADDING_HORIZONTAL=10,o.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,o.ENFORCE_CONSTRAINTS=!0,o.APPLY_LAYOUT=!0,o.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,o.TREE_REDUCTION_ON_INCREMENTAL=!0,o.PURE_INCREMENTAL=o.DEFAULT_INCREMENTAL,t.exports=o},767:(t,e,i)=>{var r=i(551).FDLayoutEdge;function o(t,e,i){r.call(this,t,e,i)}for(var a in n(o,"CoSEEdge"),o.prototype=Object.create(r.prototype),r)o[a]=r[a];t.exports=o},880:(t,e,i)=>{var r=i(551).LGraph;function o(t,e,i){r.call(this,t,e,i)}for(var a in n(o,"CoSEGraph"),o.prototype=Object.create(r.prototype),r)o[a]=r[a];t.exports=o},578:(t,e,i)=>{var r=i(551).LGraphManager;function o(t){r.call(this,t)}for(var a in n(o,"CoSEGraphManager"),o.prototype=Object.create(r.prototype),r)o[a]=r[a];t.exports=o},765:(t,e,i)=>{var r=i(551).FDLayout,o=i(578),a=i(880),s=i(991),h=i(767),l=i(806),d=i(902),c=i(551).FDLayoutConstants,g=i(551).LayoutConstants,u=i(551).Point,p=i(551).PointD,f=i(551).DimensionD,y=i(551).Layout,m=i(551).Integer,v=i(551).IGeometry,E=i(551).LGraph,N=i(551).Transform,T=i(551).LinkedList;function A(){r.call(this),this.toBeTiled={},this.constraints={}}for(var w in n(A,"CoSELayout"),A.prototype=Object.create(r.prototype),r)A[w]=r[w];A.prototype.newGraphManager=function(){var t=new o(this);return this.graphManager=t,t},A.prototype.newGraph=function(t){return new a(null,this.graphManager,t)},A.prototype.newNode=function(t){return new s(this.graphManager,t)},A.prototype.newEdge=function(t){return new h(null,null,t)},A.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(l.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=l.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=c.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=c.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},A.prototype.initSpringEmbedder=function(){r.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/c.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},A.prototype.layout=function(){return g.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},A.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(l.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(e)}}else{var i=this.getFlatForest();if(i.length>0)this.positionNodesRadially(i);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(e),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(d.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),l.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},A.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%c.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(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 t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),l.PURE_INCREMENTAL?this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=c.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()),l.PURE_INCREMENTAL?this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var i=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(i,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},A.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},i=0;i<t.length;i++){var r=t[i].rect,n=t[i].id;e[n]={id:n,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return e},A.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var t=!1;if("during"===c.ANIMATE)this.emit("layoutstarted");else{for(;!t;)t=this.tick();this.graphManager.updateBounds()}},A.prototype.moveNodes=function(){for(var t=this.getAllNodes(),e=0;e<t.length;e++)t[e].calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(e=0;e<t.length;e++)t[e].move()},A.prototype.initConstraintVariables=function(){var t=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var e=this.graphManager.getAllNodes(),i=0;i<e.length;i++){var r=e[i];this.idToNodeMap.set(r.id,r)}var o=n(function e(i){for(var r,n=i.getChild().getNodes(),o=0,a=0;a<n.length;a++)null==(r=n[a]).getChild()?t.fixedNodeSet.has(r.id)&&(o+=100):o+=e(r);return o},"calculateCompoundWeight");if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function(e){t.fixedNodeSet.add(e.nodeId)});for(e=this.graphManager.getAllNodes(),i=0;i<e.length;i++)if(null!=(r=e[i]).getChild()){var a=o(r);a>0&&(r.fixedNodeWeight=a)}}if(this.constraints.relativePlacementConstraint){var s=new Map,h=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(e){t.fixedNodesOnHorizontal.add(e),t.fixedNodesOnVertical.add(e)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var d=this.constraints.alignmentConstraint.vertical;for(i=0;i<d.length;i++)this.dummyToNodeForVerticalAlignment.set("dummy"+i,[]),d[i].forEach(function(e){s.set(e,"dummy"+i),t.dummyToNodeForVerticalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnHorizontal.add("dummy"+i)})}if(this.constraints.alignmentConstraint.horizontal){var c=this.constraints.alignmentConstraint.horizontal;for(i=0;i<c.length;i++)this.dummyToNodeForHorizontalAlignment.set("dummy"+i,[]),c[i].forEach(function(e){h.set(e,"dummy"+i),t.dummyToNodeForHorizontalAlignment.get("dummy"+i).push(e),t.fixedNodeSet.has(e)&&t.fixedNodesOnVertical.add("dummy"+i)})}}if(l.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(t){var e,i,r;for(r=t.length-1;r>=2*t.length/3;r--)e=Math.floor(Math.random()*(r+1)),i=t[r],t[r]=t[e],t[e]=i;return t},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(e){if(e.left){var i=s.has(e.left)?s.get(e.left):e.left,r=s.has(e.right)?s.get(e.right):e.right;t.nodesInRelativeHorizontal.includes(i)||(t.nodesInRelativeHorizontal.push(i),t.nodeToRelativeConstraintMapHorizontal.set(i,[]),t.dummyToNodeForVerticalAlignment.has(i)?t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(i)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(i,t.idToNodeMap.get(i).getCenterX())),t.nodesInRelativeHorizontal.includes(r)||(t.nodesInRelativeHorizontal.push(r),t.nodeToRelativeConstraintMapHorizontal.set(r,[]),t.dummyToNodeForVerticalAlignment.has(r)?t.nodeToTempPositionMapHorizontal.set(r,t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(r)[0]).getCenterX()):t.nodeToTempPositionMapHorizontal.set(r,t.idToNodeMap.get(r).getCenterX())),t.nodeToRelativeConstraintMapHorizontal.get(i).push({right:r,gap:e.gap}),t.nodeToRelativeConstraintMapHorizontal.get(r).push({left:i,gap:e.gap})}else{var n=h.has(e.top)?h.get(e.top):e.top,o=h.has(e.bottom)?h.get(e.bottom):e.bottom;t.nodesInRelativeVertical.includes(n)||(t.nodesInRelativeVertical.push(n),t.nodeToRelativeConstraintMapVertical.set(n,[]),t.dummyToNodeForHorizontalAlignment.has(n)?t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(n)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(n,t.idToNodeMap.get(n).getCenterY())),t.nodesInRelativeVertical.includes(o)||(t.nodesInRelativeVertical.push(o),t.nodeToRelativeConstraintMapVertical.set(o,[]),t.dummyToNodeForHorizontalAlignment.has(o)?t.nodeToTempPositionMapVertical.set(o,t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(o)[0]).getCenterY()):t.nodeToTempPositionMapVertical.set(o,t.idToNodeMap.get(o).getCenterY())),t.nodeToRelativeConstraintMapVertical.get(n).push({bottom:o,gap:e.gap}),t.nodeToRelativeConstraintMapVertical.get(o).push({top:n,gap:e.gap})}});else{var g=new Map,u=new Map;this.constraints.relativePlacementConstraint.forEach(function(t){if(t.left){var e=s.has(t.left)?s.get(t.left):t.left,i=s.has(t.right)?s.get(t.right):t.right;g.has(e)?g.get(e).push(i):g.set(e,[i]),g.has(i)?g.get(i).push(e):g.set(i,[e])}else{var r=h.has(t.top)?h.get(t.top):t.top,n=h.has(t.bottom)?h.get(t.bottom):t.bottom;u.has(r)?u.get(r).push(n):u.set(r,[n]),u.has(n)?u.get(n).push(r):u.set(n,[r])}});var p=n(function(t,e){var i=[],r=[],n=new T,o=new Set,a=0;return t.forEach(function(s,h){if(!o.has(h)){i[a]=[],r[a]=!1;var l=h;for(n.push(l),o.add(l),i[a].push(l);0!=n.length;){l=n.shift(),e.has(l)&&(r[a]=!0),t.get(l).forEach(function(t){o.has(t)||(n.push(t),o.add(t),i[a].push(t))})}a++}}),{components:i,isFixed:r}},"constructComponents"),f=p(g,t.fixedNodesOnHorizontal);this.componentsOnHorizontal=f.components,this.fixedComponentsOnHorizontal=f.isFixed;var y=p(u,t.fixedNodesOnVertical);this.componentsOnVertical=y.components,this.fixedComponentsOnVertical=y.isFixed}}},A.prototype.updateDisplacements=function(){var t=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(e){var i=t.idToNodeMap.get(e.nodeId);i.displacementX=0,i.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var e=this.constraints.alignmentConstraint.vertical,i=0;i<e.length;i++){for(var r=0,n=0;n<e[i].length;n++){if(this.fixedNodeSet.has(e[i][n])){r=0;break}r+=this.idToNodeMap.get(e[i][n]).displacementX}var o=r/e[i].length;for(n=0;n<e[i].length;n++)this.idToNodeMap.get(e[i][n]).displacementX=o}if(this.constraints.alignmentConstraint.horizontal){var a=this.constraints.alignmentConstraint.horizontal;for(i=0;i<a.length;i++){var s=0;for(n=0;n<a[i].length;n++){if(this.fixedNodeSet.has(a[i][n])){s=0;break}s+=this.idToNodeMap.get(a[i][n]).displacementY}var h=s/a[i].length;for(n=0;n<a[i].length;n++)this.idToNodeMap.get(a[i][n]).displacementY=h}}}if(this.constraints.relativePlacementConstraint)if(l.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForVerticalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForVerticalAlignment.get(e)[0]).displacementX:t.idToNodeMap.get(e).displacementX,t.nodeToRelativeConstraintMapHorizontal.get(e).forEach(function(r){var n;r.right?(n=t.nodeToTempPositionMapHorizontal.get(r.right)-t.nodeToTempPositionMapHorizontal.get(e)-i)<r.gap&&(i-=r.gap-n):(n=t.nodeToTempPositionMapHorizontal.get(e)-t.nodeToTempPositionMapHorizontal.get(r.left)+i)<r.gap&&(i+=r.gap-n)}),t.nodeToTempPositionMapHorizontal.set(e,t.nodeToTempPositionMapHorizontal.get(e)+i),t.dummyToNodeForVerticalAlignment.has(e)?t.dummyToNodeForVerticalAlignment.get(e).forEach(function(e){t.idToNodeMap.get(e).displacementX=i}):t.idToNodeMap.get(e).displacementX=i}}),this.nodesInRelativeVertical.forEach(function(e){if(!t.fixedNodesOnHorizontal.has(e)){var i=0;i=t.dummyToNodeForHorizontalAlignment.has(e)?t.idToNodeMap.get(t.dummyToNodeForHorizontalAlignment.get(e)[0]).displacementY:t.idToNodeMap.get(e).displacementY,t.nodeToRelativeConstraintMapVertical.get(e).forEach(function(r){var n;r.bottom?(n=t.nodeToTempPositionMapVertical.get(r.bottom)-t.nodeToTempPositionMapVertical.get(e)-i)<r.gap&&(i-=r.gap-n):(n=t.nodeToTempPositionMapVertical.get(e)-t.nodeToTempPositionMapVertical.get(r.top)+i)<r.gap&&(i+=r.gap-n)}),t.nodeToTempPositionMapVertical.set(e,t.nodeToTempPositionMapVertical.get(e)+i),t.dummyToNodeForHorizontalAlignment.has(e)?t.dummyToNodeForHorizontalAlignment.get(e).forEach(function(e){t.idToNodeMap.get(e).displacementY=i}):t.idToNodeMap.get(e).displacementY=i}});else{for(i=0;i<this.componentsOnHorizontal.length;i++){var d=this.componentsOnHorizontal[i];if(this.fixedComponentsOnHorizontal[i])for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach(function(e){t.idToNodeMap.get(e).displacementX=0}):this.idToNodeMap.get(d[n]).displacementX=0;else{var c=0,g=0;for(n=0;n<d.length;n++)if(this.dummyToNodeForVerticalAlignment.has(d[n])){c+=(p=this.dummyToNodeForVerticalAlignment.get(d[n])).length*this.idToNodeMap.get(p[0]).displacementX,g+=p.length}else c+=this.idToNodeMap.get(d[n]).displacementX,g++;var u=c/g;for(n=0;n<d.length;n++)this.dummyToNodeForVerticalAlignment.has(d[n])?this.dummyToNodeForVerticalAlignment.get(d[n]).forEach(function(e){t.idToNodeMap.get(e).displacementX=u}):this.idToNodeMap.get(d[n]).displacementX=u}}for(i=0;i<this.componentsOnVertical.length;i++){d=this.componentsOnVertical[i];if(this.fixedComponentsOnVertical[i])for(n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach(function(e){t.idToNodeMap.get(e).displacementY=0}):this.idToNodeMap.get(d[n]).displacementY=0;else{for(c=0,g=0,n=0;n<d.length;n++)if(this.dummyToNodeForHorizontalAlignment.has(d[n])){var p;c+=(p=this.dummyToNodeForHorizontalAlignment.get(d[n])).length*this.idToNodeMap.get(p[0]).displacementY,g+=p.length}else c+=this.idToNodeMap.get(d[n]).displacementY,g++;for(u=c/g,n=0;n<d.length;n++)this.dummyToNodeForHorizontalAlignment.has(d[n])?this.dummyToNodeForHorizontalAlignment.get(d[n]).forEach(function(e){t.idToNodeMap.get(e).displacementY=u}):this.idToNodeMap.get(d[n]).displacementY=u}}}},A.prototype.calculateNodesToApplyGravitationTo=function(){var t,e,i=[],r=this.graphManager.getGraphs(),n=r.length;for(e=0;e<n;e++)(t=r[e]).updateConnected(),t.isConnected||(i=i.concat(t.getNodes()));return i},A.prototype.createBendpoints=function(){var t=[];t=t.concat(this.graphManager.getAllEdges());var e,i=new Set;for(e=0;e<t.length;e++){var r=t[e];if(!i.has(r)){var n=r.getSource(),o=r.getTarget();if(n==o)r.getBendpoints().push(new p),r.getBendpoints().push(new p),this.createDummyNodesForBendpoints(r),i.add(r);else{var a=[];if(a=(a=a.concat(n.getEdgeListToNode(o))).concat(o.getEdgeListToNode(n)),!i.has(a[0])){var s;if(a.length>1)for(s=0;s<a.length;s++){var h=a[s];h.getBendpoints().push(new p),this.createDummyNodesForBendpoints(h)}a.forEach(function(t){i.add(t)})}}}if(i.size==t.length)break}},A.prototype.positionNodesRadially=function(t){for(var e=new u(0,0),i=Math.ceil(Math.sqrt(t.length)),r=0,n=0,o=0,a=new p(0,0),s=0;s<t.length;s++){s%i==0&&(o=0,n=r,0!=s&&(n+=l.DEFAULT_COMPONENT_SEPERATION),r=0);var h=t[s],d=y.findCenterOfTree(h);e.x=o,e.y=n,(a=A.radialLayout(h,d,e)).y>r&&(r=Math.floor(a.y)),o=Math.floor(a.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(g.WORLD_CENTER_X-a.x/2,g.WORLD_CENTER_Y-a.y/2))},A.radialLayout=function(t,e,i){var r=Math.max(this.maxDiagonalInTree(t),l.DEFAULT_RADIAL_SEPARATION);A.branchRadialLayout(e,null,0,359,0,r);var n=E.calculateBounds(t),o=new N;o.setDeviceOrgX(n.getMinX()),o.setDeviceOrgY(n.getMinY()),o.setWorldOrgX(i.x),o.setWorldOrgY(i.y);for(var a=0;a<t.length;a++){t[a].transform(o)}var s=new p(n.getMaxX(),n.getMaxY());return o.inverseTransformPoint(s)},A.branchRadialLayout=function(t,e,i,r,n,o){var a=(r-i+1)/2;a<0&&(a+=180);var s=(a+i)%360*v.TWO_PI/360,h=n*Math.cos(s),l=n*Math.sin(s);t.setCenter(h,l);var d=[],c=(d=d.concat(t.getEdges())).length;null!=e&&c--;for(var g,u=0,p=d.length,f=t.getEdgesBetween(e);f.length>1;){var y=f[0];f.splice(0,1);var m=d.indexOf(y);m>=0&&d.splice(m,1),p--,c--}g=null!=e?(d.indexOf(f[0])+1)%p:0;for(var E=Math.abs(r-i)/c,N=g;u!=c;N=++N%p){var T=d[N].getOtherEnd(t);if(T!=e){var w=(i+u*E)%360,_=(w+E)%360;A.branchRadialLayout(T,t,w,_,n+o,o),u++}}},A.maxDiagonalInTree=function(t){for(var e=m.MIN_VALUE,i=0;i<t.length;i++){var r=t[i].getDiagonal();r>e&&(e=r)}return e},A.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},A.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var i=[],r=this.graphManager.getAllNodes(),n=0;n<r.length;n++){var o=(a=r[n]).getParent();0===this.getNodeDegreeWithChildren(a)&&(null==o.id||!this.getToBeTiled(o))&&i.push(a)}for(n=0;n<i.length;n++){var a,h=(a=i[n]).getParent().id;typeof e[h]>"u"&&(e[h]=[]),e[h]=e[h].concat(a)}Object.keys(e).forEach(function(i){if(e[i].length>1){var r="DummyCompound_"+i;t.memberGroups[r]=e[i];var n=e[i][0].getParent(),o=new s(t.graphManager);o.id=r,o.paddingLeft=n.paddingLeft||0,o.paddingRight=n.paddingRight||0,o.paddingBottom=n.paddingBottom||0,o.paddingTop=n.paddingTop||0,t.idToDummyNode[r]=o;var a=t.getGraphManager().add(t.newGraph(),o),h=n.getChild();h.add(o);for(var l=0;l<e[i].length;l++){var d=e[i][l];h.remove(d),a.add(d)}}})},A.prototype.clearCompounds=function(){var t={},e={};this.performDFSOnCompounds();for(var i=0;i<this.compoundOrder.length;i++)e[this.compoundOrder[i].id]=this.compoundOrder[i],t[this.compoundOrder[i].id]=[].concat(this.compoundOrder[i].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[i].getChild()),this.compoundOrder[i].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(t,e)},A.prototype.clearZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(i){var r=t.idToDummyNode[i];if(e[i]=t.tileNodes(t.memberGroups[i],r.paddingLeft+r.paddingRight),r.rect.width=e[i].width,r.rect.height=e[i].height,r.setCenter(e[i].centerX,e[i].centerY),r.labelMarginLeft=0,r.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var n=r.rect.width,o=r.rect.height;r.labelWidth&&("left"==r.labelPosHorizontal?(r.rect.x-=r.labelWidth,r.setWidth(n+r.labelWidth),r.labelMarginLeft=r.labelWidth):"center"==r.labelPosHorizontal&&r.labelWidth>n?(r.rect.x-=(r.labelWidth-n)/2,r.setWidth(r.labelWidth),r.labelMarginLeft=(r.labelWidth-n)/2):"right"==r.labelPosHorizontal&&r.setWidth(n+r.labelWidth)),r.labelHeight&&("top"==r.labelPosVertical?(r.rect.y-=r.labelHeight,r.setHeight(o+r.labelHeight),r.labelMarginTop=r.labelHeight):"center"==r.labelPosVertical&&r.labelHeight>o?(r.rect.y-=(r.labelHeight-o)/2,r.setHeight(r.labelHeight),r.labelMarginTop=(r.labelHeight-o)/2):"bottom"==r.labelPosVertical&&r.setHeight(o+r.labelHeight))}})},A.prototype.repopulateCompounds=function(){for(var t=this.compoundOrder.length-1;t>=0;t--){var e=this.compoundOrder[t],i=e.id,r=e.paddingLeft,n=e.paddingTop,o=e.labelMarginLeft,a=e.labelMarginTop;this.adjustLocations(this.tiledMemberPack[i],e.rect.x,e.rect.y,r,n,o,a)}},A.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach(function(i){var r=t.idToDummyNode[i],n=r.paddingLeft,o=r.paddingTop,a=r.labelMarginLeft,s=r.labelMarginTop;t.adjustLocations(e[i],r.rect.x,r.rect.y,n,o,a,s)})},A.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var i=t.getChild();if(null==i)return this.toBeTiled[e]=!1,!1;for(var r=i.getNodes(),n=0;n<r.length;n++){var o=r[n];if(this.getNodeDegree(o)>0)return this.toBeTiled[e]=!1,!1;if(null!=o.getChild()){if(!this.getToBeTiled(o))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[o.id]=!1}return this.toBeTiled[e]=!0,!0},A.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),i=0,r=0;r<e.length;r++){var n=e[r];n.getSource().id!==n.getTarget().id&&(i+=1)}return i},A.prototype.getNodeDegreeWithChildren=function(t){var e=this.getNodeDegree(t);if(null==t.getChild())return e;for(var i=t.getChild().getNodes(),r=0;r<i.length;r++){var n=i[r];e+=this.getNodeDegreeWithChildren(n)}return e},A.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},A.prototype.fillCompexOrderByDFS=function(t){for(var e=0;e<t.length;e++){var i=t[e];null!=i.getChild()&&this.fillCompexOrderByDFS(i.getChild().getNodes()),this.getToBeTiled(i)&&this.compoundOrder.push(i)}},A.prototype.adjustLocations=function(t,e,i,r,n,o,a){i+=n+a;for(var s=e+=r+o,h=0;h<t.rows.length;h++){var l=t.rows[h];e=s;for(var d=0,c=0;c<l.length;c++){var g=l[c];g.rect.x=e,g.rect.y=i,e+=g.rect.width+t.horizontalPadding,g.rect.height>d&&(d=g.rect.height)}i+=d+t.verticalPadding}},A.prototype.tileCompoundMembers=function(t,e){var i=this;this.tiledMemberPack=[],Object.keys(t).forEach(function(r){var n=e[r];if(i.tiledMemberPack[r]=i.tileNodes(t[r],n.paddingLeft+n.paddingRight),n.rect.width=i.tiledMemberPack[r].width,n.rect.height=i.tiledMemberPack[r].height,n.setCenter(i.tiledMemberPack[r].centerX,i.tiledMemberPack[r].centerY),n.labelMarginLeft=0,n.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var o=n.rect.width,a=n.rect.height;n.labelWidth&&("left"==n.labelPosHorizontal?(n.rect.x-=n.labelWidth,n.setWidth(o+n.labelWidth),n.labelMarginLeft=n.labelWidth):"center"==n.labelPosHorizontal&&n.labelWidth>o?(n.rect.x-=(n.labelWidth-o)/2,n.setWidth(n.labelWidth),n.labelMarginLeft=(n.labelWidth-o)/2):"right"==n.labelPosHorizontal&&n.setWidth(o+n.labelWidth)),n.labelHeight&&("top"==n.labelPosVertical?(n.rect.y-=n.labelHeight,n.setHeight(a+n.labelHeight),n.labelMarginTop=n.labelHeight):"center"==n.labelPosVertical&&n.labelHeight>a?(n.rect.y-=(n.labelHeight-a)/2,n.setHeight(n.labelHeight),n.labelMarginTop=(n.labelHeight-a)/2):"bottom"==n.labelPosVertical&&n.setHeight(a+n.labelHeight))}})},A.prototype.tileNodes=function(t,e){var i=this.tileNodesByFavoringDim(t,e,!0),r=this.tileNodesByFavoringDim(t,e,!1),n=this.getOrgRatio(i);return this.getOrgRatio(r)<n?r:i},A.prototype.getOrgRatio=function(t){var e=t.width/t.height;return e<1&&(e=1/e),e},A.prototype.calcIdealRowWidth=function(t,e){var i=l.TILING_PADDING_VERTICAL,r=l.TILING_PADDING_HORIZONTAL,n=t.length,o=0,a=0,s=0;t.forEach(function(t){o+=t.getWidth(),a+=t.getHeight(),t.getWidth()>s&&(s=t.getWidth())});var h,d=o/n,c=a/n,g=Math.pow(i-r,2)+4*(d+r)*(c+i)*n,u=(r-i+Math.sqrt(g))/(2*(d+r));e?(h=Math.ceil(u))==u&&h++:h=Math.floor(u);var p=h*(d+r)-r;return s>p&&(p=s),p+=2*r},A.prototype.tileNodesByFavoringDim=function(t,e,i){var r=l.TILING_PADDING_VERTICAL,o=l.TILING_PADDING_HORIZONTAL,a=l.TILING_COMPARE_BY,s={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:r,horizontalPadding:o,centerX:0,centerY:0};a&&(s.idealRowWidth=this.calcIdealRowWidth(t,i));var h=n(function(t){return t.rect.width*t.rect.height},"getNodeArea"),d=n(function(t,e){return h(e)-h(t)},"areaCompareFcn");t.sort(function(t,e){var i=d;return s.idealRowWidth?(i=a)(t.id,e.id):i(t,e)});for(var c=0,g=0,u=0;u<t.length;u++){c+=(p=t[u]).getCenterX(),g+=p.getCenterY()}s.centerX=c/t.length,s.centerY=g/t.length;for(u=0;u<t.length;u++){var p=t[u];if(0==s.rows.length)this.insertNodeToRow(s,p,0,e);else if(this.canAddHorizontal(s,p.rect.width,p.rect.height)){var f=s.rows.length-1;s.idealRowWidth||(f=this.getShortestRowIndex(s)),this.insertNodeToRow(s,p,f,e)}else this.insertNodeToRow(s,p,s.rows.length,e);this.shiftToLastRow(s)}return s},A.prototype.insertNodeToRow=function(t,e,i,r){var n=r;if(i==t.rows.length){t.rows.push([]),t.rowWidth.push(n),t.rowHeight.push(0)}var o=t.rowWidth[i]+e.rect.width;t.rows[i].length>0&&(o+=t.horizontalPadding),t.rowWidth[i]=o,t.width<o&&(t.width=o);var a=e.rect.height;i>0&&(a+=t.verticalPadding);var s=0;a>t.rowHeight[i]&&(s=t.rowHeight[i],t.rowHeight[i]=a,s=t.rowHeight[i]-s),t.height+=s,t.rows[i].push(e)},A.prototype.getShortestRowIndex=function(t){for(var e=-1,i=Number.MAX_VALUE,r=0;r<t.rows.length;r++)t.rowWidth[r]<i&&(e=r,i=t.rowWidth[r]);return e},A.prototype.getLongestRowIndex=function(t){for(var e=-1,i=Number.MIN_VALUE,r=0;r<t.rows.length;r++)t.rowWidth[r]>i&&(e=r,i=t.rowWidth[r]);return e},A.prototype.canAddHorizontal=function(t,e,i){if(t.idealRowWidth){var r=t.rows.length-1;return t.rowWidth[r]+e+t.horizontalPadding<=t.idealRowWidth}var n=this.getShortestRowIndex(t);if(n<0)return!0;var o=t.rowWidth[n];if(o+t.horizontalPadding+e<=t.width)return!0;var a,s,h=0;return t.rowHeight[n]<i&&n>0&&(h=i+t.verticalPadding-t.rowHeight[n]),a=t.width-o>=e+t.horizontalPadding?(t.height+h)/(o+e+t.horizontalPadding):(t.height+h)/t.width,h=i+t.verticalPadding,(s=t.width<e?(t.height+h)/e:(t.height+h)/t.width)<1&&(s=1/s),a<1&&(a=1/a),a<s},A.prototype.shiftToLastRow=function(t){var e=this.getLongestRowIndex(t),i=t.rowWidth.length-1,r=t.rows[e],n=r[r.length-1],o=n.width+t.horizontalPadding;if(t.width-t.rowWidth[i]>o&&e!=i){r.splice(-1,1),t.rows[i].push(n),t.rowWidth[e]=t.rowWidth[e]-o,t.rowWidth[i]=t.rowWidth[i]+o,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var a=Number.MIN_VALUE,s=0;s<r.length;s++)r[s].height>a&&(a=r[s].height);e>0&&(a+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[i];t.rowHeight[e]=a,t.rowHeight[i]<n.height+t.verticalPadding&&(t.rowHeight[i]=n.height+t.verticalPadding);var l=t.rowHeight[e]+t.rowHeight[i];t.height+=l-h,this.shiftToLastRow(t)}},A.prototype.tilingPreLayout=function(){l.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},A.prototype.tilingPostLayout=function(){l.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},A.prototype.reduceTrees=function(){for(var t,e=[],i=!0;i;){var r=this.graphManager.getAllNodes(),n=[];i=!1;for(var o=0;o<r.length;o++)if(1==(t=r[o]).getEdges().length&&!t.getEdges()[0].isInterGraph&&null==t.getChild()){if(l.PURE_INCREMENTAL){var a=t.getEdges()[0].getOtherEnd(t),s=new f(t.getCenterX()-a.getCenterX(),t.getCenterY()-a.getCenterY());n.push([t,t.getEdges()[0],t.getOwner(),s])}else n.push([t,t.getEdges()[0],t.getOwner()]);i=!0}if(1==i){for(var h=[],d=0;d<n.length;d++)1==n[d][0].getEdges().length&&(h.push(n[d]),n[d][0].getOwner().remove(n[d][0]));e.push(h),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},A.prototype.growTree=function(t){for(var e,i=t[t.length-1],r=0;r<i.length;r++)e=i[r],this.findPlaceforPrunedNode(e),e[2].add(e[0]),e[2].add(e[1],e[1].source,e[1].target);t.splice(t.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},A.prototype.findPlaceforPrunedNode=function(t){var e,i,r=t[0];if(i=r==t[1].source?t[1].target:t[1].source,l.PURE_INCREMENTAL)r.setCenter(i.getCenterX()+t[3].getWidth(),i.getCenterY()+t[3].getHeight());else{var n=i.startX,o=i.finishX,a=i.startY,s=i.finishY,h=[0,0,0,0];if(a>0)for(var d=n;d<=o;d++)h[0]+=this.grid[d][a-1].length+this.grid[d][a].length-1;if(o<this.grid.length-1)for(d=a;d<=s;d++)h[1]+=this.grid[o+1][d].length+this.grid[o][d].length-1;if(s<this.grid[0].length-1)for(d=n;d<=o;d++)h[2]+=this.grid[d][s+1].length+this.grid[d][s].length-1;if(n>0)for(d=a;d<=s;d++)h[3]+=this.grid[n-1][d].length+this.grid[n][d].length-1;for(var g,u,p=m.MAX_VALUE,f=0;f<h.length;f++)h[f]<p?(p=h[f],g=1,u=f):h[f]==p&&g++;if(3==g&&0==p)0==h[0]&&0==h[1]&&0==h[2]?e=1:0==h[0]&&0==h[1]&&0==h[3]?e=0:0==h[0]&&0==h[2]&&0==h[3]?e=3:0==h[1]&&0==h[2]&&0==h[3]&&(e=2);else if(2==g&&0==p){var y=Math.floor(2*Math.random());e=0==h[0]&&0==h[1]?0==y?0:1:0==h[0]&&0==h[2]?0==y?0:2:0==h[0]&&0==h[3]?0==y?0:3:0==h[1]&&0==h[2]?0==y?1:2:0==h[1]&&0==h[3]?0==y?1:3:0==y?2:3}else if(4==g&&0==p){e=y=Math.floor(4*Math.random())}else e=u;0==e?r.setCenter(i.getCenterX(),i.getCenterY()-i.getHeight()/2-c.DEFAULT_EDGE_LENGTH-r.getHeight()/2):1==e?r.setCenter(i.getCenterX()+i.getWidth()/2+c.DEFAULT_EDGE_LENGTH+r.getWidth()/2,i.getCenterY()):2==e?r.setCenter(i.getCenterX(),i.getCenterY()+i.getHeight()/2+c.DEFAULT_EDGE_LENGTH+r.getHeight()/2):r.setCenter(i.getCenterX()-i.getWidth()/2-c.DEFAULT_EDGE_LENGTH-r.getWidth()/2,i.getCenterY())}},t.exports=A},991:(t,e,i)=>{var r=i(551).FDLayoutNode,o=i(551).IMath;function a(t,e,i,n){r.call(this,t,e,i,n)}for(var s in n(a,"CoSENode"),a.prototype=Object.create(r.prototype),r)a[s]=r[s];a.prototype.calculateDisplacement=function(){var t=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=t.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=t.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*o.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},a.prototype.propogateDisplacementToChildren=function(t,e){for(var i,r=this.getChild().getNodes(),n=0;n<r.length;n++)null==(i=r[n]).getChild()?(i.displacementX+=t,i.displacementY+=e):i.propogateDisplacementToChildren(t,e)},a.prototype.move=function(){var t=this.graphManager.getLayout();(null==this.child||0==this.child.getNodes().length)&&(this.moveBy(this.displacementX,this.displacementY),t.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},a.prototype.setPred1=function(t){this.pred1=t},a.prototype.getPred1=function(){return pred1},a.prototype.getPred2=function(){return pred2},a.prototype.setNext=function(t){this.next=t},a.prototype.getNext=function(){return next},a.prototype.setProcessed=function(t){this.processed=t},a.prototype.isProcessed=function(){return processed},t.exports=a},902:(t,e,i)=>{function r(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}n(r,"_toConsumableArray");var o=i(806),a=i(551).LinkedList,s=i(551).Matrix,h=i(551).SVD;function l(){}n(l,"ConstraintHandler"),l.handleConstraints=function(t){var e={};e.fixedNodeConstraint=t.constraints.fixedNodeConstraint,e.alignmentConstraint=t.constraints.alignmentConstraint,e.relativePlacementConstraint=t.constraints.relativePlacementConstraint;for(var i=new Map,l=new Map,d=[],c=[],g=t.getAllNodes(),u=0,p=0;p<g.length;p++){var f=g[p];null==f.getChild()&&(l.set(f.id,u++),d.push(f.getCenterX()),c.push(f.getCenterY()),i.set(f.id,f))}e.relativePlacementConstraint&&e.relativePlacementConstraint.forEach(function(t){!t.gap&&0!=t.gap&&(t.left?t.gap=o.DEFAULT_EDGE_LENGTH+i.get(t.left).getWidth()/2+i.get(t.right).getWidth()/2:t.gap=o.DEFAULT_EDGE_LENGTH+i.get(t.top).getHeight()/2+i.get(t.bottom).getHeight()/2)});var y=n(function(t,e){return{x:t.x-e.x,y:t.y-e.y}},"calculatePositionDiff"),m=n(function(t){var e=0,i=0;return t.forEach(function(t){e+=d[l.get(t)],i+=c[l.get(t)]}),{x:e/t.size,y:i/t.size}},"calculateAvgPosition"),v=n(function(t,e,i,o,s){function h(t,e){var i=new Set(t),r=!0,n=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var h=a.value;i.add(h)}}catch(t){n=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}return i}n(h,"setUnion");var g=new Map;t.forEach(function(t,e){g.set(e,0)}),t.forEach(function(t,e){t.forEach(function(t){g.set(t.id,g.get(t.id)+1)})});var u=new Map,p=new Map,f=new a;g.forEach(function(t,r){0==t?(f.push(r),i||("horizontal"==e?u.set(r,l.has(r)?d[l.get(r)]:o.get(r)):u.set(r,l.has(r)?c[l.get(r)]:o.get(r)))):u.set(r,Number.NEGATIVE_INFINITY),i&&p.set(r,new Set([r]))}),i&&s.forEach(function(t){var r=[];if(t.forEach(function(t){i.has(t)&&r.push(t)}),r.length>0){var n=0;r.forEach(function(t){"horizontal"==e?(u.set(t,l.has(t)?d[l.get(t)]:o.get(t)),n+=u.get(t)):(u.set(t,l.has(t)?c[l.get(t)]:o.get(t)),n+=u.get(t))}),n/=r.length,t.forEach(function(t){i.has(t)||u.set(t,n)})}else{var a=0;t.forEach(function(t){a+="horizontal"==e?l.has(t)?d[l.get(t)]:o.get(t):l.has(t)?c[l.get(t)]:o.get(t)}),a/=t.length,t.forEach(function(t){u.set(t,a)})}});for(var y=n(function(){var r=f.shift();t.get(r).forEach(function(t){if(u.get(t.id)<u.get(r)+t.gap)if(i&&i.has(t.id)){var n=void 0;if(n="horizontal"==e?l.has(t.id)?d[l.get(t.id)]:o.get(t.id):l.has(t.id)?c[l.get(t.id)]:o.get(t.id),u.set(t.id,n),n<u.get(r)+t.gap){var a=u.get(r)+t.gap-n;p.get(r).forEach(function(t){u.set(t,u.get(t)-a)})}}else u.set(t.id,u.get(r)+t.gap);g.set(t.id,g.get(t.id)-1),0==g.get(t.id)&&f.push(t.id),i&&p.set(t.id,h(p.get(r),p.get(t.id)))})},"_loop");0!=f.length;)y();if(i){var m=new Set;t.forEach(function(t,e){0==t.length&&m.add(e)});var v=[];p.forEach(function(t,e){if(m.has(e)){var n=!1,o=!0,a=!1,s=void 0;try{for(var h,l=t[Symbol.iterator]();!(o=(h=l.next()).done);o=!0){var d=h.value;i.has(d)&&(n=!0)}}catch(t){a=!0,s=t}finally{try{!o&&l.return&&l.return()}finally{if(a)throw s}}if(!n){var c=!1,g=void 0;v.forEach(function(e,i){e.has([].concat(r(t))[0])&&(c=!0,g=i)}),c?t.forEach(function(t){v[g].add(t)}):v.push(new Set(t))}}}),v.forEach(function(t,i){var r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,h=!0,g=!1,p=void 0;try{for(var f,y=t[Symbol.iterator]();!(h=(f=y.next()).done);h=!0){var m=f.value,v=void 0;v="horizontal"==e?l.has(m)?d[l.get(m)]:o.get(m):l.has(m)?c[l.get(m)]:o.get(m);var E=u.get(m);v<r&&(r=v),v>a&&(a=v),E<n&&(n=E),E>s&&(s=E)}}catch(t){g=!0,p=t}finally{try{!h&&y.return&&y.return()}finally{if(g)throw p}}var N=(r+a)/2-(n+s)/2,T=!0,A=!1,w=void 0;try{for(var _,L=t[Symbol.iterator]();!(T=(_=L.next()).done);T=!0){var C=_.value;u.set(C,u.get(C)+N)}}catch(t){A=!0,w=t}finally{try{!T&&L.return&&L.return()}finally{if(A)throw w}}})}return u},"findAppropriatePositionForRelativePlacement"),E=n(function(t){var e=0,i=0,r=0,n=0;if(t.forEach(function(t){t.left?d[l.get(t.left)]-d[l.get(t.right)]>=0?e++:i++:c[l.get(t.top)]-c[l.get(t.bottom)]>=0?r++:n++}),e>i&&r>n)for(var o=0;o<l.size;o++)d[o]=-1*d[o],c[o]=-1*c[o];else if(e>i)for(var a=0;a<l.size;a++)d[a]=-1*d[a];else if(r>n)for(var s=0;s<l.size;s++)c[s]=-1*c[s]},"applyReflectionForRelativePlacement"),N=n(function(t){var e=[],i=new a,r=new Set,n=0;return t.forEach(function(o,a){if(!r.has(a)){e[n]=[];var s=a;for(i.push(s),r.add(s),e[n].push(s);0!=i.length;){s=i.shift(),t.get(s).forEach(function(t){r.has(t.id)||(i.push(t.id),r.add(t.id),e[n].push(t.id))})}n++}}),e},"findComponents"),T=n(function(t){var e=new Map;return t.forEach(function(t,i){e.set(i,[])}),t.forEach(function(t,i){t.forEach(function(t){e.get(i).push(t),e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})})}),e},"dagToUndirected"),A=n(function(t){var e=new Map;return t.forEach(function(t,i){e.set(i,[])}),t.forEach(function(t,i){t.forEach(function(t){e.get(t.id).push({id:i,gap:t.gap,direction:t.direction})})}),e},"dagToReversed"),w=[],_=[],L=!1,C=!1,I=new Set,M=new Map,x=new Map,O=[];if(e.fixedNodeConstraint&&e.fixedNodeConstraint.forEach(function(t){I.add(t.nodeId)}),e.relativePlacementConstraint&&(e.relativePlacementConstraint.forEach(function(t){t.left?(M.has(t.left)?M.get(t.left).push({id:t.right,gap:t.gap,direction:"horizontal"}):M.set(t.left,[{id:t.right,gap:t.gap,direction:"horizontal"}]),M.has(t.right)||M.set(t.right,[])):(M.has(t.top)?M.get(t.top).push({id:t.bottom,gap:t.gap,direction:"vertical"}):M.set(t.top,[{id:t.bottom,gap:t.gap,direction:"vertical"}]),M.has(t.bottom)||M.set(t.bottom,[]))}),x=T(M),O=N(x)),o.TRANSFORM_ON_CONSTRAINT_HANDLING){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>1)e.fixedNodeConstraint.forEach(function(t,e){w[e]=[t.position.x,t.position.y],_[e]=[d[l.get(t.nodeId)],c[l.get(t.nodeId)]]}),L=!0;else if(e.alignmentConstraint)!function(){var t=0;if(e.alignmentConstraint.vertical){for(var i=e.alignmentConstraint.vertical,o=n(function(e){var n=new Set;i[e].forEach(function(t){n.add(t)});var o=new Set([].concat(r(n)).filter(function(t){return I.has(t)})),a=void 0;a=o.size>0?d[l.get(o.values().next().value)]:m(n).x,i[e].forEach(function(e){w[t]=[a,c[l.get(e)]],_[t]=[d[l.get(e)],c[l.get(e)]],t++})},"_loop2"),a=0;a<i.length;a++)o(a);L=!0}if(e.alignmentConstraint.horizontal){for(var s=e.alignmentConstraint.horizontal,h=n(function(e){var i=new Set;s[e].forEach(function(t){i.add(t)});var n=new Set([].concat(r(i)).filter(function(t){return I.has(t)})),o=void 0;o=n.size>0?d[l.get(n.values().next().value)]:m(i).y,s[e].forEach(function(e){w[t]=[d[l.get(e)],o],_[t]=[d[l.get(e)],c[l.get(e)]],t++})},"_loop3"),g=0;g<s.length;g++)h(g);L=!0}e.relativePlacementConstraint&&(C=!0)}();else if(e.relativePlacementConstraint){for(var D=0,b=0,R=0;R<O.length;R++)O[R].length>D&&(D=O[R].length,b=R);if(D<x.size/2)E(e.relativePlacementConstraint),L=!1,C=!1;else{var G=new Map,F=new Map,S=[];O[b].forEach(function(t){M.get(t).forEach(function(e){"horizontal"==e.direction?(G.has(t)?G.get(t).push(e):G.set(t,[e]),G.has(e.id)||G.set(e.id,[]),S.push({left:t,right:e.id})):(F.has(t)?F.get(t).push(e):F.set(t,[e]),F.has(e.id)||F.set(e.id,[]),S.push({top:t,bottom:e.id}))})}),E(S),C=!1;var P=v(G,"horizontal"),U=v(F,"vertical");O[b].forEach(function(t,e){_[e]=[d[l.get(t)],c[l.get(t)]],w[e]=[],P.has(t)?w[e][0]=P.get(t):w[e][0]=d[l.get(t)],U.has(t)?w[e][1]=U.get(t):w[e][1]=c[l.get(t)]}),L=!0}}if(L){for(var k,Y=s.transpose(w),H=s.transpose(_),X=0;X<Y.length;X++)Y[X]=s.multGamma(Y[X]),H[X]=s.multGamma(H[X]);var z=s.multMat(Y,s.transpose(H)),B=h.svd(z);k=s.multMat(B.V,s.transpose(B.U));for(var V=0;V<l.size;V++){var W=[d[V],c[V]],j=[k[0][0],k[1][0]],q=[k[0][1],k[1][1]];d[V]=s.dotProduct(W,j),c[V]=s.dotProduct(W,q)}C&&E(e.relativePlacementConstraint)}}if(o.ENFORCE_CONSTRAINTS){if(e.fixedNodeConstraint&&e.fixedNodeConstraint.length>0){var $={x:0,y:0};e.fixedNodeConstraint.forEach(function(t,e){var i={x:d[l.get(t.nodeId)],y:c[l.get(t.nodeId)]},r=t.position,n=y(r,i);$.x+=n.x,$.y+=n.y}),$.x/=e.fixedNodeConstraint.length,$.y/=e.fixedNodeConstraint.length,d.forEach(function(t,e){d[e]+=$.x}),c.forEach(function(t,e){c[e]+=$.y}),e.fixedNodeConstraint.forEach(function(t){d[l.get(t.nodeId)]=t.position.x,c[l.get(t.nodeId)]=t.position.y})}if(e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var Z=e.alignmentConstraint.vertical,J=n(function(t){var e=new Set;Z[t].forEach(function(t){e.add(t)});var i=new Set([].concat(r(e)).filter(function(t){return I.has(t)})),n=void 0;n=i.size>0?d[l.get(i.values().next().value)]:m(e).x,e.forEach(function(t){I.has(t)||(d[l.get(t)]=n)})},"_loop4"),Q=0;Q<Z.length;Q++)J(Q);if(e.alignmentConstraint.horizontal)for(var K=e.alignmentConstraint.horizontal,tt=n(function(t){var e=new Set;K[t].forEach(function(t){e.add(t)});var i=new Set([].concat(r(e)).filter(function(t){return I.has(t)})),n=void 0;n=i.size>0?c[l.get(i.values().next().value)]:m(e).y,e.forEach(function(t){I.has(t)||(c[l.get(t)]=n)})},"_loop5"),et=0;et<K.length;et++)tt(et)}e.relativePlacementConstraint&&function(){var t=new Map,i=new Map,r=new Map,o=new Map,a=new Map,s=new Map,h=new Set,g=new Set;if(I.forEach(function(t){h.add(t),g.add(t)}),e.alignmentConstraint){if(e.alignmentConstraint.vertical)for(var u=e.alignmentConstraint.vertical,p=n(function(e){r.set("dummy"+e,[]),u[e].forEach(function(i){t.set(i,"dummy"+e),r.get("dummy"+e).push(i),I.has(i)&&h.add("dummy"+e)}),a.set("dummy"+e,d[l.get(u[e][0])])},"_loop6"),f=0;f<u.length;f++)p(f);if(e.alignmentConstraint.horizontal)for(var y=e.alignmentConstraint.horizontal,m=n(function(t){o.set("dummy"+t,[]),y[t].forEach(function(e){i.set(e,"dummy"+t),o.get("dummy"+t).push(e),I.has(e)&&g.add("dummy"+t)}),s.set("dummy"+t,c[l.get(y[t][0])])},"_loop7"),E=0;E<y.length;E++)m(E)}var w=new Map,_=new Map,L=n(function(e){M.get(e).forEach(function(r){var n=void 0,o=void 0;"horizontal"==r.direction?(n=t.get(e)?t.get(e):e,o=t.get(r.id)?{id:t.get(r.id),gap:r.gap,direction:r.direction}:r,w.has(n)?w.get(n).push(o):w.set(n,[o]),w.has(o.id)||w.set(o.id,[])):(n=i.get(e)?i.get(e):e,o=i.get(r.id)?{id:i.get(r.id),gap:r.gap,direction:r.direction}:r,_.has(n)?_.get(n).push(o):_.set(n,[o]),_.has(o.id)||_.set(o.id,[]))})},"_loop8"),C=!0,x=!1,O=void 0;try{for(var D,b=M.keys()[Symbol.iterator]();!(C=(D=b.next()).done);C=!0){L(D.value)}}catch(t){x=!0,O=t}finally{try{!C&&b.return&&b.return()}finally{if(x)throw O}}var R=T(w),G=T(_),F=N(R),S=N(G),P=A(w),U=A(_),k=[],Y=[];F.forEach(function(t,e){k[e]=[],t.forEach(function(t){0==P.get(t).length&&k[e].push(t)})}),S.forEach(function(t,e){Y[e]=[],t.forEach(function(t){0==U.get(t).length&&Y[e].push(t)})});var H=v(w,"horizontal",h,a,k),X=v(_,"vertical",g,s,Y),z=n(function(t){r.get(t)?r.get(t).forEach(function(e){d[l.get(e)]=H.get(t)}):d[l.get(t)]=H.get(t)},"_loop9"),B=!0,V=!1,W=void 0;try{for(var j,q=H.keys()[Symbol.iterator]();!(B=(j=q.next()).done);B=!0){z(j.value)}}catch(t){V=!0,W=t}finally{try{!B&&q.return&&q.return()}finally{if(V)throw W}}var $=n(function(t){o.get(t)?o.get(t).forEach(function(e){c[l.get(e)]=X.get(t)}):c[l.get(t)]=X.get(t)},"_loop10"),Z=!0,J=!1,Q=void 0;try{for(var K,tt=X.keys()[Symbol.iterator]();!(Z=(K=tt.next()).done);Z=!0){$(K.value)}}catch(t){J=!0,Q=t}finally{try{!Z&&tt.return&&tt.return()}finally{if(J)throw Q}}}()}for(var it=0;it<g.length;it++){var rt=g[it];null==rt.getChild()&&rt.setCenter(d[l.get(rt.id)],c[l.get(rt.id)])}},t.exports=l},551:e=>{e.exports=t}},i={};function r(t){var n=i[t];if(void 0!==n)return n.exports;var o=i[t]={exports:{}};return e[t](o,o.exports,r),o.exports}return n(r,"__webpack_require__"),r(45)})()})}),M=w((t,e)=>{n(function(i,r){"object"==typeof t&&"object"==typeof e?e.exports=r(I()):"function"==typeof define&&define.amd?define(["cose-base"],r):"object"==typeof t?t.cytoscapeFcose=r(I()):i.cytoscapeFcose=r(i.coseBase)},"webpackUniversalModuleDefinition")(t,function(t){return(()=>{var e={658:t=>{t.exports=null!=Object.assign?Object.assign.bind(Object):function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return i.forEach(function(e){Object.keys(e).forEach(function(i){return t[i]=e[i]})}),t}},548:(t,e,i)=>{var r=function(){function t(t,e){var i=[],r=!0,n=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(i.push(a.value),!e||i.length!==e);r=!0);}catch(t){n=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}return i}return n(t,"sliceIterator"),function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=i(140).layoutBase.LinkedList,a={getTopMostNodes:function(t){for(var e={},i=0;i<t.length;i++)e[t[i].id()]=!0;return t.filter(function(t,i){"number"==typeof t&&(t=i);for(var r=t.parent()[0];null!=r;){if(e[r.id()])return!1;r=r.parent()[0]}return!0})},connectComponents:function(t,e,i,r){var a=new o,s=new Set,h=[],l=void 0,d=void 0,c=void 0,g=!1,u=1,p=[],f=[],y=n(function(){var r=t.collection();f.push(r);var o=i[0],y=t.collection();y.merge(o).merge(o.descendants().intersection(e)),h.push(o),y.forEach(function(t){a.push(t),s.add(t),r.merge(t)});for(var m=n(function(){o=a.shift();var n=t.collection();o.neighborhood().nodes().forEach(function(t){e.intersection(o.edgesWith(t)).length>0&&n.merge(t)});for(var d=0;d<n.length;d++){var c=n[d];if(null!=(l=i.intersection(c.union(c.ancestors())))&&!s.has(l[0]))l.union(l.descendants()).forEach(function(t){a.push(t),s.add(t),r.merge(t),i.has(t)&&h.push(t)})}},"_loop2");0!=a.length;)m();if(r.forEach(function(t){e.intersection(t.connectedEdges()).forEach(function(t){r.has(t.source())&&r.has(t.target())&&r.merge(t)})}),h.length==i.length&&(g=!0),!g||g&&u>1){d=h[0],c=d.connectedEdges().length,h.forEach(function(t){t.connectedEdges().length<c&&(c=t.connectedEdges().length,d=t)}),p.push(d.id());var v=t.collection();v.merge(h[0]),h.forEach(function(t){v.merge(t)}),h=[],i=i.difference(v),u++}},"_loop");do{y()}while(!g);return r&&p.length>0&&r.set("dummy"+(r.size+1),p),f},relocateComponent:function(t,e,i){if(!i.fixedNodeConstraint){var n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;if("draft"==i.quality){var h=!0,l=!1,d=void 0;try{for(var c,g=e.nodeIndexes[Symbol.iterator]();!(h=(c=g.next()).done);h=!0){var u=c.value,p=r(u,2),f=p[0],y=p[1],m=i.cy.getElementById(f);if(m){var v=m.boundingBox(),E=e.xCoords[y]-v.w/2,N=e.xCoords[y]+v.w/2,T=e.yCoords[y]-v.h/2,A=e.yCoords[y]+v.h/2;E<n&&(n=E),N>o&&(o=N),T<a&&(a=T),A>s&&(s=A)}}}catch(t){l=!0,d=t}finally{try{!h&&g.return&&g.return()}finally{if(l)throw d}}var w=t.x-(o+n)/2,_=t.y-(s+a)/2;e.xCoords=e.xCoords.map(function(t){return t+w}),e.yCoords=e.yCoords.map(function(t){return t+_})}else{Object.keys(e).forEach(function(t){var i=e[t],r=i.getRect().x,h=i.getRect().x+i.getRect().width,l=i.getRect().y,d=i.getRect().y+i.getRect().height;r<n&&(n=r),h>o&&(o=h),l<a&&(a=l),d>s&&(s=d)});var L=t.x-(o+n)/2,C=t.y-(s+a)/2;Object.keys(e).forEach(function(t){var i=e[t];i.setCenter(i.getCenterX()+L,i.getCenterY()+C)})}}},calcBoundingBox:function(t,e,i,r){for(var n=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER,h=void 0,l=void 0,d=void 0,c=void 0,g=t.descendants().not(":parent"),u=g.length,p=0;p<u;p++){var f=g[p];n>(h=e[r.get(f.id())]-f.width()/2)&&(n=h),o<(l=e[r.get(f.id())]+f.width()/2)&&(o=l),a>(d=i[r.get(f.id())]-f.height()/2)&&(a=d),s<(c=i[r.get(f.id())]+f.height()/2)&&(s=c)}var y={};return y.topLeftX=n,y.topLeftY=a,y.width=o-n,y.height=s-a,y},calcParentsWithoutChildren:function(t,e){var i=t.collection();return e.nodes(":parent").forEach(function(t){var e=!1;t.children().forEach(function(t){"none"!=t.css("display")&&(e=!0)}),e||i.merge(t)}),i}};t.exports=a},816:(t,e,i)=>{var r=i(548),o=i(140).CoSELayout,a=i(140).CoSENode,s=i(140).layoutBase.PointD,h=i(140).layoutBase.DimensionD,l=i(140).layoutBase.LayoutConstants,d=i(140).layoutBase.FDLayoutConstants,c=i(140).CoSEConstants,g=n(function(t,e){var i=t.cy,g=t.eles,u=g.nodes(),p=g.edges(),f=void 0,y=void 0,m=void 0,v={};t.randomize&&(f=e.nodeIndexes,y=e.xCoords,m=e.yCoords);var E=n(function(t){return"function"==typeof t},"isFn"),N=n(function(t,e){return E(t)?t(e):t},"optFn"),T=r.calcParentsWithoutChildren(i,g),A=n(function t(e,i,n,o){for(var l=i.length,d=0;d<l;d++){var c=i[d],g=null;0==c.intersection(T).length&&(g=c.children());var u=void 0,p=c.layoutDimensions({nodeDimensionsIncludeLabels:o.nodeDimensionsIncludeLabels});if(null!=c.outerWidth()&&null!=c.outerHeight())if(o.randomize)if(c.isParent()){var E=r.calcBoundingBox(c,y,m,f);u=0==c.intersection(T).length?e.add(new a(n.graphManager,new s(E.topLeftX,E.topLeftY),new h(E.width,E.height))):e.add(new a(n.graphManager,new s(E.topLeftX,E.topLeftY),new h(parseFloat(p.w),parseFloat(p.h))))}else u=e.add(new a(n.graphManager,new s(y[f.get(c.id())]-p.w/2,m[f.get(c.id())]-p.h/2),new h(parseFloat(p.w),parseFloat(p.h))));else u=e.add(new a(n.graphManager,new s(c.position("x")-p.w/2,c.position("y")-p.h/2),new h(parseFloat(p.w),parseFloat(p.h))));else u=e.add(new a(this.graphManager));if(u.id=c.data("id"),u.nodeRepulsion=N(o.nodeRepulsion,c),u.paddingLeft=parseInt(c.css("padding")),u.paddingTop=parseInt(c.css("padding")),u.paddingRight=parseInt(c.css("padding")),u.paddingBottom=parseInt(c.css("padding")),o.nodeDimensionsIncludeLabels&&(u.labelWidth=c.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,u.labelHeight=c.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,u.labelPosVertical=c.css("text-valign"),u.labelPosHorizontal=c.css("text-halign")),v[c.data("id")]=u,isNaN(u.rect.x)&&(u.rect.x=0),isNaN(u.rect.y)&&(u.rect.y=0),null!=g&&g.length>0){t(n.getGraphManager().add(n.newGraph(),u),g,n,o)}}},"processChildrenList"),w=n(function(e,i,r){for(var n=0,o=0,a=0;a<r.length;a++){var s=r[a],h=v[s.data("source")],l=v[s.data("target")];if(h&&l&&h!==l&&0==h.getEdgesBetween(l).length){var g=i.add(e.newEdge(),h,l);g.id=s.id(),g.idealLength=N(t.idealEdgeLength,s),g.edgeElasticity=N(t.edgeElasticity,s),n+=g.idealLength,o++}}null!=t.idealEdgeLength&&(o>0?c.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=n/o:E(t.idealEdgeLength)?c.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=50:c.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=t.idealEdgeLength,c.MIN_REPULSION_DIST=d.MIN_REPULSION_DIST=d.DEFAULT_EDGE_LENGTH/10,c.DEFAULT_RADIAL_SEPARATION=d.DEFAULT_EDGE_LENGTH)},"processEdges"),_=n(function(t,e){e.fixedNodeConstraint&&(t.constraints.fixedNodeConstraint=e.fixedNodeConstraint),e.alignmentConstraint&&(t.constraints.alignmentConstraint=e.alignmentConstraint),e.relativePlacementConstraint&&(t.constraints.relativePlacementConstraint=e.relativePlacementConstraint)},"processConstraints");null!=t.nestingFactor&&(c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=t.nestingFactor),null!=t.gravity&&(c.DEFAULT_GRAVITY_STRENGTH=d.DEFAULT_GRAVITY_STRENGTH=t.gravity),null!=t.numIter&&(c.MAX_ITERATIONS=d.MAX_ITERATIONS=t.numIter),null!=t.gravityRange&&(c.DEFAULT_GRAVITY_RANGE_FACTOR=d.DEFAULT_GRAVITY_RANGE_FACTOR=t.gravityRange),null!=t.gravityCompound&&(c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH=t.gravityCompound),null!=t.gravityRangeCompound&&(c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=t.gravityRangeCompound),null!=t.initialEnergyOnIncremental&&(c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.DEFAULT_COOLING_FACTOR_INCREMENTAL=t.initialEnergyOnIncremental),null!=t.tilingCompareBy&&(c.TILING_COMPARE_BY=t.tilingCompareBy),"proof"==t.quality?l.QUALITY=2:l.QUALITY=0,c.NODE_DIMENSIONS_INCLUDE_LABELS=d.NODE_DIMENSIONS_INCLUDE_LABELS=l.NODE_DIMENSIONS_INCLUDE_LABELS=t.nodeDimensionsIncludeLabels,c.DEFAULT_INCREMENTAL=d.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=!t.randomize,c.ANIMATE=d.ANIMATE=l.ANIMATE=t.animate,c.TILE=t.tile,c.TILING_PADDING_VERTICAL="function"==typeof t.tilingPaddingVertical?t.tilingPaddingVertical.call():t.tilingPaddingVertical,c.TILING_PADDING_HORIZONTAL="function"==typeof t.tilingPaddingHorizontal?t.tilingPaddingHorizontal.call():t.tilingPaddingHorizontal,c.DEFAULT_INCREMENTAL=d.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=!0,c.PURE_INCREMENTAL=!t.randomize,l.DEFAULT_UNIFORM_LEAF_NODE_SIZES=t.uniformNodeDimensions,"transformed"==t.step&&(c.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,c.ENFORCE_CONSTRAINTS=!1,c.APPLY_LAYOUT=!1),"enforced"==t.step&&(c.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,c.ENFORCE_CONSTRAINTS=!0,c.APPLY_LAYOUT=!1),"cose"==t.step&&(c.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,c.ENFORCE_CONSTRAINTS=!1,c.APPLY_LAYOUT=!0),"all"==t.step&&(t.randomize?c.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:c.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,c.ENFORCE_CONSTRAINTS=!0,c.APPLY_LAYOUT=!0),t.fixedNodeConstraint||t.alignmentConstraint||t.relativePlacementConstraint?c.TREE_REDUCTION_ON_INCREMENTAL=!1:c.TREE_REDUCTION_ON_INCREMENTAL=!0;var L=new o,C=L.newGraphManager();return A(C.addRoot(),r.getTopMostNodes(u),L,t),w(L,C,p),_(L,t),L.runLayout(),v},"coseLayout");t.exports={coseLayout:g}},212:(t,e,i)=>{var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return n(t,"defineProperties"),function(e,i,r){return i&&t(e.prototype,i),r&&t(e,r),e}}();function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n(o,"_classCallCheck");var a=i(658),s=i(548),h=i(657).spectralLayout,l=i(816).coseLayout,d=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:n(function(t){return 4500},"nodeRepulsion"),idealEdgeLength:n(function(t){return 50},"idealEdgeLength"),edgeElasticity:n(function(t){return.45},"edgeElasticity"),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:n(function(){},"ready"),stop:n(function(){},"stop")}),c=function(){function t(e){o(this,t),this.options=a({},d,e)}return n(t,"Layout"),r(t,[{key:"run",value:n(function(){var t=this.options,e=t.cy,i=t.eles,r=[],o=[],a=void 0,d=[];t.fixedNodeConstraint&&(!Array.isArray(t.fixedNodeConstraint)||0==t.fixedNodeConstraint.length)&&(t.fixedNodeConstraint=void 0),t.alignmentConstraint&&(t.alignmentConstraint.vertical&&(!Array.isArray(t.alignmentConstraint.vertical)||0==t.alignmentConstraint.vertical.length)&&(t.alignmentConstraint.vertical=void 0),t.alignmentConstraint.horizontal&&(!Array.isArray(t.alignmentConstraint.horizontal)||0==t.alignmentConstraint.horizontal.length)&&(t.alignmentConstraint.horizontal=void 0)),t.relativePlacementConstraint&&(!Array.isArray(t.relativePlacementConstraint)||0==t.relativePlacementConstraint.length)&&(t.relativePlacementConstraint=void 0),(t.fixedNodeConstraint||t.alignmentConstraint||t.relativePlacementConstraint)&&(t.tile=!1,t.packComponents=!1);var c=void 0,g=!1;if(e.layoutUtilities&&t.packComponents&&((c=e.layoutUtilities("get"))||(c=e.layoutUtilities()),g=!0),i.nodes().length>0)if(g){var u=s.getTopMostNodes(t.eles.nodes());if((a=s.connectComponents(e,t.eles,u)).forEach(function(t){var e=t.boundingBox();d.push({x:e.x1+e.w/2,y:e.y1+e.h/2})}),t.randomize&&a.forEach(function(e){t.eles=e,r.push(h(t))}),"default"==t.quality||"proof"==t.quality){var p=e.collection();if(t.tile){var f=new Map,y=0,m={nodeIndexes:f,xCoords:[],yCoords:[]},v=[];if(a.forEach(function(t,e){0==t.edges().length&&(t.nodes().forEach(function(e,i){p.merge(t.nodes()[i]),e.isParent()||(m.nodeIndexes.set(t.nodes()[i].id(),y++),m.xCoords.push(t.nodes()[0].position().x),m.yCoords.push(t.nodes()[0].position().y))}),v.push(e))}),p.length>1){var E=p.boundingBox();d.push({x:E.x1+E.w/2,y:E.y1+E.h/2}),a.push(p),r.push(m);for(var N=v.length-1;N>=0;N--)a.splice(v[N],1),r.splice(v[N],1),d.splice(v[N],1)}}a.forEach(function(e,i){t.eles=e,o.push(l(t,r[i])),s.relocateComponent(d[i],o[i],t)})}else a.forEach(function(e,i){s.relocateComponent(d[i],r[i],t)});var T=new Set;if(a.length>1){var A=[],w=i.filter(function(t){return"none"==t.css("display")});a.forEach(function(e,i){var n=void 0;if("draft"==t.quality&&(n=r[i].nodeIndexes),e.nodes().not(w).length>0){var a={edges:[],nodes:[]},h=void 0;e.nodes().not(w).forEach(function(e){if("draft"==t.quality)if(e.isParent()){var l=s.calcBoundingBox(e,r[i].xCoords,r[i].yCoords,n);a.nodes.push({x:l.topLeftX,y:l.topLeftY,width:l.width,height:l.height})}else h=n.get(e.id()),a.nodes.push({x:r[i].xCoords[h]-e.boundingbox().w/2,y:r[i].yCoords[h]-e.boundingbox().h/2,width:e.boundingbox().w,height:e.boundingbox().h});else o[i][e.id()]&&a.nodes.push({x:o[i][e.id()].getLeft(),y:o[i][e.id()].getTop(),width:o[i][e.id()].getWidth(),height:o[i][e.id()].getHeight()})}),e.edges().forEach(function(e){var h=e.source(),l=e.target();if("none"!=h.css("display")&&"none"!=l.css("display"))if("draft"==t.quality){var d=n.get(h.id()),c=n.get(l.id()),g=[],u=[];if(h.isParent()){var p=s.calcBoundingBox(h,r[i].xCoords,r[i].yCoords,n);g.push(p.topLeftX+p.width/2),g.push(p.topLeftY+p.height/2)}else g.push(r[i].xCoords[d]),g.push(r[i].yCoords[d]);if(l.isParent()){var f=s.calcBoundingBox(l,r[i].xCoords,r[i].yCoords,n);u.push(f.topLeftX+f.width/2),u.push(f.topLeftY+f.height/2)}else u.push(r[i].xCoords[c]),u.push(r[i].yCoords[c]);a.edges.push({startX:g[0],startY:g[1],endX:u[0],endY:u[1]})}else o[i][h.id()]&&o[i][l.id()]&&a.edges.push({startX:o[i][h.id()].getCenterX(),startY:o[i][h.id()].getCenterY(),endX:o[i][l.id()].getCenterX(),endY:o[i][l.id()].getCenterY()})}),a.nodes.length>0&&(A.push(a),T.add(i))}});var _=c.packComponents(A,t.randomize).shifts;if("draft"==t.quality)r.forEach(function(t,e){var i=t.xCoords.map(function(t){return t+_[e].dx}),r=t.yCoords.map(function(t){return t+_[e].dy});t.xCoords=i,t.yCoords=r});else{var L=0;T.forEach(function(t){Object.keys(o[t]).forEach(function(e){var i=o[t][e];i.setCenter(i.getCenterX()+_[L].dx,i.getCenterY()+_[L].dy)}),L++})}}}else{var C=t.eles.boundingBox();if(d.push({x:C.x1+C.w/2,y:C.y1+C.h/2}),t.randomize){var I=h(t);r.push(I)}"default"==t.quality||"proof"==t.quality?(o.push(l(t,r[0])),s.relocateComponent(d[0],o[0],t)):s.relocateComponent(d[0],r[0],t)}var M=n(function(e,i){if("default"==t.quality||"proof"==t.quality){"number"==typeof e&&(e=i);var n=void 0,a=void 0,s=e.data("id");return o.forEach(function(t){s in t&&(n={x:t[s].getRect().getCenterX(),y:t[s].getRect().getCenterY()},a=t[s])}),t.nodeDimensionsIncludeLabels&&(a.labelWidth&&("left"==a.labelPosHorizontal?n.x+=a.labelWidth/2:"right"==a.labelPosHorizontal&&(n.x-=a.labelWidth/2)),a.labelHeight&&("top"==a.labelPosVertical?n.y+=a.labelHeight/2:"bottom"==a.labelPosVertical&&(n.y-=a.labelHeight/2))),null==n&&(n={x:e.position("x"),y:e.position("y")}),{x:n.x,y:n.y}}var h=void 0;return r.forEach(function(t){var i=t.nodeIndexes.get(e.id());null!=i&&(h={x:t.xCoords[i],y:t.yCoords[i]})}),null==h&&(h={x:e.position("x"),y:e.position("y")}),{x:h.x,y:h.y}},"getPositions");if("default"==t.quality||"proof"==t.quality||t.randomize){var x=s.calcParentsWithoutChildren(e,i),O=i.filter(function(t){return"none"==t.css("display")});t.eles=i.not(O),i.nodes().not(":parent").not(O).layoutPositions(this,t,M),x.length>0&&x.forEach(function(t){t.position(M(t))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")},"run")}]),t}();t.exports=c},657:(t,e,i)=>{var r=i(548),o=i(140).layoutBase.Matrix,a=i(140).layoutBase.SVD,s=n(function(t){var e=t.cy,i=t.eles,s=i.nodes(),h=i.nodes(":parent"),l=new Map,d=new Map,c=new Map,g=[],u=[],p=[],f=[],y=[],m=[],v=[],E=[],N=void 0,T=1e8,A=1e-9,w=t.piTol,_=t.samplingType,L=t.nodeSeparation,C=void 0,I=n(function(){for(var t=0,e=0,i=!1;e<C;){t=Math.floor(Math.random()*N),i=!1;for(var r=0;r<e;r++)if(f[r]==t){i=!0;break}i||(f[e]=t,e++)}},"randomSampleCR"),M=n(function(t,e,i){for(var r=[],n=0,o=0,a=0,s=void 0,h=[],l=0,c=1,u=0;u<N;u++)h[u]=T;for(r[o]=t,h[t]=0;o>=n;){a=r[n++];for(var p=g[a],f=0;f<p.length;f++)h[s=d.get(p[f])]==T&&(h[s]=h[a]+1,r[++o]=s);m[a][e]=h[a]*L}if(i){for(var v=0;v<N;v++)m[v][e]<y[v]&&(y[v]=m[v][e]);for(var E=0;E<N;E++)y[E]>l&&(l=y[E],c=E)}return c},"BFS"),x=n(function(t){var e=void 0;if(t){e=Math.floor(Math.random()*N);for(var i=0;i<N;i++)y[i]=T;for(var r=0;r<C;r++)f[r]=e,e=M(e,r,t)}else{I();for(var n=0;n<C;n++)M(f[n],n,t,!1)}for(var o=0;o<N;o++)for(var a=0;a<C;a++)m[o][a]*=m[o][a];for(var s=0;s<C;s++)v[s]=[];for(var h=0;h<C;h++)for(var l=0;l<C;l++)v[h][l]=m[f[l]][h]},"allBFS"),O=n(function(){for(var t=a.svd(v),e=t.S,i=t.U,r=t.V,n=e[0]*e[0]*e[0],s=[],h=0;h<C;h++){s[h]=[];for(var l=0;l<C;l++)s[h][l]=0,h==l&&(s[h][l]=e[h]/(e[h]*e[h]+n/(e[h]*e[h])))}E=o.multMat(o.multMat(r,s),o.transpose(i))},"sample"),D=n(function(){for(var t=void 0,e=void 0,i=[],r=[],n=[],a=[],s=0;s<N;s++)i[s]=Math.random(),r[s]=Math.random();i=o.normalize(i),r=o.normalize(r);for(var h=A,l=A,d=void 0;;){0;for(var c=0;c<N;c++)n[c]=i[c];if(i=o.multGamma(o.multL(o.multGamma(n),m,E)),t=o.dotProduct(n,i),i=o.normalize(i),h=o.dotProduct(n,i),(d=Math.abs(h/l))<=1+w&&d>=1)break;l=h}for(var g=0;g<N;g++)n[g]=i[g];for(l=A;;){0;for(var f=0;f<N;f++)a[f]=r[f];if(a=o.minusOp(a,o.multCons(n,o.dotProduct(n,a))),r=o.multGamma(o.multL(o.multGamma(a),m,E)),e=o.dotProduct(a,r),r=o.normalize(r),h=o.dotProduct(a,r),(d=Math.abs(h/l))<=1+w&&d>=1)break;l=h}for(var y=0;y<N;y++)a[y]=r[y];u=o.multCons(n,Math.sqrt(Math.abs(t))),p=o.multCons(a,Math.sqrt(Math.abs(e)))},"powerIteration");r.connectComponents(e,i,r.getTopMostNodes(s),l),h.forEach(function(t){r.connectComponents(e,i,r.getTopMostNodes(t.descendants().intersection(i)),l)});for(var b=0,R=0;R<s.length;R++)s[R].isParent()||d.set(s[R].id(),b++);var G=!0,F=!1,S=void 0;try{for(var P,U=l.keys()[Symbol.iterator]();!(G=(P=U.next()).done);G=!0){var k=P.value;d.set(k,b++)}}catch(t){F=!0,S=t}finally{try{!G&&U.return&&U.return()}finally{if(F)throw S}}for(var Y=0;Y<d.size;Y++)g[Y]=[];h.forEach(function(t){for(var e=t.children().intersection(i);0==e.nodes(":childless").length;)e=e.nodes()[0].children().intersection(i);var r=0,n=e.nodes(":childless")[0].connectedEdges().length;e.nodes(":childless").forEach(function(t,e){t.connectedEdges().length<n&&(n=t.connectedEdges().length,r=e)}),c.set(t.id(),e.nodes(":childless")[r].id())}),s.forEach(function(t){var e=void 0;e=t.isParent()?d.get(c.get(t.id())):d.get(t.id()),t.neighborhood().nodes().forEach(function(r){i.intersection(t.edgesWith(r)).length>0&&(r.isParent()?g[e].push(c.get(r.id())):g[e].push(r.id()))})});var H=n(function(t){var i=d.get(t),r=void 0;l.get(t).forEach(function(n){r=e.getElementById(n).isParent()?c.get(n):n,g[i].push(r),g[d.get(r)].push(t)})},"_loop"),X=!0,z=!1,B=void 0;try{for(var V,W=l.keys()[Symbol.iterator]();!(X=(V=W.next()).done);X=!0){H(V.value)}}catch(t){z=!0,B=t}finally{try{!X&&W.return&&W.return()}finally{if(z)throw B}}var j=void 0;if((N=d.size)>2){C=N<t.sampleSize?N:t.sampleSize;for(var q=0;q<N;q++)m[q]=[];for(var $=0;$<C;$++)E[$]=[];return"draft"==t.quality||"all"==t.step?(x(_),O(),D(),j={nodeIndexes:d,xCoords:u,yCoords:p}):(d.forEach(function(t,i){u.push(e.getElementById(i).position("x")),p.push(e.getElementById(i).position("y"))}),j={nodeIndexes:d,xCoords:u,yCoords:p}),j}var Z=d.keys(),J=e.getElementById(Z.next().value),Q=J.position(),K=J.outerWidth();if(u.push(Q.x),p.push(Q.y),2==N){var tt=e.getElementById(Z.next().value).outerWidth();u.push(Q.x+K/2+tt/2+t.idealEdgeLength),p.push(Q.y)}return j={nodeIndexes:d,xCoords:u,yCoords:p}},"spectralLayout");t.exports={spectralLayout:s}},579:(t,e,i)=>{var r=i(212),o=n(function(t){t&&t("layout","fcose",r)},"register");typeof cytoscape<"u"&&o(cytoscape),t.exports=o},140:e=>{e.exports=t}},i={};function r(t){var n=i[t];if(void 0!==n)return n.exports;var o=i[t]={exports:{}};return e[t](o,o.exports,r),o.exports}return n(r,"__webpack_require__"),r(579)})()})}),x={L:"left",R:"right",T:"top",B:"bottom"},O={L:n(t=>`${t},${t/2} 0,${t} 0,0`,"L"),R:n(t=>`0,${t/2} ${t},0 ${t},${t}`,"R"),T:n(t=>`0,0 ${t},0 ${t/2},${t}`,"T"),B:n(t=>`${t/2},0 ${t},${t} 0,${t}`,"B")},D={L:n((t,e)=>t-e+2,"L"),R:n((t,e)=>t-2,"R"),T:n((t,e)=>t-e+2,"T"),B:n((t,e)=>t-2,"B")},b=n(function(t){return G(t)?"L"===t?"R":"L":"T"===t?"B":"T"},"getOppositeArchitectureDirection"),R=n(function(t){return"L"===t||"R"===t||"T"===t||"B"===t},"isArchitectureDirection"),G=n(function(t){return"L"===t||"R"===t},"isArchitectureDirectionX"),F=n(function(t){return"T"===t||"B"===t},"isArchitectureDirectionY"),S=n(function(t,e){let i=G(t)&&F(e),r=F(t)&&G(e);return i||r},"isArchitectureDirectionXY"),P=n(function(t){let e=t[0],i=t[1],r=G(e)&&F(i),n=F(e)&&G(i);return r||n},"isArchitecturePairXY"),U=n(function(t){return"LL"!==t&&"RR"!==t&&"TT"!==t&&"BB"!==t},"isValidArchitectureDirectionPair"),k=n(function(t,e){let i=`${t}${e}`;return U(i)?i:void 0},"getArchitectureDirectionPair"),Y=n(function([t,e],i){let r=i[0],n=i[1];return G(r)?F(n)?[t+("L"===r?-1:1),e+("T"===n?1:-1)]:[t+("L"===r?-1:1),e]:G(n)?[t+("L"===n?1:-1),e+("T"===r?1:-1)]:[t,e+("T"===r?1:-1)]},"shiftPositionByArchitectureDirectionPair"),H=n(function(t){return"LT"===t||"TL"===t?[1,1]:"BL"===t||"LB"===t?[1,-1]:"BR"===t||"RB"===t?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),X=n(function(t,e){return S(t,e)?"bend":G(t)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),z=n(function(t){return"service"===t.type},"isArchitectureService"),B=n(function(t){return"junction"===t.type},"isArchitectureJunction"),V=n(t=>t.data(),"edgeData"),W=n(t=>t.data(),"nodeData"),j=f.architecture,q=new i(()=>({nodes:{},groups:{},edges:[],registeredIds:{},config:j,dataStructures:void 0,elements:{}})),$=n(()=>{q.reset(),y()},"clear"),Z=n(function({id:t,icon:e,in:i,title:r,iconText:n}){if(void 0!==q.records.registeredIds[t])throw new Error(`The service id [${t}] is already in use by another ${q.records.registeredIds[t]}`);if(void 0!==i){if(t===i)throw new Error(`The service [${t}] cannot be placed within itself`);if(void 0===q.records.registeredIds[i])throw new Error(`The service [${t}]'s parent does not exist. Please make sure the parent is created before this service`);if("node"===q.records.registeredIds[i])throw new Error(`The service [${t}]'s parent is not a group`)}q.records.registeredIds[t]="node",q.records.nodes[t]={id:t,type:"service",icon:e,iconText:n,title:r,edges:[],in:i}},"addService"),J=n(()=>Object.values(q.records.nodes).filter(z),"getServices"),Q=n(function({id:t,in:e}){q.records.registeredIds[t]="node",q.records.nodes[t]={id:t,type:"junction",edges:[],in:e}},"addJunction"),K=n(()=>Object.values(q.records.nodes).filter(B),"getJunctions"),tt=n(()=>Object.values(q.records.nodes),"getNodes"),et=n(t=>q.records.nodes[t],"getNode"),it=n(function({id:t,icon:e,in:i,title:r}){if(void 0!==q.records.registeredIds[t])throw new Error(`The group id [${t}] is already in use by another ${q.records.registeredIds[t]}`);if(void 0!==i){if(t===i)throw new Error(`The group [${t}] cannot be placed within itself`);if(void 0===q.records.registeredIds[i])throw new Error(`The group [${t}]'s parent does not exist. Please make sure the parent is created before this group`);if("node"===q.records.registeredIds[i])throw new Error(`The group [${t}]'s parent is not a group`)}q.records.registeredIds[t]="group",q.records.groups[t]={id:t,icon:e,title:r,in:i}},"addGroup"),rt=n(()=>Object.values(q.records.groups),"getGroups"),nt=n(function({lhsId:t,rhsId:e,lhsDir:i,rhsDir:r,lhsInto:n,rhsInto:o,lhsGroup:a,rhsGroup:s,title:h}){if(!R(i))throw new Error(`Invalid direction given for left hand side of edge ${t}--${e}. Expected (L,R,T,B) got ${i}`);if(!R(r))throw new Error(`Invalid direction given for right hand side of edge ${t}--${e}. Expected (L,R,T,B) got ${r}`);if(void 0===q.records.nodes[t]&&void 0===q.records.groups[t])throw new Error(`The left-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(void 0===q.records.nodes[e]&&void 0===q.records.groups[t])throw new Error(`The right-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`);let l=q.records.nodes[t].in,d=q.records.nodes[e].in;if(a&&l&&d&&l==d)throw new Error(`The left-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(s&&l&&d&&l==d)throw new Error(`The right-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let c={lhsId:t,lhsDir:i,lhsInto:n,lhsGroup:a,rhsId:e,rhsDir:r,rhsInto:o,rhsGroup:s,title:h};q.records.edges.push(c),q.records.nodes[t]&&q.records.nodes[e]&&(q.records.nodes[t].edges.push(q.records.edges[q.records.edges.length-1]),q.records.nodes[e].edges.push(q.records.edges[q.records.edges.length-1]))},"addEdge"),ot=n(()=>q.records.edges,"getEdges"),at=n(()=>{if(void 0===q.records.dataStructures){let t={},e=Object.entries(q.records.nodes).reduce((e,[i,r])=>(e[i]=r.edges.reduce((e,r)=>{let n=et(r.lhsId)?.in,o=et(r.rhsId)?.in;if(n&&o&&n!==o){let e=X(r.lhsDir,r.rhsDir);"bend"!==e&&(t[n]??={},t[n][o]=e,t[o]??={},t[o][n]=e)}if(r.lhsId===i){let t=k(r.lhsDir,r.rhsDir);t&&(e[t]=r.rhsId)}else{let t=k(r.rhsDir,r.lhsDir);t&&(e[t]=r.lhsId)}return e},{}),e),{}),i=Object.keys(e)[0],r={[i]:1},o=Object.keys(e).reduce((t,e)=>e===i?t:{...t,[e]:1},{}),a=n(t=>{let i={[t]:[0,0]},n=[t];for(;n.length>0;){let t=n.shift();if(t){r[t]=1,delete o[t];let a=e[t],[s,h]=i[t];Object.entries(a).forEach(([t,e])=>{r[e]||(i[e]=Y([s,h],t),n.push(e))})}}return i},"BFS"),s=[a(i)];for(;Object.keys(o).length>0;)s.push(a(Object.keys(o)[0]));q.records.dataStructures={adjList:e,spatialMaps:s,groupAlignments:t}}return q.records.dataStructures},"getDataStructures"),st=n((t,e)=>{q.records.elements[t]=e},"setElementForId"),ht=n(t=>q.records.elements[t],"getElementById"),lt=n(()=>u({...j,...p().architecture}),"getConfig"),dt={clear:$,setDiagramTitle:d,getDiagramTitle:l,setAccTitle:h,getAccTitle:s,setAccDescription:a,getAccDescription:o,getConfig:lt,addService:Z,getServices:J,addJunction:Q,getJunctions:K,getNodes:tt,getNode:et,addGroup:it,getGroups:rt,addEdge:nt,getEdges:ot,setElementForId:st,getElementById:ht,getDataStructures:at};function ct(t){return lt()[t]}n(ct,"getConfigField");var gt=n((t,i)=>{e(t,i),t.groups.map(i.addGroup),t.services.map(t=>i.addService({...t,type:"service"})),t.junctions.map(t=>i.addJunction({...t,type:"junction"})),t.edges.map(i.addEdge)},"populateDb"),ut={parse:n(async t=>{let e=await r("architecture",t);m.debug(e),gt(e,dt)},"parse")},pt=n(t=>`\n .edge {\n stroke-width: ${t.archEdgeWidth};\n stroke: ${t.archEdgeColor};\n fill: none;\n }\n\n .arrow {\n fill: ${t.archEdgeArrowColor};\n }\n\n .node-bkg {\n fill: none;\n stroke: ${t.archGroupBorderColor};\n stroke-width: ${t.archGroupBorderWidth};\n stroke-dasharray: 8;\n }\n .node-icon-text {\n display: flex;\n align-items: center;\n }\n\n .node-icon-text > div {\n color: #fff;\n margin: 1px;\n height: fit-content;\n text-align: center;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n }\n`,"getStyles"),ft=A(M()),yt=n(t=>`<g><rect width="80" height="80" style="fill: #087ebf; stroke-width: 0px;"/>${t}</g>`,"wrapIcon"),mt={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:yt('<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:yt('<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:yt('<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:yt('<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:yt('<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:L,blank:{body:yt("")}}},vt=n(async function(t,e){let i=ct("padding"),r=ct("iconSize"),n=r/2,o=r/6,a=o/2;await Promise.all(e.edges().map(async e=>{let{source:r,sourceDir:s,sourceArrow:h,sourceGroup:l,target:d,targetDir:c,targetArrow:g,targetGroup:u,label:p}=V(e),{x:f,y:y}=e[0].sourceEndpoint(),{x:m,y:N}=e[0].midpoint(),{x:T,y:A}=e[0].targetEndpoint(),w=i+4;if(l&&(G(s)?f+="L"===s?-w:w:y+="T"===s?-w:w+18),u&&(G(c)?T+="L"===c?-w:w:A+="T"===c?-w:w+18),!l&&"junction"===dt.getNode(r)?.type&&(G(s)?f+="L"===s?n:-n:y+="T"===s?n:-n),!u&&"junction"===dt.getNode(d)?.type&&(G(c)?T+="L"===c?n:-n:A+="T"===c?n:-n),e[0]._private.rscratch){let e=t.insert("g");if(e.insert("path").attr("d",`M ${f},${y} L ${m},${N} L${T},${A} `).attr("class","edge"),h){let t=G(s)?D[s](f,o):f-a,i=F(s)?D[s](y,o):y-a;e.insert("polygon").attr("points",O[s](o)).attr("transform",`translate(${t},${i})`).attr("class","arrow")}if(g){let t=G(c)?D[c](T,o):T-a,i=F(c)?D[c](A,o):A-a;e.insert("polygon").attr("points",O[c](o)).attr("transform",`translate(${t},${i})`).attr("class","arrow")}if(p){let t=S(s,c)?"XY":G(s)?"X":"Y",i=0;i="X"===t?Math.abs(f-T):"Y"===t?Math.abs(y-A)/1.5:Math.abs(f-T)/2;let r=e.append("g");if(await v(r,p,{useHtmlLabels:!1,width:i,classes:"architecture-service-label"},E()),r.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),"X"===t)r.attr("transform","translate("+m+", "+N+")");else if("Y"===t)r.attr("transform","translate("+m+", "+N+") rotate(-90)");else if("XY"===t){let t=k(s,c);if(t&&P(t)){let e=r.node().getBoundingClientRect(),[i,n]=H(t);r.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*i*n*45})`);let o=r.node().getBoundingClientRect();r.attr("transform",`\n translate(${m}, ${N-e.height/2})\n translate(${i*o.width/2}, ${n*o.height/2})\n rotate(${-1*i*n*45}, 0, ${e.height/2})\n `)}}}}}))},"drawEdges"),Et=n(async function(t,e){let i=.75*ct("padding"),r=ct("fontSize"),n=ct("iconSize")/2;await Promise.all(e.nodes().map(async e=>{let o=W(e);if("group"===o.type){let{h:a,w:s,x1:h,y1:l}=e.boundingBox();t.append("rect").attr("x",h+n).attr("y",l+n).attr("width",s).attr("height",a).attr("class","node-bkg");let d=t.append("g"),c=h,g=l;if(o.icon){let t=d.append("g");t.html(`<g>${await N(o.icon,{height:i,width:i,fallbackPrefix:mt.prefix})}</g>`),t.attr("transform","translate("+(c+n+1)+", "+(g+n+1)+")"),c+=i,g+=r/2-1-2}if(o.label){let t=d.append("g");await v(t,o.label,{useHtmlLabels:!1,width:s,classes:"architecture-service-label"},E()),t.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),t.attr("transform","translate("+(c+n+4)+", "+(g+n+2)+")")}}}))},"drawGroups"),Nt=n(async function(t,e,i){for(let r of i){let i=e.append("g"),n=ct("iconSize");if(r.title){let t=i.append("g");await v(t,r.title,{useHtmlLabels:!1,width:1.5*n,classes:"architecture-service-label"},E()),t.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),t.attr("transform","translate("+n/2+", "+n+")")}let o=i.append("g");if(r.icon)o.html(`<g>${await N(r.icon,{height:n,width:n,fallbackPrefix:mt.prefix})}</g>`);else if(r.iconText){o.html(`<g>${await N("blank",{height:n,width:n,fallbackPrefix:mt.prefix})}</g>`);let t=o.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(r.iconText),e=parseInt(window.getComputedStyle(t.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;t.attr("style",`-webkit-line-clamp: ${Math.floor((n-2)/e)};`)}else o.append("path").attr("class","node-bkg").attr("id","node-"+r.id).attr("d",`M0 ${n} v${-n} q0,-5 5,-5 h${n} q5,0 5,5 v${n} H0 Z`);i.attr("class","architecture-service");let{width:a,height:s}=i._groups[0][0].getBBox();r.width=a,r.height=s,t.setElementForId(r.id,i)}return 0},"drawServices"),Tt=n(function(t,e,i){i.forEach(i=>{let r=e.append("g"),n=ct("iconSize");r.append("g").append("rect").attr("id","node-"+i.id).attr("fill-opacity","0").attr("width",n).attr("height",n),r.attr("class","architecture-junction");let{width:o,height:a}=r._groups[0][0].getBBox();r.width=o,r.height=a,t.setElementForId(i.id,r)})},"drawJunctions");function At(t,e){t.forEach(t=>{e.add({group:"nodes",data:{type:"service",id:t.id,icon:t.icon,label:t.title,parent:t.in,width:ct("iconSize"),height:ct("iconSize")},classes:"node-service"})})}function wt(t,e){t.forEach(t=>{e.add({group:"nodes",data:{type:"junction",id:t.id,parent:t.in,width:ct("iconSize"),height:ct("iconSize")},classes:"node-junction"})})}function _t(t,e){e.nodes().map(e=>{let i=W(e);"group"!==i.type&&(i.x=e.position().x,i.y=e.position().y,t.getElementById(i.id).attr("transform","translate("+(i.x||0)+","+(i.y||0)+")"))})}function Lt(t,e){t.forEach(t=>{e.add({group:"nodes",data:{type:"group",id:t.id,icon:t.icon,label:t.title,parent:t.in},classes:"node-group"})})}function Ct(t,e){t.forEach(t=>{let{lhsId:i,rhsId:r,lhsInto:n,lhsGroup:o,rhsInto:a,lhsDir:s,rhsDir:h,rhsGroup:l,title:d}=t,c=S(t.lhsDir,t.rhsDir)?"segments":"straight",g={id:`${i}-${r}`,label:d,source:i,sourceDir:s,sourceArrow:n,sourceGroup:o,sourceEndpoint:"L"===s?"0 50%":"R"===s?"100% 50%":"T"===s?"50% 0":"50% 100%",target:r,targetDir:h,targetArrow:a,targetGroup:l,targetEndpoint:"L"===h?"0 50%":"R"===h?"100% 50%":"T"===h?"50% 0":"50% 100%"};e.add({group:"edges",data:g,classes:c})})}function It(t,e,i){let r=n((t,e)=>Object.entries(t).reduce((t,[r,n])=>{let o=0,a=Object.entries(n);if(1===a.length)return t[r]=a[0][1],t;for(let n=0;n<a.length-1;n++)for(let s=n+1;s<a.length;s++){let[h,l]=a[n],[d,c]=a[s];if(i[h]?.[d]===e)t[r]??=[],t[r]=[...t[r],...l,...c];else if("default"===h||"default"===d)t[r]??=[],t[r]=[...t[r],...l,...c];else{t[`${r}-${o++}`]=l,t[`${r}-${o++}`]=c}}return t},{}),"flattenAlignments"),o=e.map(e=>{let i={},n={};return Object.entries(e).forEach(([e,[r,o]])=>{let a=t.getNode(e)?.in??"default";i[o]??={},i[o][a]??=[],i[o][a].push(e),n[r]??={},n[r][a]??=[],n[r][a].push(e)}),{horiz:Object.values(r(i,"horizontal")).filter(t=>t.length>1),vert:Object.values(r(n,"vertical")).filter(t=>t.length>1)}}),[a,s]=o.reduce(([t,e],{horiz:i,vert:r})=>[[...t,...i],[...e,...r]],[[],[]]);return{horizontal:a,vertical:s}}function Mt(t){let e=[],i=n(t=>`${t[0]},${t[1]}`,"posToStr"),r=n(t=>t.split(",").map(t=>parseInt(t)),"strToPos");return t.forEach(t=>{let n=Object.fromEntries(Object.entries(t).map(([t,e])=>[i(e),t])),o=[i([0,0])],a={},s={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;o.length>0;){let t=o.shift();if(t){a[t]=1;let h=n[t];if(h){let l=r(t);Object.entries(s).forEach(([t,r])=>{let s=i([l[0]+r[0],l[1]+r[1]]),d=n[s];d&&!a[s]&&(o.push(s),e.push({[x[t]]:d,[x[b(t)]]:h,gap:1.5*ct("iconSize")}))})}}}}),e}function xt(e,i,r,o,a,{spatialMaps:s,groupAlignments:h}){return new Promise(l=>{let d=T("body").append("div").attr("id","cy").attr("style","display:none"),c=t({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight",label:"data(label)","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${ct("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:`${ct("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});d.remove(),Lt(r,c),At(e,c),wt(i,c),Ct(o,c);let g=It(a,s,h),u=Mt(s),p=c.layout({name:"fcose",quality:"proof",styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(t){let[e,i]=t.connectedNodes(),{parent:r}=W(e),{parent:n}=W(i);return r===n?1.5*ct("iconSize"):.5*ct("iconSize")},edgeElasticity(t){let[e,i]=t.connectedNodes(),{parent:r}=W(e),{parent:n}=W(i);return r===n?.45:.001},alignmentConstraint:g,relativePlacementConstraint:u});p.one("layoutstop",()=>{function t(t,e,i,r){let n,o,{x:a,y:s}=t,{x:h,y:l}=e;o=(r-s+(a-i)*(s-l)/(a-h))/Math.sqrt(1+Math.pow((s-l)/(a-h),2)),n=Math.sqrt(Math.pow(r-s,2)+Math.pow(i-a,2)-Math.pow(o,2)),n/=Math.sqrt(Math.pow(h-a,2)+Math.pow(l-s,2));let d=(h-a)*(r-s)-(l-s)*(i-a);switch(!0){case d>=0:d=1;break;case d<0:d=-1}let c=(h-a)*(i-a)+(l-s)*(r-s);switch(!0){case c>=0:c=1;break;case c<0:c=-1}return o=Math.abs(o)*d,n*=c,{distances:o,weights:n}}n(t,"getSegmentWeights"),c.startBatch();for(let e of Object.values(c.edges()))if(e.data?.()){let{x:i,y:r}=e.source().position(),{x:n,y:o}=e.target().position();if(i!==n&&r!==o){let i=e.sourceEndpoint(),r=e.targetEndpoint(),{sourceDir:n}=V(e),[o,a]=F(n)?[i.x,r.y]:[r.x,i.y],{weights:s,distances:h}=t(i,r,o,a);e.style("segment-distances",h),e.style("segment-weights",s)}}c.endBatch(),p.run()}),p.run(),c.ready(t=>{m.info("Ready",t),l(c)})})}_([{name:mt.prefix,icons:mt}]),t.use(ft.default),n(At,"addServices"),n(wt,"addJunctions"),n(_t,"positionNodes"),n(Lt,"addGroups"),n(Ct,"addEdges"),n(It,"getAlignments"),n(Mt,"getRelativeConstraints"),n(xt,"layoutArchitecture");var Ot=n(async(t,e,i,r)=>{let n=r.db,o=n.getServices(),a=n.getJunctions(),s=n.getGroups(),h=n.getEdges(),l=n.getDataStructures(),d=c(e),u=d.append("g");u.attr("class","architecture-edges");let p=d.append("g");p.attr("class","architecture-services");let f=d.append("g");f.attr("class","architecture-groups"),await Nt(n,p,o),Tt(n,p,a);let y=await xt(o,a,s,h,n,l);await vt(u,y),await Et(f,y),_t(n,y),g(void 0,d,ct("padding"),ct("useMaxWidth"))},"draw"),Dt={parser:ut,db:dt,renderer:{draw:Ot},styles:pt};export{Dt as diagram};
//# sourceMappingURL=architectureDiagram-KNYM2FM5-c302dij-.js.map