/**
 * Highcharts JS v13.0.0 (2026-06-11)
 * @module highcharts/modules/color-axis
 * @requires highcharts
 *
 * ColorAxis module
 *
 * (c) 2012-2026 Highsoft AS
 * Author: Paweł Potaczek
 *
 * A commercial license may be required depending on use,
 * see www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,i,s,o={};o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let l=t.default;var r=o.n(l);let a=t.default.Axis;var h=o.n(a);let n=t.default.Color;var d=o.n(n);let{parse:c}=d();(e=i||(i={})).initDataClasses=function(t){let e=this.chart,i=this.legendItem=this.legendItem||{},s=this.options,o=t.dataClasses||[],r,a,h=e.options.chart.colorCount,n=0,d;this.dataClasses=a=[],i.labels=[];for(let t=0,i=o.length;t<i;++t)r=o[t],r=(0,l.merge)(r),a.push(r),(e.styledMode||!r.color)&&("category"===s.dataClassColor?(e.styledMode||(h=(d=e.options.colors||[]).length,r.color=d[n]),r.colorIndex=n,++n===h&&(n=0)):r.color=c(s.minColor).tweenTo(c(s.maxColor),i<2?.5:t/(i-1)))},e.initStops=function(){let t=this.options,e=this.stops=t.stops||[[0,t.minColor||""],[1,t.maxColor||""]];for(let t=0,i=e.length;t<i;++t)e[t].color=c(e[t][1])},e.normalizedValue=function(t){let e=this.max||0,i=this.min||0;return this.logarithmic&&(t=this.logarithmic.log2lin(t)),1-(e-t)/(e-i||1)},e.toColor=function(t,e){let i,s,o,l,r,a,h=this.dataClasses,n=this.stops;if(h){for(a=h.length;a--;)if(s=(r=h[a]).from,o=r.to,(void 0===s||t>=s)&&(void 0===o||t<=o)){l=r.color,e&&(e.dataClass=a,e.colorIndex=r.colorIndex);break}}else{for(i=this.normalizedValue(t),a=n.length;a--&&!(i>n[a][0]););s=n[a]||n[a+1],i=1-((o=n[a+1]||s)[0]-i)/(o[0]-s[0]||1),l=s.color.tweenTo(o.color,i)}return l};let p=i,{parse:g}=d();!function(t){let e;function i(){let{userOptions:t}=this;this.colorAxis=[],t.colorAxis&&(t.colorAxis=(0,l.splat)(t.colorAxis),t.colorAxis.map(t=>new e(this,t)))}function s(t){let e=this.chart.colorAxis||[],i=e=>{let i=t.allItems.indexOf(e);-1!==i&&(this.destroyItem(t.allItems[i]),t.allItems.splice(i,1))},s=[],o,l;for(e.forEach(function(t){o=t.options,o?.showInLegend&&(o.dataClasses&&o.visible?s=s.concat(t.getDataClassLegendSymbols()):o.visible&&s.push(t),t.series.forEach(function(t){(!t.options.showInLegend||o.dataClasses)&&("point"===t.options.legendType?t.points.forEach(function(t){i(t)}):i(t))}))}),l=s.length;l--;)t.allItems.unshift(s[l])}function o(t){t.visible&&t.item.legendColor&&t.item.legendItem.symbol.attr({fill:t.item.legendColor})}function r(t){this.chart.colorAxis?.forEach(e=>{e.update({},t.redraw)})}function a(){(this.chart.colorAxis?.length||this.colorAttribs)&&this.translateColors()}function h(){let t=this.axisTypes;t?-1===t.indexOf("colorAxis")&&t.push("colorAxis"):this.axisTypes=["colorAxis"]}function n(t){let e=this,i=t?"show":"hide";e.visible=e.options.visible=!!t,["graphic","dataLabel"].forEach(function(t){e[t]&&e[t][i]()}),this.series.buildKDTree()}function d(){let t=this,e=this.getPointsCollection(),i=this.options.nullColor,s=this.colorAxis,o=this.colorKey;e.forEach(e=>{let l=e.getNestedProperty(o),r=e.options.color||(e.isNull||null===e.value?i:s&&void 0!==l?s.toColor(l,e):e.color||t.color);r&&e.color!==r&&(e.color=r,"point"===t.options.legendType&&e.legendItem&&e.legendItem.label&&t.chart.legend.colorizeItem(e,e.visible))})}function c(){this.elem.attr("fill",g(this.start).tweenTo(g(this.end),this.pos),void 0,!0)}function p(){this.elem.attr("stroke",g(this.start).tweenTo(g(this.end),this.pos),void 0,!0)}t.compose=function(t,g,f,u,m){var x;let y,b=g.prototype,C=f.prototype,v=m.prototype;b.collectionsWithUpdate.includes("colorAxis")||(e=t,b.collectionsWithUpdate.push("colorAxis"),b.collectionsWithInit.colorAxis=[b.addColorAxis],(0,l.addEvent)(g,"afterCreateAxes",i),y=(x=g).prototype.createAxis,x.prototype.createAxis=function(t,i){if("colorAxis"!==t)return y.apply(this,arguments);let s=new e(this,(0,l.merge)(i.axis,{index:this[t].length,isX:!1}));return this.isDirtyLegend=!0,this.axes.forEach(t=>{t.series=[]}),this.series.forEach(t=>{t.bindAxes(),t.isDirtyData=!0}),(0,l.pick)(i.redraw,!0)&&this.redraw(i.animation),s},C.fillSetter=c,C.strokeSetter=p,(0,l.addEvent)(u,"afterGetAllItems",s),(0,l.addEvent)(u,"afterColorizeItem",o),(0,l.addEvent)(u,"afterUpdate",r),(0,l.extend)(v,{optionalAxis:"colorAxis",translateColors:d}),(0,l.extend)(v.pointClass.prototype,{setVisible:n}),(0,l.addEvent)(m,"afterTranslate",a,{order:1}),(0,l.addEvent)(m,"bindAxes",h))},t.pointSetVisible=n}(s||(s={}));let f=s,u=t.default.SeriesRegistry;var m=o.n(u);let{defaultOptions:x}=r(),{series:y}=m();x.colorAxis=(0,l.merge)(x.xAxis,{lineWidth:0,minPadding:0,maxPadding:0,gridLineColor:"var(--highcharts-background-color)",gridLineWidth:1,tickPixelInterval:72,startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50},clip:!1,lineColor:"var(--highcharts-neutral-color-40)",lineWidth:0,color:"var(--highcharts-neutral-color-40)",width:.01},labels:{distance:8,overflow:"justify",rotation:0},minColor:"var(--highcharts-highlight-color-10)",maxColor:"var(--highcharts-highlight-color-100)",tickLength:5,title:{margin:5},showInLegend:!0});class b extends h(){static compose(t,e,i,s){f.compose(b,t,e,i,s)}constructor(t,e){super(t,e),this.clippable=!1,this.coll="colorAxis",this.visible=!0,this.init(t,e)}init(t,e){let i=t.options.legend||{},s=e.layout?"vertical"!==e.layout:"vertical"!==i.layout;this.side=e.side||s?2:1,this.reversed=e.reversed,this.opposite=!s,super.init(t,e,"colorAxis"),this.userOptions=e,(0,l.isArray)(t.userOptions.colorAxis)&&(t.userOptions.colorAxis[this.index]=e),e.dataClasses&&this.initDataClasses(e),this.initStops(),this.horiz=s,this.zoomEnabled=!1}hasData(){return!!(this.tickPositions||[]).length}setTickPositions(){if(!this.dataClasses)return super.setTickPositions()}setOptions(t){let e=this.chart.options.legend||{},i=x.colorAxis,s=t.layout||e.layout||i.layout,o=(0,l.merge)("vertical"!==s?{title:{rotation:0}}:{title:{rotation:90,margin:10}},i,t,{showEmpty:!1,visible:this.chart.options.legend.enabled&&!1!==t.visible});super.setOptions(o),this.options.crosshair=this.options.marker}setAxisSize(){let t=this.chart,e=this.legendItem?.symbol,{width:i,height:s}=this.getSize();e&&(this.left=+e.attr("x"),this.top=+e.attr("y"),this.width=i=+e.attr("width"),this.height=s=+e.attr("height"),this.right=t.chartWidth-this.left-i,this.bottom=t.chartHeight-this.top-s,this.pos=this.horiz?this.left:this.top),this.len=(this.horiz?i:s)||b.defaultLegendLength}getOffset(){let t=this.chart,e=this.legendItem?.group,i=t.axisOffset[this.side],{clipOffset:s,legend:o}=t;e&&(this.axisParent=e,super.getOffset(),o.allItems.forEach(function(t){t instanceof b&&t.drawLegendSymbol(o,t)}),o.render(),t.getMargins(!0),this.added||(this.added=!0),this.labelLeft=0,this.labelRight=this.width,t.axisOffset[this.side]=i,t.clipOffset=s)}setLegendColor(){let t=this.horiz,e=this.reversed,i=+!!e,s=+!e,o=t?[i,0,s,0]:[0,s,0,i];this.legendColor={linearGradient:{x1:o[0],y1:o[1],x2:o[2],y2:o[3]},stops:this.stops}}drawLegendSymbol(t,e){let i=e.legendItem||{},s=t.padding,o=t.options,r=this.options.labels,a=(0,l.pick)(o.itemDistance,10),h=this.horiz,{width:n,height:d}=this.getSize(),c=(0,l.pick)(o.labelPadding,h?16:30);this.setLegendColor();let p=0,g=0;if(this.options.title?.text&&!this.axisTitle){this.axisGroup||(this.axisParent=i.group,this.createGroups());let t=this.len,e=this.top,s=this.left,o=this.width;this.len=h?n:d,this.top=0,this.left=0,this.width=n,this.addTitle(!0),this.len=t,this.top=e,this.left=s,this.width=o}if(this.axisTitle){let t=this.axisTitle.getBBox();p=t.height,g=t.width}let f=this.options.title||{},u=this.axisTitle?f.margin??0:0,m=h?p+u:0;i.symbol||(i.symbol=this.chart.renderer.symbol("roundedRect").attr({r:o.symbolRadius??3,zIndex:1}).add(i.group)),i.symbol.attr({x:0,y:(t.baseline||0)-11+m,width:n,height:d}),h?(i.labelWidth=Math.max(n+s+a,g||0),i.labelHeight=d+s+c+p+u):(i.labelWidth=n+s+(r.x??r.distance??0)+(this.maxLabelLength||0)+(g||0)+u,i.labelHeight=Math.max(d+s,p||0))}getTitlePosition(t){let e=super.getTitlePosition(t),i=this.options.title?.margin??0;if(this.horiz&&t)e.y=this.top-i;else if(!this.horiz&&t){let t=this.options.labels||{},s=t.x??t.distance??0;e.x=this.left+this.width+s+(this.maxLabelLength||0)+i}return e}setState(t){this.series.forEach(function(e){e.setState(t)})}setVisible(){}getSeriesExtremes(){let t=this.series,e,i,s,o,r=t.length;for(this.dataMin=1/0,this.dataMax=-1/0;r--;){for(let a of(i=(o=t[r]).colorKey=(0,l.pick)(o.options.colorKey,o.colorKey,o.pointValKey,o.zoneAxis,"y"),s=o[i+"Min"]&&o[i+"Max"],[i,"value","y"]))if((e=o.getColumn(a)).length)break;if(s)o.minColorValue=o[i+"Min"],o.maxColorValue=o[i+"Max"];else{let t=y.prototype.getExtremes.call(o,e);o.minColorValue=t.dataMin,o.maxColorValue=t.dataMax}(0,l.defined)(o.minColorValue)&&(0,l.defined)(o.maxColorValue)&&(this.dataMin=Math.min(this.dataMin,o.minColorValue),this.dataMax=Math.max(this.dataMax,o.maxColorValue)),s||y.prototype.applyExtremes.call(o)}}drawCrosshair(t,e){let i,s=this.legendItem||{},o=e?.plotX,l=e?.plotY,r=this.pos,a=this.len,h=this.options.marker||{};e&&((i=this.toPixels(e.getNestedProperty(e.series.colorKey)))<r?i=r-2:i>r+a&&(i=r+a+2),e.plotX=i,e.plotY=this.len-i,super.drawCrosshair(t,e),e.plotX=o,e.plotY=l,this.cross&&!this.cross.addedToColorAxis&&s.group&&(this.cross.addClass("highcharts-coloraxis-marker").add(s.group),this.cross.addedToColorAxis=!0,this.chart.styledMode||"object"!=typeof this.crosshair||this.cross.attr({fill:h.color,stroke:h.lineColor,"stroke-width":h.lineWidth})))}getPlotLinePath(t){let e=this.left,i=t.translatedValue,{symbol:s}=this.options.marker||{},o=this.top;if((0,l.isNumber)(i)){let t=this.width,l=i-t/2;return s?this.chart.renderer.symbols[s](e,l,t,t):this.horiz?[["M",i-4,o-6],["L",i+4,o-6],["L",i,o],["Z"]]:[["M",e,i],["L",e-6,i+6],["L",e-6,i-6],["Z"]]}return super.getPlotLinePath(t)}update(t,e){let i=this.chart.legend;this.series.forEach(t=>{t.isDirtyData=!0}),(t.dataClasses&&i.allItems||this.dataClasses)&&this.destroyItems(),super.update(t,e),this.legendItem?.label&&(this.setLegendColor(),i.colorizeItem(this,!0))}destroyItems(){let t=this.chart,e=this.legendItem||{};if(e.label)t.legend.destroyItem(this);else if(e.labels)for(let i of e.labels)t.legend.destroyItem(i);t.isDirtyLegend=!0}destroy(){this.chart.isDirtyLegend=!0,this.destroyItems(),super.destroy(...[].slice.call(arguments))}remove(t){this.destroyItems(),super.remove(t)}getDataClassLegendSymbols(){let t,e=this,i=e.chart,s=e.legendItem&&e.legendItem.labels||[],o=i.options.legend,r=(0,l.pick)(o.valueDecimals,-1),a=(0,l.pick)(o.valueSuffix,""),h=t=>e.series.reduce((e,i)=>(e.push(...i.points.filter(e=>e.dataClass===t)),e),[]);return s.length||e.dataClasses.forEach((o,n)=>{let d=o.from,c=o.to,{numberFormatter:p}=i,g=!0;t="",void 0===d?t="< ":void 0===c&&(t="> "),void 0!==d&&(t+=p(d,r)+a),void 0!==d&&void 0!==c&&(t+=" - "),void 0!==c&&(t+=p(c,r)+a),s.push((0,l.extend)({chart:i,name:t,options:{},drawLegendSymbol:y.prototype.drawLegendSymbol,visible:!0,isDataClass:!0,setState:t=>{for(let e of h(n))e.setState(t)},setVisible:function(){this.visible=g=e.visible=!g;let t=[];for(let e of h(n))e.setVisible(g),e.hiddenInDataClass=!g,-1===t.indexOf(e.series)&&t.push(e.series);i.legend.colorizeItem(this,g),t.forEach(t=>{(0,l.fireEvent)(t,"afterDataClassLegendClick")})}},o))}),s}getSize(){let{chart:t,horiz:e}=this,{height:i,width:s}=this.options,{legend:o}=t.options;return{width:(0,l.pick)((0,l.defined)(s)?(0,l.relativeLength)(s,t.chartWidth):void 0,o?.symbolWidth,e?b.defaultLegendLength:12),height:(0,l.pick)((0,l.defined)(i)?(0,l.relativeLength)(i,t.chartHeight):void 0,o?.symbolHeight,e?12:b.defaultLegendLength)}}}b.defaultLegendLength=200,b.keepProps=["legendItem"],(0,l.extend)(b.prototype,p),Array.prototype.push.apply(h().keepProps,b.keepProps);let C=r();C.ColorAxis=C.ColorAxis||b,C.ColorAxis.compose(C.Chart,C.Fx,C.Legend,C.Series);let v=r();export{v as default};