hexwright 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js ADDED
@@ -0,0 +1,339 @@
1
+ "use strict";(()=>{var eh=Object.create;var ml=Object.defineProperty;var th=Object.getOwnPropertyDescriptor;var rh=Object.getOwnPropertyNames;var ah=Object.getPrototypeOf,nh=Object.prototype.hasOwnProperty;var Pi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ih=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of rh(e))!nh.call(t,n)&&n!==r&&ml(t,n,{get:()=>e[n],enumerable:!(a=th(e,n))||a.enumerable});return t};var oh=(t,e,r)=>(r=t!=null?eh(ah(t)):{},ih(e||!t||!t.__esModule?ml(r,"default",{value:t,enumerable:!0}):r,t));var rl=Pi((pn,tl)=>{"use strict";(function(e,r){typeof pn=="object"&&typeof tl=="object"?tl.exports=r():typeof define=="function"&&define.amd?define([],r):typeof pn=="object"?pn.layoutBase=r():e.layoutBase=r()})(pn,function(){return(function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.i=function(a){return a},r.d=function(a,n,i){r.o(a,n)||Object.defineProperty(a,n,{configurable:!1,enumerable:!0,get:i})},r.n=function(a){var n=a&&a.__esModule?function(){return a.default}:function(){return a};return r.d(n,"a",n),n},r.o=function(a,n){return Object.prototype.hasOwnProperty.call(a,n)},r.p="",r(r.s=28)})([(function(t,e,r){"use strict";function a(){}a.QUALITY=1,a.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,a.DEFAULT_INCREMENTAL=!1,a.DEFAULT_ANIMATION_ON_LAYOUT=!0,a.DEFAULT_ANIMATION_DURING_LAYOUT=!1,a.DEFAULT_ANIMATION_PERIOD=50,a.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,a.DEFAULT_GRAPH_MARGIN=15,a.NODE_DIMENSIONS_INCLUDE_LABELS=!1,a.SIMPLE_NODE_SIZE=40,a.SIMPLE_NODE_HALF_SIZE=a.SIMPLE_NODE_SIZE/2,a.EMPTY_COMPOUND_NODE_SIZE=40,a.MIN_EDGE_LENGTH=1,a.WORLD_BOUNDARY=1e6,a.INITIAL_WORLD_BOUNDARY=a.WORLD_BOUNDARY/1e3,a.WORLD_CENTER_X=1200,a.WORLD_CENTER_Y=900,t.exports=a}),(function(t,e,r){"use strict";var a=r(2),n=r(8),i=r(9);function o(u,l,f){a.call(this,f),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=f,this.bendpoints=[],this.source=u,this.target=l}o.prototype=Object.create(a.prototype);for(var s in a)o[s]=a[s];o.prototype.getSource=function(){return this.source},o.prototype.getTarget=function(){return this.target},o.prototype.isInterGraph=function(){return this.isInterGraph},o.prototype.getLength=function(){return this.length},o.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},o.prototype.getBendpoints=function(){return this.bendpoints},o.prototype.getLca=function(){return this.lca},o.prototype.getSourceInLca=function(){return this.sourceInLca},o.prototype.getTargetInLca=function(){return this.targetInLca},o.prototype.getOtherEnd=function(u){if(this.source===u)return this.target;if(this.target===u)return this.source;throw"Node is not incident with this edge"},o.prototype.getOtherEndInGraph=function(u,l){for(var f=this.getOtherEnd(u),v=l.getGraphManager().getRoot();;){if(f.getOwner()==l)return f;if(f.getOwner()==v)break;f=f.getOwner().getParent()}return null},o.prototype.updateLength=function(){var u=new Array(4);this.isOverlapingSourceAndTarget=n.getIntersection(this.target.getRect(),this.source.getRect(),u),this.isOverlapingSourceAndTarget||(this.lengthX=u[0]-u[2],this.lengthY=u[1]-u[3],Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},o.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=o}),(function(t,e,r){"use strict";function a(n){this.vGraphObject=n}t.exports=a}),(function(t,e,r){"use strict";var a=r(2),n=r(10),i=r(13),o=r(0),s=r(16),u=r(5);function l(v,c,h,d){h==null&&d==null&&(d=c),a.call(this,d),v.graphManager!=null&&(v=v.graphManager),this.estimatedSize=n.MIN_VALUE,this.inclusionTreeDepth=n.MAX_VALUE,this.vGraphObject=d,this.edges=[],this.graphManager=v,h!=null&&c!=null?this.rect=new i(c.x,c.y,h.width,h.height):this.rect=new i}l.prototype=Object.create(a.prototype);for(var f in a)l[f]=a[f];l.prototype.getEdges=function(){return this.edges},l.prototype.getChild=function(){return this.child},l.prototype.getOwner=function(){return this.owner},l.prototype.getWidth=function(){return this.rect.width},l.prototype.setWidth=function(v){this.rect.width=v},l.prototype.getHeight=function(){return this.rect.height},l.prototype.setHeight=function(v){this.rect.height=v},l.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},l.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},l.prototype.getCenter=function(){return new u(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},l.prototype.getLocation=function(){return new u(this.rect.x,this.rect.y)},l.prototype.getRect=function(){return this.rect},l.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},l.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},l.prototype.setRect=function(v,c){this.rect.x=v.x,this.rect.y=v.y,this.rect.width=c.width,this.rect.height=c.height},l.prototype.setCenter=function(v,c){this.rect.x=v-this.rect.width/2,this.rect.y=c-this.rect.height/2},l.prototype.setLocation=function(v,c){this.rect.x=v,this.rect.y=c},l.prototype.moveBy=function(v,c){this.rect.x+=v,this.rect.y+=c},l.prototype.getEdgeListToNode=function(v){var c=[],h,d=this;return d.edges.forEach(function(g){if(g.target==v){if(g.source!=d)throw"Incorrect edge source!";c.push(g)}}),c},l.prototype.getEdgesBetween=function(v){var c=[],h,d=this;return d.edges.forEach(function(g){if(!(g.source==d||g.target==d))throw"Incorrect edge source and/or target";(g.target==v||g.source==v)&&c.push(g)}),c},l.prototype.getNeighborsList=function(){var v=new Set,c=this;return c.edges.forEach(function(h){if(h.source==c)v.add(h.target);else{if(h.target!=c)throw"Incorrect incidency!";v.add(h.source)}}),v},l.prototype.withChildren=function(){var v=new Set,c,h;if(v.add(this),this.child!=null)for(var d=this.child.getNodes(),g=0;g<d.length;g++)c=d[g],h=c.withChildren(),h.forEach(function(m){v.add(m)});return v},l.prototype.getNoOfChildren=function(){var v=0,c;if(this.child==null)v=1;else for(var h=this.child.getNodes(),d=0;d<h.length;d++)c=h[d],v+=c.getNoOfChildren();return v==0&&(v=1),v},l.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},l.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},l.prototype.scatter=function(){var v,c,h=-o.INITIAL_WORLD_BOUNDARY,d=o.INITIAL_WORLD_BOUNDARY;v=o.WORLD_CENTER_X+s.nextDouble()*(d-h)+h;var g=-o.INITIAL_WORLD_BOUNDARY,m=o.INITIAL_WORLD_BOUNDARY;c=o.WORLD_CENTER_Y+s.nextDouble()*(m-g)+g,this.rect.x=v,this.rect.y=c},l.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var v=this.getChild();if(v.updateBounds(!0),this.rect.x=v.getLeft(),this.rect.y=v.getTop(),this.setWidth(v.getRight()-v.getLeft()),this.setHeight(v.getBottom()-v.getTop()),o.NODE_DIMENSIONS_INCLUDE_LABELS){var c=v.getRight()-v.getLeft(),h=v.getBottom()-v.getTop();this.labelWidth&&(this.labelPosHorizontal=="left"?(this.rect.x-=this.labelWidth,this.setWidth(c+this.labelWidth)):this.labelPosHorizontal=="center"&&this.labelWidth>c?(this.rect.x-=(this.labelWidth-c)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(c+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(h+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>h?(this.rect.y-=(this.labelHeight-h)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(h+this.labelHeight))}}},l.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==n.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},l.prototype.transform=function(v){var c=this.rect.x;c>o.WORLD_BOUNDARY?c=o.WORLD_BOUNDARY:c<-o.WORLD_BOUNDARY&&(c=-o.WORLD_BOUNDARY);var h=this.rect.y;h>o.WORLD_BOUNDARY?h=o.WORLD_BOUNDARY:h<-o.WORLD_BOUNDARY&&(h=-o.WORLD_BOUNDARY);var d=new u(c,h),g=v.inverseTransformPoint(d);this.setLocation(g.x,g.y)},l.prototype.getLeft=function(){return this.rect.x},l.prototype.getRight=function(){return this.rect.x+this.rect.width},l.prototype.getTop=function(){return this.rect.y},l.prototype.getBottom=function(){return this.rect.y+this.rect.height},l.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},t.exports=l}),(function(t,e,r){"use strict";var a=r(0);function n(){}for(var i in a)n[i]=a[i];n.MAX_ITERATIONS=2500,n.DEFAULT_EDGE_LENGTH=50,n.DEFAULT_SPRING_STRENGTH=.45,n.DEFAULT_REPULSION_STRENGTH=4500,n.DEFAULT_GRAVITY_STRENGTH=.4,n.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,n.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,n.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,n.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,n.COOLING_ADAPTATION_FACTOR=.33,n.ADAPTATION_LOWER_NODE_LIMIT=1e3,n.ADAPTATION_UPPER_NODE_LIMIT=5e3,n.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,n.MAX_NODE_DISPLACEMENT=n.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,n.MIN_REPULSION_DIST=n.DEFAULT_EDGE_LENGTH/10,n.CONVERGENCE_CHECK_PERIOD=100,n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,n.MIN_EDGE_LENGTH=1,n.GRID_CALCULATION_CHECK_PERIOD=10,t.exports=n}),(function(t,e,r){"use strict";function a(n,i){n==null&&i==null?(this.x=0,this.y=0):(this.x=n,this.y=i)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.setX=function(n){this.x=n},a.prototype.setY=function(n){this.y=n},a.prototype.getDifference=function(n){return new DimensionD(this.x-n.x,this.y-n.y)},a.prototype.getCopy=function(){return new a(this.x,this.y)},a.prototype.translate=function(n){return this.x+=n.width,this.y+=n.height,this},t.exports=a}),(function(t,e,r){"use strict";var a=r(2),n=r(10),i=r(0),o=r(7),s=r(3),u=r(1),l=r(13),f=r(12),v=r(11);function c(d,g,m){a.call(this,m),this.estimatedSize=n.MIN_VALUE,this.margin=i.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=d,g!=null&&g instanceof o?this.graphManager=g:g!=null&&g instanceof Layout&&(this.graphManager=g.graphManager)}c.prototype=Object.create(a.prototype);for(var h in a)c[h]=a[h];c.prototype.getNodes=function(){return this.nodes},c.prototype.getEdges=function(){return this.edges},c.prototype.getGraphManager=function(){return this.graphManager},c.prototype.getParent=function(){return this.parent},c.prototype.getLeft=function(){return this.left},c.prototype.getRight=function(){return this.right},c.prototype.getTop=function(){return this.top},c.prototype.getBottom=function(){return this.bottom},c.prototype.isConnected=function(){return this.isConnected},c.prototype.add=function(d,g,m){if(g==null&&m==null){var p=d;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(p)>-1)throw"Node already in graph!";return p.owner=this,this.getNodes().push(p),p}else{var y=d;if(!(this.getNodes().indexOf(g)>-1&&this.getNodes().indexOf(m)>-1))throw"Source or target not in graph!";if(!(g.owner==m.owner&&g.owner==this))throw"Both owners must be this graph!";return g.owner!=m.owner?null:(y.source=g,y.target=m,y.isInterGraph=!1,this.getEdges().push(y),g.edges.push(y),m!=g&&m.edges.push(y),y)}},c.prototype.remove=function(d){var g=d;if(d instanceof s){if(g==null)throw"Node is null!";if(!(g.owner!=null&&g.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var m=g.edges.slice(),p,y=m.length,b=0;b<y;b++)p=m[b],p.isInterGraph?this.graphManager.remove(p):p.source.owner.remove(p);var E=this.nodes.indexOf(g);if(E==-1)throw"Node not in owner node list!";this.nodes.splice(E,1)}else if(d instanceof u){var p=d;if(p==null)throw"Edge is null!";if(!(p.source!=null&&p.target!=null))throw"Source and/or target is null!";if(!(p.source.owner!=null&&p.target.owner!=null&&p.source.owner==this&&p.target.owner==this))throw"Source and/or target owner is invalid!";var C=p.source.edges.indexOf(p),A=p.target.edges.indexOf(p);if(!(C>-1&&A>-1))throw"Source and/or target doesn't know this edge!";p.source.edges.splice(C,1),p.target!=p.source&&p.target.edges.splice(A,1);var E=p.source.owner.getEdges().indexOf(p);if(E==-1)throw"Not in owner's edge list!";p.source.owner.getEdges().splice(E,1)}},c.prototype.updateLeftTop=function(){for(var d=n.MAX_VALUE,g=n.MAX_VALUE,m,p,y,b=this.getNodes(),E=b.length,C=0;C<E;C++){var A=b[C];m=A.getTop(),p=A.getLeft(),d>m&&(d=m),g>p&&(g=p)}return d==n.MAX_VALUE?null:(b[0].getParent().paddingLeft!=null?y=b[0].getParent().paddingLeft:y=this.margin,this.left=g-y,this.top=d-y,new f(this.left,this.top))},c.prototype.updateBounds=function(d){for(var g=n.MAX_VALUE,m=-n.MAX_VALUE,p=n.MAX_VALUE,y=-n.MAX_VALUE,b,E,C,A,D,N=this.nodes,O=N.length,R=0;R<O;R++){var P=N[R];d&&P.child!=null&&P.updateBounds(),b=P.getLeft(),E=P.getRight(),C=P.getTop(),A=P.getBottom(),g>b&&(g=b),m<E&&(m=E),p>C&&(p=C),y<A&&(y=A)}var w=new l(g,p,m-g,y-p);g==n.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),N[0].getParent().paddingLeft!=null?D=N[0].getParent().paddingLeft:D=this.margin,this.left=w.x-D,this.right=w.x+w.width+D,this.top=w.y-D,this.bottom=w.y+w.height+D},c.calculateBounds=function(d){for(var g=n.MAX_VALUE,m=-n.MAX_VALUE,p=n.MAX_VALUE,y=-n.MAX_VALUE,b,E,C,A,D=d.length,N=0;N<D;N++){var O=d[N];b=O.getLeft(),E=O.getRight(),C=O.getTop(),A=O.getBottom(),g>b&&(g=b),m<E&&(m=E),p>C&&(p=C),y<A&&(y=A)}var R=new l(g,p,m-g,y-p);return R},c.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},c.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},c.prototype.calcEstimatedSize=function(){for(var d=0,g=this.nodes,m=g.length,p=0;p<m;p++){var y=g[p];d+=y.calcEstimatedSize()}return d==0?this.estimatedSize=i.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=d/Math.sqrt(this.nodes.length),this.estimatedSize},c.prototype.updateConnected=function(){var d=this;if(this.nodes.length==0){this.isConnected=!0;return}var g=new v,m=new Set,p=this.nodes[0],y,b,E=p.withChildren();for(E.forEach(function(R){g.push(R),m.add(R)});g.length!==0;){p=g.shift(),y=p.getEdges();for(var C=y.length,A=0;A<C;A++){var D=y[A];if(b=D.getOtherEndInGraph(p,this),b!=null&&!m.has(b)){var N=b.withChildren();N.forEach(function(R){g.push(R),m.add(R)})}}}if(this.isConnected=!1,m.size>=this.nodes.length){var O=0;m.forEach(function(R){R.owner==d&&O++}),O==this.nodes.length&&(this.isConnected=!0)}},t.exports=c}),(function(t,e,r){"use strict";var a,n=r(1);function i(o){a=r(6),this.layout=o,this.graphs=[],this.edges=[]}i.prototype.addRoot=function(){var o=this.layout.newGraph(),s=this.layout.newNode(null),u=this.add(o,s);return this.setRootGraph(u),this.rootGraph},i.prototype.add=function(o,s,u,l,f){if(u==null&&l==null&&f==null){if(o==null)throw"Graph is null!";if(s==null)throw"Parent node is null!";if(this.graphs.indexOf(o)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(o),o.parent!=null)throw"Already has a parent!";if(s.child!=null)throw"Already has a child!";return o.parent=s,s.child=o,o}else{f=u,l=s,u=o;var v=l.getOwner(),c=f.getOwner();if(!(v!=null&&v.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(c!=null&&c.getGraphManager()==this))throw"Target not in this graph mgr!";if(v==c)return u.isInterGraph=!1,v.add(u,l,f);if(u.isInterGraph=!0,u.source=l,u.target=f,this.edges.indexOf(u)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(u),!(u.source!=null&&u.target!=null))throw"Edge source and/or target is null!";if(!(u.source.edges.indexOf(u)==-1&&u.target.edges.indexOf(u)==-1))throw"Edge already in source and/or target incidency list!";return u.source.edges.push(u),u.target.edges.push(u),u}},i.prototype.remove=function(o){if(o instanceof a){var s=o;if(s.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(s==this.rootGraph||s.parent!=null&&s.parent.graphManager==this))throw"Invalid parent node!";var u=[];u=u.concat(s.getEdges());for(var l,f=u.length,v=0;v<f;v++)l=u[v],s.remove(l);var c=[];c=c.concat(s.getNodes());var h;f=c.length;for(var v=0;v<f;v++)h=c[v],s.remove(h);s==this.rootGraph&&this.setRootGraph(null);var d=this.graphs.indexOf(s);this.graphs.splice(d,1),s.parent=null}else if(o instanceof n){if(l=o,l==null)throw"Edge is null!";if(!l.isInterGraph)throw"Not an inter-graph edge!";if(!(l.source!=null&&l.target!=null))throw"Source and/or target is null!";if(!(l.source.edges.indexOf(l)!=-1&&l.target.edges.indexOf(l)!=-1))throw"Source and/or target doesn't know this edge!";var d=l.source.edges.indexOf(l);if(l.source.edges.splice(d,1),d=l.target.edges.indexOf(l),l.target.edges.splice(d,1),!(l.source.owner!=null&&l.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(l.source.owner.getGraphManager().edges.indexOf(l)==-1)throw"Not in owner graph manager's edge list!";var d=l.source.owner.getGraphManager().edges.indexOf(l);l.source.owner.getGraphManager().edges.splice(d,1)}},i.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},i.prototype.getGraphs=function(){return this.graphs},i.prototype.getAllNodes=function(){if(this.allNodes==null){for(var o=[],s=this.getGraphs(),u=s.length,l=0;l<u;l++)o=o.concat(s[l].getNodes());this.allNodes=o}return this.allNodes},i.prototype.resetAllNodes=function(){this.allNodes=null},i.prototype.resetAllEdges=function(){this.allEdges=null},i.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},i.prototype.getAllEdges=function(){if(this.allEdges==null){for(var o=[],s=this.getGraphs(),u=s.length,l=0;l<s.length;l++)o=o.concat(s[l].getEdges());o=o.concat(this.edges),this.allEdges=o}return this.allEdges},i.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},i.prototype.setAllNodesToApplyGravitation=function(o){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=o},i.prototype.getRoot=function(){return this.rootGraph},i.prototype.setRootGraph=function(o){if(o.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=o,o.parent==null&&(o.parent=this.layout.newNode("Root node"))},i.prototype.getLayout=function(){return this.layout},i.prototype.isOneAncestorOfOther=function(o,s){if(!(o!=null&&s!=null))throw"assert failed";if(o==s)return!0;var u=o.getOwner(),l;do{if(l=u.getParent(),l==null)break;if(l==s)return!0;if(u=l.getOwner(),u==null)break}while(!0);u=s.getOwner();do{if(l=u.getParent(),l==null)break;if(l==o)return!0;if(u=l.getOwner(),u==null)break}while(!0);return!1},i.prototype.calcLowestCommonAncestors=function(){for(var o,s,u,l,f,v=this.getAllEdges(),c=v.length,h=0;h<c;h++){if(o=v[h],s=o.source,u=o.target,o.lca=null,o.sourceInLca=s,o.targetInLca=u,s==u){o.lca=s.getOwner();continue}for(l=s.getOwner();o.lca==null;){for(o.targetInLca=u,f=u.getOwner();o.lca==null;){if(f==l){o.lca=f;break}if(f==this.rootGraph)break;if(o.lca!=null)throw"assert failed";o.targetInLca=f.getParent(),f=o.targetInLca.getOwner()}if(l==this.rootGraph)break;o.lca==null&&(o.sourceInLca=l.getParent(),l=o.sourceInLca.getOwner())}if(o.lca==null)throw"assert failed"}},i.prototype.calcLowestCommonAncestor=function(o,s){if(o==s)return o.getOwner();var u=o.getOwner();do{if(u==null)break;var l=s.getOwner();do{if(l==null)break;if(l==u)return l;l=l.getParent().getOwner()}while(!0);u=u.getParent().getOwner()}while(!0);return u},i.prototype.calcInclusionTreeDepths=function(o,s){o==null&&s==null&&(o=this.rootGraph,s=1);for(var u,l=o.getNodes(),f=l.length,v=0;v<f;v++)u=l[v],u.inclusionTreeDepth=s,u.child!=null&&this.calcInclusionTreeDepths(u.child,s+1)},i.prototype.includesInvalidEdge=function(){for(var o,s=[],u=this.edges.length,l=0;l<u;l++)o=this.edges[l],this.isOneAncestorOfOther(o.source,o.target)&&s.push(o);for(var l=0;l<s.length;l++)this.remove(s[l]);return!1},t.exports=i}),(function(t,e,r){"use strict";var a=r(12);function n(){}n.calcSeparationAmount=function(i,o,s,u){if(!i.intersects(o))throw"assert failed";var l=new Array(2);this.decideDirectionsForOverlappingNodes(i,o,l),s[0]=Math.min(i.getRight(),o.getRight())-Math.max(i.x,o.x),s[1]=Math.min(i.getBottom(),o.getBottom())-Math.max(i.y,o.y),i.getX()<=o.getX()&&i.getRight()>=o.getRight()?s[0]+=Math.min(o.getX()-i.getX(),i.getRight()-o.getRight()):o.getX()<=i.getX()&&o.getRight()>=i.getRight()&&(s[0]+=Math.min(i.getX()-o.getX(),o.getRight()-i.getRight())),i.getY()<=o.getY()&&i.getBottom()>=o.getBottom()?s[1]+=Math.min(o.getY()-i.getY(),i.getBottom()-o.getBottom()):o.getY()<=i.getY()&&o.getBottom()>=i.getBottom()&&(s[1]+=Math.min(i.getY()-o.getY(),o.getBottom()-i.getBottom()));var f=Math.abs((o.getCenterY()-i.getCenterY())/(o.getCenterX()-i.getCenterX()));o.getCenterY()===i.getCenterY()&&o.getCenterX()===i.getCenterX()&&(f=1);var v=f*s[0],c=s[1]/f;s[0]<c?c=s[0]:v=s[1],s[0]=-1*l[0]*(c/2+u),s[1]=-1*l[1]*(v/2+u)},n.decideDirectionsForOverlappingNodes=function(i,o,s){i.getCenterX()<o.getCenterX()?s[0]=-1:s[0]=1,i.getCenterY()<o.getCenterY()?s[1]=-1:s[1]=1},n.getIntersection2=function(i,o,s){var u=i.getCenterX(),l=i.getCenterY(),f=o.getCenterX(),v=o.getCenterY();if(i.intersects(o))return s[0]=u,s[1]=l,s[2]=f,s[3]=v,!0;var c=i.getX(),h=i.getY(),d=i.getRight(),g=i.getX(),m=i.getBottom(),p=i.getRight(),y=i.getWidthHalf(),b=i.getHeightHalf(),E=o.getX(),C=o.getY(),A=o.getRight(),D=o.getX(),N=o.getBottom(),O=o.getRight(),R=o.getWidthHalf(),P=o.getHeightHalf(),w=!1,x=!1;if(u===f){if(l>v)return s[0]=u,s[1]=h,s[2]=f,s[3]=N,!1;if(l<v)return s[0]=u,s[1]=m,s[2]=f,s[3]=C,!1}else if(l===v){if(u>f)return s[0]=c,s[1]=l,s[2]=A,s[3]=v,!1;if(u<f)return s[0]=d,s[1]=l,s[2]=E,s[3]=v,!1}else{var T=i.height/i.width,M=o.height/o.width,S=(v-l)/(f-u),I=void 0,B=void 0,V=void 0,F=void 0,k=void 0,U=void 0;if(-T===S?u>f?(s[0]=g,s[1]=m,w=!0):(s[0]=d,s[1]=h,w=!0):T===S&&(u>f?(s[0]=c,s[1]=h,w=!0):(s[0]=p,s[1]=m,w=!0)),-M===S?f>u?(s[2]=D,s[3]=N,x=!0):(s[2]=A,s[3]=C,x=!0):M===S&&(f>u?(s[2]=E,s[3]=C,x=!0):(s[2]=O,s[3]=N,x=!0)),w&&x)return!1;if(u>f?l>v?(I=this.getCardinalDirection(T,S,4),B=this.getCardinalDirection(M,S,2)):(I=this.getCardinalDirection(-T,S,3),B=this.getCardinalDirection(-M,S,1)):l>v?(I=this.getCardinalDirection(-T,S,1),B=this.getCardinalDirection(-M,S,3)):(I=this.getCardinalDirection(T,S,2),B=this.getCardinalDirection(M,S,4)),!w)switch(I){case 1:F=h,V=u+-b/S,s[0]=V,s[1]=F;break;case 2:V=p,F=l+y*S,s[0]=V,s[1]=F;break;case 3:F=m,V=u+b/S,s[0]=V,s[1]=F;break;case 4:V=g,F=l+-y*S,s[0]=V,s[1]=F;break}if(!x)switch(B){case 1:U=C,k=f+-P/S,s[2]=k,s[3]=U;break;case 2:k=O,U=v+R*S,s[2]=k,s[3]=U;break;case 3:U=N,k=f+P/S,s[2]=k,s[3]=U;break;case 4:k=D,U=v+-R*S,s[2]=k,s[3]=U;break}}return!1},n.getCardinalDirection=function(i,o,s){return i>o?s:1+s%4},n.getIntersection=function(i,o,s,u){if(u==null)return this.getIntersection2(i,o,s);var l=i.x,f=i.y,v=o.x,c=o.y,h=s.x,d=s.y,g=u.x,m=u.y,p=void 0,y=void 0,b=void 0,E=void 0,C=void 0,A=void 0,D=void 0,N=void 0,O=void 0;return b=c-f,C=l-v,D=v*f-l*c,E=m-d,A=h-g,N=g*d-h*m,O=b*A-E*C,O===0?null:(p=(C*N-A*D)/O,y=(E*D-b*N)/O,new a(p,y))},n.angleOfVector=function(i,o,s,u){var l=void 0;return i!==s?(l=Math.atan((u-o)/(s-i)),s<i?l+=Math.PI:u<o&&(l+=this.TWO_PI)):u<o?l=this.ONE_AND_HALF_PI:l=this.HALF_PI,l},n.doIntersect=function(i,o,s,u){var l=i.x,f=i.y,v=o.x,c=o.y,h=s.x,d=s.y,g=u.x,m=u.y,p=(v-l)*(m-d)-(g-h)*(c-f);if(p===0)return!1;var y=((m-d)*(g-l)+(h-g)*(m-f))/p,b=((f-c)*(g-l)+(v-l)*(m-f))/p;return 0<y&&y<1&&0<b&&b<1},n.findCircleLineIntersections=function(i,o,s,u,l,f,v){var c=(s-i)*(s-i)+(u-o)*(u-o),h=2*((i-l)*(s-i)+(o-f)*(u-o)),d=(i-l)*(i-l)+(o-f)*(o-f)-v*v,g=h*h-4*c*d;if(g>=0){var m=(-h+Math.sqrt(h*h-4*c*d))/(2*c),p=(-h-Math.sqrt(h*h-4*c*d))/(2*c),y=null;return m>=0&&m<=1?[m]:p>=0&&p<=1?[p]:y}else return null},n.HALF_PI=.5*Math.PI,n.ONE_AND_HALF_PI=1.5*Math.PI,n.TWO_PI=2*Math.PI,n.THREE_PI=3*Math.PI,t.exports=n}),(function(t,e,r){"use strict";function a(){}a.sign=function(n){return n>0?1:n<0?-1:0},a.floor=function(n){return n<0?Math.ceil(n):Math.floor(n)},a.ceil=function(n){return n<0?Math.floor(n):Math.ceil(n)},t.exports=a}),(function(t,e,r){"use strict";function a(){}a.MAX_VALUE=2147483647,a.MIN_VALUE=-2147483648,t.exports=a}),(function(t,e,r){"use strict";var a=(function(){function l(f,v){for(var c=0;c<v.length;c++){var h=v[c];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}return function(f,v,c){return v&&l(f.prototype,v),c&&l(f,c),f}})();function n(l,f){if(!(l instanceof f))throw new TypeError("Cannot call a class as a function")}var i=function(f){return{value:f,next:null,prev:null}},o=function(f,v,c,h){return f!==null?f.next=v:h.head=v,c!==null?c.prev=v:h.tail=v,v.prev=f,v.next=c,h.length++,v},s=function(f,v){var c=f.prev,h=f.next;return c!==null?c.next=h:v.head=h,h!==null?h.prev=c:v.tail=c,f.prev=f.next=null,v.length--,f},u=(function(){function l(f){var v=this;n(this,l),this.length=0,this.head=null,this.tail=null,f?.forEach(function(c){return v.push(c)})}return a(l,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(v,c){return o(c.prev,i(v),c,this)}},{key:"insertAfter",value:function(v,c){return o(c,i(v),c.next,this)}},{key:"insertNodeBefore",value:function(v,c){return o(c.prev,v,c,this)}},{key:"insertNodeAfter",value:function(v,c){return o(c,v,c.next,this)}},{key:"push",value:function(v){return o(this.tail,i(v),null,this)}},{key:"unshift",value:function(v){return o(null,i(v),this.head,this)}},{key:"remove",value:function(v){return s(v,this)}},{key:"pop",value:function(){return s(this.tail,this).value}},{key:"popNode",value:function(){return s(this.tail,this)}},{key:"shift",value:function(){return s(this.head,this).value}},{key:"shiftNode",value:function(){return s(this.head,this)}},{key:"get_object_at",value:function(v){if(v<=this.length()){for(var c=1,h=this.head;c<v;)h=h.next,c++;return h.value}}},{key:"set_object_at",value:function(v,c){if(v<=this.length()){for(var h=1,d=this.head;h<v;)d=d.next,h++;d.value=c}}}]),l})();t.exports=u}),(function(t,e,r){"use strict";function a(n,i,o){this.x=null,this.y=null,n==null&&i==null&&o==null?(this.x=0,this.y=0):typeof n=="number"&&typeof i=="number"&&o==null?(this.x=n,this.y=i):n.constructor.name=="Point"&&i==null&&o==null&&(o=n,this.x=o.x,this.y=o.y)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.getLocation=function(){return new a(this.x,this.y)},a.prototype.setLocation=function(n,i,o){n.constructor.name=="Point"&&i==null&&o==null?(o=n,this.setLocation(o.x,o.y)):typeof n=="number"&&typeof i=="number"&&o==null&&(parseInt(n)==n&&parseInt(i)==i?this.move(n,i):(this.x=Math.floor(n+.5),this.y=Math.floor(i+.5)))},a.prototype.move=function(n,i){this.x=n,this.y=i},a.prototype.translate=function(n,i){this.x+=n,this.y+=i},a.prototype.equals=function(n){if(n.constructor.name=="Point"){var i=n;return this.x==i.x&&this.y==i.y}return this==n},a.prototype.toString=function(){return new a().constructor.name+"[x="+this.x+",y="+this.y+"]"},t.exports=a}),(function(t,e,r){"use strict";function a(n,i,o,s){this.x=0,this.y=0,this.width=0,this.height=0,n!=null&&i!=null&&o!=null&&s!=null&&(this.x=n,this.y=i,this.width=o,this.height=s)}a.prototype.getX=function(){return this.x},a.prototype.setX=function(n){this.x=n},a.prototype.getY=function(){return this.y},a.prototype.setY=function(n){this.y=n},a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(n){this.width=n},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(n){this.height=n},a.prototype.getRight=function(){return this.x+this.width},a.prototype.getBottom=function(){return this.y+this.height},a.prototype.intersects=function(n){return!(this.getRight()<n.x||this.getBottom()<n.y||n.getRight()<this.x||n.getBottom()<this.y)},a.prototype.getCenterX=function(){return this.x+this.width/2},a.prototype.getMinX=function(){return this.getX()},a.prototype.getMaxX=function(){return this.getX()+this.width},a.prototype.getCenterY=function(){return this.y+this.height/2},a.prototype.getMinY=function(){return this.getY()},a.prototype.getMaxY=function(){return this.getY()+this.height},a.prototype.getWidthHalf=function(){return this.width/2},a.prototype.getHeightHalf=function(){return this.height/2},t.exports=a}),(function(t,e,r){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i};function n(){}n.lastID=0,n.createID=function(i){return n.isPrimitive(i)?i:(i.uniqueID!=null||(i.uniqueID=n.getString(),n.lastID++),i.uniqueID)},n.getString=function(i){return i==null&&(i=n.lastID),"Object#"+i},n.isPrimitive=function(i){var o=typeof i>"u"?"undefined":a(i);return i==null||o!="object"&&o!="function"},t.exports=n}),(function(t,e,r){"use strict";function a(h){if(Array.isArray(h)){for(var d=0,g=Array(h.length);d<h.length;d++)g[d]=h[d];return g}else return Array.from(h)}var n=r(0),i=r(7),o=r(3),s=r(1),u=r(6),l=r(5),f=r(17),v=r(29);function c(h){v.call(this),this.layoutQuality=n.QUALITY,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=n.DEFAULT_INCREMENTAL,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new i(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,h!=null&&(this.isRemoteUse=h)}c.RANDOM_SEED=1,c.prototype=Object.create(v.prototype),c.prototype.getGraphManager=function(){return this.graphManager},c.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},c.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},c.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},c.prototype.newGraphManager=function(){var h=new i(this);return this.graphManager=h,h},c.prototype.newGraph=function(h){return new u(null,this.graphManager,h)},c.prototype.newNode=function(h){return new o(this.graphManager,h)},c.prototype.newEdge=function(h){return new s(null,null,h)},c.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},c.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var h;return this.checkLayoutSuccess()?h=!1:h=this.layout(),n.ANIMATE==="during"?!1:(h&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,h)},c.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},c.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var h,d=this.graphManager.getAllEdges(),g=0;g<d.length;g++)h=d[g];for(var m,p=this.graphManager.getRoot().getNodes(),g=0;g<p.length;g++)m=p[g];this.update(this.graphManager.getRoot())}},c.prototype.update=function(h){if(h==null)this.update2();else if(h instanceof o){var d=h;if(d.getChild()!=null)for(var g=d.getChild().getNodes(),m=0;m<g.length;m++)update(g[m]);if(d.vGraphObject!=null){var p=d.vGraphObject;p.update(d)}}else if(h instanceof s){var y=h;if(y.vGraphObject!=null){var b=y.vGraphObject;b.update(y)}}else if(h instanceof u){var E=h;if(E.vGraphObject!=null){var C=E.vGraphObject;C.update(E)}}},c.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=n.QUALITY,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=n.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},c.prototype.transform=function(h){if(h==null)this.transform(new l(0,0));else{var d=new f,g=this.graphManager.getRoot().updateLeftTop();if(g!=null){d.setWorldOrgX(h.x),d.setWorldOrgY(h.y),d.setDeviceOrgX(g.x),d.setDeviceOrgY(g.y);for(var m=this.getAllNodes(),p,y=0;y<m.length;y++)p=m[y],p.transform(d)}}},c.prototype.positionNodesRandomly=function(h){if(h==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var d,g,m=h.getNodes(),p=0;p<m.length;p++)d=m[p],g=d.getChild(),g==null||g.getNodes().length==0?d.scatter():(this.positionNodesRandomly(g),d.updateBounds())},c.prototype.getFlatForest=function(){for(var h=[],d=!0,g=this.graphManager.getRoot().getNodes(),m=!0,p=0;p<g.length;p++)g[p].getChild()!=null&&(m=!1);if(!m)return h;var y=new Set,b=[],E=new Map,C=[];for(C=C.concat(g);C.length>0&&d;){for(b.push(C[0]);b.length>0&&d;){var A=b[0];b.splice(0,1),y.add(A);for(var D=A.getEdges(),p=0;p<D.length;p++){var N=D[p].getOtherEnd(A);if(E.get(A)!=N)if(!y.has(N))b.push(N),E.set(N,A);else{d=!1;break}}}if(!d)h=[];else{var O=[].concat(a(y));h.push(O);for(var p=0;p<O.length;p++){var R=O[p],P=C.indexOf(R);P>-1&&C.splice(P,1)}y=new Set,E=new Map}}return h},c.prototype.createDummyNodesForBendpoints=function(h){for(var d=[],g=h.source,m=this.graphManager.calcLowestCommonAncestor(h.source,h.target),p=0;p<h.bendpoints.length;p++){var y=this.newNode(null);y.setRect(new Point(0,0),new Dimension(1,1)),m.add(y);var b=this.newEdge(null);this.graphManager.add(b,g,y),d.add(y),g=y}var b=this.newEdge(null);return this.graphManager.add(b,g,h.target),this.edgeToDummyNodes.set(h,d),h.isInterGraph()?this.graphManager.remove(h):m.remove(h),d},c.prototype.createBendpointsFromDummyNodes=function(){var h=[];h=h.concat(this.graphManager.getAllEdges()),h=[].concat(a(this.edgeToDummyNodes.keys())).concat(h);for(var d=0;d<h.length;d++){var g=h[d];if(g.bendpoints.length>0){for(var m=this.edgeToDummyNodes.get(g),p=0;p<m.length;p++){var y=m[p],b=new l(y.getCenterX(),y.getCenterY()),E=g.bendpoints.get(p);E.x=b.x,E.y=b.y,y.getOwner().remove(y)}this.graphManager.add(g,g.source,g.target)}}},c.transform=function(h,d,g,m){if(g!=null&&m!=null){var p=d;if(h<=50){var y=d/g;p-=(d-y)/50*(50-h)}else{var b=d*m;p+=(b-d)/50*(h-50)}return p}else{var E,C;return h<=50?(E=9*d/500,C=d/10):(E=9*d/50,C=-8*d),E*h+C}},c.findCenterOfTree=function(h){var d=[];d=d.concat(h);var g=[],m=new Map,p=!1,y=null;(d.length==1||d.length==2)&&(p=!0,y=d[0]);for(var b=0;b<d.length;b++){var E=d[b],C=E.getNeighborsList().size;m.set(E,E.getNeighborsList().size),C==1&&g.push(E)}var A=[];for(A=A.concat(g);!p;){var D=[];D=D.concat(A),A=[];for(var b=0;b<d.length;b++){var E=d[b],N=d.indexOf(E);N>=0&&d.splice(N,1);var O=E.getNeighborsList();O.forEach(function(w){if(g.indexOf(w)<0){var x=m.get(w),T=x-1;T==1&&A.push(w),m.set(w,T)}})}g=g.concat(A),(d.length==1||d.length==2)&&(p=!0,y=d[0])}return y},c.prototype.setGraphManager=function(h){this.graphManager=h},t.exports=c}),(function(t,e,r){"use strict";function a(){}a.seed=1,a.x=0,a.nextDouble=function(){return a.x=Math.sin(a.seed++)*1e4,a.x-Math.floor(a.x)},t.exports=a}),(function(t,e,r){"use strict";var a=r(5);function n(i,o){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.prototype.getWorldOrgX=function(){return this.lworldOrgX},n.prototype.setWorldOrgX=function(i){this.lworldOrgX=i},n.prototype.getWorldOrgY=function(){return this.lworldOrgY},n.prototype.setWorldOrgY=function(i){this.lworldOrgY=i},n.prototype.getWorldExtX=function(){return this.lworldExtX},n.prototype.setWorldExtX=function(i){this.lworldExtX=i},n.prototype.getWorldExtY=function(){return this.lworldExtY},n.prototype.setWorldExtY=function(i){this.lworldExtY=i},n.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},n.prototype.setDeviceOrgX=function(i){this.ldeviceOrgX=i},n.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},n.prototype.setDeviceOrgY=function(i){this.ldeviceOrgY=i},n.prototype.getDeviceExtX=function(){return this.ldeviceExtX},n.prototype.setDeviceExtX=function(i){this.ldeviceExtX=i},n.prototype.getDeviceExtY=function(){return this.ldeviceExtY},n.prototype.setDeviceExtY=function(i){this.ldeviceExtY=i},n.prototype.transformX=function(i){var o=0,s=this.lworldExtX;return s!=0&&(o=this.ldeviceOrgX+(i-this.lworldOrgX)*this.ldeviceExtX/s),o},n.prototype.transformY=function(i){var o=0,s=this.lworldExtY;return s!=0&&(o=this.ldeviceOrgY+(i-this.lworldOrgY)*this.ldeviceExtY/s),o},n.prototype.inverseTransformX=function(i){var o=0,s=this.ldeviceExtX;return s!=0&&(o=this.lworldOrgX+(i-this.ldeviceOrgX)*this.lworldExtX/s),o},n.prototype.inverseTransformY=function(i){var o=0,s=this.ldeviceExtY;return s!=0&&(o=this.lworldOrgY+(i-this.ldeviceOrgY)*this.lworldExtY/s),o},n.prototype.inverseTransformPoint=function(i){var o=new a(this.inverseTransformX(i.x),this.inverseTransformY(i.y));return o},t.exports=n}),(function(t,e,r){"use strict";function a(v){if(Array.isArray(v)){for(var c=0,h=Array(v.length);c<v.length;c++)h[c]=v[c];return h}else return Array.from(v)}var n=r(15),i=r(4),o=r(0),s=r(8),u=r(9);function l(){n.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}l.prototype=Object.create(n.prototype);for(var f in n)l[f]=n[f];l.prototype.initParameters=function(){n.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var v,c,h,d,g,m,p,y=this.getGraphManager().getAllEdges(),b=0;b<y.length;b++)v=y[b],c=v.idealLength,v.isInterGraph&&(d=v.getSource(),g=v.getTarget(),m=v.getSourceInLca().getEstimatedSize(),p=v.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(v.idealLength+=m+p-2*o.SIMPLE_NODE_SIZE),h=v.getLca().getInclusionTreeDepth(),v.idealLength+=c*i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(d.getInclusionTreeDepth()+g.getInclusionTreeDepth()-2*h))},l.prototype.initSpringEmbedder=function(){var v=this.getAllNodes().length;this.incremental?(v>i.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(v-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(v>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(v-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var v=this.getAllEdges(),c,h=0;h<v.length;h++)c=v[h],this.calcSpringForce(c,c.idealLength)},l.prototype.calcRepulsionForces=function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,h,d,g,m,p=this.getAllNodes(),y;if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&v&&this.updateGrid(),y=new Set,h=0;h<p.length;h++)g=p[h],this.calculateRepulsionForceOfANode(g,y,v,c),y.add(g);else for(h=0;h<p.length;h++)for(g=p[h],d=h+1;d<p.length;d++)m=p[d],g.getOwner()==m.getOwner()&&this.calcRepulsionForce(g,m)},l.prototype.calcGravitationalForces=function(){for(var v,c=this.getAllNodesToApplyGravitation(),h=0;h<c.length;h++)v=c[h],this.calcGravitationalForce(v)},l.prototype.moveNodes=function(){for(var v=this.getAllNodes(),c,h=0;h<v.length;h++)c=v[h],c.move()},l.prototype.calcSpringForce=function(v,c){var h=v.getSource(),d=v.getTarget(),g,m,p,y;if(this.uniformLeafNodeSizes&&h.getChild()==null&&d.getChild()==null)v.updateLengthSimple();else if(v.updateLength(),v.isOverlapingSourceAndTarget)return;g=v.getLength(),g!=0&&(m=v.edgeElasticity*(g-c),p=m*(v.lengthX/g),y=m*(v.lengthY/g),h.springForceX+=p,h.springForceY+=y,d.springForceX-=p,d.springForceY-=y)},l.prototype.calcRepulsionForce=function(v,c){var h=v.getRect(),d=c.getRect(),g=new Array(2),m=new Array(4),p,y,b,E,C,A,D;if(h.intersects(d)){s.calcSeparationAmount(h,d,g,i.DEFAULT_EDGE_LENGTH/2),A=2*g[0],D=2*g[1];var N=v.noOfChildren*c.noOfChildren/(v.noOfChildren+c.noOfChildren);v.repulsionForceX-=N*A,v.repulsionForceY-=N*D,c.repulsionForceX+=N*A,c.repulsionForceY+=N*D}else this.uniformLeafNodeSizes&&v.getChild()==null&&c.getChild()==null?(p=d.getCenterX()-h.getCenterX(),y=d.getCenterY()-h.getCenterY()):(s.getIntersection(h,d,m),p=m[2]-m[0],y=m[3]-m[1]),Math.abs(p)<i.MIN_REPULSION_DIST&&(p=u.sign(p)*i.MIN_REPULSION_DIST),Math.abs(y)<i.MIN_REPULSION_DIST&&(y=u.sign(y)*i.MIN_REPULSION_DIST),b=p*p+y*y,E=Math.sqrt(b),C=(v.nodeRepulsion/2+c.nodeRepulsion/2)*v.noOfChildren*c.noOfChildren/b,A=C*p/E,D=C*y/E,v.repulsionForceX-=A,v.repulsionForceY-=D,c.repulsionForceX+=A,c.repulsionForceY+=D},l.prototype.calcGravitationalForce=function(v){var c,h,d,g,m,p,y,b;c=v.getOwner(),h=(c.getRight()+c.getLeft())/2,d=(c.getTop()+c.getBottom())/2,g=v.getCenterX()-h,m=v.getCenterY()-d,p=Math.abs(g)+v.getWidth()/2,y=Math.abs(m)+v.getHeight()/2,v.getOwner()==this.graphManager.getRoot()?(b=c.getEstimatedSize()*this.gravityRangeFactor,(p>b||y>b)&&(v.gravitationForceX=-this.gravityConstant*g,v.gravitationForceY=-this.gravityConstant*m)):(b=c.getEstimatedSize()*this.compoundGravityRangeFactor,(p>b||y>b)&&(v.gravitationForceX=-this.gravityConstant*g*this.compoundGravityConstant,v.gravitationForceY=-this.gravityConstant*m*this.compoundGravityConstant))},l.prototype.isConverged=function(){var v,c=!1;return this.totalIterations>this.maxIterations/3&&(c=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),v=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,v||c},l.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},l.prototype.calcNoOfChildrenForAllNodes=function(){for(var v,c=this.graphManager.getAllNodes(),h=0;h<c.length;h++)v=c[h],v.noOfChildren=v.getNoOfChildren()},l.prototype.calcGrid=function(v){var c=0,h=0;c=parseInt(Math.ceil((v.getRight()-v.getLeft())/this.repulsionRange)),h=parseInt(Math.ceil((v.getBottom()-v.getTop())/this.repulsionRange));for(var d=new Array(c),g=0;g<c;g++)d[g]=new Array(h);for(var g=0;g<c;g++)for(var m=0;m<h;m++)d[g][m]=new Array;return d},l.prototype.addNodeToGrid=function(v,c,h){var d=0,g=0,m=0,p=0;d=parseInt(Math.floor((v.getRect().x-c)/this.repulsionRange)),g=parseInt(Math.floor((v.getRect().width+v.getRect().x-c)/this.repulsionRange)),m=parseInt(Math.floor((v.getRect().y-h)/this.repulsionRange)),p=parseInt(Math.floor((v.getRect().height+v.getRect().y-h)/this.repulsionRange));for(var y=d;y<=g;y++)for(var b=m;b<=p;b++)this.grid[y][b].push(v),v.setGridCoordinates(d,g,m,p)},l.prototype.updateGrid=function(){var v,c,h=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),v=0;v<h.length;v++)c=h[v],this.addNodeToGrid(c,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},l.prototype.calculateRepulsionForceOfANode=function(v,c,h,d){if(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&h||d){var g=new Set;v.surrounding=new Array;for(var m,p=this.grid,y=v.startX-1;y<v.finishX+2;y++)for(var b=v.startY-1;b<v.finishY+2;b++)if(!(y<0||b<0||y>=p.length||b>=p[0].length)){for(var E=0;E<p[y][b].length;E++)if(m=p[y][b][E],!(v.getOwner()!=m.getOwner()||v==m)&&!c.has(m)&&!g.has(m)){var C=Math.abs(v.getCenterX()-m.getCenterX())-(v.getWidth()/2+m.getWidth()/2),A=Math.abs(v.getCenterY()-m.getCenterY())-(v.getHeight()/2+m.getHeight()/2);C<=this.repulsionRange&&A<=this.repulsionRange&&g.add(m)}}v.surrounding=[].concat(a(g))}for(y=0;y<v.surrounding.length;y++)this.calcRepulsionForce(v,v.surrounding[y])},l.prototype.calcRepulsionRange=function(){return 0},t.exports=l}),(function(t,e,r){"use strict";var a=r(1),n=r(4);function i(s,u,l){a.call(this,s,u,l),this.idealLength=n.DEFAULT_EDGE_LENGTH,this.edgeElasticity=n.DEFAULT_SPRING_STRENGTH}i.prototype=Object.create(a.prototype);for(var o in a)i[o]=a[o];t.exports=i}),(function(t,e,r){"use strict";var a=r(3),n=r(4);function i(s,u,l,f){a.call(this,s,u,l,f),this.nodeRepulsion=n.DEFAULT_REPULSION_STRENGTH,this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}i.prototype=Object.create(a.prototype);for(var o in a)i[o]=a[o];i.prototype.setGridCoordinates=function(s,u,l,f){this.startX=s,this.finishX=u,this.startY=l,this.finishY=f},t.exports=i}),(function(t,e,r){"use strict";function a(n,i){this.width=0,this.height=0,n!==null&&i!==null&&(this.height=i,this.width=n)}a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(n){this.width=n},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(n){this.height=n},t.exports=a}),(function(t,e,r){"use strict";var a=r(14);function n(){this.map={},this.keys=[]}n.prototype.put=function(i,o){var s=a.createID(i);this.contains(s)||(this.map[s]=o,this.keys.push(i))},n.prototype.contains=function(i){var o=a.createID(i);return this.map[i]!=null},n.prototype.get=function(i){var o=a.createID(i);return this.map[o]},n.prototype.keySet=function(){return this.keys},t.exports=n}),(function(t,e,r){"use strict";var a=r(14);function n(){this.set={}}n.prototype.add=function(i){var o=a.createID(i);this.contains(o)||(this.set[o]=i)},n.prototype.remove=function(i){delete this.set[a.createID(i)]},n.prototype.clear=function(){this.set={}},n.prototype.contains=function(i){return this.set[a.createID(i)]==i},n.prototype.isEmpty=function(){return this.size()===0},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAllTo=function(i){for(var o=Object.keys(this.set),s=o.length,u=0;u<s;u++)i.push(this.set[o[u]])},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAll=function(i){for(var o=i.length,s=0;s<o;s++){var u=i[s];this.add(u)}},t.exports=n}),(function(t,e,r){"use strict";function a(){}a.multMat=function(n,i){for(var o=[],s=0;s<n.length;s++){o[s]=[];for(var u=0;u<i[0].length;u++){o[s][u]=0;for(var l=0;l<n[0].length;l++)o[s][u]+=n[s][l]*i[l][u]}}return o},a.transpose=function(n){for(var i=[],o=0;o<n[0].length;o++){i[o]=[];for(var s=0;s<n.length;s++)i[o][s]=n[s][o]}return i},a.multCons=function(n,i){for(var o=[],s=0;s<n.length;s++)o[s]=n[s]*i;return o},a.minusOp=function(n,i){for(var o=[],s=0;s<n.length;s++)o[s]=n[s]-i[s];return o},a.dotProduct=function(n,i){for(var o=0,s=0;s<n.length;s++)o+=n[s]*i[s];return o},a.mag=function(n){return Math.sqrt(this.dotProduct(n,n))},a.normalize=function(n){for(var i=[],o=this.mag(n),s=0;s<n.length;s++)i[s]=n[s]/o;return i},a.multGamma=function(n){for(var i=[],o=0,s=0;s<n.length;s++)o+=n[s];o*=-1/n.length;for(var u=0;u<n.length;u++)i[u]=o+n[u];return i},a.multL=function(n,i,o){for(var s=[],u=[],l=[],f=0;f<i[0].length;f++){for(var v=0,c=0;c<i.length;c++)v+=-.5*i[c][f]*n[c];u[f]=v}for(var h=0;h<o.length;h++){for(var d=0,g=0;g<o.length;g++)d+=o[h][g]*u[g];l[h]=d}for(var m=0;m<i.length;m++){for(var p=0,y=0;y<i[0].length;y++)p+=i[m][y]*l[y];s[m]=p}return s},t.exports=a}),(function(t,e,r){"use strict";var a=(function(){function s(u,l){for(var f=0;f<l.length;f++){var v=l[f];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(u,v.key,v)}}return function(u,l,f){return l&&s(u.prototype,l),f&&s(u,f),u}})();function n(s,u){if(!(s instanceof u))throw new TypeError("Cannot call a class as a function")}var i=r(11),o=(function(){function s(u,l){n(this,s),(l!==null||l!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var f=void 0;u instanceof i?f=u.size():f=u.length,this._quicksort(u,0,f-1)}return a(s,[{key:"_quicksort",value:function(l,f,v){if(f<v){var c=this._partition(l,f,v);this._quicksort(l,f,c),this._quicksort(l,c+1,v)}}},{key:"_partition",value:function(l,f,v){for(var c=this._get(l,f),h=f,d=v;;){for(;this.compareFunction(c,this._get(l,d));)d--;for(;this.compareFunction(this._get(l,h),c);)h++;if(h<d)this._swap(l,h,d),h++,d--;else return d}}},{key:"_get",value:function(l,f){return l instanceof i?l.get_object_at(f):l[f]}},{key:"_set",value:function(l,f,v){l instanceof i?l.set_object_at(f,v):l[f]=v}},{key:"_swap",value:function(l,f,v){var c=this._get(l,f);this._set(l,f,this._get(l,v)),this._set(l,v,c)}},{key:"_defaultCompareFunction",value:function(l,f){return f>l}}]),s})();t.exports=o}),(function(t,e,r){"use strict";function a(){}a.svd=function(n){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=n.length,this.n=n[0].length;var i=Math.min(this.m,this.n);this.s=(function(ke){for(var ze=[];ke-- >0;)ze.push(0);return ze})(Math.min(this.m+1,this.n)),this.U=(function(ke){var ze=function qe(We){if(We.length==0)return 0;for(var Je=[],ut=0;ut<We[0];ut++)Je.push(qe(We.slice(1)));return Je};return ze(ke)})([this.m,i]),this.V=(function(ke){var ze=function qe(We){if(We.length==0)return 0;for(var Je=[],ut=0;ut<We[0];ut++)Je.push(qe(We.slice(1)));return Je};return ze(ke)})([this.n,this.n]);for(var o=(function(ke){for(var ze=[];ke-- >0;)ze.push(0);return ze})(this.n),s=(function(ke){for(var ze=[];ke-- >0;)ze.push(0);return ze})(this.m),u=!0,l=!0,f=Math.min(this.m-1,this.n),v=Math.max(0,Math.min(this.n-2,this.m)),c=0;c<Math.max(f,v);c++){if(c<f){this.s[c]=0;for(var h=c;h<this.m;h++)this.s[c]=a.hypot(this.s[c],n[h][c]);if(this.s[c]!==0){n[c][c]<0&&(this.s[c]=-this.s[c]);for(var d=c;d<this.m;d++)n[d][c]/=this.s[c];n[c][c]+=1}this.s[c]=-this.s[c]}for(var g=c+1;g<this.n;g++){if((function(ke,ze){return ke&&ze})(c<f,this.s[c]!==0)){for(var m=0,p=c;p<this.m;p++)m+=n[p][c]*n[p][g];m=-m/n[c][c];for(var y=c;y<this.m;y++)n[y][g]+=m*n[y][c]}o[g]=n[c][g]}if((function(ke,ze){return ke&&ze})(u,c<f))for(var b=c;b<this.m;b++)this.U[b][c]=n[b][c];if(c<v){o[c]=0;for(var E=c+1;E<this.n;E++)o[c]=a.hypot(o[c],o[E]);if(o[c]!==0){o[c+1]<0&&(o[c]=-o[c]);for(var C=c+1;C<this.n;C++)o[C]/=o[c];o[c+1]+=1}if(o[c]=-o[c],(function(ke,ze){return ke&&ze})(c+1<this.m,o[c]!==0)){for(var A=c+1;A<this.m;A++)s[A]=0;for(var D=c+1;D<this.n;D++)for(var N=c+1;N<this.m;N++)s[N]+=o[D]*n[N][D];for(var O=c+1;O<this.n;O++)for(var R=-o[O]/o[c+1],P=c+1;P<this.m;P++)n[P][O]+=R*s[P]}if(l)for(var w=c+1;w<this.n;w++)this.V[w][c]=o[w]}}var x=Math.min(this.n,this.m+1);if(f<this.n&&(this.s[f]=n[f][f]),this.m<x&&(this.s[x-1]=0),v+1<x&&(o[v]=n[v][x-1]),o[x-1]=0,u){for(var T=f;T<i;T++){for(var M=0;M<this.m;M++)this.U[M][T]=0;this.U[T][T]=1}for(var S=f-1;S>=0;S--)if(this.s[S]!==0){for(var I=S+1;I<i;I++){for(var B=0,V=S;V<this.m;V++)B+=this.U[V][S]*this.U[V][I];B=-B/this.U[S][S];for(var F=S;F<this.m;F++)this.U[F][I]+=B*this.U[F][S]}for(var k=S;k<this.m;k++)this.U[k][S]=-this.U[k][S];this.U[S][S]=1+this.U[S][S];for(var U=0;U<S-1;U++)this.U[U][S]=0}else{for(var J=0;J<this.m;J++)this.U[J][S]=0;this.U[S][S]=1}}if(l)for(var W=this.n-1;W>=0;W--){if((function(ke,ze){return ke&&ze})(W<v,o[W]!==0))for(var Q=W+1;Q<i;Q++){for(var Z=0,H=W+1;H<this.n;H++)Z+=this.V[H][W]*this.V[H][Q];Z=-Z/this.V[W+1][W];for(var j=W+1;j<this.n;j++)this.V[j][Q]+=Z*this.V[j][W]}for(var $=0;$<this.n;$++)this.V[$][W]=0;this.V[W][W]=1}for(var q=x-1,K=0,ee=Math.pow(2,-52),ne=Math.pow(2,-966);x>0;){var te=void 0,be=void 0;for(te=x-2;te>=-1&&te!==-1;te--)if(Math.abs(o[te])<=ne+ee*(Math.abs(this.s[te])+Math.abs(this.s[te+1]))){o[te]=0;break}if(te===x-2)be=4;else{var Se=void 0;for(Se=x-1;Se>=te&&Se!==te;Se--){var ve=(Se!==x?Math.abs(o[Se]):0)+(Se!==te+1?Math.abs(o[Se-1]):0);if(Math.abs(this.s[Se])<=ne+ee*ve){this.s[Se]=0;break}}Se===te?be=3:Se===x-1?be=1:(be=2,te=Se)}switch(te++,be){case 1:{var oe=o[x-2];o[x-2]=0;for(var he=x-2;he>=te;he--){var se=a.hypot(this.s[he],oe),pe=this.s[he]/se,de=oe/se;if(this.s[he]=se,he!==te&&(oe=-de*o[he-1],o[he-1]=pe*o[he-1]),l)for(var Ee=0;Ee<this.n;Ee++)se=pe*this.V[Ee][he]+de*this.V[Ee][x-1],this.V[Ee][x-1]=-de*this.V[Ee][he]+pe*this.V[Ee][x-1],this.V[Ee][he]=se}}break;case 2:{var xe=o[te-1];o[te-1]=0;for(var De=te;De<x;De++){var Oe=a.hypot(this.s[De],xe),Pe=this.s[De]/Oe,Ie=xe/Oe;if(this.s[De]=Oe,xe=-Ie*o[De],o[De]=Pe*o[De],u)for(var Ne=0;Ne<this.m;Ne++)Oe=Pe*this.U[Ne][De]+Ie*this.U[Ne][te-1],this.U[Ne][te-1]=-Ie*this.U[Ne][De]+Pe*this.U[Ne][te-1],this.U[Ne][De]=Oe}}break;case 3:{var Y=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[x-1]),Math.abs(this.s[x-2])),Math.abs(o[x-2])),Math.abs(this.s[te])),Math.abs(o[te])),L=this.s[x-1]/Y,z=this.s[x-2]/Y,G=o[x-2]/Y,X=this.s[te]/Y,_=o[te]/Y,le=((z+L)*(z-L)+G*G)/2,re=L*G*(L*G),ae=0;(function(ke,ze){return ke||ze})(le!==0,re!==0)&&(ae=Math.sqrt(le*le+re),le<0&&(ae=-ae),ae=re/(le+ae));for(var ie=(X+L)*(X-L)+ae,fe=X*_,ue=te;ue<x-1;ue++){var me=a.hypot(ie,fe),ge=ie/me,ye=fe/me;if(ue!==te&&(o[ue-1]=me),ie=ge*this.s[ue]+ye*o[ue],o[ue]=ge*o[ue]-ye*this.s[ue],fe=ye*this.s[ue+1],this.s[ue+1]=ge*this.s[ue+1],l)for(var ce=0;ce<this.n;ce++)me=ge*this.V[ce][ue]+ye*this.V[ce][ue+1],this.V[ce][ue+1]=-ye*this.V[ce][ue]+ge*this.V[ce][ue+1],this.V[ce][ue]=me;if(me=a.hypot(ie,fe),ge=ie/me,ye=fe/me,this.s[ue]=me,ie=ge*o[ue]+ye*this.s[ue+1],this.s[ue+1]=-ye*o[ue]+ge*this.s[ue+1],fe=ye*o[ue+1],o[ue+1]=ge*o[ue+1],u&&ue<this.m-1)for(var Ae=0;Ae<this.m;Ae++)me=ge*this.U[Ae][ue]+ye*this.U[Ae][ue+1],this.U[Ae][ue+1]=-ye*this.U[Ae][ue]+ge*this.U[Ae][ue+1],this.U[Ae][ue]=me}o[x-2]=ie,K=K+1}break;case 4:{if(this.s[te]<=0&&(this.s[te]=this.s[te]<0?-this.s[te]:0,l))for(var Te=0;Te<=q;Te++)this.V[Te][te]=-this.V[Te][te];for(;te<q&&!(this.s[te]>=this.s[te+1]);){var Me=this.s[te];if(this.s[te]=this.s[te+1],this.s[te+1]=Me,l&&te<this.n-1)for(var Fe=0;Fe<this.n;Fe++)Me=this.V[Fe][te+1],this.V[Fe][te+1]=this.V[Fe][te],this.V[Fe][te]=Me;if(u&&te<this.m-1)for(var Be=0;Be<this.m;Be++)Me=this.U[Be][te+1],this.U[Be][te+1]=this.U[Be][te],this.U[Be][te]=Me;te++}K=0,x--}break}}var Ye={U:this.U,V:this.V,S:this.s};return Ye},a.hypot=function(n,i){var o=void 0;return Math.abs(n)>Math.abs(i)?(o=i/n,o=Math.abs(n)*Math.sqrt(1+o*o)):i!=0?(o=n/i,o=Math.abs(i)*Math.sqrt(1+o*o)):o=0,o},t.exports=a}),(function(t,e,r){"use strict";var a=(function(){function o(s,u){for(var l=0;l<u.length;l++){var f=u[l];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(s,f.key,f)}}return function(s,u,l){return u&&o(s.prototype,u),l&&o(s,l),s}})();function n(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}var i=(function(){function o(s,u){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;n(this,o),this.sequence1=s,this.sequence2=u,this.match_score=l,this.mismatch_penalty=f,this.gap_penalty=v,this.iMax=s.length+1,this.jMax=u.length+1,this.grid=new Array(this.iMax);for(var c=0;c<this.iMax;c++){this.grid[c]=new Array(this.jMax);for(var h=0;h<this.jMax;h++)this.grid[c][h]=0}this.tracebackGrid=new Array(this.iMax);for(var d=0;d<this.iMax;d++){this.tracebackGrid[d]=new Array(this.jMax);for(var g=0;g<this.jMax;g++)this.tracebackGrid[d][g]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return a(o,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var u=1;u<this.jMax;u++)this.grid[0][u]=this.grid[0][u-1]+this.gap_penalty,this.tracebackGrid[0][u]=[!1,!1,!0];for(var l=1;l<this.iMax;l++)this.grid[l][0]=this.grid[l-1][0]+this.gap_penalty,this.tracebackGrid[l][0]=[!1,!0,!1];for(var f=1;f<this.iMax;f++)for(var v=1;v<this.jMax;v++){var c=void 0;this.sequence1[f-1]===this.sequence2[v-1]?c=this.grid[f-1][v-1]+this.match_score:c=this.grid[f-1][v-1]+this.mismatch_penalty;var h=this.grid[f-1][v]+this.gap_penalty,d=this.grid[f][v-1]+this.gap_penalty,g=[c,h,d],m=this.arrayAllMaxIndexes(g);this.grid[f][v]=g[m[0]],this.tracebackGrid[f][v]=[m.includes(0),m.includes(1),m.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var u=[];for(u.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});u[0];){var l=u[0],f=this.tracebackGrid[l.pos[0]][l.pos[1]];f[0]&&u.push({pos:[l.pos[0]-1,l.pos[1]-1],seq1:this.sequence1[l.pos[0]-1]+l.seq1,seq2:this.sequence2[l.pos[1]-1]+l.seq2}),f[1]&&u.push({pos:[l.pos[0]-1,l.pos[1]],seq1:this.sequence1[l.pos[0]-1]+l.seq1,seq2:"-"+l.seq2}),f[2]&&u.push({pos:[l.pos[0],l.pos[1]-1],seq1:"-"+l.seq1,seq2:this.sequence2[l.pos[1]-1]+l.seq2}),l.pos[0]===0&&l.pos[1]===0&&this.alignments.push({sequence1:l.seq1,sequence2:l.seq2}),u.shift()}return this.alignments}},{key:"getAllIndexes",value:function(u,l){for(var f=[],v=-1;(v=u.indexOf(l,v+1))!==-1;)f.push(v);return f}},{key:"arrayAllMaxIndexes",value:function(u){return this.getAllIndexes(u,Math.max.apply(null,u))}}]),o})();t.exports=i}),(function(t,e,r){"use strict";var a=function(){};a.FDLayout=r(18),a.FDLayoutConstants=r(4),a.FDLayoutEdge=r(19),a.FDLayoutNode=r(20),a.DimensionD=r(21),a.HashMap=r(22),a.HashSet=r(23),a.IGeometry=r(8),a.IMath=r(9),a.Integer=r(10),a.Point=r(12),a.PointD=r(5),a.RandomSeed=r(16),a.RectangleD=r(13),a.Transform=r(17),a.UniqueIDGeneretor=r(14),a.Quicksort=r(25),a.LinkedList=r(11),a.LGraphObject=r(2),a.LGraph=r(6),a.LEdge=r(1),a.LGraphManager=r(7),a.LNode=r(3),a.Layout=r(15),a.LayoutConstants=r(0),a.NeedlemanWunsch=r(27),a.Matrix=r(24),a.SVD=r(26),t.exports=a}),(function(t,e,r){"use strict";function a(){this.listeners=[]}var n=a.prototype;n.addListener=function(i,o){this.listeners.push({event:i,callback:o})},n.removeListener=function(i,o){for(var s=this.listeners.length;s>=0;s--){var u=this.listeners[s];u.event===i&&u.callback===o&&this.listeners.splice(s,1)}},n.emit=function(i,o){for(var s=0;s<this.listeners.length;s++){var u=this.listeners[s];i===u.event&&u.callback(o)}},t.exports=a})])})});var nl=Pi((yn,al)=>{"use strict";(function(e,r){typeof yn=="object"&&typeof al=="object"?al.exports=r(rl()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof yn=="object"?yn.coseBase=r(rl()):e.coseBase=r(e.layoutBase)})(yn,function(t){return(()=>{"use strict";var e={45:((i,o,s)=>{var u={};u.layoutBase=s(551),u.CoSEConstants=s(806),u.CoSEEdge=s(767),u.CoSEGraph=s(880),u.CoSEGraphManager=s(578),u.CoSELayout=s(765),u.CoSENode=s(991),u.ConstraintHandler=s(902),i.exports=u}),806:((i,o,s)=>{var u=s(551).FDLayoutConstants;function l(){}for(var f in u)l[f]=u[f];l.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,l.DEFAULT_RADIAL_SEPARATION=u.DEFAULT_EDGE_LENGTH,l.DEFAULT_COMPONENT_SEPERATION=60,l.TILE=!0,l.TILING_PADDING_VERTICAL=10,l.TILING_PADDING_HORIZONTAL=10,l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!0,l.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,l.TREE_REDUCTION_ON_INCREMENTAL=!0,l.PURE_INCREMENTAL=l.DEFAULT_INCREMENTAL,i.exports=l}),767:((i,o,s)=>{var u=s(551).FDLayoutEdge;function l(v,c,h){u.call(this,v,c,h)}l.prototype=Object.create(u.prototype);for(var f in u)l[f]=u[f];i.exports=l}),880:((i,o,s)=>{var u=s(551).LGraph;function l(v,c,h){u.call(this,v,c,h)}l.prototype=Object.create(u.prototype);for(var f in u)l[f]=u[f];i.exports=l}),578:((i,o,s)=>{var u=s(551).LGraphManager;function l(v){u.call(this,v)}l.prototype=Object.create(u.prototype);for(var f in u)l[f]=u[f];i.exports=l}),765:((i,o,s)=>{var u=s(551).FDLayout,l=s(578),f=s(880),v=s(991),c=s(767),h=s(806),d=s(902),g=s(551).FDLayoutConstants,m=s(551).LayoutConstants,p=s(551).Point,y=s(551).PointD,b=s(551).DimensionD,E=s(551).Layout,C=s(551).Integer,A=s(551).IGeometry,D=s(551).LGraph,N=s(551).Transform,O=s(551).LinkedList;function R(){u.call(this),this.toBeTiled={},this.constraints={}}R.prototype=Object.create(u.prototype);for(var P in u)R[P]=u[P];R.prototype.newGraphManager=function(){var w=new l(this);return this.graphManager=w,w},R.prototype.newGraph=function(w){return new f(null,this.graphManager,w)},R.prototype.newNode=function(w){return new v(this.graphManager,w)},R.prototype.newEdge=function(w){return new c(null,null,w)},R.prototype.initParameters=function(){u.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=g.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=g.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},R.prototype.initSpringEmbedder=function(){u.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/g.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},R.prototype.layout=function(){var w=m.DEFAULT_CREATE_BENDS_AS_NEEDED;return w&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},R.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(h.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),T=this.nodesWithGravity.filter(function(I){return x.has(I)});this.graphManager.setAllNodesToApplyGravitation(T)}}else{var w=this.getFlatForest();if(w.length>0)this.positionNodesRadially(w);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),T=this.nodesWithGravity.filter(function(M){return x.has(M)});this.graphManager.setAllNodesToApplyGravitation(T),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(d.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),h.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},R.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%g.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var w=new Set(this.getAllNodes()),x=this.nodesWithGravity.filter(function(S){return w.has(S)});this.graphManager.setAllNodesToApplyGravitation(x),this.graphManager.updateBounds(),this.updateGrid(),h.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=g.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()),h.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var T=!this.isTreeGrowing&&!this.isGrowthFinished,M=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(T,M),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},R.prototype.getPositionsData=function(){for(var w=this.graphManager.getAllNodes(),x={},T=0;T<w.length;T++){var M=w[T].rect,S=w[T].id;x[S]={id:S,x:M.getCenterX(),y:M.getCenterY(),w:M.width,h:M.height}}return x},R.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var w=!1;if(g.ANIMATE==="during")this.emit("layoutstarted");else{for(;!w;)w=this.tick();this.graphManager.updateBounds()}},R.prototype.moveNodes=function(){for(var w=this.getAllNodes(),x,T=0;T<w.length;T++)x=w[T],x.calculateDisplacement();Object.keys(this.constraints).length>0&&this.updateDisplacements();for(var T=0;T<w.length;T++)x=w[T],x.move()},R.prototype.initConstraintVariables=function(){var w=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var x=this.graphManager.getAllNodes(),T=0;T<x.length;T++){var M=x[T];this.idToNodeMap.set(M.id,M)}var S=function H(j){for(var $=j.getChild().getNodes(),q,K=0,ee=0;ee<$.length;ee++)q=$[ee],q.getChild()==null?w.fixedNodeSet.has(q.id)&&(K+=100):K+=H(q);return K};if(this.constraints.fixedNodeConstraint){this.constraints.fixedNodeConstraint.forEach(function($){w.fixedNodeSet.add($.nodeId)});for(var x=this.graphManager.getAllNodes(),M,T=0;T<x.length;T++)if(M=x[T],M.getChild()!=null){var I=S(M);I>0&&(M.fixedNodeWeight=I)}}if(this.constraints.relativePlacementConstraint){var B=new Map,V=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(H){w.fixedNodesOnHorizontal.add(H),w.fixedNodesOnVertical.add(H)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var F=this.constraints.alignmentConstraint.vertical,T=0;T<F.length;T++)this.dummyToNodeForVerticalAlignment.set("dummy"+T,[]),F[T].forEach(function(j){B.set(j,"dummy"+T),w.dummyToNodeForVerticalAlignment.get("dummy"+T).push(j),w.fixedNodeSet.has(j)&&w.fixedNodesOnHorizontal.add("dummy"+T)});if(this.constraints.alignmentConstraint.horizontal)for(var k=this.constraints.alignmentConstraint.horizontal,T=0;T<k.length;T++)this.dummyToNodeForHorizontalAlignment.set("dummy"+T,[]),k[T].forEach(function(j){V.set(j,"dummy"+T),w.dummyToNodeForHorizontalAlignment.get("dummy"+T).push(j),w.fixedNodeSet.has(j)&&w.fixedNodesOnVertical.add("dummy"+T)})}if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(H){var j,$,q;for(q=H.length-1;q>=2*H.length/3;q--)j=Math.floor(Math.random()*(q+1)),$=H[q],H[q]=H[j],H[j]=$;return H},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(H){if(H.left){var j=B.has(H.left)?B.get(H.left):H.left,$=B.has(H.right)?B.get(H.right):H.right;w.nodesInRelativeHorizontal.includes(j)||(w.nodesInRelativeHorizontal.push(j),w.nodeToRelativeConstraintMapHorizontal.set(j,[]),w.dummyToNodeForVerticalAlignment.has(j)?w.nodeToTempPositionMapHorizontal.set(j,w.idToNodeMap.get(w.dummyToNodeForVerticalAlignment.get(j)[0]).getCenterX()):w.nodeToTempPositionMapHorizontal.set(j,w.idToNodeMap.get(j).getCenterX())),w.nodesInRelativeHorizontal.includes($)||(w.nodesInRelativeHorizontal.push($),w.nodeToRelativeConstraintMapHorizontal.set($,[]),w.dummyToNodeForVerticalAlignment.has($)?w.nodeToTempPositionMapHorizontal.set($,w.idToNodeMap.get(w.dummyToNodeForVerticalAlignment.get($)[0]).getCenterX()):w.nodeToTempPositionMapHorizontal.set($,w.idToNodeMap.get($).getCenterX())),w.nodeToRelativeConstraintMapHorizontal.get(j).push({right:$,gap:H.gap}),w.nodeToRelativeConstraintMapHorizontal.get($).push({left:j,gap:H.gap})}else{var q=V.has(H.top)?V.get(H.top):H.top,K=V.has(H.bottom)?V.get(H.bottom):H.bottom;w.nodesInRelativeVertical.includes(q)||(w.nodesInRelativeVertical.push(q),w.nodeToRelativeConstraintMapVertical.set(q,[]),w.dummyToNodeForHorizontalAlignment.has(q)?w.nodeToTempPositionMapVertical.set(q,w.idToNodeMap.get(w.dummyToNodeForHorizontalAlignment.get(q)[0]).getCenterY()):w.nodeToTempPositionMapVertical.set(q,w.idToNodeMap.get(q).getCenterY())),w.nodesInRelativeVertical.includes(K)||(w.nodesInRelativeVertical.push(K),w.nodeToRelativeConstraintMapVertical.set(K,[]),w.dummyToNodeForHorizontalAlignment.has(K)?w.nodeToTempPositionMapVertical.set(K,w.idToNodeMap.get(w.dummyToNodeForHorizontalAlignment.get(K)[0]).getCenterY()):w.nodeToTempPositionMapVertical.set(K,w.idToNodeMap.get(K).getCenterY())),w.nodeToRelativeConstraintMapVertical.get(q).push({bottom:K,gap:H.gap}),w.nodeToRelativeConstraintMapVertical.get(K).push({top:q,gap:H.gap})}});else{var U=new Map,J=new Map;this.constraints.relativePlacementConstraint.forEach(function(H){if(H.left){var j=B.has(H.left)?B.get(H.left):H.left,$=B.has(H.right)?B.get(H.right):H.right;U.has(j)?U.get(j).push($):U.set(j,[$]),U.has($)?U.get($).push(j):U.set($,[j])}else{var q=V.has(H.top)?V.get(H.top):H.top,K=V.has(H.bottom)?V.get(H.bottom):H.bottom;J.has(q)?J.get(q).push(K):J.set(q,[K]),J.has(K)?J.get(K).push(q):J.set(K,[q])}});var W=function(j,$){var q=[],K=[],ee=new O,ne=new Set,te=0;return j.forEach(function(be,Se){if(!ne.has(Se)){q[te]=[],K[te]=!1;var ve=Se;for(ee.push(ve),ne.add(ve),q[te].push(ve);ee.length!=0;){ve=ee.shift(),$.has(ve)&&(K[te]=!0);var oe=j.get(ve);oe.forEach(function(he){ne.has(he)||(ee.push(he),ne.add(he),q[te].push(he))})}te++}}),{components:q,isFixed:K}},Q=W(U,w.fixedNodesOnHorizontal);this.componentsOnHorizontal=Q.components,this.fixedComponentsOnHorizontal=Q.isFixed;var Z=W(J,w.fixedNodesOnVertical);this.componentsOnVertical=Z.components,this.fixedComponentsOnVertical=Z.isFixed}}},R.prototype.updateDisplacements=function(){var w=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(Z){var H=w.idToNodeMap.get(Z.nodeId);H.displacementX=0,H.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var x=this.constraints.alignmentConstraint.vertical,T=0;T<x.length;T++){for(var M=0,S=0;S<x[T].length;S++){if(this.fixedNodeSet.has(x[T][S])){M=0;break}M+=this.idToNodeMap.get(x[T][S]).displacementX}for(var I=M/x[T].length,S=0;S<x[T].length;S++)this.idToNodeMap.get(x[T][S]).displacementX=I}if(this.constraints.alignmentConstraint.horizontal)for(var B=this.constraints.alignmentConstraint.horizontal,T=0;T<B.length;T++){for(var V=0,S=0;S<B[T].length;S++){if(this.fixedNodeSet.has(B[T][S])){V=0;break}V+=this.idToNodeMap.get(B[T][S]).displacementY}for(var F=V/B[T].length,S=0;S<B[T].length;S++)this.idToNodeMap.get(B[T][S]).displacementY=F}}if(this.constraints.relativePlacementConstraint)if(h.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(Z){if(!w.fixedNodesOnHorizontal.has(Z)){var H=0;w.dummyToNodeForVerticalAlignment.has(Z)?H=w.idToNodeMap.get(w.dummyToNodeForVerticalAlignment.get(Z)[0]).displacementX:H=w.idToNodeMap.get(Z).displacementX,w.nodeToRelativeConstraintMapHorizontal.get(Z).forEach(function(j){if(j.right){var $=w.nodeToTempPositionMapHorizontal.get(j.right)-w.nodeToTempPositionMapHorizontal.get(Z)-H;$<j.gap&&(H-=j.gap-$)}else{var $=w.nodeToTempPositionMapHorizontal.get(Z)-w.nodeToTempPositionMapHorizontal.get(j.left)+H;$<j.gap&&(H+=j.gap-$)}}),w.nodeToTempPositionMapHorizontal.set(Z,w.nodeToTempPositionMapHorizontal.get(Z)+H),w.dummyToNodeForVerticalAlignment.has(Z)?w.dummyToNodeForVerticalAlignment.get(Z).forEach(function(j){w.idToNodeMap.get(j).displacementX=H}):w.idToNodeMap.get(Z).displacementX=H}}),this.nodesInRelativeVertical.forEach(function(Z){if(!w.fixedNodesOnHorizontal.has(Z)){var H=0;w.dummyToNodeForHorizontalAlignment.has(Z)?H=w.idToNodeMap.get(w.dummyToNodeForHorizontalAlignment.get(Z)[0]).displacementY:H=w.idToNodeMap.get(Z).displacementY,w.nodeToRelativeConstraintMapVertical.get(Z).forEach(function(j){if(j.bottom){var $=w.nodeToTempPositionMapVertical.get(j.bottom)-w.nodeToTempPositionMapVertical.get(Z)-H;$<j.gap&&(H-=j.gap-$)}else{var $=w.nodeToTempPositionMapVertical.get(Z)-w.nodeToTempPositionMapVertical.get(j.top)+H;$<j.gap&&(H+=j.gap-$)}}),w.nodeToTempPositionMapVertical.set(Z,w.nodeToTempPositionMapVertical.get(Z)+H),w.dummyToNodeForHorizontalAlignment.has(Z)?w.dummyToNodeForHorizontalAlignment.get(Z).forEach(function(j){w.idToNodeMap.get(j).displacementY=H}):w.idToNodeMap.get(Z).displacementY=H}});else{for(var T=0;T<this.componentsOnHorizontal.length;T++){var k=this.componentsOnHorizontal[T];if(this.fixedComponentsOnHorizontal[T])for(var S=0;S<k.length;S++)this.dummyToNodeForVerticalAlignment.has(k[S])?this.dummyToNodeForVerticalAlignment.get(k[S]).forEach(function(j){w.idToNodeMap.get(j).displacementX=0}):this.idToNodeMap.get(k[S]).displacementX=0;else{for(var U=0,J=0,S=0;S<k.length;S++)if(this.dummyToNodeForVerticalAlignment.has(k[S])){var W=this.dummyToNodeForVerticalAlignment.get(k[S]);U+=W.length*this.idToNodeMap.get(W[0]).displacementX,J+=W.length}else U+=this.idToNodeMap.get(k[S]).displacementX,J++;for(var Q=U/J,S=0;S<k.length;S++)this.dummyToNodeForVerticalAlignment.has(k[S])?this.dummyToNodeForVerticalAlignment.get(k[S]).forEach(function(j){w.idToNodeMap.get(j).displacementX=Q}):this.idToNodeMap.get(k[S]).displacementX=Q}}for(var T=0;T<this.componentsOnVertical.length;T++){var k=this.componentsOnVertical[T];if(this.fixedComponentsOnVertical[T])for(var S=0;S<k.length;S++)this.dummyToNodeForHorizontalAlignment.has(k[S])?this.dummyToNodeForHorizontalAlignment.get(k[S]).forEach(function($){w.idToNodeMap.get($).displacementY=0}):this.idToNodeMap.get(k[S]).displacementY=0;else{for(var U=0,J=0,S=0;S<k.length;S++)if(this.dummyToNodeForHorizontalAlignment.has(k[S])){var W=this.dummyToNodeForHorizontalAlignment.get(k[S]);U+=W.length*this.idToNodeMap.get(W[0]).displacementY,J+=W.length}else U+=this.idToNodeMap.get(k[S]).displacementY,J++;for(var Q=U/J,S=0;S<k.length;S++)this.dummyToNodeForHorizontalAlignment.has(k[S])?this.dummyToNodeForHorizontalAlignment.get(k[S]).forEach(function(ee){w.idToNodeMap.get(ee).displacementY=Q}):this.idToNodeMap.get(k[S]).displacementY=Q}}}},R.prototype.calculateNodesToApplyGravitationTo=function(){var w=[],x,T=this.graphManager.getGraphs(),M=T.length,S;for(S=0;S<M;S++)x=T[S],x.updateConnected(),x.isConnected||(w=w.concat(x.getNodes()));return w},R.prototype.createBendpoints=function(){var w=[];w=w.concat(this.graphManager.getAllEdges());var x=new Set,T;for(T=0;T<w.length;T++){var M=w[T];if(!x.has(M)){var S=M.getSource(),I=M.getTarget();if(S==I)M.getBendpoints().push(new y),M.getBendpoints().push(new y),this.createDummyNodesForBendpoints(M),x.add(M);else{var B=[];if(B=B.concat(S.getEdgeListToNode(I)),B=B.concat(I.getEdgeListToNode(S)),!x.has(B[0])){if(B.length>1){var V;for(V=0;V<B.length;V++){var F=B[V];F.getBendpoints().push(new y),this.createDummyNodesForBendpoints(F)}}B.forEach(function(k){x.add(k)})}}}if(x.size==w.length)break}},R.prototype.positionNodesRadially=function(w){for(var x=new p(0,0),T=Math.ceil(Math.sqrt(w.length)),M=0,S=0,I=0,B=new y(0,0),V=0;V<w.length;V++){V%T==0&&(I=0,S=M,V!=0&&(S+=h.DEFAULT_COMPONENT_SEPERATION),M=0);var F=w[V],k=E.findCenterOfTree(F);x.x=I,x.y=S,B=R.radialLayout(F,k,x),B.y>M&&(M=Math.floor(B.y)),I=Math.floor(B.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new y(m.WORLD_CENTER_X-B.x/2,m.WORLD_CENTER_Y-B.y/2))},R.radialLayout=function(w,x,T){var M=Math.max(this.maxDiagonalInTree(w),h.DEFAULT_RADIAL_SEPARATION);R.branchRadialLayout(x,null,0,359,0,M);var S=D.calculateBounds(w),I=new N;I.setDeviceOrgX(S.getMinX()),I.setDeviceOrgY(S.getMinY()),I.setWorldOrgX(T.x),I.setWorldOrgY(T.y);for(var B=0;B<w.length;B++){var V=w[B];V.transform(I)}var F=new y(S.getMaxX(),S.getMaxY());return I.inverseTransformPoint(F)},R.branchRadialLayout=function(w,x,T,M,S,I){var B=(M-T+1)/2;B<0&&(B+=180);var V=(B+T)%360,F=V*A.TWO_PI/360,k=Math.cos(F),U=S*Math.cos(F),J=S*Math.sin(F);w.setCenter(U,J);var W=[];W=W.concat(w.getEdges());var Q=W.length;x!=null&&Q--;for(var Z=0,H=W.length,j,$=w.getEdgesBetween(x);$.length>1;){var q=$[0];$.splice(0,1);var K=W.indexOf(q);K>=0&&W.splice(K,1),H--,Q--}x!=null?j=(W.indexOf($[0])+1)%H:j=0;for(var ee=Math.abs(M-T)/Q,ne=j;Z!=Q;ne=++ne%H){var te=W[ne].getOtherEnd(w);if(te!=x){var be=(T+Z*ee)%360,Se=(be+ee)%360;R.branchRadialLayout(te,w,be,Se,S+I,I),Z++}}},R.maxDiagonalInTree=function(w){for(var x=C.MIN_VALUE,T=0;T<w.length;T++){var M=w[T],S=M.getDiagonal();S>x&&(x=S)}return x},R.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},R.prototype.groupZeroDegreeMembers=function(){var w=this,x={};this.memberGroups={},this.idToDummyNode={};for(var T=[],M=this.graphManager.getAllNodes(),S=0;S<M.length;S++){var I=M[S],B=I.getParent();this.getNodeDegreeWithChildren(I)===0&&(B.id==null||!this.getToBeTiled(B))&&T.push(I)}for(var S=0;S<T.length;S++){var I=T[S],V=I.getParent().id;typeof x[V]>"u"&&(x[V]=[]),x[V]=x[V].concat(I)}Object.keys(x).forEach(function(F){if(x[F].length>1){var k="DummyCompound_"+F;w.memberGroups[k]=x[F];var U=x[F][0].getParent(),J=new v(w.graphManager);J.id=k,J.paddingLeft=U.paddingLeft||0,J.paddingRight=U.paddingRight||0,J.paddingBottom=U.paddingBottom||0,J.paddingTop=U.paddingTop||0,w.idToDummyNode[k]=J;var W=w.getGraphManager().add(w.newGraph(),J),Q=U.getChild();Q.add(J);for(var Z=0;Z<x[F].length;Z++){var H=x[F][Z];Q.remove(H),W.add(H)}}})},R.prototype.clearCompounds=function(){var w={},x={};this.performDFSOnCompounds();for(var T=0;T<this.compoundOrder.length;T++)x[this.compoundOrder[T].id]=this.compoundOrder[T],w[this.compoundOrder[T].id]=[].concat(this.compoundOrder[T].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[T].getChild()),this.compoundOrder[T].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(w,x)},R.prototype.clearZeroDegreeMembers=function(){var w=this,x=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(T){var M=w.idToDummyNode[T];if(x[T]=w.tileNodes(w.memberGroups[T],M.paddingLeft+M.paddingRight),M.rect.width=x[T].width,M.rect.height=x[T].height,M.setCenter(x[T].centerX,x[T].centerY),M.labelMarginLeft=0,M.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var S=M.rect.width,I=M.rect.height;M.labelWidth&&(M.labelPosHorizontal=="left"?(M.rect.x-=M.labelWidth,M.setWidth(S+M.labelWidth),M.labelMarginLeft=M.labelWidth):M.labelPosHorizontal=="center"&&M.labelWidth>S?(M.rect.x-=(M.labelWidth-S)/2,M.setWidth(M.labelWidth),M.labelMarginLeft=(M.labelWidth-S)/2):M.labelPosHorizontal=="right"&&M.setWidth(S+M.labelWidth)),M.labelHeight&&(M.labelPosVertical=="top"?(M.rect.y-=M.labelHeight,M.setHeight(I+M.labelHeight),M.labelMarginTop=M.labelHeight):M.labelPosVertical=="center"&&M.labelHeight>I?(M.rect.y-=(M.labelHeight-I)/2,M.setHeight(M.labelHeight),M.labelMarginTop=(M.labelHeight-I)/2):M.labelPosVertical=="bottom"&&M.setHeight(I+M.labelHeight))}})},R.prototype.repopulateCompounds=function(){for(var w=this.compoundOrder.length-1;w>=0;w--){var x=this.compoundOrder[w],T=x.id,M=x.paddingLeft,S=x.paddingTop,I=x.labelMarginLeft,B=x.labelMarginTop;this.adjustLocations(this.tiledMemberPack[T],x.rect.x,x.rect.y,M,S,I,B)}},R.prototype.repopulateZeroDegreeMembers=function(){var w=this,x=this.tiledZeroDegreePack;Object.keys(x).forEach(function(T){var M=w.idToDummyNode[T],S=M.paddingLeft,I=M.paddingTop,B=M.labelMarginLeft,V=M.labelMarginTop;w.adjustLocations(x[T],M.rect.x,M.rect.y,S,I,B,V)})},R.prototype.getToBeTiled=function(w){var x=w.id;if(this.toBeTiled[x]!=null)return this.toBeTiled[x];var T=w.getChild();if(T==null)return this.toBeTiled[x]=!1,!1;for(var M=T.getNodes(),S=0;S<M.length;S++){var I=M[S];if(this.getNodeDegree(I)>0)return this.toBeTiled[x]=!1,!1;if(I.getChild()==null){this.toBeTiled[I.id]=!1;continue}if(!this.getToBeTiled(I))return this.toBeTiled[x]=!1,!1}return this.toBeTiled[x]=!0,!0},R.prototype.getNodeDegree=function(w){for(var x=w.id,T=w.getEdges(),M=0,S=0;S<T.length;S++){var I=T[S];I.getSource().id!==I.getTarget().id&&(M=M+1)}return M},R.prototype.getNodeDegreeWithChildren=function(w){var x=this.getNodeDegree(w);if(w.getChild()==null)return x;for(var T=w.getChild().getNodes(),M=0;M<T.length;M++){var S=T[M];x+=this.getNodeDegreeWithChildren(S)}return x},R.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},R.prototype.fillCompexOrderByDFS=function(w){for(var x=0;x<w.length;x++){var T=w[x];T.getChild()!=null&&this.fillCompexOrderByDFS(T.getChild().getNodes()),this.getToBeTiled(T)&&this.compoundOrder.push(T)}},R.prototype.adjustLocations=function(w,x,T,M,S,I,B){x+=M+I,T+=S+B;for(var V=x,F=0;F<w.rows.length;F++){var k=w.rows[F];x=V;for(var U=0,J=0;J<k.length;J++){var W=k[J];W.rect.x=x,W.rect.y=T,x+=W.rect.width+w.horizontalPadding,W.rect.height>U&&(U=W.rect.height)}T+=U+w.verticalPadding}},R.prototype.tileCompoundMembers=function(w,x){var T=this;this.tiledMemberPack=[],Object.keys(w).forEach(function(M){var S=x[M];if(T.tiledMemberPack[M]=T.tileNodes(w[M],S.paddingLeft+S.paddingRight),S.rect.width=T.tiledMemberPack[M].width,S.rect.height=T.tiledMemberPack[M].height,S.setCenter(T.tiledMemberPack[M].centerX,T.tiledMemberPack[M].centerY),S.labelMarginLeft=0,S.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var I=S.rect.width,B=S.rect.height;S.labelWidth&&(S.labelPosHorizontal=="left"?(S.rect.x-=S.labelWidth,S.setWidth(I+S.labelWidth),S.labelMarginLeft=S.labelWidth):S.labelPosHorizontal=="center"&&S.labelWidth>I?(S.rect.x-=(S.labelWidth-I)/2,S.setWidth(S.labelWidth),S.labelMarginLeft=(S.labelWidth-I)/2):S.labelPosHorizontal=="right"&&S.setWidth(I+S.labelWidth)),S.labelHeight&&(S.labelPosVertical=="top"?(S.rect.y-=S.labelHeight,S.setHeight(B+S.labelHeight),S.labelMarginTop=S.labelHeight):S.labelPosVertical=="center"&&S.labelHeight>B?(S.rect.y-=(S.labelHeight-B)/2,S.setHeight(S.labelHeight),S.labelMarginTop=(S.labelHeight-B)/2):S.labelPosVertical=="bottom"&&S.setHeight(B+S.labelHeight))}})},R.prototype.tileNodes=function(w,x){var T=this.tileNodesByFavoringDim(w,x,!0),M=this.tileNodesByFavoringDim(w,x,!1),S=this.getOrgRatio(T),I=this.getOrgRatio(M),B;return I<S?B=M:B=T,B},R.prototype.getOrgRatio=function(w){var x=w.width,T=w.height,M=x/T;return M<1&&(M=1/M),M},R.prototype.calcIdealRowWidth=function(w,x){var T=h.TILING_PADDING_VERTICAL,M=h.TILING_PADDING_HORIZONTAL,S=w.length,I=0,B=0,V=0;w.forEach(function(Z){I+=Z.getWidth(),B+=Z.getHeight(),Z.getWidth()>V&&(V=Z.getWidth())});var F=I/S,k=B/S,U=Math.pow(T-M,2)+4*(F+M)*(k+T)*S,J=(M-T+Math.sqrt(U))/(2*(F+M)),W;x?(W=Math.ceil(J),W==J&&W++):W=Math.floor(J);var Q=W*(F+M)-M;return V>Q&&(Q=V),Q+=M*2,Q},R.prototype.tileNodesByFavoringDim=function(w,x,T){var M=h.TILING_PADDING_VERTICAL,S=h.TILING_PADDING_HORIZONTAL,I=h.TILING_COMPARE_BY,B={rows:[],rowWidth:[],rowHeight:[],width:0,height:x,verticalPadding:M,horizontalPadding:S,centerX:0,centerY:0};I&&(B.idealRowWidth=this.calcIdealRowWidth(w,T));var V=function(H){return H.rect.width*H.rect.height},F=function(H,j){return V(j)-V(H)};w.sort(function(Z,H){var j=F;return B.idealRowWidth?(j=I,j(Z.id,H.id)):j(Z,H)});for(var k=0,U=0,J=0;J<w.length;J++){var W=w[J];k+=W.getCenterX(),U+=W.getCenterY()}B.centerX=k/w.length,B.centerY=U/w.length;for(var J=0;J<w.length;J++){var W=w[J];if(B.rows.length==0)this.insertNodeToRow(B,W,0,x);else if(this.canAddHorizontal(B,W.rect.width,W.rect.height)){var Q=B.rows.length-1;B.idealRowWidth||(Q=this.getShortestRowIndex(B)),this.insertNodeToRow(B,W,Q,x)}else this.insertNodeToRow(B,W,B.rows.length,x);this.shiftToLastRow(B)}return B},R.prototype.insertNodeToRow=function(w,x,T,M){var S=M;if(T==w.rows.length){var I=[];w.rows.push(I),w.rowWidth.push(S),w.rowHeight.push(0)}var B=w.rowWidth[T]+x.rect.width;w.rows[T].length>0&&(B+=w.horizontalPadding),w.rowWidth[T]=B,w.width<B&&(w.width=B);var V=x.rect.height;T>0&&(V+=w.verticalPadding);var F=0;V>w.rowHeight[T]&&(F=w.rowHeight[T],w.rowHeight[T]=V,F=w.rowHeight[T]-F),w.height+=F,w.rows[T].push(x)},R.prototype.getShortestRowIndex=function(w){for(var x=-1,T=Number.MAX_VALUE,M=0;M<w.rows.length;M++)w.rowWidth[M]<T&&(x=M,T=w.rowWidth[M]);return x},R.prototype.getLongestRowIndex=function(w){for(var x=-1,T=Number.MIN_VALUE,M=0;M<w.rows.length;M++)w.rowWidth[M]>T&&(x=M,T=w.rowWidth[M]);return x},R.prototype.canAddHorizontal=function(w,x,T){if(w.idealRowWidth){var M=w.rows.length-1,S=w.rowWidth[M];return S+x+w.horizontalPadding<=w.idealRowWidth}var I=this.getShortestRowIndex(w);if(I<0)return!0;var B=w.rowWidth[I];if(B+w.horizontalPadding+x<=w.width)return!0;var V=0;w.rowHeight[I]<T&&I>0&&(V=T+w.verticalPadding-w.rowHeight[I]);var F;w.width-B>=x+w.horizontalPadding?F=(w.height+V)/(B+x+w.horizontalPadding):F=(w.height+V)/w.width,V=T+w.verticalPadding;var k;return w.width<x?k=(w.height+V)/x:k=(w.height+V)/w.width,k<1&&(k=1/k),F<1&&(F=1/F),F<k},R.prototype.shiftToLastRow=function(w){var x=this.getLongestRowIndex(w),T=w.rowWidth.length-1,M=w.rows[x],S=M[M.length-1],I=S.width+w.horizontalPadding;if(w.width-w.rowWidth[T]>I&&x!=T){M.splice(-1,1),w.rows[T].push(S),w.rowWidth[x]=w.rowWidth[x]-I,w.rowWidth[T]=w.rowWidth[T]+I,w.width=w.rowWidth[instance.getLongestRowIndex(w)];for(var B=Number.MIN_VALUE,V=0;V<M.length;V++)M[V].height>B&&(B=M[V].height);x>0&&(B+=w.verticalPadding);var F=w.rowHeight[x]+w.rowHeight[T];w.rowHeight[x]=B,w.rowHeight[T]<S.height+w.verticalPadding&&(w.rowHeight[T]=S.height+w.verticalPadding);var k=w.rowHeight[x]+w.rowHeight[T];w.height+=k-F,this.shiftToLastRow(w)}},R.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},R.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},R.prototype.reduceTrees=function(){for(var w=[],x=!0,T;x;){var M=this.graphManager.getAllNodes(),S=[];x=!1;for(var I=0;I<M.length;I++)if(T=M[I],T.getEdges().length==1&&!T.getEdges()[0].isInterGraph&&T.getChild()==null){if(h.PURE_INCREMENTAL){var B=T.getEdges()[0].getOtherEnd(T),V=new b(T.getCenterX()-B.getCenterX(),T.getCenterY()-B.getCenterY());S.push([T,T.getEdges()[0],T.getOwner(),V])}else S.push([T,T.getEdges()[0],T.getOwner()]);x=!0}if(x==!0){for(var F=[],k=0;k<S.length;k++)S[k][0].getEdges().length==1&&(F.push(S[k]),S[k][0].getOwner().remove(S[k][0]));w.push(F),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=w},R.prototype.growTree=function(w){for(var x=w.length,T=w[x-1],M,S=0;S<T.length;S++)M=T[S],this.findPlaceforPrunedNode(M),M[2].add(M[0]),M[2].add(M[1],M[1].source,M[1].target);w.splice(w.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},R.prototype.findPlaceforPrunedNode=function(w){var x,T,M=w[0];if(M==w[1].source?T=w[1].target:T=w[1].source,h.PURE_INCREMENTAL)M.setCenter(T.getCenterX()+w[3].getWidth(),T.getCenterY()+w[3].getHeight());else{var S=T.startX,I=T.finishX,B=T.startY,V=T.finishY,F=0,k=0,U=0,J=0,W=[F,U,k,J];if(B>0)for(var Q=S;Q<=I;Q++)W[0]+=this.grid[Q][B-1].length+this.grid[Q][B].length-1;if(I<this.grid.length-1)for(var Q=B;Q<=V;Q++)W[1]+=this.grid[I+1][Q].length+this.grid[I][Q].length-1;if(V<this.grid[0].length-1)for(var Q=S;Q<=I;Q++)W[2]+=this.grid[Q][V+1].length+this.grid[Q][V].length-1;if(S>0)for(var Q=B;Q<=V;Q++)W[3]+=this.grid[S-1][Q].length+this.grid[S][Q].length-1;for(var Z=C.MAX_VALUE,H,j,$=0;$<W.length;$++)W[$]<Z?(Z=W[$],H=1,j=$):W[$]==Z&&H++;if(H==3&&Z==0)W[0]==0&&W[1]==0&&W[2]==0?x=1:W[0]==0&&W[1]==0&&W[3]==0?x=0:W[0]==0&&W[2]==0&&W[3]==0?x=3:W[1]==0&&W[2]==0&&W[3]==0&&(x=2);else if(H==2&&Z==0){var q=Math.floor(Math.random()*2);W[0]==0&&W[1]==0?q==0?x=0:x=1:W[0]==0&&W[2]==0?q==0?x=0:x=2:W[0]==0&&W[3]==0?q==0?x=0:x=3:W[1]==0&&W[2]==0?q==0?x=1:x=2:W[1]==0&&W[3]==0?q==0?x=1:x=3:q==0?x=2:x=3}else if(H==4&&Z==0){var q=Math.floor(Math.random()*4);x=q}else x=j;x==0?M.setCenter(T.getCenterX(),T.getCenterY()-T.getHeight()/2-g.DEFAULT_EDGE_LENGTH-M.getHeight()/2):x==1?M.setCenter(T.getCenterX()+T.getWidth()/2+g.DEFAULT_EDGE_LENGTH+M.getWidth()/2,T.getCenterY()):x==2?M.setCenter(T.getCenterX(),T.getCenterY()+T.getHeight()/2+g.DEFAULT_EDGE_LENGTH+M.getHeight()/2):M.setCenter(T.getCenterX()-T.getWidth()/2-g.DEFAULT_EDGE_LENGTH-M.getWidth()/2,T.getCenterY())}},i.exports=R}),991:((i,o,s)=>{var u=s(551).FDLayoutNode,l=s(551).IMath;function f(c,h,d,g){u.call(this,c,h,d,g)}f.prototype=Object.create(u.prototype);for(var v in u)f[v]=u[v];f.prototype.calculateDisplacement=function(){var c=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=c.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=c.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=c.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=c.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>c.coolingFactor*c.maxNodeDisplacement&&(this.displacementX=c.coolingFactor*c.maxNodeDisplacement*l.sign(this.displacementX)),Math.abs(this.displacementY)>c.coolingFactor*c.maxNodeDisplacement&&(this.displacementY=c.coolingFactor*c.maxNodeDisplacement*l.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},f.prototype.propogateDisplacementToChildren=function(c,h){for(var d=this.getChild().getNodes(),g,m=0;m<d.length;m++)g=d[m],g.getChild()==null?(g.displacementX+=c,g.displacementY+=h):g.propogateDisplacementToChildren(c,h)},f.prototype.move=function(){var c=this.graphManager.getLayout();(this.child==null||this.child.getNodes().length==0)&&(this.moveBy(this.displacementX,this.displacementY),c.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},f.prototype.setPred1=function(c){this.pred1=c},f.prototype.getPred1=function(){return pred1},f.prototype.getPred2=function(){return pred2},f.prototype.setNext=function(c){this.next=c},f.prototype.getNext=function(){return next},f.prototype.setProcessed=function(c){this.processed=c},f.prototype.isProcessed=function(){return processed},i.exports=f}),902:((i,o,s)=>{function u(d){if(Array.isArray(d)){for(var g=0,m=Array(d.length);g<d.length;g++)m[g]=d[g];return m}else return Array.from(d)}var l=s(806),f=s(551).LinkedList,v=s(551).Matrix,c=s(551).SVD;function h(){}h.handleConstraints=function(d){var g={};g.fixedNodeConstraint=d.constraints.fixedNodeConstraint,g.alignmentConstraint=d.constraints.alignmentConstraint,g.relativePlacementConstraint=d.constraints.relativePlacementConstraint;for(var m=new Map,p=new Map,y=[],b=[],E=d.getAllNodes(),C=0,A=0;A<E.length;A++){var D=E[A];D.getChild()==null&&(p.set(D.id,C++),y.push(D.getCenterX()),b.push(D.getCenterY()),m.set(D.id,D))}g.relativePlacementConstraint&&g.relativePlacementConstraint.forEach(function(Y){!Y.gap&&Y.gap!=0&&(Y.left?Y.gap=l.DEFAULT_EDGE_LENGTH+m.get(Y.left).getWidth()/2+m.get(Y.right).getWidth()/2:Y.gap=l.DEFAULT_EDGE_LENGTH+m.get(Y.top).getHeight()/2+m.get(Y.bottom).getHeight()/2)});var N=function(L,z){return{x:L.x-z.x,y:L.y-z.y}},O=function(L){var z=0,G=0;return L.forEach(function(X){z+=y[p.get(X)],G+=b[p.get(X)]}),{x:z/L.size,y:G/L.size}},R=function(L,z,G,X,_){function le(ye,ce){var Ae=new Set(ye),Te=!0,Me=!1,Fe=void 0;try{for(var Be=ce[Symbol.iterator](),Ye;!(Te=(Ye=Be.next()).done);Te=!0){var ke=Ye.value;Ae.add(ke)}}catch(ze){Me=!0,Fe=ze}finally{try{!Te&&Be.return&&Be.return()}finally{if(Me)throw Fe}}return Ae}var re=new Map;L.forEach(function(ye,ce){re.set(ce,0)}),L.forEach(function(ye,ce){ye.forEach(function(Ae){re.set(Ae.id,re.get(Ae.id)+1)})});var ae=new Map,ie=new Map,fe=new f;re.forEach(function(ye,ce){ye==0?(fe.push(ce),G||(z=="horizontal"?ae.set(ce,p.has(ce)?y[p.get(ce)]:X.get(ce)):ae.set(ce,p.has(ce)?b[p.get(ce)]:X.get(ce)))):ae.set(ce,Number.NEGATIVE_INFINITY),G&&ie.set(ce,new Set([ce]))}),G&&_.forEach(function(ye){var ce=[];if(ye.forEach(function(Me){G.has(Me)&&ce.push(Me)}),ce.length>0){var Ae=0;ce.forEach(function(Me){z=="horizontal"?(ae.set(Me,p.has(Me)?y[p.get(Me)]:X.get(Me)),Ae+=ae.get(Me)):(ae.set(Me,p.has(Me)?b[p.get(Me)]:X.get(Me)),Ae+=ae.get(Me))}),Ae=Ae/ce.length,ye.forEach(function(Me){G.has(Me)||ae.set(Me,Ae)})}else{var Te=0;ye.forEach(function(Me){z=="horizontal"?Te+=p.has(Me)?y[p.get(Me)]:X.get(Me):Te+=p.has(Me)?b[p.get(Me)]:X.get(Me)}),Te=Te/ye.length,ye.forEach(function(Me){ae.set(Me,Te)})}});for(var ue=function(){var ce=fe.shift(),Ae=L.get(ce);Ae.forEach(function(Te){if(ae.get(Te.id)<ae.get(ce)+Te.gap)if(G&&G.has(Te.id)){var Me=void 0;if(z=="horizontal"?Me=p.has(Te.id)?y[p.get(Te.id)]:X.get(Te.id):Me=p.has(Te.id)?b[p.get(Te.id)]:X.get(Te.id),ae.set(Te.id,Me),Me<ae.get(ce)+Te.gap){var Fe=ae.get(ce)+Te.gap-Me;ie.get(ce).forEach(function(Be){ae.set(Be,ae.get(Be)-Fe)})}}else ae.set(Te.id,ae.get(ce)+Te.gap);re.set(Te.id,re.get(Te.id)-1),re.get(Te.id)==0&&fe.push(Te.id),G&&ie.set(Te.id,le(ie.get(ce),ie.get(Te.id)))})};fe.length!=0;)ue();if(G){var me=new Set;L.forEach(function(ye,ce){ye.length==0&&me.add(ce)});var ge=[];ie.forEach(function(ye,ce){if(me.has(ce)){var Ae=!1,Te=!0,Me=!1,Fe=void 0;try{for(var Be=ye[Symbol.iterator](),Ye;!(Te=(Ye=Be.next()).done);Te=!0){var ke=Ye.value;G.has(ke)&&(Ae=!0)}}catch(We){Me=!0,Fe=We}finally{try{!Te&&Be.return&&Be.return()}finally{if(Me)throw Fe}}if(!Ae){var ze=!1,qe=void 0;ge.forEach(function(We,Je){We.has([].concat(u(ye))[0])&&(ze=!0,qe=Je)}),ze?ye.forEach(function(We){ge[qe].add(We)}):ge.push(new Set(ye))}}}),ge.forEach(function(ye,ce){var Ae=Number.POSITIVE_INFINITY,Te=Number.POSITIVE_INFINITY,Me=Number.NEGATIVE_INFINITY,Fe=Number.NEGATIVE_INFINITY,Be=!0,Ye=!1,ke=void 0;try{for(var ze=ye[Symbol.iterator](),qe;!(Be=(qe=ze.next()).done);Be=!0){var We=qe.value,Je=void 0;z=="horizontal"?Je=p.has(We)?y[p.get(We)]:X.get(We):Je=p.has(We)?b[p.get(We)]:X.get(We);var ut=ae.get(We);Je<Ae&&(Ae=Je),Je>Me&&(Me=Je),ut<Te&&(Te=ut),ut>Fe&&(Fe=ut)}}catch(ar){Ye=!0,ke=ar}finally{try{!Be&&ze.return&&ze.return()}finally{if(Ye)throw ke}}var cr=(Ae+Me)/2-(Te+Fe)/2,Pt=!0,ft=!1,it=void 0;try{for(var st=ye[Symbol.iterator](),Kt;!(Pt=(Kt=st.next()).done);Pt=!0){var gt=Kt.value;ae.set(gt,ae.get(gt)+cr)}}catch(ar){ft=!0,it=ar}finally{try{!Pt&&st.return&&st.return()}finally{if(ft)throw it}}})}return ae},P=function(L){var z=0,G=0,X=0,_=0;if(L.forEach(function(ie){ie.left?y[p.get(ie.left)]-y[p.get(ie.right)]>=0?z++:G++:b[p.get(ie.top)]-b[p.get(ie.bottom)]>=0?X++:_++}),z>G&&X>_)for(var le=0;le<p.size;le++)y[le]=-1*y[le],b[le]=-1*b[le];else if(z>G)for(var re=0;re<p.size;re++)y[re]=-1*y[re];else if(X>_)for(var ae=0;ae<p.size;ae++)b[ae]=-1*b[ae]},w=function(L){var z=[],G=new f,X=new Set,_=0;return L.forEach(function(le,re){if(!X.has(re)){z[_]=[];var ae=re;for(G.push(ae),X.add(ae),z[_].push(ae);G.length!=0;){ae=G.shift();var ie=L.get(ae);ie.forEach(function(fe){X.has(fe.id)||(G.push(fe.id),X.add(fe.id),z[_].push(fe.id))})}_++}}),z},x=function(L){var z=new Map;return L.forEach(function(G,X){z.set(X,[])}),L.forEach(function(G,X){G.forEach(function(_){z.get(X).push(_),z.get(_.id).push({id:X,gap:_.gap,direction:_.direction})})}),z},T=function(L){var z=new Map;return L.forEach(function(G,X){z.set(X,[])}),L.forEach(function(G,X){G.forEach(function(_){z.get(_.id).push({id:X,gap:_.gap,direction:_.direction})})}),z},M=[],S=[],I=!1,B=!1,V=new Set,F=new Map,k=new Map,U=[];if(g.fixedNodeConstraint&&g.fixedNodeConstraint.forEach(function(Y){V.add(Y.nodeId)}),g.relativePlacementConstraint&&(g.relativePlacementConstraint.forEach(function(Y){Y.left?(F.has(Y.left)?F.get(Y.left).push({id:Y.right,gap:Y.gap,direction:"horizontal"}):F.set(Y.left,[{id:Y.right,gap:Y.gap,direction:"horizontal"}]),F.has(Y.right)||F.set(Y.right,[])):(F.has(Y.top)?F.get(Y.top).push({id:Y.bottom,gap:Y.gap,direction:"vertical"}):F.set(Y.top,[{id:Y.bottom,gap:Y.gap,direction:"vertical"}]),F.has(Y.bottom)||F.set(Y.bottom,[]))}),k=x(F),U=w(k)),l.TRANSFORM_ON_CONSTRAINT_HANDLING){if(g.fixedNodeConstraint&&g.fixedNodeConstraint.length>1)g.fixedNodeConstraint.forEach(function(Y,L){M[L]=[Y.position.x,Y.position.y],S[L]=[y[p.get(Y.nodeId)],b[p.get(Y.nodeId)]]}),I=!0;else if(g.alignmentConstraint)(function(){var Y=0;if(g.alignmentConstraint.vertical){for(var L=g.alignmentConstraint.vertical,z=function(ae){var ie=new Set;L[ae].forEach(function(me){ie.add(me)});var fe=new Set([].concat(u(ie)).filter(function(me){return V.has(me)})),ue=void 0;fe.size>0?ue=y[p.get(fe.values().next().value)]:ue=O(ie).x,L[ae].forEach(function(me){M[Y]=[ue,b[p.get(me)]],S[Y]=[y[p.get(me)],b[p.get(me)]],Y++})},G=0;G<L.length;G++)z(G);I=!0}if(g.alignmentConstraint.horizontal){for(var X=g.alignmentConstraint.horizontal,_=function(ae){var ie=new Set;X[ae].forEach(function(me){ie.add(me)});var fe=new Set([].concat(u(ie)).filter(function(me){return V.has(me)})),ue=void 0;fe.size>0?ue=y[p.get(fe.values().next().value)]:ue=O(ie).y,X[ae].forEach(function(me){M[Y]=[y[p.get(me)],ue],S[Y]=[y[p.get(me)],b[p.get(me)]],Y++})},le=0;le<X.length;le++)_(le);I=!0}g.relativePlacementConstraint&&(B=!0)})();else if(g.relativePlacementConstraint){for(var J=0,W=0,Q=0;Q<U.length;Q++)U[Q].length>J&&(J=U[Q].length,W=Q);if(J<k.size/2)P(g.relativePlacementConstraint),I=!1,B=!1;else{var Z=new Map,H=new Map,j=[];U[W].forEach(function(Y){F.get(Y).forEach(function(L){L.direction=="horizontal"?(Z.has(Y)?Z.get(Y).push(L):Z.set(Y,[L]),Z.has(L.id)||Z.set(L.id,[]),j.push({left:Y,right:L.id})):(H.has(Y)?H.get(Y).push(L):H.set(Y,[L]),H.has(L.id)||H.set(L.id,[]),j.push({top:Y,bottom:L.id}))})}),P(j),B=!1;var $=R(Z,"horizontal"),q=R(H,"vertical");U[W].forEach(function(Y,L){S[L]=[y[p.get(Y)],b[p.get(Y)]],M[L]=[],$.has(Y)?M[L][0]=$.get(Y):M[L][0]=y[p.get(Y)],q.has(Y)?M[L][1]=q.get(Y):M[L][1]=b[p.get(Y)]}),I=!0}}if(I){for(var K=void 0,ee=v.transpose(M),ne=v.transpose(S),te=0;te<ee.length;te++)ee[te]=v.multGamma(ee[te]),ne[te]=v.multGamma(ne[te]);var be=v.multMat(ee,v.transpose(ne)),Se=c.svd(be);K=v.multMat(Se.V,v.transpose(Se.U));for(var ve=0;ve<p.size;ve++){var oe=[y[ve],b[ve]],he=[K[0][0],K[1][0]],se=[K[0][1],K[1][1]];y[ve]=v.dotProduct(oe,he),b[ve]=v.dotProduct(oe,se)}B&&P(g.relativePlacementConstraint)}}if(l.ENFORCE_CONSTRAINTS){if(g.fixedNodeConstraint&&g.fixedNodeConstraint.length>0){var pe={x:0,y:0};g.fixedNodeConstraint.forEach(function(Y,L){var z={x:y[p.get(Y.nodeId)],y:b[p.get(Y.nodeId)]},G=Y.position,X=N(G,z);pe.x+=X.x,pe.y+=X.y}),pe.x/=g.fixedNodeConstraint.length,pe.y/=g.fixedNodeConstraint.length,y.forEach(function(Y,L){y[L]+=pe.x}),b.forEach(function(Y,L){b[L]+=pe.y}),g.fixedNodeConstraint.forEach(function(Y){y[p.get(Y.nodeId)]=Y.position.x,b[p.get(Y.nodeId)]=Y.position.y})}if(g.alignmentConstraint){if(g.alignmentConstraint.vertical)for(var de=g.alignmentConstraint.vertical,Ee=function(L){var z=new Set;de[L].forEach(function(_){z.add(_)});var G=new Set([].concat(u(z)).filter(function(_){return V.has(_)})),X=void 0;G.size>0?X=y[p.get(G.values().next().value)]:X=O(z).x,z.forEach(function(_){V.has(_)||(y[p.get(_)]=X)})},xe=0;xe<de.length;xe++)Ee(xe);if(g.alignmentConstraint.horizontal)for(var De=g.alignmentConstraint.horizontal,Oe=function(L){var z=new Set;De[L].forEach(function(_){z.add(_)});var G=new Set([].concat(u(z)).filter(function(_){return V.has(_)})),X=void 0;G.size>0?X=b[p.get(G.values().next().value)]:X=O(z).y,z.forEach(function(_){V.has(_)||(b[p.get(_)]=X)})},Pe=0;Pe<De.length;Pe++)Oe(Pe)}g.relativePlacementConstraint&&(function(){var Y=new Map,L=new Map,z=new Map,G=new Map,X=new Map,_=new Map,le=new Set,re=new Set;if(V.forEach(function(vt){le.add(vt),re.add(vt)}),g.alignmentConstraint){if(g.alignmentConstraint.vertical)for(var ae=g.alignmentConstraint.vertical,ie=function(Ve){z.set("dummy"+Ve,[]),ae[Ve].forEach(function(_e){Y.set(_e,"dummy"+Ve),z.get("dummy"+Ve).push(_e),V.has(_e)&&le.add("dummy"+Ve)}),X.set("dummy"+Ve,y[p.get(ae[Ve][0])])},fe=0;fe<ae.length;fe++)ie(fe);if(g.alignmentConstraint.horizontal)for(var ue=g.alignmentConstraint.horizontal,me=function(Ve){G.set("dummy"+Ve,[]),ue[Ve].forEach(function(_e){L.set(_e,"dummy"+Ve),G.get("dummy"+Ve).push(_e),V.has(_e)&&re.add("dummy"+Ve)}),_.set("dummy"+Ve,b[p.get(ue[Ve][0])])},ge=0;ge<ue.length;ge++)me(ge)}var ye=new Map,ce=new Map,Ae=function(Ve){F.get(Ve).forEach(function(_e){var ct=void 0,Mt=void 0;_e.direction=="horizontal"?(ct=Y.get(Ve)?Y.get(Ve):Ve,Y.get(_e.id)?Mt={id:Y.get(_e.id),gap:_e.gap,direction:_e.direction}:Mt=_e,ye.has(ct)?ye.get(ct).push(Mt):ye.set(ct,[Mt]),ye.has(Mt.id)||ye.set(Mt.id,[])):(ct=L.get(Ve)?L.get(Ve):Ve,L.get(_e.id)?Mt={id:L.get(_e.id),gap:_e.gap,direction:_e.direction}:Mt=_e,ce.has(ct)?ce.get(ct).push(Mt):ce.set(ct,[Mt]),ce.has(Mt.id)||ce.set(Mt.id,[]))})},Te=!0,Me=!1,Fe=void 0;try{for(var Be=F.keys()[Symbol.iterator](),Ye;!(Te=(Ye=Be.next()).done);Te=!0){var ke=Ye.value;Ae(ke)}}catch(vt){Me=!0,Fe=vt}finally{try{!Te&&Be.return&&Be.return()}finally{if(Me)throw Fe}}var ze=x(ye),qe=x(ce),We=w(ze),Je=w(qe),ut=T(ye),cr=T(ce),Pt=[],ft=[];We.forEach(function(vt,Ve){Pt[Ve]=[],vt.forEach(function(_e){ut.get(_e).length==0&&Pt[Ve].push(_e)})}),Je.forEach(function(vt,Ve){ft[Ve]=[],vt.forEach(function(_e){cr.get(_e).length==0&&ft[Ve].push(_e)})});var it=R(ye,"horizontal",le,X,Pt),st=R(ce,"vertical",re,_,ft),Kt=function(Ve){z.get(Ve)?z.get(Ve).forEach(function(_e){y[p.get(_e)]=it.get(Ve)}):y[p.get(Ve)]=it.get(Ve)},gt=!0,ar=!1,En=void 0;try{for(var Na=it.keys()[Symbol.iterator](),xn;!(gt=(xn=Na.next()).done);gt=!0){var Ra=xn.value;Kt(Ra)}}catch(vt){ar=!0,En=vt}finally{try{!gt&&Na.return&&Na.return()}finally{if(ar)throw En}}var Ri=function(Ve){G.get(Ve)?G.get(Ve).forEach(function(_e){b[p.get(_e)]=st.get(Ve)}):b[p.get(Ve)]=st.get(Ve)},Pa=!0,Tn=!1,hr=void 0;try{for(var Br=st.keys()[Symbol.iterator](),kr;!(Pa=(kr=Br.next()).done);Pa=!0){var Ra=kr.value;Ri(Ra)}}catch(vt){Tn=!0,hr=vt}finally{try{!Pa&&Br.return&&Br.return()}finally{if(Tn)throw hr}}})()}for(var Ie=0;Ie<E.length;Ie++){var Ne=E[Ie];Ne.getChild()==null&&Ne.setCenter(y[p.get(Ne.id)],b[p.get(Ne.id)])}},i.exports=h}),551:(i=>{i.exports=t})},r={};function a(i){var o=r[i];if(o!==void 0)return o.exports;var s=r[i]={exports:{}};return e[i](s,s.exports,a),s.exports}var n=a(45);return n})()})});var Gc=Pi((mn,il)=>{"use strict";(function(e,r){typeof mn=="object"&&typeof il=="object"?il.exports=r(nl()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof mn=="object"?mn.cytoscapeFcose=r(nl()):e.cytoscapeFcose=r(e.coseBase)})(mn,function(t){return(()=>{"use strict";var e={658:(i=>{i.exports=Object.assign!=null?Object.assign.bind(Object):function(o){for(var s=arguments.length,u=Array(s>1?s-1:0),l=1;l<s;l++)u[l-1]=arguments[l];return u.forEach(function(f){Object.keys(f).forEach(function(v){return o[v]=f[v]})}),o}}),548:((i,o,s)=>{var u=(function(){function v(c,h){var d=[],g=!0,m=!1,p=void 0;try{for(var y=c[Symbol.iterator](),b;!(g=(b=y.next()).done)&&(d.push(b.value),!(h&&d.length===h));g=!0);}catch(E){m=!0,p=E}finally{try{!g&&y.return&&y.return()}finally{if(m)throw p}}return d}return function(c,h){if(Array.isArray(c))return c;if(Symbol.iterator in Object(c))return v(c,h);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),l=s(140).layoutBase.LinkedList,f={};f.getTopMostNodes=function(v){for(var c={},h=0;h<v.length;h++)c[v[h].id()]=!0;var d=v.filter(function(g,m){typeof g=="number"&&(g=m);for(var p=g.parent()[0];p!=null;){if(c[p.id()])return!1;p=p.parent()[0]}return!0});return d},f.connectComponents=function(v,c,h,d){var g=new l,m=new Set,p=[],y=void 0,b=void 0,E=void 0,C=!1,A=1,D=[],N=[],O=function(){var P=v.collection();N.push(P);var w=h[0],x=v.collection();x.merge(w).merge(w.descendants().intersection(c)),p.push(w),x.forEach(function(S){g.push(S),m.add(S),P.merge(S)});for(var T=function(){w=g.shift();var I=v.collection();w.neighborhood().nodes().forEach(function(k){c.intersection(w.edgesWith(k)).length>0&&I.merge(k)});for(var B=0;B<I.length;B++){var V=I[B];if(y=h.intersection(V.union(V.ancestors())),y!=null&&!m.has(y[0])){var F=y.union(y.descendants());F.forEach(function(k){g.push(k),m.add(k),P.merge(k),h.has(k)&&p.push(k)})}}};g.length!=0;)T();if(P.forEach(function(S){c.intersection(S.connectedEdges()).forEach(function(I){P.has(I.source())&&P.has(I.target())&&P.merge(I)})}),p.length==h.length&&(C=!0),!C||C&&A>1){b=p[0],E=b.connectedEdges().length,p.forEach(function(S){S.connectedEdges().length<E&&(E=S.connectedEdges().length,b=S)}),D.push(b.id());var M=v.collection();M.merge(p[0]),p.forEach(function(S){M.merge(S)}),p=[],h=h.difference(M),A++}};do O();while(!C);return d&&D.length>0&&d.set("dummy"+(d.size+1),D),N},f.relocateComponent=function(v,c,h){if(!h.fixedNodeConstraint){var d=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,m=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY;if(h.quality=="draft"){var y=!0,b=!1,E=void 0;try{for(var C=c.nodeIndexes[Symbol.iterator](),A;!(y=(A=C.next()).done);y=!0){var D=A.value,N=u(D,2),O=N[0],R=N[1],P=h.cy.getElementById(O);if(P){var w=P.boundingBox(),x=c.xCoords[R]-w.w/2,T=c.xCoords[R]+w.w/2,M=c.yCoords[R]-w.h/2,S=c.yCoords[R]+w.h/2;x<d&&(d=x),T>g&&(g=T),M<m&&(m=M),S>p&&(p=S)}}}catch(k){b=!0,E=k}finally{try{!y&&C.return&&C.return()}finally{if(b)throw E}}var I=v.x-(g+d)/2,B=v.y-(p+m)/2;c.xCoords=c.xCoords.map(function(k){return k+I}),c.yCoords=c.yCoords.map(function(k){return k+B})}else{Object.keys(c).forEach(function(k){var U=c[k],J=U.getRect().x,W=U.getRect().x+U.getRect().width,Q=U.getRect().y,Z=U.getRect().y+U.getRect().height;J<d&&(d=J),W>g&&(g=W),Q<m&&(m=Q),Z>p&&(p=Z)});var V=v.x-(g+d)/2,F=v.y-(p+m)/2;Object.keys(c).forEach(function(k){var U=c[k];U.setCenter(U.getCenterX()+V,U.getCenterY()+F)})}}},f.calcBoundingBox=function(v,c,h,d){for(var g=Number.MAX_SAFE_INTEGER,m=Number.MIN_SAFE_INTEGER,p=Number.MAX_SAFE_INTEGER,y=Number.MIN_SAFE_INTEGER,b=void 0,E=void 0,C=void 0,A=void 0,D=v.descendants().not(":parent"),N=D.length,O=0;O<N;O++){var R=D[O];b=c[d.get(R.id())]-R.width()/2,E=c[d.get(R.id())]+R.width()/2,C=h[d.get(R.id())]-R.height()/2,A=h[d.get(R.id())]+R.height()/2,g>b&&(g=b),m<E&&(m=E),p>C&&(p=C),y<A&&(y=A)}var P={};return P.topLeftX=g,P.topLeftY=p,P.width=m-g,P.height=y-p,P},f.calcParentsWithoutChildren=function(v,c){var h=v.collection();return c.nodes(":parent").forEach(function(d){var g=!1;d.children().forEach(function(m){m.css("display")!="none"&&(g=!0)}),g||h.merge(d)}),h},i.exports=f}),816:((i,o,s)=>{var u=s(548),l=s(140).CoSELayout,f=s(140).CoSENode,v=s(140).layoutBase.PointD,c=s(140).layoutBase.DimensionD,h=s(140).layoutBase.LayoutConstants,d=s(140).layoutBase.FDLayoutConstants,g=s(140).CoSEConstants,m=function(y,b){var E=y.cy,C=y.eles,A=C.nodes(),D=C.edges(),N=void 0,O=void 0,R=void 0,P={};y.randomize&&(N=b.nodeIndexes,O=b.xCoords,R=b.yCoords);var w=function(k){return typeof k=="function"},x=function(k,U){return w(k)?k(U):k},T=u.calcParentsWithoutChildren(E,C),M=function F(k,U,J,W){for(var Q=U.length,Z=0;Z<Q;Z++){var H=U[Z],j=null;H.intersection(T).length==0&&(j=H.children());var $=void 0,q=H.layoutDimensions({nodeDimensionsIncludeLabels:W.nodeDimensionsIncludeLabels});if(H.outerWidth()!=null&&H.outerHeight()!=null)if(W.randomize)if(!H.isParent())$=k.add(new f(J.graphManager,new v(O[N.get(H.id())]-q.w/2,R[N.get(H.id())]-q.h/2),new c(parseFloat(q.w),parseFloat(q.h))));else{var K=u.calcBoundingBox(H,O,R,N);H.intersection(T).length==0?$=k.add(new f(J.graphManager,new v(K.topLeftX,K.topLeftY),new c(K.width,K.height))):$=k.add(new f(J.graphManager,new v(K.topLeftX,K.topLeftY),new c(parseFloat(q.w),parseFloat(q.h))))}else $=k.add(new f(J.graphManager,new v(H.position("x")-q.w/2,H.position("y")-q.h/2),new c(parseFloat(q.w),parseFloat(q.h))));else $=k.add(new f(this.graphManager));if($.id=H.data("id"),$.nodeRepulsion=x(W.nodeRepulsion,H),$.paddingLeft=parseInt(H.css("padding")),$.paddingTop=parseInt(H.css("padding")),$.paddingRight=parseInt(H.css("padding")),$.paddingBottom=parseInt(H.css("padding")),W.nodeDimensionsIncludeLabels&&($.labelWidth=H.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,$.labelHeight=H.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,$.labelPosVertical=H.css("text-valign"),$.labelPosHorizontal=H.css("text-halign")),P[H.data("id")]=$,isNaN($.rect.x)&&($.rect.x=0),isNaN($.rect.y)&&($.rect.y=0),j!=null&&j.length>0){var ee=void 0;ee=J.getGraphManager().add(J.newGraph(),$),F(ee,j,J,W)}}},S=function(k,U,J){for(var W=0,Q=0,Z=0;Z<J.length;Z++){var H=J[Z],j=P[H.data("source")],$=P[H.data("target")];if(j&&$&&j!==$&&j.getEdgesBetween($).length==0){var q=U.add(k.newEdge(),j,$);q.id=H.id(),q.idealLength=x(y.idealEdgeLength,H),q.edgeElasticity=x(y.edgeElasticity,H),W+=q.idealLength,Q++}}y.idealEdgeLength!=null&&(Q>0?g.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=W/Q:w(y.idealEdgeLength)?g.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=50:g.DEFAULT_EDGE_LENGTH=d.DEFAULT_EDGE_LENGTH=y.idealEdgeLength,g.MIN_REPULSION_DIST=d.MIN_REPULSION_DIST=d.DEFAULT_EDGE_LENGTH/10,g.DEFAULT_RADIAL_SEPARATION=d.DEFAULT_EDGE_LENGTH)},I=function(k,U){U.fixedNodeConstraint&&(k.constraints.fixedNodeConstraint=U.fixedNodeConstraint),U.alignmentConstraint&&(k.constraints.alignmentConstraint=U.alignmentConstraint),U.relativePlacementConstraint&&(k.constraints.relativePlacementConstraint=U.relativePlacementConstraint)};y.nestingFactor!=null&&(g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=y.nestingFactor),y.gravity!=null&&(g.DEFAULT_GRAVITY_STRENGTH=d.DEFAULT_GRAVITY_STRENGTH=y.gravity),y.numIter!=null&&(g.MAX_ITERATIONS=d.MAX_ITERATIONS=y.numIter),y.gravityRange!=null&&(g.DEFAULT_GRAVITY_RANGE_FACTOR=d.DEFAULT_GRAVITY_RANGE_FACTOR=y.gravityRange),y.gravityCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.DEFAULT_COMPOUND_GRAVITY_STRENGTH=y.gravityCompound),y.gravityRangeCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=y.gravityRangeCompound),y.initialEnergyOnIncremental!=null&&(g.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.DEFAULT_COOLING_FACTOR_INCREMENTAL=y.initialEnergyOnIncremental),y.tilingCompareBy!=null&&(g.TILING_COMPARE_BY=y.tilingCompareBy),y.quality=="proof"?h.QUALITY=2:h.QUALITY=0,g.NODE_DIMENSIONS_INCLUDE_LABELS=d.NODE_DIMENSIONS_INCLUDE_LABELS=h.NODE_DIMENSIONS_INCLUDE_LABELS=y.nodeDimensionsIncludeLabels,g.DEFAULT_INCREMENTAL=d.DEFAULT_INCREMENTAL=h.DEFAULT_INCREMENTAL=!y.randomize,g.ANIMATE=d.ANIMATE=h.ANIMATE=y.animate,g.TILE=y.tile,g.TILING_PADDING_VERTICAL=typeof y.tilingPaddingVertical=="function"?y.tilingPaddingVertical.call():y.tilingPaddingVertical,g.TILING_PADDING_HORIZONTAL=typeof y.tilingPaddingHorizontal=="function"?y.tilingPaddingHorizontal.call():y.tilingPaddingHorizontal,g.DEFAULT_INCREMENTAL=d.DEFAULT_INCREMENTAL=h.DEFAULT_INCREMENTAL=!0,g.PURE_INCREMENTAL=!y.randomize,h.DEFAULT_UNIFORM_LEAF_NODE_SIZES=y.uniformNodeDimensions,y.step=="transformed"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!1),y.step=="enforced"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!1),y.step=="cose"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!0),y.step=="all"&&(y.randomize?g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!0),y.fixedNodeConstraint||y.alignmentConstraint||y.relativePlacementConstraint?g.TREE_REDUCTION_ON_INCREMENTAL=!1:g.TREE_REDUCTION_ON_INCREMENTAL=!0;var B=new l,V=B.newGraphManager();return M(V.addRoot(),u.getTopMostNodes(A),B,y),S(B,V,D),I(B,y),B.runLayout(),P};i.exports={coseLayout:m}}),212:((i,o,s)=>{var u=(function(){function y(b,E){for(var C=0;C<E.length;C++){var A=E[C];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(b,A.key,A)}}return function(b,E,C){return E&&y(b.prototype,E),C&&y(b,C),b}})();function l(y,b){if(!(y instanceof b))throw new TypeError("Cannot call a class as a function")}var f=s(658),v=s(548),c=s(657),h=c.spectralLayout,d=s(816),g=d.coseLayout,m=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(b){return 4500},idealEdgeLength:function(b){return 50},edgeElasticity:function(b){return .45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),p=(function(){function y(b){l(this,y),this.options=f({},m,b)}return u(y,[{key:"run",value:function(){var E=this,C=this.options,A=C.cy,D=C.eles,N=[],O=void 0,R=void 0,P=[],w=void 0,x=[];C.fixedNodeConstraint&&(!Array.isArray(C.fixedNodeConstraint)||C.fixedNodeConstraint.length==0)&&(C.fixedNodeConstraint=void 0),C.alignmentConstraint&&(C.alignmentConstraint.vertical&&(!Array.isArray(C.alignmentConstraint.vertical)||C.alignmentConstraint.vertical.length==0)&&(C.alignmentConstraint.vertical=void 0),C.alignmentConstraint.horizontal&&(!Array.isArray(C.alignmentConstraint.horizontal)||C.alignmentConstraint.horizontal.length==0)&&(C.alignmentConstraint.horizontal=void 0)),C.relativePlacementConstraint&&(!Array.isArray(C.relativePlacementConstraint)||C.relativePlacementConstraint.length==0)&&(C.relativePlacementConstraint=void 0);var T=C.fixedNodeConstraint||C.alignmentConstraint||C.relativePlacementConstraint;T&&(C.tile=!1,C.packComponents=!1);var M=void 0,S=!1;if(A.layoutUtilities&&C.packComponents&&(M=A.layoutUtilities("get"),M||(M=A.layoutUtilities()),S=!0),D.nodes().length>0)if(S){var V=v.getTopMostNodes(C.eles.nodes());if(w=v.connectComponents(A,C.eles,V),w.forEach(function(ve){var oe=ve.boundingBox();x.push({x:oe.x1+oe.w/2,y:oe.y1+oe.h/2})}),C.randomize&&w.forEach(function(ve){C.eles=ve,N.push(h(C))}),C.quality=="default"||C.quality=="proof"){var F=A.collection();if(C.tile){var k=new Map,U=[],J=[],W=0,Q={nodeIndexes:k,xCoords:U,yCoords:J},Z=[];if(w.forEach(function(ve,oe){ve.edges().length==0&&(ve.nodes().forEach(function(he,se){F.merge(ve.nodes()[se]),he.isParent()||(Q.nodeIndexes.set(ve.nodes()[se].id(),W++),Q.xCoords.push(ve.nodes()[0].position().x),Q.yCoords.push(ve.nodes()[0].position().y))}),Z.push(oe))}),F.length>1){var H=F.boundingBox();x.push({x:H.x1+H.w/2,y:H.y1+H.h/2}),w.push(F),N.push(Q);for(var j=Z.length-1;j>=0;j--)w.splice(Z[j],1),N.splice(Z[j],1),x.splice(Z[j],1)}}w.forEach(function(ve,oe){C.eles=ve,P.push(g(C,N[oe])),v.relocateComponent(x[oe],P[oe],C)})}else w.forEach(function(ve,oe){v.relocateComponent(x[oe],N[oe],C)});var $=new Set;if(w.length>1){var q=[],K=D.filter(function(ve){return ve.css("display")=="none"});w.forEach(function(ve,oe){var he=void 0;if(C.quality=="draft"&&(he=N[oe].nodeIndexes),ve.nodes().not(K).length>0){var se={};se.edges=[],se.nodes=[];var pe=void 0;ve.nodes().not(K).forEach(function(de){if(C.quality=="draft")if(!de.isParent())pe=he.get(de.id()),se.nodes.push({x:N[oe].xCoords[pe]-de.boundingbox().w/2,y:N[oe].yCoords[pe]-de.boundingbox().h/2,width:de.boundingbox().w,height:de.boundingbox().h});else{var Ee=v.calcBoundingBox(de,N[oe].xCoords,N[oe].yCoords,he);se.nodes.push({x:Ee.topLeftX,y:Ee.topLeftY,width:Ee.width,height:Ee.height})}else P[oe][de.id()]&&se.nodes.push({x:P[oe][de.id()].getLeft(),y:P[oe][de.id()].getTop(),width:P[oe][de.id()].getWidth(),height:P[oe][de.id()].getHeight()})}),ve.edges().forEach(function(de){var Ee=de.source(),xe=de.target();if(Ee.css("display")!="none"&&xe.css("display")!="none")if(C.quality=="draft"){var De=he.get(Ee.id()),Oe=he.get(xe.id()),Pe=[],Ie=[];if(Ee.isParent()){var Ne=v.calcBoundingBox(Ee,N[oe].xCoords,N[oe].yCoords,he);Pe.push(Ne.topLeftX+Ne.width/2),Pe.push(Ne.topLeftY+Ne.height/2)}else Pe.push(N[oe].xCoords[De]),Pe.push(N[oe].yCoords[De]);if(xe.isParent()){var Y=v.calcBoundingBox(xe,N[oe].xCoords,N[oe].yCoords,he);Ie.push(Y.topLeftX+Y.width/2),Ie.push(Y.topLeftY+Y.height/2)}else Ie.push(N[oe].xCoords[Oe]),Ie.push(N[oe].yCoords[Oe]);se.edges.push({startX:Pe[0],startY:Pe[1],endX:Ie[0],endY:Ie[1]})}else P[oe][Ee.id()]&&P[oe][xe.id()]&&se.edges.push({startX:P[oe][Ee.id()].getCenterX(),startY:P[oe][Ee.id()].getCenterY(),endX:P[oe][xe.id()].getCenterX(),endY:P[oe][xe.id()].getCenterY()})}),se.nodes.length>0&&(q.push(se),$.add(oe))}});var ee=M.packComponents(q,C.randomize).shifts;if(C.quality=="draft")N.forEach(function(ve,oe){var he=ve.xCoords.map(function(pe){return pe+ee[oe].dx}),se=ve.yCoords.map(function(pe){return pe+ee[oe].dy});ve.xCoords=he,ve.yCoords=se});else{var ne=0;$.forEach(function(ve){Object.keys(P[ve]).forEach(function(oe){var he=P[ve][oe];he.setCenter(he.getCenterX()+ee[ne].dx,he.getCenterY()+ee[ne].dy)}),ne++})}}}else{var I=C.eles.boundingBox();if(x.push({x:I.x1+I.w/2,y:I.y1+I.h/2}),C.randomize){var B=h(C);N.push(B)}C.quality=="default"||C.quality=="proof"?(P.push(g(C,N[0])),v.relocateComponent(x[0],P[0],C)):v.relocateComponent(x[0],N[0],C)}var te=function(oe,he){if(C.quality=="default"||C.quality=="proof"){typeof oe=="number"&&(oe=he);var se=void 0,pe=void 0,de=oe.data("id");return P.forEach(function(xe){de in xe&&(se={x:xe[de].getRect().getCenterX(),y:xe[de].getRect().getCenterY()},pe=xe[de])}),C.nodeDimensionsIncludeLabels&&(pe.labelWidth&&(pe.labelPosHorizontal=="left"?se.x+=pe.labelWidth/2:pe.labelPosHorizontal=="right"&&(se.x-=pe.labelWidth/2)),pe.labelHeight&&(pe.labelPosVertical=="top"?se.y+=pe.labelHeight/2:pe.labelPosVertical=="bottom"&&(se.y-=pe.labelHeight/2))),se==null&&(se={x:oe.position("x"),y:oe.position("y")}),{x:se.x,y:se.y}}else{var Ee=void 0;return N.forEach(function(xe){var De=xe.nodeIndexes.get(oe.id());De!=null&&(Ee={x:xe.xCoords[De],y:xe.yCoords[De]})}),Ee==null&&(Ee={x:oe.position("x"),y:oe.position("y")}),{x:Ee.x,y:Ee.y}}};if(C.quality=="default"||C.quality=="proof"||C.randomize){var be=v.calcParentsWithoutChildren(A,D),Se=D.filter(function(ve){return ve.css("display")=="none"});C.eles=D.not(Se),D.nodes().not(":parent").not(Se).layoutPositions(E,C,te),be.length>0&&be.forEach(function(ve){ve.position(te(ve))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),y})();i.exports=p}),657:((i,o,s)=>{var u=s(548),l=s(140).layoutBase.Matrix,f=s(140).layoutBase.SVD,v=function(h){var d=h.cy,g=h.eles,m=g.nodes(),p=g.nodes(":parent"),y=new Map,b=new Map,E=new Map,C=[],A=[],D=[],N=[],O=[],R=[],P=[],w=[],x=void 0,T=void 0,M=1e8,S=1e-9,I=h.piTol,B=h.samplingType,V=h.nodeSeparation,F=void 0,k=function(){for(var z=0,G=0,X=!1;G<F;){z=Math.floor(Math.random()*T),X=!1;for(var _=0;_<G;_++)if(N[_]==z){X=!0;break}if(!X)N[G]=z,G++;else continue}},U=function(z,G,X){for(var _=[],le=0,re=0,ae=0,ie=void 0,fe=[],ue=0,me=1,ge=0;ge<T;ge++)fe[ge]=M;for(_[re]=z,fe[z]=0;re>=le;){ae=_[le++];for(var ye=C[ae],ce=0;ce<ye.length;ce++)ie=b.get(ye[ce]),fe[ie]==M&&(fe[ie]=fe[ae]+1,_[++re]=ie);R[ae][G]=fe[ae]*V}if(X){for(var Ae=0;Ae<T;Ae++)R[Ae][G]<O[Ae]&&(O[Ae]=R[Ae][G]);for(var Te=0;Te<T;Te++)O[Te]>ue&&(ue=O[Te],me=Te)}return me},J=function(z){var G=void 0;if(z){G=Math.floor(Math.random()*T),x=G;for(var _=0;_<T;_++)O[_]=M;for(var le=0;le<F;le++)N[le]=G,G=U(G,le,z)}else{k();for(var X=0;X<F;X++)U(N[X],X,z,!1)}for(var re=0;re<T;re++)for(var ae=0;ae<F;ae++)R[re][ae]*=R[re][ae];for(var ie=0;ie<F;ie++)P[ie]=[];for(var fe=0;fe<F;fe++)for(var ue=0;ue<F;ue++)P[fe][ue]=R[N[ue]][fe]},W=function(){for(var z=f.svd(P),G=z.S,X=z.U,_=z.V,le=G[0]*G[0]*G[0],re=[],ae=0;ae<F;ae++){re[ae]=[];for(var ie=0;ie<F;ie++)re[ae][ie]=0,ae==ie&&(re[ae][ie]=G[ae]/(G[ae]*G[ae]+le/(G[ae]*G[ae])))}w=l.multMat(l.multMat(_,re),l.transpose(X))},Q=function(){for(var z=void 0,G=void 0,X=[],_=[],le=[],re=[],ae=0;ae<T;ae++)X[ae]=Math.random(),_[ae]=Math.random();X=l.normalize(X),_=l.normalize(_);for(var ie=0,fe=S,ue=S,me=void 0;;){ie++;for(var ge=0;ge<T;ge++)le[ge]=X[ge];if(X=l.multGamma(l.multL(l.multGamma(le),R,w)),z=l.dotProduct(le,X),X=l.normalize(X),fe=l.dotProduct(le,X),me=Math.abs(fe/ue),me<=1+I&&me>=1)break;ue=fe}for(var ye=0;ye<T;ye++)le[ye]=X[ye];for(ie=0,ue=S;;){ie++;for(var ce=0;ce<T;ce++)re[ce]=_[ce];if(re=l.minusOp(re,l.multCons(le,l.dotProduct(le,re))),_=l.multGamma(l.multL(l.multGamma(re),R,w)),G=l.dotProduct(re,_),_=l.normalize(_),fe=l.dotProduct(re,_),me=Math.abs(fe/ue),me<=1+I&&me>=1)break;ue=fe}for(var Ae=0;Ae<T;Ae++)re[Ae]=_[Ae];A=l.multCons(le,Math.sqrt(Math.abs(z))),D=l.multCons(re,Math.sqrt(Math.abs(G)))};u.connectComponents(d,g,u.getTopMostNodes(m),y),p.forEach(function(L){u.connectComponents(d,g,u.getTopMostNodes(L.descendants().intersection(g)),y)});for(var Z=0,H=0;H<m.length;H++)m[H].isParent()||b.set(m[H].id(),Z++);var j=!0,$=!1,q=void 0;try{for(var K=y.keys()[Symbol.iterator](),ee;!(j=(ee=K.next()).done);j=!0){var ne=ee.value;b.set(ne,Z++)}}catch(L){$=!0,q=L}finally{try{!j&&K.return&&K.return()}finally{if($)throw q}}for(var te=0;te<b.size;te++)C[te]=[];p.forEach(function(L){for(var z=L.children().intersection(g);z.nodes(":childless").length==0;)z=z.nodes()[0].children().intersection(g);var G=0,X=z.nodes(":childless")[0].connectedEdges().length;z.nodes(":childless").forEach(function(_,le){_.connectedEdges().length<X&&(X=_.connectedEdges().length,G=le)}),E.set(L.id(),z.nodes(":childless")[G].id())}),m.forEach(function(L){var z=void 0;L.isParent()?z=b.get(E.get(L.id())):z=b.get(L.id()),L.neighborhood().nodes().forEach(function(G){g.intersection(L.edgesWith(G)).length>0&&(G.isParent()?C[z].push(E.get(G.id())):C[z].push(G.id()))})});var be=function(z){var G=b.get(z),X=void 0;y.get(z).forEach(function(_){d.getElementById(_).isParent()?X=E.get(_):X=_,C[G].push(X),C[b.get(X)].push(z)})},Se=!0,ve=!1,oe=void 0;try{for(var he=y.keys()[Symbol.iterator](),se;!(Se=(se=he.next()).done);Se=!0){var pe=se.value;be(pe)}}catch(L){ve=!0,oe=L}finally{try{!Se&&he.return&&he.return()}finally{if(ve)throw oe}}T=b.size;var de=void 0;if(T>2){F=T<h.sampleSize?T:h.sampleSize;for(var Ee=0;Ee<T;Ee++)R[Ee]=[];for(var xe=0;xe<F;xe++)w[xe]=[];return h.quality=="draft"||h.step=="all"?(J(B),W(),Q(),de={nodeIndexes:b,xCoords:A,yCoords:D}):(b.forEach(function(L,z){A.push(d.getElementById(z).position("x")),D.push(d.getElementById(z).position("y"))}),de={nodeIndexes:b,xCoords:A,yCoords:D}),de}else{var De=b.keys(),Oe=d.getElementById(De.next().value),Pe=Oe.position(),Ie=Oe.outerWidth();if(A.push(Pe.x),D.push(Pe.y),T==2){var Ne=d.getElementById(De.next().value),Y=Ne.outerWidth();A.push(Pe.x+Ie/2+Y/2+h.idealEdgeLength),D.push(Pe.y)}return de={nodeIndexes:b,xCoords:A,yCoords:D},de}};i.exports={spectralLayout:v}}),579:((i,o,s)=>{var u=s(212),l=function(v){v&&v("layout","fcose",u)};typeof cytoscape<"u"&&l(cytoscape),i.exports=l}),140:(i=>{i.exports=t})},r={};function a(i){var o=r[i];if(o!==void 0)return o.exports;var s=r[i]={exports:{}};return e[i](s,s.exports,a),s.exports}var n=a(579);return n})()})});function fs(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}function sh(t){if(Array.isArray(t))return t}function lh(t){if(Array.isArray(t))return fs(t)}function Mr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uh(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,_f(a.key),a)}}function Lr(t,e,r){return e&&uh(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function zt(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ns(t))||e){r&&(t=r);var a=0,n=function(){};return{s:n,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(u){throw u},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||r.return==null||r.return()}finally{if(s)throw i}}}}function Kf(t,e,r){return(e=_f(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fh(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function vh(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,n,i,o,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(a=i.call(r)).done)&&(s.push(a.value),s.length!==e);u=!0);}catch(f){l=!0,n=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw n}}return s}}function ch(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hh(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dt(t,e){return sh(t)||vh(t,e)||Ns(t,e)||ch()}function Kn(t){return lh(t)||fh(t)||Ns(t)||hh()}function dh(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function _f(t){var e=dh(t,"string");return typeof e=="symbol"?e:e+""}function mt(t){"@babel/helpers - typeof";return mt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mt(t)}function Ns(t,e){if(t){if(typeof t=="string")return fs(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fs(t,e):void 0}}var pt=typeof window>"u"?null:window,bl=pt?pt.navigator:null;pt&&pt.document;var gh=mt(""),Zf=mt({}),ph=mt(function(){}),yh=typeof HTMLElement>"u"?"undefined":mt(HTMLElement),an=function(e){return e&&e.instanceString&&ot(e.instanceString)?e.instanceString():null},Le=function(e){return e!=null&&mt(e)==gh},ot=function(e){return e!=null&&mt(e)===ph},et=function(e){return!Gt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},$e=function(e){return e!=null&&mt(e)===Zf&&!et(e)&&e.constructor===Object},mh=function(e){return e!=null&&mt(e)===Zf},we=function(e){return e!=null&&mt(e)===mt(1)&&!isNaN(e)},bh=function(e){return we(e)&&Math.floor(e)===e},_n=function(e){if(yh!=="undefined")return e!=null&&e instanceof HTMLElement},Gt=function(e){return nn(e)||Qf(e)},nn=function(e){return an(e)==="collection"&&e._private.single},Qf=function(e){return an(e)==="collection"&&!e._private.single},Rs=function(e){return an(e)==="core"},Jf=function(e){return an(e)==="stylesheet"},wh=function(e){return an(e)==="event"},xr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Eh=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},xh=function(e){return $e(e)&&we(e.x1)&&we(e.x2)&&we(e.y1)&&we(e.y2)},Th=function(e){return mh(e)&&ot(e.then)},Ch=function(){return bl&&bl.userAgent.match(/msie|trident|edge/i)},ya=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var a=function(){var i=this,o=arguments,s,u=r.apply(i,o),l=a.cache;return(s=l[u])||(s=l[u]=e.apply(i,o)),s};return a.cache={},a},Ps=ya(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),li=ya(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),jf=ya(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),wl=function(e){return xr(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},yr=function(e,r){return e.slice(-1*r.length)===r},yt="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Sh="rgb[a]?\\(("+yt+"[%]?)\\s*,\\s*("+yt+"[%]?)\\s*,\\s*("+yt+"[%]?)(?:\\s*,\\s*("+yt+"))?\\)",Dh="rgb[a]?\\((?:"+yt+"[%]?)\\s*,\\s*(?:"+yt+"[%]?)\\s*,\\s*(?:"+yt+"[%]?)(?:\\s*,\\s*(?:"+yt+"))?\\)",Ah="hsl[a]?\\(("+yt+")\\s*,\\s*("+yt+"[%])\\s*,\\s*("+yt+"[%])(?:\\s*,\\s*("+yt+"))?\\)",Mh="hsl[a]?\\((?:"+yt+")\\s*,\\s*(?:"+yt+"[%])\\s*,\\s*(?:"+yt+"[%])(?:\\s*,\\s*(?:"+yt+"))?\\)",Lh="\\#[0-9a-fA-F]{3}",Nh="\\#[0-9a-fA-F]{6}",ev=function(e,r){return e<r?-1:e>r?1:0},Rh=function(e,r){return-1*ev(e,r)},Re=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var o=n[i];t[o]=a[o]}}return t},Ph=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,o=16;return r?(a=parseInt(e[1]+e[1],o),n=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),n=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[a,n,i]}},Oh=function(e){var r,a,n,i,o,s,u,l;function f(d,g,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?d+(g-d)*6*m:m<1/2?g:m<2/3?d+(g-d)*(2/3-m)*6:d}var v=new RegExp("^"+Ah+"$").exec(e);if(v){if(a=parseInt(v[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(v[2]),n<0||n>100||(n=n/100,i=parseFloat(v[3]),i<0||i>100)||(i=i/100,o=v[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=u=l=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;s=Math.round(255*f(h,c,a+1/3)),u=Math.round(255*f(h,c,a)),l=Math.round(255*f(h,c,a-1/3))}r=[s,u,l,o]}return r},Ih=function(e){var r,a=new RegExp("^"+Sh+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var s=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(s&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;r.push(l)}}return r},Bh=function(e){return kh[e.toLowerCase()]},tv=function(e){return(et(e)?e:null)||Bh(e)||Ph(e)||Ih(e)||Oh(e)},kh={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},rv=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if($e(o))throw Error("Tried to set map with object key");i<a.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},av=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if($e(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},Cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function on(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Oi,El;function sn(){if(El)return Oi;El=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return Oi=t,Oi}var Ii,xl;function Fh(){if(xl)return Ii;xl=1;var t=typeof Cn=="object"&&Cn&&Cn.Object===Object&&Cn;return Ii=t,Ii}var Bi,Tl;function ui(){if(Tl)return Bi;Tl=1;var t=Fh(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return Bi=r,Bi}var ki,Cl;function zh(){if(Cl)return ki;Cl=1;var t=ui(),e=function(){return t.Date.now()};return ki=e,ki}var Fi,Sl;function Vh(){if(Sl)return Fi;Sl=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return Fi=e,Fi}var zi,Dl;function Gh(){if(Dl)return zi;Dl=1;var t=Vh(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return zi=r,zi}var Vi,Al;function Os(){if(Al)return Vi;Al=1;var t=ui(),e=t.Symbol;return Vi=e,Vi}var Gi,Ml;function Uh(){if(Ml)return Gi;Ml=1;var t=Os(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,n=t?t.toStringTag:void 0;function i(o){var s=r.call(o,n),u=o[n];try{o[n]=void 0;var l=!0}catch{}var f=a.call(o);return l&&(s?o[n]=u:delete o[n]),f}return Gi=i,Gi}var Ui,Ll;function Hh(){if(Ll)return Ui;Ll=1;var t=Object.prototype,e=t.toString;function r(a){return e.call(a)}return Ui=r,Ui}var Hi,Nl;function nv(){if(Nl)return Hi;Nl=1;var t=Os(),e=Uh(),r=Hh(),a="[object Null]",n="[object Undefined]",i=t?t.toStringTag:void 0;function o(s){return s==null?s===void 0?n:a:i&&i in Object(s)?e(s):r(s)}return Hi=o,Hi}var qi,Rl;function qh(){if(Rl)return qi;Rl=1;function t(e){return e!=null&&typeof e=="object"}return qi=t,qi}var Yi,Pl;function ln(){if(Pl)return Yi;Pl=1;var t=nv(),e=qh(),r="[object Symbol]";function a(n){return typeof n=="symbol"||e(n)&&t(n)==r}return Yi=a,Yi}var Wi,Ol;function Yh(){if(Ol)return Wi;Ol=1;var t=Gh(),e=sn(),r=ln(),a=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return a;if(e(l)){var f=typeof l.valueOf=="function"?l.valueOf():l;l=e(f)?f+"":f}if(typeof l!="string")return l===0?l:+l;l=t(l);var v=i.test(l);return v||o.test(l)?s(l.slice(2),v?2:8):n.test(l)?a:+l}return Wi=u,Wi}var Xi,Il;function Wh(){if(Il)return Xi;Il=1;var t=sn(),e=zh(),r=Yh(),a="Expected a function",n=Math.max,i=Math.min;function o(s,u,l){var f,v,c,h,d,g,m=0,p=!1,y=!1,b=!0;if(typeof s!="function")throw new TypeError(a);u=r(u)||0,t(l)&&(p=!!l.leading,y="maxWait"in l,c=y?n(r(l.maxWait)||0,u):c,b="trailing"in l?!!l.trailing:b);function E(x){var T=f,M=v;return f=v=void 0,m=x,h=s.apply(M,T),h}function C(x){return m=x,d=setTimeout(N,u),p?E(x):h}function A(x){var T=x-g,M=x-m,S=u-T;return y?i(S,c-M):S}function D(x){var T=x-g,M=x-m;return g===void 0||T>=u||T<0||y&&M>=c}function N(){var x=e();if(D(x))return O(x);d=setTimeout(N,A(x))}function O(x){return d=void 0,b&&f?E(x):(f=v=void 0,h)}function R(){d!==void 0&&clearTimeout(d),m=0,f=g=v=d=void 0}function P(){return d===void 0?h:O(e())}function w(){var x=e(),T=D(x);if(f=arguments,v=this,g=x,T){if(d===void 0)return C(g);if(y)return clearTimeout(d),d=setTimeout(N,u),E(g)}return d===void 0&&(d=setTimeout(N,u)),h}return w.cancel=R,w.flush=P,w}return Xi=o,Xi}var Xh=Wh(),un=on(Xh),$i=pt?pt.performance:null,iv=$i&&$i.now?function(){return $i.now()}:function(){return Date.now()},$h=(function(){if(pt){if(pt.requestAnimationFrame)return function(t){pt.requestAnimationFrame(t)};if(pt.mozRequestAnimationFrame)return function(t){pt.mozRequestAnimationFrame(t)};if(pt.webkitRequestAnimationFrame)return function(t){pt.webkitRequestAnimationFrame(t)};if(pt.msRequestAnimationFrame)return function(t){pt.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(iv())},1e3/60)}})(),Zn=function(e){return $h(e)},or=iv,Hr=9261,ov=65599,ua=5381,sv=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Hr,a=r,n;n=e.next(),!n.done;)a=a*ov+n.value|0;return a},$a=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Hr;return r*ov+e|0},Ka=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ua;return(r<<5)+r+e|0},Kh=function(e,r){return e*2097152+r},dr=function(e){return e[0]*2097152+e[1]},Sn=function(e,r){return[$a(e[0],r[0]),Ka(e[1],r[1])]},Bl=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return sv(o,r)},Wr=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return sv(o,r)},lv=function(){return _h(arguments)},_h=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=Wr(n):r=Wr(n,r)}return r};function Zh(t,e,r,a,n){var i=n*Math.PI/180,o=Math.cos(i)*(t-r)-Math.sin(i)*(e-a)+r,s=Math.sin(i)*(t-r)+Math.cos(i)*(e-a)+a;return{x:o,y:s}}var Qh=function(e,r,a,n,i,o){return{x:(e-a)*i+a,y:(r-n)*o+n}};function Jh(t,e,r){if(r===0)return t;var a=(e.x1+e.x2)/2,n=(e.y1+e.y2)/2,i=e.w/e.h,o=1/i,s=Zh(t.x,t.y,a,n,r),u=Qh(s.x,s.y,a,n,i,o);return{x:u.x,y:u.y}}var kl=!0,jh=console.warn!=null,ed=console.trace!=null,Is=Number.MAX_SAFE_INTEGER||9007199254740991,uv=function(){return!0},Qn=function(){return!1},Fl=function(){return 0},Bs=function(){},nt=function(e){throw new Error(e)},fv=function(e){if(e!==void 0)kl=!!e;else return kl},Qe=function(e){fv()&&(jh?console.warn(e):(console.log(e),ed&&console.trace()))},td=function(e){return Re({},e)},jt=function(e){return e==null?e:et(e)?e.slice():$e(e)?td(e):e},rd=function(e){return e.slice()},vv=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},ad={},cv=function(){return ad},Dt=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var o=r[i],s=a?.[o];n[o]=s===void 0?e[o]:s}return n}},Tr=function(e,r,a){for(var n=e.length-1;n>=0;n--)e[n]===r&&e.splice(n,1)},ks=function(e){e.splice(0,e.length)},nd=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},It=function(e,r,a){return a&&(r=jf(a,r)),e[r]},Jt=function(e,r,a,n){a&&(r=jf(a,r)),e[r]=n},id=(function(){function t(){Mr(this,t),this._obj={}}return Lr(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}])})(),ir=typeof Map<"u"?Map:id,od="undefined",sd=(function(){function t(e){if(Mr(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return Lr(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}])})(),xa=(typeof Set>"u"?"undefined":mt(Set))!==od?Set:sd,fi=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Rs(e)){nt("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){nt("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new xa,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var o=r.renderedPosition,s=e.pan(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];et(r.classes)?l=r.classes:Le(r.classes)&&(l=r.classes.split(/\s+/));for(var f=0,v=l.length;f<v;f++){var c=l[f];!c||c===""||i.classes.add(c)}this.createEmitter(),(a===void 0||a)&&this.restore();var h=r.style||r.css;h&&(Qe("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h))},zl=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var o;$e(a)&&!Gt(a)&&(o=a,a=o.roots||o.root,n=o.visit,i=o.directed),i=arguments.length===2&&!ot(n)?n:i,n=ot(n)?n:function(){};for(var s=this._private.cy,u=a=Le(a)?this.filter(a):a,l=[],f=[],v={},c={},h={},d=0,g,m=this.byGroup(),p=m.nodes,y=m.edges,b=0;b<u.length;b++){var E=u[b],C=E.id();E.isNode()&&(l.unshift(E),e.bfs&&(h[C]=!0,f.push(E)),c[C]=0)}for(var A=function(){var x=e.bfs?l.shift():l.pop(),T=x.id();if(e.dfs){if(h[T])return 0;h[T]=!0,f.push(x)}var M=c[T],S=v[T],I=S!=null?S.source():null,B=S!=null?S.target():null,V=S==null?void 0:x.same(I)?B[0]:I[0],F;if(F=n(x,S,V,d++,M),F===!0)return g=x,1;if(F===!1)return 1;for(var k=x.connectedEdges().filter(function(Z){return(!i||Z.source().same(x))&&y.has(Z)}),U=0;U<k.length;U++){var J=k[U],W=J.connectedNodes().filter(function(Z){return!Z.same(x)&&p.has(Z)}),Q=W.id();W.length!==0&&!h[Q]&&(W=W[0],l.push(W),e.bfs&&(h[Q]=!0,f.push(W)),v[Q]=J,c[Q]=c[T]+1)}},D;l.length!==0&&(D=A(),!(D!==0&&D===1)););for(var N=s.collection(),O=0;O<f.length;O++){var R=f[O],P=v[R.id()];P!=null&&N.push(P),N.push(R)}return{path:s.collection(N),found:s.collection(g)}}},_a={breadthFirstSearch:zl({bfs:!0}),depthFirstSearch:zl({dfs:!0})};_a.bfs=_a.breadthFirstSearch;_a.dfs=_a.depthFirstSearch;var Fn={exports:{}},ld=Fn.exports,Vl;function ud(){return Vl||(Vl=1,(function(t,e){(function(){var r,a,n,i,o,s,u,l,f,v,c,h,d,g,m;n=Math.floor,v=Math.min,a=function(p,y){return p<y?-1:p>y?1:0},f=function(p,y,b,E,C){var A;if(b==null&&(b=0),C==null&&(C=a),b<0)throw new Error("lo must be non-negative");for(E==null&&(E=p.length);b<E;)A=n((b+E)/2),C(y,p[A])<0?E=A:b=A+1;return[].splice.apply(p,[b,b-b].concat(y)),y},s=function(p,y,b){return b==null&&(b=a),p.push(y),g(p,0,p.length-1,b)},o=function(p,y){var b,E;return y==null&&(y=a),b=p.pop(),p.length?(E=p[0],p[0]=b,m(p,0,y)):E=b,E},l=function(p,y,b){var E;return b==null&&(b=a),E=p[0],p[0]=y,m(p,0,b),E},u=function(p,y,b){var E;return b==null&&(b=a),p.length&&b(p[0],y)<0&&(E=[p[0],y],y=E[0],p[0]=E[1],m(p,0,b)),y},i=function(p,y){var b,E,C,A,D,N;for(y==null&&(y=a),A=(function(){N=[];for(var O=0,R=n(p.length/2);0<=R?O<R:O>R;0<=R?O++:O--)N.push(O);return N}).apply(this).reverse(),D=[],E=0,C=A.length;E<C;E++)b=A[E],D.push(m(p,b,y));return D},d=function(p,y,b){var E;if(b==null&&(b=a),E=p.indexOf(y),E!==-1)return g(p,0,E,b),m(p,E,b)},c=function(p,y,b){var E,C,A,D,N;if(b==null&&(b=a),C=p.slice(0,y),!C.length)return C;for(i(C,b),N=p.slice(y),A=0,D=N.length;A<D;A++)E=N[A],u(C,E,b);return C.sort(b).reverse()},h=function(p,y,b){var E,C,A,D,N,O,R,P,w;if(b==null&&(b=a),y*10<=p.length){if(A=p.slice(0,y).sort(b),!A.length)return A;for(C=A[A.length-1],R=p.slice(y),D=0,O=R.length;D<O;D++)E=R[D],b(E,C)<0&&(f(A,E,0,null,b),A.pop(),C=A[A.length-1]);return A}for(i(p,b),w=[],N=0,P=v(y,p.length);0<=P?N<P:N>P;0<=P?++N:--N)w.push(o(p,b));return w},g=function(p,y,b,E){var C,A,D;for(E==null&&(E=a),C=p[b];b>y;){if(D=b-1>>1,A=p[D],E(C,A)<0){p[b]=A,b=D;continue}break}return p[b]=C},m=function(p,y,b){var E,C,A,D,N;for(b==null&&(b=a),C=p.length,N=y,A=p[y],E=2*y+1;E<C;)D=E+1,D<C&&!(b(p[E],p[D])<0)&&(E=D),p[y]=p[E],y=E,E=2*y+1;return p[y]=A,g(p,N,y,b)},r=(function(){p.push=s,p.pop=o,p.replace=l,p.pushpop=u,p.heapify=i,p.updateItem=d,p.nlargest=c,p.nsmallest=h;function p(y){this.cmp=y??a,this.nodes=[]}return p.prototype.push=function(y){return s(this.nodes,y,this.cmp)},p.prototype.pop=function(){return o(this.nodes,this.cmp)},p.prototype.peek=function(){return this.nodes[0]},p.prototype.contains=function(y){return this.nodes.indexOf(y)!==-1},p.prototype.replace=function(y){return l(this.nodes,y,this.cmp)},p.prototype.pushpop=function(y){return u(this.nodes,y,this.cmp)},p.prototype.heapify=function(){return i(this.nodes,this.cmp)},p.prototype.updateItem=function(y){return d(this.nodes,y,this.cmp)},p.prototype.clear=function(){return this.nodes=[]},p.prototype.empty=function(){return this.nodes.length===0},p.prototype.size=function(){return this.nodes.length},p.prototype.clone=function(){var y;return y=new p,y.nodes=this.nodes.slice(0),y},p.prototype.toArray=function(){return this.nodes.slice(0)},p.prototype.insert=p.prototype.push,p.prototype.top=p.prototype.peek,p.prototype.front=p.prototype.peek,p.prototype.has=p.prototype.contains,p.prototype.copy=p.prototype.clone,p})(),(function(p,y){return t.exports=y()})(this,function(){return r})}).call(ld)})(Fn)),Fn.exports}var Ki,Gl;function fd(){return Gl||(Gl=1,Ki=ud()),Ki}var vd=fd(),fn=on(vd),cd=Dt({root:null,weight:function(e){return 1},directed:!1}),hd={dijkstra:function(e){if(!$e(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=cd(e),n=a.root,i=a.weight,o=a.directed,s=this,u=i,l=Le(n)?this.filter(n)[0]:n[0],f={},v={},c={},h=this.byGroup(),d=h.nodes,g=h.edges;g.unmergeBy(function(M){return M.isLoop()});for(var m=function(S){return f[S.id()]},p=function(S,I){f[S.id()]=I,y.updateItem(S)},y=new fn(function(M,S){return m(M)-m(S)}),b=0;b<d.length;b++){var E=d[b];f[E.id()]=E.same(l)?0:1/0,y.push(E)}for(var C=function(S,I){for(var B=(o?S.edgesTo(I):S.edgesWith(I)).intersect(g),V=1/0,F,k=0;k<B.length;k++){var U=B[k],J=u(U);(J<V||!F)&&(V=J,F=U)}return{edge:F,dist:V}};y.size()>0;){var A=y.pop(),D=m(A),N=A.id();if(c[N]=D,D!==1/0)for(var O=A.neighborhood().intersect(d),R=0;R<O.length;R++){var P=O[R],w=P.id(),x=C(A,P),T=D+x.dist;T<m(P)&&(p(P,T),v[w]={node:A,edge:x.edge})}}return{distanceTo:function(S){var I=Le(S)?d.filter(S)[0]:S[0];return c[I.id()]},pathTo:function(S){var I=Le(S)?d.filter(S)[0]:S[0],B=[],V=I,F=V.id();if(I.length>0)for(B.unshift(I);v[F];){var k=v[F];B.unshift(k.edge),B.unshift(k.node),V=k.node,F=V.id()}return s.spawn(B)}}}},dd={kruskal:function(e){e=e||function(b){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,o=new Array(i),s=a,u=function(E){for(var C=0;C<o.length;C++){var A=o[C];if(A.has(E))return C}},l=0;l<i;l++)o[l]=this.spawn(a[l]);for(var f=n.sort(function(b,E){return e(b)-e(E)}),v=0;v<f.length;v++){var c=f[v],h=c.source()[0],d=c.target()[0],g=u(h),m=u(d),p=o[g],y=o[m];g!==m&&(s.merge(c),p.merge(y),o.splice(m,1))}return s}},gd=Dt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),pd={aStar:function(e){var r=this.cy(),a=gd(e),n=a.root,i=a.goal,o=a.heuristic,s=a.directed,u=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var l=n.id(),f=i.id(),v={},c={},h={},d=new fn(function(F,k){return c[F.id()]-c[k.id()]}),g=new xa,m={},p={},y=function(k,U){d.push(k),g.add(U)},b,E,C=function(){b=d.pop(),E=b.id(),g.delete(E)},A=function(k){return g.has(k)};y(n,l),v[l]=0,c[l]=o(n);for(var D=0;d.size()>0;){if(C(),D++,E===f){for(var N=[],O=i,R=f,P=p[R];N.unshift(O),P!=null&&N.unshift(P),O=m[R],O!=null;)R=O.id(),P=p[R];return{found:!0,distance:v[E],path:this.spawn(N),steps:D}}h[E]=!0;for(var w=b._private.edges,x=0;x<w.length;x++){var T=w[x];if(this.hasElementWithId(T.id())&&!(s&&T.data("source")!==E)){var M=T.source(),S=T.target(),I=M.id()!==E?M:S,B=I.id();if(this.hasElementWithId(B)&&!h[B]){var V=v[E]+u(T);if(!A(B)){v[B]=V,c[B]=V+o(I),y(I,B),m[B]=b,p[B]=T;continue}V<v[B]&&(v[B]=V,c[B]=V+o(I),m[B]=b,p[B]=T)}}}}return{found:!1,distance:void 0,path:void 0,steps:D}}},yd=Dt({weight:function(e){return 1},directed:!1}),md={floydWarshall:function(e){for(var r=this.cy(),a=yd(e),n=a.weight,i=a.directed,o=n,s=this.byGroup(),u=s.nodes,l=s.edges,f=u.length,v=f*f,c=function(J){return u.indexOf(J)},h=function(J){return u[J]},d=new Array(v),g=0;g<v;g++){var m=g%f,p=(g-m)/f;p===m?d[g]=0:d[g]=1/0}for(var y=new Array(v),b=new Array(v),E=0;E<l.length;E++){var C=l[E],A=C.source()[0],D=C.target()[0];if(A!==D){var N=c(A),O=c(D),R=N*f+O,P=o(C);if(d[R]>P&&(d[R]=P,y[R]=O,b[R]=C),!i){var w=O*f+N;!i&&d[w]>P&&(d[w]=P,y[w]=N,b[w]=C)}}}for(var x=0;x<f;x++)for(var T=0;T<f;T++)for(var M=T*f+x,S=0;S<f;S++){var I=T*f+S,B=x*f+S;d[M]+d[B]<d[I]&&(d[I]=d[M]+d[B],y[I]=y[M])}var V=function(J){return(Le(J)?r.filter(J):J)[0]},F=function(J){return c(V(J))},k={distance:function(J,W){var Q=F(J),Z=F(W);return d[Q*f+Z]},path:function(J,W){var Q=F(J),Z=F(W),H=h(Q);if(Q===Z)return H.collection();if(y[Q*f+Z]==null)return r.collection();var j=r.collection(),$=Q,q;for(j.merge(H);Q!==Z;)$=Q,Q=y[Q*f+Z],q=b[$*f+Q],j.merge(q),j.merge(h(Q));return j}};return k}},bd=Dt({weight:function(e){return 1},directed:!1,root:null}),wd={bellmanFord:function(e){var r=this,a=bd(e),n=a.weight,i=a.directed,o=a.root,s=n,u=this,l=this.cy(),f=this.byGroup(),v=f.edges,c=f.nodes,h=c.length,d=new ir,g=!1,m=[];o=l.collection(o)[0],v.unmergeBy(function(ve){return ve.isLoop()});for(var p=v.length,y=function(oe){var he=d.get(oe.id());return he||(he={},d.set(oe.id(),he)),he},b=function(oe){return(Le(oe)?l.$(oe):oe)[0]},E=function(oe){return y(b(oe)).dist},C=function(oe){for(var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,se=b(oe),pe=[],de=se;;){if(de==null)return r.spawn();var Ee=y(de),xe=Ee.edge,De=Ee.pred;if(pe.unshift(de[0]),de.same(he)&&pe.length>0)break;xe!=null&&pe.unshift(xe),de=De}return u.spawn(pe)},A=0;A<h;A++){var D=c[A],N=y(D);D.same(o)?N.dist=0:N.dist=1/0,N.pred=null,N.edge=null}for(var O=!1,R=function(oe,he,se,pe,de,Ee){var xe=pe.dist+Ee;xe<de.dist&&!se.same(pe.edge)&&(de.dist=xe,de.pred=oe,de.edge=se,O=!0)},P=1;P<h;P++){O=!1;for(var w=0;w<p;w++){var x=v[w],T=x.source(),M=x.target(),S=s(x),I=y(T),B=y(M);R(T,M,x,I,B,S),i||R(M,T,x,B,I,S)}if(!O)break}if(O)for(var V=[],F=0;F<p;F++){var k=v[F],U=k.source(),J=k.target(),W=s(k),Q=y(U).dist,Z=y(J).dist;if(Q+W<Z||!i&&Z+W<Q)if(g||(Qe("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),e.findNegativeWeightCycles!==!1){var H=[];Q+W<Z&&H.push(U),!i&&Z+W<Q&&H.push(J);for(var j=H.length,$=0;$<j;$++){var q=H[$],K=[q];K.push(y(q).edge);for(var ee=y(q).pred;K.indexOf(ee)===-1;)K.push(ee),K.push(y(ee).edge),ee=y(ee).pred;K=K.slice(K.indexOf(ee));for(var ne=K[0].id(),te=0,be=2;be<K.length;be+=2)K[be].id()<ne&&(ne=K[be].id(),te=be);K=K.slice(te).concat(K.slice(0,te)),K.push(K[0]);var Se=K.map(function(ve){return ve.id()}).join(",");V.indexOf(Se)===-1&&(m.push(u.spawn(K)),V.push(Se))}}else break}return{distanceTo:E,pathTo:C,hasNegativeWeightCycle:g,negativeWeightCycles:m}}},Ed=Math.sqrt(2),xd=function(e,r,a){a.length===0&&nt("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],o=n[2],s=r[i],u=r[o],l=a,f=l.length-1;f>=0;f--){var v=l[f],c=v[1],h=v[2];(r[c]===s&&r[h]===u||r[c]===u&&r[h]===s)&&l.splice(f,1)}for(var d=0;d<l.length;d++){var g=l[d];g[1]===u?(l[d]=g.slice(),l[d][1]=s):g[2]===u&&(l[d]=g.slice(),l[d][2]=s)}for(var m=0;m<r.length;m++)r[m]===u&&(r[m]=s);return l},_i=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=xd(i,e,r),a--}return r},Td={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(B){return B.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/Ed);if(i<2){nt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f<o;f++){var v=n[f];l.push([f,a.indexOf(v.source()),a.indexOf(v.target())])}for(var c=1/0,h=[],d=new Array(i),g=new Array(i),m=new Array(i),p=function(V,F){for(var k=0;k<i;k++)F[k]=V[k]},y=0;y<=s;y++){for(var b=0;b<i;b++)g[b]=b;var E=_i(g,l.slice(),i,u),C=E.slice();p(g,m);var A=_i(g,E,u,2),D=_i(m,C,u,2);A.length<=D.length&&A.length<c?(c=A.length,h=A,p(g,d)):D.length<=A.length&&D.length<c&&(c=D.length,h=D,p(m,d))}for(var N=this.spawn(h.map(function(B){return n[B[0]]})),O=this.spawn(),R=this.spawn(),P=d[0],w=0;w<d.length;w++){var x=d[w],T=a[w];x===P?O.merge(T):R.merge(T)}var M=function(V){var F=e.spawn();return V.forEach(function(k){F.merge(k),k.connectedEdges().forEach(function(U){e.contains(U)&&!N.contains(U)&&F.merge(U)})}),F},S=[M(O),M(R)],I={cut:N,components:S,partition1:O,partition2:R};return I}},Zi,Cd=function(e){return{x:e.x,y:e.y}},vi=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},hv=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},fa=function(e){return{x:e[0],y:e[1]}},Sd=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.min(o,n))}return n},Dd=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.max(o,n))}return n},Ad=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,o=r;o<a;o++){var s=e[o];isFinite(s)&&(n+=s,i++)}return n/i},Md=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(c,h){return c-h});var f=e.length,v=Math.floor(f/2);return f%2!==0?e[v+1+s]:(e[v-1+s]+e[v+s])/2},Ld=function(e){return Math.PI*e/180},Dn=function(e,r){return Math.atan2(r,e)-Math.PI/2},Fs=Math.log2||function(t){return Math.log(t)/Math.log(2)},zs=function(e){return e>0?1:e<0?-1:0},Xr=function(e,r){return Math.sqrt(Gr(e,r))},Gr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},Nd=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},Et=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},ha=function(e,r,a,n){return{x:Et(e.x,r.x,a.x,n),y:Et(e.y,r.y,a.y,n)}},Rd=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},o=Xr(e,r),s={x:i.x/o,y:i.y/o};return a=a??0,n=n??a*o,{x:e.x+s.x*n,y:e.y+s.y*n}},Za=function(e,r,a){return Math.max(e,Math.min(a,r))},Bt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Pd=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Od=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Id=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},dv=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},zn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Vn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(r.length===1)a=n=i=o=r[0];else if(r.length===2)a=i=r[0],o=n=r[1];else if(r.length===4){var s=dt(r,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Ul=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},Vs=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},mr=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Hl=function(e,r){return mr(e,r.x,r.y)},gv=function(e,r){return mr(e,r.x1,r.y1)&&mr(e,r.x2,r.y2)},Bd=(Zi=Math.hypot)!==null&&Zi!==void 0?Zi:function(t,e){return Math.sqrt(t*t+e*e)};function kd(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(N,O){return{x:N.x+O.x,y:N.y+O.y}},a=function(N,O){return{x:N.x-O.x,y:N.y-O.y}},n=function(N,O){return{x:N.x*O,y:N.y*O}},i=function(N,O){return N.x*O.y-N.y*O.x},o=function(N){var O=Bd(N.x,N.y);return O===0?{x:0,y:0}:{x:N.x/O,y:N.y/O}},s=function(N){for(var O=0,R=0;R<N.length;R++){var P=N[R],w=N[(R+1)%N.length];O+=P.x*w.y-w.x*P.y}return O/2},u=function(N,O,R,P){var w=a(O,N),x=a(P,R),T=i(w,x);if(Math.abs(T)<1e-9)return r(N,n(w,.5));var M=i(a(R,N),x)/T;return r(N,n(w,M))},l=t.map(function(D){return{x:D.x,y:D.y}});s(l)<0&&l.reverse();for(var f=l.length,v=[],c=0;c<f;c++){var h=l[c],d=l[(c+1)%f],g=a(d,h),m=o({x:g.y,y:-g.x});v.push(m)}for(var p=v.map(function(D,N){var O=r(l[N],n(D,e)),R=r(l[(N+1)%f],n(D,e));return{p1:O,p2:R}}),y=[],b=0;b<f;b++){var E=p[(b-1+f)%f],C=p[b],A=u(E.p1,E.p2,C.p1,C.p2);y.push(A)}return y}function Fd(t,e,r,a,n,i){var o=Xd(t,e,r,a,n),s=kd(o,i),u=Bt();return s.forEach(function(l){return dv(u,l.x,l.y)}),u}var pv=function(e,r,a,n,i,o,s){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?Cr(i,o):u,f=i/2,v=o/2;l=Math.min(l,f,v);var c=l!==f,h=l!==v,d;if(c){var g=a-f+l-s,m=n-v-s,p=a+f-l+s,y=m;if(d=br(e,r,a,n,g,m,p,y,!1),d.length>0)return d}if(h){var b=a+f+s,E=n-v+l-s,C=b,A=n+v-l+s;if(d=br(e,r,a,n,b,E,C,A,!1),d.length>0)return d}if(c){var D=a-f+l-s,N=n+v+s,O=a+f-l+s,R=N;if(d=br(e,r,a,n,D,N,O,R,!1),d.length>0)return d}if(h){var P=a-f-s,w=n-v+l-s,x=P,T=n+v-l+s;if(d=br(e,r,a,n,P,w,x,T,!1),d.length>0)return d}var M;{var S=a-f+l,I=n-v+l;if(M=Ua(e,r,a,n,S,I,l+s),M.length>0&&M[0]<=S&&M[1]<=I)return[M[0],M[1]]}{var B=a+f-l,V=n-v+l;if(M=Ua(e,r,a,n,B,V,l+s),M.length>0&&M[0]>=B&&M[1]<=V)return[M[0],M[1]]}{var F=a+f-l,k=n+v-l;if(M=Ua(e,r,a,n,F,k,l+s),M.length>0&&M[0]>=F&&M[1]>=k)return[M[0],M[1]]}{var U=a-f+l,J=n+v-l;if(M=Ua(e,r,a,n,U,J,l+s),M.length>0&&M[0]<=U&&M[1]>=J)return[M[0],M[1]]}return[]},zd=function(e,r,a,n,i,o,s){var u=s,l=Math.min(a,i),f=Math.max(a,i),v=Math.min(n,o),c=Math.max(n,o);return l-u<=e&&e<=f+u&&v-u<=r&&r<=c+u},Vd=function(e,r,a,n,i,o,s,u,l){var f={x1:Math.min(a,s,i)-l,x2:Math.max(a,s,i)+l,y1:Math.min(n,u,o)-l,y2:Math.max(n,u,o)+l};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},Gd=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,u=(-r+o)/s,l=(-r-o)/s;return[u,l]},Ud=function(e,r,a,n,i){var o=1e-5;e===0&&(e=o),r/=e,a/=e,n/=e;var s,u,l,f,v,c,h,d;if(u=(3*a-r*r)/9,l=-(27*n)+r*(9*a-2*(r*r)),l/=54,s=u*u*u+l*l,i[1]=0,h=r/3,s>0){v=l+Math.sqrt(s),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),c=l-Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+v+c,h+=(v+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+v)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,s===0){d=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),d=2*Math.sqrt(u),i[0]=-h+d*Math.cos(f/3),i[2]=-h+d*Math.cos((f+2*Math.PI)/3),i[4]=-h+d*Math.cos((f+4*Math.PI)/3)},Hd=function(e,r,a,n,i,o,s,u){var l=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*u+4*o*o-4*o*u+u*u,f=9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*u-6*o*o+3*o*u,v=3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*u-n*r+2*o*o+2*o*r-u*r,c=1*a*i-a*a+a*e-i*e+n*o-n*n+n*r-o*r,h=[];Ud(l,f,v,c,h);for(var d=1e-7,g=[],m=0;m<6;m+=2)Math.abs(h[m+1])<d&&h[m]>=0&&h[m]<=1&&g.push(h[m]);g.push(1),g.push(0);for(var p=-1,y,b,E,C=0;C<g.length;C++)y=Math.pow(1-g[C],2)*a+2*(1-g[C])*g[C]*i+g[C]*g[C]*s,b=Math.pow(1-g[C],2)*n+2*(1-g[C])*g[C]*o+g[C]*g[C]*u,E=Math.pow(y-e,2)+Math.pow(b-r,2),p>=0?E<p&&(p=E):p=E;return p},qd=function(e,r,a,n,i,o){var s=[e-a,r-n],u=[i-a,o-n],l=u[0]*u[0]+u[1]*u[1],f=s[0]*s[0]+s[1]*s[1],v=s[0]*u[0]+s[1]*u[1],c=v*v/l;return v<0?f:c>l?(e-i)*(e-i)+(r-o)*(r-o):f-c},Ft=function(e,r,a){for(var n,i,o,s,u,l=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(o=a[(f+1)*2],s=a[(f+1)*2+1]):(o=a[(f+1-a.length/2)*2],s=a[(f+1-a.length/2)*2+1]),!(n==e&&o==e))if(n>=e&&e>=o||n<=e&&e<=o)u=(e-n)/(o-n)*(s-i)+i,u>r&&l++;else continue;return l%2!==0},sr=function(e,r,a,n,i,o,s,u,l){var f=new Array(a.length),v;u[0]!=null?(v=Math.atan(u[1]/u[0]),u[0]<0?v=v+Math.PI/2:v=-v-Math.PI/2):v=u;for(var c=Math.cos(-v),h=Math.sin(-v),d=0;d<f.length/2;d++)f[d*2]=o/2*(a[d*2]*c-a[d*2+1]*h),f[d*2+1]=s/2*(a[d*2+1]*c+a[d*2]*h),f[d*2]+=n,f[d*2+1]+=i;var g;if(l>0){var m=jn(f,-l);g=Jn(m)}else g=f;return Ft(e,r,g)},Yd=function(e,r,a,n,i,o,s,u){for(var l=new Array(a.length*2),f=0;f<u.length;f++){var v=u[f];l[f*4+0]=v.startX,l[f*4+1]=v.startY,l[f*4+2]=v.stopX,l[f*4+3]=v.stopY;var c=Math.pow(v.cx-e,2)+Math.pow(v.cy-r,2);if(c<=Math.pow(v.radius,2))return!0}return Ft(e,r,l)},Jn=function(e){for(var r=new Array(e.length/2),a,n,i,o,s,u,l,f,v=0;v<e.length/4;v++){a=e[v*4],n=e[v*4+1],i=e[v*4+2],o=e[v*4+3],v<e.length/4-1?(s=e[(v+1)*4],u=e[(v+1)*4+1],l=e[(v+1)*4+2],f=e[(v+1)*4+3]):(s=e[0],u=e[1],l=e[2],f=e[3]);var c=br(a,n,i,o,s,u,l,f,!0);r[v*2]=c[0],r[v*2+1]=c[1]}return r},jn=function(e,r){for(var a=new Array(e.length*2),n,i,o,s,u=0;u<e.length/2;u++){n=e[u*2],i=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],s=e[(u+1)*2+1]):(o=e[0],s=e[1]);var l=s-i,f=-(o-n),v=Math.sqrt(l*l+f*f),c=l/v,h=f/v;a[u*4]=n+c*r,a[u*4+1]=i+h*r,a[u*4+2]=o+c*r,a[u*4+3]=s+h*r}return a},Wd=function(e,r,a,n,i,o){var s=a-e,u=n-r;s/=i,u/=o;var l=Math.sqrt(s*s+u*u),f=l-1;if(f<0)return[];var v=f/l;return[(a-e)*v+e,(n-r)*v+r]},Yr=function(e,r,a,n,i,o,s){return e-=i,r-=o,e/=a/2+s,r/=n/2+s,e*e+r*r<=1},Ua=function(e,r,a,n,i,o,s){var u=[a-e,n-r],l=[e-i,r-o],f=u[0]*u[0]+u[1]*u[1],v=2*(l[0]*u[0]+l[1]*u[1]),c=l[0]*l[0]+l[1]*l[1]-s*s,h=v*v-4*f*c;if(h<0)return[];var d=(-v+Math.sqrt(h))/(2*f),g=(-v-Math.sqrt(h))/(2*f),m=Math.min(d,g),p=Math.max(d,g),y=[];if(m>=0&&m<=1&&y.push(m),p>=0&&p<=1&&y.push(p),y.length===0)return[];var b=y[0]*u[0]+e,E=y[0]*u[1]+r;if(y.length>1){if(y[0]==y[1])return[b,E];var C=y[1]*u[0]+e,A=y[1]*u[1]+r;return[b,E,C,A]}else return[b,E]},Qi=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},br=function(e,r,a,n,i,o,s,u,l){var f=e-i,v=a-e,c=s-i,h=r-o,d=n-r,g=u-o,m=c*h-g*f,p=v*h-d*f,y=g*v-c*d;if(y!==0){var b=m/y,E=p/y,C=.001,A=0-C,D=1+C;return A<=b&&b<=D&&A<=E&&E<=D?[e+b*v,r+b*d]:l?[e+b*v,r+b*d]:[]}else return m===0||p===0?Qi(e,a,s)===s?[s,u]:Qi(e,a,i)===i?[i,o]:Qi(i,s,a)===a?[a,n]:[]:[]},Xd=function(e,r,a,n,i){var o=[],s=n/2,u=i/2,l=r,f=a;o.push({x:l+s*e[0],y:f+u*e[1]});for(var v=1;v<e.length/2;v++)o.push({x:l+s*e[v*2],y:f+u*e[v*2+1]});return o},Qa=function(e,r,a,n,i,o,s,u){var l=[],f,v=new Array(a.length),c=!0;o==null&&(c=!1);var h;if(c){for(var d=0;d<v.length/2;d++)v[d*2]=a[d*2]*o+n,v[d*2+1]=a[d*2+1]*s+i;if(u>0){var g=jn(v,-u);h=Jn(g)}else h=v}else h=a;for(var m,p,y,b,E=0;E<h.length/2;E++)m=h[E*2],p=h[E*2+1],E<h.length/2-1?(y=h[(E+1)*2],b=h[(E+1)*2+1]):(y=h[0],b=h[1]),f=br(e,r,n,i,m,p,y,b),f.length!==0&&l.push(f[0],f[1]);return l},$d=function(e,r,a,n,i,o,s,u,l){var f=[],v,c=new Array(a.length*2);l.forEach(function(y,b){b===0?(c[c.length-2]=y.startX,c[c.length-1]=y.startY):(c[b*4-2]=y.startX,c[b*4-1]=y.startY),c[b*4]=y.stopX,c[b*4+1]=y.stopY,v=Ua(e,r,n,i,y.cx,y.cy,y.radius),v.length!==0&&f.push(v[0],v[1])});for(var h=0;h<c.length/4;h++)v=br(e,r,n,i,c[h*4],c[h*4+1],c[h*4+2],c[h*4+3],!1),v.length!==0&&f.push(v[0],v[1]);if(f.length>2){for(var d=[f[0],f[1]],g=Math.pow(d[0]-e,2)+Math.pow(d[1]-r,2),m=1;m<f.length/2;m++){var p=Math.pow(f[m*2]-e,2)+Math.pow(f[m*2+1]-r,2);p<=g&&(d[0]=f[m*2],d[1]=f[m*2+1],g=p)}return d}return f},An=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),o=(i-a)/i;return o<0&&(o=1e-5),[r[0]+o*n[0],r[1]+o*n[1]]},Ot=function(e,r){var a=vs(e,r);return a=yv(a),a},yv=function(e){for(var r,a,n=e.length/2,i=1/0,o=1/0,s=-1/0,u=-1/0,l=0;l<n;l++)r=e[2*l],a=e[2*l+1],i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);for(var f=2/(s-i),v=2/(u-o),c=0;c<n;c++)r=e[2*c]=e[2*c]*f,a=e[2*c+1]=e[2*c+1]*v,i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);if(o<-1)for(var h=0;h<n;h++)a=e[2*h+1]=e[2*h+1]+(-1-o);return e},vs=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*a+n,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},Cr=function(e,r){return Math.min(e/4,r/4,8)},mv=function(e,r){return Math.min(e/10,r/10,8)},Gs=function(){return 8},Kd=function(e,r,a){return[e-2*r+a,2*(r-e),e]},cs=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function Ji(t,e){function r(v){for(var c=[],h=0;h<v.length;h++){var d=v[h],g=v[(h+1)%v.length],m={x:g.x-d.x,y:g.y-d.y},p={x:-m.y,y:m.x},y=Math.sqrt(p.x*p.x+p.y*p.y);c.push({x:p.x/y,y:p.y/y})}return c}function a(v,c){var h=1/0,d=-1/0,g=zt(v),m;try{for(g.s();!(m=g.n()).done;){var p=m.value,y=p.x*c.x+p.y*c.y;h=Math.min(h,y),d=Math.max(d,y)}}catch(b){g.e(b)}finally{g.f()}return{min:h,max:d}}function n(v,c){return!(v.max<c.min||c.max<v.min)}var i=[].concat(Kn(r(t)),Kn(r(e))),o=zt(i),s;try{for(o.s();!(s=o.n()).done;){var u=s.value,l=a(t,u),f=a(e,u);if(!n(l,f))return!1}}catch(v){o.e(v)}finally{o.f()}return!0}var _d=Dt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Zd={pageRank:function(e){for(var r=_d(e),a=r.dampingFactor,n=r.precision,i=r.iterations,o=r.weight,s=this._private.cy,u=this.byGroup(),l=u.nodes,f=u.edges,v=l.length,c=v*v,h=f.length,d=new Array(c),g=new Array(v),m=(1-a)/v,p=0;p<v;p++){for(var y=0;y<v;y++){var b=p*v+y;d[b]=0}g[p]=0}for(var E=0;E<h;E++){var C=f[E],A=C.data("source"),D=C.data("target");if(A!==D){var N=l.indexOfId(A),O=l.indexOfId(D),R=o(C),P=O*v+N;d[P]+=R,g[N]+=R}}for(var w=1/v+m,x=0;x<v;x++)if(g[x]===0)for(var T=0;T<v;T++){var M=T*v+x;d[M]=w}else for(var S=0;S<v;S++){var I=S*v+x;d[I]=d[I]/g[x]+m}for(var B=new Array(v),V=new Array(v),F,k=0;k<v;k++)B[k]=1;for(var U=0;U<i;U++){for(var J=0;J<v;J++)V[J]=0;for(var W=0;W<v;W++)for(var Q=0;Q<v;Q++){var Z=W*v+Q;V[W]+=d[Z]*B[Q]}Nd(V),F=B,B=V,V=F;for(var H=0,j=0;j<v;j++){var $=F[j]-B[j];H+=$*$}if(H<n)break}var q={rank:function(ee){return ee=s.collection(ee)[0],B[l.indexOf(ee)]}};return q}},ql=Dt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),da={degreeCentralityNormalized:function(e){e=ql(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},v={},c=0,h=0,d=0;d<n;d++){var g=a[d],m=g.id();e.root=g;var p=this.degreeCentrality(e);c<p.indegree&&(c=p.indegree),h<p.outdegree&&(h=p.outdegree),f[m]=p.indegree,v[m]=p.outdegree}return{indegree:function(b){return c==0?0:(Le(b)&&(b=r.filter(b)),f[b.id()]/c)},outdegree:function(b){return h===0?0:(Le(b)&&(b=r.filter(b)),v[b.id()]/h)}}}else{for(var i={},o=0,s=0;s<n;s++){var u=a[s];e.root=u;var l=this.degreeCentrality(e);o<l.degree&&(o=l.degree),i[u.id()]=l.degree}return{degree:function(b){return o===0?0:(Le(b)&&(b=r.filter(b)),i[b.id()]/o)}}}},degreeCentrality:function(e){e=ql(e);var r=this.cy(),a=this,n=e,i=n.root,o=n.weight,s=n.directed,u=n.alpha;if(i=r.collection(i)[0],s){for(var h=i.connectedEdges(),d=h.filter(function(A){return A.target().same(i)&&a.has(A)}),g=h.filter(function(A){return A.source().same(i)&&a.has(A)}),m=d.length,p=g.length,y=0,b=0,E=0;E<d.length;E++)y+=o(d[E]);for(var C=0;C<g.length;C++)b+=o(g[C]);return{indegree:Math.pow(m,1-u)*Math.pow(y,u),outdegree:Math.pow(p,1-u)*Math.pow(b,u)}}else{for(var l=i.connectedEdges().intersection(a),f=l.length,v=0,c=0;c<l.length;c++)v+=o(l[c]);return{degree:Math.pow(f,1-u)*Math.pow(v,u)}}}};da.dc=da.degreeCentrality;da.dcn=da.degreeCentralityNormalised=da.degreeCentralityNormalized;var Yl=Dt({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),ga={closenessCentralityNormalized:function(e){for(var r=Yl(e),a=r.harmonic,n=r.weight,i=r.directed,o=this.cy(),s={},u=0,l=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),v=0;v<l.length;v++){for(var c=0,h=l[v],d=0;d<l.length;d++)if(v!==d){var g=f.distance(h,l[d]);a?c+=1/g:c+=g}a||(c=1/c),u<c&&(u=c),s[h.id()]=c}return{closeness:function(p){return u==0?0:(Le(p)?p=o.filter(p)[0].id():p=p.id(),s[p]/u)}}},closenessCentrality:function(e){var r=Yl(e),a=r.root,n=r.weight,i=r.directed,o=r.harmonic;a=this.filter(a)[0];for(var s=this.dijkstra({root:a,weight:n,directed:i}),u=0,l=this.nodes(),f=0;f<l.length;f++){var v=l[f];if(!v.same(a)){var c=s.distanceTo(v);o?u+=1/c:u+=c}}return o?u:1/u}};ga.cc=ga.closenessCentrality;ga.ccn=ga.closenessCentralityNormalised=ga.closenessCentralityNormalized;var Qd=Dt({weight:null,directed:!1}),hs={betweennessCentrality:function(e){for(var r=Qd(e),a=r.directed,n=r.weight,i=n!=null,o=this.cy(),s=this.nodes(),u={},l={},f=0,v={set:function(b,E){l[b]=E,E>f&&(f=E)},get:function(b){return l[b]}},c=0;c<s.length;c++){var h=s[c],d=h.id();a?u[d]=h.outgoers().nodes():u[d]=h.openNeighborhood().nodes(),v.set(d,0)}for(var g=function(){for(var b=s[m].id(),E=[],C={},A={},D={},N=new fn(function(W,Q){return D[W]-D[Q]}),O=0;O<s.length;O++){var R=s[O].id();C[R]=[],A[R]=0,D[R]=1/0}for(A[b]=1,D[b]=0,N.push(b);!N.empty();){var P=N.pop();if(E.push(P),i)for(var w=0;w<u[P].length;w++){var x=u[P][w],T=o.getElementById(P),M=void 0;T.edgesTo(x).length>0?M=T.edgesTo(x)[0]:M=x.edgesTo(T)[0];var S=n(M);x=x.id(),D[x]>D[P]+S&&(D[x]=D[P]+S,N.nodes.indexOf(x)<0?N.push(x):N.updateItem(x),A[x]=0,C[x]=[]),D[x]==D[P]+S&&(A[x]=A[x]+A[P],C[x].push(P))}else for(var I=0;I<u[P].length;I++){var B=u[P][I].id();D[B]==1/0&&(N.push(B),D[B]=D[P]+1),D[B]==D[P]+1&&(A[B]=A[B]+A[P],C[B].push(P))}}for(var V={},F=0;F<s.length;F++)V[s[F].id()]=0;for(;E.length>0;){for(var k=E.pop(),U=0;U<C[k].length;U++){var J=C[k][U];V[J]=V[J]+A[J]/A[k]*(1+V[k])}k!=s[m].id()&&v.set(k,v.get(k)+V[k])}},m=0;m<s.length;m++)g();var p={betweenness:function(b){var E=o.collection(b).id();return v.get(E)},betweennessNormalized:function(b){if(f==0)return 0;var E=o.collection(b).id();return v.get(E)/f}};return p.betweennessNormalised=p.betweennessNormalized,p}};hs.bc=hs.betweennessCentrality;var Jd=Dt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),jd=function(e){return Jd(e)},eg=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},tg=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},bv=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var o=0;o<r;o++)e[o*r+n]=e[o*r+n]/a}},rg=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var o=0;o<a;o++)n[i*a+o]=0;for(var s=0;s<a;s++)for(var u=0;u<a;u++)n[i*a+u]+=e[i*a+s]*r[s*a+u]}return n},ag=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=rg(e,n,r);return e},ng=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return bv(n,r),n},ig=function(e,r,a,n){for(var i=0;i<a;i++){var o=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),s=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(o!==s)return!1}return!0},og=function(e,r,a,n){for(var i=[],o=0;o<r;o++){for(var s=[],u=0;u<r;u++)Math.round(e[o*r+u]*1e3)/1e3>0&&s.push(a[u]);s.length!==0&&i.push(n.collection(s))}return i},sg=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},lg=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&sg(e[r],e[a])&&e.splice(a,1);return e},Wl=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=jd(e),o={},s=0;s<r.length;s++)o[r[s].id()]=s;for(var u=r.length,l=u*u,f=new Array(l),v,c=0;c<l;c++)f[c]=0;for(var h=0;h<a.length;h++){var d=a[h],g=o[d.source().id()],m=o[d.target().id()],p=eg(d,i.attributes);f[g*u+m]+=p,f[m*u+g]+=p}tg(f,u,i.multFactor),bv(f,u);for(var y=!0,b=0;y&&b<i.maxIterations;)y=!1,v=ag(f,u,i.expandFactor),f=ng(v,u,i.inflateFactor),ig(f,v,l,4)||(y=!0),b++;var E=og(f,u,r,n);return E=lg(E),E},ug={markovClustering:Wl,mcl:Wl},fg=function(e){return e},wv=function(e,r){return Math.abs(r-e)},Xl=function(e,r,a){return e+wv(r,a)},$l=function(e,r,a){return e+Math.pow(a-r,2)},vg=function(e){return Math.sqrt(e)},cg=function(e,r,a){return Math.max(e,wv(r,a))},Ia=function(e,r,a,n,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:fg,s=n,u,l,f=0;f<e;f++)u=r(f),l=a(f),s=i(s,u,l);return o(s)},ma={euclidean:function(e,r,a){return e>=2?Ia(e,r,a,0,$l,vg):Ia(e,r,a,0,Xl)},squaredEuclidean:function(e,r,a){return Ia(e,r,a,0,$l)},manhattan:function(e,r,a){return Ia(e,r,a,0,Xl)},max:function(e,r,a){return Ia(e,r,a,-1/0,cg)}};ma["squared-euclidean"]=ma.squaredEuclidean;ma.squaredeuclidean=ma.squaredEuclidean;function ci(t,e,r,a,n,i){var o;return ot(t)?o=t:o=ma[t]||ma.euclidean,e===0&&ot(t)?o(n,i):o(e,r,a,n,i)}var hg=Dt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Us=function(e){return hg(e)},ei=function(e,r,a,n,i){var o=i!=="kMedoids",s=o?function(v){return a[v]}:function(v){return n[v](a)},u=function(c){return n[c](r)},l=a,f=r;return ci(e,n.length,s,u,l,f)},ji=function(e,r,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(r),u=null,l=0;l<n;l++)i[l]=e.min(a[l]).value,o[l]=e.max(a[l]).value;for(var f=0;f<r;f++){u=[];for(var v=0;v<n;v++)u[v]=Math.random()*(o[v]-i[v])+i[v];s[f]=u}return s},Ev=function(e,r,a,n,i){for(var o=1/0,s=0,u=0;u<r.length;u++){var l=ei(a,e,r[u],n,i);l<o&&(o=l,s=u)}return s},xv=function(e,r,a){for(var n=[],i=null,o=0;o<r.length;o++)i=r[o],a[i.id()]===e&&n.push(i);return n},dg=function(e,r,a){return Math.abs(r-e)<=a},gg=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var o=Math.abs(e[n][i]-r[n][i]);if(o>a)return!1}return!0},pg=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},Kl=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];pg(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var o=0;o<r;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},_l=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=ei("manhattan",r[i],e,a,"kMedoids");return n},yg=function(e){var r=this.cy(),a=this.nodes(),n=null,i=Us(e),o=new Array(i.k),s={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=ji(a,i.k,i.attributes)):mt(i.testCentroids)==="object"?u=i.testCentroids:u=ji(a,i.k,i.attributes):u=ji(a,i.k,i.attributes);for(var l=!0,f=0;l&&f<i.maxIterations;){for(var v=0;v<a.length;v++)n=a[v],s[n.id()]=Ev(n,u,i.distance,i.attributes,"kMeans");l=!1;for(var c=0;c<i.k;c++){var h=xv(c,a,s);if(h.length!==0){for(var d=i.attributes.length,g=u[c],m=new Array(d),p=new Array(d),y=0;y<d;y++){p[y]=0;for(var b=0;b<h.length;b++)n=h[b],p[y]+=i.attributes[y](n);m[y]=p[y]/h.length,dg(m[y],g[y],i.sensitivityThreshold)||(l=!0)}u[c]=m,o[c]=r.collection(h)}}f++}return o},mg=function(e){var r=this.cy(),a=this.nodes(),n=null,i=Us(e),o=new Array(i.k),s,u={},l,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(mt(i.testCentroids)==="object"?s=i.testCentroids:s=Kl(a,i.k)):s=Kl(a,i.k);for(var v=!0,c=0;v&&c<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],u[n.id()]=Ev(n,s,i.distance,i.attributes,"kMedoids");v=!1;for(var d=0;d<s.length;d++){var g=xv(d,a,u);if(g.length!==0){f[d]=_l(s[d],g,i.attributes);for(var m=0;m<g.length;m++)l=_l(g[m],g,i.attributes),l<f[d]&&(f[d]=l,s[d]=g[m],v=!0);o[d]=r.collection(g)}}c++}return o},bg=function(e,r,a,n,i){for(var o,s,u=0;u<r.length;u++)for(var l=0;l<e.length;l++)n[u][l]=Math.pow(a[u][l],i.m);for(var f=0;f<e.length;f++)for(var v=0;v<i.attributes.length;v++){o=0,s=0;for(var c=0;c<r.length;c++)o+=n[c][f]*i.attributes[v](r[c]),s+=n[c][f];e[f][v]=o/s}},wg=function(e,r,a,n,i){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var s,u,l,f=2/(i.m-1),v=0;v<a.length;v++)for(var c=0;c<n.length;c++){s=0;for(var h=0;h<a.length;h++)u=ei(i.distance,n[c],a[v],i.attributes,"cmeans"),l=ei(i.distance,n[c],a[h],i.attributes,"cmeans"),s+=Math.pow(u/l,f);e[c][v]=1/s}},Eg=function(e,r,a,n){for(var i=new Array(a.k),o=0;o<i.length;o++)i[o]=[];for(var s,u,l=0;l<r.length;l++){s=-1/0,u=-1;for(var f=0;f<r[0].length;f++)r[l][f]>s&&(s=r[l][f],u=f);i[u].push(e[l])}for(var v=0;v<i.length;v++)i[v]=n.collection(i[v]);return i},Zl=function(e){var r=this.cy(),a=this.nodes(),n=Us(e),i,o,s,u,l;u=new Array(a.length);for(var f=0;f<a.length;f++)u[f]=new Array(n.k);s=new Array(a.length);for(var v=0;v<a.length;v++)s[v]=new Array(n.k);for(var c=0;c<a.length;c++){for(var h=0,d=0;d<n.k;d++)s[c][d]=Math.random(),h+=s[c][d];for(var g=0;g<n.k;g++)s[c][g]=s[c][g]/h}o=new Array(n.k);for(var m=0;m<n.k;m++)o[m]=new Array(n.attributes.length);l=new Array(a.length);for(var p=0;p<a.length;p++)l[p]=new Array(n.k);for(var y=!0,b=0;y&&b<n.maxIterations;)y=!1,bg(o,a,s,l,n),wg(s,u,o,a,n),gg(s,u,n.sensitivityThreshold)||(y=!0),b++;return i=Eg(a,s,n,r),{clusters:i,degreeOfMembership:s}},xg={kMeans:yg,kMedoids:mg,fuzzyCMeans:Zl,fcm:Zl},Tg=Dt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Cg={single:"min",complete:"max"},Sg=function(e){var r=Tg(e),a=Cg[r.linkage];return a!=null&&(r.linkage=a),r},Ql=function(e,r,a,n,i){for(var o=0,s=1/0,u,l=i.attributes,f=function(O,R){return ci(i.distance,l.length,function(P){return l[P](O)},function(P){return l[P](R)},O,R)},v=0;v<e.length;v++){var c=e[v].key,h=a[c][n[c]];h<s&&(o=c,s=h)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[o],g=r[n[o]],m;i.mode==="dendrogram"?m={left:d,right:g,key:d.key}:m={value:d.value.concat(g.value),key:d.key},e[d.index]=m,e.splice(g.index,1),r[d.key]=m;for(var p=0;p<e.length;p++){var y=e[p];d.key===y.key?u=1/0:i.linkage==="min"?(u=a[d.key][y.key],a[d.key][y.key]>a[g.key][y.key]&&(u=a[g.key][y.key])):i.linkage==="max"?(u=a[d.key][y.key],a[d.key][y.key]<a[g.key][y.key]&&(u=a[g.key][y.key])):i.linkage==="mean"?u=(a[d.key][y.key]*d.size+a[g.key][y.key]*g.size)/(d.size+g.size):i.mode==="dendrogram"?u=f(y.value,d.value):u=f(y.value[0],d.value[0]),a[d.key][y.key]=a[y.key][d.key]=u}for(var b=0;b<e.length;b++){var E=e[b].key;if(n[E]===d.key||n[E]===g.key){for(var C=E,A=0;A<e.length;A++){var D=e[A].key;a[E][D]<a[E][C]&&(C=D)}n[E]=C}e[b].index=b}return d.key=g.key=d.index=g.index=null,!0},va=function(e,r,a){e&&(e.value?r.push(e.value):(e.left&&va(e.left,r),e.right&&va(e.right,r)))},ds=function(e,r){if(!e)return"";if(e.left&&e.right){var a=ds(e.left,r),n=ds(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},gs=function(e,r,a){if(!e)return[];var n=[],i=[],o=[];return r===0?(e.left&&va(e.left,n),e.right&&va(e.right,i),o=n.concat(i),[a.collection(o)]):r===1?e.value?[a.collection(e.value)]:(e.left&&va(e.left,n),e.right&&va(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=gs(e.left,r-1,a)),e.right&&(i=gs(e.right,r-1,a)),n.concat(i))},Jl=function(e){for(var r=this.cy(),a=this.nodes(),n=Sg(e),i=n.attributes,o=function(b,E){return ci(n.distance,i.length,function(C){return i[C](b)},function(C){return i[C](E)},b,E)},s=[],u=[],l=[],f=[],v=0;v<a.length;v++){var c={value:n.mode==="dendrogram"?a[v]:[a[v]],key:v,index:v};s[v]=c,f[v]=c,u[v]=[],l[v]=0}for(var h=0;h<s.length;h++)for(var d=0;d<=h;d++){var g=void 0;n.mode==="dendrogram"?g=h===d?1/0:o(s[h].value,s[d].value):g=h===d?1/0:o(s[h].value[0],s[d].value[0]),u[h][d]=g,u[d][h]=g,g<u[h][l[h]]&&(l[h]=d)}for(var m=Ql(s,f,u,l,n);m;)m=Ql(s,f,u,l,n);var p;return n.mode==="dendrogram"?(p=gs(s[0],n.dendrogramDepth,r),n.addDendrogram&&ds(s[0],r)):(p=new Array(s.length),s.forEach(function(y,b){y.key=y.index=null,p[b]=r.collection(y.value)})),p},Dg={hierarchicalClustering:Jl,hca:Jl},Ag=Dt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Mg=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||nt("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||we(a)||nt("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),Ag(e)},Lg=function(e,r,a,n){var i=function(s,u){return n[u](s)};return-ci(e,n.length,function(o){return i(r,o)},function(o){return i(a,o)},r,a)},Ng=function(e,r){var a=null;return r==="median"?a=Md(e):r==="mean"?a=Ad(e):r==="min"?a=Sd(e):r==="max"?a=Dd(e):a=r,a},Rg=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},jl=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var o=-1,s=-1/0,u=0;u<a.length;u++){var l=a[u];r[i*e+l]>s&&(o=l,s=r[i*e+l])}o>0&&n.push(o)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},Pg=function(e,r,a){for(var n=jl(e,r,a),i=0;i<a.length;i++){for(var o=[],s=0;s<n.length;s++)n[s]===a[i]&&o.push(s);for(var u=-1,l=-1/0,f=0;f<o.length;f++){for(var v=0,c=0;c<o.length;c++)v+=r[o[c]*e+o[f]];v>l&&(u=f,l=v)}a[i]=o[u]}return n=jl(e,r,a),n},eu=function(e){for(var r=this.cy(),a=this.nodes(),n=Mg(e),i={},o=0;o<a.length;o++)i[a[o].id()]=o;var s,u,l,f,v,c;s=a.length,u=s*s,l=new Array(u);for(var h=0;h<u;h++)l[h]=-1/0;for(var d=0;d<s;d++)for(var g=0;g<s;g++)d!==g&&(l[d*s+g]=Lg(n.distance,a[d],a[g],n.attributes));f=Ng(l,n.preference);for(var m=0;m<s;m++)l[m*s+m]=f;v=new Array(u);for(var p=0;p<u;p++)v[p]=0;c=new Array(u);for(var y=0;y<u;y++)c[y]=0;for(var b=new Array(s),E=new Array(s),C=new Array(s),A=0;A<s;A++)b[A]=0,E[A]=0,C[A]=0;for(var D=new Array(s*n.minIterations),N=0;N<D.length;N++)D[N]=0;var O;for(O=0;O<n.maxIterations;O++){for(var R=0;R<s;R++){for(var P=-1/0,w=-1/0,x=-1,T=0,M=0;M<s;M++)b[M]=v[R*s+M],T=c[R*s+M]+l[R*s+M],T>=P?(w=P,P=T,x=M):T>w&&(w=T);for(var S=0;S<s;S++)v[R*s+S]=(1-n.damping)*(l[R*s+S]-P)+n.damping*b[S];v[R*s+x]=(1-n.damping)*(l[R*s+x]-w)+n.damping*b[x]}for(var I=0;I<s;I++){for(var B=0,V=0;V<s;V++)b[V]=c[V*s+I],E[V]=Math.max(0,v[V*s+I]),B+=E[V];B-=E[I],E[I]=v[I*s+I],B+=E[I];for(var F=0;F<s;F++)c[F*s+I]=(1-n.damping)*Math.min(0,B-E[F])+n.damping*b[F];c[I*s+I]=(1-n.damping)*(B-E[I])+n.damping*b[I]}for(var k=0,U=0;U<s;U++){var J=c[U*s+U]+v[U*s+U]>0?1:0;D[O%n.minIterations*s+U]=J,k+=J}if(k>0&&(O>=n.minIterations-1||O==n.maxIterations-1)){for(var W=0,Q=0;Q<s;Q++){C[Q]=0;for(var Z=0;Z<n.minIterations;Z++)C[Q]+=D[Z*s+Q];(C[Q]===0||C[Q]===n.minIterations)&&W++}if(W===s)break}}for(var H=Rg(s,v,c),j=Pg(s,l,H),$={},q=0;q<H.length;q++)$[H[q]]=[];for(var K=0;K<a.length;K++){var ee=i[a[K].id()],ne=j[ee];ne!=null&&$[ne].push(a[K])}for(var te=new Array(H.length),be=0;be<H.length;be++)te[be]=r.collection($[H[be]]);return te},Og={affinityPropagation:eu,ap:eu},Ig=Dt({root:void 0,directed:!1}),Bg={hierholzer:function(e){if(!$e(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=Ig(e),n=a.root,i=a.directed,o=this,s=!1,u,l,f;n&&(f=Le(n)?this.filter(n)[0].id():n[0].id());var v={},c={};i?o.forEach(function(y){var b=y.id();if(y.isNode()){var E=y.indegree(!0),C=y.outdegree(!0),A=E-C,D=C-E;A==1?u?s=!0:u=b:D==1?l?s=!0:l=b:(D>1||A>1)&&(s=!0),v[b]=[],y.outgoers().forEach(function(N){N.isEdge()&&v[b].push(N.id())})}else c[b]=[void 0,y.target().id()]}):o.forEach(function(y){var b=y.id();if(y.isNode()){var E=y.degree(!0);E%2&&(u?l?s=!0:l=b:u=b),v[b]=[],y.connectedEdges().forEach(function(C){return v[b].push(C.id())})}else c[b]=[y.source().id(),y.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(l&&u)if(i){if(f&&l!=f)return h;f=l}else{if(f&&l!=f&&u!=f)return h;f||(f=l)}else f||(f=o[0].id());var d=function(b){for(var E=b,C=[b],A,D,N;v[E].length;)A=v[E].shift(),D=c[A][0],N=c[A][1],E!=N?(v[N]=v[N].filter(function(O){return O!=A}),E=N):!i&&E!=D&&(v[D]=v[D].filter(function(O){return O!=A}),E=D),C.unshift(A),C.unshift(E);return C},g=[],m=[];for(m=d(f);m.length!=1;)v[m[0]].length==0?(g.unshift(o.getElementById(m.shift())),g.unshift(o.getElementById(m.shift()))):m=d(m.shift()).concat(m);g.unshift(o.getElementById(m.shift()));for(var p in v)if(v[p].length)return h;return h.found=!0,h.trail=this.spawn(g,!0),h}},Mn=function(){var e=this,r={},a=0,n=0,i=[],o=[],s={},u=function(c,h){for(var d=o.length-1,g=[],m=e.spawn();o[d].x!=c||o[d].y!=h;)g.push(o.pop().edge),d--;g.push(o.pop().edge),g.forEach(function(p){var y=p.connectedNodes().intersection(e);m.merge(p),y.forEach(function(b){var E=b.id(),C=b.connectedEdges().intersection(e);m.merge(b),r[E].cutVertex?m.merge(C.filter(function(A){return A.isLoop()})):m.merge(C)})}),i.push(m)},l=function(c,h,d){c===d&&(n+=1),r[h]={id:a,low:a++,cutVertex:!1};var g=e.getElementById(h).connectedEdges().intersection(e);if(g.size()===0)i.push(e.spawn(e.getElementById(h)));else{var m,p,y,b;g.forEach(function(E){m=E.source().id(),p=E.target().id(),y=m===h?p:m,y!==d&&(b=E.id(),s[b]||(s[b]=!0,o.push({x:h,y,edge:E})),y in r?r[h].low=Math.min(r[h].low,r[y].id):(l(c,y,h),r[h].low=Math.min(r[h].low,r[y].low),r[h].id<=r[y].low&&(r[h].cutVertex=!0,u(h,y))))})}};e.forEach(function(v){if(v.isNode()){var c=v.id();c in r||(n=0,l(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(v){return r[v].cutVertex}).map(function(v){return e.getElementById(v)});return{cut:e.spawn(f),components:i}},kg={hopcroftTarjanBiconnected:Mn,htbc:Mn,htb:Mn,hopcroftTarjanBiconnectedComponents:Mn},Ln=function(){var e=this,r={},a=0,n=[],i=[],o=e.spawn(e),s=function(l){i.push(l),r[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(g){var m=g.target().id();m!==l&&(m in r||s(m),r[m].explored||(r[l].low=Math.min(r[l].low,r[m].low)))}),r[l].index===r[l].low){for(var v=e.spawn();;){var c=i.pop();if(v.merge(e.getElementById(c)),r[c].low=r[l].index,r[c].explored=!0,c===l)break}var h=v.edgesWith(v),d=v.merge(h);n.push(d),o=o.difference(d)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in r||s(l)}}),{cut:o,components:n}},Fg={tarjanStronglyConnected:Ln,tsc:Ln,tscc:Ln,tarjanStronglyConnectedComponents:Ln},Tv={};[_a,hd,dd,pd,md,wd,Td,Zd,da,ga,hs,ug,xg,Dg,Og,Bg,kg,Fg].forEach(function(t){Re(Tv,t)});var Cv=0,Sv=1,Dv=2,$t=function(e){if(!(this instanceof $t))return new $t(e);this.id="Thenable/1.0.7",this.state=Cv,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};$t.prototype={fulfill:function(e){return tu(this,Sv,"fulfillValue",e)},reject:function(e){return tu(this,Dv,"rejectReason",e)},then:function(e,r){var a=this,n=new $t;return a.onFulfilled.push(au(e,n,"fulfill")),a.onRejected.push(au(r,n,"reject")),Av(a),n.proxy}};var tu=function(e,r,a,n){return e.state===Cv&&(e.state=r,e[a]=n,Av(e)),e},Av=function(e){e.state===Sv?ru(e,"onFulfilled",e.fulfillValue):e.state===Dv&&ru(e,"onRejected",e.rejectReason)},ru=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var s=0;s<n.length;s++)n[s](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},au=function(e,r,a){return function(n){if(typeof e!="function")r[a].call(r,n);else{var i;try{i=e(n)}catch(o){r.reject(o);return}Mv(r,i)}}},Mv=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(mt(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(r,function(i){n||(n=!0,i===r?e.reject(new TypeError("circular thenable chain")):Mv(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(r)};$t.all=function(t){return new $t(function(e,r){for(var a=new Array(t.length),n=0,i=function(u,l){a[u]=l,n++,n===t.length&&e(a)},o=0;o<t.length;o++)(function(s){var u=t[s],l=u!=null&&u.then!=null;if(l)u.then(function(v){i(s,v)},function(v){r(v)});else{var f=u;i(s,f)}})(o)})};$t.resolve=function(t){return new $t(function(e,r){e(t)})};$t.reject=function(t){return new $t(function(e,r){r(t)})};var Ta=typeof Promise<"u"?Promise:$t,ps=function(e,r,a){var n=Rs(e),i=!n,o=this._private=Re({duration:1e3},r,a);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&ot(o.complete)&&o.completes.push(o.complete),i){var s=e.position();o.startPosition=o.startPosition||{x:s.x,y:s.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(n){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},$r=ps.prototype;Re($r,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),Gt(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(l,f){var v=e[l];v!=null&&(e[l]=e[f],e[f]=v)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[n]=s}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new Ta(function(n,i){a.push(function(){n()})})}});$r.complete=$r.completed;$r.run=$r.play;$r.running=$r.playing;var zg={animated:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=n[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<n.length;o++){var s=n[o];s._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this,u=!i,l=!u;if(!s.styleEnabled())return this;var f=s.style();r=Re({},r,a);var v=Object.keys(r).length===0;if(v)return new ps(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(l&&(r.style=f.getPropsList(r.style||r.css),r.css=void 0),l&&r.renderedPosition!=null){var c=r.renderedPosition,h=s.pan(),d=s.zoom();r.position=hv(c,d,h)}if(u&&r.panBy!=null){var g=r.panBy,m=s.pan();r.pan={x:m.x+g.x,y:m.y+g.y}}var p=r.center||r.centre;if(u&&p!=null){var y=s.getCenterPan(p.eles,r.zoom);y!=null&&(r.pan=y)}if(u&&r.fit!=null){var b=r.fit,E=s.getFitViewport(b.eles||b.boundingBox,b.padding);E!=null&&(r.pan=E.pan,r.zoom=E.zoom)}if(u&&$e(r.zoom)){var C=s.getZoomedViewport(r.zoom);C!=null?(C.zoomed&&(r.zoom=C.zoom),C.panned&&(r.pan=C.pan)):r.zoom=null}return new ps(o[0],r)}},animate:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;a&&(r=Re({},r,a));for(var u=0;u<o.length;u++){var l=o[u],f=l.animated()&&(r.queue===void 0||r.queue),v=l.animation(r,f?{queue:!0}:void 0);v.play()}return this}},stop:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var u=0;u<o.length;u++){for(var l=o[u],f=l._private,v=f.animation.current,c=0;c<v.length;c++){var h=v[c],d=h._private;a&&(d.duration=0)}r&&(f.animation.queue=[]),a||(f.animation.current=[])}return s.notify("draw"),this}}},eo,nu;function hi(){if(nu)return eo;nu=1;var t=Array.isArray;return eo=t,eo}var to,iu;function Vg(){if(iu)return to;iu=1;var t=hi(),e=ln(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function n(i,o){if(t(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:a.test(i)||!r.test(i)||o!=null&&i in Object(o)}return to=n,to}var ro,ou;function Gg(){if(ou)return ro;ou=1;var t=nv(),e=sn(),r="[object AsyncFunction]",a="[object Function]",n="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=t(s);return u==a||u==n||u==r||u==i}return ro=o,ro}var ao,su;function Ug(){if(su)return ao;su=1;var t=ui(),e=t["__core-js_shared__"];return ao=e,ao}var no,lu;function Hg(){if(lu)return no;lu=1;var t=Ug(),e=(function(){var a=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function r(a){return!!e&&e in a}return no=r,no}var io,uu;function qg(){if(uu)return io;uu=1;var t=Function.prototype,e=t.toString;function r(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return io=r,io}var oo,fu;function Yg(){if(fu)return oo;fu=1;var t=Gg(),e=Hg(),r=sn(),a=qg(),n=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,f=RegExp("^"+u.call(l).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function v(c){if(!r(c)||e(c))return!1;var h=t(c)?f:i;return h.test(a(c))}return oo=v,oo}var so,vu;function Wg(){if(vu)return so;vu=1;function t(e,r){return e?.[r]}return so=t,so}var lo,cu;function Hs(){if(cu)return lo;cu=1;var t=Yg(),e=Wg();function r(a,n){var i=e(a,n);return t(i)?i:void 0}return lo=r,lo}var uo,hu;function di(){if(hu)return uo;hu=1;var t=Hs(),e=t(Object,"create");return uo=e,uo}var fo,du;function Xg(){if(du)return fo;du=1;var t=di();function e(){this.__data__=t?t(null):{},this.size=0}return fo=e,fo}var vo,gu;function $g(){if(gu)return vo;gu=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return vo=t,vo}var co,pu;function Kg(){if(pu)return co;pu=1;var t=di(),e="__lodash_hash_undefined__",r=Object.prototype,a=r.hasOwnProperty;function n(i){var o=this.__data__;if(t){var s=o[i];return s===e?void 0:s}return a.call(o,i)?o[i]:void 0}return co=n,co}var ho,yu;function _g(){if(yu)return ho;yu=1;var t=di(),e=Object.prototype,r=e.hasOwnProperty;function a(n){var i=this.__data__;return t?i[n]!==void 0:r.call(i,n)}return ho=a,ho}var go,mu;function Zg(){if(mu)return go;mu=1;var t=di(),e="__lodash_hash_undefined__";function r(a,n){var i=this.__data__;return this.size+=this.has(a)?0:1,i[a]=t&&n===void 0?e:n,this}return go=r,go}var po,bu;function Qg(){if(bu)return po;bu=1;var t=Xg(),e=$g(),r=Kg(),a=_g(),n=Zg();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,po=i,po}var yo,wu;function Jg(){if(wu)return yo;wu=1;function t(){this.__data__=[],this.size=0}return yo=t,yo}var mo,Eu;function Lv(){if(Eu)return mo;Eu=1;function t(e,r){return e===r||e!==e&&r!==r}return mo=t,mo}var bo,xu;function gi(){if(xu)return bo;xu=1;var t=Lv();function e(r,a){for(var n=r.length;n--;)if(t(r[n][0],a))return n;return-1}return bo=e,bo}var wo,Tu;function jg(){if(Tu)return wo;Tu=1;var t=gi(),e=Array.prototype,r=e.splice;function a(n){var i=this.__data__,o=t(i,n);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():r.call(i,o,1),--this.size,!0}return wo=a,wo}var Eo,Cu;function ep(){if(Cu)return Eo;Cu=1;var t=gi();function e(r){var a=this.__data__,n=t(a,r);return n<0?void 0:a[n][1]}return Eo=e,Eo}var xo,Su;function tp(){if(Su)return xo;Su=1;var t=gi();function e(r){return t(this.__data__,r)>-1}return xo=e,xo}var To,Du;function rp(){if(Du)return To;Du=1;var t=gi();function e(r,a){var n=this.__data__,i=t(n,r);return i<0?(++this.size,n.push([r,a])):n[i][1]=a,this}return To=e,To}var Co,Au;function ap(){if(Au)return Co;Au=1;var t=Jg(),e=jg(),r=ep(),a=tp(),n=rp();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,Co=i,Co}var So,Mu;function np(){if(Mu)return So;Mu=1;var t=Hs(),e=ui(),r=t(e,"Map");return So=r,So}var Do,Lu;function ip(){if(Lu)return Do;Lu=1;var t=Qg(),e=ap(),r=np();function a(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return Do=a,Do}var Ao,Nu;function op(){if(Nu)return Ao;Nu=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Ao=t,Ao}var Mo,Ru;function pi(){if(Ru)return Mo;Ru=1;var t=op();function e(r,a){var n=r.__data__;return t(a)?n[typeof a=="string"?"string":"hash"]:n.map}return Mo=e,Mo}var Lo,Pu;function sp(){if(Pu)return Lo;Pu=1;var t=pi();function e(r){var a=t(this,r).delete(r);return this.size-=a?1:0,a}return Lo=e,Lo}var No,Ou;function lp(){if(Ou)return No;Ou=1;var t=pi();function e(r){return t(this,r).get(r)}return No=e,No}var Ro,Iu;function up(){if(Iu)return Ro;Iu=1;var t=pi();function e(r){return t(this,r).has(r)}return Ro=e,Ro}var Po,Bu;function fp(){if(Bu)return Po;Bu=1;var t=pi();function e(r,a){var n=t(this,r),i=n.size;return n.set(r,a),this.size+=n.size==i?0:1,this}return Po=e,Po}var Oo,ku;function vp(){if(ku)return Oo;ku=1;var t=ip(),e=sp(),r=lp(),a=up(),n=fp();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,Oo=i,Oo}var Io,Fu;function cp(){if(Fu)return Io;Fu=1;var t=vp(),e="Expected a function";function r(a,n){if(typeof a!="function"||n!=null&&typeof n!="function")throw new TypeError(e);var i=function(){var o=arguments,s=n?n.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=a.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(r.Cache||t),i}return r.Cache=t,Io=r,Io}var Bo,zu;function hp(){if(zu)return Bo;zu=1;var t=cp(),e=500;function r(a){var n=t(a,function(o){return i.size===e&&i.clear(),o}),i=n.cache;return n}return Bo=r,Bo}var ko,Vu;function Nv(){if(Vu)return ko;Vu=1;var t=hp(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,a=t(function(n){var i=[];return n.charCodeAt(0)===46&&i.push(""),n.replace(e,function(o,s,u,l){i.push(u?l.replace(r,"$1"):s||o)}),i});return ko=a,ko}var Fo,Gu;function Rv(){if(Gu)return Fo;Gu=1;function t(e,r){for(var a=-1,n=e==null?0:e.length,i=Array(n);++a<n;)i[a]=r(e[a],a,e);return i}return Fo=t,Fo}var zo,Uu;function dp(){if(Uu)return zo;Uu=1;var t=Os(),e=Rv(),r=hi(),a=ln(),n=t?t.prototype:void 0,i=n?n.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return e(s,o)+"";if(a(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return zo=o,zo}var Vo,Hu;function Pv(){if(Hu)return Vo;Hu=1;var t=dp();function e(r){return r==null?"":t(r)}return Vo=e,Vo}var Go,qu;function Ov(){if(qu)return Go;qu=1;var t=hi(),e=Vg(),r=Nv(),a=Pv();function n(i,o){return t(i)?i:e(i,o)?[i]:r(a(i))}return Go=n,Go}var Uo,Yu;function qs(){if(Yu)return Uo;Yu=1;var t=ln();function e(r){if(typeof r=="string"||t(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return Uo=e,Uo}var Ho,Wu;function gp(){if(Wu)return Ho;Wu=1;var t=Ov(),e=qs();function r(a,n){n=t(n,a);for(var i=0,o=n.length;a!=null&&i<o;)a=a[e(n[i++])];return i&&i==o?a:void 0}return Ho=r,Ho}var qo,Xu;function pp(){if(Xu)return qo;Xu=1;var t=gp();function e(r,a,n){var i=r==null?void 0:t(r,a);return i===void 0?n:i}return qo=e,qo}var yp=pp(),mp=on(yp),Yo,$u;function bp(){if($u)return Yo;$u=1;var t=Hs(),e=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Yo=e,Yo}var Wo,Ku;function wp(){if(Ku)return Wo;Ku=1;var t=bp();function e(r,a,n){a=="__proto__"&&t?t(r,a,{configurable:!0,enumerable:!0,value:n,writable:!0}):r[a]=n}return Wo=e,Wo}var Xo,_u;function Ep(){if(_u)return Xo;_u=1;var t=wp(),e=Lv(),r=Object.prototype,a=r.hasOwnProperty;function n(i,o,s){var u=i[o];(!(a.call(i,o)&&e(u,s))||s===void 0&&!(o in i))&&t(i,o,s)}return Xo=n,Xo}var $o,Zu;function xp(){if(Zu)return $o;Zu=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(a,n){var i=typeof a;return n=n??t,!!n&&(i=="number"||i!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<n}return $o=r,$o}var Ko,Qu;function Tp(){if(Qu)return Ko;Qu=1;var t=Ep(),e=Ov(),r=xp(),a=sn(),n=qs();function i(o,s,u,l){if(!a(o))return o;s=e(s,o);for(var f=-1,v=s.length,c=v-1,h=o;h!=null&&++f<v;){var d=n(s[f]),g=u;if(d==="__proto__"||d==="constructor"||d==="prototype")return o;if(f!=c){var m=h[d];g=l?l(m,d,h):void 0,g===void 0&&(g=a(m)?m:r(s[f+1])?[]:{})}t(h,d,g),h=h[d]}return o}return Ko=i,Ko}var _o,Ju;function Cp(){if(Ju)return _o;Ju=1;var t=Tp();function e(r,a,n){return r==null?r:t(r,a,n)}return _o=e,_o}var Sp=Cp(),Dp=on(Sp),Zo,ju;function Ap(){if(ju)return Zo;ju=1;function t(e,r){var a=-1,n=e.length;for(r||(r=Array(n));++a<n;)r[a]=e[a];return r}return Zo=t,Zo}var Qo,ef;function Mp(){if(ef)return Qo;ef=1;var t=Rv(),e=Ap(),r=hi(),a=ln(),n=Nv(),i=qs(),o=Pv();function s(u){return r(u)?t(u,i):a(u)?[u]:e(n(o(u)))}return Qo=s,Qo}var Lp=Mp(),Np=on(Lp),Rp={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,i){},onSet:function(n){},canSet:function(n){return!0}};return e=Re({},r,e),function(n,i){var o=e,s=this,u=s.length!==void 0,l=u?s:[s],f=u?s[0]:s;if(Le(n)){var v=n.indexOf(".")!==-1,c=v&&Np(n);if(o.allowGetting&&i===void 0){var h;return f&&(o.beforeGet(f),c&&f._private[o.field][n]===void 0?h=mp(f._private[o.field],c):h=f._private[o.field][n]),h}else if(o.allowSetting&&i!==void 0){var d=!o.immutableKeys[n];if(d){var g=Kf({},n,i);o.beforeSet(s,g);for(var m=0,p=l.length;m<p;m++){var y=l[m];o.canSet(y)&&(c&&f._private[o.field][n]===void 0?Dp(y._private[o.field],c,i):y._private[o.field][n]=i)}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&$e(n)){var b=n,E,C,A=Object.keys(b);o.beforeSet(s,b);for(var D=0;D<A.length;D++){E=A[D],C=b[E];var N=!o.immutableKeys[E];if(N)for(var O=0;O<l.length;O++){var R=l[O];o.canSet(R)&&(R._private[o.field][E]=C)}}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&ot(n)){var P=n;s.on(o.bindingEvent,P)}else if(o.allowGetting&&n===void 0){var w;return f&&(o.beforeGet(f),w=f._private[o.field]),w}return s}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=Re({},r,e),function(n){var i=e,o=this,s=o.length!==void 0,u=s?o:[o];if(Le(n)){for(var l=n.split(/\s+/),f=l.length,v=0;v<f;v++){var c=l[v];if(!xr(c)){var h=!i.immutableKeys[c];if(h)for(var d=0,g=u.length;d<g;d++)u[d]._private[i.field][c]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(n===void 0){for(var m=0,p=u.length;m<p;m++)for(var y=u[m]._private[i.field],b=Object.keys(y),E=0;E<b.length;E++){var C=b[E],A=!i.immutableKeys[C];A&&(y[C]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},Pp={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,n){var i=this,o=Array.prototype.slice.call(arguments,0);return new Ta(function(s,u){var l=function(h){i.off.apply(i,v),s(h)},f=o.concat([l]),v=f.concat([]);i.on.apply(i,f)})}}},Ze={};[zg,Rp,Pp].forEach(function(t){Re(Ze,t)});var Op={animate:Ze.animate(),animation:Ze.animation(),animated:Ze.animated(),clearQueue:Ze.clearQueue(),delay:Ze.delay(),delayAnimation:Ze.delayAnimation(),stop:Ze.stop()},Gn={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(d){return a.push(d)}),a}else et(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new xa(e),o=0;o<r.length;o++){for(var s=r[o],u=s._private,l=u.classes,f=!1,v=0;v<e.length;v++){var c=e[v],h=l.has(c);if(!h){f=!0;break}}f||(f=l.size!==e.length),f&&(u.classes=i,n.push(s))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){et(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],o=0,s=a.length;o<s;o++)for(var u=a[o],l=u._private.classes,f=!1,v=0;v<e.length;v++){var c=e[v],h=l.has(c),d=!1;r||n&&!h?(l.add(c),d=!0):(!r||n&&h)&&(l.delete(c),d=!0),!f&&d&&(i.push(u),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};Gn.className=Gn.classNames=Gn.classes;var Xe={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:yt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Xe.variable="(?:[\\w-.]|(?:\\\\"+Xe.metaChar+"))+";Xe.className="(?:[\\w-]|(?:\\\\"+Xe.metaChar+"))+";Xe.value=Xe.string+"|"+Xe.number;Xe.id=Xe.variable;(function(){var t,e,r;for(t=Xe.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Xe.comparatorOp+="|@"+e;for(t=Xe.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Xe.comparatorOp+="|\\!"+e)})();var je=function(){return{checks:[]}},Ce={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},ys=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return Rh(t.selector,e.selector)}),Ip=(function(){for(var t={},e,r=0;r<ys.length;r++)e=ys[r],t[e.selector]=e.matches;return t})(),Bp=function(e,r){return Ip[e](r)},kp="("+ys.map(function(t){return t.selector}).join("|")+")",ra=function(e){return e.replace(new RegExp("\\\\("+Xe.metaChar+")","g"),function(r,a){return a})},gr=function(e,r,a){e[e.length-1]=a},ms=[{name:"group",query:!0,regex:"("+Xe.group+")",populate:function(e,r,a){var n=dt(a,1),i=n[0];r.checks.push({type:Ce.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:kp,populate:function(e,r,a){var n=dt(a,1),i=n[0];r.checks.push({type:Ce.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Xe.id+")",populate:function(e,r,a){var n=dt(a,1),i=n[0];r.checks.push({type:Ce.ID,value:ra(i)})}},{name:"className",query:!0,regex:"\\.("+Xe.className+")",populate:function(e,r,a){var n=dt(a,1),i=n[0];r.checks.push({type:Ce.CLASS,value:ra(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Xe.variable+")\\s*\\]",populate:function(e,r,a){var n=dt(a,1),i=n[0];r.checks.push({type:Ce.DATA_EXIST,field:ra(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Xe.variable+")\\s*("+Xe.comparatorOp+")\\s*("+Xe.value+")\\s*\\]",populate:function(e,r,a){var n=dt(a,3),i=n[0],o=n[1],s=n[2],u=new RegExp("^"+Xe.string+"$").exec(s)!=null;u?s=s.substring(1,s.length-1):s=parseFloat(s),r.checks.push({type:Ce.DATA_COMPARE,field:ra(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Xe.boolOp+")\\s*("+Xe.variable+")\\s*\\]",populate:function(e,r,a){var n=dt(a,2),i=n[0],o=n[1];r.checks.push({type:Ce.DATA_BOOL,field:ra(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Xe.meta+")\\s*("+Xe.comparatorOp+")\\s*("+Xe.number+")\\s*\\]\\]",populate:function(e,r,a){var n=dt(a,3),i=n[0],o=n[1],s=n[2];r.checks.push({type:Ce.META_COMPARE,field:ra(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:Xe.separator,populate:function(e,r){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,o=e[e.length-1];a!=null&&(o.subject=a,e.currentSubject=null),o.edgeCount=n,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var s=e[e.length++]=je();return s}},{name:"directedEdge",separator:!0,regex:Xe.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=je(),n=r,i=je();return a.checks.push({type:Ce.DIRECTED_EDGE,source:n,target:i}),gr(e,r,a),e.edgeCount++,i}else{var o=je(),s=r,u=je();return o.checks.push({type:Ce.NODE_SOURCE,source:s,target:u}),gr(e,r,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Xe.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=je(),n=r,i=je();return a.checks.push({type:Ce.UNDIRECTED_EDGE,nodes:[n,i]}),gr(e,r,a),e.edgeCount++,i}else{var o=je(),s=r,u=je();return o.checks.push({type:Ce.NODE_NEIGHBOR,node:s,neighbor:u}),gr(e,r,o),u}}},{name:"child",separator:!0,regex:Xe.child,populate:function(e,r){if(e.currentSubject==null){var a=je(),n=je(),i=e[e.length-1];return a.checks.push({type:Ce.CHILD,parent:i,child:n}),gr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=je(),s=e[e.length-1],u=je(),l=je(),f=je(),v=je();return o.checks.push({type:Ce.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:Ce.TRUE}],v.checks.push({type:Ce.TRUE}),u.checks.push({type:Ce.PARENT,parent:v,child:f}),gr(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var c=je(),h=je(),d=[{type:Ce.PARENT,parent:c,child:h}];return c.checks=r.checks,r.checks=d,e.compoundCount++,h}}},{name:"descendant",separator:!0,regex:Xe.descendant,populate:function(e,r){if(e.currentSubject==null){var a=je(),n=je(),i=e[e.length-1];return a.checks.push({type:Ce.DESCENDANT,ancestor:i,descendant:n}),gr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=je(),s=e[e.length-1],u=je(),l=je(),f=je(),v=je();return o.checks.push({type:Ce.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:Ce.TRUE}],v.checks.push({type:Ce.TRUE}),u.checks.push({type:Ce.ANCESTOR,ancestor:v,descendant:f}),gr(e,s,o),e.currentSubject=l,e.compoundCount++,f}else{var c=je(),h=je(),d=[{type:Ce.ANCESTOR,ancestor:c,descendant:h}];return c.checks=r.checks,r.checks=d,e.compoundCount++,h}}},{name:"subject",modifier:!0,regex:Xe.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Qe("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===Ce.DIRECTED_EDGE?n.type=Ce.NODE_TARGET:i===Ce.UNDIRECTED_EDGE&&(n.type=Ce.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];ms.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var Fp=function(e){for(var r,a,n,i=0;i<ms.length;i++){var o=ms[i],s=o.name,u=e.match(o.regexObj);if(u!=null){a=u,r=o,n=s;var l=u[0];e=e.substring(l.length);break}}return{expr:r,match:a,name:n,remaining:e}},zp=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},Vp=function(e){var r=this,a=r.inputText=e,n=r[0]=je();for(r.length=1,a=zp(a);;){var i=Fp(a);if(i.expr==null)return Qe("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(r,n,o);if(s===!1)return!1;if(s!=null&&(n=s),a=i.remaining,a.match(/^\s*$/))break}var u=r[r.length-1];r.currentSubject!=null&&(u.subject=r.currentSubject),u.edgeCount=r.edgeCount,u.compoundCount=r.compoundCount;for(var l=0;l<r.length;l++){var f=r[l];if(f.compoundCount>0&&f.edgeCount>0)return Qe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Qe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Qe("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},Gp=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},r=function(f){return Le(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,v){var c=f.type,h=f.value;switch(c){case Ce.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case Ce.DATA_COMPARE:{var g=f.field,m=f.operator;return"["+g+a(e(m))+r(h)+"]"}case Ce.DATA_BOOL:{var p=f.operator,y=f.field;return"["+e(p)+y+"]"}case Ce.DATA_EXIST:{var b=f.field;return"["+b+"]"}case Ce.META_COMPARE:{var E=f.operator,C=f.field;return"[["+C+a(e(E))+r(h)+"]]"}case Ce.STATE:return h;case Ce.ID:return"#"+h;case Ce.CLASS:return"."+h;case Ce.PARENT:case Ce.CHILD:return i(f.parent,v)+a(">")+i(f.child,v);case Ce.ANCESTOR:case Ce.DESCENDANT:return i(f.ancestor,v)+" "+i(f.descendant,v);case Ce.COMPOUND_SPLIT:{var A=i(f.left,v),D=i(f.subject,v),N=i(f.right,v);return A+(A.length>0?" ":"")+D+N}case Ce.TRUE:return""}},i=function(f,v){return f.checks.reduce(function(c,h,d){return c+(v===f&&d===0?"$":"")+n(h,v)},"")},o="",s=0;s<this.length;s++){var u=this[s];o+=i(u,u.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o},Up={parse:Vp,toString:Gp},Iv=function(e,r,a){var n,i=Le(e),o=we(e),s=Le(a),u,l,f=!1,v=!1,c=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),v=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||s||f)&&(u=!i&&!o?"":""+e,l=""+a),f&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),r){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e<a;break;case"<=":c=!0,n=e<=a;break;default:n=!1;break}return v&&(e!=null||!c)&&(n=!n),n},Hp=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},qp=function(e){return e!==void 0},Ys=function(e,r){return e.data(r)},Yp=function(e,r){return e[r]()},lt=[],at=function(e,r){return e.checks.every(function(a){return lt[a.type](a,r)})};lt[Ce.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};lt[Ce.STATE]=function(t,e){var r=t.value;return Bp(r,e)};lt[Ce.ID]=function(t,e){var r=t.value;return e.id()===r};lt[Ce.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};lt[Ce.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return Iv(Yp(e,r),a,n)};lt[Ce.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return Iv(Ys(e,r),a,n)};lt[Ce.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return Hp(Ys(e,r),a)};lt[Ce.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,qp(Ys(e,r))};lt[Ce.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],n=e.source(),i=e.target();return at(r,n)&&at(a,i)||at(a,n)&&at(r,i)};lt[Ce.NODE_NEIGHBOR]=function(t,e){return at(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&at(t.neighbor,r)})};lt[Ce.DIRECTED_EDGE]=function(t,e){return at(t.source,e.source())&&at(t.target,e.target())};lt[Ce.NODE_SOURCE]=function(t,e){return at(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&at(t.target,r)})};lt[Ce.NODE_TARGET]=function(t,e){return at(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&at(t.source,r)})};lt[Ce.CHILD]=function(t,e){return at(t.child,e)&&at(t.parent,e.parent())};lt[Ce.PARENT]=function(t,e){return at(t.parent,e)&&e.children().some(function(r){return at(t.child,r)})};lt[Ce.DESCENDANT]=function(t,e){return at(t.descendant,e)&&e.ancestors().some(function(r){return at(t.ancestor,r)})};lt[Ce.ANCESTOR]=function(t,e){return at(t.ancestor,e)&&e.descendants().some(function(r){return at(t.descendant,r)})};lt[Ce.COMPOUND_SPLIT]=function(t,e){return at(t.subject,e)&&at(t.left,e)&&at(t.right,e)};lt[Ce.TRUE]=function(){return!0};lt[Ce.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};lt[Ce.FILTER]=function(t,e){var r=t.value;return r(e)};var Wp=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===Ce.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(i){for(var o=0;o<r.length;o++){var s=r[o];if(at(s,i))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},Xp=function(e){for(var r=this,a=0;a<r.length;a++){var n=r[a];if(at(n,e))return!0}return!1},$p={matches:Xp,filter:Wp},Sr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||Le(e)&&e.match(/^\s*$/)||(Gt(e)?this.addQuery({checks:[{type:Ce.COLLECTION,value:e.collection()}]}):ot(e)?this.addQuery({checks:[{type:Ce.FILTER,value:e}]}):Le(e)?this.parse(e)||(this.invalid=!0):nt("A selector must be created from a string; found "))},Dr=Sr.prototype;[Up,$p].forEach(function(t){return Re(Dr,t)});Dr.text=function(){return this.inputText};Dr.size=function(){return this.length};Dr.eq=function(t){return this[t]};Dr.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};Dr.addQuery=function(t){this[this.length++]=t};Dr.selector=Dr.toString;var wr={allAre:function(e){var r=new Sr(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new Sr(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};wr.allAreNeighbours=wr.allAreNeighbors;wr.has=wr.contains;wr.equal=wr.equals=wr.same;var qt=function(e,r){return function(n,i,o,s){var u=n,l=this,f;if(u==null?f="":Gt(u)&&u.length===1&&(f=u.id()),l.length===1&&f){var v=l[0]._private,c=v.traversalCache=v.traversalCache||{},h=c[r]=c[r]||[],d=Wr(f),g=h[d];return g||(h[d]=e.call(l,n,i,o,s))}else return e.call(l,n,i,o,s)}},ba={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],o=i._private.parent;o&&r.push(o)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];r.push(i)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var n=this[a],i=n.parents();r=r||i,r=r.intersect(i)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:qt(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function a(n){for(var i=0;i<n.length;i++){var o=n[i];r.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function Ws(t,e,r,a){for(var n=[],i=new xa,o=t.cy(),s=o.hasCompoundNodes(),u=0;u<t.length;u++){var l=t[u];r?n.push(l):s&&a(n,i,l)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),s&&a(n,i,f)}return t}function Bv(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||t.push(i)}}ba.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ws(this,t,e,Bv)};function kv(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}ba.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ws(this,t,e,kv)};function Kp(t,e,r){kv(t,e,r),Bv(t,e,r)}ba.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ws(this,t,e,Kp)};ba.ancestors=ba.parents;var Ja,Fv;Ja=Fv={data:Ze.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Ze.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ze.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ze.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ze.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ze.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Ja.attr=Ja.data;Ja.removeAttr=Ja.removeData;var _p=Fv,yi={};function Jo(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(a+=t(n,s))}return a}else return}}Re(yi,{degree:Jo(function(t,e){return e.source().same(e.target())?2:1}),indegree:Jo(function(t,e){return e.target().same(t)?1:0}),outdegree:Jo(function(t,e){return e.source().same(t)?1:0})});function aa(t,e){return function(r){for(var a,n=this.nodes(),i=0;i<n.length;i++){var o=n[i],s=o[t](r);s!==void 0&&(a===void 0||e(s,a))&&(a=s)}return a}}Re(yi,{minDegree:aa("degree",function(t,e){return t<e}),maxDegree:aa("degree",function(t,e){return t>e}),minIndegree:aa("indegree",function(t,e){return t<e}),maxIndegree:aa("indegree",function(t,e){return t>e}),minOutdegree:aa("outdegree",function(t,e){return t<e}),maxOutdegree:aa("outdegree",function(t,e){return t>e})});Re(yi,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n<a.length;n++)r+=a[n].degree(e);return r}});var Xt,zv,Vv=function(e,r,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var o=i._private.position,s={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};i.isParent()&&!(s.x===0&&s.y===0)&&i.children().shift(s,a),i.dirtyBoundingBoxCache()}}},tf={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){Vv(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Xt=zv={position:Ze.data(tf),silentPosition:Ze.data(Re({},tf,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){Vv(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if($e(e))r?this.silentPosition(e):this.position(e);else if(ot(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=a(o,i))&&(r?o.silentPosition(s):o.position(s))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var n;if($e(e)?(n={x:we(e.x)?e.x:0,y:we(e.y)?e.y:0},a=r):Le(e)&&we(r)&&(n={x:0,y:0},n[e]=r),n!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var u=s.position(),l={x:u.x+n.x,y:u.y+n.y};a?s.silentPosition(l):s.position(l)}}i.endBatch()}return this},silentShift:function(e,r){return $e(e)?this.shift(e,!0):Le(e)&&we(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],n=this.cy(),i=n.zoom(),o=n.pan(),s=$e(e)?e:void 0,u=s!==void 0||r!==void 0&&Le(e);if(a&&a.isNode())if(u)for(var l=0;l<this.length;l++){var f=this[l];r!==void 0?f.position(e,(r-o[e])/i):s!==void 0&&f.position(hv(s,i,o))}else{var v=a.position();return s=vi(v,i,o),e===void 0?s:s[e]}else if(!u)return;return this},relativePosition:function(e,r){var a=this[0],n=this.cy(),i=$e(e)?e:void 0,o=i!==void 0||r!==void 0&&Le(e),s=n.hasCompoundNodes();if(a&&a.isNode())if(o)for(var u=0;u<this.length;u++){var l=this[u],f=s?l.parent():null,v=f&&f.length>0,c=v;v&&(f=f[0]);var h=c?f.position():{x:0,y:0};r!==void 0?l.position(e,r+h[e]):i!==void 0&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),g=s?a.parent():null,m=g&&g.length>0,p=m;m&&(g=g[0]);var y=p?g.position():{x:0,y:0};return i={x:d.x-y.x,y:d.y-y.y},e===void 0?i:i[e]}else if(!o)return;return this}};Xt.modelPosition=Xt.point=Xt.position;Xt.modelPositions=Xt.points=Xt.positions;Xt.renderedPoint=Xt.renderedPosition;Xt.relativePoint=Xt.relativePosition;var Zp=zv,wa=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},Ea=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},Qp=function(e){switch(e){case"left":return"right";case"right":return"left";case"left-inside":return"left";case"right-inside":return"right";default:return"center"}},pa,Nr;pa=Nr={};Nr.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}};Nr.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};Nr.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},v=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),c=s.position;(v.w===0||v.h===0)&&(v={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},v.x1=c.x-v.w/2,v.x2=c.x+v.w/2,v.y1=c.y-v.h/2,v.y2=c.y+v.h/2);function h(O,R,P){var w=0,x=0,T=R+P;return O>0&&T>0&&(w=R/T*O,x=P/T*O),{biasDiff:w,biasComplementDiff:x}}function d(O,R,P,w){if(P.units==="%")switch(w){case"width":return O>0?P.pfValue*O:0;case"height":return R>0?P.pfValue*R:0;case"average":return O>0&&R>0?P.pfValue*(O+R)/2:0;case"min":return O>0&&R>0?O>R?P.pfValue*R:P.pfValue*O:0;case"max":return O>0&&R>0?O>R?P.pfValue*O:P.pfValue*R:0;default:return 0}else return P.units==="px"?P.pfValue:0}var g=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(g=g*100/f.width.val);var m=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(m=m*100/f.width.val);var p=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(p=p*100/f.height.val);var y=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(y=y*100/f.height.val);var b=h(f.width.val-v.w,g,m),E=b.biasDiff,C=b.biasComplementDiff,A=h(f.height.val-v.h,p,y),D=A.biasDiff,N=A.biasComplementDiff;s.autoPadding=d(v.w,v.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(v.w,f.width.val),c.x=(-E+v.x1+v.x2+C)/2,s.autoHeight=Math.max(v.h,f.height.val),c.y=(-D+v.y1+v.y2+N)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||t)&&(r(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var Ht=function(e){return e===1/0||e===-1/0?0:e},Wt=function(e,r,a,n,i){n-r===0||i-a===0||r==null||a==null||n==null||i==null||(e.x1=r<e.x1?r:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},pr=function(e,r){return r==null?e:Wt(e,r.x1,r.y1,r.x2,r.y2)},Ba=function(e,r,a){return It(e,r,a)},Nn=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,o=i.arrowWidth/2,s=r.pstyle(a+"-arrow-shape").value,u,l;if(s!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=n.arrowBounds=n.arrowBounds||{},v=f[a]=f[a]||{};v.x1=u-o,v.y1=l-o,v.x2=u+o,v.y2=l+o,v.w=v.x2-v.x1,v.h=v.y2-v.y1,zn(v,1),Wt(e,v.x1,v.y1,v.x2,v.y2)}}},jo=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,o=i.rstyle,s=r.pstyle(n+"label").strValue;if(s){var u=r.pstyle("text-halign"),l=r.pstyle("text-valign"),f=Ba(o,"labelWidth",a),v=Ba(o,"labelHeight",a),c=Ba(o,"labelX",a),h=Ba(o,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,g=r.pstyle(n+"text-margin-y").pfValue,m=r.isEdge(),p=r.pstyle(n+"text-rotation"),y=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue,E=b/2,C=r.pstyle("text-background-padding").pfValue,A=2,D=v,N=f,O=N/2,R=D/2,P,w,x,T;if(m)P=c-O,w=c+O,x=h-R,T=h+R;else{switch(wa(u.value)){case"left":P=c-N,w=c;break;case"center":P=c-O,w=c+O;break;case"right":P=c,w=c+N;break}switch(Ea(l.value)){case"top":x=h-D,T=h;break;case"center":x=h-R,T=h+R;break;case"bottom":x=h,T=h+D;break}}var M=d-Math.max(y,E)-C-A,S=d+Math.max(y,E)+C+A,I=g-Math.max(y,E)-C-A,B=g+Math.max(y,E)+C+A;P+=M,w+=S,x+=I,T+=B;var V=a||"main",F=i.labelBounds,k=F[V]=F[V]||{};k.x1=P,k.y1=x,k.x2=w,k.y2=T,k.w=w-P,k.h=T-x,k.leftPad=M,k.rightPad=S,k.topPad=I,k.botPad=B;var U=m&&p.strValue==="autorotate",J=p.pfValue!=null&&p.pfValue!==0;if(U||J){var W=U?Ba(i.rstyle,"labelAngle",a):p.pfValue,Q=Math.cos(W),Z=Math.sin(W),H=(P+w)/2,j=(x+T)/2;if(!m){switch(wa(u.value)){case"left":H=w;break;case"right":H=P;break}switch(Ea(l.value)){case"top":j=T;break;case"bottom":j=x;break}}var $=function(ve,oe){return ve=ve-H,oe=oe-j,{x:ve*Q-oe*Z+H,y:ve*Z+oe*Q+j}},q=$(P,x),K=$(P,T),ee=$(w,x),ne=$(w,T);P=Math.min(q.x,K.x,ee.x,ne.x),w=Math.max(q.x,K.x,ee.x,ne.x),x=Math.min(q.y,K.y,ee.y,ne.y),T=Math.max(q.y,K.y,ee.y,ne.y)}var te=V+"Rot",be=F[te]=F[te]||{};be.x1=P,be.y1=x,be.x2=w,be.y2=T,be.w=w-P,be.h=T-x,Wt(e,P,x,w,T),Wt(i.labelBounds.all,P,x,w,T)}return e}},rf=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value,i=r.pstyle("outline-offset").value,o=n+i;Gv(e,r,a,o,"outside",o/2)}},Gv=function(e,r,a,n,i,o){if(!(a===0||n<=0||i==="inside")){var s=r.cy(),u=s.renderer(),l=u.nodeShapes[u.getNodeShape(r)];if(l){var f=r.position(),v=f.x,c=f.y,h=r.width(),d=r.height();if(l.hasMiterBounds){i==="center"&&(n/=2);var g=l.miterBounds(v,c,h,d,n);pr(e,g)}else o!=null&&o>0&&Vn(e,[o,o,o,o])}}},Jp=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,n=r.pstyle("border-width").pfValue,i=r.pstyle("border-position").value;Gv(e,r,a,n,i)}},jp=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=Bt(),s=e._private,u=e.isNode(),l=e.isEdge(),f,v,c,h,d,g,m=s.rstyle,p=u&&n?e.pstyle("bounds-expansion").pfValue:[0],y=function(Se){return Se.pstyle("display").value!=="none"},b=!n||y(e)&&(!l||y(e.source())&&y(e.target()));if(b){var E=0,C=0;n&&r.includeOverlays&&(E=e.pstyle("overlay-opacity").value,E!==0&&(C=e.pstyle("overlay-padding").value));var A=0,D=0;n&&r.includeUnderlays&&(A=e.pstyle("underlay-opacity").value,A!==0&&(D=e.pstyle("underlay-padding").value));var N=Math.max(C,D),O=0,R=0;if(n&&(O=e.pstyle("width").pfValue,R=O/2),u&&r.includeNodes){var P=e.position();d=P.x,g=P.y;var w=e.outerWidth(),x=w/2,T=e.outerHeight(),M=T/2;f=d-x,v=d+x,c=g-M,h=g+M,Wt(o,f,c,v,h),n&&rf(o,e),n&&r.includeOutlines&&!i&&rf(o,e),n&&Jp(o,e)}else if(l&&r.includeEdges)if(n&&!i){var S=e.pstyle("curve-style").strValue;if(f=Math.min(m.srcX,m.midX,m.tgtX),v=Math.max(m.srcX,m.midX,m.tgtX),c=Math.min(m.srcY,m.midY,m.tgtY),h=Math.max(m.srcY,m.midY,m.tgtY),f-=R,v+=R,c-=R,h+=R,Wt(o,f,c,v,h),S==="haystack"){var I=m.haystackPts;if(I&&I.length===2){if(f=I[0].x,c=I[0].y,v=I[1].x,h=I[1].y,f>v){var B=f;f=v,v=B}if(c>h){var V=c;c=h,h=V}Wt(o,f-R,c-R,v+R,h+R)}}else if(S==="bezier"||S==="unbundled-bezier"||yr(S,"segments")||yr(S,"taxi")){var F;switch(S){case"bezier":case"unbundled-bezier":F=m.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":F=m.linePts;break}if(F!=null)for(var k=0;k<F.length;k++){var U=F[k];f=U.x-R,v=U.x+R,c=U.y-R,h=U.y+R,Wt(o,f,c,v,h)}}}else{var J=e.source(),W=J.position(),Q=e.target(),Z=Q.position();if(f=W.x,v=Z.x,c=W.y,h=Z.y,f>v){var H=f;f=v,v=H}if(c>h){var j=c;c=h,h=j}f-=R,v+=R,c-=R,h+=R,Wt(o,f,c,v,h)}if(n&&r.includeEdges&&l&&(Nn(o,e,"mid-source"),Nn(o,e,"mid-target"),Nn(o,e,"source"),Nn(o,e,"target")),n){var $=e.pstyle("ghost").value==="yes";if($){var q=e.pstyle("ghost-offset-x").pfValue,K=e.pstyle("ghost-offset-y").pfValue;Wt(o,o.x1+q,o.y1+K,o.x2+q,o.y2+K)}}var ee=s.bodyBounds=s.bodyBounds||{};Ul(ee,o),Vn(ee,p),zn(ee,1),n&&(f=o.x1,v=o.x2,c=o.y1,h=o.y2,Wt(o,f-N,c-N,v+N,h+N));var ne=s.overlayBounds=s.overlayBounds||{};Ul(ne,o),Vn(ne,p),zn(ne,1);var te=s.labelBounds=s.labelBounds||{};te.all!=null?Od(te.all):te.all=Bt(),n&&r.includeLabels&&(r.includeMainLabels&&jo(o,e,null),l&&(r.includeSourceLabels&&jo(o,e,"source"),r.includeTargetLabels&&jo(o,e,"target")))}return o.x1=Ht(o.x1),o.y1=Ht(o.y1),o.x2=Ht(o.x2),o.y2=Ht(o.y2),o.w=Ht(o.x2-o.x1),o.h=Ht(o.y2-o.y1),o.w>0&&o.h>0&&b&&(Vn(o,p),zn(o,1)),o},Uv=function(e){var r=0,a=function(o){return(o?1:0)<<r++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},Hv=function(e){var r=function(s){return Math.round(s)};if(e.isEdge()){var a=e.source().position(),n=e.target().position();return Bl([r(a.x),r(a.y),r(n.x),r(n.y)])}else{var i=e.position();return Bl([r(i.x),r(i.y)])}},af=function(e,r){var a=e._private,n,i=e.isEdge(),o=r==null?nf:Uv(r),s=o===nf;if(a.bbCache==null?(n=jp(e,ja),a.bbCache=n,a.bbCachePosKey=Hv(e)):n=a.bbCache,!s){var u=e.isNode();n=Bt(),(r.includeNodes&&u||r.includeEdges&&!u)&&(r.includeOverlays?pr(n,a.overlayBounds):pr(n,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?pr(n,a.labelBounds.all):(r.includeMainLabels&&pr(n,a.labelBounds.mainRot),r.includeSourceLabels&&pr(n,a.labelBounds.sourceRot),r.includeTargetLabels&&pr(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},ja={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},nf=Uv(ja),of=Dt(ja);Nr.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,a=ya(function(f){var v=f._private;return v.bbCache==null||v.styleDirty||v.bbCachePosKey!==Hv(f)},function(f){return f.id()});if(r&&this.length===1&&!a(this[0]))t===void 0?t=ja:t=of(t),e=af(this[0],t);else{e=Bt(),t=t||ja;var n=of(t),i=this,o=i.cy(),s=o.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),s&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var u=0;u<i.length;u++){var l=i[u];a(l)&&l.dirtyBoundingBoxCache(),pr(e,af(l,n))}}return e.x1=Ht(e.x1),e.y1=Ht(e.y1),e.x2=Ht(e.x2),e.y2=Ht(e.y2),e.w=Ht(e.x2-e.x1),e.h=Ht(e.y2-e.y1),e};Nr.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};Nr.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),n=r.collection();if(a&&(n=e.filter(function(l){return l.isParent()}),e=e.not(n)),$e(t)){var i=t;t=function(){return i}}var o=function(f,v){return f._private.bbAtOldPos=t(f,v)},s=function(f){return f._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var u=Pd(this.boundingBox({useCache:!1}));return e.silentPositions(s),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),r.endBatch(),u};pa.boundingbox=pa.bb=pa.boundingBox;pa.renderedBoundingbox=pa.renderedBoundingBox;var ey=Nr,Ha,vn;Ha=vn={};var qv=function(e){e.uppercaseName=wl(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=wl(e.outerName),Ha[e.name]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var s=a.pstyle(e.name);return s.strValue==="label"?(a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):s.pfValue}else return 1},Ha["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){var s=a[e.name](),u=a.pstyle("border-position").value,l;u==="center"?l=a.pstyle("border-width").pfValue:u==="outside"?l=2*a.pstyle("border-width").pfValue:l=0;var f=2*a.padding();return s+l+f}else return 1},Ha["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},Ha["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};qv({name:"width"});qv({name:"height"});vn.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};vn.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};vn.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var ty=vn,ry=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},ay=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return vi(r(e),a.zoom(),a.pan())}},ny=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),n=a.pan(),i=a.zoom();return r(e).map(function(o){return vi(o,i,n)})}},iy=function(e){return e.renderer().getControlPoints(e)},oy=function(e){return e.renderer().getSegmentPoints(e)},sy=function(e){return e.renderer().getSourceEndpoint(e)},ly=function(e){return e.renderer().getTargetEndpoint(e)},uy=function(e){return e.renderer().getEdgeMidpoint(e)},sf={controlPoints:{get:iy,mult:!0},segmentPoints:{get:oy,mult:!0},sourceEndpoint:{get:sy},targetEndpoint:{get:ly},midpoint:{get:uy}},fy=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},vy=Object.keys(sf).reduce(function(t,e){var r=sf[e],a=fy(e);return t[e]=function(){return ry(this,r.get)},r.mult?t[a]=function(){return ny(this,r.get)}:t[a]=function(){return ay(this,r.get)},t},{}),cy=Re({},Zp,ey,ty,vy);var Yv=function(e,r){this.recycle(e,r)};function ka(){return!1}function Rn(){return!0}Yv.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=ka,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Rn:ka):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Rn;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Rn;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Rn,this.stopPropagation()},isDefaultPrevented:ka,isPropagationStopped:ka,isImmediatePropagationStopped:ka};var Wv=/^([^.]+)(\.(?:[^.]+))?$/,hy=".*",Xv={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},lf=Object.keys(Xv),dy={};function mi(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dy,e=arguments.length>1?arguments[1]:void 0,r=0;r<lf.length;r++){var a=lf[r];this[a]=t[a]||Xv[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var Ar=mi.prototype,$v=function(e,r,a,n,i,o,s){ot(n)&&(i=n,n=null),s&&(o==null?o=s:o=Re({},o,s));for(var u=et(a)?a:a.split(/\s+/),l=0;l<u.length;l++){var f=u[l];if(!xr(f)){var v=f.match(Wv);if(v){var c=v[1],h=v[2]?v[2]:null,d=r(e,f,c,h,n,i,o);if(d===!1)break}}}},uf=function(e,r){return e.addEventFields(e.context,r),new Yv(r.type,r)},gy=function(e,r,a){if(wh(a)){r(e,a);return}else if($e(a)){r(e,uf(e,a));return}for(var n=et(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var o=n[i];if(!xr(o)){var s=o.match(Wv);if(s){var u=s[1],l=s[2]?s[2]:null,f=uf(e,{type:u,namespace:l,target:e.context});r(e,f)}}}};Ar.on=Ar.addListener=function(t,e,r,a,n){return $v(this,function(i,o,s,u,l,f,v){ot(f)&&i.listeners.push({event:o,callback:f,type:s,namespace:u,qualifier:l,conf:v})},t,e,r,a,n),this};Ar.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};Ar.removeListener=Ar.off=function(t,e,r,a){var n=this;this.emitting!==0&&(this.listeners=rd(this.listeners));for(var i=this.listeners,o=function(l){var f=i[l];$v(n,function(v,c,h,d,g,m){if((f.type===h||t==="*")&&(!d&&f.namespace!==".*"||f.namespace===d)&&(!g||v.qualifierCompare(f.qualifier,g))&&(!m||f.callback===m))return i.splice(l,1),!1},t,e,r,a)},s=i.length-1;s>=0;s--)o(s);return this};Ar.removeAllListeners=function(){return this.removeListener("*")};Ar.emit=Ar.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,et(e)||(e=[e]),gy(this,function(i,o){r!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],n=a.length);for(var s=function(){var f=a[u];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===hy)&&i.eventMatches(i.context,f,o)){var v=[o];e!=null&&nd(v,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(d){return d!==f}));var c=i.callbackContext(i.context,f,o),h=f.callback.apply(c,v);i.afterEmit(i.context,f,o),h===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<n;u++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},t),this.emitting--,this};var py={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&nn(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Pn=function(e){return Le(e)?new Sr(e):e},Kv={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new mi(py,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var n=Pn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a)}return this},removeListener:function(e,r,a){for(var n=Pn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var n=Pn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,n,a)}return this},once:function(e,r,a){for(var n=Pn(r),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var n=this[a];n.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};Ze.eventAliasesOn(Kv);var _v={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):r.push(n)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(Le(e)||Gt(e))return new Sr(e).filter(this);if(ot(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var o=n[i],s=r?e.apply(r,[o,i,n]):e(o,i,n);s&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){Le(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||r.push(n)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(Le(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),n=this,i=e,o=this.length<e.length,s=o?n:i,u=o?i:n,l=0;l<s.length;l++){var f=s[l];u.has(f)&&a.push(f)}return a},xor:function(e){var r=this._private.cy;Le(e)&&(e=r.$(e));var a=this.spawn(),n=this,i=e,o=function(u,l){for(var f=0;f<u.length;f++){var v=u[f],c=v._private.data.id,h=l.hasElementWithId(c);h||a.push(v)}};return o(n,i),o(i,n),a},diff:function(e){var r=this._private.cy;Le(e)&&(e=r.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),o=this,s=e,u=function(f,v,c){for(var h=0;h<f.length;h++){var d=f[h],g=d._private.data.id,m=v.hasElementWithId(g);m?i.merge(d):c.push(d)}};return u(o,s,a),u(s,o,n),{left:a,right:n,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(Le(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],s=!this.has(o);s&&n.push(o)}return n},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&Le(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=r.map,o=0;o<e.length;o++){var s=e[o],u=s._private.data.id,l=!i.has(u);if(l){var f=this.length++;this[f]=s,i.set(u,{ele:s,index:f})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var o=e===this.length-1;if(this.length>1&&!o){var s=this.length-1,u=this[s],l=u._private.data.id;this[s]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&Le(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,i=0;i<n.length;i++){var o=n[i],s=r?e.apply(r,[o,i,n]):e(o,i,n);a.push(s)}return a},reduce:function(e,r){for(var a=r,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,r){for(var a=-1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u>a&&(a=u,n=s)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u<a&&(a=u,n=s)}return{value:a,ele:n}}},Ke=_v;Ke.u=Ke["|"]=Ke["+"]=Ke.union=Ke.or=Ke.add;Ke["\\"]=Ke["!"]=Ke["-"]=Ke.difference=Ke.relativeComplement=Ke.subtract=Ke.not;Ke.n=Ke["&"]=Ke["."]=Ke.and=Ke.intersection=Ke.intersect;Ke["^"]=Ke["(+)"]=Ke["(-)"]=Ke.symmetricDifference=Ke.symdiff=Ke.xor;Ke.fnFilter=Ke.filterFn=Ke.stdFilter=Ke.filter;Ke.complement=Ke.abscomp=Ke.absoluteComplement;var yy={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Zv=function(e,r){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var v=f.pstyle("z-compound-depth");return v.value==="auto"?n?f.zDepth():0:v.value==="bottom"?-1:v.value==="top"?Is:0}var o=i(e)-i(r);if(o!==0)return o;function s(f){var v=f.pstyle("z-index-compare");return v.value==="auto"&&f.isNode()?1:0}var u=s(e)-s(r);if(u!==0)return u;var l=e.pstyle("z-index").value-r.pstyle("z-index").value;return l!==0?l:e.poolIndex()-r.poolIndex()},ti={forEach:function(e,r){if(ot(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],o=r?e.apply(r,[i,n,this]):e(i,n,this);if(o===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],n=this.length;r==null&&(r=n),e==null&&(e=0),e<0&&(e=n+e),r<0&&(r=n+r);for(var i=e;i>=0&&i<r&&i<n;i++)a.push(this[i]);return this.spawn(a)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!ot(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(Zv)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var n=r.data.parent?e.parents().size():0;return e.isParent()?n:Is-1}else{var i=r.source,o=r.target,s=i.zDepth(),u=o.zDepth();return Math.max(s,u,0)}}}};ti.each=ti.forEach;var my=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":mt(Symbol))!=e&&mt(Symbol.iterator)!=e;r&&(ti[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,o=this.length;return Kf({next:function(){return i<o?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};my();var by=Dt({nodeDimensionsIncludeLabels:!1}),Un={layoutDimensions:function(e){e=by(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var n=this.nodes().filter(function(C){return!C.isParent()}),i=this.cy(),o=r.eles,s=function(A){return A.id()},u=ya(a,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(A,D,N){var O={x:D.x1+D.w/2,y:D.y1+D.h/2},R={x:(N.x-O.x)*A,y:(N.y-O.y)*A};return{x:O.x+R.x,y:O.y+R.y}},f=r.spacingFactor&&r.spacingFactor!==1,v=function(){if(!f)return null;for(var A=Bt(),D=0;D<n.length;D++){var N=n[D],O=u(N,D);dv(A,O.x,O.y)}return A},c=v(),h=ya(function(C,A){var D=u(C,A);if(f){var N=Math.abs(r.spacingFactor);D=l(N,c,D)}return r.transform!=null&&(D=r.transform(C,D)),D},s);if(r.animate){for(var d=0;d<n.length;d++){var g=n[d],m=h(g,d),p=r.animateFilter==null||r.animateFilter(g,d);if(p){var y=g.animation({position:m,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(y)}else g.position(m)}if(r.fit){var b=i.animation({fit:{boundingBox:o.boundingBoxAt(h),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else if(r.zoom!==void 0&&r.pan!==void 0){var E=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(E)}e.animations.forEach(function(C){return C.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),Ta.all(e.animations.map(function(C){return C.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(h),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(Re({},e,{eles:this}))}};Un.createLayout=Un.makeLayout=Un.layout;function Qv(t,e,r){var a=r._private,n=a.styleCache=a.styleCache||[],i;return(i=n[t])!=null||(i=n[t]=e(r)),i}function bi(t,e){return t=Wr(t),function(a){return Qv(t,e,a)}}function wi(t,e){t=Wr(t);var r=function(n){return e.call(n)};return function(){var n=this[0];if(n)return Qv(t,r,n)}}var Ct={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),n=r.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(n){r(n),n.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var n=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(s){return s._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(r?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if($e(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(Le(e))if(r===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];n.removeAllBypasses(s,a)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];n.removeBypasses(l,e,a)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!r)return i;var o=n.data.parent?a.parents():null;if(o)for(var s=0;s<o.length;s++){var u=o[s],l=u.pstyle("opacity").value;i=l*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function es(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function Xs(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],o=n.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||es(i,a);var u=s.source,l=s.target;return r(u)&&(!o||es(u,r))&&(u===l||r(l)&&(!o||es(l,r)))}}}var Ca=bi("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Ct.takesUpSpace=wi("takesUpSpace",Xs({ok:Ca}));var wy=bi("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Ca(t)}),Ey=bi("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Ca(t)});Ct.interactive=wi("interactive",Xs({ok:wy,parentOk:Ey,edgeOkViaNode:Ca}));Ct.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var xy=bi("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Ca(t)}),Ty=Ca;Ct.visible=wi("visible",Xs({ok:xy,edgeOkViaNode:Ty}));Ct.hidden=function(){var t=this[0];if(t)return!t.visible()};Ct.isBundledBezier=wi("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});Ct.bypass=Ct.css=Ct.style;Ct.renderedCss=Ct.renderedStyle;Ct.removeBypass=Ct.removeCss=Ct.removeStyle;Ct.pstyle=Ct.parsedStyle;var Er={};function ff(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],n=e[1];this.on(t.event,a,n)}else if(e.length===1&&ot(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&et(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var u=this[s],l=!t.ableField||u._private[t.ableField],f=u._private[t.field]!=t.value;if(t.overrideAble){var v=t.overrideAble(u);if(v!==void 0&&(l=v,!v))return this}l&&(u._private[t.field]=t.value,f&&r.push(u))}var c=this.spawn(r);c.updateStyle(),c.emit(t.event),o&&c.emit(o)}return this}}function Sa(t){Er[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},Er[t.on]=ff({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),Er[t.off]=ff({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}Sa({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Sa({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Sa({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Sa({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Er.deselect=Er.unselect;Er.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};Sa({field:"active",on:"activate",off:"unactivate"});Sa({field:"pannable",on:"panify",off:"unpanify"});Er.inactive=function(){var t=this[0];if(t)return!t._private.active};var Lt={},vf=function(e){return function(a){for(var n=this,i=[],o=0;o<n.length;o++){var s=n[o];if(s.isNode()){for(var u=!1,l=s.connectedEdges(),f=0;f<l.length;f++){var v=l[f],c=v.source(),h=v.target();if(e.noIncomingEdges&&h===s&&c!==s||e.noOutgoingEdges&&c===s&&h!==s){u=!0;break}}u||i.push(s)}}return this.spawn(i,!0).filter(a)}},cf=function(e){return function(r){for(var a=this,n=[],i=0;i<a.length;i++){var o=a[i];if(o.isNode())for(var s=o.connectedEdges(),u=0;u<s.length;u++){var l=s[u],f=l.source(),v=l.target();e.outgoing&&f===o?(n.push(l),n.push(v)):e.incoming&&v===o&&(n.push(l),n.push(f))}}return this.spawn(n,!0).filter(r)}},hf=function(e){return function(r){for(var a=this,n=[],i={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var s=!1,u=0;u<o.length;u++){var l=o[u],f=l.id();i[f]||(i[f]=!0,n.push(l),s=!0)}if(!s)break;a=o}return this.spawn(n,!0).filter(r)}};Lt.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};Re(Lt,{roots:vf({noIncomingEdges:!0}),leaves:vf({noOutgoingEdges:!0}),outgoers:qt(cf({outgoing:!0}),"outgoers"),successors:hf({outgoing:!0}),incomers:qt(cf({incoming:!0}),"incomers"),predecessors:hf({})});Re(Lt,{neighborhood:qt(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var n=r[a],i=n.connectedEdges(),o=0;o<i.length;o++){var s=i[o],u=s.source(),l=s.target(),f=n===u?l:u;f.length>0&&e.push(f[0]),e.push(s[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});Lt.neighbourhood=Lt.neighborhood;Lt.closedNeighbourhood=Lt.closedNeighborhood;Lt.openNeighbourhood=Lt.openNeighborhood;Re(Lt,{source:qt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:qt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:df({attr:"source"}),targets:df({attr:"target"})});function df(t){return function(r){for(var a=[],n=0;n<this.length;n++){var i=this[n],o=i._private[t.attr];o&&a.push(o)}return this.spawn(a,!0).filter(r)}}Re(Lt,{edgesWith:qt(gf(),"edgesWith"),edgesTo:qt(gf({thisIsSrc:!0}),"edgesTo")});function gf(t){return function(r){var a=[],n=this._private.cy,i=t||{};Le(r)&&(r=n.$(r));for(var o=0;o<r.length;o++)for(var s=r[o]._private.edges,u=0;u<s.length;u++){var l=s[u],f=l._private.data,v=this.hasElementWithId(f.source)&&r.hasElementWithId(f.target),c=r.hasElementWithId(f.source)&&this.hasElementWithId(f.target),h=v||c;h&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!v||i.thisIsTgt&&!c)||a.push(l))}return this.spawn(a,!0)}}Re(Lt,{connectedEdges:qt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];if(n.isNode())for(var i=n._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:qt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:qt(pf(),"parallelEdges"),codirectedEdges:qt(pf({codirected:!0}),"codirectedEdges")});function pf(t){var e={codirected:!1};return t=Re({},e,t),function(a){for(var n=[],i=this.edges(),o=t,s=0;s<i.length;s++)for(var u=i[s],l=u._private,f=l.source,v=f._private.data.id,c=l.data.target,h=f._private.edges,d=0;d<h.length;d++){var g=h[d],m=g._private.data,p=m.target,y=m.source,b=p===c&&y===v,E=v===p&&c===y;(o.codirected&&b||!o.codirected&&(b||E))&&n.push(g)}return this.spawn(n,!0).filter(a)}}Re(Lt,{components:function(e){var r=this,a=r.cy(),n=a.collection(),i=e==null?r.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(f,v){n.merge(f),i.unmerge(f),v.merge(f)};if(i.empty())return r.spawn();var u=function(){var f=a.collection();o.push(f);var v=i[0];s(v,f),r.bfs({directed:!1,roots:v,visit:function(h){return s(h,f)}}),f.forEach(function(c){c.connectedEdges().forEach(function(h){r.has(h)&&f.has(h.source())&&f.has(h.target())&&f.merge(h)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});Lt.componentsOf=Lt.components;var St=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){nt("A collection must have a reference to the core");return}var i=new ir,o=!1;if(!r)r=[];else if(r.length>0&&$e(r[0])&&!nn(r[0])){o=!0;for(var s=[],u=new xa,l=0,f=r.length;l<f;l++){var v=r[l];v.data==null&&(v.data={});var c=v.data;if(c.id==null)c.id=vv();else if(e.hasElementWithId(c.id)||u.has(c.id))continue;var h=new fi(e,v,!1);s.push(h),u.add(c.id)}r=s}this.length=0;for(var d=0,g=r.length;d<g;d++){var m=r[d][0];if(m!=null){var p=m._private.data.id;(!a||!i.has(p))&&(a&&i.set(p,{index:this.length,ele:m}),this[this.length]=m,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(y){this.lazyMap=y},rebuildMap:function(){for(var b=this.lazyMap=new ir,E=this.eles,C=0;C<E.length;C++){var A=E[C];b.set(A.id(),{index:C,ele:A})}}},a&&(this._private.map=i),o&&!n&&this.restore()},rt=fi.prototype=St.prototype=Object.create(Array.prototype);rt.instanceString=function(){return"collection"};rt.spawn=function(t,e){return new St(this.cy(),t,e)};rt.spawnSelf=function(){return this.spawn(this)};rt.cy=function(){return this._private.cy};rt.renderer=function(){return this._private.cy.renderer()};rt.element=function(){return this[0]};rt.collection=function(){return Qf(this)?this:new St(this._private.cy,[this])};rt.unique=function(){return new St(this._private.cy,this,!0)};rt.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};rt.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new St(e)};rt.$id=rt.getElementById;rt.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};rt.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};rt.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};rt.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if($e(t)){if(r.startBatch(),t.data){e.data(t.data);var n=a.data;if(e.isEdge()){var i=!1,o={},s=t.data.source,u=t.data.target;s!=null&&s!=n.source&&(o.source=""+s,i=!0),u!=null&&u!=n.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var l="parent"in t.data,f=t.data.parent;l&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}t.position&&e.position(t.position);var v=function(g,m,p){var y=t[g];y!=null&&y!==a[g]&&(y?e[m]():e[p]())};return v("removed","remove","restore"),v("selected","select","unselect"),v("selectable","selectify","unselectify"),v("locked","lock","unlock"),v("grabbable","grabify","ungrabify"),v("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var c={data:jt(a.data),position:jt(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};c.classes="";var h=0;return a.classes.forEach(function(d){return c.classes+=h++===0?d:" "+d}),c}}};rt.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t};rt.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],n=a.json(),i=new fi(t,n,!1);e.push(i)}return new St(t,e)};rt.copy=rt.clone;rt.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],o=[],s,u=0,l=r.length;u<l;u++){var f=r[u];e&&!f.removed()||(f.isNode()?i.push(f):o.push(f))}s=i.concat(o);var v,c=function(){s.splice(v,1),v--};for(v=0;v<s.length;v++){var h=s[v],d=h._private,g=d.data;if(h.clearTraversalCache(),!(!e&&!d.removed)){if(g.id===void 0)g.id=vv();else if(we(g.id))g.id=""+g.id;else if(xr(g.id)||!Le(g.id)){nt("Can not create element with invalid string ID `"+g.id+"`"),c();continue}else if(a.hasElementWithId(g.id)){nt("Can not create second element with ID `"+g.id+"`"),c();continue}}var m=g.id;if(h.isNode()){var p=d.position;p.x==null&&(p.x=0),p.y==null&&(p.y=0)}if(h.isEdge()){for(var y=h,b=["source","target"],E=b.length,C=!1,A=0;A<E;A++){var D=b[A],N=g[D];we(N)&&(N=g[D]=""+g[D]),N==null||N===""?(nt("Can not create edge `"+m+"` with unspecified "+D),C=!0):a.hasElementWithId(N)||(nt("Can not create edge `"+m+"` with nonexistent "+D+" `"+N+"`"),C=!0)}if(C){c();continue}var O=a.getElementById(g.source),R=a.getElementById(g.target);O.same(R)?O._private.edges.push(y):(O._private.edges.push(y),R._private.edges.push(y)),y._private.source=O,y._private.target=R}d.map=new ir,d.map.set(m,{ele:h,index:0}),d.removed=!1,e&&a.addToPool(h)}for(var P=0;P<i.length;P++){var w=i[P],x=w._private.data;we(x.parent)&&(x.parent=""+x.parent);var T=x.parent,M=T!=null;if(M||w._private.parent){var S=w._private.parent?a.collection().merge(w._private.parent):a.getElementById(T);if(S.empty())x.parent=void 0;else if(S[0].removed())Qe("Node added with missing parent, reference to parent removed"),x.parent=void 0,w._private.parent=null;else{for(var I=!1,B=S;!B.empty();){if(w.same(B)){I=!0,x.parent=void 0;break}B=B.parent()}I||(S[0]._private.children.push(w),w._private.parent=S[0],n.hasCompoundNodes=!0)}}}if(s.length>0){for(var V=s.length===r.length?r:new St(a,s),F=0;F<V.length;F++){var k=V[F];k.isNode()||(k.parallelEdges().clearTraversalCache(),k.source().clearTraversalCache(),k.target().clearTraversalCache())}var U;n.hasCompoundNodes?U=a.collection().merge(V).merge(V.connectedNodes()).merge(V.parent()):U=V,U.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?V.emitAndNotify("add"):e&&V.emit("add")}return r};rt.removed=function(){var t=this[0];return t&&t._private.removed};rt.inside=function(){var t=this[0];return t&&!t._private.removed};rt.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function o(T){for(var M=T._private.edges,S=0;S<M.length;S++)u(M[S])}function s(T){for(var M=T._private.children,S=0;S<M.length;S++)u(M[S])}function u(T){var M=n[T.id()];e&&T.removed()||M||(n[T.id()]=!0,T.isNode()?(a.push(T),o(T),s(T)):a.unshift(T))}for(var l=0,f=r.length;l<f;l++){var v=r[l];u(v)}function c(T,M){var S=T._private.edges;Tr(S,M),T.clearTraversalCache()}function h(T){T.clearTraversalCache()}var d=[];d.ids={};function g(T,M){M=M[0],T=T[0];var S=T._private.children,I=T.id();Tr(S,M),M._private.parent=null,d.ids[I]||(d.ids[I]=!0,d.push(T))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var m=0;m<a.length;m++){var p=a[m];if(p.isEdge()){var y=p.source()[0],b=p.target()[0];c(y,p),c(b,p);for(var E=p.parallelEdges(),C=0;C<E.length;C++){var A=E[C];h(A),A.isBundledBezier()&&A.dirtyBoundingBoxCache()}}else{var D=p.parent();D.length!==0&&g(D,p)}e&&(p._private.removed=!0)}var N=i._private.elements;i._private.hasCompoundNodes=!1;for(var O=0;O<N.length;O++){var R=N[O];if(R.isParent()){i._private.hasCompoundNodes=!0;break}}var P=new St(this.cy(),a);P.size()>0&&(t?P.emitAndNotify("remove"):e&&P.emit("remove"));for(var w=0;w<d.length;w++){var x=d[w];(!e||!x.removed())&&x.updateStyle()}return P};rt.move=function(t){var e=this._private.cy,r=this,a=!1,n=!1,i=function(d){return d==null?d:""+d};if(t.source!==void 0||t.target!==void 0){var o=i(t.source),s=i(t.target),u=o!=null&&e.hasElementWithId(o),l=s!=null&&e.hasElementWithId(s);(u||l)&&(e.batch(function(){r.remove(a,n),r.emitAndNotify("moveout");for(var h=0;h<r.length;h++){var d=r[h],g=d._private.data;d.isEdge()&&(u&&(g.source=o),l&&(g.target=s))}r.restore(a,n)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var f=i(t.parent),v=f===null||e.hasElementWithId(f);if(v){var c=f===null?void 0:f;e.batch(function(){var h=r.remove(a,n);h.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var g=r[d],m=g._private.data;g.isNode()&&(m.parent=c)}h.restore(a,n)}),r.emitAndNotify("move")}}return this};[Tv,Op,Gn,wr,ba,_p,yi,cy,Kv,_v,yy,ti,Un,Ct,Er,Lt].forEach(function(t){Re(rt,t)});var Cy={add:function(e){var r,a=this;if(Gt(e)){var n=e;if(n._private.cy===a)r=n.restore();else{for(var i=[],o=0;o<n.length;o++){var s=n[o];i.push(s.json())}r=new St(a,i)}}else if(et(e)){var u=e;r=new St(a,u)}else if($e(e)&&(et(e.nodes)||et(e.edges))){for(var l=e,f=[],v=["nodes","edges"],c=0,h=v.length;c<h;c++){var d=v[c],g=l[d];if(et(g))for(var m=0,p=g.length;m<p;m++){var y=Re({group:d},g[m]);f.push(y)}}r=new St(a,f)}else{var b=e;r=new fi(a,b).collection()}return r},remove:function(e){if(!Gt(e)){if(Le(e)){var r=e;e=this.$(r)}}return e.remove()}};function Sy(t,e,r,a){var n=4,i=.001,o=1e-7,s=10,u=11,l=1/(u-1),f=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var v=0;v<4;++v)if(typeof arguments[v]!="number"||isNaN(arguments[v])||!isFinite(arguments[v]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var c=f?new Float32Array(u):new Array(u);function h(R,P){return 1-3*P+3*R}function d(R,P){return 3*P-6*R}function g(R){return 3*R}function m(R,P,w){return((h(P,w)*R+d(P,w))*R+g(P))*R}function p(R,P,w){return 3*h(P,w)*R*R+2*d(P,w)*R+g(P)}function y(R,P){for(var w=0;w<n;++w){var x=p(P,t,r);if(x===0)return P;var T=m(P,t,r)-R;P-=T/x}return P}function b(){for(var R=0;R<u;++R)c[R]=m(R*l,t,r)}function E(R,P,w){var x,T,M=0;do T=P+(w-P)/2,x=m(T,t,r)-R,x>0?w=T:P=T;while(Math.abs(x)>o&&++M<s);return T}function C(R){for(var P=0,w=1,x=u-1;w!==x&&c[w]<=R;++w)P+=l;--w;var T=(R-c[w])/(c[w+1]-c[w]),M=P+T*l,S=p(M,t,r);return S>=i?y(R,M):S===0?M:E(R,P,P+l)}var A=!1;function D(){A=!0,(t!==e||r!==a)&&b()}var N=function(P){return A||D(),t===e&&r===a?P:P===0?0:P===1?1:m(C(P),e,a)};N.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var O="generateBezier("+[t,e,r,a]+")";return N.toString=function(){return O},N}var Dy=(function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var o={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:o.v,dv:t(o)}}function r(a,n){var i={dx:a.v,dv:t(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),u=e(a,n,s),l=1/6*(i.dx+2*(o.dx+s.dx)+u.dx),f=1/6*(i.dv+2*(o.dv+s.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+f*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,v=16/1e3,c,h,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,o=o||null,s.tension=n,s.friction=i,c=o!==null,c?(l=a(n,i),h=l/o*v):h=v;d=r(d||s,h),u.push(1+d.x),l+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return c?function(g){return u[g*(u.length-1)|0]}:l}})(),tt=function(e,r,a,n){var i=Sy(e,r,a,n);return function(o,s,u){return o+(s-o)*i(u)}},Hn={linear:function(e,r,a){return e+(r-e)*a},ease:tt(.25,.1,.25,1),"ease-in":tt(.42,0,1,1),"ease-out":tt(0,0,.58,1),"ease-in-out":tt(.42,0,.58,1),"ease-in-sine":tt(.47,0,.745,.715),"ease-out-sine":tt(.39,.575,.565,1),"ease-in-out-sine":tt(.445,.05,.55,.95),"ease-in-quad":tt(.55,.085,.68,.53),"ease-out-quad":tt(.25,.46,.45,.94),"ease-in-out-quad":tt(.455,.03,.515,.955),"ease-in-cubic":tt(.55,.055,.675,.19),"ease-out-cubic":tt(.215,.61,.355,1),"ease-in-out-cubic":tt(.645,.045,.355,1),"ease-in-quart":tt(.895,.03,.685,.22),"ease-out-quart":tt(.165,.84,.44,1),"ease-in-out-quart":tt(.77,0,.175,1),"ease-in-quint":tt(.755,.05,.855,.06),"ease-out-quint":tt(.23,1,.32,1),"ease-in-out-quint":tt(.86,0,.07,1),"ease-in-expo":tt(.95,.05,.795,.035),"ease-out-expo":tt(.19,1,.22,1),"ease-in-out-expo":tt(1,0,0,1),"ease-in-circ":tt(.6,.04,.98,.335),"ease-out-circ":tt(.075,.82,.165,1),"ease-in-out-circ":tt(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return Hn.linear;var n=Dy(e,r,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":tt};function yf(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function mf(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function na(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var o=mf(t,n),s=mf(e,n);if(we(o)&&we(s))return yf(i,o,s,r,a);if(et(o)&&et(s)){for(var u=[],l=0;l<s.length;l++){var f=o[l],v=s[l];if(f!=null&&v!=null){var c=yf(i,f,v,r,a);u.push(c)}else u.push(v)}return u}}function Ay(t,e,r,a){var n=!a,i=t._private,o=e._private,s=o.easing,u=o.startTime,l=a?t:t.cy(),f=l.style();if(!o.easingImpl)if(s==null)o.easingImpl=Hn.linear;else{var v;if(Le(s)){var c=f.parse("transition-timing-function",s);v=c.value}else v=s;var h,d;Le(v)?(h=v,d=[]):(h=v[1],d=v.slice(2).map(function(V){return+V})),d.length>0?(h==="spring"&&d.push(o.duration),o.easingImpl=Hn[h].apply(null,d)):o.easingImpl=Hn[h]}var g=o.easingImpl,m;if(o.duration===0?m=1:m=(r-u)/o.duration,o.applying&&(m=o.progress),m<0?m=0:m>1&&(m=1),o.delay==null){var p=o.startPosition,y=o.position;if(y&&n&&!t.locked()){var b={};Fa(p.x,y.x)&&(b.x=na(p.x,y.x,m,g)),Fa(p.y,y.y)&&(b.y=na(p.y,y.y,m,g)),t.position(b)}var E=o.startPan,C=o.pan,A=i.pan,D=C!=null&&a;D&&(Fa(E.x,C.x)&&(A.x=na(E.x,C.x,m,g)),Fa(E.y,C.y)&&(A.y=na(E.y,C.y,m,g)),t.emit("pan"));var N=o.startZoom,O=o.zoom,R=O!=null&&a;R&&(Fa(N,O)&&(i.zoom=Za(i.minZoom,na(N,O,m,g),i.maxZoom)),t.emit("zoom")),(D||R)&&t.emit("viewport");var P=o.style;if(P&&P.length>0&&n){for(var w=0;w<P.length;w++){var x=P[w],T=x.name,M=x,S=o.startStyle[T],I=f.properties[S.name],B=na(S,M,m,g,I);f.overrideBypass(t,T,B)}t.emit("style")}}return o.progress=m,m}function Fa(t,e){return t==null||e==null?!1:we(t)&&we(e)?!0:!!(t&&e)}function My(t,e,r,a){var n=e._private;n.started=!0,n.startTime=r-n.progress*n.duration}function bf(t,e){var r=e._private.aniEles,a=[];function n(f,v){var c=f._private,h=c.animation.current,d=c.animation.queue,g=!1;if(h.length===0){var m=d.shift();m&&h.push(m)}for(var p=function(A){for(var D=A.length-1;D>=0;D--){var N=A[D];N()}A.splice(0,A.length)},y=h.length-1;y>=0;y--){var b=h[y],E=b._private;if(E.stopped){h.splice(y,1),E.hooked=!1,E.playing=!1,E.started=!1,p(E.frames);continue}!E.playing&&!E.applying||(E.playing&&E.applying&&(E.applying=!1),E.started||My(f,b,t),Ay(f,b,t,v),E.applying&&(E.applying=!1),p(E.frames),E.step!=null&&E.step(t),b.completed()&&(h.splice(y,1),E.hooked=!1,E.playing=!1,E.started=!1,p(E.completes)),g=!0)}return!v&&h.length===0&&d.length===0&&a.push(f),g}for(var i=!1,o=0;o<r.length;o++){var s=r[o],u=n(s);i=i||u}var l=n(e,!0);(i||l)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var Ly={animate:Ze.animate(),animation:Ze.animation(),animated:Ze.animated(),clearQueue:Ze.clearQueue(),delay:Ze.delay(),delayAnimation:Ze.delayAnimation(),stop:Ze.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&Zn(function(i){bf(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){bf(o,e)},a.beforeRenderPriorities.animations):r()}},Ny={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&nn(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},On=function(e){return Le(e)?new Sr(e):e},Jv={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new mi(Ny,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,On(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,On(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,On(r),a),this},once:function(e,r,a){return this.emitter().one(e,On(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Ze.eventAliasesOn(Jv);var bs={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};bs.jpeg=bs.jpg;var qn={layout:function(e){var r=this;if(e==null){nt("Layout options must be specified to make a layout");return}if(e.name==null){nt("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){nt("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;Le(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var o=new n(Re({},e,{cy:r,eles:i}));return o}};qn.createLayout=qn.makeLayout=qn.layout;var Ry={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],o=e[i],s=r.getElementById(i);s.data(o)}})}},Py=Dt({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),ws={renderTo:function(e,r,a,n){var i=this._private.renderer;return i.renderTo(e,r,a,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var r=this,a=r.extension("renderer",e.name);if(a==null){nt("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Qe("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=Py(e);n.cy=r,r._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};ws.invalidateDimensions=ws.resize;var Yn={collection:function(e,r){return Le(e)?this.$(e):Gt(e)?e.collection():et(e)?(r||(r={}),new St(this,e,r.unique,r.removed)):new St(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};Yn.elements=Yn.filter=Yn.$;var Tt={},Ya="t",Oy="f";Tt.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i<t.length;i++){var o=t[i],s=e.getContextMeta(o);if(!s.empty){var u=e.getContextStyle(s),l=e.applyContextStyle(s,u,o);o._private.appliedInitStyle?e.updateTransitions(o,l.diffProps):o._private.appliedInitStyle=!0;var f=e.updateStyleHints(o);f&&n.push(o)}}return n};Tt.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},n=t+"-"+e,i=a[n];if(i)return i;for(var o=[],s={},u=0;u<r.length;u++){var l=r[u],f=t[u]===Ya,v=e[u]===Ya,c=f!==v,h=l.mappedProperties.length>0;if(c||v&&h){var d=void 0;c&&h||c?d=l.properties:h&&(d=l.mappedProperties);for(var g=0;g<d.length;g++){for(var m=d[g],p=m.name,y=!1,b=u+1;b<r.length;b++){var E=r[b],C=e[b]===Ya;if(C&&(y=E.properties[m.name]!=null,y))break}!s[p]&&!y&&(s[p]=!0,o.push(p))}}}return a[n]=o,o};Tt.getContextMeta=function(t){for(var e=this,r="",a,n=t._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],s=o.selector&&o.selector.matches(t);s?r+=Ya:r+=Oy}return a=e.getPropertiesDiff(n,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};Tt.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<r.length;i++){var o=r[i],s=e[i]===Ya;if(s)for(var u=0;u<o.properties.length;u++){var l=o.properties[u];n[l.name]=l}}return a[e]=n,n};Tt.applyContextStyle=function(t,e,r){for(var a=this,n=t.diffPropNames,i={},o=a.types,s=0;s<n.length;s++){var u=n[s],l=e[u],f=r.pstyle(u);if(!l)if(f)f.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(f!==l){if(l.mapped===o.fn&&f!=null&&f.mapping!=null&&f.mapping.value===l.value){var v=f.mapping,c=v.fnValue=l.value(r);if(c===v.prevFnValue)continue}var h=i[u]={prev:f};a.applyParsedProperty(r,l),h.next=r.pstyle(u),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}};Tt.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,n=r.propertyGroupKeys,i=function(ee,ne,te){return r.getPropertiesHash(ee,ne,te)},o=e.styleKey;if(t.removed())return!1;var s=e.group==="nodes",u=t._private.style;a=Object.keys(u);for(var l=0;l<n.length;l++){var f=n[l];e.styleKeys[f]=[Hr,ua]}for(var v=function(ee,ne){return e.styleKeys[ne][0]=$a(ee,e.styleKeys[ne][0])},c=function(ee,ne){return e.styleKeys[ne][1]=Ka(ee,e.styleKeys[ne][1])},h=function(ee,ne){v(ee,ne),c(ee,ne)},d=function(ee,ne){for(var te=0;te<ee.length;te++){var be=ee.charCodeAt(te);v(be,ne),c(be,ne)}},g=2e9,m=function(ee){return-128<ee&&ee<128&&Math.floor(ee)!==ee?g-(ee*1024|0):ee},p=0;p<a.length;p++){var y=a[p],b=u[y];if(b!=null){var E=this.properties[y],C=E.type,A=E.groupKey,D=void 0;E.hashOverride!=null?D=E.hashOverride(t,b):b.pfValue!=null&&(D=b.pfValue);var N=E.enums==null?b.value:null,O=D!=null,R=N!=null,P=O||R,w=b.units;if(C.number&&P&&!C.multiple){var x=O?D:N;h(m(x),A),!O&&w!=null&&d(w,A)}else d(b.strValue,A)}}for(var T=[Hr,ua],M=0;M<n.length;M++){var S=n[M],I=e.styleKeys[S];T[0]=$a(I[0],T[0]),T[1]=Ka(I[1],T[1])}e.styleKey=Kh(T[0],T[1]);var B=e.styleKeys;e.labelDimsKey=dr(B.labelDimensions);var V=i(t,["label"],B.labelDimensions);if(e.labelKey=dr(V),e.labelStyleKey=dr(Sn(B.commonLabel,V)),!s){var F=i(t,["source-label"],B.labelDimensions);e.sourceLabelKey=dr(F),e.sourceLabelStyleKey=dr(Sn(B.commonLabel,F));var k=i(t,["target-label"],B.labelDimensions);e.targetLabelKey=dr(k),e.targetLabelStyleKey=dr(Sn(B.commonLabel,k))}if(s){var U=e.styleKeys,J=U.nodeBody,W=U.nodeBorder,Q=U.nodeOutline,Z=U.backgroundImage,H=U.compound,j=U.pie,$=U.stripe,q=[J,W,Q,Z,H,j,$].filter(function(K){return K!=null}).reduce(Sn,[Hr,ua]);e.nodeKey=dr(q),e.hasPie=j!=null&&j[0]!==Hr&&j[1]!==ua,e.hasStripe=$!=null&&$[0]!==Hr&&$[1]!==ua}return o!==e.styleKey};Tt.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};Tt.applyParsedProperty=function(t,e){var r=this,a=e,n=t._private.style,i,o=r.types,s=r.properties[a.name].type,u=a.bypass,l=n[a.name],f=l&&l.bypass,v=t._private,c="mapping",h=function(J){return J==null?null:J.pfValue!=null?J.pfValue:J.value},d=function(){var J=h(l),W=h(a);r.checkTriggers(t,a.name,J,W)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",u)),a.delete)return n[a.name]=void 0,d(),!0;if(a.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,d(),!0):!1:(d(),!0);if(a.deleteBypass)return l?l.bypass?(n[a.name]=l.bypassed,d(),!0):!1:(d(),!0);var g=function(){Qe("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:{for(var m=a.field.split("."),p=v.data,y=0;y<m.length&&p;y++){var b=m[y];p=p[b]}if(p==null)return g(),!1;var E;if(we(p)){var C=a.fieldMax-a.fieldMin;C===0?E=0:E=(p-a.fieldMin)/C}else return Qe("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+p+"` for `"+t.id()+"` is non-numeric)"),!1;if(E<0?E=0:E>1&&(E=1),s.color){var A=a.valueMin[0],D=a.valueMax[0],N=a.valueMin[1],O=a.valueMax[1],R=a.valueMin[2],P=a.valueMax[2],w=a.valueMin[3]==null?1:a.valueMin[3],x=a.valueMax[3]==null?1:a.valueMax[3],T=[Math.round(A+(D-A)*E),Math.round(N+(O-N)*E),Math.round(R+(P-R)*E),Math.round(w+(x-w)*E)];i={bypass:a.bypass,name:a.name,value:T,strValue:"rgb("+T[0]+", "+T[1]+", "+T[2]+")"}}else if(s.number){var M=a.valueMin+(a.valueMax-a.valueMin)*E;i=this.parse(a.name,M,a.bypass,c)}else return!1;if(!i)return g(),!1;i.mapping=a,a=i;break}case o.data:{for(var S=a.field.split("."),I=v.data,B=0;B<S.length&&I;B++){var V=S[B];I=I[V]}if(I!=null&&(i=this.parse(a.name,I,a.bypass,c)),!i)return g(),!1;i.mapping=a,a=i;break}case o.fn:{var F=a.value,k=a.fnValue!=null?a.fnValue:F(t);if(a.prevFnValue=k,k==null)return Qe("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(a.name,k,a.bypass,c),!i)return Qe("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=jt(a),a=i;break}case void 0:break;default:return!1}return u?(f?a.bypassed=l.bypassed:a.bypassed=l,n[a.name]=a):f?l.bypassed=a:n[a.name]=a,d(),!0};Tt.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],u=n[s];u!=null&&(u.bypass?u.bypassed=null:n[s]=null)}}};Tt.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};Tt.updateTransitions=function(t,e){var r=this,a=t._private,n=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var s={},u=!1,l=0;l<n.length;l++){var f=n[l],v=t.pstyle(f),c=e[f];if(c){var h=c.prev,d=h,g=c.next!=null?c.next:v,m=!1,p=void 0,y=1e-6;d&&(we(d.pfValue)&&we(g.pfValue)?(m=g.pfValue-d.pfValue,p=d.pfValue+y*m):we(d.value)&&we(g.value)?(m=g.value-d.value,p=d.value+y*m):et(d.value)&&et(g.value)&&(m=d.value[0]!==g.value[0]||d.value[1]!==g.value[1]||d.value[2]!==g.value[2],p=d.strValue),m&&(s[f]=g.strValue,this.applyBypass(t,f,p),u=!0))}}if(!u)return;a.transitioning=!0,new Ta(function(b){o>0?t.delayAnimation(o).play().promise().then(b):b()}).then(function(){return t.animation({style:s,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)};Tt.checkTrigger=function(t,e,r,a,n,i){var o=this.properties[e],s=n(o);t.removed()||s!=null&&s(r,a,t)&&i(o)};Tt.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})};Tt.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};Tt.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};Tt.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){t.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};Tt.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a),this.checkConnectedEdgesBoundsTrigger(t,e,r,a),this.checkParallelEdgesBoundsTrigger(t,e,r,a)};var cn={};cn.applyBypass=function(t,e,r,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var s=0;s<n.properties.length;s++){var u=n.properties[s],l=u.name,f=this.parse(l,r,!0);f&&i.push(f)}}else if(Le(e)){var v=this.parse(e,r,!0);v&&i.push(v)}else if($e(e)){var c=e;a=r;for(var h=Object.keys(c),d=0;d<h.length;d++){var g=h[d],m=c[g];if(m===void 0&&(m=c[li(g)]),m!==void 0){var p=this.parse(g,m,!0);p&&i.push(p)}}}else return!1;if(i.length===0)return!1;for(var y=!1,b=0;b<t.length;b++){for(var E=t[b],C={},A=void 0,D=0;D<i.length;D++){var N=i[D];if(a){var O=E.pstyle(N.name);A=C[N.name]={prev:O}}y=this.applyParsedProperty(E,jt(N))||y,a&&(A.next=E.pstyle(N.name))}y&&this.updateStyleHints(E),a&&this.updateTransitions(E,C,o)}return y};cn.overrideBypass=function(t,e,r){e=Ps(e);for(var a=0;a<t.length;a++){var n=t[a],i=n._private.style[e],o=this.properties[e].type,s=o.color,u=o.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),s?i.strValue="rgb("+r.join(",")+")":u?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(n)),this.checkTriggers(n,e,l,r)}};cn.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};cn.removeBypasses=function(t,e,r){for(var a=!0,n=0;n<t.length;n++){for(var i=t[n],o={},s=0;s<e.length;s++){var u=e[s],l=this.properties[u],f=i.pstyle(l.name);if(!(!f||!f.bypass)){var v="",c=this.parse(u,v,!0),h=o[l.name]={prev:f};this.applyParsedProperty(i,c),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,o,a)}};var $s={};$s.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};$s.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var er={};er.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};er.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},n=0;n<r.properties.length;n++){var i=r.properties[n],o=r.getStylePropertyValue(t,i.name,e);o!=null&&(a[i.name]=o,a[li(i.name)]=o)}return a}};er.getIndexedStyle=function(t,e,r,a){var n=t.pstyle(e)[r][a];return n??t.cy().style().getDefaultProperty(e)[r][0]};er.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,o=t.pstyle(n.name);if(o){var s=o.value,u=o.units,l=o.strValue;if(r&&i.number&&s!=null&&we(s)){var f=t.cy().zoom(),v=function(m){return m*f},c=function(m,p){return v(m)+p},h=et(s),d=h?u.every(function(g){return g!=null}):u!=null;return d?h?s.map(function(g,m){return c(g,u[m])}).join(" "):c(s,u):h?s.map(function(g){return Le(g)?g:""+v(g)}).join(" "):""+v(s)}else if(l!=null)return l}return null}};er.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var n=e[a],i=n.name,o=t.pstyle(i);o!==void 0&&($e(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(r[i]=o)}return r};er.getPropsList=function(t){var e=this,r=[],a=t,n=e.properties;if(a)for(var i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],u=a[s],l=n[s]||n[Ps(s)],f=this.parse(l.name,u);f&&r.push(f)}return r};er.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),n,i,o,s,u,l;for(u=0;u<e.length;u++)if(n=e[u],i=t.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=$a(s,a[0]),a[1]=Ka(s,a[1]);else for(o=i.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),a[0]=$a(s,a[0]),a[1]=Ka(s,a[1]);return a};er.getPropertiesHash=er.getNonDefaultPropertiesHash;var Ei={};Ei.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],n=a.selector,i=a.style||a.css,o=Object.keys(i);e.selector(n);for(var s=0;s<o.length;s++){var u=o[s],l=i[u];e.css(u,l)}}return e};Ei.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};Ei.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,n=r.properties,i={},o=0;o<n.length;o++){var s=n[o];i[s.name]=s.strValue}t.push({selector:a?a.toString():"core",style:i})}return t};var Ks={};Ks.appendFromString=function(t){var e=this,r=this,a=""+t,n,i,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){a.length>n.length?a=a.substr(n.length):a=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var l=a.match(/^\s*$/);if(l)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Qe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var v=f[1];if(v!=="core"){var c=new Sr(v);if(c.invalid){Qe("Skipping parsing of block: Invalid selector found in string stylesheet: "+v),s();continue}}var h=f[2],d=!1;i=h;for(var g=[];;){var m=i.match(/^\s*$/);if(m)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){Qe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}o=p[0];var y=p[1],b=p[2],E=e.properties[y];if(!E){Qe("Skipping property: Invalid property name in: "+o),u();continue}var C=r.parse(y,b);if(!C){Qe("Skipping property: Invalid property definition in: "+o),u();continue}g.push({name:y,val:b}),u()}if(d){s();break}r.selector(v);for(var A=0;A<g.length;A++){var D=g[A];r.css(D.name,D.val)}s()}return r};Ks.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var ht={};(function(){var t=yt,e=Dh,r=Mh,a=Lh,n=Nh,i=function(K){return"^"+K+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(K){var ee=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+n;return"^"+K+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+ee+")\\s*\\,\\s*("+ee+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];ht.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","top-inside","center","bottom","bottom-inside"]},halign:{enums:["left","left-inside","center","right","right-inside"]},justification:{enums:["left","center","right","auto"]},textMetrics:{enums:["font","glyph"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(K,ee){switch(K.length){case 2:return ee[0]!=="deg"&&ee[0]!=="rad"&&ee[1]!=="deg"&&ee[1]!=="rad";case 1:return Le(K[0])||ee[0]==="deg"||ee[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(K){var ee=K.length;return ee===1||ee===2||ee===4}}};var u={zeroNonZero:function(K,ee){return(K==null||ee==null)&&K!==ee||K==0&&ee!=0?!0:K!=0&&ee==0},any:function(K,ee){return K!=ee},emptyNonEmpty:function(K,ee){var ne=xr(K),te=xr(ee);return ne&&!te||!ne&&te}},l=ht.types,f=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],v=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],c=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],h=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],d=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"text-metrics",type:l.textMetrics},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],g=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any},{name:"box-selection",type:l.boxSelection,triggersZOrder:u.any}],m=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(K,ee,ne){return K===ee?!1:ne.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],p=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],y=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],b=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],E=function(K,ee){return ee.value==="label"?-K.poolIndex():ee.pfValue},C=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:E},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:E},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],A=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],D=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],N=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],O=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],R=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(K,ee){return K===ee?!1:K==="bezier"||ee==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],P=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],w=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],x=[];ht.pieBackgroundN=16,x.push({name:"pie-size",type:l.sizeMaybePercent}),x.push({name:"pie-hole",type:l.sizeMaybePercent}),x.push({name:"pie-start-angle",type:l.angle});for(var T=1;T<=ht.pieBackgroundN;T++)x.push({name:"pie-"+T+"-background-color",type:l.color}),x.push({name:"pie-"+T+"-background-size",type:l.percent}),x.push({name:"pie-"+T+"-background-opacity",type:l.zeroOneNumber});var M=[];ht.stripeBackgroundN=16,M.push({name:"stripe-size",type:l.sizeMaybePercent}),M.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var S=1;S<=ht.stripeBackgroundN;S++)M.push({name:"stripe-"+S+"-background-color",type:l.color}),M.push({name:"stripe-"+S+"-background-size",type:l.percent}),M.push({name:"stripe-"+S+"-background-opacity",type:l.zeroOneNumber});var I=[],B=ht.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(q){B.forEach(function(K){var ee=K+"-"+q.name,ne=q.type,te=q.triggersBounds;I.push({name:ee,type:ne,triggersBounds:te})})},{});var V=ht.properties=[].concat(g,b,m,p,y,P,d,h,f,v,c,C,A,D,N,x,M,O,R,I,w),F=ht.propertyGroups={behavior:g,transition:b,visibility:m,overlay:p,underlay:y,ghost:P,commonLabel:d,labelDimensions:h,mainLabel:f,sourceLabel:v,targetLabel:c,nodeBody:C,nodeBorder:A,nodeOutline:D,backgroundImage:N,pie:x,stripe:M,compound:O,edgeLine:R,edgeArrow:I,core:w},k=ht.propertyGroupNames={},U=ht.propertyGroupKeys=Object.keys(F);U.forEach(function(q){k[q]=F[q].map(function(K){return K.name}),F[q].forEach(function(K){return K.groupKey=q})});var J=ht.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];ht.propertyNames=V.map(function(q){return q.name});for(var W=0;W<V.length;W++){var Q=V[W];V[Q.name]=Q}for(var Z=0;Z<J.length;Z++){var H=J[Z],j=V[H.pointsTo],$={name:H.name,alias:!0,pointsTo:j};V.push($),V[H.name]=$}})();ht.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};ht.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=Re({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","text-metrics":"font","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=ht.pieBackgroundN;f++){var v=l.name.replace("{{i}}",f),c=l.value;u[v]=c}return u},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var f=1;f<=ht.stripeBackgroundN;f++){var v=l.name.replace("{{i}}",f),c=l.value;u[v]=c}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return ht.arrowPrefixes.forEach(function(f){var v=f+"-"+l.name,c=l.value;u[v]=c}),u},{})),r={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,o=e[i],s=this.parse(i,o);r[i]=s}}return t.defaultProperties=r,t.defaultProperties};ht.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var xi={};xi.parse=function(t,e,r,a){var n=this;if(ot(e))return n.parseImplWarn(t,e,r,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=r?"t":"f",s=""+e,u=lv(t,s,o,i),l=n.propCache=n.propCache||[],f;return(f=l[u])||(f=l[u]=n.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(f=jt(f),f&&(f.value=jt(f.value))),f};xi.parseImplWarn=function(t,e,r,a){var n=this.parseImpl(t,e,r,a);return!n&&e!=null&&Qe("The style property `".concat(t,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Qe("The style value of `label` is deprecated for `"+n.name+"`"),n};xi.parseImpl=function(t,e,r,a){var n=this;t=Ps(t);var i=n.properties[t],o=e,s=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var u=Le(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(ot(e))return{name:t,value:e,strValue:"fn",mapped:s.fn,bypass:r};var f,v;if(!(!u||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(s.data.regex).exec(e))){if(r)return!1;var c=s.data;return{name:t,value:f,strValue:""+e,mapped:c,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(v=new RegExp(s.mapData.regex).exec(e))){if(r||l.multiple)return!1;var h=s.mapData;if(!(l.color||l.number))return!1;var d=this.parse(t,v[4]);if(!d||d.mapped)return!1;var g=this.parse(t,v[5]);if(!g||g.mapped)return!1;if(d.pfValue===g.pfValue||d.strValue===g.strValue)return Qe("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+d.strValue+"`"),this.parse(t,d.strValue);if(l.color){var m=d.value,p=g.value,y=m[0]===p[0]&&m[1]===p[1]&&m[2]===p[2]&&(m[3]===p[3]||(m[3]==null||m[3]===1)&&(p[3]==null||p[3]===1));if(y)return!1}return{name:t,value:v,strValue:""+e,mapped:h,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:d.value,valueMax:g.value,bypass:r}}}if(l.multiple&&a!=="multiple"){var b;if(u?b=e.split(/\s+/):et(e)?b=e:b=[e],l.evenMultiple&&b.length%2!==0)return null;for(var E=[],C=[],A=[],D="",N=!1,O=0;O<b.length;O++){var R=n.parse(t,b[O],r,"multiple");N=N||Le(R.value),E.push(R.value),A.push(R.pfValue!=null?R.pfValue:R.value),C.push(R.units),D+=(O>0?" ":"")+R.strValue}return l.validate&&!l.validate(E,C)?null:l.singleEnum&&N?E.length===1&&Le(E[0])?{name:t,value:E[0],strValue:E[0],bypass:r}:null:{name:t,value:E,pfValue:A,strValue:D,bypass:r,units:C}}var P=function(){for(var $=0;$<l.enums.length;$++){var q=l.enums[$];if(q===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(l.number){var w,x="px";if(l.units&&(w=l.units),l.implicitUnits&&(x=l.implicitUnits),!l.unitless)if(u){var T="px|em"+(l.allowPercent?"|\\%":"");w&&(T=w);var M=e.match("^("+yt+")("+T+")?$");M&&(e=M[1],w=M[2]||x)}else(!w||l.implicitUnits)&&(w=x);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=o,P();if(l.integer&&!bh(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var S={name:t,value:e,strValue:""+e+(w||""),units:w,bypass:r};return l.unitless||w!=="px"&&w!=="em"?S.pfValue=e:S.pfValue=w==="px"||!w?e:this.getEmSizeInPixels()*e,(w==="ms"||w==="s")&&(S.pfValue=w==="ms"?e:1e3*e),(w==="deg"||w==="rad")&&(S.pfValue=w==="rad"?e:Ld(e)),w==="%"&&(S.pfValue=e/100),S}else if(l.propList){var I=[],B=""+e;if(B!=="none"){for(var V=B.split(/\s*,\s*|\s+/),F=0;F<V.length;F++){var k=V[F].trim();n.properties[k]?I.push(k):Qe("`"+k+"` is not a valid property name")}if(I.length===0)return null}return{name:t,value:I,strValue:I.length===0?"none":I.join(" "),bypass:r}}else if(l.color){var U=tv(e);return U?{name:t,value:U,pfValue:U,strValue:"rgb("+U[0]+","+U[1]+","+U[2]+")",bypass:r}:null}else if(l.regex||l.regexes){if(l.enums){var J=P();if(J)return J}for(var W=l.regexes?l.regexes:[l.regex],Q=0;Q<W.length;Q++){var Z=new RegExp(W[Q]),H=Z.exec(e);if(H)return{name:t,value:l.singleRegexMatchValue?H[1]:H,strValue:""+e,bypass:r}}return null}else return l.string?{name:t,value:""+e,strValue:""+e,bypass:r}:l.enums?P():null};var xt=function(e){if(!(this instanceof xt))return new xt(e);if(!Rs(e)){nt("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Nt=xt.prototype;Nt.instanceString=function(){return"style"};Nt.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};Nt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};Nt.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};Nt.selector=function(t){var e=t==="core"?null:new Sr(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};Nt.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var n=t.properties[a],i=r[n.name];i===void 0&&(i=r[li(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};Nt.style=Nt.css;Nt.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[a].mappedProperties.push(r);var n=!this[a].selector;n&&(this._private.coreStyle[r.name]=r)}return this};Nt.append=function(t){return Jf(t)?t.appendToStyle(this):et(t)?this.appendFromJson(t):Le(t)&&this.appendFromString(t),this};xt.fromJson=function(t,e){var r=new xt(t);return r.fromJson(e),r};xt.fromString=function(t,e){return new xt(t).fromString(e)};[Tt,cn,$s,er,Ei,Ks,ht,xi].forEach(function(t){Re(Nt,t)});xt.types=Nt.types;xt.properties=Nt.properties;xt.propertyGroups=Nt.propertyGroups;xt.propertyGroupNames=Nt.propertyGroupNames;xt.propertyGroupKeys=Nt.propertyGroupKeys;var Iy={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return Jf(e)?r.style=e.generateStyle(this):et(e)?r.style=xt.fromJson(this,e):Le(e)?r.style=xt.fromString(this,e):r.style=xt(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},By="single",Kr={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=By),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,a,n,i,o,s;switch(e.length){case 0:return r;case 1:if(Le(e[0]))return a=e[0],r[a];if($e(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,s=i.y,we(o)&&(r.x=o),we(s)&&(r.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&we(n)&&(r[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,n=this._private.pan,i,o,s,u,l;if(!this._private.panningEnabled)return this;switch(a.length){case 1:$e(e)&&(s=a[0],u=s.x,l=s.y,we(u)&&(n.x+=u),we(l)&&(n.y+=l),this.emit("pan viewport"));break;case 2:i=e,o=r,(i==="x"||i==="y")&&we(o)&&(n[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,r){var a=this.getFitViewport(e,r);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(we(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(Le(e)){var n=e;e=this.$(n)}else if(xh(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else Gt(e)||(e=this.mutableElements());if(!(Gt(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),s=this.height(),u;if(r=we(r)?r:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((o-2*r)/a.w,(s-2*r)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(o-u*(a.x1+a.x2))/2,y:(s-u*(a.y1+a.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var n=e;e=n.min,r=n.max}return we(e)&&we(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):we(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:we(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,n=r.zoom,i,o,s=!1;if(r.zoomingEnabled||(s=!0),we(e)?o=e:$e(e)&&(o=e.level,e.position!=null?i=vi(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(s=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,s||!we(o)||o===n||i!=null&&(!we(i.x)||!we(i.y)))return null;if(i!=null){var u=a,l=n,f=o,v={x:-f/l*(i.x-u.x)+i.x,y:-f/l*(i.y-u.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:v}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,n=!0,i=[],o=!1,s=!1;if(!e)return this;if(we(e.zoom)||(a=!1),$e(e.pan)||(n=!1),!a&&!n)return this;if(a){var u=e.zoom;u<r.minZoom||u>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=u,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var l=e.pan;we(l.x)&&(r.pan.x=l.x,s=!1),we(l.y)&&(r.pan.y=l.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(Le(e)){var a=e;e=this.mutableElements().filter(a)}else Gt(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var s={x:(i-r*(n.x1+n.x2))/2,y:(o-r*(n.y1+n.y2))/2};return s}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?(function(){var n=a.window().getComputedStyle(r),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Kr.centre=Kr.center;Kr.autolockNodes=Kr.autolock;Kr.autoungrabifyNodes=Kr.autoungrabify;var en={data:Ze.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ze.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ze.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ze.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};en.attr=en.data;en.removeAttr=en.removeData;var tn=function(e){var r=this;e=Re({},e);var a=e.container;a&&!_n(a)&&_n(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var o=pt!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=Re({name:o?"grid":"null"},s.layout),s.renderer=Re({name:o?"canvas":"null"},s.renderer);var u=function(d,g,m){return g!==void 0?g:m!==void 0?m:d},l=this._private={container:a,ready:!1,options:s,elements:new St(this),listeners:[],aniEles:new St(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,s.zoomingEnabled),userZoomingEnabled:u(!0,s.userZoomingEnabled),panningEnabled:u(!0,s.panningEnabled),userPanningEnabled:u(!0,s.userPanningEnabled),boxSelectionEnabled:u(!0,s.boxSelectionEnabled),autolock:u(!1,s.autolock,s.autolockNodes),autoungrabify:u(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:u(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:we(s.zoom)?s.zoom:1,pan:{x:$e(s.pan)&&we(s.pan.x)?s.pan.x:0,y:$e(s.pan)&&we(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var f=function(d,g){var m=d.some(Th);if(m)return Ta.all(d).then(g);g(d)};l.styleEnabled&&r.setStyle([]);var v=Re({},s,s.renderer);r.initRenderer(v);var c=function(d,g,m){r.notifications(!1);var p=r.mutableElements();p.length>0&&p.remove(),d!=null&&($e(d)||et(d))&&r.add(d),r.one("layoutready",function(b){r.notifications(!0),r.emit(b),r.one("load",g),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",m),r.emit("done")});var y=Re({},r._private.options.layout);y.eles=r.elements(),r.layout(y).run()};f([s.style,s.elements],function(h){var d=h[0],g=h[1];l.styleEnabled&&r.style().append(d),c(g,function(){r.startAnimationLoop(),l.ready=!0,ot(s.ready)&&r.on("ready",s.ready);for(var m=0;m<i.length;m++){var p=i[m];r.on("ready",p)}n&&(n.readies=[]),r.emit("ready")},s.done)})},ri=tn.prototype;Re(ri,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return pt;var r=this._private.container.ownerDocument;return r===void 0||r==null?pt:r.defaultView||pt},mount:function(e){if(e!=null){var r=this,a=r._private,n=a.options;return!_n(e)&&_n(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(Re({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),r.startAnimationLoop(),r.style(n.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return jt(this._private.options)},json:function(e){var r=this,a=r._private,n=r.mutableElements(),i=function(E){return r.getElementById(E.id())};if($e(e)){if(r.startBatch(),e.elements){var o={},s=function(E,C){for(var A=[],D=[],N=0;N<E.length;N++){var O=E[N];if(!O.data.id){Qe("cy.json() cannot handle elements without an ID attribute");continue}var R=""+O.data.id,P=r.getElementById(R);o[R]=!0,P.length!==0?D.push({ele:P,json:O}):(C&&(O.group=C),A.push(O))}r.add(A);for(var w=0;w<D.length;w++){var x=D[w],T=x.ele,M=x.json;T.json(M)}};if(et(e.elements))s(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var f=u[l],v=e.elements[f];et(v)&&s(v,f)}var c=r.collection();n.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?c.merge(b):b.remove()}),c.forEach(function(b){return b.children().move({parent:null})}),c.forEach(function(b){return i(b).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<h.length;d++){var g=h[d];e[g]!=null&&r[g](e[g])}return r.endBatch(),this}else{var m=!!e,p={};m?p.elements=this.elements().map(function(b){return b.json()}):(p.elements={},n.forEach(function(b){var E=b.group();p.elements[E]||(p.elements[E]=[]),p.elements[E].push(b.json())})),this._private.styleEnabled&&(p.style=r.style().json()),p.data=jt(r.data());var y=a.options;return p.zoomingEnabled=a.zoomingEnabled,p.userZoomingEnabled=a.userZoomingEnabled,p.zoom=a.zoom,p.minZoom=a.minZoom,p.maxZoom=a.maxZoom,p.panningEnabled=a.panningEnabled,p.userPanningEnabled=a.userPanningEnabled,p.pan=jt(a.pan),p.boxSelectionEnabled=a.boxSelectionEnabled,p.renderer=jt(y.renderer),p.hideEdgesOnViewport=y.hideEdgesOnViewport,p.textureOnViewport=y.textureOnViewport,p.wheelSensitivity=y.wheelSensitivity,p.motionBlur=y.motionBlur,p.multiClickDebounceTime=y.multiClickDebounceTime,p}}});ri.$id=ri.getElementById;[Cy,Ly,Jv,bs,qn,Ry,ws,Yn,Iy,Kr,en].forEach(function(t){Re(ri,t)});var ky={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},Fy={maximal:!1,acyclic:!1},ia=function(e){return e.scratch("breadthfirst")},wf=function(e,r){return e.scratch("breadthfirst",r)};function jv(t){this.options=Re({},ky,Fy,t)}jv.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=r.nodes().filter(function(he){return he.isChildless()}),n=r,i=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=!!t.boundingBox,u=Bt(s?t.boundingBox:structuredClone(e.extent())),l;if(Gt(t.roots))l=t.roots;else if(et(t.roots)){for(var f=[],v=0;v<t.roots.length;v++){var c=t.roots[v],h=e.getElementById(c);f.push(h)}l=e.collection(f)}else if(Le(t.roots))l=e.$(t.roots);else if(i)l=a.roots();else{var d=r.components();l=e.collection();for(var g=function(){var se=d[m],pe=se.maxDegree(!1),de=se.filter(function(Ee){return Ee.degree(!1)===pe});l=l.add(de)},m=0;m<d.length;m++)g()}var p=[],y={},b=function(se,pe){p[pe]==null&&(p[pe]=[]);var de=p[pe].length;p[pe].push(se),wf(se,{index:de,depth:pe})},E=function(se,pe){var de=ia(se),Ee=de.depth,xe=de.index;p[Ee][xe]=null,se.isChildless()&&b(se,pe)};n.bfs({roots:l,directed:t.directed,visit:function(se,pe,de,Ee,xe){var De=se[0],Oe=De.id();De.isChildless()&&b(De,xe),y[Oe]=!0}});for(var C=[],A=0;A<a.length;A++){var D=a[A];y[D.id()]||C.push(D)}var N=function(se){for(var pe=p[se],de=0;de<pe.length;de++){var Ee=pe[de];if(Ee==null){pe.splice(de,1),de--;continue}wf(Ee,{depth:se,index:de})}},O=function(se,pe){for(var de=ia(se),Ee=se.incomers().filter(function(Y){return Y.isNode()&&r.has(Y)}),xe=-1,De=se.id(),Oe=0;Oe<Ee.length;Oe++){var Pe=Ee[Oe],Ie=ia(Pe);xe=Math.max(xe,Ie.depth)}if(de.depth<=xe){if(!t.acyclic&&pe[De])return null;var Ne=xe+1;return E(se,Ne),pe[De]=Ne,!0}return!1};if(i&&o){var R=[],P={},w=function(se){return R.push(se)},x=function(){return R.shift()};for(a.forEach(function(he){return R.push(he)});R.length>0;){var T=x(),M=O(T,P);if(M)T.outgoers().filter(function(he){return he.isNode()&&r.has(he)}).forEach(w);else if(M===null){Qe("Detected double maximal shift for node `"+T.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var S=0;if(t.avoidOverlap)for(var I=0;I<a.length;I++){var B=a[I],V=B.layoutDimensions(t),F=V.w,k=V.h;S=Math.max(S,F,k)}var U={},J=function(se){if(U[se.id()])return U[se.id()];for(var pe=ia(se).depth,de=se.neighborhood(),Ee=0,xe=0,De=0;De<de.length;De++){var Oe=de[De];if(!(Oe.isEdge()||Oe.isParent()||!a.has(Oe))){var Pe=ia(Oe);if(Pe!=null){var Ie=Pe.index,Ne=Pe.depth;if(!(Ie==null||Ne==null)){var Y=p[Ne].length;Ne<pe&&(Ee+=Ie/Y,xe++)}}}}return xe=Math.max(1,xe),Ee=Ee/xe,xe===0&&(Ee=0),U[se.id()]=Ee,Ee},W=function(se,pe){var de=J(se),Ee=J(pe),xe=de-Ee;return xe===0?ev(se.id(),pe.id()):xe};t.depthSort!==void 0&&(W=t.depthSort);for(var Q=p.length,Z=0;Z<Q;Z++)p[Z].sort(W),N(Z);for(var H=[],j=0;j<C.length;j++)H.push(C[j]);var $=function(){for(var se=0;se<Q;se++)N(se)};H.length&&(p.unshift(H),Q=p.length,$());for(var q=0,K=0;K<Q;K++)q=Math.max(p[K].length,q);var ee={x:u.x1+u.w/2,y:u.y1+u.h/2},ne=a.reduce(function(he,se){return(function(pe){return{w:he.w===-1?pe.w:(he.w+pe.w)/2,h:he.h===-1?pe.h:(he.h+pe.h)/2}})(se.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),te=Math.max(Q===1?0:s?(u.h-t.padding*2-ne.h)/(Q-1):(u.h-t.padding*2-ne.h)/(Q+1),S),be=p.reduce(function(he,se){return Math.max(he,se.length)},0),Se=function(se){var pe=ia(se),de=pe.depth,Ee=pe.index;if(t.circle){var xe=Math.min(u.w/2/Q,u.h/2/Q);xe=Math.max(xe,S);var De=xe*de+xe-(Q>0&&p[0].length<=3?xe/2:0),Oe=2*Math.PI/p[de].length*Ee;return de===0&&p[0].length===1&&(De=1),{x:ee.x+De*Math.cos(Oe),y:ee.y+De*Math.sin(Oe)}}else{var Pe=p[de].length,Ie=Math.max(Pe===1?0:s?(u.w-t.padding*2-ne.w)/((t.grid?be:Pe)-1):(u.w-t.padding*2-ne.w)/((t.grid?be:Pe)+1),S),Ne={x:ee.x+(Ee+1-(Pe+1)/2)*Ie,y:ee.y+(de+1-(Q+1)/2)*te};return Ne}},ve={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(ve).indexOf(t.direction)===-1&&nt("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(ve).join(", ")));var oe=function(se){return Jh(Se(se),u,ve[t.direction])};return r.nodes().layoutPositions(this,t,oe),this};var zy={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function ec(t){this.options=Re({},zy,t)}ec.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=Bt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,v=0,c=0;c<i.length;c++){var h=i[c],d=h.layoutDimensions(e),g=d.w,m=d.h;v=Math.max(v,g,m)}if(we(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(o.h,o.w)/2-v,i.length>1&&e.avoidOverlap){v*=1.75;var p=Math.cos(l)-Math.cos(0),y=Math.sin(l)-Math.sin(0),b=Math.sqrt(v*v/(p*p+y*y));f=Math.max(b,f)}var E=function(A,D){var N=e.startAngle+D*l*(n?1:-1),O=f*Math.cos(N),R=f*Math.sin(N),P={x:s.x+O,y:s.y+R};return P};return a.nodes().layoutPositions(this,e,E),this};var Vy={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function tc(t){this.options=Re({},Vy,t)}tc.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),o=Bt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,f=0;f<i.length;f++){var v=i[f],c=void 0;c=e.concentric(v),u.push({value:c,node:v}),v._private.scratch.concentric=c}i.updateStyle();for(var h=0;h<i.length;h++){var d=i[h],g=d.layoutDimensions(e);l=Math.max(l,g.w,g.h)}u.sort(function(te,be){return be.value-te.value});for(var m=e.levelWidth(i),p=[[]],y=p[0],b=0;b<u.length;b++){var E=u[b];if(y.length>0){var C=Math.abs(y[0].value-E.value);C>=m&&(y=[],p.push(y))}y.push(E)}var A=l+e.minNodeSpacing;if(!e.avoidOverlap){var D=p.length>0&&p[0].length>1,N=Math.min(o.w,o.h)/2-A,O=N/(p.length+D?1:0);A=Math.min(A,O)}for(var R=0,P=0;P<p.length;P++){var w=p[P],x=e.sweep===void 0?2*Math.PI-2*Math.PI/w.length:e.sweep,T=w.dTheta=x/Math.max(1,w.length-1);if(w.length>1&&e.avoidOverlap){var M=Math.cos(T)-Math.cos(0),S=Math.sin(T)-Math.sin(0),I=Math.sqrt(A*A/(M*M+S*S));R=Math.max(I,R)}w.r=R,R+=A}if(e.equidistant){for(var B=0,V=0,F=0;F<p.length;F++){var k=p[F],U=k.r-V;B=Math.max(B,U)}V=0;for(var J=0;J<p.length;J++){var W=p[J];J===0&&(V=W.r),W.r=V,V+=B}}for(var Q={},Z=0;Z<p.length;Z++)for(var H=p[Z],j=H.dTheta,$=H.r,q=0;q<H.length;q++){var K=H[q],ee=e.startAngle+(r?1:-1)*j*q,ne={x:s.x+$*Math.cos(ee),y:s.y+$*Math.sin(ee)};Q[K.node.id()]=ne}return n.nodes().layoutPositions(this,e,function(te){var be=te.id();return Q[be]}),this};var ts,Gy={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Ti(t){this.options=Re({},Gy,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(n){var i=n.source().data("id"),o=n.target().data("id"),s=e.some(function(l){return l.data("id")===i}),u=e.some(function(l){return l.data("id")===o});return!s||!u});this.options.eles=this.options.eles.not(a)}Ti.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?ts=!0:ts=!1;var a=Uy(e,r,t);ts&&qy(a),t.randomize&&Yy(a);var n=or(),i=function(){Wy(a,e,t),t.fit===!0&&e.fit(t.padding)},o=function(c){return!(r.stopped||c>=t.numIter||(Xy(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},s=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var c=t.eles.nodes(),h=ac(a,t,c);c.layoutPositions(r,t,h)}},u=0,l=!0;if(t.animate===!0){var f=function(){for(var c=0;l&&c<t.refresh;)l=o(u),u++,c++;if(!l)xf(a,t),s();else{var h=or();h-n>=t.animationThreshold&&i(),Zn(f)}};f()}else{for(;l;)l=o(u),u++;xf(a,t),s()}return this};Ti.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Ti.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Uy=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=Bt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=a.eles.components(),l={},f=0;f<u.length;f++)for(var v=u[f],c=0;c<v.length;c++){var h=v[c];l[h.id()]=f}for(var f=0;f<s.nodeSize;f++){var d=i[f],g=d.layoutDimensions(a),m={};m.isLocked=d.locked(),m.id=d.data("id"),m.parentId=d.data("parent"),m.cmptId=l[d.id()],m.children=[],m.positionX=d.position("x"),m.positionY=d.position("y"),m.offsetX=0,m.offsetY=0,m.height=g.w,m.width=g.h,m.maxX=m.positionX+m.width/2,m.minX=m.positionX-m.width/2,m.maxY=m.positionY+m.height/2,m.minY=m.positionY-m.height/2,m.padLeft=parseFloat(d.style("padding")),m.padRight=parseFloat(d.style("padding")),m.padTop=parseFloat(d.style("padding")),m.padBottom=parseFloat(d.style("padding")),m.nodeRepulsion=ot(a.nodeRepulsion)?a.nodeRepulsion(d):a.nodeRepulsion,s.layoutNodes.push(m),s.idToIndex[m.id]=f}for(var p=[],y=0,b=-1,E=[],f=0;f<s.nodeSize;f++){var d=s.layoutNodes[f],C=d.parentId;C!=null?s.layoutNodes[s.idToIndex[C]].children.push(d.id):(p[++b]=d.id,E.push(d.id))}for(s.graphSet.push(E);y<=b;){var A=p[y++],D=s.idToIndex[A],h=s.layoutNodes[D],N=h.children;if(N.length>0){s.graphSet.push(N);for(var f=0;f<N.length;f++)p[++b]=N[f]}}for(var f=0;f<s.graphSet.length;f++)for(var O=s.graphSet[f],c=0;c<O.length;c++){var R=s.idToIndex[O[c]];s.indexToGraph[R]=f}for(var f=0;f<s.edgeSize;f++){var P=n[f],w={};w.id=P.data("id"),w.sourceId=P.data("source"),w.targetId=P.data("target");var x=ot(a.idealEdgeLength)?a.idealEdgeLength(P):a.idealEdgeLength,T=ot(a.edgeElasticity)?a.edgeElasticity(P):a.edgeElasticity,M=s.idToIndex[w.sourceId],S=s.idToIndex[w.targetId],I=s.indexToGraph[M],B=s.indexToGraph[S];if(I!=B){for(var V=Hy(w.sourceId,w.targetId,s),F=s.graphSet[V],k=0,m=s.layoutNodes[M];F.indexOf(m.id)===-1;)m=s.layoutNodes[s.idToIndex[m.parentId]],k++;for(m=s.layoutNodes[S];F.indexOf(m.id)===-1;)m=s.layoutNodes[s.idToIndex[m.parentId]],k++;x*=k*a.nestingFactor}w.idealLength=x,w.elasticity=T,s.layoutEdges.push(w)}return s},Hy=function(e,r,a){var n=rc(e,r,0,a);return 2>n.count?0:n.graph},rc=function(e,r,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:a};for(var o=0,s=0;s<i.length;s++){var u=i[s],l=n.idToIndex[u],f=n.layoutNodes[l].children;if(f.length!==0){var v=n.indexToGraph[n.idToIndex[f[0]]],c=rc(e,r,v,n);if(c.count!==0)if(c.count===1){if(o++,o===2)break}else return c}}return{count:o,graph:a}},qy,Yy=function(e,r){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*a,o.positionY=Math.random()*n)}},ac=function(e,r,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(o){var s=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,s.positionX),i.x2=Math.max(i.x2,s.positionX),i.y1=Math.min(i.y1,s.positionY),i.y2=Math.max(i.y2,s.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,s){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var l=i.w===0?.5:(u.positionX-i.x1)/i.w,f=i.h===0?.5:(u.positionY-i.y1)/i.h;return{x:n.x1+l*n.w,y:n.y1+f*n.h}}else return{x:u.positionX,y:u.positionY}}},Wy=function(e,r,a){var n=a.layout,i=a.eles.nodes(),o=ac(e,a,i);i.positions(o),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},Xy=function(e,r,a){$y(e,r),Zy(e),Qy(e,r),Jy(e),jy(e)},$y=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[n[o]]],u=o+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[n[u]]];Ky(s,l,e,r)}},Ef=function(e){return-e+2*e*Math.random()},Ky=function(e,r,a,n){var i=e.cmptId,o=r.cmptId;if(!(i!==o&&!a.isCompound)){var s=r.positionX-e.positionX,u=r.positionY-e.positionY,l=1;s===0&&u===0&&(s=Ef(l),u=Ef(l));var f=_y(e,r,s,u);if(f>0)var v=n.nodeOverlap*f,c=Math.sqrt(s*s+u*u),h=v*s/c,d=v*u/c;else var g=ai(e,s,u),m=ai(r,-1*s,-1*u),p=m.x-g.x,y=m.y-g.y,b=p*p+y*y,c=Math.sqrt(b),v=(e.nodeRepulsion+r.nodeRepulsion)/b,h=v*p/c,d=v*y/c;e.isLocked||(e.offsetX-=h,e.offsetY-=d),r.isLocked||(r.offsetX+=h,r.offsetY+=d)}},_y=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},ai=function(e,r,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,u=a/r,l=o/s,f={};return r===0&&0<a||r===0&&0>a?(f.x=n,f.y=i+o/2,f):0<r&&-1*l<=u&&u<=l?(f.x=n+s/2,f.y=i+s*a/2/r,f):0>r&&-1*l<=u&&u<=l?(f.x=n-s/2,f.y=i-s*a/2/r,f):0<a&&(u<=-1*l||u>=l)?(f.x=n+o*r/2/a,f.y=i+o/2,f):(0>a&&(u<=-1*l||u>=l)&&(f.x=n-o*r/2/a,f.y=i-o/2),f)},Zy=function(e,r){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],o=e.layoutNodes[i],s=e.idToIndex[n.targetId],u=e.layoutNodes[s],l=u.positionX-o.positionX,f=u.positionY-o.positionY;if(!(l===0&&f===0)){var v=ai(o,l,f),c=ai(u,-1*l,-1*f),h=c.x-v.x,d=c.y-v.y,g=Math.sqrt(h*h+d*d),m=Math.pow(n.idealLength-g,2)/n.elasticity;if(g!==0)var p=m*h/g,y=m*d/g;else var p=0,y=0;o.isLocked||(o.offsetX+=p,o.offsetY+=y),u.isLocked||(u.offsetX-=p,u.offsetY-=y)}}},Qy=function(e,r){if(r.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],o=i.length;if(n===0)var s=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[l.parentId]],s=f.positionX,u=f.positionY;for(var v=0;v<o;v++){var c=e.layoutNodes[e.idToIndex[i[v]]];if(!c.isLocked){var h=s-c.positionX,d=u-c.positionY,g=Math.sqrt(h*h+d*d);if(g>a){var m=r.gravity*h/g,p=r.gravity*d/g;c.offsetX+=m,c.offsetY+=p}}}}},Jy=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var o=a[n++],s=e.idToIndex[o],u=e.layoutNodes[s],l=u.children;if(0<l.length&&!u.isLocked){for(var f=u.offsetX,v=u.offsetY,c=0;c<l.length;c++){var h=e.layoutNodes[e.idToIndex[l[c]]];h.offsetX+=f,h.offsetY+=v,a[++i]=l[c]}u.offsetX=0,u.offsetY=0}}},jy=function(e,r){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=em(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,nc(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},em=function(e,r,a){var n=Math.sqrt(e*e+r*r);if(n>a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},nc=function(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return nc(n,r)}},xf=function(e,r){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var o=a[i],s=o.cmptId,u=n[s]=n[s]||[];u.push(o)}for(var l=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var v=0;v<f.length;v++){var c=f[v];f.x1=Math.min(f.x1,c.positionX-c.width/2),f.x2=Math.max(f.x2,c.positionX+c.width/2),f.y1=Math.min(f.y1,c.positionY-c.height/2),f.y2=Math.max(f.y2,c.positionY+c.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,l+=f.w*f.h}}n.sort(function(y,b){return b.w*b.h-y.w*y.h});for(var h=0,d=0,g=0,m=0,p=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var v=0;v<f.length;v++){var c=f[v];c.isLocked||(c.positionX+=h-f.x1,c.positionY+=d-f.y1)}h+=f.w+r.componentSpacing,g+=f.w+r.componentSpacing,m=Math.max(m,f.h),g>p&&(d+=m+r.componentSpacing,h=0,g=0,m=0)}}},tm={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function ic(t){this.options=Re({},tm,t)}ic.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=Bt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(J){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),f=function(W){if(W==null)return Math.min(u,l);var Q=Math.min(u,l);Q==u?u=W:l=W},v=function(W){if(W==null)return Math.max(u,l);var Q=Math.max(u,l);Q==u?u=W:l=W},c=e.rows,h=e.cols!=null?e.cols:e.columns;if(c!=null&&h!=null)u=c,l=h;else if(c!=null&&h==null)u=c,l=Math.ceil(o/u);else if(c==null&&h!=null)l=h,u=Math.ceil(o/l);else if(l*u>o){var d=f(),g=v();(d-1)*g>=o?f(d-1):(g-1)*d>=o&&v(g-1)}else for(;l*u<o;){var m=f(),p=v();(p+1)*m>=o?v(p+1):f(m+1)}var y=i.w/l,b=i.h/u;if(e.condense&&(y=0,b=0),e.avoidOverlap)for(var E=0;E<n.length;E++){var C=n[E],A=C._private.position;(A.x==null||A.y==null)&&(A.x=0,A.y=0);var D=C.layoutDimensions(e),N=e.avoidOverlapPadding,O=D.w+N,R=D.h+N;y=Math.max(y,O),b=Math.max(b,R)}for(var P={},w=function(W,Q){return!!P["c-"+W+"-"+Q]},x=function(W,Q){P["c-"+W+"-"+Q]=!0},T=0,M=0,S=function(){M++,M>=l&&(M=0,T++)},I={},B=0;B<n.length;B++){var V=n[B],F=e.position(V);if(F&&(F.row!==void 0||F.col!==void 0)){var k={row:F.row,col:F.col};if(k.col===void 0)for(k.col=0;w(k.row,k.col);)k.col++;else if(k.row===void 0)for(k.row=0;w(k.row,k.col);)k.row++;I[V.id()]=k,x(k.row,k.col)}}var U=function(W,Q){var Z,H;if(W.locked()||W.isParent())return!1;var j=I[W.id()];if(j)Z=j.col*y+y/2+i.x1,H=j.row*b+b/2+i.y1;else{for(;w(T,M);)S();Z=M*y+y/2+i.x1,H=T*b+b/2+i.y1,x(T,M),S()}return{x:Z,y:H}};n.layoutPositions(this,e,U)}return this};var rm={ready:function(){},stop:function(){}};function _s(t){this.options=Re({},rm,t)}_s.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this};_s.prototype.stop=function(){return this};var am={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function oc(t){this.options=Re({},am,t)}oc.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=ot(t.positions);function n(i){if(t.positions==null)return Cd(i.position());if(a)return t.positions(i);var o=t.positions[i._private.data.id];return o??null}return r.layoutPositions(this,t,function(i,o){var s=n(i);return i.locked()||s==null?!1:s}),this};var nm={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function sc(t){this.options=Re({},nm,t)}sc.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=Bt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(o,s){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,n),this};var im=[{name:"breadthfirst",impl:jv},{name:"circle",impl:ec},{name:"concentric",impl:tc},{name:"cose",impl:Ti},{name:"grid",impl:ic},{name:"null",impl:_s},{name:"preset",impl:oc},{name:"random",impl:sc}];function lc(t){this.options=t,this.notifications=0}var Tf=function(){},Cf=function(){throw new Error("A headless instance can not render images")};lc.prototype={recalculateRenderedStyle:Tf,notify:function(){this.notifications++},init:Tf,isHeadless:function(){return!0},png:Cf,jpg:Cf};var Zs={};Zs.arrowShapeWidth=.3;Zs.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(l,f,v,c,h,d,g){var m=h.x-v/2-g,p=h.x+v/2+g,y=h.y-v/2-g,b=h.y+v/2+g,E=m<=l&&l<=p&&y<=f&&f<=b;return E},a=function(l,f,v,c,h){var d=l*Math.cos(c)-f*Math.sin(c),g=l*Math.sin(c)+f*Math.cos(c),m=d*v,p=g*v,y=m+h.x,b=p+h.y;return{x:y,y:b}},n=function(l,f,v,c){for(var h=[],d=0;d<l.length;d+=2){var g=l[d],m=l[d+1];h.push(a(g,m,f,v,c))}return h},i=function(l){for(var f=[],v=0;v<l.length;v++){var c=l[v];f.push(c.x,c.y)}return f},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,f){Le(f)&&(f=t[f]),t[l]=Re({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,h,d,g,m,p){var y=i(n(this.points,d+2*p,g,m)),b=Ft(c,h,y);return b},roughCollide:r,draw:function(c,h,d,g){var m=n(this.points,h,d,g);e.arrowShapeImpl("polygon")(c,m)},spacing:function(c){return 0},gap:o},f)};s("none",{collide:Qn,roughCollide:Qn,draw:Bs,spacing:Fl,gap:Fl}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(l,f,v,c,h){var d=n(this.points,f,v,c),g=this.controlPoint,m=a(g[0],g[1],f,v,c);e.arrowShapeImpl(this.name)(l,d,m)},gap:function(l){return o(l)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,f,v,c,h,d,g){var m=i(n(this.points,v+2*g,c,h)),p=i(n(this.pointsTee,v+2*g,c,h)),y=Ft(l,f,m)||Ft(l,f,p);return y},draw:function(l,f,v,c,h){var d=n(this.points,f,v,c),g=n(this.pointsTee,f,v,c);e.arrowShapeImpl(this.name)(l,d,g)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,f,v,c,h,d,g){var m=h,p=Math.pow(m.x-l,2)+Math.pow(m.y-f,2)<=Math.pow((v+2*g)*this.radius,2),y=i(n(this.points,v+2*g,c,h));return Ft(l,f,y)||p},draw:function(l,f,v,c,h){var d=n(this.pointsTr,f,v,c);e.arrowShapeImpl(this.name)(l,d,c.x,c.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,f){var v=this.baseCrossLinePts.slice(),c=f/l,h=3,d=5;return v[h]=v[h]-c,v[d]=v[d]-c,v},collide:function(l,f,v,c,h,d,g){var m=i(n(this.points,v+2*g,c,h)),p=i(n(this.crossLinePts(v,d),v+2*g,c,h)),y=Ft(l,f,m)||Ft(l,f,p);return y},draw:function(l,f,v,c,h){var d=n(this.points,f,v,c),g=n(this.crossLinePts(f,h),f,v,c);e.arrowShapeImpl(this.name)(l,d,g)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return o(l)*.525}}),s("circle",{radius:.15,collide:function(l,f,v,c,h,d,g){var m=h,p=Math.pow(m.x-l,2)+Math.pow(m.y-f,2)<=Math.pow((v+2*g)*this.radius,2);return p},draw:function(l,f,v,c,h){e.arrowShapeImpl(this.name)(l,c.x,c.y,this.radius*f)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var Zr={};Zr.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],o=a[4],s=r.pan(),u=r.zoom(),l=((t-n)/o-s.x)/u,f=((e-i)/o-s.y)/u;return[l,f]};Zr.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(p){return parseFloat(r.getPropertyValue(p))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=t.clientWidth,s=t.clientHeight,u=n.left+n.right,l=n.top+n.bottom,f=i.left+i.right,v=e.width/(o+f),c=o-u,h=s-l,d=e.left+n.left+i.left,g=e.top+n.top+i.top;return this.containerBB=[d,g,c,h,v]};Zr.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Zr.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};Zr.findNearestElements=function(t,e,r,a){var n=this,i=this,o=i.getCachedZSortedEles(),s=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),f=(a?24:8)/u,v=(a?8:2)/u,c=(a?8:2)/u,h=1/0,d,g;r&&(o=o.interactive);function m(D,N){if(D.isNode()){if(g)return;g=D,s.push(D)}if(D.isEdge()&&(N==null||N<h))if(d){if(d.pstyle("z-compound-depth").value===D.pstyle("z-compound-depth").value&&d.pstyle("z-compound-depth").value===D.pstyle("z-compound-depth").value){for(var O=0;O<s.length;O++)if(s[O].isEdge()){s[O]=D,d=D,h=N??h;break}}}else s.push(D),d=D,h=N??h}function p(D){var N=D.outerWidth()+2*v,O=D.outerHeight()+2*v,R=N/2,P=O/2,w=D.position(),x=D.pstyle("corner-radius").value==="auto"?"auto":D.pstyle("corner-radius").pfValue,T=D._private.rscratch;if(w.x-R<=t&&t<=w.x+R&&w.y-P<=e&&e<=w.y+P){var M=i.nodeShapes[n.getNodeShape(D)];if(M.checkPoint(t,e,0,N,O,w.x,w.y,x,T))return m(D,0),!0}}function y(D){var N=D._private,O=N.rscratch,R=D.pstyle("width").pfValue,P=D.pstyle("arrow-scale").value,w=R/2+f,x=w*w,T=w*2,B=N.source,V=N.target,M;if(O.edgeType==="segments"||O.edgeType==="straight"||O.edgeType==="haystack"){for(var S=O.allpts,I=0;I+3<S.length;I+=2)if(zd(t,e,S[I],S[I+1],S[I+2],S[I+3],T)&&x>(M=qd(t,e,S[I],S[I+1],S[I+2],S[I+3])))return m(D,M),!0}else if(O.edgeType==="bezier"||O.edgeType==="multibezier"||O.edgeType==="self"||O.edgeType==="compound"){for(var S=O.allpts,I=0;I+5<O.allpts.length;I+=4)if(Vd(t,e,S[I],S[I+1],S[I+2],S[I+3],S[I+4],S[I+5],T)&&x>(M=Hd(t,e,S[I],S[I+1],S[I+2],S[I+3],S[I+4],S[I+5])))return m(D,M),!0}for(var B=B||N.source,V=V||N.target,F=n.getArrowWidth(R,P),k=[{name:"source",x:O.arrowStartX,y:O.arrowStartY,angle:O.srcArrowAngle},{name:"target",x:O.arrowEndX,y:O.arrowEndY,angle:O.tgtArrowAngle},{name:"mid-source",x:O.midX,y:O.midY,angle:O.midsrcArrowAngle},{name:"mid-target",x:O.midX,y:O.midY,angle:O.midtgtArrowAngle}],I=0;I<k.length;I++){var U=k[I],J=i.arrowShapes[D.pstyle(U.name+"-arrow-shape").value],W=D.pstyle("width").pfValue;if(J.roughCollide(t,e,F,U.angle,{x:U.x,y:U.y},W,f)&&J.collide(t,e,F,U.angle,{x:U.x,y:U.y},W,f))return m(D),!0}l&&s.length>0&&(p(B),p(V))}function b(D,N,O){return It(D,N,O)}function E(D,N){var O=D._private,R=c,P;N?P=N+"-":P="",D.boundingBox();var w=O.labelBounds[N||"main"],x=D.pstyle(P+"label").value,T=D.pstyle("text-events").strValue==="yes";if(!(!T||!x)){var M=b(O.rscratch,"labelX",N),S=b(O.rscratch,"labelY",N),I=b(O.rscratch,"labelAngle",N),B=D.pstyle(P+"text-margin-x").pfValue,V=D.pstyle(P+"text-margin-y").pfValue,F=w.x1-R-B,k=w.x2+R-B,U=w.y1-R-V,J=w.y2+R-V;if(I){var W=Math.cos(I),Q=Math.sin(I),Z=function(ne,te){return ne=ne-M,te=te-S,{x:ne*W-te*Q+M,y:ne*Q+te*W+S}},H=Z(F,U),j=Z(F,J),$=Z(k,U),q=Z(k,J),K=[H.x+B,H.y+V,$.x+B,$.y+V,q.x+B,q.y+V,j.x+B,j.y+V];if(Ft(t,e,K))return m(D),!0}else if(mr(w,t,e))return m(D),!0}}for(var C=o.length-1;C>=0;C--){var A=o[C];A.isNode()?p(A)||E(A):y(A)||E(A)||E(A,"source")||E(A,"target")}return s};Zr.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),o=2/i,s=[],u=Math.min(t,r),l=Math.max(t,r),f=Math.min(e,a),v=Math.max(e,a);t=u,r=l,e=f,a=v;var c=Bt({x1:t,y1:e,x2:r,y2:a}),h=[{x:c.x1,y:c.y1},{x:c.x2,y:c.y1},{x:c.x2,y:c.y2},{x:c.x1,y:c.y2}],d=[[h[0],h[1]],[h[1],h[2]],[h[2],h[3]],[h[3],h[0]]];function g(ne,te,be){return It(ne,te,be)}function m(ne,te){var be=ne._private,Se=o,ve="";ne.boundingBox();var oe=be.labelBounds.main;if(!oe)return null;var he=g(be.rscratch,"labelX",te),se=g(be.rscratch,"labelY",te),pe=g(be.rscratch,"labelAngle",te),de=ne.pstyle(ve+"text-margin-x").pfValue,Ee=ne.pstyle(ve+"text-margin-y").pfValue,xe=oe.x1-Se-de,De=oe.x2+Se-de,Oe=oe.y1-Se-Ee,Pe=oe.y2+Se-Ee;if(pe){var Ie=Math.cos(pe),Ne=Math.sin(pe),Y=function(z,G){return z=z-he,G=G-se,{x:z*Ie-G*Ne+he,y:z*Ne+G*Ie+se}};return[Y(xe,Oe),Y(De,Oe),Y(De,Pe),Y(xe,Pe)]}else return[{x:xe,y:Oe},{x:De,y:Oe},{x:De,y:Pe},{x:xe,y:Pe}]}function p(ne,te,be,Se){function ve(oe,he,se){return(se.y-oe.y)*(he.x-oe.x)>(he.y-oe.y)*(se.x-oe.x)}return ve(ne,be,Se)!==ve(te,be,Se)&&ve(ne,te,be)!==ve(ne,te,Se)}for(var y=0;y<n.length;y++){var b=n[y];if(b.isNode()){var E=b,C=E.pstyle("text-events").strValue==="yes",A=E.pstyle("box-selection").strValue,D=E.pstyle("box-select-labels").strValue==="yes";if(A==="none")continue;var N=(A==="overlap"||D)&&C,O=E.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:N});if(A==="contain"){var R=!1;if(D&&C){var P=m(E);P&&Ji(P,h)&&(s.push(E),R=!0)}!R&&gv(c,O)&&s.push(E)}else if(A==="overlap"&&Vs(c,O)){var w=E.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1}),x=[{x:w.x1,y:w.y1},{x:w.x2,y:w.y1},{x:w.x2,y:w.y2},{x:w.x1,y:w.y2}];if(Ji(x,h))s.push(E);else{var T=m(E);T&&Ji(T,h)&&s.push(E)}}}else{var M=b,S=M._private,I=S.rscratch,B=M.pstyle("box-selection").strValue;if(B==="none")continue;if(B==="contain"){if(I.startX!=null&&I.startY!=null&&!mr(c,I.startX,I.startY)||I.endX!=null&&I.endY!=null&&!mr(c,I.endX,I.endY))continue;if(I.edgeType==="bezier"||I.edgeType==="multibezier"||I.edgeType==="self"||I.edgeType==="compound"||I.edgeType==="segments"||I.edgeType==="haystack"){for(var V=S.rstyle.bezierPts||S.rstyle.linePts||S.rstyle.haystackPts,F=!0,k=0;k<V.length;k++)if(!Hl(c,V[k])){F=!1;break}F&&s.push(M)}else I.edgeType==="straight"&&s.push(M)}else if(B==="overlap"){var U=!1;if(I.startX!=null&&I.startY!=null&&I.endX!=null&&I.endY!=null&&(mr(c,I.startX,I.startY)||mr(c,I.endX,I.endY)))s.push(M),U=!0;else if(!U&&I.edgeType==="haystack"){for(var J=S.rstyle.haystackPts,W=0;W<J.length;W++)if(Hl(c,J[W])){s.push(M),U=!0;break}}if(!U){var Q=S.rstyle.bezierPts||S.rstyle.linePts||S.rstyle.haystackPts;if((!Q||Q.length<2)&&I.edgeType==="straight"&&I.startX!=null&&I.startY!=null&&I.endX!=null&&I.endY!=null&&(Q=[{x:I.startX,y:I.startY},{x:I.endX,y:I.endY}]),!Q||Q.length<2)continue;for(var Z=0;Z<Q.length-1;Z++){for(var H=Q[Z],j=Q[Z+1],$=0;$<d.length;$++){var q=dt(d[$],2),K=q[0],ee=q[1];if(p(H,j,K,ee)){s.push(M),U=!0;break}}if(U)break}}}}}return s};var ni={};ni.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",u,l,f,v,c,h,p,y;if(r?(f=e.haystackPts[0],v=e.haystackPts[1],c=e.haystackPts[2],h=e.haystackPts[3]):(f=e.arrowStartX,v=e.arrowStartY,c=e.arrowEndX,h=e.arrowEndY),p=e.midX,y=e.midY,i)u=f-e.segpts[0],l=v-e.segpts[1];else if(n||o||s||a){var d=e.allpts,g=Et(d[0],d[2],d[4],.1),m=Et(d[1],d[3],d[5],.1);u=f-g,l=v-m}else u=f-p,l=v-y;e.srcArrowAngle=Dn(u,l);var p=e.midX,y=e.midY;if(r&&(p=(f+c)/2,y=(v+h)/2),u=c-f,l=h-v,i){var d=e.allpts;if(d.length/2%2===0){var b=d.length/2,E=b-2;u=d[b]-d[E],l=d[b+1]-d[E+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var b=d.length/2-1,E=b-2;u=d[b]-d[E],l=d[b+1]-d[E+1]}}else if(n||o||s){var d=e.allpts,C=e.ctrlpts,A,D,N,O;if(C.length/2%2===0){var R=d.length/2-1,P=R+2,w=P+2;A=Et(d[R],d[P],d[w],0),D=Et(d[R+1],d[P+1],d[w+1],0),N=Et(d[R],d[P],d[w],1e-4),O=Et(d[R+1],d[P+1],d[w+1],1e-4)}else{var P=d.length/2-1,R=P-2,w=P+2;A=Et(d[R],d[P],d[w],.4999),D=Et(d[R+1],d[P+1],d[w+1],.4999),N=Et(d[R],d[P],d[w],.5),O=Et(d[R+1],d[P+1],d[w+1],.5)}u=N-A,l=O-D}if(e.midtgtArrowAngle=Dn(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var d=e.allpts;if(d.length/2%2!==0){if(!e.isRound){var b=d.length/2-1,x=b+2;u=-(d[x]-d[b]),l=-(d[x+1]-d[b+1])}}}if(e.midsrcArrowAngle=Dn(u,l),i)u=c-e.segpts[e.segpts.length-2],l=h-e.segpts[e.segpts.length-1];else if(n||o||s||a){var d=e.allpts,T=d.length,g=Et(d[T-6],d[T-4],d[T-2],.9),m=Et(d[T-5],d[T-3],d[T-1],.9);u=c-g,l=h-m}else u=c-p,l=h-y;e.tgtArrowAngle=Dn(u,l)};ni.getArrowWidth=ni.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var Es,xs,Qt={},Ut={},Sf,Df,qr,Wn,nr,Fr,Ur,_t,oa,In,uc,fc,Ts,Cs,Af,Mf=function(e,r,a){a.x=r.x-e.x,a.y=r.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},om=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},sm=function(e,r,a,n,i){if(e!==Af?Mf(r,e,Qt):om(Ut,Qt),Mf(r,a,Ut),Sf=Qt.nx*Ut.ny-Qt.ny*Ut.nx,Df=Qt.nx*Ut.nx-Qt.ny*-Ut.ny,nr=Math.asin(Math.max(-1,Math.min(1,Sf))),Math.abs(nr)<1e-6){Es=r.x,xs=r.y,Ur=oa=0;return}qr=1,Wn=!1,Df<0?nr<0?nr=Math.PI+nr:(nr=Math.PI-nr,qr=-1,Wn=!0):nr>0&&(qr=-1,Wn=!0),r.radius!==void 0?oa=r.radius:oa=n,Fr=nr/2,In=Math.min(Qt.len/2,Ut.len/2),i?(_t=Math.abs(Math.cos(Fr)*oa/Math.sin(Fr)),_t>In?(_t=In,Ur=Math.abs(_t*Math.sin(Fr)/Math.cos(Fr))):Ur=oa):(_t=Math.min(In,oa),Ur=Math.abs(_t*Math.sin(Fr)/Math.cos(Fr))),Ts=r.x+Ut.nx*_t,Cs=r.y+Ut.ny*_t,Es=Ts-Ut.ny*Ur*qr,xs=Cs+Ut.nx*Ur*qr,uc=r.x+Qt.nx*_t,fc=r.y+Qt.ny*_t,Af=r};function vc(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Qs(t,e,r,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(sm(t,e,r,a,n),{cx:Es,cy:xs,radius:Ur,startX:uc,startY:fc,stopX:Ts,stopY:Cs,startAngle:Qt.ang+Math.PI/2*qr,endAngle:Ut.ang-Math.PI/2*qr,counterClockwise:Wn})}var rn=.01,lm=Math.sqrt(2*rn),Rt={};Rt.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=t.pstyle("source-endpoint"),s=t.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(C,A,D,N){var O=N-A,R=D-C,P=Math.sqrt(R*R+O*O);return{x:-O/P,y:R/P}},f=t.pstyle("edge-distances").value;switch(f){case"node-position":i=r;break;case"intersection":i=a;break;case"endpoints":{if(u){var v=this.manualEndptToPx(t.source()[0],o),c=dt(v,2),h=c[0],d=c[1],g=this.manualEndptToPx(t.target()[0],s),m=dt(g,2),p=m[0],y=m[1],b={x1:h,y1:d,x2:p,y2:y};n=l(h,d,p,y),i=b}else Qe("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};Rt.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var o=a.source,s=a.target,u=o.position(),l=s.position(),f=o.width(),v=s.width(),c=o.height(),h=s.height(),d=r.pstyle("haystack-radius").value,g=d/2;n.haystackPts=n.allpts=[n.source.x*f*g+u.x,n.source.y*c*g+u.y,n.target.x*v*g+l.x,n.target.y*h*g+l.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};Rt.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),n=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),s=Math.min(a.pfValue.length,n.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var f=0;f<s;f++){var v=a.pfValue[f],c=n.pfValue[f],h=1-v,d=v,g=this.findMidptPtsEtc(t,e),m=g.midptPts,p=g.vectorNormInverse,y={x:m.x1*h+m.x2*d,y:m.y1*h+m.y2*d};r.segpts.push(y.x+p.x*c,y.y+p.y*c),r.radii.push(i.pfValue[f]!==void 0?i.pfValue[f]:u),r.isArcRadius.push((o.pfValue[f]!==void 0?o.pfValue[f]:l)==="arc-radius")}};Rt.findLoopPoints=function(t,e,r,a){var n=t._private.rscratch,i=e.dirCounts,o=e.srcPos,s=t.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=t.pstyle("loop-direction").pfValue,f=t.pstyle("loop-sweep").pfValue,v=t.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=r,h=v;a&&(c=0,h=u);var d=l-Math.PI/2,g=d-f/2,m=d+f/2,p=l+"_"+f;c=i[p]===void 0?i[p]=0:++i[p],n.ctrlpts=[o.x+Math.cos(g)*1.4*h*(c/3+1),o.y+Math.sin(g)*1.4*h*(c/3+1),o.x+Math.cos(m)*1.4*h*(c/3+1),o.y+Math.sin(m)*1.4*h*(c/3+1)]};Rt.findCompoundLoopPoints=function(t,e,r,a){var n=t._private.rscratch;n.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,u=e.srcH,l=e.tgtW,f=e.tgtH,v=t.pstyle("control-point-step-size").pfValue,c=t.pstyle("control-point-distances"),h=c?c.pfValue[0]:void 0,d=r,g=v;a&&(d=0,g=h);var m=50,p={x:i.x-s/2,y:i.y-u/2},y={x:o.x-l/2,y:o.y-f/2},b={x:Math.min(p.x,y.x),y:Math.min(p.y,y.y)},E=.5,C=Math.max(E,Math.log(s*rn)),A=Math.max(E,Math.log(l*rn));n.ctrlpts=[b.x,b.y-(1+Math.pow(m,1.12)/100)*g*(d/3+1)*C,b.x-(1+Math.pow(m,1.12)/100)*g*(d/3+1)*A,b.y]};Rt.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};Rt.findBezierPoints=function(t,e,r,a,n){var i=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,s=t.pstyle("control-point-distances"),u=t.pstyle("control-point-weights"),l=s&&u?Math.min(s.value.length,u.value.length):1,f=s?s.pfValue[0]:void 0,v=u.value[0],c=a;i.edgeType=c?"multibezier":"bezier",i.ctrlpts=[];for(var h=0;h<l;h++){var d=(.5-e.eles.length/2+r)*o*(n?-1:1),g=void 0,m=zs(d);c&&(f=s?s.pfValue[h]:o,v=u.value[h]),a?g=f:g=f!==void 0?m*f:void 0;var p=g!==void 0?g:d,y=1-v,b=v,E=this.findMidptPtsEtc(t,e),C=E.midptPts,A=E.vectorNormInverse,D={x:C.x1*y+C.x2*b,y:C.y1*y+C.y2*b};i.ctrlpts.push(D.x+A.x*p,D.y+A.y*p)}};Rt.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",n="horizontal",i="leftward",o="rightward",s="downward",u="upward",l="auto",f=e.posPts,v=e.srcW,c=e.srcH,h=e.tgtW,d=e.tgtH,g=t.pstyle("edge-distances").value,m=g!=="node-position",p=t.pstyle("taxi-direction").value,y=p,b=t.pstyle("taxi-turn"),E=b.units==="%",C=b.pfValue,A=C<0,D=t.pstyle("taxi-turn-min-distance").pfValue,N=m?(v+h)/2:0,O=m?(c+d)/2:0,R=f.x2-f.x1,P=f.y2-f.y1,w=function(G,X){return G>0?Math.max(G-X,0):Math.min(G+X,0)},x=w(R,N),T=w(P,O),M=!1;y===l?p=Math.abs(x)>Math.abs(T)?n:a:y===u||y===s?(p=a,M=!0):(y===i||y===o)&&(p=n,M=!0);var S=p===a,I=S?T:x,B=S?P:R,V=zs(B),F=!1;!(M&&(E||A))&&(y===s&&B<0||y===u&&B>0||y===i&&B>0||y===o&&B<0)&&(V*=-1,I=V*Math.abs(I),F=!0);var k;if(E){var U=C<0?1+C:C;k=U*I}else{var J=C<0?I:0;k=J+C*V}var W=function(G){return Math.abs(G)<D||Math.abs(G)>=Math.abs(I)},Q=W(k),Z=W(Math.abs(I)-Math.abs(k)),H=Q||Z;if(H&&!F)if(S){var j=Math.abs(B)<=c/2,$=Math.abs(R)<=h/2;if(j){var q=(f.x1+f.x2)/2,K=f.y1,ee=f.y2;r.segpts=[q,K,q,ee]}else if($){var ne=(f.y1+f.y2)/2,te=f.x1,be=f.x2;r.segpts=[te,ne,be,ne]}else r.segpts=[f.x1,f.y2]}else{var Se=Math.abs(B)<=v/2,ve=Math.abs(P)<=d/2;if(Se){var oe=(f.y1+f.y2)/2,he=f.x1,se=f.x2;r.segpts=[he,oe,se,oe]}else if(ve){var pe=(f.x1+f.x2)/2,de=f.y1,Ee=f.y2;r.segpts=[pe,de,pe,Ee]}else r.segpts=[f.x2,f.y1]}else if(S){var xe=f.y1+k+(m?c/2*V:0),De=f.x1,Oe=f.x2;r.segpts=[De,xe,Oe,xe]}else{var Pe=f.x1+k+(m?v/2*V:0),Ie=f.y1,Ne=f.y2;r.segpts=[Pe,Ie,Pe,Ne]}if(r.isRound){var Y=t.pstyle("taxi-radius").value,L=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(Y),r.isArcRadius=new Array(r.segpts.length/2).fill(L)}};Rt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,v=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,g=!we(r.startX)||!we(r.startY),m=!we(r.arrowStartX)||!we(r.arrowStartY),p=!we(r.endX)||!we(r.endY),y=!we(r.arrowEndX)||!we(r.arrowEndY),b=3,E=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,C=b*E,A=Xr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),D=A<C,N=Xr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),O=N<C,R=!1;if(g||m||D){R=!0;var P={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},w=Math.sqrt(P.x*P.x+P.y*P.y),x={x:P.x/w,y:P.y/w},T=Math.max(i,o),M={x:r.ctrlpts[0]+x.x*2*T,y:r.ctrlpts[1]+x.y*2*T},S=l.intersectLine(a.x,a.y,i,o,M.x,M.y,0,v,h);D?(r.ctrlpts[0]=r.ctrlpts[0]+x.x*(C-A),r.ctrlpts[1]=r.ctrlpts[1]+x.y*(C-A)):(r.ctrlpts[0]=S[0]+x.x*C,r.ctrlpts[1]=S[1]+x.y*C)}if(p||y||O){R=!0;var I={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},B=Math.sqrt(I.x*I.x+I.y*I.y),V={x:I.x/B,y:I.y/B},F=Math.max(i,o),k={x:r.ctrlpts[0]+V.x*2*F,y:r.ctrlpts[1]+V.y*2*F},U=f.intersectLine(n.x,n.y,s,u,k.x,k.y,0,c,d);O?(r.ctrlpts[0]=r.ctrlpts[0]+V.x*(C-N),r.ctrlpts[1]=r.ctrlpts[1]+V.y*(C-N)):(r.ctrlpts[0]=U[0]+V.x*C,r.ctrlpts[1]=U[1]+V.y*C)}R&&this.findEndpoints(t)}};Rt.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=Et(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=Et(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],s=e.isArcRadius[i/2-1];e.roundCorners.push(Qs({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,s))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var f=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[f],e.midY=e.segpts[f+1];else{var v={x:e.segpts[f],y:e.segpts[f+1]},c=e.roundCorners[f/2];if(c.radius===0){var h={x:e.segpts[f+2],y:e.segpts[f+3]};e.midX=v.x,e.midY=v.y,e.midVector=[v.y-h.y,h.x-v.x]}else{var d=[v.x-c.cx,v.y-c.cy],g=c.radius/Math.sqrt(Math.pow(d[0],2)+Math.pow(d[1],2));d=d.map(function(m){return m*g}),e.midX=c.cx+d[0],e.midY=c.cy+d[1],e.midVector=d}}}}};Rt.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||we(e.startX)&&we(e.startY)&&we(e.endX)&&we(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Qe("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};Rt.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,n=a.hasCompoundNodes(),i=new ir,o=function(O,R){return[].concat(Kn(O),[R?1:0]).join("-")},s=[],u=[],l=0;l<t.length;l++){var f=t[l],v=f._private,c=f.pstyle("curve-style").value;if(!(f.removed()||!f.takesUpSpace())){if(c==="haystack"){u.push(f);continue}var h=c==="unbundled-bezier"||yr(c,"segments")||c==="straight"||c==="straight-triangle"||yr(c,"taxi"),d=c==="unbundled-bezier"||c==="bezier",g=v.source,m=v.target,p=g.poolIndex(),y=m.poolIndex(),b=[p,y].sort(),E=o(b,h),C=i.get(E);C==null&&(C={eles:[]},s.push({pairId:b,edgeIsUnbundled:h}),i.set(E,C)),C.eles.push(f),h&&(C.hasUnbundled=!0),d&&(C.hasBezier=!0)}}for(var A=function(){var O=s[D],R=O.pairId,P=O.edgeIsUnbundled,w=o(R,P),x=i.get(w),T;if(!x.hasUnbundled){var M=x.eles[0].parallelEdges().filter(function(L){return L.isBundledBezier()});ks(x.eles),M.forEach(function(L){return x.eles.push(L)}),x.eles.sort(function(L,z){return L.poolIndex()-z.poolIndex()})}var S=x.eles[0],I=S.source(),B=S.target();if(I.poolIndex()>B.poolIndex()){var V=I;I=B,B=V}var F=x.srcPos=I.position(),k=x.tgtPos=B.position(),U=x.srcW=I.outerWidth(),J=x.srcH=I.outerHeight(),W=x.tgtW=B.outerWidth(),Q=x.tgtH=B.outerHeight(),Z=x.srcShape=r.nodeShapes[e.getNodeShape(I)],H=x.tgtShape=r.nodeShapes[e.getNodeShape(B)],j=x.srcCornerRadius=I.pstyle("corner-radius").value==="auto"?"auto":I.pstyle("corner-radius").pfValue,$=x.tgtCornerRadius=B.pstyle("corner-radius").value==="auto"?"auto":B.pstyle("corner-radius").pfValue,q=x.tgtRs=B._private.rscratch,K=x.srcRs=I._private.rscratch;x.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var ee=0;ee<x.eles.length;ee++){var ne=x.eles[ee],te=ne[0]._private.rscratch,be=ne.pstyle("curve-style").value,Se=be==="unbundled-bezier"||yr(be,"segments")||yr(be,"taxi"),ve=!I.same(ne.source());if(!x.calculatedIntersection&&I!==B&&(x.hasBezier||x.hasUnbundled)){x.calculatedIntersection=!0;var oe=Z.intersectLine(F.x,F.y,U,J,k.x,k.y,0,j,K),he=x.srcIntn=oe,se=H.intersectLine(k.x,k.y,W,Q,F.x,F.y,0,$,q),pe=x.tgtIntn=se,de=x.intersectionPts={x1:oe[0],x2:se[0],y1:oe[1],y2:se[1]},Ee=x.posPts={x1:F.x,x2:k.x,y1:F.y,y2:k.y},xe=se[1]-oe[1],De=se[0]-oe[0],Oe=Math.sqrt(De*De+xe*xe);we(Oe)&&Oe>=lm||(Oe=Math.sqrt(Math.max(De*De,rn)+Math.max(xe*xe,rn)));var Pe=x.vector={x:De,y:xe},Ie=x.vectorNorm={x:Pe.x/Oe,y:Pe.y/Oe},Ne={x:-Ie.y,y:Ie.x};x.nodesOverlap=!we(Oe)||H.checkPoint(oe[0],oe[1],0,W,Q,k.x,k.y,$,q)||Z.checkPoint(se[0],se[1],0,U,J,F.x,F.y,j,K),x.vectorNormInverse=Ne,T={nodesOverlap:x.nodesOverlap,dirCounts:x.dirCounts,calculatedIntersection:!0,hasBezier:x.hasBezier,hasUnbundled:x.hasUnbundled,eles:x.eles,srcPos:k,srcRs:q,tgtPos:F,tgtRs:K,srcW:W,srcH:Q,tgtW:U,tgtH:J,srcIntn:pe,tgtIntn:he,srcShape:H,tgtShape:Z,posPts:{x1:Ee.x2,y1:Ee.y2,x2:Ee.x1,y2:Ee.y1},intersectionPts:{x1:de.x2,y1:de.y2,x2:de.x1,y2:de.y1},vector:{x:-Pe.x,y:-Pe.y},vectorNorm:{x:-Ie.x,y:-Ie.y},vectorNormInverse:{x:-Ne.x,y:-Ne.y}}}var Y=ve?T:x;te.nodesOverlap=Y.nodesOverlap,te.srcIntn=Y.srcIntn,te.tgtIntn=Y.tgtIntn,te.isRound=be.startsWith("round"),n&&(I.isParent()||I.isChild()||B.isParent()||B.isChild())&&(I.parents().anySame(B)||B.parents().anySame(I)||I.same(B)&&I.isParent())?e.findCompoundLoopPoints(ne,Y,ee,Se):I===B?e.findLoopPoints(ne,Y,ee,Se):be.endsWith("segments")?e.findSegmentsPoints(ne,Y):be.endsWith("taxi")?e.findTaxiPoints(ne,Y):be==="straight"||!Se&&x.eles.length%2===1&&ee===Math.floor(x.eles.length/2)?e.findStraightEdgePoints(ne):e.findBezierPoints(ne,Y,ee,Se,ve),e.findEndpoints(ne),e.tryToCorrectInvalidPoints(ne,Y),e.checkForInvalidEdgeWarning(ne),e.storeAllpts(ne),e.storeEdgeProjections(ne),e.calculateArrowAngles(ne),e.recalculateEdgeLabelProjections(ne),e.calculateLabelAngles(ne)}},D=0;D<s.length;D++)A();this.findHaystackPoints(u)}};function cc(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],n=t[r+1];e.push({x:a,y:n})}return e}}Rt.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return cc(e.segpts)};Rt.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return cc(e.ctrlpts)};Rt.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var hn={};hn.manualEndptToPx=function(t,e){var r=this,a=t.position(),n=t.outerWidth(),i=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*n),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=a.x,s[1]+=a.y,s}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(n,i),f=[a.x+Math.cos(u)*l,a.y+Math.sin(u)*l];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,n,i,f[0],f[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};hn.findEndpoints=function(t){var e,r,a,n,i=this,o,s=t.source()[0],u=t.target()[0],l=s.position(),f=u.position(),v=t.pstyle("target-arrow-shape").value,c=t.pstyle("source-arrow-shape").value,h=t.pstyle("target-distance-from-node").pfValue,d=t.pstyle("source-distance-from-node").pfValue,g=s._private.rscratch,m=u._private.rscratch,p=t.pstyle("curve-style").value,y=t._private.rscratch,b=y.edgeType,E=yr(p,"taxi"),C=b==="self"||b==="compound",A=b==="bezier"||b==="multibezier"||C,D=b!=="bezier",N=b==="straight"||b==="segments",O=b==="segments",R=A||D||N,P=C||E,w=t.pstyle("source-endpoint"),x=P?"outside-to-node":w.value,T=s.pstyle("corner-radius").value==="auto"?"auto":s.pstyle("corner-radius").pfValue,M=t.pstyle("target-endpoint"),S=P?"outside-to-node":M.value,I=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;y.srcManEndpt=w,y.tgtManEndpt=M;var B,V,F,k,U=(e=(M==null||(r=M.pfValue)===null||r===void 0?void 0:r.length)===2?M.pfValue:null)!==null&&e!==void 0?e:[0,0],J=(a=(w==null||(n=w.pfValue)===null||n===void 0?void 0:n.length)===2?w.pfValue:null)!==null&&a!==void 0?a:[0,0];if(A){var W=[y.ctrlpts[0],y.ctrlpts[1]],Q=D?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:W;B=Q,V=W}else if(N){var Z=O?y.segpts.slice(0,2):[f.x+U[0],f.y+U[1]],H=O?y.segpts.slice(y.segpts.length-2):[l.x+J[0],l.y+J[1]];B=H,V=Z}if(S==="inside-to-node")o=[f.x,f.y];else if(M.units)o=this.manualEndptToPx(u,M);else if(S==="outside-to-line")o=y.tgtIntn;else if(S==="outside-to-node"||S==="outside-to-node-or-label"?F=B:(S==="outside-to-line"||S==="outside-to-line-or-label")&&(F=[l.x,l.y]),o=i.nodeShapes[this.getNodeShape(u)].intersectLine(f.x,f.y,u.outerWidth(),u.outerHeight(),F[0],F[1],0,I,m),S==="outside-to-node-or-label"||S==="outside-to-line-or-label"){var j=u._private.rscratch,$=j.labelWidth,q=j.labelHeight,K=j.labelX,ee=j.labelY,ne=$/2,te=q/2,be=u.pstyle("text-valign").value;be=Ea(be),be==="top"?ee-=te:be==="bottom"&&(ee+=te);var Se=u.pstyle("text-halign").value;Se=wa(Se),Se==="left"?K-=ne:Se==="right"&&(K+=ne);var ve=Qa(F[0],F[1],[K-ne,ee-te,K+ne,ee-te,K+ne,ee+te,K-ne,ee+te],f.x,f.y);if(ve.length>0){var oe=l,he=Gr(oe,fa(o)),se=Gr(oe,fa(ve)),pe=he;if(se<he&&(o=ve,pe=se),ve.length>2){var de=Gr(oe,{x:ve[2],y:ve[3]});de<pe&&(o=[ve[2],ve[3]])}}}var Ee=An(o,B,i.arrowShapes[v].spacing(t)+h),xe=An(o,B,i.arrowShapes[v].gap(t)+h);if(y.endX=xe[0],y.endY=xe[1],y.arrowEndX=Ee[0],y.arrowEndY=Ee[1],x==="inside-to-node")o=[l.x,l.y];else if(w.units)o=this.manualEndptToPx(s,w);else if(x==="outside-to-line")o=y.srcIntn;else if(x==="outside-to-node"||x==="outside-to-node-or-label"?k=V:(x==="outside-to-line"||x==="outside-to-line-or-label")&&(k=[f.x,f.y]),o=i.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),k[0],k[1],0,T,g),x==="outside-to-node-or-label"||x==="outside-to-line-or-label"){var De=s._private.rscratch,Oe=De.labelWidth,Pe=De.labelHeight,Ie=De.labelX,Ne=De.labelY,Y=Oe/2,L=Pe/2,z=s.pstyle("text-valign").value;z=Ea(z),z==="top"?Ne-=L:z==="bottom"&&(Ne+=L);var G=s.pstyle("text-halign").value;G=wa(G),G==="left"?Ie-=Y:G==="right"&&(Ie+=Y);var X=Qa(k[0],k[1],[Ie-Y,Ne-L,Ie+Y,Ne-L,Ie+Y,Ne+L,Ie-Y,Ne+L],l.x,l.y);if(X.length>0){var _=f,le=Gr(_,fa(o)),re=Gr(_,fa(X)),ae=le;if(re<le&&(o=[X[0],X[1]],ae=re),X.length>2){var ie=Gr(_,{x:X[2],y:X[3]});ie<ae&&(o=[X[2],X[3]])}}}var fe=An(o,V,i.arrowShapes[c].spacing(t)+d),ue=An(o,V,i.arrowShapes[c].gap(t)+d);y.startX=ue[0],y.startY=ue[1],y.arrowStartX=fe[0],y.arrowStartY=fe[1],R&&(!we(y.startX)||!we(y.startY)||!we(y.endX)||!we(y.endY)?y.badLine=!0:y.badLine=!1)};hn.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),e.edgeType==="haystack"?{x:e.haystackPts[0],y:e.haystackPts[1]}:{x:e.arrowStartX,y:e.arrowStartY}};hn.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),e.edgeType==="haystack"?{x:e.haystackPts[2],y:e.haystackPts[3]}:{x:e.arrowEndX,y:e.arrowEndY}};var Js={};function um(t,e,r){for(var a=function(l,f,v,c){return Et(l,f,v,c)},n=e._private,i=n.rstyle.bezierPts,o=0;o<t.bezierProjPcts.length;o++){var s=t.bezierProjPcts[o];i.push({x:a(r[0],r[2],r[4],s),y:a(r[1],r[3],r[5],s)})}}Js.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<r.allpts.length;n+=4)um(this,t,r.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<r.allpts.length;n+=2)i.push({x:r.allpts[n],y:r.allpts[n+1]});else if(a==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};Js.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var tr={};tr.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!xr(e)){var r,a,n=t._private,i=t.width(),o=t.height(),s=t.padding(),u=t.position(),l=t.pstyle("text-halign").strValue,f=t.pstyle("text-valign").strValue,v=n.rscratch,c=n.rstyle;switch(l){case"left":r=u.x-i/2-s;break;case"left-inside":r=u.x-i/2+s;break;case"right":r=u.x+i/2+s;break;case"right-inside":r=u.x+i/2-s;break;default:r=u.x}switch(f){case"top":a=u.y-o/2-s;break;case"top-inside":a=u.y-o/2+s;break;case"bottom":a=u.y+o/2+s;break;case"bottom-inside":a=u.y+o/2-s;break;default:a=u.y}v.labelX=r,v.labelY=a,c.labelX=r,c.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var hc=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},dc=function(e,r){var a=r.x-e.x,n=r.y-e.y;return hc(a,n)},fm=function(e,r,a,n){var i=Za(0,n-.001,1),o=Za(0,n+.001,1),s=ha(e,r,a,i),u=ha(e,r,a,o);return dc(s,u)};tr.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,n=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var o=function(v,c,h){Jt(r.rscratch,v,c,h),Jt(r.rstyle,v,c,h)};o("labelX",null,e.x),o("labelY",null,e.y);var s=hc(a.midDispX,a.midDispY);o("labelAutoAngle",null,s);var u=function(){if(u.cache)return u.cache;for(var v=[],c=0;c+5<a.allpts.length;c+=4){var h={x:a.allpts[c],y:a.allpts[c+1]},d={x:a.allpts[c+2],y:a.allpts[c+3]},g={x:a.allpts[c+4],y:a.allpts[c+5]};v.push({p0:h,p1:d,p2:g,startDist:0,length:0,segments:[]})}var m=r.rstyle.bezierPts,p=n.bezierProjPcts.length;function y(D,N,O,R,P){var w=Xr(N,O),x=D.segments[D.segments.length-1],T={p0:N,p1:O,t0:R,t1:P,startDist:x?x.startDist+x.length:0,length:w};D.segments.push(T),D.length+=w}for(var b=0;b<v.length;b++){var E=v[b],C=v[b-1];C&&(E.startDist=C.startDist+C.length),y(E,E.p0,m[b*p],0,n.bezierProjPcts[0]);for(var A=0;A<p-1;A++)y(E,m[b*p+A],m[b*p+A+1],n.bezierProjPcts[A],n.bezierProjPcts[A+1]);y(E,m[b*p+p-1],E.p2,n.bezierProjPcts[p-1],1)}return u.cache=v},l=function(v){var c,h=v==="source";if(i[v]){var d=t.pstyle(v+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var g=u(),m,p=0,y=0,b=0;b<g.length;b++){for(var E=g[h?b:g.length-1-b],C=0;C<E.segments.length;C++){var A=E.segments[h?C:E.segments.length-1-C],D=b===g.length-1&&C===E.segments.length-1;if(p=y,y+=A.length,y>=d||D){m={cp:E,segment:A};break}}if(m)break}var N=m.cp,O=m.segment,R=(d-p)/O.length,P=O.t1-O.t0,w=h?O.t0+P*R:O.t1-P*R;w=Za(0,w,1),e=ha(N.p0,N.p1,N.p2,w),c=fm(N.p0,N.p1,N.p2,w);break}case"straight":case"segments":case"haystack":{for(var x=0,T,M,S,I,B=a.allpts.length,V=0;V+3<B&&(h?(S={x:a.allpts[V],y:a.allpts[V+1]},I={x:a.allpts[V+2],y:a.allpts[V+3]}):(S={x:a.allpts[B-2-V],y:a.allpts[B-1-V]},I={x:a.allpts[B-4-V],y:a.allpts[B-3-V]}),T=Xr(S,I),M=x,x+=T,!(x>=d));V+=2);var F=d-M,k=F/T;k=Za(0,k,1),e=Rd(S,I,k),c=dc(S,I);break}}o("labelX",v,e.x),o("labelY",v,e.y),o("labelAutoAngle",v,c)}};l("source"),l("target"),this.applyLabelDimensions(t)}};tr.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};tr.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=Wr(a,t._private.labelDimsKey);if(It(r.rscratch,"prefixedLabelDimsKey",e)!==n){Jt(r.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,s=t.pstyle("font-size").pfValue,u=t.pstyle("text-wrap").strValue,l=It(r.rscratch,"labelWrapCachedLines",e)||[],f=u!=="wrap"?1:Math.max(l.length,1),v=s*o,c=i.width,h=i.height+(f-1)*(o-1)*s;Jt(r.rstyle,"labelWidth",e,c),Jt(r.rscratch,"labelWidth",e,c),Jt(r.rstyle,"labelHeight",e,h),Jt(r.rscratch,"labelHeight",e,h),Jt(r.rscratch,"labelLineHeight",e,v),Jt(r.rscratch,"labelActualDescent",e,i.labelActualDescent)}};tr.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,o=function(J,W){return W?(Jt(r.rscratch,J,e,W),W):It(r.rscratch,J,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=t.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="\u200B",f=n.split(`
5
+ `),v=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value,h=c==="anywhere",d=[],g=/[\s\u200b]+|$/g,m=0;m<f.length;m++){var p=f[m],y=this.calculateLabelDimensions(t,p),b=y.width;if(h){var E=p.split("").join(l);p=E}if(b>v){var C=p.matchAll(g),A="",D=0,N=zt(C),O;try{for(N.s();!(O=N.n()).done;){var R=O.value,P=R[0],w=p.substring(D,R.index);D=R.index+P.length;var x=A.length===0?w:A+w+P,T=this.calculateLabelDimensions(t,x),M=T.width;M<=v?A+=w+P:(A&&d.push(A),A=w+P)}}catch(U){N.e(U)}finally{N.f()}A.match(/^[\s\u200b]+$/)||d.push(A)}else d.push(p)}o("labelWrapCachedLines",d),n=o("labelWrapCachedText",d.join(`
6
+ `)),o("labelWrapKey",u)}else if(s==="ellipsis"){var S=t.pstyle("text-max-width").pfValue,I="",B="\u2026",V=!1;if(this.calculateLabelDimensions(t,n).width<S)return n;for(var F=0;F<n.length;F++){var k=this.calculateLabelDimensions(t,I+n[F]+B).width;if(k>S)break;I+=n[F],F===n.length-1&&(V=!0)}return V||(I+=B),I}return n};tr.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;return e==="auto"?t.isNode()?Qp(r):"center":e};tr.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),n=a.document,i=0,o=t.pstyle("font-style").strValue,s=t.pstyle("font-size").pfValue,u=t.pstyle("font-family").strValue,l=t.pstyle("font-weight").strValue,f=t.pstyle("text-metrics").strValue||"font",v=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=n.createElement("canvas"),c=this.labelCalcCanvasContext=v.getContext("2d");var h=v.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}c.font="".concat(o," ").concat(l," ").concat(s,"px ").concat(u);for(var d=0,g=0,m=e.split(`
7
+ `),p=m.length,y=0,b=0,E=0;E<p;E++){var C=m[E],A=c.measureText(C),D=Math.ceil(A.width),N=s;f==="glyph"&&(E===0&&(b=A.actualBoundingBoxAscent),E===p-1&&(y=A.actualBoundingBoxDescent)),d=Math.max(D,d),g+=N}return f==="glyph"&&(g-=s-b-y),d+=i,g+=i,{width:d,height:g,labelActualAscent:b,labelActualDescent:y}};tr.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,n=t.isEdge(),i=e?e+"-":"",o=t.pstyle(i+"text-rotation"),s=o.strValue;return s==="none"?0:n&&s==="autorotate"?a.labelAutoAngle:s==="autorotate"?0:o.pfValue};tr.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(t),r&&(n.sourceLabelAngle=e.calculateLabelAngle(t,"source"),n.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var gc={},Lf=28,Nf=!1;gc.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<Lf||t.height()<Lf))return Nf||(Qe("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Nf=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var Ci={};Ci.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var u=0;u<o.length;u++){var l=o[u],f=l._private,v=f.rstyle;v.clean=!1,v.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var s=o.target;a(s)}).on("style.* background.*",function(o){var s=o.target;a(s,!1)});var n=function(o){if(o){var s=r.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],f=l._private.rstyle;l.isNode()&&!f.cleanConnected&&(a(l.connectedEdges()),f.cleanConnected=!0)}if(s)for(var v=0;v<s.length;v++){var c=s[v];c(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)};Ci.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};Ci.recalculateRenderedStyle=function(t,e){var r=function(E){return E._private.rstyle.cleanConnected};if(t.length!==0){var a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var o=t[i],s=o._private,u=s.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(u.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?n.push(o):a.push(o),u.clean=!0)}for(var l=0;l<n.length;l++){var f=n[l],v=f._private,c=v.rstyle,h=f.position();this.recalculateNodeLabelProjection(f),c.nodeX=h.x,c.nodeY=h.y,c.nodeW=f.pstyle("width").pfValue,c.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var g=a[d],m=g._private,p=m.rstyle,y=m.rscratch;p.srcX=y.arrowStartX,p.srcY=y.arrowStartY,p.tgtX=y.arrowEndX,p.tgtY=y.arrowEndY,p.midX=y.midX,p.midY=y.midY,p.labelAngle=y.labelAngle,p.sourceLabelAngle=y.sourceLabelAngle,p.targetLabelAngle=y.targetLabelAngle}}}};var Si={};Si.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}};Si.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Si.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(Zv),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var pc={};[Zr,ni,Rt,hn,Js,tr,gc,Ci,Si].forEach(function(t){Re(pc,t)});var yc={};yc.getCachedImage=function(t,e,r){var a=this,n=a.imageCache=a.imageCache||{},i=n[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=n[t]=n[t]||{};var o=i.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var s="data:",u=t.substring(0,s.length).toLowerCase()===s;return u||(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var mc=function(e,r){var a=e[0];!a||a._private.grabbed===r||(a._private.grabbed=r,e.updateStyle(!1))},vm=function(e){mc(e,!0)},cm=function(e){mc(e,!1)},Da={};Da.registerBinding=function(t,e,r,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var i=[],o=0;o<t.length;o++){var s=t[o];if(s!==void 0){var u=this.binder(s);i.push(u.on.apply(u,n))}}return i}var u=this.binder(t);return u.on.apply(u,n)};Da.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||Eh(t);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});r.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var o=function(u,l,f){var v=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(v[2]={capture:f??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:v}),(t.addEventListener||t.on).apply(t,v),this};return{on:o,addEventListener:o,addListener:o,bind:o}};Da.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};Da.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};Da.load=function(){var t=this,e=t.cy.window(),r=function(L){return L.selected()},a=function(L){var z=L.getRootNode();if(z&&z.nodeType===11&&z.host!==void 0)return z},n=function(L,z,G,X){L==null&&(L=t.cy);for(var _=0;_<z.length;_++){var le=z[_];L.emit({originalEvent:G,type:le,position:X})}},i=function(L){return L.shiftKey||L.metaKey||L.ctrlKey},o=function(L,z){var G=!0;if(t.cy.hasCompoundNodes()&&L&&L.pannable())for(var X=0;z&&X<z.length;X++){var L=z[X];if(L.isNode()&&L.isParent()&&!L.pannable()){G=!1;break}}else G=!0;return G},s=function(L){L[0]._private.rscratch.inDragLayer=!0},u=function(L){L[0]._private.rscratch.inDragLayer=!1},l=function(L){L[0]._private.rscratch.isGrabTarget=!0},f=function(L){L[0]._private.rscratch.isGrabTarget=!1},v=function(L,z){var G=z.addToList,X=G.has(L);!X&&L.grabbable()&&!L.locked()&&(G.merge(L),vm(L))},c=function(L,z){if(L.cy().hasCompoundNodes()&&!(z.inDragLayer==null&&z.addToList==null)){var G=L.descendants();z.inDragLayer&&(G.forEach(s),G.connectedEdges().forEach(s)),z.addToList&&v(G,z)}},h=function(L,z){z=z||{};var G=L.cy().hasCompoundNodes();z.inDragLayer&&(L.forEach(s),L.neighborhood().stdFilter(function(X){return!G||X.isEdge()}).forEach(s)),z.addToList&&L.forEach(function(X){v(X,z)}),c(L,z),m(L,{inDragLayer:z.inDragLayer}),t.updateCachedGrabbedEles()},d=h,g=function(L){L&&(t.getCachedZSortedEles().forEach(function(z){cm(z),u(z),f(z)}),t.updateCachedGrabbedEles())},m=function(L,z){if(!(z.inDragLayer==null&&z.addToList==null)&&L.cy().hasCompoundNodes()){var G=L.ancestors().orphans();if(!G.same(L)){var X=G.descendants().spawnSelf().merge(G).unmerge(L).unmerge(L.descendants()),_=X.connectedEdges();z.inDragLayer&&(_.forEach(s),X.forEach(s)),z.addToList&&X.forEach(function(le){v(le,z)})}}},p=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},y=typeof MutationObserver<"u",b=typeof ResizeObserver<"u";y?(t.removeObserver=new MutationObserver(function(Y){for(var L=0;L<Y.length;L++){var z=Y[L],G=z.removedNodes;if(G)for(var X=0;X<G.length;X++){var _=G[X];if(_===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(Y){t.destroy()});var E=un(function(){t.cy.resize()},100);y&&(t.styleObserver=new MutationObserver(E),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",E),b&&(t.resizeObserver=new ResizeObserver(E),t.resizeObserver.observe(t.container));var C=function(L,z){for(;L!=null;)z(L),L=L.parentNode},A=function(){t.invalidateContainerClientCoordsCache()};C(t.container,function(Y){t.registerBinding(Y,"transitionend",A),t.registerBinding(Y,"animationend",A),t.registerBinding(Y,"scroll",A)}),t.registerBinding(t.container,"contextmenu",function(Y){Y.preventDefault()});var D=function(){return t.selection[4]!==0},N=function(L){for(var z=t.findContainerClientCoords(),G=z[0],X=z[1],_=z[2],le=z[3],re=L.touches?L.touches:[L],ae=!1,ie=0;ie<re.length;ie++){var fe=re[ie];if(G<=fe.clientX&&fe.clientX<=G+_&&X<=fe.clientY&&fe.clientY<=X+le){ae=!0;break}}if(!ae)return!1;for(var ue=t.container,me=L.target,ge=me.parentNode,ye=!1;ge;){if(ge===ue){ye=!0;break}ge=ge.parentNode}return!!ye};t.registerBinding(t.container,"mousedown",function(L){if(N(L)&&!(t.hoverData.which===1&&L.which!==1)){L.preventDefault(),p(),t.hoverData.capture=!0,t.hoverData.which=L.which;var z=t.cy,G=[L.clientX,L.clientY],X=t.projectIntoViewport(G[0],G[1]),_=t.selection,le=t.findNearestElements(X[0],X[1],!0,!1),re=le[0],ae=t.dragData.possibleDragElements;t.hoverData.mdownPos=X,t.hoverData.mdownGPos=G;var ie=function(ce){return{originalEvent:L,type:ce,position:{x:X[0],y:X[1]}}},fe=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var ce=t.hoverData.down;ce?ce.emit(ie("taphold")):z.emit(ie("taphold"))}},t.tapholdDuration)};if(L.which==3){t.hoverData.cxtStarted=!0;var ue={originalEvent:L,type:"cxttapstart",position:{x:X[0],y:X[1]}};re?(re.activate(),re.emit(ue),t.hoverData.down=re):z.emit(ue),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(L.which==1){re&&re.activate();{if(re!=null&&t.nodeIsGrabbable(re)){var me=function(ce){ce.emit(ie("grab"))};if(l(re),!re.selected())ae=t.dragData.possibleDragElements=z.collection(),d(re,{addToList:ae}),re.emit(ie("grabon")).emit(ie("grab"));else{ae=t.dragData.possibleDragElements=z.collection();var ge=z.$(function(ye){return ye.isNode()&&ye.selected()&&t.nodeIsGrabbable(ye)});h(ge,{addToList:ae}),re.emit(ie("grabon")),ge.forEach(me)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=re,t.hoverData.downs=le,t.hoverData.downTime=new Date().getTime()}n(re,["mousedown","tapstart","vmousedown"],L,{x:X[0],y:X[1]}),re==null?(_[4]=1,t.data.bgActivePosistion={x:X[0],y:X[1]},t.redrawHint("select",!0),t.redraw()):re.pannable()&&(_[4]=1),fe()}_[0]=_[2]=X[0],_[1]=_[3]=X[1]}},!1);var O=a(t.container);t.registerBinding([e,O],"mousemove",function(L){var z=t.hoverData.capture;if(!(!z&&!N(L))){var G=!1,X=t.cy,_=X.zoom(),le=[L.clientX,L.clientY],re=t.projectIntoViewport(le[0],le[1]),ae=t.hoverData.mdownPos,ie=t.hoverData.mdownGPos,fe=t.selection,ue=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(ue=t.findNearestElement(re[0],re[1],!0,!1));var me=t.hoverData.last,ge=t.hoverData.down,ye=[re[0]-fe[2],re[1]-fe[3]],ce=t.dragData.possibleDragElements,Ae;if(ie){var Te=le[0]-ie[0],Me=Te*Te,Fe=le[1]-ie[1],Be=Fe*Fe,Ye=Me+Be;t.hoverData.isOverThresholdDrag=Ae=Ye>=t.desktopTapThreshold2}var ke=i(L);Ae&&(t.hoverData.tapholdCancelled=!0);var ze=function(){var gt=t.hoverData.dragDelta=t.hoverData.dragDelta||[];gt.length===0?(gt.push(ye[0]),gt.push(ye[1])):(gt[0]+=ye[0],gt[1]+=ye[1])};G=!0,n(ue,["mousemove","vmousemove","tapdrag"],L,{x:re[0],y:re[1]});var qe=function(gt){return{originalEvent:L,type:gt,position:{x:re[0],y:re[1]}}},We=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||X.emit(qe("boxstart")),fe[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Ae){var Je=qe("cxtdrag");ge?ge.emit(Je):X.emit(Je),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||ue!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(qe("cxtdragout")),t.hoverData.cxtOver=ue,ue&&ue.emit(qe("cxtdragover")))}}else if(t.hoverData.dragging){if(G=!0,X.panningEnabled()&&X.userPanningEnabled()){var ut;if(t.hoverData.justStartedPan){var cr=t.hoverData.mdownPos;ut={x:(re[0]-cr[0])*_,y:(re[1]-cr[1])*_},t.hoverData.justStartedPan=!1}else ut={x:ye[0]*_,y:ye[1]*_};X.panBy(ut),X.emit(qe("dragpan")),t.hoverData.dragged=!0}re=t.projectIntoViewport(L.clientX,L.clientY)}else if(fe[4]==1&&(ge==null||ge.pannable())){if(Ae){if(!t.hoverData.dragging&&X.boxSelectionEnabled()&&(ke||!X.panningEnabled()||!X.userPanningEnabled()))We();else if(!t.hoverData.selecting&&X.panningEnabled()&&X.userPanningEnabled()){var Pt=o(ge,t.hoverData.downs);Pt&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,fe[4]=0,t.data.bgActivePosistion=fa(ae),t.redrawHint("select",!0),t.redraw())}ge&&ge.pannable()&&ge.active()&&ge.unactivate()}}else{if(ge&&ge.pannable()&&ge.active()&&ge.unactivate(),(!ge||!ge.grabbed())&&ue!=me&&(me&&n(me,["mouseout","tapdragout"],L,{x:re[0],y:re[1]}),ue&&n(ue,["mouseover","tapdragover"],L,{x:re[0],y:re[1]}),t.hoverData.last=ue),ge)if(Ae){if(X.boxSelectionEnabled()&&ke)ge&&ge.grabbed()&&(g(ce),ge.emit(qe("freeon")),ce.emit(qe("free")),t.dragData.didDrag&&(ge.emit(qe("dragfreeon")),ce.emit(qe("dragfree")))),We();else if(ge&&ge.grabbed()&&t.nodeIsDraggable(ge)){var ft=!t.dragData.didDrag;ft&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||h(ce,{inDragLayer:!0});var it={x:0,y:0};if(we(ye[0])&&we(ye[1])&&(it.x+=ye[0],it.y+=ye[1],ft)){var st=t.hoverData.dragDelta;st&&we(st[0])&&we(st[1])&&(it.x+=st[0],it.y+=st[1])}t.hoverData.draggingEles=!0,ce.silentShift(it).emit(qe("position")).emit(qe("drag")),t.redrawHint("drag",!0),t.redraw()}}else ze();G=!0}if(fe[2]=re[0],fe[3]=re[1],G)return L.stopPropagation&&L.stopPropagation(),L.preventDefault&&L.preventDefault(),!1}},!1);var R,P,w;t.registerBinding(e,"mouseup",function(L){if(!(t.hoverData.which===1&&L.which!==1&&t.hoverData.capture)){var z=t.hoverData.capture;if(z){t.hoverData.capture=!1;var G=t.cy,X=t.projectIntoViewport(L.clientX,L.clientY),_=t.selection,le=t.findNearestElement(X[0],X[1],!0,!1),re=t.dragData.possibleDragElements,ae=t.hoverData.down,ie=i(L);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ae&&ae.unactivate();var fe=function(Te){return{originalEvent:L,type:Te,position:{x:X[0],y:X[1]}}};if(t.hoverData.which===3){var ue=fe("cxttapend");if(ae?ae.emit(ue):G.emit(ue),!t.hoverData.cxtDragged){var me=fe("cxttap");ae?ae.emit(me):G.emit(me)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(n(le,["mouseup","tapend","vmouseup"],L,{x:X[0],y:X[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(n(ae,["click","tap","vclick"],L,{x:X[0],y:X[1]}),P=!1,L.timeStamp-w<=G.multiClickDebounceTime()?(R&&clearTimeout(R),P=!0,w=null,n(ae,["dblclick","dbltap","vdblclick"],L,{x:X[0],y:X[1]})):(R=setTimeout(function(){P||n(ae,["oneclick","onetap","voneclick"],L,{x:X[0],y:X[1]})},G.multiClickDebounceTime()),w=L.timeStamp)),ae==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!i(L)&&(G.$(r).unselect(["tapunselect"]),re.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=re=G.collection()),le==ae&&!t.dragData.didDrag&&!t.hoverData.selecting&&le!=null&&le._private.selectable&&(t.hoverData.dragging||(G.selectionType()==="additive"||ie?le.selected()?le.unselect(["tapunselect"]):le.select(["tapselect"]):ie||(G.$(r).unmerge(le).unselect(["tapunselect"]),le.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var ge=G.collection(t.getAllInBox(_[0],_[1],_[2],_[3]));t.redrawHint("select",!0),ge.length>0&&t.redrawHint("eles",!0),G.emit(fe("boxend"));var ye=function(Te){return Te.selectable()&&!Te.selected()};G.selectionType()==="additive"||ie||G.$(r).unmerge(ge).unselect(),ge.emit(fe("box")).stdFilter(ye).select().emit(fe("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!_[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var ce=ae&&ae.grabbed();g(re),ce&&(ae.emit(fe("freeon")),re.emit(fe("free")),t.dragData.didDrag&&(ae.emit(fe("dragfreeon")),re.emit(fe("dragfree"))))}}_[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var x=[],T=4,M,S=1e5,I=function(L,z){for(var G=0;G<L.length;G++)if(L[G]%z!==0)return!1;return!0},B=function(L){for(var z=Math.abs(L[0]),G=1;G<L.length;G++)if(Math.abs(L[G])!==z)return!1;return!0},V=function(L){var z=!1,G=L.deltaY;if(G==null&&(L.wheelDeltaY!=null?G=L.wheelDeltaY/4:L.wheelDelta!=null&&(G=L.wheelDelta/4)),G!==0){if(M==null)if(x.length>=T){var X=x;if(M=I(X,5),!M){var _=Math.abs(X[0]);M=B(X)&&_>5}if(M)for(var le=0;le<X.length;le++)S=Math.min(Math.abs(X[le]),S)}else x.push(G),z=!0;else M&&(S=Math.min(Math.abs(G),S));if(!t.scrollingPage){var re=t.cy,ae=re.zoom(),ie=re.pan(),fe=t.projectIntoViewport(L.clientX,L.clientY),ue=[fe[0]*ae+ie.x,fe[1]*ae+ie.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||D()){L.preventDefault();return}if(re.panningEnabled()&&re.userPanningEnabled()&&re.zoomingEnabled()&&re.userZoomingEnabled()){L.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var me;z&&Math.abs(G)>5&&(G=zs(G)*5),me=G/-250,M&&(me/=S,me*=3),me=me*t.wheelSensitivity;var ge=L.deltaMode===1;ge&&(me*=33);var ye=re.zoom()*Math.pow(10,me);L.type==="gesturechange"&&(ye=t.gestureStartZoom*L.scale),re.zoom({level:ye,renderedPosition:{x:ue[0],y:ue[1]}}),re.emit({type:L.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:L,position:{x:fe[0],y:fe[1]}})}}}};t.registerBinding(t.container,"wheel",V,!0),t.registerBinding(e,"scroll",function(L){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(L){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||L.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(Y){t.hasTouchStarted||V(Y)},!0),t.registerBinding(t.container,"mouseout",function(L){var z=t.projectIntoViewport(L.clientX,L.clientY);t.cy.emit({originalEvent:L,type:"mouseout",position:{x:z[0],y:z[1]}})},!1),t.registerBinding(t.container,"mouseover",function(L){var z=t.projectIntoViewport(L.clientX,L.clientY);t.cy.emit({originalEvent:L,type:"mouseover",position:{x:z[0],y:z[1]}})},!1);var F,k,U,J,W,Q,Z,H,j,$,q,K,ee,ne=function(L,z,G,X){return Math.sqrt((G-L)*(G-L)+(X-z)*(X-z))},te=function(L,z,G,X){return(G-L)*(G-L)+(X-z)*(X-z)},be;t.registerBinding(t.container,"touchstart",be=function(L){if(t.hasTouchStarted=!0,!!N(L)){p(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var z=t.cy,G=t.touchData.now,X=t.touchData.earlier;if(L.touches[0]){var _=t.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);G[0]=_[0],G[1]=_[1]}if(L.touches[1]){var _=t.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);G[2]=_[0],G[3]=_[1]}if(L.touches[2]){var _=t.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);G[4]=_[0],G[5]=_[1]}var le=function(ke){return{originalEvent:L,type:ke,position:{x:G[0],y:G[1]}}};if(L.touches[1]){t.touchData.singleTouchMoved=!0,g(t.dragData.touchDragEles);var re=t.findContainerClientCoords();j=re[0],$=re[1],q=re[2],K=re[3],F=L.touches[0].clientX-j,k=L.touches[0].clientY-$,U=L.touches[1].clientX-j,J=L.touches[1].clientY-$,ee=0<=F&&F<=q&&0<=U&&U<=q&&0<=k&&k<=K&&0<=J&&J<=K;var ae=z.pan(),ie=z.zoom();W=ne(F,k,U,J),Q=te(F,k,U,J),Z=[(F+U)/2,(k+J)/2],H=[(Z[0]-ae.x)/ie,(Z[1]-ae.y)/ie];var fe=200,ue=fe*fe;if(Q<ue&&!L.touches[2]){var me=t.findNearestElement(G[0],G[1],!0,!0),ge=t.findNearestElement(G[2],G[3],!0,!0);me&&me.isNode()?(me.activate().emit(le("cxttapstart")),t.touchData.start=me):ge&&ge.isNode()?(ge.activate().emit(le("cxttapstart")),t.touchData.start=ge):z.emit(le("cxttapstart")),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(L.touches[2])z.boxSelectionEnabled()&&L.preventDefault();else if(!L.touches[1]){if(L.touches[0]){var ye=t.findNearestElements(G[0],G[1],!0,!0),ce=ye[0];if(ce!=null&&(ce.activate(),t.touchData.start=ce,t.touchData.starts=ye,t.nodeIsGrabbable(ce))){var Ae=t.dragData.touchDragEles=z.collection(),Te=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),ce.selected()?(Te=z.$(function(Ye){return Ye.selected()&&t.nodeIsGrabbable(Ye)}),h(Te,{addToList:Ae})):d(ce,{addToList:Ae}),l(ce),ce.emit(le("grabon")),Te?Te.forEach(function(Ye){Ye.emit(le("grab"))}):ce.emit(le("grab"))}n(ce,["touchstart","tapstart","vmousedown"],L,{x:G[0],y:G[1]}),ce==null&&(t.data.bgActivePosistion={x:_[0],y:_[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&n(t.touchData.start,["taphold"],L,{x:G[0],y:G[1]})},t.tapholdDuration)}}if(L.touches.length>=1){for(var Me=t.touchData.startPosition=[null,null,null,null,null,null],Fe=0;Fe<G.length;Fe++)Me[Fe]=X[Fe]=G[Fe];var Be=L.touches[0];t.touchData.startGPosition=[Be.clientX,Be.clientY]}}},!1);var Se;t.registerBinding(e,"touchmove",Se=function(L){var z=t.touchData.capture;if(!(!z&&!N(L))){var G=t.selection,X=t.cy,_=t.touchData.now,le=t.touchData.earlier,re=X.zoom();if(L.touches[0]){var ae=t.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);_[0]=ae[0],_[1]=ae[1]}if(L.touches[1]){var ae=t.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);_[2]=ae[0],_[3]=ae[1]}if(L.touches[2]){var ae=t.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);_[4]=ae[0],_[5]=ae[1]}var ie=function(jc){return{originalEvent:L,type:jc,position:{x:_[0],y:_[1]}}},fe=t.touchData.startGPosition,ue;if(z&&L.touches[0]&&fe){for(var me=[],ge=0;ge<_.length;ge++)me[ge]=_[ge]-le[ge];var ye=L.touches[0].clientX-fe[0],ce=ye*ye,Ae=L.touches[0].clientY-fe[1],Te=Ae*Ae,Me=ce+Te;ue=Me>=t.touchTapThreshold2}if(z&&t.touchData.cxt){L.preventDefault();var Fe=L.touches[0].clientX-j,Be=L.touches[0].clientY-$,Ye=L.touches[1].clientX-j,ke=L.touches[1].clientY-$,ze=te(Fe,Be,Ye,ke),qe=ze/Q,We=150,Je=We*We,ut=1.5,cr=ut*ut;if(qe>=cr||ze>=Je){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Pt=ie("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(Pt),t.touchData.start=null):X.emit(Pt)}}if(z&&t.touchData.cxt){var Pt=ie("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Pt):X.emit(Pt),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var ft=t.findNearestElement(_[0],_[1],!0,!0);(!t.touchData.cxtOver||ft!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(ie("cxtdragout")),t.touchData.cxtOver=ft,ft&&ft.emit(ie("cxtdragover")))}else if(z&&L.touches[2]&&X.boxSelectionEnabled())L.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||X.emit(ie("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,G[4]=1,!G||G.length===0||G[0]===void 0?(G[0]=(_[0]+_[2]+_[4])/3,G[1]=(_[1]+_[3]+_[5])/3,G[2]=(_[0]+_[2]+_[4])/3+1,G[3]=(_[1]+_[3]+_[5])/3+1):(G[2]=(_[0]+_[2]+_[4])/3,G[3]=(_[1]+_[3]+_[5])/3),t.redrawHint("select",!0),t.redraw();else if(z&&L.touches[1]&&!t.touchData.didSelect&&X.zoomingEnabled()&&X.panningEnabled()&&X.userZoomingEnabled()&&X.userPanningEnabled()){L.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var it=t.dragData.touchDragEles;if(it){t.redrawHint("drag",!0);for(var st=0;st<it.length;st++){var Kt=it[st]._private;Kt.grabbed=!1,Kt.rscratch.inDragLayer=!1}}var gt=t.touchData.start,Fe=L.touches[0].clientX-j,Be=L.touches[0].clientY-$,Ye=L.touches[1].clientX-j,ke=L.touches[1].clientY-$,ar=ne(Fe,Be,Ye,ke),En=ar/W;if(ee){var Na=Fe-F,xn=Be-k,Ra=Ye-U,Ri=ke-J,Pa=(Na+Ra)/2,Tn=(xn+Ri)/2,hr=X.zoom(),Br=hr*En,kr=X.pan(),vt=H[0]*hr+kr.x,Ve=H[1]*hr+kr.y,_e={x:-Br/hr*(vt-kr.x-Pa)+vt,y:-Br/hr*(Ve-kr.y-Tn)+Ve};if(gt&&gt.active()){var it=t.dragData.touchDragEles;g(it),t.redrawHint("drag",!0),t.redrawHint("eles",!0),gt.unactivate().emit(ie("freeon")),it.emit(ie("free")),t.dragData.didDrag&&(gt.emit(ie("dragfreeon")),it.emit(ie("dragfree")))}X.viewport({zoom:Br,pan:_e,cancelOnFailedZoom:!0}),X.emit(ie("pinchzoom")),W=ar,F=Fe,k=Be,U=Ye,J=ke,t.pinching=!0}if(L.touches[0]){var ae=t.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);_[0]=ae[0],_[1]=ae[1]}if(L.touches[1]){var ae=t.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);_[2]=ae[0],_[3]=ae[1]}if(L.touches[2]){var ae=t.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);_[4]=ae[0],_[5]=ae[1]}}else if(L.touches[0]&&!t.touchData.didSelect){var ct=t.touchData.start,Mt=t.touchData.last,ft;if(!t.hoverData.draggingEles&&!t.swipePanning&&(ft=t.findNearestElement(_[0],_[1],!0,!0)),z&&ct!=null&&L.preventDefault(),z&&ct!=null&&t.nodeIsDraggable(ct))if(ue){var it=t.dragData.touchDragEles,yl=!t.dragData.didDrag;yl&&h(it,{inDragLayer:!0}),t.dragData.didDrag=!0;var Oa={x:0,y:0};if(we(me[0])&&we(me[1])&&(Oa.x+=me[0],Oa.y+=me[1],yl)){t.redrawHint("eles",!0);var Yt=t.touchData.dragDelta;Yt&&we(Yt[0])&&we(Yt[1])&&(Oa.x+=Yt[0],Oa.y+=Yt[1])}t.hoverData.draggingEles=!0,it.silentShift(Oa).emit(ie("position")).emit(ie("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==le[0]&&t.touchData.startPosition[1]==le[1]&&t.redrawHint("eles",!0),t.redraw()}else{var Yt=t.touchData.dragDelta=t.touchData.dragDelta||[];Yt.length===0?(Yt.push(me[0]),Yt.push(me[1])):(Yt[0]+=me[0],Yt[1]+=me[1])}if(n(ct||ft,["touchmove","tapdrag","vmousemove"],L,{x:_[0],y:_[1]}),(!ct||!ct.grabbed())&&ft!=Mt&&(Mt&&Mt.emit(ie("tapdragout")),ft&&ft.emit(ie("tapdragover"))),t.touchData.last=ft,z)for(var st=0;st<_.length;st++)_[st]&&t.touchData.startPosition[st]&&ue&&(t.touchData.singleTouchMoved=!0);if(z&&(ct==null||ct.pannable())&&X.panningEnabled()&&X.userPanningEnabled()){var Jc=o(ct,t.touchData.starts);Jc&&(L.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=fa(t.touchData.startPosition)),t.swipePanning?(X.panBy({x:me[0]*re,y:me[1]*re}),X.emit(ie("dragpan"))):ue&&(t.swipePanning=!0,X.panBy({x:ye*re,y:Ae*re}),X.emit(ie("dragpan")),ct&&(ct.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ae=t.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);_[0]=ae[0],_[1]=ae[1]}}for(var ge=0;ge<_.length;ge++)le[ge]=_[ge];z&&L.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var ve;t.registerBinding(e,"touchcancel",ve=function(L){var z=t.touchData.start;t.touchData.capture=!1,z&&z.unactivate()});var oe,he,se,pe;if(t.registerBinding(e,"touchend",oe=function(L){var z=t.touchData.start,G=t.touchData.capture;if(G)L.touches.length===0&&(t.touchData.capture=!1),L.preventDefault();else return;var X=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var _=t.cy,le=_.zoom(),re=t.touchData.now,ae=t.touchData.earlier;if(L.touches[0]){var ie=t.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);re[0]=ie[0],re[1]=ie[1]}if(L.touches[1]){var ie=t.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);re[2]=ie[0],re[3]=ie[1]}if(L.touches[2]){var ie=t.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);re[4]=ie[0],re[5]=ie[1]}var fe=function(Je){return{originalEvent:L,type:Je,position:{x:re[0],y:re[1]}}};z&&z.unactivate();var ue;if(t.touchData.cxt){if(ue=fe("cxttapend"),z?z.emit(ue):_.emit(ue),!t.touchData.cxtDragged){var me=fe("cxttap");z?z.emit(me):_.emit(me)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!L.touches[2]&&_.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var ge=_.collection(t.getAllInBox(X[0],X[1],X[2],X[3]));X[0]=void 0,X[1]=void 0,X[2]=void 0,X[3]=void 0,X[4]=0,t.redrawHint("select",!0),_.emit(fe("boxend"));var ye=function(Je){return Je.selectable()&&!Je.selected()};ge.emit(fe("box")).stdFilter(ye).select().emit(fe("boxselect")),ge.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(z?.unactivate(),L.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!L.touches[1]){if(!L.touches[0]){if(!L.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ce=t.dragData.touchDragEles;if(z!=null){var Ae=z._private.grabbed;g(ce),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ae&&(z.emit(fe("freeon")),ce.emit(fe("free")),t.dragData.didDrag&&(z.emit(fe("dragfreeon")),ce.emit(fe("dragfree")))),n(z,["touchend","tapend","vmouseup","tapdragout"],L,{x:re[0],y:re[1]}),z.unactivate(),t.touchData.start=null}else{var Te=t.findNearestElement(re[0],re[1],!0,!0);n(Te,["touchend","tapend","vmouseup","tapdragout"],L,{x:re[0],y:re[1]})}var Me=t.touchData.startPosition[0]-re[0],Fe=Me*Me,Be=t.touchData.startPosition[1]-re[1],Ye=Be*Be,ke=Fe+Ye,ze=ke*le*le;t.touchData.singleTouchMoved||(z||_.$(":selected").unselect(["tapunselect"]),n(z,["tap","vclick"],L,{x:re[0],y:re[1]}),he=!1,L.timeStamp-pe<=_.multiClickDebounceTime()?(se&&clearTimeout(se),he=!0,pe=null,n(z,["dbltap","vdblclick"],L,{x:re[0],y:re[1]})):(se=setTimeout(function(){he||n(z,["onetap","voneclick"],L,{x:re[0],y:re[1]})},_.multiClickDebounceTime()),pe=L.timeStamp)),z!=null&&!t.dragData.didDrag&&z._private.selectable&&ze<t.touchTapThreshold2&&!t.pinching&&(_.selectionType()==="single"?(_.$(r).unmerge(z).unselect(["tapunselect"]),z.select(["tapselect"])):z.selected()?z.unselect(["tapunselect"]):z.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var qe=0;qe<re.length;qe++)ae[qe]=re[qe];t.dragData.didDrag=!1,L.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),L.touches.length<2&&(L.touches.length===1&&(t.touchData.startGPosition=[L.touches[0].clientX,L.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var de=[],Ee=function(L){return{clientX:L.clientX,clientY:L.clientY,force:1,identifier:L.pointerId,pageX:L.pageX,pageY:L.pageY,radiusX:L.width/2,radiusY:L.height/2,screenX:L.screenX,screenY:L.screenY,target:L.target}},xe=function(L){return{event:L,touch:Ee(L)}},De=function(L){de.push(xe(L))},Oe=function(L){for(var z=0;z<de.length;z++){var G=de[z];if(G.event.pointerId===L.pointerId){de.splice(z,1);return}}},Pe=function(L){var z=de.filter(function(G){return G.event.pointerId===L.pointerId})[0];z.event=L,z.touch=Ee(L)},Ie=function(L){L.touches=de.map(function(z){return z.touch})},Ne=function(L){return L.pointerType==="mouse"||L.pointerType===4};t.registerBinding(t.container,"pointerdown",function(Y){Ne(Y)||(Y.preventDefault(),De(Y),Ie(Y),be(Y))}),t.registerBinding(t.container,"pointerup",function(Y){Ne(Y)||(Oe(Y),Ie(Y),oe(Y))}),t.registerBinding(t.container,"pointercancel",function(Y){Ne(Y)||(Oe(Y),Ie(Y),ve(Y))}),t.registerBinding(t.container,"pointermove",function(Y){Ne(Y)||(Y.preventDefault(),Pe(Y),Ie(Y),Se(Y))})}};var ur={};ur.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,o,s,u){this.renderer.nodeShapeImpl("polygon",a,n,i,o,s,this.points)},intersectLine:function(a,n,i,o,s,u,l,f){return Qa(s,u,this.points,a,n,i/2,o/2,l)},checkPoint:function(a,n,i,o,s,u,l,f){return sr(a,n,this.points,u,l,o,s,[0,-1],i)},hasMiterBounds:t!=="rectangle",miterBounds:function(a,n,i,o,s,u){return Fd(this.points,a,n,i,o,s)}}};ur.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){return Wd(i,o,e,r,a/2+s,n/2+s)},checkPoint:function(e,r,a,n,i,o,s,u){return Yr(e,r,n,i,o,s,a)}}};ur.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,n,i,o,s,u,l){if(u[l]!==void 0&&u[l+"-cx"]===a&&u[l+"-cy"]===n)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=a,u[l+"-cy"]=n;var f=i/2,v=o/2;s=s==="auto"?mv(i,o):s;for(var c=new Array(e.length/2),h=0;h<e.length/2;h++)c[h]={x:a+f*e[h*2],y:n+v*e[h*2+1]};var d,g,m,p,y=c.length;for(g=c[y-1],d=0;d<y;d++)m=c[d%y],p=c[(d+1)%y],u[l][d]=Qs(g,m,p,s),g=m,m=p;return u[l]},draw:function(a,n,i,o,s,u,l){this.renderer.nodeShapeImpl("round-polygon",a,n,i,o,s,this.points,this.getOrCreateCorners(n,i,o,s,u,l,"drawCorners"))},intersectLine:function(a,n,i,o,s,u,l,f,v){return $d(s,u,this.points,a,n,i,o,l,this.getOrCreateCorners(a,n,i,o,f,v,"corners"))},checkPoint:function(a,n,i,o,s,u,l,f,v){return Yd(a,n,this.points,u,l,o,s,this.getOrCreateCorners(u,l,o,s,f,v,"corners"))}}};ur.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Ot(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){return pv(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){var l=n/2,f=i/2;u=u==="auto"?Cr(n,i):u,u=Math.min(l,f,u);var v=u*2;return!!(sr(e,r,this.points,o,s,n,i-v,[0,-1],a)||sr(e,r,this.points,o,s,n-v,i,[0,-1],a)||Yr(e,r,v,v,o-l+u,s-f+u,a)||Yr(e,r,v,v,o+l-u,s-f+u,a)||Yr(e,r,v,v,o+l-u,s+f-u,a)||Yr(e,r,v,v,o-l+u,s+f-u,a))}}};ur.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Gs(),points:Ot(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,null,o)},generateCutTrianglePts:function(e,r,a,n,i){var o=i==="auto"?this.cornerLength:i,s=r/2,u=e/2,l=a-u,f=a+u,v=n-s,c=n+s;return{topLeft:[l,v+o,l+o,v,l+o,v+o],topRight:[f-o,v,f,v+o,f-o,v+o],bottomRight:[f,c-o,f-o,c,f-o,c-o],bottomLeft:[l+o,c,l,c-o,l+o,c-o]}},intersectLine:function(e,r,a,n,i,o,s,u){var l=this.generateCutTrianglePts(a+2*s,n+2*s,e,r,u),f=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Qa(i,o,f,e,r)},checkPoint:function(e,r,a,n,i,o,s,u){var l=u==="auto"?this.cornerLength:u;if(sr(e,r,this.points,o,s,n,i-2*l,[0,-1],a)||sr(e,r,this.points,o,s,n-2*l,i,[0,-1],a))return!0;var f=this.generateCutTrianglePts(n,i,o,s);return Ft(e,r,f.topLeft)||Ft(e,r,f.topRight)||Ft(e,r,f.bottomRight)||Ft(e,r,f.bottomLeft)}}};ur.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Ot(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){var l=.15,f=.5,v=.85,c=this.generateBarrelBezierPts(a+2*s,n+2*s,e,r),h=function(m){var p=ha({x:m[0],y:m[1]},{x:m[2],y:m[3]},{x:m[4],y:m[5]},l),y=ha({x:m[0],y:m[1]},{x:m[2],y:m[3]},{x:m[4],y:m[5]},f),b=ha({x:m[0],y:m[1]},{x:m[2],y:m[3]},{x:m[4],y:m[5]},v);return[m[0],m[1],p.x,p.y,y.x,y.y,b.x,b.y,m[4],m[5]]},d=[].concat(h(c.topLeft),h(c.topRight),h(c.bottomRight),h(c.bottomLeft));return Qa(i,o,d,e,r)},generateBarrelBezierPts:function(e,r,a,n){var i=r/2,o=e/2,s=a-o,u=a+o,l=n-i,f=n+i,v=cs(e,r),c=v.heightOffset,h=v.widthOffset,d=v.ctrlPtOffsetPct*e,g={topLeft:[s,l+c,s+d,l,s+h,l],topRight:[u-h,l,u-d,l,u,l+c],bottomRight:[u,f-c,u-d,f,u-h,f],bottomLeft:[s+h,f,s+d,f,s,f-c]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,r,a,n,i,o,s,u){var l=cs(n,i),f=l.heightOffset,v=l.widthOffset;if(sr(e,r,this.points,o,s,n,i-2*f,[0,-1],a)||sr(e,r,this.points,o,s,n-2*v,i,[0,-1],a))return!0;for(var c=this.generateBarrelBezierPts(n,i,o,s),h=function(N,O,R){var P=R[4],w=R[2],x=R[0],T=R[5],M=R[1],S=Math.min(P,x),I=Math.max(P,x),B=Math.min(T,M),V=Math.max(T,M);if(S<=N&&N<=I&&B<=O&&O<=V){var F=Kd(P,w,x),k=Gd(F[0],F[1],F[2],N),U=k.filter(function(J){return 0<=J&&J<=1});if(U.length>0)return U[0]}return null},d=Object.keys(c),g=0;g<d.length;g++){var m=d[g],p=c[m],y=h(e,r,p);if(y!=null){var b=p[5],E=p[3],C=p[1],A=Et(b,E,C,y);if(p.isTop&&A<=r||p.isBottom&&r<=A)return!0}}return!1}}};ur.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Ot(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){var l=e-(a/2+s),f=r-(n/2+s),v=f,c=e+(a/2+s),h=br(i,o,e,r,l,f,c,v,!1);return h.length>0?h:pv(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){u=u==="auto"?Cr(n,i):u;var l=2*u;if(sr(e,r,this.points,o,s,n,i-l,[0,-1],a)||sr(e,r,this.points,o,s,n-l,i,[0,-1],a))return!0;var f=n/2+2*a,v=i/2+2*a,c=[o-f,s-v,o-f,s,o+f,s,o+f,s-v];return!!(Ft(e,r,c)||Yr(e,r,l,l,o+n/2-u,s+i/2-u,a)||Yr(e,r,l,l,o-n/2+u,s+i/2-u,a))}}};ur.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Ot(3,0)),this.generateRoundPolygon("round-triangle",Ot(3,0)),this.generatePolygon("rectangle",Ot(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",Ot(5,0)),this.generateRoundPolygon("round-pentagon",Ot(5,0)),this.generatePolygon("hexagon",Ot(6,0)),this.generateRoundPolygon("round-hexagon",Ot(6,0)),this.generatePolygon("heptagon",Ot(7,0)),this.generateRoundPolygon("round-heptagon",Ot(7,0)),this.generatePolygon("octagon",Ot(8,0)),this.generateRoundPolygon("round-octagon",Ot(8,0));var a=new Array(20);{var n=vs(5,0),i=vs(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[s*2]*=o,i[s*2+1]*=o;for(var s=0;s<20/4;s++)a[s*4]=n[s*2],a[s*4+1]=n[s*2+1],a[s*4+2]=i[s*2],a[s*4+3]=i[s*2+1]}a=yv(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}t.makePolygon=function(l){var f=l.join("$"),v="polygon-"+f,c;return(c=this[v])?c:e.generatePolygon(v,l)}};var dn={};dn.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};dn.redraw=function(t){t=t||cv();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};dn.beforeRender=function(t,e){if(!this.destroyed){e==null&&nt("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,n){return n.priority-a.priority})}};var Rf=function(e,r,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(r,a)};dn.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function(n){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){Rf(t,!0,n);var i=or();t.render(t.renderOptions);var o=t.lastDrawTime=or();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var s=o-i;t.redrawTotalTime+=s,t.lastRedrawTime=s,t.averageRedrawTime=t.averageRedrawTime/2+s/2,t.requestedFrame=!1}else Rf(t,!1,n);t.skipFrame=!1,Zn(r)}};Zn(r)}};var hm=function(e){this.init(e)},bc=hm,Aa=bc.prototype;Aa.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Aa.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",u=n.getElementById(o)!=null;if(r.className.indexOf(s)<0&&(r.className=(r.className||"")+" "+s),!u){var l=n.createElement("style");l.id=o,l.textContent="."+s+" { position: relative; }",i.insertBefore(l,i.children[0])}var f=a.getComputedStyle(r),v=f.getPropertyValue("position");v==="static"&&Qe("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.webgl=t.webgl,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=we(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};Aa.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),t==="gc"&&r.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};Aa.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}};Aa.isHeadless=function(){return!1};[Zs,pc,yc,Da,ur,dn].forEach(function(t){Re(Aa,t)});var rs=1e3/60,wc={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=un(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),o=function(l,f){var v=or(),c=n.averageRedrawTime,h=n.lastRedrawTime,d=[],g=n.cy.extent(),m=n.getPixelRatio();for(l||n.flushRenderedStyleQueue();;){var p=or(),y=p-v,b=p-f;if(h<rs){var E=rs-(l?c:0);if(b>=e.deqFastCost*E)break}else if(l){if(y>=e.deqCost*h||y>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*rs)break;var C=e.deq(a,m,g);if(C.length>0)for(var A=0;A<C.length;A++)d.push(C[A]);else break}d.length>0&&(e.onDeqd(a,d),!l&&e.shouldRedraw(a,d,m,g)&&i())},s=e.priority||Bs;n.beforeRender(o,s(a))}}}},dm=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Qn;Mr(this,t),this.idsByKey=new ir,this.keyForId=new ir,this.cachesByLvl=new ir,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return Lr(t,[{key:"getIdsFor",value:function(r){r==null&&nt("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new xa,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new ir,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])})(),Pf=25,Bn=50,Xn=-4,Ss=3,Ec=7.99,gm=8,pm=1024,ym=1024,mm=1024,bm=.2,wm=.8,Em=10,xm=.15,Tm=.1,Cm=.9,Sm=.9,Dm=100,Am=1,ca={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Mm=Dt({getKey:null,doesEleInvalidateKey:Qn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:uv,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),qa=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=Mm(r);Re(a,n),a.lookup=new dm(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},bt=qa.prototype;bt.reasons=ca;bt.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};bt.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};bt.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new fn(function(r,a){return a.reqs-r.reqs});return e};bt.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};bt.getElement=function(t,e,r,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(Fs(s*r))),a<Xn)a=Xn;else if(s>=Ec||a>Ss)return null;var l=Math.pow(2,a),f=e.h*l,v=e.w*l,c=o.eleTextBiggerThanMin(t,l);if(!this.isVisible(t,c))return null;var h=u.get(t,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(f<=Pf?d=Pf:f<=Bn?d=Bn:d=Math.ceil(f/Bn)*Bn,f>mm||v>ym)return null;var g=i.getTextureQueue(d),m=g[g.length-2],p=function(){return i.recycleTexture(d,v)||i.addTexture(d,v)};m||(m=g[g.length-1]),m||(m=p()),m.width-m.usedWidth<v&&(m=p());for(var y=function(S){return S&&S.scaledLabelShown===c},b=n&&n===ca.dequeue,E=n&&n===ca.highQuality,C=n&&n===ca.downscale,A,D=a+1;D<=Ss;D++){var N=u.get(t,D);if(N){A=N;break}}var O=A&&A.level===a+1?A:null,R=function(){m.context.drawImage(O.texture.canvas,O.x,0,O.width,O.height,m.usedWidth,0,v,f)};if(m.context.setTransform(1,0,0,1,0,0),m.context.clearRect(m.usedWidth,0,v,d),y(O))R();else if(y(A))if(E){for(var P=A.level;P>a;P--)O=i.getElement(t,e,r,P,ca.downscale);R()}else return i.queueElement(t,A.level-1),A;else{var w;if(!b&&!E&&!C)for(var x=a-1;x>=Xn;x--){var T=u.get(t,x);if(T){w=T;break}}if(y(w))return i.queueElement(t,a),w;m.context.translate(m.usedWidth,0),m.context.scale(l,l),this.drawElement(m.context,t,e,c,!1),m.context.scale(1/l,1/l),m.context.translate(-m.usedWidth,0)}return h={x:m.usedWidth,texture:m,level:a,scale:l,width:v,height:f,scaledLabelShown:c},m.usedWidth+=Math.ceil(v+gm),m.eleCaches.push(h),u.set(t,a,h),i.checkTextureFullness(m),h};bt.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};bt.invalidateElement=function(t){var e=this,r=e.lookup,a=[],n=r.isInvalid(t);if(n){for(var i=Xn;i<=Ss;i++){var o=r.getForCachedKey(t,i);o&&a.push(o)}var s=r.invalidate(t);if(s)for(var u=0;u<a.length;u++){var l=a[u],f=l.texture;f.invalidatedWidth+=l.width,l.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(t)}};bt.checkTextureUtility=function(t){t.invalidatedWidth>=bm*t.width&&this.retireTexture(t)};bt.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>wm&&t.fullnessChecks>=Em?Tr(r,t):t.fullnessChecks++};bt.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;Tr(a,t),t.retired=!0;for(var i=t.eleCaches,o=0;o<i.length;o++){var s=i[o];n.deleteCache(s.key,s.level)}ks(i);var u=e.getRetiredTextureQueue(r);u.push(t)};bt.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),n={};return a.push(n),n.eleCaches=[],n.height=t,n.width=Math.max(pm,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=r.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};bt.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),n=r.getRetiredTextureQueue(t),i=0;i<n.length;i++){var o=n[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,ks(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Tr(n,o),a.push(o),o}};bt.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,a.updateItem(o);else{var s={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(s),n[i]=s}};bt.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o<Am&&r.size()>0;o++){var s=r.pop(),u=s.key,l=s.eles[0],f=i.hasCache(l,s.level);if(a[u]=null,f)continue;n.push(s);var v=e.getBoundingBox(l);e.getElement(l,v,t,s.level,ca.dequeue)}return n};bt.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=Is,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))};bt.onDequeue=function(t){this.onDequeues.push(t)};bt.offDequeue=function(t){Tr(this.onDequeues,t)};bt.setupDequeueing=wc.setupDequeueing({deqRedrawThreshold:Dm,deqCost:xm,deqAvgCost:Tm,deqNoDrawCost:Cm,deqFastCost:Sm,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(r)}},shouldRedraw:function(e,r,a,n){for(var i=0;i<r.length;i++)for(var o=r[i].eles,s=0;s<o.length;s++){var u=o[s].boundingBox();if(Vs(u,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Lm=1,Wa=-4,ii=2,Nm=3.99,Rm=50,Pm=50,Om=.15,Im=.1,Bm=.9,km=.9,Fm=1,Of=250,zm=4e3*4e3,If=32767,Vm=!0,xc=function(e){var r=this,a=r.renderer=e,n=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=or()-2*Of,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=un(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},Pm),a.beforeRender(function(o,s){s-r.lastInvalidationTime<=Of?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(s,u){return u.reqs-s.reqs};r.layersQueue=new fn(i),r.setupDequeueing()},At=xc.prototype,Bf=0,Gm=Math.pow(2,53)-1;At.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),n=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(a,n),o={id:Bf=++Bf%Gm,bb:t,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(r,r),s.translate(u,l),o};At.getLayers=function(t,e,r){var a=this,n=a.renderer,i=n.cy,o=i.zoom(),s=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(Fs(o*e)),r<Wa)r=Wa;else if(o>=Nm||r>ii)return null}a.validateLayersElesOrdering(r,t);var u=a.layersByLevel,l=Math.pow(2,r),f=u[r]=u[r]||[],v,c=a.levelIsComplete(r,t),h,d=function(){var R=function(M){if(a.validateLayersElesOrdering(M,t),a.levelIsComplete(M,t))return h=u[M],!0},P=function(M){if(!h)for(var S=r+M;Wa<=S&&S<=ii&&!R(S);S+=M);};P(1),P(-1);for(var w=f.length-1;w>=0;w--){var x=f[w];x.invalid&&Tr(f,x)}};if(!c)d();else return f;var g=function(){if(!v){v=Bt();for(var R=0;R<t.length;R++)Id(v,t[R].boundingBox())}return v},m=function(R){R=R||{};var P=R.after;g();var w=Math.ceil(v.w*l),x=Math.ceil(v.h*l);if(w>If||x>If)return null;var T=w*x;if(T>zm)return null;var M=a.makeLayer(v,r);if(P!=null){var S=f.indexOf(P)+1;f.splice(S,0,M)}else(R.insert===void 0||R.insert)&&f.unshift(M);return M};if(a.skipping&&!s)return null;for(var p=null,y=t.length/Lm,b=!s,E=0;E<t.length;E++){var C=t[E],A=C._private.rscratch,D=A.imgLayerCaches=A.imgLayerCaches||{},N=D[r];if(N){p=N;continue}if((!p||p.eles.length>=y||!gv(p.bb,C.boundingBox()))&&(p=m({insert:!0,after:p}),!p))return null;h||b?a.queueLayer(p,C):a.drawEleInLayer(p,C,r,e),p.eles.push(C),D[r]=p}return h||(b?null:f)};At.getEleLevelForLayerLevel=function(t,e){return t};At.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,o=t.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,r,Vm),i.setImgSmoothing(o,!0))};At.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var o=a[i];if(o.reqs>0||o.invalid)return!1;n+=o.eles.length}return n===e.length};At.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var n=r[a],i=-1,o=0;o<e.length;o++)if(n.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(n);continue}for(var s=i,o=0;o<n.eles.length;o++)if(n.eles[o]!==e[s+o]){this.invalidateLayer(n);break}}};At.updateElementsInLayers=function(t,e){for(var r=this,a=nn(t[0]),n=0;n<t.length;n++)for(var i=a?null:t[n],o=a?t[n]:t[n].ele,s=o._private.rscratch,u=s.imgLayerCaches=s.imgLayerCaches||{},l=Wa;l<=ii;l++){var f=u[l];f&&(i&&r.getEleLevelForLayerLevel(f.level)!==i.level||e(f,o,i))}};At.haveLayers=function(){for(var t=this,e=!1,r=Wa;r<=ii;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};At.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=or(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))};At.invalidateLayer=function(t){if(this.lastInvalidationTime=or(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];Tr(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};At.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,n,i){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})};At.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};At.queueLayer=function(t,e){var r=this,a=r.layersQueue,n=t.elesQueue,i=n.hasId=n.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}};At.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],n=0;n<Fm&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,t),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};At.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,n=r.indexOf(a);if(!(n<0||a.invalid)){r[n]=t;for(var i=0;i<t.eles.length;i++){var o=t.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[t.level]=t)}e.requestRedraw()}};At.requestRedraw=un(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);At.setupDequeueing=wc.setupDequeueing({deqRedrawThreshold:Rm,deqCost:Om,deqAvgCost:Im,deqNoDrawCost:Bm,deqFastCost:km,deq:function(e,r){return e.dequeue(r)},onDeqd:Bs,shouldRedraw:uv,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Tc={},kf;function Um(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function Hm(t,e,r){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function Ff(t,e,r){t.beginPath&&t.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];t.lineTo(i.x,i.y)}var o=r,s=r[0];t.moveTo(s.x,s.y);for(var n=1;n<o.length;n++){var i=o[n];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function qm(t,e,r,a,n){t.beginPath&&t.beginPath(),t.arc(r,a,n,0,Math.PI*2,!1);var i=e,o=i[0];t.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var u=i[s];t.lineTo(u.x,u.y)}t.closePath&&t.closePath()}function Ym(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}Tc.arrowShapeImpl=function(t){return(kf||(kf={polygon:Um,"triangle-backcurve":Hm,"triangle-tee":Ff,"circle-triangle":qm,"triangle-cross":Ff,circle:Ym}))[t]};var rr={};rr.drawElement=function(t,e,r,a,n,i){var o=this;e.isNode()?o.drawNode(t,e,r,a,n,i):o.drawEdge(t,e,r,a,n,i)};rr.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};rr.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};rr.drawCachedElementPortion=function(t,e,r,a,n,i,o,s){var u=this,l=r.getBoundingBox(e);if(!(l.w===0||l.h===0)){var f=r.getElement(e,l,a,n,i);if(f!=null){var v=s(u,e);if(v===0)return;var c=o(u,e),h=l.x1,d=l.y1,g=l.w,m=l.h,p,y,b,E,C;if(c!==0){var A=r.getRotationPoint(e);b=A.x,E=A.y,t.translate(b,E),t.rotate(c),C=u.getImgSmoothing(t),C||u.setImgSmoothing(t,!0);var D=r.getRotationOffset(e);p=D.x,y=D.y}else p=h,y=d;var N;v!==1&&(N=t.globalAlpha,t.globalAlpha=N*v),t.drawImage(f.texture.canvas,f.x,0,f.width,f.height,p,y,g,m),v!==1&&(t.globalAlpha=N),c!==0&&(t.rotate(-c),t.translate(-b,-E),C||u.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var Wm=function(){return 0},Xm=function(e,r){return e.getTextAngle(r,null)},$m=function(e,r){return e.getTextAngle(r,"source")},Km=function(e,r){return e.getTextAngle(r,"target")},_m=function(e,r){return r.effectiveOpacity()},as=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};rr.drawCachedElement=function(t,e,r,a,n,i){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,f=s.slbTxrCache,v=s.tlbTxrCache,c=e.boundingBox(),h=i===!0?u.reasons.highQuality:null;if(!(c.w===0||c.h===0||!e.visible())&&(!a||Vs(c,a))){var d=e.isEdge(),g=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,u,r,n,h,Wm,_m),(!d||!g)&&o.drawCachedElementPortion(t,e,l,r,n,h,Xm,as),d&&!g&&(o.drawCachedElementPortion(t,e,f,r,n,h,$m,as),o.drawCachedElementPortion(t,e,v,r,n,h,Km,as)),o.drawElementOverlay(t,e)}};rr.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var n=e[a];r.drawElement(t,n)}};rr.drawCachedElements=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];n.drawCachedElement(t,o,r,a)}};rr.drawCachedNodes=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&n.drawCachedElement(t,o,r,a)}};rr.drawLayeredElements=function(t,e,r,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,r);if(i)for(var o=0;o<i.length;o++){var s=i[o],u=s.bb;u.w===0||u.h===0||t.drawImage(s.canvas,u.x1,u.y1,u.w,u.h)}else n.drawCachedElements(t,e,r,a)};var fr={};fr.drawEdge=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,v=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,g=e.pstyle("line-outline-width").value,m=e.pstyle("line-outline-color").value,p=l*f,y=l*f,b=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;v==="straight-triangle"?(o.eleStrokeStyle(t,e,M),o.drawEdgeTrianglePath(e,t,s.allpts)):(t.lineWidth=h,t.lineCap=d,o.eleStrokeStyle(t,e,M),o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},E=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;if(t.lineWidth=h+g,t.lineCap=d,g>0)o.colorStrokeStyle(t,m[0],m[1],m[2],M);else{t.lineCap="butt";return}v==="straight-triangle"?o.drawEdgeTrianglePath(e,t,s.allpts):(o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},C=function(){n&&o.drawEdgeOverlay(t,e)},A=function(){n&&o.drawEdgeUnderlay(t,e)},D=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;o.drawArrowheads(t,e,M)},N=function(){o.drawElementText(t,e,null,a)};t.lineJoin="round";var O=e.pstyle("ghost").value==="yes";if(O){var R=e.pstyle("ghost-offset-x").pfValue,P=e.pstyle("ghost-offset-y").pfValue,w=e.pstyle("ghost-opacity").value,x=p*w;t.translate(R,P),b(x),D(x),t.translate(-R,-P)}else E();A(),b(),D(),C(),N(),r&&t.translate(u.x1,u.y1)}};var Cc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,o=i.usePaths(),s=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=l,s.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,s.allpts,"solid")}}}};fr.drawEdgeOverlay=Cc("overlay");fr.drawEdgeUnderlay=Cc("underlay");fr.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,o,s=!1,u=this.usePaths(),l=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(u){var v=r.join("$"),c=n.pathCacheKey&&n.pathCacheKey===v;c?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=v,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<r.length;h+=4)e.quadraticCurveTo(r[h],r[h+1],r[h+2],r[h+3]);break;case"straight":case"haystack":for(var d=2;d+1<r.length;d+=2)e.lineTo(r[d],r[d+1]);break;case"segments":if(n.isRound){var g=zt(n.roundCorners),m;try{for(g.s();!(m=g.n()).done;){var p=m.value;vc(e,p)}}catch(b){g.e(b)}finally{g.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var y=2;y+1<r.length;y+=2)e.lineTo(r[y],r[y+1]);break}e=i,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};fr.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,n=0;n+1<r.length;n+=2){var i=[r[n+2]-r[n],r[n+3]-r[n+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],u=[s[0]*a/2,s[1]*a/2];e.beginPath(),e.moveTo(r[n]-u[0],r[n+1]-u[1]),e.lineTo(r[n]+u[0],r[n+1]+u[1]),e.lineTo(r[n+2],r[n+3]),e.closePath(),e.fill()}};fr.drawArrowheads=function(t,e,r){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),n||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)};fr.drawArrowhead=function(t,e,r,a,n,i,o){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var s=this,u=e.pstyle(r+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(r+"-arrow-fill").value,v=e.pstyle("width").pfValue,c=e.pstyle(r+"-arrow-width"),h=c.value==="match-line"?v:c.pfValue;c.units==="%"&&(h*=v);var d=e.pstyle("opacity").value;o===void 0&&(o=d);var g=t.globalCompositeOperation;(o!==1||f==="hollow")&&(t.globalCompositeOperation="destination-out",s.colorFillStyle(t,255,255,255,1),s.colorStrokeStyle(t,255,255,255,1),s.drawArrowShape(e,t,l,v,u,h,a,n,i),t.globalCompositeOperation=g);var m=e.pstyle(r+"-arrow-color").value;s.colorFillStyle(t,m[0],m[1],m[2],o),s.colorStrokeStyle(t,m[0],m[1],m[2],o),s.drawArrowShape(e,t,f,v,u,h,a,n,i)}}};fr.drawArrowShape=function(t,e,r,a,n,i,o,s,u){var l=this,f=this.usePaths()&&n!=="triangle-cross",v=!1,c,h=e,d={x:o,y:s},g=t.pstyle("arrow-scale").value,m=this.getArrowWidth(a,g),p=l.arrowShapes[n];if(f){var y=l.arrowPathCache=l.arrowPathCache||[],b=Wr(n),E=y[b];E!=null?(c=e=E,v=!0):(c=e=new Path2D,y[b]=c)}v||(e.beginPath&&e.beginPath(),f?p.draw(e,1,0,{x:0,y:0},1):p.draw(e,m,u,d,a),e.closePath&&e.closePath()),e=h,f&&(e.translate(o,s),e.rotate(u),e.scale(m,m)),(r==="filled"||r==="both")&&(f?e.fill(c):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(f?m:1),e.lineJoin="miter",f?e.stroke(c):e.stroke()),f&&(e.scale(1/m,1/m),e.rotate(-u),e.translate(-o,-s))};var js={};js.safeDrawImage=function(t,e,r,a,n,i,o,s,u,l){if(!(n<=0||i<=0||u<=0||l<=0))try{t.drawImage(e,r,a,n,i,o,s,u,l)}catch(f){Qe(f)}};js.drawInscribedImage=function(t,e,r,a,n){var i=this,o=r.position(),s=o.x,u=o.y,l=r.cy().style(),f=l.getIndexedStyle.bind(l),v=f(r,"background-fit","value",a),c=f(r,"background-repeat","value",a),h=r.width(),d=r.height(),g=r.padding()*2,m=h+(f(r,"background-width-relative-to","value",a)==="inner"?0:g),p=d+(f(r,"background-height-relative-to","value",a)==="inner"?0:g),y=r._private.rscratch,b=f(r,"background-clip","value",a),E=b==="node",C=f(r,"background-image-opacity","value",a)*n,A=f(r,"background-image-smoothing","value",a),D=r.pstyle("corner-radius").value;D!=="auto"&&(D=r.pstyle("corner-radius").pfValue);var N=e.width||e.cachedW,O=e.height||e.cachedH;(N==null||O==null)&&(document.body.appendChild(e),N=e.cachedW=e.width||e.offsetWidth,O=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var R=N,P=O;if(f(r,"background-width","value",a)!=="auto"&&(f(r,"background-width","units",a)==="%"?R=f(r,"background-width","pfValue",a)*m:R=f(r,"background-width","pfValue",a)),f(r,"background-height","value",a)!=="auto"&&(f(r,"background-height","units",a)==="%"?P=f(r,"background-height","pfValue",a)*p:P=f(r,"background-height","pfValue",a)),!(R===0||P===0)){if(v==="contain"){var w=Math.min(m/R,p/P);R*=w,P*=w}else if(v==="cover"){var w=Math.max(m/R,p/P);R*=w,P*=w}var x=s-m/2,T=f(r,"background-position-x","units",a),M=f(r,"background-position-x","pfValue",a);T==="%"?x+=(m-R)*M:x+=M;var S=f(r,"background-offset-x","units",a),I=f(r,"background-offset-x","pfValue",a);S==="%"?x+=(m-R)*I:x+=I;var B=u-p/2,V=f(r,"background-position-y","units",a),F=f(r,"background-position-y","pfValue",a);V==="%"?B+=(p-P)*F:B+=F;var k=f(r,"background-offset-y","units",a),U=f(r,"background-offset-y","pfValue",a);k==="%"?B+=(p-P)*U:B+=U,y.pathCache&&(x-=s,B-=u,s=0,u=0);var J=t.globalAlpha;t.globalAlpha=C;var W=i.getImgSmoothing(t),Q=!1;if(A==="no"&&W?(i.setImgSmoothing(t,!1),Q=!0):A==="yes"&&!W&&(i.setImgSmoothing(t,!0),Q=!0),c==="no-repeat")E&&(t.save(),y.pathCache?t.clip(y.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,m,p,D,y),t.clip())),i.safeDrawImage(t,e,0,0,N,O,x,B,R,P),E&&t.restore();else{var Z=t.createPattern(e,c);t.fillStyle=Z,i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,m,p,D,y),t.translate(x,B),t.fill(),t.translate(-x,-B)}t.globalAlpha=J,Q&&i.setImgSmoothing(t,W)}};var Qr={};Qr.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(Fs(r*a));e=Math.pow(2,n)}var i=t.pstyle("font-size").pfValue*e,o=t.pstyle("min-zoomed-font-size").pfValue;return!(i<o)};Qr.drawElementText=function(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(e),l=e.pstyle("text-metrics").strValue==="glyph";t.textAlign=u,t.textBaseline=l?"alphabetic":"bottom"}else{var f=e.element()._private.rscratch.badLine,v=e.pstyle("label"),c=e.pstyle("source-label"),h=e.pstyle("target-label");if(f||(!v||!v.value)&&(!c||!c.value)&&(!h||!h.value))return;t.textAlign="center",t.textBaseline="bottom"}var d=!r,g;r&&(g=r,t.translate(-g.x1,-g.y1)),n==null?(o.drawText(t,e,null,d,i),e.isEdge()&&(o.drawText(t,e,"source",d,i),o.drawText(t,e,"target",d,i))):o.drawText(t,e,n,d,i),r&&t.translate(g.x1,g.y1)};Qr.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};Qr.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*s,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+o+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,l[0],l[1],l[2],s),this.colorStrokeStyle(t,f[0],f[1],f[2],u)};function Zm(t,e,r,a,n){var i=Math.min(a,n),o=i/2,s=e+a/2,u=r+n/2;t.beginPath(),t.arc(s,u,o,0,Math.PI*2),t.closePath()}function zf(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(i,a/2,n/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+a-o,r),t.quadraticCurveTo(e+a,r,e+a,r+o),t.lineTo(e+a,r+n-o),t.quadraticCurveTo(e+a,r+n,e+a-o,r+n),t.lineTo(e+o,r+n),t.quadraticCurveTo(e,r+n,e,r+n-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath()}Qr.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",o=t.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var s=It(n,"labelAngle",e);r=t.isEdge()?s:0}else o.strValue==="none"?r=0:r=o.pfValue;return r};Qr.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=n?e.effectiveOpacity():1;if(!(n&&(s===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=It(o,"labelX",r),l=It(o,"labelY",r),f,v,c=this.getLabelText(e,r);if(c!=null&&c!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(t,e,n);var h=r?r+"-":"",d=It(o,"labelWidth",r),g=It(o,"labelHeight",r),m=It(o,"labelActualDescent",r),p=e.pstyle(h+"text-margin-x").pfValue,y=e.pstyle(h+"text-margin-y").pfValue,b=e.isEdge(),E=e.pstyle("text-halign").value,C=e.pstyle("text-valign").value;b&&(E="center",C="center"),u+=p,l+=y;var A;a?A=this.getTextAngle(e,r):A=0,A!==0&&(f=u,v=l,t.translate(f,v),t.rotate(A),u=0,l=0);var D=wa(E),N=Ea(C);switch(N){case"top":break;case"center":l+=g/2;break;case"bottom":l+=g;break}var O=e.pstyle("text-background-opacity").value,R=e.pstyle("text-border-opacity").value,P=e.pstyle("text-border-width").pfValue,w=e.pstyle("text-background-padding").pfValue,x=e.pstyle("text-background-shape").strValue,T=x==="round-rectangle"||x==="roundrectangle",M=x==="circle",S=2;if(O>0||P>0&&R>0){var I=t.fillStyle,B=t.strokeStyle,V=t.lineWidth,F=e.pstyle("text-background-color").value,k=e.pstyle("text-border-color").value,U=e.pstyle("text-border-style").value,J=O>0,W=P>0&&R>0,Q=u-w;switch(D){case"left":Q-=d;break;case"center":Q-=d/2;break}var Z=l-g-w,H=d+2*w,j=g+2*w;if(J&&(t.fillStyle="rgba(".concat(F[0],",").concat(F[1],",").concat(F[2],",").concat(O*s,")")),W&&(t.strokeStyle="rgba(".concat(k[0],",").concat(k[1],",").concat(k[2],",").concat(R*s,")"),t.lineWidth=P,t.setLineDash))switch(U){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=P/4,t.setLineDash([]);break;default:t.setLineDash([]);break}if(T?(t.beginPath(),zf(t,Q,Z,H,j,S)):M?(t.beginPath(),Zm(t,Q,Z,H,j)):(t.beginPath(),t.rect(Q,Z,H,j)),J&&t.fill(),W&&t.stroke(),W&&U==="double"){var $=P/2;t.beginPath(),T?zf(t,Q+$,Z+$,H-2*$,j-2*$,S):t.rect(Q+$,Z+$,H-2*$,j-2*$),t.stroke()}t.fillStyle=I,t.strokeStyle=B,t.lineWidth=V,t.setLineDash&&t.setLineDash([])}var q=2*e.pstyle("text-outline-width").pfValue;if(q>0&&(t.lineWidth=q),l-=m,e.pstyle("text-wrap").value==="wrap"){var K=It(o,"labelWrapCachedLines",r),ee=It(o,"labelLineHeight",r),ne=d/2,te=this.getLabelJustification(e);switch(te==="auto"||(D==="left"?te==="left"?u+=-d:te==="center"&&(u+=-ne):D==="center"?te==="left"?u+=-ne:te==="right"&&(u+=ne):D==="right"&&(te==="center"?u+=ne:te==="right"&&(u+=d))),N){case"top":l-=(K.length-1)*ee;break;case"center":case"bottom":l-=(K.length-1)*ee;break}for(var be=0;be<K.length;be++)q>0&&t.strokeText(K[be],u,l),t.fillText(K[be],u,l),l+=ee}else q>0&&t.strokeText(c,u,l),t.fillText(c,u,l);A!==0&&(t.rotate(-A),t.translate(-f,-v))}}};var Rr={};Rr.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,u,l=e._private,f=l.rscratch,v=e.position();if(!(!we(v.x)||!we(v.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,h=o.usePaths(),d,g=!1,m=e.padding();s=e.width()+2*m,u=e.height()+2*m;var p;r&&(p=r,t.translate(-p.x1,-p.y1));for(var y=e.pstyle("background-image"),b=y.value,E=new Array(b.length),C=new Array(b.length),A=0,D=0;D<b.length;D++){var N=b[D],O=E[D]=N!=null&&N!=="none";if(O){var R=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",D);A++,C[D]=o.getCachedImage(N,R,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var P=e.pstyle("background-blacken").value,w=e.pstyle("border-width").pfValue,x=e.pstyle("background-opacity").value*c,T=e.pstyle("border-color").value,M=e.pstyle("border-style").value,S=e.pstyle("border-join").value,I=e.pstyle("border-cap").value,B=e.pstyle("border-position").value,V=e.pstyle("border-dash-pattern").pfValue,F=e.pstyle("border-dash-offset").pfValue,k=e.pstyle("border-opacity").value*c,U=e.pstyle("outline-width").pfValue,J=e.pstyle("outline-color").value,W=e.pstyle("outline-style").value,Q=e.pstyle("outline-opacity").value*c,Z=e.pstyle("outline-offset").value,H=e.pstyle("corner-radius").value;H!=="auto"&&(H=e.pstyle("corner-radius").pfValue);var j=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:x;o.eleFillStyle(t,e,L)},$=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:k;o.colorStrokeStyle(t,T[0],T[1],T[2],L)},q=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Q;o.colorStrokeStyle(t,J[0],J[1],J[2],L)},K=function(L,z,G,X){var _=o.nodePathCache=o.nodePathCache||[],le=lv(G==="polygon"?G+","+X.join(","):G,""+z,""+L,""+H),re=_[le],ae,ie=!1;return re!=null?(ae=re,ie=!0,f.pathCache=ae):(ae=new Path2D,_[le]=f.pathCache=ae),{path:ae,cacheHit:ie}},ee=e.pstyle("shape").strValue,ne=e.pstyle("shape-polygon-points").pfValue;if(h){t.translate(v.x,v.y);var te=K(s,u,ee,ne);d=te.path,g=te.cacheHit}var be=function(){if(!g){var L=v;h&&(L={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(d||t,L.x,L.y,s,u,H,f)}h?t.fill(d):t.fill()},Se=function(){for(var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,G=l.backgrounding,X=0,_=0;_<C.length;_++){var le=e.cy().style().getIndexedStyle(e,"background-image-containment","value",_);if(z&&le==="over"||!z&&le==="inside"){X++;continue}E[_]&&C[_].complete&&!C[_].error&&(X++,o.drawInscribedImage(t,C[_],e,_,L))}l.backgrounding=X!==A,G!==l.backgrounding&&e.updateStyle(!1)},ve=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasPie(e)&&(o.drawPie(t,e,z),L&&(h||o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,H,f)))},oe=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasStripe(e)&&(t.save(),h?t.clip(f.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,H,f),t.clip()),o.drawStripe(t,e,z),t.restore(),L&&(h||o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,H,f)))},he=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,z=(P>0?P:-P)*L,G=P>0?0:255;P!==0&&(o.colorFillStyle(t,G,G,G,z),h?t.fill(d):t.fill())},se=function(){if(w>0){if(t.lineWidth=w,t.lineCap=I,t.lineJoin=S,t.setLineDash)switch(M){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(V),t.lineDashOffset=F;break;case"solid":case"double":t.setLineDash([]);break}if(B!=="center"){if(t.save(),t.lineWidth*=2,B==="inside")h?t.clip(d):t.clip();else{var L=new Path2D;L.rect(-s/2-w,-u/2-w,s+2*w,u+2*w),L.addPath(d),t.clip(L,"evenodd")}h?t.stroke(d):t.stroke(),t.restore()}else h?t.stroke(d):t.stroke();if(M==="double"){t.lineWidth=w/3;var z=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",h?t.stroke(d):t.stroke(),t.globalCompositeOperation=z}t.setLineDash&&t.setLineDash([])}},pe=function(){if(U>0){if(t.lineWidth=U,t.lineCap="butt",t.setLineDash)switch(W){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var L=v;h&&(L={x:0,y:0});var z=o.getNodeShape(e),G=w;B==="inside"&&(G=0),B==="outside"&&(G*=2);var X=(s+G+(U+Z))/s,_=(u+G+(U+Z))/u,le=s*X,re=u*_,ae=o.nodeShapes[z].points,ie;if(h){var fe=K(le,re,z,ae);ie=fe.path}if(z==="ellipse")o.drawEllipsePath(ie||t,L.x,L.y,le,re);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(z)){var ue=0,me=0,ge=0;z==="round-diamond"?ue=(G+Z+U)*1.4:z==="round-heptagon"?(ue=(G+Z+U)*1.075,ge=-(G/2+Z+U)/35):z==="round-hexagon"?ue=(G+Z+U)*1.12:z==="round-pentagon"?(ue=(G+Z+U)*1.13,ge=-(G/2+Z+U)/15):z==="round-tag"?(ue=(G+Z+U)*1.12,me=(G/2+U+Z)*.07):z==="round-triangle"&&(ue=(G+Z+U)*(Math.PI/2),ge=-(G+Z/2+U)/Math.PI),ue!==0&&(X=(s+ue)/s,le=s*X,["round-hexagon","round-tag"].includes(z)||(_=(u+ue)/u,re=u*_)),H=H==="auto"?mv(le,re):H;for(var ye=le/2,ce=re/2,Ae=H+(G+U+Z)/2,Te=new Array(ae.length/2),Me=new Array(ae.length/2),Fe=0;Fe<ae.length/2;Fe++)Te[Fe]={x:L.x+me+ye*ae[Fe*2],y:L.y+ge+ce*ae[Fe*2+1]};var Be,Ye,ke,ze,qe=Te.length;for(Ye=Te[qe-1],Be=0;Be<qe;Be++)ke=Te[Be%qe],ze=Te[(Be+1)%qe],Me[Be]=Qs(Ye,ke,ze,Ae),Ye=ke,ke=ze;o.drawRoundPolygonPath(ie||t,L.x+me,L.y+ge,s*X,u*_,ae,Me)}else if(["roundrectangle","round-rectangle"].includes(z))H=H==="auto"?Cr(le,re):H,o.drawRoundRectanglePath(ie||t,L.x,L.y,le,re,H+(G+U+Z)/2);else if(["cutrectangle","cut-rectangle"].includes(z))H=H==="auto"?Gs():H,o.drawCutRectanglePath(ie||t,L.x,L.y,le,re,null,H+(G+U+Z)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(z))H=H==="auto"?Cr(le,re):H,o.drawBottomRoundRectanglePath(ie||t,L.x,L.y,le,re,H+(G+U+Z)/2);else if(z==="barrel")o.drawBarrelPath(ie||t,L.x,L.y,le,re);else if(z.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(z)){var We=(G+U+Z)/s;ae=Jn(jn(ae,We)),o.drawPolygonPath(ie||t,L.x,L.y,s,u,ae)}else{var Je=(G+U+Z)/s;ae=Jn(jn(ae,-Je)),o.drawPolygonPath(ie||t,L.x,L.y,s,u,ae)}if(h?t.stroke(ie):t.stroke(),W==="double"){t.lineWidth=G/3;var ut=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",h?t.stroke(ie):t.stroke(),t.globalCompositeOperation=ut}t.setLineDash&&t.setLineDash([])}},de=function(){n&&o.drawNodeOverlay(t,e,v,s,u)},Ee=function(){n&&o.drawNodeUnderlay(t,e,v,s,u)},xe=function(){o.drawElementText(t,e,null,a)},De=e.pstyle("ghost").value==="yes";if(De){var Oe=e.pstyle("ghost-offset-x").pfValue,Pe=e.pstyle("ghost-offset-y").pfValue,Ie=e.pstyle("ghost-opacity").value,Ne=Ie*c;t.translate(Oe,Pe),q(),pe(),j(Ie*x),be(),Se(Ne,!0),$(Ie*k),se(),ve(P!==0||w!==0),oe(P!==0||w!==0),Se(Ne,!1),he(Ne),t.translate(-Oe,-Pe)}h&&t.translate(-v.x,-v.y),Ee(),h&&t.translate(v.x,v.y),q(),pe(),j(),be(),Se(c,!0),$(),se(),ve(P!==0||w!==0),oe(P!==0||w!==0),Se(c,!1),he(),h&&t.translate(-v.x,-v.y),xe(),de(),r&&t.translate(p.x1,p.y1)}};var Sc=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,o){var s=this;if(a.visible()){var u=a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,v=a.pstyle("".concat(e,"-shape")).value,c=a.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(n=n||a.position(),i==null||o==null){var h=a.padding();i=a.width()+2*h,o=a.height()+2*h}s.colorFillStyle(r,f[0],f[1],f[2],l),s.nodeShapes[v].draw(r,n.x,n.y,i+u*2,o+u*2,c),r.fill()}}}};Rr.drawNodeOverlay=Sc("overlay");Rr.drawNodeUnderlay=Sc("underlay");Rr.hasPie=function(t){return t=t[0],t._private.hasPie};Rr.hasStripe=function(t){return t=t[0],t._private.hasStripe};Rr.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),s=e.pstyle("pie-start-angle").pfValue,u=a.x,l=a.y,f=e.width(),v=e.height(),c=Math.min(f,v)/2,h,d=0,g=this.usePaths();if(g&&(u=0,l=0),i.units==="%"?c=c*i.pfValue:i.pfValue!==void 0&&(c=i.pfValue/2),o.units==="%"?h=c*o.pfValue:o.pfValue!==void 0&&(h=o.pfValue/2),!(h>=c))for(var m=1;m<=n.pieBackgroundN;m++){var p=e.pstyle("pie-"+m+"-background-size").value,y=e.pstyle("pie-"+m+"-background-color").value,b=e.pstyle("pie-"+m+"-background-opacity").value*r,E=p/100;E+d>1&&(E=1-d);var C=1.5*Math.PI+2*Math.PI*d;C+=s;var A=2*Math.PI*E,D=C+A;p===0||d>=1||d+E>1||(h===0?(t.beginPath(),t.moveTo(u,l),t.arc(u,l,c,C,D),t.closePath()):(t.beginPath(),t.arc(u,l,c,C,D),t.arc(u,l,h,D,C,!0),t.closePath()),this.colorFillStyle(t,y[0],y[1],y[2],b),t.fill(),d+=E)}};Rr.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,o=a.y,s=e.width(),u=e.height(),l=0,f=this.usePaths();t.save();var v=e.pstyle("stripe-direction").value,c=e.pstyle("stripe-size");switch(v){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var h=s,d=u;c.units==="%"?(h=h*c.pfValue,d=d*c.pfValue):c.pfValue!==void 0&&(h=c.pfValue,d=c.pfValue),f&&(i=0,o=0),o-=h/2,i-=d/2;for(var g=1;g<=n.stripeBackgroundN;g++){var m=e.pstyle("stripe-"+g+"-background-size").value,p=e.pstyle("stripe-"+g+"-background-color").value,y=e.pstyle("stripe-"+g+"-background-opacity").value*r,b=m/100;b+l>1&&(b=1-l),!(m===0||l>=1||l+b>1)&&(t.beginPath(),t.rect(i,o+d*l,h,d*b),t.closePath(),this.colorFillStyle(t,p[0],p[1],p[2],y),t.fill(),l+=b)}t.restore()};var kt={},Qm=100;kt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r};kt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a};kt.createGradientStyleFor=function(t,e,r,a,n){var i,o=this.usePaths(),s=r.pstyle(e+"-gradient-stop-colors").value,u=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var l=r.sourceEndpoint(),f=r.targetEndpoint(),v=r.midpoint(),c=Xr(l,v),h=Xr(f,v);i=t.createRadialGradient(v.x,v.y,0,v.x,v.y,Math.max(c,h))}else{var d=o?{x:0,y:0}:r.position(),g=r.paddedWidth(),m=r.paddedHeight();i=t.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(g,m))}else if(r.isEdge()){var p=r.sourceEndpoint(),y=r.targetEndpoint();i=t.createLinearGradient(p.x,p.y,y.x,y.y)}else{var b=o?{x:0,y:0}:r.position(),E=r.paddedWidth(),C=r.paddedHeight(),A=E/2,D=C/2,N=r.pstyle("background-gradient-direction").value;switch(N){case"to-bottom":i=t.createLinearGradient(b.x,b.y-D,b.x,b.y+D);break;case"to-top":i=t.createLinearGradient(b.x,b.y+D,b.x,b.y-D);break;case"to-left":i=t.createLinearGradient(b.x+A,b.y,b.x-A,b.y);break;case"to-right":i=t.createLinearGradient(b.x-A,b.y,b.x+A,b.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(b.x-A,b.y-D,b.x+A,b.y+D);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(b.x-A,b.y+D,b.x+A,b.y-D);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(b.x+A,b.y-D,b.x-A,b.y+D);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(b.x+A,b.y+D,b.x-A,b.y-D);break}}if(!i)return null;for(var O=u.length===s.length,R=s.length,P=0;P<R;P++)i.addColorStop(O?u[P]:P/(R-1),"rgba("+s[P][0]+","+s[P][1]+","+s[P][2]+","+n+")");return i};kt.gradientFillStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"background",e,r,a);if(!n)return null;t.fillStyle=n};kt.colorFillStyle=function(t,e,r,a,n){t.fillStyle="rgba("+e+","+r+","+a+","+n+")"};kt.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var n=e.pstyle("background-color").value;this.colorFillStyle(t,n[0],n[1],n[2],r)}};kt.gradientStrokeStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"line",e,r,a);if(!n)return null;t.strokeStyle=n};kt.colorStrokeStyle=function(t,e,r,a,n){t.strokeStyle="rgba("+e+","+r+","+a+","+n+")"};kt.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(t,n[0],n[1],n[2],r)}};kt.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],o=e.getPixelRatio(),s=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var u=n*o,l=i*o,f;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var v=r.canvasContainer;v.style.width=n+"px",v.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)f=r.canvases[c],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.BUFFER_COUNT;c++)f=r.bufferCanvases[c],f.width=u,f.height=l,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,o<=1&&(f=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=u*e.textureMult,f.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=o}};kt.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};kt.clearCanvas=function(){var t=this,e=t.data;function r(a){a.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])};kt.render=function(t){var e=this;t=t||cv();var r=e.cy,a=t.forcedContext,n=t.drawAllLayers,i=t.drawOnlyNodeLayer,o=t.forcedZoom,s=t.forcedPan,u=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,l=e.data,f=l.canvasNeedsRedraw,v=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),c=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,h=e.motionBlurPxRatio,d=r.hasCompoundNodes(),g=e.hoverData.draggingEles,m=!!(e.hoverData.selecting||e.touchData.selecting);c=c&&!a&&e.motionBlurEnabled&&!m;var p=c;a||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),c&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(p=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!v&&(f[e.NODE]=!0,f[e.SELECT_BOX]=!0);var y=r.style(),b=r.zoom(),E=o!==void 0?o:b,C=r.pan(),A={x:C.x,y:C.y},D={zoom:b,pan:{x:C.x,y:C.y}},N=e.prevViewport,O=N===void 0||D.zoom!==N.zoom||D.pan.x!==N.pan.x||D.pan.y!==N.pan.y;!O&&!(g&&!d)&&(e.motionBlurPxRatio=1),s&&(A=s),E*=u,A.x*=u,A.y*=u;var R=e.getCachedZSortedEles();function P($,q,K,ee,ne){var te=$.globalCompositeOperation;$.globalCompositeOperation="destination-out",e.colorFillStyle($,255,255,255,e.motionBlurTransparency),$.fillRect(q,K,ee,ne),$.globalCompositeOperation=te}function w($,q){var K,ee,ne,te;!e.clearingMotionBlur&&($===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||$===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(K={x:C.x*h,y:C.y*h},ee=b*h,ne=e.canvasWidth*h,te=e.canvasHeight*h):(K=A,ee=E,ne=e.canvasWidth,te=e.canvasHeight),$.setTransform(1,0,0,1,0,0),q==="motionBlur"?P($,0,0,ne,te):!a&&(q===void 0||q)&&$.clearRect(0,0,ne,te),n||($.translate(K.x,K.y),$.scale(ee,ee)),s&&$.translate(s.x,s.y),o&&$.scale(o,o)}if(v||(e.textureDrawLastFrame=!1),v){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var x=e.data.bufferContexts[e.TEXTURE_BUFFER];x.setTransform(1,0,0,1,0,0),x.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:x,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var D=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};D.mpan={x:(0-D.pan.x)/D.zoom,y:(0-D.pan.y)/D.zoom}}f[e.DRAG]=!1,f[e.NODE]=!1;var T=l.contexts[e.NODE],M=e.textureCache.texture,D=e.textureCache.viewport;T.setTransform(1,0,0,1,0,0),c?P(T,0,0,D.width,D.height):T.clearRect(0,0,D.width,D.height);var S=y.core("outside-texture-bg-color").value,I=y.core("outside-texture-bg-opacity").value;e.colorFillStyle(T,S[0],S[1],S[2],I),T.fillRect(0,0,D.width,D.height);var b=r.zoom();w(T,!1),T.clearRect(D.mpan.x,D.mpan.y,D.width/D.zoom/u,D.height/D.zoom/u),T.drawImage(M,D.mpan.x,D.mpan.y,D.width/D.zoom/u,D.height/D.zoom/u)}else e.textureOnViewport&&!a&&(e.textureCache=null);var B=r.extent(),V=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),F=e.hideEdgesOnViewport&&V,k=[];if(k[e.NODE]=!f[e.NODE]&&c&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,k[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),k[e.DRAG]=!f[e.DRAG]&&c&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,k[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),f[e.NODE]||n||i||k[e.NODE]){var U=c&&!k[e.NODE]&&h!==1,T=a||(U?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),J=c&&!U?"motionBlur":void 0;w(T,J),F?e.drawCachedNodes(T,R.nondrag,u,B):e.drawLayeredElements(T,R.nondrag,u,B),e.debug&&e.drawDebugPoints(T,R.nondrag),!n&&!c&&(f[e.NODE]=!1)}if(!i&&(f[e.DRAG]||n||k[e.DRAG])){var U=c&&!k[e.DRAG]&&h!==1,T=a||(U?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);w(T,c&&!U?"motionBlur":void 0),F?e.drawCachedNodes(T,R.drag,u,B):e.drawCachedElements(T,R.drag,u,B),e.debug&&e.drawDebugPoints(T,R.drag),!n&&!c&&(f[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,w),c&&h!==1){var W=l.contexts[e.NODE],Q=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Z=l.contexts[e.DRAG],H=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],j=function(q,K,ee){q.setTransform(1,0,0,1,0,0),ee||!p?q.clearRect(0,0,e.canvasWidth,e.canvasHeight):P(q,0,0,e.canvasWidth,e.canvasHeight);var ne=h;q.drawImage(K,0,0,e.canvasWidth*ne,e.canvasHeight*ne,0,0,e.canvasWidth,e.canvasHeight)};(f[e.NODE]||k[e.NODE])&&(j(W,Q,k[e.NODE]),f[e.NODE]=!1),(f[e.DRAG]||k[e.DRAG])&&(j(Z,H,k[e.DRAG]),f[e.DRAG]=!1)}e.prevViewport=D,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),c&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!v,e.mbFrames=0,f[e.NODE]=!0,f[e.DRAG]=!0,e.redraw()},Qm)),a||r.emit("render")};var za;kt.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,n=r.data,i=a.style(),o=t.drawOnlyNodeLayer,s=t.drawAllLayers,u=n.canvasNeedsRedraw,l=t.forcedContext;if(r.showFps||!o&&u[r.SELECT_BOX]&&!s){var f=l||n.contexts[r.SELECT_BOX];if(e(f),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var v=r.cy.zoom(),c=i.core("selection-box-border-width").value/v;f.lineWidth=c,f.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",f.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),c>0&&(f.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",f.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(n.bgActivePosistion&&!r.hoverData.selecting){var v=r.cy.zoom(),h=n.bgActivePosistion;f.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",f.beginPath(),f.arc(h.x,h.y,i.core("active-bg-size").pfValue/v,0,2*Math.PI),f.fill()}var d=r.lastRedrawTime;if(r.showFps&&d){d=Math.round(d);var g=Math.round(1e3/d),m="1 frame = "+d+" ms = "+g+" fps";if(f.setTransform(1,0,0,1,0,0),f.fillStyle="rgba(255, 0, 0, 0.75)",f.strokeStyle="rgba(255, 0, 0, 0.75)",f.font="30px Arial",!za){var p=f.measureText(m);za=p.actualBoundingBoxAscent}f.fillText(m,0,za);var y=60;f.strokeRect(0,za+10,250,20),f.fillRect(0,za+10,250*Math.min(g/y,1),20)}s||(u[r.SELECT_BOX]=!1)}};function Vf(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(a));return a}function Jm(t,e,r){var a=Vf(t,t.VERTEX_SHADER,e),n=Vf(t,t.FRAGMENT_SHADER,r),i=t.createProgram();if(t.attachShader(i,a),t.attachShader(i,n),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function jm(t,e,r){r===void 0&&(r=e);var a=t.makeOffscreenCanvas(e,r),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function el(t){var e=t.pixelRatio,r=t.cy.zoom(),a=t.cy.pan();return{zoom:r*e,pan:{x:a.x*e,y:a.y*e}}}function e0(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function t0(t,e,r,a,n){var i=a*r+e.x,o=n*r+e.y;return o=Math.round(t.canvasHeight-o),[i,o]}function r0(t,e){return e.picking?!0:t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function a0(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function zr(t,e,r){var a=t[0]/255,n=t[1]/255,i=t[2]/255,o=e,s=r||new Array(4);return s[0]=a*o,s[1]=n*o,s[2]=i*o,s[3]=o,s}function sa(t,e){var r=e||new Array(4);return r[0]=(t>>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function n0(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function i0(t,e){var r=t.createTexture();return r.buffer=function(a){t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function Dc(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function Ac(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function o0(t,e,r,a,n,i){switch(e){case t.FLOAT:return new Float32Array(r.buffer,i*a,n);case t.INT:return new Int32Array(r.buffer,i*a,n)}}function s0(t,e,r,a){var n=Dc(t,e),i=dt(n,2),o=i[0],s=i[1],u=Ac(t,s,a),l=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,u,t.STATIC_DRAW),s===t.FLOAT?t.vertexAttribPointer(r,o,s,!1,0,0):s===t.INT&&t.vertexAttribIPointer(r,o,s,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),l}function Zt(t,e,r,a){var n=Dc(t,r),i=dt(n,3),o=i[0],s=i[1],u=i[2],l=Ac(t,s,e*o),f=o*u,v=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,v),t.bufferData(t.ARRAY_BUFFER,e*f,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),s===t.FLOAT?t.vertexAttribPointer(a,o,s,!1,f,0):s===t.INT&&t.vertexAttribIPointer(a,o,s,f,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var c=new Array(e),h=0;h<e;h++)c[h]=o0(t,s,l,f,o,h);return v.dataArray=l,v.stride=f,v.size=o,v.getView=function(d){return c[d]},v.setPoint=function(d,g,m){var p=c[d];p[0]=g,p[1]=m},v.bufferSubData=function(d){t.bindBuffer(t.ARRAY_BUFFER,v),d?t.bufferSubData(t.ARRAY_BUFFER,0,l,0,d*o):t.bufferSubData(t.ARRAY_BUFFER,0,l)},v}function l0(t,e,r){for(var a=9,n=new Float32Array(e*a),i=new Array(e),o=0;o<e;o++){var s=o*a*4;i[o]=new Float32Array(n.buffer,s,a)}var u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,n.byteLength,t.DYNAMIC_DRAW);for(var l=0;l<3;l++){var f=r+l;t.enableVertexAttribArray(f),t.vertexAttribPointer(f,3,t.FLOAT,!1,36,l*12),t.vertexAttribDivisor(f,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),u.getMatrixView=function(v){return i[v]},u.setData=function(v,c){i[c].set(v,0)},u.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferSubData(t.ARRAY_BUFFER,0,n)},u}function u0(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,n){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,a,n,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var Gf=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function ns(){var t=new Gf(9);return Gf!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Uf(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function f0(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],v=e[8],c=r[0],h=r[1],d=r[2],g=r[3],m=r[4],p=r[5],y=r[6],b=r[7],E=r[8];return t[0]=c*a+h*o+d*l,t[1]=c*n+h*s+d*f,t[2]=c*i+h*u+d*v,t[3]=g*a+m*o+p*l,t[4]=g*n+m*s+p*f,t[5]=g*i+m*u+p*v,t[6]=y*a+b*o+E*l,t[7]=y*n+b*s+E*f,t[8]=y*i+b*u+E*v,t}function $n(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],v=e[8],c=r[0],h=r[1];return t[0]=a,t[1]=n,t[2]=i,t[3]=o,t[4]=s,t[5]=u,t[6]=c*a+h*o+l,t[7]=c*n+h*s+f,t[8]=c*i+h*u+v,t}function Hf(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],f=e[7],v=e[8],c=Math.sin(r),h=Math.cos(r);return t[0]=h*a+c*o,t[1]=h*n+c*s,t[2]=h*i+c*u,t[3]=h*o-c*a,t[4]=h*s-c*n,t[5]=h*u-c*i,t[6]=l,t[7]=f,t[8]=v,t}function Ds(t,e,r){var a=r[0],n=r[1];return t[0]=a*e[0],t[1]=a*e[1],t[2]=a*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function v0(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var c0=(function(){function t(e,r,a,n){Mr(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=n(e,r,r),this.scratch=n(e,r,this.texHeight,"scratch")}return Lr(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var a=r.w,n=r.h,i=this.texHeight,o=this.texSize,s=i/n,u=a*s,l=n*s;return u>o&&(s=o/a,u=a*s,l=n*s),{scale:s,texW:u,texH:l}}},{key:"draw",value:function(r,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,u=this.texHeight,l=this.getScale(a),f=l.scale,v=l.texW,c=l.texH,h=function(b,E){if(n&&E){var C=E.context,A=b.x,D=b.row,N=A,O=u*D;C.save(),C.translate(N,O),C.scale(f,f),n(C,a),C.restore()}},d=[null,null],g=function(){h(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:v,h:c},d[1]={x:i.freePointer.x+v,y:i.freePointer.row*u,w:0,h:c},i.freePointer.x+=v,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},m=function(){var b=i.scratch,E=i.canvas;b.clear(),h({x:0,row:0},b);var C=o-i.freePointer.x,A=v-C,D=u;{var N=i.freePointer.x,O=i.freePointer.row*u,R=C;E.context.drawImage(b,0,0,R,D,N,O,R,D),d[0]={x:N,y:O,w:R,h:c}}{var P=C,w=(i.freePointer.row+1)*u,x=A;E&&E.context.drawImage(b,P,0,x,D,0,w,x,D),d[1]={x:0,y:w,w:x,h:c}}i.freePointer.x=A,i.freePointer.row++},p=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+v<=o)g();else{if(this.freePointer.row>=s-1)return!1;this.freePointer.x===o?(p(),g()):this.enableWrapping?m():(p(),g())}return this.keyToLocation.set(r,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(r),o=i.texW;return this.freePointer.x+o>a?this.freePointer.row<n-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=i0(r,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])})(),h0=(function(){function t(e,r,a,n){Mr(this,t),this.r=e,this.texSize=r,this.texRows=a,this.createTextureCanvas=n,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return Lr(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new c0(r,a,n,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas,o=Math.floor(a/n);this.scratch=i(r,a,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,a,n){var i=this.styleKeyToAtlas.get(r);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(a))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(r,a,n),this.styleKeyToAtlas.set(r,i)),i}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"markKeyForGC",value:function(r){this.markedKeys.add(r)}},{key:"gc",value:function(){var r=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var n=[],i=new Map,o=null,s=zt(this.atlases),u;try{var l=function(){var v=u.value,c=v.getKeys(),h=d0(a,c);if(h.size===0)return n.push(v),c.forEach(function(C){return i.set(C,v)}),1;o||(o=r._createAtlas(),n.push(o));var d=zt(c),g;try{for(d.s();!(g=d.n()).done;){var m=g.value;if(!h.has(m)){var p=v.getOffsets(m),y=dt(p,2),b=y[0],E=y[1];o.canFit({w:b.w+E.w,h:b.h})||(o.lock(),o=r._createAtlas(),n.push(o)),v.canvas&&(r._copyTextureToNewAtlas(m,v,o),i.set(m,o))}}}catch(C){d.e(C)}finally{d.f()}v.dispose()};for(s.s();!(u=s.n()).done;)l()}catch(f){s.e(f)}finally{s.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(r,a,n){var i=a.getOffsets(r),o=dt(i,2),s=o[0],u=o[1];if(u.w===0)n.draw(r,s,function(c){c.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h),l.context.drawImage(a.canvas,u.x,u.y,u.w,u.h,s.w,0,u.w,u.h);var f=s.w+u.w,v=s.h;n.draw(r,{w:f,h:v},function(c){c.drawImage(l,0,0,f,v,0,0,f,v)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function d0(t,e){return t.intersection?t.intersection(e):new Set(Kn(t).filter(function(r){return e.has(r)}))}var g0=(function(){function t(e,r){Mr(this,t),this.r=e,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return Lr(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,a){var n=this.globalOptions,i=n.webglTexSize,o=n.createTextureCanvas,s=a.texRows,u=this._cacheScratchCanvas(o),l=new h0(this.r,i,s,u);this.collections.set(r,l)}},{key:"addRenderType",value:function(r,a){var n=a.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var i=this.collections.get(n),o=Re({type:r,atlasCollection:i},a);this.renderTypes.set(r,o)}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"getAtlasCollection",value:function(r){return this.collections.get(r)}},{key:"_cacheScratchCanvas",value:function(r){var a=-1,n=-1,i=null;return function(o,s,u,l){return l?((!i||s!=a||u!=n)&&(a=s,n=u,i=r(o,s,u)),i):r(o,s,u)}}},{key:"_key",value:function(r,a){return"".concat(r,"-").concat(a)}},{key:"invalidate",value:function(r){var a=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,o=i===void 0?!1:i,s=n.filterEle,u=s===void 0?function(){return!0}:s,l=n.filterType,f=l===void 0?function(){return!0}:l,v=!1,c=!1,h=zt(r),d;try{for(h.s();!(d=h.n()).done;){var g=d.value;if(u(g)){var m=zt(this.renderTypes.values()),p;try{var y=function(){var E=p.value,C=E.type;if(f(C)){var A=a.collections.get(E.collection),D=E.getKey(g),N=Array.isArray(D)?D:[D];if(o)N.forEach(function(w){return A.markKeyForGC(w)}),c=!0;else{var O=E.getID?E.getID(g):g.id(),R=a._key(C,O),P=a.typeAndIdToKey.get(R);P!==void 0&&!a0(N,P)&&(v=!0,a.typeAndIdToKey.delete(R),P.forEach(function(w){return A.markKeyForGC(w)}))}}};for(m.s();!(p=m.n()).done;)y()}catch(b){m.e(b)}finally{m.f()}}}}catch(b){h.e(b)}finally{h.f()}return c&&(this.gc(),v=!1),v}},{key:"gc",value:function(){var r=zt(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;){var n=a.value;n.gc()}}catch(i){r.e(i)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,n,i){var o=this.renderTypes.get(a),s=this.collections.get(o.collection),u=!1,l=s.draw(i,n,function(c){o.drawClipped?(c.save(),c.beginPath(),c.rect(0,0,n.w,n.h),c.clip(),o.drawElement(c,r,n,!0,!0),c.restore()):o.drawElement(c,r,n,!0,!0),u=!0});if(u){var f=o.getID?o.getID(r):r.id(),v=this._key(a,f);this.typeAndIdToKey.has(v)?this.typeAndIdToKey.get(v).push(i):this.typeAndIdToKey.set(v,[i])}return l}},{key:"getAtlasInfo",value:function(r,a){var n=this,i=this.renderTypes.get(a),o=i.getKey(r),s=Array.isArray(o)?o:[o];return s.map(function(u){var l=i.getBoundingBox(r,u),f=n.getOrCreateAtlas(r,a,l,u),v=f.getOffsets(u),c=dt(v,2),h=c[0],d=c[1];return{atlas:f,tex:h,tex1:h,tex2:d,bb:l}})}},{key:"getDebugInfo",value:function(){var r=[],a=zt(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=dt(n.value,2),o=i[0],s=i[1],u=s.getCounts(),l=u.keyCount,f=u.atlasCount;r.push({type:o,keyCount:l,atlasCount:f})}}catch(v){a.e(v)}finally{a.f()}return r}}])})(),p0=(function(){function t(e){Mr(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return Lr(t,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,a){return a})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}}])})(),y0=`
8
+ float circleSD(vec2 p, float r) {
9
+ return distance(vec2(0), p) - r; // signed distance
10
+ }
11
+ `,m0=`
12
+ float rectangleSD(vec2 p, vec2 b) {
13
+ vec2 d = abs(p)-b;
14
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
15
+ }
16
+ `,b0=`
17
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
18
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
19
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
20
+ vec2 q = abs(p) - b + cr.x;
21
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
22
+ }
23
+ `,w0=`
24
+ float ellipseSD(vec2 p, vec2 ab) {
25
+ p = abs( p ); // symmetry
26
+
27
+ // find root with Newton solver
28
+ vec2 q = ab*(p-ab);
29
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
30
+ for( int i=0; i<5; i++ ) {
31
+ vec2 cs = vec2(cos(w),sin(w));
32
+ vec2 u = ab*vec2( cs.x,cs.y);
33
+ vec2 v = ab*vec2(-cs.y,cs.x);
34
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
35
+ }
36
+
37
+ // compute final point and distance
38
+ float d = length(p-ab*vec2(cos(w),sin(w)));
39
+
40
+ // return signed distance
41
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
42
+ }
43
+ `,Xa={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},oi={IGNORE:1,USE_BB:2},is=0,qf=1,Yf=2,os=3,la=4,kn=5,Va=6,Ga=7,E0=(function(){function t(e,r,a){Mr(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=jm,this.atlasManager=new g0(e,a),this.batchManager=new p0(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Xa.SCREEN),this.pickingProgram=this._createShaderProgram(Xa.PICKING),this.vao=this._createVAO()}return Lr(t,[{key:"addAtlasCollection",value:function(r,a){this.atlasManager.addAtlasCollection(r,a)}},{key:"addTextureAtlasRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"addSimpleShapeRenderType",value:function(r,a){this.simpleShapeOptions.set(r,a)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(r,{filterType:function(s){return s===n},forceRedraw:!0}):i.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=this.gl,n=`#version 300 es
44
+ precision highp float;
45
+
46
+ uniform mat3 uPanZoomMatrix;
47
+ uniform int uAtlasSize;
48
+
49
+ // instanced
50
+ in vec2 aPosition; // a vertex from the unit square
51
+
52
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
53
+ in int aVertType; // the type of thing we are rendering
54
+
55
+ // the z-index that is output when using picking mode
56
+ in vec4 aIndex;
57
+
58
+ // For textures
59
+ in int aAtlasId; // which shader unit/atlas to use
60
+ in vec4 aTex; // x/y/w/h of texture in atlas
61
+
62
+ // for edges
63
+ in vec4 aPointAPointB;
64
+ in vec4 aPointCPointD;
65
+ in vec2 aLineWidth; // also used for node border width
66
+
67
+ // simple shapes
68
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
69
+ in vec4 aColor; // also used for edges
70
+ in vec4 aBorderColor; // aLineWidth is used for border width
71
+
72
+ // output values passed to the fragment shader
73
+ out vec2 vTexCoord;
74
+ out vec4 vColor;
75
+ out vec2 vPosition;
76
+ // flat values are not interpolated
77
+ flat out int vAtlasId;
78
+ flat out int vVertType;
79
+ flat out vec2 vTopRight;
80
+ flat out vec2 vBotLeft;
81
+ flat out vec4 vCornerRadius;
82
+ flat out vec4 vBorderColor;
83
+ flat out vec2 vBorderWidth;
84
+ flat out vec4 vIndex;
85
+
86
+ void main(void) {
87
+ int vid = gl_VertexID;
88
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
89
+
90
+ if(aVertType == `.concat(is,`) {
91
+ float texX = aTex.x; // texture coordinates
92
+ float texY = aTex.y;
93
+ float texW = aTex.z;
94
+ float texH = aTex.w;
95
+
96
+ if(vid == 1 || vid == 2 || vid == 4) {
97
+ texX += texW;
98
+ }
99
+ if(vid == 2 || vid == 4 || vid == 5) {
100
+ texY += texH;
101
+ }
102
+
103
+ float d = float(uAtlasSize);
104
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
105
+
106
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
107
+ }
108
+ else if(aVertType == `).concat(la," || aVertType == ").concat(Ga,`
109
+ || aVertType == `).concat(kn," || aVertType == ").concat(Va,`) { // simple shapes
110
+
111
+ // the bounding box is needed by the fragment shader
112
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
113
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
114
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
115
+
116
+ // calculations are done in the fragment shader, just pass these along
117
+ vColor = aColor;
118
+ vCornerRadius = aCornerRadius;
119
+ vBorderColor = aBorderColor;
120
+ vBorderWidth = aLineWidth;
121
+
122
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
123
+ }
124
+ else if(aVertType == `).concat(qf,`) {
125
+ vec2 source = aPointAPointB.xy;
126
+ vec2 target = aPointAPointB.zw;
127
+
128
+ // adjust the geometry so that the line is centered on the edge
129
+ position.y = position.y - 0.5;
130
+
131
+ // stretch the unit square into a long skinny rectangle
132
+ vec2 xBasis = target - source;
133
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
134
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
135
+
136
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
137
+ vColor = aColor;
138
+ }
139
+ else if(aVertType == `).concat(Yf,`) {
140
+ vec2 pointA = aPointAPointB.xy;
141
+ vec2 pointB = aPointAPointB.zw;
142
+ vec2 pointC = aPointCPointD.xy;
143
+ vec2 pointD = aPointCPointD.zw;
144
+
145
+ // adjust the geometry so that the line is centered on the edge
146
+ position.y = position.y - 0.5;
147
+
148
+ vec2 p0, p1, p2, pos;
149
+ if(position.x == 0.0) { // The left side of the unit square
150
+ p0 = pointA;
151
+ p1 = pointB;
152
+ p2 = pointC;
153
+ pos = position;
154
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
155
+ p0 = pointD;
156
+ p1 = pointC;
157
+ p2 = pointB;
158
+ pos = vec2(0.0, -position.y);
159
+ }
160
+
161
+ vec2 p01 = p1 - p0;
162
+ vec2 p12 = p2 - p1;
163
+ vec2 p21 = p1 - p2;
164
+
165
+ // Find the normal vector.
166
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
167
+ vec2 normal = vec2(-tangent.y, tangent.x);
168
+
169
+ // Find the vector perpendicular to p0 -> p1.
170
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
171
+
172
+ // Determine the bend direction.
173
+ float sigma = sign(dot(p01 + p21, normal));
174
+ float width = aLineWidth[0];
175
+
176
+ if(sign(pos.y) == -sigma) {
177
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
178
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
179
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
180
+ } else {
181
+ // This is a non-intersecting vertex. Treat it like a mitre join.
182
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
183
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
184
+ }
185
+
186
+ vColor = aColor;
187
+ }
188
+ else if(aVertType == `).concat(os,` && vid < 3) {
189
+ // massage the first triangle into an edge arrow
190
+ if(vid == 0)
191
+ position = vec2(-0.15, -0.3);
192
+ if(vid == 1)
193
+ position = vec2( 0.0, 0.0);
194
+ if(vid == 2)
195
+ position = vec2( 0.15, -0.3);
196
+
197
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
198
+ vColor = aColor;
199
+ }
200
+ else {
201
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
202
+ }
203
+
204
+ vAtlasId = aAtlasId;
205
+ vVertType = aVertType;
206
+ vIndex = aIndex;
207
+ }
208
+ `),i=this.batchManager.getIndexArray(),o=`#version 300 es
209
+ precision highp float;
210
+
211
+ // declare texture unit for each texture atlas in the batch
212
+ `.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
213
+ `),`
214
+
215
+ uniform vec4 uBGColor;
216
+ uniform float uZoom;
217
+
218
+ in vec2 vTexCoord;
219
+ in vec4 vColor;
220
+ in vec2 vPosition; // model coordinates
221
+
222
+ flat in int vAtlasId;
223
+ flat in vec4 vIndex;
224
+ flat in int vVertType;
225
+ flat in vec2 vTopRight;
226
+ flat in vec2 vBotLeft;
227
+ flat in vec4 vCornerRadius;
228
+ flat in vec4 vBorderColor;
229
+ flat in vec2 vBorderWidth;
230
+
231
+ out vec4 outColor;
232
+
233
+ `).concat(y0,`
234
+ `).concat(m0,`
235
+ `).concat(b0,`
236
+ `).concat(w0,`
237
+
238
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
239
+ return vec4(
240
+ top.rgb + (bot.rgb * (1.0 - top.a)),
241
+ top.a + (bot.a * (1.0 - top.a))
242
+ );
243
+ }
244
+
245
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
246
+ // scale to the zoom level so that borders don't look blurry when zoomed in
247
+ // note 1.5 is an aribitrary value chosen because it looks good
248
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
249
+ }
250
+
251
+ void main(void) {
252
+ if(vVertType == `).concat(is,`) {
253
+ // look up the texel from the texture unit
254
+ `).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
255
+ else `),`
256
+ }
257
+ else if(vVertType == `).concat(os,`) {
258
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
259
+ outColor = blend(vColor, uBGColor);
260
+ outColor.a = 1.0; // make opaque, masks out line under arrow
261
+ }
262
+ else if(vVertType == `).concat(la,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
263
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
264
+ }
265
+ else if(vVertType == `).concat(la," || vVertType == ").concat(Ga,`
266
+ || vVertType == `).concat(kn," || vVertType == ").concat(Va,`) { // use SDF
267
+
268
+ float outerBorder = vBorderWidth[0];
269
+ float innerBorder = vBorderWidth[1];
270
+ float borderPadding = outerBorder * 2.0;
271
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
272
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
273
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
274
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
275
+
276
+ float d; // signed distance
277
+ if(vVertType == `).concat(la,`) {
278
+ d = rectangleSD(p, b);
279
+ } else if(vVertType == `).concat(Ga,` && w == h) {
280
+ d = circleSD(p, b.x); // faster than ellipse
281
+ } else if(vVertType == `).concat(Ga,`) {
282
+ d = ellipseSD(p, b);
283
+ } else {
284
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
285
+ }
286
+
287
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
288
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
289
+ if(d > 0.0) {
290
+ if(d > outerBorder) {
291
+ discard;
292
+ } else {
293
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
294
+ }
295
+ } else {
296
+ if(d > innerBorder) {
297
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
298
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
299
+ outColor = distInterp(innerBorderColor, outerColor, d);
300
+ }
301
+ else {
302
+ vec4 outerColor;
303
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
304
+ outerColor = vec4(0);
305
+ } else if(innerBorder == 0.0) {
306
+ outerColor = vBorderColor;
307
+ } else {
308
+ outerColor = blend(vBorderColor, vColor);
309
+ }
310
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
311
+ }
312
+ }
313
+ }
314
+ else {
315
+ outColor = vColor;
316
+ }
317
+
318
+ `).concat(r.picking?`if(outColor.a == 0.0) discard;
319
+ else outColor = vIndex;`:"",`
320
+ }
321
+ `),s=Jm(a,n,o);s.aPosition=a.getAttribLocation(s,"aPosition"),s.aIndex=a.getAttribLocation(s,"aIndex"),s.aVertType=a.getAttribLocation(s,"aVertType"),s.aTransform=a.getAttribLocation(s,"aTransform"),s.aAtlasId=a.getAttribLocation(s,"aAtlasId"),s.aTex=a.getAttribLocation(s,"aTex"),s.aPointAPointB=a.getAttribLocation(s,"aPointAPointB"),s.aPointCPointD=a.getAttribLocation(s,"aPointCPointD"),s.aLineWidth=a.getAttribLocation(s,"aLineWidth"),s.aColor=a.getAttribLocation(s,"aColor"),s.aCornerRadius=a.getAttribLocation(s,"aCornerRadius"),s.aBorderColor=a.getAttribLocation(s,"aBorderColor"),s.uPanZoomMatrix=a.getUniformLocation(s,"uPanZoomMatrix"),s.uAtlasSize=a.getUniformLocation(s,"uAtlasSize"),s.uBGColor=a.getUniformLocation(s,"uBGColor"),s.uZoom=a.getUniformLocation(s,"uZoom"),s.uTextures=[];for(var u=0;u<this.batchManager.getMaxAtlasesPerBatch();u++)s.uTextures.push(a.getUniformLocation(s,"uTexture".concat(u)));return s}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var a=this.maxInstances,n=this.gl,i=this.program,o=n.createVertexArray();return n.bindVertexArray(o),s0(n,"vec2",i.aPosition,r),this.transformBuffer=l0(n,a,i.aTransform),this.indexBuffer=Zt(n,a,"vec4",i.aIndex),this.vertTypeBuffer=Zt(n,a,"int",i.aVertType),this.atlasIdBuffer=Zt(n,a,"int",i.aAtlasId),this.texBuffer=Zt(n,a,"vec4",i.aTex),this.pointAPointBBuffer=Zt(n,a,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Zt(n,a,"vec4",i.aPointCPointD),this.lineWidthBuffer=Zt(n,a,"vec2",i.aLineWidth),this.colorBuffer=Zt(n,a,"vec4",i.aColor),this.cornerRadiusBuffer=Zt(n,a,"vec4",i.aCornerRadius),this.borderColorBuffer=Zt(n,a,"vec4",i.aBorderColor),n.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return yr(a,"Buffer")}).map(function(a){return r[a]})),this._buffers}},{key:"startFrame",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Xa.SCREEN;this.panZoomMatrix=r,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,a){return r.visible()?a&&a.isVisible?a.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,a,n){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(n);if(this._isVisible(r,s)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(r);if(u===oi.IGNORE)return;if(u==oi.USE_BB){this.drawPickingRectangle(r,a,n);return}}var l=i.getAtlasInfo(r,n),f=zt(l),v;try{for(f.s();!(v=f.n()).done;){var c=v.value,h=c.atlas,d=c.tex1,g=c.tex2;o.canAddToCurrentBatch(h)||this.endBatch();for(var m=o.getAtlasIndexForBatch(h),p=0,y=[[d,!0],[g,!1]];p<y.length;p++){var b=dt(y[p],2),E=b[0],C=b[1];if(E.w!=0){var A=this.instanceCount;this.vertTypeBuffer.getView(A)[0]=is;var D=this.indexBuffer.getView(A);sa(a,D);var N=this.atlasIdBuffer.getView(A);N[0]=m;var O=this.texBuffer.getView(A);O[0]=E.x,O[1]=E.y,O[2]=E.w,O[3]=E.h;var R=this.transformBuffer.getMatrixView(A);this.setTransformMatrix(r,R,s,c,C),this.instanceCount++,C||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(P){f.e(P)}finally{f.f()}}}},{key:"setTransformMatrix",value:function(r,a,n,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;if(n.shapeProps&&n.shapeProps.padding&&(s=r.pstyle(n.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,f=i.tex2,v=l.w/(l.w+f.w);o||(v=1-v);var c=this._getAdjustedBB(u,s,o,v);this._applyTransformMatrix(a,c,n,r)}else{var h=n.getBoundingBox(r),d=this._getAdjustedBB(h,s,!0,1);this._applyTransformMatrix(a,d,n,r)}}},{key:"_applyTransformMatrix",value:function(r,a,n,i){var o,s;Uf(r);var u=n.getRotation?n.getRotation(i):0;if(u!==0){var l=n.getRotationPoint(i),f=l.x,v=l.y;$n(r,r,[f,v]),Hf(r,r,u);var c=n.getRotationOffset(i);o=c.x+(a.xOffset||0),s=c.y+(a.yOffset||0)}else o=a.x1,s=a.y1;$n(r,r,[o,s]),Ds(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,n,i){var o=r.x1,s=r.y1,u=r.w,l=r.h,f=r.yOffset;a&&(o-=a,s-=a,u+=2*a,l+=2*a);var v=0,c=u*i;return n&&i<1?u=c:!n&&i<1&&(v=u-c,o+=v,u=c),{x1:o,y1:s,w:u,h:l,xOffset:v,yOffset:f}}},{key:"drawPickingRectangle",value:function(r,a,n){var i=this.atlasManager.getRenderTypeOpts(n),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=la;var s=this.indexBuffer.getView(o);sa(a,s);var u=this.colorBuffer.getView(o);zr([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(r,i)){var o=i.shapeProps,s=this._getVertTypeForShape(r,o.shape);if(s===void 0||i.isSimple&&!i.isSimple(r,this.renderTarget)){this.drawTexture(r,a,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=s,s===kn||s===Va){var l=i.getBoundingBox(r),f=this._getCornerRadius(r,o.radius,l),v=this.cornerRadiusBuffer.getView(u);v[0]=f,v[1]=f,v[2]=f,v[3]=f,s===Va&&(v[0]=0,v[2]=0)}var c=this.indexBuffer.getView(u);sa(a,c);var h=this.renderTarget.picking?1:n==="node-body"?r.effectiveOpacity():1,d=this.renderTarget.picking?1:r.pstyle(o.opacity).value*h,g=r.pstyle(o.color).value,m=this.colorBuffer.getView(u);zr(g,d,m);var p=this.lineWidthBuffer.getView(u);if(p[0]=0,p[1]=0,o.border){var y=r.pstyle("border-width").value;if(y>0){var b=r.pstyle("border-color").value,E=h*r.pstyle("border-opacity").value,C=this.borderColorBuffer.getView(u);zr(b,E,C);var A=r.pstyle("border-position").value;if(A==="inside")p[0]=0,p[1]=-y;else if(A==="outside")p[0]=y,p[1]=0;else{var D=y/2;p[0]=D,p[1]=-D}}}var N=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(r,N,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,a){var n=r.pstyle(a).value;switch(n){case"rectangle":return la;case"ellipse":return Ga;case"roundrectangle":case"round-rectangle":return kn;case"bottom-round-rectangle":return Va;default:return}}},{key:"_getCornerRadius",value:function(r,a,n){var i=n.w,o=n.h;if(r.pstyle(a).value==="auto")return Cr(i,o);var s=r.pstyle(a).pfValue,u=i/2,l=o/2;return Math.min(s,l,u)}},{key:"drawEdgeArrow",value:function(r,a,n){if(r.visible()){var i=r._private.rscratch,o,s,u;if(n==="source"?(o=i.arrowStartX,s=i.arrowStartY,u=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(u)||u==null)){var l=r.pstyle(n+"-arrow-shape").value;if(l!=="none"){var f=r.pstyle(n+"-arrow-color").value,v=r.pstyle("opacity").value,c=r.pstyle("line-opacity").value,h=v*c,d=r.pstyle("width").pfValue,g=r.pstyle("arrow-scale").value,m=this.r.getArrowWidth(d,g),p=this.instanceCount,y=this.transformBuffer.getMatrixView(p);Uf(y),$n(y,y,[o,s]),Ds(y,y,[m,m]),Hf(y,y,u),this.vertTypeBuffer.getView(p)[0]=os;var b=this.indexBuffer.getView(p);sa(a,b);var E=this.colorBuffer.getView(p);zr(f,h,E),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,a){if(r.visible()){var n=this._getEdgePoints(r);if(n){var i=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,s=r.pstyle("width").pfValue,u=r.pstyle("line-color").value,l=i*o;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=qf;var v=this.indexBuffer.getView(f);sa(a,v);var c=this.colorBuffer.getView(f);zr(u,l,c);var h=this.lineWidthBuffer.getView(f);h[0]=s;var d=this.pointAPointBBuffer.getView(f);d[0]=n[0],d[1]=n[1],d[2]=n[2],d[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var g=0;g<n.length-2;g+=2){var m=this.instanceCount;this.vertTypeBuffer.getView(m)[0]=Yf;var p=this.indexBuffer.getView(m);sa(a,p);var y=this.colorBuffer.getView(m);zr(u,l,y);var b=this.lineWidthBuffer.getView(m);b[0]=s;var E=n[g-2],C=n[g-1],A=n[g],D=n[g+1],N=n[g+2],O=n[g+3],R=n[g+4],P=n[g+5];g==0&&(E=2*A-N+.001,C=2*D-O+.001),g==n.length-4&&(R=2*N-A+.001,P=2*O-D+.001);var w=this.pointAPointBBuffer.getView(m);w[0]=E,w[1]=C,w[2]=A,w[3]=D;var x=this.pointCPointDBuffer.getView(m);x[0]=N,x[1]=O,x[2]=R,x[3]=P,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var a=r._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var a=r._private.rscratch;if(this._isValidEdge(r)){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(r);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(r){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,a){if(r.length==4)return r;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=r[0],n[1]=r[1];else if(i==a)n[i*2]=r[r.length-2],n[i*2+1]=r[r.length-1];else{var o=i/a;this._setCurvePoint(r,o,n,i*2)}return n}},{key:"_setCurvePoint",value:function(r,a,n,i){if(r.length<=2)n[i]=r[0],n[i+1]=r[1];else{for(var o=Array(r.length-2),s=0;s<o.length;s+=2){var u=(1-a)*r[s]+a*r[s+2],l=(1-a)*r[s+1]+a*r[s+3];o[s]=u,o[s+1]=l}return this._setCurvePoint(o,a,n,i)}}},{key:"endBatch",value:function(){var r=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(o),r.bindVertexArray(a);var s=zt(this.buffers),u;try{for(s.s();!(u=s.n()).done;){var l=u.value;l.bufferSubData(i)}}catch(d){s.e(d)}finally{s.f()}for(var f=this.batchManager.getAtlases(),v=0;v<f.length;v++)f[v].bufferIfNeeded(r);for(var c=0;c<f.length;c++)r.activeTexture(r.TEXTURE0+c),r.bindTexture(r.TEXTURE_2D,f[c].texture),r.uniform1i(o.uTextures[c],c);r.uniform1f(o.uZoom,e0(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var h=zr(this.bgColor,1);r.uniform4fv(o.uBGColor,h),r.drawArraysInstanced(r.TRIANGLES,0,n,i),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:f.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),a=r.reduce(function(o,s){return o+s.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(o,s){return o+s.count},0);return{atlasInfo:r,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:i}}}])})(),Mc={};Mc.initWebgl=function(t,e){var r=this,a=r.data.contexts[r.WEBGL];t.bgColor=x0(r),t.webglTexSize=Math.min(t.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=u0(a),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new E0(r,a,t);var n=function(v){return function(c){return r.getTextAngle(c,v)}},i=function(v){return function(c){var h=c.pstyle(v);return h&&h.value}},o=function(v){return function(c){return c.pstyle("".concat(v,"-opacity")).value>0}},s=function(v){var c=v.pstyle("text-events").strValue==="yes";return c?oi.USE_BB:oi.IGNORE},u=function(v){var c=v.position(),h=c.x,d=c.y,g=v.outerWidth(),m=v.outerHeight();return{w:g,h:m,x1:h-g/2,y1:d-m/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:r0,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:ss(e.getLabelKey,null),getBoundingBox:ls(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:ss(e.getSourceLabelKey,"source"),getBoundingBox:ls(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:ss(e.getTargetLabelKey,"target"),getBoundingBox:ls(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=un(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(f,v){var c=!1;v&&v.length>0&&(c|=r.drawing.invalidate(v)),c&&l()}),T0(r)};function x0(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return tv(r)}function Lc(t,e){var r=t._private.rscratch;return It(r,"labelWrapCachedLines",e)||[]}var ss=function(e,r){return function(a){var n=e(a),i=Lc(a,r);return i.length>1?i.map(function(o,s){return"".concat(n,"_").concat(s)}):n}},ls=function(e,r){return function(a,n){var i=e(a);if(typeof n=="string"){var o=n.indexOf("_");if(o>0){var s=Number(n.substring(o+1)),u=Lc(a,r),l=i.h/u.length,f=l*s,v=i.y1+f;return{x1:i.x1,w:i.w,y1:v,h:l,yOffset:f}}}return i}};function T0(t){{var e=t.render;t.render=function(i){i=i||{};var o=t.cy;t.webgl&&(o.zoom()>Ec?(C0(t),e.call(t,i)):(S0(t),Rc(t,i,Xa.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(i){r.call(t,i),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(i,o,s,u){return R0(t,i,o)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var n=t.notify;t.notify=function(i,o){n.call(t,i,o),i==="viewport"||i==="bounds"?t.pickingFrameBuffer.needsDraw=!0:i==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}}function C0(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function S0(t){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.canvasWidth,t.canvasHeight),a.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function D0(t){var e=t.canvasWidth,r=t.canvasHeight,a=el(t),n=a.pan,i=a.zoom,o=ns();$n(o,o,[n.x,n.y]),Ds(o,o,[i,i]);var s=ns();v0(s,e,r);var u=ns();return f0(u,s,o),u}function Nc(t,e){var r=t.canvasWidth,a=t.canvasHeight,n=el(t),i=n.pan,o=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(i.x,i.y),e.scale(o,o)}function A0(t,e){t.drawSelectionRectangle(e,function(r){return Nc(t,r)})}function M0(t){var e=t.data.contexts[t.NODE];e.save(),Nc(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function L0(t){var e=function(n,i,o){for(var s=n.atlasManager.getAtlasCollection(i),u=t.data.contexts[t.NODE],l=s.atlases,f=0;f<l.length;f++){var v=l[f],c=v.canvas;if(c){var h=c.width,d=c.height,g=h*f,m=c.height*o,p=.4;u.save(),u.scale(p,p),u.drawImage(c,g,m),u.strokeStyle="black",u.rect(g,m,h,d),u.stroke(),u.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function N0(t,e,r,a,n){var i,o,s,u,l=el(t),f=l.pan,v=l.zoom;{var c=t0(t,f,v,e,r),h=dt(c,2),d=h[0],g=h[1],m=6;i=d-m/2,o=g-m/2,s=m,u=m}if(s===0||u===0)return[];var p=t.data.contexts[t.WEBGL];p.bindFramebuffer(p.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(p.viewport(0,0,p.canvas.width,p.canvas.height),Rc(t,null,Xa.PICKING),t.pickingFrameBuffer.needsDraw=!1);var y=s*u,b=new Uint8Array(y*4);p.readPixels(i,o,s,u,p.RGBA,p.UNSIGNED_BYTE,b),p.bindFramebuffer(p.FRAMEBUFFER,null);for(var E=new Set,C=0;C<y;C++){var A=b.slice(C*4,C*4+4),D=n0(A)-1;D>=0&&E.add(D)}return E}function R0(t,e,r){var a=N0(t,e,r),n=t.getCachedZSortedEles(),i,o,s=zt(a),u;try{for(s.s();!(u=s.n()).done;){var l=u.value,f=n[l];if(!i&&f.isNode()&&(i=f),!o&&f.isEdge()&&(o=f),i&&o)break}}catch(v){s.e(v)}finally{s.f()}return[i,o].filter(Boolean)}function us(t,e,r){var a=t.drawing;e+=1,r.isNode()?(a.drawNode(r,e,"node-underlay"),a.drawNode(r,e,"node-body"),a.drawTexture(r,e,"label"),a.drawNode(r,e,"node-overlay")):(a.drawEdgeLine(r,e),a.drawEdgeArrow(r,e,"source"),a.drawEdgeArrow(r,e,"target"),a.drawTexture(r,e,"label"),a.drawTexture(r,e,"edge-source-label"),a.drawTexture(r,e,"edge-target-label"))}function Rc(t,e,r){var a;t.webglDebug&&(a=performance.now());var n=t.drawing,i=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&A0(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=D0(t),u=t.getCachedZSortedEles();if(i=u.length,n.startFrame(s,r),r.screen){for(var l=0;l<u.nondrag.length;l++)us(t,l,u.nondrag[l]);for(var f=0;f<u.drag.length;f++)us(t,f,u.drag[f])}else if(r.picking)for(var v=0;v<u.length;v++)us(t,v,u[v]);n.endFrame(),r.screen&&t.webglDebugShowAtlases&&(M0(t),L0(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var c=performance.now(),h=!1,d=Math.ceil(c-a),g=n.getDebugInfo(),m=["".concat(i," elements"),"".concat(g.totalInstances," instances"),"".concat(g.batchCount," batches"),"".concat(g.totalAtlases," atlases"),"".concat(g.wrappedCount," wrapped textures"),"".concat(g.simpleCount," simple shapes")].join(", ");if(h)console.log("WebGL (".concat(r.name,") - time ").concat(d,"ms, ").concat(m));else{console.log("WebGL (".concat(r.name,") - frame time ").concat(d,"ms")),console.log("Totals:"),console.log(" ".concat(m)),console.log("Texture Atlases Used:");var p=g.atlasInfo,y=zt(p),b;try{for(y.s();!(b=y.n()).done;){var E=b.value;console.log(" ".concat(E.type,": ").concat(E.keyCount," keys, ").concat(E.atlasCount," atlases"))}}catch(C){y.e(C)}finally{y.f()}console.log("")}}t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,n.gc())}var Pr={};Pr.drawPolygonPath=function(t,e,r,a,n,i){var o=a/2,s=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*i[0],r+s*i[1]);for(var u=1;u<i.length/2;u++)t.lineTo(e+o*i[u*2],r+s*i[u*2+1]);t.closePath()};Pr.drawRoundPolygonPath=function(t,e,r,a,n,i,o){o.forEach(function(s){return vc(t,s)}),t.closePath()};Pr.drawRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?Cr(a,n):Math.min(i,s,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.arcTo(e+o,r-s,e+o,r,u),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.arcTo(e-o,r-s,e,r-s,u),t.lineTo(e,r-s),t.closePath()};Pr.drawBottomRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?Cr(a,n):i;t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.lineTo(e+o,r-s),t.lineTo(e+o,r),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.lineTo(e-o,r-s),t.lineTo(e,r-s),t.closePath()};Pr.drawCutRectanglePath=function(t,e,r,a,n,i,o){var s=a/2,u=n/2,l=o==="auto"?Gs():o;t.beginPath&&t.beginPath(),t.moveTo(e-s+l,r-u),t.lineTo(e+s-l,r-u),t.lineTo(e+s,r-u+l),t.lineTo(e+s,r+u-l),t.lineTo(e+s-l,r+u),t.lineTo(e-s+l,r+u),t.lineTo(e-s,r+u-l),t.lineTo(e-s,r-u+l),t.closePath()};Pr.drawBarrelPath=function(t,e,r,a,n){var i=a/2,o=n/2,s=e-i,u=e+i,l=r-o,f=r+o,v=cs(a,n),c=v.widthOffset,h=v.heightOffset,d=v.ctrlPtOffsetPct*c;t.beginPath&&t.beginPath(),t.moveTo(s,l+h),t.lineTo(s,f-h),t.quadraticCurveTo(s+d,f,s+c,f),t.lineTo(u-c,f),t.quadraticCurveTo(u-d,f,u,f-h),t.lineTo(u,l+h),t.quadraticCurveTo(u-d,l,u-c,l),t.lineTo(s+c,l),t.quadraticCurveTo(s+d,l,s,l+h),t.closePath()};var Wf=Math.sin(0),Xf=Math.cos(0),As={},Ms={},Pc=Math.PI/40;for(Vr=0*Math.PI;Vr<2*Math.PI;Vr+=Pc)As[Vr]=Math.sin(Vr),Ms[Vr]=Math.cos(Vr);var Vr;Pr.drawEllipsePath=function(t,e,r,a,n){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,n/2,0,0,2*Math.PI);else for(var i,o,s=a/2,u=n/2,l=0*Math.PI;l<2*Math.PI;l+=Pc)i=e-s*As[l]*Wf+s*Ms[l]*Xf,o=r+u*Ms[l]*Wf+u*As[l]*Xf,l===0?t.moveTo(i,o):t.lineTo(i,o);t.closePath()};var gn={};gn.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};gn.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),n=this.findContainerClientCoords(),i=t.full?Math.ceil(a.w):n[2],o=t.full?Math.ceil(a.h):n[3],s=we(t.maxWidth)||we(t.maxHeight),u=this.getPixelRatio(),l=1;if(t.scale!==void 0)i*=t.scale,o*=t.scale,l=t.scale;else if(s){var f=1/0,v=1/0;we(t.maxWidth)&&(f=l*t.maxWidth/i),we(t.maxHeight)&&(v=l*t.maxHeight/o),l=Math.min(f,v),i*=l,o*=l}s||(i*=u,o*=u,l*=u);var c=document.createElement("canvas");c.width=i,c.height=o,c.style.width=i+"px",c.style.height=o+"px";var h=c.getContext("2d");if(i>0&&o>0){h.clearRect(0,0,i,o),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)h.translate(-a.x1*l,-a.y1*l),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(a.x1*l,a.y1*l);else{var g=e.pan(),m={x:g.x*l,y:g.y*l};l*=e.zoom(),h.translate(m.x,m.y),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(-m.x,-m.y)}t.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=t.bg,h.rect(0,0,i,o),h.fill())}return c};function P0(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new Blob([a],{type:e})}function $f(t){var e=t.indexOf(",");return t.substr(e+1)}function Oc(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new Ta(function(n,i){try{e.toBlob(function(o){o!=null?n(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){i(o)}});case"blob":return P0($f(a()),r);case"base64":return $f(a());default:return a()}}gn.png=function(t){return Oc(t,this.bufferCanvasImage(t),"image/png")};gn.jpg=function(t){return Oc(t,this.bufferCanvasImage(t),"image/jpeg")};var Ic={};Ic.nodeShapeImpl=function(t,e,r,a,n,i,o,s){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,n,i);case"polygon":return this.drawPolygonPath(e,r,a,n,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,n,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,n,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,n,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,n,i,s);case"barrel":return this.drawBarrelPath(e,r,a,n,i)}};var O0=Bc,Ge=Bc.prototype;Ge.CANVAS_LAYERS=3;Ge.SELECT_BOX=0;Ge.DRAG=1;Ge.NODE=2;Ge.WEBGL=3;Ge.CANVAS_TYPES=["2d","2d","2d","webgl2"];Ge.BUFFER_COUNT=3;Ge.TEXTURE_BUFFER=0;Ge.MOTIONBLUR_BUFFER_NODE=1;Ge.MOTIONBLUR_BUFFER_DRAG=2;function Bc(t){var e=this,r=e.cy.window(),a=r.document;t.webgl&&(Ge.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(Ge.CANVAS_LAYERS),contexts:new Array(Ge.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Ge.CANVAS_LAYERS),bufferCanvases:new Array(Ge.BUFFER_COUNT),bufferContexts:new Array(Ge.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=t.cy.container();s.appendChild(e.data.canvasContainer),s.style[n]=i;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Ch()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<Ge.CANVAS_LAYERS;l++){var f=e.data.canvases[l]=a.createElement("canvas"),v=Ge.CANVAS_TYPES[l];e.data.contexts[l]=f.getContext(v),e.data.contexts[l]||nt("Could not create canvas of type "+v),Object.keys(u).forEach(function($){f.style[$]=u[$]}),f.style.position="absolute",f.setAttribute("data-id","layer"+l),f.style.zIndex=String(Ge.CANVAS_LAYERS-l),e.data.canvasContainer.appendChild(f),e.data.canvasNeedsRedraw[l]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Ge.NODE].setAttribute("data-id","layer"+Ge.NODE+"-node"),e.data.canvases[Ge.SELECT_BOX].setAttribute("data-id","layer"+Ge.SELECT_BOX+"-selectbox"),e.data.canvases[Ge.DRAG].setAttribute("data-id","layer"+Ge.DRAG+"-drag"),e.data.canvases[Ge.WEBGL]&&e.data.canvases[Ge.WEBGL].setAttribute("data-id","layer"+Ge.WEBGL+"-webgl");for(var l=0;l<Ge.BUFFER_COUNT;l++)e.data.bufferCanvases[l]=a.createElement("canvas"),e.data.bufferContexts[l]=e.data.bufferCanvases[l].getContext("2d"),e.data.bufferCanvases[l].style.position="absolute",e.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),e.data.bufferCanvases[l].style.zIndex=String(-l-1),e.data.bufferCanvases[l].style.visibility="hidden";e.pathsEnabled=!0;var c=Bt(),h=function(q){return{x:(q.x1+q.x2)/2,y:(q.y1+q.y2)/2}},d=function(q){return{x:-q.w/2,y:-q.h/2}},g=function(q){var K=q[0]._private,ee=K.oldBackgroundTimestamp===K.backgroundTimestamp;return!ee},m=function(q){return q[0]._private.nodeKey},p=function(q){return q[0]._private.labelStyleKey},y=function(q){return q[0]._private.sourceLabelStyleKey},b=function(q){return q[0]._private.targetLabelStyleKey},E=function(q,K,ee,ne,te){return e.drawElement(q,K,ee,!1,!1,te)},C=function(q,K,ee,ne,te){return e.drawElementText(q,K,ee,ne,"main",te)},A=function(q,K,ee,ne,te){return e.drawElementText(q,K,ee,ne,"source",te)},D=function(q,K,ee,ne,te){return e.drawElementText(q,K,ee,ne,"target",te)},N=function(q){return q.boundingBox(),q[0]._private.bodyBounds},O=function(q){return q.boundingBox(),q[0]._private.labelBounds.main||c},R=function(q){return q.boundingBox(),q[0]._private.labelBounds.source||c},P=function(q){return q.boundingBox(),q[0]._private.labelBounds.target||c},w=function(q,K){return K},x=function(q){return h(N(q))},T=function(q,K,ee){var ne=q?q+"-":"";return{x:K.x+ee.pstyle(ne+"text-margin-x").pfValue,y:K.y+ee.pstyle(ne+"text-margin-y").pfValue}},M=function(q,K,ee){var ne=q[0]._private.rscratch;return{x:ne[K],y:ne[ee]}},S=function(q){return T("",M(q,"labelX","labelY"),q)},I=function(q){return T("source",M(q,"sourceLabelX","sourceLabelY"),q)},B=function(q){return T("target",M(q,"targetLabelX","targetLabelY"),q)},V=function(q){return d(N(q))},F=function(q){return d(R(q))},k=function(q){return d(P(q))},U=function(q){var K=O(q),ee=d(O(q));if(q.isNode()){switch(wa(q.pstyle("text-halign").value)){case"left":ee.x=-K.w-(K.leftPad||0);break;case"right":ee.x=-(K.rightPad||0);break}switch(Ea(q.pstyle("text-valign").value)){case"top":ee.y=-K.h-(K.topPad||0);break;case"bottom":ee.y=-(K.botPad||0);break}}return ee},J=e.data.eleTxrCache=new qa(e,{getKey:m,doesEleInvalidateKey:g,drawElement:E,getBoundingBox:N,getRotationPoint:x,getRotationOffset:V,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),W=e.data.lblTxrCache=new qa(e,{getKey:p,drawElement:C,getBoundingBox:O,getRotationPoint:S,getRotationOffset:U,isVisible:w}),Q=e.data.slbTxrCache=new qa(e,{getKey:y,drawElement:A,getBoundingBox:R,getRotationPoint:I,getRotationOffset:F,isVisible:w}),Z=e.data.tlbTxrCache=new qa(e,{getKey:b,drawElement:D,getBoundingBox:P,getRotationPoint:B,getRotationOffset:k,isVisible:w}),H=e.data.lyrTxrCache=new xc(e);e.onUpdateEleCalcs(function(q,K){J.invalidateElements(K),W.invalidateElements(K),Q.invalidateElements(K),Z.invalidateElements(K),H.invalidateElements(K);for(var ee=0;ee<K.length;ee++){var ne=K[ee]._private;ne.oldBackgroundTimestamp=ne.backgroundTimestamp}});var j=function(q){for(var K=0;K<q.length;K++)H.enqueueElementRefinement(q[K].ele)};J.onDequeue(j),W.onDequeue(j),Q.onDequeue(j),Z.onDequeue(j),t.webgl&&e.initWebgl(t,{getStyleKey:m,getLabelKey:p,getSourceLabelKey:y,getTargetLabelKey:b,drawElement:E,drawLabel:C,drawSourceLabel:A,drawTargetLabel:D,getElementBox:N,getLabelBox:O,getSourceLabelBox:R,getTargetLabelBox:P,getElementRotationPoint:x,getElementRotationOffset:V,getLabelRotationPoint:S,getSourceLabelRotationPoint:I,getTargetLabelRotationPoint:B,getLabelRotationOffset:U,getSourceLabelRotationOffset:F,getTargetLabelRotationOffset:k})}Ge.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Ge.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Ge.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Ge.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var I0=typeof Path2D<"u";Ge.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};Ge.usePaths=function(){return I0&&this.pathsEnabled};Ge.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};Ge.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};Ge.makeOffscreenCanvas=function(t,e){var r;if((typeof OffscreenCanvas>"u"?"undefined":mt(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),n=a.document;r=n.createElement("canvas"),r.width=t,r.height=e}return r};[Tc,rr,fr,js,Qr,Rr,kt,Mc,Pr,gn,Ic].forEach(function(t){Re(Ge,t)});var B0=[{name:"null",impl:lc},{name:"base",impl:bc},{name:"canvas",impl:O0}],k0=[{type:"layout",extensions:im},{type:"renderer",extensions:B0}],kc={},Fc={};function zc(t,e,r){var a=r,n=function(N){Qe("Can not register `"+e+"` for `"+t+"` since `"+N+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(tn.prototype[e])return n(e);tn.prototype[e]=r}else if(t==="collection"){if(St.prototype[e])return n(e);St.prototype[e]=r}else if(t==="layout"){for(var i=function(N){this.options=N,r.call(this,N),$e(this._private)||(this._private={}),this._private.cy=N.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var f=r.prototype.stop;o.stop=function(){var D=this.options;if(D&&D.animate){var N=this.animations;if(N)for(var O=0;O<N.length;O++)N[O].stop()}return f?f.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var v=function(N){return N._private.cy},c={addEventFields:function(N,O){O.layout=N,O.cy=v(N),O.target=N},bubble:function(){return!0},parent:function(N){return v(N)}};Re(o,{createEmitter:function(){return this._private.emitter=new mi(c,this),this},emitter:function(){return this._private.emitter},on:function(N,O){return this.emitter().on(N,O),this},one:function(N,O){return this.emitter().one(N,O),this},once:function(N,O){return this.emitter().one(N,O),this},removeListener:function(N,O){return this.emitter().removeListener(N,O),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(N,O){return this.emitter().emit(N,O),this}}),Ze.eventAliasesOn(o),a=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var h=Vc("renderer","base"),d=h.prototype,g=r,m=r.prototype,p=function(){h.apply(this,arguments),g.apply(this,arguments)},y=p.prototype;for(var b in d){var E=d[b],C=m[b]!=null;if(C)return n(b);y[b]=E}for(var A in m)y[A]=m[A];d.clientFunctions.forEach(function(D){y[D]=y[D]||function(){nt("Renderer does not implement `renderer."+D+"()` on its prototype")}}),a=p}else if(t==="__proto__"||t==="constructor"||t==="prototype")return nt(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return rv({map:kc,keys:[t,e],value:a})}function Vc(t,e){return av({map:kc,keys:[t,e]})}function F0(t,e,r,a,n){return rv({map:Fc,keys:[t,e,r,a],value:n})}function z0(t,e,r,a){return av({map:Fc,keys:[t,e,r,a]})}var Ls=function(){if(arguments.length===2)return Vc.apply(null,arguments);if(arguments.length===3)return zc.apply(null,arguments);if(arguments.length===4)return z0.apply(null,arguments);if(arguments.length===5)return F0.apply(null,arguments);nt("Invalid extension access syntax")};tn.prototype.extension=Ls;k0.forEach(function(t){t.extensions.forEach(function(e){zc(t.type,e.name,e.impl)})});var si=function(){if(!(this instanceof si))return new si;this.length=0},_r=si.prototype;_r.instanceString=function(){return"stylesheet"};_r.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};_r.css=function(t,e){var r=this.length-1;if(Le(t))this[r].properties.push({name:t,value:e});else if($e(t))for(var a=t,n=Object.keys(a),i=0;i<n.length;i++){var o=n[i],s=a[o];if(s!=null){var u=xt.properties[o]||xt.properties[li(o)];if(u!=null){var l=u.name,f=s;this[r].properties.push({name:l,value:f})}}}return this};_r.style=_r.css;_r.generateStyle=function(t){var e=new xt(t);return this.appendToStyle(e)};_r.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,n=r.properties;t.selector(a);for(var i=0;i<n.length;i++){var o=n[i];t.css(o.name,o.value)}}return t};var V0="3.34.0",lr=function(e){if(e===void 0&&(e={}),$e(e))return new tn(e);if(Le(e))return Ls.apply(Ls,arguments)};lr.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(lr),t.apply(null,e),this};lr.warnings=function(t){return fv(t)};lr.version=V0;lr.stylesheet=lr.Stylesheet=si;var _c=oh(Gc(),1);var Ma={Entity:0,Service:1,Event:1,UseCase:2,Port:3,DTO:4,VO:4,Error:4,Shared:4,Adapter:5},qc={Entity:95,Service:72,Event:60,UseCase:48,Port:30,DTO:0,VO:0,Error:0,Shared:22,Adapter:18},Yc={Entity:"barrel",Service:"rectangle",UseCase:"round-rectangle",Port:"cut-rectangle",Event:"rhomboid",DTO:"round-rectangle",VO:"round-rectangle",Error:"round-rectangle",Shared:"round-rectangle",Adapter:"round-rectangle"},ol=["Entity","Service","UseCase","Port","Event"],sl=["DTO","VO","Error"],bn=42,Wc=338,G0=15;function Uc(t){let e=0;for(let a=0;a<t.length;a++)e=e*31+t.charCodeAt(a)|0;let r=Math.abs(e*.6180339887%1);return Math.round(bn+r*(Wc-bn))}var U0=(t,e)=>{let r=Math.abs(t-e)%360;return Math.min(r,360-r)};function Xc(t){let e=[...new Set(t)].filter(i=>!La(i)).sort(),r=[],a=new Map,n=Wc-bn;for(let i of e){let o=Uc(i),s=o;for(let u=0;u<n;u++){let l=bn+(o-bn+u)%n;if(r.every(f=>U0(f,l)>=G0)){s=l;break}}r.push(s),a.set(i,s)}return i=>La(i)?0:a.get(i)??Uc(i)}var La=t=>t==="common"||t==="shared",Di=190,H0=40,q0=230,Y0=268,W0=130,Hc=34,X0=30;function $0(t){let e=new Map;for(let o of t){let s=Ma[o.component];e.set(s,[...e.get(s)??[],o])}let r=new Map,a=0;for(let o of[...e.keys()].sort((s,u)=>s-u)){let s=e.get(o),u=s.length*Y0/(2*Math.PI),l=o===0&&s.length===1?0:Math.max(a+q0,u,170);s.forEach((f,v)=>{if(l===0)r.set(f.id,[0,0]);else{let c=2*Math.PI*v/s.length-Math.PI/2;r.set(f.id,[l*Math.cos(c),l*Math.sin(c)])}}),a=l}let n=0,i=0;for(let[o,s]of r.values())n=Math.max(n,Math.abs(o)),i=Math.max(i,Math.abs(s));return{pos:r,hw:n+Di/2+Hc,hh:i+H0/2+Hc+X0/2}}function K0(t,e,r=W0){let a=new Map(t.nodes.map(c=>[c.id,c])),n=new Map;for(let c of t.edges){let h=a.get(c.src)?.domain,d=a.get(c.dst)?.domain;if(!h||!d||h===d)continue;let g=h<d?`${h}|${d}`:`${d}|${h}`;n.set(g,(n.get(g)??0)+1)}let i=c=>e.get(c)??{hw:0,hh:0},o=c=>i(c).hw*i(c).hh,s=[...e.keys()].sort((c,h)=>o(h)-o(c)),u=new Map,l=0,f=0;s.forEach((c,h)=>{if(h===0){u.set(c,[0,0]);return}l+=Math.hypot(i(c).hw,i(c).hh)*.95,f+=2.399963,u.set(c,[l*Math.cos(f),l*Math.sin(f)])});let v=c=>{let h=0;for(let d=0;d<s.length;d++){let g=s[d];for(let m=d+1;m<s.length;m++){let p=s[m],y=u.get(g),b=u.get(p),E=b[0]-y[0],C=b[1]-y[1],A=i(g).hw+i(p).hw+r-Math.abs(E),D=i(g).hh+i(p).hh+r-Math.abs(C);if(A<=0||D<=0)continue;h=Math.max(h,Math.min(A,D));let N=Math.min(A,D)*c;if(A<D){let O=E>=0?1:-1;y[0]-=O*N,b[0]+=O*N}else{let O=C>=0?1:-1;y[1]-=O*N,b[1]+=O*N}}}return h};for(let c=0;c<400;c++){for(let h=0;h<s.length;h++){let d=s[h];for(let g=h+1;g<s.length;g++){let m=s[g],p=n.get(d<m?`${d}|${m}`:`${m}|${d}`)??0,y=u.get(d),b=u.get(m),E=b[0]-y[0],C=b[1]-y[1],A=Math.hypot(E,C)||1,D=i(d).hw+i(m).hw+r-Math.abs(E),N=i(d).hh+i(m).hh+r-Math.abs(C);if(D>0&&N>0)continue;let O=-Math.min(D,N),R=Math.min(O*(p?.06*Math.log1p(p):.006),90);u.set(d,[y[0]+E/A*R,y[1]+C/A*R]),u.set(m,[b[0]-E/A*R,b[1]-C/A*R])}}v(.5);for(let h of s){let d=u.get(h);d[0]-=d[0]*.004,d[1]-=d[1]*.004}}for(let c=0;c<600&&v(.5)>.5;c++);return u}function ll(t){let e=new Map;for(let o of t.nodes)e.set(o.domain,[...e.get(o.domain)??[],o]);let r=new Map,a=new Map;for(let[o,s]of e){let u=$0(s);r.set(o,u.pos),a.set(o,{hw:u.hw,hh:u.hh})}let n=K0(t,a),i=[];for(let[o,s]of r){let[u,l]=n.get(o)??[0,0];for(let[f,[v,c]]of s)i.push({id:f,x:Math.round(u+v),y:Math.round(l+c)})}return i}var _0=Di+54,Z0=74;function Q0(t,e){let r=[...e].sort((i,o)=>Ma[i.component]-Ma[o.component]||i.name.localeCompare(o.name)),a=Math.max(1,Math.min(5,Math.ceil(Math.sqrt(r.length/2.2)))),n=Math.ceil(r.length/a);return{d:t,items:r,cols:a,w:a*_0+80,h:n*Z0+92}}function $c(t,e=3e3){let r=new Map;for(let l of t.nodes)r.set(l.domain,[...r.get(l.domain)??[],l]);let a=[...r.entries()].map(([l,f])=>Q0(l,f)).sort((l,f)=>f.items.length-l.items.length),n=e,i=[],o=0,s=0,u=0;for(let l of a)s+l.w>n&&s>0&&(o+=u+90,s=0,u=0),l.items.forEach((f,v)=>{i.push({id:f.id,x:Math.round(s+40+v%l.cols*(Di+54)+Di/2),y:Math.round(o+52+Math.floor(v/l.cols)*74)})}),s+=l.w+70,u=Math.max(u,l.h);return i}lr.use(_c.default);var vr=(t,e,r)=>`hsl(${t},${e}%,${r}%)`,He=t=>document.getElementById(t),ea=t=>Array.from(document.querySelectorAll(t)),Ue,wt,pl,Li="hex",Or=!1,jr=!1,Ai,ta=null,Jr="both",Kc,Ni,wn=()=>0;async function J0(){wt=await(await fetch("/api/graph")).json();let t=[...new Set(wt.nodes.map(a=>a.domain))];wn=Xc(t);let e=[...new Set(wt.nodes.map(a=>a.component))].sort((a,n)=>Ma[a]-Ma[n]);pl={hex:new Map(ll(wt).map(a=>[a.id,{x:a.x,y:a.y}])),grid:new Map($c(wt).map(a=>[a.id,{x:a.x,y:a.y}]))},document.title=`${wt.project} \u2014 hexwright`,He("title").textContent=wt.project,He("ref").textContent=wt.ref;let r={added:wt.nodes.filter(a=>a.status==="added").length,modified:wt.nodes.filter(a=>a.status==="modified").length,addedEdges:wt.edges.filter(a=>a.status==="added").length};(r.added||r.modified)&&(He("delta").innerHTML=`<span class="k"></span>added ${r.added} nodes \xB7 ${r.addedEdges} edges<br><span class="k2"></span>modified ${r.modified} nodes`,He("deltaBox").style.display="block"),j0(t,e),tb(),cl("bhex"),gl("core")}function j0(t,e){let r=new Map;for(let a of wt.nodes)r.set(`c:${a.component}`,(r.get(`c:${a.component}`)??0)+1),r.set(`d:${a.domain}`,(r.get(`d:${a.domain}`)??0)+1);He("comps").innerHTML=e.map(a=>`<label><span class="sw" style="${eb(a)}"></span><input type=checkbox class=cf value="${a}" ${ol.includes(a)?"checked":""}>${a}<span class="n">${r.get(`c:${a}`)??0}</span></label>`).join(""),He("doms").innerHTML=t.sort((a,n)=>(r.get(`d:${n}`)??0)-(r.get(`d:${a}`)??0)).map(a=>{let n=wn(a);return`<label><span class="sw" style="background:${vr(n,La(a)?0:60,50)}"></span><input type=checkbox class=df value="${a}" checked>${a}<span class="n">${r.get(`d:${a}`)??0}</span></label>`}).join("");for(let a of ea(".cf,.df,.rf"))a.onchange=()=>Ir();He("showId").onchange=()=>Ir(),He("crossOnly").onchange=()=>Ir(),He("deltaOnly").onchange=()=>Ir()}function eb(t){let e="#8b949e";return sl.includes(t)?`border:1.4px dashed ${e};border-radius:5px`:`background:${e};${{Entity:"border-radius:6px/50%",Service:"border-radius:0",Port:"clip-path:polygon(22% 0,100% 0,100% 78%,78% 100%,0 100%,0 22%)",Event:"transform:skewX(-16deg)"}[t]??"border-radius:5px"}`}function tb(){let t=[...new Set(wt.nodes.map(n=>n.domain))].map(n=>({data:{id:`dom::${n}`,label:n,kind:"domain",hue:wn(n),sat:La(n)?0:26}})),e=wt.nodes.map(n=>({data:{...n,parent:`dom::${n.domain}`,kind:"type",hue:wn(n.domain),sat:La(n.domain)?0:qc[n.component],shape:Yc[n.component],outline:sl.includes(n.component),label:n.name},position:{...pl.hex.get(n.id)??{x:0,y:0}}})),r=wt.edges.map((n,i)=>({data:{...n,id:`e${i}`,source:n.src,target:n.dst,hue:wn(vl(n.src)?.domain??"")}}));Ue=lr({container:He("cy"),elements:[...t,...e,...r],layout:{name:"preset"},minZoom:.05,maxZoom:3,wheelSensitivity:.25,style:[{selector:'node[kind="domain"]',style:{"background-color":n=>vr(n.data("hue"),n.data("sat"),13),"background-opacity":.5,"border-width":1.5,"border-color":n=>vr(n.data("hue"),n.data("sat")+19,42),shape:"round-rectangle",label:"data(label)","text-valign":"top","font-size":21,"font-weight":"bold",color:n=>vr(n.data("hue"),n.data("sat")+29,62),"text-margin-y":-7,padding:"16px"}},{selector:'node[kind="type"]',style:{shape:"data(shape)",width:"182px",height:"32px","background-color":n=>vr(n.data("hue"),n.data("sat"),46-n.data("sat")*.07),"background-opacity":n=>n.data("outline")?0:1,label:"data(label)","font-size":11,"text-valign":"center","text-wrap":"ellipsis","text-max-width":"160px",color:n=>n.data("outline")?vr(n.data("hue"),n.data("hue")?52:0,72):"#fff","border-width":n=>n.data("outline")?1.4:1,"border-color":n=>vr(n.data("hue"),n.data("outline")?48:n.data("sat"),n.data("outline")?52:70),"border-style":n=>n.data("outline")?"dashed":"solid"}},{selector:'node[component="Entity"]',style:{"border-width":2.6,width:"190px",height:"36px","font-weight":"bold","font-size":12}},{selector:'node[component="Service"]',style:{"border-width":1.8}},{selector:"edge",style:{width:1.9,"line-color":n=>vr(n.data("hue"),n.data("crossDomain")?62:22,n.data("crossDomain")?58:46),opacity:n=>n.data("crossDomain")?.8:.62,"target-arrow-color":n=>vr(n.data("hue"),n.data("crossDomain")?62:22,n.data("crossDomain")?58:46)}},{selector:'edge[rel="DEPENDS_ON"]',style:{"line-style":"solid","curve-style":"straight","target-arrow-shape":"vee","arrow-scale":.95}},{selector:'edge[rel="IMPLEMENTS"]',style:{"line-style":"dashed","line-dash-pattern":[9,5],width:2.2,"curve-style":"unbundled-bezier","control-point-distances":[42],"control-point-weights":[.5],"target-arrow-shape":"triangle","target-arrow-fill":"hollow","arrow-scale":1.35}},{selector:'edge[rel="EXTENDS"]',style:{"line-style":"dashed","line-dash-pattern":[3,3],width:3.4,"curve-style":"unbundled-bezier","control-point-distances":[58],"control-point-weights":[.5],"target-arrow-shape":"triangle","target-arrow-fill":"hollow","arrow-scale":1.6}},{selector:"edge[?identifierOnly]",style:{"line-style":"dotted",opacity:.4}},{selector:'edge[violation != ""]',style:{"line-color":"#f85149","target-arrow-color":"#f85149",width:3.4,opacity:1,"z-index":90,label:"data(violation)","font-size":10,color:"#f85149","text-background-color":"#0e1116","text-background-opacity":.85,"text-background-padding":"3px"}},{selector:'edge[status="added"]',style:{opacity:1,"line-color":"#f0883e","target-arrow-color":"#f0883e","z-index":80}},{selector:".dim",style:{opacity:.035,"text-opacity":0}},{selector:".nb",style:{"border-width":2.4,"border-color":"#58a6ff","z-index":50}},{selector:".hi",style:{"border-width":5,"border-color":"#58a6ff","z-index":100}},{selector:"edge.sel",style:{width:5,opacity:1,"line-color":"#58a6ff","target-arrow-color":"#58a6ff","z-index":99}}]}),window.cy=Ue,new ResizeObserver(()=>{Ue.resize();let n=Ue.nodes('[kind="type"]').filter(i=>i.style("display")==="element");n.length&&Ue.fit(n,40)}).observe(He("cy")),Ue.on("tap",'node[kind="type"]',n=>dl(n.target)),Ue.on("tap","edge",n=>sb(n.target)),Ue.on("tap",n=>{let i=n.target;(n.target===Ue||i.data?.("kind")==="domain")&&hl()}),document.addEventListener("keydown",n=>{n.key==="Escape"&&hl()})}var vl=t=>wt.nodes.find(e=>e.id===t);function Ir(){let t=new Set(ea(".cf:checked").map(u=>u.value)),e=new Set(ea(".df:checked").map(u=>u.value)),r=new Set(ea(".rf:checked").map(u=>u.value)),a=He("showId").checked,n=He("crossOnly").checked,i=He("deltaOnly").checked,o=new Set;if(jr)for(let u of Ue.edges())u.data("violation")&&(o.add(u.data("source")),o.add(u.data("target")));Ue.batch(()=>{for(let l of Ue.nodes('[kind="type"]')){let f=l.data(),v=t.has(f.component)&&e.has(f.domain);v&&i&&f.status==="existing"&&(v=!1),v&&jr&&!o.has(f.id)&&(v=!1),l.style("display",v?"element":"none")}let u=l=>l.style("display")==="element";for(let l of Ue.nodes('[kind="domain"]'))l.style("display",l.children().filter(f=>u(f)).length?"element":"none");for(let l of Ue.edges()){let f=u(l.source())&&u(l.target())&&r.has(l.data("rel"));f&&!a&&l.data("identifierOnly")&&(f=!1),f&&n&&!l.data("crossDomain")&&(f=!1),f&&jr&&!l.data("violation")&&(f=!1),l.style("display",f?"element":"none")}}),rb(),Ue.nodes('[kind="type"]').filter(u=>u.style("display")==="element").length&&ab()}function rb(){let t=n=>n.style("display")==="element",e=Ue.nodes('[kind="type"]').filter(n=>t(n)).length,r=Ue.edges().filter(n=>t(n)).length,a=Ue.edges().filter(n=>t(n)&&n.data("violation")).length;He("stat").innerHTML=`Nodes <b>${e}</b>/${Ue.nodes('[kind="type"]').length} \xB7 Edges <b>${r}</b>/${Ue.edges().length}`,He("cviol").textContent=String(a);for(let n of["DEPENDS_ON","IMPLEMENTS","EXTENDS"]){let i=document.getElementById(`c${n}`);i&&(i.textContent=String(Ue.edges(`[rel="${n}"]`).filter(o=>t(o)).length))}}function ab(){clearTimeout(Kc),Kc=setTimeout(Mi,110)}function Mi(){Ni?.stop(),Ni=void 0,Or?Li==="hex"?nb():ob():ib()}var ul=t=>t.style("display")==="element";function nb(){let t=new Set(Ue.nodes('[kind="type"]').filter(i=>ul(i)).map(i=>i.id())),e=new Set(Ue.edges().filter(i=>ul(i)).map(i=>i.id())),r={...wt,nodes:wt.nodes.filter(i=>t.has(i.id)),edges:wt.edges.filter((i,o)=>e.has(`e${o}`))},a=new Map(ll(r).map(i=>[i.id,i]));Ue.batch(()=>{for(let i of Ue.nodes('[kind="type"]')){let o=a.get(i.id());o&&i.position({x:o.x,y:o.y})}});let n=Ue.nodes('[kind="type"]').filter(i=>ul(i));n.length&&Ue.fit(n,40)}function ib(){let t=pl[Li];Ue.batch(()=>{for(let r of Ue.nodes('[kind="type"]')){let a=t.get(r.id());a&&r.position({x:a.x,y:a.y})}});let e=Ue.nodes('[kind="type"]').filter(r=>r.style("display")==="element");e.length&&Ue.fit(e,40)}function ob(){let t=Ue.elements().filter(r=>r.style("display")==="element"),e=t.nodes().length;e&&(Ni=t.layout({name:"fcose",quality:e<=150?"proof":e<=400?"default":"draft",numIter:e<=150?1600:e<=400?900:500,randomize:e<=150,animate:e<=250,animationDuration:400,nodeSeparation:210,idealEdgeLength:r=>r.data("crossDomain")?300:130,nodeRepulsion:34e3,gravity:.12,gravityCompound:.9,gravityRangeCompound:2.2,packComponents:!0,tile:!0,nodeDimensionsIncludeLabels:!0,stop:()=>Ue.fit(t.nodes(),60)}),Ni.run())}var cl=t=>{for(let e of["bhex","bgrid"])He(e).classList.toggle("on",e===t)};function hl(){Ue.elements().removeClass("hi dim sel nb"),He("info").style.display="none",ta=null,Jr="both"}var Vt=(t,e)=>`<tr><td>${t}</td><td>${e}</td></tr>`,fl=t=>t?'<span style="color:#f0883e">yes</span>':"no",Zc=t=>t==="added"?'<span style="color:#f0883e">added</span>':t==="modified"?'<span style="color:#a371f7">modified</span>':"existing";function dl(t){ta=t.id();let e=t.data(),r=c=>c.style("display")==="element",a=t.connectedEdges().filter(c=>r(c)),n=a.filter(c=>c.target().id()===ta),i=a.filter(c=>c.source().id()===ta),o=Jr==="in"?n:Jr==="out"?i:a,s=o.connectedNodes().difference(t);Ue.elements().removeClass("hi dim sel nb").addClass("dim"),t.removeClass("dim").addClass("hi"),s.removeClass("dim").addClass("nb"),o.removeClass("dim").addClass("sel"),s.parent().removeClass("dim"),t.parent().removeClass("dim");let u=(c,h,d)=>`<button class="dirb ${Jr===c?"on":""}" data-dir="${c}">${h} ${d}</button>`,l=(c,h,d)=>{let g=d.data();return`<div class="lk" data-goto="${g.id}"><span class="ar">${h}</span>${g.name}<span class="mut"> ${g.domain}\xB7${g.component}</span><span class="rel">${c.data("rel")==="DEPENDS_ON"?"":c.data("rel")}</span></div>`},f="";if(Jr!=="out")for(let c of n)f+=l(c,"\u2190",c.source());if(Jr!=="in")for(let c of i)f+=l(c,"\u2192",c.target());let v=e.api.length||e.props.length?`<div class="dirbar" style="display:block"><b>Public contract</b><span class="mut"> ${e.api.length} fn${e.props.length?` \xB7 ${e.props.length} prop`:""}</span></div><div class="lks">${e.api.map(c=>{let h=c.indexOf("(");return`<div class="lk"><span class="sig"><b>${c.slice(0,h)}</b>${c.slice(h)}</span></div>`}).join("")}${e.props.map(c=>`<div class="lk"><span class="sig" style="color:#6e7681">${c}</span></div>`).join("")}</div>`:"";He("info").style.display="block",He("info").innerHTML=`<div class="ih">${e.name}<span class="x">\xD7</span></div><table>${Vt("Domain",e.domain)}${Vt("Component",`${e.component} <span class="mut">${e.layer}${e.sublayer?`/${e.sublayer}`:""}</span>`)}${Vt("Kind",e.kind)}${Vt("Status",Zc(e.status))}${Vt("File",`<span class="mut">${e.file}:${e.line}</span>`)}${Vt("Id",`<span class="mut" style="word-break:break-all">${e.id}</span>`)}</table>${v}<div class="dirbar">${u("both","Both",a.length)}${u("in","\u2190 In",n.length)}${u("out","Out \u2192",i.length)}</div><div class="lks">${f||'<span class="mut">No visible connections</span>'}</div><div class="hint">Click an item to focus it \xB7 Esc to clear</div>`,Qc()}function sb(t){ta=null;let e=t.data(),r=vl(e.src),a=vl(e.dst);Ue.elements().removeClass("hi dim sel nb").addClass("dim"),t.removeClass("dim").addClass("sel"),t.connectedNodes().removeClass("dim").addClass("nb").parent().removeClass("dim");let n=e.contracts.length?`<div class="dirbar" style="display:block"><b>Contracts used</b><span class="mut"> ${e.contracts.length}/${a?.api.length??0}</span></div><div class="lks">${e.contracts.map(i=>{let o=i.indexOf("(");return`<div class="lk"><span class="sig"><b>${o>0?i.slice(0,o):i}</b>${o>0?i.slice(o):""}</span></div>`}).join("")}</div>`:'<div class="hint">No method calls \u2014 type reference only</div>';He("info").style.display="block",He("info").innerHTML=`<div class="ih">${e.rel}<span class="x">\xD7</span></div><table>${Vt("Source",`${r?.name} <span class="mut">${r?.domain}\xB7${r?.component}</span>`)}${Vt("Target",`${a?.name} <span class="mut">${a?.domain}\xB7${a?.component}</span>`)}${e.rel==="DEPENDS_ON"?Vt("Weight",`${e.weight} <span class="mut">occurrences</span>`):""}${Vt("Cross-domain",fl(e.crossDomain))}${Vt("Identifier only",fl(e.identifierOnly))}${Vt("Via signature",fl(e.viaSignature))}${e.violation?Vt("Violation",`<span style="color:#f85149">${e.violation}</span>`):""}${Vt("Status",Zc(e.status))}</table>${n}`,Qc()}function Qc(){let t=He("info").querySelector(".x");t&&(t.onclick=()=>hl());for(let e of Array.from(He("info").querySelectorAll(".dirb")))e.onclick=()=>{Jr=e.dataset.dir,ta&&dl(Ue.getElementById(ta))};for(let e of Array.from(He("info").querySelectorAll("[data-goto]")))e.onclick=()=>dl(Ue.getElementById(e.dataset.goto))}function gl(t){for(let e of ea(".cf"))e.checked=t==="core"?ol.includes(e.value):!0;for(let e of["pcore","pall"])He(e).classList.toggle("on",e===`p${t}`);Ir()}function lb(){He("pcore").onclick=()=>gl("core"),He("pall").onclick=()=>gl("all"),He("bhex").onclick=()=>{Li="hex",cl("bhex"),Mi()},He("bgrid").onclick=()=>{Li="grid",cl("bgrid"),Mi()},He("borg").onclick=()=>{Or=!Or,He("borg").classList.toggle("on",Or),Mi()},He("bviol").onclick=()=>{jr=!jr,He("bviol").classList.toggle("on",jr),jr?(Ai=Or,Or=!0):Ai!==void 0&&(Or=Ai,Ai=void 0),He("borg").classList.toggle("on",Or),Ir()},He("allDomOn").onclick=()=>{for(let t of ea(".df"))t.checked=!0;Ir()},He("allDomOff").onclick=()=>{for(let t of ea(".df"))t.checked=!1;Ir()},J0()}lb();})();
322
+ /*! Bundled license information:
323
+
324
+ cytoscape/dist/cytoscape.esm.mjs:
325
+ (*!
326
+ Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
327
+ Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
328
+ Licensed under The MIT License (http://opensource.org/licenses/MIT)
329
+ *)
330
+ (*!
331
+ Event object based on jQuery events, MIT license
332
+
333
+ https://jquery.org/license/
334
+ https://tldrlegal.com/license/mit-license
335
+ https://github.com/jquery/jquery/blob/master/src/event.js
336
+ *)
337
+ (*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
338
+ (*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
339
+ */