/*
  Highcharts JS v6.1.3 (2018-09-12)
 Sankey diagram module

 (c) 2010-2017 Torstein Honsi

 License: www.highcharts.com/license
*/
(function(m){"object"===typeof module&&module.exports?module.exports=m:"function"===typeof define&&define.amd?define(function(){return m}):m(Highcharts)})(function(m){(function(d){var m=d.defined,g=d.each,N=d.extend,O=d.seriesType,n=d.Point;O("sankey","column",{colorByPoint:!0,curveFactor:.33,dataLabels:{enabled:!0,backgroundColor:"none",crop:!1,nodeFormat:void 0,nodeFormatter:function(){return this.point.name},format:void 0,formatter:function(){return""},inside:!0},linkOpacity:.5,nodeWidth:20,nodePadding:10,
showInLegend:!1,states:{hover:{linkOpacity:1}},tooltip:{followPointer:!0,headerFormat:'\x3cspan style\x3d"font-size: 0.85em"\x3e{series.name}\x3c/span\x3e\x3cbr/\x3e',pointFormat:"{point.fromNode.name} \u2192 {point.toNode.name}: \x3cb\x3e{point.weight}\x3c/b\x3e\x3cbr/\x3e",nodeFormat:"{point.name}: \x3cb\x3e{point.sum}\x3c/b\x3e\x3cbr/\x3e"}},{isCartesian:!1,forceDL:!0,createNode:function(b){function a(a,b){return d.find(a,function(a){return a.id===b})}var c=a(this.nodes,b),f;c||(f=this.options.nodes&&
a(this.options.nodes,b),c=(new n).init(this,N({className:"highcharts-node",isNode:!0,id:b,y:1},f)),c.linksTo=[],c.linksFrom=[],c.formatPrefix="node",c.name=c.name||c.id,c.getSum=function(){var a=0,b=0;g(c.linksTo,function(b){a+=b.weight});g(c.linksFrom,function(a){b+=a.weight});return Math.max(a,b)},c.offset=function(a,b){for(var f=0,e=0;e<c[b].length;e++){if(c[b][e]===a)return f;f+=c[b][e].weight}},c.hasShape=function(){var a=0;g(c.linksTo,function(b){b.outgoing&&a++});return!c.linksTo.length||a!==
c.linksTo.length},this.nodes.push(c));return c},createNodeColumn:function(){var b=this.chart,a=[],c=this.options.nodePadding;a.sum=function(){var a=0;g(this,function(b){a+=b.getSum()});return a};a.offset=function(b,e){for(var f=0,d=0;d<a.length;d++){if(a[d]===b)return f+(b.options.offset||0);f+=a[d].getSum()*e+c}};a.top=function(f){for(var e=0,d=0;d<a.length;d++)0<d&&(e+=c),e+=a[d].getSum()*f;return(b.plotSizeY-e)/2};return a},createNodeColumns:function(){var b=[];g(this.nodes,function(a){var c=-1,
f,e;if(!d.defined(a.options.column))if(0===a.linksTo.length)a.column=0;else{for(f=0;f<a.linksTo.length;f++)e=a.linksTo[0],e.fromNode.column>c&&(c=e.fromNode.column);a.column=c+1}b[a.column]||(b[a.column]=this.createNodeColumn());b[a.column].push(a)},this);return b},pointAttribs:function(b,a){var c=this.options.linkOpacity,f=b.color;a&&(c=this.options.states[a].linkOpacity||c,f=this.options.states[a].color||b.color);return{fill:b.isNode?f:d.color(f).setOpacity(c).get()}},generatePoints:function(){var b=
{};d.Series.prototype.generatePoints.call(this);this.nodes||(this.nodes=[]);this.colorCounter=0;g(this.nodes,function(a){a.linksFrom.length=0;a.linksTo.length=0});g(this.points,function(a){m(a.from)&&(b[a.from]||(b[a.from]=this.createNode(a.from)),b[a.from].linksFrom.push(a),a.fromNode=b[a.from],a.color=a.options.color||b[a.from].color);m(a.to)&&(b[a.to]||(b[a.to]=this.createNode(a.to)),b[a.to].linksTo.push(a),a.toNode=b[a.to]);a.name=a.name||a.id},this)},translate:function(){this.processedXData||
this.processData();this.generatePoints();this.nodeColumns=this.createNodeColumns();var b=this.chart,a=b.inverted,c=this.options,f=0,d=c.nodeWidth,m=this.nodeColumns,C=(b.plotSizeX-d)/(m.length-1),D=(a?-C:C)*c.curveFactor,p=Infinity;g(this.nodeColumns,function(a){p=Math.min(p,(b.plotSizeY-(a.length-1)*c.nodePadding)/a.sum())});g(this.nodeColumns,function(c){g(c,function(e){var n=e.getSum(),v=n*p,G=c.top(p)+c.offset(e,p),q=a?b.plotSizeX-f:f;e.sum=n;e.shapeType="rect";e.shapeArgs=a?{x:q-d,y:b.plotSizeY-
G-v,width:d,height:v}:{x:q,y:G,width:d,height:v};e.shapeArgs.display=e.hasShape()?"":"none";e.plotY=1;g(e.linksFrom,function(c){var h=c.weight*p,l=e.offset(c,"linksFrom")*p,l=G+l,k=c.toNode,g=m[k.column].top(p)+k.offset(c,"linksTo")*p+m[k.column].offset(k,p),r=d,k=k.column*C,w=c.outgoing;a&&(l=b.plotSizeY-l,g=b.plotSizeY-g,k=b.plotSizeX-k,r=-r,h=-h);c.shapeType="path";if(k>f)c.shapeArgs={d:["M",q+r,l,"C",q+r+D,l,k-D,g,k,g,"L",k+(w?r:0),g+h/2,"L",k,g+h,"C",k-D,g+h,q+r+D,l+h,q+r,l+h,"z"]};else{var w=
k-20-h,x=k-20,n=k,y=q+r,u=y+20,E=u+h,v=l,z=l+h,H=z+20,A=H+(b.plotHeight-l-h),t=A+20,F=t+h,I=g,B=I+h,J=B+20,K=t+.7*h,L=n-.7*h,M=y+.7*h;c.shapeArgs={d:["M",y,v,"C",M,v,E,z-.7*h,E,H,"L",E,A,"C",E,K,M,F,y,F,"L",n,F,"C",L,F,w,K,w,A,"L",w,J,"C",w,B-.7*h,L,I,n,I,"L",n,B,"C",x,B,x,B,x,J,"L",x,A,"C",x,t,x,t,n,t,"L",y,t,"C",u,t,u,t,u,A,"L",u,H,"C",u,z,u,z,y,z,"z"]}}c.dlBox={x:q+(k-q+r)/2,y:l+(g-l)/2,height:h,width:0};c.y=c.plotY=1;c.color||(c.color=e.color)})});f+=C},this)},render:function(){var b=this.points;
this.points=this.points.concat(this.nodes);d.seriesTypes.column.prototype.render.call(this);this.points=b},animate:d.Series.prototype.animate,destroy:function(){this.data=this.points.concat(this.nodes);d.Series.prototype.destroy.call(this)}},{getClassName:function(){return"highcharts-link "+n.prototype.getClassName.call(this)},isValid:function(){return this.isNode||"number"===typeof this.weight}})})(m)});
//# sourceMappingURL=sankey.js.map
