/*
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 { HorizontalRangeCategorySeries } from "./HorizontalRangeCategorySeries";
import { Array_$type, typeCast, runOn, markType } from "igniteui-react-core/ES2015/type";
import { List$1 } from "igniteui-react-core/ES2015/List$1";
import { Polyline } from "igniteui-react-core/ES2015/Polyline";
import { Polygon } from "igniteui-react-core/ES2015/Polygon";
import { ScalerParams } from "./ScalerParams";
import { isNaN_ } from "igniteui-react-core/ES2015/number";
import { RangeCategorySeriesView } from "./RangeCategorySeriesView";
export class RangeAreaSeries extends HorizontalRangeCategorySeries {
    constructor() {
        super();
        this.ab = RangeAreaSeries.$;
    }
    bf() {
        return new RangeAreaSeriesView(this);
    }
    ii(a) {
        super.ii(a);
        this.o8 = a;
    }
    get_cj() {
        return true;
    }
    get cj() {
        return this.get_cj();
    }
    o9(a, b, c, d) {
        if (isNaN_(b.x) || isNaN_(b.y)) {
            return false;
        }
        if (isNaN_(c.x) || isNaN_(c.y)) {
            return false;
        }
        if ((a.y <= b.y && a.y >= c.y)) {
            return true;
        }
        return false;
    }
    de(a, b) {
        if (this.dd(a, b)) {
            return true;
        }
        if (this.ls(a, b)) {
            return true;
        }
        return false;
    }
    preferredCategoryMode(a) {
        return 0;
    }
    hl(a, b) {
        super.hl(a, b);
        let c = b;
        c.cx();
    }
    ob(a, b) {
        super.ob(a, b);
        let c = a.f.count;
        let d = new List$1(Array_$type, 2, c);
        for (let e = 0; e < c; e++) {
            let f = a.f._inner[e];
            let g = new Array(4);
            g[0] = f[0];
            g[1] = f[1];
            let h = a.f._inner[a.f.count - 1 - e];
            g[2] = h[0];
            g[3] = h[2];
            d.add(g);
        }
        let i = typeCast(RangeAreaSeriesView.$, b);
        let j = this.getEffectiveViewport1(i);
        this.m2.x(this, this.nn(), this.xAxis, runOn(this, this.mo), this.nv(b), this.nw(b));
        let k = false;
        let l = this.m2.c;
        if (l != null) {
            k = true;
        }
        if (k) {
            let m = new ScalerParams(0, b.bq, b.bp, this.xAxis.b8, j);
            this.n7(d, -1, this.lowColumn.count, this.xAxis, m, b.n);
        }
        let n = i.c5;
        let o = i.c7;
        let p = i.c1;
        this.m2.ae(n, true, false, true, true);
        this.m2.ae(o, true, false, true, true);
        this.m2.ae(p, false, true, false, false);
        if (b.cp(a)) {
            i.cy(a.f.count, d, false);
            b.cs(a);
        }
        i.c1._opacity = this.m2.i * this.d1;
    }
    get useHighMarkerFidelity() {
        return this.nq;
    }
}
RangeAreaSeries.$t = markType(RangeAreaSeries, 'RangeAreaSeries', HorizontalRangeCategorySeries.$);
export class RangeAreaSeriesView extends RangeCategorySeriesView {
    constructor(a) {
        super(a);
        this.cw = null;
        this.c4 = new Polyline();
        this.c0 = new Polygon();
        this.c6 = new Polyline();
        this.c3 = new Polyline();
        this.c2 = new Polyline();
        this.cz = new Polygon();
        this.cw = a;
    }
    ap() {
        super.ap();
        if (!this.n) {
            this.e.bj = 1;
        }
    }
    get c5() {
        return this.c4;
    }
    get c1() {
        return this.c0;
    }
    get c7() {
        return this.c6;
    }
    cx() {
        this.c0.aj.clear();
        this.c4.aj.clear();
        this.c6.aj.clear();
    }
    cy(a, b, c) {
        this.cv(this.c4, this.c0, this.c6, a, b, c);
        this.an();
    }
    a9() {
        super.a9();
        this.c2.aj = this.c4.aj;
        this.c3.aj = this.c6.aj;
        this.cz.aj = this.c0.aj;
        let a = this.bk();
        this.c2._stroke = a;
        this.c2.ac = this.e.es + 3;
        this.c3._stroke = a;
        this.c3.ac = this.e.es + 3;
        this.cz._fill = a;
        this.cz._opacity = 1;
    }
    a3(a, b) {
        super.a3(a, b);
        if (a.d) {
            if (b) {
                a.t(this.cz);
                a.u(this.c2);
                a.u(this.c3);
            }
            else {
                a.t(this.c0);
                a.u(this.c4);
                a.u(this.c6);
            }
        }
    }
    ai(a) {
        super.ai(a);
        this.e.a2.exportPolylineData(a, this.c4, "lowerShape", ["Lower"]);
        this.e.a2.exportPolylineData(a, this.c6, "upperShape", ["Upper", "Main"]);
        this.e.a2.exportPolygonData(a, this.c0, "fillShape", ["Fill"]);
    }
}
RangeAreaSeriesView.$t = markType(RangeAreaSeriesView, 'RangeAreaSeriesView', RangeCategorySeriesView.$);
