/**
 * Highstock JS v12.6.0 (2026-04-13)
 * @module highcharts/indicators/bollinger-bands
 * @requires highcharts
 * @requires highcharts/modules/stock
 *
 * Indicator series type for Highcharts Stock
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Paweł Fus
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */import*as t from"../highcharts.js";var e,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 r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let r=t.default;var i=o.n(r);let a=t.default.SeriesRegistry;var n=o.n(a);let{doc:s,win:l}=i();function p(t){return c(t)&&"number"==typeof t.nodeType}function h(t){let e=Object.prototype.toString.call(t);return"[object Array]"===e||"[object Array Iterator]"===e}function c(t,e){return!!t&&"object"==typeof t&&(!e||!h(t))}function u(t,...e){let o,r=[t,...e],i={},a=function(t,e){return"object"!=typeof t&&(t={}),function(t,e,o){for(let o in t)Object.hasOwnProperty.call(t,o)&&e.call((0,t[o]),t[o],o,t)}(e,function(o,r){if("__proto__"!==r&&"constructor"!==r){let i;!c(o,!0)||(i=o?.constructor,c(o,!0)&&!p(o)&&i?.name&&"Object"!==i.name)||p(o)?t[r]=e[r]:t[r]=a(t[r]||{},o)}}),t};!0===t&&(i=r[1],r=Array.prototype.slice.call(r,2));let n=r.length;for(o=0;o<n;o++)i=a(i,r[o]);return i}Array.prototype.find;let{sma:{prototype:f}}=n().seriesTypes;!function(t){let e=["bottomLine"],o=["top","bottom"],i=["top"];function a(t){return"plot"+t.charAt(0).toUpperCase()+t.slice(1)}function n(t,e){let o=[];return(t.pointArrayMap||[]).forEach(t=>{t!==e&&o.push(a(t))}),o}function s(){let t=this,e=t.pointValKey,o=t.linesApiNames,i=t.areaLinesNames,s=t.points,l=t.options,p=t.graph,h={options:{gapSize:l.gapSize}},c=[],y=n(t,e),d=s.length,m;if(y.forEach((t,e)=>{for(c[e]=[];d--;)m=s[d],c[e].push({x:m.x,plotX:m.plotX,plotY:m[t],isNull:null==m[t]});d=s.length}),t.userOptions.fillColor&&i.length){let e=c[y.indexOf(a(i[0]))],o=1===i.length?s:c[y.indexOf(a(i[1]))],r=t.color;t.points=o,t.nextPoints=e,t.color=t.userOptions.fillColor,t.options=u(s,h),t.graph=t.area,t.fillGraph=!0,f.drawGraph.call(t),t.area=t.graph,delete t.nextPoints,delete t.fillGraph,t.color=r}o.forEach((e,o)=>{c[o]?(t.points=c[o],l[e]?t.options=u(l[e].styles,h):(0,r.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],f.drawGraph.call(t),t["graph"+e]=t.graph):(0,r.error)('Error: "'+e+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),t.points=s,t.options=l,t.graph=p,f.drawGraph.call(t)}function l(t){let e,o=[],r=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=f.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",o=f.getGraphPath.call(this,t),r=e.slice(0,o.length);for(let t=r.length-1;t>=0;t--)o.push(r[t])}}else o=f.getGraphPath.apply(this,arguments);return o}function p(t){let e=[];return(this.pointArrayMap||[]).forEach(o=>{e.push(t[o])}),e}function h(){let t=this.pointArrayMap,e=[],o;e=n(this),f.translate.apply(this,arguments),this.points.forEach(r=>{t.forEach((t,i)=>{o=r[t],this.dataModify&&(o=this.dataModify.modifyValue(o)),null!==o&&(r[e[i]]=this.yAxis.toPixels(o,!0))})})}t.compose=function(t){let r=t.prototype;return r.linesApiNames=r.linesApiNames||e.slice(),r.pointArrayMap=r.pointArrayMap||o.slice(),r.pointValKey=r.pointValKey||"top",r.areaLinesNames=r.areaLinesNames||i.slice(),r.drawGraph=s,r.getGraphPath=l,r.toYData=p,r.translate=h,t}}(e||(e={}));let y=e,{sma:d}=n().seriesTypes;class m extends d{init(){n().seriesTypes.sma.prototype.init.apply(this,arguments),this.options=u({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(t,e){let o,r,i,a,s,l,p,c,u,f=e.period,y=e.standardDeviation,d=[],m=[],g=t.xData,b=t.yData,A=b?b.length:0,x=[];if(g.length<f)return;let v=h(b[0]);for(u=f;u<=A;u++)s=g.slice(u-f,u),l=b.slice(u-f,u),a=(c=n().seriesTypes.sma.prototype.getValues.call(this,{xData:s,yData:l},e)).xData[0],o=c.yData[0],p=function(t,e,o,r){let i=t.length,a=0,n,s=0;for(;a<i;a++)s+=(n=(o?t[a][e]:t[a])-r)*n;return Math.sqrt(s/=i-1)}(l,e.index,v,o),r=o+y*p,i=o-y*p,x.push([a,r,o,i]),d.push(a),m.push([r,o,i]);return{values:x,xData:d,yData:m}}}m.defaultOptions=u(d.defaultOptions,{params:{period:20,standardDeviation:2,index:3},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/>Top: {point.top}<br/>Middle: {point.middle}<br/>Bottom: {point.bottom}<br/>'},marker:{enabled:!1},dataGrouping:{approximation:"averages"}}),function(t,e){let o;for(o in t||(t={}),e)t[o]=e[o]}(m.prototype,{areaLinesNames:["top","bottom"],linesApiNames:["topLine","bottomLine"],nameComponents:["period","standardDeviation"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),y.compose(m),n().registerSeriesType("bb",m);let g=i();export{g as default};