/**
 * Highcharts JS v12.6.0 (2026-04-13)
 * @module modules/arc-diagram
 * @requires highcharts/modules/sankey
 *
 * Arc diagram module
 *
 * (c) 2021-2026 Highsoft AS
 * Author: Piotr Madej
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,o,n={};n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let s=t.default;var i=n.n(s);let r=t.default.SeriesRegistry;var a=n.n(r);let{doc:l,win:h}=i();function d(t,e,o,n={}){let s="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(s,"hcEvents")||(s.hcEvents={});let r=s.hcEvents;i().Point&&t instanceof i().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let a=t.addEventListener;a&&a.call(t,e,o,!!i().supportsPassiveEvents&&{passive:void 0===n.passive?-1!==e.indexOf("touch"):n.passive,capture:!1}),r[e]||(r[e]=[]);let l={fn:o,order:"number"==typeof n.order?n.order:1/0};return r[e].push(l),r[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,o){function n(e,o){let n=t.removeEventListener;n&&n.call(t,e,o,!1)}function s(o){let s,i;t.nodeName&&(e?(s={})[e]=!0:s=o,k(s,function(t,e){if(o[e])for(i=o[e].length;i--;)n(e,o[e][i].fn)}))}let i="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(i,"hcEvents")){let t=i.hcEvents;if(e){let i=t[e]||[];o?(t[e]=i.filter(function(t){return o!==t.fn}),n(e,o)):(s(t),t[e]=[])}else s(t),delete i.hcEvents}}(t,e,o)}}function p(t,e=0,o){let n=e%2/2,s=o?-1:1;return(Math.round(t*s-n)+n)*s}function c(t){return null!=t}function u(t,e){let o;for(o in t||(t={}),e)t[o]=e[o];return t}let f=Array.prototype.find?function(t,e){return t.find(e)}:function(t,e){let o,n=t.length;for(o=0;o<n;o++)if(e(t[o],o))return t[o]};function m(t){return g(t)&&"number"==typeof t.nodeType}function g(t,e){let o;return!!t&&"object"==typeof t&&(!e||"[object Array]"!==(o=Object.prototype.toString.call(t))&&"[object Array Iterator]"!==o)}function y(t,...e){let o,n=[t,...e],s={},i=function(t,e){return"object"!=typeof t&&(t={}),k(e,function(o,n){if("__proto__"!==n&&"constructor"!==n){let s;!g(o,!0)||(s=o?.constructor,g(o,!0)&&!m(o)&&s?.name&&"Object"!==s.name)||m(o)?t[n]=e[n]:t[n]=i(t[n]||{},o)}}),t};!0===t&&(s=n[1],n=Array.prototype.slice.call(n,2));let r=n.length;for(o=0;o<r;o++)s=i(s,n[o]);return s}function k(t,e,o){for(let n in t)Object.hasOwnProperty.call(t,n)&&e.call(o||t[n],t[n],n,t)}function x(){let t=arguments,e=t.length;for(let o=0;o<e;o++){let e=t[o];if(null!=e)return e}}function b(t,e,o){return/%$/.test(t)?e*parseFloat(t)/100+(o||0):parseFloat(t)}let{series:{prototype:v,prototype:{pointClass:{prototype:P}}}}=a();!function(t){function e(){return this.data=[].concat(this.points||[],this.nodes),v.destroy.apply(this,arguments)}function o(){this.nodes&&(this.nodes.forEach(t=>{t.destroy()}),this.nodes.length=0),v.setData.apply(this,arguments)}function n(t){let e=arguments,o=this.isNode?this.linksTo.concat(this.linksFrom):[this.fromNode,this.toNode];"select"!==t&&o.forEach(t=>{t&&t.series&&(P.setState.apply(t,e),!t.isNode&&(t.fromNode.graphic&&P.setState.apply(t.fromNode,e),t.toNode&&t.toNode.graphic&&P.setState.apply(t.toNode,e)))}),P.setState.apply(this,e)}function s(t,e,o,n){let s=this.series.options.nodes,i=this.series.options.data,r=i?.length||0,a=i?.[this.index];if(P.update.call(this,t,!this.isNode&&e,o,n),this.isNode){let t=(s||[]).reduce((t,e,o)=>this.id===e.id?o:t,-1),n=y(s&&s[t]||{},i?.[this.index]||{});i&&(a?i[this.index]=a:i.length=r),s?t>=0?s[t]=n:s.push(n):this.series.options.nodes=[n],x(e,!0)&&this.series.chart.redraw(o)}}t.compose=function(t,i){let r=t.prototype,a=i.prototype;return r.setNodeState=n,r.setState=n,r.update=s,a.destroy=e,a.setData=o,i},t.createNode=function(t){let e=this.pointClass,o=(t,e)=>f(t,t=>t.id===e),n=o(this.nodes,t),s;if(!n){s=this.options.nodes&&o(this.options.nodes,t);let i=new e(this,u({className:"highcharts-node",isNode:!0,id:t,y:1},s));i.linksTo=[],i.linksFrom=[],i.getSum=function(){let t=0,e=0;return i.linksTo.forEach(e=>{t+=e.weight||0}),i.linksFrom.forEach(t=>{e+=t.weight||0}),Math.max(t,e)},i.offset=function(t,e){let o=0;for(let n=0;n<i[e].length;n++){if(i[e][n]===t)return o;o+=i[e][n].weight}},i.hasShape=function(){let t=0;return i.linksTo.forEach(e=>{e.outgoing&&t++}),!i.linksTo.length||t!==i.linksTo.length},i.index=this.nodes.push(i)-1,n=i}return n.formatPrefix="node",n.name=n.name||n.options.id||"",n.mass=x(n.options.mass,n.options.marker&&n.options.marker.radius,this.options.marker&&this.options.marker.radius,4),n},t.destroy=e,t.generatePoints=function(){let t=this.chart,e={};v.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=>{c(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=x(o.options.colorIndex,e[o.from].colorIndex):o.color=o.options.color||e[o.from].color),c(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=n,t.updateNode=s}(e||(e={}));let S=e,{seriesTypes:{sankey:{prototype:{pointClass:L}}}}=a();class N extends L{isValid(){return!0}}u(N.prototype,{setState:S.setNodeState});var T=o||(o={});T.compose=function(t,e){return t.sankeyColumn=new C(t,e),t};class C{constructor(t,e){this.points=t,this.series=e}getTranslationFactor(t){let e=this.points,o=e.slice(),n=t.chart,s=t.options.minLinkWidth||0,i,r=0,a,l=(n.plotSizeY||0)-(t.options.borderWidth||0)-(e.length-1)*t.nodePadding;for(;e.length;){for(r=l/e.sankeyColumn.sum(),i=!1,a=e.length;a--;)e[a].getSum()*r<s&&(e.splice(a,1),l=Math.max(0,l-s),i=!0);if(!i)break}for(let t of(e.length=0,o))e.push(t);return r}top(t){let e=this.series,o=e.nodePadding,n=this.points.reduce((n,s)=>(n>0&&(n+=o),n+=Math.max(s.getSum()*t,e.options.minLinkWidth||0)),0);return((t="")=>({center:.5,right:1,middle:.5,bottom:1})[t]||0)(e.options.nodeAlignment||"center")*((e.chart.plotSizeY||0)-n)}left(t){let e=this.series,o=e.chart,n=e.options.equalNodes,s=o.inverted?o.plotHeight:o.plotWidth,i=e.nodePadding,r=this.points.reduce((o,r)=>(o>0&&(o+=i),o+=n?s/r.series.nodes.length-i: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,n=this.series,s=n.nodePadding,i=0,r;if(n.is("organization")&&t.hangsFrom)return{absoluteTop:t.hangsFrom.nodeY};for(let a=0;a<o.length;a++){let l=o[a].getSum(),h=Math.max(l*e,n.options.minLinkWidth||0),d=t.options[n.chart.inverted?"offsetHorizontal":"offsetVertical"],p=t.options.offset||0;if(r=l?h+s:0,o[a]===t)return{relativeTop:i+(c(d)?b(d,h):b(p,r))};i+=r}}}T.SankeyColumnAdditions=C;let M=o,O=t.default.Series;var A=n.n(O);let W=t.default.SVGRenderer;var E=n.n(W);let w=t.default.SVGElement;var z=n.n(w);let{deg2rad:F}=i();function Y(t,e){e=y(!0,{enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},e);let o=this.renderer.url,n=this.text||this,i=n.textPath,{attributes:r,enabled:a}=e;if(t=t||i&&i.path,i&&i.undo(),t&&a){let e=d(n,"afterModifyTree",e=>{if(t&&a){let i=t.attr("id");i||t.attr("id",i=(0,s.uniqueKey)());let a={x:0,y:0};c(r.dx)&&(a.dx=r.dx,delete r.dx),c(r.dy)&&(a.dy=r.dy,delete r.dy),n.attr(a),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:u(r,{"text-anchor":r.textAnchor,href:`${o}#${i}`}),children:l}}});n.textPath={path:t,undo:e}}else n.attr({dx:0,dy:0}),delete n.textPath;return this.added&&(n.textCache="",this.renderer.buildText(n)),this}function j(t){let e=t.bBox,o=this.element?.querySelector("textPath");if(o){let t=[],{b:n,h:s}=this.renderer.fontMetrics(this.element),i=s-n,r=RegExp('(<tspan>|<tspan(?!\\sclass="highcharts-br")[^>]*>|<\\/tspan>)',"g"),a=o.innerHTML.replace(r,"").split(/<tspan class="highcharts-br"[^>]*>/),l=a.length,h=(t,e)=>{let{x:s,y:r}=e,a=(o.getRotationOfChar(t)-90)*F,l=Math.cos(a),h=Math.sin(a);return[[s-i*l,r-i*h],[s+n*l,r+n*h]]};for(let e=0,n=0;n<l;n++){let s=a[n].length;for(let i=0;i<s;i+=5)try{let s=e+i+n,[r,a]=h(s,o.getStartPositionOfChar(s));0===i?(t.push(a),t.push(r)):(0===n&&t.unshift(a),n===l-1&&t.push(r))}catch{break}e+=s-1;try{let s=e+n,i=o.getEndPositionOfChar(s),[r,a]=h(s,i);t.unshift(a),t.unshift(r)}catch{break}}t.length&&t.push(t[0].slice()),e.polygon=t}return e}function X(t){let e=t.labelOptions,o=t.point,n=e[o.formatPrefix+"TextPath"]||e.textPath;n&&!e.useHTML&&(this.setTextPath(o.getDataLabelPath?.(this)||o.graphic,n),o.dataLabelPath&&!n.enabled&&(o.dataLabelPath=o.dataLabelPath.destroy()))}({compose:function(t){d(t,"afterGetBBox",j),d(t,"beforeAddingDataLabel",X);let e=t.prototype;e.setTextPath||(e.setTextPath=Y)}}).compose(z());let{prototype:{symbols:B}}=E(),{seriesTypes:{column:H,sankey:D}}=a();class _ extends D{createNodeColumns(){let t=this,e=t.chart,o=M.compose([],t);return o.sankeyColumn.maxLength=e.inverted?e.plotHeight:e.plotWidth,o.sankeyColumn.getTranslationFactor=t=>{let n=o.slice(),s=this.options.minLinkWidth||0,i,r=0,a,l,h=0,d=1,p=0,c=(e.plotSizeX||0)-(t.options.marker&&t.options.marker.lineWidth||0)-(o.length-1)*t.nodePadding;for(;o.length;){for(r=c/o.sankeyColumn.sum(),i=!1,a=o.length;a--;){l=o[a].getSum()*r*d;let t=Math.min(e.plotHeight,e.plotWidth);l>t?d=Math.min(t/l,d):l<s&&(o.splice(a,1),c-=s,l=s,i=!0),p+=l*(1-d)/2,h=Math.max(h,l)}if(!i)break}return o.length=0,n.forEach(t=>{t.scale=d,o.push(t)}),o.sankeyColumn.maxRadius=h,o.sankeyColumn.scale=d,o.sankeyColumn.additionalSpace=p,r},o.sankeyColumn.offset=function(n,s){let i=n.series.options.equalNodes,r=t.nodePadding,a=Math.min(e.plotWidth,e.plotHeight,(o.sankeyColumn.maxLength||0)/t.nodes.length-r),l=o.sankeyColumn.additionalSpace||0,h;for(let e=0;e<o.length;e++){let d=o[e].getSum()*(o.sankeyColumn.scale||0),p=i?a:Math.max(d*s,t.options.minLinkWidth||0);if(h=d?p+r:0,o[e]===n)return{relativeLeft:l+b(n.options.offset||0,h)};l+=h}},t.nodes.forEach(function(t){t.column=0,o.push(t)}),[o]}translateLink(t){let e=t.fromNode,o=t.toNode,n=this.chart,s=this.translationFactor,i=t.options,r=this.options,a=x(i.linkWeight,r.linkWeight,Math.max((t.weight||0)*s*e.scale,this.options.minLinkWidth||0)),l=t.series.options.centeredLinks,h=e.nodeY,d=(e,o)=>{let n=(e.offset(t,o)||0)*s;return Math.min(e.nodeX+n,e.nodeX+(e.shapeArgs&&e.shapeArgs.height||0)-a)},p=l?e.nodeX+((e.shapeArgs.height||0)-a)/2:d(e,"linksFrom"),c=l?o.nodeX+((o.shapeArgs.height||0)-a)/2:d(o,"linksTo"),u=h;p>c&&([p,c]=[c,p]),r.reversed&&([p,c]=[c,p],u=(n.plotSizeY||0)-u),t.shapeType="path",t.linkBase=[p,p+a,c,c+a];let f=(c+a-p)/Math.abs(c+a-p)*x(r.linkRadius,Math.min(Math.abs(c+a-p)/2,e.nodeY-Math.abs(a)));t.shapeArgs={d:[["M",p,u],["A",(c+a-p)/2,f,0,0,1,c+a,u],["L",c,u],["A",(c-p-a)/2,f-a,0,0,0,p+a,u],["Z"]]},t.dlBox={x:p+(c-p)/2,y:u-f,height:a,width:0},t.tooltipPos=n.inverted?[(n.plotSizeY||0)-t.dlBox.y-a/2,(n.plotSizeX||0)-t.dlBox.x]:[t.dlBox.x,t.dlBox.y+a/2],t.y=t.plotY=1,t.x=t.plotX=1,t.color||(t.color=e.color)}translateNode(t,e){let o=this.translationFactor,n=this.chart,s=n.inverted?n.plotWidth:n.plotHeight,i=this.options,r=Math.min(n.plotWidth,n.plotHeight,s/t.series.nodes.length-this.nodePadding),a=t.getSum()*(e.sankeyColumn.scale||0),l=i.equalNodes?r:Math.max(a*o,this.options.minLinkWidth||0),h=i.marker?.lineWidth||0,d=e.sankeyColumn.offset(t,o),c=p(x(d&&d.absoluteLeft,(e.sankeyColumn.left(o)||0)+(d&&d.relativeLeft||0)),h),u=y(i.marker,t.options.marker),f=u.symbol,m=u.radius,g=parseInt(i.offset??"100",10)*((n.inverted?n.plotWidth:n.plotHeight)-(p(this.colDistance*(t.column||0)+(u.lineWidth||0)/2,h)+(e.sankeyColumn.scale||0)*(e.sankeyColumn.maxRadius||0)/2))/100;if(t.sum=a,a){t.nodeX=c,t.nodeY=g;let e=t.options.width||i.width||l,o=t.options.height||i.height||l,s=g;i.reversed&&(s=(n.plotSizeY||0)-g,n.inverted&&(s=(n.plotSizeY||0)-g)),this.mapOptionsToLevel&&(t.dlOptions={...D.getDLOptions({level:this.mapOptionsToLevel[t.level],optionsPoint:t.options}),zIndex:void 0}),t.plotX=1,t.plotY=1,t.tooltipPos=n.inverted?[(n.plotSizeY||0)-s-o/2,(n.plotSizeX||0)-c-e/2]:[c+e/2,s+o/2],t.shapeType="path",t.shapeArgs={d:B[f||"circle"](c,s-(m||o)/2,m||e,m||o),width:m||e,height:m||o},t.dlBox={x:c+e/2,y:s,height:0,width:0}}else t.dlOptions={enabled:!1}}drawDataLabels(){if(this.options.dataLabels){let t=this.options.dataLabels.textPath;H.prototype.drawDataLabels.call(this,this.nodes),this.options.dataLabels.textPath=this.options.dataLabels.linkTextPath,H.prototype.drawDataLabels.call(this,this.data),this.options.dataLabels.textPath=t}}pointAttribs(t,e){if(t&&t.isNode){let{...t}=A().prototype.pointAttribs.apply(this,arguments);return t}return super.pointAttribs.apply(this,arguments)}markerAttribs(t){return t.isNode?super.markerAttribs.apply(this,arguments):{}}}_.defaultOptions=y(D.defaultOptions,{centeredLinks:!1,equalNodes:!1,dataLabels:{linkTextPath:{attributes:{startOffset:"25%"}}},marker:{fillOpacity:1,lineWidth:0,states:{},symbol:"circle"},offset:"100%",reversed:!1}),u(_.prototype,{orderNodes:!1}),_.prototype.pointClass=N,a().registerSeriesType("arcdiagram",_);let R=i();export{R as default};