/* Highcharts JS v8.1.2 (2020-06-16) Force directed graph module (c) 2010-2019 Torstein Honsi License: www.highcharts.com/license */ (function(f){"object"===typeof module&&module.exports?(f["default"]=f,module.exports=f):"function"===typeof define&&define.amd?define("highcharts/modules/networkgraph",["highcharts"],function(m){f(m);f.Highcharts=m;return f}):f("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(f){function m(f,b,a,e){f.hasOwnProperty(b)||(f[b]=e.apply(null,a))}f=f?f._modules:{};m(f,"mixins/nodes.js",[f["parts/Globals.js"],f["parts/Point.js"],f["parts/Utilities.js"]],function(f,b,a){var e=a.defined,d=a.extend, g=a.find,n=a.pick;f.NodesMixin={createNode:function(b){function a(c,h){return g(c,function(c){return c.id===h})}var e=a(this.nodes,b),c=this.pointClass;if(!e){var h=this.options.nodes&&a(this.options.nodes,b);e=(new c).init(this,d({className:"highcharts-node",isNode:!0,id:b,y:1},h));e.linksTo=[];e.linksFrom=[];e.formatPrefix="node";e.name=e.name||e.options.id||"";e.mass=n(e.options.mass,e.options.marker&&e.options.marker.radius,this.options.marker&&this.options.marker.radius,4);e.getSum=function(){var c= 0,h=0;e.linksTo.forEach(function(h){c+=h.weight});e.linksFrom.forEach(function(c){h+=c.weight});return Math.max(c,h)};e.offset=function(c,h){for(var b=0,d=0;db?1:0)},barycenter:function(){var b=this.options.gravitationalConstant,a=this.barycenter.xFactor,e=this.barycenter.yFactor;a=(a-(this.box.left+this.box.width)/2)*b;e= (e-(this.box.top+this.box.height)/2)*b;this.nodes.forEach(function(d){d.fixedPosition||(d.plotX-=a/d.mass/d.degree,d.plotY-=e/d.mass/d.degree)})},repulsive:function(b,a,e){a=a*this.diffTemperature/b.mass/b.degree;b.fixedPosition||(b.plotX+=e.x*a,b.plotY+=e.y*a)},attractive:function(b,a,e){var d=b.getMass(),g=-e.x*a*this.diffTemperature;a=-e.y*a*this.diffTemperature;b.fromNode.fixedPosition||(b.fromNode.plotX-=g*d.fromNode/b.fromNode.degree,b.fromNode.plotY-=a*d.fromNode/b.fromNode.degree);b.toNode.fixedPosition|| (b.toNode.plotX+=g*d.toNode/b.toNode.degree,b.toNode.plotY+=a*d.toNode/b.toNode.degree)},integrate:function(b,a){var e=-b.options.friction,d=b.options.maxSpeed,g=(a.plotX+a.dispX-a.prevX)*e;e*=a.plotY+a.dispY-a.prevY;var f=Math.abs,q=f(g)/(g||1);f=f(e)/(e||1);g=q*Math.min(d,Math.abs(g));e=f*Math.min(d,Math.abs(e));a.prevX=a.plotX+a.dispX;a.prevY=a.plotY+a.dispY;a.plotX+=g;a.plotY+=e;a.temperature=b.vectorLength({x:g,y:e})},getK:function(b){return Math.pow(b.box.width*b.box.height/b.nodes.length,.5)}}, euler:{attractiveForceFunction:function(b,a){return b*b/a},repulsiveForceFunction:function(b,a){return a*a/b},barycenter:function(){var b=this.options.gravitationalConstant,a=this.barycenter.xFactor,e=this.barycenter.yFactor;this.nodes.forEach(function(d){if(!d.fixedPosition){var g=d.getDegree();g*=1+g/2;d.dispX+=(a-d.plotX)*b*g/d.degree;d.dispY+=(e-d.plotY)*b*g/d.degree}})},repulsive:function(b,a,e,d){b.dispX+=e.x/d*a/b.degree;b.dispY+=e.y/d*a/b.degree},attractive:function(b,a,e,d){var g=b.getMass(), f=e.x/d*a;a*=e.y/d;b.fromNode.fixedPosition||(b.fromNode.dispX-=f*g.fromNode/b.fromNode.degree,b.fromNode.dispY-=a*g.fromNode/b.fromNode.degree);b.toNode.fixedPosition||(b.toNode.dispX+=f*g.toNode/b.toNode.degree,b.toNode.dispY+=a*g.toNode/b.toNode.degree)},integrate:function(b,a){a.dispX+=a.dispX*b.options.friction;a.dispY+=a.dispY*b.options.friction;var e=a.temperature=b.vectorLength({x:a.dispX,y:a.dispY});0!==e&&(a.plotX+=a.dispX/e*Math.min(Math.abs(a.dispX),b.temperature),a.plotY+=a.dispY/e*Math.min(Math.abs(a.dispY), b.temperature))},getK:function(b){return Math.pow(b.box.width*b.box.height/b.nodes.length,.3)}}}});m(f,"modules/networkgraph/QuadTree.js",[f["parts/Globals.js"],f["parts/Utilities.js"]],function(f,b){b=b.extend;var a=f.QuadTreeNode=function(a){this.box=a;this.boxSize=Math.min(a.width,a.height);this.nodes=[];this.body=this.isInternal=!1;this.isEmpty=!0};b(a.prototype,{insert:function(e,d){this.isInternal?this.nodes[this.getBoxPosition(e)].insert(e,d-1):(this.isEmpty=!1,this.body?d?(this.isInternal= !0,this.divideBox(),!0!==this.body&&(this.nodes[this.getBoxPosition(this.body)].insert(this.body,d-1),this.body=!0),this.nodes[this.getBoxPosition(e)].insert(e,d-1)):(d=new a({top:e.plotX,left:e.plotY,width:.1,height:.1}),d.body=e,d.isInternal=!1,this.nodes.push(d)):(this.isInternal=!1,this.body=e))},updateMassAndCenter:function(){var a=0,d=0,b=0;this.isInternal?(this.nodes.forEach(function(e){e.isEmpty||(a+=e.mass,d+=e.plotX*e.mass,b+=e.plotY*e.mass)}),d/=a,b/=a):this.body&&(a=this.body.mass,d=this.body.plotX, b=this.body.plotY);this.mass=a;this.plotX=d;this.plotY=b},divideBox:function(){var b=this.box.width/2,d=this.box.height/2;this.nodes[0]=new a({left:this.box.left,top:this.box.top,width:b,height:d});this.nodes[1]=new a({left:this.box.left+b,top:this.box.top,width:b,height:d});this.nodes[2]=new a({left:this.box.left+b,top:this.box.top+d,width:b,height:d});this.nodes[3]=new a({left:this.box.left,top:this.box.top+d,width:b,height:d})},getBoxPosition:function(a){var d=a.plotYMath.abs(this.systemTemperature-this.prevSystemTemperature)||0>=this.temperature}, getSystemTemperature:function(){return this.nodes.reduce(function(c,a){return c+a.temperature},0)},vectorLength:function(c){return Math.sqrt(c.x*c.x+c.y*c.y)},getDistR:function(c,a){c=this.getDistXY(c,a);return this.vectorLength(c)},getDistXY:function(c,a){var b=c.plotX-a.plotX;c=c.plotY-a.plotY;return{x:b,y:c,absX:Math.abs(b),absY:Math.abs(c)}}});e(f,"predraw",function(){this.graphLayoutsLookup&&this.graphLayoutsLookup.forEach(function(c){c.stop()})});e(f,"render",function(){function c(c){c.maxIterations--&& isFinite(c.temperature)&&!c.isStable()&&!c.enableSimulation&&(c.beforeStep&&c.beforeStep(),c.step(),b=!1,a=!0)}var a=!1;if(this.graphLayoutsLookup){p(!1,this);for(this.graphLayoutsLookup.forEach(function(c){c.start()});!b;){var b=!0;this.graphLayoutsLookup.forEach(c)}a&&this.series.forEach(function(c){c&&c.layout&&c.render()})}});e(f,"beforePrint",function(){this.graphLayoutsLookup&&(this.graphLayoutsLookup.forEach(function(c){c.updateSimulation(!1)}),this.redraw())});e(f,"afterPrint",function(){this.graphLayoutsLookup&& this.graphLayoutsLookup.forEach(function(c){c.updateSimulation()});this.redraw()})});m(f,"modules/networkgraph/draggable-nodes.js",[f["parts/Chart.js"],f["parts/Globals.js"],f["parts/Utilities.js"]],function(f,b,a){var e=a.addEvent;b.dragNodesMixin={onMouseDown:function(a,b){b=this.chart.pointer.normalize(b);a.fixedPosition={chartX:b.chartX,chartY:b.chartY,plotX:a.plotX,plotY:a.plotY};a.inDragMode=!0},onMouseMove:function(a,b){if(a.fixedPosition&&a.inDragMode){var d=this.chart;b=d.pointer.normalize(b); var e=a.fixedPosition.chartX-b.chartX,f=a.fixedPosition.chartY-b.chartY;b=d.graphLayoutsLookup;if(5"+this.point.toNode.name},linkTextPath:{enabled:!0},textPath:{enabled:!1},style:{transition:"opacity 2000ms"}},link:{color:"rgba(100, 100, 100, 0.5)",width:1},draggable:!0,layoutAlgorithm:{initialPositions:"circle",initialPositionRadius:1,enableSimulation:!1,theta:.5,maxSpeed:10,approximation:"none",type:"reingold-fruchterman",integration:"euler",maxIterations:1E3,gravitationalConstant:.0625,friction:-.981},showInLegend:!1},{forces:["barycenter", "repulsive","attractive"],hasDraggableNodes:!0,drawGraph:null,isCartesian:!1,requireSorting:!1,directTouch:!0,noSharedTooltip:!0,pointArrayMap:["from","to"],trackerGroups:["group","markerGroup","dataLabelsGroup"],drawTracker:f.TrackerMixin.drawTrackerPoint,animate:null,buildKDTree:f.noop,createNode:f.NodesMixin.createNode,destroy:function(){this.layout.removeElementFromCollection(this,this.layout.series);f.NodesMixin.destroy.call(this)},init:function(){k.prototype.init.apply(this,arguments);e(this, "updatedData",function(){this.layout&&this.layout.stop()});return this},generatePoints:function(){var c;f.NodesMixin.generatePoints.apply(this,arguments);this.options.nodes&&this.options.nodes.forEach(function(a){this.nodeLookup[a.id]||(this.nodeLookup[a.id]=this.createNode(a.id))},this);for(c=this.nodes.length-1;0<=c;c--){var a=this.nodes[c];a.degree=a.getDegree();a.radius=n(a.marker&&a.marker.radius,this.options.marker&&this.options.marker.radius,0);this.nodeLookup[a.id]||a.remove()}this.data.forEach(function(a){a.formatPrefix= "link"});this.indexateNodes()},getPointsCollection:function(){return this.nodes||[]},indexateNodes:function(){this.nodes.forEach(function(a,b){a.index=b})},markerAttribs:function(a,b){b=k.prototype.markerAttribs.call(this,a,b);g(a.plotY)||(b.y=0);b.x=(a.plotX||0)-(b.width/2||0);return b},translate:function(){this.processedXData||this.processData();this.generatePoints();this.deferLayout();this.nodes.forEach(function(a){a.isInside=!0;a.linksFrom.forEach(function(a){a.shapeType="path";a.y=1})})},deferLayout:function(){var a= this.options.layoutAlgorithm,b=this.chart.graphLayoutsStorage,d=this.chart.graphLayoutsLookup,e=this.chart.options.chart;if(this.visible){b||(this.chart.graphLayoutsStorage=b={},this.chart.graphLayoutsLookup=d=[]);var l=b[a.type];l||(a.enableSimulation=g(e.forExport)?!e.forExport:a.enableSimulation,b[a.type]=l=new f.layouts[a.type],l.init(a),d.splice(l.index,0,l));this.layout=l;l.setArea(0,0,this.chart.plotWidth,this.chart.plotHeight);l.addElementsToCollection([this],l.series);l.addElementsToCollection(this.nodes, l.nodes);l.addElementsToCollection(this.points,l.links)}},render:function(){var a=this.points,b=this.chart.hoverPoint,d=[];this.points=this.nodes;m.line.prototype.render.call(this);this.points=a;a.forEach(function(a){a.fromNode&&a.toNode&&(a.renderLink(),a.redrawLink())});b&&b.series===this&&this.redrawHalo(b);this.chart.hasRendered&&!this.options.dataLabels.allowOverlap&&(this.nodes.concat(this.points).forEach(function(a){a.dataLabel&&d.push(a.dataLabel)}),this.chart.hideOverlappingLabels(d))},drawDataLabels:function(){var a= this.options.dataLabels.textPath;k.prototype.drawDataLabels.apply(this,arguments);this.points=this.data;this.options.dataLabels.textPath=this.options.dataLabels.linkTextPath;k.prototype.drawDataLabels.apply(this,arguments);this.points=this.nodes;this.options.dataLabels.textPath=a},pointAttribs:function(a,b){var c=b||a&&a.state||"normal";b=k.prototype.pointAttribs.call(this,a,c);c=this.options.states[c];a&&!a.isNode&&(b=a.getLinkAttributes(),c&&(b={stroke:c.linkColor||b.stroke,dashstyle:c.linkDashStyle|| b.dashstyle,opacity:n(c.linkOpacity,b.opacity),"stroke-width":c.linkColor||b["stroke-width"]}));return b},redrawHalo:p.redrawHalo,onMouseDown:p.onMouseDown,onMouseMove:p.onMouseMove,onMouseUp:p.onMouseUp,setState:function(a,b){b?(this.points=this.nodes.concat(this.data),k.prototype.setState.apply(this,arguments),this.points=this.data):k.prototype.setState.apply(this,arguments);this.layout.simulation||a||this.render()}},{setState:f.NodesMixin.setNodeState,init:function(){b.prototype.init.apply(this, arguments);this.series.options.draggable&&!this.series.chart.styledMode&&(e(this,"mouseOver",function(){d(this.series.chart.container,{cursor:"move"})}),e(this,"mouseOut",function(){d(this.series.chart.container,{cursor:"default"})}));return this},getDegree:function(){var a=this.isNode?this.linksFrom.length+this.linksTo.length:0;return 0===a?1:a},getLinkAttributes:function(){var a=this.series.options.link,b=this.options;return{"stroke-width":n(b.width,a.width),stroke:b.color||a.color,dashstyle:b.dashStyle|| a.dashStyle,opacity:n(b.opacity,a.opacity,1)}},renderLink:function(){if(!this.graphic&&(this.graphic=this.series.chart.renderer.path(this.getLinkPath()).add(this.series.group),!this.series.chart.styledMode)){var a=this.series.pointAttribs(this);this.graphic.attr(a);(this.dataLabels||[]).forEach(function(c){c&&c.attr({opacity:a.opacity})})}},redrawLink:function(){var a=this.getLinkPath();if(this.graphic){this.shapeArgs={d:a};if(!this.series.chart.styledMode){var b=this.series.pointAttribs(this);this.graphic.attr(b); (this.dataLabels||[]).forEach(function(a){a&&a.attr({opacity:b.opacity})})}this.graphic.animate(this.shapeArgs);var d=a[0];a=a[1];"M"===d[0]&&"L"===a[0]&&(this.plotX=(d[1]+a[1])/2,this.plotY=(d[2]+a[2])/2)}},getMass:function(){var a=this.fromNode.mass,b=this.toNode.mass,d=a+b;return{fromNode:1-a/d,toNode:1-b/d}},getLinkPath:function(){var a=this.fromNode,b=this.toNode;a.plotX>b.plotX&&(a=this.toNode,b=this.fromNode);return[["M",a.plotX||0,a.plotY||0],["L",b.plotX||0,b.plotY||0]]},isValid:function(){return!this.isNode|| g(this.id)},remove:function(a,b){var c=this.series,d=c.options.nodes||[],e,f=d.length;if(this.isNode){c.points=[];[].concat(this.linksFrom).concat(this.linksTo).forEach(function(a){e=a.fromNode.linksFrom.indexOf(a);-1