6 lines
507 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(self["webpackChunkdigital_codedoc_render"]=self["webpackChunkdigital_codedoc_render"]||[]).push([[664],{1006:function(e,t,n){n(4114),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698),n(8992),n(4520),n(3949),function(t,r){e.exports=r(n(7710))}(0,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(t,n){t.exports=e},function(e,t,n){"use strict";var r=n(0).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=i},function(e,t,n){"use strict";var r=n(0).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).FDLayoutNode,i=n(0).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.move=function(){var e=this.graphManager.getLayout();this.displacementX=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n,r=this.getChild().getNodes(),i=0;i<r.length;i++)n=r[i],null==n.getChild()?(n.moveBy(e,t),n.displacementX+=e,n.displacementY+=t):n.propogateDisplacementToChildren(e,t)},a.prototype.setPred1=function(e){this.pred1=e},a.prototype.getPred1=function(){return pred1},a.prototype.getPred2=function(){return pred2},a.prototype.setNext=function(e){this.next=e},a.prototype.getNext=function(){return next},a.prototype.setProcessed=function(e){this.processed=e},a.prototype.isProcessed=function(){return processed},e.exports=a},function(e,t,n){"use strict";var r=n(0).FDLayout,i=n(4),a=n(3),o=n(5),s=n(2),l=n(1),u=n(0).FDLayoutConstants,c=n(0).LayoutConstants,h=n(0).Point,d=n(0).PointD,p=n(0).Layout,g=n(0).Integer,f=n(0).IGeometry,v=n(0).LGraph,y=n(0).Transform;function m(){r.call(this),this.toBeTiled={}}for(var b in m.prototype=Object.create(r.prototype),r)m[b]=r[b];m.prototype.newGraphManager=function(){var e=new i(this);return this.graphManager=e,e},m.prototype.newGraph=function(e){return new a(null,this.graphManager,e)},m.prototype.newNode=function(e){return new o(this.graphManager,e)},m.prototype.newEdge=function(e){return new s(null,null,e)},m.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(l.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=l.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=u.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=u.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=u.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=u.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=u.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/u.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=u.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},m.prototype.layout=function(){var e=c.DEFAULT_CREATE_BENDS_AS_NEEDED;return e&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},m.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(l.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(n)}}else{var e=this.getFlatForest();if(e.length>0)this.positionNodesRadially(e);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},m.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%u.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=u.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()),this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},m.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n<e.length;n++){var r=e[n].rect,i=e[n].id;t[i]={id:i,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return t},m.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var e=!1;if("during"===u.ANIMATE)this.emit("layoutstarted");else{while(!e)e=this.tick();this.graphManager.updateBounds()}},m.prototype.calculateNodesToApplyGravitationTo=function(){var e,t,n=[],r=this.graphManager.getGraphs(),i=r.length;for(t=0;t<i;t++)e=r[t],e.updateConnected(),e.isConnected||(n=n.concat(e.getNodes()));return n},m.prototype.createBendpoints=function(){var e=[];e=e.concat(this.graphManager.getAllEdges());var t,n=new Set;for(t=0;t<e.length;t++){var r=e[t];if(!n.has(r)){var i=r.getSource(),a=r.getTarget();if(i==a)r.getBendpoints().push(new d),r.getBendpoints().push(new d),this.createDummyNodesForBendpoints(r),n.add(r);else{var o=[];if(o=o.concat(i.getEdgeListToNode(a)),o=o.concat(a.getEdgeListToNode(i)),!n.has(o[0])){var s;if(o.length>1)for(s=0;s<o.length;s++){var l=o[s];l.getBendpoints().push(new d),this.createDummyNodesForBendpoints(l)}o.forEach((function(e){n.add(e)}))}}}if(n.size==e.length)break}},m.prototype.positionNodesRadially=function(e){for(var t=new h(0,0),n=Math.ceil(Math.sqrt(e.length)),r=0,i=0,a=0,o=new d(0,0),s=0;s<e.length;s++){s%n==0&&(a=0,i=r,0!=s&&(i+=l.DEFAULT_COMPONENT_SEPERATION),r=0);var u=e[s],g=p.findCenterOfTree(u);t.x=a,t.y=i,o=m.radialLayout(u,g,t),o.y>r&&(r=Math.floor(o.y)),a=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(c.WORLD_CENTER_X-o.x/2,c.WORLD_CENTER_Y-o.y/2))},m.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);m.branchRadialLayout(t,null,0,359,0,r);var i=v.calculateBounds(e),a=new y;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o<e.length;o++){var s=e[o];s.transform(a)}var u=new d(i.getMaxX(),i.getMaxY());return a.inverseTransformPoint(u)},m.branchRadialLayout=function(e,t,n,r,i,a){var o=(r-n+1)/2;o<0&&(o+=180);var s=(o+n)%360,l=s*f.TWO_PI/360,u=(Math.cos(l),i*Math.cos(l)),c=i*Math.sin(l);e.setCenter(u,c);var h=[];h=h.concat(e.getEdges());var d=h.length;null!=t&&d--;var p,g=0,v=h.length,y=e.getEdgesBetween(t);while(y.length>1){var b=y[0];y.splice(0,1);var x=h.indexOf(b);x>=0&&h.splice(x,1),v--,d--}p=null!=t?(h.indexOf(y[0])+1)%v:0;for(var w=Math.abs(r-n)/d,E=p;g!=d;E=++E%v){var T=h[E].getOtherEnd(e);if(T!=t){var _=(n+g*w)%360,A=(_+w)%360;m.branchRadialLayout(T,e,_,A,i+a,a),g++}}},m.maxDiagonalInTree=function(e){for(var t=g.MIN_VALUE,n=0;n<e.length;n++){var r=e[n],i=r.getDiagonal();i>t&&(t=i)}return t},m.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},m.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i<r.length;i++){var a=r[i],s=a.getParent();0!==this.getNodeDegreeWithChildren(a)||void 0!=s.id&&this.getToBeTiled(s)||n.push(a)}for(i=0;i<n.length;i++){a=n[i];var l=a.getParent().id;"undefined"===typeof t[l]&&(t[l]=[]),t[l]=t[l].concat(a)}Object.keys(t).forEach((function(n){if(t[n].length>1){var r="DummyCompound_"+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),l=i.getChild();l.add(a);for(var u=0;u<t[n].length;u++){var c=t[n][u];l.remove(c),s.add(c)}}}))},m.prototype.clearCompounds=function(){var e={},t={};this.performDFSOnCompounds();for(var n=0;n<this.compoundOrder.length;n++)t[this.compoundOrder[n].id]=this.compoundOrder[n],e[this.compoundOrder[n].id]=[].concat(this.compoundOrder[n].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[n].getChild()),this.compoundOrder[n].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(e,t)},m.prototype.clearZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach((function(n){var r=e.idToDummyNode[n];t[n]=e.tileNodes(e.memberGroups[n],r.paddingLeft+r.paddingRight),r.rect.width=t[n].width,r.rect.height=t[n].height}))},m.prototype.repopulateCompounds=function(){for(var e=this.compoundOrder.length-1;e>=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i)}},m.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach((function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a)}))},m.prototype.getToBeTiled=function(e){var t=e.id;if(null!=this.toBeTiled[t])return this.toBeTiled[t];var n=e.getChild();if(null==n)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i<r.length;i++){var a=r[i];if(this.getNodeDegree(a)>0)return this.toBeTiled[t]=!1,!1;if(null!=a.getChild()){if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}else this.toBeTiled[a.id]=!1}return this.toBeTiled[t]=!0,!0},m.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;r<t.length;r++){var i=t[r];i.getSource().id!==i.getTarget().id&&(n+=1)}return n},m.prototype.getNodeDegreeWithChildren=function(e){var t=this.getNodeDegree(e);if(null==e.getChild())return t;for(var n=e.getChild().getNodes(),r=0;r<n.length;r++){var i=n[r];t+=this.getNodeDegreeWithChildren(i)}return t},m.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},m.prototype.fillCompexOrderByDFS=function(e){for(var t=0;t<e.length;t++){var n=e[t];null!=n.getChild()&&this.fillCompexOrderByDFS(n.getChild().getNodes()),this.getToBeTiled(n)&&this.compoundOrder.push(n)}},m.prototype.adjustLocations=function(e,t,n,r,i){t+=r,n+=i;for(var a=t,o=0;o<e.rows.length;o++){var s=e.rows[o];t=a;for(var l=0,u=0;u<s.length;u++){var c=s[u];c.rect.x=t,c.rect.y=n,t+=c.rect.width+e.horizontalPadding,c.rect.height>l&&(l=c.rect.height)}n+=l+e.verticalPadding}},m.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach((function(r){var i=t[r];n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height}))},m.prototype.tileNodes=function(e,t){var n=l.TILING_PADDING_VERTICAL,r=l.TILING_PADDING_HORIZONTAL,i={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:n,horizontalPadding:r};e.sort((function(e,t){return e.rect.width*e.rect.height>t.rect.width*t.rect.height?-1:e.rect.width*e.rect.height<t.rect.width*t.rect.height?1:0}));for(var a=0;a<e.length;a++){var o=e[a];0==i.rows.length?this.insertNodeToRow(i,o,0,t):this.canAddHorizontal(i,o.rect.width,o.rect.height)?this.insertNodeToRow(i,o,this.getShortestRowIndex(i),t):this.insertNodeToRow(i,o,i.rows.length,t),this.shiftToLastRow(i)}return i},m.prototype.insertNodeToRow=function(e,t,n,r){var i=r;if(n==e.rows.length){var a=[];e.rows.push(a),e.rowWidth.push(i),e.rowHeight.push(0)}var o=e.rowWidth[n]+t.rect.width;e.rows[n].length>0&&(o+=e.horizontalPadding),e.rowWidth[n]=o,e.width<o&&(e.width=o);var s=t.rect.height;n>0&&(s+=e.verticalPadding);var l=0;s>e.rowHeight[n]&&(l=e.rowHeight[n],e.rowHeight[n]=s,l=e.rowHeight[n]-l),e.height+=l,e.rows[n].push(t)},m.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]<n&&(t=r,n=e.rowWidth[r]);return t},m.prototype.getLongestRowIndex=function(e){for(var t=-1,n=Number.MIN_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]>n&&(t=r,n=e.rowWidth[r]);return t},m.prototype.canAddHorizontal=function(e,t,n){var r=this.getShortestRowIndex(e);if(r<0)return!0;var i=e.rowWidth[r];if(i+e.horizontalPadding+t<=e.width)return!0;var a,o,s=0;return e.rowHeight[r]<n&&r>0&&(s=n+e.verticalPadding-e.rowHeight[r]),a=e.width-i>=t+e.horizontalPadding?(e.height+s)/(i+t+e.horizontalPadding):(e.height+s)/e.width,s=n+e.verticalPadding,o=e.width<t?(e.height+s)/t:(e.height+s)/e.width,o<1&&(o=1/o),a<1&&(a=1/a),a<o},m.prototype.shiftToLastRow=function(e){var t=this.getLongestRowIndex(e),n=e.rowWidth.length-1,r=e.rows[t],i=r[r.length-1],a=i.width+e.horizontalPadding;if(e.width-e.rowWidth[n]>a&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;s<r.length;s++)r[s].height>o&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]<i.height+e.verticalPadding&&(e.rowHeight[n]=i.height+e.verticalPadding);var u=e.rowHeight[t]+e.rowHeight[n];e.height+=u-l,this.shiftToLastRow(e)}},m.prototype.tilingPreLayout=function(){l.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},m.prototype.tilingPostLayout=function(){l.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},m.prototype.reduceTrees=function(){var e,t=[],n=!0;while(n){var r=this.graphManager.getAllNodes(),i=[];n=!1;for(var a=0;a<r.length;a++)e=r[a],1!=e.getEdges().length||e.getEdges()[0].isInterGraph||null!=e.getChild()||(i.push([e,e.getEdges()[0],e.getOwner()]),n=!0);if(1==n){for(var o=[],s=0;s<i.length;s++)1==i[s][0].getEdges().length&&(o.push(i[s]),i[s][0].getOwner().remove(i[s][0]));t.push(o),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=t},m.prototype.growTree=function(e){for(var t,n=e.length,r=e[n-1],i=0;i<r.length;i++)t=r[i],this.findPlaceforPrunedNode(t),t[2].add(t[0]),t[2].add(t[1],t[1].source,t[1].target);e.splice(e.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},m.prototype.findPlaceforPrunedNode=function(e){var t,n,r=e[0];n=r==e[1].source?e[1].target:e[1].source;var i=n.startX,a=n.finishX,o=n.startY,s=n.finishY,l=0,c=0,h=0,d=0,p=[l,h,c,d];if(o>0)for(var f=i;f<=a;f++)p[0]+=this.grid[f][o-1].length+this.grid[f][o].length-1;if(a<this.grid.length-1)for(f=o;f<=s;f++)p[1]+=this.grid[a+1][f].length+this.grid[a][f].length-1;if(s<this.grid[0].length-1)for(f=i;f<=a;f++)p[2]+=this.grid[f][s+1].length+this.grid[f][s].length-1;if(i>0)for(f=o;f<=s;f++)p[3]+=this.grid[i-1][f].length+this.grid[i][f].length-1;for(var v,y,m=g.MAX_VALUE,b=0;b<p.length;b++)p[b]<m?(m=p[b],v=1,y=b):p[b]==m&&v++;if(3==v&&0==m)0==p[0]&&0==p[1]&&0==p[2]?t=1:0==p[0]&&0==p[1]&&0==p[3]?t=0:0==p[0]&&0==p[2]&&0==p[3]?t=3:0==p[1]&&0==p[2]&&0==p[3]&&(t=2);else if(2==v&&0==m){var x=Math.floor(2*Math.random());t=0==p[0]&&0==p[1]?0==x?0:1:0==p[0]&&0==p[2]?0==x?0:2:0==p[0]&&0==p[3]?0==x?0:3:0==p[1]&&0==p[2]?0==x?1:2:0==p[1]&&0==p[3]?0==x?1:3:0==x?2:3}else if(4==v&&0==m){x=Math.floor(4*Math.random());t=x}else t=y;0==t?r.setCenter(n.getCenterX(),n.getCenterY()-n.getHeight()/2-u.DEFAULT_EDGE_LENGTH-r.getHeight()/2):1==t?r.setCenter(n.getCenterX()+n.getWidth()/2+u.DEFAULT_EDGE_LENGTH+r.getWidth()/2,n.getCenterY()):2==t?r.setCenter(n.getCenterX(),n.getCenterY()+n.getHeight()/2+u.DEFAULT_EDGE_LENGTH+r.getHeight()/2):r.setCenter(n.getCenterX()-n.getWidth()/2-u.DEFAULT_EDGE_LENGTH-r.getWidth()/2,n.getCenterY())},e.exports=m},function(e,t,n){"use strict";var r={};r.layoutBase=n(0),r.CoSEConstants=n(1),r.CoSEEdge=n(2),r.CoSEGraph=n(3),r.CoSEGraphManager=n(4),r.CoSELayout=n(6),r.CoSENode=n(5),e.exports=r}])}))},2088:function(e,t,n){n(8992),n(4520),function(t,r){e.exports=r(n(1006))}(0,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(t,n){t.exports=e},function(e,t,n){"use strict";var r=n(0).layoutBase.LayoutConstants,i=n(0).layoutBase.FDLayoutConstants,a=n(0).CoSEConstants,o=n(0).CoSELayout,s=n(0).CoSENode,l=n(0).layoutBase.PointD,u=n(0).layoutBase.DimensionD,c={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function h(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function d(e){this.options=h(c,e),p(this.options)}var p=function(e){null!=e.nodeRepulsion&&(a.DEFAULT_REPULSION_STRENGTH=i.DEFAULT_REPULSION_STRENGTH=e.nodeRepulsion),null!=e.idealEdgeLength&&(a.DEFAULT_EDGE_LENGTH=i.DEFAULT_EDGE_LENGTH=e.idealEdgeLength),null!=e.edgeElasticity&&(a.DEFAULT_SPRING_STRENGTH=i.DEFAULT_SPRING_STRENGTH=e.edgeElasticity),null!=e.nestingFactor&&(a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),null!=e.gravity&&(a.DEFAULT_GRAVITY_STRENGTH=i.DEFAULT_GRAVITY_STRENGTH=e.gravity),null!=e.numIter&&(a.MAX_ITERATIONS=i.MAX_ITERATIONS=e.numIter),null!=e.gravityRange&&(a.DEFAULT_GRAVITY_RANGE_FACTOR=i.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),null!=e.gravityCompound&&(a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),null!=e.gravityRangeCompound&&(a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),null!=e.initialEnergyOnIncremental&&(a.DEFAULT_COOLING_FACTOR_INCREMENTAL=i.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),"draft"==e.quality?r.QUALITY=0:"proof"==e.quality?r.QUALITY=2:r.QUALITY=1,a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!e.randomize,a.ANIMATE=i.ANIMATE=r.ANIMATE=e.animate,a.TILE=e.tile,a.TILING_PADDING_VERTICAL="function"===typeof e.tilingPaddingVertical?e.tilingPaddingVertical.call():e.tilingPaddingVertical,a.TILING_PADDING_HORIZONTAL="function"===typeof e.tilingPaddingHorizontal?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal};d.prototype.run=function(){var e,t,n=this.options,r=(this.idToLNode={},this.layout=new o),i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var a=r.newGraphManager();this.gm=a;var s=this.options.eles.nodes(),l=this.options.eles.edges();this.root=a.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(s),r);for(var u=0;u<l.length;u++){var c=l[u],h=this.idToLNode[c.data("source")],d=this.idToLNode[c.data("target")];if(h!==d&&0==h.getEdgesBetween(d).length){var p=a.add(r.newEdge(),h,d);p.id=c.id()}}var g=function(e,t){"number"===typeof e&&(e=t);var n=e.data("id"),r=i.idToLNode[n];return{x:r.getRect().getCenterX(),y:r.getRect().getCenterY()}},f=function a(){for(var o,s=function(){n.fit&&n.cy.fit(n.eles,n.padding),e||(e=!0,i.cy.one("layoutready",n.ready),i.cy.trigger({type:"layoutready",layout:i}))},l=i.options.refresh,u=0;u<l&&!o;u++)o=i.stopped||i.layout.tick();if(o)return r.checkLayoutSuccess()&&!r.isSubLayout&&r.doPostLayout(),r.tilingPostLayout&&r.tilingPostLayout(),r.isLayoutFinished=!0,i.options.eles.nodes().positions(g),s(),i.cy.one("layoutstop",i.options.stop),i.cy.trigger({type:"layoutstop",layout:i}),t&&cancelAnimationFrame(t),void(e=!1);var c=i.layout.getPositionsData();n.eles.nodes().positions((function(e,t){if("number"===typeof e&&(e=t),!e.isParent()){var n=e.id(),r=c[n],i=e;while(null==r)if(r=c[i.data("parent")]||c["DummyCompound_"+i.data("parent")],c[n]=r,i=i.parent()[0],void 0==i)break;return null!=r?{x:r.x,y:r.y}:{x:e.position("x"),y:e.position("y")}}})),s(),t=requestAnimationFrame(a)};return r.addListener("layoutstarted",(function(){"during"===i.options.animate&&(t=requestAnimationFrame(f))})),r.runLayout(),"during"!==this.options.animate&&(i.options.eles.nodes().not(":parent").layoutPositions(i,i.options,g),e=!1),this},d.prototype.getTopMostNodes=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].id()]=!0;var r=e.filter((function(e,n){"number"===typeof e&&(e=n);var r=e.parent()[0];while(null!=r){if(t[r.id()])return!1;r=r.parent()[0]}return!0}));return r},d.prototype.processChildrenList=function(e,t,n){for(var r=t.length,i=0;i<r;i++){var a,o,c=t[i],h=c.children(),d=c.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(a=null!=c.outerWidth()&&null!=c.outerHeight()?e.add(new s(n.graphManager,new l(c.position("x")-d.w/2,c.position("y")-d.h/2),new u(parseFloat(d.w),parseFloat(d.h)))):e.add(new s(this.graphManager)),a.id=c.data("id"),a.paddingLeft=parseInt(c.css("padding")),a.paddingTop=parseInt(c.css("padding")),a.paddingRight=parseInt(c.css("padding")),a.paddingBottom=parseInt(c.css("padding")),this.options.nodeDimensionsIncludeLabels&&c.isParent()){var p=c.boundingBox({includeLabels:!0,includeNodes:!1}).w,g=c.boundingBox({includeLabels:!0,includeNodes:!1}).h,f=c.css("text-halign");a.labelWidth=p,a.labelHeight=g,a.labelPos=f}if(this.idToLNode[c.data("id")]=a,isNaN(a.rect.x)&&(a.rect.x=0),isNaN(a.rect.y)&&(a.rect.y=0),null!=h&&h.length>0)o=n.getGraphManager().add(n.newGraph(),a),this.processChildrenList(o,h,n)}},d.prototype.stop=function(){return this.stopped=!0,this};var g=function(e){e("layout","cose-bilkent",d)};"undefined"!==typeof cytoscape&&g(cytoscape),e.exports=g}])}))},2469:function(e,t,n){n(4114),n(6573),n(8100),n(7936),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698),n(7467),n(4732),n(9577),n(8992),n(3215),n(4520),n(3949),n(1454),n(8872),n(7550),n(1795),n(4979),n(9848),function(t,n){e.exports=n()}(0,(function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){return u(e)||h(e,t)||d(e,t)||f()}function s(e){return l(e)||c(e)||d(e)||g()}function l(e){if(Array.isArray(e))return p(e)}function u(e){if(Array.isArray(e))return e}function c(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function h(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done);o=!0)if(a.push(r.value),t&&a.length===t)break}catch(l){s=!0,i=l}finally{try{o||null==n["return"]||n["return"]()}finally{if(s)throw i}}return a}}function d(e,t){if(e){if("string"===typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=d(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}var y="undefined"===typeof window?null:window,m=y?y.navigator:null;y&&y.document;var b=e(""),x=e({}),w=e((function(){})),E="undefined"===typeof HTMLElement?"undefined":e(HTMLElement),T=function(e){return e&&e.instanceString&&A(e.instanceString)?e.instanceString():null},_=function(t){return null!=t&&e(t)==b},A=function(t){return null!=t&&e(t)===w},C=function(e){return!P(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},D=function(t){return null!=t&&e(t)===x&&!C(t)&&t.constructor===Object},N=function(t){return null!=t&&e(t)===x},S=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},k=function(e){return S(e)&&Math.floor(e)===e},L=function(e){return"undefined"===E?void 0:null!=e&&e instanceof HTMLElement},P=function(e){return I(e)||M(e)},I=function(e){return"collection"===T(e)&&e._private.single},M=function(e){return"collection"===T(e)&&!e._private.single},O=function(e){return"core"===T(e)},R=function(e){return"stylesheet"===T(e)},B=function(e){return"event"===T(e)},F=function(e){return void 0===e||null===e||!(""!==e&&!e.match(/^\s+$/))},z=function(e){return"undefined"!==typeof HTMLElement&&e instanceof HTMLElement},G=function(e){return D(e)&&S(e.x1)&&S(e.x2)&&S(e.y1)&&S(e.y2)},V=function(e){return N(e)&&A(e.then)},X=function(){return m&&m.userAgent.match(/msie|trident|edge/i)},Y=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function n(){var r,i=this,a=arguments,o=t.apply(i,a),s=n.cache;return(r=s[o])||(r=s[o]=e.apply(i,a)),r};return n.cache={},n},U=Y((function(e){return e.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))})),W=Y((function(e){return e.replace(/(-\w)/g,(function(e){return e[1].toUpperCase()}))})),j=Y((function(e,t){return e+t[0].toUpperCase()+t.substring(1)}),(function(e,t){return e+"$"+t})),H=function(e){return F(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},q="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",$="rgb[a]?\\(("+q+"[%]?)\\s*,\\s*("+q+"[%]?)\\s*,\\s*("+q+"[%]?)(?:\\s*,\\s*("+q+"))?\\)",K="rgb[a]?\\((?:"+q+"[%]?)\\s*,\\s*(?:"+q+"[%]?)\\s*,\\s*(?:"+q+"[%]?)(?:\\s*,\\s*(?:"+q+"))?\\)",Z="hsl[a]?\\(("+q+")\\s*,\\s*("+q+"[%])\\s*,\\s*("+q+"[%])(?:\\s*,\\s*("+q+"))?\\)",Q="hsl[a]?\\((?:"+q+")\\s*,\\s*(?:"+q+"[%])\\s*,\\s*(?:"+q+"[%])(?:\\s*,\\s*(?:"+q+"))?\\)",J="\\#[0-9a-fA-F]{3}",ee="\\#[0-9a-fA-F]{6}",te=function(e,t){return e<t?-1:e>t?1:0},ne=function(e,t){return-1*te(e,t)},re=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},ie=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r,i=4===e.length,a=16;return i?(t=parseInt(e[1]+e[1],a),n=parseInt(e[2]+e[2],a),r=parseInt(e[3]+e[3],a)):(t=parseInt(e[1]+e[2],a),n=parseInt(e[3]+e[4],a),r=parseInt(e[5]+e[6],a)),[t,n,r]}},ae=function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+Z+"$").exec(e);if(c){if(n=parseInt(c[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,r=parseFloat(c[2]),r<0||r>100)return;if(r/=100,i=parseFloat(c[3]),i<0||i>100)return;if(i/=100,a=c[4],void 0!==a&&(a=parseFloat(a),a<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var h=i<.5?i*(1+r):i+r-i*r,d=2*i-h;o=Math.round(255*u(d,h,n+1/3)),s=Math.round(255*u(d,h,n)),l=Math.round(255*u(d,h,n-1/3))}t=[o,s,l,a]}return t},oe=function(e){var t,n=new RegExp("^"+$+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},se=function(e){return ue[e.toLowerCase()]},le=function(e){return(C(e)?e:null)||se(e)||ie(e)||oe(e)||ae(e)},ue={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]},ce=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(D(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},he=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(D(a))throw Error("Tried to get map with object key");if(t=t[a],null==t)return t}return t};function de(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var pe=de,ge="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof n.g?n.g:"undefined"!==typeof self?self:{};function fe(e,t){return t={exports:{}},e(t,t.exports),t.exports}var ve="object"==typeof ge&&ge&&ge.Object===Object&&ge,ye=ve,me="object"==typeof self&&self&&self.Object===Object&&self,be=ye||me||Function("return this")(),xe=be,we=function(){return xe.Date.now()},Ee=we,Te=/\s/;function _e(e){var t=e.length;while(t--&&Te.test(e.charAt(t)));return t}var Ae=_e,Ce=/^\s+/;function De(e){return e?e.slice(0,Ae(e)+1).replace(Ce,""):e}var Ne=De,Se=xe.Symbol,ke=Se,Le=Object.prototype,Pe=Le.hasOwnProperty,Ie=Le.toString,Me=ke?ke.toStringTag:void 0;function Oe(e){var t=Pe.call(e,Me),n=e[Me];try{e[Me]=void 0;var r=!0}catch(a){}var i=Ie.call(e);return r&&(t?e[Me]=n:delete e[Me]),i}var Re=Oe,Be=Object.prototype,Fe=Be.toString;function ze(e){return Fe.call(e)}var Ge=ze,Ve="[object Null]",Xe="[object Undefined]",Ye=ke?ke.toStringTag:void 0;function Ue(e){return null==e?void 0===e?Xe:Ve:Ye&&Ye in Object(e)?Re(e):Ge(e)}var We=Ue;function je(e){return null!=e&&"object"==typeof e}var He=je,qe="[object Symbol]";function $e(e){return"symbol"==typeof e||He(e)&&We(e)==qe}var Ke=$e,Ze=NaN,Qe=/^[-+]0x[0-9a-f]+$/i,Je=/^0b[01]+$/i,et=/^0o[0-7]+$/i,tt=parseInt;function nt(e){if("number"==typeof e)return e;if(Ke(e))return Ze;if(pe(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=pe(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ne(e);var n=Je.test(e);return n||et.test(e)?tt(e.slice(2),n?2:8):Qe.test(e)?Ze:+e}var rt=nt,it="Expected a function",at=Math.max,ot=Math.min;function st(e,t,n){var r,i,a,o,s,l,u=0,c=!1,h=!1,d=!0;if("function"!=typeof e)throw new TypeError(it);function p(t){var n=r,a=i;return r=i=void 0,u=t,o=e.apply(a,n),o}function g(e){return u=e,s=setTimeout(y,t),c?p(e):o}function f(e){var n=e-l,r=e-u,i=t-n;return h?ot(i,a-r):i}function v(e){var n=e-l,r=e-u;return void 0===l||n>=t||n<0||h&&r>=a}function y(){var e=Ee();if(v(e))return m(e);s=setTimeout(y,f(e))}function m(e){return s=void 0,d&&r?p(e):(r=i=void 0,o)}function b(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0}function x(){return void 0===s?o:m(Ee())}function w(){var e=Ee(),n=v(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return g(l);if(h)return clearTimeout(s),s=setTimeout(y,t),p(l)}return void 0===s&&(s=setTimeout(y,t)),o}return t=rt(t)||0,pe(n)&&(c=!!n.leading,h="maxWait"in n,a=h?at(rt(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),w.cancel=b,w.flush=x,w}var lt=st,ut=y?y.performance:null,ct=ut&&ut.now?function(){return ut.now()}:function(){return Date.now()},ht=function(){if(y){if(y.requestAnimationFrame)return function(e){y.requestAnimationFrame(e)};if(y.mozRequestAnimationFrame)return function(e){y.mozRequestAnimationFrame(e)};if(y.webkitRequestAnimationFrame)return function(e){y.webkitRequestAnimationFrame(e)};if(y.msRequestAnimationFrame)return function(e){y.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(ct())}),1e3/60)}}(),dt=function(e){return ht(e)},pt=ct,gt=9261,ft=65599,vt=5381,yt=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt,r=n;;){if(t=e.next(),t.done)break;r=r*ft+t.value|0}return r},mt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt;return t*ft+e|0},bt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vt;return(t<<5)+t+e|0},xt=function(e,t){return 2097152*e+t},wt=function(e){return 2097152*e[0]+e[1]},Et=function(e,t){return[mt(e[0],t[0]),bt(e[1],t[1])]},Tt=function(e,t){var n={value:0,done:!1},r=0,i=e.length,a={next:function(){return r<i?n.value=e[r++]:n.done=!0,n}};return yt(a,t)},_t=function(e,t){var n={value:0,done:!1},r=0,i=e.length,a={next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}};return yt(a,t)},At=function(){return Ct(arguments)},Ct=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?_t(r):_t(r,t)}return t},Dt=!0,Nt=null!=console.warn,St=null!=console.trace,kt=Number.MAX_SAFE_INTEGER||9007199254740991,Lt=function(){return!0},Pt=function(){return!1},It=function(){return 0},Mt=function(){},Ot=function(e){throw new Error(e)},Rt=function(e){if(void 0===e)return Dt;Dt=!!e},Bt=function(e){Rt()&&(Nt?console.warn(e):(console.log(e),St&&console.trace()))},Ft=function(e){return re({},e)},zt=function(e){return null==e?e:C(e)?e.slice():D(e)?Ft(e):e},Gt=function(e){return e.slice()},Vt=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},Xt={},Yt=function(){return Xt},Ut=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},Wt=function(e,t,n){for(var r=e.length-1;r>=0;r--)if(e[r]===t&&(e.splice(r,1),n))break},jt=function(e){e.splice(0,e.length)},Ht=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},qt=function(e,t,n){return n&&(t=j(n,t)),e[t]},$t=function(e,t,n,r){n&&(t=j(n,t)),e[t]=r},Kt=function(){function e(){t(this,e),this._obj={}}return i(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Zt="undefined"!==typeof Map?Map:Kt,Qt="undefined",Jt=function(){function e(n){if(t(this,e),this._obj=Object.create(null),this.size=0,null!=n){var r;r=null!=n.instanceString&&n.instanceString()===this.instanceString()?n.toArray():n;for(var i=0;i<r.length;i++)this.add(r[i])}}return i(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter((function(t){return e.has(t)}))}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),e}(),en=("undefined"===typeof Set?"undefined":e(Set))!==Qt?Set:Jt,tn=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&O(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new en,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.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(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];C(t.classes)?l=t.classes:_(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var h=l[u];h&&""!==h&&i.classes.add(h)}this.createEmitter();var d=t.style||t.css;d&&(Bt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d)),(void 0===n||n)&&this.restore()}else Ot("An element must be of type `nodes` or `edges`; you specified `"+r+"`")}else Ot("An element must have a core reference and parameters set")},nn=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;D(t)&&!P(t)&&(i=t,t=i.roots||i.root,n=i.visit,r=i.directed),r=2!==arguments.length||A(n)?r:n,n=A(n)?n:function(){};for(var a,o=this._private.cy,s=t=_(t)?this.filter(t):t,l=[],u=[],c={},h={},d={},p=0,g=this.byGroup(),f=g.nodes,v=g.edges,y=0;y<s.length;y++){var m=s[y],b=m.id();m.isNode()&&(l.unshift(m),e.bfs&&(d[b]=!0,u.push(m)),h[b]=0)}var x=function(){var t=e.bfs?l.shift():l.pop(),i=t.id();if(e.dfs){if(d[i])return"continue";d[i]=!0,u.push(t)}var o=h[i],s=c[i],g=null!=s?s.source():null,y=null!=s?s.target():null,m=null==s?void 0:t.same(g)?y[0]:g[0],b=void 0;if(b=n(t,s,m,p++,o),!0===b)return a=t,"break";if(!1===b)return"break";for(var x=t.connectedEdges().filter((function(e){return(!r||e.source().same(t))&&v.has(e)})),w=0;w<x.length;w++){var E=x[w],T=E.connectedNodes().filter((function(e){return!e.same(t)&&f.has(e)})),_=T.id();0===T.length||d[_]||(T=T[0],l.push(T),e.bfs&&(d[_]=!0,u.push(T)),c[_]=E,h[_]=h[i]+1)}};while(0!==l.length){var w=x();if("continue"!==w&&"break"===w)break}for(var E=o.collection(),T=0;T<u.length;T++){var C=u[T],N=c[C.id()];null!=N&&E.push(N),E.push(C)}return{path:o.collection(E),found:o.collection(a)}}},rn={breadthFirstSearch:nn({bfs:!0}),depthFirstSearch:nn({dfs:!0})};rn.bfs=rn.breadthFirstSearch,rn.dfs=rn.depthFirstSearch;var an=fe((function(e,t){(function(){var t,n,r,i,a,o,s,l,u,c,h,d,p,g,f;r=Math.floor,c=Math.min,n=function(e,t){return e<t?-1:e>t?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");null==a&&(a=e.length);while(i<a)s=r((i+a)/2),o(t,e[s])<0?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return null==r&&(r=n),e.push(t),g(e,0,e.length-1,r)},a=function(e,t){var r,i;return null==t&&(t=n),r=e.pop(),e.length?(i=e[0],e[0]=r,f(e,0,t)):i=r,i},l=function(e,t,r){var i;return null==r&&(r=n),i=e[0],e[0]=t,f(e,0,r),i},s=function(e,t,r){var i;return null==r&&(r=n),e.length&&r(e[0],t)<0&&(i=[e[0],t],t=i[0],e[0]=i[1],f(e,0,r)),t},i=function(e,t){var i,a,o,s,l,u;for(null==t&&(t=n),s=function(){u=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse(),l=[],a=0,o=s.length;a<o;a++)i=s[a],l.push(f(e,i,t));return l},p=function(e,t,r){var i;if(null==r&&(r=n),i=e.indexOf(t),-1!==i)return g(e,0,i,r),f(e,i,r)},h=function(e,t,r){var a,o,l,u,c;if(null==r&&(r=n),o=e.slice(0,t),!o.length)return o;for(i(o,r),c=e.slice(t),l=0,u=c.length;l<u;l++)a=c[l],s(o,a,r);return o.sort(r).reverse()},d=function(e,t,r){var o,s,l,h,d,p,g,f,v;if(null==r&&(r=n),10*t<=e.length){if(l=e.slice(0,t).sort(r),!l.length)return l;for(s=l[l.length-1],g=e.slice(t),h=0,p=g.length;h<p;h++)o=g[h],r(o,s)<0&&(u(l,o,0,null,r),l.pop(),s=l[l.length-1]);return l}for(i(e,r),v=[],d=0,f=c(t,e.length);0<=f?d<f:d>f;0<=f?++d:--d)v.push(a(e,r));return v},g=function(e,t,r,i){var a,o,s;null==i&&(i=n),a=e[r];while(r>t){if(s=r-1>>1,o=e[s],!(i(a,o)<0))break;e[r]=o,r=s}return e[r]=a},f=function(e,t,r){var i,a,o,s,l;null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;while(i<a)s=i+1,s<a&&!(r(e[i],e[s])<0)&&(i=s),e[t]=e[i],t=i,i=2*t+1;return e[t]=o,g(e,l,t,r)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=o,e.pop=a,e.replace=l,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=h,e.nsmallest=d,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return t=new e,t.nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),function(t,n){e.exports=n()}(0,(function(){return t}))}).call(ge)})),on=an,sn=Ut({root:null,weight:function(e){return 1},directed:!1}),ln={dijkstra:function(e){if(!D(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=sn(e),r=n.root,i=n.weight,a=n.directed,o=this,s=i,l=_(r)?this.filter(r)[0]:r[0],u={},c={},h={},d=this.byGroup(),p=d.nodes,g=d.edges;g.unmergeBy((function(e){return e.isLoop()}));for(var f=function(e){return u[e.id()]},v=function(e,t){u[e.id()]=t,y.updateItem(e)},y=new on((function(e,t){return f(e)-f(t)})),m=0;m<p.length;m++){var b=p[m];u[b.id()]=b.same(l)?0:1/0,y.push(b)}var x=function(e,t){for(var n,r=(a?e.edgesTo(t):e.edgesWith(t)).intersect(g),i=1/0,o=0;o<r.length;o++){var l=r[o],u=s(l);(u<i||!n)&&(i=u,n=l)}return{edge:n,dist:i}};while(y.size()>0){var w=y.pop(),E=f(w),T=w.id();if(h[T]=E,E!==1/0)for(var A=w.neighborhood().intersect(p),C=0;C<A.length;C++){var N=A[C],S=N.id(),k=x(w,N),L=E+k.dist;L<f(N)&&(v(N,L),c[S]={node:w,edge:k.edge})}}return{distanceTo:function(e){var t=_(e)?p.filter(e)[0]:e[0];return h[t.id()]},pathTo:function(e){var t=_(e)?p.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0){n.unshift(t);while(c[i]){var a=c[i];n.unshift(a.edge),n.unshift(a.node),r=a.node,i=r.id()}}return o.spawn(n)}}}},un={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++){var n=a[t];if(n.has(e))return t}},l=0;l<i;l++)a[l]=this.spawn(n[l]);for(var u=r.sort((function(t,n){return e(t)-e(n)})),c=0;c<u.length;c++){var h=u[c],d=h.source()[0],p=h.target()[0],g=s(d),f=s(p),v=a[g],y=a[f];g!==f&&(o.merge(h),v.merge(y),a.splice(f,1))}return o}},cn=Ut({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),hn={aStar:function(e){var t=this.cy(),n=cn(e),r=n.root,i=n.goal,a=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var l,u,c=r.id(),h=i.id(),d={},p={},g={},f=new on((function(e,t){return p[e.id()]-p[t.id()]})),v=new en,y={},m={},b=function(e,t){f.push(e),v.add(t)},x=function(){l=f.pop(),u=l.id(),v["delete"](u)},w=function(e){return v.has(e)};b(r,c),d[c]=0,p[c]=a(r);var E=0;while(f.size()>0){if(x(),E++,u===h){for(var T=[],_=i,A=h,C=m[A];;){if(T.unshift(_),null!=C&&T.unshift(C),_=y[A],null==_)break;A=_.id(),C=m[A]}return{found:!0,distance:d[u],path:this.spawn(T),steps:E}}g[u]=!0;for(var D=l._private.edges,N=0;N<D.length;N++){var S=D[N];if(this.hasElementWithId(S.id())&&(!o||S.data("source")===u)){var k=S.source(),L=S.target(),P=k.id()!==u?k:L,I=P.id();if(this.hasElementWithId(I)&&!g[I]){var M=d[u]+s(S);w(I)?M<d[I]&&(d[I]=M,p[I]=M+a(P),y[I]=l,m[I]=S):(d[I]=M,p[I]=M+a(P),b(P,I),y[I]=l,m[I]=S)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},dn=Ut({weight:function(e){return 1},directed:!1}),pn={floydWarshall:function(e){for(var t=this.cy(),n=dn(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,l=o.edges,u=s.length,c=u*u,h=function(e){return s.indexOf(e)},d=function(e){return s[e]},p=new Array(c),g=0;g<c;g++){var f=g%u,v=(g-f)/u;p[g]=v===f?0:1/0}for(var y=new Array(c),m=new Array(c),b=0;b<l.length;b++){var x=l[b],w=x.source()[0],E=x.target()[0];if(w!==E){var T=h(w),A=h(E),C=T*u+A,D=a(x);if(p[C]>D&&(p[C]=D,y[C]=A,m[C]=x),!i){var N=A*u+T;!i&&p[N]>D&&(p[N]=D,y[N]=T,m[N]=x)}}}for(var S=0;S<u;S++)for(var k=0;k<u;k++)for(var L=k*u+S,P=0;P<u;P++){var I=k*u+P,M=S*u+P;p[L]+p[M]<p[I]&&(p[I]=p[L]+p[M],y[I]=y[L])}var O=function(e){return(_(e)?t.filter(e):e)[0]},R=function(e){return h(O(e))},B={distance:function(e,t){var n=R(e),r=R(t);return p[n*u+r]},path:function(e,n){var r=R(e),i=R(n),a=d(r);if(r===i)return a.collection();if(null==y[r*u+i])return t.collection();var o,s=t.collection(),l=r;s.merge(a);while(r!==i)l=r,r=y[r*u+i],o=m[l*u+r],s.merge(o),s.merge(d(r));return s}};return B}},gn=Ut({weight:function(e){return 1},directed:!1,root:null}),fn={bellmanFord:function(e){var t=this,n=gn(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,h=u.nodes,d=h.length,p=new Zt,g=!1,f=[];a=l.collection(a)[0],c.unmergeBy((function(e){return e.isLoop()}));for(var v=c.length,y=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},m=function(e){return(_(e)?l.$(e):e)[0]},b=function(e){return y(m(e)).dist},x=function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=m(e),i=[],o=r;;){if(null==o)return t.spawn();var l=y(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},w=0;w<d;w++){var E=h[w],T=y(E);E.same(a)?T.dist=0:T.dist=1/0,T.pred=null,T.edge=null}for(var A=!1,C=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,A=!0)},D=1;D<d;D++){A=!1;for(var N=0;N<v;N++){var S=c[N],k=S.source(),L=S.target(),P=o(S),I=y(k),M=y(L);C(k,L,S,I,M,P),i||C(L,k,S,M,I,P)}if(!A)break}if(A)for(var O=[],R=0;R<v;R++){var B=c[R],F=B.source(),z=B.target(),G=o(B),V=y(F).dist,X=y(z).dist;if(V+G<X||!i&&X+G<V){if(g||(Bt("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),!1===e.findNegativeWeightCycles)break;var Y=[];V+G<X&&Y.push(F),!i&&X+G<V&&Y.push(z);for(var U=Y.length,W=0;W<U;W++){var j=Y[W],H=[j];H.push(y(j).edge);var q=y(j).pred;while(-1===H.indexOf(q))H.push(q),H.push(y(q).edge),q=y(q).pred;H=H.slice(H.indexOf(q));for(var $=H[0].id(),K=0,Z=2;Z<H.length;Z+=2)H[Z].id()<$&&($=H[Z].id(),K=Z);H=H.slice(K).concat(H.slice(0,K)),H.push(H[0]);var Q=H.map((function(e){return e.id()})).join(",");-1===O.indexOf(Q)&&(f.push(s.spawn(H)),O.push(Q))}}}return{distanceTo:b,pathTo:x,hasNegativeWeightCycle:g,negativeWeightCycles:f}}},vn=Math.sqrt(2),yn=function(e,t,n){0===n.length&&Ot("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],h=c[1],d=c[2];(t[h]===o&&t[d]===s||t[h]===s&&t[d]===o)&&l.splice(u,1)}for(var p=0;p<l.length;p++){var g=l[p];g[1]===s?(l[p]=g.slice(),l[p][1]=o):g[2]===s&&(l[p]=g.slice(),l[p][2]=o)}for(var f=0;f<t.length;f++)t[f]===s&&(t[f]=o);return l},mn=function(e,t,n,r){while(n>r){var i=Math.floor(Math.random()*t.length);t=yn(i,e,t),n--}return t},bn={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/vn);if(!(i<2)){for(var l=[],u=0;u<a;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}for(var h=1/0,d=[],p=new Array(i),g=new Array(i),f=new Array(i),v=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},y=0;y<=o;y++){for(var m=0;m<i;m++)g[m]=m;var b=mn(g,l.slice(),i,s),x=b.slice();v(g,f);var w=mn(g,b,s,2),E=mn(f,x,s,2);w.length<=E.length&&w.length<h?(h=w.length,d=w,v(g,p)):E.length<=w.length&&E.length<h&&(h=E.length,d=E,v(f,p))}for(var T=this.spawn(d.map((function(e){return r[e[0]]}))),_=this.spawn(),A=this.spawn(),C=p[0],D=0;D<p.length;D++){var N=p[D],S=n[D];N===C?_.merge(S):A.merge(S)}var k=function(t){var n=e.spawn();return t.forEach((function(t){n.merge(t),t.connectedEdges().forEach((function(t){e.contains(t)&&!T.contains(t)&&n.merge(t)}))})),n},L=[k(_),k(A)],P={cut:T,components:L,partition1:_,partition2:A};return P}Ot("At least 2 nodes are required for Karger-Stein algorithm")}},xn=function(e){return{x:e.x,y:e.y}},wn=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},En=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Tn=function(e){return{x:e[0],y:e[1]}},_n=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r},An=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r},Cn=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i},Dn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var u=e.length,c=Math.floor(u/2);return u%2!==0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},Nn=function(e){return Math.PI*e/180},Sn=function(e,t){return Math.atan2(t,e)-Math.PI/2},kn=Math.log2||function(e){return Math.log(e)/Math.log(2)},Ln=function(e){return e>0?1:e<0?-1:0},Pn=function(e,t){return Math.sqrt(In(e,t))},In=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Mn=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},On=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},Rn=function(e,t,n,r){return{x:On(e.x,t.x,n.x,r),y:On(e.y,t.y,n.y,r)}},Bn=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},a=Pn(e,t),o={x:i.x/a,y:i.y/a};return n=null==n?0:n,r=null!=r?r:n*a,{x:e.x+o.x*r,y:e.y+o.y*r}},Fn=function(e,t,n){return Math.max(e,Math.min(n,t))},zn=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&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(null!=e.w&&null!=e.h&&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}}},Gn=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Vn=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Xn=function(e,t,n){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+n,y2:e.y2+n,w:e.w,h:e.h}},Yn=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Un=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Wn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},jn=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var s=o(a,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Hn=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},qn=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2<t.x1)&&(!(t.x2<e.x1)&&(!(e.y2<t.y1)&&(!(t.y2<e.y1)&&(!(e.y1>t.y2)&&!(t.y1>e.y2)))))))},$n=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Kn=function(e,t){return $n(e,t.x,t.y)},Zn=function(e,t){return $n(e,t.x1,t.y1)&&$n(e,t.x2,t.y2)},Qn=function(e,t,n,r,i,a,o){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",l="auto"===s?wr(i,a):s,u=i/2,c=a/2;l=Math.min(l,u,c);var h,d,p=l!==u,g=l!==c;if(p){var f=n-u+l-o,v=r-c-o,y=n+u-l+o,m=v;if(h=gr(e,t,n,r,f,v,y,m,!1),h.length>0)return h}if(g){var b=n+u+o,x=r-c+l-o,w=b,E=r+c-l+o;if(h=gr(e,t,n,r,b,x,w,E,!1),h.length>0)return h}if(p){var T=n-u+l-o,_=r+c+o,A=n+u-l+o,C=_;if(h=gr(e,t,n,r,T,_,A,C,!1),h.length>0)return h}if(g){var D=n-u-o,N=r-c+l-o,S=D,k=r+c-l+o;if(h=gr(e,t,n,r,D,N,S,k,!1),h.length>0)return h}var L=n-u+l,P=r-c+l;if(d=dr(e,t,n,r,L,P,l+o),d.length>0&&d[0]<=L&&d[1]<=P)return[d[0],d[1]];var I=n+u-l,M=r-c+l;if(d=dr(e,t,n,r,I,M,l+o),d.length>0&&d[0]>=I&&d[1]<=M)return[d[0],d[1]];var O=n+u-l,R=r+c-l;if(d=dr(e,t,n,r,O,R,l+o),d.length>0&&d[0]>=O&&d[1]>=R)return[d[0],d[1]];var B=n-u+l,F=r+c-l;return d=dr(e,t,n,r,B,F,l+o),d.length>0&&d[0]<=B&&d[1]>=F?[d[0],d[1]]:[]},Jn=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),h=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=h+s},er=function(e,t,n,r,i,a,o,s,l){var u={x1:Math.min(n,o,i)-l,x2:Math.max(n,o,i)+l,y1:Math.min(r,s,a)-l,y2:Math.max(r,s,a)+l};return!(e<u.x1||e>u.x2||t<u.y1||t>u.y2)},tr=function(e,t,n,r){n-=r;var i=t*t-4*e*n;if(i<0)return[];var a=Math.sqrt(i),o=2*e,s=(-t+a)/o,l=(-t-a)/o;return[s,l]},nr=function(e,t,n,r,i){var a,o,s,l,u,c,h,d,p=1e-5;return 0===e&&(e=p),t/=e,n/=e,r/=e,o=(3*n-t*t)/9,s=-27*r+t*(9*n-t*t*2),s/=54,a=o*o*o+s*s,i[1]=0,h=t/3,a>0?(u=s+Math.sqrt(a),u=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=s-Math.sqrt(a),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,void(i[5]=-h)):(i[5]=i[3]=0,0===a?(d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*d-h,void(i[4]=i[2]=-(d+h))):(o=-o,l=o*o*o,l=Math.acos(s/Math.sqrt(l)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),void(i[4]=-h+d*Math.cos((l+4*Math.PI)/3))))},rr=function(e,t,n,r,i,a,o,s){var l=1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,u=9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,c=3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,h=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,d=[];nr(l,u,c,h,d);for(var p=1e-7,g=[],f=0;f<6;f+=2)Math.abs(d[f+1])<p&&d[f]>=0&&d[f]<=1&&g.push(d[f]);g.push(1),g.push(0);for(var v,y,m,b=-1,x=0;x<g.length;x++)v=Math.pow(1-g[x],2)*n+2*(1-g[x])*g[x]*i+g[x]*g[x]*o,y=Math.pow(1-g[x],2)*r+2*(1-g[x])*g[x]*a+g[x]*g[x]*s,m=Math.pow(v-e,2)+Math.pow(y-t,2),b>=0?m<b&&(b=m):b=m;return b},ir=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],h=c*c/l;return c<0?u:h>l?(e-i)*(e-i)+(t-a)*(t-a):u-h},ar=function(e,t,n){for(var r,i,a,o,s,l=0,u=0;u<n.length/2;u++)if(r=n[2*u],i=n[2*u+1],u+1<n.length/2?(a=n[2*(u+1)],o=n[2*(u+1)+1]):(a=n[2*(u+1-n.length/2)],o=n[2*(u+1-n.length/2)+1]),r==e&&a==e);else{if(!(r>=e&&e>=a||r<=e&&e<=a))continue;s=(e-r)/(a-r)*(o-i)+i,s>t&&l++}return l%2!==0},or=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h,d=Math.cos(-u),p=Math.sin(-u),g=0;g<c.length/2;g++)c[2*g]=a/2*(n[2*g]*d-n[2*g+1]*p),c[2*g+1]=o/2*(n[2*g+1]*d+n[2*g]*p),c[2*g]+=r,c[2*g+1]+=i;if(l>0){var f=ur(c,-l);h=lr(f)}else h=c;return ar(e,t,h)},sr=function(e,t,n,r,i,a,o,s){for(var l=new Array(2*n.length),u=0;u<s.length;u++){var c=s[u];l[4*u+0]=c.startX,l[4*u+1]=c.startY,l[4*u+2]=c.stopX,l[4*u+3]=c.stopY;var h=Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2);if(h<=Math.pow(c.radius,2))return!0}return ar(e,t,l)},lr=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],n=e[4*c+1],r=e[4*c+2],i=e[4*c+3],c<e.length/4-1?(a=e[4*(c+1)],o=e[4*(c+1)+1],s=e[4*(c+1)+2],l=e[4*(c+1)+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var h=gr(t,n,r,i,a,o,s,l,!0);u[2*c]=h[0],u[2*c+1]=h[1]}return u},ur=function(e,t){for(var n,r,i,a,o=new Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(i=e[2*(s+1)],a=e[2*(s+1)+1]):(i=e[0],a=e[1]);var l=a-r,u=-(i-n),c=Math.sqrt(l*l+u*u),h=l/c,d=u/c;o[4*s]=n+h*t,o[4*s+1]=r+d*t,o[4*s+2]=i+h*t,o[4*s+3]=a+d*t}return o},cr=function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var l=Math.sqrt(o*o+s*s),u=l-1;if(u<0)return[];var c=u/l;return[(n-e)*c+e,(r-t)*c+t]},hr=function(e,t,n,r,i,a,o){return e-=i,t-=a,e/=n/2+o,t/=r/2+o,e*e+t*t<=1},dr=function(e,t,n,r,i,a,o){var s=[n-e,r-t],l=[e-i,t-a],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),h=l[0]*l[0]+l[1]*l[1]-o*o,d=c*c-4*u*h;if(d<0)return[];var p=(-c+Math.sqrt(d))/(2*u),g=(-c-Math.sqrt(d))/(2*u),f=Math.min(p,g),v=Math.max(p,g),y=[];if(f>=0&&f<=1&&y.push(f),v>=0&&v<=1&&y.push(v),0===y.length)return[];var m=y[0]*s[0]+e,b=y[0]*s[1]+t;if(y.length>1){if(y[0]==y[1])return[m,b];var x=y[1]*s[0]+e,w=y[1]*s[1]+t;return[m,b,x,w]}return[m,b]},pr=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},gr=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,p=r-t,g=s-a,f=h*d-g*u,v=c*d-p*u,y=g*c-h*p;if(0!==y){var m=f/y,b=v/y,x=.001,w=0-x,E=1+x;return w<=m&&m<=E&&w<=b&&b<=E||l?[e+m*c,t+m*p]:[]}return 0===f||0===v?pr(e,n,o)===o?[o,s]:pr(e,n,i)===i?[i,a]:pr(i,o,n)===n?[n,r]:[]:[]},fr=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,p,g=[],f=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y<f.length/2;y++)f[2*y]=n[2*y]*a+r,f[2*y+1]=n[2*y+1]*o+i;if(s>0){var m=ur(f,-s);u=lr(m)}else u=f}else u=n;for(var b=0;b<u.length/2;b++)c=u[2*b],h=u[2*b+1],b<u.length/2-1?(d=u[2*(b+1)],p=u[2*(b+1)+1]):(d=u[0],p=u[1]),l=gr(e,t,r,i,c,h,d,p),0!==l.length&&g.push(l[0],l[1]);return g},vr=function(e,t,n,r,i,a,o,s,l){var u,c=[],h=new Array(2*n.length);l.forEach((function(n,a){0===a?(h[h.length-2]=n.startX,h[h.length-1]=n.startY):(h[4*a-2]=n.startX,h[4*a-1]=n.startY),h[4*a]=n.stopX,h[4*a+1]=n.stopY,u=dr(e,t,r,i,n.cx,n.cy,n.radius),0!==u.length&&c.push(u[0],u[1])}));for(var d=0;d<h.length/4;d++)u=gr(e,t,r,i,h[4*d],h[4*d+1],h[4*d+2],h[4*d+3],!1),0!==u.length&&c.push(u[0],u[1]);if(c.length>2){for(var p=[c[0],c[1]],g=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),f=1;f<c.length/2;f++){var v=Math.pow(c[2*f]-e,2)+Math.pow(c[2*f+1]-t,2);v<=g&&(p[0]=c[2*f],p[1]=c[2*f+1],g=v)}return p}return c},yr=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},mr=function(e,t){var n=xr(e,t);return n=br(n),n},br=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var u=2/(o-i),c=2/(s-a),h=0;h<r;h++)t=e[2*h]=e[2*h]*u,n=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var d=0;d<r;d++)n=e[2*d+1]=e[2*d+1]+(-1-a);return e},xr=function(e,t){var n=1/e*2*Math.PI,r=e%2===0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i,a=new Array(2*e),o=0;o<e;o++)i=o*n+r,a[2*o]=Math.cos(i),a[2*o+1]=Math.sin(-i);return a},wr=function(e,t){return Math.min(e/4,t/4,8)},Er=function(e,t){return Math.min(e/10,t/10,8)},Tr=function(){return 8},_r=function(e,t,n){return[e-2*t+n,2*(t-e),e]},Ar=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Cr=Ut({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Dr={pageRank:function(e){for(var t=Cr(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),l=s.nodes,u=s.edges,c=l.length,h=c*c,d=u.length,p=new Array(h),g=new Array(c),f=(1-n)/c,v=0;v<c;v++){for(var y=0;y<c;y++){var m=v*c+y;p[m]=0}g[v]=0}for(var b=0;b<d;b++){var x=u[b],w=x.data("source"),E=x.data("target");if(w!==E){var T=l.indexOfId(w),_=l.indexOfId(E),A=a(x),C=_*c+T;p[C]+=A,g[T]+=A}}for(var D=1/c+f,N=0;N<c;N++)if(0===g[N])for(var S=0;S<c;S++){var k=S*c+N;p[k]=D}else for(var L=0;L<c;L++){var P=L*c+N;p[P]=p[P]/g[N]+f}for(var I,M=new Array(c),O=new Array(c),R=0;R<c;R++)M[R]=1;for(var B=0;B<i;B++){for(var F=0;F<c;F++)O[F]=0;for(var z=0;z<c;z++)for(var G=0;G<c;G++){var V=z*c+G;O[z]+=p[V]*M[G]}Mn(O),I=M,M=O,O=I;for(var X=0,Y=0;Y<c;Y++){var U=I[Y]-M[Y];X+=U*U}if(X<r)break}var W={rank:function(e){return e=o.collection(e)[0],M[l.indexOf(e)]}};return W}},Nr=Ut({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Sr={degreeCentralityNormalized:function(e){e=Nr(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<r;l++){var u=n[l],c=u.id();e.root=u;var h=this.degreeCentrality(e);o<h.indegree&&(o=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,a[c]=h.outdegree}return{indegree:function(e){return 0==o?0:(_(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(_(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var d={},p=0,g=0;g<r;g++){var f=n[g];e.root=f;var v=this.degreeCentrality(e);p<v.degree&&(p=v.degree),d[f.id()]=v.degree}return{degree:function(e){return 0===p?0:(_(e)&&(e=t.filter(e)),d[e.id()]/p)}}},degreeCentrality:function(e){e=Nr(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),u=l.filter((function(e){return e.target().same(i)&&n.has(e)})),c=l.filter((function(e){return e.source().same(i)&&n.has(e)})),h=u.length,d=c.length,p=0,g=0,f=0;f<u.length;f++)p+=a(u[f]);for(var v=0;v<c.length;v++)g+=a(c[v]);return{indegree:Math.pow(h,1-s)*Math.pow(p,s),outdegree:Math.pow(d,1-s)*Math.pow(g,s)}}for(var y=i.connectedEdges().intersection(n),m=y.length,b=0,x=0;x<y.length;x++)b+=a(y[x]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};Sr.dc=Sr.degreeCentrality,Sr.dcn=Sr.degreeCentralityNormalised=Sr.degreeCentralityNormalized;var kr=Ut({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Lr={closenessCentralityNormalized:function(e){for(var t=kr(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:i}),c=0;c<l.length;c++){for(var h=0,d=l[c],p=0;p<l.length;p++)if(c!==p){var g=u.distance(d,l[p]);h+=n?1/g:g}n||(h=1/h),s<h&&(s=h),o[d.id()]=h}return{closeness:function(e){return 0==s?0:(e=_(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=kr(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var h=o.distanceTo(c);s+=a?1/h:h}}return a?s:1/s}};Lr.cc=Lr.closenessCentrality,Lr.ccn=Lr.closenessCentralityNormalised=Lr.closenessCentralityNormalized;var Pr=Ut({weight:null,directed:!1}),Ir={betweennessCentrality:function(e){for(var t=Pr(e),n=t.directed,r=t.weight,i=null!=r,a=this.cy(),o=this.nodes(),s={},l={},u=0,c={set:function(e,t){l[e]=t,t>u&&(u=t)},get:function(e){return l[e]}},h=0;h<o.length;h++){var d=o[h],p=d.id();s[p]=n?d.outgoers().nodes():d.openNeighborhood().nodes(),c.set(p,0)}for(var g=function(e){for(var t=o[e].id(),n=[],l={},u={},h={},d=new on((function(e,t){return h[e]-h[t]})),p=0;p<o.length;p++){var g=o[p].id();l[g]=[],u[g]=0,h[g]=1/0}u[t]=1,h[t]=0,d.push(t);while(!d.empty()){var f=d.pop();if(n.push(f),i)for(var v=0;v<s[f].length;v++){var y=s[f][v],m=a.getElementById(f),b=void 0;b=m.edgesTo(y).length>0?m.edgesTo(y)[0]:y.edgesTo(m)[0];var x=r(b);y=y.id(),h[y]>h[f]+x&&(h[y]=h[f]+x,d.nodes.indexOf(y)<0?d.push(y):d.updateItem(y),u[y]=0,l[y]=[]),h[y]==h[f]+x&&(u[y]=u[y]+u[f],l[y].push(f))}else for(var w=0;w<s[f].length;w++){var E=s[f][w].id();h[E]==1/0&&(d.push(E),h[E]=h[f]+1),h[E]==h[f]+1&&(u[E]=u[E]+u[f],l[E].push(f))}}for(var T={},_=0;_<o.length;_++)T[o[_].id()]=0;while(n.length>0){for(var A=n.pop(),C=0;C<l[A].length;C++){var D=l[A][C];T[D]=T[D]+u[D]/u[A]*(1+T[A])}A!=o[e].id()&&c.set(A,c.get(A)+T[A])}},f=0;f<o.length;f++)g(f);var v={betweenness:function(e){var t=a.collection(e).id();return c.get(t)},betweennessNormalized:function(e){if(0==u)return 0;var t=a.collection(e).id();return c.get(t)/u}};return v.betweennessNormalised=v.betweennessNormalized,v}};Ir.bc=Ir.betweennessCentrality;var Mr=Ut({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),Or=function(e){return Mr(e)},Rr=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Br=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},Fr=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},zr=function(e,t,n){for(var r=new Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},Gr=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=zr(e,r,t);return e},Vr=function(e,t,n){for(var r=new Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return Fr(r,t),r},Xr=function(e,t,n,r){for(var i=0;i<n;i++){var a=Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r),o=Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r);if(a!==o)return!1}return!0},Yr=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},Ur=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},Wr=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Ur(e[t],e[n])&&e.splice(n,1);return e},jr=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=Or(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=new Array(u),h=0;h<u;h++)c[h]=0;for(var d=0;d<n.length;d++){var p=n[d],g=a[p.source().id()],f=a[p.target().id()],v=Rr(p,i.attributes);c[g*l+f]+=v,c[f*l+g]+=v}Br(c,l,i.multFactor),Fr(c,l);var y=!0,m=0;while(y&&m<i.maxIterations)y=!1,s=Gr(c,l,i.expandFactor),c=Vr(s,l,i.inflateFactor),Xr(c,s,u,4)||(y=!0),m++;var b=Yr(c,l,t,r);return b=Wr(b),b},Hr={markovClustering:jr,mcl:jr},qr=function(e){return e},$r=function(e,t){return Math.abs(t-e)},Kr=function(e,t,n){return e+$r(t,n)},Zr=function(e,t,n){return e+Math.pow(n-t,2)},Qr=function(e){return Math.sqrt(e)},Jr=function(e,t,n){return Math.max(e,$r(t,n))},ei=function(e,t,n,r,i){for(var a,o,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:qr,l=r,u=0;u<e;u++)a=t(u),o=n(u),l=i(l,a,o);return s(l)},ti={euclidean:function(e,t,n){return e>=2?ei(e,t,n,0,Zr,Qr):ei(e,t,n,0,Kr)},squaredEuclidean:function(e,t,n){return ei(e,t,n,0,Zr)},manhattan:function(e,t,n){return ei(e,t,n,0,Kr)},max:function(e,t,n){return ei(e,t,n,-1/0,Jr)}};function ni(e,t,n,r,i,a){var o;return o=A(e)?e:ti[e]||ti.euclidean,0===t&&A(e)?o(i,a):o(t,n,r,i,a)}ti["squared-euclidean"]=ti["squaredEuclidean"],ti["squaredeuclidean"]=ti["squaredEuclidean"];var ri=Ut({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ii=function(e){return ri(e)},ai=function(e,t,n,r,i){var a="kMedoids"!==i,o=a?function(e){return n[e]}:function(e){return r[e](n)},s=function(e){return r[e](t)},l=n,u=t;return ni(e,r.length,o,s,l,u)},oi=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,a[l]=e.max(n[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[u]=s}return o},si=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=ai(n,e,t[s],r,i);l<a&&(a=l,o=s)}return o},li=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)i=t[a],n[i.id()]===e&&r.push(i);return r},ui=function(e,t,n){return Math.abs(t-e)<=n},ci=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++){var a=Math.abs(e[r][i]-t[r][i]);if(a>n)return!1}return!0},hi=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},di=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){var i=e[Math.floor(Math.random()*e.length)];while(hi(i,n,r))i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},pi=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=ai("manhattan",t[i],e,n,"kMedoids");return r},gi=function(t){var n,r=this.cy(),i=this.nodes(),a=null,o=ii(t),s=new Array(o.k),l={};o.testMode?"number"===typeof o.testCentroids?(o.testCentroids,n=oi(i,o.k,o.attributes)):n="object"===e(o.testCentroids)?o.testCentroids:oi(i,o.k,o.attributes):n=oi(i,o.k,o.attributes);var u=!0,c=0;while(u&&c<o.maxIterations){for(var h=0;h<i.length;h++)a=i[h],l[a.id()]=si(a,n,o.distance,o.attributes,"kMeans");u=!1;for(var d=0;d<o.k;d++){var p=li(d,i,l);if(0!==p.length){for(var g=o.attributes.length,f=n[d],v=new Array(g),y=new Array(g),m=0;m<g;m++){y[m]=0;for(var b=0;b<p.length;b++)a=p[b],y[m]+=o.attributes[m](a);v[m]=y[m]/p.length,ui(v[m],f[m],o.sensitivityThreshold)||(u=!0)}n[d]=v,s[d]=r.collection(p)}}c++}return s},fi=function(t){var n,r,i=this.cy(),a=this.nodes(),o=null,s=ii(t),l=new Array(s.k),u={},c=new Array(s.k);s.testMode?"number"===typeof s.testCentroids||(n="object"===e(s.testCentroids)?s.testCentroids:di(a,s.k)):n=di(a,s.k);var h=!0,d=0;while(h&&d<s.maxIterations){for(var p=0;p<a.length;p++)o=a[p],u[o.id()]=si(o,n,s.distance,s.attributes,"kMedoids");h=!1;for(var g=0;g<n.length;g++){var f=li(g,a,u);if(0!==f.length){c[g]=pi(n[g],f,s.attributes);for(var v=0;v<f.length;v++)r=pi(f[v],f,s.attributes),r<c[g]&&(c[g]=r,n[g]=f[v],h=!0);l[g]=i.collection(f)}}d++}return l},vi=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],i.m);for(var u=0;u<e.length;u++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var h=0;h<t.length;h++)a+=r[h][u]*i.attributes[c](t[h]),o+=r[h][u];e[u][c]=a/o}},yi=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,l,u=2/(i.m-1),c=0;c<n.length;c++)for(var h=0;h<r.length;h++){o=0;for(var d=0;d<n.length;d++)s=ai(i.distance,r[h],n[c],i.attributes,"cmeans"),l=ai(i.distance,r[h],n[d],i.attributes,"cmeans"),o+=Math.pow(s/l,u);e[h][c]=1/o}},mi=function(e,t,n,r){for(var i,a,o=new Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var u=0;u<t[0].length;u++)t[l][u]>i&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c<o.length;c++)o[c]=r.collection(o[c]);return o},bi=function(e){var t,n,r,i,a,o=this.cy(),s=this.nodes(),l=ii(e);i=new Array(s.length);for(var u=0;u<s.length;u++)i[u]=new Array(l.k);r=new Array(s.length);for(var c=0;c<s.length;c++)r[c]=new Array(l.k);for(var h=0;h<s.length;h++){for(var d=0,p=0;p<l.k;p++)r[h][p]=Math.random(),d+=r[h][p];for(var g=0;g<l.k;g++)r[h][g]=r[h][g]/d}n=new Array(l.k);for(var f=0;f<l.k;f++)n[f]=new Array(l.attributes.length);a=new Array(s.length);for(var v=0;v<s.length;v++)a[v]=new Array(l.k);var y=!0,m=0;while(y&&m<l.maxIterations)y=!1,vi(n,s,r,a,l),yi(r,i,n,s,l),ci(r,i,l.sensitivityThreshold)||(y=!0),m++;return t=mi(s,r,l,o),{clusters:t,degreeOfMembership:r}},xi={kMeans:gi,kMedoids:fi,fuzzyCMeans:bi,fcm:bi},wi=Ut({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Ei={single:"min",complete:"max"},Ti=function(e){var t=wi(e),n=Ei[t.linkage];return null!=n&&(t.linkage=n),t},_i=function(e,t,n,r,i){for(var a,o=0,s=1/0,l=i.attributes,u=function(e,t){return ni(i.distance,l.length,(function(t){return l[t](e)}),(function(e){return l[e](t)}),e,t)},c=0;c<e.length;c++){var h=e[c].key,d=n[h][r[h]];d<s&&(o=h,s=d)}if("threshold"===i.mode&&s>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,g=t[o],f=t[r[o]];p="dendrogram"===i.mode?{left:g,right:f,key:g.key}:{value:g.value.concat(f.value),key:g.key},e[g.index]=p,e.splice(f.index,1),t[g.key]=p;for(var v=0;v<e.length;v++){var y=e[v];g.key===y.key?a=1/0:"min"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]>n[f.key][y.key]&&(a=n[f.key][y.key])):"max"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]<n[f.key][y.key]&&(a=n[f.key][y.key])):a="mean"===i.linkage?(n[g.key][y.key]*g.size+n[f.key][y.key]*f.size)/(g.size+f.size):"dendrogram"===i.mode?u(y.value,g.value):u(y.value[0],g.value[0]),n[g.key][y.key]=n[y.key][g.key]=a}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===g.key||r[b]===f.key){for(var x=b,w=0;w<e.length;w++){var E=e[w].key;n[b][E]<n[b][x]&&(x=E)}r[b]=x}e[m].index=m}return g.key=f.key=g.index=f.index=null,!0},Ai=function e(t,n,r){t&&(t.value?n.push(t.value):(t.left&&e(t.left,n),t.right&&e(t.right,n)))},Ci=function e(t,n){if(!t)return"";if(t.left&&t.right){var r=e(t.left,n),i=e(t.right,n),a=n.add({group:"nodes",data:{id:r+","+i}});return n.add({group:"edges",data:{source:r,target:a.id()}}),n.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}return t.value?t.value.id():void 0},Di=function e(t,n,r){if(!t)return[];var i=[],a=[],o=[];return 0===n?(t.left&&Ai(t.left,i),t.right&&Ai(t.right,a),o=i.concat(a),[r.collection(o)]):1===n?t.value?[r.collection(t.value)]:(t.left&&Ai(t.left,i),t.right&&Ai(t.right,a),[r.collection(i),r.collection(a)]):t.value?[r.collection(t.value)]:(t.left&&(i=e(t.left,n-1,r)),t.right&&(a=e(t.right,n-1,r)),i.concat(a))},Ni=function(e){for(var t=this.cy(),n=this.nodes(),r=Ti(e),i=r.attributes,a=function(e,t){return ni(r.distance,i.length,(function(t){return i[t](e)}),(function(e){return i[e](t)}),e,t)},o=[],s=[],l=[],u=[],c=0;c<n.length;c++){var h={value:"dendrogram"===r.mode?n[c]:[n[c]],key:c,index:c};o[c]=h,u[c]=h,s[c]=[],l[c]=0}for(var d=0;d<o.length;d++)for(var p=0;p<=d;p++){var g=void 0;g="dendrogram"===r.mode?d===p?1/0:a(o[d].value,o[p].value):d===p?1/0:a(o[d].value[0],o[p].value[0]),s[d][p]=g,s[p][d]=g,g<s[d][l[d]]&&(l[d]=p)}var f,v=_i(o,u,s,l,r);while(v)v=_i(o,u,s,l,r);return"dendrogram"===r.mode?(f=Di(o[0],r.dendrogramDepth,t),r.addDendrogram&&Ci(o[0],t)):(f=new Array(o.length),o.forEach((function(e,n){e.key=e.index=null,f[n]=t.collection(e.value)}))),f},Si={hierarchicalClustering:Ni,hca:Ni},ki=Ut({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Li=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||Ot("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some((function(e){return e===n}))||S(n)||Ot("Preference must be one of [".concat(r.map((function(e){return"'".concat(e,"'")})).join(", "),"] or a number. Got: ").concat(n)),ki(e)},Pi=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-ni(e,r.length,(function(e){return i(t,e)}),(function(e){return i(n,e)}),t,n)},Ii=function(e,t){var n=null;return n="median"===t?Dn(e):"mean"===t?Cn(e):"min"===t?_n(e):"max"===t?An(e):t,n},Mi=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},Oi=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},Ri=function(e,t,n){for(var r=Oi(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,l=-1/0,u=0;u<a.length;u++){for(var c=0,h=0;h<a.length;h++)c+=t[a[h]*e+a[u]];c>l&&(s=u,l=c)}n[i]=a[s]}return r=Oi(e,t,n),r},Bi=function(e){for(var t,n,r,i,a,o,s=this.cy(),l=this.nodes(),u=Li(e),c={},h=0;h<l.length;h++)c[l[h].id()]=h;t=l.length,n=t*t,r=new Array(n);for(var d=0;d<n;d++)r[d]=-1/0;for(var p=0;p<t;p++)for(var g=0;g<t;g++)p!==g&&(r[p*t+g]=Pi(u.distance,l[p],l[g],u.attributes));i=Ii(r,u.preference);for(var f=0;f<t;f++)r[f*t+f]=i;a=new Array(n);for(var v=0;v<n;v++)a[v]=0;o=new Array(n);for(var y=0;y<n;y++)o[y]=0;for(var m=new Array(t),b=new Array(t),x=new Array(t),w=0;w<t;w++)m[w]=0,b[w]=0,x[w]=0;for(var E,T=new Array(t*u.minIterations),_=0;_<T.length;_++)T[_]=0;for(E=0;E<u.maxIterations;E++){for(var A=0;A<t;A++){for(var C=-1/0,D=-1/0,N=-1,S=0,k=0;k<t;k++)m[k]=a[A*t+k],S=o[A*t+k]+r[A*t+k],S>=C?(D=C,C=S,N=k):S>D&&(D=S);for(var L=0;L<t;L++)a[A*t+L]=(1-u.damping)*(r[A*t+L]-C)+u.damping*m[L];a[A*t+N]=(1-u.damping)*(r[A*t+N]-D)+u.damping*m[N]}for(var P=0;P<t;P++){for(var I=0,M=0;M<t;M++)m[M]=o[M*t+P],b[M]=Math.max(0,a[M*t+P]),I+=b[M];I-=b[P],b[P]=a[P*t+P],I+=b[P];for(var O=0;O<t;O++)o[O*t+P]=(1-u.damping)*Math.min(0,I-b[O])+u.damping*m[O];o[P*t+P]=(1-u.damping)*(I-b[P])+u.damping*m[P]}for(var R=0,B=0;B<t;B++){var F=o[B*t+B]+a[B*t+B]>0?1:0;T[E%u.minIterations*t+B]=F,R+=F}if(R>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var z=0,G=0;G<t;G++){x[G]=0;for(var V=0;V<u.minIterations;V++)x[G]+=T[V*t+G];0!==x[G]&&x[G]!==u.minIterations||z++}if(z===t)break}}for(var X=Mi(t,a,o),Y=Ri(t,r,X),U={},W=0;W<X.length;W++)U[X[W]]=[];for(var j=0;j<l.length;j++){var H=c[l[j].id()],q=Y[H];null!=q&&U[q].push(l[j])}for(var $=new Array(X.length),K=0;K<X.length;K++)$[K]=s.collection(U[X[K]]);return $},Fi={affinityPropagation:Bi,ap:Bi},zi=Ut({root:void 0,directed:!1}),Gi={hierholzer:function(e){if(!D(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=zi(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=_(o)?this.filter(o)[0].id():o[0].id());var c={},h={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else h[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.degree(!0);i%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))}else h[t]=[e.source().id(),e.target().id()]}));var d={found:!1,trail:void 0};if(u)return d;if(r&&n)if(s){if(i&&r!=i)return d;i=r}else{if(i&&r!=i&&n!=i)return d;i||(i=r)}else i||(i=l[0].id());var p=function(e){var t,n,r,i=e,a=[e];while(c[i].length)t=c[i].shift(),n=h[t][0],r=h[t][1],i!=r?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},g=[],f=[];f=p(i);while(1!=f.length)0==c[f[0]].length?(g.unshift(l.getElementById(f.shift())),g.unshift(l.getElementById(f.shift()))):f=p(f.shift()).concat(f);for(var v in g.unshift(l.getElementById(f.shift())),c)if(c[v].length)return d;return d.found=!0,d.trail=this.spawn(g,!0),d}},Vi=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){var o=a.length-1,s=[],l=e.spawn();while(a[o].x!=n||a[o].y!=r)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach((function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach((function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter((function(e){return e.isLoop()}))):l.merge(i)}))})),i.push(l)},l=function l(u,c,h){u===h&&(r+=1),t[c]={id:n,low:n++,cutVertex:!1};var d,p,g,f,v=e.getElementById(c).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(c))):v.forEach((function(e){d=e.source().id(),p=e.target().id(),g=d===c?p:d,g!==h&&(f=e.id(),o[f]||(o[f]=!0,a.push({x:c,y:g,edge:e})),g in t?t[c].low=Math.min(t[c].low,t[g].id):(l(u,g,c),t[c].low=Math.min(t[c].low,t[g].low),t[c].id<=t[g].low&&(t[c].cutVertex=!0,s(c,g))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,l(n,n),t[n].cutVertex=r>1)}}));var u=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(u),components:i}},Xi={hopcroftTarjanBiconnected:Vi,htbc:Vi,htb:Vi,hopcroftTarjanBiconnectedComponents:Vi},Yi=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function o(s){i.push(s),t[s]={index:n,low:n++,explored:!1};var l=e.getElementById(s).connectedEdges().intersection(e);if(l.forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var u=e.spawn();;){var c=i.pop();if(u.merge(e.getElementById(c)),t[c].low=t[s].index,t[c].explored=!0,c===s)break}var h=u.edgesWith(u),d=u.merge(h);r.push(d),a=a.difference(d)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:a,components:r}},Ui={tarjanStronglyConnected:Yi,tsc:Yi,tscc:Yi,tarjanStronglyConnectedComponents:Yi},Wi={};[rn,ln,un,hn,pn,fn,bn,Dr,Sr,Lr,Ir,Hr,xi,Si,Fi,Gi,Xi,Ui].forEach((function(e){re(Wi,e)}));
/*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*/var ji=0,Hi=1,qi=2,$i=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=ji,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"===typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};$i.prototype={fulfill:function(e){return Ki(this,Hi,"fulfillValue",e)},reject:function(e){return Ki(this,qi,"rejectReason",e)},then:function(e,t){var n=this,r=new $i;return n.onFulfilled.push(Ji(e,r,"fulfill")),n.onRejected.push(Ji(t,r,"reject")),Zi(n),r.proxy}};var Ki=function(e,t,n,r){return e.state===ji&&(e.state=t,e[n]=r,Zi(e)),e},Zi=function(e){e.state===Hi?Qi(e,"onFulfilled",e.fulfillValue):e.state===qi&&Qi(e,"onRejected",e.rejectReason)},Qi=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"===typeof setImmediate?setImmediate(i):setTimeout(i,0)}},Ji=function(e,t,n){return function(r){if("function"!==typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(a){return void t.reject(a)}ea(t,i)}}},ea=function t(n,r){if(n!==r&&n.proxy!==r){var i;if("object"===e(r)&&null!==r||"function"===typeof r)try{i=r.then}catch(o){return void n.reject(o)}if("function"!==typeof i)n.fulfill(r);else{var a=!1;try{i.call(r,(function(e){a||(a=!0,e===r?n.reject(new TypeError("circular thenable chain")):t(n,e))}),(function(e){a||(a=!0,n.reject(e))}))}catch(o){a||n.reject(o)}}}else n.reject(new TypeError("cannot resolve promise with itself"))};$i.all=function(e){return new $i((function(t,n){for(var r=new Array(e.length),i=0,a=function(n,a){r[n]=a,i++,i===e.length&&t(r)},o=0;o<e.length;o++)(function(t){var r=e[t],i=null!=r&&null!=r.then;if(i)r.then((function(e){a(t,e)}),(function(e){n(e)}));else{var o=r;a(t,o)}})(o)}))},$i.resolve=function(e){return new $i((function(t,n){t(e)}))},$i.reject=function(e){return new $i((function(t,n){n(e)}))};var ta="undefined"!==typeof Promise?Promise:$i,na=function(e,t,n){var r=O(e),i=!r,a=this._private=re({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&A(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},ra=na.prototype;re(ra,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;t=e.queue?n.queue:n.current,t.push(this),P(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(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 t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;switch(e){case"frame":t=n.frames;break;default:case"complete":case"completed":t=n.completes}return new ta((function(e,n){t.push((function(){e()}))}))}}),ra.complete=ra.completed,ra.run=ra.play,ra.running=ra.playing;var ia={animated:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return!1;var i=n[0];return i?i._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var i=0;i<n.length;i++){var a=n[i];a._private.animation.queue=[]}return this}},delay:function(){return function(e,t){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=void 0!==n.length,i=r?n:[n],a=this._private.cy||this,o=!r,s=!o;if(!a.styleEnabled())return this;var l=a.style();e=re({},e,t);var u=0===Object.keys(e).length;if(u)return new na(i[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200;break}if(s&&(e.style=l.getPropsList(e.style||e.css),e.css=void 0),s&&null!=e.renderedPosition){var c=e.renderedPosition,h=a.pan(),d=a.zoom();e.position=En(c,d,h)}if(o&&null!=e.panBy){var p=e.panBy,g=a.pan();e.pan={x:g.x+p.x,y:g.y+p.y}}var f=e.center||e.centre;if(o&&null!=f){var v=a.getCenterPan(f.eles,e.zoom);null!=v&&(e.pan=v)}if(o&&null!=e.fit){var y=e.fit,m=a.getFitViewport(y.eles||y.boundingBox,y.padding);null!=m&&(e.pan=m.pan,e.zoom=m.zoom)}if(o&&D(e.zoom)){var b=a.getZoomedViewport(e.zoom);null!=b?(b.zoomed&&(e.zoom=b.zoom),b.panned&&(e.pan=b.pan)):e.zoom=null}return new na(i[0],e)}},animate:function(){return function(e,t){var n=this,r=void 0!==n.length,i=r?n:[n],a=this._private.cy||this;if(!a.styleEnabled())return this;t&&(e=re({},e,t));for(var o=0;o<i.length;o++){var s=i[o],l=s.animated()&&(void 0===e.queue||e.queue),u=s.animation(e,l?{queue:!0}:void 0);u.play()}return this}},stop:function(){return function(e,t){var n=this,r=void 0!==n.length,i=r?n:[n],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var o=0;o<i.length;o++){for(var s=i[o],l=s._private,u=l.animation.current,c=0;c<u.length;c++){var h=u[c],d=h._private;t&&(d.duration=0)}e&&(l.animation.queue=[]),t||(l.animation.current=[])}return a.notify("draw"),this}}},aa=Array.isArray,oa=aa,sa=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,la=/^\w*$/;function ua(e,t){if(oa(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ke(e))||(la.test(e)||!sa.test(e)||null!=t&&e in Object(t))}var ca=ua,ha="[object AsyncFunction]",da="[object Function]",pa="[object GeneratorFunction]",ga="[object Proxy]";function fa(e){if(!pe(e))return!1;var t=We(e);return t==da||t==pa||t==ha||t==ga}var va=fa,ya=xe["__core-js_shared__"],ma=ya,ba=function(){var e=/[^.]+$/.exec(ma&&ma.keys&&ma.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function xa(e){return!!ba&&ba in e}var wa=xa,Ea=Function.prototype,Ta=Ea.toString;function _a(e){if(null!=e){try{return Ta.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var Aa=_a,Ca=/[\\^$.*+?()[\]{}|]/g,Da=/^\[object .+?Constructor\]$/,Na=Function.prototype,Sa=Object.prototype,ka=Na.toString,La=Sa.hasOwnProperty,Pa=RegExp("^"+ka.call(La).replace(Ca,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ia(e){if(!pe(e)||wa(e))return!1;var t=va(e)?Pa:Da;return t.test(Aa(e))}var Ma=Ia;function Oa(e,t){return null==e?void 0:e[t]}var Ra=Oa;function Ba(e,t){var n=Ra(e,t);return Ma(n)?n:void 0}var Fa=Ba,za=Fa(Object,"create"),Ga=za;function Va(){this.__data__=Ga?Ga(null):{},this.size=0}var Xa=Va;function Ya(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ua=Ya,Wa="__lodash_hash_undefined__",ja=Object.prototype,Ha=ja.hasOwnProperty;function qa(e){var t=this.__data__;if(Ga){var n=t[e];return n===Wa?void 0:n}return Ha.call(t,e)?t[e]:void 0}var $a=qa,Ka=Object.prototype,Za=Ka.hasOwnProperty;function Qa(e){var t=this.__data__;return Ga?void 0!==t[e]:Za.call(t,e)}var Ja=Qa,eo="__lodash_hash_undefined__";function to(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Ga&&void 0===t?eo:t,this}var no=to;function ro(e){var t=-1,n=null==e?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}ro.prototype.clear=Xa,ro.prototype["delete"]=Ua,ro.prototype.get=$a,ro.prototype.has=Ja,ro.prototype.set=no;var io=ro;function ao(){this.__data__=[],this.size=0}var oo=ao;function so(e,t){return e===t||e!==e&&t!==t}var lo=so;function uo(e,t){var n=e.length;while(n--)if(lo(e[n][0],t))return n;return-1}var co=uo,ho=Array.prototype,po=ho.splice;function go(e){var t=this.__data__,n=co(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():po.call(t,n,1),--this.size,!0}var fo=go;function vo(e){var t=this.__data__,n=co(t,e);return n<0?void 0:t[n][1]}var yo=vo;function mo(e){return co(this.__data__,e)>-1}var bo=mo;function xo(e,t){var n=this.__data__,r=co(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var wo=xo;function Eo(e){var t=-1,n=null==e?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}Eo.prototype.clear=oo,Eo.prototype["delete"]=fo,Eo.prototype.get=yo,Eo.prototype.has=bo,Eo.prototype.set=wo;var To=Eo,_o=Fa(xe,"Map"),Ao=_o;function Co(){this.size=0,this.__data__={hash:new io,map:new(Ao||To),string:new io}}var Do=Co;function No(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var So=No;function ko(e,t){var n=e.__data__;return So(t)?n["string"==typeof t?"string":"hash"]:n.map}var Lo=ko;function Po(e){var t=Lo(this,e)["delete"](e);return this.size-=t?1:0,t}var Io=Po;function Mo(e){return Lo(this,e).get(e)}var Oo=Mo;function Ro(e){return Lo(this,e).has(e)}var Bo=Ro;function Fo(e,t){var n=Lo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var zo=Fo;function Go(e){var t=-1,n=null==e?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}Go.prototype.clear=Do,Go.prototype["delete"]=Io,Go.prototype.get=Oo,Go.prototype.has=Bo,Go.prototype.set=zo;var Vo=Go,Xo="Expected a function";function Yo(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Xo);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Yo.Cache||Vo),n}Yo.Cache=Vo;var Uo=Yo,Wo=500;function jo(e){var t=Uo(e,(function(e){return n.size===Wo&&n.clear(),e})),n=t.cache;return t}var Ho=jo,qo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$o=/\\(\\)?/g,Ko=Ho((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(qo,(function(e,n,r,i){t.push(r?i.replace($o,"$1"):n||e)})),t})),Zo=Ko;function Qo(e,t){var n=-1,r=null==e?0:e.length,i=Array(r);while(++n<r)i[n]=t(e[n],n,e);return i}var Jo=Qo,es=1/0,ts=ke?ke.prototype:void 0,ns=ts?ts.toString:void 0;function rs(e){if("string"==typeof e)return e;if(oa(e))return Jo(e,rs)+"";if(Ke(e))return ns?ns.call(e):"";var t=e+"";return"0"==t&&1/e==-es?"-0":t}var is=rs;function as(e){return null==e?"":is(e)}var os=as;function ss(e,t){return oa(e)?e:ca(e,t)?[e]:Zo(os(e))}var ls=ss,us=1/0;function cs(e){if("string"==typeof e||Ke(e))return e;var t=e+"";return"0"==t&&1/e==-us?"-0":t}var hs=cs;function ds(e,t){t=ls(t,e);var n=0,r=t.length;while(null!=e&&n<r)e=e[hs(t[n++])];return n&&n==r?e:void 0}var ps=ds;function gs(e,t,n){var r=null==e?void 0:ps(e,t);return void 0===r?n:r}var fs=gs,vs=function(){try{var e=Fa(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),ys=vs;function ms(e,t,n){"__proto__"==t&&ys?ys(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var bs=ms,xs=Object.prototype,ws=xs.hasOwnProperty;function Es(e,t,n){var r=e[t];ws.call(e,t)&&lo(r,n)&&(void 0!==n||t in e)||bs(e,t,n)}var Ts=Es,_s=9007199254740991,As=/^(?:0|[1-9]\d*)$/;function Cs(e,t){var n=typeof e;return t=null==t?_s:t,!!t&&("number"==n||"symbol"!=n&&As.test(e))&&e>-1&&e%1==0&&e<t}var Ds=Cs;function Ns(e,t,n,r){if(!pe(e))return e;t=ls(t,e);var i=-1,a=t.length,o=a-1,s=e;while(null!=s&&++i<a){var l=hs(t[i]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(i!=o){var c=s[l];u=r?r(c,l,s):void 0,void 0===u&&(u=pe(c)?c:Ds(t[i+1])?[]:{})}Ts(s,l,u),s=s[l]}return e}var Ss=Ns;function ks(e,t,n){return null==e?e:Ss(e,t,n)}var Ls=ks;function Ps(e,t){var n=-1,r=e.length;t||(t=Array(r));while(++n<r)t[n]=e[n];return t}var Is=Ps;function Ms(e){return oa(e)?Jo(e,hs):Ke(e)?[e]:Is(Zo(os(e)))}var Os=Ms,Rs={data:function(e){var t={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}};return e=re({},t,e),function(t,n){var r=e,i=this,o=void 0!==i.length,s=o?i:[i],l=o?i[0]:i;if(_(t)){var u,c=-1!==t.indexOf("."),h=c&&Os(t);if(r.allowGetting&&void 0===n)return l&&(r.beforeGet(l),u=h&&void 0===l._private[r.field][t]?fs(l._private[r.field],h):l._private[r.field][t]),u;if(r.allowSetting&&void 0!==n){var d=!r.immutableKeys[t];if(d){var p=a({},t,n);r.beforeSet(i,p);for(var g=0,f=s.length;g<f;g++){var v=s[g];r.canSet(v)&&(h&&void 0===l._private[r.field][t]?Ls(v._private[r.field],h,n):v._private[r.field][t]=n)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}}}else if(r.allowSetting&&D(t)){var y,m,b=t,x=Object.keys(b);r.beforeSet(i,b);for(var w=0;w<x.length;w++){y=x[w],m=b[y];var E=!r.immutableKeys[y];if(E)for(var T=0;T<s.length;T++){var C=s[T];r.canSet(C)&&(C._private[r.field][y]=m)}}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&A(t)){var N=t;i.on(r.bindingEvent,N)}else if(r.allowGetting&&void 0===t){var S;return l&&(r.beforeGet(l),S=l._private[r.field]),S}return i}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=re({},t,e),function(t){var n=e,r=this,i=void 0!==r.length,a=i?r:[r];if(_(t)){for(var o=t.split(/\s+/),s=o.length,l=0;l<s;l++){var u=o[l];if(!F(u)){var c=!n.immutableKeys[u];if(c)for(var h=0,d=a.length;h<d;h++)a[h]._private[n.field][u]=void 0}}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(void 0===t){for(var p=0,g=a.length;p<g;p++)for(var f=a[p]._private[n.field],v=Object.keys(f),y=0;y<v.length;y++){var m=v[y],b=!n.immutableKeys[m];b&&(f[m]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},Bs={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new ta((function(e,t){var i=function(t){n.off.apply(n,o),e(t)},a=r.concat([i]),o=a.concat([]);n.on.apply(n,a)}))}}},Fs={};[ia,Rs,Bs].forEach((function(e){re(Fs,e)}));var zs={animate:Fs.animate(),animation:Fs.animation(),animated:Fs.animated(),clearQueue:Fs.clearQueue(),delay:Fs.delay(),delayAnimation:Fs.delayAnimation(),stop:Fs.stop()},Gs={classes:function(e){var t=this;if(void 0===e){var n=[];return t[0]._private.classes.forEach((function(e){return n.push(e)})),n}C(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],i=new en(e),a=0;a<t.length;a++){for(var o=t[a],s=o._private,l=s.classes,u=!1,c=0;c<e.length;c++){var h=e[c],d=l.has(h);if(!d){u=!0;break}}u||(u=l.size!==e.length),u&&(s.classes=i,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){C(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],a=0,o=n.length;a<o;a++)for(var s=n[a],l=s._private.classes,u=!1,c=0;c<e.length;c++){var h=e[c],d=l.has(h),p=!1;t||r&&!d?(l.add(h),p=!0):(!t||r&&d)&&(l["delete"](h),p=!0),!u&&p&&(i.push(s),u=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};Gs.className=Gs.classNames=Gs.classes;var Vs={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:q,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Vs.variable="(?:[\\w-.]|(?:\\\\"+Vs.metaChar+"))+",Vs.className="(?:[\\w-]|(?:\\\\"+Vs.metaChar+"))+",Vs.value=Vs.string+"|"+Vs.number,Vs.id=Vs.variable,function(){var e,t,n;for(e=Vs.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],Vs.comparatorOp+="|@"+t;for(e=Vs.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],t.indexOf("!")>=0||"="!==t&&(Vs.comparatorOp+="|\\!"+t)}();var Xs=function(){return{checks:[]}},Ys={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},Us=[{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(e,t){return ne(e.selector,t.selector)})),Ws=function(){for(var e,t={},n=0;n<Us.length;n++)e=Us[n],t[e.selector]=e.matches;return t}(),js=function(e,t){return Ws[e](t)},Hs="("+Us.map((function(e){return e.selector})).join("|")+")",qs=function(e){return e.replace(new RegExp("\\\\("+Vs.metaChar+")","g"),(function(e,t){return t}))},$s=function(e,t,n){e[e.length-1]=n},Ks=[{name:"group",query:!0,regex:"("+Vs.group+")",populate:function(e,t,n){var r=o(n,1),i=r[0];t.checks.push({type:Ys.GROUP,value:"*"===i?i:i+"s"})}},{name:"state",query:!0,regex:Hs,populate:function(e,t,n){var r=o(n,1),i=r[0];t.checks.push({type:Ys.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Vs.id+")",populate:function(e,t,n){var r=o(n,1),i=r[0];t.checks.push({type:Ys.ID,value:qs(i)})}},{name:"className",query:!0,regex:"\\.("+Vs.className+")",populate:function(e,t,n){var r=o(n,1),i=r[0];t.checks.push({type:Ys.CLASS,value:qs(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Vs.variable+")\\s*\\]",populate:function(e,t,n){var r=o(n,1),i=r[0];t.checks.push({type:Ys.DATA_EXIST,field:qs(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Vs.variable+")\\s*("+Vs.comparatorOp+")\\s*("+Vs.value+")\\s*\\]",populate:function(e,t,n){var r=o(n,3),i=r[0],a=r[1],s=r[2],l=null!=new RegExp("^"+Vs.string+"$").exec(s);s=l?s.substring(1,s.length-1):parseFloat(s),t.checks.push({type:Ys.DATA_COMPARE,field:qs(i),operator:a,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Vs.boolOp+")\\s*("+Vs.variable+")\\s*\\]",populate:function(e,t,n){var r=o(n,2),i=r[0],a=r[1];t.checks.push({type:Ys.DATA_BOOL,field:qs(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Vs.meta+")\\s*("+Vs.comparatorOp+")\\s*("+Vs.number+")\\s*\\]\\]",populate:function(e,t,n){var r=o(n,3),i=r[0],a=r[1],s=r[2];t.checks.push({type:Ys.META_COMPARE,field:qs(i),operator:a,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:Vs.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=Xs();return o}},{name:"directedEdge",separator:!0,regex:Vs.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n=Xs(),r=t,i=Xs();return n.checks.push({type:Ys.DIRECTED_EDGE,source:r,target:i}),$s(e,t,n),e.edgeCount++,i}var a=Xs(),o=t,s=Xs();return a.checks.push({type:Ys.NODE_SOURCE,source:o,target:s}),$s(e,t,a),e.edgeCount++,s}},{name:"undirectedEdge",separator:!0,regex:Vs.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n=Xs(),r=t,i=Xs();return n.checks.push({type:Ys.UNDIRECTED_EDGE,nodes:[r,i]}),$s(e,t,n),e.edgeCount++,i}var a=Xs(),o=t,s=Xs();return a.checks.push({type:Ys.NODE_NEIGHBOR,node:o,neighbor:s}),$s(e,t,a),s}},{name:"child",separator:!0,regex:Vs.child,populate:function(e,t){if(null==e.currentSubject){var n=Xs(),r=Xs(),i=e[e.length-1];return n.checks.push({type:Ys.CHILD,parent:i,child:r}),$s(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=Xs(),o=e[e.length-1],s=Xs(),l=Xs(),u=Xs(),c=Xs();return a.checks.push({type:Ys.COMPOUND_SPLIT,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:Ys.TRUE}],c.checks.push({type:Ys.TRUE}),s.checks.push({type:Ys.PARENT,parent:c,child:u}),$s(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=Xs(),d=Xs(),p=[{type:Ys.PARENT,parent:h,child:d}];return h.checks=t.checks,t.checks=p,e.compoundCount++,d}},{name:"descendant",separator:!0,regex:Vs.descendant,populate:function(e,t){if(null==e.currentSubject){var n=Xs(),r=Xs(),i=e[e.length-1];return n.checks.push({type:Ys.DESCENDANT,ancestor:i,descendant:r}),$s(e,t,n),e.compoundCount++,r}if(e.currentSubject===t){var a=Xs(),o=e[e.length-1],s=Xs(),l=Xs(),u=Xs(),c=Xs();return a.checks.push({type:Ys.COMPOUND_SPLIT,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:Ys.TRUE}],c.checks.push({type:Ys.TRUE}),s.checks.push({type:Ys.ANCESTOR,ancestor:c,descendant:u}),$s(e,o,a),e.currentSubject=l,e.compoundCount++,u}var h=Xs(),d=Xs(),p=[{type:Ys.ANCESTOR,ancestor:h,descendant:d}];return h.checks=t.checks,t.checks=p,e.compoundCount++,d}},{name:"subject",modifier:!0,regex:Vs.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return Bt("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1],r=n.checks[0],i=null==r?null:r.type;i===Ys.DIRECTED_EDGE?r.type=Ys.NODE_TARGET:i===Ys.UNDIRECTED_EDGE&&(r.type=Ys.NODE_NEIGHBOR,r.node=r.nodes[1],r.neighbor=r.nodes[0],r.nodes=null)}}];Ks.forEach((function(e){return e.regexObj=new RegExp("^"+e.regex)}));var Zs=function(e){for(var t,n,r,i=0;i<Ks.length;i++){var a=Ks[i],o=a.name,s=e.match(a.regexObj);if(null!=s){n=s,t=a,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},Qs=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},Js=function(e){var t=this,n=t.inputText=e,r=t[0]=Xs();for(t.length=1,n=Qs(n);;){var i=Zs(n);if(null==i.expr)return Bt("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(t,r,a);if(!1===o)return!1;if(null!=o&&(r=o),n=i.remaining,n.match(/^\s*$/))break}var s=t[t.length-1];null!=t.currentSubject&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var u=t[l];if(u.compoundCount>0&&u.edgeCount>0)return Bt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Bt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&Bt("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},el=function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return _(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case Ys.GROUP:var l=e(s);return l.substring(0,l.length-1);case Ys.DATA_COMPARE:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case Ys.DATA_BOOL:var h=r.operator,d=r.field;return"["+e(h)+d+"]";case Ys.DATA_EXIST:var p=r.field;return"["+p+"]";case Ys.META_COMPARE:var g=r.operator,f=r.field;return"[["+f+n(e(g))+t(s)+"]]";case Ys.STATE:return s;case Ys.ID:return"#"+s;case Ys.CLASS:return"."+s;case Ys.PARENT:case Ys.CHILD:return i(r.parent,a)+n(">")+i(r.child,a);case Ys.ANCESTOR:case Ys.DESCENDANT:return i(r.ancestor,a)+" "+i(r.descendant,a);case Ys.COMPOUND_SPLIT:var v=i(r.left,a),y=i(r.subject,a),m=i(r.right,a);return v+(v.length>0?" ":"")+y+m;case Ys.TRUE:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a},tl={parse:Js,toString:el},nl=function(e,t,n){var r,i,a,o=_(e),s=S(e),l=_(n),u=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e<n;break;case"<=":h=!0,r=e<=n;break;default:r=!1;break}return!c||null==e&&h||(r=!r),r},rl=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},il=function(e){return void 0!==e},al=function(e,t){return e.data(t)},ol=function(e,t){return e[t]()},sl=[],ll=function(e,t){return e.checks.every((function(e){return sl[e.type](e,t)}))};sl[Ys.GROUP]=function(e,t){var n=e.value;return"*"===n||n===t.group()},sl[Ys.STATE]=function(e,t){var n=e.value;return js(n,t)},sl[Ys.ID]=function(e,t){var n=e.value;return t.id()===n},sl[Ys.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},sl[Ys.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return nl(ol(t,n),r,i)},sl[Ys.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return nl(al(t,n),r,i)},sl[Ys.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return rl(al(t,n),r)},sl[Ys.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,il(al(t,n))},sl[Ys.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return ll(n,i)&&ll(r,a)||ll(r,i)&&ll(n,a)},sl[Ys.NODE_NEIGHBOR]=function(e,t){return ll(e.node,t)&&t.neighborhood().some((function(t){return t.isNode()&&ll(e.neighbor,t)}))},sl[Ys.DIRECTED_EDGE]=function(e,t){return ll(e.source,t.source())&&ll(e.target,t.target())},sl[Ys.NODE_SOURCE]=function(e,t){return ll(e.source,t)&&t.outgoers().some((function(t){return t.isNode()&&ll(e.target,t)}))},sl[Ys.NODE_TARGET]=function(e,t){return ll(e.target,t)&&t.incomers().some((function(t){return t.isNode()&&ll(e.source,t)}))},sl[Ys.CHILD]=function(e,t){return ll(e.child,t)&&ll(e.parent,t.parent())},sl[Ys.PARENT]=function(e,t){return ll(e.parent,t)&&t.children().some((function(t){return ll(e.child,t)}))},sl[Ys.DESCENDANT]=function(e,t){return ll(e.descendant,t)&&t.ancestors().some((function(t){return ll(e.ancestor,t)}))},sl[Ys.ANCESTOR]=function(e,t){return ll(e.ancestor,t)&&t.descendants().some((function(t){return ll(e.descendant,t)}))},sl[Ys.COMPOUND_SPLIT]=function(e,t){return ll(e.subject,t)&&ll(e.left,t)&&ll(e.right,t)},sl[Ys.TRUE]=function(){return!0},sl[Ys.COLLECTION]=function(e,t){var n=e.value;return n.has(t)},sl[Ys.FILTER]=function(e,t){var n=e.value;return n(t)};var ul=function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===Ys.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(ll(r,e))return!0}return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)},cl=function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(ll(r,e))return!0}return!1},hl={matches:cl,filter:ul},dl=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||_(e)&&e.match(/^\s*$/)||(P(e)?this.addQuery({checks:[{type:Ys.COLLECTION,value:e.collection()}]}):A(e)?this.addQuery({checks:[{type:Ys.FILTER,value:e}]}):_(e)?this.parse(e)||(this.invalid=!0):Ot("A selector must be created from a string; found "))},pl=dl.prototype;[tl,hl].forEach((function(e){return re(pl,e)})),pl.text=function(){return this.inputText},pl.size=function(){return this.length},pl.eq=function(e){return this[e]},pl.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},pl.addQuery=function(e){this[this.length++]=e},pl.selector=pl.toString;var gl={allAre:function(e){var t=new dl(e);return this.every((function(e){return t.matches(e)}))},is:function(e){var t=new dl(e);return this.some((function(e){return t.matches(e)}))},some:function(e,t){for(var n=0;n<this.length;n++){var r=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(r)return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){var r=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(!r)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,n=e.length;return t===n&&(1===t?this[0]===e[0]:this.every((function(t){return e.hasElementWithId(t.id())})))},anySame:function(e){return e=this.cy().collection(e),this.some((function(t){return e.hasElementWithId(t.id())}))},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every((function(e){return t.hasElementWithId(e.id())}))},contains:function(e){e=this.cy().collection(e);var t=this;return e.every((function(e){return t.hasElementWithId(e.id())}))}};gl.allAreNeighbours=gl.allAreNeighbors,gl.has=gl.contains,gl.equal=gl.equals=gl.same;var fl,vl,yl=function(e,t){return function(n,r,i,a){var o,s=n,l=this;if(null==s?o="":P(s)&&1===s.length&&(o=s.id()),1===l.length&&o){var u=l[0]._private,c=u.traversalCache=u.traversalCache||{},h=c[t]=c[t]||[],d=_t(o),p=h[d];return p||(h[d]=e.call(l,n,r,i,a))}return e.call(l,n,r,i,a)}},ml={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r],a=i._private.parent;a&&t.push(a)}return this.spawn(t,!0).filter(e)},parents:function(e){var t=[],n=this.parent();while(n.nonempty()){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n],i=r.parents();t=t||i,t=t.intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter((function(e){return e.isOrphan()})).filter(e)},nonorphans:function(e){return this.stdFilter((function(e){return e.isChild()})).filter(e)},children:yl((function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n],i=r._private.children,a=0;a<i.length;a++)t.push(i[a]);return this.spawn(t,!0).filter(e)}),"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];function n(e){for(var r=0;r<e.length;r++){var i=e[r];t.push(i),i.children().nonempty()&&n(i.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function bl(e,t,n,r){for(var i=[],a=new en,o=e.cy(),s=o.hasCompoundNodes(),l=0;l<e.length;l++){var u=e[l];n?i.push(u):s&&r(i,a,u)}while(i.length>0){var c=i.shift();t(c),a.add(c.id()),s&&r(i,a,c)}return e}function xl(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function wl(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function El(e,t,n){wl(e,t,n),xl(e,t,n)}ml.forEachDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return bl(this,e,t,xl)},ml.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return bl(this,e,t,wl)},ml.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return bl(this,e,t,El)},ml.ancestors=ml.parents,fl=vl={data:Fs.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:Fs.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fs.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fs.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Fs.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fs.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},fl.attr=fl.data,fl.removeAttr=fl.removeData;var Tl,_l,Al=vl,Cl={};function Dl(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(r+=e(i,s))}return r}}}function Nl(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a],s=o[e](n);void 0===s||void 0!==r&&!t(s,r)||(r=s)}return r}}re(Cl,{degree:Dl((function(e,t){return t.source().same(t.target())?2:1})),indegree:Dl((function(e,t){return t.target().same(e)?1:0})),outdegree:Dl((function(e,t){return t.source().same(e)?1:0}))}),re(Cl,{minDegree:Nl("degree",(function(e,t){return e<t})),maxDegree:Nl("degree",(function(e,t){return e>t})),minIndegree:Nl("indegree",(function(e,t){return e<t})),maxIndegree:Nl("indegree",(function(e,t){return e>t})),minOutdegree:Nl("outdegree",(function(e,t){return e<t})),maxOutdegree:Nl("outdegree",(function(e,t){return e>t}))}),re(Cl,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var Sl=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};!i.isParent()||0===o.x&&0===o.y||i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},kl={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,t){Sl(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Tl=_l={position:Fs.data(kl),silentPosition:Fs.data(re({},kl,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Sl(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(D(e))t?this.silentPosition(e):this.position(e);else if(A(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a=this[i],o=void 0;(o=n(a,i))&&(t?a.silentPosition(o):a.position(o))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(D(e)?(r={x:S(e.x)?e.x:0,y:S(e.y)?e.y:0},n=t):_(e)&&S(t)&&(r={x:0,y:0},r[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return D(e)?this.shift(e,!0):_(e)&&S(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=D(e)?e:void 0,s=void 0!==o||void 0!==t&&_(e);if(n&&n.isNode()){if(!s){var l=n.position();return o=wn(l,i,a),void 0===e?o:o[e]}for(var u=0;u<this.length;u++){var c=this[u];void 0!==t?c.position(e,(t-a[e])/i):void 0!==o&&c.position(En(o,i,a))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=D(e)?e:void 0,a=void 0!==i||void 0!==t&&_(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(!a){var s=n.position(),l=o?n.parent():null,u=l&&l.length>0,c=u;u&&(l=l[0]);var h=c?l.position():{x:0,y:0};return i={x:s.x-h.x,y:s.y-h.y},void 0===e?i:i[e]}for(var d=0;d<this.length;d++){var p=this[d],g=o?p.parent():null,f=g&&g.length>0,v=f;f&&(g=g[0]);var y=v?g.position():{x:0,y:0};void 0!==t?p.position(e,t+y[e]):void 0!==i&&p.position({x:i.x+y.x,y:i.y+y.y})}}else if(!a)return;return this}},Tl.modelPosition=Tl.point=Tl.position,Tl.modelPositions=Tl.points=Tl.positions,Tl.renderedPoint=Tl.renderedPosition,Tl.relativePoint=Tl.relativePosition;var Ll,Pl,Il=_l;Ll=Pl={},Pl.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},Pl.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Pl.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||(a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue},a.x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,p=h.biasComplementDiff,g=y(i.height.val-a.h,u,c),f=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=m(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-f+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}function m(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;a.compoundBoundsClean&&!e||(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var Ml=function(e){return e===1/0||e===-1/0?0:e},Ol=function(e,t,n,r,i){r-t!==0&&i-n!==0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Rl=function(e,t){return null==t?e:Ol(e,t.x1,t.y1,t.x2,t.y2)},Bl=function(e,t,n){return qt(e,t,n)},Fl=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2,l=t.pstyle(n+"-arrow-shape").value;if("none"!==l){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var u=a.arrowBounds=a.arrowBounds||{},c=u[n]=u[n]||{};c.x1=r-s,c.y1=i-s,c.x2=r+s,c.y2=i+s,c.w=c.x2-c.x1,c.h=c.y2-c.y1,Wn(c,1),Ol(e,c.x1,c.y1,c.x2,c.y2)}}},zl=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle,o=t.pstyle(r+"label").strValue;if(o){var s,l,u,c,h=t.pstyle("text-halign"),d=t.pstyle("text-valign"),p=Bl(a,"labelWidth",n),g=Bl(a,"labelHeight",n),f=Bl(a,"labelX",n),v=Bl(a,"labelY",n),y=t.pstyle(r+"text-margin-x").pfValue,m=t.pstyle(r+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle(r+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,E=t.pstyle("text-border-width").pfValue,T=E/2,_=t.pstyle("text-background-padding").pfValue,A=2,C=g,D=p,N=D/2,S=C/2;if(b)s=f-N,l=f+N,u=v-S,c=v+S;else{switch(h.value){case"left":s=f-D,l=f;break;case"center":s=f-N,l=f+N;break;case"right":s=f,l=f+D;break}switch(d.value){case"top":u=v-C,c=v;break;case"center":u=v-S,c=v+S;break;case"bottom":u=v,c=v+C;break}}var k=y-Math.max(w,T)-_-A,L=y+Math.max(w,T)+_+A,P=m-Math.max(w,T)-_-A,I=m+Math.max(w,T)+_+A;s+=k,l+=L,u+=P,c+=I;var M=n||"main",O=i.labelBounds,R=O[M]=O[M]||{};R.x1=s,R.y1=u,R.x2=l,R.y2=c,R.w=l-s,R.h=c-u,R.leftPad=k,R.rightPad=L,R.topPad=P,R.botPad=I;var B=b&&"autorotate"===x.strValue,F=null!=x.pfValue&&0!==x.pfValue;if(B||F){var z=B?Bl(i.rstyle,"labelAngle",n):x.pfValue,G=Math.cos(z),V=Math.sin(z),X=(s+l)/2,Y=(u+c)/2;if(!b){switch(h.value){case"left":X=l;break;case"right":X=s;break}switch(d.value){case"top":Y=c;break;case"bottom":Y=u;break}}var U=function(e,t){return e-=X,t-=Y,{x:e*G-t*V+X,y:e*V+t*G+Y}},W=U(s,u),j=U(s,c),H=U(l,u),q=U(l,c);s=Math.min(W.x,j.x,H.x,q.x),l=Math.max(W.x,j.x,H.x,q.x),u=Math.min(W.y,j.y,H.y,q.y),c=Math.max(W.y,j.y,H.y,q.y)}var $=M+"Rot",K=O[$]=O[$]||{};K.x1=s,K.y1=u,K.x2=l,K.y2=c,K.w=l-s,K.h=c-u,Ol(e,s,u,l,c),Ol(i.labelBounds.all,s,u,l,c)}return e}},Gl=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value;if(n>0&&r>0){var i=t.pstyle("outline-offset").value,a=t.pstyle("shape").value,o=r+i,s=(e.w+2*o)/e.w,l=(e.h+2*o)/e.h,u=0,c=0;["diamond","pentagon","round-triangle"].includes(a)?(s=(e.w+2.4*o)/e.w,c=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(a)?s=(e.w+2.4*o)/e.w:"star"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.6*o)/e.h,c=-o/3.8):"triangle"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.4*o)/e.h,c=-o/1.4):"vee"===a&&(s=(e.w+4.4*o)/e.w,l=(e.h+3.8*o)/e.h,c=.5*-o);var h=e.h*l-e.h,d=e.w*s-e.w;if(jn(e,[Math.ceil(h/2),Math.ceil(d/2)]),0!=u||0!==c){var p=Xn(e,u,c);Yn(e,p)}}}},Vl=function(e,t){var n,r,i,a,o,s,l=e._private.cy,u=l.styleEnabled(),c=l.headless(),h=zn(),d=e._private,p=e.isNode(),g=e.isEdge(),f=d.rstyle,v=p&&u?e.pstyle("bounds-expansion").pfValue:[0],y=function(e){return"none"!==e.pstyle("display").value},m=!u||y(e)&&(!g||y(e.source())&&y(e.target()));if(m){var b=0,x=0;u&&t.includeOverlays&&(b=e.pstyle("overlay-opacity").value,0!==b&&(x=e.pstyle("overlay-padding").value));var w=0,E=0;u&&t.includeUnderlays&&(w=e.pstyle("underlay-opacity").value,0!==w&&(E=e.pstyle("underlay-padding").value));var T=Math.max(x,E),_=0,A=0;if(u&&(_=e.pstyle("width").pfValue,A=_/2),p&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var D=e.outerWidth(),N=D/2,S=e.outerHeight(),k=S/2;n=o-N,r=o+N,i=s-k,a=s+k,Ol(h,n,i,r,a),u&&t.includeOutlines&&Gl(h,e)}else if(g&&t.includeEdges)if(u&&!c){var L=e.pstyle("curve-style").strValue;if(n=Math.min(f.srcX,f.midX,f.tgtX),r=Math.max(f.srcX,f.midX,f.tgtX),i=Math.min(f.srcY,f.midY,f.tgtY),a=Math.max(f.srcY,f.midY,f.tgtY),n-=A,r+=A,i-=A,a+=A,Ol(h,n,i,r,a),"haystack"===L){var P=f.haystackPts;if(P&&2===P.length){if(n=P[0].x,i=P[0].y,r=P[1].x,a=P[1].y,n>r){var I=n;n=r,r=I}if(i>a){var M=i;i=a,a=M}Ol(h,n-A,i-A,r+A,a+A)}}else if("bezier"===L||"unbundled-bezier"===L||L.endsWith("segments")||L.endsWith("taxi")){var O;switch(L){case"bezier":case"unbundled-bezier":O=f.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":O=f.linePts;break}if(null!=O)for(var R=0;R<O.length;R++){var B=O[R];n=B.x-A,r=B.x+A,i=B.y-A,a=B.y+A,Ol(h,n,i,r,a)}}}else{var F=e.source(),z=F.position(),G=e.target(),V=G.position();if(n=z.x,r=V.x,i=z.y,a=V.y,n>r){var X=n;n=r,r=X}if(i>a){var Y=i;i=a,a=Y}n-=A,r+=A,i-=A,a+=A,Ol(h,n,i,r,a)}if(u&&t.includeEdges&&g&&(Fl(h,e,"mid-source"),Fl(h,e,"mid-target"),Fl(h,e,"source"),Fl(h,e,"target")),u){var U="yes"===e.pstyle("ghost").value;if(U){var W=e.pstyle("ghost-offset-x").pfValue,j=e.pstyle("ghost-offset-y").pfValue;Ol(h,h.x1+W,h.y1+j,h.x2+W,h.y2+j)}}var H=d.bodyBounds=d.bodyBounds||{};Hn(H,h),jn(H,v),Wn(H,1),u&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Ol(h,n-T,i-T,r+T,a+T));var q=d.overlayBounds=d.overlayBounds||{};Hn(q,h),jn(q,v),Wn(q,1);var $=d.labelBounds=d.labelBounds||{};null!=$.all?Vn($.all):$.all=zn(),u&&t.includeLabels&&(t.includeMainLabels&&zl(h,e,null),g&&(t.includeSourceLabels&&zl(h,e,"source"),t.includeTargetLabels&&zl(h,e,"target")))}return h.x1=Ml(h.x1),h.y1=Ml(h.y1),h.x2=Ml(h.x2),h.y2=Ml(h.y2),h.w=Ml(h.x2-h.x1),h.h=Ml(h.y2-h.y1),h.w>0&&h.h>0&&m&&(jn(h,v),Wn(h,1)),h},Xl=function(e){var t=0,n=function(e){return(e?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines),r},Yl=function(e){if(e.isEdge()){var t=e.source().position(),n=e.target().position(),r=function(e){return Math.round(e)};return Tt([r(t.x),r(t.y),r(n.x),r(n.y)])}return 0},Ul=function(e,t){var n,r=e._private,i=e.isEdge(),a=null==t?jl:Xl(t),o=a===jl,s=Yl(e),l=r.bbCachePosKey===s,u=t.useCache&&l,c=function(e){return null==e._private.bbCache||e._private.styleDirty},h=!u||c(e)||i&&(c(e.source())||c(e.target()));if(h?(l||e.recalculateRenderedStyle(u),n=Vl(e,Wl),r.bbCache=n,r.bbCachePosKey=s):n=r.bbCache,!o){var d=e.isNode();n=zn(),(t.includeNodes&&d||t.includeEdges&&!d)&&(t.includeOverlays?Rl(n,r.overlayBounds):Rl(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?Rl(n,r.labelBounds.all):(t.includeMainLabels&&Rl(n,r.labelBounds.mainRot),t.includeSourceLabels&&Rl(n,r.labelBounds.sourceRot),t.includeTargetLabels&&Rl(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Wl={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},jl=Xl(Wl),Hl=Ut(Wl);Pl.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=zn(),e=e||Wl;var n=Hl(e),r=this,i=r.cy(),a=i.styleEnabled();if(a)for(var o=0;o<r.length;o++){var s=r[o],l=s._private,u=Yl(s),c=l.bbCachePosKey===u,h=n.useCache&&c&&!l.styleDirty;s.recalculateRenderedStyle(h)}this.updateCompoundBounds(!e.useCache);for(var d=0;d<r.length;d++){var p=r[d];Rl(t,Ul(p,n))}}else e=void 0===e?Wl:Hl(e),t=Ul(this[0],e);return t.x1=Ml(t.x1),t.y1=Ml(t.y1),t.x2=Ml(t.x2),t.y2=Ml(t.y2),t.w=Ml(t.x2-t.x1),t.h=Ml(t.y2-t.y1),t},Pl.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},Pl.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter((function(e){return e.isParent()})),t=t.not(i)),D(e)){var a=e;e=function(){return a}}var o=function(t,n){return t._private.bbAtOldPos=e(t,n)},s=function(e){return e._private.bbAtOldPos};n.startBatch(),t.forEach(o).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var l=Gn(this.boundingBox({useCache:!1}));return t.silentPositions(s),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),l},Ll.boundingbox=Ll.bb=Ll.boundingBox,Ll.renderedBoundingbox=Ll.renderedBoundingBox;var ql,$l,Kl=Pl;ql=$l={};var Zl=function(e){e.uppercaseName=H(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=H(e.outerName),ql[e.name]=function(){var t=this[0],n=t._private,r=n.cy,i=r._private.styleEnabled;if(t){if(!i)return 1;if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var a=t.pstyle(e.name);switch(a.strValue){case"label":return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return a.pfValue}}},ql["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private,r=n.cy,i=r._private.styleEnabled;if(t){if(i){var a=t[e.name](),o=t.pstyle("border-width").pfValue,s=2*t.padding();return a+o+s}return 1}},ql["rendered"+e.uppercaseName]=function(){var t=this[0];if(t){var n=t[e.name]();return n*this.cy().zoom()}},ql["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t){var n=t[e.outerName]();return n*this.cy().zoom()}}};Zl({name:"width"}),Zl({name:"height"}),$l.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),void 0!==t.autoPadding?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue},$l.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},$l.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var Ql=$l,Jl=function(e,t){if(e.isEdge())return t(e)},eu=function(e,t){if(e.isEdge()){var n=e.cy();return wn(t(e),n.zoom(),n.pan())}},tu=function(e,t){if(e.isEdge()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map((function(e){return wn(e,i,r)}))}},nu=function(e){return e.renderer().getControlPoints(e)},ru=function(e){return e.renderer().getSegmentPoints(e)},iu=function(e){return e.renderer().getSourceEndpoint(e)},au=function(e){return e.renderer().getTargetEndpoint(e)},ou=function(e){return e.renderer().getEdgeMidpoint(e)},su={controlPoints:{get:nu,mult:!0},segmentPoints:{get:ru,mult:!0},sourceEndpoint:{get:iu},targetEndpoint:{get:au},midpoint:{get:ou}},lu=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},uu=Object.keys(su).reduce((function(e,t){var n=su[t],r=lu(t);return e[t]=function(){return Jl(this,n.get)},n.mult?e[r]=function(){return tu(this,n.get)}:e[r]=function(){return eu(this,n.get)},e}),{}),cu=re({},Il,Kl,Ql,uu),hu=function(e,t){this.recycle(e,t)};function du(){return!1}function pu(){return!0}hu.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=du,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?pu:du):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=pu;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=pu;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=pu,this.stopPropagation()},isDefaultPrevented:du,isPropagationStopped:du,isImmediatePropagationStopped:du};var gu=/^([^.]+)(\.(?:[^.]+))?$/,fu=".*",vu={qualifierCompare:function(e,t){return e===t},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},yu=Object.keys(vu),mu={};function bu(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mu,t=arguments.length>1?arguments[1]:void 0,n=0;n<yu.length;n++){var r=yu[n];this[r]=e[r]||vu[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var xu=bu.prototype,wu=function(e,t,n,r,i,a,o){A(r)&&(i=r,r=null),o&&(a=null==a?o:re({},a,o));for(var s=C(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!F(u)){var c=u.match(gu);if(c){var h=c[1],d=c[2]?c[2]:null,p=t(e,u,h,d,r,i,a);if(!1===p)break}}}},Eu=function(e,t){return e.addEventFields(e.context,t),new hu(t.type,t)},Tu=function(e,t,n){if(B(n))t(e,n);else if(D(n))t(e,Eu(e,n));else for(var r=C(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!F(a)){var o=a.match(gu);if(o){var s=o[1],l=o[2]?o[2]:null,u=Eu(e,{type:s,namespace:l,target:e.context});t(e,u)}}}};xu.on=xu.addListener=function(e,t,n,r,i){return wu(this,(function(e,t,n,r,i,a,o){A(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})}),e,t,n,r,i),this},xu.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},xu.removeListener=xu.off=function(e,t,n,r){var i=this;0!==this.emitting&&(this.listeners=Gt(this.listeners));for(var a=this.listeners,o=function(o){var s=a[o];wu(i,(function(t,n,r,i,l,u){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return a.splice(o,1),!1}),e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},xu.removeAllListeners=function(){return this.removeListener("*")},xu.emit=xu.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,C(t)||(t=[t]),Tu(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||i.namespace===fu)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&Ht(o,t),e.beforeEmit(e.context,i,a),i.conf&&i.conf.one&&(e.listeners=e.listeners.filter((function(e){return e!==i})));var s=e.callbackContext(e.context,i,a),l=i.callback.apply(s,o);e.afterEmit(e.context,i,a),!1===l&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o(s);e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)}),e),this.emitting--,this};var _u={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&I(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Au=function(e){return _(e)?new dl(e):e},Cu={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new bu(_u,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=Au(t),i=0;i<this.length;i++){var a=this[i];a.emitter().on(e,r,n)}return this},removeListener:function(e,t,n){for(var r=Au(t),i=0;i<this.length;i++){var a=this[i];a.emitter().removeListener(e,r,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},one:function(e,t,n){for(var r=Au(t),i=0;i<this.length;i++){var a=this[i];a.emitter().one(e,r,n)}return this},once:function(e,t,n){for(var r=Au(t),i=0;i<this.length;i++){var a=this[i];a.emitter().on(e,r,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){var r=this[n];r.emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};Fs.eventAliasesOn(Cu);var Du={nodes:function(e){return this.filter((function(e){return e.isNode()})).filter(e)},edges:function(e){return this.filter((function(e){return e.isEdge()})).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(_(e)||P(e))return new dl(e).filter(this);if(A(e)){for(var n=this.spawn(),r=this,i=0;i<r.length;i++){var a=r[i],o=t?e.apply(t,[a,i,r]):e(a,i,r);o&&n.push(a)}return n}return this.spawn()},not:function(e){if(e){_(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n],i=e.has(r);i||t.push(r)}return t}return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(_(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,i=e,a=this.length<e.length,o=a?r:i,s=a?i:r,l=0;l<o.length;l++){var u=o[l];s.has(u)&&n.push(u)}return n},xor:function(e){var t=this._private.cy;_(e)&&(e=t.$(e));var n=this.spawn(),r=this,i=e,a=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id,o=t.hasElementWithId(a);o||n.push(i)}};return a(r,i),a(i,r),n},diff:function(e){var t=this._private.cy;_(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=this,o=e,s=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id,s=t.hasElementWithId(o);s?i.merge(a):n.push(a)}};return s(a,o,n),s(o,a,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(_(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i],o=!this.has(a);o&&r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&_(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id,l=!i.has(s);if(l){var u=this.length++;this[u]=o,i.set(s,{ele:o,index:u})}}return this},unmergeAt:function(e){var t=this[e],n=t.id(),r=this._private,i=r.map;this[e]=void 0,i["delete"](n);var a=e===this.length-1;if(this.length>1&&!a){var o=this.length-1,s=this[o],l=s._private.data.id;this[o]=void 0,this[e]=s,i.set(l,{ele:s,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map,i=r.get(n);if(!i)return this;var a=i.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&_(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;i<r.length;i++){var a=r[i],o=t?e.apply(t,[a,i,r]):e(a,i,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,i=0;i<r.length;i++)n=e(n,r[i],i,r);return n},max:function(e,t){for(var n,r=-1/0,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s>r&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s<r&&(r=s,n=o)}return{value:r,ele:n}}},Nu=Du;Nu["u"]=Nu["|"]=Nu["+"]=Nu.union=Nu.or=Nu.add,Nu["\\"]=Nu["!"]=Nu["-"]=Nu.difference=Nu.relativeComplement=Nu.subtract=Nu.not,Nu["n"]=Nu["&"]=Nu["."]=Nu.and=Nu.intersection=Nu.intersect,Nu["^"]=Nu["(+)"]=Nu["(-)"]=Nu.symmetricDifference=Nu.symdiff=Nu.xor,Nu.fnFilter=Nu.filterFn=Nu.stdFilter=Nu.filter,Nu.complement=Nu.abscomp=Nu.absoluteComplement;var Su={isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},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}},ku=function(e,t){var n=e.cy(),r=n.hasCompoundNodes();function i(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?r?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?kt:0}var a=i(e)-i(t);if(0!==a)return a;function o(e){var t=e.pstyle("z-index-compare");return"auto"===t.value&&e.isNode()?1:0}var s=o(e)-o(t);if(0!==s)return s;var l=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==l?l:e.poolIndex()-t.poolIndex()},Lu={forEach:function(e,t){if(A(e))for(var n=this.length,r=0;r<n;r++){var i=this[r],a=t?e.apply(t,[i,r,this]):e(i,r,this);if(!1===a)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},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 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!A(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(ku)},zDepth:function(){var e=this[0];if(e){var t=e._private,n=t.group;if("nodes"===n){var r=t.data.parent?e.parents().size():0;return e.isParent()?r:kt-1}var i=t.source,a=t.target,o=i.zDepth(),s=a.zDepth();return Math.max(o,s,0)}}};Lu.each=Lu.forEach;var Pu=function(){var t="undefined",n=("undefined"===typeof Symbol?"undefined":e(Symbol))!=t&&e(Symbol.iterator)!=t;n&&(Lu[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return a({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,(function(){return this}))})};Pu();var Iu=Ut({nodeDimensionsIncludeLabels:!1}),Mu={layoutDimensions:function(e){var t;if(e=Iu(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return 0!==t.w&&0!==t.h||(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter((function(e){return!e.isParent()})),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=Y(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(e,t,n){var r={x:t.x1+t.w/2,y:t.y1+t.h/2},i={x:(n.x-r.x)*e,y:(n.y-r.y)*e};return{x:r.x+i.x,y:r.y+i.y}},u=t.spacingFactor&&1!==t.spacingFactor,c=function(){if(!u)return null;for(var e=zn(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);Un(e,i.x,i.y)}return e},h=c(),d=Y((function(e,n){var r=s(e,n);if(u){var i=Math.abs(t.spacingFactor);r=l(i,h,r)}return null!=t.transform&&(r=t.transform(e,r)),r}),o);if(t.animate){for(var p=0;p<r.length;p++){var g=r[p],f=d(g,p),v=null==t.animateFilter||t.animateFilter(g,p);if(v){var y=g.animation({position:f,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}else g.position(f)}if(t.fit){var m=i.animation({fit:{boundingBox:a.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(m)}else if(void 0!==t.zoom&&void 0!==t.pan){var b=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}e.animations.forEach((function(e){return e.play()})),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),ta.all(e.animations.map((function(e){return e.promise()}))).then((function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})}))}else r.positions(d),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(re({},e,{eles:this}))}};function Ou(e,t,n){var r,i=n._private,a=i.styleCache=i.styleCache||[];return null!=(r=a[e])||(r=a[e]=t(n)),r}function Ru(e,t){return e=_t(e),function(n){return Ou(e,t,n)}}function Bu(e,t){e=_t(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return Ou(e,n,t)}}Mu.createLayout=Mu.makeLayout=Mu.layout;var Fu={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};t.hasCompoundNodes()?(e=this.spawnSelf().merge(this.descendants()).merge(this.parents()),e.merge(e.connectedEdges()),e.forEach(n)):this.forEach((function(e){n(e),e.connectedEdges().forEach(n)}));return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var n=t._private.batchStyleEles;return n.merge(this),this}var r=t.hasCompoundNodes(),i=this;e=!(!e&&void 0!==e),r&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var a=i;return e?a.emitAndNotify("style"):a.emit("style"),i.forEach((function(e){return e._private.styleDirty=!0})),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(D(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify("style")}else if(_(e)){if(void 0===t){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}i.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(void 0===e)for(var a=0;a<i.length;a++){var o=i[a];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var l=i[s];r.removeBypasses(l,e,n)}}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 t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle("opacity").value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++){var s=a[o],l=s.pstyle("opacity").value;i*=l}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],n=t.cy().hasCompoundNodes();return t?n?0===t.effectiveOpacity():0===t.pstyle("opacity").value:void 0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding}};function zu(e,t){var n=e._private,r=n.data.parent?e.parents():null;if(r)for(var i=0;i<r.length;i++){var a=r[i];if(!t(a))return!1}return!0}function Gu(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||zu(i,r);var s=o.source,l=o.target;return n(s)&&(!a||zu(s,n))&&(s===l||n(l)&&(!a||zu(l,n)))}}}var Vu=Ru("eleTakesUpSpace",(function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())}));Fu.takesUpSpace=Bu("takesUpSpace",Gu({ok:Vu}));var Xu=Ru("eleInteractive",(function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&Vu(e)})),Yu=Ru("parentInteractive",(function(e){return"visible"===e.pstyle("visibility").value&&Vu(e)}));Fu.interactive=Bu("interactive",Gu({ok:Xu,parentOk:Yu,edgeOkViaNode:Vu})),Fu.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var Uu=Ru("eleVisible",(function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&Vu(e)})),Wu=Vu;Fu.visible=Bu("visible",Gu({ok:Uu,edgeOkViaNode:Wu})),Fu.hidden=function(){var e=this[0];if(e)return!e.visible()},Fu.isBundledBezier=Bu("isBundledBezier",(function(){return!!this.cy().styleEnabled()&&(!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace())})),Fu.bypass=Fu.css=Fu.style,Fu.renderedCss=Fu.renderedStyle,Fu.removeBypass=Fu.removeCss=Fu.removeStyle,Fu.pstyle=Fu.parsedStyle;var ju={};function Hu(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(1===t.length&&A(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&C(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(l);if(void 0!==h&&(u=h,!h))return this}u&&(l._private[e.field]=e.value,c&&n.push(l))}var d=this.spawn(n);d.updateStyle(),d.emit(e.event),o&&d.emit(o)}return this}}function qu(e){ju[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},ju[e.on]=Hu({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),ju[e.off]=Hu({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}qu({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),qu({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),qu({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),qu({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),ju.deselect=ju.unselect,ju.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},qu({field:"active",on:"activate",off:"unactivate"}),qu({field:"pannable",on:"panify",off:"unpanify"}),ju.inactive=function(){var e=this[0];if(e)return!e._private.active};var $u={},Ku=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode()){for(var o=!1,s=a.connectedEdges(),l=0;l<s.length;l++){var u=s[l],c=u.source(),h=u.target();if(e.noIncomingEdges&&h===a&&c!==a||e.noOutgoingEdges&&c===a&&h!==a){o=!0;break}}o||r.push(a)}}return this.spawn(r,!0).filter(t)}},Zu=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var a=n[i];if(a.isNode())for(var o=a.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();e.outgoing&&u===a?(r.push(l),r.push(c)):e.incoming&&c===a&&(r.push(l),r.push(u))}}return this.spawn(r,!0).filter(t)}},Qu=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],u=l.id();i[u]||(i[u]=!0,r.push(l),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};function Ju(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r],a=i._private[e.attr];a&&n.push(a)}return this.spawn(n,!0).filter(t)}}function ec(e){return function(t){var n=[],r=this._private.cy,i=e||{};_(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),h=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target),d=c||h;if(d){if(i.thisIsSrc||i.thisIsTgt){if(i.thisIsSrc&&!c)continue;if(i.thisIsTgt&&!h)continue}n.push(l)}}return this.spawn(n,!0)}}function tc(e){var t={codirected:!1};return e=re({},t,e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a],s=o._private,l=s.source,u=l._private.data.id,c=s.data.target,h=l._private.edges,d=0;d<h.length;d++){var p=h[d],g=p._private.data,f=g.target,v=g.source,y=f===c&&v===u,m=u===f&&c===v;(i.codirected&&y||!i.codirected&&(y||m))&&n.push(p)}return this.spawn(n,!0).filter(t)}}$u.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},re($u,{roots:Ku({noIncomingEdges:!0}),leaves:Ku({noOutgoingEdges:!0}),outgoers:yl(Zu({outgoing:!0}),"outgoers"),successors:Qu({outgoing:!0}),incomers:yl(Zu({incoming:!0}),"incomers"),predecessors:Qu({incoming:!0})}),re($u,{neighborhood:yl((function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target(),c=i===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),$u.neighbourhood=$u.neighborhood,$u.closedNeighbourhood=$u.closedNeighborhood,$u.openNeighbourhood=$u.openNeighborhood,re($u,{source:yl((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:yl((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:Ju({attr:"source"}),targets:Ju({attr:"target"})}),re($u,{edgesWith:yl(ec(),"edgesWith"),edgesTo:yl(ec({thisIsSrc:!0}),"edgesTo")}),re($u,{connectedEdges:yl((function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];if(i.isNode())for(var a=i._private.edges,o=0;o<a.length;o++){var s=a[o];t.push(s)}}return this.spawn(t,!0).filter(e)}),"connectedEdges"),connectedNodes:yl((function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)}),"connectedNodes"),parallelEdges:yl(tc(),"parallelEdges"),codirectedEdges:yl(tc({codirected:!0}),"codirectedEdges")}),re($u,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach((function(n){n.connectedEdges().forEach((function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)}))}))};do{s()}while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),$u.componentsOf=$u.components;var nc=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new Zt,a=!1;if(t){if(t.length>0&&D(t[0])&&!I(t[0])){a=!0;for(var o=[],s=new en,l=0,u=t.length;l<u;l++){var c=t[l];null==c.data&&(c.data={});var h=c.data;if(null==h.id)h.id=Vt();else if(e.hasElementWithId(h.id)||s.has(h.id))continue;var d=new tn(e,c,!1);o.push(d),s.add(h.id)}t=o}}else t=[];this.length=0;for(var p=0,g=t.length;p<g;p++){var f=t[p][0];if(null!=f){var v=f._private.data.id;n&&i.has(v)||(n&&i.set(v,{index:this.length,ele:f}),this[this.length]=f,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new Zt,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=i),a&&!r&&this.restore()}else Ot("A collection must have a reference to the core")},rc=tn.prototype=nc.prototype=Object.create(Array.prototype);rc.instanceString=function(){return"collection"},rc.spawn=function(e,t){return new nc(this.cy(),e,t)},rc.spawnSelf=function(){return this.spawn(this)},rc.cy=function(){return this._private.cy},rc.renderer=function(){return this._private.cy.renderer()},rc.element=function(){return this[0]},rc.collection=function(){return M(this)?this:new nc(this._private.cy,[this])},rc.unique=function(){return new nc(this._private.cy,this,!0)},rc.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},rc.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new nc(t)},rc.$id=rc.getElementById,rc.poolIndex=function(){var e=this._private.cy,t=e._private.elements,n=this[0]._private.data.id;return t._private.map.get(n).index},rc.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},rc.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},rc.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(D(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;!u||null==c&&null==i.parent||c==i.parent||(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var h=function(n,i,a){var o=e[n];null!=o&&o!==r[n]&&(o?t[i]():t[a]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var d={data:zt(r.data),position:zt(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};d.classes="";var p=0;return r.classes.forEach((function(e){return d.classes+=0===p++?e:" "+e})),d}}},rc.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t],r=n.json();e.push(r)}return e},rc.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n],i=r.json(),a=new tn(e,i,!1);t.push(a)}return new nc(e,t)},rc.copy=rc.clone,rc.restore=function(){for(var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u<c;u++){var h=i[u];r&&!h.removed()||(h.isNode()?s.push(h):l.push(h))}e=s.concat(l);var d=function(){e.splice(t,1),t--};for(t=0;t<e.length;t++){var p=e[t],g=p._private,f=g.data;if(p.clearTraversalCache(),r||g.removed)if(void 0===f.id)f.id=Vt();else if(S(f.id))f.id=""+f.id;else{if(F(f.id)||!_(f.id)){Ot("Can not create element with invalid string ID `"+f.id+"`"),d();continue}if(a.hasElementWithId(f.id)){Ot("Can not create second element with ID `"+f.id+"`"),d();continue}}else;var v=f.id;if(p.isNode()){var y=g.position;null==y.x&&(y.x=0),null==y.y&&(y.y=0)}if(p.isEdge()){for(var m=p,b=["source","target"],x=b.length,w=!1,E=0;E<x;E++){var T=b[E],A=f[T];S(A)&&(A=f[T]=""+f[T]),null==A||""===A?(Ot("Can not create edge `"+v+"` with unspecified "+T),w=!0):a.hasElementWithId(A)||(Ot("Can not create edge `"+v+"` with nonexistant "+T+" `"+A+"`"),w=!0)}if(w){d();continue}var C=a.getElementById(f.source),D=a.getElementById(f.target);C.same(D)?C._private.edges.push(m):(C._private.edges.push(m),D._private.edges.push(m)),m._private.source=C,m._private.target=D}g.map=new Zt,g.map.set(v,{ele:p,index:0}),g.removed=!1,r&&a.addToPool(p)}for(var N=0;N<s.length;N++){var k=s[N],L=k._private.data;S(L.parent)&&(L.parent=""+L.parent);var P=L.parent,I=null!=P;if(I||k._private.parent){var M=k._private.parent?a.collection().merge(k._private.parent):a.getElementById(P);if(M.empty())L.parent=void 0;else if(M[0].removed())Bt("Node added with missing parent, reference to parent removed"),L.parent=void 0,k._private.parent=null;else{var O=!1,R=M;while(!R.empty()){if(k.same(R)){O=!0,L.parent=void 0;break}R=R.parent()}O||(M[0]._private.children.push(k),k._private.parent=M[0],o.hasCompoundNodes=!0)}}}if(e.length>0){for(var B,z=e.length===i.length?i:new nc(a,e),G=0;G<z.length;G++){var V=z[G];V.isNode()||(V.parallelEdges().clearTraversalCache(),V.source().clearTraversalCache(),V.target().clearTraversalCache())}B=o.hasCompoundNodes?a.collection().merge(z).merge(z.connectedNodes()).merge(z.parent()):z,B.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(n),n?z.emitAndNotify("add"):r&&z.emit("add")}return i},rc.removed=function(){var e=this[0];return e&&e._private.removed},rc.inside=function(){var e=this[0];return e&&!e._private.removed},rc.remove=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)l(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)l(t[n])}function l(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var u=0,c=n.length;u<c;u++){var h=n[u];l(h)}function d(e,t){var n=e._private.edges;Wt(n,t),e.clearTraversalCache()}function p(e){e.clearTraversalCache()}var g=[];function f(e,t){t=t[0],e=e[0];var n=e._private.children,r=e.id();Wt(n,t),t._private.parent=null,g.ids[r]||(g.ids[r]=!0,g.push(e))}g.ids={},n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var v=0;v<r.length;v++){var y=r[v];if(y.isEdge()){var m=y.source()[0],b=y.target()[0];d(m,y),d(b,y);for(var x=y.parallelEdges(),w=0;w<x.length;w++){var E=x[w];p(E),E.isBundledBezier()&&E.dirtyBoundingBoxCache()}}else{var T=y.parent();0!==T.length&&f(T,y)}t&&(y._private.removed=!0)}var _=a._private.elements;a._private.hasCompoundNodes=!1;for(var A=0;A<_.length;A++){var C=_[A];if(C.isParent()){a._private.hasCompoundNodes=!0;break}}var D=new nc(this.cy(),r);D.size()>0&&(e?D.emitAndNotify("remove"):t&&D.emit("remove"));for(var N=0;N<g.length;N++){var S=g[N];t&&S.removed()||S.updateStyle()}return D},rc.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,a=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var o=a(e.source),s=a(e.target),l=null!=o&&t.hasElementWithId(o),u=null!=s&&t.hasElementWithId(s);(l||u)&&(t.batch((function(){n.remove(r,i),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],a=t._private.data;t.isEdge()&&(l&&(a.source=o),u&&(a.target=s))}n.restore(r,i)})),n.emitAndNotify("move"))}else if(void 0!==e.parent){var c=a(e.parent),h=null===c||t.hasElementWithId(c);if(h){var d=null===c?void 0:c;t.batch((function(){var e=n.remove(r,i);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var a=n[t],o=a._private.data;a.isNode()&&(o.parent=d)}e.restore(r,i)})),n.emitAndNotify("move")}}return this},[Wi,zs,Gs,gl,ml,Al,Cl,cu,Cu,Du,Su,Lu,Mu,Fu,ju,$u].forEach((function(e){re(rc,e)}));var ic={add:function(e){var t,n=this;if(P(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new nc(n,i)}}else if(C(e)){var s=e;t=new nc(n,s)}else if(D(e)&&(C(e.nodes)||C(e.edges))){for(var l=e,u=[],c=["nodes","edges"],h=0,d=c.length;h<d;h++){var p=c[h],g=l[p];if(C(g))for(var f=0,v=g.length;f<v;f++){var y=re({group:p},g[f]);u.push(y)}}t=new nc(n,u)}else{var m=e;t=new tn(n,m).collection()}return t},remove:function(e){if(P(e));else if(_(e)){var t=e;e=this.$(t)}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function ac(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!==typeof Float32Array;if(4!==arguments.length)return!1;for(var h=0;h<4;++h)if("number"!==typeof arguments[h]||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var d=c?new Float32Array(l):new Array(l);function p(e,t){return 1-3*t+3*e}function g(e,t){return 3*t-6*e}function f(e){return 3*e}function v(e,t,n){return((p(t,n)*e+g(t,n))*e+f(t))*e}function y(e,t,n){return 3*p(t,n)*e*e+2*g(t,n)*e+f(t)}function m(t,r){for(var a=0;a<i;++a){var o=y(r,e,n);if(0===o)return r;var s=v(r,e,n)-t;r-=s/o}return r}function b(){for(var t=0;t<l;++t)d[t]=v(t*u,e,n)}function x(t,r,i){var a,l,u=0;do{l=r+(i-r)/2,a=v(l,e,n)-t,a>0?i=l:r=l}while(Math.abs(a)>o&&++u<s);return l}function w(t){for(var r=0,i=1,o=l-1;i!==o&&d[i]<=t;++i)r+=u;--i;var s=(t-d[i])/(d[i+1]-d[i]),c=r+s*u,h=y(c,e,n);return h>=a?m(t,c):0===h?c:x(t,r,r+u)}var E=!1;function T(){E=!0,e===t&&n===r||b()}var _=function(i){return E||T(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};_.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var A="generateBezier("+[e,t,n,r]+")";return _.toString=function(){return A},_}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var oc=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,.5*r,i),o=t(n,.5*r,a),s=t(n,r,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),u=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,h=1e-4,d=.016;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,l.tension=t,l.friction=r,a=null!==i,a?(c=e(t,r),o=c/i*d):o=d;;)if(s=n(s||l,o),u.push(1+s.x),c+=16,!(Math.abs(s.x)>h&&Math.abs(s.v)>h))break;return a?function(e){return u[e*(u.length-1)|0]}:c}}(),sc=function(e,t,n,r){var i=ac(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},lc={linear:function(e,t,n){return e+(t-e)*n},ease:sc(.25,.1,.25,1),"ease-in":sc(.42,0,1,1),"ease-out":sc(0,0,.58,1),"ease-in-out":sc(.42,0,.58,1),"ease-in-sine":sc(.47,0,.745,.715),"ease-out-sine":sc(.39,.575,.565,1),"ease-in-out-sine":sc(.445,.05,.55,.95),"ease-in-quad":sc(.55,.085,.68,.53),"ease-out-quad":sc(.25,.46,.45,.94),"ease-in-out-quad":sc(.455,.03,.515,.955),"ease-in-cubic":sc(.55,.055,.675,.19),"ease-out-cubic":sc(.215,.61,.355,1),"ease-in-out-cubic":sc(.645,.045,.355,1),"ease-in-quart":sc(.895,.03,.685,.22),"ease-out-quart":sc(.165,.84,.44,1),"ease-in-out-quart":sc(.77,0,.175,1),"ease-in-quint":sc(.755,.05,.855,.06),"ease-out-quint":sc(.23,1,.32,1),"ease-in-out-quint":sc(.86,0,.07,1),"ease-in-expo":sc(.95,.05,.795,.035),"ease-out-expo":sc(.19,1,.22,1),"ease-in-out-expo":sc(1,0,0,1),"ease-in-circ":sc(.6,.04,.98,.335),"ease-out-circ":sc(.075,.82,.165,1),"ease-in-out-circ":sc(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return lc.linear;var r=oc(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":sc};function uc(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function cc(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function hc(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=cc(e,i),s=cc(t,i);if(S(o)&&S(s))return uc(a,o,s,n,r);if(C(o)&&C(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],h=s[u];if(null!=c&&null!=h){var d=uc(a,c,h,n,r);l.push(d)}else l.push(h)}return l}}function dc(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,l=o.startTime,u=r?e:e.cy(),c=u.style();if(!o.easingImpl)if(null==s)o.easingImpl=lc["linear"];else{var h,d,p;if(_(s)){var g=c.parse("transition-timing-function",s);h=g.value}else h=s;_(h)?(d=h,p=[]):(d=h[1],p=h.slice(2).map((function(e){return+e}))),p.length>0?("spring"===d&&p.push(o.duration),o.easingImpl=lc[d].apply(null,p)):o.easingImpl=lc[d]}var f,v=o.easingImpl;if(f=0===o.duration?1:(n-l)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var y=o.startPosition,m=o.position;if(m&&i&&!e.locked()){var b={};pc(y.x,m.x)&&(b.x=hc(y.x,m.x,f,v)),pc(y.y,m.y)&&(b.y=hc(y.y,m.y,f,v)),e.position(b)}var x=o.startPan,w=o.pan,E=a.pan,T=null!=w&&r;T&&(pc(x.x,w.x)&&(E.x=hc(x.x,w.x,f,v)),pc(x.y,w.y)&&(E.y=hc(x.y,w.y,f,v)),e.emit("pan"));var A=o.startZoom,C=o.zoom,D=null!=C&&r;D&&(pc(A,C)&&(a.zoom=Fn(a.minZoom,hc(A,C,f,v),a.maxZoom)),e.emit("zoom")),(T||D)&&e.emit("viewport");var N=o.style;if(N&&N.length>0&&i){for(var S=0;S<N.length;S++){var k=N[S],L=k.name,P=k,I=o.startStyle[L],M=c.properties[I.name],O=hc(I,P,f,v,M);c.overrideBypass(e,L,O)}e.emit("style")}}return o.progress=f,f}function pc(e,t){return null!=e&&null!=t&&(!(!S(e)||!S(t))||!(!e||!t))}function gc(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function fc(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.push(l)}for(var u=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t];n()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var h=a[c],d=h._private;d.stopped?(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||gc(t,h,e),dc(t,h,e,n),d.applying&&(d.applying=!1),u(d.frames),null!=d.step&&d.step(e),h.completed()&&(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=n[o],l=i(s);a=a||l}var u=i(t,!0);(a||u)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var vc={animate:Fs.animate(),animation:Fs.animation(),animated:Fs.animated(),clearQueue:Fs.clearQueue(),delay:Fs.delay(),delayAnimation:Fs.delayAnimation(),stop:Fs.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){fc(n,e)}),t.beforeRenderPriorities.animations):n()}function n(){e._private.animationsRunning&&dt((function(t){fc(t,e),n()}))}}},yc={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&I(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},mc=function(e){return _(e)?new dl(e):e},bc={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new bu(yc,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,mc(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,mc(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,mc(t),n),this},once:function(e,t,n){return this.emitter().one(e,mc(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fs.eventAliasesOn(bc);var xc={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};xc.jpeg=xc.jpg;var wc={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var i;i=_(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var a=new r(re({},e,{cy:t,eles:i}));return a}Ot("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ot("A `name` must be specified to make a layout");else Ot("Layout options must be specified to make a layout")}};wc.createLayout=wc.makeLayout=wc.layout;var Ec={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.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 null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i],o=t.getElementById(i);o.data(a)}}))}},Tc=Ut({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:12,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),_c={renderTo:function(e,t,n,r){var i=this._private.renderer;return i.renderTo(e,t,n,r),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 t=this,n=t.extension("renderer",e.name);if(null!=n){void 0!==e.wheelSensitivity&&Bt("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 r=Tc(e);r.cy=t,t._private.renderer=new n(r),this.notify("init")}else Ot("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t){t._cyreg=null;while(t.childNodes.length>0)t.removeChild(t.childNodes[0])}e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};_c.invalidateDimensions=_c.resize;var Ac={collection:function(e,t){return _(e)?this.$(e):P(e)?e.collection():C(e)?(t||(t={}),new nc(this,e,t.unique,t.removed)):new nc(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Ac.elements=Ac.filter=Ac.$;var Cc={},Dc="t",Nc="f";Cc.apply=function(e){for(var t=this,n=t._private,r=n.cy,i=r.collection(),a=0;a<e.length;a++){var o=e[a],s=t.getContextMeta(o);if(!s.empty){var l=t.getContextStyle(s),u=t.applyContextStyle(s,l,o);o._private.appliedInitStyle?t.updateTransitions(o,u.diffProps):o._private.appliedInitStyle=!0;var c=t.updateStyleHints(o);c&&i.push(o)}}return i},Cc.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+"-"+t,a=r[i];if(a)return a;for(var o=[],s={},l=0;l<n.length;l++){var u=n[l],c=e[l]===Dc,h=t[l]===Dc,d=c!==h,p=u.mappedProperties.length>0;if(d||h&&p){var g=void 0;d&&p||d?g=u.properties:p&&(g=u.mappedProperties);for(var f=0;f<g.length;f++){for(var v=g[f],y=v.name,m=!1,b=l+1;b<n.length;b++){var x=n[b],w=t[b]===Dc;if(w&&(m=null!=x.properties[v.name],m))break}s[y]||m||(s[y]=!0,o.push(y))}}}return r[i]=o,o},Cc.getContextMeta=function(e){for(var t,n=this,r="",i=e._private.styleCxtKey||"",a=0;a<n.length;a++){var o=n[a],s=o.selector&&o.selector.matches(e);r+=s?Dc:Nc}return t=n.getPropertiesDiff(i,r),e._private.styleCxtKey=r,{key:r,diffPropNames:t,empty:0===t.length}},Cc.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var i={_private:{key:t}},a=0;a<n.length;a++){var o=n[a],s=t[a]===Dc;if(s)for(var l=0;l<o.properties.length;l++){var u=o.properties[l];i[u.name]=u}}return r[t]=i,i},Cc.applyContextStyle=function(e,t,n){for(var r=this,i=e.diffPropNames,a={},o=r.types,s=0;s<i.length;s++){var l=i[s],u=t[l],c=n.pstyle(l);if(!u){if(!c)continue;u=c.bypass?{name:l,deleteBypassed:!0}:{name:l,delete:!0}}if(c!==u){if(u.mapped===o.fn&&null!=c&&null!=c.mapping&&c.mapping.value===u.value){var h=c.mapping,d=h.fnValue=u.value(n);if(d===h.prevFnValue)continue}var p=a[l]={prev:c};r.applyParsedProperty(n,u),p.next=n.pstyle(l),p.next&&p.next.bypass&&(p.next=p.next.bypassed)}}return{diffProps:a}},Cc.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;r=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];t.styleKeys[c]=[gt,vt]}for(var h=function(e,n){return t.styleKeys[n][0]=mt(e,t.styleKeys[n][0])},d=function(e,n){return t.styleKeys[n][1]=bt(e,t.styleKeys[n][1])},p=function(e,t){h(e,t),d(e,t)},g=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);h(r,t),d(r,t)}},f=2e9,v=function(e){return-128<e&&e<128&&Math.floor(e)!==e?f-(1024*e|0):e},y=0;y<r.length;y++){var m=r[y],b=l[m];if(null!=b){var x=this.properties[m],w=x.type,E=x.groupKey,T=void 0;null!=x.hashOverride?T=x.hashOverride(e,b):null!=b.pfValue&&(T=b.pfValue);var _=null==x.enums?b.value:null,A=null!=T,C=null!=_,D=A||C,N=b.units;if(w.number&&D&&!w.multiple){var S=A?T:_;p(v(S),E),A||null==N||g(N,E)}else g(b.strValue,E)}}for(var k=[gt,vt],L=0;L<i.length;L++){var P=i[L],I=t.styleKeys[P];k[0]=mt(I[0],k[0]),k[1]=bt(I[1],k[1])}t.styleKey=xt(k[0],k[1]);var M=t.styleKeys;t.labelDimsKey=wt(M.labelDimensions);var O=a(e,["label"],M.labelDimensions);if(t.labelKey=wt(O),t.labelStyleKey=wt(Et(M.commonLabel,O)),!s){var R=a(e,["source-label"],M.labelDimensions);t.sourceLabelKey=wt(R),t.sourceLabelStyleKey=wt(Et(M.commonLabel,R));var B=a(e,["target-label"],M.labelDimensions);t.targetLabelKey=wt(B),t.targetLabelStyleKey=wt(Et(M.commonLabel,B))}if(s){var F=t.styleKeys,z=F.nodeBody,G=F.nodeBorder,V=F.nodeOutline,X=F.backgroundImage,Y=F.compound,U=F.pie,W=[z,G,V,X,Y,U].filter((function(e){return null!=e})).reduce(Et,[gt,vt]);t.nodeKey=wt(W),t.hasPie=null!=U&&U[0]!==gt&&U[1]!==vt}return o!==t.styleKey},Cc.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},Cc.applyParsedProperty=function(e,t){var n,r=this,i=t,a=e._private.style,o=r.types,s=r.properties[i.name].type,l=i.bypass,u=a[i.name],c=u&&u.bypass,h=e._private,d="mapping",p=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},g=function(){var t=p(u),n=p(i);r.checkTriggers(e,i.name,t,n)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(i=t=this.parse(t.name,"bezier",l)),i["delete"])return a[i.name]=void 0,g(),!0;if(i.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,g(),!0):(g(),!0);if(i.deleteBypass)return u?!!u.bypass&&(a[i.name]=u.bypassed,g(),!0):(g(),!0);var f=function(){Bt("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+i.name+"` with data field `"+i.field+"`); try a `["+i.field+"]` selector to limit scope to elements with `"+i.field+"` defined")};switch(i.mapped){case o.mapData:for(var v,y=i.field.split("."),m=h.data,b=0;b<y.length&&m;b++){var x=y[b];m=m[x]}if(null==m)return f(),!1;if(!S(m))return Bt("Do not use continuous mappers without specifying numeric data (i.e. `"+i.field+": "+m+"` for `"+e.id()+"` is non-numeric)"),!1;var w=i.fieldMax-i.fieldMin;if(v=0===w?0:(m-i.fieldMin)/w,v<0?v=0:v>1&&(v=1),s.color){var E=i.valueMin[0],T=i.valueMax[0],_=i.valueMin[1],A=i.valueMax[1],C=i.valueMin[2],D=i.valueMax[2],N=null==i.valueMin[3]?1:i.valueMin[3],k=null==i.valueMax[3]?1:i.valueMax[3],L=[Math.round(E+(T-E)*v),Math.round(_+(A-_)*v),Math.round(C+(D-C)*v),Math.round(N+(k-N)*v)];n={bypass:i.bypass,name:i.name,value:L,strValue:"rgb("+L[0]+", "+L[1]+", "+L[2]+")"}}else{if(!s.number)return!1;var P=i.valueMin+(i.valueMax-i.valueMin)*v;n=this.parse(i.name,P,i.bypass,d)}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var I=i.field.split("."),M=h.data,O=0;O<I.length&&M;O++){var R=I[O];M=M[R]}if(null!=M&&(n=this.parse(i.name,M,i.bypass,d)),!n)return f(),!1;n.mapping=i,i=n;break;case o.fn:var B=i.value,F=null!=i.fnValue?i.fnValue:B(e);if(i.prevFnValue=F,null==F)return Bt("Custom function mappers may not return null (i.e. `"+i.name+"` for ele `"+e.id()+"` is null)"),!1;if(n=this.parse(i.name,F,i.bypass,d),!n)return Bt("Custom function mappers may not return invalid values for the property type (i.e. `"+i.name+"` for ele `"+e.id()+"` is invalid)"),!1;n.mapping=zt(i),i=n;break;case void 0:break;default:return!1}return l?(i.bypassed=c?u.bypassed:u,a[i.name]=i):c?u.bypassed=i:a[i.name]=i,g(),!0},Cc.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),t)for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else r._private.style={}}},Cc.update=function(){var e=this._private.cy,t=e.mutableElements();t.updateStyle()},Cc.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,u=0;u<i.length;u++){var c=i[u],h=e.pstyle(c),d=t[c];if(d){var p=d.prev,g=p,f=null!=d.next?d.next:h,v=!1,y=void 0,m=1e-6;g&&(S(g.pfValue)&&S(f.pfValue)?(v=f.pfValue-g.pfValue,y=g.pfValue+m*v):S(g.value)&&S(f.value)?(v=f.value-g.value,y=g.value+m*v):C(g.value)&&C(f.value)&&(v=g.value[0]!==f.value[0]||g.value[1]!==f.value[1]||g.value[2]!==f.value[2],y=g.strValue),v&&(s[c]=f.strValue,this.applyBypass(e,c,y),l=!0))}}if(!l)return;r.transitioning=!0,new ta((function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Cc.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Cc.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Cc.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||"curve-style"!==t||"bezier"!==n&&"bezier"!==r||e.parallelEdges().forEach((function(e){e.dirtyBoundingBoxCache()})),!i.triggersBoundsOfConnectedEdges||"display"!==t||"none"!==n&&"none"!==r||e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Cc.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Sc={applyBypass:function(e,t,n,r){var i=this,a=[],o=!0;if("*"===t||"**"===t){if(void 0!==n)for(var s=0;s<i.properties.length;s++){var l=i.properties[s],u=l.name,c=this.parse(u,n,!0);c&&a.push(c)}}else if(_(t)){var h=this.parse(t,n,!0);h&&a.push(h)}else{if(!D(t))return!1;var d=t;r=n;for(var p=Object.keys(d),g=0;g<p.length;g++){var f=p[g],v=d[f];if(void 0===v&&(v=d[W(f)]),void 0!==v){var y=this.parse(f,v,!0);y&&a.push(y)}}}if(0===a.length)return!1;for(var m=!1,b=0;b<e.length;b++){for(var x=e[b],w={},E=void 0,T=0;T<a.length;T++){var A=a[T];if(r){var C=x.pstyle(A.name);E=w[A.name]={prev:C}}m=this.applyParsedProperty(x,zt(A))||m,r&&(E.next=x.pstyle(A.name))}m&&this.updateStyleHints(x),r&&this.updateTransitions(x,w,o)}return m},overrideBypass:function(e,t,n){t=U(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),a.strValue=s?"rgb("+n.join(",")+")":l?n.join(" "):""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,t,u,n)}},removeAllBypasses:function(e,t){return this.removeBypasses(e,this.propertyNames,t)},removeBypasses:function(e,t,n){for(var r=!0,i=0;i<e.length;i++){for(var a=e[i],o={},s=0;s<t.length;s++){var l=t[s],u=this.properties[l],c=a.pstyle(u.name);if(c&&c.bypass){var h="",d=this.parse(l,h,!0),p=o[u.name]={prev:c};this.applyParsedProperty(a,d),p.next=a.pstyle(u.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,o,r)}}},kc={getEmSizeInPixels:function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},containerCss:function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)}},Lc={getRenderedStyle:function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},getRawStyle:function(e,t){var n=this;if(e=e[0],e){for(var r={},i=0;i<n.properties.length;i++){var a=n.properties[i],o=n.getStylePropertyValue(e,a.name,t);null!=o&&(r[a.name]=o,r[W(a.name)]=o)}return r}},getIndexedStyle:function(e,t,n,r){var i=e.pstyle(t)[n][r];return null!=i?i:e.cy().style().getDefaultProperty(t)[n][0]},getStylePropertyValue:function(e,t,n){var r=this;if(e=e[0],e){var i=r.properties[t];i.alias&&(i=i.pointsTo);var a=i.type,o=e.pstyle(i.name);if(o){var s=o.value,l=o.units,u=o.strValue;if(n&&a.number&&null!=s&&S(s)){var c=e.cy().zoom(),h=function(e){return e*c},d=function(e,t){return h(e)+t},p=C(s),g=p?l.every((function(e){return null!=e})):null!=l;return g?p?s.map((function(e,t){return d(e,l[t])})).join(" "):d(s,l):p?s.map((function(e){return _(e)?e:""+h(e)})).join(" "):""+h(s)}if(null!=u)return u}return null}},getAnimationStartStyle:function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r],a=i.name,o=e.pstyle(a);void 0!==o&&(o=D(o)?this.parse(a,o.strValue):this.parse(a,o)),o&&(n[a]=o)}return n},getPropsList:function(e){var t=this,n=[],r=e,i=t.properties;if(r)for(var a=Object.keys(r),o=0;o<a.length;o++){var s=a[o],l=r[s],u=i[s]||i[U(s)],c=this.parse(u.name,l);c&&n.push(c)}return n},getNonDefaultPropertiesHash:function(e,t,n){var r,i,a,o,s,l,u=n.slice();for(s=0;s<t.length;s++)if(r=t[s],i=e.pstyle(r,!1),null!=i)if(null!=i.pfValue)u[0]=mt(o,u[0]),u[1]=bt(o,u[1]);else for(a=i.strValue,l=0;l<a.length;l++)o=a.charCodeAt(l),u[0]=mt(o,u[0]),u[1]=bt(o,u[1]);return u}};Lc.getPropertiesHash=Lc.getNonDefaultPropertiesHash;var Pc={appendFromJson:function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,a=r.style||r.css,o=Object.keys(a);t.selector(i);for(var s=0;s<o.length;s++){var l=o[s],u=a[l];t.css(l,u)}}return t},fromJson:function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},json:function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e}},Ic={appendFromString:function(e){var t,n,r,i=this,a=this,o=""+e;function s(){o=o.length>t.length?o.substr(t.length):""}function l(){n=n.length>r.length?n.substr(r.length):""}for(o=o.replace(/[/][*](\s|.)+?[*][/]/g,"");;){var u=o.match(/^\s*$/);if(u)break;var c=o.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Bt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+o);break}t=c[0];var h=c[1];if("core"!==h){var d=new dl(h);if(d.invalid){Bt("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),s();continue}}var p=c[2],g=!1;n=p;for(var f=[];;){var v=n.match(/^\s*$/);if(v)break;var y=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){Bt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),g=!0;break}r=y[0];var m=y[1],b=y[2],x=i.properties[m];if(x){var w=a.parse(m,b);w?(f.push({name:m,val:b}),l()):(Bt("Skipping property: Invalid property definition in: "+r),l())}else Bt("Skipping property: Invalid property name in: "+r),l()}if(g){s();break}a.selector(h);for(var E=0;E<f.length;E++){var T=f[E];a.css(T.name,T.val)}s()}return a},fromString:function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t}},Mc={};(function(){var e=q,t=K,n=Q,r=J,i=ee,a=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(a){var o=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+i;return"^"+a+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+o+")\\s*\\,\\s*("+o+")\\)$"},s=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];Mc.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"]},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},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"]},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","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:a("data")},layoutData:{mapping:!0,regex:a("layoutData")},scratch:{mapping:!0,regex:a("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(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return _(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\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(e){var t=e.length;return 1===t||2===t||4===t}}};var l={zeroNonZero:function(e,t){return(null==e||null==t)&&e!==t||(0==e&&0!=t||0!=e&&0==t)},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=F(e),r=F(t);return n&&!r||!n&&r}},u=Mc.types,c=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],h=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],d=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],p=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],g=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification}],f=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any}],v=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],y=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],m=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],b=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],x=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},w=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:x},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:x},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],E=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],T=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],A=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],C=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],D=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],N=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],S=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],k=[];Mc.pieBackgroundN=16,k.push({name:"pie-size",type:u.sizeMaybePercent});for(var L=1;L<=Mc.pieBackgroundN;L++)k.push({name:"pie-"+L+"-background-color",type:u.color}),k.push({name:"pie-"+L+"-background-size",type:u.percent}),k.push({name:"pie-"+L+"-background-opacity",type:u.zeroOneNumber});var P=[],I=Mc.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach((function(e){I.forEach((function(t){var n=t+"-"+e.name,r=e.type,i=e.triggersBounds;P.push({name:n,type:r,triggersBounds:i})}))}),{});var M=Mc.properties=[].concat(f,b,v,y,m,N,g,p,c,h,d,w,E,T,A,k,C,D,P,S),O=Mc.propertyGroups={behavior:f,transition:b,visibility:v,overlay:y,underlay:m,ghost:N,commonLabel:g,labelDimensions:p,mainLabel:c,sourceLabel:h,targetLabel:d,nodeBody:w,nodeBorder:E,nodeOutline:T,backgroundImage:A,pie:k,compound:C,edgeLine:D,edgeArrow:P,core:S},R=Mc.propertyGroupNames={},B=Mc.propertyGroupKeys=Object.keys(O);B.forEach((function(e){R[e]=O[e].map((function(e){return e.name})),O[e].forEach((function(t){return t.groupKey=e}))}));var z=Mc.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"}];Mc.propertyNames=M.map((function(e){return e.name}));for(var G=0;G<M.length;G++){var V=M[G];M[V.name]=V}for(var X=0;X<z.length;X++){var Y=z[X],U=M[Y.pointsTo],W={name:Y.name,alias:!0,pointsTo:U};M.push(W),M[Y.name]=W}})(),Mc.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Mc.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=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","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","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","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%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce((function(e,t){for(var n=1;n<=Mc.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e}),{}),{"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(e,t){return Mc.arrowPrefixes.forEach((function(n){var r=n+"-"+t.name,i=t.value;e[r]=i})),e}),{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);n[a]=s}}return e.defaultProperties=n,e.defaultProperties},Mc.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 Oc={parse:function(e,t,n,r){var i=this;if(A(t))return i.parseImplWarn(e,t,n,r);var a,o="mapping"===r||!0===r||!1===r||null==r?"dontcare":r,s=n?"t":"f",l=""+t,u=At(e,l,s,o),c=i.propCache=i.propCache||[];return(a=c[u])||(a=c[u]=i.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(a=zt(a),a&&(a.value=zt(a.value))),a},parseImplWarn:function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return i||null==t||Bt("The style property `".concat(e,": ").concat(t,"` is invalid")),!i||"width"!==i.name&&"height"!==i.name||"label"!==t||Bt("The style value of `label` is deprecated for `"+i.name+"`"),i},parseImpl:function(e,t,n,r){var i=this;e=U(e);var a=i.properties[e],o=t,s=i.types;if(!a)return null;if(void 0===t)return null;a.alias&&(a=a.pointsTo,e=a.name);var l=_(t);l&&(t=t.trim());var u,c,h=a.type;if(!h)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(A(t))return{name:e,value:t,strValue:"fn",mapped:s.fn,bypass:n};if(!l||r||t.length<7||"a"!==t[1]);else{if(t.length>=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var d=s.data;return{name:e,value:u,strValue:""+t,mapped:d,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(h.multiple)return!1;var p=s.mapData;if(!h.color&&!h.number)return!1;var g=this.parse(e,c[4]);if(!g||g.mapped)return!1;var f=this.parse(e,c[5]);if(!f||f.mapped)return!1;if(g.pfValue===f.pfValue||g.strValue===f.strValue)return Bt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+g.strValue+"`"),this.parse(e,g.strValue);if(h.color){var v=g.value,y=f.value,m=v[0]===y[0]&&v[1]===y[1]&&v[2]===y[2]&&(v[3]===y[3]||(null==v[3]||1===v[3])&&(null==y[3]||1===y[3]));if(m)return!1}return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:g.value,valueMax:f.value,bypass:n}}}if(h.multiple&&"multiple"!==r){var b;if(b=l?t.split(/\s+/):C(t)?t:[t],h.evenMultiple&&b.length%2!==0)return null;for(var x=[],w=[],E=[],T="",D=!1,N=0;N<b.length;N++){var S=i.parse(e,b[N],n,"multiple");D=D||_(S.value),x.push(S.value),E.push(null!=S.pfValue?S.pfValue:S.value),w.push(S.units),T+=(N>0?" ":"")+S.strValue}return h.validate&&!h.validate(x,w)?null:h.singleEnum&&D?1===x.length&&_(x[0])?{name:e,value:x[0],strValue:x[0],bypass:n}:null:{name:e,value:x,pfValue:E,strValue:T,bypass:n,units:w}}var L=function(){for(var r=0;r<h.enums.length;r++){var i=h.enums[r];if(i===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(h.number){var P,I="px";if(h.units&&(P=h.units),h.implicitUnits&&(I=h.implicitUnits),!h.unitless)if(l){var M="px|em"+(h.allowPercent?"|\\%":"");P&&(M=P);var O=t.match("^("+q+")("+M+")?$");O&&(t=O[1],P=O[2]||I)}else P&&!h.implicitUnits||(P=I);if(t=parseFloat(t),isNaN(t)&&void 0===h.enums)return null;if(isNaN(t)&&void 0!==h.enums)return t=o,L();if(h.integer&&!k(t))return null;if(void 0!==h.min&&(t<h.min||h.strictMin&&t===h.min)||void 0!==h.max&&(t>h.max||h.strictMax&&t===h.max))return null;var R={name:e,value:t,strValue:""+t+(P||""),units:P,bypass:n};return h.unitless||"px"!==P&&"em"!==P?R.pfValue=t:R.pfValue="px"!==P&&P?this.getEmSizeInPixels()*t:t,"ms"!==P&&"s"!==P||(R.pfValue="ms"===P?t:1e3*t),"deg"!==P&&"rad"!==P||(R.pfValue="rad"===P?t:Nn(t)),"%"===P&&(R.pfValue=t/100),R}if(h.propList){var B=[],F=""+t;if("none"===F);else{for(var z=F.split(/\s*,\s*|\s+/),G=0;G<z.length;G++){var V=z[G].trim();i.properties[V]?B.push(V):Bt("`"+V+"` is not a valid property name")}if(0===B.length)return null}return{name:e,value:B,strValue:0===B.length?"none":B.join(" "),bypass:n}}if(h.color){var X=le(t);return X?{name:e,value:X,pfValue:X,strValue:"rgb("+X[0]+","+X[1]+","+X[2]+")",bypass:n}:null}if(h.regex||h.regexes){if(h.enums){var Y=L();if(Y)return Y}for(var W=h.regexes?h.regexes:[h.regex],j=0;j<W.length;j++){var H=new RegExp(W[j]),$=H.exec(t);if($)return{name:e,value:h.singleRegexMatchValue?$[1]:$,strValue:""+t,bypass:n}}return null}return h.string?{name:e,value:""+t,strValue:""+t,bypass:n}:h.enums?L():null}},Rc=function e(t){if(!(this instanceof e))return new e(t);O(t)?(this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()):Ot("A style must have a core reference")},Bc=Rc.prototype;Bc.instanceString=function(){return"style"},Bc.clear=function(){for(var e=this._private,t=e.cy,n=t.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(n,!0),n.forEach((function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1})),this},Bc.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Bc.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},Bc.selector=function(e){var t="core"===e?null:new dl(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},Bc.css=function(){var e=this,t=arguments;if(1===t.length)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];void 0===a&&(a=n[W(i.name)]),void 0!==a&&this.cssRule(i.name,a)}else 2===t.length&&this.cssRule(t[0],t[1]);return this},Bc.style=Bc.css,Bc.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n);var i=!this[r].selector;i&&(this._private.coreStyle[n.name]=n)}return this},Bc.append=function(e){return R(e)?e.appendToStyle(this):C(e)?this.appendFromJson(e):_(e)&&this.appendFromString(e),this},Rc.fromJson=function(e,t){var n=new Rc(e);return n.fromJson(t),n},Rc.fromString=function(e,t){return new Rc(e).fromString(t)},[Cc,Sc,kc,Lc,Pc,Ic,Mc,Oc].forEach((function(e){re(Bc,e)})),Rc.types=Bc.types,Rc.properties=Bc.properties,Rc.propertyGroups=Bc.propertyGroups,Rc.propertyGroupNames=Bc.propertyGroupNames,Rc.propertyGroupKeys=Bc.propertyGroupKeys;var Fc={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return R(e)?t.style=e.generateStyle(this):C(e)?t.style=Rc.fromJson(this,e):_(e)?t.style=Rc.fromString(this,e):t.style=Rc(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},zc="single",Gc={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return null==t.selectionType&&(t.selectionType=zc),void 0===e?t.selectionType:("additive"!==e&&"single"!==e||(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(_(a[0]))return e=a[0],o[e];if(D(a[0])){if(!this._private.panningEnabled)return this;n=a[0],r=n.x,i=n.y,S(r)&&(o.x=r),S(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],"x"!==e&&"y"!==e||!S(t)||(o[e]=t),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a,o,s=arguments,l=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:D(e)&&(i=s[0],a=i.x,o=i.y,S(a)&&(l.x+=a),S(o)&&(l.y+=o),this.emit("pan viewport"));break;case 2:n=e,r=t,"x"!==n&&"y"!==n||!S(r)||(l[n]+=r),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(S(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n;if(_(e)){var r=e;e=this.$(r)}else if(G(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else P(e)||(e=this.mutableElements());if(!P(e)||!e.empty()){n=n||e.boundingBox();var a,o=this.width(),s=this.height();if(t=S(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){a=Math.min((o-2*t)/n.w,(s-2*t)/n.h),a=a>this._private.maxZoom?this._private.maxZoom:a,a=a<this._private.minZoom?this._private.minZoom:a;var l={x:(o-a*(n.x1+n.x2))/2,y:(s-a*(n.y1+n.y2))/2};return{zoom:a,pan:l}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return S(e)&&S(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):S(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:S(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),S(e)?n=e:D(e)&&(n=e.level,null!=e.position?t=wn(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=n>r.maxZoom?r.maxZoom:n,n=n<r.minZoom?r.minZoom:n,o||!S(n)||n===a||null!=t&&(!S(t.x)||!S(t.y)))return null;if(null!=t){var s=i,l=a,u=n,c={x:-u/l*(t.x-s.x)+t.x,y:-u/l*(t.y-s.y)+t.y};return{zoomed:!0,panned:!0,zoom:u,pan:c}}return{zoomed:!0,panned:!1,zoom:n,pan:i}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed?(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this):this},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e)return this;if(S(e.zoom)||(n=!1),D(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;S(l.x)&&(t.pan.x=l.x,o=!1),S(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(_(e)){var n=e;e=this.mutableElements().filter(n)}else P(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();t=void 0===t?this._private.zoom:t;var o={x:(i-t*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2};return o}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var e=n.window().getComputedStyle(t),r=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-r("padding-left")-r("padding-right"),height:t.clientHeight-r("padding-top")-r("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,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Gc.centre=Gc.center,Gc.autolockNodes=Gc.autolock,Gc.autoungrabifyNodes=Gc.autoungrabify;var Vc={data:Fs.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Fs.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Fs.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fs.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Vc.attr=Vc.data,Vc.removeAttr=Vc.removeData;var Xc=function(e){var t=this;e=re({},e);var n=e.container;n&&!L(n)&&L(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r=r||{},r&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==y&&void 0!==n&&!e.headless,o=e;o.layout=re({name:a?"grid":"null"},o.layout),o.renderer=re({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new nc(this),listeners:[],aniEles:new nc(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:S(o.zoom)?o.zoom:1,pan:{x:D(o.pan)&&S(o.pan.x)?o.pan.x:0,y:D(o.pan)&&S(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var u=function(e,t){var n=e.some(V);if(n)return ta.all(e).then(t);t(e)};l.styleEnabled&&t.setStyle([]);var c=re({},o,o.renderer);t.initRenderer(c);var h=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(D(e)||C(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=re({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};u([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),h(a,(function(){t.startAnimationLoop(),l.ready=!0,A(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")}),o.done)}))},Yc=Xc.prototype;re(Yc,{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(null==e)return y;var t=this._private.container.ownerDocument;return void 0===t||null==t?y:t.defaultView||y},mount:function(e){if(null!=e){var t=this,n=t._private,r=n.options;return!L(e)&&L(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(re({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return zt(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),i=function(e){return t.getElementById(e.id())};if(D(e)){if(t.startBatch(),e.elements){var a={},o=function(e,n){for(var r=[],i=[],o=0;o<e.length;o++){var s=e[o];if(s.data.id){var l=""+s.data.id,u=t.getElementById(l);a[l]=!0,0!==u.length?i.push({ele:u,json:s}):n?(s.group=n,r.push(s)):r.push(s)}else Bt("cy.json() cannot handle elements without an ID attribute")}t.add(r);for(var c=0;c<i.length;c++){var h=i[c],d=h.ele,p=h.json;d.json(p)}};if(C(e.elements))o(e.elements);else for(var s=["nodes","edges"],l=0;l<s.length;l++){var u=s[l],c=e.elements[u];C(c)&&o(c,u)}var h=t.collection();r.filter((function(e){return!a[e.id()]})).forEach((function(e){e.isParent()?h.merge(e):e.remove()})),h.forEach((function(e){return e.children().move({parent:null})})),h.forEach((function(e){return i(e).remove()}))}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x===n.pan.x&&e.pan.y===n.pan.y||t.pan(e.pan)),e.data&&t.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],p=0;p<d.length;p++){var g=d[p];null!=e[g]&&t[g](e[g])}return t.endBatch(),this}var f=!!e,v={};f?v.elements=this.elements().map((function(e){return e.json()})):(v.elements={},r.forEach((function(e){var t=e.group();v.elements[t]||(v.elements[t]=[]),v.elements[t].push(e.json())}))),this._private.styleEnabled&&(v.style=t.style().json()),v.data=zt(t.data());var y=n.options;return v.zoomingEnabled=n.zoomingEnabled,v.userZoomingEnabled=n.userZoomingEnabled,v.zoom=n.zoom,v.minZoom=n.minZoom,v.maxZoom=n.maxZoom,v.panningEnabled=n.panningEnabled,v.userPanningEnabled=n.userPanningEnabled,v.pan=zt(n.pan),v.boxSelectionEnabled=n.boxSelectionEnabled,v.renderer=zt(y.renderer),v.hideEdgesOnViewport=y.hideEdgesOnViewport,v.textureOnViewport=y.textureOnViewport,v.wheelSensitivity=y.wheelSensitivity,v.motionBlur=y.motionBlur,v.multiClickDebounceTime=y.multiClickDebounceTime,v}}),Yc.$id=Yc.getElementById,[ic,vc,bc,xc,wc,Ec,_c,Ac,Fc,Gc,Vc].forEach((function(e){re(Yc,e)}));var Uc={fit:!0,directed:!1,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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},Wc={maximal:!1,acyclic:!1},jc=function(e){return e.scratch("breadthfirst")},Hc=function(e,t){return e.scratch("breadthfirst",t)};function qc(e){this.options=re({},Uc,Wc,e)}qc.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=r.nodes().filter((function(e){return e.isChildless()})),a=r,o=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,l=!!t.boundingBox,u=n.extent(),c=zn(l?t.boundingBox:{x1:u.x1,y1:u.y1,w:u.w,h:u.h});if(P(t.roots))e=t.roots;else if(C(t.roots)){for(var h=[],d=0;d<t.roots.length;d++){var p=t.roots[d],g=n.getElementById(p);h.push(g)}e=n.collection(h)}else if(_(t.roots))e=n.$(t.roots);else if(o)e=i.roots();else{var f=r.components();e=n.collection();for(var v=function(t){var n=f[t],r=n.maxDegree(!1),i=n.filter((function(e){return e.degree(!1)===r}));e=e.add(i)},y=0;y<f.length;y++)v(y)}var m=[],b={},x=function(e,t){null==m[t]&&(m[t]=[]);var n=m[t].length;m[t].push(e),Hc(e,{index:n,depth:t})},w=function(e,t){var n=jc(e),r=n.depth,i=n.index;m[r][i]=null,e.isChildless()&&x(e,t)};a.bfs({roots:e,directed:t.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&x(a,i),b[o]=!0}});for(var E=[],T=0;T<i.length;T++){var A=i[T];b[A.id()]||E.push(A)}var D=function(e){for(var t=m[e],n=0;n<t.length;n++){var r=t[n];null!=r?Hc(r,{depth:e,index:n}):(t.splice(n,1),n--)}},N=function(e,n){for(var i=jc(e),a=e.incomers().filter((function(e){return e.isNode()&&r.has(e)})),o=-1,s=e.id(),l=0;l<a.length;l++){var u=a[l],c=jc(u);o=Math.max(o,c.depth)}if(i.depth<=o){if(!t.acyclic&&n[s])return null;var h=o+1;return w(e,h),n[s]=h,!0}return!1};if(o&&s){var S=[],k={},L=function(e){return S.push(e)},I=function(){return S.shift()};i.forEach((function(e){return S.push(e)}));while(S.length>0){var M=I(),O=N(M,k);if(O)M.outgoers().filter((function(e){return e.isNode()&&r.has(e)})).forEach(L);else if(null===O){Bt("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var R=0;if(t.avoidOverlap)for(var B=0;B<i.length;B++){var F=i[B],z=F.layoutDimensions(t),G=z.w,V=z.h;R=Math.max(R,G,V)}var X={},Y=function(e){if(X[e.id()])return X[e.id()];for(var t=jc(e).depth,n=e.neighborhood(),r=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!s.isEdge()&&!s.isParent()&&i.has(s)){var l=jc(s);if(null!=l){var u=l.index,c=l.depth;if(null!=u&&null!=c){var h=m[c].length;c<t&&(r+=u/h,a++)}}}}return a=Math.max(1,a),r/=a,0===a&&(r=0),X[e.id()]=r,r},U=function(e,t){var n=Y(e),r=Y(t),i=n-r;return 0===i?te(e.id(),t.id()):i};void 0!==t.depthSort&&(U=t.depthSort);for(var W=m.length,j=0;j<W;j++)m[j].sort(U),D(j);for(var H=[],q=0;q<E.length;q++)H.push(E[q]);var $=function(){for(var e=0;e<W;e++)D(e)};H.length&&(m.unshift(H),W=m.length,$());for(var K=0,Z=0;Z<W;Z++)K=Math.max(m[Z].length,K);var Q={x:c.x1+c.w/2,y:c.y1+c.h/2},J=i.reduce((function(e,n){return function(t){return{w:-1===e.w?t.w:(e.w+t.w)/2,h:-1===e.h?t.h:(e.h+t.h)/2}}(n.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))}),{w:-1,h:-1}),ee=Math.max(1===W?0:l?(c.h-2*t.padding-J.h)/(W-1):(c.h-2*t.padding-J.h)/(W+1),R),ne=m.reduce((function(e,t){return Math.max(e,t.length)}),0),re=function(e){var n=jc(e),r=n.depth,i=n.index;if(t.circle){var a=Math.min(c.w/2/W,c.h/2/W);a=Math.max(a,R);var o=a*r+a-(W>0&&m[0].length<=3?a/2:0),s=2*Math.PI/m[r].length*i;return 0===r&&1===m[0].length&&(o=1),{x:Q.x+o*Math.cos(s),y:Q.y+o*Math.sin(s)}}var u=m[r].length,h=Math.max(1===u?0:l?(c.w-2*t.padding-J.w)/((t.grid?ne:u)-1):(c.w-2*t.padding-J.w)/((t.grid?ne:u)+1),R),d={x:Q.x+(i+1-(u+1)/2)*h,y:Q.y+(r+1-(W+1)/2)*ee};return d};return r.nodes().layoutPositions(this,t,re),this};var $c={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Kc(e){this.options=re({},$c,e)}Kc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=zn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep,c=u/Math.max(1,a.length-1),h=0,d=0;d<a.length;d++){var p=a[d],g=p.layoutDimensions(t),f=g.w,v=g.h;h=Math.max(h,f,v)}if(o=S(t.radius)?t.radius:a.length<=1?0:Math.min(s.h,s.w)/2-h,a.length>1&&t.avoidOverlap){h*=1.75;var y=Math.cos(c)-Math.cos(0),m=Math.sin(c)-Math.sin(0),b=Math.sqrt(h*h/(y*y+m*m));o=Math.max(b,o)}var x=function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r),u={x:l.x+a,y:l.y+s};return u};return r.nodes().layoutPositions(this,t,x),this};var Zc,Qc={fit:!0,padding:30,startAngle:1.5*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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Jc(e){this.options=re({},Qc,e)}Jc.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=zn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,c=0;c<a.length;c++){var h=a[c],d=void 0;d=t.concentric(h),l.push({value:d,node:h}),h._private.scratch.concentric=d}a.updateStyle();for(var p=0;p<a.length;p++){var g=a[p],f=g.layoutDimensions(t);u=Math.max(u,f.w,f.h)}l.sort((function(e,t){return t.value-e.value}));for(var v=t.levelWidth(a),y=[[]],m=y[0],b=0;b<l.length;b++){var x=l[b];if(m.length>0){var w=Math.abs(m[0].value-x.value);w>=v&&(m=[],y.push(m))}m.push(x)}var E=u+t.minNodeSpacing;if(!t.avoidOverlap){var T=y.length>0&&y[0].length>1,_=Math.min(o.w,o.h)/2-E,A=_/(y.length+T?1:0);E=Math.min(E,A)}for(var C=0,D=0;D<y.length;D++){var N=y[D],S=void 0===t.sweep?2*Math.PI-2*Math.PI/N.length:t.sweep,k=N.dTheta=S/Math.max(1,N.length-1);if(N.length>1&&t.avoidOverlap){var L=Math.cos(k)-Math.cos(0),P=Math.sin(k)-Math.sin(0),I=Math.sqrt(E*E/(L*L+P*P));C=Math.max(I,C)}N.r=C,C+=E}if(t.equidistant){for(var M=0,O=0,R=0;R<y.length;R++){var B=y[R],F=B.r-O;M=Math.max(M,F)}O=0;for(var z=0;z<y.length;z++){var G=y[z];0===z&&(O=G.r),G.r=O,O+=M}}for(var V={},X=0;X<y.length;X++)for(var Y=y[X],U=Y.dTheta,W=Y.r,j=0;j<Y.length;j++){var H=Y[j],q=t.startAngle+(n?1:-1)*U*j,$={x:s.x+W*Math.cos(q),y:s.y+W*Math.sin(q)};V[H.node.id()]=$}return i.nodes().layoutPositions(this,t,(function(e){var t=e.id();return V[t]})),this};var eh={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){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 th(e){this.options=re({},eh,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges(),r=n.filter((function(e){var n=e.source().data("id"),r=e.target().data("id"),i=t.some((function(e){return e.data("id")===n})),a=t.some((function(e){return e.data("id")===r}));return!i||!a}));this.options.eles=this.options.eles.not(r)}th.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,!0!==e.animate&&!1!==e.animate||n.emit({type:"layoutstart",layout:n}),Zc=!0===e.debug;var r=rh(t,n,e);Zc&&nh(r),e.randomize&&oh(r);var i=pt(),a=function(){lh(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter)&&(uh(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),i=sh(r,e,t);t.layoutPositions(n,e,i)}},l=0,u=!0;if(!0===e.animate){var c=function t(){var n=0;while(u&&n<e.refresh)u=o(l),l++,n++;if(u){var c=pt();c-i>=e.animationThreshold&&a(),dt(t)}else wh(r,e),s()};c()}else{while(u)u=o(l),l++;wh(r,e),s()}return this},th.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},th.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var nh,rh=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=zn(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],h=0;h<c.length;h++){var d=c[h];l[d.id()]=u}for(u=0;u<o.nodeSize;u++){var p=i[u],g=p.layoutDimensions(n),f={};f.isLocked=p.locked(),f.id=p.data("id"),f.parentId=p.data("parent"),f.cmptId=l[p.id()],f.children=[],f.positionX=p.position("x"),f.positionY=p.position("y"),f.offsetX=0,f.offsetY=0,f.height=g.w,f.width=g.h,f.maxX=f.positionX+f.width/2,f.minX=f.positionX-f.width/2,f.maxY=f.positionY+f.height/2,f.minY=f.positionY-f.height/2,f.padLeft=parseFloat(p.style("padding")),f.padRight=parseFloat(p.style("padding")),f.padTop=parseFloat(p.style("padding")),f.padBottom=parseFloat(p.style("padding")),f.nodeRepulsion=A(n.nodeRepulsion)?n.nodeRepulsion(p):n.nodeRepulsion,o.layoutNodes.push(f),o.idToIndex[f.id]=u}var v=[],y=0,m=-1,b=[];for(u=0;u<o.nodeSize;u++){p=o.layoutNodes[u];var x=p.parentId;null!=x?o.layoutNodes[o.idToIndex[x]].children.push(p.id):(v[++m]=p.id,b.push(p.id))}o.graphSet.push(b);while(y<=m){var w=v[y++],E=o.idToIndex[w],T=(d=o.layoutNodes[E],d.children);if(T.length>0){o.graphSet.push(T);for(u=0;u<T.length;u++)v[++m]=T[u]}}for(u=0;u<o.graphSet.length;u++){var _=o.graphSet[u];for(h=0;h<_.length;h++){var C=o.idToIndex[_[h]];o.indexToGraph[C]=u}}for(u=0;u<o.edgeSize;u++){var D=r[u],N={};N.id=D.data("id"),N.sourceId=D.data("source"),N.targetId=D.data("target");var S=A(n.idealEdgeLength)?n.idealEdgeLength(D):n.idealEdgeLength,k=A(n.edgeElasticity)?n.edgeElasticity(D):n.edgeElasticity,L=o.idToIndex[N.sourceId],P=o.idToIndex[N.targetId],I=o.indexToGraph[L],M=o.indexToGraph[P];if(I!=M){var O=ih(N.sourceId,N.targetId,o),R=o.graphSet[O],B=0;f=o.layoutNodes[L];while(-1===R.indexOf(f.id))f=o.layoutNodes[o.idToIndex[f.parentId]],B++;f=o.layoutNodes[P];while(-1===R.indexOf(f.id))f=o.layoutNodes[o.idToIndex[f.parentId]],B++;S*=B*n.nestingFactor}N.idealLength=S,N.elasticity=k,o.layoutEdges.push(N)}return o},ih=function(e,t,n){var r=ah(e,t,0,n);return 2>r.count?0:r.graph},ah=function e(t,n,r,i){var a=i.graphSet[r];if(-1<a.indexOf(t)&&-1<a.indexOf(n))return{count:2,graph:r};for(var o=0,s=0;s<a.length;s++){var l=a[s],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(0!==c.length){var h=i.indexToGraph[i.idToIndex[c[0]]],d=e(t,n,h,i);if(0!==d.count){if(1!==d.count)return d;if(o++,2===o)break}}}return{count:o,graph:r}},oh=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},sh=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach((function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)})),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(t.boundingBox){var s=(o.positionX-i.x1)/i.w,l=(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}return{x:o.positionX,y:o.positionY}}},lh=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=sh(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},uh=function(e,t,n){ch(e,t),fh(e),vh(e,t),yh(e),mh(e)},ch=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];dh(o,l,e,t)}},hh=function(e){return-e+2*e*Math.random()},dh=function(e,t,n,r){var i=e.cmptId,a=t.cmptId;if(i===a||n.isCompound){var o=t.positionX-e.positionX,s=t.positionY-e.positionY,l=1;0===o&&0===s&&(o=hh(l),s=hh(l));var u=ph(e,t,o,s);if(u>0)var c=r.nodeOverlap*u,h=Math.sqrt(o*o+s*s),d=c*o/h,p=c*s/h;else{var g=gh(e,o,s),f=gh(t,-1*o,-1*s),v=f.x-g.x,y=f.y-g.y,m=v*v+y*y;h=Math.sqrt(m),c=(e.nodeRepulsion+t.nodeRepulsion)/m,d=c*v/h,p=c*y/h}e.isLocked||(e.offsetX-=d,e.offsetY-=p),t.isLocked||(t.offsetX+=d,t.offsetY+=p)}},ph=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},gh=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0<n||0===t&&0>n?(u.x=r,u.y=i+a/2,u):0<t&&-1*l<=s&&s<=l?(u.x=r+o/2,u.y=i+o*n/2/t,u):0>t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0<n&&(s<=-1*l||s>=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},fh=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,u=s.positionY-a.positionY;if(0!==l||0!==u){var c=gh(a,l,u),h=gh(s,-1*l,-1*u),d=h.x-c.x,p=h.y-c.y,g=Math.sqrt(d*d+p*p),f=Math.pow(r.idealLength-g,2)/r.elasticity;if(0!==g)var v=f*d/g,y=f*p/g;else v=0,y=0;a.isLocked||(a.offsetX+=v,a.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},vh=function(e,t){if(0!==t.gravity)for(var n=1,r=0;r<e.graphSet.length;r++){var i=e.graphSet[r],a=i.length;if(0===r)var o=e.clientHeight/2,s=e.clientWidth/2;else{var l=e.layoutNodes[e.idToIndex[i[0]]],u=e.layoutNodes[e.idToIndex[l.parentId]];o=u.positionX,s=u.positionY}for(var c=0;c<a;c++){var h=e.layoutNodes[e.idToIndex[i[c]]];if(!h.isLocked){var d=o-h.positionX,p=s-h.positionY,g=Math.sqrt(d*d+p*p);if(g>n){var f=t.gravity*d/g,v=t.gravity*p/g;h.offsetX+=f,h.offsetY+=v}}}}},yh=function(e,t){var n=[],r=0,i=-1;n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;while(r<=i){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,h=0;h<l.length;h++){var d=e.layoutNodes[e.idToIndex[l[h]]];d.offsetX+=u,d.offsetY+=c,n[++i]=l[h]}s.offsetX=0,s.offsetY=0}}},mh=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(n=0;n<e.nodeSize;n++){r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var i=bh(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,xh(r,e)}}for(n=0;n<e.nodeSize;n++){r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},bh=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},xh=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLeft<i.minX)&&(i.minX=t.minX-i.padLeft,a=!0),(null==i.maxY||t.maxY+i.padBottom>i.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTop<i.minY)&&(i.minY=t.minY-i.padTop,a=!0),a?e(i,n):void 0}},wh=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId,s=r[o]=r[o]||[];s.push(a)}var l=0;for(i=0;i<r.length;i++){var u=r[i];if(u){u.x1=1/0,u.x2=-1/0,u.y1=1/0,u.y2=-1/0;for(var c=0;c<u.length;c++){var h=u[c];u.x1=Math.min(u.x1,h.positionX-h.width/2),u.x2=Math.max(u.x2,h.positionX+h.width/2),u.y1=Math.min(u.y1,h.positionY-h.height/2),u.y2=Math.max(u.y2,h.positionY+h.height/2)}u.w=u.x2-u.x1,u.h=u.y2-u.y1,l+=u.w*u.h}}r.sort((function(e,t){return t.w*t.h-e.w*e.h}));var d=0,p=0,g=0,f=0,v=Math.sqrt(l)*e.clientWidth/e.clientHeight;for(i=0;i<r.length;i++){u=r[i];if(u){for(c=0;c<u.length;c++){h=u[c];h.isLocked||(h.positionX+=d-u.x1,h.positionY+=p-u.y1)}d+=u.w+t.componentSpacing,g+=u.w+t.componentSpacing,f=Math.max(f,u.h),g>v&&(p+=f+t.componentSpacing,d=0,g=0,f=0)}}},Eh={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Th(e){this.options=re({},Eh,e)}Th.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=zn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);var t=Math.min(l,u);t==l?l=e:u=e},h=function(e){if(null==e)return Math.max(l,u);var t=Math.max(l,u);t==l?l=e:u=e},d=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=d&&null!=p)l=d,u=p;else if(null!=d&&null==p)l=d,u=Math.ceil(o/l);else if(null==d&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var g=c(),f=h();(g-1)*f>=o?c(g-1):(f-1)*g>=o&&h(f-1)}else while(u*l<o){var v=c(),y=h();(y+1)*v>=o?h(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x<i.length;x++){var w=i[x],E=w._private.position;null!=E.x&&null!=E.y||(E.x=0,E.y=0);var T=w.layoutDimensions(t),_=t.avoidOverlapPadding,A=T.w+_,C=T.h+_;m=Math.max(m,A),b=Math.max(b,C)}for(var D={},N=function(e,t){return!!D["c-"+e+"-"+t]},S=function(e,t){D["c-"+e+"-"+t]=!0},k=0,L=0,P=function(){L++,L>=u&&(L=0,k++)},I={},M=0;M<i.length;M++){var O=i[M],R=t.position(O);if(R&&(void 0!==R.row||void 0!==R.col)){var B={row:R.row,col:R.col};if(void 0===B.col){B.col=0;while(N(B.row,B.col))B.col++}else if(void 0===B.row){B.row=0;while(N(B.row,B.col))B.row++}I[O.id()]=B,S(B.row,B.col)}}var F=function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var i=I[e.id()];if(i)n=i.col*m+m/2+a.x1,r=i.row*b+b/2+a.y1;else{while(N(k,L))P();n=L*m+m/2+a.x1,r=k*b+b/2+a.y1,S(k,L),P()}return{x:n,y:r}};i.layoutPositions(this,t,F)}return this};var _h={ready:function(){},stop:function(){}};function Ah(e){this.options=re({},_h,e)}Ah.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions((function(){return{x:0,y:0}})),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this},Ah.prototype.stop=function(){return this};var Ch={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Dh(e){this.options=re({},Ch,e)}Dh.prototype.run=function(){var e=this.options,t=e.eles,n=t.nodes(),r=A(e.positions);function i(t){if(null==e.positions)return xn(t.position());if(r)return e.positions(t);var n=e.positions[t._private.data.id];return null==n?null:n}return n.layoutPositions(this,e,(function(e,t){var n=i(e);return!e.locked()&&null!=n&&n})),this};var Nh={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Sh(e){this.options=re({},Nh,e)}Sh.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=zn(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),i=function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,i),this};var kh=[{name:"breadthfirst",impl:qc},{name:"circle",impl:Kc},{name:"concentric",impl:Jc},{name:"cose",impl:th},{name:"grid",impl:Th},{name:"null",impl:Ah},{name:"preset",impl:Dh},{name:"random",impl:Sh}];function Lh(e){this.options=e,this.notifications=0}var Ph=function(){},Ih=function(){throw new Error("A headless instance can not render images")};Lh.prototype={recalculateRenderedStyle:Ph,notify:function(){this.notifications++},init:Ph,isHeadless:function(){return!0},png:Ih,jpg:Ih};var Mh={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,u=i.y-n/2-o,c=i.y+n/2+o,h=s<=e&&e<=l&&u<=t&&t<=c;return h},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=e*Math.sin(r)+t*Math.cos(r),s=a*n,l=o*n,u=s+i.x,c=l+i.y;return{x:u,y:c}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(r(s,l,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){_(s)&&(s=e[s]),e[r]=re({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){var l=a(i(this.points,n+2*s,r,o)),u=ar(e,t,l);return u},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:Pt,roughCollide:Pt,draw:Mt,spacing:It,gap:It}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e["triangle"].points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var l=i(this.points,n,a,o),u=this.controlPoint,c=r(u[0],u[1],n,a,o);t.arrowShapeImpl(this.name)(e,l,c)},gap:function(e){return.8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.pointsTee,n+2*l,r,o)),h=ar(e,t,u)||ar(e,t,c);return h},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,l){var u=o,c=Math.pow(u.x-e,2)+Math.pow(u.y-t,2)<=Math.pow((n+2*l)*this.radius,2),h=a(i(this.points,n+2*l,r,o));return ar(e,t,h)||c},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.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(e,t){var n=this.baseCrossLinePts.slice(),r=t/e,i=3,a=5;return n[i]=n[i]-r,n[a]=n[a]-r,n},collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.crossLinePts(n,s),n+2*l,r,o)),h=ar(e,t,u)||ar(e,t,c);return h},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return.525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i,l=Math.pow(s.x-e,2)+Math.pow(s.y-t,2)<=Math.pow((n+2*o)*this.radius,2);return l},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){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(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return.95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})}},Oh={projectIntoViewport:function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),l=n.zoom(),u=((e-i)/o-s.x)/l,c=((t-a)/o-s.y)/l;return[u,c]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},a={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=a.left+a.right,h=t.width/(o+c),d=o-l,p=s-u,g=t.left+i.left+a.left,f=t.top+i.top+a.top;return this.containerBB=[g,f,d,p,h]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},findNearestElements:function(e,t,n,r){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),h=s.cy.hasCompoundNodes(),d=(r?24:8)/c,p=(r?8:2)/c,g=(r?8:2)/c,f=1/0;function v(e,t){if(e.isNode()){if(a)return;a=e,u.push(e)}if(e.isEdge()&&(null==t||t<f))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value)for(var n=0;n<u.length;n++)if(u[n].isEdge()){u[n]=e,i=e,f=null!=t?t:f;break}}else u.push(e),i=e,f=null!=t?t:f}function y(n){var r=n.outerWidth()+2*p,i=n.outerHeight()+2*p,a=r/2,l=i/2,u=n.position(),c="auto"===n.pstyle("corner-radius").value?"auto":n.pstyle("corner-radius").pfValue,h=n._private.rscratch;if(u.x-a<=e&&e<=u.x+a&&u.y-l<=t&&t<=u.y+l){var d=s.nodeShapes[o.getNodeShape(n)];if(d.checkPoint(e,t,0,r,i,u.x,u.y,c,h))return v(n,0),!0}}function m(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,p=l/2+d,g=p*p,f=2*p,m=i.source,b=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var x=a.allpts,w=0;w+3<x.length;w+=2)if(Jn(e,t,x[w],x[w+1],x[w+2],x[w+3],f)&&g>(r=ir(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5<a.allpts.length;w+=4)if(er(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5],f)&&g>(r=rr(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),T=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w<T.length;w++){var _=T[w],A=s.arrowShapes[n.pstyle(_.name+"-arrow-shape").value],C=n.pstyle("width").pfValue;if(A.roughCollide(e,t,E,_.angle,{x:_.x,y:_.y},C,d)&&A.collide(e,t,E,_.angle,{x:_.x,y:_.y},C,d))return v(n),!0}h&&u.length>0&&(y(m),y(b))}function b(e,t,n){return qt(e,t,n)}function x(n,r){var i,a=n._private,o=g;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value,u="yes"===n.pstyle("text-events").strValue;if(u&&l){var c=b(a.rscratch,"labelX",r),h=b(a.rscratch,"labelY",r),d=b(a.rscratch,"labelAngle",r),p=n.pstyle(i+"text-margin-x").pfValue,f=n.pstyle(i+"text-margin-y").pfValue,y=s.x1-o-p,m=s.x2+o-p,x=s.y1-o-f,w=s.y2+o-f;if(d){var E=Math.cos(d),T=Math.sin(d),_=function(e,t){return e-=c,t-=h,{x:e*E-t*T+c,y:e*T+t*E+h}},A=_(y,x),C=_(y,w),D=_(m,x),N=_(m,w),S=[A.x+p,A.y+f,D.x+p,D.y+f,N.x+p,N.y+f,C.x+p,C.y+f];if(ar(e,t,S))return v(n),!0}else if($n(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=o,n=s,t=l,r=u;for(var c=zn({x1:e,y1:t,x2:n,y2:r}),h=0;h<i.length;h++){var d=i[h];if(d.isNode()){var p=d,g=p.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});qn(c,g)&&!Zn(g,c)&&a.push(p)}else{var f=d,v=f._private,y=v.rscratch;if(null!=y.startX&&null!=y.startY&&!$n(c,y.startX,y.startY))continue;if(null!=y.endX&&null!=y.endY&&!$n(c,y.endX,y.endY))continue;if("bezier"===y.edgeType||"multibezier"===y.edgeType||"self"===y.edgeType||"compound"===y.edgeType||"segments"===y.edgeType||"haystack"===y.edgeType){for(var m=v.rstyle.bezierPts||v.rstyle.linePts||v.rstyle.haystackPts,b=!0,x=0;x<m.length;x++)if(!Kn(c,m[x])){b=!1;break}b&&a.push(f)}else"haystack"!==y.edgeType&&"straight"!==y.edgeType||a.push(f)}}return a}},Rh={calculateArrowAngles:function(e){var t,n,r,i,a,o,s=e._private.rscratch,l="haystack"===s.edgeType,u="bezier"===s.edgeType,c="multibezier"===s.edgeType,h="segments"===s.edgeType,d="compound"===s.edgeType,p="self"===s.edgeType;if(l?(r=s.haystackPts[0],i=s.haystackPts[1],a=s.haystackPts[2],o=s.haystackPts[3]):(r=s.arrowStartX,i=s.arrowStartY,a=s.arrowEndX,o=s.arrowEndY),y=s.midX,m=s.midY,h)t=r-s.segpts[0],n=i-s.segpts[1];else if(c||d||p||u){var g=s.allpts,f=On(g[0],g[2],g[4],.1),v=On(g[1],g[3],g[5],.1);t=r-f,n=i-v}else t=r-y,n=i-m;s.srcArrowAngle=Sn(t,n);var y=s.midX,m=s.midY;if(l&&(y=(r+a)/2,m=(i+o)/2),t=a-r,n=o-i,h){g=s.allpts;if(g.length/2%2===0){var b=g.length/2,x=b-2;t=g[b]-g[x],n=g[b+1]-g[x+1]}else if(s.isRound)t=s.midVector[1],n=-s.midVector[0];else{b=g.length/2-1,x=b-2;t=g[b]-g[x],n=g[b+1]-g[x+1]}}else if(c||d||p){g=s.allpts;var w,E,T,_,A=s.ctrlpts;if(A.length/2%2===0){var C=g.length/2-1,D=C+2,N=D+2;w=On(g[C],g[D],g[N],0),E=On(g[C+1],g[D+1],g[N+1],0),T=On(g[C],g[D],g[N],1e-4),_=On(g[C+1],g[D+1],g[N+1],1e-4)}else{D=g.length/2-1,C=D-2,N=D+2;w=On(g[C],g[D],g[N],.4999),E=On(g[C+1],g[D+1],g[N+1],.4999),T=On(g[C],g[D],g[N],.5),_=On(g[C+1],g[D+1],g[N+1],.5)}t=T-w,n=_-E}if(s.midtgtArrowAngle=Sn(t,n),s.midDispX=t,s.midDispY=n,t*=-1,n*=-1,h){g=s.allpts;if(g.length/2%2===0);else if(!s.isRound){b=g.length/2-1;var S=b+2;t=-(g[S]-g[b]),n=-(g[S+1]-g[b+1])}}if(s.midsrcArrowAngle=Sn(t,n),h)t=a-s.segpts[s.segpts.length-2],n=o-s.segpts[s.segpts.length-1];else if(c||d||p||u){g=s.allpts;var k=g.length;f=On(g[k-6],g[k-4],g[k-2],.9),v=On(g[k-5],g[k-3],g[k-1],.9);t=a-f,n=o-v}else t=a-y,n=o-m;s.tgtArrowAngle=Sn(t,n)}};Rh.getArrowWidth=Rh.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r,r)};var Bh,Fh,zh,Gh,Vh,Xh,Yh,Uh,Wh,jh,Hh,qh,$h,Kh,Zh,Qh,Jh,ed={},td={},nd=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},rd=function(e,t){t.x=-1*e.x,t.y=-1*e.y,t.nx=-1*e.nx,t.ny=-1*e.ny,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},id=function(e,t,n,r,i){if(e!==Jh?nd(t,e,ed):rd(td,ed),nd(t,n,td),zh=ed.nx*td.ny-ed.ny*td.nx,Gh=ed.nx*td.nx-ed.ny*-td.ny,Yh=Math.asin(Math.max(-1,Math.min(1,zh))),Math.abs(Yh)<1e-6)return Bh=t.x,Fh=t.y,void(Wh=Hh=0);Vh=1,Xh=!1,Gh<0?Yh<0?Yh=Math.PI+Yh:(Yh=Math.PI-Yh,Vh=-1,Xh=!0):Yh>0&&(Vh=-1,Xh=!0),Hh=void 0!==t.radius?t.radius:r,Uh=Yh/2,qh=Math.min(ed.len/2,td.len/2),i?(jh=Math.abs(Math.cos(Uh)*Hh/Math.sin(Uh)),jh>qh?(jh=qh,Wh=Math.abs(jh*Math.sin(Uh)/Math.cos(Uh))):Wh=Hh):(jh=Math.min(qh,Hh),Wh=Math.abs(jh*Math.sin(Uh)/Math.cos(Uh))),Zh=t.x+td.nx*jh,Qh=t.y+td.ny*jh,Bh=Zh-td.ny*Wh*Vh,Fh=Qh+td.nx*Wh*Vh,$h=t.x+ed.nx*jh,Kh=t.y+ed.ny*jh,Jh=t};function ad(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function od(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(id(e,t,n,r,i),{cx:Bh,cy:Fh,radius:Wh,startX:$h,startY:Kh,stopX:Zh,stopY:Qh,startAngle:ed.ang+Math.PI/2*Vh,endAngle:td.ang-Math.PI/2*Vh,counterClockwise:Xh})}var sd={};function ld(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}sd.findMidptPtsEtc=function(e,t){var n,r=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,s=e.pstyle("source-endpoint"),l=e.pstyle("target-endpoint"),u=null!=s.units&&null!=l.units,c=function(e,t,n,r){var i=r-t,a=n-e,o=Math.sqrt(a*a+i*i);return{x:-i/o,y:a/o}},h=e.pstyle("edge-distances").value;switch(h){case"node-position":n=r;break;case"intersection":n=i;break;case"endpoints":if(u){var d=this.manualEndptToPx(e.source()[0],s),p=o(d,2),g=p[0],f=p[1],v=this.manualEndptToPx(e.target()[0],l),y=o(v,2),m=y[0],b=y[1],x={x1:g,y1:f,x2:m,y2:b};a=c(g,f,m,b),n=x}else Bt("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),n=i;break}return{midptPts:n,vectorNormInverse:a}},sd.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=2*Math.random()*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,l=o.position(),u=s.position(),c=o.width(),h=s.width(),d=o.height(),p=s.height(),g=n.pstyle("haystack-radius").value,f=g/2;i.haystackPts=i.allpts=[i.source.x*c*f+l.x,i.source.y*d*f+l.y,i.target.x*h*f+u.x,i.target.y*p*f+u.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},sd.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(r.pfValue.length,i.pfValue.length),l=a.pfValue[a.pfValue.length-1],u=o.pfValue[o.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var c=0;c<s;c++){var h=r.pfValue[c],d=i.pfValue[c],p=1-h,g=h,f=this.findMidptPtsEtc(e,t),v=f.midptPts,y=f.vectorNormInverse,m={x:v.x1*p+v.x2*g,y:v.y1*p+v.y2*g};n.segpts.push(m.x+y.x*d,m.y+y.y*d),n.radii.push(void 0!==a.pfValue[c]?a.pfValue[c]:l),n.isArcRadius.push("arc-radius"===(void 0!==o.pfValue[c]?o.pfValue[c]:u))}},sd.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var d=n,p=h;r&&(d=0,p=l);var g=u-Math.PI/2,f=g-c/2,v=g+c/2,y=String(u+"_"+c);d=void 0===a[y]?a[y]=0:++a[y],i.ctrlpts=[o.x+1.4*Math.cos(f)*p*(d/3+1),o.y+1.4*Math.sin(f)*p*(d/3+1),o.x+1.4*Math.cos(v)*p*(d/3+1),o.y+1.4*Math.sin(v)*p*(d/3+1)]},sd.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),p=d?d.pfValue[0]:void 0,g=n,f=h;r&&(g=0,f=p);var v=50,y={x:a.x-s/2,y:a.y-l/2},m={x:o.x-u/2,y:o.y-c/2},b={x:Math.min(y.x,m.x),y:Math.min(y.y,m.y)},x=.5,w=Math.max(x,Math.log(.01*s)),E=Math.max(x,Math.log(.01*u));i.ctrlpts=[b.x,b.y-(1+Math.pow(v,1.12)/100)*f*(g/3+1)*w,b.x-(1+Math.pow(v,1.12)/100)*f*(g/3+1)*E,b.y]},sd.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},sd.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,c=s?s.pfValue[0]:void 0,h=l.value[0],d=r;a.edgeType=d?"multibezier":"bezier",a.ctrlpts=[];for(var p=0;p<u;p++){var g=(.5-t.eles.length/2+n)*o*(i?-1:1),f=void 0,v=Ln(g);d&&(c=s?s.pfValue[p]:o,h=l.value[p]),f=r?c:void 0!==c?v*c:void 0;var y=void 0!==f?f:g,m=1-h,b=h,x=this.findMidptPtsEtc(e,t),w=x.midptPts,E=x.vectorNormInverse,T={x:w.x1*m+w.x2*b,y:w.y1*m+w.y2*b};a.ctrlpts.push(T.x+E.x*y,T.y+E.y*y)}},sd.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",i="horizontal",a="leftward",o="rightward",s="downward",l="upward",u="auto",c=t.posPts,h=t.srcW,d=t.srcH,p=t.tgtW,g=t.tgtH,f=e.pstyle("edge-distances").value,v="node-position"!==f,y=e.pstyle("taxi-direction").value,m=y,b=e.pstyle("taxi-turn"),x="%"===b.units,w=b.pfValue,E=w<0,T=e.pstyle("taxi-turn-min-distance").pfValue,_=v?(h+p)/2:0,A=v?(d+g)/2:0,C=c.x2-c.x1,D=c.y2-c.y1,N=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},S=N(C,_),k=N(D,A),L=!1;m===u?y=Math.abs(S)>Math.abs(k)?i:r:m===l||m===s?(y=r,L=!0):m!==a&&m!==o||(y=i,L=!0);var P,I=y===r,M=I?k:S,O=I?D:C,R=Ln(O),B=!1;if(L&&(x||E)||!(m===s&&O<0||m===l&&O>0||m===a&&O>0||m===o&&O<0)||(R*=-1,M=R*Math.abs(M),B=!0),x){var F=w<0?1+w:w;P=F*M}else{var z=w<0?M:0;P=z+w*R}var G=function(e){return Math.abs(e)<T||Math.abs(e)>=Math.abs(M)},V=G(P),X=G(Math.abs(M)-Math.abs(P)),Y=V||X;if(Y&&!B)if(I){var U=Math.abs(O)<=d/2,W=Math.abs(C)<=p/2;if(U){var j=(c.x1+c.x2)/2,H=c.y1,q=c.y2;n.segpts=[j,H,j,q]}else if(W){var $=(c.y1+c.y2)/2,K=c.x1,Z=c.x2;n.segpts=[K,$,Z,$]}else n.segpts=[c.x1,c.y2]}else{var Q=Math.abs(O)<=h/2,J=Math.abs(D)<=g/2;if(Q){var ee=(c.y1+c.y2)/2,te=c.x1,ne=c.x2;n.segpts=[te,ee,ne,ee]}else if(J){var re=(c.x1+c.x2)/2,ie=c.y1,ae=c.y2;n.segpts=[re,ie,re,ae]}else n.segpts=[c.x2,c.y1]}else if(I){var oe=c.y1+P+(v?d/2*R:0),se=c.x1,le=c.x2;n.segpts=[se,oe,le,oe]}else{var ue=c.x1+P+(v?h/2*R:0),ce=c.y1,he=c.y2;n.segpts=[ue,ce,ue,he]}if(n.isRound){var de=e.pstyle("taxi-radius").value,pe="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(de),n.isArcRadius=new Array(n.segpts.length/2).fill(pe)}},sd.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=t.srcCornerRadius,d=t.tgtCornerRadius,p=t.srcRs,g=t.tgtRs,f=!S(n.startX)||!S(n.startY),v=!S(n.arrowStartX)||!S(n.arrowStartY),y=!S(n.endX)||!S(n.endY),m=!S(n.arrowEndX)||!S(n.arrowEndY),b=3,x=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,w=b*x,E=Pn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),T=E<w,_=Pn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),A=_<w,C=!1;if(f||v||T){C=!0;var D={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},N=Math.sqrt(D.x*D.x+D.y*D.y),k={x:D.x/N,y:D.y/N},L=Math.max(a,o),P={x:n.ctrlpts[0]+2*k.x*L,y:n.ctrlpts[1]+2*k.y*L},I=u.intersectLine(r.x,r.y,a,o,P.x,P.y,0,h,p);T?(n.ctrlpts[0]=n.ctrlpts[0]+k.x*(w-E),n.ctrlpts[1]=n.ctrlpts[1]+k.y*(w-E)):(n.ctrlpts[0]=I[0]+k.x*w,n.ctrlpts[1]=I[1]+k.y*w)}if(y||m||A){C=!0;var M={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},O=Math.sqrt(M.x*M.x+M.y*M.y),R={x:M.x/O,y:M.y/O},B=Math.max(a,o),F={x:n.ctrlpts[0]+2*R.x*B,y:n.ctrlpts[1]+2*R.y*B},z=c.intersectLine(i.x,i.y,s,l,F.x,F.y,0,d,g);A?(n.ctrlpts[0]=n.ctrlpts[0]+R.x*(w-_),n.ctrlpts[1]=n.ctrlpts[1]+R.y*(w-_)):(n.ctrlpts[0]=z[0]+R.x*w,n.ctrlpts[1]=z[1]+R.y*w)}C&&this.findEndpoints(e)}},sd.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);var r,i;t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2===0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,i=.5,t.midX=On(t.allpts[r],t.allpts[r+2],t.allpts[r+4],i),t.midY=On(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],i))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var o=t.radii[a/2-1],s=t.isArcRadius[a/2-1];t.roundCorners.push(od({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:o},{x:t.allpts[a+2],y:t.allpts[a+3]},o,s))}}if(t.segpts.length%4===0){var l=t.segpts.length/2,u=l-2;t.midX=(t.segpts[u]+t.segpts[l])/2,t.midY=(t.segpts[u+1]+t.segpts[l+1])/2}else{var c=t.segpts.length/2-1;if(t.isRound){var h={x:t.segpts[c],y:t.segpts[c+1]},d=t.roundCorners[c/2],p=[h.x-d.cx,h.y-d.cy],g=d.radius/Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2));p=p.map((function(e){return e*g})),t.midX=d.cx+p[0],t.midY=d.cy+p[1],t.midVector=p}else t.midX=t.segpts[c],t.midY=t.segpts[c+1]}}},sd.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||S(t.startX)&&S(t.startY)&&S(t.endX)&&S(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Bt("Edge `"+e.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."))},sd.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy,i=r.hasCompoundNodes(),a={map:new Zt,get:function(e){var t=this.map.get(e[0]);return null!=t?t.get(e[1]):null},set:function(e,t){var n=this.map.get(e[0]);null==n&&(n=new Zt,this.map.set(e[0],n)),n.set(e[1],t)}},o=[],s=[],l=0;l<e.length;l++){var u=e[l],c=u._private,h=u.pstyle("curve-style").value;if(!u.removed()&&u.takesUpSpace())if("haystack"!==h){var d="unbundled-bezier"===h||h.endsWith("segments")||"straight"===h||"straight-triangle"===h||h.endsWith("taxi"),p="unbundled-bezier"===h||"bezier"===h,g=c.source,f=c.target,v=g.poolIndex(),y=f.poolIndex(),m=[v,y].sort(),b=a.get(m);null==b&&(b={eles:[]},a.set(m,b),o.push(m)),b.eles.push(u),d&&(b.hasUnbundled=!0),p&&(b.hasBezier=!0)}else s.push(u)}for(var x=function(e){var r=o[e],s=a.get(r),l=void 0;if(!s.hasUnbundled){var u=s.eles[0].parallelEdges().filter((function(e){return e.isBundledBezier()}));jt(s.eles),u.forEach((function(e){return s.eles.push(e)})),s.eles.sort((function(e,t){return e.poolIndex()-t.poolIndex()}))}var c=s.eles[0],h=c.source(),d=c.target();if(h.poolIndex()>d.poolIndex()){var p=h;h=d,d=p}var g=s.srcPos=h.position(),f=s.tgtPos=d.position(),v=s.srcW=h.outerWidth(),y=s.srcH=h.outerHeight(),m=s.tgtW=d.outerWidth(),b=s.tgtH=d.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(h)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(d)],E=s.srcCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,T=s.tgtCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,_=s.tgtRs=d._private.rscratch,A=s.srcRs=h._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var C=0;C<s.eles.length;C++){var D=s.eles[C],N=D[0]._private.rscratch,k=D.pstyle("curve-style").value,L="unbundled-bezier"===k||k.endsWith("segments")||k.endsWith("taxi"),P=!h.same(D.source());if(!s.calculatedIntersection&&h!==d&&(s.hasBezier||s.hasUnbundled)){s.calculatedIntersection=!0;var I=x.intersectLine(g.x,g.y,v,y,f.x,f.y,0,E,A),M=s.srcIntn=I,O=w.intersectLine(f.x,f.y,m,b,g.x,g.y,0,T,_),R=s.tgtIntn=O,B=s.intersectionPts={x1:I[0],x2:O[0],y1:I[1],y2:O[1]},F=s.posPts={x1:g.x,x2:f.x,y1:g.y,y2:f.y},z=O[1]-I[1],G=O[0]-I[0],V=Math.sqrt(G*G+z*z),X=s.vector={x:G,y:z},Y=s.vectorNorm={x:X.x/V,y:X.y/V},U={x:-Y.y,y:Y.x};s.nodesOverlap=!S(V)||w.checkPoint(I[0],I[1],0,m,b,f.x,f.y,T,_)||x.checkPoint(O[0],O[1],0,v,y,g.x,g.y,E,A),s.vectorNormInverse=U,l={nodesOverlap:s.nodesOverlap,dirCounts:s.dirCounts,calculatedIntersection:!0,hasBezier:s.hasBezier,hasUnbundled:s.hasUnbundled,eles:s.eles,srcPos:f,srcRs:_,tgtPos:g,tgtRs:A,srcW:m,srcH:b,tgtW:v,tgtH:y,srcIntn:R,tgtIntn:M,srcShape:w,tgtShape:x,posPts:{x1:F.x2,y1:F.y2,x2:F.x1,y2:F.y1},intersectionPts:{x1:B.x2,y1:B.y2,x2:B.x1,y2:B.y1},vector:{x:-X.x,y:-X.y},vectorNorm:{x:-Y.x,y:-Y.y},vectorNormInverse:{x:-U.x,y:-U.y}}}var W=P?l:s;N.nodesOverlap=W.nodesOverlap,N.srcIntn=W.srcIntn,N.tgtIntn=W.tgtIntn,N.isRound=k.startsWith("round"),i&&(h.isParent()||h.isChild()||d.isParent()||d.isChild())&&(h.parents().anySame(d)||d.parents().anySame(h)||h.same(d)&&h.isParent())?t.findCompoundLoopPoints(D,W,C,L):h===d?t.findLoopPoints(D,W,C,L):k.endsWith("segments")?t.findSegmentsPoints(D,W):k.endsWith("taxi")?t.findTaxiPoints(D,W):"straight"===k||!L&&s.eles.length%2===1&&C===Math.floor(s.eles.length/2)?t.findStraightEdgePoints(D):t.findBezierPoints(D,W,C,L,P),t.findEndpoints(D),t.tryToCorrectInvalidPoints(D,W),t.checkForInvalidEdgeWarning(D),t.storeAllpts(D),t.storeEdgeProjections(D),t.calculateArrowAngles(D),t.recalculateEdgeLabelProjections(D),t.calculateLabelAngles(D)}},w=0;w<o.length;w++)x(w);this.findHaystackPoints(s)}},sd.getSegmentPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if("segments"===n)return ld(t.segpts)},sd.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return ld(t.ctrlpts)},sd.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var ud={manualEndptToPx:function(e,t){var n=this,r=e.position(),i=e.outerWidth(),a=e.outerHeight(),o=e._private.rscratch;if(2===t.value.length){var s=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(s[0]=s[0]*i),"%"===t.units[1]&&(s[1]=s[1]*a),s[0]+=r.x,s[1]+=r.y,s}var l=t.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(i,a),c=[r.x+Math.cos(l)*u,r.y+Math.sin(l)*u];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,a,c[0],c[1],0,"auto"===e.pstyle("corner-radius").value?"auto":e.pstyle("corner-radius").pfValue,o)},findEndpoints:function(e){var t,n,r,i,a,o=this,s=e.source()[0],l=e.target()[0],u=s.position(),c=l.position(),h=e.pstyle("target-arrow-shape").value,d=e.pstyle("source-arrow-shape").value,p=e.pstyle("target-distance-from-node").pfValue,g=e.pstyle("source-distance-from-node").pfValue,f=s._private.rscratch,v=l._private.rscratch,y=e.pstyle("curve-style").value,m=e._private.rscratch,b=m.edgeType,x="taxi"===y,w="self"===b||"compound"===b,E="bezier"===b||"multibezier"===b||w,T="bezier"!==b,_="straight"===b||"segments"===b,A="segments"===b,C=E||T||_,D=w||x,N=e.pstyle("source-endpoint"),k=D?"outside-to-node":N.value,L="auto"===s.pstyle("corner-radius").value?"auto":s.pstyle("corner-radius").pfValue,P=e.pstyle("target-endpoint"),I=D?"outside-to-node":P.value,M="auto"===l.pstyle("corner-radius").value?"auto":l.pstyle("corner-radius").pfValue;if(m.srcManEndpt=N,m.tgtManEndpt=P,E){var O=[m.ctrlpts[0],m.ctrlpts[1]],R=T?[m.ctrlpts[m.ctrlpts.length-2],m.ctrlpts[m.ctrlpts.length-1]]:O;n=R,r=O}else if(_){var B=A?m.segpts.slice(0,2):[c.x,c.y],F=A?m.segpts.slice(m.segpts.length-2):[u.x,u.y];n=F,r=B}if("inside-to-node"===I)t=[c.x,c.y];else if(P.units)t=this.manualEndptToPx(l,P);else if("outside-to-line"===I)t=m.tgtIntn;else if("outside-to-node"===I||"outside-to-node-or-label"===I?i=n:"outside-to-line"!==I&&"outside-to-line-or-label"!==I||(i=[u.x,u.y]),t=o.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),i[0],i[1],0,M,v),"outside-to-node-or-label"===I||"outside-to-line-or-label"===I){var z=l._private.rscratch,G=z.labelWidth,V=z.labelHeight,X=z.labelX,Y=z.labelY,U=G/2,W=V/2,j=l.pstyle("text-valign").value;"top"===j?Y-=W:"bottom"===j&&(Y+=W);var H=l.pstyle("text-halign").value;"left"===H?X-=U:"right"===H&&(X+=U);var q=fr(i[0],i[1],[X-U,Y-W,X+U,Y-W,X+U,Y+W,X-U,Y+W],c.x,c.y);if(q.length>0){var $=u,K=In($,Tn(t)),Z=In($,Tn(q)),Q=K;if(Z<K&&(t=q,Q=Z),q.length>2){var J=In($,{x:q[2],y:q[3]});J<Q&&(t=[q[2],q[3]])}}}var ee=yr(t,n,o.arrowShapes[h].spacing(e)+p),te=yr(t,n,o.arrowShapes[h].gap(e)+p);if(m.endX=te[0],m.endY=te[1],m.arrowEndX=ee[0],m.arrowEndY=ee[1],"inside-to-node"===k)t=[u.x,u.y];else if(N.units)t=this.manualEndptToPx(s,N);else if("outside-to-line"===k)t=m.srcIntn;else if("outside-to-node"===k||"outside-to-node-or-label"===k?a=r:"outside-to-line"!==k&&"outside-to-line-or-label"!==k||(a=[c.x,c.y]),t=o.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),a[0],a[1],0,L,f),"outside-to-node-or-label"===k||"outside-to-line-or-label"===k){var ne=s._private.rscratch,re=ne.labelWidth,ie=ne.labelHeight,ae=ne.labelX,oe=ne.labelY,se=re/2,le=ie/2,ue=s.pstyle("text-valign").value;"top"===ue?oe-=le:"bottom"===ue&&(oe+=le);var ce=s.pstyle("text-halign").value;"left"===ce?ae-=se:"right"===ce&&(ae+=se);var he=fr(a[0],a[1],[ae-se,oe-le,ae+se,oe-le,ae+se,oe+le,ae-se,oe+le],u.x,u.y);if(he.length>0){var de=c,pe=In(de,Tn(t)),ge=In(de,Tn(he)),fe=pe;if(ge<pe&&(t=[he[0],he[1]],fe=ge),he.length>2){var ve=In(de,{x:he[2],y:he[3]});ve<fe&&(t=[he[2],he[3]])}}}var ye=yr(t,r,o.arrowShapes[d].spacing(e)+g),me=yr(t,r,o.arrowShapes[d].gap(e)+g);m.startX=me[0],m.startY=me[1],m.arrowStartX=ye[0],m.arrowStartY=ye[1],C&&(S(m.startX)&&S(m.startY)&&S(m.endX)&&S(m.endY)?m.badLine=!1:m.badLine=!0)},getSourceEndpoint:function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},getTargetEndpoint:function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}}},cd={};function hd(e,t,n){for(var r=function(e,t,n,r){return On(e,t,n,r)},i=t._private,a=i.rstyle.bezierPts,o=0;o<e.bezierProjPcts.length;o++){var s=e.bezierProjPcts[o];a.push({x:r(n[0],n[2],n[4],s),y:r(n[1],n[3],n[5],s)})}}cd.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)hd(this,e,n.allpts.slice(i,i+6))}else if("segments"===r){var a=t.rstyle.linePts=[];for(i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]})}else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},cd.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var dd={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!F(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,h=i.rscratch,d=i.rstyle;switch(u){case"left":n=l.x-a/2-s;break;case"right":n=l.x+a/2+s;break;default:n=l.x}switch(c){case"top":r=l.y-o/2-s;break;case"bottom":r=l.y+o/2+s;break;default:r=l.y}h.labelX=n,h.labelY=r,d.labelX=n,d.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}}},pd=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},gd=function(e,t){var n=t.x-e.x,r=t.y-e.y;return pd(n,r)},fd=function(e,t,n,r){var i=Fn(0,r-.001,1),a=Fn(0,r+.001,1),o=Rn(e,t,n,i),s=Rn(e,t,n,a);return gd(o,s)};dd.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){$t(n.rscratch,e,t,r),$t(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y);var s=pd(r.midDispX,r.midDispY);o("labelAutoAngle",null,s);var l=function e(){if(e.cache)return e.cache;for(var t=[],a=0;a+5<r.allpts.length;a+=4){var o={x:r.allpts[a],y:r.allpts[a+1]},s={x:r.allpts[a+2],y:r.allpts[a+3]},l={x:r.allpts[a+4],y:r.allpts[a+5]};t.push({p0:o,p1:s,p2:l,startDist:0,length:0,segments:[]})}var u=n.rstyle.bezierPts,c=i.bezierProjPcts.length;function h(e,t,n,r,i){var a=Pn(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var d=0;d<t.length;d++){var p=t[d],g=t[d-1];g&&(p.startDist=g.startDist+g.length),h(p,p.p0,u[d*c],0,i.bezierProjPcts[0]);for(var f=0;f<c-1;f++)h(p,u[d*c+f],u[d*c+f+1],i.bezierProjPcts[f],i.bezierProjPcts[f+1]);h(p,u[d*c+c-1],p.p2,i.bezierProjPcts[c-1],1)}return e.cache=t},u=function(n){var i,s="source"===n;if(a[n]){var u=e.pstyle(n+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var c,h=l(),d=0,p=0,g=0;g<h.length;g++){for(var f=h[s?g:h.length-1-g],v=0;v<f.segments.length;v++){var y=f.segments[s?v:f.segments.length-1-v],m=g===h.length-1&&v===f.segments.length-1;if(d=p,p+=y.length,p>=u||m){c={cp:f,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-d)/x.length,E=x.t1-x.t0,T=s?x.t0+E*w:x.t1-E*w;T=Fn(0,T,1),t=Rn(b.p0,b.p1,b.p2,T),i=fd(b.p0,b.p1,b.p2,T);break;case"straight":case"segments":case"haystack":for(var _,A,C,D,N=0,S=r.allpts.length,k=0;k+3<S;k+=2)if(s?(C={x:r.allpts[k],y:r.allpts[k+1]},D={x:r.allpts[k+2],y:r.allpts[k+3]}):(C={x:r.allpts[S-2-k],y:r.allpts[S-1-k]},D={x:r.allpts[S-4-k],y:r.allpts[S-3-k]}),_=Pn(C,D),A=N,N+=_,N>=u)break;var L=u-A,P=L/_;P=Fn(0,P,1),t=Bn(C,D,P),i=gd(C,D);break}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,i)}};u("source"),u("target"),this.applyLabelDimensions(e)}},dd.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},dd.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=qt(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,h=i.width,d=i.height+(l-1)*(a-1)*u;$t(n.rstyle,"labelWidth",t,h),$t(n.rscratch,"labelWidth",t,h),$t(n.rstyle,"labelHeight",t,d),$t(n.rscratch,"labelHeight",t,d),$t(n.rscratch,"labelLineHeight",t,c)},dd.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?($t(n.rscratch,e,t,r),r):qt(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="",c=i.split("\n"),h=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value,p="anywhere"===d,g=[],f=/[\s\u200b]+|$/g,y=0;y<c.length;y++){var m=c[y],b=this.calculateLabelDimensions(e,m),x=b.width;if(p){var w=m.split("").join(u);m=w}if(x>h){var E,T=m.matchAll(f),_="",A=0,C=v(T);try{for(C.s();!(E=C.n()).done;){var D=E.value,N=D[0],S=m.substring(A,D.index);A=D.index+N.length;var k=0===_.length?S:_+S+N,L=this.calculateLabelDimensions(e,k),P=L.width;P<=h?_+=S+N:(_&&g.push(_),_=S+N)}}catch(z){C.e(z)}finally{C.f()}_.match(/^[\s\u200b]+$/)||g.push(_)}else g.push(m)}o("labelWrapCachedLines",g),i=o("labelWrapCachedText",g.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var I=e.pstyle("text-max-width").pfValue,M="",O="…",R=!1;if(this.calculateLabelDimensions(e,i).width<I)return i;for(var B=0;B<i.length;B++){var F=this.calculateLabelDimensions(e,M+i[B]+O).width;if(F>I)break;M+=i[B],B===i.length-1&&(R=!0)}return R||(M+=O),M}return i},dd.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},dd.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window(),i=r.document,a=_t(t,e._private.labelDimsKey),o=n.labelDimCache||(n.labelDimCache=[]),s=o[a];if(null!=s)return s;var l=0,u=e.pstyle("font-style").strValue,c=e.pstyle("font-size").pfValue,h=e.pstyle("font-family").strValue,d=e.pstyle("font-weight").strValue,p=this.labelCalcCanvas,g=this.labelCalcCanvasContext;if(!p){p=this.labelCalcCanvas=i.createElement("canvas"),g=this.labelCalcCanvasContext=p.getContext("2d");var f=p.style;f.position="absolute",f.left="-9999px",f.top="-9999px",f.zIndex="-1",f.visibility="hidden",f.pointerEvents="none"}g.font="".concat(u," ").concat(d," ").concat(c,"px ").concat(h);for(var v=0,y=0,m=t.split("\n"),b=0;b<m.length;b++){var x=m[b],w=g.measureText(x),E=Math.ceil(w.width),T=c;v=Math.max(E,v),y+=T}return v+=l,y+=l,o[a]={width:v,height:y}},dd.calculateLabelAngle=function(e,t){var n=e._private,r=n.rscratch,i=e.isEdge(),a=t?t+"-":"",o=e.pstyle(a+"text-rotation"),s=o.strValue;return"none"===s?0:i&&"autorotate"===s?r.labelAutoAngle:"autorotate"===s?0:o.pfValue},dd.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private,i=r.rscratch;i.labelAngle=t.calculateLabelAngle(e),n&&(i.sourceLabelAngle=t.calculateLabelAngle(e,"source"),i.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var vd={},yd=28,md=!1;vd.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if("cutrectangle"===n&&(e.width()<yd||e.height()<yd))return md||(Bt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),md=!0),"rectangle";if(e.isParent())return"rectangle"===n||"roundrectangle"===n||"round-rectangle"===n||"cutrectangle"===n||"cut-rectangle"===n||"barrel"===n?n:"rectangle";if("polygon"===n){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var bd={registerCalculationListeners:function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r],a=i._private,o=a.rstyle;o.clean=!1,o.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",(function(e){var t=e.target;r(t)})).on("style.* background.*",(function(e){var t=e.target;r(t,!1)}));var i=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(r(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var u=0;u<a.length;u++){var c=a[u];c(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)},recalculateRenderedStyle:function(e,t){var n=function(e){return e._private.rstyle.cleanConnected},r=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?i.push(o):r.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private,d=h.rstyle,p=c.position();this.recalculateNodeLabelProjection(c),d.nodeX=p.x,d.nodeY=p.y,d.nodeW=c.pstyle("width").pfValue,d.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var g=0;g<r.length;g++){var f=r[g],v=f._private,y=v.rstyle,m=v.rscratch;y.srcX=m.arrowStartX,y.srcY=m.arrowStartY,y.tgtX=m.arrowEndX,y.tgtY=m.arrowEndY,y.midX=m.midX,y.midY=m.midY,y.labelAngle=m.labelAngle,y.sourceLabelAngle=m.sourceLabelAngle,y.targetLabelAngle=m.targetLabelAngle}}}},xd={updateCachedGrabbedEles:function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(n=0;n<t.length;n++){r=t[n];e.drag.push(r)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(ku),t.interactive=t.filter((function(e){return e.interactive()})),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t}},wd={};[Oh,Rh,sd,ud,cd,dd,vd,bd,xd].forEach((function(e){re(wd,e)}));var Ed={getCachedImage:function(e,t,n){var r=this,i=r.imageCache=r.imageCache||{},a=i[e];if(a)return a.image.complete||a.image.addEventListener("load",n),a.image;a=i[e]=i[e]||{};var o=a.image=new Image;o.addEventListener("load",n),o.addEventListener("error",(function(){o.error=!0}));var s="data:",l=e.substring(0,s.length).toLowerCase()===s;return l||(t="null"===t?null:t,o.crossOrigin=t),o.src=e,o}},Td={registerBinding:function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(void 0!==s){var l=this.binder(s);a.push(l.on.apply(l,i))}}return a}l=this.binder(e);return l.on.apply(l,i)},binder:function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||z(e);if(null==t.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});n.addEventListener("test",null,a)}catch(s){}t.supportsPassiveEvents=i}var o=function(n,i,a){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},nodeIsDraggable:function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},nodeIsGrabbable:function(e){return this.nodeIsDraggable(e)&&e.interactive()},load:function(){var e=this,t=e.cy.window(),n=function(e){return e.selected()},r=function(e){var t=e.getRootNode();if(t&&11===t.nodeType&&void 0!==t.host)return t},i=function(t,n,r,i){null==t&&(t=e.cy);for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},a=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},o=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable())for(var i=0;n&&i<n.length;i++){t=n[i];if(t.isNode()&&t.isParent()&&!t.pannable()){r=!1;break}}else r=!0;return r},s=function(e){e[0]._private.grabbed=!0},l=function(e){e[0]._private.grabbed=!1},u=function(e){e[0]._private.rscratch.inDragLayer=!0},c=function(e){e[0]._private.rscratch.inDragLayer=!1},h=function(e){e[0]._private.rscratch.isGrabTarget=!0},d=function(e){e[0]._private.rscratch.isGrabTarget=!1},p=function(e,t){var n=t.addToList,r=n.has(e);r||!e.grabbable()||e.locked()||(n.merge(e),s(e))},g=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(u),n.connectedEdges().forEach(u)),t.addToList&&p(n,t)}},f=function(t,n){n=n||{};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(u),t.neighborhood().stdFilter((function(e){return!r||e.isEdge()})).forEach(u)),n.addToList&&t.forEach((function(e){p(e,n)})),g(t,n),m(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},v=f,y=function(t){t&&(e.getCachedZSortedEles().forEach((function(e){l(e),c(e),d(e)})),e.updateCachedGrabbedEles())},m=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(u),r.forEach(u)),t.addToList&&r.forEach((function(e){p(e,t)}))}}},b=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},x="undefined"!==typeof MutationObserver,w="undefined"!==typeof ResizeObserver;x?(e.removeObserver=new MutationObserver((function(t){for(var n=0;n<t.length;n++){var r=t[n],i=r.removedNodes;if(i)for(var a=0;a<i.length;a++){var o=i[a];if(o===e.container){e.destroy();break}}}})),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",(function(t){e.destroy()}));var E=lt((function(){e.cy.resize()}),100);x&&(e.styleObserver=new MutationObserver(E),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",E),w&&(e.resizeObserver=new ResizeObserver(E),e.resizeObserver.observe(e.container));var T=function(e,t){while(null!=e)t(e),e=e.parentNode},_=function(){e.invalidateContainerClientCoordsCache()};T(e.container,(function(t){e.registerBinding(t,"transitionend",_),e.registerBinding(t,"animationend",_),e.registerBinding(t,"scroll",_)})),e.registerBinding(e.container,"contextmenu",(function(e){e.preventDefault()}));var A=function(){return 0!==e.selection[4]},C=function(t){for(var n=e.findContainerClientCoords(),r=n[0],i=n[1],a=n[2],o=n[3],s=t.touches?t.touches:[t],l=!1,u=0;u<s.length;u++){var c=s[u];if(r<=c.clientX&&c.clientX<=r+a&&i<=c.clientY&&c.clientY<=i+o){l=!0;break}}if(!l)return!1;var h=e.container,d=t.target,p=d.parentNode,g=!1;while(p){if(p===h){g=!0;break}p=p.parentNode}return!!g};e.registerBinding(e.container,"mousedown",(function(t){if(C(t)&&(1!==e.hoverData.which||1===t.which)){t.preventDefault(),b(),e.hoverData.capture=!0,e.hoverData.which=t.which;var n=e.cy,r=[t.clientX,t.clientY],a=e.projectIntoViewport(r[0],r[1]),o=e.selection,s=e.findNearestElements(a[0],a[1],!0,!1),l=s[0],u=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=r;var c=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout((function(){if(!e.hoverData.tapholdCancelled){var r=e.hoverData.down;r?r.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}}):n.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}})}}),e.tapholdDuration)};if(3==t.which){e.hoverData.cxtStarted=!0;var d={originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}};l?(l.activate(),l.emit(d),e.hoverData.down=l):n.emit(d),e.hoverData.downTime=(new Date).getTime(),e.hoverData.cxtDragged=!1}else if(1==t.which){if(l&&l.activate(),null!=l&&e.nodeIsGrabbable(l)){var p=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}},g=function(e){e.emit(p("grab"))};if(h(l),l.selected()){u=e.dragData.possibleDragElements=n.collection();var y=n.$((function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)}));f(y,{addToList:u}),l.emit(p("grabon")),y.forEach(g)}else u=e.dragData.possibleDragElements=n.collection(),v(l,{addToList:u}),l.emit(p("grabon")).emit(p("grab"));e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=l,e.hoverData.downs=s,e.hoverData.downTime=(new Date).getTime(),i(l,["mousedown","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==l?(o[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint("select",!0),e.redraw()):l.pannable()&&(o[4]=1),c()}o[0]=o[2]=a[0],o[1]=o[3]=a[1]}}),!1);var D,N,k,L=r(e.container);e.registerBinding([t,L],"mousemove",(function(t){var n=e.hoverData.capture;if(n||C(t)){var r=!1,s=e.cy,l=s.zoom(),u=[t.clientX,t.clientY],c=e.projectIntoViewport(u[0],u[1]),h=e.hoverData.mdownPos,d=e.hoverData.mdownGPos,p=e.selection,g=null;e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.selecting||(g=e.findNearestElement(c[0],c[1],!0,!1));var v,m=e.hoverData.last,b=e.hoverData.down,x=[c[0]-p[2],c[1]-p[3]],w=e.dragData.possibleDragElements;if(d){var E=u[0]-d[0],T=E*E,_=u[1]-d[1],A=_*_,D=T+A;e.hoverData.isOverThresholdDrag=v=D>=e.desktopTapThreshold2}var N=a(t);v&&(e.hoverData.tapholdCancelled=!0);var k=function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(x[0]),t.push(x[1])):(t[0]+=x[0],t[1]+=x[1])};r=!0,i(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var L=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||s.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var P={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};b?b.emit(P):s.emit(P),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(r=!0,s.panningEnabled()&&s.userPanningEnabled()){var I;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;I={x:(c[0]-M[0])*l,y:(c[1]-M[1])*l},e.hoverData.justStartedPan=!1}else I={x:x[0]*l,y:x[1]*l};s.panBy(I),s.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||g==m||(m&&i(m,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&i(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),b)if(v){if(s.boxSelectionEnabled()&&N)b&&b.grabbed()&&(y(w),b.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(b.emit("dragfreeon"),w.emit("dragfree"))),L();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var O=!e.dragData.didDrag;O&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||f(w,{inDragLayer:!0});var R={x:0,y:0};if(S(x[0])&&S(x[1])&&(R.x+=x[0],R.y+=x[1],O)){var B=e.hoverData.dragDelta;B&&S(B[0])&&S(B[1])&&(R.x+=B[0],R.y+=B[1])}e.hoverData.draggingEles=!0,w.silentShift(R).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else k();r=!0}else if(v){if(e.hoverData.dragging||!s.boxSelectionEnabled()||!N&&s.panningEnabled()&&s.userPanningEnabled()){if(!e.hoverData.selecting&&s.panningEnabled()&&s.userPanningEnabled()){var F=o(b,e.hoverData.downs);F&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=Tn(h),e.redrawHint("select",!0),e.redraw())}}else L();b&&b.pannable()&&b.active()&&b.unactivate()}return p[2]=c[0],p[3]=c[1],r?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if(1!==e.hoverData.which||1===t.which||!e.hoverData.capture){var r=e.hoverData.capture;if(r){e.hoverData.capture=!1;var o=e.cy,s=e.projectIntoViewport(t.clientX,t.clientY),l=e.selection,u=e.findNearestElement(s[0],s[1],!0,!1),c=e.dragData.possibleDragElements,h=e.hoverData.down,d=a(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,h&&h.unactivate(),3===e.hoverData.which){var p={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};if(h?h.emit(p):o.emit(p),!e.hoverData.cxtDragged){var g={originalEvent:t,type:"cxttap",position:{x:s[0],y:s[1]}};h?h.emit(g):o.emit(g)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(i(u,["mouseup","tapend","vmouseup"],t,{x:s[0],y:s[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(i(h,["click","tap","vclick"],t,{x:s[0],y:s[1]}),N=!1,t.timeStamp-k<=o.multiClickDebounceTime()?(D&&clearTimeout(D),N=!0,k=null,i(h,["dblclick","dbltap","vdblclick"],t,{x:s[0],y:s[1]})):(D=setTimeout((function(){N||i(h,["oneclick","onetap","voneclick"],t,{x:s[0],y:s[1]})}),o.multiClickDebounceTime()),k=t.timeStamp)),null!=h||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(t)||(o.$(n).unselect(["tapunselect"]),c.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=c=o.collection()),u!=h||e.dragData.didDrag||e.hoverData.selecting||null!=u&&u._private.selectable&&(e.hoverData.dragging||("additive"===o.selectionType()||d?u.selected()?u.unselect(["tapunselect"]):u.select(["tapselect"]):d||(o.$(n).unmerge(u).unselect(["tapunselect"]),u.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var f=o.collection(e.getAllInBox(l[0],l[1],l[2],l[3]));e.redrawHint("select",!0),f.length>0&&e.redrawHint("eles",!0),o.emit({type:"boxend",originalEvent:t,position:{x:s[0],y:s[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===o.selectionType()||d||o.$(n).unmerge(f).unselect(),f.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!l[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var m=h&&h.grabbed();y(c),m&&(h.emit("freeon"),c.emit("free"),e.dragData.didDrag&&(h.emit("dragfreeon"),c.emit("dragfree")))}}l[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}}),!1);var P,I,M,O,R,B,F,z,G,V,X,Y,U,W=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||A())t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity;var l=1===t.deltaMode;l&&(s*=33);var u=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(u=e.gestureStartZoom*t.scale),n.zoom({level:u,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",W,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||W(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var j,H,q,$,K,Z,Q,J=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},ee=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",j=function(t){if(e.hasTouchStarted=!0,C(t)){b(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,r=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);r[0]=o[0],r[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);r[2]=o[0],r[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);r[4]=o[0],r[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,y(e.dragData.touchDragEles);var s=e.findContainerClientCoords();G=s[0],V=s[1],X=s[2],Y=s[3],P=t.touches[0].clientX-G,I=t.touches[0].clientY-V,M=t.touches[1].clientX-G,O=t.touches[1].clientY-V,U=0<=P&&P<=X&&0<=M&&M<=X&&0<=I&&I<=Y&&0<=O&&O<=Y;var l=n.pan(),u=n.zoom();R=J(P,I,M,O),B=ee(P,I,M,O),F=[(P+M)/2,(I+O)/2],z=[(F[0]-l.x)/u,(F[1]-l.y)/u];var c=200,d=c*c;if(B<d&&!t.touches[2]){var p=e.findNearestElement(r[0],r[1],!0,!0),g=e.findNearestElement(r[2],r[3],!0,!0);return p&&p.isNode()?(p.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:r[0],y:r[1]}}),e.touchData.start=p):g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:r[0],y:r[1]}}),e.touchData.start=g):n.emit({originalEvent:t,type:"cxttapstart",position:{x:r[0],y:r[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var m=e.findNearestElements(r[0],r[1],!0,!0),x=m[0];if(null!=x&&(x.activate(),e.touchData.start=x,e.touchData.starts=m,e.nodeIsGrabbable(x))){var w=e.dragData.touchDragEles=n.collection(),E=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),x.selected()?(E=n.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),f(E,{addToList:w})):v(x,{addToList:w}),h(x);var T=function(e){return{originalEvent:t,type:e,position:{x:r[0],y:r[1]}}};x.emit(T("grabon")),E?E.forEach((function(e){e.emit(T("grab"))})):x.emit(T("grab"))}i(x,["touchstart","tapstart","vmousedown"],t,{x:r[0],y:r[1]}),null==x&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||i(e.touchData.start,["taphold"],t,{x:r[0],y:r[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var _=e.touchData.startPosition=[null,null,null,null,null,null],A=0;A<r.length;A++)_[A]=a[A]=r[A];var D=t.touches[0];e.touchData.startGPosition=[D.clientX,D.clientY]}}},!1),e.registerBinding(t,"touchmove",H=function(t){var n=e.touchData.capture;if(n||C(t)){var r=e.selection,a=e.cy,s=e.touchData.now,l=e.touchData.earlier,u=a.zoom();if(t.touches[0]){var c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=c[0],s[1]=c[1]}if(t.touches[1]){c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=c[0],s[3]=c[1]}if(t.touches[2]){c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=c[0],s[5]=c[1]}var h,d=e.touchData.startGPosition;if(n&&t.touches[0]&&d){for(var p=[],g=0;g<s.length;g++)p[g]=s[g]-l[g];var v=t.touches[0].clientX-d[0],m=v*v,b=t.touches[0].clientY-d[1],x=b*b,w=m+x;h=w>=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var E=t.touches[0].clientX-G,T=t.touches[0].clientY-V,_=t.touches[1].clientX-G,A=t.touches[1].clientY-V,D=ee(E,T,_,A),N=D/B,k=150,L=k*k,F=1.5,X=F*F;if(N>=X||D>=L){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Y={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(Y),e.touchData.start=null):a.emit(Y)}}if(n&&e.touchData.cxt){Y={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(Y):a.emit(Y),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var W=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&W===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=W,W&&W.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&a.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||a.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,r[4]=1,r&&0!==r.length&&void 0!==r[0]?(r[2]=(s[0]+s[2]+s[4])/3,r[3]=(s[1]+s[3]+s[5])/3):(r[0]=(s[0]+s[2]+s[4])/3,r[1]=(s[1]+s[3]+s[5])/3,r[2]=(s[0]+s[2]+s[4])/3+1,r[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&a.zoomingEnabled()&&a.panningEnabled()&&a.userZoomingEnabled()&&a.userPanningEnabled()){t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var j=e.dragData.touchDragEles;if(j){e.redrawHint("drag",!0);for(var H=0;H<j.length;H++){var q=j[H]._private;q.grabbed=!1,q.rscratch.inDragLayer=!1}}var $=e.touchData.start,K=(E=t.touches[0].clientX-G,T=t.touches[0].clientY-V,_=t.touches[1].clientX-G,A=t.touches[1].clientY-V,J(E,T,_,A)),Z=K/R;if(U){var Q=E-P,te=T-I,ne=_-M,re=A-O,ie=(Q+ne)/2,ae=(te+re)/2,oe=a.zoom(),se=oe*Z,le=a.pan(),ue=z[0]*oe+le.x,ce=z[1]*oe+le.y,he={x:-se/oe*(ue-le.x-ie)+ue,y:-se/oe*(ce-le.y-ae)+ce};if($&&$.active()){j=e.dragData.touchDragEles;y(j),e.redrawHint("drag",!0),e.redrawHint("eles",!0),$.unactivate().emit("freeon"),j.emit("free"),e.dragData.didDrag&&($.emit("dragfreeon"),j.emit("dragfree"))}a.viewport({zoom:se,pan:he,cancelOnFailedZoom:!0}),a.emit("pinchzoom"),R=K,P=E,I=T,M=_,O=A,e.pinching=!0}if(t.touches[0]){c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=c[0],s[1]=c[1]}if(t.touches[1]){c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=c[0],s[3]=c[1]}if(t.touches[2]){c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=c[0],s[5]=c[1]}}else if(t.touches[0]&&!e.touchData.didSelect){var de=e.touchData.start,pe=e.touchData.last;if(e.hoverData.draggingEles||e.swipePanning||(W=e.findNearestElement(s[0],s[1],!0,!0)),n&&null!=de&&t.preventDefault(),n&&null!=de&&e.nodeIsDraggable(de))if(h){j=e.dragData.touchDragEles;var ge=!e.dragData.didDrag;ge&&f(j,{inDragLayer:!0}),e.dragData.didDrag=!0;var fe={x:0,y:0};if(S(p[0])&&S(p[1])&&(fe.x+=p[0],fe.y+=p[1],ge)){e.redrawHint("eles",!0);var ve=e.touchData.dragDelta;ve&&S(ve[0])&&S(ve[1])&&(fe.x+=ve[0],fe.y+=ve[1])}e.hoverData.draggingEles=!0,j.silentShift(fe).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==l[0]&&e.touchData.startPosition[1]==l[1]&&e.redrawHint("eles",!0),e.redraw()}else{ve=e.touchData.dragDelta=e.touchData.dragDelta||[];0===ve.length?(ve.push(p[0]),ve.push(p[1])):(ve[0]+=p[0],ve[1]+=p[1])}if(i(de||W,["touchmove","tapdrag","vmousemove"],t,{x:s[0],y:s[1]}),de&&de.grabbed()||W==pe||(pe&&pe.emit({originalEvent:t,type:"tapdragout",position:{x:s[0],y:s[1]}}),W&&W.emit({originalEvent:t,type:"tapdragover",position:{x:s[0],y:s[1]}})),e.touchData.last=W,n)for(H=0;H<s.length;H++)s[H]&&e.touchData.startPosition[H]&&h&&(e.touchData.singleTouchMoved=!0);if(n&&(null==de||de.pannable())&&a.panningEnabled()&&a.userPanningEnabled()){var ye=o(de,e.touchData.starts);ye&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Tn(e.touchData.startPosition)),e.swipePanning?(a.panBy({x:p[0]*u,y:p[1]*u}),a.emit("dragpan")):h&&(e.swipePanning=!0,a.panBy({x:v*u,y:b*u}),a.emit("dragpan"),de&&(de.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=c[0],s[1]=c[1]}}for(g=0;g<s.length;g++)l[g]=s[g];n&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",q=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",$=function(t){var r=e.touchData.start,a=e.touchData.capture;if(a){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var o=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var s,l=e.cy,u=l.zoom(),c=e.touchData.now,h=e.touchData.earlier;if(t.touches[0]){var d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);c[0]=d[0],c[1]=d[1]}if(t.touches[1]){d=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);c[2]=d[0],c[3]=d[1]}if(t.touches[2]){d=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);c[4]=d[0],c[5]=d[1]}if(r&&r.unactivate(),e.touchData.cxt){if(s={originalEvent:t,type:"cxttapend",position:{x:c[0],y:c[1]}},r?r.emit(s):l.emit(s),!e.touchData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:c[0],y:c[1]}};r?r.emit(p):l.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&l.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var g=l.collection(e.getAllInBox(o[0],o[1],o[2],o[3]));o[0]=void 0,o[1]=void 0,o[2]=void 0,o[3]=void 0,o[4]=0,e.redrawHint("select",!0),l.emit({type:"boxend",originalEvent:t,position:{x:c[0],y:c[1]}});var f=function(e){return e.selectable()&&!e.selected()};g.emit("box").stdFilter(f).select().emit("boxselect"),g.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=r&&r.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var v=e.dragData.touchDragEles;if(null!=r){var m=r._private.grabbed;y(v),e.redrawHint("drag",!0),e.redrawHint("eles",!0),m&&(r.emit("freeon"),v.emit("free"),e.dragData.didDrag&&(r.emit("dragfreeon"),v.emit("dragfree"))),i(r,["touchend","tapend","vmouseup","tapdragout"],t,{x:c[0],y:c[1]}),r.unactivate(),e.touchData.start=null}else{var b=e.findNearestElement(c[0],c[1],!0,!0);i(b,["touchend","tapend","vmouseup","tapdragout"],t,{x:c[0],y:c[1]})}var x=e.touchData.startPosition[0]-c[0],w=x*x,E=e.touchData.startPosition[1]-c[1],T=E*E,_=w+T,A=_*u*u;e.touchData.singleTouchMoved||(r||l.$(":selected").unselect(["tapunselect"]),i(r,["tap","vclick"],t,{x:c[0],y:c[1]}),K=!1,t.timeStamp-Q<=l.multiClickDebounceTime()?(Z&&clearTimeout(Z),K=!0,Q=null,i(r,["dbltap","vdblclick"],t,{x:c[0],y:c[1]})):(Z=setTimeout((function(){K||i(r,["onetap","voneclick"],t,{x:c[0],y:c[1]})}),l.multiClickDebounceTime()),Q=t.timeStamp)),null!=r&&!e.dragData.didDrag&&r._private.selectable&&A<e.touchTapThreshold2&&!e.pinching&&("single"===l.selectionType()?(l.$(n).unmerge(r).unselect(["tapunselect"]),r.select(["tapselect"])):r.selected()?r.unselect(["tapunselect"]):r.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var C=0;C<c.length;C++)h[C]=c[C];e.dragData.didDrag=!1,0===t.touches.length&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),t.touches.length<2&&(1===t.touches.length&&(e.touchData.startGPosition=[t.touches[0].clientX,t.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())}},!1),"undefined"===typeof TouchEvent){var te=[],ne=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},re=function(e){return{event:e,touch:ne(e)}},ie=function(e){te.push(re(e))},ae=function(e){for(var t=0;t<te.length;t++){var n=te[t];if(n.event.pointerId===e.pointerId)return void te.splice(t,1)}},oe=function(e){var t=te.filter((function(t){return t.event.pointerId===e.pointerId}))[0];t.event=e,t.touch=ne(e)},se=function(e){e.touches=te.map((function(e){return e.touch}))},le=function(e){return"mouse"===e.pointerType||4===e.pointerType};e.registerBinding(e.container,"pointerdown",(function(e){le(e)||(e.preventDefault(),ie(e),se(e),j(e))})),e.registerBinding(e.container,"pointerup",(function(e){le(e)||(ae(e),se(e),$(e))})),e.registerBinding(e.container,"pointercancel",(function(e){le(e)||(ae(e),se(e),q(e))})),e.registerBinding(e.container,"pointermove",(function(e){le(e)||(e.preventDefault(),oe(e),se(e),H(e))}))}}},_d={generatePolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return fr(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return or(e,t,this.points,a,o,r,i,[0,-1],n)}}},generateEllipse:function(){return this.nodeShapes["ellipse"]={renderer:this,name:"ellipse",draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return cr(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return hr(e,t,r,i,a,o,n)}}},generateRoundPolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(void 0!==o[s]&&o[s+"-cx"]===e&&o[s+"-cy"]===n)return o[s];o[s]=new Array(t.length/2),o[s+"-cx"]=e,o[s+"-cy"]=n;var l=r/2,u=i/2;a="auto"===a?Er(r,i):a;for(var c=new Array(t.length/2),h=0;h<t.length/2;h++)c[h]={x:e+l*t[2*h],y:n+u*t[2*h+1]};var d,p,g,f,v=c.length;for(p=c[v-1],d=0;d<v;d++)g=c[d%v],f=c[(d+1)%v],o[s][d]=od(p,g,f,a),p=g,g=f;return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,"drawCorners"))},intersectLine:function(e,t,n,r,i,a,o,s,l){return vr(i,a,this.points,e,t,n,r,o,this.getOrCreateCorners(e,t,n,r,s,l,"corners"))},checkPoint:function(e,t,n,r,i,a,o,s,l){return sr(e,t,this.points,a,o,r,i,this.getOrCreateCorners(a,o,r,i,s,l,"corners"))}}},generateRoundRectangle:function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes["roundrectangle"]={renderer:this,name:"round-rectangle",points:mr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return Qn(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=r/2,u=i/2;s="auto"===s?wr(r,i):s,s=Math.min(l,u,s);var c=2*s;return!!or(e,t,this.points,a,o,r,i-c,[0,-1],n)||(!!or(e,t,this.points,a,o,r-c,i,[0,-1],n)||(!!hr(e,t,c,c,a-l+s,o-u+s,n)||(!!hr(e,t,c,c,a+l-s,o-u+s,n)||(!!hr(e,t,c,c,a+l-s,o+u-s,n)||!!hr(e,t,c,c,a-l+s,o+u-s,n)))))}}},generateCutRectangle:function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes["cutrectangle"]={renderer:this,name:"cut-rectangle",cornerLength:Tr(),points:mr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a="auto"===i?this.cornerLength:i,o=t/2,s=e/2,l=n-s,u=n+s,c=r-o,h=r+o;return{topLeft:[l,c+a,l+a,c,l+a,c+a],topRight:[u-a,c,u,c+a,u-a,c+a],bottomRight:[u,h-a,u-a,h,u-a,h-a],bottomLeft:[l+a,h,l,h-a,l+a,h-a]}},intersectLine:function(e,t,n,r,i,a,o,s){var l=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s),u=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return fr(i,a,u,e,t)},checkPoint:function(e,t,n,r,i,a,o,s){var l="auto"===s?this.cornerLength:s;if(or(e,t,this.points,a,o,r,i-2*l,[0,-1],n))return!0;if(or(e,t,this.points,a,o,r-2*l,i,[0,-1],n))return!0;var u=this.generateCutTrianglePts(r,i,a,o);return ar(e,t,u.topLeft)||ar(e,t,u.topRight)||ar(e,t,u.bottomRight)||ar(e,t,u.bottomLeft)}}},generateBarrel:function(){return this.nodeShapes["barrel"]={renderer:this,name:"barrel",points:mr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){var l=.15,u=.5,c=.85,h=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),d=function(e){var t=Rn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},l),n=Rn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},u),r=Rn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},c);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]},p=[].concat(d(h.topLeft),d(h.topRight),d(h.bottomRight),d(h.bottomLeft));return fr(i,a,p,e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,l=r-i,u=r+i,c=Ar(e,t),h=c.heightOffset,d=c.widthOffset,p=c.ctrlPtOffsetPct*e,g={topLeft:[o,l+h,o+p,l,o+d,l],topRight:[s-d,l,s-p,l,s,l+h],bottomRight:[s,u-h,s-p,u,s-d,u],bottomLeft:[o+d,u,o+p,u,o,u-h]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,t,n,r,i,a,o,s){var l=Ar(r,i),u=l.heightOffset,c=l.widthOffset;if(or(e,t,this.points,a,o,r,i-2*u,[0,-1],n))return!0;if(or(e,t,this.points,a,o,r-2*c,i,[0,-1],n))return!0;for(var h=this.generateBarrelBezierPts(r,i,a,o),d=function(e,t,n){var r=n[4],i=n[2],a=n[0],o=n[5],s=n[1],l=Math.min(r,a),u=Math.max(r,a),c=Math.min(o,s),h=Math.max(o,s);if(l<=e&&e<=u&&c<=t&&t<=h){var d=_r(r,i,a),p=tr(d[0],d[1],d[2],e),g=p.filter((function(e){return 0<=e&&e<=1}));if(g.length>0)return g[0]}return null},p=Object.keys(h),g=0;g<p.length;g++){var f=p[g],v=h[f],y=d(e,t,v);if(null!=y){var m=v[5],b=v[3],x=v[1],w=On(m,b,x,y);if(v.isTop&&w<=t)return!0;if(v.isBottom&&t<=w)return!0}}return!1}}},generateBottomRoundrectangle:function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes["bottomroundrectangle"]={renderer:this,name:"bottom-round-rectangle",points:mr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var l=e-(n/2+o),u=t-(r/2+o),c=u,h=e+(n/2+o),d=gr(i,a,e,t,l,u,h,c,!1);return d.length>0?d:Qn(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){s="auto"===s?wr(r,i):s;var l=2*s;if(or(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(or(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n,h=[a-u,o-c,a-u,o,a+u,o,a+u,o-c];return!!ar(e,t,h)||(!!hr(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!hr(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},registerNodeShapes:function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",mr(3,0)),this.generateRoundPolygon("round-triangle",mr(3,0)),this.generatePolygon("rectangle",mr(4,0)),e["square"]=e["rectangle"],this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",mr(5,0)),this.generateRoundPolygon("round-pentagon",mr(5,0)),this.generatePolygon("hexagon",mr(6,0)),this.generateRoundPolygon("round-hexagon",mr(6,0)),this.generatePolygon("heptagon",mr(7,0)),this.generateRoundPolygon("round-heptagon",mr(7,0)),this.generatePolygon("octagon",mr(8,0)),this.generateRoundPolygon("round-octagon",mr(8,0));var r=new Array(20),i=xr(5,0),a=xr(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(s=0;s<5;s++)r[4*s]=i[2*s],r[4*s+1]=i[2*s+1],r[4*s+2]=a[2*s],r[4*s+3]=a[2*s+1];r=br(r),this.generatePolygon("star",r),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 l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(e){var n,r=e.join("$"),i="polygon-"+r;return(n=this[i])?n:t.generatePolygon(i,e)}}},Ad={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(e){e=e||Yt();var t=this;void 0===t.averageRedrawTime&&(t.averageRedrawTime=0),void 0===t.lastRedrawTime&&(t.lastRedrawTime=0),void 0===t.lastDrawTime&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},beforeRender:function(e,t){if(!this.destroyed){null==t&&Ot("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort((function(e,t){return t.priority-e.priority}))}}},Cd=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};Ad.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function n(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){Cd(e,!0,r);var i=pt();e.render(e.renderOptions);var a=e.lastDrawTime=pt();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else Cd(e,!1,r);e.skipFrame=!1,dt(n)}};dt(n)}};var Dd=function(e){this.init(e)},Nd=Dd,Sd=Nd.prototype;Sd.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Sd.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var i=r.document,a=i.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",l=null!=i.getElementById(o);if(n.className.indexOf(s)<0&&(n.className=(n.className||"")+" "+s),!l){var u=i.createElement("style");u.id=o,u.textContent="."+s+" { position: relative; }",a.insertBefore(u,a.children[0])}var c=r.getComputedStyle(n),h=c.getPropertyValue("position");"static"===h&&Bt("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.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]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=S(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},Sd.notify=function(e,t){var n=this,r=n.cy;this.destroyed||("init"!==e?"destroy"!==e?(("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&n.invalidateCachedZSortedEles(),"viewport"===e&&n.redrawHint("select",!0),"gc"===e&&n.redrawHint("gc",!0),"load"!==e&&"resize"!==e&&"mount"!==e||(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()):n.destroy():n.load())},Sd.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n,i=r.target;(i.off||i.removeEventListener).apply(i,r.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch(a){}},Sd.isHeadless=function(){return!1},[Mh,wd,Ed,Td,_d,Ad].forEach((function(e){re(Sd,e)}));var kd=1e3/60,Ld={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=lt((function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()}),e.deqRedrawThreshold),i=function(i,a){var o=pt(),s=n.averageRedrawTime,l=n.lastRedrawTime,u=[],c=n.cy.extent(),h=n.getPixelRatio();i||n.flushRenderedStyleQueue();while(1){var d=pt(),p=d-o,g=d-a;if(l<kd){var f=kd-(i?s:0);if(g>=e.deqFastCost*f)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(g>=e.deqNoDrawCost*kd)break;var v=e.deq(t,h,c);if(!(v.length>0))break;for(var y=0;y<v.length;y++)u.push(v[y])}u.length>0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&r())},a=e.priority||Mt;n.beforeRender(i,a(t))}}}},Pd=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pt;t(this,e),this.idsByKey=new Zt,this.keyForId=new Zt,this.cachesByLvl=new Zt,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return i(e,[{key:"getIdsFor",value:function(e){null==e&&Ot("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new en,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e)["delete"](t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId["delete"](t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);return n!==r}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new Zt,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id()),r=this.getCache(n,t);return r}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t)["delete"](e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Id=25,Md=50,Od=-4,Rd=3,Bd=7.99,Fd=8,zd=1024,Gd=1024,Vd=1024,Xd=.2,Yd=.8,Ud=10,Wd=.15,jd=.1,Hd=.9,qd=.9,$d=100,Kd=1,Zd={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Qd=Ut({getKey:null,doesEleInvalidateKey:Pt,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Lt,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Jd=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Qd(t);re(n,r),n.lookup=new Pd(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},ep=Jd.prototype;ep.reasons=Zd,ep.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},ep.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r},ep.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new on((function(e,t){return t.reqs-e.reqs}));return t},ep.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t},ep.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(kn(s*n))),r<Od)r=Od;else if(s>=Bd||r>Rd)return null;var u=Math.pow(2,r),c=t.h*u,h=t.w*u,d=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var p,g=l.get(e,r);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;if(p=c<=Id?Id:c<=Md?Md:Math.ceil(c/Md)*Md,c>Vd||h>Gd)return null;var f=a.getTextureQueue(p),v=f[f.length-2],y=function(){return a.recycleTexture(p,h)||a.addTexture(p,h)};v||(v=f[f.length-1]),v||(v=y()),v.width-v.usedWidth<h&&(v=y());for(var m,b=function(e){return e&&e.scaledLabelShown===d},x=i&&i===Zd.dequeue,w=i&&i===Zd.highQuality,E=i&&i===Zd.downscale,T=r+1;T<=Rd;T++){var _=l.get(e,T);if(_){m=_;break}}var A=m&&m.level===r+1?m:null,C=function(){v.context.drawImage(A.texture.canvas,A.x,0,A.width,A.height,v.usedWidth,0,h,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,h,p),b(A))C();else if(b(m)){if(!w)return a.queueElement(e,m.level-1),m;for(var D=m.level;D>r;D--)A=a.getElement(e,t,n,D,Zd.downscale);C()}else{var N;if(!x&&!w&&!E)for(var S=r-1;S>=Od;S--){var k=l.get(e,S);if(k){N=k;break}}if(b(N))return a.queueElement(e,r),N;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,d,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return g={x:v.usedWidth,texture:v,level:r,scale:u,width:h,height:c,scaledLabelShown:d},v.usedWidth+=Math.ceil(h+Fd),v.eleCaches.push(g),l.set(e,r,g),a.checkTextureFullness(v),g},ep.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},ep.invalidateElement=function(e){var t=this,n=t.lookup,r=[],i=n.isInvalid(e);if(i){for(var a=Od;a<=Rd;a++){var o=n.getForCachedKey(e,a);o&&r.push(o)}var s=n.invalidate(e);if(s)for(var l=0;l<r.length;l++){var u=r[l],c=u.texture;c.invalidatedWidth+=u.width,u.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}},ep.checkTextureUtility=function(e){e.invalidatedWidth>=Xd*e.width&&this.retireTexture(e)},ep.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>Yd&&e.fullnessChecks>=Ud?Wt(n,e):e.fullnessChecks++},ep.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;Wt(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o<a.length;o++){var s=a[o];i.deleteCache(s.key,s.level)}jt(a);var l=t.getRetiredTextureQueue(n);l.push(e)},ep.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),i={};return r.push(i),i.eleCaches=[],i.height=e,i.width=Math.max(zd,t),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=n.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext("2d"),i},ep.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),i=n.getRetiredTextureQueue(e),a=0;a<i.length;a++){var o=i[a];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,jt(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Wt(i,o),r.push(o),o}},ep.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(s),i[a]=s}},ep.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<Kd;o++){if(!(n.size()>0))break;var s=n.pop(),l=s.key,u=s.eles[0],c=a.hasCache(u,s.level);if(r[l]=null,!c){i.push(s);var h=t.getBoundingBox(u);t.getElement(u,h,e,s.level,Zd.dequeue)}}return i},ep.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),a=r[i];null!=a&&(1===a.eles.length?(a.reqs=kt,n.updateItem(a),n.pop(),r[i]=null):a.eles.unmerge(e))},ep.onDequeue=function(e){this.onDequeues.push(e)},ep.offDequeue=function(e){Wt(this.onDequeues,e)},ep.setupDequeueing=Ld.setupDequeueing({deqRedrawThreshold:$d,deqCost:Wd,deqAvgCost:jd,deqNoDrawCost:Hd,deqFastCost:qd,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++){var s=a[o].boundingBox();if(qn(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var tp=1,np=-4,rp=2,ip=3.99,ap=50,op=50,sp=.15,lp=.1,up=.9,cp=.9,hp=1,dp=250,pp=16e6,gp=32767,fp=!0,vp=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=pt()-2*dp,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=lt((function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)}),op),n.beforeRender((function(e,n){n-t.lastInvalidationTime<=dp?t.skipping=!0:t.skipping=!1}),n.beforeRenderPriorities.lyrTxrSkip);var i=function(e,t){return t.reqs-e.reqs};t.layersQueue=new on(i),t.setupDequeueing()},yp=vp.prototype,mp=0,bp=Math.pow(2,53)-1;yp.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:mp=++mp%bp,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(n,n),s.translate(l,u),o},yp.getLayers=function(e,t,n){var r=this,i=r.renderer,a=i.cy,o=a.zoom(),s=r.firstGet;if(r.firstGet=!1,null==n)if(n=Math.ceil(kn(o*t)),n<np)n=np;else if(o>=ip||n>rp)return null;r.validateLayersElesOrdering(n,e);var l,u,c=r.layersByLevel,h=Math.pow(2,n),d=c[n]=c[n]||[],p=r.levelIsComplete(n,e),g=function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return u=c[t],!0},i=function(e){if(!u)for(var r=n+e;np<=r&&r<=rp;r+=e)if(t(r))break};i(1),i(-1);for(var a=d.length-1;a>=0;a--){var o=d[a];o.invalid&&Wt(d,o)}};if(p)return d;g();var f=function(){if(!l){l=zn();for(var t=0;t<e.length;t++)Yn(l,e[t].boundingBox())}return l},v=function(e){e=e||{};var t=e.after;f();var i=Math.ceil(l.w*h),a=Math.ceil(l.h*h);if(i>gp||a>gp)return null;var o=i*a;if(o>pp)return null;var s=r.makeLayer(l,n);if(null!=t){var u=d.indexOf(t)+1;d.splice(u,0,s)}else(void 0===e.insert||e.insert)&&d.unshift(s);return s};if(r.skipping&&!s)return null;for(var y=null,m=e.length/tp,b=!s,x=0;x<e.length;x++){var w=e[x],E=w._private.rscratch,T=E.imgLayerCaches=E.imgLayerCaches||{},_=T[n];if(_)y=_;else{if((!y||y.eles.length>=m||!Zn(y.bb,w.boundingBox()))&&(y=v({insert:!0,after:y}),!y))return null;u||b?r.queueLayer(y,w):r.drawEleInLayer(y,w,n,t),y.eles.push(w),T[n]=y}}return u||(b?null:d)},yp.getEleLevelForLayerLevel=function(e,t){return e},yp.drawEleInLayer=function(e,t,n,r){var i=this,a=this.renderer,o=e.context,s=t.boundingBox();0!==s.w&&0!==s.h&&t.visible()&&(n=i.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,fp),a.setImgSmoothing(o,!0))},yp.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||0===r.length)return!1;for(var i=0,a=0;a<r.length;a++){var o=r[a];if(o.reqs>0)return!1;if(o.invalid)return!1;i+=o.eles.length}return i===t.length},yp.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0)this.invalidateLayer(i);else{var s=a;for(o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}}},yp.updateElementsInLayers=function(e,t){for(var n=this,r=I(e[0]),i=0;i<e.length;i++)for(var a=r?null:e[i],o=r?e[i]:e[i].ele,s=o._private.rscratch,l=s.imgLayerCaches=s.imgLayerCaches||{},u=np;u<=rp;u++){var c=l[u];c&&(a&&n.getEleLevelForLayerLevel(c.level)!==a.level||t(c,o,a))}},yp.haveLayers=function(){for(var e=this,t=!1,n=np;n<=rp;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},yp.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=pt(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},yp.invalidateLayer=function(e){if(this.lastInvalidationTime=pt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Wt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},yp.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,(function(e,n,r){var i=e.replacement;if(i||(i=e.replacement=t.makeLayer(e.bb,e.level),i.replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])}))},yp.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},yp.queueLayer=function(e,t){var n=this,r=n.layersQueue,i=e.elesQueue,a=i.hasId=i.hasId||{};if(!e.replacement){if(t){if(a[t.id()])return;i.push(t),a[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}},yp.dequeue=function(e){var t=this,n=t.layersQueue,r=[],i=0;while(i<hp){if(0===n.size())break;var a=n.peek();if(a.replacement)n.pop();else if(a.replaces&&a!==a.replaces.replacement)n.pop();else if(a.invalid)n.pop();else{var o=a.elesQueue.shift();o&&(t.drawEleInLayer(a,o,a.level,e),i++),0===r.length&&r.push(!0),0===a.elesQueue.length&&(n.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}}return r},yp.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,i=n.indexOf(r);if(!(i<0||r.invalid)){n[i]=e;for(var a=0;a<e.eles.length;a++){var o=e.eles[a]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[e.level]=e)}t.requestRedraw()}},yp.requestRedraw=lt((function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()}),100),yp.setupDequeueing=Ld.setupDequeueing({deqRedrawThreshold:ap,deqCost:sp,deqAvgCost:lp,deqNoDrawCost:up,deqFastCost:cp,deq:function(e,t){return e.dequeue(t)},onDeqd:Mt,shouldRedraw:Lt,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var xp,wp={};function Ep(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function Tp(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function _p(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];e.moveTo(s.x,s.y);for(i=1;i<o.length;i++){a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function Ap(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,2*Math.PI,!1);var a=t,o=a[0];e.moveTo(o.x,o.y);for(var s=0;s<a.length;s++){var l=a[s];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function Cp(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}wp.arrowShapeImpl=function(e){return(xp||(xp={polygon:Ep,"triangle-backcurve":Tp,"triangle-tee":_p,"circle-triangle":Ap,"triangle-cross":_p,circle:Cp}))[e]};var Dp={drawElement:function(e,t,n,r,i,a){var o=this;t.isNode()?o.drawNode(e,t,n,r,i,a):o.drawEdge(e,t,n,r,i,a)},drawElementOverlay:function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},drawElementUnderlay:function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},drawCachedElementPortion:function(e,t,n,r,i,a,o,s){var l=this,u=n.getBoundingBox(t);if(0!==u.w&&0!==u.h){var c=n.getElement(t,u,r,i,a);if(null!=c){var h=s(l,t);if(0===h)return;var d,p,g,f,v,y,m=o(l,t),b=u.x1,x=u.y1,w=u.w,E=u.h;if(0!==m){var T=n.getRotationPoint(t);g=T.x,f=T.y,e.translate(g,f),e.rotate(m),v=l.getImgSmoothing(e),v||l.setImgSmoothing(e,!0);var _=n.getRotationOffset(t);d=_.x,p=_.y}else d=b,p=x;1!==h&&(y=e.globalAlpha,e.globalAlpha=y*h),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,d,p,w,E),1!==h&&(e.globalAlpha=y),0!==m&&(e.rotate(-m),e.translate(-g,-f),v||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}}},Np=function(){return 0},Sp=function(e,t){return e.getTextAngle(t,null)},kp=function(e,t){return e.getTextAngle(t,"source")},Lp=function(e,t){return e.getTextAngle(t,"target")},Pp=function(e,t){return t.effectiveOpacity()},Ip=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};Dp.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,h=s.tlbTxrCache,d=t.boundingBox(),p=!0===a?l.reasons.highQuality:null;if(0!==d.w&&0!==d.h&&t.visible()&&(!r||qn(d,r))){var g=t.isEdge(),f=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,l,n,i,p,Np,Pp),g&&f||o.drawCachedElementPortion(e,t,u,n,i,p,Sp,Ip),g&&!f&&(o.drawCachedElementPortion(e,t,c,n,i,p,kp,Ip),o.drawCachedElementPortion(e,t,h,n,i,p,Lp,Ip)),o.drawElementOverlay(e,t)}},Dp.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var i=t[r];n.drawElement(e,i)}},Dp.drawCachedElements=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];i.drawCachedElement(e,o,n,r)}},Dp.drawCachedNodes=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var o=t[a];o.isNode()&&i.drawCachedElement(e,o,n,r)}},Dp.drawLayeredElements=function(e,t,n,r){var i=this,a=i.data.lyrTxrCache.getLayers(t,n);if(a)for(var o=0;o<a.length;o++){var s=a[o],l=s.bb;0!==l.w&&0!==l.h&&e.drawImage(s.canvas,l.x1,l.y1,l.w,l.h)}else i.drawCachedElements(e,t,n,r)};var Mp={drawEdge:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,f=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===h?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=g,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,d),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+f,e.lineCap=g,f>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===h?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,d),e.lineCap="butt")):e.lineCap="butt"},w=function(){i&&o.drawEdgeOverlay(e,t)},E=function(){i&&o.drawEdgeUnderlay(e,t)},T=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)},_=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var A="yes"===t.pstyle("ghost").value;if(A){var C=t.pstyle("ghost-offset-x").pfValue,D=t.pstyle("ghost-offset-y").pfValue,N=t.pstyle("ghost-opacity").value,S=y*N;e.translate(C,D),b(S),T(S),e.translate(-C,-D)}else x();E(),b(),T(),w(),_(),n&&e.translate(l.x1,l.y1)}}},Op=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=n.pstyle("".concat(e,"-padding")).pfValue,l=2*s,u=n.pstyle("".concat(e,"-color")).value;t.lineWidth=l,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,u[0],u[1],u[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Mp.drawEdgeOverlay=Op("overlay"),Mp.drawEdgeUnderlay=Op("underlay"),Mp.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$"),d=a.pathCacheKey&&a.pathCacheKey===h;d?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([]);break}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+3<n.length;p+=4)t.quadraticCurveTo(n[p],n[p+1],n[p+2],n[p+3]);break;case"straight":case"haystack":for(var g=2;g+1<n.length;g+=2)t.lineTo(n[g],n[g+1]);break;case"segments":if(a.isRound){var f,y=v(a.roundCorners);try{for(y.s();!(f=y.n()).done;){var m=f.value;ad(t,m)}}catch(x){y.e(x)}finally{y.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var b=2;b+1<n.length;b+=2)t.lineTo(n[b],n[b+1]);break}t=o,l?t.stroke(i):t.stroke(),t.setLineDash&&t.setLineDash([])},Mp.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-l[0],n[i+1]-l[1]),t.lineTo(n[i]+l[0],n[i+1]+l[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},Mp.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},Mp.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a)){var s=this,l=t.pstyle(n+"-arrow-shape").value;if("none"!==l){var u="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,h=t.pstyle("width").pfValue,d=t.pstyle(n+"-arrow-width"),p="match-line"===d.value?h:d.pfValue;"%"===d.units&&(p*=h);var g=t.pstyle("opacity").value;void 0===o&&(o=g);var f=e.globalCompositeOperation;1===o&&"hollow"!==c||(e.globalCompositeOperation="destination-out",s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,u,h,l,p,r,i,a),e.globalCompositeOperation=f);var v=t.pstyle(n+"-arrow-color").value;s.colorFillStyle(e,v[0],v[1],v[2],o),s.colorStrokeStyle(e,v[0],v[1],v[2],o),s.drawArrowShape(t,e,c,h,l,p,r,i,a)}}},Mp.drawArrowShape=function(e,t,n,r,i,a,o,s,l){var u,c=this,h=this.usePaths()&&"triangle-cross"!==i,d=!1,p=t,g={x:o,y:s},f=e.pstyle("arrow-scale").value,v=this.getArrowWidth(r,f),y=c.arrowShapes[i];if(h){var m=c.arrowPathCache=c.arrowPathCache||[],b=_t(i),x=m[b];null!=x?(u=t=x,d=!0):(u=t=new Path2D,m[b]=u)}d||(t.beginPath&&t.beginPath(),h?y.draw(t,1,0,{x:0,y:0},1):y.draw(t,v,l,g,r),t.closePath&&t.closePath()),t=p,h&&(t.translate(o,s),t.rotate(l),t.scale(v,v)),"filled"!==n&&"both"!==n||(h?t.fill(u):t.fill()),"hollow"!==n&&"both"!==n||(t.lineWidth=a/(h?v:1),t.lineJoin="miter",h?t.stroke(u):t.stroke()),h&&(t.scale(1/v,1/v),t.rotate(-l),t.translate(-o,-s))};var Rp={safeDrawImage:function(e,t,n,r,i,a,o,s,l,u){if(!(i<=0||a<=0||l<=0||u<=0))try{e.drawImage(t,n,r,i,a,o,s,l,u)}catch(c){Bt(c)}},drawInscribedImage:function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,l=o.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),h=c(n,"background-fit","value",r),d=c(n,"background-repeat","value",r),p=n.width(),g=n.height(),f=2*n.padding(),v=p+("inner"===c(n,"background-width-relative-to","value",r)?0:f),y=g+("inner"===c(n,"background-height-relative-to","value",r)?0:f),m=n._private.rscratch,b=c(n,"background-clip","value",r),x="node"===b,w=c(n,"background-image-opacity","value",r)*i,E=c(n,"background-image-smoothing","value",r),T=n.pstyle("corner-radius").value;"auto"!==T&&(T=n.pstyle("corner-radius").pfValue);var _=t.width||t.cachedW,A=t.height||t.cachedH;null!=_&&null!=A||(document.body.appendChild(t),_=t.cachedW=t.width||t.offsetWidth,A=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var C=_,D=A;if("auto"!==c(n,"background-width","value",r)&&(C="%"===c(n,"background-width","units",r)?c(n,"background-width","pfValue",r)*v:c(n,"background-width","pfValue",r)),"auto"!==c(n,"background-height","value",r)&&(D="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*y:c(n,"background-height","pfValue",r)),0!==C&&0!==D){if("contain"===h){var N=Math.min(v/C,y/D);C*=N,D*=N}else if("cover"===h){N=Math.max(v/C,y/D);C*=N,D*=N}var S=s-v/2,k=c(n,"background-position-x","units",r),L=c(n,"background-position-x","pfValue",r);S+="%"===k?(v-C)*L:L;var P=c(n,"background-offset-x","units",r),I=c(n,"background-offset-x","pfValue",r);S+="%"===P?(v-C)*I:I;var M=l-y/2,O=c(n,"background-position-y","units",r),R=c(n,"background-position-y","pfValue",r);M+="%"===O?(y-D)*R:R;var B=c(n,"background-offset-y","units",r),F=c(n,"background-offset-y","pfValue",r);M+="%"===B?(y-D)*F:F,m.pathCache&&(S-=s,M-=l,s=0,l=0);var z=e.globalAlpha;e.globalAlpha=w;var G=a.getImgSmoothing(e),V=!1;if("no"===E&&G?(a.setImgSmoothing(e,!1),V=!0):"yes"!==E||G||(a.setImgSmoothing(e,!0),V=!0),"no-repeat"===d)x&&(e.save(),m.pathCache?e.clip(m.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,v,y,T,m),e.clip())),a.safeDrawImage(e,t,0,0,_,A,S,M,C,D),x&&e.restore();else{var X=e.createPattern(t,d);e.fillStyle=X,a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,v,y,T,m),e.translate(S,M),e.fill(),e.translate(-S,-M)}e.globalAlpha=z,V&&a.setImgSmoothing(e,G)}}},Bp={};function Fp(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}Bp.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(kn(n*r));t=Math.pow(2,i)}var a=e.pstyle("font-size").pfValue*t,o=e.pstyle("min-zoomed-font-size").pfValue;return!(a<o)},Bp.drawElementText=function(e,t,n,r,i){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),d=t.pstyle("target-label");if(u||(!c||!c.value)&&(!h||!h.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,g=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,g,a),t.isEdge()&&(o.drawText(e,t,"source",g,a),o.drawText(e,t,"target",g,a))):o.drawText(e,t,i,g,a),n&&e.translate(p.x1,p.y1)},Bp.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},Bp.setupTextStyle=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Bp.getTextAngle=function(e,t){var n,r=e._private,i=r.rscratch,a=t?t+"-":"",o=e.pstyle(a+"text-rotation");if("autorotate"===o.strValue){var s=qt(i,"labelAngle",t);n=e.isEdge()?s:0}else n="none"===o.strValue?0:o.pfValue;return n},Bp.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=qt(o,"labelX",n),h=qt(o,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(c)&&!isNaN(h)){this.setupTextStyle(e,t,i);var p,g=n?n+"-":"",f=qt(o,"labelWidth",n),v=qt(o,"labelHeight",n),y=t.pstyle(g+"text-margin-x").pfValue,m=t.pstyle(g+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,h+=m,p=r?this.getTextAngle(t,n):0,0!==p&&(l=c,u=h,e.translate(l,u),e.rotate(p),c=0,h=0),w){case"top":break;case"center":h+=v/2;break;case"bottom":h+=v;break}var E=t.pstyle("text-background-opacity").value,T=t.pstyle("text-border-opacity").value,_=t.pstyle("text-border-width").pfValue,A=t.pstyle("text-background-padding").pfValue,C=t.pstyle("text-background-shape").strValue,D=0===C.indexOf("round"),N=2;if(E>0||_>0&&T>0){var S=c-A;switch(x){case"left":S-=f;break;case"center":S-=f/2;break}var k=h-v-A,L=f+2*A,P=v+2*A;if(E>0){var I=e.fillStyle,M=t.pstyle("text-background-color").value;e.fillStyle="rgba("+M[0]+","+M[1]+","+M[2]+","+E*s+")",D?Fp(e,S,k,L,P,N):e.fillRect(S,k,L,P),e.fillStyle=I}if(_>0&&T>0){var O=e.strokeStyle,R=e.lineWidth,B=t.pstyle("text-border-color").value,F=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+T*s+")",e.lineWidth=_,e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=_/4,e.setLineDash([]);break;case"solid":e.setLineDash([]);break}if(D?Fp(e,S,k,L,P,N,"stroke"):e.strokeRect(S,k,L,P),"double"===F){var z=_/2;D?Fp(e,S+z,k+z,L-2*z,P-2*z,N,"stroke"):e.strokeRect(S+z,k+z,L-2*z,P-2*z)}e.setLineDash&&e.setLineDash([]),e.lineWidth=R,e.strokeStyle=O}}var G=2*t.pstyle("text-outline-width").pfValue;if(G>0&&(e.lineWidth=G),"wrap"===t.pstyle("text-wrap").value){var V=qt(o,"labelWrapCachedLines",n),X=qt(o,"labelLineHeight",n),Y=f/2,U=this.getLabelJustification(t);switch("auto"===U||("left"===x?"left"===U?c+=-f:"center"===U&&(c+=-Y):"center"===x?"left"===U?c+=-Y:"right"===U&&(c+=Y):"right"===x&&("center"===U?c+=Y:"right"===U&&(c+=f))),w){case"top":h-=(V.length-1)*X;break;case"center":case"bottom":h-=(V.length-1)*X;break}for(var W=0;W<V.length;W++)G>0&&e.strokeText(V[W],c,h),e.fillText(V[W],c,h),h+=X}else G>0&&e.strokeText(d,c,h),e.fillText(d,c,h);0!==p&&(e.rotate(-p),e.translate(-l,-u))}}};var zp={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,h=t.position();if(S(h.x)&&S(h.y)&&(!s||t.visible())){var d,p,g=s?t.effectiveOpacity():1,f=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image"),b=m.value,x=new Array(b.length),w=new Array(b.length),E=0,T=0;T<b.length;T++){var _=b[T],A=x[T]=null!=_&&"none"!==_;if(A){var C=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",T);E++,w[T]=l.getCachedImage(_,C,(function(){u.backgroundTimestamp=Date.now(),t.emitAndNotify("background")}))}}var D=t.pstyle("background-blacken").value,N=t.pstyle("border-width").pfValue,k=t.pstyle("background-opacity").value*g,L=t.pstyle("border-color").value,P=t.pstyle("border-style").value,I=t.pstyle("border-join").value,M=t.pstyle("border-cap").value,O=t.pstyle("border-position").value,R=t.pstyle("border-dash-pattern").pfValue,B=t.pstyle("border-dash-offset").pfValue,F=t.pstyle("border-opacity").value*g,z=t.pstyle("outline-width").pfValue,G=t.pstyle("outline-color").value,V=t.pstyle("outline-style").value,X=t.pstyle("outline-opacity").value*g,Y=t.pstyle("outline-offset").value,U=t.pstyle("corner-radius").value;"auto"!==U&&(U=t.pstyle("corner-radius").pfValue);var W=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:k;l.eleFillStyle(e,t,n)},j=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:F;l.colorStrokeStyle(e,L[0],L[1],L[2],t)},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;l.colorStrokeStyle(e,G[0],G[1],G[2],t)},q=function(e,t,n,r){var i,a=l.nodePathCache=l.nodePathCache||[],o=At("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+U),s=a[o],u=!1;return null!=s?(i=s,u=!0,c.pathCache=i):(i=new Path2D,a[o]=c.pathCache=i),{path:i,cacheHit:u}},$=t.pstyle("shape").strValue,K=t.pstyle("shape-polygon-points").pfValue;if(f){e.translate(h.x,h.y);var Z=q(r,i,$,K);d=Z.path,v=Z.cacheHit}var Q=function(){if(!v){var n=h;f&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(d||e,n.x,n.y,r,i,U,c)}f?e.fill(d):e.fill()},J=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o<w.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);r&&"over"===s||!r&&"inside"===s?a++:x[o]&&w[o].complete&&!w[o].error&&(a++,l.drawInscribedImage(e,w[o],t,o,n))}u.backgrounding=!(a===E),i!==u.backgrounding&&t.updateStyle(!1)},ee=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(f||l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i,U,c)))},te=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,n=(D>0?D:-D)*t,r=D>0?0:255;0!==D&&(l.colorFillStyle(e,r,r,r,n),f?e.fill(d):e.fill())},ne=function(){if(N>0){if(e.lineWidth=N,e.lineCap=M,e.lineJoin=I,e.setLineDash)switch(P){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(R),e.lineDashOffset=B;break;case"solid":case"double":e.setLineDash([]);break}if("center"!==O){if(e.save(),e.lineWidth*=2,"inside"===O)f?e.clip(d):e.clip();else{var t=new Path2D;t.rect(-r/2-N,-i/2-N,r+2*N,i+2*N),t.addPath(d),e.clip(t,"evenodd")}f?e.stroke(d):e.stroke(),e.restore()}else f?e.stroke(d):e.stroke();if("double"===P){e.lineWidth=N/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",f?e.stroke(d):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},re=function(){if(z>0){if(e.lineWidth=z,e.lineCap="butt",e.setLineDash)switch(V){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var n=h;f&&(n={x:0,y:0});var a=l.getNodeShape(t),o=N;"inside"===O&&(o=0),"outside"===O&&(o*=2);var s,u=(r+o+(z+Y))/r,c=(i+o+(z+Y))/i,d=r*u,p=i*c,g=l.nodeShapes[a].points;if(f){var v=q(d,p,a,g);s=v.path}if("ellipse"===a)l.drawEllipsePath(s||e,n.x,n.y,d,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var y=0,m=0,b=0;"round-diamond"===a?y=1.4*(o+Y+z):"round-heptagon"===a?(y=1.075*(o+Y+z),b=-(o/2+Y+z)/35):"round-hexagon"===a?y=1.12*(o+Y+z):"round-pentagon"===a?(y=1.13*(o+Y+z),b=-(o/2+Y+z)/15):"round-tag"===a?(y=1.12*(o+Y+z),m=.07*(o/2+z+Y)):"round-triangle"===a&&(y=(o+Y+z)*(Math.PI/2),b=-(o+Y/2+z)/Math.PI),0!==y&&(u=(r+y)/r,d=r*u,["round-hexagon","round-tag"].includes(a)||(c=(i+y)/i,p=i*c)),U="auto"===U?Er(d,p):U;for(var x=d/2,w=p/2,E=U+(o+z+Y)/2,T=new Array(g.length/2),_=new Array(g.length/2),A=0;A<g.length/2;A++)T[A]={x:n.x+m+x*g[2*A],y:n.y+b+w*g[2*A+1]};var C,D,S,k,L=T.length;for(D=T[L-1],C=0;C<L;C++)S=T[C%L],k=T[(C+1)%L],_[C]=od(D,S,k,E),D=S,S=k;l.drawRoundPolygonPath(s||e,n.x+m,n.y+b,r*u,i*c,g,_)}else if(["roundrectangle","round-rectangle"].includes(a))U="auto"===U?wr(d,p):U,l.drawRoundRectanglePath(s||e,n.x,n.y,d,p,U+(o+z+Y)/2);else if(["cutrectangle","cut-rectangle"].includes(a))U="auto"===U?Tr():U,l.drawCutRectanglePath(s||e,n.x,n.y,d,p,null,U+(o+z+Y)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(a))U="auto"===U?wr(d,p):U,l.drawBottomRoundRectanglePath(s||e,n.x,n.y,d,p,U+(o+z+Y)/2);else if("barrel"===a)l.drawBarrelPath(s||e,n.x,n.y,d,p);else if(a.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(a)){var P=(o+z+Y)/r;g=lr(ur(g,P)),l.drawPolygonPath(s||e,n.x,n.y,r,i,g)}else{var I=(o+z+Y)/r;g=lr(ur(g,-I)),l.drawPolygonPath(s||e,n.x,n.y,r,i,g)}if(f?e.stroke(s):e.stroke(),"double"===V){e.lineWidth=o/3;var M=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",f?e.stroke(s):e.stroke(),e.globalCompositeOperation=M}e.setLineDash&&e.setLineDash([])}},ie=function(){o&&l.drawNodeOverlay(e,t,h,r,i)},ae=function(){o&&l.drawNodeUnderlay(e,t,h,r,i)},oe=function(){l.drawElementText(e,t,null,a)},se="yes"===t.pstyle("ghost").value;if(se){var le=t.pstyle("ghost-offset-x").pfValue,ue=t.pstyle("ghost-offset-y").pfValue,ce=t.pstyle("ghost-opacity").value,he=ce*g;e.translate(le,ue),H(),re(),W(ce*k),Q(),J(he,!0),j(ce*F),ne(),ee(0!==D||0!==N),J(he,!1),te(he),e.translate(-le,-ue)}f&&e.translate(-h.x,-h.y),ae(),f&&e.translate(h.x,h.y),H(),re(),W(),Q(),J(g,!0),j(),ne(),ee(0!==D||0!==N),J(g,!1),te(),f&&e.translate(-h.x,-h.y),oe(),ie(),n&&e.translate(p.x1,p.y1)}}},Gp=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,i,a){var o=this;if(n.visible()){var s=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,u=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value,h=n.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}o.colorFillStyle(t,u[0],u[1],u[2],l),o.nodeShapes[c].draw(t,r.x,r.y,i+2*s,a+2*s,h),t.fill()}}}};zp.drawNodeOverlay=Gp("overlay"),zp.drawNodeUnderlay=Gp("underlay"),zp.hasPie=function(e){return e=e[0],e._private.hasPie},zp.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,h=0,d=this.usePaths();d&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var p=1;p<=i.pieBackgroundN;p++){var g=t.pstyle("pie-"+p+"-background-size").value,f=t.pstyle("pie-"+p+"-background-color").value,v=t.pstyle("pie-"+p+"-background-opacity").value*n,y=g/100;y+h>1&&(y=1-h);var m=1.5*Math.PI+2*Math.PI*h,b=2*Math.PI*y,x=m+b;0===g||h>=1||h+y>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,m,x),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],v),e.fill(),h+=y)}};var Vp,Xp={},Yp=100;function Up(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function Wp(e,t,n){var r=Up(e,e.VERTEX_SHADER,t),i=Up(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function jp(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function Hp(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function qp(e,t,n,r,i){var a=r*n+t.x,o=i*n+t.y;return o=Math.round(e.canvasHeight-o),[a,o]}function $p(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=t,s=n||new Array(4);return s[0]=r*o,s[1]=i*o,s[2]=a*o,s[3]=o,s}function Kp(e,t){var n=t||new Array(4);return n[0]=(255&e)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function Zp(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function Qp(e,t){var n=e.createTexture();return n.buffer=function(t){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function Jp(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function eg(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function tg(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function ng(e,t,n,r){var i=Jp(e,t),a=o(i,2),s=a[0],l=a[1],u=eg(e,l,r),c=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,u,e.STATIC_DRAW),l===e.FLOAT?e.vertexAttribPointer(n,s,l,!1,0,0):l===e.INT&&e.vertexAttribIPointer(n,s,l,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),c}function rg(e,t,n,r){var i=Jp(e,n),a=o(i,3),s=a[0],l=a[1],u=a[2],c=eg(e,l,t*s),h=s*u,d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,t*h,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),l===e.FLOAT?e.vertexAttribPointer(r,s,l,!1,h,0):l===e.INT&&e.vertexAttribIPointer(r,s,l,h,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var p=new Array(t),g=0;g<t;g++)p[g]=tg(e,l,c,h,s,g);return d.dataArray=c,d.stride=h,d.size=s,d.getView=function(e){return p[e]},d.setPoint=function(e,t,n){var r=p[e];r[0]=t,r[1]=n},d.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,d),t?e.bufferSubData(e.ARRAY_BUFFER,0,c,0,t*s):e.bufferSubData(e.ARRAY_BUFFER,0,c)},d}function ig(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(t,r){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}Xp.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},Xp.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if(t=n[i],t.context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},Xp.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)if(n.isEdge()){var u=n.sourceEndpoint(),c=n.targetEndpoint(),h=n.midpoint(),d=Pn(u,h),p=Pn(c,h);a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(d,p))}else{var g=o?{x:0,y:0}:n.position(),f=n.paddedWidth(),v=n.paddedHeight();a=e.createRadialGradient(g.x,g.y,0,g.x,g.y,Math.max(f,v))}else if(n.isEdge()){var y=n.sourceEndpoint(),m=n.targetEndpoint();a=e.createLinearGradient(y.x,y.y,m.x,m.y)}else{var b=o?{x:0,y:0}:n.position(),x=n.paddedWidth(),w=n.paddedHeight(),E=x/2,T=w/2,_=n.pstyle("background-gradient-direction").value;switch(_){case"to-bottom":a=e.createLinearGradient(b.x,b.y-T,b.x,b.y+T);break;case"to-top":a=e.createLinearGradient(b.x,b.y+T,b.x,b.y-T);break;case"to-left":a=e.createLinearGradient(b.x+E,b.y,b.x-E,b.y);break;case"to-right":a=e.createLinearGradient(b.x-E,b.y,b.x+E,b.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(b.x-E,b.y-T,b.x+E,b.y+T);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(b.x-E,b.y+T,b.x+E,b.y-T);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(b.x+E,b.y-T,b.x-E,b.y+T);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(b.x+E,b.y+T,b.x-E,b.y-T);break}}if(!a)return null;for(var A=l.length===s.length,C=s.length,D=0;D<C;D++)a.addColorStop(A?l[D]:D/(C-1),"rgba("+s[D][0]+","+s[D][1]+","+s[D][2]+","+i+")");return a},Xp.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},Xp.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},Xp.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},Xp.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},Xp.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},Xp.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},Xp.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]&&e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG]||(o=s);var l,u=i*o,c=a*o;if(u!==t.canvasWidth||c!==t.canvasHeight){t.fontCaches=null;var h=n.canvasContainer;h.style.width=i+"px",h.style.height=a+"px";for(var d=0;d<t.CANVAS_LAYERS;d++)l=n.canvases[d],l.width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"px";for(d=0;d<t.BUFFER_COUNT;d++)l=n.bufferCanvases[d],l.width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"px";t.textureMult=1,o<=1&&(l=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,l.width=u*t.textureMult,l.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c,t.pixelRatio=o}},Xp.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},Xp.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},Xp.render=function(e){var t=this;e=e||Yt();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,l=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,u=t.data,c=u.canvasNeedsRedraw,h=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),d=void 0!==e.motionBlur?e.motionBlur:t.motionBlur,p=t.motionBlurPxRatio,g=n.hasCompoundNodes(),f=t.hoverData.draggingEles,v=!(!t.hoverData.selecting&&!t.touchData.selecting);d=d&&!r&&t.motionBlurEnabled&&!v;var y=d;r||(t.prevPxRatio!==l&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=l),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),d&&(null==t.mbFrames&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(y=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!h&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var m=n.style(),b=n.zoom(),x=void 0!==o?o:b,w=n.pan(),E={x:w.x,y:w.y},T={zoom:b,pan:{x:w.x,y:w.y}},_=t.prevViewport,A=void 0===_||T.zoom!==_.zoom||T.pan.x!==_.pan.x||T.pan.y!==_.pan.y;A||f&&!g||(t.motionBlurPxRatio=1),s&&(E=s),x*=l,E.x*=l,E.y*=l;var C=t.getCachedZSortedEles();function D(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function N(e,n){var a,l,c,h;t.clearingMotionBlur||e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(a=E,l=x,c=t.canvasWidth,h=t.canvasHeight):(a={x:w.x*p,y:w.y*p},l=b*p,c=t.canvasWidth*p,h=t.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?D(e,0,0,c,h):r||void 0!==n&&!n||e.clearRect(0,0,c,h),i||(e.translate(a.x,a.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(h||(t.textureDrawLastFrame=!1),h){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var S=t.data.bufferContexts[t.TEXTURE_BUFFER];S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:S,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult});T=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};T.mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var k=u.contexts[t.NODE],L=t.textureCache.texture;T=t.textureCache.viewport;k.setTransform(1,0,0,1,0,0),d?D(k,0,0,T.width,T.height):k.clearRect(0,0,T.width,T.height);var P=m.core("outside-texture-bg-color").value,I=m.core("outside-texture-bg-opacity").value;t.colorFillStyle(k,P[0],P[1],P[2],I),k.fillRect(0,0,T.width,T.height);b=n.zoom();N(k,!1),k.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l),k.drawImage(L,T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var M=n.extent(),O=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),R=t.hideEdgesOnViewport&&O,B=[];if(B[t.NODE]=!c[t.NODE]&&d&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,B[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),B[t.DRAG]=!c[t.DRAG]&&d&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,B[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||i||a||B[t.NODE]){var F=d&&!B[t.NODE]&&1!==p,z=(k=r||(F?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]),d&&!F?"motionBlur":void 0);N(k,z),R?t.drawCachedNodes(k,C.nondrag,l,M):t.drawLayeredElements(k,C.nondrag,l,M),t.debug&&t.drawDebugPoints(k,C.nondrag),i||d||(c[t.NODE]=!1)}if(!a&&(c[t.DRAG]||i||B[t.DRAG])){F=d&&!B[t.DRAG]&&1!==p,k=r||(F?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]);N(k,d&&!F?"motionBlur":void 0),R?t.drawCachedNodes(k,C.drag,l,M):t.drawCachedElements(k,C.drag,l,M),t.debug&&t.drawDebugPoints(k,C.drag),i||d||(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,N),d&&1!==p){var G=u.contexts[t.NODE],V=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],X=u.contexts[t.DRAG],Y=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],U=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):D(e,0,0,t.canvasWidth,t.canvasHeight);var i=p;e.drawImage(n,0,0,t.canvasWidth*i,t.canvasHeight*i,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||B[t.NODE])&&(U(G,V,B[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||B[t.DRAG])&&(U(X,Y,B[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=T,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),d&&(t.motionBlurTimeout=setTimeout((function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!h,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()}),Yp)),r||n.emit("render")},Xp.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,i=n.data,a=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,l=i.canvasNeedsRedraw,u=e.forcedContext;if(n.showFps||!o&&l[n.SELECT_BOX]&&!s){var c=u||i.contexts[n.SELECT_BOX];if(t(c),1==n.selection[4]&&(n.hoverData.selecting||n.touchData.selecting)){var h=n.cy.zoom(),d=a.core("selection-box-border-width").value/h;c.lineWidth=d,c.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),d>0&&(c.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(i.bgActivePosistion&&!n.hoverData.selecting){h=n.cy.zoom();var p=i.bgActivePosistion;c.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",c.beginPath(),c.arc(p.x,p.y,a.core("active-bg-size").pfValue/h,0,2*Math.PI),c.fill()}var g=n.lastRedrawTime;if(n.showFps&&g){g=Math.round(g);var f=Math.round(1e3/g),v="1 frame = "+g+" ms = "+f+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!Vp){var y=c.measureText(v);Vp=y.actualBoundingBoxAscent}c.fillText(v,0,Vp);var m=60;c.strokeRect(0,Vp+10,250,20),c.fillRect(0,Vp+10,250*Math.min(f/m,1),20)}s||(l[n.SELECT_BOX]=!1)}};var ag="undefined"!==typeof Float32Array?Float32Array:Array;function og(){var e=new ag(9);return ag!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function sg(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function lg(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=n[0],p=n[1],g=n[2],f=n[3],v=n[4],y=n[5],m=n[6],b=n[7],x=n[8];return e[0]=d*r+p*o+g*u,e[1]=d*i+p*s+g*c,e[2]=d*a+p*l+g*h,e[3]=f*r+v*o+y*u,e[4]=f*i+v*s+y*c,e[5]=f*a+v*l+y*h,e[6]=m*r+b*o+x*u,e[7]=m*i+b*s+x*c,e[8]=m*a+b*l+x*h,e}function ug(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=n[0],p=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=d*r+p*o+u,e[7]=d*i+p*s+c,e[8]=d*a+p*l+h,e}function cg(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=Math.sin(n),p=Math.cos(n);return e[0]=p*r+d*o,e[1]=p*i+d*s,e[2]=p*a+d*l,e[3]=p*o-d*r,e[4]=p*s-d*i,e[5]=p*l-d*a,e[6]=u,e[7]=c,e[8]=h,e}function hg(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function dg(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}Math.hypot||(Math.hypot=function(){var e=0,t=arguments.length;while(t--)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var pg={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},gg=Ut({getKey:null,drawElement:null,getBoundingBox:null,getRotation:null,getRotationPoint:null,getRotationOffset:null,isVisible:null,getPadding:null}),fg=function(){function e(n,r){t(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=n,this.atlasSize=r.webglTexSize,this.rows=r.webglTexRows,this.enableWrapping=r.enableWrapping,this.texHeight=Math.floor(this.atlasSize/this.rows),this.maxTexWidth=this.atlasSize,this.texture=null,this.canvas=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=r.createTextureCanvas(n,this.atlasSize,this.atlasSize),this.scratch=r.createTextureCanvas(n,this.atlasSize,this.texHeight,"scratch")}return i(e,[{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.maxTexWidth,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r=this,i=this.atlasSize,a=this.rows,o=this.texHeight,s=this.getScale(t),l=s.scale,u=s.texW,c=s.texH,h=[null,null],d=function(e,r){if(n&&r){var i=r.context,a=e.x,s=e.row,u=a,c=o*s;i.save(),i.translate(u,c),i.scale(l,l),n(i,t),i.restore()}},p=function(){d(r.freePointer,r.canvas),h[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:u,h:c},h[1]={x:r.freePointer.x+u,y:r.freePointer.row*o,w:0,h:c},r.freePointer.x+=u,r.freePointer.x==i&&(r.freePointer.x=0,r.freePointer.row++)},g=function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=i-r.freePointer.x,a=u-n,s=o,l=r.freePointer.x,p=r.freePointer.row*o,g=n;t.context.drawImage(e,0,0,g,s,l,p,g,s),h[0]={x:l,y:p,w:g,h:c};var f=n,v=(r.freePointer.row+1)*o,y=a;t&&t.context.drawImage(e,f,0,y,s,0,v,y,s),h[1]={x:0,y:v,w:y,h:c},r.freePointer.x=a,r.freePointer.row++},f=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+u<=i)p();else{if(this.freePointer.row>=a-1)return!1;this.freePointer.x===i?(f(),p()):this.enableWrapping?g():(f(),p())}return this.keyToLocation.set(e,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){var t=this.atlasSize,n=this.rows,r=this.getScale(e),i=r.texW;return!(this.freePointer.x+i>t)||this.freePointer.row<n-1}},{key:"bufferIfNeeded",value:function(e){this.texture||(this.texture=Qp(e,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1)}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null,this.needsBuffer=!0)}}]),e}(),vg=function(){function e(n,r){t(this,e),this.r=n,this.opts=r,this.keyToIds=new Map,this.idToKey=new Map,this.atlases=[],this.styleKeyToAtlas=new Map,this.styleKeyNeedsRedraw=new Set,this.forceGC=!1}return i(e,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"getIdsFor",value:function(e){var t=this.keyToIds.get(e);return t||(t=new Set,this.keyToIds.set(e,t)),t}},{key:"_createAtlas",value:function(){var e=this.r,t=this.opts;return new fg(e,t)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var e=this.r,t=this.opts,n=t.webglTexSize,r=Math.floor(n/t.webglTexRows);this.scratch=t.createTextureCanvas(e,n,r,"scratch")}return this.scratch}},{key:"draw",value:function(e,t,n,r){if(this.styleKeyNeedsRedraw.has(t)){this.styleKeyNeedsRedraw["delete"](t),this.deleteKey(e,t);var i=this.styleKeyToAtlas.get(t);i&&(i.forceGC=!0),this.styleKeyToAtlas["delete"](t)}var a=this.styleKeyToAtlas.get(t);return a||(a=this.atlases[this.atlases.length-1],a&&a.canFit(n)||(a=this._createAtlas(),this.atlases.push(a)),a.draw(t,n,r),this.styleKeyToAtlas.set(t,a),this.getIdsFor(t).add(e),this.idToKey.set(e,t)),a}},{key:"getAtlas",value:function(e){return this.styleKeyToAtlas.get(e)}},{key:"hasAtlas",value:function(e){return this.styleKeyToAtlas.has(e)}},{key:"deleteKey",value:function(e,t){this.idToKey["delete"](e),this.getIdsFor(t)["delete"](e)}},{key:"checkKeyIsInvalid",value:function(e,t){if(!this.idToKey.has(e))return!1;var n=this.idToKey.get(e);return n!=t&&(this.deleteKey(e,n),!0)}},{key:"_getKeysToCollect",value:function(){var e,t=new Set,n=v(this.styleKeyToAtlas.keys());try{for(n.s();!(e=n.n()).done;){var r=e.value;0==this.getIdsFor(r).size&&t.add(r)}}catch(i){n.e(i)}finally{n.f()}return t}},{key:"gc",value:function(){var e=this,t=this.atlases.some((function(e){return e.forceGC})),n=this._getKeysToCollect();if(0!==n.size||t){var r,i=[],a=new Map,s=null,l=v(this.atlases);try{var u=function(){var t=r.value,l=t.getKeys(),u=yg(n,l);if(0===u.size&&!t.forceGC)return i.push(t),l.forEach((function(e){return a.set(e,t)})),"continue";s||(s=e._createAtlas(),i.push(s));var c,h=v(l);try{for(h.s();!(c=h.n()).done;){var d=c.value;if(!u.has(d)){var p=t.getOffsets(d),g=o(p,2),f=g[0],y=g[1];s.canFit({w:f.w+y.w,h:f.h})||(s=e._createAtlas(),i.push(s)),e._copyTextureToNewAtlas(d,t,s),a.set(d,s)}}}catch(m){h.e(m)}finally{h.f()}};for(l.s();!(r=l.n()).done;)u()}catch(c){l.e(c)}finally{l.f()}this.atlases=i,this.styleKeyToAtlas=a}else console.log("nothing to garbage collect")}},{key:"_copyTextureToNewAtlas",value:function(e,t,n){var r=t.getOffsets(e),i=o(r,2),a=i[0],s=i[1];if(0===s.w)n.draw(e,a,(function(e){e.drawImage(t.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h)}));else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,0,0,a.w,a.h),l.context.drawImage(t.canvas,s.x,s.y,s.w,s.h,a.w,0,s.w,s.h);var u=a.w+s.w,c=a.h;n.draw(e,{w:u,h:c},(function(e){e.drawImage(l,0,0,u,c,0,0,u,c)}))}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}]),e}();function yg(e,t){return e.intersection?e.intersection(t):new Set(s(e).filter((function(e){return t.has(e)})))}var mg=function(){function e(n,r){t(this,e),this.r=n;var i=r;this.globalOptions=i,this.maxAtlases=i.webglTexPerBatch,this.atlasSize=i.webglTexSize,this.renderTypes=new Map,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.batchAtlases=[],this._cacheScratchCanvas(i)}return i(e,[{key:"_cacheScratchCanvas",value:function(e){var t=-1,n=-1,r=null,i=e.createTextureCanvas;e.createTextureCanvas=function(e,a,o,s){return s?(r&&a==t&&o==n||(t=a,n=o,r=i(e,a,o)),r):i(e,a,o)}}},{key:"addRenderType",value:function(e,t){var n=new vg(this.r,this.globalOptions),r=t;this.renderTypes.set(e,re({type:e,atlasCollection:n},r))}},{key:"getRenderTypes",value:function(){return s(this.renderTypes.values())}},{key:"getRenderTypeOpts",value:function(e){return this.renderTypes.get(e)}},{key:"invalidate",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.forceRedraw,i=void 0!==r&&r,a=n.filterEle,o=void 0===a?function(){return!0}:a,s=n.filterType,l=void 0===s?function(){return!0}:s,u=!1,c=v(e);try{for(c.s();!(t=c.n()).done;){var h=t.value;if(o(h)){var d,p=h.id(),g=v(this.getRenderTypes());try{for(g.s();!(d=g.n()).done;){var f=d.value;if(l(f.type)){var y=f.getKey(h);i?(f.atlasCollection.deleteKey(p,y),f.atlasCollection.styleKeyNeedsRedraw.add(y),u=!0):u|=f.atlasCollection.checkKeyIsInvalid(p,y)}}}catch(m){g.e(m)}finally{g.f()}}}}catch(m){c.e(m)}finally{c.f()}return u}},{key:"gc",value:function(){var e,t=v(this.getRenderTypes());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.atlasCollection.gc()}}catch(r){t.e(r)}finally{t.f()}}},{key:"isRenderable",value:function(e,t){var n=this.getRenderTypeOpts(t);return n&&n.isVisible(e)}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"getOrCreateAtlas",value:function(e,t,n){var r=this.renderTypes.get(n),i=r.getKey(e),a=e.id();return r.atlasCollection.draw(a,i,t,(function(n){r.drawElement(n,e,t,!0,!0)}))}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)return;this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlases},(function(e,t){return t}))}},{key:"getAtlasInfo",value:function(e,t){var n=this.renderTypes.get(t),r=n.getBoundingBox(e),i=this.getOrCreateAtlas(e,r,t),a=this.getAtlasIndexForBatch(i);if(void 0!==a){var s=n.getKey(e),l=i.getOffsets(s),u=o(l,2),c=u[0],h=u[1];return{atlasID:a,tex:c,tex1:c,tex2:h,bb:r,type:t,styleKey:s}}}},{key:"canAddToCurrentBatch",value:function(e,t){if(this.batchAtlases.length===this.maxAtlasesPerBatch){var n=this.renderTypes.get(t),r=n.getKey(e),i=n.atlasCollection.getAtlas(r);return i&&this.batchAtlases.includes(i)}return!0}},{key:"setTransformMatrix",value:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=t.bb,a=t.type,o=t.tex1,s=t.tex2,l=this.getRenderTypeOpts(a),u=l.getPadding?l.getPadding(n):0,c=o.w/(o.w+s.w);r||(c=1-c);var h,d,p=this.getAdjustedBB(i,u,r,c);sg(e);var g=l.getRotation?l.getRotation(n):0;if(0!==g){var f=l.getRotationPoint(n),v=f.x,y=f.y;ug(e,e,[v,y]),cg(e,e,g);var m=l.getRotationOffset(n);h=m.x+p.xOffset,d=m.y}else h=p.x1,d=p.y1;ug(e,e,[h,d]),hg(e,e,[p.w,p.h])}},{key:"getTransformMatrix",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=og();return this.setTransformMatrix(r,e,t,n),r}},{key:"getAdjustedBB",value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(l=o-u,i+=l,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l}}},{key:"getDebugInfo",value:function(){var e,t=[],n=v(this.renderTypes);try{for(n.s();!(e=n.n()).done;){var r=o(e.value,2),i=r[0],a=r[1],s=a.atlasCollection.getCounts(),l=s.keyCount,u=s.atlasCount;t.push({type:i,keyCount:l,atlasCount:u})}}catch(c){n.e(c)}finally{n.f()}return t}}]),e}(),bg=0,xg=1,wg=2,Eg=3,Tg=function(){function e(n,r,i){t(this,e),this.r=n,this.gl=r,this.maxInstances=i.webglBatchSize,this.maxAtlases=i.webglTexPerBatch,this.atlasSize=i.webglTexSize,this.bgColor=i.bgColor,i.enableWrapping=!0,i.createTextureCanvas=jp,this.atlasManager=new mg(n,i),this.program=this.createShaderProgram(pg.SCREEN),this.pickingProgram=this.createShaderProgram(pg.PICKING),this.vao=this.createVAO(),this.debugInfo=[]}return i(e,[{key:"addTextureRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"invalidate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.type,r=this.atlasManager;return n?r.invalidate(e,{filterType:function(e){return e===n},forceRedraw:!0}):r.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; \n\n // what are we rendering?\n in int aVertType;\n\n // for picking\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex1; // x/y/w/h of texture in atlas\n in vec4 aTex2; \n\n // for any transforms that are needed\n in vec4 aScaleRotate1; // vectors use fewer attributes than matrices\n in vec2 aTranslate1;\n in vec4 aScaleRotate2;\n in vec2 aTranslate2;\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in float aLineWidth;\n in vec4 aEdgeColor;\n\n out vec2 vTexCoord;\n out vec4 vEdgeColor;\n flat out int vAtlasId;\n flat out vec4 vIndex;\n flat out int vVertType;\n\n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition;\n\n if(aVertType == ".concat(bg,") {\n float texX;\n float texY;\n float texW;\n float texH;\n mat3 texMatrix;\n\n int vid = gl_VertexID;\n if(vid <= 5) {\n texX = aTex1.x;\n texY = aTex1.y;\n texW = aTex1.z;\n texH = aTex1.w;\n texMatrix = mat3(\n vec3(aScaleRotate1.xy, 0.0),\n vec3(aScaleRotate2.zw, 0.0),\n vec3(aTranslate1, 1.0)\n );\n } else {\n texX = aTex2.x;\n texY = aTex2.y;\n texW = aTex2.z;\n texH = aTex2.w;\n texMatrix = mat3(\n vec3(aScaleRotate2.xy, 0.0),\n vec3(aScaleRotate2.zw, 0.0),\n vec3(aTranslate2, 1.0)\n );\n }\n\n if(vid == 1 || vid == 2 || vid == 4 || vid == 7 || vid == 8 || vid == 10) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5 || vid == 8 || vid == 10 || vid == 11) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * texMatrix * vec3(position, 1.0), 1.0);\n } \n else if(aVertType == ").concat(xg," && vid < 6) {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vEdgeColor = aEdgeColor;\n } \n else if(aVertType == ").concat(wg," && vid < 6) {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0 = pointA;\n vec2 p1 = pointB;\n vec2 p2 = pointC;\n vec2 pos = position;\n if(position.x == 1.0) {\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth;\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vEdgeColor = aEdgeColor;\n } \n else if(aVertType == ").concat(Eg," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n mat3 transform = mat3(\n vec3(aScaleRotate1.xy, 0.0),\n vec3(aScaleRotate1.zw, 0.0),\n vec3(aTranslate1, 1.0)\n );\n gl_Position = vec4(uPanZoomMatrix * transform * vec3(position, 1.0), 1.0);\n vEdgeColor = aEdgeColor;\n } else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vIndex = aIndex;\n vVertType = aVertType;\n }\n "),r=this.atlasManager.getIndexArray(),i="#version 300 es\n precision highp float;\n\n // define texture unit for each node in the batch\n ".concat(r.map((function(e){return"uniform sampler2D uTexture".concat(e,";")})).join("\n\t"),"\n\n uniform vec4 uBGColor;\n\n in vec2 vTexCoord;\n in vec4 vEdgeColor;\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n\n out vec4 outColor;\n\n void main(void) {\n if(vVertType == ").concat(bg,") {\n ").concat(r.map((function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")})).join("\n\telse "),"\n } else if(vVertType == ").concat(Eg,") {\n // blend arrow color with background (using premultiplied alpha)\n outColor.rgb = vEdgeColor.rgb + (uBGColor.rgb * (1.0 - vEdgeColor.a)); \n outColor.a = 1.0; // make opaque, masks out line under arrow\n } else {\n outColor = vEdgeColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "),a=Wp(t,n,i);a.aPosition=t.getAttribLocation(a,"aPosition"),a.aIndex=t.getAttribLocation(a,"aIndex"),a.aVertType=t.getAttribLocation(a,"aVertType"),a.aAtlasId=t.getAttribLocation(a,"aAtlasId"),a.aTex1=t.getAttribLocation(a,"aTex1"),a.aTex2=t.getAttribLocation(a,"aTex2"),a.aScaleRotate1=t.getAttribLocation(a,"aScaleRotate1"),a.aTranslate1=t.getAttribLocation(a,"aTranslate1"),a.aScaleRotate2=t.getAttribLocation(a,"aScaleRotate2"),a.aTranslate2=t.getAttribLocation(a,"aTranslate2"),a.aPointAPointB=t.getAttribLocation(a,"aPointAPointB"),a.aPointCPointD=t.getAttribLocation(a,"aPointCPointD"),a.aLineWidth=t.getAttribLocation(a,"aLineWidth"),a.aEdgeColor=t.getAttribLocation(a,"aEdgeColor"),a.uPanZoomMatrix=t.getUniformLocation(a,"uPanZoomMatrix"),a.uAtlasSize=t.getUniformLocation(a,"uAtlasSize"),a.uBGColor=t.getUniformLocation(a,"uBGColor"),a.uTextures=[];for(var o=0;o<this.atlasManager.maxAtlases;o++)a.uTextures.push(t.getUniformLocation(a,"uTexture".concat(o)));return a}},{key:"createVAO",value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1],t=[].concat(e,e);this.vertexCount=t.length/2;var n=this.maxInstances,r=this.gl,i=this.program,a=r.createVertexArray();return r.bindVertexArray(a),ng(r,"vec2",i.aPosition,t),this.indexBuffer=rg(r,n,"vec4",i.aIndex),this.vertTypeBuffer=rg(r,n,"int",i.aVertType),this.atlasIdBuffer=rg(r,n,"int",i.aAtlasId),this.tex1Buffer=rg(r,n,"vec4",i.aTex1),this.tex2Buffer=rg(r,n,"vec4",i.aTex2),this.scaleRotate1Buffer=rg(r,n,"vec4",i.aScaleRotate1),this.translate1Buffer=rg(r,n,"vec2",i.aTranslate1),this.scaleRotate2Buffer=rg(r,n,"vec4",i.aScaleRotate2),this.translate2Buffer=rg(r,n,"vec2",i.aTranslate2),this.pointAPointBBuffer=rg(r,n,"vec4",i.aPointAPointB),this.pointCPointDBuffer=rg(r,n,"vec4",i.aPointCPointD),this.lineWidthBuffer=rg(r,n,"float",i.aLineWidth),this.edgeColorBuffer=rg(r,n,"vec4",i.aEdgeColor),r.bindVertexArray(null),a}},{key:"buffers",get:function(){var e=this;return this._buffers||(this._buffers=Object.keys(this).filter((function(e){return e.endsWith("Buffer")})).map((function(t){return e[t]}))),this._buffers}},{key:"startFrame",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pg.SCREEN;this.panZoomMatrix=e,this.debugInfo=t,this.renderTarget=n,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.atlasManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"getTempMatrix",value:function(){return this.tempMatrix=this.tempMatrix||og()}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager;if(r.isRenderable(e,n)){r.canAddToCurrentBatch(e,n)||this.endBatch();var i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=bg;var a=this.indexBuffer.getView(i);Kp(t,a);var o=r.getAtlasInfo(e,n,o),s=o.atlasID,l=o.tex1,u=o.tex2,c=this.atlasIdBuffer.getView(i);c[0]=s;var h=this.tex1Buffer.getView(i);h[0]=l.x,h[1]=l.y,h[2]=l.w,h[3]=l.h;var d=this.tex2Buffer.getView(i);d[0]=u.x,d[1]=u.y,d[2]=u.w,d[3]=u.h;for(var p=this.getTempMatrix(),g=0,f=[1,2];g<f.length;g++){var v=f[g];r.setTransformMatrix(p,o,e,1===v);var y=this["scaleRotate".concat(v,"Buffer")].getView(i);y[0]=p[0],y[1]=p[1],y[2]=p[3],y[3]=p[4];var m=this["translate".concat(v,"Buffer")].getView(i);m[0]=p[6],m[1]=p[7]}this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"drawEdgeArrow",value:function(e,t,n){var r,i,a,o=e._private.rscratch;if("source"===n?(r=o.arrowStartX,i=o.arrowStartY,a=o.srcArrowAngle):(r=o.arrowEndX,i=o.arrowEndY,a=o.tgtArrowAngle),!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a)){var s=e.pstyle(n+"-arrow-shape").value;if("none"!==s){var l=e.pstyle(n+"-arrow-color").value,u=e.pstyle("opacity").value,c=e.pstyle("line-opacity").value,h=u*c,d=e.pstyle("width").pfValue,p=e.pstyle("arrow-scale").value,g=this.r.getArrowWidth(d,p),f=this.getTempMatrix();sg(f),ug(f,f,[r,i]),hg(f,f,[g,g]),cg(f,f,a);var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=Eg;var y=this.indexBuffer.getView(v);Kp(t,y);var m=this.edgeColorBuffer.getView(v);$p(l,h,m);var b=this.scaleRotate1Buffer.getView(v);b[0]=f[0],b[1]=f[1],b[2]=f[3],b[3]=f[4];var x=this.translate1Buffer.getView(v);x[0]=f[6],x[1]=f[7],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){var n=e.pstyle("opacity").value,r=e.pstyle("line-opacity").value,i=e.pstyle("width").pfValue,a=e.pstyle("line-color").value,o=n*r,s=this.getEdgePoints(e);if(s.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==s.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=xg;var u=this.indexBuffer.getView(l);Kp(t,u);var c=this.edgeColorBuffer.getView(l);$p(a,o,c);var h=this.lineWidthBuffer.getView(l);h[0]=i;var d=this.pointAPointBBuffer.getView(l);d[0]=s[0],d[1]=s[1],d[2]=s[2],d[3]=s[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var p=0;p<s.length-2;p+=2){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=wg;var f=this.indexBuffer.getView(g);Kp(t,f);var v=this.edgeColorBuffer.getView(g);$p(a,o,v);var y=this.lineWidthBuffer.getView(g);y[0]=i;var m=s[p-2],b=s[p-1],x=s[p],w=s[p+1],E=s[p+2],T=s[p+3],_=s[p+4],A=s[p+5];0==p&&(m=2*x-E+.001,b=2*w-T+.001),p==s.length-4&&(_=2*E-x+.001,A=2*T-w+.001);var C=this.pointAPointBBuffer.getView(g);C[0]=m,C[1]=b,C[2]=x,C[3]=w;var D=this.pointCPointDBuffer.getView(g);D[0]=E,D[1]=T,D[2]=_,D[3]=A,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"getEdgePoints",value:function(e){var t=e._private.rscratch,n=t.allpts;if(4==n.length)return n;var r=this.getNumSegments(e);return this.getCurveSegmentPoints(n,r)}},{key:"getNumSegments",value:function(e){var t=15;return Math.min(Math.max(t,5),this.maxInstances)}},{key:"getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array(2*(t+1)),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var i=r/t;this.setCurvePoint(e,i,n,2*r)}return n}},{key:"setCurvePoint",value:function(e,t,n,r){if(!(e.length<=2)){for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this.setCurvePoint(i,t,n,r)}n[r]=e[0],n[r+1]=e[1]}},{key:"endBatch",value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(0!==r){var i=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(i),e.bindVertexArray(t);var a,o=v(this.buffers);try{for(o.s();!(a=o.n()).done;){var s=a.value;s.bufferSubData(r)}}catch(d){o.e(d)}finally{o.f()}for(var l=this.atlasManager.getAtlases(),u=0;u<l.length;u++)l[u].bufferIfNeeded(e);for(var c=0;c<l.length;c++)e.activeTexture(e.TEXTURE0+c),e.bindTexture(e.TEXTURE_2D,l[c].texture),e.uniform1i(i.uTextures[c],c);e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.atlasManager.atlasSize);var h=$p(this.bgColor,1);e.uniform4fv(i.uBGColor,h),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debugInfo&&this.debugInfo.push({count:r,atlasCount:l.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){return this.debugInfo}},{key:"getAtlasDebugInfo",value:function(){return this.atlasManager.getDebugInfo()}}]),e}();function _g(e,t){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(t,")")}var Ag=function(){function e(n){t(this,e),this.r=n}return i(e,[{key:"getStyleKey",value:function(e,t){var n=this.getStyle(e,t),r=n.shape,i=n.opacity,a=n.color;if(!r)return null;var o=t.width(),s=t.height(),l=_g(a,i);return _t("".concat(r,"-").concat(o,"-").concat(s,"-").concat(l))}},{key:"isVisible",value:function(e,t){var n=t.pstyle("".concat(e,"-opacity")).value;return n>0}},{key:"getStyle",value:function(e,t){var n=t.pstyle("".concat(e,"-opacity")).value,r=t.pstyle("".concat(e,"-color")).value,i=t.pstyle("".concat(e,"-shape")).value;return{opacity:n,color:r,shape:i}}},{key:"getPadding",value:function(e,t){return t.pstyle("".concat(e,"-padding")).pfValue}},{key:"draw",value:function(e,t,n,r){if(this.isVisible(e,n)){var i=this.r,a=r.w,o=r.h,s=a/2,l=o/2,u=this.getStyle(e,n),c=u.shape,h=u.color,d=u.opacity;t.save(),t.fillStyle=_g(h,d),"round-rectangle"===c||"roundrectangle"===c?i.drawRoundRectanglePath(t,s,l,a,o,"auto"):"ellipse"===c&&i.drawEllipsePath(t,s,l,a,o),t.fill(),t.restore()}}}]),e}();function Cg(e){var t=e&&e.style&&e.style.backgroundColor||"white";return le(t)}var Dg={};function Ng(e){var t=e.render;e.render=function(n){n=n||{};var r=e.cy;e.webgl&&(r.zoom()>Bd?(Sg(e),t.call(e,n)):(kg(e),Fg(e,n,pg.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return Bg(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),"viewport"===t||"bounds"===t?e.pickingFrameBuffer.needsDraw=!0:"background"===t&&e.eleDrawing.invalidate(n,{type:"node-body"})}}function Sg(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function kg(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function Lg(e){var t=e.canvasWidth,n=e.canvasHeight,r=Hp(e),i=r.pan,a=r.zoom,o=og();ug(o,o,[i.x,i.y]),hg(o,o,[a,a]);var s=og();dg(s,t,n);var l=og();return lg(l,s,o),l}function Pg(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=Hp(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function Ig(e,t){e.drawSelectionRectangle(t,(function(t){return Pg(e,t)}))}function Mg(e){var t=e.data.contexts[e.NODE];t.save(),Pg(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function Og(e){var t=function(t,n,r){for(var i=t.atlasManager.getRenderTypeOpts(n),a=e.data.contexts[e.NODE],o=.125,s=i.atlasCollection.atlases,l=0;l<s.length;l++){var u=s[l],c=u.canvas,h=c.width,d=c.height,p=h*l,g=c.height*r;a.save(),a.scale(o,o),a.drawImage(c,p,g),a.strokeStyle="black",a.rect(p,g,h,d),a.stroke(),a.restore()}},n=0;t(e.eleDrawing,"node-body",n++),t(e.eleDrawing,"node-label",n++)}function Rg(e,t,n,r,i){var a,s,l,u,c=Hp(e),h=c.pan,d=c.zoom;if(void 0===r||void 0===i){var p=qp(e,h,d,t,n),g=o(p,2),f=g[0],v=g[1],y=6;a=f-y/2,s=v-y/2,l=y,u=y}else{var m=qp(e,h,d,t,n),b=o(m,2),x=b[0],w=b[1],E=qp(e,h,d,r,i),T=o(E,2),_=T[0],A=T[1];a=x,s=A,l=Math.abs(_-x),u=Math.abs(A-w)}if(0===l||0===u)return[];var C=e.data.contexts[e.WEBGL];C.bindFramebuffer(C.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(C.viewport(0,0,C.canvas.width,C.canvas.height),Fg(e,null,pg.PICKING),e.pickingFrameBuffer.needsDraw=!1);var D=l*u,N=new Uint8Array(4*D);C.readPixels(a,s,l,u,C.RGBA,C.UNSIGNED_BYTE,N),C.bindFramebuffer(C.FRAMEBUFFER,null);for(var S=new Set,k=0;k<D;k++){var L=N.slice(4*k,4*k+4),P=Zp(L)-1;P>=0&&S.add(P)}return S}function Bg(e,t,n){var r,i,a,o=Rg(e,t,n),s=e.getCachedZSortedEles(),l=v(o);try{for(l.s();!(a=l.n()).done;){var u=a.value,c=s[u];if(!r&&c.isNode()&&(r=c),!i&&c.isEdge()&&(i=c),r&&i)break}}catch(h){l.e(h)}finally{l.f()}return[r,i].filter(Boolean)}function Fg(e,t,n){var r,i;e.webglDebug&&(i=[],r=performance.now());var a=e.eleDrawing,o=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&Ig(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var s=function(e,t){t+=1,e.isNode()?(a.drawTexture(e,t,"node-underlay"),a.drawTexture(e,t,"node-body"),a.drawTexture(e,t,"node-label"),a.drawTexture(e,t,"node-overlay")):(a.drawEdgeLine(e,t),a.drawEdgeArrow(e,t,"source"),a.drawEdgeArrow(e,t,"target"),a.drawTexture(e,t,"edge-label"))},l=e.data.contexts[e.WEBGL];n.screen?(l.clearColor(0,0,0,0),l.enable(l.BLEND),l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA)):l.disable(l.BLEND),l.clear(l.COLOR_BUFFER_BIT|l.DEPTH_BUFFER_BIT),l.viewport(0,0,l.canvas.width,l.canvas.height);var u=Lg(e),c=e.getCachedZSortedEles();if(o=c.length,a.startFrame(u,i,n),n.screen){for(var h=0;h<c.nondrag.length;h++)s(c.nondrag[h],h);for(var d=0;d<c.drag.length;d++)s(c.drag[d],-1)}else if(n.picking)for(var p=0;p<c.length;p++)s(c[p],p);a.endFrame(),e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,a.gc()),n.screen&&e.webglDebugShowAtlases&&(Mg(e),Og(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var g,f=performance.now(),y=!0,m=0,b=0,x=v(i);try{for(x.s();!(g=x.n()).done;){var w=g.value;m++,b+=w.count}}catch(N){x.e(N)}finally{x.f()}var E=Math.ceil(f-r),T="".concat(o," elements, ").concat(b," rectangles, ").concat(m," batches");if(y)console.log("WebGL (".concat(n.name,") - ").concat(T));else{console.log("WebGL render (".concat(n.name,") - frame time ").concat(E,"ms")),console.log(" ".concat(T)),console.log("Texture Atlases Used:");var _,A=a.getAtlasDebugInfo(),C=v(A);try{for(C.s();!(_=C.n()).done;){var D=_.value;console.log(" ".concat(D.type,": ").concat(D.keyCount," keys, ").concat(D.atlasCount," atlases"))}}catch(N){C.e(N)}finally{C.f()}console.log("")}}}Dg.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL],i=e.cy.container();e.bgColor=Cg(i),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,console.log("max texture units",r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),console.log("max texture size",r.getParameter(r.MAX_TEXTURE_SIZE)),console.log("webgl options",e),n.pickingFrameBuffer=ig(r),n.pickingFrameBuffer.needsDraw=!0;var a=function(e){return n.getTextAngle(e,null)},o=function(e){var t=e.pstyle("label");return t&&t.value};n.eleDrawing=new Tg(n,r,e);var s=new Ag(n);n.eleDrawing.addTextureRenderType("node-body",gg({getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement,isVisible:function(e){return e.visible()}})),n.eleDrawing.addTextureRenderType("node-label",gg({getKey:t.getLabelKey,getBoundingBox:t.getLabelBox,drawElement:t.drawLabel,getRotation:a,getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:o})),n.eleDrawing.addTextureRenderType("node-overlay",gg({getBoundingBox:t.getElementBox,getKey:function(e){return s.getStyleKey("overlay",e)},drawElement:function(e,t,n){return s.draw("overlay",e,t,n)},isVisible:function(e){return s.isVisible("overlay",e)},getPadding:function(e){return s.getPadding("overlay",e)}})),n.eleDrawing.addTextureRenderType("node-underlay",gg({getBoundingBox:t.getElementBox,getKey:function(e){return s.getStyleKey("underlay",e)},drawElement:function(e,t,n){return s.draw("underlay",e,t,n)},isVisible:function(e){return s.isVisible("underlay",e)},getPadding:function(e){return s.getPadding("underlay",e)}})),n.eleDrawing.addTextureRenderType("edge-label",gg({getKey:t.getLabelKey,getBoundingBox:t.getLabelBox,drawElement:t.drawLabel,getRotation:a,getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:o}));var l=lt((function(){console.log("garbage collect flag set"),n.data.gc=!0}),1e4);n.onUpdateEleCalcs((function(e,t){var r=!1;t&&t.length>0&&(r|=n.eleDrawing.invalidate(t)),r&&l()})),Ng(n)};for(var zg={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],n+s*a[2*l+1]);e.closePath()},drawRoundPolygonPath:function(e,t,n,r,i,a,o){o.forEach((function(t){return ad(e,t)})),e.closePath()},drawRoundRectanglePath:function(e,t,n,r,i,a){var o=r/2,s=i/2,l="auto"===a?wr(r,i):Math.min(a,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,l),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.arcTo(t-o,n-s,t,n-s,l),e.lineTo(t,n-s),e.closePath()},drawBottomRoundRectanglePath:function(e,t,n,r,i,a){var o=r/2,s=i/2,l="auto"===a?wr(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},drawCutRectanglePath:function(e,t,n,r,i,a,o){var s=r/2,l=i/2,u="auto"===o?Tr():o;e.beginPath&&e.beginPath(),e.moveTo(t-s+u,n-l),e.lineTo(t+s-u,n-l),e.lineTo(t+s,n-l+u),e.lineTo(t+s,n+l-u),e.lineTo(t+s-u,n+l),e.lineTo(t-s+u,n+l),e.lineTo(t-s,n+l-u),e.lineTo(t-s,n-l+u),e.closePath()},drawBarrelPath:function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,l=t+a,u=n-o,c=n+o,h=Ar(r,i),d=h.widthOffset,p=h.heightOffset,g=h.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(s,u+p),e.lineTo(s,c-p),e.quadraticCurveTo(s+g,c,s+d,c),e.lineTo(l-d,c),e.quadraticCurveTo(l-g,c,l,c-p),e.lineTo(l,u+p),e.quadraticCurveTo(l-g,u,l-d,u),e.lineTo(s+d,u),e.quadraticCurveTo(s+g,u,s,u+p),e.closePath()}},Gg=Math.sin(0),Vg=Math.cos(0),Xg={},Yg={},Ug=Math.PI/40,Wg=0*Math.PI;Wg<2*Math.PI;Wg+=Ug)Xg[Wg]=Math.sin(Wg),Yg[Wg]=Math.cos(Wg);zg.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=Ug)a=t-s*Xg[u]*Gg+s*Yg[u]*Vg,o=n+l*Yg[u]*Gg+l*Xg[u]*Vg,0===u?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var jg={};function Hg(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}function qg(e){var t=e.indexOf(",");return e.substr(t+1)}function $g(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new ta((function(r,i){try{t.toBlob((function(e){null!=e?r(e):i(new Error("`canvas.toBlob()` sent a null value in its callback"))}),n,e.quality)}catch(a){i(a)}}));case"blob":return Hg(qg(r()),n);case"base64":return qg(r());case"base64uri":default:return r()}}jg.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},jg.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements(),r=n.boundingBox(),i=this.findContainerClientCoords(),a=e.full?Math.ceil(r.w):i[2],o=e.full?Math.ceil(r.h):i[3],s=S(e.maxWidth)||S(e.maxHeight),l=this.getPixelRatio(),u=1;if(void 0!==e.scale)a*=e.scale,o*=e.scale,u=e.scale;else if(s){var c=1/0,h=1/0;S(e.maxWidth)&&(c=u*e.maxWidth/a),S(e.maxHeight)&&(h=u*e.maxHeight/o),u=Math.min(c,h),a*=u,o*=u}s||(a*=l,o*=l,u*=l);var d=document.createElement("canvas");d.width=a,d.height=o,d.style.width=a+"px",d.style.height=o+"px";var p=d.getContext("2d");if(a>0&&o>0){p.clearRect(0,0,a,o),p.globalCompositeOperation="source-over";var g=this.getCachedZSortedEles();if(e.full)p.translate(-r.x1*u,-r.y1*u),p.scale(u,u),this.drawElements(p,g),p.scale(1/u,1/u),p.translate(r.x1*u,r.y1*u);else{var f=t.pan(),v={x:f.x*u,y:f.y*u};u*=t.zoom(),p.translate(v.x,v.y),p.scale(u,u),this.drawElements(p,g),p.scale(1/u,1/u),p.translate(-v.x,-v.y)}e.bg&&(p.globalCompositeOperation="destination-over",p.fillStyle=e.bg,p.rect(0,0,a,o),p.fill())}return d},jg.png=function(e){return $g(e,this.bufferCanvasImage(e),"image/png")},jg.jpg=function(e){return $g(e,this.bufferCanvasImage(e),"image/jpeg")};var Kg={nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},Zg=Jg,Qg=Jg.prototype;function Jg(e){var t=this,n=t.cy.window(),r=n.document;e.webgl&&(Qg.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(Qg.CANVAS_LAYERS),contexts:new Array(Qg.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Qg.CANVAS_LAYERS),bufferCanvases:new Array(Qg.BUFFER_COUNT),bufferContexts:new Array(Qg.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var o=t.data.canvasContainer.style;t.data.canvasContainer.style[i]=a,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=e.cy.container();s.appendChild(t.data.canvasContainer),s.style[i]=a;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};X()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<Qg.CANVAS_LAYERS;u++){var c=t.data.canvases[u]=r.createElement("canvas"),h=Qg.CANVAS_TYPES[u];t.data.contexts[u]=c.getContext(h),t.data.contexts[u]||Ot("Could not create canvas of type "+h),Object.keys(l).forEach((function(e){c.style[e]=l[e]})),c.style.position="absolute",c.setAttribute("data-id","layer"+u),c.style.zIndex=String(Qg.CANVAS_LAYERS-u),t.data.canvasContainer.appendChild(c),t.data.canvasNeedsRedraw[u]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[Qg.NODE].setAttribute("data-id","layer"+Qg.NODE+"-node"),t.data.canvases[Qg.SELECT_BOX].setAttribute("data-id","layer"+Qg.SELECT_BOX+"-selectbox"),t.data.canvases[Qg.DRAG].setAttribute("data-id","layer"+Qg.DRAG+"-drag"),t.data.canvases[Qg.WEBGL]&&t.data.canvases[Qg.WEBGL].setAttribute("data-id","layer"+Qg.WEBGL+"-webgl");for(u=0;u<Qg.BUFFER_COUNT;u++)t.data.bufferCanvases[u]=r.createElement("canvas"),t.data.bufferContexts[u]=t.data.bufferCanvases[u].getContext("2d"),t.data.bufferCanvases[u].style.position="absolute",t.data.bufferCanvases[u].setAttribute("data-id","buffer"+u),t.data.bufferCanvases[u].style.zIndex=String(-u-1),t.data.bufferCanvases[u].style.visibility="hidden";t.pathsEnabled=!0;var d=zn(),p=function(e){return{x:(e.x1+e.x2)/2,y:(e.y1+e.y2)/2}},g=function(e){return{x:-e.w/2,y:-e.h/2}},f=function(e){var t=e[0]._private,n=t.oldBackgroundTimestamp===t.backgroundTimestamp;return!n},v=function(e){return e[0]._private.nodeKey},y=function(e){return e[0]._private.labelStyleKey},m=function(e){return e[0]._private.sourceLabelStyleKey},b=function(e){return e[0]._private.targetLabelStyleKey},x=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},w=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)},E=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)},T=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)},_=function(e){return e.boundingBox(),e[0]._private.bodyBounds},A=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||d},C=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||d},D=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||d},N=function(e,t){return t},S=function(e){return p(_(e))},k=function(e,t,n){var r=e?e+"-":"";return{x:t.x+n.pstyle(r+"text-margin-x").pfValue,y:t.y+n.pstyle(r+"text-margin-y").pfValue}},L=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},P=function(e){return k("",L(e,"labelX","labelY"),e)},I=function(e){return k("source",L(e,"sourceLabelX","sourceLabelY"),e)},M=function(e){return k("target",L(e,"targetLabelX","targetLabelY"),e)},O=function(e){return g(_(e))},R=function(e){return g(C(e))},B=function(e){return g(D(e))},F=function(e){var t=A(e),n=g(A(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w-(t.leftPad||0);break;case"right":n.x=-(t.rightPad||0);break}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h-(t.topPad||0);break;case"bottom":n.y=-(t.botPad||0);break}}return n},z=t.data.eleTxrCache=new Jd(t,{getKey:v,doesEleInvalidateKey:f,drawElement:x,getBoundingBox:_,getRotationPoint:S,getRotationOffset:O,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),G=t.data.lblTxrCache=new Jd(t,{getKey:y,drawElement:w,getBoundingBox:A,getRotationPoint:P,getRotationOffset:F,isVisible:N}),V=t.data.slbTxrCache=new Jd(t,{getKey:m,drawElement:E,getBoundingBox:C,getRotationPoint:I,getRotationOffset:R,isVisible:N}),Y=t.data.tlbTxrCache=new Jd(t,{getKey:b,drawElement:T,getBoundingBox:D,getRotationPoint:M,getRotationOffset:B,isVisible:N}),U=t.data.lyrTxrCache=new vp(t);t.onUpdateEleCalcs((function(e,t){z.invalidateElements(t),G.invalidateElements(t),V.invalidateElements(t),Y.invalidateElements(t),U.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}}));var W=function(e){for(var t=0;t<e.length;t++)U.enqueueElementRefinement(e[t].ele)};z.onDequeue(W),G.onDequeue(W),V.onDequeue(W),Y.onDequeue(W),e.webgl&&t.initWebgl(e,{getStyleKey:v,getLabelKey:y,drawElement:x,drawLabel:w,getElementBox:_,getLabelBox:A,getElementRotationPoint:S,getElementRotationOffset:O,getLabelRotationPoint:P,getLabelRotationOffset:F})}Qg.CANVAS_LAYERS=3,Qg.SELECT_BOX=0,Qg.DRAG=1,Qg.NODE=2,Qg.WEBGL=3,Qg.CANVAS_TYPES=["2d","2d","2d","webgl2"],Qg.BUFFER_COUNT=3,Qg.TEXTURE_BUFFER=0,Qg.MOTIONBLUR_BUFFER_NODE=1,Qg.MOTIONBLUR_BUFFER_DRAG=2,Qg.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[Qg.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[Qg.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[Qg.SELECT_BOX]=t;break;case"gc":n.data.gc=!0;break}};var ef="undefined"!==typeof Path2D;Qg.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},Qg.usePaths=function(){return ef&&this.pathsEnabled},Qg.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},Qg.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},Qg.makeOffscreenCanvas=function(t,n){var r;if("undefined"!==("undefined"===typeof OffscreenCanvas?"undefined":e(OffscreenCanvas)))r=new OffscreenCanvas(t,n);else{var i=this.cy.window(),a=i.document;r=a.createElement("canvas"),r.width=t,r.height=n}return r},[wp,Dp,Mp,Rp,Bp,zp,Xp,Dg,zg,jg,Kg].forEach((function(e){re(Qg,e)}));var tf=[{name:"null",impl:Lh},{name:"base",impl:Nd},{name:"canvas",impl:Zg}],nf=[{type:"layout",extensions:kh},{type:"renderer",extensions:tf}],rf={},af={};function of(e,t,n){var r=n,i=function(n){Bt("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(Xc.prototype[t])return i(t);Xc.prototype[t]=n}else if("collection"===e){if(nc.prototype[t])return i(t);nc.prototype[t]=n}else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),D(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||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 c=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(e){return e._private.cy},d={addEventFields:function(e,t){t.layout=e,t.cy=h(e),t.target=e},bubble:function(){return!0},parent:function(e){return h(e)}};re(o,{createEmitter:function(){return this._private.emitter=new bu(d,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),Fs.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var p=sf("renderer","base"),g=p.prototype,f=n,v=n.prototype,y=function(){p.apply(this,arguments),f.apply(this,arguments)},m=y.prototype;for(var b in g){var x=g[b],w=null!=v[b];if(w)return i(b);m[b]=x}for(var E in v)m[E]=v[E];g.clientFunctions.forEach((function(e){m[e]=m[e]||function(){Ot("Renderer does not implement `renderer."+e+"()` on its prototype")}})),r=y}else if("__proto__"===e||"constructor"===e||"prototype"===e)return Ot(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return ce({map:rf,keys:[e,t],value:r})}function sf(e,t){return he({map:rf,keys:[e,t]})}function lf(e,t,n,r,i){return ce({map:af,keys:[e,t,n,r],value:i})}function uf(e,t,n,r){return he({map:af,keys:[e,t,n,r]})}var cf=function(){return 2===arguments.length?sf.apply(null,arguments):3===arguments.length?of.apply(null,arguments):4===arguments.length?uf.apply(null,arguments):5===arguments.length?lf.apply(null,arguments):void Ot("Invalid extension access syntax")};Xc.prototype.extension=cf,nf.forEach((function(e){e.extensions.forEach((function(t){of(e.type,t.name,t.impl)}))}));var hf=function e(){if(!(this instanceof e))return new e;this.length=0},df=hf.prototype;df.instanceString=function(){return"stylesheet"},df.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},df.css=function(e,t){var n=this.length-1;if(_(e))this[n].properties.push({name:e,value:t});else if(D(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(null!=s){var l=Rc.properties[o]||Rc.properties[W(o)];if(null!=l){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},df.style=df.css,df.generateStyle=function(e){var t=new Rc(e);return this.appendToStyle(t)},df.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var pf="3.31.0",gf=function(e){return void 0===e&&(e={}),D(e)?new Xc(e):_(e)?cf.apply(cf,arguments):void 0};return gf.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(gf),e.apply(null,t),this},gf.warnings=function(e){return Rt(e)},gf.version=pf,gf.stylesheet=gf.Stylesheet=hf,gf}))},7710:function(e,t,n){n(4114),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698),n(8992),n(3949),n(1454),function(t,n){e.exports=n()}(0,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=26)}([function(e,t,n){"use strict";function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(8),a=n(9);function o(e,t,n){r.call(this,n),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=n,this.bendpoints=[],this.source=e,this.target=t}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[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(e){if(this.source===e)return this.target;if(this.target===e)return this.source;throw"Node is not incident with this edge"},o.prototype.getOtherEndInGraph=function(e,t){var n=this.getOtherEnd(e),r=t.getGraphManager().getRoot();while(1){if(n.getOwner()==t)return n;if(n.getOwner()==r)break;n=n.getOwner().getParent()}return null},o.prototype.updateLength=function(){var e=new Array(4);this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),e),this.isOverlapingSourceAndTarget||(this.lengthX=e[0]-e[2],this.lengthY=e[1]-e[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},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=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=o},function(e,t,n){"use strict";function r(e){this.vGraphObject=e}e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(13),o=n(0),s=n(16),l=n(4);function u(e,t,n,o){null==n&&null==o&&(o=t),r.call(this,o),null!=e.graphManager&&(e=e.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=o,this.edges=[],this.graphManager=e,this.rect=null!=n&&null!=t?new a(t.x,t.y,n.width,n.height):new a}for(var c in u.prototype=Object.create(r.prototype),r)u[c]=r[c];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(e){this.rect.width=e},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(e){this.rect.height=e},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(e,t){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=t.width,this.rect.height=t.height},u.prototype.setCenter=function(e,t){this.rect.x=e-this.rect.width/2,this.rect.y=t-this.rect.height/2},u.prototype.setLocation=function(e,t){this.rect.x=e,this.rect.y=t},u.prototype.moveBy=function(e,t){this.rect.x+=e,this.rect.y+=t},u.prototype.getEdgeListToNode=function(e){var t=[],n=this;return n.edges.forEach((function(r){if(r.target==e){if(r.source!=n)throw"Incorrect edge source!";t.push(r)}})),t},u.prototype.getEdgesBetween=function(e){var t=[],n=this;return n.edges.forEach((function(r){if(r.source!=n&&r.target!=n)throw"Incorrect edge source and/or target";r.target!=e&&r.source!=e||t.push(r)})),t},u.prototype.getNeighborsList=function(){var e=new Set,t=this;return t.edges.forEach((function(n){if(n.source==t)e.add(n.target);else{if(n.target!=t)throw"Incorrect incidency!";e.add(n.source)}})),e},u.prototype.withChildren=function(){var e,t,n=new Set;if(n.add(this),null!=this.child)for(var r=this.child.getNodes(),i=0;i<r.length;i++)e=r[i],t=e.withChildren(),t.forEach((function(e){n.add(e)}));return n},u.prototype.getNoOfChildren=function(){var e,t=0;if(null==this.child)t=1;else for(var n=this.child.getNodes(),r=0;r<n.length;r++)e=n[r],t+=e.getNoOfChildren();return 0==t&&(t=1),t},u.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},u.prototype.calcEstimatedSize=function(){return null==this.child?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},u.prototype.scatter=function(){var e,t,n=-o.INITIAL_WORLD_BOUNDARY,r=o.INITIAL_WORLD_BOUNDARY;e=o.WORLD_CENTER_X+s.nextDouble()*(r-n)+n;var i=-o.INITIAL_WORLD_BOUNDARY,a=o.INITIAL_WORLD_BOUNDARY;t=o.WORLD_CENTER_Y+s.nextDouble()*(a-i)+i,this.rect.x=e,this.rect.y=t},u.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var e=this.getChild();if(e.updateBounds(!0),this.rect.x=e.getLeft(),this.rect.y=e.getTop(),this.setWidth(e.getRight()-e.getLeft()),this.setHeight(e.getBottom()-e.getTop()),o.NODE_DIMENSIONS_INCLUDE_LABELS){var t=e.getRight()-e.getLeft(),n=e.getBottom()-e.getTop();this.labelWidth>t&&(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)),this.labelHeight>n&&("center"==this.labelPos?this.rect.y-=(this.labelHeight-n)/2:"top"==this.labelPos&&(this.rect.y-=this.labelHeight-n),this.setHeight(this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new l(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},e.exports=u},function(e,t,n){"use strict";function r(e,t){null==e&&null==t?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(0),o=n(6),s=n(3),l=n(1),u=n(13),c=n(12),h=n(11);function d(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,null!=t&&t instanceof o?this.graphManager=t:null!=t&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var p in d.prototype=Object.create(r.prototype),r)d[p]=r[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(e,t,n){if(null==t&&null==n){var r=e;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(r)>-1)throw"Node already in graph!";return r.owner=this,this.getNodes().push(r),r}var i=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(t.owner!=n.owner||t.owner!=this)throw"Both owners must be this graph!";return t.owner!=n.owner?null:(i.source=t,i.target=n,i.isInterGraph=!1,this.getEdges().push(i),t.edges.push(i),n!=t&&n.edges.push(i),i)},d.prototype.remove=function(e){var t=e;if(e instanceof s){if(null==t)throw"Node is null!";if(null==t.owner||t.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var n=t.edges.slice(),r=n.length,i=0;i<r;i++)o=n[i],o.isInterGraph?this.graphManager.remove(o):o.source.owner.remove(o);var a=this.nodes.indexOf(t);if(-1==a)throw"Node not in owner node list!";this.nodes.splice(a,1)}else if(e instanceof l){var o=e;if(null==o)throw"Edge is null!";if(null==o.source||null==o.target)throw"Source and/or target is null!";if(null==o.source.owner||null==o.target.owner||o.source.owner!=this||o.target.owner!=this)throw"Source and/or target owner is invalid!";var u=o.source.edges.indexOf(o),c=o.target.edges.indexOf(o);if(!(u>-1&&c>-1))throw"Source and/or target doesn't know this edge!";o.source.edges.splice(u,1),o.target!=o.source&&o.target.edges.splice(c,1);a=o.source.owner.getEdges().indexOf(o);if(-1==a)throw"Not in owner's edge list!";o.source.owner.getEdges().splice(a,1)}},d.prototype.updateLeftTop=function(){for(var e,t,n,r=i.MAX_VALUE,a=i.MAX_VALUE,o=this.getNodes(),s=o.length,l=0;l<s;l++){var u=o[l];e=u.getTop(),t=u.getLeft(),r>e&&(r=e),a>t&&(a=t)}return r==i.MAX_VALUE?null:(n=void 0!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new c(this.left,this.top))},d.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,c=i.MAX_VALUE,h=-i.MAX_VALUE,d=this.nodes,p=d.length,g=0;g<p;g++){var f=d[g];e&&null!=f.child&&f.updateBounds(),t=f.getLeft(),n=f.getRight(),r=f.getTop(),a=f.getBottom(),s>t&&(s=t),l<n&&(l=n),c>r&&(c=r),h<a&&(h=a)}var v=new u(s,c,l-s,h-c);s==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),o=void 0!=d[0].getParent().paddingLeft?d[0].getParent().paddingLeft:this.margin,this.left=v.x-o,this.right=v.x+v.width+o,this.top=v.y-o,this.bottom=v.y+v.height+o},d.calculateBounds=function(e){for(var t,n,r,a,o=i.MAX_VALUE,s=-i.MAX_VALUE,l=i.MAX_VALUE,c=-i.MAX_VALUE,h=e.length,d=0;d<h;d++){var p=e[d];t=p.getLeft(),n=p.getRight(),r=p.getTop(),a=p.getBottom(),o>t&&(o=t),s<n&&(s=n),l>r&&(l=r),c<a&&(c=a)}var g=new u(o,l,s-o,c-l);return g},d.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r<n;r++){var i=t[r];e+=i.calcEstimatedSize()}return this.estimatedSize=0==e?a.EMPTY_COMPOUND_NODE_SIZE:e/Math.sqrt(this.nodes.length),this.estimatedSize},d.prototype.updateConnected=function(){var e=this;if(0!=this.nodes.length){var t,n,r=new h,i=new Set,a=this.nodes[0],o=a.withChildren();o.forEach((function(e){r.push(e),i.add(e)}));while(0!==r.length){a=r.shift(),t=a.getEdges();for(var s=t.length,l=0;l<s;l++){var u=t[l];if(n=u.getOtherEndInGraph(a,this),null!=n&&!i.has(n)){var c=n.withChildren();c.forEach((function(e){r.push(e),i.add(e)}))}}}if(this.isConnected=!1,i.size>=this.nodes.length){var d=0;i.forEach((function(t){t.owner==e&&d++})),d==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},e.exports=d},function(e,t,n){"use strict";var r,i=n(1);function a(e){r=n(5),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(null==n&&null==r&&null==i){if(null==e)throw"Graph is null!";if(null==t)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),null!=e.parent)throw"Already has a parent!";if(null!=t.child)throw"Already has a child!";return e.parent=t,t.child=e,e}i=n,r=t,n=e;var a=r.getOwner(),o=i.getOwner();if(null==a||a.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==o||o.getGraphManager()!=this)throw"Target not in this graph mgr!";if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),null==n.source||null==n.target)throw"Edge source and/or target is null!";if(-1!=n.source.edges.indexOf(n)||-1!=n.target.edges.indexOf(n))throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},a.prototype.remove=function(e){if(e instanceof r){var t=e;if(t.getGraphManager()!=this)throw"Graph not in this graph mgr";if(t!=this.rootGraph&&(null==t.parent||t.parent.graphManager!=this))throw"Invalid parent node!";var n,a=[];a=a.concat(t.getEdges());for(var o=a.length,s=0;s<o;s++)n=a[s],t.remove(n);var l,u=[];u=u.concat(t.getNodes()),o=u.length;for(s=0;s<o;s++)l=u[s],t.remove(l);t==this.rootGraph&&this.setRootGraph(null);var c=this.graphs.indexOf(t);this.graphs.splice(c,1),t.parent=null}else if(e instanceof i){if(n=e,null==n)throw"Edge is null!";if(!n.isInterGraph)throw"Not an inter-graph edge!";if(null==n.source||null==n.target)throw"Source and/or target is null!";if(-1==n.source.edges.indexOf(n)||-1==n.target.edges.indexOf(n))throw"Source and/or target doesn't know this edge!";c=n.source.edges.indexOf(n);if(n.source.edges.splice(c,1),c=n.target.edges.indexOf(n),n.target.edges.splice(c,1),null==n.source.owner||null==n.source.owner.getGraphManager())throw"Edge owner graph or owner graph manager is null!";if(-1==n.source.owner.getGraphManager().edges.indexOf(n))throw"Not in owner graph manager's edge list!";c=n.source.owner.getGraphManager().edges.indexOf(n);n.source.owner.getGraphManager().edges.splice(c,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(null==this.allNodes){for(var e=[],t=this.getGraphs(),n=t.length,r=0;r<n;r++)e=e.concat(t[r].getNodes());this.allNodes=e}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(null==this.allEdges){for(var e=[],t=this.getGraphs(),n=(t.length,0);n<t.length;n++)e=e.concat(t[n].getEdges());e=e.concat(this.edges),this.allEdges=e}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(e){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=e},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(e){if(e.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=e,null==e.parent&&(e.parent=this.layout.newNode("Root node"))},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(e,t){if(null==e||null==t)throw"assert failed";if(e==t)return!0;var n,r=e.getOwner();do{if(n=r.getParent(),null==n)break;if(n==t)return!0;if(r=n.getOwner(),null==r)break}while(1);r=t.getOwner();do{if(n=r.getParent(),null==n)break;if(n==e)return!0;if(r=n.getOwner(),null==r)break}while(1);return!1},a.prototype.calcLowestCommonAncestors=function(){for(var e,t,n,r,i,a=this.getAllEdges(),o=a.length,s=0;s<o;s++)if(e=a[s],t=e.source,n=e.target,e.lca=null,e.sourceInLca=t,e.targetInLca=n,t!=n){r=t.getOwner();while(null==e.lca){e.targetInLca=n,i=n.getOwner();while(null==e.lca){if(i==r){e.lca=i;break}if(i==this.rootGraph)break;if(null!=e.lca)throw"assert failed";e.targetInLca=i.getParent(),i=e.targetInLca.getOwner()}if(r==this.rootGraph)break;null==e.lca&&(e.sourceInLca=r.getParent(),r=e.sourceInLca.getOwner())}if(null==e.lca)throw"assert failed"}else e.lca=t.getOwner()},a.prototype.calcLowestCommonAncestor=function(e,t){if(e==t)return e.getOwner();var n=e.getOwner();do{if(null==n)break;var r=t.getOwner();do{if(null==r)break;if(r==n)return r;r=r.getParent().getOwner()}while(1);n=n.getParent().getOwner()}while(1);return n},a.prototype.calcInclusionTreeDepths=function(e,t){var n;null==e&&null==t&&(e=this.rootGraph,t=1);for(var r=e.getNodes(),i=r.length,a=0;a<i;a++)n=r[a],n.inclusionTreeDepth=t,null!=n.child&&this.calcInclusionTreeDepths(n.child,t+1)},a.prototype.includesInvalidEdge=function(){for(var e,t=this.edges.length,n=0;n<t;n++)if(e=this.edges[n],this.isOneAncestorOfOther(e.source,e.target))return!0;return!1},e.exports=a},function(e,t,n){"use strict";var r=n(0);function i(){}for(var a in r)i[a]=r[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=3*i.MAX_NODE_DISPLACEMENT_INCREMENTAL,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i},function(e,t,n){"use strict";var r=n(12);function i(){}i.calcSeparationAmount=function(e,t,n,r){if(!e.intersects(t))throw"assert failed";var i=new Array(2);this.decideDirectionsForOverlappingNodes(e,t,i),n[0]=Math.min(e.getRight(),t.getRight())-Math.max(e.x,t.x),n[1]=Math.min(e.getBottom(),t.getBottom())-Math.max(e.y,t.y),e.getX()<=t.getX()&&e.getRight()>=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]<s?s=n[0]:o=n[1],n[0]=-1*i[0]*(s/2+r),n[1]=-1*i[1]*(o/2+r)},i.decideDirectionsForOverlappingNodes=function(e,t,n){e.getCenterX()<t.getCenterX()?n[0]=-1:n[0]=1,e.getCenterY()<t.getCenterY()?n[1]=-1:n[1]=1},i.getIntersection2=function(e,t,n){var r=e.getCenterX(),i=e.getCenterY(),a=t.getCenterX(),o=t.getCenterY();if(e.intersects(t))return n[0]=r,n[1]=i,n[2]=a,n[3]=o,!0;var s=e.getX(),l=e.getY(),u=e.getRight(),c=e.getX(),h=e.getBottom(),d=e.getRight(),p=e.getWidthHalf(),g=e.getHeightHalf(),f=t.getX(),v=t.getY(),y=t.getRight(),m=t.getX(),b=t.getBottom(),x=t.getRight(),w=t.getWidthHalf(),E=t.getHeightHalf(),T=!1,_=!1;if(r===a){if(i>o)return n[0]=r,n[1]=l,n[2]=a,n[3]=b,!1;if(i<o)return n[0]=r,n[1]=h,n[2]=a,n[3]=v,!1}else if(i===o){if(r>a)return n[0]=s,n[1]=i,n[2]=y,n[3]=o,!1;if(r<a)return n[0]=u,n[1]=i,n[2]=f,n[3]=o,!1}else{var A=e.height/e.width,C=t.height/t.width,D=(o-i)/(a-r),N=void 0,S=void 0,k=void 0,L=void 0,P=void 0,I=void 0;if(-A===D?r>a?(n[0]=c,n[1]=h,T=!0):(n[0]=u,n[1]=l,T=!0):A===D&&(r>a?(n[0]=s,n[1]=l,T=!0):(n[0]=d,n[1]=h,T=!0)),-C===D?a>r?(n[2]=m,n[3]=b,_=!0):(n[2]=y,n[3]=v,_=!0):C===D&&(a>r?(n[2]=f,n[3]=v,_=!0):(n[2]=x,n[3]=b,_=!0)),T&&_)return!1;if(r>a?i>o?(N=this.getCardinalDirection(A,D,4),S=this.getCardinalDirection(C,D,2)):(N=this.getCardinalDirection(-A,D,3),S=this.getCardinalDirection(-C,D,1)):i>o?(N=this.getCardinalDirection(-A,D,1),S=this.getCardinalDirection(-C,D,3)):(N=this.getCardinalDirection(A,D,2),S=this.getCardinalDirection(C,D,4)),!T)switch(N){case 1:L=l,k=r+-g/D,n[0]=k,n[1]=L;break;case 2:k=d,L=i+p*D,n[0]=k,n[1]=L;break;case 3:L=h,k=r+g/D,n[0]=k,n[1]=L;break;case 4:k=c,L=i+-p*D,n[0]=k,n[1]=L;break}if(!_)switch(S){case 1:I=v,P=a+-E/D,n[2]=P,n[3]=I;break;case 2:P=x,I=o+w*D,n[2]=P,n[3]=I;break;case 3:I=b,P=a+E/D,n[2]=P,n[3]=I;break;case 4:P=m,I=o+-w*D,n[2]=P,n[3]=I;break}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(null==i)return this.getIntersection2(e,t,n);var a=e.x,o=e.y,s=t.x,l=t.y,u=n.x,c=n.y,h=i.x,d=i.y,p=void 0,g=void 0,f=void 0,v=void 0,y=void 0,m=void 0,b=void 0,x=void 0,w=void 0;return f=l-o,y=a-s,b=s*o-a*l,v=d-c,m=u-h,x=h*c-u*d,w=f*m-v*y,0===w?null:(p=(y*x-m*b)/w,g=(v*b-f*x)/w,new r(p,g))},i.angleOfVector=function(e,t,n,r){var i=void 0;return e!==n?(i=Math.atan((r-t)/(n-e)),n<e?i+=Math.PI:r<t&&(i+=this.TWO_PI)):i=r<t?this.ONE_AND_HALF_PI:this.HALF_PI,i},i.doIntersect=function(e,t,n,r){var i=e.x,a=e.y,o=t.x,s=t.y,l=n.x,u=n.y,c=r.x,h=r.y,d=(o-i)*(h-u)-(c-l)*(s-a);if(0===d)return!1;var p=((h-u)*(c-i)+(l-c)*(h-a))/d,g=((a-s)*(c-i)+(o-i)*(h-a))/d;return 0<p&&p<1&&0<g&&g<1},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i},function(e,t,n){"use strict";function r(){}r.sign=function(e){return e>0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r},function(e,t,n){"use strict";function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function(e){return{value:e,next:null,prev:null}},o=function(e,t,n,r){return null!==e?e.next=t:r.head=t,null!==n?n.prev=t:r.tail=t,t.prev=e,t.next=n,r.length++,t},s=function(e,t){var n=e.prev,r=e.next;return null!==n?n.next=r:t.head=r,null!==r?r.prev=n:t.tail=n,e.prev=e.next=null,t.length--,e},l=function(){function e(t){var n=this;i(this,e),this.length=0,this.head=null,this.tail=null,null!=t&&t.forEach((function(e){return n.push(e)}))}return r(e,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(e,t){return o(t.prev,a(e),t,this)}},{key:"insertAfter",value:function(e,t){return o(t,a(e),t.next,this)}},{key:"insertNodeBefore",value:function(e,t){return o(t.prev,e,t,this)}},{key:"insertNodeAfter",value:function(e,t){return o(t,e,t.next,this)}},{key:"push",value:function(e){return o(this.tail,a(e),null,this)}},{key:"unshift",value:function(e){return o(null,a(e),this.head,this)}},{key:"remove",value:function(e){return s(e,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(e){if(e<=this.length()){var t=1,n=this.head;while(t<e)n=n.next,t++;return n.value}}},{key:"set_object_at",value:function(e,t){if(e<=this.length()){var n=1,r=this.head;while(n<e)r=r.next,n++;r.value=t}}}]),e}();e.exports=l},function(e,t,n){"use strict";function r(e,t,n){this.x=null,this.y=null,null==e&&null==t&&null==n?(this.x=0,this.y=0):"number"==typeof e&&"number"==typeof t&&null==n?(this.x=e,this.y=t):"Point"==e.constructor.name&&null==t&&null==n&&(n=e,this.x=n.x,this.y=n.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(e,t,n){"Point"==e.constructor.name&&null==t&&null==n?(n=e,this.setLocation(n.x,n.y)):"number"==typeof e&&"number"==typeof t&&null==n&&(parseInt(e)==e&&parseInt(t)==t?this.move(e,t):(this.x=Math.floor(e+.5),this.y=Math.floor(t+.5)))},r.prototype.move=function(e,t){this.x=e,this.y=t},r.prototype.translate=function(e,t){this.x+=e,this.y+=t},r.prototype.equals=function(e){if("Point"==e.constructor.name){var t=e;return this.x==t.x&&this.y==t.y}return this==e},r.prototype.toString=function(){return(new r).constructor.name+"[x="+this.x+",y="+this.y+"]"},e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){this.x=0,this.y=0,this.width=0,this.height=0,null!=e&&null!=t&&null!=n&&null!=r&&(this.x=e,this.y=t,this.width=n,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(e){this.x=e},r.prototype.getY=function(){return this.y},r.prototype.setY=function(e){this.y=e},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(e){return!(this.getRight()<e.x)&&(!(this.getBottom()<e.y)&&(!(e.getRight()<this.x)&&!(e.getBottom()<this.y)))},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},e.exports=r},function(e,t,n){"use strict";var r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function i(){}i.lastID=0,i.createID=function(e){return i.isPrimitive(e)?e:(null!=e.uniqueID||(e.uniqueID=i.getString(),i.lastID++),e.uniqueID)},i.getString=function(e){return null==e&&(e=i.lastID),"Object#"+e},i.isPrimitive=function(e){var t="undefined"===typeof e?"undefined":r(e);return null==e||"object"!=t&&"function"!=t},e.exports=i},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var i=n(0),a=n(6),o=n(3),s=n(1),l=n(5),u=n(4),c=n(17),h=n(27);function d(e){h.call(this),this.layoutQuality=i.QUALITY,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=i.DEFAULT_INCREMENTAL,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=e&&(this.isRemoteUse=e)}d.RANDOM_SEED=1,d.prototype=Object.create(h.prototype),d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},d.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},d.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},d.prototype.newGraphManager=function(){var e=new a(this);return this.graphManager=e,e},d.prototype.newGraph=function(e){return new l(null,this.graphManager,e)},d.prototype.newNode=function(e){return new o(this.graphManager,e)},d.prototype.newEdge=function(e){return new s(null,null,e)},d.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},d.prototype.runLayout=function(){var e;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),e=!this.checkLayoutSuccess()&&this.layout(),"during"!==i.ANIMATE&&(e&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,e)},d.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},d.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var e=this.graphManager.getAllEdges(),t=0;t<e.length;t++)e[t];var n=this.graphManager.getRoot().getNodes();for(t=0;t<n.length;t++)n[t];this.update(this.graphManager.getRoot())}},d.prototype.update=function(e){if(null==e)this.update2();else if(e instanceof o){var t=e;if(null!=t.getChild())for(var n=t.getChild().getNodes(),r=0;r<n.length;r++)update(n[r]);if(null!=t.vGraphObject){var i=t.vGraphObject;i.update(t)}}else if(e instanceof s){var a=e;if(null!=a.vGraphObject){var u=a.vGraphObject;u.update(a)}}else if(e instanceof l){var c=e;if(null!=c.vGraphObject){var h=c.vGraphObject;h.update(c)}}},d.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=i.QUALITY,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=i.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},d.prototype.transform=function(e){if(void 0==e)this.transform(new u(0,0));else{var t=new c,n=this.graphManager.getRoot().updateLeftTop();if(null!=n){t.setWorldOrgX(e.x),t.setWorldOrgY(e.y),t.setDeviceOrgX(n.x),t.setDeviceOrgY(n.y);for(var r,i=this.getAllNodes(),a=0;a<i.length;a++)r=i[a],r.transform(t)}}},d.prototype.positionNodesRandomly=function(e){if(void 0==e)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var t,n,r=e.getNodes(),i=0;i<r.length;i++)t=r[i],n=t.getChild(),null==n||0==n.getNodes().length?t.scatter():(this.positionNodesRandomly(n),t.updateBounds())},d.prototype.getFlatForest=function(){for(var e=[],t=!0,n=this.graphManager.getRoot().getNodes(),i=!0,a=0;a<n.length;a++)null!=n[a].getChild()&&(i=!1);if(!i)return e;var o=new Set,s=[],l=new Map,u=[];u=u.concat(n);while(u.length>0&&t){s.push(u[0]);while(s.length>0&&t){var c=s[0];s.splice(0,1),o.add(c);var h=c.getEdges();for(a=0;a<h.length;a++){var d=h[a].getOtherEnd(c);if(l.get(c)!=d){if(o.has(d)){t=!1;break}s.push(d),l.set(d,c)}}}if(t){var p=[].concat(r(o));e.push(p);for(a=0;a<p.length;a++){var g=p[a],f=u.indexOf(g);f>-1&&u.splice(f,1)}o=new Set,l=new Map}else e=[]}return e},d.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i<e.bendpoints.length;i++){var a=this.newNode(null);a.setRect(new Point(0,0),new Dimension(1,1)),r.add(a);var o=this.newEdge(null);this.graphManager.add(o,n,a),t.add(a),n=a}o=this.newEdge(null);return this.graphManager.add(o,n,e.target),this.edgeToDummyNodes.set(e,t),e.isInterGraph()?this.graphManager.remove(e):r.remove(e),t},d.prototype.createBendpointsFromDummyNodes=function(){var e=[];e=e.concat(this.graphManager.getAllEdges()),e=[].concat(r(this.edgeToDummyNodes.keys())).concat(e);for(var t=0;t<e.length;t++){var n=e[t];if(n.bendpoints.length>0){for(var i=this.edgeToDummyNodes.get(n),a=0;a<i.length;a++){var o=i[a],s=new u(o.getCenterX(),o.getCenterY()),l=n.bendpoints.get(a);l.x=s.x,l.y=s.y,o.getOwner().remove(o)}this.graphManager.add(n,n.source,n.target)}}},d.transform=function(e,t,n,r){if(void 0!=n&&void 0!=r){var i=t;if(e<=50){var a=t/n;i-=(t-a)/50*(50-e)}else{var o=t*r;i+=(o-t)/50*(e-50)}return i}var s,l;return e<=50?(s=9*t/500,l=t/10):(s=9*t/50,l=-8*t),s*e+l},d.findCenterOfTree=function(e){var t=[];t=t.concat(e);var n=[],r=new Map,i=!1,a=null;1!=t.length&&2!=t.length||(i=!0,a=t[0]);for(var o=0;o<t.length;o++){var s=t[o],l=s.getNeighborsList().size;r.set(s,s.getNeighborsList().size),1==l&&n.push(s)}var u=[];u=u.concat(n);while(!i){var c=[];c=c.concat(u),u=[];for(o=0;o<t.length;o++){s=t[o];var h=t.indexOf(s);h>=0&&t.splice(h,1);var d=s.getNeighborsList();d.forEach((function(e){if(n.indexOf(e)<0){var t=r.get(e),i=t-1;1==i&&u.push(e),r.set(e,i)}}))}n=n.concat(u),1!=t.length&&2!=t.length||(i=!0,a=t[0])}return a},d.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=d},function(e,t,n){"use strict";function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},e.exports=r},function(e,t,n){"use strict";var r=n(4);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return 0!=n&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return 0!=n&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return 0!=n&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return 0!=n&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){var t=new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y));return t},e.exports=i},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var i=n(15),a=n(7),o=n(0),s=n(8),l=n(9);function u(){i.call(this),this.useSmartIdealEdgeLengthCalculation=a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=a.DEFAULT_EDGE_LENGTH,this.springConstant=a.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=a.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=a.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=a.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=a.MAX_ITERATIONS}for(var c in u.prototype=Object.create(i.prototype),i)u[c]=i[c];u.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},u.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,i,s,l=this.getGraphManager().getAllEdges(),u=0;u<l.length;u++)e=l[u],e.idealLength=this.idealEdgeLength,e.isInterGraph&&(n=e.getSource(),r=e.getTarget(),i=e.getSourceInLca().getEstimatedSize(),s=e.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(e.idealLength+=i+s-2*o.SIMPLE_NODE_SIZE),t=e.getLca().getInclusionTreeDepth(),e.idealLength+=a.DEFAULT_EDGE_LENGTH*a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(n.getInclusionTreeDepth()+r.getInclusionTreeDepth()-2*t))},u.prototype.initSpringEmbedder=function(){var e=this.getAllNodes().length;this.incremental?(e>a.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(e>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(e-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var e,t=this.getAllEdges(),n=0;n<t.length;n++)e=t[n],this.calcSpringForce(e,e.idealLength)},u.prototype.calcRepulsionForces=function(){var e,t,n,r,i,o=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),i=new Set,e=0;e<l.length;e++)n=l[e],this.calculateRepulsionForceOfANode(n,i,o,s),i.add(n);else for(e=0;e<l.length;e++)for(n=l[e],t=e+1;t<l.length;t++)r=l[t],n.getOwner()==r.getOwner()&&this.calcRepulsionForce(n,r)},u.prototype.calcGravitationalForces=function(){for(var e,t=this.getAllNodesToApplyGravitation(),n=0;n<t.length;n++)e=t[n],this.calcGravitationalForce(e)},u.prototype.moveNodes=function(){for(var e,t=this.getAllNodes(),n=0;n<t.length;n++)e=t[n],e.move()},u.prototype.calcSpringForce=function(e,t){var n,r,i,a,o=e.getSource(),s=e.getTarget();if(this.uniformLeafNodeSizes&&null==o.getChild()&&null==s.getChild())e.updateLengthSimple();else if(e.updateLength(),e.isOverlapingSourceAndTarget)return;n=e.getLength(),0!=n&&(r=this.springConstant*(n-t),i=r*(e.lengthX/n),a=r*(e.lengthY/n),o.springForceX+=i,o.springForceY+=a,s.springForceX-=i,s.springForceY-=a)},u.prototype.calcRepulsionForce=function(e,t){var n,r,i,o,u,c,h,d=e.getRect(),p=t.getRect(),g=new Array(2),f=new Array(4);if(d.intersects(p)){s.calcSeparationAmount(d,p,g,a.DEFAULT_EDGE_LENGTH/2),c=2*g[0],h=2*g[1];var v=e.noOfChildren*t.noOfChildren/(e.noOfChildren+t.noOfChildren);e.repulsionForceX-=v*c,e.repulsionForceY-=v*h,t.repulsionForceX+=v*c,t.repulsionForceY+=v*h}else this.uniformLeafNodeSizes&&null==e.getChild()&&null==t.getChild()?(n=p.getCenterX()-d.getCenterX(),r=p.getCenterY()-d.getCenterY()):(s.getIntersection(d,p,f),n=f[2]-f[0],r=f[3]-f[1]),Math.abs(n)<a.MIN_REPULSION_DIST&&(n=l.sign(n)*a.MIN_REPULSION_DIST),Math.abs(r)<a.MIN_REPULSION_DIST&&(r=l.sign(r)*a.MIN_REPULSION_DIST),i=n*n+r*r,o=Math.sqrt(i),u=this.repulsionConstant*e.noOfChildren*t.noOfChildren/i,c=u*n/o,h=u*r/o,e.repulsionForceX-=c,e.repulsionForceY-=h,t.repulsionForceX+=c,t.repulsionForceY+=h},u.prototype.calcGravitationalForce=function(e){var t,n,r,i,a,o,s,l;t=e.getOwner(),n=(t.getRight()+t.getLeft())/2,r=(t.getTop()+t.getBottom())/2,i=e.getCenterX()-n,a=e.getCenterY()-r,o=Math.abs(i)+e.getWidth()/2,s=Math.abs(a)+e.getHeight()/2,e.getOwner()==this.graphManager.getRoot()?(l=t.getEstimatedSize()*this.gravityRangeFactor,(o>l||s>l)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a)):(l=t.getEstimatedSize()*this.compoundGravityRangeFactor,(o>l||s>l)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant))},u.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,e||t},u.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},u.prototype.calcNoOfChildrenForAllNodes=function(){for(var e,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)e=t[n],e.noOfChildren=e.getNoOfChildren()},u.prototype.calcGrid=function(e){var t=0,n=0;t=parseInt(Math.ceil((e.getRight()-e.getLeft())/this.repulsionRange)),n=parseInt(Math.ceil((e.getBottom()-e.getTop())/this.repulsionRange));for(var r=new Array(t),i=0;i<t;i++)r[i]=new Array(n);for(i=0;i<t;i++)for(var a=0;a<n;a++)r[i][a]=new Array;return r},u.prototype.addNodeToGrid=function(e,t,n){var r=0,i=0,a=0,o=0;r=parseInt(Math.floor((e.getRect().x-t)/this.repulsionRange)),i=parseInt(Math.floor((e.getRect().width+e.getRect().x-t)/this.repulsionRange)),a=parseInt(Math.floor((e.getRect().y-n)/this.repulsionRange)),o=parseInt(Math.floor((e.getRect().height+e.getRect().y-n)/this.repulsionRange));for(var s=r;s<=i;s++)for(var l=a;l<=o;l++)this.grid[s][l].push(e),e.setGridCoordinates(r,i,a,o)},u.prototype.updateGrid=function(){var e,t,n=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),e=0;e<n.length;e++)t=n[e],this.addNodeToGrid(t,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},u.prototype.calculateRepulsionForceOfANode=function(e,t,n,i){if(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&n||i){var o,s=new Set;e.surrounding=new Array;for(var l=this.grid,u=e.startX-1;u<e.finishX+2;u++)for(var c=e.startY-1;c<e.finishY+2;c++)if(!(u<0||c<0||u>=l.length||c>=l[0].length))for(var h=0;h<l[u][c].length;h++)if(o=l[u][c][h],e.getOwner()==o.getOwner()&&e!=o&&!t.has(o)&&!s.has(o)){var d=Math.abs(e.getCenterX()-o.getCenterX())-(e.getWidth()/2+o.getWidth()/2),p=Math.abs(e.getCenterY()-o.getCenterY())-(e.getHeight()/2+o.getHeight()/2);d<=this.repulsionRange&&p<=this.repulsionRange&&s.add(o)}e.surrounding=[].concat(r(s))}for(u=0;u<e.surrounding.length;u++)this.calcRepulsionForce(e,e.surrounding[u])},u.prototype.calcRepulsionRange=function(){return 0},e.exports=u},function(e,t,n){"use strict";var r=n(1),i=n(7);function a(e,t,n){r.call(this,e,t,n),this.idealLength=i.DEFAULT_EDGE_LENGTH}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];e.exports=a},function(e,t,n){"use strict";var r=n(3);function i(e,t,n,i){r.call(this,e,t,n,i),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];i.prototype.setGridCoordinates=function(e,t,n,r){this.startX=e,this.finishX=t,this.startY=n,this.finishY=r},e.exports=i},function(e,t,n){"use strict";function r(e,t){this.width=0,this.height=0,null!==e&&null!==t&&(this.height=t,this.width=e)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},e.exports=r},function(e,t,n){"use strict";var r=n(14);function i(){this.map={},this.keys=[]}i.prototype.put=function(e,t){var n=r.createID(e);this.contains(n)||(this.map[n]=t,this.keys.push(e))},i.prototype.contains=function(e){r.createID(e);return null!=this.map[e]},i.prototype.get=function(e){var t=r.createID(e);return this.map[t]},i.prototype.keySet=function(){return this.keys},e.exports=i},function(e,t,n){"use strict";var r=n(14);function i(){this.set={}}i.prototype.add=function(e){var t=r.createID(e);this.contains(t)||(this.set[t]=e)},i.prototype.remove=function(e){delete this.set[r.createID(e)]},i.prototype.clear=function(){this.set={}},i.prototype.contains=function(e){return this.set[r.createID(e)]==e},i.prototype.isEmpty=function(){return 0===this.size()},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAllTo=function(e){for(var t=Object.keys(this.set),n=t.length,r=0;r<n;r++)e.push(this.set[t[r]])},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAll=function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n];this.add(r)}},e.exports=i},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=n(11),o=function(){function e(t,n){i(this,e),null===n&&void 0===n||(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=t instanceof a?t.size():t.length,this._quicksort(t,0,r-1)}return r(e,[{key:"_quicksort",value:function(e,t,n){if(t<n){var r=this._partition(e,t,n);this._quicksort(e,t,r),this._quicksort(e,r+1,n)}}},{key:"_partition",value:function(e,t,n){var r=this._get(e,t),i=t,a=n;while(1){while(this.compareFunction(r,this._get(e,a)))a--;while(this.compareFunction(this._get(e,i),r))i++;if(!(i<a))return a;this._swap(e,i,a),i++,a--}}},{key:"_get",value:function(e,t){return e instanceof a?e.get_object_at(t):e[t]}},{key:"_set",value:function(e,t,n){e instanceof a?e.set_object_at(t,n):e[t]=n}},{key:"_swap",value:function(e,t,n){var r=this._get(e,t);this._set(e,t,this._get(e,n)),this._set(e,n,r)}},{key:"_defaultCompareFunction",value:function(e,t){return t>e}}]),e}();e.exports=o},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;i(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=a,this.gap_penalty=o,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=new Array(this.iMax);for(var s=0;s<this.iMax;s++){this.grid[s]=new Array(this.jMax);for(var l=0;l<this.jMax;l++)this.grid[s][l]=0}this.tracebackGrid=new Array(this.iMax);for(var u=0;u<this.iMax;u++){this.tracebackGrid[u]=new Array(this.jMax);for(var c=0;c<this.jMax;c++)this.tracebackGrid[u][c]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(e,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var e=1;e<this.jMax;e++)this.grid[0][e]=this.grid[0][e-1]+this.gap_penalty,this.tracebackGrid[0][e]=[!1,!1,!0];for(var t=1;t<this.iMax;t++)this.grid[t][0]=this.grid[t-1][0]+this.gap_penalty,this.tracebackGrid[t][0]=[!1,!0,!1];for(var n=1;n<this.iMax;n++)for(var r=1;r<this.jMax;r++){var i=void 0;i=this.sequence1[n-1]===this.sequence2[r-1]?this.grid[n-1][r-1]+this.match_score:this.grid[n-1][r-1]+this.mismatch_penalty;var a=this.grid[n-1][r]+this.gap_penalty,o=this.grid[n][r-1]+this.gap_penalty,s=[i,a,o],l=this.arrayAllMaxIndexes(s);this.grid[n][r]=s[l[0]],this.tracebackGrid[n][r]=[l.includes(0),l.includes(1),l.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var e=[];e.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});while(e[0]){var t=e[0],n=this.tracebackGrid[t.pos[0]][t.pos[1]];n[0]&&e.push({pos:[t.pos[0]-1,t.pos[1]-1],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),n[1]&&e.push({pos:[t.pos[0]-1,t.pos[1]],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:"-"+t.seq2}),n[2]&&e.push({pos:[t.pos[0],t.pos[1]-1],seq1:"-"+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),0===t.pos[0]&&0===t.pos[1]&&this.alignments.push({sequence1:t.seq1,sequence2:t.seq2}),e.shift()}return this.alignments}},{key:"getAllIndexes",value:function(e,t){var n=[],r=-1;while(-1!==(r=e.indexOf(t,r+1)))n.push(r);return n}},{key:"arrayAllMaxIndexes",value:function(e){return this.getAllIndexes(e,Math.max.apply(null,e))}}]),e}();e.exports=a},function(e,t,n){"use strict";var r=function(){};r.FDLayout=n(18),r.FDLayoutConstants=n(7),r.FDLayoutEdge=n(19),r.FDLayoutNode=n(20),r.DimensionD=n(21),r.HashMap=n(22),r.HashSet=n(23),r.IGeometry=n(8),r.IMath=n(9),r.Integer=n(10),r.Point=n(12),r.PointD=n(4),r.RandomSeed=n(16),r.RectangleD=n(13),r.Transform=n(17),r.UniqueIDGeneretor=n(14),r.Quicksort=n(24),r.LinkedList=n(11),r.LGraphObject=n(2),r.LGraph=n(5),r.LEdge=n(1),r.LGraphManager=n(6),r.LNode=n(3),r.Layout=n(15),r.LayoutConstants=n(0),r.NeedlemanWunsch=n(25),e.exports=r},function(e,t,n){"use strict";function r(){this.listeners=[]}var i=r.prototype;i.addListener=function(e,t){this.listeners.push({event:e,callback:t})},i.removeListener=function(e,t){for(var n=this.listeners.length;n>=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n<this.listeners.length;n++){var r=this.listeners[n];e===r.event&&r.callback(t)}},e.exports=r}])}))},8664:function(e,t,n){"use strict";n.d(t,{diagram:function(){return re}});n(4114),n(8992),n(3949),n(1454);var r=n(927),i=n(8458),a=n(2469),o=n.n(a),s=n(2088),l=n.n(s),u=n(4872),c=n(9090),h=n(8602),d=(n(3512),n(1576),n(2457),n(8179),n(4038),n(8668),n(1636),n(9246),n(8845),n(742),n(6110),n(4642),function(){var e=function(e,t,n,r){for(n=n||{},r=e.length;r--;n[e[r]]=t);return n},t=[1,4],n=[1,13],r=[1,12],i=[1,15],a=[1,16],o=[1,20],s=[1,19],l=[6,7,8],u=[1,26],c=[1,24],h=[1,25],d=[6,7,11],p=[1,6,13,15,16,19,22],g=[1,33],f=[1,34],v=[1,6,7,11,13,15,16,19,22],y={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace("Stop NL ");break;case 9:r.getLogger().trace("Stop EOF ");break;case 11:r.getLogger().trace("Stop NL2 ");break;case 12:r.getLogger().trace("Stop EOF2 ");break;case 15:r.getLogger().info("Node: ",a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 16:r.getLogger().trace("Icon: ",a[s]),r.decorateNode({icon:a[s]});break;case 17:case 21:r.decorateNode({class:a[s]});break;case 18:r.getLogger().trace("SPACELIST");break;case 19:r.getLogger().trace("Node: ",a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 20:r.decorateNode({icon:a[s]});break;case 25:r.getLogger().trace("node found ..",a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 26:this.$={id:a[s],descr:a[s],type:r.nodeType.DEFAULT};break;case 27:r.getLogger().trace("node found ..",a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:n,7:[1,10],9:9,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:n,9:22,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:u,7:c,10:23,11:h},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:o,22:s}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:c,10:32,11:h},{1:[2,7],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(p,[2,14],{7:g,11:f}),e(v,[2,8]),e(v,[2,9]),e(v,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:g,11:f}),e(v,[2,11]),e(v,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(e,t){if(!t.recoverable){var n=new Error(e);throw n.hash=t,n}this.trace(e)},parse:function(e){var t=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",l=0,u=0,c=2,h=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var f in this.yy)Object.prototype.hasOwnProperty.call(this.yy,f)&&(g.yy[f]=this.yy[f]);p.setInput(e,g.yy),g.yy.lexer=p,g.yy.parser=this,"undefined"==typeof p.yylloc&&(p.yylloc={});var v=p.yylloc;a.push(v);var y=p.options&&p.options.ranges;function m(){var e;return e=r.pop()||p.lex()||h,"number"!==typeof e&&(e instanceof Array&&(r=e,e=r.pop()),e=t.symbols_[e]||e),e}"function"===typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;var b,x,w,E,T,_,A,C,D={};while(1){if(x=n[n.length-1],this.defaultActions[x]?w=this.defaultActions[x]:(null!==b&&"undefined"!=typeof b||(b=m()),w=o[x]&&o[x][b]),"undefined"===typeof w||!w.length||!w[0]){var N="";for(T in C=[],o[x])this.terminals_[T]&&T>c&&C.push("'"+this.terminals_[T]+"'");N=p.showPosition?"Parse error on line "+(l+1)+":\n"+p.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==h?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[b]||b,line:p.yylineno,loc:v,expected:C})}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+b);switch(w[0]){case 1:n.push(b),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),b=null,u=p.yyleng,s=p.yytext,l=p.yylineno,v=p.yylloc;break;case 2:if(_=this.productions_[w[1]][1],D.$=i[i.length-_],D._$={first_line:a[a.length-(_||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(_||1)].first_column,last_column:a[a.length-1].last_column},y&&(D._$.range=[a[a.length-(_||1)].range[0],a[a.length-1].range[1]]),E=this.performAction.apply(D,[s,u,l,g.yy,w[1],i,a].concat(d)),"undefined"!==typeof E)return E;_&&(n=n.slice(0,-1*_*2),i=i.slice(0,-1*_),a=a.slice(0,-1*_)),n.push(this.productions_[w[1]][0]),i.push(D.$),a.push(D._$),A=o[n[n.length-2]][n[n.length-1]],n.push(A);break;case 3:return!0}}return!0}},m=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),!1!==e)return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),!1!==e&&e):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){var e=this.conditionStack.length-1;return e>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions["INITIAL"].rules},topState:function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(e,t,n,r){switch(n){case 0:e.getLogger().trace("Found comment",t.yytext);break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:e.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return e.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:e.getLogger().trace("end icon"),this.popState();break;case 10:return e.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return e.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return e.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return e.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:e.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 22:return e.getLogger().trace("description:",t.yytext),"NODE_DESCR";case 23:this.popState();break;case 24:return this.popState(),e.getLogger().trace("node end ))"),"NODE_DEND";case 25:return this.popState(),e.getLogger().trace("node end )"),"NODE_DEND";case 26:return this.popState(),e.getLogger().trace("node end ...",t.yytext),"NODE_DEND";case 27:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 28:return this.popState(),e.getLogger().trace("node end (-"),"NODE_DEND";case 29:return this.popState(),e.getLogger().trace("node end (-"),"NODE_DEND";case 30:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 32:return e.getLogger().trace("Long description:",t.yytext),20;case 33:return e.getLogger().trace("Long description:",t.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\-\)\{\}]+)/i,/^(?:$)/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR:{rules:[22,23],inclusive:!1},NODE:{rules:[21,24,25,26,27,28,29,30,31,32,33],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return e}();function b(){this.yy={}}return y.lexer=m,b.prototype=y,y.Parser=b,new b}());d.parser=d;const p=d,g=e=>(0,r.n)(e,(0,r.g)());let f=[],v=0,y={};const m=()=>{f=[],v=0,y={}},b=function(e){for(let t=f.length-1;t>=0;t--)if(f[t].level<e)return f[t];return null},x=()=>f.length>0?f[0]:null,w=(e,t,n,i)=>{r.l.info("addNode",e,t,n,i);const a=(0,r.g)(),o={id:v++,nodeId:g(t),level:e,descr:g(n),type:i,children:[],width:(0,r.g)().mindmap.maxNodeWidth};switch(o.type){case E.ROUNDED_RECT:o.padding=2*a.mindmap.padding;break;case E.RECT:o.padding=2*a.mindmap.padding;break;case E.HEXAGON:o.padding=2*a.mindmap.padding;break;default:o.padding=a.mindmap.padding}const s=b(e);if(s)s.children.push(o),f.push(o);else{if(0!==f.length){let e=new Error('There can be only one root. No parent could be found for ("'+o.descr+'")');throw e.hash={text:"branch "+name,token:"branch "+name,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+name+'"']},e}f.push(o)}},E={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},T=(e,t)=>{switch(r.l.debug("In get type",e,t),e){case"[":return E.RECT;case"(":return")"===t?E.ROUNDED_RECT:E.CLOUD;case"((":return E.CIRCLE;case")":return E.CLOUD;case"))":return E.BANG;case"{{":return E.HEXAGON;default:return E.DEFAULT}},_=(e,t)=>{y[e]=t},A=e=>{const t=f[f.length-1];e&&e.icon&&(t.icon=g(e.icon)),e&&e.class&&(t.class=g(e.class))},C=e=>{switch(e){case E.DEFAULT:return"no-border";case E.RECT:return"rect";case E.ROUNDED_RECT:return"rounded-rect";case E.CIRCLE:return"circle";case E.CLOUD:return"cloud";case E.BANG:return"bang";case E.HEXAGON:return"hexgon";default:return"no-border"}};let D;const N=e=>{D=e},S=()=>r.l,k=e=>f[e],L=e=>y[e],P=Object.freeze(Object.defineProperty({__proto__:null,addNode:w,clear:m,decorateNode:A,getElementById:L,getLogger:S,getMindmap:x,getNodeById:k,getType:T,nodeType:E,get parseError(){return D},sanitizeText:g,setElementForId:_,setErrorHandler:N,type2Str:C},Symbol.toStringTag,{value:"Module"})),I=12;function M(e,t){e.each((function(){var e,n=(0,i.Ltv)(this),r=n.text().split(/(\s+|<br>)/).reverse(),a=[],o=1.1,s=n.attr("y"),l=parseFloat(n.attr("dy")),u=n.text(null).append("tspan").attr("x",0).attr("y",s).attr("dy",l+"em");for(let i=0;i<r.length;i++)e=r[r.length-1-i],a.push(e),u.text(a.join(" ").trim()),(u.node().getComputedTextLength()>t||"<br>"===e)&&(a.pop(),u.text(a.join(" ").trim()),a="<br>"===e?[""]:[e],u=n.append("tspan").attr("x",0).attr("y",s).attr("dy",o+"em").text(e))}))}const O=function(e,t,n){const r=5;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("d",`M0 ${t.height-r} v${-t.height+2*r} q0,-5 5,-5 h${t.width-2*r} q5,0 5,5 v${t.height-r} H0 Z`),e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},R=function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("height",t.height).attr("width",t.width)},B=function(e,t){const n=t.width,r=t.height,i=.15*n,a=.25*n,o=.35*n,s=.2*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${.25*n},${-1*n*.1}\n a${o},${o} 1 0,1 ${.4*n},${-1*n*.1}\n a${a},${a} 1 0,1 ${.35*n},${1*n*.2}\n\n a${i},${i} 1 0,1 ${.15*n},${1*r*.35}\n a${s},${s} 1 0,1 ${-1*n*.15},${1*r*.65}\n\n a${a},${i} 1 0,1 ${-1*n*.25},${.15*n}\n a${o},${o} 1 0,1 ${-1*n*.5},0\n a${i},${i} 1 0,1 ${-1*n*.25},${-1*n*.15}\n\n a${i},${i} 1 0,1 ${-1*n*.1},${-1*r*.35}\n a${s},${s} 1 0,1 ${.1*n},${-1*r*.65}\n\n H0 V0 Z`)},F=function(e,t){const n=t.width,r=t.height,i=.15*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${.25*n},${-1*r*.1}\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},${1*r*.1}\n\n a${i},${i} 1 0,0 ${.15*n},${1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${1*r*.34}\n a${i},${i} 1 0,0 ${-1*n*.15},${1*r*.33}\n\n a${i},${i} 1 0,0 ${-1*n*.25},${.15*r}\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},${-1*r*.15}\n\n a${i},${i} 1 0,0 ${-1*n*.1},${-1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${-1*r*.34}\n a${i},${i} 1 0,0 ${.1*n},${-1*r*.33}\n\n H0 V0 Z`)},z=function(e,t){e.append("circle").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("r",t.width/2)};function G(e,t,n,r,i){return e.insert("polygon",":first-child").attr("points",r.map((function(e){return e.x+","+e.y})).join(" ")).attr("transform","translate("+(i.width-t)/2+", "+n+")")}const V=function(e,t){const n=t.height,r=4,i=n/r,a=t.width-t.padding+2*i,o=[{x:i,y:0},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:i,y:-n},{x:0,y:-n/2}];G(e,a,n,o,t)},X=function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("height",t.height).attr("rx",t.padding).attr("ry",t.padding).attr("width",t.width)},Y=function(e,t,n,r){const i=n%(I-1),a=e.append("g");t.section=i;let o="section-"+i;i<0&&(o+=" section-root"),a.attr("class",(t.class?t.class+" ":"")+"mindmap-node "+o);const s=a.append("g"),l=a.append("g"),u=l.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(M,t.width),c=u.node().getBBox(),h=r.fontSize.replace?r.fontSize.replace("px",""):r.fontSize;if(t.height=c.height+1.1*h*.5+t.padding,t.width=c.width+2*t.padding,t.icon)if(t.type===E.CIRCLE){t.height+=50,t.width+=50;const e=a.append("foreignObject").attr("height","50px").attr("width",t.width).attr("style","text-align: center;");e.append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+t.width/2+", "+(t.height/2-1.5*t.padding)+")")}else{t.width+=50;const e=t.height;t.height=Math.max(e,60);const n=Math.abs(t.height-e),r=a.append("foreignObject").attr("width","60px").attr("height",t.height).attr("style","text-align: center;margin-top:"+n/2+"px;");r.append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+(25+t.width/2)+", "+(n/2+t.padding/2)+")")}else l.attr("transform","translate("+t.width/2+", "+t.padding/2+")");switch(t.type){case E.DEFAULT:O(s,t,i);break;case E.ROUNDED_RECT:X(s,t);break;case E.RECT:R(s,t);break;case E.CIRCLE:s.attr("transform","translate("+t.width/2+", "+ +t.height/2+")"),z(s,t);break;case E.CLOUD:B(s,t);break;case E.BANG:F(s,t);break;case E.HEXAGON:V(s,t);break}return _(t.id,a),t.height},U=function(e,t,n,r,i){const a=i%(I-1),o=n.x+n.width/2,s=n.y+n.height/2,l=t.x+t.width/2,u=t.y+t.height/2,c=l>o?o+Math.abs(o-l)/2:o-Math.abs(o-l)/2,h=u>s?s+Math.abs(s-u)/2:s-Math.abs(s-u)/2,d=l>o?Math.abs(o-c)/2+o:-Math.abs(o-c)/2+o,p=u>s?Math.abs(s-h)/2+s:-Math.abs(s-h)/2+s;e.append("path").attr("d","TB"===n.direction||"BT"===n.direction?`M${o},${s} Q${o},${p} ${c},${h} T${l},${u}`:`M${o},${s} Q${d},${s} ${c},${h} T${l},${u}`).attr("class","edge section-edge-"+a+" edge-depth-"+r)},W=function(e){const t=L(e.id),n=e.x||0,r=e.y||0;t.attr("transform","translate("+n+","+r+")")},j={drawNode:Y,positionNode:W,drawEdge:U};function H(e,t,n,r){j.drawNode(e,t,n,r),t.children&&t.children.forEach(((t,i)=>{H(e,t,n<0?i:n,r)}))}function q(e,t){t.edges().map(((t,n)=>{const i=t.data();if(t[0]._private.bodyBounds){const a=t[0]._private.rscratch;r.l.trace("Edge: ",n,i),e.insert("path").attr("d",`M ${a.startX},${a.startY} L ${a.midX},${a.midY} L${a.endX},${a.endY} `).attr("class","edge section-edge-"+i.section+" edge-depth-"+i.depth)}}))}function $(e,t,n,r){t.add({group:"nodes",data:{id:e.id,labelText:e.descr,height:e.height,width:e.width,level:r,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}}),e.children&&e.children.forEach((i=>{$(i,t,n,r+1),t.add({group:"edges",data:{id:`${e.id}_${i.id}`,source:e.id,target:i.id,depth:r,section:i.section}})}))}function K(e,t){return new Promise((n=>{const a=(0,i.Ltv)("body").append("div").attr("id","cy").attr("style","display:none"),s=o()({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),$(e,s,t,0),s.nodes().forEach((function(e){e.layoutDimensions=()=>{const t=e.data();return{w:t.width,h:t.height}}})),s.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),s.ready((e=>{r.l.info("Ready",e),n(s)}))}))}function Z(e){e.nodes().map(((e,t)=>{const n=e.data();n.x=e.position().x,n.y=e.position().y,j.positionNode(n);const i=L(n.nodeId);r.l.info("Id:",t,"Position: (",e.position().x,", ",e.position().y,")",n),i.attr("transform",`translate(${e.position().x-n.width/2}, ${e.position().y-n.height/2})`),i.attr("attr",`apa-${t})`)}))}o().use(l());const Q=async(e,t,n,a)=>{const o=(0,r.g)();a.db.clear(),a.parser.parse(e),r.l.debug("Renering info diagram\n"+e);const s=(0,r.g)().securityLevel;let l;"sandbox"===s&&(l=(0,i.Ltv)("#i"+t));const u="sandbox"===s?(0,i.Ltv)(l.nodes()[0].contentDocument.body):(0,i.Ltv)("body"),c=u.select("#"+t);c.append("g");const h=a.db.getMindmap(),d=c.append("g");d.attr("class","mindmap-edges");const p=c.append("g");p.attr("class","mindmap-nodes"),H(p,h,-1,o);const g=await K(h,o);q(d,g),Z(g),(0,r.s)(void 0,c,o.mindmap.padding,o.mindmap.useMaxWidth)},J={draw:Q},ee=e=>{let t="";for(let n=0;n<e.THEME_COLOR_LIMIT;n++)e["lineColor"+n]=e["lineColor"+n]||e["cScaleInv"+n],(0,u.A)(e["lineColor"+n])?e["lineColor"+n]=(0,c.A)(e["lineColor"+n],20):e["lineColor"+n]=(0,h.A)(e["lineColor"+n],20);for(let n=0;n<e.THEME_COLOR_LIMIT;n++){const r=""+(17-3*n);t+=`\n .section-${n-1} rect, .section-${n-1} path, .section-${n-1} circle, .section-${n-1} polygon, .section-${n-1} path {\n fill: ${e["cScale"+n]};\n }\n .section-${n-1} text {\n fill: ${e["cScaleLabel"+n]};\n }\n .node-icon-${n-1} {\n font-size: 40px;\n color: ${e["cScaleLabel"+n]};\n }\n .section-edge-${n-1}{\n stroke: ${e["cScale"+n]};\n }\n .edge-depth-${n-1}{\n stroke-width: ${r};\n }\n .section-${n-1} line {\n stroke: ${e["cScaleInv"+n]} ;\n stroke-width: 3;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: lightgray;\n }\n .disabled text {\n fill: #efefef;\n }\n `}return t},te=e=>`\n .edge {\n stroke-width: 3;\n }\n ${ee(e)}\n .section-root rect, .section-root path, .section-root circle, .section-root polygon {\n fill: ${e.git0};\n }\n .section-root text {\n fill: ${e.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n`,ne=te,re={db:P,renderer:J,parser:p,styles:ne}},4872:function(e,t,n){"use strict";n.d(t,{A:function(){return c}});var r=n(1258),i=n(5888);const a=e=>{const{r:t,g:n,b:a}=i.A.parse(e),o=.2126*r.A.channel.toLinear(t)+.7152*r.A.channel.toLinear(n)+.0722*r.A.channel.toLinear(a);return r.A.lang.round(o)};var o=a;const s=e=>o(e)>=.5;var l=s;const u=e=>!l(e);var c=u}}]);