/**
 * Highstock JS v13.0.0 (2026-06-11)
 * @module highcharts/indicators/price-envelopes
 * @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 a in e)o.o(e,a)&&!o.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let a=t.default;var i=o.n(a);let r=t.default.SeriesRegistry;var n=o.n(r);let{sma:{prototype:s}}=n().seriesTypes;!function(t){let e=["bottomLine"],o=["top","bottom"],i=["top"];function r(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(r(t))}),o}function p(){let t=this,e=t.pointValKey,o=t.linesApiNames,i=t.areaLinesNames,p=t.points,l=t.options,h=t.graph,d={options:{gapSize:l.gapSize}},c=[],m=n(t,e),y=p.length,u;if(m.forEach((t,e)=>{for(c[e]=[];y--;)u=p[y],c[e].push({x:u.x,plotX:u.plotX,plotY:u[t],isNull:!(0,a.defined)(u[t])});y=p.length}),t.userOptions.fillColor&&i.length){let e=c[m.indexOf(r(i[0]))],o=1===i.length?p:c[m.indexOf(r(i[1]))],n=t.color;t.points=o,t.nextPoints=e,t.color=t.userOptions.fillColor,t.options=(0,a.merge)(p,d),t.graph=t.area,t.fillGraph=!0,s.drawGraph.call(t),t.area=t.graph,delete t.nextPoints,delete t.fillGraph,t.color=n}o.forEach((e,o)=>{c[o]?(t.points=c[o],l[e]?t.options=(0,a.merge)(l[e].styles,d):(0,a.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],s.drawGraph.call(t),t["graph"+e]=t.graph):(0,a.error)('Error: "'+e+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),t.points=p,t.options=l,t.graph=h,s.drawGraph.call(t)}function l(t){let e,o=[],a=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=s.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",o=s.getGraphPath.call(this,t),a=e.slice(0,o.length);for(let t=a.length-1;t>=0;t--)o.push(a[t])}}else o=s.getGraphPath.apply(this,arguments);return o}function h(t){let e=[];return(this.pointArrayMap||[]).forEach(o=>{e.push(t[o])}),e}function d(){let t=this.pointArrayMap,e=[],o;e=n(this),s.translate.apply(this,arguments),this.points.forEach(a=>{t.forEach((t,i)=>{o=a[t],this.dataModify&&(o=this.dataModify.modifyValue(o)),null!==o&&(a[e[i]]=this.yAxis.toPixels(o,!0))})})}t.compose=function(t){let a=t.prototype;return a.linesApiNames=a.linesApiNames||e.slice(),a.pointArrayMap=a.pointArrayMap||o.slice(),a.pointValKey=a.pointValKey||"top",a.areaLinesNames=a.areaLinesNames||i.slice(),a.drawGraph=p,a.getGraphPath=l,a.toYData=h,a.translate=d,t}}(e||(e={}));let p=e,{sma:l}=n().seriesTypes;class h extends l{init(){super.init.apply(this,arguments),this.options=(0,a.merge)({topLine:{styles:{lineColor:this.color}},bottomLine:{styles:{lineColor:this.color}}},this.options)}getValues(t,e){let o,i,r,n,s,p,l,h,d=e.period,c=e.topBand,m=e.bottomBand,y=t.xData,u=t.yData,f=u?u.length:0,g=[],b=[],x=[];if(!(y.length<d)&&(0,a.isArray)(u[0])&&4===u[0].length){for(h=d;h<=f;h++)s=y.slice(h-d,h),p=u.slice(h-d,h),n=(l=super.getValues({xData:s,yData:p},e)).xData[0],i=(o=l.yData[0])*(1+c),r=o*(1-m),g.push([n,i,o,r]),b.push(n),x.push([i,o,r]);return{values:g,xData:b,yData:x}}}}h.defaultOptions=(0,a.merge)(l.defaultOptions,{marker:{enabled:!1},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/>'},params:{period:20,topBand:.1,bottomBand:.1},bottomLine:{styles:{lineWidth:1,lineColor:void 0}},topLine:{styles:{lineWidth:1}},dataGrouping:{approximation:"averages"}}),(0,a.extend)(h.prototype,{areaLinesNames:["top","bottom"],linesApiNames:["topLine","bottomLine"],nameComponents:["period","topBand","bottomBand"],nameBase:"Price envelopes",pointArrayMap:["top","middle","bottom"],parallelArrays:["x","y","top","bottom"],pointValKey:"middle"}),p.compose(h),n().registerSeriesType("priceenvelopes",h);let d=i();export{d as default};