!/**
 * Highcharts JS v13.0.0 (2026-06-11)
 * @module highcharts/modules/sankey
 * @requires highcharts
 *
 * Sankey diagram module
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Torstein Hønsi
 *
 * A commercial license may be required depending on use,
 * see www.highcharts.com/license
 */function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.Point,t._Highcharts.Color,t._Highcharts.SVGElement):"function"==typeof define&&define.amd?define("highcharts/modules/sankey",["highcharts/highcharts"],function(t){return e(t,t.SeriesRegistry,t.Point,t.Color,t.SVGElement)}):"object"==typeof exports?exports["highcharts/modules/sankey"]=e(t._Highcharts,t._Highcharts.SeriesRegistry,t._Highcharts.Point,t._Highcharts.Color,t._Highcharts.SVGElement):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry,t.Highcharts.Point,t.Highcharts.Color,t.Highcharts.SVGElement)}("u"<typeof window?this:window,(t,e,o,i,s)=>(()=>{"use strict";var n,r,l,a={28:t=>{t.exports=s},260:t=>{t.exports=o},512:t=>{t.exports=e},620:t=>{t.exports=i},944:e=>{e.exports=t}},h={};function d(t){var e=h[t];if(void 0!==e)return e.exports;var o=h[t]={exports:{}};return a[t](o,o.exports,d),o.exports}d.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return d.d(e,{a:e}),e},d.d=(t,e)=>{for(var o in e)d.o(e,o)&&!d.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},d.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var p={};d.d(p,{default:()=>Y});var c=d(944),u=d.n(c),f=d(512),m=d.n(f);let{series:{prototype:g,prototype:{pointClass:{prototype:y}}}}=m();!function(t){function e(){if(!this.hasDataLabels?.()&&this.nodes)for(let t of this.nodes)t.destroyElements({dataLabel:1})}function o(){return this.data=[].concat(this.points||[],this.nodes),g.destroy.apply(this,arguments)}function i(){this.nodes&&(this.nodes.forEach(t=>{t.destroy()}),this.nodes.length=0),g.setData.apply(this,arguments)}function s(t){let e=arguments,o=this.isNode?this.linksTo.concat(this.linksFrom):[this.fromNode,this.toNode];"select"!==t&&o.forEach(t=>{t&&t.series&&(y.setState.apply(t,e),!t.isNode&&(t.fromNode.graphic&&y.setState.apply(t.fromNode,e),t.toNode&&t.toNode.graphic&&y.setState.apply(t.toNode,e)))}),y.setState.apply(this,e)}function n(t,e,o,i){let s=this.series.options.nodes,n=this.series.options.data,r=n?.length||0,l=n?.[this.index];if(y.update.call(this,t,!this.isNode&&e,o,i),this.isNode){let t=(s||[]).reduce((t,e,o)=>this.id===e.id?o:t,-1),i=(0,c.merge)(s&&s[t]||{},n?.[this.index]||{});n&&(l?n[this.index]=l:n.length=r),s?t>=0?s[t]=i:s.push(i):this.series.options.nodes=[i],(0,c.pick)(e,!0)&&this.series.chart.redraw(o)}}t.compose=function(t,r){let l=t.prototype,a=r.prototype;return l.setNodeState=s,l.setState=s,l.update=n,a.destroy=o,a.setData=i,(0,c.addEvent)(r,"afterUpdate",e),r},t.createNode=function(t){let e=this.pointClass,o=(t,e)=>(0,c.find)(t,t=>t.id===e),i=o(this.nodes,t),s;if(!i){s=this.options.nodes&&o(this.options.nodes,t);let n=new e(this,(0,c.extend)({className:"highcharts-node",isNode:!0,id:t,y:1},s));n.linksTo=[],n.linksFrom=[],n.getSum=function(){let t=0,e=0;return n.linksTo.forEach(e=>{t+=e.weight||0}),n.linksFrom.forEach(t=>{e+=t.weight||0}),Math.max(t,e)},n.offset=function(t,e){let o=0;for(let i=0;i<n[e].length;i++){if(n[e][i]===t)return o;o+=n[e][i].weight}},n.hasShape=function(){let t=0;return n.linksTo.forEach(e=>{e.outgoing&&t++}),!n.linksTo.length||t!==n.linksTo.length},n.index=this.nodes.push(n)-1,i=n}return i.formatPrefix="node",i.name=i.name||i.options.id||"",i.mass=(0,c.pick)(i.options.mass,i.options.marker&&i.options.marker.radius,this.options.marker&&this.options.marker.radius,4),i},t.destroy=o,t.generatePoints=function(){let t=this.chart,e={};g.generatePoints.call(this),this.nodes||(this.nodes=[]),this.colorCounter=0,this.nodes.forEach(t=>{t.linksFrom.length=0,t.linksTo.length=0,t.level=t.options.level}),this.points.forEach(o=>{(0,c.defined)(o.from)&&(e[o.from]||(e[o.from]=this.createNode(o.from)),e[o.from].linksFrom.push(o),o.fromNode=e[o.from],t.styledMode?o.colorIndex=(0,c.pick)(o.options.colorIndex,e[o.from].colorIndex):o.color=o.options.color||e[o.from].color),(0,c.defined)(o.to)&&(e[o.to]||(e[o.to]=this.createNode(o.to)),e[o.to].linksTo.push(o),o.toNode=e[o.to]),o.name=o.name||o.id},this),this.nodeLookup=e},t.setNodeState=s,t.updateNode=n}(r||(r={}));let b=r;var x=d(260),v=d.n(x);let{column:k}=m().seriesTypes;class N extends k.prototype.pointClass{applyOptions(t,e){return v().prototype.applyOptions.call(this,t,e),(0,c.defined)(this.options.level)&&(this.options.column=this.column=this.options.level),this}getClassName(){return(this.isNode?"highcharts-node ":"highcharts-link ")+v().prototype.getClassName.call(this)}getFromNode(){let t=-1,e;for(let o=0;o<this.linksTo.length;o++){let i=this.linksTo[o];i.fromNode.column>t&&i.fromNode!==this&&(t=(e=i.fromNode).column)}return{fromNode:e,fromColumn:t}}setNodeColumn(){(0,c.defined)(this.options.column)||(0===this.linksTo.length?this.column=0:this.column=this.getFromNode().fromColumn+1)}isValid(){return this.isNode||"number"==typeof this.weight}}var C=l||(l={});C.compose=function(t,e){return t.sankeyColumn=new P(t,e),t};class P{constructor(t,e){this.points=t,this.series=e}getTranslationFactor(t){let e=this.points,o=e.slice(),i=t.chart,s=t.options.minLinkWidth||0,n,r=0,l,a=(i.plotSizeY||0)-(t.options.borderWidth||0)-(e.length-1)*t.nodePadding;for(;e.length;){for(r=a/e.sankeyColumn.sum(),n=!1,l=e.length;l--;)e[l].getSum()*r<s&&(e.splice(l,1),a=Math.max(0,a-s),n=!0);if(!n)break}for(let t of(e.length=0,o))e.push(t);return r}top(t){let e=this.series,o=e.nodePadding,i=this.points.reduce((i,s)=>(i>0&&(i+=o),i+=Math.max(s.getSum()*t,e.options.minLinkWidth||0)),0);return(0,c.getAlignFactor)(e.options.nodeAlignment||"center")*((e.chart.plotSizeY||0)-i)}left(t){let e=this.series,o=e.chart,i=e.options.equalNodes,s=o.inverted?o.plotHeight:o.plotWidth,n=e.nodePadding,r=this.points.reduce((o,r)=>(o>0&&(o+=n),o+=i?s/r.series.nodes.length-n:Math.max(r.getSum()*t,e.options.minLinkWidth||0)),0);return((o.plotSizeX||0)-Math.round(r))/2}sum(){return this.points.reduce((t,e)=>t+e.getSum(),0)}offset(t,e){let o=this.points,i=this.series,s=i.nodePadding,n=0,r;if(i.is("organization")&&t.hangsFrom)return{absoluteTop:t.hangsFrom.nodeY};for(let l=0;l<o.length;l++){let a=o[l].getSum(),h=Math.max(a*e,i.options.minLinkWidth||0),d=t.options[i.chart.inverted?"offsetHorizontal":"offsetVertical"],p=t.options.offset||0;if(r=a?h+s:0,o[l]===t)return{relativeTop:n+((0,c.defined)(d)?(0,c.relativeLength)(d,h):(0,c.relativeLength)(p,r))};n+=r}}}C.SankeyColumnAdditions=P;let L=l;var S=d(620),T=d.n(S),O=d(28),w=d.n(O);let{composed:M,deg2rad:F}=u(),{column:W,line:z}=m().seriesTypes,{parse:H}=T(),{getLevelOptions:I,getNodeWidth:E}={getColor:function(t,e){let o,i,s,n,r,l,a=e.index,h=e.mapOptionsToLevel,d=e.parentColor,p=e.parentColorIndex,u=e.series,f=e.colors,m=e.siblings,g=u.points,y=u.chart.options.chart;if(t){let b;o=g[t.i],i=h[t.level]||{},o&&i.colorByPoint&&(n=o.index%(f?f.length:y.colorCount),s=f&&f[n]),u.chart.styledMode||(r=(0,c.pick)(o&&o.options.color,i&&i.color,s,d&&((b=i&&i.colorVariation)&&"brightness"===b.key&&a&&m?T().parse(d).brighten(b.to*(a/m)).get():d),u.color)),l=(0,c.pick)(o&&o.options.colorIndex,i&&i.colorIndex,n,p,e.colorIndex)}return{color:r,colorIndex:l}},getLevelOptions:function(t){let e,o,i,s,n,r,l={};if((0,c.isObject)(t))for(s=(0,c.isNumber)(t.from)?t.from:1,r=t.levels,o={},e=(0,c.isObject)(t.defaults)?t.defaults:{},(0,c.isArray)(r)&&(o=r.reduce((t,o)=>{let i,n,r;return(0,c.isObject)(o)&&(0,c.isNumber)(o.level)&&(r=(0,c.merge)({},o),n=(0,c.pick)(r.levelIsConstant,e.levelIsConstant),delete r.levelIsConstant,delete r.level,i=o.level+(n?0:s-1),(0,c.isObject)(t[i])?(0,c.merge)(!0,t[i],r):t[i]=r),t},{})),n=(0,c.isNumber)(t.to)?t.to:1,i=0;i<=n;i++)l[i]=(0,c.merge)({},e,(0,c.isObject)(o[i])?o[i]:{});return l},getNodeWidth:function(t,e){let{chart:o,options:i}=t,{nodeDistance:s=0,nodeWidth:n=0}=i,{plotSizeX:r=1}=o;if("auto"===n){if("string"==typeof s&&/%$/.test(s))return r/(e+parseFloat(s)/100*(e-1));let t=Number(s);return(r+t)/(e||1)-t}return(0,c.relativeLength)(n,r)},setTreeValues:function t(e,o){let i=o.before,s=o.idRoot,n=o.mapIdToNode[s],r=!1!==o.levelIsConstant,l=o.points[e.i],a=l&&l.options||{},h=[],d=0;e.levelDynamic=e.level-(r?0:n.level),e.name=(0,c.pick)(l&&l.name,""),e.visible=s===e.id||!0===o.visible,"function"==typeof i&&(e=i(e,o)),e.children.forEach((i,s)=>{let n=(0,c.extend)({},o);(0,c.extend)(n,{index:s,siblings:e.children.length,visible:e.visible}),i=t(i,n),h.push(i),i.visible&&(d+=i.val)});let p=(0,c.pick)(a.value,d);return e.visible=p>=0&&(d>0||e.visible),e.children=h,e.childrenTotal=d,e.isLeaf=e.visible&&!d,e.val=p,e},updateRootId:function(t){let e,o;return(0,c.isObject)(t)&&(o=(0,c.isObject)(t.options)?t.options:{},e=(0,c.pick)(t.rootNode,o.rootId,""),(0,c.isObject)(t.userOptions)&&(t.userOptions.rootId=e),t.rootNode=e),e}};n=w(),(0,c.pushUnique)(M,"TextPath")&&((0,c.addEvent)(n,"afterGetBBox",function(t){let e=t.bBox,o=this.element?.querySelector("textPath");if(o){let t=[],{b:i,h:s}=this.renderer.fontMetrics(this.element),n=s-i,r=RegExp('(<tspan>|<tspan(?!\\sclass="highcharts-br")[^>]*>|<\\/tspan>)',"g"),l=o.innerHTML.replace(r,"").split(/<tspan class="highcharts-br"[^>]*>/),a=l.length,h=(t,e)=>{let{x:s,y:r}=e,l=(o.getRotationOfChar(t)-90)*F,a=Math.cos(l),h=Math.sin(l);return[[s-n*a,r-n*h],[s+i*a,r+i*h]]};for(let e=0,i=0;i<a;i++){let s=l[i].length;for(let n=0;n<s;n+=5)try{let s=e+n+i,[r,l]=h(s,o.getStartPositionOfChar(s));0===n?(t.push(l),t.push(r)):(0===i&&t.unshift(l),i===a-1&&t.push(r))}catch{break}e+=s-1;try{let s=e+i,n=o.getEndPositionOfChar(s),[r,l]=h(s,n);t.unshift(l),t.unshift(r)}catch{break}}t.length&&t.push(t[0].slice()),e.polygon=t}return e}),(0,c.addEvent)(n,"beforeAddingDataLabel",function(t){let e=t.labelOptions,o=t.point,i=e[o.formatPrefix+"TextPath"]||e.textPath;i&&!e.useHTML&&(this.setTextPath(o.getDataLabelPath?.(this)||o.graphic,i),o.dataLabelPath&&!i.enabled&&(o.dataLabelPath=o.dataLabelPath.destroy()))}),n.prototype.setTextPath=n.prototype.setTextPath??function(t,e){let o=this.renderer.url,i=this.text||this,s=i.textPath,{attributes:n,enabled:r}=(0,c.merge)({enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},e);if(t=t||s&&s.path,s?.undo(),t&&r){let e=(0,c.addEvent)(i,"afterModifyTree",e=>{if(t&&r){let s=t.attr("id");s||t.attr("id",s=(0,c.uniqueKey)());let r={x:0,y:0};(0,c.defined)(n.dx)&&(r.dx=n.dx,delete n.dx),(0,c.defined)(n.dy)&&(r.dy=n.dy,delete n.dy),i.attr(r),this.attr({transform:""}),this.box&&(this.box=this.box.destroy());let l=e.nodes.slice(0);e.nodes.length=0,e.nodes[0]={tagName:"textPath",attributes:(0,c.extend)(n,{"text-anchor":n.textAnchor,href:`${o}#${s}`}),children:l}}});i.textPath={path:t,undo:e}}else i.attr({dx:0,dy:0}),delete i.textPath;return this.added&&(i.textCache="",this.renderer.buildText(i)),this});class D extends W{static getDLOptions(t){let e=(0,c.isObject)(t.optionsPoint)?t.optionsPoint.dataLabels:{},o=(0,c.isObject)(t.level)?t.level.dataLabels:{};return(0,c.merge)({style:{}},o,e,{zIndex:o?.zIndex})}createNodeColumns(){let t=[];for(let e of this.nodes)e.setNodeColumn(),t[e.column]||(t[e.column]=L.compose([],this)),t[e.column].push(e);for(let e=0;e<t.length;e++)void 0===t[e]&&(t[e]=L.compose([],this));return t}order(t,e,o){if(o||(o=new Set),void 0===t.level||t.level<e){for(let i of(t.level=e,o.add(t),t.linksFrom))i.toNode&&!o.has(i.toNode)&&this.order(i.toNode,e+1,o);o.delete(t)}}generatePoints(){if(b.generatePoints.apply(this,arguments),this.orderNodes){for(let t of this.nodes)0===t.linksTo.length&&this.order(t,0);(0,c.stableSort)(this.nodes,(t,e)=>t.level-e.level)}}getNodePadding(){let t=this.options.nodePadding||0;if(this.nodeColumns){let e=this.nodeColumns.reduce((t,e)=>Math.max(t,e.length),0);e*t>this.chart.plotSizeY&&(t=this.chart.plotSizeY/e)}return t}hasData(){return!!this.dataTable.rowCount}pointAttribs(t,e){if(!t)return{};let o=this,i=t.isNode?t.level:t.fromNode.level,s=o.mapOptionsToLevel[i||0]||{},n=t.options,r=s.states&&s.states[e||""]||{},l=["colorByPoint","borderColor","borderWidth","linkOpacity","opacity"].reduce((t,e)=>(t[e]=(0,c.pick)(r[e],n[e],s[e],o.options[e]),t),{}),a=(0,c.pick)(r.color,n.color,l.colorByPoint?t.color:s.color);return t.isNode?{fill:a,stroke:l.borderColor,"stroke-width":l.borderWidth,opacity:l.opacity}:{fill:a,"fill-opacity":l.linkOpacity}}drawTracker(){W.prototype.drawTracker.call(this,this.points),W.prototype.drawTracker.call(this,this.nodes)}drawPoints(){W.prototype.drawPoints.call(this,this.points),W.prototype.drawPoints.call(this,this.nodes)}drawDataLabels(){W.prototype.drawDataLabels.call(this,this.points),W.prototype.drawDataLabels.call(this,this.nodes)}translate(){this.generatePoints(),this.nodeColumns=this.createNodeColumns();let t=this,e=this.chart,o=this.options,i=this.nodeColumns,s=i.length;for(let n of(this.nodeWidth=E(this,s),this.nodePadding=this.getNodePadding(),this.translationFactor=i.reduce((e,o)=>Math.min(e,o.sankeyColumn.getTranslationFactor(t)),1/0),this.colDistance=(e.plotSizeX-this.nodeWidth-o.borderWidth)/Math.max(1,i.length-1),t.mapOptionsToLevel=I({from:1,levels:o.levels,to:i.length-1,defaults:{borderColor:o.borderColor,borderRadius:o.borderRadius,borderWidth:o.borderWidth,color:t.color,colorByPoint:o.colorByPoint,levelIsConstant:!0,linkColor:o.linkColor,linkLineWidth:o.linkLineWidth,linkOpacity:o.linkOpacity,states:o.states}}),i))for(let e of n)t.translateNode(e,n);for(let e of this.nodes)for(let o of e.linksFrom)(o.weight||o.isNull)&&o.to&&(t.translateLink(o),o.allowShadow=!1)}getY(t,e,o,i){let s=(e.offset(t,o)||0)*this.translationFactor;return Math.min(e.nodeY+s,e.nodeY+(e.shapeArgs&&e.shapeArgs.height||0)-i)}translateLink(t,e){let o=t.fromNode,i=t.toNode,s=this.chart,{inverted:n}=s,r=this.translationFactor,l=this.options,a=(0,c.pick)(t.linkColorMode,l.linkColorMode),h=(s.inverted?-this.colDistance:this.colDistance)*l.curveFactor,d=o.nodeX,p=i.nodeX,u=t.outgoing,f=Math.max((t.weight||0)*r,this.options.minLinkWidth||0),m=this.getY(t,o,"linksFrom",f),g=e||this.getY(t,i,"linksTo",f),y=this.nodeWidth,b=p>d+y;if(s.inverted&&(m=s.plotSizeY-m,g=(s.plotSizeY||0)-g,y=-y,f=-f,b=d>p),t.shapeType="path",t.linkBase=[m,m+f,g,g+f],b&&"number"==typeof g)t.shapeArgs={d:[["M",d+y,m],["C",d+y+h,m,p-h,g,p,g],["L",p+(u?y:0),g+f/2],["L",p,g+f],["C",p-h,g+f,d+y+h,m+f,d+y,m+f],["Z"]]};else if("number"==typeof g){let e=s.plotHeight-m-f,o=p-20-f,i=p-20,n=d+y,r=n+20,l=r+f,a=m,h=m+f,c=h+20,u=c+e,b=u+20,x=b+f,v=g,k=v+f,N=k+20,C=h-.7*f,P=b+.7*f,L=k-.7*f,S=p-.7*f,T=n+.7*f;t.shapeArgs={d:[["M",n,a],["C",T,a,l,C,l,c],["L",l,u],["C",l,P,T,x,n,x],["L",p,x],["C",S,x,o,P,o,u],["L",o,N],["C",o,L,S,v,p,v],["L",p,k],["C",i,k,i,k,i,N],["L",i,u],["C",i,b,i,b,p,b],["L",n,b],["C",r,b,r,b,r,u],["L",r,c],["C",r,h,r,h,n,h],["Z"]]}}if(t.dlBox={x:d+(p-d+y)/2,y:m+(g-m)/2,height:f,width:0},t.tooltipPos=s.inverted?[s.plotSizeY-t.dlBox.y-f/2,s.plotSizeX-t.dlBox.x]:[t.dlBox.x,t.dlBox.y+f/2],t.y=t.plotY=1,t.x=t.plotX=1,!t.options.color){if("from"===a)t.color=o.color;else if("to"===a)t.color=i.color;else if("gradient"===a){let e=H(o.color).get(),s=H(i.color).get();t.color={linearGradient:{x1:1,x2:0,y1:0,y2:0},stops:[[0,n?e:s],[1,n?s:e]]}}}}translateNode(t,e){let o=this.translationFactor,i=this.chart,s=this.options,{borderRadius:n,borderWidth:r=0}=s,l=t.getSum(),a=Math.max(Math.round(l*o),this.options.minLinkWidth),h=Math.round(this.nodeWidth),d=e.sankeyColumn.offset(t,o),p=(0,c.crisp)((0,c.pick)(d.absoluteTop,e.sankeyColumn.top(o)+d.relativeTop),r),u=(0,c.crisp)(this.colDistance*t.column+r/2,r)+(0,c.relativeLength)(t.options[i.inverted?"offsetVertical":"offsetHorizontal"]||0,h),f=i.inverted?i.plotSizeX-u:u;if(t.sum=l,l){t.shapeType="roundedRect",t.nodeX=f,t.nodeY=p;let e=f,o=p,r=t.options.width||s.width||h,l=t.options.height||s.height||a,d=(0,c.clamp)((0,c.relativeLength)("object"==typeof n?n.radius:n||0,r),0,a/2);i.inverted&&(e=f-h,o=i.plotSizeY-p-a,r=t.options.height||s.height||h,l=t.options.width||s.width||a),t.dlOptions={...D.getDLOptions({level:this.mapOptionsToLevel[t.level],optionsPoint:t.options}),zIndex:void 0},delete t.dlOptions.zIndex,t.plotX=1,t.plotY=1,t.tooltipPos=i.inverted?[i.plotSizeY-o-l/2,i.plotSizeX-e-r/2]:[e+r/2,o+l/2],t.shapeArgs={x:e,y:o,width:r,height:l,r:d,display:t.hasShape()?"":"none"}}else t.dlOptions={enabled:!1}}}D.defaultOptions=(0,c.merge)(W.defaultOptions,{borderWidth:0,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(){},inside:!0},inactiveOtherPoints:!0,linkColorMode:"from",linkOpacity:.5,opacity:1,minLinkWidth:0,nodeAlignment:"center",nodeWidth:20,nodePadding:10,nodeDistance:30,showInLegend:!1,states:{hover:{linkOpacity:1,opacity:1},inactive:{linkOpacity:.1,opacity:.1,animation:{duration:50}}},tooltip:{followPointer:!0,headerFormat:'<span style="font-size: 0.8em">{series.name}</span><br/>',pointFormat:"{point.fromNode.name} → {point.toNode.name}: <b>{point.weight}</b><br/>",nodeFormat:"{point.name}: <b>{point.sum}</b><br/>"}}),b.compose(N,D),(0,c.extend)(D.prototype,{animate:z.prototype.animate,createNode:b.createNode,forceDL:!0,invertible:!0,isCartesian:!1,orderNodes:!0,noSharedTooltip:!0,pointArrayMap:["from","to","weight"],pointClass:N,searchPoint:u().noop}),m().registerSeriesType("sankey",D);let Y=u();return p.default})());