/*
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 { LinearScaler } from "./LinearScaler";
import { NumericScaler } from "./NumericScaler";
import { markType } from "igniteui-react-core/ES5/type";
import { ArrayAccessHelper } from "igniteui-react-core/ES5/ArrayAccessHelper";
/**
 * @hidden
 */
var HorizontalLinearScaler = /** @class */ (function (_super) {
    tslib_1.__extends(HorizontalLinearScaler, _super);
    function HorizontalLinearScaler() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    HorizontalLinearScaler.prototype.q = function (a, b) {
        if (!b.c.isEmpty) {
            var c = b.e.left + b.e.width * (a - b.d.left) / b.d.width;
            c = (c * b.d.width) + b.d.left;
            c = this.ae(c, NumericScaler.ac, b.c, b.a);
            return c;
        }
        return this.ae(a, b.e, b.d, b.a);
    };
    HorizontalLinearScaler.prototype.p = function (a, b) {
        if (!b.c.isEmpty) {
            var c = this.ad(a, NumericScaler.ac, b.c, b.a);
            c = (c - b.d.left) / b.d.width;
            c = b.d.left + b.d.width * (c - b.e.left) / b.e.width;
            return c;
        }
        return this.ad(a, b.e, b.d, b.a);
    };
    HorizontalLinearScaler.prototype.v = function (a, b, c, d) {
        var e;
        var f = d.e;
        var g = d.d;
        var h = d.c;
        var i = d.a;
        var j = !h.isEmpty;
        var k = this.m;
        var l = this.o;
        var m = h.left;
        var n = h.width;
        var o = f.left;
        var p = f.width;
        var q = g.left;
        var r = g.width;
        var s = 0;
        var t = 1;
        var u = ArrayAccessHelper.b(a);
        var v = false;
        if (u != null) {
            v = true;
        }
        for (var w = b; w < c; w++) {
            if (v) {
                e = u[w];
            }
            else {
                e = a.item(w);
            }
            if (j) {
                var x = (e - l) / (k);
                if (i) {
                    x = 1 - x;
                }
                x = m + n * (x - s) / t;
                var y = (x - (o * r)) / p;
                if (v) {
                    u[w] = y;
                }
                else {
                    a.item(w, y);
                }
            }
            else {
                var z = (e - l) / (k);
                if (i) {
                    z = 1 - z;
                }
                z = q + r * (z - o) / p;
                if (v) {
                    u[w] = z;
                }
                else {
                    a.item(w, z);
                }
            }
        }
    };
    HorizontalLinearScaler.prototype.ae = function (a, b, c, d) {
        var e = b.left + b.width * (a - c.left) / c.width;
        if (d) {
            e = 1 - e;
        }
        return this.o + e * (this.m);
    };
    HorizontalLinearScaler.prototype.ad = function (a, b, c, d) {
        var e = (a - this.o) / (this.m);
        if (d) {
            e = 1 - e;
        }
        return c.left + c.width * (e - b.left) / b.width;
    };
    HorizontalLinearScaler.$t = markType(HorizontalLinearScaler, 'HorizontalLinearScaler', LinearScaler.$);
    return HorizontalLinearScaler;
}(LinearScaler));
export { HorizontalLinearScaler };
