/*
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 * as tslib_1 from "tslib";
import { PieChartBase } from "./PieChartBase";
import { DependencyProperty } from "igniteui-angular-core";
import { PieChartBaseView } from "./PieChartBaseView";
import { Base, Number_$type, typeCast, fromEnum, markType, markDep, IEnumerable_$type, INotifyPropertyChanged_$type, PropertyChangedEventArgs, Point_$type, delegateCombine, enumGetBox, EnumUtil, Delegate_$type, Boolean_$type, delegateRemove, runOn, fromEn, toEnum } from "igniteui-angular-core";
import { Control } from "igniteui-angular-core";
import { List$1 } from "igniteui-angular-core";
import { NotifyCollectionChangedEventArgs } from "igniteui-angular-core";
import { Pool$1 } from "igniteui-angular-core";
import { FastItemsSource } from "igniteui-angular-core";
import { IChartLegend_$type } from "igniteui-angular-core";
import { ContentControl } from "igniteui-angular-core";
import { Brush } from "igniteui-angular-core";
import { PieSliceDataContext } from "./PieSliceDataContext";
import { UIElement } from "igniteui-angular-core";
import { PropertyMetadata } from "igniteui-angular-core";
import { Visibility_$type } from "igniteui-angular-core";
import { OthersCategoryType_$type } from "./OthersCategoryType";
import { BrushCollection } from "igniteui-angular-core";
import { isNaN_, isInfinity, intDivide } from "igniteui-angular-core";
import { ILegendSeries_$type } from "igniteui-angular-core";
import { ILegendTemplateProvider_$type } from "igniteui-angular-core";
import { LabelsPosition_$type } from "./LabelsPosition";
import { Style } from "igniteui-angular-core";
import { LeaderLineType_$type } from "./LeaderLineType";
import { DataTemplate } from "igniteui-angular-core";
import { ILegendOwner_$type } from "igniteui-angular-core";
import { PropertyUpdatedEventArgs } from "igniteui-angular-core";
import { Size } from "igniteui-angular-core";
import { ObservableCollection$1 } from "igniteui-angular-core";
import { DomRenderer_$type } from "igniteui-angular-core";
import { DeviceUtils } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { HoleDimensionsChangedEventArgs } from "./HoleDimensionsChangedEventArgs";
import { DoughnutChartVisualData } from "./DoughnutChartVisualData";
import { RingSeriesVisualDataList } from "./RingSeriesVisualDataList";
import { RectData } from "igniteui-angular-core";
import { Dictionary$2 } from "igniteui-angular-core";
import { PieLegendTemplates } from "./PieLegendTemplates";
import { BrushUtil } from "igniteui-angular-core";
import { FontUtil } from "igniteui-angular-core";
import { DOMEventProxy } from "igniteui-angular-core";
import { SliceVisualData } from "./SliceVisualData";
import { RingSeriesVisualData } from "./RingSeriesVisualData";
import { RingVisualDataList } from "./RingVisualDataList";
import { RingVisualData } from "./RingVisualData";
import { ArcVisualDataList } from "./ArcVisualDataList";
import { ArcVisualData } from "./ArcVisualData";
import { SliceVisualDataList } from "./SliceVisualDataList";
import { PointData } from "igniteui-angular-core";
import { AppearanceHelper } from "igniteui-angular-core";
import { PathVisualData } from "igniteui-angular-core";
import { DoughnutChartLabelVisualData } from "./DoughnutChartLabelVisualData";
import { RectUtil } from "igniteui-angular-core";
import { SizeData } from "igniteui-angular-core";
/**
 * @hidden
 */
var Arc = /** @class */ (function (_super) {
    tslib_1.__extends(Arc, _super);
    function Arc() {
        var _this = _super.call(this) || this;
        _this.hd = null;
        _this.hb = null;
        _this.hg = 0;
        _this.ab = Arc.$;
        return _this;
    }
    Arc.prototype.ar = function () {
        return new ArcView(this);
    };
    Arc.prototype.e6 = function (a) {
        _super.prototype.e6.call(this, a);
        this.hc = a;
    };
    Object.defineProperty(Arc.prototype, "he", {
        get: function () {
            return this.hd;
        },
        set: function (a) {
            var b = this.hd;
            this.hd = a;
            this.hc.b6(b, this.hd);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Arc.prototype, "hh", {
        get: function () {
            if (this.he != null) {
                return this.he.i;
            }
            return 0;
        },
        enumerable: true,
        configurable: true
    });
    Arc.prototype.e5 = function (a, b) {
        _super.prototype.e5.call(this, a, b);
        if (this.he != null) {
            this.he.c.at.bu(a, b);
        }
    };
    Arc.prototype.ek = function (a, b) {
        if (this.he != null && this.he.d != null) {
            _super.prototype.ek.call(this, a, b);
            var c = this.hf(a);
            if (c != null) {
                this.he.d.bj(c, b);
            }
        }
    };
    Arc.prototype.fk = function (a, b) {
        if (this.he != null && this.he.d != null) {
            _super.prototype.fk.call(this, a, b);
            var c = this.hf(a);
            if (c != null) {
                this.he.d.b5(c, b);
            }
        }
    };
    Arc.prototype.hf = function (a) {
        var e_1, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.hb.g)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                if (b.b == a) {
                    return 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; }
        }
        return null;
    };
    Arc.prototype.fj = function (a) {
        if (this.bq) {
            this.e9();
            this.fh();
            this.fg();
        }
    };
    Arc.prototype.e9 = function () {
        if (this.itemsSource == null || this.a5 == null) {
            this.bg.count = 0;
            return;
        }
        var a = this.b2.count;
        var b = this.b1.count > 0;
        var c = PieChartBase.cs(this.cf);
        var d = PieChartBase.cs(this.cf);
        this.cx = a;
        if (b) {
            a++;
        }
        for (var e = 0; e < a; e++) {
            var f = false;
            var g = void 0;
            if (e == a - 1 && b) {
                g = this.cp;
                f = true;
            }
            else {
                g = this.be.item(this.b2._inner[e]);
            }
            if (this.gz == 1) {
                d += PieChartBase.cs(Math.abs(g) * this.hi / this.cu);
            }
            else {
                d -= PieChartBase.cs(Math.abs(g) * this.hi / this.cu);
            }
            var h = this.bg.item(e);
            if (this.cc >= 100) {
                h._visibility = 1;
            }
            else {
                h._visibility = 0;
            }
            h.aw = true;
            h.a3 = c;
            h.ax = d;
            h.a1 = h.a0 = this.cc;
            h.isOthersSlice = f;
            h.ay = this.cb;
            h.a5 = e;
            h.dataContext = f ? this.b0 : this.a5.item(this.b2._inner[e]);
            h.isExploded = this.explodedSlices.contains(e);
            h.isSelected = this.selectedSlices.contains(e);
            c = d;
            h.aw = false;
        }
        this.bg.count = a;
        if (this.hb != null) {
            this.hb.q(this);
        }
    };
    Arc.prototype.fg = function () {
        var e_2, _a;
        var _this = this;
        var a = typeCast(IChartLegend_$type, this.legend);
        if (a == null) {
            return;
        }
        if (this.ba == null || this.ba.count == 0 || ((this.he != null && this.he.c != null) && (this.he.d != null && !this.he.d.series.contains(this.he.c)))) {
            a.clearLegendItemsForSeries(this.he.c);
            return;
        }
        this.bz = new List$1(UIElement.$, 0);
        var _loop_1 = function (b) {
            var c = new ContentControl();
            var d = this_1.cy(b);
            var e = b.b0;
            var f = b.isOthersSlice ? this_1.dz : (this_1.bb != null && this_1.bb.count > 0) ? this_1.bb.item(this_1.b2._inner[b.a5]) : null;
            f = (f == null && this_1.ba.count > 0) ? this_1.ba.item(this_1.b2._inner[b.a5]) : f;
            c.content = ((function () {
                var $ret = new PieSliceDataContext();
                $ret.series = _this.he.c;
                $ret.slice = b;
                $ret.item = b.dataContext;
                $ret.itemBrush = e;
                $ret.legendLabel = f != null ? f.toString() : null;
                $ret.itemLabel = d != null ? d.toString() : null;
                $ret.percentValue = _this.ck(b);
                $ret.isOthersSlice = b.isOthersSlice;
                return $ret;
            })());
            var g = c.content;
            if (this_1.au != null) {
                var h = this_1.au(g);
                if (h != null) {
                    g.legendLabel = h.toString();
                }
            }
            if (this_1.legendItemTemplate != null) {
                c.ah = this_1.legendItemTemplate;
            }
            this_1.bz.add(c);
        };
        var this_1 = this;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.bg.a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var b = _c.value;
                _loop_1(b);
            }
        }
        catch (e_2_1) { e_2 = { error: e_2_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_2) throw e_2.error; }
        }
        if (a.isItemwise) {
            var i = a;
            i.createLegendItemsInsert(this.bz, this.he.c);
        }
    };
    Arc.prototype.fa = function (a, b, c, d) {
        _super.prototype.fa.call(this, a, b, c, d);
        switch (b) {
            case Arc.$$p[0]:
                this.hg = d;
                this.e9();
                this.e8();
                this.fh();
                this.ff();
                break;
            case "RadiusFactor":
                if (this.he != null && this.he.d != null) {
                    this.he.d.bw();
                }
                break;
            case "Legend":
                var e = typeCast(IChartLegend_$type, c);
                if (e != null && this.he != null && this.he.c != null) {
                    e.clearLegendItemsForSeries(this.he.c);
                }
                break;
        }
    };
    Arc.prototype.hj = function () {
        return this.as.ac();
    };
    Arc.$t = markType(Arc, 'Arc', PieChartBase.$);
    Arc.$$p = markDep(DependencyProperty, PropertyMetadata, Arc, 'fc', ['EndAngle:hi:hl', [1, 360]]);
    return Arc;
}(PieChartBase));
export { Arc };
/**
 * @hidden
 */
