/*
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 { TrendLineManagerBase$1 } from "./TrendLineManagerBase$1";
import { Number_$type, Point_$type, markType } from "igniteui-react-core/ES5/type";
import { List$1 } from "igniteui-react-core/ES5/List$1";
import { TrendFitCalculator } from "./TrendFitCalculator";
import { TrendAverageCalculator } from "./TrendAverageCalculator";
import { PolarLinePlanner } from "./PolarLinePlanner";
import { isNaN_ } from "igniteui-react-core/ES5/number";
/**
 * @hidden
 */
var RadialTrendLineManager = /** @class */ (function (_super) {
    tslib_1.__extends(RadialTrendLineManager, _super);
    function RadialTrendLineManager() {
        var _this = _super.call(this, Number_$type) || this;
        _this.q = 0;
        _this.p = 0;
        _this.r = null;
        _this.s = null;
        return _this;
    }
    RadialTrendLineManager.prototype.get_g$a = function () {
        return 3;
    };
    Object.defineProperty(RadialTrendLineManager.prototype, "g$a", {
        get: function () {
            return this.get_g$a();
        },
        enumerable: true,
        configurable: true
    });
    RadialTrendLineManager.prototype.t = function (a, b, c, d, e, f, g, h) {
        var i = g.d * g.c;
        var j = g.e * g.c;
        var k = new List$1(Point_$type, 0);
        if (!g.g.isEmpty && !g.f.isEmpty) {
            if (b == 0) {
                this.a = null;
                this.d.clear();
                return;
            }
            if (this.c(b)) {
                this.d.clear();
                this.a = TrendFitCalculator.a(k, b, g, this.a, c.count, function (l) { return (l + 1); }, function (l) { return c.item(l); }, function (l) { return e(l - 1); }, f, i + 1, j + 1);
            }
            if (this.b(b)) {
                this.a = null;
                TrendAverageCalculator.b(b, this.d, c, d);
                for (var l = g.d; l <= g.e; l += 1) {
                    var m = (l % c.count) * g.c;
                    if (m >= 0 && m < this.d.count) {
                        var n = e(m);
                        var o = f(this.d._inner[m]);
                        if (!isNaN_(n) && !isNaN_(o)) {
                            k.add({ $type: Point_$type, x: n + g.a, y: o });
                        }
                    }
                }
            }
            if (k.count > 0) {
                this.n(k, g, a, h);
            }
        }
    };
    RadialTrendLineManager.prototype.m = function (a, b, c) {
        this.n(a, b, c, null);
    };
    RadialTrendLineManager.prototype.n = function (a, b, c, d) {
        var _this = this;
        if (d != null) {
            d.i = c;
        }
        var e = ((function () {
            var $ret = new PolarLinePlanner();
            $ret.m = function (f) { return a.item(f).x; };
            $ret.n = function (f) { return a.item(f).y; };
            $ret.a = d;
            $ret.q = a.count;
            $ret.l = b.b;
            $ret.o = function (f) { return _this.r(a.item(f).x, a.item(f).y); };
            $ret.p = function (f) { return _this.s(a.item(f).x, a.item(f).y); };
            $ret.f = true;
            $ret.ab = b.f;
            $ret.ac = b.g;
            return $ret;
        })());
        e.x(null, null);
    };
    RadialTrendLineManager.$t = markType(RadialTrendLineManager, 'RadialTrendLineManager', TrendLineManagerBase$1.$.specialize(Number_$type));
    return RadialTrendLineManager;
}(TrendLineManagerBase$1));
export { RadialTrendLineManager };
