/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { IndicatorCalculationStrategy } from "./IndicatorCalculationStrategy";
import { RelativeStrengthIndexIndicatorStrategy } from "./RelativeStrengthIndexIndicatorStrategy";
import { String_$type, markType, getEnumerator } from "igniteui-react-core/ES5/type";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { isNaN_ } from "igniteui-react-core/ES5/number";
/**
 * @hidden
 */
var StochRSIIndicatorStrategy = /** @class */ (function (_super) {
    tslib_1.__extends(StochRSIIndicatorStrategy, _super);
    function StochRSIIndicatorStrategy() {
        var _this = _super.call(this) || this;
        _this.c = null;
        _this.c = new RelativeStrengthIndexIndicatorStrategy();
        return _this;
    }
    StochRSIIndicatorStrategy.prototype.b = function (a, b) {
        var c = new List$1(String_$type, 0);
        c.o(this.c.b(a, b));
        return c;
    };
    StochRSIIndicatorStrategy.prototype.a = function (a, b) {
        var c = getEnumerator(this.c.c(a, b));
        var d = a.period;
        var e = 0;
        var f = new Array(d);
        for (e = 0; e < d; e++) {
            f[e] = 0;
        }
        e = 0;
        while (c.moveNext()) {
            var g = Math.min(d, e);
            var h = -1.7976931348623157E+308;
            var i = 1.7976931348623157E+308;
            var j = e % d;
            for (var k = 0; k < g; k++) {
                if (!isNaN_(f[g - k - 1])) {
                    h = Math.max(h, f[g - k - 1]);
                }
                if (!isNaN_(f[g - k - 1])) {
                    i = Math.min(i, f[g - k - 1]);
                }
            }
            f[j] = c.current;
            var l = b.i((c.current - i) / (h - i));
            a.indicatorColumn.item(e, l);
            e++;
        }
        return true;
    };
    StochRSIIndicatorStrategy.$t = markType(StochRSIIndicatorStrategy, 'StochRSIIndicatorStrategy', IndicatorCalculationStrategy.$);
    return StochRSIIndicatorStrategy;
}(IndicatorCalculationStrategy));
export { StochRSIIndicatorStrategy };