var ArcItem = /** @class */ (function (_super) {
    tslib_1.__extends(ArcItem, _super);
    function ArcItem() {
        var _this = _super.call(this) || this;
        _this.d = null;
        _this.b = null;
        _this.n = null;
        _this.l = 0;
        _this.m = 0;
        _this.k = 0;
        _this.i = 0;
        _this.j = 0;
        _this.c = 0;
        _this.a = null;
        _this.g = null;
        _this.e = null;
        _this.h = null;
        _this.k = 0;
        _this.i = 360;
        _this.g = new List$1(SliceItem.$, 0);
        return _this;
    }
    ArcItem.prototype.o = function (a, b) {
        var e_3, _a;
        var c = 0;
        var d = 0;
        var e = new List$1(Number_$type, 0);
        var f = new List$1(Number_$type, 0);
        var g = new List$1(Base.$, 0);
        this.g.clear();
        if (this.h == null) {
            return;
        }
        var h = new FastItemsSource();
        h.e = this.h;
        var i = this.f(h, this.n);
        if (i == null || i.count == 0) {
            h.deregisterColumn(i);
            h.m();
            return;
        }
        try {
            for (var _b = tslib_1.__values(fromEnum(i)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var j = _c.value;
                if (isNaN_(j) || isInfinity(j) || j <= 0) {
                    continue;
                }
                c = c + j;
            }
        }
        catch (e_3_1) { e_3 = { error: e_3_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_3) throw e_3.error; }
        }
        for (var k = 0; k < i.count; k++) {
            var l = i.item(k);
            if (isNaN_(l) || isInfinity(l) || l <= 0) {
                continue;
            }
            var m = this.c == 1 ? l / c : l;
            var n = this.c == 1 ? this.j / 100 : this.j;
            if (m <= n) {
                d = d + l;
                f.add(k);
                g.add1(h.item(k));
            }
            else {
                e.add(k);
            }
        }
        var o = e.count;
        var p = f.count > 0;
        var q = PieChartBase.cs(a);
        var r = PieChartBase.cs(a);
        if (p) {
            o++;
        }
        var _loop_2 = function (s) {
            var t = false;
            var u = void 0;
            if (s == o - 1 && p) {
                u = d;
                t = true;
            }
            else {
                u = i.item(e._inner[s]);
            }
            var v = 1;
            if (v == 1) {
                r += PieChartBase.cs(Math.abs(u) * b / c);
            }
            else {
                r -= PieChartBase.cs(Math.abs(u) * b / c);
            }
            this_2.g.add(((function () {
                var $ret = new SliceItem();
                $ret.e = q;
                $ret.d = r - q;
                $ret.g = t ? g : h.item(e._inner[s]);
                return $ret;
            })()));
            q = r;
        };
        var this_2 = this;
        for (var s = 0; s < o; s++) {
            _loop_2(s);
        }
        h.deregisterColumn(i);
        h.m();
    };
    ArcItem.prototype.f = function (a, b) {
        var c = null;
        return a.registerColumn(b, c, false);
    };
    ArcItem.prototype.p = function (a) {
        var b = this.e == null ? a : this.e.e;
        var c = this.e == null ? 360 : this.e.d;
        this.o(b, c);
    };
    ArcItem.prototype.q = function (a) {
        var _this = this;
        this.g.clear();
        var _loop_3 = function (b) {
            var c = a.bg.item(b);
            this_3.g.add(((function () {
                var $ret = new SliceItem();
                $ret.e = c.a3;
                $ret.d = c.ax - c.a3;
                $ret.f = b;
                $ret.a = _this;
                $ret.g = c.dataContext;
                $ret.c = c.isOthersSlice;
                $ret.b = c;
                return $ret;
            })()));
        };
        var this_3 = this;
        for (var b = 0; b < a.bg.count; b++) {
            _loop_3(b);
        }
    };
    ArcItem.$t = markType(ArcItem, 'ArcItem');
    return ArcItem;
}(Base));
export { ArcItem };
/**
 * @hidden
 */
