/**
 * Highcharts JS v12.5.0 (2026-01-12)
 * @module highcharts/modules/variwide
 * @requires highcharts
 *
 * Highcharts variwide 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 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,s)=>Object.prototype.hasOwnProperty.call(t,s);let i=t.default;var e=s.n(i);let r=t.default.SeriesRegistry;var a=s.n(r);let{composed:o}=e(),{addEvent:l,pushUnique:n,wrap:h}=e();function p(t){this.variwide&&this.cross&&this.cross.attr("stroke-width",t.point?.crosshairWidth)}function c(){let t=this;this.chart.labelCollectors.push(function(){return t.variwide?t.tickPositions.filter(s=>!!t.ticks[s].label).map((s,i)=>{let e=t.ticks[s].label;return e.labelrank=t.zData?.[i],e}):[]})}function d(t){let s=this.axis,i=s.horiz?"x":"y";s.variwide&&(this[i+"Orig"]=t.pos[i],this.postTranslate(t.pos,i,this.pos))}function x(t,s,i){let e=this.axis,r=t[s]-e.pos;e.horiz||(r=e.len-r),r=e.series[0].postTranslate(i,r),e.horiz||(r=e.len-r),t[s]=e.pos+r}function f(t,s,i,e,r,a,o,l){let n=Array.prototype.slice.call(arguments,1),h=r?"x":"y";this.axis.variwide&&"number"==typeof this[h+"Orig"]&&(n[+!r]=this[h+"Orig"]);let p=t.apply(this,n);return this.axis.variwide&&this.axis.categories&&this.postTranslate(p,h,this.pos),p}let{column:{prototype:{pointClass:u}}}=a().seriesTypes,{isNumber:g}=e(),{column:y}=a().seriesTypes,{addEvent:v,arrayMin:m,arrayMax:w,crisp:A,extend:T,merge:b,pick:k}=e();class O extends y{processData(t){this.totalZ=0,this.relZ=[],a().seriesTypes.column.prototype.processData.call(this,t);let s=this.getColumn("z");(this.xAxis.reversed?s.slice().reverse():s).forEach(function(t,s){this.relZ[s]=this.totalZ,this.totalZ+=t},this),this.xAxis.categories&&(this.xAxis.variwide=!0,this.xAxis.zData=s)}postTranslate(t,s,i){let e=this.xAxis,r=this.relZ,a=e.reversed?r.length-t:t,o=e.reversed?-1:1,l=e.toPixels(e.reversed?(e.dataMax||0)+e.pointRange:e.dataMin||0),n=e.toPixels(e.reversed?e.dataMin||0:(e.dataMax||0)+e.pointRange),h=Math.abs(n-l),p=this.totalZ,c=this.chart.inverted?n-(this.chart.plotTop-o*e.minPixelPadding):l-this.chart.plotLeft-o*e.minPixelPadding,d=a/r.length*h,x=(a+o)/r.length*h,f=k(r[a],p)/p*h,u=k(r[a+o],p)/p*h;return i&&(i.crosshairWidth=u-f),c+f+(s-(c+d))*(u-f)/(x-d)}translate(){this.crispOption=this.options.crisp,this.options.crisp=!1,super.translate(),this.options.crisp=this.crispOption}correctStackLabels(){let t,s,i,e,r=this.options,a=this.yAxis;for(let o of this.points)e=o.x,s=o.shapeArgs.width,(i=a.stacking.stacks[(this.negStacks&&o.y<(r.startFromThreshold?0:r.threshold)?"-":"")+this.stackKey])&&(t=i[e])&&!o.isNull&&t.setOffset(-(s/2)||0,s||0,void 0,void 0,o.plotX,this.xAxis)}getXExtremes(t){let s=w(t),i=this.getColumn("z")[t.indexOf(s)];return{min:m(t),max:s+(this.xAxis.categories?0:i)}}}O.compose=function(t,s){if(n(o,"Variwide")){let i=s.prototype;l(t,"afterDrawCrosshair",p),l(t,"afterRender",c),l(s,"afterGetPosition",d),i.postTranslate=x,h(i,"getLabelPosition",f)}},O.defaultOptions=b(y.defaultOptions,{pointPadding:0,groupPadding:0}),v(O,"afterColumnTranslate",function(){let t=this.xAxis,s=this.chart.inverted,i=-1;for(let e of this.points){let r,a;++i;let o=e.shapeArgs||{},{x:l=0,width:n=0}=o,{plotX:h=0,tooltipPos:p,z:c=0}=e;t.variwide?(r=this.postTranslate(i,l,e),a=this.postTranslate(i,l+n)):(r=h,a=t.translate(e.x+c,!1,!1,!1,!0)),this.crispOption&&(r=A(r,this.borderWidth),a=A(a,this.borderWidth)),o.x=r,o.width=Math.max(a-r,1),e.plotX=(r+a)/2,p&&(s?p[1]=t.len-o.x-o.width/2:p[0]=o.x+o.width/2)}this.options.stacking&&this.correctStackLabels()},{order:2}),T(O.prototype,{irregularWidths:!0,keysAffectYAxis:["y"],pointArrayMap:["y","z"],parallelArrays:["x","y","z"],pointClass:class extends u{isValid(){return g(this.y)&&g(this.z)}}}),a().registerSeriesType("variwide",O);let P=e();O.compose(P.Axis,P.Tick);let z=e();export{z as default};