/*
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 { __extends, __values } from "tslib";
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
 */
var RadialColumnSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RadialColumnSeries, _super);
    function RadialColumnSeries() {
        var _this = _super.call(this) || this;
        _this.ab = RadialColumnSeries.$;
        return _this;
    }
    RadialColumnSeries.prototype.bi = function () {
        return new RadialColumnSeries();
    };
    RadialColumnSeries.prototype.get_ex = function () {
        return true;
    };
    RadialColumnSeries.prototype.get_fj = function () {
        return true;
    };
    RadialColumnSeries.prototype.ji = function () {
        if (!isNaN_(this.jh)) {
            return _super.prototype.ji.call(this);
        }
        return Defaults.h;
    };
    RadialColumnSeries.prototype.cq = function () {
        return new RadialColumnSeriesView(this);
    };
    RadialColumnSeries.prototype.qw = function (a) {
        _super.prototype.qw.call(this, a);
        this.adc = a;
    };
    RadialColumnSeries.prototype.ac = function () {
        _super.prototype.ac.call(this);
        this.rm(false);
    };
    RadialColumnSeries.prototype.q4 = function (a, b, c, d) {
        _super.prototype.q4.call(this, a, b, c, d);
        switch (b) {
            case RadialColumnSeries.$$p[0]:
            case RadialColumnSeries.$$p[1]:
                this.qy();
                break;
        }
    };
    RadialColumnSeries.prototype.preferredCategoryMode = function (a) {
        return a != null && a == this.yq ? 2 : 0;
    };
    RadialColumnSeries.prototype.o2 = function (a, b) {
        _super.prototype.o2.call(this, a, b);
        var c = b;
        if (a) {
            c.c6.count = 0;
        }
    };
    RadialColumnSeries.prototype.get_eb = function () {
        return true;
    };
    RadialColumnSeries.prototype.iu = function () {
        return this.yq.k5(this.ct.by, this.ct.bx, this.getEffectiveViewport1(this.ct));
    };
    RadialColumnSeries.prototype.aa1 = function (a, b) {
        _super.prototype.aa1.call(this, a, b);
        var c = a.f;
        var d = b.by;
        var e = b.bx;
        var f = this.getEffectiveViewport1(b);
        var g = this.wc(b);
        var h = this.yv.k2(e, d, f, g);
        var i = b;
        var j = this.yv;
        var k = Math.max(0, 0.5 * j.no);
        k = Math.max(k, h.minLength * 0.9);
        var l = ViewportUtils.d(k, d, e, f);
        var m = this.yq.k5(d, e, f);
        var n = Math.max(0.1 * this.yv.np, k);
        var o = this.yy.d(0, n, d, e, f);
        var p = this.yy.e(0, n, d, e, f);
        var q = this.yy.d(m, n, d, e, f);
        var r = this.yy.e(m, n, d, e, f);
        var s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
        var t = { $type: Point_$type, x: ViewportUtils.e(0.5, d, e, f), y: ViewportUtils.i(0.5, d, e, f) };
        var 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;
        var v = false;
        var w = this.y6.b;
        if (w != null) {
            v = true;
        }
        var x = this.yq;
        var y = new ScalerParams(1, b.by, b.bx, x.ch);
        y.c = this.getEffectiveViewport();
        for (var z = 0; z < c.count; ++z) {
            var aa = Math.min(a.f._inner[z][2], h.maxLength * 1.1);
            var ab = this.yy.d(a.f._inner[z][0], aa, d, e, f);
            var ac = this.yy.e(a.f._inner[z][0], aa, d, e, f);
            var ad = Math.sqrt((ab - t.x) * (ab - t.x) + (ac - t.y) * (ac - t.y));
            var ae = ad;
            var af = l;
            if (v) {
                this.acs(c, z, u, x, y, b.q);
            }
            var ag = this.y6.k;
            var ah = this.y6.l;
            var ai = a.f._inner[z][0] - (Math.PI / 2);
            var aj = i.c6.item(z);
            var ak = 0 - (s / 2);
            var al = (s / 2);
            var am = Math.max(af, ae);
            var an = Math.min(af, ae);
            var ao = Math.cos(ai);
            var ap = Math.sin(ai);
            var aq = { $type: Point_$type, x: t.x + (ak * ao - am * ap), y: t.y + (ak * ap + am * ao) };
            var ar = { $type: Point_$type, x: t.x + (al * ao - am * ap), y: t.y + (al * ap + am * ao) };
            var as = { $type: Point_$type, x: t.x + (al * ao - an * ap), y: t.y + (al * ap + an * ao) };
            var at = { $type: Point_$type, x: t.x + (ak * ao - an * ap), y: t.y + (ak * ap + an * ao) };
            var au = new PathGeometry();
            var av = new PathFigure();
            av._startPoint = aq;
            av._isClosed = true;
            var 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 = markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
    RadialColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:add:adh', [1, 0], 'RadiusY:ade:adi', [1, 0]]);
    return RadialColumnSeries;
}(AnchoredRadialSeries));
export { RadialColumnSeries };
/**
 * @hidden
 */
