/*
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 { Series } from "./Series";
import { IHasCategoryModePreference_$type } from "./IHasCategoryModePreference";
import { Axis } from "./Axis";
import { DependencyProperty } from "igniteui-angular-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { Point_$type, typeCast, Delegate_$type, markType, markDep } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { Thickness } from "igniteui-angular-core";
import { AxisAnnotationFrame } from "./AxisAnnotationFrame";
import { List$1 } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { SeriesView } from "./SeriesView";
import { NotImplementedException } from "igniteui-angular-core";
import { AxisRange } from "./AxisRange";
import { NumericAxisBase } from "./NumericAxisBase";
import { ScalerParams } from "./ScalerParams";
import { CategoryXAxis } from "./CategoryXAxis";
import { AxisAnnotationFrameManager } from "./AxisAnnotationFrameManager";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_, isInfinity } from "igniteui-angular-core";
import { stringFormat } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
/**
 * @hidden
 */
export class ValueOverlay extends Series {
    constructor() {
        super();
        this.mg = 0;
        this.mh = 0;
        this.md = 0;
        this.l1 = null;
        this.l7 = null;
        this.l6 = null;
        this.ab = ValueOverlay.$;
    }
    en(a, b, c) {
        return this.mi;
    }
    me(a, b) {
        let c = Math.sqrt(Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2));
        let d = Math.acos((a.x - b.x) / c);
        if ((a.y - b.y) < 0) {
            d = (2 * Math.PI) - d;
        }
        return d;
    }
    ll(a, b, c) {
        if (this.l0 == null) {
            return { $type: Point_$type, x: NaN, y: NaN };
        }
        let d = this.mf();
        let e = NaN;
        let f = NaN;
        let g = NaN;
        let h = { $type: Point_$type, x: 0.5, y: 0.5 };
        let i = NaN;
        switch (this.l0.az) {
            case 2:
                i = Math.sqrt(Math.pow(a.x - h.x, 2) + Math.pow(a.y - h.y, 2));
                g = d;
                e = h.x + Math.cos(g) * i;
                f = h.y + Math.sin(g) * i;
                f = this.bi.br.top + this.bi.br.height * (f - this.bi.bs.top) / this.bi.bs.height;
                e = this.bi.br.left + this.bi.br.width * (e - this.bi.bs.left) / this.bi.bs.width;
                break;
            case 0:
                e = d;
                f = a.y;
                f = this.bi.br.top + this.bi.br.height * (f - this.bi.bs.top) / this.bi.bs.height;
                break;
            case 1:
                f = d;
                e = a.x;
                e = this.bi.br.left + this.bi.br.width * (e - this.bi.bs.left) / this.bi.bs.width;
                break;
            case 3:
                g = this.me(a, h);
                i = d;
                e = h.x + Math.cos(g) * i;
                f = h.y + Math.sin(g) * i;
                f = this.bi.br.top + this.bi.br.height * (f - this.bi.bs.top) / this.bi.bs.height;
                e = this.bi.br.left + this.bi.br.width * (e - this.bi.bs.left) / this.bi.bs.width;
                break;
        }
        return { $type: Point_$type, x: e, y: f };
    }
    e8(a) {
        throw new NotImplementedException(0);
    }
    fp(a) {
        return this;
    }
    c9(a) {
        return false;
    }
    an(a) {
        let b = typeCast(NumericAxisBase.$, a);
        let c = this.mi;
        if (isNaN_(c) || isInfinity(c)) {
            return null;
        }
        return new AxisRange(c, c);
    }
    je(a) {
        this.hv(true, this.bi);
        if (!this.l5()) {
            return;
        }
        if (this.da(a)) {
            if (this.ca()) {
                if (this.bt.g) {
                    this.bt.t();
                }
                let b = this.mg;
                this.mg = this.mh;
                this.mh = b;
            }
            else {
                this.mg = this.md;
            }
            this.md = this.mf();
            this.jl();
        }
        else {
            this.md = this.mf();
            this.mz(this.md, this.l3);
        }
    }
    mf() {
        let a, b;
        let c = this.getViewInfo(b, a);
        b = c.p0;
        a = c.p1;
        let d = this.getEffectiveViewport1(this.bi);
        let e = new ScalerParams(0, a, b, this.l0.b8, d);
        return this.l0.dw(this.mi, e);
    }
    mz(a, b) {
        if (this.l0 == null) {
            return;
        }
        let c = typeCast(CategoryAxisBase.$, this.l0);
        if (c != null && !c.b5) {
            if (this.mi > c.jz - 1) {
                return;
            }
            if (c.categoryMode == 2) {
                let d = this.getEffectiveViewport1(b);
                let e = 0.5 * c.getCategorySize(b.bs, b.br, d);
                let f = false;
                if (c.cf && !c.b8) {
                    f = true;
                }
                if (typeCast(CategoryXAxis.$, c) !== null && c.b8) {
                    f = true;
                }
                if (f) {
                    e = -e;
                }
                a += e;
            }
        }
        let g = typeCast(NumericAxisBase.$, this.l0);
        if (g != null) {
            if (this.mi < g.j4 || this.mi > g.j3) {
                return;
            }
            if (g.ju && this.mi < 0) {
                return;
            }
        }
        let h;
        switch (this.l0.az) {
            case 2:
            case 3:
                h = this.l0.it(a, b.bs, b.br, this.getEffectiveViewport1(b), this.lq(b));
                break;
            default:
                h = this.l0.it(a, b.bs, b.br);
                break;
        }
        if (h != null) {
            b.bv(h);
        }
        if (this.l4) {
            this.m0(a, this.ca());
        }
    }
    dw(a, b, c) {
        let d = true;
        d = super.dw(a, b, c);
        if (!c.l() || b.isEmpty || a.isEmpty || this.l0 == null || this.l0.bf == null) {
            d = false;
        }
        return d;
    }
    jt(a, b) {
        this.jd(false);
    }
    js(a, b) {
        this.jd(false);
    }
    hy(a, b, c, d) {
        throw new NotImplementedException(0);
    }
    iz(a, b, c, d) {
        super.iz(a, b, c, d);
        switch (b) {
            case ValueOverlay.$$p[10]:
                if (c != null) {
                    c.bv(this);
                }
                if (d != null) {
                    d.ci(this);
                }
                this.jd(false);
                this.ik();
                break;
            case "TransitionProgress":
                this.mh = this.mg + this.ez * (this.md - this.mg);
                if (this.cc(this.bi)) {
                    return;
                }
                if (this.ez == 1) {
                    this.mz(this.md, this.l3);
                }
                else {
                    this.mz(this.mh, this.l3);
                }
                if (this.bs != null) {
                    this.bs.jj(this);
                }
                break;
            case ValueOverlay.$$p[12]:
                let e = typeCast(NumericAxisBase.$, this.l0);
                if (e != null) {
                    e.cl();
                }
                this.jd(true);
                this.il();
                break;
            case ValueOverlay.$$p[11]:
            case ValueOverlay.$$p[9]:
            case ValueOverlay.$$p[0]:
            case ValueOverlay.$$p[2]:
            case ValueOverlay.$$p[3]:
            case ValueOverlay.$$p[8]:
            case ValueOverlay.$$p[4]:
            case ValueOverlay.$$p[5]:
            case ValueOverlay.$$p[6]:
            case ValueOverlay.$$p[7]:
                this.jd(true);
                break;
        }
    }
    ib() {
        super.ib();
        if (this.l0 != null) {
            this.l0.g6(false);
        }
    }
    hv(a, b) {
        super.hv(a, b);
        let c = b;
        c.bu();
    }
    l5() {
        if (this.l0 == null || this.l0.bf == null || isNaN_(this.mi) || this._visibility == 1) {
            return false;
        }
        let a = typeCast(CategoryAxisBase.$, this.l0);
        if (a != null && a.jz == 0) {
            return false;
        }
        return true;
    }
    preferredCategoryMode(a) {
        return 0;
    }
    get categoryAxis() {
        return typeCast(CategoryAxisBase.$, this.l0);
    }
    bf() {
        return new ValueOverlayView(this);
    }
    iu(a) {
        super.iu(a);
        this.l3 = typeCast(ValueOverlayView.$, a);
    }
    jf(a, b) {
        super.jf(a, b);
        if (!this.dl) {
            this.bi.az(b);
            return;
        }
        this.bi.az(b);
        if (this.cc(this.bh) || !this.l5()) {
            return;
        }
        let c = this.getEffectiveViewport1(this.bi);
        let d = this.l0.dw(this.mi, new ScalerParams(0, this.bh.bs, a, this.l0.b8, c));
        this.mz(d, typeCast(ValueOverlayView.$, this.bh));
        this.dl = false;
    }
    getOffsetValue() {
        return 0;
    }
    getCategoryWidth() {
        return 0;
    }
    get nh() {
        return new Thickness(1, this.l9, this.mb, this.ma, this.l8);
    }
    ag() {
        return [this.l0];
    }
    m0(a, b) {
        if (isNaN_(a)) {
            return;
        }
        let c = false;
        if (this.l6 == null) {
            c = true;
            this.l7 = new List$1(Axis.$, 0);
            this.l6 = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
        }
        this.l1 = new AxisAnnotationFrame();
        let d = this.k3;
        if (d == null) {
            d = this.k5;
        }
        let e = this.l0.cf;
        AxisAnnotationFrameManager.c(this.l1, { $type: Point_$type, x: a, y: a }, this, this.bs, this.getEffectiveViewport(), d, this.ne, this.ng, this.nf, this.nh, this.mc, this.ne, this.ng, this.nf, this.nh, this.mc, !this.l0.cf, this.l0.cf);
        AxisAnnotationFrameManager.d(this, this.l1, c, this.l6, this.l7, b, this.mj, this.mj, this.l2, this.l2);
    }
    get_c6() {
        return true;
    }
    mv(a) {
        if (this.l0 != null) {
            return this.l0.fj(a);
        }
        return null;
    }
    get mx() {
        let a = this.mv(this.mi);
        return a != null ? a : stringFormat("{0:0.##}", this.mi);
    }
}
ValueOverlay.$t = markType(ValueOverlay, 'ValueOverlay', Series.$, [IHasCategoryModePreference_$type]);
ValueOverlay.$$p = markDep(DependencyProperty, PropertyMetadata, ValueOverlay, 'raisePropertyChanged', ['AxisAnnotationBackground:ne:m1', [Brush.$, null], 'AxisAnnotationFormatLabel:l2:m2', [Delegate_$type], 'AxisAnnotationInterpolatedValuePrecision:mj:m3', [1, -1], 'AxisAnnotationOutline:nf:m4', [Brush.$, null], 'AxisAnnotationPaddingBottom:l8:m5', [1, NaN], 'AxisAnnotationPaddingLeft:l9:m6', [1, NaN], 'AxisAnnotationPaddingRight:ma:m7', [1, NaN], 'AxisAnnotationPaddingTop:mb:m8', [1, NaN], 'AxisAnnotationStrokeThickness:mc:m9', [1, NaN], 'AxisAnnotationTextColor:ng:na', [Brush.$, null], 'Axis:l0:nb', [Axis.$, null], 'IsAxisAnnotationEnabled:l4:nc', [0, false], 'Value:mi:nd', [1, 0]]);
/**
 * @hidden
 */
export class ValueOverlayView extends SeriesView {
    constructor(a) {
        super(a);
        this.bw = null;
        this.bw = new Path();
    }
    a8() {
        super.a8();
        this.bw._stroke = this.e.k3;
        this.bw.ac = this.e.ey;
        this.bw.ai = this.e.lb;
        this.bw.ad = this.e.lc;
    }
    a9() {
        super.a9();
        let a = this.bl();
        this.bw._stroke = a;
        this.bw.ac = this.e.ey + 3;
        this.bw._stroke = a;
        this.bw.ac = this.e.ey + 3;
    }
    bv(a) {
        this.bw.ak = a;
        this.an();
    }
    bu() {
        this.bw.ak = null;
        this.an();
    }
    a3(a, b) {
        super.a3(a, b);
        if (a.d) {
            a.s(this.bw);
        }
    }
    ai(a) {
        super.ai(a);
        this.e.a2.exportPathData(a, this.bw, "ValueOverlayPath", []);
    }
}
ValueOverlayView.$t = markType(ValueOverlayView, 'ValueOverlayView', SeriesView.$);
//# sourceMappingURL=ValueOverlay_combined.js.map