/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __extends, __values } from "tslib";
import { Base, Point_$type, fromEnum, markType } from "igniteui-angular-core";
import { PointList } from "./PointList";
import { PointCollection } from "igniteui-angular-core";
import { Rect } from "igniteui-angular-core";
import { intDivide } from "igniteui-angular-core";
/**
 * @hidden
 */
var SliceAppearance = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(SliceAppearance, _super);
    function SliceAppearance() {
        var _this = _super.call(this) || this;
        _this.l = 0;
        _this.k = 0;
        _this.ak = null;
        _this.al = null;
        _this.a = null;
        _this.b = null;
        _this.at = null;
        _this.am = null;
        _this.aj = null;
        _this.ai = null;
        _this.az = null;
        _this.z = null;
        _this.ac = null;
        _this.t = null;
        _this.ah = null;
        _this.g = false;
        _this.u = null;
        _this.r = 0;
        _this.av = Rect.empty;
        _this.aw = Rect.empty;
        _this.aa = null;
        _this.ab = null;
        _this.a1 = 0;
        _this.h = false;
        _this.q = 0;
        _this.m = 1;
        _this.ai = { $type: Point_$type, x: 0, y: 0 };
        _this.aj = { $type: Point_$type, x: 0, y: 0 };
        _this.al = { $type: Point_$type, x: 0, y: 0 };
        _this.am = { $type: Point_$type, x: 0, y: 0 };
        _this.ak = { $type: Point_$type, x: 0, y: 0 };
        return _this;
    }
    Object.defineProperty(SliceAppearance.prototype, "o", {
        get: function () {
            return this.l;
        },
        set: function (a) {
            this.l = a;
            this.y();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "n", {
        get: function () {
            return this.k;
        },
        set: function (a) {
            this.k = a;
            this.y();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "aq", {
        get: function () {
            return this.ak;
        },
        set: function (a) {
            this.ak = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "ar", {
        get: function () {
            return this.al;
        },
        set: function (a) {
            this.al = a;
            this.y();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "c", {
        get: function () {
            return this.a;
        },
        set: function (a) {
            this.a = a;
            this.y();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "e", {
        get: function () {
            return this.b;
        },
        set: function (a) {
            this.b = a;
            this.y();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "au", {
        get: function () {
            return this.at;
        },
        set: function (a) {
            this.at = a;
        },
        enumerable: false,
        configurable: true
    });
    SliceAppearance.prototype.y = function () {
    };
    SliceAppearance.prototype.x = function () {
        var e_1, _a, e_2, _b;
        var a = new PointCollection(0);
        if (this.e != null) {
            try {
                for (var _c = __values(fromEnum(this.e)), _d = _c.next(); !_d.done; _d = _c.next()) {
                    var b = _d.value;
                    a.add(b);
                }
            }
            catch (e_1_1) {
                e_1 = { error: e_1_1 };
            }
            finally {
                try {
                    if (_d && !_d.done && (_a = _c.return))
                        _a.call(_c);
                }
                finally {
                    if (e_1)
                        throw e_1.error;
                }
            }
        }
        else {
            a.add(this.ar);
            a.add(this.as);
        }
        if (this.c != null) {
            try {
                for (var _e = __values(fromEnum(this.c)), _f = _e.next(); !_f.done; _f = _e.next()) {
                    var c = _f.value;
                    a.add(c);
                }
            }
            catch (e_2_1) {
                e_2 = { error: e_2_1 };
            }
            finally {
                try {
                    if (_f && !_f.done && (_b = _e.return))
                        _b.call(_e);
                }
                finally {
                    if (e_2)
                        throw e_2.error;
                }
            }
            if (this.e != null && this.e.count > 0) {
                a.add(this.e._inner[0]);
            }
        }
        else {
            a.add(this.ap);
            a.add(this.ao);
            a.add(this.ar);
        }
        var d = 0, e = Math.min(intDivide(a.count, 2), 5);
        if (e > 1) {
            var f = a._inner[0];
            var g = 0, h = f.x, i = f.y;
            while (++d < e && g < 2) {
                f = a._inner[d];
                g = Math.abs(f.x - h) + Math.abs(f.y - i);
                if (g > 1) {
                    a.add({ $type: Point_$type, x: f.x, y: f.y });
                }
            }
        }
        this.au = a;
    };
    Object.defineProperty(SliceAppearance.prototype, "as", {
        get: function () {
            return this.am;
        },
        set: function (a) {
            this.am = a;
            this.y();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "ap", {
        get: function () {
            return this.aj;
        },
        set: function (a) {
            this.aj = a;
            this.y();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "ao", {
        get: function () {
            return this.ai;
        },
        set: function (a) {
            this.ai = a;
            this.y();
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "a0", {
        get: function () {
            return this.az;
        },
        set: function (a) {
            this.az = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "ad", {
        get: function () {
            return this.z;
        },
        set: function (a) {
            this.z = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "ag", {
        get: function () {
            return this.ac;
        },
        set: function (a) {
            this.ac = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "v", {
        get: function () {
            return this.t;
        },
        set: function (a) {
            this.t = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "an", {
        get: function () {
            return this.ah;
        },
        set: function (a) {
            this.ah = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "i", {
        get: function () {
            return this.g && this.t != null;
        },
        set: function (a) {
            this.g = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "item", {
        get: function () {
            return this.u;
        },
        set: function (a) {
            this.u = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "s", {
        get: function () {
            return this.r;
        },
        set: function (a) {
            this.r = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "ax", {
        get: function () {
            return this.av;
        },
        set: function (a) {
            this.av = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "ay", {
        get: function () {
            return this.aw;
        },
        set: function (a) {
            this.aw = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "ae", {
        get: function () {
            return this.aa;
        },
        set: function (a) {
            this.aa = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "af", {
        get: function () {
            return this.ab;
        },
        set: function (a) {
            this.ab = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "a2", {
        get: function () {
            return this.a1;
        },
        set: function (a) {
            this.a1 = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "j", {
        get: function () {
            return this.h;
        },
        set: function (a) {
            this.h = a;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(SliceAppearance.prototype, "p", {
        get: function () {
            return this.m;
        },
        set: function (a) {
            this.m = a;
        },
        enumerable: false,
        configurable: true
    });
    SliceAppearance.f = function (a, b, c, d, e) {
        if (a == null) {
            a = new SliceAppearance();
        }
        a.ad = c.ad;
        a.i = c.i;
        a.v = c.v;
        if (b.i && c.i) {
            a.an = { $type: Point_$type, x: (b.an.x * e) + (c.an.x * d), y: (b.an.y * e) + (c.an.y * d) };
        }
        else if (c.i) {
            a.an = { $type: Point_$type, x: c.an.x * d, y: c.an.y * d };
        }
        a.ao = { $type: Point_$type, x: (b.ao.x * e) + (c.ao.x * d), y: (b.ao.y * e) + (c.ao.y * d) };
        a.ap = { $type: Point_$type, x: (b.ap.x * e) + (c.ap.x * d), y: (b.ap.y * e) + (c.ap.y * d) };
        a.ar = { $type: Point_$type, x: (b.ar.x * e) + (c.ar.x * d), y: (b.ar.y * e) + (c.ar.y * d) };
        a.as = { $type: Point_$type, x: (b.as.x * e) + (c.as.x * d), y: (b.as.y * e) + (c.as.y * d) };
        a.aq = { $type: Point_$type, x: (b.aq.x * e) + (c.aq.x * d), y: (b.aq.y * e) + (c.aq.y * d) };
        if (c.c != null) {
            var f = b.c;
            if (f == null) {
                f = new PointList();
                f.add(b.ar);
                f.add(b.ao);
            }
            a.c = SliceAppearance.d(a.c, f, c.c, d, e);
        }
        else {
            a.c = null;
        }
        if (c.e != null) {
            var g = b.e;
            if (g == null) {
                g = new PointList();
                g.add(b.ap);
                g.add(b.as);
            }
            a.e = SliceAppearance.d(a.e, g, c.e, d, e);
        }
        else {
            a.e = null;
        }
        a.ag = c.ag;
        a.a0 = c.a0;
        a.item = c.item;
        a.s = c.s;
        a.x();
        return a;
    };
    SliceAppearance.d = function (a, b, c, d, e) {
        if (a == null) {
            a = new PointList();
        }
        if (b == null) {
            b = new PointList();
        }
        var f = b.count;
        var g = c.count;
        var h = Math.max(f, g);
        if (a.count < h) {
            a.s(a.count, new Array(h - a.count));
        }
        if (a.count > h) {
            a.v(h, a.count - h);
        }
        for (var i = 0; i < Math.min(f, g); ++i) {
            a._inner[i] = { $type: Point_$type, x: (b._inner[i].x * e) + (c._inner[i].x * d), y: (b._inner[i].y * e) + (c._inner[i].y * d) };
        }
        if (f < g) {
            var j = f > 0 ? b._inner[f - 1] : { $type: Point_$type, x: 0, y: 0 };
            for (var k = f; k < g; ++k) {
                a._inner[k] = { $type: Point_$type, x: (j.x * e) + (c._inner[k].x * d), y: (j.y * e) + (c._inner[k].y * d) };
            }
        }
        if (f > g) {
            var l = g > 0 ? c._inner[g - 1] : { $type: Point_$type, x: 0, y: 0 };
            for (var m = g; m < f; ++m) {
                a._inner[m] = { $type: Point_$type, x: (b._inner[m].x * e) + (l.x * d), y: (b._inner[m].y * e) + (l.y * d) };
            }
        }
        return a;
    };
    SliceAppearance.$t = markType(SliceAppearance, 'SliceAppearance');
    return SliceAppearance;
}(Base));
export { SliceAppearance };
