/*
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 { AssigningCategoryStyleEventArgs } from "./AssigningCategoryStyleEventArgs";
import { AssigningCategoryMarkerStyleEventArgs } from "./AssigningCategoryMarkerStyleEventArgs";
import { DeviceUtils } from "igniteui-react-core/ES2015/DeviceUtils";
import { Base, markType } from "igniteui-react-core/ES2015/type";
import { truncate } from "igniteui-react-core/ES2015/number";
export class CategorySeriesRenderManager extends Base {
    constructor() {
        super(...arguments);
        this.ah = null;
        this.ai = null;
        this.l = 0;
        this.an = null;
        this.ap = 0;
        this.j = 0;
        this.k = 0;
        this.i = 0;
        this.h = 0;
        this.ar = 0;
        this.aq = 0;
        this.al = null;
        this.am = null;
        this.r = 0;
        this.ao = null;
        this.as = 0;
        this.p = 0;
        this.q = 0;
        this.o = 0;
        this.n = 0;
        this.au = 0;
        this.at = 0;
        this.aj = null;
        this.ak = null;
        this.m = 0;
        this.f = false;
        this.e = false;
        this.af = null;
        this.ag = null;
        this.g = 0;
        this.c = null;
        this.b = null;
        this.d = null;
        this.s = 0;
        this.t = 0;
    }
    w(a, b, c, d, e) {
        this.s = d;
        this.t = e;
        this.e = false;
        this.aj = a.mj;
        this.ak = a.mk;
        this.m = 1;
        this.af = this.aj;
        this.ag = this.ak;
        this.g = this.m;
        let f = b;
        this.b = null;
        if (f) {
            this.b = new AssigningCategoryMarkerStyleEventArgs();
            this.b.i = 0;
            this.b.k = 0;
            if (a.bs != null && a.b9) {
                this.b.i = a.bs.az.maxMarkerHighlightingProgress;
                this.b.k = a.bs.az.sumMarkerHighlightingProgress;
            }
            this.b.a = c;
        }
    }
    x(a, b, c, d, e, f) {
        this.s = e;
        this.t = f;
        this.f = false;
        this.al = a.kr;
        this.am = a.ks;
        this.r = a.es;
        this.ao = a.kz;
        this.as = a.k0;
        this.p = 0;
        this.q = 0;
        this.o = 1;
        this.n = a.em;
        this.au = a.k2;
        this.at = a.k1;
        this.ah = this.al;
        this.ai = this.am;
        this.l = this.r;
        this.an = this.ao;
        this.ap = this.as;
        this.j = this.p;
        this.k = this.q;
        this.i = this.o;
        this.h = this.n;
        this.ar = this.au;
        this.aq = this.at;
        this.d = c;
        let g = b;
        this.c = null;
        if (g) {
            this.c = new AssigningCategoryStyleEventArgs();
            this.c.i = 0;
            this.c.k = 0;
            if (a.bs != null && a.b9) {
                this.c.i = a.bs.az.maxHighlightingProgress;
                this.c.k = a.bs.az.sumHighlightingProgress;
            }
            this.c.a = d;
        }
    }
    ae(a, b, c, d, e) {
        let f = this.ah;
        if (e) {
            f = this.ai;
        }
        if (c) {
            a._fill = f;
        }
        else {
            if (b) {
                a._stroke = f;
            }
            else {
                a._fill = f;
                a._stroke = this.ai;
            }
            a.ac = this.l;
            a.ai = this.an;
            a.ad = this.ap;
            if (d) {
            }
        }
        a._opacity = this.i;
    }
    ad(a, b) {
        a._opacity = this.g;
        b.itemBrush = this.af;
        b.actualItemBrush = b.itemBrush;
        b.outline = this.ag;
        b.thickness = DeviceUtils.g(2);
    }
    a(a, b) {
        let c = this.s;
        let d = Math.min(b * c, a - 1);
        let e = Math.min(d + c - 1, a - 1);
        let f = new Array(2);
        f[0] = Math.min(d + this.t * c, a - 1);
        f[1] = Math.min(e + this.t * c, a - 1);
        return f;
    }
    u(a) {
        if (a == null) {
            return;
        }
        if (a.b == null) {
            return;
        }
        this.ah = a.b.a0.a$ai(a.b, a, this.ah);
        this.ai = a.b.a0.a$ai(a.b, a, this.ai);
    }
    v(a) {
        if (a == null) {
            return;
        }
        if (a.b == null) {
            return;
        }
        this.af = a.b.a0.a$ai(a.b, a, this.af);
        this.ag = a.b.a0.a$ai(a.b, a, this.ag);
    }
    y(a, b, c, d, e, f, g, h, i) {
        if (d == -1) {
            if (b) {
                a.c = true;
                a.h = f.e3();
                a.g = f.e2();
            }
            else {
                a.c = false;
                a.m = 0;
                a.l = e - 1;
            }
        }
        else {
            if (b) {
                let longStart_ = truncate(f.dw(c._inner[d][0], g));
                let longEnd_ = longStart_;
                if (d + 1 < c.count) {
                    longEnd_ = truncate(f.dw(c._inner[d + 1][0], g));
                }
                a.c = true;
                a.h = (new Date(longStart_));
                a.g = (new Date(longEnd_));
                if (f.b8) {
                    let j = a.g;
                    a.g = a.h;
                    a.h = j;
                }
                if (i) {
                    a.m = d;
                    a.l = d;
                }
                else {
                    let k = this.a(e, d);
                    a.m = k[0];
                    a.l = k[1];
                }
            }
            else {
                if (i) {
                    a.m = d;
                    a.l = d;
                }
                else {
                    let l = this.a(e, d);
                    a.c = false;
                    a.m = l[0];
                    a.l = l[1];
                }
            }
        }
    }
    ac(a, b, c, d, e, f, g) {
        this.ah = this.al;
        this.ai = this.am;
        this.l = this.r;
        this.an = this.ao;
        this.ap = this.as;
        this.j = this.p;
        this.k = this.q;
        this.i = this.o;
        let h = this.c;
        let i = d.cc;
        this.y(h, i, a, b, c, d, e, f, false);
        h.n = this.ah;
        h.o = this.ai;
        h.r = this.l;
        h.s = this.an;
        h.t = this.ap;
        h.p = this.j;
        h.q = this.k;
        h.j = this.i;
        h.e = this.f;
        h.d = false;
    }
    aa(a, b, c) {
        let d = this.c;
        this.ah = d.n;
        this.ai = d.o;
        this.l = d.r;
        this.an = d.s;
        this.ap = d.t;
        this.j = d.p;
        this.k = d.q;
        this.i = d.j;
        if (c && !d.d && !b) {
            this.u(a);
        }
    }
    ab(a, b, c, d, e, f, g) {
        this.af = this.aj;
        this.ag = this.ak;
        this.g = this.m;
        let h = this.b;
        let i = d.cc;
        this.y(h, i, a, b, c, d, e, f, true);
        h.n = this.af;
        h.o = this.ag;
        h.j = this.g;
        h.e = this.e;
        h.d = false;
    }
    z(a, b, c) {
        let d = this.b;
        this.af = d.n;
        this.ag = d.o;
        this.g = d.j;
        if (c && !d.d && !b) {
            this.v(a);
        }
    }
}
CategorySeriesRenderManager.$t = markType(CategorySeriesRenderManager, 'CategorySeriesRenderManager');
