/*
 Highstock JS v9.3.3 (2022-02-01)

 Indicator series type for Highcharts Stock

 (c) 2010-2021 Daniel Studencki

 License: www.highcharts.com/license
*/
'use strict';(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/indicators/price-channel",["highcharts","highcharts/modules/stock"],function(m){a(m);a.Highcharts=m;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function m(a,g,l,n){a.hasOwnProperty(g)||(a[g]=n.apply(null,l))}a=a?a._modules:{};m(a,"Stock/Indicators/ArrayUtilities.js",[],function(){return{getArrayExtremes:function(a,
g,l){return a.reduce(function(a,q){return[Math.min(a[0],q[g]),Math.max(a[1],q[l])]},[Number.MAX_VALUE,-Number.MAX_VALUE])}}});m(a,"Stock/Indicators/MultipleLinesComposition.js",[a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"]],function(a,g){var l=a.seriesTypes.sma,m=g.defined,q=g.error,w=g.merge,k;(function(g){function k(b){var d,a=[];b=b||this.points;if(this.fillGraph&&this.nextPoints){if((d=l.prototype.getGraphPath.call(this,this.nextPoints))&&d.length){d[0][0]="L";a=l.prototype.getGraphPath.call(this,
b);d=d.slice(0,a.length);for(var e=d.length-1;0<=e;e--)a.push(d[e])}}else a=l.prototype.getGraphPath.apply(this,arguments);return a}function r(){var b=this,d=b.linesApiNames,p=b.areaLinesNames,e=b.points,f=b.options,g=b.graph,h={options:{gapSize:f.gapSize}},r=[],t=b.getTranslatedLinesNames(b.pointValKey),u=e.length,k;t.forEach(function(b,a){for(r[a]=[];u--;)k=e[u],r[a].push({x:k.x,plotX:k.plotX,plotY:k[b],isNull:!m(k[b])});u=e.length});if(this.userOptions.fillColor&&p.length){var n=t.indexOf(c(p[0]));
n=r[n];p=1===p.length?e:r[t.indexOf(c(p[1]))];t=b.color;b.points=p;b.nextPoints=n;b.color=this.userOptions.fillColor;b.options=w(e,h);b.graph=b.area;b.fillGraph=!0;a.seriesTypes.sma.prototype.drawGraph.call(b);b.area=b.graph;delete b.nextPoints;delete b.fillGraph;b.color=t}d.forEach(function(a,d){r[d]?(b.points=r[d],f[a]?b.options=w(f[a].styles,h):q('Error: "There is no '+a+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names." at mixin/multiple-line.js:34'),
b.graph=b["graph"+a],l.prototype.drawGraph.call(b),b["graph"+a]=b.graph):q('Error: "'+a+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")});b.points=e;b.options=f;b.graph=g;l.prototype.drawGraph.call(b)}function h(b){var a=[];(this.pointArrayMap||[]).forEach(function(d){d!==b&&a.push(c(d))});return a}function c(b){return"plot"+b.charAt(0).toUpperCase()+b.slice(1)}function f(b){var a=[];(this.pointArrayMap||[]).forEach(function(d){a.push(b[d])});
return a}function t(){var b=this,a=b.pointArrayMap,c=[],e;c=b.getTranslatedLinesNames();l.prototype.translate.apply(b,arguments);b.points.forEach(function(d){a.forEach(function(a,f){e=d[a];b.dataModify&&(e=b.dataModify.modifyValue(e));null!==e&&(d[c[f]]=b.yAxis.toPixels(e,!0))})})}var u=[],n=["bottomLine"],y=["top","bottom"],z=["top"];g.compose=function(b){if(-1===u.indexOf(b)){u.push(b);var a=b.prototype;a.linesApiNames=a.linesApiNames||n.slice();a.pointArrayMap=a.pointArrayMap||y.slice();a.pointValKey=
a.pointValKey||"top";a.areaLinesNames=a.areaLinesNames||z.slice();a.drawGraph=r;a.getGraphPath=k;a.toYData=f;a.translate=t;a.getTranslatedLinesNames=h}return b}})(k||(k={}));return k});m(a,"Stock/Indicators/PC/PCIndicator.js",[a["Stock/Indicators/ArrayUtilities.js"],a["Stock/Indicators/MultipleLinesComposition.js"],a["Core/Color/Palettes.js"],a["Core/Series/SeriesRegistry.js"],a["Core/Utilities.js"]],function(a,g,l,n,q){var m=this&&this.__extends||function(){var a=function(h,c){a=Object.setPrototypeOf||
{__proto__:[]}instanceof Array&&function(a,c){a.__proto__=c}||function(a,c){for(var f in c)c.hasOwnProperty(f)&&(a[f]=c[f])};return a(h,c)};return function(h,c){function f(){this.constructor=h}a(h,c);h.prototype=null===c?Object.create(c):(f.prototype=c.prototype,new f)}}(),k=n.seriesTypes.sma,x=q.merge;q=q.extend;var v=function(g){function h(){var a=null!==g&&g.apply(this,arguments)||this;a.data=void 0;a.options=void 0;a.points=void 0;return a}m(h,g);h.prototype.getValues=function(c,f){f=f.period;
var g=c.xData,h=(c=c.yData)?c.length:0,k=[],l=[],m=[],b;if(!(h<f)){for(b=f;b<=h;b++){var d=g[b-1];var p=c.slice(b-f,b);var e=a.getArrayExtremes(p,2,1);p=e[1];var n=e[0];e=(p+n)/2;k.push([d,p,e,n]);l.push(d);m.push([p,e,n])}return{values:k,xData:l,yData:m}}};h.defaultOptions=x(k.defaultOptions,{params:{index:void 0,period:20},lineWidth:1,topLine:{styles:{lineColor:l.colors[2],lineWidth:1}},bottomLine:{styles:{lineColor:l.colors[8],lineWidth:1}},dataGrouping:{approximation:"averages"}});return h}(k);
q(v.prototype,{areaLinesNames:["top","bottom"],nameBase:"Price Channel",nameComponents:["period"],linesApiNames:["topLine","bottomLine"],pointArrayMap:["top","middle","bottom"],pointValKey:"middle"});g.compose(v);n.registerSeriesType("pc",v);"";return v});m(a,"masters/indicators/price-channel.src.js",[],function(){})});
//# sourceMappingURL=price-channel.js.map