/**
 * Highstock JS v12.5.0 (2026-01-12)
 * @module highcharts/indicators/keltner-channels
 * @requires highcharts
 * @requires highcharts/modules/stock
 *
 * Indicator series type for Highcharts Stock
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Daniel Studencki
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as e from"../highcharts.js";var t,o={};o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var i in t)o.o(t,i)&&!o.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let i=e.default;var a=o.n(i);let r=e.default.SeriesRegistry;var s=o.n(r);let{sma:{prototype:n}}=s().seriesTypes,{defined:p,error:l,merge:h}=a();!function(e){let t=["bottomLine"],o=["top","bottom"],i=["top"];function a(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function r(e,t){let o=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&o.push(a(e))}),o}function s(){let e=this,t=e.pointValKey,o=e.linesApiNames,i=e.areaLinesNames,s=e.points,d=e.options,m=e.graph,u={options:{gapSize:d.gapSize}},c=[],y=r(e,t),f=s.length,g;if(y.forEach((e,t)=>{for(c[t]=[];f--;)g=s[f],c[t].push({x:g.x,plotX:g.plotX,plotY:g[e],isNull:!p(g[e])});f=s.length}),e.userOptions.fillColor&&i.length){let t=c[y.indexOf(a(i[0]))],o=1===i.length?s:c[y.indexOf(a(i[1]))],r=e.color;e.points=o,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=h(s,u),e.graph=e.area,e.fillGraph=!0,n.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=r}o.forEach((t,o)=>{c[o]?(e.points=c[o],d[t]?e.options=h(d[t].styles,u):l('Error: "There is no '+t+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),e.graph=e["graph"+t],n.drawGraph.call(e),e["graph"+t]=e.graph):l('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=s,e.options=d,e.graph=m,n.drawGraph.call(e)}function d(e){let t,o=[],i=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=n.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",o=n.getGraphPath.call(this,e),i=t.slice(0,o.length);for(let e=i.length-1;e>=0;e--)o.push(i[e])}}else o=n.getGraphPath.apply(this,arguments);return o}function m(e){let t=[];return(this.pointArrayMap||[]).forEach(o=>{t.push(e[o])}),t}function u(){let e=this.pointArrayMap,t=[],o;t=r(this),n.translate.apply(this,arguments),this.points.forEach(i=>{e.forEach((e,a)=>{o=i[e],this.dataModify&&(o=this.dataModify.modifyValue(o)),null!==o&&(i[t[a]]=this.yAxis.toPixels(o,!0))})})}e.compose=function(e){let a=e.prototype;return a.linesApiNames=a.linesApiNames||t.slice(),a.pointArrayMap=a.pointArrayMap||o.slice(),a.pointValKey=a.pointValKey||"top",a.areaLinesNames=a.areaLinesNames||i.slice(),a.drawGraph=s,a.getGraphPath=d,a.toYData=m,a.translate=u,e}}(t||(t={}));let d=t,{sma:m}=s().seriesTypes,{correctFloat:u,extend:c,merge:y}=a();class f extends m{init(){s().seriesTypes.sma.prototype.init.apply(this,arguments),this.options=y({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(e,t){let o,i,a,r,n,p,l,h=t.period,d=t.periodATR,m=t.multiplierATR,c=t.index,y=e.yData,f=y?y.length:0,g=[],A=s().seriesTypes.ema.prototype.getValues(e,{period:h,index:c}),b=s().seriesTypes.atr.prototype.getValues(e,{period:d}),x=[],v=[];if(!(f<h)){for(l=h;l<=f;l++)n=A.values[l-h],p=b.values[l-d],r=n[0],i=u(n[1]+m*p[1]),a=u(n[1]-m*p[1]),o=n[1],g.push([r,i,o,a]),x.push(r),v.push([i,o,a]);return{values:g,xData:x,yData:v}}}}f.defaultOptions=y(m.defaultOptions,{params:{index:0,period:20,periodATR:10,multiplierATR:2},bottomLine:{styles:{lineWidth:1,lineColor:void 0}},topLine:{styles:{lineWidth:1,lineColor:void 0}},tooltip:{pointFormat:'<span style="color:{point.color}">●</span><b> {series.name}</b><br/>Upper Channel: {point.top}<br/>EMA({series.options.params.period}): {point.middle}<br/>Lower Channel: {point.bottom}<br/>'},marker:{enabled:!1},dataGrouping:{approximation:"averages"},lineWidth:1}),c(f.prototype,{nameBase:"Keltner Channels",areaLinesNames:["top","bottom"],nameComponents:["period","periodATR","multiplierATR"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),d.compose(f),s().registerSeriesType("keltnerchannels",f);let g=a();export{g as default};