/*
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 { ScatterBase } from "./ScatterBase";
import { DependencyProperty } from "igniteui-react-core";
import { Point_$type, typeCast, runOn, markType, markDep } from "igniteui-react-core";
import { ScatterFrame } from "./ScatterFrame";
import { ScatterSplineSeriesView } from "./ScatterSplineSeriesView";
import { Clipper } from "igniteui-react-core";
import { ScalerParams } from "./ScalerParams";
import { OwnedPoint } from "./OwnedPoint";
import { PathGeometry } from "igniteui-react-core";
import { Numeric } from "igniteui-react-core";
import { PropertyMetadata } from "igniteui-react-core";
/**
 * @hidden
 */
var ScatterSplineSeries = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(ScatterSplineSeries, _super);
    function ScatterSplineSeries() {
        var _this = _super.call(this) || this;
        _this.ab = ScatterSplineSeries.$;
        _this.p8 = new ScatterFrame();
        _this.qa = new ScatterFrame();
        _this.p7 = new ScatterFrame();
        return _this;
    }
    ScatterSplineSeries.prototype.bp = function () {
        return new ScatterSplineSeriesView(this);
    };
    ScatterSplineSeries.prototype.kp = function (a, b, c, d) {
        _super.prototype.kp.call(this, a, b, c, d);
        switch (b) {
            case ScatterSplineSeries.$$p[0]:
                this.k3(false);
                this.ka();
                break;
        }
    };
    ScatterSplineSeries.prototype.bj = function () {
        if (this.bk == 0) {
            return 2;
        }
        else {
            return _super.prototype.bj.call(this);
        }
    };
    ScatterSplineSeries.prototype.ru = function (a, b) {
        var _this = this;
        _super.prototype.ru.call(this, a, b);
        a.m.clear();
        a.u.clear();
        var c = b.bv;
        var d = b.bu;
        var e = this.getEffectiveViewport1(b);
        var f = this.fq * this.fq;
        var g = Math.min(this.qi != null ? this.qi.count : 0, this.qj != null ? this.qj.count : 0);
        var h = new ScalerParams(0, c, d, this.p3.d, e);
        var i = ((function () {
            var $ret = new ScalerParams(0, c, d, _this.p3.e, e);
            $ret.b = _this.fa();
            return $ret;
        })());
        var j = function (k) { return _this.p3.a.dz(_this.qi.item(k), h); };
        var k = function (l) { return _this.p3.b.dz(_this.qj.item(l), i); };
        var l = ((function () {
            var $ret = new Clipper(0, d, false);
            $ret.i = a.m;
            return $ret;
        })());
        for (var m = 0; m < g;) {
            var n = m;
            ++m;
            while (m < g && this.sv(j, k, n, m) < f) {
                ++m;
            }
            if (g > this.q3) {
                l.j(this.sz(j, k, n, m - 1));
            }
            else {
                var o = new OwnedPoint();
                o.c = { $type: Point_$type, x: j(n), y: k(n) };
                o.a = this.cd.item(n);
                if (!a.u.containsKey(o.a)) {
                    a.u.addItem(o.a, o);
                }
            }
        }
        if (g > this.q3) {
            l.i = null;
        }
    };
    ScatterSplineSeries.prototype.sz = function (a, b, c, d) {
        if (c == d) {
            return { $type: Point_$type, x: a(c), y: b(c) };
        }
        var e = 0;
        var f = 0;
        var g = (d - c + 1);
        for (var h = c; h <= d; ++h) {
            e += a(h);
            f += b(h);
        }
        return { $type: Point_$type, x: e / g, y: f / g };
    };
    ScatterSplineSeries.prototype.sv = function (a, b, c, d) {
        var e = a(d) - a(c);
        var f = b(d) - b(c);
        return e * e + f * f;
    };
    ScatterSplineSeries.prototype.get_qq = function () {
        return true;
    };
    ScatterSplineSeries.prototype.jl = function (a, b) {
        _super.prototype.jl.call(this, a, b);
        var c = typeCast(ScatterSplineSeriesView.$, b);
        c.c4(false);
    };
    ScatterSplineSeries.prototype.r5 = function (a, b) {
        this.jl(false, b);
        _super.prototype.r5.call(this, a, b);
        this.rx(a);
        var c = typeCast(ScatterSplineSeriesView.$, b);
        var d = c.dg;
        this.qf.ax(this, this.qv(), runOn(this, this.pr));
        var e = false;
        var f = this.qf.b;
        if (f != null) {
            e = true;
        }
        if (e) {
            this.rq(-1, this.qi.count, b.q);
        }
        this.qf.ad(d, true, false, true, false);
        c.dg.ak = new PathGeometry();
        c.dg.ak.c = Numeric.h(a.m.count, function (g) { return a.m._inner[g].x; }, function (g) { return a.m._inner[g].y; }, this.sw);
    };
    ScatterSplineSeries.$t = markType(ScatterSplineSeries, 'ScatterSplineSeries', ScatterBase.$);
    ScatterSplineSeries.$$p = markDep(DependencyProperty, PropertyMetadata, ScatterSplineSeries, 'raisePropertyChanged', ['Stiffness:sw:sy', [1, 0.5]]);
    return ScatterSplineSeries;
}(ScatterBase));
export { ScatterSplineSeries };
//# sourceMappingURL=ScatterSplineSeries.js.map
