/** * Highcharts JS v11.2.0 (2023-10-30) * * Force directed graph module * * (c) 2010-2021 Torstein Honsi * * License: www.highcharts.com/license */!function(t){"object"==typeof module&&module.exports?(t.default=t,module.exports=t):"function"==typeof define&&define.amd?define("highcharts/modules/networkgraph",["highcharts"],function(e){return t(e),t.Highcharts=e,t}):t("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(t){"use strict";var e=t?t._modules:{};function i(t,e,i,o){t.hasOwnProperty(e)||(t[e]=o.apply(null,i),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:t[e]}})))}i(e,"Series/DragNodesComposition.js",[e["Core/Utilities.js"]],function(t){var e=t.addEvent,i=[];function o(){var t,i,o,s=this;s.container&&(t=e(s.container,"mousedown",function(t){var r=s.hoverPoint;r&&r.series&&r.series.hasDraggableNodes&&r.series.options.draggable&&(r.series.onMouseDown(r,t),i=e(s.container,"mousemove",function(t){return r&&r.series&&r.series.onMouseMove(r,t)}),o=e(s.container.ownerDocument,"mouseup",function(t){return i(),o(),r&&r.series&&r.series.onMouseUp(r,t)}))})),e(s,"destroy",function(){t()})}return{compose:function(s){t.pushUnique(i,s)&&e(s,"load",o)},onMouseDown:function(t,e){var i=this.chart.pointer.normalize(e);t.fixedPosition={chartX:i.chartX,chartY:i.chartY,plotX:t.plotX,plotY:t.plotY},t.inDragMode=!0},onMouseMove:function(t,e){if(t.fixedPosition&&t.inDragMode){var i=this.chart,o=i.pointer.normalize(e),s=t.fixedPosition.chartX-o.chartX,r=t.fixedPosition.chartY-o.chartY,n=i.graphLayoutsLookup,a=void 0,h=void 0;(Math.abs(s)>5||Math.abs(r)>5)&&(a=t.fixedPosition.plotX-s,h=t.fixedPosition.plotY-r,i.isInsidePlot(a,h)&&(t.plotX=a,t.plotY=h,t.hasDragged=!0,this.redrawHalo(t),n.forEach(function(t){t.restartSimulation()})))}},onMouseUp:function(t,e){t.fixedPosition&&(t.hasDragged&&(this.layout.enableSimulation?this.layout.start():this.chart.redraw()),t.inDragMode=t.hasDragged=!1,this.options.fixedDraggable||delete t.fixedPosition)},redrawHalo:function(t){t&&this.halo&&this.halo.attr({d:t.haloPath(this.options.states.hover.halo.size)})}}}),i(e,"Series/GraphLayoutComposition.js",[e["Core/Animation/AnimationUtilities.js"],e["Core/Utilities.js"]],function(t,e){var i=t.setAnimation,o=e.addEvent,s=[];function r(){this.graphLayoutsLookup&&(this.graphLayoutsLookup.forEach(function(t){t.updateSimulation()}),this.redraw())}function n(){this.graphLayoutsLookup&&(this.graphLayoutsLookup.forEach(function(t){t.updateSimulation(!1)}),this.redraw())}function a(){this.graphLayoutsLookup&&this.graphLayoutsLookup.forEach(function(t){t.stop()})}function h(){var t,e=!1,o=function(i){i.maxIterations--&&isFinite(i.temperature)&&!i.isStable()&&!i.enableSimulation&&(i.beforeStep&&i.beforeStep(),i.step(),t=!1,e=!0)};if(this.graphLayoutsLookup){for(i(!1,this),this.graphLayoutsLookup.forEach(function(t){return t.start()});!t;)t=!0,this.graphLayoutsLookup.forEach(o);e&&this.series.forEach(function(t){t&&t.layout&&t.render()})}}return{compose:function(t){e.pushUnique(s,t)&&(o(t,"afterPrint",r),o(t,"beforePrint",n),o(t,"predraw",a),o(t,"render",h))},integrations:{},layouts:{}}}),i(e,"Series/NodesComposition.js",[e["Core/Series/SeriesRegistry.js"],e["Core/Utilities.js"]],function(t,e){var i,o=t.series,s=o.prototype,r=o.prototype.pointClass.prototype,n=e.defined,a=e.extend,h=e.find,p=e.merge,d=e.pick;return function(t){var i=[];function o(){return this.data=[].concat(this.points||[],this.nodes),s.destroy.apply(this,arguments)}function l(){this.nodes&&(this.nodes.forEach(function(t){t.destroy()}),this.nodes.length=0),s.setData.apply(this,arguments)}function u(t){var e=arguments,i=this.isNode?this.linksTo.concat(this.linksFrom):[this.fromNode,this.toNode];"select"!==t&&i.forEach(function(t){t&&t.series&&(r.setState.apply(t,e),!t.isNode&&(t.fromNode.graphic&&r.setState.apply(t.fromNode,e),t.toNode&&t.toNode.graphic&&r.setState.apply(t.toNode,e)))}),r.setState.apply(this,e)}function c(t,e,i,o){var s=this,n=this.series.options.nodes,a=this.series.options.data,h=a&&a.length||0,l=a&&a[this.index];if(r.update.call(this,t,!this.isNode&&e,i,o),this.isNode){var u=(n||[]).reduce(function(t,e,i){return s.id===e.id?i:t},-1),c=p(n&&n[u]||{},a&&a[this.index]||{});a&&(l?a[this.index]=l:a.length=h),n?u>=0?n[u]=c:n.push(c):this.series.options.nodes=[c],d(e,!0)&&this.series.chart.redraw(i)}}t.compose=function(t,s){if(e.pushUnique(i,t)){var r=t.prototype;r.setNodeState=u,r.setState=u,r.update=c}if(e.pushUnique(i,s)){var n=s.prototype;n.destroy=o,n.setData=l}return s},t.createNode=function(t){var e,i=this.pointClass,o=function(t,e){return h(t,function(t){return t.id===e})},s=o(this.nodes,t);if(!s){e=this.options.nodes&&o(this.options.nodes,t);var r=new i().init(this,a({className:"highcharts-node",isNode:!0,id:t,y:1},e));r.linksTo=[],r.linksFrom=[],r.getSum=function(){var t=0,e=0;return r.linksTo.forEach(function(e){t+=e.weight||0}),r.linksFrom.forEach(function(t){e+=t.weight||0}),Math.max(t,e)},r.offset=function(t,e){for(var i=0,o=0;oe.plotX&&(t=this.toNode,e=this.fromNode),[["M",t.plotX||0,t.plotY||0],["L",e.plotX||0,e.plotY||0]]},e.prototype.getMass=function(){var t=this.fromNode.mass,e=this.toNode.mass,i=t+e;return{fromNode:1-t/i,toNode:1-e/i}},e.prototype.init=function(e,i,o){return t.prototype.init.call(this,e,i,o),this.series.options.draggable&&!this.series.chart.styledMode&&(h(this,"mouseOver",function(){p(this.series.chart.container,{cursor:"move"})}),h(this,"mouseOut",function(){p(this.series.chart.container,{cursor:"default"})})),this},e.prototype.isValid=function(){return!this.isNode||d(this.id)},e.prototype.redrawLink=function(){var t,e=this.getLinkPath();if(this.graphic){this.shapeArgs={d:e},this.series.chart.styledMode||(t=this.series.pointAttribs(this),this.graphic.attr(t),(this.dataLabels||[]).forEach(function(e){e&&e.attr({opacity:t.opacity})})),this.graphic.animate(this.shapeArgs);var i=e[0],o=e[1];"M"===i[0]&&"L"===o[0]&&(this.plotX=(i[1]+o[1])/2,this.plotY=(i[2]+o[2])/2)}},e.prototype.remove=function(t,e){var i,o=this.series,s=o.options.nodes||[],r=s.length;if(this.isNode){for(o.points=[],[].concat(this.linksFrom).concat(this.linksTo).forEach(function(t){(i=t.fromNode.linksFrom.indexOf(t))>-1&&t.fromNode.linksFrom.splice(i,1),(i=t.toNode.linksTo.indexOf(t))>-1&&t.toNode.linksTo.splice(i,1),n.removePoint.call(o,o.data.indexOf(t),!1,!1)}),o.points=o.data.slice(),o.nodes.splice(o.nodes.indexOf(this),1);r--;)if(s[r].id===this.options.id){o.options.nodes.splice(r,1);break}this&&this.destroy(),o.isDirty=!0,o.isDirtyData=!0,t&&o.chart.redraw(t)}else o.removePoint(o.data.indexOf(this),t,e)},e.prototype.renderLink=function(){var t;this.graphic||(this.graphic=this.series.chart.renderer.path(this.getLinkPath()).addClass(this.getClassName(),!0).add(this.series.group),this.series.chart.styledMode||(t=this.series.pointAttribs(this),this.graphic.attr(t),(this.dataLabels||[]).forEach(function(e){e&&e.attr({opacity:t.opacity})})))},e}(a);return l(c.prototype,{setState:t.setNodeState}),c}),i(e,"Series/Networkgraph/NetworkgraphSeriesDefaults.js",[],function(){return{stickyTracking:!1,inactiveOtherPoints:!0,marker:{enabled:!0,states:{inactive:{opacity:.3,animation:{duration:50}}}},states:{inactive:{linkOpacity:.3,animation:{duration:50}}},dataLabels:{formatter:function(){return this.key},linkFormatter:function(){return this.point.fromNode.name+"
"+this.point.toNode.name},linkTextPath:{enabled:!0},textPath:{enabled:!1},style:{transition:"opacity 2000ms"},defer:!0,animation:{defer:1e3}},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}}),i(e,"Series/Networkgraph/EulerIntegration.js",[],function(){return{attractive:function(t,e,i,o){var s=t.getMass(),r=i.x/o*e,n=i.y/o*e;t.fromNode.fixedPosition||(t.fromNode.dispX-=r*s.fromNode/t.fromNode.degree,t.fromNode.dispY-=n*s.fromNode/t.fromNode.degree),t.toNode.fixedPosition||(t.toNode.dispX+=r*s.toNode/t.toNode.degree,t.toNode.dispY+=n*s.toNode/t.toNode.degree)},attractiveForceFunction:function(t,e){return t*t/e},barycenter:function(){var t=this.options.gravitationalConstant,e=this.barycenter.xFactor,i=this.barycenter.yFactor;this.nodes.forEach(function(o){if(!o.fixedPosition){var s=o.getDegree(),r=s*(1+s/2);o.dispX+=(e-o.plotX)*t*r/o.degree,o.dispY+=(i-o.plotY)*t*r/o.degree}})},getK:function(t){return Math.pow(t.box.width*t.box.height/t.nodes.length,.3)},integrate:function(t,e){var i;e.dispX+=e.dispX*t.options.friction,e.dispY+=e.dispY*t.options.friction,0!==(i=e.temperature=t.vectorLength({x:e.dispX,y:e.dispY}))&&(e.plotX+=e.dispX/i*Math.min(Math.abs(e.dispX),t.temperature),e.plotY+=e.dispY/i*Math.min(Math.abs(e.dispY),t.temperature))},repulsive:function(t,e,i,o){t.dispX+=i.x/o*e/t.degree,t.dispY+=i.y/o*e/t.degree},repulsiveForceFunction:function(t,e){return e*e/t}}}),i(e,"Series/Networkgraph/QuadTreeNode.js",[],function(){return function(){function t(t){this.body=!1,this.isEmpty=!1,this.isInternal=!1,this.nodes=[],this.box=t,this.boxSize=Math.min(t.width,t.height)}return t.prototype.divideBox=function(){var e=this.box.width/2,i=this.box.height/2;this.nodes[0]=new t({left:this.box.left,top:this.box.top,width:e,height:i}),this.nodes[1]=new t({left:this.box.left+e,top:this.box.top,width:e,height:i}),this.nodes[2]=new t({left:this.box.left+e,top:this.box.top+i,width:e,height:i}),this.nodes[3]=new t({left:this.box.left,top:this.box.top+i,width:e,height:i})},t.prototype.getBoxPosition=function(t){var e=t.plotXt?1:0)}}}),i(e,"Series/Networkgraph/ReingoldFruchtermanLayout.js",[e["Series/Networkgraph/EulerIntegration.js"],e["Core/Globals.js"],e["Series/GraphLayoutComposition.js"],e["Series/Networkgraph/QuadTree.js"],e["Core/Utilities.js"],e["Series/Networkgraph/VerletIntegration.js"]],function(t,e,i,o,s,r){var n=e.win,a=s.clamp,h=s.defined,p=s.isFunction,d=s.fireEvent,l=s.pick;return function(){function e(){this.attractiveForce=void 0,this.box={},this.currentStep=0,this.initialRendering=!0,this.integration=void 0,this.links=[],this.nodes=[],this.options=void 0,this.quadTree=void 0,this.repulsiveForce=void 0,this.series=[],this.simulation=!1}return e.compose=function(o){i.compose(o),i.integrations.euler=t,i.integrations.verlet=r,i.layouts["reingold-fruchterman"]=e},e.prototype.init=function(t){this.options=t,this.nodes=[],this.links=[],this.series=[],this.box={x:0,y:0,width:0,height:0},this.setInitialRendering(!0),this.integration=i.integrations[t.integration],this.enableSimulation=t.enableSimulation,this.attractiveForce=l(t.attractiveForce,this.integration.attractiveForceFunction),this.repulsiveForce=l(t.repulsiveForce,this.integration.repulsiveForceFunction),this.approximation=t.approximation},e.prototype.updateSimulation=function(t){this.enableSimulation=l(t,this.options.enableSimulation)},e.prototype.start=function(){var t=this.series,e=this.options;this.currentStep=0,this.forces=t[0]&&t[0].forces||[],this.chart=t[0]&&t[0].chart,this.initialRendering&&(this.initPositions(),t.forEach(function(t){t.finishedAnimating=!0,t.render()})),this.setK(),this.resetSimulation(e),this.enableSimulation&&this.step()},e.prototype.step=function(){var t=this,e=this.series;this.currentStep++,"barnes-hut"===this.approximation&&(this.createQuadTree(),this.quadTree.calculateMassAndCenter());for(var i=0,o=this.forces||[];iMath.abs(this.systemTemperature-this.prevSystemTemperature)||this.temperature<=0},e.prototype.getSystemTemperature=function(){for(var t=0,e=0,i=this.nodes;e=0;e--)(t=this.nodes[e]).degree=t.getDegree(),t.radius=w(t.marker&&t.marker.radius,this.options.marker&&this.options.marker.radius,0),this.nodeLookup[t.id]||t.remove();this.data.forEach(function(t){t.formatPrefix="link"}),this.indexateNodes()},o.prototype.getPointsCollection=function(){return this.nodes||[]},o.prototype.indexateNodes=function(){this.nodes.forEach(function(t,e){t.index=e})},o.prototype.init=function(t,e){var o=this;return i.prototype.init.call(this,t,e),v.call(this),b(this,"updatedData",function(){o.layout&&o.layout.stop()}),b(this,"afterUpdate",function(){o.nodes.forEach(function(t){t&&t.series&&t.resolveColor()})}),b(this,"afterSimulation",function(){this.deferDataLabels=!1,this.drawDataLabels()}),this},o.prototype.markerAttribs=function(t,e){var i=c.prototype.markerAttribs.call(this,t,e);return x(t.plotY)||(i.y=0),i.x=(t.plotX||0)-(i.width||0)/2,i},o.prototype.pointAttribs=function(t,e){var i=e||t&&t.state||"normal",o=c.prototype.pointAttribs.call(this,t,i),s=this.options.states[i];return t&&!t.isNode&&(o=t.getLinkAttributes(),s&&(o={stroke:s.linkColor||o.stroke,dashstyle:s.linkDashStyle||o.dashstyle,opacity:w(s.linkOpacity,o.opacity),"stroke-width":s.linkColor||o["stroke-width"]})),o},o.prototype.render=function(){var t=this.points,e=this.chart.hoverPoint,i=[];this.points=this.nodes,y.render.call(this),this.points=t,t.forEach(function(t){t.fromNode&&t.toNode&&(t.renderLink(),t.redrawLink())}),e&&e.series===this&&this.redrawHalo(e),this.chart.hasRendered&&!this.options.dataLabels.allowOverlap&&(this.nodes.concat(this.points).forEach(function(t){t.dataLabel&&i.push(t.dataLabel)}),this.chart.hideOverlappingLabels(i))},o.prototype.setState=function(t,e){e?(this.points=this.nodes.concat(this.data),c.prototype.setState.apply(this,arguments),this.points=this.data):c.prototype.setState.apply(this,arguments),this.layout.simulation||t||this.render()},o.prototype.translate=function(){this.processedXData||this.processData(),this.generatePoints(),this.deferLayout(),this.nodes.forEach(function(t){t.isInside=!0,t.linksFrom.forEach(function(t){t.shapeType="path",t.y=1})})},o.defaultOptions=N(c.defaultOptions,s),o}(c);return k(S.prototype,{pointClass:o,animate:void 0,directTouch:!0,drawGraph:void 0,forces:["barycenter","repulsive","attractive"],hasDraggableNodes:!0,isCartesian:!1,noSharedTooltip:!0,pointArrayMap:["from","to"],requireSorting:!1,trackerGroups:["group","markerGroup","dataLabelsGroup"],initDataLabels:g,buildKDTree:u,createNode:r.createNode,drawTracker:m.drawTracker,onMouseDown:t.onMouseDown,onMouseMove:t.onMouseMove,onMouseUp:t.onMouseUp,redrawHalo:t.redrawHalo}),a.registerSeriesType("networkgraph",S),S}),i(e,"masters/modules/networkgraph.src.js",[e["Core/Globals.js"],e["Series/Networkgraph/NetworkgraphSeries.js"]],function(t,e){e.compose(t.Chart)})});//# sourceMappingURL=networkgraph.js.map