/**
 * Highstock JS v12.5.0 (2026-01-12)
 * @module highcharts/indicators/indicators
 * @requires highcharts
 * @requires highcharts/modules/stock
 *
 * Indicator series type for Highcharts Stock
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Pawel Fus, Sebastian Bochan
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,a={};a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var i in e)a.o(e,i)&&!a.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let i=t.default;var s=a.n(i);let n=t.default.Chart;var r=a.n(n);let l=t.default.SeriesRegistry;var o=a.n(l);let{line:p}=o().seriesTypes,{addEvent:h,fireEvent:u,error:d,extend:c,isArray:f,merge:m,pick:y}=s(),x=(t,e)=>{let a=[],i=t.pointArrayMap,s=e&&t.dataTable.getModified()||t.dataTable;if(!i)return t.getColumn("y",e);let n=i.map(a=>t.getColumn(a,e));for(let t=0;t<s.rowCount;t++){let e=i.map((e,a)=>n[a]?.[t]||0);a.push(e)}return a};class g extends p{destroy(){this.dataEventsToUnbind.forEach(function(t){t()}),super.destroy.apply(this,arguments)}getName(){let t=[],e=this.name;return e||((this.nameComponents||[]).forEach(function(e,a){t.push(this.options.params[e]+y(this.nameSuffixes[a],""))},this),e=(this.nameBase||this.type.toUpperCase())+(this.nameComponents?" ("+t.join(", ")+")":"")),e}getValues(t,e){let a=e.period,i=t.xData||[],s=t.yData,n=s.length,r=[],l=[],o=[],p,h=-1,u=0,d,c=0;if(!(i.length<a)){for(f(s[0])&&(h=e.index?e.index:0);u<a-1;)c+=h<0?s[u]:s[u][h],u++;for(p=u;p<n;p++)c+=h<0?s[p]:s[p][h],d=[i[p],c/a],r.push(d),l.push(d[0]),o.push(d[1]),c-=h<0?s[p-u]:s[p-u][h];return{values:r,xData:l,yData:o}}}init(t,e){let a=this;super.init.call(a,t,e);let i=h(r(),"afterLinkSeries",function({isUpdating:e}){if(e)return;let i=!!a.dataEventsToUnbind.length;if(!a.linkedParent)return d("Series "+a.options.linkedTo+" not found! Check `linkedTo`.",!1,t);if(!i&&(a.dataEventsToUnbind.push(h(a.linkedParent,"updatedData",function(){a.recalculateValues()})),a.calculateOn.xAxis&&a.dataEventsToUnbind.push(h(a.linkedParent.xAxis,a.calculateOn.xAxis,function(){a.recalculateValues()}))),"init"===a.calculateOn.chart)a.closestPointRange||a.recalculateValues();else if(!i){let t=h(a.chart,a.calculateOn.chart,function(){a.recalculateValues(),t()})}},{order:0});a.dataEventsToUnbind=[],a.eventsToUnbind.push(i)}recalculateValues(){let t=[],e=this.dataTable,a=this.points||[],i=this.dataTable.rowCount,s=!0,n,r,l,o,p=this.linkedParent.yData,h=this.linkedParent.processedYData;this.linkedParent.xData=this.linkedParent.getColumn("x"),this.linkedParent.yData=x(this.linkedParent),this.linkedParent.processedYData=x(this.linkedParent,!0);let d=this.linkedParent.options&&this.linkedParent.dataTable.rowCount&&this.getValues(this.linkedParent,this.options.params)||{values:[],xData:[],yData:[]};delete this.linkedParent.xData,this.linkedParent.yData=p,this.linkedParent.processedYData=h;let c=this.pointArrayMap||["y"],m={};if(d.yData.forEach(t=>{c.forEach((e,a)=>{let i=m[e]||[];i.push(f(t)?t[a]:t),m[e]||(m[e]=i)})}),i&&!this.hasGroupedData&&this.visible&&this.points)if(this.cropped){this.xAxis&&(l=this.xAxis.min,o=this.xAxis.max);let i=this.cropData(e,l,o),s=["x",...this.pointArrayMap||["y"]];for(let e=0;e<(i.modified?.rowCount||0);e++){let a=s.map(t=>this.getColumn(t)[e]||0);t.push(a)}let p=this.getColumn("x");n=d.xData.indexOf(p[0]),r=d.xData.indexOf(p[p.length-1]),-1===n&&r===d.xData.length-2&&t[0][0]===a[0].x&&t.shift(),this.updateData(t)}else(this.updateAllPoints||d.xData.length!==i-1&&d.xData.length!==i+1)&&(s=!1,this.updateData(d.values));s&&(e.setColumns({...m,x:d.xData}),this.options.data=d.values),this.calculateOn.xAxis&&this.getColumn("x",!0).length&&(this.isDirty=!0,this.redraw()),this.isDirtyData=!!this.linkedSeries.length,u(this,"updatedData")}processData(){let t=this.options.compareToMain,e=this.linkedParent;super.processData.apply(this,arguments),this.dataModify&&e&&e.dataModify&&e.dataModify.compareValue&&t&&(this.dataModify.compareValue=e.dataModify.compareValue)}}g.defaultOptions=m(p.defaultOptions,{name:void 0,tooltip:{valueDecimals:4},linkedTo:void 0,compareToMain:!1,params:{index:3,period:14}}),c(g.prototype,{calculateOn:{chart:"init"},hasDerivedData:!0,nameComponents:["period"],nameSuffixes:[],useCommonDataGrouping:!0}),o().registerSeriesType("sma",g);let{sma:D}=o().seriesTypes,{correctFloat:P,isArray:v,merge:A}=s();class C extends D{accumulatePeriodPoints(t,e,a){let i=0,s=0;for(;s<t;)i+=e<0?a[s]:a[s][e],s++;return i}calculateEma(t,e,a,i,s,n,r){let l=t[a-1],o=n<0?e[a-1]:e[a-1][n];return[l,void 0===s?r:P(o*i+s*(1-i))]}getValues(t,e){let a=e.period,i=t.xData,s=t.yData,n=s?s.length:0,r=2/(a+1),l=[],o=[],p=[],h,u,d,c=-1,f=0;if(!(n<a)){for(v(s[0])&&(c=e.index?e.index:0),f=this.accumulatePeriodPoints(a,c,s)/a,d=a;d<n+1;d++)u=this.calculateEma(i,s,d,r,h,c,f),l.push(u),o.push(u[0]),p.push(u[1]),h=u[1];return{values:l,xData:o,yData:p}}}}C.defaultOptions=A(D.defaultOptions,{params:{index:3,period:9}}),o().registerSeriesType("ema",C);let{sma:{prototype:k}}=o().seriesTypes,{defined:M,error:T,merge:O}=s();!function(t){let e=["bottomLine"],a=["top","bottom"],i=["top"];function s(t){return"plot"+t.charAt(0).toUpperCase()+t.slice(1)}function n(t,e){let a=[];return(t.pointArrayMap||[]).forEach(t=>{t!==e&&a.push(s(t))}),a}function r(){let t=this,e=t.pointValKey,a=t.linesApiNames,i=t.areaLinesNames,r=t.points,l=t.options,o=t.graph,p={options:{gapSize:l.gapSize}},h=[],u=n(t,e),d=r.length,c;if(u.forEach((t,e)=>{for(h[e]=[];d--;)c=r[d],h[e].push({x:c.x,plotX:c.plotX,plotY:c[t],isNull:!M(c[t])});d=r.length}),t.userOptions.fillColor&&i.length){let e=h[u.indexOf(s(i[0]))],a=1===i.length?r:h[u.indexOf(s(i[1]))],n=t.color;t.points=a,t.nextPoints=e,t.color=t.userOptions.fillColor,t.options=O(r,p),t.graph=t.area,t.fillGraph=!0,k.drawGraph.call(t),t.area=t.graph,delete t.nextPoints,delete t.fillGraph,t.color=n}a.forEach((e,a)=>{h[a]?(t.points=h[a],l[e]?t.options=O(l[e].styles,p):T('Error: "There is no '+e+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),t.graph=t["graph"+e],k.drawGraph.call(t),t["graph"+e]=t.graph):T('Error: "'+e+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),t.points=r,t.options=l,t.graph=o,k.drawGraph.call(t)}function l(t){let e,a=[],i=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=k.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",a=k.getGraphPath.call(this,t),i=e.slice(0,a.length);for(let t=i.length-1;t>=0;t--)a.push(i[t])}}else a=k.getGraphPath.apply(this,arguments);return a}function o(t){let e=[];return(this.pointArrayMap||[]).forEach(a=>{e.push(t[a])}),e}function p(){let t=this.pointArrayMap,e=[],a;e=n(this),k.translate.apply(this,arguments),this.points.forEach(i=>{t.forEach((t,s)=>{a=i[t],this.dataModify&&(a=this.dataModify.modifyValue(a)),null!==a&&(i[e[s]]=this.yAxis.toPixels(a,!0))})})}t.compose=function(t){let s=t.prototype;return s.linesApiNames=s.linesApiNames||e.slice(),s.pointArrayMap=s.pointArrayMap||a.slice(),s.pointValKey=s.pointValKey||"top",s.areaLinesNames=s.areaLinesNames||i.slice(),s.drawGraph=r,s.getGraphPath=l,s.toYData=o,s.translate=p,t}}(e||(e={}));let E=e,b=s();b.MultipleLinesComposition=b.MultipleLinesComposition||E;let V=s();export{V as default};