/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends, __generator, __values } from "tslib";
import { Base, fromEnum, toEnum, markType } from "igniteui-angular-core";
import { PathFigure } from "igniteui-angular-core";
import { PathGeometry } from "igniteui-angular-core";
import { NaNSegmenter } from "./NaNSegmenter";
import { PolyLineSegment } from "igniteui-angular-core";
/**
 * @hidden
 */
var PathRenderer = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(PathRenderer, _super);
    function PathRenderer(a) {
        var _rest = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            _rest[_i - 1] = arguments[_i];
        }
        var _this = _super.call(this) || this;
        _this.a = null;
        _this.b = 0;
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0:
                {
                    _this.b = 1;
                }
                break;
            case 1:
                {
                    var c = _rest[0];
                    _this.a = c;
                }
                break;
        }
        return _this;
    }
    PathRenderer.prototype.d = function (a, b, c) {
        var e_1, _a;
        var d = NaNSegmenter.c(b, this.b);
        var e = this.c(d, c);
        var f = new PathGeometry();
        try {
            for (var _b = __values(fromEnum(e)), _d = _b.next(); !_d.done; _d = _b.next()) {
                var g = _d.value;
                f.c.add(g);
            }
        }
        catch (e_1_1) {
            e_1 = { error: e_1_1 };
        }
        finally {
            try {
                if (_d && !_d.done && (_a = _b.return))
                    _a.call(_b);
            }
            finally {
                if (e_1)
                    throw e_1.error;
            }
        }
        a.ak = f;
    };
    PathRenderer.prototype._c = function (a, b) {
        var c, d, e, f, g;
        return __generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    c = 0;
                    _a.label = 1;
                case 1:
                    if (!(c < a.count))
                        return [3 /*break*/, 4];
                    d = a.item(c);
                    if (!(d.count >= 2))
                        return [3 /*break*/, 3];
                    e = new PathFigure();
                    f = d.item(0);
                    e._startPoint = f;
                    g = this.e(d, b);
                    e._segments.add(g);
                    return [4 /*yield*/, e];
                case 2:
                    _a.sent();
                    _a.label = 3;
                case 3:
                    c++;
                    return [3 /*break*/, 1];
                case 4: return [2 /*return*/];
            }
        });
    };
    PathRenderer.prototype.c = function (a, b) {
        var _this = this;
        return toEnum(function () { return _this._c(a, b); });
    };
    PathRenderer.prototype.e = function (a, b) {
        var c = new PolyLineSegment();
        if (this.a == null) {
            for (var d = 1; d < a.count; d++) {
                var e = a.item(d);
                c._points.add(e);
            }
        }
        else {
            var f = this.a.flatten(a, b);
            for (var g = 1; g < f.count; g++) {
                var h = f.item(g);
                c._points.add(h);
            }
        }
        return c;
    };
    PathRenderer.$t = markType(PathRenderer, 'PathRenderer');
    return PathRenderer;
}(Base));
export { PathRenderer };
