/*
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 { Point_$type, markType, markDep, runOn, 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 { PathGeometry } from "igniteui-react-core";
import { ViewportUtils } from "./ViewportUtils";
import { SliceCoords } from "./SliceCoords";
import { PathFigure } from "igniteui-react-core";
import { LineSegment } from "igniteui-react-core";
import { ArcSegment } from "igniteui-react-core";
import { Size } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
import { AnchoredRadialSeriesView } from "./AnchoredRadialSeriesView";
import { DataContext } from "igniteui-react-core";
/**
 * @hidden
 */
export let RadialPieSeries = /*@__PURE__*/ (() => {
    class RadialPieSeries extends AnchoredRadialSeries {
        constructor() {
            super();
            this.ab = RadialPieSeries.$;
        }
        bf() {
            return new RadialPieSeriesView(this);
        }
        i2(a) {
            super.i2(a);
            this.o2 = a;
        }
        preferredCategoryMode(a) {
            return a != null && a == this.nd ? 2 : 0;
        }
        h3(a, b) {
            super.h3(a, b);
            let c = b;
            if (a && c.cx != null) {
                c.cx.count = 0;
            }
        }
        eg() {
            return this.nd.jz(this.bi.bs, this.bi.br, this.getEffectiveViewport1(this.bi));
        }
        nx(a, b) {
            super.nx(a, b);
            let c = b;
            let d = b.bs;
            let e = b.br;
            let f = this.getEffectiveViewport1(b);
            let g = this.l0(b);
            let h = this.nf.jo(e, d, f, g);
            let i = a.f;
            let j = this.nf;
            let k = Math.max(0, 0.5 * j.lq);
            let l = k;
            l = Math.max(l, h.minLength);
            let m = this.nd.jz(d, e, f);
            let n = { $type: Point_$type, x: 0.5, y: 0.5 };
            let o = this.o3;
            let p = this.o4;
            let q = (o > 0 && p > 0);
            let r = 0;
            for (let s = 0; s < i.count; ++s) {
                let t = c.cx.item(s);
                let u = i._inner[s][0];
                let v = Math.min(i._inner[s][2], h.maxLength);
                let w = null;
                if (q) {
                    w = this.o9(d, e, u - (m * 0.5), u + (m * 0.5), l, v, n, o, p);
                }
                else {
                    w = this.pa(d, e, u - (m * 0.5), u + (m * 0.5), l, v, n);
                }
                t.ak = w;
                let x = i._inner[s][2];
                if (x > r) {
                    r = x;
                }
            }
            c.cq = ViewportUtils.d(r, d, e);
            c.cr = { $type: Point_$type, x: ViewportUtils.c(n.x, d, e), y: ViewportUtils.f(n.y, d, e) };
            c.cx.count = i.count;
            c.c2();
        }
        pa(a, b, c, d, e, f, g) {
            let h = SliceCoords.b(a, b, c, d, e, f, g);
            let i = new PathFigure();
            i._startPoint = h.d;
            i._isClosed = true;
            i._segments.add(((() => {
                let $ret = new LineSegment(1);
                $ret.c = h.f;
                return $ret;
            })()));
            i._segments.add(((() => {
                let $ret = new ArcSegment();
                $ret.e = h.h;
                $ret.f = h.n;
                $ret.d = 1;
                $ret.b = h.c;
                return $ret;
            })()));
            i._segments.add(((() => {
                let $ret = new LineSegment(1);
                $ret.c = h.j;
                return $ret;
            })()));
            i._segments.add(((() => {
                let $ret = new ArcSegment();
                $ret.e = h.d;
                $ret.f = h.m;
                $ret.d = 0;
                $ret.b = h.c;
                return $ret;
            })()));
            let j = new PathGeometry();
            j.c.add(i);
            return j;
        }
        o9(a, b, c, d, e, f, g, h, i) {
            let j = SliceCoords.a(a, b, c, d, e, f, g, h, i);
            if (j == null) {
                return this.pa(a, b, c, d, e, f, g);
            }
            let k = new PathFigure();
            k._startPoint = j.d;
            k._isClosed = true;
            let l = ((c + ((d - c) * 0.5)) * 180 / Math.PI) + 90;
            let m = new Size(1, j.l.width * (e / f), j.l.height * (e / f));
            k._segments.add(((() => {
                let $ret = new ArcSegment();
                $ret.e = j.e;
                $ret.f = m;
                $ret.c = l;
                $ret.d = 1;
                $ret.b = false;
                return $ret;
            })()));
            k._segments.add(((() => {
                let $ret = new LineSegment(1);
                $ret.c = j.f;
                return $ret;
            })()));
            k._segments.add(((() => {
                let $ret = new ArcSegment();
                $ret.e = j.g;
                $ret.f = j.l;
                $ret.c = l;
                $ret.d = 1;
                $ret.b = false;
                return $ret;
            })()));
            k._segments.add(((() => {
                let $ret = new ArcSegment();
                $ret.e = j.h;
                $ret.f = j.n;
                $ret.d = 1;
                $ret.b = j.c;
                return $ret;
            })()));
            k._segments.add(((() => {
                let $ret = new ArcSegment();
                $ret.e = j.i;
                $ret.f = j.l;
                $ret.c = l;
                $ret.d = 1;
                $ret.b = false;
                return $ret;
            })()));
            k._segments.add(((() => {
                let $ret = new LineSegment(1);
                $ret.c = j.j;
                return $ret;
            })()));
            k._segments.add(((() => {
                let $ret = new ArcSegment();
                $ret.e = j.k;
                $ret.f = m;
                $ret.c = l;
                $ret.d = 1;
                $ret.b = false;
                return $ret;
            })()));
            k._segments.add(((() => {
                let $ret = new ArcSegment();
                $ret.e = j.d;
                $ret.f = j.m;
                $ret.d = 0;
                $ret.b = j.c;
                return $ret;
            })()));
            let n = new PathGeometry();
            n.c.add(k);
            return n;
        }
        i7(a, b, c, d) {
            super.i7(a, b, c, d);
            switch (b) {
                case RadialPieSeries.$$p[0]:
                case RadialPieSeries.$$p[1]:
                    this.jl(false);
                    break;
            }
        }
    }
    RadialPieSeries.$t = /*@__PURE__*/ markType(RadialPieSeries, 'RadialPieSeries', AnchoredRadialSeries.$);
    RadialPieSeries.$$p = /*@__PURE__*/ markDep(DependencyProperty, PropertyMetadata, RadialPieSeries, 'raisePropertyChanged', ['RadiusX:o3:o7', [1, 2], 'RadiusY:o4:o8', [1, 2]]);
    return RadialPieSeries;
})();
/**
 * @hidden
 */
