!/**
 * Highcharts Stock JS v12.5.0 (2026-01-12)
 * @module highcharts/indicators/klinger
 * @requires highcharts
 * @requires highcharts/modules/stock
 *
 * Indicator series type for Highcharts Stock
 *
 * (c) 2010-2026 Highsoft AS
 * Author: Karol Kolodziej
 *
 * A commercial license may be required depending on use.
 * See www.highcharts.com/license
 */function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("highcharts"),require("highcharts").SeriesRegistry):"function"==typeof define&&define.amd?define("highcharts/indicators/klinger",[["highcharts/highcharts"],["highcharts/highcharts","SeriesRegistry"]],e):"object"==typeof exports?exports["highcharts/indicators/klinger"]=e(require("highcharts"),require("highcharts").SeriesRegistry):t.Highcharts=e(t.Highcharts,t.Highcharts.SeriesRegistry)}(this,function(t,e){return function(){"use strict";var r,o,i={512:function(t){t.exports=e},944:function(e){e.exports=t}},n={};function a(t){var e=n[t];if(void 0!==e)return e.exports;var r=n[t]={exports:{}};return i[t](r,r.exports,a),r.exports}a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,{a:e}),e},a.d=function(t,e){for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};var s={};a.d(s,{default:function(){return O}});var p=a(944),l=a.n(p),h=a(512),u=a.n(h),c=u().seriesTypes.sma.prototype,f=l().defined,g=l().error,y=l().merge;!function(t){var e=["bottomLine"],r=["top","bottom"],o=["top"];function i(t){return"plot"+t.charAt(0).toUpperCase()+t.slice(1)}function n(t,e){var r=[];return(t.pointArrayMap||[]).forEach(function(t){t!==e&&r.push(i(t))}),r}function a(){var t,e=this,r=e.pointValKey,o=e.linesApiNames,a=e.areaLinesNames,s=e.points,p=e.options,l=e.graph,h={options:{gapSize:p.gapSize}},u=[],d=n(e,r),v=s.length;if(d.forEach(function(e,r){for(u[r]=[];v--;)t=s[v],u[r].push({x:t.x,plotX:t.plotX,plotY:t[e],isNull:!f(t[e])});v=s.length}),e.userOptions.fillColor&&a.length){var m=u[d.indexOf(i(a[0]))],A=1===a.length?s:u[d.indexOf(i(a[1]))],P=e.color;e.points=A,e.nextPoints=m,e.color=e.userOptions.fillColor,e.options=y(s,h),e.graph=e.area,e.fillGraph=!0,c.drawGraph.call(e),e.area=e.graph,delete e.nextPoints,delete e.fillGraph,e.color=P}o.forEach(function(t,r){u[r]?(e.points=u[r],p[t]?e.options=y(p[t].styles,h):g('Error: "There is no '+t+' in DOCS options declared. Check if linesApiNames are consistent with your DOCS line names."'),e.graph=e["graph"+t],c.drawGraph.call(e),e["graph"+t]=e.graph):g('Error: "'+t+" doesn't have equivalent in pointArrayMap. To many elements in linesApiNames relative to pointArrayMap.\"")}),e.points=s,e.options=p,e.graph=l,c.drawGraph.call(e)}function s(t){var e,r=[],o=[];if(t=t||this.points,this.fillGraph&&this.nextPoints){if((e=c.getGraphPath.call(this,this.nextPoints))&&e.length){e[0][0]="L",r=c.getGraphPath.call(this,t),o=e.slice(0,r.length);for(var i=o.length-1;i>=0;i--)r.push(o[i])}}else r=c.getGraphPath.apply(this,arguments);return r}function p(t){var e=[];return(this.pointArrayMap||[]).forEach(function(r){e.push(t[r])}),e}function l(){var t,e=this,r=this.pointArrayMap,o=[];o=n(this),c.translate.apply(this,arguments),this.points.forEach(function(i){r.forEach(function(r,n){t=i[r],e.dataModify&&(t=e.dataModify.modifyValue(t)),null!==t&&(i[o[n]]=e.yAxis.toPixels(t,!0))})})}t.compose=function(t){var i=t.prototype;return i.linesApiNames=i.linesApiNames||e.slice(),i.pointArrayMap=i.pointArrayMap||r.slice(),i.pointValKey=i.pointValKey||"top",i.areaLinesNames=i.areaLinesNames||o.slice(),i.drawGraph=a,i.getGraphPath=s,i.toYData=p,i.translate=l,t}}(o||(o={}));var d=o,v=(r=function(t,e){return(r=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}),m=u().seriesTypes,A=m.ema,P=m.sma,x=l().correctFloat,M=l().error,S=l().extend,b=l().isArray,w=l().merge,D=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return v(e,t),e.prototype.calculateTrend=function(t,e){return t[e][1]+t[e][2]+t[e][3]>t[e-1][1]+t[e-1][2]+t[e-1][3]?1:-1},e.prototype.isValidData=function(t){var e=this.chart,r=this.options,o=this.linkedParent,i=b(t)&&4===t.length,n=this.volumeSeries||(this.volumeSeries=e.get(r.params.volumeSeriesID));return n||M("Series "+r.params.volumeSeriesID+" not found! Check `volumeSeriesID`.",!0,o.chart),!!([o,n].every(function(t){return t&&t.dataTable.rowCount>=r.params.slowAvgPeriod})&&i)},e.prototype.getCM=function(t,e,r,o,i){return x(e+(r===o?t:i))},e.prototype.getDM=function(t,e){return x(t-e)},e.prototype.getVolumeForce=function(t){for(var e,r,o=[],i=0,n=1,a=0,s=t[0][1]-t[0][2],p=0;n<t.length;n++)r=this.calculateTrend(t,n),e=this.getDM(t[n][1],t[n][2]),i=this.getCM(a,e,r,p,s),o.push([this.volumeSeries.getColumn("y")[n]*r*Math.abs(2*(e/i-1))*100]),p=r,a=i,s=e;return o},e.prototype.getEMA=function(t,e,r,o,i,n,a){return A.prototype.calculateEma(a||[],t,void 0===n?1:n,o,e,void 0===i?-1:i,r)},e.prototype.getSMA=function(t,e,r){return A.prototype.accumulatePeriodPoints(t,e,r)/t},e.prototype.getValues=function(t,e){var r,o,i=[],n=t.xData,a=t.yData,s=[],p=[],l=[],h=0,u=0,c=void 0,f=void 0,g=null;if(this.isValidData(a[0])){for(var y=this.getVolumeForce(a),d=this.getSMA(e.fastAvgPeriod,0,y),v=this.getSMA(e.slowAvgPeriod,0,y),m=2/(e.fastAvgPeriod+1),A=2/(e.slowAvgPeriod+1);h<a.length;h++)h>=e.fastAvgPeriod&&(c=u=this.getEMA(y,c,d,m,0,h,n)[1]),h>=e.slowAvgPeriod&&(f=o=this.getEMA(y,f,v,A,0,h,n)[1],r=x(u-o),l.push(r),l.length>=e.signalPeriod&&(g=l.slice(-e.signalPeriod).reduce(function(t,e){return t+e})/e.signalPeriod),i.push([n[h],r,g]),s.push(n[h]),p.push([r,g]));return{values:i,xData:s,yData:p}}},e.defaultOptions=w(P.defaultOptions,{params:{fastAvgPeriod:34,slowAvgPeriod:55,signalPeriod:13,volumeSeriesID:"volume"},signalLine:{styles:{lineWidth:1,lineColor:"#ff0000"}},dataGrouping:{approximation:"averages"},tooltip:{pointFormat:'<span style="color: {point.color}">●</span><b> {series.name}</b><br/><span style="color: {point.color}">Klinger</span>: {point.y}<br/><span style="color: {point.series.options.signalLine.styles.lineColor}">Signal</span>: {point.signal}<br/>'}}),e}(P);S(D.prototype,{areaLinesNames:[],linesApiNames:["signalLine"],nameBase:"Klinger",nameComponents:["fastAvgPeriod","slowAvgPeriod"],pointArrayMap:["y","signal"],parallelArrays:["x","y","signal"],pointValKey:"y"}),d.compose(D),u().registerSeriesType("klinger",D);var O=l();return s.default}()});