/*
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 { __extends } from "tslib";
import { CategoryTrendLineManagerBase } from "./CategoryTrendLineManagerBase";
import { Point_$type, markType } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { TrendFitCalculator } from "./TrendFitCalculator";
import { TrendAverageCalculator } from "./TrendAverageCalculator";
/**
 * @hidden
 */
var SortingTrendLineManager = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(SortingTrendLineManager, _super);
    function SortingTrendLineManager(a, b) {
        var _this = _super.call(this) || this;
        _this.j = null;
        _this.k = null;
        _this.j = a;
        _this.k = b;
        return _this;
    }
    SortingTrendLineManager.prototype.get_g$a = function () {
        return 1;
    };
    SortingTrendLineManager.prototype.prepareLineCore = function (a, b, c, d, e, f, g) {
        var _this = this;
        var h = g.c;
        var i = g.b;
        var j = new List$1(Point_$type, 0);
        if (b == 0) {
            this.a = null;
            this.i.clear();
            return;
        }
        if (this.d(b)) {
            this.i.clear();
            this.a = TrendFitCalculator.a(j, b, g, this.a, c.count, function (k) {
                var l = _this.j(k);
                l = (l - h) / (i - h);
                return l;
            }, function (k) { return c.item(k); }, function (k) {
                var l = (k * (i - h)) + h;
                return e(l);
            }, f, 0, 1);
        }
        if (this.c(b)) {
            this.a = null;
            TrendAverageCalculator.b(b, this.i, c, d);
            for (var k = g.f; k <= g.g; k += 1) {
                var l = k * g.e;
                var m = this.j(l);
                if (l >= 0 && l < this.i.count) {
                    var n = e(m);
                    var o = f(this.i._inner[l]);
                    j.add({ $type: Point_$type, x: n + g.a, y: o });
                }
            }
        }
        this.f(j, g, a);
    };
    SortingTrendLineManager.$t = markType(SortingTrendLineManager, 'SortingTrendLineManager', CategoryTrendLineManagerBase.$);
    return SortingTrendLineManager;
}(CategoryTrendLineManagerBase));
export { SortingTrendLineManager };
