/* Highcharts JS v8.2.2 (2020-10-22) Force directed graph module (c) 2010-2019 Torstein Honsi License: www.highcharts.com/license */ (function(d){"object"===typeof module&&module.exports?(d["default"]=d,module.exports=d):"function"===typeof define&&define.amd?define("highcharts/modules/networkgraph",["highcharts"],function(l){d(l);d.Highcharts=l;return d}):d("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(d){function l(d,a,b,e){d.hasOwnProperty(a)||(d[a]=e.apply(null,b))}d=d?d._modules:{};l(d,"Mixins/Nodes.js",[d["Core/Globals.js"],d["Core/Series/Point.js"],d["Core/Utilities.js"]],function(d,a,b){var e=b.defined, c=b.extend,g=b.find,m=b.pick;return d.NodesMixin={createNode:function(a){function b(h,f){return g(h,function(h){return h.id===f})}var e=b(this.nodes,a),h=this.pointClass;if(!e){var f=this.options.nodes&&b(this.options.nodes,a);e=(new h).init(this,c({className:"highcharts-node",isNode:!0,id:a,y:1},f));e.linksTo=[];e.linksFrom=[];e.formatPrefix="node";e.name=e.name||e.options.id||"";e.mass=m(e.options.mass,e.options.marker&&e.options.marker.radius,this.options.marker&&this.options.marker.radius,4); e.getSum=function(){var h=0,f=0;e.linksTo.forEach(function(f){h+=f.weight});e.linksFrom.forEach(function(h){f+=h.weight});return Math.max(h,f)};e.offset=function(h,f){for(var q=0,c=0;ca?1:0)},barycenter:function(){var a=this.options.gravitationalConstant,b=this.barycenter.xFactor,e=this.barycenter.yFactor; b=(b-(this.box.left+this.box.width)/2)*a;e=(e-(this.box.top+this.box.height)/2)*a;this.nodes.forEach(function(a){a.fixedPosition||(a.plotX-=b/a.mass/a.degree,a.plotY-=e/a.mass/a.degree)})},repulsive:function(a,b,e){b=b*this.diffTemperature/a.mass/a.degree;a.fixedPosition||(a.plotX+=e.x*b,a.plotY+=e.y*b)},attractive:function(a,b,e){var c=a.getMass(),g=-e.x*b*this.diffTemperature;b=-e.y*b*this.diffTemperature;a.fromNode.fixedPosition||(a.fromNode.plotX-=g*c.fromNode/a.fromNode.degree,a.fromNode.plotY-= b*c.fromNode/a.fromNode.degree);a.toNode.fixedPosition||(a.toNode.plotX+=g*c.toNode/a.toNode.degree,a.toNode.plotY+=b*c.toNode/a.toNode.degree)},integrate:function(a,b){var e=-a.options.friction,c=a.options.maxSpeed,g=(b.plotX+b.dispX-b.prevX)*e;e*=b.plotY+b.dispY-b.prevY;var d=Math.abs,n=d(g)/(g||1);d=d(e)/(e||1);g=n*Math.min(c,Math.abs(g));e=d*Math.min(c,Math.abs(e));b.prevX=b.plotX+b.dispX;b.prevY=b.plotY+b.dispY;b.plotX+=g;b.plotY+=e;b.temperature=a.vectorLength({x:g,y:e})},getK:function(a){return Math.pow(a.box.width* a.box.height/a.nodes.length,.5)}},euler:{attractiveForceFunction:function(a,b){return a*a/b},repulsiveForceFunction:function(a,b){return b*b/a},barycenter:function(){var a=this.options.gravitationalConstant,b=this.barycenter.xFactor,e=this.barycenter.yFactor;this.nodes.forEach(function(c){if(!c.fixedPosition){var g=c.getDegree();g*=1+g/2;c.dispX+=(b-c.plotX)*a*g/c.degree;c.dispY+=(e-c.plotY)*a*g/c.degree}})},repulsive:function(a,b,e,c){a.dispX+=e.x/c*b/a.degree;a.dispY+=e.y/c*b/a.degree},attractive:function(a, b,e,c){var g=a.getMass(),d=e.x/c*b;b*=e.y/c;a.fromNode.fixedPosition||(a.fromNode.dispX-=d*g.fromNode/a.fromNode.degree,a.fromNode.dispY-=b*g.fromNode/a.fromNode.degree);a.toNode.fixedPosition||(a.toNode.dispX+=d*g.toNode/a.toNode.degree,a.toNode.dispY+=b*g.toNode/a.toNode.degree)},integrate:function(a,b){b.dispX+=b.dispX*a.options.friction;b.dispY+=b.dispY*a.options.friction;var e=b.temperature=a.vectorLength({x:b.dispX,y:b.dispY});0!==e&&(b.plotX+=b.dispX/e*Math.min(Math.abs(b.dispX),a.temperature), b.plotY+=b.dispY/e*Math.min(Math.abs(b.dispY),a.temperature))},getK:function(a){return Math.pow(a.box.width*a.box.height/a.nodes.length,.3)}}}});l(d,"Series/Networkgraph/QuadTree.js",[d["Core/Globals.js"],d["Core/Utilities.js"]],function(d,a){a=a.extend;var b=d.QuadTreeNode=function(a){this.box=a;this.boxSize=Math.min(a.width,a.height);this.nodes=[];this.body=this.isInternal=!1;this.isEmpty=!0};a(b.prototype,{insert:function(a,c){this.isInternal?this.nodes[this.getBoxPosition(a)].insert(a,c-1):(this.isEmpty= !1,this.body?c?(this.isInternal=!0,this.divideBox(),!0!==this.body&&(this.nodes[this.getBoxPosition(this.body)].insert(this.body,c-1),this.body=!0),this.nodes[this.getBoxPosition(a)].insert(a,c-1)):(c=new b({top:a.plotX,left:a.plotY,width:.1,height:.1}),c.body=a,c.isInternal=!1,this.nodes.push(c)):(this.isInternal=!1,this.body=a))},updateMassAndCenter:function(){var a=0,b=0,d=0;this.isInternal?(this.nodes.forEach(function(c){c.isEmpty||(a+=c.mass,b+=c.plotX*c.mass,d+=c.plotY*c.mass)}),b/=a,d/=a): this.body&&(a=this.body.mass,b=this.body.plotX,d=this.body.plotY);this.mass=a;this.plotX=b;this.plotY=d},divideBox:function(){var a=this.box.width/2,c=this.box.height/2;this.nodes[0]=new b({left:this.box.left,top:this.box.top,width:a,height:c});this.nodes[1]=new b({left:this.box.left+a,top:this.box.top,width:a,height:c});this.nodes[2]=new b({left:this.box.left+a,top:this.box.top+c,width:a,height:c});this.nodes[3]=new b({left:this.box.left,top:this.box.top+c,width:a,height:c})},getBoxPosition:function(a){var b= a.plotYMath.abs(this.systemTemperature- this.prevSystemTemperature)||0>=this.temperature},getSystemTemperature:function(){return this.nodes.reduce(function(a,b){return a+b.temperature},0)},vectorLength:function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},getDistR:function(a,b){a=this.getDistXY(a,b);return this.vectorLength(a)},getDistXY:function(a,b){var c=a.plotX-b.plotX;a=a.plotY-b.plotY;return{x:c,y:a,absX:Math.abs(c),absY:Math.abs(a)}}});a(d,"predraw",function(){this.graphLayoutsLookup&&this.graphLayoutsLookup.forEach(function(a){a.stop()})}); a(d,"render",function(){function a(a){a.maxIterations--&&isFinite(a.temperature)&&!a.isStable()&&!a.enableSimulation&&(a.beforeStep&&a.beforeStep(),a.step(),d=!1,b=!0)}var b=!1;if(this.graphLayoutsLookup){c(!1,this);for(this.graphLayoutsLookup.forEach(function(a){a.start()});!d;){var d=!0;this.graphLayoutsLookup.forEach(a)}b&&this.series.forEach(function(a){a&&a.layout&&a.render()})}});a(d,"beforePrint",function(){this.graphLayoutsLookup&&(this.graphLayoutsLookup.forEach(function(a){a.updateSimulation(!1)}), this.redraw())});a(d,"afterPrint",function(){this.graphLayoutsLookup&&this.graphLayoutsLookup.forEach(function(a){a.updateSimulation()});this.redraw()})});l(d,"Series/Networkgraph/DraggableNodes.js",[d["Core/Chart/Chart.js"],d["Core/Globals.js"],d["Core/Utilities.js"]],function(d,a,b){var e=b.addEvent;a.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 c=this.chart;b=c.pointer.normalize(b);var d=a.fixedPosition.chartX-b.chartX,e=a.fixedPosition.chartY-b.chartY;b=c.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:a.TrackerMixin.drawTrackerPoint,animate:null,buildKDTree:a.noop,createNode:b.createNode,destroy:function(){this.layout&&this.layout.removeElementFromCollection(this, this.layout.series);b.destroy.call(this)},init:function(){k.prototype.init.apply(this,arguments);g(this,"updatedData",function(){this.layout&&this.layout.stop()});return this},generatePoints:function(){var a;b.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(a=this.nodes.length-1;0<=a;a--){var c=this.nodes[a];c.degree=c.getDegree();c.radius=p(c.marker&&c.marker.radius,this.options.marker&& this.options.marker.radius,0);this.nodeLookup[c.id]||c.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);n(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 b=this.options.layoutAlgorithm,c=this.chart.graphLayoutsStorage,d=this.chart.graphLayoutsLookup,e=this.chart.options.chart;if(this.visible){c||(this.chart.graphLayoutsStorage=c={},this.chart.graphLayoutsLookup=d=[]);var g=c[b.type];g||(b.enableSimulation=n(e.forExport)?!e.forExport:b.enableSimulation,c[b.type]=g=new a.layouts[b.type],g.init(b),d.splice(g.index,0,g));this.layout=g;g.setArea(0,0,this.chart.plotWidth, this.chart.plotHeight);g.addElementsToCollection([this],g.series);g.addElementsToCollection(this.nodes,g.nodes);g.addElementsToCollection(this.points,g.links)}},render:function(){var a=this.points,b=this.chart.hoverPoint,c=[];this.points=this.nodes;h.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&& c.push(a.dataLabel)}),this.chart.hideOverlappingLabels(c))},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:p(c.linkOpacity,b.opacity),"stroke-width":c.linkColor||b["stroke-width"]}));return b},redrawHalo:c.redrawHalo,onMouseDown:c.onMouseDown,onMouseMove:c.onMouseMove,onMouseUp:c.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:b.setNodeState,init:function(){e.prototype.init.apply(this,arguments);this.series.options.draggable&&!this.series.chart.styledMode&&(g(this,"mouseOver",function(){l(this.series.chart.container,{cursor:"move"})}),g(this,"mouseOut",function(){l(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":p(b.width,a.width),stroke:b.color||a.color,dashstyle:b.dashStyle||a.dashStyle,opacity:p(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(b){b&&b.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 c=a[0];a=a[1];"M"===c[0]&&"L"===a[0]&&(this.plotX=(c[1]+a[1])/2,this.plotY=(c[2]+a[2])/2)}},getMass:function(){var a=this.fromNode.mass,b=this.toNode.mass,c=a+b;return{fromNode:1-a/c,toNode:1-b/c}},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||n(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