/*
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-react-core";
import { CategoryAxisBase } from "./CategoryAxisBase";
import { Point_$type, typeCast, Delegate_$type, markType, markDep } from "igniteui-react-core";
import { Brush } from "igniteui-react-core";
import { Thickness } from "igniteui-react-core";
import { AxisAnnotationFrame } from "./AxisAnnotationFrame";
import { List$1 } from "igniteui-react-core";
import { Dictionary$2 } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { AxisAnnotation } from "./AxisAnnotation";
import { SeriesView } from "./SeriesView";
import { NotImplementedException } from "igniteui-react-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-react-core";
import { isNaN_, isInfinity } from "igniteui-react-core";
import { stringFormat } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
/**
 * @hidden
 */
export let ValueOverlay = /*@__PURE__*/ (() => {
    class ValueOverlay extends Series {
        constructor() {
            super();
            this.op = 0;
            this.oq = 0;
            this.om = 0;
            this.oa = null;
            this.og = null;
            this.of = null;
            this.ab = ValueOverlay.$;
        }
        fh(a, b, c) {
            return this.or;
        }
        on(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;
        }
        nt(a, b, c) {
            if (this.n9 == null) {
                return { $type: Point_$type, x: NaN, y: NaN };
            }
            let d = this.oo();
            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.n9.a1) {
                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.bs.bu.top + this.bs.bu.height * (f - this.bs.bv.top) / this.bs.bv.height;
                    e = this.bs.bu.left + this.bs.bu.width * (e - this.bs.bv.left) / this.bs.bv.width;
                    break;
                case 0:
                    e = d;
                    f = a.y;
                    f = this.bs.bu.top + this.bs.bu.height * (f - this.bs.bv.top) / this.bs.bv.height;
                    break;
                case 1:
                    f = d;
                    e = a.x;
                    e = this.bs.bu.left + this.bs.bu.width * (e - this.bs.bv.left) / this.bs.bv.width;
                    break;
                case 3:
                    g = this.on(a, h);
                    i = d;
                    e = h.x + Math.cos(g) * i;
                    f = h.y + Math.sin(g) * i;
                    f = this.bs.bu.top + this.bs.bu.height * (f - this.bs.bv.top) / this.bs.bv.height;
                    e = this.bs.bu.left + this.bs.bu.width * (e - this.bs.bv.left) / this.bs.bv.width;
                    break;
            }
            return { $type: Point_$type, x: e, y: f };
        }
        f9(a) {
            throw new NotImplementedException(0);
        }
        gq(a) {
            return this;
        }
        dq(a) {
            return false;
        }
        ao(a) {
            let b = typeCast(NumericAxisBase.$, a);
            let c = this.or;
            if (isNaN_(c) || isInfinity(c)) {
                return null;
            }
            return new AxisRange(c, c);
        }
        k4(a) {
            this.jl(true, this.bs);
            if (!this.oe()) {
                if (this.oa != null) {
                    this.o9(NaN, this.cn());
                }
                return;
            }
            if (this.dr(a)) {
                if (this.cn()) {
                    if (this.b7.g) {
                        this.b7.t();
                    }
                    let b = this.op;
                    this.op = this.oq;
                    this.oq = b;
                }
                else {
                    this.op = this.om;
                }
                this.om = this.oo();
                this.lb();
            }
            else {
                this.om = this.oo();
                this.o8(this.om, this.oc);
            }
        }
        oo() {
            let a, b;
            let c = this.getViewInfo(b, a);
            b = c.p0;
            a = c.p1;
            let d = this.getEffectiveViewport1(this.bs);
            let e = new ScalerParams(0, a, b, this.n9.ca, d);
            return this.n9.dz(this.or, e);
        }
        o8(a, b) {
            if (this.n9 == null) {
                return;
            }
            let c = typeCast(CategoryAxisBase.$, this.n9);
            if (c != null && !c.b7) {
                if (this.or > c.j9 - 1) {
                    return;
                }
                if (c.categoryMode == 2) {
                    let d = this.getEffectiveViewport1(b);
                    let e = 0.5 * c.getCategorySize(b.bv, b.bu, d);
                    let f = false;
                    if (c.ch && !c.ca) {
                        f = true;
                    }
                    if (typeCast(CategoryXAxis.$, c) !== null && c.ca) {
                        f = true;
                    }
                    if (f) {
                        e = -e;
                    }
                    a += e;
                }
            }
            let g = typeCast(NumericAxisBase.$, this.n9);
            if (g != null) {
                if (this.or < g.kd || this.or > g.kc) {
                    return;
                }
                if (g.j3 && this.or < 0) {
                    return;
                }
            }
            let h;
            switch (this.n9.a1) {
                case 2:
                case 3:
                    h = this.n9.i2(a, b.bv, b.bu, this.getEffectiveViewport1(b), this.ny(b));
                    break;
                default:
                    h = this.n9.i2(a, b.bv, b.bu);
                    break;
            }
            if (h != null) {
                b.by(h);
            }
            this.o9(a, this.cn());
        }
        ec(a, b, c) {
            let d = true;
            d = super.ec(a, b, c);
            if (!c.o() || b.isEmpty || a.isEmpty || this.n9 == null || this.n9.bh == null) {
                d = false;
            }
            return d;
        }
        lo(a, b) {
            this.k3(false);
        }
        ln(a, b) {
            this.k3(false);
        }
        jo(a, b, c, d) {
            throw new NotImplementedException(0);
        }
        kp(a, b, c, d) {
            super.kp(a, b, c, d);
            switch (b) {
                case ValueOverlay.$$p[10]:
                    if (c != null) {
                        c.bx(this);
                    }
                    if (d != null) {
                        d.ck(this);
                    }
                    this.k3(false);
                    this.ka();
                    break;
                case "TransitionProgress":
                    this.oq = this.op + this.fw * (this.om - this.op);
                    if (this.cp(this.bs)) {
                        return;
                    }
                    if (this.fw == 1) {
                        this.o8(this.om, this.oc);
                    }
                    else {
                        this.o8(this.oq, this.oc);
                    }
                    if (this.b6 != null) {
                        this.b6.k7(this);
                    }
                    break;
                case ValueOverlay.$$p[12]:
                    let e = typeCast(NumericAxisBase.$, this.n9);
                    if (e != null) {
                        e.cn();
                    }
                    this.k3(true);
                    this.kb();
                    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.k3(true);
                    break;
            }
        }
        j2() {
            super.j2();
            if (this.n9 != null) {
                this.n9.hc(false);
            }
        }
        jl(a, b) {
            super.jl(a, b);
            let c = b;
            c.bx();
        }
        oe() {
            if (this.n9 == null || this.n9.bh == null || isNaN_(this.or) || this._visibility == 1) {
                return false;
            }
            let a = typeCast(CategoryAxisBase.$, this.n9);
            if (a != null && a.j9 == 0) {
                return false;
            }
            return true;
        }
        preferredCategoryMode(a) {
            return 0;
        }
        get categoryAxis() {
            return typeCast(CategoryAxisBase.$, this.n9);
        }
        bp() {
            return new ValueOverlayView(this);
        }
        kk(a) {
            super.kk(a);
            this.oc = typeCast(ValueOverlayView.$, a);
        }
        k5(a, b) {
            super.k5(a, b);
            if (!this.d2) {
                this.bs.a2(b);
                return;
            }
            this.bs.a2(b);
            if (this.cp(this.br) || !this.oe()) {
                return;
            }
            let c = this.getEffectiveViewport1(this.bs);
            let d = this.n9.dz(this.or, new ScalerParams(0, this.br.bv, a, this.n9.ca, c));
            this.o8(d, typeCast(ValueOverlayView.$, this.br));
            this.d2 = false;
        }
        getOffsetValue() {
            return 0;
        }
        getCategoryWidth() {
            return 0;
        }
        get pq() {
            return new Thickness(1, this.oi, this.ok, this.oj, this.oh);
        }
        ag() {
            return [this.n9];
        }
        o9(a, b) {
            if (isNaN_(a)) {
                if (this.oa != null) {
                    AxisAnnotationFrameManager.b(this.oa);
                    AxisAnnotationFrameManager.d(this, this.oa, true, this.of, this.og, b, this.os, this.os, this.ob, this.ob);
                }
                return;
            }
            let c = false;
            if (this.of == null) {
                c = true;
                this.og = new List$1(Axis.$, 0);
                this.of = new Dictionary$2(Axis.$, Pool$1.$.specialize(AxisAnnotation.$), 0);
            }
            this.oa = new AxisAnnotationFrame();
            let d = this.m9;
            if (d == null) {
                d = this.nb;
            }
            let e = this.n9.ch;
            AxisAnnotationFrameManager.c(this.oa, { $type: Point_$type, x: a, y: a }, this, this.b6, this.getEffectiveViewport(), d, this.pn, this.pp, this.po, this.pq, this.ol, this.pn, this.pp, this.po, this.pq, this.ol, !e && this.od, e && this.od);
            AxisAnnotationFrameManager.d(this, this.oa, c, this.of, this.og, b, this.os, this.os, this.ob, this.ob);
        }
        get_dm() {
            return true;
        }
        o4(a) {
            if (this.n9 != null) {
                return this.n9.fm(a);
            }
            return null;
        }
        get o6() {
            let a = this.o4(this.or);
            return a != null ? a : stringFormat("{0:0.##}", this.or);
        }
    }
    ValueOverlay.$t = /*@__PURE__*/ markType(ValueOverlay, 'ValueOverlay', Series.$, [IHasCategoryModePreference_$type]);
    ValueOverlay.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, ValueOverlay, 'raisePropertyChanged', ['AxisAnnotationBackground:pn:pa', [Brush.$, null], 'AxisAnnotationFormatLabel:ob:pb', [Delegate_$type], 'AxisAnnotationInterpolatedValuePrecision:os:pc', [1, -1], 'AxisAnnotationOutline:po:pd', [Brush.$, null], 'AxisAnnotationPaddingBottom:oh:pe', [1, NaN], 'AxisAnnotationPaddingLeft:oi:pf', [1, NaN], 'AxisAnnotationPaddingRight:oj:pg', [1, NaN], 'AxisAnnotationPaddingTop:ok:ph', [1, NaN], 'AxisAnnotationStrokeThickness:ol:pi', [1, NaN], 'AxisAnnotationTextColor:pp:pj', [Brush.$, null], 'Axis:n9:pk', [Axis.$, null], 'IsAxisAnnotationEnabled:od:pl', [0, false], 'Value:or:pm', [1, 0]]);
    return ValueOverlay;
})();
/**
 * @hidden
 */
