/**
 * Highcharts JS v12.5.0 (2026-01-12)
 * @module highcharts/modules/dependency-wheel
 * @requires highcharts
 * @requires highcharts/modules/sankey
 *
 * Dependency wheel module
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Torstein Honsi
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,a={};a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var s in e)a.o(e,s)&&!a.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let s=t.default;var r=a.n(s);let n=t.default.SeriesRegistry;var o=a.n(n);let{sankey:{prototype:{pointClass:i}}}=o().seriesTypes,{pInt:l,wrap:h}=r(),d=class extends i{getDataLabelPath(t){let e=this,a=e.series.chart.renderer,s=e.shapeArgs,r=e.angle<0||e.angle>Math.PI,n=s.start||0,o=s.end||0;return e.dataLabelPath?(e.dataLabelPath=e.dataLabelPath.destroy(),delete e.dataLabelPath):h(t,"destroy",function(t){return e.dataLabelPath&&(e.dataLabelPath=e.dataLabelPath.destroy()),t.call(this)}),e.dataLabelPath=a.arc({open:!0,longArc:Math.abs(Math.abs(n)-Math.abs(o))<Math.PI?0:1}).attr({x:s.x,y:s.y,r:(s.r||0)+l(t.options?.distance||0),start:r?n:o,end:r?o:n,clockwise:+r}).add(a.defs),e.dataLabelPath}isValid(){return!0}},{defined:p,getAlignFactor:c,relativeLength:u}=r();var f=e||(e={});f.compose=function(t,e){return t.sankeyColumn=new g(t,e),t};class g{constructor(t,e){this.points=t,this.series=e}getTranslationFactor(t){let e=this.points,a=e.slice(),s=t.chart,r=t.options.minLinkWidth||0,n,o=0,i,l=(s.plotSizeY||0)-(t.options.borderWidth||0)-(e.length-1)*t.nodePadding;for(;e.length;){for(o=l/e.sankeyColumn.sum(),n=!1,i=e.length;i--;)e[i].getSum()*o<r&&(e.splice(i,1),l=Math.max(0,l-r),n=!0);if(!n)break}for(let t of(e.length=0,a))e.push(t);return o}top(t){let e=this.series,a=e.nodePadding,s=this.points.reduce((s,r)=>(s>0&&(s+=a),s+=Math.max(r.getSum()*t,e.options.minLinkWidth||0)),0);return c(e.options.nodeAlignment||"center")*((e.chart.plotSizeY||0)-s)}left(t){let e=this.series,a=e.chart,s=e.options.equalNodes,r=a.inverted?a.plotHeight:a.plotWidth,n=e.nodePadding,o=this.points.reduce((a,o)=>(a>0&&(a+=n),a+=s?r/o.series.nodes.length-n:Math.max(o.getSum()*t,e.options.minLinkWidth||0)),0);return((a.plotSizeX||0)-Math.round(o))/2}sum(){return this.points.reduce((t,e)=>t+e.getSum(),0)}offset(t,e){let a=this.points,s=this.series,r=s.nodePadding,n=0,o;if(s.is("organization")&&t.hangsFrom)return{absoluteTop:t.hangsFrom.nodeY};for(let i=0;i<a.length;i++){let l=a[i].getSum(),h=Math.max(l*e,s.options.minLinkWidth||0),d=t.options[s.chart.inverted?"offsetHorizontal":"offsetVertical"],c=t.options.offset||0;if(o=l?h+r:0,a[i]===t)return{relativeTop:n+(p(d)?u(d,h):u(c,o))};n+=o}}}f.SankeyColumnAdditions=g;let y=e,m=t.default.SVGElement;var x=a.n(m);let{deg2rad:b}=r(),{addEvent:P,merge:M,uniqueKey:L,defined:k,extend:T}=r();function v(t,e){e=M(!0,{enabled:!0,attributes:{dy:-5,startOffset:"50%",textAnchor:"middle"}},e);let a=this.renderer.url,s=this.text||this,r=s.textPath,{attributes:n,enabled:o}=e;if(t=t||r&&r.path,r&&r.undo(),t&&o){let e=P(s,"afterModifyTree",e=>{if(t&&o){let r=t.attr("id");r||t.attr("id",r=L());let o={x:0,y:0};k(n.dx)&&(o.dx=n.dx,delete n.dx),k(n.dy)&&(o.dy=n.dy,delete n.dy),s.attr(o),this.attr({transform:""}),this.box&&(this.box=this.box.destroy());let i=e.nodes.slice(0);e.nodes.length=0,e.nodes[0]={tagName:"textPath",attributes:T(n,{"text-anchor":n.textAnchor,href:`${a}#${r}`}),children:i}}});s.textPath={path:t,undo:e}}else s.attr({dx:0,dy:0}),delete s.textPath;return this.added&&(s.textCache="",this.renderer.buildText(s)),this}function C(t){let e=t.bBox,a=this.element?.querySelector("textPath");if(a){let t=[],{b:s,h:r}=this.renderer.fontMetrics(this.element),n=r-s,o=RegExp('(<tspan>|<tspan(?!\\sclass="highcharts-br")[^>]*>|<\\/tspan>)',"g"),i=a.innerHTML.replace(o,"").split(/<tspan class="highcharts-br"[^>]*>/),l=i.length,h=(t,e)=>{let{x:r,y:o}=e,i=(a.getRotationOfChar(t)-90)*b,l=Math.cos(i),h=Math.sin(i);return[[r-n*l,o-n*h],[r+s*l,o+s*h]]};for(let e=0,s=0;s<l;s++){let r=i[s].length;for(let n=0;n<r;n+=5)try{let r=e+n+s,[o,i]=h(r,a.getStartPositionOfChar(r));0===n?(t.push(i),t.push(o)):(0===s&&t.unshift(i),s===l-1&&t.push(o))}catch{break}e+=r-1;try{let r=e+s,n=a.getEndPositionOfChar(r),[o,i]=h(r,n);t.unshift(i),t.unshift(o)}catch{break}}t.length&&t.push(t[0].slice()),e.polygon=t}return e}function S(t){let e=t.labelOptions,a=t.point,s=e[a.formatPrefix+"TextPath"]||e.textPath;s&&!e.useHTML&&(this.setTextPath(a.getDataLabelPath?.(this)||a.graphic,s),a.dataLabelPath&&!s.enabled&&(a.dataLabelPath=a.dataLabelPath.destroy()))}let{animObject:A}=r(),{deg2rad:N}=r(),{pie:O,sankey:w}=o().seriesTypes,{extend:F,merge:W,relativeLength:Y}=r();({compose:function(t){P(t,"afterGetBBox",C),P(t,"beforeAddingDataLabel",S);let e=t.prototype;e.setTextPath||(e.setTextPath=v)}}).compose(x());class B extends w{animate(t){if(!t){let t=A(this.options.animation).duration/2/this.nodes.length,e=0;for(let a of this.nodes){let s=a.graphic;s&&(s.attr({opacity:0}),setTimeout(()=>{a.graphic&&a.graphic.animate({opacity:1},{duration:t})},t*e++))}for(let t of this.points){let e=t.graphic;!t.isNode&&e&&e.attr({opacity:0}).animate({opacity:1},this.options.animation)}}}createNode(t){let e=super.createNode(t);return e.getSum=()=>e.linksFrom.concat(e.linksTo).reduce((t,e)=>t+e.weight,0),e.offset=t=>{let a=t=>t.fromNode===e?t.toNode:t.fromNode,s=0,r=e.linksFrom.concat(e.linksTo),n;r.sort((t,e)=>a(t).index-a(e).index);for(let t=0;t<r.length;t++)if(a(r[t]).index>e.index){r=r.slice(0,t).reverse().concat(r.slice(t).reverse()),n=!0;break}n||r.reverse();for(let e=0;e<r.length;e++){if(r[e]===t)return s;s+=r[e].weight}},e}createNodeColumns(){let t=[y.compose([],this)];for(let e of this.nodes)e.column=0,t[0].push(e);return t}getNodePadding(){return this.options.nodePadding/Math.PI}translate(){let t=this.options,e=2*Math.PI/(this.chart.plotHeight+this.getNodePadding()),a=this.getCenter(),s=(t.startAngle-90)*N,r=t.borderRadius,n="object"==typeof r?r.radius:r;for(let r of(super.translate(),this.nodeColumns[0]))if(r.sum){let o=r.shapeArgs,i=a[0],l=a[1],h=a[2]/2,d=h-Y(("auto"===t.nodeWidth?20:t.nodeWidth)||0,h),p=s+e*(o.y||0),c=s+e*((o.y||0)+(o.height||0));for(let a of(r.angle=p+(c-p)/2,r.shapeType="arc",r.shapeArgs={x:i,y:l,r:h,innerR:d,start:p,end:c,borderRadius:n},r.dlBox={x:i+Math.cos((p+c)/2)*(h+d)/2,y:l+Math.sin((p+c)/2)*(h+d)/2,width:1,height:1},r.linksFrom))if(a.linkBase){let r,n,o=a.linkBase.map((o,h)=>{let p=e*o,c=Math.cos(s+p)*(d+1),u=Math.sin(s+p)*(d+1);return r=t.curveFactor||0,(n=Math.abs(a.linkBase[3-h]*e-p))>Math.PI&&(n=2*Math.PI-n),(n*=d)<d&&(r*=n/d),{x:i+c,y:l+u,cpX:i+(1-r)*c,cpY:l+(1-r)*u}});a.shapeArgs={d:[["M",o[0].x,o[0].y],["A",d,d,0,0,1,o[1].x,o[1].y],["C",o[1].cpX,o[1].cpY,o[2].cpX,o[2].cpY,o[2].x,o[2].y],["A",d,d,0,0,1,o[3].x,o[3].y],["C",o[3].cpX,o[3].cpY,o[0].cpX,o[0].cpY,o[0].x,o[0].y]]}}}}}B.defaultOptions=W(w.defaultOptions,{center:[null,null],curveFactor:.6,startAngle:0,dataLabels:{textPath:{enabled:!1,attributes:{dy:5}}}}),F(B.prototype,{orderNodes:!1,getCenter:O.prototype.getCenter}),B.prototype.pointClass=d,o().registerSeriesType("dependencywheel",B);let I=r();export{I as default};