/*
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 { SeriesRenderManager } from "./SeriesRenderManager";
import { AssigningCategoryMarkerStyleEventArgs } from "./AssigningCategoryMarkerStyleEventArgs";
import { AssigningCategoryStyleEventArgs } from "./AssigningCategoryStyleEventArgs";
import { markType } from "igniteui-react-core";
import { truncate } from "igniteui-react-core";
/**
 * @hidden
 */
export let CategorySeriesRenderManager = /*@__PURE__*/ (() => {
    class CategorySeriesRenderManager extends SeriesRenderManager {
        constructor() {
            super(...arguments);
            this.az = 0;
            this.a0 = 0;
            this.ax = null;
            this.ay = null;
        }
        c() {
            this.ax = new AssigningCategoryMarkerStyleEventArgs();
            return this.ax;
        }
        a() {
            this.ay = new AssigningCategoryStyleEventArgs();
            return this.ay;
        }
        a1(a, b, c, d, e) {
            this.az = d;
            this.a0 = e;
            this.w(a, b, c);
        }
        a2(a, b, c, d, e) {
            this.az = d;
            this.a0 = e;
            this.x(a, b, c);
        }
        aw(a, b) {
            let c = this.az;
            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.a0 * c, a - 1);
            f[1] = Math.min(e + this.a0 * c, a - 1);
            return f;
        }
        a3(a, b, c, d, e, f, g, h, i) {
            if (d == -1) {
                if (b) {
                    a.c = true;
                    a.h = f.f2();
                    a.g = f.f1();
                }
                else {
                    a.c = false;
                    a.o = 0;
                    a.n = e - 1;
                }
            }
            else {
                if (b) {
                    let longStart_ = truncate(f.em(c._inner[d][0], g));
                    let longEnd_ = longStart_;
                    if (d + 1 < c.count) {
                        longEnd_ = truncate(f.em(c._inner[d + 1][0], g));
                    }
                    a.c = true;
                    a.h = (new Date(longStart_));
                    a.g = (new Date(longEnd_));
                    if (f.ch) {
                        let j = a.g;
                        a.g = a.h;
                        a.h = j;
                    }
                    if (i) {
                        a.o = d;
                        a.n = d;
                    }
                    else {
                        let k = this.aw(e, d);
                        a.o = k[0];
                        a.n = k[1];
                    }
                }
                else {
                    if (i) {
                        a.o = d;
                        a.n = d;
                    }
                    else {
                        let l = this.aw(e, d);
                        a.c = false;
                        a.o = l[0];
                        a.n = l[1];
                    }
                }
            }
        }
    }
    CategorySeriesRenderManager.$t = /*@__PURE__*/ markType(CategorySeriesRenderManager, 'CategorySeriesRenderManager', SeriesRenderManager.$);
    return CategorySeriesRenderManager;
})();
