text: /*! For license information please see module.js.LICENSE.txt */
  define(["lodash","app/plugins/sdk"],(function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=37)}([function(t,n){t.exports=e},function(e,t,n){var r,i,a;i=[],void 0===(a="function"==typeof(r=function(){"use strict";function e(e,t){var n,r,i;for(n=1,r=arguments.length;n<r;++n)if(null!=(t=arguments[n]))for(i in t)a(t,i)&&(e[i]=t[i]);return e}function t(e,t){return t.length-e.length}function n(e,t){return e.factor-t.factor}function r(e,t){var n;for(n in e)a(e,n)&&t(e[n],n)}var i,a=(i=Object.prototype.hasOwnProperty,function(e,t){return null!=e&&i.call(e,t)});function o(e,t){for(;"string"==typeof t;)t=e[t];return t}function s(e){this._prefixes=e;var i=[],o=[];r(e,(function(e,t){i.push(t.replace(/([.*+?=^!:${}()|[\]/\\])/g,"\\$1")),o.push({factor:e,prefix:t})}));var s=this._lcPrefixes={};r(e,(function(t,n){var r=n.toLowerCase();a(e,r)||(s[r]=n)})),o.sort(n),this._list=o,i.sort(t),this._regexp=new RegExp("^\\s*(-)?\\s*(\\d+(?:\\.\\d+)?)\\s*("+i.join("|")+")\\s*(.*)\\s*?$","i")}s.create=function(e,t,n){var r={};return void 0===n&&(n=0),function(e,t){var n,r;for(n=0,r=e.length;n<r;++n)t(e[n],n)}(e,(function(e,i){r[e]=Math.pow(t,i+n)})),new s(r)},s.prototype.findPrefix=function(e){for(var t,n=this._list,r=0,i=n.length-1;r!==i;)n[t=r+i+1>>1].factor>e?i=t-1:r=t;return n[r]},s.prototype.parse=function(e,t){var n=e.match(this._regexp);if(null!==n){var r,i=n[3];if(a(this._prefixes,i))r=this._prefixes[i];else{if(t||(i=i.toLowerCase(),!a(this._lcPrefixes,i)))return;i=this._lcPrefixes[i],r=this._prefixes[i]}var o=+n[2];return void 0!==n[1]&&(o=-o),{factor:r,prefix:i,unit:n[4],value:o}}};var l={binary:s.create(",Ki,Mi,Gi,Ti,Pi,Ei,Zi,Yi".split(","),1024),SI:s.create("y,z,a,f,p,n,µ,m,,k,M,G,T,P,E,Z,Y".split(","),1e3,-8)},u={decimals:2,separator:" ",unit:""},c={scale:"SI",strict:!1};function h(t,n){var r=p(t,n=e({},u,n));t=String(r.value);var i=r.prefix+n.unit;return""===i?t:t+n.separator+i}function d(e,t){var n=f(e,t);return n.value*n.factor}function f(t,n){if("string"!=typeof t)throw new TypeError("str must be a string");n=e({},c,n);var r=o(l,n.scale);if(void 0===r)throw new Error("missing scale");var i=r.parse(t,n.strict);if(void 0===i)throw new Error("cannot parse str");return i}function p(t,n){if(0===t)return{value:0,prefix:""};if(t<0){var r=p(-t,n);return r.value=-r.value,r}if("number"!=typeof t||Number.isNaN(t))throw new TypeError("value must be a number");n=e({},c,n);var i,s=o(l,n.scale);if(void 0===s)throw new Error("missing scale");var u=n.decimals;void 0!==u&&(i=Math.pow(10,u));var h,d=n.prefix;if(void 0!==d){if(!a(s._prefixes,d))throw new Error("invalid prefix");h=s._prefixes[d]}else{var f=s.findPrefix(t);if(void 0!==i)do{var v=(h=f.factor)/i;t=Math.round(t/v)*v}while((f=s.findPrefix(t)).factor!==h);else h=f.factor;d=f.prefix}return{prefix:d,value:void 0===i?t/h:Math.round(t*i/h)/i}}return h.parse=d,d.raw=f,h.raw=p,h.Scale=s,h})?r.apply(t,i):r)||(e.exports=a)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(10),a=n(7),o=n(8),s=n(3),l=n(4),u=n(13),c=n(14);function h(e){return void 0!==e.leaves||void 0!==e.groups}!function(e){e[e.start=0]="start",e[e.tick=1]="tick",e[e.end=2]="end"}(r=t.EventType||(t.EventType={}));var d=function(){function e(){var t=this;this._canvasSize=[1,1],this._linkDistance=20,this._defaultNodeSize=10,this._linkLengthCalculator=null,this._linkType=null,this._avoidOverlaps=!1,this._handleDisconnected=!0,this._running=!1,this._nodes=[],this._groups=[],this._rootGroup=null,this._links=[],this._constraints=[],this._distanceMatrix=null,this._descent=null,this._directedLinkConstraints=null,this._threshold=.01,this._visibilityGraph=null,this._groupCompactness=1e-6,this.event=null,this.linkAccessor={getSourceIndex:e.getSourceIndex,getTargetIndex:e.getTargetIndex,setLength:e.setLinkLength,getType:function(e){return"function"==typeof t._linkType?t._linkType(e):0}}}return e.prototype.on=function(e,t){return this.event||(this.event={}),"string"==typeof e?this.event[r[e]]=t:this.event[e]=t,this},e.prototype.trigger=function(e){this.event&&void 0!==this.event[e.type]&&this.event[e.type](e)},e.prototype.kick=function(){for(;!this.tick(););},e.prototype.tick=function(){if(this._alpha<this._threshold)return this._running=!1,this.trigger({type:r.end,alpha:this._alpha=0,stress:this._lastStress}),!0;var e,t,n=this._nodes.length;this._links.length;for(this._descent.locks.clear(),t=0;t<n;++t)if((e=this._nodes[t]).fixed){void 0!==e.px&&void 0!==e.py||(e.px=e.x,e.py=e.y);var i=[e.px,e.py];this._descent.locks.add(t,i)}var a=this._descent.rungeKutta();return 0===a?this._alpha=0:void 0!==this._lastStress&&(this._alpha=a),this._lastStress=a,this.updateNodePositions(),this.trigger({type:r.tick,alpha:this._alpha,stress:this._lastStress}),!1},e.prototype.updateNodePositions=function(){for(var e,t=this._descent.x[0],n=this._descent.x[1],r=this._nodes.length;r--;)(e=this._nodes[r]).x=t[r],e.y=n[r]},e.prototype.nodes=function(e){if(!e){if(0===this._nodes.length&&this._links.length>0){var t=0;this._links.forEach((function(e){t=Math.max(t,e.source,e.target)})),this._nodes=new Array(++t);for(var n=0;n<t;++n)this._nodes[n]={}}return this._nodes}return this._nodes=e,this},e.prototype.groups=function(e){var t=this;return e?(this._groups=e,this._rootGroup={},this._groups.forEach((function(e){void 0===e.padding&&(e.padding=1),void 0!==e.leaves&&e.leaves.forEach((function(n,r){"number"==typeof n&&((e.leaves[r]=t._nodes[n]).parent=e)})),void 0!==e.groups&&e.groups.forEach((function(n,r){"number"==typeof n&&((e.groups[r]=t._groups[n]).parent=e)}))})),this._rootGroup.leaves=this._nodes.filter((function(e){return void 0===e.parent})),this._rootGroup.groups=this._groups.filter((function(e){return void 0===e.parent})),this):this._groups},e.prototype.powerGraphGroups=function(e){var t=i.getGroups(this._nodes,this._links,this.linkAccessor,this._rootGroup);return this.groups(t.groups),e(t),this},e.prototype.avoidOverlaps=function(e){return arguments.length?(this._avoidOverlaps=e,this):this._avoidOverlaps},e.prototype.handleDisconnected=function(e){return arguments.length?(this._handleDisconnected=e,this):this._handleDisconnected},e.prototype.flowLayout=function(e,t){return arguments.length||(e="y"),this._directedLinkConstraints={axis:e,getMinSeparation:"number"==typeof t?function(){return t}:t},this},e.prototype.links=function(e){return arguments.length?(this._links=e,this):this._links},e.prototype.constraints=function(e){return arguments.length?(this._constraints=e,this):this._constraints},e.prototype.distanceMatrix=function(e){return arguments.length?(this._distanceMatrix=e,this):this._distanceMatrix},e.prototype.size=function(e){return e?(this._canvasSize=e,this):this._canvasSize},e.prototype.defaultNodeSize=function(e){return e?(this._defaultNodeSize=e,this):this._defaultNodeSize},e.prototype.groupCompactness=function(e){return e?(this._groupCompactness=e,this):this._groupCompactness},e.prototype.linkDistance=function(e){return e?(this._linkDistance="function"==typeof e?e:+e,this._linkLengthCalculator=null,this):this._linkDistance},e.prototype.linkType=function(e){return this._linkType=e,this},e.prototype.convergenceThreshold=function(e){return e?(this._threshold="function"==typeof e?e:+e,this):this._threshold},e.prototype.alpha=function(e){return arguments.length?(e=+e,this._alpha?this._alpha=e>0?e:0:e>0&&(this._running||(this._running=!0,this.trigger({type:r.start,alpha:this._alpha=e}),this.kick())),this):this._alpha},e.prototype.getLinkLength=function(e){return"function"==typeof this._linkDistance?+this._linkDistance(e):this._linkDistance},e.setLinkLength=function(e,t){e.length=t},e.prototype.getLinkType=function(e){return"function"==typeof this._linkType?this._linkType(e):0},e.prototype.symmetricDiffLinkLengths=function(e,t){var n=this;return void 0===t&&(t=1),this.linkDistance((function(t){return e*t.length})),this._linkLengthCalculator=function(){return a.symmetricDiffLinkLengths(n._links,n.linkAccessor,t)},this},e.prototype.jaccardLinkLengths=function(e,t){var n=this;return void 0===t&&(t=1),this.linkDistance((function(t){return e*t.length})),this._linkLengthCalculator=function(){return a.jaccardLinkLengths(n._links,n.linkAccessor,t)},this},e.prototype.start=function(t,n,r,i,u,c){var h=this;void 0===t&&(t=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===u&&(u=!0),void 0===c&&(c=!0);var d,f=this.nodes().length,p=f+2*this._groups.length,v=(this._links.length,this._canvasSize[0]),g=this._canvasSize[1],y=new Array(p),m=new Array(p),b=null,x=this._avoidOverlaps;this._nodes.forEach((function(e,t){e.index=t,void 0===e.x&&(e.x=v/2,e.y=g/2),y[t]=e.x,m[t]=e.y})),this._linkLengthCalculator&&this._linkLengthCalculator(),this._distanceMatrix?d=this._distanceMatrix:(d=new l.Calculator(p,this._links,e.getSourceIndex,e.getTargetIndex,(function(e){return h.getLinkLength(e)})).DistanceMatrix(),b=o.Descent.createSquareMatrix(p,(function(){return 2})),this._links.forEach((function(e){"number"==typeof e.source&&(e.source=h._nodes[e.source]),"number"==typeof e.target&&(e.target=h._nodes[e.target])})),this._links.forEach((function(t){var n=e.getSourceIndex(t),r=e.getTargetIndex(t);b[n][r]=b[r][n]=t.weight||1})));var w=o.Descent.createSquareMatrix(p,(function(e,t){return d[e][t]}));if(this._rootGroup&&void 0!==this._rootGroup.groups){var E=f;this._groups.forEach((function(e){!function(e,t,n,r){b[e][t]=b[t][e]=n,w[e][t]=w[t][e]=r}(E,E+1,h._groupCompactness,.1),y[E]=0,m[E++]=0,y[E]=0,m[E++]=0}))}else this._rootGroup={leaves:this._nodes,groups:[]};var k=this._constraints||[];this._directedLinkConstraints&&(this.linkAccessor.getMinSeparation=this._directedLinkConstraints.getMinSeparation,k=k.concat(a.generateDirectedEdgeConstraints(f,this._links,this._directedLinkConstraints.axis,this.linkAccessor))),this.avoidOverlaps(!1),this._descent=new o.Descent([y,m],w),this._descent.locks.clear();for(E=0;E<f;++E){var _=this._nodes[E];if(_.fixed){_.px=_.x,_.py=_.y;var C=[_.x,_.y];this._descent.locks.add(E,C)}}if(this._descent.threshold=this._threshold,this.initialLayout(t,y,m),k.length>0&&(this._descent.project=new s.Projection(this._nodes,this._groups,this._rootGroup,k).projectFunctions()),this._descent.run(n),this.separateOverlappingComponents(v,g,c),this.avoidOverlaps(x),x&&(this._nodes.forEach((function(e,t){e.x=y[t],e.y=m[t]})),this._descent.project=new s.Projection(this._nodes,this._groups,this._rootGroup,k,!0).projectFunctions(),this._nodes.forEach((function(e,t){y[t]=e.x,m[t]=e.y}))),this._descent.G=b,this._descent.run(r),i){this._descent.snapStrength=1e3,this._descent.snapGridSize=this._nodes[0].width,this._descent.numGridSnapNodes=f,this._descent.scaleSnapByMaxH=f!=p;var S=o.Descent.createSquareMatrix(p,(function(e,t){return e>=f||t>=f?b[e][t]:0}));this._descent.G=S,this._descent.run(i)}return this.updateNodePositions(),this.separateOverlappingComponents(v,g,c),u?this.resume():this},e.prototype.initialLayout=function(t,n,r){if(this._groups.length>0&&t>0){var i=this._nodes.length,a=this._links.map((function(e){return{source:e.source.index,target:e.target.index}})),o=this._nodes.map((function(e){return{index:e.index}}));this._groups.forEach((function(e,t){o.push({index:e.index=i+t})})),this._groups.forEach((function(e,t){void 0!==e.leaves&&e.leaves.forEach((function(t){return a.push({source:e.index,target:t.index})})),void 0!==e.groups&&e.groups.forEach((function(t){return a.push({source:e.index,target:t.index})}))})),(new e).size(this.size()).nodes(o).links(a).avoidOverlaps(!1).linkDistance(this.linkDistance()).symmetricDiffLinkLengths(5).convergenceThreshold(1e-4).start(t,0,0,0,!1),this._nodes.forEach((function(e){n[e.index]=o[e.index].x,r[e.index]=o[e.index].y}))}else this._descent.run(t)},e.prototype.separateOverlappingComponents=function(e,t,n){var r=this;if(void 0===n&&(n=!0),!this._distanceMatrix&&this._handleDisconnected){var i=this._descent.x[0],a=this._descent.x[1];this._nodes.forEach((function(e,t){e.x=i[t],e.y=a[t]}));var o=c.separateGraphs(this._nodes,this._links);c.applyPacking(o,e,t,this._defaultNodeSize,1,n),this._nodes.forEach((function(e,t){r._descent.x[0][t]=e.x,r._descent.x[1][t]=e.y,e.bounds&&(e.bounds.setXCentre(e.x),e.bounds.setYCentre(e.y))}))}},e.prototype.resume=function(){return this.alpha(.1)},e.prototype.stop=function(){return this.alpha(0)},e.prototype.prepareEdgeRouting=function(e){void 0===e&&(e=0),this._visibilityGraph=new u.TangentVisibilityGraph(this._nodes.map((function(t){return t.bounds.inflate(-e).vertices()})))},e.prototype.routeEdge=function(e,t,n){void 0===t&&(t=5);var r=[],i=new u.TangentVisibilityGraph(this._visibilityGraph.P,{V:this._visibilityGraph.V,E:this._visibilityGraph.E}),a={x:e.source.x,y:e.source.y},o={x:e.target.x,y:e.target.y},c=i.addPoint(a,e.source.index),h=i.addPoint(o,e.target.index);i.addEdgeIfVisible(a,o,e.source.index,e.target.index),void 0!==n&&n(i);var d=new l.Calculator(i.V.length,i.E,(function(e){return e.source.id}),(function(e){return e.target.id}),(function(e){return e.length()})).PathFromNodeToNode(c.id,h.id);if(1===d.length||d.length===i.V.length){var f=s.makeEdgeBetween(e.source.innerBounds,e.target.innerBounds,t);r=[f.sourceIntersection,f.arrowStart]}else{for(var p=d.length-2,v=i.V[d[p]].p,g=i.V[d[0]].p,y=(r=[e.source.innerBounds.rayIntersection(v.x,v.y)],p);y>=0;--y)r.push(i.V[d[y]].p);r.push(s.makeEdgeTo(g,e.target.innerBounds,t))}return r},e.getSourceIndex=function(e){return"number"==typeof e.source?e.source:e.source.index},e.getTargetIndex=function(e){return"number"==typeof e.target?e.target:e.target.index},e.linkId=function(t){return e.getSourceIndex(t)+"-"+e.getTargetIndex(t)},e.dragStart=function(t){h(t)?e.storeOffset(t,e.dragOrigin(t)):(e.stopNode(t),t.fixed|=2)},e.stopNode=function(e){e.px=e.x,e.py=e.y},e.storeOffset=function(t,n){void 0!==t.leaves&&t.leaves.forEach((function(t){t.fixed|=2,e.stopNode(t),t._dragGroupOffsetX=t.x-n.x,t._dragGroupOffsetY=t.y-n.y})),void 0!==t.groups&&t.groups.forEach((function(t){return e.storeOffset(t,n)}))},e.dragOrigin=function(e){return h(e)?{x:e.bounds.cx(),y:e.bounds.cy()}:e},e.drag=function(t,n){h(t)?(void 0!==t.leaves&&t.leaves.forEach((function(e){t.bounds.setXCentre(n.x),t.bounds.setYCentre(n.y),e.px=e._dragGroupOffsetX+n.x,e.py=e._dragGroupOffsetY+n.y})),void 0!==t.groups&&t.groups.forEach((function(t){return e.drag(t,n)}))):(t.px=n.x,t.py=n.y)},e.dragEnd=function(t){h(t)?(void 0!==t.leaves&&t.leaves.forEach((function(t){e.dragEnd(t),delete t._dragGroupOffsetX,delete t._dragGroupOffsetY})),void 0!==t.groups&&t.groups.forEach(e.dragEnd)):t.fixed&=-7},e.mouseOver=function(e){e.fixed|=4,e.px=e.x,e.py=e.y},e.mouseOut=function(e){e.fixed&=-5},e}();t.Layout=d},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(9),o=n(11);function s(e){return e.bounds=void 0!==e.leaves?e.leaves.reduce((function(e,t){return t.bounds.union(e)}),l.empty()):l.empty(),void 0!==e.groups&&(e.bounds=e.groups.reduce((function(e,t){return s(t).union(e)}),e.bounds)),e.bounds=e.bounds.inflate(e.padding),e.bounds}t.computeGroupBounds=s;var l=function(){function e(e,t,n,r){this.x=e,this.X=t,this.y=n,this.Y=r}return e.empty=function(){return new e(Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY)},e.prototype.cx=function(){return(this.x+this.X)/2},e.prototype.cy=function(){return(this.y+this.Y)/2},e.prototype.overlapX=function(e){var t=this.cx(),n=e.cx();return t<=n&&e.x<this.X?this.X-e.x:n<=t&&this.x<e.X?e.X-this.x:0},e.prototype.overlapY=function(e){var t=this.cy(),n=e.cy();return t<=n&&e.y<this.Y?this.Y-e.y:n<=t&&this.y<e.Y?e.Y-this.y:0},e.prototype.setXCentre=function(e){var t=e-this.cx();this.x+=t,this.X+=t},e.prototype.setYCentre=function(e){var t=e-this.cy();this.y+=t,this.Y+=t},e.prototype.width=function(){return this.X-this.x},e.prototype.height=function(){return this.Y-this.y},e.prototype.union=function(t){return new e(Math.min(this.x,t.x),Math.max(this.X,t.X),Math.min(this.y,t.y),Math.max(this.Y,t.Y))},e.prototype.lineIntersections=function(t,n,r,i){for(var a=[[this.x,this.y,this.X,this.y],[this.X,this.y,this.X,this.Y],[this.X,this.Y,this.x,this.Y],[this.x,this.Y,this.x,this.y]],o=[],s=0;s<4;++s){var l=e.lineIntersection(t,n,r,i,a[s][0],a[s][1],a[s][2],a[s][3]);null!==l&&o.push({x:l.x,y:l.y})}return o},e.prototype.rayIntersection=function(e,t){var n=this.lineIntersections(this.cx(),this.cy(),e,t);return n.length>0?n[0]:null},e.prototype.vertices=function(){return[{x:this.x,y:this.y},{x:this.X,y:this.y},{x:this.X,y:this.Y},{x:this.x,y:this.Y}]},e.lineIntersection=function(e,t,n,r,i,a,o,s){var l=n-e,u=o-i,c=r-t,h=s-a,d=h*l-u*c;if(0==d)return null;var f=e-i,p=t-a,v=(u*p-h*f)/d,g=(l*p-c*f)/d;return v>=0&&v<=1&&g>=0&&g<=1?{x:e+v*l,y:t+v*c}:null},e.prototype.inflate=function(t){return new e(this.x-t,this.X+t,this.y-t,this.Y+t)},e}();t.Rectangle=l,t.makeEdgeBetween=function(e,t,n){var r=e.rayIntersection(t.cx(),t.cy())||{x:e.cx(),y:e.cy()},i=t.rayIntersection(e.cx(),e.cy())||{x:t.cx(),y:t.cy()},a=i.x-r.x,o=i.y-r.y,s=Math.sqrt(a*a+o*o),l=s-n;return{sourceIntersection:r,targetIntersection:i,arrowStart:{x:r.x+l*a/s,y:r.y+l*o/s}}},t.makeEdgeTo=function(e,t,n){var r=t.rayIntersection(e.x,e.y);r||(r={x:t.cx(),y:t.cy()});var i=r.x-e.x,a=r.y-e.y,o=Math.sqrt(i*i+a*a);return{x:r.x-n*i/o,y:r.y-n*a/o}};var u=function(e,t,n){this.v=e,this.r=t,this.pos=n,this.prev=d(),this.next=d()},c=function(e,t,n){this.isOpen=e,this.v=t,this.pos=n};function h(e,t){return e.pos>t.pos?1:e.pos<t.pos||e.isOpen?-1:t.isOpen?1:0}function d(){return new o.RBTree((function(e,t){return e.pos-t.pos}))}var f={getCentre:function(e){return e.cx()},getOpen:function(e){return e.y},getClose:function(e){return e.Y},getSize:function(e){return e.width()},makeRect:function(e,t,n,r){return new l(n-r/2,n+r/2,e,t)},findNeighbours:function(e,t){var n=function(n,r){for(var i,a=t.findIter(e);null!==(i=a[n]());){var o=i.r.overlapX(e.r);if((o<=0||o<=i.r.overlapY(e.r))&&(e[n].insert(i),i[r].insert(e)),o<=0)break}};n("next","prev"),n("prev","next")}},p={getCentre:function(e){return e.cy()},getOpen:function(e){return e.x},getClose:function(e){return e.X},getSize:function(e){return e.height()},makeRect:function(e,t,n,r){return new l(e,t,n-r/2,n+r/2)},findNeighbours:function(e,t){var n=function(n,r){var i=t.findIter(e)[n]();null!==i&&i.r.overlapX(e.r)>0&&(e[n].insert(i),i[r].insert(e))};n("next","prev"),n("prev","next")}};function v(e,t,n,r){void 0===r&&(r=!1);var i=e.padding,a=void 0!==e.groups?e.groups.length:0,o=void 0!==e.leaves?e.leaves.length:0,s=a?e.groups.reduce((function(e,r){return e.concat(v(r,t,n,!0))}),[]):[],l=(r?2:0)+o+a,u=new Array(l),c=new Array(l),h=0,d=function(e,t){c[h]=e,u[h++]=t};if(r){var f=e.bounds,p=t.getCentre(f),y=t.getSize(f)/2,m=t.getOpen(f),b=t.getClose(f),x=p-y+i/2,w=p+y-i/2;e.minVar.desiredPosition=x,d(t.makeRect(m,b,x,i),e.minVar),e.maxVar.desiredPosition=w,d(t.makeRect(m,b,w,i),e.maxVar)}o&&e.leaves.forEach((function(e){return d(e.bounds,e.variable)})),a&&e.groups.forEach((function(e){var n=e.bounds;d(t.makeRect(t.getOpen(n),t.getClose(n),t.getCentre(n),t.getSize(n)),e.minVar)}));var E=g(c,u,t,n);return a&&(u.forEach((function(e){e.cOut=[],e.cIn=[]})),E.forEach((function(e){e.left.cOut.push(e),e.right.cIn.push(e)})),e.groups.forEach((function(e){var n=(e.padding-t.getSize(e.bounds))/2;e.minVar.cIn.forEach((function(e){return e.gap+=n})),e.minVar.cOut.forEach((function(t){t.left=e.maxVar,t.gap+=n}))}))),s.concat(E)}function g(e,t,n,r){var i,o=e.length,s=2*o;console.assert(t.length>=o);var l=new Array(s);for(i=0;i<o;++i){var f=e[i],p=new u(t[i],f,n.getCentre(f));l[i]=new c(!0,p,n.getOpen(f)),l[i+o]=new c(!1,p,n.getClose(f))}l.sort(h);var v=new Array,g=d();for(i=0;i<s;++i){var y=l[i];p=y.v;if(y.isOpen)g.insert(p),n.findNeighbours(p,g);else{g.remove(p);var m=function(e,t){var i=(n.getSize(e.r)+n.getSize(t.r))/2+r;v.push(new a.Constraint(e.v,t.v,i))},b=function(e,t,n){for(var r,i=p[e].iterator();null!==(r=i[e]());)n(r,p),r[t].remove(p)};b("prev","next",(function(e,t){return m(e,t)})),b("next","prev",(function(e,t){return m(t,e)}))}}return console.assert(0===g.size),v}function y(e,t){return g(e,t,f,1e-6)}function m(e,t){return g(e,t,p,1e-6)}function b(e){return v(e,f,1e-6)}function x(e){return v(e,p,1e-6)}t.generateXConstraints=y,t.generateYConstraints=m,t.generateXGroupConstraints=b,t.generateYGroupConstraints=x,t.removeOverlaps=function(e){var t=e.map((function(e){return new a.Variable(e.cx())})),n=y(e,t),r=new a.Solver(t,n);r.solve(),t.forEach((function(t,n){return e[n].setXCentre(t.position())})),t=e.map((function(e){return new a.Variable(e.cy())})),n=m(e,t),(r=new a.Solver(t,n)).solve(),t.forEach((function(t,n){return e[n].setYCentre(t.position())}))};var w=function(e){function t(t,n){var r=e.call(this,0,n)||this;return r.index=t,r}return i(t,e),t}(a.Variable);t.IndexedVariable=w;var E=function(){function e(e,t,n,r,i){var a=this;if(void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=!1),this.nodes=e,this.groups=t,this.rootGroup=n,this.avoidOverlaps=i,this.variables=e.map((function(e,t){return e.variable=new w(t,1)})),r&&this.createConstraints(r),i&&n&&void 0!==n.groups){e.forEach((function(e){if(e.width&&e.height){var t=e.width/2,n=e.height/2;e.bounds=new l(e.x-t,e.x+t,e.y-n,e.y+n)}else e.bounds=new l(e.x,e.x,e.y,e.y)})),s(n);var o=e.length;t.forEach((function(e){a.variables[o]=e.minVar=new w(o++,void 0!==e.stiffness?e.stiffness:.01),a.variables[o]=e.maxVar=new w(o++,void 0!==e.stiffness?e.stiffness:.01)}))}}return e.prototype.createSeparation=function(e){return new a.Constraint(this.nodes[e.left].variable,this.nodes[e.right].variable,e.gap,void 0!==e.equality&&e.equality)},e.prototype.makeFeasible=function(e){var t=this;if(this.avoidOverlaps){var n="x",r="width";"x"===e.axis&&(n="y",r="height");var i=e.offsets.map((function(e){return t.nodes[e.node]})).sort((function(e,t){return e[n]-t[n]})),a=null;i.forEach((function(e){if(a){var t=a[n]+a[r];t>e[n]&&(e[n]=t)}a=e}))}},e.prototype.createAlignment=function(e){var t=this,n=this.nodes[e.offsets[0].node].variable;this.makeFeasible(e);var r="x"===e.axis?this.xConstraints:this.yConstraints;e.offsets.slice(1).forEach((function(e){var i=t.nodes[e.node].variable;r.push(new a.Constraint(n,i,e.offset,!0))}))},e.prototype.createConstraints=function(e){var t=this,n=function(e){return void 0===e.type||"separation"===e.type};this.xConstraints=e.filter((function(e){return"x"===e.axis&&n(e)})).map((function(e){return t.createSeparation(e)})),this.yConstraints=e.filter((function(e){return"y"===e.axis&&n(e)})).map((function(e){return t.createSeparation(e)})),e.filter((function(e){return"alignment"===e.type})).forEach((function(e){return t.createAlignment(e)}))},e.prototype.setupVariablesAndBounds=function(e,t,n,r){this.nodes.forEach((function(i,a){i.fixed?(i.variable.weight=i.fixedWeight?i.fixedWeight:1e3,n[a]=r(i)):i.variable.weight=1;var o=(i.width||0)/2,s=(i.height||0)/2,u=e[a],c=t[a];i.bounds=new l(u-o,u+o,c-s,c+s)}))},e.prototype.xProject=function(e,t,n){(this.rootGroup||this.avoidOverlaps||this.xConstraints)&&this.project(e,t,e,n,(function(e){return e.px}),this.xConstraints,b,(function(e){return e.bounds.setXCentre(n[e.variable.index]=e.variable.position())}),(function(e){var t=n[e.minVar.index]=e.minVar.position(),r=n[e.maxVar.index]=e.maxVar.position(),i=e.padding/2;e.bounds.x=t-i,e.bounds.X=r+i}))},e.prototype.yProject=function(e,t,n){(this.rootGroup||this.yConstraints)&&this.project(e,t,t,n,(function(e){return e.py}),this.yConstraints,x,(function(e){return e.bounds.setYCentre(n[e.variable.index]=e.variable.position())}),(function(e){var t=n[e.minVar.index]=e.minVar.position(),r=n[e.maxVar.index]=e.maxVar.position(),i=e.padding/2;e.bounds.y=t-i,e.bounds.Y=r+i}))},e.prototype.projectFunctions=function(){var e=this;return[function(t,n,r){return e.xProject(t,n,r)},function(t,n,r){return e.yProject(t,n,r)}]},e.prototype.project=function(e,t,n,r,i,a,o,l,u){this.setupVariablesAndBounds(e,t,r,i),this.rootGroup&&this.avoidOverlaps&&(s(this.rootGroup),a=a.concat(o(this.rootGroup))),this.solve(this.variables,a,n,r),this.nodes.forEach(l),this.rootGroup&&this.avoidOverlaps&&(this.groups.forEach(u),s(this.rootGroup))},e.prototype.solve=function(e,t,n,r){var i=new a.Solver(e,t);i.setStartingPositions(n),i.setDesiredPositions(r),i.solve()},e}();t.Projection=E},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(12),i=function(e,t){this.id=e,this.distance=t},a=function(e){this.id=e,this.neighbours=[]},o=function(e,t,n){this.node=e,this.prev=t,this.d=n},s=function(){function e(e,t,n,r,o){this.n=e,this.es=t,this.neighbours=new Array(this.n);for(var s=this.n;s--;)this.neighbours[s]=new a(s);for(s=this.es.length;s--;){var l=this.es[s],u=n(l),c=r(l),h=o(l);this.neighbours[u].neighbours.push(new i(c,h)),this.neighbours[c].neighbours.push(new i(u,h))}}return e.prototype.DistanceMatrix=function(){for(var e=new Array(this.n),t=0;t<this.n;++t)e[t]=this.dijkstraNeighbours(t);return e},e.prototype.DistancesFromNode=function(e){return this.dijkstraNeighbours(e)},e.prototype.PathFromNodeToNode=function(e,t){return this.dijkstraNeighbours(e,t)},e.prototype.PathFromNodeToNodeWithPrevCost=function(e,t,n){var i=new r.PriorityQueue((function(e,t){return e.d<=t.d})),a=this.neighbours[e],s=new o(a,null,0),l={};for(i.push(s);!i.empty()&&(a=(s=i.pop()).node).id!==t;)for(var u=a.neighbours.length;u--;){var c=a.neighbours[u],h=this.neighbours[c.id];if(!s.prev||h.id!==s.prev.node.id){var d=h.id+","+a.id;if(!(d in l&&l[d]<=s.d)){var f=s.prev?n(s.prev.node.id,a.id,h.id):0,p=s.d+c.distance+f;l[d]=p,i.push(new o(h,s,p))}}}for(var v=[];s.prev;)s=s.prev,v.push(s.node.id);return v},e.prototype.dijkstraNeighbours=function(e,t){void 0===t&&(t=-1);for(var n=new r.PriorityQueue((function(e,t){return e.d<=t.d})),i=this.neighbours.length,a=new Array(i);i--;){var o=this.neighbours[i];o.d=i===e?0:Number.POSITIVE_INFINITY,o.q=n.push(o)}for(;!n.empty();){var s=n.pop();if(a[s.id]=s.d,s.id===t){for(var l=[],u=s;void 0!==u.prev;)l.push(u.prev.id),u=u.prev;return l}for(i=s.neighbours.length;i--;){var c=s.neighbours[i],h=(u=this.neighbours[c.id],s.d+c.distance);s.d!==Number.MAX_VALUE&&u.d>h&&(u.d=h,u.prev=s,n.reduceKey(u.q,u,(function(e,t){return e.q=t})))}}return a},e}();t.Calculator=s},function(e,t,n){"use strict";(function(t){function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var i=r(n(27)),a=r(n(28));function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var d="undefined"==typeof window?null:window,f=d?d.navigator:null,p=(d&&d.document,o("")),v=o({}),g=o((function(){})),y="undefined"==typeof HTMLElement?"undefined":o(HTMLElement),m=function(e){return e&&e.instanceString&&x(e.instanceString)?e.instanceString():null},b=function(e){return null!=e&&o(e)==p},x=function(e){return null!=e&&o(e)===g},w=function(e){return Array.isArray?Array.isArray(e):null!=e&&e instanceof Array},E=function(e){return null!=e&&o(e)===v&&!w(e)&&e.constructor===Object},k=function(e){return null!=e&&o(e)===o(1)&&!isNaN(e)},_=function(e){return"undefined"===y?void 0:null!=e&&e instanceof HTMLElement},C=function(e){return S(e)||P(e)},S=function(e){return"collection"===m(e)&&e._private.single},P=function(e){return"collection"===m(e)&&!e._private.single},T=function(e){return"core"===m(e)},A=function(e){return"stylesheet"===m(e)},D=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},M=function(e){return function(e){return null!=e&&o(e)===v}(e)&&x(e.then)},O=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function n(){var r,i=this,a=arguments,o=t.apply(i,a),s=n.cache;return(r=s[o])||(r=s[o]=e.apply(i,a)),r};return n.cache={},n},B=O((function(e){return e.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))})),L=O((function(e){return e.replace(/(-\w)/g,(function(e){return e[1].toUpperCase()}))})),I=O((function(e,t){return e+t[0].toUpperCase()+t.substring(1)}),(function(e,t){return e+"$"+t})),N=function(e){return D(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},z="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",R=function(e,t){return e<t?-1:e>t?1:0},j=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},V=function(e){return(w(e)?e:null)||function(e){return F[e.toLowerCase()]}(e)||function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r;return 4===e.length?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),r=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],16),r=parseInt(e[5]+e[6],16)),[t,n,r]}}(e)||function(e){var t,n=new RegExp("^rgb[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").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}(e)||function(e){var t,n,r,i,a,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var h=i<.5?i*(1+r):i+r-i*r,d=2*i-h;o=Math.round(255*u(d,h,n+1/3)),s=Math.round(255*u(d,h,n)),l=Math.round(255*u(d,h,n-1/3))}t=[o,s,l,a]}return t}(e)},F={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]},q=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(E(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},X=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(E(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))return t}return t},Y=d?d.performance:null,G=Y&&Y.now?function(){return Y.now()}:function(){return Date.now()},H=function(){if(d){if(d.requestAnimationFrame)return function(e){d.requestAnimationFrame(e)};if(d.mozRequestAnimationFrame)return function(e){d.mozRequestAnimationFrame(e)};if(d.webkitRequestAnimationFrame)return function(e){d.webkitRequestAnimationFrame(e)};if(d.msRequestAnimationFrame)return function(e){d.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(G())}),1e3/60)}}(),W=function(e){return H(e)},U=G,K=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381,r=n;!(t=e.next()).done;)r=(r<<5)+r+t.value|0;return r},Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},$=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return K({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},Q=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return K({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},J=function(){return ee(arguments)},ee=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?Q(r):Q(r,t)}return t},te=!0,ne=null!=console.warn,re=null!=console.trace,ie=Number.MAX_SAFE_INTEGER||9007199254740991,ae=function(){return!0},oe=function(){return!1},se=function(){return 0},le=function(){},ue=function(e){throw new Error(e)},ce=function(e){if(void 0===e)return te;te=!!e},he=function(e){ce()&&(ne?console.warn(e):(console.log(e),re&&console.trace()))},de=function(e){return null==e?e:w(e)?e.slice():E(e)?function(e){return j({},e)}(e):e},fe=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},pe={},ve=function(){return pe},ge=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},ye=function(e,t,n){for(var r=e.length;r>=0&&(e[r]!==t||(e.splice(r,1),n));r--);},me=function(e){e.splice(0,e.length)},be=function(e,t,n){return n&&(t=I(n,t)),e[t]},xe=function(e,t,n,r){n&&(t=I(n,t)),e[t]=r},we="undefined"!=typeof Map?Map:function(){function e(){s(this,e),this._obj={}}return u(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Ee=function(){function e(t){if(s(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r<n.length;r++)this.add(n[r])}}return u(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter((function(t){return e.has(t)}))}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),e}(),ke="undefined"!==("undefined"==typeof Set?"undefined":o(Set))?Set:Ee,_e=function(e,t,n){if(n=!(void 0!==n&&!n),void 0!==e&&void 0!==t&&T(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new ke,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];w(t.classes)?l=t.classes:b(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var h=l[u];h&&""!==h&&i.classes.add(h)}this.createEmitter();var d=t.style||t.css;d&&(he("Setting a `style` bypass at element creation is deprecated"),this.style(d)),(void 0===n||n)&&this.restore()}else ue("An element must be of type `nodes` or `edges`; you specified `"+r+"`")}else ue("An element must have a core reference and parameters set")},Ce=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;E(t)&&!C(t)&&(t=(i=t).roots||i.root,n=i.visit,r=i.directed),r=2!==arguments.length||x(n)?r:n,n=x(n)?n:function(){};for(var a,o=this._private.cy,s=t=b(t)?this.filter(t):t,l=[],u=[],c={},h={},d={},f=0,p=this.byGroup(),v=p.nodes,g=p.edges,y=0;y<s.length;y++){var m=s[y],w=m.id();m.isNode()&&(l.unshift(m),e.bfs&&(d[w]=!0,u.push(m)),h[w]=0)}var k=function(){var t=e.bfs?l.shift():l.pop(),i=t.id();if(e.dfs){if(d[i])return"continue";d[i]=!0,u.push(t)}var o,s=h[i],p=c[i],y=null!=p?p.source():null,m=null!=p?p.target():null,b=null==p?void 0:t.same(y)?m[0]:y[0];if(!0===(o=n(t,p,b,f++,s)))return a=t,"break";if(!1===o)return"break";for(var x=t.connectedEdges().filter((function(e){return(!r||e.source().same(t))&&g.has(e)})),w=0;w<x.length;w++){var E=x[w],k=E.connectedNodes().filter((function(e){return!e.same(t)&&v.has(e)})),_=k.id();0===k.length||d[_]||(k=k[0],l.push(k),e.bfs&&(d[_]=!0,u.push(k)),c[_]=E,h[_]=h[i]+1)}};e:for(;0!==l.length;){var _=k();switch(_){case"continue":continue;case"break":break e}}for(var S=o.collection(),P=0;P<u.length;P++){var T=u[P],A=c[T.id()];null!=A&&S.merge(A),S.merge(T)}return{path:o.collection(S),found:o.collection(a)}}},Se={breadthFirstSearch:Ce({bfs:!0}),depthFirstSearch:Ce({dfs:!0})};Se.bfs=Se.breadthFirstSearch,Se.dfs=Se.depthFirstSearch;var Pe=ge({root:null,weight:function(e){return 1},directed:!1}),Te={dijkstra:function(e){if(!E(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=Pe(e),r=n.root,i=n.weight,o=n.directed,s=this,l=i,u=b(r)?this.filter(r)[0]:r[0],c={},h={},d={},f=this.byGroup(),p=f.nodes,v=f.edges;v.unmergeBy((function(e){return e.isLoop()}));for(var g=function(e){return c[e.id()]},y=function(e,t){c[e.id()]=t,m.updateItem(e)},m=new a((function(e,t){return g(e)-g(t)})),x=0;x<p.length;x++){var w=p[x];c[w.id()]=w.same(u)?0:1/0,m.push(w)}for(var k=function(e,t){for(var n,r=(o?e.edgesTo(t):e.edgesWith(t)).intersect(v),i=1/0,a=0;a<r.length;a++){var s=r[a],u=l(s);(u<i||!n)&&(i=u,n=s)}return{edge:n,dist:i}};m.size()>0;){var _=m.pop(),C=g(_),S=_.id();if(d[S]=C,C!==1/0)for(var P=_.neighborhood().intersect(p),T=0;T<P.length;T++){var A=P[T],D=A.id(),M=k(_,A),O=C+M.dist;O<g(A)&&(y(A,O),h[D]={node:_,edge:M.edge})}}return{distanceTo:function(e){var t=b(e)?p.filter(e)[0]:e[0];return d[t.id()]},pathTo:function(e){var t=b(e)?p.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);h[i];){var a=h[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return s.spawn(n)}}}},Ae={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++){if(a[t].has(e))return t}},l=0;l<i;l++)a[l]=this.spawn(n[l]);for(var u=r.sort((function(t,n){return e(t)-e(n)})),c=0;c<u.length;c++){var h=u[c],d=h.source()[0],f=h.target()[0],p=s(d),v=s(f),g=a[p],y=a[v];p!==v&&(o.merge(h),g.merge(y),a.splice(v,1))}return o}},De=ge({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Me={aStar:function(e){var t=this.cy(),n=De(e),r=n.root,i=n.goal,o=n.heuristic,s=n.directed,l=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var u,c,h=r.id(),d=i.id(),f={},p={},v={},g=new a((function(e,t){return p[e.id()]-p[t.id()]})),y=new ke,m={},b={},x=function(e,t){g.push(e),y.add(t)};x(r,h),f[h]=0,p[h]=o(r);for(var w,E=0;g.size()>0;){if(u=g.pop(),c=u.id(),y.delete(c),E++,c===d){for(var k=[],_=i,C=d,S=b[C];k.unshift(_),null!=S&&k.unshift(S),null!=(_=m[C]);)S=b[C=_.id()];return{found:!0,distance:f[c],path:this.spawn(k),steps:E}}v[c]=!0;for(var P=u._private.edges,T=0;T<P.length;T++){var A=P[T];if(this.hasElementWithId(A.id())&&(!s||A.data("source")===c)){var D=A.source(),M=A.target(),O=D.id()!==c?D:M,B=O.id();if(this.hasElementWithId(B)&&!v[B]){var L=f[c]+l(A);w=B,y.has(w)?L<f[B]&&(f[B]=L,p[B]=L+o(O),m[B]=u):(f[B]=L,p[B]=L+o(O),x(O,B),m[B]=u,b[B]=A)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},Oe=ge({weight:function(e){return 1},directed:!1}),Be={floydWarshall:function(e){for(var t=this.cy(),n=Oe(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,l=o.edges,u=s.length,c=u*u,h=function(e){return s.indexOf(e)},d=function(e){return s[e]},f=new Array(c),p=0;p<c;p++){var v=p%u,g=(p-v)/u;f[p]=g===v?0:1/0}for(var y=new Array(c),m=new Array(c),x=0;x<l.length;x++){var w=l[x],E=w.source()[0],k=w.target()[0];if(E!==k){var _=h(E),C=h(k),S=_*u+C,P=a(w);if(f[S]>P&&(f[S]=P,y[S]=C,m[S]=w),!i){var T=C*u+_;!i&&f[T]>P&&(f[T]=P,y[T]=_,m[T]=w)}}}for(var A=0;A<u;A++)for(var D=0;D<u;D++)for(var M=D*u+A,O=0;O<u;O++){var B=D*u+O,L=A*u+O;f[M]+f[L]<f[B]&&(f[B]=f[M]+f[L],y[B]=y[M])}var I=function(e){return h(function(e){return(b(e)?t.filter(e):e)[0]}(e))};return{distance:function(e,t){var n=I(e),r=I(t);return f[n*u+r]},path:function(e,n){var r=I(e),i=I(n),a=d(r);if(r===i)return a.collection();if(null==y[r*u+i])return t.collection();var o,s=t.collection(),l=r;for(s.merge(a);r!==i;)l=r,r=y[r*u+i],o=m[l*u+r],s.merge(o),s.merge(d(r));return s}}}},Le=ge({weight:function(e){return 1},directed:!1,root:null}),Ie={bellmanFord:function(e){var t=this,n=Le(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,h=u.nodes,d=h.length,f=new we,p=!1;a=l.collection(a)[0],c.unmergeBy((function(e){return e.isLoop()}));for(var v=c.length,g=function(e){var t=f.get(e.id());return t||(t={},f.set(e.id(),t)),t},y=function(e){return(b(e)?l.$(e):e)[0]},m=0;m<d;m++){var x=h[m],w=g(x);x.same(a)?w.dist=0:w.dist=1/0,w.pred=null,w.edge=null}for(var E=!1,k=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,E=!0)},_=1;_<d;_++){E=!1;for(var C=0;C<v;C++){var S=c[C],P=S.source(),T=S.target(),A=o(S),D=g(P),M=g(T);k(P,0,S,D,M,A),i||k(T,0,S,M,D,A)}if(!E)break}if(E)for(var O=0;O<v;O++){var B=c[O],L=B.source(),I=B.target(),N=o(B),z=g(L).dist,R=g(I).dist;if(z+N<R||!i&&R+N<z){he("Graph contains a negative weight cycle for Bellman-Ford"),p=!0;break}}return{distanceTo:function(e){return g(y(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=y(e),i=[],o=r;;){if(null==o)return t.spawn();var l=g(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},hasNegativeWeightCycle:p,negativeWeightCycles:[]}}},Ne=Math.sqrt(2),ze=function(e,t,n){0===n.length&&ue("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],h=c[1],d=c[2];(t[h]===o&&t[d]===s||t[h]===s&&t[d]===o)&&l.splice(u,1)}for(var f=0;f<l.length;f++){var p=l[f];p[1]===s?(l[f]=p.slice(),l[f][1]=o):p[2]===s&&(l[f]=p.slice(),l[f][2]=o)}for(var v=0;v<t.length;v++)t[v]===s&&(t[v]=o);return l},Re=function(e,t,n,r){for(;n>r;){var i=Math.floor(Math.random()*t.length);t=ze(i,e,t),n--}return t},je={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/Ne);if(!(i<2)){for(var l=[],u=0;u<a;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}for(var h=1/0,d=[],f=new Array(i),p=new Array(i),v=new Array(i),g=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},y=0;y<=o;y++){for(var m=0;m<i;m++)p[m]=m;var b=Re(p,l.slice(),i,s),x=b.slice();g(p,v);var w=Re(p,b,s,2),E=Re(v,x,s,2);w.length<=E.length&&w.length<h?(h=w.length,d=w,g(p,f)):E.length<=w.length&&E.length<h&&(h=E.length,d=E,g(v,f))}for(var k=this.spawn(d.map((function(e){return r[e[0]]}))),_=this.spawn(),C=this.spawn(),S=f[0],P=0;P<f.length;P++){var T=f[P],A=n[P];T===S?_.merge(A):C.merge(A)}var D=function(t){var n=e.spawn();return t.forEach((function(t){n.merge(t),t.connectedEdges().forEach((function(t){e.contains(t)&&!k.contains(t)&&n.merge(t)}))})),n},M=[D(_),D(C)];return{cut:k,components:M,partition1:_,partition2:C}}ue("At least 2 nodes are required for Karger-Stein algorithm")}},Ve=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},Fe=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},qe=function(e){return{x:e[0],y:e[1]}},Xe=function(e,t){return Math.atan2(t,e)-Math.PI/2},Ye=Math.log2||function(e){return Math.log(e)/Math.log(2)},Ge=function(e){return e>0?1:e<0?-1:0},He=function(e,t){return Math.sqrt(We(e,t))},We=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Ue=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},Ke=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},Ze=function(e,t,n,r){return{x:Ke(e.x,t.x,n.x,r),y:Ke(e.y,t.y,n.y,r)}},$e=function(e,t,n){return Math.max(e,Math.min(n,t))},Qe=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}}},Je=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},et=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tt=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=h(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},nt=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},rt=function(e,t){e.x1+=t.x,e.x2+=t.x,e.y1+=t.y,e.y2+=t.y},it=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2<t.x1)&&(!(t.x2<e.x1)&&(!(e.y2<t.y1)&&(!(t.y2<e.y1)&&(!(e.y1>t.y2)&&!(t.y1>e.y2)))))))},at=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},ot=function(e,t){return at(e,t.x1,t.y1)&&at(e,t.x2,t.y2)},st=function(e,t,n,r,i,a,o){var s,l=Ct(i,a),u=i/2,c=a/2,h=r-c-o;if((s=bt(e,t,n,r,n-u+l-o,h,n+u-l+o,h,!1)).length>0)return s;var d=n+u+o;if((s=bt(e,t,n,r,d,r-c+l-o,d,r+c-l+o,!1)).length>0)return s;var f=r+c+o;if((s=bt(e,t,n,r,n-u+l-o,f,n+u-l+o,f,!1)).length>0)return s;var p,v=n-u-o;if((s=bt(e,t,n,r,v,r-c+l-o,v,r+c-l+o,!1)).length>0)return s;var g=n-u+l,y=r-c+l;if((p=yt(e,t,n,r,g,y,l+o)).length>0&&p[0]<=g&&p[1]<=y)return[p[0],p[1]];var m=n+u-l,b=r-c+l;if((p=yt(e,t,n,r,m,b,l+o)).length>0&&p[0]>=m&&p[1]<=b)return[p[0],p[1]];var x=n+u-l,w=r+c-l;if((p=yt(e,t,n,r,x,w,l+o)).length>0&&p[0]>=x&&p[1]>=w)return[p[0],p[1]];var E=n-u+l,k=r+c-l;return(p=yt(e,t,n,r,E,k,l+o)).length>0&&p[0]<=E&&p[1]>=k?[p[0],p[1]]:[]},lt=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),h=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=h+s},ut=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,h=Math.min(r,s,a)-l,d=Math.max(r,s,a)+l;return!(e<u||e>c||t<h||t>d)},ct=function(e,t,n,r,i,a,o,s){var l=[];!function(e,t,n,r,i){var a,o,s,l,u,c,h,d;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,h=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,i[5]=-h):(i[5]=i[3]=0,0===a?(d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*d-h,i[4]=i[2]=-(d+h)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),i[4]=-h+d*Math.cos((l+4*Math.PI)/3)))}(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,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,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,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var h,d,f,p=-1,v=0;v<u.length;v++)h=Math.pow(1-u[v],2)*n+2*(1-u[v])*u[v]*i+u[v]*u[v]*o,d=Math.pow(1-u[v],2)*r+2*(1-u[v])*u[v]*a+u[v]*u[v]*s,f=Math.pow(h-e,2)+Math.pow(d-t,2),p>=0?f<p&&(p=f):p=f;return p},ht=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-r],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],h=c*c/l;return c<0?u:h>l?(e-i)*(e-i)+(t-a)*(t-a):u-h},dt=function(e,t,n){for(var r,i,a,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],i=n[2*l+1],l+1<n.length/2?(a=n[2*(l+1)],o=n[2*(l+1)+1]):(a=n[2*(l+1-n.length/2)],o=n[2*(l+1-n.length/2)+1]),r==e&&a==e);else{if(!(r>=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},ft=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h,d=Math.cos(-u),f=Math.sin(-u),p=0;p<c.length/2;p++)c[2*p]=a/2*(n[2*p]*d-n[2*p+1]*f),c[2*p+1]=o/2*(n[2*p+1]*d+n[2*p]*f),c[2*p]+=r,c[2*p+1]+=i;if(l>0){var v=vt(c,-l);h=pt(v)}else h=c;return dt(e,t,h)},pt=function(e){for(var t,n,r,i,a,o,s,l,u=new Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],n=e[4*c+1],r=e[4*c+2],i=e[4*c+3],c<e.length/4-1?(a=e[4*(c+1)],o=e[4*(c+1)+1],s=e[4*(c+1)+2],l=e[4*(c+1)+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var h=bt(t,n,r,i,a,o,s,l,!0);u[2*c]=h[0],u[2*c+1]=h[1]}return u},vt=function(e,t){for(var n,r,i,a,o=new Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(i=e[2*(s+1)],a=e[2*(s+1)+1]):(i=e[0],a=e[1]);var l=a-r,u=-(i-n),c=Math.sqrt(l*l+u*u),h=l/c,d=u/c;o[4*s]=n+h*t,o[4*s+1]=r+d*t,o[4*s+2]=i+h*t,o[4*s+3]=a+d*t}return o},gt=function(e,t,n,r,i,a,o){return e-=i,t-=a,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},yt=function(e,t,n,r,i,a,o){var s=[n-e,r-t],l=[e-i,t-a],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),h=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(h<0)return[];var d=(-c+Math.sqrt(h))/(2*u),f=(-c-Math.sqrt(h))/(2*u),p=Math.min(d,f),v=Math.max(d,f),g=[];if(p>=0&&p<=1&&g.push(p),v>=0&&v<=1&&g.push(v),0===g.length)return[];var y=g[0]*s[0]+e,m=g[0]*s[1]+t;return g.length>1?g[0]==g[1]?[y,m]:[y,m,g[1]*s[0]+e,g[1]*s[1]+t]:[y,m]},mt=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},bt=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,f=r-t,p=s-a,v=h*d-p*u,g=c*d-f*u,y=p*c-h*f;if(0!==y){var m=v/y,b=g/y;return-.001<=m&&m<=1.001&&-.001<=b&&b<=1.001||l?[e+m*c,t+m*f]:[]}return 0===v||0===g?mt(e,n,o)===o?[o,s]:mt(e,n,i)===i?[i,a]:mt(i,o,n)===n?[n,r]:[]:[]},xt=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,f,p=[],v=new Array(n.length),g=!0;if(null==a&&(g=!1),g){for(var y=0;y<v.length/2;y++)v[2*y]=n[2*y]*a+r,v[2*y+1]=n[2*y+1]*o+i;if(s>0){var m=vt(v,-s);u=pt(m)}else u=v}else u=n;for(var b=0;b<u.length/2;b++)c=u[2*b],h=u[2*b+1],b<u.length/2-1?(d=u[2*(b+1)],f=u[2*(b+1)+1]):(d=u[0],f=u[1]),0!==(l=bt(e,t,r,i,c,h,d,f)).length&&p.push(l[0],l[1]);return p},wt=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},Et=function(e,t){var n=_t(e,t);return n=kt(n)},kt=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var u=2/(o-i),c=2/(s-a),h=0;h<r;h++)t=e[2*h]=e[2*h]*u,n=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var d=0;d<r;d++)n=e[2*d+1]=e[2*d+1]+(-1-a);return e},_t=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i,a=new Array(2*e),o=0;o<e;o++)i=o*n+r,a[2*o]=Math.cos(i),a[2*o+1]=Math.sin(-i);return a},Ct=function(e,t){return Math.min(e/4,t/4,8)},St=function(e,t){return Math.min(e/10,t/10,8)},Pt=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Tt=ge({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),At={pageRank:function(e){for(var t=Tt(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),l=s.nodes,u=s.edges,c=l.length,h=c*c,d=u.length,f=new Array(h),p=new Array(c),v=(1-n)/c,g=0;g<c;g++){for(var y=0;y<c;y++){f[g*c+y]=0}p[g]=0}for(var m=0;m<d;m++){var b=u[m],x=b.data("source"),w=b.data("target");if(x!==w){var E=l.indexOfId(x),k=l.indexOfId(w),_=a(b);f[k*c+E]+=_,p[E]+=_}}for(var C=1/c+v,S=0;S<c;S++)if(0===p[S])for(var P=0;P<c;P++){f[P*c+S]=C}else for(var T=0;T<c;T++){var A=T*c+S;f[A]=f[A]/p[S]+v}for(var D,M=new Array(c),O=new Array(c),B=0;B<c;B++)M[B]=1;for(var L=0;L<i;L++){for(var I=0;I<c;I++)O[I]=0;for(var N=0;N<c;N++)for(var z=0;z<c;z++){var R=N*c+z;O[N]+=f[R]*M[z]}Ue(O),D=M,M=O,O=D;for(var j=0,V=0;V<c;V++){var F=D[V]-M[V];j+=F*F}if(j<r)break}return{rank:function(e){return e=o.collection(e)[0],M[l.indexOf(e)]}}}},Dt=ge({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Mt={degreeCentralityNormalized:function(e){e=Dt(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<r;l++){var u=n[l],c=u.id();e.root=u;var h=this.degreeCentrality(e);o<h.indegree&&(o=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,a[c]=h.outdegree}return{indegree:function(e){return 0==o?0:(b(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(b(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var d={},f=0,p=0;p<r;p++){var v=n[p];e.root=v;var g=this.degreeCentrality(e);f<g.degree&&(f=g.degree),d[v.id()]=g.degree}return{degree:function(e){return 0===f?0:(b(e)&&(e=t.filter(e)),d[e.id()]/f)}}},degreeCentrality:function(e){e=Dt(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),u=l.filter((function(e){return e.target().same(i)&&n.has(e)})),c=l.filter((function(e){return e.source().same(i)&&n.has(e)})),h=u.length,d=c.length,f=0,p=0,v=0;v<u.length;v++)f+=a(u[v]);for(var g=0;g<c.length;g++)p+=a(c[g]);return{indegree:Math.pow(h,1-s)*Math.pow(f,s),outdegree:Math.pow(d,1-s)*Math.pow(p,s)}}for(var y=i.connectedEdges().intersection(n),m=y.length,b=0,x=0;x<y.length;x++)b+=a(y[x]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};Mt.dc=Mt.degreeCentrality,Mt.dcn=Mt.degreeCentralityNormalised=Mt.degreeCentralityNormalized;var Ot=ge({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Bt={closenessCentralityNormalized:function(e){for(var t=Ot(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:i}),c=0;c<l.length;c++){for(var h=0,d=l[c],f=0;f<l.length;f++)if(c!==f){var p=u.distance(d,l[f]);h+=n?1/p:p}n||(h=1/h),s<h&&(s=h),o[d.id()]=h}return{closeness:function(e){return 0==s?0:(e=b(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=Ot(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var h=o.distanceTo(c);s+=a?1/h:h}}return a?s:1/s}};Bt.cc=Bt.closenessCentrality,Bt.ccn=Bt.closenessCentralityNormalised=Bt.closenessCentralityNormalized;var Lt=ge({weight:null,directed:!1}),It={betweennessCentrality:function(e){for(var t=Lt(e),n=t.directed,r=t.weight,i=null!=r,o=this.cy(),s=this.nodes(),l={},u={},c=0,h=function(e,t){u[e]=t,t>c&&(c=t)},d=function(e){return u[e]},f=0;f<s.length;f++){var p=s[f],v=p.id();l[v]=n?p.outgoers().nodes():p.openNeighborhood().nodes(),h(v,0)}for(var g=function(e){for(var t=s[e].id(),n=[],u={},c={},f={},p=new a((function(e,t){return f[e]-f[t]})),v=0;v<s.length;v++){var g=s[v].id();u[g]=[],c[g]=0,f[g]=1/0}for(c[t]=1,f[t]=0,p.push(t);!p.empty();){var y=p.pop();if(n.push(y),i)for(var m=0;m<l[y].length;m++){var b=l[y][m],x=o.getElementById(y),w=void 0;w=x.edgesTo(b).length>0?x.edgesTo(b)[0]:b.edgesTo(x)[0];var E=r(w);b=b.id(),f[b]>f[y]+E&&(f[b]=f[y]+E,p.nodes.indexOf(b)<0?p.push(b):p.updateItem(b),c[b]=0,u[b]=[]),f[b]==f[y]+E&&(c[b]=c[b]+c[y],u[b].push(y))}else for(var k=0;k<l[y].length;k++){var _=l[y][k].id();f[_]==1/0&&(p.push(_),f[_]=f[y]+1),f[_]==f[y]+1&&(c[_]=c[_]+c[y],u[_].push(y))}}for(var C={},S=0;S<s.length;S++)C[s[S].id()]=0;for(;n.length>0;)for(var P=n.pop(),T=0;T<u[P].length;T++){var A=u[P][T];C[A]=C[A]+c[A]/c[P]*(1+C[P]),P!=s[e].id()&&h(P,d(P)+C[P])}},y=0;y<s.length;y++)g(y);var m={betweenness:function(e){var t=o.collection(e).id();return d(t)},betweennessNormalized:function(e){if(0==c)return 0;var t=o.collection(e).id();return d(t)/c}};return m.betweennessNormalised=m.betweennessNormalized,m}};It.bc=It.betweennessCentrality;var Nt=ge({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),zt=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Rt=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},jt=function(e,t,n){for(var r=new Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},Vt=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=jt(e,r,t);return e},Ft=function(e,t,n){for(var r=new Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return Rt(r,t),r},qt=function(e,t,n,r){for(var i=0;i<n;i++){if(Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r)!==Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r))return!1}return!0},Xt=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},Yt=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=function(e){return Nt(e)}(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=new Array(u),h=0;h<u;h++)c[h]=0;for(var d=0;d<n.length;d++){var f=n[d],p=a[f.source().id()],v=a[f.target().id()],g=zt(f,i.attributes);c[p*l+v]+=g,c[v*l+p]+=g}!function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n}(c,l,i.multFactor),Rt(c,l);for(var y=!0,m=0;y&&m<i.maxIterations;)y=!1,s=Vt(c,l,i.expandFactor),c=Ft(s,l,i.inflateFactor),qt(c,s,u,4)||(y=!0),m++;var b=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,l,t,r);return b=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Xt(e[t],e[n])&&e.splice(n,1);return e}(b)},Gt={markovClustering:Yt,mcl:Yt},Ht=function(e){return e},Wt=function(e,t){return Math.abs(t-e)},Ut=function(e,t,n){return e+Wt(t,n)},Kt=function(e,t,n){return e+Math.pow(n-t,2)},Zt=function(e){return Math.sqrt(e)},$t=function(e,t,n){return Math.max(e,Wt(t,n))},Qt=function(e,t,n,r,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Ht,o=r,s=0;s<e;s++)o=i(o,t(s),n(s));return a(o)},Jt={euclidean:function(e,t,n){return e>=2?Qt(e,t,n,0,Kt,Zt):Qt(e,t,n,0,Ut)},squaredEuclidean:function(e,t,n){return Qt(e,t,n,0,Kt)},manhattan:function(e,t,n){return Qt(e,t,n,0,Ut)},max:function(e,t,n){return Qt(e,t,n,-1/0,$t)}};function en(e,t,n,r,i,a){var o;return o=x(e)?e:Jt[e]||Jt.euclidean,0===t&&x(e)?o(i,a):o(t,n,r,i,a)}Jt["squared-euclidean"]=Jt.squaredEuclidean,Jt.squaredeuclidean=Jt.squaredEuclidean;var tn=ge({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),nn=function(e){return tn(e)},rn=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return en(e,r.length,a,(function(e){return r[e](t)}),o,s)},an=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,a[l]=e.max(n[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(a[c]-i[c])+i[c];o[u]=s}return o},on=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=rn(n,e,t[s],r,i);l<a&&(a=l,o=s)}return o},sn=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)n[(i=t[a]).id()]===e&&r.push(i);return r},ln=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++){if(Math.abs(e[r][i]-t[r][i])>n)return!1}return!0},un=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},cn=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];un(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},hn=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=rn("manhattan",t[i],e,n,"kMedoids");return r},dn=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],i.m);for(var u=0;u<e.length;u++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var h=0;h<t.length;h++)a+=r[h][u]*i.attributes[c](t[h]),o+=r[h][u];e[u][c]=a/o}},fn=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,l,u=2/(i.m-1),c=0;c<n.length;c++)for(var h=0;h<r.length;h++){o=0;for(var d=0;d<n.length;d++)s=rn(i.distance,r[h],n[c],i.attributes,"cmeans"),l=rn(i.distance,r[h],n[d],i.attributes,"cmeans"),o+=Math.pow(s/l,u);e[h][c]=1/o}},pn=function(e){var t,n,r,i,a=this.cy(),o=this.nodes(),s=nn(e);r=new Array(o.length);for(var l=0;l<o.length;l++)r[l]=new Array(s.k);n=new Array(o.length);for(var u=0;u<o.length;u++)n[u]=new Array(s.k);for(var c=0;c<o.length;c++){for(var h=0,d=0;d<s.k;d++)n[c][d]=Math.random(),h+=n[c][d];for(var f=0;f<s.k;f++)n[c][f]=n[c][f]/h}t=new Array(s.k);for(var p=0;p<s.k;p++)t[p]=new Array(s.attributes.length);i=new Array(o.length);for(var v=0;v<o.length;v++)i[v]=new Array(s.k);for(var g=!0,y=0;g&&y<s.maxIterations;)g=!1,dn(t,o,n,i,s),fn(n,r,t,o,s),ln(n,r,s.sensitivityThreshold)||(g=!0),y++;return{clusters:function(e,t,n,r){for(var i,a,o=new Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var u=0;u<t[0].length;u++)t[l][u]>i&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c<o.length;c++)o[c]=r.collection(o[c]);return o}(o,n,s,a),degreeOfMembership:n}},vn={kMeans:function(e){var t,n=this.cy(),r=this.nodes(),i=null,a=nn(e),s=new Array(a.k),l={};t=a.testMode?"number"==typeof a.testCentroids?an(r,a.k,a.attributes):"object"===o(a.testCentroids)?a.testCentroids:an(r,a.k,a.attributes):an(r,a.k,a.attributes);for(var u,c,h,d=!0,f=0;d&&f<a.maxIterations;){for(var p=0;p<r.length;p++)l[(i=r[p]).id()]=on(i,t,a.distance,a.attributes,"kMeans");d=!1;for(var v=0;v<a.k;v++){var g=sn(v,r,l);if(0!==g.length){for(var y=a.attributes.length,m=t[v],b=new Array(y),x=new Array(y),w=0;w<y;w++){x[w]=0;for(var E=0;E<g.length;E++)i=g[E],x[w]+=a.attributes[w](i);b[w]=x[w]/g.length,u=b[w],c=m[w],h=a.sensitivityThreshold,Math.abs(c-u)<=h||(d=!0)}t[v]=b,s[v]=n.collection(g)}}f++}return s},kMedoids:function(e){var t,n,r=this.cy(),i=this.nodes(),a=null,s=nn(e),l=new Array(s.k),u={},c=new Array(s.k);s.testMode?"number"==typeof s.testCentroids||(t="object"===o(s.testCentroids)?s.testCentroids:cn(i,s.k)):t=cn(i,s.k);for(var h=!0,d=0;h&&d<s.maxIterations;){for(var f=0;f<i.length;f++)u[(a=i[f]).id()]=on(a,t,s.distance,s.attributes,"kMedoids");h=!1;for(var p=0;p<t.length;p++){var v=sn(p,i,u);if(0!==v.length){c[p]=hn(t[p],v,s.attributes);for(var g=0;g<v.length;g++)(n=hn(v[g],v,s.attributes))<c[p]&&(c[p]=n,t[p]=v[g],h=!0);l[p]=r.collection(v)}}d++}return l},fuzzyCMeans:pn,fcm:pn},gn=ge({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),yn={single:"min",complete:"max"},mn=function(e,t,n,r,i){for(var a,o=0,s=1/0,l=i.attributes,u=function(e,t){return en(i.distance,l.length,(function(t){return l[t](e)}),(function(e){return l[e](t)}),e,t)},c=0;c<e.length;c++){var h=e[c].key,d=n[h][r[h]];d<s&&(o=h,s=d)}if("threshold"===i.mode&&s>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var f,p=t[o],v=t[r[o]];f="dendrogram"===i.mode?{left:p,right:v,key:p.key}:{value:p.value.concat(v.value),key:p.key},e[p.index]=f,e.splice(v.index,1),t[p.key]=f;for(var g=0;g<e.length;g++){var y=e[g];p.key===y.key?a=1/0:"min"===i.linkage?(a=n[p.key][y.key],n[p.key][y.key]>n[v.key][y.key]&&(a=n[v.key][y.key])):"max"===i.linkage?(a=n[p.key][y.key],n[p.key][y.key]<n[v.key][y.key]&&(a=n[v.key][y.key])):a="mean"===i.linkage?(n[p.key][y.key]*p.size+n[v.key][y.key]*v.size)/(p.size+v.size):"dendrogram"===i.mode?u(y.value,p.value):u(y.value[0],p.value[0]),n[p.key][y.key]=n[y.key][p.key]=a}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===p.key||r[b]===v.key){for(var x=b,w=0;w<e.length;w++){var E=e[w].key;n[b][E]<n[b][x]&&(x=E)}r[b]=x}e[m].index=m}return p.key=v.key=p.index=v.index=null,!0},bn=function e(t,n,r){t&&(t.value?n.push(t.value):(t.left&&e(t.left,n),t.right&&e(t.right,n)))},xn=function(e){for(var t=this.cy(),n=this.nodes(),r=function(e){var t=gn(e),n=yn[t.linkage];return null!=n&&(t.linkage=n),t}(e),i=r.attributes,a=function(e,t){return en(r.distance,i.length,(function(t){return i[t](e)}),(function(e){return i[e](t)}),e,t)},o=[],s=[],l=[],u=[],c=0;c<n.length;c++){var h={value:"dendrogram"===r.mode?n[c]:[n[c]],key:c,index:c};o[c]=h,u[c]=h,s[c]=[],l[c]=0}for(var d=0;d<o.length;d++)for(var f=0;f<=d;f++){var p=void 0;p="dendrogram"===r.mode?d===f?1/0:a(o[d].value,o[f].value):d===f?1/0:a(o[d].value[0],o[f].value[0]),s[d][f]=p,s[f][d]=p,p<s[d][l[d]]&&(l[d]=f)}for(var v,g=mn(o,u,s,l,r);g;)g=mn(o,u,s,l,r);return"dendrogram"===r.mode?(v=function e(t,n,r){if(!t)return[];var i=[],a=[],o=[];return 0===n?(t.left&&bn(t.left,i),t.right&&bn(t.right,a),o=i.concat(a),[r.collection(o)]):1===n?t.value?[r.collection(t.value)]:(t.left&&bn(t.left,i),t.right&&bn(t.right,a),[r.collection(i),r.collection(a)]):t.value?[r.collection(t.value)]:(t.left&&(i=e(t.left,n-1,r)),t.right&&(a=e(t.right,n-1,r)),i.concat(a))}(o[0],r.dendrogramDepth,t),r.addDendrogram&&function e(t,n){if(!t)return"";if(t.left&&t.right){var r=e(t.left,n),i=e(t.right,n),a=n.add({group:"nodes",data:{id:r+","+i}});return n.add({group:"edges",data:{source:r,target:a.id()}}),n.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}return t.value?t.value.id():void 0}(o[0],t)):(v=new Array(o.length),o.forEach((function(e,n){e.key=e.index=null,v[n]=t.collection(e.value)}))),v},wn={hierarchicalClustering:xn,hca:xn},En=ge({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),kn=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-en(e,r.length,(function(e){return i(t,e)}),(function(e){return i(n,e)}),t,n)},_n=function(e,t){return"median"===t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i}(e):"min"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,r))}return r}(e):"max"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r}(e):t},Cn=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},Sn=function(e){for(var t,n,r,i,a,o,s=this.cy(),l=this.nodes(),u=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||ue("Damping must range on [0.5, 1).  Got: ".concat(t));var r=["median","mean","min","max"];return r.some((function(e){return e===n}))||k(n)||ue("Preference must be one of [".concat(r.map((function(e){return"'".concat(e,"'")})).join(", "),"] or a number.  Got: ").concat(n)),En(e)}(e),c={},h=0;h<l.length;h++)c[l[h].id()]=h;n=(t=l.length)*t,r=new Array(n);for(var d=0;d<n;d++)r[d]=-1/0;for(var f=0;f<t;f++)for(var p=0;p<t;p++)f!==p&&(r[f*t+p]=kn(u.distance,l[f],l[p],u.attributes));i=_n(r,u.preference);for(var v=0;v<t;v++)r[v*t+v]=i;a=new Array(n);for(var g=0;g<n;g++)a[g]=0;o=new Array(n);for(var y=0;y<n;y++)o[y]=0;for(var m=new Array(t),b=new Array(t),x=new Array(t),w=0;w<t;w++)m[w]=0,b[w]=0,x[w]=0;for(var E,_=new Array(t*u.minIterations),C=0;C<_.length;C++)_[C]=0;for(E=0;E<u.maxIterations;E++){for(var S=0;S<t;S++){for(var P=-1/0,T=-1/0,A=-1,D=0,M=0;M<t;M++)m[M]=a[S*t+M],(D=o[S*t+M]+r[S*t+M])>=P?(T=P,P=D,A=M):D>T&&(T=D);for(var O=0;O<t;O++)a[S*t+O]=(1-u.damping)*(r[S*t+O]-P)+u.damping*m[O];a[S*t+A]=(1-u.damping)*(r[S*t+A]-T)+u.damping*m[A]}for(var B=0;B<t;B++){for(var L=0,I=0;I<t;I++)m[I]=o[I*t+B],b[I]=Math.max(0,a[I*t+B]),L+=b[I];L-=b[B],b[B]=a[B*t+B],L+=b[B];for(var N=0;N<t;N++)o[N*t+B]=(1-u.damping)*Math.min(0,L-b[N])+u.damping*m[N];o[B*t+B]=(1-u.damping)*(L-b[B])+u.damping*m[B]}for(var z=0,R=0;R<t;R++){var j=o[R*t+R]+a[R*t+R]>0?1:0;_[E%u.minIterations*t+R]=j,z+=j}if(z>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var V=0,F=0;F<t;F++){x[F]=0;for(var q=0;q<u.minIterations;q++)x[F]+=_[q*t+F];0!==x[F]&&x[F]!==u.minIterations||V++}if(V===t)break}}for(var X=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r}(t,a,o),Y=function(e,t,n){for(var r=Cn(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,l=-1/0,u=0;u<a.length;u++){for(var c=0,h=0;h<a.length;h++)c+=t[a[h]*e+a[u]];c>l&&(s=u,l=c)}n[i]=a[s]}return r=Cn(e,t,n)}(t,r,X),G={},H=0;H<X.length;H++)G[X[H]]=[];for(var W=0;W<l.length;W++){var U=Y[c[l[W].id()]];null!=U&&G[U].push(l[W])}for(var K=new Array(X.length),Z=0;Z<X.length;Z++)K[Z]=s.collection(G[X[Z]]);return K},Pn={affinityPropagation:Sn,ap:Sn},Tn=ge({root:void 0,directed:!1}),An=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function s(l,u,c){l===c&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var h,d,f,p,v=e.getElementById(u).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(u))):v.forEach((function(n){h=n.source().id(),d=n.target().id(),(f=h===u?d:h)!==c&&(p=n.id(),o[p]||(o[p]=!0,a.push({x:u,y:f,edge:n})),f in t?t[u].low=Math.min(t[u].low,t[f].id):(s(l,f,u),t[u].low=Math.min(t[u].low,t[f].low),t[u].id<=t[f].low&&(t[u].cutVertex=!0,function(n,r){for(var o=a.length-1,s=[],l=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach((function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach((function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter((function(e){return e.isLoop()}))):l.merge(i)}))})),i.push(l)}(u,f))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,s(n,n),t[n].cutVertex=r>1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:i}},Dn=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e);return e.forEach((function(o){if(o.isNode()){var s=o.id();s in t||function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),h=l.merge(c);r.push(h),a=a.difference(h)}}(s)}})),{cut:a,components:r}},Mn={};[Se,Te,Ae,Me,Be,Ie,je,At,Mt,Bt,It,Gt,vn,wn,Pn,{hierholzer:function(e){if(!E(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=Tn(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=b(o)?this.filter(o)[0].id():o[0].id());var c={},h={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else h[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):h[t]=[e.source().id(),e.target().id()]}));var d={found:!1,trail:void 0};if(u)return d;if(r&&n)if(s){if(i&&r!=i)return d;i=r}else{if(i&&r!=i&&n!=i)return d;i||(i=r)}else i||(i=l[0].id());var f=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=h[t][0],i!=(r=h[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},p=[],v=[];for(v=f(i);1!=v.length;)0==c[v[0]].length?(p.unshift(l.getElementById(v.shift())),p.unshift(l.getElementById(v.shift()))):v=f(v.shift()).concat(v);for(var g in p.unshift(l.getElementById(v.shift())),c)if(c[g].length)return d;return d.found=!0,d.trail=this.spawn(p),d}},{hopcroftTarjanBiconnected:An,htbc:An,htb:An,hopcroftTarjanBiconnectedComponents:An},{tarjanStronglyConnected:Dn,tsc:Dn,tscc:Dn,tarjanStronglyConnectedComponents:Dn}].forEach((function(e){j(Mn,e)}));var On=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};On.prototype={fulfill:function(e){return Bn(this,1,"fulfillValue",e)},reject:function(e){return Bn(this,2,"rejectReason",e)},then:function(e,t){var n=new On;return this.onFulfilled.push(Nn(e,n,"fulfill")),this.onRejected.push(Nn(t,n,"reject")),Ln(this),n.proxy}};var Bn=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Ln(e)),e},Ln=function(e){1===e.state?In(e,"onFulfilled",e.fulfillValue):2===e.state&&In(e,"onRejected",e.rejectReason)},In=function(e,n,r){if(0!==e[n].length){var i=e[n];e[n]=[];var a=function(){for(var e=0;e<i.length;e++)i[e](r)};"function"==typeof t?t(a):setTimeout(a,0)}},Nn=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(e){return void t.reject(e)}zn(t,i)}}},zn=function e(t,n){if(t!==n&&t.proxy!==n){var r;if("object"===o(n)&&null!==n||"function"==typeof n)try{r=n.then}catch(e){return void t.reject(e)}if("function"!=typeof r)t.fulfill(n);else{var i=!1;try{r.call(n,(function(r){i||(i=!0,r===n?t.reject(new TypeError("circular thenable chain")):e(t,r))}),(function(e){i||(i=!0,t.reject(e))}))}catch(e){i||t.reject(e)}}}else t.reject(new TypeError("cannot resolve promise with itself"))};On.all=function(e){return new On((function(t,n){for(var r=new Array(e.length),i=0,a=function(n,a){r[n]=a,++i===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then((function(e){a(t,e)}),(function(e){n(e)})):a(t,r)}(o)}))},On.resolve=function(e){return new On((function(t,n){t(e)}))},On.reject=function(e){return new On((function(t,n){n(e)}))};var Rn="undefined"!=typeof Promise?Promise:On,jn=function(e,t,n){var r=T(e),i=!r,a=this._private=j({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&x(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},Vn=jn.prototype;j(Vn,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),C(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;switch(e){case"frame":t=n.frames;break;default:case"complete":case"completed":t=n.completes}return new Rn((function(e,n){t.push((function(){e()}))}))}}),Vn.complete=Vn.completed,Vn.run=Vn.play,Vn.running=Vn.playing;var Fn={};[{animated:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return!1;var t=e[0];return t?t._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t<e.length;t++){e[t]._private.animation.queue=[]}return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=void 0!==this.length,r=n?this:[this],i=this._private.cy||this,a=!n,o=!a;if(!i.styleEnabled())return this;var s=i.style();if(e=j({},e,t),0===Object.keys(e).length)return new jn(r[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(o&&(e.style=s.getPropsList(e.style||e.css),e.css=void 0),o&&null!=e.renderedPosition){var l=e.renderedPosition,u=i.pan(),c=i.zoom();e.position=Fe(l,c,u)}if(a&&null!=e.panBy){var h=e.panBy,d=i.pan();e.pan={x:d.x+h.x,y:d.y+h.y}}var f=e.center||e.centre;if(a&&null!=f){var p=i.getCenterPan(f.eles,e.zoom);null!=p&&(e.pan=p)}if(a&&null!=e.fit){var v=e.fit,g=i.getFitViewport(v.eles||v.boundingBox,v.padding);null!=g&&(e.pan=g.pan,e.zoom=g.zoom)}if(a&&E(e.zoom)){var y=i.getZoomedViewport(e.zoom);null!=y?(y.zoomed&&(e.zoom=y.zoom),y.panned&&(e.pan=y.pan)):e.zoom=null}return new jn(r[0],e)}},animate:function(){return function(e,t){var n=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=j({},e,t));for(var r=0;r<n.length;r++){var i=n[r],a=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,a?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=void 0!==this.length?this:[this],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var i=0;i<n.length;i++){for(var a=n[i]._private,o=a.animation.current,s=0;s<o.length;s++){var l=o[s]._private;t&&(l.duration=0)}e&&(a.animation.queue=[]),t||(a.animation.current=[])}return r.notify("draw"),this}}},{data:function(e){return e=j({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=void 0!==this.length,a=i?this:[this],o=i?this[0]:this;if(b(t)){var s;if(r.allowGetting&&void 0===n)return o&&(r.beforeGet(o),s=o._private[r.field][t]),s;if(r.allowSetting&&void 0!==n&&!r.immutableKeys[t]){var l=c({},t,n);r.beforeSet(this,l);for(var u=0,h=a.length;u<h;u++){var d=a[u];r.canSet(d)&&(d._private[r.field][t]=n)}r.updateStyle&&this.updateStyle(),r.onSet(this),r.settingTriggersEvent&&this[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&E(t)){var f,p,v=t,g=Object.keys(v);r.beforeSet(this,v);for(var y=0;y<g.length;y++){if(p=v[f=g[y]],!r.immutableKeys[f])for(var m=0;m<a.length;m++){var w=a[m];r.canSet(w)&&(w._private[r.field][f]=p)}}r.updateStyle&&this.updateStyle(),r.onSet(this),r.settingTriggersEvent&&this[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&x(t)){var k=t;this.on(r.bindingEvent,k)}else if(r.allowGetting&&void 0===t){var _;return o&&(r.beforeGet(o),_=o._private[r.field]),_}return this}},removeData:function(e){return e=j({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=void 0!==this.length?this:[this];if(b(t)){for(var i=t.split(/\s+/),a=i.length,o=0;o<a;o++){var s=i[o];if(!D(s))if(!n.immutableKeys[s])for(var l=0,u=r.length;l<u;l++)r[l]._private[n.field][s]=void 0}n.triggerEvent&&this[n.triggerFnName](n.event)}else if(void 0===t){for(var c=0,h=r.length;c<h;c++)for(var d=r[c]._private[n.field],f=Object.keys(d),p=0;p<f.length;p++){var v=f[p];!n.immutableKeys[v]&&(d[v]=void 0)}n.triggerEvent&&this[n.triggerFnName](n.event)}return this}}},{eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new Rn((function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)}))}}}].forEach((function(e){j(Fn,e)}));var qn={animate:Fn.animate(),animation:Fn.animation(),animated:Fn.animated(),clearQueue:Fn.clearQueue(),delay:Fn.delay(),delayAnimation:Fn.delayAnimation(),stop:Fn.stop()},Xn={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach((function(e){return t.push(e)})),t}w(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],r=new ke(e),i=0;i<this.length;i++){for(var a=this[i],o=a._private,s=o.classes,l=!1,u=0;u<e.length;u++){var c=e[u];if(!s.has(c)){l=!0;break}}l||(l=s.size!==e.length),l&&(o.classes=r,n.push(a))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},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){w(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i<a;i++)for(var o=this[i],s=o._private.classes,l=!1,u=0;u<e.length;u++){var c=e[u],h=s.has(c),d=!1;t||n&&!h?(s.add(c),d=!0):(!t||n&&h)&&(s.delete(c),d=!0),!l&&d&&(r.push(o),l=!0)}return r.length>0&&this.spawn(r).updateStyle().emit("class"),this},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}};Xn.className=Xn.classNames=Xn.classes;var Yn={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:z,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Yn.variable="(?:[\\w-]|(?:\\\\"+Yn.metaChar+"))+",Yn.value=Yn.string+"|"+Yn.number,Yn.className=Yn.variable,Yn.id=Yn.variable,function(){var e,t,n;for(e=Yn.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],Yn.comparatorOp+="|@"+t;for(e=Yn.comparatorOp.split("|"),n=0;n<e.length;n++)(t=e[n]).indexOf("!")>=0||"="!==t&&(Yn.comparatorOp+="|\\!"+t)}();var Gn=0,Hn=1,Wn=2,Un=3,Kn=4,Zn=5,$n=6,Qn=7,Jn=8,er=9,tr=10,nr=11,rr=12,ir=13,ar=14,or=15,sr=16,lr=17,ur=18,cr=19,hr=20,dr=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*R(e,t)}(e.selector,t.selector)})),fr=function(){for(var e,t={},n=0;n<dr.length;n++)t[(e=dr[n]).selector]=e.matches;return t}(),pr="("+dr.map((function(e){return e.selector})).join("|")+")",vr=function(e){return e.replace(new RegExp("\\\\("+Yn.metaChar+")","g"),(function(e,t){return t}))},gr=function(e,t,n){e[e.length-1]=n},yr=[{name:"group",query:!0,regex:"("+Yn.group+")",populate:function(e,t,n){var r=h(n,1)[0];t.checks.push({type:Gn,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:pr,populate:function(e,t,n){var r=h(n,1)[0];t.checks.push({type:Qn,value:r})}},{name:"id",query:!0,regex:"\\#("+Yn.id+")",populate:function(e,t,n){var r=h(n,1)[0];t.checks.push({type:Jn,value:vr(r)})}},{name:"className",query:!0,regex:"\\.("+Yn.className+")",populate:function(e,t,n){var r=h(n,1)[0];t.checks.push({type:er,value:vr(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Yn.variable+")\\s*\\]",populate:function(e,t,n){var r=h(n,1)[0];t.checks.push({type:Kn,field:vr(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Yn.variable+")\\s*("+Yn.comparatorOp+")\\s*("+Yn.value+")\\s*\\]",populate:function(e,t,n){var r=h(n,3),i=r[0],a=r[1],o=r[2];o=null!=new RegExp("^"+Yn.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:Un,field:vr(i),operator:a,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Yn.boolOp+")\\s*("+Yn.variable+")\\s*\\]",populate:function(e,t,n){var r=h(n,2),i=r[0],a=r[1];t.checks.push({type:Zn,field:vr(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Yn.meta+")\\s*("+Yn.comparatorOp+")\\s*("+Yn.number+")\\s*\\]\\]",populate:function(e,t,n){var r=h(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:$n,field:vr(i),operator:a,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Yn.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]={checks:[]}}},{name:"directedEdge",separator:!0,regex:Yn.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,i={checks:[]};return n.checks.push({type:nr,source:r,target:i}),gr(e,0,n),e.edgeCount++,i}var a={checks:[]},o=t,s={checks:[]};return a.checks.push({type:rr,source:o,target:s}),gr(e,0,a),e.edgeCount++,s}},{name:"undirectedEdge",separator:!0,regex:Yn.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,i={checks:[]};return n.checks.push({type:tr,nodes:[r,i]}),gr(e,0,n),e.edgeCount++,i}var a={checks:[]},o=t,s={checks:[]};return a.checks.push({type:ar,node:o,neighbor:s}),gr(e,0,a),s}},{name:"child",separator:!0,regex:Yn.child,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},i=e[e.length-1];return n.checks.push({type:or,parent:i,child:r}),gr(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var a={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return a.checks.push({type:cr,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:hr}],c.checks.push({type:hr}),s.checks.push({type:lr,parent:c,child:u}),gr(e,0,a),e.currentSubject=l,e.compoundCount++,u}var h={checks:[]},d={checks:[]},f=[{type:lr,parent:h,child:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"descendant",separator:!0,regex:Yn.descendant,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},i=e[e.length-1];return n.checks.push({type:sr,ancestor:i,descendant:r}),gr(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var a={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return a.checks.push({type:cr,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:hr}],c.checks.push({type:hr}),s.checks.push({type:ur,ancestor:c,descendant:u}),gr(e,0,a),e.currentSubject=l,e.compoundCount++,u}var h={checks:[]},d={checks:[]},f=[{type:ur,ancestor:h,descendant:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"subject",modifier:!0,regex:Yn.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return he("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=null==n?null:n.type;r===nr?n.type=ir:r===tr&&(n.type=ar,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];yr.forEach((function(e){return e.regexObj=new RegExp("^"+e.regex)}));var mr=function(e){for(var t,n,r,i=0;i<yr.length;i++){var a=yr[i],o=a.name,s=e.match(a.regexObj);if(null!=s){n=s,t=a,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},br={parse:function(e){var t=this.inputText=e,n=this[0]={checks:[]};for(this.length=1,t=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e}(t);;){var r=mr(t);if(null==r.expr)return he("The selector `"+e+"`is invalid"),!1;var i=r.match.slice(1),a=r.expr.populate(this,n,i);if(!1===a)return!1;if(null!=a&&(n=a),(t=r.remaining).match(/^\s*$/))break}var o=this[this.length-1];null!=this.currentSubject&&(o.subject=this.currentSubject),o.edgeCount=this.edgeCount,o.compoundCount=this.compoundCount;for(var s=0;s<this.length;s++){var l=this[s];if(l.compoundCount>0&&l.edgeCount>0)return he("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return he("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&he("The selector `"+e+"` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return b(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case Gn:var l=e(s);return l.substring(0,l.length-1);case Un:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case Zn:var h=r.operator,d=r.field;return"["+e(h)+d+"]";case Kn:return"["+r.field+"]";case $n:var f=r.operator;return"[["+r.field+n(e(f))+t(s)+"]]";case Qn:return s;case Jn:return"#"+s;case er:return"."+s;case lr:case or:return i(r.parent,a)+n(">")+i(r.child,a);case ur:case sr:return i(r.ancestor,a)+" "+i(r.descendant,a);case cr:var p=i(r.left,a),v=i(r.subject,a),g=i(r.right,a);return p+(p.length>0?" ":"")+v+g;case hr:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},xr=function(e,t,n){var r,i,a,o=b(e),s=k(e),l=b(n),u=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e<n;break;case"<=":h=!0,r=e<=n;break;default:r=!1}return!c||null==e&&h||(r=!r),r},wr=function(e,t){return e.data(t)},Er=[],kr=function(e,t){return e.checks.every((function(e){return Er[e.type](e,t)}))};Er[Gn]=function(e,t){var n=e.value;return"*"===n||n===t.group()},Er[Qn]=function(e,t){return function(e,t){return fr[e](t)}(e.value,t)},Er[Jn]=function(e,t){var n=e.value;return t.id()===n},Er[er]=function(e,t){var n=e.value;return t.hasClass(n)},Er[$n]=function(e,t){var n=e.field,r=e.operator,i=e.value;return xr(function(e,t){return e[t]()}(t,n),r,i)},Er[Un]=function(e,t){var n=e.field,r=e.operator,i=e.value;return xr(wr(t,n),r,i)},Er[Zn]=function(e,t){var n=e.field,r=e.operator;return function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}}(wr(t,n),r)},Er[Kn]=function(e,t){var n=e.field;e.operator;return void 0!==wr(t,n)},Er[tr]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return kr(n,i)&&kr(r,a)||kr(r,i)&&kr(n,a)},Er[ar]=function(e,t){return kr(e.node,t)&&t.neighborhood().some((function(t){return t.isNode()&&kr(e.neighbor,t)}))},Er[nr]=function(e,t){return kr(e.source,t.source())&&kr(e.target,t.target())},Er[rr]=function(e,t){return kr(e.source,t)&&t.outgoers().some((function(t){return t.isNode()&&kr(e.target,t)}))},Er[ir]=function(e,t){return kr(e.target,t)&&t.incomers().some((function(t){return t.isNode()&&kr(e.source,t)}))},Er[or]=function(e,t){return kr(e.child,t)&&kr(e.parent,t.parent())},Er[lr]=function(e,t){return kr(e.parent,t)&&t.children().some((function(t){return kr(e.child,t)}))},Er[sr]=function(e,t){return kr(e.descendant,t)&&t.ancestors().some((function(t){return kr(e.ancestor,t)}))},Er[ur]=function(e,t){return kr(e.ancestor,t)&&t.descendants().some((function(t){return kr(e.descendant,t)}))},Er[cr]=function(e,t){return kr(e.subject,t)&&kr(e.left,t)&&kr(e.right,t)},Er[hr]=function(){return!0},Er[Hn]=function(e,t){return e.value.has(t)},Er[Wn]=function(e,t){return(0,e.value)(t)};var _r=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||b(e)&&e.match(/^\s*$/)||(C(e)?this.addQuery({checks:[{type:Hn,value:e.collection()}]}):x(e)?this.addQuery({checks:[{type:Wn,value:e}]}):b(e)?this.parse(e)||(this.invalid=!0):ue("A selector must be created from a string; found "))},Cr=_r.prototype;[br,{matches:function(e){for(var t=0;t<this.length;t++){var n=this[t];if(kr(n,e))return!0}return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===Jn)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(kr(r,e))return!0}return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}}].forEach((function(e){return j(Cr,e)})),Cr.text=function(){return this.inputText},Cr.size=function(){return this.length},Cr.eq=function(e){return this[e]},Cr.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},Cr.addQuery=function(e){this[this.length++]=e},Cr.selector=Cr.toString;var Sr={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;n<this.length;n++){if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every((function(t){return e.hasElementWithId(t.id())})))},anySame:function(e){return e=this.cy().collection(e),this.some((function(t){return e.hasElementWithId(t.id())}))},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every((function(e){return t.hasElementWithId(e.id())}))},contains:function(e){e=this.cy().collection(e);var t=this;return e.every((function(e){return t.hasElementWithId(e.id())}))}};Sr.allAreNeighbours=Sr.allAreNeighbors,Sr.has=Sr.contains,Sr.equal=Sr.equals=Sr.same;var Pr,Tr,Ar=function(e,t){return function(n,r,i,a){var o,s=n;if(null==s?o="":C(s)&&1===s.length&&(o=s.id()),1===this.length&&o){var l=this[0]._private,u=l.traversalCache=l.traversalCache||{},c=u[t]=u[t]||[],h=Q(o),d=c[h];return d||(c[h]=e.call(this,n,r,i,a))}return e.call(this,n,r,i,a)}},Dr={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r]._private.parent;i&&t.push(i)}return this.spawn(t,{unique:!0}).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,{unique:!0}).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter((function(e){return e.isOrphan()})).filter(e)},nonorphans:function(e){return this.stdFilter((function(e){return e.isChild()})).filter(e)},children:Ar((function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);return this.spawn(t,{unique:!0}).filter(e)}),"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return function e(n){for(var r=0;r<n.length;r++){var i=n[r];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,{unique:!0}).filter(e)}};function Mr(e,t,n,r){for(var i=[],a=new ke,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?i.push(l):o&&r(i,a,l)}for(;i.length>0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Or(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function Br(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function Lr(e,t,n){Br(e,t,n),Or(e,t,n)}Dr.forEachDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Mr(this,e,t,Or)},Dr.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Mr(this,e,t,Br)},Dr.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Mr(this,e,t,Lr)},Dr.ancestors=Dr.parents,(Pr=Tr={data:Fn.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:Fn.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fn.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fn.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Fn.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fn.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Pr.data,Pr.removeAttr=Pr.removeData;var Ir,Nr,zr=Tr,Rr={};function jr(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&this.isNode()&&!this.removed()){for(var n=0,r=this[0],i=r._private.edges,a=0;a<i.length;a++){var o=i[a];!t&&o.isLoop()||(n+=e(r,o))}return n}}}function Vr(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);void 0===o||void 0!==r&&!t(o,r)||(r=o)}return r}}j(Rr,{degree:jr((function(e,t){return t.source().same(t.target())?2:1})),indegree:jr((function(e,t){return t.target().same(e)?1:0})),outdegree:jr((function(e,t){return t.source().same(e)?1:0}))}),j(Rr,{minDegree:Vr("degree",(function(e,t){return e<t})),maxDegree:Vr("degree",(function(e,t){return e>t})),minIndegree:Vr("indegree",(function(e,t){return e<t})),maxIndegree:Vr("indegree",(function(e,t){return e>t})),minOutdegree:Vr("outdegree",(function(e,t){return e<t})),maxOutdegree:Vr("outdegree",(function(e,t){return e>t}))}),j(Rr,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var Fr=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};!i.isParent()||0===o.x&&0===o.y||i.children().shift(o,n),i.shiftCachedBoundingBox(o)}}},qr={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){Fr(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(Ir=Nr={position:Fn.data(qr),silentPosition:Fn.data(j({},qr,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Fr(e,t,!0)}})),positions:function(e,t){if(E(e))t?this.silentPosition(e):this.position(e);else if(x(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a,o=this[i];(a=n(o,i))&&(t?o.silentPosition(a):o.position(a))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(E(e)?(r={x:k(e.x)?e.x:0,y:k(e.y)?e.y:0},n=t):b(e)&&k(t)&&((r={x:0,y:0})[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a],s=o.position(),l={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}i.endBatch()}return this},silentShift:function(e,t){return E(e)?this.shift(e,!0):b(e)&&k(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=E(e)?e:void 0,s=void 0!==o||void 0!==t&&b(e);if(n&&n.isNode()){if(!s){var l=n.position();return o=Ve(l,i,a),void 0===e?o:o[e]}for(var u=0;u<this.length;u++){var c=this[u];void 0!==t?c.position(e,(t-a[e])/i):void 0!==o&&c.position(Fe(o,i,a))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=E(e)?e:void 0,a=void 0!==i||void 0!==t&&b(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(!a){var s=n.position(),l=o?n.parent():null,u=l&&l.length>0,c=u;u&&(l=l[0]);var h=c?l.position():{x:0,y:0};return i={x:s.x-h.x,y:s.y-h.y},void 0===e?i:i[e]}for(var d=0;d<this.length;d++){var f=this[d],p=o?f.parent():null,v=p&&p.length>0,g=v;v&&(p=p[0]);var y=g?p.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==i&&f.position({x:i.x+y.x,y:i.y+y.y})}}else if(!a)return;return this}}).modelPosition=Ir.point=Ir.position,Ir.modelPositions=Ir.points=Ir.positions,Ir.renderedPoint=Ir.renderedPosition,Ir.relativePoint=Ir.relativePosition;var Xr,Yr,Gr=Nr;Xr=Yr={},Yr.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},Yr.dirtyCompoundBoundsCache=function(){var e=this.cy();return e.styleEnabled()&&e.hasCompoundNodes()?(this.forEachUp((function(e){if(e.isParent()){var t=e._private;t.compoundBoundsClean=!1,t.bbCache=null,e.emitAndNotify("bounds")}})),this):this},Yr.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,f=h.biasComplementDiff,p=y(i.height.val-a.h,u,c),v=p.biasDiff,g=p.biasComplementDiff;t.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}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+f)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-v+a.y1+a.y2+g)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;a.compoundBoundsClean||(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var Hr=function(e){return e===1/0||e===-1/0?0:e},Wr=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Ur=function(e,t){return null==t?e:Wr(e,t.x1,t.y1,t.x2,t.y2)},Kr=function(e,t,n){return be(e,t,n)},Zr=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,et(u,1),Wr(e,u.x1,u.y1,u.x2,u.y2)}}},$r=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=Kr(a,"labelWidth",n),f=Kr(a,"labelHeight",n),p=Kr(a,"labelX",n),v=Kr(a,"labelY",n),g=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=f,_=d,C=_/2,S=k/2;if(m)o=p-C,s=p+C,l=v-S,u=v+S;else{switch(c.value){case"left":o=p-_,s=p;break;case"center":o=p-C,s=p+C;break;case"right":o=p,s=p+_}switch(h.value){case"top":l=v-k,u=v;break;case"center":l=v-S,u=v+S;break;case"bottom":l=v,u=v+k}}o+=g-Math.max(x,w)-E,s+=g+Math.max(x,w)+E,l+=y-Math.max(x,w)-E,u+=y+Math.max(x,w)+E;var P=n||"main",T=i.labelBounds,A=T[P]=T[P]||{};A.x1=o,A.y1=l,A.x2=s,A.y2=u,A.w=s-o,A.h=u-l,et(A,1);var D=m&&"autorotate"===b.strValue,M=null!=b.pfValue&&0!==b.pfValue;if(D||M){var O=D?Kr(i.rstyle,"labelAngle",n):b.pfValue,B=Math.cos(O),L=Math.sin(O),I=(o+s)/2,N=(l+u)/2;if(!m){switch(c.value){case"left":I=s;break;case"right":I=o}switch(h.value){case"top":N=u;break;case"bottom":N=l}}var z=function(e,t){return{x:(e-=I)*B-(t-=N)*L+I,y:e*L+t*B+N}},R=z(o,l),j=z(o,u),V=z(s,l),F=z(s,u);o=Math.min(R.x,j.x,V.x,F.x),s=Math.max(R.x,j.x,V.x,F.x),l=Math.min(R.y,j.y,V.y,F.y),u=Math.max(R.y,j.y,V.y,F.y)}var q=P+"Rot",X=T[q]=T[q]||{};X.x1=o,X.y1=l,X.x2=s,X.y2=u,X.w=s-o,X.h=u-l,Wr(e,o,l,s,u),Wr(i.labelBounds.all,o,l,s,u)}return e}},Qr=function(e){var t=0,n=function(e){return(e?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays)},Jr=function(e){if(e.isEdge()){var t=e.source().position(),n=e.target().position(),r=function(e){return Math.round(e)};return $([r(t.x),r(t.y),r(n.x),r(n.y)])}return 0},ei=function(e,t){var n,r=e._private,i=e.isEdge(),a=(null==t?ni:Qr(t))===ni,o=Jr(e),s=r.bbCachePosKey===o,l=function(e){return null==e._private.bbCache},u=!(t.useCache&&s)||l(e)||i&&l(e.source())||l(e.target());if(u?(s||e.recalculateRenderedStyle(),n=function(e,t){var n,r,i,a,o,s,l,u=e._private.cy,c=u.styleEnabled(),h=u.headless(),d=Qe(),f=e._private,p=e.isNode(),v=e.isEdge(),g=f.rstyle,y=p&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!v||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;if(c&&(w=e.pstyle("width").pfValue/2),p&&t.includeNodes){var E=e.position();o=E.x,s=E.y;var k=e.outerWidth()/2,_=e.outerHeight()/2;Wr(d,n=o-k,i=s-_,r=o+k,a=s+_)}else if(v&&t.includeEdges)if(c&&!h){var C=e.pstyle("curve-style").strValue;if(n=Math.min(g.srcX,g.midX,g.tgtX),r=Math.max(g.srcX,g.midX,g.tgtX),i=Math.min(g.srcY,g.midY,g.tgtY),a=Math.max(g.srcY,g.midY,g.tgtY),Wr(d,n-=w,i-=w,r+=w,a+=w),"haystack"===C){var S=g.haystackPts;if(S&&2===S.length){if(n=S[0].x,i=S[0].y,n>(r=S[1].x)){var P=n;n=r,r=P}if(i>(a=S[1].y)){var T=i;i=a,a=T}Wr(d,n-w,i-w,r+w,a+w)}}else if("bezier"===C||"unbundled-bezier"===C||"segments"===C||"taxi"===C){var A;switch(C){case"bezier":case"unbundled-bezier":A=g.bezierPts;break;case"segments":case"taxi":A=g.linePts}if(null!=A)for(var D=0;D<A.length;D++){var M=A[D];n=M.x-w,r=M.x+w,i=M.y-w,a=M.y+w,Wr(d,n,i,r,a)}}}else{var O=e.source().position(),B=e.target().position();if((n=O.x)>(r=B.x)){var L=n;n=r,r=L}if((i=O.y)>(a=B.y)){var I=i;i=a,a=I}Wr(d,n-=w,i-=w,r+=w,a+=w)}if(c&&t.includeEdges&&v&&(Zr(d,e,"mid-source"),Zr(d,e,"mid-target"),Zr(d,e,"source"),Zr(d,e,"target")),c)if("yes"===e.pstyle("ghost").value){var N=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;Wr(d,d.x1+N,d.y1+z,d.x2+N,d.y2+z)}var R=f.bodyBounds=f.bodyBounds||{};nt(R,d),tt(R,y),et(R,1),c&&(n=d.x1,r=d.x2,i=d.y1,a=d.y2,Wr(d,n-x,i-x,r+x,a+x));var j=f.overlayBounds=f.overlayBounds||{};nt(j,d),tt(j,y),et(j,1);var V=f.labelBounds=f.labelBounds||{};null!=V.all?((l=V.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):V.all=Qe(),c&&t.includeLabels&&(t.includeMainLabels&&$r(d,e,null),v&&(t.includeSourceLabels&&$r(d,e,"source"),t.includeTargetLabels&&$r(d,e,"target")))}return d.x1=Hr(d.x1),d.y1=Hr(d.y1),d.x2=Hr(d.x2),d.y2=Hr(d.y2),d.w=Hr(d.x2-d.x1),d.h=Hr(d.y2-d.y1),d.w>0&&d.h>0&&b&&(tt(d,y),et(d,1)),d}(e,ti),r.bbCache=n,r.bbCacheShift.x=r.bbCacheShift.y=0,r.bbCachePosKey=o):n=r.bbCache,!u&&(0!==r.bbCacheShift.x||0!==r.bbCacheShift.y)){var c=rt,h=r.bbCacheShift,d=function(e,t){null!=e&&c(e,t)};c(n,h);var f=r.bodyBounds,p=r.overlayBounds,v=r.labelBounds,g=r.arrowBounds;d(f,h),d(p,h),null!=g&&(d(g.source,h),d(g.target,h),d(g["mid-source"],h),d(g["mid-target"],h)),null!=v&&(d(v.main,h),d(v.all,h),d(v.source,h),d(v.target,h))}if(r.bbCacheShift.x=r.bbCacheShift.y=0,!a){var y=e.isNode();n=Qe(),(t.includeNodes&&y||t.includeEdges&&!y)&&(t.includeOverlays?Ur(n,r.overlayBounds):Ur(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?Ur(n,r.labelBounds.all):(t.includeMainLabels&&Ur(n,r.labelBounds.mainRot),t.includeSourceLabels&&Ur(n,r.labelBounds.sourceRot),t.includeTargetLabels&&Ur(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},ti={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,useCache:!0},ni=Qr(ti),ri=ge(ti);Yr.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=Qe();var n=ri(e=e||ti);if(this.cy().styleEnabled())for(var r=0;r<this.length;r++){var i=this[r],a=i._private,o=Jr(i),s=a.bbCachePosKey===o,l=n.useCache&&s;i.recalculateRenderedStyle(l)}this.updateCompoundBounds();for(var u=0;u<this.length;u++){var c=this[u];Ur(t,ei(c,n))}}else e=void 0===e?ti:ri(e),t=ei(this[0],e);return t.x1=Hr(t.x1),t.y1=Hr(t.y1),t.x2=Hr(t.x2),t.y2=Hr(t.y2),t.w=Hr(t.x2-t.x1),t.h=Hr(t.y2-t.y1),t},Yr.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCacheShift.x=t.bbCacheShift.y=0,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},Yr.shiftCachedBoundingBox=function(e){for(var t=0;t<this.length;t++){var n=this[t]._private;null!=n.bbCache&&(n.bbCacheShift.x+=e.x,n.bbCacheShift.y+=e.y)}return this.emitAndNotify("bounds"),this},Yr.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes();if(r&&(t=t.filter((function(e){return!e.isParent()}))),E(e)){var i=e;e=function(){return i}}n.startBatch(),t.forEach((function(t,n){return t._private.bbAtOldPos=e(t,n)})).silentPositions(e),r&&this.updateCompoundBounds(!0);var a=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}}(this.boundingBox({useCache:!1}));return t.silentPositions((function(e){return e._private.bbAtOldPos})),n.endBatch(),a},Xr.boundingbox=Xr.bb=Xr.boundingBox,Xr.renderedBoundingbox=Xr.renderedBoundingBox;var ii,ai,oi=Yr;ii=ai={};var si=function(e){e.uppercaseName=N(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=N(e.outerName),ii[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t){if(!r)return 1;if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var i=t.pstyle(e.name);switch(i.strValue){case"label":return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return i.pfValue}}},ii["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)return n?t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding():1},ii["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},ii["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};si({name:"width"}),si({name:"height"}),ai.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},ai.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},ai.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var li=ai,ui={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},ci=Object.keys(ui).reduce((function(e,t){var n=ui[t],r=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)}(t);return e[t]=function(){return function(e,t){if(e.isEdge())return t(e)}(this,n.get)},n.mult?e[r]=function(){return function(e,t){if(e.isEdge()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map((function(e){return Ve(e,i,r)}))}}(this,n.get)}:e[r]=function(){return function(e,t){if(e.isEdge()){var n=e.cy();return Ve(t(e),n.zoom(),n.pan())}}(this,n.get)},e}),{}),hi=j({},Gr,oi,li,ci),di=function(e,t){this.recycle(e,t)};function fi(){return!1}function pi(){return!0}di.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=fi,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?pi:fi):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=pi;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=pi;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=pi,this.stopPropagation()},isDefaultPrevented:fi,isPropagationStopped:fi,isImmediatePropagationStopped:fi};var vi=/^([^.]+)(\.(?:[^.]+))?$/,gi={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},yi=Object.keys(gi),mi={};function bi(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mi,t=arguments.length>1?arguments[1]:void 0,n=0;n<yi.length;n++){var r=yi[n];this[r]=e[r]||gi[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var xi=bi.prototype,wi=function(e,t,n,r,i,a,o){x(r)&&(i=r,r=null),o&&(a=null==a?o:j({},a,o));for(var s=w(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!D(u)){var c=u.match(vi);if(c)if(!1===t(e,u,c[1],c[2]?c[2]:null,r,i,a))break}}},Ei=function(e,t){return e.addEventFields(e.context,t),new di(t.type,t)},ki=function(e,t,n){if("event"!==m(n))if(E(n))t(e,Ei(e,n));else for(var r=w(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!D(a)){var o=a.match(vi);if(o){var s=o[1],l=o[2]?o[2]:null;t(e,Ei(e,{type:s,namespace:l,target:e.context}))}}}else t(e,n)};xi.on=xi.addListener=function(e,t,n,r,i){return wi(this,(function(e,t,n,r,i,a,o){x(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})}),e,t,n,r,i),this},xi.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},xi.removeListener=xi.off=function(e,t,n,r){var i=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var a=this.listeners,o=function(o){var s=a[o];wi(i,(function(t,n,r,i,l,u){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return a.splice(o,1),!1}),e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},xi.removeAllListeners=function(){return this.removeListener("*")},xi.emit=xi.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,w(t)||(t=[t]),ki(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}}(o,t),e.beforeEmit(e.context,i,a),i.conf&&i.conf.one&&(e.listeners=e.listeners.filter((function(e){return e!==i})));var s=e.callbackContext(e.context,i,a),l=i.callback.apply(s,o);e.afterEmit(e.context,i,a),!1===l&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o(s);e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)}),e),this.emitting--,this};var _i={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&&S(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Ci=function(e){return b(e)?new _r(e):e},Si={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new bi(_i,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=Ci(t),i=0;i<this.length;i++){this[i].emitter().on(e,r,n)}return this},removeListener:function(e,t,n){for(var r=Ci(t),i=0;i<this.length;i++){this[i].emitter().removeListener(e,r,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){this[e].emitter().removeAllListeners()}return this},one:function(e,t,n){for(var r=Ci(t),i=0;i<this.length;i++){this[i].emitter().one(e,r,n)}return this},once:function(e,t,n){for(var r=Ci(t),i=0;i<this.length;i++){this[i].emitter().on(e,r,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){this[n].emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};Fn.eventAliasesOn(Si);var Pi={nodes:function(e){return this.filter((function(e){return e.isNode()})).filter(e)},edges:function(e){return this.filter((function(e){return e.isEdge()})).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.merge(r):t.merge(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(b(e)||C(e))return new _r(e).filter(this);if(x(e)){for(var n=this.spawn(),r=0;r<this.length;r++){var i=this[r];(t?e.apply(t,[i,r,this]):e(i,r,this))&&n.merge(i)}return n}return this.spawn()},not:function(e){if(e){b(e)&&(e=this.filter(e));for(var t=[],n=e._private.map,r=0;r<this.length;r++){var i=this[r];n.has(i.id())||t.push(i)}return this.spawn(t)}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(b(e)){var t=e;return this.filter(t)}for(var n=[],r=e,i=this.length<e.length,a=i?r._private.map:this._private.map,o=i?this:r,s=0;s<o.length;s++){var l=o[s]._private.data.id,u=a.get(l);u&&n.push(u.ele)}return this.spawn(n)},xor:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=[],r=e,i=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return i(this,r),i(r,this),this.spawn(n)},diff:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=[],r=[],i=[],a=e,o=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.push(a):n.push(a)}};return o(this,a,n),o(a,this,r),{left:this.spawn(n,{unique:!0}),right:this.spawn(r,{unique:!0}),both:this.spawn(i,{unique:!0})}},add:function(e){var t=this._private.cy;if(!e)return this;if(b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=[],i=0;i<this.length;i++)r.push(this[i]);for(var a=this._private.map,o=0;o<e.length;o++){var s=!a.has(e[o].id());s&&r.push(e[o])}return this.spawn(r)},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&b(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var l=this.length++;this[l]=o,i.set(s,{ele:o,index:l})}else{var u=i.get(s).index;this[u]=o,i.set(s,{ele:o,index:u})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=0;r<this.length;r++){var i=this[r],a=t?e.apply(t,[i,r,this]):e(i,r,this);n.push(a)}return n},reduce:function(e,t){for(var n=t,r=0;r<this.length;r++)n=e(n,this[r],r,this);return n},max:function(e,t){for(var n,r=-1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o>r&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);o<r&&(r=o,n=a)}return{value:r,ele:n}}},Ti=Pi;Ti.u=Ti["|"]=Ti["+"]=Ti.union=Ti.or=Ti.add,Ti["\\"]=Ti["!"]=Ti["-"]=Ti.difference=Ti.relativeComplement=Ti.subtract=Ti.not,Ti.n=Ti["&"]=Ti["."]=Ti.and=Ti.intersection=Ti.intersect,Ti["^"]=Ti["(+)"]=Ti["(-)"]=Ti.symmetricDifference=Ti.symdiff=Ti.xor,Ti.fnFilter=Ti.filterFn=Ti.stdFilter=Ti.filter,Ti.complement=Ti.abscomp=Ti.absoluteComplement;var Ai=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?ie:0}var i=r(e)-r(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1:0}var o=a(e)-a(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},Di={forEach:function(e,t){if(x(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if(!1===(t?e.apply(t,[i,r,this]):e(i,r,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!x(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Ai)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:ie-1}var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}};Di.each=Di.forEach;"undefined"!=("undefined"==typeof Symbol?"undefined":o(Symbol))&&"undefined"!=o(Symbol.iterator)&&(Di[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return c({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,(function(){return this}))});var Mi=ge({nodeDimensionsIncludeLabels:!1}),Oi={layoutDimensions:function(e){var t;if(e=Mi(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return 0!==t.w&&0!==t.h||(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes(),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=O(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=t.spacingFactor&&1!==t.spacingFactor,u=function(){if(!l)return null;for(var e=Qe(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);Je(e,i.x,i.y)}return e}(),c=O((function(e,n){var r=s(e,n);l&&(r=function(e,t,n){var r=t.x1+t.w/2,i=t.y1+t.h/2;return{x:r+(n.x-r)*e,y:i+(n.y-i)*e}}(Math.abs(t.spacingFactor),u,r));return null!=t.transform&&(r=t.transform(e,r)),r}),o);if(t.animate){for(var h=0;h<r.length;h++){var d=r[h],f=c(d,h);if(null==t.animateFilter||t.animateFilter(d,h)){var p=d.animation({position:f,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(p)}else d.position(f)}if(t.fit){var v=i.animation({fit:{boundingBox:a.boundingBoxAt(c),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else if(void 0!==t.zoom&&void 0!==t.pan){var g=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}e.animations.forEach((function(e){return e.play()})),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Rn.all(e.animations.map((function(e){return e.promise()}))).then((function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})}))}else r.positions(c),t.fit&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(j({},e,{eles:this}))}};function Bi(e,t,n){var r,i=n._private,a=i.styleCache=i.styleCache||[];return null!=(r=a[e])?r:r=a[e]=t(n)}function Li(e,t){return e=Q(e),function(n){return Bi(e,t,n)}}function Ii(e,t){e=Q(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return Bi(e,n,t)}}Oi.createLayout=Oi.makeLayout=Oi.layout;var Ni={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach((function(e){n(e),e.connectedEdges().forEach(n)}));return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),r=t.style(),i=this;e=!(!e&&void 0!==e),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var a=r.apply(i);return e?a.emitAndNotify("style"):a.emit("style"),this},parsedStyle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(E(e)){var i=e;r.applyBypass(this,i,!1),this.emitAndNotify("style")}else if(b(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r<this.length;r++){var i=this[r];n.removeAllBypasses(i,!1)}else{e=e.split(/\s+/);for(var a=0;a<this.length;a++){var o=this[a];n.removeBypasses(o,e,!1)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle("opacity").value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++){i*=a[o].pstyle("opacity").value}return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();return e?t?0===e.effectiveOpacity():0===e.pstyle("opacity").value:void 0},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function zi(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++){if(!t(n[r]))return!1}return!0}function Ri(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||zi(i,r);var s=o.source,l=o.target;return n(s)&&(!a||zi(s,n))&&(s===l||n(l)&&(!a||zi(l,n)))}}}var ji=Li("eleTakesUpSpace",(function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())}));Ni.takesUpSpace=Ii("takesUpSpace",Ri({ok:ji}));var Vi=Li("eleInteractive",(function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&ji(e)})),Fi=Li("parentInteractive",(function(e){return"visible"===e.pstyle("visibility").value&&ji(e)}));Ni.interactive=Ii("interactive",Ri({ok:Vi,parentOk:Fi,edgeOkViaNode:ji})),Ni.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var qi=Li("eleVisible",(function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&ji(e)})),Xi=ji;Ni.visible=Ii("visible",Ri({ok:qi,edgeOkViaNode:Xi})),Ni.hidden=function(){var e=this[0];if(e)return!e.visible()},Ni.isBundledBezier=Ii("isBundledBezier",(function(){return!!this.cy().styleEnabled()&&(!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace())})),Ni.bypass=Ni.css=Ni.style,Ni.renderedCss=Ni.renderedStyle,Ni.removeBypass=Ni.removeCss=Ni.removeStyle,Ni.pstyle=Ni.parsedStyle;var Yi={};function Gi(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(1===t.length&&x(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&w(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(l);if(void 0!==h&&(u=h,!h))return this}u&&(l._private[e.field]=e.value,c&&n.push(l))}var d=this.spawn(n);d.updateStyle(),d.emit(e.event),o&&d.emit(o)}return this}}function Hi(e){Yi[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},Yi[e.on]=Gi({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),Yi[e.off]=Gi({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}Hi({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),Hi({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),Hi({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),Hi({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),Yi.deselect=Yi.unselect,Yi.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},Hi({field:"active",on:"activate",off:"unactivate"}),Hi({field:"pannable",on:"panify",off:"unpanify"}),Yi.inactive=function(){var e=this[0];if(e)return!e._private.active};var Wi={},Ui=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();if(e.noIncomingEdges&&c===i&&u!==i||e.noOutgoingEdges&&u===i&&c!==i){a=!0;break}}a||n.push(i)}}return this.spawn(n,{unique:!0}).filter(t)}},Ki=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target();e.outgoing&&l===i?(n.push(s),n.push(u)):e.incoming&&u===i&&(n.push(s),n.push(l))}}return this.spawn(n,{unique:!0}).filter(t)}},Zi=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],u=l.id();i[u]||(i[u]=!0,r.push(l),o=!0)}if(!o)break;n=a}return this.spawn(r,{unique:!0}).filter(t)}};function $i(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,{unique:!0}).filter(t)}}function Qi(e){return function(t){var n=[],r=this._private.cy,i=e||{};b(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),h=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||h){if(i.thisIsSrc||i.thisIsTgt){if(i.thisIsSrc&&!c)continue;if(i.thisIsTgt&&!h)continue}n.push(l)}}return this.spawn(n,{unique:!0})}}function Ji(e){return e=j({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,h=0;h<c.length;h++){var d=c[h],f=d._private.data,p=f.target,v=f.source,g=p===u&&v===l,y=l===p&&u===v;(i.codirected&&g||!i.codirected&&(g||y))&&n.push(d)}return this.spawn(n,{unique:!0}).filter(t)}}Wi.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},j(Wi,{roots:Ui({noIncomingEdges:!0}),leaves:Ui({noOutgoingEdges:!0}),outgoers:Ar(Ki({outgoing:!0}),"outgoers"),successors:Zi({outgoing:!0}),incomers:Ar(Ki({incoming:!0}),"incomers"),predecessors:Zi({incoming:!0})}),j(Wi,{neighborhood:Ar((function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target(),c=i===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,{unique:!0}).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Wi.neighbourhood=Wi.neighborhood,Wi.closedNeighbourhood=Wi.closedNeighborhood,Wi.openNeighbourhood=Wi.openNeighborhood,j(Wi,{source:Ar((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Ar((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:$i({attr:"source"}),targets:$i({attr:"target"})}),j(Wi,{edgesWith:Ar(Qi(),"edgesWith"),edgesTo:Ar(Qi({thisIsSrc:!0}),"edgesTo")}),j(Wi,{connectedEdges:Ar((function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var i=r._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,{unique:!0}).filter(e)}),"connectedEdges"),connectedNodes:Ar((function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];r.isEdge()&&(t.push(r.source()[0]),t.push(r.target()[0]))}return this.spawn(t,{unique:!0}).filter(e)}),"connectedNodes"),parallelEdges:Ar(Ji(),"parallelEdges"),codirectedEdges:Ar(Ji({codirected:!0}),"codirectedEdges")}),j(Wi,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach((function(n){n.connectedEdges().forEach((function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)}))}))};do{s()}while(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Wi.componentsOf=Wi.components;var ea=function(e,t,n){for(var r=null!=n?n:fe();e.hasElementWithId(r);)r=fe();return r},ta=function(e,t,n){if(void 0!==e&&T(e)){var r=new we,i=!1;if(t){if(t.length>0&&E(t[0])&&!S(t[0])){i=!0;for(var a=[],o=new ke,s=0,l=t.length;s<l;s++){var u=t[s];null==u.data&&(u.data={});var c=u.data;if(null==c.id)c.id=ea(e,u);else if(e.hasElementWithId(c.id)||o.has(c.id))continue;var h=new _e(e,u,!1);a.push(h),o.add(c.id)}t=a}}else t=[];this.length=0;for(var d=0,f=t.length;d<f;d++){var p=t[d][0];if(null!=p){var v=p._private.data.id;(null==n||n.unique&&!r.has(v))&&(r.set(v,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={cy:e,map:r},i&&this.restore()}else ue("A collection must have a reference to the core")},na=_e.prototype=ta.prototype;na.instanceString=function(){return"collection"},na.spawn=function(e,t,n){return T(e)||(n=t,t=e,e=this.cy()),new ta(e,t,n)},na.spawnSelf=function(){return this.spawn(this)},na.cy=function(){return this._private.cy},na.renderer=function(){return this._private.cy.renderer()},na.element=function(){return this[0]},na.collection=function(){return P(this)?this:new ta(this._private.cy,[this])},na.unique=function(){return new ta(this._private.cy,this,{unique:!0})},na.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},na.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new ta(t)},na.$id=na.getElementById,na.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},na.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},na.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},na.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(E(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;!u||null==c&&null==i.parent||c==i.parent||(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var h=function(n,i,a){var o=e[n];null!=o&&o!==r[n]&&(o?t[i]():t[a]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var d={data:de(r.data),position:de(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};d.classes="";var f=0;return r.classes.forEach((function(e){return d.classes+=0==f++?e:" "+e})),d}}},na.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},na.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n].json(),i=new _e(e,r,!1);t.push(i)}return new ta(e,t)},na.copy=na.clone,na.restore=function(){for(var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u<c;u++){var h=i[u];r&&!h.removed()||(h.isNode()?s.push(h):l.push(h))}e=s.concat(l);var d=function(){e.splice(t,1),t--};for(t=0;t<e.length;t++){var f=e[t],p=f._private,v=p.data;if(f.clearTraversalCache(),r||p.removed)if(void 0===v.id)v.id=ea(a,f);else if(k(v.id))v.id=""+v.id;else{if(D(v.id)||!b(v.id)){ue("Can not create element with invalid string ID `"+v.id+"`"),d();continue}if(a.hasElementWithId(v.id)){ue("Can not create second element with ID `"+v.id+"`"),d();continue}}else;var g=v.id;if(f.isNode()){var y=p.position;null==y.x&&(y.x=0),null==y.y&&(y.y=0)}if(f.isEdge()){for(var m=f,x=["source","target"],w=x.length,E=!1,_=0;_<w;_++){var C=x[_],S=v[C];k(S)&&(S=v[C]=""+v[C]),null==S||""===S?(ue("Can not create edge `"+g+"` with unspecified "+C),E=!0):a.hasElementWithId(S)||(ue("Can not create edge `"+g+"` with nonexistant "+C+" `"+S+"`"),E=!0)}if(E){d();continue}var P=a.getElementById(v.source),T=a.getElementById(v.target);P.same(T)?P._private.edges.push(m):(P._private.edges.push(m),T._private.edges.push(m)),m._private.source=P,m._private.target=T}p.map=new we,p.map.set(g,{ele:f,index:0}),p.removed=!1,r&&a.addToPool(f)}for(var A=0;A<s.length;A++){var M=s[A],O=M._private.data;k(O.parent)&&(O.parent=""+O.parent);var B=O.parent,L=null!=B;if(L){var I=a.getElementById(B);if(I.empty())O.parent=void 0;else{for(var N=!1,z=I;!z.empty();){if(M.same(z)){N=!0,O.parent=void 0;break}z=z.parent()}N||(I[0]._private.children.push(M),M._private.parent=I[0],o.hasCompoundNodes=!0)}}}if(e.length>0){for(var R=new ta(a,e),j=0;j<R.length;j++){var V=R[j];V.isNode()||(V.parallelEdges().clearTraversalCache(),V.source().clearTraversalCache(),V.target().clearTraversalCache())}(o.hasCompoundNodes?a.collection().merge(R).merge(R.connectedNodes()).merge(R.parent()):R).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(n),n?R.emitAndNotify("add"):r&&R.emit("add")}return i},na.removed=function(){var e=this[0];return e&&e._private.removed},na.inside=function(){var e=this[0];return e&&!e._private.removed},na.remove=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n<t.length;n++)l(t[n])}function s(e){for(var t=e._private.children,n=0;n<t.length;n++)l(t[n])}function l(e){var n=i[e.id()];t&&e.removed()||n||(i[e.id()]=!0,e.isNode()?(r.push(e),o(e),s(e)):r.unshift(e))}for(var u=0,c=n.length;u<c;u++){var h=n[u];l(h)}function d(e,t){var n=e._private.edges;ye(n,t),e.clearTraversalCache()}function f(e){e.clearTraversalCache()}var p=[];function v(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();ye(n,t),t._private.parent=null,p.ids[r]||(p.ids[r]=!0,p.push(e))}p.ids={},n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var g=0;g<r.length;g++){var y=r[g];if(y.isEdge()){var m=y.source()[0],b=y.target()[0];d(m,y),d(b,y);for(var x=y.parallelEdges(),w=0;w<x.length;w++){var E=x[w];f(E),E.isBundledBezier()&&E.dirtyBoundingBoxCache()}}else{var k=y.parent();0!==k.length&&v(k,y)}t&&(y._private.removed=!0)}var _=a._private.elements;a._private.hasCompoundNodes=!1;for(var C=0;C<_.length;C++){var S=_[C];if(S.isParent()){a._private.hasCompoundNodes=!0;break}}var P=new ta(this.cy(),r);P.size()>0&&(e?P.emitAndNotify("remove"):t&&P.emit("remove"));for(var T=0;T<p.length;T++){var A=p[T];t&&A.removed()||A.updateStyle()}return P},na.move=function(e){var t=this._private.cy,n=this,r=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var i=r(e.source),a=r(e.target),o=null!=i&&t.hasElementWithId(i),s=null!=a&&t.hasElementWithId(a);(o||s)&&(t.batch((function(){n.remove(!1,!1),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],r=t._private.data;t.isEdge()&&(o&&(r.source=i),s&&(r.target=a))}n.restore(!1,!1)})),n.emitAndNotify("move"))}else if(void 0!==e.parent){var l=r(e.parent);if(null===l||t.hasElementWithId(l)){var u=null===l?void 0:l;t.batch((function(){var e=n.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var r=n[t],i=r._private.data;r.isNode()&&(i.parent=u)}e.restore(!1,!1)})),n.emitAndNotify("move")}}return this},[Mn,qn,Xn,Sr,Dr,zr,Rr,hi,Si,Pi,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Di,Oi,Ni,Yi,Wi].forEach((function(e){j(na,e)}));var ra={add:function(e){var t,n=this;if(C(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new ta(n,i)}}else if(w(e)){t=new ta(n,e)}else if(E(e)&&(w(e.nodes)||w(e.edges))){for(var s=e,l=[],u=["nodes","edges"],c=0,h=u.length;c<h;c++){var d=u[c],f=s[d];if(w(f))for(var p=0,v=f.length;p<v;p++){var g=j({group:d},f[p]);l.push(g)}}t=new ta(n,l)}else{t=new _e(n,e).collection()}return t},remove:function(e){if(C(e));else if(b(e)){var t=e;e=this.$(t)}return e.remove()}};var ia=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,.5*r,i),o=t(n,.5*r,a),s=t(n,r,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),u=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,l.tension=t,l.friction=r,o=(a=null!==i)?(c=e(t,r))/i*.016:.016;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>1e-4&&Math.abs(s.v)>1e-4;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),aa=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,l=11,u=1/(l-1),c="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var h=0;h<4;++h)if("number"!=typeof arguments[h]||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var d=c?new Float32Array(l):new Array(l);function f(e,t){return 1-3*t+3*e}function p(e,t){return 3*t-6*e}function v(e){return 3*e}function g(e,t,n){return((f(t,n)*e+p(t,n))*e+v(t))*e}function y(e,t,n){return 3*f(t,n)*e*e+2*p(t,n)*e+v(t)}function m(t,r){for(var a=0;a<i;++a){var o=y(r,e,n);if(0===o)return r;r-=(g(r,e,n)-t)/o}return r}function b(){for(var t=0;t<l;++t)d[t]=g(t*u,e,n)}function x(t,r,i){var a,l,u=0;do{(a=g(l=r+(i-r)/2,e,n)-t)>0?i=l:r=l}while(Math.abs(a)>o&&++u<s);return l}function w(t){for(var r=0,i=1,o=l-1;i!==o&&d[i]<=t;++i)r+=u;--i;var s=r+(t-d[i])/(d[i+1]-d[i])*u,c=y(s,e,n);return c>=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function k(){E=!0,e===t&&n===r||b()}var _=function(i){return E||k(),e===t&&n===r?i:0===i?0:1===i?1:g(w(i),t,r)};_.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var C="generateBezier("+[e,t,n,r]+")";return _.toString=function(){return C},_}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},oa={linear:function(e,t,n){return e+(t-e)*n},ease:aa(.25,.1,.25,1),"ease-in":aa(.42,0,1,1),"ease-out":aa(0,0,.58,1),"ease-in-out":aa(.42,0,.58,1),"ease-in-sine":aa(.47,0,.745,.715),"ease-out-sine":aa(.39,.575,.565,1),"ease-in-out-sine":aa(.445,.05,.55,.95),"ease-in-quad":aa(.55,.085,.68,.53),"ease-out-quad":aa(.25,.46,.45,.94),"ease-in-out-quad":aa(.455,.03,.515,.955),"ease-in-cubic":aa(.55,.055,.675,.19),"ease-out-cubic":aa(.215,.61,.355,1),"ease-in-out-cubic":aa(.645,.045,.355,1),"ease-in-quart":aa(.895,.03,.685,.22),"ease-out-quart":aa(.165,.84,.44,1),"ease-in-out-quart":aa(.77,0,.175,1),"ease-in-quint":aa(.755,.05,.855,.06),"ease-out-quint":aa(.23,1,.32,1),"ease-in-out-quint":aa(.86,0,.07,1),"ease-in-expo":aa(.95,.05,.795,.035),"ease-out-expo":aa(.19,1,.22,1),"ease-in-out-expo":aa(1,0,0,1),"ease-in-circ":aa(.6,.04,.98,.335),"ease-out-circ":aa(.075,.82,.165,1),"ease-in-out-circ":aa(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return oa.linear;var r=ia(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":aa};function sa(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function la(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function ua(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=la(e,i),s=la(t,i);if(k(o)&&k(s))return sa(a,o,s,n,r);if(w(o)&&w(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],h=s[u];if(null!=c&&null!=h){var d=sa(a,c,h,n,r);l.push(d)}else l.push(h)}return l}}function ca(e,t,n,r){var i=!r,a=e._private,o=t._private,s=o.easing,l=o.startTime,u=(r?e:e.cy()).style();if(!o.easingImpl)if(null==s)o.easingImpl=oa.linear;else{var c,h,d;if(b(s))c=u.parse("transition-timing-function",s).value;else c=s;b(c)?(h=c,d=[]):(h=c[1],d=c.slice(2).map((function(e){return+e}))),d.length>0?("spring"===h&&d.push(o.duration),o.easingImpl=oa[h].apply(null,d)):o.easingImpl=oa[h]}var f,p=o.easingImpl;if(f=0===o.duration?1:(n-l)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var v=o.startPosition,g=o.position;if(g&&i&&!e.locked()){var y={};ha(v.x,g.x)&&(y.x=ua(v.x,g.x,f,p)),ha(v.y,g.y)&&(y.y=ua(v.y,g.y,f,p)),e.position(y)}var m=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(ha(m.x,x.x)&&(w.x=ua(m.x,x.x,f,p)),ha(m.y,x.y)&&(w.y=ua(m.y,x.y,f,p)),e.emit("pan"));var k=o.startZoom,_=o.zoom,C=null!=_&&r;C&&(ha(k,_)&&(a.zoom=$e(a.minZoom,ua(k,_,f,p),a.maxZoom)),e.emit("zoom")),(E||C)&&e.emit("viewport");var S=o.style;if(S&&S.length>0&&i){for(var P=0;P<S.length;P++){var T=S[P],A=T.name,D=T,M=o.startStyle[A],O=ua(M,D,f,p,u.properties[M.name]);u.overrideBypass(e,A,O)}e.emit("style")}}return o.progress=f,f}function ha(e,t){return null!=e&&null!=t&&(!(!k(e)||!k(t))||!(!e||!t))}function da(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function fa(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(!n&&"none"===t.pstyle("display").value){a=a.splice(0,a.length).concat(o.splice(0,o.length));for(var l=0;l<a.length;l++)a[l].stop()}if(0===a.length){var u=o.shift();u&&a.push(u)}for(var c=function(e){for(var t=e.length-1;t>=0;t--){(0,e[t])()}e.splice(0,e.length)},h=a.length-1;h>=0;h--){var d=a[h],f=d._private;f.stopped?(a.splice(h,1),f.hooked=!1,f.playing=!1,f.started=!1,c(f.frames)):(f.playing||f.applying)&&(f.playing&&f.applying&&(f.applying=!1),f.started||da(0,d,e),ca(t,d,e,n),f.applying&&(f.applying=!1),c(f.frames),null!=f.step&&f.step(e),d.completed()&&(a.splice(h,1),f.hooked=!1,f.playing=!1,f.started=!1,c(f.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=i(n[o]);a=a||s}var l=i(t,!0);(a||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var pa={animate:Fn.animate(),animation:Fn.animation(),animated:Fn.animated(),clearQueue:Fn.clearQueue(),delay:Fn.delay(),delayAnimation:Fn.delayAnimation(),stop:Fn.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){fa(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&W((function(n){fa(n,e),t()}))}()}}},va={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&&S(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},ga=function(e){return b(e)?new _r(e):e},ya={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new bi(va,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,ga(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,ga(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,ga(t),n),this},once:function(e,t,n){return this.emitter().one(e,ga(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fn.eventAliasesOn(ya);var ma={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};ma.jpeg=ma.jpg;var ba={layout:function(e){if(null!=e)if(null!=e.name){var t=e.name,n=this.extension("layout",t);if(null!=n){var r;r=b(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$();var i=new n(j({},e,{cy:this,eles:r}));return i}ue("No such layout `"+t+"` found.  Did you forget to import it and `cytoscape.use()` it?")}else ue("A `name` must be specified to make a layout");else ue("Layout options must be specified to make a layout")}};ba.createLayout=ba.makeLayout=ba.layout;var xa={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],a=e[i];t.getElementById(i).data(a)}}))}},wa=ge({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),Ea={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null!=t){void 0!==e.wheelSensitivity&&he("You have set a custom wheel sensitivity.  This will make your app zoom unnaturally when using mainstream mice.  You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=wa(e);n.cy=this,this._private.renderer=new t(n),this.notify("init")}else ue("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Ea.invalidateDimensions=Ea.resize;var ka={collection:function(e,t){return b(e)?this.$(e):C(e)?e.collection():w(e)?new ta(this,e,t):new ta(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}};ka.elements=ka.filter=ka.$;var _a={};_a.apply=function(e){var t=this._private,n=t.cy.collection();t.newStyle&&(t.contextStyles={},t.propDiffs={},this.cleanElements(e,!0));for(var r=0;r<e.length;r++){var i=e[r],a=this.getContextMeta(i);if(!a.empty){var o=this.getContextStyle(a),s=this.applyContextStyle(a,o,i);t.newStyle||this.updateTransitions(i,s.diffProps),this.updateStyleHints(i)&&n.merge(i)}}return t.newStyle=!1,n},_a.getPropertiesDiff=function(e,t){var n=this._private.propDiffs=this._private.propDiffs||{},r=e+"-"+t,i=n[r];if(i)return i;for(var a=[],o={},s=0;s<this.length;s++){var l=this[s],u="t"===e[s],c="t"===t[s],h=u!==c,d=l.mappedProperties.length>0;if(h||c&&d){var f=void 0;h&&d||h?f=l.properties:d&&(f=l.mappedProperties);for(var p=0;p<f.length;p++){for(var v=f[p],g=v.name,y=!1,m=s+1;m<this.length;m++){var b=this[m];if("t"===t[m]&&(y=null!=b.properties[v.name]))break}o[g]||y||(o[g]=!0,a.push(g))}}}return n[r]=a,a},_a.getContextMeta=function(e){var t,n="",r=e._private.styleCxtKey||"";this._private.newStyle&&(r="");for(var i=0;i<this.length;i++){var a=this[i];n+=a.selector&&a.selector.matches(e)?"t":"f"}return t=this.getPropertiesDiff(r,n),e._private.styleCxtKey=n,{key:n,diffPropNames:t,empty:0===t.length}},_a.getContextStyle=function(e){var t=e.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var r={_private:{key:t}},i=0;i<this.length;i++){var a=this[i];if("t"===t[i])for(var o=0;o<a.properties.length;o++){var s=a.properties[o];r[s.name]=s}}return n[t]=r,r},_a.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,i={},a=this.types,o=0;o<r.length;o++){var s=r[o],l=t[s],u=n.pstyle(s);if(!l){if(!u)continue;l=u.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0}}if(u!==l){if(l.mapped===a.fn&&null!=u&&null!=u.mapping&&u.mapping.value===l.value){var c=u.mapping;if((c.fnValue=l.value(n))===c.prevFnValue)continue}var h=i[s]={prev:u};this.applyParsedProperty(n,l),h.next=n.pstyle(s),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},_a.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;r=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];t.styleKeys[c]=0}for(var h=function(e,n){return t.styleKeys[n]=Z(e,t.styleKeys[n])},d=function(e,t){for(var n=0;n<e.length;n++)h(e.charCodeAt(n),t)},f=function(e){return-128<e&&e<128&&Math.floor(e)!==e?2e9-(1024*e|0):e},p=0;p<r.length;p++){var v=r[p],g=l[v];if(null!=g){var y=this.properties[v],m=y.type,b=y.groupKey,x=void 0;null!=y.hashOverride?x=y.hashOverride(e,g):null!=g.pfValue&&(x=g.pfValue);var w=null==y.enums?g.value:null,E=null!=x,k=E||null!=w,_=g.units;if(m.number&&k){var C=E?x:w;if(m.multiple)for(var S=0;S<C.length;S++)h(f(C[S]),b);else h(f(C),b);E||null==_||d(_,b)}else d(g.strValue,b)}}for(var P=0,T=0;T<i.length;T++){var A=i[T],D=t.styleKeys[A];P=Z(D,P)}t.styleKey=P;var M=t.labelDimsKey=t.styleKeys.labelDimensions;if(t.labelKey=a(e,["label"],M),t.labelStyleKey=Z(t.styleKeys.commonLabel,t.labelKey),s||(t.sourceLabelKey=a(e,["source-label"],M),t.sourceLabelStyleKey=Z(t.styleKeys.commonLabel,t.sourceLabelKey),t.targetLabelKey=a(e,["target-label"],M),t.targetLabelStyleKey=Z(t.styleKeys.commonLabel,t.targetLabelKey)),s){var O=t.styleKeys,B=O.nodeBody,L=O.nodeBorder,I=O.backgroundImage,N=O.compound,z=O.pie;t.nodeKey=$([L,I,N,z],B),t.hasPie=0!=z}return o!==t.styleKey},_a.clearStyleHints=function(e){var t=e._private;t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},_a.applyParsedProperty=function(e,t){var n,r=this,i=t,a=e._private.style,o=r.types,s=r.properties[i.name].type,l=i.bypass,u=a[i.name],c=u&&u.bypass,h=e._private,d=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=d(u),n=d(i);r.checkTriggers(e,i.name,t,n)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(i=t=this.parse(t.name,"bezier",l)),i.delete)return a[i.name]=void 0,f(),!0;if(i.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,f(),!0):(f(),!0);if(i.deleteBypass)return u?!!u.bypass&&(a[i.name]=u.bypassed,f(),!0):(f(),!0);var p=function(){he("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+i.name+"` with data field `"+i.field+"`); try a `["+i.field+"]` selector to limit scope to elements with `"+i.field+"` defined")};switch(i.mapped){case o.mapData:for(var v,g=i.field.split("."),y=h.data,m=0;m<g.length&&y;m++){y=y[g[m]]}if(null==y)return p(),!1;if(!k(y))return he("Do not use continuous mappers without specifying numeric data (i.e. `"+i.field+": "+y+"` for `"+e.id()+"` is non-numeric)"),!1;var b=i.fieldMax-i.fieldMin;if((v=0===b?0:(y-i.fieldMin)/b)<0?v=0:v>1&&(v=1),s.color){var x=i.valueMin[0],w=i.valueMax[0],E=i.valueMin[1],_=i.valueMax[1],C=i.valueMin[2],S=i.valueMax[2],P=null==i.valueMin[3]?1:i.valueMin[3],T=null==i.valueMax[3]?1:i.valueMax[3],A=[Math.round(x+(w-x)*v),Math.round(E+(_-E)*v),Math.round(C+(S-C)*v),Math.round(P+(T-P)*v)];n={bypass:i.bypass,name:i.name,value:A,strValue:"rgb("+A[0]+", "+A[1]+", "+A[2]+")"}}else{if(!s.number)return!1;var D=i.valueMin+(i.valueMax-i.valueMin)*v;n=this.parse(i.name,D,i.bypass,"mapping")}if(!n)return p(),!1;n.mapping=i,i=n;break;case o.data:for(var M=i.field.split("."),O=h.data,B=0;B<M.length&&O;B++){O=O[M[B]]}if(null!=O&&(n=this.parse(i.name,O,i.bypass,"mapping")),!n)return p(),!1;n.mapping=i,i=n;break;case o.fn:var L=i.value,I=null!=i.fnValue?i.fnValue:L(e);if(i.prevFnValue=I,null==I)return he("Custom function mappers may not return null (i.e. `"+i.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(n=this.parse(i.name,I,i.bypass,"mapping")))return he("Custom function mappers may not return invalid values for the property type (i.e. `"+i.name+"` for ele `"+e.id()+"` is invalid)"),!1;n.mapping=de(i),i=n;break;case void 0:break;default:return!1}return l?(i.bypassed=c?u.bypassed:u,a[i.name]=i):c?u.bypassed=i:a[i.name]=i,f(),!0},_a.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),t)for(var i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else r._private.style={}}},_a.update=function(){this._private.cy.mutableElements().updateStyle()},_a.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,u=0;u<i.length;u++){var c=i[u],h=e.pstyle(c),d=t[c];if(d){var f=d.prev,p=null!=d.next?d.next:h,v=!1,g=void 0;f&&(k(f.pfValue)&&k(p.pfValue)?(v=p.pfValue-f.pfValue,g=f.pfValue+1e-6*v):k(f.value)&&k(p.value)?(v=p.value-f.value,g=f.value+1e-6*v):w(f.value)&&w(p.value)&&(v=f.value[0]!==p.value[0]||f.value[1]!==p.value[1]||f.value[2]!==p.value[2],g=f.strValue),v&&(s[c]=p.strValue,this.applyBypass(e,c,g),l=!0))}}if(!l)return;r.transitioning=!0,new Rn((function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},_a.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},_a.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},_a.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),"bezier"!==e.pstyle("curve-style").value&&("curve-style"!==t||"bezier"!==n&&"bezier"!==r)||!i.triggersBoundsOfParallelBeziers||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},_a.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ca={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name,s=this.parse(o,n,!0);s&&i.push(s)}}else if(b(t)){var l=this.parse(t,n,!0);l&&i.push(l)}else{if(!E(t))return!1;var u=t;r=n;for(var c=Object.keys(u),h=0;h<c.length;h++){var d=c[h],f=u[d];if(void 0===f&&(f=u[L(d)]),void 0!==f){var p=this.parse(d,f,!0);p&&i.push(p)}}}if(0===i.length)return!1;for(var v=!1,g=0;g<e.length;g++){for(var y=e[g],m={},x=void 0,w=0;w<i.length;w++){var k=i[w];if(r){var _=y.pstyle(k.name);x=m[k.name]={prev:_}}v=this.applyParsedProperty(y,k)||v,r&&(x.next=y.pstyle(k.name))}v&&this.updateStyleHints(y),r&&this.updateTransitions(y,m,!0)}return v},overrideBypass:function(e,t,n){t=B(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),a.strValue=s?"rgb("+n.join(",")+")":l?n.join(" "):""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,t,u,n)}},removeAllBypasses:function(e,t){return this.removeBypasses(e,this.propertyNames,t)},removeBypasses:function(e,t,n){for(var r=0;r<e.length;r++){for(var i=e[r],a={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=i.pstyle(l.name);if(u&&u.bypass){var c=this.parse(s,"",!0),h=a[l.name]={prev:u};this.applyParsedProperty(i,c),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,a,!0)}}},Sa={getEmSizeInPixels:function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},containerCss:function(e){var t=this._private.cy.container();if(d&&t&&d.getComputedStyle)return d.getComputedStyle(t).getPropertyValue(e)}},Pa={getRenderedStyle:function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},getRawStyle:function(e,t){if(e=e[0]){for(var n={},r=0;r<this.properties.length;r++){var i=this.properties[r],a=this.getStylePropertyValue(e,i.name,t);null!=a&&(n[i.name]=a,n[L(i.name)]=a)}return n}},getIndexedStyle:function(e,t,n,r){var i=e.pstyle(t)[n][r];return null!=i?i:e.cy().style().getDefaultProperty(t)[n][0]},getStylePropertyValue:function(e,t,n){if(e=e[0]){var r=this.properties[t];r.alias&&(r=r.pointsTo);var i=r.type,a=e.pstyle(r.name);if(a){var o=a.value,s=a.units,l=a.strValue;if(n&&i.number&&null!=o&&k(o)){var u=e.cy().zoom(),c=function(e){return e*u},h=function(e,t){return c(e)+t},d=w(o);return(d?s.every((function(e){return null!=e})):null!=s)?d?o.map((function(e,t){return h(e,s[t])})).join(" "):h(o,s):d?o.map((function(e){return b(e)?e:""+c(e)})).join(" "):""+c(o)}if(null!=l)return l}return null}},getAnimationStartStyle:function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r].name,a=e.pstyle(i);void 0!==a&&(a=E(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},getPropsList:function(e){var t=[],n=e,r=this.properties;if(n)for(var i=Object.keys(n),a=0;a<i.length;a++){var o=i[a],s=n[o],l=r[o]||r[B(o)],u=this.parse(l.name,s);u&&t.push(u)}return t},getNonDefaultPropertiesHash:function(e,t,n){var r,i,a,o,s,l,u=n;for(s=0;s<t.length;s++)if(r=t[s],null!=(i=e.pstyle(r,!1)))if(null!=i.pfValue)u=Z(o,u);else for(a=i.strValue,l=0;l<a.length;l++)o=a.charCodeAt(l),u=Z(o,u);return u}};Pa.getPropertiesHash=Pa.getNonDefaultPropertiesHash;var Ta={appendFromJson:function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n.selector,i=n.style||n.css,a=Object.keys(i);this.selector(r);for(var o=0;o<a.length;o++){var s=a[o],l=i[s];this.css(s,l)}}return this},fromJson:function(e){return this.resetToDefault(),this.appendFromJson(e),this},json:function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e}},Aa={appendFromString:function(e){var t,n,r,i=""+e;function a(){i=i.length>t.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(i.match(/^\s*$/))break;var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){he("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l)if(new _r(l).invalid){he("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var h=[];;){if(n.match(/^\s*$/))break;var d=n.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!d){he("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=d[0];var f=d[1],p=d[2];if(this.properties[f])this.parse(f,p)?(h.push({name:f,val:p}),o()):(he("Skipping property: Invalid property definition in: "+r),o());else he("Skipping property: Invalid property name in: "+r),o()}if(c){a();break}this.selector(l);for(var v=0;v<h.length;v++){var g=h[v];this.css(g.name,g.val)}a()}return this},fromString:function(e){return this.resetToDefault(),this.appendFromString(e),this}},Da={};!function(){var e=z,t=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},n=function(t){var n=e+"|\\w+|rgb[a]?\\((?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%]?)(?:\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)|hsl[a]?\\((?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*(?:(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+t+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+n+")\\s*\\,\\s*("+n+")\\)$"},r=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];Da.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","taxi"]},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","polygon"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:t("data")},layoutData:{mapping:!0,regex:t("layoutData")},scratch:{mapping:!0,regex:t("scratch")},mapData:{mapping:!0,regex:n("mapData")},mapLayoutData:{mapping:!0,regex:n("mapLayoutData")},mapScratch:{mapping:!0,regex:n("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:r,singleRegexMatchValue:!0},urls:{regexes:r,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return b(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return 1===t||2===t||4===t}}};var i={zeroNonZero:function(e,t){return(null==e||null==t)&&e!==t||(0==e&&0!=t||0!=e&&0==t)},any:function(e,t){return e!=t}},a=Da.types,o=[{name:"label",type:a.text,triggersBounds:i.any},{name:"text-rotation",type:a.textRotation,triggersBounds:i.any},{name:"text-margin-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"text-margin-y",type:a.bidirectionalSize,triggersBounds:i.any}],s=[{name:"source-label",type:a.text,triggersBounds:i.any},{name:"source-text-rotation",type:a.textRotation,triggersBounds:i.any},{name:"source-text-margin-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"source-text-margin-y",type:a.bidirectionalSize,triggersBounds:i.any},{name:"source-text-offset",type:a.size,triggersBounds:i.any}],l=[{name:"target-label",type:a.text,triggersBounds:i.any},{name:"target-text-rotation",type:a.textRotation,triggersBounds:i.any},{name:"target-text-margin-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"target-text-margin-y",type:a.bidirectionalSize,triggersBounds:i.any},{name:"target-text-offset",type:a.size,triggersBounds:i.any}],u=[{name:"font-family",type:a.fontFamily,triggersBounds:i.any},{name:"font-style",type:a.fontStyle,triggersBounds:i.any},{name:"font-weight",type:a.fontWeight,triggersBounds:i.any},{name:"font-size",type:a.size,triggersBounds:i.any},{name:"text-transform",type:a.textTransform,triggersBounds:i.any},{name:"text-wrap",type:a.textWrap,triggersBounds:i.any},{name:"text-overflow-wrap",type:a.textOverflowWrap,triggersBounds:i.any},{name:"text-max-width",type:a.size,triggersBounds:i.any},{name:"text-outline-width",type:a.size,triggersBounds:i.any},{name:"line-height",type:a.positiveNumber,triggersBounds:i.any}],c=[{name:"text-valign",type:a.valign,triggersBounds:i.any},{name:"text-halign",type:a.halign,triggersBounds:i.any},{name:"color",type:a.color},{name:"text-outline-color",type:a.color},{name:"text-outline-opacity",type:a.zeroOneNumber},{name:"text-background-color",type:a.color},{name:"text-background-opacity",type:a.zeroOneNumber},{name:"text-background-padding",type:a.size,triggersBounds:i.any},{name:"text-border-opacity",type:a.zeroOneNumber},{name:"text-border-color",type:a.color},{name:"text-border-width",type:a.size,triggersBounds:i.any},{name:"text-border-style",type:a.borderStyle,triggersBounds:i.any},{name:"text-background-shape",type:a.textBackgroundShape,triggersBounds:i.any},{name:"text-justification",type:a.justification}],h=[{name:"events",type:a.bool},{name:"text-events",type:a.bool}],d=[{name:"display",type:a.display,triggersZOrder:i.any,triggersBounds:i.any,triggersBoundsOfParallelBeziers:!0},{name:"visibility",type:a.visibility,triggersZOrder:i.any},{name:"opacity",type:a.zeroOneNumber,triggersZOrder:i.zeroNonZero},{name:"text-opacity",type:a.zeroOneNumber},{name:"min-zoomed-font-size",type:a.size},{name:"z-compound-depth",type:a.zCompoundDepth,triggersZOrder:i.any},{name:"z-index-compare",type:a.zIndexCompare,triggersZOrder:i.any},{name:"z-index",type:a.nonNegativeInt,triggersZOrder:i.any}],f=[{name:"overlay-padding",type:a.size,triggersBounds:i.any},{name:"overlay-color",type:a.color},{name:"overlay-opacity",type:a.zeroOneNumber,triggersBounds:i.zeroNonZero}],p=[{name:"transition-property",type:a.propList},{name:"transition-duration",type:a.time},{name:"transition-delay",type:a.time},{name:"transition-timing-function",type:a.easing}],v=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},g=[{name:"height",type:a.nodeSize,triggersBounds:i.any,hashOverride:v},{name:"width",type:a.nodeSize,triggersBounds:i.any,hashOverride:v},{name:"shape",type:a.nodeShape,triggersBounds:i.any},{name:"shape-polygon-points",type:a.polygonPointList,triggersBounds:i.any},{name:"background-color",type:a.color},{name:"background-fill",type:a.fill},{name:"background-opacity",type:a.zeroOneNumber},{name:"background-blacken",type:a.nOneOneNumber},{name:"background-gradient-stop-colors",type:a.colors},{name:"background-gradient-stop-positions",type:a.percentages},{name:"background-gradient-direction",type:a.gradientDirection},{name:"padding",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"padding-relative-to",type:a.paddingRelativeTo,triggersBounds:i.any},{name:"bounds-expansion",type:a.boundsExpansion,triggersBounds:i.any}],y=[{name:"border-color",type:a.color},{name:"border-opacity",type:a.zeroOneNumber},{name:"border-width",type:a.size,triggersBounds:i.any},{name:"border-style",type:a.borderStyle}],m=[{name:"background-image",type:a.urls},{name:"background-image-crossorigin",type:a.bgCrossOrigin},{name:"background-image-opacity",type:a.zeroOneNumbers},{name:"background-position-x",type:a.bgPos},{name:"background-position-y",type:a.bgPos},{name:"background-width-relative-to",type:a.bgRelativeTo},{name:"background-height-relative-to",type:a.bgRelativeTo},{name:"background-repeat",type:a.bgRepeat},{name:"background-fit",type:a.bgFit},{name:"background-clip",type:a.bgClip},{name:"background-width",type:a.bgWH},{name:"background-height",type:a.bgWH},{name:"background-offset-x",type:a.bgPos},{name:"background-offset-y",type:a.bgPos}],x=[{name:"position",type:a.position,triggersBounds:i.any},{name:"compound-sizing-wrt-labels",type:a.compoundIncludeLabels,triggersBounds:i.any},{name:"min-width",type:a.size,triggersBounds:i.any},{name:"min-width-bias-left",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"min-width-bias-right",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"min-height",type:a.size,triggersBounds:i.any},{name:"min-height-bias-top",type:a.sizeMaybePercent,triggersBounds:i.any},{name:"min-height-bias-bottom",type:a.sizeMaybePercent,triggersBounds:i.any}],w=[{name:"line-style",type:a.lineStyle},{name:"line-color",type:a.color},{name:"line-fill",type:a.fill},{name:"line-cap",type:a.lineCap},{name:"line-dash-pattern",type:a.numbers},{name:"line-dash-offset",type:a.number},{name:"line-gradient-stop-colors",type:a.colors},{name:"line-gradient-stop-positions",type:a.percentages},{name:"curve-style",type:a.curveStyle,triggersBounds:i.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:a.zeroOneNumber,triggersBounds:i.any},{name:"source-endpoint",type:a.edgeEndpoint,triggersBounds:i.any},{name:"target-endpoint",type:a.edgeEndpoint,triggersBounds:i.any},{name:"control-point-step-size",type:a.size,triggersBounds:i.any},{name:"control-point-distances",type:a.bidirectionalSizes,triggersBounds:i.any},{name:"control-point-weights",type:a.numbers,triggersBounds:i.any},{name:"segment-distances",type:a.bidirectionalSizes,triggersBounds:i.any},{name:"segment-weights",type:a.numbers,triggersBounds:i.any},{name:"taxi-turn",type:a.bidirectionalSizeMaybePercent,triggersBounds:i.any},{name:"taxi-turn-min-distance",type:a.size,triggersBounds:i.any},{name:"taxi-direction",type:a.axisDirection,triggersBounds:i.any},{name:"edge-distances",type:a.edgeDistances,triggersBounds:i.any},{name:"arrow-scale",type:a.positiveNumber,triggersBounds:i.any},{name:"loop-direction",type:a.angle,triggersBounds:i.any},{name:"loop-sweep",type:a.angle,triggersBounds:i.any},{name:"source-distance-from-node",type:a.size,triggersBounds:i.any},{name:"target-distance-from-node",type:a.size,triggersBounds:i.any}],E=[{name:"ghost",type:a.bool,triggersBounds:i.any},{name:"ghost-offset-x",type:a.bidirectionalSize,triggersBounds:i.any},{name:"ghost-offset-y",type:a.bidirectionalSize,triggersBounds:i.any},{name:"ghost-opacity",type:a.zeroOneNumber}],k=[{name:"selection-box-color",type:a.color},{name:"selection-box-opacity",type:a.zeroOneNumber},{name:"selection-box-border-color",type:a.color},{name:"selection-box-border-width",type:a.size},{name:"active-bg-color",type:a.color},{name:"active-bg-opacity",type:a.zeroOneNumber},{name:"active-bg-size",type:a.size},{name:"outside-texture-bg-color",type:a.color},{name:"outside-texture-bg-opacity",type:a.zeroOneNumber}],_=[];Da.pieBackgroundN=16,_.push({name:"pie-size",type:a.sizeMaybePercent});for(var C=1;C<=Da.pieBackgroundN;C++)_.push({name:"pie-"+C+"-background-color",type:a.color}),_.push({name:"pie-"+C+"-background-size",type:a.percent}),_.push({name:"pie-"+C+"-background-opacity",type:a.zeroOneNumber});var S=[],P=Da.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:a.arrowShape,triggersBounds:i.any},{name:"arrow-color",type:a.color},{name:"arrow-fill",type:a.arrowFill}].forEach((function(e){P.forEach((function(t){var n=t+"-"+e.name,r=e.type,i=e.triggersBounds;S.push({name:n,type:r,triggersBounds:i})}))}),{});var T=Da.properties=[].concat(h,p,d,f,E,c,u,o,s,l,g,y,m,_,x,w,S,k),A=Da.propertyGroups={behavior:h,transition:p,visibility:d,overlay:f,ghost:E,commonLabel:c,labelDimensions:u,mainLabel:o,sourceLabel:s,targetLabel:l,nodeBody:g,nodeBorder:y,backgroundImage:m,pie:_,compound:x,edgeLine:w,edgeArrow:S,core:k},D=Da.propertyGroupNames={};(Da.propertyGroupKeys=Object.keys(A)).forEach((function(e){D[e]=A[e].map((function(e){return e.name})),A[e].forEach((function(t){return t.groupKey=e}))}));var M=Da.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Da.propertyNames=T.map((function(e){return e.name}));for(var O=0;O<T.length;O++){var B=T[O];T[B.name]=B}for(var L=0;L<M.length;L++){var I=M[L],N=T[I.pointsTo],R={name:I.name,alias:!0,pointsTo:N};T.push(R),T[I.name]=R}}(),Da.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Da.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=j({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1,   1, -1,   1, 1,   -1, 1","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce((function(e,t){for(var n=1;n<=Da.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e}),{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"taxi-turn":"50%","taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"}].reduce((function(e,t){return Da.arrowPrefixes.forEach((function(n){var r=n+"-"+t.name,i=t.value;e[r]=i})),e}),{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);n[a]=s}}return e.defaultProperties=n,e.defaultProperties},Da.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Ma={parse:function(e,t,n,r){if(x(t))return this.parseImplWarn(e,t,n,r);var i,a=J(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),o=this.propCache=this.propCache||[];return(i=o[a])||(i=o[a]=this.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(i=de(i))&&(i.value=de(i.value)),i},parseImplWarn:function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return i||null==t||he("The style property `".concat(e,": ").concat(t,"` is invalid")),i}};Ma.parseImpl=function(e,t,n,r){e=B(e);var i=this.properties[e],a=t,o=this.types;if(!i)return null;if(void 0===t)return null;i.alias&&(i=i.pointsTo,e=i.name);var s=b(t);s&&(t=t.trim());var l,u,c=i.type;if(!c)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(x(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};if(!s||r||t.length<7||"a"!==t[1]);else{if(t.length>=7&&"d"===t[0]&&(l=new RegExp(o.data.regex).exec(t))){if(n)return!1;var h=o.data;return{name:e,value:l,strValue:""+t,mapped:h,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(u=new RegExp(o.mapData.regex).exec(t))){if(n)return!1;if(c.multiple)return!1;var d=o.mapData;if(!c.color&&!c.number)return!1;var f=this.parse(e,u[4]);if(!f||f.mapped)return!1;var p=this.parse(e,u[5]);if(!p||p.mapped)return!1;if(f.pfValue===p.pfValue||f.strValue===p.strValue)return he("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+f.strValue+"`"),this.parse(e,f.strValue);if(c.color){var v=f.value,g=p.value;if(!(v[0]!==g[0]||v[1]!==g[1]||v[2]!==g[2]||v[3]!==g[3]&&(null!=v[3]&&1!==v[3]||null!=g[3]&&1!==g[3])))return!1}return{name:e,value:u,strValue:""+t,mapped:d,field:u[1],fieldMin:parseFloat(u[2]),fieldMax:parseFloat(u[3]),valueMin:f.value,valueMax:p.value,bypass:n}}}if(c.multiple&&"multiple"!==r){var y;if(y=s?t.split(/\s+/):w(t)?t:[t],c.evenMultiple&&y.length%2!=0)return null;for(var m=[],E=[],_=[],C="",S=!1,P=0;P<y.length;P++){var T=this.parse(e,y[P],n,"multiple");S=S||b(T.value),m.push(T.value),_.push(null!=T.pfValue?T.pfValue:T.value),E.push(T.units),C+=(P>0?" ":"")+T.strValue}return c.validate&&!c.validate(m,E)?null:c.singleEnum&&S?1===m.length&&b(m[0])?{name:e,value:m[0],strValue:m[0],bypass:n}:null:{name:e,value:m,pfValue:_,strValue:C,bypass:n,units:E}}var A,D,M=function(){for(var r=0;r<c.enums.length;r++){if(c.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(c.number){var O,L="px";if(c.units&&(O=c.units),c.implicitUnits&&(L=c.implicitUnits),!c.unitless)if(s){var I="px|em"+(c.allowPercent?"|\\%":"");O&&(I=O);var N=t.match("^("+z+")("+I+")?$");N&&(t=N[1],O=N[2]||L)}else O&&!c.implicitUnits||(O=L);if(t=parseFloat(t),isNaN(t)&&void 0===c.enums)return null;if(isNaN(t)&&void 0!==c.enums)return t=a,M();if(c.integer&&(!k(D=t)||Math.floor(D)!==D))return null;if(void 0!==c.min&&(t<c.min||c.strictMin&&t===c.min)||void 0!==c.max&&(t>c.max||c.strictMax&&t===c.max))return null;var R={name:e,value:t,strValue:""+t+(O||""),units:O,bypass:n};return c.unitless||"px"!==O&&"em"!==O?R.pfValue=t:R.pfValue="px"!==O&&O?this.getEmSizeInPixels()*t:t,"ms"!==O&&"s"!==O||(R.pfValue="ms"===O?t:1e3*t),"deg"!==O&&"rad"!==O||(R.pfValue="rad"===O?t:(A=t,Math.PI*A/180)),"%"===O&&(R.pfValue=t/100),R}if(c.propList){var j=[],F=""+t;if("none"===F);else{for(var q=F.split(/\s*,\s*|\s+/),X=0;X<q.length;X++){var Y=q[X].trim();this.properties[Y]?j.push(Y):he("`"+Y+"` is not a valid property name")}if(0===j.length)return null}return{name:e,value:j,strValue:0===j.length?"none":j.join(" "),bypass:n}}if(c.color){var G=V(t);return G?{name:e,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:n}:null}if(c.regex||c.regexes){if(c.enums){var H=M();if(H)return H}for(var W=c.regexes?c.regexes:[c.regex],U=0;U<W.length;U++){var K=new RegExp(W[U]).exec(t);if(K)return{name:e,value:c.singleRegexMatchValue?K[1]:K,strValue:""+t,bypass:n}}return null}return c.string?{name:e,value:""+t,strValue:""+t,bypass:n}:c.enums?M():null};var Oa=function e(t){if(!(this instanceof e))return new e(t);T(t)?(this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()):ue("A style must have a core reference")},Ba=Oa.prototype;Ba.instanceString=function(){return"style"},Ba.clear=function(){for(var e=0;e<this.length;e++)this[e]=void 0;return this.length=0,this._private.newStyle=!0,this},Ba.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Ba.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},Ba.selector=function(e){var t="core"===e?null:new _r(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},Ba.css=function(){var e=this,t=arguments;if(1===t.length)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];void 0===a&&(a=n[L(i.name)]),void 0!==a&&this.cssRule(i.name,a)}else 2===t.length&&this.cssRule(t[0],t[1]);return this},Ba.style=Ba.css,Ba.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n),!this[r].selector&&(this._private.coreStyle[n.name]=n)}return this},Ba.append=function(e){return A(e)?e.appendToStyle(this):w(e)?this.appendFromJson(e):b(e)&&this.appendFromString(e),this},Oa.fromJson=function(e,t){var n=new Oa(e);return n.fromJson(t),n},Oa.fromString=function(e,t){return new Oa(e).fromString(t)},[_a,Ca,Sa,Pa,Ta,Aa,Da,Ma].forEach((function(e){j(Ba,e)})),Oa.types=Ba.types,Oa.properties=Ba.properties,Oa.propertyGroups=Ba.propertyGroups,Oa.propertyGroupNames=Ba.propertyGroupNames,Oa.propertyGroupKeys=Ba.propertyGroupKeys;var La={style:function(e){e&&this.setStyle(e).update();return this._private.style},setStyle:function(e){var t=this._private;return A(e)?t.style=e.generateStyle(this):w(e)?t.style=Oa.fromJson(this,e):b(e)?t.style=Oa.fromString(this,e):t.style=Oa(this),t.style}},Ia={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return null==t.selectionType&&(t.selectionType="single"),void 0===e?t.selectionType:("additive"!==e&&"single"!==e||(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(b(a[0]))return o[e=a[0]];if(E(a[0])){if(!this._private.panningEnabled)return this;r=(n=a[0]).x,i=n.y,k(r)&&(o.x=r),k(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],"x"!==e&&"y"!==e||!k(t)||(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a,o,s=arguments,l=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:E(e)&&(a=(i=s[0]).x,o=i.y,k(a)&&(l.x+=a),k(o)&&(l.y+=o),this.emit("pan viewport"));break;case 2:r=t,"x"!==(n=e)&&"y"!==n||!k(r)||(l[n]+=r),this.emit("pan viewport")}return this.notify("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("viewport")}return this},getFitViewport:function(e,t){if(k(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n,r;if(b(e)){var i=e;e=this.$(i)}else if(E(r=e)&&k(r.x1)&&k(r.x2)&&k(r.y1)&&k(r.y2)){var a=e;(n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else C(e)||(e=this.mutableElements());if(!C(e)||!e.empty()){n=n||e.boundingBox();var o,s=this.width(),l=this.height();if(t=k(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)<this._private.minZoom?this._private.minZoom:o,pan:{x:(s-o*(n.x1+n.x2))/2,y:(l-o*(n.y1+n.y2))/2}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return k(e)&&k(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):k(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:k(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),k(e)?n=e:E(e)&&(n=e.level,null!=e.position?t=Ve(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!k(n)||n===a||null!=t&&(!k(t.x)||!k(t.y)))return null;if(null!=t){var s=i,l=a,u=n;return{zoomed:!0,panned:!0,zoom:u,pan:{x:-u/l*(t.x-s.x)+t.x,y:-u/l*(t.y-s.y)+t.y}}}return{zoomed:!0,panned:!1,zoom:n,pan:i}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed?(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this):this},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],a=!1,o=!1;if(!e)return this;if(k(e.zoom)||(n=!1),E(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;k(l.x)&&(t.pan.x=l.x,o=!1),k(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(b(e)){var n=e;e=this.mutableElements().filter(n)}else C(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.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,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=d.getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("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}}};Ia.centre=Ia.center,Ia.autolockNodes=Ia.autolock,Ia.autoungrabifyNodes=Ia.autoungrabify;var Na={data:Fn.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0}),removeData:Fn.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0}),scratch:Fn.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0}),removeScratch:Fn.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0})};Na.attr=Na.data,Na.removeAttr=Na.removeData;var za=function(e){var t=this,n=(e=j({},e)).container;n&&!_(n)&&_(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==d&&void 0!==n&&!e.headless,o=e;o.layout=j({name:a?"grid":"null"},o.layout),o.renderer=j({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new ta(this),listeners:[],aniEles:new ta(this),data:{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:k(o.zoom)?o.zoom:1,pan:{x:E(o.pan)&&k(o.pan.x)?o.pan.x:0,y:E(o.pan)&&k(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});l.styleEnabled&&t.setStyle([]);var u=j({},o,o.renderer);t.initRenderer(u);!function(e,t){if(e.some(M))return Rn.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(E(e)||w(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=j({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),l.ready=!0,x(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")}),o.done)}))},Ra=za.prototype;j(Ra,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},mount:function(e){if(null!=e){var t=this,n=t._private,r=n.options;return!_(e)&&_(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(j({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return de(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements();if(E(e)){if(t.startBatch(),e.elements){var i={},a=function(e,n){for(var r=[],a=[],o=0;o<e.length;o++){var s=e[o],l=""+s.data.id,u=t.getElementById(l);i[l]=!0,0!==u.length?a.push({ele:u,json:s}):n?(s.group=n,r.push(s)):r.push(s)}t.add(r);for(var c=0;c<a.length;c++){var h=a[c],d=h.ele,f=h.json;d.json(f)}};if(w(e.elements))a(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];w(u)&&a(u,l)}var c=t.collection();r.filter((function(e){return!i[e.id()]})).forEach((function(e){e.isParent()?c.merge(e):e.remove()})),c.forEach((function(e){return e.children().move({parent:null})})),c.forEach((function(e){return function(e){return t.getElementById(e.id())}(e).remove()}))}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x===n.pan.x&&e.pan.y===n.pan.y||t.pan(e.pan)),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify"],d=0;d<h.length;d++){var f=h[d];null!=e[f]&&t[f](e[f])}return t.endBatch(),this}var p={};!!e?p.elements=this.elements().map((function(e){return e.json()})):(p.elements={},r.forEach((function(e){var t=e.group();p.elements[t]||(p.elements[t]=[]),p.elements[t].push(e.json())}))),this._private.styleEnabled&&(p.style=t.style().json()),p.data=de(t.data());var v=n.options;return p.zoomingEnabled=n.zoomingEnabled,p.userZoomingEnabled=n.userZoomingEnabled,p.zoom=n.zoom,p.minZoom=n.minZoom,p.maxZoom=n.maxZoom,p.panningEnabled=n.panningEnabled,p.userPanningEnabled=n.userPanningEnabled,p.pan=de(n.pan),p.boxSelectionEnabled=n.boxSelectionEnabled,p.renderer=de(v.renderer),p.hideEdgesOnViewport=v.hideEdgesOnViewport,p.textureOnViewport=v.textureOnViewport,p.wheelSensitivity=v.wheelSensitivity,p.motionBlur=v.motionBlur,p}}),Ra.$id=Ra.getElementById,[ra,pa,ya,ma,ba,xa,Ea,ka,La,Ia,Na].forEach((function(e){j(Ra,e)}));var ja={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,maximal:!1,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}},Va=function(e){return e.scratch("breadthfirst")},Fa=function(e,t){return e.scratch("breadthfirst",t)};function qa(e){this.options=j({},ja,e)}qa.prototype.run=function(){var e,t=this.options,n=t,r=t.cy,i=n.eles,a=i.nodes().filter((function(e){return!e.isParent()})),o=i,s=n.directed,l=n.maximal||n.maximalAdjustments>0,u=Qe(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(C(n.roots))e=n.roots;else if(w(n.roots)){for(var c=[],h=0;h<n.roots.length;h++){var d=n.roots[h],f=r.getElementById(d);c.push(f)}e=r.collection(c)}else if(b(n.roots))e=r.$(n.roots);else if(s)e=a.roots();else{var p=i.components();e=r.collection();for(var v=function(t){var n=p[t],r=n.maxDegree(!1),i=n.filter((function(e){return e.degree(!1)===r}));e=e.add(i)},g=0;g<p.length;g++)v(g)}var y=[],m={},x=function(e,t){null==y[t]&&(y[t]=[]);var n=y[t].length;y[t].push(e),Fa(e,{index:n,depth:t})};o.bfs({roots:e,directed:n.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();x(a,i),m[o]=!0}});for(var E=[],k=0;k<a.length;k++){var _=a[k];m[_.id()]||E.push(_)}var S=function(e){for(var t=y[e],n=0;n<t.length;n++){var r=t[n];null!=r?Fa(r,{depth:e,index:n}):(t.splice(n,1),n--)}},P=function(){for(var e=0;e<y.length;e++)S(e)},T=function(e,t){for(var n=Va(e),r=e.incomers().filter((function(e){return e.isNode()&&i.has(e)})),a=-1,o=e.id(),s=0;s<r.length;s++){var l=r[s],u=Va(l);a=Math.max(a,u.depth)}return n.depth<=a&&(t[o]?null:(function(e,t){var n=Va(e),r=n.depth,i=n.index;y[r][i]=null,x(e,t)}(e,a+1),t[o]=!0,!0))};if(s&&l){var A=[],D={},M=function(e){return A.push(e)};for(a.forEach((function(e){return A.push(e)}));A.length>0;){var O=A.shift(),B=T(O,D);if(B)O.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(M);else if(null===B){he("Detected double maximal shift for node `"+O.id()+"`.  Bailing maximal adjustment due to cycle.  Use `options.maximal: true` only on DAGs.");break}}}P();var L=0;if(n.avoidOverlap)for(var I=0;I<a.length;I++){var N=a[I].layoutDimensions(n),z=N.w,j=N.h;L=Math.max(L,z,j)}for(var V={},F=function(e){if(V[e.id()])return V[e.id()];for(var t=Va(e).depth,n=e.neighborhood(),r=0,i=0,o=0;o<n.length;o++){var s=n[o];if(!s.isEdge()&&!s.isParent()&&a.has(s)){var l=Va(s),u=l.index,c=l.depth;if(null!=u&&null!=c){var h=y[c].length;c<t&&(r+=u/h,i++)}}}return r/=i=Math.max(1,i),0===i&&(r=0),V[e.id()]=r,r},q=function(e,t){var n=F(e)-F(t);return 0===n?R(e.id(),t.id()):n},X=0;X<y.length;X++)y[X].sort(q),S(X);for(var Y=[],G=0;G<E.length;G++)Y.push(E[G]);y.unshift(Y),P();for(var H=0,W=0;W<y.length;W++)H=Math.max(y[W].length,H);var U=u.x1+u.w/2,K=u.x1+u.h/2,Z=y.reduce((function(e,t){return Math.max(e,t.length)}),0);return a.layoutPositions(this,n,(function(e){var t=Va(e),r=t.depth,i=t.index,a=y[r].length,o=Math.max(u.w/((n.grid?Z:a)+1),L),s=Math.max(u.h/(y.length+1),L),l=Math.min(u.w/2/y.length,u.h/2/y.length);if(l=Math.max(l,L),n.circle){var c=l*r+l-(y.length>0&&y[0].length<=3?l/2:0),h=2*Math.PI/y[r].length*i;return 0===r&&1===y[0].length&&(c=1),{x:U+c*Math.cos(h),y:K+c*Math.sin(h)}}return{x:U+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var Xa={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ya(e){this.options=j({},Xa,e)}Ya.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=Qe(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),h=0,d=0;d<a.length;d++){var f=a[d].layoutDimensions(t),p=f.w,v=f.h;h=Math.max(h,p,v)}if(o=k(t.radius)?t.radius:a.length<=1?0:Math.min(s.h,s.w)/2-h,a.length>1&&t.avoidOverlap){h*=1.75;var g=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(h*h/(g*g+y*y));o=Math.max(m,o)}return a.layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}})),this};var Ga,Ha={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Wa(e){this.options=j({},Ha,e)}Wa.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.nodes().not(":parent"),a=Qe(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o=a.x1+a.w/2,s=a.y1+a.h/2,l=[],u=0,c=0;c<i.length;c++){var h,d=i[c];h=t.concentric(d),l.push({value:h,node:d}),d._private.scratch.concentric=h}i.updateStyle();for(var f=0;f<i.length;f++){var p=i[f].layoutDimensions(t);u=Math.max(u,p.w,p.h)}l.sort((function(e,t){return t.value-e.value}));for(var v=t.levelWidth(i),g=[[]],y=g[0],m=0;m<l.length;m++){var b=l[m];if(y.length>0)Math.abs(y[0].value-b.value)>=v&&(y=[],g.push(y));y.push(b)}var x=u+t.minNodeSpacing;if(!t.avoidOverlap){var w=g.length>0&&g[0].length>1,E=(Math.min(a.w,a.h)/2-x)/(g.length+w?1:0);x=Math.min(x,E)}for(var k=0,_=0;_<g.length;_++){var C=g[_],S=void 0===t.sweep?2*Math.PI-2*Math.PI/C.length:t.sweep,P=C.dTheta=S/Math.max(1,C.length-1);if(C.length>1&&t.avoidOverlap){var T=Math.cos(P)-Math.cos(0),A=Math.sin(P)-Math.sin(0),D=Math.sqrt(x*x/(T*T+A*A));k=Math.max(D,k)}C.r=k,k+=x}if(t.equidistant){for(var M=0,O=0,B=0;B<g.length;B++){var L=g[B].r-O;M=Math.max(M,L)}O=0;for(var I=0;I<g.length;I++){var N=g[I];0===I&&(O=N.r),N.r=O,O+=M}}for(var z={},R=0;R<g.length;R++)for(var j=g[R],V=j.dTheta,F=j.r,q=0;q<j.length;q++){var X=j[q],Y=t.startAngle+(n?1:-1)*V*q,G={x:o+F*Math.cos(Y),y:s+F*Math.sin(Y)};z[X.node.id()]=G}return i.layoutPositions(this,t,(function(e){var t=e.id();return z[t]})),this};var Ua={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Ka(e){this.options=j({},Ua,e),this.options.layout=this}Ka.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,!0!==e.animate&&!1!==e.animate||n.emit({type:"layoutstart",layout:n}),Ga=!0===e.debug;var r=Za(t,n,e);Ga&&(void 0)(r),e.randomize&&Ja(r);var i=U(),a=function(){to(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter)&&(no(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),i=eo(r,e,t);t.layoutPositions(n,e,i)}},l=0,u=!0;if(!0===e.animate){!function t(){for(var n=0;u&&n<e.refresh;)u=o(l),l++,n++;u?(U()-i>=e.animationThreshold&&a(),W(t)):(vo(r,e),s())}()}else{for(;u;)u=o(l),l++;vo(r,e),s()}return this},Ka.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Ka.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Za=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:Qe(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=n.eles.components(),s={},l=0;l<o.length;l++)for(var u=o[l],c=0;c<u.length;c++){s[u[c].id()]=l}for(l=0;l<a.nodeSize;l++){var h=(g=i[l]).layoutDimensions(n);(B={}).isLocked=g.locked(),B.id=g.data("id"),B.parentId=g.data("parent"),B.cmptId=s[g.id()],B.children=[],B.positionX=g.position("x"),B.positionY=g.position("y"),B.offsetX=0,B.offsetY=0,B.height=h.w,B.width=h.h,B.maxX=B.positionX+B.width/2,B.minX=B.positionX-B.width/2,B.maxY=B.positionY+B.height/2,B.minY=B.positionY-B.height/2,B.padLeft=parseFloat(g.style("padding")),B.padRight=parseFloat(g.style("padding")),B.padTop=parseFloat(g.style("padding")),B.padBottom=parseFloat(g.style("padding")),B.nodeRepulsion=x(n.nodeRepulsion)?n.nodeRepulsion(g):n.nodeRepulsion,a.layoutNodes.push(B),a.idToIndex[B.id]=l}var d=[],f=0,p=-1,v=[];for(l=0;l<a.nodeSize;l++){var g,y=(g=a.layoutNodes[l]).parentId;null!=y?a.layoutNodes[a.idToIndex[y]].children.push(g.id):(d[++p]=g.id,v.push(g.id))}for(a.graphSet.push(v);f<=p;){var m=d[f++],b=a.idToIndex[m],w=a.layoutNodes[b].children;if(w.length>0){a.graphSet.push(w);for(l=0;l<w.length;l++)d[++p]=w[l]}}for(l=0;l<a.graphSet.length;l++){var E=a.graphSet[l];for(c=0;c<E.length;c++){var k=a.idToIndex[E[c]];a.indexToGraph[k]=l}}for(l=0;l<a.edgeSize;l++){var _=r[l],C={};C.id=_.data("id"),C.sourceId=_.data("source"),C.targetId=_.data("target");var S=x(n.idealEdgeLength)?n.idealEdgeLength(_):n.idealEdgeLength,P=x(n.edgeElasticity)?n.edgeElasticity(_):n.edgeElasticity,T=a.idToIndex[C.sourceId],A=a.idToIndex[C.targetId];if(a.indexToGraph[T]!=a.indexToGraph[A]){for(var D=$a(C.sourceId,C.targetId,a),M=a.graphSet[D],O=0,B=a.layoutNodes[T];-1===M.indexOf(B.id);)B=a.layoutNodes[a.idToIndex[B.parentId]],O++;for(B=a.layoutNodes[A];-1===M.indexOf(B.id);)B=a.layoutNodes[a.idToIndex[B.parentId]],O++;S*=O*n.nestingFactor}C.idealLength=S,C.elasticity=P,a.layoutEdges.push(C)}return a},$a=function(e,t,n){var r=Qa(e,t,0,n);return 2>r.count?0:r.graph},Qa=function e(t,n,r,i){var a=i.graphSet[r];if(-1<a.indexOf(t)&&-1<a.indexOf(n))return{count:2,graph:r};for(var o=0,s=0;s<a.length;s++){var l=a[s],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(0!==c.length){var h=e(t,n,i.indexToGraph[i.idToIndex[c[0]]],i);if(0!==h.count){if(1!==h.count)return h;if(2===++o)break}}}return{count:o,graph:r}},Ja=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},eo=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach((function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)})),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(t.boundingBox){var s=(o.positionX-i.x1)/i.w,l=(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}return{x:o.positionX,y:o.positionY}}},to=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=eo(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},no=function(e,t,n){ro(e,t),lo(e),uo(e,t),co(e),ho(e)},ro=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];ao(o,l,e,t)}},io=function(e){return-e+2*e*Math.random()},ao=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY;0===i&&0===a&&(i=io(1),a=io(1));var o=oo(e,t,i,a);if(o>0)var s=(u=r.nodeOverlap*o)*i/(v=Math.sqrt(i*i+a*a)),l=u*a/v;else{var u,c=so(e,i,a),h=so(t,-1*i,-1*a),d=h.x-c.x,f=h.y-c.y,p=d*d+f*f,v=Math.sqrt(p);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/p)*d/v,l=u*f/v}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},oo=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},so=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0<n||0===t&&0>n?(u.x=r,u.y=i+a/2,u):0<t&&-1*l<=s&&s<=l?(u.x=r+o/2,u.y=i+o*n/2/t,u):0>t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0<n&&(s<=-1*l||s>=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},lo=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,u=s.positionY-a.positionY;if(0!==l||0!==u){var c=so(a,l,u),h=so(s,-1*l,-1*u),d=h.x-c.x,f=h.y-c.y,p=Math.sqrt(d*d+f*f),v=Math.pow(r.idealLength-p,2)/r.elasticity;if(0!==p)var g=v*d/p,y=v*f/p;else g=0,y=0;a.isLocked||(a.offsetX+=g,a.offsetY+=y),s.isLocked||(s.offsetX-=g,s.offsetY-=y)}}},uo=function(e,t){for(var n=0;n<e.graphSet.length;n++){var r=e.graphSet[n],i=r.length;if(0===n)var a=e.clientHeight/2,o=e.clientWidth/2;else{var s=e.layoutNodes[e.idToIndex[r[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]];a=l.positionX,o=l.positionY}for(var u=0;u<i;u++){var c=e.layoutNodes[e.idToIndex[r[u]]];if(!c.isLocked){var h=a-c.positionX,d=o-c.positionY,f=Math.sqrt(h*h+d*d);if(f>1){var p=t.gravity*h/f,v=t.gravity*d/f;c.offsetX+=p,c.offsetY+=v}}}}},co=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(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,h=0;h<l.length;h++){var d=e.layoutNodes[e.idToIndex[l[h]]];d.offsetX+=u,d.offsetY+=c,n[++i]=l[h]}s.offsetX=0,s.offsetY=0}}},ho=function(e,t){for(var n=0;n<e.nodeSize;n++){0<(i=e.layoutNodes[n]).children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(n=0;n<e.nodeSize;n++){if(!(0<(i=e.layoutNodes[n]).children.length||i.isLocked)){var r=fo(i.offsetX,i.offsetY,e.temperature);i.positionX+=r.x,i.positionY+=r.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,po(i,e)}}for(n=0;n<e.nodeSize;n++){var i;0<(i=e.layoutNodes[n]).children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},fo=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},po=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLeft<i.minX)&&(i.minX=t.minX-i.padLeft,a=!0),(null==i.maxY||t.maxY+i.padBottom>i.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTop<i.minY)&&(i.minY=t.minY-i.padTop,a=!0),a?e(i,n):void 0}},vo=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}var s=0;for(i=0;i<r.length;i++){if(v=r[i]){v.x1=1/0,v.x2=-1/0,v.y1=1/0,v.y2=-1/0;for(var l=0;l<v.length;l++){var u=v[l];v.x1=Math.min(v.x1,u.positionX-u.width/2),v.x2=Math.max(v.x2,u.positionX+u.width/2),v.y1=Math.min(v.y1,u.positionY-u.height/2),v.y2=Math.max(v.y2,u.positionY+u.height/2)}v.w=v.x2-v.x1,v.h=v.y2-v.y1,s+=v.w*v.h}}r.sort((function(e,t){return t.w*t.h-e.w*e.h}));var c=0,h=0,d=0,f=0,p=Math.sqrt(s)*e.clientWidth/e.clientHeight;for(i=0;i<r.length;i++){var v;if(v=r[i]){for(l=0;l<v.length;l++){(u=v[l]).isLocked||(u.positionX+=c-v.x1,u.positionY+=h-v.y1)}c+=v.w+t.componentSpacing,d+=v.w+t.componentSpacing,f=Math.max(f,v.h),d>p&&(h+=f+t.componentSpacing,c=0,d=0,f=0)}}},go={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function yo(e){this.options=j({},go,e)}yo.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles.nodes().not(":parent");t.sort&&(r=r.sort(t.sort));var i=Qe(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===i.h||0===i.w)r.layoutPositions(this,t,(function(e){return{x:i.x1,y:i.y1}}));else{var a=r.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),l=Math.round(i.w/i.h*o),u=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},c=function(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e},h=t.rows,d=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=d)s=h,l=d;else if(null!=h&&null==d)s=h,l=Math.ceil(a/s);else if(null==h&&null!=d)l=d,s=Math.ceil(a/l);else if(l*s>a){var f=u(),p=c();(f-1)*p>=a?u(f-1):(p-1)*f>=a&&c(p-1)}else for(;l*s<a;){var v=u(),g=c();(g+1)*v>=a?c(g+1):u(v+1)}var y=i.w/l,m=i.h/s;if(t.condense&&(y=0,m=0),t.avoidOverlap)for(var b=0;b<r.length;b++){var x=r[b],w=x._private.position;null!=w.x&&null!=w.y||(w.x=0,w.y=0);var E=x.layoutDimensions(t),k=t.avoidOverlapPadding,_=E.w+k,C=E.h+k;y=Math.max(y,_),m=Math.max(m,C)}for(var S={},P=function(e,t){return!!S["c-"+e+"-"+t]},T=function(e,t){S["c-"+e+"-"+t]=!0},A=0,D=0,M=function(){++D>=l&&(D=0,A++)},O={},B=0;B<r.length;B++){var L=r[B],I=t.position(L);if(I&&(void 0!==I.row||void 0!==I.col)){var N={row:I.row,col:I.col};if(void 0===N.col)for(N.col=0;P(N.row,N.col);)N.col++;else if(void 0===N.row)for(N.row=0;P(N.row,N.col);)N.row++;O[L.id()]=N,T(N.row,N.col)}}r.layoutPositions(this,t,(function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var a=O[e.id()];if(a)n=a.col*y+y/2+i.x1,r=a.row*m+m/2+i.y1;else{for(;P(A,D);)M();n=D*y+y/2+i.x1,r=A*m+m/2+i.y1,T(A,D),M()}return{x:n,y:r}}))}return this};var mo={ready:function(){},stop:function(){}};function bo(e){this.options=j({},mo,e)}bo.prototype.run=function(){var e=this.options,t=e.eles;e.cy;return this.emit("layoutstart"),t.nodes().positions((function(){return{x:0,y:0}})),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this},bo.prototype.stop=function(){return this};var xo={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function wo(e){this.options=j({},xo,e)}wo.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=x(e.positions);return t.layoutPositions(this,e,(function(t,r){var i=function(t){if(null==e.positions)return function(e){return{x:e.x,y:e.y}}(t.position());if(n)return e.positions(t);var r=e.positions[t._private.data.id];return null==r?null:r}(t);return!t.locked()&&null!=i&&i})),this};var Eo={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ko(e){this.options=j({},Eo,e)}ko.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles.nodes().not(":parent"),r=Qe(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.layoutPositions(this,e,(function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}})),this};var _o=[{name:"breadthfirst",impl:qa},{name:"circle",impl:Ya},{name:"concentric",impl:Wa},{name:"cose",impl:Ka},{name:"grid",impl:yo},{name:"null",impl:bo},{name:"preset",impl:wo},{name:"random",impl:ko}];function Co(e){this.options=e,this.notifications=0}var So=function(){},Po=function(){throw new Error("A headless instance can not render images")};Co.prototype={recalculateRenderedStyle:So,notify:function(){this.notifications++},init:So,isHeadless:function(){return!0},png:Po,jpg:Po};var To={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,u=i.y-n/2-o,c=i.y+n/2+o;return s<=e&&e<=l&&u<=t&&t<=c},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=(e*Math.sin(r)+t*Math.cos(r))*n;return{x:a*n+i.x,y:o+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(r(s,l,t,n,i))}return a},a=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){b(s)&&(s=e[s]),e[r]=j({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){var l=a(i(this.points,n+2*s,r,o));return dt(e,t,l)},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:oe,roughCollide:oe,draw:le,spacing:se,gap:se}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,a,o,s){var l=i(this.points,n,a,o),u=this.controlPoint,c=r(u[0],u[1],n,a,o);t.arrowShapeImpl(this.name)(e,l,c)},gap:function(e){return.8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.pointsTee,n+2*l,r,o));return dt(e,t,u)||dt(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.pointsTee,n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e;return n[3]=n[3]-r,n[5]=n[5]-r,n},collide:function(e,t,n,r,o,s,l){var u=a(i(this.points,n+2*l,r,o)),c=a(i(this.crossLinePts(n,s),n+2*l,r,o));return dt(e,t,u)||dt(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.crossLinePts(n,o),n,r,a);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return.525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,n,r,i,a,o){var s=i;return Math.pow(s.x-e,2)+Math.pow(s.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,n,r,i,a){t.arrowShapeImpl(this.name)(e,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return.95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})}},Ao={projectIntoViewport:function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-i)/o-s.x)/l,((t-a)/o-s.y)/l]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=d.getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},i=r("padding-left"),a=r("padding-right"),o=r("padding-top"),s=r("padding-bottom"),l=r("border-left-width"),u=r("border-right-width"),c=r("border-top-width"),h=(r("border-bottom-width"),e.clientWidth),f=e.clientHeight,p=i+a,v=o+s,g=l+u,y=t.width/(h+g),m=h-p,b=f-v,x=t.left+i+l,w=t.top+o+c;return this.containerBB=[x,w,m,b,y]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},findNearestElements:function(e,t,n,r){var i,a,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),h=s.cy.hasCompoundNodes(),d=(r?24:8)/c,f=(r?8:2)/c,p=(r?8:2)/c,v=1/0;function g(e,t){if(e.isNode()){if(a)return;a=e,u.push(e)}if(e.isEdge()&&(null==t||t<v))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value)for(var n=0;n<u.length;n++)if(u[n].isEdge()){u[n]=e,i=e,v=null!=t?t:v;break}}else u.push(e),i=e,v=null!=t?t:v}function y(n){var r=n.outerWidth()+2*f,i=n.outerHeight()+2*f,a=r/2,l=i/2,u=n.position();if(u.x-a<=e&&e<=u.x+a&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,i,u.x,u.y))return g(n,0),!0}function m(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,f=l/2+d,p=f*f,v=2*f,m=i.source,b=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var x=a.allpts,w=0;w+3<x.length;w+=2)if(lt(e,t,x[w],x[w+1],x[w+2],x[w+3],v)&&p>(r=ht(e,t,x[w],x[w+1],x[w+2],x[w+3])))return g(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5<a.allpts.length;w+=4)if(ut(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5],v)&&p>(r=ct(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return g(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w<k.length;w++){var _=k[w],C=s.arrowShapes[n.pstyle(_.name+"-arrow-shape").value],S=n.pstyle("width").pfValue;if(C.roughCollide(e,t,E,_.angle,{x:_.x,y:_.y},S,d)&&C.collide(e,t,E,_.angle,{x:_.x,y:_.y},S,d))return g(n),!0}h&&u.length>0&&(y(m),y(b))}function b(e,t,n){return be(e,t,n)}function x(n,r){var i,a=n._private,o=p;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=a.rstyle,c=b(u,"labelX",r),h=b(u,"labelY",r),d=b(a.rscratch,"labelAngle",r),f=s.x1-o,v=s.x2+o,y=s.y1-o,m=s.y2+o;if(d){var x=Math.cos(d),w=Math.sin(d),E=function(e,t){return{x:(e-=c)*x-(t-=h)*w+c,y:e*w+t*x+h}},k=E(f,y),_=E(f,m),C=E(v,y),S=E(v,m),P=[k.x,k.y,C.x,C.y,S.x,S.y,_.x,_.y];if(dt(e,t,P))return g(n),!0}else if(at(s,e,t))return g(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),h=Math.max(t,r),d=Qe({x1:e=l,y1:t=c,x2:n=u,y2:r=h}),f=0;f<o.length;f++){var p=o[f];if(p.isNode()){var v=p,g=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});it(d,g)&&!ot(g,d)&&s.push(v)}else{var y=p,m=y._private,b=m.rscratch;if(null!=b.startX&&null!=b.startY&&!at(d,b.startX,b.startY))continue;if(null!=b.endX&&null!=b.endY&&!at(d,b.endX,b.endY))continue;if("bezier"===b.edgeType||"multibezier"===b.edgeType||"self"===b.edgeType||"compound"===b.edgeType||"segments"===b.edgeType||"haystack"===b.edgeType){for(var x=m.rstyle.bezierPts||m.rstyle.linePts||m.rstyle.haystackPts,w=!0,E=0;E<x.length;E++)if(i=d,a=x[E],!at(i,a.x,a.y)){w=!1;break}w&&s.push(y)}else"haystack"!==b.edgeType&&"straight"!==b.edgeType||s.push(y)}}return s}},Do={calculateArrowAngles:function(e){var t,n,r,i,a,o,s=e._private.rscratch,l="haystack"===s.edgeType,u="bezier"===s.edgeType,c="multibezier"===s.edgeType,h="segments"===s.edgeType,d="compound"===s.edgeType,f="self"===s.edgeType;if(l?(r=s.haystackPts[0],i=s.haystackPts[1],a=s.haystackPts[2],o=s.haystackPts[3]):(r=s.arrowStartX,i=s.arrowStartY,a=s.arrowEndX,o=s.arrowEndY),v=s.midX,g=s.midY,h)t=r-s.segpts[0],n=i-s.segpts[1];else if(c||d||f||u){var p=s.allpts;t=r-Ke(p[0],p[2],p[4],.1),n=i-Ke(p[1],p[3],p[5],.1)}else t=r-v,n=i-g;s.srcArrowAngle=Xe(t,n);var v=s.midX,g=s.midY;if(l&&(v=(r+a)/2,g=(i+o)/2),t=a-r,n=o-i,h)if((p=s.allpts).length/2%2==0){var y=(m=p.length/2)-2;t=p[m]-p[y],n=p[m+1]-p[y+1]}else{y=(m=p.length/2-1)-2;var m,b=m+2;t=p[m]-p[y],n=p[m+1]-p[y+1]}else if(c||d||f){var x,w,E,k,p=s.allpts;if(s.ctrlpts.length/2%2==0){var _=(C=(S=p.length/2-1)+2)+2;x=Ke(p[S],p[C],p[_],0),w=Ke(p[S+1],p[C+1],p[_+1],0),E=Ke(p[S],p[C],p[_],1e-4),k=Ke(p[S+1],p[C+1],p[_+1],1e-4)}else{var C,S;_=(C=p.length/2-1)+2;x=Ke(p[S=C-2],p[C],p[_],.4999),w=Ke(p[S+1],p[C+1],p[_+1],.4999),E=Ke(p[S],p[C],p[_],.5),k=Ke(p[S+1],p[C+1],p[_+1],.5)}t=E-x,n=k-w}(s.midtgtArrowAngle=Xe(t,n),s.midDispX=t,s.midDispY=n,t*=-1,n*=-1,h)&&((p=s.allpts).length/2%2==0||(t=-(p[b=(m=p.length/2-1)+2]-p[m]),n=-(p[b+1]-p[m+1])));if(s.midsrcArrowAngle=Xe(t,n),h)t=a-s.segpts[s.segpts.length-2],n=o-s.segpts[s.segpts.length-1];else if(c||d||f||u){var P=(p=s.allpts).length;t=a-Ke(p[P-6],p[P-4],p[P-2],.9),n=o-Ke(p[P-5],p[P-3],p[P-1],.9)}else t=a-v,n=o-g;s.tgtArrowAngle=Xe(t,n)}};Do.getArrowWidth=Do.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r,r)};var Mo={};function Oo(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}Mo.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=2*Math.random()*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,l=o.position(),u=s.position(),c=o.width(),h=s.width(),d=o.height(),f=s.height(),p=n.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*c*p+l.x,i.source.y*d*p+l.y,i.target.x*h*p+u.x,i.target.y*f*p+u.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},Mo.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,o=e.pstyle("edge-distances").value,s=e.pstyle("segment-weights"),l=e.pstyle("segment-distances"),u=Math.min(s.pfValue.length,l.pfValue.length);n.edgeType="segments",n.segpts=[];for(var c=0;c<u;c++){var h=s.pfValue[c],d=l.pfValue[c],f=1-h,p=h,v="node-position"===o?r:i,g={x:v.x1*f+v.x2*p,y:v.y1*f+v.y2*p};n.segpts.push(g.x+a.x*d,g.y+a.y*d)}},Mo.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var d=n,f=h;r&&(d=0,f=l);var p=u-Math.PI/2,v=p-c/2,g=p+c/2,y=String(u+"_"+c);d=void 0===a[y]?a[y]=0:++a[y],i.ctrlpts=[o.x+1.4*Math.cos(v)*f*(d/3+1),o.y+1.4*Math.sin(v)*f*(d/3+1),o.x+1.4*Math.cos(g)*f*(d/3+1),o.y+1.4*Math.sin(g)*f*(d/3+1)]},Mo.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),f=d?d.pfValue[0]:void 0,p=n,v=h;r&&(p=0,v=f);var g={x:a.x-s/2,y:a.y-l/2},y={x:o.x-u/2,y:o.y-c/2},m={x:Math.min(g.x,y.x),y:Math.min(g.y,y.y)},b=Math.max(.5,Math.log(.01*s)),x=Math.max(.5,Math.log(.01*u));i.ctrlpts=[m.x,m.y-(1+Math.pow(50,1.12)/100)*v*(p/3+1)*b,m.x-(1+Math.pow(50,1.12)/100)*v*(p/3+1)*x,m.y]},Mo.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},Mo.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,o=t.vectorNormInverse,s=t.posPts,l=t.intersectionPts,u=e.pstyle("edge-distances").value,c=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),d=e.pstyle("control-point-weights"),f=h&&d?Math.min(h.value.length,d.value.length):1,p=h?h.pfValue[0]:void 0,v=d.value[0],g=r;a.edgeType=g?"multibezier":"bezier",a.ctrlpts=[];for(var y=0;y<f;y++){var m=(.5-t.eles.length/2+n)*c*(i?-1:1),b=void 0,x=Ge(m);g&&(p=h?h.pfValue[y]:c,v=d.value[y]);var w=void 0!==(b=r?p:void 0!==p?x*p:void 0)?b:m,E=1-v,k=v,_="node-position"===u?s:l,C={x:_.x1*E+_.x2*k,y:_.y1*E+_.y2*k};a.ctrlpts.push(C.x+o.x*w,C.y+o.y*w)}},Mo.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r=t.posPts,i=t.srcW,a=t.srcH,o=t.tgtW,s=t.tgtH,l="node-position"!==e.pstyle("edge-distances").value,u=e.pstyle("taxi-direction").value,c=u,h=e.pstyle("taxi-turn"),d="%"===h.units,f=d&&h.pfValue<0?1+h.pfValue:h.pfValue,p=e.pstyle("taxi-turn-min-distance").pfValue,v=l?(i+o)/2:0,g=l?(a+s)/2:0,y=r.x2-r.x1,m=r.y2-r.y1,b=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},x=b(y,v),w=b(m,g),E=!1;"auto"===u?u=Math.abs(x)>Math.abs(w)?"horizontal":"vertical":"upward"===u||"downward"===u?(u="vertical",E=!0):"leftward"!==u&&"rightward"!==u||(u="horizontal",E=!0);var k="vertical"===u,_=k?w:x,C=k?m:y,S=Ge(C),P=!1;E&&d||!("downward"===c&&C<0||"upward"===c&&C>0||"leftward"===c&&C>0||"rightward"===c&&C<0)||(_=(S*=-1)*Math.abs(_),P=!0);var T=d?f*_:f*S,A=function(e){return Math.abs(e)<p||Math.abs(e)>=Math.abs(_)},D=A(T),M=A(_-Math.abs(T));if((D||M)&&!P)if(k){var O=Math.abs(C)<=a/2,B=Math.abs(y)<=o/2;if(O){var L=(r.x1+r.x2)/2,I=r.y1,N=r.y2;n.segpts=[L,I,L,N]}else if(B){var z=(r.y1+r.y2)/2,R=r.x1,j=r.x2;n.segpts=[R,z,j,z]}else n.segpts=[r.x1,r.y2]}else{var V=Math.abs(C)<=i/2,F=Math.abs(m)<=s/2;if(V){var q=(r.y1+r.y2)/2,X=r.x1,Y=r.x2;n.segpts=[X,q,Y,q]}else if(F){var G=(r.x1+r.x2)/2,H=r.y1,W=r.y2;n.segpts=[G,H,G,W]}else n.segpts=[r.x2,r.y1]}else if(k){var U=(T<0?r.y2:r.y1)+T+(l?a/2*S:0),K=r.x1,Z=r.x2;n.segpts=[K,U,Z,U]}else{var $=(T<0?r.x2:r.x1)+T+(l?i/2*S:0),Q=r.y1,J=r.y2;n.segpts=[$,Q,$,J]}},Mo.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=!k(n.startX)||!k(n.startY),d=!k(n.arrowStartX)||!k(n.arrowStartY),f=!k(n.endX)||!k(n.endY),p=!k(n.arrowEndX)||!k(n.arrowEndY),v=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),g=He({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),y=g<v,m=He({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),b=m<v,x=!1;if(h||d||y){x=!0;var w={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},E=Math.sqrt(w.x*w.x+w.y*w.y),_={x:w.x/E,y:w.y/E},C=Math.max(a,o),S={x:n.ctrlpts[0]+2*_.x*C,y:n.ctrlpts[1]+2*_.y*C},P=u.intersectLine(r.x,r.y,a,o,S.x,S.y,0);y?(n.ctrlpts[0]=n.ctrlpts[0]+_.x*(v-g),n.ctrlpts[1]=n.ctrlpts[1]+_.y*(v-g)):(n.ctrlpts[0]=P[0]+_.x*v,n.ctrlpts[1]=P[1]+_.y*v)}if(f||p||b){x=!0;var T={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},A=Math.sqrt(T.x*T.x+T.y*T.y),D={x:T.x/A,y:T.y/A},M=Math.max(a,o),O={x:n.ctrlpts[0]+2*D.x*M,y:n.ctrlpts[1]+2*D.y*M},B=c.intersectLine(i.x,i.y,s,l,O.x,O.y,0);b?(n.ctrlpts[0]=n.ctrlpts[0]+D.x*(v-m),n.ctrlpts[1]=n.ctrlpts[1]+D.y*(v-m)):(n.ctrlpts[0]=B[0]+D.x*v,n.ctrlpts[1]=B[1]+D.y*v)}x&&this.findEndpoints(e)}},Mo.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);var r;t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,.5,t.midX=Ke(t.allpts[r],t.allpts[r+2],t.allpts[r+4],.5),t.midY=Ke(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],.5))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType)if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.segpts.length%4==0){var i=t.segpts.length/2,a=i-2;t.midX=(t.segpts[a]+t.segpts[i])/2,t.midY=(t.segpts[a+1]+t.segpts[i+1])/2}else{var o=t.segpts.length/2-1;t.midX=t.segpts[o],t.midY=t.segpts[o+1]}},Mo.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||k(t.startX)&&k(t.startY)&&k(t.endX)&&k(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,he("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw.  Adjust your edge style (e.g. control points) accordingly or use an alternative edge type.  This is expected behaviour when the source node and the target node overlap."))},Mo.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),i={map:new we,get:function(e){var t=this.map.get(e[0]);return null!=t?t.get(e[1]):null},set:function(e,t){var n=this.map.get(e[0]);null==n&&(n=new we,this.map.set(e[0],n)),n.set(e[1],t)}},a=[],o=[],s=0;s<e.length;s++){var l=e[s],u=l._private,c=l.pstyle("curve-style").value;if(!l.removed()&&l.takesUpSpace())if("haystack"!==c){var h="unbundled-bezier"===c||"segments"===c||"straight"===c||"taxi"===c,d="unbundled-bezier"===c||"bezier"===c,f=u.source,p=u.target,v=[f.poolIndex(),p.poolIndex()].sort(),g=i.get(v);null==g&&(g={eles:[]},i.set(v,g),a.push(v)),g.eles.push(l),h&&(g.hasUnbundled=!0),d&&(g.hasBezier=!0)}else o.push(l)}for(var y=function(e){var o=a[e],s=i.get(o),l=void 0;if(!s.hasUnbundled){var u=s.eles[0].parallelEdges().filter((function(e){return e.isBundledBezier()}));me(s.eles),u.forEach((function(e){return s.eles.push(e)})),s.eles.sort((function(e,t){return e.poolIndex()-t.poolIndex()}))}var c=s.eles[0],h=c.source(),d=c.target();if(h.poolIndex()>d.poolIndex()){var f=h;h=d,d=f}var p=s.srcPos=h.position(),v=s.tgtPos=d.position(),g=s.srcW=h.outerWidth(),y=s.srcH=h.outerHeight(),m=s.tgtW=d.outerWidth(),b=s.tgtH=d.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(h)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(d)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var E=0;E<s.eles.length;E++){var _=s.eles[E],C=_[0]._private.rscratch,S=_.pstyle("curve-style").value,P="unbundled-bezier"===S||"segments"===S||"taxi"===S,T=!h.same(_.source());if(!s.calculatedIntersection&&h!==d&&(s.hasBezier||s.hasUnbundled)){s.calculatedIntersection=!0;var A=x.intersectLine(p.x,p.y,g,y,v.x,v.y,0),D=s.srcIntn=A,M=w.intersectLine(v.x,v.y,m,b,p.x,p.y,0),O=s.tgtIntn=M,B=s.intersectionPts={x1:A[0],x2:M[0],y1:A[1],y2:M[1]},L=s.posPts={x1:p.x,x2:v.x,y1:p.y,y2:v.y},I=M[1]-A[1],N=M[0]-A[0],z=Math.sqrt(N*N+I*I),R=s.vector={x:N,y:I},j=s.vectorNorm={x:R.x/z,y:R.y/z},V={x:-j.y,y:j.x};s.nodesOverlap=!k(z)||w.checkPoint(A[0],A[1],0,m,b,v.x,v.y)||x.checkPoint(M[0],M[1],0,g,y,p.x,p.y),s.vectorNormInverse=V,l={nodesOverlap:s.nodesOverlap,dirCounts:s.dirCounts,calculatedIntersection:!0,hasBezier:s.hasBezier,hasUnbundled:s.hasUnbundled,eles:s.eles,srcPos:v,tgtPos:p,srcW:m,srcH:b,tgtW:g,tgtH:y,srcIntn:O,tgtIntn:D,srcShape:w,tgtShape:x,posPts:{x1:L.x2,y1:L.y2,x2:L.x1,y2:L.y1},intersectionPts:{x1:B.x2,y1:B.y2,x2:B.x1,y2:B.y1},vector:{x:-R.x,y:-R.y},vectorNorm:{x:-j.x,y:-j.y},vectorNormInverse:{x:-V.x,y:-V.y}}}var F=T?l:s;C.nodesOverlap=F.nodesOverlap,C.srcIntn=F.srcIntn,C.tgtIntn=F.tgtIntn,r&&(h.isParent()||h.isChild()||d.isParent()||d.isChild())&&(h.parents().anySame(d)||d.parents().anySame(h)||h.same(d)&&h.isParent())?t.findCompoundLoopPoints(_,F,E,P):h===d?t.findLoopPoints(_,F,E,P):"segments"===S?t.findSegmentsPoints(_,F):"taxi"===S?t.findTaxiPoints(_,F):"straight"===S||!P&&s.eles.length%2==1&&E===Math.floor(s.eles.length/2)?t.findStraightEdgePoints(_):t.findBezierPoints(_,F,E,P,T),t.findEndpoints(_),t.tryToCorrectInvalidPoints(_,F),t.checkForInvalidEdgeWarning(_),t.storeAllpts(_),t.storeEdgeProjections(_),t.calculateArrowAngles(_),t.recalculateEdgeLabelProjections(_),t.calculateLabelAngles(_)}},m=0;m<a.length;m++)y(m);this.findHaystackPoints(o)}},Mo.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if("segments"===t.edgeType)return this.recalculateRenderedStyle(e),Oo(t.segpts)},Mo.getControlPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return this.recalculateRenderedStyle(e),Oo(t.ctrlpts)},Mo.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var Bo={manualEndptToPx:function(e,t){var n=e.position(),r=e.outerWidth(),i=e.outerHeight();if(2===t.value.length){var a=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(a[0]=a[0]*r),"%"===t.units[1]&&(a[1]=a[1]*i),a[0]+=n.x,a[1]+=n.y,a}var o=t.pfValue[0];o=-Math.PI/2+o;var s=2*Math.max(r,i),l=[n.x+Math.cos(o)*s,n.y+Math.sin(o)*s];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,r,i,l[0],l[1],0)},findEndpoints:function(e){var t,n,r,i,a,o=this,s=e.source()[0],l=e.target()[0],u=s.position(),c=l.position(),h=e.pstyle("target-arrow-shape").value,d=e.pstyle("source-arrow-shape").value,f=e.pstyle("target-distance-from-node").pfValue,p=e.pstyle("source-distance-from-node").pfValue,v=e.pstyle("curve-style").value,g=e._private.rscratch,y=g.edgeType,m="self"===y||"compound"===y,b="bezier"===y||"multibezier"===y||m,x="bezier"!==y,w="straight"===y||"segments"===y,E="segments"===y,_=b||x||w,C=m||"taxi"===v,S=e.pstyle("source-endpoint"),P=C?"outside-to-node":S.value,T=e.pstyle("target-endpoint"),A=C?"outside-to-node":T.value;if(g.srcManEndpt=S,g.tgtManEndpt=T,b){var D=[g.ctrlpts[0],g.ctrlpts[1]];n=x?[g.ctrlpts[g.ctrlpts.length-2],g.ctrlpts[g.ctrlpts.length-1]]:D,r=D}else if(w){var M=E?g.segpts.slice(0,2):[c.x,c.y];n=E?g.segpts.slice(g.segpts.length-2):[u.x,u.y],r=M}if("inside-to-node"===A)t=[c.x,c.y];else if(T.units)t=this.manualEndptToPx(l,T);else if("outside-to-line"===A)t=g.tgtIntn;else if("outside-to-node"===A||"outside-to-node-or-label"===A?i=n:"outside-to-line"!==A&&"outside-to-line-or-label"!==A||(i=[u.x,u.y]),t=o.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),i[0],i[1],0),"outside-to-node-or-label"===A||"outside-to-line-or-label"===A){var O=l._private.rscratch,B=O.labelWidth,L=O.labelHeight,I=O.labelX,N=O.labelY,z=B/2,R=L/2,j=l.pstyle("text-valign").value;"top"===j?N-=R:"bottom"===j&&(N+=R);var V=l.pstyle("text-halign").value;"left"===V?I-=z:"right"===V&&(I+=z);var F=xt(i[0],i[1],[I-z,N-R,I+z,N-R,I+z,N+R,I-z,N+R],c.x,c.y);if(F.length>0){var q=u,X=We(q,qe(t)),Y=We(q,qe(F)),G=X;if(Y<X&&(t=F,G=Y),F.length>2)We(q,{x:F[2],y:F[3]})<G&&(t=[F[2],F[3]])}}var H=wt(t,n,o.arrowShapes[h].spacing(e)+f),W=wt(t,n,o.arrowShapes[h].gap(e)+f);if(g.endX=W[0],g.endY=W[1],g.arrowEndX=H[0],g.arrowEndY=H[1],"inside-to-node"===P)t=[u.x,u.y];else if(S.units)t=this.manualEndptToPx(s,S);else if("outside-to-line"===P)t=g.srcIntn;else if("outside-to-node"===P||"outside-to-node-or-label"===P?a=r:"outside-to-line"!==P&&"outside-to-line-or-label"!==P||(a=[c.x,c.y]),t=o.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),a[0],a[1],0),"outside-to-node-or-label"===P||"outside-to-line-or-label"===P){var U=s._private.rscratch,K=U.labelWidth,Z=U.labelHeight,$=U.labelX,Q=U.labelY,J=K/2,ee=Z/2,te=s.pstyle("text-valign").value;"top"===te?Q-=ee:"bottom"===te&&(Q+=ee);var ne=s.pstyle("text-halign").value;"left"===ne?$-=J:"right"===ne&&($+=J);var re=xt(a[0],a[1],[$-J,Q-ee,$+J,Q-ee,$+J,Q+ee,$-J,Q+ee],u.x,u.y);if(re.length>0){var ie=c,ae=We(ie,qe(t)),oe=We(ie,qe(re)),se=ae;if(oe<ae&&(t=[re[0],re[1]],se=oe),re.length>2)We(ie,{x:re[2],y:re[3]})<se&&(t=[re[2],re[3]])}}var le=wt(t,r,o.arrowShapes[d].spacing(e)+p),ue=wt(t,r,o.arrowShapes[d].gap(e)+p);g.startX=ue[0],g.startY=ue[1],g.arrowStartX=le[0],g.arrowStartY=le[1],_&&(k(g.startX)&&k(g.startY)&&k(g.endX)&&k(g.endY)?g.badLine=!1:g.badLine=!0)},getSourceEndpoint:function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},getTargetEndpoint:function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}}},Lo={};function Io(e,t,n){for(var r=function(e,t,n,r){return Ke(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}Lo.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)Io(this,e,n.allpts.slice(i,i+6))}else if("segments"===r){var a=t.rstyle.linePts=[];for(i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]})}else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},Lo.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var No={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!D(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,h=i.rscratch,d=i.rstyle;switch(u){case"left":n=l.x-a/2-s;break;case"right":n=l.x+a/2+s;break;default:n=l.x}switch(c){case"top":r=l.y-o/2-s;break;case"bottom":r=l.y+o/2+s;break;default:r=l.y}h.labelX=n,h.labelY=r,d.labelX=n,d.labelY=r,this.applyLabelDimensions(e)}}},zo=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},Ro=function(e,t){var n=t.x-e.x,r=t.y-e.y;return zo(n,r)};No.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){xe(n.rscratch,e,t,r),xe(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y);var s=zo(r.midDispX,r.midDispY);o("labelAutoAngle",null,s);var l=function(s){var l,u="source"===s;if(a[s]){var c=e.pstyle(s+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var h,d=function e(){if(e.cache)return e.cache;for(var t=[],a=0;a+5<r.allpts.length;a+=4){var o={x:r.allpts[a],y:r.allpts[a+1]},s={x:r.allpts[a+2],y:r.allpts[a+3]},l={x:r.allpts[a+4],y:r.allpts[a+5]};t.push({p0:o,p1:s,p2:l,startDist:0,length:0,segments:[]})}var u=n.rstyle.bezierPts,c=i.bezierProjPcts.length;function h(e,t,n,r,i){var a=He(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var d=0;d<t.length;d++){var f=t[d],p=t[d-1];p&&(f.startDist=p.startDist+p.length),h(f,f.p0,u[d*c],0,i.bezierProjPcts[0]);for(var v=0;v<c-1;v++)h(f,u[d*c+v],u[d*c+v+1],i.bezierProjPcts[v],i.bezierProjPcts[v+1]);h(f,u[d*c+c-1],f.p2,i.bezierProjPcts[c-1],1)}return e.cache=t}(),f=0,p=0,v=0;v<d.length;v++){for(var g=d[u?v:d.length-1-v],y=0;y<g.segments.length;y++){var m=g.segments[u?y:g.segments.length-1-y],b=v===d.length-1&&y===g.segments.length-1;if(f=p,(p+=m.length)>=c||b){h={cp:g,segment:m};break}}if(h)break}var x=h.cp,w=h.segment,E=(c-f)/w.length,k=w.t1-w.t0,_=u?w.t0+k*E:w.t1-k*E;_=$e(0,_,1),t=Ze(x.p0,x.p1,x.p2,_),l=function(e,t,n,r){var i=$e(0,r-.001,1),a=$e(0,r+.001,1),o=Ze(e,t,n,i),s=Ze(e,t,n,a);return Ro(o,s)}(x.p0,x.p1,x.p2,_);break;case"straight":case"segments":case"haystack":for(var C,S,P,T,A=0,D=r.allpts.length,M=0;M+3<D&&(u?(P={x:r.allpts[M],y:r.allpts[M+1]},T={x:r.allpts[M+2],y:r.allpts[M+3]}):(P={x:r.allpts[D-2-M],y:r.allpts[D-1-M]},T={x:r.allpts[D-4-M],y:r.allpts[D-3-M]}),S=A,!((A+=C=He(P,T))>=c));M+=2);var O=(c-S)/C;O=$e(0,O,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=He(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(P,T,O),l=Ro(P,T)}o("labelX",s,t.x),o("labelY",s,t.y),o("labelAutoAngle",s,l)}};l("source"),l("target"),this.applyLabelDimensions(e)}},No.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},No.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=be(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,h=i.width,d=i.height+(l-1)*(a-1)*u;xe(n.rstyle,"labelWidth",t,h),xe(n.rscratch,"labelWidth",t,h),xe(n.rstyle,"labelHeight",t,d),xe(n.rscratch,"labelHeight",t,d),xe(n.rscratch,"labelLineHeight",t,c)},No.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(xe(n.rscratch,e,t,r),r):be(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=i.split("\n"),c=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,d=[],f=/[\s\u200b]+/,p=h?"":" ",v=0;v<u.length;v++){var g=u[v],y=this.calculateLabelDimensions(e,g).width;if(h){var m=g.split("").join("​");g=m}if(y>c){for(var b=g.split(f),x="",w=0;w<b.length;w++){var E=b[w],k=0===x.length?E:x+p+E;this.calculateLabelDimensions(e,k).width<=c?x+=E+p:(x&&d.push(x),x=E+p)}x.match(/^[\s\u200b]+$/)||d.push(x)}else d.push(g)}o("labelWrapCachedLines",d),i=o("labelWrapCachedText",d.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){for(var _=e.pstyle("text-max-width").pfValue,C="",S=!1,P=0;P<i.length;P++){if(this.calculateLabelDimensions(e,C+i[P]+"…").width>_)break;C+=i[P],P===i.length-1&&(S=!0)}return S||(C+="…"),C}return i},No.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},No.calculateLabelDimensions=function(e,t){var n=Q(t,e._private.labelDimsKey),r=this.labelDimCache||(this.labelDimCache=[]),i=r[n];if(null!=i)return i;var a=e.pstyle("font-style").strValue,o=1*e.pstyle("font-size").pfValue+"px",s=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,u=this.labelCalcDiv;u||(u=this.labelCalcDiv=document.createElement("div"),document.body.appendChild(u));var c=u.style;return c.fontFamily=s,c.fontStyle=a,c.fontSize=o,c.fontWeight=l,c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none",c.padding="0",c.lineHeight="1",c.whiteSpace="pre",u.textContent=t,r[n]={width:Math.ceil(u.clientWidth/1),height:Math.ceil(u.clientHeight/1)}},No.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=t?t+"-":"",a=e.pstyle(i+"text-rotation"),o=a.strValue;return"none"===o?0:r&&"autorotate"===o?n.labelAutoAngle:"autorotate"===o?0:a.pfValue},No.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,"source"),r.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var jo={},Vo=!1;jo.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(e.width()<28||e.height()<28))return Vo||(he("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Vo=!0),"rectangle";if(e.isParent())return"rectangle"===t||"roundrectangle"===t||"cutrectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var Fo={registerCalculationListeners:function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){var i=e[r],a=i._private,o=a.rstyle;o.clean=!1,o.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",(function(e){var t=e.target;r(t)})).on("style.* background.*",(function(e){var t=e.target;r(t,!1)}));var i=function(i){if(i){for(var a=n.onUpdateEleCalcsFns,o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(r(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var u=0;u<a.length;u++){(0,a[u])(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},recalculateRenderedStyle:function(e,t){var n=function(e){return e._private.rstyle.cleanConnected},r=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?i.push(o):r.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private.rstyle,d=c.position();this.recalculateNodeLabelProjection(c),h.nodeX=d.x,h.nodeY=d.y,h.nodeW=c.pstyle("width").pfValue,h.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var f=0;f<r.length;f++){var p=r[f]._private,v=p.rstyle,g=p.rscratch;v.srcX=g.arrowStartX,v.srcY=g.arrowStartY,v.tgtX=g.arrowEndX,v.tgtY=g.arrowEndY,v.midX=g.midX,v.midY=g.midY,v.labelAngle=g.labelAngle,v.sourceLabelAngle=g.sourceLabelAngle,v.targetLabelAngle=g.targetLabelAngle}}}},qo={updateCachedGrabbedEles:function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=(i=e[n])._private.rscratch;i.grabbed()&&!i.isParent()?t.push(i):r.inDragLayer?e.drag.push(i):e.nondrag.push(i)}for(n=0;n<t.length;n++){var i=t[n];e.drag.push(i)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Ai),t.interactive=t.filter((function(e){return e.interactive()})),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t}},Xo={};[Ao,Do,Mo,Bo,Lo,No,jo,Fo,qo].forEach((function(e){j(Xo,e)}));var Yo={getCachedImage:function(e,t,n){var r=this.imageCache=this.imageCache||{},i=r[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;var a=(i=r[e]=r[e]||{}).image=new Image;a.addEventListener("load",n),a.addEventListener("error",(function(){a.error=!0}));return"data:"===e.substring(0,"data:".length).toLowerCase()||(a.crossOrigin=t),a.src=e,a}},Go={registerBinding:function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]),a=this.binder(e);return a.on.apply(a,i)}};Go.binder=function(e){var t,n=this,r=e===window||e===document||e===document.body||(t=e,"undefined"!=typeof HTMLElement&&t instanceof HTMLElement);if(null==n.supportsPassiveEvents){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});window.addEventListener("test",null,a)}catch(e){}n.supportsPassiveEvents=i}var o=function(t,i,a){var o=Array.prototype.slice.call(arguments);return r&&n.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),n.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},Go.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},Go.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},Go.load=function(){var e=this,t=function(e){return e.selected()},n=function(t,n,r,i){null==t&&(t=e.cy);for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},r=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},a=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable())for(var i=0;n&&i<n.length;i++){if((t=n[i]).isNode()&&t.isParent()){r=!1;break}}else r=!0;return r},o=function(e){e[0]._private.rscratch.inDragLayer=!0},s=function(e){e[0]._private.rscratch.isGrabTarget=!0},l=function(e,t){var n=t.addToList;n.has(e)||(n.merge(e),function(e){e[0]._private.grabbed=!0}(e))},u=function(t,n){n=n||{};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(o),t.neighborhood().stdFilter((function(e){return!r||e.isEdge()})).forEach(o)),n.addToList&&t.forEach((function(e){l(e,n)})),function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(o),n.connectedEdges().forEach(o)),t.addToList&&t.addToList.unmerge(n)}}(t,n),d(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},c=u,h=function(t){t&&(e.getCachedZSortedEles().forEach((function(e){!function(e){e[0]._private.grabbed=!1}(e),function(e){e[0]._private.rscratch.inDragLayer=!1}(e),function(e){e[0]._private.rscratch.isGrabTarget=!1}(e)})),e.updateCachedGrabbedEles())},d=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(o),r.forEach(o)),t.addToList&&r.forEach((function(e){l(e,t)}))}}},f=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},p="undefined"!=typeof MutationObserver,v="undefined"!=typeof ResizeObserver;p?(e.removeObserver=new MutationObserver((function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r)for(var i=0;i<r.length;i++){if(r[i]===e.container){e.destroy();break}}}})),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",(function(t){e.destroy()}));var g=i((function(){e.cy.resize()}),100);p&&(e.styleObserver=new MutationObserver(g),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(window,"resize",g),v&&(e.resizeObserver=new ResizeObserver(g),e.resizeObserver.observe(e.container));var y=function(){e.invalidateContainerClientCoordsCache()};!function(e,t){for(;null!=e;)t(e),e=e.parentNode}(e.container,(function(t){e.registerBinding(t,"transitionend",y),e.registerBinding(t,"animationend",y),e.registerBinding(t,"scroll",y)})),e.registerBinding(e.container,"contextmenu",(function(e){e.preventDefault()}));var m=function(t){for(var n=e.findContainerClientCoords(),r=n[0],i=n[1],a=n[2],o=n[3],s=t.touches?t.touches:[t],l=!1,u=0;u<s.length;u++){var c=s[u];if(r<=c.clientX&&c.clientX<=r+a&&i<=c.clientY&&c.clientY<=i+o){l=!0;break}}if(!l)return!1;for(var h=e.container,d=t.target.parentNode,f=!1;d;){if(d===h){f=!0;break}d=d.parentNode}return!!f};e.registerBinding(e.container,"mousedown",(function(t){if(m(t)){t.preventDefault(),f(),e.hoverData.capture=!0,e.hoverData.which=t.which;var r=e.cy,i=[t.clientX,t.clientY],a=e.projectIntoViewport(i[0],i[1]),o=e.selection,l=e.findNearestElements(a[0],a[1],!0,!1),h=l[0],d=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=i;if(3==t.which){e.hoverData.cxtStarted=!0;var p={originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}};h?(h.activate(),h.emit(p),e.hoverData.down=h):r.emit(p),e.hoverData.downTime=(new Date).getTime(),e.hoverData.cxtDragged=!1}else if(1==t.which){if(h&&h.activate(),null!=h&&e.nodeIsGrabbable(h)){var v=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};if(s(h),h.selected()){d=e.dragData.possibleDragElements=r.collection();var g=r.$((function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)}));u(g,{addToList:d}),h.emit(v("grabon")),g.forEach((function(e){e.emit(v("grab"))}))}else d=e.dragData.possibleDragElements=r.collection(),c(h,{addToList:d}),h.emit(v("grabon")).emit(v("grab"));e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=h,e.hoverData.downs=l,e.hoverData.downTime=(new Date).getTime(),n(h,["mousedown","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==h?(o[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint("select",!0),e.redraw()):h.pannable()&&(o[4]=1),e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout((function(){if(!e.hoverData.tapholdCancelled){var n=e.hoverData.down;n?n.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}}):r.emit({originalEvent:t,type:"taphold",position:{x:a[0],y:a[1]}})}}),e.tapholdDuration)}o[0]=o[2]=a[0],o[1]=o[3]=a[1]}}),!1),e.registerBinding(window,"mousemove",(function(t){if(e.hoverData.capture||m(t)){var i=!1,o=e.cy,s=o.zoom(),l=[t.clientX,t.clientY],c=e.projectIntoViewport(l[0],l[1]),d=e.hoverData.mdownPos,f=e.hoverData.mdownGPos,p=e.selection,v=null;e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.selecting||(v=e.findNearestElement(c[0],c[1],!0,!1));var g,y=e.hoverData.last,b=e.hoverData.down,x=[c[0]-p[2],c[1]-p[3]],w=e.dragData.possibleDragElements;if(f){var E=l[0]-f[0],_=E*E,C=l[1]-f[1],S=_+C*C;e.hoverData.isOverThresholdDrag=g=S>=e.desktopTapThreshold2}var P=r(t);g&&(e.hoverData.tapholdCancelled=!0);i=!0,n(v,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(g){var A={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};b?b.emit(A):o.emit(A),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&v===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=v,v&&v.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(i=!0,o.panningEnabled()&&o.userPanningEnabled()){var D;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;D={x:(c[0]-M[0])*s,y:(c[1]-M[1])*s},e.hoverData.justStartedPan=!1}else D={x:x[0]*s,y:x[1]*s};o.panBy(D),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||v==y||(y&&n(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),v&&n(v,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=v),b)if(g){if(o.boxSelectionEnabled()&&P)b&&b.grabbed()&&(h(w),b.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(b.emit("dragfreeon"),w.emit("dragfree"))),T();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var O=!e.dragData.didDrag;O&&e.redrawHint("eles",!0),e.dragData.didDrag=!0;var B=o.collection();e.hoverData.draggingEles||u(w,{inDragLayer:!0});var L={x:0,y:0};if(k(x[0])&&k(x[1])&&(L.x+=x[0],L.y+=x[1],O)){var I=e.hoverData.dragDelta;I&&k(I[0])&&k(I[1])&&(L.x+=I[0],L.y+=I[1])}for(var N=0;N<w.length;N++){var z=w[N];e.nodeIsDraggable(z)&&z.grabbed()&&B.merge(z)}e.hoverData.draggingEles=!0,B.silentShift(L).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(x[0]),t.push(x[1])):(t[0]+=x[0],t[1]+=x[1])}();i=!0}else if(g){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!P&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){a(b,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=qe(d),e.redrawHint("select",!0),e.redraw())}}else T();b&&b.pannable()&&b.active()&&b.unactivate()}return p[2]=c[0],p[3]=c[1],i?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(window,"mouseup",(function(i){if(e.hoverData.capture){e.hoverData.capture=!1;var a=e.cy,o=e.projectIntoViewport(i.clientX,i.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,d=r(i);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var f={originalEvent:i,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(f):a.emit(f),!e.hoverData.cxtDragged){var p={originalEvent:i,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(p):a.emit(p)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(n(l,["mouseup","tapend","vmouseup"],i,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||n(c,["click","tap","vclick"],i,{x:o[0],y:o[1]}),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||r(i)||(a.$(t).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||d?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):d||(a.$(t).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var v=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),v.length>0&&e.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:i,position:{x:o[0],y:o[1]}});var g=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||d||a.$(t).unmerge(v).unselect(),v.emit("box").stdFilter(g).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var y=c&&c.grabbed();h(u),y&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[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 b,x,w,E,_,C,S,P,T,A,D,M,O;e.registerBinding(e.container,"wheel",(function(t){if(!e.scrollingPage){var n,r=e.cy,i=e.projectIntoViewport(t.clientX,t.clientY),a=[i[0]*r.zoom()+r.pan().x,i[1]*r.zoom()+r.pan().y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(r.panningEnabled()&&r.userPanningEnabled()&&r.zoomingEnabled()&&r.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),n=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,n*=e.wheelSensitivity,1===t.deltaMode&&(n*=33),r.zoom({level:r.zoom()*Math.pow(10,n),renderedPosition:{x:a[0],y:a[1]}})}}),!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 B,L,I,N,z=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},R=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",B=function(t){if(m(t)){f(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var r=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=o[0],i[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,h(e.dragData.touchDragEles);var l=e.findContainerClientCoords();T=l[0],A=l[1],D=l[2],M=l[3],b=t.touches[0].clientX-T,x=t.touches[0].clientY-A,w=t.touches[1].clientX-T,E=t.touches[1].clientY-A,O=0<=b&&b<=D&&0<=w&&w<=D&&0<=x&&x<=M&&0<=E&&E<=M;var d=r.pan(),p=r.zoom();_=z(b,x,w,E),C=R(b,x,w,E),P=[((S=[(b+w)/2,(x+E)/2])[0]-d.x)/p,(S[1]-d.y)/p];if(C<4e4&&!t.touches[2]){var v=e.findNearestElement(i[0],i[1],!0,!0),g=e.findNearestElement(i[2],i[3],!0,!0);return v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=v):g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}}),e.touchData.start=g):r.emit({originalEvent:t,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(t.touches[2])r.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(i[0],i[1],!0,!0),k=y[0];if(null!=k&&(k.activate(),e.touchData.start=k,e.touchData.starts=y,e.nodeIsGrabbable(k))){var B=e.dragData.touchDragEles=r.collection(),L=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),k.selected()?(L=r.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),u(L,{addToList:B})):c(k,{addToList:B}),s(k);var I=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};k.emit(I("grabon")),L?L.forEach((function(e){e.emit(I("grab"))})):k.emit(I("grab"))}n(k,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==k&&(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||n(e.touchData.start,["taphold"],t,{x:i[0],y:i[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var N=e.touchData.startPosition=[],j=0;j<i.length;j++)N[j]=a[j]=i[j];var V=t.touches[0];e.touchData.startGPosition=[V.clientX,V.clientY]}}},!1),e.registerBinding(window,"touchmove",L=function(t){var r=e.touchData.capture;if(r||m(t)){var i=e.selection,o=e.cy,s=e.touchData.now,l=e.touchData.earlier,c=o.zoom();if(t.touches[0]){var d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=d[0],s[1]=d[1]}if(t.touches[1]){d=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=d[0],s[3]=d[1]}if(t.touches[2]){d=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=d[0],s[5]=d[1]}var f,p=e.touchData.startGPosition;if(r&&t.touches[0]&&p){for(var v=[],g=0;g<s.length;g++)v[g]=s[g]-l[g];var y=t.touches[0].clientX-p[0],S=y*y,D=t.touches[0].clientY-p[1];f=S+D*D>=e.touchTapThreshold2}if(r&&e.touchData.cxt){t.preventDefault();var M=t.touches[0].clientX-T,B=t.touches[0].clientY-A,L=t.touches[1].clientX-T,I=t.touches[1].clientY-A,N=R(M,B,L,I);if(N/C>=2.25||N>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var j={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(j),e.touchData.start=null):o.emit(j)}}if(r&&e.touchData.cxt){j={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(j):o.emit(j),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var V=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&V===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=V,V&&V.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(r&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(s[0]+s[2]+s[4])/3,i[3]=(s[1]+s[3]+s[5])/3):(i[0]=(s[0]+s[2]+s[4])/3,i[1]=(s[1]+s[3]+s[5])/3,i[2]=(s[0]+s[2]+s[4])/3+1,i[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(r&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var F=0;F<ee.length;F++){var q=ee[F]._private;q.grabbed=!1,q.rscratch.inDragLayer=!1}}var X=e.touchData.start,Y=(M=t.touches[0].clientX-T,B=t.touches[0].clientY-A,L=t.touches[1].clientX-T,I=t.touches[1].clientY-A,z(M,B,L,I)),G=Y/_;if(O){var H=(M-b+(L-w))/2,W=(B-x+(I-E))/2,U=o.zoom(),K=U*G,Z=o.pan(),$=P[0]*U+Z.x,Q=P[1]*U+Z.y,J={x:-K/U*($-Z.x-H)+$,y:-K/U*(Q-Z.y-W)+Q};if(X&&X.active()){var ee=e.dragData.touchDragEles;h(ee),e.redrawHint("drag",!0),e.redrawHint("eles",!0),X.unactivate().emit("freeon"),ee.emit("free"),e.dragData.didDrag&&(X.emit("dragfreeon"),ee.emit("dragfree"))}o.viewport({zoom:K,pan:J,cancelOnFailedZoom:!0}),_=Y,b=M,x=B,w=L,E=I,e.pinching=!0}if(t.touches[0]){d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=d[0],s[1]=d[1]}if(t.touches[1]){d=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=d[0],s[3]=d[1]}if(t.touches[2]){d=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=d[0],s[5]=d[1]}}else if(t.touches[0]&&!e.touchData.didSelect){var te=e.touchData.start,ne=e.touchData.last;if(e.hoverData.draggingEles||e.swipePanning||(V=e.findNearestElement(s[0],s[1],!0,!0)),r&&null!=te&&t.preventDefault(),r&&null!=te&&e.nodeIsDraggable(te))if(f){ee=e.dragData.touchDragEles;var re=!e.dragData.didDrag;re&&u(ee,{inDragLayer:!0}),e.dragData.didDrag=!0;var ie={x:0,y:0};if(k(v[0])&&k(v[1]))if(ie.x+=v[0],ie.y+=v[1],re)e.redrawHint("eles",!0),(ae=e.touchData.dragDelta)&&k(ae[0])&&k(ae[1])&&(ie.x+=ae[0],ie.y+=ae[1]);e.hoverData.draggingEles=!0,ee.silentShift(ie).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==l[0]&&e.touchData.startPosition[1]==l[1]&&e.redrawHint("eles",!0),e.redraw()}else{var ae;0===(ae=e.touchData.dragDelta=e.touchData.dragDelta||[]).length?(ae.push(v[0]),ae.push(v[1])):(ae[0]+=v[0],ae[1]+=v[1])}if(n(te||V,["touchmove","tapdrag","vmousemove"],t,{x:s[0],y:s[1]}),te&&te.grabbed()||V==ne||(ne&&ne.emit({originalEvent:t,type:"tapdragout",position:{x:s[0],y:s[1]}}),V&&V.emit({originalEvent:t,type:"tapdragover",position:{x:s[0],y:s[1]}})),e.touchData.last=V,r)for(F=0;F<s.length;F++)s[F]&&e.touchData.startPosition[F]&&f&&(e.touchData.singleTouchMoved=!0);if(r&&(null==te||te.pannable())&&o.panningEnabled()&&o.userPanningEnabled()){a(te,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=qe(e.touchData.startPosition)),e.swipePanning?o.panBy({x:v[0]*c,y:v[1]*c}):f&&(e.swipePanning=!0,o.panBy({x:y*c,y:D*c}),te&&(te.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=d[0],s[1]=d[1]}}for(g=0;g<s.length;g++)l[g]=s[g];r&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(window,"touchcancel",I=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(window,"touchend",N=function(r){var i=e.touchData.start;if(e.touchData.capture){0===r.touches.length&&(e.touchData.capture=!1),r.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(r.touches[0]){var d=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);u[0]=d[0],u[1]=d[1]}if(r.touches[1]){d=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);u[2]=d[0],u[3]=d[1]}if(r.touches[2]){d=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);u[4]=d[0],u[5]=d[1]}if(i&&i.unactivate(),e.touchData.cxt){if(o={originalEvent:r,type:"cxttapend",position:{x:u[0],y:u[1]}},i?i.emit(o):s.emit(o),!e.touchData.cxtDragged){var f={originalEvent:r,type:"cxttap",position:{x:u[0],y:u[1]}};i?i.emit(f):s.emit(f)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!r.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var p=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:r,position:{x:u[0],y:u[1]}});p.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),p.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.unactivate(),r.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(r.touches[1]);else if(r.touches[0]);else if(!r.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var v=e.dragData.touchDragEles;if(null!=i){var g=i._private.grabbed;h(v),e.redrawHint("drag",!0),e.redrawHint("eles",!0),g&&(i.emit("freeon"),v.emit("free"),e.dragData.didDrag&&(i.emit("dragfreeon"),v.emit("dragfree"))),n(i,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]}),i.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);n(y,["touchend","tapend","vmouseup","tapdragout"],r,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(i||s.$(":selected").unselect(["tapunselect"]),n(i,["tap","vclick"],r,{x:u[0],y:u[1]})),null!=i&&!e.dragData.didDrag&&i._private.selectable&&w<e.touchTapThreshold2&&!e.pinching&&("single"===s.selectionType()?(s.$(t).unmerge(i).unselect(["tapunselect"]),i.select(["tapselect"])):i.selected()?i.unselect(["tapunselect"]):i.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var E=0;E<u.length;E++)c[E]=u[E];e.dragData.didDrag=!1,0===r.touches.length&&(e.touchData.dragDelta=[],e.touchData.startPosition=null,e.touchData.startGPosition=null,e.touchData.didSelect=!1),r.touches.length<2&&(1===r.touches.length&&(e.touchData.startGPosition=[r.touches[0].clientX,r.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())}},!1),"undefined"==typeof TouchEvent){var j=[],V=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},F=function(e){j.push(function(e){return{event:e,touch:V(e)}}(e))},q=function(e){for(var t=0;t<j.length;t++){if(j[t].event.pointerId===e.pointerId)return void j.splice(t,1)}},X=function(e){e.touches=j.map((function(e){return e.touch}))},Y=function(e){return"mouse"===e.pointerType||4===e.pointerType};e.registerBinding(e.container,"pointerdown",(function(e){Y(e)||(e.preventDefault(),F(e),X(e),B(e))})),e.registerBinding(e.container,"pointerup",(function(e){Y(e)||(q(e),X(e),N(e))})),e.registerBinding(e.container,"pointercancel",(function(e){Y(e)||(q(e),X(e),I())})),e.registerBinding(e.container,"pointermove",(function(e){Y(e)||(e.preventDefault(),function(e){var t=j.filter((function(t){return t.event.pointerId===e.pointerId}))[0];t.event=e,t.touch=V(e)}(e),X(e),L(e))}))}};var Ho={generatePolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o){return xt(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o){return ft(e,t,this.points,a,o,r,i,[0,-1],n)}}}};Ho.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){return function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;var l=Math.sqrt(o*o+s*s),u=l-1;if(u<0)return[];var c=u/l;return[(n-e)*c+e,(r-t)*c+t]}(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o){return gt(e,t,r,i,a,o,n)}}},Ho.generateRoundPolygon=function(e,t){for(var n=new Array(2*t.length),r=0;r<t.length/2;r++){var i=2*r,a=void 0;a=r<t.length/2-1?2*(r+1):0,n[4*r]=t[i],n[4*r+1]=t[i+1];var o=t[a]-t[i],s=t[a+1]-t[i+1],l=Math.sqrt(o*o+s*s);n[4*r+2]=o/l,n[4*r+3]=s/l}return this.nodeShapes[e]={renderer:this,name:e,points:n,draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o){return function(e,t,n,r,i,a,o,s){for(var l,u=[],c=new Array(n.length),h=a/2,d=o/2,f=St(a,o),p=0;p<n.length/4;p++){var v,g=void 0;g=0===p?n.length-2:4*p-2,v=4*p+2;var y=r+h*n[4*p],m=i+d*n[4*p+1],b=-n[g]*n[v]-n[g+1]*n[v+1],x=f/Math.tan(Math.acos(b)/2),w=y-x*n[g],E=m-x*n[g+1],k=y+x*n[v],_=m+x*n[v+1];0===p?(c[n.length-2]=w,c[n.length-1]=E):(c[4*p-2]=w,c[4*p-1]=E),c[4*p]=k,c[4*p+1]=_;var C=n[g+1],S=-n[g];C*n[v]+S*n[v+1]<0&&(C*=-1,S*=-1),0!==(l=yt(e,t,r,i,w+C*f,E+S*f,f)).length&&u.push(l[0],l[1])}for(var P=0;P<c.length/4;P++)0!==(l=bt(e,t,r,i,c[4*P],c[4*P+1],c[4*P+2],c[4*P+3],!1)).length&&u.push(l[0],l[1]);if(u.length>2){for(var T=[u[0],u[1]],A=Math.pow(T[0]-e,2)+Math.pow(T[1]-t,2),D=1;D<u.length/2;D++){var M=Math.pow(u[2*D]-e,2)+Math.pow(u[2*D+1]-t,2);M<=A&&(T[0]=u[2*D],T[1]=u[2*D+1],A=M)}return T}return u}(i,a,this.points,e,t,n,r)},checkPoint:function(e,t,n,r,i,a,o){return function(e,t,n,r,i,a,o){for(var s=new Array(n.length),l=a/2,u=o/2,c=St(a,o),h=c*c,d=0;d<n.length/4;d++){var f,p=void 0;p=0===d?n.length-2:4*d-2,f=4*d+2;var v=r+l*n[4*d],g=i+u*n[4*d+1],y=-n[p]*n[f]-n[p+1]*n[f+1],m=c/Math.tan(Math.acos(y)/2),b=v-m*n[p],x=g-m*n[p+1],w=v+m*n[f],E=g+m*n[f+1];s[4*d]=b,s[4*d+1]=x,s[4*d+2]=w,s[4*d+3]=E;var k=n[p+1],_=-n[p];k*n[f]+_*n[f+1]<0&&(k*=-1,_*=-1);var C=b+k*c,S=x+_*c;if(Math.pow(C-e,2)+Math.pow(S-t,2)<=h)return!0}return dt(e,t,s)}(e,t,this.points,a,o,r,i)}}},Ho.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:Et(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){return st(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=Ct(r,i),l=2*s;return!!ft(e,t,this.points,a,o,r,i-l,[0,-1],n)||(!!ft(e,t,this.points,a,o,r-l,i,[0,-1],n)||(!!gt(e,t,l,l,a-r/2+s,o-i/2+s,n)||(!!gt(e,t,l,l,a+r/2-s,o-i/2+s,n)||(!!gt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!gt(e,t,l,l,a-r/2+s,o+i/2-s,n)))))}}},Ho.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:8,points:Et(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},generateCutTrianglePts:function(e,t,n,r){var i=this.cornerLength,a=t/2,o=e/2,s=n-o,l=n+o,u=r-a,c=r+a;return{topLeft:[s,u+i,s+i,u,s+i,u+i],topRight:[l-i,u,l,u+i,l-i,u+i],bottomRight:[l,c-i,l-i,c,l-i,c-i],bottomLeft:[s+i,c,s,c-i,s+i,c-i]}},intersectLine:function(e,t,n,r,i,a,o){var s=this.generateCutTrianglePts(n+2*o,r+2*o,e,t),l=[].concat.apply([],[s.topLeft.splice(0,4),s.topRight.splice(0,4),s.bottomRight.splice(0,4),s.bottomLeft.splice(0,4)]);return xt(i,a,l,e,t)},checkPoint:function(e,t,n,r,i,a,o){if(ft(e,t,this.points,a,o,r,i-2*this.cornerLength,[0,-1],n))return!0;if(ft(e,t,this.points,a,o,r-2*this.cornerLength,i,[0,-1],n))return!0;var s=this.generateCutTrianglePts(r,i,a,o);return dt(e,t,s.topLeft)||dt(e,t,s.topRight)||dt(e,t,s.bottomRight)||dt(e,t,s.bottomLeft)}}},Ho.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:Et(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){var s=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),l=function(e){var t=Ze({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=Ze({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),r=Ze({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]},u=[].concat(l(s.topLeft),l(s.topRight),l(s.bottomRight),l(s.bottomLeft));return xt(i,a,u,e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,l=r-i,u=r+i,c=Pt(e,t),h=c.heightOffset,d=c.widthOffset,f=c.ctrlPtOffsetPct*e,p={topLeft:[o,l+h,o+f,l,o+d,l],topRight:[s-d,l,s-f,l,s,l+h],bottomRight:[s,u-h,s-f,u,s-d,u],bottomLeft:[o+d,u,o+f,u,o,u-h]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(e,t,n,r,i,a,o){var s=Pt(r,i),l=s.heightOffset,u=s.widthOffset;if(ft(e,t,this.points,a,o,r,i-2*l,[0,-1],n))return!0;if(ft(e,t,this.points,a,o,r-2*u,i,[0,-1],n))return!0;for(var c=this.generateBarrelBezierPts(r,i,a,o),h=function(e,t,n){var r,i,a=n[4],o=n[2],s=n[0],l=n[5],u=n[1],c=Math.min(a,s),h=Math.max(a,s),d=Math.min(l,u),f=Math.max(l,u);if(c<=e&&e<=h&&d<=t&&t<=f){var p=[(r=a)-2*(i=o)+s,2*(i-r),r],v=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]}(p[0],p[1],p[2],e).filter((function(e){return 0<=e&&e<=1}));if(v.length>0)return v[0]}return null},d=Object.keys(c),f=0;f<d.length;f++){var p=c[d[f]],v=h(e,t,p);if(null!=v){var g=p[5],y=p[3],m=p[1],b=Ke(g,y,m,v);if(p.isTop&&b<=t)return!0;if(p.isBottom&&t<=b)return!0}}return!1}}},Ho.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:Et(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o){var s=t-(r/2+o),l=bt(i,a,e,t,e-(n/2+o),s,e+(n/2+o),s,!1);return l.length>0?l:st(i,a,e,t,n,r,o)},checkPoint:function(e,t,n,r,i,a,o){var s=Ct(r,i),l=2*s;if(ft(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(ft(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!dt(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!gt(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!gt(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},Ho.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",Et(3,0)),this.generateRoundPolygon("round-triangle",Et(3,0)),this.generatePolygon("rectangle",Et(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",Et(5,0)),this.generateRoundPolygon("round-pentagon",Et(5,0)),this.generatePolygon("hexagon",Et(6,0)),this.generateRoundPolygon("round-hexagon",Et(6,0)),this.generatePolygon("heptagon",Et(7,0)),this.generateRoundPolygon("round-heptagon",Et(7,0)),this.generatePolygon("octagon",Et(8,0)),this.generateRoundPolygon("round-octagon",Et(8,0));var r=new Array(20),i=_t(5,0),a=_t(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(s=0;s<5;s++)r[4*s]=i[2*s],r[4*s+1]=i[2*s+1],r[4*s+2]=a[2*s],r[4*s+3]=a[2*s+1];r=kt(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(e){var n,r="polygon-"+e.join("$");return(n=this[r])?n:t.generatePolygon(r,e)}};var Wo={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(e){e=e||ve();var t=this;void 0===t.averageRedrawTime&&(t.averageRedrawTime=0),void 0===t.lastRedrawTime&&(t.lastRedrawTime=0),void 0===t.lastDrawTime&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},beforeRender:function(e,t){if(!this.destroyed){null==t&&ue("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort((function(e,t){return t.priority-e.priority}))}}},Uo=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};Wo.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;W((function n(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){Uo(e,!0,r);var i=U();e.render(e.renderOptions);var a=e.lastDrawTime=U();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else Uo(e,!1,r);e.skipFrame=!1,W(n)}}))}};var Ko=function(e){this.init(e)},Zo=Ko.prototype;Zo.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Zo.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container();if(d){var r=d.document,i=r.head,a="__________cytoscape_container",o=null!=r.getElementById("__________cytoscape_stylesheet");if(n.className.indexOf(a)<0&&(n.className=(n.className||"")+" "+a),!o){var s=r.createElement("style");s.id="__________cytoscape_stylesheet",s.innerHTML="."+a+" { position: relative; }",i.insertBefore(s,i.children[0])}"static"===d.getComputedStyle(n).getPropertyValue("position")&&he("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=k(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},Zo.notify=function(e,t){var n=this,r=n.cy;this.destroyed||("init"!==e?"destroy"!==e?(("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&n.invalidateCachedZSortedEles(),"viewport"===e&&n.redrawHint("select",!0),"load"!==e&&"resize"!==e&&"mount"!==e||(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()):n.destroy():n.load())},Zo.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch(e){}},Zo.isHeadless=function(){return!1},[To,Xo,Yo,Go,Ho,Wo].forEach((function(e){j(Zo,e)}));var $o=function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=i((function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()}),e.deqRedrawThreshold),a=e.priority||le;n.beforeRender((function(i,a){var o=U(),s=n.averageRedrawTime,l=n.lastRedrawTime,u=[],c=n.cy.extent(),h=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var d=U(),f=d-o,p=d-a;if(l<1e3/60){var v=1e3/60-(i?s:0);if(p>=e.deqFastCost*v)break}else if(i){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*(1e3/60))break;var g=e.deq(t,h,c);if(!(g.length>0))break;for(var y=0;y<g.length;y++)u.push(g[y])}u.length>0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&r())}),a(t))}}},Qo=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oe;s(this,e),this.idsByKey=new we,this.keyForId=new we,this.cachesByLvl=new we,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return u(e,[{key:"getIdsFor",value:function(e){null==e&&ue("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new ke,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new we,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Jo={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},es=ge({getKey:null,doesEleInvalidateKey:oe,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:ae,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ts=function(e,t){this.renderer=e,this.onDequeues=[];var n=es(t);j(this,n),this.lookup=new Qo(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},ns=ts.prototype;ns.reasons=Jo,ns.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},ns.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},ns.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new a((function(e,t){return t.reqs-e.reqs}))},ns.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},ns.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(Ye(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,h=t.w*u,d=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var f,p=l.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;if(f=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||h>1024)return null;var v=a.getTextureQueue(f),g=v[v.length-2],y=function(){return a.recycleTexture(f,h)||a.addTexture(f,h)};g||(g=v[v.length-1]),g||(g=y()),g.width-g.usedWidth<h&&(g=y());for(var m,b=function(e){return e&&e.scaledLabelShown===d},x=i&&i===Jo.dequeue,w=i&&i===Jo.highQuality,E=i&&i===Jo.downscale,k=r+1;k<=3;k++){var _=l.get(e,k);if(_){m=_;break}}var C=m&&m.level===r+1?m:null,S=function(){g.context.drawImage(C.texture.canvas,C.x,0,C.width,C.height,g.usedWidth,0,h,c)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,h,f),b(C))S();else if(b(m)){if(!w)return a.queueElement(e,m.level-1),m;for(var P=m.level;P>r;P--)C=a.getElement(e,t,n,P,Jo.downscale);S()}else{var T;if(!x&&!w&&!E)for(var A=r-1;A>=-4;A--){var D=l.get(e,A);if(D){T=D;break}}if(b(T))return a.queueElement(e,r),T;g.context.translate(g.usedWidth,0),g.context.scale(u,u),this.drawElement(g.context,e,t,d,!1),g.context.scale(1/u,1/u),g.context.translate(-g.usedWidth,0)}return p={x:g.usedWidth,texture:g,level:r,scale:u,width:h,height:c,scaledLabelShown:d},g.usedWidth+=Math.ceil(h+8),g.eleCaches.push(p),l.set(e,r,p),a.checkTextureFullness(g),p},ns.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},ns.invalidateElement=function(e){var t=this.lookup,n=[];if(t.isInvalid(e)){for(var r=-4;r<=3;r++){var i=t.getForCachedKey(e,r);i&&n.push(i)}if(t.invalidate(e))for(var a=0;a<n.length;a++){var o=n[a],s=o.texture;s.invalidatedWidth+=o.width,o.invalidated=!0,this.checkTextureUtility(s)}this.removeFromQueue(e)}},ns.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},ns.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?ye(t,e):e.fullnessChecks++},ns.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;ye(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a<i.length;a++){var o=i[a];r.deleteCache(o.key,o.level)}me(i),this.getRetiredTextureQueue(t).push(e)},ns.addTexture=function(e,t){var n={};return this.getTextureQueue(e).push(n),n.eleCaches=[],n.height=e,n.width=Math.max(1024,t),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=this.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},ns.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),i=0;i<r.length;i++){var a=r[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,me(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),ye(r,a),n.push(a),a}},ns.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},ns.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,!u){r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,Jo.dequeue)}}return r},ns.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=ie,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},ns.onDequeue=function(e){this.onDequeues.push(e)},ns.offDequeue=function(e){ye(this.onDequeues,e)},ns.setupDequeueing=$o({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;n<e.onDequeues.length;n++){(0,e.onDequeues[n])(t)}},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++){var s=a[o].boundingBox();if(it(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var rs=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=U()-500,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=i((function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)}),50),n.beforeRender((function(e,n){n-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1}),n.beforeRenderPriorities.lyrTxrSkip);t.layersQueue=new a((function(e,t){return t.reqs-e.reqs})),t.setupDequeueing()},is=rs.prototype,as=0,os=Math.pow(2,53)-1;is.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:as=++as%os,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},is.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(Ye(i*t)))<-4)n=-4;else if(i>=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&ye(c,o)}}();var h=function(t){var i=(t=t||{}).after;if(function(){if(!o){o=Qe();for(var t=0;t<e.length;t++)n=o,r=e[t].boundingBox(),n.x1=Math.min(n.x1,r.x1),n.x2=Math.max(n.x2,r.x2),n.w=n.x2-n.x1,n.y1=Math.min(n.y1,r.y1),n.y2=Math.max(n.y2,r.y2),n.h=n.y2-n.y1}var n,r}(),o.w*u*(o.h*u)>16e6)return null;var a=r.makeLayer(o,n);if(null!=i){var s=c.indexOf(i)+1;c.splice(s,0,a)}else(void 0===t.insert||t.insert)&&c.unshift(a);return a};if(r.skipping&&!a)return null;for(var d=null,f=e.length/1,p=!a,v=0;v<e.length;v++){var g=e[v],y=g._private.rscratch,m=y.imgLayerCaches=y.imgLayerCaches||{},b=m[n];if(b)d=b;else{if((!d||d.eles.length>=f||!ot(d.bb,g.boundingBox()))&&!(d=h({insert:!0,after:d})))return null;s||p?r.queueLayer(d,g):r.drawEleInLayer(d,g,n,t),d.eles.push(g),m[n]=d}}return s||(p?null:c)},is.getEleLevelForLayerLevel=function(e,t){return e},is.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},is.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},is.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0)this.invalidateLayer(i);else{var s=a;for(o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}}},is.updateElementsInLayers=function(e,t){for(var n=S(e[0]),r=0;r<e.length;r++)for(var i=n?null:e[r],a=n?e[r]:e[r].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];u&&(i&&this.getEleLevelForLayerLevel(u.level)!==i.level||t(u,a,i))}},is.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},is.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=U(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},is.invalidateLayer=function(e){if(this.lastInvalidationTime=U(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];ye(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},is.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,(function(e,n,r){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])}))},is.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},is.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},is.dequeue=function(e){for(var t=this.layersQueue,n=[],r=0;r<1&&0!==t.size();){var i=t.peek();if(i.replacement)t.pop();else if(i.replaces&&i!==i.replaces.replacement)t.pop();else if(i.invalid)t.pop();else{var a=i.elesQueue.shift();a&&(this.drawEleInLayer(i,a,i.level,e),r++),0===n.length&&n.push(!0),0===i.elesQueue.length&&(t.pop(),i.reqs=0,i.replaces&&this.applyLayerReplacement(i),this.requestRedraw())}}return n},is.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],n=e.replaces,r=t.indexOf(n);if(!(r<0||n.invalid)){t[r]=e;for(var i=0;i<e.eles.length;i++){var a=e.eles[i]._private,o=a.imgLayerCaches=a.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},is.requestRedraw=i((function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()}),100),is.setupDequeueing=$o({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:le,shouldRedraw:ae,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var ss,ls={};function us(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function cs(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function hs(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];e.moveTo(s.x,s.y);for(i=1;i<o.length;i++){a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function ds(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}ls.arrowShapeImpl=function(e){return(ss||(ss={polygon:us,"triangle-backcurve":cs,"triangle-tee":hs,"triangle-cross":hs,circle:ds}))[e]};var fs={drawElement:function(e,t,n,r,i,a){t.isNode()?this.drawNode(e,t,n,r,i,a):this.drawEdge(e,t,n,r,i,a)},drawElementOverlay:function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},drawCachedElementPortion:function(e,t,n,r,i,a,o,s){var l=this,u=n.getBoundingBox(t);if(0!==u.w&&0!==u.h){var c=n.getElement(t,u,r,i,a);if(null!=c){var h=s(l,t);if(0===h)return;var d,f,p,v,g,y,m=o(l,t),b=u.x1,x=u.y1,w=u.w,E=u.h;if(0!==m){var k=n.getRotationPoint(t);p=k.x,v=k.y,e.translate(p,v),e.rotate(m),(g=l.getImgSmoothing(e))||l.setImgSmoothing(e,!0);var _=n.getRotationOffset(t);d=_.x,f=_.y}else d=b,f=x;1!==h&&(y=e.globalAlpha,e.globalAlpha=y*h),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,d,f,w,E),1!==h&&(e.globalAlpha=y),0!==m&&(e.rotate(-m),e.translate(-p,-v),g||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}}},ps=function(){return 0},vs=function(e,t){return e.getTextAngle(t,null)},gs=function(e,t){return e.getTextAngle(t,"source")},ys=function(e,t){return e.getTextAngle(t,"target")},ms=function(e,t){return t.effectiveOpacity()},bs=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};fs.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,h=s.tlbTxrCache,d=t.boundingBox(),f=!0===a?l.reasons.highQuality:null;if(0!==d.w&&0!==d.h&&t.visible()&&(!r||it(d,r))){var p=t.isEdge(),v=t.element()._private.rscratch.badLine;o.drawCachedElementPortion(e,t,l,n,i,f,ps,ms),p&&v||o.drawCachedElementPortion(e,t,u,n,i,f,vs,bs),p&&!v&&(o.drawCachedElementPortion(e,t,c,n,i,f,gs,bs),o.drawCachedElementPortion(e,t,h,n,i,f,ys,bs)),o.drawElementOverlay(e,t)}},fs.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},fs.drawCachedElements=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,n,r)}},fs.drawCachedNodes=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,n,r)}},fs.drawLayeredElements=function(e,t,n,r){var i=this.data.lyrTxrCache.getLayers(t,n);if(i)for(var a=0;a<i.length;a++){var o=i[a],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,n,r)};var xs={drawEdge:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=t.pstyle("line-style").value,h=t.pstyle("width").pfValue,d=t.pstyle("line-cap").value,f=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u;e.lineWidth=h,e.lineCap=d,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,c),e.lineCap="butt"},p=function(){i&&o.drawEdgeOverlay(e,t)},v=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u;o.drawArrowheads(e,t,n)},g=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var y="yes"===t.pstyle("ghost").value;if(y){var m=t.pstyle("ghost-offset-x").pfValue,b=t.pstyle("ghost-offset-y").pfValue,x=t.pstyle("ghost-opacity").value,w=u*x;e.translate(m,b),f(w),v(w),e.translate(-m,-b)}f(),v(),p(),g(),n&&e.translate(l.x1,l.y1)}},drawEdgeOverlay:function(e,t){if(t.visible()){var n=t.pstyle("overlay-opacity").value;if(0!==n){var r=this,i=r.usePaths(),a=t._private.rscratch,o=2*t.pstyle("overlay-padding").pfValue,s=t.pstyle("overlay-color").value;e.lineWidth=o,"self"!==a.edgeType||i?e.lineCap="round":e.lineCap="butt",r.colorStrokeStyle(e,s[0],s[1],s[2],n),r.drawEdgePath(t,e,a.allpts,"solid")}}},drawEdgePath:function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<n.length;d+=4)t.quadraticCurveTo(n[d],n[d+1],n[d+2],n[d+3]);break;case"straight":case"segments":case"haystack":for(var f=2;f+1<n.length;f+=2)t.lineTo(n[f],n[f+1])}t=o,l?t.stroke(i):t.stroke(),t.setLineDash&&t.setLineDash([])},drawArrowheads:function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},drawArrowhead:function(e,t,n,r,i,a,o){if(!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a)){var s=t.pstyle(n+"-arrow-shape").value;if("none"!==s){var l="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",u=t.pstyle(n+"-arrow-fill").value,c=t.pstyle("width").pfValue,h=t.pstyle("opacity").value;void 0===o&&(o=h);var d=e.globalCompositeOperation;1===o&&"hollow"!==u||(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,l,c,s,r,i,a),e.globalCompositeOperation=d);var f=t.pstyle(n+"-arrow-color").value;this.colorFillStyle(e,f[0],f[1],f[2],o),this.colorStrokeStyle(e,f[0],f[1],f[2],o),this.drawArrowShape(t,e,u,c,s,r,i,a)}}},drawArrowShape:function(e,t,n,r,i,a,o,s){var l,u=this,c=this.usePaths()&&"triangle-cross"!==i,h=!1,d=t,f={x:a,y:o},p=e.pstyle("arrow-scale").value,v=this.getArrowWidth(r,p),g=u.arrowShapes[i];if(c){var y=u.arrowPathCache=u.arrowPathCache||[],m=Q(i),b=y[m];null!=b?(l=t=b,h=!0):(l=t=new Path2D,y[m]=l)}h||(t.beginPath&&t.beginPath(),c?g.draw(t,1,0,{x:0,y:0},1):g.draw(t,v,s,f,r),t.closePath&&t.closePath()),t=d,c&&(t.translate(a,o),t.rotate(s),t.scale(v,v)),"filled"!==n&&"both"!==n||(c?t.fill(l):t.fill()),"hollow"!==n&&"both"!==n||(t.lineWidth=(g.matchEdgeWidth?r:1)/(c?v:1),t.lineJoin="miter",c?t.stroke(l):t.stroke()),c&&(t.scale(1/v,1/v),t.rotate(-s),t.translate(-a,-o))}},ws={safeDrawImage:function(e,t,n,r,i,a,o,s,l,u){i<=0||a<=0||l<=0||u<=0||e.drawImage(t,n,r,i,a,o,s,l,u)},drawInscribedImage:function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,l=o.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),h=c(n,"background-fit","value",r),d=c(n,"background-repeat","value",r),f=n.width(),p=n.height(),v=2*n.padding(),g=f+("inner"===c(n,"background-width-relative-to","value",r)?0:v),y=p+("inner"===c(n,"background-height-relative-to","value",r)?0:v),m=n._private.rscratch,b="node"===c(n,"background-clip","value",r),x=c(n,"background-image-opacity","value",r)*i,w=t.width||t.cachedW,E=t.height||t.cachedH;null!=w&&null!=E||(document.body.appendChild(t),w=t.cachedW=t.width||t.offsetWidth,E=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var k=w,_=E;if("auto"!==c(n,"background-width","value",r)&&(k="%"===c(n,"background-width","units",r)?c(n,"background-width","pfValue",r)*g:c(n,"background-width","pfValue",r)),"auto"!==c(n,"background-height","value",r)&&(_="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*y:c(n,"background-height","pfValue",r)),0!==k&&0!==_){if("contain"===h)k*=C=Math.min(g/k,y/_),_*=C;else if("cover"===h){var C;k*=C=Math.max(g/k,y/_),_*=C}var S=s-g/2,P=c(n,"background-position-x","units",r),T=c(n,"background-position-x","pfValue",r);S+="%"===P?(g-k)*T:T;var A=c(n,"background-offset-x","units",r),D=c(n,"background-offset-x","pfValue",r);S+="%"===A?(g-k)*D:D;var M=l-y/2,O=c(n,"background-position-y","units",r),B=c(n,"background-position-y","pfValue",r);M+="%"===O?(y-_)*B:B;var L=c(n,"background-offset-y","units",r),I=c(n,"background-offset-y","pfValue",r);M+="%"===L?(y-_)*I:I,m.pathCache&&(S-=s,M-=l,s=0,l=0);var N=e.globalAlpha;if(e.globalAlpha=x,"no-repeat"===d)b&&(e.save(),m.pathCache?e.clip(m.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,g,y),e.clip())),a.safeDrawImage(e,t,0,0,w,E,S,M,k,_),b&&e.restore();else{var z=e.createPattern(t,d);e.fillStyle=z,a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,g,y),e.translate(S,M),e.fill(),e.translate(-S,-M)}e.globalAlpha=N}}},Es={};function ks(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill()}Es.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(Ye(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},Es.drawElementText=function(e,t,n,r,i){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),d=t.pstyle("target-label");if(u||(!c||!c.value)&&(!h||!h.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var f,p=!n;n&&(f=n,e.translate(-f.x1,-f.y1)),null==i?(o.drawText(e,t,null,p,a),t.isEdge()&&(o.drawText(e,t,"source",p,a),o.drawText(e,t,"target",p,a))):o.drawText(e,t,i,p,a),n&&e.translate(f.x1,f.y1)},Es.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},Es.setupTextStyle=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Es.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=be(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},Es.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=be(o,"labelX",n),h=be(o,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(c)&&!isNaN(h)){this.setupTextStyle(e,t,i);var f,p=n?n+"-":"",v=be(o,"labelWidth",n),g=be(o,"labelHeight",n),y=t.pstyle(p+"text-margin-x").pfValue,m=t.pstyle(p+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,h+=m,0!==(f=r?this.getTextAngle(t,n):0)&&(l=c,u=h,e.translate(l,u),e.rotate(f),c=0,h=0),w){case"top":break;case"center":h+=g/2;break;case"bottom":h+=g}var E=t.pstyle("text-background-opacity").value,k=t.pstyle("text-border-opacity").value,_=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue;if(E>0||_>0&&k>0){var S=c-C;switch(x){case"left":S-=v;break;case"center":S-=v/2}var P=h-g-C,T=v+2*C,A=g+2*C;if(E>0){var D=e.fillStyle,M=t.pstyle("text-background-color").value;e.fillStyle="rgba("+M[0]+","+M[1]+","+M[2]+","+E*s+")";var O=t.pstyle("text-background-shape").strValue;0===O.indexOf("round")?ks(e,S,P,T,A,2):e.fillRect(S,P,T,A),e.fillStyle=D}if(_>0&&k>0){var B=e.strokeStyle,L=e.lineWidth,I=t.pstyle("text-border-color").value,N=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+k*s+")",e.lineWidth=_,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=_/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(e.strokeRect(S,P,T,A),"double"===N){var z=_/2;e.strokeRect(S+z,P+z,T-2*z,A-2*z)}e.setLineDash&&e.setLineDash([]),e.lineWidth=L,e.strokeStyle=B}}var R=2*t.pstyle("text-outline-width").pfValue;if(R>0&&(e.lineWidth=R),"wrap"===t.pstyle("text-wrap").value){var j=be(o,"labelWrapCachedLines",n),V=be(o,"labelLineHeight",n),F=v/2,q=this.getLabelJustification(t);switch("auto"===q||("left"===x?"left"===q?c+=-v:"center"===q&&(c+=-F):"center"===x?"left"===q?c+=-F:"right"===q&&(c+=F):"right"===x&&("center"===q?c+=F:"right"===q&&(c+=v))),w){case"top":h-=(j.length-1)*V;break;case"center":case"bottom":h-=(j.length-1)*V}for(var X=0;X<j.length;X++)R>0&&e.strokeText(j[X],c,h),e.fillText(j[X],c,h),h+=V}else R>0&&e.strokeText(d,c,h),e.fillText(d,c,h);0!==f&&(e.rotate(-f),e.translate(-l,-u))}}};var _s={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,h=t.position();if(k(h.x)&&k(h.y)&&(!s||t.visible())){var d,f,p=s?t.effectiveOpacity():1,v=l.usePaths(),g=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(f=n,e.translate(-f.x1,-f.y1));for(var m=t.pstyle("background-image"),b=m.value,x=new Array(b.length),w=new Array(b.length),E=0,_=0;_<b.length;_++){var C=b[_],S=x[_]=null!=C&&"none"!==C;if(S){var P=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",_);E++,w[_]=l.getCachedImage(C,P,(function(){u.backgroundTimestamp=Date.now(),t.emitAndNotify("background")}))}}var T=t.pstyle("background-blacken").value,A=t.pstyle("border-width").pfValue,D=t.pstyle("background-opacity").value*p,M=t.pstyle("border-color").value,O=t.pstyle("border-style").value,B=t.pstyle("border-opacity").value*p;e.lineJoin="miter";var L=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D;l.eleFillStyle(e,t,n)},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B;l.colorStrokeStyle(e,M[0],M[1],M[2],t)},N=t.pstyle("shape").strValue,z=t.pstyle("shape-polygon-points").pfValue;if(v){e.translate(h.x,h.y);var R=l.nodePathCache=l.nodePathCache||[],j=J("polygon"===N?N+","+z.join(","):N,""+i,""+r),V=R[j];null!=V?(d=V,g=!0,c.pathCache=d):(d=new Path2D,R[j]=c.pathCache=d)}var F=function(){if(!g){var n=h;v&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(d||e,n.x,n.y,r,i)}v?e.fill(d):e.fill()},q=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=u.backgrounding,i=0,a=0;a<w.length;a++)x[a]&&w[a].complete&&!w[a].error&&(i++,l.drawInscribedImage(e,w[a],t,a,n));u.backgrounding=!(i===E),r!==u.backgrounding&&t.updateStyle(!1)},X=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(v||l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i)))},Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,n=(T>0?T:-T)*t,r=T>0?0:255;0!==T&&(l.colorFillStyle(e,r,r,r,n),v?e.fill(d):e.fill())},G=function(){if(A>0){if(e.lineWidth=A,e.lineCap="butt",e.setLineDash)switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(v?e.stroke(d):e.stroke(),"double"===O){e.lineWidth=A/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",v?e.stroke(d):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},H=function(){o&&l.drawNodeOverlay(e,t,h,r,i)},W=function(){l.drawElementText(e,t,null,a)},U="yes"===t.pstyle("ghost").value;if(U){var K=t.pstyle("ghost-offset-x").pfValue,Z=t.pstyle("ghost-offset-y").pfValue,$=t.pstyle("ghost-opacity").value,Q=$*p;e.translate(K,Z),L($*D),F(),q(Q),X(0!==T||0!==A),Y(Q),I($*B),G(),e.translate(-K,-Z)}L(),F(),q(),X(0!==T||0!==A),Y(),I(),G(),v&&e.translate(-h.x,-h.y),W(),H(),n&&e.translate(f.x1,f.y1)}},drawNodeOverlay:function(e,t,n,r,i){if(t.visible()){var a=t.pstyle("overlay-padding").pfValue,o=t.pstyle("overlay-opacity").value,s=t.pstyle("overlay-color").value;if(o>0){if(n=n||t.position(),null==r||null==i){var l=t.padding();r=t.width()+2*l,i=t.height()+2*l}this.colorFillStyle(e,s[0],s[1],s[2],o),this.nodeShapes.roundrectangle.draw(e,n.x,n.y,r+2*a,i+2*a),e.fill()}}},hasPie:function(e){return(e=e[0])._private.hasPie},drawPie:function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,h=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var d=1;d<=i.pieBackgroundN;d++){var f=t.pstyle("pie-"+d+"-background-size").value,p=t.pstyle("pie-"+d+"-background-color").value,v=t.pstyle("pie-"+d+"-background-opacity").value*n,g=f/100;g+h>1&&(g=1-h);var y=1.5*Math.PI+2*Math.PI*h,m=y+2*Math.PI*g;0===f||h>=1||h+g>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,p[0],p[1],p[2],v),e.fill(),h+=g)}}},Cs={};Cs.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},Cs.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if((t=n[i]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},Cs.createGradientStyleFor=function(e,t,n,r,i){var a,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)if(n.isEdge()){var u=n.sourceEndpoint(),c=n.targetEndpoint(),h=n.midpoint(),d=He(u,h),f=He(c,h);a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(d,f))}else{var p=o?{x:0,y:0}:n.position(),v=n.paddedWidth(),g=n.paddedHeight();a=e.createRadialGradient(p.x,p.y,0,p.x,p.y,Math.max(v,g))}else if(n.isEdge()){var y=n.sourceEndpoint(),m=n.targetEndpoint();a=e.createLinearGradient(y.x,y.y,m.x,m.y)}else{var b=o?{x:0,y:0}:n.position(),x=n.paddedWidth()/2,w=n.paddedHeight()/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":a=e.createLinearGradient(b.x,b.y-w,b.x,b.y+w);break;case"to-top":a=e.createLinearGradient(b.x,b.y+w,b.x,b.y-w);break;case"to-left":a=e.createLinearGradient(b.x+x,b.y,b.x-x,b.y);break;case"to-right":a=e.createLinearGradient(b.x-x,b.y,b.x+x,b.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(b.x-x,b.y-w,b.x+x,b.y+w);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(b.x-x,b.y+w,b.x+x,b.y-w);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(b.x+x,b.y-w,b.x-x,b.y+w);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(b.x+x,b.y+w,b.x-x,b.y-w)}}if(!a)return null;for(var E=l.length===s.length,k=s.length,_=0;_<k;_++)a.addColorStop(E?l[_]:_/(k-1),"rgba("+s[_][0]+","+s[_][1]+","+s[_][2]+","+i+")");return a},Cs.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},Cs.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},Cs.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},Cs.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},Cs.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},Cs.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},Cs.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]&&e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG]||(o=s);var l,u=i*o,c=a*o;if(u!==t.canvasWidth||c!==t.canvasHeight){t.fontCaches=null;var h=n.canvasContainer;h.style.width=i+"px",h.style.height=a+"px";for(var d=0;d<t.CANVAS_LAYERS;d++)(l=n.canvases[d]).width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"px";for(d=0;d<t.BUFFER_COUNT;d++)(l=n.bufferCanvases[d]).width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"px";t.textureMult=1,o<=1&&(l=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,l.width=u*t.textureMult,l.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c}},Cs.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},Cs.render=function(e){var t=(e=e||ve()).forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,i=e.forcedZoom,a=e.forcedPan,o=this,s=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,l=o.cy,u=o.data,c=u.canvasNeedsRedraw,h=o.textureOnViewport&&!t&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),d=void 0!==e.motionBlur?e.motionBlur:o.motionBlur,f=o.motionBlurPxRatio,p=l.hasCompoundNodes(),v=o.hoverData.draggingEles,g=!(!o.hoverData.selecting&&!o.touchData.selecting),y=d=d&&!t&&o.motionBlurEnabled&&!g;t||(o.prevPxRatio!==s&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=s),!t&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),d&&(null==o.mbFrames&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(y=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!h&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==i?i:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},_=o.prevViewport;void 0===_||k.zoom!==_.zoom||k.pan.x!==_.pan.x||k.pan.y!==_.pan.y||v&&!p||(o.motionBlurPxRatio=1),a&&(E=a),x*=s,E.x*=s,E.y*=s;var C=o.getCachedZSortedEles();function S(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function P(e,r){var s,l,c,h;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,h=o.canvasHeight):(s={x:w.x*f,y:w.y*f},l=b*f,c=o.canvasWidth*f,h=o.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?S(e,0,0,c,h):t||void 0!==r&&!r||e.clearRect(0,0,c,h),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(h||(o.textureDrawLastFrame=!1),h){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var A=u.contexts[o.NODE],D=o.textureCache.texture;k=o.textureCache.viewport;A.setTransform(1,0,0,1,0,0),d?S(A,0,0,k.width,k.height):A.clearRect(0,0,k.width,k.height);var M=m.core("outside-texture-bg-color").value,O=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(A,M[0],M[1],M[2],O),A.fillRect(0,0,k.width,k.height);b=l.zoom();P(A,!1),A.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),A.drawImage(D,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var B=l.extent(),L=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),I=o.hideEdgesOnViewport&&L,N=[];if(N[o.NODE]=!c[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,N[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),N[o.DRAG]=!c[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,N[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||N[o.NODE]){var z=d&&!N[o.NODE]&&1!==f;P(A=t||(z?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),d&&!z?"motionBlur":void 0),I?o.drawCachedNodes(A,C.nondrag,s,B):o.drawLayeredElements(A,C.nondrag,s,B),o.debug&&o.drawDebugPoints(A,C.nondrag),n||d||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||N[o.DRAG])){z=d&&!N[o.DRAG]&&1!==f;P(A=t||(z?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),d&&!z?"motionBlur":void 0),I?o.drawCachedNodes(A,C.drag,s,B):o.drawCachedElements(A,C.drag,s,B),o.debug&&o.drawDebugPoints(A,C.drag),n||d||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(P(A=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;A.lineWidth=R,A.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",A.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(A.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",A.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var j=u.bgActivePosistion;A.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",A.beginPath(),A.arc(j.x,j.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),A.fill()}var V=o.lastRedrawTime;if(o.showFps&&V){V=Math.round(V);var F=Math.round(1e3/V);A.setTransform(1,0,0,1,0,0),A.fillStyle="rgba(255, 0, 0, 0.75)",A.strokeStyle="rgba(255, 0, 0, 0.75)",A.lineWidth=1,A.fillText("1 frame = "+V+" ms = "+F+" fps",0,20);A.strokeRect(0,30,250,20),A.fillRect(0,30,250*Math.min(F/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(d&&1!==f){var q=u.contexts[o.NODE],X=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],Y=u.contexts[o.DRAG],G=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):S(e,0,0,o.canvasWidth,o.canvasHeight);var r=f;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||N[o.NODE])&&(H(q,X,N[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||N[o.DRAG])&&(H(Y,G,N[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!h,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")};for(var Ss={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],n+s*a[2*l+1]);e.closePath()},drawRoundPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2,l=St(r,i);e.beginPath&&e.beginPath();for(var u=0;u<a.length/4;u++){var c,h=void 0;h=0===u?a.length-2:4*u-2,c=4*u+2;var d=t+o*a[4*u],f=n+s*a[4*u+1],p=-a[h]*a[c]-a[h+1]*a[c+1],v=l/Math.tan(Math.acos(p)/2),g=d-v*a[h],y=f-v*a[h+1],m=d+v*a[c],b=f+v*a[c+1];0===u?e.moveTo(g,y):e.lineTo(g,y),e.arcTo(d,f,m,b,l)}e.closePath()},drawRoundRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2,s=Ct(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.arcTo(t+a,n-o,t+a,n,s),e.arcTo(t+a,n+o,t,n+o,s),e.arcTo(t-a,n+o,t-a,n,s),e.arcTo(t-a,n-o,t,n-o,s),e.lineTo(t,n-o),e.closePath()},drawBottomRoundRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2,s=Ct(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.lineTo(t+a,n-o),e.lineTo(t+a,n),e.arcTo(t+a,n+o,t,n+o,s),e.arcTo(t-a,n+o,t-a,n,s),e.lineTo(t-a,n-o),e.lineTo(t,n-o),e.closePath()},drawCutRectanglePath:function(e,t,n,r,i){var a=r/2,o=i/2;e.beginPath&&e.beginPath(),e.moveTo(t-a+8,n-o),e.lineTo(t+a-8,n-o),e.lineTo(t+a,n-o+8),e.lineTo(t+a,n+o-8),e.lineTo(t+a-8,n+o),e.lineTo(t-a+8,n+o),e.lineTo(t-a,n+o-8),e.lineTo(t-a,n-o+8),e.closePath()},drawBarrelPath:function(e,t,n,r,i){var a=r/2,o=i/2,s=t-a,l=t+a,u=n-o,c=n+o,h=Pt(r,i),d=h.widthOffset,f=h.heightOffset,p=h.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(s,u+f),e.lineTo(s,c-f),e.quadraticCurveTo(s+p,c,s+d,c),e.lineTo(l-d,c),e.quadraticCurveTo(l-p,c,l,c-f),e.lineTo(l,u+f),e.quadraticCurveTo(l-p,u,l-d,u),e.lineTo(s+d,u),e.quadraticCurveTo(s+p,u,s,u+f),e.closePath()}},Ps=Math.sin(0),Ts=Math.cos(0),As={},Ds={},Ms=Math.PI/40,Os=0*Math.PI;Os<2*Math.PI;Os+=Ms)As[Os]=Math.sin(Os),Ds[Os]=Math.cos(Os);Ss.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=Ms)a=t-s*As[u]*Ps+s*Ds[u]*Ts,o=n+l*Ds[u]*Ps+l*As[u]*Ts,0===u?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var Bs={};function Ls(e){var t=e.indexOf(",");return e.substr(t+1)}function Is(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new Rn((function(r,i){try{t.toBlob((function(e){null!=e?r(e):i(new Error("`canvas.toBlob()` sent a null value in its callback"))}),n,e.quality)}catch(e){i(e)}}));case"blob":return function(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}(Ls(r()),n);case"base64":return Ls(r());case"base64uri":default:return r()}}Bs.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},Bs.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=k(e.maxWidth)||k(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;k(e.maxWidth)&&(u=l*e.maxWidth/i),k(e.maxHeight)&&(c=l*e.maxHeight/a),i*=l=Math.min(u,c),a*=l}o||(i*=s,a*=s,l*=s);var h=document.createElement("canvas");h.width=i,h.height=a,h.style.width=i+"px",h.style.height=a+"px";var d=h.getContext("2d");if(i>0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var p=t.pan(),v={x:p.x*l,y:p.y*l};l*=t.zoom(),d.translate(v.x,v.y),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(-v.x,-v.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},Bs.png=function(e){return Is(e,this.bufferCanvasImage(e),"image/png")},Bs.jpg=function(e){return Is(e,this.bufferCanvasImage(e),"image/jpeg")};var Ns={nodeShapeImpl:function(e,t,n,r,i,a,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},zs=js,Rs=js.prototype;function js(e){var t=this;t.data={canvases:new Array(Rs.CANVAS_LAYERS),contexts:new Array(Rs.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Rs.CANVAS_LAYERS),bufferCanvases:new Array(Rs.BUFFER_COUNT),bufferContexts:new Array(Rs.CANVAS_LAYERS)};t.data.canvasContainer=document.createElement("div");var n=t.data.canvasContainer.style;t.data.canvasContainer.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",n.position="relative",n.zIndex="0",n.overflow="hidden";var r=e.cy.container();r.appendChild(t.data.canvasContainer),r.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";var i={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};f&&f.userAgent.match(/msie|trident|edge/i)&&(i["-ms-touch-action"]="none",i["touch-action"]="none");for(var a=0;a<Rs.CANVAS_LAYERS;a++){var o=t.data.canvases[a]=document.createElement("canvas");t.data.contexts[a]=o.getContext("2d"),Object.keys(i).forEach((function(e){o.style[e]=i[e]})),o.style.position="absolute",o.setAttribute("data-id","layer"+a),o.style.zIndex=String(Rs.CANVAS_LAYERS-a),t.data.canvasContainer.appendChild(o),t.data.canvasNeedsRedraw[a]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[Rs.NODE].setAttribute("data-id","layer"+Rs.NODE+"-node"),t.data.canvases[Rs.SELECT_BOX].setAttribute("data-id","layer"+Rs.SELECT_BOX+"-selectbox"),t.data.canvases[Rs.DRAG].setAttribute("data-id","layer"+Rs.DRAG+"-drag");for(a=0;a<Rs.BUFFER_COUNT;a++)t.data.bufferCanvases[a]=document.createElement("canvas"),t.data.bufferContexts[a]=t.data.bufferCanvases[a].getContext("2d"),t.data.bufferCanvases[a].style.position="absolute",t.data.bufferCanvases[a].setAttribute("data-id","buffer"+a),t.data.bufferCanvases[a].style.zIndex=String(-a-1),t.data.bufferCanvases[a].style.visibility="hidden";t.pathsEnabled=!0;var s=Qe(),l=function(e){return{x:-e.w/2,y:-e.h/2}},u=function(e){return e.boundingBox(),e[0]._private.bodyBounds},c=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||s},h=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||s},d=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||s},p=function(e,t){return t},v=function(e,t,n){var r=e?e+"-":"";return{x:t.x+n.pstyle(r+"text-margin-x").pfValue,y:t.y+n.pstyle(r+"text-margin-y").pfValue}},g=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},y=t.data.eleTxrCache=new ts(t,{getKey:function(e){return e[0]._private.nodeKey},doesEleInvalidateKey:function(e){var t=e[0]._private;return!(t.oldBackgroundTimestamp===t.backgroundTimestamp)},drawElement:function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},getBoundingBox:u,getRotationPoint:function(e){return{x:((t=u(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2};var t},getRotationOffset:function(e){return l(u(e))},allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),m=t.data.lblTxrCache=new ts(t,{getKey:function(e){return e[0]._private.labelStyleKey},drawElement:function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)},getBoundingBox:c,getRotationPoint:function(e){return v("",g(e,"labelX","labelY"),e)},getRotationOffset:function(e){var t=c(e),n=l(c(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w;break;case"right":n.x=0}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h;break;case"bottom":n.y=0}}return n},isVisible:p}),b=t.data.slbTxrCache=new ts(t,{getKey:function(e){return e[0]._private.sourceLabelStyleKey},drawElement:function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)},getBoundingBox:h,getRotationPoint:function(e){return v("source",g(e,"sourceLabelX","sourceLabelY"),e)},getRotationOffset:function(e){return l(h(e))},isVisible:p}),x=t.data.tlbTxrCache=new ts(t,{getKey:function(e){return e[0]._private.targetLabelStyleKey},drawElement:function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)},getBoundingBox:d,getRotationPoint:function(e){return v("target",g(e,"targetLabelX","targetLabelY"),e)},getRotationOffset:function(e){return l(d(e))},isVisible:p}),w=t.data.lyrTxrCache=new rs(t);t.onUpdateEleCalcs((function(e,t){y.invalidateElements(t),m.invalidateElements(t),b.invalidateElements(t),x.invalidateElements(t),w.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}}));var E=function(e){for(var t=0;t<e.length;t++)w.enqueueElementRefinement(e[t].ele)};y.onDequeue(E),m.onDequeue(E),b.onDequeue(E),x.onDequeue(E)}Rs.CANVAS_LAYERS=3,Rs.SELECT_BOX=0,Rs.DRAG=1,Rs.NODE=2,Rs.BUFFER_COUNT=3,Rs.TEXTURE_BUFFER=0,Rs.MOTIONBLUR_BUFFER_NODE=1,Rs.MOTIONBLUR_BUFFER_DRAG=2,Rs.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[Rs.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[Rs.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[Rs.SELECT_BOX]=t}};var Vs="undefined"!=typeof Path2D;Rs.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},Rs.usePaths=function(){return Vs&&this.pathsEnabled},Rs.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},Rs.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},Rs.makeOffscreenCanvas=function(e,t){var n;return"undefined"!==("undefined"==typeof OffscreenCanvas?"undefined":o(OffscreenCanvas))?n=new OffscreenCanvas(e,t):((n=document.createElement("canvas")).width=e,n.height=t),n},[ls,fs,xs,ws,Es,_s,Cs,Ss,Bs,Ns].forEach((function(e){j(Rs,e)}));var Fs=[{type:"layout",extensions:_o},{type:"renderer",extensions:[{name:"null",impl:Co},{name:"base",impl:Ko},{name:"canvas",impl:zs}]}],qs={},Xs={};function Ys(e,t,n){var r=n,i=function(n){ue("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(za.prototype[t])return i(t);za.prototype[t]=n}else if("collection"===e){if(ta.prototype[t])return i(t);ta.prototype[t]=n}else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),E(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(e){return e._private.cy},d={addEventFields:function(e,t){t.layout=e,t.cy=h(e),t.target=e},bubble:function(){return!0},parent:function(e){return h(e)}};j(o,{createEmitter:function(){return this._private.emitter=new bi(d,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),Fn.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var f=Gs("renderer","base"),p=f.prototype,v=n,g=n.prototype,y=function(){f.apply(this,arguments),v.apply(this,arguments)},m=y.prototype;for(var b in p){var x=p[b];if(null!=g[b])return i(b);m[b]=x}for(var w in g)m[w]=g[w];p.clientFunctions.forEach((function(e){m[e]=m[e]||function(){ue("Renderer does not implement `renderer."+e+"()` on its prototype")}})),r=y}return q({map:qs,keys:[e,t],value:r})}function Gs(e,t){return X({map:qs,keys:[e,t]})}function Hs(e,t,n,r,i){return q({map:Xs,keys:[e,t,n,r],value:i})}function Ws(e,t,n,r){return X({map:Xs,keys:[e,t,n,r]})}var Us=function(){return 2===arguments.length?Gs.apply(null,arguments):3===arguments.length?Ys.apply(null,arguments):4===arguments.length?Ws.apply(null,arguments):5===arguments.length?Hs.apply(null,arguments):void ue("Invalid extension access syntax")};za.prototype.extension=Us,Fs.forEach((function(e){e.extensions.forEach((function(t){Ys(e.type,t.name,t.impl)}))}));var Ks=function e(){if(!(this instanceof e))return new e;this.length=0},Zs=Ks.prototype;Zs.instanceString=function(){return"stylesheet"},Zs.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},Zs.css=function(e,t){var n=this.length-1;if(b(e))this[n].properties.push({name:e,value:t});else if(E(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(null!=s){var l=Oa.properties[o]||Oa.properties[L(o)];if(null!=l){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},Zs.style=Zs.css,Zs.generateStyle=function(e){var t=new Oa(e);return this.appendToStyle(t)},Zs.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var $s=function(e){return void 0===e&&(e={}),E(e)?new za(e):b(e)?Us.apply(Us,arguments):void 0};$s.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift($s),e.apply(null,t),this},$s.warnings=function(e){return ce(e)},$s.version="3.14.2",$s.stylesheet=$s.Stylesheet=Ks,e.exports=$s}).call(this,n(24).setImmediate)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function r(e,t){var n={};for(var r in e)n[r]={};for(var r in t)n[r]={};return Object.keys(n).length}function i(e,t){var n=0;for(var r in e)void 0!==t[r]&&++n;return n}function a(e,t,n,r){var i=function(e,t){var n={},r=function(e,t){void 0===n[e]&&(n[e]={}),n[e][t]={}};return e.forEach((function(e){var n=t.getSourceIndex(e),i=t.getTargetIndex(e);r(n,i),r(i,n)})),n}(e,r);e.forEach((function(e){var a=i[r.getSourceIndex(e)],o=i[r.getTargetIndex(e)];r.setLength(e,1+t*n(a,o))}))}function o(e,t,n){var r=[],i=0,a=[],o=[];function s(e){e.index=e.lowlink=i++,a.push(e),e.onStack=!0;for(var t=0,n=e.out;t<n.length;t++){var r=n[t];void 0===r.index?(s(r),e.lowlink=Math.min(e.lowlink,r.lowlink)):r.onStack&&(e.lowlink=Math.min(e.lowlink,r.index))}if(e.lowlink===e.index){for(var l=[];a.length&&((r=a.pop()).onStack=!1,l.push(r),r!==e););o.push(l.map((function(e){return e.id})))}}for(var l=0;l<e;l++)r.push({id:l,out:[]});for(var u=0,c=t;u<c.length;u++){var h=c[u],d=r[n.getSourceIndex(h)],f=r[n.getTargetIndex(h)];d.out.push(f)}for(var p=0,v=r;p<v.length;p++){var g=v[p];void 0===g.index&&s(g)}return o}Object.defineProperty(t,"__esModule",{value:!0}),t.symmetricDiffLinkLengths=function(e,t,n){void 0===n&&(n=1),a(e,n,(function(e,t){return Math.sqrt(r(e,t)-i(e,t))}),t)},t.jaccardLinkLengths=function(e,t,n){void 0===n&&(n=1),a(e,n,(function(e,t){return Math.min(Object.keys(e).length,Object.keys(t).length)<1.1?0:i(e,t)/r(e,t)}),t)},t.generateDirectedEdgeConstraints=function(e,t,n,r){var i=o(e,t,r),a={};i.forEach((function(e,t){return e.forEach((function(e){return a[e]=t}))}));var s=[];return t.forEach((function(e){var t=r.getSourceIndex(e),i=r.getTargetIndex(e);a[t]!==a[i]&&s.push({axis:n,left:t,right:i,gap:r.getMinSeparation(e)})})),s},t.stronglyConnectedComponents=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.locks={}}return e.prototype.add=function(e,t){this.locks[e]=t},e.prototype.clear=function(){this.locks={}},e.prototype.isEmpty=function(){for(var e in this.locks)return!1;return!0},e.prototype.apply=function(e){for(var t in this.locks)e(Number(t),this.locks[t])},e}();t.Locks=r;var i=function(){function e(e,t,n){void 0===n&&(n=null),this.D=t,this.G=n,this.threshold=1e-4,this.numGridSnapNodes=0,this.snapGridSize=100,this.snapStrength=1e3,this.scaleSnapByMaxH=!1,this.random=new a,this.project=null,this.x=e,this.k=e.length;var i=this.n=e[0].length;this.H=new Array(this.k),this.g=new Array(this.k),this.Hd=new Array(this.k),this.a=new Array(this.k),this.b=new Array(this.k),this.c=new Array(this.k),this.d=new Array(this.k),this.e=new Array(this.k),this.ia=new Array(this.k),this.ib=new Array(this.k),this.xtmp=new Array(this.k),this.locks=new r,this.minD=Number.MAX_VALUE;for(var o,s=i;s--;)for(o=i;--o>s;){var l=t[s][o];l>0&&l<this.minD&&(this.minD=l)}for(this.minD===Number.MAX_VALUE&&(this.minD=1),s=this.k;s--;){for(this.g[s]=new Array(i),this.H[s]=new Array(i),o=i;o--;)this.H[s][o]=new Array(i);this.Hd[s]=new Array(i),this.a[s]=new Array(i),this.b[s]=new Array(i),this.c[s]=new Array(i),this.d[s]=new Array(i),this.e[s]=new Array(i),this.ia[s]=new Array(i),this.ib[s]=new Array(i),this.xtmp[s]=new Array(i)}}return e.createSquareMatrix=function(e,t){for(var n=new Array(e),r=0;r<e;++r){n[r]=new Array(e);for(var i=0;i<e;++i)n[r][i]=t(r,i)}return n},e.prototype.offsetDir=function(){for(var e=this,t=new Array(this.k),n=0,r=0;r<this.k;++r){var i=t[r]=this.random.getNextBetween(.01,1)-.5;n+=i*i}return n=Math.sqrt(n),t.map((function(t){return t*(e.minD/n)}))},e.prototype.computeDerivatives=function(e){var t=this,n=this.n;if(!(n<1)){for(var r,i=new Array(this.k),a=new Array(this.k),o=new Array(this.k),s=0,l=0;l<n;++l){for(r=0;r<this.k;++r)o[r]=this.g[r][l]=0;for(var u=0;u<n;++u)if(l!==u){for(var c=n;c--;){var h=0;for(r=0;r<this.k;++r){var d=i[r]=e[r][l]-e[r][u];h+=a[r]=d*d}if(h>1e-9)break;var f=this.offsetDir();for(r=0;r<this.k;++r)e[r][u]+=f[r]}var p=Math.sqrt(h),v=this.D[l][u],g=null!=this.G?this.G[l][u]:1;if(g>1&&p>v||!isFinite(v))for(r=0;r<this.k;++r)this.H[r][l][u]=0;else{g>1&&(g=1);var y=v*v,m=2*g*(p-v)/(y*p),b=p*p*p,x=2*-g/(y*b);for(isFinite(m)||console.log(m),r=0;r<this.k;++r)this.g[r][l]+=i[r]*m,o[r]-=this.H[r][l][u]=x*(b+v*(a[r]-h)+p*h)}}for(r=0;r<this.k;++r)s=Math.max(s,this.H[r][l][l]=o[r])}var w=this.snapGridSize/2,E=this.snapGridSize,k=this.snapStrength/(w*w),_=this.numGridSnapNodes;for(l=0;l<_;++l)for(r=0;r<this.k;++r){var C=this.x[r][l],S=C/E,P=S%1,T=S-P;-w<(d=Math.abs(P)<=.5?C-T*E:C>0?C-(T+1)*E:C-(T-1)*E)&&d<=w&&(this.scaleSnapByMaxH?(this.g[r][l]+=s*k*d,this.H[r][l][l]+=s*k):(this.g[r][l]+=k*d,this.H[r][l][l]+=k))}this.locks.isEmpty()||this.locks.apply((function(n,i){for(r=0;r<t.k;++r)t.H[r][n][n]+=s,t.g[r][n]-=s*(i[r]-e[r][n])}))}},e.dotProd=function(e,t){for(var n=0,r=e.length;r--;)n+=e[r]*t[r];return n},e.rightMultiply=function(t,n,r){for(var i=t.length;i--;)r[i]=e.dotProd(t[i],n)},e.prototype.computeStepSize=function(t){for(var n=0,r=0,i=0;i<this.k;++i)n+=e.dotProd(this.g[i],t[i]),e.rightMultiply(this.H[i],t[i],this.Hd[i]),r+=e.dotProd(t[i],this.Hd[i]);return 0!==r&&isFinite(r)?1*n/r:0},e.prototype.reduceStress=function(){this.computeDerivatives(this.x);for(var e=this.computeStepSize(this.g),t=0;t<this.k;++t)this.takeDescentStep(this.x[t],this.g[t],e);return this.computeStress()},e.copy=function(e,t){for(var n=e.length,r=t[0].length,i=0;i<n;++i)for(var a=0;a<r;++a)t[i][a]=e[i][a]},e.prototype.stepAndProject=function(t,n,r,i){e.copy(t,n),this.takeDescentStep(n[0],r[0],i),this.project&&this.project[0](t[0],t[1],n[0]),this.takeDescentStep(n[1],r[1],i),this.project&&this.project[1](n[0],t[1],n[1]);for(var a=2;a<this.k;a++)this.takeDescentStep(n[a],r[a],i)},e.mApply=function(e,t,n){for(var r=e;r-- >0;)for(var i=t;i-- >0;)n(r,i)},e.prototype.matrixApply=function(t){e.mApply(this.k,this.n,t)},e.prototype.computeNextPosition=function(e,t){var n=this;this.computeDerivatives(e);var r=this.computeStepSize(this.g);if(this.stepAndProject(e,t,this.g,r),this.project){this.matrixApply((function(r,i){return n.e[r][i]=e[r][i]-t[r][i]}));var i=this.computeStepSize(this.e);i=Math.max(.2,Math.min(i,1)),this.stepAndProject(e,t,this.e,i)}},e.prototype.run=function(e){for(var t=Number.MAX_VALUE,n=!1;!n&&e-- >0;){var r=this.rungeKutta();n=Math.abs(t/r-1)<this.threshold,t=r}return t},e.prototype.rungeKutta=function(){var t=this;this.computeNextPosition(this.x,this.a),e.mid(this.x,this.a,this.ia),this.computeNextPosition(this.ia,this.b),e.mid(this.x,this.b,this.ib),this.computeNextPosition(this.ib,this.c),this.computeNextPosition(this.c,this.d);var n=0;return this.matrixApply((function(e,r){var i=(t.a[e][r]+2*t.b[e][r]+2*t.c[e][r]+t.d[e][r])/6,a=t.x[e][r]-i;n+=a*a,t.x[e][r]=i})),n},e.mid=function(t,n,r){e.mApply(t.length,t[0].length,(function(e,i){return r[e][i]=t[e][i]+(n[e][i]-t[e][i])/2}))},e.prototype.takeDescentStep=function(e,t,n){for(var r=0;r<this.n;++r)e[r]=e[r]-n*t[r]},e.prototype.computeStress=function(){for(var e=0,t=0,n=this.n-1;t<n;++t)for(var r=t+1,i=this.n;r<i;++r){for(var a=0,o=0;o<this.k;++o){var s=this.x[o][t]-this.x[o][r];a+=s*s}a=Math.sqrt(a);var l=this.D[t][r];if(isFinite(l)){var u=l-a;e+=u*u/(l*l)}}return e},e.zeroDistance=1e-10,e}();t.Descent=i;var a=function(){function e(e){void 0===e&&(e=1),this.seed=e,this.a=214013,this.c=2531011,this.m=2147483648,this.range=32767}return e.prototype.getNext=function(){return this.seed=(this.seed*this.a+this.c)%this.m,(this.seed>>16)/this.range},e.prototype.getNextBetween=function(e,t){return e+this.getNext()*(t-e)},e}();t.PseudoRandom=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.scale=e,this.AB=0,this.AD=0,this.A2=0}return e.prototype.addVariable=function(e){var t=this.scale/e.scale,n=e.offset/e.scale,r=e.weight;this.AB+=r*t*n,this.AD+=r*t*e.desiredPosition,this.A2+=r*t*t},e.prototype.getPosn=function(){return(this.AD-this.AB)/this.A2},e}();t.PositionStats=r;var i=function(){function e(e,t,n,r){void 0===r&&(r=!1),this.left=e,this.right=t,this.gap=n,this.equality=r,this.active=!1,this.unsatisfiable=!1,this.left=e,this.right=t,this.gap=n,this.equality=r}return e.prototype.slack=function(){return this.unsatisfiable?Number.MAX_VALUE:this.right.scale*this.right.position()-this.gap-this.left.scale*this.left.position()},e}();t.Constraint=i;var a=function(){function e(e,t,n){void 0===t&&(t=1),void 0===n&&(n=1),this.desiredPosition=e,this.weight=t,this.scale=n,this.offset=0}return e.prototype.dfdv=function(){return 2*this.weight*(this.position()-this.desiredPosition)},e.prototype.position=function(){return(this.block.ps.scale*this.block.posn+this.offset)/this.scale},e.prototype.visitNeighbours=function(e,t){var n=function(n,r){return n.active&&e!==r&&t(n,r)};this.cOut.forEach((function(e){return n(e,e.right)})),this.cIn.forEach((function(e){return n(e,e.left)}))},e}();t.Variable=a;var o=function(){function e(e){this.vars=[],e.offset=0,this.ps=new r(e.scale),this.addVariable(e)}return e.prototype.addVariable=function(e){e.block=this,this.vars.push(e),this.ps.addVariable(e),this.posn=this.ps.getPosn()},e.prototype.updateWeightedPosition=function(){this.ps.AB=this.ps.AD=this.ps.A2=0;for(var e=0,t=this.vars.length;e<t;++e)this.ps.addVariable(this.vars[e]);this.posn=this.ps.getPosn()},e.prototype.compute_lm=function(e,t,n){var r=this,i=e.dfdv();return e.visitNeighbours(t,(function(t,a){var o=r.compute_lm(a,e,n);a===t.right?(i+=o*t.left.scale,t.lm=o):(i+=o*t.right.scale,t.lm=-o),n(t)})),i/e.scale},e.prototype.populateSplitBlock=function(e,t){var n=this;e.visitNeighbours(t,(function(t,r){r.offset=e.offset+(r===t.right?t.gap:-t.gap),n.addVariable(r),n.populateSplitBlock(r,e)}))},e.prototype.traverse=function(e,t,n,r){var i=this;void 0===n&&(n=this.vars[0]),void 0===r&&(r=null),n.visitNeighbours(r,(function(r,a){t.push(e(r)),i.traverse(e,t,a,n)}))},e.prototype.findMinLM=function(){var e=null;return this.compute_lm(this.vars[0],null,(function(t){!t.equality&&(null===e||t.lm<e.lm)&&(e=t)})),e},e.prototype.findMinLMBetween=function(e,t){this.compute_lm(e,null,(function(){}));var n=null;return this.findPath(e,null,t,(function(e,t){!e.equality&&e.right===t&&(null===n||e.lm<n.lm)&&(n=e)})),n},e.prototype.findPath=function(e,t,n,r){var i=this,a=!1;return e.visitNeighbours(t,(function(t,o){a||o!==n&&!i.findPath(o,e,n,r)||(a=!0,r(t,o))})),a},e.prototype.isActiveDirectedPathBetween=function(e,t){if(e===t)return!0;for(var n=e.cOut.length;n--;){var r=e.cOut[n];if(r.active&&this.isActiveDirectedPathBetween(r.right,t))return!0}return!1},e.split=function(t){return t.active=!1,[e.createSplitBlock(t.left),e.createSplitBlock(t.right)]},e.createSplitBlock=function(t){var n=new e(t);return n.populateSplitBlock(t,null),n},e.prototype.splitBetween=function(t,n){var r=this.findMinLMBetween(t,n);if(null!==r){var i=e.split(r);return{constraint:r,lb:i[0],rb:i[1]}}return null},e.prototype.mergeAcross=function(e,t,n){t.active=!0;for(var r=0,i=e.vars.length;r<i;++r){var a=e.vars[r];a.offset+=n,this.addVariable(a)}this.posn=this.ps.getPosn()},e.prototype.cost=function(){for(var e=0,t=this.vars.length;t--;){var n=this.vars[t],r=n.position()-n.desiredPosition;e+=r*r*n.weight}return e},e}();t.Block=o;var s=function(){function e(e){this.vs=e;var t=e.length;for(this.list=new Array(t);t--;){var n=new o(e[t]);this.list[t]=n,n.blockInd=t}}return e.prototype.cost=function(){for(var e=0,t=this.list.length;t--;)e+=this.list[t].cost();return e},e.prototype.insert=function(e){e.blockInd=this.list.length,this.list.push(e)},e.prototype.remove=function(e){var t=this.list.length-1,n=this.list[t];this.list.length=t,e!==n&&(this.list[e.blockInd]=n,n.blockInd=e.blockInd)},e.prototype.merge=function(e){var t=e.left.block,n=e.right.block,r=e.right.offset-e.left.offset-e.gap;t.vars.length<n.vars.length?(n.mergeAcross(t,e,r),this.remove(t)):(t.mergeAcross(n,e,-r),this.remove(n))},e.prototype.forEach=function(e){this.list.forEach(e)},e.prototype.updateBlockPositions=function(){this.list.forEach((function(e){return e.updateWeightedPosition()}))},e.prototype.split=function(e){var t=this;this.updateBlockPositions(),this.list.forEach((function(n){var r=n.findMinLM();null!==r&&r.lm<l.LAGRANGIAN_TOLERANCE&&(n=r.left.block,o.split(r).forEach((function(e){return t.insert(e)})),t.remove(n),e.push(r))}))},e}();t.Blocks=s;var l=function(){function e(e,t){this.vs=e,this.cs=t,this.vs=e,e.forEach((function(e){e.cIn=[],e.cOut=[]})),this.cs=t,t.forEach((function(e){e.left.cOut.push(e),e.right.cIn.push(e)})),this.inactive=t.map((function(e){return e.active=!1,e})),this.bs=null}return e.prototype.cost=function(){return this.bs.cost()},e.prototype.setStartingPositions=function(e){this.inactive=this.cs.map((function(e){return e.active=!1,e})),this.bs=new s(this.vs),this.bs.forEach((function(t,n){return t.posn=e[n]}))},e.prototype.setDesiredPositions=function(e){this.vs.forEach((function(t,n){return t.desiredPosition=e[n]}))},e.prototype.mostViolated=function(){for(var t=Number.MAX_VALUE,n=null,r=this.inactive,i=r.length,a=i,o=0;o<i;++o){var s=r[o];if(!s.unsatisfiable){var l=s.slack();if((s.equality||l<t)&&(t=l,n=s,a=o,s.equality))break}}return a!==i&&(t<e.ZERO_UPPERBOUND&&!n.active||n.equality)&&(r[a]=r[i-1],r.length=i-1),n},e.prototype.satisfy=function(){null==this.bs&&(this.bs=new s(this.vs)),this.bs.split(this.inactive);for(var t=null;(t=this.mostViolated())&&(t.equality||t.slack()<e.ZERO_UPPERBOUND&&!t.active);){var n=t.left.block;if(n!==t.right.block)this.bs.merge(t);else{if(n.isActiveDirectedPathBetween(t.right,t.left)){t.unsatisfiable=!0;continue}var r=n.splitBetween(t.left,t.right);if(null===r){t.unsatisfiable=!0;continue}this.bs.insert(r.lb),this.bs.insert(r.rb),this.bs.remove(n),this.inactive.push(r.constraint),t.slack()>=0?this.inactive.push(t):this.bs.merge(t)}}},e.prototype.solve=function(){this.satisfy();for(var e=Number.MAX_VALUE,t=this.bs.cost();Math.abs(e-t)>1e-4;)this.satisfy(),e=t,t=this.bs.cost();return t},e.LAGRANGIAN_TOLERANCE=-1e-4,e.ZERO_UPPERBOUND=-1e-10,e}();t.Solver=l,t.removeOverlapInOneDimension=function(e,t,n){for(var r=e.map((function(e){return new a(e.desiredCenter)})),o=[],s=e.length,u=0;u<s-1;u++){var c=e[u],h=e[u+1];o.push(new i(r[u],r[u+1],(c.size+h.size)/2))}var d=r[0],f=r[s-1],p=e[0].size/2,v=e[s-1].size/2,g=null,y=null;return t&&(g=new a(t,1e3*d.weight),r.push(g),o.push(new i(g,d,p))),n&&(y=new a(n,1e3*f.weight),r.push(y),o.push(new i(f,y,v))),new l(r,o).solve(),{newCenters:r.slice(0,e.length).map((function(e){return e.position()})),lowerBound:g?g.position():d.position()-p,upperBound:y?y.position():f.position()+v}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t,n){this.source=e,this.target=t,this.type=n};t.PowerEdge=r;var i=function(){function e(e,t,n,r){var i=this;if(this.linkAccessor=n,this.modules=new Array(e),this.roots=[],r)this.initModulesFromGroup(r);else{this.roots.push(new s);for(var o=0;o<e;++o)this.roots[0].add(this.modules[o]=new a(o))}this.R=t.length,t.forEach((function(e){var t=i.modules[n.getSourceIndex(e)],r=i.modules[n.getTargetIndex(e)],a=n.getType(e);t.outgoing.add(a,r),r.incoming.add(a,t)}))}return e.prototype.initModulesFromGroup=function(e){var t=new s;this.roots.push(t);for(var n=0;n<e.leaves.length;++n){var r=e.leaves[n],i=new a(r.id);this.modules[r.id]=i,t.add(i)}if(e.groups)for(var o=0;o<e.groups.length;++o){var u=e.groups[o],c={};for(var h in u)"leaves"!==h&&"groups"!==h&&u.hasOwnProperty(h)&&(c[h]=u[h]);t.add(new a(-1-o,new l,new l,this.initModulesFromGroup(u),c))}return t},e.prototype.merge=function(e,t,n){void 0===n&&(n=0);var r=e.incoming.intersection(t.incoming),i=e.outgoing.intersection(t.outgoing),o=new s;o.add(e),o.add(t);var l=new a(this.modules.length,i,r,o);this.modules.push(l);var u=function(n,r,i){n.forAll((function(n,a){n.forAll((function(n){var o=n[r];o.add(a,l),o.remove(a,e),o.remove(a,t),e[i].remove(a,n),t[i].remove(a,n)}))}))};return u(i,"incoming","outgoing"),u(r,"outgoing","incoming"),this.R-=r.count()+i.count(),this.roots[n].remove(e),this.roots[n].remove(t),this.roots[n].add(l),l},e.prototype.rootMerges=function(e){void 0===e&&(e=0);for(var t=this.roots[e].modules(),n=t.length,r=new Array(n*(n-1)),i=0,a=0,o=n-1;a<o;++a)for(var s=a+1;s<n;++s){var l=t[a],u=t[s];r[i]={id:i,nEdges:this.nEdges(l,u),a:l,b:u},i++}return r},e.prototype.greedyMerge=function(){for(var e=0;e<this.roots.length;++e)if(!(this.roots[e].modules().length<2)){var t=this.rootMerges(e).sort((function(e,t){return e.nEdges==t.nEdges?e.id-t.id:e.nEdges-t.nEdges}))[0];if(!(t.nEdges>=this.R))return this.merge(t.a,t.b,e),!0}},e.prototype.nEdges=function(e,t){var n=e.incoming.intersection(t.incoming),r=e.outgoing.intersection(t.outgoing);return this.R-n.count()-r.count()},e.prototype.getGroupHierarchy=function(e){var t=this,n=[];return function e(t,n,r){t.forAll((function(t){if(t.isLeaf())n.leaves||(n.leaves=[]),n.leaves.push(t.id);else{var i=n;if(t.gid=r.length,!t.isIsland()||t.isPredefined()){if(i={id:t.gid},t.isPredefined())for(var a in t.definition)i[a]=t.definition[a];n.groups||(n.groups=[]),n.groups.push(t.gid),r.push(i)}e(t.children,i,r)}}))}(this.roots[0],{},n),this.allEdges().forEach((function(i){var a=t.modules[i.source],o=t.modules[i.target];e.push(new r(void 0===a.gid?i.source:n[a.gid],void 0===o.gid?i.target:n[o.gid],i.type))})),n},e.prototype.allEdges=function(){var t=[];return e.getEdges(this.roots[0],t),t},e.getEdges=function(t,n){t.forAll((function(t){t.getEdges(n),e.getEdges(t.children,n)}))},e}();t.Configuration=i;var a=function(){function e(e,t,n,r,i){void 0===t&&(t=new l),void 0===n&&(n=new l),void 0===r&&(r=new s),this.id=e,this.outgoing=t,this.incoming=n,this.children=r,this.definition=i}return e.prototype.getEdges=function(e){var t=this;this.outgoing.forAll((function(n,i){n.forAll((function(n){e.push(new r(t.id,n.id,i))}))}))},e.prototype.isLeaf=function(){return 0===this.children.count()},e.prototype.isIsland=function(){return 0===this.outgoing.count()&&0===this.incoming.count()},e.prototype.isPredefined=function(){return void 0!==this.definition},e}();function o(e,t){var n={};for(var r in e)r in t&&(n[r]=e[r]);return n}t.Module=a;var s=function(){function e(){this.table={}}return e.prototype.count=function(){return Object.keys(this.table).length},e.prototype.intersection=function(t){var n=new e;return n.table=o(this.table,t.table),n},e.prototype.intersectionCount=function(e){return this.intersection(e).count()},e.prototype.contains=function(e){return e in this.table},e.prototype.add=function(e){this.table[e.id]=e},e.prototype.remove=function(e){delete this.table[e.id]},e.prototype.forAll=function(e){for(var t in this.table)e(this.table[t])},e.prototype.modules=function(){var e=[];return this.forAll((function(t){t.isPredefined()||e.push(t)})),e},e}();t.ModuleSet=s;var l=function(){function e(){this.sets={},this.n=0}return e.prototype.count=function(){return this.n},e.prototype.contains=function(e){var t=!1;return this.forAllModules((function(n){t||n.id!=e||(t=!0)})),t},e.prototype.add=function(e,t){(e in this.sets?this.sets[e]:this.sets[e]=new s).add(t),++this.n},e.prototype.remove=function(e,t){var n=this.sets[e];n.remove(t),0===n.count()&&delete this.sets[e],--this.n},e.prototype.forAll=function(e){for(var t in this.sets)e(this.sets[t],Number(t))},e.prototype.forAllModules=function(e){this.forAll((function(t,n){return t.forAll(e)}))},e.prototype.intersection=function(t){var n=new e;return this.forAll((function(e,r){if(r in t.sets){var i=e.intersection(t.sets[r]),a=i.count();a>0&&(n.sets[r]=i,n.n+=a)}})),n},e}();t.LinkSets=l,t.getGroups=function(e,t,n,r){for(var a=e.length,o=new i(a,t,n,r);o.greedyMerge(););var s=[],l=o.getGroupHierarchy(s);return s.forEach((function(t){var n=function(n){var r=t[n];"number"==typeof r&&(t[n]=e[r])};n("source"),n("target")})),{groups:l,powerEdges:s}}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(){this.findIter=function(e){for(var t=this._root,n=this.iterator();null!==t;){var r=this._comparator(e,t.data);if(0===r)return n._cursor=t,n;n._ancestors.push(t),t=t.get_child(r>0)}return null}}return e.prototype.clear=function(){this._root=null,this.size=0},e.prototype.find=function(e){for(var t=this._root;null!==t;){var n=this._comparator(e,t.data);if(0===n)return t.data;t=t.get_child(n>0)}return null},e.prototype.lowerBound=function(e){return this._bound(e,this._comparator)},e.prototype.upperBound=function(e){var t=this._comparator;return this._bound(e,(function(e,n){return t(n,e)}))},e.prototype.min=function(){var e=this._root;if(null===e)return null;for(;null!==e.left;)e=e.left;return e.data},e.prototype.max=function(){var e=this._root;if(null===e)return null;for(;null!==e.right;)e=e.right;return e.data},e.prototype.iterator=function(){return new o(this)},e.prototype.each=function(e){for(var t,n=this.iterator();null!==(t=n.next());)e(t)},e.prototype.reach=function(e){for(var t,n=this.iterator();null!==(t=n.prev());)e(t)},e.prototype._bound=function(e,t){for(var n=this._root,r=this.iterator();null!==n;){var i=this._comparator(e,n.data);if(0===i)return r._cursor=n,r;r._ancestors.push(n),n=n.get_child(i>0)}for(var a=r._ancestors.length-1;a>=0;--a)if(t(e,(n=r._ancestors[a]).data)>0)return r._cursor=n,r._ancestors.length=a,r;return r._ancestors.length=0,r},e}();t.TreeBase=a;var o=function(){function e(e){this._tree=e,this._ancestors=[],this._cursor=null}return e.prototype.data=function(){return null!==this._cursor?this._cursor.data:null},e.prototype.next=function(){if(null===this._cursor){var e=this._tree._root;null!==e&&this._minNode(e)}else{var t;if(null===this._cursor.right)do{if(t=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.right===t);else this._ancestors.push(this._cursor),this._minNode(this._cursor.right)}return null!==this._cursor?this._cursor.data:null},e.prototype.prev=function(){if(null===this._cursor){var e=this._tree._root;null!==e&&this._maxNode(e)}else{var t;if(null===this._cursor.left)do{if(t=this._cursor,!this._ancestors.length){this._cursor=null;break}this._cursor=this._ancestors.pop()}while(this._cursor.left===t);else this._ancestors.push(this._cursor),this._maxNode(this._cursor.left)}return null!==this._cursor?this._cursor.data:null},e.prototype._minNode=function(e){for(;null!==e.left;)this._ancestors.push(e),e=e.left;this._cursor=e},e.prototype._maxNode=function(e){for(;null!==e.right;)this._ancestors.push(e),e=e.right;this._cursor=e},e}();t.Iterator=o;var s=function(){function e(e){this.data=e,this.left=null,this.right=null,this.red=!0}return e.prototype.get_child=function(e){return e?this.right:this.left},e.prototype.set_child=function(e,t){e?this.right=t:this.left=t},e}(),l=function(e){function t(t){var n=e.call(this)||this;return n._root=null,n._comparator=t,n.size=0,n}return i(t,e),t.prototype.insert=function(e){var n=!1;if(null===this._root)this._root=new s(e),n=!0,this.size++;else{var r=new s(void 0),i=!1,a=!1,o=null,l=r,u=null,c=this._root;for(l.right=this._root;;){if(null===c?(c=new s(e),u.set_child(i,c),n=!0,this.size++):t.is_red(c.left)&&t.is_red(c.right)&&(c.red=!0,c.left.red=!1,c.right.red=!1),t.is_red(c)&&t.is_red(u)){var h=l.right===o;c===u.get_child(a)?l.set_child(h,t.single_rotate(o,!a)):l.set_child(h,t.double_rotate(o,!a))}var d=this._comparator(c.data,e);if(0===d)break;a=i,i=d<0,null!==o&&(l=o),o=u,u=c,c=c.get_child(i)}this._root=r.right}return this._root.red=!1,n},t.prototype.remove=function(e){if(null===this._root)return!1;var n=new s(void 0),r=n;r.right=this._root;for(var i=null,a=null,o=null,l=!0;null!==r.get_child(l);){var u=l;a=i,i=r,r=r.get_child(l);var c=this._comparator(e,r.data);if(l=c>0,0===c&&(o=r),!t.is_red(r)&&!t.is_red(r.get_child(l)))if(t.is_red(r.get_child(!l))){var h=t.single_rotate(r,l);i.set_child(u,h),i=h}else if(!t.is_red(r.get_child(!l))){var d=i.get_child(!u);if(null!==d)if(t.is_red(d.get_child(!u))||t.is_red(d.get_child(u))){var f=a.right===i;t.is_red(d.get_child(u))?a.set_child(f,t.double_rotate(i,u)):t.is_red(d.get_child(!u))&&a.set_child(f,t.single_rotate(i,u));var p=a.get_child(f);p.red=!0,r.red=!0,p.left.red=!1,p.right.red=!1}else i.red=!1,d.red=!0,r.red=!0}}return null!==o&&(o.data=r.data,i.set_child(i.right===r,r.get_child(null===r.left)),this.size--),this._root=n.right,null!==this._root&&(this._root.red=!1),null!==o},t.is_red=function(e){return null!==e&&e.red},t.single_rotate=function(e,t){var n=e.get_child(!t);return e.set_child(!t,n.get_child(t)),n.set_child(t,e),e.red=!0,n.red=!1,n},t.double_rotate=function(e,n){return e.set_child(!n,t.single_rotate(e.get_child(!n),!n)),t.single_rotate(e,n)},t}(a);t.RBTree=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.elem=e,this.subheaps=[]}return e.prototype.toString=function(e){for(var t="",n=!1,r=0;r<this.subheaps.length;++r){var i=this.subheaps[r];i.elem?(n&&(t+=","),t+=i.toString(e),n=!0):n=!1}return""!==t&&(t="("+t+")"),(this.elem?e(this.elem):"")+t},e.prototype.forEach=function(e){this.empty()||(e(this.elem,this),this.subheaps.forEach((function(t){return t.forEach(e)})))},e.prototype.count=function(){return this.empty()?0:1+this.subheaps.reduce((function(e,t){return e+t.count()}),0)},e.prototype.min=function(){return this.elem},e.prototype.empty=function(){return null==this.elem},e.prototype.contains=function(e){if(this===e)return!0;for(var t=0;t<this.subheaps.length;t++)if(this.subheaps[t].contains(e))return!0;return!1},e.prototype.isHeap=function(e){var t=this;return this.subheaps.every((function(n){return e(t.elem,n.elem)&&n.isHeap(e)}))},e.prototype.insert=function(t,n){return this.merge(new e(t),n)},e.prototype.merge=function(e,t){return this.empty()?e:e.empty()?this:t(this.elem,e.elem)?(this.subheaps.push(e),this):(e.subheaps.push(this),e)},e.prototype.removeMin=function(e){return this.empty()?null:this.mergePairs(e)},e.prototype.mergePairs=function(t){if(0==this.subheaps.length)return new e(null);if(1==this.subheaps.length)return this.subheaps[0];var n=this.subheaps.pop().merge(this.subheaps.pop(),t),r=this.mergePairs(t);return n.merge(r,t)},e.prototype.decreaseKey=function(t,n,r,i){var a=t.removeMin(i);t.elem=a.elem,t.subheaps=a.subheaps,null!==r&&null!==a.elem&&r(t.elem,t);var o=new e(n);return null!==r&&r(n,o),this.merge(o,i)},e}();t.PairingHeap=r;var i=function(){function e(e){this.lessThan=e}return e.prototype.top=function(){return this.empty()?null:this.root.elem},e.prototype.push=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var i,a=0;i=t[a];++a)e=new r(i),this.root=this.empty()?e:this.root.merge(e,this.lessThan);return e},e.prototype.empty=function(){return!this.root||!this.root.elem},e.prototype.isHeap=function(){return this.root.isHeap(this.lessThan)},e.prototype.forEach=function(e){this.root.forEach(e)},e.prototype.pop=function(){if(this.empty())return null;var e=this.root.min();return this.root=this.root.removeMin(this.lessThan),e},e.prototype.reduceKey=function(e,t,n){void 0===n&&(n=null),this.root=this.root.decreaseKey(e,t,n,this.lessThan)},e.prototype.toString=function(e){return this.root.toString(e)},e.prototype.count=function(){return this.root.count()},e}();t.PriorityQueue=i},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(3),o=function(){};t.Point=o;var s=function(e,t,n,r){this.x1=e,this.y1=t,this.x2=n,this.y2=r};t.LineSegment=s;var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(o);function u(e,t,n){return(t.x-e.x)*(n.y-e.y)-(n.x-e.x)*(t.y-e.y)}function c(e,t,n){return u(e,t,n)>0}function h(e,t,n){return u(e,t,n)<0}function d(e,t){var n,r,i,a,o=t.length-1;if(h(e,t[1],t[0])&&!c(e,t[o-1],t[0]))return 0;for(n=0,r=o;;){if(r-n==1)return c(e,t[n],t[r])?n:r;if((a=h(e,t[(i=Math.floor((n+r)/2))+1],t[i]))&&!c(e,t[i-1],t[i]))return i;c(e,t[n+1],t[n])?a||c(e,t[n],t[i])?r=i:n=i:a&&h(e,t[n],t[i])?r=i:n=i}}function f(e,t){var n,r,i,a,o=t.length-1;if(c(e,t[o-1],t[0])&&!h(e,t[1],t[0]))return 0;for(n=0,r=o;;){if(r-n==1)return h(e,t[n],t[r])?n:r;if(a=h(e,t[(i=Math.floor((n+r)/2))+1],t[i]),c(e,t[i-1],t[i])&&!a)return i;h(e,t[n+1],t[n])?a?h(e,t[n],t[i])?r=i:n=i:r=i:a?n=i:c(e,t[n],t[i])?r=i:n=i}}function p(e,t,n,r,i,a){var o,s;s=r(e[o=n(t[0],e)],t);for(var l=!1;!l;){for(l=!0;o===e.length-1&&(o=0),!i(t[s],e[o],e[o+1]);)++o;for(;0===s&&(s=t.length-1),!a(e[o],t[s],t[s-1]);)--s,l=!1}return{t1:o,t2:s}}function v(e,t){return p(e,t,d,f,c,h)}t.PolyPoint=l,t.isLeft=u,t.ConvexHull=function(e){var t,n=e.slice(0).sort((function(e,t){return e.x!==t.x?t.x-e.x:t.y-e.y})),r=e.length,i=n[0].x;for(t=1;t<r&&n[t].x===i;++t);var a=t-1,o=[];if(o.push(n[0]),a===r-1)n[a].y!==n[0].y&&o.push(n[a]);else{var s,l=r-1,c=n[r-1].x;for(t=r-2;t>=0&&n[t].x===c;t--);for(s=t+1,t=a;++t<=s;)if(!(u(n[0],n[s],n[t])>=0&&t<s)){for(;o.length>1&&!(u(o[o.length-2],o[o.length-1],n[t])>0);)o.length-=1;0!=t&&o.push(n[t])}l!=s&&o.push(n[l]);var h=o.length;for(t=s;--t>=a;)if(!(u(n[l],n[a],n[t])>=0&&t>a)){for(;o.length>h&&!(u(o[o.length-2],o[o.length-1],n[t])>0);)o.length-=1;0!=t&&o.push(n[t])}}return o},t.clockwiseRadialSweep=function(e,t,n){t.slice(0).sort((function(t,n){return Math.atan2(t.y-e.y,t.x-e.x)-Math.atan2(n.y-e.y,n.x-e.x)})).forEach(n)},t.tangent_PolyPolyC=p,t.LRtangent_PolyPolyC=function(e,t){var n=v(t,e);return{t1:n.t2,t2:n.t1}},t.RLtangent_PolyPolyC=v,t.LLtangent_PolyPolyC=function(e,t){return p(e,t,f,f,h,h)},t.RRtangent_PolyPolyC=function(e,t){return p(e,t,d,d,c,c)};var g=function(e,t){this.t1=e,this.t2=t};t.BiTangent=g;var y=function(){};t.BiTangents=y;var m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(o);t.TVGPoint=m;var b=function(e,t,n,r){this.id=e,this.polyid=t,this.polyvertid=n,this.p=r,r.vv=this};t.VisibilityVertex=b;var x=function(){function e(e,t){this.source=e,this.target=t}return e.prototype.length=function(){var e=this.source.p.x-this.target.p.x,t=this.source.p.y-this.target.p.y;return Math.sqrt(e*e+t*t)},e}();t.VisibilityEdge=x;var w=function(){function e(e,t){if(this.P=e,this.V=[],this.E=[],t)this.V=t.V.slice(0),this.E=t.E.slice(0);else{for(var n=e.length,r=0;r<n;r++){for(var i=e[r],a=0;a<i.length;++a){var o=i[a],s=new b(this.V.length,r,a,o);this.V.push(s),a>0&&this.E.push(new x(i[a-1].vv,s))}i.length>1&&this.E.push(new x(i[0].vv,i[i.length-1].vv))}for(r=0;r<n-1;r++){var l=e[r];for(a=r+1;a<n;a++){var u=e[a],c=k(l,u);for(var h in c){var d=c[h],f=l[d.t1],p=u[d.t2];this.addEdgeIfVisible(f,p,r,a)}}}}}return e.prototype.addEdgeIfVisible=function(e,t,n,r){this.intersectsPolys(new s(e.x,e.y,t.x,t.y),n,r)||this.E.push(new x(e.vv,t.vv))},e.prototype.addPoint=function(e,t){var n,r,i,a=this.P.length;this.V.push(new b(this.V.length,a,0,e));for(var o=0;o<a;++o)if(o!==t){var s=this.P[o],l=(n=e,i=void 0,(i=(r=s).slice(0)).push(r[0]),{rtan:d(n,i),ltan:f(n,i)});this.addEdgeIfVisible(e,s[l.ltan],t,o),this.addEdgeIfVisible(e,s[l.rtan],t,o)}return e.vv},e.prototype.intersectsPolys=function(e,t,n){for(var r=0,i=this.P.length;r<i;++r)if(r!=t&&r!=n&&E(e,this.P[r]).length>0)return!0;return!1},e}();function E(e,t){for(var n=[],r=1,i=t.length;r<i;++r){var o=a.Rectangle.lineIntersection(e.x1,e.y1,e.x2,e.y2,t[r-1].x,t[r-1].y,t[r].x,t[r].y);o&&n.push(o)}return n}function k(e,t){for(var n=e.length-1,r=t.length-1,i=new y,a=0;a<n;++a)for(var o=0;o<r;++o){var s=e[0==a?n-1:a-1],l=e[a],c=e[a+1],h=t[0==o?r-1:o-1],d=t[o],f=t[o+1],p=u(s,l,d),v=u(l,h,d),m=u(l,d,f),b=u(h,d,l),x=u(d,s,l),w=u(d,l,c);p>=0&&v>=0&&m<0&&b>=0&&x>=0&&w<0?i.ll=new g(a,o):p<=0&&v<=0&&m>0&&b<=0&&x<=0&&w>0?i.rr=new g(a,o):p<=0&&v>0&&m<=0&&b>=0&&x<0&&w>=0?i.rl=new g(a,o):p>=0&&v<0&&m>=0&&b<=0&&x>0&&w<=0&&(i.lr=new g(a,o))}return i}function _(e,t){return!e.every((function(e){return!function(e,t){for(var n=1,r=t.length;n<r;++n)if(h(t[n-1],t[n],e))return!1;return!0}(e,t)}))}t.TangentVisibilityGraph=w,t.tangents=k,t.polysOverlap=function(e,t){if(_(e,t))return!0;if(_(t,e))return!0;for(var n=1,r=e.length;n<r;++n){var i=e[n],a=e[n-1];if(E(new s(a.x,a.y,i.x,i.y),t).length>0)return!0}return!1}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=10,i=(1+Math.sqrt(5))/2,a=1e-4;t.applyPacking=function(e,t,n,o,s,l){void 0===s&&(s=1),void 0===l&&(l=!0);var u=t,c=n,h=(s=void 0!==s?s:1,o=void 0!==o?o:0,0),d=0,f=0,p=0,v=[];function g(e,t){v=[],h=0,d=0,p=0;for(var n=0;n<e.length;n++){y(e[n],t)}return Math.abs(h/d-s)}function y(e,t){for(var n=void 0,i=0;i<v.length;i++)if(v[i].space_left>=e.height&&v[i].x+v[i].width+e.width+r-t<=a){n=v[i];break}v.push(e),void 0!==n?(e.x=n.x+n.width+r,e.y=n.bottom,e.space_left=e.height,e.bottom=e.y,n.space_left-=e.height+r,n.bottom+=e.height+r):(e.y=p,p+=e.height+r,e.x=0,e.bottom=e.y,e.space_left=e.height),e.y+e.height-d>-a&&(d=e.y+e.height-0),e.x+e.width-h>-a&&(h=e.x+e.width-0)}0!=e.length&&(function(e){e.forEach((function(e){var t,n,r,i,a;t=e,n=Number.MAX_VALUE,r=Number.MAX_VALUE,i=0,a=0,t.array.forEach((function(e){var t=void 0!==e.width?e.width:o,s=void 0!==e.height?e.height:o;t/=2,s/=2,i=Math.max(e.x+t,i),n=Math.min(e.x-t,n),a=Math.max(e.y+s,a),r=Math.min(e.y-s,r)})),t.width=i-n,t.height=a-r}))}(e),function(e,t){var n=Number.POSITIVE_INFINITY,o=0;e.sort((function(e,t){return t.height-e.height})),f=e.reduce((function(e,t){return e.width<t.width?e.width:t.width}));var s=y=f,l=m=function(e){var t=0;return e.forEach((function(e){return t+=e.width+r})),t}(e),u=0,c=Number.MAX_VALUE,h=Number.MAX_VALUE,d=-1,p=Number.MAX_VALUE,v=Number.MAX_VALUE;for(;p>f||v>a;){if(1!=d){var y=l-(l-s)/i;c=g(e,y)}if(0!=d){var m=s+(l-s)/i;h=g(e,m)}if(p=Math.abs(y-m),v=Math.abs(c-h),c<n&&(n=c,o=y),h<n&&(n=h,o=m),c>h?(s=y,y=m,c=h,d=1):(l=m,m=y,h=c,d=0),u++>100)break}g(e,o)}(e),l&&function(e){e.forEach((function(e){var t={x:0,y:0};e.array.forEach((function(e){t.x+=e.x,t.y+=e.y})),t.x/=e.array.length,t.y/=e.array.length;var n=t.x-e.width/2,r=t.y-e.height/2,i=e.x-n+u/2-h/2,a=e.y-r+c/2-d/2;e.array.forEach((function(e){e.x+=i,e.y+=a}))}))}(e))},t.separateGraphs=function(e,t){for(var n={},r={},i=[],a=0,o=0;o<t.length;o++){var s=t[o],l=s.source,u=s.target;r[l.index]?r[l.index].push(u):r[l.index]=[u],r[u.index]?r[u.index].push(l):r[u.index]=[l]}for(o=0;o<e.length;o++){var c=e[o];n[c.index]||h(c,!0)}function h(e,t){if(void 0===n[e.index]){t&&(a++,i.push({array:[]})),n[e.index]=a,i[a-1].array.push(e);var o=r[e.index];if(o)for(var s=0;s<o.length;s++)h(o[s],!1)}}return i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(9),a=n(4),o=function(e,t,n){this.id=e,this.rect=t,this.children=n,this.leaf=void 0===n||0===n.length};t.NodeWrapper=o;var s=function(e,t,n,r,i){void 0===r&&(r=null),void 0===i&&(i=null),this.id=e,this.x=t,this.y=n,this.node=r,this.line=i};t.Vert=s;var l=function(){function e(t,n){this.s=t,this.t=n;var r=e.findMatch(t,n),i=n.slice(0).reverse(),a=e.findMatch(t,i);r.length>=a.length?(this.length=r.length,this.si=r.si,this.ti=r.ti,this.reversed=!1):(this.length=a.length,this.si=a.si,this.ti=n.length-a.ti-a.length,this.reversed=!0)}return e.findMatch=function(e,t){for(var n=e.length,r=t.length,i={length:0,si:-1,ti:-1},a=new Array(n),o=0;o<n;o++){a[o]=new Array(r);for(var s=0;s<r;s++)if(e[o]===t[s]){var l=a[o][s]=0===o||0===s?1:a[o-1][s-1]+1;l>i.length&&(i.length=l,i.si=o-l+1,i.ti=s-l+1)}else a[o][s]=0}return i},e.prototype.getSequence=function(){return this.length>=0?this.s.slice(this.si,this.si+this.length):[]},e}();t.LongestCommonSubsequence=l;var u=function(){function e(e,t,n){var i=this;void 0===n&&(n=12),this.originalnodes=e,this.groupPadding=n,this.leaves=null,this.nodes=e.map((function(e,n){return new o(n,t.getBounds(e),t.getChildren(e))})),this.leaves=this.nodes.filter((function(e){return e.leaf})),this.groups=this.nodes.filter((function(e){return!e.leaf})),this.cols=this.getGridLines("x"),this.rows=this.getGridLines("y"),this.groups.forEach((function(e){return e.children.forEach((function(t){return i.nodes[t].parent=e}))})),this.root={children:[]},this.nodes.forEach((function(e){void 0===e.parent&&(e.parent=i.root,i.root.children.push(e.id)),e.ports=[]})),this.backToFront=this.nodes.slice(0),this.backToFront.sort((function(e,t){return i.getDepth(e)-i.getDepth(t)})),this.backToFront.slice(0).reverse().filter((function(e){return!e.leaf})).forEach((function(e){var t=r.Rectangle.empty();e.children.forEach((function(e){return t=t.union(i.nodes[e].rect)})),e.rect=t.inflate(i.groupPadding)}));var a=this.midPoints(this.cols.map((function(e){return e.pos}))),l=this.midPoints(this.rows.map((function(e){return e.pos}))),u=a[0],c=a[a.length-1],h=l[0],d=l[l.length-1],f=this.rows.map((function(e){return{x1:u,x2:c,y1:e.pos,y2:e.pos}})).concat(l.map((function(e){return{x1:u,x2:c,y1:e,y2:e}}))),p=this.cols.map((function(e){return{x1:e.pos,x2:e.pos,y1:h,y2:d}})).concat(a.map((function(e){return{x1:e,x2:e,y1:h,y2:d}}))),v=f.concat(p);v.forEach((function(e){return e.verts=[]})),this.verts=[],this.edges=[],f.forEach((function(e){return p.forEach((function(t){var n=new s(i.verts.length,t.x1,e.y1);e.verts.push(n),t.verts.push(n),i.verts.push(n);for(var r=i.backToFront.length;r-- >0;){var a=i.backToFront[r],o=a.rect,l=Math.abs(n.x-o.cx()),u=Math.abs(n.y-o.cy());if(l<o.width()/2&&u<o.height()/2){n.node=a;break}}}))})),v.forEach((function(e,t){i.nodes.forEach((function(t,n){t.rect.lineIntersections(e.x1,e.y1,e.x2,e.y2).forEach((function(n,r){var a=new s(i.verts.length,n.x,n.y,t,e);i.verts.push(a),e.verts.push(a),t.ports.push(a)}))}));var n=Math.abs(e.y1-e.y2)<.1,r=function(e,t){return n?t.x-e.x:t.y-e.y};e.verts.sort(r);for(var a=1;a<e.verts.length;a++){var o=e.verts[a-1],l=e.verts[a];o.node&&o.node===l.node&&o.node.leaf||i.edges.push({source:o.id,target:l.id,length:Math.abs(r(o,l))})}}))}return e.prototype.avg=function(e){return e.reduce((function(e,t){return e+t}))/e.length},e.prototype.getGridLines=function(e){for(var t=[],n=this.leaves.slice(0,this.leaves.length);n.length>0;){var r=n.filter((function(t){return t.rect["overlap"+e.toUpperCase()](n[0].rect)})),i={nodes:r,pos:this.avg(r.map((function(t){return t.rect["c"+e]()})))};t.push(i),i.nodes.forEach((function(e){return n.splice(n.indexOf(e),1)}))}return t.sort((function(e,t){return e.pos-t.pos})),t},e.prototype.getDepth=function(e){for(var t=0;e.parent!==this.root;)t++,e=e.parent;return t},e.prototype.midPoints=function(e){for(var t=e[1]-e[0],n=[e[0]-t/2],r=1;r<e.length;r++)n.push((e[r]+e[r-1])/2);return n.push(e[e.length-1]+t/2),n},e.prototype.findLineage=function(e){var t=[e];do{e=e.parent,t.push(e)}while(e!==this.root);return t.reverse()},e.prototype.findAncestorPathBetween=function(e,t){for(var n=this.findLineage(e),r=this.findLineage(t),i=0;n[i]===r[i];)i++;return{commonAncestor:n[i-1],lineages:n.slice(i).concat(r.slice(i))}},e.prototype.siblingObstacles=function(e,t){var n=this,r=this.findAncestorPathBetween(e,t),i={};r.lineages.forEach((function(e){return i[e.id]={}}));var a=r.commonAncestor.children.filter((function(e){return!(e in i)}));return r.lineages.filter((function(e){return e.parent!==r.commonAncestor})).forEach((function(e){return a=a.concat(e.parent.children.filter((function(t){return t!==e.id})))})),a.map((function(e){return n.nodes[e]}))},e.getSegmentSets=function(e,t,n){for(var r=[],i=0;i<e.length;i++)for(var a=e[i],o=0;o<a.length;o++){(h=a[o]).edgeid=i,h.i=o;var s=h[1][t]-h[0][t];Math.abs(s)<.1&&r.push(h)}r.sort((function(e,n){return e[0][t]-n[0][t]}));for(var l=[],u=null,c=0;c<r.length;c++){var h=r[c];(!u||Math.abs(h[0][t]-u.pos)>.1)&&(u={pos:h[0][t],segments:[]},l.push(u)),u.segments.push(h)}return l},e.nudgeSegs=function(e,t,n,r,a,o){var s=r.length;if(!(s<=1)){for(var l=r.map((function(t){return new i.Variable(t[0][e])})),u=[],c=0;c<s;c++)for(var h=0;h<s;h++)if(c!==h){var d=r[c],f=r[h],p=d.edgeid,v=f.edgeid,g=-1,y=-1;"x"==e?a(p,v)&&(d[0][t]<d[1][t]?(g=h,y=c):(g=c,y=h)):a(p,v)&&(d[0][t]<d[1][t]?(g=c,y=h):(g=h,y=c)),g>=0&&u.push(new i.Constraint(l[g],l[y],o))}new i.Solver(l,u).solve(),l.forEach((function(t,i){var a=r[i],o=t.position();a[0][e]=a[1][e]=o;var s=n[a.edgeid];a.i>0&&(s[a.i-1][1][e]=o),a.i<s.length-1&&(s[a.i+1][0][e]=o)}))}},e.nudgeSegments=function(t,n,r,i,a){for(var o=e.getSegmentSets(t,n,r),s=0;s<o.length;s++){for(var l=o[s],u=[],c=0;c<l.segments.length;c++){var h=l.segments[c];u.push({type:0,s:h,pos:Math.min(h[0][r],h[1][r])}),u.push({type:1,s:h,pos:Math.max(h[0][r],h[1][r])})}u.sort((function(e,t){return e.pos-t.pos+e.type-t.type}));var d=[],f=0;u.forEach((function(o){0===o.type?(d.push(o.s),f++):f--,0==f&&(e.nudgeSegs(n,r,t,d,i,a),d=[])}))}},e.prototype.routeEdges=function(t,n,r,i){var a=this,o=t.map((function(e){return a.route(r(e),i(e))})),s=e.orderEdges(o),l=o.map((function(t){return e.makeSegments(t)}));return e.nudgeSegments(l,"x","y",s,n),e.nudgeSegments(l,"y","x",s,n),e.unreverseEdges(l,o),l},e.unreverseEdges=function(e,t){e.forEach((function(e,n){t[n].reversed&&(e.reverse(),e.forEach((function(e){e.reverse()})))}))},e.angleBetween2Lines=function(e,t){var n=Math.atan2(e[0].y-e[1].y,e[0].x-e[1].x),r=Math.atan2(t[0].y-t[1].y,t[0].x-t[1].x),i=n-r;return(i>Math.PI||i<-Math.PI)&&(i=r-n),i},e.isLeft=function(e,t,n){return(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x)<=0},e.getOrder=function(e){for(var t={},n=0;n<e.length;n++){var r=e[n];void 0===t[r.l]&&(t[r.l]={}),t[r.l][r.r]=!0}return function(e,n){return void 0!==t[e]&&t[e][n]}},e.orderEdges=function(t){for(var n=[],r=0;r<t.length-1;r++)for(var i=r+1;i<t.length;i++){var a,o,s,u=t[r],c=t[i],h=new l(u,c);0!==h.length&&(h.reversed&&(c.reverse(),c.reversed=!0,h=new l(u,c)),(h.si<=0||h.ti<=0)&&(h.si+h.length>=u.length||h.ti+h.length>=c.length)?n.push({l:r,r:i}):(h.si+h.length>=u.length||h.ti+h.length>=c.length?(a=u[h.si+1],s=u[h.si-1],o=c[h.ti-1]):(a=u[h.si+h.length-2],o=u[h.si+h.length],s=c[h.ti+h.length]),e.isLeft(a,o,s)?n.push({l:i,r:r}):n.push({l:r,r:i})))}return e.getOrder(n)},e.makeSegments=function(e){function t(e){return{x:e.x,y:e.y}}for(var n=function(e,t,n){return Math.abs((t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x))<.001},r=[],i=t(e[0]),a=1;a<e.length;a++){var o=t(e[a]),s=a<e.length-1?e[a+1]:null;s&&n(i,o,s)||(r.push([i,o]),i=o)}return r},e.prototype.route=function(e,t){var n=this,r=this.nodes[e],i=this.nodes[t];this.obstacles=this.siblingObstacles(r,i);var o={};this.obstacles.forEach((function(e){return o[e.id]=e})),this.passableEdges=this.edges.filter((function(e){var t=n.verts[e.source],r=n.verts[e.target];return!(t.node&&t.node.id in o||r.node&&r.node.id in o)}));for(var s=1;s<r.ports.length;s++){var l=r.ports[0].id,u=r.ports[s].id;this.passableEdges.push({source:l,target:u,length:0})}for(s=1;s<i.ports.length;s++){l=i.ports[0].id,u=i.ports[s].id;this.passableEdges.push({source:l,target:u,length:0})}var c=new a.Calculator(this.verts.length,this.passableEdges,(function(e){return e.source}),(function(e){return e.target}),(function(e){return e.length})).PathFromNodeToNodeWithPrevCost(r.ports[0].id,i.ports[0].id,(function(e,t,a){var o=n.verts[e],s=n.verts[t],l=n.verts[a],u=Math.abs(l.x-o.x),c=Math.abs(l.y-o.y);return o.node===r&&o.node===s.node||s.node===i&&s.node===l.node?0:u>1&&c>1?1e3:0})).reverse().map((function(e){return n.verts[e]}));return c.push(this.nodes[i.id].ports[0]),c.filter((function(e,t){return!(t<c.length-1&&c[t+1].node===r&&e.node===r||t>0&&e.node===i&&c[t-1].node===i)}))},e.getRoutePath=function(t,n,r,i){var a={routepath:"M "+t[0][0].x+" "+t[0][0].y+" ",arrowpath:""};if(t.length>1)for(var o=0;o<t.length;o++){var s=(x=t[o])[1].x,l=x[1].y,u=s-x[0].x,c=l-x[0].y;if(o<t.length-1){Math.abs(u)>0?s-=u/Math.abs(u)*n:l-=c/Math.abs(c)*n,a.routepath+="L "+s+" "+l+" ";var h=t[o+1],d=h[0].x,f=h[0].y;u=h[1].x-d,c=h[1].y-f;var p,v,g=e.angleBetween2Lines(x,h)<0?1:0;Math.abs(u)>0?(p=d+u/Math.abs(u)*n,v=f):(p=d,v=f+c/Math.abs(c)*n);var y=Math.abs(p-s),m=Math.abs(v-l);a.routepath+="A "+y+" "+m+" 0 0 "+g+" "+p+" "+v+" "}else{var b=[s,l];Math.abs(u)>0?(w=[s-=u/Math.abs(u)*i,l+r],E=[s,l-r]):(w=[s+r,l-=c/Math.abs(c)*i],E=[s-r,l]),a.routepath+="L "+s+" "+l+" ",i>0&&(a.arrowpath="M "+b[0]+" "+b[1]+" L "+w[0]+" "+w[1]+" L "+E[0]+" "+E[1])}}else{var x,w,E;s=(x=t[0])[1].x,l=x[1].y,u=s-x[0].x,c=l-x[0].y,b=[s,l];Math.abs(u)>0?(w=[s-=u/Math.abs(u)*i,l+r],E=[s,l-r]):(w=[s+r,l-=c/Math.abs(c)*i],E=[s-r,l]),a.routepath+="L "+s+" "+l+" ",i>0&&(a.arrowpath="M "+b[0]+" "+b[1]+" L "+w[0]+" "+w[1]+" L "+E[0]+" "+E[1])}return a},e}();t.GridRouter=u},function(e,n){e.exports=t},function(e,t,n){var r;r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([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(1),a=n(2),o=n(5)||("undefined"!=typeof window?window.cola:null),s=n(4),l=function(e){return(void 0===e?"undefined":r(e))===r(0)},u=function(){},c=function(e,t){var n;return null!=(n=e)&&(void 0===n?"undefined":r(n))===r((function(){}))?e.apply(t,[t]):e};function h(e){this.options=i({},a,e)}h.prototype.run=function(){var e=this,t=this.options;e.manuallyStopped=!1;var n=t.cy,i=t.eles,a=i.nodes(),h=i.edges(),d=!1,f=a.filter((function(e){return e.isParent()})),p=a.subtract(f),v=t.boundingBox||{x1:0,y1:0,w:n.width(),h:n.height()};void 0===v.x2&&(v.x2=v.x1+v.w),void 0===v.w&&(v.w=v.x2-v.x1),void 0===v.y2&&(v.y2=v.y1+v.h),void 0===v.h&&(v.h=v.y2-v.y1);var g=function(){for(var e=0;e<a.length;e++){var r=a[e],i=r.layoutDimensions(t),o=r.scratch("cola");if(!o.updatedDims){var s=c(t.nodeSpacing,r);o.width=i.w+2*s,o.height=i.h+2*s}}a.positions((function(e){var t=e.scratch().cola,n=void 0;return!e.grabbed()&&p.contains(e)&&(n={x:v.x1+t.x,y:v.y1+t.y},l(n.x)&&l(n.y)||(n=void 0)),n})),a.updateCompoundBounds(),d||(m(),d=!0),t.fit&&n.fit(t.padding)},y=function(){t.ungrabifyWhileSimulating&&w.grabify(),n.off("destroy",E),a.off("grab free position",k),a.off("lock unlock",_),e.one("layoutstop",t.stop),e.trigger({type:"layoutstop",layout:e})},m=function(){e.one("layoutready",t.ready),e.trigger({type:"layoutready",layout:e})},b=t.refresh;b=t.refresh<0?1:Math.max(1,b);var x=e.adaptor=o.adaptor({trigger:function(e){var n=o.EventType?o.EventType.tick:null,r=o.EventType?o.EventType.end:null;switch(e.type){case"tick":case n:t.animate&&g();break;case"end":case r:g(),t.infinite||y()}},kick:function(){var n=!0,r=function(){if(e.manuallyStopped)return y(),!0;var r=x.tick();return t.infinite||n||x.convergenceThreshold(t.convergenceThreshold),n=!1,r&&t.infinite&&x.resume(),r};if(t.animate)s((function e(){(function(){for(var e=void 0,t=0;t<b&&!e;t++)e=e||r();return e})()||s(e)}));else for(;!r(););},on:u,drag:u});e.adaptor=x;var w=a.filter(":grabbable");t.ungrabifyWhileSimulating&&w.ungrabify();var E=void 0;n.one("destroy",E=function(){e.stop()});var k=void 0;a.on("grab free position",k=function(e){var t=this.scratch().cola,n=this.position();if(e.cyTarget===this||e.target===this)switch(e.type){case"grab":x.dragstart(t);break;case"free":x.dragend(t);break;case"position":t.px===n.x-v.x1&&t.py===n.y-v.y1||(t.px=n.x-v.x1,t.py=n.y-v.y1)}});var _=void 0;a.on("lock unlock",_=function(){var e=this.scratch().cola;e.fixed=this.locked(),this.locked()?x.dragstart(e):x.dragend(e)}),x.nodes(p.map((function(e,n){var r=c(t.nodeSpacing,e),i=e.position(),a=e.layoutDimensions(t);return e.scratch().cola={x:t.randomize||void 0===i.x?Math.round(Math.random()*v.w):i.x,y:t.randomize||void 0===i.y?Math.round(Math.random()*v.h):i.y,width:a.w+2*r,height:a.h+2*r,index:n,fixed:e.locked()}})));var C=[];if(t.alignment){var S=[],P=[];p.forEach((function(e){var n=c(t.alignment,e),r=e.scratch().cola.index;n&&(null!=n.x&&S.push({node:r,offset:n.x}),null!=n.y&&P.push({node:r,offset:n.y}))})),S.length>0&&C.push({type:"alignment",axis:"x",offsets:S}),P.length>0&&C.push({type:"alignment",axis:"y",offsets:P})}t.gapInequalities&&t.gapInequalities.forEach((function(e){var t=e.left.scratch().cola.index,n=e.right.scratch().cola.index;C.push({axis:e.axis,left:t,right:n,gap:e.gap,equality:e.equality})})),C.length>0&&x.constraints(C),x.groups(f.map((function(e,n){var r=c(t.nodeSpacing,e),i=function(t){return parseFloat(e.style("padding-"+t))},a=i("left")+r,o=i("right")+r,s=i("top")+r,l=i("bottom")+r;return e.scratch().cola={index:n,padding:Math.max(a,o,s,l),leaves:e.children().intersection(p).map((function(e){return e[0].scratch().cola.index})),fixed:e.locked()},e})).map((function(e){return e.scratch().cola.groups=e.children().intersection(f).map((function(e){return e.scratch().cola.index})),e.scratch().cola})));var T,A=void 0,D=void 0;if(null!=t.edgeLength?(A=t.edgeLength,D="linkDistance"):null!=t.edgeSymDiffLength?(A=t.edgeSymDiffLength,D="symmetricDiffLinkLengths"):null!=t.edgeJaccardLength?(A=t.edgeJaccardLength,D="jaccardLinkLengths"):(A=100,D="linkDistance"),x.links(h.stdFilter((function(e){return p.contains(e.source())&&p.contains(e.target())})).map((function(e){var t=e.scratch().cola={source:e.source()[0].scratch().cola.index,target:e.target()[0].scratch().cola.index};return null!=A&&(t.calcLength=c(A,e)),t}))),x.size([v.w,v.h]),null!=A&&x[D]((function(e){return e.calcLength})),t.flow){var M=void 0;(void 0===(T=t.flow)?"undefined":r(T))===r("")?M={axis:t.flow,minSeparation:50}:l(t.flow)?M={axis:"y",minSeparation:t.flow}:function(e){return null!=e&&(void 0===e?"undefined":r(e))===r({})}(t.flow)?((M=t.flow).axis=M.axis||"y",M.minSeparation=null!=M.minSeparation?M.minSeparation:50):M={axis:"y",minSeparation:50},x.flowLayout(M.axis,M.minSeparation)}return e.trigger({type:"layoutstart",layout:e}),x.avoidOverlaps(t.avoidOverlap).handleDisconnected(t.handleDisconnected).start(t.unconstrIter,t.userConstIter,t.allConstIter),t.infinite||setTimeout((function(){e.manuallyStopped||x.stop()}),t.maxSimulationTime),this},h.prototype.stop=function(){return this.adaptor&&(this.manuallyStopped=!0,this.adaptor.stop()),this},e.exports=h},function(e,t,n){"use strict";e.exports=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.filter((function(e){return null!=e})).forEach((function(t){Object.keys(t).forEach((function(n){return e[n]=t[n]}))})),e}},function(e,t,n){"use strict";var r={animate:!0,refresh:1,maxSimulationTime:4e3,ungrabifyWhileSimulating:!1,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,ready:function(){},stop:function(){},randomize:!1,avoidOverlap:!0,handleDisconnected:!0,convergenceThreshold:.01,nodeSpacing:function(e){return 10},flow:void 0,alignment:void 0,gapInequalities:void 0,edgeLength:void 0,edgeSymDiffLength:void 0,edgeJaccardLength:void 0,unconstrIter:void 0,userConstIter:void 0,allConstIter:void 0,infinite:!1};e.exports=r},function(e,t,n){"use strict";var r=n(0),i=function(e){e&&e("layout","cola",r)};"undefined"!=typeof cytoscape&&i(cytoscape),e.exports=i},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=void 0;i="undefined"!==("undefined"==typeof window?"undefined":r(window))?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,16)}:function(e){e()},e.exports=i},function(t,n){t.exports=e}])},e.exports=r(n(30))},function(e,t,n){"use strict";var r,i;i=function(e){e&&e("core","cyCanvas",(function(e){var t=this,n=t.container(),r=document.createElement("canvas");n.appendChild(r);var i=Object.assign({},{zIndex:1,pixelRatio:"auto"},e);function a(){var e=n.offsetWidth,a=n.offsetHeight,o=e*i.pixelRatio,s=a*i.pixelRatio;r.width=o,r.height=s,r.style.width=e+"px",r.style.height=a+"px",t.trigger("cyCanvas.resize")}return"auto"===i.pixelRatio&&(i.pixelRatio=window.devicePixelRatio||1),t.on("resize",(function(){a()})),r.setAttribute("style","position:absolute; top:0; left:0; z-index:"+i.zIndex+";"),a(),{getCanvas:function(){return r},clear:function(e){var n=t.width(),r=t.height();e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,n*i.pixelRatio,r*i.pixelRatio),e.restore()},resetTransform:function(e){e.setTransform(1,0,0,1,0,0)},setTransform:function(e){var n=t.pan(),r=t.zoom();e.setTransform(1,0,0,1,0,0),e.translate(n.x*i.pixelRatio,n.y*i.pixelRatio),e.scale(r*i.pixelRatio,r*i.pixelRatio)}}}))},e.exports&&(e.exports=function(e){i(e)}),void 0===(r=function(){return i}.call(t,n,t,e))||(e.exports=r),"undefined"!=typeof cytoscape&&i(cytoscape)},function(e,t,n){var r=n(20);"string"==typeof r&&(r=[[e.i,r,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(22)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(21)(!0)).push([e.i,".service-dependency-graph-panel {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  flex-direction: column;\n}\n\n.graph-container {\n  width: 100%;\n  height: 100%;\n  display: flex;\n  flex-direction: row;\n}\n\n.service-dependency-graph {\n  position: relative;\n  flex-grow: 1;\n  min-width: 0;\n}\n\n.canvas-container {\n   width: 100%;\n   height: 100%;\n   overflow: hidden;\n}\n\n.zoom-button-container {\n  position: absolute;\n  top: 0;\n  right: 1rem;\n  z-index: 99;\n}\n\n.statistics {\n  flex-basis: 0;\n  transition: flex-basis 250ms ease-in-out;\n  overflow-y: scroll;\n  \n}\n\n.statistics.show {\n  flex-basis: 30rem;\n  padding-left: 0.5%;\n}\n\n.header--selection {\n  font-size: 1.25em;\n  text-align: center;\n  border-bottom: 2px solid #161719;\n  font-weight: 500;\n  color: rgb(216, 217, 218);\n}\n\n.secondHeader--selection {\n  font-size: 1.2em;\n  text-align: center;\n  padding-top: 1.5rem;\n  padding-bottom: 0.5rem;\n}\n\n.no-data--selection{\n  color: #888888;\n  text-align: center;\n}\n\n.table--selection {\n  width: 99%;\n  table-layout: fixed;\n}\n\n.table--selection th, .table--selection td {\n  padding: 3px 5px;\n}\n\n.table--selection tr {\n  border-bottom: 2px solid #161719;\n}\n\n.table--td--selection {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n\n.threshold--bad {\n  color:#f2495c;\n}\n\n.threshold--good {\n  color: #73bf69;\n}\n\n.table--th--selectionSmall {\n  width: 5.5rem;\n}\n\n.table--th--selectionMedium {\n  width: 8rem;\n}\n\n.table--selection--head {\n  background-color: #28282a;\n  border-top: 2px solid #161719;\n  color: #33b5e5;\n}\n\n\n","",{version:3,sources:["C:/_Development/Javascript/novatec-service-dependency-graph-panel/src/css/novatec-service-dependency-graph-panel.css"],names:[],mappings:"AAAA;EACE,cAAc;EACd,oBAAoB;EACpB,wBAAwB;EACxB,uBAAuB;CACxB;;AAED;EACE,YAAY;EACZ,aAAa;EACb,cAAc;EACd,oBAAoB;CACrB;;AAED;EACE,mBAAmB;EACnB,aAAa;EACb,aAAa;CACd;;AAED;GACG,YAAY;GACZ,aAAa;GACb,iBAAiB;CACnB;;AAED;EACE,mBAAmB;EACnB,OAAO;EACP,YAAY;EACZ,YAAY;CACb;;AAED;EACE,cAAc;EACd,yCAAyC;EACzC,mBAAmB;;CAEpB;;AAED;EACE,kBAAkB;EAClB,mBAAmB;CACpB;;AAED;EACE,kBAAkB;EAClB,mBAAmB;EACnB,iCAAiC;EACjC,iBAAiB;EACjB,0BAA0B;CAC3B;;AAED;EACE,iBAAiB;EACjB,mBAAmB;EACnB,oBAAoB;EACpB,uBAAuB;CACxB;;AAED;EACE,eAAe;EACf,mBAAmB;CACpB;;AAED;EACE,WAAW;EACX,oBAAoB;CACrB;;AAED;EACE,iBAAiB;CAClB;;AAED;EACE,iCAAiC;CAClC;;AAED;EACE,iBAAiB;EACjB,wBAAwB;EACxB,oBAAoB;CACrB;;AAED;EACE,cAAc;CACf;;AAED;EACE,eAAe;CAChB;;AAED;EACE,cAAc;CACf;;AAED;EACE,YAAY;CACb;;AAED;EACE,0BAA0B;EAC1B,8BAA8B;EAC9B,eAAe;CAChB",file:"novatec-service-dependency-graph-panel.css",sourcesContent:[".service-dependency-graph-panel {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  flex-direction: column;\n}\n\n.graph-container {\n  width: 100%;\n  height: 100%;\n  display: flex;\n  flex-direction: row;\n}\n\n.service-dependency-graph {\n  position: relative;\n  flex-grow: 1;\n  min-width: 0;\n}\n\n.canvas-container {\n   width: 100%;\n   height: 100%;\n   overflow: hidden;\n}\n\n.zoom-button-container {\n  position: absolute;\n  top: 0;\n  right: 1rem;\n  z-index: 99;\n}\n\n.statistics {\n  flex-basis: 0;\n  transition: flex-basis 250ms ease-in-out;\n  overflow-y: scroll;\n  \n}\n\n.statistics.show {\n  flex-basis: 30rem;\n  padding-left: 0.5%;\n}\n\n.header--selection {\n  font-size: 1.25em;\n  text-align: center;\n  border-bottom: 2px solid #161719;\n  font-weight: 500;\n  color: rgb(216, 217, 218);\n}\n\n.secondHeader--selection {\n  font-size: 1.2em;\n  text-align: center;\n  padding-top: 1.5rem;\n  padding-bottom: 0.5rem;\n}\n\n.no-data--selection{\n  color: #888888;\n  text-align: center;\n}\n\n.table--selection {\n  width: 99%;\n  table-layout: fixed;\n}\n\n.table--selection th, .table--selection td {\n  padding: 3px 5px;\n}\n\n.table--selection tr {\n  border-bottom: 2px solid #161719;\n}\n\n.table--td--selection {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n\n.threshold--bad {\n  color:#f2495c;\n}\n\n.threshold--good {\n  color: #73bf69;\n}\n\n.table--th--selectionSmall {\n  width: 5.5rem;\n}\n\n.table--th--selectionMedium {\n  width: 8rem;\n}\n\n.table--selection--head {\n  background-color: #28282a;\n  border-top: 2px solid #161719;\n  color: #33b5e5;\n}\n\n\n"],sourceRoot:""}])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var i=(o=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),a=r.sources.map((function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"}));return[n].concat(a).concat([i]).join("\n")}var o;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i<this.length;i++){var a=this[i][0];"number"==typeof a&&(r[a]=!0)}for(i=0;i<e.length;i++){var o=e[i];"number"==typeof o[0]&&r[o[0]]||(n&&!o[2]?o[2]=n:n&&(o[2]="("+o[2]+") and ("+n+")"),t.push(o))}},t}},function(e,t,n){var r,i,a={},o=(r=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=r.apply(this,arguments)),i}),s=function(e,t){return t?t.querySelector(e):document.querySelector(e)},l=function(e){var t={};return function(e,n){if("function"==typeof e)return e();if(void 0===t[e]){var r=s.call(this,e,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}}(),u=null,c=0,h=[],d=n(23);function f(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=a[r.id];if(i){i.refs++;for(var o=0;o<i.parts.length;o++)i.parts[o](r.parts[o]);for(;o<r.parts.length;o++)i.parts.push(b(r.parts[o],t))}else{var s=[];for(o=0;o<r.parts.length;o++)s.push(b(r.parts[o],t));a[r.id]={id:r.id,refs:1,parts:s}}}}function p(e,t){for(var n=[],r={},i=0;i<e.length;i++){var a=e[i],o=t.base?a[0]+t.base:a[0],s={css:a[1],media:a[2],sourceMap:a[3]};r[o]?r[o].parts.push(s):n.push(r[o]={id:o,parts:[s]})}return n}function v(e,t){var n=l(e.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=h[h.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),h.push(t);else if("bottom"===e.insertAt)n.appendChild(t);else{if("object"!=typeof e.insertAt||!e.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=l(e.insertAt.before,n);n.insertBefore(t,i)}}function g(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=h.indexOf(e);t>=0&&h.splice(t,1)}function y(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var r=function(){0;return n.nc}();r&&(e.attrs.nonce=r)}return m(t,e.attrs),v(e,t),t}function m(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function b(e,t){var n,r,i,a;if(t.transform&&e.css){if(!(a="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=a}if(t.singleton){var o=c++;n=u||(u=y(t)),r=E.bind(null,n,o,!1),i=E.bind(null,n,o,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",m(t,e.attrs),v(e,t),t}(t),r=_.bind(null,n,t),i=function(){g(n),n.href&&URL.revokeObjectURL(n.href)}):(n=y(t),r=k.bind(null,n),i=function(){g(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=o()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return f(n,t),function(e){for(var r=[],i=0;i<n.length;i++){var o=n[i];(s=a[o.id]).refs--,r.push(s)}e&&f(p(e,t),t);for(i=0;i<r.length;i++){var s;if(0===(s=r[i]).refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete a[s.id]}}}};var x,w=(x=[],function(e,t){return x[e]=t,x.filter(Boolean).join("\n")});function E(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=w(t,i);else{var a=document.createTextNode(i),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(a,o[t]):e.appendChild(a)}}function k(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function _(e,t,n){var r=n.css,i=n.sourceMap,a=void 0===t.convertToAbsoluteUrls&&i;(t.convertToAbsoluteUrls||a)&&(r=d(r)),i&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var o=new Blob([r],{type:"text/css"}),s=e.href;e.href=URL.createObjectURL(o),s&&URL.revokeObjectURL(s)}},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,r=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var i,a=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(a)?e:(i=0===a.indexOf("//")?a:0===a.indexOf("/")?n+a:r+a.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new a(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(25),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(6))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,a,o,s,l=1,u={},c=!1,h=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){a.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(e){var t=h.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):r=function(e){setTimeout(p,0,e)}:(o="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&p(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(o+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var i={callback:e,args:t};return u[l]=i,r(l),l++},d.clearImmediate=f}function f(e){delete u[e]}function p(e){if(c)setTimeout(p,0,e);else{var t=u[e];if(t){c=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{f(e),c=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(6),n(26))},function(e,t){var n,r,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var l,u=[],c=!1,h=-1;function d(){c&&l&&(c=!1,l.length?u=l.concat(u):h=-1,u.length&&f())}function f(){if(!c){var e=s(d);c=!0;for(var t=u.length;t;){for(l=u,u=[];++h<t;)l&&l[h].run();h=-1,t=u.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||c||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){(function(t){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt,s="object"==typeof t&&t&&t.Object===Object&&t,l="object"==typeof self&&self&&self.Object===Object&&self,u=s||l||Function("return this")(),c=Object.prototype.toString,h=Math.max,d=Math.min,f=function(){return u.Date.now()};function p(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==c.call(e)}(e))return NaN;if(p(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=p(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var s=i.test(e);return s||a.test(e)?o(e.slice(2),s?2:8):r.test(e)?NaN:+e}e.exports=function(e,t,n){var r,i,a,o,s,l,u=0,c=!1,g=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function m(t){var n=r,a=i;return r=i=void 0,u=t,o=e.apply(a,n)}function b(e){return u=e,s=setTimeout(w,t),c?m(e):o}function x(e){var n=e-l;return void 0===l||n>=t||n<0||g&&e-u>=a}function w(){var e=f();if(x(e))return E(e);s=setTimeout(w,function(e){var n=t-(e-l);return g?d(n,a-(e-u)):n}(e))}function E(e){return s=void 0,y&&r?m(e):(r=i=void 0,o)}function k(){var e=f(),n=x(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return b(l);if(g)return s=setTimeout(w,t),m(l)}return void 0===s&&(s=setTimeout(w,t)),o}return t=v(t)||0,p(n)&&(c=!!n.leading,a=(g="maxWait"in n)?h(v(n.maxWait)||0,t):a,y="trailing"in n?!!n.trailing:y),k.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},k.flush=function(){return void 0===s?o:E(f())},k}}).call(this,n(6))},function(e,t,n){e.exports=n(29)},function(e,t,n){var r,i,a;(function(){var n,o,s,l,u,c,h,d,f,p,v,g,y,m,b;s=Math.floor,p=Math.min,o=function(e,t){return e<t?-1:e>t?1:0},f=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);n<r;)i(t,e[a=s((n+r)/2)])<0?r=a:n=a+1;return[].splice.apply(e,[n,n-n].concat(t)),t},c=function(e,t,n){return null==n&&(n=o),e.push(t),m(e,0,e.length-1,n)},u=function(e,t){var n,r;return null==t&&(t=o),n=e.pop(),e.length?(r=e[0],e[0]=n,b(e,0,t)):r=n,r},d=function(e,t,n){var r;return null==n&&(n=o),r=e[0],e[0]=t,b(e,0,n),r},h=function(e,t,n){var r;return null==n&&(n=o),e.length&&n(e[0],t)<0&&(t=(r=[e[0],t])[0],e[0]=r[1],b(e,0,n)),t},l=function(e,t){var n,r,i,a,l,u;for(null==t&&(t=o),l=[],r=0,i=(a=function(){u=[];for(var t=0,n=s(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;r<i;r++)n=a[r],l.push(b(e,n,t));return l},y=function(e,t,n){var r;if(null==n&&(n=o),-1!==(r=e.indexOf(t)))return m(e,0,r,n),b(e,r,n)},v=function(e,t,n){var r,i,a,s,u;if(null==n&&(n=o),!(i=e.slice(0,t)).length)return i;for(l(i,n),a=0,s=(u=e.slice(t)).length;a<s;a++)r=u[a],h(i,r,n);return i.sort(n).reverse()},g=function(e,t,n){var r,i,a,s,c,h,d,v,g;if(null==n&&(n=o),10*t<=e.length){if(!(a=e.slice(0,t).sort(n)).length)return a;for(i=a[a.length-1],s=0,h=(d=e.slice(t)).length;s<h;s++)n(r=d[s],i)<0&&(f(a,r,0,null,n),a.pop(),i=a[a.length-1]);return a}for(l(e,n),g=[],c=0,v=p(t,e.length);0<=v?c<v:c>v;0<=v?++c:--c)g.push(u(e,n));return g},m=function(e,t,n,r){var i,a,s;for(null==r&&(r=o),i=e[n];n>t&&r(i,a=e[s=n-1>>1])<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<i;)(s=r+1)<i&&!(n(e[r],e[s])<0)&&(r=s),e[t]=e[r],r=2*(t=r)+1;return e[t]=a,m(e,l,t,n)},n=function(){function e(e){this.cmp=null!=e?e:o,this.nodes=[]}return e.push=c,e.pop=u,e.replace=d,e.pushpop=h,e.heapify=l,e.updateItem=y,e.nlargest=v,e.nsmallest=g,e.prototype.push=function(e){return c(this.nodes,e,this.cmp)},e.prototype.pop=function(){return u(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return d(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return h(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return l(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return y(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),i=[],void 0===(a="function"==typeof(r=function(){return n})?r.apply(t,i):r)||(e.exports=a)}).call(this)},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(31)),r(n(32)),r(n(8)),r(n(13)),r(n(15)),r(n(14)),r(n(2)),r(n(35)),r(n(7)),r(n(10)),r(n(12)),r(n(11)),r(n(3)),r(n(4)),r(n(9)),r(n(36))},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=function(e){function t(t){var n=e.call(this)||this,r=t;return r.trigger&&(n.trigger=r.trigger),r.kick&&(n.kick=r.kick),r.drag&&(n.drag=r.drag),r.on&&(n.on=r.on),n.dragstart=n.dragStart=a.Layout.dragStart,n.dragend=n.dragEnd=a.Layout.dragEnd,n}return i(t,e),t.prototype.trigger=function(e){},t.prototype.kick=function(){},t.prototype.drag=function(){},t.prototype.on=function(e,t){return this},t}(a.Layout);t.LayoutAdaptor=o,t.adaptor=function(e){return new o(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(33),i=n(34);t.d3adaptor=function(e){return!e||function(e){return e.version&&null!==e.version.match(/^3\./)}(e)?new r.D3StyleLayoutAdaptor:new i.D3StyleLayoutAdaptor(e)}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=function(e){function t(){var t=e.call(this)||this;t.event=d3.dispatch(a.EventType[a.EventType.start],a.EventType[a.EventType.tick],a.EventType[a.EventType.end]);var n=t;return t.drag=function(){if(!e)var e=d3.behavior.drag().origin(a.Layout.dragOrigin).on("dragstart.d3adaptor",a.Layout.dragStart).on("drag.d3adaptor",(function(e){a.Layout.drag(e,d3.event),n.resume()})).on("dragend.d3adaptor",a.Layout.dragEnd);if(!arguments.length)return e;this.call(e)},t}return i(t,e),t.prototype.trigger=function(e){var t={type:a.EventType[e.type],alpha:e.alpha,stress:e.stress};this.event[t.type](t)},t.prototype.kick=function(){var t=this;d3.timer((function(){return e.prototype.tick.call(t)}))},t.prototype.on=function(e,t){return"string"==typeof e?this.event.on(e,t):this.event.on(a.EventType[e],t),this},t}(a.Layout);t.D3StyleLayoutAdaptor=o,t.d3adaptor=function(){return new o}},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=function(e){function t(t){var n=e.call(this)||this;n.d3Context=t,n.event=t.dispatch(a.EventType[a.EventType.start],a.EventType[a.EventType.tick],a.EventType[a.EventType.end]);var r=n;return n.drag=function(){if(!e)var e=t.drag().subject(a.Layout.dragOrigin).on("start.d3adaptor",a.Layout.dragStart).on("drag.d3adaptor",(function(e){a.Layout.drag(e,t.event),r.resume()})).on("end.d3adaptor",a.Layout.dragEnd);if(!arguments.length)return e;arguments[0].call(e)},n}return i(t,e),t.prototype.trigger=function(e){var t={type:a.EventType[e.type],alpha:e.alpha,stress:e.stress};this.event.call(t.type,t)},t.prototype.kick=function(){var t=this,n=this.d3Context.timer((function(){return e.prototype.tick.call(t)&&n.stop()}))},t.prototype.on=function(e,t){return"string"==typeof e?this.event.on(e,t):this.event.on(a.EventType[e],t),this},t}(a.Layout);t.D3StyleLayoutAdaptor=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),i=n(8),a=n(3),o=n(7),s=function(){function e(e,t){this.source=e,this.target=t}return e.prototype.actualLength=function(e){var t=this;return Math.sqrt(e.reduce((function(e,n){var r=n[t.target]-n[t.source];return e+r*r}),0))},e}();t.Link3D=s;var l=function(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=0),this.x=e,this.y=t,this.z=n};t.Node3D=l;var u=function(){function e(t,n,r){var i=this;void 0===r&&(r=1),this.nodes=t,this.links=n,this.idealLinkLength=r,this.constraints=null,this.useJaccardLinkLengths=!0,this.result=new Array(e.k);for(var a=0;a<e.k;++a)this.result[a]=new Array(t.length);t.forEach((function(t,n){for(var r=0,a=e.dims;r<a.length;r++){var o=a[r];void 0===t[o]&&(t[o]=Math.random())}i.result[0][n]=t.x,i.result[1][n]=t.y,i.result[2][n]=t.z}))}return e.prototype.linkLength=function(e){return e.actualLength(this.result)},e.prototype.start=function(e){var t=this;void 0===e&&(e=100);var n=this.nodes.length,s=new c;this.useJaccardLinkLengths&&o.jaccardLinkLengths(this.links,s,1.5),this.links.forEach((function(e){return e.length*=t.idealLinkLength}));var l=new r.Calculator(n,this.links,(function(e){return e.source}),(function(e){return e.target}),(function(e){return e.length})).DistanceMatrix(),u=i.Descent.createSquareMatrix(n,(function(e,t){return l[e][t]})),h=i.Descent.createSquareMatrix(n,(function(){return 2}));this.links.forEach((function(e){var t=e.source,n=e.target;return h[t][n]=h[n][t]=1})),this.descent=new i.Descent(this.result,u),this.descent.threshold=.001,this.descent.G=h,this.constraints&&(this.descent.project=new a.Projection(this.nodes,null,null,this.constraints).projectFunctions());for(var d=0;d<this.nodes.length;d++){var f=this.nodes[d];f.fixed&&this.descent.locks.add(d,[f.x,f.y,f.z])}return this.descent.run(e),this},e.prototype.tick=function(){this.descent.locks.clear();for(var e=0;e<this.nodes.length;e++){var t=this.nodes[e];t.fixed&&this.descent.locks.add(e,[t.x,t.y,t.z])}return this.descent.rungeKutta()},e.dims=["x","y","z"],e.k=e.dims.length,e}();t.Layout3D=u;var c=function(){function e(){}return e.prototype.getSourceIndex=function(e){return e.source},e.prototype.getTargetIndex=function(e){return e.target},e.prototype.getLength=function(e){return e.length},e.prototype.setLength=function(e,t){e.length=t},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),i=n(15);t.gridify=function(e,t,n,r){return e.cola.start(0,0,0,10,!1),function(e,t,n,r){e.forEach((function(e){e.routerNode={name:e.name,bounds:e.bounds.inflate(-n)}})),t.forEach((function(t){t.routerNode={bounds:t.bounds.inflate(-r),children:(void 0!==t.groups?t.groups.map((function(t){return e.length+t.id})):[]).concat(void 0!==t.leaves?t.leaves.map((function(e){return e.index})):[])}}));var a=e.concat(t).map((function(e,t){return e.routerNode.id=t,e.routerNode}));return new i.GridRouter(a,{getChildren:function(e){return e.children},getBounds:function(e){return e.bounds}},n-r)}(e.cola.nodes(),e.cola.groups(),n,r).routeEdges(e.powerGraph.powerEdges,t,(function(e){return e.source.routerNode.id}),(function(e){return e.target.routerNode.id}))},t.powerGraphGridLayout=function(e,t,n){var i;e.nodes.forEach((function(e,t){return e.index=t})),(new r.Layout).avoidOverlaps(!1).nodes(e.nodes).links(e.links).powerGraphGroups((function(e){(i=e).groups.forEach((function(e){return e.padding=n}))}));var a=e.nodes.length,o=[],s=e.nodes.slice(0);return s.forEach((function(e,t){return e.index=t})),i.groups.forEach((function(e){var t=e.index=e.id+a;s.push(e),void 0!==e.leaves&&e.leaves.forEach((function(e){return o.push({source:t,target:e.index})})),void 0!==e.groups&&e.groups.forEach((function(e){return o.push({source:t,target:e.id+a})}))})),i.powerEdges.forEach((function(e){o.push({source:e.source.index,target:e.target.index})})),(new r.Layout).size(t).nodes(s).links(o).avoidOverlaps(!1).linkDistance(30).symmetricDiffLinkLengths(5).convergenceThreshold(1e-4).start(100,0,0,0,!1),{cola:(new r.Layout).convergenceThreshold(.001).size(t).avoidOverlaps(!0).nodes(e.nodes).links(e.links).groupCompactness(1e-4).linkDistance(30).symmetricDiffLinkLengths(5).powerGraphGroups((function(e){(i=e).groups.forEach((function(e){e.padding=n}))})).start(50,0,100,0,!1),powerGraph:i}}},function(e,t,n){"use strict";u.$inject=["$q","uiSegmentSrv"],n.r(t),n.d(t,"PanelCtrl",(function(){return Y}));var r=n(16),i=n(0),a=n.n(i);function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"panel",void 0),s(this,"controller",void 0),s(this,"colorModes",void 0),s(this,"serviceIcons",[]),t.editor=this,this.controller=t.ctrl,this.panel=this.controller.panel,this.render=this.render.bind(this),this.getColumnNames=this.getColumnNames.bind(this),this.getPrefixCandidates=this.getPrefixCandidates.bind(this),this.addExternalMapping=this.addExternalMapping.bind(this),this.removeExternalMapping=this.removeExternalMapping.bind(this),fetch(this.controller.getAssetUrl("service_icons/icon_index.json")).then((function(e){return e.json()})).then((function(e){e.sort(),n.serviceIcons=e})).catch((function(){console.error('Could not load service icons mapping index. Please verify the "icon_index.json" in the plugin\'s asset directory.')}))}var t,n,r;return e.$inject=["$scope"],t=e,(n=[{key:"addExternalMapping",value:function(){this.panel.settings.externalIcons.push({name:"my-type",filename:"default"}),this.controller.render()}},{key:"removeExternalMapping",value:function(e){this.panel.settings.externalIcons.splice(e,1),this.controller.render()}},{key:"getExternalIconOptions",value:function(){return["default","message","database","http","web","balancer","ldap","mainframe","smtp","ftp"]}},{key:"addServiceMapping",value:function(){this.panel.settings.serviceIcons.push({pattern:"my-type",filename:"default"}),this.controller.render()}},{key:"removeServiceMapping",value:function(e){this.panel.settings.serviceIcons.splice(e,1),this.controller.render()}},{key:"getServiceIconOptions",value:function(){return this.serviceIcons}},{key:"getColumnNames",value:function(){var e=this.controller.currentData;return e?Object(i.sortBy)(e.columnNames):[]}},{key:"getTraceBackend",value:function(){return["http://localhost:9411/zipkin/?serviceName={}","http://localhost:9411/zipkin/?serviceName={}&lookback=custom&startTs=[[__from]]&endTs=[[__to]]","http://localhost:16686/search?service={}&end=[[__to]]&limit=20&lookback=custom&start=[[__from]]"]}},{key:"getPrefixCandidates",value:function(){var e=a.a.find(this.controller.dashboard.templating.list,{name:"aggregationType"}).current.value,t=this.controller.currentData;return t?a()(t.columnNames).filter((function(t){return t.includes(e)})).map((function(t){return t.slice(0,-e.length)})).value():[]}},{key:"render",value:function(){this.controller.graphCanvas.resetAssets(),this.controller.render()}}])&&o(t.prototype,n),r&&o(t,r),e}();function u(e,t){return{restrict:"E",scope:!0,templateUrl:"public/plugins/novatec-sdg-panel/partials/options.html",controller:l}}n(19);function c(e){return null!=e}var h,d,f=function(e,t){var n=a.a.find(e.dashboard.templating.list,{name:t});return n?n.current.value:void 0},p=function(e,t){return e.panel.settings.dataMapping[t]};function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}!function(e){e.SELF="SELF",e.INTERNAL="INTERNAL",e.EXTERNAL_OUT="EXTERNAL_OUT",e.EXTERNAL_IN="EXTERNAL_IN"}(h||(h={})),function(e){e.INTERNAL="INTERNAL",e.EXTERNAL="EXTERNAL"}(d||(d={}));var m=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),y(this,"controller",void 0),this.controller=t}var t,n,r;return t=e,(n=[{key:"_transformTable",value:function(e){return Object(i.map)(e.rows,(function(t){for(var n={},r=0;r<t.length;r++)""!==t[r]&&(n[e.columns[r].text]=t[r]);return n}))}},{key:"_transformTables",value:function(e){var t=this;return Object(i.map)(e,(function(e){return t._transformTable(e)}))}},{key:"_transformObjects",value:function(e){var t=this.controller.getSettings().dataMapping,n=t.extOrigin,r=t.extTarget,a=t.sourceComponentPrefix,o=t.targetComponentPrefix,s=f(this.controller,"aggregationType"),l=a+s,u=o+s;return Object(i.map)(e,(function(e){var t=Object(i.has)(e,l),a=Object(i.has)(e,u),o=Object(i.has)(e,n),c=Object(i.has)(e,r),d=[t,a,o,c].filter((function(e){return e})).length;if(d>1)if(a&&c)a=!1;else{if(!t||!o)return void console.error("soruce-target conflict for data element",e);t=!1}var f={target:"",data:e,type:h.INTERNAL};return 0==d?(f.target=e[s],f.type=h.EXTERNAL_IN):t||a?(t?(f.source=e[l],f.target=e[s]):(f.source=e[s],f.target=e[u]),f.source===f.target&&(f.type=h.SELF)):o?(f.source=e[n],f.target=e[s],f.type=h.EXTERNAL_IN):c&&(f.source=e[s],f.target=e[r],f.type=h.EXTERNAL_OUT),f})).filter((function(e){return null!==e}))}},{key:"_mergeGraphData",value:function(e){var t=Object(i.values)(Object(i.groupBy)(e,(function(e){return e.source+"<---\x3e"+e.target})));return Object(i.map)(t,(function(e){return Object(i.reduce)(e,(function(e,t){return Object(i.merge)(e,t)}),{})}))}},{key:"_cleanMetaData",value:function(e,t){var n={};return Object(i.forOwn)(e,(function(e,r){Object(i.has)(t,e)&&(n[r]=t[e])})),n}},{key:"_cleanData",value:function(e){var t=this,n={};return n.response_time_in=p(this.controller,"responseTimeColumn"),n.rate_in=p(this.controller,"requestRateColumn"),n.error_rate_in=p(this.controller,"errorRateColumn"),n.response_time_out=p(this.controller,"responseTimeOutgoingColumn"),n.rate_out=p(this.controller,"requestRateOutgoingColumn"),n.error_rate_out=p(this.controller,"errorRateOutgoingColumn"),n.type=p(this.controller,"type"),n.threshold=p(this.controller,"baselineRtUpper"),Object(i.map)(e,(function(e){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},e,{data:t._cleanMetaData(n,e.data)})}))}},{key:"_extractColumnNames",value:function(e){return a()(e).flatMap((function(e){return Object(i.keys)(e.data)})).uniq().sort().value()}},{key:"processData",value:function(e){var t=this._transformTables(e),n=Object(i.flattenDeep)(t),r=this._transformObjects(n),a=this._mergeGraphData(r),o=this._extractColumnNames(a),s=this._cleanData(a);return console.groupCollapsed("Data transformation log"),console.log("Transform tables:",t),console.log("Flat data:",n),console.log("Graph elements:",r),console.log("Merged graph data:",a),console.log("Cleaned data:",s),console.log("Table columns:",o),console.groupEnd(),{graph:s,raw:e,columnNames:o}}}])&&g(t.prototype,n),r&&g(t,r),e}();function b(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var x=function(){function e(t){var n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i=void 0,(r="controller")in(n=this)?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,this.controller=t}var t,n,r;return t=e,(n=[{key:"_createNode",value:function(e){if(e&&!(e.length<=0)){var t=this.controller.getSettings().sumTimings,n=e[0].target,r=Object(i.some)(e,["type",h.INTERNAL])||Object(i.some)(e,["type",h.EXTERNAL_IN]),o={},s={name:n,type:r?d.INTERNAL:d.EXTERNAL,metrics:o},l=t?i.sum:i.mean;if(r){o.rate=Object(i.sum)(Object(i.map)(e,(function(e){return e.data.rate_in}))),o.error_rate=Object(i.sum)(Object(i.map)(e,(function(e){return e.data.error_rate_in})));var u=Object(i.map)(e,(function(e){return e.data.response_time_in})).filter(c);u.length>0&&(o.response_time=l(u))}else{o.rate=Object(i.sum)(Object(i.map)(e,(function(e){return e.data.rate_out}))),o.error_rate=Object(i.sum)(Object(i.map)(e,(function(e){return e.data.error_rate_out})));var f=Object(i.map)(e,(function(e){return e.data.response_time_out})).filter(c);f.length>0&&(o.response_time=l(f));var p=a()(e).map((function(e){return e.data.type})).uniq().value();1==p.length&&(s.external_type=p[0])}if(o.threshold=a()(e).map((function(e){return e.data.threshold})).filter().mean(),t){var v=Object(i.defaultTo)(o.rate,0)+Object(i.defaultTo)(o.error_rate,0),g=Object(i.defaultTo)(o.response_time,-1);v>0&&g>=0&&(o.response_time=g/v)}var y=o.rate,m=o.error_rate;return o.success_rate=y+m>0?1/(y+m)*y:1,s}}},{key:"_createMissingNodes",value:function(e,t){var n=Object(i.map)(t,(function(e){return e.name})),r=Object(i.uniq)(Object(i.flatMap)(e,(function(e){return[e.source,e.target]}))).filter(c),a=Object(i.difference)(r,n);return Object(i.map)(a,(function(t){var n,r,a=Object(i.find)(e,{source:t}),o=Object(i.find)(e,{target:t});return a&&a.type==h.EXTERNAL_IN?(n=d.EXTERNAL,r=a.data.type):o&&o.type==h.EXTERNAL_OUT?(n=d.EXTERNAL,r=o.data.type):n=d.INTERNAL,{name:t,type:n,external_type:r}}))}},{key:"_createNodes",value:function(e){var t=this,n=Object(i.filter)(e,(function(e){return e.source!==e.target})),r=Object(i.groupBy)(n,"target"),a=Object(i.map)(r,(function(e){return t._createNode(e)})).filter(c),o=this._createMissingNodes(n,a);return Object(i.concat)(a,o)}},{key:"_createEdge",value:function(e){var t=e.source,n=e.target;if(void 0!==t&&void 0!==n){var r={},a={source:t,target:n,metrics:r},o=e.data,s=o.rate_out,l=o.rate_in,u=o.error_rate_out,c=o.response_time_out;return Object(i.isUndefined)(s)?Object(i.isUndefined)(l)||(r.rate=l):r.rate=s,Object(i.isUndefined)(u)||(r.error_rate=u),Object(i.isUndefined)(c)||(this.controller.getSettings().sumTimings&&r.rate?r.response_time=c/r.rate:r.response_time=c),a}console.error("source and target are necessary to create an edge",e)}},{key:"_createEdges",value:function(e){var t=this,n=a()(e).filter((function(e){return!!e.source})).filter((function(e){return e.source!==e.target})).value();return Object(i.map)(n,(function(e){return t._createEdge(e)})).filter(c)}},{key:"_filterData",value:function(e){if(this.controller.getSettings().filterEmptyConnections){var t={nodes:[],edges:[]};return t.edges=Object(i.filter)(e.edges,(function(e){return Object(i.size)(e.metrics)>0})),t.nodes=Object(i.filter)(e.nodes,(function(t){var n=t.name;if(Object(i.some)(e.edges,{source:n})||Object(i.some)(e.edges,{target:n}))return!0;var r=t.metrics;return!!r&&(Object(i.defaultTo)(r.rate,-1)>=0||Object(i.defaultTo)(r.error_rate,-1)>=0||Object(i.defaultTo)(r.response_time,-1)>=0)})),t}return e}},{key:"generateGraph",value:function(e){var t=this._createNodes(e),n=this._createEdges(e),r={nodes:t,edges:n},i=this._filterData(r);return console.groupCollapsed("Graph generated"),console.log("Input data:",e),console.log("Nodes:",t),console.log("Edges:",n),console.log("Filtered graph",i),console.groupEnd(),i}}])&&b(t.prototype,n),r&&b(t,r),e}();function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var k=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),E(this,"drawer",void 0),E(this,"maxVolume",1e3),E(this,"minSpawnPropability",.01),E(this,"spawnInterval",void 0),this.drawer=t}var t,n,r;return t=e,(n=[{key:"start",value:function(){if(!this.spawnInterval){var e=this;this.spawnInterval=setInterval((function(){return e._spawnParticles()}),100)}}},{key:"stop",value:function(){this.spawnInterval&&(clearInterval(this.spawnInterval),this.spawnInterval=null)}},{key:"_spawnParticles",value:function(){var e=this,t=this.drawer.cytoscape,n=Date.now();t.edges().forEach((function(t){var r=t.data("particles"),a=t.data("metrics");if(a){var o,s=Object(i.defaultTo)(a.rate,0),l=Object(i.defaultTo)(a.error_rate,0),u=s+l;if(o=s>=0&&l>=0?l/s:0,void 0===r&&(r={normal:[],danger:[]},t.data("particles",r)),a&&u>0)for(var c=Math.min(u/e.maxVolume,1),h=0;h<5;h++)if(Math.random()<=c+e.minSpawnPropability){var d={velocity:.05+.05*Math.random(),startTime:n};Math.random()<o?r.danger.push(d):r.normal.push(d)}}}))}},{key:"count",value:function(){var e=this.drawer.cytoscape,t=a()(e.edges()).map((function(e){return e.data("particles")})).filter().map((function(e){return e.normal.length+e.danger.length})).sum();return t}}])&&w(t.prototype,n),r&&w(t,r),e}(),_=n(1),C=n.n(_);function S(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var T=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),P(this,"colors",{default:"#bad5ed",background:"#212121",edge:"#505050",status:{warning:"orange"}}),P(this,"donutRadius",15),P(this,"controller",void 0),P(this,"cytoscape",void 0),P(this,"context",void 0),P(this,"cyCanvas",void 0),P(this,"canvas",void 0),P(this,"offscreenCanvas",void 0),P(this,"offscreenContext",void 0),P(this,"frameCounter",0),P(this,"fpsCounter",0),P(this,"particleImage",void 0),P(this,"pixelRatio",void 0),P(this,"imageAssets",{}),P(this,"selectionNeighborhood",void 0),P(this,"particleEngine",void 0),P(this,"lastRenderTime",0),P(this,"dashAnimationOffset",0),P(this,"timeScale",void 0),this.cytoscape=n,this.cyCanvas=r,this.controller=t,this.particleEngine=new k(this),this.pixelRatio=window.devicePixelRatio||1,this.canvas=r.getCanvas();var i=this.canvas.getContext("2d");i?this.context=i:console.error("Could not get 2d canvas context."),this.offscreenCanvas=document.createElement("canvas"),this.offscreenContext=this.offscreenCanvas.getContext("2d"),this.timeScale=new C.a.Scale({ms:1,s:1e3,min:6e4})}var t,n,r;return t=e,(n=[{key:"resetAssets",value:function(){this.imageAssets={}}},{key:"_loadImage",value:function(e,t){var n,r,i,a=this;(n=e,r=t,i=new Image,a.imageAssets[r]={image:i,loaded:!1},new Promise((function(e,t){i.onload=function(){return e(r)},i.onerror=function(){return t(new Error("load ".concat(n," fail")))},i.src=n}))).then((function(e){a.imageAssets[e].loaded=!0}))}},{key:"_isImageLoaded",value:function(e){return!(!a.a.has(this.imageAssets,e)||!this.imageAssets[e].loaded)}},{key:"_getImageAsset",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!a.a.has(this.imageAssets,e)){var n=this.controller.getTypeSymbol(e,t);this._loadImage(n,e)}return this._isImageLoaded(e)?this.imageAssets[e].image:null}},{key:"_getAsset",value:function(e,t){if(!a.a.has(this.imageAssets,e)){var n=this.controller.getAssetUrl(t);this._loadImage(n,e)}return this._isImageLoaded(e)?this.imageAssets[e].image:null}},{key:"start",value:function(){console.log("Starting graph logic");var e=this;window.requestAnimationFrame((function t(){e.repaint(),window.requestAnimationFrame(t)})),setInterval((function(){e.fpsCounter=e.frameCounter,e.frameCounter=0}),1e3)}},{key:"startAnimation",value:function(){this.particleEngine.start()}},{key:"stopAnimation",value:function(){this.particleEngine.stop()}},{key:"_skipFrame",value:function(){var e=Date.now()-this.lastRenderTime;return!(this.particleEngine.count()>0)&&!this.controller.panel.settings.animate&&e<1e3}},{key:"repaint",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(t||!this._skipFrame()){this.lastRenderTime=Date.now();var n=this.context,r=this.cyCanvas,i=this.offscreenCanvas,a=this.offscreenContext;i.width=this.canvas.width,i.height=this.canvas.height,this._setTransformation(a),this.selectionNeighborhood=this.cytoscape.collection();var o=this.cytoscape.$(":selected");o.forEach((function(t){if(e.selectionNeighborhood.merge(t),t.isNode()){var n=t.neighborhood();e.selectionNeighborhood.merge(n)}else{var r=t.source(),i=t.target();e.selectionNeighborhood.merge(r),e.selectionNeighborhood.merge(i)}})),this._drawEdgeAnimation(a),this._drawNodes(a),r.clear(n),this.controller.getSettings().showDebugInformation&&this._drawDebugInformation(),i.width>0&&i.height>0&&n.drawImage(i,0,0),this.dashAnimationOffset=Date.now()%6e4/250}}},{key:"_setTransformation",value:function(e){var t=this.cytoscape.pan(),n=this.cytoscape.zoom();e.setTransform(1,0,0,1,0,0),e.translate(t.x*this.pixelRatio,t.y*this.pixelRatio),e.scale(n*this.pixelRatio,n*this.pixelRatio)}},{key:"_drawEdgeAnimation",value:function(e){var t=Date.now();e.save();var n=this.cytoscape.edges().toArray(),r=this.selectionNeighborhood.size()>0;if(r){e.globalAlpha=.25;for(var i=0;i<n.length;i++){var a=n[i];this.selectionNeighborhood.has(a)||this._drawEdge(e,a,t)}}e.globalAlpha=1;for(var o=0;o<n.length;o++){var s=n[o];r&&!this.selectionNeighborhood.has(s)||this._drawEdge(e,s,t)}e.restore()}},{key:"_drawEdge",value:function(e,t,n){var r=this.cytoscape,i=t.sourceEndpoint(),a=t.targetEndpoint();this._drawEdgeLine(e,t,i,a),this._drawEdgeParticles(e,t,i,a,n),this.controller.getSettings().showConnectionStats&&r.zoom()>1&&this._drawEdgeLabel(e,t)}},{key:"_drawEdgeLine",value:function(e,t,n,r){e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(r.x,r.y);var i,o=t.data("metrics"),s=a.a.get(o,"normal",-1),l=a.a.get(o,"danger",-1);if(!this.selectionNeighborhood.empty()&&this.selectionNeighborhood.has(t)?(e.lineWidth=3,i=140):(e.lineWidth=1,i=80),s>=0&&l>=0){var u=l/s,c=Math.min(255,i+255*Math.log2(u+1));e.strokeStyle="rgb("+c+","+i+","+i+")"}else e.strokeStyle="rgb("+i+","+i+","+i+")";e.stroke()}},{key:"_drawEdgeLabel",value:function(e,t){var n=t.midpoint(),r=n.x,i=n.y,o=[],s=t.data("metrics"),l=a.a.defaultTo(s.response_time,-1),u=a.a.defaultTo(s.rate,-1),c=a.a.defaultTo(s.error_rate,-1);if(l>=0){var h=l>=1e3?1:0;o.push(C()(l,{scale:this.timeScale,decimals:h}))}if(u>=0){var d=u>=1e3?1:0;o.push(C()(u,{decimals:d})+" Requests")}if(c>=0){var f=c>=1e3?1:0;o.push(C()(c,{decimals:f})+" Errors")}if(o.length>0){var p=o.join(", ");this._drawLabel(e,p,r,i)}}},{key:"_drawEdgeParticles",value:function(e,t,n,r,i){var a=t.data("particles");if(void 0!==a){var o=r.x-n.x,s=r.y-n.y,l=Math.atan2(s,o),u={ctx:e,now:i,xDirection:Math.cos(l),yDirection:Math.sin(l),xMinLimit:Math.min(n.x,r.x),xMaxLimit:Math.max(n.x,r.x),yMinLimit:Math.min(n.y,r.y),yMaxLimit:Math.max(n.y,r.y),sourcePoint:n};e.beginPath();for(var c=a.normal.length-1;c>=0;)this._drawParticle(u,a.normal,c),c--;for(e.fillStyle="#d1e2f2",e.fill(),e.beginPath(),c=a.danger.length-1;c>=0;)this._drawParticle(u,a.danger,c),c--;var h=this.controller.getSettings().style.dangerColor;e.fillStyle=h,e.fill()}}},{key:"_drawLabel",value:function(e,t,n,r){e.font="6px Arial";var i=e.measureText(t).width,a=n-i/2,o=r+3;e.fillStyle=this.colors.default,e.fillRect(a-1,o-6-1,i+2,8),e.fillStyle=this.colors.background,e.fillText(t,a,o)}},{key:"_drawParticle",value:function(e,t,n){var r=e.ctx,i=e.now,a=e.xDirection,o=e.yDirection,s=e.xMinLimit,l=e.xMaxLimit,u=e.yMinLimit,c=e.yMaxLimit,h=e.sourcePoint,d=t[n],f=i-d.startTime,p=h.x+a*f*d.velocity,v=h.y+o*f*d.velocity;p>l||p<s||v>c||v<u?t.splice(n,1):(r.moveTo(p,v),r.arc(p,v,1,0,2*Math.PI,!1))}},{key:"_drawNodes",value:function(e){for(var t=this.cytoscape,n=t.nodes().toArray(),r=0;r<n.length;r++){var i=n[r];this.selectionNeighborhood.empty()||this.selectionNeighborhood.has(i)?e.globalAlpha=1:e.globalAlpha=.25,this._drawNode(e,i),t.zoom()>1&&this._drawNodeLabel(e,i)}}},{key:"_drawNode",value:function(e,t){var n=this.cytoscape,r=t.data("type"),i=t.data("metrics");if(r===d.INTERNAL){var o,s,l,u=a.a.defaultTo(i.rate,-1),c=a.a.defaultTo(i.error_rate,0),h=a.a.defaultTo(i.response_time,-1),f=a.a.defaultTo(i.threshold,-1);if(u<0?(l=0,s=0,o=1):(l=1-(s=c<=0?0:1/u*c),o=0),this._drawDonut(e,t,15,5,.5,[s,o,l]),this._drawServiceIcon(e,t),this.controller.getSettings().showBaselines&&h>=0&&f>=0){var p=f<h;this._drawThresholdStroke(e,t,p,15,5,.5)}}else this._drawExternalService(e,t);n.zoom()>1&&this._drawNodeStatistics(e,t)}},{key:"_drawServiceIcon",value:function(e,t){var n=t.id(),r=this.controller.panel.settings.serviceIcons,i=a.a.find(r,(function(e){var t=e.pattern;try{return new RegExp(t).test(n)}catch(e){return!1}}));if(i){var o=this._getAsset(i.filename,"service_icons/"+i.filename+".png");if(null!=o){var s=t.position().x,l=t.position().y;e.drawImage(o,s-8,l-8,16,16)}}}},{key:"_drawNodeStatistics",value:function(e,t){var n=[],r=t.data("metrics"),i=a.a.defaultTo(r.rate,-1),o=a.a.defaultTo(r.error_rate,-1),s=a.a.defaultTo(r.response_time,-1);if(i>=0){var l=i>=1e3?1:0;n.push("Requests: "+C()(i,{decimals:l}))}if(o>=0){var u=o>=1e3?1:0;n.push("Errors: "+C()(o,{decimals:u}))}if(s>=0){var c=s>=1e3?1:0;n.push("Avg. Resp. Time: "+C()(s,{scale:this.timeScale,decimals:c}))}var h=t.position(),d=h.x+1.25*this.donutRadius,f=h.y+3-3*(n.length-1);e.font="6px Arial",e.fillStyle=this.colors.default;for(var p=0;p<n.length;p++)e.fillText(n[p],d,f+6*p)}},{key:"_drawThresholdStroke",value:function(e,t,n,r,i,a){var o=t.position(),s=o.x,l=o.y,u=2*a*(n?1.5:1),c=.2*u;e.beginPath(),e.arc(s,l,r+u-c,0,2*Math.PI,!1),e.closePath(),e.setLineDash([]),e.lineWidth=1*u,e.strokeStyle="white",e.stroke(),e.beginPath(),e.arc(s,l,r+u-c,0,2*Math.PI,!1),e.closePath(),e.setLineDash([10,2]),n&&this.controller.panel.settings.animate?e.lineDashOffset=this.dashAnimationOffset:e.lineDashOffset=0,e.lineWidth=u,e.strokeStyle=n?"rgb(184, 36, 36)":"#37872d",e.stroke(),e.beginPath(),e.arc(s,l,r-i-a,0,2*Math.PI,!1),e.closePath(),e.fillStyle=n?"rgb(184, 36, 36)":"#37872d",e.fill()}},{key:"_drawExternalService",value:function(e,t){var n=t.position(),r=n.x,i=n.y;e.beginPath(),e.arc(r,i,12,0,2*Math.PI,!1),e.fillStyle="white",e.fill(),e.beginPath(),e.arc(r,i,11.5,0,2*Math.PI,!1),e.fillStyle=this.colors.background,e.fill();var a=t.data("external_type"),o=this._getImageAsset(a);null!=o&&e.drawImage(o,r-6,i-6,12,12)}},{key:"_drawNodeLabel",value:function(e,t){var n=t.position(),r=t.id();!this.selectionNeighborhood.empty()&&this.selectionNeighborhood.has(t)||r.length>20&&(r=r.substr(0,7)+"..."+r.slice(-7)),e.font="6px Arial";var i=e.measureText(r).width,o=n.x-i/2,s=n.y+.8*t.height(),l=this.controller.getSettings().showBaselines,u=t.data("metrics"),c=a.a.defaultTo(u.response_time,-1),h=a.a.defaultTo(u.threshold,-1);e.fillStyle=!l||h<0||c<0||c<=h?this.colors.default:"#FF7383",e.fillRect(o-1,s-6-1,i+2,8),e.fillStyle=this.colors.background,e.fillText(r,o,s)}},{key:"_drawDebugInformation",value:function(){var e=this.context;this.frameCounter++,e.font="12px monospace",e.fillStyle="white",e.fillText("Frames per Second: "+this.fpsCounter,10,12),e.fillText("Particles: "+this.particleEngine.count(),10,24)}},{key:"_drawDonut",value:function(e,t,n,r,i,a){var o=t.position().x,s=t.position().y,l=-Math.PI/2;e.beginPath(),e.arc(o,s,n+i,0,2*Math.PI,!1),e.closePath(),e.fillStyle="white",e.fill();for(var u=this.controller.getSettings().style,c=u.healthyColor,h=[u.dangerColor,u.unknownColor,c],d=0;d<a.length;d++)l+=this._drawArc(e,l,o,s,n,a[d],h[d]);e.beginPath(),e.arc(o,s,n-r,0,2*Math.PI,!1),e.fillStyle="white",e.fill(),e.beginPath(),e.arc(o,s,n-r-i,0,2*Math.PI,!1),t.selected()?e.fillStyle="white":e.fillStyle=this.colors.background,e.fill()}},{key:"_drawArc",value:function(e,t,n,r,i,a,o){var s=360*a*Math.PI/180;return e.save(),e.beginPath(),e.moveTo(n,r),e.arc(n,r,i,t,t+s,!1),e.closePath(),e.fillStyle=o,e.fill(),e.restore(),s}}])&&S(t.prototype,n),r&&S(t,r),e}(),A=n(5),D=n.n(A),M=n(17),O=n.n(M),B=n(18),L={name:"cola",animate:!0,refresh:1,maxSimulationTime:3e3,ungrabifyWhileSimulating:!1,fit:!0,padding:90,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,ready:function(){},stop:function(){},randomize:!1,avoidOverlap:!0,handleDisconnected:!0,convergenceThreshold:.01,nodeSpacing:function(e){return 50},flow:void 0,alignment:void 0,gapInequalities:void 0,edgeLength:void 0,edgeSymDiffLength:void 0,edgeJaccardLength:void 0,unconstrIter:50,userConstIter:void 0,allConstIter:void 0,infinite:!1},I=[{columns:[{type:"time",text:"Time"},{text:"origin_external"},{text:"origin_service"},{text:"protocol"},{text:"service"},{text:"in_count"}],refId:void 0,meta:void 0,rows:[[0,"","","http","api-gateway",508],[0,"","","http","config-server",0],[0,"","","http","discovery-server",0],[0,"","api-gateway","http","api-gateway",100],[0,"","api-gateway","http","customers-service",3247],[0,"","api-gateway","http","discovery-server",20],[0,"","api-gateway","http","vets-service",63],[0,"","api-gateway","http","visits-service",100],[0,"","customers-service","http","discovery-server",20],[0,"","vets-service","http","discovery-server",20],[0,"","visits-service","http","discovery-server",20],[0,"tcp://localhost:61616","vets-service","jms","visits-service",300],[0,"tcp://10.10.10.10:61616","","jms","api-gateway",100]]},{columns:[{type:"time",text:"Time"},{text:"protocol"},{text:"service"},{text:"target_external"},{text:"target_service"},{text:"out_count"}],refId:void 0,meta:void 0,rows:[[0,"http","api-gateway","","api-gateway",100],[0,"http","api-gateway","","customers-service",347],[0,"http","api-gateway","","discovery-server",20],[0,"http","api-gateway","","vets-service",62],[0,"http","api-gateway","","visits-service",100],[0,"http","api-gateway","7a8dce897616:8080","",0],[0,"http","config-server","github.com","",0],[0,"http","customers-service","","discovery-server",20],[0,"http","vets-service","","discovery-server",20],[0,"jms","vets-service","tcp://localhost:61616","visits-service",300],[0,"http","visits-service","","discovery-server",20],[0,"jdbc","customers-service","jdbc:hsqldb:mem:testdb","",1847],[0,"jdbc","vets-service","jdbc:hsqldb:mem:testdb","",441],[0,"jdbc","visits-service","jdbc:hsqldb:mem:testdb","",100]]},{columns:[{type:"time",text:"Time"},{text:"origin_service"},{text:"protocol"},{text:"service"},{text:"target_external"},{text:"in_timesum"}],refId:void 0,meta:void 0,rows:[[0,"","http","api-gateway","",45140.00842799999],[0,"","http","config-server","",0],[0,"","http","discovery-server","",0],[0,"api-gateway","http","api-gateway","",1511.9842349999872],[0,"api-gateway","http","customers-service","",819.3634589999965],[0,"api-gateway","http","discovery-server","",21.881731999999943],[0,"api-gateway","http","vets-service","",281.0465210000002],[0,"api-gateway","http","visits-service","",325.85070300000007],[0,"customers-service","http","discovery-server","",21.53124399999996],[0,"vets-service","http","discovery-server","",21.40604300000001],[0,"visits-service","http","discovery-server","",20.813048000000038]]},{columns:[{type:"time",text:"Time"},{text:"protocol"},{text:"service"},{text:"target_external"},{text:"target_service"},{text:"out_timesum"}],refId:void 0,meta:void 0,rows:[[0,"http","api-gateway","","api-gateway",1700.468872999987],[0,"http","api-gateway","","customers-service",1481.533606999972],[0,"http","api-gateway","","discovery-server",540.746261],[0,"http","api-gateway","","vets-service",501.65547400000014],[0,"http","api-gateway","","visits-service",394.81158100000175],[0,"http","api-gateway","7a8dce897616:8080","",0],[0,"http","config-server","github.com","",0],[0,"http","customers-service","","discovery-server",84.59527999999978],[0,"http","vets-service","","discovery-server",381.87400800000023],[0,"http","visits-service","","discovery-server",225.65933600000017],[0,"jdbc","customers-service","jdbc:hsqldb:mem:testdb","",35.9093940000007],[0,"jdbc","vets-service","jdbc:hsqldb:mem:testdb","",13.000189000000091],[0,"jdbc","visits-service","jdbc:hsqldb:mem:testdb","",12.258137999999946]]},{columns:[{type:"time",text:"Time"},{text:"origin_service"},{text:"protocol"},{text:"service"},{text:"target_external"},{text:"error_in"}],refId:void 0,meta:void 0,rows:[[0,"","http","api-gateway","",14],[0,"","http","discovery-server","",20],[0,"","http","customers-service","",20],[0,"","http","vets-service","",0]]},{columns:[{type:"time",text:"Time"},{text:"origin_service"},{text:"protocol"},{text:"service"},{text:"target_external"},{text:"error_out"}],refId:void 0,meta:void 0,rows:[[0,"api-gateway","http","customers-service","",14],[0,"api-gateway","http","vets-service","",0],[0,"api-gateway","http","visits-service","",0],[0,"customers-service","http","discovery-server","",20]]},{columns:[{type:"time",text:"Time"},{text:"service"},{text:"threshold"}],refId:void 0,meta:void 0,rows:[[0,"api-gateway",40.40604300000001],[0,"customers-service",10]]}];function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach((function(t){X(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function X(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.n(B)()(D.a),D.a.use(O.a);var Y=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=function(e,t){return!t||"object"!==N(t)&&"function"!=typeof t?F(e):t}(this,V(t).call(this,e,n)),X(F(r),"panelDefaults",{settings:{showDummyData:!1,animate:!0,sumTimings:!0,showConnectionStats:!0,filterEmptyConnections:!0,serviceIcons:[{pattern:"java",filename:"java"},{pattern:"spok|star trek",filename:"star_trek"}],externalIcons:[{name:"web",filename:"web"},{name:"jms",filename:"message"},{name:"jdbc",filename:"database"},{name:"http",filename:"http"}],style:{healthyColor:"rgb(87, 148, 242)",dangerColor:"rgb(184, 36, 36)",unknownColor:"rgb(123, 123, 138)"},showDebugInformation:!1,showBaselines:!1,dataMapping:{sourceComponentPrefix:"origin_",targetComponentPrefix:"target_",responseTimeColumn:"response-time",requestRateColumn:"request-rate",errorRateColumn:"error-rate",responseTimeOutgoingColumn:"response-time-out",requestRateOutgoingColumn:"request-rate-out",errorRateOutgoingColumn:"error-rate-out",extOrigin:"external_origin",extTarget:"external_target",type:"type",baselineRtUpper:"threshold"},drillDownLink:""}}),X(F(r),"currentData",void 0),X(F(r),"cy",void 0),X(F(r),"graphCanvas",void 0),X(F(r),"initResize",!0),X(F(r),"preProcessor",new m(F(r))),X(F(r),"graphGenerator",new x(F(r))),X(F(r),"graphContainer",void 0),X(F(r),"validQueryTypes",void 0),X(F(r),"showStatistics",!1),X(F(r),"selectionId",void 0),X(F(r),"receiving",void 0),X(F(r),"sending",void 0),X(F(r),"resolvedDrillDownLink",void 0),X(F(r),"currentType",void 0),X(F(r),"selectionStatistics",void 0),a.a.defaultsDeep(r.panel,r.panelDefaults),r.events.on("init-edit-mode",r.onInitEditMode.bind(F(r))),r.events.on("component-did-mount",r.onMount.bind(F(r))),r.events.on("refresh",r.onRefresh.bind(F(r))),r.events.on("render",r.onRender.bind(F(r))),r.events.on("data-received",r.onDataReceived.bind(F(r))),r.events.on("data-snapshot-load",r.onDataReceived.bind(F(r))),r}var n,r,o;return t.$inject=["$scope","$injector"],function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&q(e,t)}(t,e),n=t,(r=[{key:"link",value:function(e,t,n,r){console.log("Linking container DOM element."),this.graphContainer=t.find(".canvas-container")[0]}},{key:"onRefresh",value:function(){console.log("refresh"),this.getSettings().showDummyData&&this.updateDummyData()}},{key:"onInitEditMode",value:function(){this.addEditorTab("Options",u,2)}},{key:"onPanelTeardown",value:function(){}},{key:"toggleAnimation",value:function(){this.panel.settings.animate=!this.panel.settings.animate,this.panel.settings.animate?this.graphCanvas.startAnimation():this.graphCanvas.stopAnimation()}},{key:"zoom",value:function(e){var t=.25*e,n=Math.max(.1,this.cy.zoom()+t);this.cy.zoom(n)}},{key:"isDataAvailable",value:function(){return!Object(i.isUndefined)(this.currentData)&&this.currentData.graph.length>0}},{key:"_updateOrRemove",value:function(e,t){for(var n=[],r=function(r){var a=e[r],o=Object(i.find)(t,{data:{id:a.id()}});o?(a.data(o.data),Object(i.remove)(t,(function(e){return e.data.id===o.data.id})),n.push(a)):a.remove()},a=0;a<e.length;a++)r(a);return n}},{key:"_updateGraph",value:function(e){var t=this._transformNodes(e.nodes),n=this._transformEdges(e.edges);console.groupCollapsed("Updating graph"),console.log("cytoscape nodes: ",JSON.parse(JSON.stringify(t))),console.log("cytoscape edges: ",JSON.parse(JSON.stringify(n))),console.groupEnd();var r=this.cy.nodes().toArray(),a=this._updateOrRemove(r,t);this.cy.add(t);var o=this.cy.edges().toArray();this._updateOrRemove(o,n),this.cy.add(n),this.initResize?(this.initResize=!1,this.cy.resize(),this.cy.reset(),this.runLayout()):t.length>0&&(Object(i.each)(a,(function(e){e.lock()})),this.runLayout(!0))}},{key:"_transformEdges",value:function(e){return Object(i.map)(e,(function(e){return{group:"edges",data:{id:e.source+":"+e.target,source:e.source,target:e.target,metrics:R({},e.metrics)}}}))}},{key:"_transformNodes",value:function(e){return Object(i.map)(e,(function(e){return{group:"nodes",data:{id:e.name,type:e.type,external_type:e.external_type,metrics:R({},e.metrics)}}}))}},{key:"_initCytoscape",value:function(){var e=this;console.log("Initialize cytoscape.."),this.cy=D()({container:this.graphContainer,style:[{selector:"node",style:{"background-opacity":0}},{selector:"edge",style:{visibility:"hidden"}}],wheelSensitivity:.125});var t=this.cy.cyCanvas({zIndex:1});this.graphCanvas=new T(this,this.cy,t),this.graphCanvas.start(),this.panel.settings.animate&&this.graphCanvas.startAnimation(),this.cy.reset(),this.cy.resize(),this.cy.center(),this.cy.on("render",(function(t){e.graphCanvas.repaint(!0)})),this.cy.on("select","node",(function(t){return e.onSelectionChange(t)})),this.cy.on("unselect","node",(function(t){return e.onSelectionChange(t)}))}},{key:"onSelectionChange",value:function(e){1===this.cy.$(":selected").length?(this.showStatistics=!0,this.updateStatisticTable()):this.showStatistics=!1,this.$scope.$apply()}},{key:"updateStatisticTable",value:function(){var e=this.cy.$(":selected");if(1===e.length){var t=e[0];this.selectionId=t.id(),this.currentType=t.data("type");var n=[],r=[],i=e.connectedEdges(),o=e.nodes()[0].data("metrics"),s=a.a.defaultTo(o.rate,-1),l=a.a.defaultTo(o.error_rate,-1),u=a.a.defaultTo(o.response_time,-1),c=a.a.defaultTo(o.threshold,-1);this.selectionStatistics={},s>=0&&(this.selectionStatistics.requests=Math.floor(s)),l>=0&&(this.selectionStatistics.errors=Math.floor(l)),u>=0&&(this.selectionStatistics.responseTime=Math.floor(u),c>=0&&(this.selectionStatistics.threshold=Math.floor(c),this.selectionStatistics.thresholdViolation=u>c));for(var h=0;h<i.length;h++){var d=i[h],f=d.source().id()===this.selectionId,p={name:(f?d.target():d.source()).id(),responseTime:"-",rate:"-",error:"-"},v=d.data("metrics"),g=v.response_time,y=v.rate,m=v.error_rate;null!=y&&(p.rate=Math.floor(y).toString()),null!=g&&(p.responseTime=Math.floor(g)+" ms"),null!=m&&null!=y&&(p.error=Math.floor(m/(y/100))+"%"),f?r.push(p):n.push(p)}this.receiving=n,this.sending=r,this.generateDrillDownLink()}}},{key:"onMount",value:function(){this.getSettings().showDummyData?this.updateDummyData():this.render()}},{key:"onRender",value:function(e){if(console.log("render"),this.cy||this._initCytoscape(),this.isDataAvailable()){var t=this.graphGenerator.generateGraph(this.currentData.graph);console.log(t),this._updateGraph(t),this.updateStatisticTable()}}},{key:"getError",value:function(){return this.hasAggregationVariable()?this.validQueryTypes?this.isDataAvailable()?null:"No data to show - the query returned no data.":"Invalid query types - only use queries which return table data.":"Please provide a 'aggregationType' template variable."}},{key:"runLayout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this,n=R({},L,{stop:function(){e&&t.unlockNodes()}});this.cy.layout(n).run()}},{key:"unlockNodes",value:function(){this.cy.nodes().forEach((function(e){e.unlock()}))}},{key:"fit",value:function(){var e=this.graphCanvas.selectionNeighborhood;e&&!e.empty()?this.cy.fit(e,30):this.cy.fit()}},{key:"hasAggregationVariable",value:function(){return!!a.a.find(this.dashboard.templating.list,{name:"aggregationType"})}},{key:"hasOnlyTableQueries",value:function(e){var t=!0;return Object(i.each)(e,(function(e){Object(i.has)(e,"columns")||(t=!1)})),t}},{key:"onDataReceived",value:function(e){this.getSettings().showDummyData||this.processQueryData(e)}},{key:"updateDummyData",value:function(){this.getSettings().showDummyData?this.processQueryData(I):this.currentData=void 0}},{key:"processQueryData",value:function(e){if(this.validQueryTypes=this.hasOnlyTableQueries(e),this.hasAggregationVariable()&&this.validQueryTypes){var t=this.preProcessor.processData(e);console.groupCollapsed("Processed received data"),console.log("raw data: ",e),console.log("graph data: ",t),console.groupEnd(),this.currentData=t}else this.currentData=void 0;this.render()}},{key:"getTemplateVariable",value:function(e){return Object(i.find)(this.dashboard.templating.list,{name:e}).current.value}},{key:"getAssetUrl",value:function(e){return"public/plugins/"+this.panel.type+"/assets/"+e}},{key:"getTypeSymbol",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return this.getAssetUrl("default.png");if(!t)return this.getAssetUrl(e);var n=this.getSettings(),r=n.externalIcons,a=Object(i.find)(r,(function(t){return t.name.toLowerCase()===e.toLowerCase()}));return void 0!==a?this.getAssetUrl(a.filename+".png"):this.getAssetUrl("default.png")}},{key:"getDataMapping",value:function(){return this.getSettings().dataMapping}},{key:"getSettings",value:function(){return this.panel.settings}},{key:"generateDrillDownLink",value:function(){var e=this.getSettings().drillDownLink.replace("{}",this.selectionId);this.resolvedDrillDownLink=this.templateSrv.replace(e)}}])&&j(n.prototype,r),o&&j(n,o),t}(r.MetricsPanelCtrl);X(Y,"templateUrl","partials/module.html")}])}));
  //# sourceMappingURL=module.js.map