/*
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, fromEnum, typeCast, markType } from "igniteui-react-core";
import { ITrendLineManager_$type } from "./ITrendLineManager";
import { List$1 } from "igniteui-react-core";
import { Polyline } from "igniteui-react-core";
import { Flattener } from "igniteui-react-core";
import { Series } from "./Series";
import { Panel } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
/**
 * @hidden
 */
export let TrendLineManagerBase$1 = /*@__PURE__*/ (() => {
    class TrendLineManagerBase$1 extends Base {
        constructor($tTrendColumn) {
            super();
            this.$tTrendColumn = null;
            this.d = null;
            this.a = null;
            this.g = ((() => {
                let $ret = new Polyline();
                $ret.ab = false;
                return $ret;
            })());
            this.$tTrendColumn = $tTrendColumn;
            this.$type = this.$type.specialize(this.$tTrendColumn);
            this.d = new List$1(this.$tTrendColumn, 0);
        }
        get g$j() {
            return this.g;
        }
        g$g(a) {
            this.g$h(a, null);
        }
        c(a) {
            return a == 1 || a == 2 || a == 3 || a == 4 || a == 5 || a == 6 || a == 7 || a == 8;
        }
        b(a) {
            return a == 9 || a == 10 || a == 11 || a == 12 || a == 13;
        }
        g$h(a, b) {
            this.g$j.an.clear();
            if (b != null) {
                b.i = this.g$j.an;
            }
            if (a != null) {
                for (let c of fromEnum(a)) {
                    if (!isNaN_(c.x) && !isNaN_(c.y)) {
                        if (b != null) {
                            b.j(c);
                        }
                        else {
                            this.g$j.an.add(c);
                        }
                    }
                }
            }
            this.g$j.ab = this.g$j.an.count > 0;
        }
        e(a, b, c) {
            this.f(a, b, c, null);
        }
        f(a, b, c, d) {
            if (d != null) {
                d.i = c;
            }
            for (let e of fromEnum(Flattener.d(a.count, (f) => a.item(f).x, (f) => a.item(f).y, b.d))) {
                if (d != null) {
                    d.j(a.item(e));
                }
                else {
                    c.add(a.item(e));
                }
            }
        }
        g$c(a, b) {
            if (a == null || b == null) {
                return;
            }
            if (this.g$j.x != null) {
                this.g$f();
            }
            a.ab.add(this.g$j);
        }
        g$f() {
            if (this.g$j == null) {
                return;
            }
            let a = typeCast(Panel.$, this.g$j.x);
            if (a != null) {
                a.ab.remove(this.g$j);
            }
        }
        g$d() {
            this.g$j.an.clear();
        }
        g$i() {
            this.a = null;
            this.d.clear();
        }
        g$e(a, b, c, d) {
            switch (a) {
                case 3:
                case 2:
                case 1:
                case 0:
                case 4:
                    this.g$i();
                    break;
            }
        }
        g$b(a, b, c, d) {
            let e = false;
            switch (b) {
                case "TrendLineType":
                case "TrendLinePeriod":
                    this.g$i();
                    e = true;
                    break;
                case "TrendLineThickness":
                    e = true;
                    break;
                case Series.$$p[12]:
                    e = true;
                    this.g$i();
                    break;
            }
            return e;
        }
    }
    TrendLineManagerBase$1.$t = /*@__PURE__*/ markType(TrendLineManagerBase$1, 'TrendLineManagerBase$1', Base.$, [ITrendLineManager_$type]);
    return TrendLineManagerBase$1;
})();