var RingSeriesBase = /** @class */ (function (_super) {
    tslib_1.__extends(RingSeriesBase, _super);
    function RingSeriesBase() {
        var _this = _super.call(this) || this;
        _this.ao = null;
        _this.at = null;
        _this.propertyChanged = null;
        _this.propertyUpdated = null;
        _this.a7 = null;
        _this.aw = false;
        _this.av = false;
        _this.a5 = null;
        _this.dq = null;
        _this.as = null;
        _this.cq = null;
        _this.dq = { $type: Point_$type, x: 0, y: 0 };
        _this.ao = function (a, b) { return _this.cl(a, b.propertyName, b.oldValue, b.newValue); };
        _this.propertyUpdated = delegateCombine(_this.propertyUpdated, _this.ao);
        _this.as = _this.ar();
        _this.ci(_this.as);
        _this.as.k();
        _this.a5 = function (a, b) { return _this.cc(b.action, b.position, b.count, b.propertyName); };
        return _this;
    }
    RingSeriesBase.prototype.cn = function (a, b, c) {
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
        if (this.propertyUpdated != null) {
            this.propertyUpdated(this, new PropertyUpdatedEventArgs(a, b, c));
        }
    };
    Object.defineProperty(RingSeriesBase.prototype, "du", {
        get: function () {
            if (this.dt != null) {
                return this.dt;
            }
            if (this.at != null && this.at.cg != null) {
                return this.at.cg;
            }
            return null;
        },
        set: function (a) {
            var b = this.du;
            if (this.dt != null && a != this.dt) {
                a = this.dt;
            }
            this.cn("SelectedStyleResolved", b, a);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "b5", {
        get: function () {
            return this.a7;
        },
        set: function (a) {
            var b = this.a7;
            this.a7 = a;
            this.cn("TextStyle", b, a);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "cr", {
        get: function () {
            return typeCast(DataTemplate.$, this.c(RingSeriesBase.c3));
        },
        set: function (a) {
            this.h(RingSeriesBase.c3, a);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "ax", {
        get: function () {
            return this.c(RingSeriesBase.cw);
        },
        set: function (a) {
            this.aw = true;
            this.h(RingSeriesBase.cw, a);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "ay", {
        get: function () {
            if (!this.aw) {
                return this.at.ax;
            }
            else {
                return this.ax;
            }
        },
        enumerable: true,
        configurable: true
    });
    RingSeriesBase.prototype.cl = function (a, b, c, d) {
        if (b == RingSeriesBase.$$p[4]) {
            this.au = ((function () {
                var $ret = new FastItemsSource();
                $ret.e = d;
                return $ret;
            })());
        }
        if (b == RingSeriesBase.$$p[1]) {
            if (typeCast(FastItemsSource.$, c) != null) {
                var e = (typeCast(FastItemsSource.$, c));
                e.event = delegateRemove(e.event, this.a5);
                this.av = false;
            }
            if (typeCast(FastItemsSource.$, d) != null) {
                var f = (typeCast(FastItemsSource.$, d));
                f.event = delegateCombine(f.event, this.a5);
                this.av = true;
            }
            this.ck();
        }
        switch (b) {
            case RingSeriesBase.$$p[24]:
                this.du = d;
                break;
            case RingSeriesBase.$$p[28]:
                this.ck();
                break;
        }
    };
    Object.defineProperty(RingSeriesBase.prototype, "container", {
        get: function () {
            return this.at;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "isStacked", {
        get: function () {
            return false;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "isVertical", {
        get: function () {
            return false;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "isUsableInLegend", {
        get: function () {
            return true;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "hasMarkers", {
        get: function () {
            return false;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingSeriesBase.prototype, "hasSubItems", {
        get: function () {
            return false;
        },
        enumerable: true,
        configurable: true
    });
    RingSeriesBase.prototype.cc = function (a, b, c, d) {
        this.ck();
    };
    RingSeriesBase.prototype.ar = function () {
        return new RingSeriesBaseView(this);
    };
    RingSeriesBase.prototype.ci = function (a) {
    };
    RingSeriesBase.prototype.cm = function (a) {
        this.as.n(a);
    };
    RingSeriesBase.prototype.cb = function () {
        if (this.as != null) {
            this.as.i();
        }
    };
    RingSeriesBase.prototype.cf = function (a, b) {
        this.cd(new NotifyCollectionChangedEventArgs(1, 0, b, a));
    };
    RingSeriesBase.prototype.ch = function (a, b, c) {
        this.cd(new NotifyCollectionChangedEventArgs(2, 2, c, b, a));
    };
    RingSeriesBase.prototype.ce = function () {
        this.cd(new NotifyCollectionChangedEventArgs(0, 4));
    };
    RingSeriesBase.prototype.cg = function (a, b) {
        this.cd(new NotifyCollectionChangedEventArgs(1, 1, b, a));
    };
    RingSeriesBase.prototype.cd = function (a) {
        if (this.au != null) {
            this.au.handleCollectionChanged(a);
        }
    };
    RingSeriesBase.prototype.resolveLegendIndex = function () {
        return -1;
    };
    RingSeriesBase.prototype.forSubItems = function (a) {
    };
    RingSeriesBase.$t = markType(RingSeriesBase, 'RingSeriesBase', Control.$, [INotifyPropertyChanged_$type, ILegendSeries_$type, ILegendTemplateProvider_$type]);
    RingSeriesBase.c3 = DependencyProperty.i("LabelTemplate", DataTemplate.$, RingSeriesBase.$, new PropertyMetadata(2, null, function (a, b) { return (typeCast(RingSeriesBase.$, a)).cn("LabelTemplate", b.oldValue, b.newValue); }));
    RingSeriesBase.cw = DependencyProperty.i("IsSurfaceInteractionDisabled", Boolean_$type, RingSeriesBase.$, new PropertyMetadata(2, false, function (a, b) { return a.cn("IsSurfaceInteractionDisabled", b.oldValue, b.newValue); }));
    RingSeriesBase.$$p = markDep(DependencyProperty, PropertyMetadata, RingSeriesBase, 'cn', ['Brushes:ag:cs', [BrushCollection.$, null], 'FastItemsSource:au:ct', [FastItemsSource.$], 'FormatLabel:am:cu', [Delegate_$type], 'FormatLegendLabel:an:cv', [Delegate_$type], 'ItemsSource::cx', [IEnumerable_$type, null], 'LabelExtent:a0:cy', [1, 10], 'LabelInnerColor:dn:cz', [Brush.$, null], 'LabelMemberPath:bg:c0', [2], 'LabelOuterColor:dp:c1', [Brush.$, null], 'LabelsPosition:aj:c2', [LabelsPosition_$type, enumGetBox(LabelsPosition_$type, 1)], 'LeaderLineMargin:a1:c4', [1, 6], 'LeaderLineStyle:dr:c5', [Style.$, null], 'LeaderLineType:ak:c6', [LeaderLineType_$type, enumGetBox(LeaderLineType_$type, 0)], 'LeaderLineVisibility:dw:c7', [Visibility_$type, enumGetBox(Visibility_$type, 0)], 'LegendItemBadgeTemplate::c8', [DataTemplate.$, null], 'LegendItemTemplate::c9', [DataTemplate.$, null], 'LegendLabelMemberPath:br:da', [2], 'Legend::db', [IChartLegend_$type, null], 'OthersCategoryStyle:ds:dc', [Style.$, null], 'OthersCategoryText:bv:dd', [2, "Others"], 'OthersCategoryThreshold:a2:de', [1, 3], 'OthersCategoryType:al:df', [OthersCategoryType_$type, enumGetBox(OthersCategoryType_$type, 1)], 'Outlines:ah:dg', [BrushCollection.$, null], 'RadiusFactor:a3:dh', [1, 0.9], 'SelectedStyle:dt:di', [Style.$, null], 'StartAngle:a4:dj', [1, 0], 'ToolTip::dk', [4, null], 'ToolTipStyle:dv:dl', [Style.$, null], 'ValueMemberPath:b9:dm', [2, null]]);
    return RingSeriesBase;
}(Control));
export { RingSeriesBase };
/**
 * @hidden
 */
var Ring = /** @class */ (function (_super) {
    tslib_1.__extends(Ring, _super);
    function Ring() {
        var _this = _super.call(this) || this;
        _this.j = 0;
        _this.h = 0;
        _this.q = new Size();
        _this.p = null;
        _this._ringControl = null;
        _this.b = null;
        _this.i = 0;
        _this.g = null;
        _this.d = null;
        _this.e = false;
        _this.p = { $type: Point_$type, x: 0, y: 0 };
        _this.q = new Size(1, 0, 0);
        _this.ringControl = ((function () {
            var $ret = new RingControl();
            $ret.ai = _this;
            return $ret;
        })());
        _this.g = new List$1(ArcItem.$, 0);
        _this.e = true;
        return _this;
    }
    Object.defineProperty(Ring.prototype, "ringControl", {
        get: function () {
            return this._ringControl;
        },
        set: function (a) {
            this._ringControl = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Ring.prototype, "c", {
        get: function () {
            return this.b;
        },
        set: function (a) {
            this.b = a;
            this.b.as.h(this.ringControl);
            if (this.ringControl != null) {
                this.ringControl.ak.s(a);
            }
        },
        enumerable: true,
        configurable: true
    });
    Ring.prototype.f = function () {
        if (this.ringControl != null && this.ringControl.ak.d()) {
            var a = void 0, b = void 0;
            a = this.p.x - this.c.dq.x;
            b = this.p.y - this.c.dq.y;
            this.ringControl.ak.v(a, b);
            return this.ringControl.an();
        }
        return false;
    };
    Ring.prototype.o = function () {
        if (this.ringControl != null) {
            this.ringControl.width = this.q.width;
            this.ringControl.height = this.q.height;
            this.c.as.h(this.ringControl);
            this.ringControl.ao = this.g;
        }
    };
    Ring.prototype.l = function (source_, a, b) {
        this.ringControl.as(source_, a, b);
    };
    Ring.prototype.k = function (source_) {
        this.ringControl.ar(source_);
    };
    Ring.prototype.m = function (source_, a, b) {
        this.ringControl.at(source_, a, b);
    };
    Ring.prototype.n = function (source_, a, b, c) {
        this.ringControl.au(source_, a, b, c);
    };
    Ring.$t = markType(Ring, 'Ring');
    return Ring;
}(Base));
export { Ring };
/**
 * @hidden
 */
var RingCollection = /** @class */ (function (_super) {
    tslib_1.__extends(RingCollection, _super);
    function RingCollection() {
        return _super.call(this, Ring.$, 0) || this;
    }
    RingCollection.prototype.p = function () {
        var e_4, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                if (a.e) {
                    var b = 0;
                    var c = a.ringControl.arcs.count;
                    while (b < c) {
                        a.ringControl.arcs.destroy(a.ringControl.arcs.item(b));
                        b++;
                    }
                    a.ringControl.arcs.count = 0;
                    a.ringControl = null;
                }
            }
        }
        catch (e_4_1) { e_4 = { error: e_4_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_4) throw e_4.error; }
        }
        _super.prototype.p.call(this);
    };
    RingCollection.prototype.u = function (a) {
        var b = this._inner[a];
        if (b.e) {
            b.ringControl.arcs.destroy(b.ringControl.arcs.item(a));
            b.ringControl.arcs.count = 0;
            b.ringControl = null;
        }
        _super.prototype.u.call(this, a);
    };
    RingCollection.$t = markType(RingCollection, 'RingCollection', ObservableCollection$1.$.specialize(Ring.$));
    return RingCollection;
}(ObservableCollection$1));
export { RingCollection };
/**
 * @hidden
 */
var RingControl = /** @class */ (function (_super) {
    tslib_1.__extends(RingControl, _super);
    function RingControl() {
        var _this = _super.call(this) || this;
        _this.ak = null;
        _this.ah = null;
        _this.arcs = null;
        _this.ao = null;
        _this.a0 = null;
        _this.propertyChanged = null;
        _this.propertyUpdated = null;
        _this.ab = RingControl.$;
        _this.ak = _this.aj();
        _this.ax(_this.ak);
        _this.ak.r();
        _this.arcs = ((function () {
            var $ret = new Pool$1(Arc.$);
            $ret.create = runOn(_this.ak, _this.ak.a);
            $ret.activate = runOn(_this.ak, _this.ak.l);
            $ret.disactivate = runOn(_this.ak, _this.ak.n);
            $ret.destroy = runOn(_this.ak, _this.ak.m);
            return $ret;
        })());
        return _this;
    }
    Object.defineProperty(RingControl.prototype, "al", {
        get: function () {
            return this.ai.c;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(RingControl.prototype, "ai", {
        get: function () {
            return this.ah;
        },
        set: function (a) {
            this.ah = a;
            if (this.ah == null) {
                this.ak.s(null);
            }
            else {
                this.ak.s(this.ah.c);
            }
        },
        enumerable: true,
        configurable: true
    });
    RingControl.prototype.aj = function () {
        return new RingControlView(this);
    };
    RingControl.prototype.ax = function (a) {
    };
    RingControl.prototype.az = function (a, b, c) {
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
        if (this.propertyUpdated != null) {
            this.propertyUpdated(this, new PropertyUpdatedEventArgs(a, b, c));
        }
    };
    RingControl.prototype.aw = function () {
        this.an();
    };
    RingControl.prototype.an = function () {
        var e_5, _a;
        if (this.ao == null) {
            return false;
        }
        if (!this.ak.d()) {
            return false;
        }
        var a = 0;
        var b = false;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.ao)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                var d = this.arcs.item(a);
                d.hb = c;
                if (d.cl != this.ai.h) {
                    d.cl = this.ai.h;
                }
                if ((d.width != this.ai.q.width || d.height != this.ai.q.height) && d.as.r()) {
                    d.width = this.ai.q.width;
                    d.height = this.ai.q.height;
                    this.ak.ab(d);
                    b = true;
                }
                if (d.ct != c.k) {
                    d.ct = c.k;
                }
                if (d.hi != c.i) {
                    d.hi = c.i;
                }
                if (d.itemsSource != c.h) {
                    d.itemsSource = c.h;
                }
                if (d.ag != c.a) {
                    d.ag = c.a;
                }
                this.ak.t(d, 0, 0);
                a++;
            }
        }
        catch (e_5_1) { e_5 = { error: e_5_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_5) throw e_5.error; }
        }
        this.arcs.count = a;
        return b;
    };
    RingControl.prototype.ay = function (a) {
        this.ak.w(a);
    };
    RingControl.prototype.av = function () {
        this.ak.q();
    };
    RingControl.prototype.ap = function () {
        return this.ak.j();
    };
    RingControl.prototype.as = function (source_, a, b) {
        for (var c = 0; c < this.arcs.count; c++) {
            this.arcs.item(c).es(source_, a, b);
        }
    };
    RingControl.prototype.ar = function (source_) {
        for (var a = 0; a < this.arcs.count; a++) {
            this.arcs.item(a).eq(source_);
        }
    };
    RingControl.prototype.at = function (source_, a, b) {
        for (var c = 0; c < this.arcs.count; c++) {
            this.arcs.item(c).et(source_, a, b);
        }
    };
    RingControl.prototype.au = function (source_, a, b, c) {
        for (var d = 0; d < this.arcs.count; d++) {
            this.arcs.item(d).eu(source_, a, b, c);
        }
    };
    RingControl.$t = markType(RingControl, 'RingControl', Control.$, [INotifyPropertyChanged_$type]);
    return RingControl;
}(Control));
export { RingControl };
/**
 * @hidden
 */
var RingSeriesCollection = /** @class */ (function (_super) {
    tslib_1.__extends(RingSeriesCollection, _super);
    function RingSeriesCollection() {
        return _super.call(this, RingSeriesBase.$, 0) || this;
    }
    RingSeriesCollection.$t = markType(RingSeriesCollection, 'RingSeriesCollection', ObservableCollection$1.$.specialize(RingSeriesBase.$));
    return RingSeriesCollection;
}(ObservableCollection$1));
export { RingSeriesCollection };
/**
 * @hidden
 */
var SliceItem = /** @class */ (function (_super) {
    tslib_1.__extends(SliceItem, _super);
    function SliceItem() {
        var _this = _super.call(this) || this;
        _this.e = 0;
        _this.d = 0;
        _this.a = null;
        _this.f = 0;
        _this.b = null;
        _this.g = null;
        _this.c = false;
        return _this;
    }
    SliceItem.$t = markType(SliceItem, 'SliceItem');
    return SliceItem;
}(Base));
export { SliceItem };
/**
 * @hidden
 */
var SliceCollection = /** @class */ (function (_super) {
    tslib_1.__extends(SliceCollection, _super);
    function SliceCollection() {
        var _this = _super.call(this, SliceItem.$, 0) || this;
        _this.ae = false;
        _this.ag = false;
        return _this;
    }
    SliceCollection.prototype.r = function (a, b) {
        if (this.contains(b)) {
            return;
        }
        var c = this.ah(b.b);
        if (c != -1) {
            _super.prototype.x.call(this, c, b);
        }
        else {
            _super.prototype.r.call(this, a, b);
            if (this.ae) {
                if (this.ag) {
                    b.b.isSelected = true;
                }
                else {
                    b.b.isExploded = true;
                }
            }
        }
    };
    SliceCollection.prototype.x = function (a, b) {
        if (this.ae) {
            if (this.ag) {
                this._inner[a].b.isSelected = false;
            }
            else {
                this._inner[a].b.isExploded = false;
            }
        }
        _super.prototype.x.call(this, a, b);
    };
    SliceCollection.prototype.u = function (a) {
        var b = this._inner[a];
        _super.prototype.u.call(this, a);
        if (this.ae) {
            if (this.ag) {
                b.b.isSelected = false;
            }
            else {
                b.b.isExploded = false;
            }
        }
    };
    SliceCollection.prototype.remove = function (a) {
        var b = this.ah(a.b);
        if (b != -1) {
            this.u(b);
            return true;
        }
        else {
            return false;
        }
    };
    SliceCollection.prototype.p = function () {
        while (this.count > 0) {
            this.u(0);
        }
    };
    SliceCollection.prototype.ah = function (a) {
        for (var b = 0; b < this.count; b++) {
            if (this._inner[b].b == a) {
                return b;
            }
        }
        return -1;
    };
    SliceCollection.$t = markType(SliceCollection, 'SliceCollection', ObservableCollection$1.$.specialize(SliceItem.$));
    return SliceCollection;
}(ObservableCollection$1));
export { SliceCollection };
/**
 * @hidden
 */
var XamDoughnutChart = /** @class */ (function (_super) {
    tslib_1.__extends(XamDoughnutChart, _super);
    function XamDoughnutChart() {
        var _this = _super.call(this) || this;
        _this.al = new RingSeriesCollection();
        _this.aj = new RingCollection();
        _this.ap = ((function () {
            var $ret = new SliceCollection();
            $ret.ae = true;
            $ret.ag = true;
            return $ret;
        })());
        _this.ao = ((function () {
            var $ret = new SliceCollection();
            $ret.ae = true;
            $ret.ag = false;
            return $ret;
        })());
        _this.ah = null;
        _this.a0 = NaN;
        _this.az = 1;
        _this.au = null;
        _this.sliceClick = null;
        _this.propertyChanged = null;
        _this.propertyUpdated = null;
        _this.holeDimensionsChanged = null;
        var a = _this.at();
        _this.bv(a);
        a.s();
        _this.ab = XamDoughnutChart.$;
        _this.ah = function (b, c) { return _this.bz(b, c.propertyName, c.oldValue, c.newValue); };
        _this.propertyUpdated = delegateCombine(_this.propertyUpdated, _this.ah);
        var b = _this.series;
        b.collectionChanged = delegateCombine(b.collectionChanged, runOn(_this, _this.b6));
        return _this;
    }
    Object.defineProperty(XamDoughnutChart.prototype, "ak", {
        get: function () {
            return this.aj;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "series", {
        get: function () {
            return this.al;
        },
        enumerable: true,
        configurable: true
    });
    XamDoughnutChart.prototype.b6 = function (a, b) {
        var e_6, _a;
        var c = new List$1(RingSeriesBase.$, 0);
        if (b.oldItems != null) {
            try {
                for (var _b = tslib_1.__values(fromEn(b.oldItems)), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var d = _c.value;
                    if (b.newItems == null || !b.newItems.contains(d)) {
                        d.cb();
                        this.au.w(d);
                    }
                }
            }
            catch (e_6_1) { e_6 = { error: e_6_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_6) throw e_6.error; }
            }
        }
        this.bx();
        this.b2();
    };
    Object.defineProperty(XamDoughnutChart.prototype, "a3", {
        get: function () {
            return this.c(XamDoughnutChart.cc);
        },
        set: function (a) {
            this.h(XamDoughnutChart.cc, a);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "ar", {
        get: function () {
            return this.ap;
        },
        set: function (a) {
            this.ap.clear();
            this.ap.ae = false;
            this.ap = a;
            this.ap.ae = true;
            this.ap.ag = true;
            for (var b = 0; b < this.ap.count; b++) {
                this.ap._inner[b].b.isSelected = true;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "aq", {
        get: function () {
            return this.ao;
        },
        set: function (a) {
            this.ao.clear();
            this.ao.ae = false;
            this.ao = a;
            this.ao.ae = true;
            this.ao.ag = false;
            for (var b = 0; b < this.ao.count; b++) {
                this.ao._inner[b].b.isExploded = true;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "a4", {
        get: function () {
            return this.a0;
        },
        set: function (a) {
            var b = this.a0;
            this.a0 = a;
            this.b1("PixelScalingRatio", b, this.a0);
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(XamDoughnutChart.prototype, "a1", {
        get: function () {
            return this.az;
        },
        set: function (a) {
            var b = this.az;
            this.az = a;
            this.b1("ActualPixelScalingRatio", b, this.az);
        },
        enumerable: true,
        configurable: true
    });
    XamDoughnutChart.prototype.destroy = function () {
        var e_7, _a;
        this.au.v(null);
        try {
            for (var _b = tslib_1.__values(fromEnum(this.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                a.cb();
            }
        }
        catch (e_7_1) { e_7 = { error: e_7_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_7) throw e_7.error; }
        }
    };
    XamDoughnutChart.prototype.b5 = function (a, b) {
        if (b) {
            this.ar.add(a);
        }
        else {
            this.ar.remove(a);
        }
    };
    XamDoughnutChart.prototype.bj = function (a, b) {
        if (b) {
            this.aq.add(a);
        }
        else {
            this.aq.remove(a);
        }
    };
    XamDoughnutChart.prototype.bz = function (a, b, c, d) {
        var e_8, _a, e_9, _b, e_10, _c, e_11, _d, e_12, _e;
        switch (b) {
            case XamDoughnutChart.$$p[5]:
                try {
                    for (var _f = tslib_1.__values(fromEnum(this.series)), _g = _f.next(); !_g.done; _g = _f.next()) {
                        var e = _g.value;
                        e.du = d;
                    }
                }
                catch (e_8_1) { e_8 = { error: e_8_1 }; }
                finally {
                    try {
                        if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
                    }
                    finally { if (e_8) throw e_8.error; }
                }
                break;
            case XamDoughnutChart.$$p[0]:
                for (var f = 0; f < this.aj.count; f++) {
                    try {
                        for (var _h = (e_9 = void 0, tslib_1.__values(fromEnum(this.aj._inner[f].ringControl.arcs.a))), _j = _h.next(); !_j.done; _j = _h.next()) {
                            var g = _j.value;
                            g.bp = this.av;
                        }
                    }
                    catch (e_9_1) { e_9 = { error: e_9_1 }; }
                    finally {
                        try {
                            if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
                        }
                        finally { if (e_9) throw e_9.error; }
                    }
                }
                break;
            case XamDoughnutChart.$$p[1]:
                for (var h = 0; h < this.aj.count; h++) {
                    try {
                        for (var _k = (e_10 = void 0, tslib_1.__values(fromEnum(this.aj._inner[h].ringControl.arcs.a))), _l = _k.next(); !_l.done; _l = _k.next()) {
                            var i = _l.value;
                            i.bq = this.aw;
                        }
                    }
                    catch (e_10_1) { e_10 = { error: e_10_1 }; }
                    finally {
                        try {
                            if (_l && !_l.done && (_c = _k.return)) _c.call(_k);
                        }
                        finally { if (e_10) throw e_10.error; }
                    }
                }
                break;
            case "PixelScalingRatio":
                var j = DeviceUtils.a(this.a4);
                if (isNaN_(j)) {
                    this.a1 = 1;
                }
                else {
                    this.a1 = j;
                }
                break;
            case "ActualPixelScalingRatio":
                try {
                    for (var _m = tslib_1.__values(fromEnum(this.aj)), _o = _m.next(); !_o.done; _o = _m.next()) {
                        var k = _o.value;
                        try {
                            for (var _p = (e_12 = void 0, tslib_1.__values(fromEnum(k.ringControl.arcs.a))), _q = _p.next(); !_q.done; _q = _p.next()) {
                                var l = _q.value;
                                l.cd = this.a1;
                            }
                        }
                        catch (e_12_1) { e_12 = { error: e_12_1 }; }
                        finally {
                            try {
                                if (_q && !_q.done && (_e = _p.return)) _e.call(_p);
                            }
                            finally { if (e_12) throw e_12.error; }
                        }
                    }
                }
                catch (e_11_1) { e_11 = { error: e_11_1 }; }
                finally {
                    try {
                        if (_o && !_o.done && (_d = _m.return)) _d.call(_m);
                    }
                    finally { if (e_11) throw e_11.error; }
                }
                break;
        }
    };
    XamDoughnutChart.prototype.at = function () {
        return new XamDoughnutChartView(this);
    };
    XamDoughnutChart.prototype.bv = function (a) {
        this.au = a;
    };
    XamDoughnutChart.prototype.b2 = function () {
        this.by();
        this.b4();
        this.b3();
        this.bw();
        this.au.z();
    };
    XamDoughnutChart.prototype.b4 = function () {
        var e_13, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.series)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                a.cp();
            }
        }
        catch (e_13_1) { e_13 = { error: e_13_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_13) throw e_13.error; }
        }
    };
    XamDoughnutChart.prototype.bw = function () {
        var a = this.au.ab;
        if (a.isEmpty || a.width == 0 || a.height == 0) {
            return;
        }
        var b = { $type: Point_$type, x: a.width / 2, y: a.height / 2 };
        var c = Math.min(a.width / 2, a.height / 2);
        var d = 0.9;
        if (this.series.count > 0) {
            d = this.series._inner[0].a3;
            if (isNaN_(d) || isInfinity(d) || d < 0) {
                d = 0;
            }
            else if (d > 1) {
                d = 1;
            }
        }
        var e = this.a3 * c / 100 * d;
        this.au.x(e * 2, e * 2);
        this.au.u(b.x - e, b.y - e);
    };
    XamDoughnutChart.prototype.b3 = function () {
        var e_14, _a, e_15, _b;
        var a = false;
        try {
            for (var _c = tslib_1.__values(fromEnum(this.aj)), _d = _c.next(); !_d.done; _d = _c.next()) {
                var b = _d.value;
                if (b.f()) {
                    a = true;
                }
            }
        }
        catch (e_14_1) { e_14 = { error: e_14_1 }; }
        finally {
            try {
                if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
            }
            finally { if (e_14) throw e_14.error; }
        }
        if (a) {
            try {
                for (var _e = tslib_1.__values(fromEnum(this.aj)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.c.as.l();
                }
            }
            catch (e_15_1) { e_15 = { error: e_15_1 }; }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
                }
                finally { if (e_15) throw e_15.error; }
            }
        }
    };
    XamDoughnutChart.prototype.by = function () {
        var e_16, _a;
        var a = this.au.ab;
        if (a.isEmpty || a.width == 0 || a.height == 0) {
            return;
        }
        var b = { $type: Point_$type, x: a.width / 2, y: a.height / 2 };
        var c = Math.min(a.width / 2, a.height / 2);
        var d = Math.max(a.width / 2, a.height / 2);
        if (a.width > a.height) {
            c = c + d;
            d = c - d;
            c = c - d;
        }
        var e = ((100 - this.a3) / 100 * c) / this.aj.count;
        var f = ((100 - this.a3) / 100 * d) / this.aj.count;
        var g = this.a3 * c / 100;
        var h = this.a3 * d / 100;
        var i = 1;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.aj)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var j = _c.value;
                var k = (g + (e * i));
                var l = (h + (f * i));
                j.i = e;
                j.q = new Size(1, k * 2, l * 2);
                j.p = { $type: Point_$type, x: b.x - k, y: b.y - l };
                j.h = 100 - (e / k * 100);
                j.o();
                i++;
            }
        }
        catch (e_16_1) { e_16 = { error: e_16_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_16) throw e_16.error; }
        }
    };
    XamDoughnutChart.prototype.bx = function () {
        var e_17, _a;
        this.aq.clear();
        this.ar.clear();
        this.aj.clear();
        this.au.j();
        this.au.i();
        var a = 0;
        for (var b = 0; b < this.series.count; b++) {
            var c = this.series._inner[b];
            c.at = this;
            this.au.h(c);
            var series_ = c;
            series_.externalObject.sychronizeCollections();
            var d = c.aq();
            try {
                for (var _b = (e_17 = void 0, tslib_1.__values(fromEnum(d))), _c = _b.next(); !_c.done; _c = _b.next()) {
                    var e = _c.value;
                    e.d = this;
                    e.j = a;
                    this.aj.add(e);
                    a++;
                }
            }
            catch (e_17_1) { e_17 = { error: e_17_1 }; }
            finally {
                try {
                    if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                }
                finally { if (e_17) throw e_17.error; }
            }
        }
    };
    XamDoughnutChart.prototype.bt = function () {
        if (this.au != null) {
            this.height = this.au.ab.height;
            this.width = this.au.ab.width;
        }
        this.b2();
    };
    XamDoughnutChart.prototype.bu = function (a, b) {
        var c = a;
        var d = c.he.c;
        if (d.ay) {
            return;
        }
        if (this.sliceClick != null) {
            this.sliceClick(a, b);
        }
    };
    XamDoughnutChart.prototype.b1 = function (a, b, c) {
        if (this.propertyChanged != null) {
            this.propertyChanged(this, new PropertyChangedEventArgs(a));
        }
        if (this.propertyUpdated != null) {
            this.propertyUpdated(this, new PropertyUpdatedEventArgs(a, b, c));
        }
    };
    XamDoughnutChart.prototype.onDetachedFromUI = function () {
        var e_18, _a, e_19, _b;
        this.au.r();
        for (var a = 0; a < this.aj.count; a++) {
            try {
                for (var _c = (e_18 = void 0, tslib_1.__values(fromEnum(this.aj._inner[a].ringControl.arcs.a))), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.onDetachedFromUI();
                }
            }
            catch (e_18_1) { e_18 = { error: e_18_1 }; }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
                }
                finally { if (e_18) throw e_18.error; }
            }
            try {
                for (var _e = (e_19 = void 0, tslib_1.__values(fromEnum(this.aj._inner[a].ringControl.arcs.b))), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.onDetachedFromUI();
                }
            }
            catch (e_19_1) { e_19 = { error: e_19_1 }; }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
                }
                finally { if (e_19) throw e_19.error; }
            }
        }
    };
    XamDoughnutChart.prototype.onAttachedToUI = function () {
        var e_20, _a, e_21, _b;
        this.au.q();
        for (var a = 0; a < this.aj.count; a++) {
            try {
                for (var _c = (e_20 = void 0, tslib_1.__values(fromEnum(this.aj._inner[a].ringControl.arcs.a))), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.onAttachedToUI();
                }
            }
            catch (e_20_1) { e_20 = { error: e_20_1 }; }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
                }
                finally { if (e_20) throw e_20.error; }
            }
            try {
                for (var _e = (e_21 = void 0, tslib_1.__values(fromEnum(this.aj._inner[a].ringControl.arcs.b))), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    c.onAttachedToUI();
                }
            }
            catch (e_21_1) { e_21 = { error: e_21_1 }; }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
                }
                finally { if (e_21) throw e_21.error; }
            }
        }
    };
    XamDoughnutChart.prototype.provideContainer = function (a) {
        this.au.v(a);
    };
    XamDoughnutChart.prototype.notifyResized = function () {
        this.au.y();
    };
    XamDoughnutChart.prototype.bd = function () {
        return this.au.g();
    };
    XamDoughnutChart.prototype.cf = function () {
        return this.au.aa;
    };
    XamDoughnutChart.prototype.a2 = function () {
        return this.au.d;
    };
    XamDoughnutChart.prototype.bk = function () {
        var a;
        var b;
        for (var c = 0; c < this.series.count; c++) {
            b = this.series._inner[c].aq();
            for (var d = 0; d < b.count; d++) {
                a = b._inner[d].ringControl.ak.h();
                for (var e = 0; e < a.count; e++) {
                    a._inner[e].el();
                }
            }
        }
    };
    XamDoughnutChart.prototype.bs = function () {
        if (this.holeDimensionsChanged != null) {
            this.holeDimensionsChanged(this, new HoleDimensionsChangedEventArgs(this.cf(), this.a2()));
        }
    };
    XamDoughnutChart.prototype.as = function () {
        var a = new DoughnutChartVisualData();
        a.series = new RingSeriesVisualDataList();
        a.viewport = RectData.b(this.au.ab);
        this.au.o(a);
        return a;
    };
    XamDoughnutChart.prototype.bc = function () {
        var a = this.as();
        a.scaleByViewport();
        return a.serialize();
    };
    XamDoughnutChart.prototype._ay = function (a) {
        var _a, _b, b, e_22_1;
        var e_22, _c;
        return tslib_1.__generator(this, function (_d) {
            switch (_d.label) {
                case 0:
                    _d.trys.push([0, 5, 6, 7]);
                    _a = tslib_1.__values(fromEnum(this.series)), _b = _a.next();
                    _d.label = 1;
                case 1:
                    if (!!_b.done) return [3 /*break*/, 4];
                    b = _b.value;
                    if (!PieChartBase.by(a, b.itemsSource)) return [3 /*break*/, 3];
                    return [4 /*yield*/, b];
                case 2:
                    _d.sent();
                    _d.label = 3;
                case 3:
                    _b = _a.next();
                    return [3 /*break*/, 1];
                case 4: return [3 /*break*/, 7];
                case 5:
                    e_22_1 = _d.sent();
                    e_22 = { error: e_22_1 };
                    return [3 /*break*/, 7];
                case 6:
                    try {
                        if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
                    }
                    finally { if (e_22) throw e_22.error; }
                    return [7 /*endfinally*/];
                case 7: return [2 /*return*/];
            }
        });
    };
    XamDoughnutChart.prototype.ay = function (a) {
        var _this = this;
        return toEnum(function () { return _this._ay(a); });
    };
    XamDoughnutChart.prototype.bm = function (source_, a, b) {
        var e_23, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.ay(source_))), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                c.cf(a, b);
            }
        }
        catch (e_23_1) { e_23 = { error: e_23_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_23) throw e_23.error; }
        }
    };
    XamDoughnutChart.prototype.bp = function (source_, a, b, c) {
        var e_24, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.ay(source_))), _c = _b.next(); !_c.done; _c = _b.next()) {
                var d = _c.value;
                d.ch(a, b, c);
            }
        }
        catch (e_24_1) { e_24 = { error: e_24_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_24) throw e_24.error; }
        }
    };
    XamDoughnutChart.prototype.bl = function (source_) {
        var e_25, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.ay(source_))), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                a.ce();
            }
        }
        catch (e_25_1) { e_25 = { error: e_25_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_25) throw e_25.error; }
        }
    };
    XamDoughnutChart.prototype.bn = function (source_, a, b) {
        var e_26, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.ay(source_))), _c = _b.next(); !_c.done; _c = _b.next()) {
                var c = _c.value;
                c.cg(a, b);
            }
        }
        catch (e_26_1) { e_26 = { error: e_26_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_26) throw e_26.error; }
        }
    };
    XamDoughnutChart.$t = markType(XamDoughnutChart, 'XamDoughnutChart', Control.$, [INotifyPropertyChanged_$type, ILegendOwner_$type]);
    XamDoughnutChart.cc = DependencyProperty.i("InnerExtent", Number_$type, XamDoughnutChart.$, new PropertyMetadata(2, 40, function (a, b) {
        var c = b.newValue;
        if (c < 0 || c > 100) {
            if (b.oldValue != null) {
                a.a3 = b.oldValue;
            }
            return;
        }
        a.b2();
        a.b1("InnerExtent", b.oldValue, b.newValue);
    }));
    XamDoughnutChart.$$p = markDep(DependencyProperty, PropertyMetadata, XamDoughnutChart, 'b1', ['AllowSliceExplosion:av:b8', [0, true], 'AllowSliceSelection:aw:b9', [0, true], 'CenterData:a5:ca', [4, null], 'CenterDataTemplate:b7:cb', [DataTemplate.$, null], 'IsSurfaceInteractionDisabled:ax:cd', [0, false], 'SelectedStyle:cg:ce', [Style.$, null]]);
    return XamDoughnutChart;
}(Control));
export { XamDoughnutChart };
/**
 * @hidden
 */
