/**
 * Highstock JS v13.0.0 (2026-06-11)
 * @module highcharts/indicators/indicators
 * @requires highcharts
 * @requires highcharts/modules/stock
 *
 * Indicator series type for Highcharts Stock
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Paweł 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{setLength:o,splice:l}={convertToNumber:function(t,e){switch(typeof t){case"boolean":return+!!t;case"number":return isNaN(t)&&!e?null:t;default:return isNaN(t=parseFloat(`${t??""}`))&&!e?null:t}},setLength:function(t,e,a){return Array.isArray(t)?(t.length=e,t):t[a?"subarray":"slice"](0,e)},splice:function(t,e,a,i,s=[]){if(Array.isArray(t))return Array.isArray(s)||(s=Array.from(s)),{removed:t.splice(e,a,...s),array:t};let n=Object.getPrototypeOf(t).constructor,r=t[i?"subarray":"slice"](e,e+a),o=new n(t.length-a+s.length);return o.set(t.subarray(0,e),0),o.set(s,e),o.set(t.subarray(e+a),e+s.length),{removed:r,array:o}}},h=class{constructor(t={}){this.isDataTable=!0,this.autoId=!t.id,this.columns={},this.id=t.id||(0,i.uniqueKey)(),this.rowCount=0,this.versionTag=(0,i.uniqueKey)();let e=0;(0,i.objectEach)(t.columns||{},(t,a)=>{this.columns[a]=t.slice(),e=Math.max(e,t.length)}),this.applyRowCount(e)}applyRowCount(t){this.rowCount=t,(0,i.objectEach)(this.columns,(e,a)=>{e.length!==t&&(this.columns[a]=o(e,t))})}deleteRows(t,e=1){if(e>0&&t<this.rowCount){let a=0;(0,i.objectEach)(this.columns,(i,s)=>{this.columns[s]=l(i,t,e).array,a=i.length}),this.rowCount=a}(0,i.fireEvent)(this,"afterDeleteRows",{rowIndex:t,rowCount:e}),this.versionTag=(0,i.uniqueKey)()}getColumn(t,e){return this.columns[t]}getColumns(t,e){return(t||Object.keys(this.columns)).reduce((t,e)=>(t[e]=this.columns[e],t),{})}getRowObject(t,e){let a={},i=this.columns;for(let s of(e??(e=Object.keys(this.columns)),e))a[s]=i[s]?.[t];return a}setColumn(t,e=[],a=0,i){this.setColumns({[t]:e},a,i)}setColumns(t,e,a){let s=this.rowCount;(0,i.objectEach)(t,(t,e)=>{this.columns[e]=t.slice(),s=t.length}),this.applyRowCount(s),a?.silent||((0,i.fireEvent)(this,"afterSetColumns"),this.versionTag=(0,i.uniqueKey)())}setRow(t,e=this.rowCount,a,s){var n;let{columns:r}=this,o=a?this.rowCount+1:e+1,h=Object.keys(t);if(s?.addColumns!==!1)for(let t=0,e=h.length;t<e;t++)r[n=h[t]]||(r[n]=Array(this.rowCount));(0,i.objectEach)(r,(i,s)=>{i&&(a?i=l(i,e,0,!0,[t[s]]).array:i[e]=s in t?t[s]:i[e],r[s]=i)}),this.applyRowCount(Math.max(o,this.rowCount)),s?.silent||((0,i.fireEvent)(this,"afterSetRows",{rowIndex:e}),this.versionTag=(0,i.uniqueKey)())}getModified(){return this.modified||this}},u=t.default.SeriesRegistry;var p=a.n(u);let{line:c}=p().seriesTypes,d=(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 f extends c{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]+(0,i.pick)(this.nameSuffixes[a],""))},this),e=(this.nameBase||this.type.toUpperCase())+(this.nameComponents?" ("+t.join(", ")+")":"")),e}getValues(t,e){let a=e.period,s=t.xData||[],n=t.yData,r=n.length,o=[],l=[],h=[],u,p=-1,c=0,d,f=0;if(!(s.length<a)){for((0,i.isArray)(n[0])&&(p=e.index?e.index:0);c<a-1;)f+=p<0?n[c]:n[c][p],c++;for(u=c;u<r;u++)f+=p<0?n[u]:n[u][p],d=[s[u],f/a],o.push(d),l.push(d[0]),h.push(d[1]),f-=p<0?n[u-c]:n[u-c][p];return{values:o,xData:l,yData:h}}}init(t,e){let a=this;super.init.call(a,t,e);let s=(0,i.addEvent)(r(),"afterLinkSeries",function({isUpdating:e}){if(e)return;let s=!!a.dataEventsToUnbind.length;if(!a.linkedParent)return(0,i.error)("Series "+a.options.linkedTo+" not found! Check `linkedTo`.",!1,t);if(!s&&(a.dataEventsToUnbind.push((0,i.addEvent)(a.linkedParent,"updatedData",function(){a.recalculateValues()})),a.calculateOn.xAxis&&a.dataEventsToUnbind.push((0,i.addEvent)(a.linkedParent.xAxis,a.calculateOn.xAxis,function(){a.recalculateValues()}))),"init"===a.calculateOn.chart)a.closestPointRange||a.recalculateValues();else if(!s){let t=(0,i.addEvent)(a.chart,a.calculateOn.chart,function(){a.recalculateValues(),t()})}},{order:0});a.dataEventsToUnbind=[],a.eventsToUnbind.push(s)}recalculateValues(){let t=this.dataTable,e=this.dataTable.rowCount,a=!0,s,n,r=this.linkedParent.yData,o=this.linkedParent.processedYData;this.linkedParent.xData=this.linkedParent.getColumn("x"),this.linkedParent.yData=d(this.linkedParent),this.linkedParent.processedYData=d(this.linkedParent,!0);let l=this.linkedParent.options&&this.linkedParent.dataTable.rowCount&&this.getValues(this.linkedParent,this.options.params)||{values:[],xData:[],yData:[]};l.xData.length=l.values.length,delete this.linkedParent.xData,this.linkedParent.yData=r,this.linkedParent.processedYData=o;let u=this.pointArrayMap||["y"],p={};if(l.yData.forEach(t=>{u.forEach((e,a)=>{let s=p[e]||[];s.push((0,i.isArray)(t)?t[a]:t),p[e]||(p[e]=s)})}),e&&!this.hasGroupedData&&this.visible&&this.points)if(this.cropped){this.xAxis&&(s=this.xAxis.min,n=this.xAxis.max);let e=this.cropData(t,s,n);this.setData(e.modified,!1)}else(this.updateAllPoints||l.xData.length!==e-1&&l.xData.length!==e+1)&&(a=!1,this.setData(new h({columns:{x:l.xData,...p}}),!1));a&&(p.x=l.xData,l.values.reduce((t,e,a)=>(Object.keys(e).forEach(i=>{t[i]||(t[i]=[]),t[i][a]=e[i]}),t),p),t.setColumns(p),delete this.xColumn,delete this.xColumnIsNumbers),this.calculateOn.xAxis&&this.getColumn("x",!0).length&&(this.isDirty=!0,this.redraw()),this.isDirtyData=!!this.linkedSeries.length,(0,i.fireEvent)(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)}}f.defaultOptions=(0,i.merge)(c.defaultOptions,{name:void 0,tooltip:{valueDecimals:4},linkedTo:void 0,compareToMain:!1,params:{index:3,period:14}}),(0,i.extend)(f.prototype,{calculateOn:{chart:"init"},hasDerivedData:!0,nameComponents:["period"],nameSuffixes:[],useCommonDataGrouping:!0}),p().registerSeriesType("sma",f);let{sma:m}=p().seriesTypes;class y extends m{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,s,n,r,o){let l=t[a-1],h=r<0?e[a-1]:e[a-1][r];return[l,void 0===n?o:(0,i.correctFloat)(h*s+n*(1-s))]}getValues(t,e){let a=e.period,s=t.xData,n=t.yData,r=n?n.length:0,o=2/(a+1),l=[],h=[],u=[],p,c,d,f=-1,m=0;if(!(r<a)){for((0,i.isArray)(n[0])&&(f=e.index?e.index:0),m=this.accumulatePeriodPoints(a,f,n)/a,d=a;d<r+1;d++)c=this.calculateEma(s,n,d,o,p,f,m),l.push(c),h.push(c[0]),u.push(c[1]),p=c[1];return{values:l,xData:h,yData:u}}}}y.defaultOptions=(0,i.merge)(m.defaultOptions,{params:{index:3,period:9}}),p().registerSeriesType("ema",y);let{sma:{prototype:g}}=p().seriesTypes;!function(t){let e=["bottomLine"],a=["top","bottom"],s=["top"];function n(t){return"plot"+t.charAt(0).toUpperCase()+t.slice(1)}function r(t,e){let a=[];return(t.pointArrayMap||[]).forEach(t=>{t!==e&&a.push(n(t))}),a}function o(){let t=this,e=t.pointValKey,a=t.linesApiNames,s=t.areaLinesNames,o=t.points,l=t.options,h=t.graph,u={options:{gapSize:l.gapSize}},p=[],c=r(t,e),d=o.length,f;if(c.forEach((t,e)=>{for(p[e]=[];d--;)f=o[d],p[e].push({x:f.x,plotX:f.plotX,plotY:f[t],isNull:!(0,i.defined)(f[t])});d=o.length}),t.userOptions.fillColor&&s.length){let e=p[c.indexOf(n(s[0]))],a=1===s.length?o:p[c.indexOf(n(s[1]))],r=t.color;t.points=a,t.nextPoints=e,t.color=t.userOptions.fillColor,t.options=(0,i.merge)(o,u),t.graph=t.area,t.fillGraph=!0,g.drawGraph.call(t),t.area=t.graph,delete t.nextPoints,delete t.fillGraph,t.color=r}a.forEach((e,a)=>{p[a]?(t.points=p[a],l[e]?t.options=(0,i.merge)(l[e].styles,u):(0,i.error)('Error: "There is no '+e+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),t.graph=t["graph"+e],g.drawGraph.call(t),t["graph"+e]=t.graph):(0,i.error)('Error: "'+e+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),t.points=o,t.options=l,t.graph=h,g.drawGraph.call(t)}function l(t){let e,a=[],i=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=g.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",a=g.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=g.getGraphPath.apply(this,arguments);return a}function h(t){let e=[];return(this.pointArrayMap||[]).forEach(a=>{e.push(t[a])}),e}function u(){let t=this.pointArrayMap,e=[],a;e=r(this),g.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 i=t.prototype;return i.linesApiNames=i.linesApiNames||e.slice(),i.pointArrayMap=i.pointArrayMap||a.slice(),i.pointValKey=i.pointValKey||"top",i.areaLinesNames=i.areaLinesNames||s.slice(),i.drawGraph=o,i.getGraphPath=l,i.toYData=h,i.translate=u,t}}(e||(e={}));let x=e,C=s();C.MultipleLinesComposition=C.MultipleLinesComposition||x;let D=s();export{D as default};