/**
 * Highstock JS v12.5.0 (2026-01-12)
 * @module highcharts/indicators/price-channel
 * @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,a={};a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var i in t)a.o(t,i)&&!a.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);let i=e.default;var o=a.n(i);let r=function(e,t,a){return e.reduce((e,i)=>[Math.min(e[0],i[t]),Math.max(e[1],i[a])],[Number.MAX_VALUE,-Number.MAX_VALUE])},n=e.default.SeriesRegistry;var s=a.n(n);let{sma:{prototype:p}}=s().seriesTypes,{defined:l,error:h,merge:c}=o();!function(e){let t=["bottomLine"],a=["top","bottom"],i=["top"];function o(e){return"plot"+e.charAt(0).toUpperCase()+e.slice(1)}function r(e,t){let a=[];return(e.pointArrayMap||[]).forEach(e=>{e!==t&&a.push(o(e))}),a}function n(){let e=this,t=e.pointValKey,a=e.linesApiNames,i=e.areaLinesNames,n=e.points,s=e.options,u=e.graph,f={options:{gapSize:s.gapSize}},d=[],m=r(e,t),y=n.length,g;if(m.forEach((e,t)=>{for(d[t]=[];y--;)g=n[y],d[t].push({x:g.x,plotX:g.plotX,plotY:g[e],isNull:!l(g[e])});y=n.length}),e.userOptions.fillColor&&i.length){let t=d[m.indexOf(o(i[0]))],a=1===i.length?n:d[m.indexOf(o(i[1]))],r=e.color;e.points=a,e.nextPoints=t,e.color=e.userOptions.fillColor,e.options=c(n,f),e.graph=e.area,e.fillGraph=!0,p.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=r}a.forEach((t,a)=>{d[a]?(e.points=d[a],s[t]?e.options=c(s[t].styles,f):h('Error: "There is no '+t+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),e.graph=e["graph"+t],p.drawGraph.call(e),e["graph"+t]=e.graph):h('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=n,e.options=s,e.graph=u,p.drawGraph.call(e)}function s(e){let t,a=[],i=[];if(e=e||this.points,this.fillGraph&&this.nextPoints){if((t=p.getGraphPath.call(this,this.nextPoints))&&t.length){t[0][0]="L",a=p.getGraphPath.call(this,e),i=t.slice(0,a.length);for(let e=i.length-1;e>=0;e--)a.push(i[e])}}else a=p.getGraphPath.apply(this,arguments);return a}function u(e){let t=[];return(this.pointArrayMap||[]).forEach(a=>{t.push(e[a])}),t}function f(){let e=this.pointArrayMap,t=[],a;t=r(this),p.translate.apply(this,arguments),this.points.forEach(i=>{e.forEach((e,o)=>{a=i[e],this.dataModify&&(a=this.dataModify.modifyValue(a)),null!==a&&(i[t[o]]=this.yAxis.toPixels(a,!0))})})}e.compose=function(e){let o=e.prototype;return o.linesApiNames=o.linesApiNames||t.slice(),o.pointArrayMap=o.pointArrayMap||a.slice(),o.pointValKey=o.pointValKey||"top",o.areaLinesNames=o.areaLinesNames||i.slice(),o.drawGraph=n,o.getGraphPath=s,o.toYData=u,o.translate=f,e}}(t||(t={}));let u=t,{sma:f}=s().seriesTypes,{merge:d,extend:m}=o();class y extends f{getValues(e,t){let a,i,o,n,s,p,l=t.period,h=e.xData,c=e.yData,u=c?c.length:0,f=[],d=[],m=[];if(!(u<l)){for(p=l;p<=u;p++)n=h[p-1],a=((i=(s=r(c.slice(p-l,p),2,1))[1])+(o=s[0]))/2,f.push([n,i,a,o]),d.push(n),m.push([i,a,o]);return{values:f,xData:d,yData:m}}}}y.defaultOptions=d(f.defaultOptions,{params:{index:void 0,period:20},lineWidth:1,topLine:{styles:{lineColor:"#00e272",lineWidth:1}},bottomLine:{styles:{lineColor:"#feb56a",lineWidth:1}},dataGrouping:{approximation:"averages"}}),m(y.prototype,{areaLinesNames:["top","bottom"],nameBase:"Price Channel",nameComponents:["period"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"}),u.compose(y),s().registerSeriesType("pc",y);let g=o();export{g as default};