export let ValueOverlayView = /*@__PURE__*/ (() => {
    class ValueOverlayView extends SeriesView {
        constructor(a) {
            super(a);
            this.bz = null;
            this.bz = new Path();
        }
        bb() {
            super.bb();
            this.bz._stroke = this.e.m9;
            this.bz.ac = this.e.eu;
            this.bz.ai = this.e.nj;
            this.bz.ad = this.e.nk;
        }
        bc() {
            super.bc();
            let a = this.bo();
            this.bz._stroke = a;
            this.bz.ac = this.e.eu + 3;
            this.bz._stroke = a;
            this.bz.ac = this.e.eu + 3;
        }
        by(a) {
            this.bz.ak = a;
            this.aq();
        }
        bx() {
            this.bz.ak = null;
            this.aq();
        }
        a6(a, b) {
            super.a6(a, b);
            if (a.d) {
                a.s(this.bz);
            }
        }
        al(a) {
            super.al(a);
            this.e.a5.exportPathData(a, this.bz, "ValueOverlayPath", []);
        }
    }
    ValueOverlayView.$t = /*@__PURE__*/ markType(ValueOverlayView, 'ValueOverlayView', SeriesView.$);
    return ValueOverlayView;
})();
//# sourceMappingURL=ValueOverlay_combined.js.map