export let RadialPieSeriesView = /*@__PURE__*/ (() => {
    class RadialPieSeriesView extends AnchoredRadialSeriesView {
        constructor(a) {
            super(a);
            this.cw = null;
            this.cx = null;
            this.cy = null;
            this.cw = a;
            this.cx = ((() => {
                let $ret = new Pool$1(Path.$);
                $ret.create = runOn(this, this.c3);
                $ret.activate = runOn(this, this.cz);
                $ret.disactivate = runOn(this, this.c1);
                $ret.destroy = runOn(this, this.c0);
                return $ret;
            })());
        }
        ap() {
            super.ap();
            this.cy = new List$1(Path.$, 0);
            if (!this.n) {
                this.e.eu = 4;
                this.e.bj = 1;
            }
        }
        c3() {
            let a = ((() => {
                let $ret = new Path();
                $ret.dataContext = ((() => {
                    let $ret = new DataContext();
                    $ret.series = this.e;
                    return $ret;
                })());
                return $ret;
            })());
            this.cy.add(a);
            a._visibility = 1;
            return a;
        }
        cz(a) {
            a._visibility = 0;
        }
        c1(a) {
            a._visibility = 1;
        }
        c0(a) {
            this.cy.remove(a);
        }
        bb(a, b) {
            super.bb(a, b);
            let c = a;
            c._stroke = this.e.lc;
            c.ac = this.e.ey;
            c._fill = this.e.lb;
            c.ai = this.e.ll;
            c.ad = this.e.lm;
        }
        bc(a, b) {
            super.bc(a, b);
            let c = a;
            let d = this.bm(b);
            c._stroke = d;
            c.ac = this.e.ey;
            c._fill = d;
        }
        a3(a, b) {
            super.a3(a, b);
            if (a.d) {
                for (let c = 0; c < this.cy.count; c++) {
                    let d = this.cy._inner[c];
                    this.ba(d, c, b);
                    a.s(d);
                }
            }
        }
        c2() {
            this.an();
        }
        ai(a) {
            super.ai(a);
            let b = 0;
            for (let c of fromEnum(this.cx.a)) {
                this.e.a2.exportPathData(a, c, "slice" + b, ["Main", "Fill"]);
                b++;
            }
        }
    }
    RadialPieSeriesView.$t = /*@__PURE__*/ markType(RadialPieSeriesView, 'RadialPieSeriesView', AnchoredRadialSeriesView.$);
    return RadialPieSeriesView;
})();
//# sourceMappingURL=RadialPieSeries_combined.js.map
