/*
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-angular-core";
import { Defaults } from "./Defaults";
import { Point_$type, runOn, markType, markDep, fromEnum } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { Path } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { ScalerParams } from "./ScalerParams";
import { PathGeometry } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { PolyLineSegment } from "igniteui-angular-core";
import { ViewportUtils } from "./ViewportUtils";
import { PropertyMetadata } from "igniteui-angular-core";
import { isNaN_ } from "igniteui-angular-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.get_dh = function () {
        return true;
    };
    RadialColumnSeries.prototype.get_d2 = function () {
        return true;
    };
    RadialColumnSeries.prototype.gu = function () {
        if (!isNaN_(this.gt)) {
            return _super.prototype.gu.call(this);
        }
        return Defaults.h;
    };
    RadialColumnSeries.prototype.bx = function () {
        return new RadialColumnSeriesView(this);
    };
    RadialColumnSeries.prototype.ly = function (a) {
        _super.prototype.ly.call(this, a);
        this.t6 = a;
    };
    RadialColumnSeries.prototype.ac = function () {
        _super.prototype.ac.call(this);
        this.mh(false);
    };
    RadialColumnSeries.prototype.l3 = function (a, b, c, d) {
        _super.prototype.l3.call(this, a, b, c, d);
        switch (b) {
            case RadialColumnSeries.$$p[0]:
            case RadialColumnSeries.$$p[1]:
                this.l0();
                break;
        }
    };
    RadialColumnSeries.prototype.preferredCategoryMode = function (a) {
        return a != null && a == this.rk ? 2 : 0;
    };
    RadialColumnSeries.prototype.kx = function (a, b) {
        _super.prototype.kx.call(this, a, b);
        var c = b;
        if (a) {
            c.c1.count = 0;
        }
    };
    RadialColumnSeries.prototype.get_c2 = function () {
        return true;
    };
    RadialColumnSeries.prototype.ga = function () {
        return this.rk.k3(this.b0.bv, this.b0.bu, this.getEffectiveViewport1(this.b0));
    };
    RadialColumnSeries.prototype.sp = function (a, b) {
        _super.prototype.sp.call(this, a, b);
        var c = a.f;
        var d = b.bv;
        var e = b.bu;
        var f = this.getEffectiveViewport1(b);
        var g = this.pq(b);
        var h = this.rr.kz(e, d, f, g);
        var i = b;
        var j = this.rr;
        var k = Math.max(0, 0.5 * j.nl);
        k = Math.max(k, h.minLength * 0.9);
        var l = ViewportUtils.d(k, d, e);
        var m = this.rk.k3(d, e, f);
        var n = Math.max(0.1 * this.rr.nm, k);
        var o = this.rs.d(0, n, d, e);
        var p = this.rs.e(0, n, d, e);
        var q = this.rs.d(m, n, d, e);
        var r = this.rs.e(m, n, d, e);
        var s = Math.sqrt((o - q) * (o - q) + (p - r) * (p - r));
        var t = { $type: Point_$type, x: ViewportUtils.c(0.5, d, e), y: ViewportUtils.f(0.5, d, e) };
        var u = this.s3.count;
        this.ry.a0(this, this.sa(), runOn(this, this.rh), this.sc(b), this.sd(b));
        this.ry.r = this.t7;
        this.ry.s = this.t8;
        this.ry.k = this.t7;
        this.ry.l = this.t8;
        var v = false;
        var w = this.ry.b;
        if (w != null) {
            v = true;
        }
        var x = this.rk;
        var y = new ScalerParams(1, b.bv, b.bu, x.cg);
        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.rs.d(a.f._inner[z][0], aa, d, e);
            var ac = this.rs.e(a.f._inner[z][0], aa, d, e);
            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.to(c, z, u, x, y, b.q);
            }
            var ag = this.ry.k;
            var ah = this.ry.l;
            var ai = a.f._inner[z][0] - (Math.PI / 2);
            var aj = i.c1.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.ak = au;
            this.ry.ad(aj, false, false, false, false);
        }
        i.c1.count = c.count;
        this.t6.c6();
    };
    RadialColumnSeries.$t = markType(RadialColumnSeries, 'RadialColumnSeries', AnchoredRadialSeries.$);
    RadialColumnSeries.$$p = markDep(DependencyProperty, PropertyMetadata, RadialColumnSeries, 'raisePropertyChanged', ['RadiusX:t7:ub', [1, 0], 'RadiusY:t8:uc', [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.c0 = null;
        _this.c1 = null;
        _this.c2 = null;
        _this.c8 = new Path();
        _this.c0 = a;
        _this.c1 = ((function () {
            var $ret = new Pool$1(Path.$);
            $ret.create = runOn(_this, _this.c9);
            $ret.activate = runOn(_this, _this.c3);
            $ret.disactivate = runOn(_this, _this.c5);
            $ret.destroy = runOn(_this, _this.c4);
            return $ret;
        })());
        return _this;
    }
    RadialColumnSeriesView.prototype.as = function () {
        _super.prototype.as.call(this);
        this.c2 = new List$1(Path.$, 0);
        if (!this.q) {
            this.cr.qc = Defaults.c;
            this.cr.gz = Defaults.i;
        }
    };
    RadialColumnSeriesView.prototype.c9 = function () {
        var a = new Path();
        this.c2.add(a);
        a._visibility = 1;
        return a;
    };
    RadialColumnSeriesView.prototype.c3 = function (a) {
        a._visibility = 0;
    };
    RadialColumnSeriesView.prototype.c5 = function (a) {
        a._visibility = 1;
    };
    RadialColumnSeriesView.prototype.c4 = function (a) {
        this.c2.remove(a);
    };
    RadialColumnSeriesView.prototype.c7 = function (a, b, c, d, e, f) {
        this.aq();
    };
    RadialColumnSeriesView.prototype.be = function (a, b) {
        _super.prototype.be.call(this, a, b);
        var c = a;
    };
    RadialColumnSeriesView.prototype.bf = function (a, b) {
        _super.prototype.bf.call(this, a, b);
        var c = a;
    };
    RadialColumnSeriesView.prototype.ac = function (a) {
        return this.c2._inner[a];
    };
    RadialColumnSeriesView.prototype.ab = function (a) {
        var b = this.c2._inner[a];
        this.c8._visibility = b._visibility;
        this.c8.ak = b.ak;
        var c = this.bp(a);
        this.c8._fill = c;
        this.c8._stroke = c;
        this.c8.ac = this.e.fu + 3;
        return this.c8;
    };
    RadialColumnSeriesView.prototype.a6 = function (a, b) {
        _super.prototype.a6.call(this, a, b);
        if (a.d) {
            for (var c = 0; c < this.c2.count; c++) {
                var d = this.aa(c, b);
                this.bd(d, c, b);
                a.s(d);
            }
        }
    };
    RadialColumnSeriesView.prototype.al = function (a) {
        var e_1, _a;
        _super.prototype.al.call(this, a);
        var b = 0;
        try {
            for (var _b = __values(fromEnum(this.c1.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                this.e.a8.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.c6 = function () {
        this.aq();
    };
    RadialColumnSeriesView.$t = markType(RadialColumnSeriesView, 'RadialColumnSeriesView', AnchoredRadialSeriesView.$);
    return RadialColumnSeriesView;
}(AnchoredRadialSeriesView));
export { RadialColumnSeriesView };