var ArcView = /** @class */ (function (_super) {
    tslib_1.__extends(ArcView, _super);
    function ArcView(a) {
        var _this = _super.call(this, a) || this;
        _this.b4 = null;
        _this.b4 = a;
        return _this;
    }
    ArcView.prototype.b6 = function (a, b) {
        this.e.series = this.b4.he.c;
    };
    ArcView.prototype.b5 = function () {
        return this.f;
    };
    ArcView.prototype.b7 = function () {
        this.bb();
        this.bs = new Brush();
        var a = this.c.t();
        this.bs._fill = a.rootWrapper.getStyleProperty("color");
    };
    ArcView.$t = markType(ArcView, 'ArcView', PieChartBaseView.$);
    return ArcView;
}(PieChartBaseView));
export { ArcView };
/**
 * @hidden
 */
var RingControlView = /** @class */ (function (_super) {
    tslib_1.__extends(RingControlView, _super);
    function RingControlView(a) {
        var _this = _super.call(this) || this;
        _this.b = null;
        _this.f = new List$1(Arc.$, 0);
        _this.g = new List$1(Arc.$, 0);
        _this.i = null;
        _this.e = new Dictionary$2(Arc.$, DomRenderer_$type, 0);
        _this.c = null;
        _this.b = a;
        return _this;
    }
    RingControlView.prototype.a = function () {
        var a = new Arc();
        a.o = 0;
        a.n = 0;
        a.he = this.b.ai;
        this.f.add(a);
        this.z(a);
        if (a.eb != this.b.al.b5) {
            a.eb = this.b.al.b5;
        }
        a.cm = this.b.al.a0;
        a.at = this.b.al.am;
        a.di = this.b.al.bg;
        a.ao = this.b.al.aj;
        a.fu = this.b.al.cr;
        a.eg = this.b.al.b9;
        if (this.b.al.toolTip != null) {
            a.c0 = this.b.al.toolTip;
        }
        a.ha = this.b.al.dw;
        a.g6 = this.b.al.dr;
        a.ap = this.b.al.ak;
        a.cn = this.b.al.a1;
        a.co = this.b.al.a2;
        a.aq = this.b.al.al;
        a.dz = this.b.al.bv;
        a.g7 = this.b.al.ds;
        a.legend = this.b.al.legend;
        a.legendItemTemplate = this.b.al.legendItemTemplate;
        a.legendItemBadgeTemplate = this.b.al.legendItemBadgeTemplate;
        a.ah = this.b.al.ah;
        a.gx = this.b.al.dn;
        a.gy = this.b.al.dp;
        a.ct = this.b.al.a4;
        a.ag = this.b.al.ag;
        a.g8 = this.b.al.du;
        a.bv = true;
        a.cr = this.b.al.a3;
        a.bp = this.b.al.at.av;
        a.bq = this.b.al.at.aw;
        a.au = this.b.al.an;
        a.dv = this.b.al.br;
        a.cd = this.b.al.at.a1;
        return a;
    };
    RingControlView.prototype.l = function (a) {
        var b = this.e.item(a).rootWrapper;
        if (b != null) {
            b.show();
        }
        this.g.add(a);
    };
    RingControlView.prototype.n = function (a) {
        var b = this.e.item(a).rootWrapper;
        if (b != null) {
            b.hide();
        }
        this.g.remove(a);
    };
    RingControlView.prototype.m = function (a) {
        this.o(a);
        this.f.remove(a);
    };
    RingControlView.prototype.h = function () {
        return this.f;
    };
    RingControlView.prototype.r = function () {
    };
    RingControlView.prototype.aa = function () {
        this.b.aw();
    };
    RingControlView.prototype.t = function (a, b, c) {
        b = b + this.b.n;
        c = c + this.b.o;
        if (this.c != null) {
            b = b + this.c.n;
            c = c + this.c.o;
        }
        if (a.n != b || a.o != c) {
            a.n = b;
            a.o = c;
            this.u(a, this.e.item(a).rootWrapper);
        }
    };
    RingControlView.prototype.w = function (a) {
        var e_27, _a, e_28, _b;
        if (a == null) {
            this.b.arcs.count = 0;
            try {
                for (var _c = tslib_1.__values(fromEnum(this.f)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.destroy();
                }
            }
            catch (e_27_1) { e_27 = { error: e_27_1 }; }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
                }
                finally { if (e_27) throw e_27.error; }
            }
            this.f.clear();
            this.e.clear();
            this.g.clear();
            return;
        }
        this.i = a;
        this.i.rootWrapper.setStyleProperty("position", "relative");
        try {
            for (var _e = tslib_1.__values(fromEnum(this.f)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var c = _f.value;
                var d = this.e.item(c);
                this.i.append(d.rootWrapper);
                c.hc.b7();
            }
        }
        catch (e_28_1) { e_28 = { error: e_28_1 }; }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
            }
            finally { if (e_28) throw e_28.error; }
        }
        this.aa();
    };
    RingControlView.prototype.z = function (a) {
        var b = this.i.createElement("div");
        b.setStyleProperty("position", "absolute");
        this.e.addItem(a, this.i.getSubRenderer(b));
        this.k(a, b);
        this.u(a, b);
        if (this.i != null) {
            this.i.append(b);
        }
        a.provideContainer(this.e.item(a));
        b.setStyleProperty("position", "absolute");
    };
    RingControlView.prototype.k = function (a, b) {
        b.setStyleProperty("width", a.width.toString() + "px");
        b.setStyleProperty("height", a.height.toString() + "px");
    };
    RingControlView.prototype.u = function (a, b) {
        b.setStyleProperty("top", a.o.toString() + "px");
        b.setStyleProperty("left", a.n.toString() + "px");
    };
    RingControlView.prototype.o = function (a) {
        var b = this.e.item(a);
        b.rootWrapper.remove();
        this.e.removeItem(a);
        a.provideContainer(null);
    };
    RingControlView.prototype.ab = function (a) {
        this.k(a, a.hj().rootWrapper);
        a.ew(a.width, a.height);
    };
    RingControlView.prototype.d = function () {
        return this.i != null;
    };
    RingControlView.prototype.q = function () {
    };
    RingControlView.prototype.s = function (a) {
        this.c = a;
        if (a != null) {
            a.propertyUpdated = delegateCombine(a.propertyUpdated, runOn(this, this.y));
        }
    };
    RingControlView.prototype.y = function (a, b) {
        switch (b.propertyName) {
            case "LabelExtent":
                for (var c = 0; c < this.f.count; c++) {
                    this.f._inner[c].cm = b.newValue;
                }
                break;
            case "LabelMemberPath":
                for (var d = 0; d < this.f.count; d++) {
                    this.f._inner[d].di = b.newValue;
                }
                break;
            case "LabelsPosition":
                for (var e = 0; e < this.f.count; e++) {
                    this.f._inner[e].ao = EnumUtil.getEnumValue(LabelsPosition_$type, b.newValue);
                }
                break;
            case "LabelTemplate":
                for (var f = 0; f < this.f.count; f++) {
                    this.f._inner[f].fu = b.newValue;
                }
                break;
            case "ValueMemberPath":
                for (var g = 0; g < this.f.count; g++) {
                    this.f._inner[g].eg = b.newValue;
                }
                break;
            case "ToolTip":
                for (var h = 0; h < this.f.count; h++) {
                    this.f._inner[h].c0 = b.newValue;
                }
                break;
            case "LeaderLineVisibility":
                for (var i = 0; i < this.f.count; i++) {
                    this.f._inner[i].ha = EnumUtil.getEnumValue(Visibility_$type, b.newValue);
                }
                break;
            case "LeaderLineStyle":
                for (var j = 0; j < this.f.count; j++) {
                    this.f._inner[j].g6 = b.newValue;
                }
                break;
            case "LeaderLineType":
                for (var k = 0; k < this.f.count; k++) {
                    this.f._inner[k].ap = EnumUtil.getEnumValue(LeaderLineType_$type, b.newValue);
                }
                break;
            case "LeaderLineMargin":
                for (var l = 0; l < this.f.count; l++) {
                    this.f._inner[l].cn = b.newValue;
                }
                break;
            case "OthersCategoryThreshold":
                for (var m = 0; m < this.f.count; m++) {
                    this.f._inner[m].co = b.newValue;
                }
                break;
            case "OthersCategoryType":
                for (var n = 0; n < this.f.count; n++) {
                    this.f._inner[n].aq = EnumUtil.getEnumValue(OthersCategoryType_$type, b.newValue);
                }
                break;
            case "OthersCategoryText":
                for (var o = 0; o < this.f.count; o++) {
                    this.f._inner[o].dz = b.newValue;
                }
                break;
            case "OthersCategoryStyle":
                for (var p = 0; p < this.f.count; p++) {
                    this.f._inner[p].g7 = b.newValue;
                }
                break;
            case "Legend":
                for (var q = 0; q < this.f.count; q++) {
                    this.f._inner[q].legend = b.newValue;
                }
                break;
            case "LegendItemTemplate":
                for (var r = 0; r < this.f.count; r++) {
                    this.f._inner[r].legendItemTemplate = b.newValue;
                }
                break;
            case "LegendItemBadgeTemplate":
                for (var s = 0; s < this.f.count; s++) {
                    this.f._inner[s].legendItemBadgeTemplate = b.newValue;
                }
                break;
            case "Outlines":
                for (var t = 0; t < this.f.count; t++) {
                    this.f._inner[t].ah = b.newValue;
                }
                break;
            case "Brushes":
                for (var u = 0; u < this.f.count; u++) {
                    this.f._inner[u].ag = b.newValue;
                }
                break;
            case "SelectedStyle":
                for (var v = 0; v < this.f.count; v++) {
                    this.f._inner[v].g8 = b.newValue;
                }
                break;
            case "SelectedStyleResolved":
                for (var w = 0; w < this.f.count; w++) {
                    this.f._inner[w].g8 = b.newValue;
                }
                break;
            case "RadiusFactor":
                for (var x = 0; x < this.f.count; x++) {
                    this.f._inner[x].cr = b.newValue;
                }
                break;
        }
    };
    RingControlView.prototype.p = function () {
        var e_29, _a;
        try {
            for (var _b = tslib_1.__values(fromEnum(this.f)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var a = _c.value;
                a.el();
            }
        }
        catch (e_29_1) { e_29 = { error: e_29_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_29) throw e_29.error; }
        }
    };
    RingControlView.prototype.j = function () {
        return this.i;
    };
    RingControlView.prototype.v = function (a, b) {
        this.b.n = a;
        this.b.o = b;
        this.x();
    };
    RingControlView.prototype.x = function () {
        for (var a = 0; a < this.f.count; a++) {
            var b = this.f._inner[a];
            this.t(b, 0, 0);
        }
    };
    RingControlView.$t = markType(RingControlView, 'RingControlView');
    return RingControlView;
}(Base));
export { RingControlView };
/**
 * @hidden
 */
