/*
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 { AnchoredRadialSeries } from "./AnchoredRadialSeries";
import { DependencyProperty } from "igniteui-react-core";
import { Defaults } from "./Defaults";
import { Point_$type, runOn, markType, markDep, fromEnum } from "igniteui-react-core";
import { Pool$1 } from "igniteui-react-core";
import { Path } from "igniteui-react-core";
import { List$1 } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { PathGeometry } from "igniteui-react-core";
import { PathFigure } from "igniteui-react-core";
import { PolyLineSegment } from "igniteui-react-core";
import { ViewportUtils } from "./ViewportUtils";
import { PropertyMetadata } from "igniteui-react-core";
import { isNaN_ } from "igniteui-react-core";
import { AnchoredRadialSeriesView } from "./AnchoredRadialSeriesView";
/**
 * @hidden
 */
export let RadialColumnSeries = /*@__PURE__*/ (() => {
    class RadialColumnSeries extends AnchoredRadialSeries {
        get_ed() {
            return true;
        }
        get_ey() {
            return true;
        }
        ip() {
            if (!isNaN_(this.io)) {
                return super.ip();
            }
            return Defaults.h;
        }
        cg() {
            return new RadialColumnSeriesView(this);
        }
        o0(a) {
            super.o0(a);
            this.x9 = a;
        }
        constructor() {
            super();
            this.ab = RadialColumnSeries.$;
        }
        ac() {
            super.ac();
            this.pp(false);
        }
        o8(a, b, c, d) {
            super.o8(a, b, c, d);
            switch (b) {
                case RadialColumnSeries.$$p[0]:
                case RadialColumnSeries.$$p[1]:
                    this.o2();
                    break;
            }
        }
        preferredCategoryMode(a) {
            return a != null && a == this.vi ? 2 : 0;
        }
        nj(a, b) {
            super.nj(a, b);
            let c = b;
            if (a) {
                c.c4.count = 0;
            }
        }
        get_du() {
            return true;
        }
        h0() {
            return this.vi.k4(this.cj.by, this.cj.bx, this.getEffectiveViewport1(this.cj));
        }
        wo(a, b) {
            super.wo(a, b);
            let c = a.f;
            let d = b.by;
            let e = b.bx;
            let f = this.getEffectiveViewport1(b);
            let g = this.to(b);
            let h = this.vp.k1(e, d, f, g);
            let i = b;
            let j = this.vp;
            let k = Math.max(0, 0.5 * j.nn);
            k = Math.max(k, h.minLength * 0.9);
            let l = ViewportUtils.d(k, d, e);
            let m = this.vi.k4(d, e, f);
            let n = Math.max(0.1 * this.vp.no, k);
            let o = this.vq.d(0, n, d, e);
            let p = this.vq.e(0, n, d, e);
            let q = this.vq.d(m, n, d, e);
            let r = this.vq.e(m, n, d, e);
            let s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
            let t = { $type: Point_$type, x: ViewportUtils.c(0.5, d, e), y: ViewportUtils.f(0.5, d, e) };
            let u = this.w2.count;
            this.vw.a2(this, this.v8(), runOn(this, this.vf), this.wb(b), this.wc(b));
            this.vw.r = this.ya;
            this.vw.s = this.yb;
            this.vw.k = this.ya;
            this.vw.l = this.yb;
            let v = false;
            let w = this.vw.b;
            if (w != null) {
                v = true;
            }
            let x = this.vi;
            let y = new ScalerParams(1, b.by, b.bx, x.ch);
            y.c = this.getEffectiveViewport();
            for (let z = 0; z < c.count; ++z) {
                let aa = Math.min(a.f._inner[z][2], h.maxLength * 1.1);
                let ab = this.vq.d(a.f._inner[z][0], aa, d, e);
                let ac = this.vq.e(a.f._inner[z][0], aa, d, e);
                let ad = Math.sqrt((ab - t.x) * (ab - t.x) + (ac - t.y) * (ac - t.y));
                let ae = ad;
                let af = l;
                if (v) {
                    this.xq(c, z, u, x, y, b.q);
                }
                let ag = this.vw.k;
                let ah = this.vw.l;
                let ai = a.f._inner[z][0] - (Math.PI / 2);
                let aj = i.c4.item(z);
                let ak = 0 - (s / 2);
                let al = (s / 2);
                let am = Math.max(af, ae);
                let an = Math.min(af, ae);
                let ao = Math.cos(ai);
                let ap = Math.sin(ai);
                let aq = { $type: Point_$type, x: t.x + (ak * ao - am * ap), y: t.y + (ak * ap + am * ao) };
                let ar = { $type: Point_$type, x: t.x + (al * ao - am * ap), y: t.y + (al * ap + am * ao) };
                let as = { $type: Point_$type, x: t.x + (al * ao - an * ap), y: t.y + (al * ap + an * ao) };
                let at = { $type: Point_$type, x: t.x + (ak * ao - an * ap), y: t.y + (ak * ap + an * ao) };
                let au = new PathGeometry();
                let av = new PathFigure();
                av._startPoint = aq;
                av._isClosed = true;
                let aw = new PolyLineSegment();
                aw._points.add(ar);
                aw._points.add(as);
                aw._points.add(at);
                av._segments.add(aw);
                au.c.add(av);
                aj.an = au;
                this.vw.ad(aj, false, false, false, false);
            }
            i.c4.count = c.count;
            this.x9.c9();
        }
    }
    RadialColumnSeries.$t = /*@__PURE__*/ markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
    RadialColumnSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:ya:ye', [1, 0], 'RadiusY:yb:yf', [1, 0]]);
    return RadialColumnSeries;
})();
/**
 * @hidden
 */
