/**
 * Highcharts Gantt JS v12.6.0 (2026-04-13)
 * @module highcharts/modules/grid-axis
 * @requires highcharts
 *
 * GridAxis
 *
 * (c) 2016-2026 Highsoft AS
 * Author: Lars A. V. Cabrera
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var i,e,s={};s.n=t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return s.d(i,{a:i}),i},s.d=(t,i)=>{for(var e in i)s.o(i,e)&&!s.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:i[e]})},s.o=(t,i)=>Object.prototype.hasOwnProperty.call(t,i);let r=t.default;var n=s.n(r);let o=t.default.Axis;var l=s.n(o);let{doc:h,win:a}=n();function d(t,i,e,s={}){let r="function"==typeof t&&t.prototype||t;Object.hasOwnProperty.call(r,"hcEvents")||(r.hcEvents={});let o=r.hcEvents;n().Point&&t instanceof n().Point&&t.series&&t.series.chart&&(t.series.chart.runTrackerClick=!0);let l=t.addEventListener;l&&l.call(t,i,e,!!n().supportsPassiveEvents&&{passive:void 0===s.passive?-1!==i.indexOf("touch"):s.passive,capture:!1}),o[i]||(o[i]=[]);let h={fn:e,order:"number"==typeof s.order?s.order:1/0};return o[i].push(h),o[i].sort((t,i)=>t.order-i.order),function(){!function(t,i,e){function s(i,e){let s=t.removeEventListener;s&&s.call(t,i,e,!1)}function r(e){let r,n;t.nodeName&&(i?(r={})[i]=!0:r=e,b(r,function(t,i){if(e[i])for(n=e[i].length;n--;)s(i,e[i][n].fn)}))}let n="function"==typeof t&&t.prototype||t;if(Object.hasOwnProperty.call(n,"hcEvents")){let t=n.hcEvents;if(i){let n=t[i]||[];e?(t[i]=n.filter(function(t){return e!==t.fn}),s(i,e)):(r(t),t[i]=[])}else r(t),delete n.hcEvents}}(t,i,e)}}function c(t){return null!=t}function f(t,i){let e=t.length;for(;e--;)if(t[e]===i){t.splice(e,1);break}}let u=Array.prototype.find?function(t,i){return t.find(i)}:function(t,i){let e,s=t.length;for(e=0;e<s;e++)if(i(t[e],e))return t[e]};function p(t){return k(t)&&"number"==typeof t.nodeType}function g(t){return"number"==typeof t&&!isNaN(t)&&t<1/0&&t>-1/0}function m(t){let i=Object.prototype.toString.call(t);return"[object Array]"===i||"[object Array Iterator]"===i}function k(t,i){return!!t&&"object"==typeof t&&(!i||!m(t))}function x(t,...i){let e,s=[t,...i],r={},n=function(t,i){return"object"!=typeof t&&(t={}),b(i,function(e,s){if("__proto__"!==s&&"constructor"!==s){let r;!k(e,!0)||(r=e?.constructor,k(e,!0)&&!p(e)&&r?.name&&"Object"!==r.name)||p(e)?t[s]=i[s]:t[s]=n(t[s]||{},e)}}),t};!0===t&&(r=s[1],s=Array.prototype.slice.call(s,2));let o=s.length;for(e=0;e<o;e++)r=n(r,s[e]);return r}function b(t,i,e){for(let s in t)Object.hasOwnProperty.call(t,s)&&i.call(e||t[s],t[s],s,t)}function y(){let t=arguments,i=t.length;for(let e=0;e<i;e++){let i=t[e];if(null!=i)return i}}function P(t,i,e){let s=t[i];t[i]=function(){let t=arguments,i=this;return e.apply(this,[function(){return s.apply(i,arguments.length?arguments:t)}].concat([].slice.call(arguments)))}}let{dateFormats:v}=n();(i=e||(e={}))[i.top=0]="top",i[i.right=1]="right",i[i.bottom=2]="bottom",i[i.left=3]="left";function w(t,i){let e={width:0,height:0};if(i.forEach(function(i){let s=t[i],r=0,n=0,o;k(s,!0)&&(r=(o=k(s.label,!0)?s.label:{}).getBBox?o.getBBox().height:0,o.textStr&&!g(o.textPxLength)&&(o.textPxLength=o.getBBox().width),n=g(o.textPxLength)?Math.round(o.textPxLength):0,o.textStr&&(n=Math.round(o.getBBox().width)),e.height=Math.max(r,e.height),e.width=Math.max(n,e.width))}),"treegrid"===this.type&&this.treeGrid&&this.treeGrid.mapOfPosToGridNode){let t=this.treeGrid.mapOfPosToGridNode[-1].height||0;e.width+=this.options.labels.indentation*(t-1)}return e}function L(t){let{grid:i}=this,e=3===this.side;if(e||t.apply(this),!i?.isColumn){let t=i?.columns||[];e&&(t=t.slice().reverse()),t.forEach(t=>{t.getOffset()})}e&&t.apply(this)}function O(t){if(!0===(this.options.grid||{}).enabled){let{axisTitle:i,height:s,horiz:r,left:n,offset:o,opposite:l,options:h,top:a,width:d}=this,c=this.tickSize(),f=i?.getBBox().width,u=h.title.x,p=h.title.y,g=y(h.title.margin,r?5:10),m=i?this.chart.renderer.fontMetrics(i).f:0,k=(r?a+s:n)+(r?1:-1)*(l?-1:1)*(c?c[0]/2:0)+(this.side===e.bottom?m:0);t.titlePosition.x=r?n-(f||0)/2-g+u:k+(l?d:0)+o+u,t.titlePosition.y=r?k-(l?s:0)+(l?m:-m)/2+o+p:a-g+p}}function B(){let t,{chart:i,options:{grid:e={}},userOptions:s}=this;if(e.enabled&&((t=this.options).labels.align=y(t.labels.align,"center"),this.categories||(t.showLastLabel=!1),this.labelRotation=0,t.labels.rotation=0,t.minTickInterval=1),e.columns){let t=this.grid.columns=[],r=this.grid.columnIndex=0;for(;++r<e.columns.length;){let n=x(s,e.columns[r],{isInternal:!0,linkedTo:0,scrollbar:{enabled:!1}},{grid:{columns:void 0}}),o=new(l())(this.chart,n,this.coll);o.grid.isColumn=!0,o.grid.columnIndex=r,f(i.axes,o),f(i[this.coll]||[],o),t.push(o)}}}function T(){let{axisTitle:t,grid:i,options:s}=this;if(!0===(s.grid||{}).enabled){let r=this.min||0,n=this.max||0,o=this.ticks[this.tickPositions[0]];if(t&&!this.chart.styledMode&&o?.slotWidth&&!this.options.title.style.width&&t.css({width:`${o.slotWidth}px`}),this.maxLabelDimensions=this.getMaxLabelDimensions(this.ticks,this.tickPositions),this.rightWall&&this.rightWall.destroy(),this.grid?.isOuterAxis()&&this.axisLine){let t=s.lineWidth;if(t){let i=this.getLinePath(t),o=i[0],l=i[1],h=(this.tickSize("tick")||[1])[0]*(this.side===e.top||this.side===e.left?-1:1);if("M"===o[0]&&"L"===l[0]&&(this.horiz?(o[2]+=h,l[2]+=h):(o[1]+=h,l[1]+=h)),!this.horiz&&this.chart.marginRight){let t=["L",this.left,o[2]||0],i=[o,t],e=["L",this.chart.chartWidth-this.chart.marginRight,this.toPixels(n+this.tickmarkOffset)],h=[["M",l[1]||0,this.toPixels(n+this.tickmarkOffset)],e];this.grid.upperBorder||r%1==0||(this.grid.upperBorder=this.grid.renderBorder(i)),this.grid.upperBorder&&(this.grid.upperBorder.attr({stroke:s.lineColor,"stroke-width":s.lineWidth}),this.grid.upperBorder.animate({d:i})),this.grid.lowerBorder||n%1==0||(this.grid.lowerBorder=this.grid.renderBorder(h)),this.grid.lowerBorder&&(this.grid.lowerBorder.attr({stroke:s.lineColor,"stroke-width":s.lineWidth}),this.grid.lowerBorder.animate({d:h}))}this.grid.axisLineExtra?(this.grid.axisLineExtra.attr({stroke:s.lineColor,"stroke-width":s.lineWidth}),this.grid.axisLineExtra.animate({d:i})):this.grid.axisLineExtra=this.grid.renderBorder(i),this.axisLine[this.showAxis?"show":"hide"]()}}if((i?.columns||[]).forEach(t=>t.render()),!this.horiz&&this.chart.hasRendered&&(this.scrollbar||this.linkedParent?.scrollbar)&&this.tickPositions.length){let t,i,e=this.tickmarkOffset,s=this.tickPositions[this.tickPositions.length-1],o=this.tickPositions[0];for(;(t=this.hiddenLabels.pop())&&t.element;)t.show();for(;(i=this.hiddenMarks.pop())&&i.element;)i.show();(t=this.ticks[o].label)&&(r-o>e?this.hiddenLabels.push(t.hide()):t.show()),(t=this.ticks[s].label)&&(s-n>e?this.hiddenLabels.push(t.hide()):t.show());let l=this.ticks[s].mark;l&&s-n<e&&s-n>0&&this.ticks[s].isLast&&this.hiddenMarks.push(l.hide())}}}function E(){let t=this.tickPositions?.info,i=this.options,e=i.grid||{},s=this.userOptions.labels||{};e.enabled&&(this.horiz?(this.series.forEach(t=>{t.options.pointRange=0}),t&&i.dateTimeLabelFormats&&i.labels&&!c(s.align)&&(!1===i.dateTimeLabelFormats[t.unitName].range||t.count>1)&&(i.labels.align="left",c(s.x)||(i.labels.x=3))):"treegrid"!==this.type&&this.grid&&this.grid.columns&&(this.minPointOffset=this.tickInterval))}function M(t){let i,e=this.options,s=t.userOptions,n=e&&k(e.grid,!0)?e.grid:{};!0===n.enabled&&(i=x(!0,{className:"highcharts-grid-axis "+(s.className||""),dateTimeLabelFormats:{hour:{list:["%[HM]","%[H]"]},day:{list:["%[AeB]","%[aeb]","%[E]"]},week:{list:["Week %W","W%W"]},month:{list:["%[B]","%[b]","%o"]}},grid:{borderWidth:1},labels:{padding:2,style:{fontSize:"0.9em"}},margin:0,title:{text:null,reserveSpace:!1,rotation:0,style:{textOverflow:"ellipsis"}},units:[["millisecond",[1,10,100]],["second",[1,10]],["minute",[1,5,15]],["hour",[1,6]],["day",[1]],["week",[1]],["month",[1]],["year",null]]},s),"xAxis"===this.coll&&(c(s.linkedTo)&&!c(s.tickPixelInterval)&&(i.tickPixelInterval=350),!(!c(s.tickPixelInterval)&&c(s.linkedTo))||c(s.tickPositioner)||c(s.tickInterval)||c(s.units)||(i.tickPositioner=function(t,e){let s=this.linkedParent?.tickPositions?.info;if(s){let n=i.units||[],o,l=1,h="year";for(let t=0;t<n.length;t++){let i=n[t];if(i&&i[0]===s.unitName){o=t;break}}let a=g(o)&&n[o+1];if(a){h=a[0]||"year";let t=a[1];l=t?.[0]||1}else"year"===s.unitName&&(l=10*s.count);let d=r.timeUnits[h];return this.tickInterval=d*l,this.chart.time.getTimeTicks({unitRange:d,count:l,unitName:h},t,e,this.options.startOfWeek)}})),x(!0,this.options,i),this.horiz&&(e.minPadding=y(s.minPadding,0),e.maxPadding=y(s.maxPadding,0)),g(e.grid.borderWidth)&&(e.tickWidth=e.lineWidth=n.borderWidth))}function W(t){let i=t.userOptions,e=i?.grid||{},s=e.columns;e.enabled&&s&&x(!0,this.options,s[0])}function S(){(this.grid.columns||[]).forEach(t=>t.setScale())}function A(t){let{horiz:i,maxLabelDimensions:e,options:{grid:s={}}}=this;if(s.enabled&&e){let r=2*this.options.labels.distance,n=i?s.cellHeight||r+e.height:r+e.width;m(t.tickSize)?t.tickSize[0]=n:t.tickSize=[n,0]}}function z(){this.axes.forEach(t=>{(t.grid?.columns||[]).forEach(t=>{t.setAxisSize(),t.setAxisTranslation()})})}function I(t){let{grid:i}=this;(i.columns||[]).forEach(i=>i.destroy(t.keepEvents)),i.columns=void 0}function C(t){let i=t.userOptions||{},e=i.grid||{};e.enabled&&c(e.borderColor)&&(i.tickColor=i.lineColor=e.borderColor),this.grid||(this.grid=new F(this)),this.hiddenLabels=[],this.hiddenMarks=[]}function j(t){let i=this.label,s=this.axis,r=s.reversed,n=s.chart,o=s.options.grid||{},l=s.options.labels,h=l.align,a=e[s.side],d=t.tickmarkOffset,c=s.tickPositions,f=this.pos-d,u=g(c[t.index+1])?c[t.index+1]-d:(s.max||0)+d,p=s.tickSize("tick"),m=p?p[0]:0,k=p?p[1]/2:0;if(!0===o.enabled){let e,o,d,c;if("top"===a?o=(e=s.top+s.offset)-m:"bottom"===a?e=(o=n.chartHeight-s.bottom+s.offset)+m:(e=s.top+s.len-(s.translate(r?u:f)||0),o=s.top+s.len-(s.translate(r?f:u)||0)),"right"===a?c=(d=n.chartWidth-s.right+s.offset)+m:"left"===a?d=(c=s.left+s.offset)-m:(d=Math.round(s.left+(s.translate(r?u:f)||0))-k,c=Math.min(Math.round(s.left+(s.translate(r?f:u)||0))-k,s.left+s.len)),this.slotWidth=c-d,t.pos.x="left"===h?d:"right"===h?c:d+(c-d)/2,t.pos.y=o+(e-o)/2,i){let e=n.renderer.fontMetrics(i),s=i.getBBox().height;if(l.useHTML)t.pos.y+=e.b+-(s/2);else{let i=Math.round(s/e.h);t.pos.y+=(e.b-(e.h-e.f))/2+-((i-1)*e.h/2)}}t.pos.x+=s.horiz&&l.x||0}}function N(t){let{axis:i,value:e}=t;if(i.options.grid?.enabled){let s,r=i.tickPositions,o=(i.linkedParent||i).series[0],l=e===r[0],h=e===r[r.length-1],a=o&&u(o.options.data,function(t){return t[i.isXAxis?"x":"y"]===e});a&&o.is("gantt")&&(s=x(a),n().seriesTypes.gantt.prototype.pointClass.setGanttPointAliases(s,i.chart)),t.isFirst=l,t.isLast=h,t.point=s}}function G(){let t=this.options,i=t.grid||{},e=this.categories,s=this.tickPositions,r=s[0],n=s[1],o=s[s.length-1],l=s[s.length-2],h=this.linkedParent?.min,a=this.linkedParent?.max,d=h||this.min,c=a||this.max,f=this.tickInterval,u=g(d)&&d>=r+f&&d<n,p=g(d)&&r<d&&r+f>d,m=g(c)&&o>c&&o-f<c,k=g(c)&&c<=o-f&&c>l;!0===i.enabled&&!e&&(this.isXAxis||this.isLinked)&&((p||u)&&!t.startOnTick&&(s[0]=d),(m||k)&&!t.endOnTick&&(s[s.length-1]=c))}function _(t){var i;let{options:{grid:e={}}}=this;return!0===e.enabled&&this.categories?this.tickInterval:t.apply(this,(i=arguments,Array.prototype.slice.call(i,1)))}class F{constructor(t){this.axis=t}isOuterAxis(){let t=this.axis,i=t.chart,e=t.grid.columnIndex,s=t.linkedParent?.grid.columns||t.grid.columns||[],r=e?t.linkedParent:t,n=-1,o=0;return 3===t.side&&!i.inverted&&s.length?!t.linkedParent:((i[t.coll]||[]).forEach((i,e)=>{i.side!==t.side||i.options.isInternal||(o=e,i===r&&(n=e))}),o===n&&(!g(e)||s.length===e))}renderBorder(t){let i=this.axis,e=i.chart.renderer,s=i.options,r=e.path(t).addClass("highcharts-axis-line").add(i.axisGroup);return e.styledMode||r.attr({stroke:s.lineColor,"stroke-width":s.lineWidth,zIndex:7}),r}}v.E=function(t){return this.dateFormat("%a",t,!0).charAt(0)},v.W=function(t){let i=this.toParts(t),e=(i[7]+6)%7,s=i.slice(0);s[2]=i[2]-e+3;let r=this.toParts(this.makeTime(s[0],0,1));return 4!==r[7]&&(i[1]=0,i[2]=1+(11-r[7])%7),(1+Math.floor((this.makeTime(s[0],s[1],s[2])-this.makeTime(r[0],r[1],r[2]))/6048e5)).toString()};let R=n();({compose:function(t,i,e){return t.keepProps.includes("grid")||(t.keepProps.push("grid"),t.prototype.getMaxLabelDimensions=w,P(t.prototype,"unsquish",_),P(t.prototype,"getOffset",L),d(t,"init",C),d(t,"afterGetTitlePosition",O),d(t,"afterInit",B),d(t,"afterRender",T),d(t,"afterSetAxisTranslation",E),d(t,"afterSetOptions",M),d(t,"afterSetOptions",W),d(t,"afterSetScale",S),d(t,"afterTickSize",A),d(t,"trimTicks",G),d(t,"destroy",I),d(i,"afterSetChartSize",z),d(e,"afterGetLabelPosition",j),d(e,"labelFormat",N)),t}}).compose(R.Axis,R.Chart,R.Tick);let H=n();export{H as default};