var RingSeriesBaseView = /** @class */ (function (_super) {
    tslib_1.__extends(RingSeriesBaseView, _super);
    function RingSeriesBaseView(a) {
        var _this = _super.call(this) || this;
        _this.c = null;
        _this.f = null;
        _this.g = null;
        _this.a = null;
        _this.b = null;
        _this.o = null;
        _this.d = null;
        _this.f = new List$1(RingControl.$, 0);
        _this.c = a;
        return _this;
    }
    RingSeriesBaseView.prototype.k = function () {
        this.c.legendItemTemplate = ((function () {
            var $ret = new DataTemplate();
            $ret.render = PieLegendTemplates.c;
            $ret.measure = PieLegendTemplates.a;
            return $ret;
        })());
        this.c.legendItemBadgeTemplate = ((function () {
            var $ret = new DataTemplate();
            $ret.render = PieLegendTemplates.b;
            $ret.measure = PieLegendTemplates.d;
            return $ret;
        })());
    };
    RingSeriesBaseView.prototype.h = function (a) {
        if (!this.f.contains(a)) {
            this.f.add(a);
        }
        if (this.g != null && (a.ap() != this.g)) {
            a.ay(this.g);
        }
    };
    RingSeriesBaseView.prototype.j = function (a, b, c, d, e) {
        var f = BrushUtil.e("chart", a, b, c);
        b = f.p2;
        c = f.p3;
        var g = new Array(b.count * 2);
        for (var h = 0; h < g.length; h += 2) {
            g[h] = "#fff";
            g[h + 1] = b.item(intDivide(h, 2))._fill;
        }
        var i = BrushUtil.e("doughnut", a, b, c, g);
        b = i.p2;
        c = i.p3;
        d = new Brush();
        d._fill = this.g.rootWrapper.getStyleProperty("color");
        e = FontUtil.getFont(a);
        return {
            p1: b,
            p2: c,
            p3: d,
            p4: e
        };
    };
    RingSeriesBaseView.prototype.n = function (a) {
        var e_30, _a, e_31, _b;
        if (a == null) {
            try {
                for (var _c = tslib_1.__values(fromEnum(this.f)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    b.ay(null);
                }
            }
            catch (e_30_1) { e_30 = { error: e_30_1 }; }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
                }
                finally { if (e_30) throw e_30.error; }
            }
            return;
        }
        this.g = a;
        var c;
        var d;
        var e;
        var f;
        var g = this.j(this.g, c, d, e, f);
        c = g.p1;
        d = g.p2;
        e = g.p3;
        f = g.p4;
        this.a = c;
        this.b = d;
        this.o = e;
        this.d = f;
        if (this.c.ag == null) {
            this.c.ag = this.a;
        }
        if (this.c.ah == null) {
            this.c.ah = this.b;
        }
        try {
            for (var _e = tslib_1.__values(fromEnum(this.f)), _f = _e.next(); !_f.done; _f = _e.next()) {
                var h = _f.value;
                h.ay(this.g);
            }
        }
        catch (e_31_1) { e_31 = { error: e_31_1 }; }
        finally {
            try {
                if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
            }
            finally { if (e_31) throw e_31.error; }
        }
    };
    RingSeriesBaseView.prototype.e = function () {
        return true;
    };
    RingSeriesBaseView.prototype.i = function () {
        this.n(null);
    };
    RingSeriesBaseView.prototype.l = function () {
        for (var a = 0; a < this.f.count; a++) {
            var b = this.f._inner[a];
            for (var c = 0; c < b.arcs.a.count; c++) {
                var d = b.arcs.a._inner[c];
                d.el();
            }
        }
    };
    RingSeriesBaseView.prototype.m = function (a, b) {
        this.c.n = a;
        this.c.o = b;
        this.c.dq = { $type: Point_$type, x: a, y: b };
    };
    RingSeriesBaseView.$t = markType(RingSeriesBaseView, 'RingSeriesBaseView');
    return RingSeriesBaseView;
}(Base));
export { RingSeriesBaseView };
/**
 * @hidden
 */