export let RadialColumnSeriesView = /*@__PURE__*/ (() => {
    class RadialColumnSeriesView extends AnchoredRadialSeriesView {
        constructor(a) {
            super(a);
            this.c3 = null;
            this.c4 = null;
            this.c5 = null;
            this.db = new Path();
            this.c3 = a;
            this.c4 = ((() => {
                let $ret = new Pool$1(Path.$);
                $ret.create = runOn(this, this.dc);
                $ret.activate = runOn(this, this.c6);
                $ret.disactivate = runOn(this, this.c8);
                $ret.destroy = runOn(this, this.c7);
                return $ret;
            })());
        }
        au() {
            super.au();
            this.c5 = new List$1(Path.$, 0);
            if (!this.q) {
                this.cu.ua = Defaults.c;
                this.cu.iu = Defaults.i;
            }
        }
        dc() {
            let a = new Path();
            this.c5.add(a);
            a._visibility = 1;
            return a;
        }
        c6(a) {
            a._visibility = 0;
        }
        c8(a) {
            a._visibility = 1;
        }
        c7(a) {
            this.c5.remove(a);
        }
        da(a, b, c, d, e, f) {
            this.as();
        }
        bg(a, b) {
            super.bg(a, b);
            let c = a;
        }
        bh(a, b) {
            super.bh(a, b);
            let c = a;
        }
        ac(a) {
            return this.c5._inner[a];
        }
        ab(a) {
            let b = this.c5._inner[a];
            this.db._visibility = b._visibility;
            this.db.an = b.an;
            let c = this.bs(a);
            this.db._fill = c;
            this.db._stroke = c;
            this.db.ad = this.e.hk + 3;
            return this.db;
        }
        a8(a, b) {
            super.a8(a, b);
            if (a.d) {
                for (let c = 0; c < this.c5.count; c++) {
                    let d = this.aa(c, b);
                    this.bf(d, c, b);
                    a.t(d);
                }
            }
        }
        an(a) {
            super.an(a);
            let b = 0;
            for (let c of fromEnum(this.c4.a)) {
                this.e.a9.exportPathData(a, c, "column" + b, ["Main", "Fill"]);
                b++;
            }
        }
        c9() {
            this.as();
        }
    }
    RadialColumnSeriesView.$t = /*@__PURE__*/ markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
    return RadialColumnSeriesView;
})();
