diff --git a/dist/cytoscape.cjs.js b/dist/cytoscape.cjs.js index e3f88eb1d3..91459f5d91 100644 --- a/dist/cytoscape.cjs.js +++ b/dist/cytoscape.cjs.js @@ -2836,7 +2836,7 @@ var util = __webpack_require__(1); var is = __webpack_require__(0); var Event = __webpack_require__(15); -var eventRegex = /(\w+)(\.(?:\w+|\*))?/; // regex for matching event strings (e.g. "click.namespace") +var eventRegex = /^([^.]+)(\.(?:[^.]+))?$/; // regex for matching event strings (e.g. "click.namespace") var universalNamespace = '.*'; // matches as if no namespace specified and prevents users from unbinding accidentally var defaults = { @@ -3621,7 +3621,8 @@ var Element = function Element(cy, params, restore) { edges: [], // array of connected edges children: [], // array of children parent: null, // parent ref - traversalCache: {} // cache of output of traversal functions + traversalCache: {}, // cache of output of traversal functions + backgrounding: false // whether background images are loading }; // renderedPosition overrides if specified @@ -4717,7 +4718,7 @@ module.exports = Stylesheet; "use strict"; -module.exports = "3.2.5"; +module.exports = "3.2.6"; /***/ }), /* 23 */ @@ -22720,8 +22721,6 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { nodeWidth = node.width() + 2 * padding; nodeHeight = node.height() + 2 * padding; - context.lineWidth = node.pstyle('border-width').pfValue; - // // setup shift @@ -22737,16 +22736,18 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { var bgImgProp = node.pstyle('background-image'); var urls = bgImgProp.value; - var url = void 0; - var urlDefined = []; - var image = []; - var numImages = urls.length; - for (var i = 0; i < numImages; i++) { - url = urls[i]; - urlDefined[i] = url != null && url !== 'none'; - if (urlDefined[i]) { + var urlDefined = new Array(urls.length); + var image = new Array(urls.length); + var numImages = 0; + for (var i = 0; i < urls.length; i++) { + var url = urls[i]; + var defd = urlDefined[i] = url != null && url !== 'none'; + + if (defd) { var bgImgCrossOrigin = node.cy().style().getIndexedStyle(node, 'background-image-crossorigin', 'value', i); + numImages++; + // get image, and if not loaded then ask to redraw when later loaded image[i] = r.getCachedImage(url, bgImgCrossOrigin, function () { node.emitAndNotify('background'); @@ -22767,24 +22768,6 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { context.lineJoin = 'miter'; // so borders are square with the node shape - if (context.setLineDash) { - // for very outofdate browsers - switch (borderStyle) { - case 'dotted': - context.setLineDash([1, 1]); - break; - - case 'dashed': - context.setLineDash([4, 2]); - break; - - case 'solid': - case 'double': - context.setLineDash([]); - break; - } - } - var setupShapeColor = function setupShapeColor() { var bgOpy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : bgOpacity; @@ -22846,7 +22829,7 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { var prevBging = _p.backgrounding; var totalCompleted = 0; - for (var _i = 0; _i < numImages; _i++) { + for (var _i = 0; _i < image.length; _i++) { if (urlDefined[_i] && image[_i].complete && !image[_i].error) { totalCompleted++; r.drawInscribedImage(context, image[_i], node, _i, nodeOpacity); @@ -22897,6 +22880,27 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { var drawBorder = function drawBorder() { if (borderWidth > 0) { + context.lineWidth = borderWidth; + context.lineCap = 'butt'; + + if (context.setLineDash) { + // for very outofdate browsers + switch (borderStyle) { + case 'dotted': + context.setLineDash([1, 1]); + break; + + case 'dashed': + context.setLineDash([4, 2]); + break; + + case 'solid': + case 'double': + context.setLineDash([]); + break; + } + } + if (usePaths) { context.stroke(path); } else { @@ -22917,6 +22921,12 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { context.globalCompositeOperation = gco; } + + // reset in case we changed the border style + if (context.setLineDash) { + // for very outofdate browsers + context.setLineDash([]); + } } }; @@ -22974,12 +22984,6 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { drawText(); drawOverlay(); - // reset in case we changed the border style - if (context.setLineDash) { - // for very outofdate browsers - context.setLineDash([]); - } - // // clean up shift diff --git a/dist/cytoscape.js b/dist/cytoscape.js index 56dda5eb36..31855f6a31 100644 --- a/dist/cytoscape.js +++ b/dist/cytoscape.js @@ -2836,7 +2836,7 @@ var util = __webpack_require__(1); var is = __webpack_require__(0); var Event = __webpack_require__(15); -var eventRegex = /(\w+)(\.(?:\w+|\*))?/; // regex for matching event strings (e.g. "click.namespace") +var eventRegex = /^([^.]+)(\.(?:[^.]+))?$/; // regex for matching event strings (e.g. "click.namespace") var universalNamespace = '.*'; // matches as if no namespace specified and prevents users from unbinding accidentally var defaults = { @@ -3621,7 +3621,8 @@ var Element = function Element(cy, params, restore) { edges: [], // array of connected edges children: [], // array of children parent: null, // parent ref - traversalCache: {} // cache of output of traversal functions + traversalCache: {}, // cache of output of traversal functions + backgrounding: false // whether background images are loading }; // renderedPosition overrides if specified @@ -4744,7 +4745,7 @@ module.exports = Stylesheet; "use strict"; -module.exports = "3.2.5"; +module.exports = "3.2.6"; /***/ }), /* 24 */ @@ -22747,8 +22748,6 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { nodeWidth = node.width() + 2 * padding; nodeHeight = node.height() + 2 * padding; - context.lineWidth = node.pstyle('border-width').pfValue; - // // setup shift @@ -22764,16 +22763,18 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { var bgImgProp = node.pstyle('background-image'); var urls = bgImgProp.value; - var url = void 0; - var urlDefined = []; - var image = []; - var numImages = urls.length; - for (var i = 0; i < numImages; i++) { - url = urls[i]; - urlDefined[i] = url != null && url !== 'none'; - if (urlDefined[i]) { + var urlDefined = new Array(urls.length); + var image = new Array(urls.length); + var numImages = 0; + for (var i = 0; i < urls.length; i++) { + var url = urls[i]; + var defd = urlDefined[i] = url != null && url !== 'none'; + + if (defd) { var bgImgCrossOrigin = node.cy().style().getIndexedStyle(node, 'background-image-crossorigin', 'value', i); + numImages++; + // get image, and if not loaded then ask to redraw when later loaded image[i] = r.getCachedImage(url, bgImgCrossOrigin, function () { node.emitAndNotify('background'); @@ -22794,24 +22795,6 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { context.lineJoin = 'miter'; // so borders are square with the node shape - if (context.setLineDash) { - // for very outofdate browsers - switch (borderStyle) { - case 'dotted': - context.setLineDash([1, 1]); - break; - - case 'dashed': - context.setLineDash([4, 2]); - break; - - case 'solid': - case 'double': - context.setLineDash([]); - break; - } - } - var setupShapeColor = function setupShapeColor() { var bgOpy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : bgOpacity; @@ -22873,7 +22856,7 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { var prevBging = _p.backgrounding; var totalCompleted = 0; - for (var _i = 0; _i < numImages; _i++) { + for (var _i = 0; _i < image.length; _i++) { if (urlDefined[_i] && image[_i].complete && !image[_i].error) { totalCompleted++; r.drawInscribedImage(context, image[_i], node, _i, nodeOpacity); @@ -22924,6 +22907,27 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { var drawBorder = function drawBorder() { if (borderWidth > 0) { + context.lineWidth = borderWidth; + context.lineCap = 'butt'; + + if (context.setLineDash) { + // for very outofdate browsers + switch (borderStyle) { + case 'dotted': + context.setLineDash([1, 1]); + break; + + case 'dashed': + context.setLineDash([4, 2]); + break; + + case 'solid': + case 'double': + context.setLineDash([]); + break; + } + } + if (usePaths) { context.stroke(path); } else { @@ -22944,6 +22948,12 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { context.globalCompositeOperation = gco; } + + // reset in case we changed the border style + if (context.setLineDash) { + // for very outofdate browsers + context.setLineDash([]); + } } }; @@ -23001,12 +23011,6 @@ CRp.drawNode = function (context, node, shiftToOriginWithBb, drawLabel) { drawText(); drawOverlay(); - // reset in case we changed the border style - if (context.setLineDash) { - // for very outofdate browsers - context.setLineDash([]); - } - // // clean up shift diff --git a/dist/cytoscape.min.js b/dist/cytoscape.min.js index 7df0d7e95e..90c8156a5d 100644 --- a/dist/cytoscape.min.js +++ b/dist/cytoscape.min.js @@ -1,10 +1,10 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.cytoscape=t():e.cytoscape=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=117)}([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},i=n(4),a=i?i.navigator:null,o=i?i.document:null,s=r(""),l=r({}),u=r(function(){}),c="undefined"==typeof HTMLElement?"undefined":r(HTMLElement),d=function(e){return e&&e.instanceString&&h.fn(e.instanceString)?e.instanceString():null},h={defined:function(e){return null!=e},string:function(e){return null!=e&&(void 0===e?"undefined":r(e))==s},fn:function(e){return null!=e&&(void 0===e?"undefined":r(e))===u},array:function(e){return Array.isArray?Array.isArray(e):null!=e&&e instanceof Array},plainObject:function(e){return null!=e&&(void 0===e?"undefined":r(e))===l&&!h.array(e)&&e.constructor===Object},object:function(e){return null!=e&&(void 0===e?"undefined":r(e))===l},number:function(e){return null!=e&&(void 0===e?"undefined":r(e))===r(1)&&!isNaN(e)},integer:function(e){return h.number(e)&&Math.floor(e)===e},bool:function(e){return null!=e&&(void 0===e?"undefined":r(e))===r(!0)},htmlElement:function(e){return"undefined"===c?void 0:null!=e&&e instanceof HTMLElement},elementOrCollection:function(e){return h.element(e)||h.collection(e)},element:function(e){return"collection"===d(e)&&e._private.single},collection:function(e){return"collection"===d(e)&&!e._private.single},core:function(e){return"core"===d(e)},style:function(e){return"style"===d(e)},stylesheet:function(e){return"stylesheet"===d(e)},event:function(e){return"event"===d(e)},thread:function(e){return"thread"===d(e)},fabric:function(e){return"fabric"===d(e)},emptyString:function(e){return void 0===e||null===e||!(""!==e&&!e.match(/^\s+$/))},nonemptyString:function(e){return!(!e||!h.string(e)||""===e||e.match(/^\s+$/))},domElement:function(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement},boundingBox:function(e){return h.plainObject(e)&&h.number(e.x1)&&h.number(e.x2)&&h.number(e.y1)&&h.number(e.y2)},promise:function(e){return h.object(e)&&h.fn(e.then)},touch:function(){return i&&("ontouchstart"in i||i.DocumentTouch&&o instanceof DocumentTouch)},gecko:function(){return i&&("undefined"!=typeof InstallTrigger||"MozAppearance"in o.documentElement.style)},webkit:function(){return i&&("undefined"!=typeof webkitURL||"WebkitAppearance"in o.documentElement.style)},chromium:function(){return i&&"undefined"!=typeof chrome},khtml:function(){return a&&a.vendor.match(/kde/i)},khtmlEtc:function(){return h.khtml()||h.webkit()||h.chromium()},ms:function(){return a&&a.userAgent.match(/msie|trident|edge/i)},windows:function(){return a&&a.appVersion.match(/Win/i)},mac:function(){return a&&a.appVersion.match(/Mac/i)},linux:function(){return a&&a.appVersion.match(/Linux/i)},unix:function(){return a&&a.appVersion.match(/X11/i)}};e.exports=h},function(e,t,n){"use strict";var r=n(0),i=n(2),a={MAX_INT:Number.MAX_SAFE_INTEGER||9007199254740991,trueify:function(){return!0},falsify:function(){return!1},zeroify:function(){return 0},noop:function(){},error:function(e){console.error?(console.error.apply(console,arguments),console.trace&&console.trace()):(console.log.apply(console,arguments),console.trace&&console.trace())},clone:function(e){return this.extend({},e)},copy:function(e){return null==e?e:r.array(e)?e.slice():r.plainObject(e)?this.clone(e):e},copyArray:function(e){return e.slice()},clonePosition:function(e){return{x:e.x,y:e.y}},uuid: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}};a.makeBoundingBox=i.makeBoundingBox.bind(i),a._staticEmptyObject={},a.staticEmptyObject=function(){return a._staticEmptyObject},a.extend=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n=0&&(e[r]!==t||(e.splice(r,1),n));r--);},a.clearArray=function(e){e.splice(0,e.length)},a.push=function(e,t){for(var n=0;n0?1:e<0?-1:0},r.dist=function(e,t){return Math.sqrt(r.sqdist(e,t))},r.sqdist=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},r.qbezierAt=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},r.qbezierPtAt=function(e,t,n,i){return{x:r.qbezierAt(e.x,t.x,n.x,i),y:r.qbezierAt(e.y,t.y,n.y,i)}},r.lineAt=function(e,t,n,i){var a={x:t.x-e.x,y:t.y-e.y},o=r.dist(e,t),s={x:a.x/o,y:a.y/o};return n=null==n?0:n,i=null!=i?i:n*o,{x:e.x+s.x*i,y:e.y+s.y*i}},r.lineAtDist=function(e,t,n){return r.lineAt(e,t,void 0,n)},r.triangleAngle=function(e,t,n){var i=r.dist(t,n),a=r.dist(e,n),o=r.dist(e,t);return Math.acos((i*i+a*a-o*o)/(2*i*a))},r.bound=function(e,t,n){return Math.max(e,Math.min(n,t))},r.makeBoundingBox=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}}},r.updateBoundingBox=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},r.expandBoundingBoxByPoint=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},r.expandBoundingBox=function(e,t){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},r.boundingBoxesIntersect=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},r.inBoundingBox=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},r.pointInBoundingBox=function(e,t){return this.inBoundingBox(e,t.x,t.y)},r.boundingBoxInBoundingBox=function(e,t){return r.inBoundingBox(e,t.x1,t.y1)&&r.inBoundingBox(e,t.x2,t.y2)},r.roundRectangleIntersectLine=function(e,t,n,r,i,a,o){var s=this.getRoundRectangleRadius(i,a),l=i/2,u=a/2,c=void 0,d=n-l+s-o,h=r-u-o,p=n+l-s+o,f=h;if(c=this.finiteLinesIntersect(e,t,n,r,d,h,p,f,!1),c.length>0)return c;var v=n+l+o,g=r-u+s-o,m=v,y=r+u-s+o;if(c=this.finiteLinesIntersect(e,t,n,r,v,g,m,y,!1),c.length>0)return c;var b=n-l+s-o,x=r+u+o,w=n+l-s+o,E=x;if(c=this.finiteLinesIntersect(e,t,n,r,b,x,w,E,!1),c.length>0)return c;var P=n-l-o,T=r-u+s-o,C=P,S=r+u-s+o;if(c=this.finiteLinesIntersect(e,t,n,r,P,T,C,S,!1),c.length>0)return c;var D=void 0,k=n-l+s,_=r-u+s;if(D=this.intersectLineCircle(e,t,n,r,k,_,s+o),D.length>0&&D[0]<=k&&D[1]<=_)return[D[0],D[1]];var M=n+l-s,I=r-u+s;if(D=this.intersectLineCircle(e,t,n,r,M,I,s+o),D.length>0&&D[0]>=M&&D[1]<=I)return[D[0],D[1]];var N=n+l-s,B=r+u-s;if(D=this.intersectLineCircle(e,t,n,r,N,B,s+o),D.length>0&&D[0]>=N&&D[1]>=B)return[D[0],D[1]];var z=n-l+s,L=r+u-s;return D=this.intersectLineCircle(e,t,n,r,z,L,s+o),D.length>0&&D[0]<=z&&D[1]>=L?[D[0],D[1]]:[]},r.inLineVicinity=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),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},r.inBezierVicinity=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!(eu.x2||tu.y2)},r.solveQuadratic=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;return[(-t+a)/o,(-t-a)/o]},r.solveCubic=function(e,t,n,r,i){t/=e,n/=e,r/=e;var a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=void 0,d=void 0,h=void 0;return 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,d=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]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,void(i[5]=-d)):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,void(i[4]=i[2]=-(h+d))):(o=-o,l=o*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),void(i[4]=-d+h*Math.cos((l+4*Math.PI)/3))))},r.sqdistToQuadraticBezier=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,d=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,h=[];this.solveCubic(l,u,c,d,h);for(var p=[],f=0;f<6;f+=2)Math.abs(h[f+1])<1e-7&&h[f]>=0&&h[f]<=1&&p.push(h[f]);p.push(1),p.push(0);for(var v=-1,g=void 0,m=void 0,y=void 0,b=0;b=0?yl?(e-i)*(e-i)+(t-a)*(t-a):u-d},r.pointInsidePolygonPoints=function(e,t,n){for(var r=void 0,i=void 0,a=void 0,o=void 0,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},r.pointInsidePolygon=function(e,t,n,i,a,o,s,l,u){var c=new Array(n.length),d=void 0;null!=l[0]?(d=Math.atan(l[1]/l[0]),l[0]<0?d+=Math.PI/2:d=-d-Math.PI/2):d=l;for(var h=Math.cos(-d),p=Math.sin(-d),f=0;f0){var g=this.expandPolygon(c,-u);v=this.joinLines(g)}else v=c;return r.pointInsidePolygonPoints(e,t,v)},r.joinLines=function(e){for(var t=new Array(e.length/2),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=0;c=0&&v<=1&&m.push(v),g>=0&&g<=1&&m.push(g),0===m.length)return[];var y=m[0]*s[0]+e,b=m[0]*s[1]+t;if(m.length>1){if(m[0]==m[1])return[y,b];return[y,b,m[1]*s[0]+e,m[1]*s[1]+t]}return[y,b]},r.findCircleNearPoint=function(e,t,n,r,i){var a=r-e,o=i-t,s=Math.sqrt(a*a+o*o);return[e+a/s*n,t+o/s*n]},r.findMaxSqDistanceToOrigin=function(e){for(var t=1e-6,n=void 0,r=0;rt&&(t=n);return t},r.midOfThree=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},r.finiteLinesIntersect=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,v=d*h-f*u,g=c*h-p*u,m=f*c-d*p;if(0!==m){var y=v/m,b=g/m;return-.001<=y&&y<=1.001&&-.001<=b&&b<=1.001?[e+y*c,t+y*p]:l?[e+y*c,t+y*p]:[]}return 0===v||0===g?this.midOfThree(e,n,o)===o?[o,s]:this.midOfThree(e,n,i)===i?[i,a]:this.midOfThree(i,o,n)===n?[n,r]:[]:[]},r.polygonIntersectLine=function(e,t,n,i,a,o,s,l){var u=[],c=void 0,d=new Array(n.length),h=!0;5===arguments.length&&(h=!1);var p=void 0;if(h){for(var f=0;f0){var v=r.expandPolygon(d,-l);p=r.joinLines(v)}else p=d}else p=n;for(var g=void 0,m=void 0,y=void 0,b=void 0,x=0;x "+t(r.target)),null!=r.connectedNodes){var h=r.connectedNodes;o=t(h[0])+" <-> "+t(h[1])}return null!=r.parent&&(o=t(r.parent)+" > "+o),null!=r.ancestor&&(o=t(r.ancestor)+" "+o),null!=r.child&&(o+=" > "+t(r.child)),null!=r.descendant&&(o+=" "+t(r.descendant)),o}(o),this.length>1&&e0&&i.plainObject(t[0])&&!i.element(t[0])){c=!0;for(var d=[],h=new o,p=0,f=t.length;p0){for(var R=new u(n,d),V=0;V0&&(e&&this.cy().notify({type:"remove",eles:E}),E.emit("remove"));for(var P=0;P=0;s--)!function(i){var s=o[i];c(a,function(e,t,n,r,a,l){if(s.type===n&&(!r||s.namespace===r)&&(!a||e.qualifierCompare(s.qualifier,a))&&(!l||s.callback===l))return o.splice(i,1),!1},e,t,n,r)}(s);return this},u.emit=u.trigger=function(e,t,n){var r=this.listeners,o=r.length;return this.emitting++,a.array(t)||(t=[t]),h(this,function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],o=r.length);for(var s=0;s0?d.wheelSensitivity:1,motionBlur:void 0!==d.motionBlur&&d.motionBlur,motionBlurOpacity:void 0===d.motionBlurOpacity?.05:d.motionBlurOpacity,pixelRatio:o.number(d.pixelRatio)&&d.pixelRatio>0?d.pixelRatio:void 0,desktopTapThreshold:void 0===d.desktopTapThreshold?4:d.desktopTapThreshold,touchTapThreshold:void 0===d.touchTapThreshold?8:d.touchTapThreshold},d.renderer));var v=function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(o.plainObject(e)||o.array(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.notify({type:"load",eles:t.mutableElements()}),t.one("load",n),t.emit("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var s=i.extend({},t._private.options.layout);s.eles=t.elements(),t.layout(s).run()};!function(e,t){if(e.some(o.promise))return s.all(e).then(t);t(e)}([d.style,d.elements],function(e){var n=e[0],r=e[1];p.styleEnabled&&t.style().append(n),v(r,function(){t.startAnimationLoop(),p.ready=!0,o.fn(d.ready)&&t.on("ready",d.ready);for(var e=0;e=0&&(e[r]!==t||(e.splice(r,1),n));r--);},a.clearArray=function(e){e.splice(0,e.length)},a.push=function(e,t){for(var n=0;n0?1:e<0?-1:0},r.dist=function(e,t){return Math.sqrt(r.sqdist(e,t))},r.sqdist=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},r.qbezierAt=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},r.qbezierPtAt=function(e,t,n,i){return{x:r.qbezierAt(e.x,t.x,n.x,i),y:r.qbezierAt(e.y,t.y,n.y,i)}},r.lineAt=function(e,t,n,i){var a={x:t.x-e.x,y:t.y-e.y},o=r.dist(e,t),s={x:a.x/o,y:a.y/o};return n=null==n?0:n,i=null!=i?i:n*o,{x:e.x+s.x*i,y:e.y+s.y*i}},r.lineAtDist=function(e,t,n){return r.lineAt(e,t,void 0,n)},r.triangleAngle=function(e,t,n){var i=r.dist(t,n),a=r.dist(e,n),o=r.dist(e,t);return Math.acos((i*i+a*a-o*o)/(2*i*a))},r.bound=function(e,t,n){return Math.max(e,Math.min(n,t))},r.makeBoundingBox=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}}},r.updateBoundingBox=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},r.expandBoundingBoxByPoint=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},r.expandBoundingBox=function(e,t){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},r.boundingBoxesIntersect=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},r.inBoundingBox=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},r.pointInBoundingBox=function(e,t){return this.inBoundingBox(e,t.x,t.y)},r.boundingBoxInBoundingBox=function(e,t){return r.inBoundingBox(e,t.x1,t.y1)&&r.inBoundingBox(e,t.x2,t.y2)},r.roundRectangleIntersectLine=function(e,t,n,r,i,a,o){var s=this.getRoundRectangleRadius(i,a),l=i/2,u=a/2,c=void 0,d=n-l+s-o,h=r-u-o,p=n+l-s+o,f=h;if(c=this.finiteLinesIntersect(e,t,n,r,d,h,p,f,!1),c.length>0)return c;var v=n+l+o,g=r-u+s-o,m=v,y=r+u-s+o;if(c=this.finiteLinesIntersect(e,t,n,r,v,g,m,y,!1),c.length>0)return c;var b=n-l+s-o,x=r+u+o,w=n+l-s+o,E=x;if(c=this.finiteLinesIntersect(e,t,n,r,b,x,w,E,!1),c.length>0)return c;var P=n-l-o,T=r-u+s-o,C=P,S=r+u-s+o;if(c=this.finiteLinesIntersect(e,t,n,r,P,T,C,S,!1),c.length>0)return c;var D=void 0,k=n-l+s,_=r-u+s;if(D=this.intersectLineCircle(e,t,n,r,k,_,s+o),D.length>0&&D[0]<=k&&D[1]<=_)return[D[0],D[1]];var M=n+l-s,I=r-u+s;if(D=this.intersectLineCircle(e,t,n,r,M,I,s+o),D.length>0&&D[0]>=M&&D[1]<=I)return[D[0],D[1]];var N=n+l-s,B=r+u-s;if(D=this.intersectLineCircle(e,t,n,r,N,B,s+o),D.length>0&&D[0]>=N&&D[1]>=B)return[D[0],D[1]];var z=n-l+s,L=r+u-s;return D=this.intersectLineCircle(e,t,n,r,z,L,s+o),D.length>0&&D[0]<=z&&D[1]>=L?[D[0],D[1]]:[]},r.inLineVicinity=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),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},r.inBezierVicinity=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!(eu.x2||tu.y2)},r.solveQuadratic=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;return[(-t+a)/o,(-t-a)/o]},r.solveCubic=function(e,t,n,r,i){t/=e,n/=e,r/=e;var a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=void 0,d=void 0,h=void 0;return 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,d=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]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,void(i[5]=-d)):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,void(i[4]=i[2]=-(h+d))):(o=-o,l=o*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),void(i[4]=-d+h*Math.cos((l+4*Math.PI)/3))))},r.sqdistToQuadraticBezier=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,d=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,h=[];this.solveCubic(l,u,c,d,h);for(var p=[],f=0;f<6;f+=2)Math.abs(h[f+1])<1e-7&&h[f]>=0&&h[f]<=1&&p.push(h[f]);p.push(1),p.push(0);for(var v=-1,g=void 0,m=void 0,y=void 0,b=0;b=0?yl?(e-i)*(e-i)+(t-a)*(t-a):u-d},r.pointInsidePolygonPoints=function(e,t,n){for(var r=void 0,i=void 0,a=void 0,o=void 0,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},r.pointInsidePolygon=function(e,t,n,i,a,o,s,l,u){var c=new Array(n.length),d=void 0;null!=l[0]?(d=Math.atan(l[1]/l[0]),l[0]<0?d+=Math.PI/2:d=-d-Math.PI/2):d=l;for(var h=Math.cos(-d),p=Math.sin(-d),f=0;f0){var g=this.expandPolygon(c,-u);v=this.joinLines(g)}else v=c;return r.pointInsidePolygonPoints(e,t,v)},r.joinLines=function(e){for(var t=new Array(e.length/2),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=0;c=0&&v<=1&&m.push(v),g>=0&&g<=1&&m.push(g),0===m.length)return[];var y=m[0]*s[0]+e,b=m[0]*s[1]+t;if(m.length>1){if(m[0]==m[1])return[y,b];return[y,b,m[1]*s[0]+e,m[1]*s[1]+t]}return[y,b]},r.findCircleNearPoint=function(e,t,n,r,i){var a=r-e,o=i-t,s=Math.sqrt(a*a+o*o);return[e+a/s*n,t+o/s*n]},r.findMaxSqDistanceToOrigin=function(e){for(var t=1e-6,n=void 0,r=0;rt&&(t=n);return t},r.midOfThree=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},r.finiteLinesIntersect=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,v=d*h-f*u,g=c*h-p*u,m=f*c-d*p;if(0!==m){var y=v/m,b=g/m;return-.001<=y&&y<=1.001&&-.001<=b&&b<=1.001?[e+y*c,t+y*p]:l?[e+y*c,t+y*p]:[]}return 0===v||0===g?this.midOfThree(e,n,o)===o?[o,s]:this.midOfThree(e,n,i)===i?[i,a]:this.midOfThree(i,o,n)===n?[n,r]:[]:[]},r.polygonIntersectLine=function(e,t,n,i,a,o,s,l){var u=[],c=void 0,d=new Array(n.length),h=!0;5===arguments.length&&(h=!1);var p=void 0;if(h){for(var f=0;f0){var v=r.expandPolygon(d,-l);p=r.joinLines(v)}else p=d}else p=n;for(var g=void 0,m=void 0,y=void 0,b=void 0,x=0;x "+t(r.target)),null!=r.connectedNodes){var h=r.connectedNodes;o=t(h[0])+" <-> "+t(h[1])}return null!=r.parent&&(o=t(r.parent)+" > "+o),null!=r.ancestor&&(o=t(r.ancestor)+" "+o),null!=r.child&&(o+=" > "+t(r.child)),null!=r.descendant&&(o+=" "+t(r.descendant)),o}(o),this.length>1&&e0&&i.plainObject(t[0])&&!i.element(t[0])){c=!0;for(var d=[],h=new o,p=0,f=t.length;p0){for(var R=new u(n,d),V=0;V0&&(e&&this.cy().notify({type:"remove",eles:E}),E.emit("remove"));for(var P=0;P=0;s--)!function(i){var s=o[i];c(a,function(e,t,n,r,a,l){if(s.type===n&&(!r||s.namespace===r)&&(!a||e.qualifierCompare(s.qualifier,a))&&(!l||s.callback===l))return o.splice(i,1),!1},e,t,n,r)}(s);return this},u.emit=u.trigger=function(e,t,n){var r=this.listeners,o=r.length;return this.emitting++,a.array(t)||(t=[t]),h(this,function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],o=r.length);for(var s=0;s0?d.wheelSensitivity:1,motionBlur:void 0!==d.motionBlur&&d.motionBlur,motionBlurOpacity:void 0===d.motionBlurOpacity?.05:d.motionBlurOpacity,pixelRatio:o.number(d.pixelRatio)&&d.pixelRatio>0?d.pixelRatio:void 0,desktopTapThreshold:void 0===d.desktopTapThreshold?4:d.desktopTapThreshold,touchTapThreshold:void 0===d.touchTapThreshold?8:d.touchTapThreshold},d.renderer));var v=function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(o.plainObject(e)||o.array(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.notify({type:"load",eles:t.mutableElements()}),t.one("load",n),t.emit("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var s=i.extend({},t._private.options.layout);s.eles=t.elements(),t.layout(s).run()};!function(e,t){if(e.some(o.promise))return s.all(e).then(t);t(e)}([d.style,d.elements],function(e){var n=e[0],r=e[1];p.styleEnabled&&t.style().append(n),v(r,function(){t.startAnimationLoop(),p.ready=!0,o.fn(d.ready)&&t.on("ready",d.ready);for(var e=0;e=e.deqFastCost*g)break}else if(a){if(f>=e.deqCost*u||f>=e.deqAvgCost*l)break}else if(v>=e.deqNoDrawCost*(1e3/60))break;var m=e.deq(t,h,d);if(!(m.length>0))break;for(var y=0;y0&&(e.onDeqd(t,c),!a&&e.shouldRedraw(t,c,h,d)&&i())},o=e.priority||r.noop;n.beforeRender(a,o(t))}}}}},function(e,t,n){"use strict";var r=n(1),i=[{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:":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 r.sort.descending(e.selector,t.selector)}),a=function e(t,n){return(e.lookup=e.lookup||function(){for(var e={},t=void 0,n=0;n0;){var y=function(e,t){if(0!==e.length){for(var n=0,r=t[e[0]],i=1;ic&&(c=t)},get:function(e){return u[e]}},h=0;h0?C.edgesTo(T)[0]:T.edgesTo(C)[0];var S=n(P);T=T.id(),x[T]>x[p]+S&&(x[T]=x[p]+S,w.nodes.indexOf(T)<0?w.push(T):w.updateItem(T),b[T]=0,y[T]=[]),x[T]==x[p]+S&&(b[T]=b[T]+b[p],y[T].push(p))}else for(var E=0;E0;)for(var T=m.pop(),E=0;E0;){var m=f.pop(),y=p(m),b=m.id();if(c[b]=y,y!==1/0)for(var x=m.neighborhood().intersect(h),v=0;v0)for(n.unshift(t);u[i.id()];){var a=u[i.id()];n.unshift(a.edge),n.unshift(a.node),i=a.node}return o.collection(n)}}}};e.exports=a},function(e,t,n){"use strict";var r=n(0),i={floydWarshall:function(e){e=e||{};var t=this.cy();if(null!=e.weight&&r.fn(e.weight))var n=e.weight;else var n=function(e){return 1};if(null!=e.directed)var i=e.directed;else var i=!1;for(var a=this.edges().stdFilter(function(e){return!e.isLoop()}),o=this.nodes(),s=o.length,l={},u=0;uy&&(c[g][m]=y,p[g][m]=m,f[g][m]=a[u])}if(!i)for(var u=0;uy&&(c[g][m]=y,p[g][m]=m,f[g][m]=a[u])}for(var b=0;b0&&this.spawn(n).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){for(var n=e.match(/\S+/g)||[],r=this,i=[],a=0,o=r.length;a0&&this.spawn(i).updateStyle().emit("class"),r},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}};e.exports=i},function(e,t,n){"use strict";var r=(n(0),n(6)),i={allAre:function(e){var t=new r(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new r(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n0;){var d=i.shift();t(d),a.add(d.id()),l&&r(i,a,d)}return e}function i(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1],i)},l.forEachUp=function(e){return r(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a)},l.forEachUpAndDown=function(e){return r(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o)},l.ancestors=l.parents,e.exports=l},function(e,t,n){"use strict";var r=n(3),i=void 0,a=void 0;i=a={data:r.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:r.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:r.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:r.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:r.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:r.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},i.attr=i.data,i.removeAttr=i.removeData,e.exports=a},function(e,t,n){"use strict";function r(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;ot}),minIndegree:i("indegree",function(e,t){return et}),minOutdegree:i("outdegree",function(e,t){return et})}),a.extend(o,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}if(e.isParent()){var r=e._private,i=e.children(),a="include"===e.pstyle("compound-sizing-wrt-labels").value,o={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")}},s=i.boundingBox({includeLabels:a,includeOverlays:!1,useCache:!1}),l=r.position;0!==s.w&&0!==s.h||(s={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue},s.x1=l.x-s.w/2,s.x2=l.x+s.w/2,s.y1=l.y-s.h/2,s.y2=l.y+s.h/2);var u=o.width.left.value;"px"===o.width.left.units&&o.width.val>0&&(u=100*u/o.width.val);var c=o.width.right.value;"px"===o.width.right.units&&o.width.val>0&&(c=100*c/o.width.val);var d=o.height.top.value;"px"===o.height.top.units&&o.height.val>0&&(d=100*d/o.height.val);var h=o.height.bottom.value;"px"===o.height.bottom.units&&o.height.val>0&&(h=100*h/o.height.val);var p=n(o.width.val-s.w,u,c),f=p.biasDiff,v=p.biasComplementDiff,g=n(o.height.val-s.h,d,h),m=g.biasDiff,y=g.biasComplementDiff;r.autoPadding=function(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}}(s.w,s.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),r.autoWidth=Math.max(s.w,o.width.val),l.x=(-f+s.x1+s.x2+v)/2,r.autoHeight=Math.max(s.h,o.height.val),l.y=(-m+s.y1+s.y2+y)/2,t.push(e)}}(r),e._private.batchingStyle||(i.compoundBoundsClean=!0))}return this};var u=function(e){return e===1/0||e===-1/0?0:e},c=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=te.x2?r:e.x2,e.y1=ne.y2?i:e.y2)},d=function(e,t){return c(e,t.x1,t.y1,t.x2,t.y2)},h=function(e,t,n){return a.getPrefixedProperty(e,t,n)},p=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,a=i.arrowWidth/2,o=t.pstyle(n+"-arrow-shape").value,s=void 0,l=void 0;"none"!==o&&("source"===n?(s=i.srcX,l=i.srcY):"target"===n?(s=i.tgtX,l=i.tgtY):(s=i.midX,l=i.midY),c(e,s-a,l-a,s+a,l+a))}},f=function(e,t,n){if(!t.cy().headless()){var r=void 0;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o=t.pstyle("text-halign"),s=t.pstyle("text-valign"),l=h(a,"labelWidth",n),u=h(a,"labelHeight",n),d=h(a,"labelX",n),p=h(a,"labelY",n),f=t.pstyle(r+"text-margin-x").pfValue,v=t.pstyle(r+"text-margin-y").pfValue,g=t.isEdge(),m=t.pstyle(r+"text-rotation"),y=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,x=b/2,w=t.pstyle("text-background-padding").pfValue,E=u+2*w,P=l+2*w,T=P/2,C=E/2,S=void 0,D=void 0,k=void 0,_=void 0;if(g)S=d-T,D=d+T,k=p-C,_=p+C;else{switch(o.value){case"left":S=d-P,D=d;break;case"center":S=d-T,D=d+T;break;case"right":S=d,D=d+P}switch(s.value){case"top":k=p-E,_=p;break;case"center":k=p-C,_=p+C;break;case"bottom":k=p,_=p+E}}var M=g&&"autorotate"===m.strValue,I=null!=m.pfValue&&0!==m.pfValue;if(M||I){var N=M?h(i.rstyle,"labelAngle",n):m.pfValue,B=Math.cos(N),z=Math.sin(N),L=function(e,t){return e-=d,t-=p,{x:e*B-t*z+d,y:e*z+t*B+p}},A=L(S,k),O=L(S,_),R=L(D,k),V=L(D,_);S=Math.min(A.x,O.x,R.x,V.x),D=Math.max(A.x,O.x,R.x,V.x),k=Math.min(A.y,O.y,R.y,V.y),_=Math.max(A.y,O.y,R.y,V.y)}S+=f-Math.max(y,x),D+=f+Math.max(y,x),k+=v-Math.max(y,x),_+=v+Math.max(y,x),c(e,S,k,D,_)}return e}},v=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},s=e._private,l=r?e.pstyle("display").value:"element",d=e.isNode(),h=e.isEdge(),v=void 0,g=void 0,m=void 0,y=void 0,b=void 0,x=void 0,w="none"!==l;if(w){var E=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(E=e.pstyle("overlay-padding").value);var P=0,T=0;if(r&&(P=e.pstyle("width").pfValue,T=P/2),d&&t.includeNodes){var C=e.position();b=C.x,x=C.y;var S=e.outerWidth(),D=S/2,k=e.outerHeight(),_=k/2;v=b-D-E,g=b+D+E,m=x-_-E,y=x+_+E,c(a,v,m,g,y)}else if(h&&t.includeEdges){var M=s.rstyle||{};if(r&&!i&&(v=Math.min(M.srcX,M.midX,M.tgtX),g=Math.max(M.srcX,M.midX,M.tgtX),m=Math.min(M.srcY,M.midY,M.tgtY),y=Math.max(M.srcY,M.midY,M.tgtY),v-=T,g+=T,m-=T,y+=T,c(a,v,m,g,y)),r&&!i&&"haystack"===e.pstyle("curve-style").strValue){var I=M.haystackPts||[];if(v=I[0].x,m=I[0].y,g=I[1].x,y=I[1].y,v>g){var N=v;v=g,g=N}if(m>y){var B=m;m=y,y=B}c(a,v-T,m-T,g+T,y+T)}else{for(var z=M.bezierPts||M.linePts||[],L=0;Lg){var F=v;v=g,g=F}if(m>y){var j=m;m=y,y=j}v-=T,g+=T,m-=T,y+=T,c(a,v,m,g,y)}}}if(r&&t.includeEdges&&h&&(p(a,e,"mid-source"),p(a,e,"mid-target"),p(a,e,"source"),p(a,e,"target")),r){if("yes"===e.pstyle("ghost").value){var X=e.pstyle("ghost-offset-x").pfValue,Y=e.pstyle("ghost-offset-y").pfValue;c(a,a.x1+X,a.y1+Y,a.x2+X,a.y2+Y)}}r&&(v=a.x1,g=a.x2,m=a.y1,y=a.y2,c(a,v-E,m-E,g+E,y+E)),r&&t.includeLabels&&(f(a,e,null),h&&(f(a,e,"source"),f(a,e,"target")))}return a.x1=u(a.x1),a.y1=u(a.y1),a.x2=u(a.x2),a.y2=u(a.y2),a.w=u(a.x2-a.x1),a.h=u(a.y2-a.y1),a.w>0&&a.h>0&&w&&o.expandBoundingBox(a,1),a},g=function(e){return e?"t":"f"},m=function(e){var t="";return t+=g(e.incudeNodes),t+=g(e.includeEdges),t+=g(e.includeLabels),t+=g(e.includeOverlays)},y=function(e,t){var n=e._private,r=void 0,i=e.cy().headless(),a=t===b?x:m(t);return t.useCache&&!i&&n.bbCache&&n.bbCache[a]?r=n.bbCache[a]:(r=v(e,t),i||(n.bbCache=n.bbCache||{},n.bbCache[a]=r)),r},b={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeOverlays:!0,useCache:!0},x=m(b);l.boundingBox=function(e){if(1===this.length&&this[0]._private.bbCache&&(void 0===e||void 0===e.useCache||!0===e.useCache))return e=void 0===e?b:r(e),y(this[0],e);var t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};e=e||a.staticEmptyObject();var n=r(e),i=this,o=i.cy(),s=o.styleEnabled();s&&this.recalculateRenderedStyle(n.useCache),this.updateCompoundBounds();for(var l={},c=0;c0,d=c;c&&(u=u[0]);var h=d?u.position():{x:0,y:0};return a={x:l.x-h.x,y:l.y-h.y},void 0===e?a:a[e]}for(var p=0;p0,m=g;g&&(v=v[0]);var y=m?v.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==a&&f.position({x:a.x+y.x,y:a.y+y.y})}}else if(!o)return;return this}},o.modelPosition=o.point=o.position,o.modelPositions=o.points=o.positions,o.renderedPoint=o.renderedPosition,o.relativePoint=o.relativePosition,e.exports=s},function(e,t,n){"use strict";var r=n(1),i=void 0,a=void 0;i=a={};var o=function(e){e.uppercaseName=r.capitalize(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=r.capitalize(e.outerName),i[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}}},i["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private,r=n.cy,i=r._private.styleEnabled;if(t){if(i){return t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding()}return 1}},i["rendered"+e.uppercaseName]=function(){var t=this[0];if(t){return t[e.name]()*this.cy().zoom()}},i["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t){return t[e.outerName]()*this.cy().zoom()}}};o({name:"width"}),o({name:"height"}),a.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},e.exports=a},function(e,t,n){"use strict";var r=n(10),i=n(3),a=n(0),o=n(1),s=n(6),l={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&&a.element(n.target)&&r.matches(n.target)},eventFields:function(e){return{cy:e.cy(),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()}},u=function(e){return a.string(e)?new s(e):e},c={createEmitter:function(){for(var e=0;e1&&!o){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[a]=l,r.set(u,{ele:l,index:a})}return this.length--,this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&r.string(e)){var n=e;e=t.mutableElements().filter(n)}for(var i=0;in&&(n=s,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r=void 0,i=this,a=0;a=0&&i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,{unique:!0}).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),l.neighbourhood=l.neighborhood,l.closedNeighbourhood=l.closedNeighborhood,l.openNeighbourhood=l.openNeighborhood,o.extend(l,{source:u(function(e){var t=this[0],n=void 0;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:u(function(e){var t=this[0],n=void 0;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:r({attr:"source"}),targets:r({attr:"target"})}),o.extend(l,{edgesWith:u(i(),"edgesWith"),edgesTo:u(i({thisIsSrc:!0}),"edgesTo")}),o.extend(l,{connectedEdges:u(function(e){for(var t=[],n=this,r=0;r0);return i.map(function(e){var t=e.connectedEdges().stdFilter(function(t){return e.anySame(t.source())&&e.anySame(t.target())});return e.union(t)})}}),e.exports=l},function(e,t,n){"use strict";var r=n(0),i=n(1),a=n(7),o=n(13),s={add:function(e){var t=void 0,n=this;if(r.elementOrCollection(e)){var s=e;if(s._private.cy===n)t=s.restore();else{for(var l=[],u=0;u=e.deqFastCost*g)break}else if(a){if(f>=e.deqCost*u||f>=e.deqAvgCost*l)break}else if(v>=e.deqNoDrawCost*(1e3/60))break;var m=e.deq(t,h,d);if(!(m.length>0))break;for(var y=0;y0&&(e.onDeqd(t,c),!a&&e.shouldRedraw(t,c,h,d)&&i())},o=e.priority||r.noop;n.beforeRender(a,o(t))}}}}},function(e,t,n){"use strict";var r=n(1),i=[{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:":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 r.sort.descending(e.selector,t.selector)}),a=function e(t,n){return(e.lookup=e.lookup||function(){for(var e={},t=void 0,n=0;n0;){var y=function(e,t){if(0!==e.length){for(var n=0,r=t[e[0]],i=1;ic&&(c=t)},get:function(e){return u[e]}},h=0;h0?C.edgesTo(T)[0]:T.edgesTo(C)[0];var S=n(P);T=T.id(),x[T]>x[p]+S&&(x[T]=x[p]+S,w.nodes.indexOf(T)<0?w.push(T):w.updateItem(T),b[T]=0,y[T]=[]),x[T]==x[p]+S&&(b[T]=b[T]+b[p],y[T].push(p))}else for(var E=0;E0;)for(var T=m.pop(),E=0;E0;){var m=f.pop(),y=p(m),b=m.id();if(c[b]=y,y!==1/0)for(var x=m.neighborhood().intersect(h),v=0;v0)for(n.unshift(t);u[i.id()];){var a=u[i.id()];n.unshift(a.edge),n.unshift(a.node),i=a.node}return o.collection(n)}}}};e.exports=a},function(e,t,n){"use strict";var r=n(0),i={floydWarshall:function(e){e=e||{};var t=this.cy();if(null!=e.weight&&r.fn(e.weight))var n=e.weight;else var n=function(e){return 1};if(null!=e.directed)var i=e.directed;else var i=!1;for(var a=this.edges().stdFilter(function(e){return!e.isLoop()}),o=this.nodes(),s=o.length,l={},u=0;uy&&(c[g][m]=y,p[g][m]=m,f[g][m]=a[u])}if(!i)for(var u=0;uy&&(c[g][m]=y,p[g][m]=m,f[g][m]=a[u])}for(var b=0;b0&&this.spawn(n).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){for(var n=e.match(/\S+/g)||[],r=this,i=[],a=0,o=r.length;a0&&this.spawn(i).updateStyle().emit("class"),r},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}};e.exports=i},function(e,t,n){"use strict";var r=(n(0),n(6)),i={allAre:function(e){var t=new r(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new r(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n0;){var d=i.shift();t(d),a.add(d.id()),l&&r(i,a,d)}return e}function i(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1],i)},l.forEachUp=function(e){return r(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a)},l.forEachUpAndDown=function(e){return r(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o)},l.ancestors=l.parents,e.exports=l},function(e,t,n){"use strict";var r=n(3),i=void 0,a=void 0;i=a={data:r.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:r.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:r.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:r.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:r.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:r.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},i.attr=i.data,i.removeAttr=i.removeData,e.exports=a},function(e,t,n){"use strict";function r(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;ot}),minIndegree:i("indegree",function(e,t){return et}),minOutdegree:i("outdegree",function(e,t){return et})}),a.extend(o,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}if(e.isParent()){var r=e._private,i=e.children(),a="include"===e.pstyle("compound-sizing-wrt-labels").value,o={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")}},s=i.boundingBox({includeLabels:a,includeOverlays:!1,useCache:!1}),l=r.position;0!==s.w&&0!==s.h||(s={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue},s.x1=l.x-s.w/2,s.x2=l.x+s.w/2,s.y1=l.y-s.h/2,s.y2=l.y+s.h/2);var u=o.width.left.value;"px"===o.width.left.units&&o.width.val>0&&(u=100*u/o.width.val);var c=o.width.right.value;"px"===o.width.right.units&&o.width.val>0&&(c=100*c/o.width.val);var d=o.height.top.value;"px"===o.height.top.units&&o.height.val>0&&(d=100*d/o.height.val);var h=o.height.bottom.value;"px"===o.height.bottom.units&&o.height.val>0&&(h=100*h/o.height.val);var p=n(o.width.val-s.w,u,c),f=p.biasDiff,v=p.biasComplementDiff,g=n(o.height.val-s.h,d,h),m=g.biasDiff,y=g.biasComplementDiff;r.autoPadding=function(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}}(s.w,s.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),r.autoWidth=Math.max(s.w,o.width.val),l.x=(-f+s.x1+s.x2+v)/2,r.autoHeight=Math.max(s.h,o.height.val),l.y=(-m+s.y1+s.y2+y)/2,t.push(e)}}(r),e._private.batchingStyle||(i.compoundBoundsClean=!0))}return this};var u=function(e){return e===1/0||e===-1/0?0:e},c=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=te.x2?r:e.x2,e.y1=ne.y2?i:e.y2)},d=function(e,t){return c(e,t.x1,t.y1,t.x2,t.y2)},h=function(e,t,n){return a.getPrefixedProperty(e,t,n)},p=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,a=i.arrowWidth/2,o=t.pstyle(n+"-arrow-shape").value,s=void 0,l=void 0;"none"!==o&&("source"===n?(s=i.srcX,l=i.srcY):"target"===n?(s=i.tgtX,l=i.tgtY):(s=i.midX,l=i.midY),c(e,s-a,l-a,s+a,l+a))}},f=function(e,t,n){if(!t.cy().headless()){var r=void 0;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o=t.pstyle("text-halign"),s=t.pstyle("text-valign"),l=h(a,"labelWidth",n),u=h(a,"labelHeight",n),d=h(a,"labelX",n),p=h(a,"labelY",n),f=t.pstyle(r+"text-margin-x").pfValue,v=t.pstyle(r+"text-margin-y").pfValue,g=t.isEdge(),m=t.pstyle(r+"text-rotation"),y=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,x=b/2,w=t.pstyle("text-background-padding").pfValue,E=u+2*w,P=l+2*w,T=P/2,C=E/2,S=void 0,D=void 0,k=void 0,_=void 0;if(g)S=d-T,D=d+T,k=p-C,_=p+C;else{switch(o.value){case"left":S=d-P,D=d;break;case"center":S=d-T,D=d+T;break;case"right":S=d,D=d+P}switch(s.value){case"top":k=p-E,_=p;break;case"center":k=p-C,_=p+C;break;case"bottom":k=p,_=p+E}}var M=g&&"autorotate"===m.strValue,I=null!=m.pfValue&&0!==m.pfValue;if(M||I){var N=M?h(i.rstyle,"labelAngle",n):m.pfValue,B=Math.cos(N),z=Math.sin(N),L=function(e,t){return e-=d,t-=p,{x:e*B-t*z+d,y:e*z+t*B+p}},A=L(S,k),O=L(S,_),R=L(D,k),V=L(D,_);S=Math.min(A.x,O.x,R.x,V.x),D=Math.max(A.x,O.x,R.x,V.x),k=Math.min(A.y,O.y,R.y,V.y),_=Math.max(A.y,O.y,R.y,V.y)}S+=f-Math.max(y,x),D+=f+Math.max(y,x),k+=v-Math.max(y,x),_+=v+Math.max(y,x),c(e,S,k,D,_)}return e}},v=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},s=e._private,l=r?e.pstyle("display").value:"element",d=e.isNode(),h=e.isEdge(),v=void 0,g=void 0,m=void 0,y=void 0,b=void 0,x=void 0,w="none"!==l;if(w){var E=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(E=e.pstyle("overlay-padding").value);var P=0,T=0;if(r&&(P=e.pstyle("width").pfValue,T=P/2),d&&t.includeNodes){var C=e.position();b=C.x,x=C.y;var S=e.outerWidth(),D=S/2,k=e.outerHeight(),_=k/2;v=b-D-E,g=b+D+E,m=x-_-E,y=x+_+E,c(a,v,m,g,y)}else if(h&&t.includeEdges){var M=s.rstyle||{};if(r&&!i&&(v=Math.min(M.srcX,M.midX,M.tgtX),g=Math.max(M.srcX,M.midX,M.tgtX),m=Math.min(M.srcY,M.midY,M.tgtY),y=Math.max(M.srcY,M.midY,M.tgtY),v-=T,g+=T,m-=T,y+=T,c(a,v,m,g,y)),r&&!i&&"haystack"===e.pstyle("curve-style").strValue){var I=M.haystackPts||[];if(v=I[0].x,m=I[0].y,g=I[1].x,y=I[1].y,v>g){var N=v;v=g,g=N}if(m>y){var B=m;m=y,y=B}c(a,v-T,m-T,g+T,y+T)}else{for(var z=M.bezierPts||M.linePts||[],L=0;Lg){var F=v;v=g,g=F}if(m>y){var j=m;m=y,y=j}v-=T,g+=T,m-=T,y+=T,c(a,v,m,g,y)}}}if(r&&t.includeEdges&&h&&(p(a,e,"mid-source"),p(a,e,"mid-target"),p(a,e,"source"),p(a,e,"target")),r){if("yes"===e.pstyle("ghost").value){var X=e.pstyle("ghost-offset-x").pfValue,Y=e.pstyle("ghost-offset-y").pfValue;c(a,a.x1+X,a.y1+Y,a.x2+X,a.y2+Y)}}r&&(v=a.x1,g=a.x2,m=a.y1,y=a.y2,c(a,v-E,m-E,g+E,y+E)),r&&t.includeLabels&&(f(a,e,null),h&&(f(a,e,"source"),f(a,e,"target")))}return a.x1=u(a.x1),a.y1=u(a.y1),a.x2=u(a.x2),a.y2=u(a.y2),a.w=u(a.x2-a.x1),a.h=u(a.y2-a.y1),a.w>0&&a.h>0&&w&&o.expandBoundingBox(a,1),a},g=function(e){return e?"t":"f"},m=function(e){var t="";return t+=g(e.incudeNodes),t+=g(e.includeEdges),t+=g(e.includeLabels),t+=g(e.includeOverlays)},y=function(e,t){var n=e._private,r=void 0,i=e.cy().headless(),a=t===b?x:m(t);return t.useCache&&!i&&n.bbCache&&n.bbCache[a]?r=n.bbCache[a]:(r=v(e,t),i||(n.bbCache=n.bbCache||{},n.bbCache[a]=r)),r},b={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeOverlays:!0,useCache:!0},x=m(b);l.boundingBox=function(e){if(1===this.length&&this[0]._private.bbCache&&(void 0===e||void 0===e.useCache||!0===e.useCache))return e=void 0===e?b:r(e),y(this[0],e);var t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};e=e||a.staticEmptyObject();var n=r(e),i=this,o=i.cy(),s=o.styleEnabled();s&&this.recalculateRenderedStyle(n.useCache),this.updateCompoundBounds();for(var l={},c=0;c0,d=c;c&&(u=u[0]);var h=d?u.position():{x:0,y:0};return a={x:l.x-h.x,y:l.y-h.y},void 0===e?a:a[e]}for(var p=0;p0,m=g;g&&(v=v[0]);var y=m?v.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==a&&f.position({x:a.x+y.x,y:a.y+y.y})}}else if(!o)return;return this}},o.modelPosition=o.point=o.position,o.modelPositions=o.points=o.positions,o.renderedPoint=o.renderedPosition,o.relativePoint=o.relativePosition,e.exports=s},function(e,t,n){"use strict";var r=n(1),i=void 0,a=void 0;i=a={};var o=function(e){e.uppercaseName=r.capitalize(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=r.capitalize(e.outerName),i[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}}},i["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private,r=n.cy,i=r._private.styleEnabled;if(t){if(i){return t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding()}return 1}},i["rendered"+e.uppercaseName]=function(){var t=this[0];if(t){return t[e.name]()*this.cy().zoom()}},i["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t){return t[e.outerName]()*this.cy().zoom()}}};o({name:"width"}),o({name:"height"}),a.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},e.exports=a},function(e,t,n){"use strict";var r=n(10),i=n(3),a=n(0),o=n(1),s=n(6),l={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&&a.element(n.target)&&r.matches(n.target)},eventFields:function(e){return{cy:e.cy(),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()}},u=function(e){return a.string(e)?new s(e):e},c={createEmitter:function(){for(var e=0;e1&&!o){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[a]=l,r.set(u,{ele:l,index:a})}return this.length--,this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&r.string(e)){var n=e;e=t.mutableElements().filter(n)}for(var i=0;in&&(n=s,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r=void 0,i=this,a=0;a=0&&i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,{unique:!0}).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),l.neighbourhood=l.neighborhood,l.closedNeighbourhood=l.closedNeighborhood,l.openNeighbourhood=l.openNeighborhood,o.extend(l,{source:u(function(e){var t=this[0],n=void 0;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:u(function(e){var t=this[0],n=void 0;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:r({attr:"source"}),targets:r({attr:"target"})}),o.extend(l,{edgesWith:u(i(),"edgesWith"),edgesTo:u(i({thisIsSrc:!0}),"edgesTo")}),o.extend(l,{connectedEdges:u(function(e){for(var t=[],n=this,r=0;r0);return i.map(function(e){var t=e.connectedEdges().stdFilter(function(t){return e.anySame(t.source())&&e.anySame(t.target())});return e.union(t)})}}),e.exports=l},function(e,t,n){"use strict";var r=n(0),i=n(1),a=n(7),o=n(13),s={add:function(e){var t=void 0,n=this;if(r.elementOrCollection(e)){var s=e;if(s._private.cy===n)t=s.restore();else{for(var l=[],u=0;u0?i=o:r=o}while(Math.abs(a)>g&&++l=v?u(t,s):0===c?s:d(t,r,r+b)}function p(){P=!0,e===t&&n===r||c()}var f=4,v=.001,g=1e-7,m=10,y=11,b=1/(y-1),x="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var w=0;w<4;++w)if("number"!=typeof arguments[w]||isNaN(arguments[w])||!isFinite(arguments[w]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var E=x?new Float32Array(y):new Array(y),P=!1,T=function(i){return P||p(),e===t&&n===r?i:0===i?0:1===i?1:s(h(i),t,r)};T.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var C="generateBezier("+[e,t,n,r]+")";return T.toString=function(){return C},T}e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,i){if(1===r)return n;var a=i(t,n,r);return null==e?a:((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 i(e,t,n,i,o){var s=null!=o?o.type:null;n<0?n=0:n>1&&(n=1);var l=void 0,u=void 0;if(l=null!=e.pfValue||null!=e.value?null!=e.pfValue?e.pfValue:e.value:e,u=null!=t.pfValue||null!=t.value?null!=t.pfValue?t.pfValue:t.value:t,a.number(l)&&a.number(u))return r(s,l,u,n,i);if(a.array(l)&&a.array(u)){for(var c=[],d=0;d1e-4&&Math.abs(c.v)>1e-4;);return l?function(e){return o[e*(o.length-1)|0]}:s}}();e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){var i=!r,a=e,o=t._private,s=r?e:e.cy(),l=s.style();if(i){var u=a.position();o.startPosition=o.startPosition||{x:u.x,y:u.y},o.startStyle=o.startStyle||l.getAnimationStartStyle(a,o.style)}if(r){var c=s._private.pan;o.startPan=o.startPan||{x:c.x,y:c.y},o.startZoom=null!=o.startZoom?o.startZoom:s._private.zoom}o.started=!0,o.startTime=n-o.progress*o.duration}e.exports=r},function(e,t,n){"use strict";function r(e,t){function n(t,n){var r=t._private,s=r.animation.current,l=r.animation.queue,u=!1;if(!n&&"none"===t.pstyle("display").value){s=s.splice(0,s.length).concat(l.splice(0,l.length));for(var c=0;c=0;t--){(0,e[t])()}e.splice(0,e.length)},p=s.length-1;p>=0;p--){var f=s[p],v=f._private;v.stopped?(s.splice(p,1),v.hooked=!1,v.playing=!1,v.started=!1,h(v.frames)):(v.playing||v.applying)&&(v.playing&&v.applying&&(v.applying=!1),v.started||a(t,f,e,n),i(t,f,e,n),v.applying&&(v.applying=!1),h(v.frames),f.completed()&&(s.splice(p,1),v.hooked=!1,v.playing=!1,v.started=!1,h(v.completes)),u=!0)}return n||0!==s.length||0!==l.length||o.push(t),u}for(var r=t._private.aniEles,o=[],s=!1,l=0;l0?(r.dirtyCompoundBoundsCache(),t.notify({type:"draw",eles:r})):t.notify({type:"draw"})),r.unmerge(o),t.emit("step")}var i=n(64),a=n(62);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){var l=!r,u=e._private,c=t._private,d=c.easing,h=c.startTime,p=r?e:e.cy(),f=p.style();if(!c.easingImpl)if(null==d)c.easingImpl=a.linear;else{var v=void 0;if(s.string(d)){var g=f.parse("transition-timing-function",d);v=g.value}else v=d;var m=void 0,y=void 0;s.string(v)?(m=v,y=[]):(m=v[1],y=v.slice(2).map(function(e){return+e})),y.length>0?("spring"===m&&y.push(c.duration),c.easingImpl=a[m].apply(null,y)):c.easingImpl=a[m]}var b=c.easingImpl,x=void 0;if(x=0===c.duration?1:(n-h)/c.duration,c.applying&&(x=c.progress),x<0?x=0:x>1&&(x=1),null==c.delay){var w=c.startPosition,E=c.position;if(E&&l&&!e.locked()){var P=e.position();i(w.x,E.x)&&(P.x=o(w.x,E.x,x,b)),i(w.y,E.y)&&(P.y=o(w.y,E.y,x,b)),e.emit("position")}var T=c.startPan,C=c.pan,S=u.pan,D=null!=C&&r;D&&(i(T.x,C.x)&&(S.x=o(T.x,C.x,x,b)),i(T.y,C.y)&&(S.y=o(T.y,C.y,x,b)),e.emit("pan"));var k=c.startZoom,_=c.zoom,M=null!=_&&r;M&&(i(k,_)&&(u.zoom=o(k,_,x,b)),e.emit("zoom")),(D||M)&&e.emit("viewport");var I=c.style;if(I&&I.length>0&&l){for(var N=0;N0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchingStyle=e.batchingNotify=!0,e.batchStyleEles=this.collection(),e.batchNotifyEles=this.collection(),e.batchNotifyTypes=[],e.batchNotifyTypes.ids={}),e.batchCount++,this},endBatch:function(){var e=this._private;return e.batchCount--,0===e.batchCount&&(e.batchingStyle=!1,e.batchStyleEles.updateStyle(),e.batchingNotify=!1,this.notify({type:e.batchNotifyTypes,eles:e.batchNotifyEles})),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;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};i.invalidateDimensions=i.resize,e.exports=i},function(e,t,n){"use strict";var r=n(0),i=n(7),a={collection:function(e,t){return r.string(e)?this.$(e):r.elementOrCollection(e)?e.collection():r.array(e)?new i(this,e,t):new i(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}};a.elements=a.filter=a.$,e.exports=a},function(e,t,n){"use strict";var r=n(0),i=n(18),a={style:function(e){if(e){this.setStyle(e).update()}return this._private.style},setStyle:function(e){var t=this._private;return r.stylesheet(e)?t.style=e.generateStyle(this):r.array(e)?t.style=i.fromJson(this,e):r.string(e)?t.style=i.fromString(this,e):t.style=i(this),t.style}};e.exports=a},function(e,t,n){"use strict";var r=n(0),i=n(4),a=n(2),o={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)},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=arguments,t=this._private.pan,n=void 0,i=void 0,a=void 0,o=void 0,s=void 0;switch(e.length){case 0:return t;case 1:if(r.string(e[0]))return n=e[0],t[n];if(r.plainObject(e[0])){if(!this._private.panningEnabled)return this;a=e[0],o=a.x,s=a.y,r.number(o)&&(t.x=o),r.number(s)&&(t.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],i=e[1],"x"!==n&&"y"!==n||!r.number(i)||(t[n]=i),this.emit("pan viewport")}return this.notify({type:"viewport"}),this},panBy:function(e,t){var n=arguments,i=this._private.pan,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0;if(!this._private.panningEnabled)return this;switch(n.length){case 1:r.plainObject(e)&&(s=n[0],l=s.x,u=s.y,r.number(l)&&(i.x+=l),r.number(u)&&(i.y+=u),this.emit("pan viewport"));break;case 2:a=e,o=t,"x"!==a&&"y"!==a||!r.number(o)||(i[a]+=o),this.emit("pan viewport")}return this.notify({type:"viewport"}),this},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({type:"viewport"})}return this},getFitViewport:function(e,t){if(r.number(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n=void 0;if(r.string(e)){var i=e;e=this.$(i)}else if(r.boundingBox(e)){var a=e;n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else r.elementOrCollection(e)||(e=this.mutableElements());if(!r.elementOrCollection(e)||!e.empty()){n=n||e.boundingBox();var o=this.width(),s=this.height(),l=void 0;if(t=r.number(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((o-2*t)/n.w,(s-2*t)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=lt.maxZoom?t.maxZoom:s,s=st.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=l,a.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;r.number(u.x)&&(t.pan.x=u.x,s=!1),r.number(u.y)&&(t.pan.y=u.y,s=!1),s||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify({type:"viewport"})),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify({type:"viewport"})),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(r.string(e)){var n=e;e=this.mutableElements().filter(n)}else r.elementOrCollection(e)||(e=this.mutableElements());if(0!==e.length){var i=e.boundingBox(),a=this.width(),o=this.height();t=void 0===t?this._private.zoom:t;return{x:(a-t*(i.x1+i.x2))/2,y:(o-t*(i.y1+i.y2))/2}}}},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;return e.sizeCache=e.sizeCache||(t?function(){var e=i.getComputedStyle(t),n=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-n("padding-left")-n("padding-right"),height:t.clientHeight-n("padding-top")-n("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}}};o.centre=o.center,o.autolockNodes=o.autolock,o.autoungrabifyNodes=o.autoungrabify,e.exports=o},function(e,t,n){"use strict";var r=n(1),i=n(24),a=n(2),o=n(0),s={animated:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e];if(!(this._private.cy||this).styleEnabled())return!1;var r=n[0];return r?r._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var r=0;r0;)!function(){var e=n.collection();r.bfs({roots:v[0],visit:function(t,n,r,i,a){e=e.add(t)},directed:!1}),v=v.not(e),f.push(e)}();u=n.collection();for(var g=0;gm.length-1;)m.push([]);m[G].push(H),Z.depth=G,Z.index=m[G].length-1}z()}var Q=0;if(t.avoidOverlap)for(var K=0;Kc||0===t)&&(r+=u/d,a++)}return a=Math.max(1,a),r/=a,0===a&&(r=void 0),re[e.id()]=r,r},ae=function(e,t){return ie(e)-ie(t)},oe=0;oe<3;oe++){for(var se=0;se=0;he--)for(var pe=m[he],fe=0;fe0&&m[0].length<=3?c/2:0),h=2*Math.PI/m[i].length*a;return 0===i&&1===m[0].length&&(d=1),{x:ce.x+d*Math.cos(h),y:ce.y+d*Math.sin(h)}}return{x:ce.x+(a+1-(o+1)/2)*s,y:(i+1)*u}}var p={x:ce.x+(a+1-(o+1)/2)*s,y:(i+1)*u};return p}(ve,m.length)}return i.layoutPositions(this,t,function(e){return de[e.id()]}),this},e.exports=r},function(e,t,n){"use strict";function r(e){this.options=i.extend({},s,e)}var i=n(1),a=n(2),o=n(0),s={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}};r.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,s=r.nodes().not(":parent");t.sort&&(s=s.sort(t.sort));for(var l=a.makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u={x:l.x1+l.w/2,y:l.y1+l.h/2},c=void 0===t.sweep?2*Math.PI-2*Math.PI/s.length:t.sweep,d=c/Math.max(1,s.length-1),h=void 0,p=0,f=0;f1&&t.avoidOverlap){p*=1.75;var b=Math.cos(d)-Math.cos(0),x=Math.sin(d)-Math.sin(0),w=Math.sqrt(p*p/(b*b+x*x));h=Math.max(w,h)}var E=function(e,n){var r=t.startAngle+n*d*(i?1:-1),a=h*Math.cos(r),o=h*Math.sin(r);return{x:u.x+a,y:u.y+o}};return s.layoutPositions(this,t,E),this},e.exports=r},function(e,t,n){"use strict";function r(e){this.options=i.extend({},o,e)}var i=n(1),a=n(2),o={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}};r.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,o=i.nodes().not(":parent"),s=a.makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],c=(t.startAngle,0),d=0;d0){Math.abs(b[0].value-w.value)>=m&&(b=[],y.push(b))}b.push(w)}var E=c+t.minNodeSpacing;if(!t.avoidOverlap){var P=y.length>0&&y[0].length>1,T=Math.min(s.w,s.h)/2-E,C=T/(y.length+P?1:0);E=Math.min(E,C)}for(var S=0,D=0;D1&&t.avoidOverlap){var I=Math.cos(M)-Math.cos(0),N=Math.sin(M)-Math.sin(0),B=Math.sqrt(E*E/(I*I+N*N));S=Math.max(B,S)}k.r=S,S+=E}if(t.equidistant){for(var z=0,L=0,A=0;A0)var l=r.nodeOverlap*o,d=Math.sqrt(i*i+a*a),h=l*i/d,p=l*a/d;else var f=c(e,i,a),v=c(t,-1*i,-1*a),g=v.x-f.x,m=v.y-f.y,y=g*g+m*m,d=Math.sqrt(y),l=(e.nodeRepulsion+t.nodeRepulsion)/y,h=l*g/d,p=l*m/d;e.isLocked||(e.offsetX-=h,e.offsetY-=p),t.isLocked||(t.offsetX+=h,t.offsetY+=p)}},u=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},c=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&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=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},d=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,v=t.gravity*h/p;c.offsetX+=f,c.offsetY+=v}}}}},p=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},g=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.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopg&&(p+=v+t.componentSpacing,h=0,f=0,v=0)}}}(0,i),r}).then(function(e){h.layoutNodes=e.layoutNodes,o.stop(),b()});var b=function(){!0===t.animate||!1===t.animate?y({force:!0,next:function(){r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r})}}):t.eles.nodes().layoutPositions(r,t,function(e){var t=h.layoutNodes[h.idToIndex[e.data("id")]];return{x:t.positionX,y:t.positionY}})};return this},r.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},r.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var c=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:o.makeBoundingBox(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},l=n.eles.components(),u={},c=0;c0){a.graphSet.push(C);for(var c=0;cr.count?0:r.graph},h=function e(t,n,r,i){var a=i.graphSet[r];if(-1s){var v=d(),g=h();(v-1)*g>=s?d(v-1):(g-1)*v>=s&&h(g-1)}else for(;c*u=s?h(y+1):d(m+1)}var b=o.w/c,x=o.h/u;if(t.condense&&(b=0,x=0),t.avoidOverlap)for(var w=0;w=c&&(N=0,I++)},z={},L=0;L=0;E--){var P=f[E];P.isNode()?s(P)||u(P):function(n){var r,a=n._private,l=a.rscratch,u=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,d=u/2+y,f=d*d,g=2*d,b=a.source,x=a.target;if("segments"===l.edgeType||"straight"===l.edgeType||"haystack"===l.edgeType){for(var w=l.allpts,E=0;E+3(r=i.sqdistToFiniteLine(e,t,w[E],w[E+1],w[E+2],w[E+3])))return o(n,r),!0}else if("bezier"===l.edgeType||"multibezier"===l.edgeType||"self"===l.edgeType||"compound"===l.edgeType)for(var w=l.allpts,E=0;E+5(r=i.sqdistToQuadraticBezier(e,t,w[E],w[E+1],w[E+2],w[E+3],w[E+4],w[E+5])))return o(n,r),!0;for(var b=b||a.source,x=x||a.target,P=h.getArrowWidth(u,c),T=[{name:"source",x:l.arrowStartX,y:l.arrowStartY,angle:l.srcArrowAngle},{name:"target",x:l.arrowEndX,y:l.arrowEndY,angle:l.tgtArrowAngle},{name:"mid-source",x:l.midX,y:l.midY,angle:l.midsrcArrowAngle},{name:"mid-target",x:l.midX,y:l.midY,angle:l.midtgtArrowAngle}],E=0;E0&&(s(b),s(x))}(P)||u(P)||u(P,"source")||u(P,"target")}return v},o.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,o=[],s=Math.min(e,n),l=Math.max(e,n),u=Math.min(t,r),c=Math.max(t,r);e=s,n=l,t=u,r=c;for(var d=i.makeBoundingBox({x1:e,y1:t,x2:n,y2:r}),h=0;hy?y+"$-$"+m:m+"$-$"+y,v&&(t="unbundled$-$"+p.id);var b=s[t];null==b&&(b=s[t]=[],l.push(t)),b.push(d),v&&(b.hasUnbundled=!0),g&&(b.hasBezier=!0)}else u.push(d)}for(var x,w,E,P,T,C,S,D,k,_,M,I,N=0;Nw.id()){var z=x;x=w,w=z}E=x.position(),P=w.position(),T=x.outerWidth(),C=x.outerHeight(),S=w.outerWidth(),D=w.outerHeight(),k=n.nodeShapes[this.getNodeShape(x)],_=n.nodeShapes[this.getNodeShape(w)],I=!1;for(var d,L,A,O={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0},R=E.x,V=E.y,q=T,F=C,j=P.x,X=P.y,Y=S,W=D,H=B.length,c=0;c=c||x){h={cp:m,segment:b};break}}if(h)break}var m=h.cp,b=h.segment,w=(c-f)/b.length,E=b.t1-b.t0,P=o?b.t0+E*w:b.t1-E*w;P=r.bound(0,P,1),t=r.qbezierPtAt(m.p0,m.p1,m.p2,P),a=function(e,t,n,i){var a=r.bound(0,i-.001,1),o=r.bound(0,i+.001,1),s=r.qbezierPtAt(e,t,n,a),l=r.qbezierPtAt(e,t,n,o);return d(s,l)}(m.p0,m.p1,m.p2,P);break;case"straight":case"segments":case"haystack":for(var T,C,S,D,k=0,_=i.allpts.length,g=0;g+3<_&&(o?(S={x:i.allpts[g],y:i.allpts[g+1]},D={x:i.allpts[g+2],y:i.allpts[g+3]}):(S={x:i.allpts[_-2-g],y:i.allpts[_-1-g]},D={x:i.allpts[_-4-g],y:i.allpts[_-3-g]}),T=r.dist(S,D),C=k,!((k+=T)>=c));g+=2);var M=c-C,P=M/T;P=r.bound(0,P,1),t=r.lineAt(S,D,P),a=d(S,D)}l("labelX",n,t.x),l("labelY",n,t.y),l("labelAutoAngle",n,a)}};c("source"),c("target"),this.applyLabelDimensions(e)}},o.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},o.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r);a.setPrefixedProperty(n.rstyle,"labelWidth",t,i.width),a.setPrefixedProperty(n.rscratch,"labelWidth",t,i.width),a.setPrefixedProperty(n.rstyle,"labelHeight",t,i.height),a.setPrefixedProperty(n.rscratch,"labelHeight",t,i.height)},o.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,s=function(e,r){return r?(a.setPrefixedProperty(n.rscratch,e,t,r),r):a.getPrefixedProperty(n.rscratch,e,t)};"none"==o||("uppercase"==o?i=i.toUpperCase():"lowercase"==o&&(i=i.toLowerCase()));var l=e.pstyle("text-wrap").value;if("wrap"===l){var u=s("labelKey");if(u&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h=[],p=0;pd){for(var v=f.split(/\s+/),g="",m=0;md)break;x+=i[E],E===i.length-1&&(w=!0)}return w||(x+="…"),x}return i},o.calculateLabelDimensions=function(e,t,n){var r=this,i=e._private.labelStyleKey+"$@$"+t;n&&(i+="$@$"+n);var a=r.labelDimCache||(r.labelDimCache={});if(a[i])return a[i];var o=e.pstyle("font-style").strValue,s=1*e.pstyle("font-size").pfValue+"px",l=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,c=this.labelCalcDiv;c||(c=this.labelCalcDiv=document.createElement("div"),document.body.appendChild(c));var d=c.style;return d.fontFamily=l,d.fontStyle=o,d.fontSize=s,d.fontWeight=u,d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none",d.padding="0",d.lineHeight="1","wrap"===e.pstyle("text-wrap").value?d.whiteSpace="pre":d.whiteSpace="normal",c.textContent=t,a[i]={width:Math.ceil(c.clientWidth/1),height:Math.ceil(c.clientHeight/1)},a[i]},o.calculateLabelAngles=function(e){var t=e._private,n=t.rscratch,r=e.isEdge(),i=e.pstyle("text-rotation"),a=i.strValue;"none"===a?n.labelAngle=n.sourceLabelAngle=n.targetLabelAngle=0:r&&"autorotate"===a?(n.labelAngle=Math.atan(n.midDispY/n.midDispX),n.sourceLabelAngle=n.sourceLabelAutoAngle,n.targetLabelAngle=n.targetLabelAutoAngle):n.labelAngle=n.sourceLabelAngle=n.targetLabelAngle="autorotate"===a?0:i.pfValue},e.exports=o},function(e,t,n){"use strict";var r={};r.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(e.isParent())return"rectangle"===n||"roundrectangle"===n||"cutrectangle"===n||"barrel"===n?n:"rectangle";if("polygon"===n){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n},e.exports=r},function(e,t,n){"use strict";var r={};r.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e,n,r){if(t.merge(e),!0===r||void 0===r)for(var i=0;i=e.desktopTapThreshold2}var _=n(i);m&&(e.hoverData.tapholdCancelled=!0),s=!0,t(v,["mousemove","vmousemove","tapdrag"],i,{position:{x:d[0],y:d[1]}});var M=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||l.emit("boxstart"),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(m){var I={originalEvent:i,type:"cxtdrag",position:{x:d[0],y:d[1]}};x?x.emit(I):l.emit(I),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:i,type:"cxtdragout",position:{x:d[0],y:d[1]}}),e.hoverData.cxtOver=v,v&&v.emit({originalEvent:i,type:"cxtdragover",position:{x:d[0],y:d[1]}}))}}else if(e.hoverData.dragging){if(s=!0,l.panningEnabled()&&l.userPanningEnabled()){var N;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;N={x:(d[0]-B[0])*u,y:(d[1]-B[1])*u},e.hoverData.justStartedPan=!1}else N={x:w[0]*u,y:w[1]*u};l.panBy(N),e.hoverData.dragged=!0}d=e.projectIntoViewport(i.clientX,i.clientY)}else if(1!=f[4]||null!=x&&!x.isEdge()){if(x&&x.isEdge()&&x.active()&&x.unactivate(),x&&x.grabbed()||v==b||(b&&t(b,["mouseout","tapdragout"],i,{position:{x:d[0],y:d[1]}}),v&&t(v,["mouseover","tapdragover"],i,{position:{x:d[0],y:d[1]}}),e.hoverData.last=v),x)if(m){if(l.boxSelectionEnabled()&&_)x&&x.grabbed()&&(y(E),x.emit("free")),M();else if(x&&x.grabbed()&&e.nodeIsDraggable(x)){var z=!e.dragData.didDrag;z&&e.redrawHint("eles",!0),e.dragData.didDrag=!0;var L=[];e.hoverData.draggingEles||g(l.collection(E),{inDragLayer:!0});for(var A=0;A0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=l=[]),t(s,["mouseup","tapend","vmouseup"],r,{position:{x:a[0],y:a[1]}}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||t(u,["click","tap","vclick"],r,{position:{x:a[0],y:a[1]}}),s!=u||e.dragData.didDrag||e.hoverData.selecting||null!=s&&s._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||c?s.selected()?s.unselect():s.select():c||(i.$(":selected").unmerge(s).unselect(),s.select())),e.redrawHint("eles",!0)),e.hoverData.selecting){var p=i.collection(e.getAllInBox(o[0],o[1],o[2],o[3]));e.redrawHint("select",!0),p.length>0&&e.redrawHint("eles",!0),i.emit("boxend");var f=function(e){return e.selectable()&&!e.selected()};"additive"===i.selectionType()?p.emit("box").stdFilter(f).select().emit("boxselect"):(c||i.$(":selected").unmerge(p).unselect(),p.emit("box").stdFilter(f).select().emit("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!o[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var v=u&&u.grabbed();y(l),v&&u.emit("free")}}o[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}},!1);var C=function(t){if(!e.scrollingPage){var n=e.cy,r=e.projectIntoViewport(t.clientX,t.clientY),i=[r[0]*n.zoom()+n.pan().x,r[1]*n.zoom()+n.pan().y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||P())return void t.preventDefault();if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){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);var a;a=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,a*=e.wheelSensitivity;1===t.deltaMode&&(a*=33),n.zoom({level:n.zoom()*Math.pow(10,a),renderedPosition:{x:i[0],y:i[1]}})}}};e.registerBinding(e.container,"wheel",C,!0),e.registerBinding(window,"scroll",function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!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 S,D,k,_,M,I,N,B,z,L,A,O,R,V,q=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},F=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};e.registerBinding(e.container,"touchstart",V=function(n){if(T(n)){e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(n.touches[0]){var o=e.projectIntoViewport(n.touches[0].clientX,n.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(n.touches[1]){var o=e.projectIntoViewport(n.touches[1].clientX,n.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(n.touches[2]){var o=e.projectIntoViewport(n.touches[2].clientX,n.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(n.touches[1]){y(e.dragData.touchDragEles);var s=e.findContainerClientCoords();z=s[0],L=s[1],A=s[2],O=s[3],S=n.touches[0].clientX-z,D=n.touches[0].clientY-L,k=n.touches[1].clientX-z,_=n.touches[1].clientY-L,R=0<=S&&S<=A&&0<=k&&k<=A&&0<=D&&D<=O&&0<=_&&_<=O;var l=r.pan(),u=r.zoom();M=q(S,D,k,_),I=F(S,D,k,_),N=[(S+k)/2,(D+_)/2],B=[(N[0]-l.x)/u,(N[1]-l.y)/u];if(I<4e4&&!n.touches[2]){var c=e.findNearestElement(i[0],i[1],!0,!0),d=e.findNearestElement(i[2],i[3],!0,!0);return c&&c.isNode()?(c.activate().emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=c):d&&d.isNode()?(d.activate().emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=d):r.emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[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(n.touches[2]);else if(n.touches[1]);else if(n.touches[0]){var p=e.findNearestElements(i[0],i[1],!0,!0),f=p[0];if(null!=f&&(f.activate(),e.touchData.start=f,e.touchData.starts=p,e.nodeIsGrabbable(f))){var v=e.dragData.touchDragEles=[],b=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),f.selected()?(b=r.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),g(b,{addToList:v})):m(f,{addToList:v}),h(f);var x=function(e){return{originalEvent:n,type:e,position:{x:i[0],y:i[1]}}};f.emit(x("grabon")),b?b.forEach(function(e){e.emit(x("grab"))}):f.emit(x("grab"))}t(f,["touchstart","tapstart","vmousedown"],n,{position:{x:i[0],y:i[1]}}),null==f&&(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||(t(e.touchData.start,["taphold"],n,{position:{x:i[0],y:i[1]}}),e.touchData.start||r.$(":selected").unselect())},e.tapholdDuration)}if(n.touches.length>=1){for(var w=e.touchData.startPosition=[],E=0;E=e.touchTapThreshold2}if(i&&e.touchData.cxt){n.preventDefault();var E=n.touches[0].clientX-z,P=n.touches[0].clientY-L,C=n.touches[1].clientX-z,N=n.touches[1].clientY-L,A=F(E,P,C,N),O=A/I;if(O>=2.25||A>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var V={originalEvent:n,type:"cxttapend",position:{x:u[0],y:u[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(V),e.touchData.start=null):l.emit(V)}}if(i&&e.touchData.cxt){var V={originalEvent:n,type:"cxtdrag",position:{x:u[0],y:u[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(V):l.emit(V),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var j=e.findNearestElement(u[0],u[1],!0,!0);e.touchData.cxtOver&&j===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:n,type:"cxtdragout",position:{x:u[0],y:u[1]}}),e.touchData.cxtOver=j,j&&j.emit({originalEvent:n,type:"cxtdragover",position:{x:u[0],y:u[1]}}))}else if(i&&n.touches[2]&&l.boxSelectionEnabled())n.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||l.emit("boxstart"),e.touchData.selecting=!0,e.redrawHint("select",!0),s&&0!==s.length&&void 0!==s[0]?(s[2]=(u[0]+u[2]+u[4])/3,s[3]=(u[1]+u[3]+u[5])/3):(s[0]=(u[0]+u[2]+u[4])/3,s[1]=(u[1]+u[3]+u[5])/3,s[2]=(u[0]+u[2]+u[4])/3+1,s[3]=(u[1]+u[3]+u[5])/3+1),s[4]=1,e.touchData.selecting=!0,e.redraw();else if(i&&n.touches[1]&&l.zoomingEnabled()&&l.panningEnabled()&&l.userZoomingEnabled()&&l.userPanningEnabled()){n.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var X=e.dragData.touchDragEles;if(X){e.redrawHint("drag",!0);for(var Y=0;Y0)return v[0]}return null}(e,t,v);if(null!=g){var m=v[5],y=v[3],b=v[1],x=r.qbezierAt(m,y,b,g);if(v.isTop&&x<=t)return!0;if(v.isBottom&&t<=x)return!0}}return!1}}},i.generateBottomRoundrectangle=function(){return this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottomroundrectangle",points:r.generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,i,a,o,s){var l=e-(n/2+s),u=t-(i/2+s),c=u,d=e+(n/2+s),h=r.finiteLinesIntersect(a,o,e,t,l,u,d,c,!1);return h.length>0?h:r.roundRectangleIntersectLine(a,o,e,t,n,i,s)},checkPoint:function(e,t,n,i,a,o,s){var l=r.getRoundRectangleRadius(i,a),u=2*l;if(r.pointInsidePolygon(e,t,this.points,o,s,i,a-u,[0,-1],n))return!0;if(r.pointInsidePolygon(e,t,this.points,o,s,i-u,a,[0,-1],n))return!0;var c=i/2+2*n,d=a/2+2*n,h=[o-c,s-d,o-c,s,o+c,s,o+c,s-d];return!!r.pointInsidePolygonPoints(e,t,h)||(!!r.checkInEllipse(e,t,u,u,o+i/2-l,s+a/2-l,n)||!!r.checkInEllipse(e,t,u,u,o-i/2+l,s+a/2-l,n))}}},i.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",r.generateUnitNgonPointsFitToSquare(3,0)),this.generatePolygon("rectangle",r.generateUnitNgonPointsFitToSquare(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle(),this.generatePolygon("diamond",[0,1,1,0,0,-1,-1,0]),this.generatePolygon("pentagon",r.generateUnitNgonPointsFitToSquare(5,0)),this.generatePolygon("hexagon",r.generateUnitNgonPointsFitToSquare(6,0)),this.generatePolygon("heptagon",r.generateUnitNgonPointsFitToSquare(7,0)),this.generatePolygon("octagon",r.generateUnitNgonPointsFitToSquare(8,0));var n=new Array(20),i=r.generateUnitNgonPoints(5,0),a=r.generateUnitNgonPoints(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:p;e.lineWidth=v,e.lineCap="butt",i.strokeStyle(e,h[0],h[1],h[2],n),i.drawEdgePath(t,e,a.allpts,f)},m=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;i.drawArrowheads(e,t,n)};e.lineJoin="round";if("yes"===t.pstyle("ghost").value){var y=t.pstyle("ghost-offset-x").pfValue,b=t.pstyle("ghost-offset-y").pfValue,x=t.pstyle("ghost-opacity").value,w=p*x;e.translate(y,b),g(w),m(w),e.translate(-y,-b)}g(),m(),function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c;e.lineWidth=u,"self"!==a.edgeType||o?e.lineCap="round":e.lineCap="butt",i.strokeStyle(e,d[0],d[1],d[2],n),i.drawEdgePath(t,e,a.allpts,"solid")}(),function(){i.drawElementText(e,t,r)}(),n&&e.translate(s.x1,s.y1)}},r.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o=void 0,s=!1,l=this.usePaths();if(l){var u=n.join("$");i.pathCacheKey&&i.pathCacheKey===u?(o=t=i.pathCache,s=!0):(o=t=new Path2D,i.pathCacheKey=u,i.pathCache=o)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash([6,3]);break;case"solid":a.setLineDash([])}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var c=2;c+30||S>0&&C>0){var k=l-D;switch(y){case"left":k-=h;break;case"center":k-=h/2}var _=u-p-D,M=h+2*D,I=p+2*D;if(T>0){var N=e.fillStyle,B=t.pstyle("text-background-color").value;e.fillStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+T*s+")";"roundrectangle"==t.pstyle("text-background-shape").strValue?r(e,k,_,M,I,2):e.fillRect(k,_,M,I),e.fillStyle=N}if(S>0&&C>0){var z=e.strokeStyle,L=e.lineWidth,A=t.pstyle("text-border-color").value,O=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+C*s+")",e.lineWidth=S,e.setLineDash)switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=S/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(k,_,M,I),"double"===O){var R=S/2;e.strokeRect(k+R,_+R,M-2*R,I-2*R)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=z}}var V=2*t.pstyle("text-outline-width").pfValue;if(V>0&&(e.lineWidth=V),"wrap"===t.pstyle("text-wrap").value){var q=i.getPrefixedProperty(o,"labelWrapCachedLines",n),F=p/q.length;switch(b){case"top":u-=(q.length-1)*F;break;case"center":case"bottom":u-=(q.length-1)*F}for(var j=0;j0&&e.strokeText(q[j],l,u),e.fillText(q[j],l,u),u+=F}else V>0&&e.strokeText(c,l,u),e.fillText(c,l,u);0!==x&&(e.rotate(-x),e.translate(-E,-P))}}},e.exports=o},function(e,t,n){"use strict";var r=n(0),i={};i.drawNode=function(e,t,n,i){var a=this,o=void 0,s=void 0,l=t._private,u=l.rscratch,c=t.position();if(r.number(c.x)&&r.number(c.y)&&t.visible()){var d=t.effectiveOpacity(),h=a.usePaths(),p=void 0,f=!1,v=t.padding();o=t.width()+2*v,s=t.height()+2*v,e.lineWidth=t.pstyle("border-width").pfValue;var g=void 0;n&&(g=n,e.translate(-g.x1,-g.y1));for(var m=t.pstyle("background-image"),y=m.value,b=void 0,x=[],w=[],E=y.length,P=0;P0&&void 0!==arguments[0]?arguments[0]:k;a.fillStyle(e,D[0],D[1],D[2],t)},B=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;a.strokeStyle(e,_[0],_[1],_[2],t)},z=t.pstyle("shape").strValue,L=t.pstyle("shape-polygon-points").pfValue;if(h){var A=z+"$"+o+"$"+s+("polygon"===z?"$"+L.join("$"):"");e.translate(c.x,c.y),u.pathCacheKey===A?(p=u.pathCache,f=!0):(p=new Path2D,u.pathCacheKey=A,u.pathCache=p)}var O=function(){if(!f){var n=c;h&&(n={x:0,y:0}),a.nodeShapes[a.getNodeShape(t)].draw(p||e,n.x,n.y,o,s)}h?e.fill(p):e.fill()},R=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,r=l.backgrounding,i=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;a.hasPie(t)&&(a.drawPie(e,t,r),n&&(h||a.nodeShapes[a.getNodeShape(t)].draw(e,c.x,c.y,o,s)))},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,n=(C>0?C:-C)*t,r=C>0?0:255;0!==C&&(a.fillStyle(e,r,r,r,n),h?e.fill(p):e.fill())},F=function(){if(S>0&&(h?e.stroke(p):e.stroke(),"double"===M)){e.lineWidth=S/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",h?e.stroke(p):e.stroke(),e.globalCompositeOperation=t}};if("yes"===t.pstyle("ghost").value){var j=t.pstyle("ghost-offset-x").pfValue,X=t.pstyle("ghost-offset-y").pfValue,Y=t.pstyle("ghost-opacity").value,W=Y*d;e.translate(j,X),N(Y*k),O(),R(W),V(0!==C||0!==S),q(W),B(Y*I),F(),e.translate(-j,-X)}N(),O(),R(),V(0!==C||0!==S),q(),B(),F(),h&&e.translate(-c.x,-c.y),function(){a.drawElementText(e,t,i)}(),function(){var n=t.pstyle("overlay-padding").pfValue,r=t.pstyle("overlay-opacity").value,i=t.pstyle("overlay-color").value;r>0&&(a.fillStyle(e,i[0],i[1],i[2],r),a.nodeShapes.roundrectangle.draw(e,c.x,c.y,o+2*n,s+2*n),e.fill())}(),e.setLineDash&&e.setLineDash([]),n&&e.translate(g.x1,g.y1)}},i.hasPie=function(e){return e=e[0],e._private.hasPie},i.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,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,v=t.pstyle("pie-"+h+"-background-opacity").value*n,g=p/100;g+d>1&&(g=1-d);var m=1.5*Math.PI+2*Math.PI*d,y=2*Math.PI*g,b=m+y;0===p||d>=1||d+g>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,m,b),e.closePath(),this.fillStyle(e,f[0],f[1],f[2],v),e.fill(),d+=g)}},e.exports=i},function(e,t,n){"use strict";var r={},i=n(1);r.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},r.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;iu.minMbLowQualFrames&&(u.motionBlurPxRatio=u.mbPxRBlurry)),u.clearingMotionBlur&&(u.motionBlurPxRatio=1),u.textureDrawLastFrame&&!f&&(p[u.NODE]=!0,p[u.SELECT_BOX]=!0);var w=d.style()._private.coreStyle,E=d.zoom(),P=void 0!==s?s:E,T=d.pan(),C={x:T.x,y:T.y},S={zoom:E,pan:{x:T.x,y:T.y}},D=u.prevViewport;void 0===D||S.zoom!==D.zoom||S.pan.x!==D.pan.x||S.pan.y!==D.pan.y||y&&!m||(u.motionBlurPxRatio=1),l&&(C=l),P*=c,C.x*=c,C.y*=c;var k=u.getCachedZSortedEles();if(f||(u.textureDrawLastFrame=!1),f){u.textureDrawLastFrame=!0;if(!u.textureCache){u.textureCache={},u.textureCache.bb=d.mutableElements().boundingBox(),u.textureCache.texture=u.data.bufferCanvases[u.TEXTURE_BUFFER];var _=u.data.bufferContexts[u.TEXTURE_BUFFER];_.setTransform(1,0,0,1,0,0),_.clearRect(0,0,u.canvasWidth*u.textureMult,u.canvasHeight*u.textureMult),u.render({forcedContext:_,drawOnlyNodeLayer:!0,forcedPxRatio:c*u.textureMult});var S=u.textureCache.viewport={zoom:d.zoom(),pan:d.pan(),width:u.canvasWidth,height:u.canvasHeight};S.mpan={x:(0-S.pan.x)/S.zoom,y:(0-S.pan.y)/S.zoom}}p[u.DRAG]=!1,p[u.NODE]=!1;var M=h.contexts[u.NODE],I=u.textureCache.texture,S=u.textureCache.viewport;u.textureCache.bb,M.setTransform(1,0,0,1,0,0),v?t(M,0,0,S.width,S.height):M.clearRect(0,0,S.width,S.height);var N=w["outside-texture-bg-color"].value,B=w["outside-texture-bg-opacity"].value;u.fillStyle(M,N[0],N[1],N[2],B),M.fillRect(0,0,S.width,S.height);var E=d.zoom();n(M,!1),M.clearRect(S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c),M.drawImage(I,S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c)}else u.textureOnViewport&&!r&&(u.textureCache=null);var z=d.extent(),L=u.pinching||u.hoverData.dragging||u.swipePanning||u.data.wheelZooming||u.hoverData.draggingEles,A=u.hideEdgesOnViewport&&L,O=[];if(O[u.NODE]=!p[u.NODE]&&v&&!u.clearedForMotionBlur[u.NODE]||u.clearingMotionBlur,O[u.NODE]&&(u.clearedForMotionBlur[u.NODE]=!0),O[u.DRAG]=!p[u.DRAG]&&v&&!u.clearedForMotionBlur[u.DRAG]||u.clearingMotionBlur,O[u.DRAG]&&(u.clearedForMotionBlur[u.DRAG]=!0),p[u.NODE]||a||o||O[u.NODE]){var R=v&&!O[u.NODE]&&1!==g,M=r||(R?u.data.bufferContexts[u.MOTIONBLUR_BUFFER_NODE]:h.contexts[u.NODE]);n(M,v&&!R?"motionBlur":void 0),A?u.drawCachedNodes(M,k.nondrag,c,z):u.drawLayeredElements(M,k.nondrag,c,z),u.debug&&u.drawDebugPoints(M,k.nondrag),a||v||(p[u.NODE]=!1)}if(!o&&(p[u.DRAG]||a||O[u.DRAG])){var R=v&&!O[u.DRAG]&&1!==g,M=r||(R?u.data.bufferContexts[u.MOTIONBLUR_BUFFER_DRAG]:h.contexts[u.DRAG]);n(M,v&&!R?"motionBlur":void 0),A?u.drawCachedNodes(M,k.drag,c,z):u.drawCachedElements(M,k.drag,c,z),u.debug&&u.drawDebugPoints(M,k.drag),a||v||(p[u.DRAG]=!1)}if(u.showFps||!o&&p[u.SELECT_BOX]&&!a){var M=r||h.contexts[u.SELECT_BOX];if(n(M),1==u.selection[4]&&(u.hoverData.selecting||u.touchData.selecting)){var E=u.cy.zoom(),V=w["selection-box-border-width"].value/E;M.lineWidth=V,M.fillStyle="rgba("+w["selection-box-color"].value[0]+","+w["selection-box-color"].value[1]+","+w["selection-box-color"].value[2]+","+w["selection-box-opacity"].value+")",M.fillRect(u.selection[0],u.selection[1],u.selection[2]-u.selection[0],u.selection[3]-u.selection[1]),V>0&&(M.strokeStyle="rgba("+w["selection-box-border-color"].value[0]+","+w["selection-box-border-color"].value[1]+","+w["selection-box-border-color"].value[2]+","+w["selection-box-opacity"].value+")",M.strokeRect(u.selection[0],u.selection[1],u.selection[2]-u.selection[0],u.selection[3]-u.selection[1]))}if(h.bgActivePosistion&&!u.hoverData.selecting){var E=u.cy.zoom(),q=h.bgActivePosistion;M.fillStyle="rgba("+w["active-bg-color"].value[0]+","+w["active-bg-color"].value[1]+","+w["active-bg-color"].value[2]+","+w["active-bg-opacity"].value+")",M.beginPath(),M.arc(q.x,q.y,w["active-bg-size"].pfValue/E,0,2*Math.PI),M.fill()}var F=u.lastRedrawTime;if(u.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);M.setTransform(1,0,0,1,0,0),M.fillStyle="rgba(255, 0, 0, 0.75)",M.strokeStyle="rgba(255, 0, 0, 0.75)",M.lineWidth=1,M.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);M.strokeRect(0,30,250,20),M.fillRect(0,30,250*Math.min(j/60,1),20)}a||(p[u.SELECT_BOX]=!1)}if(v&&1!==g){var X=h.contexts[u.NODE],Y=u.data.bufferCanvases[u.MOTIONBLUR_BUFFER_NODE],W=h.contexts[u.DRAG],H=u.data.bufferCanvases[u.MOTIONBLUR_BUFFER_DRAG],Z=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!x?e.clearRect(0,0,u.canvasWidth,u.canvasHeight):t(e,0,0,u.canvasWidth,u.canvasHeight);var i=g;e.drawImage(n,0,0,u.canvasWidth*i,u.canvasHeight*i,0,0,u.canvasWidth,u.canvasHeight)};(p[u.NODE]||O[u.NODE])&&(Z(X,Y,O[u.NODE]),p[u.NODE]=!1),(p[u.DRAG]||O[u.DRAG])&&(Z(W,H,O[u.DRAG]),p[u.DRAG]=!1)}u.prevViewport=S,u.clearingMotionBlur&&(u.clearingMotionBlur=!1,u.motionBlurCleared=!0,u.motionBlur=!0),v&&(u.motionBlurTimeout=setTimeout(function(){u.motionBlurTimeout=null,u.clearedForMotionBlur[u.NODE]=!1,u.clearedForMotionBlur[u.DRAG]=!1,u.motionBlur=!1,u.clearingMotionBlur=!f,u.mbFrames=0,p[u.NODE]=!0,p[u.DRAG]=!0,u.redraw()},100)),r||d.emit("render")},e.exports=r},function(e,t,n){"use strict";var r=n(2),i={};i.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=3.99||i>2)return null;var d=Math.pow(2,i),h=t.h*d,p=t.w*d,f=u.imgCaches=u.imgCaches||{},v=f[i];if(v)return v;var g;if(g=h<=25?25:h<=50?50:50*Math.ceil(h/50),h>1024||p>1024||e.isEdge()||e.isParent())return null;var m=o.getTextureQueue(g),y=m[m.length-2],b=function(){return o.recycleTexture(g,p)||o.addTexture(g,p)};y||(y=m[m.length-1]),y||(y=b()),y.width-y.usedWidthi;S--)k=o.getElement(e,t,n,S,s.downscale);_()}else{var M;if(!P&&!T&&!C)for(var S=i-1;S>=-4;S--){var D=f[S];if(D){M=D;break}}if(E(M))return o.queueElement(e,t,i),M;y.context.translate(y.usedWidth,0),y.context.scale(d,d),l.drawElement(y.context,e,t,w),y.context.scale(1/d,1/d),y.context.translate(-y.usedWidth,0)}return v=f[i]={ele:e,x:y.usedWidth,texture:y,level:i,scale:d,width:p,height:h,scaledLabelShown:w},y.usedWidth+=Math.ceil(p+8),y.eleCaches.push(v),o.checkTextureFullness(y),v},u.invalidateElement=function(e){var t=this,n=e._private.rscratch.imgCaches;if(n)for(var r=-4;r<=2;r++){var a=n[r];if(a){var o=a.texture;o.invalidatedWidth+=a.width,n[r]=null,i.removeFromArray(o.eleCaches,a),t.checkTextureUtility(o)}}},u.checkTextureUtility=function(e){e.invalidatedWidth>=.5*e.width&&this.retireTexture(e)},u.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?i.removeFromArray(n,e):e.fullnessChecks++},u.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n);i.removeFromArray(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,i.clearArray(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),i.removeFromArray(a,s),r.push(s),s}},u.queueElement=function(e,t,n){var i=this,a=i.getElementQueue(),o=i.getElementIdToQueue(),s=e.id(),l=o[s];if(l)l.level=Math.max(l.level,n),l.reqs++,a.updateItem(l);else{var u={ele:e,bb:t,position:r.copyPosition(e.position()),level:n,reqs:1};e.isEdge()&&(u.positions={source:r.copyPosition(e.source().position()),target:r.copyPosition(e.target().position())}),a.push(u),o[s]=u}},u.dequeue=function(e){for(var t=this,n=t.getElementQueue(),i=t.getElementIdToQueue(),a=[],o=0;o<1&&n.size()>0;o++){var l=n.pop();i[l.ele.id()]=null,a.push(l);var u,c=l.ele;u=(!c.isEdge()||r.arePositionsSame(c.source().position(),l.positions.source)&&r.arePositionsSame(c.target().position(),l.positions.target))&&r.arePositionsSame(c.position(),l.position)?l.bb:c.boundingBox(),t.getElement(l.ele,u,e,l.level,s.dequeue)}return a},u.onDequeue=function(e){this.onDequeues.push(e)},u.offDequeue=function(e){i.removeFromArray(this.onDequeues,e)},u.setupDequeueing=o.setupDequeueing({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n0&&s>0){f.clearRect(0,0,a,s),f.globalCompositeOperation="source-over";var v=this.getCachedZSortedEles();if(e.full)f.translate(-r.x1*c,-r.y1*c),f.scale(c,c),this.drawElements(f,v),f.scale(1/c,1/c),f.translate(r.x1*c,r.y1*c);else{var g=t.pan(),m={x:g.x*c,y:g.y*c};c*=t.zoom(),f.translate(m.x,m.y),f.scale(c,c),this.drawElements(f,v),f.scale(1/c,1/c),f.translate(-m.x,-m.y)}e.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=e.bg,f.rect(0,0,a,s),f.fill())}return p},s.png=function(e){return a(e,this.bufferCanvasImage(e),"image/png")},s.jpg=function(e){return a(e,this.bufferCanvasImage(e),"image/jpeg")},e.exports=s},function(e,t,n){"use strict";function r(e){var t=this;t.data={canvases:new Array(u.CANVAS_LAYERS),contexts:new Array(u.CANVAS_LAYERS),canvasNeedsRedraw:new Array(u.CANVAS_LAYERS),bufferCanvases:new Array(u.BUFFER_COUNT),bufferContexts:new Array(u.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color: rgba(0,0,0,0);";t.data.canvasContainer=document.createElement("div");var r=t.data.canvasContainer.style;t.data.canvasContainer.setAttribute("style",n),r.position="relative",r.zIndex="0",r.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),(i.getAttribute("style")||"").indexOf(n)<0&&i.setAttribute("style",(i.getAttribute("style")||"")+n);for(var l=0;l0&&t.data.lyrTxrCache.invalidateElements(n)})}var i=n(1),a=n(0),o=n(110),s=n(113),l=r,u=r.prototype;u.CANVAS_LAYERS=3,u.SELECT_BOX=0,u.DRAG=1,u.NODE=2,u.BUFFER_COUNT=3,u.TEXTURE_BUFFER=0,u.MOTIONBLUR_BUFFER_NODE=1,u.MOTIONBLUR_BUFFER_DRAG=2,u.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[u.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[u.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[u.SELECT_BOX]=t}};var c="undefined"!=typeof Path2D;u.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},u.usePaths=function(){return c&&this.pathsEnabled},[n(102),n(104),n(103),n(105),n(106),n(107),n(108),n(109),n(111),n(114)].forEach(function(e){i.extend(u,e)}),e.exports=l},function(e,t,n){"use strict";function r(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)}var i=n(1),a=n(2),o=n(8),s=n(0),l=n(16),u=function(e,t){var n=this,r=n.renderer=e;n.layersByLevel={},n.firstGet=!0,n.lastInvalidationTime=i.performanceNow()-500,n.skipping=!1,r.beforeRender(function(e,t){t-n.lastInvalidationTime<=250?n.skipping=!0:n.skipping=!1});var a=function(e,t){return t.reqs-e.reqs};n.layersQueue=new o(a),n.eleTxrCache=t,n.setupEleCacheInvalidation(),n.setupDequeueing()},c=u.prototype,d=0,h=Math.pow(2,53)-1;c.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=document.createElement("canvas");a.width=r,a.height=i;var o={id:d=++d%h,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},c.getLayers=function(e,t,n){var r=this,o=r.renderer,s=o.cy,l=s.zoom(),u=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(a.log2(l*t)))<-4)n=-4;else if(l>=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var c,d,h=r.layersByLevel,p=Math.pow(2,n),f=h[n]=h[n]||[],v=r.levelIsComplete(n,e);if(v)return f;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return d=h[t],!0},a=function(e){if(!d)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};a(1),a(-1);for(var o=f.length-1;o>=0;o--){var s=f[o];s.invalid&&i.removeFromArray(f,s)}}();var g=function(){if(!c){c=a.makeBoundingBox();for(var t=0;t=y||!a.boundingBoxInBoundingBox(m.bb,w.boundingBox()))&&!(m=function(e){e=e||{};var t=e.after;if(g(),c.w*p*(c.h*p)>16e6)return null;var i=r.makeLayer(c,n);if(null!=t){var a=f.indexOf(t)+1;f.splice(a,0,i)}else(void 0===e.insert||e.insert)&&f.unshift(i);return i}({insert:!0,after:m})))return null;d||b?r.queueLayer(m,w):r.drawEleInLayer(m,w,n,t),m.eles.push(w),P[n]=m}}return d||(b?null:f)},c.getEleLevelForLayerLevel=function(e,t){return e},c.drawEleInLayer=function(e,t,n,i){var a=this,o=this.renderer,s=e.context,l=t.boundingBox();if(0!==l.w&&0!==l.h&&t.visible()){var u=a.eleTxrCache,c=u.reasons.highQuality;n=a.getEleLevelForLayerLevel(n,i);var d=u.getElement(t,l,null,n,c);d?(r(s,!1),s.drawImage(d.texture.canvas,d.x,0,d.width,d.height,l.x1,l.y1,l.w,l.h),r(s,!0)):o.drawElement(s,t)}},c.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||0===r.length)return!1;for(var i=0,a=0;a0)return!1;if(o.invalid)return!1;i+=o.eles.length}return i===t.length},c.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){t=!0;break}}return t},c.invalidateElements=function(e){var t=this;t.lastInvalidationTime=i.performanceNow(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)})},c.invalidateLayer=function(e){if(this.lastInvalidationTime=i.performanceNow(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];i.removeFromArray(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a=0&&(d=d.toLowerCase(),h=h.toLowerCase(),o=o.replace("@",""),p=!0);var f=!1;o.indexOf("!")>=0&&(o=o.replace("!",""),f=!0),p&&(s=h.toLowerCase(),c=d.toLowerCase());var v=!1;switch(o){case"*=":u=d.indexOf(h)>=0;break;case"$=":u=d.indexOf(h,d.length-h.length)>=0;break;case"^=":u=0===d.indexOf(h);break;case"=":u=c===s;break;case">":v=!0,u=c>s;break;case">=":v=!0,u=c>=s;break;case"<":v=!0,u=c\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:'"(?:\\\\"|[^"])*"|'+"'(?:\\\\'|[^'])*'",number:r.regex.number,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};i.variable="(?:[\\w-]|(?:\\\\"+i.metaChar+"))+",i.value=i.string+"|"+i.number,i.className=i.variable,i.id=i.variable,function(){var e=void 0,t=void 0,n=void 0;for(e=i.comparatorOp.split("|"),n=0;n=0||"="!==t&&(i.comparatorOp+="|\\!"+t)}(),e.exports=i},function(e,t,n){"use strict";var r=n(1),i=n(0),a=n(5),o={};o.apply=function(e){var t=this,n=t._private,r=n.cy,i=r.collection();n.newStyle&&(n.contextStyles={},n.propDiffs={},t.cleanElements(e,!0));for(var a=0;a0;if(h||p){var f=void 0;h&&p?f=u.properties:h?f=u.properties:p&&(f=u.mappedProperties);for(var v=0;v0){r=!0;break}}t.hasPie=r;var o=e.pstyle("text-transform").strValue,s=e.pstyle("label").strValue,l=e.pstyle("source-label").strValue,u=e.pstyle("target-label").strValue,c=e.pstyle("font-style").strValue,d=e.pstyle("font-size").pfValue+"px",h=e.pstyle("font-family").strValue,p=e.pstyle("font-weight").strValue,f=e.pstyle("text-valign").strValue,v=e.pstyle("text-valign").strValue,g=e.pstyle("text-outline-width").pfValue,m=e.pstyle("text-wrap").strValue,y=e.pstyle("text-max-width").pfValue,b=c+"$"+d+"$"+h+"$"+p+"$"+o+"$"+f+"$"+v+"$"+g+"$"+m+"$"+y;t.labelStyleKey=b,t.sourceLabelKey=b+"$"+l,t.targetLabelKey=b+"$"+u,t.labelKey=b+"$"+s,t.fontKey=c+"$"+p+"$"+d+"$"+h,t.styleKey=Date.now()}},o.applyParsedProperty=function(e,t){var n=this,a=t,o=e._private.style,s=void 0,l=n.types,u=n.properties[a.name].type,c=a.bypass,d=o[a.name],h=d&&d.bypass,p=e._private,f=function(){n.checkZOrderTrigger(e,a.name,d?d.value:null,a.value)};if("curve-style"===t.name&&"haystack"===t.value&&e.isEdge()&&(e.isLoop()||e.source().isParent()||e.target().isParent())&&(a=t=this.parse(t.name,"bezier",c)),a.delete)return o[a.name]=void 0,f(),!0;if(a.deleteBypassed)return d?!!d.bypass&&(d.bypassed=void 0,f(),!0):(f(),!0);if(a.deleteBypass)return d?!!d.bypass&&(o[a.name]=d.bypassed,f(),!0):(f(),!0);var v=function(){r.error("Do not assign mappings to elements without corresponding data (e.g. ele `"+e.id()+"` for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case l.mapData:for(var g=a.field.split("."),m=p.data,y=0;y1&&(b=1),u.color){var x=a.valueMin[0],w=a.valueMax[0],E=a.valueMin[1],P=a.valueMax[1],T=a.valueMin[2],C=a.valueMax[2],S=null==a.valueMin[3]?1:a.valueMin[3],D=null==a.valueMax[3]?1:a.valueMax[3],k=[Math.round(x+(w-x)*b),Math.round(E+(P-E)*b),Math.round(T+(C-T)*b),Math.round(S+(D-S)*b)];s={bypass:a.bypass,name:a.name,value:k,strValue:"rgb("+k[0]+", "+k[1]+", "+k[2]+")"}}else{if(!u.number)return!1;var _=a.valueMin+(a.valueMax-a.valueMin)*b;s=this.parse(a.name,_,a.bypass,"mapping")}s||(s=this.parse(a.name,d.strValue,a.bypass,"mapping")),s||v(),s.mapping=a,a=s;break;case l.data:var M=a.field.split("."),I=p.data;if(I)for(var N=0;N0&&l>0){for(var c={},d=!1,h=0;h0?e.delayAnimation(u).play().promise().then(t):t()}).then(function(){return e.animation({style:c,duration:l,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,s),e.emitAndNotify("style"),o.transitioning=!1})}else o.transitioning&&(this.removeBypasses(e,s),e.emitAndNotify("style"),o.transitioning=!1)},o.checkZOrderTrigger=function(e,t,n,r){var i=this.properties[t];null==i.triggersZOrder||null!=n&&!i.triggersZOrder(n,r)||this._private.cy.notify({type:"zorder",eles:e})},e.exports=o},function(e,t,n){"use strict";var r=n(0),i=n(1),a={};a.applyBypass=function(e,t,n,a){var o=this,s=[];if("*"===t||"**"===t){if(void 0!==n)for(var l=0;lh.max||h.strictMax&&t===h.max))return null;var B={name:e,value:t,strValue:""+t+(_||""),units:_,bypass:n};return h.unitless||"px"!==_&&"em"!==_?B.pfValue=t:B.pfValue="px"!==_&&_?this.getEmSizeInPixels()*t:t,"ms"!==_&&"s"!==_||(B.pfValue="ms"===_?t:1e3*t),"deg"!==_&&"rad"!==_||(B.pfValue="rad"===_?t:a.deg2rad(t)),"%"===_&&(B.pfValue=t/100),B}if(h.propList){var z=[],L=""+t;if("none"===L);else{for(var A=L.split(","),O=0;O node").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3,"curve-style":"haystack"}).selector(":parent <-> node").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("node:parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}).selector("core").css({"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}),this.defaultLength=this.length},e.exports=a},function(e,t,n){"use strict";var r=n(1),i=n(6),a={};a.appendFromString=function(e){function t(){s=s.length>l.length?s.substr(l.length):""}function n(){u=u.length>c.length?u.substr(c.length):""}var a=this,o=this,s=""+e,l=void 0,u=void 0,c=void 0;for(s=s.replace(/[\/][*](\s|.)+?[*][\/]/g,"");;){if(s.match(/^\s*$/))break;var d=s.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){r.error("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+s);break}l=d[0];var h=d[1];if("core"!==h){if(new i(h)._private.invalid){r.error("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),t();continue}}var p=d[2],f=!1;u=p;for(var v=[];;){if(u.match(/^\s*$/))break;var g=u.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!g){r.error("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),f=!0;break}c=g[0];var m=g[1],y=g[2];if(a.properties[m]){o.parse(m,y)?(v.push({name:m,val:y}),n()):(r.error("Skipping property: Invalid property definition in: "+c),n())}else r.error("Skipping property: Invalid property name in: "+c),n()}if(f){t();break}o.selector(h);for(var b=0;b1&&(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 n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=new RegExp("^"+this.regex.hsla+"$").exec(e);if(c){if(r=parseInt(c[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(i=parseFloat(c[2]))<0||i>100)return;if(i/=100,(a=parseFloat(c[3]))<0||a>100)return;if(a/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1))return;if(0===i)s=l=u=Math.round(255*a);else{var d=a<.5?a*(1+i):a+i-a*i,h=2*a-d;s=Math.round(255*t(h,d,r+1/3)),l=Math.round(255*t(h,d,r)),u=Math.round(255*t(h,d,r-1/3))}n=[s,l,u,o]}return n},rgb2tuple:function(e){var t=void 0,n=new RegExp("^"+this.regex.rgba+"$").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))<0||l>1)return;t.push(l)}}return t},colorname2tuple:function(e){return this.colors[e.toLowerCase()]},color2tuple:function(e){return(r.array(e)?e:null)||this.colorname2tuple(e)||this.hex2tuple(e)||this.rgb2tuple(e)||this.hsl2tuple(e)},colors:{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]}}},function(e,t,n){"use strict";var r=n(0);e.exports={mapEmpty:function(e){return null==e||0===Object.keys(e).length},pushMap:function(e){var t=this.getMap(e);null==t?this.setMap(this.extend({},e,{value:[e.value]})):t.push(e.value)},setMap:function(e){for(var t=e.map,n=e.keys,i=n.length,a=0;at?1:0}function i(e,t){return-1*r(e,t)}e.exports={sort:{ascending:r,descending:i}}},function(e,t,n){"use strict";var r=n(19),i=n(0);e.exports={camel2dash:r(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),dash2camel:r(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),prependCamel:r(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),capitalize:function(e){return i.emptyString(e)?e:e.charAt(0).toUpperCase()+e.substring(1)}}},function(e,t,n){"use strict";var r=n(4),i=r?r.performance:null,a={},o=i&&i.now?function(){return i.now()}:function(){return Date.now()},s=function(){if(r){if(r.requestAnimationFrame)return function(e){r.requestAnimationFrame(e)};if(r.mozRequestAnimationFrame)return function(e){r.mozRequestAnimationFrame(e)};if(r.webkitRequestAnimationFrame)return function(e){r.webkitRequestAnimationFrame(e)};if(r.msRequestAnimationFrame)return function(e){r.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(o())},1e3/60)}}();a.requestAnimationFrame=function(e){s(e)},a.performanceNow=o,a.debounce=n(139),a.now=function(){return Date.now()},e.exports=a},function(e,t,n){e.exports=n(138)},function(e,t,n){var r,i,a;(function(){var n,o,s,l,u,c,d,h,p,f,v,g,m,y,b;s=Math.floor,f=Math.min,o=function(e,t){return et?1:0},p=function(e,t,n,r,i){var a;if(null==n&&(n=0),null==i&&(i=o),n<0)throw new Error("lo must be non-negative");for(null==r&&(r=e.length);nn;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse(),l=[],r=0,i=a.length;rv;0<=v?++c:--c)g.push(u(e,n));return g},y=function(e,t,n,r){var i,a,s;for(null==r&&(r=o),i=e[n];n>t&&(s=n-1>>1,a=e[s],r(i,a)<0);)e[n]=a,n=s;return e[n]=i},b=function(e,t,n){var r,i,a,s,l;for(null==n&&(n=o),i=e.length,l=t,a=e[t],r=2*t+1;r=t||n<0||S&&r>=m}function c(){var e=E();if(u(e))return d(e);b=setTimeout(c,l(e))}function d(e){return b=void 0,D&&v?i(e):(v=g=void 0,y)}function h(){void 0!==b&&clearTimeout(b),T=0,v=P=g=b=void 0}function p(){return void 0===b?y:d(E())}function f(){var e=E(),n=u(e);if(v=arguments,g=this,P=e,n){if(void 0===b)return a(P);if(S)return b=setTimeout(c,t),i(P)}return void 0===b&&(b=setTimeout(c,t)),y}var v,g,m,y,b,P,T=0,C=!1,S=!1,D=!0;if("function"!=typeof e)throw new TypeError(s);return t=o(t)||0,r(n)&&(C=!!n.leading,S="maxWait"in n,m=S?x(o(n.maxWait)||0,t):m,D="trailing"in n?!!n.trailing:D),f.cancel=h,f.flush=p,f}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==typeof e}function a(e){return"symbol"==typeof e||i(e)&&b.call(e)==u}function o(e){if("number"==typeof e)return e;if(a(e))return l;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var n=h.test(e);return n||p.test(e)?f(e.slice(2),n?2:8):d.test(e)?l:+e}var s="Expected a function",l=NaN,u="[object Symbol]",c=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,p=/^0o[0-7]+$/i,f=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,m=v||g||Function("return this")(),y=Object.prototype,b=y.toString,x=Math.max,w=Math.min,E=function(){return m.Date.now()};e.exports=n}).call(t,n(20))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function o(){v&&p&&(v=!1,p.length?f=p.concat(f):g=-1,f.length&&s())}function s(){if(!v){var e=i(o);v=!0;for(var t=f.length;t;){for(p=f,f=[];++g1)for(var n=1;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(141),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate}])}); \ No newline at end of file +var r=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={x:-1,v:0,tension:null,friction:null},o=[0],s=0,l=void 0,u=void 0,c=void 0;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,a.tension=t,a.friction=r,l=null!==i,l?(s=e(t,r),u=s/i*.016):u=.016;c=n(c||a,u),o.push(1+c.x),s+=16,Math.abs(c.x)>1e-4&&Math.abs(c.v)>1e-4;);return l?function(e){return o[e*(o.length-1)|0]}:s}}();e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){var i=!r,a=e,o=t._private,s=r?e:e.cy(),l=s.style();if(i){var u=a.position();o.startPosition=o.startPosition||{x:u.x,y:u.y},o.startStyle=o.startStyle||l.getAnimationStartStyle(a,o.style)}if(r){var c=s._private.pan;o.startPan=o.startPan||{x:c.x,y:c.y},o.startZoom=null!=o.startZoom?o.startZoom:s._private.zoom}o.started=!0,o.startTime=n-o.progress*o.duration}e.exports=r},function(e,t,n){"use strict";function r(e,t){function n(t,n){var r=t._private,s=r.animation.current,l=r.animation.queue,u=!1;if(!n&&"none"===t.pstyle("display").value){s=s.splice(0,s.length).concat(l.splice(0,l.length));for(var c=0;c=0;t--){(0,e[t])()}e.splice(0,e.length)},p=s.length-1;p>=0;p--){var f=s[p],v=f._private;v.stopped?(s.splice(p,1),v.hooked=!1,v.playing=!1,v.started=!1,h(v.frames)):(v.playing||v.applying)&&(v.playing&&v.applying&&(v.applying=!1),v.started||a(t,f,e,n),i(t,f,e,n),v.applying&&(v.applying=!1),h(v.frames),f.completed()&&(s.splice(p,1),v.hooked=!1,v.playing=!1,v.started=!1,h(v.completes)),u=!0)}return n||0!==s.length||0!==l.length||o.push(t),u}for(var r=t._private.aniEles,o=[],s=!1,l=0;l0?(r.dirtyCompoundBoundsCache(),t.notify({type:"draw",eles:r})):t.notify({type:"draw"})),r.unmerge(o),t.emit("step")}var i=n(64),a=n(62);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){var l=!r,u=e._private,c=t._private,d=c.easing,h=c.startTime,p=r?e:e.cy(),f=p.style();if(!c.easingImpl)if(null==d)c.easingImpl=a.linear;else{var v=void 0;if(s.string(d)){var g=f.parse("transition-timing-function",d);v=g.value}else v=d;var m=void 0,y=void 0;s.string(v)?(m=v,y=[]):(m=v[1],y=v.slice(2).map(function(e){return+e})),y.length>0?("spring"===m&&y.push(c.duration),c.easingImpl=a[m].apply(null,y)):c.easingImpl=a[m]}var b=c.easingImpl,x=void 0;if(x=0===c.duration?1:(n-h)/c.duration,c.applying&&(x=c.progress),x<0?x=0:x>1&&(x=1),null==c.delay){var w=c.startPosition,E=c.position;if(E&&l&&!e.locked()){var P=e.position();i(w.x,E.x)&&(P.x=o(w.x,E.x,x,b)),i(w.y,E.y)&&(P.y=o(w.y,E.y,x,b)),e.emit("position")}var T=c.startPan,C=c.pan,S=u.pan,D=null!=C&&r;D&&(i(T.x,C.x)&&(S.x=o(T.x,C.x,x,b)),i(T.y,C.y)&&(S.y=o(T.y,C.y,x,b)),e.emit("pan"));var k=c.startZoom,_=c.zoom,M=null!=_&&r;M&&(i(k,_)&&(u.zoom=o(k,_,x,b)),e.emit("zoom")),(D||M)&&e.emit("viewport");var I=c.style;if(I&&I.length>0&&l){for(var N=0;N0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchingStyle=e.batchingNotify=!0,e.batchStyleEles=this.collection(),e.batchNotifyEles=this.collection(),e.batchNotifyTypes=[],e.batchNotifyTypes.ids={}),e.batchCount++,this},endBatch:function(){var e=this._private;return e.batchCount--,0===e.batchCount&&(e.batchingStyle=!1,e.batchStyleEles.updateStyle(),e.batchingNotify=!1,this.notify({type:e.batchNotifyTypes,eles:e.batchNotifyEles})),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;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};i.invalidateDimensions=i.resize,e.exports=i},function(e,t,n){"use strict";var r=n(0),i=n(7),a={collection:function(e,t){return r.string(e)?this.$(e):r.elementOrCollection(e)?e.collection():r.array(e)?new i(this,e,t):new i(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}};a.elements=a.filter=a.$,e.exports=a},function(e,t,n){"use strict";var r=n(0),i=n(18),a={style:function(e){if(e){this.setStyle(e).update()}return this._private.style},setStyle:function(e){var t=this._private;return r.stylesheet(e)?t.style=e.generateStyle(this):r.array(e)?t.style=i.fromJson(this,e):r.string(e)?t.style=i.fromString(this,e):t.style=i(this),t.style}};e.exports=a},function(e,t,n){"use strict";var r=n(0),i=n(4),a=n(2),o={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)},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=arguments,t=this._private.pan,n=void 0,i=void 0,a=void 0,o=void 0,s=void 0;switch(e.length){case 0:return t;case 1:if(r.string(e[0]))return n=e[0],t[n];if(r.plainObject(e[0])){if(!this._private.panningEnabled)return this;a=e[0],o=a.x,s=a.y,r.number(o)&&(t.x=o),r.number(s)&&(t.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],i=e[1],"x"!==n&&"y"!==n||!r.number(i)||(t[n]=i),this.emit("pan viewport")}return this.notify({type:"viewport"}),this},panBy:function(e,t){var n=arguments,i=this._private.pan,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0;if(!this._private.panningEnabled)return this;switch(n.length){case 1:r.plainObject(e)&&(s=n[0],l=s.x,u=s.y,r.number(l)&&(i.x+=l),r.number(u)&&(i.y+=u),this.emit("pan viewport"));break;case 2:a=e,o=t,"x"!==a&&"y"!==a||!r.number(o)||(i[a]+=o),this.emit("pan viewport")}return this.notify({type:"viewport"}),this},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({type:"viewport"})}return this},getFitViewport:function(e,t){if(r.number(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n=void 0;if(r.string(e)){var i=e;e=this.$(i)}else if(r.boundingBox(e)){var a=e;n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else r.elementOrCollection(e)||(e=this.mutableElements());if(!r.elementOrCollection(e)||!e.empty()){n=n||e.boundingBox();var o=this.width(),s=this.height(),l=void 0;if(t=r.number(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((o-2*t)/n.w,(s-2*t)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=lt.maxZoom?t.maxZoom:s,s=st.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=l,a.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;r.number(u.x)&&(t.pan.x=u.x,s=!1),r.number(u.y)&&(t.pan.y=u.y,s=!1),s||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify({type:"viewport"})),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify({type:"viewport"})),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(r.string(e)){var n=e;e=this.mutableElements().filter(n)}else r.elementOrCollection(e)||(e=this.mutableElements());if(0!==e.length){var i=e.boundingBox(),a=this.width(),o=this.height();t=void 0===t?this._private.zoom:t;return{x:(a-t*(i.x1+i.x2))/2,y:(o-t*(i.y1+i.y2))/2}}}},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;return e.sizeCache=e.sizeCache||(t?function(){var e=i.getComputedStyle(t),n=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-n("padding-left")-n("padding-right"),height:t.clientHeight-n("padding-top")-n("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}}};o.centre=o.center,o.autolockNodes=o.autolock,o.autoungrabifyNodes=o.autoungrabify,e.exports=o},function(e,t,n){"use strict";var r=n(1),i=n(24),a=n(2),o=n(0),s={animated:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e];if(!(this._private.cy||this).styleEnabled())return!1;var r=n[0];return r?r._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var r=0;r0;)!function(){var e=n.collection();r.bfs({roots:v[0],visit:function(t,n,r,i,a){e=e.add(t)},directed:!1}),v=v.not(e),f.push(e)}();u=n.collection();for(var g=0;gm.length-1;)m.push([]);m[G].push(H),Z.depth=G,Z.index=m[G].length-1}z()}var Q=0;if(t.avoidOverlap)for(var K=0;Kc||0===t)&&(r+=u/d,a++)}return a=Math.max(1,a),r/=a,0===a&&(r=void 0),re[e.id()]=r,r},ae=function(e,t){return ie(e)-ie(t)},oe=0;oe<3;oe++){for(var se=0;se=0;he--)for(var pe=m[he],fe=0;fe0&&m[0].length<=3?c/2:0),h=2*Math.PI/m[i].length*a;return 0===i&&1===m[0].length&&(d=1),{x:ce.x+d*Math.cos(h),y:ce.y+d*Math.sin(h)}}return{x:ce.x+(a+1-(o+1)/2)*s,y:(i+1)*u}}var p={x:ce.x+(a+1-(o+1)/2)*s,y:(i+1)*u};return p}(ve,m.length)}return i.layoutPositions(this,t,function(e){return de[e.id()]}),this},e.exports=r},function(e,t,n){"use strict";function r(e){this.options=i.extend({},s,e)}var i=n(1),a=n(2),o=n(0),s={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}};r.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,s=r.nodes().not(":parent");t.sort&&(s=s.sort(t.sort));for(var l=a.makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u={x:l.x1+l.w/2,y:l.y1+l.h/2},c=void 0===t.sweep?2*Math.PI-2*Math.PI/s.length:t.sweep,d=c/Math.max(1,s.length-1),h=void 0,p=0,f=0;f1&&t.avoidOverlap){p*=1.75;var b=Math.cos(d)-Math.cos(0),x=Math.sin(d)-Math.sin(0),w=Math.sqrt(p*p/(b*b+x*x));h=Math.max(w,h)}var E=function(e,n){var r=t.startAngle+n*d*(i?1:-1),a=h*Math.cos(r),o=h*Math.sin(r);return{x:u.x+a,y:u.y+o}};return s.layoutPositions(this,t,E),this},e.exports=r},function(e,t,n){"use strict";function r(e){this.options=i.extend({},o,e)}var i=n(1),a=n(2),o={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}};r.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,o=i.nodes().not(":parent"),s=a.makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],c=(t.startAngle,0),d=0;d0){Math.abs(b[0].value-w.value)>=m&&(b=[],y.push(b))}b.push(w)}var E=c+t.minNodeSpacing;if(!t.avoidOverlap){var P=y.length>0&&y[0].length>1,T=Math.min(s.w,s.h)/2-E,C=T/(y.length+P?1:0);E=Math.min(E,C)}for(var S=0,D=0;D1&&t.avoidOverlap){var I=Math.cos(M)-Math.cos(0),N=Math.sin(M)-Math.sin(0),B=Math.sqrt(E*E/(I*I+N*N));S=Math.max(B,S)}k.r=S,S+=E}if(t.equidistant){for(var z=0,L=0,A=0;A0)var l=r.nodeOverlap*o,d=Math.sqrt(i*i+a*a),h=l*i/d,p=l*a/d;else var f=c(e,i,a),v=c(t,-1*i,-1*a),g=v.x-f.x,m=v.y-f.y,y=g*g+m*m,d=Math.sqrt(y),l=(e.nodeRepulsion+t.nodeRepulsion)/y,h=l*g/d,p=l*m/d;e.isLocked||(e.offsetX-=h,e.offsetY-=p),t.isLocked||(t.offsetX+=h,t.offsetY+=p)}},u=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},c=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&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=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},d=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,v=t.gravity*h/p;c.offsetX+=f,c.offsetY+=v}}}}},p=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},g=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.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopg&&(p+=v+t.componentSpacing,h=0,f=0,v=0)}}}(0,i),r}).then(function(e){h.layoutNodes=e.layoutNodes,o.stop(),b()});var b=function(){!0===t.animate||!1===t.animate?y({force:!0,next:function(){r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r})}}):t.eles.nodes().layoutPositions(r,t,function(e){var t=h.layoutNodes[h.idToIndex[e.data("id")]];return{x:t.positionX,y:t.positionY}})};return this},r.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},r.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var c=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:o.makeBoundingBox(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},l=n.eles.components(),u={},c=0;c0){a.graphSet.push(C);for(var c=0;cr.count?0:r.graph},h=function e(t,n,r,i){var a=i.graphSet[r];if(-1s){var v=d(),g=h();(v-1)*g>=s?d(v-1):(g-1)*v>=s&&h(g-1)}else for(;c*u=s?h(y+1):d(m+1)}var b=o.w/c,x=o.h/u;if(t.condense&&(b=0,x=0),t.avoidOverlap)for(var w=0;w=c&&(N=0,I++)},z={},L=0;L=0;E--){var P=f[E];P.isNode()?s(P)||u(P):function(n){var r,a=n._private,l=a.rscratch,u=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,d=u/2+y,f=d*d,g=2*d,b=a.source,x=a.target;if("segments"===l.edgeType||"straight"===l.edgeType||"haystack"===l.edgeType){for(var w=l.allpts,E=0;E+3(r=i.sqdistToFiniteLine(e,t,w[E],w[E+1],w[E+2],w[E+3])))return o(n,r),!0}else if("bezier"===l.edgeType||"multibezier"===l.edgeType||"self"===l.edgeType||"compound"===l.edgeType)for(var w=l.allpts,E=0;E+5(r=i.sqdistToQuadraticBezier(e,t,w[E],w[E+1],w[E+2],w[E+3],w[E+4],w[E+5])))return o(n,r),!0;for(var b=b||a.source,x=x||a.target,P=h.getArrowWidth(u,c),T=[{name:"source",x:l.arrowStartX,y:l.arrowStartY,angle:l.srcArrowAngle},{name:"target",x:l.arrowEndX,y:l.arrowEndY,angle:l.tgtArrowAngle},{name:"mid-source",x:l.midX,y:l.midY,angle:l.midsrcArrowAngle},{name:"mid-target",x:l.midX,y:l.midY,angle:l.midtgtArrowAngle}],E=0;E0&&(s(b),s(x))}(P)||u(P)||u(P,"source")||u(P,"target")}return v},o.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,o=[],s=Math.min(e,n),l=Math.max(e,n),u=Math.min(t,r),c=Math.max(t,r);e=s,n=l,t=u,r=c;for(var d=i.makeBoundingBox({x1:e,y1:t,x2:n,y2:r}),h=0;hy?y+"$-$"+m:m+"$-$"+y,v&&(t="unbundled$-$"+p.id);var b=s[t];null==b&&(b=s[t]=[],l.push(t)),b.push(d),v&&(b.hasUnbundled=!0),g&&(b.hasBezier=!0)}else u.push(d)}for(var x,w,E,P,T,C,S,D,k,_,M,I,N=0;Nw.id()){var z=x;x=w,w=z}E=x.position(),P=w.position(),T=x.outerWidth(),C=x.outerHeight(),S=w.outerWidth(),D=w.outerHeight(),k=n.nodeShapes[this.getNodeShape(x)],_=n.nodeShapes[this.getNodeShape(w)],I=!1;for(var d,L,A,O={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0},R=E.x,V=E.y,q=T,F=C,j=P.x,X=P.y,Y=S,W=D,H=B.length,c=0;c=c||x){h={cp:m,segment:b};break}}if(h)break}var m=h.cp,b=h.segment,w=(c-f)/b.length,E=b.t1-b.t0,P=o?b.t0+E*w:b.t1-E*w;P=r.bound(0,P,1),t=r.qbezierPtAt(m.p0,m.p1,m.p2,P),a=function(e,t,n,i){var a=r.bound(0,i-.001,1),o=r.bound(0,i+.001,1),s=r.qbezierPtAt(e,t,n,a),l=r.qbezierPtAt(e,t,n,o);return d(s,l)}(m.p0,m.p1,m.p2,P);break;case"straight":case"segments":case"haystack":for(var T,C,S,D,k=0,_=i.allpts.length,g=0;g+3<_&&(o?(S={x:i.allpts[g],y:i.allpts[g+1]},D={x:i.allpts[g+2],y:i.allpts[g+3]}):(S={x:i.allpts[_-2-g],y:i.allpts[_-1-g]},D={x:i.allpts[_-4-g],y:i.allpts[_-3-g]}),T=r.dist(S,D),C=k,!((k+=T)>=c));g+=2);var M=c-C,P=M/T;P=r.bound(0,P,1),t=r.lineAt(S,D,P),a=d(S,D)}l("labelX",n,t.x),l("labelY",n,t.y),l("labelAutoAngle",n,a)}};c("source"),c("target"),this.applyLabelDimensions(e)}},o.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},o.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r);a.setPrefixedProperty(n.rstyle,"labelWidth",t,i.width),a.setPrefixedProperty(n.rscratch,"labelWidth",t,i.width),a.setPrefixedProperty(n.rstyle,"labelHeight",t,i.height),a.setPrefixedProperty(n.rscratch,"labelHeight",t,i.height)},o.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,s=function(e,r){return r?(a.setPrefixedProperty(n.rscratch,e,t,r),r):a.getPrefixedProperty(n.rscratch,e,t)};"none"==o||("uppercase"==o?i=i.toUpperCase():"lowercase"==o&&(i=i.toLowerCase()));var l=e.pstyle("text-wrap").value;if("wrap"===l){var u=s("labelKey");if(u&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h=[],p=0;pd){for(var v=f.split(/\s+/),g="",m=0;md)break;x+=i[E],E===i.length-1&&(w=!0)}return w||(x+="…"),x}return i},o.calculateLabelDimensions=function(e,t,n){var r=this,i=e._private.labelStyleKey+"$@$"+t;n&&(i+="$@$"+n);var a=r.labelDimCache||(r.labelDimCache={});if(a[i])return a[i];var o=e.pstyle("font-style").strValue,s=1*e.pstyle("font-size").pfValue+"px",l=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,c=this.labelCalcDiv;c||(c=this.labelCalcDiv=document.createElement("div"),document.body.appendChild(c));var d=c.style;return d.fontFamily=l,d.fontStyle=o,d.fontSize=s,d.fontWeight=u,d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none",d.padding="0",d.lineHeight="1","wrap"===e.pstyle("text-wrap").value?d.whiteSpace="pre":d.whiteSpace="normal",c.textContent=t,a[i]={width:Math.ceil(c.clientWidth/1),height:Math.ceil(c.clientHeight/1)},a[i]},o.calculateLabelAngles=function(e){var t=e._private,n=t.rscratch,r=e.isEdge(),i=e.pstyle("text-rotation"),a=i.strValue;"none"===a?n.labelAngle=n.sourceLabelAngle=n.targetLabelAngle=0:r&&"autorotate"===a?(n.labelAngle=Math.atan(n.midDispY/n.midDispX),n.sourceLabelAngle=n.sourceLabelAutoAngle,n.targetLabelAngle=n.targetLabelAutoAngle):n.labelAngle=n.sourceLabelAngle=n.targetLabelAngle="autorotate"===a?0:i.pfValue},e.exports=o},function(e,t,n){"use strict";var r={};r.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(e.isParent())return"rectangle"===n||"roundrectangle"===n||"cutrectangle"===n||"barrel"===n?n:"rectangle";if("polygon"===n){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n},e.exports=r},function(e,t,n){"use strict";var r={};r.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e,n,r){if(t.merge(e),!0===r||void 0===r)for(var i=0;i=e.desktopTapThreshold2}var _=n(i);m&&(e.hoverData.tapholdCancelled=!0),s=!0,t(v,["mousemove","vmousemove","tapdrag"],i,{position:{x:d[0],y:d[1]}});var M=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||l.emit("boxstart"),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(m){var I={originalEvent:i,type:"cxtdrag",position:{x:d[0],y:d[1]}};x?x.emit(I):l.emit(I),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:i,type:"cxtdragout",position:{x:d[0],y:d[1]}}),e.hoverData.cxtOver=v,v&&v.emit({originalEvent:i,type:"cxtdragover",position:{x:d[0],y:d[1]}}))}}else if(e.hoverData.dragging){if(s=!0,l.panningEnabled()&&l.userPanningEnabled()){var N;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;N={x:(d[0]-B[0])*u,y:(d[1]-B[1])*u},e.hoverData.justStartedPan=!1}else N={x:w[0]*u,y:w[1]*u};l.panBy(N),e.hoverData.dragged=!0}d=e.projectIntoViewport(i.clientX,i.clientY)}else if(1!=f[4]||null!=x&&!x.isEdge()){if(x&&x.isEdge()&&x.active()&&x.unactivate(),x&&x.grabbed()||v==b||(b&&t(b,["mouseout","tapdragout"],i,{position:{x:d[0],y:d[1]}}),v&&t(v,["mouseover","tapdragover"],i,{position:{x:d[0],y:d[1]}}),e.hoverData.last=v),x)if(m){if(l.boxSelectionEnabled()&&_)x&&x.grabbed()&&(y(E),x.emit("free")),M();else if(x&&x.grabbed()&&e.nodeIsDraggable(x)){var z=!e.dragData.didDrag;z&&e.redrawHint("eles",!0),e.dragData.didDrag=!0;var L=[];e.hoverData.draggingEles||g(l.collection(E),{inDragLayer:!0});for(var A=0;A0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=l=[]),t(s,["mouseup","tapend","vmouseup"],r,{position:{x:a[0],y:a[1]}}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||t(u,["click","tap","vclick"],r,{position:{x:a[0],y:a[1]}}),s!=u||e.dragData.didDrag||e.hoverData.selecting||null!=s&&s._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||c?s.selected()?s.unselect():s.select():c||(i.$(":selected").unmerge(s).unselect(),s.select())),e.redrawHint("eles",!0)),e.hoverData.selecting){var p=i.collection(e.getAllInBox(o[0],o[1],o[2],o[3]));e.redrawHint("select",!0),p.length>0&&e.redrawHint("eles",!0),i.emit("boxend");var f=function(e){return e.selectable()&&!e.selected()};"additive"===i.selectionType()?p.emit("box").stdFilter(f).select().emit("boxselect"):(c||i.$(":selected").unmerge(p).unselect(),p.emit("box").stdFilter(f).select().emit("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!o[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var v=u&&u.grabbed();y(l),v&&u.emit("free")}}o[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}},!1);var C=function(t){if(!e.scrollingPage){var n=e.cy,r=e.projectIntoViewport(t.clientX,t.clientY),i=[r[0]*n.zoom()+n.pan().x,r[1]*n.zoom()+n.pan().y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||P())return void t.preventDefault();if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){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);var a;a=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,a*=e.wheelSensitivity;1===t.deltaMode&&(a*=33),n.zoom({level:n.zoom()*Math.pow(10,a),renderedPosition:{x:i[0],y:i[1]}})}}};e.registerBinding(e.container,"wheel",C,!0),e.registerBinding(window,"scroll",function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!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 S,D,k,_,M,I,N,B,z,L,A,O,R,V,q=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},F=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};e.registerBinding(e.container,"touchstart",V=function(n){if(T(n)){e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(n.touches[0]){var o=e.projectIntoViewport(n.touches[0].clientX,n.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(n.touches[1]){var o=e.projectIntoViewport(n.touches[1].clientX,n.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(n.touches[2]){var o=e.projectIntoViewport(n.touches[2].clientX,n.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(n.touches[1]){y(e.dragData.touchDragEles);var s=e.findContainerClientCoords();z=s[0],L=s[1],A=s[2],O=s[3],S=n.touches[0].clientX-z,D=n.touches[0].clientY-L,k=n.touches[1].clientX-z,_=n.touches[1].clientY-L,R=0<=S&&S<=A&&0<=k&&k<=A&&0<=D&&D<=O&&0<=_&&_<=O;var l=r.pan(),u=r.zoom();M=q(S,D,k,_),I=F(S,D,k,_),N=[(S+k)/2,(D+_)/2],B=[(N[0]-l.x)/u,(N[1]-l.y)/u];if(I<4e4&&!n.touches[2]){var c=e.findNearestElement(i[0],i[1],!0,!0),d=e.findNearestElement(i[2],i[3],!0,!0);return c&&c.isNode()?(c.activate().emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=c):d&&d.isNode()?(d.activate().emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=d):r.emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[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(n.touches[2]);else if(n.touches[1]);else if(n.touches[0]){var p=e.findNearestElements(i[0],i[1],!0,!0),f=p[0];if(null!=f&&(f.activate(),e.touchData.start=f,e.touchData.starts=p,e.nodeIsGrabbable(f))){var v=e.dragData.touchDragEles=[],b=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),f.selected()?(b=r.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),g(b,{addToList:v})):m(f,{addToList:v}),h(f);var x=function(e){return{originalEvent:n,type:e,position:{x:i[0],y:i[1]}}};f.emit(x("grabon")),b?b.forEach(function(e){e.emit(x("grab"))}):f.emit(x("grab"))}t(f,["touchstart","tapstart","vmousedown"],n,{position:{x:i[0],y:i[1]}}),null==f&&(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||(t(e.touchData.start,["taphold"],n,{position:{x:i[0],y:i[1]}}),e.touchData.start||r.$(":selected").unselect())},e.tapholdDuration)}if(n.touches.length>=1){for(var w=e.touchData.startPosition=[],E=0;E=e.touchTapThreshold2}if(i&&e.touchData.cxt){n.preventDefault();var E=n.touches[0].clientX-z,P=n.touches[0].clientY-L,C=n.touches[1].clientX-z,N=n.touches[1].clientY-L,A=F(E,P,C,N),O=A/I;if(O>=2.25||A>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var V={originalEvent:n,type:"cxttapend",position:{x:u[0],y:u[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(V),e.touchData.start=null):l.emit(V)}}if(i&&e.touchData.cxt){var V={originalEvent:n,type:"cxtdrag",position:{x:u[0],y:u[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(V):l.emit(V),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var j=e.findNearestElement(u[0],u[1],!0,!0);e.touchData.cxtOver&&j===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:n,type:"cxtdragout",position:{x:u[0],y:u[1]}}),e.touchData.cxtOver=j,j&&j.emit({originalEvent:n,type:"cxtdragover",position:{x:u[0],y:u[1]}}))}else if(i&&n.touches[2]&&l.boxSelectionEnabled())n.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||l.emit("boxstart"),e.touchData.selecting=!0,e.redrawHint("select",!0),s&&0!==s.length&&void 0!==s[0]?(s[2]=(u[0]+u[2]+u[4])/3,s[3]=(u[1]+u[3]+u[5])/3):(s[0]=(u[0]+u[2]+u[4])/3,s[1]=(u[1]+u[3]+u[5])/3,s[2]=(u[0]+u[2]+u[4])/3+1,s[3]=(u[1]+u[3]+u[5])/3+1),s[4]=1,e.touchData.selecting=!0,e.redraw();else if(i&&n.touches[1]&&l.zoomingEnabled()&&l.panningEnabled()&&l.userZoomingEnabled()&&l.userPanningEnabled()){n.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var X=e.dragData.touchDragEles;if(X){e.redrawHint("drag",!0);for(var Y=0;Y0)return v[0]}return null}(e,t,v);if(null!=g){var m=v[5],y=v[3],b=v[1],x=r.qbezierAt(m,y,b,g);if(v.isTop&&x<=t)return!0;if(v.isBottom&&t<=x)return!0}}return!1}}},i.generateBottomRoundrectangle=function(){return this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottomroundrectangle",points:r.generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,i,a,o,s){var l=e-(n/2+s),u=t-(i/2+s),c=u,d=e+(n/2+s),h=r.finiteLinesIntersect(a,o,e,t,l,u,d,c,!1);return h.length>0?h:r.roundRectangleIntersectLine(a,o,e,t,n,i,s)},checkPoint:function(e,t,n,i,a,o,s){var l=r.getRoundRectangleRadius(i,a),u=2*l;if(r.pointInsidePolygon(e,t,this.points,o,s,i,a-u,[0,-1],n))return!0;if(r.pointInsidePolygon(e,t,this.points,o,s,i-u,a,[0,-1],n))return!0;var c=i/2+2*n,d=a/2+2*n,h=[o-c,s-d,o-c,s,o+c,s,o+c,s-d];return!!r.pointInsidePolygonPoints(e,t,h)||(!!r.checkInEllipse(e,t,u,u,o+i/2-l,s+a/2-l,n)||!!r.checkInEllipse(e,t,u,u,o-i/2+l,s+a/2-l,n))}}},i.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",r.generateUnitNgonPointsFitToSquare(3,0)),this.generatePolygon("rectangle",r.generateUnitNgonPointsFitToSquare(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle(),this.generatePolygon("diamond",[0,1,1,0,0,-1,-1,0]),this.generatePolygon("pentagon",r.generateUnitNgonPointsFitToSquare(5,0)),this.generatePolygon("hexagon",r.generateUnitNgonPointsFitToSquare(6,0)),this.generatePolygon("heptagon",r.generateUnitNgonPointsFitToSquare(7,0)),this.generatePolygon("octagon",r.generateUnitNgonPointsFitToSquare(8,0));var n=new Array(20),i=r.generateUnitNgonPoints(5,0),a=r.generateUnitNgonPoints(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:p;e.lineWidth=v,e.lineCap="butt",i.strokeStyle(e,h[0],h[1],h[2],n),i.drawEdgePath(t,e,a.allpts,f)},m=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;i.drawArrowheads(e,t,n)};e.lineJoin="round";if("yes"===t.pstyle("ghost").value){var y=t.pstyle("ghost-offset-x").pfValue,b=t.pstyle("ghost-offset-y").pfValue,x=t.pstyle("ghost-opacity").value,w=p*x;e.translate(y,b),g(w),m(w),e.translate(-y,-b)}g(),m(),function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c;e.lineWidth=u,"self"!==a.edgeType||o?e.lineCap="round":e.lineCap="butt",i.strokeStyle(e,d[0],d[1],d[2],n),i.drawEdgePath(t,e,a.allpts,"solid")}(),function(){i.drawElementText(e,t,r)}(),n&&e.translate(s.x1,s.y1)}},r.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o=void 0,s=!1,l=this.usePaths();if(l){var u=n.join("$");i.pathCacheKey&&i.pathCacheKey===u?(o=t=i.pathCache,s=!0):(o=t=new Path2D,i.pathCacheKey=u,i.pathCache=o)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash([6,3]);break;case"solid":a.setLineDash([])}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var c=2;c+30||S>0&&C>0){var k=l-D;switch(y){case"left":k-=h;break;case"center":k-=h/2}var _=u-p-D,M=h+2*D,I=p+2*D;if(T>0){var N=e.fillStyle,B=t.pstyle("text-background-color").value;e.fillStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+T*s+")";"roundrectangle"==t.pstyle("text-background-shape").strValue?r(e,k,_,M,I,2):e.fillRect(k,_,M,I),e.fillStyle=N}if(S>0&&C>0){var z=e.strokeStyle,L=e.lineWidth,A=t.pstyle("text-border-color").value,O=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+C*s+")",e.lineWidth=S,e.setLineDash)switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=S/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(k,_,M,I),"double"===O){var R=S/2;e.strokeRect(k+R,_+R,M-2*R,I-2*R)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=z}}var V=2*t.pstyle("text-outline-width").pfValue;if(V>0&&(e.lineWidth=V),"wrap"===t.pstyle("text-wrap").value){var q=i.getPrefixedProperty(o,"labelWrapCachedLines",n),F=p/q.length;switch(b){case"top":u-=(q.length-1)*F;break;case"center":case"bottom":u-=(q.length-1)*F}for(var j=0;j0&&e.strokeText(q[j],l,u),e.fillText(q[j],l,u),u+=F}else V>0&&e.strokeText(c,l,u),e.fillText(c,l,u);0!==x&&(e.rotate(-x),e.translate(-E,-P))}}},e.exports=o},function(e,t,n){"use strict";var r=n(0),i={};i.drawNode=function(e,t,n,i){var a=this,o=void 0,s=void 0,l=t._private,u=l.rscratch,c=t.position();if(r.number(c.x)&&r.number(c.y)&&t.visible()){var d=t.effectiveOpacity(),h=a.usePaths(),p=void 0,f=!1,v=t.padding();o=t.width()+2*v,s=t.height()+2*v;var g=void 0;n&&(g=n,e.translate(-g.x1,-g.y1));for(var m=t.pstyle("background-image"),y=m.value,b=new Array(y.length),x=new Array(y.length),w=0,E=0;E0&&void 0!==arguments[0]?arguments[0]:k;a.fillStyle(e,D[0],D[1],D[2],t)},B=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;a.strokeStyle(e,_[0],_[1],_[2],t)},z=t.pstyle("shape").strValue,L=t.pstyle("shape-polygon-points").pfValue;if(h){var A=z+"$"+o+"$"+s+("polygon"===z?"$"+L.join("$"):"");e.translate(c.x,c.y),u.pathCacheKey===A?(p=u.pathCache,f=!0):(p=new Path2D,u.pathCacheKey=A,u.pathCache=p)}var O=function(){if(!f){var n=c;h&&(n={x:0,y:0}),a.nodeShapes[a.getNodeShape(t)].draw(p||e,n.x,n.y,o,s)}h?e.fill(p):e.fill()},R=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,r=l.backgrounding,i=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;a.hasPie(t)&&(a.drawPie(e,t,r),n&&(h||a.nodeShapes[a.getNodeShape(t)].draw(e,c.x,c.y,o,s)))},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,n=(C>0?C:-C)*t,r=C>0?0:255;0!==C&&(a.fillStyle(e,r,r,r,n),h?e.fill(p):e.fill())},F=function(){if(S>0){if(e.lineWidth=S,e.lineCap="butt",e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(h?e.stroke(p):e.stroke(),"double"===M){e.lineWidth=S/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",h?e.stroke(p):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var j=t.pstyle("ghost-offset-x").pfValue,X=t.pstyle("ghost-offset-y").pfValue,Y=t.pstyle("ghost-opacity").value,W=Y*d;e.translate(j,X),N(Y*k),O(),R(W),V(0!==C||0!==S),q(W),B(Y*I),F(),e.translate(-j,-X)}N(),O(),R(),V(0!==C||0!==S),q(),B(),F(),h&&e.translate(-c.x,-c.y),function(){a.drawElementText(e,t,i)}(),function(){var n=t.pstyle("overlay-padding").pfValue,r=t.pstyle("overlay-opacity").value,i=t.pstyle("overlay-color").value;r>0&&(a.fillStyle(e,i[0],i[1],i[2],r),a.nodeShapes.roundrectangle.draw(e,c.x,c.y,o+2*n,s+2*n),e.fill())}(),n&&e.translate(g.x1,g.y1)}},i.hasPie=function(e){return e=e[0],e._private.hasPie},i.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,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,v=t.pstyle("pie-"+h+"-background-opacity").value*n,g=p/100;g+d>1&&(g=1-d);var m=1.5*Math.PI+2*Math.PI*d,y=2*Math.PI*g,b=m+y;0===p||d>=1||d+g>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,m,b),e.closePath(),this.fillStyle(e,f[0],f[1],f[2],v),e.fill(),d+=g)}},e.exports=i},function(e,t,n){"use strict";var r={},i=n(1);r.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},r.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;iu.minMbLowQualFrames&&(u.motionBlurPxRatio=u.mbPxRBlurry)),u.clearingMotionBlur&&(u.motionBlurPxRatio=1),u.textureDrawLastFrame&&!f&&(p[u.NODE]=!0,p[u.SELECT_BOX]=!0);var w=d.style()._private.coreStyle,E=d.zoom(),P=void 0!==s?s:E,T=d.pan(),C={x:T.x,y:T.y},S={zoom:E,pan:{x:T.x,y:T.y}},D=u.prevViewport;void 0===D||S.zoom!==D.zoom||S.pan.x!==D.pan.x||S.pan.y!==D.pan.y||y&&!m||(u.motionBlurPxRatio=1),l&&(C=l),P*=c,C.x*=c,C.y*=c;var k=u.getCachedZSortedEles();if(f||(u.textureDrawLastFrame=!1),f){u.textureDrawLastFrame=!0;if(!u.textureCache){u.textureCache={},u.textureCache.bb=d.mutableElements().boundingBox(),u.textureCache.texture=u.data.bufferCanvases[u.TEXTURE_BUFFER];var _=u.data.bufferContexts[u.TEXTURE_BUFFER];_.setTransform(1,0,0,1,0,0),_.clearRect(0,0,u.canvasWidth*u.textureMult,u.canvasHeight*u.textureMult),u.render({forcedContext:_,drawOnlyNodeLayer:!0,forcedPxRatio:c*u.textureMult});var S=u.textureCache.viewport={zoom:d.zoom(),pan:d.pan(),width:u.canvasWidth,height:u.canvasHeight};S.mpan={x:(0-S.pan.x)/S.zoom,y:(0-S.pan.y)/S.zoom}}p[u.DRAG]=!1,p[u.NODE]=!1;var M=h.contexts[u.NODE],I=u.textureCache.texture,S=u.textureCache.viewport;u.textureCache.bb,M.setTransform(1,0,0,1,0,0),v?t(M,0,0,S.width,S.height):M.clearRect(0,0,S.width,S.height);var N=w["outside-texture-bg-color"].value,B=w["outside-texture-bg-opacity"].value;u.fillStyle(M,N[0],N[1],N[2],B),M.fillRect(0,0,S.width,S.height);var E=d.zoom();n(M,!1),M.clearRect(S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c),M.drawImage(I,S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c)}else u.textureOnViewport&&!r&&(u.textureCache=null);var z=d.extent(),L=u.pinching||u.hoverData.dragging||u.swipePanning||u.data.wheelZooming||u.hoverData.draggingEles,A=u.hideEdgesOnViewport&&L,O=[];if(O[u.NODE]=!p[u.NODE]&&v&&!u.clearedForMotionBlur[u.NODE]||u.clearingMotionBlur,O[u.NODE]&&(u.clearedForMotionBlur[u.NODE]=!0),O[u.DRAG]=!p[u.DRAG]&&v&&!u.clearedForMotionBlur[u.DRAG]||u.clearingMotionBlur,O[u.DRAG]&&(u.clearedForMotionBlur[u.DRAG]=!0),p[u.NODE]||a||o||O[u.NODE]){var R=v&&!O[u.NODE]&&1!==g,M=r||(R?u.data.bufferContexts[u.MOTIONBLUR_BUFFER_NODE]:h.contexts[u.NODE]);n(M,v&&!R?"motionBlur":void 0),A?u.drawCachedNodes(M,k.nondrag,c,z):u.drawLayeredElements(M,k.nondrag,c,z),u.debug&&u.drawDebugPoints(M,k.nondrag),a||v||(p[u.NODE]=!1)}if(!o&&(p[u.DRAG]||a||O[u.DRAG])){var R=v&&!O[u.DRAG]&&1!==g,M=r||(R?u.data.bufferContexts[u.MOTIONBLUR_BUFFER_DRAG]:h.contexts[u.DRAG]);n(M,v&&!R?"motionBlur":void 0),A?u.drawCachedNodes(M,k.drag,c,z):u.drawCachedElements(M,k.drag,c,z),u.debug&&u.drawDebugPoints(M,k.drag),a||v||(p[u.DRAG]=!1)}if(u.showFps||!o&&p[u.SELECT_BOX]&&!a){var M=r||h.contexts[u.SELECT_BOX];if(n(M),1==u.selection[4]&&(u.hoverData.selecting||u.touchData.selecting)){var E=u.cy.zoom(),V=w["selection-box-border-width"].value/E;M.lineWidth=V,M.fillStyle="rgba("+w["selection-box-color"].value[0]+","+w["selection-box-color"].value[1]+","+w["selection-box-color"].value[2]+","+w["selection-box-opacity"].value+")",M.fillRect(u.selection[0],u.selection[1],u.selection[2]-u.selection[0],u.selection[3]-u.selection[1]),V>0&&(M.strokeStyle="rgba("+w["selection-box-border-color"].value[0]+","+w["selection-box-border-color"].value[1]+","+w["selection-box-border-color"].value[2]+","+w["selection-box-opacity"].value+")",M.strokeRect(u.selection[0],u.selection[1],u.selection[2]-u.selection[0],u.selection[3]-u.selection[1]))}if(h.bgActivePosistion&&!u.hoverData.selecting){var E=u.cy.zoom(),q=h.bgActivePosistion;M.fillStyle="rgba("+w["active-bg-color"].value[0]+","+w["active-bg-color"].value[1]+","+w["active-bg-color"].value[2]+","+w["active-bg-opacity"].value+")",M.beginPath(),M.arc(q.x,q.y,w["active-bg-size"].pfValue/E,0,2*Math.PI),M.fill()}var F=u.lastRedrawTime;if(u.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);M.setTransform(1,0,0,1,0,0),M.fillStyle="rgba(255, 0, 0, 0.75)",M.strokeStyle="rgba(255, 0, 0, 0.75)",M.lineWidth=1,M.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);M.strokeRect(0,30,250,20),M.fillRect(0,30,250*Math.min(j/60,1),20)}a||(p[u.SELECT_BOX]=!1)}if(v&&1!==g){var X=h.contexts[u.NODE],Y=u.data.bufferCanvases[u.MOTIONBLUR_BUFFER_NODE],W=h.contexts[u.DRAG],H=u.data.bufferCanvases[u.MOTIONBLUR_BUFFER_DRAG],Z=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!x?e.clearRect(0,0,u.canvasWidth,u.canvasHeight):t(e,0,0,u.canvasWidth,u.canvasHeight);var i=g;e.drawImage(n,0,0,u.canvasWidth*i,u.canvasHeight*i,0,0,u.canvasWidth,u.canvasHeight)};(p[u.NODE]||O[u.NODE])&&(Z(X,Y,O[u.NODE]),p[u.NODE]=!1),(p[u.DRAG]||O[u.DRAG])&&(Z(W,H,O[u.DRAG]),p[u.DRAG]=!1)}u.prevViewport=S,u.clearingMotionBlur&&(u.clearingMotionBlur=!1,u.motionBlurCleared=!0,u.motionBlur=!0),v&&(u.motionBlurTimeout=setTimeout(function(){u.motionBlurTimeout=null,u.clearedForMotionBlur[u.NODE]=!1,u.clearedForMotionBlur[u.DRAG]=!1,u.motionBlur=!1,u.clearingMotionBlur=!f,u.mbFrames=0,p[u.NODE]=!0,p[u.DRAG]=!0,u.redraw()},100)),r||d.emit("render")},e.exports=r},function(e,t,n){"use strict";var r=n(2),i={};i.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=3.99||i>2)return null;var d=Math.pow(2,i),h=t.h*d,p=t.w*d,f=u.imgCaches=u.imgCaches||{},v=f[i];if(v)return v;var g;if(g=h<=25?25:h<=50?50:50*Math.ceil(h/50),h>1024||p>1024||e.isEdge()||e.isParent())return null;var m=o.getTextureQueue(g),y=m[m.length-2],b=function(){return o.recycleTexture(g,p)||o.addTexture(g,p)};y||(y=m[m.length-1]),y||(y=b()),y.width-y.usedWidthi;S--)k=o.getElement(e,t,n,S,s.downscale);_()}else{var M;if(!P&&!T&&!C)for(var S=i-1;S>=-4;S--){var D=f[S];if(D){M=D;break}}if(E(M))return o.queueElement(e,t,i),M;y.context.translate(y.usedWidth,0),y.context.scale(d,d),l.drawElement(y.context,e,t,w),y.context.scale(1/d,1/d),y.context.translate(-y.usedWidth,0)}return v=f[i]={ele:e,x:y.usedWidth,texture:y,level:i,scale:d,width:p,height:h,scaledLabelShown:w},y.usedWidth+=Math.ceil(p+8),y.eleCaches.push(v),o.checkTextureFullness(y),v},u.invalidateElement=function(e){var t=this,n=e._private.rscratch.imgCaches;if(n)for(var r=-4;r<=2;r++){var a=n[r];if(a){var o=a.texture;o.invalidatedWidth+=a.width,n[r]=null,i.removeFromArray(o.eleCaches,a),t.checkTextureUtility(o)}}},u.checkTextureUtility=function(e){e.invalidatedWidth>=.5*e.width&&this.retireTexture(e)},u.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?i.removeFromArray(n,e):e.fullnessChecks++},u.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n);i.removeFromArray(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,i.clearArray(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),i.removeFromArray(a,s),r.push(s),s}},u.queueElement=function(e,t,n){var i=this,a=i.getElementQueue(),o=i.getElementIdToQueue(),s=e.id(),l=o[s];if(l)l.level=Math.max(l.level,n),l.reqs++,a.updateItem(l);else{var u={ele:e,bb:t,position:r.copyPosition(e.position()),level:n,reqs:1};e.isEdge()&&(u.positions={source:r.copyPosition(e.source().position()),target:r.copyPosition(e.target().position())}),a.push(u),o[s]=u}},u.dequeue=function(e){for(var t=this,n=t.getElementQueue(),i=t.getElementIdToQueue(),a=[],o=0;o<1&&n.size()>0;o++){var l=n.pop();i[l.ele.id()]=null,a.push(l);var u,c=l.ele;u=(!c.isEdge()||r.arePositionsSame(c.source().position(),l.positions.source)&&r.arePositionsSame(c.target().position(),l.positions.target))&&r.arePositionsSame(c.position(),l.position)?l.bb:c.boundingBox(),t.getElement(l.ele,u,e,l.level,s.dequeue)}return a},u.onDequeue=function(e){this.onDequeues.push(e)},u.offDequeue=function(e){i.removeFromArray(this.onDequeues,e)},u.setupDequeueing=o.setupDequeueing({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n0&&s>0){f.clearRect(0,0,a,s),f.globalCompositeOperation="source-over";var v=this.getCachedZSortedEles();if(e.full)f.translate(-r.x1*c,-r.y1*c),f.scale(c,c),this.drawElements(f,v),f.scale(1/c,1/c),f.translate(r.x1*c,r.y1*c);else{var g=t.pan(),m={x:g.x*c,y:g.y*c};c*=t.zoom(),f.translate(m.x,m.y),f.scale(c,c),this.drawElements(f,v),f.scale(1/c,1/c),f.translate(-m.x,-m.y)}e.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=e.bg,f.rect(0,0,a,s),f.fill())}return p},s.png=function(e){return a(e,this.bufferCanvasImage(e),"image/png")},s.jpg=function(e){return a(e,this.bufferCanvasImage(e),"image/jpeg")},e.exports=s},function(e,t,n){"use strict";function r(e){var t=this;t.data={canvases:new Array(u.CANVAS_LAYERS),contexts:new Array(u.CANVAS_LAYERS),canvasNeedsRedraw:new Array(u.CANVAS_LAYERS),bufferCanvases:new Array(u.BUFFER_COUNT),bufferContexts:new Array(u.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color: rgba(0,0,0,0);";t.data.canvasContainer=document.createElement("div");var r=t.data.canvasContainer.style;t.data.canvasContainer.setAttribute("style",n),r.position="relative",r.zIndex="0",r.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),(i.getAttribute("style")||"").indexOf(n)<0&&i.setAttribute("style",(i.getAttribute("style")||"")+n);for(var l=0;l0&&t.data.lyrTxrCache.invalidateElements(n)})}var i=n(1),a=n(0),o=n(110),s=n(113),l=r,u=r.prototype;u.CANVAS_LAYERS=3,u.SELECT_BOX=0,u.DRAG=1,u.NODE=2,u.BUFFER_COUNT=3,u.TEXTURE_BUFFER=0,u.MOTIONBLUR_BUFFER_NODE=1,u.MOTIONBLUR_BUFFER_DRAG=2,u.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[u.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[u.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[u.SELECT_BOX]=t}};var c="undefined"!=typeof Path2D;u.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},u.usePaths=function(){return c&&this.pathsEnabled},[n(102),n(104),n(103),n(105),n(106),n(107),n(108),n(109),n(111),n(114)].forEach(function(e){i.extend(u,e)}),e.exports=l},function(e,t,n){"use strict";function r(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)}var i=n(1),a=n(2),o=n(8),s=n(0),l=n(16),u=function(e,t){var n=this,r=n.renderer=e;n.layersByLevel={},n.firstGet=!0,n.lastInvalidationTime=i.performanceNow()-500,n.skipping=!1,r.beforeRender(function(e,t){t-n.lastInvalidationTime<=250?n.skipping=!0:n.skipping=!1});var a=function(e,t){return t.reqs-e.reqs};n.layersQueue=new o(a),n.eleTxrCache=t,n.setupEleCacheInvalidation(),n.setupDequeueing()},c=u.prototype,d=0,h=Math.pow(2,53)-1;c.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=document.createElement("canvas");a.width=r,a.height=i;var o={id:d=++d%h,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},c.getLayers=function(e,t,n){var r=this,o=r.renderer,s=o.cy,l=s.zoom(),u=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(a.log2(l*t)))<-4)n=-4;else if(l>=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var c,d,h=r.layersByLevel,p=Math.pow(2,n),f=h[n]=h[n]||[],v=r.levelIsComplete(n,e);if(v)return f;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return d=h[t],!0},a=function(e){if(!d)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};a(1),a(-1);for(var o=f.length-1;o>=0;o--){var s=f[o];s.invalid&&i.removeFromArray(f,s)}}();var g=function(){if(!c){c=a.makeBoundingBox();for(var t=0;t=y||!a.boundingBoxInBoundingBox(m.bb,w.boundingBox()))&&!(m=function(e){e=e||{};var t=e.after;if(g(),c.w*p*(c.h*p)>16e6)return null;var i=r.makeLayer(c,n);if(null!=t){var a=f.indexOf(t)+1;f.splice(a,0,i)}else(void 0===e.insert||e.insert)&&f.unshift(i);return i}({insert:!0,after:m})))return null;d||b?r.queueLayer(m,w):r.drawEleInLayer(m,w,n,t),m.eles.push(w),P[n]=m}}return d||(b?null:f)},c.getEleLevelForLayerLevel=function(e,t){return e},c.drawEleInLayer=function(e,t,n,i){var a=this,o=this.renderer,s=e.context,l=t.boundingBox();if(0!==l.w&&0!==l.h&&t.visible()){var u=a.eleTxrCache,c=u.reasons.highQuality;n=a.getEleLevelForLayerLevel(n,i);var d=u.getElement(t,l,null,n,c);d?(r(s,!1),s.drawImage(d.texture.canvas,d.x,0,d.width,d.height,l.x1,l.y1,l.w,l.h),r(s,!0)):o.drawElement(s,t)}},c.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||0===r.length)return!1;for(var i=0,a=0;a0)return!1;if(o.invalid)return!1;i+=o.eles.length}return i===t.length},c.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){t=!0;break}}return t},c.invalidateElements=function(e){var t=this;t.lastInvalidationTime=i.performanceNow(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)})},c.invalidateLayer=function(e){if(this.lastInvalidationTime=i.performanceNow(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];i.removeFromArray(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a=0&&(d=d.toLowerCase(),h=h.toLowerCase(),o=o.replace("@",""),p=!0);var f=!1;o.indexOf("!")>=0&&(o=o.replace("!",""),f=!0),p&&(s=h.toLowerCase(),c=d.toLowerCase());var v=!1;switch(o){case"*=":u=d.indexOf(h)>=0;break;case"$=":u=d.indexOf(h,d.length-h.length)>=0;break;case"^=":u=0===d.indexOf(h);break;case"=":u=c===s;break;case">":v=!0,u=c>s;break;case">=":v=!0,u=c>=s;break;case"<":v=!0,u=c\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:'"(?:\\\\"|[^"])*"|'+"'(?:\\\\'|[^'])*'",number:r.regex.number,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};i.variable="(?:[\\w-]|(?:\\\\"+i.metaChar+"))+",i.value=i.string+"|"+i.number,i.className=i.variable,i.id=i.variable,function(){var e=void 0,t=void 0,n=void 0;for(e=i.comparatorOp.split("|"),n=0;n=0||"="!==t&&(i.comparatorOp+="|\\!"+t)}(),e.exports=i},function(e,t,n){"use strict";var r=n(1),i=n(0),a=n(5),o={};o.apply=function(e){var t=this,n=t._private,r=n.cy,i=r.collection();n.newStyle&&(n.contextStyles={},n.propDiffs={},t.cleanElements(e,!0));for(var a=0;a0;if(h||p){var f=void 0;h&&p?f=u.properties:h?f=u.properties:p&&(f=u.mappedProperties);for(var v=0;v0){r=!0;break}}t.hasPie=r;var o=e.pstyle("text-transform").strValue,s=e.pstyle("label").strValue,l=e.pstyle("source-label").strValue,u=e.pstyle("target-label").strValue,c=e.pstyle("font-style").strValue,d=e.pstyle("font-size").pfValue+"px",h=e.pstyle("font-family").strValue,p=e.pstyle("font-weight").strValue,f=e.pstyle("text-valign").strValue,v=e.pstyle("text-valign").strValue,g=e.pstyle("text-outline-width").pfValue,m=e.pstyle("text-wrap").strValue,y=e.pstyle("text-max-width").pfValue,b=c+"$"+d+"$"+h+"$"+p+"$"+o+"$"+f+"$"+v+"$"+g+"$"+m+"$"+y;t.labelStyleKey=b,t.sourceLabelKey=b+"$"+l,t.targetLabelKey=b+"$"+u,t.labelKey=b+"$"+s,t.fontKey=c+"$"+p+"$"+d+"$"+h,t.styleKey=Date.now()}},o.applyParsedProperty=function(e,t){var n=this,a=t,o=e._private.style,s=void 0,l=n.types,u=n.properties[a.name].type,c=a.bypass,d=o[a.name],h=d&&d.bypass,p=e._private,f=function(){n.checkZOrderTrigger(e,a.name,d?d.value:null,a.value)};if("curve-style"===t.name&&"haystack"===t.value&&e.isEdge()&&(e.isLoop()||e.source().isParent()||e.target().isParent())&&(a=t=this.parse(t.name,"bezier",c)),a.delete)return o[a.name]=void 0,f(),!0;if(a.deleteBypassed)return d?!!d.bypass&&(d.bypassed=void 0,f(),!0):(f(),!0);if(a.deleteBypass)return d?!!d.bypass&&(o[a.name]=d.bypassed,f(),!0):(f(),!0);var v=function(){r.error("Do not assign mappings to elements without corresponding data (e.g. ele `"+e.id()+"` for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case l.mapData:for(var g=a.field.split("."),m=p.data,y=0;y1&&(b=1),u.color){var x=a.valueMin[0],w=a.valueMax[0],E=a.valueMin[1],P=a.valueMax[1],T=a.valueMin[2],C=a.valueMax[2],S=null==a.valueMin[3]?1:a.valueMin[3],D=null==a.valueMax[3]?1:a.valueMax[3],k=[Math.round(x+(w-x)*b),Math.round(E+(P-E)*b),Math.round(T+(C-T)*b),Math.round(S+(D-S)*b)];s={bypass:a.bypass,name:a.name,value:k,strValue:"rgb("+k[0]+", "+k[1]+", "+k[2]+")"}}else{if(!u.number)return!1;var _=a.valueMin+(a.valueMax-a.valueMin)*b;s=this.parse(a.name,_,a.bypass,"mapping")}s||(s=this.parse(a.name,d.strValue,a.bypass,"mapping")),s||v(),s.mapping=a,a=s;break;case l.data:var M=a.field.split("."),I=p.data;if(I)for(var N=0;N0&&l>0){for(var c={},d=!1,h=0;h0?e.delayAnimation(u).play().promise().then(t):t()}).then(function(){return e.animation({style:c,duration:l,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,s),e.emitAndNotify("style"),o.transitioning=!1})}else o.transitioning&&(this.removeBypasses(e,s),e.emitAndNotify("style"),o.transitioning=!1)},o.checkZOrderTrigger=function(e,t,n,r){var i=this.properties[t];null==i.triggersZOrder||null!=n&&!i.triggersZOrder(n,r)||this._private.cy.notify({type:"zorder",eles:e})},e.exports=o},function(e,t,n){"use strict";var r=n(0),i=n(1),a={};a.applyBypass=function(e,t,n,a){var o=this,s=[];if("*"===t||"**"===t){if(void 0!==n)for(var l=0;lh.max||h.strictMax&&t===h.max))return null;var B={name:e,value:t,strValue:""+t+(_||""),units:_,bypass:n};return h.unitless||"px"!==_&&"em"!==_?B.pfValue=t:B.pfValue="px"!==_&&_?this.getEmSizeInPixels()*t:t,"ms"!==_&&"s"!==_||(B.pfValue="ms"===_?t:1e3*t),"deg"!==_&&"rad"!==_||(B.pfValue="rad"===_?t:a.deg2rad(t)),"%"===_&&(B.pfValue=t/100),B}if(h.propList){var z=[],L=""+t;if("none"===L);else{for(var A=L.split(","),O=0;O node").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3,"curve-style":"haystack"}).selector(":parent <-> node").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("node:parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}).selector("core").css({"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}),this.defaultLength=this.length},e.exports=a},function(e,t,n){"use strict";var r=n(1),i=n(6),a={};a.appendFromString=function(e){function t(){s=s.length>l.length?s.substr(l.length):""}function n(){u=u.length>c.length?u.substr(c.length):""}var a=this,o=this,s=""+e,l=void 0,u=void 0,c=void 0;for(s=s.replace(/[\/][*](\s|.)+?[*][\/]/g,"");;){if(s.match(/^\s*$/))break;var d=s.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){r.error("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+s);break}l=d[0];var h=d[1];if("core"!==h){if(new i(h)._private.invalid){r.error("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),t();continue}}var p=d[2],f=!1;u=p;for(var v=[];;){if(u.match(/^\s*$/))break;var g=u.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!g){r.error("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),f=!0;break}c=g[0];var m=g[1],y=g[2];if(a.properties[m]){o.parse(m,y)?(v.push({name:m,val:y}),n()):(r.error("Skipping property: Invalid property definition in: "+c),n())}else r.error("Skipping property: Invalid property name in: "+c),n()}if(f){t();break}o.selector(h);for(var b=0;b1&&(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 n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=new RegExp("^"+this.regex.hsla+"$").exec(e);if(c){if(r=parseInt(c[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(i=parseFloat(c[2]))<0||i>100)return;if(i/=100,(a=parseFloat(c[3]))<0||a>100)return;if(a/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1))return;if(0===i)s=l=u=Math.round(255*a);else{var d=a<.5?a*(1+i):a+i-a*i,h=2*a-d;s=Math.round(255*t(h,d,r+1/3)),l=Math.round(255*t(h,d,r)),u=Math.round(255*t(h,d,r-1/3))}n=[s,l,u,o]}return n},rgb2tuple:function(e){var t=void 0,n=new RegExp("^"+this.regex.rgba+"$").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))<0||l>1)return;t.push(l)}}return t},colorname2tuple:function(e){return this.colors[e.toLowerCase()]},color2tuple:function(e){return(r.array(e)?e:null)||this.colorname2tuple(e)||this.hex2tuple(e)||this.rgb2tuple(e)||this.hsl2tuple(e)},colors:{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]}}},function(e,t,n){"use strict";var r=n(0);e.exports={mapEmpty:function(e){return null==e||0===Object.keys(e).length},pushMap:function(e){var t=this.getMap(e);null==t?this.setMap(this.extend({},e,{value:[e.value]})):t.push(e.value)},setMap:function(e){for(var t=e.map,n=e.keys,i=n.length,a=0;at?1:0}function i(e,t){return-1*r(e,t)}e.exports={sort:{ascending:r,descending:i}}},function(e,t,n){"use strict";var r=n(19),i=n(0);e.exports={camel2dash:r(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),dash2camel:r(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),prependCamel:r(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),capitalize:function(e){return i.emptyString(e)?e:e.charAt(0).toUpperCase()+e.substring(1)}}},function(e,t,n){"use strict";var r=n(4),i=r?r.performance:null,a={},o=i&&i.now?function(){return i.now()}:function(){return Date.now()},s=function(){if(r){if(r.requestAnimationFrame)return function(e){r.requestAnimationFrame(e)};if(r.mozRequestAnimationFrame)return function(e){r.mozRequestAnimationFrame(e)};if(r.webkitRequestAnimationFrame)return function(e){r.webkitRequestAnimationFrame(e)};if(r.msRequestAnimationFrame)return function(e){r.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(o())},1e3/60)}}();a.requestAnimationFrame=function(e){s(e)},a.performanceNow=o,a.debounce=n(139),a.now=function(){return Date.now()},e.exports=a},function(e,t,n){e.exports=n(138)},function(e,t,n){var r,i,a;(function(){var n,o,s,l,u,c,d,h,p,f,v,g,m,y,b;s=Math.floor,f=Math.min,o=function(e,t){return et?1:0},p=function(e,t,n,r,i){var a;if(null==n&&(n=0),null==i&&(i=o),n<0)throw new Error("lo must be non-negative");for(null==r&&(r=e.length);nn;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse(),l=[],r=0,i=a.length;rv;0<=v?++c:--c)g.push(u(e,n));return g},y=function(e,t,n,r){var i,a,s;for(null==r&&(r=o),i=e[n];n>t&&(s=n-1>>1,a=e[s],r(i,a)<0);)e[n]=a,n=s;return e[n]=i},b=function(e,t,n){var r,i,a,s,l;for(null==n&&(n=o),i=e.length,l=t,a=e[t],r=2*t+1;r=t||n<0||S&&r>=m}function c(){var e=E();if(u(e))return d(e);b=setTimeout(c,l(e))}function d(e){return b=void 0,D&&v?i(e):(v=g=void 0,y)}function h(){void 0!==b&&clearTimeout(b),T=0,v=P=g=b=void 0}function p(){return void 0===b?y:d(E())}function f(){var e=E(),n=u(e);if(v=arguments,g=this,P=e,n){if(void 0===b)return a(P);if(S)return b=setTimeout(c,t),i(P)}return void 0===b&&(b=setTimeout(c,t)),y}var v,g,m,y,b,P,T=0,C=!1,S=!1,D=!0;if("function"!=typeof e)throw new TypeError(s);return t=o(t)||0,r(n)&&(C=!!n.leading,S="maxWait"in n,m=S?x(o(n.maxWait)||0,t):m,D="trailing"in n?!!n.trailing:D),f.cancel=h,f.flush=p,f}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==typeof e}function a(e){return"symbol"==typeof e||i(e)&&b.call(e)==u}function o(e){if("number"==typeof e)return e;if(a(e))return l;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var n=h.test(e);return n||p.test(e)?f(e.slice(2),n?2:8):d.test(e)?l:+e}var s="Expected a function",l=NaN,u="[object Symbol]",c=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,p=/^0o[0-7]+$/i,f=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,m=v||g||Function("return this")(),y=Object.prototype,b=y.toString,x=Math.max,w=Math.min,E=function(){return m.Date.now()};e.exports=n}).call(t,n(20))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function o(){v&&p&&(v=!1,p.length?f=p.concat(f):g=-1,f.length&&s())}function s(){if(!v){var e=i(o);v=!0;for(var t=f.length;t;){for(p=f,f=[];++g1)for(var n=1;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(141),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate}])}); \ No newline at end of file diff --git a/documentation/docmaker.json b/documentation/docmaker.json index 0a0c6c710c..1c4d7da689 100644 --- a/documentation/docmaker.json +++ b/documentation/docmaker.json @@ -1,5 +1,5 @@ { - "version": "3.2.5", + "version": "3.2.6", "fnArgLinks": { "selector": "#selectors", diff --git a/documentation/index.html b/documentation/index.html index 1afcdc19c3..02705a8d37 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -1,8 +1,8 @@ -Cytoscape.js

Cytoscape.js

Graph theory / network library for analysis and visualisation

Cytoscape.js

Graph theory / network library for analysis and visualisation

Demos

Introduction

Factsheet

About

Cytoscape.js is an open-source graph theory (a.k.a. network) library written in JS. You can use Cytoscape.js for graph analysis and visualisation.

Cytoscape.js allows you to easily display and manipulate rich, interactive graphs. Because Cytoscape.js allows the user to interact with the graph and the library allows the client to hook into user events, Cytoscape.js is easily integrated into your app, especially since Cytoscape.js supports both desktop browsers, like Chrome, and mobile browsers, like on the iPad. Cytoscape.js includes all the gestures you would expect out-of-the-box, including pinch-to-zoom, box selection, panning, et cetera.

Cytoscape.js also has graph analysis in mind: The library contains many useful functions in graph theory. You can use Cytoscape.js headlessly on Node.js to do graph analysis in the terminal or on a web server.

Cytoscape.js is an open-source project, and anyone is free to contribute. For more information, refer to the GitHub README.

The library was created at the Donnelly Centre at the University of Toronto. It is the successor of Cytoscape Web.

Packages

  • npm : npm install cytoscape
  • bower : bower install cytoscape
  • jspm : jspm install npm:cytoscape
  • meteor : npm install cytoscape

Releases

Citation

To cite Cytoscape.js in a paper, please cite the Oxford Bioinformatics issue:

Cytoscape.js: a graph theory library for visualisation and analysis

Franz M, Lopes CT, Huck G, Dong Y, Sumer O, Bader GD

Bioinformatics (2016) 32 (2): 309-311 first published online September 28, 2015 doi:10.1093/bioinformatics/btv557 (PDF)

PubMed abstract

Funding

Funding for Cytoscape.js and Cytoscape is provided by NRNB (U.S. National Institutes of Health, National Center for Research Resources grant numbers P41 RR031228 and GM103504) and by NIH grants 2R01GM070743 and 1U41HG006623. The following organizations help develop Cytoscape:

ISB | UCSD | MSKCC | Pasteur | Agilent | UCSF | Unilever | Toronto | NCIBI | NRNB

Notation

Graph model

Cytoscape.js supports many different graph theory usecases. It supports directed graphs, undirected graphs, mixed graphs, loops, multigraphs, compound graphs (a type of hypergraph), and so on.

We are regularly making additions and enhancements to the library, and we gladly accept feature requests and pull requests.

Architecture & API

There are two components in the architecture that a developer need concern himself in order to use Cytoscape.js, the core (i.e. a graph instance) and the collection. In Cytoscape.js, the core is a developer’s main entry point into the library. From the core, a developer can run layouts, alter the viewport, and perform other operations on the graph as a whole.

The core provides several functions to access elements in the graph. Each of these functions returns a collection, a set of elements in the graph. Functions are available on collections that allow the developer to filter the collection, perform operations on the collection, traverse the graph about the collection, get data about elements in the collection, and so on.

Note that a collection is immutable by default, meaning that the set of elements within a collection can not be changed. The API returns a new collection with different elements when necessary, instead of mutating the existing collection. This allows the developer to safely use set theory operations on collections, use collections functionally, and so on. Note that because a collection is just a list of elements, it is inexpensive to create new collections.

For very performance intensive code, a collection can be treated as mutable with eles.merge() and eles.unmerge(). Most apps should never need these functions.

Functions

There are several types that different functions can be executed on, and the variable names used to denote these types in the documentation are outlined below:

ShorthandWorks on
cythe core
elesa collection of one or more elements (nodes and edges)
elea collection of a single element (node or edge)
nodesa collection of one or more nodes
nodea collection of a single node
edgesa collection of one or more edges
edgea collection of a single edge
layouta layout
anian animation

By default, a function returns a reference back to the calling object to allow for chaining (e.g. obj.fn1().fn2().fn3()). Unless otherwise indicated in this documentation, a function is chainable in this manner unless a different return value is specified. This applies both to the core and to collections.

For functions that return a value, note that calling a singular — ele, node, or edge — function on a collection of more than one element will return the expected value for only the first element.

Object ownership

When passing objects to Cytoscape.js for creating elements, animations, layouts, etc., the objects are considered owned by Cytoscape. Objects like elements have several levels to them, and doing deep copies of those objects every time they are passed to Cytoscape creates additional expense. When desired, the dev can copy objects manually before passing them to Cytoscape. However, copying is not necessary for most developers most of the time.

Gestures

Cytoscape.js supports several gestures:

  • Grab and drag background to pan : touch & desktop
  • Pinch to zoom : touch & desktop (with supported trackpad)
  • Mouse wheel to zoom : desktop
  • Two finger trackpad up or down to zoom : desktop
  • Tap to select : touch & desktop
  • Tap background to unselect : desktop
  • Taphold background to unselect : desktop & touch
  • Multiple selection via modifier key (shift, command, control, alt) + tap : desktop
  • Box selection : touch (three finger swipe) & desktop (modifier key + mousedown then drag)
  • Grab and drag nodes : touch & desktop

All gesture actions can be controlled by the dev, toggling them on or off whenever needed.

Position

A node’s position refers to the centre point of its body.

There is an important distinction to make for position: A position may be a model position or a rendered position.

A model position — as its name suggests — is the position stored in the model for an element. An element’s model position remains constant, despite changes to zoom and pan. Numeric style property values are specified in model co-ordinates, e.g. an node with width 20px will be 20 pixels wide at zoom 1.

A rendered position is an on-screen location relative to the viewport. For example, a rendered position of { x: 100, y: 100 } specifies a point 100 pixels to the right and 100 pixels down from the top-left corner of the viewport. The model position and rendered position are the same at zoom 1 and pan (0, 0).

An element’s rendered position naturally changes as zoom and pan changes, because the element’s on-screen position in the viewport changes as zooming and panning are applied. Panning is always measured in rendered coordinates.

In this documentation, “position” refers to model position unless otherwise stated.

A node’s position can be set manually, or it can be set automatically using a layout. Because the positions of two nodes influence the lengths of the edges in between them, a layout effectively sets edge lengths.

Elements JSON

Examples are given that outline format of the elements JSON used to load elements into Cytoscape.js:

cytoscape({
+			-->

Demos

Introduction

Factsheet

About

Cytoscape.js is an open-source graph theory (a.k.a. network) library written in JS. You can use Cytoscape.js for graph analysis and visualisation.

Cytoscape.js allows you to easily display and manipulate rich, interactive graphs. Because Cytoscape.js allows the user to interact with the graph and the library allows the client to hook into user events, Cytoscape.js is easily integrated into your app, especially since Cytoscape.js supports both desktop browsers, like Chrome, and mobile browsers, like on the iPad. Cytoscape.js includes all the gestures you would expect out-of-the-box, including pinch-to-zoom, box selection, panning, et cetera.

Cytoscape.js also has graph analysis in mind: The library contains many useful functions in graph theory. You can use Cytoscape.js headlessly on Node.js to do graph analysis in the terminal or on a web server.

Cytoscape.js is an open-source project, and anyone is free to contribute. For more information, refer to the GitHub README.

The library was created at the Donnelly Centre at the University of Toronto. It is the successor of Cytoscape Web.

Packages

  • npm : npm install cytoscape
  • bower : bower install cytoscape
  • jspm : jspm install npm:cytoscape
  • meteor : npm install cytoscape

Releases

Citation

To cite Cytoscape.js in a paper, please cite the Oxford Bioinformatics issue:

Cytoscape.js: a graph theory library for visualisation and analysis

Franz M, Lopes CT, Huck G, Dong Y, Sumer O, Bader GD

Bioinformatics (2016) 32 (2): 309-311 first published online September 28, 2015 doi:10.1093/bioinformatics/btv557 (PDF)

PubMed abstract

Funding

Funding for Cytoscape.js and Cytoscape is provided by NRNB (U.S. National Institutes of Health, National Center for Research Resources grant numbers P41 RR031228 and GM103504) and by NIH grants 2R01GM070743 and 1U41HG006623. The following organizations help develop Cytoscape:

ISB | UCSD | MSKCC | Pasteur | Agilent | UCSF | Unilever | Toronto | NCIBI | NRNB

Notation

Graph model

Cytoscape.js supports many different graph theory usecases. It supports directed graphs, undirected graphs, mixed graphs, loops, multigraphs, compound graphs (a type of hypergraph), and so on.

We are regularly making additions and enhancements to the library, and we gladly accept feature requests and pull requests.

Architecture & API

There are two components in the architecture that a developer need concern himself in order to use Cytoscape.js, the core (i.e. a graph instance) and the collection. In Cytoscape.js, the core is a developer’s main entry point into the library. From the core, a developer can run layouts, alter the viewport, and perform other operations on the graph as a whole.

The core provides several functions to access elements in the graph. Each of these functions returns a collection, a set of elements in the graph. Functions are available on collections that allow the developer to filter the collection, perform operations on the collection, traverse the graph about the collection, get data about elements in the collection, and so on.

Note that a collection is immutable by default, meaning that the set of elements within a collection can not be changed. The API returns a new collection with different elements when necessary, instead of mutating the existing collection. This allows the developer to safely use set theory operations on collections, use collections functionally, and so on. Note that because a collection is just a list of elements, it is inexpensive to create new collections.

For very performance intensive code, a collection can be treated as mutable with eles.merge() and eles.unmerge(). Most apps should never need these functions.

Functions

There are several types that different functions can be executed on, and the variable names used to denote these types in the documentation are outlined below:

ShorthandWorks on
cythe core
elesa collection of one or more elements (nodes and edges)
elea collection of a single element (node or edge)
nodesa collection of one or more nodes
nodea collection of a single node
edgesa collection of one or more edges
edgea collection of a single edge
layouta layout
anian animation

By default, a function returns a reference back to the calling object to allow for chaining (e.g. obj.fn1().fn2().fn3()). Unless otherwise indicated in this documentation, a function is chainable in this manner unless a different return value is specified. This applies both to the core and to collections.

For functions that return a value, note that calling a singular — ele, node, or edge — function on a collection of more than one element will return the expected value for only the first element.

Object ownership

When passing objects to Cytoscape.js for creating elements, animations, layouts, etc., the objects are considered owned by Cytoscape. Objects like elements have several levels to them, and doing deep copies of those objects every time they are passed to Cytoscape creates additional expense. When desired, the dev can copy objects manually before passing them to Cytoscape. However, copying is not necessary for most developers most of the time.

Gestures

Cytoscape.js supports several gestures:

  • Grab and drag background to pan : touch & desktop
  • Pinch to zoom : touch & desktop (with supported trackpad)
  • Mouse wheel to zoom : desktop
  • Two finger trackpad up or down to zoom : desktop
  • Tap to select : touch & desktop
  • Tap background to unselect : desktop
  • Taphold background to unselect : desktop & touch
  • Multiple selection via modifier key (shift, command, control, alt) + tap : desktop
  • Box selection : touch (three finger swipe) & desktop (modifier key + mousedown then drag)
  • Grab and drag nodes : touch & desktop

All gesture actions can be controlled by the dev, toggling them on or off whenever needed.

Position

A node’s position refers to the centre point of its body.

There is an important distinction to make for position: A position may be a model position or a rendered position.

A model position — as its name suggests — is the position stored in the model for an element. An element’s model position remains constant, despite changes to zoom and pan. Numeric style property values are specified in model co-ordinates, e.g. an node with width 20px will be 20 pixels wide at zoom 1.

A rendered position is an on-screen location relative to the viewport. For example, a rendered position of { x: 100, y: 100 } specifies a point 100 pixels to the right and 100 pixels down from the top-left corner of the viewport. The model position and rendered position are the same at zoom 1 and pan (0, 0).

An element’s rendered position naturally changes as zoom and pan changes, because the element’s on-screen position in the viewport changes as zooming and panning are applied. Panning is always measured in rendered coordinates.

In this documentation, “position” refers to model position unless otherwise stated.

A node’s position can be set manually, or it can be set automatically using a layout. Because the positions of two nodes influence the lengths of the edges in between them, a layout effectively sets edge lengths.

Elements JSON

Examples are given that outline format of the elements JSON used to load elements into Cytoscape.js:

cytoscape({
 
   container: document.getElementById('cy'),
 
@@ -834,8 +834,8 @@
   distanceTo: function( node ){ /* impl */ }
   pathTo: function( node ){ /* impl */ }
 }
-

distanceTo(node) returns the distance from the source node to node, and pathTo(node) returns a collection containing the shortest path from the source node to node. The path starts with the source node and includes the edges between the nodes in the path such that if pathTo(node)[i] is an edge, then pathTo(node)[i-1] is the previous node in the path and pathTo(node)[i+1] is the next node in the path.

If no weight function is defined, a constant weight of 1 is used for each edge.

Examples

var dijkstra = cy.elements().dijkstra('#e', function(){
-  return this.data('weight');
+

distanceTo(node) returns the distance from the source node to node, and pathTo(node) returns a collection containing the shortest path from the source node to node. The path starts with the source node and includes the edges between the nodes in the path such that if pathTo(node)[i] is an edge, then pathTo(node)[i-1] is the previous node in the path and pathTo(node)[i+1] is the next node in the path.

If no weight function is defined, a constant weight of 1 is used for each edge.

Examples

var dijkstra = cy.elements().dijkstra('#e', function(edge){
+  return edge.data('weight');
 });
 
 var pathToJ = dijkstra.pathTo( cy.$('#j') );
@@ -1016,7 +1016,7 @@
   'background-fit': 'cover cover',
   `background-image-opacity`: 0.5
 }
-

Pie chart background

These properties allow you to create pie chart backgrounds on nodes. Note that 16 slices maximum are supported per node, so in the properties 1 <= i <= 16. Of course, you must specify a numerical value for each property in place of i. Each nonzero sized slice is placed in order of i, starting from the 12 o’clock position and working clockwise.

You may find it useful to reserve a number to a particular colour for all nodes in your stylesheet. Then you can specify values for pie-i-background-size accordingly for each node via a mapper. This would allow you to create consistently coloured pie charts in each node of the graph based on element data.

  • pie-size : The diameter of the pie, measured as a percent of node size (e.g. 100%) or an absolute length (e.g. 25px).
  • pie-i-background-color : The colour of the node’s ith pie chart slice.
  • pie-i-background-size : The size of the node’s ith pie chart slice, measured in percent (e.g. 25% or 25).
  • pie-i-background-opacity : The opacity of the node’s ith pie chart slice.

Edge line

These properties affect the styling of an edge’s line:

  • width : The width of an edge’s line.
  • curve-style : The curving method used to separate two or more edges between two nodes; may be haystack (default, very fast, bundled straight edges for which loops and compounds are unsupported), bezier (bundled curved edges), unbundled-bezier (curved edges for use with manual control points), or segments (a series of straight lines). Note that haystack edges work best with ellipse, rectangle, or similar nodes. Smaller node shapes, like triangle, will not be as aesthetically pleasing. Also note that edge arrows are unsupported for haystack edges.
  • line-color : The colour of the edge’s line.
  • line-style : The style of the edge’s line; may be solid, dotted, or dashed.

Bezier edges

For automatic, bundled bezier edges (curve-style: bezier):

  • control-point-step-size : From the line perpendicular from source to target, this value specifies the distance between successive bezier edges.
  • control-point-distance : A single value that overrides control-point-step-size with a manual value. Because it overrides the step size, bezier edges with the same value will overlap. Thus, it’s best to use this as a one-off value for particular edges if need be.
  • control-point-weight : A single value that weights control points along the line from source to target. The value usually ranges on [0, 1], with 0 towards the source node and 1 towards the target node — but larger or smaller values can also be used.
  • edge-distances : With value intersection (default), the line from source to target for control-point-weight is from the outside of the source node’s shape to the outside of the target node’s shape. With value node-position, the line is from the source position to the target position. The node-position option makes calculating edge points easier — but it should be used carefully because you can create invalid points that intersection would have automatically corrected.

Loop edges

For loops (i.e. same source and target):

  • loop-direction : Determines the angle that loops extend from the node in cases when the source and target node of an edge is the same. The angle is specified from the 12 o’clock position and it progresses clockwise for increasing positive values. The default is -45deg (extending to the upper left).
  • loop-sweep : Determines the angle between the leaving and returning edges in loops. Positive values result in clockwise looping and negative values result in counter-clockwise looping. Default is -90deg.

Note that loops may only be bezier or unbundled-bezier for their curve-style.

Unbundled bezier edges

For bezier edges with manual control points (curve-style: unbundled-bezier):

  • control-point-distances : A series of values that specify for each control point the distance perpendicular to a line formed from source to target, e.g. -20 20 -20.
  • control-point-weights : A series of values that weights control points along a line from source to target, e.g. 0.25 0.5 0.75. A value usually ranges on [0, 1], with 0 towards the source node and 1 towards the target node — but larger or smaller values can also be used.
  • edge-distances : With value intersection (default), the line from source to target for control-point-weights is from the outside of the source node’s shape to the outside of the target node’s shape. With value node-position, the line is from the source position to the target position. The node-position option makes calculating edge points easier — but it should be used carefully because you can create invalid points that intersection would have automatically corrected.

Haystack edges

Loop edges and compound parent nodes are not supported by haystack edges. Haystack edges are a more performant replacement for plain, straight line edges.

For fast, straight line edges (curve-style: haystack):

  • haystack-radius : A value between 0 and 1 inclusive that indicates the relative radius used to position haystack edges on their connected nodes. The outside of the node is at 1, and the centre of the node is at 0.

Segments edges

For edges made of several straight lines (curve-style: segments):

  • segment-distances : A series of values that specify for each segment point the distance perpendicular to a line formed from source to target, e.g. -20 20 -20.
  • segment-weights : A series of values that weights segment points along a line from source to target, e.g. 0.25 0.5 0.75. A value usually ranges on [0, 1], with 0 towards the source node and 1 towards the target node — but larger or smaller values can also be used.
  • edge-distances : With value intersection (default), the line from source to target for segment-weights is from the outside of the source node’s shape to the outside of the target node’s shape. With value node-position, the line is from the source position to the target position. The node-position option makes calculating edge points easier — but it should be used carefully because you can create invalid points that intersection would have automatically corrected.

Edge arrow

  • <pos>-arrow-color : The colour of the edge’s source arrow.
  • <pos>-arrow-shape : The shape of the edge’s source arrow; may be tee, triangle, triangle-tee, triangle-cross, triangle-backcurve, square, circle, diamond, or none.
  • <pos>-arrow-fill : The fill state of the edge’s source arrow; may be filled or hollow.
  • arrow-scale : Scaling for the arrow size; may be any number >= 0.

For each edge arrow property above, replace <pos> with one of

  • source : Pointing towards the source node, at the end of the edge.
  • mid-source : Pointing towards the source node, at the middle of the edge.
  • target : Pointing towards the target node, at the end of the edge.
  • mid-target: Pointing towards the target node, at the middle of the edge.

Only mid arrows are supported on haystack edges.

Edge endpoints

source-endpoint & target-endpoint : Specifies the endpoint of the source side of the edge and the target side of the edge, respectively. There are several options for how those properties can be set:

  • A special, named value may be used.
    • outside-to-node (default) indicates that the edge should be placed automatically to point towards the node’s position and be placed on the outside of the node’s shape.
    • inside-to-node indicates the edge should go all the way inside the node and point directly on the node’s position. This is the same as specifying 0 0.
    • outside-to-line indicates the edge endpoint should be placed outside the node’s shape where it would intersect the imaginary line from the source position to the target position. This value is useful for automatically avoiding invalid cases for bezier edges, especially with compound nodes.
  • Two numbers may specify the endpoint. The numbers indicate a position relative to the source node’s position. The numbers can be specified as percent values (e.g. 50%, which are relative to the node’s width and height respectively) or as absolute distances (e.g. 100px or 2em).
  • A single angle value (e.g. 90deg or 1.57rad) may specify that the endpoint should be placed at where the line formed from the node’s position with the specified angle would intersect the node’s shape. The angle starts at 12 o’clock and progresses clockwise.

The endpoints for edges can be shifted away from the source and target node:

  • source-distance-from-node : A value that shifts the edge away from the source node (default 0px).
  • target-distance-from-node : A value that shifts the edge away from the target node (default 0px).

Endpoint modification is not supported for curve-style: haystack edges for performance reasons.

Visibility

  • display : Whether to display the element; may be element for displayed or none for not displayed.
    • A display: none element does not take up space.
      • A display: none bundled bezier edge does not take up space in its bundle.
      • A display: none node hides its connected edges.
    • A display: none element is not interactive.
  • visibility : Whether the element is visible; may be visible or hidden.
    • A visibility: hidden element does take up space.
      • A visibility: hidden bundled bezier edge does take up space in its bundle.
      • A visibility: hidden node does not hide its connected edges.
    • A visibility: hidden element is not interactive.
  • opacity : The opacity of the element, ranging from 0 to 1. Note that the opacity of a compound node parent affects the effective opacity of its children.
    • An opacity: 0 element does take up space.
      • An opacity: 0 bundled bezier edge does take up space in its bundle.
      • An opacity: 0 node does not hide its connected edges.
    • An opacity: 0 element is interactive.
  • z-index : An integer value that affects the relative draw order of elements. In general, an element with a higher z-index will be drawn on top of an element with a lower z-index. Note that edges are under nodes despite z-index, except when necessary for compound nodes.

Elements are drawn in a specific order based on compound depth (low to high), the element type (typically nodes above edges), and z-index (low to high). These styles affect the ordering:

  • z-compound-depth : May be bottom, orphan, auto (default), or top. The first drawn is bottom, the second is orphan, which is the same depth as the root of the compound graph, followed by the default of auto which draws in depth order from root to leaves of the compound graph. The last drawn is top.
  • z-index-compare: May be auto (default) or manual. The auto setting draws edges under nodes, whereas manual ignores this convention and draws solely based on the z-index value.
  • z-index : An integer value that affects the relative draw order of elements. In general, an element with a higher z-index will be drawn on top of an element with a lower z-index within the same depth.

Labels

Label text:

  • label : The text to display for an element’s label.
  • source-label : The text to display for an edge’s source label.
  • target-label : The text to display for an edge’s target label.

Basic font styling:

  • color : The colour of the element’s label.
  • text-opacity : The opacity of the label text, including its outline.
  • font-family : A comma-separated list of font names to use on the label text.
  • font-size : The size of the label text.
  • font-style : A CSS font style to be applied to the label text.
  • font-weight : A CSS font weight to be applied to the label text.
  • text-transform : A transformation to apply to the label text; may be none, uppercase, or lowercase.

Wrapping text:

  • text-wrap : A wrapping style to apply to the label text; may be none for no wrapping (including manual newlines: \n), wrap for manual and/or autowrapping or ellipsis to truncate the string and append ‘…’ based on text-max-width.
  • text-max-width : The maximum width for wrapped text, applied when text-wrap is set to wrap or ellipsis. For only manual newlines (i.e. \n), set a very large value like 1000px such that only your newline characters would apply.

Node label alignment:

  • text-halign : The vertical alignment of a node’s label; may have value left, center, or right.
  • text-valign : The vertical alignment of a node’s label; may have value top, center, or bottom.

Edge label alignment:

  • source-text-offset : For the source label of an edge, how far from the source node the label should be placed.
  • target-text-offset : For the target label of an edge, how far from the target node the label should be placed.

Margins:

  • text-margin-x : A margin that shifts the label along the x-axis.
  • text-margin-y : A margin that shifts the label along the y-axis.
  • source-text-margin-x : (For the source label of an edge.)
  • source-text-margin-y : (For the source label of an edge.)
  • target-text-margin-x : (For the target label of an edge.)
  • target-text-margin-y : (For the target label of an edge.)

Rotating text:

  • text-rotation : A rotation angle that is applied to the label.
    • For edges, the special value autorotate can be used to align the label to the edge.
    • For nodes, the label is rotated along its anchor point on the node, so a label margin may help for some usecases.
    • The special value none can be used to denote 0deg.
    • Rotations works best with left-to-right text.
  • source-text-rotation : (For the source label of an edge.)
  • target-text-rotation : (For the target label of an edge.)

Outline:

  • text-outline-color : The colour of the outline around the element’s label text.
  • text-outline-opacity : The opacity of the outline on label text.
  • text-outline-width : The size of the outline on label text.

Background:

  • text-background-color : A colour to apply on the text background.
  • text-background-opacity : The opacity of the label background; the background is disabled for 0 (default value).
  • text-background-shape : The shape to use for the label background, can be rectangle or roundrectangle.
  • text-background-padding : A padding on the background of the label (e.g 5px); zero padding is used by default.

Border:

  • text-border-opacity : The width of the border around the label; the border is disabled for 0 (default value).
  • text-border-width : The width of the border around the label.
  • text-border-style : The style of the border around the label; may be solid, dotted, dashed, or double.
  • text-border-color : The colour of the border around the label.

Interactivity:

  • min-zoomed-font-size : If zooming makes the effective font size of the label smaller than this, then no label is shown. Note that because of performance optimisations, the label may be shown at font sizes slightly smaller than this value. This effect is more pronounced at larger screen pixel ratios. However, it is guaranteed that the label will be shown at sizes equal to or greater than the value specified.
  • text-events : Whether events should occur on an element if the label receives an event; may be yes or no. You may want a style applied to the text on :active so you know the text is activatable.

Events

  • events : Whether events should occur on an element (e.g. tap, mouseover, etc.); may be yes or no. For no, the element receives no events and events simply pass through to the core/viewport. The events property is per-element, so the value of a compound parent does not affect its children.
  • text-events : Whether events should occur on an element if the label receives an event; may be yes or no. You may want a style applied to the text on :active so you know the text is activatable.

Overlay

These properties allow for the creation of overlays on top of nodes or edges, and are often used in the :active state.

  • overlay-color : The colour of the overlay.
  • overlay-padding : The area outside of the element within which the overlay is shown.
  • overlay-opacity : The opacity of the overlay.

Ghost

The ghost properties allow for creating a ghosting effect, a semitransparent duplicate of the element drawn at an offset.

  • ghost : Whether to use the ghost effect; may be yes or no.
  • ghost-offset-x : The horizontal offset used to position the ghost effect.
  • ghost-offset-y : The vertical offset used to position the ghost effect.
  • ghost-opacity : The opacity of the ghost effect.

Transition animation

  • transition-property : A comma separated list of style properties to animate in this state.
  • transition-duration : The length of the transition in seconds (e.g. 0.5s).
  • transition-delay : The length of the delay in seconds before the transition occurs (e.g. 250ms).
  • transition-timing-function : An easing function that controls the animation progress curve; may be one of the following values. A visualisation of easings serves as a reference.
    • linear (default),
    • spring( tension, friction ) (the demo has details for parameter values),
    • cubic-bezier( x1, y1, x2, y2 ) (the demo has details for parameter values),
    • 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.

Core

These properties affect UI global to the graph, and apply only to the core. You can use the special core selector string to set these properties.

Indicator:

  • active-bg-color : The colour of the indicator shown when the background is grabbed by the user.
  • active-bg-opacity : The opacity of the active background indicator.
  • active-bg-size : The size of the active background indicator.

Selection box:

  • selection-box-color : The background colour of the selection box used for drag selection.
  • selection-box-border-color : The colour of the border on the selection box.
  • selection-box-border-width : The size of the border on the selection box.
  • selection-box-opacity : The opacity of the selection box.

Texture during viewport gestures:

  • outside-texture-bg-color : The colour of the area outside the viewport texture when initOptions.textureOnViewport === true.
  • outside-texture-bg-opacity : The opacity of the area outside the viewport texture.

Events

Event object

Events passed to handler callbacks are similar to jQuery event objects in that they wrap native event objects, mimicking their API.

Fields:

  • cy : a reference to the corresponding core instance
  • target : indicates the element or core that first caused the event
  • type : the event type string (e.g. "tap")
  • namespace : the event namespace string (e.g. "foo" for "foo.tap")
  • timeStamp : Unix epoch time of event in milliseconds

Fields for only user input device events:

  • position : indicates the model position of the event
  • renderedPosition : indicates the rendered position of the event
  • originalEvent : the original user input device event object

Fields for only layout events:

  • layout : indicates the corresponding layout that triggered the event (useful if running multiple layouts simultaneously)

Event bubbling

All events that occur on elements get bubbled up to compound parents and then to the core. You must take this into consideration when binding to the core so you can differentiate between events that happened on the background and ones that happened on elements. Use the eventObj.target field, which indicates the originator of the event (i.e. eventObj.target === cy || eventObj.target === someEle).

User input device events

These are normal browser events that you can bind to via Cytoscape.js. You can bind these events to the core and to collections.

  • mousedown : when the mouse button is pressed
  • mouseup : when the mouse button is released
  • click : after mousedown then mouseup
  • mouseover : when the cursor is put on top of the target
  • mouseout : when the cursor is moved off of the target
  • mousemove : when the cursor is moved somewhere on top of the target
  • touchstart : when one or more fingers starts to touch the screen
  • touchmove : when one or more fingers are moved on the screen
  • touchend : when one or more fingers are removed from the screen

There are also some higher level events that you can use so you don’t have to bind to different events for mouse-input devices and for touch devices.

  • tapstart or vmousedown : normalised tap start event (either mousedown or touchstart)
  • tapdrag or vmousemove : normalised move event (either touchmove or mousemove)
  • tapdragover : normalised over element event (either touchmove or mousemove/mouseover)
  • tapdragout : normalised off of element event (either touchmove or mousemove/mouseout)
  • tapend or vmouseup : normalised tap end event (either mouseup or touchend)
  • tap or vclick : normalised tap event (either click, or touchstart followed by touchend without touchmove)
  • taphold : normalised tap hold event
  • cxttapstart : normalised right-click mousedown or two-finger tapstart
  • cxttapend : normalised right-click mouseup or two-finger tapend
  • cxttap : normalised right-click or two-finger tap
  • cxtdrag : normalised mousemove or two-finger drag after cxttapstart but before cxttapend
  • cxtdragover : when going over a node via cxtdrag
  • cxtdragout : when going off a node via cxtdrag
  • boxstart : when starting box selection
  • boxend : when ending box selection
  • boxselect : triggered on elements when selected by box selection
  • box : triggered on elements when inside the box on boxend

Collection events

These events are custom to Cytoscape.js. You can bind to these events for collections.

  • add : when an element is added to the graph
  • remove : when an element is removed from the graph
  • select : when an element is selected
  • unselect : when an element is unselected
  • lock : when an element is locked
  • unlock : when an element is unlocked
  • grabon : when an element is grabbed directly (including only the one node directly under the cursor or the user’s finger)
  • grab : when an element is grabbed (including all elements that would be dragged)
  • drag : when an element is grabbed and then moved
  • free : when an element is freed (i.e. let go from being grabbed)
  • position : when an element changes position
  • data : when an element’s data is changed
  • scratch : when an element’s scratchpad data is changed
  • style : when an element’s style is changed
  • background : when a node’s background image is loaded

Graph events

These events are custom to Cytoscape.js, and they occur on the core.

  • layoutstart : when a layout starts running
  • layoutready : when a layout has set initial positions for all the nodes (but perhaps not final positions)
  • layoutstop : when a layout has finished running completely or otherwise stopped running
  • ready : when a new instance of Cytoscape.js is ready to be interacted with
  • destroy : when the instance of Cytoscape.js was explicitly destroyed by calling .destroy().
  • render : when the viewport is (re)rendered
  • pan : when the viewport is panned
  • zoom : when the viewport is zoomed
  • resize : when the viewport is resized (usually by calling cy.resize(), a window resize, or toggling a class on the Cytoscape.js div)

Layouts

The function of a layout is to set the positions on the nodes in the graph. Layouts are extensions of Cytoscape.js such that it is possible for anyone to write a layout without modifying the library itself.

Several layouts are included with Cytoscape.js by default, and their options are described in the sections that follow with the default values specified. Note that you must set options.name to the name of the layout to specify which one you want to run.

Each layout has its own algorithm for setting the position for each node. This algorithm influences the overall shape of the graph and the lengths of the edges. A layout’s algorithm can be customised by setting its options. Therefore, edge lengths can be controlled by setting the layout options appropriately.

For force-directed (physics) layouts, there is generally an option to set a weight to each edge to affect the relative edge lengths. Edge length can also be affected by options like spacing factors, angles, and overlap avoidance. Setting edge length depends on the particular layout, and some layouts will allow for more precise edge lengths than others.

null

The null layout puts all nodes at (0, 0). It’s useful for debugging purposes.

Options

var options = {
+

Pie chart background

These properties allow you to create pie chart backgrounds on nodes. Note that 16 slices maximum are supported per node, so in the properties 1 <= i <= 16. Of course, you must specify a numerical value for each property in place of i. Each nonzero sized slice is placed in order of i, starting from the 12 o’clock position and working clockwise.

You may find it useful to reserve a number to a particular colour for all nodes in your stylesheet. Then you can specify values for pie-i-background-size accordingly for each node via a mapper. This would allow you to create consistently coloured pie charts in each node of the graph based on element data.

  • pie-size : The diameter of the pie, measured as a percent of node size (e.g. 100%) or an absolute length (e.g. 25px).
  • pie-i-background-color : The colour of the node’s ith pie chart slice.
  • pie-i-background-size : The size of the node’s ith pie chart slice, measured in percent (e.g. 25% or 25).
  • pie-i-background-opacity : The opacity of the node’s ith pie chart slice.

Edge line

These properties affect the styling of an edge’s line:

  • width : The width of an edge’s line.
  • curve-style : The curving method used to separate two or more edges between two nodes; may be haystack (default, very fast, bundled straight edges for which loops and compounds are unsupported), bezier (bundled curved edges), unbundled-bezier (curved edges for use with manual control points), or segments (a series of straight lines). Note that haystack edges work best with ellipse, rectangle, or similar nodes. Smaller node shapes, like triangle, will not be as aesthetically pleasing. Also note that edge arrows are unsupported for haystack edges.
  • line-color : The colour of the edge’s line.
  • line-style : The style of the edge’s line; may be solid, dotted, or dashed.

Bezier edges

For automatic, bundled bezier edges (curve-style: bezier):

  • control-point-step-size : From the line perpendicular from source to target, this value specifies the distance between successive bezier edges.
  • control-point-distance : A single value that overrides control-point-step-size with a manual value. Because it overrides the step size, bezier edges with the same value will overlap. Thus, it’s best to use this as a one-off value for particular edges if need be.
  • control-point-weight : A single value that weights control points along the line from source to target. The value usually ranges on [0, 1], with 0 towards the source node and 1 towards the target node — but larger or smaller values can also be used.
  • edge-distances : With value intersection (default), the line from source to target for control-point-weight is from the outside of the source node’s shape to the outside of the target node’s shape. With value node-position, the line is from the source position to the target position. The node-position option makes calculating edge points easier — but it should be used carefully because you can create invalid points that intersection would have automatically corrected.

Loop edges

For loops (i.e. same source and target):

  • loop-direction : Determines the angle that loops extend from the node in cases when the source and target node of an edge is the same. The angle is specified from the 12 o’clock position and it progresses clockwise for increasing positive values. The default is -45deg (extending to the upper left).
  • loop-sweep : Determines the angle between the leaving and returning edges in loops. Positive values result in clockwise looping and negative values result in counter-clockwise looping. Default is -90deg.

Note that loops may only be bezier or unbundled-bezier for their curve-style.

Unbundled bezier edges

For bezier edges with manual control points (curve-style: unbundled-bezier):

  • control-point-distances : A series of values that specify for each control point the distance perpendicular to a line formed from source to target, e.g. -20 20 -20.
  • control-point-weights : A series of values that weights control points along a line from source to target, e.g. 0.25 0.5 0.75. A value usually ranges on [0, 1], with 0 towards the source node and 1 towards the target node — but larger or smaller values can also be used.
  • edge-distances : With value intersection (default), the line from source to target for control-point-weights is from the outside of the source node’s shape to the outside of the target node’s shape. With value node-position, the line is from the source position to the target position. The node-position option makes calculating edge points easier — but it should be used carefully because you can create invalid points that intersection would have automatically corrected.

Haystack edges

Loop edges and compound parent nodes are not supported by haystack edges. Haystack edges are a more performant replacement for plain, straight line edges.

For fast, straight line edges (curve-style: haystack):

  • haystack-radius : A value between 0 and 1 inclusive that indicates the relative radius used to position haystack edges on their connected nodes. The outside of the node is at 1, and the centre of the node is at 0.

Segments edges

For edges made of several straight lines (curve-style: segments):

  • segment-distances : A series of values that specify for each segment point the distance perpendicular to a line formed from source to target, e.g. -20 20 -20.
  • segment-weights : A series of values that weights segment points along a line from source to target, e.g. 0.25 0.5 0.75. A value usually ranges on [0, 1], with 0 towards the source node and 1 towards the target node — but larger or smaller values can also be used.
  • edge-distances : With value intersection (default), the line from source to target for segment-weights is from the outside of the source node’s shape to the outside of the target node’s shape. With value node-position, the line is from the source position to the target position. The node-position option makes calculating edge points easier — but it should be used carefully because you can create invalid points that intersection would have automatically corrected.

Edge arrow

  • <pos>-arrow-color : The colour of the edge’s source arrow.
  • <pos>-arrow-shape : The shape of the edge’s source arrow; may be tee, triangle, triangle-tee, triangle-cross, triangle-backcurve, square, circle, diamond, or none.
  • <pos>-arrow-fill : The fill state of the edge’s source arrow; may be filled or hollow.
  • arrow-scale : Scaling for the arrow size; may be any number >= 0.

For each edge arrow property above, replace <pos> with one of

  • source : Pointing towards the source node, at the end of the edge.
  • mid-source : Pointing towards the source node, at the middle of the edge.
  • target : Pointing towards the target node, at the end of the edge.
  • mid-target: Pointing towards the target node, at the middle of the edge.

Only mid arrows are supported on haystack edges.

Edge endpoints

source-endpoint & target-endpoint : Specifies the endpoint of the source side of the edge and the target side of the edge, respectively. There are several options for how those properties can be set:

  • A special, named value may be used.
    • outside-to-node (default) indicates that the edge should be placed automatically to point towards the node’s position and be placed on the outside of the node’s shape.
    • inside-to-node indicates the edge should go all the way inside the node and point directly on the node’s position. This is the same as specifying 0 0.
    • outside-to-line indicates the edge endpoint should be placed outside the node’s shape where it would intersect the imaginary line from the source position to the target position. This value is useful for automatically avoiding invalid cases for bezier edges, especially with compound nodes.
  • Two numbers may specify the endpoint. The numbers indicate a position relative to the source node’s position. The numbers can be specified as percent values (e.g. 50%, which are relative to the node’s width and height respectively) or as absolute distances (e.g. 100px or 2em).
  • A single angle value (e.g. 90deg or 1.57rad) may specify that the endpoint should be placed at where the line formed from the node’s position with the specified angle would intersect the node’s shape. The angle starts at 12 o’clock and progresses clockwise.

The endpoints for edges can be shifted away from the source and target node:

  • source-distance-from-node : A value that shifts the edge away from the source node (default 0px).
  • target-distance-from-node : A value that shifts the edge away from the target node (default 0px).

Endpoint modification is not supported for curve-style: haystack edges for performance reasons.

Visibility

  • display : Whether to display the element; may be element for displayed or none for not displayed.
    • A display: none element does not take up space.
      • A display: none bundled bezier edge does not take up space in its bundle.
      • A display: none node hides its connected edges.
    • A display: none element is not interactive.
  • visibility : Whether the element is visible; may be visible or hidden.
    • A visibility: hidden element does take up space.
      • A visibility: hidden bundled bezier edge does take up space in its bundle.
      • A visibility: hidden node does not hide its connected edges.
    • A visibility: hidden element is not interactive.
  • opacity : The opacity of the element, ranging from 0 to 1. Note that the opacity of a compound node parent affects the effective opacity of its children.
    • An opacity: 0 element does take up space.
      • An opacity: 0 bundled bezier edge does take up space in its bundle.
      • An opacity: 0 node does not hide its connected edges.
    • An opacity: 0 element is interactive.
  • z-index : An integer value that affects the relative draw order of elements. In general, an element with a higher z-index will be drawn on top of an element with a lower z-index. Note that edges are under nodes despite z-index, except when necessary for compound nodes.

Elements are drawn in a specific order based on compound depth (low to high), the element type (typically nodes above edges), and z-index (low to high). These styles affect the ordering:

  • z-compound-depth : May be bottom, orphan, auto (default), or top. The first drawn is bottom, the second is orphan, which is the same depth as the root of the compound graph, followed by the default of auto which draws in depth order from root to leaves of the compound graph. The last drawn is top.
  • z-index-compare: May be auto (default) or manual. The auto setting draws edges under nodes, whereas manual ignores this convention and draws solely based on the z-index value.
  • z-index : An integer value that affects the relative draw order of elements. In general, an element with a higher z-index will be drawn on top of an element with a lower z-index within the same depth.

Labels

Label text:

  • label : The text to display for an element’s label.
  • source-label : The text to display for an edge’s source label.
  • target-label : The text to display for an edge’s target label.

Basic font styling:

  • color : The colour of the element’s label.
  • text-opacity : The opacity of the label text, including its outline.
  • font-family : A comma-separated list of font names to use on the label text.
  • font-size : The size of the label text.
  • font-style : A CSS font style to be applied to the label text.
  • font-weight : A CSS font weight to be applied to the label text.
  • text-transform : A transformation to apply to the label text; may be none, uppercase, or lowercase.

Wrapping text:

  • text-wrap : A wrapping style to apply to the label text; may be none for no wrapping (including manual newlines: \n), wrap for manual and/or autowrapping or ellipsis to truncate the string and append ‘…’ based on text-max-width.
  • text-max-width : The maximum width for wrapped text, applied when text-wrap is set to wrap or ellipsis. For only manual newlines (i.e. \n), set a very large value like 1000px such that only your newline characters would apply.

Node label alignment:

  • text-halign : The vertical alignment of a node’s label; may have value left, center, or right.
  • text-valign : The vertical alignment of a node’s label; may have value top, center, or bottom.

Edge label alignment:

  • source-text-offset : For the source label of an edge, how far from the source node the label should be placed.
  • target-text-offset : For the target label of an edge, how far from the target node the label should be placed.

Margins:

  • text-margin-x : A margin that shifts the label along the x-axis.
  • text-margin-y : A margin that shifts the label along the y-axis.
  • source-text-margin-x : (For the source label of an edge.)
  • source-text-margin-y : (For the source label of an edge.)
  • target-text-margin-x : (For the target label of an edge.)
  • target-text-margin-y : (For the target label of an edge.)

Rotating text:

  • text-rotation : A rotation angle that is applied to the label.
    • For edges, the special value autorotate can be used to align the label to the edge.
    • For nodes, the label is rotated along its anchor point on the node, so a label margin may help for some usecases.
    • The special value none can be used to denote 0deg.
    • Rotations works best with left-to-right text.
  • source-text-rotation : (For the source label of an edge.)
  • target-text-rotation : (For the target label of an edge.)

Outline:

  • text-outline-color : The colour of the outline around the element’s label text.
  • text-outline-opacity : The opacity of the outline on label text.
  • text-outline-width : The size of the outline on label text.

Background:

  • text-background-color : A colour to apply on the text background.
  • text-background-opacity : The opacity of the label background; the background is disabled for 0 (default value).
  • text-background-shape : The shape to use for the label background, can be rectangle or roundrectangle.
  • text-background-padding : A padding on the background of the label (e.g 5px); zero padding is used by default.

Border:

  • text-border-opacity : The width of the border around the label; the border is disabled for 0 (default value).
  • text-border-width : The width of the border around the label.
  • text-border-style : The style of the border around the label; may be solid, dotted, dashed, or double.
  • text-border-color : The colour of the border around the label.

Interactivity:

  • min-zoomed-font-size : If zooming makes the effective font size of the label smaller than this, then no label is shown. Note that because of performance optimisations, the label may be shown at font sizes slightly smaller than this value. This effect is more pronounced at larger screen pixel ratios. However, it is guaranteed that the label will be shown at sizes equal to or greater than the value specified.
  • text-events : Whether events should occur on an element if the label receives an event; may be yes or no. You may want a style applied to the text on :active so you know the text is activatable.

Events

  • events : Whether events should occur on an element (e.g. tap, mouseover, etc.); may be yes or no. For no, the element receives no events and events simply pass through to the core/viewport. The events property is per-element, so the value of a compound parent does not affect its children.
  • text-events : Whether events should occur on an element if the label receives an event; may be yes or no. You may want a style applied to the text on :active so you know the text is activatable.

Overlay

These properties allow for the creation of overlays on top of nodes or edges, and are often used in the :active state.

  • overlay-color : The colour of the overlay.
  • overlay-padding : The area outside of the element within which the overlay is shown.
  • overlay-opacity : The opacity of the overlay.

Ghost

The ghost properties allow for creating a ghosting effect, a semitransparent duplicate of the element drawn at an offset.

  • ghost : Whether to use the ghost effect; may be yes or no.
  • ghost-offset-x : The horizontal offset used to position the ghost effect.
  • ghost-offset-y : The vertical offset used to position the ghost effect.
  • ghost-opacity : The opacity of the ghost effect.

Transition animation

  • transition-property : A comma separated list of style properties to animate in this state.
  • transition-duration : The length of the transition in seconds (e.g. 0.5s).
  • transition-delay : The length of the delay in seconds before the transition occurs (e.g. 250ms).
  • transition-timing-function : An easing function that controls the animation progress curve; may be one of the following values. A visualisation of easings serves as a reference.
    • linear (default),
    • spring( tension, friction ) (the demo has details for parameter values),
    • cubic-bezier( x1, y1, x2, y2 ) (the demo has details for parameter values),
    • 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.

Core

These properties affect UI global to the graph, and apply only to the core. You can use the special core selector string to set these properties.

Indicator:

  • active-bg-color : The colour of the indicator shown when the background is grabbed by the user.
  • active-bg-opacity : The opacity of the active background indicator.
  • active-bg-size : The size of the active background indicator.

Selection box:

  • selection-box-color : The background colour of the selection box used for drag selection.
  • selection-box-border-color : The colour of the border on the selection box.
  • selection-box-border-width : The size of the border on the selection box.
  • selection-box-opacity : The opacity of the selection box.

Texture during viewport gestures:

  • outside-texture-bg-color : The colour of the area outside the viewport texture when initOptions.textureOnViewport === true.
  • outside-texture-bg-opacity : The opacity of the area outside the viewport texture.

Events

Event object

Events passed to handler callbacks are similar to jQuery event objects in that they wrap native event objects, mimicking their API.

Fields:

  • cy : a reference to the corresponding core instance
  • target : indicates the element or core that first caused the event
  • type : the event type string (e.g. "tap")
  • namespace : the event namespace string (e.g. "foo" for "tap.foo")
  • timeStamp : Unix epoch time of event in milliseconds

Fields for only user input device events:

  • position : indicates the model position of the event
  • renderedPosition : indicates the rendered position of the event
  • originalEvent : the original user input device event object

Fields for only layout events:

  • layout : indicates the corresponding layout that triggered the event (useful if running multiple layouts simultaneously)

Event bubbling

All events that occur on elements get bubbled up to compound parents and then to the core. You must take this into consideration when binding to the core so you can differentiate between events that happened on the background and ones that happened on elements. Use the eventObj.target field, which indicates the originator of the event (i.e. eventObj.target === cy || eventObj.target === someEle).

User input device events

These are normal browser events that you can bind to via Cytoscape.js. You can bind these events to the core and to collections.

  • mousedown : when the mouse button is pressed
  • mouseup : when the mouse button is released
  • click : after mousedown then mouseup
  • mouseover : when the cursor is put on top of the target
  • mouseout : when the cursor is moved off of the target
  • mousemove : when the cursor is moved somewhere on top of the target
  • touchstart : when one or more fingers starts to touch the screen
  • touchmove : when one or more fingers are moved on the screen
  • touchend : when one or more fingers are removed from the screen

There are also some higher level events that you can use so you don’t have to bind to different events for mouse-input devices and for touch devices.

  • tapstart or vmousedown : normalised tap start event (either mousedown or touchstart)
  • tapdrag or vmousemove : normalised move event (either touchmove or mousemove)
  • tapdragover : normalised over element event (either touchmove or mousemove/mouseover)
  • tapdragout : normalised off of element event (either touchmove or mousemove/mouseout)
  • tapend or vmouseup : normalised tap end event (either mouseup or touchend)
  • tap or vclick : normalised tap event (either click, or touchstart followed by touchend without touchmove)
  • taphold : normalised tap hold event
  • cxttapstart : normalised right-click mousedown or two-finger tapstart
  • cxttapend : normalised right-click mouseup or two-finger tapend
  • cxttap : normalised right-click or two-finger tap
  • cxtdrag : normalised mousemove or two-finger drag after cxttapstart but before cxttapend
  • cxtdragover : when going over a node via cxtdrag
  • cxtdragout : when going off a node via cxtdrag
  • boxstart : when starting box selection
  • boxend : when ending box selection
  • boxselect : triggered on elements when selected by box selection
  • box : triggered on elements when inside the box on boxend

Collection events

These events are custom to Cytoscape.js. You can bind to these events for collections.

  • add : when an element is added to the graph
  • remove : when an element is removed from the graph
  • select : when an element is selected
  • unselect : when an element is unselected
  • lock : when an element is locked
  • unlock : when an element is unlocked
  • grabon : when an element is grabbed directly (including only the one node directly under the cursor or the user’s finger)
  • grab : when an element is grabbed (including all elements that would be dragged)
  • drag : when an element is grabbed and then moved
  • free : when an element is freed (i.e. let go from being grabbed)
  • position : when an element changes position
  • data : when an element’s data is changed
  • scratch : when an element’s scratchpad data is changed
  • style : when an element’s style is changed
  • background : when a node’s background image is loaded

Graph events

These events are custom to Cytoscape.js, and they occur on the core.

  • layoutstart : when a layout starts running
  • layoutready : when a layout has set initial positions for all the nodes (but perhaps not final positions)
  • layoutstop : when a layout has finished running completely or otherwise stopped running
  • ready : when a new instance of Cytoscape.js is ready to be interacted with
  • destroy : when the instance of Cytoscape.js was explicitly destroyed by calling .destroy().
  • render : when the viewport is (re)rendered
  • pan : when the viewport is panned
  • zoom : when the viewport is zoomed
  • resize : when the viewport is resized (usually by calling cy.resize(), a window resize, or toggling a class on the Cytoscape.js div)

Layouts

The function of a layout is to set the positions on the nodes in the graph. Layouts are extensions of Cytoscape.js such that it is possible for anyone to write a layout without modifying the library itself.

Several layouts are included with Cytoscape.js by default, and their options are described in the sections that follow with the default values specified. Note that you must set options.name to the name of the layout to specify which one you want to run.

Each layout has its own algorithm for setting the position for each node. This algorithm influences the overall shape of the graph and the lengths of the edges. A layout’s algorithm can be customised by setting its options. Therefore, edge lengths can be controlled by setting the layout options appropriately.

For force-directed (physics) layouts, there is generally an option to set a weight to each edge to affect the relative edge lengths. Edge length can also be affected by options like spacing factors, angles, and overlap avoidance. Setting edge length depends on the particular layout, and some layouts will allow for more precise edge lengths than others.

null

The null layout puts all nodes at (0, 0). It’s useful for debugging purposes.

Options

var options = {
   name: 'null',
 
   ready: function(){}, // on layoutready
diff --git a/documentation/js/cytoscape.min.js b/documentation/js/cytoscape.min.js
index 7df0d7e95e..90c8156a5d 100644
--- a/documentation/js/cytoscape.min.js
+++ b/documentation/js/cytoscape.min.js
@@ -1,10 +1,10 @@
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.cytoscape=t():e.cytoscape=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=117)}([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},i=n(4),a=i?i.navigator:null,o=i?i.document:null,s=r(""),l=r({}),u=r(function(){}),c="undefined"==typeof HTMLElement?"undefined":r(HTMLElement),d=function(e){return e&&e.instanceString&&h.fn(e.instanceString)?e.instanceString():null},h={defined:function(e){return null!=e},string:function(e){return null!=e&&(void 0===e?"undefined":r(e))==s},fn:function(e){return null!=e&&(void 0===e?"undefined":r(e))===u},array:function(e){return Array.isArray?Array.isArray(e):null!=e&&e instanceof Array},plainObject:function(e){return null!=e&&(void 0===e?"undefined":r(e))===l&&!h.array(e)&&e.constructor===Object},object:function(e){return null!=e&&(void 0===e?"undefined":r(e))===l},number:function(e){return null!=e&&(void 0===e?"undefined":r(e))===r(1)&&!isNaN(e)},integer:function(e){return h.number(e)&&Math.floor(e)===e},bool:function(e){return null!=e&&(void 0===e?"undefined":r(e))===r(!0)},htmlElement:function(e){return"undefined"===c?void 0:null!=e&&e instanceof HTMLElement},elementOrCollection:function(e){return h.element(e)||h.collection(e)},element:function(e){return"collection"===d(e)&&e._private.single},collection:function(e){return"collection"===d(e)&&!e._private.single},core:function(e){return"core"===d(e)},style:function(e){return"style"===d(e)},stylesheet:function(e){return"stylesheet"===d(e)},event:function(e){return"event"===d(e)},thread:function(e){return"thread"===d(e)},fabric:function(e){return"fabric"===d(e)},emptyString:function(e){return void 0===e||null===e||!(""!==e&&!e.match(/^\s+$/))},nonemptyString:function(e){return!(!e||!h.string(e)||""===e||e.match(/^\s+$/))},domElement:function(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement},boundingBox:function(e){return h.plainObject(e)&&h.number(e.x1)&&h.number(e.x2)&&h.number(e.y1)&&h.number(e.y2)},promise:function(e){return h.object(e)&&h.fn(e.then)},touch:function(){return i&&("ontouchstart"in i||i.DocumentTouch&&o instanceof DocumentTouch)},gecko:function(){return i&&("undefined"!=typeof InstallTrigger||"MozAppearance"in o.documentElement.style)},webkit:function(){return i&&("undefined"!=typeof webkitURL||"WebkitAppearance"in o.documentElement.style)},chromium:function(){return i&&"undefined"!=typeof chrome},khtml:function(){return a&&a.vendor.match(/kde/i)},khtmlEtc:function(){return h.khtml()||h.webkit()||h.chromium()},ms:function(){return a&&a.userAgent.match(/msie|trident|edge/i)},windows:function(){return a&&a.appVersion.match(/Win/i)},mac:function(){return a&&a.appVersion.match(/Mac/i)},linux:function(){return a&&a.appVersion.match(/Linux/i)},unix:function(){return a&&a.appVersion.match(/X11/i)}};e.exports=h},function(e,t,n){"use strict";var r=n(0),i=n(2),a={MAX_INT:Number.MAX_SAFE_INTEGER||9007199254740991,trueify:function(){return!0},falsify:function(){return!1},zeroify:function(){return 0},noop:function(){},error:function(e){console.error?(console.error.apply(console,arguments),console.trace&&console.trace()):(console.log.apply(console,arguments),console.trace&&console.trace())},clone:function(e){return this.extend({},e)},copy:function(e){return null==e?e:r.array(e)?e.slice():r.plainObject(e)?this.clone(e):e},copyArray:function(e){return e.slice()},clonePosition:function(e){return{x:e.x,y:e.y}},uuid: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}};a.makeBoundingBox=i.makeBoundingBox.bind(i),a._staticEmptyObject={},a.staticEmptyObject=function(){return a._staticEmptyObject},a.extend=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n=0&&(e[r]!==t||(e.splice(r,1),n));r--);},a.clearArray=function(e){e.splice(0,e.length)},a.push=function(e,t){for(var n=0;n0?1:e<0?-1:0},r.dist=function(e,t){return Math.sqrt(r.sqdist(e,t))},r.sqdist=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},r.qbezierAt=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},r.qbezierPtAt=function(e,t,n,i){return{x:r.qbezierAt(e.x,t.x,n.x,i),y:r.qbezierAt(e.y,t.y,n.y,i)}},r.lineAt=function(e,t,n,i){var a={x:t.x-e.x,y:t.y-e.y},o=r.dist(e,t),s={x:a.x/o,y:a.y/o};return n=null==n?0:n,i=null!=i?i:n*o,{x:e.x+s.x*i,y:e.y+s.y*i}},r.lineAtDist=function(e,t,n){return r.lineAt(e,t,void 0,n)},r.triangleAngle=function(e,t,n){var i=r.dist(t,n),a=r.dist(e,n),o=r.dist(e,t);return Math.acos((i*i+a*a-o*o)/(2*i*a))},r.bound=function(e,t,n){return Math.max(e,Math.min(n,t))},r.makeBoundingBox=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}}},r.updateBoundingBox=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},r.expandBoundingBoxByPoint=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},r.expandBoundingBox=function(e,t){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},r.boundingBoxesIntersect=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},r.inBoundingBox=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},r.pointInBoundingBox=function(e,t){return this.inBoundingBox(e,t.x,t.y)},r.boundingBoxInBoundingBox=function(e,t){return r.inBoundingBox(e,t.x1,t.y1)&&r.inBoundingBox(e,t.x2,t.y2)},r.roundRectangleIntersectLine=function(e,t,n,r,i,a,o){var s=this.getRoundRectangleRadius(i,a),l=i/2,u=a/2,c=void 0,d=n-l+s-o,h=r-u-o,p=n+l-s+o,f=h;if(c=this.finiteLinesIntersect(e,t,n,r,d,h,p,f,!1),c.length>0)return c;var v=n+l+o,g=r-u+s-o,m=v,y=r+u-s+o;if(c=this.finiteLinesIntersect(e,t,n,r,v,g,m,y,!1),c.length>0)return c;var b=n-l+s-o,x=r+u+o,w=n+l-s+o,E=x;if(c=this.finiteLinesIntersect(e,t,n,r,b,x,w,E,!1),c.length>0)return c;var P=n-l-o,T=r-u+s-o,C=P,S=r+u-s+o;if(c=this.finiteLinesIntersect(e,t,n,r,P,T,C,S,!1),c.length>0)return c;var D=void 0,k=n-l+s,_=r-u+s;if(D=this.intersectLineCircle(e,t,n,r,k,_,s+o),D.length>0&&D[0]<=k&&D[1]<=_)return[D[0],D[1]];var M=n+l-s,I=r-u+s;if(D=this.intersectLineCircle(e,t,n,r,M,I,s+o),D.length>0&&D[0]>=M&&D[1]<=I)return[D[0],D[1]];var N=n+l-s,B=r+u-s;if(D=this.intersectLineCircle(e,t,n,r,N,B,s+o),D.length>0&&D[0]>=N&&D[1]>=B)return[D[0],D[1]];var z=n-l+s,L=r+u-s;return D=this.intersectLineCircle(e,t,n,r,z,L,s+o),D.length>0&&D[0]<=z&&D[1]>=L?[D[0],D[1]]:[]},r.inLineVicinity=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),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},r.inBezierVicinity=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!(eu.x2||tu.y2)},r.solveQuadratic=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;return[(-t+a)/o,(-t-a)/o]},r.solveCubic=function(e,t,n,r,i){t/=e,n/=e,r/=e;var a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=void 0,d=void 0,h=void 0;return 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,d=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]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,void(i[5]=-d)):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,void(i[4]=i[2]=-(h+d))):(o=-o,l=o*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),void(i[4]=-d+h*Math.cos((l+4*Math.PI)/3))))},r.sqdistToQuadraticBezier=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,d=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,h=[];this.solveCubic(l,u,c,d,h);for(var p=[],f=0;f<6;f+=2)Math.abs(h[f+1])<1e-7&&h[f]>=0&&h[f]<=1&&p.push(h[f]);p.push(1),p.push(0);for(var v=-1,g=void 0,m=void 0,y=void 0,b=0;b=0?yl?(e-i)*(e-i)+(t-a)*(t-a):u-d},r.pointInsidePolygonPoints=function(e,t,n){for(var r=void 0,i=void 0,a=void 0,o=void 0,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},r.pointInsidePolygon=function(e,t,n,i,a,o,s,l,u){var c=new Array(n.length),d=void 0;null!=l[0]?(d=Math.atan(l[1]/l[0]),l[0]<0?d+=Math.PI/2:d=-d-Math.PI/2):d=l;for(var h=Math.cos(-d),p=Math.sin(-d),f=0;f0){var g=this.expandPolygon(c,-u);v=this.joinLines(g)}else v=c;return r.pointInsidePolygonPoints(e,t,v)},r.joinLines=function(e){for(var t=new Array(e.length/2),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=0;c=0&&v<=1&&m.push(v),g>=0&&g<=1&&m.push(g),0===m.length)return[];var y=m[0]*s[0]+e,b=m[0]*s[1]+t;if(m.length>1){if(m[0]==m[1])return[y,b];return[y,b,m[1]*s[0]+e,m[1]*s[1]+t]}return[y,b]},r.findCircleNearPoint=function(e,t,n,r,i){var a=r-e,o=i-t,s=Math.sqrt(a*a+o*o);return[e+a/s*n,t+o/s*n]},r.findMaxSqDistanceToOrigin=function(e){for(var t=1e-6,n=void 0,r=0;rt&&(t=n);return t},r.midOfThree=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},r.finiteLinesIntersect=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,v=d*h-f*u,g=c*h-p*u,m=f*c-d*p;if(0!==m){var y=v/m,b=g/m;return-.001<=y&&y<=1.001&&-.001<=b&&b<=1.001?[e+y*c,t+y*p]:l?[e+y*c,t+y*p]:[]}return 0===v||0===g?this.midOfThree(e,n,o)===o?[o,s]:this.midOfThree(e,n,i)===i?[i,a]:this.midOfThree(i,o,n)===n?[n,r]:[]:[]},r.polygonIntersectLine=function(e,t,n,i,a,o,s,l){var u=[],c=void 0,d=new Array(n.length),h=!0;5===arguments.length&&(h=!1);var p=void 0;if(h){for(var f=0;f0){var v=r.expandPolygon(d,-l);p=r.joinLines(v)}else p=d}else p=n;for(var g=void 0,m=void 0,y=void 0,b=void 0,x=0;x "+t(r.target)),null!=r.connectedNodes){var h=r.connectedNodes;o=t(h[0])+" <-> "+t(h[1])}return null!=r.parent&&(o=t(r.parent)+" > "+o),null!=r.ancestor&&(o=t(r.ancestor)+" "+o),null!=r.child&&(o+=" > "+t(r.child)),null!=r.descendant&&(o+=" "+t(r.descendant)),o}(o),this.length>1&&e0&&i.plainObject(t[0])&&!i.element(t[0])){c=!0;for(var d=[],h=new o,p=0,f=t.length;p0){for(var R=new u(n,d),V=0;V0&&(e&&this.cy().notify({type:"remove",eles:E}),E.emit("remove"));for(var P=0;P=0;s--)!function(i){var s=o[i];c(a,function(e,t,n,r,a,l){if(s.type===n&&(!r||s.namespace===r)&&(!a||e.qualifierCompare(s.qualifier,a))&&(!l||s.callback===l))return o.splice(i,1),!1},e,t,n,r)}(s);return this},u.emit=u.trigger=function(e,t,n){var r=this.listeners,o=r.length;return this.emitting++,a.array(t)||(t=[t]),h(this,function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],o=r.length);for(var s=0;s0?d.wheelSensitivity:1,motionBlur:void 0!==d.motionBlur&&d.motionBlur,motionBlurOpacity:void 0===d.motionBlurOpacity?.05:d.motionBlurOpacity,pixelRatio:o.number(d.pixelRatio)&&d.pixelRatio>0?d.pixelRatio:void 0,desktopTapThreshold:void 0===d.desktopTapThreshold?4:d.desktopTapThreshold,touchTapThreshold:void 0===d.touchTapThreshold?8:d.touchTapThreshold},d.renderer));var v=function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(o.plainObject(e)||o.array(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.notify({type:"load",eles:t.mutableElements()}),t.one("load",n),t.emit("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var s=i.extend({},t._private.options.layout);s.eles=t.elements(),t.layout(s).run()};!function(e,t){if(e.some(o.promise))return s.all(e).then(t);t(e)}([d.style,d.elements],function(e){var n=e[0],r=e[1];p.styleEnabled&&t.style().append(n),v(r,function(){t.startAnimationLoop(),p.ready=!0,o.fn(d.ready)&&t.on("ready",d.ready);for(var e=0;e=0&&(e[r]!==t||(e.splice(r,1),n));r--);},a.clearArray=function(e){e.splice(0,e.length)},a.push=function(e,t){for(var n=0;n0?1:e<0?-1:0},r.dist=function(e,t){return Math.sqrt(r.sqdist(e,t))},r.sqdist=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},r.qbezierAt=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},r.qbezierPtAt=function(e,t,n,i){return{x:r.qbezierAt(e.x,t.x,n.x,i),y:r.qbezierAt(e.y,t.y,n.y,i)}},r.lineAt=function(e,t,n,i){var a={x:t.x-e.x,y:t.y-e.y},o=r.dist(e,t),s={x:a.x/o,y:a.y/o};return n=null==n?0:n,i=null!=i?i:n*o,{x:e.x+s.x*i,y:e.y+s.y*i}},r.lineAtDist=function(e,t,n){return r.lineAt(e,t,void 0,n)},r.triangleAngle=function(e,t,n){var i=r.dist(t,n),a=r.dist(e,n),o=r.dist(e,t);return Math.acos((i*i+a*a-o*o)/(2*i*a))},r.bound=function(e,t,n){return Math.max(e,Math.min(n,t))},r.makeBoundingBox=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}}},r.updateBoundingBox=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},r.expandBoundingBoxByPoint=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},r.expandBoundingBox=function(e,t){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},r.boundingBoxesIntersect=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},r.inBoundingBox=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},r.pointInBoundingBox=function(e,t){return this.inBoundingBox(e,t.x,t.y)},r.boundingBoxInBoundingBox=function(e,t){return r.inBoundingBox(e,t.x1,t.y1)&&r.inBoundingBox(e,t.x2,t.y2)},r.roundRectangleIntersectLine=function(e,t,n,r,i,a,o){var s=this.getRoundRectangleRadius(i,a),l=i/2,u=a/2,c=void 0,d=n-l+s-o,h=r-u-o,p=n+l-s+o,f=h;if(c=this.finiteLinesIntersect(e,t,n,r,d,h,p,f,!1),c.length>0)return c;var v=n+l+o,g=r-u+s-o,m=v,y=r+u-s+o;if(c=this.finiteLinesIntersect(e,t,n,r,v,g,m,y,!1),c.length>0)return c;var b=n-l+s-o,x=r+u+o,w=n+l-s+o,E=x;if(c=this.finiteLinesIntersect(e,t,n,r,b,x,w,E,!1),c.length>0)return c;var P=n-l-o,T=r-u+s-o,C=P,S=r+u-s+o;if(c=this.finiteLinesIntersect(e,t,n,r,P,T,C,S,!1),c.length>0)return c;var D=void 0,k=n-l+s,_=r-u+s;if(D=this.intersectLineCircle(e,t,n,r,k,_,s+o),D.length>0&&D[0]<=k&&D[1]<=_)return[D[0],D[1]];var M=n+l-s,I=r-u+s;if(D=this.intersectLineCircle(e,t,n,r,M,I,s+o),D.length>0&&D[0]>=M&&D[1]<=I)return[D[0],D[1]];var N=n+l-s,B=r+u-s;if(D=this.intersectLineCircle(e,t,n,r,N,B,s+o),D.length>0&&D[0]>=N&&D[1]>=B)return[D[0],D[1]];var z=n-l+s,L=r+u-s;return D=this.intersectLineCircle(e,t,n,r,z,L,s+o),D.length>0&&D[0]<=z&&D[1]>=L?[D[0],D[1]]:[]},r.inLineVicinity=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),d=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},r.inBezierVicinity=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!(eu.x2||tu.y2)},r.solveQuadratic=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;return[(-t+a)/o,(-t-a)/o]},r.solveCubic=function(e,t,n,r,i){t/=e,n/=e,r/=e;var a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=void 0,d=void 0,h=void 0;return 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,d=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]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,void(i[5]=-d)):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,void(i[4]=i[2]=-(h+d))):(o=-o,l=o*o*o,l=Math.acos(s/Math.sqrt(l)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),void(i[4]=-d+h*Math.cos((l+4*Math.PI)/3))))},r.sqdistToQuadraticBezier=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,d=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,h=[];this.solveCubic(l,u,c,d,h);for(var p=[],f=0;f<6;f+=2)Math.abs(h[f+1])<1e-7&&h[f]>=0&&h[f]<=1&&p.push(h[f]);p.push(1),p.push(0);for(var v=-1,g=void 0,m=void 0,y=void 0,b=0;b=0?yl?(e-i)*(e-i)+(t-a)*(t-a):u-d},r.pointInsidePolygonPoints=function(e,t,n){for(var r=void 0,i=void 0,a=void 0,o=void 0,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},r.pointInsidePolygon=function(e,t,n,i,a,o,s,l,u){var c=new Array(n.length),d=void 0;null!=l[0]?(d=Math.atan(l[1]/l[0]),l[0]<0?d+=Math.PI/2:d=-d-Math.PI/2):d=l;for(var h=Math.cos(-d),p=Math.sin(-d),f=0;f0){var g=this.expandPolygon(c,-u);v=this.joinLines(g)}else v=c;return r.pointInsidePolygonPoints(e,t,v)},r.joinLines=function(e){for(var t=new Array(e.length/2),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=0;c=0&&v<=1&&m.push(v),g>=0&&g<=1&&m.push(g),0===m.length)return[];var y=m[0]*s[0]+e,b=m[0]*s[1]+t;if(m.length>1){if(m[0]==m[1])return[y,b];return[y,b,m[1]*s[0]+e,m[1]*s[1]+t]}return[y,b]},r.findCircleNearPoint=function(e,t,n,r,i){var a=r-e,o=i-t,s=Math.sqrt(a*a+o*o);return[e+a/s*n,t+o/s*n]},r.findMaxSqDistanceToOrigin=function(e){for(var t=1e-6,n=void 0,r=0;rt&&(t=n);return t},r.midOfThree=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},r.finiteLinesIntersect=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,p=r-t,f=s-a,v=d*h-f*u,g=c*h-p*u,m=f*c-d*p;if(0!==m){var y=v/m,b=g/m;return-.001<=y&&y<=1.001&&-.001<=b&&b<=1.001?[e+y*c,t+y*p]:l?[e+y*c,t+y*p]:[]}return 0===v||0===g?this.midOfThree(e,n,o)===o?[o,s]:this.midOfThree(e,n,i)===i?[i,a]:this.midOfThree(i,o,n)===n?[n,r]:[]:[]},r.polygonIntersectLine=function(e,t,n,i,a,o,s,l){var u=[],c=void 0,d=new Array(n.length),h=!0;5===arguments.length&&(h=!1);var p=void 0;if(h){for(var f=0;f0){var v=r.expandPolygon(d,-l);p=r.joinLines(v)}else p=d}else p=n;for(var g=void 0,m=void 0,y=void 0,b=void 0,x=0;x "+t(r.target)),null!=r.connectedNodes){var h=r.connectedNodes;o=t(h[0])+" <-> "+t(h[1])}return null!=r.parent&&(o=t(r.parent)+" > "+o),null!=r.ancestor&&(o=t(r.ancestor)+" "+o),null!=r.child&&(o+=" > "+t(r.child)),null!=r.descendant&&(o+=" "+t(r.descendant)),o}(o),this.length>1&&e0&&i.plainObject(t[0])&&!i.element(t[0])){c=!0;for(var d=[],h=new o,p=0,f=t.length;p0){for(var R=new u(n,d),V=0;V0&&(e&&this.cy().notify({type:"remove",eles:E}),E.emit("remove"));for(var P=0;P=0;s--)!function(i){var s=o[i];c(a,function(e,t,n,r,a,l){if(s.type===n&&(!r||s.namespace===r)&&(!a||e.qualifierCompare(s.qualifier,a))&&(!l||s.callback===l))return o.splice(i,1),!1},e,t,n,r)}(s);return this},u.emit=u.trigger=function(e,t,n){var r=this.listeners,o=r.length;return this.emitting++,a.array(t)||(t=[t]),h(this,function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],o=r.length);for(var s=0;s0?d.wheelSensitivity:1,motionBlur:void 0!==d.motionBlur&&d.motionBlur,motionBlurOpacity:void 0===d.motionBlurOpacity?.05:d.motionBlurOpacity,pixelRatio:o.number(d.pixelRatio)&&d.pixelRatio>0?d.pixelRatio:void 0,desktopTapThreshold:void 0===d.desktopTapThreshold?4:d.desktopTapThreshold,touchTapThreshold:void 0===d.touchTapThreshold?8:d.touchTapThreshold},d.renderer));var v=function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(o.plainObject(e)||o.array(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.notify({type:"load",eles:t.mutableElements()}),t.one("load",n),t.emit("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var s=i.extend({},t._private.options.layout);s.eles=t.elements(),t.layout(s).run()};!function(e,t){if(e.some(o.promise))return s.all(e).then(t);t(e)}([d.style,d.elements],function(e){var n=e[0],r=e[1];p.styleEnabled&&t.style().append(n),v(r,function(){t.startAnimationLoop(),p.ready=!0,o.fn(d.ready)&&t.on("ready",d.ready);for(var e=0;e=e.deqFastCost*g)break}else if(a){if(f>=e.deqCost*u||f>=e.deqAvgCost*l)break}else if(v>=e.deqNoDrawCost*(1e3/60))break;var m=e.deq(t,h,d);if(!(m.length>0))break;for(var y=0;y0&&(e.onDeqd(t,c),!a&&e.shouldRedraw(t,c,h,d)&&i())},o=e.priority||r.noop;n.beforeRender(a,o(t))}}}}},function(e,t,n){"use strict";var r=n(1),i=[{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:":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 r.sort.descending(e.selector,t.selector)}),a=function e(t,n){return(e.lookup=e.lookup||function(){for(var e={},t=void 0,n=0;n0;){var y=function(e,t){if(0!==e.length){for(var n=0,r=t[e[0]],i=1;ic&&(c=t)},get:function(e){return u[e]}},h=0;h0?C.edgesTo(T)[0]:T.edgesTo(C)[0];var S=n(P);T=T.id(),x[T]>x[p]+S&&(x[T]=x[p]+S,w.nodes.indexOf(T)<0?w.push(T):w.updateItem(T),b[T]=0,y[T]=[]),x[T]==x[p]+S&&(b[T]=b[T]+b[p],y[T].push(p))}else for(var E=0;E0;)for(var T=m.pop(),E=0;E0;){var m=f.pop(),y=p(m),b=m.id();if(c[b]=y,y!==1/0)for(var x=m.neighborhood().intersect(h),v=0;v0)for(n.unshift(t);u[i.id()];){var a=u[i.id()];n.unshift(a.edge),n.unshift(a.node),i=a.node}return o.collection(n)}}}};e.exports=a},function(e,t,n){"use strict";var r=n(0),i={floydWarshall:function(e){e=e||{};var t=this.cy();if(null!=e.weight&&r.fn(e.weight))var n=e.weight;else var n=function(e){return 1};if(null!=e.directed)var i=e.directed;else var i=!1;for(var a=this.edges().stdFilter(function(e){return!e.isLoop()}),o=this.nodes(),s=o.length,l={},u=0;uy&&(c[g][m]=y,p[g][m]=m,f[g][m]=a[u])}if(!i)for(var u=0;uy&&(c[g][m]=y,p[g][m]=m,f[g][m]=a[u])}for(var b=0;b0&&this.spawn(n).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){for(var n=e.match(/\S+/g)||[],r=this,i=[],a=0,o=r.length;a0&&this.spawn(i).updateStyle().emit("class"),r},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}};e.exports=i},function(e,t,n){"use strict";var r=(n(0),n(6)),i={allAre:function(e){var t=new r(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new r(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n0;){var d=i.shift();t(d),a.add(d.id()),l&&r(i,a,d)}return e}function i(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1],i)},l.forEachUp=function(e){return r(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a)},l.forEachUpAndDown=function(e){return r(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o)},l.ancestors=l.parents,e.exports=l},function(e,t,n){"use strict";var r=n(3),i=void 0,a=void 0;i=a={data:r.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:r.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:r.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:r.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:r.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:r.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},i.attr=i.data,i.removeAttr=i.removeData,e.exports=a},function(e,t,n){"use strict";function r(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;ot}),minIndegree:i("indegree",function(e,t){return et}),minOutdegree:i("outdegree",function(e,t){return et})}),a.extend(o,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}if(e.isParent()){var r=e._private,i=e.children(),a="include"===e.pstyle("compound-sizing-wrt-labels").value,o={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")}},s=i.boundingBox({includeLabels:a,includeOverlays:!1,useCache:!1}),l=r.position;0!==s.w&&0!==s.h||(s={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue},s.x1=l.x-s.w/2,s.x2=l.x+s.w/2,s.y1=l.y-s.h/2,s.y2=l.y+s.h/2);var u=o.width.left.value;"px"===o.width.left.units&&o.width.val>0&&(u=100*u/o.width.val);var c=o.width.right.value;"px"===o.width.right.units&&o.width.val>0&&(c=100*c/o.width.val);var d=o.height.top.value;"px"===o.height.top.units&&o.height.val>0&&(d=100*d/o.height.val);var h=o.height.bottom.value;"px"===o.height.bottom.units&&o.height.val>0&&(h=100*h/o.height.val);var p=n(o.width.val-s.w,u,c),f=p.biasDiff,v=p.biasComplementDiff,g=n(o.height.val-s.h,d,h),m=g.biasDiff,y=g.biasComplementDiff;r.autoPadding=function(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}}(s.w,s.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),r.autoWidth=Math.max(s.w,o.width.val),l.x=(-f+s.x1+s.x2+v)/2,r.autoHeight=Math.max(s.h,o.height.val),l.y=(-m+s.y1+s.y2+y)/2,t.push(e)}}(r),e._private.batchingStyle||(i.compoundBoundsClean=!0))}return this};var u=function(e){return e===1/0||e===-1/0?0:e},c=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=te.x2?r:e.x2,e.y1=ne.y2?i:e.y2)},d=function(e,t){return c(e,t.x1,t.y1,t.x2,t.y2)},h=function(e,t,n){return a.getPrefixedProperty(e,t,n)},p=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,a=i.arrowWidth/2,o=t.pstyle(n+"-arrow-shape").value,s=void 0,l=void 0;"none"!==o&&("source"===n?(s=i.srcX,l=i.srcY):"target"===n?(s=i.tgtX,l=i.tgtY):(s=i.midX,l=i.midY),c(e,s-a,l-a,s+a,l+a))}},f=function(e,t,n){if(!t.cy().headless()){var r=void 0;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o=t.pstyle("text-halign"),s=t.pstyle("text-valign"),l=h(a,"labelWidth",n),u=h(a,"labelHeight",n),d=h(a,"labelX",n),p=h(a,"labelY",n),f=t.pstyle(r+"text-margin-x").pfValue,v=t.pstyle(r+"text-margin-y").pfValue,g=t.isEdge(),m=t.pstyle(r+"text-rotation"),y=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,x=b/2,w=t.pstyle("text-background-padding").pfValue,E=u+2*w,P=l+2*w,T=P/2,C=E/2,S=void 0,D=void 0,k=void 0,_=void 0;if(g)S=d-T,D=d+T,k=p-C,_=p+C;else{switch(o.value){case"left":S=d-P,D=d;break;case"center":S=d-T,D=d+T;break;case"right":S=d,D=d+P}switch(s.value){case"top":k=p-E,_=p;break;case"center":k=p-C,_=p+C;break;case"bottom":k=p,_=p+E}}var M=g&&"autorotate"===m.strValue,I=null!=m.pfValue&&0!==m.pfValue;if(M||I){var N=M?h(i.rstyle,"labelAngle",n):m.pfValue,B=Math.cos(N),z=Math.sin(N),L=function(e,t){return e-=d,t-=p,{x:e*B-t*z+d,y:e*z+t*B+p}},A=L(S,k),O=L(S,_),R=L(D,k),V=L(D,_);S=Math.min(A.x,O.x,R.x,V.x),D=Math.max(A.x,O.x,R.x,V.x),k=Math.min(A.y,O.y,R.y,V.y),_=Math.max(A.y,O.y,R.y,V.y)}S+=f-Math.max(y,x),D+=f+Math.max(y,x),k+=v-Math.max(y,x),_+=v+Math.max(y,x),c(e,S,k,D,_)}return e}},v=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},s=e._private,l=r?e.pstyle("display").value:"element",d=e.isNode(),h=e.isEdge(),v=void 0,g=void 0,m=void 0,y=void 0,b=void 0,x=void 0,w="none"!==l;if(w){var E=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(E=e.pstyle("overlay-padding").value);var P=0,T=0;if(r&&(P=e.pstyle("width").pfValue,T=P/2),d&&t.includeNodes){var C=e.position();b=C.x,x=C.y;var S=e.outerWidth(),D=S/2,k=e.outerHeight(),_=k/2;v=b-D-E,g=b+D+E,m=x-_-E,y=x+_+E,c(a,v,m,g,y)}else if(h&&t.includeEdges){var M=s.rstyle||{};if(r&&!i&&(v=Math.min(M.srcX,M.midX,M.tgtX),g=Math.max(M.srcX,M.midX,M.tgtX),m=Math.min(M.srcY,M.midY,M.tgtY),y=Math.max(M.srcY,M.midY,M.tgtY),v-=T,g+=T,m-=T,y+=T,c(a,v,m,g,y)),r&&!i&&"haystack"===e.pstyle("curve-style").strValue){var I=M.haystackPts||[];if(v=I[0].x,m=I[0].y,g=I[1].x,y=I[1].y,v>g){var N=v;v=g,g=N}if(m>y){var B=m;m=y,y=B}c(a,v-T,m-T,g+T,y+T)}else{for(var z=M.bezierPts||M.linePts||[],L=0;Lg){var F=v;v=g,g=F}if(m>y){var j=m;m=y,y=j}v-=T,g+=T,m-=T,y+=T,c(a,v,m,g,y)}}}if(r&&t.includeEdges&&h&&(p(a,e,"mid-source"),p(a,e,"mid-target"),p(a,e,"source"),p(a,e,"target")),r){if("yes"===e.pstyle("ghost").value){var X=e.pstyle("ghost-offset-x").pfValue,Y=e.pstyle("ghost-offset-y").pfValue;c(a,a.x1+X,a.y1+Y,a.x2+X,a.y2+Y)}}r&&(v=a.x1,g=a.x2,m=a.y1,y=a.y2,c(a,v-E,m-E,g+E,y+E)),r&&t.includeLabels&&(f(a,e,null),h&&(f(a,e,"source"),f(a,e,"target")))}return a.x1=u(a.x1),a.y1=u(a.y1),a.x2=u(a.x2),a.y2=u(a.y2),a.w=u(a.x2-a.x1),a.h=u(a.y2-a.y1),a.w>0&&a.h>0&&w&&o.expandBoundingBox(a,1),a},g=function(e){return e?"t":"f"},m=function(e){var t="";return t+=g(e.incudeNodes),t+=g(e.includeEdges),t+=g(e.includeLabels),t+=g(e.includeOverlays)},y=function(e,t){var n=e._private,r=void 0,i=e.cy().headless(),a=t===b?x:m(t);return t.useCache&&!i&&n.bbCache&&n.bbCache[a]?r=n.bbCache[a]:(r=v(e,t),i||(n.bbCache=n.bbCache||{},n.bbCache[a]=r)),r},b={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeOverlays:!0,useCache:!0},x=m(b);l.boundingBox=function(e){if(1===this.length&&this[0]._private.bbCache&&(void 0===e||void 0===e.useCache||!0===e.useCache))return e=void 0===e?b:r(e),y(this[0],e);var t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};e=e||a.staticEmptyObject();var n=r(e),i=this,o=i.cy(),s=o.styleEnabled();s&&this.recalculateRenderedStyle(n.useCache),this.updateCompoundBounds();for(var l={},c=0;c0,d=c;c&&(u=u[0]);var h=d?u.position():{x:0,y:0};return a={x:l.x-h.x,y:l.y-h.y},void 0===e?a:a[e]}for(var p=0;p0,m=g;g&&(v=v[0]);var y=m?v.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==a&&f.position({x:a.x+y.x,y:a.y+y.y})}}else if(!o)return;return this}},o.modelPosition=o.point=o.position,o.modelPositions=o.points=o.positions,o.renderedPoint=o.renderedPosition,o.relativePoint=o.relativePosition,e.exports=s},function(e,t,n){"use strict";var r=n(1),i=void 0,a=void 0;i=a={};var o=function(e){e.uppercaseName=r.capitalize(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=r.capitalize(e.outerName),i[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}}},i["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private,r=n.cy,i=r._private.styleEnabled;if(t){if(i){return t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding()}return 1}},i["rendered"+e.uppercaseName]=function(){var t=this[0];if(t){return t[e.name]()*this.cy().zoom()}},i["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t){return t[e.outerName]()*this.cy().zoom()}}};o({name:"width"}),o({name:"height"}),a.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},e.exports=a},function(e,t,n){"use strict";var r=n(10),i=n(3),a=n(0),o=n(1),s=n(6),l={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&&a.element(n.target)&&r.matches(n.target)},eventFields:function(e){return{cy:e.cy(),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()}},u=function(e){return a.string(e)?new s(e):e},c={createEmitter:function(){for(var e=0;e1&&!o){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[a]=l,r.set(u,{ele:l,index:a})}return this.length--,this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&r.string(e)){var n=e;e=t.mutableElements().filter(n)}for(var i=0;in&&(n=s,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r=void 0,i=this,a=0;a=0&&i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,{unique:!0}).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),l.neighbourhood=l.neighborhood,l.closedNeighbourhood=l.closedNeighborhood,l.openNeighbourhood=l.openNeighborhood,o.extend(l,{source:u(function(e){var t=this[0],n=void 0;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:u(function(e){var t=this[0],n=void 0;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:r({attr:"source"}),targets:r({attr:"target"})}),o.extend(l,{edgesWith:u(i(),"edgesWith"),edgesTo:u(i({thisIsSrc:!0}),"edgesTo")}),o.extend(l,{connectedEdges:u(function(e){for(var t=[],n=this,r=0;r0);return i.map(function(e){var t=e.connectedEdges().stdFilter(function(t){return e.anySame(t.source())&&e.anySame(t.target())});return e.union(t)})}}),e.exports=l},function(e,t,n){"use strict";var r=n(0),i=n(1),a=n(7),o=n(13),s={add:function(e){var t=void 0,n=this;if(r.elementOrCollection(e)){var s=e;if(s._private.cy===n)t=s.restore();else{for(var l=[],u=0;u=e.deqFastCost*g)break}else if(a){if(f>=e.deqCost*u||f>=e.deqAvgCost*l)break}else if(v>=e.deqNoDrawCost*(1e3/60))break;var m=e.deq(t,h,d);if(!(m.length>0))break;for(var y=0;y0&&(e.onDeqd(t,c),!a&&e.shouldRedraw(t,c,h,d)&&i())},o=e.priority||r.noop;n.beforeRender(a,o(t))}}}}},function(e,t,n){"use strict";var r=n(1),i=[{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:":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 r.sort.descending(e.selector,t.selector)}),a=function e(t,n){return(e.lookup=e.lookup||function(){for(var e={},t=void 0,n=0;n0;){var y=function(e,t){if(0!==e.length){for(var n=0,r=t[e[0]],i=1;ic&&(c=t)},get:function(e){return u[e]}},h=0;h0?C.edgesTo(T)[0]:T.edgesTo(C)[0];var S=n(P);T=T.id(),x[T]>x[p]+S&&(x[T]=x[p]+S,w.nodes.indexOf(T)<0?w.push(T):w.updateItem(T),b[T]=0,y[T]=[]),x[T]==x[p]+S&&(b[T]=b[T]+b[p],y[T].push(p))}else for(var E=0;E0;)for(var T=m.pop(),E=0;E0;){var m=f.pop(),y=p(m),b=m.id();if(c[b]=y,y!==1/0)for(var x=m.neighborhood().intersect(h),v=0;v0)for(n.unshift(t);u[i.id()];){var a=u[i.id()];n.unshift(a.edge),n.unshift(a.node),i=a.node}return o.collection(n)}}}};e.exports=a},function(e,t,n){"use strict";var r=n(0),i={floydWarshall:function(e){e=e||{};var t=this.cy();if(null!=e.weight&&r.fn(e.weight))var n=e.weight;else var n=function(e){return 1};if(null!=e.directed)var i=e.directed;else var i=!1;for(var a=this.edges().stdFilter(function(e){return!e.isLoop()}),o=this.nodes(),s=o.length,l={},u=0;uy&&(c[g][m]=y,p[g][m]=m,f[g][m]=a[u])}if(!i)for(var u=0;uy&&(c[g][m]=y,p[g][m]=m,f[g][m]=a[u])}for(var b=0;b0&&this.spawn(n).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){for(var n=e.match(/\S+/g)||[],r=this,i=[],a=0,o=r.length;a0&&this.spawn(i).updateStyle().emit("class"),r},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}};e.exports=i},function(e,t,n){"use strict";var r=(n(0),n(6)),i={allAre:function(e){var t=new r(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new r(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n0;){var d=i.shift();t(d),a.add(d.id()),l&&r(i,a,d)}return e}function i(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1],i)},l.forEachUp=function(e){return r(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a)},l.forEachUpAndDown=function(e){return r(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o)},l.ancestors=l.parents,e.exports=l},function(e,t,n){"use strict";var r=n(3),i=void 0,a=void 0;i=a={data:r.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:r.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:r.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:r.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:r.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:r.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},i.attr=i.data,i.removeAttr=i.removeData,e.exports=a},function(e,t,n){"use strict";function r(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;ot}),minIndegree:i("indegree",function(e,t){return et}),minOutdegree:i("outdegree",function(e,t){return et})}),a.extend(o,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}if(e.isParent()){var r=e._private,i=e.children(),a="include"===e.pstyle("compound-sizing-wrt-labels").value,o={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")}},s=i.boundingBox({includeLabels:a,includeOverlays:!1,useCache:!1}),l=r.position;0!==s.w&&0!==s.h||(s={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue},s.x1=l.x-s.w/2,s.x2=l.x+s.w/2,s.y1=l.y-s.h/2,s.y2=l.y+s.h/2);var u=o.width.left.value;"px"===o.width.left.units&&o.width.val>0&&(u=100*u/o.width.val);var c=o.width.right.value;"px"===o.width.right.units&&o.width.val>0&&(c=100*c/o.width.val);var d=o.height.top.value;"px"===o.height.top.units&&o.height.val>0&&(d=100*d/o.height.val);var h=o.height.bottom.value;"px"===o.height.bottom.units&&o.height.val>0&&(h=100*h/o.height.val);var p=n(o.width.val-s.w,u,c),f=p.biasDiff,v=p.biasComplementDiff,g=n(o.height.val-s.h,d,h),m=g.biasDiff,y=g.biasComplementDiff;r.autoPadding=function(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}}(s.w,s.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),r.autoWidth=Math.max(s.w,o.width.val),l.x=(-f+s.x1+s.x2+v)/2,r.autoHeight=Math.max(s.h,o.height.val),l.y=(-m+s.y1+s.y2+y)/2,t.push(e)}}(r),e._private.batchingStyle||(i.compoundBoundsClean=!0))}return this};var u=function(e){return e===1/0||e===-1/0?0:e},c=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=te.x2?r:e.x2,e.y1=ne.y2?i:e.y2)},d=function(e,t){return c(e,t.x1,t.y1,t.x2,t.y2)},h=function(e,t,n){return a.getPrefixedProperty(e,t,n)},p=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,a=i.arrowWidth/2,o=t.pstyle(n+"-arrow-shape").value,s=void 0,l=void 0;"none"!==o&&("source"===n?(s=i.srcX,l=i.srcY):"target"===n?(s=i.tgtX,l=i.tgtY):(s=i.midX,l=i.midY),c(e,s-a,l-a,s+a,l+a))}},f=function(e,t,n){if(!t.cy().headless()){var r=void 0;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o=t.pstyle("text-halign"),s=t.pstyle("text-valign"),l=h(a,"labelWidth",n),u=h(a,"labelHeight",n),d=h(a,"labelX",n),p=h(a,"labelY",n),f=t.pstyle(r+"text-margin-x").pfValue,v=t.pstyle(r+"text-margin-y").pfValue,g=t.isEdge(),m=t.pstyle(r+"text-rotation"),y=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,x=b/2,w=t.pstyle("text-background-padding").pfValue,E=u+2*w,P=l+2*w,T=P/2,C=E/2,S=void 0,D=void 0,k=void 0,_=void 0;if(g)S=d-T,D=d+T,k=p-C,_=p+C;else{switch(o.value){case"left":S=d-P,D=d;break;case"center":S=d-T,D=d+T;break;case"right":S=d,D=d+P}switch(s.value){case"top":k=p-E,_=p;break;case"center":k=p-C,_=p+C;break;case"bottom":k=p,_=p+E}}var M=g&&"autorotate"===m.strValue,I=null!=m.pfValue&&0!==m.pfValue;if(M||I){var N=M?h(i.rstyle,"labelAngle",n):m.pfValue,B=Math.cos(N),z=Math.sin(N),L=function(e,t){return e-=d,t-=p,{x:e*B-t*z+d,y:e*z+t*B+p}},A=L(S,k),O=L(S,_),R=L(D,k),V=L(D,_);S=Math.min(A.x,O.x,R.x,V.x),D=Math.max(A.x,O.x,R.x,V.x),k=Math.min(A.y,O.y,R.y,V.y),_=Math.max(A.y,O.y,R.y,V.y)}S+=f-Math.max(y,x),D+=f+Math.max(y,x),k+=v-Math.max(y,x),_+=v+Math.max(y,x),c(e,S,k,D,_)}return e}},v=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0},s=e._private,l=r?e.pstyle("display").value:"element",d=e.isNode(),h=e.isEdge(),v=void 0,g=void 0,m=void 0,y=void 0,b=void 0,x=void 0,w="none"!==l;if(w){var E=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(E=e.pstyle("overlay-padding").value);var P=0,T=0;if(r&&(P=e.pstyle("width").pfValue,T=P/2),d&&t.includeNodes){var C=e.position();b=C.x,x=C.y;var S=e.outerWidth(),D=S/2,k=e.outerHeight(),_=k/2;v=b-D-E,g=b+D+E,m=x-_-E,y=x+_+E,c(a,v,m,g,y)}else if(h&&t.includeEdges){var M=s.rstyle||{};if(r&&!i&&(v=Math.min(M.srcX,M.midX,M.tgtX),g=Math.max(M.srcX,M.midX,M.tgtX),m=Math.min(M.srcY,M.midY,M.tgtY),y=Math.max(M.srcY,M.midY,M.tgtY),v-=T,g+=T,m-=T,y+=T,c(a,v,m,g,y)),r&&!i&&"haystack"===e.pstyle("curve-style").strValue){var I=M.haystackPts||[];if(v=I[0].x,m=I[0].y,g=I[1].x,y=I[1].y,v>g){var N=v;v=g,g=N}if(m>y){var B=m;m=y,y=B}c(a,v-T,m-T,g+T,y+T)}else{for(var z=M.bezierPts||M.linePts||[],L=0;Lg){var F=v;v=g,g=F}if(m>y){var j=m;m=y,y=j}v-=T,g+=T,m-=T,y+=T,c(a,v,m,g,y)}}}if(r&&t.includeEdges&&h&&(p(a,e,"mid-source"),p(a,e,"mid-target"),p(a,e,"source"),p(a,e,"target")),r){if("yes"===e.pstyle("ghost").value){var X=e.pstyle("ghost-offset-x").pfValue,Y=e.pstyle("ghost-offset-y").pfValue;c(a,a.x1+X,a.y1+Y,a.x2+X,a.y2+Y)}}r&&(v=a.x1,g=a.x2,m=a.y1,y=a.y2,c(a,v-E,m-E,g+E,y+E)),r&&t.includeLabels&&(f(a,e,null),h&&(f(a,e,"source"),f(a,e,"target")))}return a.x1=u(a.x1),a.y1=u(a.y1),a.x2=u(a.x2),a.y2=u(a.y2),a.w=u(a.x2-a.x1),a.h=u(a.y2-a.y1),a.w>0&&a.h>0&&w&&o.expandBoundingBox(a,1),a},g=function(e){return e?"t":"f"},m=function(e){var t="";return t+=g(e.incudeNodes),t+=g(e.includeEdges),t+=g(e.includeLabels),t+=g(e.includeOverlays)},y=function(e,t){var n=e._private,r=void 0,i=e.cy().headless(),a=t===b?x:m(t);return t.useCache&&!i&&n.bbCache&&n.bbCache[a]?r=n.bbCache[a]:(r=v(e,t),i||(n.bbCache=n.bbCache||{},n.bbCache[a]=r)),r},b={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeOverlays:!0,useCache:!0},x=m(b);l.boundingBox=function(e){if(1===this.length&&this[0]._private.bbCache&&(void 0===e||void 0===e.useCache||!0===e.useCache))return e=void 0===e?b:r(e),y(this[0],e);var t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};e=e||a.staticEmptyObject();var n=r(e),i=this,o=i.cy(),s=o.styleEnabled();s&&this.recalculateRenderedStyle(n.useCache),this.updateCompoundBounds();for(var l={},c=0;c0,d=c;c&&(u=u[0]);var h=d?u.position():{x:0,y:0};return a={x:l.x-h.x,y:l.y-h.y},void 0===e?a:a[e]}for(var p=0;p0,m=g;g&&(v=v[0]);var y=m?v.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==a&&f.position({x:a.x+y.x,y:a.y+y.y})}}else if(!o)return;return this}},o.modelPosition=o.point=o.position,o.modelPositions=o.points=o.positions,o.renderedPoint=o.renderedPosition,o.relativePoint=o.relativePosition,e.exports=s},function(e,t,n){"use strict";var r=n(1),i=void 0,a=void 0;i=a={};var o=function(e){e.uppercaseName=r.capitalize(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=r.capitalize(e.outerName),i[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}}},i["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private,r=n.cy,i=r._private.styleEnabled;if(t){if(i){return t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding()}return 1}},i["rendered"+e.uppercaseName]=function(){var t=this[0];if(t){return t[e.name]()*this.cy().zoom()}},i["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t){return t[e.outerName]()*this.cy().zoom()}}};o({name:"width"}),o({name:"height"}),a.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},e.exports=a},function(e,t,n){"use strict";var r=n(10),i=n(3),a=n(0),o=n(1),s=n(6),l={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&&a.element(n.target)&&r.matches(n.target)},eventFields:function(e){return{cy:e.cy(),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()}},u=function(e){return a.string(e)?new s(e):e},c={createEmitter:function(){for(var e=0;e1&&!o){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[a]=l,r.set(u,{ele:l,index:a})}return this.length--,this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&r.string(e)){var n=e;e=t.mutableElements().filter(n)}for(var i=0;in&&(n=s,r=o)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r=void 0,i=this,a=0;a=0&&i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,{unique:!0}).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),l.neighbourhood=l.neighborhood,l.closedNeighbourhood=l.closedNeighborhood,l.openNeighbourhood=l.openNeighborhood,o.extend(l,{source:u(function(e){var t=this[0],n=void 0;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:u(function(e){var t=this[0],n=void 0;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:r({attr:"source"}),targets:r({attr:"target"})}),o.extend(l,{edgesWith:u(i(),"edgesWith"),edgesTo:u(i({thisIsSrc:!0}),"edgesTo")}),o.extend(l,{connectedEdges:u(function(e){for(var t=[],n=this,r=0;r0);return i.map(function(e){var t=e.connectedEdges().stdFilter(function(t){return e.anySame(t.source())&&e.anySame(t.target())});return e.union(t)})}}),e.exports=l},function(e,t,n){"use strict";var r=n(0),i=n(1),a=n(7),o=n(13),s={add:function(e){var t=void 0,n=this;if(r.elementOrCollection(e)){var s=e;if(s._private.cy===n)t=s.restore();else{for(var l=[],u=0;u0?i=o:r=o}while(Math.abs(a)>g&&++l=v?u(t,s):0===c?s:d(t,r,r+b)}function p(){P=!0,e===t&&n===r||c()}var f=4,v=.001,g=1e-7,m=10,y=11,b=1/(y-1),x="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var w=0;w<4;++w)if("number"!=typeof arguments[w]||isNaN(arguments[w])||!isFinite(arguments[w]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var E=x?new Float32Array(y):new Array(y),P=!1,T=function(i){return P||p(),e===t&&n===r?i:0===i?0:1===i?1:s(h(i),t,r)};T.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var C="generateBezier("+[e,t,n,r]+")";return T.toString=function(){return C},T}e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,i){if(1===r)return n;var a=i(t,n,r);return null==e?a:((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 i(e,t,n,i,o){var s=null!=o?o.type:null;n<0?n=0:n>1&&(n=1);var l=void 0,u=void 0;if(l=null!=e.pfValue||null!=e.value?null!=e.pfValue?e.pfValue:e.value:e,u=null!=t.pfValue||null!=t.value?null!=t.pfValue?t.pfValue:t.value:t,a.number(l)&&a.number(u))return r(s,l,u,n,i);if(a.array(l)&&a.array(u)){for(var c=[],d=0;d1e-4&&Math.abs(c.v)>1e-4;);return l?function(e){return o[e*(o.length-1)|0]}:s}}();e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){var i=!r,a=e,o=t._private,s=r?e:e.cy(),l=s.style();if(i){var u=a.position();o.startPosition=o.startPosition||{x:u.x,y:u.y},o.startStyle=o.startStyle||l.getAnimationStartStyle(a,o.style)}if(r){var c=s._private.pan;o.startPan=o.startPan||{x:c.x,y:c.y},o.startZoom=null!=o.startZoom?o.startZoom:s._private.zoom}o.started=!0,o.startTime=n-o.progress*o.duration}e.exports=r},function(e,t,n){"use strict";function r(e,t){function n(t,n){var r=t._private,s=r.animation.current,l=r.animation.queue,u=!1;if(!n&&"none"===t.pstyle("display").value){s=s.splice(0,s.length).concat(l.splice(0,l.length));for(var c=0;c=0;t--){(0,e[t])()}e.splice(0,e.length)},p=s.length-1;p>=0;p--){var f=s[p],v=f._private;v.stopped?(s.splice(p,1),v.hooked=!1,v.playing=!1,v.started=!1,h(v.frames)):(v.playing||v.applying)&&(v.playing&&v.applying&&(v.applying=!1),v.started||a(t,f,e,n),i(t,f,e,n),v.applying&&(v.applying=!1),h(v.frames),f.completed()&&(s.splice(p,1),v.hooked=!1,v.playing=!1,v.started=!1,h(v.completes)),u=!0)}return n||0!==s.length||0!==l.length||o.push(t),u}for(var r=t._private.aniEles,o=[],s=!1,l=0;l0?(r.dirtyCompoundBoundsCache(),t.notify({type:"draw",eles:r})):t.notify({type:"draw"})),r.unmerge(o),t.emit("step")}var i=n(64),a=n(62);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){var l=!r,u=e._private,c=t._private,d=c.easing,h=c.startTime,p=r?e:e.cy(),f=p.style();if(!c.easingImpl)if(null==d)c.easingImpl=a.linear;else{var v=void 0;if(s.string(d)){var g=f.parse("transition-timing-function",d);v=g.value}else v=d;var m=void 0,y=void 0;s.string(v)?(m=v,y=[]):(m=v[1],y=v.slice(2).map(function(e){return+e})),y.length>0?("spring"===m&&y.push(c.duration),c.easingImpl=a[m].apply(null,y)):c.easingImpl=a[m]}var b=c.easingImpl,x=void 0;if(x=0===c.duration?1:(n-h)/c.duration,c.applying&&(x=c.progress),x<0?x=0:x>1&&(x=1),null==c.delay){var w=c.startPosition,E=c.position;if(E&&l&&!e.locked()){var P=e.position();i(w.x,E.x)&&(P.x=o(w.x,E.x,x,b)),i(w.y,E.y)&&(P.y=o(w.y,E.y,x,b)),e.emit("position")}var T=c.startPan,C=c.pan,S=u.pan,D=null!=C&&r;D&&(i(T.x,C.x)&&(S.x=o(T.x,C.x,x,b)),i(T.y,C.y)&&(S.y=o(T.y,C.y,x,b)),e.emit("pan"));var k=c.startZoom,_=c.zoom,M=null!=_&&r;M&&(i(k,_)&&(u.zoom=o(k,_,x,b)),e.emit("zoom")),(D||M)&&e.emit("viewport");var I=c.style;if(I&&I.length>0&&l){for(var N=0;N0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchingStyle=e.batchingNotify=!0,e.batchStyleEles=this.collection(),e.batchNotifyEles=this.collection(),e.batchNotifyTypes=[],e.batchNotifyTypes.ids={}),e.batchCount++,this},endBatch:function(){var e=this._private;return e.batchCount--,0===e.batchCount&&(e.batchingStyle=!1,e.batchStyleEles.updateStyle(),e.batchingNotify=!1,this.notify({type:e.batchNotifyTypes,eles:e.batchNotifyEles})),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;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};i.invalidateDimensions=i.resize,e.exports=i},function(e,t,n){"use strict";var r=n(0),i=n(7),a={collection:function(e,t){return r.string(e)?this.$(e):r.elementOrCollection(e)?e.collection():r.array(e)?new i(this,e,t):new i(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}};a.elements=a.filter=a.$,e.exports=a},function(e,t,n){"use strict";var r=n(0),i=n(18),a={style:function(e){if(e){this.setStyle(e).update()}return this._private.style},setStyle:function(e){var t=this._private;return r.stylesheet(e)?t.style=e.generateStyle(this):r.array(e)?t.style=i.fromJson(this,e):r.string(e)?t.style=i.fromString(this,e):t.style=i(this),t.style}};e.exports=a},function(e,t,n){"use strict";var r=n(0),i=n(4),a=n(2),o={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)},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=arguments,t=this._private.pan,n=void 0,i=void 0,a=void 0,o=void 0,s=void 0;switch(e.length){case 0:return t;case 1:if(r.string(e[0]))return n=e[0],t[n];if(r.plainObject(e[0])){if(!this._private.panningEnabled)return this;a=e[0],o=a.x,s=a.y,r.number(o)&&(t.x=o),r.number(s)&&(t.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],i=e[1],"x"!==n&&"y"!==n||!r.number(i)||(t[n]=i),this.emit("pan viewport")}return this.notify({type:"viewport"}),this},panBy:function(e,t){var n=arguments,i=this._private.pan,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0;if(!this._private.panningEnabled)return this;switch(n.length){case 1:r.plainObject(e)&&(s=n[0],l=s.x,u=s.y,r.number(l)&&(i.x+=l),r.number(u)&&(i.y+=u),this.emit("pan viewport"));break;case 2:a=e,o=t,"x"!==a&&"y"!==a||!r.number(o)||(i[a]+=o),this.emit("pan viewport")}return this.notify({type:"viewport"}),this},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({type:"viewport"})}return this},getFitViewport:function(e,t){if(r.number(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n=void 0;if(r.string(e)){var i=e;e=this.$(i)}else if(r.boundingBox(e)){var a=e;n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else r.elementOrCollection(e)||(e=this.mutableElements());if(!r.elementOrCollection(e)||!e.empty()){n=n||e.boundingBox();var o=this.width(),s=this.height(),l=void 0;if(t=r.number(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((o-2*t)/n.w,(s-2*t)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=lt.maxZoom?t.maxZoom:s,s=st.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=l,a.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;r.number(u.x)&&(t.pan.x=u.x,s=!1),r.number(u.y)&&(t.pan.y=u.y,s=!1),s||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify({type:"viewport"})),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify({type:"viewport"})),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(r.string(e)){var n=e;e=this.mutableElements().filter(n)}else r.elementOrCollection(e)||(e=this.mutableElements());if(0!==e.length){var i=e.boundingBox(),a=this.width(),o=this.height();t=void 0===t?this._private.zoom:t;return{x:(a-t*(i.x1+i.x2))/2,y:(o-t*(i.y1+i.y2))/2}}}},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;return e.sizeCache=e.sizeCache||(t?function(){var e=i.getComputedStyle(t),n=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-n("padding-left")-n("padding-right"),height:t.clientHeight-n("padding-top")-n("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}}};o.centre=o.center,o.autolockNodes=o.autolock,o.autoungrabifyNodes=o.autoungrabify,e.exports=o},function(e,t,n){"use strict";var r=n(1),i=n(24),a=n(2),o=n(0),s={animated:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e];if(!(this._private.cy||this).styleEnabled())return!1;var r=n[0];return r?r._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var r=0;r0;)!function(){var e=n.collection();r.bfs({roots:v[0],visit:function(t,n,r,i,a){e=e.add(t)},directed:!1}),v=v.not(e),f.push(e)}();u=n.collection();for(var g=0;gm.length-1;)m.push([]);m[G].push(H),Z.depth=G,Z.index=m[G].length-1}z()}var Q=0;if(t.avoidOverlap)for(var K=0;Kc||0===t)&&(r+=u/d,a++)}return a=Math.max(1,a),r/=a,0===a&&(r=void 0),re[e.id()]=r,r},ae=function(e,t){return ie(e)-ie(t)},oe=0;oe<3;oe++){for(var se=0;se=0;he--)for(var pe=m[he],fe=0;fe0&&m[0].length<=3?c/2:0),h=2*Math.PI/m[i].length*a;return 0===i&&1===m[0].length&&(d=1),{x:ce.x+d*Math.cos(h),y:ce.y+d*Math.sin(h)}}return{x:ce.x+(a+1-(o+1)/2)*s,y:(i+1)*u}}var p={x:ce.x+(a+1-(o+1)/2)*s,y:(i+1)*u};return p}(ve,m.length)}return i.layoutPositions(this,t,function(e){return de[e.id()]}),this},e.exports=r},function(e,t,n){"use strict";function r(e){this.options=i.extend({},s,e)}var i=n(1),a=n(2),o=n(0),s={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}};r.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,s=r.nodes().not(":parent");t.sort&&(s=s.sort(t.sort));for(var l=a.makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u={x:l.x1+l.w/2,y:l.y1+l.h/2},c=void 0===t.sweep?2*Math.PI-2*Math.PI/s.length:t.sweep,d=c/Math.max(1,s.length-1),h=void 0,p=0,f=0;f1&&t.avoidOverlap){p*=1.75;var b=Math.cos(d)-Math.cos(0),x=Math.sin(d)-Math.sin(0),w=Math.sqrt(p*p/(b*b+x*x));h=Math.max(w,h)}var E=function(e,n){var r=t.startAngle+n*d*(i?1:-1),a=h*Math.cos(r),o=h*Math.sin(r);return{x:u.x+a,y:u.y+o}};return s.layoutPositions(this,t,E),this},e.exports=r},function(e,t,n){"use strict";function r(e){this.options=i.extend({},o,e)}var i=n(1),a=n(2),o={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}};r.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,o=i.nodes().not(":parent"),s=a.makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],c=(t.startAngle,0),d=0;d0){Math.abs(b[0].value-w.value)>=m&&(b=[],y.push(b))}b.push(w)}var E=c+t.minNodeSpacing;if(!t.avoidOverlap){var P=y.length>0&&y[0].length>1,T=Math.min(s.w,s.h)/2-E,C=T/(y.length+P?1:0);E=Math.min(E,C)}for(var S=0,D=0;D1&&t.avoidOverlap){var I=Math.cos(M)-Math.cos(0),N=Math.sin(M)-Math.sin(0),B=Math.sqrt(E*E/(I*I+N*N));S=Math.max(B,S)}k.r=S,S+=E}if(t.equidistant){for(var z=0,L=0,A=0;A0)var l=r.nodeOverlap*o,d=Math.sqrt(i*i+a*a),h=l*i/d,p=l*a/d;else var f=c(e,i,a),v=c(t,-1*i,-1*a),g=v.x-f.x,m=v.y-f.y,y=g*g+m*m,d=Math.sqrt(y),l=(e.nodeRepulsion+t.nodeRepulsion)/y,h=l*g/d,p=l*m/d;e.isLocked||(e.offsetX-=h,e.offsetY-=p),t.isLocked||(t.offsetX+=h,t.offsetY+=p)}},u=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},c=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&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=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},d=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,v=t.gravity*h/p;c.offsetX+=f,c.offsetY+=v}}}}},p=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},g=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.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopg&&(p+=v+t.componentSpacing,h=0,f=0,v=0)}}}(0,i),r}).then(function(e){h.layoutNodes=e.layoutNodes,o.stop(),b()});var b=function(){!0===t.animate||!1===t.animate?y({force:!0,next:function(){r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r})}}):t.eles.nodes().layoutPositions(r,t,function(e){var t=h.layoutNodes[h.idToIndex[e.data("id")]];return{x:t.positionX,y:t.positionY}})};return this},r.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},r.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var c=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:o.makeBoundingBox(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},l=n.eles.components(),u={},c=0;c0){a.graphSet.push(C);for(var c=0;cr.count?0:r.graph},h=function e(t,n,r,i){var a=i.graphSet[r];if(-1s){var v=d(),g=h();(v-1)*g>=s?d(v-1):(g-1)*v>=s&&h(g-1)}else for(;c*u=s?h(y+1):d(m+1)}var b=o.w/c,x=o.h/u;if(t.condense&&(b=0,x=0),t.avoidOverlap)for(var w=0;w=c&&(N=0,I++)},z={},L=0;L=0;E--){var P=f[E];P.isNode()?s(P)||u(P):function(n){var r,a=n._private,l=a.rscratch,u=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,d=u/2+y,f=d*d,g=2*d,b=a.source,x=a.target;if("segments"===l.edgeType||"straight"===l.edgeType||"haystack"===l.edgeType){for(var w=l.allpts,E=0;E+3(r=i.sqdistToFiniteLine(e,t,w[E],w[E+1],w[E+2],w[E+3])))return o(n,r),!0}else if("bezier"===l.edgeType||"multibezier"===l.edgeType||"self"===l.edgeType||"compound"===l.edgeType)for(var w=l.allpts,E=0;E+5(r=i.sqdistToQuadraticBezier(e,t,w[E],w[E+1],w[E+2],w[E+3],w[E+4],w[E+5])))return o(n,r),!0;for(var b=b||a.source,x=x||a.target,P=h.getArrowWidth(u,c),T=[{name:"source",x:l.arrowStartX,y:l.arrowStartY,angle:l.srcArrowAngle},{name:"target",x:l.arrowEndX,y:l.arrowEndY,angle:l.tgtArrowAngle},{name:"mid-source",x:l.midX,y:l.midY,angle:l.midsrcArrowAngle},{name:"mid-target",x:l.midX,y:l.midY,angle:l.midtgtArrowAngle}],E=0;E0&&(s(b),s(x))}(P)||u(P)||u(P,"source")||u(P,"target")}return v},o.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,o=[],s=Math.min(e,n),l=Math.max(e,n),u=Math.min(t,r),c=Math.max(t,r);e=s,n=l,t=u,r=c;for(var d=i.makeBoundingBox({x1:e,y1:t,x2:n,y2:r}),h=0;hy?y+"$-$"+m:m+"$-$"+y,v&&(t="unbundled$-$"+p.id);var b=s[t];null==b&&(b=s[t]=[],l.push(t)),b.push(d),v&&(b.hasUnbundled=!0),g&&(b.hasBezier=!0)}else u.push(d)}for(var x,w,E,P,T,C,S,D,k,_,M,I,N=0;Nw.id()){var z=x;x=w,w=z}E=x.position(),P=w.position(),T=x.outerWidth(),C=x.outerHeight(),S=w.outerWidth(),D=w.outerHeight(),k=n.nodeShapes[this.getNodeShape(x)],_=n.nodeShapes[this.getNodeShape(w)],I=!1;for(var d,L,A,O={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0},R=E.x,V=E.y,q=T,F=C,j=P.x,X=P.y,Y=S,W=D,H=B.length,c=0;c=c||x){h={cp:m,segment:b};break}}if(h)break}var m=h.cp,b=h.segment,w=(c-f)/b.length,E=b.t1-b.t0,P=o?b.t0+E*w:b.t1-E*w;P=r.bound(0,P,1),t=r.qbezierPtAt(m.p0,m.p1,m.p2,P),a=function(e,t,n,i){var a=r.bound(0,i-.001,1),o=r.bound(0,i+.001,1),s=r.qbezierPtAt(e,t,n,a),l=r.qbezierPtAt(e,t,n,o);return d(s,l)}(m.p0,m.p1,m.p2,P);break;case"straight":case"segments":case"haystack":for(var T,C,S,D,k=0,_=i.allpts.length,g=0;g+3<_&&(o?(S={x:i.allpts[g],y:i.allpts[g+1]},D={x:i.allpts[g+2],y:i.allpts[g+3]}):(S={x:i.allpts[_-2-g],y:i.allpts[_-1-g]},D={x:i.allpts[_-4-g],y:i.allpts[_-3-g]}),T=r.dist(S,D),C=k,!((k+=T)>=c));g+=2);var M=c-C,P=M/T;P=r.bound(0,P,1),t=r.lineAt(S,D,P),a=d(S,D)}l("labelX",n,t.x),l("labelY",n,t.y),l("labelAutoAngle",n,a)}};c("source"),c("target"),this.applyLabelDimensions(e)}},o.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},o.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r);a.setPrefixedProperty(n.rstyle,"labelWidth",t,i.width),a.setPrefixedProperty(n.rscratch,"labelWidth",t,i.width),a.setPrefixedProperty(n.rstyle,"labelHeight",t,i.height),a.setPrefixedProperty(n.rscratch,"labelHeight",t,i.height)},o.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,s=function(e,r){return r?(a.setPrefixedProperty(n.rscratch,e,t,r),r):a.getPrefixedProperty(n.rscratch,e,t)};"none"==o||("uppercase"==o?i=i.toUpperCase():"lowercase"==o&&(i=i.toLowerCase()));var l=e.pstyle("text-wrap").value;if("wrap"===l){var u=s("labelKey");if(u&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h=[],p=0;pd){for(var v=f.split(/\s+/),g="",m=0;md)break;x+=i[E],E===i.length-1&&(w=!0)}return w||(x+="…"),x}return i},o.calculateLabelDimensions=function(e,t,n){var r=this,i=e._private.labelStyleKey+"$@$"+t;n&&(i+="$@$"+n);var a=r.labelDimCache||(r.labelDimCache={});if(a[i])return a[i];var o=e.pstyle("font-style").strValue,s=1*e.pstyle("font-size").pfValue+"px",l=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,c=this.labelCalcDiv;c||(c=this.labelCalcDiv=document.createElement("div"),document.body.appendChild(c));var d=c.style;return d.fontFamily=l,d.fontStyle=o,d.fontSize=s,d.fontWeight=u,d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none",d.padding="0",d.lineHeight="1","wrap"===e.pstyle("text-wrap").value?d.whiteSpace="pre":d.whiteSpace="normal",c.textContent=t,a[i]={width:Math.ceil(c.clientWidth/1),height:Math.ceil(c.clientHeight/1)},a[i]},o.calculateLabelAngles=function(e){var t=e._private,n=t.rscratch,r=e.isEdge(),i=e.pstyle("text-rotation"),a=i.strValue;"none"===a?n.labelAngle=n.sourceLabelAngle=n.targetLabelAngle=0:r&&"autorotate"===a?(n.labelAngle=Math.atan(n.midDispY/n.midDispX),n.sourceLabelAngle=n.sourceLabelAutoAngle,n.targetLabelAngle=n.targetLabelAutoAngle):n.labelAngle=n.sourceLabelAngle=n.targetLabelAngle="autorotate"===a?0:i.pfValue},e.exports=o},function(e,t,n){"use strict";var r={};r.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(e.isParent())return"rectangle"===n||"roundrectangle"===n||"cutrectangle"===n||"barrel"===n?n:"rectangle";if("polygon"===n){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n},e.exports=r},function(e,t,n){"use strict";var r={};r.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e,n,r){if(t.merge(e),!0===r||void 0===r)for(var i=0;i=e.desktopTapThreshold2}var _=n(i);m&&(e.hoverData.tapholdCancelled=!0),s=!0,t(v,["mousemove","vmousemove","tapdrag"],i,{position:{x:d[0],y:d[1]}});var M=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||l.emit("boxstart"),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(m){var I={originalEvent:i,type:"cxtdrag",position:{x:d[0],y:d[1]}};x?x.emit(I):l.emit(I),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:i,type:"cxtdragout",position:{x:d[0],y:d[1]}}),e.hoverData.cxtOver=v,v&&v.emit({originalEvent:i,type:"cxtdragover",position:{x:d[0],y:d[1]}}))}}else if(e.hoverData.dragging){if(s=!0,l.panningEnabled()&&l.userPanningEnabled()){var N;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;N={x:(d[0]-B[0])*u,y:(d[1]-B[1])*u},e.hoverData.justStartedPan=!1}else N={x:w[0]*u,y:w[1]*u};l.panBy(N),e.hoverData.dragged=!0}d=e.projectIntoViewport(i.clientX,i.clientY)}else if(1!=f[4]||null!=x&&!x.isEdge()){if(x&&x.isEdge()&&x.active()&&x.unactivate(),x&&x.grabbed()||v==b||(b&&t(b,["mouseout","tapdragout"],i,{position:{x:d[0],y:d[1]}}),v&&t(v,["mouseover","tapdragover"],i,{position:{x:d[0],y:d[1]}}),e.hoverData.last=v),x)if(m){if(l.boxSelectionEnabled()&&_)x&&x.grabbed()&&(y(E),x.emit("free")),M();else if(x&&x.grabbed()&&e.nodeIsDraggable(x)){var z=!e.dragData.didDrag;z&&e.redrawHint("eles",!0),e.dragData.didDrag=!0;var L=[];e.hoverData.draggingEles||g(l.collection(E),{inDragLayer:!0});for(var A=0;A0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=l=[]),t(s,["mouseup","tapend","vmouseup"],r,{position:{x:a[0],y:a[1]}}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||t(u,["click","tap","vclick"],r,{position:{x:a[0],y:a[1]}}),s!=u||e.dragData.didDrag||e.hoverData.selecting||null!=s&&s._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||c?s.selected()?s.unselect():s.select():c||(i.$(":selected").unmerge(s).unselect(),s.select())),e.redrawHint("eles",!0)),e.hoverData.selecting){var p=i.collection(e.getAllInBox(o[0],o[1],o[2],o[3]));e.redrawHint("select",!0),p.length>0&&e.redrawHint("eles",!0),i.emit("boxend");var f=function(e){return e.selectable()&&!e.selected()};"additive"===i.selectionType()?p.emit("box").stdFilter(f).select().emit("boxselect"):(c||i.$(":selected").unmerge(p).unselect(),p.emit("box").stdFilter(f).select().emit("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!o[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var v=u&&u.grabbed();y(l),v&&u.emit("free")}}o[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}},!1);var C=function(t){if(!e.scrollingPage){var n=e.cy,r=e.projectIntoViewport(t.clientX,t.clientY),i=[r[0]*n.zoom()+n.pan().x,r[1]*n.zoom()+n.pan().y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||P())return void t.preventDefault();if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){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);var a;a=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,a*=e.wheelSensitivity;1===t.deltaMode&&(a*=33),n.zoom({level:n.zoom()*Math.pow(10,a),renderedPosition:{x:i[0],y:i[1]}})}}};e.registerBinding(e.container,"wheel",C,!0),e.registerBinding(window,"scroll",function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!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 S,D,k,_,M,I,N,B,z,L,A,O,R,V,q=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},F=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};e.registerBinding(e.container,"touchstart",V=function(n){if(T(n)){e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(n.touches[0]){var o=e.projectIntoViewport(n.touches[0].clientX,n.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(n.touches[1]){var o=e.projectIntoViewport(n.touches[1].clientX,n.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(n.touches[2]){var o=e.projectIntoViewport(n.touches[2].clientX,n.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(n.touches[1]){y(e.dragData.touchDragEles);var s=e.findContainerClientCoords();z=s[0],L=s[1],A=s[2],O=s[3],S=n.touches[0].clientX-z,D=n.touches[0].clientY-L,k=n.touches[1].clientX-z,_=n.touches[1].clientY-L,R=0<=S&&S<=A&&0<=k&&k<=A&&0<=D&&D<=O&&0<=_&&_<=O;var l=r.pan(),u=r.zoom();M=q(S,D,k,_),I=F(S,D,k,_),N=[(S+k)/2,(D+_)/2],B=[(N[0]-l.x)/u,(N[1]-l.y)/u];if(I<4e4&&!n.touches[2]){var c=e.findNearestElement(i[0],i[1],!0,!0),d=e.findNearestElement(i[2],i[3],!0,!0);return c&&c.isNode()?(c.activate().emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=c):d&&d.isNode()?(d.activate().emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=d):r.emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[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(n.touches[2]);else if(n.touches[1]);else if(n.touches[0]){var p=e.findNearestElements(i[0],i[1],!0,!0),f=p[0];if(null!=f&&(f.activate(),e.touchData.start=f,e.touchData.starts=p,e.nodeIsGrabbable(f))){var v=e.dragData.touchDragEles=[],b=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),f.selected()?(b=r.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),g(b,{addToList:v})):m(f,{addToList:v}),h(f);var x=function(e){return{originalEvent:n,type:e,position:{x:i[0],y:i[1]}}};f.emit(x("grabon")),b?b.forEach(function(e){e.emit(x("grab"))}):f.emit(x("grab"))}t(f,["touchstart","tapstart","vmousedown"],n,{position:{x:i[0],y:i[1]}}),null==f&&(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||(t(e.touchData.start,["taphold"],n,{position:{x:i[0],y:i[1]}}),e.touchData.start||r.$(":selected").unselect())},e.tapholdDuration)}if(n.touches.length>=1){for(var w=e.touchData.startPosition=[],E=0;E=e.touchTapThreshold2}if(i&&e.touchData.cxt){n.preventDefault();var E=n.touches[0].clientX-z,P=n.touches[0].clientY-L,C=n.touches[1].clientX-z,N=n.touches[1].clientY-L,A=F(E,P,C,N),O=A/I;if(O>=2.25||A>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var V={originalEvent:n,type:"cxttapend",position:{x:u[0],y:u[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(V),e.touchData.start=null):l.emit(V)}}if(i&&e.touchData.cxt){var V={originalEvent:n,type:"cxtdrag",position:{x:u[0],y:u[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(V):l.emit(V),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var j=e.findNearestElement(u[0],u[1],!0,!0);e.touchData.cxtOver&&j===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:n,type:"cxtdragout",position:{x:u[0],y:u[1]}}),e.touchData.cxtOver=j,j&&j.emit({originalEvent:n,type:"cxtdragover",position:{x:u[0],y:u[1]}}))}else if(i&&n.touches[2]&&l.boxSelectionEnabled())n.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||l.emit("boxstart"),e.touchData.selecting=!0,e.redrawHint("select",!0),s&&0!==s.length&&void 0!==s[0]?(s[2]=(u[0]+u[2]+u[4])/3,s[3]=(u[1]+u[3]+u[5])/3):(s[0]=(u[0]+u[2]+u[4])/3,s[1]=(u[1]+u[3]+u[5])/3,s[2]=(u[0]+u[2]+u[4])/3+1,s[3]=(u[1]+u[3]+u[5])/3+1),s[4]=1,e.touchData.selecting=!0,e.redraw();else if(i&&n.touches[1]&&l.zoomingEnabled()&&l.panningEnabled()&&l.userZoomingEnabled()&&l.userPanningEnabled()){n.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var X=e.dragData.touchDragEles;if(X){e.redrawHint("drag",!0);for(var Y=0;Y0)return v[0]}return null}(e,t,v);if(null!=g){var m=v[5],y=v[3],b=v[1],x=r.qbezierAt(m,y,b,g);if(v.isTop&&x<=t)return!0;if(v.isBottom&&t<=x)return!0}}return!1}}},i.generateBottomRoundrectangle=function(){return this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottomroundrectangle",points:r.generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,i,a,o,s){var l=e-(n/2+s),u=t-(i/2+s),c=u,d=e+(n/2+s),h=r.finiteLinesIntersect(a,o,e,t,l,u,d,c,!1);return h.length>0?h:r.roundRectangleIntersectLine(a,o,e,t,n,i,s)},checkPoint:function(e,t,n,i,a,o,s){var l=r.getRoundRectangleRadius(i,a),u=2*l;if(r.pointInsidePolygon(e,t,this.points,o,s,i,a-u,[0,-1],n))return!0;if(r.pointInsidePolygon(e,t,this.points,o,s,i-u,a,[0,-1],n))return!0;var c=i/2+2*n,d=a/2+2*n,h=[o-c,s-d,o-c,s,o+c,s,o+c,s-d];return!!r.pointInsidePolygonPoints(e,t,h)||(!!r.checkInEllipse(e,t,u,u,o+i/2-l,s+a/2-l,n)||!!r.checkInEllipse(e,t,u,u,o-i/2+l,s+a/2-l,n))}}},i.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",r.generateUnitNgonPointsFitToSquare(3,0)),this.generatePolygon("rectangle",r.generateUnitNgonPointsFitToSquare(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle(),this.generatePolygon("diamond",[0,1,1,0,0,-1,-1,0]),this.generatePolygon("pentagon",r.generateUnitNgonPointsFitToSquare(5,0)),this.generatePolygon("hexagon",r.generateUnitNgonPointsFitToSquare(6,0)),this.generatePolygon("heptagon",r.generateUnitNgonPointsFitToSquare(7,0)),this.generatePolygon("octagon",r.generateUnitNgonPointsFitToSquare(8,0));var n=new Array(20),i=r.generateUnitNgonPoints(5,0),a=r.generateUnitNgonPoints(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:p;e.lineWidth=v,e.lineCap="butt",i.strokeStyle(e,h[0],h[1],h[2],n),i.drawEdgePath(t,e,a.allpts,f)},m=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;i.drawArrowheads(e,t,n)};e.lineJoin="round";if("yes"===t.pstyle("ghost").value){var y=t.pstyle("ghost-offset-x").pfValue,b=t.pstyle("ghost-offset-y").pfValue,x=t.pstyle("ghost-opacity").value,w=p*x;e.translate(y,b),g(w),m(w),e.translate(-y,-b)}g(),m(),function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c;e.lineWidth=u,"self"!==a.edgeType||o?e.lineCap="round":e.lineCap="butt",i.strokeStyle(e,d[0],d[1],d[2],n),i.drawEdgePath(t,e,a.allpts,"solid")}(),function(){i.drawElementText(e,t,r)}(),n&&e.translate(s.x1,s.y1)}},r.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o=void 0,s=!1,l=this.usePaths();if(l){var u=n.join("$");i.pathCacheKey&&i.pathCacheKey===u?(o=t=i.pathCache,s=!0):(o=t=new Path2D,i.pathCacheKey=u,i.pathCache=o)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash([6,3]);break;case"solid":a.setLineDash([])}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var c=2;c+30||S>0&&C>0){var k=l-D;switch(y){case"left":k-=h;break;case"center":k-=h/2}var _=u-p-D,M=h+2*D,I=p+2*D;if(T>0){var N=e.fillStyle,B=t.pstyle("text-background-color").value;e.fillStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+T*s+")";"roundrectangle"==t.pstyle("text-background-shape").strValue?r(e,k,_,M,I,2):e.fillRect(k,_,M,I),e.fillStyle=N}if(S>0&&C>0){var z=e.strokeStyle,L=e.lineWidth,A=t.pstyle("text-border-color").value,O=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+C*s+")",e.lineWidth=S,e.setLineDash)switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=S/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(k,_,M,I),"double"===O){var R=S/2;e.strokeRect(k+R,_+R,M-2*R,I-2*R)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=z}}var V=2*t.pstyle("text-outline-width").pfValue;if(V>0&&(e.lineWidth=V),"wrap"===t.pstyle("text-wrap").value){var q=i.getPrefixedProperty(o,"labelWrapCachedLines",n),F=p/q.length;switch(b){case"top":u-=(q.length-1)*F;break;case"center":case"bottom":u-=(q.length-1)*F}for(var j=0;j0&&e.strokeText(q[j],l,u),e.fillText(q[j],l,u),u+=F}else V>0&&e.strokeText(c,l,u),e.fillText(c,l,u);0!==x&&(e.rotate(-x),e.translate(-E,-P))}}},e.exports=o},function(e,t,n){"use strict";var r=n(0),i={};i.drawNode=function(e,t,n,i){var a=this,o=void 0,s=void 0,l=t._private,u=l.rscratch,c=t.position();if(r.number(c.x)&&r.number(c.y)&&t.visible()){var d=t.effectiveOpacity(),h=a.usePaths(),p=void 0,f=!1,v=t.padding();o=t.width()+2*v,s=t.height()+2*v,e.lineWidth=t.pstyle("border-width").pfValue;var g=void 0;n&&(g=n,e.translate(-g.x1,-g.y1));for(var m=t.pstyle("background-image"),y=m.value,b=void 0,x=[],w=[],E=y.length,P=0;P0&&void 0!==arguments[0]?arguments[0]:k;a.fillStyle(e,D[0],D[1],D[2],t)},B=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;a.strokeStyle(e,_[0],_[1],_[2],t)},z=t.pstyle("shape").strValue,L=t.pstyle("shape-polygon-points").pfValue;if(h){var A=z+"$"+o+"$"+s+("polygon"===z?"$"+L.join("$"):"");e.translate(c.x,c.y),u.pathCacheKey===A?(p=u.pathCache,f=!0):(p=new Path2D,u.pathCacheKey=A,u.pathCache=p)}var O=function(){if(!f){var n=c;h&&(n={x:0,y:0}),a.nodeShapes[a.getNodeShape(t)].draw(p||e,n.x,n.y,o,s)}h?e.fill(p):e.fill()},R=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,r=l.backgrounding,i=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;a.hasPie(t)&&(a.drawPie(e,t,r),n&&(h||a.nodeShapes[a.getNodeShape(t)].draw(e,c.x,c.y,o,s)))},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,n=(C>0?C:-C)*t,r=C>0?0:255;0!==C&&(a.fillStyle(e,r,r,r,n),h?e.fill(p):e.fill())},F=function(){if(S>0&&(h?e.stroke(p):e.stroke(),"double"===M)){e.lineWidth=S/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",h?e.stroke(p):e.stroke(),e.globalCompositeOperation=t}};if("yes"===t.pstyle("ghost").value){var j=t.pstyle("ghost-offset-x").pfValue,X=t.pstyle("ghost-offset-y").pfValue,Y=t.pstyle("ghost-opacity").value,W=Y*d;e.translate(j,X),N(Y*k),O(),R(W),V(0!==C||0!==S),q(W),B(Y*I),F(),e.translate(-j,-X)}N(),O(),R(),V(0!==C||0!==S),q(),B(),F(),h&&e.translate(-c.x,-c.y),function(){a.drawElementText(e,t,i)}(),function(){var n=t.pstyle("overlay-padding").pfValue,r=t.pstyle("overlay-opacity").value,i=t.pstyle("overlay-color").value;r>0&&(a.fillStyle(e,i[0],i[1],i[2],r),a.nodeShapes.roundrectangle.draw(e,c.x,c.y,o+2*n,s+2*n),e.fill())}(),e.setLineDash&&e.setLineDash([]),n&&e.translate(g.x1,g.y1)}},i.hasPie=function(e){return e=e[0],e._private.hasPie},i.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,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,v=t.pstyle("pie-"+h+"-background-opacity").value*n,g=p/100;g+d>1&&(g=1-d);var m=1.5*Math.PI+2*Math.PI*d,y=2*Math.PI*g,b=m+y;0===p||d>=1||d+g>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,m,b),e.closePath(),this.fillStyle(e,f[0],f[1],f[2],v),e.fill(),d+=g)}},e.exports=i},function(e,t,n){"use strict";var r={},i=n(1);r.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},r.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;iu.minMbLowQualFrames&&(u.motionBlurPxRatio=u.mbPxRBlurry)),u.clearingMotionBlur&&(u.motionBlurPxRatio=1),u.textureDrawLastFrame&&!f&&(p[u.NODE]=!0,p[u.SELECT_BOX]=!0);var w=d.style()._private.coreStyle,E=d.zoom(),P=void 0!==s?s:E,T=d.pan(),C={x:T.x,y:T.y},S={zoom:E,pan:{x:T.x,y:T.y}},D=u.prevViewport;void 0===D||S.zoom!==D.zoom||S.pan.x!==D.pan.x||S.pan.y!==D.pan.y||y&&!m||(u.motionBlurPxRatio=1),l&&(C=l),P*=c,C.x*=c,C.y*=c;var k=u.getCachedZSortedEles();if(f||(u.textureDrawLastFrame=!1),f){u.textureDrawLastFrame=!0;if(!u.textureCache){u.textureCache={},u.textureCache.bb=d.mutableElements().boundingBox(),u.textureCache.texture=u.data.bufferCanvases[u.TEXTURE_BUFFER];var _=u.data.bufferContexts[u.TEXTURE_BUFFER];_.setTransform(1,0,0,1,0,0),_.clearRect(0,0,u.canvasWidth*u.textureMult,u.canvasHeight*u.textureMult),u.render({forcedContext:_,drawOnlyNodeLayer:!0,forcedPxRatio:c*u.textureMult});var S=u.textureCache.viewport={zoom:d.zoom(),pan:d.pan(),width:u.canvasWidth,height:u.canvasHeight};S.mpan={x:(0-S.pan.x)/S.zoom,y:(0-S.pan.y)/S.zoom}}p[u.DRAG]=!1,p[u.NODE]=!1;var M=h.contexts[u.NODE],I=u.textureCache.texture,S=u.textureCache.viewport;u.textureCache.bb,M.setTransform(1,0,0,1,0,0),v?t(M,0,0,S.width,S.height):M.clearRect(0,0,S.width,S.height);var N=w["outside-texture-bg-color"].value,B=w["outside-texture-bg-opacity"].value;u.fillStyle(M,N[0],N[1],N[2],B),M.fillRect(0,0,S.width,S.height);var E=d.zoom();n(M,!1),M.clearRect(S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c),M.drawImage(I,S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c)}else u.textureOnViewport&&!r&&(u.textureCache=null);var z=d.extent(),L=u.pinching||u.hoverData.dragging||u.swipePanning||u.data.wheelZooming||u.hoverData.draggingEles,A=u.hideEdgesOnViewport&&L,O=[];if(O[u.NODE]=!p[u.NODE]&&v&&!u.clearedForMotionBlur[u.NODE]||u.clearingMotionBlur,O[u.NODE]&&(u.clearedForMotionBlur[u.NODE]=!0),O[u.DRAG]=!p[u.DRAG]&&v&&!u.clearedForMotionBlur[u.DRAG]||u.clearingMotionBlur,O[u.DRAG]&&(u.clearedForMotionBlur[u.DRAG]=!0),p[u.NODE]||a||o||O[u.NODE]){var R=v&&!O[u.NODE]&&1!==g,M=r||(R?u.data.bufferContexts[u.MOTIONBLUR_BUFFER_NODE]:h.contexts[u.NODE]);n(M,v&&!R?"motionBlur":void 0),A?u.drawCachedNodes(M,k.nondrag,c,z):u.drawLayeredElements(M,k.nondrag,c,z),u.debug&&u.drawDebugPoints(M,k.nondrag),a||v||(p[u.NODE]=!1)}if(!o&&(p[u.DRAG]||a||O[u.DRAG])){var R=v&&!O[u.DRAG]&&1!==g,M=r||(R?u.data.bufferContexts[u.MOTIONBLUR_BUFFER_DRAG]:h.contexts[u.DRAG]);n(M,v&&!R?"motionBlur":void 0),A?u.drawCachedNodes(M,k.drag,c,z):u.drawCachedElements(M,k.drag,c,z),u.debug&&u.drawDebugPoints(M,k.drag),a||v||(p[u.DRAG]=!1)}if(u.showFps||!o&&p[u.SELECT_BOX]&&!a){var M=r||h.contexts[u.SELECT_BOX];if(n(M),1==u.selection[4]&&(u.hoverData.selecting||u.touchData.selecting)){var E=u.cy.zoom(),V=w["selection-box-border-width"].value/E;M.lineWidth=V,M.fillStyle="rgba("+w["selection-box-color"].value[0]+","+w["selection-box-color"].value[1]+","+w["selection-box-color"].value[2]+","+w["selection-box-opacity"].value+")",M.fillRect(u.selection[0],u.selection[1],u.selection[2]-u.selection[0],u.selection[3]-u.selection[1]),V>0&&(M.strokeStyle="rgba("+w["selection-box-border-color"].value[0]+","+w["selection-box-border-color"].value[1]+","+w["selection-box-border-color"].value[2]+","+w["selection-box-opacity"].value+")",M.strokeRect(u.selection[0],u.selection[1],u.selection[2]-u.selection[0],u.selection[3]-u.selection[1]))}if(h.bgActivePosistion&&!u.hoverData.selecting){var E=u.cy.zoom(),q=h.bgActivePosistion;M.fillStyle="rgba("+w["active-bg-color"].value[0]+","+w["active-bg-color"].value[1]+","+w["active-bg-color"].value[2]+","+w["active-bg-opacity"].value+")",M.beginPath(),M.arc(q.x,q.y,w["active-bg-size"].pfValue/E,0,2*Math.PI),M.fill()}var F=u.lastRedrawTime;if(u.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);M.setTransform(1,0,0,1,0,0),M.fillStyle="rgba(255, 0, 0, 0.75)",M.strokeStyle="rgba(255, 0, 0, 0.75)",M.lineWidth=1,M.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);M.strokeRect(0,30,250,20),M.fillRect(0,30,250*Math.min(j/60,1),20)}a||(p[u.SELECT_BOX]=!1)}if(v&&1!==g){var X=h.contexts[u.NODE],Y=u.data.bufferCanvases[u.MOTIONBLUR_BUFFER_NODE],W=h.contexts[u.DRAG],H=u.data.bufferCanvases[u.MOTIONBLUR_BUFFER_DRAG],Z=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!x?e.clearRect(0,0,u.canvasWidth,u.canvasHeight):t(e,0,0,u.canvasWidth,u.canvasHeight);var i=g;e.drawImage(n,0,0,u.canvasWidth*i,u.canvasHeight*i,0,0,u.canvasWidth,u.canvasHeight)};(p[u.NODE]||O[u.NODE])&&(Z(X,Y,O[u.NODE]),p[u.NODE]=!1),(p[u.DRAG]||O[u.DRAG])&&(Z(W,H,O[u.DRAG]),p[u.DRAG]=!1)}u.prevViewport=S,u.clearingMotionBlur&&(u.clearingMotionBlur=!1,u.motionBlurCleared=!0,u.motionBlur=!0),v&&(u.motionBlurTimeout=setTimeout(function(){u.motionBlurTimeout=null,u.clearedForMotionBlur[u.NODE]=!1,u.clearedForMotionBlur[u.DRAG]=!1,u.motionBlur=!1,u.clearingMotionBlur=!f,u.mbFrames=0,p[u.NODE]=!0,p[u.DRAG]=!0,u.redraw()},100)),r||d.emit("render")},e.exports=r},function(e,t,n){"use strict";var r=n(2),i={};i.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=3.99||i>2)return null;var d=Math.pow(2,i),h=t.h*d,p=t.w*d,f=u.imgCaches=u.imgCaches||{},v=f[i];if(v)return v;var g;if(g=h<=25?25:h<=50?50:50*Math.ceil(h/50),h>1024||p>1024||e.isEdge()||e.isParent())return null;var m=o.getTextureQueue(g),y=m[m.length-2],b=function(){return o.recycleTexture(g,p)||o.addTexture(g,p)};y||(y=m[m.length-1]),y||(y=b()),y.width-y.usedWidthi;S--)k=o.getElement(e,t,n,S,s.downscale);_()}else{var M;if(!P&&!T&&!C)for(var S=i-1;S>=-4;S--){var D=f[S];if(D){M=D;break}}if(E(M))return o.queueElement(e,t,i),M;y.context.translate(y.usedWidth,0),y.context.scale(d,d),l.drawElement(y.context,e,t,w),y.context.scale(1/d,1/d),y.context.translate(-y.usedWidth,0)}return v=f[i]={ele:e,x:y.usedWidth,texture:y,level:i,scale:d,width:p,height:h,scaledLabelShown:w},y.usedWidth+=Math.ceil(p+8),y.eleCaches.push(v),o.checkTextureFullness(y),v},u.invalidateElement=function(e){var t=this,n=e._private.rscratch.imgCaches;if(n)for(var r=-4;r<=2;r++){var a=n[r];if(a){var o=a.texture;o.invalidatedWidth+=a.width,n[r]=null,i.removeFromArray(o.eleCaches,a),t.checkTextureUtility(o)}}},u.checkTextureUtility=function(e){e.invalidatedWidth>=.5*e.width&&this.retireTexture(e)},u.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?i.removeFromArray(n,e):e.fullnessChecks++},u.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n);i.removeFromArray(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,i.clearArray(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),i.removeFromArray(a,s),r.push(s),s}},u.queueElement=function(e,t,n){var i=this,a=i.getElementQueue(),o=i.getElementIdToQueue(),s=e.id(),l=o[s];if(l)l.level=Math.max(l.level,n),l.reqs++,a.updateItem(l);else{var u={ele:e,bb:t,position:r.copyPosition(e.position()),level:n,reqs:1};e.isEdge()&&(u.positions={source:r.copyPosition(e.source().position()),target:r.copyPosition(e.target().position())}),a.push(u),o[s]=u}},u.dequeue=function(e){for(var t=this,n=t.getElementQueue(),i=t.getElementIdToQueue(),a=[],o=0;o<1&&n.size()>0;o++){var l=n.pop();i[l.ele.id()]=null,a.push(l);var u,c=l.ele;u=(!c.isEdge()||r.arePositionsSame(c.source().position(),l.positions.source)&&r.arePositionsSame(c.target().position(),l.positions.target))&&r.arePositionsSame(c.position(),l.position)?l.bb:c.boundingBox(),t.getElement(l.ele,u,e,l.level,s.dequeue)}return a},u.onDequeue=function(e){this.onDequeues.push(e)},u.offDequeue=function(e){i.removeFromArray(this.onDequeues,e)},u.setupDequeueing=o.setupDequeueing({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n0&&s>0){f.clearRect(0,0,a,s),f.globalCompositeOperation="source-over";var v=this.getCachedZSortedEles();if(e.full)f.translate(-r.x1*c,-r.y1*c),f.scale(c,c),this.drawElements(f,v),f.scale(1/c,1/c),f.translate(r.x1*c,r.y1*c);else{var g=t.pan(),m={x:g.x*c,y:g.y*c};c*=t.zoom(),f.translate(m.x,m.y),f.scale(c,c),this.drawElements(f,v),f.scale(1/c,1/c),f.translate(-m.x,-m.y)}e.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=e.bg,f.rect(0,0,a,s),f.fill())}return p},s.png=function(e){return a(e,this.bufferCanvasImage(e),"image/png")},s.jpg=function(e){return a(e,this.bufferCanvasImage(e),"image/jpeg")},e.exports=s},function(e,t,n){"use strict";function r(e){var t=this;t.data={canvases:new Array(u.CANVAS_LAYERS),contexts:new Array(u.CANVAS_LAYERS),canvasNeedsRedraw:new Array(u.CANVAS_LAYERS),bufferCanvases:new Array(u.BUFFER_COUNT),bufferContexts:new Array(u.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color: rgba(0,0,0,0);";t.data.canvasContainer=document.createElement("div");var r=t.data.canvasContainer.style;t.data.canvasContainer.setAttribute("style",n),r.position="relative",r.zIndex="0",r.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),(i.getAttribute("style")||"").indexOf(n)<0&&i.setAttribute("style",(i.getAttribute("style")||"")+n);for(var l=0;l0&&t.data.lyrTxrCache.invalidateElements(n)})}var i=n(1),a=n(0),o=n(110),s=n(113),l=r,u=r.prototype;u.CANVAS_LAYERS=3,u.SELECT_BOX=0,u.DRAG=1,u.NODE=2,u.BUFFER_COUNT=3,u.TEXTURE_BUFFER=0,u.MOTIONBLUR_BUFFER_NODE=1,u.MOTIONBLUR_BUFFER_DRAG=2,u.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[u.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[u.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[u.SELECT_BOX]=t}};var c="undefined"!=typeof Path2D;u.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},u.usePaths=function(){return c&&this.pathsEnabled},[n(102),n(104),n(103),n(105),n(106),n(107),n(108),n(109),n(111),n(114)].forEach(function(e){i.extend(u,e)}),e.exports=l},function(e,t,n){"use strict";function r(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)}var i=n(1),a=n(2),o=n(8),s=n(0),l=n(16),u=function(e,t){var n=this,r=n.renderer=e;n.layersByLevel={},n.firstGet=!0,n.lastInvalidationTime=i.performanceNow()-500,n.skipping=!1,r.beforeRender(function(e,t){t-n.lastInvalidationTime<=250?n.skipping=!0:n.skipping=!1});var a=function(e,t){return t.reqs-e.reqs};n.layersQueue=new o(a),n.eleTxrCache=t,n.setupEleCacheInvalidation(),n.setupDequeueing()},c=u.prototype,d=0,h=Math.pow(2,53)-1;c.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=document.createElement("canvas");a.width=r,a.height=i;var o={id:d=++d%h,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},c.getLayers=function(e,t,n){var r=this,o=r.renderer,s=o.cy,l=s.zoom(),u=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(a.log2(l*t)))<-4)n=-4;else if(l>=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var c,d,h=r.layersByLevel,p=Math.pow(2,n),f=h[n]=h[n]||[],v=r.levelIsComplete(n,e);if(v)return f;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return d=h[t],!0},a=function(e){if(!d)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};a(1),a(-1);for(var o=f.length-1;o>=0;o--){var s=f[o];s.invalid&&i.removeFromArray(f,s)}}();var g=function(){if(!c){c=a.makeBoundingBox();for(var t=0;t=y||!a.boundingBoxInBoundingBox(m.bb,w.boundingBox()))&&!(m=function(e){e=e||{};var t=e.after;if(g(),c.w*p*(c.h*p)>16e6)return null;var i=r.makeLayer(c,n);if(null!=t){var a=f.indexOf(t)+1;f.splice(a,0,i)}else(void 0===e.insert||e.insert)&&f.unshift(i);return i}({insert:!0,after:m})))return null;d||b?r.queueLayer(m,w):r.drawEleInLayer(m,w,n,t),m.eles.push(w),P[n]=m}}return d||(b?null:f)},c.getEleLevelForLayerLevel=function(e,t){return e},c.drawEleInLayer=function(e,t,n,i){var a=this,o=this.renderer,s=e.context,l=t.boundingBox();if(0!==l.w&&0!==l.h&&t.visible()){var u=a.eleTxrCache,c=u.reasons.highQuality;n=a.getEleLevelForLayerLevel(n,i);var d=u.getElement(t,l,null,n,c);d?(r(s,!1),s.drawImage(d.texture.canvas,d.x,0,d.width,d.height,l.x1,l.y1,l.w,l.h),r(s,!0)):o.drawElement(s,t)}},c.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||0===r.length)return!1;for(var i=0,a=0;a0)return!1;if(o.invalid)return!1;i+=o.eles.length}return i===t.length},c.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){t=!0;break}}return t},c.invalidateElements=function(e){var t=this;t.lastInvalidationTime=i.performanceNow(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)})},c.invalidateLayer=function(e){if(this.lastInvalidationTime=i.performanceNow(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];i.removeFromArray(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a=0&&(d=d.toLowerCase(),h=h.toLowerCase(),o=o.replace("@",""),p=!0);var f=!1;o.indexOf("!")>=0&&(o=o.replace("!",""),f=!0),p&&(s=h.toLowerCase(),c=d.toLowerCase());var v=!1;switch(o){case"*=":u=d.indexOf(h)>=0;break;case"$=":u=d.indexOf(h,d.length-h.length)>=0;break;case"^=":u=0===d.indexOf(h);break;case"=":u=c===s;break;case">":v=!0,u=c>s;break;case">=":v=!0,u=c>=s;break;case"<":v=!0,u=c\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:'"(?:\\\\"|[^"])*"|'+"'(?:\\\\'|[^'])*'",number:r.regex.number,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};i.variable="(?:[\\w-]|(?:\\\\"+i.metaChar+"))+",i.value=i.string+"|"+i.number,i.className=i.variable,i.id=i.variable,function(){var e=void 0,t=void 0,n=void 0;for(e=i.comparatorOp.split("|"),n=0;n=0||"="!==t&&(i.comparatorOp+="|\\!"+t)}(),e.exports=i},function(e,t,n){"use strict";var r=n(1),i=n(0),a=n(5),o={};o.apply=function(e){var t=this,n=t._private,r=n.cy,i=r.collection();n.newStyle&&(n.contextStyles={},n.propDiffs={},t.cleanElements(e,!0));for(var a=0;a0;if(h||p){var f=void 0;h&&p?f=u.properties:h?f=u.properties:p&&(f=u.mappedProperties);for(var v=0;v0){r=!0;break}}t.hasPie=r;var o=e.pstyle("text-transform").strValue,s=e.pstyle("label").strValue,l=e.pstyle("source-label").strValue,u=e.pstyle("target-label").strValue,c=e.pstyle("font-style").strValue,d=e.pstyle("font-size").pfValue+"px",h=e.pstyle("font-family").strValue,p=e.pstyle("font-weight").strValue,f=e.pstyle("text-valign").strValue,v=e.pstyle("text-valign").strValue,g=e.pstyle("text-outline-width").pfValue,m=e.pstyle("text-wrap").strValue,y=e.pstyle("text-max-width").pfValue,b=c+"$"+d+"$"+h+"$"+p+"$"+o+"$"+f+"$"+v+"$"+g+"$"+m+"$"+y;t.labelStyleKey=b,t.sourceLabelKey=b+"$"+l,t.targetLabelKey=b+"$"+u,t.labelKey=b+"$"+s,t.fontKey=c+"$"+p+"$"+d+"$"+h,t.styleKey=Date.now()}},o.applyParsedProperty=function(e,t){var n=this,a=t,o=e._private.style,s=void 0,l=n.types,u=n.properties[a.name].type,c=a.bypass,d=o[a.name],h=d&&d.bypass,p=e._private,f=function(){n.checkZOrderTrigger(e,a.name,d?d.value:null,a.value)};if("curve-style"===t.name&&"haystack"===t.value&&e.isEdge()&&(e.isLoop()||e.source().isParent()||e.target().isParent())&&(a=t=this.parse(t.name,"bezier",c)),a.delete)return o[a.name]=void 0,f(),!0;if(a.deleteBypassed)return d?!!d.bypass&&(d.bypassed=void 0,f(),!0):(f(),!0);if(a.deleteBypass)return d?!!d.bypass&&(o[a.name]=d.bypassed,f(),!0):(f(),!0);var v=function(){r.error("Do not assign mappings to elements without corresponding data (e.g. ele `"+e.id()+"` for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case l.mapData:for(var g=a.field.split("."),m=p.data,y=0;y1&&(b=1),u.color){var x=a.valueMin[0],w=a.valueMax[0],E=a.valueMin[1],P=a.valueMax[1],T=a.valueMin[2],C=a.valueMax[2],S=null==a.valueMin[3]?1:a.valueMin[3],D=null==a.valueMax[3]?1:a.valueMax[3],k=[Math.round(x+(w-x)*b),Math.round(E+(P-E)*b),Math.round(T+(C-T)*b),Math.round(S+(D-S)*b)];s={bypass:a.bypass,name:a.name,value:k,strValue:"rgb("+k[0]+", "+k[1]+", "+k[2]+")"}}else{if(!u.number)return!1;var _=a.valueMin+(a.valueMax-a.valueMin)*b;s=this.parse(a.name,_,a.bypass,"mapping")}s||(s=this.parse(a.name,d.strValue,a.bypass,"mapping")),s||v(),s.mapping=a,a=s;break;case l.data:var M=a.field.split("."),I=p.data;if(I)for(var N=0;N0&&l>0){for(var c={},d=!1,h=0;h0?e.delayAnimation(u).play().promise().then(t):t()}).then(function(){return e.animation({style:c,duration:l,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,s),e.emitAndNotify("style"),o.transitioning=!1})}else o.transitioning&&(this.removeBypasses(e,s),e.emitAndNotify("style"),o.transitioning=!1)},o.checkZOrderTrigger=function(e,t,n,r){var i=this.properties[t];null==i.triggersZOrder||null!=n&&!i.triggersZOrder(n,r)||this._private.cy.notify({type:"zorder",eles:e})},e.exports=o},function(e,t,n){"use strict";var r=n(0),i=n(1),a={};a.applyBypass=function(e,t,n,a){var o=this,s=[];if("*"===t||"**"===t){if(void 0!==n)for(var l=0;lh.max||h.strictMax&&t===h.max))return null;var B={name:e,value:t,strValue:""+t+(_||""),units:_,bypass:n};return h.unitless||"px"!==_&&"em"!==_?B.pfValue=t:B.pfValue="px"!==_&&_?this.getEmSizeInPixels()*t:t,"ms"!==_&&"s"!==_||(B.pfValue="ms"===_?t:1e3*t),"deg"!==_&&"rad"!==_||(B.pfValue="rad"===_?t:a.deg2rad(t)),"%"===_&&(B.pfValue=t/100),B}if(h.propList){var z=[],L=""+t;if("none"===L);else{for(var A=L.split(","),O=0;O node").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3,"curve-style":"haystack"}).selector(":parent <-> node").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("node:parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}).selector("core").css({"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}),this.defaultLength=this.length},e.exports=a},function(e,t,n){"use strict";var r=n(1),i=n(6),a={};a.appendFromString=function(e){function t(){s=s.length>l.length?s.substr(l.length):""}function n(){u=u.length>c.length?u.substr(c.length):""}var a=this,o=this,s=""+e,l=void 0,u=void 0,c=void 0;for(s=s.replace(/[\/][*](\s|.)+?[*][\/]/g,"");;){if(s.match(/^\s*$/))break;var d=s.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){r.error("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+s);break}l=d[0];var h=d[1];if("core"!==h){if(new i(h)._private.invalid){r.error("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),t();continue}}var p=d[2],f=!1;u=p;for(var v=[];;){if(u.match(/^\s*$/))break;var g=u.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!g){r.error("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),f=!0;break}c=g[0];var m=g[1],y=g[2];if(a.properties[m]){o.parse(m,y)?(v.push({name:m,val:y}),n()):(r.error("Skipping property: Invalid property definition in: "+c),n())}else r.error("Skipping property: Invalid property name in: "+c),n()}if(f){t();break}o.selector(h);for(var b=0;b1&&(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 n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=new RegExp("^"+this.regex.hsla+"$").exec(e);if(c){if(r=parseInt(c[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(i=parseFloat(c[2]))<0||i>100)return;if(i/=100,(a=parseFloat(c[3]))<0||a>100)return;if(a/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1))return;if(0===i)s=l=u=Math.round(255*a);else{var d=a<.5?a*(1+i):a+i-a*i,h=2*a-d;s=Math.round(255*t(h,d,r+1/3)),l=Math.round(255*t(h,d,r)),u=Math.round(255*t(h,d,r-1/3))}n=[s,l,u,o]}return n},rgb2tuple:function(e){var t=void 0,n=new RegExp("^"+this.regex.rgba+"$").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))<0||l>1)return;t.push(l)}}return t},colorname2tuple:function(e){return this.colors[e.toLowerCase()]},color2tuple:function(e){return(r.array(e)?e:null)||this.colorname2tuple(e)||this.hex2tuple(e)||this.rgb2tuple(e)||this.hsl2tuple(e)},colors:{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]}}},function(e,t,n){"use strict";var r=n(0);e.exports={mapEmpty:function(e){return null==e||0===Object.keys(e).length},pushMap:function(e){var t=this.getMap(e);null==t?this.setMap(this.extend({},e,{value:[e.value]})):t.push(e.value)},setMap:function(e){for(var t=e.map,n=e.keys,i=n.length,a=0;at?1:0}function i(e,t){return-1*r(e,t)}e.exports={sort:{ascending:r,descending:i}}},function(e,t,n){"use strict";var r=n(19),i=n(0);e.exports={camel2dash:r(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),dash2camel:r(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),prependCamel:r(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),capitalize:function(e){return i.emptyString(e)?e:e.charAt(0).toUpperCase()+e.substring(1)}}},function(e,t,n){"use strict";var r=n(4),i=r?r.performance:null,a={},o=i&&i.now?function(){return i.now()}:function(){return Date.now()},s=function(){if(r){if(r.requestAnimationFrame)return function(e){r.requestAnimationFrame(e)};if(r.mozRequestAnimationFrame)return function(e){r.mozRequestAnimationFrame(e)};if(r.webkitRequestAnimationFrame)return function(e){r.webkitRequestAnimationFrame(e)};if(r.msRequestAnimationFrame)return function(e){r.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(o())},1e3/60)}}();a.requestAnimationFrame=function(e){s(e)},a.performanceNow=o,a.debounce=n(139),a.now=function(){return Date.now()},e.exports=a},function(e,t,n){e.exports=n(138)},function(e,t,n){var r,i,a;(function(){var n,o,s,l,u,c,d,h,p,f,v,g,m,y,b;s=Math.floor,f=Math.min,o=function(e,t){return et?1:0},p=function(e,t,n,r,i){var a;if(null==n&&(n=0),null==i&&(i=o),n<0)throw new Error("lo must be non-negative");for(null==r&&(r=e.length);nn;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse(),l=[],r=0,i=a.length;rv;0<=v?++c:--c)g.push(u(e,n));return g},y=function(e,t,n,r){var i,a,s;for(null==r&&(r=o),i=e[n];n>t&&(s=n-1>>1,a=e[s],r(i,a)<0);)e[n]=a,n=s;return e[n]=i},b=function(e,t,n){var r,i,a,s,l;for(null==n&&(n=o),i=e.length,l=t,a=e[t],r=2*t+1;r=t||n<0||S&&r>=m}function c(){var e=E();if(u(e))return d(e);b=setTimeout(c,l(e))}function d(e){return b=void 0,D&&v?i(e):(v=g=void 0,y)}function h(){void 0!==b&&clearTimeout(b),T=0,v=P=g=b=void 0}function p(){return void 0===b?y:d(E())}function f(){var e=E(),n=u(e);if(v=arguments,g=this,P=e,n){if(void 0===b)return a(P);if(S)return b=setTimeout(c,t),i(P)}return void 0===b&&(b=setTimeout(c,t)),y}var v,g,m,y,b,P,T=0,C=!1,S=!1,D=!0;if("function"!=typeof e)throw new TypeError(s);return t=o(t)||0,r(n)&&(C=!!n.leading,S="maxWait"in n,m=S?x(o(n.maxWait)||0,t):m,D="trailing"in n?!!n.trailing:D),f.cancel=h,f.flush=p,f}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==typeof e}function a(e){return"symbol"==typeof e||i(e)&&b.call(e)==u}function o(e){if("number"==typeof e)return e;if(a(e))return l;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var n=h.test(e);return n||p.test(e)?f(e.slice(2),n?2:8):d.test(e)?l:+e}var s="Expected a function",l=NaN,u="[object Symbol]",c=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,p=/^0o[0-7]+$/i,f=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,m=v||g||Function("return this")(),y=Object.prototype,b=y.toString,x=Math.max,w=Math.min,E=function(){return m.Date.now()};e.exports=n}).call(t,n(20))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function o(){v&&p&&(v=!1,p.length?f=p.concat(f):g=-1,f.length&&s())}function s(){if(!v){var e=i(o);v=!0;for(var t=f.length;t;){for(p=f,f=[];++g1)for(var n=1;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(141),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate}])});
\ No newline at end of file
+var r=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={x:-1,v:0,tension:null,friction:null},o=[0],s=0,l=void 0,u=void 0,c=void 0;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,a.tension=t,a.friction=r,l=null!==i,l?(s=e(t,r),u=s/i*.016):u=.016;c=n(c||a,u),o.push(1+c.x),s+=16,Math.abs(c.x)>1e-4&&Math.abs(c.v)>1e-4;);return l?function(e){return o[e*(o.length-1)|0]}:s}}();e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){var i=!r,a=e,o=t._private,s=r?e:e.cy(),l=s.style();if(i){var u=a.position();o.startPosition=o.startPosition||{x:u.x,y:u.y},o.startStyle=o.startStyle||l.getAnimationStartStyle(a,o.style)}if(r){var c=s._private.pan;o.startPan=o.startPan||{x:c.x,y:c.y},o.startZoom=null!=o.startZoom?o.startZoom:s._private.zoom}o.started=!0,o.startTime=n-o.progress*o.duration}e.exports=r},function(e,t,n){"use strict";function r(e,t){function n(t,n){var r=t._private,s=r.animation.current,l=r.animation.queue,u=!1;if(!n&&"none"===t.pstyle("display").value){s=s.splice(0,s.length).concat(l.splice(0,l.length));for(var c=0;c=0;t--){(0,e[t])()}e.splice(0,e.length)},p=s.length-1;p>=0;p--){var f=s[p],v=f._private;v.stopped?(s.splice(p,1),v.hooked=!1,v.playing=!1,v.started=!1,h(v.frames)):(v.playing||v.applying)&&(v.playing&&v.applying&&(v.applying=!1),v.started||a(t,f,e,n),i(t,f,e,n),v.applying&&(v.applying=!1),h(v.frames),f.completed()&&(s.splice(p,1),v.hooked=!1,v.playing=!1,v.started=!1,h(v.completes)),u=!0)}return n||0!==s.length||0!==l.length||o.push(t),u}for(var r=t._private.aniEles,o=[],s=!1,l=0;l0?(r.dirtyCompoundBoundsCache(),t.notify({type:"draw",eles:r})):t.notify({type:"draw"})),r.unmerge(o),t.emit("step")}var i=n(64),a=n(62);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){var l=!r,u=e._private,c=t._private,d=c.easing,h=c.startTime,p=r?e:e.cy(),f=p.style();if(!c.easingImpl)if(null==d)c.easingImpl=a.linear;else{var v=void 0;if(s.string(d)){var g=f.parse("transition-timing-function",d);v=g.value}else v=d;var m=void 0,y=void 0;s.string(v)?(m=v,y=[]):(m=v[1],y=v.slice(2).map(function(e){return+e})),y.length>0?("spring"===m&&y.push(c.duration),c.easingImpl=a[m].apply(null,y)):c.easingImpl=a[m]}var b=c.easingImpl,x=void 0;if(x=0===c.duration?1:(n-h)/c.duration,c.applying&&(x=c.progress),x<0?x=0:x>1&&(x=1),null==c.delay){var w=c.startPosition,E=c.position;if(E&&l&&!e.locked()){var P=e.position();i(w.x,E.x)&&(P.x=o(w.x,E.x,x,b)),i(w.y,E.y)&&(P.y=o(w.y,E.y,x,b)),e.emit("position")}var T=c.startPan,C=c.pan,S=u.pan,D=null!=C&&r;D&&(i(T.x,C.x)&&(S.x=o(T.x,C.x,x,b)),i(T.y,C.y)&&(S.y=o(T.y,C.y,x,b)),e.emit("pan"));var k=c.startZoom,_=c.zoom,M=null!=_&&r;M&&(i(k,_)&&(u.zoom=o(k,_,x,b)),e.emit("zoom")),(D||M)&&e.emit("viewport");var I=c.style;if(I&&I.length>0&&l){for(var N=0;N0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchingStyle=e.batchingNotify=!0,e.batchStyleEles=this.collection(),e.batchNotifyEles=this.collection(),e.batchNotifyTypes=[],e.batchNotifyTypes.ids={}),e.batchCount++,this},endBatch:function(){var e=this._private;return e.batchCount--,0===e.batchCount&&(e.batchingStyle=!1,e.batchStyleEles.updateStyle(),e.batchingNotify=!1,this.notify({type:e.batchNotifyTypes,eles:e.batchNotifyEles})),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;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};i.invalidateDimensions=i.resize,e.exports=i},function(e,t,n){"use strict";var r=n(0),i=n(7),a={collection:function(e,t){return r.string(e)?this.$(e):r.elementOrCollection(e)?e.collection():r.array(e)?new i(this,e,t):new i(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}};a.elements=a.filter=a.$,e.exports=a},function(e,t,n){"use strict";var r=n(0),i=n(18),a={style:function(e){if(e){this.setStyle(e).update()}return this._private.style},setStyle:function(e){var t=this._private;return r.stylesheet(e)?t.style=e.generateStyle(this):r.array(e)?t.style=i.fromJson(this,e):r.string(e)?t.style=i.fromString(this,e):t.style=i(this),t.style}};e.exports=a},function(e,t,n){"use strict";var r=n(0),i=n(4),a=n(2),o={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)},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=arguments,t=this._private.pan,n=void 0,i=void 0,a=void 0,o=void 0,s=void 0;switch(e.length){case 0:return t;case 1:if(r.string(e[0]))return n=e[0],t[n];if(r.plainObject(e[0])){if(!this._private.panningEnabled)return this;a=e[0],o=a.x,s=a.y,r.number(o)&&(t.x=o),r.number(s)&&(t.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],i=e[1],"x"!==n&&"y"!==n||!r.number(i)||(t[n]=i),this.emit("pan viewport")}return this.notify({type:"viewport"}),this},panBy:function(e,t){var n=arguments,i=this._private.pan,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0;if(!this._private.panningEnabled)return this;switch(n.length){case 1:r.plainObject(e)&&(s=n[0],l=s.x,u=s.y,r.number(l)&&(i.x+=l),r.number(u)&&(i.y+=u),this.emit("pan viewport"));break;case 2:a=e,o=t,"x"!==a&&"y"!==a||!r.number(o)||(i[a]+=o),this.emit("pan viewport")}return this.notify({type:"viewport"}),this},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({type:"viewport"})}return this},getFitViewport:function(e,t){if(r.number(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n=void 0;if(r.string(e)){var i=e;e=this.$(i)}else if(r.boundingBox(e)){var a=e;n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else r.elementOrCollection(e)||(e=this.mutableElements());if(!r.elementOrCollection(e)||!e.empty()){n=n||e.boundingBox();var o=this.width(),s=this.height(),l=void 0;if(t=r.number(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((o-2*t)/n.w,(s-2*t)/n.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=lt.maxZoom?t.maxZoom:s,s=st.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=l,a.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;r.number(u.x)&&(t.pan.x=u.x,s=!1),r.number(u.y)&&(t.pan.y=u.y,s=!1),s||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify({type:"viewport"})),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify({type:"viewport"})),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(r.string(e)){var n=e;e=this.mutableElements().filter(n)}else r.elementOrCollection(e)||(e=this.mutableElements());if(0!==e.length){var i=e.boundingBox(),a=this.width(),o=this.height();t=void 0===t?this._private.zoom:t;return{x:(a-t*(i.x1+i.x2))/2,y:(o-t*(i.y1+i.y2))/2}}}},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;return e.sizeCache=e.sizeCache||(t?function(){var e=i.getComputedStyle(t),n=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-n("padding-left")-n("padding-right"),height:t.clientHeight-n("padding-top")-n("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}}};o.centre=o.center,o.autolockNodes=o.autolock,o.autoungrabifyNodes=o.autoungrabify,e.exports=o},function(e,t,n){"use strict";var r=n(1),i=n(24),a=n(2),o=n(0),s={animated:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e];if(!(this._private.cy||this).styleEnabled())return!1;var r=n[0];return r?r._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var r=0;r0;)!function(){var e=n.collection();r.bfs({roots:v[0],visit:function(t,n,r,i,a){e=e.add(t)},directed:!1}),v=v.not(e),f.push(e)}();u=n.collection();for(var g=0;gm.length-1;)m.push([]);m[G].push(H),Z.depth=G,Z.index=m[G].length-1}z()}var Q=0;if(t.avoidOverlap)for(var K=0;Kc||0===t)&&(r+=u/d,a++)}return a=Math.max(1,a),r/=a,0===a&&(r=void 0),re[e.id()]=r,r},ae=function(e,t){return ie(e)-ie(t)},oe=0;oe<3;oe++){for(var se=0;se=0;he--)for(var pe=m[he],fe=0;fe0&&m[0].length<=3?c/2:0),h=2*Math.PI/m[i].length*a;return 0===i&&1===m[0].length&&(d=1),{x:ce.x+d*Math.cos(h),y:ce.y+d*Math.sin(h)}}return{x:ce.x+(a+1-(o+1)/2)*s,y:(i+1)*u}}var p={x:ce.x+(a+1-(o+1)/2)*s,y:(i+1)*u};return p}(ve,m.length)}return i.layoutPositions(this,t,function(e){return de[e.id()]}),this},e.exports=r},function(e,t,n){"use strict";function r(e){this.options=i.extend({},s,e)}var i=n(1),a=n(2),o=n(0),s={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}};r.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,s=r.nodes().not(":parent");t.sort&&(s=s.sort(t.sort));for(var l=a.makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u={x:l.x1+l.w/2,y:l.y1+l.h/2},c=void 0===t.sweep?2*Math.PI-2*Math.PI/s.length:t.sweep,d=c/Math.max(1,s.length-1),h=void 0,p=0,f=0;f1&&t.avoidOverlap){p*=1.75;var b=Math.cos(d)-Math.cos(0),x=Math.sin(d)-Math.sin(0),w=Math.sqrt(p*p/(b*b+x*x));h=Math.max(w,h)}var E=function(e,n){var r=t.startAngle+n*d*(i?1:-1),a=h*Math.cos(r),o=h*Math.sin(r);return{x:u.x+a,y:u.y+o}};return s.layoutPositions(this,t,E),this},e.exports=r},function(e,t,n){"use strict";function r(e){this.options=i.extend({},o,e)}var i=n(1),a=n(2),o={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}};r.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,o=i.nodes().not(":parent"),s=a.makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],c=(t.startAngle,0),d=0;d0){Math.abs(b[0].value-w.value)>=m&&(b=[],y.push(b))}b.push(w)}var E=c+t.minNodeSpacing;if(!t.avoidOverlap){var P=y.length>0&&y[0].length>1,T=Math.min(s.w,s.h)/2-E,C=T/(y.length+P?1:0);E=Math.min(E,C)}for(var S=0,D=0;D1&&t.avoidOverlap){var I=Math.cos(M)-Math.cos(0),N=Math.sin(M)-Math.sin(0),B=Math.sqrt(E*E/(I*I+N*N));S=Math.max(B,S)}k.r=S,S+=E}if(t.equidistant){for(var z=0,L=0,A=0;A0)var l=r.nodeOverlap*o,d=Math.sqrt(i*i+a*a),h=l*i/d,p=l*a/d;else var f=c(e,i,a),v=c(t,-1*i,-1*a),g=v.x-f.x,m=v.y-f.y,y=g*g+m*m,d=Math.sqrt(y),l=(e.nodeRepulsion+t.nodeRepulsion)/y,h=l*g/d,p=l*m/d;e.isLocked||(e.offsetX-=h,e.offsetY-=p),t.isLocked||(t.offsetX+=h,t.offsetY+=p)}},u=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},c=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&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=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},d=function(e,t){for(var n=0;n1){var f=t.gravity*d/p,v=t.gravity*h/p;c.offsetX+=f,c.offsetY+=v}}}}},p=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},g=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.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopg&&(p+=v+t.componentSpacing,h=0,f=0,v=0)}}}(0,i),r}).then(function(e){h.layoutNodes=e.layoutNodes,o.stop(),b()});var b=function(){!0===t.animate||!1===t.animate?y({force:!0,next:function(){r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r})}}):t.eles.nodes().layoutPositions(r,t,function(e){var t=h.layoutNodes[h.idToIndex[e.data("id")]];return{x:t.positionX,y:t.positionY}})};return this},r.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},r.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var c=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:o.makeBoundingBox(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},l=n.eles.components(),u={},c=0;c0){a.graphSet.push(C);for(var c=0;cr.count?0:r.graph},h=function e(t,n,r,i){var a=i.graphSet[r];if(-1s){var v=d(),g=h();(v-1)*g>=s?d(v-1):(g-1)*v>=s&&h(g-1)}else for(;c*u=s?h(y+1):d(m+1)}var b=o.w/c,x=o.h/u;if(t.condense&&(b=0,x=0),t.avoidOverlap)for(var w=0;w=c&&(N=0,I++)},z={},L=0;L=0;E--){var P=f[E];P.isNode()?s(P)||u(P):function(n){var r,a=n._private,l=a.rscratch,u=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,d=u/2+y,f=d*d,g=2*d,b=a.source,x=a.target;if("segments"===l.edgeType||"straight"===l.edgeType||"haystack"===l.edgeType){for(var w=l.allpts,E=0;E+3(r=i.sqdistToFiniteLine(e,t,w[E],w[E+1],w[E+2],w[E+3])))return o(n,r),!0}else if("bezier"===l.edgeType||"multibezier"===l.edgeType||"self"===l.edgeType||"compound"===l.edgeType)for(var w=l.allpts,E=0;E+5(r=i.sqdistToQuadraticBezier(e,t,w[E],w[E+1],w[E+2],w[E+3],w[E+4],w[E+5])))return o(n,r),!0;for(var b=b||a.source,x=x||a.target,P=h.getArrowWidth(u,c),T=[{name:"source",x:l.arrowStartX,y:l.arrowStartY,angle:l.srcArrowAngle},{name:"target",x:l.arrowEndX,y:l.arrowEndY,angle:l.tgtArrowAngle},{name:"mid-source",x:l.midX,y:l.midY,angle:l.midsrcArrowAngle},{name:"mid-target",x:l.midX,y:l.midY,angle:l.midtgtArrowAngle}],E=0;E0&&(s(b),s(x))}(P)||u(P)||u(P,"source")||u(P,"target")}return v},o.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,o=[],s=Math.min(e,n),l=Math.max(e,n),u=Math.min(t,r),c=Math.max(t,r);e=s,n=l,t=u,r=c;for(var d=i.makeBoundingBox({x1:e,y1:t,x2:n,y2:r}),h=0;hy?y+"$-$"+m:m+"$-$"+y,v&&(t="unbundled$-$"+p.id);var b=s[t];null==b&&(b=s[t]=[],l.push(t)),b.push(d),v&&(b.hasUnbundled=!0),g&&(b.hasBezier=!0)}else u.push(d)}for(var x,w,E,P,T,C,S,D,k,_,M,I,N=0;Nw.id()){var z=x;x=w,w=z}E=x.position(),P=w.position(),T=x.outerWidth(),C=x.outerHeight(),S=w.outerWidth(),D=w.outerHeight(),k=n.nodeShapes[this.getNodeShape(x)],_=n.nodeShapes[this.getNodeShape(w)],I=!1;for(var d,L,A,O={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0},R=E.x,V=E.y,q=T,F=C,j=P.x,X=P.y,Y=S,W=D,H=B.length,c=0;c=c||x){h={cp:m,segment:b};break}}if(h)break}var m=h.cp,b=h.segment,w=(c-f)/b.length,E=b.t1-b.t0,P=o?b.t0+E*w:b.t1-E*w;P=r.bound(0,P,1),t=r.qbezierPtAt(m.p0,m.p1,m.p2,P),a=function(e,t,n,i){var a=r.bound(0,i-.001,1),o=r.bound(0,i+.001,1),s=r.qbezierPtAt(e,t,n,a),l=r.qbezierPtAt(e,t,n,o);return d(s,l)}(m.p0,m.p1,m.p2,P);break;case"straight":case"segments":case"haystack":for(var T,C,S,D,k=0,_=i.allpts.length,g=0;g+3<_&&(o?(S={x:i.allpts[g],y:i.allpts[g+1]},D={x:i.allpts[g+2],y:i.allpts[g+3]}):(S={x:i.allpts[_-2-g],y:i.allpts[_-1-g]},D={x:i.allpts[_-4-g],y:i.allpts[_-3-g]}),T=r.dist(S,D),C=k,!((k+=T)>=c));g+=2);var M=c-C,P=M/T;P=r.bound(0,P,1),t=r.lineAt(S,D,P),a=d(S,D)}l("labelX",n,t.x),l("labelY",n,t.y),l("labelAutoAngle",n,a)}};c("source"),c("target"),this.applyLabelDimensions(e)}},o.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},o.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r);a.setPrefixedProperty(n.rstyle,"labelWidth",t,i.width),a.setPrefixedProperty(n.rscratch,"labelWidth",t,i.width),a.setPrefixedProperty(n.rstyle,"labelHeight",t,i.height),a.setPrefixedProperty(n.rscratch,"labelHeight",t,i.height)},o.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,s=function(e,r){return r?(a.setPrefixedProperty(n.rscratch,e,t,r),r):a.getPrefixedProperty(n.rscratch,e,t)};"none"==o||("uppercase"==o?i=i.toUpperCase():"lowercase"==o&&(i=i.toLowerCase()));var l=e.pstyle("text-wrap").value;if("wrap"===l){var u=s("labelKey");if(u&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h=[],p=0;pd){for(var v=f.split(/\s+/),g="",m=0;md)break;x+=i[E],E===i.length-1&&(w=!0)}return w||(x+="…"),x}return i},o.calculateLabelDimensions=function(e,t,n){var r=this,i=e._private.labelStyleKey+"$@$"+t;n&&(i+="$@$"+n);var a=r.labelDimCache||(r.labelDimCache={});if(a[i])return a[i];var o=e.pstyle("font-style").strValue,s=1*e.pstyle("font-size").pfValue+"px",l=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,c=this.labelCalcDiv;c||(c=this.labelCalcDiv=document.createElement("div"),document.body.appendChild(c));var d=c.style;return d.fontFamily=l,d.fontStyle=o,d.fontSize=s,d.fontWeight=u,d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none",d.padding="0",d.lineHeight="1","wrap"===e.pstyle("text-wrap").value?d.whiteSpace="pre":d.whiteSpace="normal",c.textContent=t,a[i]={width:Math.ceil(c.clientWidth/1),height:Math.ceil(c.clientHeight/1)},a[i]},o.calculateLabelAngles=function(e){var t=e._private,n=t.rscratch,r=e.isEdge(),i=e.pstyle("text-rotation"),a=i.strValue;"none"===a?n.labelAngle=n.sourceLabelAngle=n.targetLabelAngle=0:r&&"autorotate"===a?(n.labelAngle=Math.atan(n.midDispY/n.midDispX),n.sourceLabelAngle=n.sourceLabelAutoAngle,n.targetLabelAngle=n.targetLabelAutoAngle):n.labelAngle=n.sourceLabelAngle=n.targetLabelAngle="autorotate"===a?0:i.pfValue},e.exports=o},function(e,t,n){"use strict";var r={};r.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(e.isParent())return"rectangle"===n||"roundrectangle"===n||"cutrectangle"===n||"barrel"===n?n:"rectangle";if("polygon"===n){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n},e.exports=r},function(e,t,n){"use strict";var r={};r.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e,n,r){if(t.merge(e),!0===r||void 0===r)for(var i=0;i=e.desktopTapThreshold2}var _=n(i);m&&(e.hoverData.tapholdCancelled=!0),s=!0,t(v,["mousemove","vmousemove","tapdrag"],i,{position:{x:d[0],y:d[1]}});var M=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||l.emit("boxstart"),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(m){var I={originalEvent:i,type:"cxtdrag",position:{x:d[0],y:d[1]}};x?x.emit(I):l.emit(I),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:i,type:"cxtdragout",position:{x:d[0],y:d[1]}}),e.hoverData.cxtOver=v,v&&v.emit({originalEvent:i,type:"cxtdragover",position:{x:d[0],y:d[1]}}))}}else if(e.hoverData.dragging){if(s=!0,l.panningEnabled()&&l.userPanningEnabled()){var N;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;N={x:(d[0]-B[0])*u,y:(d[1]-B[1])*u},e.hoverData.justStartedPan=!1}else N={x:w[0]*u,y:w[1]*u};l.panBy(N),e.hoverData.dragged=!0}d=e.projectIntoViewport(i.clientX,i.clientY)}else if(1!=f[4]||null!=x&&!x.isEdge()){if(x&&x.isEdge()&&x.active()&&x.unactivate(),x&&x.grabbed()||v==b||(b&&t(b,["mouseout","tapdragout"],i,{position:{x:d[0],y:d[1]}}),v&&t(v,["mouseover","tapdragover"],i,{position:{x:d[0],y:d[1]}}),e.hoverData.last=v),x)if(m){if(l.boxSelectionEnabled()&&_)x&&x.grabbed()&&(y(E),x.emit("free")),M();else if(x&&x.grabbed()&&e.nodeIsDraggable(x)){var z=!e.dragData.didDrag;z&&e.redrawHint("eles",!0),e.dragData.didDrag=!0;var L=[];e.hoverData.draggingEles||g(l.collection(E),{inDragLayer:!0});for(var A=0;A0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=l=[]),t(s,["mouseup","tapend","vmouseup"],r,{position:{x:a[0],y:a[1]}}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||t(u,["click","tap","vclick"],r,{position:{x:a[0],y:a[1]}}),s!=u||e.dragData.didDrag||e.hoverData.selecting||null!=s&&s._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||c?s.selected()?s.unselect():s.select():c||(i.$(":selected").unmerge(s).unselect(),s.select())),e.redrawHint("eles",!0)),e.hoverData.selecting){var p=i.collection(e.getAllInBox(o[0],o[1],o[2],o[3]));e.redrawHint("select",!0),p.length>0&&e.redrawHint("eles",!0),i.emit("boxend");var f=function(e){return e.selectable()&&!e.selected()};"additive"===i.selectionType()?p.emit("box").stdFilter(f).select().emit("boxselect"):(c||i.$(":selected").unmerge(p).unselect(),p.emit("box").stdFilter(f).select().emit("boxselect")),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!o[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var v=u&&u.grabbed();y(l),v&&u.emit("free")}}o[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}},!1);var C=function(t){if(!e.scrollingPage){var n=e.cy,r=e.projectIntoViewport(t.clientX,t.clientY),i=[r[0]*n.zoom()+n.pan().x,r[1]*n.zoom()+n.pan().y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||P())return void t.preventDefault();if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){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);var a;a=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,a*=e.wheelSensitivity;1===t.deltaMode&&(a*=33),n.zoom({level:n.zoom()*Math.pow(10,a),renderedPosition:{x:i[0],y:i[1]}})}}};e.registerBinding(e.container,"wheel",C,!0),e.registerBinding(window,"scroll",function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!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 S,D,k,_,M,I,N,B,z,L,A,O,R,V,q=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},F=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};e.registerBinding(e.container,"touchstart",V=function(n){if(T(n)){e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(n.touches[0]){var o=e.projectIntoViewport(n.touches[0].clientX,n.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(n.touches[1]){var o=e.projectIntoViewport(n.touches[1].clientX,n.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(n.touches[2]){var o=e.projectIntoViewport(n.touches[2].clientX,n.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(n.touches[1]){y(e.dragData.touchDragEles);var s=e.findContainerClientCoords();z=s[0],L=s[1],A=s[2],O=s[3],S=n.touches[0].clientX-z,D=n.touches[0].clientY-L,k=n.touches[1].clientX-z,_=n.touches[1].clientY-L,R=0<=S&&S<=A&&0<=k&&k<=A&&0<=D&&D<=O&&0<=_&&_<=O;var l=r.pan(),u=r.zoom();M=q(S,D,k,_),I=F(S,D,k,_),N=[(S+k)/2,(D+_)/2],B=[(N[0]-l.x)/u,(N[1]-l.y)/u];if(I<4e4&&!n.touches[2]){var c=e.findNearestElement(i[0],i[1],!0,!0),d=e.findNearestElement(i[2],i[3],!0,!0);return c&&c.isNode()?(c.activate().emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=c):d&&d.isNode()?(d.activate().emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=d):r.emit({originalEvent:n,type:"cxttapstart",position:{x:i[0],y:i[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(n.touches[2]);else if(n.touches[1]);else if(n.touches[0]){var p=e.findNearestElements(i[0],i[1],!0,!0),f=p[0];if(null!=f&&(f.activate(),e.touchData.start=f,e.touchData.starts=p,e.nodeIsGrabbable(f))){var v=e.dragData.touchDragEles=[],b=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),f.selected()?(b=r.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),g(b,{addToList:v})):m(f,{addToList:v}),h(f);var x=function(e){return{originalEvent:n,type:e,position:{x:i[0],y:i[1]}}};f.emit(x("grabon")),b?b.forEach(function(e){e.emit(x("grab"))}):f.emit(x("grab"))}t(f,["touchstart","tapstart","vmousedown"],n,{position:{x:i[0],y:i[1]}}),null==f&&(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||(t(e.touchData.start,["taphold"],n,{position:{x:i[0],y:i[1]}}),e.touchData.start||r.$(":selected").unselect())},e.tapholdDuration)}if(n.touches.length>=1){for(var w=e.touchData.startPosition=[],E=0;E=e.touchTapThreshold2}if(i&&e.touchData.cxt){n.preventDefault();var E=n.touches[0].clientX-z,P=n.touches[0].clientY-L,C=n.touches[1].clientX-z,N=n.touches[1].clientY-L,A=F(E,P,C,N),O=A/I;if(O>=2.25||A>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var V={originalEvent:n,type:"cxttapend",position:{x:u[0],y:u[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(V),e.touchData.start=null):l.emit(V)}}if(i&&e.touchData.cxt){var V={originalEvent:n,type:"cxtdrag",position:{x:u[0],y:u[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(V):l.emit(V),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var j=e.findNearestElement(u[0],u[1],!0,!0);e.touchData.cxtOver&&j===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:n,type:"cxtdragout",position:{x:u[0],y:u[1]}}),e.touchData.cxtOver=j,j&&j.emit({originalEvent:n,type:"cxtdragover",position:{x:u[0],y:u[1]}}))}else if(i&&n.touches[2]&&l.boxSelectionEnabled())n.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||l.emit("boxstart"),e.touchData.selecting=!0,e.redrawHint("select",!0),s&&0!==s.length&&void 0!==s[0]?(s[2]=(u[0]+u[2]+u[4])/3,s[3]=(u[1]+u[3]+u[5])/3):(s[0]=(u[0]+u[2]+u[4])/3,s[1]=(u[1]+u[3]+u[5])/3,s[2]=(u[0]+u[2]+u[4])/3+1,s[3]=(u[1]+u[3]+u[5])/3+1),s[4]=1,e.touchData.selecting=!0,e.redraw();else if(i&&n.touches[1]&&l.zoomingEnabled()&&l.panningEnabled()&&l.userZoomingEnabled()&&l.userPanningEnabled()){n.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var X=e.dragData.touchDragEles;if(X){e.redrawHint("drag",!0);for(var Y=0;Y0)return v[0]}return null}(e,t,v);if(null!=g){var m=v[5],y=v[3],b=v[1],x=r.qbezierAt(m,y,b,g);if(v.isTop&&x<=t)return!0;if(v.isBottom&&t<=x)return!0}}return!1}}},i.generateBottomRoundrectangle=function(){return this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottomroundrectangle",points:r.generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,i,a,o,s){var l=e-(n/2+s),u=t-(i/2+s),c=u,d=e+(n/2+s),h=r.finiteLinesIntersect(a,o,e,t,l,u,d,c,!1);return h.length>0?h:r.roundRectangleIntersectLine(a,o,e,t,n,i,s)},checkPoint:function(e,t,n,i,a,o,s){var l=r.getRoundRectangleRadius(i,a),u=2*l;if(r.pointInsidePolygon(e,t,this.points,o,s,i,a-u,[0,-1],n))return!0;if(r.pointInsidePolygon(e,t,this.points,o,s,i-u,a,[0,-1],n))return!0;var c=i/2+2*n,d=a/2+2*n,h=[o-c,s-d,o-c,s,o+c,s,o+c,s-d];return!!r.pointInsidePolygonPoints(e,t,h)||(!!r.checkInEllipse(e,t,u,u,o+i/2-l,s+a/2-l,n)||!!r.checkInEllipse(e,t,u,u,o-i/2+l,s+a/2-l,n))}}},i.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",r.generateUnitNgonPointsFitToSquare(3,0)),this.generatePolygon("rectangle",r.generateUnitNgonPointsFitToSquare(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle(),this.generatePolygon("diamond",[0,1,1,0,0,-1,-1,0]),this.generatePolygon("pentagon",r.generateUnitNgonPointsFitToSquare(5,0)),this.generatePolygon("hexagon",r.generateUnitNgonPointsFitToSquare(6,0)),this.generatePolygon("heptagon",r.generateUnitNgonPointsFitToSquare(7,0)),this.generatePolygon("octagon",r.generateUnitNgonPointsFitToSquare(8,0));var n=new Array(20),i=r.generateUnitNgonPoints(5,0),a=r.generateUnitNgonPoints(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:p;e.lineWidth=v,e.lineCap="butt",i.strokeStyle(e,h[0],h[1],h[2],n),i.drawEdgePath(t,e,a.allpts,f)},m=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p;i.drawArrowheads(e,t,n)};e.lineJoin="round";if("yes"===t.pstyle("ghost").value){var y=t.pstyle("ghost-offset-x").pfValue,b=t.pstyle("ghost-offset-y").pfValue,x=t.pstyle("ghost-opacity").value,w=p*x;e.translate(y,b),g(w),m(w),e.translate(-y,-b)}g(),m(),function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c;e.lineWidth=u,"self"!==a.edgeType||o?e.lineCap="round":e.lineCap="butt",i.strokeStyle(e,d[0],d[1],d[2],n),i.drawEdgePath(t,e,a.allpts,"solid")}(),function(){i.drawElementText(e,t,r)}(),n&&e.translate(s.x1,s.y1)}},r.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o=void 0,s=!1,l=this.usePaths();if(l){var u=n.join("$");i.pathCacheKey&&i.pathCacheKey===u?(o=t=i.pathCache,s=!0):(o=t=new Path2D,i.pathCacheKey=u,i.pathCache=o)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash([6,3]);break;case"solid":a.setLineDash([])}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var c=2;c+30||S>0&&C>0){var k=l-D;switch(y){case"left":k-=h;break;case"center":k-=h/2}var _=u-p-D,M=h+2*D,I=p+2*D;if(T>0){var N=e.fillStyle,B=t.pstyle("text-background-color").value;e.fillStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+T*s+")";"roundrectangle"==t.pstyle("text-background-shape").strValue?r(e,k,_,M,I,2):e.fillRect(k,_,M,I),e.fillStyle=N}if(S>0&&C>0){var z=e.strokeStyle,L=e.lineWidth,A=t.pstyle("text-border-color").value,O=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+C*s+")",e.lineWidth=S,e.setLineDash)switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=S/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(k,_,M,I),"double"===O){var R=S/2;e.strokeRect(k+R,_+R,M-2*R,I-2*R)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=z}}var V=2*t.pstyle("text-outline-width").pfValue;if(V>0&&(e.lineWidth=V),"wrap"===t.pstyle("text-wrap").value){var q=i.getPrefixedProperty(o,"labelWrapCachedLines",n),F=p/q.length;switch(b){case"top":u-=(q.length-1)*F;break;case"center":case"bottom":u-=(q.length-1)*F}for(var j=0;j0&&e.strokeText(q[j],l,u),e.fillText(q[j],l,u),u+=F}else V>0&&e.strokeText(c,l,u),e.fillText(c,l,u);0!==x&&(e.rotate(-x),e.translate(-E,-P))}}},e.exports=o},function(e,t,n){"use strict";var r=n(0),i={};i.drawNode=function(e,t,n,i){var a=this,o=void 0,s=void 0,l=t._private,u=l.rscratch,c=t.position();if(r.number(c.x)&&r.number(c.y)&&t.visible()){var d=t.effectiveOpacity(),h=a.usePaths(),p=void 0,f=!1,v=t.padding();o=t.width()+2*v,s=t.height()+2*v;var g=void 0;n&&(g=n,e.translate(-g.x1,-g.y1));for(var m=t.pstyle("background-image"),y=m.value,b=new Array(y.length),x=new Array(y.length),w=0,E=0;E0&&void 0!==arguments[0]?arguments[0]:k;a.fillStyle(e,D[0],D[1],D[2],t)},B=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:I;a.strokeStyle(e,_[0],_[1],_[2],t)},z=t.pstyle("shape").strValue,L=t.pstyle("shape-polygon-points").pfValue;if(h){var A=z+"$"+o+"$"+s+("polygon"===z?"$"+L.join("$"):"");e.translate(c.x,c.y),u.pathCacheKey===A?(p=u.pathCache,f=!0):(p=new Path2D,u.pathCacheKey=A,u.pathCache=p)}var O=function(){if(!f){var n=c;h&&(n={x:0,y:0}),a.nodeShapes[a.getNodeShape(t)].draw(p||e,n.x,n.y,o,s)}h?e.fill(p):e.fill()},R=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,r=l.backgrounding,i=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;a.hasPie(t)&&(a.drawPie(e,t,r),n&&(h||a.nodeShapes[a.getNodeShape(t)].draw(e,c.x,c.y,o,s)))},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,n=(C>0?C:-C)*t,r=C>0?0:255;0!==C&&(a.fillStyle(e,r,r,r,n),h?e.fill(p):e.fill())},F=function(){if(S>0){if(e.lineWidth=S,e.lineCap="butt",e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(h?e.stroke(p):e.stroke(),"double"===M){e.lineWidth=S/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",h?e.stroke(p):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var j=t.pstyle("ghost-offset-x").pfValue,X=t.pstyle("ghost-offset-y").pfValue,Y=t.pstyle("ghost-opacity").value,W=Y*d;e.translate(j,X),N(Y*k),O(),R(W),V(0!==C||0!==S),q(W),B(Y*I),F(),e.translate(-j,-X)}N(),O(),R(),V(0!==C||0!==S),q(),B(),F(),h&&e.translate(-c.x,-c.y),function(){a.drawElementText(e,t,i)}(),function(){var n=t.pstyle("overlay-padding").pfValue,r=t.pstyle("overlay-opacity").value,i=t.pstyle("overlay-color").value;r>0&&(a.fillStyle(e,i[0],i[1],i[2],r),a.nodeShapes.roundrectangle.draw(e,c.x,c.y,o+2*n,s+2*n),e.fill())}(),n&&e.translate(g.x1,g.y1)}},i.hasPie=function(e){return e=e[0],e._private.hasPie},i.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,d=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,v=t.pstyle("pie-"+h+"-background-opacity").value*n,g=p/100;g+d>1&&(g=1-d);var m=1.5*Math.PI+2*Math.PI*d,y=2*Math.PI*g,b=m+y;0===p||d>=1||d+g>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,m,b),e.closePath(),this.fillStyle(e,f[0],f[1],f[2],v),e.fill(),d+=g)}},e.exports=i},function(e,t,n){"use strict";var r={},i=n(1);r.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},r.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;iu.minMbLowQualFrames&&(u.motionBlurPxRatio=u.mbPxRBlurry)),u.clearingMotionBlur&&(u.motionBlurPxRatio=1),u.textureDrawLastFrame&&!f&&(p[u.NODE]=!0,p[u.SELECT_BOX]=!0);var w=d.style()._private.coreStyle,E=d.zoom(),P=void 0!==s?s:E,T=d.pan(),C={x:T.x,y:T.y},S={zoom:E,pan:{x:T.x,y:T.y}},D=u.prevViewport;void 0===D||S.zoom!==D.zoom||S.pan.x!==D.pan.x||S.pan.y!==D.pan.y||y&&!m||(u.motionBlurPxRatio=1),l&&(C=l),P*=c,C.x*=c,C.y*=c;var k=u.getCachedZSortedEles();if(f||(u.textureDrawLastFrame=!1),f){u.textureDrawLastFrame=!0;if(!u.textureCache){u.textureCache={},u.textureCache.bb=d.mutableElements().boundingBox(),u.textureCache.texture=u.data.bufferCanvases[u.TEXTURE_BUFFER];var _=u.data.bufferContexts[u.TEXTURE_BUFFER];_.setTransform(1,0,0,1,0,0),_.clearRect(0,0,u.canvasWidth*u.textureMult,u.canvasHeight*u.textureMult),u.render({forcedContext:_,drawOnlyNodeLayer:!0,forcedPxRatio:c*u.textureMult});var S=u.textureCache.viewport={zoom:d.zoom(),pan:d.pan(),width:u.canvasWidth,height:u.canvasHeight};S.mpan={x:(0-S.pan.x)/S.zoom,y:(0-S.pan.y)/S.zoom}}p[u.DRAG]=!1,p[u.NODE]=!1;var M=h.contexts[u.NODE],I=u.textureCache.texture,S=u.textureCache.viewport;u.textureCache.bb,M.setTransform(1,0,0,1,0,0),v?t(M,0,0,S.width,S.height):M.clearRect(0,0,S.width,S.height);var N=w["outside-texture-bg-color"].value,B=w["outside-texture-bg-opacity"].value;u.fillStyle(M,N[0],N[1],N[2],B),M.fillRect(0,0,S.width,S.height);var E=d.zoom();n(M,!1),M.clearRect(S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c),M.drawImage(I,S.mpan.x,S.mpan.y,S.width/S.zoom/c,S.height/S.zoom/c)}else u.textureOnViewport&&!r&&(u.textureCache=null);var z=d.extent(),L=u.pinching||u.hoverData.dragging||u.swipePanning||u.data.wheelZooming||u.hoverData.draggingEles,A=u.hideEdgesOnViewport&&L,O=[];if(O[u.NODE]=!p[u.NODE]&&v&&!u.clearedForMotionBlur[u.NODE]||u.clearingMotionBlur,O[u.NODE]&&(u.clearedForMotionBlur[u.NODE]=!0),O[u.DRAG]=!p[u.DRAG]&&v&&!u.clearedForMotionBlur[u.DRAG]||u.clearingMotionBlur,O[u.DRAG]&&(u.clearedForMotionBlur[u.DRAG]=!0),p[u.NODE]||a||o||O[u.NODE]){var R=v&&!O[u.NODE]&&1!==g,M=r||(R?u.data.bufferContexts[u.MOTIONBLUR_BUFFER_NODE]:h.contexts[u.NODE]);n(M,v&&!R?"motionBlur":void 0),A?u.drawCachedNodes(M,k.nondrag,c,z):u.drawLayeredElements(M,k.nondrag,c,z),u.debug&&u.drawDebugPoints(M,k.nondrag),a||v||(p[u.NODE]=!1)}if(!o&&(p[u.DRAG]||a||O[u.DRAG])){var R=v&&!O[u.DRAG]&&1!==g,M=r||(R?u.data.bufferContexts[u.MOTIONBLUR_BUFFER_DRAG]:h.contexts[u.DRAG]);n(M,v&&!R?"motionBlur":void 0),A?u.drawCachedNodes(M,k.drag,c,z):u.drawCachedElements(M,k.drag,c,z),u.debug&&u.drawDebugPoints(M,k.drag),a||v||(p[u.DRAG]=!1)}if(u.showFps||!o&&p[u.SELECT_BOX]&&!a){var M=r||h.contexts[u.SELECT_BOX];if(n(M),1==u.selection[4]&&(u.hoverData.selecting||u.touchData.selecting)){var E=u.cy.zoom(),V=w["selection-box-border-width"].value/E;M.lineWidth=V,M.fillStyle="rgba("+w["selection-box-color"].value[0]+","+w["selection-box-color"].value[1]+","+w["selection-box-color"].value[2]+","+w["selection-box-opacity"].value+")",M.fillRect(u.selection[0],u.selection[1],u.selection[2]-u.selection[0],u.selection[3]-u.selection[1]),V>0&&(M.strokeStyle="rgba("+w["selection-box-border-color"].value[0]+","+w["selection-box-border-color"].value[1]+","+w["selection-box-border-color"].value[2]+","+w["selection-box-opacity"].value+")",M.strokeRect(u.selection[0],u.selection[1],u.selection[2]-u.selection[0],u.selection[3]-u.selection[1]))}if(h.bgActivePosistion&&!u.hoverData.selecting){var E=u.cy.zoom(),q=h.bgActivePosistion;M.fillStyle="rgba("+w["active-bg-color"].value[0]+","+w["active-bg-color"].value[1]+","+w["active-bg-color"].value[2]+","+w["active-bg-opacity"].value+")",M.beginPath(),M.arc(q.x,q.y,w["active-bg-size"].pfValue/E,0,2*Math.PI),M.fill()}var F=u.lastRedrawTime;if(u.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);M.setTransform(1,0,0,1,0,0),M.fillStyle="rgba(255, 0, 0, 0.75)",M.strokeStyle="rgba(255, 0, 0, 0.75)",M.lineWidth=1,M.fillText("1 frame = "+F+" ms = "+j+" fps",0,20);M.strokeRect(0,30,250,20),M.fillRect(0,30,250*Math.min(j/60,1),20)}a||(p[u.SELECT_BOX]=!1)}if(v&&1!==g){var X=h.contexts[u.NODE],Y=u.data.bufferCanvases[u.MOTIONBLUR_BUFFER_NODE],W=h.contexts[u.DRAG],H=u.data.bufferCanvases[u.MOTIONBLUR_BUFFER_DRAG],Z=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!x?e.clearRect(0,0,u.canvasWidth,u.canvasHeight):t(e,0,0,u.canvasWidth,u.canvasHeight);var i=g;e.drawImage(n,0,0,u.canvasWidth*i,u.canvasHeight*i,0,0,u.canvasWidth,u.canvasHeight)};(p[u.NODE]||O[u.NODE])&&(Z(X,Y,O[u.NODE]),p[u.NODE]=!1),(p[u.DRAG]||O[u.DRAG])&&(Z(W,H,O[u.DRAG]),p[u.DRAG]=!1)}u.prevViewport=S,u.clearingMotionBlur&&(u.clearingMotionBlur=!1,u.motionBlurCleared=!0,u.motionBlur=!0),v&&(u.motionBlurTimeout=setTimeout(function(){u.motionBlurTimeout=null,u.clearedForMotionBlur[u.NODE]=!1,u.clearedForMotionBlur[u.DRAG]=!1,u.motionBlur=!1,u.clearingMotionBlur=!f,u.mbFrames=0,p[u.NODE]=!0,p[u.DRAG]=!0,u.redraw()},100)),r||d.emit("render")},e.exports=r},function(e,t,n){"use strict";var r=n(2),i={};i.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=3.99||i>2)return null;var d=Math.pow(2,i),h=t.h*d,p=t.w*d,f=u.imgCaches=u.imgCaches||{},v=f[i];if(v)return v;var g;if(g=h<=25?25:h<=50?50:50*Math.ceil(h/50),h>1024||p>1024||e.isEdge()||e.isParent())return null;var m=o.getTextureQueue(g),y=m[m.length-2],b=function(){return o.recycleTexture(g,p)||o.addTexture(g,p)};y||(y=m[m.length-1]),y||(y=b()),y.width-y.usedWidthi;S--)k=o.getElement(e,t,n,S,s.downscale);_()}else{var M;if(!P&&!T&&!C)for(var S=i-1;S>=-4;S--){var D=f[S];if(D){M=D;break}}if(E(M))return o.queueElement(e,t,i),M;y.context.translate(y.usedWidth,0),y.context.scale(d,d),l.drawElement(y.context,e,t,w),y.context.scale(1/d,1/d),y.context.translate(-y.usedWidth,0)}return v=f[i]={ele:e,x:y.usedWidth,texture:y,level:i,scale:d,width:p,height:h,scaledLabelShown:w},y.usedWidth+=Math.ceil(p+8),y.eleCaches.push(v),o.checkTextureFullness(y),v},u.invalidateElement=function(e){var t=this,n=e._private.rscratch.imgCaches;if(n)for(var r=-4;r<=2;r++){var a=n[r];if(a){var o=a.texture;o.invalidatedWidth+=a.width,n[r]=null,i.removeFromArray(o.eleCaches,a),t.checkTextureUtility(o)}}},u.checkTextureUtility=function(e){e.invalidatedWidth>=.5*e.width&&this.retireTexture(e)},u.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?i.removeFromArray(n,e):e.fullnessChecks++},u.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n);i.removeFromArray(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,i.clearArray(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),i.removeFromArray(a,s),r.push(s),s}},u.queueElement=function(e,t,n){var i=this,a=i.getElementQueue(),o=i.getElementIdToQueue(),s=e.id(),l=o[s];if(l)l.level=Math.max(l.level,n),l.reqs++,a.updateItem(l);else{var u={ele:e,bb:t,position:r.copyPosition(e.position()),level:n,reqs:1};e.isEdge()&&(u.positions={source:r.copyPosition(e.source().position()),target:r.copyPosition(e.target().position())}),a.push(u),o[s]=u}},u.dequeue=function(e){for(var t=this,n=t.getElementQueue(),i=t.getElementIdToQueue(),a=[],o=0;o<1&&n.size()>0;o++){var l=n.pop();i[l.ele.id()]=null,a.push(l);var u,c=l.ele;u=(!c.isEdge()||r.arePositionsSame(c.source().position(),l.positions.source)&&r.arePositionsSame(c.target().position(),l.positions.target))&&r.arePositionsSame(c.position(),l.position)?l.bb:c.boundingBox(),t.getElement(l.ele,u,e,l.level,s.dequeue)}return a},u.onDequeue=function(e){this.onDequeues.push(e)},u.offDequeue=function(e){i.removeFromArray(this.onDequeues,e)},u.setupDequeueing=o.setupDequeueing({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n0&&s>0){f.clearRect(0,0,a,s),f.globalCompositeOperation="source-over";var v=this.getCachedZSortedEles();if(e.full)f.translate(-r.x1*c,-r.y1*c),f.scale(c,c),this.drawElements(f,v),f.scale(1/c,1/c),f.translate(r.x1*c,r.y1*c);else{var g=t.pan(),m={x:g.x*c,y:g.y*c};c*=t.zoom(),f.translate(m.x,m.y),f.scale(c,c),this.drawElements(f,v),f.scale(1/c,1/c),f.translate(-m.x,-m.y)}e.bg&&(f.globalCompositeOperation="destination-over",f.fillStyle=e.bg,f.rect(0,0,a,s),f.fill())}return p},s.png=function(e){return a(e,this.bufferCanvasImage(e),"image/png")},s.jpg=function(e){return a(e,this.bufferCanvasImage(e),"image/jpeg")},e.exports=s},function(e,t,n){"use strict";function r(e){var t=this;t.data={canvases:new Array(u.CANVAS_LAYERS),contexts:new Array(u.CANVAS_LAYERS),canvasNeedsRedraw:new Array(u.CANVAS_LAYERS),bufferCanvases:new Array(u.BUFFER_COUNT),bufferContexts:new Array(u.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color: rgba(0,0,0,0);";t.data.canvasContainer=document.createElement("div");var r=t.data.canvasContainer.style;t.data.canvasContainer.setAttribute("style",n),r.position="relative",r.zIndex="0",r.overflow="hidden";var i=e.cy.container();i.appendChild(t.data.canvasContainer),(i.getAttribute("style")||"").indexOf(n)<0&&i.setAttribute("style",(i.getAttribute("style")||"")+n);for(var l=0;l0&&t.data.lyrTxrCache.invalidateElements(n)})}var i=n(1),a=n(0),o=n(110),s=n(113),l=r,u=r.prototype;u.CANVAS_LAYERS=3,u.SELECT_BOX=0,u.DRAG=1,u.NODE=2,u.BUFFER_COUNT=3,u.TEXTURE_BUFFER=0,u.MOTIONBLUR_BUFFER_NODE=1,u.MOTIONBLUR_BUFFER_DRAG=2,u.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[u.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[u.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[u.SELECT_BOX]=t}};var c="undefined"!=typeof Path2D;u.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},u.usePaths=function(){return c&&this.pathsEnabled},[n(102),n(104),n(103),n(105),n(106),n(107),n(108),n(109),n(111),n(114)].forEach(function(e){i.extend(u,e)}),e.exports=l},function(e,t,n){"use strict";function r(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)}var i=n(1),a=n(2),o=n(8),s=n(0),l=n(16),u=function(e,t){var n=this,r=n.renderer=e;n.layersByLevel={},n.firstGet=!0,n.lastInvalidationTime=i.performanceNow()-500,n.skipping=!1,r.beforeRender(function(e,t){t-n.lastInvalidationTime<=250?n.skipping=!0:n.skipping=!1});var a=function(e,t){return t.reqs-e.reqs};n.layersQueue=new o(a),n.eleTxrCache=t,n.setupEleCacheInvalidation(),n.setupDequeueing()},c=u.prototype,d=0,h=Math.pow(2,53)-1;c.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=document.createElement("canvas");a.width=r,a.height=i;var o={id:d=++d%h,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},c.getLayers=function(e,t,n){var r=this,o=r.renderer,s=o.cy,l=s.zoom(),u=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(a.log2(l*t)))<-4)n=-4;else if(l>=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var c,d,h=r.layersByLevel,p=Math.pow(2,n),f=h[n]=h[n]||[],v=r.levelIsComplete(n,e);if(v)return f;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return d=h[t],!0},a=function(e){if(!d)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};a(1),a(-1);for(var o=f.length-1;o>=0;o--){var s=f[o];s.invalid&&i.removeFromArray(f,s)}}();var g=function(){if(!c){c=a.makeBoundingBox();for(var t=0;t=y||!a.boundingBoxInBoundingBox(m.bb,w.boundingBox()))&&!(m=function(e){e=e||{};var t=e.after;if(g(),c.w*p*(c.h*p)>16e6)return null;var i=r.makeLayer(c,n);if(null!=t){var a=f.indexOf(t)+1;f.splice(a,0,i)}else(void 0===e.insert||e.insert)&&f.unshift(i);return i}({insert:!0,after:m})))return null;d||b?r.queueLayer(m,w):r.drawEleInLayer(m,w,n,t),m.eles.push(w),P[n]=m}}return d||(b?null:f)},c.getEleLevelForLayerLevel=function(e,t){return e},c.drawEleInLayer=function(e,t,n,i){var a=this,o=this.renderer,s=e.context,l=t.boundingBox();if(0!==l.w&&0!==l.h&&t.visible()){var u=a.eleTxrCache,c=u.reasons.highQuality;n=a.getEleLevelForLayerLevel(n,i);var d=u.getElement(t,l,null,n,c);d?(r(s,!1),s.drawImage(d.texture.canvas,d.x,0,d.width,d.height,l.x1,l.y1,l.w,l.h),r(s,!0)):o.drawElement(s,t)}},c.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||0===r.length)return!1;for(var i=0,a=0;a0)return!1;if(o.invalid)return!1;i+=o.eles.length}return i===t.length},c.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){t=!0;break}}return t},c.invalidateElements=function(e){var t=this;t.lastInvalidationTime=i.performanceNow(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)})},c.invalidateLayer=function(e){if(this.lastInvalidationTime=i.performanceNow(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];i.removeFromArray(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a=0&&(d=d.toLowerCase(),h=h.toLowerCase(),o=o.replace("@",""),p=!0);var f=!1;o.indexOf("!")>=0&&(o=o.replace("!",""),f=!0),p&&(s=h.toLowerCase(),c=d.toLowerCase());var v=!1;switch(o){case"*=":u=d.indexOf(h)>=0;break;case"$=":u=d.indexOf(h,d.length-h.length)>=0;break;case"^=":u=0===d.indexOf(h);break;case"=":u=c===s;break;case">":v=!0,u=c>s;break;case">=":v=!0,u=c>=s;break;case"<":v=!0,u=c\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:'"(?:\\\\"|[^"])*"|'+"'(?:\\\\'|[^'])*'",number:r.regex.number,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};i.variable="(?:[\\w-]|(?:\\\\"+i.metaChar+"))+",i.value=i.string+"|"+i.number,i.className=i.variable,i.id=i.variable,function(){var e=void 0,t=void 0,n=void 0;for(e=i.comparatorOp.split("|"),n=0;n=0||"="!==t&&(i.comparatorOp+="|\\!"+t)}(),e.exports=i},function(e,t,n){"use strict";var r=n(1),i=n(0),a=n(5),o={};o.apply=function(e){var t=this,n=t._private,r=n.cy,i=r.collection();n.newStyle&&(n.contextStyles={},n.propDiffs={},t.cleanElements(e,!0));for(var a=0;a0;if(h||p){var f=void 0;h&&p?f=u.properties:h?f=u.properties:p&&(f=u.mappedProperties);for(var v=0;v0){r=!0;break}}t.hasPie=r;var o=e.pstyle("text-transform").strValue,s=e.pstyle("label").strValue,l=e.pstyle("source-label").strValue,u=e.pstyle("target-label").strValue,c=e.pstyle("font-style").strValue,d=e.pstyle("font-size").pfValue+"px",h=e.pstyle("font-family").strValue,p=e.pstyle("font-weight").strValue,f=e.pstyle("text-valign").strValue,v=e.pstyle("text-valign").strValue,g=e.pstyle("text-outline-width").pfValue,m=e.pstyle("text-wrap").strValue,y=e.pstyle("text-max-width").pfValue,b=c+"$"+d+"$"+h+"$"+p+"$"+o+"$"+f+"$"+v+"$"+g+"$"+m+"$"+y;t.labelStyleKey=b,t.sourceLabelKey=b+"$"+l,t.targetLabelKey=b+"$"+u,t.labelKey=b+"$"+s,t.fontKey=c+"$"+p+"$"+d+"$"+h,t.styleKey=Date.now()}},o.applyParsedProperty=function(e,t){var n=this,a=t,o=e._private.style,s=void 0,l=n.types,u=n.properties[a.name].type,c=a.bypass,d=o[a.name],h=d&&d.bypass,p=e._private,f=function(){n.checkZOrderTrigger(e,a.name,d?d.value:null,a.value)};if("curve-style"===t.name&&"haystack"===t.value&&e.isEdge()&&(e.isLoop()||e.source().isParent()||e.target().isParent())&&(a=t=this.parse(t.name,"bezier",c)),a.delete)return o[a.name]=void 0,f(),!0;if(a.deleteBypassed)return d?!!d.bypass&&(d.bypassed=void 0,f(),!0):(f(),!0);if(a.deleteBypass)return d?!!d.bypass&&(o[a.name]=d.bypassed,f(),!0):(f(),!0);var v=function(){r.error("Do not assign mappings to elements without corresponding data (e.g. ele `"+e.id()+"` for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case l.mapData:for(var g=a.field.split("."),m=p.data,y=0;y1&&(b=1),u.color){var x=a.valueMin[0],w=a.valueMax[0],E=a.valueMin[1],P=a.valueMax[1],T=a.valueMin[2],C=a.valueMax[2],S=null==a.valueMin[3]?1:a.valueMin[3],D=null==a.valueMax[3]?1:a.valueMax[3],k=[Math.round(x+(w-x)*b),Math.round(E+(P-E)*b),Math.round(T+(C-T)*b),Math.round(S+(D-S)*b)];s={bypass:a.bypass,name:a.name,value:k,strValue:"rgb("+k[0]+", "+k[1]+", "+k[2]+")"}}else{if(!u.number)return!1;var _=a.valueMin+(a.valueMax-a.valueMin)*b;s=this.parse(a.name,_,a.bypass,"mapping")}s||(s=this.parse(a.name,d.strValue,a.bypass,"mapping")),s||v(),s.mapping=a,a=s;break;case l.data:var M=a.field.split("."),I=p.data;if(I)for(var N=0;N0&&l>0){for(var c={},d=!1,h=0;h0?e.delayAnimation(u).play().promise().then(t):t()}).then(function(){return e.animation({style:c,duration:l,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(e,s),e.emitAndNotify("style"),o.transitioning=!1})}else o.transitioning&&(this.removeBypasses(e,s),e.emitAndNotify("style"),o.transitioning=!1)},o.checkZOrderTrigger=function(e,t,n,r){var i=this.properties[t];null==i.triggersZOrder||null!=n&&!i.triggersZOrder(n,r)||this._private.cy.notify({type:"zorder",eles:e})},e.exports=o},function(e,t,n){"use strict";var r=n(0),i=n(1),a={};a.applyBypass=function(e,t,n,a){var o=this,s=[];if("*"===t||"**"===t){if(void 0!==n)for(var l=0;lh.max||h.strictMax&&t===h.max))return null;var B={name:e,value:t,strValue:""+t+(_||""),units:_,bypass:n};return h.unitless||"px"!==_&&"em"!==_?B.pfValue=t:B.pfValue="px"!==_&&_?this.getEmSizeInPixels()*t:t,"ms"!==_&&"s"!==_||(B.pfValue="ms"===_?t:1e3*t),"deg"!==_&&"rad"!==_||(B.pfValue="rad"===_?t:a.deg2rad(t)),"%"===_&&(B.pfValue=t/100),B}if(h.propList){var z=[],L=""+t;if("none"===L);else{for(var A=L.split(","),O=0;O node").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3,"curve-style":"haystack"}).selector(":parent <-> node").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("node:parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}).selector("core").css({"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}),this.defaultLength=this.length},e.exports=a},function(e,t,n){"use strict";var r=n(1),i=n(6),a={};a.appendFromString=function(e){function t(){s=s.length>l.length?s.substr(l.length):""}function n(){u=u.length>c.length?u.substr(c.length):""}var a=this,o=this,s=""+e,l=void 0,u=void 0,c=void 0;for(s=s.replace(/[\/][*](\s|.)+?[*][\/]/g,"");;){if(s.match(/^\s*$/))break;var d=s.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!d){r.error("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+s);break}l=d[0];var h=d[1];if("core"!==h){if(new i(h)._private.invalid){r.error("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),t();continue}}var p=d[2],f=!1;u=p;for(var v=[];;){if(u.match(/^\s*$/))break;var g=u.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!g){r.error("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),f=!0;break}c=g[0];var m=g[1],y=g[2];if(a.properties[m]){o.parse(m,y)?(v.push({name:m,val:y}),n()):(r.error("Skipping property: Invalid property definition in: "+c),n())}else r.error("Skipping property: Invalid property name in: "+c),n()}if(f){t();break}o.selector(h);for(var b=0;b1&&(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 n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0,u=void 0,c=new RegExp("^"+this.regex.hsla+"$").exec(e);if(c){if(r=parseInt(c[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(i=parseFloat(c[2]))<0||i>100)return;if(i/=100,(a=parseFloat(c[3]))<0||a>100)return;if(a/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1))return;if(0===i)s=l=u=Math.round(255*a);else{var d=a<.5?a*(1+i):a+i-a*i,h=2*a-d;s=Math.round(255*t(h,d,r+1/3)),l=Math.round(255*t(h,d,r)),u=Math.round(255*t(h,d,r-1/3))}n=[s,l,u,o]}return n},rgb2tuple:function(e){var t=void 0,n=new RegExp("^"+this.regex.rgba+"$").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))<0||l>1)return;t.push(l)}}return t},colorname2tuple:function(e){return this.colors[e.toLowerCase()]},color2tuple:function(e){return(r.array(e)?e:null)||this.colorname2tuple(e)||this.hex2tuple(e)||this.rgb2tuple(e)||this.hsl2tuple(e)},colors:{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]}}},function(e,t,n){"use strict";var r=n(0);e.exports={mapEmpty:function(e){return null==e||0===Object.keys(e).length},pushMap:function(e){var t=this.getMap(e);null==t?this.setMap(this.extend({},e,{value:[e.value]})):t.push(e.value)},setMap:function(e){for(var t=e.map,n=e.keys,i=n.length,a=0;at?1:0}function i(e,t){return-1*r(e,t)}e.exports={sort:{ascending:r,descending:i}}},function(e,t,n){"use strict";var r=n(19),i=n(0);e.exports={camel2dash:r(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),dash2camel:r(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),prependCamel:r(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),capitalize:function(e){return i.emptyString(e)?e:e.charAt(0).toUpperCase()+e.substring(1)}}},function(e,t,n){"use strict";var r=n(4),i=r?r.performance:null,a={},o=i&&i.now?function(){return i.now()}:function(){return Date.now()},s=function(){if(r){if(r.requestAnimationFrame)return function(e){r.requestAnimationFrame(e)};if(r.mozRequestAnimationFrame)return function(e){r.mozRequestAnimationFrame(e)};if(r.webkitRequestAnimationFrame)return function(e){r.webkitRequestAnimationFrame(e)};if(r.msRequestAnimationFrame)return function(e){r.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(o())},1e3/60)}}();a.requestAnimationFrame=function(e){s(e)},a.performanceNow=o,a.debounce=n(139),a.now=function(){return Date.now()},e.exports=a},function(e,t,n){e.exports=n(138)},function(e,t,n){var r,i,a;(function(){var n,o,s,l,u,c,d,h,p,f,v,g,m,y,b;s=Math.floor,f=Math.min,o=function(e,t){return et?1:0},p=function(e,t,n,r,i){var a;if(null==n&&(n=0),null==i&&(i=o),n<0)throw new Error("lo must be non-negative");for(null==r&&(r=e.length);nn;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse(),l=[],r=0,i=a.length;rv;0<=v?++c:--c)g.push(u(e,n));return g},y=function(e,t,n,r){var i,a,s;for(null==r&&(r=o),i=e[n];n>t&&(s=n-1>>1,a=e[s],r(i,a)<0);)e[n]=a,n=s;return e[n]=i},b=function(e,t,n){var r,i,a,s,l;for(null==n&&(n=o),i=e.length,l=t,a=e[t],r=2*t+1;r=t||n<0||S&&r>=m}function c(){var e=E();if(u(e))return d(e);b=setTimeout(c,l(e))}function d(e){return b=void 0,D&&v?i(e):(v=g=void 0,y)}function h(){void 0!==b&&clearTimeout(b),T=0,v=P=g=b=void 0}function p(){return void 0===b?y:d(E())}function f(){var e=E(),n=u(e);if(v=arguments,g=this,P=e,n){if(void 0===b)return a(P);if(S)return b=setTimeout(c,t),i(P)}return void 0===b&&(b=setTimeout(c,t)),y}var v,g,m,y,b,P,T=0,C=!1,S=!1,D=!0;if("function"!=typeof e)throw new TypeError(s);return t=o(t)||0,r(n)&&(C=!!n.leading,S="maxWait"in n,m=S?x(o(n.maxWait)||0,t):m,D="trailing"in n?!!n.trailing:D),f.cancel=h,f.flush=p,f}function r(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==typeof e}function a(e){return"symbol"==typeof e||i(e)&&b.call(e)==u}function o(e){if("number"==typeof e)return e;if(a(e))return l;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(c,"");var n=h.test(e);return n||p.test(e)?f(e.slice(2),n?2:8):d.test(e)?l:+e}var s="Expected a function",l=NaN,u="[object Symbol]",c=/^\s+|\s+$/g,d=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,p=/^0o[0-7]+$/i,f=parseInt,v="object"==typeof t&&t&&t.Object===Object&&t,g="object"==typeof self&&self&&self.Object===Object&&self,m=v||g||Function("return this")(),y=Object.prototype,b=y.toString,x=Math.max,w=Math.min,E=function(){return m.Date.now()};e.exports=n}).call(t,n(20))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(d===clearTimeout)return clearTimeout(e);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function o(){v&&p&&(v=!1,p.length?f=p.concat(f):g=-1,f.length&&s())}function s(){if(!v){var e=i(o);v=!0;for(var t=f.length;t;){for(p=f,f=[];++g1)for(var n=1;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(141),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate}])});
\ No newline at end of file
diff --git a/package.json b/package.json
index 6e8229bc59..2fdd0f1cba 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cytoscape",
-  "version": "3.2.5",
+  "version": "3.2.6",
   "license": "MIT",
   "description": "Graph theory (a.k.a. network) library for analysis and visualisation",
   "homepage": "http://js.cytoscape.org",
diff --git a/src/version.js b/src/version.js
index 488adbe1ec..f3124f3440 100644
--- a/src/version.js
+++ b/src/version.js
@@ -1 +1 @@
-module.exports = "3.2.5";
+module.exports = "3.2.6";