var XamDoughnutChartView = /** @class */ (function (_super) {
    tslib_1.__extends(XamDoughnutChartView, _super);
    function XamDoughnutChartView(a) {
        var _this = _super.call(this) || this;
        _this.a = null;
        _this.aa = null;
        _this.d = 0;
        _this.c = null;
        _this.ab = null;
        _this.f = null;
        _this.e = null;
        _this.b = null;
        _this.ab = Rect.empty;
        _this.aa = { $type: Point_$type, x: 0, y: 0 };
        _this.d = 0;
        _this.c = new List$1(RingSeriesBase.$, 0);
        _this.a = a;
        return _this;
    }
    XamDoughnutChartView.prototype.s = function () {
        this.p();
    };
    XamDoughnutChartView.prototype.z = function () {
    };
    XamDoughnutChartView.prototype.h = function (a) {
        if (!this.c.contains(a)) {
            a.cm(this.e);
            this.c.add(a);
        }
    };
    XamDoughnutChartView.prototype.w = function (a) {
        if (this.c.contains(a)) {
            a.cm(null);
            this.c.remove(a);
        }
    };
    XamDoughnutChartView.prototype.i = function () {
    };
    XamDoughnutChartView.prototype.y = function () {
        if (this.e == null) {
            return;
        }
        this.p();
        var a = this.e.rootWrapper.width();
        var b = this.e.rootWrapper.height();
        this.ab = new Rect(0, 0, 0, a, b);
        if (this.b != null) {
            this.b.bf = this.ab;
        }
        this.a.bt();
    };
    XamDoughnutChartView.prototype.v = function (a) {
        if (a == null) {
            if (this.b != null) {
                this.b.aq();
            }
            return;
        }
        var b = a;
        this.e = b;
        var c = this.e.rootWrapper.width();
        var d = this.e.rootWrapper.height();
        this.ab = new Rect(0, 0, 0, c, d);
        this.b = new DOMEventProxy(this.e.rootWrapper, this.e, false);
        this.b.bf = this.ab;
        var e = this.b;
        e.onMouseOver = delegateCombine(e.onMouseOver, runOn(this, this.m));
        var f = this.b;
        f.onMouseLeave = delegateCombine(f.onMouseLeave, runOn(this, this.l));
        var g = this.b;
        g.onMouseDown = delegateCombine(g.onMouseDown, runOn(this, this.k));
        var h = this.b;
        h.onMouseUp = delegateCombine(h.onMouseUp, runOn(this, this.n));
        this.y();
    };
    XamDoughnutChartView.prototype.t = function (a, b, c) {
        for (var d = this.c.count - 1; d >= 0; d--) {
            var e = this.c._inner[d];
            if (e.ay) {
                continue;
            }
            var f = e.as.f;
            for (var g = 0; g < f.count; g++) {
                var h = f._inner[g];
                var i = h.arcs.a;
                for (var j = 0; j < i.count; j++) {
                    var k = i._inner[j];
                    var l = { $type: Point_$type, x: a.x - k.n, y: a.y - k.o };
                    b(k.as, l);
                    if (c == "mouseUp") {
                        var m = k.hc.b5();
                        if (m != null) {
                            return;
                        }
                    }
                }
            }
        }
    };
    XamDoughnutChartView.prototype.n = function (a) {
        this.t(a, function (b, c) { return b.ak(c); }, "mouseUp");
    };
    XamDoughnutChartView.prototype.k = function (a) {
        this.t(a, function (b, c) { return b.ah(c); }, "mouseDown");
    };
    XamDoughnutChartView.prototype.l = function (a) {
        this.t(a, function (b, c) { return b.ai(c); }, "mouseLeave");
    };
    XamDoughnutChartView.prototype.m = function (a, b, c) {
        this.t(a, function (d, e) { return d.aj(e, b, c); }, "mouseOver");
    };
    XamDoughnutChartView.prototype.g = function () {
        return this.e.rootWrapper.getAttribute("id");
    };
    XamDoughnutChartView.prototype.u = function (a, b) {
        if (!this.ab.isEmpty && this.ab.width != 0 && this.ab.height != 0) {
            var c = this.aa.x;
            var d = this.aa.y;
            this.aa.x = this.ab.width / 2;
            this.aa.y = this.ab.height / 2;
            if (this.aa.x != c || this.aa.y != d) {
                this.a.bs();
            }
        }
    };
    XamDoughnutChartView.prototype.x = function (a, b) {
        var c = this.d;
        this.d = a / 2;
        if (c != this.d) {
            this.a.bs();
        }
    };
    XamDoughnutChartView.prototype.j = function () {
    };
    XamDoughnutChartView.prototype.o = function (a) {
        a.width = this.a.width;
        a.height = this.a.height;
        a.holeRadius = this.a.a2();
        for (var b = 0; b < this.a.series.count; b++) {
            a.series.add(new RingSeriesVisualData());
            a.series._inner[b].rings = new RingVisualDataList();
            a.series._inner[b].name = this.a.series._inner[b].name;
            a.series._inner[b].labelExtent = this.a.series._inner[b].a0;
            a.series._inner[b].leaderLineMargin = this.a.series._inner[b].a1;
            a.series._inner[b].leaderLineType = EnumUtil.getName(LeaderLineType_$type, this.a.series._inner[b].ak);
            a.series._inner[b].labelsPosition = EnumUtil.getName(LabelsPosition_$type, this.a.series._inner[b].aj);
            a.series._inner[b].leaderLineVisibility = this.a.series._inner[b].dw == 0;
            for (var c = 0; c < this.a.series._inner[b].aq().count; c++) {
                a.series._inner[b].rings.add(new RingVisualData());
                a.series._inner[b].rings._inner[c].arcs = new ArcVisualDataList();
                for (var d = 0; d < this.a.series._inner[b].aq()._inner[c].g.count; d++) {
                    a.series._inner[b].rings._inner[c].arcs.add(new ArcVisualData());
                    a.series._inner[b].rings._inner[c].arcs._inner[d].a = new SliceVisualDataList();
                    var _loop_4 = function (e) {
                        if (null == this_4.a.series._inner[b].aq()._inner[c].g._inner[d].g._inner[e].b) {
                            return "continue";
                        }
                        a.series._inner[b].rings._inner[c].arcs._inner[d].a.add(new SliceVisualData());
                        var f = new SliceVisualData();
                        var g = this_4.a.series._inner[b].aq()._inner[c].g._inner[d].g._inner[e].b;
                        f.visibility = g._visibility == 0;
                        f.endAngle = g.ax;
                        f.startAngle = g.a3;
                        f.radius = g.a2;
                        f.origin = PointData.b(g.b7);
                        f.explodedOrigin = PointData.b(g.b5);
                        f.index = g.a5;
                        f.isExploded = g.isExploded;
                        f.isSelected = g.isSelected;
                        f.outline = AppearanceHelper.a(g.b1);
                        f.backgroundPath = new PathVisualData(1, "slicePath", g.al.f());
                        a.series._inner[b].rings._inner[c].arcs._inner[d].a._inner[e] = f;
                        var h = g.aj;
                        if (null != h) {
                            a.series._inner[b].rings._inner[c].arcs._inner[d].a._inner[e].labelVisualData = ((function () {
                                var $ret = new DoughnutChartLabelVisualData();
                                $ret.labelSize = SizeData.b(RectUtil.z(h.ao));
                                $ret.labelValue = h.aj.ak;
                                return $ret;
                            })());
                            if (!isNaN_(h.n) && !isNaN_(h.o)) {
                                a.series._inner[b].rings._inner[c].arcs._inner[d].a._inner[e].labelVisualData.labelPosition = new PointData(h.n, h.o);
                            }
                        }
                    };
                    var this_4 = this;
                    for (var e = 0; e < this.a.series._inner[b].aq()._inner[c].g._inner[d].g.count; e++) {
                        _loop_4(e);
                    }
                }
            }
        }
    };
    XamDoughnutChartView.prototype.p = function () {
        var a = this.a.a4;
        var b = this.a.a1;
        if (!isNaN_(a) && a != 0) {
            return;
        }
        if (window.devicePixelRatio != undefined && window.devicePixelRatio != b) {
            this.a.a1 = window.devicePixelRatio;
        }
    };
    XamDoughnutChartView.prototype.r = function () {
        if (this.b != null) {
            this.b.bb(this.e.rootWrapper, "");
        }
    };
    XamDoughnutChartView.prototype.q = function () {
        this.p();
        if (this.b != null) {
            this.b.ap(this.e.rootWrapper, "");
        }
    };
    XamDoughnutChartView.$t = markType(XamDoughnutChartView, 'XamDoughnutChartView');
    return XamDoughnutChartView;
}(Base));
export { XamDoughnutChartView };
//# sourceMappingURL=Arc_combined.js.map