var RadialColumnSeriesView = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(RadialColumnSeriesView, _super);
    function RadialColumnSeriesView(a) {
        var _this = _super.call(this, a) || this;
        _this.c5 = null;
        _this.c6 = null;
        _this.c7 = null;
        _this.dd = new Path();
        _this.c5 = a;
        _this.c6 = ((function () {
            var $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;
        })());
        return _this;
    }
    RadialColumnSeriesView.prototype.au = function () {
        _super.prototype.au.call(this);
        this.c7 = new List$1(Path.$, 0);
        if (!this.q) {
            this.cw.w1 = Defaults.c;
            this.cw.jn = Defaults.i;
        }
    };
    RadialColumnSeriesView.prototype.de = function () {
        var a = new Path();
        this.c7.add(a);
        a._visibility = 1;
        return a;
    };
    RadialColumnSeriesView.prototype.c8 = function (a) {
        a._visibility = 0;
    };
    RadialColumnSeriesView.prototype.da = function (a) {
        a._visibility = 1;
    };
    RadialColumnSeriesView.prototype.c9 = function (a) {
        this.c7.remove(a);
    };
    RadialColumnSeriesView.prototype.dc = function (a, b, c, d, e, f) {
        this.as();
    };
    RadialColumnSeriesView.prototype.bg = function (a, b) {
        _super.prototype.bg.call(this, a, b);
        var c = a;
    };
    RadialColumnSeriesView.prototype.bh = function (a, b) {
        _super.prototype.bh.call(this, a, b);
        var c = a;
    };
    RadialColumnSeriesView.prototype.ac = function (a) {
        return this.c7._inner[a];
    };
    RadialColumnSeriesView.prototype.ab = function (a) {
        var b = this.c7._inner[a];
        this.dd._visibility = b._visibility;
        this.dd.an = b.an;
        var c = this.bs(a);
        this.dd._fill = c;
        this.dd._stroke = c;
        this.dd.ad = this.e.ic + 3;
        return this.dd;
    };
    RadialColumnSeriesView.prototype.a8 = function (a, b) {
        _super.prototype.a8.call(this, a, b);
        if (a.d) {
            for (var c = 0; c < this.c7.count; c++) {
                var d = this.aa(c, b);
                this.bf(d, c, b);
                a.t(d);
            }
        }
    };
    RadialColumnSeriesView.prototype.an = function (a) {
        var e_1, _a;
        _super.prototype.an.call(this, a);
        var b = 0;
        try {
            for (var _b = __values(fromEnum(this.c6.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                this.e.bb.exportPathData(a, c, "column" + b, ["Main", "Fill"]);
                b++;
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
    };
    RadialColumnSeriesView.prototype.db = function () {
        this.as();
    };
    RadialColumnSeriesView.$t = markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
    return RadialColumnSeriesView;
}(AnchoredRadialSeriesView));
export { RadialColumnSeriesView };
