/*
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 { Base, fromEnum, markType } from "igniteui-react-core/ES5/type";
import { StringBuilder } from "igniteui-react-core/ES5/StringBuilder";
import { isNaN_ } from "igniteui-react-core/ES5/number";
/**
 * @hidden
 */
var DoughnutChartVisualData = /** @class */ (function (_super) {
    tslib_1.__extends(DoughnutChartVisualData, _super);
    function DoughnutChartVisualData() {
        var _this = _super.call(this) || this;
        _this._series = null;
        _this._height = 0;
        _this._width = 0;
        _this._holeRadius = 0;
        _this._dipScalingRatio = 0;
        _this._viewport = null;
        _this.dipScalingRatio = 1;
        return _this;
    }
    Object.defineProperty(DoughnutChartVisualData.prototype, "series", {
        get: function () {
            return this._series;
        },
        set: function (a) {
            this._series = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DoughnutChartVisualData.prototype, "height", {
        get: function () {
            return this._height;
        },
        set: function (a) {
            this._height = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DoughnutChartVisualData.prototype, "width", {
        get: function () {
            return this._width;
        },
        set: function (a) {
            this._width = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DoughnutChartVisualData.prototype, "holeRadius", {
        get: function () {
            return this._holeRadius;
        },
        set: function (a) {
            this._holeRadius = a;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(DoughnutChartVisualData.prototype, "dipScalingRatio", {
        get: function () {
            return this._dipScalingRatio;
        },
        set: function (a) {
            this._dipScalingRatio = a;
        },
        enumerable: true,
        configurable: true
    });
    DoughnutChartVisualData.prototype.scaleByViewport = function () {
        var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
        if (this.series != null) {
            try {
                for (var _e = tslib_1.__values(fromEnum(this.series)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var a = _f.value;
                    try {
                        for (var _g = tslib_1.__values(fromEnum(a.rings)), _h = _g.next(); !_h.done; _h = _g.next()) {
                            var b = _h.value;
                            try {
                                for (var _j = tslib_1.__values(fromEnum(b.arcs)), _k = _j.next(); !_k.done; _k = _j.next()) {
                                    var c = _k.value;
                                    try {
                                        for (var _l = tslib_1.__values(fromEnum(c.a)), _m = _l.next(); !_m.done; _m = _l.next()) {
                                            var d = _m.value;
                                            d.scaleByViewport(this.viewport);
                                        }
                                    }
                                    catch (e_4_1) { e_4 = { error: e_4_1 }; }
                                    finally {
                                        try {
                                            if (_m && !_m.done && (_d = _l.return)) _d.call(_l);
                                        }
                                        finally { if (e_4) throw e_4.error; }
                                    }
                                }
                            }
                            catch (e_3_1) { e_3 = { error: e_3_1 }; }
                            finally {
                                try {
                                    if (_k && !_k.done && (_c = _j.return)) _c.call(_j);
                                }
                                finally { if (e_3) throw e_3.error; }
                            }
                        }
                    }
                    catch (e_2_1) { e_2 = { error: e_2_1 }; }
                    finally {
                        try {
                            if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
                        }
                        finally { if (e_2) throw e_2.error; }
                    }
                }
            }
            catch (e_1_1) { e_1 = { error: e_1_1 }; }
            finally {
                try {
                    if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
                }
                finally { if (e_1) throw e_1.error; }
            }
        }
    };
    DoughnutChartVisualData.prototype.serialize = function () {
        var a = new StringBuilder(0);
        var b = true;
        a.u("{");
        if (!isNaN_(this.width)) {
            if (b) {
                b = false;
            }
            else {
                a.l(", ");
            }
            a.l("width: ");
            a.u(this.width.toString());
        }
        if (!isNaN_(this.height)) {
            if (b) {
                b = false;
            }
            else {
                a.l(", ");
            }
            a.l("height: ");
            a.u(this.height.toString());
        }
        if (!isNaN_(this.holeRadius)) {
            if (b) {
                b = false;
            }
            else {
                a.l(", ");
            }
            a.l("holeRadius: ");
            a.u(this.holeRadius.toString());
        }
        if (this.viewport != null) {
            if (b) {
                b = false;
            }
            else {
                a.l(", ");
            }
            a.u("viewport: {");
            a.l("left: " + this.viewport.left + ", top: " + this.viewport.top + ", width: " + this.viewport.width + ", height: " + this.viewport.height);
            a.u("}");
        }
        if (this.series != null) {
            if (b) {
                b = false;
            }
            else {
                a.l(", ");
            }
            a.u("series: [");
            for (var c = 0; c < this.series.count; c++) {
                if (c != 0) {
                    a.l(", ");
                }
                a.l(this.series._inner[c].serialize());
            }
            a.u("]");
        }
        if (!b) {
            a.l(", ");
        }
        a.l("dipScalingRatio: " + this.dipScalingRatio.toString());
        a.u("}");
        return a.toString();
    };
    Object.defineProperty(DoughnutChartVisualData.prototype, "viewport", {
        get: function () {
            return this._viewport;
        },
        set: function (a) {
            this._viewport = a;
        },
        enumerable: true,
        configurable: true
    });
    DoughnutChartVisualData.$t = markType(DoughnutChartVisualData, 'DoughnutChartVisualData');
    return DoughnutChartVisualData;
}(Base));
export { DoughnutChartVisualData };
