/**
 * Highcharts Gantt JS v12.6.0 (2026-04-13)
 * @module highcharts/modules/pathfinder
 * @requires highcharts
 *
 * Pathfinder
 *
 * (c) 2016-2026 Highsoft AS
 * Author: Øystein Moseng
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,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 r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let r=t.default;var i=n.n(r);let{doc:o,win:a}=i();function s(t,e,n,r={}){let o="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(o,"hcEvents")||(o.hcEvents={});let a=o.hcEvents;i().Point&&t instanceof i().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let h=t.addEventListener;h&&h.call(t,e,n,!!i().supportsPassiveEvents&&{passive:void 0===r.passive?-1!==e.indexOf("touch"):r.passive,capture:!1}),a[e]||(a[e]=[]);let c={fn:n,order:"number"==typeof r.order?r.order:1/0};return a[e].push(c),a[e].sort((t,e)=>t.order-e.order),function(){!function(t,e,n){function r(e,n){let r=t.removeEventListener;r&&r.call(t,e,n,!1)}function i(n){let i,o;t.nodeName&&(e?(i={})[e]=!0:i=n,M(i,function(t,e){if(n[e])for(o=n[e].length;o--;)r(e,n[e][o].fn)}))}let o="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(o,"hcEvents")){let t=o.hcEvents;if(e){let o=t[e]||[];n?(t[e]=o.filter(function(t){return n!==t.fn}),r(e,n)):(i(t),t[e]=[])}else i(t),delete o.hcEvents}}(t,e,n)}}function h(t){return l(t)&&"number"==typeof t.nodeType}function c(t){let e=Object.prototype.toString.call(t);return"[object Array]"===e||"[object Array Iterator]"===e}function l(t,e){return!!t&&"object"==typeof t&&(!e||!c(t))}function x(t,...e){let n,r=[t,...e],i={},o=function(t,e){return"object"!=typeof t&&(t={}),M(e,function(n,r){if("__proto__"!==r&&"constructor"!==r){let i;!l(n,!0)||(i=n?.constructor,l(n,!0)&&!h(n)&&i?.name&&"Object"!==i.name)||h(n)?t[r]=e[r]:t[r]=o(t[r]||{},n)}}),t};!0===t&&(i=r[1],r=Array.prototype.slice.call(r,2));let a=r.length;for(n=0;n<a;n++)i=o(i,r[n]);return i}function M(t,e,n){for(let r in t)Object.hasOwnProperty.call(t,r)&&e.call(n||t[r],t[r],r,t)}function y(){let t=arguments,e=t.length;for(let n=0;n<e;n++){let e=t[n];if(null!=e)return e}}Array.prototype.find;let p=i().deg2rad,f=Math.max,d=Math.min,u=class{constructor(t,e,n){this.init(t,e,n)}init(t,e,n){this.fromPoint=t,this.toPoint=e,this.options=n,this.chart=t.series.chart,this.pathfinder=this.chart.pathfinder}renderPath(t,e){let n=this.chart,r=n.styledMode,i=this.pathfinder,o={},a=this.graphics&&this.graphics.path;i.group||(i.group=n.renderer.g().addClass("highcharts-pathfinder-group").attr({zIndex:-1}).add(n.seriesGroup)),i.group.translate(n.plotLeft,n.plotTop),!(a&&a.renderer)&&(a=n.renderer.path().add(i.group),r||a.attr({opacity:0})),a.attr(e),o.d=t,r||(o.opacity=1),a.animate(o),this.graphics=this.graphics||{},this.graphics.path=a}addMarker(t,e,n){let r,i,o,a,s,h,c,l=this.fromPoint.series.chart,x=l.pathfinder,M=l.renderer,y="start"===t?this.fromPoint:this.toPoint,f=y.getPathfinderAnchorPoint(e);e.enabled&&((c="start"===t?n[1]:n[n.length-2])&&"M"===c[0]||"L"===c[0])&&(h={x:c[1],y:c[2]},i=y.getRadiansToVector(h,f),r=y.getMarkerVector(i,e.radius,f),e.width&&e.height?(a=e.width,s=e.height):a=s=2*e.radius,this.graphics=this.graphics||{},o={x:r.x-a/2,y:r.y-s/2,width:a,height:s,rotation:-i/p,rotationOriginX:r.x,rotationOriginY:r.y},this.graphics[t]?this.graphics[t].animate(o):(this.graphics[t]=M.symbol(e.symbol).addClass("highcharts-point-connecting-path-"+t+"-marker highcharts-color-"+this.fromPoint.colorIndex).attr(o).add(x.group),M.styledMode||this.graphics[t].attr({fill:e.color||this.fromPoint.color,stroke:e.lineColor,"stroke-width":e.lineWidth,opacity:0}).animate({opacity:1},y.series.options.animation)))}getPath(t){let e=this.pathfinder,n=this.chart,i=e.algorithms[t.type],o=e.chartObstacles;return"function"!=typeof i?((0,r.error)('"'+t.type+'" is not a Pathfinder algorithm.'),{path:[],obstacles:[]}):(i.requiresObstacles&&!o&&(o=e.chartObstacles=e.getChartObstacles(t),n.options.connectors.algorithmMargin=t.algorithmMargin,e.chartObstacleMetrics=e.getObstacleMetrics(o)),i(this.fromPoint.getPathfinderAnchorPoint(t.startMarker),this.toPoint.getPathfinderAnchorPoint(t.endMarker),x({chartObstacles:o,lineObstacles:e.lineObstacles||[],obstacleMetrics:e.chartObstacleMetrics,hardBounds:{xMin:0,xMax:n.plotWidth,yMin:0,yMax:n.plotHeight},obstacleOptions:{margin:t.algorithmMargin},startDirectionX:e.getAlgorithmStartDirection(t.startMarker)},t)))}render(){let t=this.fromPoint,e=t.series,n=e.chart,r=n.pathfinder,i={},o=x(n.options.connectors,e.options.connectors,t.options.connectors,this.options);!n.styledMode&&(i.stroke=o.lineColor||t.color,i["stroke-width"]=o.lineWidth,o.dashStyle&&(i.dashstyle=o.dashStyle)),i.class="highcharts-point-connecting-path highcharts-color-"+t.colorIndex,null==(o=x(i,o)).marker.radius&&(o.marker.radius=d(f(Math.ceil((o.algorithmMargin||8)/2)-1,1),5));let a=this.getPath(o),s=a.path;a.obstacles&&(r.lineObstacles=r.lineObstacles||[],r.lineObstacles=r.lineObstacles.concat(a.obstacles)),this.renderPath(s,i),this.addMarker("start",x(o.marker,o.startMarker),s),this.addMarker("end",x(o.marker,o.endMarker),s)}destroy(){this.graphics&&(M(this.graphics,function(t){t.destroy()}),delete this.graphics)}};function g(t,e){let n=[];for(let r=0;r<t.length;r++){let i=t[r][1],o=t[r][2];if("number"==typeof i&&"number"==typeof o)if(0===r)n.push(["M",i,o]);else if(r===t.length-1)n.push(["L",i,o]);else if(e){let a=t[r-1],s=t[r+1];if(a&&s){let t=a[1],r=a[2],h=s[1],c=s[2];if("number"==typeof t&&"number"==typeof h&&"number"==typeof r&&"number"==typeof c&&t!==h&&r!==c){let a=t<h?1:-1,s=r<c?1:-1;n.push(["L",i-a*Math.min(Math.abs(i-t),e),o-s*Math.min(Math.abs(o-r),e)],["C",i,o,i,o,i+a*Math.min(Math.abs(i-h),e),o+s*Math.min(Math.abs(o-c),e)])}}}else n.push(["L",i,o])}return n}let{min:m,max:b,abs:P}=Math;function v(t,e,n){let r=e-1e-7,i=n||0,o=t.length-1,a,s;for(;i<=o;)if((s=r-t[a=o+i>>1].xMin)>0)i=a+1;else{if(!(s<0))return a;o=a-1}return i>0?i-1:0}function O(t,e){let n=v(t,e.x+1)+1;for(;n--;){var r;if(t[n].xMax>=e.x&&(r=t[n],e.x<=r.xMax&&e.x>=r.xMin&&e.y<=r.yMax&&e.y>=r.yMin))return n}return -1}function k(t){let e=[];if(t.length){e.push(["M",t[0].start.x,t[0].start.y]);for(let n=0;n<t.length;++n)e.push(["L",t[n].end.x,t[n].end.y])}return e}function w(t,e){t.yMin=b(t.yMin,e.yMin),t.yMax=m(t.yMax,e.yMax),t.xMin=b(t.xMin,e.xMin),t.xMax=m(t.xMax,e.xMax)}let E=function(t,e,n){let r=[],i=n.chartObstacles,o=O(i,t),a=O(i,e),s,h=y(n.startDirectionX,P(e.x-t.x)>P(e.y-t.y))?"x":"y",c,l,x,M;function p(t,e,n,r,i){let o={x:t.x,y:t.y};return o[e]=n[r||e]+(i||0),o}function f(t,e,n){let r=P(e[n]-t[n+"Min"])>P(e[n]-t[n+"Max"]);return p(e,n,t,n+(r?"Max":"Min"),r?1:-1)}a>-1?(s={start:l=f(i[a],e,h),end:e},M=l):M=e,o>-1&&(l=f(c=i[o],t,h),r.push({start:t,end:l}),l[h]>=t[h]==l[h]>=M[h]&&(x=t[h="y"===h?"x":"y"]<e[h],r.push({start:l,end:p(l,h,c,h+(x?"Max":"Min"),x?1:-1)}),h="y"===h?"x":"y"));let d=r.length?r[r.length-1].end:t;l=p(d,h,M),r.push({start:d,end:l});let u=p(l,h="y"===h?"x":"y",M);return r.push({start:l,end:u}),r.push(s),{path:g(k(r),n.radius),obstacles:r}};function A(t,e,n){let r=y(n.startDirectionX,P(e.x-t.x)>P(e.y-t.y)),i=r?"x":"y",o=[],a=n.obstacleMetrics,s=m(t.x,e.x)-a.maxWidth-10,h=b(t.x,e.x)+a.maxWidth+10,c=m(t.y,e.y)-a.maxHeight-10,l=b(t.y,e.y)+a.maxHeight+10,x,M,p,f=!1,d=n.chartObstacles,u=v(d,h),g=v(d,s);function E(t,e,n){let r,i,o,a,s=t.x<e.x?1:-1;t.x<e.x?(r=t,i=e):(r=e,i=t),t.y<e.y?(a=t,o=e):(a=e,o=t);let h=s<0?m(v(d,i.x),d.length-1):0;for(;d[h]&&(s>0&&d[h].xMin<=i.x||s<0&&d[h].xMax>=r.x);){if(d[h].xMin<=i.x&&d[h].xMax>=r.x&&d[h].yMin<=o.y&&d[h].yMax>=a.y){if(n)return{y:t.y,x:t.x<e.x?d[h].xMin-1:d[h].xMax+1,obstacle:d[h]};return{x:t.x,y:t.y<e.y?d[h].yMin-1:d[h].yMax+1,obstacle:d[h]}}h+=s}return e}function A(t,e,n,r,i){let o=i.soft,a=i.hard,s=r?"x":"y",h={x:e.x,y:e.y},c={x:e.x,y:e.y},l=t[s+"Max"]>=o[s+"Max"],x=t[s+"Min"]<=o[s+"Min"],M=t[s+"Max"]>=a[s+"Max"],y=t[s+"Min"]<=a[s+"Min"],p=P(t[s+"Min"]-e[s]),f=P(t[s+"Max"]-e[s]),d=10>P(p-f)?e[s]<n[s]:f<p;c[s]=t[s+"Min"],h[s]=t[s+"Max"];let u=E(e,c,r)[s]!==c[s],g=E(e,h,r)[s]!==h[s];return d=u?!g||d:!g&&d,d=x?!l||d:!l&&d,d=y?!M||d:!M&&d}if((u=O(d=d.slice(g,u+1),e))>-1){var I,L;let r,i;I=d[u],L=e,r=m(I.xMax-L.x,L.x-I.xMin)<m(I.yMax-L.y,L.y-I.yMin),i=A(I,L,t,r,{soft:n.hardBounds,hard:n.hardBounds}),p=r?{y:L.y,x:I[i?"xMax":"xMin"]+(i?1:-1)}:{x:L.x,y:I[i?"yMax":"yMin"]+(i?1:-1)},o.push({end:e,start:p}),e=p}for(;(u=O(d,e))>-1;)M=e[i]-t[i]<0,(p={x:e.x,y:e.y})[i]=d[u][M?i+"Max":i+"Min"]+(M?1:-1),o.push({end:e,start:p}),e=p;return{path:k(x=(x=function t(e,r,i){let o,a,x,M,y,p,u;if(e.x===r.x&&e.y===r.y)return[];let g=i?"x":"y",P=n.obstacleOptions.margin,v={soft:{xMin:s,xMax:h,yMin:c,yMax:l},hard:n.hardBounds};return(y=O(d,e))>-1?(M=A(y=d[y],e,r,i,v),w(y,n.hardBounds),u=i?{y:e.y,x:y[M?"xMax":"xMin"]+(M?1:-1)}:{x:e.x,y:y[M?"yMax":"yMin"]+(M?1:-1)},(p=O(d,u))>-1&&(w(p=d[p],n.hardBounds),u[g]=M?b(y[g+"Max"]-P+1,(p[g+"Min"]+y[g+"Max"])/2):m(y[g+"Min"]+P-1,(p[g+"Max"]+y[g+"Min"])/2),e.x===u.x&&e.y===u.y?(f&&(u[g]=M?b(y[g+"Max"],p[g+"Max"])+1:m(y[g+"Min"],p[g+"Min"])-1),f=!f):f=!1),a=[{start:e,end:u}]):(o=E(e,{x:i?r.x:e.x,y:i?e.y:r.y},i),a=[{start:e,end:{x:o.x,y:o.y}}],o[i?"x":"y"]!==r[i?"x":"y"]&&(M=A(o.obstacle,o,r,!i,v),w(o.obstacle,n.hardBounds),x={x:i?o.x:o.obstacle[M?"xMax":"xMin"]+(M?1:-1),y:i?o.obstacle[M?"yMax":"yMin"]+(M?1:-1):o.y},i=!i,a=a.concat(t({x:o.x,y:o.y},x,i)))),a=a.concat(t(a[a.length-1].end,r,!i))}(t,e,r)).concat(o.reverse())),obstacles:x}}E.requiresObstacles=!0,A.requiresObstacles=!0;let I={connectors:{type:"straight",radius:0,lineWidth:1,marker:{enabled:!1,align:"center",verticalAlign:"middle",inside:!1,lineWidth:1},startMarker:{symbol:"diamond"},endMarker:{symbol:"arrow-filled"}}},{setOptions:L}=i();function j(t){let e=t.shapeArgs;if(e)return{xMin:e.x||0,xMax:(e.x||0)+(e.width||0),yMin:e.y||0,yMax:(e.y||0)+(e.height||0)};let n=t.graphic&&t.graphic.getBBox();return n?{xMin:t.plotX-n.width/2,xMax:t.plotX+n.width/2,yMin:t.plotY-n.height/2,yMax:t.plotY+n.height/2}:null}!function(t){function e(t){let e,n,r=j(this);switch(t.align){case"right":e="xMax";break;case"left":e="xMin"}switch(t.verticalAlign){case"top":n="yMin";break;case"bottom":n="yMax"}return{x:e?r[e]:(r.xMin+r.xMax)/2,y:n?r[n]:(r.yMin+r.yMax)/2}}function n(t,e){let n;return null==e&&(n=j(this))&&(e={x:(n.xMin+n.xMax)/2,y:(n.yMin+n.yMax)/2}),Math.atan2(e.y-t.y,t.x-e.x)}function i(t,e,n){let r=2*Math.PI,i=j(this),o=i.xMax-i.xMin,a=i.yMax-i.yMin,s=Math.atan2(a,o),h=o/2,c=a/2,l=i.xMin+h,x=i.yMin+c,M={x:l,y:x},y=t,p=1,f=!1,d=1,u=1;for(;y<-Math.PI;)y+=r;for(;y>Math.PI;)y-=r;return p=Math.tan(y),y>-s&&y<=s?(u=-1,f=!0):y>s&&y<=Math.PI-s?u=-1:y>Math.PI-s||y<=-(Math.PI-s)?(d=-1,f=!0):d=-1,f?(M.x+=d*h,M.y+=u*h*p):(M.x+=a/(2*p)*d,M.y+=u*c),n.x!==l&&(M.x=n.x),n.y!==x&&(M.y=n.y),{x:M.x+e*Math.cos(y),y:M.y-e*Math.sin(y)}}t.compose=function(t,o,a){let s=a.prototype;s.getPathfinderAnchorPoint||(t.prototype.callbacks.push(function(t){!1!==t.options.connectors.enabled&&((t.options.pathfinder||t.series.reduce(function(t,e){return e.options&&x(!0,e.options.connectors=e.options.connectors||{},e.options.pathfinder),t||e.options&&e.options.pathfinder},!1))&&(x(!0,t.options.connectors=t.options.connectors||{},t.options.pathfinder),(0,r.error)('WARNING: Pathfinder options have been renamed. Use "chart.connectors" or "series.connectors" instead.')),this.pathfinder=new o(this),this.pathfinder.update(!0))}),s.getMarkerVector=i,s.getPathfinderAnchorPoint=e,s.getRadiansToVector=n,L(I))}}(e||(e={}));let R=e,B=t.default.Point;var C=n.n(B);let W=Math.max,X=Math.min;class _{static compose(t,e){R.compose(t,_,e)}constructor(t){this.init(t)}init(t){this.chart=t,this.connections=[],s(t,"redraw",function(){this.pathfinder.update()})}update(t){let e=this.chart,n=this,r=n.connections;n.connections=[],e.series.forEach(function(t){t.visible&&!t.options.isInternal&&t.points.forEach(function(t){var r;let i,o=t.options;o&&o.dependency&&(o.connect=o.dependency);let a=t.options?.connect?c(r=t.options.connect)?r:[r]:[];t.visible&&!1!==t.isInside&&a.forEach(r=>{let o="string"==typeof r?r:r.to;o&&(i=e.get(o)),i instanceof C()&&i.series.visible&&i.visible&&!1!==i.isInside&&n.connections.push(new u(t,i,"string"==typeof r?{}:r))})})});for(let t=0,e,i,o=r.length,a=n.connections.length;t<o;++t){i=!1;let o=r[t];for(e=0;e<a;++e){let t=n.connections[e];if((o.options&&o.options.type)===(t.options&&t.options.type)&&o.fromPoint===t.fromPoint&&o.toPoint===t.toPoint){t.graphics=o.graphics,i=!0;break}}i||o.destroy()}delete this.chartObstacles,delete this.lineObstacles,n.renderConnections(t)}renderConnections(t){t?this.chart.series.forEach(function(t){let e=function(){let e=t.chart.pathfinder;(e&&e.connections||[]).forEach(function(e){e.fromPoint&&e.fromPoint.series===t&&e.render()}),t.pathfinderRemoveRenderEvent&&(t.pathfinderRemoveRenderEvent(),delete t.pathfinderRemoveRenderEvent)};!1===t.options.animation?e():t.pathfinderRemoveRenderEvent=s(t,"afterAnimate",e)}):this.connections.forEach(function(t){t.render()})}getChartObstacles(t){let e=this.chart.series,n=y(t.algorithmMargin,0),r=[],i;for(let t=0,i=e.length;t<i;++t)if(e[t].visible&&!e[t].options.isInternal)for(let i=0,o=e[t].points.length,a,s;i<o;++i)(s=e[t].points[i]).visible&&(a=function(t){let e=t.shapeArgs;if(e)return{xMin:e.x||0,xMax:(e.x||0)+(e.width||0),yMin:e.y||0,yMax:(e.y||0)+(e.height||0)};let n=t.graphic&&t.graphic.getBBox();return n?{xMin:t.plotX-n.width/2,xMax:t.plotX+n.width/2,yMin:t.plotY-n.height/2,yMax:t.plotY+n.height/2}:null}(s))&&r.push({xMin:a.xMin-n,xMax:a.xMax+n,yMin:a.yMin-n,yMax:a.yMax+n});return r=r.sort(function(t,e){return t.xMin-e.xMin}),null==t.algorithmMargin&&(i=t.algorithmMargin=function(t){let e,n=t.length,r=[];for(let i=0;i<n;++i)for(let o=i+1;o<n;++o)(e=function t(e,n,r){let i=y(r,10),o=e.yMax+i>n.yMin-i&&e.yMin-i<n.yMax+i,a=e.xMax+i>n.xMin-i&&e.xMin-i<n.xMax+i,s=o?e.xMin>n.xMax?e.xMin-n.xMax:n.xMin-e.xMax:1/0,h=a?e.yMin>n.yMax?e.yMin-n.yMax:n.yMin-e.yMax:1/0;return a&&o?i?t(e,n,Math.floor(i/2)):1/0:X(s,h)}(t[i],t[o]))<80&&r.push(e);return r.push(80),W(Math.floor(r.sort(function(t,e){return t-e})[Math.floor(r.length/10)]/2-1),1)}(r),r.forEach(function(t){t.xMin-=i,t.xMax+=i,t.yMin-=i,t.yMax+=i})),r}getObstacleMetrics(t){let e=0,n=0,r,i,o=t.length;for(;o--;)r=t[o].xMax-t[o].xMin,i=t[o].yMax-t[o].yMin,e<r&&(e=r),n<i&&(n=i);return{maxHeight:n,maxWidth:e}}getAlgorithmStartDirection(t){let e="left"!==t.align&&"right"!==t.align,n="top"!==t.verticalAlign&&"bottom"!==t.verticalAlign;return e?!!n&&void 0:!!n||void 0}}function S(t,e,n,r){return[["M",t,e+r/2],["L",t+n,e],["L",t,e+r/2],["L",t+n,e+r]]}function D(t,e,n,r){return S(t,e,n/2,r)}function T(t,e,n,r){return[["M",t+n,e],["L",t,e+r/2],["L",t+n,e+r],["Z"]]}function V(t,e,n,r){return T(t,e,n/2,r)}_.prototype.algorithms={fastAvoid:A,straight:function(t,e){return{path:[["M",t.x,t.y],["L",e.x,e.y]],obstacles:[{start:t,end:e}]}},simpleConnect:E};let Y=i();Y.Pathfinder=Y.Pathfinder||_,({compose:function(t){let e=t.prototype.symbols;e.arrow=S,e["arrow-filled"]=T,e["arrow-filled-half"]=V,e["arrow-half"]=D,e["triangle-left"]=T,e["triangle-left-half"]=V}}).compose(Y.SVGRenderer),Y.Pathfinder.compose(Y.Chart,Y.Point);let q=i();export{q as default};