/*
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 { Base, Point_$type, markType } from "igniteui-react-core/ES2015/type";
import { LeastSquaresFit } from "igniteui-react-core/ES2015/LeastSquaresFit";
import { NotImplementedException } from "igniteui-react-core/ES2015/NotImplementedException";
import { isNaN_, isInfinity } from "igniteui-react-core/ES2015/number";
/**
 * @hidden
 */
export class BarTrendFitCalculator extends Base {
    static a(a, b, c, d, e, f, g, h, i, j, k) {
        if (d == null) {
            switch (b) {
                case 1:
                    d = LeastSquaresFit.k(e, g, f);
                    break;
                case 2:
                    d = LeastSquaresFit.o(e, g, f);
                    break;
                case 3:
                    d = LeastSquaresFit.i(e, g, f);
                    break;
                case 4:
                    d = LeastSquaresFit.p(e, g, f);
                    break;
                case 5:
                    d = LeastSquaresFit.q(e, g, f);
                    break;
                case 7:
                    d = LeastSquaresFit.j(e, g, f);
                    break;
                case 6:
                    d = LeastSquaresFit.l(e, g, f);
                    break;
                case 8:
                    d = LeastSquaresFit.n(e, g, f);
                    break;
                default: throw new NotImplementedException(0);
            }
        }
        if (d == null) {
            return null;
        }
        for (let l = 0; l < c.f.height; l += 2) {
            let m = l / (c.f.height - 1);
            let n = j + m * (k - j);
            let o = NaN;
            switch (b) {
                case 1:
                    o = LeastSquaresFit.ad(d, n);
                    break;
                case 2:
                    o = LeastSquaresFit.ah(d, n);
                    break;
                case 3:
                    o = LeastSquaresFit.ab(d, n);
                    break;
                case 4:
                    o = LeastSquaresFit.ai(d, n);
                    break;
                case 5:
                    o = LeastSquaresFit.aj(d, n);
                    break;
                case 7:
                    o = LeastSquaresFit.ac(d, n);
                    break;
                case 6:
                    o = LeastSquaresFit.ae(d, n);
                    break;
                case 8:
                    o = LeastSquaresFit.ag(d, n);
                    break;
                default: throw new NotImplementedException(0);
            }
            o = h(o);
            n = i(n);
            if (!isNaN_(o) && !isInfinity(o)) {
                a.add({ $type: Point_$type, x: o, y: n + c.a });
            }
        }
        return d;
    }
}
BarTrendFitCalculator.$t = markType(BarTrendFitCalculator, 'BarTrendFitCalculator');
