/*
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 {
        bi() {
            return new RadialColumnSeries();
        }
        get_ex() {
            return true;
        }
        get_fj() {
            return true;
        }
        ji() {
            if (!isNaN_(this.jh)) {
                return super.ji();
            }
            return Defaults.h;
        }
        cq() {
            return new RadialColumnSeriesView(this);
        }
        qw(a) {
            super.qw(a);
            this.adc = a;
        }
        constructor() {
            super();
            this.ab = RadialColumnSeries.$;
        }
        ac() {
            super.ac();
            this.rm(false);
        }
        q4(a, b, c, d) {
            super.q4(a, b, c, d);
            switch (b) {
                case RadialColumnSeries.$$p[0]:
                case RadialColumnSeries.$$p[1]:
                    this.qy();
                    break;
            }
        }
        preferredCategoryMode(a) {
            return a != null && a == this.yq ? 2 : 0;
        }
        o2(a, b) {
            super.o2(a, b);
            let c = b;
            if (a) {
                c.c6.count = 0;
            }
        }
        get_eb() {
            return true;
        }
        iu() {
            return this.yq.k5(this.ct.by, this.ct.bx, this.getEffectiveViewport1(this.ct));
        }
        aa1(a, b) {
            super.aa1(a, b);
            let c = a.f;
            let d = b.by;
            let e = b.bx;
            let f = this.getEffectiveViewport1(b);
            let g = this.wc(b);
            let h = this.yv.k2(e, d, f, g);
            let i = b;
            let j = this.yv;
            let k = Math.max(0, 0.5 * j.no);
            k = Math.max(k, h.minLength * 0.9);
            let l = ViewportUtils.d(k, d, e, f);
            let m = this.yq.k5(d, e, f);
            let n = Math.max(0.1 * this.yv.np, k);
            let o = this.yy.d(0, n, d, e, f);
            let p = this.yy.e(0, n, d, e, f);
            let q = this.yy.d(m, n, d, e, f);
            let r = this.yy.e(m, n, d, e, f);
            let s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
            let t = { $type: Point_$type, x: ViewportUtils.e(0.5, d, e, f), y: ViewportUtils.i(0.5, d, e, f) };
            let u = this.abw.count;
            this.y6.a2(this, this.zn(), runOn(this, this.ye), this.zw(b), this.zx(b));
            this.y6.r = this.add;
            this.y6.s = this.ade;
            this.y6.k = this.add;
            this.y6.l = this.ade;
            let v = false;
            let w = this.y6.b;
            if (w != null) {
                v = true;
            }
            let x = this.yq;
            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.yy.d(a.f._inner[z][0], aa, d, e, f);
                let ac = this.yy.e(a.f._inner[z][0], aa, d, e, f);
                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.acs(c, z, u, x, y, b.q);
                }
                let ag = this.y6.k;
                let ah = this.y6.l;
                let ai = a.f._inner[z][0] - (Math.PI / 2);
                let aj = i.c6.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.y6.ad(aj, false, false, false, false);
            }
            i.c6.count = c.count;
            this.adc.db();
        }
    }
    RadialColumnSeries.$t = /*@__PURE__*/ markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
    RadialColumnSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:add:adh', [1, 0], 'RadiusY:ade:adi', [1, 0]]);
    return RadialColumnSeries;
})();
/**
 * @hidden
 */
export let RadialColumnSeriesView = /*@__PURE__*/ (() => {
    class RadialColumnSeriesView extends AnchoredRadialSeriesView {
        constructor(a) {
            super(a);
            this.c5 = null;
            this.c6 = null;
            this.c7 = null;
            this.dd = new Path();
            this.c5 = a;
            this.c6 = ((() => {
                let $ret = new Pool$1(Path.$);
                $ret.create = runOn(this, this.de);
                $ret.activate = runOn(this, this.c8);
                $ret.disactivate = runOn(this, this.da);
                $ret.destroy = runOn(this, this.c9);
                return $ret;
            })());
        }
        au() {
            super.au();
            this.c7 = new List$1(Path.$, 0);
            if (!this.q) {
                this.cw.w1 = Defaults.c;
                this.cw.jn = Defaults.i;
            }
        }
        de() {
            let a = new Path();
            this.c7.add(a);
            a._visibility = 1;
            return a;
        }
        c8(a) {
            a._visibility = 0;
        }
        da(a) {
            a._visibility = 1;
        }
        c9(a) {
            this.c7.remove(a);
        }
        dc(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.c7._inner[a];
        }
        ab(a) {
            let b = this.c7._inner[a];
            this.dd._visibility = b._visibility;
            this.dd.an = b.an;
            let c = this.bs(a);
            this.dd._fill = c;
            this.dd._stroke = c;
            this.dd.ad = this.e.ic + 3;
            return this.dd;
        }
        a8(a, b) {
            super.a8(a, b);
            if (a.d) {
                for (let c = 0; c < this.c7.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.c6.a)) {
                this.e.bb.exportPathData(a, c, "column" + b, ["Main", "Fill"]);
                b++;
            }
        }
        db() {
            this.as();
        }
    }
    RadialColumnSeriesView.$t = /*@__PURE__*/ markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
    return RadialColumnSeriesView;
})();
